@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,5 +1,7 @@
1
1
  import { SearchResult } from '../libs/CesiumMapModel';
2
- export declare const useToolBarConfig: (message: any) => {
2
+ import { Viewer } from '../../node_modules/cesium';
3
+ import { Ref } from 'vue';
4
+ export declare const useToolBarConfig: (viewer: Viewer | undefined, message: Ref<string>) => {
3
5
  toolbarConfig: {
4
6
  position: string;
5
7
  buttonSize: number;
@@ -56,13 +58,14 @@ export declare const useToolBarConfig: (message: any) => {
56
58
  onSelect: (result: SearchResult) => void;
57
59
  };
58
60
  measurement: {
61
+ onMeasurementStart: (positions?: any) => void;
59
62
  onDistanceComplete: (positions: any, distance: any) => void;
60
63
  onAreaComplete: (positions: any, area: any) => void;
61
64
  onClear: () => void;
62
65
  };
63
66
  zoom: {
64
- onZoomIn: (beforeLevel: any, afterLevel: any) => void;
65
- onZoomOut: (beforeLevel: any, afterLevel: any) => void;
67
+ onZoomIn: (beforeLevel: any, afterLevel: any, currentLevel: any) => void;
68
+ onZoomOut: (beforeLevel: any, afterLevel: any, currentLevel: any) => void;
66
69
  };
67
70
  };
68
71
  };
@@ -0,0 +1,63 @@
1
+ import { Ref } from 'vue';
2
+ import { default as DrawHelper } from '../libs/CesiumMapDraw';
3
+ import * as Cesium from "cesium";
4
+ /**
5
+ * 绘制相关的辅助逻辑
6
+ * - 提供线、矩形、圆形、多边形的绘制示例方法
7
+ */
8
+ export declare function useDrawHelper(viewer: Ref<Cesium.Viewer | undefined>, message: Ref<string>): {
9
+ drawHelper: Ref<{
10
+ handleSceneModeChanged: () => void;
11
+ startDrawingLine: (options?: import('../libs/drawHelper').DrawOptions) => void;
12
+ startDrawingPolygon: (options?: import('../libs/drawHelper').DrawOptions) => void;
13
+ startDrawingRectangle: (options?: import('../libs/drawHelper').DrawOptions) => void;
14
+ startDrawingCircle: (options?: import('../libs/drawHelper').DrawOptions) => void;
15
+ endDrawing: () => void;
16
+ clearAll: () => void;
17
+ clearAllEntities: () => void;
18
+ clearAllPoints: () => void;
19
+ removeEntity: (entity: Cesium.Entity) => void;
20
+ getFinishedEntities: () => Cesium.Entity[];
21
+ onMeasureComplete: (callback: (result: {
22
+ type: "line" | "polygon" | "rectangle" | "circle";
23
+ positions: Cesium.Cartesian3[];
24
+ distance?: number;
25
+ areaKm2?: number;
26
+ }) => void) => void;
27
+ onDrawStart: (callback: () => void) => void;
28
+ onDrawEnd: (callback: (entity: Cesium.Entity | null) => void) => void;
29
+ onEntityRemoved: (callback: (entity: Cesium.Entity) => void) => void;
30
+ destroy: () => void;
31
+ } | null, DrawHelper | {
32
+ handleSceneModeChanged: () => void;
33
+ startDrawingLine: (options?: import('../libs/drawHelper').DrawOptions) => void;
34
+ startDrawingPolygon: (options?: import('../libs/drawHelper').DrawOptions) => void;
35
+ startDrawingRectangle: (options?: import('../libs/drawHelper').DrawOptions) => void;
36
+ startDrawingCircle: (options?: import('../libs/drawHelper').DrawOptions) => void;
37
+ endDrawing: () => void;
38
+ clearAll: () => void;
39
+ clearAllEntities: () => void;
40
+ clearAllPoints: () => void;
41
+ removeEntity: (entity: Cesium.Entity) => void;
42
+ getFinishedEntities: () => Cesium.Entity[];
43
+ onMeasureComplete: (callback: (result: {
44
+ type: "line" | "polygon" | "rectangle" | "circle";
45
+ positions: Cesium.Cartesian3[];
46
+ distance?: number;
47
+ areaKm2?: number;
48
+ }) => void) => void;
49
+ onDrawStart: (callback: () => void) => void;
50
+ onDrawEnd: (callback: (entity: Cesium.Entity | null) => void) => void;
51
+ onEntityRemoved: (callback: (entity: Cesium.Entity) => void) => void;
52
+ destroy: () => void;
53
+ } | null>;
54
+ isDrawing: Ref<boolean, boolean>;
55
+ currentDrawMode: Ref<string | null, string | null>;
56
+ initDrawHelper: () => void;
57
+ endDrawing: () => void;
58
+ addDrawLine: () => void;
59
+ addDrawArea: () => void;
60
+ addDrawCircle: () => void;
61
+ addDrawPolygon: () => void;
62
+ destroyDrawHelper: () => void;
63
+ };
@@ -0,0 +1,193 @@
1
+ import { Ref } from 'vue';
2
+ import { Entity } from '../../node_modules/cesium';
3
+ import { CesiumOverlayService } from '../libs/overlay';
4
+ import * as Cesium from "cesium";
5
+ /**
6
+ * 覆盖物相关的辅助逻辑
7
+ * - 提供添加点位(Marker)与示例覆盖物的便捷方法
8
+ * - 管理点位模式的事件处理及清理
9
+ */
10
+ export declare function useOverlayHelper(viewer: Ref<Cesium.Viewer | undefined>, message: Ref<string>): {
11
+ overlayService: Ref<{
12
+ readonly marker: {
13
+ add: (options: import('../libs/overlay').MarkerOptions) => Entity;
14
+ updatePosition: (entity: Entity, position: import('../libs/overlay').OverlayPosition) => void;
15
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').MarkerOptions, "color" | "outlineColor" | "outlineWidth" | "pixelSize">>) => void;
16
+ remove: (entityOrId: Entity | string) => boolean;
17
+ };
18
+ readonly label: {
19
+ add: (options: import('../libs/overlay').LabelOptions) => Entity;
20
+ updatePosition: (entity: Entity, position: import('../libs/overlay').OverlayPosition) => void;
21
+ updateText: (entity: Entity, text: string) => void;
22
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').LabelOptions, "fillColor" | "outlineColor" | "outlineWidth" | "font" | "scale">>) => void;
23
+ remove: (entityOrId: Entity | string) => boolean;
24
+ };
25
+ readonly icon: {
26
+ add: (options: import('../libs/overlay').IconOptions) => Entity;
27
+ updatePosition: (entity: Entity, position: import('../libs/overlay').OverlayPosition) => void;
28
+ updateImage: (entity: Entity, image: string) => void;
29
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').IconOptions, "scale" | "rotation" | "color">>) => void;
30
+ remove: (entityOrId: Entity | string) => boolean;
31
+ };
32
+ readonly svg: {
33
+ add: (options: import('../libs/overlay').SvgOptions) => Entity;
34
+ updatePosition: (entity: Entity, position: import('../libs/overlay').OverlayPosition) => void;
35
+ updateSvg: (entity: Entity, svg: string) => void;
36
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').SvgOptions, "scale" | "rotation" | "color">>) => void;
37
+ remove: (entityOrId: Entity | string) => boolean;
38
+ };
39
+ readonly infoWindow: {
40
+ setDefaultUpdateInterval: (ms: number) => void;
41
+ forceUpdateAll: () => void;
42
+ bringToFront: (entity: Entity) => void;
43
+ add: (options: import('../libs/overlay').InfoWindowOptions) => Entity;
44
+ updatePosition: (entity: Entity, position: import('../libs/overlay').OverlayPosition) => void;
45
+ updateContent: (entity: Entity, content: string | HTMLElement) => void;
46
+ setVisible: (entity: Entity, visible: boolean) => void;
47
+ show: (entity: Entity) => void;
48
+ hide: (entity: Entity) => void;
49
+ remove: (entity: Entity) => void;
50
+ destroy: () => void;
51
+ };
52
+ readonly polyline: {
53
+ add: (options: import('../libs/overlay').PolylineOptions) => Entity;
54
+ updatePositions: (entity: Entity, positions: import('../libs/overlay').OverlayPosition[]) => void;
55
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').PolylineOptions, "width" | "material">>) => void;
56
+ remove: (entityOrId: Entity | string) => boolean;
57
+ };
58
+ readonly polygon: {
59
+ add: (options: import('../libs/overlay').PolygonOptions) => Entity;
60
+ updatePositions: (entity: Entity, positions: import('../libs/overlay').OverlayPosition[]) => void;
61
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').PolygonOptions, "material" | "outline" | "outlineColor" | "outlineWidth">>) => void;
62
+ remove: (entityOrId: Entity | string) => boolean;
63
+ };
64
+ readonly rectangle: {
65
+ add: (options: import('../libs/overlay').RectangleOptions) => Entity;
66
+ updateCoordinates: (entity: Entity, coordinates: Cesium.Rectangle) => void;
67
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').RectangleOptions, "material" | "outline" | "outlineColor" | "outlineWidth">>) => void;
68
+ remove: (entityOrId: Entity | string) => boolean;
69
+ };
70
+ readonly circle: {
71
+ add: (options: import('../libs/overlay').CircleOptions) => Entity;
72
+ updatePosition: (entity: Entity, position: import('../libs/overlay').OverlayPosition) => void;
73
+ updateRadius: (entity: Entity, radius: number) => void;
74
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').CircleOptions, "material" | "outline" | "outlineColor" | "outlineWidth">>) => void;
75
+ remove: (entityOrId: Entity | string) => boolean;
76
+ };
77
+ addMarker: (options: import('../libs/overlay').MarkerOptions) => Entity;
78
+ addLabel: (options: import('../libs/overlay').LabelOptions) => Entity;
79
+ addIcon: (options: import('../libs/overlay').IconOptions) => Entity;
80
+ addSvg: (options: import('../libs/overlay').SvgOptions) => Entity;
81
+ addInfoWindow: (options: import('../libs/overlay').InfoWindowOptions) => Entity;
82
+ addPolyline: (options: import('../libs/overlay').PolylineOptions) => Entity;
83
+ addPolygon: (options: import('../libs/overlay').PolygonOptions) => Entity;
84
+ addRectangle: (options: import('../libs/overlay').RectangleOptions) => Entity;
85
+ addCircle: (options: import('../libs/overlay').CircleOptions) => Entity;
86
+ getOverlay: (id: string) => Entity | undefined;
87
+ removeOverlay: (id: string) => boolean;
88
+ removeAllOverlays: () => void;
89
+ updateOverlayPosition: (id: string, position: import('../libs/overlay').OverlayPosition) => boolean;
90
+ setOverlayVisible: (id: string, visible: boolean) => boolean;
91
+ getAllOverlayIds: () => string[];
92
+ getAllOverlays: () => Entity[];
93
+ destroy: () => void;
94
+ } | null, CesiumOverlayService | {
95
+ readonly marker: {
96
+ add: (options: import('../libs/overlay').MarkerOptions) => Entity;
97
+ updatePosition: (entity: Entity, position: import('../libs/overlay').OverlayPosition) => void;
98
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').MarkerOptions, "color" | "outlineColor" | "outlineWidth" | "pixelSize">>) => void;
99
+ remove: (entityOrId: Entity | string) => boolean;
100
+ };
101
+ readonly label: {
102
+ add: (options: import('../libs/overlay').LabelOptions) => Entity;
103
+ updatePosition: (entity: Entity, position: import('../libs/overlay').OverlayPosition) => void;
104
+ updateText: (entity: Entity, text: string) => void;
105
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').LabelOptions, "fillColor" | "outlineColor" | "outlineWidth" | "font" | "scale">>) => void;
106
+ remove: (entityOrId: Entity | string) => boolean;
107
+ };
108
+ readonly icon: {
109
+ add: (options: import('../libs/overlay').IconOptions) => Entity;
110
+ updatePosition: (entity: Entity, position: import('../libs/overlay').OverlayPosition) => void;
111
+ updateImage: (entity: Entity, image: string) => void;
112
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').IconOptions, "scale" | "rotation" | "color">>) => void;
113
+ remove: (entityOrId: Entity | string) => boolean;
114
+ };
115
+ readonly svg: {
116
+ add: (options: import('../libs/overlay').SvgOptions) => Entity;
117
+ updatePosition: (entity: Entity, position: import('../libs/overlay').OverlayPosition) => void;
118
+ updateSvg: (entity: Entity, svg: string) => void;
119
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').SvgOptions, "scale" | "rotation" | "color">>) => void;
120
+ remove: (entityOrId: Entity | string) => boolean;
121
+ };
122
+ readonly infoWindow: {
123
+ setDefaultUpdateInterval: (ms: number) => void;
124
+ forceUpdateAll: () => void;
125
+ bringToFront: (entity: Entity) => void;
126
+ add: (options: import('../libs/overlay').InfoWindowOptions) => Entity;
127
+ updatePosition: (entity: Entity, position: import('../libs/overlay').OverlayPosition) => void;
128
+ updateContent: (entity: Entity, content: string | HTMLElement) => void;
129
+ setVisible: (entity: Entity, visible: boolean) => void;
130
+ show: (entity: Entity) => void;
131
+ hide: (entity: Entity) => void;
132
+ remove: (entity: Entity) => void;
133
+ destroy: () => void;
134
+ };
135
+ readonly polyline: {
136
+ add: (options: import('../libs/overlay').PolylineOptions) => Entity;
137
+ updatePositions: (entity: Entity, positions: import('../libs/overlay').OverlayPosition[]) => void;
138
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').PolylineOptions, "width" | "material">>) => void;
139
+ remove: (entityOrId: Entity | string) => boolean;
140
+ };
141
+ readonly polygon: {
142
+ add: (options: import('../libs/overlay').PolygonOptions) => Entity;
143
+ updatePositions: (entity: Entity, positions: import('../libs/overlay').OverlayPosition[]) => void;
144
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').PolygonOptions, "material" | "outline" | "outlineColor" | "outlineWidth">>) => void;
145
+ remove: (entityOrId: Entity | string) => boolean;
146
+ };
147
+ readonly rectangle: {
148
+ add: (options: import('../libs/overlay').RectangleOptions) => Entity;
149
+ updateCoordinates: (entity: Entity, coordinates: Cesium.Rectangle) => void;
150
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').RectangleOptions, "material" | "outline" | "outlineColor" | "outlineWidth">>) => void;
151
+ remove: (entityOrId: Entity | string) => boolean;
152
+ };
153
+ readonly circle: {
154
+ add: (options: import('../libs/overlay').CircleOptions) => Entity;
155
+ updatePosition: (entity: Entity, position: import('../libs/overlay').OverlayPosition) => void;
156
+ updateRadius: (entity: Entity, radius: number) => void;
157
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').CircleOptions, "material" | "outline" | "outlineColor" | "outlineWidth">>) => void;
158
+ remove: (entityOrId: Entity | string) => boolean;
159
+ };
160
+ addMarker: (options: import('../libs/overlay').MarkerOptions) => Entity;
161
+ addLabel: (options: import('../libs/overlay').LabelOptions) => Entity;
162
+ addIcon: (options: import('../libs/overlay').IconOptions) => Entity;
163
+ addSvg: (options: import('../libs/overlay').SvgOptions) => Entity;
164
+ addInfoWindow: (options: import('../libs/overlay').InfoWindowOptions) => Entity;
165
+ addPolyline: (options: import('../libs/overlay').PolylineOptions) => Entity;
166
+ addPolygon: (options: import('../libs/overlay').PolygonOptions) => Entity;
167
+ addRectangle: (options: import('../libs/overlay').RectangleOptions) => Entity;
168
+ addCircle: (options: import('../libs/overlay').CircleOptions) => Entity;
169
+ getOverlay: (id: string) => Entity | undefined;
170
+ removeOverlay: (id: string) => boolean;
171
+ removeAllOverlays: () => void;
172
+ updateOverlayPosition: (id: string, position: import('../libs/overlay').OverlayPosition) => boolean;
173
+ setOverlayVisible: (id: string, visible: boolean) => boolean;
174
+ getAllOverlayIds: () => string[];
175
+ getAllOverlays: () => Entity[];
176
+ destroy: () => void;
177
+ } | null>;
178
+ initOverlayService: () => void;
179
+ addMarker: () => void;
180
+ addMarkerWithLabel: () => void;
181
+ addLabel: (options: any) => void;
182
+ addIcon: () => void;
183
+ addSvg: () => void;
184
+ addPolyline: () => void;
185
+ addLine: () => void;
186
+ addArea: () => void;
187
+ addCircle: () => void;
188
+ addPolygon: () => void;
189
+ addRectangle: () => void;
190
+ addInfoWindow: () => void;
191
+ cancelMarkerMode: () => void;
192
+ destroyOverlayService: () => void;
193
+ };
package/dist/index.d.ts CHANGED
@@ -43,6 +43,7 @@ export interface SearchResult {
43
43
 
44
44
  // 测量回调接口
45
45
  export interface MeasurementCallback {
46
+ onMeasurementStart?: (positions?: Cartesian3[]) => void;
46
47
  onDistanceComplete?: (positions: Cartesian3[], distance: number) => void;
47
48
  onAreaComplete?: (positions: Cartesian3[], area: number) => void;
48
49
  onClear?: () => void;
@@ -101,6 +102,7 @@ export interface MapCenter {
101
102
  // 初始化选项接口
102
103
  export interface InitOptions {
103
104
  token?: string;
105
+ cesiumToken?: string;
104
106
  terrain?: any; // Cesium.Terrain
105
107
  terrainProvider?: any; // Cesium.TerrainProvider
106
108
  mapType?: string;
@@ -109,6 +111,8 @@ export interface InitOptions {
109
111
  terrainShadows?: any; // Cesium.ShadowMode
110
112
  contextOptions?: any; // Cesium.ContextOptions
111
113
  scene3DOnly?: boolean;
114
+ isFlyTo?: boolean;
115
+ isFly?: boolean;
112
116
  selectionIndicator?: boolean;
113
117
  navigationHelpButton?: boolean;
114
118
  fullscreenButton?: boolean;
@@ -203,7 +207,8 @@ export declare class DrawHelper {
203
207
  export declare function initCesium(
204
208
  containerId: string,
205
209
  options: InitOptions,
206
- mapCenter?: MapCenter
210
+ mapCenterOrCesiumToken?: MapCenter | string,
211
+ cesiumToken?: String
207
212
  ): Promise<{ viewer: Viewer; initialCenter: MapCenter }>;
208
213
 
209
214
  // 默认导出