my-openlayer 2.0.0 → 2.0.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.
package/types.d.ts CHANGED
@@ -1,302 +1,305 @@
1
- import BaseLayer from "ol/layer/Base";
2
- import TileLayer from "ol/layer/Tile";
3
- import { WMTS } from "ol/source";
4
- import View from "ol/View";
5
- import Feature from "ol/Feature";
6
- export interface FeatureData {
7
- type: string;
8
- properties: any;
9
- geometry: {
10
- type: "Polygon" | "MultiPolygon" | "Point" | "LineString" | "MultiLineString" | "MultiPoint" | "GeometryCollection";
11
- coordinates: any[];
12
- };
13
- }
14
- export interface MapJSONData {
15
- type: string;
16
- name?: string;
17
- features: FeatureData[];
18
- }
19
- type LayerItem = BaseLayer | TileLayer<WMTS>;
20
- export interface MapInitType {
21
- layers?: LayerItem[] | {
22
- [key: string]: LayerItem[];
23
- };
24
- zoom?: number;
25
- center?: number[];
26
- view?: View;
27
- minZoom?: number;
28
- maxZoom?: number;
29
- extent?: number[];
30
- mapClipData?: MapJSONData;
31
- token?: string;
32
- annotation?: boolean;
33
- }
34
- export type AnnotationType = 'cva_c' | 'cia_c' | 'cta_c';
35
- export type TiandituType = 'vec_c' | 'img_c' | 'ter_c';
36
- export interface MapLayers {
37
- vec_c?: BaseLayer[];
38
- img_c?: BaseLayer[];
39
- ter_c?: BaseLayer[];
40
- [key: string]: BaseLayer[] | undefined;
41
- }
42
- export interface MapLayersOptions {
43
- layers?: BaseLayer[] | MapLayers;
44
- zIndex?: number;
45
- mapClip?: boolean;
46
- mapClipData?: MapJSONData;
47
- token?: string;
48
- annotation?: boolean;
49
- }
50
- export interface AnnotationLayerOptions {
51
- type: AnnotationType;
52
- token: string;
53
- zIndex?: number;
54
- visible?: boolean;
55
- }
56
- export interface HeatMapOptions {
57
- layerName?: string;
58
- radius?: number;
59
- blur?: number;
60
- gradient?: string[];
61
- opacity?: number;
62
- visible?: boolean;
63
- zIndex?: number;
64
- valueKey?: string;
65
- }
66
- /**
67
- * 基础选项接口 - 所有图层的公共配置
68
- */
69
- export interface BaseOptions {
70
- /** 图层名称 */
71
- layerName?: string;
72
- /** 图层层级 */
73
- zIndex?: number;
74
- /** 图层可见性 */
75
- visible?: boolean;
76
- /** 图层透明度 */
77
- opacity?: number;
78
- /** 是否适应视图 */
79
- fitView?: boolean;
80
- /** 地图裁剪 */
81
- mapClip?: boolean;
82
- /** 地图裁剪数据 */
83
- mapClipData?: MapJSONData;
84
- /** 投影选项 */
85
- projectionOptOptions?: any;
86
- }
87
- /**
88
- * 样式选项接口 - 图形样式相关配置
89
- */
90
- export interface StyleOptions {
91
- /** 描边颜色 */
92
- strokeColor?: string | number[];
93
- /** 描边宽度 */
94
- strokeWidth?: number;
95
- /** 线条虚线样式 */
96
- lineDash?: number[];
97
- /** 线条虚线偏移 */
98
- lineDashOffset?: number;
99
- /** 填充颜色 */
100
- fillColor?: string;
101
- /** 填充颜色回调函数 */
102
- fillColorCallBack?: (feature: Feature) => string;
103
- }
104
- /**
105
- * 文本选项接口 - 文本标注相关配置
106
- */
107
- export interface TextOptions {
108
- /** 文本可见性 */
109
- textVisible?: boolean;
110
- /** 文本内容回调函数 */
111
- textCallBack?: (feature: Feature) => string;
112
- /** 文本字体 */
113
- textFont?: string;
114
- /** 文本填充颜色 */
115
- textFillColor?: string;
116
- /** 文本描边颜色 */
117
- textStrokeColor?: string;
118
- /** 文本描边宽度 */
119
- textStrokeWidth?: number;
120
- /** 文本Y轴偏移 */
121
- textOffsetY?: number;
122
- }
123
- /**
124
- * 点位选项接口 - 点位图层专用配置
125
- */
126
- export interface PointOptions extends BaseOptions, StyleOptions, TextOptions {
127
- /** 文本字段键 */
128
- textKey?: string;
129
- /** 图标图片 */
130
- img?: string;
131
- /** 图标缩放比例 */
132
- scale?: number;
133
- /** 图标颜色 */
134
- iconColor?: string;
135
- }
136
- /**
137
- * 线条选项接口 - 线条图层专用配置
138
- */
139
- export interface LineOptions extends BaseOptions, StyleOptions, TextOptions {
140
- /** 线条类型 */
141
- type?: string;
142
- }
143
- /**
144
- * 多边形选项接口 - 多边形图层专用配置
145
- */
146
- export interface PolygonOptions extends BaseOptions, StyleOptions, TextOptions {
147
- /** 文本字段键 */
148
- textKey?: string;
149
- /** 是否为蒙版 */
150
- mask?: boolean;
151
- }
152
- /**
153
- * 兼容性类型别名 - 保持向后兼容
154
- * @deprecated 请使用具体的选项接口:PointOptions, LineOptions, PolygonOptions
155
- */
156
- export type OptionsType = BaseOptions & StyleOptions & TextOptions & {
157
- textKey?: string;
158
- img?: string;
159
- scale?: number;
160
- iconColor?: string;
161
- type?: string;
162
- mask?: boolean;
163
- };
164
- /**
165
- * 图片图层数据接口
166
- */
167
- export interface ImageLayerData {
168
- img?: string;
169
- extent?: number[];
170
- }
171
- /**
172
- * 蒙版图层配置接口
173
- */
174
- export interface MaskLayerOptions {
175
- extent?: any;
176
- fillColor?: string;
177
- strokeWidth?: number;
178
- strokeColor?: string;
179
- zIndex?: number;
180
- opacity?: number;
181
- visible?: boolean;
182
- layerName?: string;
183
- }
184
- /**
185
- * 颜色映射接口
186
- */
187
- export interface ColorMap {
188
- [level: string]: string;
189
- }
190
- /**
191
- * 要素颜色更新选项接口
192
- */
193
- export interface FeatureColorUpdateOptions extends BaseOptions, StyleOptions, TextOptions {
194
- /** 文本字段键 */
195
- textKey?: string;
196
- }
197
- /**
198
- * 点位数据接口
199
- */
200
- export interface PointData {
201
- lgtd: number;
202
- lttd: number;
203
- [key: string]: any;
204
- }
205
- /**
206
- * 线数据接口
207
- */
208
- export interface LineData {
209
- type: string;
210
- coordinates: number[][];
211
- [key: string]: any;
212
- }
213
- /**
214
- * 聚合选项接口
215
- */
216
- export interface ClusterOptions extends PointOptions {
217
- /** 聚合距离 */
218
- distance?: number;
219
- /** 最小聚合距离 */
220
- minDistance?: number;
221
- }
222
- /**
223
- * 测量处理器类型
224
- */
225
- export type MeasureHandlerType = 'LineString' | 'Polygon';
226
- /**
227
- * 事件类型
228
- */
229
- export type EventType = 'click' | 'hover' | 'moveend';
230
- /**
231
- * Vue实例接口
232
- */
233
- export interface VueInstance {
234
- mount(element: Element | string): VueInstance;
235
- unmount?(): void;
236
- $destroy?(): void;
237
- [key: string]: any;
238
- }
239
- /**
240
- * Vue应用接口
241
- */
242
- export interface VueApp {
243
- mount(element: Element | string): VueInstance;
244
- unmount(): void;
245
- [key: string]: any;
246
- }
247
- /**
248
- * Vue 2.x 实例接口
249
- */
250
- export interface VueLegacyInstance {
251
- $mount(element?: Element | string): VueLegacyInstance;
252
- $destroy(): void;
253
- [key: string]: any;
254
- }
255
- /**
256
- * DOM点位状态枚举
257
- */
258
- export declare enum VueTemplatePointState {
259
- CREATED = "created",
260
- MOUNTED = "mounted",
261
- VISIBLE = "visible",
262
- HIDDEN = "hidden",
263
- DESTROYED = "destroyed"
264
- }
265
- /**
266
- * Vue模板点位选项接口
267
- */
268
- export interface VueTemplatePointOptions {
269
- Template: any;
270
- lgtd: number;
271
- lttd: number;
272
- props?: any;
273
- styleType?: 'default' | 'custom';
274
- positioning?: 'bottom-left' | 'bottom-center' | 'bottom-right' | 'center-left' | 'center-center' | 'center-right' | 'top-left' | 'top-center' | 'top-right';
275
- stopEvent?: boolean;
276
- visible?: boolean;
277
- className?: string;
278
- zIndex?: number;
279
- }
280
- /**
281
- * Vue模板点位实例接口
282
- */
283
- export interface VueTemplatePointInstance {
284
- id: string;
285
- dom: HTMLElement;
286
- anchor: any;
287
- app: VueApp | VueLegacyInstance | null;
288
- state: VueTemplatePointState;
289
- position: number[];
290
- options: VueTemplatePointOptions;
291
- setVisible(visible: boolean): void;
292
- updatePosition(lgtd: number, lttd: number): void;
293
- updateProps(newProps: Record<string, any>): void;
294
- setStyle(styles: Partial<CSSStyleDeclaration>): void;
295
- addClass(className: string): void;
296
- removeClass(className: string): void;
297
- remove(): void;
298
- getState(): VueTemplatePointState;
299
- getOptions(): Readonly<VueTemplatePointOptions>;
300
- isDestroyed(): boolean;
301
- }
302
- export {};
1
+ import BaseLayer from "ol/layer/Base";
2
+ import TileLayer from "ol/layer/Tile";
3
+ import { WMTS } from "ol/source";
4
+ import View from "ol/View";
5
+ import Feature, { FeatureLike } from "ol/Feature";
6
+ import { Style } from "ol/style";
7
+ export interface FeatureData {
8
+ type: string;
9
+ properties: any;
10
+ geometry: {
11
+ type: "Polygon" | "MultiPolygon" | "Point" | "LineString" | "MultiLineString" | "MultiPoint" | "GeometryCollection";
12
+ coordinates: any[];
13
+ };
14
+ }
15
+ export interface MapJSONData {
16
+ type: string;
17
+ name?: string;
18
+ features: FeatureData[];
19
+ }
20
+ type LayerItem = BaseLayer | TileLayer<WMTS>;
21
+ export interface MapInitType {
22
+ layers?: LayerItem[] | {
23
+ [key: string]: LayerItem[];
24
+ };
25
+ zoom?: number;
26
+ center?: number[];
27
+ view?: View;
28
+ minZoom?: number;
29
+ maxZoom?: number;
30
+ extent?: number[];
31
+ mapClipData?: MapJSONData;
32
+ token?: string;
33
+ annotation?: boolean;
34
+ }
35
+ export type AnnotationType = 'cva_c' | 'cia_c' | 'cta_c';
36
+ export type TiandituType = 'vec_c' | 'img_c' | 'ter_c';
37
+ export interface MapLayers {
38
+ vec_c?: BaseLayer[];
39
+ img_c?: BaseLayer[];
40
+ ter_c?: BaseLayer[];
41
+ [key: string]: BaseLayer[] | undefined;
42
+ }
43
+ export interface MapLayersOptions {
44
+ layers?: BaseLayer[] | MapLayers;
45
+ zIndex?: number;
46
+ mapClip?: boolean;
47
+ mapClipData?: MapJSONData;
48
+ token?: string;
49
+ annotation?: boolean;
50
+ }
51
+ export interface AnnotationLayerOptions {
52
+ type: AnnotationType;
53
+ token: string;
54
+ zIndex?: number;
55
+ visible?: boolean;
56
+ }
57
+ export interface HeatMapOptions {
58
+ layerName?: string;
59
+ radius?: number;
60
+ blur?: number;
61
+ gradient?: string[];
62
+ opacity?: number;
63
+ visible?: boolean;
64
+ zIndex?: number;
65
+ valueKey?: string;
66
+ }
67
+ /**
68
+ * 基础选项接口 - 所有图层的公共配置
69
+ */
70
+ export interface BaseOptions {
71
+ /** 图层名称 */
72
+ layerName?: string;
73
+ /** 图层层级 */
74
+ zIndex?: number;
75
+ /** 图层可见性 */
76
+ visible?: boolean;
77
+ /** 图层透明度 */
78
+ opacity?: number;
79
+ /** 是否适应视图 */
80
+ fitView?: boolean;
81
+ /** 地图裁剪 */
82
+ mapClip?: boolean;
83
+ /** 地图裁剪数据 */
84
+ mapClipData?: MapJSONData;
85
+ /** 投影选项 */
86
+ projectionOptOptions?: any;
87
+ /** 自定义样式函数 */
88
+ style?: Style | Style[] | ((feature: FeatureLike) => Style | Style[]);
89
+ }
90
+ /**
91
+ * 样式选项接口 - 图形样式相关配置
92
+ */
93
+ export interface StyleOptions {
94
+ /** 描边颜色 */
95
+ strokeColor?: string | number[];
96
+ /** 描边宽度 */
97
+ strokeWidth?: number;
98
+ /** 线条虚线样式 */
99
+ lineDash?: number[];
100
+ /** 线条虚线偏移 */
101
+ lineDashOffset?: number;
102
+ /** 填充颜色 */
103
+ fillColor?: string;
104
+ /** 填充颜色回调函数 */
105
+ fillColorCallBack?: (feature: Feature) => string;
106
+ }
107
+ /**
108
+ * 文本选项接口 - 文本标注相关配置
109
+ */
110
+ export interface TextOptions {
111
+ /** 文本可见性 */
112
+ textVisible?: boolean;
113
+ /** 文本内容回调函数 */
114
+ textCallBack?: (feature: Feature) => string;
115
+ /** 文本字体 */
116
+ textFont?: string;
117
+ /** 文本填充颜色 */
118
+ textFillColor?: string;
119
+ /** 文本描边颜色 */
120
+ textStrokeColor?: string;
121
+ /** 文本描边宽度 */
122
+ textStrokeWidth?: number;
123
+ /** 文本Y轴偏移 */
124
+ textOffsetY?: number;
125
+ }
126
+ /**
127
+ * 点位选项接口 - 点位图层专用配置
128
+ */
129
+ export interface PointOptions extends BaseOptions, StyleOptions, TextOptions {
130
+ /** 文本字段键 */
131
+ textKey?: string;
132
+ /** 图标图片 */
133
+ img?: string;
134
+ /** 图标缩放比例 */
135
+ scale?: number;
136
+ /** 图标颜色 */
137
+ iconColor?: string;
138
+ }
139
+ /**
140
+ * 线条选项接口 - 线条图层专用配置
141
+ */
142
+ export interface LineOptions extends BaseOptions, StyleOptions, TextOptions {
143
+ /** 线条类型 */
144
+ type?: string;
145
+ }
146
+ /**
147
+ * 多边形选项接口 - 多边形图层专用配置
148
+ */
149
+ export interface PolygonOptions extends BaseOptions, StyleOptions, TextOptions {
150
+ /** 文本字段键 */
151
+ textKey?: string;
152
+ /** 是否为蒙版 */
153
+ mask?: boolean;
154
+ }
155
+ /**
156
+ * 兼容性类型别名 - 保持向后兼容
157
+ * @deprecated 请使用具体的选项接口:PointOptions, LineOptions, PolygonOptions
158
+ */
159
+ export type OptionsType = BaseOptions & StyleOptions & TextOptions & {
160
+ textKey?: string;
161
+ img?: string;
162
+ scale?: number;
163
+ iconColor?: string;
164
+ type?: string;
165
+ mask?: boolean;
166
+ };
167
+ /**
168
+ * 图片图层数据接口
169
+ */
170
+ export interface ImageLayerData {
171
+ img?: string;
172
+ extent?: number[];
173
+ }
174
+ /**
175
+ * 蒙版图层配置接口
176
+ */
177
+ export interface MaskLayerOptions {
178
+ extent?: any;
179
+ fillColor?: string;
180
+ strokeWidth?: number;
181
+ strokeColor?: string;
182
+ zIndex?: number;
183
+ opacity?: number;
184
+ visible?: boolean;
185
+ layerName?: string;
186
+ }
187
+ /**
188
+ * 颜色映射接口
189
+ */
190
+ export interface ColorMap {
191
+ [level: string]: string;
192
+ }
193
+ /**
194
+ * 要素颜色更新选项接口
195
+ */
196
+ export interface FeatureColorUpdateOptions extends BaseOptions, StyleOptions, TextOptions {
197
+ /** 文本字段键 */
198
+ textKey?: string;
199
+ }
200
+ /**
201
+ * 点位数据接口
202
+ */
203
+ export interface PointData {
204
+ lgtd: number;
205
+ lttd: number;
206
+ [key: string]: any;
207
+ }
208
+ /**
209
+ * 线数据接口
210
+ */
211
+ export interface LineData {
212
+ type: string;
213
+ coordinates: number[][];
214
+ [key: string]: any;
215
+ }
216
+ /**
217
+ * 聚合选项接口
218
+ */
219
+ export interface ClusterOptions extends PointOptions {
220
+ /** 聚合距离 */
221
+ distance?: number;
222
+ /** 最小聚合距离 */
223
+ minDistance?: number;
224
+ }
225
+ /**
226
+ * 测量处理器类型
227
+ */
228
+ export type MeasureHandlerType = 'LineString' | 'Polygon';
229
+ /**
230
+ * 事件类型
231
+ */
232
+ export type EventType = 'click' | 'hover' | 'moveend';
233
+ /**
234
+ * Vue实例接口
235
+ */
236
+ export interface VueInstance {
237
+ mount(element: Element | string): VueInstance;
238
+ unmount?(): void;
239
+ $destroy?(): void;
240
+ [key: string]: any;
241
+ }
242
+ /**
243
+ * Vue应用接口
244
+ */
245
+ export interface VueApp {
246
+ mount(element: Element | string): VueInstance;
247
+ unmount(): void;
248
+ [key: string]: any;
249
+ }
250
+ /**
251
+ * Vue 2.x 实例接口
252
+ */
253
+ export interface VueLegacyInstance {
254
+ $mount(element?: Element | string): VueLegacyInstance;
255
+ $destroy(): void;
256
+ [key: string]: any;
257
+ }
258
+ /**
259
+ * DOM点位状态枚举
260
+ */
261
+ export declare enum VueTemplatePointState {
262
+ CREATED = "created",
263
+ MOUNTED = "mounted",
264
+ VISIBLE = "visible",
265
+ HIDDEN = "hidden",
266
+ DESTROYED = "destroyed"
267
+ }
268
+ /**
269
+ * Vue模板点位选项接口
270
+ */
271
+ export interface VueTemplatePointOptions {
272
+ Template: any;
273
+ lgtd: number;
274
+ lttd: number;
275
+ props?: any;
276
+ styleType?: 'default' | 'custom';
277
+ positioning?: 'bottom-left' | 'bottom-center' | 'bottom-right' | 'center-left' | 'center-center' | 'center-right' | 'top-left' | 'top-center' | 'top-right';
278
+ stopEvent?: boolean;
279
+ visible?: boolean;
280
+ className?: string;
281
+ zIndex?: number;
282
+ }
283
+ /**
284
+ * Vue模板点位实例接口
285
+ */
286
+ export interface VueTemplatePointInstance {
287
+ id: string;
288
+ dom: HTMLElement;
289
+ anchor: any;
290
+ app: VueApp | VueLegacyInstance | null;
291
+ state: VueTemplatePointState;
292
+ position: number[];
293
+ options: VueTemplatePointOptions;
294
+ setVisible(visible: boolean): void;
295
+ updatePosition(lgtd: number, lttd: number): void;
296
+ updateProps(newProps: Record<string, any>): void;
297
+ setStyle(styles: Partial<CSSStyleDeclaration>): void;
298
+ addClass(className: string): void;
299
+ removeClass(className: string): void;
300
+ remove(): void;
301
+ getState(): VueTemplatePointState;
302
+ getOptions(): Readonly<VueTemplatePointOptions>;
303
+ isDestroyed(): boolean;
304
+ }
305
+ export {};
package/types.js CHANGED
@@ -1,11 +1,11 @@
1
- /**
2
- * DOM点位状态枚举
3
- */
4
- export var VueTemplatePointState;
5
- (function (VueTemplatePointState) {
6
- VueTemplatePointState["CREATED"] = "created";
7
- VueTemplatePointState["MOUNTED"] = "mounted";
8
- VueTemplatePointState["VISIBLE"] = "visible";
9
- VueTemplatePointState["HIDDEN"] = "hidden";
10
- VueTemplatePointState["DESTROYED"] = "destroyed";
11
- })(VueTemplatePointState || (VueTemplatePointState = {}));
1
+ /**
2
+ * DOM点位状态枚举
3
+ */
4
+ export var VueTemplatePointState;
5
+ (function (VueTemplatePointState) {
6
+ VueTemplatePointState["CREATED"] = "created";
7
+ VueTemplatePointState["MOUNTED"] = "mounted";
8
+ VueTemplatePointState["VISIBLE"] = "visible";
9
+ VueTemplatePointState["HIDDEN"] = "hidden";
10
+ VueTemplatePointState["DESTROYED"] = "destroyed";
11
+ })(VueTemplatePointState || (VueTemplatePointState = {}));