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

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 +173 -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 +54 -0
  22. package/dist/libs/overlay/MapIcon.d.ts +55 -0
  23. package/dist/libs/overlay/MapInfoWindow.d.ts +73 -0
  24. package/dist/libs/overlay/MapLabel.d.ts +59 -0
  25. package/dist/libs/overlay/MapMarker.d.ts +46 -0
  26. package/dist/libs/overlay/MapPolygon.d.ts +49 -0
  27. package/dist/libs/overlay/MapPolyline.d.ts +46 -0
  28. package/dist/libs/overlay/MapRectangle.d.ts +44 -0
  29. package/dist/libs/overlay/MapSVG.d.ts +59 -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,173 @@
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
+ };
17
+ readonly label: {
18
+ add: (options: import('../libs/overlay').LabelOptions) => Entity;
19
+ updatePosition: (entity: Entity, position: import('../libs/overlay').OverlayPosition) => void;
20
+ updateText: (entity: Entity, text: string) => void;
21
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').LabelOptions, "fillColor" | "outlineColor" | "outlineWidth" | "font" | "scale">>) => void;
22
+ };
23
+ readonly icon: {
24
+ add: (options: import('../libs/overlay').IconOptions) => Entity;
25
+ updatePosition: (entity: Entity, position: import('../libs/overlay').OverlayPosition) => void;
26
+ updateImage: (entity: Entity, image: string) => void;
27
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').IconOptions, "scale" | "rotation" | "color">>) => void;
28
+ };
29
+ readonly svg: {
30
+ add: (options: import('../libs/overlay').SvgOptions) => Entity;
31
+ updatePosition: (entity: Entity, position: import('../libs/overlay').OverlayPosition) => void;
32
+ updateSvg: (entity: Entity, svg: string) => void;
33
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').SvgOptions, "scale" | "rotation" | "color">>) => void;
34
+ };
35
+ readonly infoWindow: {
36
+ bringToFront: (entity: Entity) => void;
37
+ add: (options: import('../libs/overlay').InfoWindowOptions) => Entity;
38
+ updatePosition: (entity: Entity, position: import('../libs/overlay').OverlayPosition) => void;
39
+ updateContent: (entity: Entity, content: string | HTMLElement) => void;
40
+ setVisible: (entity: Entity, visible: boolean) => void;
41
+ show: (entity: Entity) => void;
42
+ hide: (entity: Entity) => void;
43
+ remove: (entity: Entity) => void;
44
+ destroy: () => void;
45
+ };
46
+ readonly polyline: {
47
+ add: (options: import('../libs/overlay').PolylineOptions) => Entity;
48
+ updatePositions: (entity: Entity, positions: import('../libs/overlay').OverlayPosition[]) => void;
49
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').PolylineOptions, "width" | "material">>) => void;
50
+ };
51
+ readonly polygon: {
52
+ add: (options: import('../libs/overlay').PolygonOptions) => Entity;
53
+ updatePositions: (entity: Entity, positions: import('../libs/overlay').OverlayPosition[]) => void;
54
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').PolygonOptions, "material" | "outline" | "outlineColor" | "outlineWidth">>) => void;
55
+ };
56
+ readonly rectangle: {
57
+ add: (options: import('../libs/overlay').RectangleOptions) => Entity;
58
+ updateCoordinates: (entity: Entity, coordinates: Cesium.Rectangle) => void;
59
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').RectangleOptions, "material" | "outline" | "outlineColor" | "outlineWidth">>) => void;
60
+ };
61
+ readonly circle: {
62
+ add: (options: import('../libs/overlay').CircleOptions) => Entity;
63
+ updatePosition: (entity: Entity, position: import('../libs/overlay').OverlayPosition) => void;
64
+ updateRadius: (entity: Entity, radius: number) => void;
65
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').CircleOptions, "material" | "outline" | "outlineColor" | "outlineWidth">>) => void;
66
+ };
67
+ addMarker: (options: import('../libs/overlay').MarkerOptions) => Entity;
68
+ addLabel: (options: import('../libs/overlay').LabelOptions) => Entity;
69
+ addIcon: (options: import('../libs/overlay').IconOptions) => Entity;
70
+ addSvg: (options: import('../libs/overlay').SvgOptions) => Entity;
71
+ addInfoWindow: (options: import('../libs/overlay').InfoWindowOptions) => Entity;
72
+ addPolyline: (options: import('../libs/overlay').PolylineOptions) => Entity;
73
+ addPolygon: (options: import('../libs/overlay').PolygonOptions) => Entity;
74
+ addRectangle: (options: import('../libs/overlay').RectangleOptions) => Entity;
75
+ addCircle: (options: import('../libs/overlay').CircleOptions) => Entity;
76
+ getOverlay: (id: string) => Entity | undefined;
77
+ removeOverlay: (id: string) => boolean;
78
+ removeAllOverlays: () => void;
79
+ updateOverlayPosition: (id: string, position: import('../libs/overlay').OverlayPosition) => boolean;
80
+ setOverlayVisible: (id: string, visible: boolean) => boolean;
81
+ getAllOverlayIds: () => string[];
82
+ getAllOverlays: () => Entity[];
83
+ destroy: () => void;
84
+ } | null, CesiumOverlayService | {
85
+ readonly marker: {
86
+ add: (options: import('../libs/overlay').MarkerOptions) => Entity;
87
+ updatePosition: (entity: Entity, position: import('../libs/overlay').OverlayPosition) => void;
88
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').MarkerOptions, "color" | "outlineColor" | "outlineWidth" | "pixelSize">>) => void;
89
+ };
90
+ readonly label: {
91
+ add: (options: import('../libs/overlay').LabelOptions) => Entity;
92
+ updatePosition: (entity: Entity, position: import('../libs/overlay').OverlayPosition) => void;
93
+ updateText: (entity: Entity, text: string) => void;
94
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').LabelOptions, "fillColor" | "outlineColor" | "outlineWidth" | "font" | "scale">>) => void;
95
+ };
96
+ readonly icon: {
97
+ add: (options: import('../libs/overlay').IconOptions) => Entity;
98
+ updatePosition: (entity: Entity, position: import('../libs/overlay').OverlayPosition) => void;
99
+ updateImage: (entity: Entity, image: string) => void;
100
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').IconOptions, "scale" | "rotation" | "color">>) => void;
101
+ };
102
+ readonly svg: {
103
+ add: (options: import('../libs/overlay').SvgOptions) => Entity;
104
+ updatePosition: (entity: Entity, position: import('../libs/overlay').OverlayPosition) => void;
105
+ updateSvg: (entity: Entity, svg: string) => void;
106
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').SvgOptions, "scale" | "rotation" | "color">>) => void;
107
+ };
108
+ readonly infoWindow: {
109
+ bringToFront: (entity: Entity) => void;
110
+ add: (options: import('../libs/overlay').InfoWindowOptions) => Entity;
111
+ updatePosition: (entity: Entity, position: import('../libs/overlay').OverlayPosition) => void;
112
+ updateContent: (entity: Entity, content: string | HTMLElement) => void;
113
+ setVisible: (entity: Entity, visible: boolean) => void;
114
+ show: (entity: Entity) => void;
115
+ hide: (entity: Entity) => void;
116
+ remove: (entity: Entity) => void;
117
+ destroy: () => void;
118
+ };
119
+ readonly polyline: {
120
+ add: (options: import('../libs/overlay').PolylineOptions) => Entity;
121
+ updatePositions: (entity: Entity, positions: import('../libs/overlay').OverlayPosition[]) => void;
122
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').PolylineOptions, "width" | "material">>) => void;
123
+ };
124
+ readonly polygon: {
125
+ add: (options: import('../libs/overlay').PolygonOptions) => Entity;
126
+ updatePositions: (entity: Entity, positions: import('../libs/overlay').OverlayPosition[]) => void;
127
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').PolygonOptions, "material" | "outline" | "outlineColor" | "outlineWidth">>) => void;
128
+ };
129
+ readonly rectangle: {
130
+ add: (options: import('../libs/overlay').RectangleOptions) => Entity;
131
+ updateCoordinates: (entity: Entity, coordinates: Cesium.Rectangle) => void;
132
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').RectangleOptions, "material" | "outline" | "outlineColor" | "outlineWidth">>) => void;
133
+ };
134
+ readonly circle: {
135
+ add: (options: import('../libs/overlay').CircleOptions) => Entity;
136
+ updatePosition: (entity: Entity, position: import('../libs/overlay').OverlayPosition) => void;
137
+ updateRadius: (entity: Entity, radius: number) => void;
138
+ updateStyle: (entity: Entity, options: Partial<Pick<import('../libs/overlay').CircleOptions, "material" | "outline" | "outlineColor" | "outlineWidth">>) => void;
139
+ };
140
+ addMarker: (options: import('../libs/overlay').MarkerOptions) => Entity;
141
+ addLabel: (options: import('../libs/overlay').LabelOptions) => Entity;
142
+ addIcon: (options: import('../libs/overlay').IconOptions) => Entity;
143
+ addSvg: (options: import('../libs/overlay').SvgOptions) => Entity;
144
+ addInfoWindow: (options: import('../libs/overlay').InfoWindowOptions) => Entity;
145
+ addPolyline: (options: import('../libs/overlay').PolylineOptions) => Entity;
146
+ addPolygon: (options: import('../libs/overlay').PolygonOptions) => Entity;
147
+ addRectangle: (options: import('../libs/overlay').RectangleOptions) => Entity;
148
+ addCircle: (options: import('../libs/overlay').CircleOptions) => Entity;
149
+ getOverlay: (id: string) => Entity | undefined;
150
+ removeOverlay: (id: string) => boolean;
151
+ removeAllOverlays: () => void;
152
+ updateOverlayPosition: (id: string, position: import('../libs/overlay').OverlayPosition) => boolean;
153
+ setOverlayVisible: (id: string, visible: boolean) => boolean;
154
+ getAllOverlayIds: () => string[];
155
+ getAllOverlays: () => Entity[];
156
+ destroy: () => void;
157
+ } | null>;
158
+ initOverlayService: () => void;
159
+ addMarker: () => void;
160
+ addMarkerWithLabel: () => void;
161
+ addLabel: (options: any) => void;
162
+ addIcon: () => void;
163
+ addSvg: () => void;
164
+ addPolyline: () => void;
165
+ addLine: () => void;
166
+ addArea: () => void;
167
+ addCircle: () => void;
168
+ addPolygon: () => void;
169
+ addRectangle: () => void;
170
+ addInfoWindow: () => void;
171
+ cancelMarkerMode: () => void;
172
+ destroyOverlayService: () => void;
173
+ };
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
  // 默认导出