Polygons flicker while show and hide

Hi,

I need to show and hide some of the polygons on map based on condition. I am using show property of the polygon for this but all the polygons flicker while updating one of the polygons. Could you please help me on this?

Thanks,

Gowtham.

Hello,

The flickering is most likely happening because the polygons are being drawn asynchronously in a webworker. You can use a CallbackProperty for the value that’s changing to force the polygon to draw synchronously instead.

See this post for an example of using a CallbackProperty for the positions of a wall: https://groups.google.com/d/msg/cesium-dev/nypZFdPLjhs/rRH_NdUvhVIJ

Best,

Hannah

Hi Hannah,

I tried Callback property as you said and I have few observations. It seems Callback property depends on frame rate as I could see there is a difference in show hide behavior of polygon with default frame rate and with frame rate 6. With default frame rate the execution is fast compared to reduced frame rate. Also the call back property function is continuously executing. Will there be any performance hit if we use it? Also show,hide using Callback property is not working for rectangle.Is there any bug with it? Please find the attached videos and sandcastle examples for the above mentioned points.

Thanks,

Gowtham.

polygon_framerate_default.txt (1.44 KB)

polygon_framerate_default.webm (2.44 MB)

polygon_framerate6.txt (1.46 KB)

polygon_framerate6.webm (1.89 MB)

rectangle.webm (2.62 MB)

rectangle_showhide.txt (1.19 KB)

Hello Gowtham,

The show callback property is working for rectangles. I think your code example is just changing the value too quickly for it to be noticeable. I change your callback function to this and it worked fine:

var isShow = true;
function isAnimate(){
if (j%60 === 0){
isShow = !isShow;
}
j++;
return isShow;

}

``

The callback property function is called once per frame, so that is why you see a difference in the results when you change the target frame rate, since the function you wrote switches the value back and forth every call. You might see performance slow down a little if you’re adding many thousands of polygons with CallbackProperties. If that is the case, switch the property to a static value when you know it is not going to be changing.

Best,

Hannah

Thanks for the answers Hannah. I tried as you mentioned for rectangle and it’s working.