38 lines
1.0 KiB
JavaScript
38 lines
1.0 KiB
JavaScript
function changeClassificationPrimitive(options, array) {
|
|
this.options = options
|
|
this.array = array
|
|
}
|
|
|
|
changeClassificationPrimitive.prototype.getGeometry = function () {
|
|
return Cesium.PolygonGeometry.createGeometry(this.options);
|
|
};
|
|
changeClassificationPrimitive.prototype.update = function (context, frameState, commandList) {
|
|
var geometry = this.getGeometry();
|
|
if (!geometry) {
|
|
return;
|
|
}
|
|
|
|
this._primitive = new Cesium.ClassificationPrimitive({
|
|
geometryInstances: new Cesium.GeometryInstance({
|
|
geometry: geometry,
|
|
id: {
|
|
type: 'dth',
|
|
...this.array,
|
|
},
|
|
attributes: {
|
|
color: Cesium.ColorGeometryInstanceAttribute.fromColor(
|
|
Cesium.Color.fromRandom({ alpha: 0.5 })
|
|
),
|
|
show: new Cesium.ShowGeometryInstanceAttribute(true),
|
|
}
|
|
}),
|
|
classificationType: Cesium.ClassificationType.CESIUM_3D_TILE,
|
|
});
|
|
var primitive = this._primitive
|
|
|
|
primitive.update(context, frameState, commandList);
|
|
|
|
};
|
|
|
|
export { changeClassificationPrimitive }
|