deeptwins-engine-3d 0.1.32 → 0.1.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/dist/assets/Build/DeepTwins/Image/f_point.png +0 -0
  2. package/dist/esm/analyze/SubmergenceAnalysis.d.ts +19 -0
  3. package/dist/esm/analyze/SubmergenceAnalysis.js +137 -0
  4. package/dist/esm/constant.d.ts +29 -0
  5. package/dist/esm/constant.js +47 -0
  6. package/dist/esm/drawer/index.d.ts +56 -59
  7. package/dist/esm/drawer/index.js +380 -292
  8. package/dist/esm/drawer/shape/BaseShape.d.ts +33 -0
  9. package/dist/esm/drawer/shape/BaseShape.js +228 -0
  10. package/dist/esm/drawer/shape/Point.d.ts +44 -11
  11. package/dist/esm/drawer/shape/Point.js +299 -35
  12. package/dist/esm/drawer/shape/Polygon.d.ts +43 -9
  13. package/dist/esm/drawer/shape/Polygon.js +408 -56
  14. package/dist/esm/drawer/shape/Polyline.d.ts +41 -10
  15. package/dist/esm/drawer/shape/Polyline.js +373 -31
  16. package/dist/esm/drawer/utils.d.ts +1 -0
  17. package/dist/esm/drawer/utils.js +63 -0
  18. package/dist/esm/graphicLayer/BaseLayer.d.ts +1 -0
  19. package/dist/esm/graphicLayer/BaseLayer.js +8 -3
  20. package/dist/esm/graphicLayer/BaseSource.d.ts +1 -1
  21. package/dist/esm/graphicLayer/BaseSource.js +13 -3
  22. package/dist/esm/graphicLayer/GraphicLayerCollection.d.ts +2 -0
  23. package/dist/esm/graphicLayer/GraphicLayerCollection.js +46 -4
  24. package/dist/esm/graphicLayer/HtmlEntity.js +1 -2
  25. package/dist/esm/index.d.ts +1 -1
  26. package/dist/esm/index.js +7 -4
  27. package/dist/esm/map/Map.d.ts +1 -0
  28. package/dist/esm/map/Map.js +10 -0
  29. package/dist/esm/measure/Area.d.ts +29 -0
  30. package/dist/esm/measure/{AreaMeasure.js → Area.js} +156 -65
  31. package/dist/esm/measure/BaseDraw.d.ts +13 -0
  32. package/dist/esm/measure/BaseDraw.js +70 -0
  33. package/dist/esm/measure/Distance.d.ts +23 -0
  34. package/dist/esm/measure/Distance.js +239 -0
  35. package/dist/esm/measure/index.d.ts +44 -5
  36. package/dist/esm/measure/index.js +278 -5
  37. package/dist/esm/measure/utils.d.ts +108 -14
  38. package/dist/esm/measure/utils.js +262 -20
  39. package/dist/esm/plot/create/CreateAssemble.d.ts +2 -0
  40. package/dist/esm/plot/create/CreateAssemble.js +63 -0
  41. package/dist/esm/plot/create/CreateAttackArrow.d.ts +5 -0
  42. package/dist/esm/plot/create/CreateAttackArrow.js +75 -0
  43. package/dist/esm/plot/create/CreateBillboard.d.ts +2 -0
  44. package/dist/esm/plot/create/CreateBillboard.js +47 -0
  45. package/dist/esm/plot/create/CreateBow.d.ts +2 -0
  46. package/dist/esm/plot/create/CreateBow.js +63 -0
  47. package/dist/esm/plot/create/CreateCircle.d.ts +2 -0
  48. package/dist/esm/plot/create/CreateCircle.js +68 -0
  49. package/dist/esm/plot/create/CreateCurve.d.ts +2 -0
  50. package/dist/esm/plot/create/CreateCurve.js +76 -0
  51. package/dist/esm/plot/create/CreateElliptic.d.ts +2 -0
  52. package/dist/esm/plot/create/CreateElliptic.js +69 -0
  53. package/dist/esm/plot/create/CreateFlag.d.ts +2 -0
  54. package/dist/esm/plot/create/CreateFlag.js +80 -0
  55. package/dist/esm/plot/create/CreateFormation.d.ts +2 -0
  56. package/dist/esm/plot/create/CreateFormation.js +65 -0
  57. package/dist/esm/plot/create/CreateFreeLine.d.ts +2 -0
  58. package/dist/esm/plot/create/CreateFreeLine.js +69 -0
  59. package/dist/esm/plot/create/CreateFreePolygon.d.ts +2 -0
  60. package/dist/esm/plot/create/CreateFreePolygon.js +65 -0
  61. package/dist/esm/plot/create/CreateLabel.d.ts +2 -0
  62. package/dist/esm/plot/create/CreateLabel.js +55 -0
  63. package/dist/esm/plot/create/CreateLineArrow.d.ts +2 -0
  64. package/dist/esm/plot/create/CreateLineArrow.js +79 -0
  65. package/dist/esm/plot/create/CreatePincerArrow.d.ts +5 -0
  66. package/dist/esm/plot/create/CreatePincerArrow.js +73 -0
  67. package/dist/esm/plot/create/CreatePoint.d.ts +2 -0
  68. package/dist/esm/plot/create/CreatePoint.js +47 -0
  69. package/dist/esm/plot/create/CreatePolygon.d.ts +2 -0
  70. package/dist/esm/plot/create/CreatePolygon.js +80 -0
  71. package/dist/esm/plot/create/CreatePolyline.d.ts +2 -0
  72. package/dist/esm/plot/create/CreatePolyline.js +70 -0
  73. package/dist/esm/plot/create/CreateRectangle.d.ts +2 -0
  74. package/dist/esm/plot/create/CreateRectangle.js +60 -0
  75. package/dist/esm/plot/create/CreateRegularPolygon.d.ts +2 -0
  76. package/dist/esm/plot/create/CreateRegularPolygon.js +75 -0
  77. package/dist/esm/plot/create/CreateRightAngleArrow.d.ts +5 -0
  78. package/dist/esm/plot/create/CreateRightAngleArrow.js +73 -0
  79. package/dist/esm/plot/create/CreateRoundRectangle.d.ts +2 -0
  80. package/dist/esm/plot/create/CreateRoundRectangle.js +63 -0
  81. package/dist/esm/plot/create/CreateSector.d.ts +2 -0
  82. package/dist/esm/plot/create/CreateSector.js +65 -0
  83. package/dist/esm/plot/create/CreateStraightArrow.d.ts +5 -0
  84. package/dist/esm/plot/create/CreateStraightArrow.js +65 -0
  85. package/dist/esm/plot/create/CreateSwallowtailArrow.d.ts +5 -0
  86. package/dist/esm/plot/create/CreateSwallowtailArrow.js +67 -0
  87. package/dist/esm/plot/create/index.d.ts +25 -0
  88. package/dist/esm/plot/create/index.js +25 -0
  89. package/dist/esm/plot/edit/EditAssemble.d.ts +8 -0
  90. package/dist/esm/plot/edit/EditAssemble.js +120 -0
  91. package/dist/esm/plot/edit/EditAttackArrow.d.ts +8 -0
  92. package/dist/esm/plot/edit/EditAttackArrow.js +182 -0
  93. package/dist/esm/plot/edit/EditBillboard.d.ts +7 -0
  94. package/dist/esm/plot/edit/EditBillboard.js +70 -0
  95. package/dist/esm/plot/edit/EditBow.d.ts +8 -0
  96. package/dist/esm/plot/edit/EditBow.js +119 -0
  97. package/dist/esm/plot/edit/EditCircle.d.ts +8 -0
  98. package/dist/esm/plot/edit/EditCircle.js +133 -0
  99. package/dist/esm/plot/edit/EditCurve.d.ts +8 -0
  100. package/dist/esm/plot/edit/EditCurve.js +180 -0
  101. package/dist/esm/plot/edit/EditElliptic.d.ts +8 -0
  102. package/dist/esm/plot/edit/EditElliptic.js +144 -0
  103. package/dist/esm/plot/edit/EditFlag.d.ts +8 -0
  104. package/dist/esm/plot/edit/EditFlag.js +121 -0
  105. package/dist/esm/plot/edit/EditFormation.d.ts +8 -0
  106. package/dist/esm/plot/edit/EditFormation.js +120 -0
  107. package/dist/esm/plot/edit/EditLabel.d.ts +7 -0
  108. package/dist/esm/plot/edit/EditLabel.js +100 -0
  109. package/dist/esm/plot/edit/EditLineArrow.d.ts +8 -0
  110. package/dist/esm/plot/edit/EditLineArrow.js +180 -0
  111. package/dist/esm/plot/edit/EditPincerArrow.d.ts +8 -0
  112. package/dist/esm/plot/edit/EditPincerArrow.js +121 -0
  113. package/dist/esm/plot/edit/EditPoint.d.ts +7 -0
  114. package/dist/esm/plot/edit/EditPoint.js +70 -0
  115. package/dist/esm/plot/edit/EditPolygon.d.ts +8 -0
  116. package/dist/esm/plot/edit/EditPolygon.js +181 -0
  117. package/dist/esm/plot/edit/EditPolyline.d.ts +8 -0
  118. package/dist/esm/plot/edit/EditPolyline.js +179 -0
  119. package/dist/esm/plot/edit/EditRectangle.d.ts +8 -0
  120. package/dist/esm/plot/edit/EditRectangle.js +119 -0
  121. package/dist/esm/plot/edit/EditRegularPolygon.d.ts +8 -0
  122. package/dist/esm/plot/edit/EditRegularPolygon.js +170 -0
  123. package/dist/esm/plot/edit/EditRightAngleArrow.d.ts +8 -0
  124. package/dist/esm/plot/edit/EditRightAngleArrow.js +143 -0
  125. package/dist/esm/plot/edit/EditRoundRectangle.d.ts +8 -0
  126. package/dist/esm/plot/edit/EditRoundRectangle.js +119 -0
  127. package/dist/esm/plot/edit/EditSector.d.ts +8 -0
  128. package/dist/esm/plot/edit/EditSector.js +120 -0
  129. package/dist/esm/plot/edit/EditStraightArrow.d.ts +8 -0
  130. package/dist/esm/plot/edit/EditStraightArrow.js +120 -0
  131. package/dist/esm/plot/edit/EditSwallowtailArrow.d.ts +8 -0
  132. package/dist/esm/plot/edit/EditSwallowtailArrow.js +121 -0
  133. package/dist/esm/plot/edit/index.d.ts +23 -0
  134. package/dist/esm/plot/edit/index.js +23 -0
  135. package/dist/esm/plot/utils/Algorithm.d.ts +2 -0
  136. package/dist/esm/plot/utils/Algorithm.js +316 -0
  137. package/dist/esm/plot/utils/Coordinate.d.ts +98 -0
  138. package/dist/esm/plot/utils/Coordinate.js +184 -0
  139. package/dist/esm/plot/utils/DomUtil.d.ts +34 -0
  140. package/dist/esm/plot/utils/DomUtil.js +100 -0
  141. package/dist/esm/plot/utils/PlotCommon.d.ts +101 -0
  142. package/dist/esm/plot/utils/PlotCommon.js +1412 -0
  143. package/dist/esm/plot/utils/ReminderTip.d.ts +10 -0
  144. package/dist/esm/plot/utils/ReminderTip.js +67 -0
  145. package/dist/esm/plot/utils/Tooltip.d.ts +3 -0
  146. package/dist/esm/plot/utils/Tooltip.js +97 -0
  147. package/dist/esm/plot/utils/plotUtil.d.ts +5 -0
  148. package/dist/esm/plot/utils/plotUtil.js +268 -0
  149. package/dist/esm/tool/utils.d.ts +8 -7
  150. package/dist/esm/tool/utils.js +20 -16
  151. package/dist/esm/toolTip/index.d.ts +2 -1
  152. package/dist/esm/toolTip/index.js +12 -6
  153. package/dist/esm/typings.d.ts +1 -0
  154. package/dist/umd/deeptwins-engine-3d.min.js +1 -1
  155. package/package.json +1 -1
  156. package/dist/esm/drawer/base.d.ts +0 -51
  157. package/dist/esm/drawer/base.js +0 -179
  158. package/dist/esm/drawer/painter.d.ts +0 -41
  159. package/dist/esm/drawer/painter.js +0 -115
  160. package/dist/esm/drawer/shape/Ellipse.d.ts +0 -10
  161. package/dist/esm/drawer/shape/Ellipse.js +0 -62
  162. package/dist/esm/drawer/shape/Rectangle.d.ts +0 -10
  163. package/dist/esm/drawer/shape/Rectangle.js +0 -85
  164. package/dist/esm/drawer/typings.d.ts +0 -106
  165. package/dist/esm/drawer/typings.js +0 -1
  166. package/dist/esm/measure/AreaMeasure.d.ts +0 -19
  167. package/dist/esm/measure/AreaSurfaceMeasure.d.ts +0 -30
  168. package/dist/esm/measure/AreaSurfaceMeasure.js +0 -151
  169. package/dist/esm/measure/DistanceMeasure.d.ts +0 -19
  170. package/dist/esm/measure/DistanceMeasure.js +0 -91
  171. package/dist/esm/measure/DistanceSurfaceMeasure.d.ts +0 -37
  172. package/dist/esm/measure/DistanceSurfaceMeasure.js +0 -122
  173. package/dist/esm/measure/Measure.d.ts +0 -111
  174. package/dist/esm/measure/Measure.js +0 -177
  175. package/dist/esm/tool/cesiumExtends/Subscriber/index.d.ts +0 -66
  176. package/dist/esm/tool/cesiumExtends/Subscriber/index.js +0 -246
  177. package/dist/esm/tool/kriging.d.ts +0 -10
  178. package/dist/esm/tool/kriging.js +0 -436
