ry-vue-map 0.3.5 → 0.3.7

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.3.5",
3
+ "version": "0.3.7",
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.4.5",
48
+ "ry-map": "^0.4.6",
49
49
  "vue": "~2.6.14",
50
50
  "vue-demi": "^0.13.11",
51
51
  "vue-router": "~3.5.2",
@@ -16,7 +16,7 @@ export default class MapDto {
16
16
  // 最大缩放率
17
17
  this.maxZoom = {
18
18
  type: Number,
19
- default: 18,
19
+ default: 21,
20
20
  };
21
21
 
22
22
  // 最小缩放率
@@ -21,25 +21,20 @@
21
21
  <slot name="polygon" :mapDto="{map,lMap}">
22
22
 
23
23
  </slot>
24
-
24
+
25
25
  <slot name="marker" :mapDto="{map,lMap}">
26
-
26
+
27
27
  </slot>
28
28
  </template>
29
-
30
- <SwitchMap
31
- v-if="isSwitchMapTool && isShowSwitchMap"
32
- :height="switchMapHeight"
33
- :switchMapDefaultTypeOrLayer="switchMapDefaultTypeOrLayer"
34
- :mapTypeAndLayer="mapTypeAndLayer"
35
- class="move-box" :style="{
29
+
30
+ <SwitchMap v-if="isSwitchMapTool && isShowSwitchMap" :height="switchMapHeight"
31
+ :switchMapDefaultTypeOrLayer="switchMapDefaultTypeOrLayer" :mapTypeAndLayer="mapTypeAndLayer"
32
+ class="move-box" :style="{
36
33
  top:switchMapPosTop + 'px',
37
34
  right:isSwitchMapRight?switchMapPosLeftOrRight + 'px':'none',
38
35
  left:!isSwitchMapRight?switchMapPosLeftOrRight + 'px':'none'
39
- }" :bottom-right="isSwitchMapRight"
40
- @changeSwitchMap="changeSwitchMap"
41
- :isDisabled= "isDisabledSwitchMapTabEvent"
42
- />
36
+ }" :bottom-right="isSwitchMapRight" @changeSwitchMap="changeSwitchMap"
37
+ :isDisabled="isDisabledSwitchMapTabEvent" />
43
38
 
44
39
  <!-- 'current': !isRyMapTool || !isRight -->
45
40
  </div>
@@ -123,15 +118,15 @@
123
118
  mapType,
124
119
  layerType
125
120
  }) {
126
-
121
+
127
122
  this.lMap.selectMapLayer(mapType, layerType);
128
123
  this._setMaxZoom(mapType, layerType);
129
- let _mapType = mapType;
130
- if (mapType > 1) {
131
- _mapType = 0;
132
- }
133
- if (this.lastMapType == _mapType ) return;
134
-
124
+ let _mapType = mapType;
125
+ if (mapType > 1) {
126
+ _mapType = 0;
127
+ }
128
+ if (this.lastMapType == _mapType) return;
129
+
135
130
  this.lastMapType = _mapType;
136
131
 
137
132
  const center = this.lMap.getCenter();
@@ -153,7 +148,7 @@
153
148
  this.$emit('changeSwitchMap', {
154
149
  mapType: _mapType,
155
150
  layerType,
156
- type:mapType
151
+ type: mapType
157
152
  });
158
153
  },
