Ver código fonte

优化组件地图

wulanhaote
hbao 3 anos atrás
pai
commit
2a7a4835d0
1 arquivos alterados com 32 adições e 25 exclusões
  1. +32
    -25
      src/components/Map/MapGisDrawing.vue

+ 32
- 25
src/components/Map/MapGisDrawing.vue Ver arquivo

@@ -137,17 +137,19 @@ export default {
var maxYMap = hc_land.values_.source.featuresRtree_.rbush_.data.maxY;
var minXMap = hc_land.values_.source.featuresRtree_.rbush_.data.minX;
var minYMap = hc_land.values_.source.featuresRtree_.rbush_.data.minY;
//定位查询位置
var center = ol.extent.getCenter([maxXMap, maxYMap, minXMap, minYMap]); //获取边界区域的中心位置
map.getView().animate({
// 只设置需要的属性即可
center: center, // 中心点
zoom: 17.9, // 缩放级别
rotation: undefined, // 缩放完成view视图旋转弧度
duration: 1000, // 缩放持续时间,默认不需要设置
});
// //定位查询位置
// var center = ol.extent.getCenter([maxXMap, maxYMap, minXMap, minYMap]); //获取边界区域的中心位置
// map.getView().animate({
// // 只设置需要的属性即可
// center: center, // 中心点
// zoom: 17.9, // 缩放级别
// rotation: undefined, // 缩放完成view视图旋转弧度
// duration: 1000, // 缩放持续时间,默认不需要设置
// });
let resolution = map.getView().getResolutionForExtent([maxXMap, maxYMap, minXMap, minYMap],map.getSize());
map.getView().fit([maxXMap, maxYMap, minXMap, minYMap]);
map.getView().setResolution(resolution);
} else if(this.message.substring(0,1) =="["){
console.log("6");
var zbNew = JSON.stringify({"type": "MultiPolygon", "coordinates": [this.message.replaceAll("\"","")]});
var leftJoin = zbNew.replace("\"[","[");
var rightJoin = leftJoin.replace("\"]","]");
@@ -177,15 +179,18 @@ export default {
var maxYMap = hc_landFuther.values_.source.featuresRtree_.rbush_.data.maxY;
var minXMap = hc_landFuther.values_.source.featuresRtree_.rbush_.data.minX;
var minYMap = hc_landFuther.values_.source.featuresRtree_.rbush_.data.minY;
//定位查询位置
var center = ol.extent.getCenter([maxXMap, maxYMap, minXMap, minYMap]); //获取边界区域的中心位置
map.getView().animate({
// 只设置需要的属性即可
center: center, // 中心点
zoom: 17.9, // 缩放级别
rotation: undefined, // 缩放完成view视图旋转弧度
duration: 1000, // 缩放持续时间,默认不需要设置
});
// //定位查询位置
// var center = ol.extent.getCenter([maxXMap, maxYMap, minXMap, minYMap]); //获取边界区域的中心位置
// map.getView().animate({
// // 只设置需要的属性即可
// center: center, // 中心点
// zoom: 17.9, // 缩放级别
// rotation: undefined, // 缩放完成view视图旋转弧度
// duration: 1000, // 缩放持续时间,默认不需要设置
// });
let resolution = map.getView().getResolutionForExtent([maxXMap, maxYMap, minXMap, minYMap],map.getSize());
map.getView().fit([maxXMap, maxYMap, minXMap, minYMap]);
map.getView().setResolution(resolution);
} else {

}
@@ -233,12 +238,14 @@ export default {
//还原之前图层
$("#"+this.drawingResetMap).click(function () {
if(that.closeMoule !=null) {
map.removeLayer(vector_drawing);
map.addLayer(hc_landFuther);
map.removeInteraction(draw);
map.addLayer(hc_land);
//map.addLayer(hc_landFuther);
// that.closeMoule = null;
if(this.message.substring(0,1) =="{"){
map.addLayer(hc_land);
map.removeInteraction(draw);
}
if(this.message.substring(0,1) =="["){
map.addLayer(hc_landFuther);
map.removeLayer(vector_drawing);
}
that.formSubmit();
}
});


Carregando…
Cancelar
Salvar