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.

VectorLayer.js 831B

12345678910111213141516171819202122232425262728293031323334353637
  1. /**
  2. * @Author: Caven
  3. * @Date: 2020-01-02 16:42:03
  4. */
  5. import State from '../state/State'
  6. import Layer from './Layer'
  7. const { Cesium } = DC.Namespace
  8. /**
  9. * The vector layer is used to add various entity, which is essentially a CustomDataSource
  10. * that is used to place entities of the same class or business attribute into the same layer
  11. */
  12. class VectorLayer extends Layer {
  13. constructor(id) {
  14. super(id)
  15. this._delegate = new Cesium.CustomDataSource(id)
  16. this.type = Layer.getLayerType('vector')
  17. this._state = State.INITIALIZED
  18. }
  19. /**
  20. * Clears all entities
  21. * @returns {VectorLayer}
  22. */
  23. clear() {
  24. this._delegate.entities && this._delegate.entities.removeAll()
  25. this._cache = {}
  26. this._state = State.CLEARED
  27. return this
  28. }
  29. }
  30. Layer.registerType('vector')
  31. export default VectorLayer