Parcourir la source

地图优化

wulanhaote
hbao il y a 3 ans
Parent
révision
bc33d080d7
2 fichiers modifiés avec 57 ajouts et 44 suppressions
  1. +50
    -39
      src/components/Map/MapGisDrawing.vue
  2. +7
    -5
      src/views/homesteadSurvey/add.vue

+ 50
- 39
src/components/Map/MapGisDrawing.vue Voir le fichier

@@ -146,46 +146,49 @@ export default {
rotation: undefined, // 缩放完成view视图旋转弧度
duration: 1000, // 缩放持续时间,默认不需要设置
});
} 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("\"]","]");
console.log(rightJoin);
hc_landFuther = new ol.layer.Vector({
title: "add Layer",
source: new ol.source.Vector({
projection: projection,
features: new ol.format.GeoJSON().readFeatures("{\n" +
" \"type\": \"Feature\",\n" +
" \"geometry\":" + rightJoin + "}"),
}),
style: new ol.style.Style({
fill: new ol.style.Fill({
//矢量图层填充颜色,以及透明度
color: "rgba(204, 255, 204,0.3)",
}),
stroke: new ol.style.Stroke({
//边界样式
color: "#47c68f",
width: 3,
}),
}),
});
map.addLayer(hc_landFuther);
var maxXMap = hc_landFuther.values_.source.featuresRtree_.rbush_.data.maxX;
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, // 缩放持续时间,默认不需要设置
});
} else {

}
// if(this.message.substring(0,1) =="["){
// var zbNew = JSON.stringify({"type": "MultiPolygon", "coordinates": [[[this.message.replaceAll("\"","")]]]});
// var leftJoin = zbNew.replace("\"[","[");
// var rightJoin = leftJoin.replace("\"]","]");
// hc_landFuther = new ol.layer.Vector({
// title: "add Layer",
// source: new ol.source.Vector({
// projection: projection,
// features: new ol.format.GeoJSON().readFeatures("{\n" +
// " \"type\": \"Feature\",\n" +
// " \"geometry\":" + rightJoin + "}"),
// }),
// style: new ol.style.Style({
// fill: new ol.style.Fill({
// //矢量图层填充颜色,以及透明度
// color: "rgba(204, 255, 204,0.3)",
// }),
// stroke: new ol.style.Stroke({
// //边界样式
// color: "#47c68f",
// width: 3,
// }),
// }),
// });
// map.addLayer(hc_landFuther);
// var maxXMap = hc_landFuther.values_.source.featuresRtree_.rbush_.data.maxX;
// 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, // 缩放持续时间,默认不需要设置
// });
// }
//图层查询定位结束 ---------end
//开始绘制地图
$("#"+this.drawingPolygonMap).click(function () {
@@ -209,6 +212,10 @@ export default {
var feature = evt.feature;
var geometry = feature.getGeometry();
var coordinate = geometry.getCoordinates();
if(coordinate !="" && coordinate !=null){
//map.addLayer(vector_drawing);
map.removeInteraction(draw);
}
that.closeMoule = coordinate;
that.formSubmit();
});
@@ -314,6 +321,10 @@ export default {
var feature = evt.feature;
var geometry = feature.getGeometry();
var coordinate = geometry.getCoordinates();
if(coordinate !="" && coordinate !=null){
//map.addLayer(vector_drawing);
map.removeInteraction(draw);
}
that.closeMoule = coordinate;
that.formSubmit();
});


+ 7
- 5
src/views/homesteadSurvey/add.vue Voir le fichier

@@ -20,7 +20,7 @@
margin: 20px;margin-top:-70px;">
<van-row>
<van-col span="4" :offset="1" style="text-align:center;" @click="active=1">
<van-icon :name="require('../../assets/images/housesteadSurvey/zjd'+(active==1?'A':'D')+'.png')" size="80px" style="margin-top:0px;"/>
<van-icon :name="require('../../assets/images/housesteadSurvey/zjd'+(active==1?'A':'D')+'.png')" size="80px" @click="mapClickLoading" style="margin-top:0px;"/>
<p :style="{color:(active==1?'rgb(34, 183, 242)':'#000')}">宅基地</p>
</van-col>
<van-col span="2">
@@ -34,14 +34,14 @@
<div style=" height: 2px; border: 2px dashed #b5b4b4;margin-top: 40px;"></div>
</van-col>
<van-col span="4" style="text-align:center;" @click="active=3,getZrzList()">
<van-icon :name="require('../../assets/images/housesteadSurvey/fwxx'+(active==3?'A':'D')+'.png')" size="80px" style="margin-top:0px;"/>
<van-icon :name="require('../../assets/images/housesteadSurvey/fwxx'+(active==3?'A':'D')+'.png')" size="80px" @click="mapClickLoading" style="margin-top:0px;"/>
<p :style="{color:(active==3?'rgb(34, 183, 242)':'#000')}">房屋信息</p>
</van-col>
<van-col span="2">
<div style=" height: 2px; border: 2px dashed #b5b4b4;margin-top: 40px;"></div>
</van-col>
<van-col span="4" style="text-align:center;" @click="active=4,getFsssList()">
<van-icon :name="require('../../assets/images/housesteadSurvey/fsss'+(active==4?'A':'D')+'.png')" size="80px" style="margin-top:0px;"/>
<van-icon :name="require('../../assets/images/housesteadSurvey/fsss'+(active==4?'A':'D')+'.png')" size="80px" @click="mapClickLoading" style="margin-top:0px;"/>
<p :style="{color:(active==4?'rgb(34, 183, 242)':'#000')}">附属设施</p>
</van-col>
</van-row>
@@ -785,7 +785,7 @@
label="备注"
placeholder="备注"
/>
<MapGisDrawing ref="drewingClickLoading" :message="form.theGeom" v-on:formSubmit="MapTag"></MapGisDrawing>
<MapGisDrawing ref="drewingClickLoading" :message="form3.theGeom" v-on:formSubmit="MapTag"></MapGisDrawing>
<div style="margin: 16px;">
<van-button round block color="#7AC943" native-type="submit">保存</van-button>
</div>
@@ -1624,7 +1624,7 @@
label="备注"
placeholder="备注"
/>
<MapGisDrawing ref="drewingClickLoading" :message="form.theGeom" v-on:formSubmit="MapTag"></MapGisDrawing>
<MapGisDrawing ref="drewingClickLoading" :message="form4.theGeom" v-on:formSubmit="MapTag"></MapGisDrawing>
<div style="margin: 16px;">
<van-button round block color="#7AC943" native-type="submit">保存</van-button>
</div>
@@ -2817,8 +2817,10 @@
changeActiveBack(){
if(this.active>1){
this.active-=1
this.mapClickLoading();
}else{
this.active=1
this.mapClickLoading();
}
},
searchCommit(){


Chargement…
Annuler
Enregistrer