Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

EditBillboard.js 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. * @Author: Caven
  3. * @Date: 2020-08-30 22:04:36
  4. */
  5. import { Cesium } from '@dc-modules/namespace'
  6. import { Transform } from '@dc-modules/transform'
  7. import Edit from './Edit'
  8. class EditBillboard extends Edit {
  9. constructor(overlay) {
  10. super()
  11. this._overlay = overlay
  12. this._position = undefined
  13. this._tooltipMess = '右击结束编辑'
  14. }
  15. _mountEntity() {
  16. this._delegate = new Cesium.Entity()
  17. this._delegate.merge(this._overlay.delegate)
  18. this._overlay.show = false
  19. this._position = this._delegate.position.getValue(Cesium.JulianDate.now())
  20. this._delegate.position = new Cesium.CallbackProperty(() => {
  21. return this._position
  22. })
  23. this._layer.add(this._delegate)
  24. }
  25. _onMouseMove(e) {
  26. this._tooltip.showAt(e.windowPosition, this._tooltipMess)
  27. this._position = this._clampToGround ? e.surfacePosition : e.position
  28. }
  29. _onRightClick(e) {
  30. this.unbindEvent()
  31. this._overlay.position = Transform.transformCartesianToWGS84(this._position)
  32. this._overlay.show = true
  33. this._plotEvent.raiseEvent(this._overlay)
  34. }
  35. }
  36. export default EditBillboard