forked from drone/command-center-dashboard

罗广辉
2025-04-02 e1699c4851f6ca397cd0ad1ff63f32c737654836
src/utils/cesium/ImageTrailMaterial.js
@@ -1,48 +1,45 @@
import * as Cesium from 'cesium';
import * as Cesium from 'cesium'
/**
 * 定义Cesium材质对象
 */
class ImageTrailMaterial {
    constructor(options = {}) {
        this._definitionChanged = new Cesium.Event();
        this._color = void 0;
        this._colorSubscription = void 0;
        this._speed = void 0;
        this._speedSubscription = void 0;
        this._image = void 0;
        this._imageSubscription = void 0;
        this._repeat = void 0;
        this._repeatSubscription = void 0;
        this.color = options.color || Cesium.Color.fromBytes(0, 0, 255, 255);
        this.speed = options.speed || 1;
        this.image = options.image;
        this.repeat = new Cesium.Cartesian2(
            options.repeat?.x || 1,
            options.repeat?.y || 1,
        );
      this._definitionChanged = new Cesium.Event()
      this._color = void 0
      this._colorSubscription = void 0
      this._speed = void 0
      this._speedSubscription = void 0
      this._image = void 0
      this._imageSubscription = void 0
      this._repeat = void 0
      this._repeatSubscription = void 0
      this.color = options.color || Cesium.Color.fromBytes(0, 0, 255, 255)
      this.speed = options.speed || 1
      this.image = options.image
      this.repeat = new Cesium.Cartesian2(options.repeat?.x || 1, options.repeat?.y || 1)
    }
    get isConstant() {
        return false;
      return false
    }
    get definitionChanged() {
        return this._definitionChanged;
      return this._definitionChanged
    }
    getType() {
        return Cesium.Material.ImageTrailMaterialType;
      return Cesium.Material.ImageTrailMaterialType
    }
    getValue(time, result) {
        if (!result) {
            result = {};
         result = {}
        }
        result.color = Cesium.Property.getValueOrUndefined(this._color, time);
        result.image = Cesium.Property.getValueOrUndefined(this._image, time);
        result.repeat = Cesium.Property.getValueOrUndefined(this._repeat, time);
        result.speed = this._speed;
        return result;
      result.color = Cesium.Property.getValueOrUndefined(this._color, time)
      result.image = Cesium.Property.getValueOrUndefined(this._image, time)
      result.repeat = Cesium.Property.getValueOrUndefined(this._repeat, time)
      result.speed = this._speed
      return result
    }
    equals(other) {
@@ -53,7 +50,7 @@
                Cesium.Property.equals(this._image, other._image) &&
                Cesium.Property.equals(this._repeat, other._repeat) &&
                Cesium.Property.equals(this._speed, other._speed))
        );
      )
    }
}
@@ -62,13 +59,11 @@
    speed: Cesium.createPropertyDescriptor('speed'),
    image: Cesium.createPropertyDescriptor('image'),
    repeat: Cesium.createPropertyDescriptor('repeat'),
});
})
//材质类型
Cesium.Material.ImageTrailMaterialType = 'PolylineImageTrail';
Cesium.Material.ImageTrailMaterialType = 'PolylineImageTrail'
//添加材质到缓冲区中
Cesium.Material._materialCache.addMaterial(
    Cesium.Material.ImageTrailMaterialType,
    {
Cesium.Material._materialCache.addMaterial(Cesium.Material.ImageTrailMaterialType, {
        fabric: {
            type: Cesium.Material.ImageTrailMaterialType,
            //uniform变量
@@ -97,11 +92,10 @@
                    `,
        },
        translucent: function () {
            return true;
      return true
        },
    },
);
export default ImageTrailMaterial;
})
export default ImageTrailMaterial
//之前的航线材质编写
// source: `