Hi Cesium-Team,
as far as a know, the "allowPicking" option is not available on the Entity API level, and only supported in Primitive API
But how to use the Primitive API to create a 3D point geometry with allowPicking = false?
some example code snippet would be very helpful.
Many thanks in advance,
Zhihang
omar
December 17, 2018, 4:44pm
2
I don’t see a way to set allowPicking from the Entity API either. I think this might be a straightforward feature to add, in that you’d add a property called “allowPicking” to Entity.js:
function Entity(options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
var id = options.id;
if (!defined(id)) {
id = createGuid();
}
this._availability = undefined;
this._id = id;
this._definitionChanged = new Event();
this._name = options.name;
this._show = defaultValue(options.show, true);
this._parent = undefined;
this._propertyNames = ['billboard', 'box', 'corridor', 'cylinder', 'description', 'ellipse', //
'ellipsoid', 'label', 'model', 'tileset', 'orientation', 'path', 'plane', 'point', 'polygon', //
'polyline', 'polylineVolume', 'position', 'properties', 'rectangle', 'viewFrom', 'wall'];
this._billboard = undefined;
this._billboardSubscription = undefined;
this._box = undefined;
The actual primitives are then created in the visualizer classes:
So for example, for points, you’d go to the PointVisualizer and pass the new property you created to the primitive here:
}
if (defined(pointPrimitive)) {
pointPrimitive.show = true;
pointPrimitive.position = position;
pointPrimitive.scaleByDistance = Property.getValueOrUndefined(pointGraphics._scaleByDistance, time, scaleByDistanceScratch);
pointPrimitive.translucencyByDistance = Property.getValueOrUndefined(pointGraphics._translucencyByDistance, time, translucencyByDistanceScratch);
pointPrimitive.color = Property.getValueOrDefault(pointGraphics._color, time, defaultColor, colorScratch);
pointPrimitive.outlineColor = Property.getValueOrDefault(pointGraphics._outlineColor, time, defaultOutlineColor, outlineColorScratch);
pointPrimitive.outlineWidth = Property.getValueOrDefault(pointGraphics._outlineWidth, time, defaultOutlineWidth);
pointPrimitive.pixelSize = Property.getValueOrDefault(pointGraphics._pixelSize, time, defaultPixelSize);
pointPrimitive.distanceDisplayCondition = Property.getValueOrUndefined(pointGraphics._distanceDisplayCondition, time, distanceDisplayConditionScratch);
pointPrimitive.disableDepthTestDistance = Property.getValueOrDefault(pointGraphics._disableDepthTestDistance, time, defaultDisableDepthTestDistance);
} else if (defined(billboard)) {
billboard.show = true;
billboard.position = position;
billboard.scaleByDistance = Property.getValueOrUndefined(pointGraphics._scaleByDistance, time, scaleByDistanceScratch);
billboard.translucencyByDistance = Property.getValueOrUndefined(pointGraphics._translucencyByDistance, time, translucencyByDistanceScratch);
billboard.distanceDisplayCondition = Property.getValueOrUndefined(pointGraphics._distanceDisplayCondition, time, distanceDisplayConditionScratch);
billboard.disableDepthTestDistance = Property.getValueOrDefault(pointGraphics._disableDepthTestDistance, time, defaultDisableDepthTestDistance);
billboard.heightReference = heightReference;
It’d definitely be awesome if you can contribute that to Cesium! Check out the contributing guide for a place to start https://github.com/AnalyticalGraphicsInc/cesium/blob/master/CONTRIBUTING.md#opening-a-pull-request
For using primitives, this is my go-to guide for a reference on creating geometry with the primitive API:
Cesium is geospatial. Use Cesium ion's simple workflow to create 3D maps of your geospatial data for visualization, analysis, and sharing. For developers, use the open-source CesiumJS library to create custom 3D mapping apps.
Hope it helps!