BillboardGraphic

Hello everyone!

I've been wondering if there is a way to get the computeScreenSpacePosition of a billboardgraphic? I know computeScreenSpacePosition() exists for Billboard, but BillboardGraphic doesn't have that. Is there a way to either access the "Billboard" side of the BillboardGraphic or something? All of the objects on my globe is a CzmlDataSource. I would really like to get the billboard's X Y position of the screen.

Thanks!

For those looking for this answer, please check the following area:

console.log(scene.primitive);

The list of all labels, billboards, etc are all in here (in it’s LABEL / BILLBOARD form, not LabelGraphic and BillboardGraphic). If you were like me and needed to access a method like computeScreenSpacePosition() which Label had but LabeGraphic doesn’t, please go to scene.primitive and access it.

Good luck!

We’re going to work into making this easier, but as you’ve already discovered, the id property of each primitive will be the Entity instance it corresponds to. So if you pick a primitive and want the entity, you can just access [primitive.id](http://primitive.id). From there you can use the lower level interface. Finding the entity inside of scene.primitives is a little tricker because it may be further encapsulated in a BillboardCollection or batched Primitive object.

After the next release, we’ll definitely look into making this easier (or in many cases, unnecessary by bringing parity to the higher-level objects).

Matthew,

Will this be on the upcoming release? =) As you have stated, from Primitive, you can find the Entity object related to it by going onto Primitive-id. But is there going to be the Reverse way of this on the upcoming patch?

I should add that I just think it be easier if I have a reference on those Entities that points back to their “related” primitive. Currently, I’m looping through each LabelCollections to see if the Primitive->Id is equal to the Entity I am looking for.

It’s a tricky problem to solve because the data and the visualization are separated by design. There’s no single way to represent an entity billboard, you can have multiple visualizers using the same billboard data to do different things. We may have something eventually, but I need to better understand the use cases before I’m comfortable further extending the API. I’m more interest in what you are trying to accomplish that requires you to have this information?

The case I am working on have lots of entities that uses billboards and labels. I need to use the ComputeScreenSpacePosition() method to figure out where the billboards and labels all are to determine which space is free (label declutter). By knowing its screen positioning, I can run a loop to figure out where the label can be offset to so that all the labels don’t overlap each other. =)

So it sounds like what you really want is automatic decluttering and if you had that, you wouldn’t really have a need for computing the position?

Sorry for late reply.

Not really. Being able to compute the position will help me accomplish several other stuff, such as finding where the label’s screen location is. With that, I’ll be able to put an icon (billboards… waiting and hoping for the future where Entities can have multiple billboards as said in this post:

https://groups.google.com/forum/#!searchin/cesium-dev/$20cesium-dev$20›$20make$20mutilpolygon$20as$20one$20entity/cesium-dev/l4LyRr3vd7g/-KCIRf95yZAJ

)

next to the label. This is an important feature for us. For instance, here is my entity:

billboard : Toyota-Supra-Vehicle-Icon.gif

label: Toyota Supra

icon to the left of the label : Toyota-Logo.png

icon to the right of the label: Japanese-flag.png

So this entity will show not only the vehicle and its name, but it’s brand name and what country it was made in (this is just an example). This would be another reason why i’d need to compute the position.

Thanks Matthew!

Out of curiosity, why not just draw those images and labels in the order you want onto a single canvas and use that as a billboard? The only problem I see with that strategy is it would be memory inefficient if you had thousands of billboards, but assuming that’s not the case it should work well. Unless maybe you need to pick each of the icons separately?