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
package/dist/esm/constant.d.ts
CHANGED
|
@@ -110,7 +110,7 @@ export declare const DEFAULT_POINT_CLUSTER_STYLE: () => {
|
|
|
110
110
|
enabled: boolean;
|
|
111
111
|
colorArr: never[];
|
|
112
112
|
};
|
|
113
|
-
export declare const
|
|
113
|
+
export declare const DEFAULT_GRID_STYLE: () => {
|
|
114
114
|
show: boolean;
|
|
115
115
|
chunkSize: number;
|
|
116
116
|
dimensions: number[];
|
|
@@ -131,6 +131,43 @@ export declare const DEFAULT_VIDEO_TEXTURE_HLS: () => {
|
|
|
131
131
|
width: number;
|
|
132
132
|
height: number;
|
|
133
133
|
};
|
|
134
|
+
export declare const DEFAULT_GRID_VT_OPTIONS: () => {
|
|
135
|
+
cacheSize: number;
|
|
136
|
+
dataZooms: number[];
|
|
137
|
+
zooms: number[];
|
|
138
|
+
minHeight: number;
|
|
139
|
+
maxHeight: number;
|
|
140
|
+
heightColors: string[];
|
|
141
|
+
};
|
|
142
|
+
export declare const DEFAULT_FLIGHT_PLANNING_OPTIONS: () => {
|
|
143
|
+
isDraw: boolean;
|
|
144
|
+
GRID_HEIGHT_PER_LAYER: number;
|
|
145
|
+
DEFAULT_LATITUDE: number;
|
|
146
|
+
DEFAULT_GRID_LEVEL: number;
|
|
147
|
+
COLOR_GROUP_SIZE: number;
|
|
148
|
+
GRID_ALPHA: number;
|
|
149
|
+
GRID_SIZES: number[][];
|
|
150
|
+
HEIGHT_COLORS: string[];
|
|
151
|
+
DEFAULT_GRID_COLOR: string;
|
|
152
|
+
TYPE_COLOR_MAP: {
|
|
153
|
+
START: string;
|
|
154
|
+
END: string;
|
|
155
|
+
WAYPOINT: string;
|
|
156
|
+
HOLD: string;
|
|
157
|
+
NORMAL: string;
|
|
158
|
+
TASKSTART: string;
|
|
159
|
+
TASKEND: string;
|
|
160
|
+
};
|
|
161
|
+
TYPE_LABEL_MAP: {
|
|
162
|
+
START: string;
|
|
163
|
+
END: string;
|
|
164
|
+
WAYPOINT: string;
|
|
165
|
+
NORMAL: string;
|
|
166
|
+
HOLD: string;
|
|
167
|
+
TASKSTART: string;
|
|
168
|
+
TASKEND: string;
|
|
169
|
+
};
|
|
170
|
+
};
|
|
134
171
|
export declare const DEFAULT_SUBMERGENCE_ANALYSIS_OPTIONS: () => {
|
|
135
172
|
startHeight: number;
|
|
136
173
|
targetHeight: number;
|
|
@@ -147,15 +184,16 @@ export declare const DEFAULT_SUN_ANALYSIS_OPTIONS: () => {
|
|
|
147
184
|
clockStep: Cesium.ClockStep;
|
|
148
185
|
};
|
|
149
186
|
export declare const DEFAULT_VIEWSHED_ANALYSIS_OPTIONS: () => {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
187
|
+
position: null;
|
|
188
|
+
positionEnd: null;
|
|
189
|
+
distance: number;
|
|
190
|
+
heading: number;
|
|
191
|
+
pitch: number;
|
|
155
192
|
horizontalViewAngle: number;
|
|
156
193
|
verticalViewAngle: number;
|
|
157
194
|
visibleAreaColor: Cesium.Color;
|
|
158
195
|
invisibleAreaColor: Cesium.Color;
|
|
196
|
+
outlineColor: Cesium.Color;
|
|
159
197
|
enabled: boolean;
|
|
160
198
|
softShadows: boolean;
|
|
161
199
|
size: number;
|
package/dist/esm/constant.js
CHANGED
|
@@ -172,8 +172,8 @@ export var DEFAULT_POINT_CLUSTER_STYLE = function DEFAULT_POINT_CLUSTER_STYLE()
|
|
|
172
172
|
};
|
|
173
173
|
};
|
|
174
174
|
|
|
175
|
-
//
|
|
176
|
-
export var
|
|
175
|
+
// 默认的网格样式
|
|
176
|
+
export var DEFAULT_GRID_STYLE = function DEFAULT_GRID_STYLE() {
|
|
177
177
|
return {
|
|
178
178
|
show: true,
|
|
179
179
|
chunkSize: 10000,
|
|
@@ -205,6 +205,82 @@ export var DEFAULT_VIDEO_TEXTURE_HLS = function DEFAULT_VIDEO_TEXTURE_HLS() {
|
|
|
205
205
|
};
|
|
206
206
|
};
|
|
207
207
|
|
|
208
|
+
// 默认GridVT属性
|
|
209
|
+
export var DEFAULT_GRID_VT_OPTIONS = function DEFAULT_GRID_VT_OPTIONS() {
|
|
210
|
+
return {
|
|
211
|
+
cacheSize: 20,
|
|
212
|
+
dataZooms: [16, 16],
|
|
213
|
+
zooms: [10, 22],
|
|
214
|
+
minHeight: 0,
|
|
215
|
+
maxHeight: Infinity,
|
|
216
|
+
heightColors: ['#9e0142', '#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#e6f598', '#abdda4', '#66c2a5', '#3288bd', '#5e4fa2'].reverse()
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
// 默认航线规划配置选项
|
|
221
|
+
export var DEFAULT_FLIGHT_PLANNING_OPTIONS = function DEFAULT_FLIGHT_PLANNING_OPTIONS() {
|
|
222
|
+
return {
|
|
223
|
+
isDraw: true,
|
|
224
|
+
// 是否绘制
|
|
225
|
+
GRID_HEIGHT_PER_LAYER: 7.66,
|
|
226
|
+
// 每层高度(米)
|
|
227
|
+
DEFAULT_LATITUDE: 22.7,
|
|
228
|
+
// 默认纬度
|
|
229
|
+
DEFAULT_GRID_LEVEL: 11,
|
|
230
|
+
// 默认网格级别
|
|
231
|
+
COLOR_GROUP_SIZE: 3,
|
|
232
|
+
// 每几层使用一种颜色
|
|
233
|
+
GRID_ALPHA: 0.6,
|
|
234
|
+
// 网格透明度
|
|
235
|
+
GRID_SIZES: [[0, 0], [21600, 14400], [10800, 7200], [1800, 1800], [900, 600], [300, 300], [60, 60], [12, 12], [4, 4], [2, 2], [1, 1], [0.5, 0.5], [0.25, 0.25], [0.125, 0.125], [0.0625, 0.0625], [0.03125, 0.03125], [0.015625, 0.015625]],
|
|
236
|
+
// 不同级别的网格的地理尺寸,单位:秒,数组的一级索引对应网格级别
|
|
237
|
+
HEIGHT_COLORS: ['#9e0142',
|
|
238
|
+
// 深红色
|
|
239
|
+
'#d53e4f',
|
|
240
|
+
// 红色
|
|
241
|
+
'#f46d43',
|
|
242
|
+
// 橙红色
|
|
243
|
+
'#fdae61',
|
|
244
|
+
// 橙色
|
|
245
|
+
'#fee08b',
|
|
246
|
+
// 黄色
|
|
247
|
+
'#ffffbf',
|
|
248
|
+
// 浅黄色
|
|
249
|
+
'#e6f598',
|
|
250
|
+
// 浅绿色
|
|
251
|
+
'#abdda4',
|
|
252
|
+
// 绿色
|
|
253
|
+
'#66c2a5',
|
|
254
|
+
// 青绿色
|
|
255
|
+
'#3288bd',
|
|
256
|
+
// 蓝色
|
|
257
|
+
'#5e4fa2' // 紫色(最高层)
|
|
258
|
+
],
|
|
259
|
+
// 网格颜色
|
|
260
|
+
DEFAULT_GRID_COLOR: '#d8daeb',
|
|
261
|
+
// 默认网格颜色
|
|
262
|
+
TYPE_COLOR_MAP: {
|
|
263
|
+
START: '#00ff00',
|
|
264
|
+
END: '#ff0000',
|
|
265
|
+
WAYPOINT: '#ffa500',
|
|
266
|
+
HOLD: '#ffff00',
|
|
267
|
+
NORMAL: '#ffffff',
|
|
268
|
+
TASKSTART: '#87ceeb',
|
|
269
|
+
TASKEND: '#ff00ff'
|
|
270
|
+
},
|
|
271
|
+
// 点位颜色
|
|
272
|
+
TYPE_LABEL_MAP: {
|
|
273
|
+
START: '起点',
|
|
274
|
+
END: '终点',
|
|
275
|
+
WAYPOINT: '途经点',
|
|
276
|
+
NORMAL: '航迹点',
|
|
277
|
+
HOLD: '悬停点',
|
|
278
|
+
TASKSTART: '任务起点',
|
|
279
|
+
TASKEND: '任务终点'
|
|
280
|
+
} // 点位名称
|
|
281
|
+
};
|
|
282
|
+
};
|
|
283
|
+
|
|
208
284
|
// 默认淹没分析配置选项 SubmergenceAnalysis
|
|
209
285
|
export var DEFAULT_SUBMERGENCE_ANALYSIS_OPTIONS = function DEFAULT_SUBMERGENCE_ANALYSIS_OPTIONS() {
|
|
210
286
|
return {
|
|
@@ -236,15 +312,15 @@ export var DEFAULT_SUN_ANALYSIS_OPTIONS = function DEFAULT_SUN_ANALYSIS_OPTIONS(
|
|
|
236
312
|
// 默认可视域分析
|
|
237
313
|
export var DEFAULT_VIEWSHED_ANALYSIS_OPTIONS = function DEFAULT_VIEWSHED_ANALYSIS_OPTIONS() {
|
|
238
314
|
return {
|
|
239
|
-
|
|
315
|
+
position: null,
|
|
240
316
|
// 观测点位置
|
|
241
|
-
|
|
317
|
+
positionEnd: null,
|
|
242
318
|
// 最远观测点位置 (如果设置了观测距离,这个属性可以不设置
|
|
243
|
-
|
|
319
|
+
distance: 100,
|
|
244
320
|
// 观测距离
|
|
245
|
-
|
|
321
|
+
heading: 0.0,
|
|
246
322
|
// 航向角
|
|
247
|
-
|
|
323
|
+
pitch: 0.0,
|
|
248
324
|
// 俯仰角
|
|
249
325
|
horizontalViewAngle: 90.0,
|
|
250
326
|
// 可视域水平夹角
|
|
@@ -254,6 +330,7 @@ export var DEFAULT_VIEWSHED_ANALYSIS_OPTIONS = function DEFAULT_VIEWSHED_ANALYSI
|
|
|
254
330
|
// 可视区域颜色(默认值`绿色`)。
|
|
255
331
|
invisibleAreaColor: Cesium.Color.RED,
|
|
256
332
|
// 不可视区域颜色(默认值`红色`)。
|
|
333
|
+
outlineColor: Cesium.Color.YELLOWGREEN,
|
|
257
334
|
enabled: true,
|
|
258
335
|
// 阴影贴图是否可用
|
|
259
336
|
softShadows: true,
|
|
@@ -469,6 +546,7 @@ export var DEFAULT_DYNAMIC_WALL_MATERIAL_STYLE = function DEFAULT_DYNAMIC_WALL_M
|
|
|
469
546
|
image: utils.getDeepTwinsFile('Image/wall.png')
|
|
470
547
|
};
|
|
471
548
|
};
|
|
549
|
+
|
|
472
550
|
// 水波纹材质默认的配置
|
|
473
551
|
export var DEFAULT_CIRCLE_WAVE_MATERIAL_STYLE = function DEFAULT_CIRCLE_WAVE_MATERIAL_STYLE() {
|
|
474
552
|
return {
|
|
@@ -478,6 +556,7 @@ export var DEFAULT_CIRCLE_WAVE_MATERIAL_STYLE = function DEFAULT_CIRCLE_WAVE_MAT
|
|
|
478
556
|
gradient: 0.1
|
|
479
557
|
};
|
|
480
558
|
};
|
|
559
|
+
|
|
481
560
|
// 发光材质默认的配置
|
|
482
561
|
export var DEFAULT_GLOW_MATERIAL_STYLE = function DEFAULT_GLOW_MATERIAL_STYLE() {
|
|
483
562
|
return {
|
|
@@ -57,7 +57,8 @@ var DeepTwins = /*#__PURE__*/function () {
|
|
|
57
57
|
moduleLayer: this._getModuleLayer.bind(this),
|
|
58
58
|
trafficHistoryLayer: this._YunJing.TrafficHistoryLayer,
|
|
59
59
|
trafficLayer: this._YunJing.TrafficLayer,
|
|
60
|
-
gridVTLayer: (_this$_YunjingCesiumP = this._YunjingCesiumPlugins) === null || _this$_YunjingCesiumP === void 0 ? void 0 : _this$_YunjingCesiumP.GridVTLayer
|
|
60
|
+
gridVTLayer: (_this$_YunjingCesiumP = this._YunjingCesiumPlugins) === null || _this$_YunjingCesiumP === void 0 ? void 0 : _this$_YunjingCesiumP.GridVTLayer,
|
|
61
|
+
poiLayer: this._YunJing.PoiLayer
|
|
61
62
|
});
|
|
62
63
|
}
|
|
63
64
|
case 15:
|
|
@@ -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): "other" | "wkt" | "sourceId" | "sourceInstance" | "geoJson";
|
|
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.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export declare class DeepTwinsEngine3D {
|
|
|
32
32
|
static PositionProperty: any;
|
|
33
33
|
static Frustum: any;
|
|
34
34
|
static FrustumWithCamera: any;
|
|
35
|
-
static
|
|
35
|
+
static GridDraw: any;
|
|
36
36
|
static VideoTexture: any;
|
|
37
37
|
static VideoProject: any;
|
|
38
38
|
static MapEvent: any;
|
|
@@ -65,5 +65,9 @@ export declare class DeepTwinsEngine3D {
|
|
|
65
65
|
static SunLightAnalysis: any;
|
|
66
66
|
static KmlDataSource: any;
|
|
67
67
|
static Compass: any;
|
|
68
|
+
static ViewshedAnalysis: any;
|
|
69
|
+
static VisitLayer: any;
|
|
70
|
+
static PoiLayer: any;
|
|
71
|
+
static FlightPlanning: any;
|
|
68
72
|
}
|
|
69
73
|
export default DeepTwinsEngine3D;
|
package/dist/esm/index.js
CHANGED
|
@@ -9,7 +9,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
9
9
|
import * as Cesium from 'deeptwins-cesium';
|
|
10
10
|
import SubmergenceAnalysis from "./analyze/SubmergenceAnalysis";
|
|
11
11
|
import SunLightAnalysis from "./analyze/SunLightAnalysis";
|
|
12
|
-
|
|
12
|
+
import ViewshedAnalysis from "./analyze/ViewshedAnalysis";
|
|
13
13
|
import ModelRoamHistory from "./cameraControl/ModelRoamHistory";
|
|
14
14
|
import ModelRoamRealTime from "./cameraControl/ModelRoamRealTime";
|
|
15
15
|
import Roam from "./cameraControl/Roam";
|
|
@@ -19,6 +19,11 @@ import { CAMERA_EVENT_TYPE, DEFAULT_BASE_LAYER_TYPE, LAYER_EVENT_TYPE, SCENE_EVE
|
|
|
19
19
|
import DeepTwins from "./deepTwins";
|
|
20
20
|
import Drawer from "./drawer/index";
|
|
21
21
|
import "./global.css";
|
|
22
|
+
import BarrierLayer from "./lowAltitude/BarrierLayer";
|
|
23
|
+
import FlightPlanning from "./lowAltitude/FlightPlanning";
|
|
24
|
+
import GridDraw from "./lowAltitude/GridDraw";
|
|
25
|
+
import PoiLayer from "./lowAltitude/PoiLayer";
|
|
26
|
+
import VisitLayer from "./lowAltitude/VisitLayer";
|
|
22
27
|
import GroundSkyBox from "./map/GroundSkyBox";
|
|
23
28
|
import Map from "./map/Map";
|
|
24
29
|
import VolumeCloud from "./material/VolumeCloud";
|
|
@@ -32,7 +37,6 @@ import ImageGlowingMaterialAppearance from "./material/primitive/ImageGlowingMat
|
|
|
32
37
|
import Measure from "./measure";
|
|
33
38
|
import PositionProperty from "./property/PositionProperty";
|
|
34
39
|
import ArcGisLayer from "./tileLayer/ArcGisLayer";
|
|
35
|
-
import BarrierLayer from "./tileLayer/BarrierLayer";
|
|
36
40
|
import RasterLayer from "./tileLayer/RasterLayer";
|
|
37
41
|
import WmsLayer from "./tileLayer/WmsLayer";
|
|
38
42
|
import WmtsLayer from "./tileLayer/WmtsLayer";
|
|
@@ -42,7 +46,6 @@ import { ClampToGround, ShapeSection } from "./tool/common";
|
|
|
42
46
|
import { loadCss } from "./tool/utils";
|
|
43
47
|
import VideoProject from "./videoFusion/VideoProject";
|
|
44
48
|
import VideoTexture from "./videoFusion/VideoTexture";
|
|
45
|
-
import Airspace from "./visualization/Airspace";
|
|
46
49
|
import Frustum from "./visualization/Frustum";
|
|
47
50
|
import FrustumWithCamera from "./visualization/FrustumWithCamera";
|
|
48
51
|
import Heatmap2d from "./visualization/Heatmap2d";
|
|
@@ -54,11 +57,11 @@ DEEP_TWINS_BASE_URL && (window.CESIUM_BASE_URL = DEEP_TWINS_BASE_URL);
|
|
|
54
57
|
// 全局加载css
|
|
55
58
|
loadCss(Cesium.buildModuleUrl('Widgets/widgets.css'));
|
|
56
59
|
// 打印版本信息
|
|
57
|
-
console.log('DeepTwinsEngine3D Version:', "0.1.
|
|
60
|
+
console.log('DeepTwinsEngine3D Version:', "0.1.43");
|
|
58
61
|
export var DeepTwinsEngine3D = /*#__PURE__*/_createClass(function DeepTwinsEngine3D() {
|
|
59
62
|
_classCallCheck(this, DeepTwinsEngine3D);
|
|
60
63
|
});
|
|
61
|
-
_defineProperty(DeepTwinsEngine3D, "Version", "0.1.
|
|
64
|
+
_defineProperty(DeepTwinsEngine3D, "Version", "0.1.43");
|
|
62
65
|
_defineProperty(DeepTwinsEngine3D, "Map", Map);
|
|
63
66
|
_defineProperty(DeepTwinsEngine3D, "GroundSkyBox", GroundSkyBox);
|
|
64
67
|
_defineProperty(DeepTwinsEngine3D, "RasterLayer", RasterLayer);
|
|
@@ -90,7 +93,7 @@ _defineProperty(DeepTwinsEngine3D, "PointCluster", PointCluster);
|
|
|
90
93
|
_defineProperty(DeepTwinsEngine3D, "PositionProperty", PositionProperty);
|
|
91
94
|
_defineProperty(DeepTwinsEngine3D, "Frustum", Frustum);
|
|
92
95
|
_defineProperty(DeepTwinsEngine3D, "FrustumWithCamera", FrustumWithCamera);
|
|
93
|
-
_defineProperty(DeepTwinsEngine3D, "
|
|
96
|
+
_defineProperty(DeepTwinsEngine3D, "GridDraw", GridDraw);
|
|
94
97
|
_defineProperty(DeepTwinsEngine3D, "VideoTexture", VideoTexture);
|
|
95
98
|
_defineProperty(DeepTwinsEngine3D, "VideoProject", VideoProject);
|
|
96
99
|
_defineProperty(DeepTwinsEngine3D, "MapEvent", Cesium.ScreenSpaceEventType);
|
|
@@ -123,4 +126,8 @@ _defineProperty(DeepTwinsEngine3D, "SubmergenceAnalysis", SubmergenceAnalysis);
|
|
|
123
126
|
_defineProperty(DeepTwinsEngine3D, "SunLightAnalysis", SunLightAnalysis);
|
|
124
127
|
_defineProperty(DeepTwinsEngine3D, "KmlDataSource", Cesium.KmlDataSource);
|
|
125
128
|
_defineProperty(DeepTwinsEngine3D, "Compass", Compass);
|
|
129
|
+
_defineProperty(DeepTwinsEngine3D, "ViewshedAnalysis", ViewshedAnalysis);
|
|
130
|
+
_defineProperty(DeepTwinsEngine3D, "VisitLayer", VisitLayer);
|
|
131
|
+
_defineProperty(DeepTwinsEngine3D, "PoiLayer", PoiLayer);
|
|
132
|
+
_defineProperty(DeepTwinsEngine3D, "FlightPlanning", FlightPlanning);
|
|
126
133
|
export default DeepTwinsEngine3D;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import BaseGridMvtLayer from './BaseGridMvtLayer';
|
|
2
|
+
/**
|
|
3
|
+
* 障碍物图层 - 基于MVT数据渲染障碍物网格
|
|
4
|
+
*/
|
|
5
|
+
declare class BarrierLayer extends BaseGridMvtLayer {
|
|
6
|
+
constructor(map: any, options?: any);
|
|
7
|
+
/**
|
|
8
|
+
* 创建primitives
|
|
9
|
+
* 按照示例代码的逻辑实现,每个feature创建一个障碍物实例
|
|
10
|
+
*/
|
|
11
|
+
private _createPrimitives;
|
|
12
|
+
/**
|
|
13
|
+
* 销毁primitives
|
|
14
|
+
*/
|
|
15
|
+
private _destroyPrimitives;
|
|
16
|
+
/**
|
|
17
|
+
* 显示primitives
|
|
18
|
+
*/
|
|
19
|
+
private _showPrimitives;
|
|
20
|
+
/**
|
|
21
|
+
* 隐藏primitives
|
|
22
|
+
*/
|
|
23
|
+
private _hidePrimitives;
|
|
24
|
+
/**
|
|
25
|
+
* 更新primitives
|
|
26
|
+
*/
|
|
27
|
+
private _updatePrimitives;
|
|
28
|
+
}
|
|
29
|
+
export default BarrierLayer;
|
|
@@ -1,91 +1,38 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
function
|
|
5
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
6
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
7
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
8
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
9
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
5
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
11
6
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
12
7
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
15
9
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
10
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
11
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
12
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
13
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
14
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
15
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
16
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
16
17
|
import * as Cesium from 'deeptwins-cesium';
|
|
17
|
-
import
|
|
18
|
+
import BaseGridMvtLayer from "./BaseGridMvtLayer";
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* 障碍物图层 - 基于MVT数据渲染障碍物网格
|
|
21
|
-
*
|
|
22
|
-
* 使用方式:
|
|
23
|
-
* ```js
|
|
24
|
-
* const DeepTwins = new DeepTwinsEngine3D.DeepTwins();
|
|
25
|
-
* DeepTwins.onLoad(async ({ gridVTLayer }) => {
|
|
26
|
-
* const barrierLayer = new BarrierLayer(viewer, {
|
|
27
|
-
* gridVTLayer: gridVTLayer,
|
|
28
|
-
* url: 'https://...',
|
|
29
|
-
* });
|
|
30
|
-
* });
|
|
31
|
-
* ```
|
|
32
22
|
*/
|
|
33
|
-
var BarrierLayer = /*#__PURE__*/function () {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
* @param map Cesium Viewer实例
|
|
37
|
-
* @param options 配置选项
|
|
38
|
-
* @param options.gridVTLayer GridVTLayer类(从DeepTwins.onLoad中获取)
|
|
39
|
-
* @param options.url MVT数据URL模板,默认为障碍物数据地址
|
|
40
|
-
* @param options.dataType 数据类型,默认为'barrier'
|
|
41
|
-
* @param options.zooms 缩放级别范围,默认[10, 22]
|
|
42
|
-
* @param options.dataZooms 数据缩放级别,默认[16, 16]
|
|
43
|
-
* @param options.cacheSize 缓存大小,默认20
|
|
44
|
-
* @param options.heightColors 高度颜色映射数组,默认使用内置颜色
|
|
45
|
-
* @param options.minHeight 最小高度(米),低于此高度的障碍物不渲染,默认0
|
|
46
|
-
* @param options.maxHeight 最大高度(米),高于此高度的障碍物不渲染,默认Infinity
|
|
47
|
-
*/
|
|
23
|
+
var BarrierLayer = /*#__PURE__*/function (_BaseGridMvtLayer) {
|
|
24
|
+
_inherits(BarrierLayer, _BaseGridMvtLayer);
|
|
25
|
+
var _super = _createSuper(BarrierLayer);
|
|
48
26
|
function BarrierLayer(map) {
|
|
49
|
-
var _this
|
|
27
|
+
var _this;
|
|
50
28
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
51
29
|
_classCallCheck(this, BarrierLayer);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
_defineProperty(this, "_options", {});
|
|
56
|
-
_defineProperty(this, "_heightColors", []);
|
|
57
|
-
this._mapContext = map._mapContext;
|
|
58
|
-
if (!options.gridVTLayer) {
|
|
59
|
-
console.error('BarrierLayer: 请提供gridVTLayer参数,可通过DeepTwins.onLoad获取');
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
var GridVTLayer = options.gridVTLayer;
|
|
63
|
-
|
|
64
|
-
// 验证并设置 dataZooms
|
|
65
|
-
var dataZooms = options.dataZooms || [16, 16];
|
|
66
|
-
if (!Array.isArray(dataZooms) || dataZooms.length !== 2) {
|
|
67
|
-
console.warn('BarrierLayer: dataZooms 应该是 [minZoom, maxZoom] 格式的数组,使用默认值 [16, 16]');
|
|
68
|
-
dataZooms = [16, 16];
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// 设置颜色配置
|
|
72
|
-
if (options.heightColors && Array.isArray(options.heightColors)) {
|
|
73
|
-
this._heightColors = options.heightColors;
|
|
74
|
-
} else {
|
|
75
|
-
this._heightColors = _toConsumableArray(BarrierLayer.DEFAULT_HEIGHT_COLORS);
|
|
76
|
-
}
|
|
77
|
-
this._options = _objectSpread({
|
|
78
|
-
url: options.url || 'https://amappc.oss-cn-zhangjiakou.aliyuncs.com/yunjing/data/dikong/barrier/mvt/{z}_{x}_{y}.mvt',
|
|
79
|
-
dataType: options.dataType || 'barrier',
|
|
80
|
-
zooms: options.zooms || [10, 22],
|
|
81
|
-
dataZooms: dataZooms,
|
|
82
|
-
cacheSize: options.cacheSize || 20,
|
|
83
|
-
minHeight: options.minHeight !== undefined ? options.minHeight : 0,
|
|
84
|
-
maxHeight: options.maxHeight !== undefined ? options.maxHeight : Infinity
|
|
85
|
-
}, options);
|
|
30
|
+
_this = _super.call(this, map, _objectSpread({
|
|
31
|
+
dataType: 'barrier'
|
|
32
|
+
}, options));
|
|
86
33
|
|
|
87
34
|
// 创建 GridVTLayer
|
|
88
|
-
|
|
35
|
+
_this.createMvtLayer({
|
|
89
36
|
createPrimitives: function createPrimitives(tileNum, renderData, viewer) {
|
|
90
37
|
var targetViewer = viewer || _this.getMap();
|
|
91
38
|
return _this._createPrimitives(tileNum, renderData, targetViewer);
|
|
@@ -102,52 +49,24 @@ var BarrierLayer = /*#__PURE__*/function () {
|
|
|
102
49
|
updatePrimitives: function updatePrimitives(tileNum, primitives) {
|
|
103
50
|
return _this._updatePrimitives(tileNum, primitives);
|
|
104
51
|
}
|
|
105
|
-
};
|
|
106
|
-
this._gridVTLayer = new GridVTLayer({
|
|
107
|
-
viewer: this.getMap(),
|
|
108
|
-
url: this._options.url,
|
|
109
|
-
cacheSize: this._options.cacheSize,
|
|
110
|
-
dataZooms: this._options.dataZooms,
|
|
111
|
-
zooms: this._options.zooms,
|
|
112
|
-
dataType: this._options.dataType,
|
|
113
|
-
customPrimitive: customPrimitiveCallbacks
|
|
114
52
|
});
|
|
115
|
-
|
|
116
|
-
// 默认显示图层
|
|
117
|
-
if (typeof this._gridVTLayer.show === 'function') {
|
|
118
|
-
this._gridVTLayer.show();
|
|
119
|
-
} else if (this._gridVTLayer.visible !== undefined) {
|
|
120
|
-
this._gridVTLayer.visible = true;
|
|
121
|
-
}
|
|
53
|
+
return _this;
|
|
122
54
|
}
|
|
123
55
|
|
|
124
|
-
|
|
56
|
+
/**
|
|
57
|
+
* 创建primitives
|
|
58
|
+
* 按照示例代码的逻辑实现,每个feature创建一个障碍物实例
|
|
59
|
+
*/
|
|
125
60
|
_createClass(BarrierLayer, [{
|
|
126
|
-
key: "_canOperate",
|
|
127
|
-
value: function _canOperate() {
|
|
128
|
-
if (this.isDestroyed) {
|
|
129
|
-
utils.error('SubmergenceAnalysis实例已销毁');
|
|
130
|
-
return false;
|
|
131
|
-
}
|
|
132
|
-
return true;
|
|
133
|
-
}
|
|
134
|
-
}, {
|
|
135
|
-
key: "getMap",
|
|
136
|
-
value: function getMap() {
|
|
137
|
-
return this._mapContext && this._mapContext.getMap();
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* 创建primitives
|
|
142
|
-
* 按照示例代码的逻辑实现,每个feature创建一个障碍物实例
|
|
143
|
-
*/
|
|
144
|
-
}, {
|
|
145
61
|
key: "_createPrimitives",
|
|
146
62
|
value: function _createPrimitives(tileNum, renderData, viewer) {
|
|
63
|
+
if (!this._isViewerReady()) {
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
147
66
|
var features = (renderData === null || renderData === void 0 ? void 0 : renderData.default) || [];
|
|
148
67
|
var instances = [];
|
|
149
|
-
var minHeight = this.
|
|
150
|
-
var maxHeight = this.
|
|
68
|
+
var minHeight = this.options.minHeight || 0;
|
|
69
|
+
var maxHeight = this.options.maxHeight !== undefined ? this.options.maxHeight : Infinity;
|
|
151
70
|
for (var i = 0; i < features.length; i++) {
|
|
152
71
|
var feature = features[i];
|
|
153
72
|
if (!feature || !feature.lnglat || !feature.gridSize) {
|
|
@@ -164,8 +83,8 @@ var BarrierLayer = /*#__PURE__*/function () {
|
|
|
164
83
|
|
|
165
84
|
// 根据高度计算颜色索引
|
|
166
85
|
var colorIndex = Math.floor(feature.lnglat[2] / 7.66 / 3);
|
|
167
|
-
var clampedIndex = Math.max(0, Math.min(colorIndex, this.
|
|
168
|
-
var color = this.
|
|
86
|
+
var clampedIndex = Math.max(0, Math.min(colorIndex, this.options.heightColors.length - 1));
|
|
87
|
+
var color = this.options.heightColors[clampedIndex] || '#d8daeb';
|
|
169
88
|
var instance = new Cesium.GeometryInstance({
|
|
170
89
|
geometry: Cesium.BoxGeometry.fromDimensions({
|
|
171
90
|
vertexFormat: Cesium.VertexFormat.POSITION_AND_NORMAL,
|
|
@@ -178,6 +97,9 @@ var BarrierLayer = /*#__PURE__*/function () {
|
|
|
178
97
|
});
|
|
179
98
|
instances.push(instance);
|
|
180
99
|
}
|
|
100
|
+
if (!this._isViewerReady() || instances.length === 0) {
|
|
101
|
+
return [];
|
|
102
|
+
}
|
|
181
103
|
var primitives = [];
|
|
182
104
|
if (instances.length > 0) {
|
|
183
105
|
var primitive = new Cesium.Primitive({
|
|
@@ -187,9 +109,11 @@ var BarrierLayer = /*#__PURE__*/function () {
|
|
|
187
109
|
closed: true
|
|
188
110
|
})
|
|
189
111
|
});
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
112
|
+
if (this._isViewerReady()) {
|
|
113
|
+
var targetViewer = viewer || this.getMap();
|
|
114
|
+
targetViewer.scene.primitives.add(primitive);
|
|
115
|
+
primitives.push(primitive);
|
|
116
|
+
}
|
|
193
117
|
}
|
|
194
118
|
return primitives;
|
|
195
119
|
}
|
|
@@ -242,57 +166,7 @@ var BarrierLayer = /*#__PURE__*/function () {
|
|
|
242
166
|
value: function _updatePrimitives(_tileNum, _primitives) {
|
|
243
167
|
// 预留接口,可根据需要实现更新逻辑
|
|
244
168
|
}
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* 显示图层
|
|
248
|
-
*/
|
|
249
|
-
}, {
|
|
250
|
-
key: "show",
|
|
251
|
-
value: function show() {
|
|
252
|
-
if (this._gridVTLayer) {
|
|
253
|
-
if (typeof this._gridVTLayer.show === 'function') {
|
|
254
|
-
this._gridVTLayer.show();
|
|
255
|
-
} else if (this._gridVTLayer.visible !== undefined) {
|
|
256
|
-
this._gridVTLayer.visible = true;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
/**
|
|
262
|
-
* 隐藏图层
|
|
263
|
-
*/
|
|
264
|
-
}, {
|
|
265
|
-
key: "hide",
|
|
266
|
-
value: function hide() {
|
|
267
|
-
if (this._gridVTLayer) {
|
|
268
|
-
this._gridVTLayer.hide();
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* 销毁图层
|
|
274
|
-
*/
|
|
275
|
-
}, {
|
|
276
|
-
key: "destroy",
|
|
277
|
-
value: function destroy() {
|
|
278
|
-
if (this._gridVTLayer) {
|
|
279
|
-
var _this$_gridVTLayer$de, _this$_gridVTLayer;
|
|
280
|
-
(_this$_gridVTLayer$de = (_this$_gridVTLayer = this._gridVTLayer).destroy) === null || _this$_gridVTLayer$de === void 0 || _this$_gridVTLayer$de.call(_this$_gridVTLayer);
|
|
281
|
-
this._gridVTLayer = null;
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
/**
|
|
286
|
-
* 获取底层GridVTLayer实例
|
|
287
|
-
*/
|
|
288
|
-
}, {
|
|
289
|
-
key: "getGridVTLayer",
|
|
290
|
-
value: function getGridVTLayer() {
|
|
291
|
-
return this._gridVTLayer;
|
|
292
|
-
}
|
|
293
169
|
}]);
|
|
294
170
|
return BarrierLayer;
|
|
295
|
-
}();
|
|
296
|
-
|
|
297
|
-
_defineProperty(BarrierLayer, "DEFAULT_HEIGHT_COLORS", ['#9e0142', '#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#e6f598', '#abdda4', '#66c2a5', '#3288bd', '#5e4fa2'].reverse());
|
|
298
|
-
export { BarrierLayer as default };
|
|
171
|
+
}(BaseGridMvtLayer);
|
|
172
|
+
export default BarrierLayer;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
declare class BaseGridMvtLayer {
|
|
2
|
+
private readonly _mapContext;
|
|
3
|
+
isDestroyed: boolean;
|
|
4
|
+
options: any;
|
|
5
|
+
_gridVTLayer: any;
|
|
6
|
+
/**
|
|
7
|
+
* 创建网格mvt图层
|
|
8
|
+
* @param map Cesium Viewer实例
|
|
9
|
+
* @param options 配置选项
|
|
10
|
+
* @param options.gridVTLayer GridVTLayer类(从DeepTwins.onLoad中获取)
|
|
11
|
+
* @param options.url MVT数据URL模板,默认为障碍物数据地址
|
|
12
|
+
* @param options.dataType 数据类型,默认为'flow'
|
|
13
|
+
* @param options.zooms 缩放级别范围,默认[10, 22]
|
|
14
|
+
* @param options.dataZooms 数据缩放级别,默认[16, 16]
|
|
15
|
+
* @param options.cacheSize 缓存大小,默认20
|
|
16
|
+
* @param options.heightColors 高度颜色映射数组,默认使用内置颜色
|
|
17
|
+
* @param options.minHeight 最小高度(米),低于此高度的障碍物不渲染,默认0
|
|
18
|
+
* @param options.maxHeight 最大高度(米),高于此高度的障碍物不渲染,默认Infinity
|
|
19
|
+
*/
|
|
20
|
+
constructor(map: any, options?: any);
|
|
21
|
+
createMvtLayer(customPrimitive: any): void;
|
|
22
|
+
private _canOperate;
|
|
23
|
+
getMap(): any;
|
|
24
|
+
_isViewerReady(): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* 显示/隐藏图层
|
|
27
|
+
*/
|
|
28
|
+
show(isShow: boolean): void;
|
|
29
|
+
/**
|
|
30
|
+
* 销毁图层
|
|
31
|
+
*/
|
|
32
|
+
destroy(): void;
|
|
33
|
+
}
|
|
34
|
+
export default BaseGridMvtLayer;
|