deeptwins-engine-3d 0.1.45 → 0.1.47

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.
@@ -168,6 +168,21 @@ export declare const DEFAULT_FLIGHT_PLANNING_OPTIONS: () => {
168
168
  TASKEND: string;
169
169
  };
170
170
  };
171
+ export declare const DEFAULT_FLIGHT_RISK_EVALUATION_OPTIONS: () => {
172
+ isDraw: boolean;
173
+ TYPE_LABEL_MAP: {
174
+ START: string;
175
+ END: string;
176
+ };
177
+ TYPE_COLOR_MAP: {
178
+ START: string;
179
+ END: string;
180
+ };
181
+ segmentGradeColor: {
182
+ num: number;
183
+ color: string;
184
+ }[];
185
+ };
171
186
  export declare const DEFAULT_SUBMERGENCE_ANALYSIS_OPTIONS: () => {
172
187
  startHeight: number;
173
188
  targetHeight: number;
@@ -281,6 +281,35 @@ export var DEFAULT_FLIGHT_PLANNING_OPTIONS = function DEFAULT_FLIGHT_PLANNING_OP
281
281
  };
282
282
  };
283
283
 
284
+ // 默认航线风险评估配置选项
285
+ export var DEFAULT_FLIGHT_RISK_EVALUATION_OPTIONS = function DEFAULT_FLIGHT_RISK_EVALUATION_OPTIONS() {
286
+ return {
287
+ isDraw: true,
288
+ // 是否绘制
289
+ // 点位名称
290
+ TYPE_LABEL_MAP: {
291
+ START: '起点',
292
+ END: '终点'
293
+ },
294
+ // 点位颜色
295
+ TYPE_COLOR_MAP: {
296
+ START: '#00ff00',
297
+ END: '#ff0000'
298
+ },
299
+ // 航段颜色等级
300
+ segmentGradeColor: [{
301
+ num: -Number.NEGATIVE_INFINITY,
302
+ color: 'rgba(239,68,68,0.95)'
303
+ }, {
304
+ num: 0,
305
+ color: 'rgba(245,158,11,0.95)'
306
+ }, {
307
+ num: 0.5,
308
+ color: 'rgba(16,185,129,0.95)'
309
+ }]
310
+ };
311
+ };
312
+
284
313
  // 默认淹没分析配置选项 SubmergenceAnalysis
