From 5d7406be7c774d7235d388bf683d34d80e7c3ff4 Mon Sep 17 00:00:00 2001 From: Surpriseplus <845948745@qq.com> Date: 星期一, 13 三月 2023 16:51:02 +0800 Subject: [PATCH] 综合展示批量添加柱状图 --- src/components/MapView/mapSpacePop.vue | 296 ++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 242 insertions(+), 54 deletions(-) diff --git a/src/components/MapView/mapSpacePop.vue b/src/components/MapView/mapSpacePop.vue index 0d9ab37..661cf6b 100644 --- a/src/components/MapView/mapSpacePop.vue +++ b/src/components/MapView/mapSpacePop.vue @@ -56,6 +56,18 @@ @click="restSpacePopLayer" >閲嶇疆</el-button> </el-form-item> + + <el-form-item v-if="spaceLayer == 'sexplorationpoint'"> + <el-button + size="small" + @click="spaceHistogram( )" + plain + >鏌辩姸鍥�</el-button> + <!-- <el-button + plain + size="small" + >鍓栧垏鍥�</el-button> --> + </el-form-item> </el-form> <div class="centTable"> <el-table @@ -84,7 +96,7 @@ ></el-button> </template> </el-table-column> - <el-table-column + <!-- <el-table-column label="鏌辩姸鍥�" width="100" align="center" @@ -97,7 +109,7 @@ @click="spaceHistogram(scope.$index, scope.row)" ></el-button> </template> - </el-table-column> + </el-table-column> --> <el-table-column v-for="(item, index) in attributeData" :key="index" @@ -133,7 +145,9 @@ inquiry_selectFields, inquiry_selectDomains, decr, + encr, } from "../../api/api.js" +import * as turf from "@turf/turf" export default { computed: { storeTime() { @@ -402,27 +416,95 @@ this.tableData = data.result this.$refs.filterTable.doLayout() }, - async spaceHistogram(index, row) { - if (this.$store.state.histogramLayer.length != 0) { - for (var i in this.$store.state.histogramLayer) { - Viewer.entities.remove(this.$store.state.histogramLayer[i]) + + async setCartesianToEightFour(entities) { + var east = Cesium.Math.toDegrees( + entities.rectangle.coordinates.getValue().east + ); + var north = Cesium.Math.toDegrees( + entities.rectangle.coordinates.getValue().north + ); + var west = Cesium.Math.toDegrees( + entities.rectangle.coordinates.getValue().west + ); + var south = Cesium.Math.toDegrees( + entities.rectangle.coordinates.getValue().south + ); + var line = turf.polygon([ + [ + [east, north], + [west, north], + [west, south], + [east, south], + [east, north], + ], + ]); + var wkt = this.$wkt.convert(line.geometry); + this.listdata.pageIndex = 1; + this.listdata.pageSize = 10; + this.listdata.wkt = encr(wkt) + + const data = await dataQuerySelectByPage(this.listdata) + if (data.code != 200) { + this.$message.error("鍒楄〃璋冪敤澶辫触") + } + this.listdata.count = data.count; + this.tableData = data.result; + this.$refs.filterTable.doLayout(); + this.showHistogramLayer(data.count) + var that = this; + + window.histogramHandler = new Cesium.ScreenSpaceEventHandler( + sgworld.Viewer.scene.canvas + ) + window.histogramHandler.setInputAction((event) => { + var pick = sgworld.Viewer.scene.pick(event.endPosition); + + var propertiesFlag = that.$store.state.propertiesFlag + + if (Cesium.defined(pick)) { + if (pick && pick.id && pick.id.tag && pick.id.tag == "Histogram") { + that.$store.state.propertiesInfo = { + title: pick.id.properties._exppointid._value, + name: pick.id.properties._geoname._value, + type: pick.id.properties.geotype._value, + botdepth: pick.id.properties._botdepth._value, + describe: pick.id.properties._describe._value, + } + that.$store.state.propertiesFlag = "2" + } else { + that.$store.state.propertiesFlag = propertiesFlag + } + } else { + that.$store.state.propertiesFlag = propertiesFlag } + }, Cesium.ScreenSpaceEventType.MOUSE_MOVE) + }, + async showHistogramLayer(res) { + var obj = { + pageIndex: 1, + pageSize: res, + wkt: this.listdata.wkt, + name: this.listdata.name } - if (window.histogramHandler != null && Cesium.defined(window.histogramHandler)) { - window.histogramHandler.removeInputAction( - Cesium.ScreenSpaceEventType.MOUSE_MOVE - ) - window.histogramHandler = null + const data = await dataQuerySelectByPage(obj) + if (data.code != 200) { + return } + var val = data.result; + for (var i in val) { + this.setShowHistogramLayer(val[i]) + } + }, + async setShowHistogramLayer(res) { var param = { - gid: row.gid, + gid: res.gid, name: this.spaceLayer, } const data1 = await dataQuerySelectWktById(param) if (data1.code != 200) { this.$message.error("鍒楄〃璋冪敤澶辫触") } - var val1 = decr(data1.result) var wkt = this.$wkt.parse(val1) var coord = wkt.coordinates @@ -430,19 +512,15 @@ pageIndex: 1, pageSize: 10, name: 'sexplorationpointstratum', - filter: "exppointid = '" + row.exppointid + "'" + filter: "exppointid = '" + res.exppointid + "'" } var data = await dataQuerySelectByPage(obj) - if (data.code != 200) { - - } - + if (data.code != 200) { return } if (data.result.length != 0) { var val = data.result; //鍐掓场鎺掑簭 for (var i = 0; i < val.length; i++) { for (var u = i + 1; u < val.length; u++) { - if (val[i].botdepth > val[u].botdepth) { var num = val[i]; val[i] = val[u]; @@ -459,11 +537,11 @@ 'rgba(197,222,130,1)', 'rgba(208,228,177,1)', ] - var num = row.elev; + var num = res.elev; var height = 0; for (var i = 0; i < val.length; i++) { var fill, line; - if (i > outlineList.length) { + if (i >= outlineList.length) { var len = outlineList.length - 1; fill = outlineList[len]; line = outlineList[len]; @@ -490,43 +568,153 @@ }); num -= val[i].botdepth; this.$store.state.histogramLayer.push(layer) - sgworld.Navigate.flyToObj(layer) } - window.histogramHandler = new Cesium.ScreenSpaceEventHandler( - sgworld.Viewer.scene.canvas - ) - var that = this; - window.histogramHandler.setInputAction((event) => { - // var ellipsoid = sgworld.Viewer.scene.globe.ellipsoid; - // var cartesian = sgworld.Viewer.scene.camera.pickEllipsoid(event.endPosition, ellipsoid); - var pick = sgworld.Viewer.scene.pick(event.endPosition); - var selectedEntity = null; - - if (Cesium.defined(pick)) { - if (pick && pick.id && pick.id.tag && pick.id.tag == "Histogram") { - - that.$store.state.propertiesInfo = { - title: pick.id.properties._exppointid._value, - name: pick.id.properties._geoname._value, - type: pick.id.properties.geotype._value, - botdepth: pick.id.properties._botdepth._value, - describe: pick.id.properties._describe._value, - } - that.$store.state.propertiesFlag = "2" - } else { - that.$store.state.propertiesFlag = null - } - } else { - that.$store.state.propertiesFlag = null - } - - }, Cesium.ScreenSpaceEventType.MOUSE_MOVE) - } else { - var msg = row.exppointid + " 娌″嫎鎺㈢偣鍦板眰琛ㄦ暟鎹紝鏃犳硶鐢熸垚鏌辩姸鍥�" - this.$message.error(msg); + + } + + }, + + + + + spaceHistogram() { + this.restSpacePopLayer(); + if (this.$store.state.histogramLayer.length != 0) { + for (var i in this.$store.state.histogramLayer) { + Viewer.entities.remove(this.$store.state.histogramLayer[i]) + } + } + if (window.histogramHandler != null && Cesium.defined(window.histogramHandler)) { + window.histogramHandler.removeInputAction( + Cesium.ScreenSpaceEventType.MOUSE_MOVE + ) + window.histogramHandler = null + } + var that = this; + sgworld.Creator.createSimpleGraphic('rectangle', { showSize: false }, function (entity) { + sgworld.Creator.SimpleGraphic.remove(entity.id); + that.setCartesianToEightFour(entity) + }); + + + + + // var param = { + // gid: row.gid, + // name: this.spaceLayer, + // } + // const data1 = await dataQuerySelectWktById(param) + // if (data1.code != 200) { + // this.$message.error("鍒楄〃璋冪敤澶辫触") + // } + + // var val1 = decr(data1.result) + // var wkt = this.$wkt.parse(val1) + // var coord = wkt.coordinates + // var obj = { + // pageIndex: 1, + // pageSize: 10, + // name: 'sexplorationpointstratum', + // filter: "exppointid = '" + row.exppointid + "'" + // } + // var data = await dataQuerySelectByPage(obj) + // if (data.code != 200) { + + // } + + // if (data.result.length != 0) { + // var val = data.result; + // //鍐掓场鎺掑簭 + // for (var i = 0; i < val.length; i++) { + // for (var u = i + 1; u < val.length; u++) { + + // if (val[i].botdepth > val[u].botdepth) { + // var num = val[i]; + // val[i] = val[u]; + // val[u] = num; + // } + // } + // } + // var outlineList = [ + // 'rgba(141,135,114,1)', + // 'rgba(248,235,179,1)', + // 'rgba(185,183,151,1)', + // 'rgba(224,222,94,1)', + // 'rgba(250,190,153,1)', + // 'rgba(197,222,130,1)', + // 'rgba(208,228,177,1)', + // ] + // var num = row.elev; + // var height = 0; + // for (var i = 0; i < val.length; i++) { + // var fill, line; + // if (i > outlineList.length) { + // var len = outlineList.length - 1; + // fill = outlineList[len]; + // line = outlineList[len]; + // } else { + // fill = outlineList[i]; + // line = outlineList[i]; + // } + // var height = num - val[i].botdepth + // var layer = Viewer.entities.add({ + // position: Cesium.Cartesian3.fromDegrees(coord[0], coord[1]), + // tag: 'Histogram', + // properties: val[i], + // ellipse: { + // semiMinorAxis: 1.0, //鐭酱 + // semiMajorAxis: 1.0, //闀胯酱 + // height: height, //鎷変几楂樺害 elev gwaterdep + // extrudedHeight: num, //绂诲湴楂樺害 + // rotation: Cesium.Math.toRadians(0), //鏃嬭浆 + // fill: true, //鏄惁鏄剧ず鍦嗙殑濉厖 + // material: Cesium.Color.fromCssColorString(line), //鍦嗙殑棰滆壊, + // outline: false, //鏄惁鏄剧ず鍦嗚疆寤� + + // }, + // }); + // num -= val[i].botdepth; + // this.$store.state.histogramLayer.push(layer) + // sgworld.Navigate.flyToObj(layer) + // } + // window.histogramHandler = new Cesium.ScreenSpaceEventHandler( + // sgworld.Viewer.scene.canvas + // ) + // var that = this; + // window.histogramHandler.setInputAction((event) => { + // // var ellipsoid = sgworld.Viewer.scene.globe.ellipsoid; + // // var cartesian = sgworld.Viewer.scene.camera.pickEllipsoid(event.endPosition, ellipsoid); + // var pick = sgworld.Viewer.scene.pick(event.endPosition); + // var selectedEntity = null; + + // if (Cesium.defined(pick)) { + // if (pick && pick.id && pick.id.tag && pick.id.tag == "Histogram") { + + // that.$store.state.propertiesInfo = { + // title: pick.id.properties._exppointid._value, + // name: pick.id.properties._geoname._value, + // type: pick.id.properties.geotype._value, + // botdepth: pick.id.properties._botdepth._value, + // describe: pick.id.properties._describe._value, + // } + // that.$store.state.propertiesFlag = "2" + // } else { + // that.$store.state.propertiesFlag = null + // } + // } else { + // that.$store.state.propertiesFlag = null + // } + + // }, Cesium.ScreenSpaceEventType.MOUSE_MOVE) + + + // } else { + // var msg = row.exppointid + " 娌″嫎鎺㈢偣鍦板眰琛ㄦ暟鎹紝鏃犳硶鐢熸垚鏌辩姸鍥�" + // this.$message.error(msg); + // } }, async spaceLocation(index, row) { var param = { -- Gitblit v1.9.3