Files
sdk4.0/src/Global/DTH/changeClassificationPrimitive.js

38 lines
1.0 KiB
JavaScript
Raw Normal View History

2025-07-03 13:54:01 +08:00
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 }