Hello,
How to remove specific load dataSource add by addToolbarMenu?
var cartDS = undefined;
var options = [{
text : '111',
onselect : function() {
if (Cesium.defined(cartDS)){
viewer.dataSources.remove(cartDS)
};
cartDS = Cesium.GeoJsonDataSource.load('./SampleData/111.json');
viewer.dataSources.add(cartDS);
}
}, {
text : '222',
onselect : function() {
if (Cesium.defined(cartDS)){
viewer.dataSources.remove(cartDS)
};
cartDS = Cesium.GeoJsonDataSource.load('./SampleData/222.json');
viewer.dataSources.add(cartDS);
}
}];
Sandcastle.addToolbarMenu(options);
Sandcastle.reset = function() {
console.log(cartDS);
viewer.dataSources.remove(cartDS); // dont work
//viewer.dataSources.removeAll(); // this remove all
};
Thanks