|
@@ -30,6 +30,29 @@
|
|
|
<span> 最大:{{ cutData.max || 0 }}米 </span>
|
|
|
<span> 平均:{{ cutData.avg || 0 }}米 </span>
|
|
|
</el-form-item>
|
|
|
+ <el-radio v-model="dsmtype" label="buffer">
|
|
|
+ 缓冲区获取高程
|
|
|
+ <el-input
|
|
|
+ v-model="form.buffer"
|
|
|
+ placeholder="修改缓冲区获取高程"
|
|
|
+ size="mini"
|
|
|
+ class="iwidth"
|
|
|
+ :disabled="dsmtype != 'buffer'"
|
|
|
+ @hange="getDsm()"
|
|
|
+ ></el-input
|
|
|
+ ></el-radio>
|
|
|
+ <el-radio v-model="dsmtype" label="pick">
|
|
|
+ 点击获取高程
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="mini"
|
|
|
+ class="iwidth"
|
|
|
+ :disabled="dsmtype != 'pick'"
|
|
|
+ @click="clickPoint"
|
|
|
+ >
|
|
|
+ 查询
|
|
|
+ </el-button>
|
|
|
+ </el-radio>
|
|
|
<el-form-item label="填挖基准:" v-if="radio == 'cut'" prop="height">
|
|
|
<!-- readonly="readonly" -->
|
|
|
<el-input
|
|
@@ -38,9 +61,6 @@
|
|
|
size="mini"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="缓冲区:" prop="height">
|
|
|
- <el-input v-model="form.buffer" placeholder="" size="mini"></el-input>
|
|
|
- </el-form-item>
|
|
|
<div class="sdatadiv">
|
|
|
分析结果:
|
|
|
<p v-for="(sitem, index) in sdata" :key="index">
|
|
@@ -82,7 +102,7 @@
|
|
|
import { getDsm, cutFill } from "@/api/analse";
|
|
|
import * as turf from "@turf/turf";
|
|
|
import parse from "wellknown";
|
|
|
-import { loadGeoJSON, download } from "@/utils/MapHelper/help.js";
|
|
|
+import { loadGeoJSON, download, pickPoint } from "@/utils/MapHelper/help.js";
|
|
|
import range from "@/components/mapview/range.vue"; ///mapview/range
|
|
|
export default {
|
|
|
name: "TerrainCutFillAnalysis",
|
|
@@ -90,11 +110,12 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
radio: "cut",
|
|
|
+ dsmtype: "",
|
|
|
sharedState: store.state,
|
|
|
loading: false,
|
|
|
form: {
|
|
|
height: "",
|
|
|
- buffer: 5,
|
|
|
+ buffer: "",
|
|
|
geom: "",
|
|
|
},
|
|
|
cutData: {},
|
|
@@ -123,6 +144,11 @@ export default {
|
|
|
watch: {},
|
|
|
//方法集合
|
|
|
methods: {
|
|
|
+ clickPoint() {
|
|
|
+ pickPoint(true, (lon, lat, height) => {
|
|
|
+ this.form.height = height.toFixed(2);
|
|
|
+ });
|
|
|
+ },
|
|
|
reset() {
|
|
|
this.cutData = {};
|
|
|
this.form = {
|
|
@@ -133,7 +159,9 @@ export default {
|
|
|
this.$refs.range.reset();
|
|
|
viewer.entities.removeAll();
|
|
|
viewer.dataSources.removeAll();
|
|
|
- viewer.scene.globe.removeAllModifyRegion();
|
|
|
+ // viewer.scene.globe.removeAllModifyRegion();
|
|
|
+ viewer.scene.globe.removeAllExtractRegion();
|
|
|
+ viewer.scene.globe.removeAllExcavationRegion();
|
|
|
},
|
|
|
submitData() {
|
|
|
var _temp = this.$refs.range.getRange();
|
|
@@ -155,7 +183,7 @@ export default {
|
|
|
} else {
|
|
|
result.push(c[0]);
|
|
|
result.push(c[1]);
|
|
|
- result.push(Number(this.cutData.midHeight));
|
|
|
+ result.push(0); //Number(this.cutData.midHeight)
|
|
|
}
|
|
|
});
|
|
|
return result;
|
|
@@ -166,7 +194,8 @@ export default {
|
|
|
return this.flatten(geojson.coordinates[0]);
|
|
|
}
|
|
|
if (geojson.type === "MultiPolygon") {
|
|
|
- return this.flatten(geojson.coordinates.map((polygon) => polygon[0]));
|
|
|
+ return this.flatten(geojson.coordinates[0]);
|
|
|
+ // return this.flatten(geojson.coordinates.map((polygon) => polygon[0]));
|
|
|
}
|
|
|
},
|
|
|
clear() {
|
|
@@ -174,7 +203,16 @@ export default {
|
|
|
},
|
|
|
|
|
|
async getDsm(geom) {
|
|
|
- let res = await getDsm({ geom, type: "all" });
|
|
|
+ if (geom) this.form.geom = geom;
|
|
|
+ if (!this.form.geom) {
|
|
|
+ this.$message.warning("请绘制或导入分析范围!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let res = await getDsm({
|
|
|
+ geom: this.form.geom,
|
|
|
+ type: "all",
|
|
|
+ buffer: this.form.buffer,
|
|
|
+ });
|
|
|
if (!res.data)
|
|
|
this.$message.error("抱歉!不在分析范围内,请在抱坡区进行分析");
|
|
|
this.cutData = {
|
|
@@ -182,10 +220,11 @@ export default {
|
|
|
max: res.data.max.toFixed(2),
|
|
|
avg: res.data.avg.toFixed(2),
|
|
|
};
|
|
|
+ this.form.height = res.data.avg.toFixed(2);
|
|
|
},
|
|
|
async cutFill() {
|
|
|
this.loading = true;
|
|
|
- let res = await cutFill(this.form);
|
|
|
+ let res = await cutFill({ ...this.form, buffer: undefined });
|
|
|
this.loading = false;
|
|
|
if (res.success) {
|
|
|
this.$refs.range.reset();
|
|
@@ -205,19 +244,47 @@ export default {
|
|
|
viewer.dataSources.removeAll();
|
|
|
loadGeoJSON(res.data.bottomGeom, "#1E90A8", params);
|
|
|
loadGeoJSON(res.data.midGeom, "#ff0000", params);
|
|
|
- let threeArray = [];
|
|
|
- threeArray = this.geojsonToFlatArray(parse(this.form.geom));
|
|
|
- this.extract(threeArray);
|
|
|
+ // let threeArray = this.geojsonToFlatArray(parse(this.form.geom));
|
|
|
+ // this.cutana(threeArray);
|
|
|
+ // this.smooth(threeArray);
|
|
|
+ let bthree = this.geojsonToFlatArray(parse(res.data.bottomGeom));
|
|
|
+ let mthree = this.geojsonToFlatArray(parse(res.data.midGeom));
|
|
|
+ console.log(parse(res.data.bottomGeom), bthree, "--");
|
|
|
+ this.extract(bthree);
|
|
|
+ console.log(parse(res.data.midGeom), mthree, "--");
|
|
|
+ this.cutana(mthree);
|
|
|
}
|
|
|
},
|
|
|
//地形抽出部分
|
|
|
extract(positions) {
|
|
|
- viewer.scene.globe.removeAllModifyRegion();
|
|
|
- viewer.scene.globe.addModifyRegion({
|
|
|
+ viewer.scene.globe.removeAllExtractRegion();
|
|
|
+ viewer.scene.globe.addExtractRegion({
|
|
|
+ name: "extract", //名称
|
|
|
+ position: positions, //区域
|
|
|
+ height: this.cutData.midHeight, //开挖深度
|
|
|
+ transparent: false, //封边是否透明
|
|
|
+ extractHeight: Number(this.cutData.midHeight), //抽出高度
|
|
|
+ granularity: 1, //精度
|
|
|
+ });
|
|
|
+ },
|
|
|
+ cutana(positions) {
|
|
|
+ console.log(positions, "----");
|
|
|
+ viewer.scene.globe.removeAllExcavationRegion();
|
|
|
+ viewer.scene.globe.addExcavationRegion({
|
|
|
name: "ggg",
|
|
|
position: positions,
|
|
|
+ height: Number(this.cutData.midHeight),
|
|
|
+ transparent: false,
|
|
|
});
|
|
|
},
|
|
|
+ //地形抽出部分
|
|
|
+ smooth(positions) {
|
|
|
+ // viewer.scene.globe.removeAllModifyRegion();
|
|
|
+ // viewer.scene.globe.addModifyRegion({
|
|
|
+ // name: "ggg",
|
|
|
+ // position: positions,
|
|
|
+ // });
|
|
|
+ },
|
|
|
ExportResult() {
|
|
|
var legends = [];
|
|
|
// legends.push({ name: "最小高程", value: this.cutData.min, unit: "米" });
|
|
@@ -244,6 +311,7 @@ export default {
|
|
|
padding: 20px;
|
|
|
box-sizing: border-box;
|
|
|
position: relative;
|
|
|
+ text-align: left;
|
|
|
.ruleForm {
|
|
|
width: 100%;
|
|
|
height: calc(100% - 120px);
|
|
@@ -260,6 +328,19 @@ export default {
|
|
|
text-align: left;
|
|
|
line-height: 40px;
|
|
|
}
|
|
|
+ .iwidth {
|
|
|
+ width: calc(100% - 120px);
|
|
|
+ margin-left: 20px;
|
|
|
+ }
|
|
|
+ /deep/ .el-button--mini {
|
|
|
+ background: #0f7ac8;
|
|
|
+ border: none;
|
|
|
+ border-radius: 0;
|
|
|
+ color: #fff;
|
|
|
+ width: 60px;
|
|
|
+ height: 26px;
|
|
|
+ font-size: 14px;
|
|
|
+ }
|
|
|
.ptitle {
|
|
|
width: 100px;
|
|
|
color: #cddeeb;
|