ry-vue-map 0.6.13 → 0.6.14

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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ry-vue-map",
3
- "version": "0.6.13",
3
+ "version": "0.6.14",
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.4",
48
+ "ry-map": "^0.5.6",
49
49
  "vue": "~2.6.14",
50
50
  "vue-demi": "^0.13.11",
51
51
  "vue-router": "~3.5.2",
@@ -135,6 +135,18 @@ export default class MapDto {
135
135
  isShowSwitchMap={
136
136
  type: Boolean,
137
137
  default: true,
138
- }
138
+ }
139
+
140
+ // 是否开启 放大时显示多边形中的文字
141
+ resolution={
142
+ type: Boolean,
143
+ default: false,
144
+ }
145
+
146
+ // 设定值zoom 用于判断当前zoom是否大于 15 默认值15
147
+ zoomedIn = {
148
+ type: Number,
149
+ default:17,
150
+ };
139
151
 
140
152
  }
@@ -118,11 +118,11 @@ export default class PolygonsDto extends Base {
118
118
  default: false,
119
119
  };
120
120
 
121
- // 调校参数
122
- correct={
123
- type:Number,
124
- default:0,
125
- }
121
+ // // 调校参数
122
+ // correct={
123
+ // type:Number,
124
+ // default:0,
125
+ // }
126
126
 
127
127
  // // 是否开启 放大时显示多边形中的文字
128
128
  // declutter={
@@ -94,6 +94,9 @@
94
94
  },
95
95
  bindMapMoveend(val) {
96
96
  this._bingMapMoveend();
97
+ },
98
+ resolution(val){
99
+ this._bingResolution();
97
100
  },
98
101
  m(val) {
99
102
  this.m = val;
@@ -111,7 +114,8 @@
111
114
  lastMapType: 0,
112
115
  isFirstLoad: false,
113
116
  contextmenu: null,
114
- dblClick: null,
117
+ dblClick: null,
118
+ resolutionFun:null,
115
119
  };
116
120
  },
117
121
 
@@ -183,7 +187,8 @@
183
187
 
184
188
  }
185
189
  this._bingMapEvent();
186
- this._bingMapMoveend();
190
+ this._bingMapMoveend();
191
+ this._bingResolution();
187
192
  this._bindContextmenu();
188
193
  this._binddblClick();
189
194
  this.$emit('load', {
@@ -213,6 +218,15 @@
213
218
  } else {
214
219
  this._mapMoveend(true);
215
220
  }
221
+ },
222
+ _bingResolution(){
223
+ if(this.resolution){
224
+ this.bingResolutionEvent();
225
+ }
226
+ else {
227
+ this.bingResolutionEvent(true);
228
+ }
229
+
216
230
  },
217
231
  _bindContextmenu() {
218
232
  if (this.bindContextmenu) {
@@ -374,10 +388,36 @@
374
388
  } else {
375
389
  this.map.on('moveend', this.moveend);
376
390
  }
377
- },
391
+ },
392
+
378
393
  loadDrawPolygonEvent(e) {
379
394
  this.$emit('loadDrawPolygonEvent', e);
380
- }
395
+ },
396
+
397
+ bingResolutionEvent(isResolution = false){
398
+ const view =this.map.getView();
399
+ const zoomedIn = this.zoomedIn;
400
+ let isZoomedIn = view.getZoom() > zoomedIn;
401
+
402
+ this.resolutionFun= ()=> {
403
+ const currentZoom = view.getZoom();
404
+ if (currentZoom > zoomedIn && !isZoomedIn) {
405
+ isZoomedIn = true;
406
+ this.$emit('resolutionEvent', {zoom:currentZoom,status:isZoomedIn});
407
+ } else if (currentZoom <= zoomedIn && isZoomedIn) {
408
+ isZoomedIn = false;
409
+ this.$emit('resolutionEvent', {zoom:currentZoom,status:isZoomedIn});
410
+ }
411
+
412
+ };
413
+
414
+ if (isResolution) {
415
+ view.un('change:resolution', this.resolutionFun);
416
+ } else {
417
+ view.on('change:resolution', this.resolutionFun);
418
+ }
419
+
420
+ },
381
421
  }
382
422
  }
383
423
  </script>
@@ -239,9 +239,7 @@
239
239
  // }
240
240
  },
241
241
  setText(text) {
242
- if (this.checkPoint) {
243
- this.checkPoint.setText(text);
244
- }
242
+ this.polygon.setText(text);
245
243
  },
246
244
  selectGPSAll(type){
247
245
  // if(this.checkPoint){
@@ -366,26 +366,17 @@
366
366
  },
367
367
 
368
368
  _isCheckPointHide(val) {
369
-
369
+ console.log('ceshi==========',val);
370
370
  const id = val.id;
371
371
  if (this.polygonMap.has(id)) {
372
- const polygonMap = this.polygonMap.get(id);
373
- if (val.isShow) {
374
- polygonMap.setTextVisible(true);
375
- return;
376
- }
377
- polygonMap.setTextVisible(false);
372
+ const polygonMap = this.polygonMap.get(id).setTextVisible(val.isShow);
373
+ // if (val.isShow) {
374
+ // polygonMap.setTextVisible(true);
375
+ // return;
376
+ // }
377
+ // polygonMap.setTextVisible(false);
378
378
  }
379
379
 
380
- // const id = val.id;
381
- // if (this.checkPointMap.has(id)) {
382
- // const checkPoint = this.checkPointMap.get(id);
383
- // if (val.isShow) {
384
- // checkPoint.show();
385
- // return;
386
- // }
387
- // checkPoint.hide();
388
- // }
389
380
  },
