cesium|xt3d
import "./ScanlineMaterial" //引入自定义材质
//扫描线类
export default class Scanline {
constructor(viewer, position, style) {
this.viewer = viewer; //场景viewer对象
this.position = position; //坐标位置
style = style || {}; //样式信息
this.radius = style.radius || 200; //半径
this.color = style.color || Cesium.Color.YELLOW; //颜色
this.speed = style.speed || 10; //速度
this.addEnt();
}
//添加实体对象
addEnt() {
this.ent = this.viewer.entities.add({
position: this.position,
ellipse: {
semiMinorAxis: this.radius,
semiMajorAxis: this.radius,
material: new Cesium.ScanlineMaterialProperty(this.color, this.speed), //使用自定义材质
classificationType: Cesium.ClassificationType.BOTH,
}
});
}
//移除
remove() {
this.viewer.remove(this.ent);
}
}