| | |
| | | <el-form-item v-if="spaceLayer == 'sexplorationpoint'"> |
| | | <el-button |
| | | size="small" |
| | | @click="spaceHistogram( )" |
| | | @click="spaceHistogram()" |
| | | plain |
| | | >柱状图</el-button> |
| | | <!-- <el-button |
| | | <el-button |
| | | plain |
| | | size="small" |
| | | >剖切图</el-button> --> |
| | | @click="spaceGeobody()" |
| | | >地质体</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <!-- <el-form |
| | |
| | | imagePoint: null, |
| | | domainsLayer: null, |
| | | querytype: null, |
| | | |
| | | formSql: { |
| | | field: "", |
| | | condition: "", |
| | |
| | | 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)' } |
| | | ] |
| | | } |
| | | }, |
| | | watch: { |
| | |
| | | |
| | | |
| | | this.tableData = val; |
| | | |
| | | this.geobodyCount = data.count; |
| | | this.showHistogramLayer(data.count) |
| | | this.$refs.filterTable.doLayout(); |
| | | var that = this; |
| | |
| | | gid: res.gid, |
| | | name: this.spaceLayer, |
| | | } |
| | | |
| | | const data1 = await dataQuerySelectWktById(param) |
| | | if (data1.code != 200) { |
| | | this.$message.error("列表调用失败") |
| | |
| | | } |
| | | 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; |
| | | } |
| | | } |
| | | } |
| | | // //冒泡排序 |
| | | // 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 = [ |
| | | { '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)' } |
| | | ] |
| | | var outlineList = this.outlineList |
| | | var num = res.elev; |
| | | var height = 0; |
| | | for (var i = 0; i < val.length; i++) { |
| | |
| | | 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]), |
| | |
| | | num -= val[i].botdepth; |
| | | this.$store.state.histogramLayer.push(layer) |
| | | } |
| | | } else { |
| | | return this.$message('查无数据'); |
| | | } |
| | | this.$store.state.histLenged = true; |
| | | }, |
| | |
| | | ) |
| | | 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); |
| | |
| | | }); |
| | | |
| | | }, |
| | | 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 |
| | | } |
| | | const data = await dataQuerySelectByPage(obj) |
| | | if (data.code != 200) { |
| | | return |
| | | } |
| | | var val = data.result; |
| | | var std = []; |
| | | for (var i in val) { |
| | | var param = { |
| | | gid: val[i].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 = '" + val[i].exppointid + "'" |
| | | } |
| | | var data2 = await dataQuerySelectByPage(obj) |
| | | |
| | | if (data2.code == 200) { |
| | | |
| | | std.push({ |
| | | bh: val[i].exppointid, |
| | | X: coord[0], |
| | | Y: coord[1], |
| | | Z: val[i].elev, |
| | | soilLayers: data2.result |
| | | }) |
| | | } |
| | | } |
| | | 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] } |
| | | ] |
| | | 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 = { |
| | | gid: row.gid, |