From 60db92bf4f1e4cf4491668eb1d4281f6ac99bc02 Mon Sep 17 00:00:00 2001 From: Surpriseplus <845948745@qq.com> Date: 星期一, 06 三月 2023 18:38:24 +0800 Subject: [PATCH] 前端添加柱状图显示 --- src/components/MapView/mapSpacePop.vue | 140 ++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 132 insertions(+), 8 deletions(-) diff --git a/src/components/MapView/mapSpacePop.vue b/src/components/MapView/mapSpacePop.vue index 0ba1b6c..73d023e 100644 --- a/src/components/MapView/mapSpacePop.vue +++ b/src/components/MapView/mapSpacePop.vue @@ -1,7 +1,11 @@ <template> <div class="menuPop"> <div style="padding: 5px"> - <el-form :inline="true" :model="formInline" class="demo-form-inline"> + <el-form + :inline="true" + :model="formInline" + class="demo-form-inline" + > <el-form-item> <el-select v-model="formInline.name" @@ -41,12 +45,16 @@ ></el-input> </el-form-item> <el-form-item> - <el-button size="small" plain @click="setSpaceTableLayer" - >鏌ヨ</el-button - > - <el-button plain size="small" @click="restSpacePopLayer" - >閲嶇疆</el-button - > + <el-button + size="small" + plain + @click="setSpaceTableLayer" + >鏌ヨ</el-button> + <el-button + plain + size="small" + @click="restSpacePopLayer" + >閲嶇疆</el-button> </el-form-item> </el-form> <div class="centTable"> @@ -63,12 +71,30 @@ label="搴忓彿" width="50" /> - <el-table-column label="瀹氫綅" width="100" align="center"> + <el-table-column + label="瀹氫綅" + width="100" + align="center" + > <template slot-scope="scope"> <el-button icon="el-icon-map-location" size="small" @click="spaceLocation(scope.$index, scope.row)" + ></el-button> + </template> + </el-table-column> + <el-table-column + label="鏌辩姸鍥�" + width="100" + align="center" + v-show="spaceLayer== 'spaceLayer'" + > + <template slot-scope="scope"> + <el-button + icon="el-icon-map-location" + size="small" + @click="spaceHistogram(scope.$index, scope.row)" ></el-button> </template> </el-table-column> @@ -197,6 +223,8 @@ this.spaceLayer = this.$store.state.mapSpaceQueryLayer // this.showSpacePopLayer(); // this.getTableselectFields(); + + this.getDomainsLayer() }, @@ -371,6 +399,102 @@ 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]) + } + } + 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) { + 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]), + 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) + } + + + + + + + + + } + }, async spaceLocation(index, row) { var param = { gid: row.gid, -- Gitblit v1.9.3