@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.
- package/dist/hooks/toolBarConfig.d.ts +6 -3
- package/dist/hooks/useDrawHelper.d.ts +65 -0
- package/dist/hooks/useHeatmapHelper.d.ts +34 -0
- package/dist/hooks/useOverlayHelper.d.ts +212 -0
- package/dist/index.d.ts +664 -36
- package/dist/index.js +5078 -1840
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +215 -128
- package/dist/index.umd.js.map +1 -1
- package/dist/libs/CesiumHeatmapLayer.d.ts +109 -0
- package/dist/libs/{CesiumMapHelper.d.ts → CesiumMapDraw.d.ts} +34 -51
- package/dist/libs/CesiumMapLoader.d.ts +11 -2
- package/dist/libs/CesiumMapModel.d.ts +5 -2
- package/dist/libs/CesiumMapToolbar.d.ts +23 -67
- package/dist/libs/CesiumOverlayService.d.ts +117 -0
- package/dist/libs/{CesiumMapConfig.d.ts → config/CesiumMapConfig.d.ts} +3 -3
- package/dist/libs/drawHelper/BaseDraw.d.ts +170 -0
- package/dist/libs/drawHelper/DrawCircle.d.ts +30 -0
- package/dist/libs/drawHelper/DrawLine.d.ts +44 -0
- package/dist/libs/drawHelper/DrawPolgon.d.ts +29 -0
- package/dist/libs/drawHelper/DrawRectangle.d.ts +24 -0
- package/dist/libs/drawHelper/index.d.ts +5 -0
- package/dist/libs/overlay/MapCircle.d.ts +64 -0
- package/dist/libs/overlay/MapIcon.d.ts +59 -0
- package/dist/libs/overlay/MapInfoWindow.d.ts +100 -0
- package/dist/libs/overlay/MapLabel.d.ts +63 -0
- package/dist/libs/overlay/MapMarker.d.ts +50 -0
- package/dist/libs/overlay/MapPolygon.d.ts +70 -0
- package/dist/libs/overlay/MapPolyline.d.ts +50 -0
- package/dist/libs/overlay/MapRectangle.d.ts +56 -0
- package/dist/libs/overlay/MapRing.d.ts +95 -0
- package/dist/libs/overlay/MapSVG.d.ts +63 -0
- package/dist/libs/overlay/index.d.ts +22 -0
- package/dist/libs/overlay/types.d.ts +41 -0
- package/dist/libs/toolBar/CesiumMapController.d.ts +78 -0
- package/dist/libs/toolBar/MapLayersService.d.ts +67 -0
- package/dist/libs/toolBar/MapSearchService.d.ts +41 -0
- package/dist/libs/toolBar/MapToolBarConfig.d.ts +3 -0
- package/dist/libs/toolBar/MeasurementService.d.ts +16 -0
- package/dist/libs/toolBar/NotFlyZonesService.d.ts +46 -0
- package/dist/package.json +5 -5
- package/dist/utils/calc.d.ts +44 -0
- package/dist/utils/common.d.ts +1 -0
- package/dist/z.const.d.ts +24 -0
- package/package.json +7 -7
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import * as Cesium from "cesium";
|
|
2
|
+
export interface HeatPoint {
|
|
3
|
+
/** 经度(度) */
|
|
4
|
+
lon: number;
|
|
5
|
+
/** 纬度(度) */
|
|
6
|
+
lat: number;
|
|
7
|
+
/** 强度值,用于控制热度(0~maxValue) */
|
|
8
|
+
value: number;
|
|
9
|
+
}
|
|
10
|
+
export interface HeatmapGradient {
|
|
11
|
+
/**
|
|
12
|
+
* 0~1 的比例到颜色字符串的映射,例如:
|
|
13
|
+
* { 0.0: "#0000ff", 0.5: "#ffff00", 1.0: "#ff0000" }
|
|
14
|
+
*/
|
|
15
|
+
[stop: number]: string;
|
|
16
|
+
}
|
|
17
|
+
export interface HeatmapOptions {
|
|
18
|
+
/** Canvas 分辨率,越大越清晰但开销越大 */
|
|
19
|
+
width?: number;
|
|
20
|
+
height?: number;
|
|
21
|
+
/** 单个点的影响半径(像素) */
|
|
22
|
+
radius?: number;
|
|
23
|
+
/** 最小/最大值,用于归一化 value,如果不传则自动根据数据计算 */
|
|
24
|
+
minValue?: number;
|
|
25
|
+
maxValue?: number;
|
|
26
|
+
/** 全局不透明度 0~1 */
|
|
27
|
+
opacity?: number;
|
|
28
|
+
/** 颜色梯度 */
|
|
29
|
+
gradient?: HeatmapGradient;
|
|
30
|
+
}
|
|
31
|
+
export interface HeatmapAutoUpdateOptions {
|
|
32
|
+
/** 是否启用随视角变化自动重绘(默认 true) */
|
|
33
|
+
enabled?: boolean;
|
|
34
|
+
/** 视域范围 padding(比例,默认 0.15) */
|
|
35
|
+
viewPaddingRatio?: number;
|
|
36
|
+
/** 聚合网格边长(米)。不传则根据相机高度自动估算 */
|
|
37
|
+
cellSizeMeters?: number;
|
|
38
|
+
/** 根据相机高度(米)动态返回网格边长(米)。优先级高于 cellSizeMeters */
|
|
39
|
+
cellSizeMetersByHeight?: (cameraHeightMeters: number) => number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Cesium 热力图图层封装
|
|
43
|
+
* - 使用离屏 Canvas 绘制热力图
|
|
44
|
+
* - 通过 SingleTileImageryProvider 叠加到地球上
|
|
45
|
+
*/
|
|
46
|
+
export default class CesiumHeatmapLayer {
|
|
47
|
+
private viewer;
|
|
48
|
+
private imageryLayer;
|
|
49
|
+
private rectangle;
|
|
50
|
+
private canvas;
|
|
51
|
+
private ctx;
|
|
52
|
+
private options;
|
|
53
|
+
private data;
|
|
54
|
+
private gradientLUT;
|
|
55
|
+
private autoUpdateEnabled;
|
|
56
|
+
private autoUpdateOptions;
|
|
57
|
+
private removeMoveEndListener;
|
|
58
|
+
private aggregateWorker;
|
|
59
|
+
private workerReady;
|
|
60
|
+
private pendingUpdate;
|
|
61
|
+
private lastUpdateKey;
|
|
62
|
+
constructor(viewer: Cesium.Viewer, options?: HeatmapOptions);
|
|
63
|
+
/**
|
|
64
|
+
* 设置/替换热力图数据(度为单位)
|
|
65
|
+
*/
|
|
66
|
+
setData(points: HeatPoint[]): void;
|
|
67
|
+
/**
|
|
68
|
+
* 更新调色板
|
|
69
|
+
*/
|
|
70
|
+
setGradient(gradient: HeatmapGradient): void;
|
|
71
|
+
/**
|
|
72
|
+
* 设置透明度
|
|
73
|
+
*/
|
|
74
|
+
setOpacity(opacity: number): void;
|
|
75
|
+
/**
|
|
76
|
+
* 显隐控制
|
|
77
|
+
*/
|
|
78
|
+
setVisible(visible: boolean): void;
|
|
79
|
+
/**
|
|
80
|
+
* 销毁并移除图层
|
|
81
|
+
*/
|
|
82
|
+
destroy(): void;
|
|
83
|
+
/**
|
|
84
|
+
* 启用/关闭基于视域与缩放的自动聚合重绘(方格聚合 + moveEnd + WebWorker)。
|
|
85
|
+
* - 启用后:热力图仅渲染当前视域范围内的聚合结果,缩放/平移后自动更新。
|
|
86
|
+
* - 关闭后:回退为 setData() 时按全量范围绘制一张 SingleTile。
|
|
87
|
+
*/
|
|
88
|
+
setAutoUpdate(options?: HeatmapAutoUpdateOptions): void;
|
|
89
|
+
stopAutoUpdate(): void;
|
|
90
|
+
private clearLayer;
|
|
91
|
+
private startAutoUpdateInternal;
|
|
92
|
+
private requestAutoUpdate;
|
|
93
|
+
private getPaddedViewRectangleDegrees;
|
|
94
|
+
private ensureWorker;
|
|
95
|
+
private pushDataToWorker;
|
|
96
|
+
/**
|
|
97
|
+
* 构建颜色查找表(0-255 -> RGBA)
|
|
98
|
+
*/
|
|
99
|
+
private buildGradientLUT;
|
|
100
|
+
/**
|
|
101
|
+
* 在离屏 canvas 上绘制热力图,并更新到 Cesium 图层
|
|
102
|
+
*/
|
|
103
|
+
private renderHeatmap;
|
|
104
|
+
/**
|
|
105
|
+
* 将当前 canvas 映射为 Cesium 影像图层
|
|
106
|
+
*/
|
|
107
|
+
private updateImageryLayer;
|
|
108
|
+
}
|
|
109
|
+
export { CesiumHeatmapLayer };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DrawOptions } from './drawHelper';
|
|
1
2
|
import * as Cesium from "cesium";
|
|
2
3
|
/**
|
|
3
4
|
* Cesium 绘图辅助工具类
|
|
@@ -8,7 +9,6 @@ declare class DrawHelper {
|
|
|
8
9
|
private viewer;
|
|
9
10
|
private scene;
|
|
10
11
|
private entities;
|
|
11
|
-
private frustumPrimitives;
|
|
12
12
|
private drawMode;
|
|
13
13
|
private isDrawing;
|
|
14
14
|
private tempPositions;
|
|
@@ -19,19 +19,30 @@ declare class DrawHelper {
|
|
|
19
19
|
private finishedPointEntities;
|
|
20
20
|
private publicEntities;
|
|
21
21
|
private _doubleClickPending;
|
|
22
|
-
private
|
|
23
|
-
private
|
|
24
|
-
private
|
|
22
|
+
private lastPreviewPosition;
|
|
23
|
+
private static activeDrawingHelper;
|
|
24
|
+
private drawLine;
|
|
25
|
+
private drawPolygon;
|
|
26
|
+
private drawRectangle;
|
|
27
|
+
private drawCircle;
|
|
28
|
+
private currentDrawer;
|
|
25
29
|
private screenSpaceEventHandler;
|
|
30
|
+
private entityClickHandler;
|
|
26
31
|
private onDrawStartCallback;
|
|
27
32
|
private onDrawEndCallback;
|
|
28
33
|
private onEntityRemovedCallback;
|
|
34
|
+
private onMeasureCompleteCallback;
|
|
29
35
|
private offsetHeight;
|
|
36
|
+
private originalDepthTestAgainstTerrain;
|
|
30
37
|
/**
|
|
31
38
|
* 构造函数
|
|
32
39
|
* @param viewer Cesium Viewer 实例
|
|
33
40
|
*/
|
|
34
41
|
constructor(viewer: Cesium.Viewer);
|
|
42
|
+
/**
|
|
43
|
+
* 外部调用:在场景模式(2D/3D)切换后,更新偏移高度并重算已完成实体
|
|
44
|
+
*/
|
|
45
|
+
handleSceneModeChanged(): void;
|
|
35
46
|
/**
|
|
36
47
|
* 根据场景模式更新偏移高度
|
|
37
48
|
*/
|
|
@@ -39,15 +50,19 @@ declare class DrawHelper {
|
|
|
39
50
|
/**
|
|
40
51
|
* 开始绘制线条
|
|
41
52
|
*/
|
|
42
|
-
startDrawingLine(): void;
|
|
53
|
+
startDrawingLine(options?: DrawOptions): void;
|
|
43
54
|
/**
|
|
44
55
|
* 开始绘制多边形(仅边线)
|
|
45
56
|
*/
|
|
46
|
-
startDrawingPolygon(): void;
|
|
57
|
+
startDrawingPolygon(options?: DrawOptions): void;
|
|
47
58
|
/**
|
|
48
59
|
* 开始绘制矩形
|
|
49
60
|
*/
|
|
50
|
-
startDrawingRectangle(): void;
|
|
61
|
+
startDrawingRectangle(options?: DrawOptions): void;
|
|
62
|
+
/**
|
|
63
|
+
* 开始绘制圆形
|
|
64
|
+
*/
|
|
65
|
+
startDrawingCircle(options?: DrawOptions): void;
|
|
51
66
|
/**
|
|
52
67
|
* 内部统一的开始绘制方法
|
|
53
68
|
* @param mode 绘制模式
|
|
@@ -72,11 +87,6 @@ declare class DrawHelper {
|
|
|
72
87
|
* 删除最后一个添加的点及其相关的临时实体
|
|
73
88
|
*/
|
|
74
89
|
private removeLastPoint;
|
|
75
|
-
/**
|
|
76
|
-
* 重新创建剩余的点实体和绘制实体
|
|
77
|
-
* 用于右键删除点后的重建
|
|
78
|
-
*/
|
|
79
|
-
private recreateRemainingEntities;
|
|
80
90
|
/**
|
|
81
91
|
* 更新预览线/面
|
|
82
92
|
* @param currentMousePosition 当前鼠标位置世界坐标
|
|
@@ -100,6 +110,12 @@ declare class DrawHelper {
|
|
|
100
110
|
* 公共方法:结束当前绘制(如果正在进行)
|
|
101
111
|
*/
|
|
102
112
|
endDrawing(): void;
|
|
113
|
+
/**
|
|
114
|
+
* 公共方法:取消当前正在进行的绘制(不触发完成回调,不生成实体)
|
|
115
|
+
* 主要用于在外部开启新的绘制前,保证旧的未完成绘制被安全终止,
|
|
116
|
+
* 避免同时存在多个绘制事件处理器。
|
|
117
|
+
*/
|
|
118
|
+
cancelDrawing(): void;
|
|
103
119
|
/**
|
|
104
120
|
* 销毁事件处理器
|
|
105
121
|
*/
|
|
@@ -128,17 +144,12 @@ declare class DrawHelper {
|
|
|
128
144
|
* @returns 实体数组
|
|
129
145
|
*/
|
|
130
146
|
getFinishedEntities(): Cesium.Entity[];
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
* 超过1000m时转换为km,保留两位小数
|
|
138
|
-
* @param distance 距离(米)
|
|
139
|
-
* @returns 格式化后的距离字符串
|
|
140
|
-
*/
|
|
141
|
-
private formatDistance;
|
|
147
|
+
onMeasureComplete(callback: (result: {
|
|
148
|
+
type: "line" | "polygon" | "rectangle" | "circle";
|
|
149
|
+
positions: Cesium.Cartesian3[];
|
|
150
|
+
distance?: number;
|
|
151
|
+
areaKm2?: number;
|
|
152
|
+
}) => void): void;
|
|
142
153
|
/**
|
|
143
154
|
* 设置开始绘制时的回调函数
|
|
144
155
|
* @param callback 回调函数
|
|
@@ -154,34 +165,6 @@ declare class DrawHelper {
|
|
|
154
165
|
* @param callback 回调函数,参数为被移除的实体
|
|
155
166
|
*/
|
|
156
167
|
onEntityRemoved(callback: (entity: Cesium.Entity) => void): void;
|
|
157
|
-
/**
|
|
158
|
-
* 绘制监控圆形区域
|
|
159
|
-
* @param longitude 经度
|
|
160
|
-
* @param latitude 纬度
|
|
161
|
-
* @param height 高度
|
|
162
|
-
* @param radius 监控范围半径(米)
|
|
163
|
-
* @param options 可选配置
|
|
164
|
-
*/
|
|
165
|
-
drawMonitoringCircle(longitude: number, latitude: number, height: number, radius: number, options?: {
|
|
166
|
-
borderColor?: string;
|
|
167
|
-
fillColor?: string;
|
|
168
|
-
borderWidth?: number;
|
|
169
|
-
name?: string;
|
|
170
|
-
}): Cesium.Entity;
|
|
171
|
-
/**
|
|
172
|
-
* 绘制垂直线条
|
|
173
|
-
* @param longitude 经度
|
|
174
|
-
* @param latitude 纬度
|
|
175
|
-
* @param height 高度
|
|
176
|
-
* @param options 可选配置
|
|
177
|
-
*/
|
|
178
|
-
drawVerticalLine(longitude: number, latitude: number, height: number, options?: {
|
|
179
|
-
color?: string;
|
|
180
|
-
width?: number;
|
|
181
|
-
dashPattern?: number;
|
|
182
|
-
name?: string;
|
|
183
|
-
groundHeight?: number;
|
|
184
|
-
}): Cesium.Entity;
|
|
185
168
|
/**
|
|
186
169
|
* 更新所有已完成实体以适应场景模式变化
|
|
187
170
|
* 当从2D切换到3D或从3D切换到2D时,需要更新实体的高度参考和位置
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Viewer as CesiumViewer, Terrain, TerrainProvider } from '../../node_modules/cesium';
|
|
2
2
|
import * as Cesium from 'cesium';
|
|
3
3
|
interface InitOptions {
|
|
4
4
|
terrain?: Terrain;
|
|
@@ -20,6 +20,7 @@ interface InitOptions {
|
|
|
20
20
|
timeline?: boolean;
|
|
21
21
|
animation?: boolean;
|
|
22
22
|
isFly?: boolean;
|
|
23
|
+
flyDuration?: number;
|
|
23
24
|
baseLayerPicker?: boolean;
|
|
24
25
|
navigationInstructionsInitiallyVisible?: boolean;
|
|
25
26
|
clock?: Cesium.Clock;
|
|
@@ -35,10 +36,16 @@ interface InitOptions {
|
|
|
35
36
|
resolutionScale?: number;
|
|
36
37
|
orderIndependentTransparency?: boolean;
|
|
37
38
|
shadows?: boolean;
|
|
39
|
+
depthTestAgainstTerrain?: boolean;
|
|
38
40
|
terrainExaggeration?: number;
|
|
39
41
|
maximumScreenSpaceError?: number;
|
|
40
42
|
maximumNumberOfLoadedTiles?: number;
|
|
43
|
+
requestRenderMode?: boolean;
|
|
41
44
|
token?: string;
|
|
45
|
+
cesiumToken?: string;
|
|
46
|
+
success?: () => void;
|
|
47
|
+
cancel?: () => void;
|
|
48
|
+
mapCenter?: MapCenter;
|
|
42
49
|
}
|
|
43
50
|
interface MapCenter {
|
|
44
51
|
latitude: number;
|
|
@@ -47,7 +54,9 @@ interface MapCenter {
|
|
|
47
54
|
pitch?: number;
|
|
48
55
|
heading?: number;
|
|
49
56
|
}
|
|
50
|
-
export declare
|
|
57
|
+
export declare const setCameraView: (viewer: CesiumViewer, center: MapCenter) => void;
|
|
58
|
+
export declare const setCameraFlyTo: (viewer: CesiumViewer, center: MapCenter, options: InitOptions) => void;
|
|
59
|
+
export declare function initCesium(containerId: string, options: InitOptions, mapCenterOrCesiumToken?: MapCenter | string, cesiumToken?: string): Promise<{
|
|
51
60
|
viewer: CesiumViewer;
|
|
52
61
|
initialCenter: MapCenter;
|
|
53
62
|
}>;
|
|
@@ -13,6 +13,7 @@ export interface ToolbarConfig {
|
|
|
13
13
|
buttons?: CustomButtonConfig[];
|
|
14
14
|
}
|
|
15
15
|
export interface ButtonConfig {
|
|
16
|
+
sort?: number;
|
|
16
17
|
id: string;
|
|
17
18
|
icon: string;
|
|
18
19
|
title: string;
|
|
@@ -42,6 +43,7 @@ export interface CustomButtonConfig {
|
|
|
42
43
|
hoverColor?: string;
|
|
43
44
|
activeColor?: string;
|
|
44
45
|
backgroundColor?: string;
|
|
46
|
+
sort?: number;
|
|
45
47
|
activeIcon?: string | HTMLElement | false;
|
|
46
48
|
callback?: () => void;
|
|
47
49
|
onClick?: (buttonId: string, buttonElement: HTMLElement) => void;
|
|
@@ -60,13 +62,14 @@ export interface SearchResult {
|
|
|
60
62
|
height?: number;
|
|
61
63
|
}
|
|
62
64
|
export interface MeasurementCallback {
|
|
65
|
+
onMeasurementStart?: (positions?: Cartesian3[]) => void;
|
|
63
66
|
onDistanceComplete?: (positions: Cartesian3[], distance: number) => void;
|
|
64
67
|
onAreaComplete?: (positions: Cartesian3[], area: number) => void;
|
|
65
68
|
onClear?: () => void;
|
|
66
69
|
}
|
|
67
70
|
export interface ZoomCallback {
|
|
68
|
-
onZoomIn?: (
|
|
69
|
-
onZoomOut?: (
|
|
71
|
+
onZoomIn?: (beforeHeight: number, afterHeight: number, currentLevel: number) => void;
|
|
72
|
+
onZoomOut?: (beforeHeight: number, afterHeight: number, currentLevel: number) => void;
|
|
70
73
|
}
|
|
71
74
|
export interface MapType {
|
|
72
75
|
id: string;
|
|
@@ -10,17 +10,22 @@ export declare class CesiumMapToolbar {
|
|
|
10
10
|
private container;
|
|
11
11
|
private toolbarElement;
|
|
12
12
|
private config;
|
|
13
|
-
private
|
|
13
|
+
private searchService;
|
|
14
|
+
private mapLayersService;
|
|
15
|
+
private notFlyZonesService;
|
|
14
16
|
private measurementCallback?;
|
|
15
17
|
private zoomCallback?;
|
|
16
18
|
private initialCenter?;
|
|
17
|
-
private isFullscreen;
|
|
18
19
|
private currentMapType;
|
|
19
20
|
TD_Token: string;
|
|
20
21
|
mapTypes: MapType[];
|
|
21
|
-
private
|
|
22
|
-
private isNoFlyZoneVisible;
|
|
22
|
+
private isNoFlyZoneChecked;
|
|
23
23
|
private currentGeoWTFS;
|
|
24
|
+
private measurementService;
|
|
25
|
+
readonly measurement: {
|
|
26
|
+
getMeasureMode: () => "none" | "distance" | "area";
|
|
27
|
+
};
|
|
28
|
+
private mapController;
|
|
24
29
|
constructor(viewer: Viewer, container: HTMLElement, config?: ToolbarConfig, callbacks?: {
|
|
25
30
|
search?: SearchCallback;
|
|
26
31
|
measurement?: MeasurementCallback;
|
|
@@ -58,37 +63,31 @@ export declare class CesiumMapToolbar {
|
|
|
58
63
|
updateButtonConfig(buttonId: string, config: Partial<CustomButtonConfig>): void;
|
|
59
64
|
/**
|
|
60
65
|
* 添加自定义按钮
|
|
66
|
+
* @param config 按钮配置,支持 sort 参数控制插入位置
|
|
61
67
|
*/
|
|
62
68
|
addCustomButton(config: CustomButtonConfig): void;
|
|
63
69
|
/**
|
|
64
|
-
*
|
|
65
|
-
*/
|
|
66
|
-
removeButton(buttonId: string): void;
|
|
67
|
-
/**
|
|
68
|
-
* 获取按钮元素
|
|
70
|
+
* 获取所有按钮配置(包括默认按钮和自定义按钮),并添加 sort 值
|
|
69
71
|
*/
|
|
70
|
-
|
|
72
|
+
private getAllButtonsWithSort;
|
|
71
73
|
/**
|
|
72
|
-
*
|
|
74
|
+
* 重新构建工具栏按钮
|
|
73
75
|
*/
|
|
74
|
-
private
|
|
76
|
+
private rebuildToolbarButtons;
|
|
75
77
|
/**
|
|
76
|
-
*
|
|
77
|
-
* 超过1000m时转换为km,保留两位小数
|
|
78
|
-
* @param distance 距离(米)
|
|
79
|
-
* @returns 格式化后的距离字符串
|
|
78
|
+
* 移除按钮
|
|
80
79
|
*/
|
|
81
|
-
|
|
80
|
+
removeButton(buttonId: string): void;
|
|
82
81
|
/**
|
|
83
|
-
*
|
|
82
|
+
* 获取按钮元素
|
|
84
83
|
*/
|
|
85
|
-
private
|
|
84
|
+
private setupDrawHelperCallbacks;
|
|
86
85
|
/**
|
|
87
86
|
* 创建工具栏
|
|
88
87
|
*/
|
|
89
88
|
private createToolbar;
|
|
90
89
|
/**
|
|
91
|
-
*
|
|
90
|
+
* 获取按钮配置(已排序)
|
|
92
91
|
*/
|
|
93
92
|
private getButtonConfigs;
|
|
94
93
|
/**
|
|
@@ -127,18 +126,6 @@ export declare class CesiumMapToolbar {
|
|
|
127
126
|
* 处理按钮点击
|
|
128
127
|
*/
|
|
129
128
|
private handleButtonClick;
|
|
130
|
-
/**
|
|
131
|
-
* 切换搜索功能
|
|
132
|
-
*/
|
|
133
|
-
private toggleSearch;
|
|
134
|
-
/**
|
|
135
|
-
* 显示搜索结果
|
|
136
|
-
*/
|
|
137
|
-
private displaySearchResults;
|
|
138
|
-
/**
|
|
139
|
-
* 选择搜索结果
|
|
140
|
-
*/
|
|
141
|
-
private selectSearchResult;
|
|
142
129
|
/**
|
|
143
130
|
* 切换测量功能
|
|
144
131
|
*/
|
|
@@ -151,28 +138,10 @@ export declare class CesiumMapToolbar {
|
|
|
151
138
|
* 切换2D/3D视图
|
|
152
139
|
*/
|
|
153
140
|
private toggle2D3D;
|
|
154
|
-
/**
|
|
155
|
-
* 切换图层
|
|
156
|
-
*/
|
|
157
|
-
private toggleLayers;
|
|
158
|
-
/**
|
|
159
|
-
* 切换地图类型
|
|
160
|
-
*/
|
|
161
|
-
private switchMapType;
|
|
162
141
|
/**
|
|
163
142
|
* 复位到初始位置
|
|
164
143
|
*/
|
|
165
144
|
private resetLocation;
|
|
166
|
-
/**
|
|
167
|
-
* 获取当前地图层级
|
|
168
|
-
* @returns 当前层级(1-18)
|
|
169
|
-
*/
|
|
170
|
-
private getCurrentZoomLevel;
|
|
171
|
-
/**
|
|
172
|
-
* 设置地图层级
|
|
173
|
-
* @param zoomLevel 目标层级(1-18)
|
|
174
|
-
*/
|
|
175
|
-
private setZoomLevel;
|
|
176
145
|
/**
|
|
177
146
|
* 放大
|
|
178
147
|
*/
|
|
@@ -181,39 +150,26 @@ export declare class CesiumMapToolbar {
|
|
|
181
150
|
* 缩小
|
|
182
151
|
*/
|
|
183
152
|
private zoomOut;
|
|
184
|
-
/**
|
|
185
|
-
* 切换全屏
|
|
186
|
-
*/
|
|
187
|
-
private toggleFullscreen;
|
|
188
|
-
/**
|
|
189
|
-
* 进入全屏
|
|
190
|
-
*/
|
|
191
|
-
private enterFullscreen;
|
|
192
|
-
/**
|
|
193
|
-
* 退出全屏
|
|
194
|
-
*/
|
|
195
|
-
private exitFullscreen;
|
|
196
153
|
/**
|
|
197
154
|
* 加载并显示机场禁飞区
|
|
155
|
+
* @deprecated 使用 NotFlyZonesService.showNoFlyZones 代替
|
|
198
156
|
*/
|
|
199
157
|
showNoFlyZones(): Promise<void>;
|
|
200
158
|
/**
|
|
201
159
|
* 隐藏机场禁飞区
|
|
160
|
+
* @deprecated 使用 NotFlyZonesService.hideNoFlyZones 代替
|
|
202
161
|
*/
|
|
203
162
|
hideNoFlyZones(): void;
|
|
204
163
|
/**
|
|
205
164
|
* 切换机场禁飞区显示状态
|
|
165
|
+
* @deprecated 使用 NotFlyZonesService.toggleNoFlyZones 代替
|
|
206
166
|
*/
|
|
207
167
|
toggleNoFlyZones(): Promise<void>;
|
|
208
168
|
/**
|
|
209
169
|
* 获取禁飞区显示状态
|
|
170
|
+
* @deprecated 使用 NotFlyZonesService.getNoFlyZoneVisible 代替
|
|
210
171
|
*/
|
|
211
172
|
getNoFlyZoneVisible(): boolean;
|
|
212
|
-
/**
|
|
213
|
-
* 自动加载禁飞区(如果默认勾选)
|
|
214
|
-
* 在创建 toolbar 后自动调用
|
|
215
|
-
*/
|
|
216
|
-
private autoLoadNoFlyZones;
|
|
217
173
|
/**
|
|
218
174
|
* 销毁工具栏
|
|
219
175
|
*/
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Viewer, Entity } from '../../node_modules/cesium';
|
|
2
|
+
import { MapMarker, MarkerOptions } from './overlay/MapMarker';
|
|
3
|
+
import { MapLabel, LabelOptions } from './overlay/MapLabel';
|
|
4
|
+
import { MapIcon, IconOptions } from './overlay/MapIcon';
|
|
5
|
+
import { MapSVG, SvgOptions } from './overlay/MapSVG';
|
|
6
|
+
import { MapInfoWindow, InfoWindowOptions } from './overlay/MapInfoWindow';
|
|
7
|
+
import { MapPolyline, PolylineOptions } from './overlay/MapPolyline';
|
|
8
|
+
import { MapPolygon, PolygonOptions } from './overlay/MapPolygon';
|
|
9
|
+
import { MapRectangle, RectangleOptions } from './overlay/MapRectangle';
|
|
10
|
+
import { MapCircle, CircleOptions } from './overlay/MapCircle';
|
|
11
|
+
import { MapRing, RingOptions } from './overlay/MapRing';
|
|
12
|
+
import { OverlayPosition } from './overlay/types';
|
|
13
|
+
/**
|
|
14
|
+
* Cesium 覆盖物服务类
|
|
15
|
+
* 统一管理各种覆盖物工具类
|
|
16
|
+
*/
|
|
17
|
+
export declare class CesiumOverlayService {
|
|
18
|
+
private viewer;
|
|
19
|
+
private entities;
|
|
20
|
+
private overlayMap;
|
|
21
|
+
private infoWindowContainer;
|
|
22
|
+
readonly marker: MapMarker;
|
|
23
|
+
readonly label: MapLabel;
|
|
24
|
+
readonly icon: MapIcon;
|
|
25
|
+
readonly svg: MapSVG;
|
|
26
|
+
readonly infoWindow: MapInfoWindow;
|
|
27
|
+
readonly polyline: MapPolyline;
|
|
28
|
+
readonly polygon: MapPolygon;
|
|
29
|
+
readonly rectangle: MapRectangle;
|
|
30
|
+
readonly circle: MapCircle;
|
|
31
|
+
readonly ring: MapRing;
|
|
32
|
+
constructor(viewer: Viewer);
|
|
33
|
+
/**
|
|
34
|
+
* 初始化信息窗口容器
|
|
35
|
+
*/
|
|
36
|
+
private initInfoWindowContainer;
|
|
37
|
+
/**
|
|
38
|
+
* 设置实体点击处理器
|
|
39
|
+
*/
|
|
40
|
+
private setupEntityClickHandler;
|
|
41
|
+
/**
|
|
42
|
+
* 生成唯一ID
|
|
43
|
+
*/
|
|
44
|
+
private generateId;
|
|
45
|
+
/**
|
|
46
|
+
* 添加 Marker
|
|
47
|
+
*/
|
|
48
|
+
addMarker(options: MarkerOptions): Entity;
|
|
49
|
+
/**
|
|
50
|
+
* 添加 Label
|
|
51
|
+
*/
|
|
52
|
+
addLabel(options: LabelOptions): Entity;
|
|
53
|
+
/**
|
|
54
|
+
* 添加 Icon
|
|
55
|
+
*/
|
|
56
|
+
addIcon(options: IconOptions): Entity;
|
|
57
|
+
/**
|
|
58
|
+
* 添加 SVG
|
|
59
|
+
*/
|
|
60
|
+
addSvg(options: SvgOptions): Entity;
|
|
61
|
+
/**
|
|
62
|
+
* 添加 InfoWindow
|
|
63
|
+
*/
|
|
64
|
+
addInfoWindow(options: InfoWindowOptions): Entity;
|
|
65
|
+
/**
|
|
66
|
+
* 添加 Polyline
|
|
67
|
+
*/
|
|
68
|
+
addPolyline(options: PolylineOptions): Entity;
|
|
69
|
+
/**
|
|
70
|
+
* 添加 Polygon
|
|
71
|
+
*/
|
|
72
|
+
addPolygon(options: PolygonOptions): Entity;
|
|
73
|
+
/**
|
|
74
|
+
* 添加 Rectangle
|
|
75
|
+
*/
|
|
76
|
+
addRectangle(options: RectangleOptions): Entity;
|
|
77
|
+
/**
|
|
78
|
+
* 添加 Circle
|
|
79
|
+
*/
|
|
80
|
+
addCircle(options: CircleOptions): Entity;
|
|
81
|
+
/**
|
|
82
|
+
* 添加 Ring
|
|
83
|
+
*/
|
|
84
|
+
addRing(options: RingOptions): Entity;
|
|
85
|
+
/**
|
|
86
|
+
* 根据ID获取覆盖物
|
|
87
|
+
*/
|
|
88
|
+
getOverlay(id: string): Entity | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* 根据ID删除覆盖物
|
|
91
|
+
*/
|
|
92
|
+
removeOverlay(id: string): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* 删除所有覆盖物
|
|
95
|
+
*/
|
|
96
|
+
removeAllOverlays(): void;
|
|
97
|
+
/**
|
|
98
|
+
* 更新覆盖物位置
|
|
99
|
+
*/
|
|
100
|
+
updateOverlayPosition(id: string, position: OverlayPosition): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* 显示/隐藏覆盖物
|
|
103
|
+
*/
|
|
104
|
+
setOverlayVisible(id: string, visible: boolean): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* 获取所有覆盖物ID
|
|
107
|
+
*/
|
|
108
|
+
getAllOverlayIds(): string[];
|
|
109
|
+
/**
|
|
110
|
+
* 获取所有覆盖物
|
|
111
|
+
*/
|
|
112
|
+
getAllOverlays(): Entity[];
|
|
113
|
+
/**
|
|
114
|
+
* 销毁服务,清理所有资源
|
|
115
|
+
*/
|
|
116
|
+
destroy(): void;
|
|
117
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Viewer } from '
|
|
2
|
-
import { default as DrawHelper } from '
|
|
3
|
-
import { MapType, ToolbarConfig, SearchCallback, MeasurementCallback, ZoomCallback } from '
|
|
1
|
+
import { Viewer } from '../../../node_modules/cesium';
|
|
2
|
+
import { default as DrawHelper } from '../CesiumMapDraw';
|
|
3
|
+
import { MapType, ToolbarConfig, SearchCallback, MeasurementCallback, ZoomCallback } from '../CesiumMapModel';
|
|
4
4
|
export interface CesiumMapConfig {
|
|
5
5
|
viewer?: Viewer;
|
|
6
6
|
drawHelper?: DrawHelper;
|