show/hide PathGraphic of dragged CZML

Hello forum,

I've tried and tried and finally writing forum. Using v 1.4 and Chrome.

I have a user interface wired-up to a list of Entity objects that I have referenced in my code succesfully. Fine. All and good.

I drag some czml onto the map and it successfully displays aircraft flights, along with a path. Here is the czml snippet of question (pay attention to the 'boolean' attribute):
<CZML SNIP>
...},
"path":{"material":{"solidColor":{"color":{"rgba":[255,255,100,100]}}},
"width":[ { "number":1.0}],
"show":[{
  "interval":"2014-09-03T11:45:10Z/2014-09-03T12:16:24Z","boolean":true}
]
},
...
</CZML SNIP>

I have a show/hide checkbox for the path of a vehicle moving through time and space. All good so far ... I can de-select the box to hide the path:

<code for deselect>
// this will successfully hide the path
thisPathGraphic.show = new $wnd.Cesium.ConstantProperty(false);
</code for deselect>

... but when I try to show the path (assuming the path can be shown according to the timeInterval), nothing happens, no exception, just nothing.

<code for select>
// show the path
function show(timeInterval) {
// this pops-up the original iso time string
alert( "iso time: " +timeInterval.toString() );

try {
  thisPathGraphic.show = new Cesium.TimeIntervalCollectionProperty();
  this.show.intervals.addInterval(timeInterval);
}
catch(err) {
  alert("Exception on show(). " +err.message);
}

}

</code for select>

The original CZML has boolean:true but I don't see where to say that again outside of CZML. This seems to be a question of how to reset the TimeIntervalCollectionProperty object of the PathGraphic .

Wish I could help with the js, but I'm just a high level user at this point using GWT and overlay types to encapsulate the various Cesium types (Entity, PathGraphic, TimeInterval, TimeIntervalCollection, etc ).

Thanks for any help !
Tom

Any advise on how the API enables ON/OFF visibility of the path of an Entity ? Thanks

Here’s a simple working example that you can copy and paste into Sandcastle. This assumes a constant always on or off setting.

var gallery = ‘…/…/SampleData/’;

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var czmlDataSource = new Cesium.CzmlDataSource();

czmlDataSource.loadUrl(gallery + ‘simple.czml’);

viewer.dataSources.add(czmlDataSource);

var showPaths = true;

Sandcastle.addToolbarButton(‘Toggle paths’, function() {

showPaths = !showPaths;

var entities = czmlDataSource.entities.entities;

for(var i = 0, len = entities.length; i < len; i++) {

var entity = entities[i];

if(entity.path) {

entity.path.show = new Cesium.ConstantProperty(showPaths);

}

}

});

Thanks, but I already tried that. Using that solution causes the path stay visible even after the Entity times-out. What I need is to re-attach a TimeIntervalCollectionProperty(). The CZML has this boolean:true attribute that I don't understand its equivalent in the js API.

Can you simply keep around the old value and reassign it when you turn them back on. (This assumes you are working with data that isn’t being continually updated).

Something as simple as this should work:

//Turn off

path.oldShow = path.show;

path.show = new Cesium.ConstantProperty(false);

then later

//Turn back on

path.show = path.oldShow;

path.oldShow = undefined;

D'Oh! That worked. Just say that path.oldShow exists out of the blue. Javascript.

Thanks !