@xingm/vmap-cesium-toolbar 0.0.7-alpha.0 → 0.0.7-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.
- package/dist/hooks/toolBarConfig.d.ts +4 -1
- package/dist/hooks/useMap.d.ts +1 -1
- package/dist/hooks/useMapInit.d.ts +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.es.js +2691 -1826
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +35 -35
- package/dist/index.umd.js.map +1 -1
- package/dist/libs/CesiumMapLoader.d.ts +3 -0
- package/dist/libs/CesiumMapMark.d.ts +202 -0
- package/dist/libs/CesiumMapModel.d.ts +11 -3
- package/dist/libs/CesiumMapToolbar.d.ts +12 -0
- package/dist/libs/toolBar/CesiumMapController.d.ts +3 -0
- package/dist/libs/toolBar/MapLayersService.d.ts +1 -0
- package/dist/libs/toolBar/MapSearchService.d.ts +4 -0
- package/dist/package.json +1 -1
- package/dist/tdt/tdtAuth.d.ts +1 -0
- package/dist/utils/common.d.ts +1 -0
- package/dist/utils/overlayUtils.d.ts +149 -0
- package/package.json +74 -74
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { CesiumOverlayService } from './CesiumOverlayService';
|
|
2
|
+
import { default as DrawHelper } from './CesiumMapDraw';
|
|
3
|
+
import { DrawOptions } from './drawHelper/BaseDraw';
|
|
4
|
+
import { LngLatPosition } from '../utils/overlayUtils';
|
|
5
|
+
import * as Cesium from "cesium";
|
|
6
|
+
export type CesiumMapDrawType = "point" | "polyline" | "polygon" | "rectangle" | "circle";
|
|
7
|
+
export type CesiumMapWorkAreaType = "polygon" | "circle" | "rectangle";
|
|
8
|
+
export type CesiumMapWorkAreaKind = "work" | "noFly";
|
|
9
|
+
export interface CesiumMapMarkToolbarPosition {
|
|
10
|
+
left?: number | string;
|
|
11
|
+
right?: number | string;
|
|
12
|
+
top?: number | string;
|
|
13
|
+
bottom?: number | string;
|
|
14
|
+
}
|
|
15
|
+
export interface CesiumMapDrawResult {
|
|
16
|
+
drawType: CesiumMapDrawType;
|
|
17
|
+
positions: LngLatPosition[];
|
|
18
|
+
cartesian3Positions: Cesium.Cartesian3[];
|
|
19
|
+
position?: LngLatPosition;
|
|
20
|
+
entity: Cesium.Entity | null;
|
|
21
|
+
length?: number;
|
|
22
|
+
area?: number;
|
|
23
|
+
radius?: number;
|
|
24
|
+
color?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface CesiumMapWorkAreaDrawResult extends Omit<CesiumMapDrawResult, "drawType"> {
|
|
27
|
+
drawType: CesiumMapWorkAreaType;
|
|
28
|
+
areaType: CesiumMapWorkAreaKind;
|
|
29
|
+
}
|
|
30
|
+
export interface CesiumMapMarkOptions extends DrawOptions {
|
|
31
|
+
pointWidth?: number;
|
|
32
|
+
pointHeight?: number;
|
|
33
|
+
continuous?: boolean;
|
|
34
|
+
showPolylineLengthLabel?: boolean;
|
|
35
|
+
showToolbar?: boolean;
|
|
36
|
+
toolbarClassName?: string;
|
|
37
|
+
toolbarPosition?: CesiumMapMarkToolbarPosition;
|
|
38
|
+
buttonSize?: number;
|
|
39
|
+
buttonSpacing?: number;
|
|
40
|
+
zIndex?: number;
|
|
41
|
+
defaultColor?: string;
|
|
42
|
+
colors?: Partial<Record<CesiumMapDrawType, string>>;
|
|
43
|
+
overlayServiceOptions?: ConstructorParameters<typeof CesiumOverlayService>[1];
|
|
44
|
+
buttons?: CesiumMapMarkButtonConfig[];
|
|
45
|
+
}
|
|
46
|
+
export interface CesiumMapMarkCallbacks {
|
|
47
|
+
onDrawStart?: (drawType: CesiumMapDrawType) => void;
|
|
48
|
+
onDrawEnd?: (result: CesiumMapDrawResult) => void;
|
|
49
|
+
onWorkAreaDrawEnd?: (result: CesiumMapWorkAreaDrawResult) => void;
|
|
50
|
+
onClear?: () => void;
|
|
51
|
+
onDelete?: (entity: Cesium.Entity) => void;
|
|
52
|
+
onEditChange?: (entity: Cesium.Entity) => void;
|
|
53
|
+
onEditEnd?: (result: CesiumMapDrawResult) => void;
|
|
54
|
+
onColorChange?: (color: string, drawType?: CesiumMapDrawType) => void;
|
|
55
|
+
onError?: (error: Error) => void;
|
|
56
|
+
}
|
|
57
|
+
export interface CesiumMapMarkExportItem {
|
|
58
|
+
id?: string;
|
|
59
|
+
drawType: CesiumMapDrawType;
|
|
60
|
+
positions: LngLatPosition[];
|
|
61
|
+
position?: LngLatPosition;
|
|
62
|
+
length?: number;
|
|
63
|
+
area?: number;
|
|
64
|
+
radius?: number;
|
|
65
|
+
color?: string;
|
|
66
|
+
entity: Cesium.Entity;
|
|
67
|
+
}
|
|
68
|
+
export interface CesiumMapMarkButtonConfig {
|
|
69
|
+
id: CesiumMapDrawType;
|
|
70
|
+
title?: string;
|
|
71
|
+
text?: string;
|
|
72
|
+
icon?: string | HTMLElement | false;
|
|
73
|
+
color?: string;
|
|
74
|
+
borderColor?: string;
|
|
75
|
+
backgroundColor?: string;
|
|
76
|
+
activeBackgroundColor?: string;
|
|
77
|
+
callback?: (mark: CesiumMapMark, drawType: CesiumMapDrawType) => void;
|
|
78
|
+
}
|
|
79
|
+
export declare class CesiumMapMark {
|
|
80
|
+
private viewer;
|
|
81
|
+
private map?;
|
|
82
|
+
private container?;
|
|
83
|
+
private options;
|
|
84
|
+
private callbacks;
|
|
85
|
+
private drawHelper;
|
|
86
|
+
private overlayService;
|
|
87
|
+
private pointHandler;
|
|
88
|
+
private editClickHandler;
|
|
89
|
+
private editModeEnabled;
|
|
90
|
+
private editOptions?;
|
|
91
|
+
private originalRequestRenderMode;
|
|
92
|
+
private currentEditingEntity;
|
|
93
|
+
private lastEditedEntity;
|
|
94
|
+
private pointEditDragging;
|
|
95
|
+
private pointEditDraggingEntity;
|
|
96
|
+
private pointEditMarkerEntity;
|
|
97
|
+
private pointEditCameraBackup;
|
|
98
|
+
private activeTool;
|
|
99
|
+
private workAreaMode;
|
|
100
|
+
private workAreaType;
|
|
101
|
+
private workAreaKind;
|
|
102
|
+
private readonly entityTypeMap;
|
|
103
|
+
private readonly pointEntities;
|
|
104
|
+
private readonly toolColors;
|
|
105
|
+
private toolbarElement;
|
|
106
|
+
private readonly toolbarButtons;
|
|
107
|
+
private colorPanelElement;
|
|
108
|
+
private hoveredColorTool;
|
|
109
|
+
private colorPanelCloseTimer;
|
|
110
|
+
constructor(viewer: Cesium.Viewer, container?: HTMLElement, options?: CesiumMapMarkOptions, callbacks?: CesiumMapMarkCallbacks, map?: unknown);
|
|
111
|
+
constructor(viewer: Cesium.Viewer, map?: unknown, container?: HTMLElement, options?: CesiumMapMarkOptions, callbacks?: CesiumMapMarkCallbacks);
|
|
112
|
+
getViewer(): Cesium.Viewer;
|
|
113
|
+
getMap(): unknown;
|
|
114
|
+
getContainer(): HTMLElement | undefined;
|
|
115
|
+
getDrawHelper(): DrawHelper;
|
|
116
|
+
getOverlayService(): CesiumOverlayService;
|
|
117
|
+
getActiveTool(): CesiumMapDrawType | null;
|
|
118
|
+
getToolbarElement(): HTMLElement | null;
|
|
119
|
+
setCallbacks(callbacks: CesiumMapMarkCallbacks): void;
|
|
120
|
+
updateCallbacks(callbacks: Partial<CesiumMapMarkCallbacks>): void;
|
|
121
|
+
updateOptions(options: Partial<CesiumMapMarkOptions>): void;
|
|
122
|
+
startDrawTool(drawType: CesiumMapDrawType, options?: DrawOptions): void;
|
|
123
|
+
startDrawing(drawType: CesiumMapDrawType, options?: DrawOptions): void;
|
|
124
|
+
drawPoint(options?: DrawOptions): void;
|
|
125
|
+
drawPolyline(options?: DrawOptions): void;
|
|
126
|
+
drawPolygon(options?: DrawOptions): void;
|
|
127
|
+
drawRectangle(options?: DrawOptions): void;
|
|
128
|
+
drawCircle(options?: DrawOptions): void;
|
|
129
|
+
startWorkAreaDraw(drawType: CesiumMapWorkAreaType, areaType?: CesiumMapWorkAreaKind, options?: DrawOptions): void;
|
|
130
|
+
stopDraw(): void;
|
|
131
|
+
cancelDrawing(): void;
|
|
132
|
+
clearAll(): void;
|
|
133
|
+
deleteEntity(entity: Cesium.Entity | null | undefined): void;
|
|
134
|
+
removeEntity(entity: Cesium.Entity | null | undefined): void;
|
|
135
|
+
setColor(drawType: CesiumMapDrawType, color: string): void;
|
|
136
|
+
getColor(drawType: CesiumMapDrawType): string;
|
|
137
|
+
enableEdit(options?: Parameters<CesiumOverlayService["setOverlayEditMode"]>[1]): void;
|
|
138
|
+
disableEdit(): CesiumMapDrawResult | null;
|
|
139
|
+
startEdit(entityOrId: Cesium.Entity | string, options?: Parameters<CesiumOverlayService["startOverlayEdit"]>[1]): boolean;
|
|
140
|
+
stopEdit(): CesiumMapDrawResult | null;
|
|
141
|
+
getEntities(): Cesium.Entity[];
|
|
142
|
+
exportData(): CesiumMapMarkExportItem[];
|
|
143
|
+
handleSceneModeChanged(): void;
|
|
144
|
+
destroy(): void;
|
|
145
|
+
private setupDrawHelperCallbacks;
|
|
146
|
+
private startDrawHelper;
|
|
147
|
+
private createToolbar;
|
|
148
|
+
private rebuildToolbar;
|
|
149
|
+
private destroyToolbar;
|
|
150
|
+
private resolveButtonConfigs;
|
|
151
|
+
private createToolbarButton;
|
|
152
|
+
private formatCssPixel;
|
|
153
|
+
private applyToolbarStyle;
|
|
154
|
+
private applyButtonStyle;
|
|
155
|
+
private applyButtonContentColor;
|
|
156
|
+
private showColorPanel;
|
|
157
|
+
private renderColorPanel;
|
|
158
|
+
private applyColorPanelStyle;
|
|
159
|
+
private applyColorItemStyle;
|
|
160
|
+
private positionColorPanel;
|
|
161
|
+
private scheduleColorPanelClose;
|
|
162
|
+
private clearColorPanelCloseTimer;
|
|
163
|
+
private destroyColorPanel;
|
|
164
|
+
private updateToolbarActiveState;
|
|
165
|
+
private createEditableOverlayEntity;
|
|
166
|
+
private removeOriginalDrawEntity;
|
|
167
|
+
private startPointDrawing;
|
|
168
|
+
private installEditClickHandler;
|
|
169
|
+
private destroyEditClickHandler;
|
|
170
|
+
private showPointEditMarker;
|
|
171
|
+
private updatePointEditMarkerPosition;
|
|
172
|
+
private removePointEditMarker;
|
|
173
|
+
private pickPointEditEntity;
|
|
174
|
+
private isPointEditHit;
|
|
175
|
+
private getScreenDistance;
|
|
176
|
+
private pickPointEditPosition;
|
|
177
|
+
private pickDrawEntity;
|
|
178
|
+
private resolvePickedEntity;
|
|
179
|
+
private enableContinuousRenderForEdit;
|
|
180
|
+
private restoreRequestRenderModeAfterEdit;
|
|
181
|
+
private lockCameraForPointEdit;
|
|
182
|
+
private restoreCameraAfterPointEdit;
|
|
183
|
+
private emitEditEnd;
|
|
184
|
+
private buildDrawOptions;
|
|
185
|
+
private createWorkAreaOptions;
|
|
186
|
+
private buildDrawResult;
|
|
187
|
+
private buildWorkAreaDrawResult;
|
|
188
|
+
private getLngLatPositions;
|
|
189
|
+
private getCartesian3Positions;
|
|
190
|
+
private getRectangleLngLatPositions;
|
|
191
|
+
private calculateCartesianLength;
|
|
192
|
+
private resolveEntityDrawType;
|
|
193
|
+
private pickPosition;
|
|
194
|
+
private trackEntity;
|
|
195
|
+
private applyCircleStroke;
|
|
196
|
+
private resolveCesiumColor;
|
|
197
|
+
private normalizeColorKey;
|
|
198
|
+
private createInitialColors;
|
|
199
|
+
private normalizeConstructorArgs;
|
|
200
|
+
private emitError;
|
|
201
|
+
}
|
|
202
|
+
export default CesiumMapMark;
|
|
@@ -14,6 +14,14 @@ export interface ToolbarConfig {
|
|
|
14
14
|
buttons?: CustomButtonConfig[];
|
|
15
15
|
useI18n?: boolean;
|
|
16
16
|
i18n?: I18nLike;
|
|
17
|
+
/** 天地图 token(工具栏默认搜索、图层切换使用) */
|
|
18
|
+
TD_Token?: string;
|
|
19
|
+
/** 天地图 sk(工具栏默认搜索、图层切换使用) */
|
|
20
|
+
TD_SK?: string;
|
|
21
|
+
/** 天地图 token 别名 */
|
|
22
|
+
token?: string;
|
|
23
|
+
/** 天地图 sk 别名 */
|
|
24
|
+
sk?: string;
|
|
17
25
|
}
|
|
18
26
|
export interface ButtonConfig {
|
|
19
27
|
sort?: number;
|
|
@@ -87,9 +95,9 @@ export interface MapType {
|
|
|
87
95
|
/** 是否强制始终显示路网层(不受 placeName 开关影响) */
|
|
88
96
|
forcePlaceName?: boolean;
|
|
89
97
|
thumbnail: string;
|
|
90
|
-
provider: (token: string) => Cesium.ImageryProvider[];
|
|
91
|
-
terrainProvider?: (token: string) => Cesium.TerrainProvider | null;
|
|
92
|
-
geoWTFS?: (token: string, viewer: Cesium.Viewer) => any | null;
|
|
98
|
+
provider: (token: string, sk?: string) => Cesium.ImageryProvider[];
|
|
99
|
+
terrainProvider?: (token: string, sk?: string) => Cesium.TerrainProvider | null;
|
|
100
|
+
geoWTFS?: (token: string, viewer: Cesium.Viewer, sk?: string) => any | null;
|
|
93
101
|
}
|
|
94
102
|
export interface MapToolsConfig {
|
|
95
103
|
containerId: string;
|
|
@@ -25,6 +25,7 @@ export declare class CesiumMapToolbar {
|
|
|
25
25
|
private initialCenter?;
|
|
26
26
|
private currentMapType;
|
|
27
27
|
TD_Token: string;
|
|
28
|
+
TD_SK: string;
|
|
28
29
|
mapTypes: MapType[];
|
|
29
30
|
private isNoFlyZoneChecked;
|
|
30
31
|
private currentGeoWTFS;
|
|
@@ -77,6 +78,17 @@ export declare class CesiumMapToolbar {
|
|
|
77
78
|
* @param TD_Token
|
|
78
79
|
*/
|
|
79
80
|
setTDToken(TD_Token: string): void;
|
|
81
|
+
/**
|
|
82
|
+
* 设置天地图 sk
|
|
83
|
+
* @param TD_SK
|
|
84
|
+
*/
|
|
85
|
+
setTDSK(TD_SK: string): void;
|
|
86
|
+
/**
|
|
87
|
+
* 设置天地图认证参数
|
|
88
|
+
* @param TD_Token
|
|
89
|
+
* @param TD_SK
|
|
90
|
+
*/
|
|
91
|
+
setTDTAuth(TD_Token: string, TD_SK?: string): void;
|
|
80
92
|
/**
|
|
81
93
|
* 设置初始中心点
|
|
82
94
|
*/
|
|
@@ -13,6 +13,8 @@ interface CesiumMapControllerOptions {
|
|
|
13
13
|
getCurrentMapTypeId?: () => string;
|
|
14
14
|
/** 获取当前天地图 token(用于从 provider 读取 maximumLevel 时保持行为一致) */
|
|
15
15
|
getToken?: () => string;
|
|
16
|
+
/** 获取当前天地图 sk(用于从 provider 读取 maximumLevel 时保持行为一致) */
|
|
17
|
+
getSk?: () => string | undefined;
|
|
16
18
|
/** 缩放回调(来自 Toolbar 的 ZoomCallback) */
|
|
17
19
|
zoomCallback?: ZoomCallback;
|
|
18
20
|
/** 场景模式切换后回调(例如通知 DrawHelper 重新计算偏移) */
|
|
@@ -32,6 +34,7 @@ export declare class CesiumMapController {
|
|
|
32
34
|
private getMapTypes?;
|
|
33
35
|
private getCurrentMapTypeId?;
|
|
34
36
|
private getToken?;
|
|
37
|
+
private getSk?;
|
|
35
38
|
private zoomCallback?;
|
|
36
39
|
private onSceneModeChanged?;
|
|
37
40
|
private fullscreenCallback?;
|
|
@@ -12,9 +12,13 @@ export declare class SearchService {
|
|
|
12
12
|
private searchContainer;
|
|
13
13
|
private i18n;
|
|
14
14
|
private useI18n;
|
|
15
|
+
private getToken?;
|
|
16
|
+
private getSk?;
|
|
15
17
|
constructor(viewer: Viewer, toolbarElement: HTMLElement, searchCallback?: SearchCallback, options?: {
|
|
16
18
|
i18n?: I18nLike;
|
|
17
19
|
useI18n?: boolean;
|
|
20
|
+
getToken?: () => string | undefined;
|
|
21
|
+
getSk?: () => string | undefined;
|
|
18
22
|
});
|
|
19
23
|
/**
|
|
20
24
|
* 设置搜索回调
|
package/dist/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const buildTDTAuthParams: (token: string, sk?: string, includeSk?: boolean) => string;
|
package/dist/utils/common.d.ts
CHANGED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 覆盖物工具函数
|
|
3
|
+
* 整合绘制工具相关的公共方法
|
|
4
|
+
*/
|
|
5
|
+
import * as Cesium from 'cesium';
|
|
6
|
+
/**
|
|
7
|
+
* 将多边形顶点沿中心方向外扩指定距离
|
|
8
|
+
* @param positions - 原始多边形顶点经纬度数组 [lng, lat, height][]
|
|
9
|
+
* @param expandDistanceMeters - 外扩距离(米)
|
|
10
|
+
* @returns 外扩后的多边形顶点经纬度数组 [lng, lat, height][]
|
|
11
|
+
*/
|
|
12
|
+
export declare const expandPolygon: (positions: [number, number, number][], expandDistanceMeters: number) => [number, number, number][];
|
|
13
|
+
export type DrawType = 'point' | 'polyline' | 'polygon' | 'rectangle' | 'circle';
|
|
14
|
+
export declare const OVERLAY_PRESET_COLORS: readonly [{
|
|
15
|
+
readonly value: "blue";
|
|
16
|
+
readonly label: "蓝色";
|
|
17
|
+
readonly hex: "#007BFF";
|
|
18
|
+
}, {
|
|
19
|
+
readonly value: "orange";
|
|
20
|
+
readonly label: "橙色";
|
|
21
|
+
readonly hex: "#FF6932";
|
|
22
|
+
}, {
|
|
23
|
+
readonly value: "yellow";
|
|
24
|
+
readonly label: "黄色";
|
|
25
|
+
readonly hex: "#FFB700";
|
|
26
|
+
}, {
|
|
27
|
+
readonly value: "cyan";
|
|
28
|
+
readonly label: "青色";
|
|
29
|
+
readonly hex: "#13FFFF";
|
|
30
|
+
}, {
|
|
31
|
+
readonly value: "purple";
|
|
32
|
+
readonly label: "紫色";
|
|
33
|
+
readonly hex: "#ED64FF";
|
|
34
|
+
}];
|
|
35
|
+
export declare const OVERLAY_COLOR_HEX_LIST: ("#007BFF" | "#FF6932" | "#FFB700" | "#13FFFF" | "#ED64FF")[];
|
|
36
|
+
export interface LngLatPosition {
|
|
37
|
+
lng: number;
|
|
38
|
+
lat: number;
|
|
39
|
+
}
|
|
40
|
+
export interface CesiumPosition {
|
|
41
|
+
longitude: number;
|
|
42
|
+
latitude: number;
|
|
43
|
+
height?: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 颜色转Cesium颜色
|
|
47
|
+
*/
|
|
48
|
+
export declare const hexToCesiumColor: (hex: string, alpha?: number) => Cesium.Color;
|
|
49
|
+
/**
|
|
50
|
+
* 获取默认颜色
|
|
51
|
+
*/
|
|
52
|
+
export declare const getDefaultColor: () => string;
|
|
53
|
+
/**
|
|
54
|
+
* 根据颜色获取Cesium颜色(带透明度)
|
|
55
|
+
*/
|
|
56
|
+
export declare const getColorWithAlpha: (color: string, alpha?: number) => Cesium.Color;
|
|
57
|
+
/**
|
|
58
|
+
* 将 Cartesian3 转换为经纬度
|
|
59
|
+
*/
|
|
60
|
+
export declare const cartesian3ToLngLat: (position: Cesium.Cartesian3) => LngLatPosition;
|
|
61
|
+
/**
|
|
62
|
+
* 将经纬度转换为 Cartesian3
|
|
63
|
+
*/
|
|
64
|
+
export declare const lngLatToCartesian3: (lng: number, lat: number, height?: number) => Cesium.Cartesian3;
|
|
65
|
+
/**
|
|
66
|
+
* 将 { lng, lat }[] 转换为 [lng, lat, height][]
|
|
67
|
+
*/
|
|
68
|
+
export declare const lngLatArrayToCesiumPositions: (positions: LngLatPosition[], height?: number) => [number, number, number][];
|
|
69
|
+
/**
|
|
70
|
+
* 将 [lng, lat, height][] 转换为 { lng, lat }[]
|
|
71
|
+
*/
|
|
72
|
+
export declare const cesiumPositionsToLngLatArray: (positions: [number, number, number][]) => LngLatPosition[];
|
|
73
|
+
/**
|
|
74
|
+
* 计算两点之间的距离(米)- 使用大圆距离公式
|
|
75
|
+
*/
|
|
76
|
+
export declare const calculateDistanceByLngLat: (p1: LngLatPosition, p2: LngLatPosition) => number;
|
|
77
|
+
/**
|
|
78
|
+
* 计算线段总长度(米)
|
|
79
|
+
*/
|
|
80
|
+
export declare const calculatePolylineLength: (positions: LngLatPosition[]) => number;
|
|
81
|
+
/**
|
|
82
|
+
* 计算多边形面积(使用球面面积计算)
|
|
83
|
+
*/
|
|
84
|
+
export declare const calculatePolygonArea: (positions: LngLatPosition[]) => number;
|
|
85
|
+
/**
|
|
86
|
+
* 计算圆的面积
|
|
87
|
+
*/
|
|
88
|
+
export declare const calculateCircleArea: (radius: number) => number;
|
|
89
|
+
/**
|
|
90
|
+
* 计算几何中心点
|
|
91
|
+
*/
|
|
92
|
+
export declare const calculateCenter: (positions: LngLatPosition[]) => LngLatPosition | null;
|
|
93
|
+
/**
|
|
94
|
+
* 计算两个位置的中心点
|
|
95
|
+
*/
|
|
96
|
+
export declare const calculateTwoPointsCenter: (p1: LngLatPosition, p2: LngLatPosition) => LngLatPosition;
|
|
97
|
+
/**
|
|
98
|
+
* 格式化面积显示
|
|
99
|
+
*/
|
|
100
|
+
export declare const formatArea: (area: number) => string;
|
|
101
|
+
/**
|
|
102
|
+
* 格式化长度显示
|
|
103
|
+
*/
|
|
104
|
+
export declare const formatLength: (length: number) => string;
|
|
105
|
+
/**
|
|
106
|
+
* 格式化经纬度显示
|
|
107
|
+
*/
|
|
108
|
+
export declare const formatLngLat: (position: LngLatPosition) => string;
|
|
109
|
+
/**
|
|
110
|
+
* 获取绘制类型的默认名称
|
|
111
|
+
*/
|
|
112
|
+
export declare const getDefaultNameByType: (type: DrawType) => string;
|
|
113
|
+
/**
|
|
114
|
+
* 获取绘制类型的提示文本
|
|
115
|
+
*/
|
|
116
|
+
export declare const getDrawHintByType: (type: DrawType) => string;
|
|
117
|
+
/**
|
|
118
|
+
* 获取动态标签(根据绘制类型)
|
|
119
|
+
*/
|
|
120
|
+
export declare const getDynamicLabelByType: (type: DrawType) => string;
|
|
121
|
+
/**
|
|
122
|
+
* 获取类型对应的图标URL
|
|
123
|
+
* 需要在组件中动态导入
|
|
124
|
+
*/
|
|
125
|
+
export declare const getTypeIconUrl: (type: DrawType) => string;
|
|
126
|
+
/**
|
|
127
|
+
* 验证经纬度坐标是否有效
|
|
128
|
+
*/
|
|
129
|
+
export declare const isValidLngLat: (position: LngLatPosition) => boolean;
|
|
130
|
+
/**
|
|
131
|
+
* 从Cesium实体获取位置数据
|
|
132
|
+
*/
|
|
133
|
+
export declare const getEntityPositions: (entity: Cesium.Entity, type: DrawType) => LngLatPosition[];
|
|
134
|
+
/**
|
|
135
|
+
* 从Cesium实体获取Cartesian3位置数组
|
|
136
|
+
*/
|
|
137
|
+
export declare const getEntityCartesian3Positions: (entity: Cesium.Entity, type: DrawType) => Cesium.Cartesian3[];
|
|
138
|
+
/**
|
|
139
|
+
* 获取圆的半径(米)
|
|
140
|
+
*/
|
|
141
|
+
export declare const getCircleRadius: (entity: Cesium.Entity) => number | null;
|
|
142
|
+
/**
|
|
143
|
+
* 解析geometry字符串为对象
|
|
144
|
+
*/
|
|
145
|
+
export declare const parseGeometry: (geometry: any) => any;
|
|
146
|
+
/**
|
|
147
|
+
* 生成GUID
|
|
148
|
+
*/
|
|
149
|
+
export declare const generateGuid: () => string;
|
package/package.json
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@xingm/vmap-cesium-toolbar",
|
|
3
|
-
"version": "0.0.7-alpha.
|
|
4
|
-
"description": "A powerful Cesium map toolbar plugin with drawing, measurement, and interaction features",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "dist/index.es.js",
|
|
7
|
-
"module": "dist/index.es.js",
|
|
8
|
-
"types": "dist/index.d.ts",
|
|
9
|
-
"files": [
|
|
10
|
-
"dist",
|
|
11
|
-
"README.md"
|
|
12
|
-
],
|
|
13
|
-
"publishConfig": {
|
|
14
|
-
"access": "public"
|
|
15
|
-
},
|
|
16
|
-
"exports": {
|
|
17
|
-
".": {
|
|
18
|
-
"import": "./dist/index.es.js",
|
|
19
|
-
"default": "./dist/index.es.js"
|
|
20
|
-
},
|
|
21
|
-
"./style": "./dist/style.css"
|
|
22
|
-
},
|
|
23
|
-
"scripts": {
|
|
24
|
-
"dev": "vite --force",
|
|
25
|
-
"build": "vite build --mode lib",
|
|
26
|
-
"dist": "vite build",
|
|
27
|
-
"build:dts": "vue-tsc -p tsconfig.dts.json",
|
|
28
|
-
"build:plugin": "node scripts/build-plugin.js",
|
|
29
|
-
"docs:dev": "vitepress dev doc",
|
|
30
|
-
"docs:build": "vitepress build doc",
|
|
31
|
-
"docs:preview": "vitepress preview doc",
|
|
32
|
-
"generate:file-list": "node scripts/generate-file-list.js",
|
|
33
|
-
"preview": "vite preview",
|
|
34
|
-
"type-check": "vue-tsc --noEmit"
|
|
35
|
-
},
|
|
36
|
-
"peerDependencies": {
|
|
37
|
-
"vue": "^3.0.0"
|
|
38
|
-
},
|
|
39
|
-
"dependencies": {
|
|
40
|
-
"cesium": "^1.134.1",
|
|
41
|
-
"tdt-terrain-cesium-plugin": "^1.0.4",
|
|
42
|
-
"vue": "^3.5.18"
|
|
43
|
-
},
|
|
44
|
-
"devDependencies": {
|
|
45
|
-
"@types/cesium": "^1.70.4",
|
|
46
|
-
"@vitejs/plugin-vue": "^6.0.1",
|
|
47
|
-
"rollup-plugin-dts": "^6.1.0",
|
|
48
|
-
"vite": "^7.1.2",
|
|
49
|
-
"vite-plugin-cesium": "^1.2.23",
|
|
50
|
-
"vite-plugin-dts": "^4.5.4",
|
|
51
|
-
"vite-plugin-static-copy": "^3.1.2",
|
|
52
|
-
"vitepress": "^1.6.4",
|
|
53
|
-
"vue-tsc": "^3.0.5"
|
|
54
|
-
},
|
|
55
|
-
"keywords": [
|
|
56
|
-
"cesium",
|
|
57
|
-
"map",
|
|
58
|
-
"toolbar",
|
|
59
|
-
"drawing",
|
|
60
|
-
"measurement",
|
|
61
|
-
"vue3",
|
|
62
|
-
"typescript"
|
|
63
|
-
],
|
|
64
|
-
"author": "pengxueyou",
|
|
65
|
-
"license": "MIT",
|
|
66
|
-
"repository": {
|
|
67
|
-
"type": "git",
|
|
68
|
-
"url": "git+https://github.com/BenXueYou/vmap-cesium-tool.git"
|
|
69
|
-
},
|
|
70
|
-
"bugs": {
|
|
71
|
-
"url": "https://github.com/BenXueYou/vmap-cesium-tool/issues"
|
|
72
|
-
},
|
|
73
|
-
"homepage": "https://github.com/BenXueYou/vmap-cesium-tool#readme"
|
|
74
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@xingm/vmap-cesium-toolbar",
|
|
3
|
+
"version": "0.0.7-alpha.2",
|
|
4
|
+
"description": "A powerful Cesium map toolbar plugin with drawing, measurement, and interaction features",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.es.js",
|
|
7
|
+
"module": "dist/index.es.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"import": "./dist/index.es.js",
|
|
19
|
+
"default": "./dist/index.es.js"
|
|
20
|
+
},
|
|
21
|
+
"./style": "./dist/style.css"
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"dev": "vite --force",
|
|
25
|
+
"build": "vite build --mode lib",
|
|
26
|
+
"dist": "vite build",
|
|
27
|
+
"build:dts": "vue-tsc -p tsconfig.dts.json",
|
|
28
|
+
"build:plugin": "node scripts/build-plugin.js",
|
|
29
|
+
"docs:dev": "vitepress dev doc",
|
|
30
|
+
"docs:build": "vitepress build doc",
|
|
31
|
+
"docs:preview": "vitepress preview doc",
|
|
32
|
+
"generate:file-list": "node scripts/generate-file-list.js",
|
|
33
|
+
"preview": "vite preview",
|
|
34
|
+
"type-check": "vue-tsc --noEmit"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"vue": "^3.0.0"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"cesium": "^1.134.1",
|
|
41
|
+
"tdt-terrain-cesium-plugin": "^1.0.4",
|
|
42
|
+
"vue": "^3.5.18"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/cesium": "^1.70.4",
|
|
46
|
+
"@vitejs/plugin-vue": "^6.0.1",
|
|
47
|
+
"rollup-plugin-dts": "^6.1.0",
|
|
48
|
+
"vite": "^7.1.2",
|
|
49
|
+
"vite-plugin-cesium": "^1.2.23",
|
|
50
|
+
"vite-plugin-dts": "^4.5.4",
|
|
51
|
+
"vite-plugin-static-copy": "^3.1.2",
|
|
52
|
+
"vitepress": "^1.6.4",
|
|
53
|
+
"vue-tsc": "^3.0.5"
|
|
54
|
+
},
|
|
55
|
+
"keywords": [
|
|
56
|
+
"cesium",
|
|
57
|
+
"map",
|
|
58
|
+
"toolbar",
|
|
59
|
+
"drawing",
|
|
60
|
+
"measurement",
|
|
61
|
+
"vue3",
|
|
62
|
+
"typescript"
|
|
63
|
+
],
|
|
64
|
+
"author": "pengxueyou",
|
|
65
|
+
"license": "MIT",
|
|
66
|
+
"repository": {
|
|
67
|
+
"type": "git",
|
|
68
|
+
"url": "git+https://github.com/BenXueYou/vmap-cesium-tool.git"
|
|
69
|
+
},
|
|
70
|
+
"bugs": {
|
|
71
|
+
"url": "https://github.com/BenXueYou/vmap-cesium-tool/issues"
|
|
72
|
+
},
|
|
73
|
+
"homepage": "https://github.com/BenXueYou/vmap-cesium-tool#readme"
|
|
74
|
+
}
|