deeptwins-engine-3d 0.1.42 → 0.1.44
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/esm/analyze/ViewshedAnalysis.d.ts +8 -8
- package/dist/esm/analyze/ViewshedAnalysis.js +76 -90
- package/dist/esm/constant.d.ts +44 -6
- package/dist/esm/constant.js +86 -7
- package/dist/esm/deepTwins/index.js +2 -1
- package/dist/esm/drawer/index.d.ts +1 -1
- package/dist/esm/index.d.ts +4 -1
- package/dist/esm/index.js +12 -5
- package/dist/esm/lowAltitude/BarrierLayer.d.ts +29 -0
- package/dist/esm/{tileLayer → lowAltitude}/BarrierLayer.js +39 -165
- package/dist/esm/lowAltitude/BaseGridMvtLayer.d.ts +34 -0
- package/dist/esm/lowAltitude/BaseGridMvtLayer.js +122 -0
- package/dist/esm/lowAltitude/FlightPlanning.d.ts +27 -0
- package/dist/esm/lowAltitude/FlightPlanning.js +411 -0
- package/dist/esm/lowAltitude/FlightRiskEvaluation.d.ts +0 -0
- package/dist/esm/lowAltitude/FlightRiskEvaluation.js +383 -0
- package/dist/esm/{visualization/Airspace.d.ts → lowAltitude/GridDraw.d.ts} +2 -1
- package/dist/esm/{visualization/Airspace.js → lowAltitude/GridDraw.js} +9 -9
- package/dist/esm/lowAltitude/PoiLayer.d.ts +13 -0
- package/dist/esm/lowAltitude/PoiLayer.js +74 -0
- package/dist/esm/lowAltitude/VisitLayer.d.ts +26 -0
- package/dist/esm/lowAltitude/VisitLayer.js +180 -0
- package/dist/esm/map/Map.js +3 -3
- package/dist/esm/tool/common.d.ts +2 -1
- package/dist/esm/tool/common.js +14 -2
- package/dist/esm/tool/fetch.d.ts +51 -0
- package/dist/esm/tool/fetch.js +222 -0
- package/dist/esm/videoFusion/BaseVideo.d.ts +1 -1
- package/dist/esm/videoFusion/BaseVideo.js +47 -2
- package/dist/esm/videoFusion/VideoProject.js +3 -0
- package/dist/esm/videoFusion/VideoTexture.js +3 -0
- package/dist/esm/visualization/FrustumWithCamera.js +10 -8
- package/dist/umd/deeptwins-engine-3d.min.js +1 -1
- package/package.json +2 -2
- package/dist/esm/tileLayer/BarrierLayer.d.ts +0 -76
|
@@ -1,91 +1,38 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
function
|
|
5
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
7
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
9
|
-
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; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
5
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
11
6
|
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); } }
|
|
12
7
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
|
-
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; }
|
|
14
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
15
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
|
+
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); }
|
|
11
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
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); }; }
|
|
13
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
14
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
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; } }
|
|
16
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
16
17
|
import * as Cesium from 'deeptwins-cesium';
|
|
17
|
-
import
|
|
18
|
+
import BaseGridMvtLayer from "./BaseGridMvtLayer";
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* 障碍物图层 - 基于MVT数据渲染障碍物网格
|
|
21
|
-
*
|
|
22
|
-
* 使用方式:
|
|
23
|
-
* ```js
|
|
24
|
-
* const DeepTwins = new DeepTwinsEngine3D.DeepTwins();
|
|
25
|
-
* DeepTwins.onLoad(async ({ gridVTLayer }) => {
|
|
26
|
-
* const barrierLayer = new BarrierLayer(viewer, {
|
|
27
|
-
* gridVTLayer: gridVTLayer,
|
|
28
|
-
* url: 'https://...',
|
|
29
|
-
* });
|
|
30
|
-
* });
|
|
31
|
-
* ```
|
|
32
22
|
*/
|
|
33
|
-
var BarrierLayer = /*#__PURE__*/function () {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
* @param map Cesium Viewer实例
|
|
37
|
-
* @param options 配置选项
|
|
38
|
-
* @param options.gridVTLayer GridVTLayer类(从DeepTwins.onLoad中获取)
|
|
39
|
-
* @param options.url MVT数据URL模板,默认为障碍物数据地址
|
|
40
|
-
* @param options.dataType 数据类型,默认为'barrier'
|
|
41
|
-
* @param options.zooms 缩放级别范围,默认[10, 22]
|
|
42
|
-
* @param options.dataZooms 数据缩放级别,默认[16, 16]
|
|
43
|
-
* @param options.cacheSize 缓存大小,默认20
|
|
44
|
-
* @param options.heightColors 高度颜色映射数组,默认使用内置颜色
|
|
45
|
-
* @param options.minHeight 最小高度(米),低于此高度的障碍物不渲染,默认0
|
|
46
|
-
* @param options.maxHeight 最大高度(米),高于此高度的障碍物不渲染,默认Infinity
|
|
47
|
-
*/
|
|
23
|
+
var BarrierLayer = /*#__PURE__*/function (_BaseGridMvtLayer) {
|
|
24
|
+
_inherits(BarrierLayer, _BaseGridMvtLayer);
|
|
25
|
+
var _super = _createSuper(BarrierLayer);
|
|
48
26
|
function BarrierLayer(map) {
|
|
49
|
-
var _this
|
|
27
|
+
var _this;
|
|
50
28
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
51
29
|
_classCallCheck(this, BarrierLayer);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
_defineProperty(this, "_options", {});
|
|
56
|
-
_defineProperty(this, "_heightColors", []);
|
|
57
|
-
this._mapContext = map._mapContext;
|
|
58
|
-
if (!options.gridVTLayer) {
|
|
59
|
-
console.error('BarrierLayer: 请提供gridVTLayer参数,可通过DeepTwins.onLoad获取');
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
var GridVTLayer = options.gridVTLayer;
|
|
63
|
-
|
|
64
|
-
// 验证并设置 dataZooms
|
|
65
|
-
var dataZooms = options.dataZooms || [16, 16];
|
|
66
|
-
if (!Array.isArray(dataZooms) || dataZooms.length !== 2) {
|
|
67
|
-
console.warn('BarrierLayer: dataZooms 应该是 [minZoom, maxZoom] 格式的数组,使用默认值 [16, 16]');
|
|
68
|
-
dataZooms = [16, 16];
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// 设置颜色配置
|
|
72
|
-
if (options.heightColors && Array.isArray(options.heightColors)) {
|
|
73
|
-
this._heightColors = options.heightColors;
|
|
74
|
-
} else {
|
|
75
|
-
this._heightColors = _toConsumableArray(BarrierLayer.DEFAULT_HEIGHT_COLORS);
|
|
76
|
-
}
|
|
77
|
-
this._options = _objectSpread({
|
|
78
|
-
url: options.url || 'https://amappc.oss-cn-zhangjiakou.aliyuncs.com/yunjing/data/dikong/barrier/mvt/{z}_{x}_{y}.mvt',
|
|
79
|
-
dataType: options.dataType || 'barrier',
|
|
80
|
-
zooms: options.zooms || [10, 22],
|
|
81
|
-
dataZooms: dataZooms,
|
|
82
|
-
cacheSize: options.cacheSize || 20,
|
|
83
|
-
minHeight: options.minHeight !== undefined ? options.minHeight : 0,
|
|
84
|
-
maxHeight: options.maxHeight !== undefined ? options.maxHeight : Infinity
|
|
85
|
-
}, options);
|
|
30
|
+
_this = _super.call(this, map, _objectSpread({
|
|
31
|
+
dataType: 'barrier'
|
|
32
|
+
}, options));
|
|
86
33
|
|
|
87
34
|
// 创建 GridVTLayer
|
|
88
|
-
|
|
35
|
+
_this.createMvtLayer({
|
|
89
36
|
createPrimitives: function createPrimitives(tileNum, renderData, viewer) {
|
|
90
37
|
var targetViewer = viewer || _this.getMap();
|
|
91
38
|
return _this._createPrimitives(tileNum, renderData, targetViewer);
|
|
@@ -102,52 +49,24 @@ var BarrierLayer = /*#__PURE__*/function () {
|
|
|
102
49
|
updatePrimitives: function updatePrimitives(tileNum, primitives) {
|
|
103
50
|
return _this._updatePrimitives(tileNum, primitives);
|
|
104
51
|
}
|
|
105
|
-
};
|
|
106
|
-
this._gridVTLayer = new GridVTLayer({
|
|
107
|
-
viewer: this.getMap(),
|
|
108
|
-
url: this._options.url,
|
|
109
|
-
cacheSize: this._options.cacheSize,
|
|
110
|
-
dataZooms: this._options.dataZooms,
|
|
111
|
-
zooms: this._options.zooms,
|
|
112
|
-
dataType: this._options.dataType,
|
|
113
|
-
customPrimitive: customPrimitiveCallbacks
|
|
114
52
|
});
|
|
115
|
-
|
|
116
|
-
// 默认显示图层
|
|
117
|
-
if (typeof this._gridVTLayer.show === 'function') {
|
|
118
|
-
this._gridVTLayer.show();
|
|
119
|
-
} else if (this._gridVTLayer.visible !== undefined) {
|
|
120
|
-
this._gridVTLayer.visible = true;
|
|
121
|
-
}
|
|
53
|
+
return _this;
|
|
122
54
|
}
|
|
123
55
|
|
|
124
|
-
|
|
56
|
+
/**
|
|
57
|
+
* 创建primitives
|
|
58
|
+
* 按照示例代码的逻辑实现,每个feature创建一个障碍物实例
|
|
59
|
+
*/
|
|
125
60
|
_createClass(BarrierLayer, [{
|
|
126
|
-
key: "_canOperate",
|
|
127
|
-
value: function _canOperate() {
|
|
128
|
-
if (this.isDestroyed) {
|
|
129
|
-
utils.error('SubmergenceAnalysis实例已销毁');
|
|
130
|
-
return false;
|
|
131
|
-
}
|
|
132
|
-
return true;
|
|
133
|
-
}
|
|
134
|
-
}, {
|
|
135
|
-
key: "getMap",
|
|
136
|
-
value: function getMap() {
|
|
137
|
-
return this._mapContext && this._mapContext.getMap();
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* 创建primitives
|
|
142
|
-
* 按照示例代码的逻辑实现,每个feature创建一个障碍物实例
|
|
143
|
-
*/
|
|
144
|
-
}, {
|
|
145
61
|
key: "_createPrimitives",
|
|
146
62
|
value: function _createPrimitives(tileNum, renderData, viewer) {
|
|
63
|
+
if (!this._isViewerReady()) {
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
147
66
|
var features = (renderData === null || renderData === void 0 ? void 0 : renderData.default) || [];
|
|
148
67
|
var instances = [];
|
|
149
|
-
var minHeight = this.
|
|
150
|
-
var maxHeight = this.
|
|
68
|
+
var minHeight = this.options.minHeight || 0;
|
|
69
|
+
var maxHeight = this.options.maxHeight !== undefined ? this.options.maxHeight : Infinity;
|
|
151
70
|
for (var i = 0; i < features.length; i++) {
|
|
152
71
|
var feature = features[i];
|
|
153
72
|
if (!feature || !feature.lnglat || !feature.gridSize) {
|
|
@@ -164,8 +83,8 @@ var BarrierLayer = /*#__PURE__*/function () {
|
|
|
164
83
|
|
|
165
84
|
// 根据高度计算颜色索引
|
|
166
85
|
var colorIndex = Math.floor(feature.lnglat[2] / 7.66 / 3);
|
|
167
|
-
var clampedIndex = Math.max(0, Math.min(colorIndex, this.
|
|
168
|
-
var color = this.
|
|
86
|
+
var clampedIndex = Math.max(0, Math.min(colorIndex, this.options.heightColors.length - 1));
|
|
87
|
+
var color = this.options.heightColors[clampedIndex] || '#d8daeb';
|
|
169
88
|
var instance = new Cesium.GeometryInstance({
|
|
170
89
|
geometry: Cesium.BoxGeometry.fromDimensions({
|
|
171
90
|
vertexFormat: Cesium.VertexFormat.POSITION_AND_NORMAL,
|
|
@@ -178,6 +97,9 @@ var BarrierLayer = /*#__PURE__*/function () {
|
|
|
178
97
|
});
|
|
179
98
|
instances.push(instance);
|
|
180
99
|
}
|
|
100
|
+
if (!this._isViewerReady() || instances.length === 0) {
|
|
101
|
+
return [];
|
|
102
|
+
}
|
|
181
103
|
var primitives = [];
|
|
182
104
|
if (instances.length > 0) {
|
|
183
105
|
var primitive = new Cesium.Primitive({
|
|
@@ -187,9 +109,11 @@ var BarrierLayer = /*#__PURE__*/function () {
|
|
|
187
109
|
closed: true
|
|
188
110
|
})
|
|
189
111
|
});
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
112
|
+
if (this._isViewerReady()) {
|
|
113
|
+
var targetViewer = viewer || this.getMap();
|
|
114
|
+
targetViewer.scene.primitives.add(primitive);
|
|
115
|
+
primitives.push(primitive);
|
|
116
|
+
}
|
|
193
117
|
}
|
|
194
118
|
return primitives;
|
|
195
119
|
}
|
|
@@ -242,57 +166,7 @@ var BarrierLayer = /*#__PURE__*/function () {
|
|
|
242
166
|
value: function _updatePrimitives(_tileNum, _primitives) {
|
|
243
167
|
// 预留接口,可根据需要实现更新逻辑
|
|
244
168
|
}
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* 显示图层
|
|
248
|
-
*/
|
|
249
|
-
}, {
|
|
250
|
-
key: "show",
|
|
251
|
-
value: function show() {
|
|
252
|
-
if (this._gridVTLayer) {
|
|
253
|
-
if (typeof this._gridVTLayer.show === 'function') {
|
|
254
|
-
this._gridVTLayer.show();
|
|
255
|
-
} else if (this._gridVTLayer.visible !== undefined) {
|
|
256
|
-
this._gridVTLayer.visible = true;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* 隐藏图层
|
|
263
|
-
*/
|
|
264
|
-
}, {
|
|
265
|
-
key: "hide",
|
|
266
|
-
value: function hide() {
|
|
267
|
-
if (this._gridVTLayer) {
|
|
268
|
-
this._gridVTLayer.hide();
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* 销毁图层
|
|
274
|
-
*/
|
|
275
|
-
}, {
|
|
276
|
-
key: "destroy",
|
|
277
|
-
value: function destroy() {
|
|
278
|
-
if (this._gridVTLayer) {
|
|
279
|
-
var _this$_gridVTLayer$de, _this$_gridVTLayer;
|
|
280
|
-
(_this$_gridVTLayer$de = (_this$_gridVTLayer = this._gridVTLayer).destroy) === null || _this$_gridVTLayer$de === void 0 || _this$_gridVTLayer$de.call(_this$_gridVTLayer);
|
|
281
|
-
this._gridVTLayer = null;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* 获取底层GridVTLayer实例
|
|
287
|
-
*/
|
|
288
|
-
}, {
|
|
289
|
-
key: "getGridVTLayer",
|
|
290
|
-
value: function getGridVTLayer() {
|
|
291
|
-
return this._gridVTLayer;
|
|
292
|
-
}
|
|
293
169
|
}]);
|
|
294
170
|
return BarrierLayer;
|
|
295
|
-
}();
|
|
296
|
-
|
|
297
|
-
_defineProperty(BarrierLayer, "DEFAULT_HEIGHT_COLORS", ['#9e0142', '#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#e6f598', '#abdda4', '#66c2a5', '#3288bd', '#5e4fa2'].reverse());
|
|
298
|
-
export { BarrierLayer as default };
|
|
171
|
+
}(BaseGridMvtLayer);
|
|
172
|
+
export default BarrierLayer;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
declare class BaseGridMvtLayer {
|
|
2
|
+
private readonly _mapContext;
|
|
3
|
+
isDestroyed: boolean;
|
|
4
|
+
options: any;
|
|
5
|
+
_gridVTLayer: any;
|
|
6
|
+
/**
|
|
7
|
+
* 创建网格mvt图层
|
|
8
|
+
* @param map Cesium Viewer实例
|
|
9
|
+
* @param options 配置选项
|
|
10
|
+
* @param options.gridVTLayer GridVTLayer类(从DeepTwins.onLoad中获取)
|
|
11
|
+
* @param options.url MVT数据URL模板,默认为障碍物数据地址
|
|
12
|
+
* @param options.dataType 数据类型,默认为'flow'
|
|
13
|
+
* @param options.zooms 缩放级别范围,默认[10, 22]
|
|
14
|
+
* @param options.dataZooms 数据缩放级别,默认[16, 16]
|
|
15
|
+
* @param options.cacheSize 缓存大小,默认20
|
|
16
|
+
* @param options.heightColors 高度颜色映射数组,默认使用内置颜色
|
|
17
|
+
* @param options.minHeight 最小高度(米),低于此高度的障碍物不渲染,默认0
|
|
18
|
+
* @param options.maxHeight 最大高度(米),高于此高度的障碍物不渲染,默认Infinity
|
|
19
|
+
*/
|
|
20
|
+
constructor(map: any, options?: any);
|
|
21
|
+
createMvtLayer(customPrimitive: any): void;
|
|
22
|
+
private _canOperate;
|
|
23
|
+
getMap(): any;
|
|
24
|
+
_isViewerReady(): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* 显示/隐藏图层
|
|
27
|
+
*/
|
|
28
|
+
show(isShow: boolean): void;
|
|
29
|
+
/**
|
|
30
|
+
* 销毁图层
|
|
31
|
+
*/
|
|
32
|
+
destroy(): void;
|
|
33
|
+
}
|
|
34
|
+
export default BaseGridMvtLayer;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
import { merge } from 'lodash';
|
|
9
|
+
import { DEFAULT_GRID_VT_OPTIONS } from "../constant";
|
|
10
|
+
import * as utils from "../tool/utils";
|
|
11
|
+
var BaseGridMvtLayer = /*#__PURE__*/function () {
|
|
12
|
+
/**
|
|
13
|
+
* 创建网格mvt图层
|
|
14
|
+
* @param map Cesium Viewer实例
|
|
15
|
+
* @param options 配置选项
|
|
16
|
+
* @param options.gridVTLayer GridVTLayer类(从DeepTwins.onLoad中获取)
|
|
17
|
+
* @param options.url MVT数据URL模板,默认为障碍物数据地址
|
|
18
|
+
* @param options.dataType 数据类型,默认为'flow'
|
|
19
|
+
* @param options.zooms 缩放级别范围,默认[10, 22]
|
|
20
|
+
* @param options.dataZooms 数据缩放级别,默认[16, 16]
|
|
21
|
+
* @param options.cacheSize 缓存大小,默认20
|
|
22
|
+
* @param options.heightColors 高度颜色映射数组,默认使用内置颜色
|
|
23
|
+
* @param options.minHeight 最小高度(米),低于此高度的障碍物不渲染,默认0
|
|
24
|
+
* @param options.maxHeight 最大高度(米),高于此高度的障碍物不渲染,默认Infinity
|
|
25
|
+
*/
|
|
26
|
+
function BaseGridMvtLayer(map) {
|
|
27
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
28
|
+
_classCallCheck(this, BaseGridMvtLayer);
|
|
29
|
+
_defineProperty(this, "_mapContext", void 0);
|
|
30
|
+
_defineProperty(this, "isDestroyed", false);
|
|
31
|
+
_defineProperty(this, "options", {});
|
|
32
|
+
_defineProperty(this, "_gridVTLayer", null);
|
|
33
|
+
this._mapContext = map._mapContext;
|
|
34
|
+
if (!options.gridVTLayer) {
|
|
35
|
+
utils.error('VisitLayer: 请提供gridVTLayer参数,可通过DeepTwins.onLoad获取');
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
this.options = merge(DEFAULT_GRID_VT_OPTIONS(), options);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// 创建GridVTLayer
|
|
42
|
+
_createClass(BaseGridMvtLayer, [{
|
|
43
|
+
key: "createMvtLayer",
|
|
44
|
+
value: function createMvtLayer(customPrimitive) {
|
|
45
|
+
var GridVTLayer = this.options.gridVTLayer;
|
|
46
|
+
// 创建 GridVTLayer
|
|
47
|
+
this._gridVTLayer = new GridVTLayer({
|
|
48
|
+
viewer: this.getMap(),
|
|
49
|
+
url: this.options.url,
|
|
50
|
+
cacheSize: this.options.cacheSize,
|
|
51
|
+
dataZooms: this.options.dataZooms,
|
|
52
|
+
zooms: this.options.zooms,
|
|
53
|
+
dataType: this.options.dataType,
|
|
54
|
+
customPrimitive: customPrimitive
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// 是否能进行操作
|
|
59
|
+
}, {
|
|
60
|
+
key: "_canOperate",
|
|
61
|
+
value: function _canOperate() {
|
|
62
|
+
if (this.isDestroyed) {
|
|
63
|
+
utils.error('SubmergenceAnalysis实例已销毁');
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
}, {
|
|
69
|
+
key: "getMap",
|
|
70
|
+
value: function getMap() {
|
|
71
|
+
return this._mapContext && this._mapContext.getMap();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// 检查 viewer 是否就绪
|
|
75
|
+
}, {
|
|
76
|
+
key: "_isViewerReady",
|
|
77
|
+
value: function _isViewerReady() {
|
|
78
|
+
if (!this.getMap() || this.getMap().isDestroyed()) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
var scene = this.getMap().scene;
|
|
83
|
+
var imageryLayers = this.getMap().imageryLayers;
|
|
84
|
+
return Boolean(scene && imageryLayers);
|
|
85
|
+
} catch (error) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* 显示/隐藏图层
|
|
92
|
+
*/
|
|
93
|
+
}, {
|
|
94
|
+
key: "show",
|
|
95
|
+
value: function show(isShow) {
|
|
96
|
+
if (!this._canOperate()) return;
|
|
97
|
+
if (this._gridVTLayer) {
|
|
98
|
+
if (typeof this._gridVTLayer.show === 'function') {
|
|
99
|
+
isShow ? this._gridVTLayer.show() : this._gridVTLayer.hide();
|
|
100
|
+
} else if (this._gridVTLayer.visible !== undefined) {
|
|
101
|
+
this._gridVTLayer.visible = isShow;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* 销毁图层
|
|
108
|
+
*/
|
|
109
|
+
}, {
|
|
110
|
+
key: "destroy",
|
|
111
|
+
value: function destroy() {
|
|
112
|
+
if (!this._canOperate()) return;
|
|
113
|
+
this.isDestroyed = true;
|
|
114
|
+
if (this._gridVTLayer) {
|
|
115
|
+
this._gridVTLayer.destroy();
|
|
116
|
+
this._gridVTLayer = null;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}]);
|
|
120
|
+
return BaseGridMvtLayer;
|
|
121
|
+
}();
|
|
122
|
+
export default BaseGridMvtLayer;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
declare class FlightPlanning {
|
|
2
|
+
private readonly _mapContext;
|
|
3
|
+
isDestroyed: boolean;
|
|
4
|
+
options: any;
|
|
5
|
+
currentRoute: any;
|
|
6
|
+
routeGrid: any;
|
|
7
|
+
pipelinePlanningLayer: any;
|
|
8
|
+
routePointsLayer: any;
|
|
9
|
+
routePointsLabelLayer: any;
|
|
10
|
+
constructor(map: any, options: any);
|
|
11
|
+
private _canOperate;
|
|
12
|
+
getMap(): any;
|
|
13
|
+
createPlan(value: any): Promise<any>;
|
|
14
|
+
private _buildPayload;
|
|
15
|
+
private _normalizeRouteData;
|
|
16
|
+
private _createRoute;
|
|
17
|
+
private _clearRoute;
|
|
18
|
+
private _renderRouteGrids;
|
|
19
|
+
_clearRouteGrids(): void;
|
|
20
|
+
private _getColorByLayerHeight;
|
|
21
|
+
private _calculateGridCenterHeight;
|
|
22
|
+
private _getGridSizeByLevel;
|
|
23
|
+
private _calculateSphericalDistance;
|
|
24
|
+
clear(): void;
|
|
25
|
+
destroy(): void;
|
|
26
|
+
}
|
|
27
|
+
export default FlightPlanning;
|