285
314
  export var DEFAULT_SUBMERGENCE_ANALYSIS_OPTIONS = function DEFAULT_SUBMERGENCE_ANALYSIS_OPTIONS() {
286
315
  return {
package/dist/esm/index.js CHANGED
@@ -58,11 +58,11 @@ DEEP_TWINS_BASE_URL && (window.CESIUM_BASE_URL = DEEP_TWINS_BASE_URL);
58
58
  // 全局加载css
59
59
  loadCss(Cesium.buildModuleUrl('Widgets/widgets.css'));
60
60
  // 打印版本信息
61
- console.log('DeepTwinsEngine3D Version:', "0.1.45");
61
+ console.log('DeepTwinsEngine3D Version:', "0.1.47");
62
62
  export var DeepTwinsEngine3D = /*#__PURE__*/_createClass(function DeepTwinsEngine3D() {
63
63
  _classCallCheck(this, DeepTwinsEngine3D);
64
64
  });
65
- _defineProperty(DeepTwinsEngine3D, "Version", "0.1.45");
65
+ _defineProperty(DeepTwinsEngine3D, "Version", "0.1.47");
66
66
  _defineProperty(DeepTwinsEngine3D, "Map", Map);
67
67
  _defineProperty(DeepTwinsEngine3D, "GroundSkyBox", GroundSkyBox);
68
68
  _defineProperty(DeepTwinsEngine3D, "RasterLayer", RasterLayer);
@@ -60,7 +60,7 @@ var BaseGridMvtLayer = /*#__PURE__*/function () {
60
60
  key: "_canOperate",
61
61
  value: function _canOperate() {
62
62
  if (this.isDestroyed) {
63
- utils.error('SubmergenceAnalysis实例已销毁');
63
+ utils.error('BaseGridMvtLayer实例已销毁');
64
64
  return false;
65
65
  }
66
66
  return true;
@@ -10,7 +10,7 @@ declare class FlightPlanning {
10
10
  constructor(map: any, options: any);
11
11
  private _canOperate;
12
12
  getMap(): any;
13
- createPlan(value: any): Promise<any>;
13
+ create(value: any): Promise<any>;
14
14
  private _buildPayload;
15
15
  private _normalizeRouteData;
16
16
  private _createRoute;
@@ -42,7 +42,7 @@ var FlightPlanning = /*#__PURE__*/function () {
42
42
  key: "_canOperate",
43
43
  value: function _canOperate() {
44
44
  if (this.isDestroyed) {
45
- utils.error('SubmergenceAnalysis实例已销毁');
45
+ utils.error('FlightPlanning实例已销毁');
46
46
  return false;
47
47
  }
48
48
  return true;
@@ -55,9 +55,9 @@ var FlightPlanning = /*#__PURE__*/function () {
55
55
 
56
56
  // 生成计划
57
57
  }, {
58
- key: "createPlan",
58
+ key: "create",
59
59
  value: function () {
60
- var _createPlan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(value) {
60
+ var _create = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(value) {
61
61
  var payload, _yield$fetch$post, result, normalized, hasPoints;
62
62
  return _regeneratorRuntime().wrap(function _callee$(_context) {
63
63
  while (1) switch (_context.prev = _context.next) {
@@ -102,10 +102,10 @@ var FlightPlanning = /*#__PURE__*/function () {
102
102
  }
103
103
  }, _callee, this);
104
104
  }));
105
- function createPlan(_x) {
106
- return _createPlan.apply(this, arguments);
105
+ function create(_x) {
106
+ return _create.apply(this, arguments);
107
107
  }
108
- return createPlan;
108
+ return create;
109
109
  }()
110
110
  }, {
111
111
  key: "_buildPayload",
@@ -10,10 +10,18 @@ declare class FlightRiskEvaluation {
10
10
  riskPointsLayer: any;
11
11
  riskPointsLabelLayer: any;
12
12
  gridsLayer: any;
13
+ private _onClickSegmentEvent;
14
+ private _onClickRiskPointEvent;
15
+ private _onClickRiskPointLabelEvent;
13
16
  constructor(map: any, options?: any);
14
17
  private _canOperate;
15
18
  getMap(): any;
16
- start(geoJson?: any): Promise<void>;
19
+ start(geoJson: any): Promise<{
20
+ pointEvaluationData: any;
21
+ segmentEvaluationData: any;
22
+ routeEvaluationData: any;
23
+ gridData: any;
24
+ } | undefined>;
17
25
  private _createRoute;
18
26
  private _clearRoute;
19
27
  private _getSegmentColorFromEvaluation;
@@ -21,6 +29,7 @@ declare class FlightRiskEvaluation {
21
29
  private _createRiskPoints;
22
30
  private _clearRiskPoints;
23
31
  private _createGrids;
32
+ clear(): void;
24
33
  destroy(): void;
25
34
  }
26
35
  export default FlightRiskEvaluation;
@@ -26,27 +26,11 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
26
26
  import { flatten, getCoords } from '@turf/turf';
27
27
  import * as Cesium from 'deeptwins-cesium';
28
28
  import { merge } from 'lodash';
29
- import { DEFAULT_GRID_VT_OPTIONS, LAYER_EVENT_TYPE } from "../constant";
29
+ import { DEFAULT_FLIGHT_RISK_EVALUATION_OPTIONS, LAYER_EVENT_TYPE } from "../constant";
30
30
  import BaseSource from "../graphicLayer/BaseSource";
31
31
  import { ShapeSection, translateSource } from "../tool/common";
32
32
  import fetch from "../tool/fetch";
33
33
  import * as utils from "../tool/utils";
34
- var API_HOST = 'https://els-yunjing.amap.com';
35
- var API_KEY = 'd1dc38f19b7bfc453e870a80be359cd5';
36
- // 接口定义 - 明确各接口职责
37
- var POINT_EVALUATION_URL = "".concat(API_HOST, "/data/risk/evaluation/point?key=").concat(API_KEY); // 风险点评估接口 - 用于创建风险点标记
38
- var SEGMENT_EVALUATION_URL = "".concat(API_HOST, "/data/risk/evaluation/segment?key=").concat(API_KEY); // 航段评估接口 - 用于管道颜色和绘制
39
- var ROUTE_EVALUATION_URL = "".concat(API_HOST, "/data/risk/evaluation/route?key=").concat(API_KEY); // 航线评估接口 - 用于右侧面板数据
40
- var GRID_RENDER_URL = "".concat(API_HOST, "/data/grid/render?key=").concat(API_KEY); // 网格渲染接口 - 用于航迹点网格
41
-
42
- var TYPE_COLOR_MAP = {
43
- START: '#00ff00',
44
- END: '#ff0000'
45
- }; // 点位颜色
46
- var TYPE_LABEL_MAP = {
47
- START: '起点',
48
- END: '终点'
49
- }; // 点位名称
50
34
 
51
35
  // 航线风险评估
52
36
  var FlightRiskEvaluation = /*#__PURE__*/function () {
@@ -72,8 +56,14 @@ var FlightRiskEvaluation = /*#__PURE__*/function () {
72
56
  _defineProperty(this, "riskPointsLabelLayer", null);
73
57
  // 网格
74
58
  _defineProperty(this, "gridsLayer", null);
59
+ // 点击航线段事件
60
+ _defineProperty(this, "_onClickSegmentEvent", null);
61
+ // 点击风险点事件
62
+ _defineProperty(this, "_onClickRiskPointEvent", null);
63
+ // 点击风险点文字事件
64
+ _defineProperty(this, "_onClickRiskPointLabelEvent", null);
75
65
  this._mapContext = map._mapContext;
76
- this.options = merge(DEFAULT_GRID_VT_OPTIONS(), options);
66
+ this.options = merge(DEFAULT_FLIGHT_RISK_EVALUATION_OPTIONS(), options);
77
67
  }
78
68
 
79
69
  // 是否能进行操作
@@ -81,7 +71,7 @@ var FlightRiskEvaluation = /*#__PURE__*/function () {
81
71
  key: "_canOperate",
82
72
  value: function _canOperate() {
83
73
  if (this.isDestroyed) {
84
- utils.error('SubmergenceAnalysis实例已销毁');
74
+ utils.error('FlightRiskEvaluation实例已销毁');
85
75
  return false;
86
76
  }
87
77
  return true;
@@ -96,33 +86,17 @@ var FlightRiskEvaluation = /*#__PURE__*/function () {
96
86
  }, {
97
87
  key: "start",
98
88
  value: function () {
99
- var _start = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
100
- var geoJson,
101
- translatedSource,
102
- points,
103
- _yield$Promise$all,
104
- _yield$Promise$all2,
105
- pointEvaluationData,
106
- segmentEvaluationData,
107
- routeEvaluationData,
108
- gridData,
109
- _args = arguments;
89
+ var _start = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(geoJson) {
90
+ var translatedSource, points, _yield$Promise$all, _yield$Promise$all2, pointEvaluationData, segmentEvaluationData, routeEvaluationData, gridData;
110
91
  return _regeneratorRuntime().wrap(function _callee$(_context) {
111
92
  while (1) switch (_context.prev = _context.next) {
112
93
  case 0:
113
- geoJson = _args.length > 0 && _args[0] !== undefined ? _args[0] : {
114
- type: 'Feature',
115
- geometry: {
116
- type: 'LineString',
117
- coordinates: [[114.269292, 22.692453, 95.75], [114.26916666666668, 22.693055555555556, 95.75], [114.27083333333334, 22.69472222222222, 95.75], [114.2713888888889, 22.69527777777778, 118.73], [114.27861111111112, 22.7025, 118.73], [114.28861111111111, 22.7025, 126.39], [114.28972222222222, 22.703611111111112, 118.73], [114.29583333333333, 22.703611111111112, 118.73], [114.302994, 22.707242, 80], [114.292009, 22.72269, 80], [114.27916666666667, 22.733055555555556, 80.43], [114.27665, 22.73299, 80]]
118
- }
119
- };
120
94
  if (this._canOperate()) {
121
- _context.next = 3;
95
+ _context.next = 2;
122
96
  break;
123
97
  }
124
98
  return _context.abrupt("return");
125
- case 3:
99
+ case 2:
126
100
  translatedSource = translateSource(geoJson);
127
101
  this.routeSource = flatten(translatedSource);
128
102
  points = [];
@@ -136,41 +110,48 @@ var FlightRiskEvaluation = /*#__PURE__*/function () {
136
110
  };
137
111
  })));
138
112
  });
139
- _context.next = 9;
140
- return Promise.all([fetch.post(POINT_EVALUATION_URL, {
113
+ _context.next = 8;
114
+ return Promise.all([fetch.post(this.options.POINT_EVALUATION_URL, {
141
115
  points: points
142
- }), fetch.post(SEGMENT_EVALUATION_URL, {
116
+ }), fetch.post(this.options.SEGMENT_EVALUATION_URL, {
143
117
  points: points
144
- }), fetch.post(ROUTE_EVALUATION_URL, {
118
+ }), fetch.post(this.options.ROUTE_EVALUATION_URL, {
145
119
  points: points
146
- }), fetch.post(GRID_RENDER_URL, {
120
+ }), fetch.post(this.options.GRID_RENDER_URL, {
147
121
  points: points,
148
122
  stepDistance: 30
149
123
  })]);
150
- case 9:
124
+ case 8:
151
125
  _yield$Promise$all = _context.sent;
152
126
  _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 4);
153
127
  pointEvaluationData = _yield$Promise$all2[0].data.data;
154
128
  segmentEvaluationData = _yield$Promise$all2[1].data.data;
155
129
  routeEvaluationData = _yield$Promise$all2[2].data.data;
156
130
  gridData = _yield$Promise$all2[3].data.data;
157
- this.routeResultSource = {
131
+ if (this.options.isDraw) {
132
+ this.routeResultSource = {
133
+ pointEvaluationData: pointEvaluationData,
134
+ segmentEvaluationData: segmentEvaluationData,
135
+ routeEvaluationData: routeEvaluationData,
136
+ gridData: gridData
137
+ };
138
+ this._createRoute();
139
+ this._createRiskPoints();
140
+ this._createGrids();
141
+ }
142
+ return _context.abrupt("return", {
158
143
  pointEvaluationData: pointEvaluationData,
159
144
  segmentEvaluationData: segmentEvaluationData,
160
145
  routeEvaluationData: routeEvaluationData,
161
146
  gridData: gridData
162
- };
163
- this._createRoute();
164
- this._createRiskPoints();
165
- this._createGrids();
166
- console.log(pointEvaluationData, segmentEvaluationData, routeEvaluationData, gridData);
167
- case 20:
147
+ });
148
+ case 16:
168
149
  case "end":
169
150
  return _context.stop();
170
151
  }
171
152
  }, _callee, this);
172
153
  }));
173
- function start() {
154
+ function start(_x) {
174
155
  return _start.apply(this, arguments);
175
156
  }
176
157
  return start;
@@ -178,8 +159,8 @@ var FlightRiskEvaluation = /*#__PURE__*/function () {
178
159
  }, {
179
160
  key: "_createRoute",
180
161
  value: function _createRoute() {
181
- var _this$routeResultSour,
182
- _this = this;
162
+ var _this = this,
163
+ _this$routeResultSour;
183
164
  if (!this._canOperate) return;
184
165
  this._clearRoute();
185
166
  var allPoints = [];
@@ -200,8 +181,8 @@ var FlightRiskEvaluation = /*#__PURE__*/function () {
200
181
  coordinates: point
201
182
  },
202
183
  properties: {
203
- text: TYPE_LABEL_MAP.START,
204
- color: TYPE_COLOR_MAP.START
184
+ text: _this.options.TYPE_LABEL_MAP.START,
185
+ color: _this.options.TYPE_COLOR_MAP.START
205
186
  }
206
187
  });
207
188
  }
@@ -213,8 +194,8 @@ var FlightRiskEvaluation = /*#__PURE__*/function () {
213
194
  coordinates: point
214
195
  },
215
196
  properties: {
216
- text: TYPE_LABEL_MAP.END,
217
- color: TYPE_COLOR_MAP.END
197
+ text: _this.options.TYPE_LABEL_MAP.END,
198
+ color: _this.options.TYPE_COLOR_MAP.END
218
199
  }
219
200
  });
220
201
  }
@@ -288,8 +269,8 @@ var FlightRiskEvaluation = /*#__PURE__*/function () {
288
269
  translucent: true
289
270
  }
290
271
  });
291
- this.routePipelineLayer.on(LAYER_EVENT_TYPE.LEFT_CLICK, function (e) {
292
- console.log(e);
272
+ this._onClickSegmentEvent = this.routePipelineLayer.on(LAYER_EVENT_TYPE.LEFT_CLICK, function (e) {
273
+ _this.options.onClickSegment && _this.options.onClickSegment(e);
293
274
  });
294
275
  }
295
276
  this.routePointsLayer.flyTo();
@@ -308,15 +289,19 @@ var FlightRiskEvaluation = /*#__PURE__*/function () {
308
289
  this.routePointsLabelLayer = null;
309
290
  }
310
291
 
311
- // 获取航段颜色使用segment接口返回的数据)
292
+ // 获取航段颜色 使用segment接口返回的数据
312
293
  }, {
313
294
  key: "_getSegmentColorFromEvaluation",
314
295
  value: function _getSegmentColorFromEvaluation(evaluation) {
315
296
  var confidence = evaluation === null || evaluation === void 0 ? void 0 : evaluation.confidence;
297
+ var step = -1;
298
+ for (var i = 0; i < this.options.segmentGradeColor.length; i++) {
299
+ if (confidence > this.options.segmentGradeColor[i].num) {
300
+ step = i;
301
+ }
302
+ }
316
303
  if (confidence == null) return 'rgba(6,182,212,0.95)';
317
- if (confidence < 0) return 'rgba(239,68,68,0.95)';
318
- if (confidence < 0.5) return 'rgba(245,158,11,0.95)';
319
- return 'rgba(16,185,129,0.95)';
304
+ return this.options.segmentGradeColor[step].color;
320
305
  }
321
306
 
322
307
  // 风险点聚合函数:将相近位置的风险点聚合在一起
@@ -378,11 +363,12 @@ var FlightRiskEvaluation = /*#__PURE__*/function () {
378
363
  }, {
379
364
  key: "_createRiskPoints",
380
365
  value: function _createRiskPoints() {
381
- var _this$routeResultSour2;
366
+ var _this$routeResultSour2,
367
+ _this2 = this;
382
368
  if (!this._canOperate()) return;
383
369
  this._clearRiskPoints();
384
370
  if ((_this$routeResultSour2 = this.routeResultSource) !== null && _this$routeResultSour2 !== void 0 && (_this$routeResultSour2 = _this$routeResultSour2.pointEvaluationData) !== null && _this$routeResultSour2 !== void 0 && _this$routeResultSour2.length) {
385
- var riskPoints = [];
371
+ // const riskPoints = [];
386
372
  var allRiskPoints = [];
387
373
  // 第一步:收集所有风险点
388
374
  this.routeResultSource.pointEvaluationData.forEach(function (item, idx) {
@@ -412,24 +398,9 @@ var FlightRiskEvaluation = /*#__PURE__*/function () {
412
398
  var clusters = this._clusterRiskPoints(allRiskPoints, 0.005); // 约55米聚合距离
413
399
  var clustersGeoJson = {
414
400
  type: 'FeatureCollection',
415
- features: clusters === null || clusters === void 0 ? void 0 : clusters.map(function (cluster, clusterIdx) {
401
+ features: clusters === null || clusters === void 0 ? void 0 : clusters.map(function (cluster) {
416
402
  var isClustered = cluster.points.length > 1;
417
403
  var displayHeight = cluster.centerAlt + 20; // 管道上方20米
418
- var clusterData = {
419
- index: clusterIdx,
420
- lng: cluster.centerLng,
421
- lat: cluster.centerLat,
422
- alt: cluster.centerAlt,
423
- displayHeight: displayHeight,
424
- riskCount: cluster.totalRiskCount,
425
- pointCount: cluster.points.length,
426
- // 聚合的点数量
427
- isClustered: isClustered,
428
- points: cluster.points,
429
- // 包含的所有风险点
430
- evaluation: cluster.evaluations[0] // 使用第一个点的评估数据
431
- };
432
- riskPoints.push(clusterData);
433
404
  // 创建聚合风险点标记
434
405
  // 如果是聚合点,使用更大的标记和不同的颜色
435
406
  var markerSize = isClustered ? 50 : 40;
@@ -441,13 +412,16 @@ var FlightRiskEvaluation = /*#__PURE__*/function () {
441
412
  type: 'Point',
442
413
  coordinates: [cluster.centerLng, cluster.centerLat, displayHeight]
443
414
  },
444
- properties: {
445
- totalRiskCount: cluster.totalRiskCount,
415
+ properties: _objectSpread({
446
416
  isClustered: isClustered,
447
417
  markerSize: markerSize,
448
418
  markerColor: markerColor,
449
- markerText: markerText
450
- }
419
+ markerText: markerText,
420
+ displayHeight: displayHeight,
421
+ riskCount: cluster.totalRiskCount,
422
+ // 风险数量
423
+ pointCount: cluster.points.length
424
+ }, cluster)
451
425
  };
452
426
  })
453
427
  };
@@ -462,6 +436,9 @@ var FlightRiskEvaluation = /*#__PURE__*/function () {
462
436
  disableDepthTestDistance: Number.POSITIVE_INFINITY
463
437
  }
464
438
  });
439
+ this._onClickRiskPointEvent = this.riskPointsLayer.on(LAYER_EVENT_TYPE.LEFT_CLICK, function (e) {
440
+ _this2.options.onClickRisk && _this2.options.onClickRisk(e);
441
+ });
465
442
  this.riskPointsLabelLayer = this.getMap().addGraphicLayer(clustersGeoJson, {
466
443
  type: 'labelP',
467
444
  style: {
@@ -482,6 +459,9 @@ var FlightRiskEvaluation = /*#__PURE__*/function () {
482
459
  disableDepthTestDistance: Number.POSITIVE_INFINITY
483
460
  }
484
461
  });
462
+ this._onClickRiskPointLabelEvent = this.riskPointsLabelLayer.on(LAYER_EVENT_TYPE.LEFT_CLICK, function (e) {
463
+ _this2.options.onClickRisk && _this2.options.onClickRisk(e);
464
+ });
485
465
  }
486
466
  }
487
467
 
@@ -536,14 +516,25 @@ var FlightRiskEvaluation = /*#__PURE__*/function () {
536
516
  });
537
517
  }
538
518
 
539
- // 销毁
519
+ // 清除
540
520
  }, {
541
- key: "destroy",
542
- value: function destroy() {
521
+ key: "clear",
522
+ value: function clear() {
543
523
  if (!this._canOperate()) return;
544
524
  this._clearRoute();
545
525
  this._clearRiskPoints();
546
526
  this.routeResultSource = null;
527
+ this._onClickSegmentEvent && this._onClickSegmentEvent.off();
528
+ this._onClickRiskPointEvent && this._onClickRiskPointEvent.off();
529
+ this._onClickRiskPointLabelEvent && this._onClickRiskPointLabelEvent.off();
530
+ }
531
+
532
+ // 销毁
533
+ }, {
534
+ key: "destroy",
535
+ value: function destroy() {
536
+ if (!this._canOperate()) return;
537
+ this.clear();
547
538
  this.isDestroyed = true;
548
539
  }
549
540
  }]);
@@ -46,7 +46,7 @@ var GridDraw = /*#__PURE__*/function () {
46
46
  key: "_canOperate",
47
47
  value: function _canOperate() {
48
48
  if (this.isDestroyed) {
49
- utils.error('Airspace实例已销毁');
49
+ utils.error('GridDraw实例已销毁');
50
50
  return false;
51
51
  }
52
52
  return true;
@@ -28,7 +28,7 @@ var PoiLayer = /*#__PURE__*/function () {
28
28
  key: "_canOperate",
29
29
  value: function _canOperate() {
30
30
  if (this.isDestroyed) {
31
- utils.error('SubmergenceAnalysis实例已销毁');
31
+ utils.error('PoiLayer实例已销毁');
32
32
  return false;
33
33
  }
34
34
  return true;
@@ -1,4 +1,6 @@
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 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
+ 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; }
2
4
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3
5
  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
6
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -245,6 +247,7 @@ var Event = /*#__PURE__*/function () {
245
247
  var pickedObject = _this4._getPickedObject(position);
246
248
  if (pickedObject) {
247
249
  var currLayer;
250
+ var primitiveInstance;
248
251
  if (layer.isEntity) {
249
252
  currLayer = layer.layers.find(function (t) {
250
253
  var _pickedObject$id;
@@ -254,12 +257,35 @@ var Event = /*#__PURE__*/function () {
254
257
  currLayer = layer.layers.find(function (t) {
255
258
  return t.id === (pickedObject === null || pickedObject === void 0 ? void 0 : pickedObject.id);
256
259
  });
260
+ if (!['pointP', 'billboardP', 'labelP'].includes(layer.type)) {
261
+ var _layer$primitiveColle;
262
+ primitiveInstance = layer === null || layer === void 0 || (_layer$primitiveColle = layer.primitiveCollection) === null || _layer$primitiveColle === void 0 || (_layer$primitiveColle = _layer$primitiveColle.primitive) === null || _layer$primitiveColle === void 0 || (_layer$primitiveColle = _layer$primitiveColle.geometryInstances) === null || _layer$primitiveColle === void 0 ? void 0 : _layer$primitiveColle.find(function (t) {
263
+ return t.id === (pickedObject === null || pickedObject === void 0 ? void 0 : pickedObject.id);
264
+ });
265
+ } else if (layer.type === 'pointP') {
266
+ var _layer$primitiveColle2;
267
+ primitiveInstance = layer === null || layer === void 0 || (_layer$primitiveColle2 = layer.primitiveCollection) === null || _layer$primitiveColle2 === void 0 || (_layer$primitiveColle2 = _layer$primitiveColle2._pointPrimitives) === null || _layer$primitiveColle2 === void 0 ? void 0 : _layer$primitiveColle2.find(function (t) {
268
+ return t.id === (pickedObject === null || pickedObject === void 0 ? void 0 : pickedObject.id);
269
+ });
270
+ } else if (layer.type === 'billboardP') {
271
+ var _layer$primitiveColle3;
272
+ primitiveInstance = layer === null || layer === void 0 || (_layer$primitiveColle3 = layer.primitiveCollection) === null || _layer$primitiveColle3 === void 0 || (_layer$primitiveColle3 = _layer$primitiveColle3._billboards) === null || _layer$primitiveColle3 === void 0 ? void 0 : _layer$primitiveColle3.find(function (t) {
273
+ return t.id === (pickedObject === null || pickedObject === void 0 ? void 0 : pickedObject.id);
274
+ });
275
+ } else if (layer.type === 'labelP') {
276
+ var _layer$primitiveColle4;
277
+ primitiveInstance = layer === null || layer === void 0 || (_layer$primitiveColle4 = layer.primitiveCollection) === null || _layer$primitiveColle4 === void 0 || (_layer$primitiveColle4 = _layer$primitiveColle4._labels) === null || _layer$primitiveColle4 === void 0 ? void 0 : _layer$primitiveColle4.find(function (t) {
278
+ return t.id === (pickedObject === null || pickedObject === void 0 ? void 0 : pickedObject.id);
279
+ });
280
+ }
257
281
  }
258
282
  if (currLayer) {
259
283
  var result = {
260
284
  original: e,
261
285
  position: _this4._getPosition(position),
262
- layer: currLayer
286
+ layer: _objectSpread(_objectSpread({}, currLayer), {}, {
287
+ primitiveInstance: primitiveInstance
288
+ })
263
289
  };
264
290
  if (type === Cesium.ScreenSpaceEventType.MOUSE_MOVE) {
265
291
  result.mouseType = !isHoverLayer ? 'mouseEnter' : 'mouseMove';
@@ -66,9 +66,9 @@ var BaseVideo = /*#__PURE__*/function () {
66
66
  if (!videoContainer) {
67
67
  return;
68
68
  }
69
- this.videoElement = document.createElement('video');
70
- this.videoElement.id = uuidv4();
71
69
  if (this.videoType === 'video') {
70
+ this.videoElement = document.createElement('video');
71
+ this.videoElement.id = uuidv4();
72
72
  var _merge = merge(DEFAULT_VIDEO_TEXTURE_VIDEO(), this.options.video),
73
73
  loop = _merge.loop,
74
74
  muted = _merge.muted,
@@ -89,6 +89,8 @@ var BaseVideo = /*#__PURE__*/function () {
89
89
  this.videoElement.appendChild(sourceEl);
90
90
  videoContainer.appendChild(this.videoElement);
91
91
  } else if (this.videoType === 'hls') {
92
+ this.videoElement = document.createElement('video');
93
+ this.videoElement.id = uuidv4();
92
94
  var _merge2 = merge(DEFAULT_VIDEO_TEXTURE_HLS(), this.options.hls),
93
95
  _muted = _merge2.muted,
94
96
  _autoPlay = _merge2.autoPlay,
@@ -128,16 +130,15 @@ var BaseVideo = /*#__PURE__*/function () {
128
130
  });
129
131
  }
130
132
  } else if (this.videoType === 'custom') {
131
- var _this$options$custom = this.options.custom,
132
- _width2 = _this$options$custom.width,
133
- _height2 = _this$options$custom.height,
134
- onReady = _this$options$custom.onReady;
135
- this.videoElement.width = _width2;
136
- this.videoElement.height = _height2;
137
- videoContainer.appendChild(this.videoElement);
133
+ var element = document.createElement('div');
134
+ element.id = uuidv4();
135
+ var onReady = this.options.custom.onReady;
136
+ videoContainer.appendChild(element);
138
137
  if (onReady) {
139
138
  this.status = 'READY';
140
- onReady(this.videoElement, this.play, this.pause);
139
+ onReady(element, function (video) {
140
+ _this.videoElement = video;
141
+ });
141
142
  }
142
143
  }
143
144
  }
@@ -313,7 +314,7 @@ var BaseVideo = /*#__PURE__*/function () {
313
314
  this.isDestroyed = true;
314
315
  if (this.videoType === 'hls') {
315
316
  this.synchronizer && this.synchronizer.destroy();
316
- this.hls && this.hls.destroyed();
317
+ this.hls && this.hls.destroy();
317
318
  this.getMap().clock.shouldAnimate = false;
318
319
  }
319
320
  if (this.videoType === 'custom') {
@@ -4,7 +4,7 @@ export default class VideoProject extends BaseVideo {
4
4
  frustum: any;
5
5
  frustumLineLayer: any;
6
6
  constructor(map: any, options: any);
7
- addToMap(map: any): void;
7
+ addToMap(): void;
8
8
  show(isShow: boolean): void;
9
9
  private _drawLine;
10
10
  private _getInterPointByLine;