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.

PolylineFenceMaterialProperty.js 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /**
  2. * PolylineFence Material Property
  3. * @Author : Converted from fh2
  4. */
  5. import { Cesium } from '../../../../libs'
  6. import MaterialProperty from '../../MaterialProperty'
  7. class PolylineFenceMaterialProperty extends MaterialProperty {
  8. constructor(options = {}) {
  9. super(options)
  10. this.color = options.color || Cesium.Color.WHITE
  11. this._outlineColor = undefined
  12. this._outlineColorSubscription = undefined
  13. this.outlineColor = options.outlineColor || new Cesium.Color(1, 1, 1, 0)
  14. this._outlineWidth = undefined
  15. this._outlineWidthSubscription = undefined
  16. this.outlineWidth = options.outlineWidth ?? 10
  17. this._maskLength = undefined
  18. this._maskLengthSubscription = undefined
  19. this.maskLength = options.maskLength ?? 20
  20. }
  21. getType(time) {
  22. return Cesium.Material.PolylineFenceType
  23. }
  24. getValue(time, result) {
  25. if (!result) {
  26. result = {}
  27. }
  28. result.color = Cesium.Property.getValueOrUndefined(this._color, time)
  29. result.outlineColor = Cesium.Property.getValueOrUndefined(this._outlineColor, time)
  30. result.outlineWidth = Cesium.Property.getValueOrUndefined(this._outlineWidth, time)
  31. result.maskLength = Cesium.Property.getValueOrUndefined(this._maskLength, time)
  32. return result
  33. }
  34. equals(other) {
  35. return (
  36. this === other ||
  37. (other instanceof PolylineFenceMaterialProperty &&
  38. Cesium.Property.equals(this._color, other._color) &&
  39. Cesium.Property.equals(this._outlineColor, other._outlineColor) &&
  40. Cesium.Property.equals(this._outlineWidth, other._outlineWidth) &&
  41. Cesium.Property.equals(this._maskLength, other._maskLength))
  42. )
  43. }
  44. }
  45. Object.defineProperties(PolylineFenceMaterialProperty.prototype, {
  46. color: Cesium.createPropertyDescriptor('color'),
  47. outlineColor: Cesium.createPropertyDescriptor('outlineColor'),
  48. outlineWidth: Cesium.createPropertyDescriptor('outlineWidth'),
  49. maskLength: Cesium.createPropertyDescriptor('maskLength'),
  50. })
  51. export default PolylineFenceMaterialProperty