ry-vue-map 0.3.3 → 0.3.4
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 +70 -46
- package/lib/ryui.common.js.gz +0 -0
- package/lib/ryui.css +1 -1
- package/lib/ryui.css.gz +0 -0
- package/lib/ryui.umd.js +70 -46
- package/lib/ryui.umd.js.gz +0 -0
- package/lib/ryui.umd.min.js +2 -2
- package/lib/ryui.umd.min.js.gz +0 -0
- package/package.json +1 -1
- package/src/components/maps/ryStaticMap/src/index.vue +71 -52
- package/src/views/map/imgUrl.js +434 -110
- package/src/views/map/index.vue +104 -144
package/lib/ryui.umd.min.js.gz
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -10,9 +10,8 @@
|
|
|
10
10
|
:isShowDrawTool="isShowDrawTool" :isRight="isRight" :isCrossHair="isCrossHair" :hideAdd="hideAdd"
|
|
11
11
|
:hidePoint="hidePoint" :hideCancel="hideCancel" :hideDelete="hideDelete" :hideSave="hideSave"
|
|
12
12
|
:hideLine="hideLine" :hideArea="hideArea" :isSwitchMap="isSwitchMap" :isSwitchMapRight="isSwitchMapRight"
|
|
13
|
-
:isHideAreaAndKM="isHideAreaAndKM"
|
|
14
|
-
|
|
15
|
-
@error="drawError($event)">
|
|
13
|
+
:isHideAreaAndKM="isHideAreaAndKM" @loadDrawPolygonEvent="loadDrawPolygonEvent($event)"
|
|
14
|
+
@success="drawSuccess($event)" @error="drawError($event)">
|
|
16
15
|
<template>
|
|
17
16
|
<slot name="maptool"></slot>
|
|
18
17
|
</template>
|
|
@@ -22,12 +21,12 @@
|
|
|
22
21
|
<slot name="polygon" :mapDto="{map,lMap}">
|
|
23
22
|
|
|
24
23
|
</slot>
|
|
25
|
-
|
|
24
|
+
|
|
26
25
|
<slot name="marker" :mapDto="{map,lMap}">
|
|
27
|
-
|
|
26
|
+
|
|
28
27
|
</slot>
|
|
29
28
|
</template>
|
|
30
|
-
|
|
29
|
+
|
|
31
30
|
</div>
|
|
32
31
|
|
|
33
32
|
|
|
@@ -40,9 +39,9 @@
|
|
|
40
39
|
import MapToolDto from './../../models/ryMapTool/mapTool.js';
|
|
41
40
|
import RyMapTool from '../../ryMapTool/src/index';
|
|
42
41
|
import ImageLayer from 'ol/layer/Image';
|
|
43
|
-
|
|
42
|
+
import ImageStatic from 'ol/source/ImageStatic';
|
|
44
43
|
import View from 'ol/View';
|
|
45
|
-
|
|
44
|
+
import Projection from 'ol/proj/Projection';
|
|
46
45
|
|
|
47
46
|
import {
|
|
48
47
|
fitNew,
|
|
@@ -58,8 +57,7 @@
|
|
|
58
57
|
...new ViewDto(),
|
|
59
58
|
...new MapToolDto()
|
|
60
59
|
},
|
|
61
|
-
created() {
|
|
62
|
-
},
|
|
60
|
+
created() {},
|
|
63
61
|
watch: {
|
|
64
62
|
center(newValue) {
|
|
65
63
|
this.setCenter(newValue);
|
|
@@ -82,6 +80,13 @@
|
|
|
82
80
|
this._bingMapEvent();
|
|
83
81
|
}
|
|
84
82
|
},
|
|
83
|
+
url(val){
|
|
84
|
+
if(this.map){
|
|
85
|
+
|
|
86
|
+
this.selectLayer();
|
|
87
|
+
this.setCenter();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
85
90
|
},
|
|
86
91
|
data() {
|
|
87
92
|
return {
|
|
@@ -92,50 +97,51 @@
|
|
|
92
97
|
moveend: null,
|
|
93
98
|
lastX: 0,
|
|
94
99
|
lastY: 0,
|
|
100
|
+
layer: null,
|
|
95
101
|
};
|
|
96
102
|
},
|
|
97
103
|
methods: {
|
|
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
|
-
|
|
104
|
+
getImageLayer() {
|
|
105
|
+
return new ImageLayer({
|
|
106
|
+
source: new ImageStatic({
|
|
107
|
+
crossOrigin: 'anonymous',
|
|
108
|
+
imageSize: this.imageSize,
|
|
109
|
+
imageExtent: this.imageExtent,
|
|
110
|
+
// url: require('@/assets/jsmap.png')
|
|
111
|
+
url: this.url
|
|
112
|
+
})
|
|
113
|
+
});
|
|
114
|
+
},
|
|
115
|
+
getProjection() {
|
|
116
|
+
return new Projection({
|
|
117
|
+
code: 3875,
|
|
118
|
+
extent: this.imageExtent,
|
|
119
|
+
units: 'm'
|
|
120
|
+
});
|
|
121
|
+
},
|
|
122
|
+
getView() {
|
|
123
|
+
return new View({
|
|
124
|
+
projection: 'EPSG:3857',
|
|
125
|
+
center: this.center,
|
|
126
|
+
Projection: this.getProjection(),
|
|
127
|
+
zoom: this.zoom,
|
|
128
|
+
minZoom: this.minZoom,
|
|
129
|
+
maxZoom: this.maxZoom
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
async loadMap(el) {
|
|
134
|
+
this.layer=this.getImageLayer();
|
|
135
|
+
const map = await this.lMap.initStaticMap(el, {
|
|
136
|
+
view: this.getView(),
|
|
137
|
+
layer: this.layer,
|
|
138
|
+
});
|
|
139
|
+
this.map = map;
|
|
140
|
+
this.$emit('load', {
|
|
141
|
+
map,
|
|
142
|
+
mapServices: this.lMap,
|
|
143
|
+
ryMapTool: this.$refs.mapTool
|
|
144
|
+
});
|
|
139
145
|
},
|
|
140
146
|
_bingMapEvent() {
|
|
141
147
|
if (this.bindMapClick) {
|
|
@@ -194,6 +200,19 @@
|
|
|
194
200
|
this.map.on('click', this.mapClick);
|
|
195
201
|
}
|
|
196
202
|
},
|
|
203
|
+
removeLayer(){
|
|
204
|
+
if(this.map && this.layer){
|
|
205
|
+
this.map.removeLayer(this.layer);
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
selectLayer(){
|
|
209
|
+
this.removeLayer();
|
|
210
|
+
if(this.map){
|
|
211
|
+
this.layer = this.getImageLayer();
|
|
212
|
+
this.map.addLayer(this.layer);
|
|
213
|
+
this.$emit('selectMapEvent');
|
|
214
|
+
}
|
|
215
|
+
},
|
|
197
216
|
loadDrawPolygonEvent(e) {
|
|
198
217
|
this.$emit('loadDrawPolygonEvent', e);
|
|
199
218
|
}
|
|
@@ -230,4 +249,4 @@
|
|
|
230
249
|
.move-box {
|
|
231
250
|
position: absolute;
|
|
232
251
|
}
|
|
233
|
-
</style>
|
|
252
|
+
</style>
|