Asynchronous Entity Rendering in Cesium 1.7

I've been working with Cesium for a bit now and I started when Primitive Collections were the thing to use. I had click and drag primitive rendering working, but now I want to upgrade Cesium and move on to entities. I moved over the code, refactored, and can click and drag to draw shapes; however, before I was able to flip the asynchronous flag and it would render as I moved the mouse. Now, I'm unable to do that. I tried setting 'allowDataSourcesToSuspendAnimation' on the viewer to false, but to no avail. Any help would be extremely appreciated.

scene.screenSpaceCameraController.enableRotate = false;
scene.screenSpaceCameraController.enableTranslate = false;
scene.screenSpaceCameraController.enableZoom = false;
scene.screenSpaceCameraController.enableTilt = false;
scene.screenSpaceCameraController.enableLook = false;

I have a similar issue with the drawing of polylines in Cesium version 1.7.1. I first disable the camera by doing the following:

With the camera disabled, I’m adding new positions while the mouse is moving with the left click pressed (freestyle drawing). The issue I’m having is that the polyline is rendered or updated on the map after I release the mouse. Is there a way to allow the rendering of polylines or any other geometry on the map synchronously instead of asynchronously while I’m drawing or dragging?

Thanks,

Alberto

We plan on making this easier and better documenting it, but check out this thread for some info. https://groups.google.com/d/msg/cesium-dev/DTJ6TEN04U8/AbG14Wm-z98J

Basically, when you assign a raw value to an entity you are assigning the value as a constant (and Cesium optimizes to support that). If you want to assign a value over and over (as is the case for interactive editing) you need to use a dynamic property to indicate that.

Is there any plan on supporting this type of behavior natively in future patches? It would be amazing to have real time editing.

Built in support for object editing may be too “high-level” for core Cesium, since a lot of assumptions about the application need to be made in order to implement it. That being said, having first class support via a plug-in or other project is certainly possible, but given everything else we have on our plate, it’s not on our own near term schedule.

I also found the same problem today, we had implemented real time dragging/scaling/etc of shapes and now when we tried porting the codebase to the new entity API the editing is not real-time anymore, dragging a shape takes 2 to 3 seconds to update…

I think what the other guys asked was just support for syncronous imediate updates, not actually having object editing inside Cesium.
Is there any special reason entities don’t have a asyncronous property?

Without a way to update stuff in real-time the whole entity API is worthless to us, and we really wanted to port the codebase to it in order to simplifiy lots of code and make use of the new stuff (tracking, pop up descriptions, etc).

Am I missing something? Or else how the CZML system updates entities without having this delay?

One of the main points of the Entity system is to efficiently handle dynamic data, (we are just lacking a good tutorial on the subject because I haven’t had time to write one). There are two different forms of dynamic data, 1) data that varies with animation time 2) data that varies due to external user interaction or stimulus. Cesium uses a Property system to allow for users to provide information about their data so that dynamic data can be efficiently rendered. This is touched on at the end of the Visualizing Spatial Data tutorial If you have a look at the ref doc for the various properties, you will hopefully be able to get a sense for how each one would be used.

You can also implement custom properties if needed. For object editing, CallbackProperty usually makes the most sense. I’m floating the idea of adding a DynamicProperty but I’m not sure we need it because it’s ultimately less efficient than CallbackProperty. Don’t get me wrong, there’s lots of rooms for improvement here; and perhaps the best thing we can do is improve the documentation of what we already have.

Here’s a couple links to other discussions that may be helpful too (though there are plenty more if you search the forums).

https://groups.google.com/d/msg/cesium-dev/-qQemO1C-eg/FU7Xo9WwF08J

https://groups.google.com/d/msg/cesium-dev/DTJ6TEN04U8/AbG14Wm-z98J

Wow Matthew, thanks for the very faster answer, and that is actually what we needed, the CallbackProperty is great, it will allow us to remove tons of updating code!

Just in case someone needs some help in this topic, here’s how to make an ellipse with a position that can be updated in real-time from a custom function.

    me.entity = new Cesium.Entity({
        id: myID,
        position: new Cesium.CallbackProperty(function() {
                return me.ellipsoid.cartographicToCartesian(me.center);
            }, false),
        ellipse : me.getEllipseData()
    });

``

Sergio, thanks so much for coming back and posting your answer. It helped me work out my problem. Thank you Matthew also.