390
381
 
391
382
  _isCheckPointHides(arr) {
@@ -395,9 +386,9 @@
395
386
  },
396
387
 
397
388
  setText(id, text) {
398
- if (this.checkPointMap.has(id)) {
399
- const checkPoint = this.checkPointMap.get(id);
400
- checkPoint.setText(text);
389
+ if (this.polygonMap.has(id)) {
390
+ const checkPoint = this.polygonMap.get(id);
391
+ checkPoint.setText(text);
401
392
  }
402
393
  },
403
394
  restBBOXArr() {
@@ -1,16 +1,16 @@
1
1
  <template>
2
2
  <div class="map-style">
3
3
  <ry-map projection="EPSG:4326" :zoom="15" :minZoom="1" :maxZoom="28" :center="center" @load="load($event)"
4
- :bindMapClick="true" @mapClick="mapClick($event)"  :switchMapDefaultTypeOrLayer="[0,2]">
4
+ :bindMapClick="true" @mapClick="mapClick($event)" :resolution="true" @resolutionEvent="resolutionEvent($event)"  :switchMapDefaultTypeOrLayer="[0,2]">
5
5
  <template #marker="{mapDto}">
6
6
  <!-- <ry-lines :isPlaybackTrackPoints="isPlaybackTrackPoints" :moveMarkerDto="moveMarkerDto" :map="mapDto.map"
7
7
  :isConneLine="false" :model="lineModel" :linenIsert="lineData" :isFit="true"></ry-lines> -->
8
8
  <!-- <RyWMSs v-if="wmsDtos.length" :map="mapDto.map" :modelArr="wmsDtos" /> -->
9
- <ry-polygons :isShowAll="isShowField" :isCheckPointHideAll="!isShowText" :map="mapDto.map" :isFit="true" :gpsType="0" :modelArr="modelArr" >
9
+ <ry-polygons :isShowAll="isShowField" :isCheckPointHide="testObj" :isCheckPointHideAll="!isShowText" :map="mapDto.map" :isFit="true" :gpsType="0" :modelArr="modelArr" >
10
10
  </ry-polygons>
11
11
 
12
- <ry-polygon :isShow="isShowField" :isCheckPointHide="!isShowText" :map="mapDto.map" :isFit="true" :gpsType="0" :model="modelArr[0]" >
13
- </ry-polygon>
12
+ <!-- <ry-polygon :isShow="isShowField" :isCheckPointHide="!isShowText" :map="mapDto.map" :isFit="true" :gpsType="0" :model="modelArr[0]" >
13
+ </ry-polygon> -->
14
14
  <!-- <RyKMLs @loadingEvent="loadingEvent($event)" :map="mapDto.map" :modelArr="kmls" ref="kmls"></RyKMLs> -->
15
15
  </template>
16
16
 
@@ -84,8 +84,8 @@
84
84
  zIndex: 20,
85
85
  type: 1,
86
86
  text:'10 亩',
87
- // isShowText: true,
88
- declutter: true,
87
+ //isShowText: false,
88
+ // declutter: false,
89
89
  };
90
90
 
91
91
  const polygonModel2 = {
@@ -98,7 +98,7 @@
98
98
  type: 1,
99
99
  text:'11 亩',
100
100
  //isShowText: true,
101
- declutter: true,
101
+ // declutter: true,
102
102
  };
103
103
 
104
104
  const polygonModel3 = {
@@ -111,7 +111,7 @@
111
111
  type: 1,
112
112
  text:'12 亩',
113
113
  //isShowText: true,
114
- declutter: true,
114
+ // declutter: true,
115
115
  };
116
116
 
117
117
  const polygonModel4 = {
@@ -124,7 +124,7 @@
124
124
  type: 1,
125
125
  text:'13 亩',
126
126
  //isShowText: true,
127
- declutter: true,
127
+ // declutter: true,
128
128
  };
129
129
 
130
130
 
@@ -163,7 +163,11 @@
163
163
  center: [120.2687149, 29.8142052],
164
164
  lineModel: ModelLineArr[0],
165
165
  lineData: null,
166
- isPlaybackTrackPoints: false,
166
+ isPlaybackTrackPoints: false,
167
+ testObj:{
168
+ id:'ceshi1',
169
+ isShow:false,
170
+ },
167
171
  wmsDtos: [{
168
172
  url: 'https://geo.ryaims.com:8010/geoserver/daofeng/wms',
169
173
  id: 'daofeng',
@@ -252,8 +256,15 @@
252
256
  };
253
257
  },
254
258
  drawError(obj) {},
255
- mapClick(e) {
256
- // alert(e);
259
+ mapClick(e) {
260
+ console.log('e=====','e');
261
+ this.testObj={
262
+ id:'ceshi1',
263
+ // isShow:false,
264
+ isShow:!this.testObj.isShow,
265
+ };
266
+ // alert(e);
267
+
257
268
  // alert(e);
258
269
  },
259
270
  onLoad(e) {},
@@ -339,7 +350,11 @@
339
350
  },
340
351
  loadingEvent(e) {
341
352
  // alert(e);
342
- }
353
+ },
354
+ resolutionEvent(obj){
355
+ console.log('obj=======',obj);
356
+ // this.isShowText=obj.status;
357
+ },
343
358
 
344
359
  }
345
360
  };