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

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 (41) hide show
  1. package/dist/hooks/toolBarConfig.d.ts +6 -3
  2. package/dist/hooks/useDrawHelper.d.ts +63 -0
  3. package/dist/hooks/useOverlayHelper.d.ts +193 -0
  4. package/dist/index.d.ts +6 -1
  5. package/dist/index.js +2563 -1559
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.umd.js +124 -124
  8. package/dist/index.umd.js.map +1 -1
  9. package/dist/libs/{CesiumMapHelper.d.ts → CesiumMapDraw.d.ts} +33 -43
  10. package/dist/libs/CesiumMapLoader.d.ts +8 -2
  11. package/dist/libs/CesiumMapModel.d.ts +5 -2
  12. package/dist/libs/CesiumMapToolbar.d.ts +23 -67
  13. package/dist/libs/CesiumOverlayService.d.ts +111 -0
  14. package/dist/libs/{CesiumMapConfig.d.ts → config/CesiumMapConfig.d.ts} +3 -3
  15. package/dist/libs/drawHelper/BaseDraw.d.ts +116 -0
  16. package/dist/libs/drawHelper/DrawCircle.d.ts +25 -0
  17. package/dist/libs/drawHelper/DrawLine.d.ts +44 -0
  18. package/dist/libs/drawHelper/DrawPolgon.d.ts +24 -0
  19. package/dist/libs/drawHelper/DrawRectangle.d.ts +24 -0
  20. package/dist/libs/drawHelper/index.d.ts +5 -0
  21. package/dist/libs/overlay/MapCircle.d.ts +58 -0
  22. package/dist/libs/overlay/MapIcon.d.ts +59 -0
  23. package/dist/libs/overlay/MapInfoWindow.d.ts +100 -0
  24. package/dist/libs/overlay/MapLabel.d.ts +63 -0
  25. package/dist/libs/overlay/MapMarker.d.ts +50 -0
  26. package/dist/libs/overlay/MapPolygon.d.ts +53 -0
  27. package/dist/libs/overlay/MapPolyline.d.ts +50 -0
  28. package/dist/libs/overlay/MapRectangle.d.ts +48 -0
  29. package/dist/libs/overlay/MapSVG.d.ts +63 -0
  30. package/dist/libs/overlay/index.d.ts +20 -0
  31. package/dist/libs/overlay/types.d.ts +5 -0
  32. package/dist/libs/toolBar/CesiumMapController.d.ts +78 -0
  33. package/dist/libs/toolBar/MapLayersService.d.ts +66 -0
  34. package/dist/libs/toolBar/MapSearchService.d.ts +41 -0
  35. package/dist/libs/toolBar/MapToolBarConfig.d.ts +3 -0
  36. package/dist/libs/toolBar/MeasurementService.d.ts +16 -0
  37. package/dist/libs/toolBar/NotFlyZonesService.d.ts +46 -0
  38. package/dist/package.json +5 -5
  39. package/dist/utils/calc.d.ts +44 -0
  40. package/dist/utils/common.d.ts +1 -0
  41. package/package.json +5 -5
@@ -1,3 +1,4 @@
1
+ import { DrawOptions } from './drawHelper';
1
2
  import * as Cesium from "cesium";
2
3
  /**
3
4
  * Cesium 绘图辅助工具类
@@ -19,19 +20,28 @@ declare class DrawHelper {
19
20
  private finishedPointEntities;
20
21
  private publicEntities;
21
22
  private _doubleClickPending;
22
- private currentLineEntity;
23
- private currentSegmentLabels;
24
- private currentTotalLabel;
23
+ private drawLine;
24
+ private drawPolygon;
25
+ private drawRectangle;
26
+ private drawCircle;
27
+ private currentDrawer;
25
28
  private screenSpaceEventHandler;
29
+ private entityClickHandler;
26
30
  private onDrawStartCallback;
27
31
  private onDrawEndCallback;
28
32
  private onEntityRemovedCallback;
33
+ private onMeasureCompleteCallback;
29
34
  private offsetHeight;
35
+ private originalDepthTestAgainstTerrain;
30
36
  /**
31
37
  * 构造函数
32
38
  * @param viewer Cesium Viewer 实例
33
39
  */
34
40
  constructor(viewer: Cesium.Viewer);
