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
|
@@ -1,9 +1,12 @@
|
|
|
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
|
|
3
|
-
function
|
|
4
|
-
function
|
|
5
|
-
function
|
|
6
|
-
function
|
|
2
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
8
|
+
function _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; }
|
|
7
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); }
|
|
8
11
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
9
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); }; }
|
|
@@ -11,44 +14,383 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
|
|
|
11
14
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
12
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; } }
|
|
13
16
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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 { isNil } from 'lodash';
|
|
24
|
+
import { v4 as uuidV4 } from 'uuid';
|
|
25
|
+
import PositionProperty from "../../property/PositionProperty";
|
|
26
|
+
import * as utils from "../../tool/utils";
|
|
27
|
+
import { STATUS } from "../index";
|
|
28
|
+
import BaseShape from "./BaseShape";
|
|
29
|
+
import { DragPoint } from "./Point";
|
|
30
|
+
|
|
31
|
+
// 创建形状线
|
|
32
|
+
export var ShapePolyline = /*#__PURE__*/function () {
|
|
33
|
+
/**
|
|
34
|
+
* 构造函数,用于创建一个线条对象
|
|
35
|
+
* @param map 地图实例对象,用于获取地图上下文
|
|
36
|
+
* @param options 配置选项对象
|
|
37
|
+
* @param options.positions 线条的坐标点数组
|
|
38
|
+
* @param options.style 线条的样式配置
|
|
39
|
+
*/
|
|
40
|
+
function ShapePolyline(map, _ref) {
|
|
41
|
+
var positions = _ref.positions,
|
|
42
|
+
style = _ref.style;
|
|
43
|
+
_classCallCheck(this, ShapePolyline);
|
|
44
|
+
_defineProperty(this, "_mapContext", void 0);
|
|
45
|
+
_defineProperty(this, "id", '');
|
|
46
|
+
_defineProperty(this, "layer", void 0);
|
|
47
|
+
_defineProperty(this, "isDestroyed", false);
|
|
48
|
+
_defineProperty(this, "_geoJson", void 0);
|
|
49
|
+
_defineProperty(this, "_style", void 0);
|
|
50
|
+
this._mapContext = map._mapContext;
|
|
51
|
+
this.id = uuidV4();
|
|
52
|
+
this._geoJson = {
|
|
53
|
+
type: 'Feature',
|
|
54
|
+
geometry: {
|
|
55
|
+
type: 'LineString',
|
|
56
|
+
coordinates: positions
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
this._style = style;
|
|
60
|
+
this._create();
|
|
61
|
+
}
|
|
62
|
+
_createClass(ShapePolyline, [{
|
|
63
|
+
key: "getMap",
|
|
64
|
+
value: function getMap() {
|
|
65
|
+
return this._mapContext && this._mapContext.getMap();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// 是否能进行操作
|
|
69
|
+
}, {
|
|
70
|
+
key: "_canOperate",
|
|
71
|
+
value: function _canOperate() {
|
|
72
|
+
if (this.isDestroyed) {
|
|
73
|
+
utils.error('ShapePolyline实例已销毁');
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
}, {
|
|
79
|
+
key: "_create",
|
|
80
|
+
value: function _create() {
|
|
81
|
+
if (!this._canOperate()) return;
|
|
82
|
+
this.layer = this.getMap().addGraphicLayer(this._geoJson, {
|
|
83
|
+
type: 'polyline',
|
|
84
|
+
id: this.id,
|
|
85
|
+
style: this._style,
|
|
86
|
+
positionProperty: new PositionProperty()
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// 更新
|
|
91
|
+
}, {
|
|
92
|
+
key: "update",
|
|
93
|
+
value: function update(positions) {
|
|
94
|
+
if (!this._canOperate()) return;
|
|
95
|
+
if (this.layer) {
|
|
96
|
+
this._geoJson.geometry.coordinates = positions;
|
|
97
|
+
this.layer.setData(this._geoJson);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// 销毁
|
|
102
|
+
}, {
|
|
103
|
+
key: "destroy",
|
|
104
|
+
value: function destroy() {
|
|
105
|
+
if (!this._canOperate()) return;
|
|
106
|
+
this.isDestroyed = true;
|
|
107
|
+
this.layer && this.layer.remove();
|
|
108
|
+
this.layer = null;
|
|
109
|
+
}
|
|
110
|
+
}]);
|
|
111
|
+
return ShapePolyline;
|
|
112
|
+
}();
|
|
113
|
+
var Polyline = /*#__PURE__*/function (_BaseShape) {
|
|
114
|
+
_inherits(Polyline, _BaseShape);
|
|
18
115
|
var _super = _createSuper(Polyline);
|
|
19
|
-
function Polyline() {
|
|
116
|
+
function Polyline(drawContext, config) {
|
|
117
|
+
var _this;
|
|
20
118
|
_classCallCheck(this, Polyline);
|
|
21
|
-
|
|
119
|
+
_this = _super.call(this, drawContext);
|
|
120
|
+
_defineProperty(_assertThisInitialized(_this), "type", 'polyline');
|
|
121
|
+
_defineProperty(_assertThisInitialized(_this), "shapePolylineLayer", void 0);
|
|
122
|
+
// 鼠标移动时的临时点
|
|
123
|
+
_defineProperty(_assertThisInitialized(_this), "_tempPosition", void 0);
|
|
124
|
+
_this.clampToGround = isNil(config === null || config === void 0 ? void 0 : config.clampToGround) ? _this.clampToGround : config.clampToGround;
|
|
125
|
+
_this.polylineStyle.clampToGround = _this.clampToGround;
|
|
126
|
+
return _this;
|
|
22
127
|
}
|
|
128
|
+
|
|
129
|
+
// 数据转换
|
|
23
130
|
_createClass(Polyline, [{
|
|
24
|
-
key: "
|
|
25
|
-
value: function
|
|
26
|
-
|
|
131
|
+
key: "transformData",
|
|
132
|
+
value: function transformData(positions) {
|
|
133
|
+
var _this2 = this;
|
|
134
|
+
this.positions = positions;
|
|
135
|
+
this.shapePolylineLayer = new ShapePolyline(this.getMap(), {
|
|
136
|
+
map: this.getMap(),
|
|
137
|
+
positions: this._getDrawPolylinePositions(),
|
|
138
|
+
style: this.polylineStyle
|
|
139
|
+
});
|
|
140
|
+
positions.forEach(function (position, index) {
|
|
141
|
+
var layer = new DragPoint(_this2.getMap(), {
|
|
142
|
+
positions: position,
|
|
143
|
+
style: _this2.pointStyle
|
|
144
|
+
});
|
|
145
|
+
layer.isStart = index === 0;
|
|
146
|
+
layer.endEdit();
|
|
147
|
+
layer.show(false);
|
|
148
|
+
_this2.dragPoints.push(layer);
|
|
149
|
+
});
|
|
150
|
+
// 存入
|
|
151
|
+
this._drawContext.setDrawerLayer(this.id, this);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// 获取绘制中的点位
|
|
155
|
+
}, {
|
|
156
|
+
key: "_getDrawPolylinePositions",
|
|
157
|
+
value: function _getDrawPolylinePositions() {
|
|
158
|
+
return this._tempPosition ? [].concat(_toConsumableArray(this.positions), [this._tempPosition]) : _toConsumableArray(this.positions);
|
|
27
159
|
}
|
|
160
|
+
|
|
161
|
+
// 添加点位
|
|
28
162
|
}, {
|
|
29
|
-
key: "
|
|
30
|
-
value: function
|
|
31
|
-
|
|
163
|
+
key: "addPoint",
|
|
164
|
+
value: function addPoint(position) {
|
|
165
|
+
var _this$positions;
|
|
166
|
+
var lng = position.lng,
|
|
167
|
+
lat = position.lat,
|
|
168
|
+
alt = position.alt;
|
|
169
|
+
if (!((_this$positions = this.positions) !== null && _this$positions !== void 0 && _this$positions.length)) {
|
|
170
|
+
// 创建
|
|
171
|
+
this.positions = [[lng, lat, alt]];
|
|
172
|
+
this.shapePolylineLayer = new ShapePolyline(this.getMap(), {
|
|
173
|
+
map: this.getMap(),
|
|
174
|
+
positions: this._getDrawPolylinePositions(),
|
|
175
|
+
style: this.polylineStyle
|
|
176
|
+
});
|
|
177
|
+
} else {
|
|
178
|
+
var _this$shapePolylineLa;
|
|
179
|
+
// 添加
|
|
180
|
+
this.positions.push([lng, lat, alt]);
|
|
181
|
+
(_this$shapePolylineLa = this.shapePolylineLayer) === null || _this$shapePolylineLa === void 0 || _this$shapePolylineLa.update(this._getDrawPolylinePositions());
|
|
182
|
+
}
|
|
183
|
+
// 创建拖动点位
|
|
184
|
+
this._createDragPoint(position);
|
|
185
|
+
// 绘制中
|
|
186
|
+
this.drawing(this);
|
|
32
187
|
}
|
|
188
|
+
|
|
189
|
+
// 创建拖动点位
|
|
33
190
|
}, {
|
|
34
|
-
key: "
|
|
35
|
-
value: function
|
|
36
|
-
|
|
191
|
+
key: "_createDragPoint",
|
|
192
|
+
value: function _createDragPoint(position) {
|
|
193
|
+
var _this$positions2;
|
|
194
|
+
var lng = position.lng,
|
|
195
|
+
lat = position.lat,
|
|
196
|
+
alt = position.alt;
|
|
197
|
+
var layer = new DragPoint(this.getMap(), {
|
|
198
|
+
positions: [lng, lat, alt],
|
|
199
|
+
style: this.pointStyle
|
|
200
|
+
});
|
|
201
|
+
layer.isStart = ((_this$positions2 = this.positions) === null || _this$positions2 === void 0 ? void 0 : _this$positions2.length) === 1;
|
|
202
|
+
this.dragPoints.push(layer);
|
|
37
203
|
}
|
|
204
|
+
|
|
205
|
+
// 删除上一个
|
|
38
206
|
}, {
|
|
39
|
-
key: "
|
|
40
|
-
value: function
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
207
|
+
key: "removePrev",
|
|
208
|
+
value: function removePrev() {
|
|
209
|
+
var _this$positions3, _this$positions4, _this$positions5, _this$positions6;
|
|
210
|
+
if (!((_this$positions3 = this.positions) !== null && _this$positions3 !== void 0 && _this$positions3.length)) return;
|
|
211
|
+
var i = ((_this$positions4 = this.positions) === null || _this$positions4 === void 0 ? void 0 : _this$positions4.length) - 1;
|
|
212
|
+
this.positions.splice(i, 1);
|
|
213
|
+
if (!((_this$positions5 = this.positions) !== null && _this$positions5 !== void 0 && _this$positions5.length)) {
|
|
214
|
+
var _this$shapePolylineLa2;
|
|
215
|
+
(_this$shapePolylineLa2 = this.shapePolylineLayer) === null || _this$shapePolylineLa2 === void 0 || _this$shapePolylineLa2.destroy();
|
|
216
|
+
this.shapePolylineLayer = null;
|
|
217
|
+
} else {
|
|
218
|
+
var _this$shapePolylineLa3;
|
|
219
|
+
(_this$shapePolylineLa3 = this.shapePolylineLayer) === null || _this$shapePolylineLa3 === void 0 || _this$shapePolylineLa3.update(this._getDrawPolylinePositions());
|
|
220
|
+
}
|
|
221
|
+
if (this.dragPoints[i]) {
|
|
222
|
+
this.dragPoints[i].destroy();
|
|
223
|
+
this.dragPoints.splice(i, 1);
|
|
224
|
+
}
|
|
225
|
+
// 绘制中
|
|
226
|
+
this.drawing(this);
|
|
227
|
+
this._drawContext.options.onMouseMoveChange && this._drawContext.options.onMouseMoveChange({
|
|
228
|
+
layer: this,
|
|
229
|
+
positions: this._getDrawPolylinePositions()
|
|
46
230
|
});
|
|
47
|
-
|
|
48
|
-
|
|
231
|
+
if (!((_this$positions6 = this.positions) !== null && _this$positions6 !== void 0 && _this$positions6.length)) {
|
|
232
|
+
this._drawContext._changeStatus(STATUS.START_DRAW);
|
|
233
|
+
this._drawContext._updateTooltip();
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// 更新临时点位
|
|
238
|
+
}, {
|
|
239
|
+
key: "updateTempPosition",
|
|
240
|
+
value: function updateTempPosition(position) {
|
|
241
|
+
var _this$shapePolylineLa4;
|
|
242
|
+
if (!this.shapePolylineLayer) return;
|
|
243
|
+
var lng = position.lng,
|
|
244
|
+
lat = position.lat,
|
|
245
|
+
alt = position.alt;
|
|
246
|
+
this._tempPosition = [lng, lat, alt];
|
|
247
|
+
(_this$shapePolylineLa4 = this.shapePolylineLayer) === null || _this$shapePolylineLa4 === void 0 || _this$shapePolylineLa4.update(this._getDrawPolylinePositions());
|
|
248
|
+
this._drawContext.options.onMouseMoveChange && this._drawContext.options.onMouseMoveChange({
|
|
249
|
+
layer: this,
|
|
250
|
+
positions: this._getDrawPolylinePositions()
|
|
49
251
|
});
|
|
50
252
|
}
|
|
253
|
+
|
|
254
|
+
// 结束绘制
|
|
255
|
+
}, {
|
|
256
|
+
key: "endDraw",
|
|
257
|
+
value: function endDraw() {
|
|
258
|
+
var _this$shapePolylineLa5;
|
|
259
|
+
this._tempPosition = null;
|
|
260
|
+
(_this$shapePolylineLa5 = this.shapePolylineLayer) === null || _this$shapePolylineLa5 === void 0 || _this$shapePolylineLa5.update(this._getDrawPolylinePositions());
|
|
261
|
+
// 存入
|
|
262
|
+
this._drawContext.setDrawerLayer(this.id, this);
|
|
263
|
+
this.drawEnd(this);
|
|
264
|
+
this.startEdit();
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// 开始编辑
|
|
268
|
+
}, {
|
|
269
|
+
key: "startEdit",
|
|
270
|
+
value: function startEdit() {
|
|
271
|
+
_get(_getPrototypeOf(Polyline.prototype), "startEdit", this).call(this);
|
|
272
|
+
this.edges = [];
|
|
273
|
+
this.edges = this._createEdgesAndMiddle(this.dragPoints);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// 开始鼠标拖拽
|
|
277
|
+
}, {
|
|
278
|
+
key: "mouseDragStart",
|
|
279
|
+
value: function mouseDragStart(position, dragLayer) {
|
|
280
|
+
var _this3 = this;
|
|
281
|
+
this.dragging = true;
|
|
282
|
+
this.dragLayer = dragLayer;
|
|
283
|
+
if (this.dragLayer.isMiddlePoint) {
|
|
284
|
+
// 找到相应有关系的边
|
|
285
|
+
var changeEdges = this.edges.filter(function (t) {
|
|
286
|
+
return t.middlePoint.id === _this3.dragLayer.id;
|
|
287
|
+
});
|
|
288
|
+
this.edges = this.edges.filter(function (t) {
|
|
289
|
+
return t.middlePoint.id !== _this3.dragLayer.id;
|
|
290
|
+
});
|
|
291
|
+
var _loop = function _loop() {
|
|
292
|
+
var source = changeEdges[i].source;
|
|
293
|
+
var target = changeEdges[i].target;
|
|
294
|
+
var middlePoint = changeEdges[i].middlePoint;
|
|
295
|
+
middlePoint.isStart = false;
|
|
296
|
+
_this3.edges.push({
|
|
297
|
+
source: source,
|
|
298
|
+
target: middlePoint,
|
|
299
|
+
middlePoint: null
|
|
300
|
+
}, {
|
|
301
|
+
source: middlePoint,
|
|
302
|
+
target: target,
|
|
303
|
+
middlePoint: null
|
|
304
|
+
});
|
|
305
|
+
var findIndex = _this3.dragPoints.findIndex(function (t) {
|
|
306
|
+
return t.id === source.id;
|
|
307
|
+
});
|
|
308
|
+
if (findIndex > -1) {
|
|
309
|
+
_this3.dragPoints.splice(findIndex + 1, 0, middlePoint);
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
for (var i = 0; i < changeEdges.length; i++) {
|
|
313
|
+
_loop();
|
|
314
|
+
}
|
|
315
|
+
} else {
|
|
316
|
+
// 找到相应有关系的边
|
|
317
|
+
var _changeEdges = this.edges.filter(function (t) {
|
|
318
|
+
return t.source.id === _this3.dragLayer.id || t.target.id === _this3.dragLayer.id;
|
|
319
|
+
});
|
|
320
|
+
for (var _i = 0; _i < _changeEdges.length; _i++) {
|
|
321
|
+
// 删除中间点
|
|
322
|
+
if (_changeEdges[_i].middlePoint) {
|
|
323
|
+
_changeEdges[_i].middlePoint.destroy();
|
|
324
|
+
_changeEdges[_i].middlePoint = null;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
this.dragLayer.mouseDragStart();
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// 鼠标拖拽
|
|
332
|
+
}, {
|
|
333
|
+
key: "mouseDragChange",
|
|
334
|
+
value: function mouseDragChange(position) {
|
|
335
|
+
var _this$shapePolylineLa6, _this$_drawContext$op, _this$_drawContext$op2;
|
|
336
|
+
if (!this.dragging) return;
|
|
337
|
+
// 点拖拽
|
|
338
|
+
this.dragLayer.mouseDragChange(position);
|
|
339
|
+
// 根据edges重新生成新的点位
|
|
340
|
+
this.positions = this._updatePositionsFromEdges();
|
|
341
|
+
(_this$shapePolylineLa6 = this.shapePolylineLayer) === null || _this$shapePolylineLa6 === void 0 || _this$shapePolylineLa6.update(this._getDrawPolylinePositions());
|
|
342
|
+
// 调用点位改变事件
|
|
343
|
+
((_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({
|
|
344
|
+
layer: this,
|
|
345
|
+
positions: this.positions
|
|
346
|
+
}));
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// 拖拽结束
|
|
350
|
+
}, {
|
|
351
|
+
key: "mouseDragEnd",
|
|
352
|
+
value: function mouseDragEnd() {
|
|
353
|
+
var _this4 = this;
|
|
354
|
+
// 找到相应有关系的边
|
|
355
|
+
var changeEdges = this.edges.filter(function (t) {
|
|
356
|
+
return t.source.id === _this4.dragLayer.id || t.target.id === _this4.dragLayer.id;
|
|
357
|
+
});
|
|
358
|
+
// 创建中间点
|
|
359
|
+
for (var i = 0; i < changeEdges.length; i++) {
|
|
360
|
+
var p1 = changeEdges[i].source.layer.layers[0].source.positions;
|
|
361
|
+
var p2 = changeEdges[i].target.layer.layers[0].source.positions;
|
|
362
|
+
var layer = this._createTwoPointMiddle(utils.getMidpoint(p1, p2));
|
|
363
|
+
layer.startEdit();
|
|
364
|
+
changeEdges[i].middlePoint = layer;
|
|
365
|
+
}
|
|
366
|
+
this.dragging = false;
|
|
367
|
+
this.dragLayer = null;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// 结束编辑
|
|
371
|
+
}, {
|
|
372
|
+
key: "endEdit",
|
|
373
|
+
value: function endEdit(layer) {
|
|
374
|
+
_get(_getPrototypeOf(Polyline.prototype), "endEdit", this).call(this, layer);
|
|
375
|
+
this.dragPoints.forEach(function (t) {
|
|
376
|
+
t.endEdit();
|
|
377
|
+
t.show(false);
|
|
378
|
+
});
|
|
379
|
+
this.edges.forEach(function (t) {
|
|
380
|
+
return t.middlePoint.destroy();
|
|
381
|
+
});
|
|
382
|
+
this.edges = [];
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// 销毁
|
|
386
|
+
}, {
|
|
387
|
+
key: "destroy",
|
|
388
|
+
value: function destroy() {
|
|
389
|
+
_get(_getPrototypeOf(Polyline.prototype), "destroy", this).call(this);
|
|
390
|
+
this.shapePolylineLayer && this.shapePolylineLayer.destroy();
|
|
391
|
+
this.shapePolylineLayer = null;
|
|
392
|
+
}
|
|
51
393
|
}]);
|
|
52
394
|
return Polyline;
|
|
53
|
-
}(
|
|
54
|
-
export
|
|
395
|
+
}(BaseShape);
|
|
396
|
+
export default Polyline;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const HANDLE_FEATURE_DATA_TYPE_FUN: any;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// 获取对应类型的数据处理方法
|
|
2
|
+
import { flattenEach } from '@turf/turf';
|
|
3
|
+
export var HANDLE_FEATURE_DATA_TYPE_FUN = {
|
|
4
|
+
Point: handleFeaturePoint,
|
|
5
|
+
MultiPoint: handleFeatureMultiPoint,
|
|
6
|
+
LineString: handleFeatureLineString,
|
|
7
|
+
MultiLineString: handleFeatureMultiLineString,
|
|
8
|
+
Polygon: handleFeaturePolygon,
|
|
9
|
+
MultiPolygon: handleFeatureMultiPolygon
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// 处理点
|
|
13
|
+
function handleFeaturePoint(feature) {
|
|
14
|
+
return {
|
|
15
|
+
type: 'single',
|
|
16
|
+
positions: feature.geometry.coordinates
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// 处理多点
|
|
21
|
+
function handleFeatureMultiPoint(feature) {
|
|
22
|
+
return {
|
|
23
|
+
type: 'multi',
|
|
24
|
+
positions: feature.geometry.coordinates
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// 处理线
|
|
29
|
+
function handleFeatureLineString(feature) {
|
|
30
|
+
return {
|
|
31
|
+
type: 'single',
|
|
32
|
+
positions: feature.geometry.coordinates
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// 处理多线
|
|
37
|
+
function handleFeatureMultiLineString(feature) {
|
|
38
|
+
return {
|
|
39
|
+
type: 'multi',
|
|
40
|
+
positions: feature.geometry.coordinates
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// 处理面
|
|
45
|
+
function handleFeaturePolygon(feature) {
|
|
46
|
+
return {
|
|
47
|
+
type: 'single',
|
|
48
|
+
positions: feature.geometry.coordinates[0]
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// 处理多面
|
|
53
|
+
function handleFeatureMultiPolygon(feature) {
|
|
54
|
+
var features = [];
|
|
55
|
+
flattenEach(feature, function (currentFeature) {
|
|
56
|
+
var singleFeature = handleFeaturePolygon(currentFeature);
|
|
57
|
+
features.push(singleFeature.positions);
|
|
58
|
+
});
|
|
59
|
+
return {
|
|
60
|
+
type: 'multi',
|
|
61
|
+
positions: features
|
|
62
|
+
};
|
|
63
|
+
}
|
|
@@ -8,7 +8,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
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
10
|
import * as Cesium from 'deeptwins-cesium';
|
|
11
|
-
import { cloneDeep, flattenDeep } from 'lodash';
|
|
11
|
+
import { cloneDeep, flattenDeep, isFunction, isString } from 'lodash';
|
|
12
12
|
import { v4 as uuidv4 } from 'uuid';
|
|
13
13
|
import * as constant from "../constant";
|
|
14
14
|
import BaseSource from "../graphicLayer/BaseSource";
|
|
@@ -150,7 +150,7 @@ var BaseLayer = /*#__PURE__*/function () {
|
|
|
150
150
|
var layer = new this._renderClass(_objectSpread(_objectSpread(_objectSpread({
|
|
151
151
|
map: this.getMap()
|
|
152
152
|
}, data), options), {}, {
|
|
153
|
-
html:
|
|
153
|
+
html: isFunction(options.html) ? options.html(data.properties) : options.html,
|
|
154
154
|
source: data,
|
|
155
155
|
style: utils.styleFun(cloneDeep(options.style || {}), data.properties)
|
|
156
156
|
}));
|
|
@@ -210,7 +210,7 @@ var BaseLayer = /*#__PURE__*/function () {
|
|
|
210
210
|
}, {
|
|
211
211
|
key: "_getOne",
|
|
212
212
|
value: function _getOne(id) {
|
|
213
|
-
return
|
|
213
|
+
return isString(id) ? this.layers.find(function (t) {
|
|
214
214
|
return t.id === id;
|
|
215
215
|
}) : id;
|
|
216
216
|
}
|
|
@@ -383,6 +383,11 @@ var BaseLayer = /*#__PURE__*/function () {
|
|
|
383
383
|
this.primitiveCollection && this.primitiveCollection.removeAll();
|
|
384
384
|
this.primitiveCollection = null;
|
|
385
385
|
}
|
|
386
|
+
}, {
|
|
387
|
+
key: "destroy",
|
|
388
|
+
value: function destroy() {
|
|
389
|
+
this.remove();
|
|
390
|
+
}
|
|
386
391
|
}]);
|
|
387
392
|
return BaseLayer;
|
|
388
393
|
}();
|
|
@@ -7,7 +7,7 @@ export default class BaseSource {
|
|
|
7
7
|
private _isCompleteInfo;
|
|
8
8
|
static HANDLE_FEATURE_TYPE_FUN: any;
|
|
9
9
|
static HANDLE_FEATURE_CLAMP_TYPE_FUN: any;
|
|
10
|
-
constructor({ id, source, customSource, mapContext }: any);
|
|
10
|
+
constructor({ id, source, customSource, originalData, mapContext }: any);
|
|
11
11
|
getMap(): any;
|
|
12
12
|
private _canOperate;
|
|
13
13
|
private _handleGeoJson;
|
|
@@ -23,6 +23,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
23
23
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
24
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
25
|
import { featureEach, flattenEach } from '@turf/turf';
|
|
26
|
+
import { isArray, isString } from 'lodash';
|
|
26
27
|
import wellknown from 'wellknown';
|
|
27
28
|
import { ClampToGround } from "../tool/common";
|
|
28
29
|
import * as utils from "../tool/utils";
|
|
@@ -31,6 +32,7 @@ var BaseSource = /*#__PURE__*/function () {
|
|
|
31
32
|
var id = _ref.id,
|
|
32
33
|
source = _ref.source,
|
|
33
34
|
customSource = _ref.customSource,
|
|
35
|
+
originalData = _ref.originalData,
|
|
34
36
|
mapContext = _ref.mapContext;
|
|
35
37
|
_classCallCheck(this, BaseSource);
|
|
36
38
|
_defineProperty(this, "_mapContext", void 0);
|
|
@@ -46,6 +48,14 @@ var BaseSource = /*#__PURE__*/function () {
|
|
|
46
48
|
if (customSource) {
|
|
47
49
|
this._isCompleteInfo = false;
|
|
48
50
|
this.source.push(customSource);
|
|
51
|
+
} else if (originalData) {
|
|
52
|
+
this._isCompleteInfo = false;
|
|
53
|
+
this.source.push({
|
|
54
|
+
type: '',
|
|
55
|
+
properties: {},
|
|
56
|
+
geometry: {},
|
|
57
|
+
positions: originalData
|
|
58
|
+
});
|
|
49
59
|
} else {
|
|
50
60
|
this.translateSource(source);
|
|
51
61
|
}
|
|
@@ -131,7 +141,7 @@ var BaseSource = /*#__PURE__*/function () {
|
|
|
131
141
|
}], [{
|
|
132
142
|
key: "analysisSourceType",
|
|
133
143
|
value: function analysisSourceType(data) {
|
|
134
|
-
if (
|
|
144
|
+
if (isString(data)) {
|
|
135
145
|
if (utils.isWKT(data)) {
|
|
136
146
|
return 'wkt';
|
|
137
147
|
} else {
|
|
@@ -167,7 +177,7 @@ var BaseSource = /*#__PURE__*/function () {
|
|
|
167
177
|
var handle = BaseSource.HANDLE_FEATURE_TYPE_FUN[feature.geometry.type];
|
|
168
178
|
if (handle) {
|
|
169
179
|
var handleFeature = handle(feature);
|
|
170
|
-
|
|
180
|
+
isArray(handleFeature) ? features.push.apply(features, _toConsumableArray(handleFeature)) : features.push(handleFeature);
|
|
171
181
|
} else {
|
|
172
182
|
throw new Error("\u9519\u8BEF\u7684geometry\u7C7B\u578B".concat(feature.geometry.type));
|
|
173
183
|
}
|
|
@@ -278,7 +288,7 @@ var BaseSource = /*#__PURE__*/function () {
|
|
|
278
288
|
return handle(feature, clampToGroundInstance, clampToGround);
|
|
279
289
|
case 4:
|
|
280
290
|
_handleFeature = _context.sent;
|
|
281
|
-
|
|
291
|
+
isArray(_handleFeature) ? features.push.apply(features, _toConsumableArray(_handleFeature)) : features.push(_handleFeature);
|
|
282
292
|
_context.next = 9;
|
|
283
293
|
break;
|
|
284
294
|
case 8:
|
|
@@ -11,7 +11,9 @@ export default class GraphicLayerCollection {
|
|
|
11
11
|
getMap(): any;
|
|
12
12
|
addSource(id: string, geoJson: any): BaseSource | undefined;
|
|
13
13
|
addCustomSource(id: string, positions: any): BaseSource | undefined;
|
|
14
|
+
addOriginalDataToSource(id: string, positions: any): BaseSource | undefined;
|
|
14
15
|
addLayer(data: any, options: any): BaseLayer | undefined;
|
|
16
|
+
addOriginalDataToLayer(positions: any, options: any): BaseLayer | undefined;
|
|
15
17
|
addCustomSourceToLayer(positions: any, options: any): BaseLayer | undefined;
|
|
16
18
|
private _addLayerToMap;
|
|
17
19
|
private _removeGraphicMapLayer;
|