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
@@ -7,7 +7,7 @@
7
7
  CheckPoint,
8
8
  getCenterPoint,
9
9
  fitNew,
10
- getLngAndLatMaxMin,
10
+ getLngAndLatMaxMin,
11
11
  GPS,
12
12
  } from 'ry-map';
13
13
  import Dto from './../../models/ryPolygons/ryPolygons.js';
@@ -19,12 +19,12 @@
19
19
  data() {
20
20
  return {
21
21
  bbox: [],
22
- bboxMap: new Map(),
23
- bboxGCJ02:[],
22
+ bboxMap: new Map(),
23
+ bboxGCJ02:[],
24
24
  bboxMapGCJ02: new Map(),
25
25
  polygonMap: new Map(),
26
- checkPointMap: new Map(),
27
- isCreate:true,
26
+ checkPointMap: new Map(),
27
+ isCreate:true,
28
28
  lastType:-1,
29
29
  };
30
30
  },
@@ -124,11 +124,11 @@
124
124
  }
125
125
  },
126
126
  gpsType(val){
127
- if(this.lastType == val) return;
128
- this.gpsType=val;
127
+ if(this.lastType == val) return;
128
+ this.gpsType=val;
129
129
  this.lastType=val;
130
130
  this.selectGPSAll(this.gpsType);
131
- },
131
+ },
132
132
 
133
133
  },
134
134
  created() {
@@ -181,16 +181,16 @@
181
181
  this.polygonMap.set(val.id, polygon);
182
182
  }
183
183
  },
184
- selectGPSAll(type){
184
+ selectGPSAll(type){
185
185
 
186
- this.polygonMap.forEach(val=> {
187
- val.selectGPS(type);
188
- });
189
-
190
- this.checkPointMap.forEach(val => {
191
- val.selectGPS(type);
186
+ this.polygonMap.forEach(val=> {
187
+ val.selectGPS(type);
192
188
  });
193
- },
189
+
190
+ this.checkPointMap.forEach(val => {
191
+ val.selectGPS(type);
192
+ });
193
+ },
194
194
 
195
195
  initCheckPoint(val, center) {
196
196
  if (!this.checkPointMap.has(val.id) && val.text) {
@@ -202,11 +202,11 @@
202
202
  if (!this.bboxMap.has(id)) {
203
203
  this.bbox.push(bbox);
204
204
  this.bboxMap.set(id, bbox);
205
- }
206
- if(!this.bboxMapGCJ02.has(id)){
207
- const _bboxGCJ02 =this.convertBBoxGCJ02(bbox);
208
- this.bboxGCJ02.push(_bboxGCJ02);
209
- this.bboxMapGCJ02.set(id,_bboxGCJ02);
205
+ }
206
+ if(!this.bboxMapGCJ02.has(id)){
207
+ const _bboxGCJ02 =this.convertBBoxGCJ02(bbox);
208
+ this.bboxGCJ02.push(_bboxGCJ02);
209
+ this.bboxMapGCJ02.set(id,_bboxGCJ02);
210
210
  }
211
211
  },
212
212
  setFit() {
@@ -289,8 +289,8 @@
289
289
  this.checkPointMap.clear();
290
290
  this.polygonMap.clear();
291
291
  this.bboxMap.clear();
292
- this.bbox = [];
293
- this.bboxGCJ02=[];
292
+ this.bbox = [];
293
+ this.bboxGCJ02=[];
294
294
  this.bboxMapGCJ02.clear();
295
295
  },
296
296
 
@@ -356,7 +356,6 @@
356
356
  checkPoint.show();
357
357
  return;
358
358
  }
359
-
360
359
  checkPoint.hide();
361
360
  }
362
361
  },
@@ -374,13 +373,13 @@
374
373
  }
375
374
  },
376
375
  restBBOXArr() {
377
- this.bbox = [];
376
+ this.bbox = [];
378
377
  this.bboxGCJ02=[];
379
378
  this.bboxMap.forEach(val => {
380
379
  this.bbox.push(val);
381
- });
382
- this.bboxMapGCJ02.forEach(val => {
383
- this.bboxGCJ02.push(val);
380
+ });
381
+ this.bboxMapGCJ02.forEach(val => {
382
+ this.bboxGCJ02.push(val);
384
383
  });
385
384
  },
