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.
Files changed (35) hide show
  1. package/dist/esm/analyze/ViewshedAnalysis.d.ts +8 -8
  2. package/dist/esm/analyze/ViewshedAnalysis.js +76 -90
  3. package/dist/esm/constant.d.ts +44 -6
  4. package/dist/esm/constant.js +86 -7
  5. package/dist/esm/deepTwins/index.js +2 -1
  6. package/dist/esm/drawer/index.d.ts +1 -1
  7. package/dist/esm/index.d.ts +4 -1
  8. package/dist/esm/index.js +12 -5
  9. package/dist/esm/lowAltitude/BarrierLayer.d.ts +29 -0
  10. package/dist/esm/{tileLayer → lowAltitude}/BarrierLayer.js +39 -165
  11. package/dist/esm/lowAltitude/BaseGridMvtLayer.d.ts +34 -0
  12. package/dist/esm/lowAltitude/BaseGridMvtLayer.js +122 -0
  13. package/dist/esm/lowAltitude/FlightPlanning.d.ts +27 -0
  14. package/dist/esm/lowAltitude/FlightPlanning.js +411 -0
  15. package/dist/esm/lowAltitude/FlightRiskEvaluation.d.ts +0 -0
  16. package/dist/esm/lowAltitude/FlightRiskEvaluation.js +383 -0
  17. package/dist/esm/{visualization/Airspace.d.ts → lowAltitude/GridDraw.d.ts} +2 -1
  18. package/dist/esm/{visualization/Airspace.js → lowAltitude/GridDraw.js} +9 -9
  19. package/dist/esm/lowAltitude/PoiLayer.d.ts +13 -0
  20. package/dist/esm/lowAltitude/PoiLayer.js +74 -0
  21. package/dist/esm/lowAltitude/VisitLayer.d.ts +26 -0
  22. package/dist/esm/lowAltitude/VisitLayer.js +180 -0
  23. package/dist/esm/map/Map.js +3 -3
  24. package/dist/esm/tool/common.d.ts +2 -1
  25. package/dist/esm/tool/common.js +14 -2
  26. package/dist/esm/tool/fetch.d.ts +51 -0
  27. package/dist/esm/tool/fetch.js +222 -0
  28. package/dist/esm/videoFusion/BaseVideo.d.ts +1 -1
  29. package/dist/esm/videoFusion/BaseVideo.js +47 -2
  30. package/dist/esm/videoFusion/VideoProject.js +3 -0
  31. package/dist/esm/videoFusion/VideoTexture.js +3 -0
  32. package/dist/esm/visualization/FrustumWithCamera.js +10 -8
  33. package/dist/umd/deeptwins-engine-3d.min.js +1 -1
  34. package/package.json +2 -2
  35. package/dist/esm/tileLayer/BarrierLayer.d.ts +0 -76
