diff --git a/src/views/homesteadSurvey/list.vue b/src/views/homesteadSurvey/list.vue index 0313db29..511748f1 100644 --- a/src/views/homesteadSurvey/list.vue +++ b/src/views/homesteadSurvey/list.vue @@ -3784,6 +3784,7 @@ // } // }); console.log(obj.id); + var vector_drawing_map; let params = { "deptId" : that.$cookies.get("item").deptId, "zjddm" : obj.zjddm, @@ -3813,33 +3814,6 @@ style: styleZjd }); - // function createLabelStyle() { - // return new ol.style.Style({ - // text: new ol.style.Text({ - // text: that.textMjAll+"㎡", - // textAlign: "center", //位置 - // textBaseline: "middle", //基准线 - // font: "normal 12px 微软雅黑", //文字样式 - // //text: "标注点", //文本内容 - // fill: new ol.style.Fill({ - // //文本填充样式(即文字颜色) - // color: "#FFFFFF", - // width: 10, - // }), - // overflow: false //超出面的部分不显示 - // }), - // zIndex: 9999, - // }); - // } - // var newcenterFeatureMap = new ol.Feature({ - // geometry: new ol.geom.Point(that.clickBbox), //几何信息 - // //name: "标注点", - // }); - // var sourceMapLook = new ol.source.Vector({wrapX: false}); - // vector_drawing_delete = new ol.layer.Vector({ - // source: sourceMapLook, - // }); - // map.addLayer(vector_drawing_delete); map.addLayer(hc_land_on); var maxXMap = hc_land_on.values_.source.featuresRtree_.rbush_.data.maxX; var maxYMap = hc_land_on.values_.source.featuresRtree_.rbush_.data.maxY; @@ -3854,6 +3828,35 @@ rotation: undefined, // 缩放完成view视图旋转弧度 duration: 1000, // 缩放持续时间,默认不需要设置 }); + function createLabelStyleMap() { + return new ol.style.Style({ + text: new ol.style.Text({ + text: that.mapZjdData.syqr, + textAlign: "center", //位置 + textBaseline: "middle", //基准线 + font: "normal 16px 微软雅黑", //文字样式 + //text: "标注点", //文本内容 + fill: new ol.style.Fill({ + //文本填充样式(即文字颜色) + color: "#0099FF", + width: 10, + }), + overflow: false //超出面的部分不显示 + }), + zIndex: 9999, + }); + } + var newcenterFeatureMap = new ol.Feature({ + geometry: new ol.geom.Point(center), //几何信息 + //name: "标注点", + }); + var sourceMapLookMap = new ol.source.Vector({wrapX: false}); + vector_drawing_map = new ol.layer.Vector({ + source: sourceMapLookMap, + }); + map.addLayer(vector_drawing_map); + newcenterFeatureMap.setStyle(createLabelStyleMap()); //设置要素样式 + sourceMapLookMap.addFeature(newcenterFeatureMap); }); //let cloneObj = JSON.parse(JSON.stringify(obj)); if(obj.zdmj != ""){