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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deeptwins-engine-3d",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
4
4
  "description": "map for 3d",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/esm/index.d.ts",
@@ -1,51 +0,0 @@
1
- import { CallbackProperty, Cartesian2 } from 'deeptwins-cesium';
2
- import type { Cartesian3, Entity } from 'deeptwins-cesium';
3
- import type { EventArgs } from '../tool/cesiumExtends/Subscriber/index';
4
- import type Painter from './painter';
5
- type CreateFunc = (callback: CallbackProperty, bool: boolean) => Entity;
6
- export interface LifeCycle {
7
- dropPoint?: (move: EventArgs) => void;
8
- moving?: (move: EventArgs) => void;
9
- cancel?: (move: EventArgs) => void;
10
- playOff?: (move: EventArgs) => void;
11
- createShape?: CreateFunc;
12
- }
13
- export type BasicGraphicsOptions = {
14
- finalOptions?: object;
15
- dynamicOptions?: object;
16
- sameStyle?: boolean;
17
- onPointsChange?: (points: Cartesian3[], coordinates: any[]) => void;
18
- complete?: (entity: Entity, positions: Cartesian3[], coordinates: any[]) => void;
19
- };
20
- export default class BasicGraphics {
21
- result: Entity;
22
- painter: Painter;
23
- protected _terrain: boolean | undefined;
24
- protected _lastClickPosition: Cartesian2;
25
- private _mouseDelta;
26
- finalOptions: object;
27
- dynamicOptions: object;
28
- sameStyle: boolean;
29
- protected _onPointsChange: ((points: any[], coordinates: any[]) => void) | undefined;
30
- protected _complete: ((entity: Entity, positions: Cartesian3[], coordinates: any[]) => void) | undefined;
31
- /**
32
- *
33
- * @param painter
34
- * @param options
35
- * @param flag
36
- */
37
- constructor(painter: Painter, options?: BasicGraphicsOptions);
38
- protected _dropPoint(move: EventArgs, createShape: CreateFunc): void;
39
- moving(event: EventArgs): void;
40
- protected _moving(event: EventArgs): void;
41
- protected _playOff(createShape: (positions: Cartesian3[]) => Entity): Entity;
42
- protected _cancel(createShape: (positions: Cartesian3[]) => Entity): void;
43
- SetBreakpoint(earthPosition: Cartesian3): void;
44
- /**
45
- * 将新的点添加到动态数组中
46
- * @param {Cartesian3} earthPosition
47
- * @param {CreateFunc} createShape
48
- */
49
- dynamicUpdate(earthPosition: Cartesian3, createShape: CreateFunc): void;
50
- }
51
- export {};
@@ -1,179 +0,0 @@
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 _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; }
6
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
- 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); }
8
- import { CallbackProperty, Cartesian2, defined } from 'deeptwins-cesium';
9
- import { cartesian3ToLngLatAlt } from "../tool/utils";
10
- var BasicGraphics = /*#__PURE__*/function () {
11
- /**
12
- *
13
- * @param painter
14
- * @param options
15
- * @param flag
16
- */
17
- function BasicGraphics(painter) {
18
- var _options$finalOptions, _options$dynamicOptio, _options$sameStyle;
19
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
20
- _classCallCheck(this, BasicGraphics);
21
- _defineProperty(this, "result", void 0);
22
- _defineProperty(this, "painter", void 0);
23
- _defineProperty(this, "_terrain", void 0);
24
- _defineProperty(this, "_lastClickPosition", new Cartesian2(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY));
25
- _defineProperty(this, "_mouseDelta", 10);
26
- _defineProperty(this, "finalOptions", void 0);
27
- _defineProperty(this, "dynamicOptions", {});
28
- _defineProperty(this, "sameStyle", void 0);
29
- _defineProperty(this, "_onPointsChange", void 0);
30
- _defineProperty(this, "_complete", void 0);
31
- this.painter = painter;
32
- this._terrain = painter._terrain;
33
- this.finalOptions = (_options$finalOptions = options.finalOptions) !== null && _options$finalOptions !== void 0 ? _options$finalOptions : {};
34
- this.dynamicOptions = (_options$dynamicOptio = options.dynamicOptions) !== null && _options$dynamicOptio !== void 0 ? _options$dynamicOptio : {};
35
- this.sameStyle = (_options$sameStyle = options.sameStyle) !== null && _options$sameStyle !== void 0 ? _options$sameStyle : false;
36
- this._onPointsChange = options.onPointsChange;
37
- this._complete = options.complete;
38
- }
39
- _createClass(BasicGraphics, [{
40
- key: "_dropPoint",
41
- value: function _dropPoint(move, createShape) {
42
- if (!move.position) return;
43
- var earthPosition = this.painter.pickCartesian3(move.position);
44
- if (!earthPosition || !defined(earthPosition)) return;
45
-
46
- // 如果最近两个点的距离过小则return
47
- if (this._lastClickPosition && Cartesian2.magnitude(Cartesian2.subtract(this._lastClickPosition, move.position, {})) < this._mouseDelta) return;
48
-
49
- // 如果当前没有点则动态绘制
50
- if (!this.painter._activeShapePoints.length) {
51
- this.dynamicUpdate(earthPosition, createShape);
52
- }
53
- this.SetBreakpoint(earthPosition);
54
- Cartesian2.clone(move.position, this._lastClickPosition);
55
- }
56
- }, {
57
- key: "moving",
58
- value: function moving(event) {
59
- this._moving(event);
60
- }
61
- }, {
62
- key: "_moving",
63
- value: function _moving(event) {
64
- if (!event.endPosition || this.painter._activeShapePoints.length === 0) return;
65
- var earthPosition = this.painter.pickCartesian3(event.endPosition);
66
- if (earthPosition && defined(earthPosition)) {
67
- this.painter._activeShapePoints.pop();
68
- this.painter._activeShapePoints.push(earthPosition);
69
- if (this._onPointsChange) {
70
- var _points = this.painter._activeShapePoints.map(function (t) {
71
- return cartesian3ToLngLatAlt(t);
72
- });
73
- this._onPointsChange(this.painter._activeShapePoints, _points);
74
- }
75
- }
76
- this.painter._viewer.scene.requestRender();
77
- }
78
- }, {
79
- key: "_playOff",
80
- value: function _playOff(createShape) {
81
- this.painter._activeShapePoints.pop();
82
- if (this._onPointsChange) {
83
- var _points2 = this.painter._activeShapePoints.map(function (t) {
84
- return cartesian3ToLngLatAlt(t);
85
- });
86
- this._onPointsChange(this.painter._activeShapePoints, _points2);
87
- }
88
- this.result = createShape(this.painter._activeShapePoints);
89
- var data;
90
- switch (this.painter._type) {
91
- case 'polyline':
92
- // @ts-ignore
93
- data = this.result.polyline.positions;
94
- break;
95
- case 'polygon':
96
- // @ts-ignore
97
- data = this.result.polygon.hierarchy;
98
- break;
99
- case 'rectangle':
100
- // @ts-ignore
101
- data = this.result.polyline.coordinates;
102
- break;
103
- case 'ellipse':
104
- // @ts-ignore
105
- data = this.result.position;
106
- break;
107
- }
108
- this.result = this.painter._viewer.addCustomSourceToGraphicLayer(data, {
109
- type: this.painter._type,
110
- id: this.result.id,
111
- entity: this.result
112
- });
113
- if (this._complete) {
114
- var _points3 = this.painter._activeShapePoints.map(function (t) {
115
- return cartesian3ToLngLatAlt(t);
116
- });
117
- this._complete(this.result, this.painter._activeShapePoints, _points3);
118
- }
119
- this.painter.reset();
120
- this._lastClickPosition = new Cartesian2(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY);
121
- return this.result;
122
- }
123
- }, {
124
- key: "_cancel",
125
- value: function _cancel(createShape) {
126
- if (this.painter._activeShapePoints.length < 3) {
127
- this.painter.reset();
128
- return;
129
- }
130
- // 移除最后一个固定点
131
- this.painter._activeShapePoints.splice(-2, 1);
132
- if (this._onPointsChange) {
133
- var _points4 = this.painter._activeShapePoints.map(function (t) {
134
- return cartesian3ToLngLatAlt(t);
135
- });
136
- this._onPointsChange(this.painter._activeShapePoints, _points4);
137
- }
138
- this.result = createShape(this.painter._activeShapePoints);
139
- var entity = this.painter._breakPointEntities.pop();
140
- if (entity) this.painter.removeEntity(entity);
141
- }
142
- }, {
143
- key: "SetBreakpoint",
144
- value: function SetBreakpoint(earthPosition) {
145
- this.painter._activeShapePoints.push(earthPosition);
146
- if (this._onPointsChange) {
147
- var _points5 = this.painter._activeShapePoints.map(function (t) {
148
- return cartesian3ToLngLatAlt(t);
149
- });
150
- this._onPointsChange(this.painter._activeShapePoints, _points5);
151
- }
152
- var $point = this.painter.createPoint(earthPosition);
153
- this.painter._breakPointEntities.push($point);
154
- this.painter.addView($point);
155
- }
156
-
157
- /**
158
- * 将新的点添加到动态数组中
159
- * @param {Cartesian3} earthPosition
160
- * @param {CreateFunc} createShape
161
- */
162
- }, {
163
- key: "dynamicUpdate",
164
- value: function dynamicUpdate(earthPosition, createShape) {
165
- var _this = this;
166
- this.painter._activeShapePoints.push(earthPosition);
167
-
168
- // 将动态绘制的图形加入Viewer
169
- var dynamicPositions = new CallbackProperty(function () {
170
- return _this.painter._activeShapePoints;
171
- }, false);
172
- this.painter._dynamicShapeEntity = createShape(dynamicPositions, true);
173
- this.painter.addView(this.painter._dynamicShapeEntity);
174
- return undefined;
175
- }
176
- }]);
177
- return BasicGraphics;
178
- }();
179
- export { BasicGraphics as default };
@@ -1,41 +0,0 @@
1
- import { Cartesian2, Cartesian3, Entity, PointGraphics, Viewer } from 'deeptwins-cesium';
2
- interface DrawOption {
3
- viewer: Viewer;
4
- type: any;
5
- terrain?: boolean;
6
- model?: boolean;
7
- }
8
- /**
9
- * @desc 画笔工具
10
- */
11
- export default class Painter {
12
- _viewer: any;
13
- _type: any;
14
- _terrain: boolean | undefined;
15
- _model?: boolean;
16
- _activeShapePoints: Cartesian3[];
17
- _dynamicShapeEntity: Entity | undefined;
18
- _breakPointEntities: Entity[];
19
- _addedEntitys: Entity[];
20
- constructor(options: DrawOption);
21
- /**
22
- * 将entity添加到视图
23
- * @param {Entity | Entity.ConstructorOptions} entity entity实体或者构造参数
24
- * @returns {Entity} entity
25
- */
26
- addView(entity: Entity | Entity.ConstructorOptions): Entity;
27
- /**
28
- * 移除entity
29
- * @param {Entity} entity entity实体
30
- * @returns {boolean} 是否移除成功
31
- */
32
- removeEntity(entity: Entity): boolean;
33
- createPoint(worldPosition: Cartesian3, options?: PointGraphics.ConstructorOptions): Entity;
34
- pickCartesian3(position: Cartesian2): Cartesian3 | undefined;
35
- /**
36
- * 重置绘画结果,清空间断点和动态图形
37
- */
38
- reset(): void;
39
- clear(): void;
40
- }
41
- export {};
@@ -1,115 +0,0 @@
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 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; }
3
- 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; }
4
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5
- 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); } }
6
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
7
- 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; }
8
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
- 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); }
10
- import { Entity } from 'deeptwins-cesium';
11
- import { defaultOptions } from "./index";
12
- /**
13
- * @desc 画笔工具
14
- */
15
- var Painter = /*#__PURE__*/function () {
16
- function Painter(options) {
17
- _classCallCheck(this, Painter);
18
- _defineProperty(this, "_viewer", void 0);
19
- _defineProperty(this, "_type", void 0);
20
- _defineProperty(this, "_terrain", void 0);
21
- _defineProperty(this, "_model", void 0);
22
- _defineProperty(this, "_activeShapePoints", []);
23
- _defineProperty(this, "_dynamicShapeEntity", void 0);
24
- _defineProperty(this, "_breakPointEntities", []);
25
- _defineProperty(this, "_addedEntitys", []);
26
- this._viewer = options.viewer;
27
- this._type = options.type;
28
- this._terrain = options.terrain;
29
- this._model = options.model;
30
- }
31
-
32
- /**
33
- * 将entity添加到视图
34
- * @param {Entity | Entity.ConstructorOptions} entity entity实体或者构造参数
35
- * @returns {Entity} entity
36
- */
37
- _createClass(Painter, [{
38
- key: "addView",
39
- value: function addView(entity) {
40
- var newEntity = this._viewer.entities.add(entity);
41
- this._viewer.scene.requestRender();
42
- this._addedEntitys.push(newEntity);
43
- return newEntity;
44
- }
45
-
46
- /**
47
- * 移除entity
48
- * @param {Entity} entity entity实体
49
- * @returns {boolean} 是否移除成功
50
- */
51
- }, {
52
- key: "removeEntity",
53
- value: function removeEntity(entity) {
54
- this._addedEntitys = this._addedEntitys.filter(function (item) {
55
- return item !== entity;
56
- });
57
- var bool = this._viewer.entities.remove(entity);
58
- this._viewer.scene.requestRender();
59
- return bool;
60
- }
61
- }, {
62
- key: "createPoint",
63
- value: function createPoint(worldPosition, options) {
64
- var _defaultOptions$dynam;
65
- return new Entity({
66
- position: worldPosition,
67
- point: _objectSpread(_objectSpread({}, (_defaultOptions$dynam = defaultOptions.dynamicGraphicsOptions) === null || _defaultOptions$dynam === void 0 ? void 0 : _defaultOptions$dynam.point), options)
68
- });
69
- }
70
- }, {
71
- key: "pickCartesian3",
72
- value: function pickCartesian3(position) {
73
- // We use `viewer.scene.pickPosition` here instead of `viewer.camera.pickEllipsoid` so that
74
- // we get the correct point when mousing over terrain.
75
- if (this._model) {
76
- return this._viewer.scene.pickPosition(position);
77
- }
78
- if (this._terrain) {
79
- var ray = this._viewer.camera.getPickRay(position);
80
- if (ray) return this._viewer.scene.globe.pick(ray, this._viewer.scene);
81
- } else {
82
- return this._viewer.camera.pickEllipsoid(position);
83
- }
84
- return undefined;
85
- }
86
-
87
- /**
88
- * 重置绘画结果,清空间断点和动态图形
89
- */
90
- }, {
91
- key: "reset",
92
- value: function reset() {
93
- if (this._dynamicShapeEntity) {
94
- this._viewer.entities.remove(this._dynamicShapeEntity);
95
- this._dynamicShapeEntity = undefined;
96
- }
97
- while (this._breakPointEntities.length) {
98
- var entity = this._breakPointEntities.pop();
99
- if (entity) this._viewer.entities.remove(entity);
100
- }
101
- this._activeShapePoints = [];
102
- }
103
- }, {
104
- key: "clear",
105
- value: function clear() {
106
- this.reset();
107
- while (this._addedEntitys.length) {
108
- var entity = this._addedEntitys.pop();
109
- if (entity) this._viewer.entities.remove(entity);
110
- }
111
- }
112
- }]);
113
- return Painter;
114
- }();
115
- export { Painter as default };
@@ -1,10 +0,0 @@
1
- import { CallbackProperty, Entity } from 'deeptwins-cesium';
2
- import BasicGraphics from '../base';
3
- import { Cartesian3 } from 'deeptwins-cesium';
4
- import type { LifeCycle } from '../base';
5
- export default class Ellipse extends BasicGraphics implements LifeCycle {
6
- dropPoint(move: any): void;
7
- playOff(): Entity;
8
- cancel(): void;
9
- createShape(hierarchy: Cartesian3[] | CallbackProperty, isDynamic?: boolean): Entity;
10
- }
@@ -1,62 +0,0 @@
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); }
7
- 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
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
9
- 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); }; }
10
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
11
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
12
- 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
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
14
- import { CallbackProperty, ClassificationType, Entity, JulianDate } from 'deeptwins-cesium';
15
- import BasicGraphics from "../base";
16
- import { Cartesian3 } from 'deeptwins-cesium';
17
- var Ellipse = /*#__PURE__*/function (_BasicGraphics) {
18
- _inherits(Ellipse, _BasicGraphics);
19
- var _super = _createSuper(Ellipse);
20
- function Ellipse() {
21
- _classCallCheck(this, Ellipse);
22
- return _super.apply(this, arguments);
23
- }
24
- _createClass(Ellipse, [{
25
- key: "dropPoint",
26
- value: function dropPoint(move) {
27
- this._dropPoint(move, this.createShape.bind(this));
28
- }
29
- }, {
30
- key: "playOff",
31
- value: function playOff() {
32
- return this._playOff(this.createShape.bind(this));
33
- }
34
- }, {
35
- key: "cancel",
36
- value: function cancel() {
37
- this._cancel(this.createShape.bind(this));
38
- }
39
- }, {
40
- key: "createShape",
41
- value: function createShape(hierarchy) {
42
- var isDynamic = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
43
- var target = Array.isArray(hierarchy) ? hierarchy : hierarchy.getValue(JulianDate.now());
44
- var radiusFuc = new CallbackProperty(function () {
45
- var distance = Cartesian3.distance(target[0], target[target.length - 1]);
46
- return distance || 1;
47
- }, false);
48
- var ellipse = Object.assign({}, isDynamic && !this.sameStyle ? this.dynamicOptions : this.finalOptions, {
49
- semiMinorAxis: radiusFuc,
50
- semiMajorAxis: radiusFuc,
51
- classificationType: this.painter._model ? ClassificationType.CESIUM_3D_TILE : undefined
52
- });
53
- var position = this.painter._activeShapePoints[0];
54
- return new Entity({
55
- position: position,
56
- ellipse: ellipse
57
- });
58
- }
59
- }]);
60
- return Ellipse;
61
- }(BasicGraphics);
62
- export { Ellipse as default };
@@ -1,10 +0,0 @@
1
- import { CallbackProperty, Cartesian3, Entity } from 'deeptwins-cesium';
2
- import type { LifeCycle } from '../base';
3
- import BasicGraphics from '../base';
4
- import type { EventArgs } from '../../tool/cesiumExtends/Subscriber';
5
- export default class Rectangle extends BasicGraphics implements LifeCycle {
6
- dropPoint(move: EventArgs): void;
7
- playOff(): Entity;
8
- cancel(): void;
9
- createShape(hierarchy: Cartesian3[] | CallbackProperty, isDynamic?: boolean): Entity;
10
- }
@@ -1,85 +0,0 @@
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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread 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 _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
7
- 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; }
8
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
- 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); } }
10
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
11
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
12
- 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); }
13
- 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); }
14
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
15
- 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); }; }
16
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
17
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
18
- 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; } }
19
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
20
- import { CallbackProperty, Cartesian2, Cartesian3, Rectangle as CesiumRectangle, Entity, JulianDate } from 'deeptwins-cesium';
21
- import BasicGraphics from "../base";
22
- import { cartesian3ToLngLatAlt } from "../../tool/utils";
23
- var Rectangle = /*#__PURE__*/function (_BasicGraphics) {
24
- _inherits(Rectangle, _BasicGraphics);
25
- var _super = _createSuper(Rectangle);
26
- function Rectangle() {
27
- _classCallCheck(this, Rectangle);
28
- return _super.apply(this, arguments);
29
- }
30
- _createClass(Rectangle, [{
31
- key: "dropPoint",
32
- value: function dropPoint(move) {
33
- this._dropPoint(move, this.createShape.bind(this));
34
- }
35
- }, {
36
- key: "playOff",
37
- value: function playOff() {
38
- var _this$result$rectangl;
39
- this.painter._activeShapePoints.pop();
40
- if (this._onPointsChange) {
41
- var _points = this.painter._activeShapePoints.map(function (t) {
42
- return cartesian3ToLngLatAlt(t);
43
- });
44
- this._onPointsChange(_toConsumableArray(this.painter._activeShapePoints), _points);
45
- }
46
- this.result = this.createShape(this.painter._activeShapePoints);
47
- var rect = (_this$result$rectangl = this.result.rectangle) === null || _this$result$rectangl === void 0 || (_this$result$rectangl = _this$result$rectangl.coordinates) === null || _this$result$rectangl === void 0 ? void 0 : _this$result$rectangl.getValue(new JulianDate());
48
- var west = rect.west,
49
- east = rect.east,
50
- north = rect.north,
51
- south = rect.south;
52
- var positions = [[west, north], [east, north], [east, south], [west, south]].map(function (pos) {
53
- return Cartesian3.fromRadians(pos[0], pos[1], 0);
54
- });
55
- var points = positions.map(function (t) {
56
- return cartesian3ToLngLatAlt(t);
57
- });
58
- if (this._complete) this._complete(this.result, positions, points);
59
- this.painter.reset();
60
- this._lastClickPosition = new Cartesian2(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY);
61
- return this.result;
62
- }
63
- }, {
64
- key: "cancel",
65
- value: function cancel() {
66
- this._cancel(this.createShape.bind(this));
67
- }
68
- }, {
69
- key: "createShape",
70
- value: function createShape(hierarchy) {
71
- var isDynamic = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
72
- var target = Array.isArray(hierarchy) ? hierarchy : hierarchy.getValue(JulianDate.now());
73
- var rectangle = Object.assign({}, isDynamic && !this.sameStyle ? this.dynamicOptions : this.finalOptions, {
74
- coordinates: new CallbackProperty(function () {
75
- return CesiumRectangle.fromCartesianArray(target);
76
- }, false)
77
- });
78
- return new Entity({
79
- rectangle: rectangle
80
- });
81
- }
82
- }]);
83
- return Rectangle;
84
- }(BasicGraphics);
85
- export { Rectangle as default };