diff --git a/src/components/Map/MapGisDrawing.vue b/src/components/Map/MapGisDrawing.vue index a9c5dbdb..a2c70d31 100644 --- a/src/components/Map/MapGisDrawing.vue +++ b/src/components/Map/MapGisDrawing.vue @@ -137,18 +137,18 @@ 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, // 缩放持续时间,默认不需要设置 - // }); - let resolution = map.getView().getResolutionForExtent([maxXMap, maxYMap, minXMap, minYMap],map.getSize()); - map.getView().fit([maxXMap, maxYMap, minXMap, minYMap]); - map.getView().setResolution(resolution); + //定位查询位置 + 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) =="["){ var zbNew = JSON.stringify({"type": "MultiPolygon", "coordinates": [this.message.replaceAll("\"","")]}); var leftJoin = zbNew.replace("\"[","["); @@ -179,18 +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, // 缩放持续时间,默认不需要设置 - // }); - let resolution = map.getView().getResolutionForExtent([maxXMap, maxYMap, minXMap, minYMap],map.getSize()); - map.getView().fit([maxXMap, maxYMap, minXMap, minYMap]); - map.getView().setResolution(resolution); + //定位查询位置 + var center = ol.extent.getCenter([maxXMap, maxYMap, minXMap, minYMap]); //获取边界区域的中心位置 + map.getView().animate({ + // 只设置需要的属性即可 + center: center, // 中心点 + zoom: 16.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 { }