From 368b6c77a9516bfe76faf845dd77d92bb45c95d8 Mon Sep 17 00:00:00 2001 From: Surpriseplus <845948745@qq.com> Date: 星期五, 22 九月 2023 14:12:07 +0800 Subject: [PATCH] 空间查询,地名定位修改 --- src/components/MapView/mapSpacePop.vue | 1109 +++++++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 855 insertions(+), 254 deletions(-) diff --git a/src/components/MapView/mapSpacePop.vue b/src/components/MapView/mapSpacePop.vue index 661cf6b..ea93012 100644 --- a/src/components/MapView/mapSpacePop.vue +++ b/src/components/MapView/mapSpacePop.vue @@ -3,6 +3,44 @@ <div style="padding: 5px"> <el-form :inline="true" + :model="ruleForm" + class="demo-form-inline" + > + <el-form-item> + <el-input + size="small" + style="width:30vh" + v-model="ruleForm.fileName" + disabled + placeholder="璇疯緭鍏�..." + ></el-input> + </el-form-item> + <el-form-item> + <el-button + @click="conditionVisible = true" + size="small" + type="success" + >{{$t('common.lable6')}}</el-button> + <el-button + size="small" + @click="resetForm" + >閲嶇疆</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" + @click="spaceGeobody()" + >鍦拌川浣�</el-button> + </el-form-item> + </el-form> + <!-- <el-form + :inline="true" :model="formInline" class="demo-form-inline" > @@ -66,9 +104,9 @@ <!-- <el-button plain size="small" - >鍓栧垏鍥�</el-button> --> - </el-form-item> - </el-form> + >鍓栧垏鍥�</el-button> + </el-form-item> + </el-form> --> <div class="centTable"> <el-table :data="tableData" @@ -135,6 +173,84 @@ </el-pagination> </div> </div> + <el-dialog + :visible.sync="conditionVisible" + title="楂樼骇鏌ヨ" + width="44%" + :close-on-click-modal="false" + :modal="false" + > + + <el-form + :inline=" true" + :model="formSql" + class="demo-form-inline" + label-position="top" + > + + <el-form-item> + <el-select + @change="fieldChange($event)" + v-model="formSql.field" + :popper-append-to-body="false" + > + <el-option + v-for="item in filedsOption" + :key="item.field" + :label="item.alias" + :value="item.field" + > + </el-option> + </el-select> + </el-form-item> + <el-form-item> + <el-select + :popper-append-to-body="false" + v-model="formSql.condition" + > + <el-option + v-for="item in condOption" + :key="item.value" + :label="item.label" + :value="item.value" + > + </el-option> + </el-select> + </el-form-item> + <el-form-item v-show="!fromSqlflag"> + <el-input + v-model="formSql.value" + :placeholder="$t('shuJuGuanLi.shuJuJianSuo.queryContent')" + > </el-input> + </el-form-item> + <el-form-item v-show="fromSqlflag"> + <el-date-picker + v-model="formSql.date" + type="date" + placeholder="閫夋嫨鏃ユ湡" + value-format="yyyy-MM-dd" + > + </el-date-picker> + </el-form-item> + + </el-form> + + <span + slot="footer" + class="dialog-footer" + > + <el-button + size="small" + @click="startFiledAndcondition" + >鍙� 娑�</el-button> + <el-button + class="primaries" + size="small" + @click="appendQueryFilter" + >纭� 瀹�</el-button> + </span> + </el-dialog> + </div> </template> @@ -148,6 +264,7 @@ encr, } from "../../api/api.js" import * as turf from "@turf/turf" +import { conditions } from "../../views/Archive/Archive.js"; export default { computed: { storeTime() { @@ -156,6 +273,13 @@ }, data() { return { + conditionVisible: false, + filedsOption: [], + condOption: [], + ruleForm: { + fileName: "", + }, + fromSqlflag: false, count: 0, listdata: { pageIndex: 1, @@ -223,12 +347,32 @@ imagePoint: null, domainsLayer: null, querytype: null, + formSql: { + field: "", + condition: "", + value: "", + type: "", + date: "", + }, + geobodyCount: null, + outlineList: [ + { 'name': '绮夎川榛忓湡', 'color': 'rgba(139,106,77,1)' }, + { 'name': '娣ゆ偿璐ㄧ矇鍦�', 'color': 'rgba(141,85,69,1)' }, + { 'name': '鍦嗙牼', 'color': 'rgba(102,166,184,1)' }, + { 'name': '鍗电煶', 'color': 'rgba(54,83,173,1)' }, + { 'name': '娉ュ博', 'color': 'rgba(47,30,13,1)' }, + { 'name': '缁嗙爞', 'color': 'rgba(93,88,15,1)' }, + { 'name': '涓爞', 'color': 'rgba(164,140,21,1)' }, + { 'name': '娣ゆ偿璐ㄥ湡', 'color': 'rgba(75,74,78,1)' }, + { 'name': '鍏朵粬', 'color': 'rgba(225,225,225,1)' }, + ] } }, watch: { async storeTime(index) { this.spaceLayer = index - this.getDomainsLayer() + this.resetForm(); + // this.getDomainsLayer() // this.getTableselectFields(); // this.restSpacePopLayer(); }, @@ -237,12 +381,43 @@ this.spaceLayer = this.$store.state.mapSpaceQueryLayer // this.showSpacePopLayer(); // this.getTableselectFields(); - - - this.getDomainsLayer() + this.resetForm(); + // this.getDomainsLayer() }, methods: { + fieldChange(value) { + var obj = {}; + obj = this.filedsOption.find(function (item) { + return item.field === value; + }); + this.conditionChange(obj); + }, + conditionChange(res) { + this.formSql.field = res.field; + this.formSql.type = res.type; + if (res.type == "date" || res.type == "datetime") { + this.fromSqlflag = true; + } else { + this.fromSqlflag = false; + } + var std = []; + this.condOption = []; + if (res.type == "text" || res.type == "blob") { + std = conditions[0]; + } else if (res.type == "date" || res.type == "datetime") { + std = conditions[2]; + } else { + std = conditions[1]; + } + for (var i in std) { + this.condOption.push({ + label: std[i], + value: std[i], + }); + } + this.formSql.condition = this.condOption[0].value; + }, closeSpaceBox() { if (this.imagePoint != null) { sgworld.Creator.DeleteObject(this.imagePoint) @@ -291,8 +466,14 @@ this.formInline.region = this.options[0].value }, setListDataStart() { - this.listdata.pageSize = 10 - this.listdata.pageIndex = 1 + this.listdata = { + pageIndex: 1, + pageSize: 10, + name: null, + srid: 4326, + wkt: null, + filter: null, + } this.tableData = [] }, //鍒濆鍖栨煡璇㈡潯浠� @@ -326,9 +507,13 @@ async getTableselectFields() { const data = await inquiry_selectFields({ name: this.spaceLayer }) if (data.code != 200) { - this.$message.error("鍒楄〃璋冪敤澶辫触") + this.$message.error("鍒楄〃璋冪敤瀛楁澶辫触") + } + if (data.result.length == 0) { + this.$message("鍒楄〃璋冪敤瀛楁鏌ユ棤鏁版嵁") } + this.filedsOption = []; this.optionx = [] var valadata = data.result for (var i in valadata) { @@ -340,10 +525,63 @@ valadata[i].domainNa = this.getMatchDomainNa(valadata[i].domainNa) } this.optionx.push(valadata[i]) + this.filedsOption.push(valadata[i]) this.attributeData.push(valadata[i]) } } + this.startFiledAndcondition(); this.showSpacePopLayer() + }, + appendQueryFilter() { + if (this.formSql.type == "date" || this.formSql.type == "datetime") { + if (this.formSql.date == null) { + this.$message.error("璇疯緭鍏ヨ鏌ヨ鐨勪俊鎭�!"); + return; + } + } else { + if (this.formSql.value == "") { + this.$message.error("璇疯緭鍏ヨ鏌ヨ鐨勪俊鎭�!"); + return; + } + } + + if (this.ruleForm.fileName != "") { + this.ruleForm.fileName += " and "; + } + var val; + + if (this.formSql.type == "long" || this.formSql.type == "integer") { + val = parseInt(this.formSql.value); + } else if (this.formSql.type == "double") { + if (this.formSql.value.indexOf(".") != -1) { + val = this.formSql.value; + } else { + val = parseFloat(this.formSql.value).toFixed(1); + } + } else if ( + this.formSql.type == "date" || + this.formSql.type == "datetime" + ) { + var time = new Date(this.formSql.date); + var m = time.getMonth() + 1; + var d = time.getDate(); + var y = time.getFullYear(); + val = "'" + y + "-" + this.add0(m) + "-" + this.add0(d) + "'"; + } else { + val = "'" + this.formSql.value + "'"; + } + this.ruleForm.fileName += + this.formSql.field + " " + this.formSql.condition + " " + val; + + this.startFiledAndcondition(); + this.getSpaceTableLayer(); + }, + + startFiledAndcondition() { + this.conditionVisible = false; + this.conditionChange(this.filedsOption[0]); + this.formSql.value = ""; + this.formSql.date = new Date(); }, getMatchDomainNa(res) { var std = null @@ -356,49 +594,84 @@ }, //鍒濆鍖栨煡璇㈤槇鍊艰〃 async getDomainsLayer() { + this.$store.state.loading = true; const data = await inquiry_selectDomains({ name: this.spaceLayer }) if (data.code != 200) { - this.$message.error("鍒楄〃璋冪敤澶辫触") + this.$message.error("鍒楄〃闃堝�艰皟鐢ㄥけ璐�") } + // if (data.result.length == 0) { + // this.$message("鍒楄〃闃堝�兼煡鏃犳暟鎹�") + // } this.domainsLayer = data.result this.setListDataStart() this.getTableselectFields() }, + + + + resetForm() { + this.ruleForm.fileName = ""; + this.listdata.pageIndex = 1; + this.listdata.pageSize = 10; + //鑾峰彇table淇℃伅 + this.getDomainsLayer() + }, + //鍒濆鍖栨煡璇㈣〃鏍间俊鎭� async getSpaceTableLayer() { - this.listdata.name = this.spaceLayer - if (this.formInline.input == undefined || this.formInline.input == null) { - this.listdata.filter = null - } else { - var val - var value = this.formInline.input - if (this.querytype == "long" || this.querytype == "integer") { - val = parseInt(value) - } else if (this.querytype == "double") { - if (this.formSql.value.indexOf(".") != -1) { - val = value - } else { - val = parseFloat(value).toFixed(1) - } - } else if (this.querytype == "date" || this.querytype == "datetime") { - var time = new Date(value) - var m = time.getMonth() + 1 - var d = time.getDate() - var y = time.getFullYear() - val = "'" + y + "-" + this.add0(m) + "-" + this.add0(d) + "'" - } else { - val = "'" + value + "'" - } - this.listdata.filter = - this.formInline.name + " " + this.formInline.region + " " + val + this.listdata.name = this.spaceLayer + if (this.ruleForm.fileName != "") { + this.listdata.filter = this.ruleForm.fileName; + } else { + this.listdata.filter = null; + } + if (this.$store.state.pigCode) { + this.listdata.dirs = this.$store.state.pigCode; + } const data = await dataQuerySelectByPage(this.listdata) + this.$store.state.loading = false; if (data.code != 200) { - this.$message.error("鍒楄〃璋冪敤澶辫触") + return this.$message.error("鍒楄〃璋冪敤澶辫触") } + if (data.result.length == 0) { + return this.$message("鍒楄〃鏌ユ棤鏁版嵁") + } + + + + var val = data.result; + val = val.filter((res) => { + + if (res.dirName) { + res.dirid = res.dirName + } + if (res.depName) { + res.depid = res.depName + } + if (res.verName) { + res.verid = res.verName + } + if (res.updateName) { + res.updateuser = res.updateName + } + if (res.createName) { + res.createuser = res.createName + } + + if (res.createtime) { + res.createtime = this.format(res.createtime) + } + if (res.updatetime) { + res.createtime = this.format(res.updatetime) + } + return res + }) + + var val_Data = data.result this.count = data.count @@ -413,8 +686,10 @@ } } } - this.tableData = data.result - this.$refs.filterTable.doLayout() + + + this.tableData = val + // this.$refs.filterTable.doLayout() }, async setCartesianToEightFour(entities) { @@ -445,220 +720,176 @@ this.listdata.wkt = encr(wkt) const data = await dataQuerySelectByPage(this.listdata) + if (data.code != 200) { - this.$message.error("鍒楄〃璋冪敤澶辫触") + return 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); + this.count = data.count; + if (data.result.length == 0) { + return this.$message({ + message: '鏈煡璇㈠埌杞瓟鐐规暟鎹�', + type: 'warning' + }); + } else { + this.$message({ + message: '鏌辩姸鍥炬煡璇㈡垚鍔�', + type: 'success' + }); + setTimeout(() => { + var val = data.result; + val = val.filter((res) => { - 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, + if (res.dirName) { + res.dirid = res.dirName } - that.$store.state.propertiesFlag = "2" - } else { - that.$store.state.propertiesFlag = propertiesFlag - } - } else { - that.$store.state.propertiesFlag = propertiesFlag - } - }, Cesium.ScreenSpaceEventType.MOUSE_MOVE) + if (res.depName) { + res.depid = res.depName + } + if (res.verName) { + res.verid = res.verName + } + if (res.updateName) { + res.updateuser = res.updateName + } + if (res.createName) { + res.createuser = res.createName + } + + if (res.createtime) { + res.createtime = this.format(res.createtime) + } + if (res.updatetime) { + res.createtime = this.format(res.updatetime) + } + return res + }) + + + + this.tableData = val; + this.geobodyCount = data.count; + this.showHistogramLayer(data.count) + this.$refs.filterTable.doLayout(); + var that = this; + + window.histogramHandler = new Cesium.ScreenSpaceEventHandler( + sgworld.Viewer.scene.canvas + ) + window.histogramHandler.setInputAction((event) => { + var pick = sgworld.Viewer.scene.pick(event.endPosition); + if (pick) { + + 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 { + if (propertiesFlag == 1) { + that.$store.state.propertiesFlag = propertiesFlag + } else { + that.$store.state.propertiesFlag = null + } + } + } else { + if (propertiesFlag == 1) { + that.$store.state.propertiesFlag = propertiesFlag + } else { + that.$store.state.propertiesFlag = null + } + } + } + + }, Cesium.ScreenSpaceEventType.MOUSE_MOVE) + }, 500); + } + + }, async showHistogramLayer(res) { var obj = { pageIndex: 1, pageSize: res, wkt: this.listdata.wkt, - name: this.listdata.name + name: this.listdata.name, + hasGeom: 1, } const data = await dataQuerySelectByPage(obj) if (data.code != 200) { return } var val = data.result; - for (var i in val) { - this.setShowHistogramLayer(val[i]) - } + // for (var i in val) { + this.setShowHistogramLayer(val) + // } }, async setShowHistogramLayer(res) { - var param = { - gid: res.gid, - name: this.spaceLayer, + var gid = []; + for (var i in res) { + + gid.push(res[i].exppointid) } - 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 = '" + res.exppointid + "'" - } - var data = await dataQuerySelectByPage(obj) - 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]; - 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 = res.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) - } - - - - - } - - }, - - - - - 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, + // 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 - // var obj = { - // pageIndex: 1, - // pageSize: 10, - // name: 'sexplorationpointstratum', - // filter: "exppointid = '" + row.exppointid + "'" - // } - // var data = await dataQuerySelectByPage(obj) - // if (data.code != 200) { - - // } - + var obj = { + pageIndex: 1, + pageSize: 100000000, + name: 'sexplorationpointstratum', + filter: "exppointid in '" + gid.toString() + "'" + } + var data = await dataQuerySelectByPage(obj) + if (data.code != 200) { return } + if (data.result.length == 0) { + return this.$message('鏌ユ棤鏁版嵁'); + } + for (var i in res) { + this.setHistogramLayer(res[i], data.result) + } // 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; - // } + // //鍐掓场鎺掑簭 + // 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 num = res.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 line; + + // var geoname = val[i].geoname; + // var col = outlineList.filter((res) => { + // if (res.name == geoname) { + // return res + // } + // }) + // line = col[0].color // var height = num - val[i].botdepth // var layer = Viewer.entities.add({ // position: Cesium.Cartesian3.fromDegrees(coord[0], coord[1]), @@ -678,43 +909,379 @@ // }); // 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); + // // } + // + }, + setHistogramLayer(res, data) { + + var exppointid = res.exppointid; + + var val1 = decr(res.geom) + var wkt = this.$wkt.parse(val1) + var coord = wkt.coordinates; + + var std = []; + var num = res.elev == null ? 0 : res.elev; + + var height = 0; + for (var i in data) { + if (data[i].exppointid == exppointid) { + std.push(data[i]) + } + } + + var outlineList = this.outlineList; + if (std.length > 0) { + for (var i in std) { + var line; + var geoname = std[i].geoname; + var col = outlineList.filter((ste) => { + if (ste.name == geoname) { + return res + } + }) + + if (col.length == 0) { + col = outlineList.filter((ste) => { + if (ste.name == '鍏朵粬') { + return res + } + }) + } + line = col[0].color + + var height = num - std[i].botdepth + // console.log(num, std[i].botdepth) + var layer = Viewer.entities.add({ + position: Cesium.Cartesian3.fromDegrees(coord[0], coord[1]), + tag: 'Histogram', + properties: std[i], + ellipse: { + semiMinorAxis: 2.0, //鐭酱 + semiMajorAxis: 2.0, //闀胯酱 + height: height, //鎷変几楂樺害 elev gwaterdep + extrudedHeight: num, //绂诲湴楂樺害 + rotation: Cesium.Math.toRadians(0), //鏃嬭浆 + fill: true, //鏄惁鏄剧ず鍦嗙殑濉厖 + material: Cesium.Color.fromCssColorString(line), //鍦嗙殑棰滆壊, + outline: false, //鏄惁鏄剧ず鍦嗚疆寤� + + }, + }); + num -= std[i].botdepth; + this.$store.state.histogramLayer.push(layer) + } + this.$store.state.histLenged = true; + } + + + + }, + + + + spaceHistogram() { + this.resetForm(); + 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 entitys = Viewer.entities._entities._array; + for (var i = 0; i < entitys.length; i++) { + if (entitys[i]._name === "鍦拌川浣撴ā鍨�") { + Viewer.entities.remove(entitys[i]); + i--; + } + } + this.geobodyCount = null; + var that = this; + sgworld.Creator.createSimpleGraphic('rectangle', { showSize: false }, function (entity) { + sgworld.Creator.SimpleGraphic.remove(entity.id); + that.setCartesianToEightFour(entity) + }); + + }, + async spaceGeobody() { + var entitys = Viewer.entities._entities._array; + for (var i = 0; i < entitys.length; i++) { + if (entitys[i]._name === "鍦拌川浣撴ā鍨�") { + Viewer.entities.remove(entitys[i]); + i--; + } + } + + if (this.geobodyCount) { + + var obj = { + pageIndex: 1, + pageSize: this.geobodyCount, + wkt: this.listdata.wkt, + name: this.listdata.name, + hasGeom: 1, + } + const data = await dataQuerySelectByPage(obj) + if (data.code != 200) { + return + } + var gid = []; + var val = data.result; + for (var i in val) { + gid.push(val[i].exppointid) + } + var obj = { + pageIndex: 1, + pageSize: 100000000, + name: 'sexplorationpointstratum', + filter: "exppointid in '" + gid.toString() + "'" + } + var data2 = await dataQuerySelectByPage(obj) + + if (data2.code == 200) { + var val2 = data2.result; + var std = []; + for (var i in val) { + var soilLayers = []; + + for (var j in val2) { + if (val2[j].exppointid == val[i].exppointid) { + soilLayers.push(val2[j]) + } + } + var val1 = decr(val[i].geom) + var wkt = this.$wkt.parse(val1) + var coord = wkt.coordinates + std.push({ + bh: val[i].exppointid, + X: coord[0], + Y: coord[1], + Z: val[i].elev, + soilLayers: soilLayers + }) + } + this.setLayerByZFBH(std); + } + + } else { + return this.$message('鏈煡璇㈠埌杞瓟鐐规暟鎹�,鏃犳硶鐢熸垚鍦拌川浣�'); + } + }, + setLayerByZFBH(res) { + var list = [ + { 'name': '绮夎川榛忓湡', 'color': [139, 106, 77, 1] }, + { 'name': '娣ゆ偿璐ㄧ矇鍦�', 'color': [141, 85, 69, 1] }, + { 'name': '鍦嗙牼', 'color': [102, 166, 184, 1] }, + { 'name': '鍗电煶', 'color': [54, 83, 173, 1] }, + { 'name': '娉ュ博', 'color': [47, 30, 13, 1] }, + { 'name': '缁嗙爞', 'color': [93, 88, 15, 1] }, + { 'name': '涓爞', 'color': [164, 140, 21, 1] }, + { 'name': '娣ゆ偿璐ㄥ湡', 'color': [75, 74, 78, 1] }, + { 'name': '鍏朵粬', 'color': [225, 225, 225, 1] } + ] + for (var i = 0; i < list.length; i++) { + var out_color = list[i].color + var color = new Cesium.Color(out_color[0] / 255.0, out_color[1] / 255.0, out_color[2] / 255.0).withAlpha(0.9) + this.CreateLayerByZFBH(list[i].name, res, color) + + } + // var color = new Cesium.Color(139 / 255, 106 / 255, 77 / 255).withAlpha(0.9) + // this.CreateLayerByZFBH("娣ゆ偿璐ㄧ矇鍦�", res, color) + + }, + CreateLayerByZFBH(zfbh, jsonObj, materialColor) { + + var featurePoints = []; + var featurePoints1 = []; + let points = turf.featureCollection([]); + for (let i = 0; i < jsonObj.length; i++) { + var p = jsonObj[i]; + var layers = p.soilLayers; + points.features.push(turf.point([parseFloat(p.X), parseFloat(p.Y)], { alt: p.Z })); + for (let j = 0; j < layers.length; j++) { + let obj = layers[j]; + + if (obj.geoname == zfbh) { + if (j == 0) { + + featurePoints.push(...[parseFloat(p.X), parseFloat(p.Y), parseFloat(p.Z)]); + featurePoints1.push(...[parseFloat(p.X), parseFloat(p.Y), (parseFloat(p.Z) - parseFloat(obj.botdepth))]); + } else { + let obj_height = this.GetRealHeight(j, layers, p.Z); + + featurePoints.push(...[parseFloat(p.X), parseFloat(p.Y), parseFloat(obj_height.topHeight)]); + featurePoints1.push(...[parseFloat(p.X), parseFloat(p.Y), parseFloat(obj_height.bottomHeight)]); + + } + + } + } + } + this.CreateSoilLayer(featurePoints, featurePoints1, materialColor); + }, + CreateSoilLayer(abovePoints, underPoints, materialColor) { + let aboveCollection = this.CreateCollectionByArray(abovePoints); + let underCollection = this.CreateCollectionByArray(underPoints); + //璁$畻鎻掑�� + let options = { gridType: "points", property: "alt", units: "miles" }; + let aboveGrid = turf.interpolate(aboveCollection, 0.01, options); + let underGrid = turf.interpolate(underCollection, 0.01, options); + //鍒涘缓tin闈� + let aboveTin = turf.tin(aboveGrid, "alt"); + let underTin = turf.tin(underGrid, "alt"); + //鑾峰彇tin闈㈢殑鍑犱釜椤剁偣 + let aboveHull = turf.convex(aboveTin); + let underHull = turf.convex(underTin); + + //缁勮椤跺簳闈㈠洓涓《鐐� + this.CreateRoundMian(aboveTin, aboveHull, underTin, underHull, materialColor); + //鍒涘缓闈� + this.CreateTin(aboveTin, materialColor); + this.CreateTin(underTin, materialColor); + }, + + CreateRoundMian(tinArr, hull, tinArr1, hull1, materialColor) { + if (!hull) { + return; + } + let left = turf.lineIntersect(tinArr, turf.lineString([[hull.geometry.coordinates[0][0][0], hull.geometry.coordinates[0][0][1]], [hull.geometry.coordinates[0][1][0], hull.geometry.coordinates[0][1][1]]])); + let right = turf.lineIntersect(tinArr, turf.lineString([[hull.geometry.coordinates[0][1][0], hull.geometry.coordinates[0][1][1]], [hull.geometry.coordinates[0][2][0], hull.geometry.coordinates[0][2][1]]])); + let top = turf.lineIntersect(tinArr, turf.lineString([[hull.geometry.coordinates[0][2][0], hull.geometry.coordinates[0][2][1]], [hull.geometry.coordinates[0][3][0], hull.geometry.coordinates[0][3][1]]])); + let bottom = turf.lineIntersect(tinArr, turf.lineString([[hull.geometry.coordinates[0][3][0], hull.geometry.coordinates[0][3][1]], [hull.geometry.coordinates[0][4][0], hull.geometry.coordinates[0][4][1]]])); + let left1 = turf.lineIntersect(tinArr1, turf.lineString([[hull1.geometry.coordinates[0][0][0], hull1.geometry.coordinates[0][0][1]], [hull1.geometry.coordinates[0][1][0], hull1.geometry.coordinates[0][1][1]]])); + let right1 = turf.lineIntersect(tinArr1, turf.lineString([[hull1.geometry.coordinates[0][1][0], hull1.geometry.coordinates[0][1][1]], [hull1.geometry.coordinates[0][2][0], hull1.geometry.coordinates[0][2][1]]])); + let top1 = turf.lineIntersect(tinArr1, turf.lineString([[hull1.geometry.coordinates[0][2][0], hull1.geometry.coordinates[0][2][1]], [hull1.geometry.coordinates[0][3][0], hull1.geometry.coordinates[0][3][1]]])); + let bottom1 = turf.lineIntersect(tinArr1, turf.lineString([[hull1.geometry.coordinates[0][3][0], hull1.geometry.coordinates[0][3][1]], [hull1.geometry.coordinates[0][4][0], hull1.geometry.coordinates[0][4][1]]])); + // console.log(left); + // console.log(intPoints); + // console.log(tinArr); + this.SetAltAttribut(tinArr, left); + this.SetAltAttribut(tinArr, right); + this.SetAltAttribut(tinArr, top); + this.SetAltAttribut(tinArr, bottom); + this.SetAltAttribut(tinArr1, left1); + this.SetAltAttribut(tinArr1, right1); + this.SetAltAttribut(tinArr1, top1); + this.SetAltAttribut(tinArr1, bottom1); + ///缁樺埗闈� + this.CreateSoilLayerRound(left, left1, materialColor); + this.CreateSoilLayerRound(right, right1, materialColor); + this.CreateSoilLayerRound(top, top1, materialColor); + this.CreateSoilLayerRound(bottom, bottom1, materialColor); + }, + SetAltAttribut(tinarr, points) { + for (let i = 0; i < tinarr.features.length; i++) { + for (let j = 0; j < points.features.length; j++) { + if (!turf.booleanDisjoint(tinarr.features[i].geometry, points.features[j].geometry)) { + for (let n = 0; n < tinarr.features[i].geometry.coordinates[0].length; n++) { + if (tinarr.features[i].geometry.coordinates[0][n][0] == points.features[j].geometry.coordinates[0] && tinarr.features[i].geometry.coordinates[0][n][1] == points.features[j].geometry.coordinates[1]) { + if (n == 0) { + points.features[j].properties.alt = tinarr.features[i].properties.a; + break; + } + if (n == 1) { + points.features[j].properties.alt = tinarr.features[i].properties.b; + break; + } + if (n == 2) { + points.features[j].properties.alt = tinarr.features[i].properties.c; + break; + } + } + + } + } + } + } + }, + CreateCollectionByArray(arr) { + let newCollection = turf.featureCollection([]); + for (let i = 0; i < arr.length; i += 3) { + let tmpPoint = turf.point([arr[i], arr[i + 1]], { + alt: arr[i + 2] + }); + newCollection.features.push(tmpPoint); + } + return newCollection; + }, + + CreateTin(tin, materialColor) { + for (let n = 0; n < tin.features.length; n++) { + let geoms = tin.features[n].geometry.coordinates[0]; + + let points = []; + let p1 = new Cesium.Cartesian3.fromDegrees(geoms[0][0], geoms[0][1], tin.features[n].properties.a); + let p2 = new Cesium.Cartesian3.fromDegrees(geoms[1][0], geoms[1][1], tin.features[n].properties.b); + let p3 = new Cesium.Cartesian3.fromDegrees(geoms[2][0], geoms[2][1], tin.features[n].properties.c); + points.push(p1) + points.push(p2) + points.push(p3) + let aa = Viewer.entities.add({ + name: '鍦拌川浣撴ā鍨�', + polygon: { + hierarchy: new Cesium.PolygonHierarchy(points), + material: materialColor, + // material: new Cesium.Color(Math.random() * 255, Math.random() * 255, Math.random() * 255), + perPositionHeight: true + } + }); + Viewer.flyTo(aa) + } + }, + CreateSoilLayerRound(above, under, materialColor) { + for (let i = 0; i < under.features.length; i++) { + above.features.push(under.features[under.features.length - 1 - i]); + } + + let points = []; + for (let j = 0; j < above.features.length; j++) { + let geo = above.features[j].geometry.coordinates; + let alt = above.features[j].properties.alt; + let p = new Cesium.Cartesian3.fromDegrees(geo[0], geo[1], alt); + points.push(p); + } + Viewer.entities.add({ + name: '鍦拌川浣撴ā鍨�', + polygon: { + hierarchy: new Cesium.PolygonHierarchy(points), + material: materialColor, + + perPositionHeight: true + } + }); + }, + GetRealHeight(index, arr, parentZ) { + + var top = 0; + var bottom = 0; + var std = 0; + var start = index + 1 + var end = index - 1; + for (let i = 0; i < start; i++) { + std += parseFloat(arr[i].botdepth) + + if (i == end) { + + top = parseFloat(parentZ - std).toFixed(6); + + } + + bottom = parseFloat(parentZ - std).toFixed(6); + } + + + return { + topHeight: top, + bottomHeight: bottom + }; }, async spaceLocation(index, row) { var param = { @@ -785,7 +1352,6 @@ this.$store.state.queryInfo.push(point) sgworld.Navigate.flyToObj(point) this.$store.state.primitLayer = point - break case "LineString": case "MultiLineString": @@ -833,6 +1399,7 @@ this.setMapHandler() }, setMapHandler() { + var that = this; window.propertieshandler = new Cesium.ScreenSpaceEventHandler( sgworld.Viewer.scene.canvas ) @@ -844,6 +1411,13 @@ pick.id.tag && pick.id.tag.includes("properties_") ) { + if (this.spaceLayer == 'msurfacedeformationdata') { + this.$store.state.surfaceDeForm.flag = true; + this.$store.state.surfaceDeForm.gid = pick.id.properties.gid._value; + } else { + this.$store.state.surfaceDeForm.flag = false; + this.$store.state.surfaceDeForm.gid = null; + } this.$store.state.propertiesFlag = "1" let properties = pick.id.properties let propertyNames = pick.id.properties.propertyNames @@ -857,14 +1431,41 @@ } }) }) + if (obj['鏇存柊鏃堕棿']) { + obj['鏇存柊鏃堕棿'] = that.format(obj['鏇存柊鏃堕棿']) + } + if (obj['鍒涘缓鏃堕棿']) { + + + obj['鍒涘缓鏃堕棿'] = that.format(obj['鍒涘缓鏃堕棿']) + } + this.$store.state.propertiesInfo = obj } }, Cesium.ScreenSpaceEventType.LEFT_CLICK) }, + //鏍煎紡鍖栨椂闂� + format(shijianchuo) { + //shijianchuo鏄暣鏁帮紝鍚﹀垯瑕乸arseInt杞崲 + var time = new Date(shijianchuo); + var y = time.getFullYear(); + var m = time.getMonth() + 1; + var d = time.getDate(); + var h = time.getHours(); + var mm = time.getMinutes(); + var s = time.getSeconds(); + return y + "-" + this.add0(m) + "-" + this.add0(d); + }, + //鏍煎紡鍖栨椂闂� + add0(m) { + return m < 10 ? "0" + m : m; + }, + }, + destroyed() { this.$store.state.propertiesFlag = null - if (propertieshandler != null && Cesium.defined(propertieshandler)) { + if (window.propertieshandler != null && Cesium.defined(window.propertieshandler)) { window.propertieshandler.removeInputAction( Cesium.ScreenSpaceEventType.LEFT_CLICK ) @@ -899,7 +1500,7 @@ } .bottomPage { position: absolute; - bottom: 3%; + bottom: 10px; } /deep/.el-form-item { margin-bottom: 0px; -- Gitblit v1.9.3