-
全选
+
全选
-
+
- 附属设施
+ 附属设施
-
+
- 自然幢
+ 自然幢
-
+
- 宅基地
+ 宅基地
@@ -820,6 +824,9 @@
mapVillageList: null,
coordinate:"",
checked:[],
+ checkAllFlag: false,//全选判断标识
+ CheckedAllArr: [],//全选数组
+ dataList:[],
//地图使用 --end
};
},
@@ -1076,37 +1083,43 @@
onConfirm(){},
onSubmit(){},
mapShow() {
+ //通过数据直接查询方式--------加载较慢 start
//镇边界获取
- listTown().then(response => {
- if (response.code == 200) {
- this.mapTownList = response.rows;
- //村边界获取
- listVillage(this.queryParams).then(response => {
- this.mapVillageList = response.rows;
- listZjdzd().then((response) => {
- if (response.code == 200) {
- this.mapTheGeomZjdId= response.rows;
- listZrz().then((response) => {
- if (response.code == 200) {
- this.mapTheGeomZrzId = response.rows;
- listFsss().then((response) => {
- if (response.code == 200) {
- this.mapTheGeomFsssId = response.rows;
- }
- setTimeout(() => {
- this.GetMapsInit();
- }, 300);
- });
- }
- });
- }
- });
- });
- }
- });
+ // listTown().then(response => {
+ // if (response.code == 200) {
+ // this.mapTownList = response.rows;
+ // //村边界获取
+ // listVillage(this.queryParams).then(response => {
+ // this.mapVillageList = response.rows;
+ // listZjdzd().then((response) => {
+ // if (response.code == 200) {
+ // this.mapTheGeomZjdId= response.rows;
+ // listZrz().then((response) => {
+ // if (response.code == 200) {
+ // this.mapTheGeomZrzId = response.rows;
+ // listFsss().then((response) => {
+ // if (response.code == 200) {
+ // this.mapTheGeomFsssId = response.rows;
+ // }
+ // setTimeout(() => {
+ // this.GetMapsInit();
+ // }, 300);
+ // });
+ // }
+ // });
+ // }
+ // });
+ // });
+ // }
+ // });
+ //通过数据直接查询方式--------加载较慢 end
+ setTimeout(() => {
+ this.GetMapsInit();
+ }, 300);
},
//地图加载 -----start
GetMapsInit() {
+
//加载地图编辑
var that = this;
var map;
@@ -1136,6 +1149,7 @@
isGroup: true,
name: "天地图文字标注--卫星影像图",
});
+
//加载地图
map = new ol.Map({
controls: ol.control.defaults({attribution: false, zoom: false, rotate: false}).extend([]), //隐藏放大缩小按钮
@@ -1144,305 +1158,424 @@
target: "mapWrapAll",
view: new ol.View({
//center: ol.proj.fromLonLat([115.452752, 31.789033]),
- zoom: 15,
- minZoom: 0, //地图缩小限制
+ //center: ol.proj.fromLonLat([115.452752, 31.789033]),
+ zoom: 10,
+ minZoom: 5, //地图缩小限制
maxZoom: 18.3, //地图放大限制
}),
});
- //判断当前账套是否有数据
- var mapTalkAbout = true;
- //获取镇界线----start
- if(this.mapTownList.length >0){
- for (var i = 0; this.mapTownList.length > i; i++) {
- if (this.mapTownList[i] != null && this.mapTownList[i].theGeom != null && this.mapTownList[i].theGeom != "") {
- mapTalkAbout =false;
- this.mapTownList[i].createBy = 'mapTownList';
- var theGeomLine= this.mapTownList[i].theGeom.replaceAll("MultiPolygon","LineString");
- theGeomLine = theGeomLine.replaceAll("[[[[","[[");
- theGeomLine = theGeomLine.replaceAll("]]]]","]]");
- 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\":" + theGeomLine + ", \"properties\":" + JSON.stringify(this.mapTownList[i]) + "}"),
- }),
- style: new ol.style.Style({
- fill: new ol.style.Fill({
- //矢量图层填充颜色,以及透明度
- color: "#AE57A4",
- }),
- stroke: new ol.style.Stroke({
- //边界样式
- color: "#FF0000",
- width: 3,
- }),
- // text: new ol.style.Text({
- // text: this.mapTownList[i].xzqmc,
- // font: '30px sans-serif',
- // textAlign: "center",
- // textBaseline: "middle",
- // //font: 'verdana',
- // fill: new ol.style.Fill({
- // color: "#ff0000"
- // }),
- // // backgroundFill: new ol.style.Fill({
- // // color: "#ff0000"
- // // }),
- // font: "30px sans-serif",
- // stroke: new ol.style.Stroke({
- // color: "#ffffff"
- // // width: 3
- // }),
- // offsetX: parseInt(0, 10),
- // offsetY: parseInt(0, 10),
- // placement: "line", //point 则自动计算面的中心k点然后标注 line 则根据面要素的边进行标注
- // overflow: false //超出面的部分不显示
- //}),
- }),
- });
- map.addLayer(hc_land);
- //console.log(hc_land.values_.source.featuresRtree_.rbush_.data);
- var maxXMap = hc_land.values_.source.featuresRtree_.rbush_.data.maxX;
- 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]); //获取边界区域的中心位置
- // console.log(center);
- map.getView().animate({
- // 只设置需要的属性即可
- center: center, // 中心点
- zoom: 9.8, // 缩放级别
- rotation: undefined, // 缩放完成view视图旋转弧度
- duration: 1000, // 缩放持续时间,默认不需要设置
- });
- }
- }
- }
- //获取镇界线----end
- //获取村界线----start
- if(this.mapVillageList.length >0){
- for (var i = 0; this.mapVillageList.length > i; i++) {
- if (this.mapVillageList[i] != null && this.mapVillageList[i].theGeom != null && this.mapVillageList[i].theGeom != "") {
- mapTalkAbout =false;
- this.mapVillageList[i].createBy = 'mapVillageList';
- var theGeomLine= this.mapVillageList[i].theGeom.replaceAll("MultiPolygon","LineString");
- theGeomLine = theGeomLine.replaceAll("[[[[","[[");
- theGeomLine = theGeomLine.replaceAll("]]]]","]]");
- 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\":" + theGeomLine + ", \"properties\":" + JSON.stringify(this.mapVillageList[i]) + "}"),
- }),
- style: new ol.style.Style({
- fill: new ol.style.Fill({
- //矢量图层填充颜色,以及透明度
- color: "#AE57A4",
- }),
- stroke: new ol.style.Stroke({
- //边界样式
- color: "#ff00ff",
- width: 3,
- }),
- // text: new ol.style.Text({
- // text: this.mapVillageList[i].dcmj,
- // font: '30px sans-serif',
- // textAlign: "center",
- // textBaseline: "middle",
- // //font: 'verdana',
- // fill: new ol.style.Fill({
- // color: "#ff00ff"
- // }),
- // // backgroundFill: new ol.style.Fill({
- // // color: "#ff0000"
- // // }),
- // font: "30px sans-serif",
- // stroke: new ol.style.Stroke({
- // color: "#ffffff"
- // // width: 3
- // }),
- // offsetX: parseInt(0, 10),
- // offsetY: parseInt(0, 10),
- // placement: "line", //point 则自动计算面的中心k点然后标注 line 则根据面要素的边进行标注
- // overflow: false //超出面的部分不显示
- // }),
- }),
- });
- map.addLayer(hc_land);
- }
- }
- }
- // //获取村界线----end
- //宅基地定位开始 ---------start
- if(this.mapTheGeomZjdId.length >0) {
- for (var i = 0; this.mapTheGeomZjdId.length > i; i++) {
- if (this.mapTheGeomZjdId[i] !=null && this.mapTheGeomZjdId[i].theGeom != null && this.mapTheGeomZjdId[i].theGeom != "") {
- mapTalkAbout =false;
- this.mapTheGeomZjdId[i].createBy = 'mapTheGeomZjdId';
- var styleYqr = "";
- if(this.mapTheGeomZjdId[i].houseDataConfirmStatus == "CONFIRMED"){
- styleYqr = new ol.style.Style({
- fill: new ol.style.Fill({
- //矢量图层填充颜色,以及透明度
- color: "#AE57A4",
- }),
- stroke: new ol.style.Stroke({
- //边界样式
- color: "#28FF28",
- width: 3,
- }),
- });
- } else {
- styleYqr = new ol.style.Style({
- fill: new ol.style.Fill({
- //矢量图层填充颜色,以及透明度
- color: "#AE57A4",
- }),
- stroke: new ol.style.Stroke({
- //边界样式
- color: "rgba(255, 45, 45,1)",
- width: 3,
- }),
- });
- }
- 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.mapTheGeomZjdId[i].theGeom + ", \"properties\":" + JSON.stringify(this.mapTheGeomZjdId[i]) + "}"),
- }),
- style: styleYqr
- });
- map.addLayer(hc_land);
- // var maxXMap = hc_land.values_.source.featuresRtree_.rbush_.data.maxX;
- // 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: 15.8, // 缩放级别
- // rotation: undefined, // 缩放完成view视图旋转弧度
- // duration: 1000, // 缩放持续时间,默认不需要设置
- // });
- //自然幢定位开始 ---------start
- getZrzZjdDmList(this.mapTheGeomZjdId[i].zjddm).then((response) => {
- if (response.code == 200) {
- this.mapTheGeomZrzId = response.data;
- if(this.mapTheGeomZrzId.length >0) {
- for (var i = 0; this.mapTheGeomZrzId.length > i; i++) {
- if (this.mapTheGeomZrzId[i] !=null && this.mapTheGeomZrzId[i].theGeom != null && this.mapTheGeomZrzId[i].theGeom != "") {
- this.mapTheGeomZrzId[i].createBy = 'mapTheGeomZrzId';
- var styleZrz = "";
- if(this.mapTheGeomZjdId[i].houseDataConfirmStatus == "CONFIRMED"){
- styleZrz = new ol.style.Style({
- fill: new ol.style.Fill({
- //矢量图层填充颜色,以及透明度
- color: "#FFD306",
- }),
- stroke: new ol.style.Stroke({
- //边界样式
- color: "#28FF28",
- width: 3,
- }),
- });
- } else {
- styleZrz = new ol.style.Style({
- fill: new ol.style.Fill({
- //矢量图层填充颜色,以及透明度
- color: "#FFD306",
- }),
- stroke: new ol.style.Stroke({
- //边界样式
- color: "rgba(255, 45, 45,1)",
- width: 3,
- }),
- });
- }
- 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.mapTheGeomZrzId[i].theGeom + ", \"properties\":" + JSON.stringify(this.mapTheGeomZrzId[i]) + "}"),
- }),
- style: styleZrz
- });
- map.addLayer(hc_land);
- }
- }
- }
- }
- });
- //自然幢定位结束 ---------end
- //附属设施定位开始 ---------start
- getFsssZjdDmList(this.mapTheGeomZjdId[i].zjddm).then((response) => {
- if (response.code == 200) {
- this.mapTheGeomFsssId = response.data;
- if(this.mapTheGeomFsssId.length >0) {
- for (var i = 0; this.mapTheGeomFsssId.length > i; i++) {
- if (this.mapTheGeomFsssId[i] !=null && this.mapTheGeomFsssId[i].theGeom != null && this.mapTheGeomFsssId[i].theGeom != "") {
- this.mapTheGeomFsssId[i].createBy = 'mapTheGeomFsssId';
- var styleFsss = "";
- if(this.mapTheGeomZjdId[i].houseDataConfirmStatus == "CONFIRMED"){
- styleFsss = new ol.style.Style({
- fill: new ol.style.Fill({
- //矢量图层填充颜色,以及透明度
- color: "#00FFFF",
- }),
- stroke: new ol.style.Stroke({
- //边界样式
- color: "#28FF28",
- width: 3,
- }),
- });
- } else {
- styleFsss = new ol.style.Style({
- fill: new ol.style.Fill({
- //矢量图层填充颜色,以及透明度
- color: "#00FFFF",
- }),
- stroke: new ol.style.Stroke({
- //边界样式
- color: "rgba(255, 45, 45,1)",
- width: 3,
- }),
- });
- }
- 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.mapTheGeomFsssId[i].theGeom + ", \"properties\":" + JSON.stringify(this.mapTheGeomFsssId[i]) + "}"),
- }),
- style: styleFsss
- });
- map.addLayer(hc_land);
- }
- }
- }
- }
- });
- //附属设施定位结束 ---------end
- }
- }
+ //使用geoserver服务查询开始 -------------------start
+ //镇边界查询开始 ------------------------------start
+ // var zhenTc= new ol.layer.Tile({
+ // source: new ol.source.TileWMS({
+ // url: "http://116.255.223.226:8080/geoserver/zjd_dc/wms",
+ // params: {
+ // LAYERS: 'zjd_dc:t_house_survey_border_town',
+ // TILED: true,
+ // //cql_filter: cql_filter,
+ // SRID: 3857,
+ // },
+ // }),
+ // });
+ // map.addLayer(zhenTc);
+ //镇边界查询开始 ------------------------------end
+ //村边界查询开始 ------------------------------start
+ var cunTc= new ol.layer.Tile({
+ source: new ol.source.TileWMS({
+ url: "http://116.255.223.226:8080/geoserver/zjd_dc/wms",
+ params: {
+ LAYERS: 'zjd_dc:t_house_survey_border_village',
+ TILED: true,
+ //cql_filter: cql_filter,
+ SRID: 3857,
+ },
+ }),
+ });
+ //定位查询位置
+ let param_dw = {
+ srsName: "EPSG:3857",
+ service: "WFS",
+ version: "1.0.0",
+ request: "GetFeature",
+ typename: "zjd_dc:t_house_survey_border_village",
+ //featureNS: 'nsgk_hc',//命名空间 URI
+ //cql_filter: cql_filter,
+ //featurePrefix: 'nationalwater',//工作区名称
+ //featureTypes: ['nationalwater:01fir'],//查询图层,可以是同一个工作区下多个图层,逗号隔开
+ outputFormat: "application/json",
+ //filter: ol.format.filter.equalTo(t,e,r)//前者是属性名,后者是对应值
+ };
+ let url_dw = "http://116.255.223.226:8080/geoserver/zjd_dc/wfs"; //wfsurl;
+ url_dw = url_dw + "?";
+ for (let key in param_dw) {
+ url_dw = url_dw + key + "=" + param_dw[key] + "&";
}
- //宅基地定位结束 ---------end
+ url_dw = url_dw.substr(0, url_dw.length - 1);
+ fetch(url_dw, {
+ method: "POST", // *GET, POST, PUT, DELETE, etc.
+ })
+ .then((res) => {
+ var geojsonmap = res.json();
+ return geojsonmap;
+ })
+ .then((data) => {
+ let resolution = map.getView().getResolutionForExtent(data.bbox,map.getSize());
+ map.getView().fit(data.bbox);
+ map.getView().setResolution(resolution);
+ // var datamap = data.bbox;
+ // var center = ol.extent.getCenter(datamap);
+ // map.getView().animate({
+ // // 只设置需要的属性即可
+ // center: center, // 中心点
+ // rotation: undefined, // 缩放完成view视图旋转弧度
+ // });
+ })
+ .catch((error) => {
+ console.log("【异常】", error);
+ });
+ map.addLayer(cunTc);
+ //村边界查询开始 ------------------------------end
+ //宅基地图层查询开始 ------------------start
+ var zjdTc= new ol.layer.Tile({
+ source: new ol.source.TileWMS({
+ url: "http://116.255.223.226:8080/geoserver/zjd_dc/wms",
+ params: {
+ LAYERS: 'zjd_dc:t_house_survey_zjdzd',
+ TILED: true,
+ //cql_filter: cql_filter,
+ SRID: 3857,
+ },
+ }),
+ });
+ map.addLayer(zjdTc);
+ //宅基地图层查询开始 ------------------start
+
+ //自然幢图层查询开始 ------------------start
+ var zraTc= new ol.layer.Tile({
+ source: new ol.source.TileWMS({
+ url: "http://116.255.223.226:8080/geoserver/zjd_dc/wms",
+ params: {
+ LAYERS: 'zjd_dc:t_house_survey_zrz',
+ TILED: true,
+ SRID: 3857,
+ },
+ }),
+ });
+ map.addLayer(zraTc);
+ //自然幢图层查询开始 ------------------start
+
+ //附属设施图层查询开始 ------------------start
+ var fsssTc= new ol.layer.Tile({
+ source: new ol.source.TileWMS({
+ url: "http://116.255.223.226:8080/geoserver/zjd_dc/wms",
+ params: {
+ LAYERS: 'zjd_dc:t_house_survey_fsss',
+ TILED: true,
+ SRID: 3857,
+ },
+ }),
+ });
+ map.addLayer(fsssTc);
+ //附属设施图层查询开始 ------------------start
+ //使用geoserver服务查询开始 -------------------end
+ //数据库直接加载数据渲染方式---------------------------------------------------start
+ //判断当前账套是否有数据
+ // var mapTalkAbout = true;
+ // //获取镇界线----start
+ // if(this.mapTownList.length >0){
+ // for (var i = 0; this.mapTownList.length > i; i++) {
+ // if (this.mapTownList[i] != null && this.mapTownList[i].theGeom != null && this.mapTownList[i].theGeom != "") {
+ // mapTalkAbout =false;
+ // this.mapTownList[i].createBy = 'mapTownList';
+ // var theGeomLine= this.mapTownList[i].theGeom.replaceAll("MultiPolygon","LineString");
+ // theGeomLine = theGeomLine.replaceAll("[[[[","[[");
+ // theGeomLine = theGeomLine.replaceAll("]]]]","]]");
+ // 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\":" + theGeomLine + ", \"properties\":" + JSON.stringify(this.mapTownList[i]) + "}"),
+ // }),
+ // style: new ol.style.Style({
+ // fill: new ol.style.Fill({
+ // //矢量图层填充颜色,以及透明度
+ // color: "#AE57A4",
+ // }),
+ // stroke: new ol.style.Stroke({
+ // //边界样式
+ // color: "#FF0000",
+ // width: 3,
+ // }),
+ // // text: new ol.style.Text({
+ // // text: this.mapTownList[i].xzqmc,
+ // // font: '30px sans-serif',
+ // // textAlign: "center",
+ // // textBaseline: "middle",
+ // // //font: 'verdana',
+ // // fill: new ol.style.Fill({
+ // // color: "#ff0000"
+ // // }),
+ // // // backgroundFill: new ol.style.Fill({
+ // // // color: "#ff0000"
+ // // // }),
+ // // font: "30px sans-serif",
+ // // stroke: new ol.style.Stroke({
+ // // color: "#ffffff"
+ // // // width: 3
+ // // }),
+ // // offsetX: parseInt(0, 10),
+ // // offsetY: parseInt(0, 10),
+ // // placement: "line", //point 则自动计算面的中心k点然后标注 line 则根据面要素的边进行标注
+ // // overflow: false //超出面的部分不显示
+ // //}),
+ // }),
+ // });
+ // map.addLayer(hc_land);
+ // //console.log(hc_land.values_.source.featuresRtree_.rbush_.data);
+ // var maxXMap = hc_land.values_.source.featuresRtree_.rbush_.data.maxX;
+ // 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]); //获取边界区域的中心位置
+ // // console.log(center);
+ // map.getView().animate({
+ // // 只设置需要的属性即可
+ // center: center, // 中心点
+ // zoom: 9.8, // 缩放级别
+ // rotation: undefined, // 缩放完成view视图旋转弧度
+ // duration: 1000, // 缩放持续时间,默认不需要设置
+ // });
+ // }
+ // }
+ // }
+ // //获取镇界线----end
+ // //获取村界线----start
+ // if(this.mapVillageList.length >0){
+ // for (var i = 0; this.mapVillageList.length > i; i++) {
+ // if (this.mapVillageList[i] != null && this.mapVillageList[i].theGeom != null && this.mapVillageList[i].theGeom != "") {
+ // mapTalkAbout =false;
+ // this.mapVillageList[i].createBy = 'mapVillageList';
+ // var theGeomLine= this.mapVillageList[i].theGeom.replaceAll("MultiPolygon","LineString");
+ // theGeomLine = theGeomLine.replaceAll("[[[[","[[");
+ // theGeomLine = theGeomLine.replaceAll("]]]]","]]");
+ // 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\":" + theGeomLine + ", \"properties\":" + JSON.stringify(this.mapVillageList[i]) + "}"),
+ // }),
+ // style: new ol.style.Style({
+ // fill: new ol.style.Fill({
+ // //矢量图层填充颜色,以及透明度
+ // color: "#AE57A4",
+ // }),
+ // stroke: new ol.style.Stroke({
+ // //边界样式
+ // color: "#ff00ff",
+ // width: 3,
+ // }),
+ // // text: new ol.style.Text({
+ // // text: this.mapVillageList[i].dcmj,
+ // // font: '30px sans-serif',
+ // // textAlign: "center",
+ // // textBaseline: "middle",
+ // // //font: 'verdana',
+ // // fill: new ol.style.Fill({
+ // // color: "#ff00ff"
+ // // }),
+ // // // backgroundFill: new ol.style.Fill({
+ // // // color: "#ff0000"
+ // // // }),
+ // // font: "30px sans-serif",
+ // // stroke: new ol.style.Stroke({
+ // // color: "#ffffff"
+ // // // width: 3
+ // // }),
+ // // offsetX: parseInt(0, 10),
+ // // offsetY: parseInt(0, 10),
+ // // placement: "line", //point 则自动计算面的中心k点然后标注 line 则根据面要素的边进行标注
+ // // overflow: false //超出面的部分不显示
+ // // }),
+ // }),
+ // });
+ // map.addLayer(hc_land);
+ // }
+ // }
+ // }
+ // // //获取村界线----end
+ // //宅基地定位开始 ---------start
+ // if(this.mapTheGeomZjdId.length >0) {
+ // for (var i = 0; this.mapTheGeomZjdId.length > i; i++) {
+ // if (this.mapTheGeomZjdId[i] !=null && this.mapTheGeomZjdId[i].theGeom != null && this.mapTheGeomZjdId[i].theGeom != "") {
+ // mapTalkAbout =false;
+ // this.mapTheGeomZjdId[i].createBy = 'mapTheGeomZjdId';
+ // var styleYqr = "";
+ // if(this.mapTheGeomZjdId[i].houseDataConfirmStatus == "CONFIRMED"){
+ // styleYqr = new ol.style.Style({
+ // fill: new ol.style.Fill({
+ // //矢量图层填充颜色,以及透明度
+ // color: "#AE57A4",
+ // }),
+ // stroke: new ol.style.Stroke({
+ // //边界样式
+ // color: "#28FF28",
+ // width: 3,
+ // }),
+ // });
+ // } else {
+ // styleYqr = new ol.style.Style({
+ // fill: new ol.style.Fill({
+ // //矢量图层填充颜色,以及透明度
+ // color: "#AE57A4",
+ // }),
+ // stroke: new ol.style.Stroke({
+ // //边界样式
+ // color: "rgba(255, 45, 45,1)",
+ // width: 3,
+ // }),
+ // });
+ // }
+ // 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.mapTheGeomZjdId[i].theGeom + ", \"properties\":" + JSON.stringify(this.mapTheGeomZjdId[i]) + "}"),
+ // }),
+ // style: styleYqr
+ // });
+ // map.addLayer(hc_land);
+ // // var maxXMap = hc_land.values_.source.featuresRtree_.rbush_.data.maxX;
+ // // 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: 15.8, // 缩放级别
+ // // rotation: undefined, // 缩放完成view视图旋转弧度
+ // // duration: 1000, // 缩放持续时间,默认不需要设置
+ // // });
+ // //自然幢定位开始 ---------start
+ // getZrzZjdDmList(this.mapTheGeomZjdId[i].zjddm).then((response) => {
+ // if (response.code == 200) {
+ // this.mapTheGeomZrzId = response.data;
+ // if(this.mapTheGeomZrzId.length >0) {
+ // for (var i = 0; this.mapTheGeomZrzId.length > i; i++) {
+ // if (this.mapTheGeomZrzId[i] !=null && this.mapTheGeomZrzId[i].theGeom != null && this.mapTheGeomZrzId[i].theGeom != "") {
+ // this.mapTheGeomZrzId[i].createBy = 'mapTheGeomZrzId';
+ // var styleZrz = "";
+ // if(this.mapTheGeomZjdId[i].houseDataConfirmStatus == "CONFIRMED"){
+ // styleZrz = new ol.style.Style({
+ // fill: new ol.style.Fill({
+ // //矢量图层填充颜色,以及透明度
+ // color: "#FFD306",
+ // }),
+ // stroke: new ol.style.Stroke({
+ // //边界样式
+ // color: "#28FF28",
+ // width: 3,
+ // }),
+ // });
+ // } else {
+ // styleZrz = new ol.style.Style({
+ // fill: new ol.style.Fill({
+ // //矢量图层填充颜色,以及透明度
+ // color: "#FFD306",
+ // }),
+ // stroke: new ol.style.Stroke({
+ // //边界样式
+ // color: "rgba(255, 45, 45,1)",
+ // width: 3,
+ // }),
+ // });
+ // }
+ // 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.mapTheGeomZrzId[i].theGeom + ", \"properties\":" + JSON.stringify(this.mapTheGeomZrzId[i]) + "}"),
+ // }),
+ // style: styleZrz
+ // });
+ // map.addLayer(hc_land);
+ // }
+ // }
+ // }
+ // }
+ // });
+ // //自然幢定位结束 ---------end
+ //
+ // //附属设施定位开始 ---------start
+ // getFsssZjdDmList(this.mapTheGeomZjdId[i].zjddm).then((response) => {
+ // if (response.code == 200) {
+ // this.mapTheGeomFsssId = response.data;
+ // if(this.mapTheGeomFsssId.length >0) {
+ // for (var i = 0; this.mapTheGeomFsssId.length > i; i++) {
+ // if (this.mapTheGeomFsssId[i] !=null && this.mapTheGeomFsssId[i].theGeom != null && this.mapTheGeomFsssId[i].theGeom != "") {
+ // this.mapTheGeomFsssId[i].createBy = 'mapTheGeomFsssId';
+ // var styleFsss = "";
+ // if(this.mapTheGeomZjdId[i].houseDataConfirmStatus == "CONFIRMED"){
+ // styleFsss = new ol.style.Style({
+ // fill: new ol.style.Fill({
+ // //矢量图层填充颜色,以及透明度
+ // color: "#00FFFF",
+ // }),
+ // stroke: new ol.style.Stroke({
+ // //边界样式
+ // color: "#28FF28",
+ // width: 3,
+ // }),
+ // });
+ // } else {
+ // styleFsss = new ol.style.Style({
+ // fill: new ol.style.Fill({
+ // //矢量图层填充颜色,以及透明度
+ // color: "#00FFFF",
+ // }),
+ // stroke: new ol.style.Stroke({
+ // //边界样式
+ // color: "rgba(255, 45, 45,1)",
+ // width: 3,
+ // }),
+ // });
+ // }
+ // 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.mapTheGeomFsssId[i].theGeom + ", \"properties\":" + JSON.stringify(this.mapTheGeomFsssId[i]) + "}"),
+ // }),
+ // style: styleFsss
+ // });
+ // map.addLayer(hc_land);
+ // }
+ // }
+ // }
+ // }
+ // });
+ // //附属设施定位结束 ---------end
+ // }
+ // }
+ // }
+ // //宅基地定位结束 ---------end
+ //数据库直接加载数据渲染方式---------------------------------------------------end
+
//地图操作定义------------start
//定位定义------------start
var Zb;
@@ -1620,276 +1753,383 @@
// });
//
- //获取类型开始 侧面-----------------------------------------------------------------start
+ // //获取类型开始 侧面-----------------------------------------------------------------start
$("#area").click(function () {
- console.log("进入测面")
- //删除绘制图层画图操作-------start
- map.removeInteraction(draw_map);
- map.removeLayer(drawing);
- //删除绘制图层画图操作-------end
- //开始绘制 测面--------------------------------------------------------------start
- //定义矢量数据源
- var source = new ol.source.Vector();
-
- vector = new ol.layer.Vector({
- source: source,
- style: new ol.style.Style({
- fill: new ol.style.Fill({
- color: "rgba(255,255,255,0.2)",
- }),
- stroke: new ol.style.Stroke({
- color: "#e21e0a",
- width: 2,
- }),
- //image: new ol.style.Circle({
- // radius: 7,
- // fill: new ol.style.Fill({
- // color:'#ffcc33'
- // })
- //})
- }),
- });
-
- //将矢量图层添加到地图中 线的颜色加入map中
- map.addLayer(vector);
-
- var sketch;
-
- var continuePolygonMsg = "单击以继续绘制多边形";
+ console.log("进入测面");
- /**
- * Message to show when the user is drawing a line.
- * @type {string}
- */
- //var continueLineMsg = '单击继续绘制直线';
-
- //鼠标移动触发的函数
- var pointerMoveHandler = function (evt) {
- //Indicates if the map is currently being dragged.
- //Only set for POINTERDRAG and POINTERMOVE events. Default is false.
- //如果是平移地图则直接结束
- if (evt.dragging) {
- return;
- }
- //帮助提示信息
- var helpMsg = "单击开始绘图";
-
- if (sketch) {
- //Get the feature's default geometry.
- //A feature may have any number of named geometries.
- //获取绘图对象的几何要素
- var geom = sketch.getGeometry();
- //如果当前绘制的几何要素是多边形,则将绘制提示信息设置为多边形绘制提示信息
- //如果当前绘制的几何要素是多线段,则将绘制提示信息设置为多线段绘制提示信息
- helpMsg = continuePolygonMsg;
- }
- //设置帮助提示要素的内标签为帮助提示信息
- helpTooltipElement.innerHTML = helpMsg;
- //设置帮助提示信息的位置
- //The coordinate in view projection corresponding to the original browser event.
- helpTooltip.setPosition(evt.coordinate);
- //移除帮助提示要素的隐藏样式
- $(helpTooltipElement).removeClass("hidden");
- };
-
- map.on("pointermove", pointerMoveHandler);
-
- map.getViewport().addEventListener("mouseout", function () {
- helpTooltipElement.classList.add("hidden");
- });
-
- //添加交互式绘图对象的函数
- function addInteraction() {
- // 获取当前选择的绘制类型
- //var type = typeSelect.value == 'length' ? 'Polygon' : 'LineString';
- //创建一个交互式绘图对象
- var type = "Polygon";
- draw_cm = new ol.interaction.Draw({
- //绘制的数据源
- source: source,
- //绘制类型
- type: type,
- //样式
- style: new ol.style.Style({
- fill: new ol.style.Fill({
- color: "rgba(255,255,255,0.2)",
- }),
- stroke: new ol.style.Stroke({
- color: "rgba(0,0,0,0.5)",
- lineDash: [10, 10],
- width: 2,
- }),
- // image: new ol.style.Circle({
- // radius: 5,
- // stroke: new ol.style.Stroke({
- // color:'rgba(0,0,0,0.7)'
- // }),
- // fill: new ol.style.Fill({
- //color: 'rgba(255,255,255,0.2)'
- // })
- //})
- }),
- });
- //将交互绘图对象添加到地图中
- map.addInteraction(draw_cm);
-
- //创建测量提示框
- createMeasureTooltip();
- //创建帮助提示框
- createHelpTooltip();
-
- //定义一个事件监听
- var listener;
- //定义一个控制鼠标点击次数的变量
- var count = 0;
- //绘制开始事件
- draw_cm.on(
- "drawstart",
- function (evt) {
- //The feature being drawn.
- sketch = evt.feature;
- //提示框的坐标
- var tooltipCoord = evt.coordinate;
- //监听几何要素的change事件
- //Increases the revision counter and dispatches a 'change' event.
-
- listener = sketch.getGeometry().on("change", function (evt) {
- //The event target.
- //获取绘制的几何对象
- var geom = evt.target;
- //定义一个输出对象,用于记录面积和长度
- var output;
- map.removeEventListener("singleclick");
- map.removeEventListener("dblclick");
- //输出多边形的面积
- output = formatArea(geom);
- //Return an interior point of the polygon.
- //获取多变形内部点的坐标
- tooltipCoord = geom.getInteriorPoint().getCoordinates();
-
- //设置测量提示框的内标签为最终输出结果
- measureTooltipElement.innerHTML = output;
- //设置测量提示信息的位置坐标
- measureTooltip.setPosition(tooltipCoord);
- });
-
- //地图单击事件
- map.on("singleclick", function (evt) {
- //设置测量提示信息的位置坐标,用来确定鼠标点击后测量提示框的位置
- measureTooltip.setPosition(evt.coordinate);
- //如果是第一次点击,则设置测量提示框的文本内容为起点
- if (count == 0) {
- measureTooltipElement.innerHTML = "起点";
- }
- //根据鼠标点击位置生成一个点
- var point = new ol.geom.Point(evt.coordinate);
- //将该点要素添加到矢量数据源中
- source.addFeature(new ol.Feature(point));
- //更改测量提示框的样式,使测量提示框可见
- measureTooltipElement.className = "tooltip tooltip-static";
- //创建测量提示框
- createMeasureTooltip();
- //点击次数增加
- count++;
- });
+ });
+ // $("#area").click(function () {
+ // console.log("进入测面")
+ // //删除绘制图层画图操作-------start
+ // map.removeInteraction(draw_map);
+ // map.removeLayer(drawing);
+ // //删除绘制图层画图操作-------end
+ // //开始绘制 测面--------------------------------------------------------------start
+ // //定义矢量数据源
+ // var source = new ol.source.Vector();
+ //
+ // vector = new ol.layer.Vector({
+ // source: source,
+ // style: new ol.style.Style({
+ // fill: new ol.style.Fill({
+ // color: "rgba(255,255,255,0.2)",
+ // }),
+ // stroke: new ol.style.Stroke({
+ // color: "#e21e0a",
+ // width: 2,
+ // }),
+ // //image: new ol.style.Circle({
+ // // radius: 7,
+ // // fill: new ol.style.Fill({
+ // // color:'#ffcc33'
+ // // })
+ // //})
+ // }),
+ // });
+ //
+ // //将矢量图层添加到地图中 线的颜色加入map中
+ // map.addLayer(vector);
+ //
+ // var sketch;
+ //
+ // var continuePolygonMsg = "单击以继续绘制多边形";
+ //
+ // /**
+ // * Message to show when the user is drawing a line.
+ // * @type {string}
+ // */
+ // //var continueLineMsg = '单击继续绘制直线';
+ //
+ // //鼠标移动触发的函数
+ // var pointerMoveHandler = function (evt) {
+ // //Indicates if the map is currently being dragged.
+ // //Only set for POINTERDRAG and POINTERMOVE events. Default is false.
+ // //如果是平移地图则直接结束
+ // if (evt.dragging) {
+ // return;
+ // }
+ // //帮助提示信息
+ // var helpMsg = "单击开始绘图";
+ //
+ // if (sketch) {
+ // //Get the feature's default geometry.
+ // //A feature may have any number of named geometries.
+ // //获取绘图对象的几何要素
+ // var geom = sketch.getGeometry();
+ // //如果当前绘制的几何要素是多边形,则将绘制提示信息设置为多边形绘制提示信息
+ // //如果当前绘制的几何要素是多线段,则将绘制提示信息设置为多线段绘制提示信息
+ // helpMsg = continuePolygonMsg;
+ // }
+ // //设置帮助提示要素的内标签为帮助提示信息
+ // helpTooltipElement.innerHTML = helpMsg;
+ // //设置帮助提示信息的位置
+ // //The coordinate in view projection corresponding to the original browser event.
+ // helpTooltip.setPosition(evt.coordinate);
+ // //移除帮助提示要素的隐藏样式
+ // $(helpTooltipElement).removeClass("hidden");
+ // };
+ //
+ // map.on("pointermove", pointerMoveHandler);
+ //
+ // map.getViewport().addEventListener("mouseout", function () {
+ // helpTooltipElement.classList.add("hidden");
+ // });
+ //
+ // //添加交互式绘图对象的函数
+ // function addInteraction() {
+ // // 获取当前选择的绘制类型
+ // //var type = typeSelect.value == 'length' ? 'Polygon' : 'LineString';
+ // //创建一个交互式绘图对象
+ // var type = "Polygon";
+ // draw_cm = new ol.interaction.Draw({
+ // //绘制的数据源
+ // source: source,
+ // //绘制类型
+ // type: type,
+ // //样式
+ // style: new ol.style.Style({
+ // fill: new ol.style.Fill({
+ // color: "rgba(255,255,255,0.2)",
+ // }),
+ // stroke: new ol.style.Stroke({
+ // color: "rgba(0,0,0,0.5)",
+ // lineDash: [10, 10],
+ // width: 2,
+ // }),
+ // // image: new ol.style.Circle({
+ // // radius: 5,
+ // // stroke: new ol.style.Stroke({
+ // // color:'rgba(0,0,0,0.7)'
+ // // }),
+ // // fill: new ol.style.Fill({
+ // //color: 'rgba(255,255,255,0.2)'
+ // // })
+ // //})
+ // }),
+ // });
+ // //将交互绘图对象添加到地图中
+ // map.addInteraction(draw_cm);
+ //
+ // //创建测量提示框
+ // createMeasureTooltip();
+ // //创建帮助提示框
+ // createHelpTooltip();
+ //
+ // //定义一个事件监听
+ // var listener;
+ // //定义一个控制鼠标点击次数的变量
+ // var count = 0;
+ // //绘制开始事件
+ // draw_cm.on(
+ // "drawstart",
+ // function (evt) {
+ // //The feature being drawn.
+ // sketch = evt.feature;
+ // //提示框的坐标
+ // var tooltipCoord = evt.coordinate;
+ // //监听几何要素的change事件
+ // //Increases the revision counter and dispatches a 'change' event.
+ //
+ // listener = sketch.getGeometry().on("change", function (evt) {
+ // //The event target.
+ // //获取绘制的几何对象
+ // var geom = evt.target;
+ // //定义一个输出对象,用于记录面积和长度
+ // var output;
+ // map.removeEventListener("singleclick");
+ // map.removeEventListener("dblclick");
+ // //输出多边形的面积
+ // output = formatArea(geom);
+ // //Return an interior point of the polygon.
+ // //获取多变形内部点的坐标
+ // tooltipCoord = geom.getInteriorPoint().getCoordinates();
+ //
+ // //设置测量提示框的内标签为最终输出结果
+ // measureTooltipElement.innerHTML = output;
+ // //设置测量提示信息的位置坐标
+ // measureTooltip.setPosition(tooltipCoord);
+ // });
+ //
+ // //地图单击事件
+ // map.on("singleclick", function (evt) {
+ // //设置测量提示信息的位置坐标,用来确定鼠标点击后测量提示框的位置
+ // measureTooltip.setPosition(evt.coordinate);
+ // //如果是第一次点击,则设置测量提示框的文本内容为起点
+ // if (count == 0) {
+ // measureTooltipElement.innerHTML = "起点";
+ // }
+ // //根据鼠标点击位置生成一个点
+ // var point = new ol.geom.Point(evt.coordinate);
+ // //将该点要素添加到矢量数据源中
+ // source.addFeature(new ol.Feature(point));
+ // //更改测量提示框的样式,使测量提示框可见
+ // measureTooltipElement.className = "tooltip tooltip-static";
+ // //创建测量提示框
+ // createMeasureTooltip();
+ // //点击次数增加
+ // count++;
+ // });
+ //
+ // //地图双击事件
+ // map.on("dblclick", function (evt) {
+ // //根据
+ // var point = new ol.geom.Point(evt.coordinate);
+ // source.addFeature(new ol.Feature(point));
+ // });
+ // },
+ // this
+ // );
+ // //绘制结束事件
+ // draw_cm.on(
+ // "drawend",
+ // function (evt) {
+ // count = 0;
+ // //设置测量提示框的样式
+ // measureTooltipElement.className = "tooltip tooltip-static";
+ // //Set the offset for this overlay.
+ // //设置偏移量
+ // measureTooltip.setOffset([0, -7]);
+ // //清空绘制要素
+ // sketch = null;
+ // //清空测量提示要素
+ // measureTooltipElement = null;
+ // //创建测量提示框
+ // createMeasureTooltip();
+ // //Removes an event listener using the key returned by on() or once().
+ // //移除事件监听
+ // ol.Observable.unByKey(listener);
+ // //移除地图单击事件
+ // map.removeEventListener("singleclick");
+ // },
+ // this
+ // );
+ // }
+ // /**
+ // * Creates a new help tooltip
+ // */
+ // function createHelpTooltip() {
+ // if (helpTooltipElement) {
+ // helpTooltipElement.parentNode.removeChild(helpTooltipElement);
+ // }
+ // helpTooltipElement = document.createElement("div");
+ // helpTooltipElement.className = "ol-tooltip hidden";
+ // helpTooltip = new ol.Overlay({
+ // element: helpTooltipElement,
+ // offset: [15, 0],
+ // positioning: "center-left",
+ // });
+ // map.addOverlay(helpTooltip);
+ // }
+ //
+ // /**
+ // * Creates a new measure tooltip
+ // */
+ // function createMeasureTooltip() {
+ // if (measureTooltipElement) {
+ // measureTooltipElement.parentNode.removeChild(measureTooltipElement);
+ // }
+ // measureTooltipElement = document.createElement("div");
+ // measureTooltipElement.className = "ol-tooltip ol-tooltip-measure";
+ // measureTooltip = new ol.Overlay({
+ // element: measureTooltipElement,
+ // offset: [0, -15],
+ // positioning: "bottom-center",
+ // });
+ // map.addOverlay(measureTooltip);
+ // }
+ //
+ // //格式化测量面积
+ // var formatArea = function (polygon) {
+ // //定义面积变量
+ // var area;
+ // //获取平面面积
+ // area = polygon.getArea();
+ // //定义输出变量
+ // var output;
+ // //当面积大于10000时,转换为平方千米,否则为平方米
+ // if (area > 10000) {
+ // output =
+ // Math.round((area / 1000000) * 100) / 100 + " " + "km
2";
+ // } else {
+ // output = Math.round(area * 100) / 100 + " " + "m
2";
+ // }
+ // return output;
+ // };
+ //
+ // addInteraction();
+ // });
+ // //侧面结束-----------------------------------------------------------------end
- //地图双击事件
- map.on("dblclick", function (evt) {
- //根据
- var point = new ol.geom.Point(evt.coordinate);
- source.addFeature(new ol.Feature(point));
- });
- },
- this
- );
- //绘制结束事件
- draw_cm.on(
- "drawend",
- function (evt) {
- count = 0;
- //设置测量提示框的样式
- measureTooltipElement.className = "tooltip tooltip-static";
- //Set the offset for this overlay.
- //设置偏移量
- measureTooltip.setOffset([0, -7]);
- //清空绘制要素
- sketch = null;
- //清空测量提示要素
- measureTooltipElement = null;
- //创建测量提示框
- createMeasureTooltip();
- //Removes an event listener using the key returned by on() or once().
- //移除事件监听
- ol.Observable.unByKey(listener);
- //移除地图单击事件
- map.removeEventListener("singleclick");
- },
- this
- );
- }
- /**
- * Creates a new help tooltip
- */
- function createHelpTooltip() {
- if (helpTooltipElement) {
- helpTooltipElement.parentNode.removeChild(helpTooltipElement);
- }
- helpTooltipElement = document.createElement("div");
- helpTooltipElement.className = "ol-tooltip hidden";
- helpTooltip = new ol.Overlay({
- element: helpTooltipElement,
- offset: [15, 0],
- positioning: "center-left",
- });
- map.addOverlay(helpTooltip);
+ //全图展示-----------------start
+ $("#mapAllQt").click(function (){
+ //定位查询位置
+ let param_dw = {
+ srsName: "EPSG:3857",
+ service: "WFS",
+ version: "1.0.0",
+ request: "GetFeature",
+ typename: "zjd_dc:t_house_survey_border_village",
+ //featureNS: 'nsgk_hc',//命名空间 URI
+ //cql_filter: cql_filter,
+ //featurePrefix: 'nationalwater',//工作区名称
+ //featureTypes: ['nationalwater:01fir'],//查询图层,可以是同一个工作区下多个图层,逗号隔开
+ outputFormat: "application/json",
+ //filter: ol.format.filter.equalTo(t,e,r)//前者是属性名,后者是对应值
+ };
+ let url_dw = "http://116.255.223.226:8080/geoserver/zjd_dc/wfs"; //wfsurl;
+ url_dw = url_dw + "?";
+ for (let key in param_dw) {
+ url_dw = url_dw + key + "=" + param_dw[key] + "&";
}
-
- /**
- * Creates a new measure tooltip
- */
- function createMeasureTooltip() {
- if (measureTooltipElement) {
- measureTooltipElement.parentNode.removeChild(measureTooltipElement);
- }
- measureTooltipElement = document.createElement("div");
- measureTooltipElement.className = "ol-tooltip ol-tooltip-measure";
- measureTooltip = new ol.Overlay({
- element: measureTooltipElement,
- offset: [0, -15],
- positioning: "bottom-center",
+ url_dw = url_dw.substr(0, url_dw.length - 1);
+ fetch(url_dw, {
+ method: "POST", // *GET, POST, PUT, DELETE, etc.
+ })
+ .then((res) => {
+ var geojsonmap = res.json();
+ return geojsonmap;
+ })
+ .then((data) => {
+ let resolution = map.getView().getResolutionForExtent(data.bbox,map.getSize());
+ map.getView().fit(data.bbox);
+ map.getView().setResolution(resolution);
+ // var datamap = data.bbox;
+ // var center = ol.extent.getCenter(datamap);
+ // map.getView().animate({
+ // // 只设置需要的属性即可
+ // center: center, // 中心点
+ // rotation: undefined, // 缩放完成view视图旋转弧度
+ // });
+ })
+ .catch((error) => {
+ console.log("【异常】", error);
});
- map.addOverlay(measureTooltip);
- }
+ });
- //格式化测量面积
- var formatArea = function (polygon) {
- //定义面积变量
- var area;
- //获取平面面积
- area = polygon.getArea();
- //定义输出变量
- var output;
- //当面积大于10000时,转换为平方千米,否则为平方米
- if (area > 10000) {
- output =
- Math.round((area / 1000000) * 100) / 100 + " " + "km
2";
- } else {
- output = Math.round(area * 100) / 100 + " " + "m
2";
- }
- return output;
- };
+ //业务图层 wfs服务 属性查询开始 ------------------start
+ /**
+ * @api wfs服务空间查询
+ * @param {*} wfsurl
+ * @param {*} srsName
+ * @param {*} typeName
+ * @param {*} drawType
+ * @param {option 可选} geometryField
+ */
- addInteraction();
+ var wmsSource = new ol.source.TileWMS({
+ url: "http://116.255.223.226:8080/geoserver/zjd_dc/wms",
+ params: {
+ LAYERS: "zjd_dc:t_house_survey_all",
+ TILED: true,
+ SRID: 3857,
+ serverType: "geoserver",
+ crossOrigin: "anonymous",
+ },
});
- //侧面结束-----------------------------------------------------------------end
+ map.on("pointermove", function (evt) {
+ if (evt.dragging) {
+ return;
+ }
+ var pixel = map.getEventPixel(evt.originalEvent);
+ var hit = map.forEachLayerAtPixel(pixel, function () {
+ return true;
+ });
+ map.getTargetElement().style.cursor = hit ? "pointer" : "";
+ });
+ //属性查询结束 ------------------end
//点击查询详细信息
map.on("singleclick", function (evt) {
+ console.log("查看详情");
let feature = map.forEachFeatureAtPixel(
evt.pixel,
(feature) => feature
);
+ console.log(feature);
+ var viewResolution = map.getView().getResolution(); ///** @type {number} */ (view.getResolution());
+ var zb = evt.coordinate;
+ var url = wmsSource.getFeatureInfoUrl(
+ evt.coordinate,
+ viewResolution,
+ "EPSG:3857",
+ { INFO_FORMAT: "text/html" }
+ );
+ if (url) {
+ fetch(url)
+ .then(function (response) {
+ return response.text();
+ })
+ .then(function (html) {
+ console.log(html);
+ // document.getElementById("info").innerHTML = html;
+ // if (html.indexOf("house") != -1) {
+ //
+ // } else {
+ // }
+ }, 300);
+ }
if(feature) {
+ console.log(feature);
//document.getElementById("info").innerHTML = "";
that.mapHaDataValue = true;
var ifConsole = feature.values_.createBy;
@@ -2226,32 +2466,34 @@
that.mapHaDataValue = false;
}
});
+ //数据库循环加载时使用 --------------------加载较慢 ------start
//当前账套没有任何空间数据
- if(mapTalkAbout){
- let deptName = this.$store.state.user.loginDeptId + "";
- getQueryLand(deptName).then((response) => {
- if (response.code == 200) {
- let InsertCode = response.data;
- if (InsertCode != null) {
- var lat = InsertCode.lat;
- var lng = InsertCode.lng;
- var center;
- if(lat !=null && lng !=null && lat !="" && lng !=""){
- center = [lng,lat];
- }else {
- center =[115.452752, 31.789033];
- }
- map.getView().animate({
- // 只设置需要的属性即可
- center: ol.proj.fromLonLat(center), // 中心点
- zoom: 17.9, // 缩放级别
- rotation: undefined, // 缩放完成view视图旋转弧度
- duration: 1000, // 缩放持续时间,默认不需要设置
- });
- }
- }
- });
- }
+ // if(mapTalkAbout){
+ // let deptName = this.$store.state.user.loginDeptId + "";
+ // getQueryLand(deptName).then((response) => {
+ // if (response.code == 200) {
+ // let InsertCode = response.data;
+ // if (InsertCode != null) {
+ // var lat = InsertCode.lat;
+ // var lng = InsertCode.lng;
+ // var center;
+ // if(lat !=null && lng !=null && lat !="" && lng !=""){
+ // center = [lng,lat];
+ // }else {
+ // center =[115.452752, 31.789033];
+ // }
+ // map.getView().animate({
+ // // 只设置需要的属性即可
+ // center: ol.proj.fromLonLat(center), // 中心点
+ // zoom: 17.9, // 缩放级别
+ // rotation: undefined, // 缩放完成view视图旋转弧度
+ // duration: 1000, // 缩放持续时间,默认不需要设置
+ // });
+ // }
+ // }
+ // });
+ // }
+ //数据库循环加载时使用 --------------------加载较慢 ------start
},
/*右侧列表 --展开收缩*/
@@ -2323,6 +2565,21 @@
});
}
},
+ //全选
+ checkAll(val) {
+ let checkedCount = this.CheckedAllArr.length
+ if (val) {
+ //全选
+ this.CheckedAllArr = this.dataList.map(item => item.id)
+ } else{
+ //取消全选
+ if (checkedCount === this.dataList.length) {
+ //如果不增加这个条件判断点击某一项时会全部取消
+ this.CheckedAllArr = []
+ }
+ }
+ },
+
}
}