@@ -0,0 +1,383 @@
1
+ // import { flatten, getCoords } from '@turf/turf';
2
+ // import Cesium from 'deeptwins-cesium';
3
+ // import { merge } from 'lodash';
4
+ // import { DEFAULT_GRID_VT_OPTIONS } from '../constant';
5
+ // import { MapContext } from '../map/Map';
6
+ // import { ShapeSection, translateSource } from '../tool/common';
7
+ // import fetch from '../tool/fetch';
8
+ // import * as utils from '../tool/utils';
9
+ //
10
+ // const API_HOST = 'https://els-yunjing.amap.com';
11
+ // const API_KEY = 'd1dc38f19b7bfc453e870a80be359cd5';
12
+ // // 接口定义 - 明确各接口职责
13
+ // const POINT_EVALUATION_URL = `${API_HOST}/data/risk/evaluation/point?key=${API_KEY}`; // 风险点评估接口 - 用于创建风险点标记
14
+ // const SEGMENT_EVALUATION_URL = `${API_HOST}/data/risk/evaluation/segment?key=${API_KEY}`; // 航段评估接口 - 用于管道颜色和绘制
15
+ // const ROUTE_EVALUATION_URL = `${API_HOST}/data/risk/evaluation/route?key=${API_KEY}`; // 航线评估接口 - 用于右侧面板数据
16
+ // const GRID_RENDER_URL = `${API_HOST}/data/grid/render?key=${API_KEY}`; // 网格渲染接口 - 用于航迹点网格
17
+ //
18
+ // const TYPE_COLOR_MAP = {
19
+ // START: '#00ff00',
20
+ // END: '#ff0000',
21
+ // }; // 点位颜色
22
+ // const TYPE_LABEL_MAP = {
23
+ // START: '起点',
24
+ // END: '终点',
25
+ // }; // 点位名称
26
+ //
27
+ // // 航线风险评估
28
+ // class FlightRiskEvaluation {
29
+ // private readonly _mapContext: MapContext;
30
+ // public isDestroyed: boolean = false;
31
+ // public options: any = {};
32
+ // // 路线数据
33
+ // public routeSource: any = null;
34
+ // // 路线点位
35
+ // public routePointsLayer: any = null;
36
+ // // 路线点位文字
37
+ // public routePointsLabelLayer: any = null;
38
+ // // 规划管道
39
+ // public routePipelineLayer: any = null;
40
+ //
41
+ // constructor(map: any, options: any = {}) {
42
+ // this._mapContext = map._mapContext;
43
+ // this.options = merge(DEFAULT_GRID_VT_OPTIONS(), options);
44
+ // }
45
+ //
46
+ // // 是否能进行操作
47
+ // private _canOperate() {
48
+ // if (this.isDestroyed) {
49
+ // utils.error('SubmergenceAnalysis实例已销毁');
50
+ // return false;
51
+ // }
52
+ // return true;
53
+ // }
54
+ //
55
+ // public getMap() {
56
+ // return this._mapContext && this._mapContext.getMap();
57
+ // }
58
+ //
59
+ // // 开始评估
60
+ // public async start(
61
+ // geoJson: any = {
62
+ // type: 'Feature',
63
+ // geometry: {
64
+ // type: 'LineString',
65
+ // coordinates: [
66
+ // [114.269292, 22.692453, 95.75],
67
+ // [114.26916666666668, 22.693055555555556, 95.75],
68
+ // [114.27083333333334, 22.69472222222222, 95.75],
69
+ // [114.2713888888889, 22.69527777777778, 118.73],
70
+ // [114.27861111111112, 22.7025, 118.73],
71
+ // [114.28861111111111, 22.7025, 126.39],
72
+ // [114.28972222222222, 22.703611111111112, 118.73],
73
+ // [114.29583333333333, 22.703611111111112, 118.73],
74
+ // [114.302994, 22.707242, 80],
75
+ // [114.292009, 22.72269, 80],
76
+ // [114.27916666666667, 22.733055555555556, 80.43],
77
+ // [114.27665, 22.73299, 80],
78
+ // ],
79
+ // },
80
+ // },
81
+ // ) {
82
+ // if (!this._canOperate()) return;
83
+ // const translatedSource = translateSource(geoJson);
84
+ // this.routeSource = flatten(translatedSource);
85
+ // const points: any[] = [];
86
+ // this.routeSource.features.forEach((feature: any) => {
87
+ // const coords = getCoords(feature);
88
+ // points.push(
89
+ // ...coords.map((t: any) => ({ lng: t[0], lat: t[1], alt: t[2] || 0 })),
90
+ // );
91
+ // });
92
+ //
93
+ // const [
94
+ // { data: pointEvaluationData },
95
+ // { data: segmentEvaluationData },
96
+ // { data: routeEvaluationData },
97
+ // ] = await Promise.all([
98
+ // fetch.post(POINT_EVALUATION_URL, { points }),
99
+ // fetch.post(SEGMENT_EVALUATION_URL, { points }),
100
+ // fetch.post(ROUTE_EVALUATION_URL, { points }),
101
+ // ]);
102
+ // this._createRoute();
103
+ // console.log(
104
+ // pointEvaluationData,
105
+ // segmentEvaluationData,
106
+ // routeEvaluationData,
107
+ // );
108
+ // }
109
+ //
110
+ // // 创建航线(起点、终点、基础管道)
111
+ // private _createRoute() {
112
+ // if (!this._canOperate) return;
113
+ // this._clearRoute();
114
+ // const pointGeoJson: any = {
115
+ // type: 'FeatureCollection',
116
+ // features: [],
117
+ // };
118
+ // this.routeSource.features.forEach((feature: any, index: number) => {
119
+ // if (!index) {
120
+ // pointGeoJson.features.push({
121
+ // ...feature,
122
+ // properties: {
123
+ // ...feature.properties,
124
+ // text: TYPE_LABEL_MAP.START,
125
+ // color: TYPE_COLOR_MAP.START,
126
+ // },
127
+ // });
128
+ // }
129
+ // if (index === this.routeSource.features.length - 1) {
130
+ // pointGeoJson.features.push({
131
+ // ...feature,
132
+ // properties: {
133
+ // ...feature.properties,
134
+ // text: TYPE_LABEL_MAP.END,
135
+ // color: TYPE_COLOR_MAP.END,
136
+ // },
137
+ // });
138
+ // }
139
+ // });
140
+ // // 路线点位
141
+ // this.routePointsLayer = this.getMap().addGraphicLayer(pointGeoJson, {
142
+ // type: 'pointP',
143
+ // style: {
144
+ // pixelSize: 20,
145
+ // color: (p: any) => p.color,
146
+ // outlineColor: '#ffffff',
147
+ // outlineWidth: 3,
148
+ // disableDepthTestDistance: Number.POSITIVE_INFINITY,
149
+ // },
150
+ // });
151
+ // // 路线点位标签
152
+ // this.routePointsLabelLayer = this.getMap().addGraphicLayer(pointGeoJson, {
153
+ // type: 'labelP',
154
+ // style: {
155
+ // text: (p: any) => p.text,
156
+ // font: '16px "Microsoft YaHei", Arial, sans-serif',
157
+ // fillColor: '#ffffff',
158
+ // showBackground: true,
159
+ // backgroundColor: 'rgba(0,0,0,0.55)',
160
+ // pixelOffset: [0, -30],
161
+ // verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
162
+ // disableDepthTestDistance: Number.POSITIVE_INFINITY,
163
+ // },
164
+ // });
165
+ // // 路线管道
166
+ // this.routePipelineLayer = this.getMap().addGraphicLayer(this.routeSource, {
167
+ // type: 'polylineVolumeP',
168
+ // style: {
169
+ // // 圆截面
170
+ // shapePositions: ShapeSection.circleSection(6, 48),
171
+ // cornerType: Cesium.CornerType.ROUNDED,
172
+ // color: 'rgba(0,255,255,0.85)',
173
+ // },
174
+ // });
175
+ // }
176
+ //
177
+ // // 销毁航线
178
+ // private _clearRoute() {
179
+ // if (!this._canOperate) return;
180
+ // this.routePipelineLayer && this.routePipelineLayer.remove();
181
+ // this.routePipelineLayer = null;
182
+ // this.routePointsLayer && this.routePointsLayer.remove();
183
+ // this.routePointsLayer = null;
184
+ // this.routePointsLabelLayer && this.routePointsLabelLayer.remove();
185
+ // this.routePointsLabelLayer = null;
186
+ // }
187
+ //
188
+ // // 获取航段颜色使用segment接口返回的数据)
189
+ // getSegmentColorFromEvaluation(evaluation: any) {
190
+ // const confidence = evaluation?.confidence;
191
+ // if (confidence == null) return Cesium.Color.fromCssColorString('#06b6d4');
192
+ // if (confidence < 0) return Cesium.Color.fromCssColorString('#ef4444');
193
+ // if (confidence < 0.5) return Cesium.Color.fromCssColorString('#f59e0b');
194
+ // return Cesium.Color.fromCssColorString('#10b981');
195
+ // }
196
+ //
197
+ // // 创建航线实体(起点、终点、基础管道)
198
+ // // 注意:管道颜色由updateSegmentColors根据segment接口数据更新
199
+ // // 风险点标记由point接口数据创建
200
+ // private _createRouteEntity() {
201
+ // selectedSegmentEntity = null;
202
+ //
203
+ // if (route.length < 2) return;
204
+ //
205
+ // // 风险点聚合函数:将相近位置的风险点聚合在一起
206
+ // // threshold: 聚合距离阈值(度),默认0.0005度(约55米)
207
+ // function clusterRiskPoints(riskPointsData, threshold = 0.0005) {
208
+ // const clusters = [];
209
+ // const processed = new Set();
210
+ //
211
+ // riskPointsData.forEach((point, idx) => {
212
+ // if (processed.has(idx)) return;
213
+ //
214
+ // const cluster = {
215
+ // points: [point],
216
+ // indices: [idx],
217
+ // centerLng: point.lng,
218
+ // centerLat: point.lat,
219
+ // centerAlt: point.alt,
220
+ // totalRiskCount: point.riskCount,
221
+ // maxRiskCount: point.riskCount,
222
+ // evaluations: [point.evaluation],
223
+ // };
224
+ //
225
+ // // 查找相近的风险点
226
+ // riskPointsData.forEach((otherPoint, otherIdx) => {
227
+ // if (idx === otherIdx || processed.has(otherIdx)) return;
228
+ //
229
+ // const distance = Math.sqrt(
230
+ // Math.pow(point.lng - otherPoint.lng, 2) +
231
+ // Math.pow(point.lat - otherPoint.lat, 2),
232
+ // );
233
+ //
234
+ // if (distance < threshold) {
235
+ // cluster.points.push(otherPoint);
236
+ // cluster.indices.push(otherIdx);
237
+ // processed.add(otherIdx);
238
+ //
239
+ // // 更新聚合中心(使用平均值)
240
+ // cluster.centerLng =
241
+ // cluster.points.reduce((sum, p) => sum + p.lng, 0) /
242
+ // cluster.points.length;
243
+ // cluster.centerLat =
244
+ // cluster.points.reduce((sum, p) => sum + p.lat, 0) /
245
+ // cluster.points.length;
246
+ // cluster.centerAlt =
247
+ // cluster.points.reduce((sum, p) => sum + p.alt, 0) /
248
+ // cluster.points.length;
249
+ //
250
+ // // 累加风险数量
251
+ // cluster.totalRiskCount += otherPoint.riskCount;
252
+ // if (otherPoint.riskCount > cluster.maxRiskCount) {
253
+ // cluster.maxRiskCount = otherPoint.riskCount;
254
+ // }
255
+ // cluster.evaluations.push(otherPoint.evaluation);
256
+ // }
257
+ // });
258
+ //
259
+ // processed.add(idx);
260
+ // clusters.push(cluster);
261
+ // });
262
+ //
263
+ // return clusters;
264
+ // }
265
+ //
266
+ // // 创建风险点标记(使用point接口数据)
267
+ // // 先聚合密集的风险点,然后显示聚合后的点
268
+ // riskPoints = [];
269
+ // const allRiskPoints = [];
270
+ //
271
+ // if (pointEvaluationData?.length) {
272
+ // // 第一步:收集所有风险点
273
+ // pointEvaluationData.forEach((item, idx) => {
274
+ // if (item.riskCount > 0) {
275
+ // const { lon, lat, alt, code } = item.grid;
276
+ // const pointAlt = alt;
277
+ // const evaluation = item.evaluation;
278
+ //
279
+ // const riskPoint = {
280
+ // index: idx,
281
+ // lng: lon,
282
+ // lat: lat,
283
+ // alt: pointAlt, // 网格高度(来自grid.alt)
284
+ // riskCount: item.riskCount,
285
+ // evaluation: evaluation,
286
+ // gridCode: code, // 网格code
287
+ // };
288
+ // allRiskPoints.push(riskPoint);
289
+ // }
290
+ // });
291
+ //
292
+ // // 第二步:聚合风险点
293
+ // const clusters = clusterRiskPoints(allRiskPoints, 0.005); // 约55米聚合距离
294
+ //
295
+ // // 第三步:渲染聚合后的风险点
296
+ // clusters.forEach((cluster, clusterIdx) => {
297
+ // const isClustered = cluster.points.length > 1;
298
+ // const displayHeight = cluster.centerAlt + 20; // 管道上方20米
299
+ //
300
+ // const clusterData = {
301
+ // index: clusterIdx,
302
+ // lng: cluster.centerLng,
303
+ // lat: cluster.centerLat,
304
+ // alt: cluster.centerAlt,
305
+ // displayHeight: displayHeight,
306
+ // riskCount: cluster.totalRiskCount,
307
+ // pointCount: cluster.points.length, // 聚合的点数量
308
+ // isClustered: isClustered,
309
+ // points: cluster.points, // 包含的所有风险点
310
+ // evaluation: cluster.evaluations[0], // 使用第一个点的评估数据
311
+ // };
312
+ //
313
+ // riskPoints.push(clusterData);
314
+ //
315
+ // // 创建聚合风险点标记
316
+ // // 如果是聚合点,使用更大的标记和不同的颜色
317
+ // const markerSize = isClustered ? 50 : 40;
318
+ // const markerColor = isClustered ? '#ef4444' : '#f59e0b'; // 聚合点用红色,单点用黄色
319
+ // const markerText = isClustered ? cluster.points.length : '!';
320
+ //
321
+ // viewer.entities.add({
322
+ // name: `风险点-${clusterIdx}${isClustered ? '-聚合' : ''}`,
323
+ // position: CesiumNS.Cartesian3.fromDegrees(
324
+ // cluster.centerLng,
325
+ // cluster.centerLat,
326
+ // displayHeight,
327
+ // ),
328
+ // billboard: {
329
+ // image:
330
+ // 'data:image/svg+xml;base64,' +
331
+ // btoa(
332
+ // '<svg width="' +
333
+ // markerSize +
334
+ // '" height="' +
335
+ // markerSize +
336
+ // '" xmlns="http://www.w3.org/2000/svg">' +
337
+ // '<circle cx="' +
338
+ // markerSize / 2 +
339
+ // '" cy="' +
340
+ // markerSize / 2 +
341
+ // '" r="' +
342
+ // (markerSize / 2 - 2) +
343
+ // '" fill="' +
344
+ // markerColor +
345
+ // '" stroke="#fff" stroke-width="2"/>' +
346
+ // '<text x="' +
347
+ // markerSize / 2 +
348
+ // '" y="' +
349
+ // (markerSize / 2 + 6) +
350
+ // '" font-size="' +
351
+ // (isClustered ? '14' : '16') +
352
+ // '" font-weight="bold" fill="#fff" text-anchor="middle">' +
353
+ // markerText +
354
+ // '</text>' +
355
+ // '</svg>',
356
+ // ),
357
+ // scale: 1.0,
358
+ // disableDepthTestDistance: Number.POSITIVE_INFINITY,
359
+ // },
360
+ // label: {
361
+ // text: `${cluster.totalRiskCount}`,
362
+ // font: '12px Arial',
363
+ // fillColor: CesiumNS.Color.WHITE,
364
+ // showBackground: true,
365
+ // backgroundColor: isClustered
366
+ // ? CesiumNS.Color.RED
367
+ // : CesiumNS.Color.ORANGE,
368
+ // pixelOffset: new CesiumNS.Cartesian2(
369
+ // markerSize / 2,
370
+ // -markerSize / 2 - 10,
371
+ // ),
372
+ // verticalOrigin: CesiumNS.VerticalOrigin.TOP,
373
+ // horizontalOrigin: CesiumNS.HorizontalOrigin.LEFT,
374
+ // disableDepthTestDistance: Number.POSITIVE_INFINITY,
375
+ // },
376
+ // riskPointData: clusterData,
377
+ // });
378
+ // });
379
+ // }
380
+ // }
381
+ // }
382
+ //
383
+ // export default FlightRiskEvaluation;
@@ -1,5 +1,5 @@
1
1
  import { MapContext } from '../map/Map';
