ry-vue-map 0.0.3 → 0.0.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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ry-vue-map",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "private": false,
5
5
  "main": "lib/ryui.umd.min.js",
6
6
  "description": "ry公共组件库",
@@ -117,4 +117,9 @@ export default class MapDto {
117
117
  ]
118
118
  }
119
119
  }
120
+ isShowSwitchMap={
121
+ type: Boolean,
122
+ default: true,
123
+ }
124
+
120
125
  }
@@ -3,42 +3,73 @@
3
3
  </template>
4
4
 
5
5
  <script>
6
-
7
- import {
8
- CrossHair
9
- } from 'ry-map';
10
-
11
- export default {
12
- name: 'RyCrossHair',
13
- props: {
14
- map: {
15
- type: Object,
16
- default: () => null,
17
- }
18
- },
19
- created() {
20
- this.map.addControl(new CrossHair(() => {
21
- this.$emit('click', this.getCenter());
22
- }));
23
- },
24
- data() {
25
- return {
6
+ import {
7
+ watch
8
+ } from 'fs';
9
+ import {
10
+ CrossHair
11
+ } from 'ry-map';
26
12
 
27
- }
28
- },
29
- methods: {
30
- // 点击获取地图把心中心点坐标
31
- getCenter() {
32
- if (!this.map) {
33
- return;
34
- }
35
- const view = this.map.getView();
36
- let [x, y] = view.getCenter();
37
- return [x, y];
38
- }
39
- }
40
- }
13
+ export default {
14
+ name: 'RyCrossHair',
15
+ props: {
16
+ map: {
17
+ type: Object,
18
+ default: () => null,
19
+ },
20
+ isHide: {
21
+ type: Boolean,
22
+ default: false,
23
+ }
24
+ },
25
+ created() {
26
+ if (this.isHide && !this.crossHair) {
27
+ this.createCrossHair();
28
+ }
29
+ // this.map.addControl(new CrossHair(() => {
30
+ // this.$emit('click', this.getCenter());
31
+ // }));
32
+ },
33
+ watch: {
34
+ isHide(val) {
35
+ if (val && !this.crossHair) {
36
+ this.createCrossHair();
37
+ return;
38
+ }
39
+ this.removeControl();
40
+ }
41
+ },
42
+ data() {
43
+ return {
44
+ crossHair: null
45
+ }
46
+ },
47
+ methods: {
48
+ // 点击获取地图把心中心点坐标
49
+ getCenter() {
50
+ if (!this.map) {
51
+ return;
52
+ }
53
+ const view = this.map.getView();
54
+ let [x, y] = view.getCenter();
55
+ return [x, y];
56
+ },
57
+ createCrossHair() {
58
+ this.crossHair = new CrossHair(() => {
59
+ this.$emit('click', this.getCenter());
60
+ });
61
+ this.map.addControl(this.crossHair);
62
+ },
63
+ removeControl() {
64
+ if (!this.map || !this.crossHair) {
65
+ return;
66
+ }
67
+ this.map.removeControl(this.crossHair);
68
+ this.crossHair = null;
69
+ }
70
+ }
71
+ }
41
72
  </script>
42
73
 
43
74
  <style>
44
- </style>
75
+ </style>
@@ -7,7 +7,6 @@
7
7
  'right':isRight
8
8
  }"
9
9
  v-if="lMap.map && isRyMapTool"
10
-
11
10
  @crossHairClick="crossHairClick($event)"
12
11
  :lMap="lMap"
13
12
  :isShowRangingTool="isShowRangingTool"
@@ -41,7 +40,7 @@
41
40
  </template>
42
41
 
43
42
  <SwitchMap
44
- v-if="isSwitchMapTool"
43
+ v-if="isSwitchMapTool && isShowSwitchMap"
45
44
  :height="switchMapHeight"
46
45
  :switchMapDefaultTypeOrLayer="switchMapDefaultTypeOrLayer"
47
46
  :mapTypeAndLayer = "mapTypeAndLayer"
@@ -125,7 +124,7 @@
125
124
  changeSwitchMap({mapType,layerType}){
126
125
  this.lMap.selectMapLayer(mapType,layerType);
127
126
  if(this.lastMapType == mapType) return;
128
- this.lastMapType=mapType;
127
+ this.lastMapType= mapType > 1? 0 : mapType;
129
128
  let _mapType= mapType;
130
129
  if(mapType > 1){
131
130
  _mapType=0;
@@ -144,6 +143,7 @@
144
143
  this.$emit('changeSwitchMap',{mapType:_mapType,layerType});
145
144
  },
146
145
  loadMap(el) {
146
+ // const dto =
147
147
  this.lMap.init({
148
148
  el,
149
149
  type: this.mapType,
@@ -169,6 +169,10 @@
169
169
  mapServices: this.lMap,
170
170
  ryMapTool: this.$refs.mapTool
171
171
  });
172
+
173
+ if(!this.isShowSwitchMap){
174
+ this.lastMapType= this.mapType > 2 ? 0 : this.mapType;
175
+ }
172
176
  }
173
177
  });
174
178
  },
@@ -46,7 +46,7 @@
46
46
  <slot></slot>
47
47
  </aside>
48
48
  </template>
49
- <ry-cross-hair v-if="lMap && isCrossHair" :map="lMap.map" @click="onClick($event)"></ry-cross-hair>
49
+ <ry-cross-hair v-if="lMap" :isHide="isCrossHair" :map="lMap.map" @click="onClick($event)"></ry-cross-hair>
50
50
  </div>
51
51
 
52
52
  </template>
@@ -82,6 +82,7 @@
82
82
  },
83
83
  isShowDrawTool(val) {
84
84
  this.isShowDrawTool = val;
85
+ this.isCrossHair = val;
85
86
  },
86
87
  isRight(val) {
87
88
  this.isShowDrawTool = val;
@@ -243,7 +244,6 @@
243
244
  }
244
245
  this.x = pointArr[0];
245
246
  this.y = pointArr[1];
246
-       
247
247
  let _pointArr= pointArr;
248
248
  if(this.gpsType){
249
249
  let {lon,lat} = GPS.gcj_decrypt(pointArr[0],pointArr[1]);
@@ -268,7 +268,6 @@
268
268
  this.lMap.onCancel();
269
269
  },
270
270
  selectGPSAll(type){
271
- // this.onDelete();
272
271
  this.lMap.removeDrawArr();
273
272
  if(this.drawPolygon){
274
273
  this.drawPolygon.selectGPS(type,true);
@@ -62,7 +62,7 @@
62
62
  this.setFit();
63
63
  }
64
64
  },
65
- gpsType(val){
65
+ gpsType(val){
66
66
  if(this.lastType == val) return;
67
67
  this.gpsType=val;
68
68
  this.lastType=val;
@@ -86,6 +86,9 @@ export default {
86
86
  },
87
87
  immediate:true
88
88
  }
89
+ },
90
+ created(){
91
+
89
92
  },
90
93
  mounted() {
91
94
  if(!this.switchMapDefaultTypeOrLayer){
@@ -287,6 +287,12 @@ export default class LMapServices {
287
287
  // callback();
288
288
  // }
289
289
  }
290
+
291
+ skipCurrentDraw(){
292
+ if (this._lPolygon) {
293
+ this._lPolygon.skipCurrentDraw();
294
+ }
295
+ }
290
296
 
291
297
  onCancel() {
292
298
  if (this._lPolygon) {