/* * @Author: Morpheus * @Name: 地图测距 * @Date: 2021-11-13 16:04:27 * @Last
|
Modified by: Morpheus * @Last Modified time: 2022-02-15 14:28:44 */
|
|
<template>
|
<public-box class="technique-box">
|
<template slot="public-box-header">
|
<div class="title">
|
<span>三维空间分析</span>
|
</div>
|
<img class="close deblurring" src="/img/navicon/close.png" alt @click="closeModel" />
|
</template>
|
<template slot="public-box-content">
|
<ul>
|
<li>
|
点位缓冲
|
<el-switch
|
v-model="pointShow"
|
:active-value="true"
|
:inactive-value="false"
|
@change="pointChange"
|
></el-switch>
|
</li>
|
<li>
|
线缓冲
|
<el-switch
|
v-model="plineShow"
|
:active-value="true"
|
:inactive-value="false"
|
@change="plineChange"
|
></el-switch>
|
</li>
|
<li>
|
面缓冲
|
<el-switch
|
v-model="regionShow"
|
:active-value="true"
|
:inactive-value="false"
|
@change="regionChange"
|
></el-switch>
|
</li>
|
</ul>
|
</template>
|
</public-box>
|
</template>
|
|
<script>
|
|
let pointTrufLayer = null
|
let pointTrufPolygon = null
|
let pointTrufPoint = null
|
|
let plineTrufLayer = null
|
let plineTrufPolygon = null
|
let plineTrufPline = null
|
|
let regionTrufLayer = null
|
let regionTrufRegion = null
|
let regionTrufPolygon = null
|
|
export default {
|
data () {
|
return {
|
pointShow: false,
|
plineShow: false,
|
regionShow: false
|
}
|
},
|
mounted () {
|
},
|
methods: {
|
closeModel () {
|
this.$router.push('/pcLayout/default')
|
},
|
loadPoint () {
|
pointTrufLayer = new global.DC.VectorLayer('pointTrufLayer')
|
global.viewer.addLayer(pointTrufLayer)
|
pointTrufPoint = new global.DC.Point('114.0415,27.6299,150')
|
pointTrufLayer.addOverlay(pointTrufPoint)
|
const coords = global.DC.GeoTools.pointBuffer('114.0415,27.6299', 50)
|
pointTrufPolygon = new global.DC.Polygon(coords)
|
pointTrufPolygon.setStyle({
|
material: global.DC.Color.RED.withAlpha(0.4)
|
})
|
pointTrufLayer.addOverlay(pointTrufPolygon)
|
global.viewer.flyTo(pointTrufLayer)
|
},
|
removePoint () {
|
pointTrufPoint != null && pointTrufLayer.removeOverlay(pointTrufPoint)
|
pointTrufPolygon != null && pointTrufLayer.removeOverlay(pointTrufPolygon)
|
pointTrufLayer != null && global.viewer.removeLayer(pointTrufLayer)
|
pointTrufPoint = null
|
pointTrufPolygon = null
|
pointTrufLayer = null
|
},
|
pointChange (e) {
|
if (e) {
|
this.loadPoint()
|
} else {
|
this.removePoint()
|
}
|
},
|
loadPline () {
|
plineTrufLayer = new global.DC.VectorLayer('plineTrufLayer')
|
global.viewer.addLayer(plineTrufLayer)
|
plineTrufPline = new global.DC.Polyline('114.0411,27.62997062,152;114.0418,27.62997062,152')
|
plineTrufPline.setStyle({
|
width: 2,
|
material: global.DC.Color.YELLOW,
|
zIndex: 1
|
})
|
plineTrufLayer.addOverlay(plineTrufPline)
|
const coords = global.DC.GeoTools.polylineBuffer('114.0411,27.62997062;114.0418,27.62997062', 50)
|
plineTrufPolygon = new global.DC.Polygon(coords)
|
plineTrufPolygon.setStyle({
|
material: global.DC.Color.RED.withAlpha(0.4)
|
})
|
plineTrufLayer.addOverlay(plineTrufPolygon)
|
global.viewer.flyTo(plineTrufLayer)
|
},
|
removePline () {
|
plineTrufPline != null && plineTrufLayer.removeOverlay(plineTrufPline)
|
plineTrufPolygon != null && plineTrufLayer.removeOverlay(plineTrufPolygon)
|
plineTrufLayer != null && global.viewer.removeLayer(plineTrufLayer)
|
plineTrufPline = null
|
plineTrufPolygon = null
|
plineTrufLayer = null
|
},
|
plineChange (e) {
|
if (e) {
|
this.loadPline()
|
} else {
|
this.removePline()
|
}
|
},
|
loadRegion () {
|
regionTrufLayer = new global.DC.VectorLayer('regionTrufLayer')
|
global.viewer.addLayer(regionTrufLayer)
|
regionTrufRegion = new global.DC.Polygon('114.0410,27.6299,152;114.0418,27.6312,152;114.0426,27.6299,152')
|
regionTrufRegion.setStyle({
|
zIndex: 1,
|
material: global.DC.Color.YELLOW
|
})
|
regionTrufLayer.addOverlay(regionTrufRegion)
|
const coords = global.DC.GeoTools.polygonBuffer('114.0410,27.6299;114.0415,27.6312;114.0426,27.6299', 150)
|
regionTrufPolygon = new global.DC.Polygon(coords)
|
regionTrufPolygon.setStyle({
|
material: global.DC.Color.RED.withAlpha(0.4)
|
})
|
regionTrufLayer.addOverlay(regionTrufPolygon)
|
global.viewer.flyTo(regionTrufLayer)
|
},
|
removeRegion () {
|
regionTrufRegion != null && regionTrufLayer.removeOverlay(regionTrufRegion)
|
regionTrufPolygon != null && regionTrufLayer.removeOverlay(regionTrufPolygon)
|
regionTrufLayer != null && global.viewer.removeLayer(regionTrufLayer)
|
regionTrufRegion = null
|
regionTrufPolygon = null
|
regionTrufLayer = null
|
},
|
regionChange (e) {
|
if (e) {
|
this.loadRegion()
|
} else {
|
this.removeRegion()
|
}
|
}
|
},
|
destroyed () {
|
this.removePoint()
|
this.removePline()
|
this.removeRegion()
|
}
|
}
|
</script>
|
|
<style lang="sass" scoped>
|
.move
|
cursor: move
|
</style>
|