@ino-cesium/common 0.0.18 → 0.0.19
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 +716 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,716 @@
|
|
|
1
|
+
import * as Cesium from 'cesium';
|
|
2
|
+
import { FeatureCollection, Point, GeoJsonProperties, LineString, Polygon } from 'geojson';
|
|
3
|
+
|
|
4
|
+
interface ISetViewByLngLatOptions {
|
|
5
|
+
lng: number;
|
|
6
|
+
lat: number;
|
|
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
|
+
}
|
|
29
|
+
type DeepPartial<T> = {
|
|
30
|
+
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
31
|
+
};
|
|
32
|
+
|
|
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
|
+
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
|
+
declare namespace types {
|
|
65
|
+
export type { types_DeepPartial as DeepPartial, types_ICamearView as ICamearView, types_ICesiumEventListener as ICesiumEventListener, types_ISetViewByLngLatOptions as ISetViewByLngLatOptions, types_ISetViewByPositionOptions as ISetViewByPositionOptions, types_ISkyBoxOnGroundOptions as ISkyBoxOnGroundOptions, types_ISkyBoxOptions as ISkyBoxOptions, types_ISkyBoxSources as ISkyBoxSources, types_IYawPitchRoll as IYawPitchRoll };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 初始化Cesium
|
|
70
|
+
* @param eleId DOM元素ID
|
|
71
|
+
* @param options Viewer.ConstructorOptions
|
|
72
|
+
*/
|
|
73
|
+
declare const initCesium: (eleId: string, options?: Cesium.Viewer.ConstructorOptions & {
|
|
74
|
+
token?: string;
|
|
75
|
+
}) => Cesium.Viewer;
|
|
76
|
+
/**
|
|
77
|
+
* 设置地球是否可见
|
|
78
|
+
* 地球不可见无法对地形进行pick操作,
|
|
79
|
+
* @param viewer
|
|
80
|
+
* @param enabled
|
|
81
|
+
*/
|
|
82
|
+
declare const setGlobeEnabled: (viewer: Cesium.Viewer, enabled: boolean) => void;
|
|
83
|
+
/**
|
|
84
|
+
* 修改地球透明度
|
|
85
|
+
* @param value 0-1
|
|
86
|
+
* @param viewer
|
|
87
|
+
*/
|
|
88
|
+
declare const setGlobeOpatity: (value: number, viewer: Cesium.Viewer) => void;
|
|
89
|
+
declare const setCesiumForAutoFitScale: (value: number) => void;
|
|
90
|
+
declare const getCesiumForAutoFitScale: () => number;
|
|
91
|
+
declare const DefaultViewerOptions: Cesium.Viewer.ConstructorOptions;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* 设置中心点
|
|
95
|
+
* @param options.lng 精度
|
|
96
|
+
* @param options.lat 纬度
|
|
97
|
+
* @param options.height 高度
|
|
98
|
+
* @param options.viewer Cesium Viewer 实例
|
|
99
|
+
*/
|
|
100
|
+
declare const setViewToLnglat: (options: ISetViewByLngLatOptions) => void;
|
|
101
|
+
/**
|
|
102
|
+
* 飞行至中心点
|
|
103
|
+
* @param options.lng 精度
|
|
104
|
+
* @param options.lat 纬度
|
|
105
|
+
* @param options.height 高度
|
|
106
|
+
* @param options.viewer Cesium Viewer 实例
|
|
107
|
+
*/
|
|
108
|
+
declare const flyToLnglat: (options: ISetViewByLngLatOptions) => void;
|
|
109
|
+
/**
|
|
110
|
+
* 飞行至中心点
|
|
111
|
+
* @param options.lng 精度
|
|
112
|
+
* @param options.lat 纬度
|
|
113
|
+
* @param options.height 高度
|
|
114
|
+
* @param options.viewer Cesium Viewer 实例
|
|
115
|
+
*/
|
|
116
|
+
declare const flyToPosition: (options: ISetViewByPositionOptions) => void;
|
|
117
|
+
/**
|
|
118
|
+
* 获取相机视图
|
|
119
|
+
* @param viewer
|
|
120
|
+
* @returns camearView
|
|
121
|
+
*
|
|
122
|
+
* camearView: {
|
|
123
|
+
* destination: Cartesian3,
|
|
124
|
+
* orientation: {
|
|
125
|
+
* heading: number
|
|
126
|
+
* pitch: number
|
|
127
|
+
* roll: number
|
|
128
|
+
* }
|
|
129
|
+
* }
|
|
130
|
+
*/
|
|
131
|
+
declare function getCameraView(viewer: Cesium.Viewer): ICamearView;
|
|
132
|
+
/**
|
|
133
|
+
*
|
|
134
|
+
* @param camearView
|
|
135
|
+
* camearView: {
|
|
136
|
+
* destination: Cartesian3
|
|
137
|
+
* orientation: {
|
|
138
|
+
* heading: number
|
|
139
|
+
* pitch: number
|
|
140
|
+
* roll: number
|
|
141
|
+
* }
|
|
142
|
+
* }
|
|
143
|
+
* @param viewer
|
|
144
|
+
*/
|
|
145
|
+
declare function flyToCameraView(camearView: ICamearView, viewer: Cesium.Viewer): void;
|
|
146
|
+
/**
|
|
147
|
+
* 飞行至数据源
|
|
148
|
+
* @param dataScourceId 数据源id
|
|
149
|
+
* @param viewer Cesium Viewer 实例
|
|
150
|
+
*/
|
|
151
|
+
declare function flyToDataSource(dataScourceId: string, viewer: Cesium.Viewer): void;
|
|
152
|
+
/**
|
|
153
|
+
* 飞行至影像图层
|
|
154
|
+
* @param imagery 影像图层
|
|
155
|
+
* @param viewer Cesium Viewer 实例
|
|
156
|
+
*/
|
|
157
|
+
declare function flyToImagery(imagery: Cesium.ImageryLayer, viewer: Cesium.Viewer): void;
|
|
158
|
+
/**
|
|
159
|
+
* 飞行至3dtile
|
|
160
|
+
* @param {}tileset 3dtile
|
|
161
|
+
* @param viewer Cesium Viewer 实例
|
|
162
|
+
*/
|
|
163
|
+
declare function flyToCesium3DTile(tileset: Cesium.Cesium3DTileset, viewer: Cesium.Viewer): void;
|
|
164
|
+
/**
|
|
165
|
+
* 飞行至球体
|
|
166
|
+
* @param sphere 球体
|
|
167
|
+
* @param viewer
|
|
168
|
+
*/
|
|
169
|
+
declare function flyToFromSphere(sphere: number[], viewer: Cesium.Viewer): void;
|
|
170
|
+
/**
|
|
171
|
+
* 控制Cesium地图视图飞向指定的地理区域
|
|
172
|
+
* @param {number} west - 西边界经度(度)
|
|
173
|
+
* @param {number} south - 南边界纬度(度)
|
|
174
|
+
* @param {number} east - 东边界经度(度)
|
|
175
|
+
* @param {number} north - 北边界纬度(度)
|
|
176
|
+
* @param {Cesium.Viewer} viewer - Cesium地图查看器实例
|
|
177
|
+
*/
|
|
178
|
+
declare const flyToRectangleBounds: (west: number, south: number, east: number, north: number, viewer: Cesium.Viewer) => void;
|
|
179
|
+
declare const flyToNorth: (viewer: Cesium.Viewer) => void;
|
|
180
|
+
declare function getScreenCenterPoint(viewer: Cesium.Viewer): Cesium.Cartesian3;
|
|
181
|
+
/**
|
|
182
|
+
* 绕点飞行
|
|
183
|
+
*/
|
|
184
|
+
declare const flyByRotatePoint: (viewer: Cesium.Viewer) => {
|
|
185
|
+
/**
|
|
186
|
+
* 不传入positions,为当前屏幕中心点
|
|
187
|
+
* direction: true: 顺时针旋转,false: 逆时针旋转
|
|
188
|
+
*/
|
|
189
|
+
start: (position?: Cesium.Cartesian3, direction?: boolean) => void;
|
|
190
|
+
end: () => void;
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* 相机原地旋转
|
|
194
|
+
*/
|
|
195
|
+
declare const flyByRotateOut: (viewer: Cesium.Viewer) => {
|
|
196
|
+
start: (direction?: boolean) => void;
|
|
197
|
+
end: () => void;
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* 闪烁模型
|
|
201
|
+
* @param model
|
|
202
|
+
*/
|
|
203
|
+
declare function twinkleModel(model: any): void;
|
|
204
|
+
declare const setCameraAutoBackTiltToZero: (viewer: Cesium.Viewer, distance?: number) => void;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* 初始化cesium事件
|
|
208
|
+
* @param viewer
|
|
209
|
+
* @param eventListener
|
|
210
|
+
*/
|
|
211
|
+
declare const initCesiumEvent: (viewer: Cesium.Viewer, eventListener: ICesiumEventListener) => void;
|
|
212
|
+
|
|
213
|
+
declare const numberId: () => string;
|
|
214
|
+
declare const getInoCesiumBaseUrl: () => any;
|
|
215
|
+
|
|
216
|
+
declare class Tooltip {
|
|
217
|
+
static tooltip: Tooltip | null;
|
|
218
|
+
private _title;
|
|
219
|
+
private _div;
|
|
220
|
+
private _message;
|
|
221
|
+
constructor(viewer: Cesium.Viewer);
|
|
222
|
+
showAt(position: Cesium.Cartesian2, message: string): void;
|
|
223
|
+
setVisible(visible: boolean): void;
|
|
224
|
+
static createToolTip(viewer: Cesium.Viewer): Tooltip;
|
|
225
|
+
destroy(): void;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
declare class Popup {
|
|
229
|
+
static popup: Popup | null;
|
|
230
|
+
private _div;
|
|
231
|
+
private viewer;
|
|
232
|
+
private offset;
|
|
233
|
+
private position;
|
|
234
|
+
constructor(viewer: Cesium.Viewer, element: HTMLElement, offset?: Cesium.Cartesian2);
|
|
235
|
+
showAt(position: Cesium.Cartesian3): void;
|
|
236
|
+
setVisible(visible: boolean): void;
|
|
237
|
+
renderPosition(): void;
|
|
238
|
+
static createPupup(viewer: Cesium.Viewer, element: HTMLElement, offset?: Cesium.Cartesian2): Popup;
|
|
239
|
+
destroy(): void;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* 生成随机点输入geojosn 格式
|
|
244
|
+
* @param count 点数量
|
|
245
|
+
* @param lngRange 精度范围
|
|
246
|
+
* @param latRange 纬度范围
|
|
247
|
+
* @returns
|
|
248
|
+
*/
|
|
249
|
+
declare const randomPointToGeoJson: (count: number, lngRange?: number[], latRange?: number[]) => FeatureCollection<Point, GeoJsonProperties>;
|
|
250
|
+
declare function randomColor(): string;
|
|
251
|
+
declare const randomPolylineToGeoJson: (count: number, lngRange?: number[], latRange?: number[]) => FeatureCollection<LineString, GeoJsonProperties>;
|
|
252
|
+
declare const randomPolygonToGeoJson: (count: number, lngRange?: number[], latRange?: number[]) => FeatureCollection<Polygon, GeoJsonProperties>;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* 创建鹰眼图
|
|
256
|
+
* @param eleId
|
|
257
|
+
* @param mainViewer
|
|
258
|
+
*/
|
|
259
|
+
declare const createEagleEye: (eleId: string, mainViewer: Cesium.Viewer) => {
|
|
260
|
+
viewer: Cesium.Viewer;
|
|
261
|
+
open: () => void;
|
|
262
|
+
close: () => void;
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* 计算空间距离
|
|
267
|
+
* @param {Cartesian3} start - 起始点
|
|
268
|
+
* @param {Cartesian3} end - 结束点
|
|
269
|
+
* @returns {number} - 两点之间的空间距离
|
|
270
|
+
*/
|
|
271
|
+
declare const calcSpaceDistance: (start: Cesium.Cartesian3, end: Cesium.Cartesian3) => number;
|
|
272
|
+
/**
|
|
273
|
+
* 计算空间距离-多点
|
|
274
|
+
* @param {Cartesian3[]} positions - 点集
|
|
275
|
+
*/
|
|
276
|
+
declare function calcSpaceDistances(positions: Cesium.Cartesian3[]): number;
|
|
277
|
+
/**
|
|
278
|
+
* 计算贴地距离-两点
|
|
279
|
+
* @param {Cartesian3} start - 起始点
|
|
280
|
+
* @param {Cartesian3} end - 结束点
|
|
281
|
+
* @param {ellipsoid} Cesium.Ellipsoid
|
|
282
|
+
*/
|
|
283
|
+
declare function calcGeodesicDistance(start: Cesium.Cartesian3, end: Cesium.Cartesian3, ellipsoid?: Cesium.Ellipsoid): number;
|
|
284
|
+
/**
|
|
285
|
+
* 计算贴地距离-多点
|
|
286
|
+
* @param {Cartesian3[]} positions - 点集
|
|
287
|
+
* @returns {number} - 总距离
|
|
288
|
+
*/
|
|
289
|
+
declare function calcGeodesicDistances(positions: Cesium.Cartesian3[]): number;
|
|
290
|
+
/**
|
|
291
|
+
* 计算质心
|
|
292
|
+
* turf Centroid
|
|
293
|
+
* @param {Cartesian3[]} positions - 点集
|
|
294
|
+
* @returns {Cartesian3} - 质心点
|
|
295
|
+
*/
|
|
296
|
+
declare const calcPoistionCenter: (positions: Cesium.Cartesian3[]) => Cesium.Cartesian3;
|
|
297
|
+
/**
|
|
298
|
+
* 计算面积
|
|
299
|
+
* @param {Cartesian3[]} positions - 点集
|
|
300
|
+
* @returns {number} - 面积 单位:平方米
|
|
301
|
+
*/
|
|
302
|
+
declare function calcArea(positions: Array<Cesium.Cartesian3>): number;
|
|
303
|
+
/**
|
|
304
|
+
* 计算三角形面积
|
|
305
|
+
* @param {Cartesian3} vertexA - 三角形顶点A
|
|
306
|
+
* @param {Cartesian3} vertexB - 三角形顶点B
|
|
307
|
+
* @param {Cartesian3} vertexC - 三角形顶点C
|
|
308
|
+
* @returns {number} - 三角形面积
|
|
309
|
+
*/
|
|
310
|
+
declare const calcTriangleArea: (vertexA: Cesium.Cartesian3, vertexB: Cesium.Cartesian3, vertexC: Cesium.Cartesian3) => number;
|
|
311
|
+
/**
|
|
312
|
+
* 计算地形高度
|
|
313
|
+
* @param {TerrainProvider} terrainProvider - 地形提供者
|
|
314
|
+
* @param {Cartesian3[]} positions - 点集
|
|
315
|
+
* @returns {Cartesian3[]} - 地形高度点集
|
|
316
|
+
*/
|
|
317
|
+
declare const calcTerrainHeightFromPositions: (terrainProvider: Cesium.TerrainProvider, positions: Cesium.Cartesian3[]) => Promise<Cesium.Cartographic[]>;
|
|
318
|
+
/**
|
|
319
|
+
* 计算场景高度
|
|
320
|
+
* @param {TerrainProvider} viewer
|
|
321
|
+
* @param {Cartesian3[]} positions - 点集
|
|
322
|
+
* @returns {Cartesian3[]} - 地形高度点集
|
|
323
|
+
*/
|
|
324
|
+
declare const calcSceneHeightFromPositions: (viewer: Cesium.Viewer, positions: Cesium.Cartesian3[]) => Promise<Cesium.Cartesian3[]>;
|
|
325
|
+
/**
|
|
326
|
+
* 计算抛物线点集,
|
|
327
|
+
* @param {Cartesian3} startPoint - 开始节点
|
|
328
|
+
* @param {Cartesian3} endPoint - 结束节点
|
|
329
|
+
* @param {number} angularityFactor - 曲率
|
|
330
|
+
* @param {number} numOfSingleLine - 点集数量
|
|
331
|
+
* @returns {Cartesian3[]} - 点集
|
|
332
|
+
*/
|
|
333
|
+
declare const clacPositionsForParabola: (startPoint: Cesium.Cartesian3, endPoint: Cesium.Cartesian3, angularityFactor: number, numOfSingleLine: number) => Cesium.Cartesian3[];
|
|
334
|
+
/**
|
|
335
|
+
* 计算缩放级别,
|
|
336
|
+
* 把当前相机高度转为缩放级别
|
|
337
|
+
* @param {Camera} camera - 相机
|
|
338
|
+
*/
|
|
339
|
+
declare const calcZoomFromCameraHeight: (camera: Cesium.Camera) => number;
|
|
340
|
+
/**
|
|
341
|
+
* 计算相机高度
|
|
342
|
+
* 把缩放级别转为相机高度
|
|
343
|
+
* @无效
|
|
344
|
+
*/
|
|
345
|
+
declare const calcCameraHeightFromZoom: (zoom: number) => number;
|
|
346
|
+
/**
|
|
347
|
+
* 计算插值点集
|
|
348
|
+
* @param positions Cartesian3[]
|
|
349
|
+
* @param number 插值点数量
|
|
350
|
+
* @returns Cartesian3[]
|
|
351
|
+
*/
|
|
352
|
+
declare const calcLerpPosition: (positions: Cesium.Cartesian3[], number: number) => Cesium.Cartesian3[];
|
|
353
|
+
/**
|
|
354
|
+
* 根据一组笛卡尔坐标计算包围球
|
|
355
|
+
* @param positions 笛卡尔坐标组
|
|
356
|
+
*/
|
|
357
|
+
declare const calcBoundingSphereFromPositions: (positions: Cesium.Cartesian3[]) => Cesium.BoundingSphere;
|
|
358
|
+
|
|
359
|
+
declare abstract class BasePrimitive<T> {
|
|
360
|
+
protected _primitive: CusPrimitive;
|
|
361
|
+
protected _promise: Promise<T>;
|
|
362
|
+
protected appearance: Cesium.Appearance | undefined;
|
|
363
|
+
protected geometryInstance: Cesium.Appearance | undefined;
|
|
364
|
+
protected drawCommand: any;
|
|
365
|
+
/**
|
|
366
|
+
* 组成primitive的position
|
|
367
|
+
* @protected
|
|
368
|
+
*/
|
|
369
|
+
protected shapePositions: Cesium.Cartesian3[];
|
|
370
|
+
needUpdate: boolean;
|
|
371
|
+
constructor();
|
|
372
|
+
update(frameState: any): void;
|
|
373
|
+
then(onFulfilled?: any): Promise<T>;
|
|
374
|
+
catch(onRejected?: any): Promise<T>;
|
|
375
|
+
abstract getPrimitive(): CusPrimitive;
|
|
376
|
+
isDestroyed(): boolean;
|
|
377
|
+
destroy(): void;
|
|
378
|
+
setShapePositions(positions: Cesium.Cartesian3[]): void;
|
|
379
|
+
}
|
|
380
|
+
type CusPrimitive = Cesium.Primitive | Cesium.GroundPrimitive | Cesium.PointPrimitiveCollection | Cesium.GroundPolylinePrimitive | Cesium.LabelCollection | Cesium.PrimitiveCollection | undefined;
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* 线材质基类
|
|
384
|
+
*/
|
|
385
|
+
declare abstract class BaseMaterialProperty {
|
|
386
|
+
protected _definitionChanged: Cesium.Event<(...args: any[]) => void>;
|
|
387
|
+
get definitionChanged(): Cesium.Event<(...args: any[]) => void>;
|
|
388
|
+
get isConstant(): boolean;
|
|
389
|
+
abstract getType(): string;
|
|
390
|
+
abstract getValue(time: Cesium.JulianDate, result: any): any;
|
|
391
|
+
abstract equals(other: any): boolean;
|
|
392
|
+
abstract init(): void;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* 把点集合转为顺时针
|
|
397
|
+
*/
|
|
398
|
+
declare const makePositionsForClockwise: (positions: Cesium.Cartesian3[]) => Cesium.Cartesian3[];
|
|
399
|
+
/**
|
|
400
|
+
* 把点集合转为逆时针
|
|
401
|
+
*/
|
|
402
|
+
declare const makePositionsForAntiClockwise: (positions: Cesium.Cartesian3[]) => Cesium.Cartesian3[];
|
|
403
|
+
/**
|
|
404
|
+
* 把笛卡尔坐标数组转为经纬度数组
|
|
405
|
+
*/
|
|
406
|
+
declare const makePositionsToLnglats: (positions: Cesium.Cartesian3[]) => Cesium.Cartographic[];
|
|
407
|
+
/**
|
|
408
|
+
* 把笛卡尔坐标转为经纬度
|
|
409
|
+
*/
|
|
410
|
+
declare const makePositiontoLnglat: (position: Cesium.Cartesian3) => Cesium.Cartographic;
|
|
411
|
+
/**
|
|
412
|
+
* 把经纬度数组转为笛卡尔坐标数组
|
|
413
|
+
*/
|
|
414
|
+
declare const makeLnglatsToPositions: (lnglats: Cesium.Cartographic[]) => Cesium.Cartesian3[];
|
|
415
|
+
/**
|
|
416
|
+
* 把经纬度转为笛卡尔坐标
|
|
417
|
+
*/
|
|
418
|
+
declare const makeLnglatToPosition: (lnglat: Cesium.Cartographic) => Cesium.Cartesian3;
|
|
419
|
+
/**
|
|
420
|
+
* 点集闭合成面 首位相接
|
|
421
|
+
*/
|
|
422
|
+
declare const makePositionsClose: (positions: Cesium.Cartesian3[]) => Cesium.Cartesian3[];
|
|
423
|
+
/**
|
|
424
|
+
* 把经纬度数组转为点数据的geojson集合
|
|
425
|
+
* @param lnglats
|
|
426
|
+
* @returns GeoJSON.FeatureCollection
|
|
427
|
+
*/
|
|
428
|
+
declare const makeLnglatsToPointGeojson: (lnglats: Cesium.Cartographic[]) => GeoJSON.FeatureCollection;
|
|
429
|
+
/**
|
|
430
|
+
* 把经纬度数组转为线数据的geojson集合
|
|
431
|
+
* @param lnglats
|
|
432
|
+
* @returns GeoJSON.FeatureCollection
|
|
433
|
+
*/
|
|
434
|
+
declare const makeLnglatsToLineGeojson: (lnglats: Cesium.Cartographic[]) => GeoJSON.FeatureCollection;
|
|
435
|
+
/**
|
|
436
|
+
* 把经纬度数组转为面数据的geojson集合
|
|
437
|
+
* @param lnglats
|
|
438
|
+
* @returns GeoJSON.FeatureCollection
|
|
439
|
+
*/
|
|
440
|
+
declare const makeLnglatsToPolygonGeojson: (lnglats: Cesium.Cartographic[]) => GeoJSON.FeatureCollection;
|
|
441
|
+
/**
|
|
442
|
+
* 把yawPitchRoll转为headingPitchRoll
|
|
443
|
+
* 航空中的参数和cesium中的参数有区别 角度转弧度
|
|
444
|
+
* @param yawPitchRoll
|
|
445
|
+
*/
|
|
446
|
+
declare const makeYawPitchRollToHeadingPitchRoll: (yawPitchRoll: IYawPitchRoll) => {
|
|
447
|
+
heading: number;
|
|
448
|
+
pitch: number;
|
|
449
|
+
roll: number;
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* 创建天空盒
|
|
454
|
+
* @param options
|
|
455
|
+
*/
|
|
456
|
+
declare const createSkyBox: (options: ISkyBoxOptions) => Cesium.SkyBox;
|
|
457
|
+
/**
|
|
458
|
+
* 创建近地天空盒
|
|
459
|
+
* @param options
|
|
460
|
+
*/
|
|
461
|
+
declare const createSkyBoxOnGround: (options: ISkyBoxOnGroundOptions) => void;
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* 漫游控制器
|
|
465
|
+
* @param viewer Cesium Viewer
|
|
466
|
+
*
|
|
467
|
+
*/
|
|
468
|
+
declare const createRoamHandler: (viewer: Cesium.Viewer) => IRoamHandler;
|
|
469
|
+
interface IRoamOptions {
|
|
470
|
+
/**
|
|
471
|
+
* 唯一id, 默认为随机生成
|
|
472
|
+
*/
|
|
473
|
+
id?: string;
|
|
474
|
+
/**
|
|
475
|
+
* 漫游路径
|
|
476
|
+
*/
|
|
477
|
+
positions: Cesium.Cartesian3[];
|
|
478
|
+
/**
|
|
479
|
+
* 飞行器参数
|
|
480
|
+
*/
|
|
481
|
+
flyParams: {
|
|
482
|
+
/**
|
|
483
|
+
* 漫游时间数组 以时间计算飞行速度 数组长度必须与漫游路径点数组长度相同
|
|
484
|
+
* 与spped二者取其一 时间优先
|
|
485
|
+
*/
|
|
486
|
+
times?: number[];
|
|
487
|
+
/**
|
|
488
|
+
* 漫游速度 公里/每小时
|
|
489
|
+
* 与times二者取其一
|
|
490
|
+
*/
|
|
491
|
+
speed?: number;
|
|
492
|
+
/**
|
|
493
|
+
* 飞行器的heading pitch roll
|
|
494
|
+
*/
|
|
495
|
+
hpr?: IRoamItemHPR[];
|
|
496
|
+
};
|
|
497
|
+
/**
|
|
498
|
+
* 漫游目标 可跟随物体和漫游路线设置
|
|
499
|
+
*/
|
|
500
|
+
entity: Cesium.Entity;
|
|
501
|
+
/**
|
|
502
|
+
* 是否循环
|
|
503
|
+
*/
|
|
504
|
+
loop: boolean;
|
|
505
|
+
/**
|
|
506
|
+
* 漫游目标属性信息
|
|
507
|
+
*/
|
|
508
|
+
attrs?: any;
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* 漫游控制器
|
|
512
|
+
*/
|
|
513
|
+
interface IRoamHandler {
|
|
514
|
+
set: (options: IRoamOptions) => IRoamItem;
|
|
515
|
+
/**
|
|
516
|
+
* 漫游目标跟随
|
|
517
|
+
* @param roamItem
|
|
518
|
+
* @param isLock 是否锁定视角
|
|
519
|
+
*/
|
|
520
|
+
tracked: (roamItem: IRoamItem, isLock: boolean) => void;
|
|
521
|
+
/**
|
|
522
|
+
* 通过entityId 设置漫游目标跟随
|
|
523
|
+
* @param id
|
|
524
|
+
* @param isLock 是否锁定视角
|
|
525
|
+
*/
|
|
526
|
+
trackedByEntityId: (id: string, isLock: boolean) => void;
|
|
527
|
+
/**
|
|
528
|
+
* 停止漫游目标跟随
|
|
529
|
+
*/
|
|
530
|
+
stopTracked: () => void;
|
|
531
|
+
remove: (roamItem: IRoamItem) => void;
|
|
532
|
+
frameRoam: (roamItem: IRoamItem, time: Cesium.JulianDate) => void;
|
|
533
|
+
removeAll: () => void;
|
|
534
|
+
Event: IRoamEvent;
|
|
535
|
+
lockCameraView: (roamItem: IRoamItem) => void;
|
|
536
|
+
/**
|
|
537
|
+
* 更新漫游目标姿态
|
|
538
|
+
* @param roamItem
|
|
539
|
+
* @param flyAttitude
|
|
540
|
+
*/
|
|
541
|
+
updateRoamAttitude: (roamItem: IRoamItem, flyAttitude: FlyAttitude) => void;
|
|
542
|
+
}
|
|
543
|
+
interface IRoamItem extends IRoamOptions {
|
|
544
|
+
/**
|
|
545
|
+
* 漫游路径
|
|
546
|
+
*/
|
|
547
|
+
property: Cesium.SampledPositionProperty;
|
|
548
|
+
/**
|
|
549
|
+
* 开始时间
|
|
550
|
+
*/
|
|
551
|
+
startTime: Cesium.JulianDate | undefined;
|
|
552
|
+
/**
|
|
553
|
+
* 结束时间
|
|
554
|
+
*/
|
|
555
|
+
stopTime: Cesium.JulianDate | undefined;
|
|
556
|
+
/**
|
|
557
|
+
* 漫游状态
|
|
558
|
+
*/
|
|
559
|
+
status: RoamStatus;
|
|
560
|
+
}
|
|
561
|
+
interface IRoaming {
|
|
562
|
+
time: Cesium.JulianDate;
|
|
563
|
+
position: Cesium.Cartesian3 | undefined;
|
|
564
|
+
}
|
|
565
|
+
interface IRoamEvent {
|
|
566
|
+
/**
|
|
567
|
+
* 漫游开始
|
|
568
|
+
* @param roamItem
|
|
569
|
+
*/
|
|
570
|
+
start?: (roamItem: IRoamItem) => void;
|
|
571
|
+
/**
|
|
572
|
+
* 漫游重新开始 调用reStart方法时或触发循环式触发
|
|
573
|
+
* @param roamItem
|
|
574
|
+
*/
|
|
575
|
+
reStart?: (roamItem: IRoamItem) => void;
|
|
576
|
+
/**
|
|
577
|
+
* 漫游中
|
|
578
|
+
* @param roamItem
|
|
579
|
+
* @param roaming
|
|
580
|
+
*/
|
|
581
|
+
roaming?: (roamItem: IRoamItem, roaming: IRoaming) => void;
|
|
582
|
+
/**
|
|
583
|
+
* 漫游结束
|
|
584
|
+
* @param roamItem
|
|
585
|
+
*/
|
|
586
|
+
end?: (roamItem: IRoamItem) => void;
|
|
587
|
+
}
|
|
588
|
+
declare enum FlyAttitude {
|
|
589
|
+
UP = "UP",
|
|
590
|
+
DOWN = "DOWN",
|
|
591
|
+
LEFT = "left",
|
|
592
|
+
RIGHT = "right",
|
|
593
|
+
FRONT = "front",
|
|
594
|
+
BACK = "back"
|
|
595
|
+
}
|
|
596
|
+
declare enum RoamStatus {
|
|
597
|
+
END = "END",
|
|
598
|
+
START = "START",
|
|
599
|
+
ROAMING = "ROAMING"
|
|
600
|
+
}
|
|
601
|
+
interface IRoamItemHPR {
|
|
602
|
+
time: number;
|
|
603
|
+
heading: number;
|
|
604
|
+
pitch: number;
|
|
605
|
+
roll: number;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
declare const createBottomStatusBar: (options: IBottomStatusBarOptions) => void;
|
|
609
|
+
interface IBottomStatusBarOptions {
|
|
610
|
+
viewer: Cesium.Viewer;
|
|
611
|
+
/**
|
|
612
|
+
* 显示方向角、俯仰角、侧翻角
|
|
613
|
+
*/
|
|
614
|
+
hpr?: boolean;
|
|
615
|
+
/**
|
|
616
|
+
* 开启点击复制
|
|
617
|
+
* 复制当前中心经纬度和高度,相机视角
|
|
618
|
+
*/
|
|
619
|
+
clickCopy?: boolean;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
declare const createOpenAnim: (options: IOpenAnimOptions) => Promise<unknown>;
|
|
623
|
+
interface IOpenAnimOptions {
|
|
624
|
+
viewer: Cesium.Viewer;
|
|
625
|
+
center: {
|
|
626
|
+
lat: number;
|
|
627
|
+
lng: number;
|
|
628
|
+
height: number;
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* 网格8个顶点生成盒子面
|
|
634
|
+
* @param cartesianVertices 8个顶点
|
|
635
|
+
* @param color 网格颜色
|
|
636
|
+
* @param gridId 网格id
|
|
637
|
+
*/
|
|
638
|
+
declare const makeGridToInstanceForBox: (cartesianVertices: any, color: Cesium.Color, gridId: string) => Cesium.GeometryInstance;
|
|
639
|
+
/**
|
|
640
|
+
* 网格8个顶点生成盒子边线
|
|
641
|
+
* @param cartesianVertices 8个顶点
|
|
642
|
+
* @param color 网格颜色
|
|
643
|
+
* @param gridId 网格id
|
|
644
|
+
*/
|
|
645
|
+
declare const makeGridToInstanceForLine: (cartesianVertices: any, color: Cesium.Color, gridId: string) => Cesium.GeometryInstance;
|
|
646
|
+
/**
|
|
647
|
+
* 使用顶点极值创建盒子的八个点
|
|
648
|
+
* @param maxPoint
|
|
649
|
+
* @param minPoint
|
|
650
|
+
*/
|
|
651
|
+
declare const makeGridFromElevationExtrema: (maxPoint: Cesium.Cartographic, minPoint: Cesium.Cartographic) => Cesium.Cartesian3[];
|
|
652
|
+
/**
|
|
653
|
+
* 使用底面和高度创建网格
|
|
654
|
+
* @param topLeft
|
|
655
|
+
* @param topRight
|
|
656
|
+
* @param bottomRight
|
|
657
|
+
* @param bottomLeft
|
|
658
|
+
* @param minHeight
|
|
659
|
+
* @param maxHeight
|
|
660
|
+
*/
|
|
661
|
+
declare const mekeGridPolygonAndHeight: (topLeft: number, topRight: number, bottomRight: number, bottomLeft: number, minHeight: number, maxHeight: number) => Cesium.Cartesian3[];
|
|
662
|
+
|
|
663
|
+
/**
|
|
664
|
+
* 坐标转换工具库 - 实现了WGS84、GCJ02(火星坐标)和BD09(百度坐标)之间的相互转换
|
|
665
|
+
*/
|
|
666
|
+
/**
|
|
667
|
+
* 坐标点接口定义
|
|
668
|
+
*/
|
|
669
|
+
interface CoordinatePoint {
|
|
670
|
+
lng: number;
|
|
671
|
+
lat: number;
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* 坐标转换工具类
|
|
675
|
+
*/
|
|
676
|
+
declare class CoordinateTransformer {
|
|
677
|
+
/**
|
|
678
|
+
* WGS84坐标转换为GCJ02坐标
|
|
679
|
+
* @param point WGS84坐标点
|
|
680
|
+
* @returns GCJ02坐标点
|
|
681
|
+
*/
|
|
682
|
+
static wgs84ToGcj02(point: CoordinatePoint): CoordinatePoint;
|
|
683
|
+
/**
|
|
684
|
+
* GCJ02坐标转换为WGS84坐标
|
|
685
|
+
* @param point GCJ02坐标点
|
|
686
|
+
* @returns WGS84坐标点
|
|
687
|
+
*/
|
|
688
|
+
static gcj02ToWgs84(point: CoordinatePoint): CoordinatePoint;
|
|
689
|
+
/**
|
|
690
|
+
* GCJ02坐标转换为BD09坐标
|
|
691
|
+
* @param point GCJ02坐标点
|
|
692
|
+
* @returns BD09坐标点
|
|
693
|
+
*/
|
|
694
|
+
static gcj02ToBd09(point: CoordinatePoint): CoordinatePoint;
|
|
695
|
+
/**
|
|
696
|
+
* BD09坐标转换为GCJ02坐标
|
|
697
|
+
* @param point BD09坐标点
|
|
698
|
+
* @returns GCJ02坐标点
|
|
699
|
+
*/
|
|
700
|
+
static bd09ToGcj02(point: CoordinatePoint): CoordinatePoint;
|
|
701
|
+
/**
|
|
702
|
+
* BD09坐标转换为WGS84坐标
|
|
703
|
+
* @param point BD09坐标点
|
|
704
|
+
* @returns WGS84坐标点
|
|
705
|
+
*/
|
|
706
|
+
static bd09ToWgs84(point: CoordinatePoint): CoordinatePoint;
|
|
707
|
+
/**
|
|
708
|
+
* WGS84坐标转换为BD09坐标
|
|
709
|
+
* @param point WGS84坐标点
|
|
710
|
+
* @returns BD09坐标点
|
|
711
|
+
*/
|
|
712
|
+
static wgs84ToBd09(point: CoordinatePoint): CoordinatePoint;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
export { BaseMaterialProperty, BasePrimitive, types as Common, CoordinateTransformer, DefaultViewerOptions, FlyAttitude, Popup, RoamStatus, Tooltip, calcArea, calcBoundingSphereFromPositions, calcCameraHeightFromZoom, calcGeodesicDistance, calcGeodesicDistances, calcLerpPosition, calcPoistionCenter, calcSceneHeightFromPositions, calcSpaceDistance, calcSpaceDistances, calcTerrainHeightFromPositions, calcTriangleArea, calcZoomFromCameraHeight, clacPositionsForParabola, createBottomStatusBar, createEagleEye, createOpenAnim, createRoamHandler, createSkyBox, createSkyBoxOnGround, flyByRotateOut, flyByRotatePoint, flyToCameraView, flyToCesium3DTile, flyToDataSource, flyToFromSphere, flyToImagery, flyToLnglat, flyToNorth, flyToPosition, flyToRectangleBounds, getCameraView, getCesiumForAutoFitScale, getInoCesiumBaseUrl, getScreenCenterPoint, initCesium, initCesiumEvent, makeGridFromElevationExtrema, makeGridToInstanceForBox, makeGridToInstanceForLine, makeLnglatToPosition, makeLnglatsToLineGeojson, makeLnglatsToPointGeojson, makeLnglatsToPolygonGeojson, makeLnglatsToPositions, makePositionsClose, makePositionsForAntiClockwise, makePositionsForClockwise, makePositionsToLnglats, makePositiontoLnglat, makeYawPitchRollToHeadingPitchRoll, mekeGridPolygonAndHeight, numberId, randomColor, randomPointToGeoJson, randomPolygonToGeoJson, randomPolylineToGeoJson, setCameraAutoBackTiltToZero, setCesiumForAutoFitScale, setGlobeEnabled, setGlobeOpatity, setViewToLnglat, twinkleModel };
|
|
716
|
+
export type { DeepPartial, ICamearView, ICesiumEventListener, IOpenAnimOptions, IRoamEvent, IRoamHandler, IRoamItem, IRoamItemHPR, IRoaming, ISetViewByLngLatOptions, ISetViewByPositionOptions, ISkyBoxOnGroundOptions, ISkyBoxOptions, ISkyBoxSources, IYawPitchRoll };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"cesium";import{polygon as t,centroid as n}from"@turf/turf";var i=Object.freeze({__proto__:null});let o=1;const r=(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={...d,...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},s=(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})`)}}}))},a=(e,t)=>{t.scene.globe.translucency.enabled=!0,t.scene.globe.translucency.frontFaceAlpha=e,t.scene.globe.translucency.backFaceAlpha=e},c=e=>{o=e},l=()=>o,d={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},p=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=e=>e.map(e=>m(e)),m=t=>{const n=e.Cartographic.fromCartesian(t);return{longitude:e.Math.toDegrees(n.longitude),latitude:e.Math.toDegrees(n.latitude),height:n.height}},g=t=>t.map(t=>e.Cartesian3.fromDegrees(t.longitude,t.latitude,t.height)),f=t=>e.Cartesian3.fromDegrees(t.longitude,t.latitude,t.height),y=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]]},C=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}},v=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)}),w=t=>{const{lng:n,lat:i,height:o,viewer:r}=t;r.scene.camera.setView({destination:e.Cartesian3.fromDegrees(n,i,o||1e4)})},_=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 E(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 P(e,t){e&&t.scene.camera.flyTo({...e})}function x(e,t){const n=t.dataSources.getByName(e);n.length>0&&t.flyTo(n[0])}function D(e,t){e&&t.flyTo(e)}function S(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 A=(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)},I=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 O=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}}},F=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 L(e){e.show=!1,setTimeout(()=>{e.show=!0,setTimeout(()=>{e.show=!1,setTimeout(()=>{e.show=!0},300)},300)},300)}const N=(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})},B=(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);$(e.position,o,n.LEFT_POSITION,t)}n.PICK_FEATURE&&V(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);$(e.endPosition,o,n.MOVE_POSITION,t)}n.MOVE_PICK_FEATURE&&V(t,e.endPosition,n.MOVE_PICK_FEATURE)},e.ScreenSpaceEventType.MOUSE_MOVE)},V=(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,{})},$=(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:E(o)})},G=()=>`${Date.now()}${Math.round(9999999999*Math.random()+1)}`,H=()=>window.INO_CESIUM_BASE_URL;class z{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 z.tooltip||(z.tooltip=new z(e)),z.tooltip}destroy(){z.tooltip&&(this._div&&this._div.parentNode.removeChild(this._div),z.tooltip=null)}}class U{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 U.popup||(U.popup=new U(e,t,n)),U.popup}destroy(){U.popup&&(this._div&&this._div.parentNode.removeChild(this._div),U.popup=null)}}const j=(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 W(){return`rgba(${Math.round(255*Math.random())},${Math.round(255*Math.random())},${Math.round(255*Math.random())},${Math.random()})`}const X=(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}},Z=(e,t=[-180,180],n=[-90,90])=>{const i=[];for(let o=0;o<e;o++){const e=Y(t,n);i.push({type:"Feature",geometry:{type:"Polygon",coordinates:[e]}})}return{type:"FeatureCollection",features:i}};function Y(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 K=(t,n)=>{let i=!1;const o=new e.Viewer(t,{...d,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}}},J=(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 Q(e){let t=0;return e.forEach((n,i)=>{if(i===e.length-1)return;const o=J(n,e[i+1]);t+=o}),t}function ee(t,n,i){const{EllipsoidGeodesic:o,Ellipsoid:r}=e;return new o((i=i||r.WGS84).cartesianToCartographic(t),i.cartesianToCartographic(n)).surfaceDistance}function te(e){let t=0;return e.forEach((n,i)=>{if(i===e.length-1)return;const o=ee(n,e[i+1]);t+=o}),t}const ne=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 ie(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+=oe(s.unpack(t,3*o,{}),s.unpack(t,3*r,{}),s.unpack(t,3*a,{}))}}return n}const oe=(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)},re=async(t,n)=>{const i=n.map(t=>e.Cartographic.fromCartesian(t));return await e.sampleTerrainMostDetailed(t,i)},se=async(e,t)=>await e.scene.clampToHeightMostDetailed(t),ae=(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,h=180*a.latitude/Math.PI,p=Math.sqrt((c-d)*(c-d)+(l-h)*(l-h))*i,u=e.Cartesian3.clone(t),m=e.Cartesian3.clone(n),g=e.Cartesian3.distance(u,e.Cartesian3.ZERO),f=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 y=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*y)/Math.sin(y),a=Math.sin(n*y)/Math.sin(y),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 h=n*Math.PI,C=g*i+f*n+Math.sin(h)*p;d=e.Cartesian3.multiplyByScalar(d,C,d),r.push(d)}return r.push(n),r},ce=e=>{const t=e.positionCartographic.height,n=-40467.74;return Math.round(n+80955.31/(1+(t/91610.74)**7096758e-11))},le=e=>e,de=(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},he=t=>{const n=new e.BoundingSphere(e.Cartesian3.ZERO,0);return e.BoundingSphere.fromPoints(t,n),n};class pe{_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 ue{_definitionChanged=new e.Event;get definitionChanged(){return this._definitionChanged}get isConstant(){return!1}}const me=e.BoxGeometry,ge=e.Cartesian3,fe=e.defaultValue,ye=e.defined,Ce=e.destroyObject,ve=e.DeveloperError,Me=e.GeometryPipeline,be=e.Matrix3,we=e.Matrix4,_e=e.Transforms,Te=e.VertexFormat,Ee=e.BufferUsage,Pe=e.CubeMap,xe=e.DrawCommand,De=e.loadCubeMap,Se=e.RenderState,ke=e.VertexArray,Ae=e.BlendingState,Ie=e.SceneMode,Re=e.ShaderProgram,Oe=e.ShaderSource,Fe=new be;class Le{constructor(t){e.defined(e.Matrix4.getRotation)||(e.Matrix4.getRotation=e.Matrix4.getMatrix3),this.sources=t.sources,this._sources=void 0,this.show=fe(t.show,!0),this._command=new xe({modelMatrix:we.clone(we.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!==Ie.SCENE3D&&e.mode!==Ie.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(!(ye(e.positiveX)&&ye(e.negativeX)&&ye(e.positiveY)&&ye(e.negativeY)&&ye(e.positiveZ)&&ye(e.negativeZ)))throw new ve("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 ve("this.sources properties must all be the same type.");"string"==typeof e.positiveX?De(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 Pe({context:i,source:e}))}const o=this._command;if(o.modelMatrix=_e.eastNorthUpToFixedFrame(e.camera._positionWC),!ye(o.vertexArray)){o.uniformMap={u_cubeMap:()=>n._cubeMap,u_rotateMatrix:()=>we.getRotation(o.modelMatrix,Fe)};const e=me.createGeometry(me.fromDimensions({dimensions:new ge(2,2,2),vertexFormat:Te.POSITION_ONLY})),t=this._attributeLocations=Me.createAttributeLocations(e);o.vertexArray=ke.fromGeometry({context:i,geometry:e,attributeLocations:t,bufferUsage:Ee._DRAW}),o.renderState=Se.fromCache({blending:Ae.ALPHA_BLEND})}if(!ye(o.shaderProgram)||this._useHdr!==t){const e=new Oe({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=Re.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 ye(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(),Ce(this)}}const Ne=t=>{const{viewer:n,sources:i}=t;return n.scene.skyBox=new e.SkyBox({sources:i}),n.scene.skyBox},Be=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:`${H()}/assets/ground-skybox/px.jpg`,negativeX:`${H()}/assets/ground-skybox/nx.jpg`,positiveY:`${H()}/assets/ground-skybox/py.jpg`,negativeY:`${H()}/assets/ground-skybox/ny.jpg`,positiveZ:`${H()}/assets/ground-skybox/pz.jpg`,negativeZ:`${H()}/assets/ground-skybox/nz.jpg`});const a=new Le({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)})},Ve=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?h(e):c()),e.flyParams.hpr){const i=r[e.id].find(e=>e.time>t.secondsOfDay);i&&u(e,i,n)}},h=n=>{const{property:i,startTime:o,stopTime:r}=p(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)},p=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=G(),t.entities.add(o);const{property:r,startTime:s,stopTime:a}=p(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 $e=(e=>(e.UP="UP",e.DOWN="DOWN",e.LEFT="left",e.RIGHT="right",e.FRONT="front",e.BACK="back",e))($e||{}),Ge=(e=>(e.END="END",e.START="START",e.ROAMING="ROAMING",e))(Ge||{});let He=100,ze="",Ue="0";const je=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),B(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&&E(n),s.appendChild(c),s.appendChild(a)}}),t.clickCopy&&document.addEventListener("click",e=>{e.target.id});let d=Date.now(),h=0;const p=()=>{requestAnimationFrame(()=>{if(h+=1,h>=30){const e=Date.now(),t=e-d,n=Math.round(1e3/(t/h));d=e,h=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=qe(n);r.innerHTML=`${i.distanceLabel}`,p()})};p()},qe=t=>{const n=t.camera.positionCartographic.height.toFixed(0);if(n===Ue)return{barWidth:He,distanceLabel:ze};Ue=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,h=d.pick(c,r),p=d.pick(l,r);if(!e.defined(h)||!e.defined(p))return{barWidth:He,distanceLabel:ze};const u=d.ellipsoid.cartesianToCartographic(h),m=d.ellipsoid.cartesianToCartographic(p);i.setEndPoints(u,m);const g=i.surfaceDistance;let f;for(let t=o.length-1;!e.defined(f)&&t>=0;--t)o[t]/g<100&&(f=o[t]);if(e.defined(f)){const e=f>=1e3?`${(f/1e3).toString()} km`:`${f.toString()} m`;He=f/g|0,ze=e}else He=0,ze="1 m";return{barWidth:He,distanceLabel:ze}},We=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)}),Xe=(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}`})},Ze=(t,n,i)=>{const[o,r,s,a,c,l,d,h]=t,p=[o,r,r,s,s,a,a,o,c,l,l,d,d,h,h,c,o,c,c,l,l,r,r,o,a,h,h,d,d,s,s,a,o,a,a,h,h,c,c,o,r,l,l,d,d,s,s,r];return new e.GeometryInstance({geometry:new e.PolylineGeometry({positions:p,width:2,vertexFormat:e.PolylineColorAppearance.VERTEX_FORMAT}),attributes:{color:e.ColorGeometryInstanceAttribute.fromColor(n)},id:`${i}`})},Ye=(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)],Ke=(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)],Je=3e3*Math.PI/180,Qe=Math.PI,et=6378245,tt=.006693421622965943,nt=(e,t)=>!(e>72.004&&e<137.8347&&t>.8293&&t<55.8271),it=(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*Qe)+20*Math.sin(2*e*Qe))/3,n+=2*(20*Math.sin(t*Qe)+40*Math.sin(t/3*Qe))/3,n+=2*(160*Math.sin(t/12*Qe)+320*Math.sin(t*Qe/30))/3,n},ot=(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*Qe)+20*Math.sin(2*e*Qe))/3,n+=2*(20*Math.sin(e*Qe)+40*Math.sin(e/3*Qe))/3,n+=2*(150*Math.sin(e/12*Qe)+300*Math.sin(e/30*Qe))/3,n},rt=(e,t)=>{if(nt(e,t))return[e,t];let n=it(e-105,t-35),i=ot(e-105,t-35);const o=t/180*Qe;let r=Math.sin(o);r=1-tt*r*r;const s=Math.sqrt(r);n=180*n/(et*(1-tt)/(r*s)*Qe),i=180*i/(et/s*Math.cos(o)*Qe);return[e+i,t+n]},st=(e,t)=>{if(nt(e,t))return[e,t];let n=it(e-105,t-35),i=ot(e-105,t-35);const o=t/180*Qe;let r=Math.sin(o);r=1-tt*r*r;const s=Math.sqrt(r);n=180*n/(et*(1-tt)/(r*s)*Qe),i=180*i/(et/s*Math.cos(o)*Qe);return[2*e-(e+i),2*t-(t+n)]},at=(e,t)=>{const n=e,i=t,o=Math.sqrt(n*n+i*i)+2e-5*Math.sin(i*Je),r=Math.atan2(i,n)+3e-6*Math.cos(n*Je);return[o*Math.cos(r)+.0065,o*Math.sin(r)+.006]},ct=(e,t)=>{const n=e-.0065,i=t-.006,o=Math.sqrt(n*n+i*i)-2e-5*Math.sin(i*Je),r=Math.atan2(i,n)-3e-6*Math.cos(n*Je);return[o*Math.cos(r),o*Math.sin(r)]};class lt{static wgs84ToGcj02(e){const[t,n]=rt(e.lng,e.lat);return{lng:t,lat:n}}static gcj02ToWgs84(e){const[t,n]=st(e.lng,e.lat);return{lng:t,lat:n}}static gcj02ToBd09(e){const[t,n]=at(e.lng,e.lat);return{lng:t,lat:n}}static bd09ToGcj02(e){const[t,n]=ct(e.lng,e.lat);return{lng:t,lat:n}}static bd09ToWgs84(e){const[t,n]=((e,t)=>{const[n,i]=ct(e,t);return st(n,i)})(e.lng,e.lat);return{lng:t,lat:n}}static wgs84ToBd09(e){const[t,n]=((e,t)=>{const[n,i]=rt(e,t);return at(n,i)})(e.lng,e.lat);return{lng:t,lat:n}}}export{ue as BaseMaterialProperty,pe as BasePrimitive,i as Common,lt as CoordinateTransformer,d as DefaultViewerOptions,$e as FlyAttitude,U as Popup,Ge as RoamStatus,z as Tooltip,ie as calcArea,he as calcBoundingSphereFromPositions,le as calcCameraHeightFromZoom,ee as calcGeodesicDistance,te as calcGeodesicDistances,de as calcLerpPosition,ne as calcPoistionCenter,se as calcSceneHeightFromPositions,J as calcSpaceDistance,Q as calcSpaceDistances,re as calcTerrainHeightFromPositions,oe as calcTriangleArea,ce as calcZoomFromCameraHeight,ae as clacPositionsForParabola,je as createBottomStatusBar,K as createEagleEye,We as createOpenAnim,Ve as createRoamHandler,Ne as createSkyBox,Be as createSkyBoxOnGround,F as flyByRotateOut,O as flyByRotatePoint,P as flyToCameraView,S as flyToCesium3DTile,x as flyToDataSource,k as flyToFromSphere,D as flyToImagery,_ as flyToLnglat,I as flyToNorth,T as flyToPosition,A as flyToRectangleBounds,E as getCameraView,l as getCesiumForAutoFitScale,H as getInoCesiumBaseUrl,R as getScreenCenterPoint,r as initCesium,B as initCesiumEvent,Ye as makeGridFromElevationExtrema,Xe as makeGridToInstanceForBox,Ze as makeGridToInstanceForLine,f as makeLnglatToPosition,v as makeLnglatsToLineGeojson,C as makeLnglatsToPointGeojson,M as makeLnglatsToPolygonGeojson,g as makeLnglatsToPositions,y as makePositionsClose,p as makePositionsForAntiClockwise,h as makePositionsForClockwise,u as makePositionsToLnglats,m as makePositiontoLnglat,b as makeYawPitchRollToHeadingPitchRoll,Ke as mekeGridPolygonAndHeight,G as numberId,W as randomColor,j as randomPointToGeoJson,Z as randomPolygonToGeoJson,X as randomPolylineToGeoJson,N as setCameraAutoBackTiltToZero,c as setCesiumForAutoFitScale,s as setGlobeEnabled,a as setGlobeOpatity,w as setViewToLnglat,L as twinkleModel};
|