From 4f55f7d94198eca8eba9ae6b85af19a07cac2f79 Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 29 Apr 2022 17:23:55 +0800
Subject: [PATCH] 内容修改
---
src/pcviews/technique/space.vue | 192 ++++++++++++++++++++---------------------------
1 files changed, 83 insertions(+), 109 deletions(-)
diff --git a/src/pcviews/technique/space.vue b/src/pcviews/technique/space.vue
index 65a1075..09f741d 100644
--- a/src/pcviews/technique/space.vue
+++ b/src/pcviews/technique/space.vue
@@ -12,30 +12,26 @@
<template slot="public-box-content">
<ul>
<li>
- 点位缓冲
+ 日照分析
<el-switch
- v-model="pointShow"
+ v-model="sunlightShow"
:active-value="true"
:inactive-value="false"
- @change="pointChange"
+ @change="sunlightChange"
></el-switch>
</li>
<li>
- 线缓冲
- <el-switch
- v-model="plineShow"
- :active-value="true"
- :inactive-value="false"
- @change="plineChange"
- ></el-switch>
+ 通视分析(圆)
+ <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="regionShow"
+ v-model="visualShow"
:active-value="true"
:inactive-value="false"
- @change="regionChange"
+ @change="visualChange"
></el-switch>
</li>
</ul>
@@ -45,130 +41,108 @@
<script>
-let pointTrufLayer = null
-let pointTrufPolygon = null
-let pointTrufPoint = null
+let sunlightLayer = null
+let tileset = null
+let plot = null
-let plineTrufLayer = null
-let plineTrufPolygon = null
-let plineTrufPline = null
-
-let regionTrufLayer = null
-let regionTrufRegion = null
-let regionTrufPolygon = null
+let visualLayer = null
+let visualTileset = null
export default {
data () {
return {
- pointShow: false,
- plineShow: false,
- regionShow: false
+ 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')
},
- 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)
+ 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)
},
- removePoint () {
- pointTrufPoint != null && pointTrufLayer.removeOverlay(pointTrufPoint)
- pointTrufPolygon != null && pointTrufLayer.removeOverlay(pointTrufPolygon)
- pointTrufLayer != null && global.viewer.removeLayer(pointTrufLayer)
- pointTrufPoint = null
- pointTrufPolygon = null
- pointTrufLayer = null
+ removeSunlight () {
+ global.viewer.analysis.deactivate(global.DC.AnalysisType.SHADOWS)
+ tileset != null && sunlightLayer.removeOverlay(tileset)
+ sunlightLayer != null && global.viewer.removeLayer(sunlightLayer)
+ tileset = null
+ sunlightLayer = null
},
- pointChange (e) {
+ sunlightChange (e) {
if (e) {
- this.loadPoint()
+ this.loadSunlight()
} else {
- this.removePoint()
+ this.removeSunlight()
}
},
- 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
+ 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, [])
})
- 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
+ removeCircle () {
+ global.viewer.analysis.deactivate(global.DC.AnalysisType.SIGHT_CIRCLE)
},
- plineChange (e) {
+ 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.loadPline()
+ this.loadVisual()
} 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()
+ this.removeVisual()
}
}
},
destroyed () {
- this.removePoint()
- this.removePline()
- this.removeRegion()
+ this.removeSunlight()
+ this.removeCircle()
+ this.removeVisual()
}
}
</script>
--
Gitblit v1.9.3