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.

EditPoint.js 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 EditPoint extends Edit {
  9. constructor(overlay) {
  10. super(overlay)
  11. this._position = undefined
  12. }
  13. /**
  14. *
  15. * @private
  16. */
  17. _mountedHook() {
  18. this.editTool.tooltipMess = '右击结束编辑'
  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.entities.add(this._delegate)
  24. }
  25. /**
  26. *
  27. * @private
  28. */
  29. _stopedHook() {
  30. this._overlay.position = Transform.transformCartesianToWGS84(this._position)
  31. this._overlay.show = true
  32. this._options.onEditStop && this._options.onEditStop(this._overlay)
  33. }
  34. /**
  35. *
  36. * @param pickedAnchor
  37. * @param position
  38. * @private
  39. */
  40. _onAnchorMoving({ pickedAnchor, position }) {
  41. this._position = position
  42. }
  43. }
  44. export default EditPoint