ry-vue-map 0.6.0 → 0.6.2

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 (56) hide show
  1. package/README.MD +1 -1
  2. package/lib/ryui.common.0.js +625 -794
  3. package/lib/ryui.common.0.js.gz +0 -0
  4. package/lib/ryui.common.2.js +125 -125
  5. package/lib/ryui.common.2.js.gz +0 -0
  6. package/lib/ryui.common.3.js +125 -125
  7. package/lib/ryui.common.4.js +5 -5
  8. package/lib/ryui.common.5.js +21 -21
  9. package/lib/ryui.common.6.js +5 -5
  10. package/lib/ryui.common.7.js +47 -47
  11. package/lib/ryui.common.7.js.gz +0 -0
  12. package/lib/ryui.common.8.js +3 -3
  13. package/lib/ryui.common.8.js.gz +0 -0
  14. package/lib/ryui.common.9.js +3 -3
  15. package/lib/ryui.common.js +78394 -105881
  16. package/lib/ryui.common.js.gz +0 -0
  17. package/lib/ryui.css +1 -1
  18. package/lib/ryui.css.gz +0 -0
  19. package/lib/ryui.umd.0.js +625 -794
  20. package/lib/ryui.umd.0.js.gz +0 -0
  21. package/lib/ryui.umd.2.js +125 -125
  22. package/lib/ryui.umd.2.js.gz +0 -0
  23. package/lib/ryui.umd.3.js +125 -125
  24. package/lib/ryui.umd.4.js +5 -5
  25. package/lib/ryui.umd.5.js +21 -21
  26. package/lib/ryui.umd.6.js +5 -5
  27. package/lib/ryui.umd.7.js +47 -47
  28. package/lib/ryui.umd.7.js.gz +0 -0
  29. package/lib/ryui.umd.8.js +3 -3
  30. package/lib/ryui.umd.8.js.gz +0 -0
  31. package/lib/ryui.umd.9.js +3 -3
  32. package/lib/ryui.umd.js +78394 -105881
  33. package/lib/ryui.umd.js.gz +0 -0
  34. package/lib/ryui.umd.min.0.js +3 -3
  35. package/lib/ryui.umd.min.0.js.gz +0 -0
  36. package/lib/ryui.umd.min.2.js +1 -1
  37. package/lib/ryui.umd.min.2.js.gz +0 -0
  38. package/lib/ryui.umd.min.3.js +1 -1
  39. package/lib/ryui.umd.min.4.js +1 -1
  40. package/lib/ryui.umd.min.5.js +1 -1
  41. package/lib/ryui.umd.min.6.js +1 -1
  42. package/lib/ryui.umd.min.7.js +2 -2
  43. package/lib/ryui.umd.min.7.js.gz +0 -0
  44. package/lib/ryui.umd.min.8.js +1 -1
  45. package/lib/ryui.umd.min.8.js.gz +0 -0
  46. package/lib/ryui.umd.min.9.js +1 -1
  47. package/lib/ryui.umd.min.js +6 -8
  48. package/lib/ryui.umd.min.js.gz +0 -0
  49. package/package.json +2 -2
  50. package/src/components/maps/models/ryLines/ryLines.js +6 -0
  51. package/src/components/maps/models/ryMapTool/mapTool.js +7 -2
  52. package/src/components/maps/ryLines/src/index.vue +43 -1
  53. package/src/components/maps/ryMap/src/index.vue +4 -6
  54. package/src/components/maps/ryMapTool/src/index.vue +85 -67
  55. package/src/utils/lMapServices.js +13 -4
  56. package/src/views/map/index.vue +1006 -216
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ry-vue-map",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "private": false,
5
5
  "main": "lib/ryui.umd.min.js",
6
6
  "description": "ry公共组件库",
@@ -45,7 +45,7 @@
45
45
  "kml-to-geojson": "^1.0.13",
46
46
  "nprogress": "~0.2.0",
47
47
  "ol": "^6.14.1",
48
- "ry-map": "^0.5.1",
48
+ "ry-map": "^0.5.2",
49
49
  "vue": "~2.6.14",
50
50
  "vue-demi": "^0.13.11",
