代码迁移
This commit is contained in:
37
src/Global/DTH/changeClassificationPrimitive.js
Normal file
37
src/Global/DTH/changeClassificationPrimitive.js
Normal file
@ -0,0 +1,37 @@
|
||||
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 }
|
Reference in New Issue
Block a user