386
385
  removePolygonsAndCheckPoints(ids) {
@@ -409,23 +408,23 @@
409
408
 
410
409
  if (this.bboxMap.has(id)) {
411
410
  this.bboxMap.delete(id);
412
- }
413
-
414
- if (this.bboxMapGCJ02.has(id)) {
415
- this.bboxMapGCJ02.delete(id);
411
+ }
412
+
413
+ if (this.bboxMapGCJ02.has(id)) {
414
+ this.bboxMapGCJ02.delete(id);
416
415
  }
417
416
  },
418
417
  _ranges(ids) {
419
418
  const arr = [];
420
- ids.forEach(val => {
419
+ ids.forEach(val => {
421
420
 
422
421
  if (this.bboxMap.has(val) && this.gpsType!=1) {
423
422
  const bbox = this.bboxMap.get(val);
424
423
  arr.push(bbox);
425
- }else if (this.bboxMapGCJ02.has(val) && this.gpsType==1){
426
- const bbox = this.bboxMapGCJ02.get(val);
427
- arr.push(bbox);
428
- }
424
+ }else if (this.bboxMapGCJ02.has(val) && this.gpsType==1){
425
+ const bbox = this.bboxMapGCJ02.get(val);
426
+ arr.push(bbox);
427
+ }
429
428
 
430
429
  });
431
430
  if (arr.length) {
@@ -437,9 +436,9 @@
437
436
  if (this.bboxMap.has(id) && this.gpsType!=1) {
438
437
  const bbox = this.bboxMap.get(id);
439
438
  fitNew(this.map, [bbox]);
440
- }else if(this.bboxMapGCJ02.has(id) && this.gpsType==1){
441
- const bbox = this.bboxMapGCJ02.get(id);
442
- fitNew(this.map, [bbox]);
439
+ }else if(this.bboxMapGCJ02.has(id) && this.gpsType==1){
440
+ const bbox = this.bboxMapGCJ02.get(id);
441
+ fitNew(this.map, [bbox]);
443
442
  }
444
443
  },
445
444
  _insert(val, isLoad) {
@@ -463,7 +462,7 @@
463
462
  }
464
463
  },
465
464
  // 批量插入多边形
466
- _inserts(arr) {
465
+ _inserts(arr) {
467
466
  this.lastType=this.gpsType;
468
467
  arr.forEach(val => {
469
468
  this._insert(val, false);
@@ -476,26 +475,26 @@
476
475
  this.$emit('onLoad', {
477
476
  polygonMap: this.polygonMap,
478
477
  checkPointMap: this.checkPointMap,
479
- bboxMap: this.bboxMap,
478
+ bboxMap: this.bboxMap,
480
479
  bboxMapGCJ02:this.bboxMapGCJ02
481
480
  });
482
481
  },
483
482
  _restFit() {
484
- let bbox = [];
485
- if(this.gpsType !=1){
486
- this.bboxMap.forEach((val, key) => {
487
- if (this.isShowPolygons.findIndex(r => r.id == key) === -1) {
488
- bbox.push(this.bboxMap.get(key));
489
- }
490
- });
491
- }else if(this.gpsType ==1){
492
- this.bboxMapGCJ02.forEach((val, key) => {
493
- if (this.isShowPolygons.findIndex(r => r.id == key) === -1) {
494
- bbox.push(this.bboxMapGCJ02.get(key));
495
- }
496
- });
497
- }
498
-
483
+ let bbox = [];
484
+ if(this.gpsType !=1){
485
+ this.bboxMap.forEach((val, key) => {
486
+ if (this.isShowPolygons.findIndex(r => r.id == key) === -1) {
487
+ bbox.push(this.bboxMap.get(key));
488
+ }
489
+ });
490
+ }else if(this.gpsType ==1){
491
+ this.bboxMapGCJ02.forEach((val, key) => {
492
+ if (this.isShowPolygons.findIndex(r => r.id == key) === -1) {
493
+ bbox.push(this.bboxMapGCJ02.get(key));
494
+ }
495
+ });
496
+ }
497
+
499
498
 
500
499
  if (bbox.length) {
501
500
  if(bbox.length > 1){
@@ -504,17 +503,17 @@
504
503
  this.setFitFist(bbox[0]);
505
504
  }
506
505
  }
507
- },
508
- convertBBoxGCJ02(bbox){
509
- const pointArr= [];
510
- const { lat, lon } = GPS.gcj_encrypt(bbox[0], bbox[1]);
511
- const { lon:lon2, lat:lat2 }= GPS.gcj_encrypt(bbox[2], bbox[3]);
512
- pointArr.push(lon);
513
- pointArr.push(lat);
514
- pointArr.push(lon2);
515
- pointArr.push(lat2);
516
- return pointArr;
517
- },
506
+ },
507
+ convertBBoxGCJ02(bbox){
508
+ const pointArr= [];
509
+ const { lat, lon } = GPS.gcj_encrypt(bbox[0], bbox[1]);
510
+ const { lon:lon2, lat:lat2 }= GPS.gcj_encrypt(bbox[2], bbox[3]);
511
+ pointArr.push(lon);
512
+ pointArr.push(lat);
513
+ pointArr.push(lon2);
514
+ pointArr.push(lat2);
515
+ return pointArr;
516
+ },
518
517
 
519
518
  },
520
519
  }
@@ -0,0 +1,7 @@
1
+ import RyStaticMap from './src/index';
2
+
3
+ RyStaticMap.install = (Vue) => {
4
+ Vue.install(RyStaticMap.name, RyStaticMap);
5
+ };
6
+
7
+ export default RyStaticMap;
@@ -0,0 +1,233 @@
1
+ <template>
2
+ <div class="map-box">
3
+ <div v-lmap:loadMap 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
+ :isHideAreaAndKM="isHideAreaAndKM"
14
+ @loadDrawPolygonEvent="loadDrawPolygonEvent($event)" @success="drawSuccess($event)"
15
+ @error="drawError($event)">
16
+ <template>
17
+ <slot name="maptool"></slot>
18
+ </template>
19
+ </RyMapTool>
20
+
21
+ <template v-if="map">
22
+ <slot name="polygon" :mapDto="{map,lMap}">
23
+
24
+ </slot>
25
+
26
+ <slot name="marker" :mapDto="{map,lMap}">
27
+
28
+ </slot>
29
+ </template>
30
+
31
+ </div>
32
+
33
+
34
+
35
+ </template>
36
+ <script>
37
+ import MapServices from '@/utils/lMapServices.js';
38
+ import MapDto from './../../models/ryStaticMap/map.js';
39
+ import ViewDto from './../../models/ryStaticMap/view.js';
40
+ import MapToolDto from './../../models/ryMapTool/mapTool.js';
41
+ import RyMapTool from '../../ryMapTool/src/index';
42
+ import ImageLayer from 'ol/layer/Image';
43
+ import ImageStatic from 'ol/source/ImageStatic';
44
+ import View from 'ol/View';
45
+ import Projection from 'ol/proj/Projection';
46
+
47
+ import {
48
+ fitNew,
49
+ caculateLL,
50
+ } from 'ry-map';
51
+ export default {
52
+ name: 'RyStaticMap',
53
+ components: {
54
+ RyMapTool,
55
+ },
56
+ props: {
57
+ ...new MapDto(),
58
+ ...new ViewDto(),
59
+ ...new MapToolDto()
60
+ },
61
+ created() {
62
+ },
63
+ watch: {
64
+ center(newValue) {
65
+ this.setCenter(newValue);
66
+ },
67
+ bbox(newValue) {
68
+ this.setFit(newValue);
69
+ },
70
+ maxZoom(zoom) {
71
+ this.lMap.setMaxZoom(zoom);
72
+ },
73
+ zoom(zoom) {
74
+ this.lMap.setZoom(zoom);
75
+ },
76
+ minZoom(zoom) {
77
+ this.lMap.setMinZoom(zoom);
78
+ },
79
+ bindMapClick(val) {
80
+ if (this.bindMapClick !== val) {
81
+ this.bindMapClick = val;
82
+ this._bingMapEvent();
83
+ }
84
+ },
85
+ },
86
+ data() {
87
+ return {
88
+ lMap: new MapServices(),
89
+ drawPolygon: null,
90
+ mapClick: null,
91
+ map: null,
92
+ moveend: null,
93
+ lastX: 0,
94
+ lastY: 0,
95
+ };
96
+ },
97
+ methods: {
98
+
99
+ getImageLayer() {
100
+ return new ImageLayer({
101
+ source: new ImageStatic({
102
+ crossOrigin: 'anonymous',
103
+ imageSize: this.imageSize,
104
+ imageExtent: this.imageExtent,
105
+ // url: require('@/assets/jsmap.png')
106
+ url:this.url
107
+ })
108
+ });
109
+ },
110
+ getProjection() {
111
+ return new Projection({
112
+ code: 3875,
113
+ extent: this.imageExtent,
114
+ units: 'm'
115
+ });
116
+ },
117
+ getView() {
118
+ return new View({
119
+ projection: 'EPSG:3857',
120
+ center: this.center,
121
+ Projection: this.getProjection(),
122
+ zoom: this.zoom,
123
+ minZoom: this.minZoom,
124
+ maxZoom: this.maxZoom
125
+ });
126
+ },
127
+
128
+ async loadMap(el) {
129
+ const map = await this.lMap.initStaticMap(el,{
130
+ view:this.getView(),
131
+ layer:this.getImageLayer(),
132
+ });
133
+ this.map=map;
134
+ this.$emit('load', {
135
+ map,
136
+ mapServices: this.lMap,
137
+ ryMapTool: this.$refs.mapTool
138
+ });
139
+ },
140
+ _bingMapEvent() {
141
+ if (this.bindMapClick) {
142
+ this._mapClickOnce();
143
+ } else {
144
+ this._mapClickOnce(true);
145
+ }
146
+ },
147
+ setMaxZoom(zoom) {
148
+ this.lMap.setMaxZoom(zoom)
149
+ },
150
+ setMinZoom(zoom) {
151
+ this.lMap.setMinZoom(zoom)
152
+ },
153
+ setZoom(zoom) {
154
+ this.lMap.setZoom(zoom);
155
+ },
156
+ crossHairClick(obj) {
157
+ this.$emit('crossHairClick', obj);
158
+ },
159
+ setCenter(center) {
160
+ this.lMap.setCenter(center, 15);
161
+ },
162
+ setFit(bbox) {
163
+ if (!bbox.length || !this.map) return;
164
+ fitNew(this.map, [bbox]);
165
+ },
166
+ drawSuccess(geo) {
167
+ this.$emit('drawSuccess', geo);
168
+ },
169
+ drawError(obj) {
170
+ this.$emit('drawError', obj);
171
+ },
172
+ _mapClickOnce(isBinClick = false) {
173
+ if (!this.mapClick) {
174
+ this.mapClick = evt => {
175
+ if (evt.dragging) {
176
+ return;
177
+ }
178
+ const pixel = this.map.getEventPixel(evt.originalEvent);
179
+ const hit = this.map.hasFeatureAtPixel(pixel);
180
+ if (hit) {
181
+ const _feature = this.map.forEachFeatureAtPixel(evt.pixel, feature => feature);
182
+ const _id = _feature.getId();
183
+ if (_id === undefined) {
184
+ return;
185
+ }
186
+ this.$emit('mapClick', _id);
187
+ }
188
+ };
189
+ }
190
+ if (isBinClick) {
191
+ this.map.un('click', this.mapClick);
192
+ this.mapClick = null;
193
+ } else {
194
+ this.map.on('click', this.mapClick);
195
+ }
196
+ },
197
+ loadDrawPolygonEvent(e) {
198
+ this.$emit('loadDrawPolygonEvent', e);
199
+ }
200
+ }
201
+ }
202
+ </script>
203
+
204
+ <style lang="scss" scoped>
205
+ .map-box {
206
+ height: 100%;
207
+ position: relative;
208
+
209
+ &>.map-style {
210
+ height: 100%;
211
+ position: relative;
212
+ width: 100%;
213
+ }
214
+ }
215
+
216
+ .ry-map-tool {
217
+ position: absolute;
218
+ top: 20px;
219
+ }
220
+
221
+ .left {
222
+ left: 30px;
223
+ }
224
+
225
+ .right {
226
+ right: 30px;
227
+ }
228
+
229
+
230
+ .move-box {
231
+ position: absolute;
232
+ }
233
+ </style>
@@ -0,0 +1,6 @@
1
+ import RyUniMap from './src/ryUniMap';
2
+ RyUniMap.install = (Vue) => {
3
+ Vue.install(RyUniMap.name, RyUniMap);
4
+ };
5
+
6
+ export default RyUniMap;