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
package/dist/esm/drawer/index.js
CHANGED
|
@@ -1,350 +1,438 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
function 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
2
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5
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); } }
|
|
6
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; }
|
|
7
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; }
|
|
8
6
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
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); }
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
8
|
+
import { featureEach } from '@turf/turf';
|
|
9
|
+
import * as Cesium from 'deeptwins-cesium';
|
|
10
|
+
import { isString, merge } from 'lodash';
|
|
11
|
+
import { DEFAULT_DRAWER_OPTIONS, LAYER_EVENT_TYPE } from "../constant";
|
|
12
|
+
import BaseSource from "../graphicLayer/BaseSource";
|
|
13
|
+
import * as utils from "../tool/utils";
|
|
12
14
|
import ToolTip from "../toolTip/index";
|
|
13
|
-
import Painter from "./painter";
|
|
14
|
-
import Ellipse from "./shape/Ellipse";
|
|
15
15
|
import Point from "./shape/Point";
|
|
16
16
|
import Polygon from "./shape/Polygon";
|
|
17
17
|
import Polyline from "./shape/Polyline";
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
point: {
|
|
45
|
-
// HeightReference: HeightReference.CLAMP_TO_GROUND,
|
|
46
|
-
color: Color.BLUE,
|
|
47
|
-
pixelSize: 8,
|
|
48
|
-
outlineColor: Color.WHITE,
|
|
49
|
-
outlineWidth: 1
|
|
50
|
-
},
|
|
51
|
-
rectangle: {
|
|
52
|
-
material: Color.BLUE.withAlpha(0.5)
|
|
53
|
-
},
|
|
54
|
-
ellipse: {
|
|
55
|
-
material: Color.BLUE.withAlpha(0.5),
|
|
56
|
-
outline: true
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
sameStyle: true,
|
|
60
|
-
tips: {
|
|
61
|
-
init: '点击绘制',
|
|
62
|
-
start: '左键添加点,右键移除点,双击结束绘制',
|
|
63
|
-
end: ''
|
|
64
|
-
}
|
|
18
|
+
import { HANDLE_FEATURE_DATA_TYPE_FUN } from "./utils";
|
|
19
|
+
|
|
20
|
+
// 根据类型相应的实现类
|
|
21
|
+
var DYNAMIC_GRAPHICS_TYPE = {
|
|
22
|
+
point: Point,
|
|
23
|
+
polyline: Polyline,
|
|
24
|
+
polygon: Polygon
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// 根据相应的geoJson类型获取相应的实现类
|
|
28
|
+
var dynamicGraphicsGeoJsonType = {
|
|
29
|
+
Point: Point,
|
|
30
|
+
MultiPoint: Point,
|
|
31
|
+
LineString: Polyline,
|
|
32
|
+
MultiLineString: Polyline,
|
|
33
|
+
Polygon: Polygon,
|
|
34
|
+
MultiPolygon: Polygon
|
|
35
|
+
};
|
|
36
|
+
// 状态表定义
|
|
37
|
+
export var STATUS = {
|
|
38
|
+
INIT: 'INIT',
|
|
39
|
+
START_DRAW: 'START_DRAW',
|
|
40
|
+
DRAWING: 'DRAWING',
|
|
41
|
+
END_DRAW: 'END_DRAW',
|
|
42
|
+
EDITING: 'EDITING',
|
|
43
|
+
END_EDIT: 'END_EDIT'
|
|
65
44
|
};
|
|
45
|
+
|
|
46
|
+
// 从状态表推导类型
|
|
47
|
+
|
|
48
|
+
// 支持多点绘制的形状类型表
|
|
49
|
+
export var MULTI_POINT_SHAPE_TYPES = {
|
|
50
|
+
POLYLINE: 'polyline',
|
|
51
|
+
POLYGON: 'polygon'
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// 支持多点绘制的形状类型数组
|
|
55
|
+
export var MULTI_POINT_SHAPES = Object.values(MULTI_POINT_SHAPE_TYPES);
|
|
66
56
|
var Drawer = /*#__PURE__*/function () {
|
|
67
|
-
function Drawer(
|
|
68
|
-
var
|
|
57
|
+
function Drawer(map) {
|
|
58
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
69
59
|
_classCallCheck(this, Drawer);
|
|
70
|
-
_defineProperty(this, "
|
|
71
|
-
_defineProperty(this, "
|
|
72
|
-
_defineProperty(this, "
|
|
73
|
-
_defineProperty(this, "
|
|
74
|
-
_defineProperty(this, "
|
|
75
|
-
_defineProperty(this, "_status",
|
|
76
|
-
|
|
77
|
-
_defineProperty(this, "
|
|
78
|
-
_defineProperty(this, "
|
|
79
|
-
_defineProperty(this, "
|
|
80
|
-
_defineProperty(this, "
|
|
81
|
-
_defineProperty(this, "
|
|
82
|
-
_defineProperty(this, "
|
|
83
|
-
_defineProperty(this, "
|
|
84
|
-
|
|
85
|
-
_defineProperty(this, "
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
// 设置操作方式
|
|
103
|
-
this._operateType = _objectSpread(_objectSpread({}, defaultOptions.operateType), options === null || options === void 0 ? void 0 : options.operateType);
|
|
104
|
-
this._viewer = viewer;
|
|
105
|
-
this._terrain = defaultValue(this._option.terrain, defaultOptions.terrain);
|
|
106
|
-
this._model = defaultValue(this._option.model, defaultOptions.model);
|
|
107
|
-
this._action = this._option.action;
|
|
108
|
-
this._sameStyle = (_options$sameStyle = options === null || options === void 0 ? void 0 : options.sameStyle) !== null && _options$sameStyle !== void 0 ? _options$sameStyle : true;
|
|
109
|
-
this._tips = _objectSpread(_objectSpread({}, defaultOptions.tips), options === null || options === void 0 ? void 0 : options.tips);
|
|
110
|
-
if (this._terrain && !this._viewer.scene.pickPositionSupported) {
|
|
111
|
-
console.warn('浏览器不支持 pickPosition属性,无法在有地形的情况下正确选点');
|
|
112
|
-
this._terrain = false;
|
|
113
|
-
}
|
|
114
|
-
this._subscriber = new Subscriber(this._viewer);
|
|
115
|
-
this.mouseTooltip = new ToolTip(viewer);
|
|
116
|
-
this.mouseTooltip.show(false);
|
|
117
|
-
this._status = 'INIT';
|
|
118
|
-
// 为了防止产生侵入性bug,请在使用前确认相关事件是否可用,不再默认移除原生事件
|
|
119
|
-
// Object.keys(this._option.keyboard).forEach(key =>
|
|
120
|
-
// Subscriber.removeNative(this._viewer, this._option.keyboard[key])
|
|
121
|
-
// )
|
|
60
|
+
_defineProperty(this, "_mapContext", void 0);
|
|
61
|
+
_defineProperty(this, "_drawContext", void 0);
|
|
62
|
+
_defineProperty(this, "options", void 0);
|
|
63
|
+
_defineProperty(this, "tooltip", void 0);
|
|
64
|
+
_defineProperty(this, "isDestroyed", false);
|
|
65
|
+
_defineProperty(this, "_status", STATUS.INIT);
|
|
66
|
+
// 拖动中
|
|
67
|
+
_defineProperty(this, "_dragging", false);
|
|
68
|
+
_defineProperty(this, "_eventLeftDown", void 0);
|
|
69
|
+
_defineProperty(this, "_eventLeftUp", void 0);
|
|
70
|
+
_defineProperty(this, "_eventClick", void 0);
|
|
71
|
+
_defineProperty(this, "_eventMove", void 0);
|
|
72
|
+
_defineProperty(this, "_eventDoubleClick", void 0);
|
|
73
|
+
_defineProperty(this, "_eventRightClick", void 0);
|
|
74
|
+
// 绘制的图形实例
|
|
75
|
+
_defineProperty(this, "_instance", void 0);
|
|
76
|
+
// 绘制完成的图层
|
|
77
|
+
_defineProperty(this, "_drawLayers", new Map());
|
|
78
|
+
this._mapContext = map._mapContext;
|
|
79
|
+
this.options = merge(DEFAULT_DRAWER_OPTIONS(), options);
|
|
80
|
+
this.tooltip = new ToolTip(this.getMap());
|
|
81
|
+
this.tooltip.show(false);
|
|
82
|
+
this._destroyListeners();
|
|
83
|
+
this._createListeners();
|
|
84
|
+
this._drawContext = {
|
|
85
|
+
options: this.options,
|
|
86
|
+
getMap: this.getMap.bind(this),
|
|
87
|
+
setDrawerLayer: this.setDrawerLayer.bind(this),
|
|
88
|
+
_changeStatus: this._changeStatus.bind(this),
|
|
89
|
+
_updateTooltip: this._updateTooltip.bind(this)
|
|
90
|
+
};
|
|
122
91
|
}
|
|
123
92
|
|
|
124
|
-
|
|
125
|
-
* @param finalOptions
|
|
126
|
-
* @param dynamicOptions
|
|
127
|
-
*/
|
|
93
|
+
// 是否能进行操作
|
|
128
94
|
_createClass(Drawer, [{
|
|
129
|
-
key: "
|
|
130
|
-
|
|
131
|
-
|
|
95
|
+
key: "_canOperate",
|
|
96
|
+
value: function _canOperate() {
|
|
97
|
+
if (this.isDestroyed) {
|
|
98
|
+
utils.error('Drawer实例已销毁');
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
return true;
|
|
132
102
|
}
|
|
133
103
|
}, {
|
|
134
|
-
key: "
|
|
135
|
-
|
|
136
|
-
return this.
|
|
104
|
+
key: "getMap",
|
|
105
|
+
value: function getMap() {
|
|
106
|
+
return this._mapContext && this._mapContext.getMap();
|
|
137
107
|
}
|
|
108
|
+
|
|
109
|
+
// 是否是拖拽点
|
|
138
110
|
}, {
|
|
139
|
-
key: "
|
|
140
|
-
|
|
141
|
-
|
|
111
|
+
key: "_isDragPoint",
|
|
112
|
+
value: function _isDragPoint(e) {
|
|
113
|
+
var _this$_instance$dragP, _this$_instance$edges;
|
|
114
|
+
// 拖拽点图层
|
|
115
|
+
var dragPoint = (_this$_instance$dragP = this._instance.dragPoints) === null || _this$_instance$dragP === void 0 ? void 0 : _this$_instance$dragP.find(function (point) {
|
|
116
|
+
var _e$pickedObject;
|
|
117
|
+
return point.layer.layers[0].id === (e === null || e === void 0 || (_e$pickedObject = e.pickedObject) === null || _e$pickedObject === void 0 || (_e$pickedObject = _e$pickedObject.id) === null || _e$pickedObject === void 0 ? void 0 : _e$pickedObject.id);
|
|
118
|
+
});
|
|
119
|
+
// 中间点图层
|
|
120
|
+
var middlePoint = (_this$_instance$edges = this._instance.edges.find(function (t) {
|
|
121
|
+
var _t$middlePoint, _e$pickedObject2;
|
|
122
|
+
return (t === null || t === void 0 || (_t$middlePoint = t.middlePoint) === null || _t$middlePoint === void 0 || (_t$middlePoint = _t$middlePoint.layer) === null || _t$middlePoint === void 0 || (_t$middlePoint = _t$middlePoint.layers) === null || _t$middlePoint === void 0 || (_t$middlePoint = _t$middlePoint[0]) === null || _t$middlePoint === void 0 ? void 0 : _t$middlePoint.id) === (e === null || e === void 0 || (_e$pickedObject2 = e.pickedObject) === null || _e$pickedObject2 === void 0 || (_e$pickedObject2 = _e$pickedObject2.id) === null || _e$pickedObject2 === void 0 ? void 0 : _e$pickedObject2.id);
|
|
123
|
+
})) === null || _this$_instance$edges === void 0 ? void 0 : _this$_instance$edges.middlePoint;
|
|
124
|
+
return dragPoint || middlePoint;
|
|
142
125
|
}
|
|
126
|
+
|
|
127
|
+
// 创建监听事件
|
|
143
128
|
}, {
|
|
144
|
-
key: "
|
|
145
|
-
value: function
|
|
146
|
-
var
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
129
|
+
key: "_createListeners",
|
|
130
|
+
value: function _createListeners() {
|
|
131
|
+
var _this = this;
|
|
132
|
+
// 鼠标按下
|
|
133
|
+
this._eventLeftDown = this.getMap().on(Cesium.ScreenSpaceEventType.LEFT_DOWN, function (e) {
|
|
134
|
+
if (!_this._instance) return;
|
|
135
|
+
if (_this._status !== STATUS.EDITING) return;
|
|
136
|
+
var dragPoint = _this._isDragPoint(e);
|
|
137
|
+
if (dragPoint) {
|
|
138
|
+
_this._dragging = true;
|
|
139
|
+
_this._instance.mouseDragStart(e.position, dragPoint);
|
|
140
|
+
// 禁用相机拖拽(避免和点拖拽冲突)
|
|
141
|
+
_this.getMap().scene.screenSpaceCameraController.enableRotate = false;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
// 鼠标抬起
|
|
145
|
+
this._eventLeftUp = this.getMap().on(LAYER_EVENT_TYPE.LEFT_UP, function (e) {
|
|
146
|
+
if (!_this._instance) return;
|
|
147
|
+
if (_this._dragging) {
|
|
148
|
+
_this._dragging = false;
|
|
149
|
+
_this._instance.mouseDragEnd(e.position);
|
|
150
|
+
_this.getMap().scene.screenSpaceCameraController.enableRotate = true;
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
// 鼠标点击
|
|
154
|
+
this._eventClick = this.getMap().on(Cesium.ScreenSpaceEventType.LEFT_CLICK, function (e) {
|
|
155
|
+
if (!_this._instance) return;
|
|
156
|
+
if (_this._status !== STATUS.START_DRAW && _this._status !== STATUS.DRAWING) return;
|
|
157
|
+
// 添加点
|
|
158
|
+
_this._instance.addPoint(e.position);
|
|
159
|
+
});
|
|
160
|
+
// 鼠标移动
|
|
161
|
+
this._eventMove = this.getMap().on(Cesium.ScreenSpaceEventType.MOUSE_MOVE, function (e) {
|
|
162
|
+
if (!_this._instance) return;
|
|
163
|
+
// 绘制
|
|
164
|
+
if (_this._status === STATUS.START_DRAW || _this._status === STATUS.DRAWING) {
|
|
165
|
+
if (MULTI_POINT_SHAPES.includes(_this._instance.type)) {
|
|
166
|
+
_this._instance.updateTempPosition(e.position);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// 编辑
|
|
170
|
+
if (_this._status === STATUS.EDITING) {
|
|
171
|
+
var dragPoint = _this._isDragPoint(e);
|
|
172
|
+
if (dragPoint) {
|
|
173
|
+
_this.getMap().canvas.style.cursor = 'pointer';
|
|
174
|
+
} else {
|
|
175
|
+
_this.getMap().canvas.style.cursor = 'default';
|
|
176
|
+
}
|
|
177
|
+
if (_this._dragging) {
|
|
178
|
+
_this._instance.mouseDragChange(e.position, dragPoint);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
// 鼠标双击
|
|
183
|
+
this._eventDoubleClick = this.getMap().on(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK, function () {
|
|
184
|
+
if (!_this._instance) return;
|
|
185
|
+
if (_this._status !== STATUS.START_DRAW && _this._status !== STATUS.DRAWING) return;
|
|
186
|
+
if (MULTI_POINT_SHAPES.includes(_this._instance.type)) {
|
|
187
|
+
_this._instance.endDraw();
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
// 鼠标右键
|
|
191
|
+
this._eventRightClick = this.getMap().on(Cesium.ScreenSpaceEventType.RIGHT_CLICK, function () {
|
|
192
|
+
if (!_this._instance) return;
|
|
193
|
+
if (_this._status !== STATUS.START_DRAW && _this._status !== STATUS.DRAWING) return;
|
|
194
|
+
if (MULTI_POINT_SHAPES.includes(_this._instance.type)) {
|
|
195
|
+
_this._instance.removePrev();
|
|
196
|
+
}
|
|
197
|
+
});
|
|
168
198
|
}
|
|
199
|
+
|
|
200
|
+
// 销毁监听事件
|
|
169
201
|
}, {
|
|
170
|
-
key: "
|
|
171
|
-
value: function
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
202
|
+
key: "_destroyListeners",
|
|
203
|
+
value: function _destroyListeners() {
|
|
204
|
+
this._eventLeftDown && this._eventLeftDown.off();
|
|
205
|
+
this._eventLeftDown = null;
|
|
206
|
+
this._eventLeftUp && this._eventLeftUp.off();
|
|
207
|
+
this._eventLeftUp = null;
|
|
208
|
+
this._eventClick && this._eventClick.off();
|
|
209
|
+
this._eventClick = null;
|
|
210
|
+
this._eventMove && this._eventMove.off();
|
|
211
|
+
this._eventMove = null;
|
|
212
|
+
this._eventDoubleClick && this._eventDoubleClick.off();
|
|
213
|
+
this._eventDoubleClick = null;
|
|
214
|
+
this._eventRightClick && this._eventRightClick.off();
|
|
215
|
+
this._eventRightClick = null;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// 更新提示
|
|
219
|
+
}, {
|
|
220
|
+
key: "_updateTooltip",
|
|
221
|
+
value: function _updateTooltip() {
|
|
222
|
+
if (!this._canOperate()) return;
|
|
223
|
+
if (this._status === STATUS.START_DRAW) {
|
|
224
|
+
this.tooltip.setOptions({
|
|
225
|
+
text: '点击开始绘制'
|
|
180
226
|
});
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
this.mouseTooltip.setOptions({
|
|
186
|
-
text: this._tips.init
|
|
227
|
+
this.tooltip.show(true);
|
|
228
|
+
} else if (this._status === STATUS.DRAWING) {
|
|
229
|
+
this.tooltip.setOptions({
|
|
230
|
+
text: '左键添加点,右键移除点,双击结束绘制'
|
|
187
231
|
});
|
|
188
|
-
this.mouseTooltip.show(true);
|
|
189
232
|
} else {
|
|
190
|
-
this.
|
|
191
|
-
text: this._tips.start
|
|
192
|
-
});
|
|
193
|
-
this.mouseTooltip.show(true);
|
|
233
|
+
this.tooltip.show(false);
|
|
194
234
|
}
|
|
195
235
|
}
|
|
196
236
|
|
|
197
|
-
|
|
198
|
-
* @desc 绘制函数,
|
|
199
|
-
* @param config 绘制配置,可以通过定义options直接改写结果而不再填第二个参数
|
|
200
|
-
* @param overrideFunc Entity 重写函数,用于重写绘制结果,如果 overrideFunc返回一个Entity,则将该Entity添加到Viewer中,否则结束函数无操作
|
|
201
|
-
* @returns
|
|
202
|
-
*/
|
|
237
|
+
// 修改状态
|
|
203
238
|
}, {
|
|
204
|
-
key: "
|
|
205
|
-
value: function
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
return entity;
|
|
209
|
-
};
|
|
210
|
-
config = defaultValue(config, {});
|
|
211
|
-
this._once = defaultValue(config.once, true);
|
|
212
|
-
this._oneInstance = defaultValue(config.oneInstance, false);
|
|
213
|
-
if (!this._isSupport(config.type)) {
|
|
214
|
-
throw new Error("the type '".concat(config.type, "' is not support"));
|
|
215
|
-
}
|
|
216
|
-
this._type = config.type;
|
|
217
|
-
var defaultOpts = defaultOptions.dynamicGraphicsOptions[this._type];
|
|
218
|
-
this._initPainter({
|
|
219
|
-
finalOptions: _objectSpread(_objectSpread({}, defaultOpts), config.finalOptions),
|
|
220
|
-
dynamicOptions: _objectSpread(_objectSpread({}, defaultOpts), config.dynamicOptions),
|
|
221
|
-
sameStyle: this._sameStyle,
|
|
222
|
-
complete: config.complete,
|
|
223
|
-
onPointsChange: config.onPointsChange
|
|
224
|
-
});
|
|
225
|
-
if (this._status === 'START') return;
|
|
226
|
-
this._status = 'START';
|
|
227
|
-
this._viewer.canvas.style.cursor = 'crosshair';
|
|
228
|
-
this._updateTips();
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* @desc 是否开始绘制
|
|
232
|
-
*/
|
|
233
|
-
var isStartDraw = false;
|
|
234
|
-
|
|
235
|
-
// 开始事件
|
|
236
|
-
var startId = this._subscriber.addExternal(function (move) {
|
|
237
|
-
if (_this._oneInstance && _this.$Instance) {
|
|
238
|
-
_this._viewer.entities.remove(_this.$Instance);
|
|
239
|
-
_this.$AddedInstance = [];
|
|
240
|
-
}
|
|
241
|
-
_this._dropPoint(move);
|
|
242
|
-
if (_this._action) _this._action(_this._operateType.START, move);
|
|
239
|
+
key: "_changeStatus",
|
|
240
|
+
value: function _changeStatus(status) {
|
|
241
|
+
this._status = status;
|
|
242
|
+
}
|
|
243
243
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
244
|
+
// 转化为绘制类型
|
|
245
|
+
}, {
|
|
246
|
+
key: "dataTransformDraw",
|
|
247
|
+
value: function dataTransformDraw(data) {
|
|
248
|
+
var _this2 = this;
|
|
249
|
+
var dataType = BaseSource.analysisSourceType(data);
|
|
250
|
+
var transformGeoJson;
|
|
251
|
+
if (dataType === 'wkt') {
|
|
252
|
+
transformGeoJson = BaseSource.wktToGeoJon(data);
|
|
253
|
+
} else if (dataType === 'geoJson') {
|
|
254
|
+
transformGeoJson = data;
|
|
255
|
+
}
|
|
256
|
+
if (!transformGeoJson) return;
|
|
257
|
+
var layers = [];
|
|
258
|
+
featureEach(transformGeoJson, function (feature) {
|
|
259
|
+
var handle = HANDLE_FEATURE_DATA_TYPE_FUN[feature.geometry.type];
|
|
260
|
+
var shapeClass = dynamicGraphicsGeoJsonType[feature.geometry.type];
|
|
261
|
+
if (!shapeClass) return;
|
|
262
|
+
if (handle) {
|
|
263
|
+
var handleFeature = handle(feature);
|
|
264
|
+
if (handleFeature.type === 'single') {
|
|
265
|
+
var layer = new shapeClass(_this2._drawContext);
|
|
266
|
+
layer.transformData(handleFeature.positions);
|
|
267
|
+
layers.push(layer);
|
|
268
|
+
}
|
|
269
|
+
if (handleFeature.type === 'multi') {
|
|
270
|
+
handleFeature.positions.forEach(function (position) {
|
|
271
|
+
var layer = new shapeClass(_this2._drawContext);
|
|
272
|
+
layer.transformData(position);
|
|
273
|
+
layers.push(layer);
|
|
274
|
+
});
|
|
258
275
|
}
|
|
259
276
|
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
isStartDraw = true;
|
|
264
|
-
}, 100);
|
|
265
|
-
}, this._operateType.START);
|
|
266
|
-
|
|
267
|
-
// 移动事件
|
|
268
|
-
var moveId = this._subscriber.addExternal(function (move) {
|
|
269
|
-
_this._viewer.canvas.style.cursor = 'crosshair';
|
|
270
|
-
if (!isStartDraw) return;
|
|
271
|
-
_this._moving(move);
|
|
277
|
+
});
|
|
278
|
+
return layers;
|
|
279
|
+
}
|
|
272
280
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
281
|
+
// 开始绘制
|
|
282
|
+
}, {
|
|
283
|
+
key: "startDraw",
|
|
284
|
+
value: function startDraw(type) {
|
|
285
|
+
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
286
|
+
if (!this._canOperate()) return;
|
|
287
|
+
if (this._instance) {
|
|
288
|
+
this._stopDraw();
|
|
289
|
+
}
|
|
290
|
+
this._changeStatus(STATUS.START_DRAW);
|
|
291
|
+
this.getMap().canvas.style.cursor = 'crosshair';
|
|
292
|
+
this._updateTooltip();
|
|
293
|
+
var shapeClass = DYNAMIC_GRAPHICS_TYPE[type];
|
|
294
|
+
if (!shapeClass) return;
|
|
295
|
+
this._instance = new shapeClass(this._drawContext, config);
|
|
296
|
+
return this._instance;
|
|
297
|
+
}
|
|
276
298
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
299
|
+
// 中止当前绘制
|
|
300
|
+
}, {
|
|
301
|
+
key: "_stopDraw",
|
|
302
|
+
value: function _stopDraw() {
|
|
303
|
+
if (!this._canOperate()) return;
|
|
304
|
+
if (!this._instance) return;
|
|
305
|
+
if (this._status === STATUS.INIT || this._status === STATUS.START_DRAW || this._status === STATUS.END_EDIT) {
|
|
306
|
+
var layer = this.getDrawerLayer(this._instance);
|
|
307
|
+
// layer未存入
|
|
308
|
+
if (!layer) {
|
|
309
|
+
this._instance.destroy();
|
|
310
|
+
}
|
|
311
|
+
this._instance = null;
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
if (this._status === STATUS.DRAWING) {
|
|
315
|
+
this.removeDrawerLayer(this._instance);
|
|
316
|
+
this._instance = null;
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
if (this._status === STATUS.END_DRAW || this._status === STATUS.EDITING) {
|
|
320
|
+
this.endEdit();
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
282
324
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
325
|
+
// 开始编辑
|
|
326
|
+
}, {
|
|
327
|
+
key: "startEdit",
|
|
328
|
+
value: function startEdit(id) {
|
|
329
|
+
if (!this._canOperate()) return;
|
|
330
|
+
if (!id) return;
|
|
331
|
+
if (this._instance) {
|
|
332
|
+
this._instance.endEdit(this._instance);
|
|
333
|
+
this.setDrawerLayer(this._instance.id, this._instance);
|
|
334
|
+
this._instance = null;
|
|
335
|
+
}
|
|
336
|
+
this._changeStatus(STATUS.EDITING);
|
|
337
|
+
this._instance = this.getDrawerLayer(id);
|
|
338
|
+
if (!this._instance) return;
|
|
339
|
+
this._instance.startEdit();
|
|
340
|
+
}
|
|
286
341
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
342
|
+
// 结束编辑
|
|
343
|
+
}, {
|
|
344
|
+
key: "endEdit",
|
|
345
|
+
value: function endEdit() {
|
|
346
|
+
if (!this._canOperate()) return;
|
|
347
|
+
this._changeStatus(STATUS.END_EDIT);
|
|
348
|
+
this._updateTooltip();
|
|
349
|
+
if (!this._instance) return;
|
|
350
|
+
this._instance.endEdit(this._instance);
|
|
351
|
+
this.setDrawerLayer(this._instance.id, this._instance);
|
|
352
|
+
this._instance = null;
|
|
353
|
+
}
|
|
290
354
|
|
|
291
|
-
|
|
292
|
-
|
|
355
|
+
// 获取绘制的图层
|
|
356
|
+
}, {
|
|
357
|
+
key: "getDrawerLayer",
|
|
358
|
+
value: function getDrawerLayer(id) {
|
|
359
|
+
if (!this._canOperate) return;
|
|
360
|
+
if (!id) return;
|
|
361
|
+
return isString(id) ? this._drawLayers.get(id) : id;
|
|
362
|
+
}
|
|
293
363
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}, this._operateType.END);
|
|
301
|
-
this._events = [startId, moveId, cancelId, endId];
|
|
364
|
+
// 添加完成绘制的图层
|
|
365
|
+
}, {
|
|
366
|
+
key: "setDrawerLayer",
|
|
367
|
+
value: function setDrawerLayer(id, value) {
|
|
368
|
+
if (!this._instance) return;
|
|
369
|
+
this._drawLayers.set(id, value);
|
|
302
370
|
}
|
|
371
|
+
|
|
372
|
+
// 移除绘制的图层
|
|
303
373
|
}, {
|
|
304
|
-
key: "
|
|
305
|
-
value: function
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
374
|
+
key: "removeDrawerLayer",
|
|
375
|
+
value: function removeDrawerLayer(id) {
|
|
376
|
+
if (!this._canOperate) return;
|
|
377
|
+
var layer = this.getDrawerLayer(id);
|
|
378
|
+
if (layer) {
|
|
379
|
+
var _this$_instance;
|
|
380
|
+
if (layer.id === (this === null || this === void 0 || (_this$_instance = this._instance) === null || _this$_instance === void 0 ? void 0 : _this$_instance.id)) {
|
|
381
|
+
this._instance = null;
|
|
382
|
+
this._status = STATUS.INIT;
|
|
383
|
+
this.getMap().canvas.style.cursor = 'default';
|
|
384
|
+
this._updateTooltip();
|
|
385
|
+
}
|
|
386
|
+
this._drawLayers.delete(layer.id);
|
|
387
|
+
layer.destroy();
|
|
388
|
+
layer = null;
|
|
389
|
+
}
|
|
311
390
|
}
|
|
391
|
+
|
|
392
|
+
// 获取所有绘制的图层
|
|
312
393
|
}, {
|
|
313
|
-
key: "
|
|
314
|
-
value: function
|
|
315
|
-
|
|
394
|
+
key: "getAllDrawerLayers",
|
|
395
|
+
value: function getAllDrawerLayers() {
|
|
396
|
+
if (!this._canOperate) return;
|
|
397
|
+
return Array.from(this._drawLayers.values());
|
|
316
398
|
}
|
|
399
|
+
|
|
400
|
+
// 清除所有绘制的图层
|
|
317
401
|
}, {
|
|
318
|
-
key: "
|
|
319
|
-
value: function
|
|
320
|
-
|
|
321
|
-
this.
|
|
322
|
-
|
|
323
|
-
(_this$_painter = this._painter) === null || _this$_painter === void 0 || _this$_painter.clear();
|
|
324
|
-
this.$AddedInstance.map(function (layer) {
|
|
325
|
-
layer.remove();
|
|
402
|
+
key: "clearAllDrawerLayers",
|
|
403
|
+
value: function clearAllDrawerLayers() {
|
|
404
|
+
if (!this._canOperate) return;
|
|
405
|
+
this._drawLayers.forEach(function (t) {
|
|
406
|
+
return t.destroy();
|
|
326
407
|
});
|
|
327
|
-
this
|
|
328
|
-
this._viewer.scene.requestRender();
|
|
408
|
+
this._drawLayers.clear();
|
|
329
409
|
}
|
|
410
|
+
|
|
411
|
+
// 清除
|
|
330
412
|
}, {
|
|
331
|
-
key: "
|
|
332
|
-
value: function
|
|
333
|
-
this.
|
|
334
|
-
this.
|
|
335
|
-
this.
|
|
336
|
-
this.
|
|
337
|
-
this.
|
|
413
|
+
key: "clear",
|
|
414
|
+
value: function clear() {
|
|
415
|
+
if (!this._canOperate) return;
|
|
416
|
+
this.getMap().canvas.style.cursor = 'default';
|
|
417
|
+
this._changeStatus(STATUS.INIT);
|
|
418
|
+
this._updateTooltip();
|
|
419
|
+
this._instance && this._instance.destroy();
|
|
420
|
+
this._instance = null;
|
|
421
|
+
this.clearAllDrawerLayers();
|
|
338
422
|
}
|
|
423
|
+
|
|
424
|
+
// 销毁
|
|
339
425
|
}, {
|
|
340
426
|
key: "destroy",
|
|
341
427
|
value: function destroy() {
|
|
342
|
-
this.
|
|
343
|
-
this.
|
|
344
|
-
this.
|
|
345
|
-
this.
|
|
428
|
+
if (!this._canOperate) return;
|
|
429
|
+
this._destroyListeners();
|
|
430
|
+
this.clear();
|
|
431
|
+
this.tooltip.destroy();
|
|
432
|
+
this.tooltip = null;
|
|
433
|
+
this.isDestroyed = true;
|
|
346
434
|
}
|
|
347
435
|
}]);
|
|
348
436
|
return Drawer;
|
|
349
437
|
}();
|
|
350
|
-
export
|
|
438
|
+
export default Drawer;
|