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
@@ -0,0 +1,33 @@
1
+ import { DrawContext } from '../index';
2
+ import { DragPoint } from './Point';
3
+ declare class BaseShape {
4
+ _drawContext: DrawContext;
5
+ id: string;
6
+ positions: any;
7
+ clampToGround: boolean;
8
+ pointStyle: any;
9
+ polylineStyle: any;
10
+ polygonStyle: any;
11
+ isDestroyed: boolean;
12
+ isEditing: boolean;
13
+ dragging: boolean;
14
+ dragLayer: any;
15
+ dragPoints: any[];
16
+ edges: any[];
17
+ constructor(drawContext: any);
18
+ getMap(): any;
19
+ private _canOperate;
20
+ drawing(layer: any): void;
21
+ drawEnd(layer: any): void;
22
+ startEdit(): void;
23
+ endEdit(layer: any): void;
24
+ destroy(): void;
25
+ _createEdgesAndMiddle(dragPoints: any[], isPolygon?: boolean): {
26
+ source: any;
27
+ target: any;
28
+ middlePoint: DragPoint;
29
+ }[];
30
+ _createTwoPointMiddle(position: any): DragPoint;
31
+ _updatePositionsFromEdges(): any[][] | undefined;
32
+ }
33
+ export default BaseShape;
@@ -0,0 +1,228 @@
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
6
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
7
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8
+ 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; }
9
+ 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; }
10
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
11
+ 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); } }
12
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
13
+ 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; }
14
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
15
+ 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); }
16
+ import * as Cesium from 'deeptwins-cesium';
17
+ import { cloneDeep } from 'lodash';
18
+ import { v4 as uuidV4 } from 'uuid';
19
+ import * as utils from "../../tool/utils";
20
+ import { STATUS } from "../index";
21
+ import { DragPoint } from "./Point";
22
+ var BaseShape = /*#__PURE__*/function () {
23
+ function BaseShape(drawContext) {
24
+ _classCallCheck(this, BaseShape);
25
+ _defineProperty(this, "_drawContext", void 0);
26
+ _defineProperty(this, "id", void 0);
27
+ // 位置
28
+ _defineProperty(this, "positions", []);
29
+ // 是否贴地
30
+ _defineProperty(this, "clampToGround", false);
31
+ _defineProperty(this, "pointStyle", void 0);
32
+ _defineProperty(this, "polylineStyle", void 0);
33
+ _defineProperty(this, "polygonStyle", void 0);
34
+ _defineProperty(this, "isDestroyed", false);
35
+ // 是否编辑
36
+ _defineProperty(this, "isEditing", false);
37
+ // 是否拖拽中
38
+ _defineProperty(this, "dragging", false);
39
+ // 拖拽中的点
40
+ _defineProperty(this, "dragLayer", void 0);
41
+ // 可拖动点位
42
+ _defineProperty(this, "dragPoints", []);
43
+ // 可拖动点位的映射关系
44
+ _defineProperty(this, "edges", []);
45
+ this.id = uuidV4();
46
+ this._drawContext = drawContext;
47
+ var clampToGround = drawContext.options.clampToGround;
48
+ this.clampToGround = clampToGround;
49
+ var _drawContext$options = drawContext.options,
50
+ pointStyle = _drawContext$options.pointStyle,
51
+ polylineStyle = _drawContext$options.polylineStyle,
52
+ polygonStyle = _drawContext$options.polygonStyle;
53
+ this.pointStyle = cloneDeep(pointStyle);
54
+ this.polylineStyle = cloneDeep(polylineStyle);
55
+ this.polygonStyle = cloneDeep(polygonStyle);
56
+ }
57
+ _createClass(BaseShape, [{
58
+ key: "getMap",
59
+ value: function getMap() {
60
+ return this._drawContext && this._drawContext.getMap();
61
+ }
62
+ // 是否能进行操作
63
+ }, {
64
+ key: "_canOperate",
65
+ value: function _canOperate() {
66
+ if (this.isDestroyed) {
67
+ utils.error('DrawerShape实例已销毁');
68
+ return false;
69
+ }
70
+ return true;
71
+ }
72
+
73
+ // 绘制中
74
+ }, {
75
+ key: "drawing",
76
+ value: function drawing(layer) {
77
+ var _this$_drawContext$op, _this$_drawContext$op2;
78
+ if (!this._canOperate()) return;
79
+ // 调用点位改变事件
80
+ ((_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({
81
+ layer: layer,
82
+ positions: this.positions
83
+ }));
84
+ this._drawContext._changeStatus(STATUS.DRAWING);
85
+ this._drawContext._updateTooltip();
86
+ }
87
+
88
+ // 绘制结束
89
+ }, {
90
+ key: "drawEnd",
91
+ value: function drawEnd(layer) {
92
+ var _this$_drawContext$op3;
93
+ if (!this._canOperate()) return;
94
+ // 调用绘制完成事件
95
+ ((_this$_drawContext$op3 = this._drawContext.options) === null || _this$_drawContext$op3 === void 0 ? void 0 : _this$_drawContext$op3.onComplete) && this._drawContext.options.onComplete({
96
+ layer: layer,
97
+ positions: this.positions
98
+ });
99
+ this._drawContext._changeStatus(STATUS.END_DRAW);
100
+ this._drawContext._updateTooltip();
101
+ this.getMap().canvas.style.cursor = 'default';
102
+ }
103
+
104
+ // 开始编辑
105
+ }, {
106
+ key: "startEdit",
107
+ value: function startEdit() {
108
+ if (!this._canOperate()) return;
109
+ this.isEditing = true;
110
+ this._drawContext._changeStatus(STATUS.EDITING);
111
+ }
112
+
113
+ // 结束编辑
114
+ }, {
115
+ key: "endEdit",
116
+ value: function endEdit(layer) {
117
+ var _this$_drawContext$op4;
118
+ if (!this._canOperate()) return;
119
+ this.isEditing = false;
120
+ // 调用绘制完成事件
121
+ ((_this$_drawContext$op4 = this._drawContext.options) === null || _this$_drawContext$op4 === void 0 ? void 0 : _this$_drawContext$op4.onComplete) && this._drawContext.options.onComplete({
122
+ layer: layer,
123
+ positions: this.positions
124
+ });
125
+ }
126
+ }, {
127
+ key: "destroy",
128
+ value: function destroy() {
129
+ if (!this._canOperate()) return;
130
+ this.positions = [];
131
+ this.isDestroyed = true;
132
+ this.dragPoints.forEach(function (t) {
133
+ return t.destroy();
134
+ });
135
+ this.dragPoints = [];
136
+ this.edges.forEach(function (t) {
137
+ return t.middlePoint.destroy();
138
+ });
139
+ this.edges = [];
140
+ }
141
+
142
+ // 根据可拖拽点位创建两个点位中间点和映射关系
143
+ }, {
144
+ key: "_createEdgesAndMiddle",
145
+ value: function _createEdgesAndMiddle(dragPoints, isPolygon) {
146
+ var edges = [];
147
+ for (var i = 0; i < dragPoints.length; i++) {
148
+ var item = dragPoints[i];
149
+ var itemNext = isPolygon ? dragPoints[i + 1] || dragPoints[0] : dragPoints[i + 1];
150
+ item.startEdit();
151
+ item.show(true);
152
+ if (itemNext) {
153
+ var p1 = item.layer.layers[0].source.positions;
154
+ var p2 = itemNext.layer.layers[0].source.positions;
155
+ var layer = this._createTwoPointMiddle(utils.getMidpoint(p1, p2));
156
+ layer.startEdit();
157
+ // 创建映射关系
158
+ edges.push({
159
+ source: item,
160
+ target: itemNext,
161
+ middlePoint: layer
162
+ });
163
+ }
164
+ }
165
+ return edges;
166
+ }
167
+
168
+ // 创建两点间的可拖动点位
169
+ }, {
170
+ key: "_createTwoPointMiddle",
171
+ value: function _createTwoPointMiddle(position) {
172
+ var lng = position.lng,
173
+ lat = position.lat,
174
+ alt = position.alt;
175
+ return new DragPoint(this.getMap(), {
176
+ positions: [lng, lat, alt],
177
+ style: _objectSpread(_objectSpread({}, this.pointStyle), {}, {
178
+ heightReference: this.clampToGround ? Cesium.HeightReference.CLAMP_TO_GROUND : Cesium.HeightReference.NONE
179
+ }),
180
+ isMiddlePoint: true
181
+ });
182
+ }
183
+
184
+ // 根据edges生成最新的positions数组
185
+ }, {
186
+ key: "_updatePositionsFromEdges",
187
+ value: function _updatePositionsFromEdges() {
188
+ var positions = [];
189
+ var visitedIds = new Set();
190
+
191
+ // 找到起点(isStart为true的点)
192
+ var startPoint = this.dragPoints.find(function (point) {
193
+ return point.isStart;
194
+ });
195
+ if (!startPoint) {
196
+ return;
197
+ }
198
+
199
+ // 从起点开始,按source->target的顺序构建positions数组
200
+ var currentPoint = startPoint;
201
+ while (currentPoint && !visitedIds.has(currentPoint.id)) {
202
+ // 添加当前点
203
+ var _currentPoint$_geoJso = _slicedToArray(currentPoint._geoJson.geometry.coordinates, 3),
204
+ lng = _currentPoint$_geoJso[0],
205
+ lat = _currentPoint$_geoJso[1],
206
+ alt = _currentPoint$_geoJso[2];
207
+ positions.push([lng, lat, alt]);
208
+ visitedIds.add(currentPoint.id);
209
+
210
+ // 查找以当前点为source的边
211
+ var currentEdge = this.edges.find(function (edge) {
212
+ var _edge$source;
213
+ return ((_edge$source = edge.source) === null || _edge$source === void 0 ? void 0 : _edge$source.id) === currentPoint.id;
214
+ });
215
+
216
+ // 移动到下一个点(target)
217
+ if (currentEdge && currentEdge.target && !visitedIds.has(currentEdge.target.id)) {
218
+ currentPoint = currentEdge.target;
219
+ } else {
220
+ break;
221
+ }
222
+ }
223
+ return positions;
224
+ }
225
+ }]);
226
+ return BaseShape;
227
+ }();
228
+ export default BaseShape;
@@ -1,12 +1,45 @@
1
- import { Entity } from 'deeptwins-cesium';
2
- import BasicGraphics from '../base';
3
- import type { Cartesian3 } from 'deeptwins-cesium';
4
- import type { EventArgs } from '../../tool/cesiumExtends/Subscriber';
5
- import type { LifeCycle } from '../base';
6
- export default class Point extends BasicGraphics implements LifeCycle {
7
- dropPoint(event: EventArgs): void;
8
- moving(): void;
9
- playOff(): Entity;
10
- cancel(): void;
11
- createDynamicShape(position: Cartesian3): Entity;
1
+ import BaseShape from './BaseShape';
2
+ export declare class DragPoint {
3
+ private readonly _mapContext;
4
+ id: string;
5
+ layer: any;
6
+ isEditing: boolean;
7
+ isMiddlePoint: boolean;
8
+ isDestroyed: boolean;
9
+ labelLayer: any;
10
+ private _geoJson;
11
+ private _style;
12
+ /**
13
+ * 构造函数,用于创建一个地图元素实例
14
+ * @param map 地图对象,包含地图上下文信息
15
+ * @param options 配置选项对象
16
+ * @param options.positions 点的坐标位置数组
17
+ * @param options.style 样式配置
18
+ * @param options.isMiddlePoint 是否为中间点的标识,默认为false
19
+ */
20
+ constructor(map: any, { positions, style, isMiddlePoint }: any);
21
+ getMap(): any;
22
+ private _canOperate;
23
+ private _create;
24
+ private _createLabel;
25
+ startEdit(): void;
26
+ mouseDragStart(): void;
27
+ mouseDragChange(position: any): void;
28
+ endEdit(): void;
29
+ show(isShow: boolean): void;
30
+ destroy(): void;
12
31
  }
32
+ declare class Point extends BaseShape {
33
+ readonly type: string;
34
+ shapePointLayer: any;
35
+ constructor(drawContext: any, config: any);
36
+ transformData(positions: any[]): void;
37
+ addPoint(position: any): void;
38
+ startEdit(): void;
39
+ mouseDragStart(position: any, dragLayer: any): void;
40
+ mouseDragChange(position: any): void;
41
+ mouseDragEnd(): void;
42
+ endEdit(layer: any): void;
43
+ destroy(): void;
44
+ }
45
+ export default Point;