159
154
  _setMaxZoom(type, layerType) {
@@ -171,8 +166,8 @@
171
166
  type: this.mapType,
172
167
  layerType: this.layerType,
173
168
  viewOptions: this.getViewOptions(),
174
-
175
- callback: (map,layers) => {
169
+
170
+ callback: (map, layers) => {
176
171
  this.map = map;
177
172
 
178
173
  if (this.bbox.length > 0) {
@@ -254,15 +249,15 @@
254
249
  if (evt.dragging) {
255
250
  return;
256
251
  }
257
-
252
+
258
253
  const pixel = this.map.getEventPixel(evt.originalEvent);
259
254
  const hit = this.map.hasFeatureAtPixel(pixel);
260
255
  if (hit) {
261
256
  const _feature = this.map.forEachFeatureAtPixel(evt.pixel, feature => feature);
262
- this.$emit('mapClick2', _feature);
257
+ this.$emit('mapClick2', _feature);
263
258
  const _id = _feature.getId();
264
259
  if (_id === undefined) {
265
- // this.$emit('mapClick2', _feature);
260
+ // this.$emit('mapClick2', _feature);
266
261
  return;
267
262
  }
268
263
  this.$emit('mapClick', _id);
@@ -346,4 +341,4 @@
346
341
  .move-box {
347
342
  position: absolute;
348
343
  }
349
- </style>
344
+ </style>
@@ -1,48 +1,31 @@
1
1
  <template>
2
2
  <div class="map-box">
3
3
  <div v-lmap:loadMap class="map-style"></div>
4
- <RyMapTool class="ry-map-tool" :class="{
4
+ <RyMapTool class="ry-map-tool" :class="{
5
5
  'left':!isRight,
6
6
  'right':isRight
7
7
  }" v-if="lMap.map && isRyMapTool" @crossHairClick="crossHairClick($event)" :lMap="lMap"
8
- :isShowRangingTool="isShowRangingTool" :initModifyPolygon="initModifyPolygon"
9
- :isShowDrawTool="isShowDrawTool" :isRight="isRight" :isCrossHair="isCrossHair" :hideAdd="hideAdd"
10
- :hidePoint="hidePoint" :hideCancel="hideCancel" :hideDelete="hideDelete" :hideSave="hideSave"
11
- :hideLine="hideLine" :hideArea="hideArea" :isSwitchMap="isSwitchMap" :isSwitchMapRight="isSwitchMapRight"
12
- :gpsType="lastMapType" @loadDrawPolygonEvent="loadDrawPolygonEvent($event)" @success="drawSuccess($event)"
13
- @error="drawError($event)">
14
- <template>
15
- <slot name="maptool"></slot>
16
- </template>
17
- </RyMapTool>
18
-
19
- <template v-if="map">
20
- <slot name="polygon" :mapDto="{map,lMap}">
21
-
22
- </slot>
23
-
24
- <slot name="marker" :mapDto="{map,lMap}">
25
-
26
- </slot>
27
- </template>
28
- <!--
29
- <SwitchMap
30
- v-if="isSwitchMapTool && isShowSwitchMap"
31
- :height="switchMapHeight"
32
- :switchMapDefaultTypeOrLayer="switchMapDefaultTypeOrLayer"
33
- :mapTypeAndLayer="mapTypeAndLayer"
34
- class="move-box" :style="{
35
- top:switchMapPosTop + 'px',
36
- right:isSwitchMapRight?switchMapPosLeftOrRight + 'px':'none',
37
- left:!isSwitchMapRight?switchMapPosLeftOrRight + 'px':'none'
38
- }" :bottom-right="isSwitchMapRight"
39
- @changeSwitchMap="changeSwitchMap"
40
- :isDisabled= "isDisabledSwitchMapTabEvent"
41
- /> -->
42
- </div>
8
+ :isShowRangingTool="isShowRangingTool" :initModifyPolygon="initModifyPolygon"
9
+ :isShowDrawTool="isShowDrawTool" :isRight="isRight" :isCrossHair="isCrossHair" :hideAdd="hideAdd"
10
+ :hidePoint="hidePoint" :hideCancel="hideCancel" :hideDelete="hideDelete" :hideSave="hideSave"
11
+ :hideLine="hideLine" :hideArea="hideArea" :isSwitchMap="isSwitchMap" :isSwitchMapRight="isSwitchMapRight"
12
+ :gpsType="lastMapType" @loadDrawPolygonEvent="loadDrawPolygonEvent($event)" @success="drawSuccess($event)"
13
+ @error="drawError($event)">
14
+ <template>
15
+ <slot name="maptool"></slot>
16
+ </template>
17
+ </RyMapTool>
18
+
19
+ <template v-if="map">
20
+ <slot name="polygon" :mapDto="{map,lMap}">
43
21
 
22
+ </slot>
44
23
 
24
+ <slot name="marker" :mapDto="{map,lMap}">
45
25
 
26
+ </slot>
27
+ </template>
28
+ </div>
46
29
  </template>
47
30
  <script>
48
31
  import MapServices from '@/utils/lMapServices.js';
@@ -50,7 +33,6 @@
50
33
  import ViewDto from './../../models/ryMap/view.js';
51
34
  import MapToolDto from './../../models/ryMapTool/mapTool.js';
52
35
  import RyMapTool from '../../ryMapTool/src/index';
53
- // import SwitchMap from '../../switchMap/src/newIndex';
54
36
  import {
55
37
  ViewOptions,
56
38
  fitNew,
@@ -102,9 +84,9 @@
102
84
  m(val) {
103
85
  this.m = val;
104
86
  },
105
- boundaryModel(val){
106
- if(!this.map) return;
107
- }
87
+ boundaryModel(val) {
88
+ if (!this.map) return;
89
+ }
108
90
  },
109
91
  data() {
110
92
  return {
@@ -121,43 +103,6 @@
121
103
  },
122
104
 
123
105
  methods: {
124
- changeSwitchMap({
125
- mapType,
126
- layerType
127
- }) {
128
-
129
- this.lMap.selectMapLayer(mapType, layerType);
130
- this._setMaxZoom(mapType, layerType);
131
- let _mapType = mapType;
132
- if (mapType > 1) {
133
- _mapType = 0;
134
- }
135
- if (this.lastMapType == _mapType) return;
136
-
137
- this.lastMapType = _mapType;
138
-
139
- const center = this.lMap.getCenter();
140
- if (center && center.length) {
141
- if (_mapType == 0) {
142
- const {
143
- lon,
144
- lat
145
- } = GPS.gcj_decrypt(center[0], center[1]);
146
- this.lMap.setCenter([lon, lat]);
147
- } else {
148
- const {
149
- lon,
150
- lat
151
- } = GPS.gcj_encrypt(center[0], center[1]);
152
- this.lMap.setCenter([lon, lat]);
153
- }
154
- }
155
- this.$emit('changeSwitchMap', {
156
- mapType: _mapType,
157
- layerType,
158
- type: mapType
159
- });
160
- },
161
106
  _setMaxZoom(type, layerType) {
162
107
  if (type == 2 || layerType == 0) {
163
108
  this.setMaxZoom(18);
@@ -169,17 +114,30 @@
169
114
  async loadMap(el) {
170
115
  this.lMap.initOfflineMap(100, {
171
116
  el,
172
- urls:this.urls,
117
+ urls: this.urls,
173
118
  callback: ({
174
119
  map,
175
120
  lMap
176
121
  }) => {
177
122
  lMap.setView(this.center, this.bbox);
178
- lMap.getView().fit(this.bbox, [
123
+ const _view = lMap.getView();
124
+ _view.fit(this.bbox, [
179
125
  50, 50, 50, 50
180
126
  ]);
181
- const {geo,width,color} = this.boundaryModel;
182
- lMap.initMapMaskEvent(map.getLayers(), geo,width,color);
127
+ _view.setMaxZoom(this.minZoom);
128
+ _view.setMaxZoom(this.maxZoom);
129
+ // _view.seZoom(this.zoom);
130
+ const {
131
+ geo,
132
+ width,
133
+ color,
134
+ lineDash
135
+ } = this.boundaryModel;
136
+ lMap.initMapMaskEvent(map.getLayers(), geo, {
137
+ width,
138
+ color,
139
+ lineDash
140
+ });
183
141
  }
184
142
  });
185
143
  },