ry-vue-map 0.2.1 → 0.2.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.
Files changed (43) hide show
  1. package/README.MD +1 -1
  2. package/lib/ryui.common.js +999 -380
  3. package/lib/ryui.common.js.gz +0 -0
  4. package/lib/ryui.css +1 -1
  5. package/lib/ryui.umd.js +999 -380
  6. package/lib/ryui.umd.js.gz +0 -0
  7. package/lib/ryui.umd.min.js +5 -5
  8. package/lib/ryui.umd.min.js.gz +0 -0
  9. package/package.json +8 -3
  10. package/src/assets/map.png +0 -0
  11. package/src/assets/moveMarker.png +0 -0
  12. package/src/assets/startpoint.png +0 -0
  13. package/src/assets/stoppoint.png +0 -0
  14. package/src/components/index.js +3 -1
  15. package/src/components/maps/models/ryLines/ryLines.js +73 -0
  16. package/src/components/maps/models/ryMapTool/mapTool.js +7 -0
  17. package/src/components/maps/models/ryStaticMap/map.js +36 -0
  18. package/src/components/maps/models/ryStaticMap/view.js +66 -0
  19. package/src/components/maps/ryClusters/src/index.vue +4 -2
  20. package/src/components/maps/ryLines/index.js +7 -0
  21. package/src/components/maps/ryLines/src/index.vue +226 -0
  22. package/src/components/maps/ryMap/src/index.vue +5 -2
  23. package/src/components/maps/ryMapTool/src/index.vue +6 -6
  24. package/src/components/maps/ryPolygons/src/index.vue +67 -68
  25. package/src/components/maps/ryStaticMap/index.js +7 -0
  26. package/src/components/maps/ryStaticMap/src/index.vue +233 -0
  27. package/src/components/maps/ryUniMap/index.js +6 -0
  28. package/src/components/maps/ryUniMap/src/index.vue +351 -0
  29. package/src/components/maps/ryVectorMap/src/index.vue +1 -3
  30. package/src/components/maps/switchMap/src/newIndex.vue +39 -19
  31. package/src/router/index.js +30 -5
  32. package/src/utils/lMapServices.js +962 -918
  33. package/src/views/docx/index.vue +36 -0
  34. package/src/views/excel/index.vue +26 -0
  35. package/src/views/map/dksj.js +1103 -0
  36. package/src/views/map/index.vue +76 -205
  37. package/src/views/map/indexNew.vue +625 -0
  38. package/src/views/map/lineData.js +19592 -0
  39. package/src/views/map/lineData2.js +3449 -0
  40. package/src/views/pdf/index.vue +24 -0
  41. package/src/views/staticMap/index.vue +91 -0
  42. package/src/views/tree/index.vue +193 -0
  43. package/src/views/vectorMap/index.vue +26 -5
