v-openlayers 2.9.5 → 2.10.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/package/v-map/global.d.ts +208 -0
- package/package/v-map/ol/config.d.ts +5 -0
- package/package/v-map/ol/lib/business/OlHandler.d.ts +49 -0
- package/package/v-map/ol/lib/config/mapConfig-4326.d.ts +36 -0
- package/package/v-map/ol/lib/core/VMap.d.ts +556 -0
- package/package/v-map/ol/lib/core/plugins/DrawConditions.d.ts +64 -0
- package/package/v-map/ol/lib/core/plugins/DrawHandler.d.ts +306 -0
- package/package/v-map/ol/lib/core/plugins/FeatureHandler.d.ts +117 -0
- package/package/v-map/ol/lib/core/plugins/GeojsonHandler.d.ts +76 -0
- package/package/v-map/ol/lib/core/plugins/GeometryHandler.d.ts +117 -0
- package/package/v-map/ol/lib/core/plugins/InteractionHandler.d.ts +230 -0
- package/package/v-map/ol/lib/core/plugins/KrigingHandler.d.ts +18 -0
- package/package/v-map/ol/lib/core/plugins/LayerHandler.d.ts +386 -0
- package/package/v-map/ol/lib/core/plugins/MeasureHandler.d.ts +32 -0
- package/package/v-map/ol/lib/core/plugins/Simplify.d.ts +26 -0
- package/package/v-map/ol/lib/core/plugins/StyleHandler.d.ts +72 -0
- package/package/v-map/ol/lib/core/plugins/TransformHandler.d.ts +35 -0
- package/package/v-map/ol/lib/core/plugins/WMTSExplorer.d.ts +108 -0
- package/package/v-map/ol/lib/core/plugins/WfsHandler.d.ts +66 -0
- package/package/v-map/ol/lib/core/plugins/WktHandler.d.ts +62 -0
- package/package/v-map/ol/lib/core/plugins/WmsHandler.d.ts +32 -0
- package/package/v-map/ol/lib/core/plugins/baidu/BaiduMap.d.ts +3 -0
- package/package/v-map/ol/lib/core/plugins/baidu/bd09.d.ts +2 -0
- package/package/v-map/ol/lib/core/plugins/mapbox-streets-v6-style.d.ts +1 -0
- package/package/v-map/ol/types/types.d.ts +84 -0
- package/package/v-map/public/utils/advanced/GradientColor.d.ts +27 -0
- package/package/v-map/public/utils/base/color.d.ts +17 -0
- package/package/v-map/public/utils/base/common.d.ts +126 -0
- package/package/v-map/public/utils/base/date.d.ts +52 -0
- package/package/v-map/public/utils/base/index.d.ts +340 -0
- package/package/v-map/public/utils/base/number.d.ts +21 -0
- package/package/v-map/public/utils/base/string.d.ts +16 -0
- package/package/v-map/public/utils/base/transform.d.ts +12 -0
- package/package/v-map/public/utils/base/type.d.ts +88 -0
- package/package/v-map/public/utils/base/utils.d.ts +155 -0
- package/package/v-map/public/utils/base/validate.d.ts +54 -0
- package/package/v-map/public/utils/map/index.d.ts +15 -0
- package/package/v-map/public/utils/map/ol.d.ts +7 -0
- package/package/v-map/public/utils/map/transform.d.ts +1 -0
- package/package/v-map/public/utils/map/turf.d.ts +1 -0
- package/package/v-openlayers.css +1 -1
- package/package/v-openlayers.d.ts +35 -9578
- package/package/v-openlayers.mjs +31034 -82215
- package/package.json +3 -2
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import { Map } from 'ol';
|
|
2
|
+
import { Modify } from 'ol/interaction';
|
|
3
|
+
import { Vector as VectorSource } from 'ol/source';
|
|
4
|
+
import { Vector as VectorLayer } from 'ol/layer';
|
|
5
|
+
import { LineString, Geometry } from 'ol/geom';
|
|
6
|
+
import { Feature } from 'ol';
|
|
7
|
+
/**
|
|
8
|
+
* 绘制类型枚举
|
|
9
|
+
*/
|
|
10
|
+
declare enum DrawType {
|
|
11
|
+
Point = "Point",
|
|
12
|
+
LineString = "LineString",
|
|
13
|
+
Polygon = "Polygon",
|
|
14
|
+
Circle = "Circle",
|
|
15
|
+
Box = "Box",
|
|
16
|
+
Ring = "Ring"
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 绘制错误代码
|
|
20
|
+
*/
|
|
21
|
+
declare enum DrawErrorCode {
|
|
22
|
+
EXCLUDE_POINT = 1,// 不相交
|
|
23
|
+
DEFAULT = 0
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 绘制条件配置接口
|
|
27
|
+
*/
|
|
28
|
+
interface DrawConditionsConfig {
|
|
29
|
+
intersectGeometries?: Geometry[];
|
|
30
|
+
showTip?: boolean;
|
|
31
|
+
maxStepDis?: number;
|
|
32
|
+
excludeGeometries?: Geometry[];
|
|
33
|
+
drawType?: DrawType;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 绘制选项接口
|
|
37
|
+
*/
|
|
38
|
+
interface DrawOptions {
|
|
39
|
+
map?: Map;
|
|
40
|
+
type?: DrawType;
|
|
41
|
+
snapEnable?: boolean;
|
|
42
|
+
modifyEnable?: boolean;
|
|
43
|
+
selectEnable?: boolean;
|
|
44
|
+
onceOnly?: boolean;
|
|
45
|
+
clear?: boolean;
|
|
46
|
+
freehand?: boolean;
|
|
47
|
+
drawStartHandle?: (params: DrawEventParams) => void;
|
|
48
|
+
drawEndHandle?: (params: DrawEventParams) => void;
|
|
49
|
+
selectedHandle?: (params: SelectEventParams) => void;
|
|
50
|
+
modifyEndHandle?: (params: ModifyEventParams) => void;
|
|
51
|
+
conditions?: DrawConditionsConfig;
|
|
52
|
+
style?: any;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* 绘制事件参数接口
|
|
56
|
+
*/
|
|
57
|
+
interface DrawEventParams {
|
|
58
|
+
e: any;
|
|
59
|
+
code?: DrawErrorCode;
|
|
60
|
+
intersect?: boolean;
|
|
61
|
+
feature?: Feature;
|
|
62
|
+
coordinates?: any[];
|
|
63
|
+
type?: string;
|
|
64
|
+
wkt?: string;
|
|
65
|
+
layer?: VectorLayer<any>;
|
|
66
|
+
dbClick?: boolean;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* 选择事件参数接口
|
|
70
|
+
*/
|
|
71
|
+
interface SelectEventParams {
|
|
72
|
+
features?: Feature[];
|
|
73
|
+
layer?: VectorLayer<any>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* 编辑事件参数接口
|
|
77
|
+
*/
|
|
78
|
+
interface ModifyEventParams {
|
|
79
|
+
e: any;
|
|
80
|
+
features?: Feature[];
|
|
81
|
+
layer?: VectorLayer<any>;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* @description 绘制处理器类
|
|
85
|
+
*/
|
|
86
|
+
declare class DrawHandler {
|
|
87
|
+
private map;
|
|
88
|
+
private curFeature;
|
|
89
|
+
private flag;
|
|
90
|
+
private remenberDrawCoordinates;
|
|
91
|
+
private rememberCoordsClone;
|
|
92
|
+
private step;
|
|
93
|
+
private timer;
|
|
94
|
+
private source;
|
|
95
|
+
private vector;
|
|
96
|
+
private draw;
|
|
97
|
+
private snap;
|
|
98
|
+
private modify;
|
|
99
|
+
private select;
|
|
100
|
+
private bInit;
|
|
101
|
+
private selectEnable;
|
|
102
|
+
private layerId;
|
|
103
|
+
private zIndex;
|
|
104
|
+
private imageStyle;
|
|
105
|
+
private defaultStyle;
|
|
106
|
+
private drawConditions;
|
|
107
|
+
private interactionHandler;
|
|
108
|
+
private layerHandler;
|
|
109
|
+
private drawType;
|
|
110
|
+
private spliceSnaps;
|
|
111
|
+
private splicePoints;
|
|
112
|
+
private spliceFeature;
|
|
113
|
+
private spliceLinestring;
|
|
114
|
+
private readonly splicePointsLayerId;
|
|
115
|
+
/**
|
|
116
|
+
* 键盘事件处理
|
|
117
|
+
*/
|
|
118
|
+
private handleKeydown;
|
|
119
|
+
/**
|
|
120
|
+
* 构造函数
|
|
121
|
+
* @param map 地图实例
|
|
122
|
+
*/
|
|
123
|
+
constructor(map?: Map | null);
|
|
124
|
+
/**
|
|
125
|
+
* 获取绘制类型枚举
|
|
126
|
+
*/
|
|
127
|
+
getDrawType(): typeof DrawType;
|
|
128
|
+
/**
|
|
129
|
+
* 获取绘制的矢量图层
|
|
130
|
+
*/
|
|
131
|
+
getLayer(): VectorLayer<any> | null;
|
|
132
|
+
/**
|
|
133
|
+
* 创建矢量图层
|
|
134
|
+
* @param style 样式配置
|
|
135
|
+
*/
|
|
136
|
+
private createLayer;
|
|
137
|
+
/**
|
|
138
|
+
* 初始化矢量图层
|
|
139
|
+
* @param map 地图实例
|
|
140
|
+
*/
|
|
141
|
+
private initVectorLayer;
|
|
142
|
+
/**
|
|
143
|
+
* 移除交互
|
|
144
|
+
* @param map 地图实例
|
|
145
|
+
*/
|
|
146
|
+
private removeInteraction;
|
|
147
|
+
/**
|
|
148
|
+
* 移除绘制交互
|
|
149
|
+
* @param map 地图实例
|
|
150
|
+
*/
|
|
151
|
+
removeDraw(map?: Map): void;
|
|
152
|
+
/**
|
|
153
|
+
* 激活捕捉
|
|
154
|
+
*/
|
|
155
|
+
activeSnap(): void;
|
|
156
|
+
/**
|
|
157
|
+
* 移除捕捉
|
|
158
|
+
* @param map 地图实例
|
|
159
|
+
*/
|
|
160
|
+
removeSnap(map?: Map): void;
|
|
161
|
+
/**
|
|
162
|
+
* 添加编辑交互
|
|
163
|
+
* @param map 地图实例
|
|
164
|
+
* @param selectEnable 是否启用选择
|
|
165
|
+
* @param modifyEnable 是否启用编辑
|
|
166
|
+
*/
|
|
167
|
+
addModify(map: Map, selectEnable?: boolean, modifyEnable?: boolean): void;
|
|
168
|
+
/**
|
|
169
|
+
* 激活选择
|
|
170
|
+
* @param map 地图实例
|
|
171
|
+
*/
|
|
172
|
+
activeSelect(map?: Map): void;
|
|
173
|
+
/**
|
|
174
|
+
* 移除选择
|
|
175
|
+
* @param map 地图实例
|
|
176
|
+
*/
|
|
177
|
+
removeSelect(map?: Map): void;
|
|
178
|
+
/**
|
|
179
|
+
* 激活编辑
|
|
180
|
+
* @param map 地图实例
|
|
181
|
+
*/
|
|
182
|
+
activeModify(map?: Map): Modify | null;
|
|
183
|
+
/**
|
|
184
|
+
* 移除编辑
|
|
185
|
+
* @param map 地图实例
|
|
186
|
+
*/
|
|
187
|
+
removeModify(map?: Map): void;
|
|
188
|
+
/**
|
|
189
|
+
* 绘制图形
|
|
190
|
+
* @param options 绘制选项
|
|
191
|
+
* @param type 绘制类型 Point|LineString|Polygon|Circle|Box|Ring
|
|
192
|
+
* @param selectEnable 是否启用选择
|
|
193
|
+
* @param modifyEnable 是否启用编辑
|
|
194
|
+
* @param onceOnly 是否仅绘制一次
|
|
195
|
+
* @param clear 是否清除之前的绘制
|
|
196
|
+
* @param freehand 是否启用自由绘制
|
|
197
|
+
* @param drawStartHandle 绘制开始回调
|
|
198
|
+
* @param drawEndHandle 绘制结束回调
|
|
199
|
+
* @param selectedHandle 选择回调
|
|
200
|
+
* @param modifyEndHandle 编辑结束回调
|
|
201
|
+
* @param conditions 绘制条件
|
|
202
|
+
* @param style 样式配置
|
|
203
|
+
*/
|
|
204
|
+
drawByType(options: DrawOptions): boolean;
|
|
205
|
+
/**
|
|
206
|
+
* 创建环形
|
|
207
|
+
* @param center 中心点坐标
|
|
208
|
+
* @param innerR 内半径
|
|
209
|
+
* @param outerR 外半径
|
|
210
|
+
*/
|
|
211
|
+
private createRing;
|
|
212
|
+
/**
|
|
213
|
+
* 初始化绘制条件
|
|
214
|
+
* @param conditions 条件配置
|
|
215
|
+
*/
|
|
216
|
+
private initConditions;
|
|
217
|
+
/**
|
|
218
|
+
* 绘制点
|
|
219
|
+
* @param drawEndHandle 绘制结束回调
|
|
220
|
+
* @param options 绘制选项
|
|
221
|
+
*/
|
|
222
|
+
drawPoint(drawEndHandle?: ((params: DrawEventParams) => void) | null, options?: Partial<DrawOptions>): boolean;
|
|
223
|
+
/**
|
|
224
|
+
* 绘制线
|
|
225
|
+
* @param drawEndHandle 绘制结束回调
|
|
226
|
+
* @param options 绘制选项
|
|
227
|
+
*/
|
|
228
|
+
drawLineString(drawEndHandle?: ((params: DrawEventParams) => void) | null, options?: Partial<DrawOptions>): boolean;
|
|
229
|
+
/**
|
|
230
|
+
* 结束绘制
|
|
231
|
+
* @param map 地图实例
|
|
232
|
+
*/
|
|
233
|
+
endDraw(map?: Map): void;
|
|
234
|
+
/**
|
|
235
|
+
* 结束交互
|
|
236
|
+
* @param map 地图实例
|
|
237
|
+
*/
|
|
238
|
+
endInteraction(map?: Map): void;
|
|
239
|
+
/**
|
|
240
|
+
* 删除绘制图层
|
|
241
|
+
* @param map 地图实例
|
|
242
|
+
*/
|
|
243
|
+
remove(map?: Map): void;
|
|
244
|
+
/**
|
|
245
|
+
* 清空绘制图形
|
|
246
|
+
* @param map 地图实例
|
|
247
|
+
*/
|
|
248
|
+
clear(map?: Map): void;
|
|
249
|
+
/**
|
|
250
|
+
* 后退一步
|
|
251
|
+
*/
|
|
252
|
+
backward(): void;
|
|
253
|
+
/**
|
|
254
|
+
* 线段分割
|
|
255
|
+
* @param param0 分割参数
|
|
256
|
+
*/
|
|
257
|
+
spliceLine({ source, line, style, callback, }: {
|
|
258
|
+
source: VectorSource;
|
|
259
|
+
line: LineString;
|
|
260
|
+
style: any;
|
|
261
|
+
callback: (spliced: any) => void;
|
|
262
|
+
}): void;
|
|
263
|
+
/**
|
|
264
|
+
* 处理线段分割完成
|
|
265
|
+
* @param callback 回调函数
|
|
266
|
+
*/
|
|
267
|
+
private handleSpliceLineComplete;
|
|
268
|
+
/**
|
|
269
|
+
* 处理分割点
|
|
270
|
+
* @param coordinates 坐标
|
|
271
|
+
* @param source 数据源
|
|
272
|
+
* @param style 样式
|
|
273
|
+
*/
|
|
274
|
+
private handleSplicePoint;
|
|
275
|
+
/**
|
|
276
|
+
* 设置分割捕捉交互
|
|
277
|
+
* @param source 数据源
|
|
278
|
+
* @param style 样式
|
|
279
|
+
*/
|
|
280
|
+
private setupSpliceSnapInteractions;
|
|
281
|
+
/**
|
|
282
|
+
* 创建分割点图层
|
|
283
|
+
* @param point 点坐标
|
|
284
|
+
* @param style 样式
|
|
285
|
+
*/
|
|
286
|
+
private createSplitPointsLayer;
|
|
287
|
+
/**
|
|
288
|
+
* 获取相交的线段
|
|
289
|
+
* @param geometry 几何体
|
|
290
|
+
* @param coordinate 坐标
|
|
291
|
+
*/
|
|
292
|
+
private getIntersectLinestring;
|
|
293
|
+
/**
|
|
294
|
+
* 移除最后一个点
|
|
295
|
+
*/
|
|
296
|
+
private removeLastPoint;
|
|
297
|
+
/**
|
|
298
|
+
* 结束线段分割
|
|
299
|
+
*/
|
|
300
|
+
endSpliceLine(): void;
|
|
301
|
+
/**
|
|
302
|
+
* 重置分割状态
|
|
303
|
+
*/
|
|
304
|
+
private resetSpliceState;
|
|
305
|
+
}
|
|
306
|
+
export default DrawHandler;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import VectorLayer from 'ol/layer/Vector';
|
|
2
|
+
import { Style } from 'ol/style';
|
|
3
|
+
import { Feature } from 'ol';
|
|
4
|
+
import { Geometry } from 'ol/geom';
|
|
5
|
+
import { Map } from 'ol';
|
|
6
|
+
/**
|
|
7
|
+
* 要素样式选项接口
|
|
8
|
+
*/
|
|
9
|
+
interface FeatureStyleOptions {
|
|
10
|
+
field?: string;
|
|
11
|
+
style?: Style;
|
|
12
|
+
labelField?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 点要素创建选项接口
|
|
16
|
+
*/
|
|
17
|
+
interface CreatePointsOptions {
|
|
18
|
+
style?: Style;
|
|
19
|
+
featureId?: string;
|
|
20
|
+
layerId?: string;
|
|
21
|
+
points: Array<{
|
|
22
|
+
lgtd: number;
|
|
23
|
+
lttd: number;
|
|
24
|
+
code?: string;
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* 图层管理接口
|
|
30
|
+
*/
|
|
31
|
+
interface LayerCollection {
|
|
32
|
+
[layerId: string]: VectorLayer<any> | null;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 从GeoJSON数据获取要素并应用样式
|
|
36
|
+
* @param geojson GeoJSON数据
|
|
37
|
+
* @param options 样式选项
|
|
38
|
+
* @returns 样式化后的要素数组
|
|
39
|
+
*/
|
|
40
|
+
export declare function getFeaturesFromGeojson(geojson: any, options?: FeatureStyleOptions): Feature<Geometry>[];
|
|
41
|
+
/**
|
|
42
|
+
* 从GeoJSON数据获取聚类要素(待实现)
|
|
43
|
+
* @param geojson GeoJSON数据
|
|
44
|
+
* @returns 聚类要素数组
|
|
45
|
+
*/
|
|
46
|
+
export declare function getFeatureClusterFromGeojson(geojson: any): Feature<Geometry>[];
|
|
47
|
+
/**
|
|
48
|
+
* 根据GeoJSON创建点要素图层
|
|
49
|
+
* @param options 创建选项
|
|
50
|
+
* @param map 地图实例
|
|
51
|
+
* @returns 创建的矢量图层
|
|
52
|
+
*/
|
|
53
|
+
export declare function createPointsByGeojson(options: CreatePointsOptions, map: Map): VectorLayer<any> | null;
|
|
54
|
+
/**
|
|
55
|
+
* 根据图层ID移除图层
|
|
56
|
+
* @param layerId 图层ID
|
|
57
|
+
* @param map 地图实例
|
|
58
|
+
*/
|
|
59
|
+
export declare function removeLayerById(layerId: string, map: Map): void;
|
|
60
|
+
/**
|
|
61
|
+
* 获取所有图层
|
|
62
|
+
* @returns 图层集合
|
|
63
|
+
*/
|
|
64
|
+
export declare function getLayerCollection(): LayerCollection;
|
|
65
|
+
/**
|
|
66
|
+
* 清空所有图层
|
|
67
|
+
* @param map 地图实例
|
|
68
|
+
*/
|
|
69
|
+
export declare function clearAllLayers(map: Map): void;
|
|
70
|
+
/**
|
|
71
|
+
* 根据图层ID获取图层
|
|
72
|
+
* @param layerId 图层ID
|
|
73
|
+
* @returns 图层实例或null
|
|
74
|
+
*/
|
|
75
|
+
export declare function getLayerById(layerId: string): VectorLayer<any> | null;
|
|
76
|
+
/**
|
|
77
|
+
* 检查图层是否存在
|
|
78
|
+
* @param layerId 图层ID
|
|
79
|
+
* @returns 是否存在
|
|
80
|
+
*/
|
|
81
|
+
export declare function checkLayerExists(layerId: string): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* 要素处理器工具类
|
|
84
|
+
*/
|
|
85
|
+
export declare class FeatureHandler {
|
|
86
|
+
private map;
|
|
87
|
+
private layerCollection;
|
|
88
|
+
constructor(map: Map);
|
|
89
|
+
/**
|
|
90
|
+
* 创建点要素图层
|
|
91
|
+
* @param options 创建选项
|
|
92
|
+
* @returns 创建的图层
|
|
93
|
+
*/
|
|
94
|
+
createPointsLayer(options: CreatePointsOptions): VectorLayer<any> | null;
|
|
95
|
+
/**
|
|
96
|
+
* 移除图层
|
|
97
|
+
* @param layerId 图层ID
|
|
98
|
+
*/
|
|
99
|
+
removeLayer(layerId: string): void;
|
|
100
|
+
/**
|
|
101
|
+
* 清空所有图层
|
|
102
|
+
*/
|
|
103
|
+
clearAllLayers(): void;
|
|
104
|
+
/**
|
|
105
|
+
* 获取图层
|
|
106
|
+
* @param layerId 图层ID
|
|
107
|
+
* @returns 图层实例
|
|
108
|
+
*/
|
|
109
|
+
getLayer(layerId: string): VectorLayer<any> | null;
|
|
110
|
+
/**
|
|
111
|
+
* 检查图层是否存在
|
|
112
|
+
* @param layerId 图层ID
|
|
113
|
+
* @returns 是否存在
|
|
114
|
+
*/
|
|
115
|
+
hasLayer(layerId: string): boolean;
|
|
116
|
+
}
|
|
117
|
+
export default FeatureHandler;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import GeoJSON from 'ol/format/GeoJSON';
|
|
2
|
+
import VectorLayer from 'ol/layer/Vector';
|
|
3
|
+
import { Style } from 'ol/style';
|
|
4
|
+
import Feature from 'ol/Feature';
|
|
5
|
+
import { Geometry } from 'ol/geom';
|
|
6
|
+
/**
|
|
7
|
+
* GeoJSON处理选项接口
|
|
8
|
+
*/
|
|
9
|
+
interface Wkt2LayerOptions {
|
|
10
|
+
id?: string;
|
|
11
|
+
style?: Style;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @description GeoJSON处理工具类
|
|
15
|
+
* 提供WKT与GeoJSON之间的相互转换功能
|
|
16
|
+
*/
|
|
17
|
+
export default class GeojsonHandler extends GeoJSON {
|
|
18
|
+
/** 默认样式配置 */
|
|
19
|
+
private readonly defaultStyle;
|
|
20
|
+
constructor();
|
|
21
|
+
/**
|
|
22
|
+
* 将要素转换为WKT格式
|
|
23
|
+
* @param feature - 要转换的要素
|
|
24
|
+
* @returns WKT字符串,如果是圆形几何体则返回空字符串
|
|
25
|
+
*/
|
|
26
|
+
feature2wkt(feature: Feature<Geometry>): string;
|
|
27
|
+
/**
|
|
28
|
+
* 将图层转换为WKT格式
|
|
29
|
+
* @param layer - 要转换的矢量图层
|
|
30
|
+
* @returns WKT字符串或错误信息
|
|
31
|
+
*/
|
|
32
|
+
layer2wkt(layer: VectorLayer<any> | null): string;
|
|
33
|
+
/**
|
|
34
|
+
* 将WKT字符串转换为矢量图层
|
|
35
|
+
* @param wkt - WKT格式的几何体字符串
|
|
36
|
+
* @param options - 图层配置选项
|
|
37
|
+
* @param options.id - 图层ID,默认使用UUID
|
|
38
|
+
* @param options.style - 要素样式,默认使用默认样式
|
|
39
|
+
* @returns 创建的矢量图层
|
|
40
|
+
*/
|
|
41
|
+
wkt2layer(wkt: string, options?: Wkt2LayerOptions): VectorLayer<any>;
|
|
42
|
+
/**
|
|
43
|
+
* 将GeoJSON转换为WKT格式
|
|
44
|
+
* @param geojson - GeoJSON对象或字符串
|
|
45
|
+
* @returns WKT字符串
|
|
46
|
+
*/
|
|
47
|
+
geojson2wkt(geojson: object | string): string;
|
|
48
|
+
/**
|
|
49
|
+
* 将WKT转换为GeoJSON格式
|
|
50
|
+
* @param wkt - WKT字符串
|
|
51
|
+
* @returns GeoJSON对象
|
|
52
|
+
*/
|
|
53
|
+
wkt2geojson(wkt: string): object;
|
|
54
|
+
/**
|
|
55
|
+
* 将要素数组转换为GeoJSON格式
|
|
56
|
+
* @param features - 要素数组
|
|
57
|
+
* @returns GeoJSON对象
|
|
58
|
+
*/
|
|
59
|
+
features2geojson(features: Feature<Geometry>[]): object;
|
|
60
|
+
/**
|
|
61
|
+
* 从GeoJSON创建矢量图层
|
|
62
|
+
* @param geojson - GeoJSON对象或字符串
|
|
63
|
+
* @param options - 图层配置选项
|
|
64
|
+
* @param options.id - 图层ID,默认使用UUID
|
|
65
|
+
* @param options.style - 要素样式,默认使用默认样式
|
|
66
|
+
* @returns 创建的矢量图层
|
|
67
|
+
*/
|
|
68
|
+
geojson2layer(geojson: object | string, options?: Wkt2LayerOptions): VectorLayer<Feature<Geometry>>;
|
|
69
|
+
/**
|
|
70
|
+
* 将VectorLayer转换为GeoJSON格式
|
|
71
|
+
* @param layer VectorLayer对象
|
|
72
|
+
* @returns GeoJSON对象
|
|
73
|
+
*/
|
|
74
|
+
layer2geojson(layer: VectorLayer<Feature<Geometry>> | null): object;
|
|
75
|
+
}
|
|
76
|
+
export {};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Polygon, Point } from 'ol/geom';
|
|
2
|
+
import { Style } from 'ol/style';
|
|
3
|
+
import Feature from 'ol/Feature';
|
|
4
|
+
import VectorLayer from 'ol/layer/Vector';
|
|
5
|
+
import Map from 'ol/Map';
|
|
6
|
+
/**
|
|
7
|
+
* 点坐标接口
|
|
8
|
+
*/
|
|
9
|
+
interface PointCoordinate {
|
|
10
|
+
lgtd: number;
|
|
11
|
+
lttd: number;
|
|
12
|
+
code?: string;
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 创建点图层配置选项
|
|
17
|
+
*/
|
|
18
|
+
interface CreatePointsOptions {
|
|
19
|
+
map: Map;
|
|
20
|
+
points: PointCoordinate[];
|
|
21
|
+
style?: Style;
|
|
22
|
+
layerId?: string;
|
|
23
|
+
featureId?: string;
|
|
24
|
+
zIndex?: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @description 几何图形处理工具类
|
|
28
|
+
* 提供圆形、环形、点等几何图形的创建功能
|
|
29
|
+
*/
|
|
30
|
+
export declare class GeometryHandler {
|
|
31
|
+
private readonly defaultStyle;
|
|
32
|
+
private layerHandler;
|
|
33
|
+
constructor();
|
|
34
|
+
/**
|
|
35
|
+
* 创建圆形点坐标数组
|
|
36
|
+
* @param map - 地图实例
|
|
37
|
+
* @param origin - 圆心坐标 [x, y]
|
|
38
|
+
* @param radius - 圆的半径(像素)
|
|
39
|
+
* @returns 圆形边界点坐标数组
|
|
40
|
+
*/
|
|
41
|
+
private createCirclePoints;
|
|
42
|
+
/**
|
|
43
|
+
* 创建圆形多边形
|
|
44
|
+
* @param map - 地图实例
|
|
45
|
+
* @param center - 圆心坐标 [x, y]
|
|
46
|
+
* @param radius - 圆的半径(像素)
|
|
47
|
+
* @returns 圆形多边形几何体
|
|
48
|
+
*/
|
|
49
|
+
createCircle(center: [number, number], radius: number): Polygon;
|
|
50
|
+
/**
|
|
51
|
+
* 创建环形多边形(圆环)
|
|
52
|
+
* @param map - 地图实例
|
|
53
|
+
* @param center - 圆心坐标 [x, y]
|
|
54
|
+
* @param outerRadius - 外圆半径(像素)
|
|
55
|
+
* @param innerRadius - 内圆半径(像素)
|
|
56
|
+
* @returns 环形多边形几何体
|
|
57
|
+
*/
|
|
58
|
+
createRing(center: [number, number], outerRadius: number, innerRadius: number): Polygon;
|
|
59
|
+
/**
|
|
60
|
+
* 创建单个点要素
|
|
61
|
+
* @param coordinate - 点坐标 [x, y]
|
|
62
|
+
* @param style - 点样式
|
|
63
|
+
* @param properties - 点属性
|
|
64
|
+
* @returns 点要素
|
|
65
|
+
*/
|
|
66
|
+
createPoint(coordinate: [number, number], style?: Style, properties?: Record<string, any>): Feature<Point>;
|
|
67
|
+
/**
|
|
68
|
+
* 创建点图层
|
|
69
|
+
* @param options - 创建点图层的配置选项
|
|
70
|
+
* @returns 创建的矢量图层
|
|
71
|
+
*/
|
|
72
|
+
createPoints(options: CreatePointsOptions): VectorLayer<any>;
|
|
73
|
+
/**
|
|
74
|
+
* 创建圆形要素
|
|
75
|
+
* @param center - 圆心坐标 [x, y]
|
|
76
|
+
* @param radius - 圆的半径(像素)
|
|
77
|
+
* @param style - 样式配置
|
|
78
|
+
* @param properties - 要素属性
|
|
79
|
+
* @returns 圆形要素
|
|
80
|
+
*/
|
|
81
|
+
createCircleFeature(center: [number, number], radius: number, style?: Style, properties?: Record<string, any>): Feature<Polygon>;
|
|
82
|
+
/**
|
|
83
|
+
* 创建环形要素
|
|
84
|
+
* @param center - 圆心坐标 [x, y]
|
|
85
|
+
* @param outerRadius - 外圆半径(像素)
|
|
86
|
+
* @param innerRadius - 内圆半径(像素)
|
|
87
|
+
* @param style - 样式配置
|
|
88
|
+
* @param properties - 要素属性
|
|
89
|
+
* @returns 环形要素
|
|
90
|
+
*/
|
|
91
|
+
createRingFeature(center: [number, number], outerRadius: number, innerRadius: number, style?: Style, properties?: Record<string, any>): Feature<Polygon>;
|
|
92
|
+
/**
|
|
93
|
+
* 创建圆形图层
|
|
94
|
+
* @param map - 地图实例
|
|
95
|
+
* @param center - 圆心坐标 [x, y]
|
|
96
|
+
* @param radius - 圆的半径(像素)
|
|
97
|
+
* @param layerId - 图层ID
|
|
98
|
+
* @param style - 样式配置
|
|
99
|
+
* @returns 创建的矢量图层
|
|
100
|
+
*/
|
|
101
|
+
createCircleLayer(map: Map, center: [number, number], radius: number, layerId?: string, style?: Style): VectorLayer<any>;
|
|
102
|
+
/**
|
|
103
|
+
* 创建环形图层
|
|
104
|
+
* @param map - 地图实例
|
|
105
|
+
* @param center - 圆心坐标 [x, y]
|
|
106
|
+
* @param outerRadius - 外圆半径(像素)
|
|
107
|
+
* @param innerRadius - 内圆半径(像素)
|
|
108
|
+
* @param layerId - 图层ID
|
|
109
|
+
* @param style - 样式配置
|
|
110
|
+
* @returns 创建的矢量图层
|
|
111
|
+
*/
|
|
112
|
+
createRingLayer(map: Map, center: [number, number], outerRadius: number, innerRadius: number, layerId?: string, style?: Style): VectorLayer<any>;
|
|
113
|
+
}
|
|
114
|
+
export declare function createCircle(map: Map, center: [number, number], radius: number): Polygon;
|
|
115
|
+
export declare function createRing(map: Map, center: [number, number], outerRadius: number, innerRadius: number): Polygon;
|
|
116
|
+
export declare function createPoints(options: CreatePointsOptions): VectorLayer<any>;
|
|
117
|
+
export default GeometryHandler;
|