@ino-cesium/common 0.0.23 → 0.0.25-beta.0
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/index.d.ts +411 -307
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,74 +1,26 @@
|
|
|
1
1
|
import * as Cesium from 'cesium';
|
|
2
2
|
import { FeatureCollection, Point, GeoJsonProperties, LineString, Polygon } from 'geojson';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
height?: number;
|
|
8
|
-
viewer: Cesium.Viewer;
|
|
9
|
-
}
|
|
10
|
-
interface ISetViewByPositionOptions {
|
|
11
|
-
position: Cesium.Cartesian3;
|
|
12
|
-
viewer: Cesium.Viewer;
|
|
13
|
-
}
|
|
14
|
-
interface ICamearView {
|
|
15
|
-
destination: Cesium.Cartesian3;
|
|
16
|
-
orientation: {
|
|
17
|
-
heading: number;
|
|
18
|
-
pitch: number;
|
|
19
|
-
roll: number;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
interface ICesiumEventListener {
|
|
23
|
-
LEFT_CLICK?: (e: any) => void;
|
|
24
|
-
LEFT_POSITION?: (e: any) => void;
|
|
25
|
-
MOVE_POSITION?: (e: any) => void;
|
|
26
|
-
PICK_FEATURE?: (pickModel: any, feature: any) => void;
|
|
27
|
-
MOVE_PICK_FEATURE?: (pickModel: any, feature: any) => void;
|
|
28
|
-
}
|
|
4
|
+
/**
|
|
5
|
+
* @module 类型定义
|
|
6
|
+
*/
|
|
29
7
|
type DeepPartial<T> = {
|
|
30
8
|
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
31
9
|
};
|
|
32
10
|
|
|
33
|
-
interface ISkyBoxSources {
|
|
34
|
-
positiveX: string;
|
|
35
|
-
negativeX: string;
|
|
36
|
-
positiveY: string;
|
|
37
|
-
negativeY: string;
|
|
38
|
-
positiveZ: string;
|
|
39
|
-
negativeZ: string;
|
|
40
|
-
}
|
|
41
|
-
interface ISkyBoxOptions {
|
|
42
|
-
viewer: Cesium.Viewer;
|
|
43
|
-
sources?: ISkyBoxSources;
|
|
44
|
-
}
|
|
45
|
-
interface ISkyBoxOnGroundOptions extends ISkyBoxOptions {
|
|
46
|
-
height?: number;
|
|
47
|
-
}
|
|
48
|
-
interface IYawPitchRoll {
|
|
49
|
-
yaw: number;
|
|
50
|
-
pitch: number;
|
|
51
|
-
roll: number;
|
|
52
|
-
offsetYaw?: number;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
11
|
type types_DeepPartial<T> = DeepPartial<T>;
|
|
56
|
-
type types_ICamearView = ICamearView;
|
|
57
|
-
type types_ICesiumEventListener = ICesiumEventListener;
|
|
58
|
-
type types_ISetViewByLngLatOptions = ISetViewByLngLatOptions;
|
|
59
|
-
type types_ISetViewByPositionOptions = ISetViewByPositionOptions;
|
|
60
|
-
type types_ISkyBoxOnGroundOptions = ISkyBoxOnGroundOptions;
|
|
61
|
-
type types_ISkyBoxOptions = ISkyBoxOptions;
|
|
62
|
-
type types_ISkyBoxSources = ISkyBoxSources;
|
|
63
|
-
type types_IYawPitchRoll = IYawPitchRoll;
|
|
64
12
|
declare namespace types {
|
|
65
|
-
export type { types_DeepPartial as DeepPartial
|
|
13
|
+
export type { types_DeepPartial as DeepPartial };
|
|
66
14
|
}
|
|
67
15
|
|
|
16
|
+
/**
|
|
17
|
+
* @module 初始化
|
|
18
|
+
*/
|
|
19
|
+
|
|
68
20
|
/**
|
|
69
21
|
* 初始化Cesium
|
|
70
22
|
* @param eleId DOM元素ID
|
|
71
|
-
* @param options Viewer.ConstructorOptions
|
|
23
|
+
* @param {Cesium.Viewer.ConstructorOptions} options Cesium.Viewer.ConstructorOptions
|
|
72
24
|
*/
|
|
73
25
|
declare const initCesium: (eleId: string, options?: Cesium.Viewer.ConstructorOptions & {
|
|
74
26
|
token?: string;
|
|
@@ -88,8 +40,15 @@ declare const setGlobeEnabled: (viewer: Cesium.Viewer, enabled: boolean) => void
|
|
|
88
40
|
declare const setGlobeOpatity: (value: number, viewer: Cesium.Viewer) => void;
|
|
89
41
|
declare const setCesiumForAutoFitScale: (value: number) => void;
|
|
90
42
|
declare const getCesiumForAutoFitScale: () => number;
|
|
43
|
+
/**
|
|
44
|
+
* 初始化时默认参数
|
|
45
|
+
*/
|
|
91
46
|
declare const DefaultViewerOptions: Cesium.Viewer.ConstructorOptions;
|
|
92
47
|
|
|
48
|
+
/**
|
|
49
|
+
* @module 相机视角控制
|
|
50
|
+
*/
|
|
51
|
+
|
|
93
52
|
/**
|
|
94
53
|
* 设置中心点
|
|
95
54
|
* @param options.lng 精度
|
|
@@ -108,18 +67,16 @@ declare const setViewToLnglat: (options: ISetViewByLngLatOptions) => void;
|
|
|
108
67
|
declare const flyToLnglat: (options: ISetViewByLngLatOptions) => void;
|
|
109
68
|
/**
|
|
110
69
|
* 飞行至中心点
|
|
111
|
-
* @param options.
|
|
112
|
-
* @param options.lat 纬度
|
|
113
|
-
* @param options.height 高度
|
|
70
|
+
* @param options.position 笛卡尔点
|
|
114
71
|
* @param options.viewer Cesium Viewer 实例
|
|
115
72
|
*/
|
|
116
73
|
declare const flyToPosition: (options: ISetViewByPositionOptions) => void;
|
|
117
74
|
/**
|
|
118
75
|
* 获取相机视图
|
|
119
76
|
* @param viewer
|
|
120
|
-
* @returns
|
|
77
|
+
* @returns cameraView
|
|
121
78
|
*
|
|
122
|
-
*
|
|
79
|
+
* cameraView: {
|
|
123
80
|
* destination: Cartesian3,
|
|
124
81
|
* orientation: {
|
|
125
82
|
* heading: number
|
|
@@ -128,11 +85,11 @@ declare const flyToPosition: (options: ISetViewByPositionOptions) => void;
|
|
|
128
85
|
* }
|
|
129
86
|
* }
|
|
130
87
|
*/
|
|
131
|
-
declare function getCameraView(viewer: Cesium.Viewer):
|
|
88
|
+
declare function getCameraView(viewer: Cesium.Viewer): ICameraView;
|
|
132
89
|
/**
|
|
133
90
|
*
|
|
134
|
-
* @param
|
|
135
|
-
*
|
|
91
|
+
* @param cameraView
|
|
92
|
+
* cameraView: {
|
|
136
93
|
* destination: Cartesian3
|
|
137
94
|
* orientation: {
|
|
138
95
|
* heading: number
|
|
@@ -142,7 +99,7 @@ declare function getCameraView(viewer: Cesium.Viewer): ICamearView;
|
|
|
142
99
|
* }
|
|
143
100
|
* @param viewer
|
|
144
101
|
*/
|
|
145
|
-
declare function flyToCameraView(
|
|
102
|
+
declare function flyToCameraView(cameraView: ICameraView, viewer: Cesium.Viewer): void;
|
|
146
103
|
/**
|
|
147
104
|
* 飞行至数据源
|
|
148
105
|
* @param dataScourceId 数据源id
|
|
@@ -202,6 +159,28 @@ declare const flyByRotateOut: (viewer: Cesium.Viewer) => {
|
|
|
202
159
|
*/
|
|
203
160
|
declare function twinkleModel(model: any): void;
|
|
204
161
|
declare const setCameraAutoBackTiltToZero: (viewer: Cesium.Viewer, distance?: number) => void;
|
|
162
|
+
interface ICameraView {
|
|
163
|
+
destination: Cesium.Cartesian3;
|
|
164
|
+
orientation: {
|
|
165
|
+
heading: number;
|
|
166
|
+
pitch: number;
|
|
167
|
+
roll: number;
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
interface ISetViewByLngLatOptions {
|
|
171
|
+
lng: number;
|
|
172
|
+
lat: number;
|
|
173
|
+
height?: number;
|
|
174
|
+
viewer: Cesium.Viewer;
|
|
175
|
+
}
|
|
176
|
+
interface ISetViewByPositionOptions {
|
|
177
|
+
position: Cesium.Cartesian3;
|
|
178
|
+
viewer: Cesium.Viewer;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* @module 事件统一处理
|
|
183
|
+
*/
|
|
205
184
|
|
|
206
185
|
/**
|
|
207
186
|
* 初始化cesium事件
|
|
@@ -209,27 +188,63 @@ declare const setCameraAutoBackTiltToZero: (viewer: Cesium.Viewer, distance?: nu
|
|
|
209
188
|
* @param eventListener
|
|
210
189
|
*/
|
|
211
190
|
declare const initCesiumEvent: (viewer: Cesium.Viewer, eventListener: ICesiumEventListener) => void;
|
|
191
|
+
interface ICesiumEventListener {
|
|
192
|
+
LEFT_CLICK?: (e: any) => void;
|
|
193
|
+
LEFT_POSITION?: (e: any) => void;
|
|
194
|
+
MOVE_POSITION?: (e: any) => void;
|
|
195
|
+
PICK_FEATURE?: (pickModel: any, feature: any) => void;
|
|
196
|
+
MOVE_PICK_FEATURE?: (pickModel: any, feature: any) => void;
|
|
197
|
+
}
|
|
212
198
|
|
|
213
|
-
declare const numberId: () => string;
|
|
214
|
-
declare const getInoCesiumBaseUrl: () => any;
|
|
215
199
|
/**
|
|
216
|
-
*
|
|
217
|
-
* @param ms
|
|
200
|
+
* @momodule 底部状态栏
|
|
218
201
|
*/
|
|
219
|
-
declare const delayTime: (ms: number) => Promise<unknown>;
|
|
220
202
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
203
|
+
/**
|
|
204
|
+
* 创建底部状态栏
|
|
205
|
+
* @param options
|
|
206
|
+
* @param options.viewer
|
|
207
|
+
* @param {boolean} options.hpr 显示方向角、俯仰角、侧翻角
|
|
208
|
+
* @param {boolean} options.clickCopy 开启点击复制
|
|
209
|
+
*/
|
|
210
|
+
declare const createBottomStatusBar: (options: IBottomStatusBarOptions) => void;
|
|
211
|
+
interface IBottomStatusBarOptions {
|
|
212
|
+
viewer: Cesium.Viewer;
|
|
213
|
+
/**
|
|
214
|
+
* 显示方向角、俯仰角、侧翻角
|
|
215
|
+
*/
|
|
216
|
+
hpr?: boolean;
|
|
217
|
+
/**
|
|
218
|
+
* 开启点击复制
|
|
219
|
+
* 复制当前中心经纬度和高度,相机视角
|
|
220
|
+
*/
|
|
221
|
+
clickCopy?: boolean;
|
|
231
222
|
}
|
|
232
223
|
|
|
224
|
+
/**
|
|
225
|
+
* @module 鹰眼图
|
|
226
|
+
*/
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* 创建鹰眼图
|
|
230
|
+
* @param eleId
|
|
231
|
+
* @param mainViewer
|
|
232
|
+
*/
|
|
233
|
+
declare const createEagleEye: (eleId: string, mainViewer: Cesium.Viewer) => {
|
|
234
|
+
viewer: Cesium.Viewer;
|
|
235
|
+
open: () => void;
|
|
236
|
+
close: () => void;
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* @module 气泡
|
|
241
|
+
*/
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* 气泡
|
|
245
|
+
*
|
|
246
|
+
* 使用Popup.createPopup()单例调用
|
|
247
|
+
*/
|
|
233
248
|
declare class Popup {
|
|
234
249
|
static popup: Popup | null;
|
|
235
250
|
private _div;
|
|
@@ -240,32 +255,13 @@ declare class Popup {
|
|
|
240
255
|
showAt(position: Cesium.Cartesian3): void;
|
|
241
256
|
setVisible(visible: boolean): void;
|
|
242
257
|
renderPosition(): void;
|
|
243
|
-
static
|
|
258
|
+
static createPopup(viewer: Cesium.Viewer, element: HTMLElement, offset?: Cesium.Cartesian2): Popup;
|
|
244
259
|
destroy(): void;
|
|
245
260
|
}
|
|
246
261
|
|
|
247
262
|
/**
|
|
248
|
-
*
|
|
249
|
-
* @param count 点数量
|
|
250
|
-
* @param lngRange 精度范围
|
|
251
|
-
* @param latRange 纬度范围
|
|
252
|
-
* @returns
|
|
253
|
-
*/
|
|
254
|
-
declare const randomPointToGeoJson: (count: number, lngRange?: number[], latRange?: number[]) => FeatureCollection<Point, GeoJsonProperties>;
|
|
255
|
-
declare function randomColor(): string;
|
|
256
|
-
declare const randomPolylineToGeoJson: (count: number, lngRange?: number[], latRange?: number[]) => FeatureCollection<LineString, GeoJsonProperties>;
|
|
257
|
-
declare const randomPolygonToGeoJson: (count: number, lngRange?: number[], latRange?: number[]) => FeatureCollection<Polygon, GeoJsonProperties>;
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* 创建鹰眼图
|
|
261
|
-
* @param eleId
|
|
262
|
-
* @param mainViewer
|
|
263
|
+
* @卷帘 处理器
|
|
263
264
|
*/
|
|
264
|
-
declare const createEagleEye: (eleId: string, mainViewer: Cesium.Viewer) => {
|
|
265
|
-
viewer: Cesium.Viewer;
|
|
266
|
-
open: () => void;
|
|
267
|
-
close: () => void;
|
|
268
|
-
};
|
|
269
265
|
|
|
270
266
|
/**
|
|
271
267
|
* 创建卷帘handler
|
|
@@ -278,6 +274,10 @@ declare const createRollerShutterHandler: (viewer: Cesium.Viewer) => {
|
|
|
278
274
|
setSplitDirection: (layer: Cesium.ImageryLayer | Cesium.Cesium3DTileset, direction: Cesium.SplitDirection) => void;
|
|
279
275
|
};
|
|
280
276
|
|
|
277
|
+
/**
|
|
278
|
+
* @module 分屏处理器
|
|
279
|
+
*/
|
|
280
|
+
|
|
281
281
|
/**
|
|
282
282
|
* 创建卷帘handler
|
|
283
283
|
* @param viewer
|
|
@@ -293,98 +293,20 @@ declare const createSplitScreenHandler: (viewer: Cesium.Viewer) => {
|
|
|
293
293
|
};
|
|
294
294
|
|
|
295
295
|
/**
|
|
296
|
-
|
|
297
|
-
* @param {Cartesian3} start - 起始点
|
|
298
|
-
* @param {Cartesian3} end - 结束点
|
|
299
|
-
* @returns {number} - 两点之间的空间距离
|
|
300
|
-
*/
|
|
301
|
-
declare const calcSpaceDistance: (start: Cesium.Cartesian3, end: Cesium.Cartesian3) => number;
|
|
302
|
-
/**
|
|
303
|
-
* 计算空间距离-多点
|
|
304
|
-
* @param {Cartesian3[]} positions - 点集
|
|
305
|
-
*/
|
|
306
|
-
declare function calcSpaceDistances(positions: Cesium.Cartesian3[]): number;
|
|
307
|
-
/**
|
|
308
|
-
* 计算贴地距离-两点
|
|
309
|
-
* @param {Cartesian3} start - 起始点
|
|
310
|
-
* @param {Cartesian3} end - 结束点
|
|
311
|
-
* @param {ellipsoid} Cesium.Ellipsoid
|
|
312
|
-
*/
|
|
313
|
-
declare function calcGeodesicDistance(start: Cesium.Cartesian3, end: Cesium.Cartesian3, ellipsoid?: Cesium.Ellipsoid): number;
|
|
314
|
-
/**
|
|
315
|
-
* 计算贴地距离-多点
|
|
316
|
-
* @param {Cartesian3[]} positions - 点集
|
|
317
|
-
* @returns {number} - 总距离
|
|
318
|
-
*/
|
|
319
|
-
declare function calcGeodesicDistances(positions: Cesium.Cartesian3[]): number;
|
|
320
|
-
/**
|
|
321
|
-
* 计算质心
|
|
322
|
-
* turf Centroid
|
|
323
|
-
* @param {Cartesian3[]} positions - 点集
|
|
324
|
-
* @returns {Cartesian3} - 质心点
|
|
325
|
-
*/
|
|
326
|
-
declare const calcPoistionCenter: (positions: Cesium.Cartesian3[]) => Cesium.Cartesian3;
|
|
327
|
-
/**
|
|
328
|
-
* 计算面积
|
|
329
|
-
* @param {Cartesian3[]} positions - 点集
|
|
330
|
-
* @returns {number} - 面积 单位:平方米
|
|
331
|
-
*/
|
|
332
|
-
declare function calcArea(positions: Array<Cesium.Cartesian3>): number;
|
|
333
|
-
/**
|
|
334
|
-
* 计算三角形面积
|
|
335
|
-
* @param {Cartesian3} vertexA - 三角形顶点A
|
|
336
|
-
* @param {Cartesian3} vertexB - 三角形顶点B
|
|
337
|
-
* @param {Cartesian3} vertexC - 三角形顶点C
|
|
338
|
-
* @returns {number} - 三角形面积
|
|
339
|
-
*/
|
|
340
|
-
declare const calcTriangleArea: (vertexA: Cesium.Cartesian3, vertexB: Cesium.Cartesian3, vertexC: Cesium.Cartesian3) => number;
|
|
341
|
-
/**
|
|
342
|
-
* 计算地形高度
|
|
343
|
-
* @param {TerrainProvider} terrainProvider - 地形提供者
|
|
344
|
-
* @param {Cartesian3[]} positions - 点集
|
|
345
|
-
* @returns {Cartesian3[]} - 地形高度点集
|
|
346
|
-
*/
|
|
347
|
-
declare const calcTerrainHeightFromPositions: (terrainProvider: Cesium.TerrainProvider, positions: Cesium.Cartesian3[]) => Promise<Cesium.Cartographic[]>;
|
|
348
|
-
/**
|
|
349
|
-
* 计算场景高度
|
|
350
|
-
* @param {TerrainProvider} viewer
|
|
351
|
-
* @param {Cartesian3[]} positions - 点集
|
|
352
|
-
* @returns {Cartesian3[]} - 地形高度点集
|
|
353
|
-
*/
|
|
354
|
-
declare const calcSceneHeightFromPositions: (viewer: Cesium.Viewer, positions: Cesium.Cartesian3[]) => Promise<Cesium.Cartesian3[]>;
|
|
355
|
-
/**
|
|
356
|
-
* 计算抛物线点集,
|
|
357
|
-
* @param {Cartesian3} startPoint - 开始节点
|
|
358
|
-
* @param {Cartesian3} endPoint - 结束节点
|
|
359
|
-
* @param {number} angularityFactor - 曲率
|
|
360
|
-
* @param {number} numOfSingleLine - 点集数量
|
|
361
|
-
* @returns {Cartesian3[]} - 点集
|
|
362
|
-
*/
|
|
363
|
-
declare const clacPositionsForParabola: (startPoint: Cesium.Cartesian3, endPoint: Cesium.Cartesian3, angularityFactor: number, numOfSingleLine: number) => Cesium.Cartesian3[];
|
|
364
|
-
/**
|
|
365
|
-
* 计算缩放级别,
|
|
366
|
-
* 把当前相机高度转为缩放级别
|
|
367
|
-
* @param {Camera} camera - 相机
|
|
368
|
-
*/
|
|
369
|
-
declare const calcZoomFromCameraHeight: (camera: Cesium.Camera) => number;
|
|
370
|
-
/**
|
|
371
|
-
* 计算相机高度
|
|
372
|
-
* 把缩放级别转为相机高度
|
|
373
|
-
* @无效
|
|
374
|
-
*/
|
|
375
|
-
declare const calcCameraHeightFromZoom: (zoom: number) => number;
|
|
376
|
-
/**
|
|
377
|
-
* 计算插值点集
|
|
378
|
-
* @param positions Cartesian3[]
|
|
379
|
-
* @param number 插值点数量
|
|
380
|
-
* @returns Cartesian3[]
|
|
381
|
-
*/
|
|
382
|
-
declare const calcLerpPosition: (positions: Cesium.Cartesian3[], number: number) => Cesium.Cartesian3[];
|
|
383
|
-
/**
|
|
384
|
-
* 根据一组笛卡尔坐标计算包围球
|
|
385
|
-
* @param positions 笛卡尔坐标组
|
|
296
|
+
*@module tooltip
|
|
386
297
|
*/
|
|
387
|
-
|
|
298
|
+
|
|
299
|
+
declare class Tooltip {
|
|
300
|
+
static tooltip: Tooltip | null;
|
|
301
|
+
private _title;
|
|
302
|
+
private _div;
|
|
303
|
+
private _message;
|
|
304
|
+
constructor(viewer: Cesium.Viewer);
|
|
305
|
+
showAt(position: Cesium.Cartesian2, message: string): void;
|
|
306
|
+
setVisible(visible: boolean): void;
|
|
307
|
+
static createToolTip(viewer: Cesium.Viewer): Tooltip;
|
|
308
|
+
destroy(): void;
|
|
309
|
+
}
|
|
388
310
|
|
|
389
311
|
declare abstract class BasePrimitive<T> {
|
|
390
312
|
protected _primitive: CusPrimitive;
|
|
@@ -423,72 +345,46 @@ declare abstract class BaseMaterialProperty {
|
|
|
423
345
|
}
|
|
424
346
|
|
|
425
347
|
/**
|
|
426
|
-
*
|
|
348
|
+
* 创建天空盒
|
|
349
|
+
* @param options
|
|
427
350
|
*/
|
|
428
|
-
declare const
|
|
351
|
+
declare const createSkyBox: (options: ISkyBoxOptions) => Cesium.SkyBox;
|
|
429
352
|
/**
|
|
430
|
-
*
|
|
353
|
+
* 创建近地天空盒
|
|
354
|
+
* @param options
|
|
431
355
|
*/
|
|
432
|
-
declare const
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
declare const makeLnglatToPosition: (lnglat: Cesium.Cartographic) => Cesium.Cartesian3;
|
|
449
|
-
/**
|
|
450
|
-
* 点集闭合成面 首位相接
|
|
451
|
-
*/
|
|
452
|
-
declare const makePositionsClose: (positions: Cesium.Cartesian3[]) => Cesium.Cartesian3[];
|
|
453
|
-
/**
|
|
454
|
-
* 把经纬度数组转为点数据的geojson集合
|
|
455
|
-
* @param lnglats
|
|
456
|
-
* @returns GeoJSON.FeatureCollection
|
|
457
|
-
*/
|
|
458
|
-
declare const makeLnglatsToPointGeojson: (lnglats: Cesium.Cartographic[]) => GeoJSON.FeatureCollection;
|
|
459
|
-
/**
|
|
460
|
-
* 把经纬度数组转为线数据的geojson集合
|
|
461
|
-
* @param lnglats
|
|
462
|
-
* @returns GeoJSON.FeatureCollection
|
|
463
|
-
*/
|
|
464
|
-
declare const makeLnglatsToLineGeojson: (lnglats: Cesium.Cartographic[]) => GeoJSON.FeatureCollection;
|
|
465
|
-
/**
|
|
466
|
-
* 把经纬度数组转为面数据的geojson集合
|
|
467
|
-
* @param lnglats
|
|
468
|
-
* @returns GeoJSON.FeatureCollection
|
|
469
|
-
*/
|
|
470
|
-
declare const makeLnglatsToPolygonGeojson: (lnglats: Cesium.Cartographic[]) => GeoJSON.FeatureCollection;
|
|
471
|
-
/**
|
|
472
|
-
* 把yawPitchRoll转为headingPitchRoll
|
|
473
|
-
* 航空中的参数和cesium中的参数有区别 角度转弧度
|
|
474
|
-
* @param yawPitchRoll
|
|
475
|
-
*/
|
|
476
|
-
declare const makeYawPitchRollToHeadingPitchRoll: (yawPitchRoll: IYawPitchRoll) => {
|
|
477
|
-
heading: number;
|
|
478
|
-
pitch: number;
|
|
479
|
-
roll: number;
|
|
480
|
-
};
|
|
356
|
+
declare const createSkyBoxOnGround: (options: ISkyBoxOnGroundOptions) => void;
|
|
357
|
+
interface ISkyBoxSources {
|
|
358
|
+
positiveX: string;
|
|
359
|
+
negativeX: string;
|
|
360
|
+
positiveY: string;
|
|
361
|
+
negativeY: string;
|
|
362
|
+
positiveZ: string;
|
|
363
|
+
negativeZ: string;
|
|
364
|
+
}
|
|
365
|
+
interface ISkyBoxOptions {
|
|
366
|
+
viewer: Cesium.Viewer;
|
|
367
|
+
sources?: ISkyBoxSources;
|
|
368
|
+
}
|
|
369
|
+
interface ISkyBoxOnGroundOptions extends ISkyBoxOptions {
|
|
370
|
+
height?: number;
|
|
371
|
+
}
|
|
481
372
|
|
|
482
373
|
/**
|
|
483
|
-
*
|
|
484
|
-
* @param options
|
|
374
|
+
* 近景天空盒
|
|
375
|
+
* @param {object} options - 参数。
|
|
376
|
+
* @param {object} options.sources - 近地天空盒来源。
|
|
485
377
|
*/
|
|
486
|
-
declare
|
|
378
|
+
declare class SkyBoxOnGround {
|
|
379
|
+
constructor(options: any);
|
|
380
|
+
update(frameState: any, useHdr: any): any;
|
|
381
|
+
isDestroyed(): boolean;
|
|
382
|
+
destroy(): void;
|
|
383
|
+
}
|
|
384
|
+
|
|
487
385
|
/**
|
|
488
|
-
*
|
|
489
|
-
* @param options
|
|
386
|
+
* @module 漫游处理器
|
|
490
387
|
*/
|
|
491
|
-
declare const createSkyBoxOnGround: (options: ISkyBoxOnGroundOptions) => void;
|
|
492
388
|
|
|
493
389
|
/**
|
|
494
390
|
* 漫游控制器
|
|
@@ -496,7 +392,7 @@ declare const createSkyBoxOnGround: (options: ISkyBoxOnGroundOptions) => void;
|
|
|
496
392
|
*
|
|
497
393
|
*/
|
|
498
394
|
declare const createRoamHandler: (viewer: Cesium.Viewer) => IRoamHandler;
|
|
499
|
-
interface
|
|
395
|
+
interface IRoamSetOptions {
|
|
500
396
|
/**
|
|
501
397
|
* 唯一id, 默认为随机生成
|
|
502
398
|
*/
|
|
@@ -508,22 +404,7 @@ interface IRoamOptions {
|
|
|
508
404
|
/**
|
|
509
405
|
* 飞行器参数
|
|
510
406
|
*/
|
|
511
|
-
flyParams:
|
|
512
|
-
/**
|
|
513
|
-
* 漫游时间数组 以时间计算飞行速度 数组长度必须与漫游路径点数组长度相同
|
|
514
|
-
* 与spped二者取其一 时间优先
|
|
515
|
-
*/
|
|
516
|
-
times?: number[];
|
|
517
|
-
/**
|
|
518
|
-
* 漫游速度 公里/每小时
|
|
519
|
-
* 与times二者取其一
|
|
520
|
-
*/
|
|
521
|
-
speed?: number;
|
|
522
|
-
/**
|
|
523
|
-
* 飞行器的heading pitch roll
|
|
524
|
-
*/
|
|
525
|
-
hpr?: IRoamItemHPR[];
|
|
526
|
-
};
|
|
407
|
+
flyParams: IRoamFlyParam;
|
|
527
408
|
/**
|
|
528
409
|
* 漫游目标 可跟随物体和漫游路线设置
|
|
529
410
|
*/
|
|
@@ -532,16 +413,23 @@ interface IRoamOptions {
|
|
|
532
413
|
* 是否循环
|
|
533
414
|
*/
|
|
534
415
|
loop: boolean;
|
|
535
|
-
/**
|
|
536
|
-
* 漫游目标属性信息
|
|
537
|
-
*/
|
|
538
|
-
attrs?: any;
|
|
539
416
|
}
|
|
540
417
|
/**
|
|
541
418
|
* 漫游控制器
|
|
542
419
|
*/
|
|
543
420
|
interface IRoamHandler {
|
|
544
|
-
|
|
421
|
+
/**
|
|
422
|
+
* 设置漫游
|
|
423
|
+
* @param {IRoamSetOptions} options
|
|
424
|
+
* @param {string} options.id
|
|
425
|
+
* @param {IRoamFlyParam} options.flyParams 飞行器参数
|
|
426
|
+
* - flyParams.times 漫游时间毫秒值数组 以时间计算飞行速度 数组长度必须与漫游路径点数组长度相同 与spped二者取其一
|
|
427
|
+
* - flyParams.speed 漫游速度 公里/每小时
|
|
428
|
+
* - flyParams.hpr 飞行器的heading pitch roll
|
|
429
|
+
* @param options.entity 漫游目标 可跟随物体和漫游路线设置
|
|
430
|
+
* @param options.loop 是否循环
|
|
431
|
+
*/
|
|
432
|
+
set: (options: IRoamSetOptions) => IRoamItem;
|
|
545
433
|
/**
|
|
546
434
|
* 漫游目标跟随
|
|
547
435
|
* @param roamItem
|
|
@@ -570,7 +458,7 @@ interface IRoamHandler {
|
|
|
570
458
|
*/
|
|
571
459
|
updateRoamAttitude: (roamItem: IRoamItem, flyAttitude: FlyAttitude) => void;
|
|
572
460
|
}
|
|
573
|
-
interface IRoamItem extends
|
|
461
|
+
interface IRoamItem extends IRoamSetOptions {
|
|
574
462
|
/**
|
|
575
463
|
* 漫游路径
|
|
576
464
|
*/
|
|
@@ -634,21 +522,31 @@ interface IRoamItemHPR {
|
|
|
634
522
|
pitch: number;
|
|
635
523
|
roll: number;
|
|
636
524
|
}
|
|
637
|
-
|
|
638
|
-
declare const createBottomStatusBar: (options: IBottomStatusBarOptions) => void;
|
|
639
|
-
interface IBottomStatusBarOptions {
|
|
640
|
-
viewer: Cesium.Viewer;
|
|
525
|
+
interface IRoamFlyParam {
|
|
641
526
|
/**
|
|
642
|
-
*
|
|
527
|
+
* 漫游时间数组 以时间计算飞行速度 数组长度必须与漫游路径点数组长度相同
|
|
528
|
+
* 与spped二者取其一 时间优先
|
|
643
529
|
*/
|
|
644
|
-
|
|
530
|
+
times?: number[];
|
|
645
531
|
/**
|
|
646
|
-
*
|
|
647
|
-
*
|
|
532
|
+
* 漫游速度 公里/每小时
|
|
533
|
+
* 与times二者取其一
|
|
648
534
|
*/
|
|
649
|
-
|
|
535
|
+
speed?: number;
|
|
536
|
+
/**
|
|
537
|
+
* 飞行器的heading pitch roll
|
|
538
|
+
*/
|
|
539
|
+
hpr?: IRoamItemHPR[];
|
|
650
540
|
}
|
|
651
541
|
|
|
542
|
+
/**
|
|
543
|
+
* @module 开场动画
|
|
544
|
+
*/
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* 开场动画
|
|
548
|
+
* @param options
|
|
549
|
+
*/
|
|
652
550
|
declare const createOpenAnim: (options: IOpenAnimOptions) => Promise<unknown>;
|
|
653
551
|
interface IOpenAnimOptions {
|
|
654
552
|
viewer: Cesium.Viewer;
|
|
@@ -660,35 +558,97 @@ interface IOpenAnimOptions {
|
|
|
660
558
|
}
|
|
661
559
|
|
|
662
560
|
/**
|
|
663
|
-
*
|
|
664
|
-
*
|
|
665
|
-
*
|
|
666
|
-
* @
|
|
561
|
+
* 计算空间两点距离
|
|
562
|
+
* @param {Cartesian3} start - 起始点
|
|
563
|
+
* @param {Cartesian3} end - 结束点
|
|
564
|
+
* @returns {number} - 两点之间的空间距离
|
|
667
565
|
*/
|
|
668
|
-
declare const
|
|
566
|
+
declare const calcSpaceDistance: (start: Cesium.Cartesian3, end: Cesium.Cartesian3) => number;
|
|
669
567
|
/**
|
|
670
|
-
*
|
|
671
|
-
*
|
|
672
|
-
* @param
|
|
673
|
-
* @param gridId 网格id
|
|
568
|
+
* 计算空间距离多点
|
|
569
|
+
* - 单位为米
|
|
570
|
+
* @param {Cartesian3[]} positions - 点集
|
|
674
571
|
*/
|
|
675
|
-
declare
|
|
572
|
+
declare function calcSpaceDistances(positions: Cesium.Cartesian3[]): number;
|
|
676
573
|
/**
|
|
677
|
-
*
|
|
678
|
-
* @param
|
|
679
|
-
* @param
|
|
574
|
+
* 计算贴地距离-两点
|
|
575
|
+
* @param {Cartesian3} start - 起始点
|
|
576
|
+
* @param {Cartesian3} end - 结束点
|
|
577
|
+
* @param {Cesium.ellipsoid} ellipsoid 椭球体
|
|
680
578
|
*/
|
|
681
|
-
declare
|
|
579
|
+
declare function calcGeodesicDistance(start: Cesium.Cartesian3, end: Cesium.Cartesian3, ellipsoid?: Cesium.Ellipsoid): number;
|
|
682
580
|
/**
|
|
683
|
-
*
|
|
684
|
-
* @param
|
|
685
|
-
* @
|
|
686
|
-
* @param bottomRight
|
|
687
|
-
* @param bottomLeft
|
|
688
|
-
* @param minHeight
|
|
689
|
-
* @param maxHeight
|
|
581
|
+
* 计算贴地距离-多点
|
|
582
|
+
* @param {Cartesian3[]} positions - 点集
|
|
583
|
+
* @returns {number} - 总距离
|
|
690
584
|
*/
|
|
691
|
-
declare
|
|
585
|
+
declare function calcGeodesicDistances(positions: Cesium.Cartesian3[]): number;
|
|
586
|
+
/**
|
|
587
|
+
* 计算质心
|
|
588
|
+
* turf Centroid
|
|
589
|
+
* @param {Cartesian3[]} positions - 点集
|
|
590
|
+
* @returns {Cartesian3} - 质心点
|
|
591
|
+
*/
|
|
592
|
+
declare const calcPoistionCenter: (positions: Cesium.Cartesian3[]) => Cesium.Cartesian3;
|
|
593
|
+
/**
|
|
594
|
+
* 计算面积
|
|
595
|
+
* @param {Cartesian3[]} positions - 点集
|
|
596
|
+
* @returns {number} 面积 单位:平方米
|
|
597
|
+
*/
|
|
598
|
+
declare function calcArea(positions: Array<Cesium.Cartesian3>): number;
|
|
599
|
+
/**
|
|
600
|
+
* 计算三角形面积
|
|
601
|
+
* @param {Cartesian3} vertexA - 三角形顶点A
|
|
602
|
+
* @param {Cartesian3} vertexB - 三角形顶点B
|
|
603
|
+
* @param {Cartesian3} vertexC - 三角形顶点C
|
|
604
|
+
* @returns {number} - 三角形面积
|
|
605
|
+
*/
|
|
606
|
+
declare const calcTriangleArea: (vertexA: Cesium.Cartesian3, vertexB: Cesium.Cartesian3, vertexC: Cesium.Cartesian3) => number;
|
|
607
|
+
/**
|
|
608
|
+
* 计算地形高度
|
|
609
|
+
* @param {TerrainProvider} terrainProvider - 地形提供者
|
|
610
|
+
* @param {Cartesian3[]} positions - 点集
|
|
611
|
+
* @returns {Promise<Cesium.Cartographic[]>} - 地形高度点集
|
|
612
|
+
*/
|
|
613
|
+
declare const calcTerrainHeightFromPositions: (terrainProvider: Cesium.TerrainProvider, positions: Cesium.Cartesian3[]) => Promise<Cesium.Cartographic[]>;
|
|
614
|
+
/**
|
|
615
|
+
* 计算场景高度
|
|
616
|
+
* @param {TerrainProvider} viewer
|
|
617
|
+
* @param {Cartesian3[]} positions - 点集
|
|
618
|
+
* @returns {Promise<(Cesium.Cartesian3 | undefined)[]>} - 地形高度点集
|
|
619
|
+
*/
|
|
620
|
+
declare const calcSceneHeightFromPositions: (viewer: Cesium.Viewer, positions: Cesium.Cartesian3[]) => Promise<(Cesium.Cartesian3 | undefined)[]>;
|
|
621
|
+
/**
|
|
622
|
+
* 计算抛物线点集,
|
|
623
|
+
* @param {Cartesian3} startPoint - 开始节点
|
|
624
|
+
* @param {Cartesian3} endPoint - 结束节点
|
|
625
|
+
* @param {number} angularityFactor - 曲率
|
|
626
|
+
* @param {number} numOfSingleLine - 点集数量
|
|
627
|
+
* @returns {Cartesian3[]} - 点集
|
|
628
|
+
*/
|
|
629
|
+
declare const clacPositionsForParabola: (startPoint: Cesium.Cartesian3, endPoint: Cesium.Cartesian3, angularityFactor: number, numOfSingleLine: number) => Cesium.Cartesian3[];
|
|
630
|
+
/**
|
|
631
|
+
* 计算缩放级别,把当前相机高度转为缩放级别
|
|
632
|
+
* @param {Camera} camera - 相机
|
|
633
|
+
*/
|
|
634
|
+
declare const calcZoomFromCameraHeight: (camera: Cesium.Camera) => number;
|
|
635
|
+
/**
|
|
636
|
+
* 计算相机高度,把缩放级别转为相机高度
|
|
637
|
+
* @deprecated
|
|
638
|
+
*/
|
|
639
|
+
declare const calcCameraHeightFromZoom: (zoom: number) => number;
|
|
640
|
+
/**
|
|
641
|
+
* 计算插值点集,按数量平均插值
|
|
642
|
+
* @param positions Cartesian3[]
|
|
643
|
+
* @param number 插值点数量
|
|
644
|
+
* @returns Cartesian3[]
|
|
645
|
+
*/
|
|
646
|
+
declare const calcLerpPosition: (positions: Cesium.Cartesian3[], number: number) => Cesium.Cartesian3[];
|
|
647
|
+
/**
|
|
648
|
+
* 根据一组笛卡尔坐标计算包围球
|
|
649
|
+
* @param positions 笛卡尔坐标组
|
|
650
|
+
*/
|
|
651
|
+
declare const calcBoundingSphereFromPositions: (positions: Cesium.Cartesian3[]) => Cesium.BoundingSphere;
|
|
692
652
|
|
|
693
653
|
/**
|
|
694
654
|
* 坐标转换工具库 - 实现了WGS84、GCJ02(火星坐标)和BD09(百度坐标)之间的相互转换
|
|
@@ -742,9 +702,153 @@ declare class CoordinateTransformer {
|
|
|
742
702
|
static wgs84ToBd09(point: CoordinatePoint): CoordinatePoint;
|
|
743
703
|
}
|
|
744
704
|
|
|
705
|
+
/**
|
|
706
|
+
* 网格8个顶点生成盒子面
|
|
707
|
+
* @param cartesianVertices 8个顶点
|
|
708
|
+
* @param color 网格颜色
|
|
709
|
+
* @param gridId 网格id
|
|
710
|
+
*/
|
|
711
|
+
declare const makeGridToInstanceForBox: (cartesianVertices: any, color: Cesium.Color, gridId: string) => Cesium.GeometryInstance;
|
|
712
|
+
/**
|
|
713
|
+
* 网格8个顶点生成盒子边线
|
|
714
|
+
* @param cartesianVertices 8个顶点
|
|
715
|
+
* @param color 网格颜色
|
|
716
|
+
* @param gridId 网格id
|
|
717
|
+
*/
|
|
718
|
+
declare const makeGridToInstanceForLine: (cartesianVertices: any, color: Cesium.Color, gridId: string) => Cesium.GeometryInstance;
|
|
719
|
+
/**
|
|
720
|
+
* 使用顶点极值创建盒子的八个点
|
|
721
|
+
* @param maxPoint
|
|
722
|
+
* @param minPoint
|
|
723
|
+
*/
|
|
724
|
+
declare const makeGridFromElevationExtrema: (maxPoint: Cesium.Cartographic, minPoint: Cesium.Cartographic) => Cesium.Cartesian3[];
|
|
725
|
+
/**
|
|
726
|
+
* 使用底面和高度创建网格
|
|
727
|
+
* @param topLeft
|
|
728
|
+
* @param topRight
|
|
729
|
+
* @param bottomRight
|
|
730
|
+
* @param bottomLeft
|
|
731
|
+
* @param minHeight
|
|
732
|
+
* @param maxHeight
|
|
733
|
+
*/
|
|
734
|
+
declare const mekeGridPolygonAndHeight: (topLeft: number, topRight: number, bottomRight: number, bottomLeft: number, minHeight: number, maxHeight: number) => Cesium.Cartesian3[];
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* 把点集合转为顺时针
|
|
738
|
+
* @param positions 笛卡尔坐标数组
|
|
739
|
+
*/
|
|
740
|
+
declare const makePositionsForClockwise: (positions: Cesium.Cartesian3[]) => Cesium.Cartesian3[];
|
|
741
|
+
/**
|
|
742
|
+
* 把点集合转为逆时针
|
|
743
|
+
* @param positions 笛卡尔坐标数组
|
|
744
|
+
*/
|
|
745
|
+
declare const makePositionsForAntiClockwise: (positions: Cesium.Cartesian3[]) => Cesium.Cartesian3[];
|
|
746
|
+
/**
|
|
747
|
+
* 把笛卡尔坐标数组转为经纬度数组
|
|
748
|
+
* @param positions 笛卡尔坐标数组
|
|
749
|
+
* @returns Cartographic[]
|
|
750
|
+
*/
|
|
751
|
+
declare const makePositionsToLnglats: (positions: Cesium.Cartesian3[]) => Cesium.Cartographic[];
|
|
752
|
+
/**
|
|
753
|
+
* 把笛卡尔坐标转为经纬度
|
|
754
|
+
* @param position 笛卡尔坐标
|
|
755
|
+
* @returns Cartographic
|
|
756
|
+
*/
|
|
757
|
+
declare const makePositiontoLnglat: (position: Cesium.Cartesian3) => Cesium.Cartographic;
|
|
758
|
+
/**
|
|
759
|
+
* 把经纬度数组转为笛卡尔坐标数组
|
|
760
|
+
* @param {Cesium.Cartographic[]} lnglats
|
|
761
|
+
* @returns Cartesian3[]
|
|
762
|
+
*/
|
|
763
|
+
declare const makeLnglatsToPositions: (lnglats: Cesium.Cartographic[]) => Cesium.Cartesian3[];
|
|
764
|
+
/**
|
|
765
|
+
* 把经纬度转为笛卡尔坐标
|
|
766
|
+
* @param {Cesium.Cartographic} lnglat
|
|
767
|
+
* @returns Cartesian3
|
|
768
|
+
*/
|
|
769
|
+
declare const makeLnglatToPosition: (lnglat: Cesium.Cartographic) => Cesium.Cartesian3;
|
|
770
|
+
/**
|
|
771
|
+
* 点集闭合成面 首位相接
|
|
772
|
+
* @param positions
|
|
773
|
+
* @returns Cartesian3[]
|
|
774
|
+
*/
|
|
775
|
+
declare const makePositionsClose: (positions: Cesium.Cartesian3[]) => Cesium.Cartesian3[];
|
|
776
|
+
/**
|
|
777
|
+
* 把经纬度数组转为点数据的geojson集合
|
|
778
|
+
* @param { Cesium.Cartographic[] } lnglats
|
|
779
|
+
* @returns GeoJSON.FeatureCollection
|
|
780
|
+
*/
|
|
781
|
+
declare const makeLnglatsToPointGeojson: (lnglats: Cesium.Cartographic[]) => GeoJSON.FeatureCollection;
|
|
782
|
+
/**
|
|
783
|
+
* 把经纬度数组转为线数据的geojson集合
|
|
784
|
+
* @param lnglats
|
|
785
|
+
* @returns GeoJSON.FeatureCollection
|
|
786
|
+
*/
|
|
787
|
+
declare const makeLnglatsToLineGeojson: (lnglats: Cesium.Cartographic[]) => GeoJSON.FeatureCollection;
|
|
788
|
+
/**
|
|
789
|
+
* 把经纬度数组转为面数据的geojson集合
|
|
790
|
+
* @param lnglats
|
|
791
|
+
* @returns GeoJSON.FeatureCollection
|
|
792
|
+
*/
|
|
793
|
+
declare const makeLnglatsToPolygonGeojson: (lnglats: Cesium.Cartographic[]) => GeoJSON.FeatureCollection;
|
|
794
|
+
/**
|
|
795
|
+
* 把yawPitchRoll转为headingPitchRoll
|
|
796
|
+
* 航空中的参数和cesium中的参数有区别 角度转弧度
|
|
797
|
+
* @param yawPitchRoll
|
|
798
|
+
*/
|
|
799
|
+
declare const makeYawPitchRollToHeadingPitchRoll: (yawPitchRoll: IYawPitchRoll) => {
|
|
800
|
+
heading: number;
|
|
801
|
+
pitch: number;
|
|
802
|
+
roll: number;
|
|
803
|
+
};
|
|
804
|
+
interface IYawPitchRoll {
|
|
805
|
+
yaw: number;
|
|
806
|
+
pitch: number;
|
|
807
|
+
roll: number;
|
|
808
|
+
offsetYaw?: number;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
/**
|
|
812
|
+
* 左键点击拾取点位置,调用后只生效一次点击
|
|
813
|
+
* @param viewer
|
|
814
|
+
* @return Promise<{position: Cartesian3, lnglat: Cartographic}>
|
|
815
|
+
*/
|
|
745
816
|
declare const pickPoint: (viewer: Cesium.Viewer) => Promise<unknown>;
|
|
817
|
+
/**
|
|
818
|
+
* 获取瓦片内容中的属性
|
|
819
|
+
* @deprecated
|
|
820
|
+
* @param id
|
|
821
|
+
* @param content
|
|
822
|
+
* @return
|
|
823
|
+
*/
|
|
746
824
|
declare const getFeaturesFromTileContent: (id: number, content: Cesium.Cesium3DTileContent) => any;
|
|
825
|
+
/**
|
|
826
|
+
* 获取瓦片内容中的属性
|
|
827
|
+
* @deprecated
|
|
828
|
+
* @param feature
|
|
829
|
+
* @return
|
|
830
|
+
*/
|
|
747
831
|
declare const getFeaturesFromTileFeature: (feature: Cesium.Cesium3DTileFeature) => any;
|
|
748
832
|
|
|
749
|
-
|
|
750
|
-
|
|
833
|
+
/**
|
|
834
|
+
* 生成随机点输入geojosn 格式
|
|
835
|
+
* @param count 点数量
|
|
836
|
+
* @param lngRange 精度范围
|
|
837
|
+
* @param latRange 纬度范围
|
|
838
|
+
* @returns
|
|
839
|
+
*/
|
|
840
|
+
declare const randomPointToGeoJson: (count: number, lngRange?: number[], latRange?: number[]) => FeatureCollection<Point, GeoJsonProperties>;
|
|
841
|
+
declare function randomColor(): string;
|
|
842
|
+
declare const randomPolylineToGeoJson: (count: number, lngRange?: number[], latRange?: number[]) => FeatureCollection<LineString, GeoJsonProperties>;
|
|
843
|
+
declare const randomPolygonToGeoJson: (count: number, lngRange?: number[], latRange?: number[]) => FeatureCollection<Polygon, GeoJsonProperties>;
|
|
844
|
+
|
|
845
|
+
declare const numberId: () => string;
|
|
846
|
+
declare const getInoCesiumBaseUrl: () => any;
|
|
847
|
+
/**
|
|
848
|
+
* 延迟指定时间
|
|
849
|
+
* @param ms 毫秒值
|
|
850
|
+
*/
|
|
851
|
+
declare const delayTime: (ms: number) => Promise<unknown>;
|
|
852
|
+
|
|
853
|
+
export { BaseMaterialProperty, BasePrimitive, types as Common, CoordinateTransformer, DefaultViewerOptions, FlyAttitude, Popup, RoamStatus, SkyBoxOnGround, Tooltip, calcArea, calcBoundingSphereFromPositions, calcCameraHeightFromZoom, calcGeodesicDistance, calcGeodesicDistances, calcLerpPosition, calcPoistionCenter, calcSceneHeightFromPositions, calcSpaceDistance, calcSpaceDistances, calcTerrainHeightFromPositions, calcTriangleArea, calcZoomFromCameraHeight, clacPositionsForParabola, createBottomStatusBar, createEagleEye, createOpenAnim, createRoamHandler, createRollerShutterHandler, createSkyBox, createSkyBoxOnGround, createSplitScreenHandler, delayTime, flyByRotateOut, flyByRotatePoint, flyToCameraView, flyToCesium3DTile, flyToDataSource, flyToFromSphere, flyToImagery, flyToLnglat, flyToNorth, flyToPosition, flyToRectangleBounds, getCameraView, getCesiumForAutoFitScale, getFeaturesFromTileContent, getFeaturesFromTileFeature, getInoCesiumBaseUrl, getScreenCenterPoint, initCesium, initCesiumEvent, makeGridFromElevationExtrema, makeGridToInstanceForBox, makeGridToInstanceForLine, makeLnglatToPosition, makeLnglatsToLineGeojson, makeLnglatsToPointGeojson, makeLnglatsToPolygonGeojson, makeLnglatsToPositions, makePositionsClose, makePositionsForAntiClockwise, makePositionsForClockwise, makePositionsToLnglats, makePositiontoLnglat, makeYawPitchRollToHeadingPitchRoll, mekeGridPolygonAndHeight, numberId, pickPoint, randomColor, randomPointToGeoJson, randomPolygonToGeoJson, randomPolylineToGeoJson, setCameraAutoBackTiltToZero, setCesiumForAutoFitScale, setGlobeEnabled, setGlobeOpatity, setViewToLnglat, twinkleModel };
|
|
854
|
+
export type { DeepPartial, ICameraView, ICesiumEventListener, IOpenAnimOptions, IRoamEvent, IRoamFlyParam, IRoamHandler, IRoamItem, IRoamItemHPR, IRoamSetOptions, IRoaming, ISetViewByLngLatOptions, ISetViewByPositionOptions, ISkyBoxOnGroundOptions, ISkyBoxOptions, ISkyBoxSources, IYawPitchRoll };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"cesium";import{polygon as t,centroid as n}from"@turf/turf";import{makePositiontoLnglat as i}from"@ino-cesium/common";var o=Object.freeze({__proto__:null});let r=1;const s=(t,n)=>{n||(n={token:""}),n.token&&(e.Ion.defaultAccessToken=n.token),e.Camera.DEFAULT_VIEW_RECTANGLE=e.Rectangle.fromDegrees(90,-20,110,90);const i={...p,...n},o=new e.Viewer(t,i);return o.imageryLayers.remove(o.imageryLayers.get(0)),o._cesiumWidget._creditContainer.style.display="none",o.scene.postProcessStages.fxaa.enabled=!0,o.scene.msaaSamples=8,o.scene.globe.baseColor=e.Color.fromCssColorString("rgba(0,0,255,0.5)"),o.scene.globe.depthTestAgainstTerrain=!0,o.scene.globe.showGroundAtmosphere=!0,o.scene.globe.enableLighting=!1,o.scene.screenSpaceCameraController.maximumTiltAngle=Math.PI/2,console.log("%c%s","color: GREEN; font-size: 20px",`Cesium ${e.VERSION}`),o},a=(t,n)=>{const i=n?1:0;t.scene.skyBox.show=n,t.scene.skyAtmosphere.show=n,t.scene.globe.dynamicAtmosphereLighting=n,t.scene.globe.dynamicAtmosphereLightingFromSun=n,t.scene.globe.translucency.backFaceAlpha=i,t.scene.globe.baseColor=e.Color.fromCssColorString(`rgba(121, 121, 255,${i})`),t.scene.globe.showGroundAtmosphere=n,n?(t.scene.backgroundColor=e.Color.fromCssColorString(`rgba(255,255,255,${i})`),t.scene.globe.material=void 0,t.scene.globe.translucency.enabled=!1):(t.scene.globe.translucency.enabled=!1,t.scene.globe.undergroundColor=e.Color.fromCssColorString(`rgba(0, 0, 0,${i})`),t.scene.backgroundColor=e.Color.fromCssColorString(`rgba(0,0,0,${i})`),t.scene.globe.material=new e.Material({fabric:{type:"Color",uniforms:{color:e.Color.fromCssColorString(`rgba(0, 0, 0,${i})`)}}}))},c=(e,t)=>{t.scene.globe.translucency.enabled=!0,t.scene.globe.translucency.frontFaceAlpha=e,t.scene.globe.translucency.backFaceAlpha=e},l=e=>{r=e},d=()=>r,p={animation:!1,baseLayerPicker:!1,fullscreenButton:!1,geocoder:!1,homeButton:!1,infoBox:!0,sceneModePicker:!1,selectionIndicator:!1,timeline:!1,navigationHelpButton:!1,scene3DOnly:!0,navigation:!1,navigationInstructionsInitiallyVisible:!1,showRenderLoopErrors:!0,orderIndependentTranslucency:!1,contextOptions:{webgl:{alpha:!0}}},h=t=>{let n=0;for(let i=0;i<t.length;i++){const o=t[i],r=t[(i+1)%t.length];n+=e.Cartesian3.cross(o,r,new e.Cartesian3).z}return n>0?t.reverse():t},u=t=>{let n=0;for(let i=0;i<t.length;i++){const o=t[i],r=t[(i+1)%t.length];n+=e.Cartesian3.cross(o,r,new e.Cartesian3).z}return n<0?t.reverse():t},m=e=>e.map(e=>g(e)),g=t=>{const n=e.Cartographic.fromCartesian(t);return{longitude:e.Math.toDegrees(n.longitude),latitude:e.Math.toDegrees(n.latitude),height:n.height}},y=t=>t.map(t=>e.Cartesian3.fromDegrees(t.longitude,t.latitude,t.height)),f=t=>e.Cartesian3.fromDegrees(t.longitude,t.latitude,t.height),C=e=>{const t=e[0],n=e[e.length-1];return t.x===n.x&&t.y===n.y&&t.z===n.z?e:[...e,e[0]]},v=e=>{const t=[];return e.forEach(e=>{t.push({type:"Feature",geometry:{type:"Point",coordinates:[e.longitude,e.latitude]},properties:{height:e.height}})}),{type:"FeatureCollection",features:t}},w=e=>{const t=[];return e.forEach((n,i)=>{0!==i&&t.push({type:"Feature",geometry:{type:"LineString",coordinates:[[e[i-1].longitude,e[i-1].latitude],[n.longitude,n.latitude]]},properties:{height:n.height}})}),{type:"FeatureCollection",features:t}},M=e=>{const t=[];return t.push({type:"Feature",geometry:{type:"Polygon",coordinates:[e.map(e=>[e.longitude,e.latitude])]},properties:{heights:e.map(e=>e.height)}}),{type:"FeatureCollection",features:t}},b=t=>({heading:e.Math.toRadians(t.yaw+(t.offsetYaw||0)),pitch:e.Math.toRadians(t.pitch),roll:e.Math.toRadians(t.roll)}),_=t=>{const{lng:n,lat:i,height:o,viewer:r}=t;r.scene.camera.setView({destination:e.Cartesian3.fromDegrees(n,i,o||1e4)})},E=t=>{const{lng:n,lat:i,height:o,viewer:r}=t;r.scene.camera.flyTo({destination:e.Cartesian3.fromDegrees(n,i,o||1e4)})},T=e=>{const{position:t,viewer:n}=e;n.scene.camera.flyTo({destination:t})};function P(t){const n=t.camera.heading,i=t.camera.pitch,o=t.camera.roll;return{destination:new e.Cartesian3(t.camera.position.x,t.camera.position.y,t.camera.position.z),orientation:{heading:n,pitch:i,roll:o}}}function x(e,t){e&&t.scene.camera.flyTo({...e})}function D(e,t){const n=t.dataSources.getByName(e);n.length>0&&t.flyTo(n[0])}function S(e,t){e&&t.flyTo(e)}function I(e,t){t.flyTo(e)}function k(t,n){const i=new e.Cartesian3(t[0],t[1],t[2]),o=new e.BoundingSphere(i,t[3]);n.camera.flyToBoundingSphere(o,{offset:new e.HeadingPitchRange(3.5,-.5,200),duration:2})}const L=(t,n,i,o,r)=>{if(i<=t||o<=n)return void console.error("无效的边界坐标:东必须大于西,北必须大于南");const s={destination:e.Rectangle.fromDegrees(t,n,i,o),duration:3,orientation:{heading:e.Math.toRadians(0),pitch:e.Math.toRadians(-90),roll:0}};r.camera.flyTo(s)},A=t=>{t.camera.flyTo({destination:t.scene.camera.position,orientation:{heading:e.Math.toRadians(0),pitch:e.Math.toRadians(-90),roll:0},duration:1.5})};function R(t){const n=t.scene.canvas,i=n.clientWidth/2,o=n.clientHeight/2;return t.scene.pickPosition(new e.Cartesian2(i,o))}const F=t=>{let n=!1;let i;const o=t.camera;let r=o.pitch,s=0,a=!1;function c(){if(!n||!i)return;let e=o.heading;a?e+=.005:e-=.005,t.camera.setView({destination:i,orientation:{heading:e,pitch:r}}),t.camera.moveBackward(s),requestAnimationFrame(c)}return{start:(l,d)=>{i=l||R(t),r=o.pitch,a=!!d,s=e.Cartesian3.distance(o.position,i),n=!0,c(),t.scene.screenSpaceCameraController.enableInputs=!1},end:()=>{n=!1,t.scene.screenSpaceCameraController.enableInputs=!0}}},O=e=>{let t=!1;let n=!1;function i(){if(!t)return;let o=e.camera.heading;n?o+=.001:o-=.001,e.camera.setView({orientation:{heading:o,pitch:e.camera.pitch}}),requestAnimationFrame(i)}t=!0;return{start:e=>{t=!0,n=!!e,i()},end:()=>{t=!1}}};function N(e){e.show=!1,setTimeout(()=>{e.show=!0,setTimeout(()=>{e.show=!1,setTimeout(()=>{e.show=!0},300)},300)},300)}const B=(t,n)=>{console.log("sdfjdsklf"),n||(n=1e5);let i=!1;t.camera.moveEnd.addEventListener(function(){if(i)return;const o=t.camera,r=t.camera.positionCartographic.height;console.log("cameraEnd",r);const s=o.heading,a=o.roll;if(r>n){i=!0;const n=t.camera.computeViewRectangle();if(!n)return void(i=!0);const o={longitude:0,latitude:0},c=e.Rectangle.center(n);o.longitude=e.Math.toDegrees(c.longitude),o.latitude=e.Math.toDegrees(c.latitude),t.camera.flyTo({destination:f(new e.Cartographic(o.longitude,o.latitude,r)),orientation:{heading:s,pitch:-1.5,roll:a},duration:1,complete:()=>{}})}else i=!1,t.scene.screenSpaceCameraController.maximumTiltAngle=Math.PI/2})},V=(t,n)=>{const i=t.scene,o=new e.ScreenSpaceEventHandler(i.canvas);o.setInputAction(e=>{if(n.LEFT_POSITION){const o=i.pickPosition(e.position);G(e.position,o,n.LEFT_POSITION,t)}n.PICK_FEATURE&&$(t,e.position,n.PICK_FEATURE),t._element.style.cursor="default"},e.ScreenSpaceEventType.LEFT_CLICK),o.setInputAction(e=>{if(n.MOVE_POSITION){const o=i.pickPosition(e.endPosition);G(e.endPosition,o,n.MOVE_POSITION,t)}n.MOVE_PICK_FEATURE&&$(t,e.endPosition,n.MOVE_PICK_FEATURE)},e.ScreenSpaceEventType.MOUSE_MOVE)},$=(t,n,i)=>{const o=t.scene.pickPosition(n),r=t.scene.pick(n),s={};if(r){if(t._element.style.cursor="pointer",r instanceof e.Cesium3DTileFeature){r.getPropertyIds().forEach(e=>{s[e]=r.getProperty(e)})}else r.id instanceof e.Cesium3DTileContent?(t._element.style.cursor="pointer",Object.assign(s,{name:"sdfjldks"})):r.id instanceof e.Entity?t._element.style.cursor="pointer":r.primitive&&Object.assign(s,r.primitive.properties);i({position:o,...r},s)}else i(void 0,{})},G=(t,n,i,o)=>{n||(n=e.Cartesian3.fromDegrees(0,0,0));const r=e.Cartographic.fromCartesian(n);i({windowPosition:t,position:n,lnglat:{lng:e.Math.toDegrees(r.longitude),lat:e.Math.toDegrees(r.latitude),height:r.height},cameraView:P(o)})},H=()=>`${Date.now()}${Math.round(9999999999*Math.random()+1)}`,z=()=>window.INO_CESIUM_BASE_URL,U=e=>new Promise(t=>setTimeout(t,e));class j{static tooltip;_title;_div;_message;constructor(e){const t=document.createElement("DIV");t.id="tooltip",t.className="twipsy right";const n=document.createElement("DIV");n.className="twipsy-inner",t.appendChild(n),this._div=t,this._title=n,this._message="";const i=e._element.getElementsByClassName("cesium-widget")[0];if(!i)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");i.appendChild(t),t.onmousemove=e=>{this.showAt({x:e.clientX,y:e.clientY},this._message)}}showAt(e,t){e&&t&&(this.setVisible(!0),this._title.innerHTML=t,this._div.style.left=`${e.x+10}px`,this._div.style.top=e.y-this._div.clientHeight/2+"px",this._message=t)}setVisible(e){this._div.style.display=e?"block":"none"}static createToolTip(e){return j.tooltip||(j.tooltip=new j(e)),j.tooltip}destroy(){j.tooltip&&(this._div&&this._div.parentNode.removeChild(this._div),j.tooltip=null)}}class X{static popup;_div;viewer;offset=new e.Cartesian2(140,150);position=e.Cartesian3.ZERO;constructor(e,t,n){this.viewer=e,n&&(this.offset=n),this._div=t,this._div.style.position="absolute",this._div.style.left="0",this._div.style.top="0",this._div.style.display="none";const i=e._element.getElementsByClassName("cesium-widget")[0];if(!i)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");i.appendChild(t),this.renderPosition()}showAt(e){this.position=e,e&&this.setVisible(!0)}setVisible(e){this._div.style.display=e?"block":"none"}renderPosition(){this.viewer.scene.postRender.addEventListener(()=>{if(!this.position.equals(e.Cartesian3.ZERO)){const e=this.viewer.scene.cartesianToCanvasCoordinates(this.position);this._div.style.left=e.x-this.offset.x+"px",this._div.style.top=e.y-this.offset.y+"px"}})}static createPupup(e,t,n){return X.popup||(X.popup=new X(e,t,n)),X.popup}destroy(){X.popup&&(this._div&&this._div.parentNode.removeChild(this._div),X.popup=null)}}const W=(e,t=[-180,180],n=[-90,90])=>{const i=[];for(let o=0;o<e;o++){const e=q(t),o=q(n);i.push({type:"Feature",geometry:{type:"Point",coordinates:[e,o]},properties:{}})}return{type:"FeatureCollection",features:i}};function q(e){const[t,n]=e;return Math.random()*(n-t)+t}function Z(){return`rgba(${Math.round(255*Math.random())},${Math.round(255*Math.random())},${Math.round(255*Math.random())},${Math.random()})`}const Y=(e,t=[-180,180],n=[-90,90])=>{const i=[];for(let o=0;o<e;o++){const e=Math.floor(q([3,10])),o=[];for(let i=0;i<e;i++){const e=q(t),i=q(n);o.push([e,i])}i.push({type:"Feature",geometry:{type:"LineString",coordinates:o},properties:{}})}return{type:"FeatureCollection",features:i}},K=(e,t=[-180,180],n=[-90,90])=>{const i=[];for(let o=0;o<e;o++){const e=J(t,n);i.push({type:"Feature",geometry:{type:"Polygon",coordinates:[e]}})}return{type:"FeatureCollection",features:i}};function J(e,t){const n=Math.floor(q([3,10])),i=q(e),o=q(t),r=q([1,5]),s=[];for(let e=0;e<n;e++){const t=e/n*2*Math.PI,a=q([.8*r,r]),c=i+a*Math.cos(t),l=o+a*Math.sin(t);s.push([c,l])}return s.push(s[0]),s}const Q=(t,n)=>{let i=!1;const o=new e.Viewer(t,{...p,scene3DOnly:!1});o.scene.mode=2;const r=o.scene.screenSpaceCameraController;r.enableRotate=!1,r.enableTranslate=!1,r.enableZoom=!1,r.enableTilt=!1,r.enableLook=!1,n.entities.add({position:e.Cartesian3.fromDegrees(0,0),label:{text:new e.CallbackProperty(()=>(s(),""),!0)}});const s=function(){i||o.camera.flyTo({destination:n.camera.position,orientation:{heading:n.camera.heading,pitch:n.camera.pitch,roll:n.camera.roll},duration:0})};return{viewer:o,open:()=>{i=!1},close:()=>{i=!0}}},ee=t=>{const n=[],i=e=>{t.scene.splitPosition=e},o=(e,t)=>{n.push(e),e.splitDirection=t};return{set:()=>{i(.5),function(){let e=document.getElementById("vertical-slider");if(e)return void(e.style.display="block");e=document.createElement("div"),e.id="vertical-slider";const n=t._element.getElementsByClassName("cesium-widget")[0];if(!n)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");n.appendChild(e)}(),function(){const e=document.getElementById("vertical-slider");function n(){document.removeEventListener("mousemove",o,!1)}function i(){document.addEventListener("mousemove",o,!1)}function o(n){n.preventDefault?n.preventDefault():n.returnValue=!1,e.style.left=`${n.clientX}px`;const i=n.clientX/e.parentElement.offsetWidth;t.scene.splitPosition=i}e.addEventListener("mousedown",i,!1),document.addEventListener("mouseup",n,!1)}()},remove:()=>{n.forEach(t=>{o(t,e.SplitDirection.NONE)});document.getElementById("vertical-slider").style.display="none"},setSplitPosition:i,setSplitDirection:o}},te=t=>{const n=t;let i;const o={},r=()=>{const e=n.container;e.style.display="flex";e.getElementsByClassName("cesium-viewer")[0].style.width="50%";const t=document.createElement("div");t.style={width:"50%",height:"100%"},t.id="right-screen-viewer",e.appendChild(t),i=s(t.id),o[1]=i,c(),n.camera.changed.addEventListener(()=>a(n,i)),n.scene.preRender.addEventListener(()=>a(n,i)),n.camera.percentageChanged=.01,i.camera.changed.addEventListener(()=>a(i,n)),i.scene.preRender.addEventListener(()=>a(i,n)),i.camera.percentageChanged=.01,i._splitNumber=1};function a(t,n){const i=e.Cartographic.toCartesian(t.camera.positionCartographic);n.camera.setView({destination:new e.Cartesian3(i.x,i.y,i.z),orientation:{direction:t.scene.camera._direction,up:t.scene.camera.up,heading:t.scene.camera.heading,pitch:t.scene.camera.pitch,roll:t.scene.camera.roll}})}const c=()=>{n.imageryLayers._layers.forEach(e=>{e.splitScreenBaseLayer&&i.imageryLayers.addImageryProvider(e.imageryProvider)})};return{set:()=>{r(),function(){let e=document.getElementById("split-screen-slider");if(e)return void(e.style.display="block");e=document.createElement("div"),e.id="split-screen-slider";const n=t._element.getElementsByClassName("cesium-widget")[0];if(!n)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");n.appendChild(e)}(),n._splitNumber=-1,o[-1]=n},viewerMap:o,getViewerFromKey:e=>o[e],remove:()=>{document.getElementById("split-screen-slider").style.display="none";n.container.getElementsByClassName("cesium-viewer")[0].style.width="100%",i.container.remove(),delete o[1]},setLayer:(e,t)=>{},updateBaseLayers:c}},ne=(t,n)=>{const i=e.Cartographic.fromCartesian(t),o=e.Cartographic.fromCartesian(n),r=new e.EllipsoidGeodesic;r.setEndPoints(i,o);let s=r.surfaceDistance;return s=Math.sqrt(s**2+(o.height-i.height)**2),s};function ie(e){let t=0;return e.forEach((n,i)=>{if(i===e.length-1)return;const o=ne(n,e[i+1]);t+=o}),t}function oe(t,n,i){const{EllipsoidGeodesic:o,Ellipsoid:r}=e;return new o((i=i||r.WGS84).cartesianToCartographic(t),i.cartesianToCartographic(n)).surfaceDistance}function re(e){let t=0;return e.forEach((n,i)=>{if(i===e.length-1)return;const o=oe(n,e[i+1]);t+=o}),t}const se=i=>{if(i.length<4)return e.BoundingSphere.fromPoints(i).center;const o=t([i.map(e=>[e.x,e.y])]),r=e.BoundingSphere.fromPoints(i).center,s=n(o);return new e.Cartesian3(s.geometry.coordinates[0],s.geometry.coordinates[1],r.z)};function ae(t){let n=0;const{CoplanarPolygonGeometry:i,VertexFormat:o,defined:r,Cartesian3:s}=e,a=i.createGeometry(i.fromPositions({positions:t,vertexFormat:o.POSITION_ONLY}));if(r(a)){const e=a.indices,t=a.attributes.position.values;for(let i=0;i<e.length;i+=3){const o=e[i],r=e[i+1],a=e[i+2];n+=ce(s.unpack(t,3*o,{}),s.unpack(t,3*r,{}),s.unpack(t,3*a,{}))}}return n}const ce=(t,n,i)=>{const{Cartesian3:o}=e,r=o.subtract(t,n,{}),s=o.subtract(i,n,{}),a=o.cross(r,s,r);return.5*o.magnitude(a)},le=async(t,n)=>{const i=n.map(t=>e.Cartographic.fromCartesian(t));return await e.sampleTerrainMostDetailed(t,i)},de=async(e,t)=>await e.scene.clampToHeightMostDetailed(t),pe=(t,n,i,o)=>{const r=[],s=e.Cartographic.fromCartesian(t),a=e.Cartographic.fromCartesian(n),c=180*s.longitude/Math.PI,l=180*s.latitude/Math.PI,d=180*a.longitude/Math.PI,p=180*a.latitude/Math.PI,h=Math.sqrt((c-d)*(c-d)+(l-p)*(l-p))*i,u=e.Cartesian3.clone(t),m=e.Cartesian3.clone(n),g=e.Cartesian3.distance(u,e.Cartesian3.ZERO),y=e.Cartesian3.distance(m,e.Cartesian3.ZERO);if(e.Cartesian3.normalize(u,u),e.Cartesian3.normalize(m,m),!e.Cartesian3.distance(u,m))return r;const f=e.Cartesian3.angleBetween(u,m);r.push(t);for(let t=1;t<o-1;t++){const n=1*t/(o-1),i=1-n,s=Math.sin(i*f)/Math.sin(f),a=Math.sin(n*f)/Math.sin(f),c=e.Cartesian3.multiplyByScalar(u,s,new e.Cartesian3),l=e.Cartesian3.multiplyByScalar(m,a,new e.Cartesian3);let d=e.Cartesian3.add(c,l,new e.Cartesian3);const p=n*Math.PI,C=g*i+y*n+Math.sin(p)*h;d=e.Cartesian3.multiplyByScalar(d,C,d),r.push(d)}return r.push(n),r},he=e=>{const t=e.positionCartographic.height,n=-40467.74;return Math.round(n+80955.31/(1+(t/91610.74)**7096758e-11))},ue=e=>e,me=(t,n)=>{const i=[];let o=0,r=0,s=0;const a=[];for(let n=0;n<t.length-1;++n)o+=e.Cartesian3.distance(t[n],t[n+1]);for(let n=0;n<t.length;n++)0===n?r=0:(s+=e.Cartesian3.distance(t[n-1],t[n]),r=s/o),i.push(r);const c=new e.LinearSpline({times:i,points:t});for(let e=0;e<=n;e++){const t=c.evaluate(e/n);a.push(t)}return a},ge=t=>{const n=new e.BoundingSphere(e.Cartesian3.ZERO,0);return e.BoundingSphere.fromPoints(t,n),n};class ye{_primitive;_promise;appearance;geometryInstance;drawCommand;shapePositions;needUpdate=!1;constructor(){this._primitive=void 0,this.appearance=void 0,this.geometryInstance=void 0,this._promise=null,this.drawCommand=null,this.needUpdate=!1,this.shapePositions=[]}update(e){const t=this.getPrimitive();if(t){this._primitive=t;this._primitive.update(e)}}then(e=null){return this._promise?.then(e)}catch(e=null){return this._promise?.catch(e)}isDestroyed(){return!!this._primitive}destroy(){this._primitive=void 0}setShapePositions(e){this.shapePositions=e}}class fe{_definitionChanged=new e.Event;get definitionChanged(){return this._definitionChanged}get isConstant(){return!1}}const Ce=e.BoxGeometry,ve=e.Cartesian3,we=e.defaultValue,Me=e.defined,be=e.destroyObject,_e=e.DeveloperError,Ee=e.GeometryPipeline,Te=e.Matrix3,Pe=e.Matrix4,xe=e.Transforms,De=e.VertexFormat,Se=e.BufferUsage,Ie=e.CubeMap,ke=e.DrawCommand,Le=e.loadCubeMap,Ae=e.RenderState,Re=e.VertexArray,Fe=e.BlendingState,Oe=e.SceneMode,Ne=e.ShaderProgram,Be=e.ShaderSource,Ve=new Te;class $e{constructor(t){e.defined(e.Matrix4.getRotation)||(e.Matrix4.getRotation=e.Matrix4.getMatrix3),this.sources=t.sources,this._sources=void 0,this.show=we(t.show,!0),this._command=new ke({modelMatrix:Pe.clone(Pe.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0}update(e,t){const n=this;if(!this.show)return;if(e.mode!==Oe.SCENE3D&&e.mode!==Oe.MORPHING)return;if(!e.passes.render)return;const i=e.context;if(this._sources!==this.sources){this._sources=this.sources;const e=this.sources;if(!(Me(e.positiveX)&&Me(e.negativeX)&&Me(e.positiveY)&&Me(e.negativeY)&&Me(e.positiveZ)&&Me(e.negativeZ)))throw new _e("this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");if(typeof e.positiveX!=typeof e.negativeX||typeof e.positiveX!=typeof e.positiveY||typeof e.positiveX!=typeof e.negativeY||typeof e.positiveX!=typeof e.positiveZ||typeof e.positiveX!=typeof e.negativeZ)throw new _e("this.sources properties must all be the same type.");"string"==typeof e.positiveX?Le(i,this._sources).then(e=>{n._cubeMap=n._cubeMap&&n._cubeMap.destroy(),n._cubeMap=e}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new Ie({context:i,source:e}))}const o=this._command;if(o.modelMatrix=xe.eastNorthUpToFixedFrame(e.camera._positionWC),!Me(o.vertexArray)){o.uniformMap={u_cubeMap:()=>n._cubeMap,u_rotateMatrix:()=>Pe.getRotation(o.modelMatrix,Ve)};const e=Ce.createGeometry(Ce.fromDimensions({dimensions:new ve(2,2,2),vertexFormat:De.POSITION_ONLY})),t=this._attributeLocations=Ee.createAttributeLocations(e);o.vertexArray=Re.fromGeometry({context:i,geometry:e,attributeLocations:t,bufferUsage:Se._DRAW}),o.renderState=Ae.fromCache({blending:Fe.ALPHA_BLEND})}if(!Me(o.shaderProgram)||this._useHdr!==t){const e=new Be({defines:[t?"HDR":""],sources:["precision highp float;\n\nuniform samplerCube u_cubeMap;\nin vec3 v_texCoord;\nout vec4 fragColor;\n\nvoid main() {\n vec4 color = texture(u_cubeMap, normalize(v_texCoord));\n fragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);\n}"]});o.shaderProgram=Ne.fromCache({context:i,vertexShaderSource:"#version 300 es\n\nprecision highp float;\n\nin vec3 position;\nout vec3 v_texCoord;\n\nuniform mat3 u_rotateMatrix;\n\nvoid main() {\n vec3 p = czm_viewRotation * u_rotateMatrix * (czm_temeToPseudoFixed * (czm_entireFrustum.y * position));\n gl_Position = czm_projection * vec4(p, 1.0);\n v_texCoord = position;\n}\n",fragmentShaderSource:e,attributeLocations:this._attributeLocations}),this._useHdr=t}return Me(this._cubeMap)?o:void 0}isDestroyed(){return!1}destroy(){const e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy(),this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),be(this)}}const Ge=t=>{const{viewer:n,sources:i}=t;return n.scene.skyBox=new e.SkyBox({sources:i}),n.scene.skyBox},He=t=>{let{viewer:n,sources:i}=t;const o=t.height?t.height:225705,r=n.scene.skyBox,s=n.scene.skyAtmosphere.show;i||(i={positiveX:`${z()}/assets/images/ground-skybox/px.jpg`,negativeX:`${z()}/assets/images/ground-skybox/nx.jpg`,positiveY:`${z()}/assets/images/ground-skybox/py.jpg`,negativeY:`${z()}/assets/images/ground-skybox/ny.jpg`,positiveZ:`${z()}/assets/images/ground-skybox/pz.jpg`,negativeZ:`${z()}/assets/images/ground-skybox/nz.jpg`});const a=new $e({sources:i});n.scene.postRender.addEventListener(()=>{const t=n.camera.position;e.Cartographic.fromCartesian(t).height<o?(n.scene.skyBox=a,n.scene.skyAtmosphere.show=!1):(n.scene.skyBox=r,n.scene.skyAtmosphere.show=s)})},ze=t=>{const n=[];let i,o;t.clock.shouldAnimate=!0;const r={},s=(e,n)=>{if(a(),e.entity.cylinder){const n=e.entity.cylinder;n.roamId=e.id,e.entity.cylinder=void 0,o=t.entities.add({position:e.property,cylinder:n})}t.trackedEntity=e.entity,n&&(i=e)},a=()=>{if(o){t.entities.remove(o);const e=n.find(e=>e.id===o.cylinder.roamId);e&&(e.entity.cylinder=o.cylinder),o=void 0}},c=()=>{t.trackedEntity=void 0,i=void 0,a()},l=e=>{t.trackedEntity?.id===e.entity.id&&c(),t.entities.remove(e.entity);const i=n.findIndex(t=>t.id===e.id);i>-1&&n.splice(i,1)},d=(e,t)=>{const n=e.property.getValue(t);if(n&&(e.status="ROAMING",m.roaming&&m.roaming(e,{time:t,position:n})),e.stopTime.secondsOfDay<t.secondsOfDay&&"END"!==e.status&&(e.status="END",m.end&&m.end(e),e.loop?p(e):c()),e.flyParams.hpr){const i=r[e.id].find(e=>e.time>t.secondsOfDay);i&&u(e,i,n)}},p=n=>{const{property:i,startTime:o,stopTime:r}=h(n);n.stopTime=r,n.startTime=o,n.property=i,n.flyParams.hpr||(n.entity.orientation=new e.VelocityOrientationProperty(i)),n.entity.position=i,n.status="START",t.clock.currentTime=o,t.clock.multiplier=1,m.reStart&&m.reStart(n)},h=t=>{const n=[],{positions:i,flyParams:o}=t,s=new e.SampledPositionProperty;let a=0;const c=e.JulianDate.now();let l=c.clone();return i.forEach((t,r)=>{let d=e.JulianDate.now();if(r){let n=0;if(o.speed){n=e.Cartesian3.distance(t,i[r-1])/(1e3*o.speed/3600)}o.times&&(n=(o.times[r]-o.times[r-1])/1e3),a+=n,d=e.JulianDate.addSeconds(c,a,new e.JulianDate)}else d=c;l=d,s.addSample(d,t),o.hpr&&n.push({time:d.secondsOfDay,heading:o.hpr[r].heading,pitch:o.hpr[r].pitch,roll:o.hpr[r].roll})}),r[t.id]=n,{property:s,startTime:c,stopTime:l}},u=(t,n,i)=>{if(!i)return;const{heading:o,pitch:r,roll:s}=n,a=new e.HeadingPitchRoll(o,r,s);t.entity.orientation=Transforms.headingPitchRollQuaternion(i,a)};t.scene.preRender.addEventListener((o,r)=>{if(n.forEach(e=>{d(e,r)}),!i)return;const s=i.entity.computeModelMatrix(t.clock.currentTime);s&&t.camera.lookAtTransform(s,new e.Cartesian3(...[-20,0,5]))});const m={};return{set:i=>{const{entity:o}=i;i.id=H(),t.entities.add(o);const{property:r,startTime:s,stopTime:a}=h(i);i.flyParams.hpr||(o.orientation=new e.VelocityOrientationProperty(r)),o.position=r;const c={...i,startTime:s,stopTime:a,property:r,status:"START"};return t.clock.currentTime=s,t.clock.multiplier=1,n.push(c),c.status="START",m.start&&m.start(c),c},tracked:s,stopTracked:c,remove:l,frameRoam:d,trackedByEntityId:(e,t)=>{const i=n.find(t=>t.entity.id===e);i&&s(i,t)},removeAll:()=>{n.forEach(e=>{l(e)}),n.length=0},Event:m,lockCameraView:e=>{i=e},updateRoamAttitude:(t,n)=>{"UP"!==n&&"DOWN"!==n||(t.entity.orientation=void 0),"front"!==n&&"back"!==n||(t.entity.orientation=new e.VelocityOrientationProperty(t.property))}}};var Ue=(e=>(e.UP="UP",e.DOWN="DOWN",e.LEFT="left",e.RIGHT="right",e.FRONT="front",e.BACK="back",e))(Ue||{}),je=(e=>(e.END="END",e.START="START",e.ROAMING="ROAMING",e))(je||{});let Xe=100,We="",qe="0";const Ze=t=>{const{viewer:n}=t,i=document.createElement("div");i.className="bottom-status-bar";const o=document.createElement("div");o.className="scale-bar",o.innerHTML="";const r=document.createElement("div");r.className="scale-label",r.innerHTML="",o.appendChild(r),i.appendChild(o);const s=document.createElement("div");s.id="bottom-status-bar-camera",t.clickCopy&&(s.style.pointerEvents="auto",s.style.cursor="pointer"),i.appendChild(s),s.style.display="flex";const a=document.createElement("div"),c=document.createElement("div"),l=n._element.getElementsByClassName("cesium-widget")[0];if(!l)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");l.appendChild(i),V(n,{MOVE_POSITION(e){s.innerHTML=`\n 经度:${e.lnglat.lng.toFixed(6)} \n 纬度:${e.lnglat.lat.toFixed(6)} \n 高程:${e.lnglat.height.toFixed(2)} \n `,t.clickCopy&&P(n),s.appendChild(c),s.appendChild(a)}}),t.clickCopy&&document.addEventListener("click",e=>{e.target.id});let d=Date.now(),p=0;const h=()=>{requestAnimationFrame(()=>{if(p+=1,p>=30){const e=Date.now(),t=e-d,n=Math.round(1e3/(t/p));d=e,p=0,a.innerHTML=`${n} FPS`}t.hpr?c.innerHTML=`\n 方位角:${e.Math.toDegrees(n.camera.heading).toFixed(1)}° \n 俯仰角:${e.Math.toDegrees(n.camera.pitch).toFixed(1)}° \n 翻滚角:${e.Math.toDegrees(n.camera.roll).toFixed(1)}° \n `:c.innerHTML="",c.innerHTML+=`\n 视高:${n.camera.positionCartographic.height.toFixed(0)}m \n `;const i=Ye(n);r.innerHTML=`${i.distanceLabel}`,h()})};h()},Ye=t=>{const n=t.camera.positionCartographic.height.toFixed(0);if(n===qe)return{barWidth:Xe,distanceLabel:We};qe=n;const i=new e.EllipsoidGeodesic,o=[1,2,3,5,10,20,30,50,100,200,300,500,1e3,2e3,3e3,5e3,1e4,2e4,3e4,5e4,1e5,2e5,3e5,5e5,1e6,2e6,3e6,5e6,1e7,2e7,3e7,5e7],r=t.scene,s=r.canvas.clientWidth,a=r.canvas.clientHeight,c=r.camera.getPickRay(new e.Cartesian2(s/2|0,a-1)),l=r.camera.getPickRay(new e.Cartesian2(1+s/2|0,a-1)),d=r.globe,p=d.pick(c,r),h=d.pick(l,r);if(!e.defined(p)||!e.defined(h))return{barWidth:Xe,distanceLabel:We};const u=d.ellipsoid.cartesianToCartographic(p),m=d.ellipsoid.cartesianToCartographic(h);i.setEndPoints(u,m);const g=i.surfaceDistance;let y;for(let t=o.length-1;!e.defined(y)&&t>=0;--t)o[t]/g<100&&(y=o[t]);if(e.defined(y)){const e=y>=1e3?`${(y/1e3).toString()} km`:`${y.toString()} m`;Xe=y/g|0,We=e}else Xe=0,We="1 m";return{barWidth:Xe,distanceLabel:We}},Ke=t=>new Promise(n=>{const{viewer:i,center:o}=t;let r=o.lng,s=1,a=null;const c=t=>{null===a&&(a=t);r-=(t-a)/2e4*2,r<-180&&(r=180,s+=1),2===s&&r>o.lng?i.camera.flyTo({destination:e.Cartesian3.fromDegrees(o.lng,o.lat,3e7),duration:2,orientation:{heading:e.Math.toRadians(360),pitch:e.Math.toRadians(-90),roll:0},easingFunction:e.EasingFunction.LINEAR_NONE,complete:()=>{i.camera.flyTo({destination:e.Cartesian3.fromDegrees(o.lng,o.lat,o.height),duration:3,orientation:{heading:e.Math.toRadians(2.8),pitch:e.Math.toRadians(-90),roll:6.282253919167732},complete:()=>{n(!0)}})}}):(i.camera.setView({destination:e.Cartesian3.fromDegrees(r,o.lat,3e7),orientation:{heading:e.Math.toRadians(360),pitch:e.Math.toRadians(-90),roll:0}}),requestAnimationFrame(c))};requestAnimationFrame(c)}),Je=(t,n,i)=>{const o=new Float64Array(24);for(let e=0;e<8;e++)o[3*e]=t[e].x,o[3*e+1]=t[e].y,o[3*e+2]=t[e].z;const r=new Uint16Array([0,1,2,0,2,3,4,6,5,4,7,6,0,4,1,1,4,5,1,5,2,2,5,6,2,6,3,3,6,7,3,7,0,0,7,4]),s={position:new e.GeometryAttribute({componentDatatype:e.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:o})},a=new e.Geometry({indices:r,attributes:s,primitiveType:e.PrimitiveType.TRIANGLES,boundingSphere:e.BoundingSphere.fromVertices(o)});return new e.GeometryInstance({geometry:a,attributes:{color:e.ColorGeometryInstanceAttribute.fromColor(n)},id:`${i}`})},Qe=(t,n,i)=>{const[o,r,s,a,c,l,d,p]=t,h=[o,r,r,s,s,a,a,o,c,l,l,d,d,p,p,c,o,c,c,l,l,r,r,o,a,p,p,d,d,s,s,a,o,a,a,p,p,c,c,o,r,l,l,d,d,s,s,r];return new e.GeometryInstance({geometry:new e.PolylineGeometry({positions:h,width:2,vertexFormat:e.PolylineColorAppearance.VERTEX_FORMAT}),attributes:{color:e.ColorGeometryInstanceAttribute.fromColor(n)},id:`${i}`})},et=(t,n)=>[e.Cartesian3.fromDegrees(t.longitude,t.latitude,n.height),e.Cartesian3.fromDegrees(t.longitude,n.latitude,n.height),e.Cartesian3.fromDegrees(n.longitude,n.latitude,n.height),e.Cartesian3.fromDegrees(n.longitude,t.latitude,n.height),e.Cartesian3.fromDegrees(t.longitude,t.latitude,t.height),e.Cartesian3.fromDegrees(t.longitude,n.latitude,t.height),e.Cartesian3.fromDegrees(n.longitude,n.latitude,t.height),e.Cartesian3.fromDegrees(n.longitude,t.latitude,t.height)],tt=(t,n,i,o,r,s)=>[e.Cartesian3.fromDegrees(t,t,r),e.Cartesian3.fromDegrees(n,n,r),e.Cartesian3.fromDegrees(i,i,r),e.Cartesian3.fromDegrees(o,o,r),e.Cartesian3.fromDegrees(t,t,s),e.Cartesian3.fromDegrees(n,n,s),e.Cartesian3.fromDegrees(i,i,s),e.Cartesian3.fromDegrees(o,o,s)],nt=3e3*Math.PI/180,it=Math.PI,ot=6378245,rt=.006693421622965943,st=(e,t)=>!(e>72.004&&e<137.8347&&t>.8293&&t<55.8271),at=(e,t)=>{let n=2*e-100+3*t+.2*t*t+.1*e*t+.2*Math.sqrt(Math.abs(e));return n+=2*(20*Math.sin(6*e*it)+20*Math.sin(2*e*it))/3,n+=2*(20*Math.sin(t*it)+40*Math.sin(t/3*it))/3,n+=2*(160*Math.sin(t/12*it)+320*Math.sin(t*it/30))/3,n},ct=(e,t)=>{let n=300+e+2*t+.1*e*e+.1*e*t+.1*Math.sqrt(Math.abs(e));return n+=2*(20*Math.sin(6*e*it)+20*Math.sin(2*e*it))/3,n+=2*(20*Math.sin(e*it)+40*Math.sin(e/3*it))/3,n+=2*(150*Math.sin(e/12*it)+300*Math.sin(e/30*it))/3,n},lt=(e,t)=>{if(st(e,t))return[e,t];let n=at(e-105,t-35),i=ct(e-105,t-35);const o=t/180*it;let r=Math.sin(o);r=1-rt*r*r;const s=Math.sqrt(r);n=180*n/(ot*(1-rt)/(r*s)*it),i=180*i/(ot/s*Math.cos(o)*it);return[e+i,t+n]},dt=(e,t)=>{if(st(e,t))return[e,t];let n=at(e-105,t-35),i=ct(e-105,t-35);const o=t/180*it;let r=Math.sin(o);r=1-rt*r*r;const s=Math.sqrt(r);n=180*n/(ot*(1-rt)/(r*s)*it),i=180*i/(ot/s*Math.cos(o)*it);return[2*e-(e+i),2*t-(t+n)]},pt=(e,t)=>{const n=e,i=t,o=Math.sqrt(n*n+i*i)+2e-5*Math.sin(i*nt),r=Math.atan2(i,n)+3e-6*Math.cos(n*nt);return[o*Math.cos(r)+.0065,o*Math.sin(r)+.006]},ht=(e,t)=>{const n=e-.0065,i=t-.006,o=Math.sqrt(n*n+i*i)-2e-5*Math.sin(i*nt),r=Math.atan2(i,n)-3e-6*Math.cos(n*nt);return[o*Math.cos(r),o*Math.sin(r)]};class ut{static wgs84ToGcj02(e){const[t,n]=lt(e.lng,e.lat);return{lng:t,lat:n}}static gcj02ToWgs84(e){const[t,n]=dt(e.lng,e.lat);return{lng:t,lat:n}}static gcj02ToBd09(e){const[t,n]=pt(e.lng,e.lat);return{lng:t,lat:n}}static bd09ToGcj02(e){const[t,n]=ht(e.lng,e.lat);return{lng:t,lat:n}}static bd09ToWgs84(e){const[t,n]=((e,t)=>{const[n,i]=ht(e,t);return dt(n,i)})(e.lng,e.lat);return{lng:t,lat:n}}static wgs84ToBd09(e){const[t,n]=((e,t)=>{const[n,i]=lt(e,t);return pt(n,i)})(e.lng,e.lat);return{lng:t,lat:n}}}let mt;const gt=t=>new Promise(n=>{document.body.style.cursor="pointer",t._element.style.cursor="pointer",mt||(mt=new e.ScreenSpaceEventHandler(t.scene.canvas)),mt.setInputAction(async o=>{const r=t.scene.pickPosition(o.position);await t.scene.clampToHeightMostDetailed([r]);const s=i(r);t._element.style.cursor="default",mt.removeInputAction(e.ScreenSpaceEventType.LEFT_CLICK),n({position:r,lnglat:s})},e.ScreenSpaceEventType.LEFT_CLICK)}),yt=(e,t)=>{const n={},i=t.getFeature(e);return i?ft(i):n},ft=e=>{const t={};return e.getPropertyIds().forEach(n=>{t[n]=e.getProperty(n)}),t};export{fe as BaseMaterialProperty,ye as BasePrimitive,o as Common,ut as CoordinateTransformer,p as DefaultViewerOptions,Ue as FlyAttitude,X as Popup,je as RoamStatus,j as Tooltip,ae as calcArea,ge as calcBoundingSphereFromPositions,ue as calcCameraHeightFromZoom,oe as calcGeodesicDistance,re as calcGeodesicDistances,me as calcLerpPosition,se as calcPoistionCenter,de as calcSceneHeightFromPositions,ne as calcSpaceDistance,ie as calcSpaceDistances,le as calcTerrainHeightFromPositions,ce as calcTriangleArea,he as calcZoomFromCameraHeight,pe as clacPositionsForParabola,Ze as createBottomStatusBar,Q as createEagleEye,Ke as createOpenAnim,ze as createRoamHandler,ee as createRollerShutterHandler,Ge as createSkyBox,He as createSkyBoxOnGround,te as createSplitScreenHandler,U as delayTime,O as flyByRotateOut,F as flyByRotatePoint,x as flyToCameraView,I as flyToCesium3DTile,D as flyToDataSource,k as flyToFromSphere,S as flyToImagery,E as flyToLnglat,A as flyToNorth,T as flyToPosition,L as flyToRectangleBounds,P as getCameraView,d as getCesiumForAutoFitScale,yt as getFeaturesFromTileContent,ft as getFeaturesFromTileFeature,z as getInoCesiumBaseUrl,R as getScreenCenterPoint,s as initCesium,V as initCesiumEvent,et as makeGridFromElevationExtrema,Je as makeGridToInstanceForBox,Qe as makeGridToInstanceForLine,f as makeLnglatToPosition,w as makeLnglatsToLineGeojson,v as makeLnglatsToPointGeojson,M as makeLnglatsToPolygonGeojson,y as makeLnglatsToPositions,C as makePositionsClose,u as makePositionsForAntiClockwise,h as makePositionsForClockwise,m as makePositionsToLnglats,g as makePositiontoLnglat,b as makeYawPitchRollToHeadingPitchRoll,tt as mekeGridPolygonAndHeight,H as numberId,gt as pickPoint,Z as randomColor,W as randomPointToGeoJson,K as randomPolygonToGeoJson,Y as randomPolylineToGeoJson,B as setCameraAutoBackTiltToZero,l as setCesiumForAutoFitScale,a as setGlobeEnabled,c as setGlobeOpatity,_ as setViewToLnglat,N as twinkleModel};
|
|
1
|
+
import*as e from"cesium";import{polygon as t,centroid as n}from"@turf/turf";import{makePositiontoLnglat as i}from"@ino-cesium/common";var o=Object.freeze({__proto__:null});let r=1;const s=(t,n)=>{n||(n={token:""}),n.token&&(e.Ion.defaultAccessToken=n.token),e.Camera.DEFAULT_VIEW_RECTANGLE=e.Rectangle.fromDegrees(90,-20,110,90);const i={...p,...n},o=new e.Viewer(t,i);return o.imageryLayers.remove(o.imageryLayers.get(0)),o._cesiumWidget._creditContainer.style.display="none",o.scene.postProcessStages.fxaa.enabled=!0,o.scene.msaaSamples=8,o.scene.globe.baseColor=e.Color.fromCssColorString("rgba(0,0,255,0.5)"),o.scene.globe.depthTestAgainstTerrain=!0,o.scene.globe.showGroundAtmosphere=!0,o.scene.globe.enableLighting=!1,o.scene.screenSpaceCameraController.maximumTiltAngle=Math.PI/2,console.log("%c%s","color: GREEN; font-size: 20px",`Cesium ${e.VERSION}`),o},a=(t,n)=>{const i=n?1:0;t.scene.skyBox.show=n,t.scene.skyAtmosphere.show=n,t.scene.globe.dynamicAtmosphereLighting=n,t.scene.globe.dynamicAtmosphereLightingFromSun=n,t.scene.globe.translucency.backFaceAlpha=i,t.scene.globe.baseColor=e.Color.fromCssColorString(`rgba(121, 121, 255,${i})`),t.scene.globe.showGroundAtmosphere=n,n?(t.scene.backgroundColor=e.Color.fromCssColorString(`rgba(255,255,255,${i})`),t.scene.globe.material=void 0,t.scene.globe.translucency.enabled=!1):(t.scene.globe.translucency.enabled=!1,t.scene.globe.undergroundColor=e.Color.fromCssColorString(`rgba(0, 0, 0,${i})`),t.scene.backgroundColor=e.Color.fromCssColorString(`rgba(0,0,0,${i})`),t.scene.globe.material=new e.Material({fabric:{type:"Color",uniforms:{color:e.Color.fromCssColorString(`rgba(0, 0, 0,${i})`)}}}))},c=(e,t)=>{t.scene.globe.translucency.enabled=!0,t.scene.globe.translucency.frontFaceAlpha=e,t.scene.globe.translucency.backFaceAlpha=e},l=e=>{r=e},d=()=>r,p={animation:!1,baseLayerPicker:!1,fullscreenButton:!1,geocoder:!1,homeButton:!1,infoBox:!0,sceneModePicker:!1,selectionIndicator:!1,timeline:!1,navigationHelpButton:!1,scene3DOnly:!0,navigation:!1,navigationInstructionsInitiallyVisible:!1,showRenderLoopErrors:!0,orderIndependentTranslucency:!1,contextOptions:{webgl:{alpha:!0}}},h=t=>{let n=0;for(let i=0;i<t.length;i++){const o=t[i],r=t[(i+1)%t.length];n+=e.Cartesian3.cross(o,r,new e.Cartesian3).z}return n>0?t.reverse():t},u=t=>{let n=0;for(let i=0;i<t.length;i++){const o=t[i],r=t[(i+1)%t.length];n+=e.Cartesian3.cross(o,r,new e.Cartesian3).z}return n<0?t.reverse():t},m=e=>e.map(e=>g(e)),g=t=>{const n=e.Cartographic.fromCartesian(t);return{longitude:e.Math.toDegrees(n.longitude),latitude:e.Math.toDegrees(n.latitude),height:n.height}},y=t=>t.map(t=>e.Cartesian3.fromDegrees(t.longitude,t.latitude,t.height)),f=t=>e.Cartesian3.fromDegrees(t.longitude,t.latitude,t.height),C=e=>{const t=e[0],n=e[e.length-1];return t.x===n.x&&t.y===n.y&&t.z===n.z?e:[...e,e[0]]},v=e=>{const t=[];return e.forEach(e=>{t.push({type:"Feature",geometry:{type:"Point",coordinates:[e.longitude,e.latitude]},properties:{height:e.height}})}),{type:"FeatureCollection",features:t}},M=e=>{const t=[];return e.forEach((n,i)=>{0!==i&&t.push({type:"Feature",geometry:{type:"LineString",coordinates:[[e[i-1].longitude,e[i-1].latitude],[n.longitude,n.latitude]]},properties:{height:n.height}})}),{type:"FeatureCollection",features:t}},w=e=>{const t=[];return t.push({type:"Feature",geometry:{type:"Polygon",coordinates:[e.map(e=>[e.longitude,e.latitude])]},properties:{heights:e.map(e=>e.height)}}),{type:"FeatureCollection",features:t}},b=t=>({heading:e.Math.toRadians(t.yaw+(t.offsetYaw||0)),pitch:e.Math.toRadians(t.pitch),roll:e.Math.toRadians(t.roll)}),_=t=>{const{lng:n,lat:i,height:o,viewer:r}=t;r.scene.camera.setView({destination:e.Cartesian3.fromDegrees(n,i,o||1e4),orientation:{heading:e.Math.toRadians(0),pitch:e.Math.toRadians(-90),roll:0}})},E=t=>{const{lng:n,lat:i,height:o,viewer:r}=t;r.scene.camera.flyTo({destination:e.Cartesian3.fromDegrees(n,i,o||1e4),orientation:{heading:e.Math.toRadians(0),pitch:e.Math.toRadians(-90),roll:0}})},T=e=>{const{position:t,viewer:n}=e;n.scene.camera.flyTo({destination:t})};function P(t){const n=t.camera.heading,i=t.camera.pitch,o=t.camera.roll;return{destination:new e.Cartesian3(t.camera.position.x,t.camera.position.y,t.camera.position.z),orientation:{heading:n,pitch:i,roll:o}}}function x(e,t){e&&t.scene.camera.flyTo({...e})}function D(e,t){const n=t.dataSources.getByName(e);n.length>0&&t.flyTo(n[0])}function S(e,t){e&&t.flyTo(e)}function I(e,t){t.flyTo(e)}function k(t,n){const i=new e.Cartesian3(t[0],t[1],t[2]),o=new e.BoundingSphere(i,t[3]);n.camera.flyToBoundingSphere(o,{offset:new e.HeadingPitchRange(3.5,-.5,200),duration:2})}const R=(t,n,i,o,r)=>{if(i<=t||o<=n)return void console.error("无效的边界坐标:东必须大于西,北必须大于南");const s={destination:e.Rectangle.fromDegrees(t,n,i,o),duration:3,orientation:{heading:e.Math.toRadians(0),pitch:e.Math.toRadians(-90),roll:0}};r.camera.flyTo(s)},L=t=>{t.camera.flyTo({destination:t.scene.camera.position,orientation:{heading:e.Math.toRadians(0),pitch:e.Math.toRadians(-90),roll:0},duration:1.5})};function A(t){const n=t.scene.canvas,i=n.clientWidth/2,o=n.clientHeight/2;return t.scene.pickPosition(new e.Cartesian2(i,o))}const F=t=>{let n=!1;let i;const o=t.camera;let r=o.pitch,s=0,a=!1;function c(){if(!n||!i)return;let e=o.heading;a?e+=.005:e-=.005,t.camera.setView({destination:i,orientation:{heading:e,pitch:r}}),t.camera.moveBackward(s),requestAnimationFrame(c)}return{start:(l,d)=>{i=l||A(t),r=o.pitch,a=!!d,s=e.Cartesian3.distance(o.position,i),n=!0,c(),t.scene.screenSpaceCameraController.enableInputs=!1},end:()=>{n=!1,t.scene.screenSpaceCameraController.enableInputs=!0}}},O=e=>{let t=!1;let n=!1;function i(){if(!t)return;let o=e.camera.heading;n?o+=.001:o-=.001,e.camera.setView({orientation:{heading:o,pitch:e.camera.pitch}}),requestAnimationFrame(i)}t=!0;return{start:e=>{t=!0,n=!!e,i()},end:()=>{t=!1}}};function N(e){e.show=!1,setTimeout(()=>{e.show=!0,setTimeout(()=>{e.show=!1,setTimeout(()=>{e.show=!0},300)},300)},300)}const B=(t,n)=>{console.log("sdfjdsklf"),n||(n=1e5);let i=!1;t.camera.moveEnd.addEventListener(function(){if(i)return;const o=t.camera,r=t.camera.positionCartographic.height;console.log("cameraEnd",r);const s=o.heading,a=o.roll;if(r>n){i=!0;const n=t.camera.computeViewRectangle();if(!n)return void(i=!0);const o={longitude:0,latitude:0},c=e.Rectangle.center(n);o.longitude=e.Math.toDegrees(c.longitude),o.latitude=e.Math.toDegrees(c.latitude),t.camera.flyTo({destination:f(new e.Cartographic(o.longitude,o.latitude,r)),orientation:{heading:s,pitch:-1.5,roll:a},duration:1,complete:()=>{}})}else i=!1,t.scene.screenSpaceCameraController.maximumTiltAngle=Math.PI/2})},V=(t,n)=>{const i=t.scene,o=new e.ScreenSpaceEventHandler(i.canvas);o.setInputAction(e=>{if(n.LEFT_POSITION){const o=i.pickPosition(e.position);G(e.position,o,n.LEFT_POSITION,t)}n.PICK_FEATURE&&$(t,e.position,n.PICK_FEATURE),t._element.style.cursor="default"},e.ScreenSpaceEventType.LEFT_CLICK),o.setInputAction(e=>{if(n.MOVE_POSITION){const o=i.pickPosition(e.endPosition);G(e.endPosition,o,n.MOVE_POSITION,t)}n.MOVE_PICK_FEATURE&&$(t,e.endPosition,n.MOVE_PICK_FEATURE)},e.ScreenSpaceEventType.MOUSE_MOVE)},$=(t,n,i)=>{const o=t.scene.pickPosition(n),r=t.scene.pick(n),s={};if(r){if(t._element.style.cursor="pointer",r instanceof e.Cesium3DTileFeature){r.getPropertyIds().forEach(e=>{s[e]=r.getProperty(e)})}else r.id instanceof e.Cesium3DTileContent?(t._element.style.cursor="pointer",Object.assign(s,{name:"sdfjldks"})):r.id instanceof e.Entity?t._element.style.cursor="pointer":r.primitive&&Object.assign(s,r.primitive.properties);i({position:o,...r},s)}else i(void 0,{})},G=(t,n,i,o)=>{n||(n=e.Cartesian3.fromDegrees(0,0,0));const r=e.Cartographic.fromCartesian(n);i({windowPosition:t,position:n,lnglat:{lng:e.Math.toDegrees(r.longitude),lat:e.Math.toDegrees(r.latitude),height:r.height},cameraView:P(o)})};let H=100,z="",U="0";const j=t=>{const{viewer:n}=t,i=document.createElement("div");i.className="bottom-status-bar";const o=document.createElement("div");o.className="scale-bar",o.innerHTML="";const r=document.createElement("div");r.className="scale-label",r.innerHTML="",o.appendChild(r),i.appendChild(o);const s=document.createElement("div");s.id="bottom-status-bar-camera",t.clickCopy&&(s.style.pointerEvents="auto",s.style.cursor="pointer"),i.appendChild(s),s.style.display="flex";const a=document.createElement("div"),c=document.createElement("div"),l=n._element.getElementsByClassName("cesium-widget")[0];if(!l)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");l.appendChild(i),V(n,{MOVE_POSITION(e){s.innerHTML=`\n 经度:${e.lnglat.lng.toFixed(6)} \n 纬度:${e.lnglat.lat.toFixed(6)} \n 高程:${e.lnglat.height.toFixed(2)} \n `,t.clickCopy&&P(n),s.appendChild(c),s.appendChild(a)}}),t.clickCopy&&document.addEventListener("click",e=>{e.target.id});let d=Date.now(),p=0;const h=()=>{requestAnimationFrame(()=>{if(p+=1,p>=30){const e=Date.now(),t=e-d,n=Math.round(1e3/(t/p));d=e,p=0,a.innerHTML=`${n} FPS`}t.hpr?c.innerHTML=`\n 方位角:${e.Math.toDegrees(n.camera.heading).toFixed(1)}° \n 俯仰角:${e.Math.toDegrees(n.camera.pitch).toFixed(1)}° \n 翻滚角:${e.Math.toDegrees(n.camera.roll).toFixed(1)}° \n `:c.innerHTML="",c.innerHTML+=`\n 视高:${n.camera.positionCartographic.height.toFixed(0)}m \n `;const i=X(n);r.innerHTML=`${i.distanceLabel}`,h()})};h()},X=t=>{const n=t.camera.positionCartographic.height.toFixed(0);if(n===U)return{barWidth:H,distanceLabel:z};U=n;const i=new e.EllipsoidGeodesic,o=[1,2,3,5,10,20,30,50,100,200,300,500,1e3,2e3,3e3,5e3,1e4,2e4,3e4,5e4,1e5,2e5,3e5,5e5,1e6,2e6,3e6,5e6,1e7,2e7,3e7,5e7],r=t.scene,s=r.canvas.clientWidth,a=r.canvas.clientHeight,c=r.camera.getPickRay(new e.Cartesian2(s/2|0,a-1)),l=r.camera.getPickRay(new e.Cartesian2(1+s/2|0,a-1)),d=r.globe,p=d.pick(c,r),h=d.pick(l,r);if(!e.defined(p)||!e.defined(h))return{barWidth:H,distanceLabel:z};const u=d.ellipsoid.cartesianToCartographic(p),m=d.ellipsoid.cartesianToCartographic(h);i.setEndPoints(u,m);const g=i.surfaceDistance;let y;for(let t=o.length-1;!e.defined(y)&&t>=0;--t)o[t]/g<100&&(y=o[t]);if(e.defined(y)){const e=y>=1e3?`${(y/1e3).toString()} km`:`${y.toString()} m`;H=y/g|0,z=e}else H=0,z="1 m";return{barWidth:H,distanceLabel:z}},W=(t,n)=>{let i=!1;const o=new e.Viewer(t,{...p,scene3DOnly:!1});o.scene.mode=2;const r=o.scene.screenSpaceCameraController;r.enableRotate=!1,r.enableTranslate=!1,r.enableZoom=!1,r.enableTilt=!1,r.enableLook=!1,n.entities.add({position:e.Cartesian3.fromDegrees(0,0),label:{text:new e.CallbackProperty(()=>(s(),""),!0)}});const s=function(){i||o.camera.flyTo({destination:n.camera.position,orientation:{heading:n.camera.heading,pitch:n.camera.pitch,roll:n.camera.roll},duration:0})};return{viewer:o,open:()=>{i=!1},close:()=>{i=!0}}};class q{static popup;_div;viewer;offset=new e.Cartesian2(140,150);position=e.Cartesian3.ZERO;constructor(e,t,n){this.viewer=e,n&&(this.offset=n),this._div=t,this._div.style.position="absolute",this._div.style.left="0",this._div.style.top="0",this._div.style.display="none";const i=e._element.getElementsByClassName("cesium-widget")[0];if(!i)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");i.appendChild(t),this.renderPosition()}showAt(e){this.position=e,e&&this.setVisible(!0)}setVisible(e){this._div.style.display=e?"block":"none"}renderPosition(){this.viewer.scene.postRender.addEventListener(()=>{if(!this.position.equals(e.Cartesian3.ZERO)){const e=this.viewer.scene.cartesianToCanvasCoordinates(this.position);this._div.style.left=e.x-this.offset.x+"px",this._div.style.top=e.y-this.offset.y+"px"}})}static createPopup(e,t,n){return q.popup||(q.popup=new q(e,t,n)),q.popup}destroy(){q.popup&&(this._div&&this._div.parentNode.removeChild(this._div),q.popup=null)}}const Z=t=>{const n=[],i=e=>{t.scene.splitPosition=e},o=(e,t)=>{n.push(e),e.splitDirection=t};return{set:()=>{i(.5),function(){let e=document.getElementById("vertical-slider");if(e)return void(e.style.display="block");e=document.createElement("div"),e.id="vertical-slider";const n=t._element.getElementsByClassName("cesium-widget")[0];if(!n)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");n.appendChild(e)}(),function(){const e=document.getElementById("vertical-slider");function n(){document.removeEventListener("mousemove",o,!1)}function i(){document.addEventListener("mousemove",o,!1)}function o(n){n.preventDefault?n.preventDefault():n.returnValue=!1,e.style.left=`${n.clientX}px`;const i=n.clientX/e.parentElement.offsetWidth;t.scene.splitPosition=i}e.addEventListener("mousedown",i,!1),document.addEventListener("mouseup",n,!1)}()},remove:()=>{n.forEach(t=>{o(t,e.SplitDirection.NONE)});document.getElementById("vertical-slider").style.display="none"},setSplitPosition:i,setSplitDirection:o}},Y=t=>{const n=t;let i;const o={},r=()=>{const e=n.container;e.style.display="flex";e.getElementsByClassName("cesium-viewer")[0].style.width="50%";const t=document.createElement("div");t.style={width:"50%",height:"100%"},t.id="right-screen-viewer",e.appendChild(t),i=s(t.id),o[1]=i,c(),n.camera.changed.addEventListener(()=>a(n,i)),n.scene.preRender.addEventListener(()=>a(n,i)),n.camera.percentageChanged=.01,i.camera.changed.addEventListener(()=>a(i,n)),i.scene.preRender.addEventListener(()=>a(i,n)),i.camera.percentageChanged=.01,i._splitNumber=1};function a(t,n){const i=e.Cartographic.toCartesian(t.camera.positionCartographic);n.camera.setView({destination:new e.Cartesian3(i.x,i.y,i.z),orientation:{direction:t.scene.camera._direction,up:t.scene.camera.up,heading:t.scene.camera.heading,pitch:t.scene.camera.pitch,roll:t.scene.camera.roll}})}const c=()=>{n.imageryLayers._layers.forEach(e=>{e.splitScreenBaseLayer&&i.imageryLayers.addImageryProvider(e.imageryProvider)})};return{set:()=>{r(),function(){let e=document.getElementById("split-screen-slider");if(e)return void(e.style.display="block");e=document.createElement("div"),e.id="split-screen-slider";const n=t._element.getElementsByClassName("cesium-widget")[0];if(!n)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");n.appendChild(e)}(),n._splitNumber=-1,o[-1]=n},viewerMap:o,getViewerFromKey:e=>o[e],remove:()=>{document.getElementById("split-screen-slider").style.display="none";n.container.getElementsByClassName("cesium-viewer")[0].style.width="100%",i.container.remove(),delete o[1]},setLayer:(e,t)=>{},updateBaseLayers:c}};class K{static tooltip;_title;_div;_message;constructor(e){const t=document.createElement("DIV");t.id="tooltip",t.className="twipsy right";const n=document.createElement("DIV");n.className="twipsy-inner",t.appendChild(n),this._div=t,this._title=n,this._message="";const i=e._element.getElementsByClassName("cesium-widget")[0];if(!i)throw new Error("The cesium-widget element has not finished loading yet, so the popup cannot be created!");i.appendChild(t),t.onmousemove=e=>{this.showAt({x:e.clientX,y:e.clientY},this._message)}}showAt(e,t){e&&t&&(this.setVisible(!0),this._title.innerHTML=t,this._div.style.left=`${e.x+10}px`,this._div.style.top=e.y-this._div.clientHeight/2+"px",this._message=t)}setVisible(e){this._div.style.display=e?"block":"none"}static createToolTip(e){return K.tooltip||(K.tooltip=new K(e)),K.tooltip}destroy(){K.tooltip&&(this._div&&this._div.parentNode.removeChild(this._div),K.tooltip=null)}}class J{_primitive;_promise;appearance;geometryInstance;drawCommand;shapePositions;needUpdate=!1;constructor(){this._primitive=void 0,this.appearance=void 0,this.geometryInstance=void 0,this._promise=null,this.drawCommand=null,this.needUpdate=!1,this.shapePositions=[]}update(e){const t=this.getPrimitive();if(t){this._primitive=t;this._primitive.update(e)}}then(e=null){return this._promise?.then(e)}catch(e=null){return this._promise?.catch(e)}isDestroyed(){return!!this._primitive}destroy(){this._primitive=void 0}setShapePositions(e){this.shapePositions=e}}class Q{_definitionChanged=new e.Event;get definitionChanged(){return this._definitionChanged}get isConstant(){return!1}}const ee=()=>`${Date.now()}${Math.round(9999999999*Math.random()+1)}`,te=()=>window.INO_CESIUM_BASE_URL,ne=e=>new Promise(t=>setTimeout(t,e)),ie=e.BoxGeometry,oe=e.Cartesian3,re=e.defaultValue,se=e.defined,ae=e.destroyObject,ce=e.DeveloperError,le=e.GeometryPipeline,de=e.Matrix3,pe=e.Matrix4,he=e.Transforms,ue=e.VertexFormat,me=e.BufferUsage,ge=e.CubeMap,ye=e.DrawCommand,fe=e.loadCubeMap,Ce=e.RenderState,ve=e.VertexArray,Me=e.BlendingState,we=e.SceneMode,be=e.ShaderProgram,_e=e.ShaderSource,Ee=new de;class Te{constructor(t){e.defined(e.Matrix4.getRotation)||(e.Matrix4.getRotation=e.Matrix4.getMatrix3),this.sources=t.sources,this._sources=void 0,this.show=re(t.show,!0),this._command=new ye({modelMatrix:pe.clone(pe.IDENTITY),owner:this}),this._cubeMap=void 0,this._attributeLocations=void 0,this._useHdr=void 0}update(e,t){const n=this;if(!this.show)return;if(e.mode!==we.SCENE3D&&e.mode!==we.MORPHING)return;if(!e.passes.render)return;const i=e.context;if(this._sources!==this.sources){this._sources=this.sources;const e=this.sources;if(!(se(e.positiveX)&&se(e.negativeX)&&se(e.positiveY)&&se(e.negativeY)&&se(e.positiveZ)&&se(e.negativeZ)))throw new ce("this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties.");if(typeof e.positiveX!=typeof e.negativeX||typeof e.positiveX!=typeof e.positiveY||typeof e.positiveX!=typeof e.negativeY||typeof e.positiveX!=typeof e.positiveZ||typeof e.positiveX!=typeof e.negativeZ)throw new ce("this.sources properties must all be the same type.");"string"==typeof e.positiveX?fe(i,this._sources).then(e=>{n._cubeMap=n._cubeMap&&n._cubeMap.destroy(),n._cubeMap=e}):(this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),this._cubeMap=new ge({context:i,source:e}))}const o=this._command;if(o.modelMatrix=he.eastNorthUpToFixedFrame(e.camera._positionWC),!se(o.vertexArray)){o.uniformMap={u_cubeMap:()=>n._cubeMap,u_rotateMatrix:()=>pe.getRotation(o.modelMatrix,Ee)};const e=ie.createGeometry(ie.fromDimensions({dimensions:new oe(2,2,2),vertexFormat:ue.POSITION_ONLY})),t=this._attributeLocations=le.createAttributeLocations(e);o.vertexArray=ve.fromGeometry({context:i,geometry:e,attributeLocations:t,bufferUsage:me._DRAW}),o.renderState=Ce.fromCache({blending:Me.ALPHA_BLEND})}if(!se(o.shaderProgram)||this._useHdr!==t){const e=new _e({defines:[t?"HDR":""],sources:["precision highp float;\n\nuniform samplerCube u_cubeMap;\nin vec3 v_texCoord;\nout vec4 fragColor;\n\nvoid main() {\n vec4 color = texture(u_cubeMap, normalize(v_texCoord));\n fragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);\n}"]});o.shaderProgram=be.fromCache({context:i,vertexShaderSource:"#version 300 es\n\nprecision highp float;\n\nin vec3 position;\nout vec3 v_texCoord;\n\nuniform mat3 u_rotateMatrix;\n\nvoid main() {\n vec3 p = czm_viewRotation * u_rotateMatrix * (czm_temeToPseudoFixed * (czm_entireFrustum.y * position));\n gl_Position = czm_projection * vec4(p, 1.0);\n v_texCoord = position;\n}\n",fragmentShaderSource:e,attributeLocations:this._attributeLocations}),this._useHdr=t}return se(this._cubeMap)?o:void 0}isDestroyed(){return!1}destroy(){const e=this._command;return e.vertexArray=e.vertexArray&&e.vertexArray.destroy(),e.shaderProgram=e.shaderProgram&&e.shaderProgram.destroy(),this._cubeMap=this._cubeMap&&this._cubeMap.destroy(),ae(this)}}const Pe=t=>{const{viewer:n,sources:i}=t;return n.scene.skyBox=new e.SkyBox({sources:i}),n.scene.skyBox},xe=t=>{let{viewer:n,sources:i}=t;const o=t.height?t.height:225705,r=n.scene.skyBox,s=n.scene.skyAtmosphere.show;i||(i={positiveX:`${te()}/assets/images/ground-skybox/px.jpg`,negativeX:`${te()}/assets/images/ground-skybox/nx.jpg`,positiveY:`${te()}/assets/images/ground-skybox/py.jpg`,negativeY:`${te()}/assets/images/ground-skybox/ny.jpg`,positiveZ:`${te()}/assets/images/ground-skybox/pz.jpg`,negativeZ:`${te()}/assets/images/ground-skybox/nz.jpg`});const a=new Te({sources:i});n.scene.postRender.addEventListener(()=>{const t=n.camera.position;e.Cartographic.fromCartesian(t).height<o?(n.scene.skyBox=a,n.scene.skyAtmosphere.show=!1):(n.scene.skyBox=r,n.scene.skyAtmosphere.show=s)})},De=t=>{const n=[];let i,o;t.clock.shouldAnimate=!0;const r={},s=(e,n)=>{if(a(),e.entity.cylinder){const n=e.entity.cylinder;n.roamId=e.id,e.entity.cylinder=void 0,o=t.entities.add({position:e.property,cylinder:n})}t.trackedEntity=e.entity,n&&(i=e)},a=()=>{if(o){t.entities.remove(o);const e=n.find(e=>e.id===o.cylinder.roamId);e&&(e.entity.cylinder=o.cylinder),o=void 0}},c=()=>{t.trackedEntity=void 0,i=void 0,a()},l=e=>{t.trackedEntity?.id===e.entity.id&&c(),t.entities.remove(e.entity);const i=n.findIndex(t=>t.id===e.id);i>-1&&n.splice(i,1)},d=(e,t)=>{const n=e.property.getValue(t);if(n&&(e.status="ROAMING",m.roaming&&m.roaming(e,{time:t,position:n})),e.stopTime.secondsOfDay<t.secondsOfDay&&"END"!==e.status&&(e.status="END",m.end&&m.end(e),e.loop?p(e):c()),e.flyParams.hpr){const i=r[e.id].find(e=>e.time>t.secondsOfDay);i&&u(e,i,n)}},p=n=>{const{property:i,startTime:o,stopTime:r}=h(n);n.stopTime=r,n.startTime=o,n.property=i,n.flyParams.hpr||(n.entity.orientation=new e.VelocityOrientationProperty(i)),n.entity.position=i,n.status="START",t.clock.currentTime=o,t.clock.multiplier=1,m.reStart&&m.reStart(n)},h=t=>{const n=[],{positions:i,flyParams:o}=t,s=new e.SampledPositionProperty;let a=0;const c=e.JulianDate.now();let l=c.clone();return i.forEach((t,r)=>{let d=e.JulianDate.now();if(r){let n=0;if(o.speed){n=e.Cartesian3.distance(t,i[r-1])/(1e3*o.speed/3600)}o.times&&(n=(o.times[r]-o.times[r-1])/1e3),a+=n,d=e.JulianDate.addSeconds(c,a,new e.JulianDate)}else d=c;l=d,s.addSample(d,t),o.hpr&&n.push({time:d.secondsOfDay,heading:o.hpr[r].heading,pitch:o.hpr[r].pitch,roll:o.hpr[r].roll})}),r[t.id]=n,{property:s,startTime:c,stopTime:l}},u=(t,n,i)=>{if(!i)return;const{heading:o,pitch:r,roll:s}=n,a=new e.HeadingPitchRoll(o,r,s);t.entity.orientation=Transforms.headingPitchRollQuaternion(i,a)};t.scene.preRender.addEventListener((o,r)=>{if(n.forEach(e=>{d(e,r)}),!i)return;const s=i.entity.computeModelMatrix(t.clock.currentTime);s&&t.camera.lookAtTransform(s,new e.Cartesian3(...[-20,0,5]))});const m={};return{set:i=>{const{entity:o}=i;i.id=ee(),t.entities.add(o);const{property:r,startTime:s,stopTime:a}=h(i);i.flyParams.hpr||(o.orientation=new e.VelocityOrientationProperty(r)),o.position=r;const c={...i,startTime:s,stopTime:a,property:r,status:"START"};return t.clock.currentTime=s,t.clock.multiplier=1,n.push(c),c.status="START",m.start&&m.start(c),c},tracked:s,stopTracked:c,remove:l,frameRoam:d,trackedByEntityId:(e,t)=>{const i=n.find(t=>t.entity.id===e);i&&s(i,t)},removeAll:()=>{n.forEach(e=>{l(e)}),n.length=0},Event:m,lockCameraView:e=>{i=e},updateRoamAttitude:(t,n)=>{"UP"!==n&&"DOWN"!==n||(t.entity.orientation=void 0),"front"!==n&&"back"!==n||(t.entity.orientation=new e.VelocityOrientationProperty(t.property))}}};var Se=(e=>(e.UP="UP",e.DOWN="DOWN",e.LEFT="left",e.RIGHT="right",e.FRONT="front",e.BACK="back",e))(Se||{}),Ie=(e=>(e.END="END",e.START="START",e.ROAMING="ROAMING",e))(Ie||{});const ke=t=>new Promise(n=>{const{viewer:i,center:o}=t;let r=o.lng,s=1,a=null;const c=t=>{null===a&&(a=t);r-=(t-a)/2e4*2,r<-180&&(r=180,s+=1),2===s&&r>o.lng?i.camera.flyTo({destination:e.Cartesian3.fromDegrees(o.lng,o.lat,3e7),duration:2,orientation:{heading:e.Math.toRadians(360),pitch:e.Math.toRadians(-90),roll:0},easingFunction:e.EasingFunction.LINEAR_NONE,complete:()=>{i.camera.flyTo({destination:e.Cartesian3.fromDegrees(o.lng,o.lat,o.height),duration:3,orientation:{heading:e.Math.toRadians(2.8),pitch:e.Math.toRadians(-90),roll:6.282253919167732},complete:()=>{n(!0)}})}}):(i.camera.setView({destination:e.Cartesian3.fromDegrees(r,o.lat,3e7),orientation:{heading:e.Math.toRadians(360),pitch:e.Math.toRadians(-90),roll:0}}),requestAnimationFrame(c))};requestAnimationFrame(c)}),Re=(t,n)=>{const i=e.Cartographic.fromCartesian(t),o=e.Cartographic.fromCartesian(n),r=new e.EllipsoidGeodesic;r.setEndPoints(i,o);let s=r.surfaceDistance;return s=Math.sqrt(s**2+(o.height-i.height)**2),s};function Le(e){let t=0;return e.forEach((n,i)=>{if(i===e.length-1)return;const o=Re(n,e[i+1]);t+=o}),t}function Ae(t,n,i){const{EllipsoidGeodesic:o,Ellipsoid:r}=e;return new o((i=i||r.WGS84).cartesianToCartographic(t),i.cartesianToCartographic(n)).surfaceDistance}function Fe(e){let t=0;return e.forEach((n,i)=>{if(i===e.length-1)return;const o=Ae(n,e[i+1]);t+=o}),t}const Oe=i=>{if(i.length<4)return e.BoundingSphere.fromPoints(i).center;const o=t([i.map(e=>[e.x,e.y])]),r=e.BoundingSphere.fromPoints(i).center,s=n(o);return new e.Cartesian3(s.geometry.coordinates[0],s.geometry.coordinates[1],r.z)};function Ne(t){let n=0;const{CoplanarPolygonGeometry:i,VertexFormat:o,defined:r,Cartesian3:s}=e,a=i.createGeometry(i.fromPositions({positions:t,vertexFormat:o.POSITION_ONLY}));if(r(a)){const e=a.indices,t=a.attributes.position.values;for(let i=0;i<e.length;i+=3){const o=e[i],r=e[i+1],a=e[i+2];n+=Be(s.unpack(t,3*o,{}),s.unpack(t,3*r,{}),s.unpack(t,3*a,{}))}}return n}const Be=(t,n,i)=>{const{Cartesian3:o}=e,r=o.subtract(t,n,{}),s=o.subtract(i,n,{}),a=o.cross(r,s,r);return.5*o.magnitude(a)},Ve=async(t,n)=>{const i=n.map(t=>e.Cartographic.fromCartesian(t));return await e.sampleTerrainMostDetailed(t,i)},$e=async(e,t)=>await e.scene.clampToHeightMostDetailed(t),Ge=(t,n,i,o)=>{const r=[],s=e.Cartographic.fromCartesian(t),a=e.Cartographic.fromCartesian(n),c=180*s.longitude/Math.PI,l=180*s.latitude/Math.PI,d=180*a.longitude/Math.PI,p=180*a.latitude/Math.PI,h=Math.sqrt((c-d)*(c-d)+(l-p)*(l-p))*i,u=e.Cartesian3.clone(t),m=e.Cartesian3.clone(n),g=e.Cartesian3.distance(u,e.Cartesian3.ZERO),y=e.Cartesian3.distance(m,e.Cartesian3.ZERO);if(e.Cartesian3.normalize(u,u),e.Cartesian3.normalize(m,m),!e.Cartesian3.distance(u,m))return r;const f=e.Cartesian3.angleBetween(u,m);r.push(t);for(let t=1;t<o-1;t++){const n=1*t/(o-1),i=1-n,s=Math.sin(i*f)/Math.sin(f),a=Math.sin(n*f)/Math.sin(f),c=e.Cartesian3.multiplyByScalar(u,s,new e.Cartesian3),l=e.Cartesian3.multiplyByScalar(m,a,new e.Cartesian3);let d=e.Cartesian3.add(c,l,new e.Cartesian3);const p=n*Math.PI,C=g*i+y*n+Math.sin(p)*h;d=e.Cartesian3.multiplyByScalar(d,C,d),r.push(d)}return r.push(n),r},He=e=>{const t=e.positionCartographic.height,n=-40467.74;return Math.round(n+80955.31/(1+(t/91610.74)**7096758e-11))},ze=e=>e,Ue=(t,n)=>{const i=[];let o=0,r=0,s=0;const a=[];for(let n=0;n<t.length-1;++n)o+=e.Cartesian3.distance(t[n],t[n+1]);for(let n=0;n<t.length;n++)0===n?r=0:(s+=e.Cartesian3.distance(t[n-1],t[n]),r=s/o),i.push(r);const c=new e.LinearSpline({times:i,points:t});for(let e=0;e<=n;e++){const t=c.evaluate(e/n);a.push(t)}return a},je=t=>{const n=new e.BoundingSphere(e.Cartesian3.ZERO,0);return e.BoundingSphere.fromPoints(t,n),n},Xe=3e3*Math.PI/180,We=Math.PI,qe=6378245,Ze=.006693421622965943,Ye=(e,t)=>!(e>72.004&&e<137.8347&&t>.8293&&t<55.8271),Ke=(e,t)=>{let n=2*e-100+3*t+.2*t*t+.1*e*t+.2*Math.sqrt(Math.abs(e));return n+=2*(20*Math.sin(6*e*We)+20*Math.sin(2*e*We))/3,n+=2*(20*Math.sin(t*We)+40*Math.sin(t/3*We))/3,n+=2*(160*Math.sin(t/12*We)+320*Math.sin(t*We/30))/3,n},Je=(e,t)=>{let n=300+e+2*t+.1*e*e+.1*e*t+.1*Math.sqrt(Math.abs(e));return n+=2*(20*Math.sin(6*e*We)+20*Math.sin(2*e*We))/3,n+=2*(20*Math.sin(e*We)+40*Math.sin(e/3*We))/3,n+=2*(150*Math.sin(e/12*We)+300*Math.sin(e/30*We))/3,n},Qe=(e,t)=>{if(Ye(e,t))return[e,t];let n=Ke(e-105,t-35),i=Je(e-105,t-35);const o=t/180*We;let r=Math.sin(o);r=1-Ze*r*r;const s=Math.sqrt(r);n=180*n/(qe*(1-Ze)/(r*s)*We),i=180*i/(qe/s*Math.cos(o)*We);return[e+i,t+n]},et=(e,t)=>{if(Ye(e,t))return[e,t];let n=Ke(e-105,t-35),i=Je(e-105,t-35);const o=t/180*We;let r=Math.sin(o);r=1-Ze*r*r;const s=Math.sqrt(r);n=180*n/(qe*(1-Ze)/(r*s)*We),i=180*i/(qe/s*Math.cos(o)*We);return[2*e-(e+i),2*t-(t+n)]},tt=(e,t)=>{const n=e,i=t,o=Math.sqrt(n*n+i*i)+2e-5*Math.sin(i*Xe),r=Math.atan2(i,n)+3e-6*Math.cos(n*Xe);return[o*Math.cos(r)+.0065,o*Math.sin(r)+.006]},nt=(e,t)=>{const n=e-.0065,i=t-.006,o=Math.sqrt(n*n+i*i)-2e-5*Math.sin(i*Xe),r=Math.atan2(i,n)-3e-6*Math.cos(n*Xe);return[o*Math.cos(r),o*Math.sin(r)]};class it{static wgs84ToGcj02(e){const[t,n]=Qe(e.lng,e.lat);return{lng:t,lat:n}}static gcj02ToWgs84(e){const[t,n]=et(e.lng,e.lat);return{lng:t,lat:n}}static gcj02ToBd09(e){const[t,n]=tt(e.lng,e.lat);return{lng:t,lat:n}}static bd09ToGcj02(e){const[t,n]=nt(e.lng,e.lat);return{lng:t,lat:n}}static bd09ToWgs84(e){const[t,n]=((e,t)=>{const[n,i]=nt(e,t);return et(n,i)})(e.lng,e.lat);return{lng:t,lat:n}}static wgs84ToBd09(e){const[t,n]=((e,t)=>{const[n,i]=Qe(e,t);return tt(n,i)})(e.lng,e.lat);return{lng:t,lat:n}}}const ot=(t,n,i)=>{const o=new Float64Array(24);for(let e=0;e<8;e++)o[3*e]=t[e].x,o[3*e+1]=t[e].y,o[3*e+2]=t[e].z;const r=new Uint16Array([0,1,2,0,2,3,4,6,5,4,7,6,0,4,1,1,4,5,1,5,2,2,5,6,2,6,3,3,6,7,3,7,0,0,7,4]),s={position:new e.GeometryAttribute({componentDatatype:e.ComponentDatatype.DOUBLE,componentsPerAttribute:3,values:o})},a=new e.Geometry({indices:r,attributes:s,primitiveType:e.PrimitiveType.TRIANGLES,boundingSphere:e.BoundingSphere.fromVertices(o)});return new e.GeometryInstance({geometry:a,attributes:{color:e.ColorGeometryInstanceAttribute.fromColor(n)},id:`${i}`})},rt=(t,n,i)=>{const[o,r,s,a,c,l,d,p]=t,h=[o,r,r,s,s,a,a,o,c,l,l,d,d,p,p,c,o,c,c,l,l,r,r,o,a,p,p,d,d,s,s,a,o,a,a,p,p,c,c,o,r,l,l,d,d,s,s,r];return new e.GeometryInstance({geometry:new e.PolylineGeometry({positions:h,width:2,vertexFormat:e.PolylineColorAppearance.VERTEX_FORMAT}),attributes:{color:e.ColorGeometryInstanceAttribute.fromColor(n)},id:`${i}`})},st=(t,n)=>[e.Cartesian3.fromDegrees(t.longitude,t.latitude,n.height),e.Cartesian3.fromDegrees(t.longitude,n.latitude,n.height),e.Cartesian3.fromDegrees(n.longitude,n.latitude,n.height),e.Cartesian3.fromDegrees(n.longitude,t.latitude,n.height),e.Cartesian3.fromDegrees(t.longitude,t.latitude,t.height),e.Cartesian3.fromDegrees(t.longitude,n.latitude,t.height),e.Cartesian3.fromDegrees(n.longitude,n.latitude,t.height),e.Cartesian3.fromDegrees(n.longitude,t.latitude,t.height)],at=(t,n,i,o,r,s)=>[e.Cartesian3.fromDegrees(t,t,r),e.Cartesian3.fromDegrees(n,n,r),e.Cartesian3.fromDegrees(i,i,r),e.Cartesian3.fromDegrees(o,o,r),e.Cartesian3.fromDegrees(t,t,s),e.Cartesian3.fromDegrees(n,n,s),e.Cartesian3.fromDegrees(i,i,s),e.Cartesian3.fromDegrees(o,o,s)];let ct;const lt=t=>new Promise(n=>{document.body.style.cursor="pointer",t._element.style.cursor="pointer",ct||(ct=new e.ScreenSpaceEventHandler(t.scene.canvas)),ct.setInputAction(async o=>{const r=t.scene.pickPosition(o.position);await t.scene.clampToHeightMostDetailed([r]);const s=i(r);t._element.style.cursor="default",ct.removeInputAction(e.ScreenSpaceEventType.LEFT_CLICK),n({position:r,lnglat:s})},e.ScreenSpaceEventType.LEFT_CLICK)}),dt=(e,t)=>{const n={},i=t.getFeature(e);return i?pt(i):n},pt=e=>{const t={};return e.getPropertyIds().forEach(n=>{t[n]=e.getProperty(n)}),t},ht=(e,t=[-180,180],n=[-90,90])=>{const i=[];for(let o=0;o<e;o++){const e=ut(t),o=ut(n);i.push({type:"Feature",geometry:{type:"Point",coordinates:[e,o]},properties:{}})}return{type:"FeatureCollection",features:i}};function ut(e){const[t,n]=e;return Math.random()*(n-t)+t}function mt(){return`rgba(${Math.round(255*Math.random())},${Math.round(255*Math.random())},${Math.round(255*Math.random())},${Math.random()})`}const gt=(e,t=[-180,180],n=[-90,90])=>{const i=[];for(let o=0;o<e;o++){const e=Math.floor(ut([3,10])),o=[];for(let i=0;i<e;i++){const e=ut(t),i=ut(n);o.push([e,i])}i.push({type:"Feature",geometry:{type:"LineString",coordinates:o},properties:{}})}return{type:"FeatureCollection",features:i}},yt=(e,t=[-180,180],n=[-90,90])=>{const i=[];for(let o=0;o<e;o++){const e=ft(t,n);i.push({type:"Feature",geometry:{type:"Polygon",coordinates:[e]}})}return{type:"FeatureCollection",features:i}};function ft(e,t){const n=Math.floor(ut([3,10])),i=ut(e),o=ut(t),r=ut([1,5]),s=[];for(let e=0;e<n;e++){const t=e/n*2*Math.PI,a=ut([.8*r,r]),c=i+a*Math.cos(t),l=o+a*Math.sin(t);s.push([c,l])}return s.push(s[0]),s}export{Q as BaseMaterialProperty,J as BasePrimitive,o as Common,it as CoordinateTransformer,p as DefaultViewerOptions,Se as FlyAttitude,q as Popup,Ie as RoamStatus,Te as SkyBoxOnGround,K as Tooltip,Ne as calcArea,je as calcBoundingSphereFromPositions,ze as calcCameraHeightFromZoom,Ae as calcGeodesicDistance,Fe as calcGeodesicDistances,Ue as calcLerpPosition,Oe as calcPoistionCenter,$e as calcSceneHeightFromPositions,Re as calcSpaceDistance,Le as calcSpaceDistances,Ve as calcTerrainHeightFromPositions,Be as calcTriangleArea,He as calcZoomFromCameraHeight,Ge as clacPositionsForParabola,j as createBottomStatusBar,W as createEagleEye,ke as createOpenAnim,De as createRoamHandler,Z as createRollerShutterHandler,Pe as createSkyBox,xe as createSkyBoxOnGround,Y as createSplitScreenHandler,ne as delayTime,O as flyByRotateOut,F as flyByRotatePoint,x as flyToCameraView,I as flyToCesium3DTile,D as flyToDataSource,k as flyToFromSphere,S as flyToImagery,E as flyToLnglat,L as flyToNorth,T as flyToPosition,R as flyToRectangleBounds,P as getCameraView,d as getCesiumForAutoFitScale,dt as getFeaturesFromTileContent,pt as getFeaturesFromTileFeature,te as getInoCesiumBaseUrl,A as getScreenCenterPoint,s as initCesium,V as initCesiumEvent,st as makeGridFromElevationExtrema,ot as makeGridToInstanceForBox,rt as makeGridToInstanceForLine,f as makeLnglatToPosition,M as makeLnglatsToLineGeojson,v as makeLnglatsToPointGeojson,w as makeLnglatsToPolygonGeojson,y as makeLnglatsToPositions,C as makePositionsClose,u as makePositionsForAntiClockwise,h as makePositionsForClockwise,m as makePositionsToLnglats,g as makePositiontoLnglat,b as makeYawPitchRollToHeadingPitchRoll,at as mekeGridPolygonAndHeight,ee as numberId,lt as pickPoint,mt as randomColor,ht as randomPointToGeoJson,yt as randomPolygonToGeoJson,gt as randomPolylineToGeoJson,B as setCameraAutoBackTiltToZero,l as setCesiumForAutoFitScale,a as setGlobeEnabled,c as setGlobeOpatity,_ as setViewToLnglat,N as twinkleModel};
|