How to hide/remove (multiple) entities?

  1. There is “show” on graphic properties, but not on the entity itself. How to show/hide the whole entity? Enumerate and hide graphic props? Change availability?

  2. Tried to assign a parent and show/hide it trough availability to no avail. What is a recommended way to show/hide multiple entities? What is parent for?

  3. What about changing viewer.entities to CompositeEntityCollection and then adding/removing EntityCollections to show/hide stuff?

  4. What about CZML? Should I split stuff among DataSourses and add/remove them?

  5. Can this be done regardless of entity source?

  6. Is there a way to remove an entity through CZML?

Thank you

  1. We’re aware of this deficiency and will be added very soon, probably in the next release on March 2nd. A possible workaround would be to assign an empty TimeIntervalCollection instances to entity.availability.

  2. Right now the parent is simply for bookkeeping to enable UI devleopment, however in the next release we also plan on having child entities visibility tied to the parent as well.

3/4/5. The best answer here is to just wait for 1 & 2 to be done. You could add multiple DataSources, but removing/re-adding them is a much heavier operation that toggling the visibility on and off.

  1. there is a delete packet. I think the below syntax is the correct:

{

id : ‘entityID’

delete : true

}.

Hope that helps and thanks for the feedback.

Thank you, Matthew for your great reply. Did the show/hide on the entire Entity make it into the March 2nd release? Looking at the docs, I don't think so. What's the update? I can write a work-around, but would rather wait and put attention elsewhere. Thanks!

Unfortunately this didn’t go into March 2nd, but I really want to get it into the April 1st release, I’ll try to remember to update this thread when it goes into master.

In regards to #6… For an application that relies purely on CZML messages, is it more efficient to toggle the show flag or send a delete json packet to Cesium? Thank you.

Were these issues, especially #3, ever addressed?

Hello,

Please see this demo for show/hide entities: http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Show%20or%20Hide%20Entities.html&label=Beginner

Best,

Hannah

Thanks for the reference. I was wondering, however, if it were yet possible to remove a group (of like) of entities from viewer.entities, as opposed to just hiding them.

For instance in the example your posted, how could I remove all and only the boxes? It seems the only way to remove from an EntityCollection like viewer.entities is individually by id. But does there doesn't seem to exist something like viewer.entities.remove(boxes).

Nathan

Hi Nathan,

Yeah, I think the only way to currently remove multiple entities at once would be to loop through them and remove each one individually.

-Hannah

Hi,

Can properties of entities drawn in CZML be manipulated? I am trying to toggle fill property of a group of polygons at a time. I have added parent property. But it doesn’t seem to work. Anyone has faced this issue before? Any help is much appreciated :slight_smile:

Here is my sample code:

[

{

“id”:“document”,

“name”:“CZML Geometries: Polygon”,

“version”:“1.0”

},

{

“id”:“testParent”,

“description”:“test parent entity”

},

{

“id”:“id_1”,

“polygon”:{

“positions”:{

“cartographicDegrees”:[

-95,29,0,

-95,29,0,

-95,29,0,

-95,29,0,

-95,29,0

]

},

“extrudedHeight”:{

“number”:4

},

“height”:{

“number”:0

},

“fill”:false,

“parent”:“testParent”,

“outline”:true

}

}

]

Thanks,

MP