2
- export default class Airspace {
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 { DEFAULT_AIRSPACE_STYLE } from "../constant";
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 Airspace = /*#__PURE__*/function () {
19
- function Airspace(map, geoJson) {
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, Airspace);
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(DEFAULT_AIRSPACE_STYLE(), options);
29
+ this.options = merge(DEFAULT_GRID_STYLE(), options);
30
30
  this.startDraw(geoJson);
31
31
  }
32
- _createClass(Airspace, [{
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 Airspace;
135
+ return GridDraw;
136
136
  }();
137
- export { Airspace as default };
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;
@@ -0,0 +1,74 @@
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 * as utils from "../tool/utils";
9
+ var PoiLayer = /*#__PURE__*/function () {
10
+ function PoiLayer(map) {
11
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
12
+ _classCallCheck(this, PoiLayer);
13
+ _defineProperty(this, "_mapContext", void 0);
14
+ _defineProperty(this, "isDestroyed", false);
15
+ _defineProperty(this, "options", {});
16
+ _defineProperty(this, "poiLayer", null);
17
+ this._mapContext = map._mapContext;
18
+ this.options = options;
19
+ if (!options.poiLayer) {
20
+ utils.error('请提供poiLayer参数,可通过DeepTwins.onLoad获取');
21
+ return;
22
+ }
23
+ this._create();
24
+ }
25
+
26
+ // 是否能进行操作
27
+ _createClass(PoiLayer, [{
28
+ key: "_canOperate",
29
+ value: function _canOperate() {
30
+ if (this.isDestroyed) {
31
+ utils.error('SubmergenceAnalysis实例已销毁');
32
+ return false;
33
+ }
34
+ return true;
35
+ }
36
+ }, {
37
+ key: "getMap",
38
+ value: function getMap() {
39
+ return this._mapContext && this._mapContext.getMap();
40
+ }
41
+ }, {
42
+ key: "_create",
43
+ value: function _create() {
44
+ if (!this._canOperate()) return;
45
+ var YunJingPoiLayer = this.options.poiLayer;
46
+ var layer = new YunJingPoiLayer({
47
+ viewer: this.getMap(),
48
+ poiTileset: this.options.poiTileset,
49
+ roadTileset: this.options.roadTileset
50
+ });
51
+ this.poiLayer = this.getMap().scene.primitives.add(layer);
52
+ }
53
+ }, {
54
+ key: "show",
55
+ value: function show(isShow) {
56
+ if (!this._canOperate()) return;
57
+ if (this.poiLayer) {
58
+ this.poiLayer.show = isShow;
59
+ }
60
+ }
61
+ }, {
62
+ key: "destroy",
63
+ value: function destroy() {
64
+ if (!this._canOperate()) return;
65
+ this.isDestroyed = true;
66
+ if (this.poiLayer) {
67
+ this.getMap().scene.primitives.remove(this.poiLayer);
68
+ this.poiLayer = null;
69
+ }
70
+ }
71
+ }]);
72
+ return PoiLayer;
73
+ }();
74
+ export default PoiLayer;
@@ -0,0 +1,26 @@
1
+ import BaseGridMvtLayer from './BaseGridMvtLayer';
2
+ declare class VisitLayer extends BaseGridMvtLayer {
3
+ constructor(map: any, options?: any);
4
+ /**
5
+ * 创建primitives
6
+ * 按照示例代码的逻辑实现,每个feature创建一个障碍物实例
7
+ */
8
+ private _createPrimitives;
9
+ /**
10
+ * 销毁primitives
11
+ */
12
+ private _destroyPrimitives;
13
+ /**
14
+ * 显示primitives
15
+ */
16
+ private _showPrimitives;
17
+ /**
18
+ * 隐藏primitives
19
+ */
20
+ private _hidePrimitives;
21
+ /**
22
+ * 更新primitives
23
+ */
24
+ private _updatePrimitives;
25
+ }
26
+ export default VisitLayer;