@@ -1,9 +1,6 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
4
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
5
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
2
+ function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
3
+ function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
7
4
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
8
5
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
9
6
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
@@ -11,49 +8,316 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
11
8
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
12
9
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
10
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
14
- import { defined, Entity } from 'deeptwins-cesium';
15
- import BasicGraphics from "../base";
16
- var Point = /*#__PURE__*/function (_BasicGraphics) {
17
- _inherits(Point, _BasicGraphics);
11
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
12
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
13
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
15
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
16
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
17
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
18
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
19
+ import * as Cesium from 'deeptwins-cesium';
20
+ import { isNil } from 'lodash';
21
+ import { v4 as uuidV4 } from 'uuid';
22
+ import PositionProperty from "../../property/PositionProperty";
23
+ import * as utils from "../../tool/utils";
24
+ import BaseShape from "./BaseShape";
25
+
26
+ // 拖动点样式
27
+ var DRAG_POINT_STYLE = {
28
+ pixelSize: 10,
29
+ color: '#ffffff',
30
+ outline: true,
31
+ outlineColor: '#1890FF',
32
+ outlineWidth: 2
33
+ };
34
+
35
+ // 临时拖动点样式
36
+ var TEMP_DRAG_POINT_STYLE = {
37
+ pixelSize: 10,
38
+ color: '#1890FF',
39
+ outline: true,
40
+ outlineColor: '#ffffff',
41
+ outlineWidth: 2
42
+ };
43
+
44
+ // 创建可拖动的点
45
+ export var DragPoint = /*#__PURE__*/function () {
46
+ /**
47
+ * 构造函数,用于创建一个地图元素实例
48
+ * @param map 地图对象,包含地图上下文信息
49
+ * @param options 配置选项对象
50
+ * @param options.positions 点的坐标位置数组
51
+ * @param options.style 样式配置
52
+ * @param options.isMiddlePoint 是否为中间点的标识,默认为false
53
+ */
54
+ function DragPoint(map, _ref) {
55
+ var positions = _ref.positions,
56
+ style = _ref.style,
57
+ _ref$isMiddlePoint = _ref.isMiddlePoint,
58
+ isMiddlePoint = _ref$isMiddlePoint === void 0 ? false : _ref$isMiddlePoint;
59
+ _classCallCheck(this, DragPoint);
60
+ _defineProperty(this, "_mapContext", void 0);
61
+ _defineProperty(this, "id", '');
62
+ _defineProperty(this, "layer", void 0);
63
+ // 是否编辑中
64
+ _defineProperty(this, "isEditing", false);
65
+ // 是否是中间点
66
+ _defineProperty(this, "isMiddlePoint", false);
67
+ _defineProperty(this, "isDestroyed", false);
68
+ _defineProperty(this, "labelLayer", void 0);
69
+ _defineProperty(this, "_geoJson", void 0);
70
+ _defineProperty(this, "_style", void 0);
71
+ this._mapContext = map._mapContext;
72
+ this.id = uuidV4();
73
+ this.isMiddlePoint = isMiddlePoint;
74
+ this._geoJson = {
75
+ type: 'Feature',
76
+ geometry: {
77
+ type: 'Point',
78
+ coordinates: positions
79
+ }
80
+ };
81
+ this._style = style;
82
+ this._create();
83
+ }
84
+ _createClass(DragPoint, [{
85
+ key: "getMap",
86
+ value: function getMap() {
87
+ return this._mapContext && this._mapContext.getMap();
88
+ }
89
+
90
+ // 是否能进行操作
91
+ }, {
92
+ key: "_canOperate",
93
+ value: function _canOperate() {
94
+ if (this.isDestroyed) {
95
+ utils.error('DragPoint实例已销毁');
96
+ return false;
97
+ }
98
+ return true;
99
+ }
100
+
101
+ // 创建
102
+ }, {
103
+ key: "_create",
104
+ value: function _create() {
105
+ if (!this._canOperate()) return;
106
+ this.layer = this.getMap().addGraphicLayer(this._geoJson, {
107
+ type: 'point',
108
+ id: this.id,
109
+ style: _objectSpread(_objectSpread({}, this._style), {}, {
110
+ disableDepthTestDistance: Number.POSITIVE_INFINITY
111
+ }),
112
+ positionProperty: new PositionProperty()
113
+ });
114
+ if (!this.isMiddlePoint) {
115
+ this._createLabel();
116
+ }
117
+ }
118
+
119
+ // 创建label
120
+ }, {
121
+ key: "_createLabel",
122
+ value: function _createLabel() {
123
+ this.labelLayer = this.getMap().addGraphicLayer(this._geoJson, {
124
+ type: 'label',
125
+ style: {
126
+ text: '',
127
+ font: 'bold 16px Arial',
128
+ style: Cesium.LabelStyle.FILL_AND_OUTLINE,
129
+ outlineWidth: 4,
130
+ eyeOffset: [-20, 0, 0],
131
+ horizontalOrigin: Cesium.HorizontalOrigin.RIGHT,
132
+ heightReference: Cesium.HeightReference.NONE,
133
+ disableDepthTestDistance: Number.POSITIVE_INFINITY,
134
+ show: false
135
+ },
136
+ positionProperty: new PositionProperty()
137
+ });
138
+ }
139
+
140
+ // 开始编辑
141
+ }, {
142
+ key: "startEdit",
143
+ value: function startEdit() {
144
+ if (!this._canOperate()) return;
145
+ this.isEditing = true;
146
+ this.layer && this.layer.setStyle(this.isMiddlePoint ? TEMP_DRAG_POINT_STYLE : DRAG_POINT_STYLE);
147
+ }
148
+
149
+ // 开始鼠标拖拽
150
+ }, {
151
+ key: "mouseDragStart",
152
+ value: function mouseDragStart() {
153
+ if (this.isMiddlePoint) {
154
+ this.isMiddlePoint = false;
155
+ this.layer && this.layer.setStyle(DRAG_POINT_STYLE);
156
+ this._createLabel();
157
+ }
158
+ }
159
+
160
+ // 鼠标拖拽
161
+ }, {
162
+ key: "mouseDragChange",
163
+ value: function mouseDragChange(position) {
164
+ if (!this._canOperate()) return;
165
+ if (this.layer && position) {
166
+ var lng = position.lng,
167
+ lat = position.lat,
168
+ alt = position.alt;
169
+ this._geoJson.geometry.coordinates = [lng, lat, alt];
170
+ this.layer.setData(this._geoJson);
171
+ this.labelLayer && this.labelLayer.setData(this._geoJson);
172
+ }
173
+ }
174
+
175
+ // 结束编辑
176
+ }, {
177
+ key: "endEdit",
178
+ value: function endEdit() {
179
+ if (!this._canOperate()) return;
180
+ if (this.layer) {
181
+ this.isEditing = false;
182
+ this.layer.setStyle(this._style);
183
+ }
184
+ }
185
+
186
+ // 隐藏
187
+ }, {
188
+ key: "show",
189
+ value: function show(isShow) {
190
+ if (!this._canOperate()) return;
191
+ this.layer && this.layer.show(isShow);
192
+ }
193
+
194
+ // 销毁
195
+ }, {
196
+ key: "destroy",
197
+ value: function destroy() {
198
+ if (!this._canOperate()) return;
199
+ this.isDestroyed = true;
200
+ this.layer && this.layer.remove();
201
+ this.layer = null;
202
+ this.labelLayer && this.labelLayer.remove();
203
+ this.labelLayer = null;
204
+ }
205
+ }]);
206
+ return DragPoint;
207
+ }();
208
+ var Point = /*#__PURE__*/function (_BaseShape) {
209
+ _inherits(Point, _BaseShape);
18
210
  var _super = _createSuper(Point);
19
- function Point() {
211
+ function Point(drawContext, config) {
212
+ var _this;
20
213
  _classCallCheck(this, Point);
21
- return _super.apply(this, arguments);
214
+ _this = _super.call(this, drawContext);
215
+ _defineProperty(_assertThisInitialized(_this), "type", 'point');
216
+ _defineProperty(_assertThisInitialized(_this), "shapePointLayer", void 0);
217
+ _this.clampToGround = isNil(config === null || config === void 0 ? void 0 : config.clampToGround) ? _this.clampToGround : config.clampToGround;
218
+ _this.pointStyle.heightReference = _this.clampToGround ? Cesium.HeightReference.CLAMP_TO_GROUND : Cesium.HeightReference.NONE;
219
+ return _this;
22
220
  }
221
+
222
+ // 数据转换
23
223
  _createClass(Point, [{
24
- key: "dropPoint",
25
- value: function dropPoint(event) {
26
- if (!event.position) return;
27
- var earthPosition = this.painter.pickCartesian3(event.position);
28
- if (earthPosition && defined(earthPosition)) this.result = this.createDynamicShape(earthPosition);
224
+ key: "transformData",
225
+ value: function transformData(positions) {
226
+ this.positions = positions;
227
+ this.shapePointLayer = new DragPoint(this.getMap(), {
228
+ positions: this.positions,
229
+ style: this.pointStyle
230
+ });
231
+ this.shapePointLayer.endEdit();
232
+ this.dragPoints = [this.shapePointLayer];
233
+ // 存入
234
+ this._drawContext.setDrawerLayer(this.id, this);
235
+ }
236
+
237
+ // 添加点位
238
+ }, {
239
+ key: "addPoint",
240
+ value: function addPoint(position) {
241
+ var lng = position.lng,
242
+ lat = position.lat,
243
+ alt = position.alt;
244
+ this.positions = [lng, lat, alt];
245
+ this.shapePointLayer = new DragPoint(this.getMap(), {
246
+ positions: this.positions,
247
+ style: this.pointStyle
248
+ });
249
+ this.dragPoints = [this.shapePointLayer];
250
+ // 存入
251
+ this._drawContext.setDrawerLayer(this.id, this);
252
+ this.drawing(this);
253
+ this.drawEnd(this);
254
+ this.startEdit();
29
255
  }
256
+
257
+ // 开始编辑
30
258
  }, {
31
- key: "moving",
32
- value: function moving() {
33
- return undefined;
259
+ key: "startEdit",
260
+ value: function startEdit() {
261
+ _get(_getPrototypeOf(Point.prototype), "startEdit", this).call(this);
262
+ this.dragPoints[0] && this.dragPoints[0].startEdit();
34
263
  }
264
+
265
+ // 开始鼠标拖拽
35
266
  }, {
36
- key: "playOff",
37
- value: function playOff() {
38
- this.painter.reset();
39
- return this.result;
267
+ key: "mouseDragStart",
268
+ value: function mouseDragStart(position, dragLayer) {
269
+ this.dragging = true;
270
+ this.dragLayer = dragLayer;
40
271
  }
272
+
273
+ // 鼠标拖拽
41
274
  }, {
42
- key: "cancel",
43
- value: function cancel() {
44
- this.painter.reset();
45
- return undefined;
275
+ key: "mouseDragChange",
276
+ value: function mouseDragChange(position) {
277
+ if (this.dragging) {
278
+ var _this$_drawContext$op, _this$_drawContext$op2;
279
+ // 调用点位改变事件
280
+ ((_this$_drawContext$op = this._drawContext.options) === null || _this$_drawContext$op === void 0 ? void 0 : _this$_drawContext$op.onPointsChange) && ((_this$_drawContext$op2 = this._drawContext.options) === null || _this$_drawContext$op2 === void 0 ? void 0 : _this$_drawContext$op2.onPointsChange({
281
+ layer: this,
282
+ positions: this.positions
283
+ }));
284
+ this.dragLayer.mouseDragChange(position);
285
+ }
46
286
  }
287
+
288
+ // 结束鼠标拖拽
47
289
  }, {
48
- key: "createDynamicShape",
49
- value: function createDynamicShape(position) {
50
- var point = Object.assign({}, this.finalOptions);
51
- return new Entity({
52
- position: position,
53
- point: point
290
+ key: "mouseDragEnd",
291
+ value: function mouseDragEnd() {
292
+ this.dragging = false;
293
+ this.dragLayer = null;
294
+ }
295
+
296
+ // 结束编辑
297
+ }, {
298
+ key: "endEdit",
299
+ value: function endEdit(layer) {
300
+ _get(_getPrototypeOf(Point.prototype), "endEdit", this).call(this, layer);
301
+ this.dragPoints[0] && this.dragPoints[0].endEdit();
302
+ }
303
+
304
+ // 销毁
305
+ }, {
306
+ key: "destroy",
307
+ value: function destroy() {
308
+ _get(_getPrototypeOf(Point.prototype), "destroy", this).call(this);
309
+ this.dragPoints.forEach(function (t) {
310
+ return t.destroy();
311
+ });
312
+ this.dragPoints = [];
313
+ this.edges.forEach(function (t) {
314
+ return t.middlePoint.destroy();
54
315
  });
316
+ this.edges = [];
317
+ this.shapePointLayer && this.shapePointLayer.destroy();
318
+ this.shapePointLayer = null;
55
319
  }
56
320
  }]);
57
321
  return Point;
58
- }(BasicGraphics);
59
- export { Point as default };
322
+ }(BaseShape);
323
+ export default Point;
@@ -1,10 +1,44 @@
1
- import { CallbackProperty, Entity } from 'deeptwins-cesium';
2
- import BasicGraphics from '../base';
3
- import type { Cartesian3 } from 'deeptwins-cesium';
4
- import type { LifeCycle } from '../base';
5
- export default class Polygon extends BasicGraphics implements LifeCycle {
6
- dropPoint(event: any): void;
7
- playOff(): Entity;
8
- cancel(): void;
9
- createShape(hierarchy: Cartesian3[] | CallbackProperty, isDynamic?: boolean): Entity;
1
+ import BaseShape from './BaseShape';
2
+ export declare class ShapePolygon {
3
+ private readonly _mapContext;
4
+ id: string;
5
+ layer: any;
6
+ isDestroyed: boolean;
7
+ private _geoJson;
8
+ private _style;
9
+ /**
10
+ * 构造函数,用于创建一个地图多边形对象
11
+ * @param map 地图实例对象,用于获取地图上下文
12
+ * @param options 配置选项对象
13
+ * @param options.positions 多边形的坐标点数组
14
+ * @param options.style 多边形的样式配置
15
+ */
16
+ constructor(map: any, { positions, style }: any);
17
+ getMap(): any;
18
+ private _canOperate;
19
+ private _create;
20
+ update(positions: any): void;
21
+ destroy(): void;
10
22
  }
23
+ declare class Polygon extends BaseShape {
24
+ readonly type: string;
25
+ shapePolylineLayer: any;
26
+ shapePolygonLayer: any;
27
+ private _tempPosition;
28
+ constructor(drawContext: any, config: any);
29
+ transformData(positions: any[]): void;
30
+ private _getDrawPolylinePositions;
31
+ private _getDrawPolygonPositions;
32
+ addPoint(position: any): void;
33
+ private _createDragPoint;
34
+ removePrev(): void;
35
+ updateTempPosition(position: any): void;
36
+ endDraw(): void;
37
+ startEdit(): void;
38
+ mouseDragStart(position: any, dragLayer: any): void;
39
+ mouseDragChange(position: any): void;
40
+ mouseDragEnd(): void;
41
+ endEdit(layer: any): void;
42
+ destroy(): void;
43
+ }
44
+ export default Polygon;