my-openlayer 0.1.2 → 0.1.3
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/core/Point.d.ts +3 -3
- package/dist/core/Point.js +7 -7
- package/dist/core/Polygon.d.ts +1 -2
- package/dist/core/Polygon.js +4 -32
- package/package.json +1 -1
package/dist/core/Point.d.ts
CHANGED
|
@@ -15,8 +15,8 @@ export default class Point {
|
|
|
15
15
|
* hasImg: Boolean 是否显示图标
|
|
16
16
|
* }
|
|
17
17
|
*/
|
|
18
|
-
addPoint(pointData: PointData[],
|
|
19
|
-
addClusterPoint(pointData: any[],
|
|
18
|
+
addPoint(pointData: PointData[], options: OptionsType): VectorLayer<VectorSource<import("ol/geom").Geometry>>;
|
|
19
|
+
addClusterPoint(pointData: any[], options: OptionsType): void;
|
|
20
20
|
/**
|
|
21
21
|
* 添加点 - 闪烁
|
|
22
22
|
*
|
|
@@ -26,7 +26,7 @@ export default class Point {
|
|
|
26
26
|
/**
|
|
27
27
|
* 设置闪烁点
|
|
28
28
|
* @param twinkleList 闪烁点数据 - 二维数组 [[],[]]
|
|
29
|
-
* @param className
|
|
29
|
+
* @param className 闪烁点样式,需要和id保持一致
|
|
30
30
|
* @param key 闪烁点索引
|
|
31
31
|
* @param callback
|
|
32
32
|
*/
|
package/dist/core/Point.js
CHANGED
|
@@ -25,14 +25,14 @@ export default class Point {
|
|
|
25
25
|
* hasImg: Boolean 是否显示图标
|
|
26
26
|
* }
|
|
27
27
|
*/
|
|
28
|
-
addPoint(pointData,
|
|
28
|
+
addPoint(pointData, options) {
|
|
29
29
|
const pointFeatureList = [];
|
|
30
30
|
pointData.forEach((item) => {
|
|
31
31
|
const pointFeature = new Feature({
|
|
32
32
|
// clickLocation: options.clickLocation,
|
|
33
33
|
// all: JSON.stringify(item),
|
|
34
34
|
rawData: item, //保存原始数据
|
|
35
|
-
type: type,
|
|
35
|
+
type: options.type,
|
|
36
36
|
geometry: new olPoint([item.lgtd, item.lttd])
|
|
37
37
|
});
|
|
38
38
|
const style = {};
|
|
@@ -64,7 +64,7 @@ export default class Point {
|
|
|
64
64
|
pointFeatureList.push(pointFeature);
|
|
65
65
|
});
|
|
66
66
|
const PointVectorLayer = new VectorLayer({
|
|
67
|
-
layerName: type,
|
|
67
|
+
layerName: options.type,
|
|
68
68
|
source: new VectorSource({
|
|
69
69
|
features: pointFeatureList
|
|
70
70
|
}),
|
|
@@ -74,7 +74,7 @@ export default class Point {
|
|
|
74
74
|
this.map.addLayer(PointVectorLayer);
|
|
75
75
|
return PointVectorLayer;
|
|
76
76
|
}
|
|
77
|
-
addClusterPoint(pointData,
|
|
77
|
+
addClusterPoint(pointData, options) {
|
|
78
78
|
const pointFeatureList = [];
|
|
79
79
|
pointData.forEach(item => {
|
|
80
80
|
const pointFeature = new Feature({
|
|
@@ -91,7 +91,7 @@ export default class Point {
|
|
|
91
91
|
source: source,
|
|
92
92
|
});
|
|
93
93
|
const clusterLayer = new VectorLayer({
|
|
94
|
-
layerName: type,
|
|
94
|
+
layerName: options.type,
|
|
95
95
|
source: clusterSource,
|
|
96
96
|
style: function (feature) {
|
|
97
97
|
const aviValue = feature.get('features')[0].get('name');
|
|
@@ -199,7 +199,7 @@ export default class Point {
|
|
|
199
199
|
/**
|
|
200
200
|
* 设置闪烁点
|
|
201
201
|
* @param twinkleList 闪烁点数据 - 二维数组 [[],[]]
|
|
202
|
-
* @param className
|
|
202
|
+
* @param className 闪烁点样式,需要和id保持一致
|
|
203
203
|
* @param key 闪烁点索引
|
|
204
204
|
* @param callback
|
|
205
205
|
*/
|
|
@@ -212,7 +212,7 @@ export default class Point {
|
|
|
212
212
|
arr[i].parentNode?.removeChild(arr[i]);
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
const el = document.getElementById(
|
|
215
|
+
const el = document.getElementById(className);
|
|
216
216
|
for (let i = 0; i < twinkleList.length; i++) {
|
|
217
217
|
const twinkleItem = twinkleList[i];
|
|
218
218
|
// 定义图标Dom
|
package/dist/core/Polygon.d.ts
CHANGED
|
@@ -16,10 +16,9 @@ export default class Polygon {
|
|
|
16
16
|
/**
|
|
17
17
|
* 添加 地图 边框 图层
|
|
18
18
|
* @param data 图层数据
|
|
19
|
-
* @param type 图层类型
|
|
20
19
|
* @param options 图层配置
|
|
21
20
|
*/
|
|
22
|
-
|
|
21
|
+
addBorderPolygonLayer(data: MapJSONData, options: OptionsType): void;
|
|
23
22
|
addPolygonLayerCommon(dataJSON: MapJSONData, options?: OptionsType): VectorLayer<VectorSource<Geometry>>;
|
|
24
23
|
/**
|
|
25
24
|
* 根据数据数组更新某个面颜色
|
package/dist/core/Polygon.js
CHANGED
|
@@ -29,40 +29,12 @@ export default class Polygon {
|
|
|
29
29
|
/**
|
|
30
30
|
* 添加 地图 边框 图层
|
|
31
31
|
* @param data 图层数据
|
|
32
|
-
* @param type 图层类型
|
|
33
32
|
* @param options 图层配置
|
|
34
33
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
source: new VectorSource({
|
|
40
|
-
features: (new GeoJSON()).readFeatures(data)
|
|
41
|
-
}),
|
|
42
|
-
style: function (feature) {
|
|
43
|
-
feature.set('type', options.type);
|
|
44
|
-
feature.set('layerName', options.type);
|
|
45
|
-
return new Style({
|
|
46
|
-
stroke: new Stroke({
|
|
47
|
-
color: options.strokeColor || '#EBEEF5',
|
|
48
|
-
width: options.strokeWidth || 3
|
|
49
|
-
}),
|
|
50
|
-
fill: new Fill({ color: 'rgba(255, 255, 255, 0)' }),
|
|
51
|
-
text: new Text({
|
|
52
|
-
text: options.nameKey ? feature.values_[options.nameKey] : "",
|
|
53
|
-
font: options.textFont ?? '14px Calibri,sans-serif',
|
|
54
|
-
fill: new Fill({ color: options.textFillColor ?? '#FFF' }),
|
|
55
|
-
stroke: new Stroke({
|
|
56
|
-
color: options.textStrokeColor ?? '#409EFF',
|
|
57
|
-
width: options.textStrokeWidth ?? 2
|
|
58
|
-
})
|
|
59
|
-
})
|
|
60
|
-
});
|
|
61
|
-
},
|
|
62
|
-
zIndex: options.zIndex ?? 2
|
|
63
|
-
});
|
|
64
|
-
borderLayer.setVisible(options.visible === undefined ? true : options.visible);
|
|
65
|
-
this.map.addLayer(borderLayer);
|
|
34
|
+
addBorderPolygonLayer(data, options) {
|
|
35
|
+
options.type = options.type ?? 'border';
|
|
36
|
+
options.fillColor = options.fillColor ?? 'rgba(255, 255, 255, 0)';
|
|
37
|
+
this.addPolygonLayerCommon(data, options);
|
|
66
38
|
if (options.mask)
|
|
67
39
|
this.setOutLayer(data);
|
|
68
40
|
}
|