@xingm/vmap-cesium-toolbar 0.0.1 → 0.0.2-alpha.10

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.
Files changed (45) hide show
  1. package/dist/hooks/toolBarConfig.d.ts +6 -3
  2. package/dist/hooks/useDrawHelper.d.ts +65 -0
  3. package/dist/hooks/useHeatmapHelper.d.ts +34 -0
  4. package/dist/hooks/useOverlayHelper.d.ts +212 -0
  5. package/dist/index.d.ts +664 -36
  6. package/dist/index.js +5078 -1840
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.umd.js +215 -128
  9. package/dist/index.umd.js.map +1 -1
  10. package/dist/libs/CesiumHeatmapLayer.d.ts +109 -0
  11. package/dist/libs/{CesiumMapHelper.d.ts → CesiumMapDraw.d.ts} +34 -51
  12. package/dist/libs/CesiumMapLoader.d.ts +11 -2
  13. package/dist/libs/CesiumMapModel.d.ts +5 -2
  14. package/dist/libs/CesiumMapToolbar.d.ts +23 -67
  15. package/dist/libs/CesiumOverlayService.d.ts +117 -0
  16. package/dist/libs/{CesiumMapConfig.d.ts → config/CesiumMapConfig.d.ts} +3 -3
  17. package/dist/libs/drawHelper/BaseDraw.d.ts +170 -0
  18. package/dist/libs/drawHelper/DrawCircle.d.ts +30 -0
  19. package/dist/libs/drawHelper/DrawLine.d.ts +44 -0
  20. package/dist/libs/drawHelper/DrawPolgon.d.ts +29 -0
  21. package/dist/libs/drawHelper/DrawRectangle.d.ts +24 -0
  22. package/dist/libs/drawHelper/index.d.ts +5 -0
  23. package/dist/libs/overlay/MapCircle.d.ts +64 -0
  24. package/dist/libs/overlay/MapIcon.d.ts +59 -0
  25. package/dist/libs/overlay/MapInfoWindow.d.ts +100 -0
  26. package/dist/libs/overlay/MapLabel.d.ts +63 -0
  27. package/dist/libs/overlay/MapMarker.d.ts +50 -0
  28. package/dist/libs/overlay/MapPolygon.d.ts +70 -0
  29. package/dist/libs/overlay/MapPolyline.d.ts +50 -0
  30. package/dist/libs/overlay/MapRectangle.d.ts +56 -0
  31. package/dist/libs/overlay/MapRing.d.ts +95 -0
  32. package/dist/libs/overlay/MapSVG.d.ts +63 -0
  33. package/dist/libs/overlay/index.d.ts +22 -0
  34. package/dist/libs/overlay/types.d.ts +41 -0
  35. package/dist/libs/toolBar/CesiumMapController.d.ts +78 -0
  36. package/dist/libs/toolBar/MapLayersService.d.ts +67 -0
  37. package/dist/libs/toolBar/MapSearchService.d.ts +41 -0
  38. package/dist/libs/toolBar/MapToolBarConfig.d.ts +3 -0
  39. package/dist/libs/toolBar/MeasurementService.d.ts +16 -0
  40. package/dist/libs/toolBar/NotFlyZonesService.d.ts +46 -0
  41. package/dist/package.json +5 -5
  42. package/dist/utils/calc.d.ts +44 -0
  43. package/dist/utils/common.d.ts +1 -0
  44. package/dist/z.const.d.ts +24 -0
  45. package/package.json +7 -7
package/dist/index.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  // VMap Cesium Toolbar Plugin Type Definitions
2
2
 
3
- import type { Viewer, Cartesian3, Cartographic } from 'cesium';
3
+ import type * as Cesium from 'cesium';
4
+ import type { Viewer, Cartesian3, Entity, Color } from 'cesium';
4
5
 
5
- // 工具栏配置接口
6
+ // 工具栏配置接口(与 CesiumMapModel.ts 保持一致)
6
7
  export interface ToolbarConfig {
7
8
  position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
8
9
  buttonSize?: number;
@@ -13,23 +14,55 @@ export interface ToolbarConfig {
13
14
  borderWidth?: number;
14
15
  boxShadow?: string;
15
16
  zIndex?: number;
17
+ buttons?: CustomButtonConfig[];
16
18
  }
17
19
 
18
- // 按钮配置接口
20
+ // 按钮配置接口(内部默认按钮配置使用)
19
21
  export interface ButtonConfig {
22
+ sort?: number;
20
23
  id: string;
21
24
  icon: string;
22
25
  title: string;
23
26
  size?: number;
24
27
  color?: string;
28
+ borderColor?: string;
29
+ borderWidth?: number;
30
+ borderStyle?: string;
25
31
  hoverColor?: string;
26
32
  activeColor?: string;
33
+ backgroundColor?: string;
34
+ callback?: () => void;
35
+ activeIcon?: string | HTMLElement;
36
+ }
37
+
38
+ // 自定义按钮配置接口(对外主要使用)
39
+ export interface CustomButtonConfig {
40
+ id: string;
41
+ icon: string | HTMLElement | false;
42
+ title: string;
43
+ enabled?: boolean;
44
+ visible?: boolean;
45
+ size?: number;
46
+ color?: string;
47
+ borderColor?: string;
48
+ borderWidth?: number;
49
+ borderStyle?: string;
50
+ padding?: string;
51
+ hoverColor?: string;
52
+ activeColor?: string;
53
+ backgroundColor?: string;
54
+ sort?: number;
55
+ activeIcon?: string | HTMLElement | false;
56
+ callback?: () => void;
57
+ onClick?: (buttonId: string, buttonElement: HTMLElement) => void;
27
58
  }
28
59
 
29
60
  // 搜索回调接口
30
61
  export interface SearchCallback {
31
62
  onSearch?: (query: string) => Promise<SearchResult[]>;
32
63
  onSelect?: (result: SearchResult) => void;
64
+ onSearchInput?: (query: string, container: HTMLElement) => void;
65
+ onSearchResults?: (results: SearchResult[], container: HTMLElement) => void;
33
66
  }
34
67
 
35
68
  // 搜索结果接口
@@ -43,6 +76,7 @@ export interface SearchResult {
43
76
 
44
77
  // 测量回调接口
45
78
  export interface MeasurementCallback {
79
+ onMeasurementStart?: (positions?: Cartesian3[]) => void;
46
80
  onDistanceComplete?: (positions: Cartesian3[], distance: number) => void;
47
81
  onAreaComplete?: (positions: Cartesian3[], area: number) => void;
48
82
  onClear?: () => void;
@@ -50,8 +84,8 @@ export interface MeasurementCallback {
50
84
 
51
85
  // 缩放回调接口
52
86
  export interface ZoomCallback {
53
- onZoomIn?: (beforeLevel: number, afterLevel: number) => void;
54
- onZoomOut?: (beforeLevel: number, afterLevel: number) => void;
87
+ onZoomIn?: (beforeHeight: number, afterHeight: number, currentLevel: number) => void;
88
+ onZoomOut?: (beforeHeight: number, afterHeight: number, currentLevel: number) => void;
55
89
  }
56
90
 
57
91
  // 地图类型接口
@@ -59,7 +93,9 @@ export interface MapType {
59
93
  id: string;
60
94
  name: string;
61
95
  thumbnail: string;
62
- provider: any; // Cesium.ImageryProvider
96
+ provider: (token: string) => Cesium.ImageryProvider[];
97
+ terrainProvider?: (token: string) => Cesium.TerrainProvider | null;
98
+ geoWTFS?: (token: string, viewer: Cesium.Viewer) => any | null;
63
99
  }
64
100
 
65
101
  // 视锥体选项接口
@@ -76,17 +112,37 @@ export interface FrustumOptions {
76
112
  }
77
113
 
78
114
  // 覆盖物选项接口
115
+ // 覆盖物选项(与 CesiumMapModel.ts 保持一致)
79
116
  export interface OverlayOptions {
80
117
  position: Cartesian3;
81
118
  type: 'point' | 'label' | 'billboard' | 'model' | 'cylinder';
82
- text?: string;
83
- image?: string;
84
- model?: string;
85
- color?: any; // Cesium.Color
86
- scale?: number;
87
- height?: number;
88
- width?: number;
89
- heightReference?: any; // Cesium.HeightReference
119
+ point?: {
120
+ pixelSize?: number;
121
+ color?: Color;
122
+ outlineColor?: Color;
123
+ outlineWidth?: number;
124
+ };
125
+ label?: {
126
+ text: string;
127
+ font?: string;
128
+ fillColor?: Color;
129
+ outlineColor?: Color;
130
+ outlineWidth?: number;
131
+ };
132
+ billboard?: {
133
+ image: string;
134
+ scale?: number;
135
+ };
136
+ model?: {
137
+ uri: string;
138
+ scale?: number;
139
+ };
140
+ cylinder?: {
141
+ length: number;
142
+ topRadius: number;
143
+ bottomRadius: number;
144
+ material?: Color;
145
+ };
90
146
  }
91
147
 
92
148
  // 地图中心点接口
@@ -100,14 +156,13 @@ export interface MapCenter {
100
156
 
101
157
  // 初始化选项接口
102
158
  export interface InitOptions {
103
- token?: string;
104
- terrain?: any; // Cesium.Terrain
105
- terrainProvider?: any; // Cesium.TerrainProvider
159
+ terrain?: Cesium.Terrain;
160
+ terrainProvider?: Cesium.TerrainProvider;
106
161
  mapType?: string;
107
- imageryProvider?: any; // Cesium.UrlTemplateImageryProvider
108
- imageryLayers?: any; // Cesium.ImageryLayerCollection
109
- terrainShadows?: any; // Cesium.ShadowMode
110
- contextOptions?: any; // Cesium.ContextOptions
162
+ imageryProvider?: Cesium.UrlTemplateImageryProvider;
163
+ imageryLayers?: Cesium.ImageryLayerCollection;
164
+ terrainShadows?: Cesium.ShadowMode;
165
+ contextOptions?: Cesium.ContextOptions;
111
166
  scene3DOnly?: boolean;
112
167
  selectionIndicator?: boolean;
113
168
  navigationHelpButton?: boolean;
@@ -115,27 +170,37 @@ export interface InitOptions {
115
170
  geocoder?: boolean;
116
171
  homeButton?: boolean;
117
172
  infoBox?: boolean;
173
+ vrButton?: boolean;
118
174
  sceneModePicker?: boolean;
119
- baseLayerPicker?: boolean;
120
175
  timeline?: boolean;
121
176
  animation?: boolean;
122
- clock?: any; // Cesium.Clock
177
+ isFly?: boolean;
178
+ flyDuration?: number;
179
+ baseLayerPicker?: boolean;
123
180
  navigationInstructionsInitiallyVisible?: boolean;
124
- sceneMode?: any; // Cesium.SceneMode
125
- screenSpaceEventHandler?: any; // Cesium.ScreenSpaceEventHandler
181
+ clock?: Cesium.Clock;
182
+ sceneMode?: Cesium.SceneMode;
183
+ screenSpaceEventHandler?: Cesium.ScreenSpaceEventHandler;
126
184
  useDefaultRenderLoop?: boolean;
127
185
  targetFrameRate?: number;
128
186
  showRenderLoopErrors?: boolean;
129
187
  automaticallyTrackDataSourceClocks?: boolean;
130
- dataSources?: any; // Cesium.DataSourceCollection
188
+ dataSources?: Cesium.DataSourceCollection;
131
189
  creationTime?: number;
132
190
  useBrowserRecommendedResolution?: boolean;
133
191
  resolutionScale?: number;
134
192
  orderIndependentTransparency?: boolean;
135
193
  shadows?: boolean;
194
+ depthTestAgainstTerrain?: boolean;
136
195
  terrainExaggeration?: number;
137
196
  maximumScreenSpaceError?: number;
138
197
  maximumNumberOfLoadedTiles?: number;
198
+ requestRenderMode?: boolean;
199
+ token?: string;
200
+ cesiumToken?: string;
201
+ success?: () => void;
202
+ cancel?: () => void;
203
+ mapCenter?: MapCenter;
139
204
  }
140
205
 
141
206
  // 主要类声明
@@ -156,6 +221,16 @@ export declare class CesiumMapToolbar {
156
221
  setInitialCenter(center: { longitude: number; latitude: number; height: number }): void;
157
222
  getInitialCenter(): { longitude: number; latitude: number; height: number } | undefined;
158
223
  resetToInitialLocation(): void;
224
+ /** 当前测量模式:none / distance / area */
225
+ readonly measurement: {
226
+ getMeasureMode: () => 'none' | 'distance' | 'area';
227
+ };
228
+ /** 更新内置或自定义按钮配置 */
229
+ updateButtonConfig(buttonId: string, config: Partial<CustomButtonConfig>): void;
230
+ /** 添加或替换自定义按钮 */
231
+ addCustomButton(config: CustomButtonConfig): void;
232
+ /** 按 id 移除按钮 */
233
+ removeButton(buttonId: string): void;
159
234
  drawMonitoringCircle(
160
235
  longitude: number,
161
236
  latitude: number,
@@ -183,34 +258,587 @@ export declare class CesiumMapToolbar {
183
258
  destroy(): void;
184
259
  }
185
260
 
261
+ // 覆盖物服务:对外暴露的简化类型声明
262
+ // 覆盖物位置类型(与 overlay/types.ts 保持一致)
263
+ export type OverlayPosition = Cartesian3 | [number, number] | [number, number, number];
264
+
265
+ // 覆盖物扩展实体类型(与 libs/overlay/types.ts 保持一致)
266
+ export interface OverlayEntity extends Entity {
267
+ _onClick?: (entity: Entity) => void;
268
+ _overlayType?: string;
269
+ _infoWindow?: HTMLElement;
270
+ _borderEntity?: Entity;
271
+ _innerEntity?: Entity;
272
+ _isThickOutline?: boolean;
273
+ _outlineWidth?: number;
274
+ _isRing?: boolean;
275
+ _ringThickness?: number;
276
+ _ringSegments?: number;
277
+ _ringGlowPower?: number;
278
+ _ringLineColor?: Color | string;
279
+ _ringLineStyle?: 'solid' | 'dashed';
280
+ _ringLineMaterialMode?: 'stripe' | 'dash';
281
+ _ringStripeRepeat?: number;
282
+ _ringDashLength?: number;
283
+ _ringDashPattern?: number;
284
+ _ringGapColor?: Color | string;
285
+ _ringShowInnerLine?: boolean;
286
+ _fillMaterial?: Cesium.MaterialProperty | Color | string;
287
+ _ringHeightEpsilon?: number;
288
+ _centerCartographic?: Cesium.Cartographic;
289
+ _outerRadius?: number;
290
+ _innerRadius?: number;
291
+ _outerRectangle?: Cesium.Rectangle;
292
+ }
293
+
294
+ export type PositionOffset =
295
+ | 'top'
296
+ | 'bottom'
297
+ | 'left'
298
+ | 'right'
299
+ | 'top-left'
300
+ | 'top-right'
301
+ | 'bottom-left'
302
+ | 'bottom-right'
303
+ | 'left-top'
304
+ | 'left-bottom'
305
+ | 'right-top'
306
+ | 'right-bottom';
307
+
308
+ export interface InfoWindowOptions {
309
+ position: OverlayPosition;
310
+ content: string | HTMLElement;
311
+ width?: number;
312
+ height?: number;
313
+ pixelOffset?: Cesium.Cartesian2 | { x: number; y: number };
314
+ show?: boolean;
315
+ id?: string;
316
+ closable?: boolean;
317
+ onClick?: (entity: any) => void;
318
+ onClose?: (entity: any) => void;
319
+ backgroundColor?: string;
320
+ color?: string;
321
+ font?: string;
322
+ className?: string;
323
+ style?: Partial<CSSStyleDeclaration>;
324
+ hideWhenOutOfView?: boolean;
325
+ anchorHeight?: number;
326
+ anchorPixel?: number;
327
+ tailGap?: number;
328
+ updateInterval?: number;
329
+ showArrow?: boolean;
330
+ arrowSize?: number;
331
+ positionOffset?: PositionOffset;
332
+ }
333
+
334
+ // Overlay: 选项类型(与各实现保持一致)
335
+ export interface MarkerOptions {
336
+ position: OverlayPosition;
337
+ pixelSize?: number;
338
+ color?: any | string;
339
+ outlineColor?: any | string;
340
+ outlineWidth?: number;
341
+ heightReference?: any;
342
+ scaleByDistance?: Cesium.NearFarScalar;
343
+ disableDepthTestDistance?: number;
344
+ onClick?: (entity: Entity) => void;
345
+ id?: string;
346
+ }
347
+
348
+ export interface LabelOptions {
349
+ position: OverlayPosition;
350
+ text: string;
351
+ font?: string;
352
+ fillColor?: any | string;
353
+ outlineColor?: any | string;
354
+ outlineWidth?: number;
355
+ style?: any;
356
+ pixelOffset?: Cesium.Cartesian2;
357
+ eyeOffset?: Cesium.Cartesian3;
358
+ horizontalOrigin?: any;
359
+ verticalOrigin?: any;
360
+ heightReference?: any;
361
+ scale?: number;
362
+ showBackground?: boolean;
363
+ backgroundColor?: any | string;
364
+ backgroundPadding?: Cesium.Cartesian2;
365
+ disableDepthTestDistance?: number;
366
+ onClick?: (entity: Entity) => void;
367
+ id?: string;
368
+ }
369
+
370
+ export interface IconOptions {
371
+ position: OverlayPosition;
372
+ image: string;
373
+ width?: number;
374
+ height?: number;
375
+ scale?: number;
376
+ rotation?: number;
377
+ pixelOffset?: Cesium.Cartesian2;
378
+ eyeOffset?: Cesium.Cartesian3;
379
+ horizontalOrigin?: any;
380
+ verticalOrigin?: any;
381
+ heightReference?: any;
382
+ disableDepthTestDistance?: number;
383
+ color?: any | string;
384
+ onClick?: (entity: Entity) => void;
385
+ id?: string;
386
+ }
387
+
388
+ export interface SvgOptions {
389
+ position: OverlayPosition;
390
+ svg: string;
391
+ width?: number;
392
+ height?: number;
393
+ scale?: number;
394
+ rotation?: number;
395
+ pixelOffset?: Cesium.Cartesian2;
396
+ eyeOffset?: Cesium.Cartesian3;
397
+ horizontalOrigin?: any;
398
+ verticalOrigin?: any;
399
+ heightReference?: any;
400
+ disableDepthTestDistance?: number;
401
+ color?: any | string;
402
+ onClick?: (entity: Entity) => void;
403
+ id?: string;
404
+ }
405
+
406
+ export interface PolylineOptions {
407
+ positions: OverlayPosition[];
408
+ width?: number;
409
+ material?: Cesium.MaterialProperty | any | string;
410
+ clampToGround?: boolean;
411
+ onClick?: (entity: Entity) => void;
412
+ id?: string;
413
+ }
414
+
415
+ export interface PolygonOptions {
416
+ positions: OverlayPosition[];
417
+ material?: Cesium.MaterialProperty | any | string;
418
+ outline?: boolean;
419
+ outlineColor?: any | string;
420
+ outlineWidth?: number;
421
+ heightReference?: any;
422
+ extrudedHeight?: number;
423
+ onClick?: (entity: Entity) => void;
424
+ id?: string;
425
+ }
426
+
427
+ export interface RectangleOptions {
428
+ coordinates: Cesium.Rectangle;
429
+ material?: Cesium.MaterialProperty | any | string;
430
+ outline?: boolean;
431
+ outlineColor?: any | string;
432
+ outlineWidth?: number;
433
+ heightReference?: any;
434
+ extrudedHeight?: number;
435
+ onClick?: (entity: Entity) => void;
436
+ id?: string;
437
+ }
438
+
439
+ export interface CircleOptions {
440
+ position: OverlayPosition;
441
+ radius: number;
442
+ material?: Cesium.MaterialProperty | any | string;
443
+ outline?: boolean;
444
+ outlineColor?: any | string;
445
+ outlineWidth?: number;
446
+ heightReference?: any;
447
+ extrudedHeight?: number;
448
+ heightEpsilon?: number; // 高度容差,用于环形方案
449
+ onClick?: (entity: Entity) => void;
450
+ id?: string;
451
+ }
452
+
453
+ export interface RingOptions {
454
+ /** 中心点(经纬度/高度 或 Cartesian3) */
455
+ position: OverlayPosition;
456
+ /** 半径(米) */
457
+ radius: number;
458
+ /** 边缘发光颜色 */
459
+ color?: any | string;
460
+ /** 是否绘制内层线(默认 true)。关闭可去掉“白色芯子” */
461
+ showInnerLine?: boolean;
462
+ /** 内层线颜色 */
463
+ lineColor?: any | string;
464
+ /** 内层线型:实线/虚线(默认 solid) */
465
+ lineStyle?: 'solid' | 'dashed';
466
+ /** 虚线材质方案:stripe(默认) / dash */
467
+ lineMaterialMode?: 'stripe' | 'dash';
468
+ /** stripe 模式:条纹重复次数(默认 32) */
469
+ stripeRepeat?: number;
470
+ /** 虚线长度(像素,默认 16) */
471
+ dashLength?: number;
472
+ /** 虚线模式(16bit pattern,可选) */
473
+ dashPattern?: number;
474
+ /** 虚线间隙颜色(默认透明) */
475
+ gapColor?: any | string;
476
+ /** 线宽(像素) */
477
+ width?: number;
478
+ /** 外层发光线宽(像素)。优先于 width */
479
+ glowWidth?: number;
480
+ /** 内层线宽(像素)。不传则使用自动计算 */
481
+ lineWidth?: number;
482
+ /** 发光强度(0-1),越大越“亮/粗” */
483
+ glowPower?: number;
484
+ /** 是否贴地(默认 true) */
485
+ clampToGround?: boolean;
486
+ /** 圆环分段数(默认 128),越大越圆滑 */
487
+ segments?: number;
488
+ /** 覆盖物点击回调 */
489
+ onClick?: (entity: Entity) => void;
490
+ id?: string;
491
+ }
492
+
493
+ export declare class CesiumOverlayService {
494
+ constructor(viewer: Viewer);
495
+ addMarker(options: any): any; // 返回 Cesium.Entity
496
+ addLabel(options: any): any; // 返回 Cesium.Entity
497
+ addIcon(options: any): any; // 返回 Cesium.Entity
498
+ addSvg(options: any): any; // 返回 Cesium.Entity
499
+ addInfoWindow(options: InfoWindowOptions): any; // 返回 Cesium.Entity
500
+ addPolyline(options: any): any; // 返回 Cesium.Entity
501
+ addPolygon(options: any): any; // 返回 Cesium.Entity
502
+ addRectangle(options: any): any; // 返回 Cesium.Entity
503
+ addCircle(options: any): any; // 返回 Cesium.Entity
504
+ addRing(options: RingOptions): any; // 返回 Cesium.Entity
505
+ getOverlay(id: string): any | undefined; // 返回 Cesium.Entity | undefined
506
+ removeOverlay(id: string): boolean;
507
+ removeAllOverlays(): void;
508
+ updateOverlayPosition(id: string, position: Cartesian3 | [number, number, number?]): boolean;
509
+ setOverlayVisible(id: string, visible: boolean): boolean;
510
+ getAllOverlayIds(): string[];
511
+ getAllOverlays(): any[]; // Cesium.Entity[]
512
+ destroy(): void;
513
+ }
514
+
515
+ // 单个信息窗口工具类(与 libs/overlay/MapInfoWindow.ts 保持一致)
516
+ export declare class MapInfoWindow {
517
+ constructor(viewer: Viewer, container: HTMLElement);
518
+ setDefaultUpdateInterval(ms: number): void;
519
+ forceUpdateAll(): void;
520
+ add(options: InfoWindowOptions): Entity;
521
+ update(options: Partial<InfoWindowOptions> & { id: string }): void;
522
+ updatePosition(entity: Entity, position: OverlayPosition): void;
523
+ setVisible(entity: Entity, visible: boolean): void;
524
+ remove(entity: Entity): void;
525
+ removeAll(): void;
526
+ destroy(): void;
527
+ }
528
+
529
+ // Overlay: 工具类声明(只暴露主要方法)
530
+ export declare class MapMarker {
531
+ constructor(viewer: Viewer);
532
+ add(options: MarkerOptions): Entity;
533
+ updatePosition(entity: Entity, position: OverlayPosition): void;
534
+ updateStyle(entity: Entity, options: Partial<Pick<MarkerOptions, 'color' | 'outlineColor' | 'outlineWidth' | 'pixelSize'>>): void;
535
+ }
536
+
537
+ export declare class MapLabel {
538
+ constructor(viewer: Viewer);
539
+ add(options: LabelOptions): Entity;
540
+ updatePosition(entity: Entity, position: OverlayPosition): void;
541
+ }
542
+
543
+ export declare class MapIcon {
544
+ constructor(viewer: Viewer);
545
+ add(options: IconOptions): Entity;
546
+ updatePosition(entity: Entity, position: OverlayPosition): void;
547
+ updateImage(entity: Entity, image: string): void;
548
+ }
549
+
550
+ export declare class MapSVG {
551
+ constructor(viewer: Viewer);
552
+ add(options: SvgOptions): Entity;
553
+ updatePosition(entity: Entity, position: OverlayPosition): void;
554
+ }
555
+
556
+ export declare class MapPolyline {
557
+ constructor(viewer: Viewer);
558
+ add(options: PolylineOptions): Entity;
559
+ updatePositions(entity: Entity, positions: OverlayPosition[]): void;
560
+ updateStyle(entity: Entity, options: Partial<Pick<PolylineOptions, 'width' | 'material'>>): void;
561
+ }
562
+
563
+ export declare class MapPolygon {
564
+ constructor(viewer: Viewer);
565
+ add(options: PolygonOptions): Entity;
566
+ updatePositions(entity: Entity, positions: OverlayPosition[]): void;
567
+ updateStyle(entity: Entity, options: Partial<Pick<PolygonOptions, 'material' | 'outline' | 'outlineColor' | 'outlineWidth'>>): void;
568
+ remove(entityOrId: Entity | string): boolean;
569
+ }
570
+
571
+ export declare class MapRectangle {
572
+ constructor(viewer: Viewer);
573
+ add(options: RectangleOptions): Entity;
574
+ updateCoordinates(entity: Entity, coordinates: Cesium.Rectangle): void;
575
+ updateStyle(entity: Entity, options: Partial<Pick<RectangleOptions, 'material' | 'outline' | 'outlineColor' | 'outlineWidth'>>): void;
576
+ remove(entityOrId: Entity | string): boolean;
577
+ }
578
+
579
+ export declare class MapCircle {
580
+ constructor(viewer: Viewer);
581
+ add(options: CircleOptions): Entity;
582
+ updatePosition(entity: Entity, position: OverlayPosition): void;
583
+ updateRadius(entity: Entity, radius: number): void;
584
+ updateStyle(entity: Entity, options: Partial<Pick<CircleOptions, 'material' | 'outline' | 'outlineColor' | 'outlineWidth'>>): void;
585
+ }
586
+
587
+ export declare class MapRing {
588
+ constructor(viewer: Viewer);
589
+ add(options: RingOptions): Entity;
590
+ updatePosition(entity: Entity, position: OverlayPosition): void;
591
+ updateRadius(entity: Entity, radius: number): void;
592
+ updateStyle(
593
+ entity: Entity,
594
+ options: Partial<
595
+ Pick<
596
+ RingOptions,
597
+ | 'color'
598
+ | 'showInnerLine'
599
+ | 'lineColor'
600
+ | 'lineStyle'
601
+ | 'lineMaterialMode'
602
+ | 'stripeRepeat'
603
+ | 'dashLength'
604
+ | 'dashPattern'
605
+ | 'gapColor'
606
+ | 'width'
607
+ | 'glowWidth'
608
+ | 'lineWidth'
609
+ | 'glowPower'
610
+ | 'clampToGround'
611
+ | 'segments'
612
+ >
613
+ >
614
+ ): void;
615
+ setVisible(entity: Entity, visible: boolean): void;
616
+ remove(entityOrId: Entity | string): boolean;
617
+ }
618
+
619
+ // toolbar: 相机控制器及服务(与工具栏相关类保持一致)
620
+ export interface MapInitialCenter {
621
+ longitude: number;
622
+ latitude: number;
623
+ height: number;
624
+ }
625
+
626
+ export interface CesiumMapControllerOptions {
627
+ initialCenter?: MapInitialCenter;
628
+ getMapTypes?: () => MapType[];
629
+ getCurrentMapTypeId?: () => string;
630
+ getToken?: () => string;
631
+ zoomCallback?: ZoomCallback;
632
+ onSceneModeChanged?: () => void;
633
+ }
634
+
635
+ export declare class CesiumMapController {
636
+ constructor(viewer: Viewer, options?: CesiumMapControllerOptions);
637
+ setupCameraZoomLimitListener(): void;
638
+ getCurrentZoomLevel(): number;
639
+ setZoomLevel(zoomLevel: number): void;
640
+ zoomIn(): void;
641
+ zoomOut(): void;
642
+ toggle2D3D(buttonElement: HTMLElement): void;
643
+ resetLocation(): void;
644
+ setInitialCenter(center: MapInitialCenter): void;
645
+ getInitialCenter(): MapInitialCenter | undefined;
646
+ toggleFullscreen(): void;
647
+ isFullscreen(): boolean;
648
+ enterFullscreen(): void;
649
+ exitFullscreen(): void;
650
+ }
651
+
652
+ export interface MapLayersServiceConfig {
653
+ mapTypes: MapType[];
654
+ currentMapType: string;
655
+ token: string;
656
+ isNoFlyZoneChecked: boolean;
657
+ isNoFlyZoneVisible: boolean;
658
+ onMapTypeChange?: (mapTypeId: string) => void;
659
+ onNoFlyZoneToggle?: (isChecked: boolean) => void;
660
+ onShowNoFlyZones?: () => Promise<void> | void;
661
+ }
662
+
663
+ export declare class MapLayersService {
664
+ constructor(viewer: Viewer, toolbarElement: HTMLElement, config: MapLayersServiceConfig);
665
+ updateConfig(config: Partial<MapLayersServiceConfig>): void;
666
+ toggleLayers(buttonElement: HTMLElement): void;
667
+ switchMapType(mapTypeId: string): void;
668
+ getCurrentMapType(): string;
669
+ closeLayersMenu(): void;
670
+ destroy(): void;
671
+ }
672
+
673
+ export declare class SearchService {
674
+ constructor(viewer: Viewer, toolbarElement: HTMLElement, searchCallback?: SearchCallback);
675
+ setSearchCallback(callback: SearchCallback): void;
676
+ toggleSearch(buttonElement: HTMLElement): void;
677
+ displaySearchResults(results: SearchResult[], container: HTMLElement): void;
678
+ selectSearchResult(result: SearchResult): void;
679
+ closeSearchContainer(): void;
680
+ destroy(): void;
681
+ }
682
+
683
+ export interface NotFlyZonesServiceConfig {
684
+ extrudedHeight?: number;
685
+ autoLoad?: boolean;
686
+ }
687
+
688
+ export declare class NotFlyZonesService {
689
+ constructor(viewer: Viewer, config?: NotFlyZonesServiceConfig);
690
+ showNoFlyZones(): Promise<void>;
691
+ hideNoFlyZones(): void;
692
+ toggleNoFlyZones(): Promise<void>;
693
+ getNoFlyZoneVisible(): boolean;
694
+ destroy(): void;
695
+ }
696
+
697
+ // 工具栏按钮默认配置与排序(来自 MapToolBarConfig.ts)
698
+ export declare const defaultButtonSorts: Record<string, number>;
699
+ export declare const defaultButtons: ButtonConfig[];
700
+
701
+ // 绘制相关类型(与内部实现保持一致)
702
+ // 绘制底层工具类型(与 drawHelper/BaseDraw.ts 保持一致)
703
+ export interface DrawResult {
704
+ entity: Entity | null;
705
+ type: 'line' | 'polygon' | 'rectangle' | 'circle';
706
+ positions: Cartesian3[];
707
+ distance?: number;
708
+ areaKm2?: number;
709
+ }
710
+
711
+ export interface DrawCallbacks {
712
+ onDrawStart?: () => void;
713
+ onDrawEnd?: (entity: Entity | null, result: DrawResult) => void;
714
+ onEntityRemoved?: (entity: Entity) => void;
715
+ onMeasureComplete?: (result: DrawResult) => void;
716
+ }
717
+
718
+ export interface DrawOptions {
719
+ strokeColor?: Cesium.Color | string;
720
+ strokeWidth?: number;
721
+ fillColor?: Cesium.Color | string;
722
+ outlineColor?: Cesium.Color | string;
723
+ outlineWidth?: number;
724
+ heightEpsilon?: number;
725
+ selected?: {
726
+ color?: Cesium.Color | string;
727
+ width?: number;
728
+ outlineColor?: Cesium.Color | string;
729
+ outlineWidth?: number;
730
+ };
731
+ onClick?: (entity: Entity, type?: 'line' | 'polygon' | 'rectangle' | 'circle', positions?: Cartesian3[]) => void;
732
+ }
733
+
186
734
  export declare class DrawHelper {
187
735
  constructor(viewer: Viewer);
188
- startDrawingLine(): void;
189
- startDrawingPolygon(): void;
190
- startDrawingRectangle(): void;
191
- drawFrustum(options?: FrustumOptions): void;
736
+ // 开始绘制(可选样式参数)
737
+ startDrawingLine(options?: DrawOptions): void;
738
+ startDrawingPolygon(options?: DrawOptions): void;
739
+ startDrawingRectangle(options?: DrawOptions): void;
740
+ startDrawingCircle(options?: DrawOptions): void;
741
+ // 控制绘制流程
192
742
  endDrawing(): void;
743
+ // 清理与管理
193
744
  clearAll(): void;
194
- clearFrustum(): void;
195
- removeEntity(entity: any): void; // Cesium.Entity
196
- getFinishedEntities(): any[]; // Cesium.Entity[]
745
+ clearAllEntities(): void;
746
+ clearAllPoints(): void;
747
+ removeEntity(entity: Entity): void;
748
+ getFinishedEntities(): Entity[];
749
+ // 事件回调注册
750
+ onMeasureComplete(callback: (result: DrawResult) => void): void;
197
751
  onDrawStart(callback: () => void): void;
198
- onDrawEnd(callback: (entity: any) => void): void; // Cesium.Entity | null
199
- onEntityRemoved(callback: (entity: any) => void): void; // Cesium.Entity
752
+ onDrawEnd(callback: (entity: Entity | null) => void): void;
753
+ onEntityRemoved(callback: (entity: Entity) => void): void;
754
+ // 场景模式切换适配
755
+ handleSceneModeChanged(): void;
756
+ // 资源释放
200
757
  destroy(): void;
201
758
  }
202
759
 
760
+ // 底层抽象绘制类及具体实现(通过 `export * from './libs/drawHelper/index'` 暴露)
761
+ export declare abstract class BaseDraw {
762
+ protected viewer: Viewer;
763
+ protected scene: Cesium.Scene;
764
+ protected entities: Cesium.EntityCollection;
765
+ protected offsetHeight: number;
766
+ protected originalDepthTestAgainstTerrain: boolean | null;
767
+ protected originalRequestRenderMode: boolean | null;
768
+ protected callbacks: DrawCallbacks;
769
+ protected tempPositions: Cartesian3[];
770
+ protected tempEntities: Entity[];
771
+ protected tempLabelEntities: Entity[];
772
+ protected finishedPointEntities: Entity[];
773
+ protected drawOptions?: DrawOptions;
774
+ protected resolveColor(input?: Cesium.Color | string): Cesium.Color;
775
+ protected applySelectedStyleToEntity(entity: Entity): void;
776
+ protected restoreOriginalStyleForEntity(entity: Entity): void;
777
+ protected updateOffsetHeight(): void;
778
+ protected pickGlobePosition(windowPosition: Cesium.Cartesian2): Cartesian3 | null;
779
+ protected rememberOriginalRequestRenderModeIfNeeded(): void;
780
+ protected restoreRequestRenderModeIfNeeded(): void;
781
+ abstract updateDrawingEntity(previewPoint?: Cartesian3): void;
782
+ abstract startDrawing(options?: DrawOptions): void;
783
+ abstract finishDrawing(): DrawResult | null;
784
+ abstract getDrawType(): 'line' | 'polygon' | 'rectangle' | 'circle';
785
+ }
786
+
787
+ export declare class DrawLine extends BaseDraw {
788
+ updateDrawingEntity(previewPoint?: Cartesian3): void;
789
+ startDrawing(options?: DrawOptions): void;
790
+ finishDrawing(): DrawResult | null;
791
+ getDrawType(): 'line';
792
+ }
793
+
794
+ export declare class DrawPolygon extends BaseDraw {
795
+ updateDrawingEntity(previewPoint?: Cartesian3): void;
796
+ startDrawing(options?: DrawOptions): void;
797
+ finishDrawing(): DrawResult | null;
798
+ getDrawType(): 'polygon';
799
+ }
800
+
801
+ export declare class DrawRectangle extends BaseDraw {
802
+ updateDrawingEntity(previewPoint?: Cartesian3): void;
803
+ startDrawing(options?: DrawOptions): void;
804
+ finishDrawing(): DrawResult | null;
805
+ getDrawType(): 'rectangle';
806
+ }
807
+
808
+ export declare class DrawCircle extends BaseDraw {
809
+ updateDrawingEntity(previewPoint?: Cartesian3): void;
810
+ startDrawing(options?: DrawOptions): void;
811
+ finishDrawing(): DrawResult | null;
812
+ getDrawType(): 'circle';
813
+ }
814
+
203
815
  export declare function initCesium(
204
816
  containerId: string,
205
817
  options: InitOptions,
206
- mapCenter?: MapCenter
818
+ mapCenterOrCesiumToken?: MapCenter | string,
819
+ cesiumToken?: String
207
820
  ): Promise<{ viewer: Viewer; initialCenter: MapCenter }>;
208
821
 
209
822
  // 默认导出
210
823
  declare const _default: {
211
824
  CesiumMapToolbar: typeof CesiumMapToolbar;
212
825
  DrawHelper: typeof DrawHelper;
826
+ CesiumOverlayService: typeof CesiumOverlayService;
213
827
  initCesium: typeof initCesium;
828
+ initCesiumMap: typeof initCesium;
214
829
  };
215
830
 
216
831
  export default _default;
832
+
833
+ // Heatmap-related types
834
+ export interface HeatmapOptions {
835
+ intensity?: number;
836
+ radius?: number;
837
+ gradient?: Record<number, string>;
838
+ }
839
+
840
+ export interface HeatmapLayer {
841
+ addData(data: { x: number; y: number; value: number }[]): void;
842
+ setOptions(options: HeatmapOptions): void;
843
+ clear(): void;
844
+ }