BUG? PrimitiveCollection show property ignored (with Sandcastle)

Hello Cesium folks,

If I create a PrimitiveCollect (or PointPrimitiveCollection in the example below), add it to the scene, then flip the show property on that collection, no visible change occurs. Here’s a Sandcastle that demonstrates the issue:

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

var points = viewer.scene.primitives.add(
new Cesium.PointPrimitiveCollection());

var step = 360 / 30;

for (var longitude = -180; longitude < 180; longitude += step) {
var color = Cesium.Color.PINK;
if ((longitude % 2) === 0) {
color = Cesium.Color.CYAN;
}
for (var latitude = -90; latitude < 90; latitude += step) {
points.add({
position : Cesium.Cartesian3.fromDegrees(longitude, latitude),
color : color
});
}
}
points.show = false;

``

Expected: no visible points

Observed: all points visible

If I do:

viewer.scene.primitives.show = false;

``

This does in fact turn off the points. However I want more granular control than that. I want to add several PrimitiveCollections, and be able to toggle them on/off independently of one another, which I would expect to be able to do.

Thoughts?

Thanks,

Bryan Ressler

Institute for Disease Modeling

Looks like PointPrimitiveCollection doesn’t actually have a show property (and never has). You could wrap each PointPrimitiveCollection in a PrimitiveCollection, or if you wanted to add the show property, that would use a useful (and easy) contribution.

+1 to Scott’s reply! We’d be happy to help you make a contribution if you’re interested. Start by taking a look here: https://github.com/AnalyticalGraphicsInc/cesium/blob/master/CONTRIBUTING.md

Wow I looked in PointPrimitiveCollection, didn’t see show, then assumed that PointPrimitiveCollection was-a PointCollection (OOP), and went to look at PrimitiveCollection, which does have a show property, and so assumed it would be inherited. So definitely mea culpa. For now I will wrap the PointPrimitiveCollection in a PrimitiveCollection, since I’m currently trying to avoid modifying/building Cesium. I may take a shot at adding a show property too.

Thanks for your help Scott & Rachel!