/* * @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="sunlightShow"
|
:active-value="true"
|
:inactive-value="false"
|
@change="sunlightChange"
|
></el-switch>
|
</li>
|
<li>
|
通视分析(圆)
|
<el-button type="primary" size="mini" @click="drawCircle">标绘</el-button>
|
<el-button type="primary" size="mini" @click="removeCircle">清除</el-button>
|
</li>
|
<li>
|
可视域分析
|
<el-switch
|
v-model="visualShow"
|
:active-value="true"
|
:inactive-value="false"
|
@change="visualChange"
|
></el-switch>
|
</li>
|
</ul>
|
</template>
|
</public-box>
|
</template>
|
|
<script>
|
|
let sunlightLayer = null
|
let tileset = null
|
let plot = null
|
|
let visualLayer = null
|
let visualTileset = null
|
|
export default {
|
data () {
|
return {
|
sunlightShow: false,
|
visualShow: false
|
}
|
},
|
mounted () {
|
plot = new global.DC.Plot(global.viewer, {
|
clampToGround: false
|
})
|
|
global.viewer.use(new global.DC.Analysis())
|
},
|
methods: {
|
closeModel () {
|
this.$router.push('/pcLayout/default')
|
},
|
loadSunlight () {
|
sunlightLayer = new global.DC.TilesetLayer('sunlightLayer')
|
global.viewer.addLayer(sunlightLayer)
|
tileset = new global.DC.Tileset(
|
'http://resource.dvgis.cn/data/3dtiles/ljz/tileset.json'
|
)
|
const style = new global.DC.TilesetStyle()
|
style.color = {
|
conditions: [
|
['${Height} >= 300', 'rgba(45, 0, 75, 0.5)'],
|
['${Height} >= 200', 'rgb(102, 71, 151)'],
|
['${Height} >= 100', 'rgb(170, 162, 204)'],
|
['${Height} >= 50', 'rgb(224, 226, 238)'],
|
['${Height} >= 25', 'rgb(252, 230, 200)'],
|
['${Height} >= 10', 'rgb(248, 176, 87)'],
|
['${Height} >= 5', 'rgb(198, 106, 11)'],
|
['true', 'rgb(127, 59, 8)']
|
]
|
}
|
tileset.setStyle(style)
|
sunlightLayer.addOverlay(tileset)
|
global.viewer.flyTo(tileset)
|
|
global.viewer.analysis.shadows(new Date(), 1600)
|
},
|
removeSunlight () {
|
global.viewer.analysis.deactivate(global.DC.AnalysisType.SHADOWS)
|
tileset != null && sunlightLayer.removeOverlay(tileset)
|
sunlightLayer != null && global.viewer.removeLayer(sunlightLayer)
|
tileset = null
|
sunlightLayer = null
|
},
|
sunlightChange (e) {
|
if (e) {
|
this.loadSunlight()
|
} else {
|
this.removeSunlight()
|
}
|
},
|
drawCircle () {
|
global.viewer.analysis.deactivate(global.DC.AnalysisType.SIGHT_CIRCLE)
|
plot.draw(global.DC.OverlayType.CIRCLE, overlay => {
|
global.viewer.analysis.sightCircle(overlay.center, overlay.radius, [])
|
})
|
},
|
removeCircle () {
|
global.viewer.analysis.deactivate(global.DC.AnalysisType.SIGHT_CIRCLE)
|
},
|
loadVisual () {
|
this.$EventBus.$emit('chinaDx', 'remove')
|
visualLayer = new global.DC.TilesetLayer('visualLayer').addTo(global.viewer)
|
visualTileset = new global.DC.Tileset('http://resource.dvgis.cn/data/3dtiles/dayanta/tileset.json')
|
visualTileset.setHeight(-420)
|
visualLayer.addOverlay(visualTileset)
|
global.viewer.flyTo(visualTileset)
|
global.viewer.analysis.viewshed('108.95772292882747,34.22122559229137,20,130', 400, 60, 1.3)
|
},
|
removeVisual () {
|
this.$EventBus.$emit('chinaDx', 'add')
|
global.viewer.analysis.deactivate(global.DC.AnalysisType.VIEWSHED)
|
visualTileset != null && visualLayer.removeOverlay(visualTileset)
|
visualLayer != null && global.viewer.removeLayer(visualLayer)
|
visualTileset = null
|
visualLayer = null
|
},
|
visualChange (e) {
|
if (e) {
|
this.loadVisual()
|
} else {
|
this.removeVisual()
|
}
|
}
|
},
|
destroyed () {
|
this.removeSunlight()
|
this.removeCircle()
|
this.removeVisual()
|
}
|
}
|
</script>
|
|
<style lang="sass" scoped>
|
.move
|
cursor: move
|
</style>
|