41
+ /**
42
+ * 外部调用:在场景模式(2D/3D)切换后,更新偏移高度并重算已完成实体
43
+ */
44
+ handleSceneModeChanged(): void;
35
45
  /**
36
46
  * 根据场景模式更新偏移高度
37
47
  */
@@ -39,15 +49,19 @@ declare class DrawHelper {
39
49
  /**
40
50
  * 开始绘制线条
41
51
  */
42
- startDrawingLine(): void;
52
+ startDrawingLine(options?: DrawOptions): void;
43
53
  /**
44
54
  * 开始绘制多边形(仅边线)
45
55
  */
46
- startDrawingPolygon(): void;
56
+ startDrawingPolygon(options?: DrawOptions): void;
47
57
  /**
48
58
  * 开始绘制矩形
49
59
  */
50
- startDrawingRectangle(): void;
60
+ startDrawingRectangle(options?: DrawOptions): void;
61
+ /**
62
+ * 开始绘制圆形
63
+ */
64
+ startDrawingCircle(options?: DrawOptions): void;
51
65
  /**
52
66
  * 内部统一的开始绘制方法
53
67
  * @param mode 绘制模式
@@ -128,17 +142,21 @@ declare class DrawHelper {
128
142
  * @returns 实体数组
129
143
  */
130
144
  getFinishedEntities(): Cesium.Entity[];
131
- private calculateRectangle;
132
- private calculateRectangleArea;
133
- private calculatePolygonArea;
134
- private calculatePolygonCenter;
135
145
  /**
136
- * 格式化距离显示
137
- * 超过1000m时转换为km,保留两位小数
138
- * @param distance 距离(米)
139
- * @returns 格式化后的距离字符串
146
+ * 使用 Canvas 绘制总长文本,生成用于 billboard 的图片
140
147
  */
141
- private formatDistance;
148
+ private createTotalLengthBillboardImage;
149
+ /**
150
+ * 使用 Canvas 绘制分段长度文本,生成用于 billboard 的图片
151
+ * 样式与总长保持一致,便于统一视觉
152
+ */
153
+ private createSegmentLengthBillboardImage;
154
+ onMeasureComplete(callback: (result: {
155
+ type: "line" | "polygon" | "rectangle" | "circle";
156
+ positions: Cesium.Cartesian3[];
157
+ distance?: number;
158
+ areaKm2?: number;
159
+ }) => void): void;
142
160
  /**
143
161
  * 设置开始绘制时的回调函数
144
162
  * @param callback 回调函数
@@ -154,34 +172,6 @@ declare class DrawHelper {
154
172
  * @param callback 回调函数,参数为被移除的实体
155
173
  */
156
174
  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
175
  /**
186
176
  * 更新所有已完成实体以适应场景模式变化
187
177
  * 当从2D切换到3D或从3D切换到2D时,需要更新实体的高度参考和位置
@@ -1,4 +1,4 @@
1
- import { Terrain, TerrainProvider, Viewer as CesiumViewer } from '../../node_modules/cesium';
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,15 @@ 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;
41
43
  token?: string;
44
+ cesiumToken?: string;
45
+ success?: () => void;
46
+ cancel?: () => void;
47
+ mapCenter?: MapCenter;
42
48
  }
43
49
  interface MapCenter {
44
50
  latitude: number;
@@ -47,7 +53,7 @@ interface MapCenter {
47
53
  pitch?: number;
48
54
  heading?: number;
49
55
  }
50
- export declare function initCesium(containerId: string, options: InitOptions, mapCenter?: MapCenter): Promise<{
56
+ export declare function initCesium(containerId: string, options: InitOptions, mapCenterOrCesiumToken?: MapCenter | string, cesiumToken?: string): Promise<{
51
57
  viewer: CesiumViewer;
52
58
  initialCenter: MapCenter;
53
59
  }>;
@@ -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?: (beforeLevel: number, afterLevel: number) => void;
69
- onZoomOut?: (beforeLevel: number, afterLevel: number) => void;
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 searchCallback?;
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 noFlyZoneEntities;
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
- getButtonElement(buttonId: string): HTMLElement | null;
72
+ private getAllButtonsWithSort;
71
73
  /**
72
- * 设置绘图助手回调
74
+ * 重新构建工具栏按钮
73
75
  */
74
- private setupDrawHelperCallbacks;
76
+ private rebuildToolbarButtons;
75
77
  /**
76
- * 格式化距离显示
77
- * 超过1000m时转换为km,保留两位小数
78
- * @param distance 距离(米)
79
- * @returns 格式化后的距离字符串
78
+ * 移除按钮
80
79
  */
81
- private formatDistance;
80
+ removeButton(buttonId: string): void;
82
81
  /**
83
- * 计算多边形面积
82
+ * 获取按钮元素
84
83
  */
85
- private calculatePolygonArea;
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,111 @@
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 { OverlayPosition } from './overlay/types';
12
+ /**
13
+ * Cesium 覆盖物服务类
14
+ * 统一管理各种覆盖物工具类
15
+ */
16
+ export declare class CesiumOverlayService {
17
+ private viewer;
18
+ private entities;
19
+ private overlayMap;
20
+ private infoWindowContainer;
21
+ readonly marker: MapMarker;
22
+ readonly label: MapLabel;
23
+ readonly icon: MapIcon;
24
+ readonly svg: MapSVG;
25
+ readonly infoWindow: MapInfoWindow;
26
+ readonly polyline: MapPolyline;
27
+ readonly polygon: MapPolygon;
28
+ readonly rectangle: MapRectangle;
29
+ readonly circle: MapCircle;
30
+ constructor(viewer: Viewer);
31
+ /**
32
+ * 初始化信息窗口容器
33
+ */
34
+ private initInfoWindowContainer;
35
+ /**
36
+ * 设置实体点击处理器
37
+ */
38
+ private setupEntityClickHandler;
39
+ /**
40
+ * 生成唯一ID
41
+ */
42
+ private generateId;
43
+ /**
44
+ * 添加 Marker
45
+ */
46
+ addMarker(options: MarkerOptions): Entity;
47
+ /**
48
+ * 添加 Label
49
+ */
50
+ addLabel(options: LabelOptions): Entity;
51
+ /**
52
+ * 添加 Icon
53
+ */
54
+ addIcon(options: IconOptions): Entity;
55
+ /**
56
+ * 添加 SVG
57
+ */
58
+ addSvg(options: SvgOptions): Entity;
59
+ /**
60
+ * 添加 InfoWindow
61
+ */
62
+ addInfoWindow(options: InfoWindowOptions): Entity;
63
+ /**
64
+ * 添加 Polyline
65
+ */
66
+ addPolyline(options: PolylineOptions): Entity;
67
+ /**
68
+ * 添加 Polygon
69
+ */
70
+ addPolygon(options: PolygonOptions): Entity;
71
+ /**
72
+ * 添加 Rectangle
73
+ */
74
+ addRectangle(options: RectangleOptions): Entity;
75
+ /**
76
+ * 添加 Circle
77
+ */
78
+ addCircle(options: CircleOptions): Entity;
79
+ /**
80
+ * 根据ID获取覆盖物
81
+ */
82
+ getOverlay(id: string): Entity | undefined;
83
+ /**
84
+ * 根据ID删除覆盖物
85
+ */
86
+ removeOverlay(id: string): boolean;
87
+ /**
88
+ * 删除所有覆盖物
89
+ */
90
+ removeAllOverlays(): void;
91
+ /**
92
+ * 更新覆盖物位置
93
+ */
94
+ updateOverlayPosition(id: string, position: OverlayPosition): boolean;
95
+ /**
96
+ * 显示/隐藏覆盖物
97
+ */
98
+ setOverlayVisible(id: string, visible: boolean): boolean;
99
+ /**
100
+ * 获取所有覆盖物ID
101
+ */
102
+ getAllOverlayIds(): string[];
103
+ /**
104
+ * 获取所有覆盖物
105
+ */
106
+ getAllOverlays(): Entity[];
107
+ /**
108
+ * 销毁服务,清理所有资源
109
+ */
110
+ destroy(): void;
111
+ }
@@ -1,6 +1,6 @@
1
- import { Viewer } from '../../node_modules/cesium';
2
- import { default as DrawHelper } from './CesiumMapHelper';
3
- import { MapType, ToolbarConfig, SearchCallback, MeasurementCallback, ZoomCallback } from './CesiumMapModel';
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;
@@ -0,0 +1,116 @@
1
+ import { Viewer, Entity, Cartesian3 } from '../../../node_modules/cesium';
2
+ import * as Cesium from "cesium";
3
+ /**
4
+ * 绘制结果接口
5
+ */
6
+ export interface DrawResult {
7
+ entity: Entity | null;
8
+ type: "line" | "polygon" | "rectangle" | "circle";
9
+ positions: Cartesian3[];
10
+ distance?: number;
11
+ areaKm2?: number;
12
+ }
13
+ /**
14
+ * 绘制回调接口
15
+ */
16
+ export interface DrawCallbacks {
17
+ onDrawStart?: () => void;
18
+ onDrawEnd?: (entity: Entity | null) => void;
19
+ onEntityRemoved?: (entity: Entity) => void;
20
+ onMeasureComplete?: (result: DrawResult) => void;
21
+ }
22
+ /**
23
+ * 绘制时可选的样式和事件回调
24
+ */
25
+ export interface DrawOptions {
26
+ strokeColor?: Cesium.Color | string;
27
+ strokeWidth?: number;
28
+ fillColor?: Cesium.Color | string;
29
+ outlineColor?: Cesium.Color | string;
30
+ outlineWidth?: number;
31
+ selected?: {
32
+ color?: Cesium.Color | string;
33
+ width?: number;
34
+ outlineColor?: Cesium.Color | string;
35
+ outlineWidth?: number;
36
+ };
37
+ onClick?: (entity: Entity, type?: "line" | "polygon" | "rectangle" | "circle", positions?: Cartesian3[]) => void;
38
+ }
39
+ /**
40
+ * 基础绘制类
41
+ * 包含所有绘制类型的通用逻辑
42
+ */
43
+ export declare abstract class BaseDraw {
44
+ protected viewer: Viewer;
45
+ protected scene: Cesium.Scene;
46
+ protected entities: Cesium.EntityCollection;
47
+ protected offsetHeight: number;
48
+ protected originalDepthTestAgainstTerrain: boolean | null;
49
+ /**
50
+ * 当场景启用了 requestRenderMode(手动渲染)时,绘制过程中需要关闭该模式以保证动画和交互正常。
51
+ * 在绘制结束或取消时应恢复为原始值。
52
+ */
53
+ protected originalRequestRenderMode: boolean | null;
54
+ protected callbacks: DrawCallbacks;
55
+ protected tempPositions: Cesium.Cartesian3[];
56
+ protected tempEntities: Cesium.Entity[];
57
+ protected tempLabelEntities: Cesium.Entity[];
58
+ protected finishedPointEntities: Cesium.Entity[];
59
+ /** 当前绘制的选项(如果有) */
60
+ protected drawOptions?: DrawOptions;
61
+ /**
62
+ * 将任意颜色输入解析为 Cesium.Color
63
+ */
64
+ protected resolveColor(input?: Cesium.Color | string): Cesium.Color;
65
+ /**
66
+ * 应用选中样式(可切换)
67
+ */
68
+ protected applySelectedStyleToEntity(entity: Entity): void;
69
+ /**
70
+ * 恢复原始样式
71
+ */
72
+ protected restoreOriginalStyleForEntity(entity: Entity): void;
73
+ abstract updateDrawingEntity(previewPoint?: Cesium.Cartesian3): void;
74
+ abstract startDrawing(options?: DrawOptions): void;
75
+ /**
76
+ * 抽象方法:完成绘制
77
+ */
78
+ abstract finishDrawing(): DrawResult | null;
79
+ /**
80
+ * 抽象方法:获取绘制类型
81
+ */
82
+ abstract getDrawType(): "line" | "polygon" | "rectangle" | "circle";
83
+ constructor(viewer: Viewer, callbacks?: DrawCallbacks);
84
+ /**
85
+ * 根据场景模式更新偏移高度
86
+ */
87
+ protected updateOffsetHeight(): void;
88
+ /**
89
+ * 拾取地形或椭球体上的位置
90
+ */
91
+ protected pickGlobePosition(windowPosition: Cesium.Cartesian2): Cesium.Cartesian3 | null;
92
+ /**
93
+ * 如果场景启用了 requestRenderMode(手动渲染),在开始绘制时临时关闭以保证动画/交互正常。
94
+ */
95
+ protected enableContinuousRenderingIfNeeded(): void;
96
+ /**
97
+ * 在绘制完成或取消时恢复 requestRenderMode 到原始状态(如果曾被修改过)。
98
+ */
99
+ protected restoreRequestRenderModeIfNeeded(): void;
100
+ /**
101
+ * 添加一个点到临时位置数组并创建点实体
102
+ */
103
+ protected addPoint(position: Cesium.Cartesian3): void;
104
+ /**
105
+ * 创建总长/面积标签图片
106
+ */
107
+ protected createTotalLengthBillboardImage(text: string): HTMLCanvasElement;
108
+ /**
109
+ * 创建分段长度标签图片
110
+ */
111
+ protected createSegmentLengthBillboardImage(text: string): HTMLCanvasElement;
112
+ /**
113
+ * 清理临时实体
114
+ */
115
+ protected clearTempEntities(): void;
116
+ }
@@ -0,0 +1,25 @@
1
+ import { Cartesian3 } from '../../../node_modules/cesium';
2
+ import { BaseDraw, DrawResult, DrawOptions } from './BaseDraw';
3
+ /**
4
+ * 画圆绘制类
5
+ */
6
+ export declare class DrawCircle extends BaseDraw {
7
+ private currentCircleEntity;
8
+ private centerPosition;
9
+ /**
10
+ * 开始绘制
11
+ */
12
+ startDrawing(options?: DrawOptions): void;
13
+ /**
14
+ * 更新绘制实体(预览)
15
+ */
16
+ updateDrawingEntity(previewPoint?: Cartesian3): void;
17
+ /**
18
+ * 完成绘制
19
+ */
20
+ finishDrawing(): DrawResult | null;
21
+ /**
22
+ * 获取绘制类型
23
+ */
24
+ getDrawType(): "line" | "polygon" | "rectangle" | "circle";
25
+ }
@@ -0,0 +1,44 @@
1
+ import { Cartesian3 } from '../../../node_modules/cesium';
2
+ import { BaseDraw, DrawResult, DrawOptions } from './BaseDraw';
3
+ /**
4
+ * 画线绘制类
5
+ */
6
+ export declare class DrawLine extends BaseDraw {
7
+ private currentLineEntity;
8
+ private currentSegmentLabels;
9
+ private currentTotalLabel;
10
+ private currentLinePositions;
11
+ private isTotalLabelWarmedUp;
12
+ /**
13
+ * 开始绘制
14
+ */
15
+ startDrawing(options?: DrawOptions): void;
16
+ /**
17
+ * 更新绘制实体(预览)
18
+ */
19
+ updateDrawingEntity(previewPoint?: Cartesian3): void;
20
+ /**
21
+ * 完成绘制
22
+ */
23
+ finishDrawing(): DrawResult | null;
24
+ /**
25
+ * 获取绘制类型
26
+ */
27
+ getDrawType(): "line" | "polygon" | "rectangle" | "circle";
28
+ /**
29
+ * 清理线条实体
30
+ */
31
+ private clearLineEntity;
32
+ /**
33
+ * 更新分段标签
34
+ */
35
+ private updateSegmentLabels;
36
+ /**
37
+ * 更新总距离标签
38
+ */
39
+ private updateTotalLabel;
40
+ /**
41
+ * 总长标签预热
42
+ */
43
+ private warmupTotalLengthLabel;
44
+ }
@@ -0,0 +1,24 @@
1
+ import { Cartesian3 } from '../../../node_modules/cesium';
2
+ import { BaseDraw, DrawResult, DrawOptions } from './BaseDraw';
3
+ /**
4
+ * 画多边形绘制类
5
+ */
6
+ export declare class DrawPolygon extends BaseDraw {
7
+ private currentPolygonEntity;
8
+ /**
9
+ * 开始绘制
10
+ */
11
+ startDrawing(options?: DrawOptions): void;
12
+ /**
13
+ * 更新绘制实体(预览)
14
+ */
15
+ updateDrawingEntity(previewPoint?: Cartesian3): void;
16
+ /**
17
+ * 完成绘制
18
+ */
19
+ finishDrawing(): DrawResult | null;
20
+ /**
21
+ * 获取绘制类型
22
+ */
23
+ getDrawType(): "line" | "polygon" | "rectangle" | "circle";
24
+ }