cd-mapgis 1.0.55 → 1.0.57
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.
- package/package.json +1 -1
- package/src/MapView.js +7 -0
- package/src/OM.js +4 -0
- package/src/SwipeUtil.js +3 -3
package/package.json
CHANGED
package/src/MapView.js
CHANGED
|
@@ -23,6 +23,7 @@ export default class MapView {
|
|
|
23
23
|
this.viewLayers = [];
|
|
24
24
|
//所有的geoServer图层列表
|
|
25
25
|
this.geoServerLayers = [];
|
|
26
|
+
this._reset_bounds = null;//复位窗口范围
|
|
26
27
|
|
|
27
28
|
this._view_templayer = null;
|
|
28
29
|
this._init(this.params);
|
|
@@ -231,4 +232,10 @@ export default class MapView {
|
|
|
231
232
|
this.swipeUtil = null;
|
|
232
233
|
}
|
|
233
234
|
}
|
|
235
|
+
//复位
|
|
236
|
+
reSet() {
|
|
237
|
+
if (this._reset_bounds) {
|
|
238
|
+
this.map.getView().fit(this._reset_bounds, this.map.getSize());
|
|
239
|
+
}
|
|
240
|
+
}
|
|
234
241
|
}
|
package/src/OM.js
CHANGED
|
@@ -149,6 +149,9 @@ export default class OM {
|
|
|
149
149
|
layers.forEach(function (layer) {
|
|
150
150
|
map.removeLayer(layer); // 移除每个图层
|
|
151
151
|
});
|
|
152
|
+
mapView.layerGroup = [];
|
|
153
|
+
mapView.viewLayers = [];
|
|
154
|
+
mapView.geoServerLayers = [];
|
|
152
155
|
}
|
|
153
156
|
//先加载后端默认加载的图层
|
|
154
157
|
let mapKey = (p.comm && p.comm.mapKey) ? p.comm.mapKey : 'def_view_layers';
|
|
@@ -276,6 +279,7 @@ export default class OM {
|
|
|
276
279
|
let mapView = mapViews[k];
|
|
277
280
|
let map = mapView.map;
|
|
278
281
|
map.getView().fit(bounds, map.getSize());
|
|
282
|
+
mapView._reset_bounds = bounds;
|
|
279
283
|
}
|
|
280
284
|
}
|
|
281
285
|
}
|
package/src/SwipeUtil.js
CHANGED
|
@@ -26,7 +26,7 @@ export default class SwipeUtil {
|
|
|
26
26
|
let layer_event_precompose;//图层在地图渲染之前事件
|
|
27
27
|
let layer_event_postcompose;//图层在地图渲染之后事件
|
|
28
28
|
//注册鼠标在地图上按下事件
|
|
29
|
-
map_event_pointerdown = _map.on('pointerdown', function (e) {
|
|
29
|
+
this.map_event_pointerdown = _map.on('pointerdown', function (e) {
|
|
30
30
|
pixel = e.pixel;
|
|
31
31
|
//图层在地图渲染之前触发
|
|
32
32
|
layer_event_precompose = layer.on('precompose', function (event) {
|
|
@@ -62,7 +62,7 @@ export default class SwipeUtil {
|
|
|
62
62
|
_mapView.dragPan(false);
|
|
63
63
|
});
|
|
64
64
|
//注册鼠标在地图上弹起事件
|
|
65
|
-
map_event_pointerup = _map.on('pointerup', function (e) {
|
|
65
|
+
this.map_event_pointerup = _map.on('pointerup', function (e) {
|
|
66
66
|
//移除图层的事件
|
|
67
67
|
layer.un(layer_event_precompose.type, layer_event_precompose.listener);
|
|
68
68
|
layer.un(layer_event_postcompose.type, layer_event_postcompose.listener);
|
|
@@ -72,7 +72,7 @@ export default class SwipeUtil {
|
|
|
72
72
|
_mapView.dragPan(true);
|
|
73
73
|
});
|
|
74
74
|
//注册鼠标在地图上移动事件
|
|
75
|
-
map_event_pointermove = _map.on('pointermove', (e) => {
|
|
75
|
+
this.map_event_pointermove = _map.on('pointermove', (e) => {
|
|
76
76
|
pixel = e.pixel;
|
|
77
77
|
_map.render();
|
|
78
78
|
});
|