It's possible to set the CallbackProperty to a bool variable? ?

23 views
Skip to first unread message

ccci

unread,
Feb 28, 2020, 1:32:58 AM2/28/20
to cesium-dev
1. A concise explanation of the problem you're experiencing.
Currently, I need to create lots of polygons and set the default "show" to false. When certain conditions met, the "show" could change to true. I understand how to use Callback property to set dynamic positions, but I am not sure if it works for bool. I don't know if there other way to achieve this. Thanks for helping me. 


2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.
var tf = new Cesium.CallbackProperty(function(){
    if (value>10)
      return true;
    }
    else
      return false;
}, false);

 let entity_example=new Cesium.Entity();
    entity_example.polygon={
        hierarchy: new Cesium.PolygonHierarchy(poss),
        material: Cesium.Color.RED.withAlpha(0.5),
        heightReference : Cesium.HeightReference.CLAMP_TO_GROUND,
        show: tf
      }

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
I need to control entity visibility dynamically after I create the entity.


4. The Cesium version you're using, your operating system and browser.
Windows, Chrome


Omar Shehata

unread,
Mar 2, 2020, 7:34:43 AM3/2/20
to cesium-dev
I think you should be able to just set show = true/false as needed. 

So if you need to do it based on polling some condition like that, you could check every frame for it. Does that work?

Jingdi Zhang

unread,
Mar 3, 2020, 3:47:23 PM3/3/20
to cesiu...@googlegroups.com
Thanks! Nothing changes when I try to track the bool value. I decide to use callback property for position to control show/hide.

ccci

unread,
Mar 3, 2020, 3:47:37 PM3/3/20
to cesium-dev
Thanks! Nothing changes when I try to track the bool value. I decide to use callback property for position to control show/hide.

Reply all
Reply to author
Forward
0 new messages