deeptwins-engine-3d 0.1.43 → 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/graphicLayer/BaseSource.d.ts +1 -1
- package/dist/esm/index.js +3 -2
- package/dist/esm/lowAltitude/FlightPlanning.js +10 -25
- package/dist/esm/lowAltitude/FlightRiskEvaluation.js +383 -0
- package/dist/esm/tool/common.d.ts +1 -0
- package/dist/esm/tool/common.js +13 -1
- 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/umd/deeptwins-engine-3d.min.js +1 -1
- package/package.json +2 -2
- package/dist/esm/lowAltitude/RiskEvaluation.js +0 -0
- /package/dist/esm/lowAltitude/{RiskEvaluation.d.ts → FlightRiskEvaluation.d.ts} +0 -0
|
@@ -15,7 +15,7 @@ export default class BaseSource {
|
|
|
15
15
|
remove(): void;
|
|
16
16
|
setData(data: any): this | undefined;
|
|
17
17
|
_toDestroy(): void;
|
|
18
|
-
static analysisSourceType(data: any): "
|
|
18
|
+
static analysisSourceType(data: any): "wkt" | "sourceId" | "sourceInstance" | "geoJson" | "other";
|
|
19
19
|
static wktToGeoJon(wkt: string): any;
|
|
20
20
|
static geoJsonToGeoCartesian3Array(geoJson: any): any[];
|
|
21
21
|
static handleFeaturePoint(feature: any): any;
|
package/dist/esm/index.js
CHANGED
|
@@ -21,6 +21,7 @@ import Drawer from "./drawer/index";
|
|
|
21
21
|
import "./global.css";
|
|
22
22
|
import BarrierLayer from "./lowAltitude/BarrierLayer";
|
|
23
23
|
import FlightPlanning from "./lowAltitude/FlightPlanning";
|
|
24
|
+
// import FlightRiskEvaluation from './lowAltitude/FlightRiskEvaluation';
|
|
24
25
|
import GridDraw from "./lowAltitude/GridDraw";
|
|
25
26
|
import PoiLayer from "./lowAltitude/PoiLayer";
|
|
26
27
|
import VisitLayer from "./lowAltitude/VisitLayer";
|
|
@@ -57,11 +58,11 @@ DEEP_TWINS_BASE_URL && (window.CESIUM_BASE_URL = DEEP_TWINS_BASE_URL);
|
|
|
57
58
|
// 全局加载css
|
|
58
59
|
loadCss(Cesium.buildModuleUrl('Widgets/widgets.css'));
|
|
59
60
|
// 打印版本信息
|
|
60
|
-
console.log('DeepTwinsEngine3D Version:', "0.1.
|
|
61
|
+
console.log('DeepTwinsEngine3D Version:', "0.1.44");
|
|
61
62
|
export var DeepTwinsEngine3D = /*#__PURE__*/_createClass(function DeepTwinsEngine3D() {
|
|
62
63
|
_classCallCheck(this, DeepTwinsEngine3D);
|
|
63
64
|
});
|
|
64
|
-
_defineProperty(DeepTwinsEngine3D, "Version", "0.1.
|
|
65
|
+
_defineProperty(DeepTwinsEngine3D, "Version", "0.1.44");
|
|
65
66
|
_defineProperty(DeepTwinsEngine3D, "Map", Map);
|
|
66
67
|
_defineProperty(DeepTwinsEngine3D, "GroundSkyBox", GroundSkyBox);
|
|
67
68
|
_defineProperty(DeepTwinsEngine3D, "RasterLayer", RasterLayer);
|
|
@@ -15,6 +15,7 @@ import * as Cesium from 'deeptwins-cesium';
|
|
|
15
15
|
import { merge } from 'lodash';
|
|
16
16
|
import { DEFAULT_FLIGHT_PLANNING_OPTIONS } from "../constant";
|
|
17
17
|
import { ShapeSection } from "../tool/common";
|
|
18
|
+
import fetch from "../tool/fetch";
|
|
18
19
|
import * as utils from "../tool/utils";
|
|
19
20
|
import GridDraw from "./GridDraw";
|
|
20
21
|
var FlightPlanning = /*#__PURE__*/function () {
|
|
@@ -57,46 +58,30 @@ var FlightPlanning = /*#__PURE__*/function () {
|
|
|
57
58
|
key: "createPlan",
|
|
58
59
|
value: function () {
|
|
59
60
|
var _createPlan = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(value) {
|
|
60
|
-
var payload,
|
|
61
|
+
var payload, _yield$fetch$post, result, normalized, hasPoints;
|
|
61
62
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
62
63
|
while (1) switch (_context.prev = _context.next) {
|
|
63
64
|
case 0:
|
|
64
65
|
payload = this._buildPayload(value);
|
|
65
66
|
_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
|
-
});
|
|
67
|
+
return fetch.post(this.options.API_URL, payload);
|
|
73
68
|
case 3:
|
|
74
|
-
|
|
75
|
-
|
|
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;
|
|
69
|
+
_yield$fetch$post = _context.sent;
|
|
70
|
+
result = _yield$fetch$post.data;
|
|
86
71
|
if (!(result.code !== 0)) {
|
|
87
|
-
_context.next =
|
|
72
|
+
_context.next = 8;
|
|
88
73
|
break;
|
|
89
74
|
}
|
|
90
75
|
utils.error(result.message || '规划接口返回失败');
|
|
91
76
|
return _context.abrupt("return");
|
|
92
|
-
case
|
|
77
|
+
case 8:
|
|
93
78
|
if (result.data) {
|
|
94
|
-
_context.next =
|
|
79
|
+
_context.next = 11;
|
|
95
80
|
break;
|
|
96
81
|
}
|
|
97
82
|
utils.error('规划结果为空');
|
|
98
83
|
return _context.abrupt("return");
|
|
99
|
-
case
|
|
84
|
+
case 11:
|
|
100
85
|
normalized = this._normalizeRouteData(result.data);
|
|
101
86
|
if (this.options.isDraw) {
|
|
102
87
|
hasPoints = normalized && Array.isArray(normalized.points) && normalized.points.length > 0;
|
|
@@ -111,7 +96,7 @@ var FlightPlanning = /*#__PURE__*/function () {
|
|
|
111
96
|
}
|
|
112
97
|
}
|
|
113
98
|
return _context.abrupt("return", normalized);
|
|
114
|
-
case
|
|
99
|
+
case 14:
|
|
115
100
|
case "end":
|
|
116
101
|
return _context.stop();
|
|
117
102
|
}
|
|
@@ -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;
|
package/dist/esm/tool/common.js
CHANGED
|
@@ -390,4 +390,16 @@ export var ClampToGround = /*#__PURE__*/function () {
|
|
|
390
390
|
}()
|
|
391
391
|
}]);
|
|
392
392
|
return ClampToGround;
|
|
393
|
-
}();
|
|
393
|
+
}();
|
|
394
|
+
|
|
395
|
+
// 数据类型转换
|
|
396
|
+
export function translateSource(source) {
|
|
397
|
+
var sourceType = BaseSource.analysisSourceType(source);
|
|
398
|
+
if (sourceType === 'geoJson') {
|
|
399
|
+
return source;
|
|
400
|
+
} else if (sourceType === 'wkt') {
|
|
401
|
+
return BaseSource.wktToGeoJon(source);
|
|
402
|
+
} else {
|
|
403
|
+
throw new Error('数据格式错误');
|
|
404
|
+
}
|
|
405
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetch 请求配置选项
|
|
3
|
+
*/
|
|
4
|
+
export interface FetchUrlOptions {
|
|
5
|
+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
6
|
+
headers?: Record<string, string>;
|
|
7
|
+
body?: any;
|
|
8
|
+
timeout?: number;
|
|
9
|
+
params?: Record<string, any>;
|
|
10
|
+
responseType?: 'json' | 'text' | 'blob' | 'arrayBuffer';
|
|
11
|
+
credentials?: RequestCredentials;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Fetch 请求响应
|
|
15
|
+
*/
|
|
16
|
+
export interface FetchUrlResponse<T = any> {
|
|
17
|
+
data: T;
|
|
18
|
+
status: number;
|
|
19
|
+
statusText: string;
|
|
20
|
+
headers: Headers;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 封装的 fetch 请求函数
|
|
24
|
+
* @param url 请求地址
|
|
25
|
+
* @param options 请求配置
|
|
26
|
+
* @returns Promise<FetchUrlResponse>
|
|
27
|
+
*/
|
|
28
|
+
export declare function fetchUrl<T = any>(url: string, options?: FetchUrlOptions): Promise<FetchUrlResponse<T>>;
|
|
29
|
+
/**
|
|
30
|
+
* GET 请求快捷方法
|
|
31
|
+
*/
|
|
32
|
+
export declare function get<T = any>(url: string, params?: Record<string, any>, options?: Omit<FetchUrlOptions, 'method' | 'body' | 'params'>): Promise<FetchUrlResponse<T>>;
|
|
33
|
+
/**
|
|
34
|
+
* POST 请求快捷方法
|
|
35
|
+
*/
|
|
36
|
+
export declare function post<T = any>(url: string, body?: any, options?: Omit<FetchUrlOptions, 'method' | 'body'>): Promise<FetchUrlResponse<T>>;
|
|
37
|
+
/**
|
|
38
|
+
* PUT 请求快捷方法
|
|
39
|
+
*/
|
|
40
|
+
export declare function put<T = any>(url: string, body?: any, options?: Omit<FetchUrlOptions, 'method' | 'body'>): Promise<FetchUrlResponse<T>>;
|
|
41
|
+
/**
|
|
42
|
+
* DELETE 请求快捷方法
|
|
43
|
+
*/
|
|
44
|
+
export declare function del<T = any>(url: string, body?: any, options?: Omit<FetchUrlOptions, 'method' | 'body'>): Promise<FetchUrlResponse<T>>;
|
|
45
|
+
declare const _default: {
|
|
46
|
+
get: typeof get;
|
|
47
|
+
post: typeof post;
|
|
48
|
+
put: typeof put;
|
|
49
|
+
delete: typeof del;
|
|
50
|
+
};
|
|
51
|
+
export default _default;
|