| | |
| | | <queryinfo ref="queryinfo" /> |
| | | <!-- <div class="buffer-container" ></div> --> |
| | | <el-dialog |
| | | v-dialogDrag |
| | | custom-class="buffer-dialog" |
| | | top="40vh" |
| | | title="管道中心线查询" |
| | | :visible.sync="dialogFormVisible" |
| | | :modal="false" |
| | | :lock-scroll="false" |
| | | :close-on-click-modal="false" |
| | | width="25%" |
| | | @opened="dialogOpend" |
| | | > |
| | | <el-form :model="menuTopFrom" label-width="150px"> |
| | | <el-form-item label="管道中心线"> |
| | |
| | | <el-input-number |
| | | v-model="menuTopFrom.bufferSize" |
| | | placeholder="" |
| | | @change="handleBufferChange" |
| | | :step="500" |
| | | ></el-input-number> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="dialogFormVisible = false">取 消</el-button> |
| | | <el-button type="primary" @click="genBuffer">确 定</el-button> |
| | | <el-button type="primary" @click="changeBufferData">确 定</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | |
| | | import { getToken } from "@/utils/auth" |
| | | import * as turf from "@turf/turf" |
| | | import { wktToGeoJSON } from "@terraformer/wkt" |
| | | |
| | | export default { |
| | | components: { queryinfo }, |
| | | data() { |
| | |
| | | queryType: "", |
| | | pipeline: "", |
| | | segName: "", |
| | | bufferSize: 10, |
| | | bufferSize: 5000, |
| | | }, |
| | | treeChange: [], |
| | | layerData: [ |
| | |
| | | featureLayer: [], |
| | | analyGid: null, |
| | | dialogFormVisible: false, |
| | | bufferLinePosition: [], |
| | | } |
| | | }, |
| | | |
| | |
| | | this.menuTopFrom.queryType = "rectangle" |
| | | this.getAllTable() |
| | | this.getPipelineData() |
| | | }, |
| | | watch: { |
| | | analyGid(newVal, oldVal) { |
| | | if (newVal !== oldVal && this.dialogFormVisible) { |
| | | this.genBuffer() |
| | | } |
| | | }, |
| | | }, |
| | | methods: { |
| | | changeValue(value) { |
| | |
| | | if (obj.value == "inputFile") { |
| | | this.getMenuTopFile() |
| | | } else if (obj.value == "buffer") { |
| | | this.handleBuffer() |
| | | this.dialogFormVisible = true |
| | | } |
| | | }, |
| | | async getAllTable() { |
| | |
| | | std.alt = cartographic.height |
| | | return std |
| | | }, |
| | | handleBuffer() {}, |
| | | async getPipelineData() { |
| | | const data = await pipelines_selectSegNames() |
| | | if (data.code != 200) { |
| | |
| | | |
| | | if (item && wkt) { |
| | | const line = wktToGeoJSON(wkt) |
| | | // const line2 = wktToGeoJSON(wkt2) |
| | | |
| | | const position = line.coordinates |
| | | // const position2 = line2.coordinates |
| | | let position = line.coordinates |
| | | if (wkt.includes("MULTILINESTRING")) { |
| | | this.createBuffer(position.flat()) |
| | | } else { |
| | | this.createBuffer(position) |
| | | position = line.coordinates.flat() |
| | | } |
| | | this.bufferLinePosition = position |
| | | if (this.dialogFormVisible) { |
| | | this.createBuffer() |
| | | } |
| | | } |
| | | } |
| | | this.dialogFormVisible = false |
| | | let wkt = |
| | | "LINESTRING(114.82181424692999 33.697046488105,115.06065563205186 32.2808276171009,114.69405780892077 31.527280108790023)" |
| | | let wkt2 = |
| | | "MULTILINESTRING((115.35696516720873 33.51877172773311,117.76217256980829 32.44801812803422,118.69492094774364 32.31899881794112))" |
| | | |
| | | // console.log("line1", position) |
| | | // console.log("line2", position2) |
| | | }, |
| | | createBuffer(position) { |
| | | createBuffer() { |
| | | this.clearBufferEntities() |
| | | const position = this.bufferLinePosition |
| | | const buffRadius = this.menuTopFrom.bufferSize |
| | | var polylineF = turf.lineString(position) |
| | | var bufferd = turf.buffer(polylineF, buffRadius, { units: "meters" }) |
| | |
| | | }) |
| | | this.bufferEntities.push(bufferPolygon) |
| | | let res = hierarchy.positions |
| | | sgworld.Navigate.flyToObj(bufferPolygon) |
| | | this.flyEntity = res |
| | | }, |
| | | changeBufferData() { |
| | | this.dialogFormVisible = false |
| | | let res = this.flyEntity |
| | | let restVal, |
| | | std = [] |
| | | for (let i in res) { |
| | |
| | | } |
| | | restVal = turf.polygon([std], { name: "polygon" }) |
| | | |
| | | this.flyEntity = res |
| | | sgworld.Navigate.flyToObj(bufferPolygon) |
| | | console.log("bufferPolygon", res) |
| | | |
| | | console.log("bufferPolygon", restVal) |
| | | this.setJonToWKT(restVal) |
| | | }, |
| | | |
| | | pointsToDegreesArray(points) { |
| | | let degreesArray = [] |
| | | points.forEach(item => { |
| | |
| | | this.bufferEntities.forEach(entity => { |
| | | sgworld.Viewer.entities.remove(entity) |
| | | }) |
| | | this.flyEntity = null |
| | | }, |
| | | changeSelect2(res) { |
| | | var value = this.featureLayer |
| | |
| | | } |
| | | } |
| | | this.segNameOption = option |
| | | this.menuTopFrom.segName = option[0].segName || '<空>' |
| | | this.menuTopFrom.segName = option[0].segName || "<空>" |
| | | this.analyGid = option[0].gid |
| | | this.genBuffer() |
| | | }, |
| | | selectChangeGid(res) { |
| | | this.analyGid = res |
| | |
| | | }) |
| | | return restVal |
| | | }, |
| | | handleBufferChange(val, oldVal) { |
| | | this.createBuffer() |
| | | }, |
| | | dialogOpend() { |
| | | this.createBuffer() |
| | | } |
| | | }, |
| | | } |
| | | </script> |
| | |
| | | |
| | | <style lang="less"> |
| | | .menuBox { |
| | | .buffer-dialog { |
| | | background-color: rgba(244, 248, 255, 0.85) !important; |
| | | border: 1px solid rgba(32, 160, 255, 0.6); |
| | | color: #202020; |
| | | .el-dialog__header { |
| | | padding: 10px 20px; |
| | | border-bottom: 1px solid rgba(32, 160, 255, 0.6); |
| | | .el-dialog__wrapper { |
| | | pointer-events: none; |
| | | .buffer-dialog { |
| | | top: 355px; |
| | | background-color: rgba(244, 248, 255, 0.85) !important; |
| | | border: 1px solid rgba(32, 160, 255, 0.6); |
| | | color: #202020; |
| | | .el-dialog__body, |
| | | .el-dialog__header, |
| | | .el-dialog__footer { |
| | | pointer-events: auto; |
| | | } |
| | | .el-dialog__header { |
| | | padding: 10px 20px; |
| | | border-bottom: 1px solid rgba(32, 160, 255, 0.6); |
| | | |
| | | .el-dialog__headerbtn { |
| | | top: 10px; |
| | | font-size: 18px; |
| | | .el-dialog__headerbtn { |
| | | top: 10px; |
| | | font-size: 18px; |
| | | } |
| | | } |
| | | .el-form-item { |
| | | .el-input-number { |
| | | width: 202px; |
| | | } |
| | | } |
| | | } |
| | | .el-form-item { |
| | | .el-input-number { |
| | | width: 202px; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | </style> |