|
@@ -28,6 +28,8 @@
|
|
|
<script>
|
|
<script>
|
|
|
import * as mars3d from 'mars3d'
|
|
import * as mars3d from 'mars3d'
|
|
|
let layerCache = {}
|
|
let layerCache = {}
|
|
|
|
|
+let graphicsLayer = null
|
|
|
|
|
+let csqGraphicsLayer = null
|
|
|
export default {
|
|
export default {
|
|
|
name: 'LayerListView',
|
|
name: 'LayerListView',
|
|
|
data() {
|
|
data() {
|
|
@@ -46,7 +48,7 @@ export default {
|
|
|
children: [
|
|
children: [
|
|
|
{ id: '1-1-1', label: '提防背河坡脚线', meta: { type: 'polyline', url: '/geojson/提防背河坡脚线.geojson' } },
|
|
{ id: '1-1-1', label: '提防背河坡脚线', meta: { type: 'polyline', url: '/geojson/提防背河坡脚线.geojson' } },
|
|
|
{ id: '1-1-2', label: '河道管理范围线', meta: { type: 'polyline', url: '/geojson/河道管理范围线.geojson' } },
|
|
{ id: '1-1-2', label: '河道管理范围线', meta: { type: 'polyline', url: '/geojson/河道管理范围线.geojson' } },
|
|
|
- { id: '1-1-3', label: '一二级管控区界限', meta: { type: 'polyline', url: '/geojson/一二级管控区界限.geojson' } },
|
|
|
|
|
|
|
+ { id: '1-1-3', label: '一级管控区界限', meta: { type: 'polyline', url: '/geojson/一二级管控区界限.geojson' } },
|
|
|
{ id: '1-1-4', label: '生态区界限', meta: { type: 'polyline', url: '/geojson/生态区界限.geojson' } },
|
|
{ id: '1-1-4', label: '生态区界限', meta: { type: 'polyline', url: '/geojson/生态区界限.geojson' } },
|
|
|
{ id: '1-1-5', label: '城市核心区', meta: { type: 'polyline', url: '/geojson/城市核心区.geojson' } },
|
|
{ id: '1-1-5', label: '城市核心区', meta: { type: 'polyline', url: '/geojson/城市核心区.geojson' } },
|
|
|
{ id: '1-1-6', label: '农村区段', meta: { type: 'polyline', url: '/geojson/农村区段.geojson' } },
|
|
{ id: '1-1-6', label: '农村区段', meta: { type: 'polyline', url: '/geojson/农村区段.geojson' } },
|
|
@@ -54,9 +56,25 @@ export default {
|
|
|
{ id: '1-1-9', label: '农村区段(右岸)', meta: { type: 'polyline', url: '/geojson/农村区段右岸.geojson' } }
|
|
{ id: '1-1-9', label: '农村区段(右岸)', meta: { type: 'polyline', url: '/geojson/农村区段右岸.geojson' } }
|
|
|
]
|
|
]
|
|
|
},
|
|
},
|
|
|
- { id: '1-2', label: '监测设备' },
|
|
|
|
|
- { id: '1-3', label: '入河排水(污)口' },
|
|
|
|
|
- { id: '1-4', label: '河道管理站' }
|
|
|
|
|
|
|
+ { id: '1-2', label: '监测设备', type: 'monitor' },
|
|
|
|
|
+ {
|
|
|
|
|
+ id: '1-3',
|
|
|
|
|
+ label: '入河排水(污)口',
|
|
|
|
|
+ children: [
|
|
|
|
|
+ { id: '1-3-1', label: '兴平城市总排口', meta: { type: 'point', url: '/geojson/兴平城市总排口.geojson' } },
|
|
|
|
|
+ { id: '1-3-2', label: '兴平城市污水处理厂排口', meta: { type: 'point', url: '/geojson/兴平城市总排口2.geojson' } },
|
|
|
|
|
+ { id: '1-3-3', label: '新兴纺织园污水处理厂排口', meta: { type: 'point', url: '/geojson/新兴纺织园污水处理厂排口.geojson' } }
|
|
|
|
|
+ ]
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ id: '1-4',
|
|
|
|
|
+ label: '河道管理站',
|
|
|
|
|
+ children: [
|
|
|
|
|
+ { id: '1-4-1', label: '庄头管理站', meta: { type: 'point', url: '/geojson/庄头管理站.geojson' } },
|
|
|
|
|
+ { id: '1-4-2', label: '汤坊管理站', meta: { type: 'point', url: '/geojson/汤坊管理站.geojson' } },
|
|
|
|
|
+ { id: '1-4-3', label: '阜寨管理站', meta: { type: 'point', url: '/geojson/阜寨管理站.geojson' } }
|
|
|
|
|
+ ]
|
|
|
|
|
+ }
|
|
|
]
|
|
]
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -64,16 +82,16 @@ export default {
|
|
|
label: '水文监测',
|
|
label: '水文监测',
|
|
|
children: [
|
|
children: [
|
|
|
{ id: '2-1', label: '水文监测点1', meta: { type: 'point', url: '/geojson/sw1.geojson' } },
|
|
{ id: '2-1', label: '水文监测点1', meta: { type: 'point', url: '/geojson/sw1.geojson' } },
|
|
|
- { id: '2-2', label: '水文监测点2', meta: { type: 'point', url: '/geojson/sw2.geojson' }}
|
|
|
|
|
|
|
+ { id: '2-2', label: '水文监测点2', meta: { type: 'point', url: '/geojson/sw2.geojson' } }
|
|
|
]
|
|
]
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
id: '3',
|
|
id: '3',
|
|
|
label: '采砂区',
|
|
label: '采砂区',
|
|
|
children: [
|
|
children: [
|
|
|
- { id: '3-1', label: '兴平市宜空采砂区', meta: { type: 'polygon', url: '/geojson/宜空采砂区.geojson' } },
|
|
|
|
|
- { id: '3-2', label: '兴平市团结采砂区', meta: { type: 'polygon', url: '/geojson/团结采砂区.geojson' } },
|
|
|
|
|
- { id: '3-3', label: '兴平市汤坊龙兴1区采砂区', meta: { type: 'polygon', url: '/geojson/坊龙兴1区采砂区.geojson' } }
|
|
|
|
|
|
|
+ { id: '3-1', label: '兴平市宜空采砂区', type: 'csq', meta: { type: 'polygon', url: '/geojson/宜空采砂区.geojson' } },
|
|
|
|
|
+ { id: '3-2', label: '兴平市团结采砂区', type: 'csq', meta: { type: 'polygon', url: '/geojson/团结采砂区.geojson' } },
|
|
|
|
|
+ { id: '3-3', label: '兴平市汤坊龙兴1区采砂区', type: 'csq', meta: { type: 'polygon', url: '/geojson/坊龙兴1区采砂区.geojson' } }
|
|
|
]
|
|
]
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
@@ -140,7 +158,14 @@ export default {
|
|
|
this.$globalEventBus.$emit('showPlanDialog', { list: this.checkedNodes })
|
|
this.$globalEventBus.$emit('showPlanDialog', { list: this.checkedNodes })
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ if (node.type === 'monitor') {
|
|
|
|
|
+ if (graphicsLayer) {
|
|
|
|
|
+ graphicsLayer.show = true
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.getMonitorData()
|
|
|
|
|
+ }
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
if (node.children?.length) {
|
|
if (node.children?.length) {
|
|
|
// 递归加载所有叶子节点
|
|
// 递归加载所有叶子节点
|
|
|
await this.loadAllLeafLayers(node.children)
|
|
await this.loadAllLeafLayers(node.children)
|
|
@@ -152,6 +177,9 @@ export default {
|
|
|
layerCache[id].show = true
|
|
layerCache[id].show = true
|
|
|
} else {
|
|
} else {
|
|
|
await this.loadGeoJsonLayer(node)
|
|
await this.loadGeoJsonLayer(node)
|
|
|
|
|
+ if (node.type === 'csq') {
|
|
|
|
|
+ this.getCsqLayer(node.label)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -161,13 +189,18 @@ export default {
|
|
|
this.$globalEventBus.$emit('showPlanDialog', { list: this.checkedNodes })
|
|
this.$globalEventBus.$emit('showPlanDialog', { list: this.checkedNodes })
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ if (node.type === 'monitor') {
|
|
|
|
|
+ this.removeMonitorData()
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
if (node.children?.length) {
|
|
if (node.children?.length) {
|
|
|
// 递归删除所有叶子节点
|
|
// 递归删除所有叶子节点
|
|
|
this.removeAllLeafLayers(node.children)
|
|
this.removeAllLeafLayers(node.children)
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ if (node.type === 'csq') {
|
|
|
|
|
+ this.removeCsqLayer(node.label)
|
|
|
|
|
+ }
|
|
|
this.removeLayer(id)
|
|
this.removeLayer(id)
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -182,6 +215,9 @@ export default {
|
|
|
layerCache[child.id].show = true
|
|
layerCache[child.id].show = true
|
|
|
} else {
|
|
} else {
|
|
|
await this.loadGeoJsonLayer(child)
|
|
await this.loadGeoJsonLayer(child)
|
|
|
|
|
+ if (child.type === 'csq') {
|
|
|
|
|
+ this.getCsqLayer(child.label)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -194,6 +230,9 @@ export default {
|
|
|
this.removeAllLeafLayers(child.children)
|
|
this.removeAllLeafLayers(child.children)
|
|
|
} else {
|
|
} else {
|
|
|
this.removeLayer(child.id)
|
|
this.removeLayer(child.id)
|
|
|
|
|
+ if (child.type === 'csq') {
|
|
|
|
|
+ this.removeCsqLayer(child.label)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -250,7 +289,7 @@ export default {
|
|
|
return { type: 'polyline', styleOptions: { color: '#c53632', width: 2 } }
|
|
return { type: 'polyline', styleOptions: { color: '#c53632', width: 2 } }
|
|
|
} else if (name === '河道管理范围线') {
|
|
} else if (name === '河道管理范围线') {
|
|
|
return { type: 'polyline', styleOptions: { color: '#12641c', width: 2 } }
|
|
return { type: 'polyline', styleOptions: { color: '#12641c', width: 2 } }
|
|
|
- } else if (name === '一二级管控区界限') {
|
|
|
|
|
|
|
+ } else if (name === '一级管控区界限') {
|
|
|
return {
|
|
return {
|
|
|
type: 'polyline',
|
|
type: 'polyline',
|
|
|
styleOptions: { width: 2, materialType: mars3d.MaterialType.PolylineDash, materialOptions: { color: '#12641c', dashLength: 60 } }
|
|
styleOptions: { width: 2, materialType: mars3d.MaterialType.PolylineDash, materialOptions: { color: '#12641c', dashLength: 60 } }
|
|
@@ -278,27 +317,40 @@ export default {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
} else if (name.indexOf('水文') > -1) {
|
|
} else if (name.indexOf('水文') > -1) {
|
|
|
|
|
+ const ptStyle = this.getPointStyle(name)
|
|
|
return {
|
|
return {
|
|
|
type: 'billboard',
|
|
type: 'billboard',
|
|
|
styleOptions: {
|
|
styleOptions: {
|
|
|
image: require('./image/水文站.png'),
|
|
image: require('./image/水文站.png'),
|
|
|
- scale: 1,
|
|
|
|
|
- clampToGround: true,
|
|
|
|
|
- horizontalOrigin: this.Cesium.HorizontalOrigin.CENTER,
|
|
|
|
|
- verticalOrigin: this.Cesium.VerticalOrigin.BOTTOM,
|
|
|
|
|
- pixelOffset: new this.Cesium.Cartesian2(0, -6), // 偏移量
|
|
|
|
|
- distanceDisplayCondition: new this.Cesium.DistanceDisplayCondition(0.0, 500000) // 按视距显示
|
|
|
|
|
|
|
+ ...ptStyle
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (name.indexOf('排口') > -1) {
|
|
|
|
|
+ const ptStyle = this.getPointStyle(name)
|
|
|
|
|
+ return {
|
|
|
|
|
+ type: 'billboard',
|
|
|
|
|
+ styleOptions: {
|
|
|
|
|
+ image: require('./image/排污口.png'),
|
|
|
|
|
+ ...ptStyle
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (name.indexOf('管理站') > -1) {
|
|
|
|
|
+ const ptStyle = this.getPointStyle(name)
|
|
|
|
|
+ return {
|
|
|
|
|
+ type: 'billboard',
|
|
|
|
|
+ styleOptions: {
|
|
|
|
|
+ image: require('./image/管理站.png'),
|
|
|
|
|
+ ...ptStyle
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
} else if (name.indexOf('采砂区') > -1) {
|
|
} else if (name.indexOf('采砂区') > -1) {
|
|
|
return {
|
|
return {
|
|
|
type: 'polygon',
|
|
type: 'polygon',
|
|
|
styleOptions: {
|
|
styleOptions: {
|
|
|
|
|
+ label: { text: name, font_size: 14, outline: true, outlineColor: '#000000', outlineWidth: 2 },
|
|
|
|
|
+ clampToGround: true,
|
|
|
materialType: this.mars3d.MaterialType.Grid,
|
|
materialType: this.mars3d.MaterialType.Grid,
|
|
|
- materialOptions: {
|
|
|
|
|
- color: '#cc9648',
|
|
|
|
|
- cellAlpha: 0.5
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ materialOptions: { color: '#cc9648', cellAlpha: 0.5 },
|
|
|
outline: true,
|
|
outline: true,
|
|
|
outlineWidth: 1,
|
|
outlineWidth: 1,
|
|
|
outlineColor: '#cc9648'
|
|
outlineColor: '#cc9648'
|
|
@@ -306,6 +358,18 @@ export default {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+
|
|
|
|
|
+ getPointStyle(name) {
|
|
|
|
|
+ return {
|
|
|
|
|
+ scale: 0.8,
|
|
|
|
|
+ label: { text: name, font_size: 14, outline: true, outlineColor: '#000000', outlineWidth: 2, pixelOffsetY: -60 },
|
|
|
|
|
+ clampToGround: true,
|
|
|
|
|
+ horizontalOrigin: this.Cesium.HorizontalOrigin.CENTER,
|
|
|
|
|
+ verticalOrigin: this.Cesium.VerticalOrigin.BOTTOM,
|
|
|
|
|
+ pixelOffset: new this.Cesium.Cartesian2(0, -6), // 偏移量
|
|
|
|
|
+ distanceDisplayCondition: new this.Cesium.DistanceDisplayCondition(0.0, 500000) // 按视距显示
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
// 处理水文站数据
|
|
// 处理水文站数据
|
|
|
handleData(isShow) {
|
|
handleData(isShow) {
|
|
|
const nodeIds = ['2-1', '2-2']
|
|
const nodeIds = ['2-1', '2-2']
|
|
@@ -336,6 +400,75 @@ export default {
|
|
|
_that.$globalEventBus.$emit('clickWaterStation', event)
|
|
_that.$globalEventBus.$emit('clickWaterStation', event)
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
|
|
+ },
|
|
|
|
|
+ getMonitorData() {
|
|
|
|
|
+ graphicsLayer = new this.mars3d.layer.GraphicLayer()
|
|
|
|
|
+ window.map.addLayer(graphicsLayer)
|
|
|
|
|
+ window.requestSDK('/device/deviceSimpleList', { pageNum: 1, pageSize: 10, platFlag: '1', operType: '0' }, {}, 'post').then((res) => {
|
|
|
|
|
+ const data = res.data
|
|
|
|
|
+ data.forEach((point) => {
|
|
|
|
|
+ const graphic = new mars3d.graphic.BillboardEntity({
|
|
|
|
|
+ position: [point.longitude, point.latitude],
|
|
|
|
|
+ style: {
|
|
|
|
|
+ image: require('./image/camera.png'),
|
|
|
|
|
+ scale: 0.8,
|
|
|
|
|
+ clampToGround: true,
|
|
|
|
|
+ horizontalOrigin: this.Cesium.HorizontalOrigin.CENTER,
|
|
|
|
|
+ verticalOrigin: this.Cesium.VerticalOrigin.BOTTOM,
|
|
|
|
|
+ pixelOffset: new this.Cesium.Cartesian2(0, -6), // 偏移量
|
|
|
|
|
+ distanceDisplayCondition: new this.Cesium.DistanceDisplayCondition(0.0, 500000) // 按视距显示
|
|
|
|
|
+ },
|
|
|
|
|
+ attr: { ...point }
|
|
|
|
|
+ })
|
|
|
|
|
+ graphicsLayer.addGraphic(graphic)
|
|
|
|
|
+ })
|
|
|
|
|
+ graphicsLayer.flyTo()
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ removeMonitorData() {
|
|
|
|
|
+ if (graphicsLayer) {
|
|
|
|
|
+ graphicsLayer.show = false
|
|
|
|
|
+ // window.map.removeLayer(graphicsLayer)
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ // 采砂区柱状图
|
|
|
|
|
+ getCsqLayer(name) {
|
|
|
|
|
+ const coorList = {
|
|
|
|
|
+ 兴平市宜空采砂区: [108.352091, 34.202407, 100],
|
|
|
|
|
+ 兴平市团结采砂区: [108.360076, 34.20512, 100],
|
|
|
|
|
+ 兴平市汤坊龙兴1区采砂区: [108.474301, 34.21255, 100]
|
|
|
|
|
+ }
|
|
|
|
|
+ const lengthList = {
|
|
|
|
|
+ 兴平市宜空采砂区: 300,
|
|
|
|
|
+ 兴平市团结采砂区: 500,
|
|
|
|
|
+ 兴平市汤坊龙兴1区采砂区: 600
|
|
|
|
|
+ }
|
|
|
|
|
+ if (csqGraphicsLayer) {
|
|
|
|
|
+ csqGraphicsLayer.show = true
|
|
|
|
|
+ } else {
|
|
|
|
|
+ csqGraphicsLayer = new this.mars3d.layer.GraphicLayer()
|
|
|
|
|
+ window.map.addLayer(csqGraphicsLayer)
|
|
|
|
|
+ }
|
|
|
|
|
+ const position = coorList[name]
|
|
|
|
|
+ const graphic = new this.mars3d.graphic.CylinderEntity({
|
|
|
|
|
+ id: name,
|
|
|
|
|
+ position,
|
|
|
|
|
+ style: {
|
|
|
|
|
+ length: lengthList[name],
|
|
|
|
|
+ topRadius: 20.0,
|
|
|
|
|
+ bottomRadius: 20.0,
|
|
|
|
|
+ color: '#85bc68',
|
|
|
|
|
+ opacity: 0.45,
|
|
|
|
|
+ clampToGround: true
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ csqGraphicsLayer.addGraphic(graphic)
|
|
|
|
|
+ },
|
|
|
|
|
+ removeCsqLayer(name) {
|
|
|
|
|
+ if (csqGraphicsLayer) {
|
|
|
|
|
+ const graphic = csqGraphicsLayer.getGraphicById(name)
|
|
|
|
|
+ csqGraphicsLayer.removeGraphic(graphic)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
destroyed() {
|
|
destroyed() {
|
|
@@ -343,6 +476,10 @@ export default {
|
|
|
this.$globalEventBus.$off('toggleLeftPanel')
|
|
this.$globalEventBus.$off('toggleLeftPanel')
|
|
|
// 把图层上绑定的事件也清掉
|
|
// 把图层上绑定的事件也清掉
|
|
|
Object.values(layerCache).forEach((l) => l.off('click'))
|
|
Object.values(layerCache).forEach((l) => l.off('click'))
|
|
|
|
|
+ window.map.removeLayer(graphicsLayer)
|
|
|
|
|
+ graphicsLayer = null
|
|
|
|
|
+ window.map.removeLayer(csqGraphicsLayer)
|
|
|
|
|
+ csqGraphicsLayer = null
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|