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/MyOl.d.ts +128 -128
- package/MyOl.js +382 -381
- package/README.md +0 -21
- package/core/ConfigManager.d.ts +88 -88
- package/core/ConfigManager.js +112 -112
- package/core/EventManager.d.ts +141 -141
- package/core/EventManager.js +316 -316
- package/core/Line.d.ts +130 -109
- package/core/Line.js +354 -288
- package/core/MapBaseLayers.d.ts +234 -234
- package/core/MapBaseLayers.js +573 -573
- package/core/MapTools.d.ts +68 -68
- package/core/MapTools.js +202 -201
- package/core/MeasureHandler.d.ts +65 -65
- package/core/MeasureHandler.js +312 -312
- package/core/Point.d.ts +94 -94
- package/core/Point.js +348 -348
- package/core/Polygon.d.ts +157 -139
- package/core/Polygon.js +558 -529
- package/core/VueTemplatePoint.d.ts +51 -51
- package/core/VueTemplatePoint.js +529 -529
- package/index.d.ts +18 -18
- package/index.js +17 -17
- package/package.json +1 -1
- package/types.d.ts +305 -302
- package/types.js +11 -11
- package/utils/ErrorHandler.d.ts +102 -102
- package/utils/ErrorHandler.js +191 -191
- package/utils/ValidationUtils.d.ts +163 -163
- package/utils/ValidationUtils.js +312 -312
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 {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
*
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
*
|
|
29
|
-
* @
|
|
30
|
-
* @
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
*
|
|
37
|
-
* @
|
|
38
|
-
* @
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
*
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
*
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
*
|
|
56
|
-
* @
|
|
57
|
-
*/
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
*
|
|
61
|
-
* @param
|
|
62
|
-
* @param
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
*
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
* @param
|
|
82
|
-
* @
|
|
83
|
-
*/
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
*
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
*
|
|
111
|
-
* @
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
*
|
|
134
|
-
* @
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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
|
+
}
|