| @@ -137,17 +137,19 @@ export default { | |||||
| var maxYMap = hc_land.values_.source.featuresRtree_.rbush_.data.maxY; | var maxYMap = hc_land.values_.source.featuresRtree_.rbush_.data.maxY; | ||||
| var minXMap = hc_land.values_.source.featuresRtree_.rbush_.data.minX; | var minXMap = hc_land.values_.source.featuresRtree_.rbush_.data.minX; | ||||
| var minYMap = hc_land.values_.source.featuresRtree_.rbush_.data.minY; | 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) =="["){ | } else if(this.message.substring(0,1) =="["){ | ||||
| console.log("6"); | |||||
| var zbNew = JSON.stringify({"type": "MultiPolygon", "coordinates": [this.message.replaceAll("\"","")]}); | var zbNew = JSON.stringify({"type": "MultiPolygon", "coordinates": [this.message.replaceAll("\"","")]}); | ||||
| var leftJoin = zbNew.replace("\"[","["); | var leftJoin = zbNew.replace("\"[","["); | ||||
| var rightJoin = leftJoin.replace("\"]","]"); | var rightJoin = leftJoin.replace("\"]","]"); | ||||
| @@ -177,15 +179,18 @@ export default { | |||||
| var maxYMap = hc_landFuther.values_.source.featuresRtree_.rbush_.data.maxY; | var maxYMap = hc_landFuther.values_.source.featuresRtree_.rbush_.data.maxY; | ||||
| var minXMap = hc_landFuther.values_.source.featuresRtree_.rbush_.data.minX; | var minXMap = hc_landFuther.values_.source.featuresRtree_.rbush_.data.minX; | ||||
| var minYMap = hc_landFuther.values_.source.featuresRtree_.rbush_.data.minY; | 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 { | } else { | ||||
| } | } | ||||
| @@ -233,12 +238,14 @@ export default { | |||||
| //还原之前图层 | //还原之前图层 | ||||
| $("#"+this.drawingResetMap).click(function () { | $("#"+this.drawingResetMap).click(function () { | ||||
| if(that.closeMoule !=null) { | 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(); | that.formSubmit(); | ||||
| } | } | ||||
| }); | }); | ||||