地图四色图和便捷单独控制是否显示

hyx_2024-9-25_tongbu
LiuJiaNan 2024-09-13 17:56:35 +08:00
parent 071fe616ca
commit 76a6aad1b4
7 changed files with 9164 additions and 9080 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

@ -374,6 +374,18 @@ export default {
checkImg: require('../../assets/map/index/map_on.png'), checkImg: require('../../assets/map/index/map_on.png'),
check: '', check: '',
label: '气象监测' label: '气象监测'
},
{
img: require('../../assets/map/index/sisetu.png'),
checkImg: require('../../assets/map/index/sisetu_on.png'),
check: false,
label: '四色图'
},
{
img: require('../../assets/map/index/bianjie.png'),
checkImg: require('../../assets/map/index/bianjie_on.png'),
check: false,
label: '边界'
} }
], ],
myEntityCollection: {}, myEntityCollection: {},
@ -1358,7 +1370,7 @@ export default {
this.bottomOptionsKey = Math.random() this.bottomOptionsKey = Math.random()
this.bottomOptionsAnimationComplex = false this.bottomOptionsAnimationComplex = false
this.toCenter({ longitude, latitude, height }) this.toCenter({ longitude, latitude, height })
drag.addPolygon(id) // drag.addPolygon(id)
viewer.dataSources.removeAll() viewer.dataSources.removeAll()
this.poinEntity = {} this.poinEntity = {}
this.branchPoint = [] this.branchPoint = []
@ -1618,6 +1630,26 @@ export default {
this.dialog.corpInfoId = '' this.dialog.corpInfoId = ''
this.dialog.infoname = '' this.dialog.infoname = ''
this.dialog.width = '96%' this.dialog.width = '96%'
} else if (index === 7) {
if (!this.gangkouActive) {
this.$message.warning('请先选择港口')
return
}
if (this.rightOptionsList[index].check) {
drag.addPolygon(this.gangkouActive, '')
} else {
drag.removeFourColorDiagram()
}
} else if (index === 8) {
if (!this.gangkouActive) {
this.$message.warning('请先选择港口')
return
}
if (this.rightOptionsList[index].check) {
drag.addPolygon(this.gangkouActive, 'wall')
} else {
drag.removeWall()
}
} }
}, },
changeSceneMode(check) { changeSceneMode(check) {
@ -1728,6 +1760,8 @@ export default {
this.poinEntity = {} this.poinEntity = {}
this.toCenter(this.initCenter) this.toCenter(this.initCenter)
this.dragAreaEntity(this.initPoint) this.dragAreaEntity(this.initPoint)
this.rightOptionsList[7].check = false
this.rightOptionsList[8].check = false
} }
this.componentKey = Math.random() this.componentKey = Math.random()

View File

@ -80,6 +80,7 @@ const polygonMap = {
export default class DragEntity { export default class DragEntity {
constructor(val) { constructor(val) {
this.viewer = val.viewer this.viewer = val.viewer
this.id = []
} }
addEntity(value) { addEntity(value) {
@ -243,16 +244,24 @@ export default class DragEntity {
}) })
} }
addPolygon(id) { addPolygon(id, type) {
if (!polygonMap[id]) return if (!polygonMap[id]) return
const loadMapBoxObj = polygonMap[id]() const loadMapBoxObj = polygonMap[id]()
if (type === 'wall') {
const loadMapBoxItem = loadMapBoxObj['wallList']
for (let i = 0; i < loadMapBoxItem.length; i++) {
this.addWall(this.formatPolygon(loadMapBoxItem[i]))
}
return
}
// 循环获取所有颜色 // 循环获取所有颜色
for (const loadMapBoxKey in loadMapBoxObj) { for (const loadMapBoxKey in loadMapBoxObj) {
// 获取每种颜色 // 获取每种颜色
const loadMapBoxItem = loadMapBoxObj[loadMapBoxKey] const loadMapBoxItem = loadMapBoxObj[loadMapBoxKey]
if (loadMapBoxKey === 'wallList') continue
// 循环每种颜色里每一块创建多边形 // 循环每种颜色里每一块创建多边形
for (let i = 0; i < loadMapBoxItem.length; i++) { for (let i = 0; i < loadMapBoxItem.length; i++) {
this.formatPolygon(loadMapBoxItem[i]) this.addFourColorDiagram(this.formatPolygon(loadMapBoxItem[i]), loadMapBoxItem[i])
} }
} }
} }
@ -263,33 +272,68 @@ export default class DragEntity {
latitudeAndLongitude.push(item.x) latitudeAndLongitude.push(item.x)
latitudeAndLongitude.push(item.y) latitudeAndLongitude.push(item.y)
}) })
if (item.type === 'wall') { return latitudeAndLongitude
const target = new Cesium.Entity({ }
wall: {
positions: Cesium.Cartesian3.fromDegreesArray(latitudeAndLongitude), addFourColorDiagram(latitudeAndLongitude, item) {
material: new Cesium.PolylineTrailLinkMaterialProperty({ const id = Cesium.createGuid()
color: Cesium.Color.fromBytes(201, 118, 243).withAlpha(0.5), this.id.push({
duration: 2000 id,
}, this.viewer), key: 'FourColorDiagram'
maximumHeights: new Array(latitudeAndLongitude.length).fill(40), })
minimumHeights: new Array(latitudeAndLongitude.length).fill(0) const target = new Cesium.Entity({
} id,
}) polygon: {
this.viewer.entities.add(target) hierarchy: Cesium.Cartesian3.fromDegreesArray(latitudeAndLongitude),
} else { extrudedHeight: item.stretchHeight,
const target = new Cesium.Entity({ height: item.height,
polygon: { // eslint-disable-next-line new-cap
hierarchy: Cesium.Cartesian3.fromDegreesArray(latitudeAndLongitude), material: new Cesium.Color.fromCssColorString(item.color),
extrudedHeight: item.stretchHeight, outline: !!item.strokeColor,
height: item.height, // eslint-disable-next-line new-cap
// eslint-disable-next-line new-cap outlineColor: new Cesium.Color.fromCssColorString(item.strokeColor)
material: new Cesium.Color.fromCssColorString(item.color), }
outline: !!item.strokeColor, })
// eslint-disable-next-line new-cap this.viewer.entities.add(target)
outlineColor: new Cesium.Color.fromCssColorString(item.strokeColor) }
} addWall(latitudeAndLongitude) {
}) const id = Cesium.createGuid()
this.viewer.entities.add(target) this.id.push({
id,
key: 'Wall'
})
const target = new Cesium.Entity({
id,
wall: {
positions: Cesium.Cartesian3.fromDegreesArray(latitudeAndLongitude),
material: new Cesium.PolylineTrailLinkMaterialProperty({
color: Cesium.Color.fromBytes(201, 118, 243).withAlpha(0.5),
duration: 2000
}, this.viewer),
maximumHeights: new Array(latitudeAndLongitude.length).fill(40),
minimumHeights: new Array(latitudeAndLongitude.length).fill(0)
}
})
this.viewer.entities.add(target)
}
removeFourColorDiagram() {
for (let i = 0; i < this.id.length; i++) {
if (this.id[i].key === 'FourColorDiagram') {
this.viewer.entities.removeById(this.id[i].id)
this.id.splice(i, 1)
i--
}
}
}
removeWall() {
for (let i = 0; i < this.id.length; i++) {
if (this.id[i].key === 'Wall') {
this.viewer.entities.removeById(this.id[i].id)
this.id.splice(i, 1)
i--
}
} }
} }
} }

File diff suppressed because it is too large Load Diff