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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * @Author: Caven
  3. * @Date: 2020-03-17 16:19:15
  4. * @Last Modified by: Caven
  5. * @Last Modified time: 2020-05-11 23:11:18
  6. */
  7. const { OverlayType, Transform } = DC
  8. const { Cesium } = DC.NameSpace
  9. class Edit {
  10. constructor(plotInfo) {
  11. this._viewer = plotInfo.viewer
  12. this._plotEvent = plotInfo.plotEvent
  13. this._layer = plotInfo.layer
  14. this._overlay = plotInfo.overlay
  15. this._markers = []
  16. this._currentMarker = undefined
  17. }
  18. _mouseMoveHandler(e) {}
  19. _mouseRightClickHandler(e) {
  20. this._unbindEnvet()
  21. this._layer.clear()
  22. this._plotEvent.raiseEvent({
  23. type: OverlayType.POLYLINE,
  24. points: Transform.transformCartesianArrayToWGS84Array(this._positions)
  25. })
  26. }
  27. _bindEvent() {
  28. this._viewer.on(
  29. Cesium.ScreenSpaceEventType.MOUSE_MOVE,
  30. this._mouseMoveHandler,
  31. this
  32. )
  33. this._viewer.on(
  34. Cesium.ScreenSpaceEventType.RIGHT_CLICK,
  35. this._mouseRightClickHandler,
  36. this
  37. )
  38. }
  39. _unbindEnvet() {
  40. this._viewer.off(
  41. Cesium.ScreenSpaceEventType.MOUSE_MOVE,
  42. this._mouseMoveHandler,
  43. this
  44. )
  45. this._viewer.off(
  46. Cesium.ScreenSpaceEventType.RIGHT_CLICK,
  47. this._mouseRightClickHandler,
  48. this
  49. )
  50. }
  51. _prepareMarkers() {}
  52. start() {
  53. this._layer.clear()
  54. this._bindEvent()
  55. this._prepareMarkers()
  56. }
  57. }
  58. export default Edit