@xingm/vmap-cesium-toolbar 0.0.1-alpha.6 → 0.0.1-alpha.7
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/index.d.ts +220 -14
- package/dist/package.json +45 -0
- package/dist/style.css +162 -0
- package/package.json +1 -1
- /package/dist/{index.es.js → index.js} +0 -0
- /package/dist/{index.es.js.map → index.js.map} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,220 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
// VMap Cesium Toolbar Plugin Type Definitions
|
|
2
|
+
|
|
3
|
+
import type { Viewer, Cartesian3, Cartographic } from 'cesium';
|
|
4
|
+
|
|
5
|
+
// 工具栏配置接口
|
|
6
|
+
export interface ToolbarConfig {
|
|
7
|
+
position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
|
|
8
|
+
buttonSize?: number;
|
|
9
|
+
buttonSpacing?: number;
|
|
10
|
+
backgroundColor?: string;
|
|
11
|
+
borderColor?: string;
|
|
12
|
+
borderRadius?: number;
|
|
13
|
+
borderWidth?: number;
|
|
14
|
+
boxShadow?: string;
|
|
15
|
+
zIndex?: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// 按钮配置接口
|
|
19
|
+
export interface ButtonConfig {
|
|
20
|
+
id: string;
|
|
21
|
+
icon: string;
|
|
22
|
+
title: string;
|
|
23
|
+
size?: number;
|
|
24
|
+
color?: string;
|
|
25
|
+
hoverColor?: string;
|
|
26
|
+
activeColor?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// 搜索回调接口
|
|
30
|
+
export interface SearchCallback {
|
|
31
|
+
onSearch?: (query: string) => Promise<SearchResult[]>;
|
|
32
|
+
onSelect?: (result: SearchResult) => void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// 搜索结果接口
|
|
36
|
+
export interface SearchResult {
|
|
37
|
+
name: string;
|
|
38
|
+
address: string;
|
|
39
|
+
longitude: number;
|
|
40
|
+
latitude: number;
|
|
41
|
+
height?: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// 测量回调接口
|
|
45
|
+
export interface MeasurementCallback {
|
|
46
|
+
onDistanceComplete?: (positions: Cartesian3[], distance: number) => void;
|
|
47
|
+
onAreaComplete?: (positions: Cartesian3[], area: number) => void;
|
|
48
|
+
onClear?: () => void;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// 缩放回调接口
|
|
52
|
+
export interface ZoomCallback {
|
|
53
|
+
onZoomIn?: (beforeLevel: number, afterLevel: number) => void;
|
|
54
|
+
onZoomOut?: (beforeLevel: number, afterLevel: number) => void;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// 地图类型接口
|
|
58
|
+
export interface MapType {
|
|
59
|
+
id: string;
|
|
60
|
+
name: string;
|
|
61
|
+
thumbnail: string;
|
|
62
|
+
provider: any; // Cesium.ImageryProvider
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// 视锥体选项接口
|
|
66
|
+
export interface FrustumOptions {
|
|
67
|
+
position?: Cartesian3;
|
|
68
|
+
orientation?: any; // Cesium.Quaternion
|
|
69
|
+
fov?: number;
|
|
70
|
+
aspectRatio?: number;
|
|
71
|
+
near?: number;
|
|
72
|
+
far?: number;
|
|
73
|
+
fillColor?: any; // Cesium.Color
|
|
74
|
+
outlineColor?: any; // Cesium.Color
|
|
75
|
+
onRightClick?: (position: Cartesian3) => void;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// 覆盖物选项接口
|
|
79
|
+
export interface OverlayOptions {
|
|
80
|
+
position: Cartesian3;
|
|
81
|
+
type: 'point' | 'label' | 'billboard' | 'model' | 'cylinder';
|
|
82
|
+
text?: string;
|
|
83
|
+
image?: string;
|
|
84
|
+
model?: string;
|
|
85
|
+
color?: any; // Cesium.Color
|
|
86
|
+
scale?: number;
|
|
87
|
+
height?: number;
|
|
88
|
+
width?: number;
|
|
89
|
+
heightReference?: any; // Cesium.HeightReference
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// 地图中心点接口
|
|
93
|
+
export interface MapCenter {
|
|
94
|
+
latitude: number;
|
|
95
|
+
longitude: number;
|
|
96
|
+
height: number;
|
|
97
|
+
pitch?: number;
|
|
98
|
+
heading?: number;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// 初始化选项接口
|
|
102
|
+
export interface InitOptions {
|
|
103
|
+
token?: string;
|
|
104
|
+
cesiumToken?: string;
|
|
105
|
+
terrain?: any; // Cesium.Terrain
|
|
106
|
+
terrainProvider?: any; // Cesium.TerrainProvider
|
|
107
|
+
mapType?: string;
|
|
108
|
+
imageryProvider?: any; // Cesium.UrlTemplateImageryProvider
|
|
109
|
+
imageryLayers?: any; // Cesium.ImageryLayerCollection
|
|
110
|
+
terrainShadows?: any; // Cesium.ShadowMode
|
|
111
|
+
contextOptions?: any; // Cesium.ContextOptions
|
|
112
|
+
scene3DOnly?: boolean;
|
|
113
|
+
isFlyTo?: boolean;
|
|
114
|
+
isFly?: boolean;
|
|
115
|
+
selectionIndicator?: boolean;
|
|
116
|
+
navigationHelpButton?: boolean;
|
|
117
|
+
fullscreenButton?: boolean;
|
|
118
|
+
geocoder?: boolean;
|
|
119
|
+
homeButton?: boolean;
|
|
120
|
+
infoBox?: boolean;
|
|
121
|
+
sceneModePicker?: boolean;
|
|
122
|
+
baseLayerPicker?: boolean;
|
|
123
|
+
timeline?: boolean;
|
|
124
|
+
animation?: boolean;
|
|
125
|
+
clock?: any; // Cesium.Clock
|
|
126
|
+
navigationInstructionsInitiallyVisible?: boolean;
|
|
127
|
+
sceneMode?: any; // Cesium.SceneMode
|
|
128
|
+
screenSpaceEventHandler?: any; // Cesium.ScreenSpaceEventHandler
|
|
129
|
+
useDefaultRenderLoop?: boolean;
|
|
130
|
+
targetFrameRate?: number;
|
|
131
|
+
showRenderLoopErrors?: boolean;
|
|
132
|
+
automaticallyTrackDataSourceClocks?: boolean;
|
|
133
|
+
dataSources?: any; // Cesium.DataSourceCollection
|
|
134
|
+
creationTime?: number;
|
|
135
|
+
useBrowserRecommendedResolution?: boolean;
|
|
136
|
+
resolutionScale?: number;
|
|
137
|
+
orderIndependentTransparency?: boolean;
|
|
138
|
+
shadows?: boolean;
|
|
139
|
+
terrainExaggeration?: number;
|
|
140
|
+
maximumScreenSpaceError?: number;
|
|
141
|
+
maximumNumberOfLoadedTiles?: number;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// 主要类声明
|
|
145
|
+
export declare class CesiumMapToolbar {
|
|
146
|
+
constructor(
|
|
147
|
+
viewer: Viewer,
|
|
148
|
+
container: HTMLElement,
|
|
149
|
+
config?: ToolbarConfig,
|
|
150
|
+
callbacks?: {
|
|
151
|
+
search?: SearchCallback;
|
|
152
|
+
measurement?: MeasurementCallback;
|
|
153
|
+
zoom?: ZoomCallback;
|
|
154
|
+
},
|
|
155
|
+
initialCenter?: { longitude: number; latitude: number; height: number }
|
|
156
|
+
);
|
|
157
|
+
setMapTypes(mapTypes: MapType[]): void;
|
|
158
|
+
setTDToken(TD_Token: string): void;
|
|
159
|
+
setInitialCenter(center: { longitude: number; latitude: number; height: number }): void;
|
|
160
|
+
getInitialCenter(): { longitude: number; latitude: number; height: number } | undefined;
|
|
161
|
+
resetToInitialLocation(): void;
|
|
162
|
+
drawMonitoringCircle(
|
|
163
|
+
longitude: number,
|
|
164
|
+
latitude: number,
|
|
165
|
+
height: number,
|
|
166
|
+
radius: number,
|
|
167
|
+
options?: {
|
|
168
|
+
borderColor?: string;
|
|
169
|
+
fillColor?: string;
|
|
170
|
+
borderWidth?: number;
|
|
171
|
+
name?: string;
|
|
172
|
+
}
|
|
173
|
+
): any; // Cesium.Entity
|
|
174
|
+
drawVerticalLine(
|
|
175
|
+
longitude: number,
|
|
176
|
+
latitude: number,
|
|
177
|
+
height: number,
|
|
178
|
+
options?: {
|
|
179
|
+
color?: string;
|
|
180
|
+
width?: number;
|
|
181
|
+
dashPattern?: number;
|
|
182
|
+
name?: string;
|
|
183
|
+
groundHeight?: number;
|
|
184
|
+
}
|
|
185
|
+
): any; // Cesium.Entity
|
|
186
|
+
destroy(): void;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export declare class DrawHelper {
|
|
190
|
+
constructor(viewer: Viewer);
|
|
191
|
+
startDrawingLine(): void;
|
|
192
|
+
startDrawingPolygon(): void;
|
|
193
|
+
startDrawingRectangle(): void;
|
|
194
|
+
drawFrustum(options?: FrustumOptions): void;
|
|
195
|
+
endDrawing(): void;
|
|
196
|
+
clearAll(): void;
|
|
197
|
+
clearFrustum(): void;
|
|
198
|
+
removeEntity(entity: any): void; // Cesium.Entity
|
|
199
|
+
getFinishedEntities(): any[]; // Cesium.Entity[]
|
|
200
|
+
onDrawStart(callback: () => void): void;
|
|
201
|
+
onDrawEnd(callback: (entity: any) => void): void; // Cesium.Entity | null
|
|
202
|
+
onEntityRemoved(callback: (entity: any) => void): void; // Cesium.Entity
|
|
203
|
+
destroy(): void;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export declare function initCesium(
|
|
207
|
+
containerId: string,
|
|
208
|
+
options: InitOptions,
|
|
209
|
+
mapCenter?: MapCenter,
|
|
210
|
+
cesiumToken?: String
|
|
211
|
+
): Promise<{ viewer: Viewer; initialCenter: MapCenter }>;
|
|
212
|
+
|
|
213
|
+
// 默认导出
|
|
214
|
+
declare const _default: {
|
|
215
|
+
CesiumMapToolbar: typeof CesiumMapToolbar;
|
|
216
|
+
DrawHelper: typeof DrawHelper;
|
|
217
|
+
initCesium: typeof initCesium;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
export default _default;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xingm/vmap-cesium-toolbar",
|
|
3
|
+
"version": "0.0.1-alpha.6",
|
|
4
|
+
"description": "A powerful Cesium map toolbar plugin with drawing, measurement, and interaction features",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"module": "index.js",
|
|
8
|
+
"types": "index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"index.js",
|
|
11
|
+
"index.d.ts",
|
|
12
|
+
"style.css",
|
|
13
|
+
"README.md",
|
|
14
|
+
"geojson"
|
|
15
|
+
],
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"import": "./index.js",
|
|
19
|
+
"types": "./index.d.ts"
|
|
20
|
+
},
|
|
21
|
+
"./style": "./style.css"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"vue": "^3.0.0"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"cesium",
|
|
28
|
+
"map",
|
|
29
|
+
"toolbar",
|
|
30
|
+
"drawing",
|
|
31
|
+
"measurement",
|
|
32
|
+
"vue3",
|
|
33
|
+
"typescript"
|
|
34
|
+
],
|
|
35
|
+
"author": "pengxueyou",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "https://github.com/your-username/vmap-cesium-toolbar.git"
|
|
40
|
+
},
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/your-username/vmap-cesium-toolbar/issues"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "https://github.com/your-username/vmap-cesium-toolbar#readme"
|
|
45
|
+
}
|
package/dist/style.css
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/* VMap Cesium Toolbar Plugin Styles */
|
|
2
|
+
|
|
3
|
+
/* 工具栏基础样式 */
|
|
4
|
+
.cesium-map-toolbar {
|
|
5
|
+
position: absolute;
|
|
6
|
+
background: rgba(255, 255, 255, 0.95);
|
|
7
|
+
border: 1px solid #e0e0e0;
|
|
8
|
+
border-radius: 6px;
|
|
9
|
+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
|
10
|
+
padding: 8px;
|
|
11
|
+
z-index: 1000;
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
gap: 8px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* 工具栏按钮样式 */
|
|
18
|
+
.cesium-toolbar-button {
|
|
19
|
+
width: 40px;
|
|
20
|
+
height: 40px;
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
background: rgba(66, 133, 244, 0.4);
|
|
25
|
+
color: white;
|
|
26
|
+
border: none;
|
|
27
|
+
border-radius: 4px;
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
font-size: 14px;
|
|
30
|
+
font-weight: bold;
|
|
31
|
+
transition: all 0.2s ease;
|
|
32
|
+
user-select: none;
|
|
33
|
+
position: relative;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.cesium-toolbar-button:hover {
|
|
37
|
+
background: rgba(51, 103, 214, 0.9);
|
|
38
|
+
transform: scale(1.05);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* 搜索容器样式 */
|
|
42
|
+
.search-container {
|
|
43
|
+
position: absolute;
|
|
44
|
+
background: white;
|
|
45
|
+
border: 1px solid #e0e0e0;
|
|
46
|
+
border-radius: 4px;
|
|
47
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
48
|
+
padding: 8px;
|
|
49
|
+
min-width: 200px;
|
|
50
|
+
z-index: 1001;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.search-container input {
|
|
54
|
+
padding: 6px 8px;
|
|
55
|
+
border: 1px solid #ddd;
|
|
56
|
+
border-radius: 3px;
|
|
57
|
+
font-size: 14px;
|
|
58
|
+
outline: none;
|
|
59
|
+
width: 100%;
|
|
60
|
+
box-sizing: border-box;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.search-results {
|
|
64
|
+
margin-top: 8px;
|
|
65
|
+
max-height: 200px;
|
|
66
|
+
overflow-y: auto;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.search-results > div {
|
|
70
|
+
padding: 8px;
|
|
71
|
+
border-bottom: 1px solid #f0f0f0;
|
|
72
|
+
cursor: pointer;
|
|
73
|
+
transition: background-color 0.2s;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.search-results > div:hover {
|
|
77
|
+
background-color: #f5f5f5;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* 测量菜单样式 */
|
|
81
|
+
.measurement-menu,
|
|
82
|
+
.layers-menu {
|
|
83
|
+
position: absolute;
|
|
84
|
+
background: white;
|
|
85
|
+
border: 1px solid #e0e0e0;
|
|
86
|
+
border-radius: 4px;
|
|
87
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
|
88
|
+
padding: 4px 0;
|
|
89
|
+
min-width: 120px;
|
|
90
|
+
z-index: 1001;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.layers-menu {
|
|
94
|
+
padding: 8px;
|
|
95
|
+
min-width: 200px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.measurement-menu > div,
|
|
99
|
+
.layers-menu > div {
|
|
100
|
+
padding: 8px 12px;
|
|
101
|
+
cursor: pointer;
|
|
102
|
+
display: flex;
|
|
103
|
+
align-items: center;
|
|
104
|
+
gap: 8px;
|
|
105
|
+
transition: background-color 0.2s;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.measurement-menu > div:hover,
|
|
109
|
+
.layers-menu > div:hover {
|
|
110
|
+
background-color: #f5f5f5;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* 图层菜单项样式 */
|
|
114
|
+
.layers-menu .map-type-item {
|
|
115
|
+
display: flex;
|
|
116
|
+
align-items: center;
|
|
117
|
+
gap: 8px;
|
|
118
|
+
padding: 6px;
|
|
119
|
+
cursor: pointer;
|
|
120
|
+
border-radius: 3px;
|
|
121
|
+
transition: background-color 0.2s;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.layers-menu .map-type-item:hover {
|
|
125
|
+
background-color: #f5f5f5;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.layers-menu .map-type-item.selected {
|
|
129
|
+
background-color: #e3f2fd;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.layers-menu .map-type-thumbnail {
|
|
133
|
+
width: 20px;
|
|
134
|
+
height: 20px;
|
|
135
|
+
border-radius: 2px;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.layers-menu .map-type-checkmark {
|
|
139
|
+
color: #1976d2;
|
|
140
|
+
font-weight: bold;
|
|
141
|
+
margin-left: auto;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* 响应式设计 */
|
|
145
|
+
@media (max-width: 768px) {
|
|
146
|
+
.cesium-map-toolbar {
|
|
147
|
+
padding: 6px;
|
|
148
|
+
gap: 6px;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.cesium-toolbar-button {
|
|
152
|
+
width: 36px;
|
|
153
|
+
height: 36px;
|
|
154
|
+
font-size: 12px;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.search-container,
|
|
158
|
+
.measurement-menu,
|
|
159
|
+
.layers-menu {
|
|
160
|
+
min-width: 180px;
|
|
161
|
+
}
|
|
162
|
+
}
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|