地图四色图和便捷单独控制是否显示
parent
071fe616ca
commit
76a6aad1b4
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 |
|
@ -374,6 +374,18 @@ export default {
|
|||
checkImg: require('../../assets/map/index/map_on.png'),
|
||||
check: '',
|
||||
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: {},
|
||||
|
@ -1358,7 +1370,7 @@ export default {
|
|||
this.bottomOptionsKey = Math.random()
|
||||
this.bottomOptionsAnimationComplex = false
|
||||
this.toCenter({ longitude, latitude, height })
|
||||
drag.addPolygon(id)
|
||||
// drag.addPolygon(id)
|
||||
viewer.dataSources.removeAll()
|
||||
this.poinEntity = {}
|
||||
this.branchPoint = []
|
||||
|
@ -1618,6 +1630,26 @@ export default {
|
|||
this.dialog.corpInfoId = ''
|
||||
this.dialog.infoname = ''
|
||||
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) {
|
||||
|
@ -1728,6 +1760,8 @@ export default {
|
|||
this.poinEntity = {}
|
||||
this.toCenter(this.initCenter)
|
||||
this.dragAreaEntity(this.initPoint)
|
||||
this.rightOptionsList[7].check = false
|
||||
this.rightOptionsList[8].check = false
|
||||
}
|
||||
|
||||
this.componentKey = Math.random()
|
||||
|
|
|
@ -80,6 +80,7 @@ const polygonMap = {
|
|||
export default class DragEntity {
|
||||
constructor(val) {
|
||||
this.viewer = val.viewer
|
||||
this.id = []
|
||||
}
|
||||
|
||||
addEntity(value) {
|
||||
|
@ -243,16 +244,24 @@ export default class DragEntity {
|
|||
})
|
||||
}
|
||||
|
||||
addPolygon(id) {
|
||||
addPolygon(id, type) {
|
||||
if (!polygonMap[id]) return
|
||||
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) {
|
||||
// 获取每种颜色
|
||||
const loadMapBoxItem = loadMapBoxObj[loadMapBoxKey]
|
||||
if (loadMapBoxKey === 'wallList') continue
|
||||
// 循环每种颜色里每一块创建多边形
|
||||
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.y)
|
||||
})
|
||||
if (item.type === 'wall') {
|
||||
const target = new Cesium.Entity({
|
||||
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)
|
||||
} else {
|
||||
const target = new Cesium.Entity({
|
||||
polygon: {
|
||||
hierarchy: Cesium.Cartesian3.fromDegreesArray(latitudeAndLongitude),
|
||||
extrudedHeight: item.stretchHeight,
|
||||
height: item.height,
|
||||
// eslint-disable-next-line new-cap
|
||||
material: new Cesium.Color.fromCssColorString(item.color),
|
||||
outline: !!item.strokeColor,
|
||||
// eslint-disable-next-line new-cap
|
||||
outlineColor: new Cesium.Color.fromCssColorString(item.strokeColor)
|
||||
}
|
||||
})
|
||||
this.viewer.entities.add(target)
|
||||
return latitudeAndLongitude
|
||||
}
|
||||
|
||||
addFourColorDiagram(latitudeAndLongitude, item) {
|
||||
const id = Cesium.createGuid()
|
||||
this.id.push({
|
||||
id,
|
||||
key: 'FourColorDiagram'
|
||||
})
|
||||
const target = new Cesium.Entity({
|
||||
id,
|
||||
polygon: {
|
||||
hierarchy: Cesium.Cartesian3.fromDegreesArray(latitudeAndLongitude),
|
||||
extrudedHeight: item.stretchHeight,
|
||||
height: item.height,
|
||||
// eslint-disable-next-line new-cap
|
||||
material: new Cesium.Color.fromCssColorString(item.color),
|
||||
outline: !!item.strokeColor,
|
||||
// eslint-disable-next-line new-cap
|
||||
outlineColor: new Cesium.Color.fromCssColorString(item.strokeColor)
|
||||
}
|
||||
})
|
||||
this.viewer.entities.add(target)
|
||||
}
|
||||
addWall(latitudeAndLongitude) {
|
||||
const id = Cesium.createGuid()
|
||||
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
Loading…
Reference in New Issue