RE: [cesium-dev] Re: object timeout czml [SEC=UNCLASSIFIED]

72 views
Skip to first unread message

Fraser, James

unread,
May 9, 2017, 8:18:31 PM5/9/17
to cesiu...@googlegroups.com

UNCLASSIFIED

Thanks for the reply Rachel.

 

These options don’t wholly match my requirement.

 

Put more simply: after 30 seconds, I’d like the Cesium runtime to remove an entity from the active entitycollection, freeing memory.  I’d rather not write my own naïve “cull” code if the runtime can do it for me.

 

Since my use of Cesium is dynamic (I’m not that interested in the history), where-by I’m constructing CZML packets on arrival of network traffic server-side, I’d have to keep a list of all the current entities and their current “active time” either server or client side.  This way when I iterate through the entitycollection, I make a passing check to see how long each entity has been active, and if it’s been active for my 30 second requirement, mark it for deletion with a CZML delete packet.  If during these 30 seconds incoming data for a existing entity arrives, I’d “refresh” the timeout to having been active for 0 seconds.

 

I can do all of this, but you make the point that it’s expensive.  I could probably devise an asynchronous solution with callbacks, but why the complexity?  It would be useful if I could simply give an entity a property like “timeout” in the CZML and the Cesium runtime actuate a delete when currentTime reaches timeout.

 

From: cesiu...@googlegroups.com [mailto:cesiu...@googlegroups.com] On Behalf Of Rachel Hwang
Sent: Tuesday, 9 May 2017 11:50 PM
To: cesium-dev
Subject: [cesium-dev] Re: object timeout czml

 

Hi James,

 

Good question! It depends on what you mean by reap:

 

A) If you just want to remove a entity from the display (eg. hide it), you can use the CZML availability property (https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/CZML-Structure#availability), which will hide the entity at specified intervals. Note that this means the objects persist in memory -- if you were to scrub backwards in history, the hidden entities would return.

 

B) If you want to reclaim memory, totally erasing your entities, this can still be done client-side. If on the server-side you know the entity is going away, you can send a CZML delete request. However, if you don't know when the entity needs to disappear, then you can iterate through your list of entities (probably as an EntityCollection of your datasource), and remove any that don't need update. The issue is that for a large list of entities, doing this per-frame can get expensive, so I'd recommend only checking every X seconds instead.

 

If you share more details about your specific use-case, I can make some more specific recommendations. 

 

Hope that helps!

- Rachel

 

It depends on if he’s talking about removing an entity permanently from Cesium (for example, if he’s trying to reclaim memory for a long-running real-time application) or if he just wants it gone from the display.

a.       If it’s just removing it from the display, he should be using either the CZML availability property (if he knows the first and final positions) or just setting the extrapolation options so the entity times out in the display (see https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/InterpolatableProperty). In both cases, Cesium will know the lifespan of the object and remove it from the display automatically.  This also means if you scrub the timeline backward, the timed out entities will come back, because we have data for that time.

b.       If it’s the former (reclaiming memory) then that can be done client side as well, but it’s a little trickier depending on his requirements.  If he knows the entity is going away on the server, he can send a CZML delete request which will delete the entity on the client (this is server initiated though and sounds like he doesn’t know when it’s supposed to go away).  A second option would be do as you suggested, iterate through entities and remove any that haven’t need updated in X seconds.  This can be slow to do every frame, so you would probably want to do it every few seconds.  It’s also a little tricky because it’s not really possible to tell what the “last update” of an entity is.  If he’s just updating positions and they are definitely all SampledPositionProperties (which is likely), then the problem is a lot easier.  Either way, I would share some of this info and ask for more details about his specific use case.


On Monday, May 8, 2017 at 12:23:02 AM UTC-4, James Fraser wrote:

Hi,

 

Is there a simple way of giving a czml entity a timeout property that would effectively cause the runtime to automatically reap entities that have reached their timeout period?

 

I'd rather not manage a list of "active" entities server-side, where I'd either decide an entity should be kept active or otherwise removed.

 

I'm thinking currentTime and interval might provide this flexibility, but I'm unsure.

--
You received this message because you are subscribed to a topic in the Google Groups "cesium-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cesium-dev/ku2FfYhd7CA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

IMPORTANT: This email remains the property of the Department of Defence and is subject to the jurisdiction of section 70 of the Crimes Act 1914. If you have received this email in error, you are requested to contact the sender and delete the email.

Rachel Hwang

unread,
May 15, 2017, 2:37:00 PM5/15/17
to cesium-dev, James....@dst.defence.gov.au
Hi James,

Unfortunately, we don't yet have a native solution for your timeout problem. The approach would indeed be to have a process that just runs every x seconds and checks to see whether some property of your entities has been updated. To make this slightly cleaner, you could still use the availability property of Entity. When you add a new entity to your collection, you can set availability to a TimeIntervalCollection consisting of a single interval from current time to 30 seconds out. http://cesiumjs.org/Cesium/Build/Documentation/TimeIntervalCollection.html Then in your check process, just cull any entity that is no long available.

Hope that helps,
- Rachel

To unsubscribe from this group and all its topics, send an email to cesium-dev+unsubscribe@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages