@xingm/vmap-cesium-toolbar 0.0.2-alpha.1 → 0.0.2-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts 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;
31
+ hoverColor?: string;
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;
25
51
  hoverColor?: string;
26
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
  // 搜索结果接口
@@ -51,8 +84,8 @@ export interface MeasurementCallback {
51
84
 
52
85
  // 缩放回调接口
53
86
  export interface ZoomCallback {
54
- onZoomIn?: (beforeLevel: number, afterLevel: number) => void;
55
- onZoomOut?: (beforeLevel: number, afterLevel: number) => void;
87
+ onZoomIn?: (beforeHeight: number, afterHeight: number, currentLevel: number) => void;
88
+ onZoomOut?: (beforeHeight: number, afterHeight: number, currentLevel: number) => void;
56
89
  }
57
90
 
58
91
  // 地图类型接口
@@ -60,7 +93,9 @@ export interface MapType {
60
93
  id: string;
61
94
  name: string;
62
95
  thumbnail: string;
63
- 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;
64
99
  }
65
100
 
66
101
  // 视锥体选项接口
@@ -77,17 +112,37 @@ export interface FrustumOptions {
77
112
  }
78
113
 
79
114
  // 覆盖物选项接口
115
+ // 覆盖物选项(与 CesiumMapModel.ts 保持一致)
80
116
  export interface OverlayOptions {
81
117
  position: Cartesian3;
82
118
  type: 'point' | 'label' | 'billboard' | 'model' | 'cylinder';
83
- text?: string;
84
- image?: string;
85
- model?: string;
86
- color?: any; // Cesium.Color
87
- scale?: number;
88
- height?: number;
89
- width?: number;
90
- 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
+ };
91
146
  }
92
147
 
93
148
  // 地图中心点接口
@@ -101,45 +156,51 @@ export interface MapCenter {
101
156
 
102
157
  // 初始化选项接口
103
158
  export interface InitOptions {
104
- token?: string;
105
- cesiumToken?: string;
106
- terrain?: any; // Cesium.Terrain
107
- terrainProvider?: any; // Cesium.TerrainProvider
159
+ terrain?: Cesium.Terrain;
160
+ terrainProvider?: Cesium.TerrainProvider;
108
161
  mapType?: string;
109
- imageryProvider?: any; // Cesium.UrlTemplateImageryProvider
110
- imageryLayers?: any; // Cesium.ImageryLayerCollection
111
- terrainShadows?: any; // Cesium.ShadowMode
112
- contextOptions?: any; // Cesium.ContextOptions
162
+ imageryProvider?: Cesium.UrlTemplateImageryProvider;
163
+ imageryLayers?: Cesium.ImageryLayerCollection;
164
+ terrainShadows?: Cesium.ShadowMode;
165
+ contextOptions?: Cesium.ContextOptions;
113
166
  scene3DOnly?: boolean;
114
- isFlyTo?: boolean;
115
- isFly?: boolean;
116
167
  selectionIndicator?: boolean;
117
168
  navigationHelpButton?: boolean;
118
169
  fullscreenButton?: boolean;
119
170
  geocoder?: boolean;
120
171
  homeButton?: boolean;
121
172
  infoBox?: boolean;
173
+ vrButton?: boolean;
122
174
  sceneModePicker?: boolean;
123
- baseLayerPicker?: boolean;
124
175
  timeline?: boolean;
125
176
  animation?: boolean;
126
- clock?: any; // Cesium.Clock
177
+ isFly?: boolean;
178
+ flyDuration?: number;
179
+ baseLayerPicker?: boolean;
127
180
  navigationInstructionsInitiallyVisible?: boolean;
128
- sceneMode?: any; // Cesium.SceneMode
129
- screenSpaceEventHandler?: any; // Cesium.ScreenSpaceEventHandler
181
+ clock?: Cesium.Clock;
182
+ sceneMode?: Cesium.SceneMode;
183
+ screenSpaceEventHandler?: Cesium.ScreenSpaceEventHandler;
130
184
  useDefaultRenderLoop?: boolean;
131
185
  targetFrameRate?: number;
132
186
  showRenderLoopErrors?: boolean;
133
187
  automaticallyTrackDataSourceClocks?: boolean;
134
- dataSources?: any; // Cesium.DataSourceCollection
188
+ dataSources?: Cesium.DataSourceCollection;
135
189
  creationTime?: number;
136
190
  useBrowserRecommendedResolution?: boolean;
137
191
  resolutionScale?: number;
138
192
  orderIndependentTransparency?: boolean;
139
193
  shadows?: boolean;
194
+ depthTestAgainstTerrain?: boolean;
140
195
  terrainExaggeration?: number;
141
196
  maximumScreenSpaceError?: number;
142
197
  maximumNumberOfLoadedTiles?: number;
198
+ requestRenderMode?: boolean;
199
+ token?: string;
200
+ cesiumToken?: string;
201
+ success?: () => void;
202
+ cancel?: () => void;
203
+ mapCenter?: MapCenter;
143
204
  }
144
205
 
145
206
  // 主要类声明
@@ -160,6 +221,16 @@ export declare class CesiumMapToolbar {
160
221
  setInitialCenter(center: { longitude: number; latitude: number; height: number }): void;
161
222
  getInitialCenter(): { longitude: number; latitude: number; height: number } | undefined;
162
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;
163
234
  drawMonitoringCircle(
164
235
  longitude: number,
165
236
  latitude: number,
@@ -187,23 +258,560 @@ export declare class CesiumMapToolbar {
187
258
  destroy(): void;
188
259
  }
189
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
+
190
734
  export declare class DrawHelper {
191
735
  constructor(viewer: Viewer);
192
- startDrawingLine(): void;
193
- startDrawingPolygon(): void;
194
- startDrawingRectangle(): void;
195
- 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
+ // 控制绘制流程
196
742
  endDrawing(): void;
743
+ // 清理与管理
197
744
  clearAll(): void;
198
- clearFrustum(): void;
199
- removeEntity(entity: any): void; // Cesium.Entity
200
- 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;
201
751
  onDrawStart(callback: () => void): void;
202
- onDrawEnd(callback: (entity: any) => void): void; // Cesium.Entity | null
203
- 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
+ // 资源释放
204
757
  destroy(): void;
205
758
  }
206
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
+
207
815
  export declare function initCesium(
208
816
  containerId: string,
209
817
  options: InitOptions,
@@ -215,7 +823,22 @@ export declare function initCesium(
215
823
  declare const _default: {
216
824
  CesiumMapToolbar: typeof CesiumMapToolbar;
217
825
  DrawHelper: typeof DrawHelper;
826
+ CesiumOverlayService: typeof CesiumOverlayService;
218
827
  initCesium: typeof initCesium;
828
+ initCesiumMap: typeof initCesium;
219
829
  };
220
830
 
221
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
+ }