@xingm/vmap-cesium-toolbar 0.0.2-alpha.4 → 0.0.2-alpha.6
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 +454 -44
- package/dist/index.js +822 -498
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +15 -15
- package/dist/index.umd.js.map +1 -1
- package/dist/libs/drawHelper/DrawCircle.d.ts +5 -0
- package/dist/libs/drawHelper/DrawPolgon.d.ts +1 -0
- package/dist/libs/overlay/MapCircle.d.ts +6 -0
- package/dist/libs/overlay/MapPolygon.d.ts +17 -0
- package/dist/libs/overlay/MapRectangle.d.ts +8 -0
- package/dist/package.json +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// VMap Cesium Toolbar Plugin Type Definitions
|
|
2
2
|
|
|
3
|
-
import type
|
|
3
|
+
import type * as Cesium from 'cesium';
|
|
4
|
+
import type { Viewer, Cartesian3, Cartographic, Entity, Cartesian2, 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?: (
|
|
55
|
-
onZoomOut?: (
|
|
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:
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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,50 @@ export interface MapCenter {
|
|
|
101
156
|
|
|
102
157
|
// 初始化选项接口
|
|
103
158
|
export interface InitOptions {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
terrain?: any; // Cesium.Terrain
|
|
107
|
-
terrainProvider?: any; // Cesium.TerrainProvider
|
|
159
|
+
terrain?: Cesium.Terrain;
|
|
160
|
+
terrainProvider?: Cesium.TerrainProvider;
|
|
108
161
|
mapType?: string;
|
|
109
|
-
imageryProvider?:
|
|
110
|
-
imageryLayers?:
|
|
111
|
-
terrainShadows?:
|
|
112
|
-
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
|
-
|
|
177
|
+
isFly?: boolean;
|
|
178
|
+
flyDuration?: number;
|
|
179
|
+
baseLayerPicker?: boolean;
|
|
127
180
|
navigationInstructionsInitiallyVisible?: boolean;
|
|
128
|
-
|
|
129
|
-
|
|
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?:
|
|
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
|
+
token?: string;
|
|
199
|
+
cesiumToken?: string;
|
|
200
|
+
success?: () => void;
|
|
201
|
+
cancel?: () => void;
|
|
202
|
+
mapCenter?: MapCenter;
|
|
143
203
|
}
|
|
144
204
|
|
|
145
205
|
// 主要类声明
|
|
@@ -160,6 +220,16 @@ export declare class CesiumMapToolbar {
|
|
|
160
220
|
setInitialCenter(center: { longitude: number; latitude: number; height: number }): void;
|
|
161
221
|
getInitialCenter(): { longitude: number; latitude: number; height: number } | undefined;
|
|
162
222
|
resetToInitialLocation(): void;
|
|
223
|
+
/** 当前测量模式:none / distance / area */
|
|
224
|
+
readonly measurement: {
|
|
225
|
+
getMeasureMode: () => 'none' | 'distance' | 'area';
|
|
226
|
+
};
|
|
227
|
+
/** 更新内置或自定义按钮配置 */
|
|
228
|
+
updateButtonConfig(buttonId: string, config: Partial<CustomButtonConfig>): void;
|
|
229
|
+
/** 添加或替换自定义按钮 */
|
|
230
|
+
addCustomButton(config: CustomButtonConfig): void;
|
|
231
|
+
/** 按 id 移除按钮 */
|
|
232
|
+
removeButton(buttonId: string): void;
|
|
163
233
|
drawMonitoringCircle(
|
|
164
234
|
longitude: number,
|
|
165
235
|
latitude: number,
|
|
@@ -188,6 +258,9 @@ export declare class CesiumMapToolbar {
|
|
|
188
258
|
}
|
|
189
259
|
|
|
190
260
|
// 覆盖物服务:对外暴露的简化类型声明
|
|
261
|
+
// 覆盖物位置类型(与 overlay/types.ts 保持一致)
|
|
262
|
+
export type OverlayPosition = Cartesian3 | [number, number] | [number, number, number];
|
|
263
|
+
|
|
191
264
|
export type PositionOffset =
|
|
192
265
|
| 'top'
|
|
193
266
|
| 'bottom'
|
|
@@ -203,11 +276,11 @@ export type PositionOffset =
|
|
|
203
276
|
| 'right-bottom';
|
|
204
277
|
|
|
205
278
|
export interface InfoWindowOptions {
|
|
206
|
-
position:
|
|
279
|
+
position: OverlayPosition;
|
|
207
280
|
content: string | HTMLElement;
|
|
208
281
|
width?: number;
|
|
209
282
|
height?: number;
|
|
210
|
-
pixelOffset?: { x: number; y: number };
|
|
283
|
+
pixelOffset?: Cesium.Cartesian2 | { x: number; y: number };
|
|
211
284
|
show?: boolean;
|
|
212
285
|
id?: string;
|
|
213
286
|
closable?: boolean;
|
|
@@ -228,6 +301,125 @@ export interface InfoWindowOptions {
|
|
|
228
301
|
positionOffset?: PositionOffset;
|
|
229
302
|
}
|
|
230
303
|
|
|
304
|
+
// Overlay: 选项类型(与各实现保持一致)
|
|
305
|
+
export interface MarkerOptions {
|
|
306
|
+
position: OverlayPosition;
|
|
307
|
+
pixelSize?: number;
|
|
308
|
+
color?: any | string;
|
|
309
|
+
outlineColor?: any | string;
|
|
310
|
+
outlineWidth?: number;
|
|
311
|
+
heightReference?: any;
|
|
312
|
+
scaleByDistance?: Cesium.NearFarScalar;
|
|
313
|
+
disableDepthTestDistance?: number;
|
|
314
|
+
onClick?: (entity: Entity) => void;
|
|
315
|
+
id?: string;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
export interface LabelOptions {
|
|
319
|
+
position: OverlayPosition;
|
|
320
|
+
text: string;
|
|
321
|
+
font?: string;
|
|
322
|
+
fillColor?: any | string;
|
|
323
|
+
outlineColor?: any | string;
|
|
324
|
+
outlineWidth?: number;
|
|
325
|
+
style?: any;
|
|
326
|
+
pixelOffset?: Cesium.Cartesian2;
|
|
327
|
+
eyeOffset?: Cesium.Cartesian3;
|
|
328
|
+
horizontalOrigin?: any;
|
|
329
|
+
verticalOrigin?: any;
|
|
330
|
+
heightReference?: any;
|
|
331
|
+
scale?: number;
|
|
332
|
+
showBackground?: boolean;
|
|
333
|
+
backgroundColor?: any | string;
|
|
334
|
+
backgroundPadding?: Cesium.Cartesian2;
|
|
335
|
+
disableDepthTestDistance?: number;
|
|
336
|
+
onClick?: (entity: Entity) => void;
|
|
337
|
+
id?: string;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
export interface IconOptions {
|
|
341
|
+
position: OverlayPosition;
|
|
342
|
+
image: string;
|
|
343
|
+
width?: number;
|
|
344
|
+
height?: number;
|
|
345
|
+
scale?: number;
|
|
346
|
+
rotation?: number;
|
|
347
|
+
pixelOffset?: Cesium.Cartesian2;
|
|
348
|
+
eyeOffset?: Cesium.Cartesian3;
|
|
349
|
+
horizontalOrigin?: any;
|
|
350
|
+
verticalOrigin?: any;
|
|
351
|
+
heightReference?: any;
|
|
352
|
+
disableDepthTestDistance?: number;
|
|
353
|
+
color?: any | string;
|
|
354
|
+
onClick?: (entity: Entity) => void;
|
|
355
|
+
id?: string;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
export interface SvgOptions {
|
|
359
|
+
position: OverlayPosition;
|
|
360
|
+
svg: string;
|
|
361
|
+
width?: number;
|
|
362
|
+
height?: number;
|
|
363
|
+
scale?: number;
|
|
364
|
+
rotation?: number;
|
|
365
|
+
pixelOffset?: Cesium.Cartesian2;
|
|
366
|
+
eyeOffset?: Cesium.Cartesian3;
|
|
367
|
+
horizontalOrigin?: any;
|
|
368
|
+
verticalOrigin?: any;
|
|
369
|
+
heightReference?: any;
|
|
370
|
+
disableDepthTestDistance?: number;
|
|
371
|
+
color?: any | string;
|
|
372
|
+
onClick?: (entity: Entity) => void;
|
|
373
|
+
id?: string;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
export interface PolylineOptions {
|
|
377
|
+
positions: OverlayPosition[];
|
|
378
|
+
width?: number;
|
|
379
|
+
material?: Cesium.MaterialProperty | any | string;
|
|
380
|
+
clampToGround?: boolean;
|
|
381
|
+
onClick?: (entity: Entity) => void;
|
|
382
|
+
id?: string;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
export interface PolygonOptions {
|
|
386
|
+
positions: OverlayPosition[];
|
|
387
|
+
material?: Cesium.MaterialProperty | any | string;
|
|
388
|
+
outline?: boolean;
|
|
389
|
+
outlineColor?: any | string;
|
|
390
|
+
outlineWidth?: number;
|
|
391
|
+
heightReference?: any;
|
|
392
|
+
extrudedHeight?: number;
|
|
393
|
+
onClick?: (entity: Entity) => void;
|
|
394
|
+
id?: string;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
export interface RectangleOptions {
|
|
398
|
+
coordinates: Cesium.Rectangle;
|
|
399
|
+
material?: Cesium.MaterialProperty | any | string;
|
|
400
|
+
outline?: boolean;
|
|
401
|
+
outlineColor?: any | string;
|
|
402
|
+
outlineWidth?: number;
|
|
403
|
+
heightReference?: any;
|
|
404
|
+
extrudedHeight?: number;
|
|
405
|
+
onClick?: (entity: Entity) => void;
|
|
406
|
+
id?: string;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
export interface CircleOptions {
|
|
410
|
+
position: OverlayPosition;
|
|
411
|
+
radius: number;
|
|
412
|
+
material?: Cesium.MaterialProperty | any | string;
|
|
413
|
+
outline?: boolean;
|
|
414
|
+
outlineColor?: any | string;
|
|
415
|
+
outlineWidth?: number;
|
|
416
|
+
heightReference?: any;
|
|
417
|
+
extrudedHeight?: number;
|
|
418
|
+
heightEpsilon?: number; // 高度容差,用于环形方案
|
|
419
|
+
onClick?: (entity: Entity) => void;
|
|
420
|
+
id?: string;
|
|
421
|
+
}
|
|
422
|
+
|
|
231
423
|
export declare class CesiumOverlayService {
|
|
232
424
|
constructor(viewer: Viewer);
|
|
233
425
|
addMarker(options: any): any; // 返回 Cesium.Entity
|
|
@@ -249,30 +441,193 @@ export declare class CesiumOverlayService {
|
|
|
249
441
|
destroy(): void;
|
|
250
442
|
}
|
|
251
443
|
|
|
444
|
+
// 单个信息窗口工具类(与 libs/overlay/MapInfoWindow.ts 保持一致)
|
|
445
|
+
export declare class MapInfoWindow {
|
|
446
|
+
constructor(viewer: Viewer, container: HTMLElement);
|
|
447
|
+
setDefaultUpdateInterval(ms: number): void;
|
|
448
|
+
forceUpdateAll(): void;
|
|
449
|
+
add(options: InfoWindowOptions): Entity;
|
|
450
|
+
update(options: Partial<InfoWindowOptions> & { id: string }): void;
|
|
451
|
+
updatePosition(entity: Entity, position: OverlayPosition): void;
|
|
452
|
+
setVisible(entity: Entity, visible: boolean): void;
|
|
453
|
+
remove(entity: Entity): void;
|
|
454
|
+
removeAll(): void;
|
|
455
|
+
destroy(): void;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
// Overlay: 工具类声明(只暴露主要方法)
|
|
459
|
+
export declare class MapMarker {
|
|
460
|
+
constructor(viewer: Viewer);
|
|
461
|
+
add(options: MarkerOptions): Entity;
|
|
462
|
+
updatePosition(entity: Entity, position: OverlayPosition): void;
|
|
463
|
+
updateStyle(entity: Entity, options: Partial<Pick<MarkerOptions, 'color' | 'outlineColor' | 'outlineWidth' | 'pixelSize'>>): void;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
export declare class MapLabel {
|
|
467
|
+
constructor(viewer: Viewer);
|
|
468
|
+
add(options: LabelOptions): Entity;
|
|
469
|
+
updatePosition(entity: Entity, position: OverlayPosition): void;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
export declare class MapIcon {
|
|
473
|
+
constructor(viewer: Viewer);
|
|
474
|
+
add(options: IconOptions): Entity;
|
|
475
|
+
updatePosition(entity: Entity, position: OverlayPosition): void;
|
|
476
|
+
updateImage(entity: Entity, image: string): void;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
export declare class MapSVG {
|
|
480
|
+
constructor(viewer: Viewer);
|
|
481
|
+
add(options: SvgOptions): Entity;
|
|
482
|
+
updatePosition(entity: Entity, position: OverlayPosition): void;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
export declare class MapPolyline {
|
|
486
|
+
constructor(viewer: Viewer);
|
|
487
|
+
add(options: PolylineOptions): Entity;
|
|
488
|
+
updatePositions(entity: Entity, positions: OverlayPosition[]): void;
|
|
489
|
+
updateStyle(entity: Entity, options: Partial<Pick<PolylineOptions, 'width' | 'material'>>): void;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
export declare class MapPolygon {
|
|
493
|
+
constructor(viewer: Viewer);
|
|
494
|
+
add(options: PolygonOptions): Entity;
|
|
495
|
+
updatePositions(entity: Entity, positions: OverlayPosition[]): void;
|
|
496
|
+
updateStyle(entity: Entity, options: Partial<Pick<PolygonOptions, 'material' | 'outline' | 'outlineColor' | 'outlineWidth'>>): void;
|
|
497
|
+
remove(entityOrId: Entity | string): boolean;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
export declare class MapRectangle {
|
|
501
|
+
constructor(viewer: Viewer);
|
|
502
|
+
add(options: RectangleOptions): Entity;
|
|
503
|
+
updateCoordinates(entity: Entity, coordinates: Cesium.Rectangle): void;
|
|
504
|
+
updateStyle(entity: Entity, options: Partial<Pick<RectangleOptions, 'material' | 'outline' | 'outlineColor' | 'outlineWidth'>>): void;
|
|
505
|
+
remove(entityOrId: Entity | string): boolean;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
export declare class MapCircle {
|
|
509
|
+
constructor(viewer: Viewer);
|
|
510
|
+
add(options: CircleOptions): Entity;
|
|
511
|
+
updatePosition(entity: Entity, position: OverlayPosition): void;
|
|
512
|
+
updateRadius(entity: Entity, radius: number): void;
|
|
513
|
+
updateStyle(entity: Entity, options: Partial<Pick<CircleOptions, 'material' | 'outline' | 'outlineColor' | 'outlineWidth'>>): void;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
// toolbar: 相机控制器及服务(与工具栏相关类保持一致)
|
|
517
|
+
export interface MapInitialCenter {
|
|
518
|
+
longitude: number;
|
|
519
|
+
latitude: number;
|
|
520
|
+
height: number;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
export interface CesiumMapControllerOptions {
|
|
524
|
+
initialCenter?: MapInitialCenter;
|
|
525
|
+
getMapTypes?: () => MapType[];
|
|
526
|
+
getCurrentMapTypeId?: () => string;
|
|
527
|
+
getToken?: () => string;
|
|
528
|
+
zoomCallback?: ZoomCallback;
|
|
529
|
+
onSceneModeChanged?: () => void;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
export declare class CesiumMapController {
|
|
533
|
+
constructor(viewer: Viewer, options?: CesiumMapControllerOptions);
|
|
534
|
+
setupCameraZoomLimitListener(): void;
|
|
535
|
+
getCurrentZoomLevel(): number;
|
|
536
|
+
setZoomLevel(zoomLevel: number): void;
|
|
537
|
+
zoomIn(): void;
|
|
538
|
+
zoomOut(): void;
|
|
539
|
+
toggle2D3D(buttonElement: HTMLElement): void;
|
|
540
|
+
resetLocation(): void;
|
|
541
|
+
setInitialCenter(center: MapInitialCenter): void;
|
|
542
|
+
getInitialCenter(): MapInitialCenter | undefined;
|
|
543
|
+
toggleFullscreen(): void;
|
|
544
|
+
isFullscreen(): boolean;
|
|
545
|
+
enterFullscreen(): void;
|
|
546
|
+
exitFullscreen(): void;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
export interface MapLayersServiceConfig {
|
|
550
|
+
mapTypes: MapType[];
|
|
551
|
+
currentMapType: string;
|
|
552
|
+
token: string;
|
|
553
|
+
isNoFlyZoneChecked: boolean;
|
|
554
|
+
isNoFlyZoneVisible: boolean;
|
|
555
|
+
onMapTypeChange?: (mapTypeId: string) => void;
|
|
556
|
+
onNoFlyZoneToggle?: (isChecked: boolean) => void;
|
|
557
|
+
onShowNoFlyZones?: () => Promise<void> | void;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
export declare class MapLayersService {
|
|
561
|
+
constructor(viewer: Viewer, toolbarElement: HTMLElement, config: MapLayersServiceConfig);
|
|
562
|
+
updateConfig(config: Partial<MapLayersServiceConfig>): void;
|
|
563
|
+
toggleLayers(buttonElement: HTMLElement): void;
|
|
564
|
+
switchMapType(mapTypeId: string): void;
|
|
565
|
+
getCurrentMapType(): string;
|
|
566
|
+
closeLayersMenu(): void;
|
|
567
|
+
destroy(): void;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
export declare class SearchService {
|
|
571
|
+
constructor(viewer: Viewer, toolbarElement: HTMLElement, searchCallback?: SearchCallback);
|
|
572
|
+
setSearchCallback(callback: SearchCallback): void;
|
|
573
|
+
toggleSearch(buttonElement: HTMLElement): void;
|
|
574
|
+
displaySearchResults(results: SearchResult[], container: HTMLElement): void;
|
|
575
|
+
selectSearchResult(result: SearchResult): void;
|
|
576
|
+
closeSearchContainer(): void;
|
|
577
|
+
destroy(): void;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
export interface NotFlyZonesServiceConfig {
|
|
581
|
+
extrudedHeight?: number;
|
|
582
|
+
autoLoad?: boolean;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
export declare class NotFlyZonesService {
|
|
586
|
+
constructor(viewer: Viewer, config?: NotFlyZonesServiceConfig);
|
|
587
|
+
showNoFlyZones(): Promise<void>;
|
|
588
|
+
hideNoFlyZones(): void;
|
|
589
|
+
toggleNoFlyZones(): Promise<void>;
|
|
590
|
+
getNoFlyZoneVisible(): boolean;
|
|
591
|
+
destroy(): void;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
// 工具栏按钮默认配置与排序(来自 MapToolBarConfig.ts)
|
|
595
|
+
export declare const defaultButtonSorts: Record<string, number>;
|
|
596
|
+
export declare const defaultButtons: ButtonConfig[];
|
|
597
|
+
|
|
252
598
|
// 绘制相关类型(与内部实现保持一致)
|
|
599
|
+
// 绘制底层工具类型(与 drawHelper/BaseDraw.ts 保持一致)
|
|
600
|
+
export interface DrawResult {
|
|
601
|
+
entity: Entity | null;
|
|
602
|
+
type: 'line' | 'polygon' | 'rectangle' | 'circle';
|
|
603
|
+
positions: Cartesian3[];
|
|
604
|
+
distance?: number;
|
|
605
|
+
areaKm2?: number;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
export interface DrawCallbacks {
|
|
609
|
+
onDrawStart?: () => void;
|
|
610
|
+
onDrawEnd?: (entity: Entity | null) => void;
|
|
611
|
+
onEntityRemoved?: (entity: Entity) => void;
|
|
612
|
+
onMeasureComplete?: (result: DrawResult) => void;
|
|
613
|
+
}
|
|
614
|
+
|
|
253
615
|
export interface DrawOptions {
|
|
254
|
-
strokeColor?:
|
|
616
|
+
strokeColor?: Cesium.Color | string;
|
|
255
617
|
strokeWidth?: number;
|
|
256
|
-
fillColor?:
|
|
257
|
-
outlineColor?:
|
|
618
|
+
fillColor?: Cesium.Color | string;
|
|
619
|
+
outlineColor?: Cesium.Color | string;
|
|
258
620
|
outlineWidth?: number;
|
|
621
|
+
heightEpsilon?: number;
|
|
259
622
|
selected?: {
|
|
260
|
-
color?:
|
|
623
|
+
color?: Cesium.Color | string;
|
|
261
624
|
width?: number;
|
|
262
|
-
outlineColor?:
|
|
625
|
+
outlineColor?: Cesium.Color | string;
|
|
263
626
|
outlineWidth?: number;
|
|
264
627
|
};
|
|
265
628
|
onClick?: (entity: Entity, type?: 'line' | 'polygon' | 'rectangle' | 'circle', positions?: Cartesian3[]) => void;
|
|
266
629
|
}
|
|
267
630
|
|
|
268
|
-
export interface DrawResult {
|
|
269
|
-
entity: Entity | null;
|
|
270
|
-
type: 'line' | 'polygon' | 'rectangle' | 'circle';
|
|
271
|
-
positions: Cartesian3[];
|
|
272
|
-
distance?: number;
|
|
273
|
-
areaKm2?: number;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
631
|
export declare class DrawHelper {
|
|
277
632
|
constructor(viewer: Viewer);
|
|
278
633
|
// 开始绘制(可选样式参数)
|
|
@@ -299,6 +654,61 @@ export declare class DrawHelper {
|
|
|
299
654
|
destroy(): void;
|
|
300
655
|
}
|
|
301
656
|
|
|
657
|
+
// 底层抽象绘制类及具体实现(通过 `export * from './libs/drawHelper/index'` 暴露)
|
|
658
|
+
export declare abstract class BaseDraw {
|
|
659
|
+
protected viewer: Viewer;
|
|
660
|
+
protected scene: Cesium.Scene;
|
|
661
|
+
protected entities: Cesium.EntityCollection;
|
|
662
|
+
protected offsetHeight: number;
|
|
663
|
+
protected originalDepthTestAgainstTerrain: boolean | null;
|
|
664
|
+
protected originalRequestRenderMode: boolean | null;
|
|
665
|
+
protected callbacks: DrawCallbacks;
|
|
666
|
+
protected tempPositions: Cartesian3[];
|
|
667
|
+
protected tempEntities: Entity[];
|
|
668
|
+
protected tempLabelEntities: Entity[];
|
|
669
|
+
protected finishedPointEntities: Entity[];
|
|
670
|
+
protected drawOptions?: DrawOptions;
|
|
671
|
+
protected resolveColor(input?: Cesium.Color | string): Cesium.Color;
|
|
672
|
+
protected applySelectedStyleToEntity(entity: Entity): void;
|
|
673
|
+
protected restoreOriginalStyleForEntity(entity: Entity): void;
|
|
674
|
+
protected updateOffsetHeight(): void;
|
|
675
|
+
protected pickGlobePosition(windowPosition: Cesium.Cartesian2): Cartesian3 | null;
|
|
676
|
+
protected rememberOriginalRequestRenderModeIfNeeded(): void;
|
|
677
|
+
protected restoreRequestRenderModeIfNeeded(): void;
|
|
678
|
+
abstract updateDrawingEntity(previewPoint?: Cartesian3): void;
|
|
679
|
+
abstract startDrawing(options?: DrawOptions): void;
|
|
680
|
+
abstract finishDrawing(): DrawResult | null;
|
|
681
|
+
abstract getDrawType(): 'line' | 'polygon' | 'rectangle' | 'circle';
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
export declare class DrawLine extends BaseDraw {
|
|
685
|
+
updateDrawingEntity(previewPoint?: Cartesian3): void;
|
|
686
|
+
startDrawing(options?: DrawOptions): void;
|
|
687
|
+
finishDrawing(): DrawResult | null;
|
|
688
|
+
getDrawType(): 'line';
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
export declare class DrawPolygon extends BaseDraw {
|
|
692
|
+
updateDrawingEntity(previewPoint?: Cartesian3): void;
|
|
693
|
+
startDrawing(options?: DrawOptions): void;
|
|
694
|
+
finishDrawing(): DrawResult | null;
|
|
695
|
+
getDrawType(): 'polygon';
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
export declare class DrawRectangle extends BaseDraw {
|
|
699
|
+
updateDrawingEntity(previewPoint?: Cartesian3): void;
|
|
700
|
+
startDrawing(options?: DrawOptions): void;
|
|
701
|
+
finishDrawing(): DrawResult | null;
|
|
702
|
+
getDrawType(): 'rectangle';
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
export declare class DrawCircle extends BaseDraw {
|
|
706
|
+
updateDrawingEntity(previewPoint?: Cartesian3): void;
|
|
707
|
+
startDrawing(options?: DrawOptions): void;
|
|
708
|
+
finishDrawing(): DrawResult | null;
|
|
709
|
+
getDrawType(): 'circle';
|
|
710
|
+
}
|
|
711
|
+
|
|
302
712
|
export declare function initCesium(
|
|
303
713
|
containerId: string,
|
|
304
714
|
options: InitOptions,
|