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/core/Polygon.d.ts CHANGED
@@ -1,139 +1,157 @@
1
- import Map from "ol/Map";
2
- import VectorLayer from "ol/layer/Vector";
3
- import VectorSource from "ol/source/Vector";
4
- import { Image as ImageLayer, Heatmap } from "ol/layer";
5
- import { PolygonOptions, MapJSONData, PointData, HeatMapOptions, ImageLayerData, MaskLayerOptions, FeatureColorUpdateOptions } from '../types';
6
- /**
7
- * Polygon 类用于处理地图上的面要素操作
8
- * 包括添加多边形、边框、图片图层、热力图等功能
9
- */
10
- export default class Polygon {
11
- private map;
12
- private colorMap;
13
- [key: string]: any;
14
- /**
15
- * 构造函数
16
- * @param map OpenLayers 地图实例
17
- */
18
- constructor(map: Map);
19
- /**
20
- * 获取等级颜色
21
- * @param lev 等级值,支持字符串或数字
22
- * @returns 对应等级的颜色值,如果等级不存在则返回默认颜色
23
- */
24
- getLevColor(lev: string | number): string;
25
- /**
26
- * 添加地图边框图层
27
- * @param data 图层数据,必须是有效的 GeoJSON 格式
28
- * @param options 图层配置选项
29
- * @returns 创建的图层实例
30
- * @throws 当数据格式无效时抛出错误
31
- */
32
- addBorderPolygon(data: MapJSONData, options?: PolygonOptions): VectorLayer<VectorSource>;
33
- /**
34
- * 添加多边形图层
35
- * @param dataJSON GeoJSON 数据
36
- * @param options 图层配置选项
37
- * @returns 创建的矢量图层
38
- * @throws 当数据格式无效时抛出错误
39
- */
40
- addPolygon(dataJSON: MapJSONData, options?: PolygonOptions): VectorLayer<VectorSource>;
41
- /**
42
- * 设置要素样式
43
- * @param features 要素数组
44
- * @param options 样式配置选项
45
- */
46
- private setFeatureStyles;
47
- /**
48
- * 获取要素文本
49
- * @param feature 要素对象
50
- * @param options 配置选项
51
- * @returns 文本内容
52
- */
53
- private getFeatureText;
54
- /**
55
- * 适应图层视图
56
- * @param layer 图层对象
57
- */
58
- private fitViewToLayer;
59
- /**
60
- * 根据数据数组更新某个面颜色
61
- * @param layerName 图层名称
62
- * @param colorObj 颜色映射对象,键为要素属性值,值为颜色字符串
63
- * @param options 配置项
64
- * @throws 当图层不存在时抛出错误
65
- */
66
- updateFeatureColor(layerName: string, colorObj?: {
67
- [propName: string]: string;
68
- }, options?: FeatureColorUpdateOptions): void;
69
- /**
70
- * 更新单个要素的颜色
71
- * @param feature 要素对象
72
- * @param colorObj 颜色映射对象
73
- * @param options 配置选项
74
- */
75
- private updateSingleFeatureColor;
76
- /**
77
- * 设置外围蒙版图层
78
- *
79
- * 详细文档参考 https_blog.csdn.net/?url=https%3A%2F%2Fblog.csdn.net%2Fu012413551%2Farticle%2Fdetails%2F122739501
80
- *
81
- * @param data
82
- * @param options
83
- */
84
- setOutLayer(data: MapJSONData, options?: {
85
- extent?: any;
86
- fillColor?: string;
87
- strokeWidth?: number;
88
- strokeColor?: string;
89
- zIndex?: number;
90
- }): void;
91
- /**
92
- * 添加图片图层
93
- * @param imageData 图片数据,包含url和extent
94
- * @param options 配置项
95
- * @returns 创建的图片图层
96
- * @throws 当数据格式无效时抛出错误
97
- */
98
- addImageLayer(imageData: ImageLayerData, options?: PolygonOptions): ImageLayer<any>;
99
- /**
100
- * 尝试更新现有图层
101
- * @private
102
- */
103
- private tryUpdateExistingImageLayer;
104
- /**
105
- * 创建新的图像图层
106
- * @private
107
- */
108
- private createNewImageLayer;
109
- /**
110
- * 更新图层属性
111
- * @private
112
- */
113
- private updateImageLayerProperties;
114
- /**
115
- * 配置图层基本属性
116
- * @private
117
- */
118
- private configureImageLayer;
119
- /**
120
- * 添加图层到地图并应用裁剪
121
- * @private
122
- */
123
- private addImageLayerToMap;
124
- /**
125
- * 添加热力图图层
126
- * @param pointData 点数据数组
127
- * @param options 热力图配置
128
- */
129
- addHeatmap(pointData: PointData[], options?: HeatMapOptions): Heatmap;
130
- /**
131
- * 添加遮罩图层
132
- * @param data GeoJSON格式的遮罩数据
133
- * @param options 配置项
134
- * @returns 创建的遮罩图层
135
- * @throws 当数据格式无效时抛出错误
136
- */
137
- addMaskLayer(data: any, options?: MaskLayerOptions): VectorLayer<VectorSource>;
138
- removePolygonLayer(layerName: string): void;
139
- }
1
+ import Map from "ol/Map";
2
+ import VectorLayer from "ol/layer/Vector";
3
+ import VectorSource from "ol/source/Vector";
4
+ import { Image as ImageLayer, Heatmap } from "ol/layer";
5
+ import { Geometry } from "ol/geom";
6
+ import Feature from "ol/Feature";
7
+ import { PolygonOptions, MapJSONData, PointData, HeatMapOptions, ImageLayerData, MaskLayerOptions, FeatureColorUpdateOptions } from '../types';
8
+ /**
9
+ * Polygon 类用于处理地图上的面要素操作
10
+ * 包括添加多边形、边框、图片图层、热力图等功能
11
+ */
12
+ export default class Polygon {
13
+ private map;
14
+ private colorMap;
15
+ [key: string]: any;
16
+ /**
17
+ * 构造函数
18
+ * @param map OpenLayers 地图实例
19
+ */
20
+ constructor(map: Map);
21
+ /**
22
+ * 获取等级颜色
23
+ * @param lev 等级值,支持字符串或数字
24
+ * @returns 对应等级的颜色值,如果等级不存在则返回默认颜色
25
+ */
26
+ getLevColor(lev: string | number): string;
27
+ /**
28
+ * 添加地图边框图层(使用GeoJSON数据)
29
+ * @param data 图层数据,必须是有效的 GeoJSON 格式
30
+ * @param options 图层配置选项
31
+ * @returns 创建的图层实例
32
+ * @throws 当数据格式无效时抛出错误
33
+ */
34
+ addBorderPolygon(data: MapJSONData, options?: PolygonOptions): VectorLayer<VectorSource>;
35
+ /**
36
+ * 添加地图边框图层(从URL加载)
37
+ * @param url 数据URL
38
+ * @param options 图层配置选项
39
+ * @returns 创建的图层实例
40
+ * @throws 当数据格式无效时抛出错误
41
+ */
42
+ addBorderPolygon(url: string, options?: PolygonOptions): VectorLayer<VectorSource>;
43
+ /**
44
+ * 添加多边形图层(使用GeoJSON数据)
45
+ * @param dataJSON GeoJSON 数据
46
+ * @param options 图层配置选项
47
+ * @returns 创建的矢量图层
48
+ * @throws 当数据格式无效时抛出错误
49
+ */
50
+ addPolygon(dataJSON: MapJSONData, options?: PolygonOptions): VectorLayer<VectorSource>;
51
+ /**
52
+ * 添加多边形图层(从URL加载)
53
+ * @param url 数据URL
54
+ * @param options 图层配置选项
55
+ * @returns 创建的矢量图层
56
+ * @throws 当数据格式无效时抛出错误
57
+ */
58
+ addPolygon(url: string, options?: PolygonOptions): VectorLayer<VectorSource>;
59
+ /**
60
+ * 设置要素样式
61
+ * @param features 要素数组
62
+ * @param options 样式配置选项
63
+ */
64
+ private setFeatureStyles;
65
+ /**
66
+ * 获取要素文本
67
+ * @param feature 要素对象
68
+ * @param options 配置选项
69
+ * @returns 文本内容
70
+ */
71
+ private getFeatureText;
72
+ /**
73
+ * 适应图层视图
74
+ * @param layer 图层对象
75
+ */
76
+ private fitViewToLayer;
77
+ /**
78
+ * 根据数据数组更新某个面颜色
79
+ * @param layerName 图层名称
80
+ * @param colorObj 颜色映射对象,键为要素属性值,值为颜色字符串
81
+ * @param options 配置项
82
+ * @throws 当图层不存在时抛出错误
83
+ */
84
+ updateFeatureColor(layerName: string, colorObj?: {
85
+ [propName: string]: string;
86
+ }, options?: FeatureColorUpdateOptions): void;
87
+ /**
88
+ * 更新单个要素的颜色
89
+ * @param feature 要素对象
90
+ * @param colorObj 颜色映射对象
91
+ * @param options 配置选项
92
+ */
93
+ private updateSingleFeatureColor;
94
+ /**
95
+ * 设置外围蒙版图层
96
+ *
97
+ * 详细文档参考 https_blog.csdn.net/?url=https%3A%2F%2Fblog.csdn.net%2Fu012413551%2Farticle%2Fdetails%2F122739501
98
+ *
99
+ * @param data
100
+ * @param options
101
+ */
102
+ setOutLayer(data: MapJSONData, options?: {
103
+ extent?: any;
104
+ fillColor?: string;
105
+ strokeWidth?: number;
106
+ strokeColor?: string;
107
+ zIndex?: number;
108
+ }): void;
109
+ /**
110
+ * 添加图片图层
111
+ * @param imageData 图片数据,包含url和extent
112
+ * @param options 配置项
113
+ * @returns 创建的图片图层
114
+ * @throws 当数据格式无效时抛出错误
115
+ */
116
+ addImageLayer(imageData: ImageLayerData, options?: PolygonOptions): ImageLayer<any>;
117
+ /**
118
+ * 尝试更新现有图层
119
+ * @private
120
+ */
121
+ private tryUpdateExistingImageLayer;
122
+ /**
123
+ * 创建新的图像图层
124
+ * @private
125
+ */
126
+ private createNewImageLayer;
127
+ /**
128
+ * 更新图层属性
129
+ * @private
130
+ */
131
+ private updateImageLayerProperties;
132
+ /**
133
+ * 配置图层基本属性
134
+ * @private
135
+ */
136
+ private configureImageLayer;
137
+ /**
138
+ * 添加图层到地图并应用裁剪
139
+ * @private
140
+ */
141
+ private addImageLayerToMap;
142
+ /**
143
+ * 添加热力图图层
144
+ * @param pointData 点数据数组
145
+ * @param options 热力图配置
146
+ */
147
+ addHeatmap(pointData: PointData[], options?: HeatMapOptions): Heatmap<Feature<Geometry>, VectorSource<Feature<Geometry>>>;
148
+ /**
149
+ * 添加遮罩图层
150
+ * @param data GeoJSON格式的遮罩数据
151
+ * @param options 配置项
152
+ * @returns 创建的遮罩图层
153
+ * @throws 当数据格式无效时抛出错误
154
+ */
155
+ addMaskLayer(data: any, options?: MaskLayerOptions): VectorLayer<VectorSource>;
156
+ removePolygonLayer(layerName: string): void;
157
+ }