/* * @Description: 雷达扫描效果(参考开源代码) * @Version: 1.0 * @Author: Julian * @Date: 2022-03-04 20:02:48 * @LastEditors: Julian * @LastEditTime: 2022-03-05 15:26:47 */ class Radar { constructor(options) { // this._definitionChanged = new Cesium.Event(); // this._color = undefined; // this._speed = undefined; // this.color = options.color; // this.speed = options.speed; let that = this; this._viewer = options.viewer; this._position = options.position; this._num = options.num; this._maxAngle = options.maxAngle; this._entity = this._viewer.entities.add({ position: that._position, //Cesium.Cartesian3 orientation: new Cesium.CallbackProperty(() => { that._num += 0.3; if (that._num >= that._maxAngle) that._num = 0; return Cesium.Transforms.headingPitchRollQuaternion( that._entity.position.getValue(Cesium), new Cesium.HeadingPitchRoll((that._num * Math.PI) / 180, 0, 0) ); }, false), ellipsoid: { radii: new Cesium.Cartesian3(100000.0, 100000.00, 2000.0), // 扇形半径 innerRadii: new Cesium.Cartesian3(1.0, 1.0, 1.0), // 内半径 minimumClock: Cesium.Math.toRadians(-10), maximumClock: Cesium.Math.toRadians(10), minimumCone: Cesium.Math.toRadians(90), // 上下偏角 可以都设置为90 maximumCone: Cesium.Math.toRadians(90), material: Cesium.Color.GREEN.withAlpha(0.5), outline: true, outlineColor: Cesium.Color.GREEN.withAlpha(.8), heightReference: Cesium.HeightReference.CLAMP_TO_GROUND, //RELATIVE_TO_GROUND CLAMP_TO_GROUND }, }); return this._entity }; }