@@ -0,0 +1,351 @@
1
+ <template>
2
+ <div class="map-box">
3
+ <div class="map-style"></div>
4
+ <!-- isRyMapTool -->
5
+ <RyMapTool class="ry-map-tool" :class="{
6
+ 'left':!isRight,
7
+ 'right':isRight
8
+ }" v-if="lMap.map && isRyMapTool" @crossHairClick="crossHairClick($event)" :lMap="lMap"
9
+ :isShowRangingTool="isShowRangingTool" :initModifyPolygon="initModifyPolygon"
10
+ :isShowDrawTool="isShowDrawTool" :isRight="isRight" :isCrossHair="isCrossHair" :hideAdd="hideAdd"
11
+ :hidePoint="hidePoint" :hideCancel="hideCancel" :hideDelete="hideDelete" :hideSave="hideSave"
12
+ :hideLine="hideLine" :hideArea="hideArea" :isSwitchMap="isSwitchMap" :isSwitchMapRight="isSwitchMapRight"
13
+ :gpsType="lastMapType" @loadDrawPolygonEvent="loadDrawPolygonEvent($event)" @success="drawSuccess($event)"
14
+ @error="drawError($event)">
15
+ <template>
16
+ <slot name="maptool"></slot>
17
+ </template>
18
+ </RyMapTool>
19
+
20
+ <template v-if="map">
21
+ <slot name="polygon" :mapDto="{map,lMap}">
22
+
23
+ </slot>
24
+
25
+ <slot name="marker" :mapDto="{map,lMap}">
26
+
27
+ </slot>
28
+ </template>
29
+
30
+ <SwitchMap
31
+ v-if="isSwitchMapTool && isShowSwitchMap"
32
+ :height="switchMapHeight"
33
+ :switchMapDefaultTypeOrLayer="switchMapDefaultTypeOrLayer"
34
+ :mapTypeAndLayer="mapTypeAndLayer"
35
+ class="move-box" :style="{
36
+ top:switchMapPosTop + 'px',
37
+ right:isSwitchMapRight?switchMapPosLeftOrRight + 'px':'none',
38
+ left:!isSwitchMapRight?switchMapPosLeftOrRight + 'px':'none'
39
+ }" :bottom-right="isSwitchMapRight"
40
+ @changeSwitchMap="changeSwitchMap"
41
+ :isDisabled= "isDisabledSwitchMapTabEvent"
42
+ />
43
+
44
+ <!-- 'current': !isRyMapTool || !isRight -->
45
+ </div>
46
+
47
+
48
+
49
+ </template>
50
+ <script>
51
+ import MapServices from '@/utils/lMapServices.js';
52
+ import MapDto from './../../models/ryMap/map.js';
53
+ import ViewDto from './../../models/ryMap/view.js';
54
+ import MapToolDto from './../../models/ryMapTool/mapTool.js';
55
+ import RyMapTool from '../../ryMapTool/src/index';
56
+ import SwitchMap from '../../switchMap/src/newIndex';
57
+ import {
58
+ ViewOptions,
59
+ fitNew,
60
+ caculateLL,
61
+ GPS
62
+ } from 'ry-map';
63
+ export default {
64
+ name: 'RyUniMap',
65
+ components: {
66
+ RyMapTool,
67
+ SwitchMap,
68
+ },
69
+ props: {
70
+ target:{
71
+ type:Object,
72
+ default:()=> null,
73
+
74
+ },
75
+ ...new MapDto(),
76
+ ...new ViewDto(),
77
+ ...new MapToolDto()
78
+ },
79
+ created() {},
80
+ watch: {
81
+ center(newValue) {
82
+ this.setCenter(newValue);
83
+ },
84
+ bbox(newValue) {
85
+ this.setFit(newValue);
86
+ },
87
+ maxZoom(zoom) {
88
+ this.lMap.setMaxZoom(zoom);
89
+ },
90
+ zoom(zoom) {
91
+ this.lMap.setZoom(zoom);
92
+ },
93
+ minZoom(zoom) {
94
+ this.lMap.setMinZoom(zoom);
95
+ },
96
+ bindMapClick(val) {
97
+ if (this.bindMapClick !== val) {
98
+ this.bindMapClick = val;
99
+ this._bingMapEvent();
100
+ }
101
+ },
102
+ bindMapMoveend(val) {
103
+ if (this.bindMapMoveend !== val) {
104
+ this.bindMapMoveend = val;
105
+ this._bingMapMoveend();
106
+ }
107
+ },
108
+ m(val) {
109
+ this.m = val;
110
+ }
111
+ },
112
+ created(){
113
+
114
+ },
115
+ data() {
116
+ return {
117
+ lMap: new MapServices(),
118
+ drawPolygon: null,
119
+ mapClick: null,
120
+ map: null,
121
+ moveend: null,
122
+ lastX: 0,
123
+ lastY: 0,
124
+ lastMapType: 0,
125
+ isFirstLoad: false,
126
+ };
127
+ },
128
+
129
+ methods: {
130
+ changeSwitchMap({
131
+ mapType,
132
+ layerType
133
+ }) {
134
+
135
+ this.lMap.selectMapLayer(mapType, layerType);
136
+ this._setMaxZoom(mapType, layerType);
137
+ let _mapType = mapType;
138
+ if (mapType > 1) {
139
+ _mapType = 0;
140
+ }
141
+ if (this.lastMapType == _mapType ) return;
142
+
143
+ this.lastMapType = _mapType;
144
+
145
+ const center = this.lMap.getCenter();
146
+ if (center && center.length) {
147
+ if (_mapType == 0) {
148
+ const {
149
+ lon,
150
+ lat
151
+ } = GPS.gcj_decrypt(center[0], center[1]);
152
+ this.lMap.setCenter([lon, lat]);
153
+ } else {
154
+ const {
155
+ lon,
156
+ lat
157
+ } = GPS.gcj_encrypt(center[0], center[1]);
158
+ this.lMap.setCenter([lon, lat]);
159
+ }
160
+ }
161
+ this.$emit('changeSwitchMap', {
162
+ mapType: _mapType,
163
+ layerType,
164
+ type:mapType
165
+ });
166
+ },
167
+ _setMaxZoom(type, layerType) {
168
+ if (type == 2 || layerType == 0) {
169
+ this.setMaxZoom(28);
170
+ // return;
171
+ } else {
172
+ this.setMaxZoom(18);
173
+ }
174
+ },
175
+ loadMap(el) {
176
+ // const dto =
177
+ this.lMap.init({
178
+ el,
179
+ type: this.mapType,
180
+ layerType: this.layerType,
181
+ viewOptions: this.getViewOptions(),
182
+ callback: (map,layers) => {
183
+ this.map = map;
184
+
185
+ if (this.bbox.length > 0) {
186
+ this.setFit(this.bbox);
187
+ }
188
+ try {
189
+ const [x, y] = this.lMap.getCenter();
190
+ this.lastX = x;
191
+ this.lastY = y;
192
+ } catch (err) {
193
+
194
+ }
195
+ this._bingMapEvent();
196
+ this._bingMapMoveend();
197
+ this.$emit('load', {
198
+ map,
199
+ mapServices: this.lMap,
200
+ layers,
201
+ ryMapTool: this.$refs.mapTool
202
+ });
203
+
204
+ if (!this.isShowSwitchMap) {
205
+ this.lastMapType = this.mapType > 2 ? 0 : this.mapType;
206
+ }
207
+ }
208
+ });
209
+ },
210
+ _bingMapEvent() {
211
+ if (this.bindMapClick) {
212
+ this._mapClickOnce();
213
+ } else {
214
+ this._mapClickOnce(true);
215
+ }
216
+ },
217
+ _bingMapMoveend() {
218
+ if (this.bindMapMoveend) {
219
+ this._mapMoveend();
220
+ } else {
221
+ this._mapMoveend(true);
222
+ }
223
+ },
224
+ getViewOptions() {
225
+ return {
226
+ projection: this.projection,
227
+ center: this.center,
228
+ zoom: this.zoom,
229
+ minZoom: this.minZoom,
230
+ maxZoom: this.maxZoom,
231
+ };
232
+ },
233
+ setMaxZoom(zoom) {
234
+ this.lMap.setMaxZoom(zoom)
235
+ },
236
+ setMinZoom(zoom) {
237
+ this.lMap.setMinZoom(zoom)
238
+ },
239
+ setZoom(zoom) {
240
+ this.lMap.setZoom(zoom);
241
+ },
242
+ crossHairClick(obj) {
243
+ this.$emit('crossHairClick', obj);
244
+ },
245
+ setCenter(center) {
246
+ this.lMap.setCenter(center, 15);
247
+ },
248
+ setFit(bbox) {
249
+ if (!bbox.length || !this.map) return;
250
+ fitNew(this.map, [bbox]);
251
+ },
252
+ drawSuccess(geo) {
253
+ this.$emit('drawSuccess', geo);
254
+ },
255
+ drawError(obj) {
256
+ this.$emit('drawError', obj);
257
+ },
258
+ _mapClickOnce(isBinClick = false) {
259
+ if (!this.mapClick) {
260
+ this.mapClick = evt => {
261
+ if (evt.dragging) {
262
+ return;
263
+ }
264
+ const pixel = this.map.getEventPixel(evt.originalEvent);
265
+ const hit = this.map.hasFeatureAtPixel(pixel);
266
+ if (hit) {
267
+ const _feature = this.map.forEachFeatureAtPixel(evt.pixel, feature => feature);
268
+ const _id = _feature.getId();
269
+ if (_id === undefined) {
270
+ return;
271
+ }
272
+ this.$emit('mapClick', _id);
273
+ }
274
+ };
275
+ }
276
+ if (isBinClick) {
277
+ this.map.un('click', this.mapClick);
278
+ this.mapClick = null;
279
+ } else {
280
+ this.map.on('click', this.mapClick);
281
+ }
282
+ },
283
+ _mapMoveend(isMoveend = false) {
284
+ this.moveend = e => {
285
+ const [x, y] = this.lMap.getCenter();
286
+ let m = 0;
287
+ if (this.lastX !== x && this.lastY !== y) {
288
+ m = caculateLL(this.lastY, this.lastX, y, x);
289
+ this.$emit('mapMoveend', {
290
+ m,
291
+ oversteSetValue: m >= this.m ? true : false,
292
+ x,
293
+ y
294
+ });
295
+
296
+ if (m >= this.m) {
297
+ this.lastX = x;
298
+ this.lastY = y;
299
+ }
300
+ return;
301
+ }
302
+ this.$emit('mapMoveend', {
303
+ m,
304
+ oversteSetValue: false,
305
+ x,
306
+ y
307
+ });
308
+ }
309
+ if (isMoveend) {
310
+ this.map.un('moveend', this.moveend);
311
+ } else {
312
+ this.map.on('moveend', this.moveend);
313
+ }
314
+ },
315
+ loadDrawPolygonEvent(e) {
316
+ this.$emit('loadDrawPolygonEvent', e);
317
+ }
318
+ }
319
+ }
320
+ </script>
321
+
322
+ <style lang="scss" scoped>
323
+ .map-box {
324
+ height: 100%;
325
+ position: relative;
326
+
327
+ &>.map-style {
328
+ height: 100%;
329
+ position: relative;
330
+ width: 100%;
331
+ }
332
+ }
333
+
334
+ .ry-map-tool {
335
+ position: absolute;
336
+ top: 20px;
337
+ }
338
+
339
+ .left {
340
+ left: 30px;
341
+ }
342
+
343
+ .right {
344
+ right: 30px;
345
+ }
346
+
347
+
348
+ .move-box {
349
+ position: absolute;
350
+ }
351
+ </style>
@@ -145,9 +145,7 @@
145
145
  this.map.getView().setZoom(zoom + 0.00001);
