You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PolylineImageTrailMaterialProperty.js 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /**
  2. * @Author: Caven
  3. * @Date: 2020-07-17 22:15:56
  4. */
  5. import { Cesium } from '@dc-modules/namespace'
  6. import MaterialProperty from '../../MaterialProperty'
  7. class PolylineImageTrailMaterialProperty extends MaterialProperty {
  8. constructor(options = {}) {
  9. super(options)
  10. this._image = undefined
  11. this._imageSubscription = undefined
  12. this._repeat = undefined
  13. this._repeatSubscription = undefined
  14. this.image = options.image
  15. this.repeat = new Cesium.Cartesian2(
  16. options.repeat?.x || 1,
  17. options.repeat?.y || 1
  18. )
  19. }
  20. getType(time) {
  21. return Cesium.Material.PolylineImageTrailType
  22. }
  23. getValue(time, result) {
  24. if (!result) {
  25. result = {}
  26. }
  27. result.color = Cesium.Property.getValueOrUndefined(this._color, time)
  28. result.image = Cesium.Property.getValueOrUndefined(this._image, time)
  29. result.repeat = Cesium.Property.getValueOrUndefined(this._repeat, time)
  30. result.speed = this._speed
  31. return result
  32. }
  33. equals(other) {
  34. return (
  35. this === other ||
  36. (other instanceof PolylineImageTrailMaterialProperty &&
  37. Cesium.Property.equals(this._color, other._color) &&
  38. Cesium.Property.equals(this._image, other._image) &&
  39. Cesium.Property.equals(this._repeat, other._repeat) &&
  40. Cesium.Property.equals(this._speed, other._speed))
  41. )
  42. }
  43. }
  44. Object.defineProperties(PolylineImageTrailMaterialProperty.prototype, {
  45. color: Cesium.createPropertyDescriptor('color'),
  46. speed: Cesium.createPropertyDescriptor('speed'),
  47. image: Cesium.createPropertyDescriptor('image'),
  48. repeat: Cesium.createPropertyDescriptor('repeat')
  49. })
  50. export default PolylineImageTrailMaterialProperty