ry-vue-map 0.1.9 → 0.2.0
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/README.MD +1 -1
- package/lib/ryui.common.js +319 -41
- package/lib/ryui.common.js.gz +0 -0
- package/lib/ryui.css +1 -1
- package/lib/ryui.umd.js +319 -41
- package/lib/ryui.umd.js.gz +0 -0
- package/lib/ryui.umd.min.js +5 -5
- package/lib/ryui.umd.min.js.gz +0 -0
- package/package.json +2 -2
- package/src/components/maps/ryVectorMap/src/index.vue +79 -3
- package/src/utils/lMapServices.js +2 -1
- package/src/views/vectorMap/geo.json +154715 -0
- package/src/views/vectorMap/geoJson2.js +37 -0
- package/src/views/vectorMap/index.vue +11 -23
package/lib/ryui.umd.min.js.gz
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ry-vue-map",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "lib/ryui.umd.min.js",
|
|
6
6
|
"description": "ry公共组件库",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"element-ui": "~2.15.6",
|
|
39
39
|
"nprogress": "~0.2.0",
|
|
40
40
|
"ol": "^6.14.1",
|
|
41
|
-
"ry-map": "^0.3.
|
|
41
|
+
"ry-map": "^0.3.2",
|
|
42
42
|
"vue": "~2.6.14",
|
|
43
43
|
"vue-router": "~3.5.2",
|
|
44
44
|
"vue-server-renderer": "^2.6.14",
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
isAnalysisCenter: {
|
|
17
17
|
type: Boolean,
|
|
18
18
|
default: true,
|
|
19
|
-
|
|
20
19
|
},
|
|
21
20
|
modelArr : {
|
|
22
21
|
type: Array,
|
|
@@ -25,7 +24,15 @@
|
|
|
25
24
|
delayTime:{
|
|
26
25
|
type: Number,
|
|
27
26
|
default: () =>50,
|
|
28
|
-
}
|
|
27
|
+
},
|
|
28
|
+
bindMapClick:{
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false,
|
|
31
|
+
},
|
|
32
|
+
isDrag:{
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: true,
|
|
35
|
+
},
|
|
29
36
|
},
|
|
30
37
|
data() {
|
|
31
38
|
return {
|
|
@@ -36,12 +43,25 @@
|
|
|
36
43
|
vmap:null,
|
|
37
44
|
lastX: 0,
|
|
38
45
|
lastY: 0,
|
|
46
|
+
moveend: null,
|
|
47
|
+
polygonMap:null,
|
|
39
48
|
}
|
|
40
49
|
},
|
|
41
50
|
watch: {
|
|
42
51
|
modelArr(val){
|
|
43
52
|
this.initLayers(val);
|
|
44
53
|
},
|
|
54
|
+
bindMapClick(val) {
|
|
55
|
+
if (this.bindMapClick !== val) {
|
|
56
|
+
this.bindMapClick = val;
|
|
57
|
+
this._bingMapEvent();
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
polygonColor(val) {
|
|
61
|
+
if (val) {
|
|
62
|
+
this.setPolygonColor(val.id, val.colorArr);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
45
65
|
},
|
|
46
66
|
mounted() {
|
|
47
67
|
|
|
@@ -56,10 +76,13 @@
|
|
|
56
76
|
isAnalysisBBOX:this.isAnalysisBBOX,
|
|
57
77
|
isAnalysisCenter:this.isAnalysisCenter,
|
|
58
78
|
delayTime:this.delayTime,
|
|
79
|
+
isDrag:this.isDrag,
|
|
59
80
|
callback: r => this.$emit('initLayersEvent', r),
|
|
60
81
|
});
|
|
61
82
|
this.map=map;
|
|
62
83
|
this.vmap=vmap;
|
|
84
|
+
this.polygonMap=vmap.getLayerMap;
|
|
85
|
+
this._bingMapEvent();
|
|
63
86
|
this.$emit('load', {
|
|
64
87
|
map,
|
|
65
88
|
vmap
|
|
@@ -71,7 +94,60 @@
|
|
|
71
94
|
initLayers(val){
|
|
72
95
|
if(!this.vmap) return;
|
|
73
96
|
this.vmap.initLayers(val);
|
|
74
|
-
}
|
|
97
|
+
},
|
|
98
|
+
_mapClickOnce(isBinClick = false) {
|
|
99
|
+
if (!this.mapClick) {
|
|
100
|
+
this.mapClick = evt => {
|
|
101
|
+
if (evt.dragging) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const pixel = this.map.getEventPixel(evt.originalEvent);
|
|
105
|
+
const hit = this.map.hasFeatureAtPixel(pixel);
|
|
106
|
+
if (hit) {
|
|
107
|
+
const _feature = this.map.forEachFeatureAtPixel(evt.pixel, feature => feature);
|
|
108
|
+
const pro =_feature.getProperties();
|
|
109
|
+
const view = this.map.getView();
|
|
110
|
+
const [lon,lat]=view.getCenter();
|
|
111
|
+
const _id = _feature.getId();
|
|
112
|
+
if(pro){
|
|
113
|
+
this.$emit('mapClick', {...pro,id: _id ? _id:null,lon,lat});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
if (isBinClick) {
|
|
119
|
+
this.map.un('click', this.mapClick);
|
|
120
|
+
this.mapClick = null;
|
|
121
|
+
} else {
|
|
122
|
+
this.map.on('click', this.mapClick);
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
_bingMapEvent() {
|
|
126
|
+
if (this.bindMapClick) {
|
|
127
|
+
this._mapClickOnce();
|
|
128
|
+
} else {
|
|
129
|
+
this._mapClickOnce(true);
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
setPolygonColor(id, color, isLoad = true) {
|
|
134
|
+
if (this.polygonMap.has(id)) {
|
|
135
|
+
const polygon = this.polygonMap.get(id);
|
|
136
|
+
polygon.setPolygonColor(color);
|
|
137
|
+
if (isLoad) {
|
|
138
|
+
this._setZoom();
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
// 刷新颜色
|
|
143
|
+
_setZoom() {
|
|
144
|
+
const zoom = this.map.getView().getZoom();
|
|
145
|
+
this.map.getView().setZoom(zoom + 0.00001);
|
|
146
|
+
this.map.getView().setZoom(zoom - 0.0001);
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
75
151
|
}
|
|
76
152
|
}
|
|
77
153
|
</script>
|
|
@@ -227,10 +227,11 @@ export default class LMapServices {
|
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
async initVectorMap(opt) {
|
|
230
|
-
const {el,isAnalysisBBOX,isAnalysisCenter,callback,delaytime} = opt;
|
|
230
|
+
const {el,isAnalysisBBOX,isAnalysisCenter,callback,delaytime,isDrag} = opt;
|
|
231
231
|
const vmap = new VectorMap({
|
|
232
232
|
isAnalysisBBOX,
|
|
233
233
|
isAnalysisCenter,
|
|
234
|
+
isDrag,
|
|
234
235
|
callback:r=> {
|
|
235
236
|
if(callback){
|
|
236
237
|
callback(r);
|