feat:亮度调节第一版提交

This commit is contained in:
wxs 2026-02-28 14:43:43 +08:00
parent a03b7fcbea
commit 4f7496a240
6 changed files with 169 additions and 62 deletions

View File

@ -1,10 +1,9 @@
window.config = { window.config = {
env: 'offline', //online env: 'offline', //online
//api: 'http://127.0.0.1:9116/', // 外网服务器, //api: 'http://127.0.0.1:9116/', // 外网服务器,
api: 'http://127.0.0.1:9116', api: 'http://182.92.203.107:9116',
socket: 'http://127.0.0.1:9116', //外网服务器, socket: 'http://182.92.203.107:9116', //外网服务器,
imagePath: 'http://192.168.112.181:9000/files', imagePath: 'http://182.92.203.107:8080/files',
// imagePath: 'http://127.0.0.1:8080/files',
arithmeticPath: 'http://127.0.0.1:18090/ktkx/UavPlanning/SAR', arithmeticPath: 'http://127.0.0.1:18090/ktkx/UavPlanning/SAR',
tokenKey: 'accessToken', tokenKey: 'accessToken',
refreshTokenKey: 'refreshToken', refreshTokenKey: 'refreshToken',

View File

@ -987,7 +987,6 @@ export default {
let list = [] let list = []
data.forEach(item => { data.forEach(item => {
item.statusName = this.jobStatus[item.status + ''] item.statusName = this.jobStatus[item.status + '']
console.log(item, 33333333333);
let uav = undefined let uav = undefined
let sar = undefined let sar = undefined
if (item.uavList.length) { if (item.uavList.length) {

View File

@ -0,0 +1,94 @@
// src/cesium/layers/OrthoManager.js
export default class OrthoManager {
constructor(viewer, Cesium) {
this.viewer = viewer
this.Cesium = Cesium
this.entityMap = new Map()
this.currentBrightness = 1.0
}
/**
* 添加正射影像
*/
add(data) {
const key = `${data.jobId}-${data.uavId}~${data.fileId}`
if (this.entityMap.has(key)) return
const C = this.Cesium
let cby_bg_data = [
data.left1Lon, data.left1Lat,
data.left2Lon, data.left2Lat,
data.right2Lon, data.right2Lat,
data.right1Lon, data.right1Lat,
]
const positions = C.Cartesian3.fromDegreesArray(cby_bg_data)
const entity = this.viewer.entities.add({
id: key,
polygon: {
hierarchy: positions,
perPositionHeight: true,
material: new C.ImageMaterialProperty({
image: window.config.imagePath + data.relativePath,
transparent: false,
color: new C.Color(
this.currentBrightness,
this.currentBrightness,
this.currentBrightness,
1
)
})
}
})
this.entityMap.set(key, entity)
}
/**
* 设置全局亮度
*/
setBrightness(value) {
this.currentBrightness = value
const C = this.Cesium
this.entityMap.forEach(entity => {
entity.polygon.material.color =
new C.Color(value, value, value, 1)
})
}
/**
* 清除全部影像
*/
clearAll() {
this.entityMap.forEach(entity => {
this.viewer.entities.remove(entity)
})
this.entityMap.clear()
}
/**
* 清除某个任务(jobId-uavId)
*/
clearByTask(jobId, uavId) {
const prefix = `${jobId}-${uavId}`
this.entityMap.forEach((entity, key) => {
if (key.startsWith(prefix)) {
this.viewer.entities.remove(entity)
this.entityMap.delete(key)
}
})
}
/**
* 清除单张图片
*/
clearByFile(jobId, uavId, fileId) {
const key = `${jobId}-${uavId}~${fileId}`
if (this.entityMap.has(key)) {
this.viewer.entities.remove(this.entityMap.get(key))
this.entityMap.delete(key)
}
}
}

View File

@ -1,5 +1,5 @@
import { lodLayer, viewer } from '@/components/dt-scene/index.vue' import { lodLayer, viewer } from '@/components/dt-scene/index.vue'
import OrthoManager from './OrthoManager'
// 新增空间态势统计 // 新增空间态势统计
// 台风列表 // 台风列表
@ -55,6 +55,7 @@ let taskPlanAreaCollection = {}
let radarSceneEntity = {} let radarSceneEntity = {}
let sceneEntity = {} let sceneEntity = {}
let taskListResource = [] let taskListResource = []
let orthoManager = null
export default { export default {
name: 'TwinSituation', name: 'TwinSituation',
props: { props: {
@ -402,8 +403,8 @@ export default {
lightPercent: 0, lightPercent: 0,
contrastPercent: 10, contrastPercent: 10,
imageInfos: { imageInfos: {
brightness: null brightness: 10
} },
} }
}, },
computed: { computed: {
@ -508,12 +509,19 @@ export default {
// this.resourceClick(this.resourceList.data[0]) // this.resourceClick(this.resourceList.data[0])
this.handleSceneComplete() this.handleSceneComplete()
this.getTaskList() this.getTaskList()
orthoManager = new OrthoManager(
viewer,
DT.Cesium
)
// this.startTest() // this.startTest()
}, },
beforeDestroy() { beforeDestroy() {
this.SET_SPLIT_VISIBLE(false) this.SET_SPLIT_VISIBLE(false)
this.removePictureHandle() this.removePictureHandle()
if (orthoManager) {
orthoManager.clearAll()
orthoManager = null
}
// 移除任务区域 // 移除任务区域
for (let key in taskPlanAreaCollection) { for (let key in taskPlanAreaCollection) {
if (taskPlanAreaCollection[key]) { if (taskPlanAreaCollection[key]) {
@ -521,7 +529,6 @@ export default {
viewer.entities.remove(item) viewer.entities.remove(item)
}) })
} }
} }
for (let key in taskUavCollection) { for (let key in taskUavCollection) {
if (taskUavCollection[key]) { if (taskUavCollection[key]) {
@ -594,13 +601,14 @@ export default {
} }
}, },
// 亮度设置变化 // 亮度设置变化
onLightChange() { onLightChange: debounce(function (val) {
const imageInfos = { ...this.imageInfos } const imageInfos = { ...this.imageInfos }
orthoManager.setBrightness(val / 10)
execBrightnessexport(imageInfos).then(res => { execBrightnessexport(imageInfos).then(res => {
console.log('亮度调整成功'); console.log('亮度调整成功');
// this.$message.success('亮度调整成功') // this.$message.success('亮度调整成功')
}) })
}, }, 500),
// startTest() { // startTest() {
// let testHeight = 1000 // let testHeight = 1000
// window.detectType = { // window.detectType = {
@ -1582,6 +1590,10 @@ export default {
// currentPicture = null // currentPicture = null
// } // }
this.removeTaskTarget(info.id); this.removeTaskTarget(info.id);
if (orthoManager) {
orthoManager.clearAll()
orthoManager = null
}
} else { } else {
this.addUavToScene(taskListResource[index]) this.addUavToScene(taskListResource[index])
this.addTaskPlanArea(taskListResource[index].pointList, info.id, info.name) this.addTaskPlanArea(taskListResource[index].pointList, info.id, info.name)
@ -1610,6 +1622,10 @@ export default {
viewer.entities.remove(item) viewer.entities.remove(item)
} }
}) })
if (orthoManager) {
orthoManager.clearAll()
orthoManager = null
}
} else { } else {
this.$message.error(res.data.message) this.$message.error(res.data.message)
} }
@ -2824,18 +2840,18 @@ export default {
// console.log('SAR图像', info.body) // console.log('SAR图像', info.body)
let data = JSON.parse(info.body) let data = JSON.parse(info.body)
this.imageInfos = Object.assign({}, this.imageInfos, data) this.imageInfos = Object.assign({}, this.imageInfos, data)
console.log(this.imageInfos, 444444444); this.imageInfos.brightness = data.brightness
console.log('SAR图像2', data) console.log('SAR图像2', data)
this.addMarkPicture2(data) orthoManager.add(data)
// this.addMarkPicture2(data)
// console.log('灭有匹配到吗taskUavCollection', taskUavCollection, taskUavCollection[data.jobId]) // console.log('灭有匹配到吗taskUavCollection', taskUavCollection, taskUavCollection[data.jobId])
if (taskUavCollection[data.jobId]) { // if (taskUavCollection[data.jobId]) {
let find = taskUavCollection[data.jobId].find(item => item.uavId + '' === data.uavId + '') // let find = taskUavCollection[data.jobId].find(item => item.uavId + '' === data.uavId + '')
// console.log('找到添加图片的对象', find) // // console.log('找到添加图片的对象', find)
if (find) { // if (find) {
find.appendLoaderPicture(data) // find.appendLoaderPicture(data)
} // }
} // }
// 更新列表里的数据 // 更新列表里的数据
let find = taskListResource.find(item => item.id === data.jobId) let find = taskListResource.find(item => item.id === data.jobId)
if (find) { if (find) {
@ -2876,8 +2892,6 @@ export default {
// })); // }));
// if (this.tempAdd) return // if (this.tempAdd) return
// this.tempAdd = true // this.tempAdd = true
console.log(data, renderTaskInfo, 'tupiantupian');
let id = `${data.jobId}-${data.uavId}` let id = `${data.jobId}-${data.uavId}`
// let target = renderTaskInfo[id] // let target = renderTaskInfo[id]
// if (target) { // if (target) {
@ -2903,42 +2917,42 @@ export default {
}) })
let markLineArr = [] let markLineArr = []
if (data.itemList) { if (data.itemList) {
data.itemList.forEach((item) => { // data.itemList.forEach((item) => {
let markId = `${data.jobId}-${data.uavId}-${data.fileId}-${item.id}~mark` // let markId = `${data.jobId}-${data.uavId}-${data.fileId}-${item.id}~mark`
let markPosition = DT.Cesium.Cartesian3.fromDegrees(item.left1Lon, item.left1Lat, 1) // let markPosition = DT.Cesium.Cartesian3.fromDegrees(item.left1Lon, item.left1Lat, 1)
let markArr = [ // let markArr = [
item.left1Lon, item.left1Lat, 1, // item.left1Lon, item.left1Lat, 1,
item.left2Lon, item.left2Lat, 1, // item.left2Lon, item.left2Lat, 1,
item.right2Lon, item.right2Lat, 1, // item.right2Lon, item.right2Lat, 1,
item.right1Lon, item.right1Lat, 1, // item.right1Lon, item.right1Lat, 1,
item.left1Lon, item.left1Lat, 1, // item.left1Lon, item.left1Lat, 1,
] // ]
let markLine = viewer.entities.add({ // let markLine = viewer.entities.add({
id: markId, // id: markId,
show: false, // show: false,
position: markPosition, // position: markPosition,
label: { // label: {
text: this.detectType[item.type], // text: this.detectType[item.type],
font: '12px sans-serif', // font: '12px sans-serif',
fillColor: DT.Cesium.Color.RED, // fillColor: DT.Cesium.Color.RED,
horizontalOrigin: DT.Cesium.HorizontalOrigin.LEFT, // horizontalOrigin: DT.Cesium.HorizontalOrigin.LEFT,
verticalOrigin: DT.Cesium.VerticalOrigin.TOP, // verticalOrigin: DT.Cesium.VerticalOrigin.TOP,
disableDepthTestDistance: 10000, // disableDepthTestDistance: 10000,
showBackground: false, // showBackground: false,
backgroundColor: DT.Cesium.Color.BLACK, // backgroundColor: DT.Cesium.Color.BLACK,
style: DT.Cesium.LabelStyle.FILL_AND_OUTLINE, // style: DT.Cesium.LabelStyle.FILL_AND_OUTLINE,
}, // },
polyline: { // polyline: {
positions: DT.Cesium.Cartesian3.fromDegreesArrayHeights(markArr), // positions: DT.Cesium.Cartesian3.fromDegreesArrayHeights(markArr),
// positions: DT.Cesium.Cartesian3.fromDegreesArray(markArr), // // positions: DT.Cesium.Cartesian3.fromDegreesArray(markArr),
width: 1, // width: 1,
material: DT.Cesium.Color.RED, // material: DT.Cesium.Color.RED,
depthFailMaterial: DT.Cesium.Color.RED, // depthFailMaterial: DT.Cesium.Color.RED,
zIndex: 3, // zIndex: 3,
} // }
}) // })
markLineArr.push(markLine) // markLineArr.push(markLine)
}) // })
} }
// target.picture[`${data.fileId}-picture`] = { // target.picture[`${data.fileId}-picture`] = {
// pictureEntity: entity, // pictureEntity: entity,
@ -3107,8 +3121,6 @@ export default {
//#endregion //#endregion
// 打开状态和波形信息展示 // 打开状态和波形信息展示
openSarStatusDetail(data) { openSarStatusDetail(data) {
console.log(data, 444444444444);
// changeJobStatus(data.id).then(() => { // changeJobStatus(data.id).then(() => {
// this.$message.success('已切换到状态展示') // this.$message.success('已切换到状态展示')
// }) // })

View File

@ -147,7 +147,9 @@
<el-slider <el-slider
v-model="imageInfos.brightness" v-model="imageInfos.brightness"
show-input show-input
:min="1"
:max="30" :max="30"
:step="1"
input-size="mini" input-size="mini"
:show-input-controls="false" :show-input-controls="false"
@change="onLightChange" @change="onLightChange"

View File

@ -76,6 +76,7 @@ export default class UavTarget {
this.positions.push(position.clone()) this.positions.push(position.clone())
} }
addUavLoader(data) { addUavLoader(data) {
return;
let loaderPicture = {} let loaderPicture = {}
data.forEach(loader => { data.forEach(loader => {
loaderPicture[loader.payloadId] = [] loaderPicture[loader.payloadId] = []