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.
- package/dist/assets/Build/DeepTwins/Image/f_point.png +0 -0
- package/dist/esm/analyze/SubmergenceAnalysis.d.ts +19 -0
- package/dist/esm/analyze/SubmergenceAnalysis.js +137 -0
- package/dist/esm/constant.d.ts +29 -0
- package/dist/esm/constant.js +47 -0
- package/dist/esm/drawer/index.d.ts +56 -59
- package/dist/esm/drawer/index.js +380 -292
- package/dist/esm/drawer/shape/BaseShape.d.ts +33 -0
- package/dist/esm/drawer/shape/BaseShape.js +228 -0
- package/dist/esm/drawer/shape/Point.d.ts +44 -11
- package/dist/esm/drawer/shape/Point.js +299 -35
- package/dist/esm/drawer/shape/Polygon.d.ts +43 -9
- package/dist/esm/drawer/shape/Polygon.js +408 -56
- package/dist/esm/drawer/shape/Polyline.d.ts +41 -10
- package/dist/esm/drawer/shape/Polyline.js +373 -31
- package/dist/esm/drawer/utils.d.ts +1 -0
- package/dist/esm/drawer/utils.js +63 -0
- package/dist/esm/graphicLayer/BaseLayer.d.ts +1 -0
- package/dist/esm/graphicLayer/BaseLayer.js +8 -3
- package/dist/esm/graphicLayer/BaseSource.d.ts +1 -1
- package/dist/esm/graphicLayer/BaseSource.js +13 -3
- package/dist/esm/graphicLayer/GraphicLayerCollection.d.ts +2 -0
- package/dist/esm/graphicLayer/GraphicLayerCollection.js +46 -4
- package/dist/esm/graphicLayer/HtmlEntity.js +1 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +7 -4
- package/dist/esm/map/Map.d.ts +1 -0
- package/dist/esm/map/Map.js +10 -0
- package/dist/esm/measure/Area.d.ts +29 -0
- package/dist/esm/measure/{AreaMeasure.js → Area.js} +156 -65
- package/dist/esm/measure/BaseDraw.d.ts +13 -0
- package/dist/esm/measure/BaseDraw.js +70 -0
- package/dist/esm/measure/Distance.d.ts +23 -0
- package/dist/esm/measure/Distance.js +239 -0
- package/dist/esm/measure/index.d.ts +44 -5
- package/dist/esm/measure/index.js +278 -5
- package/dist/esm/measure/utils.d.ts +108 -14
- package/dist/esm/measure/utils.js +262 -20
- package/dist/esm/plot/create/CreateAssemble.d.ts +2 -0
- package/dist/esm/plot/create/CreateAssemble.js +63 -0
- package/dist/esm/plot/create/CreateAttackArrow.d.ts +5 -0
- package/dist/esm/plot/create/CreateAttackArrow.js +75 -0
- package/dist/esm/plot/create/CreateBillboard.d.ts +2 -0
- package/dist/esm/plot/create/CreateBillboard.js +47 -0
- package/dist/esm/plot/create/CreateBow.d.ts +2 -0
- package/dist/esm/plot/create/CreateBow.js +63 -0
- package/dist/esm/plot/create/CreateCircle.d.ts +2 -0
- package/dist/esm/plot/create/CreateCircle.js +68 -0
- package/dist/esm/plot/create/CreateCurve.d.ts +2 -0
- package/dist/esm/plot/create/CreateCurve.js +76 -0
- package/dist/esm/plot/create/CreateElliptic.d.ts +2 -0
- package/dist/esm/plot/create/CreateElliptic.js +69 -0
- package/dist/esm/plot/create/CreateFlag.d.ts +2 -0
- package/dist/esm/plot/create/CreateFlag.js +80 -0
- package/dist/esm/plot/create/CreateFormation.d.ts +2 -0
- package/dist/esm/plot/create/CreateFormation.js +65 -0
- package/dist/esm/plot/create/CreateFreeLine.d.ts +2 -0
- package/dist/esm/plot/create/CreateFreeLine.js +69 -0
- package/dist/esm/plot/create/CreateFreePolygon.d.ts +2 -0
- package/dist/esm/plot/create/CreateFreePolygon.js +65 -0
- package/dist/esm/plot/create/CreateLabel.d.ts +2 -0
- package/dist/esm/plot/create/CreateLabel.js +55 -0
- package/dist/esm/plot/create/CreateLineArrow.d.ts +2 -0
- package/dist/esm/plot/create/CreateLineArrow.js +79 -0
- package/dist/esm/plot/create/CreatePincerArrow.d.ts +5 -0
- package/dist/esm/plot/create/CreatePincerArrow.js +73 -0
- package/dist/esm/plot/create/CreatePoint.d.ts +2 -0
- package/dist/esm/plot/create/CreatePoint.js +47 -0
- package/dist/esm/plot/create/CreatePolygon.d.ts +2 -0
- package/dist/esm/plot/create/CreatePolygon.js +80 -0
- package/dist/esm/plot/create/CreatePolyline.d.ts +2 -0
- package/dist/esm/plot/create/CreatePolyline.js +70 -0
- package/dist/esm/plot/create/CreateRectangle.d.ts +2 -0
- package/dist/esm/plot/create/CreateRectangle.js +60 -0
- package/dist/esm/plot/create/CreateRegularPolygon.d.ts +2 -0
- package/dist/esm/plot/create/CreateRegularPolygon.js +75 -0
- package/dist/esm/plot/create/CreateRightAngleArrow.d.ts +5 -0
- package/dist/esm/plot/create/CreateRightAngleArrow.js +73 -0
- package/dist/esm/plot/create/CreateRoundRectangle.d.ts +2 -0
- package/dist/esm/plot/create/CreateRoundRectangle.js +63 -0
- package/dist/esm/plot/create/CreateSector.d.ts +2 -0
- package/dist/esm/plot/create/CreateSector.js +65 -0
- package/dist/esm/plot/create/CreateStraightArrow.d.ts +5 -0
- package/dist/esm/plot/create/CreateStraightArrow.js +65 -0
- package/dist/esm/plot/create/CreateSwallowtailArrow.d.ts +5 -0
- package/dist/esm/plot/create/CreateSwallowtailArrow.js +67 -0
- package/dist/esm/plot/create/index.d.ts +25 -0
- package/dist/esm/plot/create/index.js +25 -0
- package/dist/esm/plot/edit/EditAssemble.d.ts +8 -0
- package/dist/esm/plot/edit/EditAssemble.js +120 -0
- package/dist/esm/plot/edit/EditAttackArrow.d.ts +8 -0
- package/dist/esm/plot/edit/EditAttackArrow.js +182 -0
- package/dist/esm/plot/edit/EditBillboard.d.ts +7 -0
- package/dist/esm/plot/edit/EditBillboard.js +70 -0
- package/dist/esm/plot/edit/EditBow.d.ts +8 -0
- package/dist/esm/plot/edit/EditBow.js +119 -0
- package/dist/esm/plot/edit/EditCircle.d.ts +8 -0
- package/dist/esm/plot/edit/EditCircle.js +133 -0
- package/dist/esm/plot/edit/EditCurve.d.ts +8 -0
- package/dist/esm/plot/edit/EditCurve.js +180 -0
- package/dist/esm/plot/edit/EditElliptic.d.ts +8 -0
- package/dist/esm/plot/edit/EditElliptic.js +144 -0
- package/dist/esm/plot/edit/EditFlag.d.ts +8 -0
- package/dist/esm/plot/edit/EditFlag.js +121 -0
- package/dist/esm/plot/edit/EditFormation.d.ts +8 -0
- package/dist/esm/plot/edit/EditFormation.js +120 -0
- package/dist/esm/plot/edit/EditLabel.d.ts +7 -0
- package/dist/esm/plot/edit/EditLabel.js +100 -0
- package/dist/esm/plot/edit/EditLineArrow.d.ts +8 -0
- package/dist/esm/plot/edit/EditLineArrow.js +180 -0
- package/dist/esm/plot/edit/EditPincerArrow.d.ts +8 -0
- package/dist/esm/plot/edit/EditPincerArrow.js +121 -0
- package/dist/esm/plot/edit/EditPoint.d.ts +7 -0
- package/dist/esm/plot/edit/EditPoint.js +70 -0
- package/dist/esm/plot/edit/EditPolygon.d.ts +8 -0
- package/dist/esm/plot/edit/EditPolygon.js +181 -0
- package/dist/esm/plot/edit/EditPolyline.d.ts +8 -0
- package/dist/esm/plot/edit/EditPolyline.js +179 -0
- package/dist/esm/plot/edit/EditRectangle.d.ts +8 -0
- package/dist/esm/plot/edit/EditRectangle.js +119 -0
- package/dist/esm/plot/edit/EditRegularPolygon.d.ts +8 -0
- package/dist/esm/plot/edit/EditRegularPolygon.js +170 -0
- package/dist/esm/plot/edit/EditRightAngleArrow.d.ts +8 -0
- package/dist/esm/plot/edit/EditRightAngleArrow.js +143 -0
- package/dist/esm/plot/edit/EditRoundRectangle.d.ts +8 -0
- package/dist/esm/plot/edit/EditRoundRectangle.js +119 -0
- package/dist/esm/plot/edit/EditSector.d.ts +8 -0
- package/dist/esm/plot/edit/EditSector.js +120 -0
- package/dist/esm/plot/edit/EditStraightArrow.d.ts +8 -0
- package/dist/esm/plot/edit/EditStraightArrow.js +120 -0
- package/dist/esm/plot/edit/EditSwallowtailArrow.d.ts +8 -0
- package/dist/esm/plot/edit/EditSwallowtailArrow.js +121 -0
- package/dist/esm/plot/edit/index.d.ts +23 -0
- package/dist/esm/plot/edit/index.js +23 -0
- package/dist/esm/plot/utils/Algorithm.d.ts +2 -0
- package/dist/esm/plot/utils/Algorithm.js +316 -0
- package/dist/esm/plot/utils/Coordinate.d.ts +98 -0
- package/dist/esm/plot/utils/Coordinate.js +184 -0
- package/dist/esm/plot/utils/DomUtil.d.ts +34 -0
- package/dist/esm/plot/utils/DomUtil.js +100 -0
- package/dist/esm/plot/utils/PlotCommon.d.ts +101 -0
- package/dist/esm/plot/utils/PlotCommon.js +1412 -0
- package/dist/esm/plot/utils/ReminderTip.d.ts +10 -0
- package/dist/esm/plot/utils/ReminderTip.js +67 -0
- package/dist/esm/plot/utils/Tooltip.d.ts +3 -0
- package/dist/esm/plot/utils/Tooltip.js +97 -0
- package/dist/esm/plot/utils/plotUtil.d.ts +5 -0
- package/dist/esm/plot/utils/plotUtil.js +268 -0
- package/dist/esm/tool/utils.d.ts +8 -7
- package/dist/esm/tool/utils.js +20 -16
- package/dist/esm/toolTip/index.d.ts +2 -1
- package/dist/esm/toolTip/index.js +12 -6
- package/dist/esm/typings.d.ts +1 -0
- package/dist/umd/deeptwins-engine-3d.min.js +1 -1
- package/package.json +1 -1
- package/dist/esm/drawer/base.d.ts +0 -51
- package/dist/esm/drawer/base.js +0 -179
- package/dist/esm/drawer/painter.d.ts +0 -41
- package/dist/esm/drawer/painter.js +0 -115
- package/dist/esm/drawer/shape/Ellipse.d.ts +0 -10
- package/dist/esm/drawer/shape/Ellipse.js +0 -62
- package/dist/esm/drawer/shape/Rectangle.d.ts +0 -10
- package/dist/esm/drawer/shape/Rectangle.js +0 -85
- package/dist/esm/drawer/typings.d.ts +0 -106
- package/dist/esm/drawer/typings.js +0 -1
- package/dist/esm/measure/AreaMeasure.d.ts +0 -19
- package/dist/esm/measure/AreaSurfaceMeasure.d.ts +0 -30
- package/dist/esm/measure/AreaSurfaceMeasure.js +0 -151
- package/dist/esm/measure/DistanceMeasure.d.ts +0 -19
- package/dist/esm/measure/DistanceMeasure.js +0 -91
- package/dist/esm/measure/DistanceSurfaceMeasure.d.ts +0 -37
- package/dist/esm/measure/DistanceSurfaceMeasure.js +0 -122
- package/dist/esm/measure/Measure.d.ts +0 -111
- package/dist/esm/measure/Measure.js +0 -177
- package/dist/esm/tool/cesiumExtends/Subscriber/index.d.ts +0 -66
- package/dist/esm/tool/cesiumExtends/Subscriber/index.js +0 -246
- package/dist/esm/tool/kriging.d.ts +0 -10
- package/dist/esm/tool/kriging.js +0 -436
|
@@ -8,7 +8,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
8
8
|
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; }
|
|
9
9
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
10
10
|
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); }
|
|
11
|
-
import { flattenDeep } from 'lodash';
|
|
11
|
+
import { flattenDeep, isArray, isString } from 'lodash';
|
|
12
12
|
import { v4 as uuidv4 } from 'uuid';
|
|
13
13
|
import * as utils from "../tool/utils";
|
|
14
14
|
import BaseLayer from "./BaseLayer";
|
|
@@ -83,6 +83,27 @@ var GraphicLayerCollection = /*#__PURE__*/function () {
|
|
|
83
83
|
return source;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
// 添加原始数据
|
|
87
|
+
}, {
|
|
88
|
+
key: "addOriginalDataToSource",
|
|
89
|
+
value: function addOriginalDataToSource(id, positions) {
|
|
90
|
+
if (!this._canOperate()) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
var uuid = id;
|
|
94
|
+
if (this.graphicSources.get(uuid)) {
|
|
95
|
+
utils.warn("id".concat(uuid, "\u5DF2\u7ECF\u5B58\u5728\uFF0C\u5DF2\u81EA\u52A8\u751F\u6210\u968F\u673Aid"));
|
|
96
|
+
uuid = uuidv4();
|
|
97
|
+
}
|
|
98
|
+
var source = new BaseSource({
|
|
99
|
+
id: uuid,
|
|
100
|
+
originalData: positions,
|
|
101
|
+
mapContext: this._mapContext
|
|
102
|
+
});
|
|
103
|
+
this.graphicSources.set(source.id, source);
|
|
104
|
+
return source;
|
|
105
|
+
}
|
|
106
|
+
|
|
86
107
|
// 添加图层
|
|
87
108
|
}, {
|
|
88
109
|
key: "addLayer",
|
|
@@ -118,6 +139,27 @@ var GraphicLayerCollection = /*#__PURE__*/function () {
|
|
|
118
139
|
return layer;
|
|
119
140
|
}
|
|
120
141
|
|
|
142
|
+
// 添加原始数据到图层
|
|
143
|
+
}, {
|
|
144
|
+
key: "addOriginalDataToLayer",
|
|
145
|
+
value: function addOriginalDataToLayer(positions, options) {
|
|
146
|
+
if (!this._canOperate()) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
var uuid = uuidv4();
|
|
150
|
+
var source = this.addOriginalDataToSource(uuid, positions);
|
|
151
|
+
// 生成graphicLayer
|
|
152
|
+
var layer = new BaseLayer({
|
|
153
|
+
id: uuid,
|
|
154
|
+
source: source,
|
|
155
|
+
options: options,
|
|
156
|
+
mapContext: this._mapContext
|
|
157
|
+
});
|
|
158
|
+
// 添加到地图上
|
|
159
|
+
this._addLayerToMap(layer, options);
|
|
160
|
+
return layer;
|
|
161
|
+
}
|
|
162
|
+
|
|
121
163
|
// 添加图层自定义数据
|
|
122
164
|
}, {
|
|
123
165
|
key: "addCustomSourceToLayer",
|
|
@@ -222,7 +264,7 @@ var GraphicLayerCollection = /*#__PURE__*/function () {
|
|
|
222
264
|
if (!this._canOperate()) {
|
|
223
265
|
return;
|
|
224
266
|
}
|
|
225
|
-
return
|
|
267
|
+
return isString(id) ? this.graphicLayers.get(id) : id;
|
|
226
268
|
}
|
|
227
269
|
|
|
228
270
|
// 获取数据
|
|
@@ -232,7 +274,7 @@ var GraphicLayerCollection = /*#__PURE__*/function () {
|
|
|
232
274
|
if (!this._canOperate()) {
|
|
233
275
|
return;
|
|
234
276
|
}
|
|
235
|
-
return
|
|
277
|
+
return isString(id) ? this.graphicSources.get(id) : id;
|
|
236
278
|
}
|
|
237
279
|
|
|
238
280
|
// 显示隐藏图层
|
|
@@ -425,7 +467,7 @@ var GraphicLayerCollection = /*#__PURE__*/function () {
|
|
|
425
467
|
if (!this._canOperate()) {
|
|
426
468
|
return;
|
|
427
469
|
}
|
|
428
|
-
if (
|
|
470
|
+
if (isArray(layers)) {
|
|
429
471
|
var graphicLayers = layers.map(function (layer) {
|
|
430
472
|
return _this2.getLayer(layer);
|
|
431
473
|
});
|
|
@@ -17,11 +17,10 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
17
17
|
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; }
|
|
18
18
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
19
19
|
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); }
|
|
20
|
-
import { cloneDeep, isNil, merge } from 'lodash';
|
|
20
|
+
import { cloneDeep, isNil, isString, merge } from 'lodash';
|
|
21
21
|
import { DEFAULT_HTML_OPTIONS, HTML_CONTAINER_ID } from "../constant";
|
|
22
22
|
import { ClampToGround } from "../tool/common";
|
|
23
23
|
import * as utils from "../tool/utils";
|
|
24
|
-
import { isString } from "../tool/utils";
|
|
25
24
|
import BaseEntity from "./BaseEntity";
|
|
26
25
|
var horizontalOriginObj = {
|
|
27
26
|
1: 0,
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -59,7 +59,7 @@ export declare class DeepTwinsEngine3D {
|
|
|
59
59
|
static DistanceDisplayCondition: any;
|
|
60
60
|
static BoundingRectangle: any;
|
|
61
61
|
static SplitDirection: any;
|
|
62
|
-
static Kriging: any;
|
|
63
62
|
static ImageGlowingMaterialProperty: any;
|
|
63
|
+
static SubmergenceAnalysis: any;
|
|
64
64
|
}
|
|
65
65
|
export default DeepTwinsEngine3D;
|
package/dist/esm/index.js
CHANGED
|
@@ -7,6 +7,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
7
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
8
|
//引入cesium基础库
|
|
9
9
|
import * as Cesium from 'deeptwins-cesium';
|
|
10
|
+
import SubmergenceAnalysis from "./analyze/SubmergenceAnalysis";
|
|
10
11
|
import ModelRoamHistory from "./cameraControl/ModelRoamHistory";
|
|
11
12
|
import ModelRoamRealTime from "./cameraControl/ModelRoamRealTime";
|
|
12
13
|
import Roam from "./cameraControl/Roam";
|
|
@@ -26,7 +27,7 @@ import ImageGlowingMaterialProperty from "./material/entity/ImageGlowingMaterial
|
|
|
26
27
|
import ImageMaterialProperty from "./material/entity/ImageMaterialProperty";
|
|
27
28
|
import PolylineTrailLinkMaterialProperty from "./material/entity/PolylineTrailLinkMaterialProperty";
|
|
28
29
|
import ImageGlowingMaterialAppearance from "./material/primitive/ImageGlowingMaterialAppearance";
|
|
29
|
-
import
|
|
30
|
+
import Measure from "./measure";
|
|
30
31
|
import PositionProperty from "./property/PositionProperty";
|
|
31
32
|
import ArcGisLayer from "./tileLayer/ArcGisLayer";
|
|
32
33
|
import RasterLayer from "./tileLayer/RasterLayer";
|
|
@@ -34,7 +35,6 @@ import WmsLayer from "./tileLayer/WmsLayer";
|
|
|
34
35
|
import WmtsLayer from "./tileLayer/WmtsLayer";
|
|
35
36
|
import TimerInterval from "./tool/TimerInterval";
|
|
36
37
|
import { ClampToGround, ShapeSection } from "./tool/common";
|
|
37
|
-
import Kriging from "./tool/kriging";
|
|
38
38
|
import { loadCss } from "./tool/utils";
|
|
39
39
|
import VideoProject from "./videoFusion/VideoProject";
|
|
40
40
|
import VideoTexture from "./videoFusion/VideoTexture";
|
|
@@ -45,13 +45,16 @@ import Heatmap2d from "./visualization/Heatmap2d";
|
|
|
45
45
|
import Heatmap3d from "./visualization/Heatmap3d";
|
|
46
46
|
import PointCluster from "./visualization/PointCluster";
|
|
47
47
|
window.Cesium = Cesium;
|
|
48
|
+
// 将DEEP_TWINS_BASE_URL赋值给CESIUM_BASE_URL
|
|
48
49
|
DEEP_TWINS_BASE_URL && (window.CESIUM_BASE_URL = DEEP_TWINS_BASE_URL);
|
|
49
50
|
// 全局加载css
|
|
50
51
|
loadCss(Cesium.buildModuleUrl('Widgets/widgets.css'));
|
|
52
|
+
// 打印版本信息
|
|
53
|
+
console.log('DeepTwinsEngine3D Version:', "0.1.34");
|
|
51
54
|
export var DeepTwinsEngine3D = /*#__PURE__*/_createClass(function DeepTwinsEngine3D() {
|
|
52
55
|
_classCallCheck(this, DeepTwinsEngine3D);
|
|
53
56
|
});
|
|
54
|
-
_defineProperty(DeepTwinsEngine3D, "Version", "0.1.
|
|
57
|
+
_defineProperty(DeepTwinsEngine3D, "Version", "0.1.34");
|
|
55
58
|
_defineProperty(DeepTwinsEngine3D, "Map", Map);
|
|
56
59
|
_defineProperty(DeepTwinsEngine3D, "GroundSkyBox", GroundSkyBox);
|
|
57
60
|
_defineProperty(DeepTwinsEngine3D, "RasterLayer", RasterLayer);
|
|
@@ -110,6 +113,6 @@ _defineProperty(DeepTwinsEngine3D, "NearFarScalar", Cesium.NearFarScalar);
|
|
|
110
113
|
_defineProperty(DeepTwinsEngine3D, "DistanceDisplayCondition", Cesium.DistanceDisplayCondition);
|
|
111
114
|
_defineProperty(DeepTwinsEngine3D, "BoundingRectangle", Cesium.BoundingRectangle);
|
|
112
115
|
_defineProperty(DeepTwinsEngine3D, "SplitDirection", Cesium.SplitDirection);
|
|
113
|
-
_defineProperty(DeepTwinsEngine3D, "Kriging", Kriging);
|
|
114
116
|
_defineProperty(DeepTwinsEngine3D, "ImageGlowingMaterialProperty", ImageGlowingMaterialProperty);
|
|
117
|
+
_defineProperty(DeepTwinsEngine3D, "SubmergenceAnalysis", SubmergenceAnalysis);
|
|
115
118
|
export default DeepTwinsEngine3D;
|
package/dist/esm/map/Map.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ export default class Map extends Cesium.Viewer implements MapContext {
|
|
|
45
45
|
addGraphicSource(id: string, data: any): any;
|
|
46
46
|
addGraphicEntityToSource(id: string, data: any): any;
|
|
47
47
|
addGraphicLayer(data: any, options: any): any;
|
|
48
|
+
_addOriginalDataToGraphicLayer(data: any, options: any): any;
|
|
48
49
|
addCustomSourceToGraphicLayer(data: any, options: any): any;
|
|
49
50
|
getGraphicSource(id: any): any;
|
|
50
51
|
getGraphicLayer(id: any): any;
|
package/dist/esm/map/Map.js
CHANGED
|
@@ -482,6 +482,16 @@ var Map = /*#__PURE__*/function (_Cesium$Viewer) {
|
|
|
482
482
|
return this.graphicLayerCollection.addLayer(data, options);
|
|
483
483
|
}
|
|
484
484
|
|
|
485
|
+
// 添加原始数据到图层
|
|
486
|
+
}, {
|
|
487
|
+
key: "_addOriginalDataToGraphicLayer",
|
|
488
|
+
value: function _addOriginalDataToGraphicLayer(data, options) {
|
|
489
|
+
if (!this.graphicLayerCollection) {
|
|
490
|
+
this.graphicLayerCollection = new GraphicLayerCollection(this);
|
|
491
|
+
}
|
|
492
|
+
return this.graphicLayerCollection.addOriginalDataToLayer(data, options);
|
|
493
|
+
}
|
|
494
|
+
|
|
485
495
|
// 直接自定义数据到图层
|
|
486
496
|
}, {
|
|
487
497
|
key: "addCustomSourceToGraphicLayer",
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import BaseDraw from './BaseDraw';
|
|
2
|
+
import { MeasureContext } from './index';
|
|
3
|
+
declare class Area extends BaseDraw {
|
|
4
|
+
private readonly _type;
|
|
5
|
+
private _config;
|
|
6
|
+
private _instance;
|
|
7
|
+
private _area;
|
|
8
|
+
private _areaLayer;
|
|
9
|
+
constructor(measureContext: MeasureContext, config: any);
|
|
10
|
+
private _init;
|
|
11
|
+
drawing(positions: any): {
|
|
12
|
+
area: any;
|
|
13
|
+
} | undefined;
|
|
14
|
+
pointsChange(layer: any, positions: any): {
|
|
15
|
+
area: any;
|
|
16
|
+
} | undefined;
|
|
17
|
+
drawEnd(positions: any): {
|
|
18
|
+
area: any;
|
|
19
|
+
} | undefined;
|
|
20
|
+
startEdit(): void;
|
|
21
|
+
endEdit(positions: any): {
|
|
22
|
+
area: any;
|
|
23
|
+
} | undefined;
|
|
24
|
+
private _calculateArea;
|
|
25
|
+
private _createAreaLabel;
|
|
26
|
+
private _destroyAreaLabel;
|
|
27
|
+
destroy(): void;
|
|
28
|
+
}
|
|
29
|
+
export default Area;
|
|
@@ -1,8 +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
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
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 _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; }
|
|
5
|
-
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
6
4
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
7
5
|
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."); }
|
|
8
6
|
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); }
|
|
@@ -12,8 +10,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
12
10
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
13
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); } }
|
|
14
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; }
|
|
15
|
-
function
|
|
16
|
-
function
|
|
13
|
+
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); }
|
|
14
|
+
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
17
15
|
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); }
|
|
18
16
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
19
17
|
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); }; }
|
|
@@ -21,77 +19,170 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
|
|
|
21
19
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
22
20
|
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; } }
|
|
23
21
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
import {
|
|
28
|
-
import
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
22
|
+
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; }
|
|
23
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
24
|
+
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); }
|
|
25
|
+
import { centerOfMass, point, polygon } from '@turf/turf';
|
|
26
|
+
import { SceneTransforms } from 'deeptwins-cesium';
|
|
27
|
+
import { STATUS } from "../drawer";
|
|
28
|
+
import { lngLatAltToCartesian3 } from "../tool/utils";
|
|
29
|
+
import BaseDraw from "./BaseDraw";
|
|
30
|
+
import * as utils from "./utils";
|
|
31
|
+
var Area = /*#__PURE__*/function (_BaseDraw) {
|
|
32
|
+
_inherits(Area, _BaseDraw);
|
|
33
|
+
var _super = _createSuper(Area);
|
|
34
|
+
function Area(measureContext, config) {
|
|
35
|
+
var _this;
|
|
36
|
+
_classCallCheck(this, Area);
|
|
37
|
+
_this = _super.call(this, measureContext);
|
|
38
|
+
_defineProperty(_assertThisInitialized(_this), "_type", 'area');
|
|
39
|
+
_defineProperty(_assertThisInitialized(_this), "_config", void 0);
|
|
40
|
+
// 线图层
|
|
41
|
+
_defineProperty(_assertThisInitialized(_this), "_instance", void 0);
|
|
42
|
+
_defineProperty(_assertThisInitialized(_this), "_area", 0);
|
|
43
|
+
// 鼠标移动的label
|
|
44
|
+
_defineProperty(_assertThisInitialized(_this), "_areaLayer", void 0);
|
|
45
|
+
_this._config = config;
|
|
46
|
+
_this._init();
|
|
47
|
+
return _this;
|
|
38
48
|
}
|
|
39
|
-
_createClass(
|
|
40
|
-
key: "
|
|
41
|
-
value: function
|
|
42
|
-
this.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
this.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
_createClass(Area, [{
|
|
50
|
+
key: "_init",
|
|
51
|
+
value: function _init() {
|
|
52
|
+
this._instance = this._drawer.startDraw('polygon', this._config);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// 绘制
|
|
56
|
+
}, {
|
|
57
|
+
key: "drawing",
|
|
58
|
+
value: function drawing(positions) {
|
|
59
|
+
if (!this._canOperate()) return;
|
|
60
|
+
this._measureContext._changeStatus(STATUS.DRAWING);
|
|
61
|
+
if (positions.length < 3) {
|
|
62
|
+
this._destroyAreaLabel();
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
var polygonPositions = [].concat(_toConsumableArray(positions), [positions[0]]);
|
|
66
|
+
this._area = this._calculateArea(polygonPositions);
|
|
67
|
+
var center = centerOfMass(polygon([polygonPositions]));
|
|
68
|
+
this._createAreaLabel(center.geometry.coordinates, "\u9762\u79EF".concat(utils.formatArea(this._area)));
|
|
69
|
+
return {
|
|
70
|
+
area: this._area
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// 点位修改
|
|
75
|
+
}, {
|
|
76
|
+
key: "pointsChange",
|
|
77
|
+
value: function pointsChange(layer, positions) {
|
|
78
|
+
if (!this._canOperate()) return;
|
|
79
|
+
if (positions.length < 3) {
|
|
80
|
+
this._destroyAreaLabel();
|
|
81
|
+
return {
|
|
82
|
+
area: 0
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
var polygonPositions = [].concat(_toConsumableArray(positions), [positions[0]]);
|
|
86
|
+
this._area = this._calculateArea(polygonPositions);
|
|
87
|
+
var center = centerOfMass(polygon([polygonPositions]));
|
|
88
|
+
this._createAreaLabel(center.geometry.coordinates, "\u9762\u79EF".concat(utils.formatArea(this._area)));
|
|
89
|
+
return {
|
|
90
|
+
area: this._area
|
|
91
|
+
};
|
|
55
92
|
}
|
|
56
93
|
|
|
57
|
-
|
|
58
|
-
* 计算多边形面积
|
|
59
|
-
* @param {Cartesian3[]} positions 点位
|
|
60
|
-
* @returns {number} 面积/平方米
|
|
61
|
-
*/
|
|
94
|
+
// 结束绘制
|
|
62
95
|
}, {
|
|
63
|
-
key: "
|
|
64
|
-
value: function
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
96
|
+
key: "drawEnd",
|
|
97
|
+
value: function drawEnd(positions) {
|
|
98
|
+
if (!this._canOperate()) return;
|
|
99
|
+
this._measureContext._changeStatus(STATUS.END_DRAW);
|
|
100
|
+
this._measureContext.setDrawerLayer(this.id, this);
|
|
101
|
+
var polygonPositions = [].concat(_toConsumableArray(positions), [positions[0]]);
|
|
102
|
+
this._area = this._calculateArea(polygonPositions);
|
|
103
|
+
this.startEdit();
|
|
104
|
+
return {
|
|
105
|
+
area: this._area
|
|
106
|
+
};
|
|
69
107
|
}
|
|
108
|
+
|
|
109
|
+
// 开始编辑
|
|
70
110
|
}, {
|
|
71
|
-
key: "
|
|
72
|
-
value: function
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
var unitedArea = +convertArea(area, 'meters', this._units).toFixed(2);
|
|
76
|
-
// @ts-ignore
|
|
77
|
-
label.total = area;
|
|
78
|
-
label.text = "".concat(this._locale.area, ": ").concat(this._locale.formatArea(area, unitedArea, this._units));
|
|
111
|
+
key: "startEdit",
|
|
112
|
+
value: function startEdit() {
|
|
113
|
+
if (!this._canOperate()) return;
|
|
114
|
+
this._measureContext._changeStatus(STATUS.EDITING);
|
|
79
115
|
}
|
|
116
|
+
|
|
117
|
+
// 结束编辑
|
|
80
118
|
}, {
|
|
81
|
-
key: "
|
|
82
|
-
value: function
|
|
83
|
-
|
|
119
|
+
key: "endEdit",
|
|
120
|
+
value: function endEdit(positions) {
|
|
121
|
+
if (!this._canOperate()) return;
|
|
122
|
+
var polygonPositions = [].concat(_toConsumableArray(positions), [positions[0]]);
|
|
123
|
+
this._area = this._calculateArea(polygonPositions);
|
|
124
|
+
return {
|
|
125
|
+
area: this._area
|
|
126
|
+
};
|
|
84
127
|
}
|
|
128
|
+
|
|
129
|
+
// 计算面积
|
|
85
130
|
}, {
|
|
86
|
-
key: "
|
|
87
|
-
value: function
|
|
88
|
-
var
|
|
89
|
-
this.
|
|
90
|
-
|
|
91
|
-
|
|
131
|
+
key: "_calculateArea",
|
|
132
|
+
value: function _calculateArea(positions) {
|
|
133
|
+
var _this2 = this;
|
|
134
|
+
if (!this._canOperate()) return;
|
|
135
|
+
if (positions.length < 4) return;
|
|
136
|
+
var area = 0;
|
|
137
|
+
var config = _objectSpread(_objectSpread({}, this._measureContext.options), this._config);
|
|
138
|
+
var positionsC3 = positions.map(function (t) {
|
|
139
|
+
return lngLatAltToCartesian3(t[0], t[1], t[2]);
|
|
92
140
|
});
|
|
141
|
+
if (config.clampToGround) {
|
|
142
|
+
area = utils.calculateSurfaceArea(this.getMap(), positionsC3.map(function (item) {
|
|
143
|
+
return SceneTransforms.worldToWindowCoordinates(_this2.getMap().scene, item);
|
|
144
|
+
}));
|
|
145
|
+
} else {
|
|
146
|
+
area = utils.getArea(this.getMap(), positionsC3);
|
|
147
|
+
}
|
|
148
|
+
return area;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// 绘制area label
|
|
152
|
+
}, {
|
|
153
|
+
key: "_createAreaLabel",
|
|
154
|
+
value: function _createAreaLabel(position, text) {
|
|
155
|
+
if (!this._canOperate()) return;
|
|
156
|
+
if (this._areaLayer) {
|
|
157
|
+
this._areaLayer.setData(point(position));
|
|
158
|
+
this._areaLayer.setStyle({
|
|
159
|
+
text: text
|
|
160
|
+
});
|
|
161
|
+
} else {
|
|
162
|
+
this._areaLayer = this.createLabelLayer(position, text);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// 销毁area label
|
|
167
|
+
}, {
|
|
168
|
+
key: "_destroyAreaLabel",
|
|
169
|
+
value: function _destroyAreaLabel() {
|
|
170
|
+
this._areaLayer && this._areaLayer.destroy();
|
|
171
|
+
this._areaLayer = null;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// 销毁
|
|
175
|
+
}, {
|
|
176
|
+
key: "destroy",
|
|
177
|
+
value: function destroy() {
|
|
178
|
+
if (!this._canOperate()) return;
|
|
179
|
+
_get(_getPrototypeOf(Area.prototype), "destroy", this).call(this);
|
|
180
|
+
this._drawer.removeDrawerLayer(this._instance);
|
|
181
|
+
this._instance = null;
|
|
182
|
+
this._areaLayer && this._areaLayer.remove();
|
|
183
|
+
this._areaLayer = null;
|
|
93
184
|
}
|
|
94
185
|
}]);
|
|
95
|
-
return
|
|
96
|
-
}(
|
|
97
|
-
export default
|
|
186
|
+
return Area;
|
|
187
|
+
}(BaseDraw);
|
|
188
|
+
export default Area;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MeasureContext } from './index';
|
|
2
|
+
declare class BaseDraw {
|
|
3
|
+
_measureContext: MeasureContext;
|
|
4
|
+
id: string;
|
|
5
|
+
_drawer: any;
|
|
6
|
+
isDestroyed: boolean;
|
|
7
|
+
constructor(measureContext: MeasureContext);
|
|
8
|
+
_canOperate(): boolean;
|
|
9
|
+
getMap(): any;
|
|
10
|
+
createLabelLayer(position: any, text: string, style?: any): any;
|
|
11
|
+
destroy(): void;
|
|
12
|
+
}
|
|
13
|
+
export default BaseDraw;
|
|
@@ -0,0 +1,70 @@
|
|
|
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 { point } from '@turf/turf';
|
|
11
|
+
import * as Cesium from 'deeptwins-cesium';
|
|
12
|
+
import { v4 as uuidV4 } from 'uuid';
|
|
13
|
+
import PositionProperty from "../property/PositionProperty";
|
|
14
|
+
import { error } from "../tool/utils";
|
|
15
|
+
var BaseDraw = /*#__PURE__*/function () {
|
|
16
|
+
function BaseDraw(measureContext) {
|
|
17
|
+
_classCallCheck(this, BaseDraw);
|
|
18
|
+
_defineProperty(this, "_measureContext", void 0);
|
|
19
|
+
_defineProperty(this, "id", void 0);
|
|
20
|
+
_defineProperty(this, "_drawer", void 0);
|
|
21
|
+
_defineProperty(this, "isDestroyed", false);
|
|
22
|
+
this.id = uuidV4();
|
|
23
|
+
this._measureContext = measureContext;
|
|
24
|
+
this._drawer = measureContext.drawer;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// 是否能进行操作
|
|
28
|
+
_createClass(BaseDraw, [{
|
|
29
|
+
key: "_canOperate",
|
|
30
|
+
value: function _canOperate() {
|
|
31
|
+
if (this.isDestroyed) {
|
|
32
|
+
error('measureDraw实例已销毁');
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
}, {
|
|
38
|
+
key: "getMap",
|
|
39
|
+
value: function getMap() {
|
|
40
|
+
return this._measureContext && this._measureContext.getMap();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// 创建label图层
|
|
44
|
+
}, {
|
|
45
|
+
key: "createLabelLayer",
|
|
46
|
+
value: function createLabelLayer(position, text) {
|
|
47
|
+
var style = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
48
|
+
return this.getMap().addGraphicLayer(point(position), {
|
|
49
|
+
type: 'label',
|
|
50
|
+
style: _objectSpread({
|
|
51
|
+
text: text,
|
|
52
|
+
font: 'bold 16px Arial',
|
|
53
|
+
style: Cesium.LabelStyle.FILL_AND_OUTLINE,
|
|
54
|
+
outlineWidth: 4,
|
|
55
|
+
heightReference: Cesium.HeightReference.NONE,
|
|
56
|
+
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
57
|
+
}, style),
|
|
58
|
+
positionProperty: new PositionProperty()
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}, {
|
|
62
|
+
key: "destroy",
|
|
63
|
+
value: function destroy() {
|
|
64
|
+
if (!this._canOperate()) return;
|
|
65
|
+
this.isDestroyed = true;
|
|
66
|
+
}
|
|
67
|
+
}]);
|
|
68
|
+
return BaseDraw;
|
|
69
|
+
}();
|
|
70
|
+
export default BaseDraw;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import BaseDraw from './BaseDraw';
|
|
2
|
+
import { MeasureContext } from './index';
|
|
3
|
+
declare class Distance extends BaseDraw {
|
|
4
|
+
private readonly _type;
|
|
5
|
+
private _config;
|
|
6
|
+
private _instance;
|
|
7
|
+
private _measureCache;
|
|
8
|
+
private _mouseLabelLayer;
|
|
9
|
+
constructor(measureContext: MeasureContext, config: any);
|
|
10
|
+
private _init;
|
|
11
|
+
drawing(positions: any): any;
|
|
12
|
+
pointsChange(layer: any, positions: any): any[] | undefined;
|
|
13
|
+
drawEnd(): any[] | undefined;
|
|
14
|
+
startEdit(): void;
|
|
15
|
+
endEdit(): any[] | undefined;
|
|
16
|
+
private _createMouseMoveLabel;
|
|
17
|
+
private _destroyMouseMoveLabel;
|
|
18
|
+
private _calculateDistance;
|
|
19
|
+
private _calculateMouseDistance;
|
|
20
|
+
private _createMeasureCacheText;
|
|
21
|
+
destroy(): void;
|
|
22
|
+
}
|
|
23
|
+
export default Distance;
|