瀏覽代碼

地图优化

wulanhaote
hbao 3 年之前
父節點
當前提交
690db8f897
共有 1 個文件被更改,包括 24 次插入24 次删除
  1. +24
    -24
      src/components/Map/MapGisDrawing.vue

+ 24
- 24
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 {

}


Loading…
取消
儲存