51
51
  "vue-router": "~3.5.2",
@@ -84,6 +84,12 @@ export default class LineDto extends Base {
84
84
  default: () => _lineDto
85
85
  }
86
86
 
87
+
88
+ isShowAll = {
89
+ type: Boolean,
90
+ default: true,
91
+ };
92
+
87
93
 
88
94
 
89
95
  }
@@ -1,6 +1,6 @@
1
1
  export default class MapToolDto {
2
2
 
3
-
3
+
4
4
  //是否显示地图中的
5
5
  isHideAreaAndKM = {
6
6
  type:Boolean,
@@ -108,5 +108,10 @@ export default class MapToolDto {
108
108
  type: Number,
109
109
  default: 0,
110
110
  };
111
-
111
+
112
+ // 绘制工具 图层级别
113
+ drawZIndex={
114
+ type: Number,
115
+ default: 1,
116
+ }
112
117
  }
@@ -119,7 +119,17 @@
119
119
  delete this.marks2[this.len];
120
120
  this.marks = this.marks2;
121
121
 
122
- }
122
+ },
123
+ isShowAll(val){
124
+ if(!val){
125
+ this.hideAll();
126
+ this.hideMarker();
127
+ return;
128
+ }
129
+ this.showAll();
130
+ this.showMarker();
131
+ },
132
+
123
133
  // isPlayback(val){
124
134
  // if(val){
125
135
  // this.trackPlayback();
@@ -311,6 +321,38 @@
311
321
  });
312
322
  this.pineArr = [];
313
323
  },
324
+ showAll(){
325
+ this.pineArr.forEach(val => {
326
+ val.show();
327
+ });
328
+ },
329
+ hideAll(){
330
+ this.pineArr.forEach(val => {
331
+ val.hide();
332
+ });
333
+ },
334
+ showMarker(){
335
+ if (this.endMarker) {
336
+ this.endMarker.show();
337
+ }
338
+ if (this.startMarker) {
339
+ this.startMarker.show();
340
+ }
341
+ if (this.moveMarker) {
342
+ this.moveMarker.show();
343
+ }
344
+ },
345
+ hideMarker(){
346
+ if (this.endMarker) {
347
+ this.endMarker.hide();
348
+ }
349
+ if (this.startMarker) {
350
+ this.startMarker.hide();
351
+ }
352
+ if (this.moveMarker) {
353
+ this.moveMarker.hide();
354
+ }
355
+ },
314
356
  removeLineMarker() {
315
357
  if (!this.map) return;
316
358
  if (this.endMarker) {
@@ -161,7 +161,9 @@
161
161
  this.setMaxZoom(18);
162
162
  }
163
163
  },
