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
|
@@ -5,11 +5,8 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
5
5
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
6
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
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
|
|
9
|
-
function
|
|
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); }
|
|
8
|
+
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); }
|
|
9
|
+
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
13
10
|
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
11
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
15
12
|
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); }; }
|
|
@@ -17,71 +14,426 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
|
|
|
17
14
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
15
|
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
16
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
18
|
+
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); } }
|
|
19
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
20
|
+
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; }
|
|
21
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
22
|
+
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); }
|
|
23
|
+
import * as Cesium from 'deeptwins-cesium';
|
|
24
|
+
import { isNil } from 'lodash';
|
|
25
|
+
import { v4 as uuidV4 } from 'uuid';
|
|
26
|
+
import PositionProperty from "../../property/PositionProperty";
|
|
27
|
+
import * as utils from "../../tool/utils";
|
|
28
|
+
import { STATUS } from "../index";
|
|
29
|
+
import BaseShape from "./BaseShape";
|
|
30
|
+
import { DragPoint } from "./Point";
|
|
31
|
+
import { ShapePolyline } from "./Polyline";
|
|
32
|
+
|
|
33
|
+
// 创建形状面
|
|
34
|
+
export var ShapePolygon = /*#__PURE__*/function () {
|
|
35
|
+
/**
|
|
36
|
+
* 构造函数,用于创建一个地图多边形对象
|
|
37
|
+
* @param map 地图实例对象,用于获取地图上下文
|
|
38
|
+
* @param options 配置选项对象
|
|
39
|
+
* @param options.positions 多边形的坐标点数组
|
|
40
|
+
* @param options.style 多边形的样式配置
|
|
41
|
+
*/
|
|
42
|
+
function ShapePolygon(map, _ref) {
|
|
43
|
+
var positions = _ref.positions,
|
|
44
|
+
style = _ref.style;
|
|
45
|
+
_classCallCheck(this, ShapePolygon);
|
|
46
|
+
_defineProperty(this, "_mapContext", void 0);
|
|
47
|
+
_defineProperty(this, "id", '');
|
|
48
|
+
_defineProperty(this, "layer", void 0);
|
|
49
|
+
_defineProperty(this, "isDestroyed", false);
|
|
50
|
+
_defineProperty(this, "_geoJson", void 0);
|
|
51
|
+
_defineProperty(this, "_style", void 0);
|
|
52
|
+
this._mapContext = map._mapContext;
|
|
53
|
+
this.id = uuidV4();
|
|
54
|
+
this._geoJson = {
|
|
55
|
+
type: 'Feature',
|
|
56
|
+
geometry: {
|
|
57
|
+
type: 'Polygon',
|
|
58
|
+
coordinates: [positions]
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
this._style = style;
|
|
62
|
+
this._create();
|
|
63
|
+
}
|
|
64
|
+
_createClass(ShapePolygon, [{
|
|
65
|
+
key: "getMap",
|
|
66
|
+
value: function getMap() {
|
|
67
|
+
return this._mapContext && this._mapContext.getMap();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// 是否能进行操作
|
|
71
|
+
}, {
|
|
72
|
+
key: "_canOperate",
|
|
73
|
+
value: function _canOperate() {
|
|
74
|
+
if (this.isDestroyed) {
|
|
75
|
+
utils.error('ShapePolygon实例已销毁');
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
}, {
|
|
81
|
+
key: "_create",
|
|
82
|
+
value: function _create() {
|
|
83
|
+
if (!this._canOperate()) return;
|
|
84
|
+
this.layer = this.getMap().addGraphicLayer(this._geoJson, {
|
|
85
|
+
type: 'polygon',
|
|
86
|
+
id: this.id,
|
|
87
|
+
style: this._style,
|
|
88
|
+
positionProperty: new PositionProperty()
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// 更新
|
|
93
|
+
}, {
|
|
94
|
+
key: "update",
|
|
95
|
+
value: function update(positions) {
|
|
96
|
+
if (!this._canOperate()) return;
|
|
97
|
+
if (this.layer) {
|
|
98
|
+
this._geoJson.geometry.coordinates = [positions];
|
|
99
|
+
this.layer.setData(this._geoJson);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// 销毁
|
|
104
|
+
}, {
|
|
105
|
+
key: "destroy",
|
|
106
|
+
value: function destroy() {
|
|
107
|
+
if (!this._canOperate()) return;
|
|
108
|
+
this.isDestroyed = true;
|
|
109
|
+
this.layer && this.layer.remove();
|
|
110
|
+
this.layer = null;
|
|
111
|
+
}
|
|
112
|
+
}]);
|
|
113
|
+
return ShapePolygon;
|
|
114
|
+
}();
|
|
115
|
+
var Polygon = /*#__PURE__*/function (_BaseShape) {
|
|
116
|
+
_inherits(Polygon, _BaseShape);
|
|
24
117
|
var _super = _createSuper(Polygon);
|
|
25
|
-
function Polygon() {
|
|
118
|
+
function Polygon(drawContext, config) {
|
|
119
|
+
var _this;
|
|
26
120
|
_classCallCheck(this, Polygon);
|
|
27
|
-
|
|
121
|
+
_this = _super.call(this, drawContext);
|
|
122
|
+
_defineProperty(_assertThisInitialized(_this), "type", 'polygon');
|
|
123
|
+
_defineProperty(_assertThisInitialized(_this), "shapePolylineLayer", void 0);
|
|
124
|
+
_defineProperty(_assertThisInitialized(_this), "shapePolygonLayer", void 0);
|
|
125
|
+
// 鼠标移动时的临时点
|
|
126
|
+
_defineProperty(_assertThisInitialized(_this), "_tempPosition", void 0);
|
|
127
|
+
_this.clampToGround = isNil(config === null || config === void 0 ? void 0 : config.clampToGround) ? _this.clampToGround : config.clampToGround;
|
|
128
|
+
_this.polylineStyle.clampToGround = _this.clampToGround;
|
|
129
|
+
if (_this.clampToGround) {
|
|
130
|
+
_this.polygonStyle.heightReference = Cesium.HeightReference.CLAMP_TO_GROUND;
|
|
131
|
+
_this.polygonStyle.perPositionHeight = false;
|
|
132
|
+
} else {
|
|
133
|
+
_this.polygonStyle.heightReference = Cesium.HeightReference.NONE;
|
|
134
|
+
_this.polygonStyle.perPositionHeight = true;
|
|
135
|
+
}
|
|
136
|
+
return _this;
|
|
28
137
|
}
|
|
138
|
+
|
|
139
|
+
// 数据转换
|
|
29
140
|
_createClass(Polygon, [{
|
|
30
|
-
key: "
|
|
31
|
-
value: function
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
141
|
+
key: "transformData",
|
|
142
|
+
value: function transformData(positions) {
|
|
143
|
+
var _this2 = this;
|
|
144
|
+
this.positions = positions;
|
|
145
|
+
this.shapePolylineLayer = new ShapePolyline(this.getMap(), {
|
|
146
|
+
map: this.getMap(),
|
|
147
|
+
positions: this._getDrawPolylinePositions(),
|
|
148
|
+
style: this.polylineStyle
|
|
149
|
+
});
|
|
150
|
+
this.shapePolygonLayer = new ShapePolygon(this.getMap(), {
|
|
151
|
+
map: this.getMap(),
|
|
152
|
+
positions: this._getDrawPolygonPositions(),
|
|
153
|
+
style: this.polygonStyle
|
|
154
|
+
});
|
|
155
|
+
positions.forEach(function (position, index) {
|
|
156
|
+
var layer = new DragPoint(_this2.getMap(), {
|
|
157
|
+
positions: position,
|
|
158
|
+
style: _this2.pointStyle
|
|
159
|
+
});
|
|
160
|
+
layer.isStart = index === 0;
|
|
161
|
+
layer.endEdit();
|
|
162
|
+
layer.show(false);
|
|
163
|
+
_this2.dragPoints.push(layer);
|
|
164
|
+
});
|
|
165
|
+
// 存入
|
|
166
|
+
this._drawContext.setDrawerLayer(this.id, this);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// 获取绘制中的线的点位
|
|
170
|
+
}, {
|
|
171
|
+
key: "_getDrawPolylinePositions",
|
|
172
|
+
value: function _getDrawPolylinePositions() {
|
|
173
|
+
var _this$positions;
|
|
174
|
+
if (!((_this$positions = this.positions) !== null && _this$positions !== void 0 && _this$positions.length)) return [];
|
|
175
|
+
var positions = this._tempPosition ? [].concat(_toConsumableArray(this.positions), [this._tempPosition]) : _toConsumableArray(this.positions);
|
|
176
|
+
var isNeedClose = positions.length > 2;
|
|
177
|
+
isNeedClose && positions.push(positions[0]);
|
|
178
|
+
return positions;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// 获取绘制中的面的点位
|
|
182
|
+
}, {
|
|
183
|
+
key: "_getDrawPolygonPositions",
|
|
184
|
+
value: function _getDrawPolygonPositions() {
|
|
185
|
+
var _this$positions2;
|
|
186
|
+
if (!((_this$positions2 = this.positions) !== null && _this$positions2 !== void 0 && _this$positions2.length)) return [];
|
|
187
|
+
return this._tempPosition ? [].concat(_toConsumableArray(this.positions), [this._tempPosition, this.positions[0]]) : [].concat(_toConsumableArray(this.positions), [this.positions[0]]);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// 添加点位
|
|
191
|
+
}, {
|
|
192
|
+
key: "addPoint",
|
|
193
|
+
value: function addPoint(position) {
|
|
194
|
+
var _this$positions3;
|
|
195
|
+
var lng = position.lng,
|
|
196
|
+
lat = position.lat,
|
|
197
|
+
alt = position.alt;
|
|
198
|
+
if (!((_this$positions3 = this.positions) !== null && _this$positions3 !== void 0 && _this$positions3.length)) {
|
|
199
|
+
// 创建
|
|
200
|
+
this.positions = [[lng, lat, alt]];
|
|
201
|
+
this.shapePolylineLayer = new ShapePolyline(this.getMap(), {
|
|
202
|
+
map: this.getMap(),
|
|
203
|
+
positions: this._getDrawPolylinePositions(),
|
|
204
|
+
style: this.polylineStyle
|
|
205
|
+
});
|
|
206
|
+
this.shapePolygonLayer = new ShapePolygon(this.getMap(), {
|
|
207
|
+
map: this.getMap(),
|
|
208
|
+
positions: this._getDrawPolygonPositions(),
|
|
209
|
+
style: this.polygonStyle
|
|
210
|
+
});
|
|
211
|
+
} else {
|
|
212
|
+
var _this$shapePolylineLa, _this$shapePolygonLay;
|
|
213
|
+
// 添加
|
|
214
|
+
this.positions.push([lng, lat, alt]);
|
|
215
|
+
(_this$shapePolylineLa = this.shapePolylineLayer) === null || _this$shapePolylineLa === void 0 || _this$shapePolylineLa.update(this._getDrawPolylinePositions());
|
|
216
|
+
(_this$shapePolygonLay = this.shapePolygonLayer) === null || _this$shapePolygonLay === void 0 || _this$shapePolygonLay.update(this._getDrawPolygonPositions());
|
|
217
|
+
}
|
|
218
|
+
// 创建拖动点位
|
|
219
|
+
this._createDragPoint(position);
|
|
220
|
+
// 绘制中
|
|
221
|
+
this.drawing(this);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// 创建拖动点位
|
|
225
|
+
}, {
|
|
226
|
+
key: "_createDragPoint",
|
|
227
|
+
value: function _createDragPoint(position) {
|
|
228
|
+
var _this$positions4;
|
|
229
|
+
var lng = position.lng,
|
|
230
|
+
lat = position.lat,
|
|
231
|
+
alt = position.alt;
|
|
232
|
+
var layer = new DragPoint(this.getMap(), {
|
|
233
|
+
positions: [lng, lat, alt],
|
|
234
|
+
style: this.pointStyle
|
|
235
|
+
});
|
|
236
|
+
layer.isStart = ((_this$positions4 = this.positions) === null || _this$positions4 === void 0 ? void 0 : _this$positions4.length) === 1;
|
|
237
|
+
this.dragPoints.push(layer);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// 删除上一个
|
|
241
|
+
}, {
|
|
242
|
+
key: "removePrev",
|
|
243
|
+
value: function removePrev() {
|
|
244
|
+
var _this$positions5, _this$positions6, _this$positions7, _this$positions8;
|
|
245
|
+
if (!((_this$positions5 = this.positions) !== null && _this$positions5 !== void 0 && _this$positions5.length)) return;
|
|
246
|
+
var i = ((_this$positions6 = this.positions) === null || _this$positions6 === void 0 ? void 0 : _this$positions6.length) - 1;
|
|
247
|
+
this.positions.splice(i, 1);
|
|
248
|
+
if (!((_this$positions7 = this.positions) !== null && _this$positions7 !== void 0 && _this$positions7.length)) {
|
|
249
|
+
this.positions = [];
|
|
250
|
+
this.shapePolylineLayer && this.shapePolylineLayer.destroy();
|
|
251
|
+
this.shapePolylineLayer = null;
|
|
252
|
+
this.shapePolygonLayer && this.shapePolygonLayer.destroy();
|
|
253
|
+
this.shapePolygonLayer = null;
|
|
254
|
+
} else {
|
|
255
|
+
var _this$shapePolylineLa2, _this$shapePolygonLay2;
|
|
256
|
+
(_this$shapePolylineLa2 = this.shapePolylineLayer) === null || _this$shapePolylineLa2 === void 0 || _this$shapePolylineLa2.update(this._getDrawPolylinePositions());
|
|
257
|
+
(_this$shapePolygonLay2 = this.shapePolygonLayer) === null || _this$shapePolygonLay2 === void 0 || _this$shapePolygonLay2.update(this._getDrawPolygonPositions());
|
|
258
|
+
}
|
|
259
|
+
if (this.dragPoints[i]) {
|
|
260
|
+
this.dragPoints[i].destroy();
|
|
261
|
+
this.dragPoints.splice(i, 1);
|
|
262
|
+
}
|
|
263
|
+
// 绘制中
|
|
264
|
+
this.drawing(this);
|
|
265
|
+
this._drawContext.options.onMouseMoveChange && this._drawContext.options.onMouseMoveChange({
|
|
266
|
+
layer: this,
|
|
267
|
+
positions: this._tempPosition ? [].concat(_toConsumableArray(this.positions), [this._tempPosition]) : this.positions
|
|
268
|
+
});
|
|
269
|
+
if (!((_this$positions8 = this.positions) !== null && _this$positions8 !== void 0 && _this$positions8.length)) {
|
|
270
|
+
this._drawContext._changeStatus(STATUS.START_DRAW);
|
|
271
|
+
this._drawContext._updateTooltip();
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// 更新临时点位
|
|
276
|
+
}, {
|
|
277
|
+
key: "updateTempPosition",
|
|
278
|
+
value: function updateTempPosition(position) {
|
|
279
|
+
var _this$shapePolylineLa3, _this$shapePolygonLay3;
|
|
280
|
+
if (!this.shapePolylineLayer || !this.shapePolygonLayer) return;
|
|
281
|
+
var lng = position.lng,
|
|
282
|
+
lat = position.lat,
|
|
283
|
+
alt = position.alt;
|
|
284
|
+
this._tempPosition = [lng, lat, alt];
|
|
285
|
+
(_this$shapePolylineLa3 = this.shapePolylineLayer) === null || _this$shapePolylineLa3 === void 0 || _this$shapePolylineLa3.update(this._getDrawPolylinePositions());
|
|
286
|
+
(_this$shapePolygonLay3 = this.shapePolygonLayer) === null || _this$shapePolygonLay3 === void 0 || _this$shapePolygonLay3.update(this._getDrawPolygonPositions());
|
|
287
|
+
this._drawContext.options.onMouseMoveChange && this._drawContext.options.onMouseMoveChange({
|
|
288
|
+
layer: this,
|
|
289
|
+
positions: this._tempPosition ? [].concat(_toConsumableArray(this.positions), [this._tempPosition]) : this.positions
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// 结束绘制
|
|
294
|
+
}, {
|
|
295
|
+
key: "endDraw",
|
|
296
|
+
value: function endDraw() {
|
|
297
|
+
var _this$shapePolylineLa4, _this$shapePolygonLay4;
|
|
298
|
+
this._tempPosition = null;
|
|
299
|
+
(_this$shapePolylineLa4 = this.shapePolylineLayer) === null || _this$shapePolylineLa4 === void 0 || _this$shapePolylineLa4.update(this._getDrawPolylinePositions());
|
|
300
|
+
(_this$shapePolygonLay4 = this.shapePolygonLayer) === null || _this$shapePolygonLay4 === void 0 || _this$shapePolygonLay4.update(this._getDrawPolygonPositions());
|
|
301
|
+
this.drawEnd(this);
|
|
302
|
+
// 存入
|
|
303
|
+
this._drawContext.setDrawerLayer(this.id, this);
|
|
304
|
+
this.startEdit();
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// 开始编辑
|
|
308
|
+
}, {
|
|
309
|
+
key: "startEdit",
|
|
310
|
+
value: function startEdit() {
|
|
311
|
+
_get(_getPrototypeOf(Polygon.prototype), "startEdit", this).call(this);
|
|
312
|
+
this.edges = [];
|
|
313
|
+
this.edges = this._createEdgesAndMiddle(this.dragPoints, true);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// 开始鼠标拖拽
|
|
317
|
+
}, {
|
|
318
|
+
key: "mouseDragStart",
|
|
319
|
+
value: function mouseDragStart(position, dragLayer) {
|
|
320
|
+
var _this3 = this;
|
|
321
|
+
this.dragging = true;
|
|
322
|
+
this.dragLayer = dragLayer;
|
|
323
|
+
if (this.dragLayer.isMiddlePoint) {
|
|
324
|
+
// 找到相应有关系的边
|
|
325
|
+
var changeEdges = this.edges.filter(function (t) {
|
|
326
|
+
return t.middlePoint.id === _this3.dragLayer.id;
|
|
327
|
+
});
|
|
328
|
+
this.edges = this.edges.filter(function (t) {
|
|
329
|
+
return t.middlePoint.id !== _this3.dragLayer.id;
|
|
330
|
+
});
|
|
331
|
+
var _loop = function _loop() {
|
|
332
|
+
var source = changeEdges[i].source;
|
|
333
|
+
var target = changeEdges[i].target;
|
|
334
|
+
var middlePoint = changeEdges[i].middlePoint;
|
|
335
|
+
middlePoint.isStart = false;
|
|
336
|
+
_this3.edges.push({
|
|
337
|
+
source: source,
|
|
338
|
+
target: middlePoint,
|
|
339
|
+
middlePoint: null
|
|
340
|
+
}, {
|
|
341
|
+
source: middlePoint,
|
|
342
|
+
target: target,
|
|
343
|
+
middlePoint: null
|
|
344
|
+
});
|
|
345
|
+
var findIndex = _this3.dragPoints.findIndex(function (t) {
|
|
346
|
+
return t.id === source.id;
|
|
347
|
+
});
|
|
348
|
+
if (findIndex > -1) {
|
|
349
|
+
_this3.dragPoints.splice(findIndex + 1, 0, middlePoint);
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
for (var i = 0; i < changeEdges.length; i++) {
|
|
353
|
+
_loop();
|
|
354
|
+
}
|
|
355
|
+
} else {
|
|
356
|
+
// 找到相应有关系的边
|
|
357
|
+
var _changeEdges = this.edges.filter(function (t) {
|
|
358
|
+
return t.source.id === _this3.dragLayer.id || t.target.id === _this3.dragLayer.id;
|
|
359
|
+
});
|
|
360
|
+
for (var _i = 0; _i < _changeEdges.length; _i++) {
|
|
361
|
+
// 删除中间点
|
|
362
|
+
if (_changeEdges[_i].middlePoint) {
|
|
363
|
+
_changeEdges[_i].middlePoint.destroy();
|
|
364
|
+
_changeEdges[_i].middlePoint = null;
|
|
365
|
+
}
|
|
42
366
|
}
|
|
43
|
-
this.SetBreakpoint(earthPosition);
|
|
44
367
|
}
|
|
368
|
+
this.dragLayer.mouseDragStart();
|
|
45
369
|
}
|
|
370
|
+
|
|
371
|
+
// 鼠标拖拽
|
|
46
372
|
}, {
|
|
47
|
-
key: "
|
|
48
|
-
value: function
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
373
|
+
key: "mouseDragChange",
|
|
374
|
+
value: function mouseDragChange(position) {
|
|
375
|
+
var _this$shapePolylineLa5, _this$shapePolygonLay5, _this$_drawContext$op, _this$_drawContext$op2;
|
|
376
|
+
if (!this.dragging) return;
|
|
377
|
+
// 点拖拽
|
|
378
|
+
this.dragLayer.mouseDragChange(position);
|
|
379
|
+
// 根据edges重新生成新的点位
|
|
380
|
+
this.positions = this._updatePositionsFromEdges();
|
|
381
|
+
(_this$shapePolylineLa5 = this.shapePolylineLayer) === null || _this$shapePolylineLa5 === void 0 || _this$shapePolylineLa5.update(this._getDrawPolylinePositions());
|
|
382
|
+
(_this$shapePolygonLay5 = this.shapePolygonLayer) === null || _this$shapePolygonLay5 === void 0 || _this$shapePolygonLay5.update(this._getDrawPolygonPositions());
|
|
383
|
+
// 调用点位改变事件
|
|
384
|
+
((_this$_drawContext$op = this._drawContext.options) === null || _this$_drawContext$op === void 0 ? void 0 : _this$_drawContext$op.onPointsChange) && ((_this$_drawContext$op2 = this._drawContext.options) === null || _this$_drawContext$op2 === void 0 ? void 0 : _this$_drawContext$op2.onPointsChange({
|
|
385
|
+
layer: this,
|
|
386
|
+
positions: this.positions
|
|
387
|
+
}));
|
|
52
388
|
}
|
|
389
|
+
|
|
390
|
+
// 拖拽结束
|
|
53
391
|
}, {
|
|
54
|
-
key: "
|
|
55
|
-
value: function
|
|
56
|
-
this
|
|
392
|
+
key: "mouseDragEnd",
|
|
393
|
+
value: function mouseDragEnd() {
|
|
394
|
+
var _this4 = this;
|
|
395
|
+
// 找到相应有关系的边
|
|
396
|
+
var changeEdges = this.edges.filter(function (t) {
|
|
397
|
+
return t.source.id === _this4.dragLayer.id || t.target.id === _this4.dragLayer.id;
|
|
398
|
+
});
|
|
399
|
+
// 创建中间点
|
|
400
|
+
for (var i = 0; i < changeEdges.length; i++) {
|
|
401
|
+
var p1 = changeEdges[i].source.layer.layers[0].source.positions;
|
|
402
|
+
var p2 = changeEdges[i].target.layer.layers[0].source.positions;
|
|
403
|
+
var layer = this._createTwoPointMiddle(utils.getMidpoint(p1, p2));
|
|
404
|
+
layer.startEdit();
|
|
405
|
+
changeEdges[i].middlePoint = layer;
|
|
406
|
+
}
|
|
407
|
+
this.dragging = false;
|
|
408
|
+
this.dragLayer = null;
|
|
57
409
|
}
|
|
410
|
+
|
|
411
|
+
// 结束编辑
|
|
58
412
|
}, {
|
|
59
|
-
key: "
|
|
60
|
-
value: function
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
hierarchy: Array.isArray(hierarchy) ? new PolygonHierarchy(hierarchy) : hierarchy,
|
|
66
|
-
arcType: ArcType.RHUMB,
|
|
67
|
-
classificationType: this.painter._model ? ClassificationType.CESIUM_3D_TILE : undefined
|
|
413
|
+
key: "endEdit",
|
|
414
|
+
value: function endEdit(layer) {
|
|
415
|
+
_get(_getPrototypeOf(Polygon.prototype), "endEdit", this).call(this, layer);
|
|
416
|
+
this.dragPoints.forEach(function (t) {
|
|
417
|
+
t.endEdit();
|
|
418
|
+
t.show(false);
|
|
68
419
|
});
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
material: options.outlineColor,
|
|
72
|
-
positions: Array.isArray(hierarchy) ? [].concat(_toConsumableArray(hierarchy), [hierarchy[0]]) : new CallbackProperty(function () {
|
|
73
|
-
return [].concat(_toConsumableArray(_this2.painter._activeShapePoints), [_this2.painter._activeShapePoints[0]]);
|
|
74
|
-
}, false),
|
|
75
|
-
clampToGround: true,
|
|
76
|
-
arcType: ArcType.RHUMB,
|
|
77
|
-
classificationType: this.painter._model ? ClassificationType.CESIUM_3D_TILE : undefined
|
|
78
|
-
};
|
|
79
|
-
return new Entity({
|
|
80
|
-
polygon: polygon,
|
|
81
|
-
polyline: polyline
|
|
420
|
+
this.edges.forEach(function (t) {
|
|
421
|
+
return t.middlePoint.destroy();
|
|
82
422
|
});
|
|
423
|
+
this.edges = [];
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
// 销毁
|
|
427
|
+
}, {
|
|
428
|
+
key: "destroy",
|
|
429
|
+
value: function destroy() {
|
|
430
|
+
_get(_getPrototypeOf(Polygon.prototype), "destroy", this).call(this);
|
|
431
|
+
this.shapePolylineLayer && this.shapePolylineLayer.destroy();
|
|
432
|
+
this.shapePolylineLayer = null;
|
|
433
|
+
this.shapePolygonLayer && this.shapePolygonLayer.destroy();
|
|
434
|
+
this.shapePolygonLayer = null;
|
|
83
435
|
}
|
|
84
436
|
}]);
|
|
85
437
|
return Polygon;
|
|
86
|
-
}(
|
|
87
|
-
export
|
|
438
|
+
}(BaseShape);
|
|
439
|
+
export default Polygon;
|
|
@@ -1,11 +1,42 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import BaseShape from './BaseShape';
|
|
2
|
+
export declare class ShapePolyline {
|
|
3
|
+
private readonly _mapContext;
|
|
4
|
+
id: string;
|
|
5
|
+
layer: any;
|
|
6
|
+
isDestroyed: boolean;
|
|
7
|
+
private _geoJson;
|
|
8
|
+
private _style;
|
|
9
|
+
/**
|
|
10
|
+
* 构造函数,用于创建一个线条对象
|
|
11
|
+
* @param map 地图实例对象,用于获取地图上下文
|
|
12
|
+
* @param options 配置选项对象
|
|
13
|
+
* @param options.positions 线条的坐标点数组
|
|
14
|
+
* @param options.style 线条的样式配置
|
|
15
|
+
*/
|
|
16
|
+
constructor(map: any, { positions, style }: any);
|
|
17
|
+
getMap(): any;
|
|
18
|
+
private _canOperate;
|
|
19
|
+
private _create;
|
|
20
|
+
update(positions: any): void;
|
|
21
|
+
destroy(): void;
|
|
11
22
|
}
|
|
23
|
+
declare class Polyline extends BaseShape {
|
|
24
|
+
readonly type: string;
|
|
25
|
+
shapePolylineLayer: any;
|
|
26
|
+
private _tempPosition;
|
|
27
|
+
constructor(drawContext: any, config: any);
|
|
28
|
+
transformData(positions: any[]): void;
|
|
29
|
+
private _getDrawPolylinePositions;
|
|
30
|
+
addPoint(position: any): void;
|
|
31
|
+
private _createDragPoint;
|
|
32
|
+
removePrev(): void;
|
|
33
|
+
updateTempPosition(position: any): void;
|
|
34
|
+
endDraw(): void;
|
|
35
|
+
startEdit(): void;
|
|
36
|
+
mouseDragStart(position: any, dragLayer: any): void;
|
|
37
|
+
mouseDragChange(position: any): void;
|
|
38
|
+
mouseDragEnd(): void;
|
|
39
|
+
endEdit(layer: any): void;
|
|
40
|
+
destroy(): void;
|
|
41
|
+
}
|
|
42
|
+
export default Polyline;
|