deeptwins-engine-3d 0.1.41 → 0.1.43
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 +28 -0
- package/dist/esm/analyze/ViewshedAnalysis.js +291 -442
- 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/graphicLayer/BaseSource.d.ts +1 -1
- package/dist/esm/index.d.ts +5 -1
- package/dist/esm/index.js +13 -6
- 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 +426 -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/RiskEvaluation.d.ts +0 -0
- package/dist/esm/lowAltitude/RiskEvaluation.js +0 -0
- package/dist/esm/lowAltitude/VisitLayer.d.ts +26 -0
- package/dist/esm/lowAltitude/VisitLayer.js +180 -0
- package/dist/esm/map/GroundSkyBox.js +2 -2
- package/dist/esm/map/Map.js +10 -10
- package/dist/esm/plot/utils/DomUtil.js +1 -1
- package/dist/esm/tool/Compass.js +20 -4
- package/dist/esm/tool/PrimitiveCluster.js +10 -9
- package/dist/esm/tool/common.d.ts +1 -1
- package/dist/esm/tool/common.js +1 -1
- 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
|
@@ -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;
|
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
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; }
|
|
3
|
+
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); }
|
|
4
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
5
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
6
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
7
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
8
|
+
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); } }
|
|
9
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
10
|
+
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; }
|
|
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); }
|
|
13
|
+
import { lineString } from '@turf/turf';
|
|
14
|
+
import * as Cesium from 'deeptwins-cesium';
|
|
15
|
+
import { merge } from 'lodash';
|
|
16
|
+
import { DEFAULT_FLIGHT_PLANNING_OPTIONS } from "../constant";
|
|
17
|
+
import { ShapeSection } from "../tool/common";
|
|
18
|
+
import * as utils from "../tool/utils";
|
|
19
|
+
import GridDraw from "./GridDraw";
|
|
20
|
+
var FlightPlanning = /*#__PURE__*/function () {
|
|
21
|
+
function FlightPlanning(map, options) {
|
|
22
|
+
_classCallCheck(this, FlightPlanning);
|
|
23
|
+
_defineProperty(this, "_mapContext", void 0);
|
|
24
|
+
_defineProperty(this, "isDestroyed", false);
|
|
25
|
+
_defineProperty(this, "options", {});
|
|
26
|
+
_defineProperty(this, "currentRoute", null);
|
|
27
|
+
// 路线网格
|
|
28
|
+
_defineProperty(this, "routeGrid", null);
|
|
29
|
+
// 规划管道
|
|
30
|
+
_defineProperty(this, "pipelinePlanningLayer", null);
|
|
31
|
+
// 路线点位
|
|
32
|
+
_defineProperty(this, "routePointsLayer", null);
|
|
33
|
+
// 路线点位文字
|
|
34
|
+
_defineProperty(this, "routePointsLabelLayer", null);
|
|
35
|
+
this._mapContext = map._mapContext;
|
|
36
|
+
this.options = merge(DEFAULT_FLIGHT_PLANNING_OPTIONS(), options);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// 是否能进行操作
|
|
40
|
+
_createClass(FlightPlanning, [{
|
|
41
|
+
key: "_canOperate",
|
|
42
|
+
value: function _canOperate() {
|
|
43
|
+
if (this.isDestroyed) {
|
|
44
|
+
utils.error('SubmergenceAnalysis实例已销毁');
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
}, {
|
|
50
|
+
key: "getMap",
|
|
51
|
+
value: function getMap() {
|
|
52
|
+
return this._mapContext && this._mapContext.getMap();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// 生成计划
|
|
56
|
+
}, {
|
|
57
|
+
key: "createPlan",
|
|
58
|
+
value: function () {
|
|
59
|
+
var _createPlan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(value) {
|
|
60
|
+
var payload, response, result, normalized, hasPoints;
|
|
61
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
62
|
+
while (1) switch (_context.prev = _context.next) {
|
|
63
|
+
case 0:
|
|
64
|
+
payload = this._buildPayload(value);
|
|
65
|
+
_context.next = 3;
|
|
66
|
+
return fetch(this.options.API_URL, {
|
|
67
|
+
method: 'POST',
|
|
68
|
+
headers: {
|
|
69
|
+
'Content-Type': 'application/json'
|
|
70
|
+
},
|
|
71
|
+
body: JSON.stringify(payload)
|
|
72
|
+
});
|
|
73
|
+
case 3:
|
|
74
|
+
response = _context.sent;
|
|
75
|
+
if (response.ok) {
|
|
76
|
+
_context.next = 7;
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
utils.error("\u63A5\u53E3\u8BF7\u6C42\u5931\u8D25\uFF0CHTTP ".concat(response.status));
|
|
80
|
+
return _context.abrupt("return");
|
|
81
|
+
case 7:
|
|
82
|
+
_context.next = 9;
|
|
83
|
+
return response.json();
|
|
84
|
+
case 9:
|
|
85
|
+
result = _context.sent;
|
|
86
|
+
if (!(result.code !== 0)) {
|
|
87
|
+
_context.next = 13;
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
utils.error(result.message || '规划接口返回失败');
|
|
91
|
+
return _context.abrupt("return");
|
|
92
|
+
case 13:
|
|
93
|
+
if (result.data) {
|
|
94
|
+
_context.next = 16;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
utils.error('规划结果为空');
|
|
98
|
+
return _context.abrupt("return");
|
|
99
|
+
case 16:
|
|
100
|
+
normalized = this._normalizeRouteData(result.data);
|
|
101
|
+
if (this.options.isDraw) {
|
|
102
|
+
hasPoints = normalized && Array.isArray(normalized.points) && normalized.points.length > 0;
|
|
103
|
+
this.currentRoute = normalized;
|
|
104
|
+
this._clearRouteGrids();
|
|
105
|
+
if (hasPoints) {
|
|
106
|
+
this._createRoute();
|
|
107
|
+
// 渲染路线网格
|
|
108
|
+
if (this.currentRoute.grids && Array.isArray(this.currentRoute.grids) && this.currentRoute.grids.length > 0) {
|
|
109
|
+
this._renderRouteGrids();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return _context.abrupt("return", normalized);
|
|
114
|
+
case 19:
|
|
115
|
+
case "end":
|
|
116
|
+
return _context.stop();
|
|
117
|
+
}
|
|
118
|
+
}, _callee, this);
|
|
119
|
+
}));
|
|
120
|
+
function createPlan(_x) {
|
|
121
|
+
return _createPlan.apply(this, arguments);
|
|
122
|
+
}
|
|
123
|
+
return createPlan;
|
|
124
|
+
}()
|
|
125
|
+
}, {
|
|
126
|
+
key: "_buildPayload",
|
|
127
|
+
value: function _buildPayload(values) {
|
|
128
|
+
var toCoord = function toCoord(_ref) {
|
|
129
|
+
var lng = _ref.lng,
|
|
130
|
+
lat = _ref.lat,
|
|
131
|
+
alt = _ref.alt;
|
|
132
|
+
return [lng, lat, alt];
|
|
133
|
+
};
|
|
134
|
+
return {
|
|
135
|
+
source_target: {
|
|
136
|
+
source: {
|
|
137
|
+
coord: toCoord(values.source)
|
|
138
|
+
},
|
|
139
|
+
way_points: values.waypoints.map(function (item) {
|
|
140
|
+
return {
|
|
141
|
+
coord: toCoord(item)
|
|
142
|
+
};
|
|
143
|
+
}),
|
|
144
|
+
target: {
|
|
145
|
+
coord: toCoord(values.target)
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
metric: values.metric
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// 规划接口响应归一化:
|
|
153
|
+
// - 新版:result.data.paths[0].points 为航迹点数组(可能是二维数组,分段点数组)
|
|
154
|
+
// - 兼容老版:result.data.points 为航迹点数组
|
|
155
|
+
}, {
|
|
156
|
+
key: "_normalizeRouteData",
|
|
157
|
+
value: function _normalizeRouteData(data) {
|
|
158
|
+
if (!data || _typeof(data) !== 'object') return null;
|
|
159
|
+
var points = [];
|
|
160
|
+
var statistic = data.statistic;
|
|
161
|
+
var grids = data.grids;
|
|
162
|
+
var gridLevel = data.gridLevel;
|
|
163
|
+
var pushPoint = function pushPoint(p) {
|
|
164
|
+
if (!p || _typeof(p) !== 'object') return;
|
|
165
|
+
var lng = Number(p.lng);
|
|
166
|
+
var lat = Number(p.lat);
|
|
167
|
+
var alt = p.alt != null ? Number(p.alt) : 0;
|
|
168
|
+
var type = p.type;
|
|
169
|
+
if (!Number.isFinite(lng) || !Number.isFinite(lat)) return;
|
|
170
|
+
points.push({
|
|
171
|
+
lng: lng,
|
|
172
|
+
lat: lat,
|
|
173
|
+
alt: Number.isFinite(alt) ? alt : 0,
|
|
174
|
+
type: type
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
if (Array.isArray(data.paths) && data.paths.length) {
|
|
178
|
+
var path = data.paths[0] || {};
|
|
179
|
+
statistic = path.statistic || statistic;
|
|
180
|
+
grids = path.grids || grids;
|
|
181
|
+
gridLevel = path.gridLevel != null ? path.gridLevel : gridLevel;
|
|
182
|
+
var rawPoints = Array.isArray(path.points) ? path.points : [];
|
|
183
|
+
rawPoints.forEach(function (item) {
|
|
184
|
+
// 兼容二维数组 [ [point, point], [point, ...] ]
|
|
185
|
+
if (Array.isArray(item)) {
|
|
186
|
+
item.forEach(pushPoint);
|
|
187
|
+
} else {
|
|
188
|
+
pushPoint(item);
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
} else if (Array.isArray(data.points)) {
|
|
192
|
+
data.points.forEach(pushPoint);
|
|
193
|
+
}
|
|
194
|
+
return _objectSpread(_objectSpread({}, data), {}, {
|
|
195
|
+
points: points,
|
|
196
|
+
statistic: statistic,
|
|
197
|
+
grids: grids,
|
|
198
|
+
gridLevel: gridLevel
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// 绘制路线
|
|
203
|
+
}, {
|
|
204
|
+
key: "_createRoute",
|
|
205
|
+
value: function _createRoute() {
|
|
206
|
+
var _this = this;
|
|
207
|
+
if (!this.currentRoute || !Array.isArray(this.currentRoute.points) || !this.currentRoute.points.length) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// 规划管道
|
|
212
|
+
this.pipelinePlanningLayer = this.getMap().addGraphicLayer(lineString(this.currentRoute.points.map(function (point) {
|
|
213
|
+
return [point.lng, point.lat, point.alt];
|
|
214
|
+
})), {
|
|
215
|
+
type: 'polylineVolumeP',
|
|
216
|
+
style: {
|
|
217
|
+
// 圆截面
|
|
218
|
+
shapePositions: ShapeSection.circleSection(7.66 / 2, 48),
|
|
219
|
+
cornerType: Cesium.CornerType.ROUNDED,
|
|
220
|
+
color: 'rgba(0,255,255,0.85)'
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
var pointGeoJson = {
|
|
224
|
+
type: 'FeatureCollection',
|
|
225
|
+
features: this.currentRoute.points.map(function (point) {
|
|
226
|
+
return {
|
|
227
|
+
type: 'Feature',
|
|
228
|
+
geometry: {
|
|
229
|
+
type: 'Point',
|
|
230
|
+
coordinates: [point.lng, point.lat, point.alt]
|
|
231
|
+
},
|
|
232
|
+
properties: _objectSpread({}, point)
|
|
233
|
+
};
|
|
234
|
+
})
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
// 路线点位
|
|
238
|
+
this.routePointsLayer = this.getMap().addGraphicLayer(pointGeoJson, {
|
|
239
|
+
type: 'pointP',
|
|
240
|
+
style: {
|
|
241
|
+
pixelSize: 14,
|
|
242
|
+
color: function color(p) {
|
|
243
|
+
var typeKey = (p.type || '').toUpperCase();
|
|
244
|
+
return _this.options.TYPE_COLOR_MAP[typeKey] || '#38bdf8';
|
|
245
|
+
},
|
|
246
|
+
outlineColor: '#ffffff',
|
|
247
|
+
outlineWidth: 2,
|
|
248
|
+
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
// 路线点位标签
|
|
253
|
+
this.routePointsLabelLayer = this.getMap().addGraphicLayer(pointGeoJson, {
|
|
254
|
+
type: 'labelP',
|
|
255
|
+
style: {
|
|
256
|
+
text: function text(p) {
|
|
257
|
+
var _p$alt$toFixed, _p$alt;
|
|
258
|
+
var typeKey = (p.type || '').toUpperCase();
|
|
259
|
+
var displayType = _this.options.TYPE_LABEL_MAP[typeKey] || typeKey || 'POINT';
|
|
260
|
+
return "".concat(displayType, "\n ").concat((_p$alt$toFixed = (_p$alt = p.alt) === null || _p$alt === void 0 ? void 0 : _p$alt.toFixed(1)) !== null && _p$alt$toFixed !== void 0 ? _p$alt$toFixed : '-', " m");
|
|
261
|
+
},
|
|
262
|
+
font: '14px "Helvetica Neue", Arial, sans-serif',
|
|
263
|
+
fillColor: '#ffffff',
|
|
264
|
+
showBackground: true,
|
|
265
|
+
backgroundColor: 'rgba(0,0,0,0.55)',
|
|
266
|
+
pixelOffset: [0, -24],
|
|
267
|
+
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
|
|
268
|
+
disableDepthTestDistance: Number.POSITIVE_INFINITY
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
this.pipelinePlanningLayer.flyTo();
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// 清除路线
|
|
275
|
+
}, {
|
|
276
|
+
key: "_clearRoute",
|
|
277
|
+
value: function _clearRoute() {
|
|
278
|
+
if (!this._canOperate) return;
|
|
279
|
+
this.pipelinePlanningLayer && this.pipelinePlanningLayer.remove();
|
|
280
|
+
this.pipelinePlanningLayer = null;
|
|
281
|
+
this.routePointsLayer && this.routePointsLayer.remove();
|
|
282
|
+
this.routePointsLayer = null;
|
|
283
|
+
this.routePointsLabelLayer && this.routePointsLabelLayer.remove();
|
|
284
|
+
this.routePointsLabelLayer = null;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// 渲染路线网格
|
|
288
|
+
}, {
|
|
289
|
+
key: "_renderRouteGrids",
|
|
290
|
+
value: function _renderRouteGrids() {
|
|
291
|
+
var _this2 = this;
|
|
292
|
+
if (!this._canOperate) return;
|
|
293
|
+
|
|
294
|
+
// 清除之前的路线网格
|
|
295
|
+
this._clearRouteGrids();
|
|
296
|
+
if (!this.currentRoute || !Array.isArray(this.currentRoute.grids) || this.currentRoute.grids.length === 0) {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
var gridLevel = this.currentRoute.gridLevel || this.options.DEFAULT_GRID_LEVEL;
|
|
300
|
+
|
|
301
|
+
// 使用第一个网格的纬度来计算网格大小(如果网格数组为空,使用默认纬度)
|
|
302
|
+
var firstGrid = this.currentRoute.grids[0];
|
|
303
|
+
var latitude = firstGrid && typeof firstGrid.lat === 'number' ? firstGrid.lat : this.options.DEFAULT_LATITUDE;
|
|
304
|
+
var gridSize = this._getGridSizeByLevel(gridLevel, latitude);
|
|
305
|
+
var gridGeoJson = {
|
|
306
|
+
type: 'FeatureCollection',
|
|
307
|
+
features: this.currentRoute.grids.map(function (grid) {
|
|
308
|
+
var layerHeight = grid.alt || 0;
|
|
309
|
+
var centerHeight = _this2._calculateGridCenterHeight(layerHeight);
|
|
310
|
+
return {
|
|
311
|
+
type: 'Feature',
|
|
312
|
+
geometry: {
|
|
313
|
+
type: 'Point',
|
|
314
|
+
coordinates: [grid.lng, grid.lat, centerHeight],
|
|
315
|
+
properties: {
|
|
316
|
+
color: Cesium.Color.fromCssColorString(_this2._getColorByLayerHeight(layerHeight)).withAlpha(_this2.options.GRID_ALPHA)
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
})
|
|
321
|
+
};
|
|
322
|
+
this.routeGrid = new GridDraw(this.getMap(), gridGeoJson, {
|
|
323
|
+
dimensions: [gridSize, gridSize, this.options.GRID_HEIGHT_PER_LAYER],
|
|
324
|
+
translucent: true
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// 清除路线网格
|
|
329
|
+
}, {
|
|
330
|
+
key: "_clearRouteGrids",
|
|
331
|
+
value: function _clearRouteGrids() {
|
|
332
|
+
if (this.routeGrid) {
|
|
333
|
+
this.routeGrid.destroy();
|
|
334
|
+
this.routeGrid = null;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// 根据层高获取颜色
|
|
339
|
+
}, {
|
|
340
|
+
key: "_getColorByLayerHeight",
|
|
341
|
+
value: function _getColorByLayerHeight(layerHeight) {
|
|
342
|
+
var colorIndex = Math.min(Math.floor(layerHeight / this.options.COLOR_GROUP_SIZE), this.options.HEIGHT_COLORS.length - 1);
|
|
343
|
+
return this.options.HEIGHT_COLORS[colorIndex] || this.options.DEFAULT_GRID_COLOR;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// 计算网格中心高度
|
|
347
|
+
}, {
|
|
348
|
+
key: "_calculateGridCenterHeight",
|
|
349
|
+
value: function _calculateGridCenterHeight(layerHeight) {
|
|
350
|
+
var bottomHeight = layerHeight * this.options.GRID_HEIGHT_PER_LAYER;
|
|
351
|
+
var topHeight = (layerHeight + 1) * this.options.GRID_HEIGHT_PER_LAYER;
|
|
352
|
+
return (bottomHeight + topHeight) / 2;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// 根据网格级别和纬度计算网格大小
|
|
356
|
+
}, {
|
|
357
|
+
key: "_getGridSizeByLevel",
|
|
358
|
+
value: function _getGridSizeByLevel(gridLevel) {
|
|
359
|
+
var latitude = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.options.DEFAULT_LATITUDE;
|
|
360
|
+
if (gridLevel < 0 || gridLevel >= this.options.GRID_SIZES.length) {
|
|
361
|
+
console.warn("\u7F51\u683C\u7EA7\u522B ".concat(gridLevel, " \u8D85\u51FA\u8303\u56F4\uFF0C\u4F7F\u7528\u9ED8\u8BA4\u5927\u5C0F"));
|
|
362
|
+
return 100;
|
|
363
|
+
}
|
|
364
|
+
var gridSizeInSeconds = this.options.GRID_SIZES[gridLevel];
|
|
365
|
+
if (!gridSizeInSeconds || gridSizeInSeconds[0] === 0) {
|
|
366
|
+
console.warn("\u7F51\u683C\u7EA7\u522B ".concat(gridLevel, " \u65E0\u6548\uFF0C\u4F7F\u7528\u9ED8\u8BA4\u5927\u5C0F"));
|
|
367
|
+
return 100;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// 将秒转换为度
|
|
371
|
+
var lonPerCell = gridSizeInSeconds[0] / 3600;
|
|
372
|
+
var latPerCell = gridSizeInSeconds[1] / 3600;
|
|
373
|
+
|
|
374
|
+
// 计算经度和纬度方向的网格大小(米)
|
|
375
|
+
var lonSize = this._calculateSphericalDistance(latitude, lonPerCell, 0);
|
|
376
|
+
var latSize = this._calculateSphericalDistance(latitude, 0, latPerCell);
|
|
377
|
+
return (lonSize + latSize) / 2;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// 计算球面地理长度(米)
|
|
381
|
+
}, {
|
|
382
|
+
key: "_calculateSphericalDistance",
|
|
383
|
+
value: function _calculateSphericalDistance(centerLat) {
|
|
384
|
+
var deltaLongitude = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
385
|
+
var deltaLatitude = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
386
|
+
var earthRadius = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 6371008.8;
|
|
387
|
+
var latRad = centerLat * Math.PI / 180;
|
|
388
|
+
var deltaLonRad = deltaLongitude * Math.PI / 180;
|
|
389
|
+
var deltaLatRad = deltaLatitude * Math.PI / 180;
|
|
390
|
+
if (deltaLongitude === 0 && deltaLatitude !== 0) {
|
|
391
|
+
return Math.abs(deltaLatRad * earthRadius);
|
|
392
|
+
}
|
|
393
|
+
if (deltaLongitude !== 0 && deltaLatitude === 0) {
|
|
394
|
+
var latitudeCircleRadius = earthRadius * Math.cos(latRad);
|
|
395
|
+
return Math.abs(deltaLonRad * latitudeCircleRadius);
|
|
396
|
+
}
|
|
397
|
+
var endLatRad = latRad + deltaLatRad;
|
|
398
|
+
var dLat = deltaLatRad;
|
|
399
|
+
var dLon = deltaLonRad;
|
|
400
|
+
var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(latRad) * Math.cos(endLatRad) * Math.sin(dLon / 2) * Math.sin(dLon / 2);
|
|
401
|
+
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
|
402
|
+
return earthRadius * c;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// 清除
|
|
406
|
+
}, {
|
|
407
|
+
key: "clear",
|
|
408
|
+
value: function clear() {
|
|
409
|
+
if (!this._canOperate()) return;
|
|
410
|
+
this.currentRoute = null;
|
|
411
|
+
this._clearRoute();
|
|
412
|
+
this._clearRouteGrids();
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
// 销毁
|
|
416
|
+
}, {
|
|
417
|
+
key: "destroy",
|
|
418
|
+
value: function destroy() {
|
|
419
|
+
if (!this._canOperate()) return;
|
|
420
|
+
this.isDestroyed = true;
|
|
421
|
+
this.clear();
|
|
422
|
+
}
|
|
423
|
+
}]);
|
|
424
|
+
return FlightPlanning;
|
|
425
|
+
}();
|
|
426
|
+
export default FlightPlanning;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MapContext } from '../map/Map';
|
|
2
|
-
|
|
2
|
+
declare class GridDraw {
|
|
3
3
|
_mapContext: MapContext | undefined;
|
|
4
4
|
options: any;
|
|
5
5
|
primitives: any[];
|
|
@@ -16,3 +16,4 @@ export default class Airspace {
|
|
|
16
16
|
on(eventType: string, event: any): void;
|
|
17
17
|
destroy(): void;
|
|
18
18
|
}
|
|
19
|
+
export default GridDraw;
|
|
@@ -8,17 +8,17 @@ 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 { merge } from 'lodash';
|
|
11
|
-
import {
|
|
11
|
+
import { DEFAULT_GRID_STYLE } from "../constant";
|
|
12
12
|
import BaseSource from "../graphicLayer/BaseSource";
|
|
13
13
|
import BoxPrimitive from "../graphicLayer/BoxPrimitive";
|
|
14
14
|
import BoxPrimitiveInstance from "../graphicLayer/BoxPrimitiveInstance";
|
|
15
15
|
import * as utils from "../tool/utils";
|
|
16
16
|
|
|
17
|
-
//
|
|
18
|
-
var
|
|
19
|
-
function
|
|
17
|
+
// 网格绘制
|
|
18
|
+
var GridDraw = /*#__PURE__*/function () {
|
|
19
|
+
function GridDraw(map, geoJson) {
|
|
20
20
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
21
|
-
_classCallCheck(this,
|
|
21
|
+
_classCallCheck(this, GridDraw);
|
|
22
22
|
_defineProperty(this, "_mapContext", void 0);
|
|
23
23
|
_defineProperty(this, "options", void 0);
|
|
24
24
|
_defineProperty(this, "primitives", []);
|
|
@@ -26,10 +26,10 @@ var Airspace = /*#__PURE__*/function () {
|
|
|
26
26
|
_defineProperty(this, "_events", {});
|
|
27
27
|
_defineProperty(this, "_isShow", true);
|
|
28
28
|
this._mapContext = map._mapContext;
|
|
29
|
-
this.options = merge(
|
|
29
|
+
this.options = merge(DEFAULT_GRID_STYLE(), options);
|
|
30
30
|
this.startDraw(geoJson);
|
|
31
31
|
}
|
|
32
|
-
_createClass(
|
|
32
|
+
_createClass(GridDraw, [{
|
|
33
33
|
key: "getMap",
|
|
34
34
|
value: function getMap() {
|
|
35
35
|
return this._mapContext && this._mapContext.getMap();
|
|
@@ -132,6 +132,6 @@ var Airspace = /*#__PURE__*/function () {
|
|
|
132
132
|
this._events = {};
|
|
133
133
|
}
|
|
134
134
|
}]);
|
|
135
|
-
return
|
|
135
|
+
return GridDraw;
|
|
136
136
|
}();
|
|
137
|
-
export
|
|
137
|
+
export default GridDraw;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare class PoiLayer {
|
|
2
|
+
private readonly _mapContext;
|
|
3
|
+
isDestroyed: boolean;
|
|
4
|
+
options: any;
|
|
5
|
+
poiLayer: any;
|
|
6
|
+
constructor(map: any, options?: any);
|
|
7
|
+
private _canOperate;
|
|
8
|
+
getMap(): any;
|
|
9
|
+
private _create;
|
|
10
|
+
show(isShow: boolean): void;
|
|
11
|
+
destroy(): void;
|
|
12
|
+
}
|
|
13
|
+
export default PoiLayer;
|