@jorgmoritz/gis-manager 0.1.21
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/LICENSE +21 -0
- package/README.md +76 -0
- package/dist/VertexDetailInfo-BoVDy22s.d.cts +79 -0
- package/dist/VertexDetailInfo-BoVDy22s.d.ts +79 -0
- package/dist/index.cjs +10111 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1891 -0
- package/dist/index.d.ts +1891 -0
- package/dist/index.js +10084 -0
- package/dist/index.js.map +1 -0
- package/dist/vue/index.cjs +9939 -0
- package/dist/vue/index.cjs.map +1 -0
- package/dist/vue/index.d.cts +160 -0
- package/dist/vue/index.d.ts +160 -0
- package/dist/vue/index.js +9936 -0
- package/dist/vue/index.js.map +1 -0
- package/package.json +67 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,1891 @@
|
|
|
1
|
+
import * as Cesium from 'cesium';
|
|
2
|
+
export { V as VertexDetailInfo, a as VertexOperationInfo } from './VertexDetailInfo-BoVDy22s.cjs';
|
|
3
|
+
|
|
4
|
+
interface InitOptions {
|
|
5
|
+
appName?: string;
|
|
6
|
+
}
|
|
7
|
+
interface VersionInfo {
|
|
8
|
+
name: string;
|
|
9
|
+
version: string;
|
|
10
|
+
}
|
|
11
|
+
interface CameraView {
|
|
12
|
+
destination: any;
|
|
13
|
+
heading?: number;
|
|
14
|
+
pitch?: number;
|
|
15
|
+
roll?: number;
|
|
16
|
+
}
|
|
17
|
+
type CameraDestinationInput = [number, number] | [number, number, number] | {
|
|
18
|
+
lon: number;
|
|
19
|
+
lat: number;
|
|
20
|
+
height?: number;
|
|
21
|
+
} | {
|
|
22
|
+
lng: number;
|
|
23
|
+
lat: number;
|
|
24
|
+
height?: number;
|
|
25
|
+
} | {
|
|
26
|
+
longitude: number;
|
|
27
|
+
latitude: number;
|
|
28
|
+
height?: number;
|
|
29
|
+
};
|
|
30
|
+
interface CameraOrientation {
|
|
31
|
+
heading?: number;
|
|
32
|
+
pitch?: number;
|
|
33
|
+
roll?: number;
|
|
34
|
+
}
|
|
35
|
+
interface CameraInitOptions {
|
|
36
|
+
destination: CameraDestinationInput;
|
|
37
|
+
height?: number;
|
|
38
|
+
orientation?: CameraOrientation;
|
|
39
|
+
}
|
|
40
|
+
interface CameraFlyOptions extends CameraInitOptions {
|
|
41
|
+
duration?: number;
|
|
42
|
+
}
|
|
43
|
+
interface CameraSetViewOptions {
|
|
44
|
+
destination: CameraDestinationInput;
|
|
45
|
+
orientation?: CameraOrientation;
|
|
46
|
+
}
|
|
47
|
+
type ImageryProviderKind = 'urlTemplate' | 'wmts' | 'wms' | 'arcgis';
|
|
48
|
+
interface ImageryOptions {
|
|
49
|
+
provider: ImageryProviderKind;
|
|
50
|
+
url: string;
|
|
51
|
+
opacity?: number;
|
|
52
|
+
attribution?: string;
|
|
53
|
+
zIndex?: number;
|
|
54
|
+
zoomRange?: {
|
|
55
|
+
min?: number;
|
|
56
|
+
max?: number;
|
|
57
|
+
};
|
|
58
|
+
rectangle?: [number, number, number, number];
|
|
59
|
+
[key: string]: any;
|
|
60
|
+
}
|
|
61
|
+
type TerrainKind = 'cesium-ion' | 'url' | 'ellipsoid';
|
|
62
|
+
interface TerrainOptions {
|
|
63
|
+
type: TerrainKind;
|
|
64
|
+
url?: string;
|
|
65
|
+
ionAssetId?: number;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
declare const version: string;
|
|
69
|
+
declare const versionInfo: {
|
|
70
|
+
name: string;
|
|
71
|
+
version: string;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
interface CesiumAssetsOptions {
|
|
75
|
+
baseUrl: string;
|
|
76
|
+
ionToken?: string;
|
|
77
|
+
}
|
|
78
|
+
declare function configureCesiumAssets(opts: CesiumAssetsOptions): void;
|
|
79
|
+
declare function getCesiumBaseUrl(): string | undefined;
|
|
80
|
+
declare function assertCesiumAssetsConfigured(): void;
|
|
81
|
+
/** Configure Cesium Ion token only. Safe to call before or after Cesium is imported. */
|
|
82
|
+
declare function configureCesiumIonToken(token: string): void;
|
|
83
|
+
declare function getCesiumIonToken(): string | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Ensure the provided Cesium namespace uses the configured Ion token.
|
|
86
|
+
* This solves cases where the app's Cesium module instance differs from the one we can require(),
|
|
87
|
+
* especially under ESM bundlers. Call this with the Cesium instance actually used to construct Viewer.
|
|
88
|
+
*/
|
|
89
|
+
declare function ensureCesiumIonToken(CesiumNS: typeof Cesium): void;
|
|
90
|
+
|
|
91
|
+
type Listener<T> = (payload: T) => void;
|
|
92
|
+
declare class Emitter<T> {
|
|
93
|
+
private listeners;
|
|
94
|
+
on(fn: Listener<T>): () => void;
|
|
95
|
+
off(fn: Listener<T>): void;
|
|
96
|
+
emit(payload: T): void;
|
|
97
|
+
clear(): void;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* 相机 FOV 变化事件
|
|
101
|
+
*/
|
|
102
|
+
interface CameraFOVChangeEvent {
|
|
103
|
+
/** 当前 FOV 值(度) */
|
|
104
|
+
fov: number;
|
|
105
|
+
/** 等效焦距(mm) */
|
|
106
|
+
focalLength: number;
|
|
107
|
+
/** 事件来源 */
|
|
108
|
+
source: 'controller' | 'preview' | 'frustum' | 'user';
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* 相机姿态变化事件
|
|
112
|
+
*/
|
|
113
|
+
interface CameraPoseChangeEvent {
|
|
114
|
+
/** 相机位置 */
|
|
115
|
+
position: any;
|
|
116
|
+
/** 航向角(度) */
|
|
117
|
+
heading: number;
|
|
118
|
+
/** 俯仰角(度) */
|
|
119
|
+
pitch: number;
|
|
120
|
+
/** 翻滚角(度) */
|
|
121
|
+
roll: number;
|
|
122
|
+
/** FOV(度) */
|
|
123
|
+
fov?: number;
|
|
124
|
+
/** 事件来源 */
|
|
125
|
+
source: 'preview' | 'frustum' | 'airplane' | 'user';
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* 视锥体形状变化事件
|
|
129
|
+
*/
|
|
130
|
+
interface FrustumShapeChangeEvent {
|
|
131
|
+
/** FOV(度) */
|
|
132
|
+
fov: number;
|
|
133
|
+
/** 视锥体长度(米) */
|
|
134
|
+
length: number;
|
|
135
|
+
/** 宽高比 */
|
|
136
|
+
aspectRatio: number;
|
|
137
|
+
/** 事件来源 */
|
|
138
|
+
source: 'controller' | 'user';
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* 全局事件总线
|
|
142
|
+
* 用于管理 CameraFOVController、PathPreview、FrustumPyramid 之间的通信
|
|
143
|
+
*/
|
|
144
|
+
declare class CameraEventBus {
|
|
145
|
+
/** FOV 变化事件 */
|
|
146
|
+
readonly onFOVChange: Emitter<CameraFOVChangeEvent>;
|
|
147
|
+
/** 相机姿态变化事件 */
|
|
148
|
+
readonly onPoseChange: Emitter<CameraPoseChangeEvent>;
|
|
149
|
+
/** 视锥体形状变化事件 */
|
|
150
|
+
readonly onFrustumShapeChange: Emitter<FrustumShapeChangeEvent>;
|
|
151
|
+
/**
|
|
152
|
+
* 清理所有监听器
|
|
153
|
+
*/
|
|
154
|
+
destroy(): void;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* 全局单例事件总线实例
|
|
158
|
+
* 用于跨组件通信
|
|
159
|
+
*/
|
|
160
|
+
declare const globalCameraEventBus: CameraEventBus;
|
|
161
|
+
|
|
162
|
+
type LayerType = 'terrain' | 'imagery' | 'tileset' | 'datasource';
|
|
163
|
+
interface LayerHandle {
|
|
164
|
+
id: string;
|
|
165
|
+
type: LayerType;
|
|
166
|
+
dispose(): void;
|
|
167
|
+
}
|
|
168
|
+
interface LayerEvents {
|
|
169
|
+
added: LayerHandle;
|
|
170
|
+
removed: LayerHandle;
|
|
171
|
+
error: {
|
|
172
|
+
id?: string;
|
|
173
|
+
error: unknown;
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
interface PhotoBillboardItem {
|
|
177
|
+
lon: number;
|
|
178
|
+
lat: number;
|
|
179
|
+
height?: number;
|
|
180
|
+
imgUrl: string;
|
|
181
|
+
name?: string;
|
|
182
|
+
id?: string;
|
|
183
|
+
}
|
|
184
|
+
interface PhotoBillboardLayerOptions {
|
|
185
|
+
items: PhotoBillboardItem[];
|
|
186
|
+
layerName?: string;
|
|
187
|
+
size?: number;
|
|
188
|
+
preloadImages?: boolean;
|
|
189
|
+
}
|
|
190
|
+
interface PhotoBillboardResult {
|
|
191
|
+
handle: LayerHandle;
|
|
192
|
+
dataSource: Cesium.CustomDataSource;
|
|
193
|
+
layerName: string;
|
|
194
|
+
added: number;
|
|
195
|
+
total: number;
|
|
196
|
+
}
|
|
197
|
+
declare class LayerManager {
|
|
198
|
+
private CesiumNS;
|
|
199
|
+
private viewer;
|
|
200
|
+
private imageryIdMap;
|
|
201
|
+
private tilesetIdMap;
|
|
202
|
+
private dataSourceIdMap;
|
|
203
|
+
private terrainId?;
|
|
204
|
+
events: Emitter<LayerEvents>;
|
|
205
|
+
constructor(CesiumNS: typeof Cesium, viewer: Cesium.Viewer);
|
|
206
|
+
addDOM(options: ImageryOptions): LayerHandle | undefined;
|
|
207
|
+
addDEM(options: TerrainOptions): Promise<LayerHandle | undefined>;
|
|
208
|
+
addDSM(options: {
|
|
209
|
+
url: string;
|
|
210
|
+
show?: boolean;
|
|
211
|
+
maximumScreenSpaceError?: number;
|
|
212
|
+
}): Promise<LayerHandle | undefined>;
|
|
213
|
+
addPhotoBillboards(options: PhotoBillboardLayerOptions): Promise<PhotoBillboardResult | undefined>;
|
|
214
|
+
setVisible(id: string, visible: boolean): void;
|
|
215
|
+
setOpacity(id: string, opacity: number): void;
|
|
216
|
+
remove(id: string): void;
|
|
217
|
+
private composeImageWithBorder;
|
|
218
|
+
private createImageryProvider;
|
|
219
|
+
private createTerrain;
|
|
220
|
+
getImageryLayer(id: string): Cesium.ImageryLayer | undefined;
|
|
221
|
+
getTileset(id: string): Cesium.Cesium3DTileset | undefined;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
type Toggle2D3DOptions = {
|
|
225
|
+
orthographicWidth?: number;
|
|
226
|
+
pitch3D?: number;
|
|
227
|
+
heading3D?: number;
|
|
228
|
+
roll3D?: number;
|
|
229
|
+
height3D?: number;
|
|
230
|
+
duration?: number;
|
|
231
|
+
};
|
|
232
|
+
type Orientation = {
|
|
233
|
+
heading: number;
|
|
234
|
+
pitch: number;
|
|
235
|
+
roll: number;
|
|
236
|
+
};
|
|
237
|
+
interface Toggle2D3DContext {
|
|
238
|
+
CesiumNS: typeof Cesium;
|
|
239
|
+
viewer: Cesium.Viewer;
|
|
240
|
+
getLastPerspectiveOrientation: () => Orientation | undefined;
|
|
241
|
+
setLastPerspectiveOrientation: (o: Orientation | undefined) => void;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Toggle between 3D and 2D scene modes with orientation preservation on return to 3D.
|
|
245
|
+
* This utility is framework-agnostic and only depends on Cesium viewer and a tiny state bridge.
|
|
246
|
+
*/
|
|
247
|
+
declare function toggle2D3D(ctx: Toggle2D3DContext, options?: Toggle2D3DOptions): void;
|
|
248
|
+
|
|
249
|
+
interface FlyToOptions {
|
|
250
|
+
duration?: number;
|
|
251
|
+
}
|
|
252
|
+
interface PathOptions {
|
|
253
|
+
speed?: number;
|
|
254
|
+
loop?: boolean;
|
|
255
|
+
}
|
|
256
|
+
declare class CameraManager {
|
|
257
|
+
private CesiumNS;
|
|
258
|
+
private viewer;
|
|
259
|
+
constructor(CesiumNS: typeof Cesium, viewer: Cesium.Viewer);
|
|
260
|
+
private _lastPerspectiveOrientation?;
|
|
261
|
+
private _isBirdsEyeView;
|
|
262
|
+
private _beforeBirdsEye?;
|
|
263
|
+
private parseLonLat;
|
|
264
|
+
initCamera(destination: CameraDestinationInput | CameraFlyOptions, height?: number, orientation?: CameraOrientation): void;
|
|
265
|
+
setPerspective(): void;
|
|
266
|
+
setOrthographic(width?: number): void;
|
|
267
|
+
/**
|
|
268
|
+
* Toggle between 2D and 3D scene modes while preserving and restoring a 3D orientation.
|
|
269
|
+
*/
|
|
270
|
+
toggle2D3D(options?: Toggle2D3DOptions): void;
|
|
271
|
+
/**
|
|
272
|
+
* @deprecated Use toggle2D3D instead.
|
|
273
|
+
*/
|
|
274
|
+
toggleBirdsEye3D(options?: Toggle2D3DOptions): void;
|
|
275
|
+
/**
|
|
276
|
+
* 切换鸟瞰视角(垂直俯视)
|
|
277
|
+
* 在当前3D场景中切换到垂直向下的俯视角度,并可选择使用正交投影
|
|
278
|
+
*
|
|
279
|
+
* @param options 配置选项
|
|
280
|
+
* @param options.useOrthographic 是否使用正交投影(默认false,使用透视投影)
|
|
281
|
+
* @param options.height 鸟瞰高度(米,默认自动计算)
|
|
282
|
+
* @param options.orthographicWidth 正交视图宽度(米,默认1000000)
|
|
283
|
+
* @param options.duration 飞行动画时长(秒,默认1.0)
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* ```typescript
|
|
287
|
+
* // 切换到鸟瞰视角(透视投影)
|
|
288
|
+
* cameraManager.toggleBirdsEyeView();
|
|
289
|
+
*
|
|
290
|
+
* // 切换到鸟瞰视角(正交投影)
|
|
291
|
+
* cameraManager.toggleBirdsEyeView({ useOrthographic: true });
|
|
292
|
+
*
|
|
293
|
+
* // 自定义高度和宽度
|
|
294
|
+
* cameraManager.toggleBirdsEyeView({
|
|
295
|
+
* useOrthographic: true,
|
|
296
|
+
* height: 50000,
|
|
297
|
+
* orthographicWidth: 500000
|
|
298
|
+
* });
|
|
299
|
+
* ```
|
|
300
|
+
*/
|
|
301
|
+
toggleBirdsEyeView(options?: {
|
|
302
|
+
useOrthographic?: boolean;
|
|
303
|
+
height?: number;
|
|
304
|
+
orthographicWidth?: number;
|
|
305
|
+
duration?: number;
|
|
306
|
+
}): void;
|
|
307
|
+
/**
|
|
308
|
+
* 进入鸟瞰视角
|
|
309
|
+
*/
|
|
310
|
+
private enterBirdsEyeView;
|
|
311
|
+
flyToSimple(lon: number, lat: number, height?: number): void;
|
|
312
|
+
/**
|
|
313
|
+
* 从鸟瞰视角恢复
|
|
314
|
+
*/
|
|
315
|
+
private restoreFromBirdsEye;
|
|
316
|
+
/**
|
|
317
|
+
* 设置为鸟瞰视角(不切换,直接设置)
|
|
318
|
+
*
|
|
319
|
+
* @param options 配置选项
|
|
320
|
+
* @param options.useOrthographic 是否使用正交投影
|
|
321
|
+
* @param options.height 鸟瞰高度
|
|
322
|
+
* @param options.orthographicWidth 正交视图宽度
|
|
323
|
+
*/
|
|
324
|
+
setBirdsEyeView(options?: {
|
|
325
|
+
useOrthographic?: boolean;
|
|
326
|
+
height?: number;
|
|
327
|
+
orthographicWidth?: number;
|
|
328
|
+
}): void;
|
|
329
|
+
/**
|
|
330
|
+
* 检查当前是否处于鸟瞰视角
|
|
331
|
+
*/
|
|
332
|
+
isBirdsEyeView(): boolean;
|
|
333
|
+
setView(view: CameraView): void;
|
|
334
|
+
moveToChengdu(): void;
|
|
335
|
+
isitwork(): void;
|
|
336
|
+
setViewEasy(args: {
|
|
337
|
+
destination: CameraDestinationInput;
|
|
338
|
+
orientation?: CameraOrientation;
|
|
339
|
+
}): void;
|
|
340
|
+
flyToTerrain(bounds: [number, number, number, number], tp: Cesium.CesiumTerrainProvider): Promise<void>;
|
|
341
|
+
flyToEasy(destination: CameraDestinationInput | CameraFlyOptions, heightOrOrientation?: number | CameraOrientation, orientationOrDuration?: CameraOrientation | number, duration?: number): void;
|
|
342
|
+
flyTo(view: CameraView, opts?: FlyToOptions): void;
|
|
343
|
+
lookAt(target: any, offset?: any): void;
|
|
344
|
+
zoom(delta: number): void;
|
|
345
|
+
pan(dx: number, dy: number): void;
|
|
346
|
+
followPath(positions: any[], opts?: PathOptions): Promise<void>;
|
|
347
|
+
flyToRectangle(rect: Cesium.Rectangle, opts?: FlyToOptions & {
|
|
348
|
+
heading?: number;
|
|
349
|
+
pitch?: number;
|
|
350
|
+
roll?: number;
|
|
351
|
+
zoomScale?: number;
|
|
352
|
+
}): void;
|
|
353
|
+
focusOnImageryLayer(layer: Cesium.ImageryLayer, opts?: FlyToOptions & {
|
|
354
|
+
heading?: number;
|
|
355
|
+
pitch?: number;
|
|
356
|
+
roll?: number;
|
|
357
|
+
height?: number;
|
|
358
|
+
zoomScale?: number;
|
|
359
|
+
}): void;
|
|
360
|
+
/**
|
|
361
|
+
* fly to with promise
|
|
362
|
+
* @param view
|
|
363
|
+
* @param opts
|
|
364
|
+
* @returns
|
|
365
|
+
*/
|
|
366
|
+
private flyToAsync;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
interface SceneOptions {
|
|
370
|
+
container: string | HTMLElement;
|
|
371
|
+
imagery?: ImageryOptions;
|
|
372
|
+
terrain?: TerrainOptions;
|
|
373
|
+
initialCamera?: CameraView | CameraInitOptions;
|
|
374
|
+
sunlight?: {
|
|
375
|
+
enabled: boolean;
|
|
376
|
+
time?: Date;
|
|
377
|
+
};
|
|
378
|
+
shadows?: boolean;
|
|
379
|
+
viewerOptions?: Cesium.Viewer.ConstructorOptions;
|
|
380
|
+
}
|
|
381
|
+
declare class SceneManager {
|
|
382
|
+
private CesiumNS;
|
|
383
|
+
private viewer;
|
|
384
|
+
private layerManager;
|
|
385
|
+
private cameraManager;
|
|
386
|
+
constructor(CesiumNS: typeof Cesium, options: SceneOptions);
|
|
387
|
+
getViewer(): Cesium.Viewer;
|
|
388
|
+
/**
|
|
389
|
+
* Set a black background for areas without imagery. Optionally clear existing base imagery layers.
|
|
390
|
+
*/
|
|
391
|
+
useBlackBackground(removeAllImagery?: boolean): void;
|
|
392
|
+
destroy(): void;
|
|
393
|
+
configureSunlight(enabled: boolean, datetime?: Date): void;
|
|
394
|
+
setShadows(enabled: boolean): void;
|
|
395
|
+
setInitialCamera(view: CameraView | CameraInitOptions): void;
|
|
396
|
+
getCameraManager(): CameraManager;
|
|
397
|
+
getLayerManager(): LayerManager;
|
|
398
|
+
setBaseImagery(url: string, layer_id: string, opts?: Omit<ImageryOptions, 'url'>): Cesium.ImageryLayer | undefined;
|
|
399
|
+
set3DTiles(url: string, layer_id: string): Promise<any | undefined>;
|
|
400
|
+
setTerrain(options: TerrainOptions): Promise<Cesium.TerrainProvider | undefined>;
|
|
401
|
+
addDSM(options: {
|
|
402
|
+
url: string;
|
|
403
|
+
show?: boolean;
|
|
404
|
+
maximumScreenSpaceError?: number;
|
|
405
|
+
}): Promise<LayerHandle | undefined>;
|
|
406
|
+
private resolveContainer;
|
|
407
|
+
private applyImagery;
|
|
408
|
+
private apply3Dtiles;
|
|
409
|
+
private applyTerrain;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Sinofly 航点信息接口
|
|
414
|
+
*/
|
|
415
|
+
interface SinoflyWaypointInfo {
|
|
416
|
+
waypointId: number | string;
|
|
417
|
+
waylineId: number | string;
|
|
418
|
+
index: number;
|
|
419
|
+
latitude: string;
|
|
420
|
+
longitude: string;
|
|
421
|
+
altitude: string;
|
|
422
|
+
action: string;
|
|
423
|
+
noReturn: number;
|
|
424
|
+
createUserId?: string;
|
|
425
|
+
createTime?: string;
|
|
426
|
+
modifyUserId?: string;
|
|
427
|
+
modifyTime?: string;
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Sinofly 航线路数据结构接口
|
|
431
|
+
*/
|
|
432
|
+
interface SinoflyWaylineData {
|
|
433
|
+
waylineId: number | string;
|
|
434
|
+
waylineName: string;
|
|
435
|
+
waylineType: number;
|
|
436
|
+
waylineVersion: string;
|
|
437
|
+
source: number;
|
|
438
|
+
heightType?: string;
|
|
439
|
+
droneModelKey: number | string;
|
|
440
|
+
relativeHeight: number;
|
|
441
|
+
autoFlightSpeed: number;
|
|
442
|
+
takeOffSecurityHeight: number;
|
|
443
|
+
globalRthHeight: number;
|
|
444
|
+
fileId: number | string;
|
|
445
|
+
fileMd5: string;
|
|
446
|
+
distance: number;
|
|
447
|
+
duration: number;
|
|
448
|
+
waypointNumber: number;
|
|
449
|
+
photoNumber: number;
|
|
450
|
+
createUserId?: string;
|
|
451
|
+
createTime?: string;
|
|
452
|
+
modifyUserId?: string;
|
|
453
|
+
modifyTime?: string;
|
|
454
|
+
stationId?: number;
|
|
455
|
+
subarrayId?: number;
|
|
456
|
+
stationName?: string;
|
|
457
|
+
subarrayName?: string;
|
|
458
|
+
/** 起始点位置坐标(Cartesian3 序列化后的字符串,JSON 格式包含 longitude/latitude/height) */
|
|
459
|
+
takeOffRefPoint?: string;
|
|
460
|
+
thumbnailFileId?: number;
|
|
461
|
+
waypointInfo: SinoflyWaypointInfo[];
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* 转换后的航点数据格式(用于 renderFlightPath)
|
|
465
|
+
*/
|
|
466
|
+
interface ConvertedWaypointData {
|
|
467
|
+
position: Cesium.Cartesian3;
|
|
468
|
+
heading: number;
|
|
469
|
+
pitch: number;
|
|
470
|
+
roll: number;
|
|
471
|
+
fov: number;
|
|
472
|
+
index: number;
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* 转换后的航线路数据格式
|
|
476
|
+
*/
|
|
477
|
+
interface ConvertedWaylineData {
|
|
478
|
+
id?: string;
|
|
479
|
+
name?: string;
|
|
480
|
+
description?: string;
|
|
481
|
+
waypointData: ConvertedWaypointData[];
|
|
482
|
+
metadata?: {
|
|
483
|
+
waylineId: number | string;
|
|
484
|
+
waylineType: number;
|
|
485
|
+
waylineVersion: string;
|
|
486
|
+
relativeHeight: number;
|
|
487
|
+
autoFlightSpeed: number;
|
|
488
|
+
distance: number;
|
|
489
|
+
duration: number;
|
|
490
|
+
stationId?: number;
|
|
491
|
+
subarrayId?: number;
|
|
492
|
+
stationName?: string;
|
|
493
|
+
subarrayName?: string;
|
|
494
|
+
takeOffSecurityHeight?: number;
|
|
495
|
+
hasTakeOffRefPoint?: boolean;
|
|
496
|
+
[key: string]: any;
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Sinofly 数据适配器配置选项
|
|
501
|
+
*/
|
|
502
|
+
interface SinoflyAdapterOptions {
|
|
503
|
+
/**
|
|
504
|
+
* Cesium 命名空间(用于创建 Cartesian3)
|
|
505
|
+
*/
|
|
506
|
+
CesiumNS: typeof Cesium;
|
|
507
|
+
/**
|
|
508
|
+
* 默认航向角(度),默认 0
|
|
509
|
+
*/
|
|
510
|
+
defaultHeading?: number;
|
|
511
|
+
/**
|
|
512
|
+
* 默认俯仰角(度),默认 -10
|
|
513
|
+
*/
|
|
514
|
+
defaultPitch?: number;
|
|
515
|
+
/**
|
|
516
|
+
* 默认横滚角(度),默认 0
|
|
517
|
+
*/
|
|
518
|
+
defaultRoll?: number;
|
|
519
|
+
/**
|
|
520
|
+
* 默认视场角(度),默认 50
|
|
521
|
+
*/
|
|
522
|
+
defaultFov?: number;
|
|
523
|
+
/**
|
|
524
|
+
* 是否从 action 字段解析姿态信息(默认 true)
|
|
525
|
+
* 如果为 true,会尝试从 action JSON 字符串中解析姿态信息:
|
|
526
|
+
* - heading: 从 rotateYaw 或 rotateYaw.aircraftHeading 获取
|
|
527
|
+
* - pitch: 从 gimbalRotate 或 gimbalRotate.gimbalPitchRotateAngle 获取
|
|
528
|
+
* - fov: 从 zoom 或 zoom.focalLength 获取
|
|
529
|
+
* - roll: 保持默认值(Sinofly 数据中通常不包含 roll 信息)
|
|
530
|
+
*/
|
|
531
|
+
parseActionForPose?: boolean;
|
|
532
|
+
/**
|
|
533
|
+
* 是否按 index 排序航点(默认 true)
|
|
534
|
+
*/
|
|
535
|
+
sortByIndex?: boolean;
|
|
536
|
+
/**
|
|
537
|
+
* 自定义航点过滤函数,返回 false 的航点将被过滤
|
|
538
|
+
*/
|
|
539
|
+
filterWaypoint?: (waypoint: SinoflyWaypointInfo, index: number) => boolean;
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* 将 Sinofly 航线路数据转换为本库所需的数据格式
|
|
543
|
+
*
|
|
544
|
+
* @param data Sinofly 航线路数据
|
|
545
|
+
* @param options 适配器配置选项
|
|
546
|
+
* @returns 转换后的航线路数据
|
|
547
|
+
*
|
|
548
|
+
* @example
|
|
549
|
+
* ```typescript
|
|
550
|
+
* import * as Cesium from 'cesium';
|
|
551
|
+
* import { convertSinoflyWayline } from '@jorgmoritz/gis-manager';
|
|
552
|
+
*
|
|
553
|
+
* const sinoflyData = {
|
|
554
|
+
* waylineId: 1,
|
|
555
|
+
* waylineName: "测试航线",
|
|
556
|
+
* waypointInfo: [
|
|
557
|
+
* {
|
|
558
|
+
* index: 0,
|
|
559
|
+
* latitude: "39.9042",
|
|
560
|
+
* longitude: "116.4074",
|
|
561
|
+
* altitude: "100.0",
|
|
562
|
+
* action: JSON.stringify({
|
|
563
|
+
* rotateYaw: { aircraftHeading: 45 },
|
|
564
|
+
* gimbalRotate: { gimbalPitchRotateAngle: -10 },
|
|
565
|
+
* zoom: { focalLength: 50 }
|
|
566
|
+
* })
|
|
567
|
+
* }
|
|
568
|
+
* ]
|
|
569
|
+
* };
|
|
570
|
+
*
|
|
571
|
+
* const converted = convertSinoflyWayline(sinoflyData, {
|
|
572
|
+
* CesiumNS: Cesium,
|
|
573
|
+
* // parseActionForPose 默认为 true,会自动从 action 中解析姿态信息
|
|
574
|
+
* defaultHeading: 0, // 如果 action 中没有 rotateYaw,使用此默认值
|
|
575
|
+
* defaultPitch: -10, // 如果 action 中没有 gimbalRotate,使用此默认值
|
|
576
|
+
* defaultRoll: 0,
|
|
577
|
+
* defaultFov: 50 // 如果 action 中没有 zoom,使用此默认值
|
|
578
|
+
* });
|
|
579
|
+
*
|
|
580
|
+
* // 使用转换后的数据
|
|
581
|
+
* czmlPathManager.renderFlightPath({
|
|
582
|
+
* id: converted.id,
|
|
583
|
+
* name: converted.name,
|
|
584
|
+
* waypointData: converted.waypointData,
|
|
585
|
+
* description: converted.description
|
|
586
|
+
* });
|
|
587
|
+
* ```
|
|
588
|
+
*/
|
|
589
|
+
declare function convertSinoflyWayline(data: SinoflyWaylineData, options: SinoflyAdapterOptions): ConvertedWaylineData;
|
|
590
|
+
/**
|
|
591
|
+
* 批量转换多个 Sinofly 航线路
|
|
592
|
+
*
|
|
593
|
+
* @param dataList Sinofly 航线路数据数组
|
|
594
|
+
* @param options 适配器配置选项
|
|
595
|
+
* @returns 转换后的航线路数据数组
|
|
596
|
+
*
|
|
597
|
+
* @example
|
|
598
|
+
* ```typescript
|
|
599
|
+
* const results = convertSinoflyWaylines(
|
|
600
|
+
* [wayline1, wayline2, wayline3],
|
|
601
|
+
* { CesiumNS: Cesium }
|
|
602
|
+
* );
|
|
603
|
+
*
|
|
604
|
+
* results.forEach(result => {
|
|
605
|
+
* if (result.success) {
|
|
606
|
+
* czmlPathManager.renderFlightPath({
|
|
607
|
+
* waypointData: result.data.waypointData,
|
|
608
|
+
* name: result.data.name
|
|
609
|
+
* });
|
|
610
|
+
* } else {
|
|
611
|
+
* console.error('转换失败:', result.error);
|
|
612
|
+
* }
|
|
613
|
+
* });
|
|
614
|
+
* ```
|
|
615
|
+
*/
|
|
616
|
+
declare function convertSinoflyWaylines(dataList: SinoflyWaylineData[], options: SinoflyAdapterOptions): Array<{
|
|
617
|
+
success: boolean;
|
|
618
|
+
data?: ConvertedWaylineData;
|
|
619
|
+
error?: string;
|
|
620
|
+
waylineId?: number | string;
|
|
621
|
+
}>;
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* 回显飞航路线的选项类型
|
|
625
|
+
*/
|
|
626
|
+
interface RenderFlightPathOptions {
|
|
627
|
+
/** Sinofly 航线路数据 */
|
|
628
|
+
data: SinoflyWaylineData;
|
|
629
|
+
/** Sinofly 适配器配置选项 */
|
|
630
|
+
adapterOptions?: Omit<SinoflyAdapterOptions, 'CesiumNS'>;
|
|
631
|
+
id?: string;
|
|
632
|
+
name?: string;
|
|
633
|
+
description?: string;
|
|
634
|
+
layer?: Cesium.CustomDataSource;
|
|
635
|
+
style?: {
|
|
636
|
+
width?: number;
|
|
637
|
+
color?: Cesium.Color;
|
|
638
|
+
material?: Cesium.MaterialProperty | Cesium.Color;
|
|
639
|
+
};
|
|
640
|
+
hasHiddenClimb?: boolean;
|
|
641
|
+
altitudeMode?: string;
|
|
642
|
+
climbHeight?: number;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
type PathSample = {
|
|
646
|
+
time: Cesium.JulianDate | Date | string | number;
|
|
647
|
+
lon: number;
|
|
648
|
+
lat: number;
|
|
649
|
+
height?: number;
|
|
650
|
+
} | [Cesium.JulianDate | Date | string | number, number, number, number?];
|
|
651
|
+
interface PathStyleOptions {
|
|
652
|
+
width?: number;
|
|
653
|
+
color?: Cesium.Color;
|
|
654
|
+
material?: Cesium.MaterialProperty | Cesium.Color;
|
|
655
|
+
leadTime?: number;
|
|
656
|
+
trailTime?: number;
|
|
657
|
+
resolution?: number;
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
interface CzmlImportOptions {
|
|
661
|
+
}
|
|
662
|
+
interface CzmlExportOptions {
|
|
663
|
+
name?: string;
|
|
664
|
+
}
|
|
665
|
+
interface ShapePointProps {
|
|
666
|
+
id?: string;
|
|
667
|
+
lon: number;
|
|
668
|
+
lat: number;
|
|
669
|
+
height?: number;
|
|
670
|
+
name?: string;
|
|
671
|
+
description?: string;
|
|
672
|
+
}
|
|
673
|
+
interface ShapeLineProps {
|
|
674
|
+
id?: string;
|
|
675
|
+
coords: Array<[number, number, number?]>;
|
|
676
|
+
name?: string;
|
|
677
|
+
description?: string;
|
|
678
|
+
}
|
|
679
|
+
interface ShapePolygonProps {
|
|
680
|
+
id?: string;
|
|
681
|
+
coords: Array<[number, number, number?]>;
|
|
682
|
+
name?: string;
|
|
683
|
+
description?: string;
|
|
684
|
+
}
|
|
685
|
+
type Entity = Cesium.Entity;
|
|
686
|
+
type LonLatHeight = {
|
|
687
|
+
lon: number;
|
|
688
|
+
lat: number;
|
|
689
|
+
height: number | null;
|
|
690
|
+
};
|
|
691
|
+
declare class CZMLManager {
|
|
692
|
+
private CesiumNS;
|
|
693
|
+
private viewer;
|
|
694
|
+
private currentSelectedEntity;
|
|
695
|
+
private activePolygonSession;
|
|
696
|
+
private polygonSessionCleanup?;
|
|
697
|
+
constructor(CesiumNS: typeof Cesium, viewer: Cesium.Viewer);
|
|
698
|
+
private _polygonEditor?;
|
|
699
|
+
private get polygonEditor();
|
|
700
|
+
private _pathMgr?;
|
|
701
|
+
private get pathMgr();
|
|
702
|
+
importCZML(czml: any | URL, _opts?: CzmlImportOptions): Promise<any>;
|
|
703
|
+
exportCZML(entities: Entity[] | Cesium.EntityCollection, opts?: CzmlExportOptions): any[];
|
|
704
|
+
/**
|
|
705
|
+
* 回显飞航路线:显示完整飞航路线、航点编号和起始点箭头
|
|
706
|
+
*
|
|
707
|
+
* 接收 Sinofly 航线路数据,自动转换为本库格式并渲染显示。
|
|
708
|
+
* 请使用 pathMgr.renderFlightPath() 方法或直接导入 renderFlightPath 函数。
|
|
709
|
+
*
|
|
710
|
+
* @deprecated 请使用 pathMgr.renderFlightPath() 或直接导入 renderFlightPath 函数
|
|
711
|
+
* @param options Sinofly 数据和配置选项
|
|
712
|
+
* @returns 创建的 polyline 实体
|
|
713
|
+
*
|
|
714
|
+
* @example
|
|
715
|
+
* ```typescript
|
|
716
|
+
* // 推荐方式 1: 使用 pathMgr
|
|
717
|
+
* const entity = czmlManager.pathMgr.renderFlightPath(Cesium, viewer, {
|
|
718
|
+
* data: sinoflyData
|
|
719
|
+
* });
|
|
720
|
+
*
|
|
721
|
+
* // 推荐方式 2: 直接导入函数
|
|
722
|
+
* import { renderFlightPath } from '@jorgmoritz/gis-manager';
|
|
723
|
+
* const entity = renderFlightPath(Cesium, viewer, {
|
|
724
|
+
* data: sinoflyData
|
|
725
|
+
* });
|
|
726
|
+
* ```
|
|
727
|
+
*/
|
|
728
|
+
renderFlightPath(options: RenderFlightPathOptions): Entity;
|
|
729
|
+
addPathSample(entityOrId: Entity | string, sample: PathSample): void;
|
|
730
|
+
addPathSamples(entityOrId: Entity | string, samples: PathSample[]): void;
|
|
731
|
+
setPathSamples(entityOrId: Entity | string, samples: PathSample[]): void;
|
|
732
|
+
clearPathSamples(entityOrId: Entity | string): void;
|
|
733
|
+
setPathStyle(entityOrId: Entity | string, style: PathStyleOptions): void;
|
|
734
|
+
startPathDrawing(options?: {
|
|
735
|
+
layer?: Cesium.CustomDataSource;
|
|
736
|
+
idPrefix?: string;
|
|
737
|
+
defaultHeight?: number;
|
|
738
|
+
width?: number;
|
|
739
|
+
material?: Cesium.MaterialProperty | Cesium.Color;
|
|
740
|
+
}, onComplete?: (entity: Entity) => void): {
|
|
741
|
+
stop: () => void;
|
|
742
|
+
};
|
|
743
|
+
startPathEditing(entityOrId: Entity | string, options?: {
|
|
744
|
+
layer?: Cesium.CustomDataSource;
|
|
745
|
+
defaultHeight?: number;
|
|
746
|
+
width?: number;
|
|
747
|
+
material?: Cesium.MaterialProperty | Cesium.Color;
|
|
748
|
+
}): {
|
|
749
|
+
stop: () => void;
|
|
750
|
+
} | undefined;
|
|
751
|
+
addPoint(props: ShapePointProps): Entity;
|
|
752
|
+
addLine(props: ShapeLineProps): Entity;
|
|
753
|
+
addPolygon(props: ShapePolygonProps): Entity;
|
|
754
|
+
/**
|
|
755
|
+
* 创建一个新的自定义图层用于存放多边形实体。
|
|
756
|
+
* @param name 自定义图层名称:string,默认值为'Polygons'
|
|
757
|
+
* @returns 自定义图层对象
|
|
758
|
+
*/
|
|
759
|
+
createPolygonLayer(name?: string): Cesium.CustomDataSource;
|
|
760
|
+
/**
|
|
761
|
+
* 多边形绘制会话管理接口,创建一个polygon绘制对话,允许用户通过鼠标交互绘制多边形。
|
|
762
|
+
* @param type 图层类型 ('subarray' | 'inverter' | 'other')
|
|
763
|
+
* @param onComplete 结果回调函数,参数为新创建的多边形实体
|
|
764
|
+
* @returns 返回一个polygon绘制会话对象
|
|
765
|
+
*/
|
|
766
|
+
startPolygonDrawing(type: string, onComplete?: (entity: Entity) => void): any;
|
|
767
|
+
/**
|
|
768
|
+
* 圆形绘制会话管理接口,创建一个圆形绘制对话,允许用户通过鼠标交互绘制圆形。
|
|
769
|
+
* 使用流程:
|
|
770
|
+
* 1. 左键点击确定圆心
|
|
771
|
+
* 2. 移动鼠标动态调整半径
|
|
772
|
+
* 3. 再次左键点击确定半径,完成绘制
|
|
773
|
+
* 4. 或右键/ESC取消绘制
|
|
774
|
+
*
|
|
775
|
+
* @param onComplete 结果回调函数,参数为新创建的圆形实体
|
|
776
|
+
* @returns 返回一个圆形绘制会话对象,包含 stop() 方法
|
|
777
|
+
*
|
|
778
|
+
* ⚠️ 注意:此方法需要 PolygonEditor 实现 startCircleDrawing 方法
|
|
779
|
+
*/
|
|
780
|
+
startCircleDrawing(onComplete?: (entity: Entity) => void): any;
|
|
781
|
+
/**
|
|
782
|
+
* 点标记绘制会话管理接口,创建一个点标记绘制对话,允许用户通过鼠标交互连续添加点标记。
|
|
783
|
+
* 使用流程:
|
|
784
|
+
* 1. 左键点击地图添加点标记
|
|
785
|
+
* 2. 可连续点击添加多个点
|
|
786
|
+
* 3. 右键或 ESC 结束绘制
|
|
787
|
+
*
|
|
788
|
+
* @param iconSvg SVG 图标的 data URL 或路径
|
|
789
|
+
* @param onComplete 每次添加点时的回调函数(可选)
|
|
790
|
+
* @returns 返回一个点标记绘制会话对象,包含 stop() 方法
|
|
791
|
+
*
|
|
792
|
+
* ⚠️ 注意:此方法需要 PolygonEditor 实现 startPointDrawing 方法
|
|
793
|
+
*/
|
|
794
|
+
startPointDrawing(iconSvg?: string, onComplete?: (entity: Entity) => void): any;
|
|
795
|
+
startPolygonEditing(entityOrId?: Entity | string | undefined | null, onComplete?: (entity: Entity) => void): any;
|
|
796
|
+
private ensurePolygonSessionHooks;
|
|
797
|
+
private cancelActivePolygonDrawing;
|
|
798
|
+
/**
|
|
799
|
+
* 删除一个 polygon 实体及其 outline
|
|
800
|
+
* @param entityOrId 要删除的实体,或实体 ID,或 undefined 使用当前选中的实体
|
|
801
|
+
* @param onComplete 删除完成后的回调函数
|
|
802
|
+
* @returns 是否成功删除
|
|
803
|
+
*/
|
|
804
|
+
startPolygonDeleting(entityOrId?: Entity | string | undefined | null, onComplete?: (entity: Entity) => void): boolean;
|
|
805
|
+
updateEntity(id: string, patch: Partial<{
|
|
806
|
+
name: string;
|
|
807
|
+
description: string;
|
|
808
|
+
}>): void;
|
|
809
|
+
deleteEntity(id: string): void;
|
|
810
|
+
listEntities(): Entity[];
|
|
811
|
+
/**
|
|
812
|
+
* 获取实体的经纬度与地形高数组(仅外环/各点/单点)。
|
|
813
|
+
* - 地形高来自 viewer.scene.globe.getHeight(carto)
|
|
814
|
+
* - 高度保留 3 位小数;若为负数则置为 0
|
|
815
|
+
* - 无法获取地形高时 height 为 null
|
|
816
|
+
*
|
|
817
|
+
* 支持的实体类型:polygon(仅外环)、polyline、point/billboard
|
|
818
|
+
*/
|
|
819
|
+
getEntityLonLatTerrainHeightArray(entity: any): LonLatHeight[];
|
|
820
|
+
getEntityDataSource(entity: any): Cesium.DataSource | null;
|
|
821
|
+
/**
|
|
822
|
+
* 选择一个 polygon 实体并高亮显示
|
|
823
|
+
* 新逻辑:
|
|
824
|
+
* - 只对 subarray 和 inverter 图层的多边形生效
|
|
825
|
+
* - 设置 checked=true,使用 type 对应的高亮颜色(faceColor 和 lineColor)
|
|
826
|
+
* - faceColor:鲜艳的填充色(用于高亮)
|
|
827
|
+
* - lineColor:鲜艳的轮廓线色(用于高亮)
|
|
828
|
+
*
|
|
829
|
+
* @param entity 要选择的实体,如果为 null 则取消当前选择
|
|
830
|
+
* @returns 是否成功选择
|
|
831
|
+
*/
|
|
832
|
+
selectPolygonEntity(entity: Entity | null): boolean;
|
|
833
|
+
/**
|
|
834
|
+
* 检查当前是否处于多边形绘制模式
|
|
835
|
+
* @returns 如果正在绘制多边形则返回 true
|
|
836
|
+
*/
|
|
837
|
+
isDrawingActive(): boolean;
|
|
838
|
+
/**
|
|
839
|
+
* 检查当前是否处于多边形编辑模式
|
|
840
|
+
* @returns 如果正在编辑多边形则返回 true
|
|
841
|
+
*/
|
|
842
|
+
isEditingActive(): boolean;
|
|
843
|
+
/**
|
|
844
|
+
* 清除当前的 polygon 选择状态
|
|
845
|
+
* 新逻辑:
|
|
846
|
+
* - 设置 checked=false
|
|
847
|
+
* - 恢复为对应 type 的默认颜色(faceFinalColor 和 lineFinalColor)
|
|
848
|
+
* - faceFinalColor:较淡的填充色(默认状态)
|
|
849
|
+
* - lineFinalColor:较淡的轮廓线色(默认状态)
|
|
850
|
+
*
|
|
851
|
+
* @returns 是否成功清除
|
|
852
|
+
*/
|
|
853
|
+
clearPolygonSelection(): boolean;
|
|
854
|
+
/**
|
|
855
|
+
* 获取当前选中的 polygon 实体
|
|
856
|
+
* @returns 当前选中的实体,如果没有则返回 null
|
|
857
|
+
*/
|
|
858
|
+
getSelectedPolygonEntity(): Entity | null;
|
|
859
|
+
/**
|
|
860
|
+
* 从点位数组创建一个多边形及其轮廓线和标签
|
|
861
|
+
* @param options 创建选项
|
|
862
|
+
* - layerName: 图层名称 ('subarray' 或 'inverter')
|
|
863
|
+
* - id: 实体ID
|
|
864
|
+
* - name: 实体名称
|
|
865
|
+
* - points: 点位数组 [{ lon, lat, height }]
|
|
866
|
+
* @returns 创建的主多边形实体
|
|
867
|
+
*/
|
|
868
|
+
createPolygonFromPoints(options: {
|
|
869
|
+
layerName: 'subarray' | 'inverter';
|
|
870
|
+
id: string;
|
|
871
|
+
name: string;
|
|
872
|
+
points: Array<{
|
|
873
|
+
lon: number;
|
|
874
|
+
lat: number;
|
|
875
|
+
height?: number;
|
|
876
|
+
}>;
|
|
877
|
+
}): Entity | null;
|
|
878
|
+
/**
|
|
879
|
+
* 确保 inverter 图层始终在最上层
|
|
880
|
+
*/
|
|
881
|
+
ensureInverterLayerOnTop(): void;
|
|
882
|
+
/**
|
|
883
|
+
* 分析子阵和组串的层级关系,并自动重新编码
|
|
884
|
+
* 代理到 PolygonEditor.analyzeAndEncodePolygonHierarchy()
|
|
885
|
+
* @param targetSubarrayEntity - 可选,指定要处理的子阵实体。如果提供,则只处理该子阵及其内部组串
|
|
886
|
+
*
|
|
887
|
+
* ⚠️ 注意:此方法需要 PolygonEditor 实现 analyzeAndEncodePolygonHierarchy 方法
|
|
888
|
+
*/
|
|
889
|
+
analyzeAndEncodePolygonHierarchy(targetSubarrayEntity?: any): any;
|
|
890
|
+
/**
|
|
891
|
+
* 还原多边形的原始名称
|
|
892
|
+
* 代理到 PolygonEditor.restoreOriginalNames()
|
|
893
|
+
*
|
|
894
|
+
* ⚠️ 注意:此方法需要 PolygonEditor 实现 restoreOriginalNames 方法
|
|
895
|
+
*/
|
|
896
|
+
restoreOriginalNames(): any;
|
|
897
|
+
/**
|
|
898
|
+
* 仅分析多边形层级关系,不修改名称
|
|
899
|
+
* 代理到 PolygonEditor.getPolygonHierarchyWithoutEncoding()
|
|
900
|
+
*
|
|
901
|
+
* ⚠️ 注意:此方法需要 PolygonEditor 实现 getPolygonHierarchyWithoutEncoding 方法
|
|
902
|
+
*/
|
|
903
|
+
getPolygonHierarchyWithoutEncoding(): any;
|
|
904
|
+
/**
|
|
905
|
+
* 导出指定子阵及其内部组串的层级结构
|
|
906
|
+
* 代理到 PolygonEditor.exportSingleSubarrayHierarchy()
|
|
907
|
+
* @param subarrayEntity - 要导出的子阵实体
|
|
908
|
+
*
|
|
909
|
+
* ⚠️ 注意:此方法需要 PolygonEditor 实现 exportSingleSubarrayHierarchy 方法
|
|
910
|
+
*/
|
|
911
|
+
exportSingleSubarrayHierarchy(subarrayEntity: any): any;
|
|
912
|
+
/**
|
|
913
|
+
* 导出指定组串的扁平结构
|
|
914
|
+
* 代理到 PolygonEditor.exportSingleInverter()
|
|
915
|
+
* @param inverterEntity - 要导出的组串实体
|
|
916
|
+
*
|
|
917
|
+
* ⚠️ 注意:此方法需要 PolygonEditor 实现 exportSingleInverter 方法
|
|
918
|
+
*/
|
|
919
|
+
exportSingleInverter(inverterEntity: any): any;
|
|
920
|
+
/**
|
|
921
|
+
* 从 JSON 数据批量创建多边形(层级结构)
|
|
922
|
+
* 代理到 PolygonEditor.importPolygonsFromHierarchy()
|
|
923
|
+
*
|
|
924
|
+
* ⚠️ 注意:此方法需要 PolygonEditor 实现 importPolygonsFromHierarchy 方法
|
|
925
|
+
*/
|
|
926
|
+
importPolygonsFromHierarchy(data: any): any;
|
|
927
|
+
/**
|
|
928
|
+
* 从 JSON 数据批量创建多边形(扁平结构)
|
|
929
|
+
* 代理到 PolygonEditor.importPolygonsFromFlatStructure()
|
|
930
|
+
*
|
|
931
|
+
* ⚠️ 注意:此方法需要 PolygonEditor 实现 importPolygonsFromFlatStructure 方法
|
|
932
|
+
*/
|
|
933
|
+
importPolygonsFromFlatStructure(data: any): any;
|
|
934
|
+
/**
|
|
935
|
+
* 更新多边形实体的类型、颜色和标签
|
|
936
|
+
* 代理到 PolygonEditor.updatePolygonTypeAndStyle()
|
|
937
|
+
* @param entity 要更新的多边形实体
|
|
938
|
+
* @param newType 新的类型 ('subarray' | 'inverter' | 'astrict' | 'rail' | 'feature')
|
|
939
|
+
* @param customName 可选的自定义名称
|
|
940
|
+
*
|
|
941
|
+
* ⚠️ 注意:此方法需要 PolygonEditor 实现 updatePolygonTypeAndStyle 方法
|
|
942
|
+
*/
|
|
943
|
+
updatePolygonTypeAndStyle(entity: any, newType: string, customName?: string): any;
|
|
944
|
+
/**
|
|
945
|
+
* 从 JSON 数据加载 other 图层 (多边形、圆形、特征点)
|
|
946
|
+
* 代理到 PolygonEditor.loadOtherLayerFromJson()
|
|
947
|
+
* @param data JSON 数据,包含 astrict, rail, feature, feature_point 数组
|
|
948
|
+
*
|
|
949
|
+
* ⚠️ 注意:此方法需要 PolygonEditor 实现 loadOtherLayerFromJson 方法
|
|
950
|
+
*/
|
|
951
|
+
loadOtherLayerFromJson(data: {
|
|
952
|
+
astrict?: Array<any>;
|
|
953
|
+
rail?: Array<any>;
|
|
954
|
+
feature?: Array<any>;
|
|
955
|
+
feature_point?: Array<any>;
|
|
956
|
+
}): any;
|
|
957
|
+
/**
|
|
958
|
+
* 计算多边形的周长和面积(忽略高度值)
|
|
959
|
+
* 代理到 PolygonEditor.calculatePolygonPerimeterAndArea()
|
|
960
|
+
* @param points 点位数组 [{ lon, lat, height }]
|
|
961
|
+
* @returns { perimeter: 周长(米), area: 面积(平方米) }
|
|
962
|
+
*/
|
|
963
|
+
calculatePolygonPerimeterAndArea(points: Array<{
|
|
964
|
+
lon: number;
|
|
965
|
+
lat: number;
|
|
966
|
+
height?: number;
|
|
967
|
+
}>): {
|
|
968
|
+
perimeter: number;
|
|
969
|
+
area: number;
|
|
970
|
+
};
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
type Viewer$1 = Cesium.Viewer;
|
|
974
|
+
interface PolygonDrawingOptions {
|
|
975
|
+
layer?: Cesium.CustomDataSource;
|
|
976
|
+
idPrefix?: string;
|
|
977
|
+
}
|
|
978
|
+
interface PolygonEditingSession {
|
|
979
|
+
stop: () => void;
|
|
980
|
+
}
|
|
981
|
+
declare class PolygonEditor {
|
|
982
|
+
private CesiumNS;
|
|
983
|
+
private viewer;
|
|
984
|
+
private handler?;
|
|
985
|
+
private drawingPositions;
|
|
986
|
+
private tempPolyline?;
|
|
987
|
+
private tempPolygon?;
|
|
988
|
+
private drawHandles;
|
|
989
|
+
private rubberBandPoint?;
|
|
990
|
+
private editHandles;
|
|
991
|
+
private draggingIndex;
|
|
992
|
+
private originalPositionOnDrag?;
|
|
993
|
+
private segmentHighlight?;
|
|
994
|
+
private editOutline?;
|
|
995
|
+
private insertPreviewHandle?;
|
|
996
|
+
private keydownHandler?;
|
|
997
|
+
private originalPolygonNames;
|
|
998
|
+
constructor(CesiumNS: typeof Cesium, viewer: Viewer$1);
|
|
999
|
+
/**
|
|
1000
|
+
* 根据图层名称获取颜色配置
|
|
1001
|
+
* @param layerName 图层名称 ('subarray' | 'inverter' | 其他)
|
|
1002
|
+
* @returns 颜色配置对象
|
|
1003
|
+
*/
|
|
1004
|
+
getColorConfig(layerName: string): {
|
|
1005
|
+
lineColor: any;
|
|
1006
|
+
lineFinalColor: any;
|
|
1007
|
+
faceColor: any;
|
|
1008
|
+
faceFinalColor: any;
|
|
1009
|
+
pointColor: any;
|
|
1010
|
+
};
|
|
1011
|
+
private getPositionFromMouse;
|
|
1012
|
+
/**
|
|
1013
|
+
*
|
|
1014
|
+
* @param fn 计算属性函数
|
|
1015
|
+
* @returns 计算函数返回值的CallbackProperty对象
|
|
1016
|
+
*/
|
|
1017
|
+
private makeCallback;
|
|
1018
|
+
/**
|
|
1019
|
+
* 生成复杂唯一的 Entity ID
|
|
1020
|
+
* 格式: {timestamp}-{random}
|
|
1021
|
+
*/
|
|
1022
|
+
private generateUniqueId;
|
|
1023
|
+
/**
|
|
1024
|
+
* 将轮廓线设置为虚线样式(公用方法)
|
|
1025
|
+
*/
|
|
1026
|
+
applyDashedOutlineStyle(outlineEntity: any, color: any, width?: number, dashLength?: number): void;
|
|
1027
|
+
/**
|
|
1028
|
+
* 清除所有图层中多边形的高亮状态
|
|
1029
|
+
*/
|
|
1030
|
+
private clearAllPolygonHighlights;
|
|
1031
|
+
/**
|
|
1032
|
+
* 创建轮廓线实体
|
|
1033
|
+
*/
|
|
1034
|
+
private createOutlineEntity;
|
|
1035
|
+
/**
|
|
1036
|
+
* 创建标签实体
|
|
1037
|
+
*/
|
|
1038
|
+
private createLabelEntity;
|
|
1039
|
+
/**
|
|
1040
|
+
* 清理临时绘制元素
|
|
1041
|
+
*/
|
|
1042
|
+
private cleanupDrawingTemporaries;
|
|
1043
|
+
/**
|
|
1044
|
+
* 设置键盘事件监听器(ESC/X 键)
|
|
1045
|
+
*/
|
|
1046
|
+
private setupKeyboardListener;
|
|
1047
|
+
/**
|
|
1048
|
+
* 移除键盘事件监听器
|
|
1049
|
+
*/
|
|
1050
|
+
private removeKeyboardListener;
|
|
1051
|
+
/**
|
|
1052
|
+
* 销毁事件处理器
|
|
1053
|
+
*/
|
|
1054
|
+
private destroyHandler;
|
|
1055
|
+
/**
|
|
1056
|
+
* 完成编辑/绘制的通用清理逻辑
|
|
1057
|
+
*/
|
|
1058
|
+
private finalizePolygonSession;
|
|
1059
|
+
/**
|
|
1060
|
+
* 创建polygon绘制会话,允许用户通过鼠标交互绘制多边形。
|
|
1061
|
+
* @param type 多边形类型
|
|
1062
|
+
* @param layer 自定义图层对象
|
|
1063
|
+
* @param onComplete 结果回调函数,参数为新创建的多边形实体
|
|
1064
|
+
* @returns 返回一个polygon绘制会话对象
|
|
1065
|
+
*/
|
|
1066
|
+
startDrawing(type: string, layer?: Cesium.CustomDataSource, onComplete?: (entity: Cesium.Entity) => void): {
|
|
1067
|
+
stop: () => void;
|
|
1068
|
+
};
|
|
1069
|
+
private stopInternal;
|
|
1070
|
+
/**
|
|
1071
|
+
* 开始编辑多边形
|
|
1072
|
+
* @param polygonEntity 要编辑的多边形实体
|
|
1073
|
+
* @param layer 多边形所属的图层
|
|
1074
|
+
* @param onComplete 编辑完成回调函数
|
|
1075
|
+
* @returns 返回编辑会话对象
|
|
1076
|
+
*/
|
|
1077
|
+
startEditing(polygonEntity: Cesium.Entity, layer: Cesium.CustomDataSource, onComplete?: (entity: Cesium.Entity) => void): PolygonEditingSession;
|
|
1078
|
+
private cleanupHandles;
|
|
1079
|
+
/**
|
|
1080
|
+
* 计算多边形的周长和面积
|
|
1081
|
+
*/
|
|
1082
|
+
calculatePolygonPerimeterAndArea(points: Array<{
|
|
1083
|
+
lon: number;
|
|
1084
|
+
lat: number;
|
|
1085
|
+
height?: number;
|
|
1086
|
+
}>): {
|
|
1087
|
+
perimeter: number;
|
|
1088
|
+
area: number;
|
|
1089
|
+
};
|
|
1090
|
+
/**
|
|
1091
|
+
* 从点位数组创建一个多边形及其轮廓线和标签
|
|
1092
|
+
* @param options 创建选项
|
|
1093
|
+
* - layer: 目标图层 (CustomDataSource)
|
|
1094
|
+
* - id: 实体ID
|
|
1095
|
+
* - name: 实体名称
|
|
1096
|
+
* - points: 点位数组 [{ lon, lat, height }]
|
|
1097
|
+
* @returns 创建的主多边形实体,如果失败则返回 null
|
|
1098
|
+
*/
|
|
1099
|
+
createPolygonFromPoints(options: {
|
|
1100
|
+
layer: Cesium.CustomDataSource;
|
|
1101
|
+
id: string;
|
|
1102
|
+
name: string;
|
|
1103
|
+
points: Array<{
|
|
1104
|
+
lon: number;
|
|
1105
|
+
lat: number;
|
|
1106
|
+
height?: number;
|
|
1107
|
+
}>;
|
|
1108
|
+
}): Cesium.Entity | null;
|
|
1109
|
+
/**
|
|
1110
|
+
* 辅助方法:从实体中提取经纬度高度数组
|
|
1111
|
+
* @param entity 多边形实体
|
|
1112
|
+
* @returns 点位数组 [{ lon, lat, height }]
|
|
1113
|
+
*/
|
|
1114
|
+
private getEntityLonLatTerrainHeightArray;
|
|
1115
|
+
/**
|
|
1116
|
+
* 辅助方法:获取实体所属的 DataSource
|
|
1117
|
+
* @param entity 实体对象
|
|
1118
|
+
* @returns DataSource 或 undefined
|
|
1119
|
+
*/
|
|
1120
|
+
private getEntityDataSource;
|
|
1121
|
+
/**
|
|
1122
|
+
* 分析子阵和组串的层级关系,并自动重新编码
|
|
1123
|
+
*
|
|
1124
|
+
* 功能说明:
|
|
1125
|
+
* 1. 收集所有 subarray 和 inverter 多边形 (或仅处理指定的子阵)
|
|
1126
|
+
* 2. 使用射线法判断 inverter 是否在 subarray 内部
|
|
1127
|
+
* 3. 构建层级关系数据结构
|
|
1128
|
+
* 4. 按空间位置排序(从北到南、从东到西)
|
|
1129
|
+
* 5. 重新编码:
|
|
1130
|
+
* - 子阵: #01, #02, #03, ...
|
|
1131
|
+
* - 子阵内组串: G1.1.1, G1.1.2, ..., G1.1.99, G1.2.1, ...
|
|
1132
|
+
* - 独立组串: GX.1.1, GX.1.2, ..., GX.1.99, GX.2.1, ...
|
|
1133
|
+
* 6. 保存原始名称用于还原
|
|
1134
|
+
*
|
|
1135
|
+
* @param targetSubarrayEntity - 可选,指定要处理的子阵实体。如果提供,则只处理该子阵及其内部组串
|
|
1136
|
+
* @returns 编码结果对象,包含成功状态、统计信息、层级关系等
|
|
1137
|
+
*/
|
|
1138
|
+
analyzeAndEncodePolygonHierarchy(targetSubarrayEntity?: any): {
|
|
1139
|
+
success: boolean;
|
|
1140
|
+
subarrayCount: number;
|
|
1141
|
+
inverterCount: number;
|
|
1142
|
+
independentCount: number;
|
|
1143
|
+
savedNamesCount: number;
|
|
1144
|
+
hierarchy?: {
|
|
1145
|
+
subarrays: Array<{
|
|
1146
|
+
id: string;
|
|
1147
|
+
name: string;
|
|
1148
|
+
oldName?: string;
|
|
1149
|
+
inverters: Array<{
|
|
1150
|
+
id: string;
|
|
1151
|
+
name: string;
|
|
1152
|
+
oldName?: string;
|
|
1153
|
+
}>;
|
|
1154
|
+
}>;
|
|
1155
|
+
independentInverters?: Array<{
|
|
1156
|
+
id: string;
|
|
1157
|
+
name: string;
|
|
1158
|
+
oldName?: string;
|
|
1159
|
+
}>;
|
|
1160
|
+
};
|
|
1161
|
+
recodingResult?: Array<{
|
|
1162
|
+
oldId: string;
|
|
1163
|
+
oldName: string;
|
|
1164
|
+
newCode: string;
|
|
1165
|
+
subarraySeq: number | string;
|
|
1166
|
+
subarrayName: string;
|
|
1167
|
+
globalIndex: number;
|
|
1168
|
+
isIndependent?: boolean;
|
|
1169
|
+
}>;
|
|
1170
|
+
error?: string;
|
|
1171
|
+
};
|
|
1172
|
+
/**
|
|
1173
|
+
* 还原多边形的原始名称
|
|
1174
|
+
*
|
|
1175
|
+
* 功能说明:
|
|
1176
|
+
* 1. 检查是否有保存的原始名称
|
|
1177
|
+
* 2. 遍历所有保存的实体并还原名称
|
|
1178
|
+
* 3. 同步更新关联的 label 文本
|
|
1179
|
+
* 4. 还原后清空映射表
|
|
1180
|
+
*
|
|
1181
|
+
* @returns 还原结果对象,包含成功状态、统计信息等
|
|
1182
|
+
*/
|
|
1183
|
+
restoreOriginalNames(): {
|
|
1184
|
+
success: boolean;
|
|
1185
|
+
restoredCount: number;
|
|
1186
|
+
notFoundCount: number;
|
|
1187
|
+
message?: string;
|
|
1188
|
+
};
|
|
1189
|
+
/**
|
|
1190
|
+
* 仅分析多边形层级关系,不修改名称
|
|
1191
|
+
*
|
|
1192
|
+
* 功能说明:
|
|
1193
|
+
* 1. 收集所有 subarray 和 inverter 多边形
|
|
1194
|
+
* 2. 使用射线法判断 inverter 是否在 subarray 内部
|
|
1195
|
+
* 3. 构建层级关系数据结构
|
|
1196
|
+
* 4. 不进行任何重新编码操作,保持原始名称
|
|
1197
|
+
* 5. 按当前名称组织层级结构
|
|
1198
|
+
*
|
|
1199
|
+
* @returns 层级关系对象,包含成功状态和层级数据
|
|
1200
|
+
*/
|
|
1201
|
+
getPolygonHierarchyWithoutEncoding(): {
|
|
1202
|
+
success: boolean;
|
|
1203
|
+
subarrayCount: number;
|
|
1204
|
+
inverterCount: number;
|
|
1205
|
+
independentCount: number;
|
|
1206
|
+
hierarchy?: {
|
|
1207
|
+
subarrays: Array<{
|
|
1208
|
+
id: string;
|
|
1209
|
+
name: string;
|
|
1210
|
+
points: Array<{
|
|
1211
|
+
lon: number;
|
|
1212
|
+
lat: number;
|
|
1213
|
+
height: number;
|
|
1214
|
+
}>;
|
|
1215
|
+
inverters: Array<{
|
|
1216
|
+
id: string;
|
|
1217
|
+
name: string;
|
|
1218
|
+
points: Array<{
|
|
1219
|
+
lon: number;
|
|
1220
|
+
lat: number;
|
|
1221
|
+
height: number;
|
|
1222
|
+
}>;
|
|
1223
|
+
}>;
|
|
1224
|
+
}>;
|
|
1225
|
+
independentInverters: Array<{
|
|
1226
|
+
id: string;
|
|
1227
|
+
name: string;
|
|
1228
|
+
points: Array<{
|
|
1229
|
+
lon: number;
|
|
1230
|
+
lat: number;
|
|
1231
|
+
height: number;
|
|
1232
|
+
}>;
|
|
1233
|
+
}>;
|
|
1234
|
+
};
|
|
1235
|
+
error?: string;
|
|
1236
|
+
};
|
|
1237
|
+
/**
|
|
1238
|
+
* 导出指定子阵及其内部组串的层级结构
|
|
1239
|
+
*
|
|
1240
|
+
* @param subarrayEntity - 要导出的子阵实体
|
|
1241
|
+
* @returns 导出结果,包含该子阵及其内部组串的层级结构
|
|
1242
|
+
*/
|
|
1243
|
+
exportSingleSubarrayHierarchy(subarrayEntity: any): {
|
|
1244
|
+
success: boolean;
|
|
1245
|
+
subarrayCount: number;
|
|
1246
|
+
inverterCount: number;
|
|
1247
|
+
hierarchy?: {
|
|
1248
|
+
subarrays: Array<{
|
|
1249
|
+
id: string;
|
|
1250
|
+
name: string;
|
|
1251
|
+
points: Array<{
|
|
1252
|
+
lon: number;
|
|
1253
|
+
lat: number;
|
|
1254
|
+
height: number;
|
|
1255
|
+
}>;
|
|
1256
|
+
inverters: Array<{
|
|
1257
|
+
id: string;
|
|
1258
|
+
name: string;
|
|
1259
|
+
points: Array<{
|
|
1260
|
+
lon: number;
|
|
1261
|
+
lat: number;
|
|
1262
|
+
height: number;
|
|
1263
|
+
}>;
|
|
1264
|
+
}>;
|
|
1265
|
+
}>;
|
|
1266
|
+
independentInverters: Array<any>;
|
|
1267
|
+
};
|
|
1268
|
+
error?: string;
|
|
1269
|
+
};
|
|
1270
|
+
/**
|
|
1271
|
+
* 导出指定组串的扁平结构
|
|
1272
|
+
*
|
|
1273
|
+
* @param inverterEntity - 要导出的组串实体
|
|
1274
|
+
* @returns 导出结果,包含该组串的扁平结构数据
|
|
1275
|
+
*/
|
|
1276
|
+
exportSingleInverter(inverterEntity: any): {
|
|
1277
|
+
success: boolean;
|
|
1278
|
+
data: {
|
|
1279
|
+
subarray: Array<any>;
|
|
1280
|
+
inverter: Array<{
|
|
1281
|
+
id: string;
|
|
1282
|
+
name: string;
|
|
1283
|
+
points: Array<{
|
|
1284
|
+
lon: number;
|
|
1285
|
+
lat: number;
|
|
1286
|
+
height: number;
|
|
1287
|
+
}>;
|
|
1288
|
+
}>;
|
|
1289
|
+
};
|
|
1290
|
+
error?: string;
|
|
1291
|
+
};
|
|
1292
|
+
/**
|
|
1293
|
+
* 从 JSON 数据批量创建多边形(层级结构)
|
|
1294
|
+
*
|
|
1295
|
+
* @param data - 层级结构的 JSON 数据
|
|
1296
|
+
* @param createPolygonFromPointsFn - 创建多边形的函数(由 CZMLManager 提供)
|
|
1297
|
+
* @returns 创建结果统计
|
|
1298
|
+
*/
|
|
1299
|
+
importPolygonsFromHierarchy(data: {
|
|
1300
|
+
subarrays: Array<{
|
|
1301
|
+
id: string;
|
|
1302
|
+
name: string;
|
|
1303
|
+
oldName?: string;
|
|
1304
|
+
points: Array<{
|
|
1305
|
+
lon: number;
|
|
1306
|
+
lat: number;
|
|
1307
|
+
height: number;
|
|
1308
|
+
}>;
|
|
1309
|
+
inverters: Array<{
|
|
1310
|
+
id: string;
|
|
1311
|
+
name: string;
|
|
1312
|
+
oldName?: string;
|
|
1313
|
+
points: Array<{
|
|
1314
|
+
lon: number;
|
|
1315
|
+
lat: number;
|
|
1316
|
+
height: number;
|
|
1317
|
+
}>;
|
|
1318
|
+
}>;
|
|
1319
|
+
}>;
|
|
1320
|
+
independentInverters: Array<{
|
|
1321
|
+
id: string;
|
|
1322
|
+
name: string;
|
|
1323
|
+
oldName?: string;
|
|
1324
|
+
points: Array<{
|
|
1325
|
+
lon: number;
|
|
1326
|
+
lat: number;
|
|
1327
|
+
height: number;
|
|
1328
|
+
}>;
|
|
1329
|
+
}>;
|
|
1330
|
+
}, createPolygonFromPointsFn: (params: {
|
|
1331
|
+
layerName: string;
|
|
1332
|
+
id: string;
|
|
1333
|
+
name: string;
|
|
1334
|
+
points: Array<{
|
|
1335
|
+
lon: number;
|
|
1336
|
+
lat: number;
|
|
1337
|
+
height: number;
|
|
1338
|
+
}>;
|
|
1339
|
+
}) => any): {
|
|
1340
|
+
success: boolean;
|
|
1341
|
+
subarrayCount: number;
|
|
1342
|
+
inverterCount: number;
|
|
1343
|
+
independentCount: number;
|
|
1344
|
+
errors: Array<{
|
|
1345
|
+
type: string;
|
|
1346
|
+
name: string;
|
|
1347
|
+
error: string;
|
|
1348
|
+
}>;
|
|
1349
|
+
};
|
|
1350
|
+
/**
|
|
1351
|
+
* 从 JSON 数据批量创建多边形(扁平结构)
|
|
1352
|
+
*
|
|
1353
|
+
* @param data - 扁平结构的 JSON 数据
|
|
1354
|
+
* @param createPolygonFromPointsFn - 创建多边形的函数(由 CZMLManager 提供)
|
|
1355
|
+
* @returns 创建结果统计
|
|
1356
|
+
*/
|
|
1357
|
+
importPolygonsFromFlatStructure(data: {
|
|
1358
|
+
subarray: Array<{
|
|
1359
|
+
id: string;
|
|
1360
|
+
name: string;
|
|
1361
|
+
points: Array<{
|
|
1362
|
+
lon: number;
|
|
1363
|
+
lat: number;
|
|
1364
|
+
height: number;
|
|
1365
|
+
}>;
|
|
1366
|
+
}>;
|
|
1367
|
+
inverter: Array<{
|
|
1368
|
+
id: string;
|
|
1369
|
+
name: string;
|
|
1370
|
+
points: Array<{
|
|
1371
|
+
lon: number;
|
|
1372
|
+
lat: number;
|
|
1373
|
+
height: number;
|
|
1374
|
+
}>;
|
|
1375
|
+
}>;
|
|
1376
|
+
}, createPolygonFromPointsFn: (params: {
|
|
1377
|
+
layerName: string;
|
|
1378
|
+
id: string;
|
|
1379
|
+
name: string;
|
|
1380
|
+
points: Array<{
|
|
1381
|
+
lon: number;
|
|
1382
|
+
lat: number;
|
|
1383
|
+
height: number;
|
|
1384
|
+
}>;
|
|
1385
|
+
}) => any): {
|
|
1386
|
+
success: boolean;
|
|
1387
|
+
subarrayCount: number;
|
|
1388
|
+
inverterCount: number;
|
|
1389
|
+
errors: Array<{
|
|
1390
|
+
type: string;
|
|
1391
|
+
name: string;
|
|
1392
|
+
error: string;
|
|
1393
|
+
}>;
|
|
1394
|
+
};
|
|
1395
|
+
/**
|
|
1396
|
+
* 更新多边形实体的类型、颜色和标签
|
|
1397
|
+
* @param entity 要更新的多边形实体
|
|
1398
|
+
* @param newType 新的类型 ('subarray' | 'inverter' | 'astrict' | 'rail' | 'feature')
|
|
1399
|
+
* @param customName 可选的自定义名称
|
|
1400
|
+
* @returns 更新结果
|
|
1401
|
+
*/
|
|
1402
|
+
updatePolygonTypeAndStyle(entity: Cesium.Entity, newType: string, customName?: string): {
|
|
1403
|
+
success: boolean;
|
|
1404
|
+
message: string;
|
|
1405
|
+
oldType?: string;
|
|
1406
|
+
newType?: string;
|
|
1407
|
+
oldName?: string;
|
|
1408
|
+
newName?: string;
|
|
1409
|
+
};
|
|
1410
|
+
/**
|
|
1411
|
+
* 开始圆形绘制
|
|
1412
|
+
* 用户流程:
|
|
1413
|
+
* 1. 左键点击确定圆心
|
|
1414
|
+
* 2. 移动鼠标动态调整半径
|
|
1415
|
+
* 3. 再次左键点击确定半径,完成绘制
|
|
1416
|
+
* 4. 或右键/ESC取消绘制
|
|
1417
|
+
*
|
|
1418
|
+
* @param layer 图层对象 (使用 'other' 类型的 DataSource)
|
|
1419
|
+
* @param onComplete 绘制完成回调函数
|
|
1420
|
+
* @returns 返回绘制会话对象,包含 stop() 方法
|
|
1421
|
+
*/
|
|
1422
|
+
startCircleDrawing(layer?: Cesium.CustomDataSource, onComplete?: (entity: Cesium.Entity) => void): {
|
|
1423
|
+
stop: () => void;
|
|
1424
|
+
};
|
|
1425
|
+
/**
|
|
1426
|
+
* 开始点标记绘制
|
|
1427
|
+
* 用户流程:
|
|
1428
|
+
* 1. 左键点击地图添加点标记
|
|
1429
|
+
* 2. 可连续点击添加多个点
|
|
1430
|
+
* 3. 右键或 ESC 结束绘制
|
|
1431
|
+
*
|
|
1432
|
+
* @param layer 图层对象 (使用 'other' 类型的 DataSource)
|
|
1433
|
+
* @param iconSvg SVG 图标的 data URL 或路径
|
|
1434
|
+
* @param onComplete 每次添加点时的回调函数(可选)
|
|
1435
|
+
* @returns 返回绘制会话对象,包含 stop() 方法
|
|
1436
|
+
*/
|
|
1437
|
+
startPointDrawing(layer?: Cesium.CustomDataSource, iconSvg?: string, onComplete?: (entity: Cesium.Entity) => void): {
|
|
1438
|
+
stop: () => void;
|
|
1439
|
+
};
|
|
1440
|
+
/**
|
|
1441
|
+
* 从 JSON 数据加载多边形、圆形和特征点到 other 图层
|
|
1442
|
+
* @param data JSON 数据,包含 astrict, rail, feature, feature_point 数组
|
|
1443
|
+
* @returns 加载结果统计
|
|
1444
|
+
*/
|
|
1445
|
+
loadOtherLayerFromJson(data: {
|
|
1446
|
+
astrict?: Array<any>;
|
|
1447
|
+
rail?: Array<any>;
|
|
1448
|
+
feature?: Array<any>;
|
|
1449
|
+
feature_point?: Array<any>;
|
|
1450
|
+
}): {
|
|
1451
|
+
success: boolean;
|
|
1452
|
+
message: string;
|
|
1453
|
+
stats: {
|
|
1454
|
+
astrict: number;
|
|
1455
|
+
rail: number;
|
|
1456
|
+
feature: number;
|
|
1457
|
+
feature_point: number;
|
|
1458
|
+
total: number;
|
|
1459
|
+
};
|
|
1460
|
+
};
|
|
1461
|
+
/**
|
|
1462
|
+
* 加载多边形实体 (复用代码)
|
|
1463
|
+
*/
|
|
1464
|
+
private loadPolygonEntity;
|
|
1465
|
+
/**
|
|
1466
|
+
* 加载圆形实体 (复用代码)
|
|
1467
|
+
* 圆形数据格式: points[0] 包含 {lon, lat, height, radius}
|
|
1468
|
+
*/
|
|
1469
|
+
private loadCircleEntity;
|
|
1470
|
+
/**
|
|
1471
|
+
* 加载特征点实体 (复用代码)
|
|
1472
|
+
*/
|
|
1473
|
+
private loadPointEntity;
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
interface SelectionChange<T = unknown> {
|
|
1477
|
+
current?: T;
|
|
1478
|
+
previous?: T;
|
|
1479
|
+
}
|
|
1480
|
+
interface EditingChange<T = unknown> {
|
|
1481
|
+
editing: boolean;
|
|
1482
|
+
target?: T;
|
|
1483
|
+
}
|
|
1484
|
+
interface PreviousViewChange {
|
|
1485
|
+
current?: CameraView;
|
|
1486
|
+
previous?: CameraView;
|
|
1487
|
+
}
|
|
1488
|
+
/**
|
|
1489
|
+
* Lightweight state manager for common UI states:
|
|
1490
|
+
* - selection (arbitrary payload)
|
|
1491
|
+
* - editing (boolean + optional target)
|
|
1492
|
+
* - previous camera view (for simple back navigation)
|
|
1493
|
+
*/
|
|
1494
|
+
declare class StateManager<TSelection = unknown, TEditingTarget = unknown> {
|
|
1495
|
+
private selected?;
|
|
1496
|
+
private editing;
|
|
1497
|
+
private editingTarget?;
|
|
1498
|
+
private previousView?;
|
|
1499
|
+
readonly onSelectionChange: Emitter<SelectionChange<TSelection>>;
|
|
1500
|
+
readonly onEditingChange: Emitter<EditingChange<TEditingTarget>>;
|
|
1501
|
+
readonly onPreviousViewChange: Emitter<PreviousViewChange>;
|
|
1502
|
+
setSelected(next?: TSelection): void;
|
|
1503
|
+
/**
|
|
1504
|
+
* 获取当前选中对象。
|
|
1505
|
+
* - 若未传入类型,直接返回当前选中对象。
|
|
1506
|
+
* - 若传入类型,则当且仅当选中对象的 `type` 字段与之匹配时返回,否则返回 undefined。
|
|
1507
|
+
*/
|
|
1508
|
+
getSelected(): TSelection | undefined;
|
|
1509
|
+
getSelected(type: 'line' | 'shape' | 'point' | 'unknown'): TSelection | undefined;
|
|
1510
|
+
clearSelected(): void;
|
|
1511
|
+
startEditing(target?: TEditingTarget): void;
|
|
1512
|
+
stopEditing(): void;
|
|
1513
|
+
toggleEditing(target?: TEditingTarget): void;
|
|
1514
|
+
isEditing(): boolean;
|
|
1515
|
+
getEditingTarget(): TEditingTarget | undefined;
|
|
1516
|
+
setPreviousCameraView(view?: CameraView): void;
|
|
1517
|
+
getPreviousCameraView(): CameraView | undefined;
|
|
1518
|
+
}
|
|
1519
|
+
declare const globalState: StateManager<any, any>;
|
|
1520
|
+
|
|
1521
|
+
type Viewer = Cesium.Viewer;
|
|
1522
|
+
interface SelectionResult {
|
|
1523
|
+
/** 世界坐标(Cartesian3)。若拾取失败则为 undefined */
|
|
1524
|
+
position?: any;
|
|
1525
|
+
/** 被选中的实体(如果有的话) */
|
|
1526
|
+
entity?: Cesium.Entity;
|
|
1527
|
+
}
|
|
1528
|
+
interface SelectionSession {
|
|
1529
|
+
/** 停止选择(移除事件、恢复光标等) */
|
|
1530
|
+
stop: () => void;
|
|
1531
|
+
}
|
|
1532
|
+
/**
|
|
1533
|
+
* 选择器:提供点击场景返回坐标点与选中的 entity(如果有)的能力。
|
|
1534
|
+
*/
|
|
1535
|
+
declare class Selector {
|
|
1536
|
+
private CesiumNS;
|
|
1537
|
+
private viewer;
|
|
1538
|
+
private state?;
|
|
1539
|
+
private handler?;
|
|
1540
|
+
constructor(CesiumNS: typeof Cesium, viewer: Viewer, state?: StateManager<any, any> | undefined);
|
|
1541
|
+
/**
|
|
1542
|
+
* 从鼠标事件解析世界坐标。
|
|
1543
|
+
*/
|
|
1544
|
+
private getPositionFromMouse;
|
|
1545
|
+
/**
|
|
1546
|
+
* 在窗口坐标处进行一次拾取,返回坐标与实体。
|
|
1547
|
+
*/
|
|
1548
|
+
pickAt(windowPosition: {
|
|
1549
|
+
x: number;
|
|
1550
|
+
y: number;
|
|
1551
|
+
}): SelectionResult;
|
|
1552
|
+
/**
|
|
1553
|
+
* 开启点击选择会话。左键点击触发回调,返回坐标与实体。
|
|
1554
|
+
* @param onSelect 回调函数,参数为 { position, entity }
|
|
1555
|
+
* @param options 可选项:{ cursor?: string }
|
|
1556
|
+
*/
|
|
1557
|
+
startSelecting(onSelect: (result: SelectionResult) => void, options?: {
|
|
1558
|
+
cursor?: string;
|
|
1559
|
+
}): SelectionSession;
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
interface FOVControllerOptions {
|
|
1563
|
+
/** 初始 FOV 值(度) */
|
|
1564
|
+
initialFOV?: number;
|
|
1565
|
+
/** 最小 FOV 值(度),对应长焦 */
|
|
1566
|
+
minFOV?: number;
|
|
1567
|
+
/** 最大 FOV 值(度),对应广角 */
|
|
1568
|
+
maxFOV?: number;
|
|
1569
|
+
/** UI 容器元素,如果不提供则自动创建 */
|
|
1570
|
+
container?: HTMLElement;
|
|
1571
|
+
/** 是否显示焦距刻度标签 */
|
|
1572
|
+
showLabels?: boolean;
|
|
1573
|
+
/** 预设焦距档位(焦距值数组,mm) */
|
|
1574
|
+
focalLengthPresets?: number[];
|
|
1575
|
+
/** 传感器宽度(mm),用于计算焦距,默认 35mm 全画幅 */
|
|
1576
|
+
sensorWidth?: number;
|
|
1577
|
+
/** 是否使用全局事件总线,默认 true */
|
|
1578
|
+
useGlobalEventBus?: boolean;
|
|
1579
|
+
/** 滑块容器高度(px),默认 300 */
|
|
1580
|
+
sliderHeight?: number;
|
|
1581
|
+
}
|
|
1582
|
+
interface FOVChangeEvent {
|
|
1583
|
+
/** 当前 FOV 值(度) */
|
|
1584
|
+
fov: number;
|
|
1585
|
+
/** 等效焦距(mm) */
|
|
1586
|
+
focalLength: number;
|
|
1587
|
+
}
|
|
1588
|
+
/**
|
|
1589
|
+
* 相机 FOV(视场角)控制器
|
|
1590
|
+
* 提供焦距滑块控制,模拟镜头焦距变化(14mm 广角 到 200mm 长焦)
|
|
1591
|
+
* 通过全局事件总线与 PathPreview 和 FrustumPyramid 通信
|
|
1592
|
+
*/
|
|
1593
|
+
declare class CameraFOVController {
|
|
1594
|
+
private opts;
|
|
1595
|
+
private containerEl?;
|
|
1596
|
+
private sliderEl?;
|
|
1597
|
+
private labelEl?;
|
|
1598
|
+
private destroyed;
|
|
1599
|
+
private useGlobalEventBus;
|
|
1600
|
+
onFOVChange: Emitter<FOVChangeEvent>;
|
|
1601
|
+
private minFOV;
|
|
1602
|
+
private maxFOV;
|
|
1603
|
+
private currentFOV;
|
|
1604
|
+
private sensorWidth;
|
|
1605
|
+
private focalLengthPresets;
|
|
1606
|
+
constructor(opts?: FOVControllerOptions);
|
|
1607
|
+
/**
|
|
1608
|
+
* 变焦倍数转换为 FOV(度)- 直接计算版本
|
|
1609
|
+
*/
|
|
1610
|
+
private zoomMultiplierToFOVDirect;
|
|
1611
|
+
/**
|
|
1612
|
+
* 创建 UI 控件
|
|
1613
|
+
*/
|
|
1614
|
+
private createUI;
|
|
1615
|
+
/**
|
|
1616
|
+
* 滑块变化处理
|
|
1617
|
+
*/
|
|
1618
|
+
private handleSliderChange;
|
|
1619
|
+
/**
|
|
1620
|
+
* 根据索引插值计算变焦倍数
|
|
1621
|
+
*/
|
|
1622
|
+
private interpolateZoomMultiplier;
|
|
1623
|
+
/**
|
|
1624
|
+
* 根据变焦倍数计算对应的索引(可以是小数)
|
|
1625
|
+
*/
|
|
1626
|
+
private getZoomMultiplierIndex;
|
|
1627
|
+
/**
|
|
1628
|
+
* 根据 FOV 找到最接近的预设索引(可以是小数)
|
|
1629
|
+
*/
|
|
1630
|
+
private getClosestPresetIndex;
|
|
1631
|
+
/**
|
|
1632
|
+
* 更新显示
|
|
1633
|
+
*/
|
|
1634
|
+
private updateDisplay;
|
|
1635
|
+
/**
|
|
1636
|
+
* 发射 FOV 变化事件
|
|
1637
|
+
*/
|
|
1638
|
+
private emitChange;
|
|
1639
|
+
/**
|
|
1640
|
+
* FOV 转换为等效焦距(mm)
|
|
1641
|
+
* 公式: f = (sensor_width / 2) / tan(fov / 2)
|
|
1642
|
+
*/
|
|
1643
|
+
private fovToFocalLength;
|
|
1644
|
+
/**
|
|
1645
|
+
* 焦距转换为 FOV(度)
|
|
1646
|
+
* 公式: fov = 2 * atan(sensor_width / (2 * f))
|
|
1647
|
+
*/
|
|
1648
|
+
private focalLengthToFOV;
|
|
1649
|
+
/**
|
|
1650
|
+
* 变焦倍数转换为 FOV(度)
|
|
1651
|
+
*/
|
|
1652
|
+
private zoomMultiplierToFOV;
|
|
1653
|
+
/**
|
|
1654
|
+
* 设置焦距(mm)
|
|
1655
|
+
*/
|
|
1656
|
+
setFocalLength(focalLengthMm: number): void;
|
|
1657
|
+
/**
|
|
1658
|
+
* 设置变焦倍数
|
|
1659
|
+
*/
|
|
1660
|
+
setZoomMultiplier(zoomMultiplier: number): void;
|
|
1661
|
+
/**
|
|
1662
|
+
* 设置 FOV(度)
|
|
1663
|
+
*/
|
|
1664
|
+
setFOV(fovDeg: number): void;
|
|
1665
|
+
/**
|
|
1666
|
+
* 获取当前 FOV
|
|
1667
|
+
*/
|
|
1668
|
+
getFOV(): number;
|
|
1669
|
+
/**
|
|
1670
|
+
* 获取当前焦距
|
|
1671
|
+
*/
|
|
1672
|
+
getFocalLength(): number;
|
|
1673
|
+
/**
|
|
1674
|
+
* 显示控制器
|
|
1675
|
+
*/
|
|
1676
|
+
show(): void;
|
|
1677
|
+
/**
|
|
1678
|
+
* 隐藏控制器
|
|
1679
|
+
*/
|
|
1680
|
+
hide(): void;
|
|
1681
|
+
/**
|
|
1682
|
+
* 销毁控制器
|
|
1683
|
+
*/
|
|
1684
|
+
destroy(): void;
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
/**
|
|
1688
|
+
* 视锥体/金字塔可视化工具
|
|
1689
|
+
* - 用多段线与多边形在 Cesium 中绘制一个“相机视锥体”样式的方锥体
|
|
1690
|
+
* - 支持静态一次性绘制(showAt)与基于 CallbackProperty 的动态绘制(showAtDynamic)
|
|
1691
|
+
* - 几何计算集中在 computeFrustumGeometry,避免重复代码
|
|
1692
|
+
*/
|
|
1693
|
+
|
|
1694
|
+
interface FrustumPyramidOptions {
|
|
1695
|
+
/** 顶点到底面中心的距离(米) */
|
|
1696
|
+
length?: number;
|
|
1697
|
+
/** 水平视场角(度,整角) */
|
|
1698
|
+
fov?: number;
|
|
1699
|
+
/** 底面宽高比(width:height),默认 4:3 模拟相机画幅 */
|
|
1700
|
+
aspectRatio?: number;
|
|
1701
|
+
/** 边线颜色 */
|
|
1702
|
+
color?: Cesium.Color;
|
|
1703
|
+
/** 面填充颜色(alpha 由 fillAlpha 决定或自身附带) */
|
|
1704
|
+
fillColor?: Cesium.Color;
|
|
1705
|
+
/** 面透明度 [0..1],默认 0.25 */
|
|
1706
|
+
fillAlpha?: number;
|
|
1707
|
+
/** 边线宽度(像素) */
|
|
1708
|
+
width?: number;
|
|
1709
|
+
/** 是否打印上下左右半视场角(度)变化日志(默认关闭) */
|
|
1710
|
+
logAngles?: boolean;
|
|
1711
|
+
/** 日志节流间隔(毫秒),仅在 logAngles=true 时生效,默认 250ms */
|
|
1712
|
+
logThrottleMs?: number;
|
|
1713
|
+
}
|
|
1714
|
+
/**
|
|
1715
|
+
* 在给定姿态处渲染一个方锥体视锥(边线 + 面填充 + 垂直箭头)
|
|
1716
|
+
* - 通过 Entity 层级维护几何,支持重复更新与清理
|
|
1717
|
+
*/
|
|
1718
|
+
declare class FrustumPyramid {
|
|
1719
|
+
private CesiumNS;
|
|
1720
|
+
private layer;
|
|
1721
|
+
private opts;
|
|
1722
|
+
/** 4 条边线实体(apex->四个角) */
|
|
1723
|
+
private edgeEntities;
|
|
1724
|
+
/** 底面填充多边形实体(可选显示) */
|
|
1725
|
+
private baseFillEntity?;
|
|
1726
|
+
/** 4 个侧面三角形实体(apex->ci->c(i+1)) */
|
|
1727
|
+
private faceEntities;
|
|
1728
|
+
/** 顶点到底面中心的垂直“箭头线”(用于指示方向/深度) */
|
|
1729
|
+
private verticalLineEntity?;
|
|
1730
|
+
private destroyed;
|
|
1731
|
+
/** 上次记录的半视场角(度),用于判定变化 */
|
|
1732
|
+
private lastAngles?;
|
|
1733
|
+
/** 上次打印日志的时间戳(ms) */
|
|
1734
|
+
private lastLogAt;
|
|
1735
|
+
constructor(CesiumNS: typeof Cesium, layer: Cesium.CustomDataSource, opts?: FrustumPyramidOptions);
|
|
1736
|
+
/**
|
|
1737
|
+
* 计算视锥体几何(顶点、四个底面角点与底面中心)
|
|
1738
|
+
* - 先根据 HPR 在 apex 处构造模型矩阵,取 forward(列1)方向
|
|
1739
|
+
* - 用 apex 的地表法线作为世界 up,重建无滚转的 right/up,从而避免 pitch 时的视觉侧倾
|
|
1740
|
+
* - 基于 fov 与 aspectRatio 求得底面半宽半高,沿 forward 推进 length 得到 baseCenter
|
|
1741
|
+
*/
|
|
1742
|
+
private computeFrustumGeometry;
|
|
1743
|
+
/**
|
|
1744
|
+
* 若启用日志,则在“左右/上下对应的世界角度”变化时打印一条日志。
|
|
1745
|
+
* - 左右角度:以 heading 为中心的 ±(FOV/2)
|
|
1746
|
+
* - 上下角度:以 pitch 为中心的 ±(verticalHalfFov)
|
|
1747
|
+
* - 采用节流与变化判定:小于 logThrottleMs 的间隔或角度未变时不重复打印
|
|
1748
|
+
*/
|
|
1749
|
+
private logAnglesIfChanged;
|
|
1750
|
+
/**
|
|
1751
|
+
* 确保实体已创建:
|
|
1752
|
+
* - 4 条边线、4 个侧面三角形、1 个底面填充、多一条垂直箭头线
|
|
1753
|
+
* - 若已存在则直接返回,避免重复创建
|
|
1754
|
+
*/
|
|
1755
|
+
private ensureEntities;
|
|
1756
|
+
/**
|
|
1757
|
+
* 静态更新:在给定姿态一次性计算并更新几何
|
|
1758
|
+
* - 适合低频率更新或仅渲染一次的场景
|
|
1759
|
+
*/
|
|
1760
|
+
showAt(apex: Cesium.Cartesian3, headingDeg: number, pitchDeg?: number, rollDeg?: number, fovDeg?: number, lengthOverride?: number): void;
|
|
1761
|
+
/**
|
|
1762
|
+
* 动态更新:通过回调获取实时姿态,由 Cesium 在每帧调用 CallbackProperty 自动评估
|
|
1763
|
+
* - 适合高频率变化(相机/游标联动)
|
|
1764
|
+
*/
|
|
1765
|
+
showAtDynamic(apexCallback: () => Cesium.Cartesian3, headingDegCallback: () => number, pitchDegCallback: () => number, rollDegCallback: () => number, fovDegCallback: () => number, lengthCallback: () => number): void;
|
|
1766
|
+
/**
|
|
1767
|
+
* 销毁:移除所有已创建的实体并释放引用
|
|
1768
|
+
* - 与 clear 的区别:destroy 彻底删除实体;clear 仅隐藏/清空坐标以复用
|
|
1769
|
+
*/
|
|
1770
|
+
destroy(): void;
|
|
1771
|
+
/**
|
|
1772
|
+
* 清理:隐藏几何但不销毁实例(保留复用能力)
|
|
1773
|
+
*/
|
|
1774
|
+
clear(): void;
|
|
1775
|
+
}
|
|
1776
|
+
|
|
1777
|
+
/**
|
|
1778
|
+
* 🆕 快速编辑模式配置选项
|
|
1779
|
+
*/
|
|
1780
|
+
interface QuickEditOptions {
|
|
1781
|
+
/** 是否启用(默认 false) */
|
|
1782
|
+
enabled?: boolean;
|
|
1783
|
+
/** 新顶点的默认爬升高度(米) */
|
|
1784
|
+
climbHeight?: number;
|
|
1785
|
+
/** 高度模式 */
|
|
1786
|
+
altitudeMode?: 'absolute' | 'relativeToStart' | 'relativeToGround';
|
|
1787
|
+
}
|
|
1788
|
+
|
|
1789
|
+
/**
|
|
1790
|
+
* Path 编辑保存结果数据接口
|
|
1791
|
+
* 对应 pathEditing.ts 中 saveAndStop() 返回的数据结构
|
|
1792
|
+
*/
|
|
1793
|
+
interface PathEditingSaveResult {
|
|
1794
|
+
entity: Cesium.Entity;
|
|
1795
|
+
positions: Cesium.Cartesian3[];
|
|
1796
|
+
startPoint: {
|
|
1797
|
+
position: Cesium.Cartesian3;
|
|
1798
|
+
};
|
|
1799
|
+
climbHeight?: number;
|
|
1800
|
+
waypointData: Array<{
|
|
1801
|
+
position: Cesium.Cartesian3;
|
|
1802
|
+
heading: number;
|
|
1803
|
+
pitch: number;
|
|
1804
|
+
roll: number;
|
|
1805
|
+
fov: number;
|
|
1806
|
+
index: number;
|
|
1807
|
+
distance: number;
|
|
1808
|
+
}>;
|
|
1809
|
+
altitudeMode?: string;
|
|
1810
|
+
hasHiddenClimb?: boolean;
|
|
1811
|
+
}
|
|
1812
|
+
/**
|
|
1813
|
+
* Path 到 Sinofly 转换选项
|
|
1814
|
+
*/
|
|
1815
|
+
interface PathToSinoflyOptions {
|
|
1816
|
+
CesiumNS: typeof Cesium;
|
|
1817
|
+
waylineId: number | string;
|
|
1818
|
+
waylineName?: string;
|
|
1819
|
+
waylineType?: number;
|
|
1820
|
+
waylineVersion?: string;
|
|
1821
|
+
source?: number;
|
|
1822
|
+
heightType?: string;
|
|
1823
|
+
droneModelKey?: number | string;
|
|
1824
|
+
relativeHeight?: number;
|
|
1825
|
+
autoFlightSpeed?: number;
|
|
1826
|
+
globalRthHeight?: number;
|
|
1827
|
+
fileId?: number | string;
|
|
1828
|
+
fileMd5?: string;
|
|
1829
|
+
duration?: number;
|
|
1830
|
+
photoNumber?: number;
|
|
1831
|
+
thumbnailFileId?: number;
|
|
1832
|
+
stationId?: number;
|
|
1833
|
+
subarrayId?: number;
|
|
1834
|
+
stationName?: string;
|
|
1835
|
+
subarrayName?: string;
|
|
1836
|
+
createUserId?: string;
|
|
1837
|
+
createTime?: string;
|
|
1838
|
+
modifyUserId?: string;
|
|
1839
|
+
modifyTime?: string;
|
|
1840
|
+
/** 航点的 noReturn 值,默认 0 */
|
|
1841
|
+
defaultNoReturn?: number;
|
|
1842
|
+
/** 航点的 createUserId,如果提供则应用到所有航点 */
|
|
1843
|
+
waypointCreateUserId?: string;
|
|
1844
|
+
/** 航点的 createTime,如果提供则应用到所有航点 */
|
|
1845
|
+
waypointCreateTime?: string;
|
|
1846
|
+
/** 航点的 modifyUserId,如果提供则应用到所有航点 */
|
|
1847
|
+
waypointModifyUserId?: string;
|
|
1848
|
+
/** 航点的 modifyTime,如果提供则应用到所有航点 */
|
|
1849
|
+
waypointModifyTime?: string;
|
|
1850
|
+
}
|
|
1851
|
+
/**
|
|
1852
|
+
* 将 Path 编辑保存结果转换为 Sinofly 航线路数据格式
|
|
1853
|
+
*
|
|
1854
|
+
* @param data Path 编辑保存结果数据
|
|
1855
|
+
* @param options 转换选项
|
|
1856
|
+
* @returns Sinofly 航线路数据
|
|
1857
|
+
*
|
|
1858
|
+
* @example
|
|
1859
|
+
* ```typescript
|
|
1860
|
+
* import * as Cesium from 'cesium';
|
|
1861
|
+
* import { convertPathToSinofly } from '@jorgmoritz/gis-manager';
|
|
1862
|
+
*
|
|
1863
|
+
* const editSession = startPathEditing(Cesium, viewer, entity, {
|
|
1864
|
+
* onVertexSelectDetail: (info) => console.log(info)
|
|
1865
|
+
* });
|
|
1866
|
+
*
|
|
1867
|
+
* // 编辑完成后保存
|
|
1868
|
+
* const saveResult = editSession.saveAndStop();
|
|
1869
|
+
*
|
|
1870
|
+
* // 转换为 Sinofly 格式
|
|
1871
|
+
* const sinoflyData = convertPathToSinofly(saveResult, {
|
|
1872
|
+
* CesiumNS: Cesium,
|
|
1873
|
+
* waylineId: 12345,
|
|
1874
|
+
* waylineName: '测试航线',
|
|
1875
|
+
* takeOffSecurityHeight: saveResult.climbHeight ?? 50,
|
|
1876
|
+
* });
|
|
1877
|
+
*
|
|
1878
|
+
* // 发送到 Sinofly 服务器
|
|
1879
|
+
* await fetch('/api/waylines', {
|
|
1880
|
+
* method: 'POST',
|
|
1881
|
+
* body: JSON.stringify(sinoflyData)
|
|
1882
|
+
* });
|
|
1883
|
+
* ```
|
|
1884
|
+
*/
|
|
1885
|
+
declare function convertPathToSinofly(data: PathEditingSaveResult, options: PathToSinoflyOptions): SinoflyWaylineData;
|
|
1886
|
+
|
|
1887
|
+
declare const placeholder: {
|
|
1888
|
+
ready: boolean;
|
|
1889
|
+
};
|
|
1890
|
+
|
|
1891
|
+
export { CZMLManager, type CameraDestinationInput, CameraEventBus, type CameraFOVChangeEvent, CameraFOVController, type CameraFlyOptions, type CameraInitOptions, CameraManager, type CameraOrientation, type CameraPoseChangeEvent, type CameraSetViewOptions, type CameraView, type CesiumAssetsOptions, type ConvertedWaylineData, type ConvertedWaypointData, type CzmlExportOptions, type CzmlImportOptions, type EditingChange, Emitter, type FOVChangeEvent, type FOVControllerOptions, type FlyToOptions, FrustumPyramid, type FrustumPyramidOptions, type FrustumShapeChangeEvent, type ImageryOptions, type ImageryProviderKind, type InitOptions, type LayerEvents, type LayerHandle, LayerManager, type LayerType, type Listener, type LonLatHeight, type Orientation, type PathEditingSaveResult, type PathOptions, type PathToSinoflyOptions, type PhotoBillboardItem, type PhotoBillboardLayerOptions, type PhotoBillboardResult, type PolygonDrawingOptions, type PolygonEditingSession, PolygonEditor, type PreviousViewChange, type QuickEditOptions, SceneManager, type SceneOptions, type SelectionChange, type SelectionResult, type SelectionSession, Selector, type ShapeLineProps, type ShapePointProps, type ShapePolygonProps, type SinoflyAdapterOptions, type SinoflyWaylineData, type SinoflyWaypointInfo, StateManager, type TerrainKind, type TerrainOptions, type Toggle2D3DContext, type Toggle2D3DOptions, type VersionInfo, assertCesiumAssetsConfigured, configureCesiumAssets, configureCesiumIonToken, convertPathToSinofly, convertSinoflyWayline, convertSinoflyWaylines, ensureCesiumIonToken, getCesiumBaseUrl, getCesiumIonToken, globalCameraEventBus, globalState, placeholder, toggle2D3D, version, versionInfo };
|