diff --git a/src/views/sunVillage_info/assetMapOpen.vue b/src/views/sunVillage_info/assetMapOpen.vue index fe849ded..edf6c7dc 100644 --- a/src/views/sunVillage_info/assetMapOpen.vue +++ b/src/views/sunVillage_info/assetMapOpen.vue @@ -616,21 +616,18 @@ }); //判断当前账套是否有数据 var mapTalkAbout = true; - //图层查询固定资产定位开始 ---------start - if(this.mapTheGeomId.length >0) { - for (var i = 0; this.mapTheGeomId.length > i; i++) { - if (this.mapTheGeomId[i] != null && this.mapTheGeomId[i].theGeom != null && this.mapTheGeomId[i].theGeom != "") { + //图层查询资源性资产定位开始 ---------start + if(this.mapTheGeomResourceId.length >0) { + for (var i = 0; this.mapTheGeomResourceId.length > i; i++) { + if (this.mapTheGeomResourceId[i] !=null && this.mapTheGeomResourceId[i].theGeom != null && this.mapTheGeomResourceId[i].theGeom != "") { mapTalkAbout =false; - var theGeomMap = this.mapTheGeomId[i].theGeom.replace("Point", "MultiPolygon"); - var pointLeft = theGeomMap.replace("[", "[[[["); - var pointRight = pointLeft.replace("]", "]]]]"); hc_land = 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\":" + pointRight +", \"properties\":" + JSON.stringify(this.mapTheGeomId[i]) + "}"), + " \"geometry\":" + this.mapTheGeomResourceId[i].theGeom + ", \"properties\":" + JSON.stringify(this.mapTheGeomResourceId[i]) + "}"), }), style: new ol.style.Style({ fill: new ol.style.Fill({ @@ -651,18 +648,6 @@ var minYMap = hc_land.values_.source.featuresRtree_.rbush_.data.minY; //定位查询位置 var center = ol.extent.getCenter([maxXMap, maxYMap, minXMap, minYMap]); //获取边界区域的中心位置 - var newcenterFeature = new ol.Feature({ - geometry: new ol.geom.Point(center), //几何信息 - name: "标注点", - properties: hc_land.values_.source.featuresRtree_.rbush_.data.children - }); - var sourceMapLook = new ol.source.Vector({wrapX: false}); - vector_drawing = new ol.layer.Vector({ - source: sourceMapLook, - }); - map.addLayer(vector_drawing); - newcenterFeature.setStyle(createLabelStyle()); //设置要素样式 - sourceMapLook.addFeature(newcenterFeature); map.getView().animate({ // 只设置需要的属性即可 center: center, // 中心点 @@ -673,19 +658,22 @@ } } } - //图层查询固定资产定位结束 ---------end - //图层查询资源性资产定位开始 ---------start - if(this.mapTheGeomResourceId.length >0) { - for (var i = 0; this.mapTheGeomResourceId.length > i; i++) { - if (this.mapTheGeomResourceId[i] !=null && this.mapTheGeomResourceId[i].theGeom != null && this.mapTheGeomResourceId[i].theGeom != "") { + //图层查询资源性资产定位开始 ---------end + //图层查询固定资产定位开始 ---------start + if(this.mapTheGeomId.length >0) { + for (var i = 0; this.mapTheGeomId.length > i; i++) { + if (this.mapTheGeomId[i] != null && this.mapTheGeomId[i].theGeom != null && this.mapTheGeomId[i].theGeom != "") { mapTalkAbout =false; + var theGeomMap = this.mapTheGeomId[i].theGeom.replace("Point", "MultiPolygon"); + var pointLeft = theGeomMap.replace("[", "[[[["); + var pointRight = pointLeft.replace("]", "]]]]"); hc_land = 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\":" + this.mapTheGeomResourceId[i].theGeom + ", \"properties\":" + JSON.stringify(this.mapTheGeomResourceId[i]) + "}"), + " \"geometry\":" + pointRight +", \"properties\":" + JSON.stringify(this.mapTheGeomId[i]) + "}"), }), style: new ol.style.Style({ fill: new ol.style.Fill({ @@ -706,6 +694,18 @@ var minYMap = hc_land.values_.source.featuresRtree_.rbush_.data.minY; //定位查询位置 var center = ol.extent.getCenter([maxXMap, maxYMap, minXMap, minYMap]); //获取边界区域的中心位置 + var newcenterFeature = new ol.Feature({ + geometry: new ol.geom.Point(center), //几何信息 + name: "标注点", + properties: hc_land.values_.source.featuresRtree_.rbush_.data.children + }); + var sourceMapLook = new ol.source.Vector({wrapX: false}); + vector_drawing = new ol.layer.Vector({ + source: sourceMapLook, + }); + map.addLayer(vector_drawing); + newcenterFeature.setStyle(createLabelStyle()); //设置要素样式 + sourceMapLook.addFeature(newcenterFeature); map.getView().animate({ // 只设置需要的属性即可 center: center, // 中心点 @@ -716,7 +716,7 @@ } } } - //图层查询资源性资产定位开始 ---------end + //图层查询固定资产定位结束 ---------end //点击查询详细信息 map.on("singleclick", function (evt) { let feature = map.forEachFeatureAtPixel(