146
146
  this.map.getView().setZoom(zoom - 0.0001);
147
147
  },
148
-
149
-
150
-
148
+
151
149
  }
152
150
  }
153
151
  </script>
@@ -59,26 +59,32 @@ export default {
59
59
  mapStyleCopy: [],
60
60
  }
61
61
  },
62
+
62
63
  watch: {
63
- switchMapDefaultTypeOrLayer: {
64
- handler(e) {
65
- if(!e)return;
66
- const isCorrect = this.formatToJudge(e);
67
- if (!isCorrect) return;
68
- const active = this.mapStyleActive;
69
- const mapType = (isCorrect || isCorrect===0)?e[0]:1;
70
- const layerType = (isCorrect || isCorrect===1)?active:2;
71
- setTimeout(() => {
72
- this.$emit('changeSwitchMap', {
73
- mapType,
74
- layerType
75
- });
76
- }, 100);
77
- },
78
- immediate: true
79
- },
64
+ switchMapDefaultTypeOrLayer(e){
65
+ console.log(e);
66
+ if(!e)return;
67
+ const isCorrect = this.formatToJudge(e);
68
+ if (!isCorrect) return;
69
+ const active = this.mapStyleActive;
70
+ const mapType = (isCorrect || isCorrect===0)?e[0]:1;
71
+ const layerType = (isCorrect || isCorrect===1)?active:2;
72
+ setTimeout(() => {
73
+ this.$emit('changeSwitchMap', {
74
+ mapType,
75
+ layerType
76
+ });
77
+ }, 100);
78
+ },
79
+ // switchMapDefaultTypeOrLayer: {
80
+ // handler(e) {
81
+
82
+ // },
83
+ // immediate: true
84
+ // },
80
85
  mapTypeAndLayer :{
81
86
  handler(e){
87
+ console.log('111111');
82
88
  if(!Array.isArray(e) || !e[1])return;
83
89
  e.forEach((r,index)=>{
84
90
  if(index===1 && !this.switchMapDefaultTypeOrLayer){
@@ -91,9 +97,9 @@ export default {
91
97
  }
92
98
  },
93
99
  created(){
94
-
95
100
  },
96
101
  mounted() {
102
+ this._switchMapDefaultTypeOrLayer(this.switchMapDefaultTypeOrLayer);
97
103
  if(!this.switchMapDefaultTypeOrLayer){
98
104
  setTimeout(()=>{
99
105
  this.$emit('changeSwitchMap', {
@@ -186,7 +192,21 @@ export default {
186
192
  mapType: this.mapTypeActive,
187
193
  layerType: this.mapStyleActive
188
194
  });
189
- }
195
+ },
196
+ _switchMapDefaultTypeOrLayer(e){
197
+ if(!e)return;
198
+ const isCorrect = this.formatToJudge(e);
199
+ if (!isCorrect) return;
200
+ const active = this.mapStyleActive;
201
+ const mapType = (isCorrect || isCorrect===0)?e[0]:1;
202
+ const layerType = (isCorrect || isCorrect===1)?active:2;
203
+ setTimeout(() => {
204
+ this.$emit('changeSwitchMap', {
205
+ mapType,
206
+ layerType
207
+ });
208
+ }, 100);
209
+ }
190
210
  }
191
211
  }
192
212
  </script>
@@ -11,17 +11,42 @@ Vue.use(VueRouter);
11
11
  const routes = [
12
12
  {
13
13
  path: '/',
14
- component: () => import('@/views/vectorMap'),
14
+ component: () => import('@/views/map'),
15
15
  meta: { title: '地图' }
16
16
  },
17
+ {
18
+ path: '/staticMap',
19
+ component: () => import('@/views/staticMap'),
20
+ meta: { title: '室内地图' }
21
+ },
17
22
  {
18
- path: '/',
19
- component: () => import('@/views/map'),
20
- meta: { title: '地图' }
23
+ path: '/excel',
24
+ component: () => import('@/views/excel'),
25
+ meta: { title: 'excel' }
21
26
  },
27
+ {
28
+ path: '/tree',
29
+ component: () => import('@/views/tree'),
30
+ meta: { title: 'tree' }
31
+ },
32
+ {
33
+ path: '/pdf',
34
+ component: () => import('@/views/pdf'),
35
+ meta: { title: 'pdf' }
36
+ },
37
+ {
38
+ path: '/docx',
39
+ component: () => import('@/views/docx'),
40
+ meta: { title: 'docx' }
41
+ },
42
+ {
43
+ path: '/',
44
+ component: () => import('@/views/vectorMap'),
45
+ meta: { title: '地图' }
46
+ },
22
47
  {
23
48
  path: '*',
24
-    component: () => import('@/views/vectorMap'),
49
+    component: () => import('@/views/map'),
25
50
  }
26
51
  ];
27
52