164
- loadMap(el) {
164
+ loadMap(el) {
165
+
166
+ this.lMap.DrawZIndex=this.drawZIndex;
165
167
  this.lMap.init({
166
168
  el,
167
169
  type: this.mapType,
@@ -177,7 +179,6 @@
177
179
  const [x, y] = this.lMap.getCenter();
178
180
  this.lastX = x;
179
181
  this.lastY = y;
180
- s
181
182
  } catch (err) {
182
183
 
183
184
  }
@@ -312,7 +313,6 @@
312
313
  this.$emit(event, _id);
313
314
  }
314
315
  evt.preventDefault();
315
-
316
316
  },
317
317
  _contextmenu(isBinClick) {
318
318
  if (!this.contextmenu) {
@@ -321,9 +321,7 @@
321
321
  };
322
322
  }
323
323
  if (isBinClick) {
324
- this.map.un('contextmenu', event => {
325
- event.preventDefault();
326
- });
324
+ this.map.un('contextmenu', this.contextmenu);
327
325
  this.contextmenu = null;
328
326
  } else {
329
327
 
@@ -1,26 +1,25 @@
1
-
2
1
  <template>
3
2
  <div class="draw-tool-box">
4
3
 
5
4
  <template v-if="!isRight">
6
5
  <aside class="map-button-box" v-if="isShowDrawTool">
7
- <el-button v-if="!hideAdd" class="ele-text-primary el-icon--add" @click.stop="onCreatePolygon()">
8
- </el-button>
9
- <el-button v-if="!hidePoint" class="ele-text-primary el-icon--dadian" @click.stop="onPointEvent()">
10
- </el-button>
11
- <el-button v-if="!hideCancel" class="ele-text-primary el-icon--back" @click.stop="lMap.onCancel()">
12
- </el-button>
13
- <el-button v-if="!hideDelete" class="ele-text-primary el-icon--ashbin" @click.stop="onDelete()">
14
- </el-button>
15
- <el-button v-if="!hideSave" class="ele-text-primary el-icon--duihao" @click.stop="onSave()"></el-button>
6
+ <el-button v-if="!hideAdd" class="ele-text-primary el-icon--add" @click.stop="onCreatePolygon()">
7
+ </el-button>
8
+ <el-button v-if="!hidePoint" class="ele-text-primary el-icon--dadian" @click.stop="onPointEvent()">
9
+ </el-button>
10
+ <el-button v-if="!hideCancel" class="ele-text-primary el-icon--back" @click.stop="lMap.onCancel()">
11
+ </el-button>
12
+ <el-button v-if="!hideDelete" class="ele-text-primary el-icon--ashbin" @click.stop="onDelete()">
13
+ </el-button>
14
+ <el-button v-if="!hideSave" class="ele-text-primary el-icon--duihao" @click.stop="onSave()"></el-button>
16
15
  <slot></slot>
17
16
  </aside>
18
17
 
19
18
  <aside class="map-control" v-if="isShowRangingTool" style="margin-left: 60px;">
20
- <el-button v-if="!hideLine" class="ele-text-primary el-icon--changdu" @click.stop="onCreateLine()">
21
- </el-button>
22
- <el-button v-if="!hideArea" class="ele-text-primary el-icon--mianji" @click.stop="onCreateArea()">
23
- </el-button>
19
+ <el-button v-if="!hideLine" class="ele-text-primary el-icon--changdu" @click.stop="onCreateLine()">
20
+ </el-button>
21
+ <el-button v-if="!hideArea" class="ele-text-primary el-icon--mianji" @click.stop="onCreateArea()">
22
+ </el-button>
24
23
  </aside>
25
24
  </template>
26
25
 
@@ -46,7 +45,7 @@
46
45
  <slot></slot>
47
46
  </aside>
48
47
  </template>
49
- <ry-cross-hair v-if="lMap" :isHide="isCrossHair" :map="lMap.map" @click="onClick($event)"></ry-cross-hair>
48
+ <ry-cross-hair v-if="lMap" :isHide="isCrossHair" :map="lMap.map" @click="onClick($event)"></ry-cross-hair>
50
49
  </div>
51
50
 
52
51
  </template>
@@ -76,14 +75,14 @@
76
75
  watch: {
77
76
  initModifyPolygon(val) {
78
77
  this.initModifyPolygon = val;
79
- this._init();
78
+ this._initPolygon();
80
79
  },
81
80
  isShowRangingTool(val) {
82
81
  this.isShowRangingTool = val;
83
82
  },
84
83
  isShowDrawTool(val) {
85
84
  this.isShowDrawTool = val;
86
- this.isCrossHair = val;
85
+ this.isCrossHair = val;
87
86
  },
88
87
  isRight(val) {
89
88
  this.isShowDrawTool = val;
@@ -91,22 +90,21 @@
91
90
  isCrossHair(val) {
92
91
  this.isCrossHair = val;
93
92
  },
94
- gpsType(val){
95
- if(this.lastType == val) return;
96
- this.gpsType=val;
97
- this.lastType=val;
98
- if(this.drawPolygon){
99
- this.drawPolygon.type=val;
100
- }
101
- this.selectGPSAll(this.gpsType);
93
+ gpsType(val) {
94
+ if (this.lastType == val) return;
95
+ this.gpsType = val;
96
+ this.lastType = val;
97
+ if (this.drawPolygon) {
98
+ this.drawPolygon.type = val;
99
+ }
100
+ this.selectGPSAll(this.gpsType);
102
101
  },
103
-
104
102
  },
105
103
  data() {
106
104
  return {
107
105
  drawPolygon: null,
108
- isEdit:true,
109
- lastType:-1,
106
+ isEdit: true,
107
+ lastType: -1,
110
108
  };
111
109
  },
112
110
  created() {
@@ -123,16 +121,16 @@
123
121
  bbox
124
122
  } = this._serializeGeoJson();
125
123
  this.onDelete();
126
- this.drawPolygon = this.lMap.onCreatePolygon(() => {},this.isHideAreaAndKM);
127
- this.lastType=this.gpsType;
128
- this.drawPolygon.type= this.gpsType;
124
+ this.drawPolygon = this.lMap.onCreatePolygon(() => {}, this.isHideAreaAndKM);
125
+ this.lastType = this.gpsType;
126
+ this.drawPolygon.type = this.gpsType;
129
127
  this.drawPolygon.initCoordinates(coordinates);
130
- this.isEdit=true;
128
+ this.isEdit = true;
131
129
  this.$emit('loadDrawPolygonEvent', this);
132
130
  if (bbox) {
133
- const bbox1 = [bbox[0], bbox[3], bbox[2], bbox[1]];
134
- const bbox2 = [bbox[2], bbox[1], bbox[0], bbox[3]];
135
- this.lMap.fit([bbox1,bbox2]);
131
+ const bbox1 = [bbox[0], bbox[3], bbox[2], bbox[1]];
132
+ const bbox2 = [bbox[2], bbox[1], bbox[0], bbox[3]];
133
+ this.lMap.fit([bbox1, bbox2]);
136
134
  }
137
135
  },
138
136
  _serializeGeoJson() {
@@ -160,9 +158,9 @@
160
158
  onCreatePolygon() {
161
159
  if (this.lMap) {
162
160
  // this.drawPolygon=null;
163
- this.drawPolygon = this.lMap.onCreatePolygon(() => {},this.isHideAreaAndKM);
164
- this.lastType=this.gpsType;
165
- this.drawPolygon.type=this.gpsType;
161
+ this.drawPolygon = this.lMap.onCreatePolygon(() => {}, this.isHideAreaAndKM);
162
+ this.lastType = this.gpsType;
163
+ this.drawPolygon.type = this.gpsType;
166
164
  this.$emit('loadDrawPolygonEvent', this);
167
165
  }
168
166
  },
@@ -183,13 +181,16 @@
183
181
  this.x = pointArr[0];
184
182
  this.y = pointArr[1];
185
183
 
186
- let _pointArr= pointArr;
187
- if(this.gpsType){
188
- let {lon,lat} = GPS.gcj_decrypt(pointArr[0],pointArr[1]);
189
- _pointArr=[lon,lat];
184
+ let _pointArr = pointArr;
185
+ if (this.gpsType) {
186
+ let {
187
+ lon,
188
+ lat
189
+ } = GPS.gcj_decrypt(pointArr[0], pointArr[1]);
190
+ _pointArr = [lon, lat];
190
191
  }
191
192
 
192
- this.drawPolygon.setCoordinates(_pointArr,this.gpsType);
193
+ this.drawPolygon.setCoordinates(_pointArr, this.gpsType);
193
194
 
194
195
  this.$emit('crossHairClick', {
195
196
  pointArr,
@@ -245,13 +246,16 @@
245
246
  }
246
247
  this.x = pointArr[0];
247
248
  this.y = pointArr[1];
248
- let _pointArr= pointArr;
249
- if(this.gpsType){
250
- let {lon,lat} = GPS.gcj_decrypt(pointArr[0],pointArr[1]);
251
- _pointArr=[lon,lat];
249
+ let _pointArr = pointArr;
250
+ if (this.gpsType) {
251
+ let {
252
+ lon,
253
+ lat
254
+ } = GPS.gcj_decrypt(pointArr[0], pointArr[1]);
255
+ _pointArr = [lon, lat];
252
256
  }
253
257
 
254
- this.drawPolygon.setCoordinates(_pointArr,this.gpsType);
258
+ this.drawPolygon.setCoordinates(_pointArr, this.gpsType);
255
259
  this.$emit('crossHairClick', {
256
260
  pointArr,
257
261
  delete: this.onDelete,
@@ -260,30 +264,44 @@
260
264
  }
261
265
  this.$message.error('请绘制地块后在进行操作!');
262
266
  },
263
- getGeoJson(){
264
- if(!this.lMap) return;
267
+ getGeoJson() {
268
+ if (!this.lMap) return;
265
269
  return this.lMap.getPolygonGeoJson();
266
270
  },
267
- onCancel(){
268
- if(!this.lMap) return;
269
- this.lMap.onCancel();
271
+ onCancel() {
272
+ if (!this.lMap) return;
273
+ this.lMap.onCancel();
270
274
  },
271
- onCreateLine(){
272
- let draw = this.lMap.onCreateLine(({id,type}) => {
273
- this.$emit('drawLineEvent',{draw,id,type});
274
- });
275
- draw.Id=generateGuid();
275
+ onCreateLine() {
276
+ let draw = this.lMap.onCreateLine(({
277
+ id,
278
+ type
279
+ }) => {
280
+ this.$emit('drawLineEvent', {
281
+ draw,
282
+ id,
283
+ type
284
+ });
285
+ });
286
+ draw.Id = generateGuid();
276
287
  },
277
- onCreateArea(){
278
- let draw = this.lMap.onCreateArea(({id,type}) => {
279
- this.$emit('drawPolygonEvent',{draw,id,type});
280
- });
281
- draw.Id=generateGuid();
288
+ onCreateArea() {
289
+ let draw = this.lMap.onCreateArea(({
290
+ id,
291
+ type
292
+ }) => {
293
+ this.$emit('drawPolygonEvent', {
294
+ draw,
295
+ id,
296
+ type
297
+ });
298
+ });
299
+ draw.Id = generateGuid();
282
300
  },
283
- selectGPSAll(type){
301
+ selectGPSAll(type) {
284
302
  this.lMap.removeDrawArr();
285
- if(this.drawPolygon){
286
- this.drawPolygon.selectGPS(type,true);
303
+ if (this.drawPolygon) {
304
+ this.drawPolygon.selectGPS(type, true);
287
305
  }
288
306
  }
289
307
  }
@@ -339,4 +357,4 @@
339
357
  .ele-text-primary {
340
358
  padding: 0;
341
359
  }
342
- </style>
360
+ </style>
@@ -97,7 +97,8 @@ export default class LMapServices {
97
97
  this.drawPolygonArr = new Set();
98
98
  this.drawLineArr = new Set();
99
99
  this._lRectangle = null;
100
- this.layers = null;
100
+ this.layers = null;
101
+ this.drawZIndex=1;
101
102
  }
102
103
  init(optins) {
103
104
  const {
@@ -395,7 +396,7 @@ export default class LMapServices {
395
396
 
396
397
  onCreateLine(callback) {
397
398
  if (this.map) {
398
- let drawLine = new LDraw('LineString',callback?callback:()=> {},this.map);
399
+ let drawLine = new LDraw('LineString',callback?callback:()=> {},this.map,this.drawZIndex);
399
400
  this.drawLineArr.add(drawLine);
400
401
  return drawLine;
401
402
  }
@@ -404,7 +405,7 @@ export default class LMapServices {
404
405
 
405
406
  onCreateArea(callback) {
406
407
  if (this.map) {
407
- let draw = new LDraw('Polygon', callback?callback:()=> {}, this.map);
408
+ let draw = new LDraw('Polygon', callback?callback:()=> {}, this.map,this.drawZIndex);
408
409
  this.drawPolygonArr.add(draw);
409
410
  return draw;
410
411
  }
@@ -999,6 +1000,14 @@ export default class LMapServices {
999
1000
  });
1000
1001
  }, 50);
1001
1002
 
1002
- }
1003
+ }
1004
+
1005
+ set DrawZIndex(zIndex){
1006
+ this.drawZIndex=zIndex;
1007
+ }
1008
+
1009
+ get DrawZIndex(){
1010
+ return this.drawZIndex;
1011
+ }
1003
1012
 
1004
1013
  }