diff --git a/frontend/Skyeye-sys-ui/public/config.js b/frontend/Skyeye-sys-ui/public/config.js index 9130112..6392990 100644 --- a/frontend/Skyeye-sys-ui/public/config.js +++ b/frontend/Skyeye-sys-ui/public/config.js @@ -1,10 +1,9 @@ window.config = { env: 'offline', //online //api: 'http://127.0.0.1:9116/', // 外网服务器, - api: 'http://127.0.0.1:9116', - socket: 'http://127.0.0.1:9116', //外网服务器, - imagePath: 'http://192.168.112.181:9000/files', - // imagePath: 'http://127.0.0.1:8080/files', + api: 'http://182.92.203.107:9116', + socket: 'http://182.92.203.107:9116', //外网服务器, + imagePath: 'http://182.92.203.107:8080/files', arithmeticPath: 'http://127.0.0.1:18090/ktkx/UavPlanning/SAR', tokenKey: 'accessToken', refreshTokenKey: 'refreshToken', diff --git a/frontend/Skyeye-sys-ui/src/views/home/components/task-manage/index.js b/frontend/Skyeye-sys-ui/src/views/home/components/task-manage/index.js index 67e885b..da8cfdc 100644 --- a/frontend/Skyeye-sys-ui/src/views/home/components/task-manage/index.js +++ b/frontend/Skyeye-sys-ui/src/views/home/components/task-manage/index.js @@ -987,7 +987,6 @@ export default { let list = [] data.forEach(item => { item.statusName = this.jobStatus[item.status + ''] - console.log(item, 33333333333); let uav = undefined let sar = undefined if (item.uavList.length) { diff --git a/frontend/Skyeye-sys-ui/src/views/home/components/twin-situation/OrthoManager.js b/frontend/Skyeye-sys-ui/src/views/home/components/twin-situation/OrthoManager.js new file mode 100644 index 0000000..5bbd56c --- /dev/null +++ b/frontend/Skyeye-sys-ui/src/views/home/components/twin-situation/OrthoManager.js @@ -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) + } + } +} diff --git a/frontend/Skyeye-sys-ui/src/views/home/components/twin-situation/index.js b/frontend/Skyeye-sys-ui/src/views/home/components/twin-situation/index.js index 63ae7ab..6a4dd6f 100644 --- a/frontend/Skyeye-sys-ui/src/views/home/components/twin-situation/index.js +++ b/frontend/Skyeye-sys-ui/src/views/home/components/twin-situation/index.js @@ -1,5 +1,5 @@ import { lodLayer, viewer } from '@/components/dt-scene/index.vue' - +import OrthoManager from './OrthoManager' // 新增空间态势统计 // 台风列表 @@ -55,6 +55,7 @@ let taskPlanAreaCollection = {} let radarSceneEntity = {} let sceneEntity = {} let taskListResource = [] +let orthoManager = null export default { name: 'TwinSituation', props: { @@ -402,8 +403,8 @@ export default { lightPercent: 0, contrastPercent: 10, imageInfos: { - brightness: null - } + brightness: 10 + }, } }, computed: { @@ -508,12 +509,19 @@ export default { // this.resourceClick(this.resourceList.data[0]) this.handleSceneComplete() this.getTaskList() - + orthoManager = new OrthoManager( + viewer, + DT.Cesium + ) // this.startTest() }, beforeDestroy() { this.SET_SPLIT_VISIBLE(false) this.removePictureHandle() + if (orthoManager) { + orthoManager.clearAll() + orthoManager = null + } // 移除任务区域 for (let key in taskPlanAreaCollection) { if (taskPlanAreaCollection[key]) { @@ -521,7 +529,6 @@ export default { viewer.entities.remove(item) }) } - } for (let key in taskUavCollection) { if (taskUavCollection[key]) { @@ -594,13 +601,14 @@ export default { } }, // 亮度设置变化 - onLightChange() { + onLightChange: debounce(function (val) { const imageInfos = { ...this.imageInfos } + orthoManager.setBrightness(val / 10) execBrightnessexport(imageInfos).then(res => { console.log('亮度调整成功'); // this.$message.success('亮度调整成功') }) - }, + }, 500), // startTest() { // let testHeight = 1000 // window.detectType = { @@ -1582,6 +1590,10 @@ export default { // currentPicture = null // } this.removeTaskTarget(info.id); + if (orthoManager) { + orthoManager.clearAll() + orthoManager = null + } } else { this.addUavToScene(taskListResource[index]) this.addTaskPlanArea(taskListResource[index].pointList, info.id, info.name) @@ -1610,6 +1622,10 @@ export default { viewer.entities.remove(item) } }) + if (orthoManager) { + orthoManager.clearAll() + orthoManager = null + } } else { this.$message.error(res.data.message) } @@ -2824,18 +2840,18 @@ export default { // console.log('SAR图像', info.body) let data = JSON.parse(info.body) this.imageInfos = Object.assign({}, this.imageInfos, data) - console.log(this.imageInfos, 444444444); - + this.imageInfos.brightness = data.brightness console.log('SAR图像2', data) - this.addMarkPicture2(data) + orthoManager.add(data) + // this.addMarkPicture2(data) // console.log('灭有匹配到吗taskUavCollection', taskUavCollection, taskUavCollection[data.jobId]) - if (taskUavCollection[data.jobId]) { - let find = taskUavCollection[data.jobId].find(item => item.uavId + '' === data.uavId + '') - // console.log('找到添加图片的对象', find) - if (find) { - find.appendLoaderPicture(data) - } - } + // if (taskUavCollection[data.jobId]) { + // let find = taskUavCollection[data.jobId].find(item => item.uavId + '' === data.uavId + '') + // // console.log('找到添加图片的对象', find) + // if (find) { + // find.appendLoaderPicture(data) + // } + // } // 更新列表里的数据 let find = taskListResource.find(item => item.id === data.jobId) if (find) { @@ -2876,8 +2892,6 @@ export default { // })); // if (this.tempAdd) return // this.tempAdd = true - console.log(data, renderTaskInfo, 'tupiantupian'); - let id = `${data.jobId}-${data.uavId}` // let target = renderTaskInfo[id] // if (target) { @@ -2903,42 +2917,42 @@ export default { }) let markLineArr = [] if (data.itemList) { - data.itemList.forEach((item) => { - let markId = `${data.jobId}-${data.uavId}-${data.fileId}-${item.id}~mark` - let markPosition = DT.Cesium.Cartesian3.fromDegrees(item.left1Lon, item.left1Lat, 1) - let markArr = [ - item.left1Lon, item.left1Lat, 1, - item.left2Lon, item.left2Lat, 1, - item.right2Lon, item.right2Lat, 1, - item.right1Lon, item.right1Lat, 1, - item.left1Lon, item.left1Lat, 1, - ] - let markLine = viewer.entities.add({ - id: markId, - show: false, - position: markPosition, - label: { - text: this.detectType[item.type], - font: '12px sans-serif', - fillColor: DT.Cesium.Color.RED, - horizontalOrigin: DT.Cesium.HorizontalOrigin.LEFT, - verticalOrigin: DT.Cesium.VerticalOrigin.TOP, - disableDepthTestDistance: 10000, - showBackground: false, - backgroundColor: DT.Cesium.Color.BLACK, - style: DT.Cesium.LabelStyle.FILL_AND_OUTLINE, - }, - polyline: { - positions: DT.Cesium.Cartesian3.fromDegreesArrayHeights(markArr), - // positions: DT.Cesium.Cartesian3.fromDegreesArray(markArr), - width: 1, - material: DT.Cesium.Color.RED, - depthFailMaterial: DT.Cesium.Color.RED, - zIndex: 3, - } - }) - markLineArr.push(markLine) - }) + // data.itemList.forEach((item) => { + // let markId = `${data.jobId}-${data.uavId}-${data.fileId}-${item.id}~mark` + // let markPosition = DT.Cesium.Cartesian3.fromDegrees(item.left1Lon, item.left1Lat, 1) + // let markArr = [ + // item.left1Lon, item.left1Lat, 1, + // item.left2Lon, item.left2Lat, 1, + // item.right2Lon, item.right2Lat, 1, + // item.right1Lon, item.right1Lat, 1, + // item.left1Lon, item.left1Lat, 1, + // ] + // let markLine = viewer.entities.add({ + // id: markId, + // show: false, + // position: markPosition, + // label: { + // text: this.detectType[item.type], + // font: '12px sans-serif', + // fillColor: DT.Cesium.Color.RED, + // horizontalOrigin: DT.Cesium.HorizontalOrigin.LEFT, + // verticalOrigin: DT.Cesium.VerticalOrigin.TOP, + // disableDepthTestDistance: 10000, + // showBackground: false, + // backgroundColor: DT.Cesium.Color.BLACK, + // style: DT.Cesium.LabelStyle.FILL_AND_OUTLINE, + // }, + // polyline: { + // positions: DT.Cesium.Cartesian3.fromDegreesArrayHeights(markArr), + // // positions: DT.Cesium.Cartesian3.fromDegreesArray(markArr), + // width: 1, + // material: DT.Cesium.Color.RED, + // depthFailMaterial: DT.Cesium.Color.RED, + // zIndex: 3, + // } + // }) + // markLineArr.push(markLine) + // }) } // target.picture[`${data.fileId}-picture`] = { // pictureEntity: entity, @@ -3107,8 +3121,6 @@ export default { //#endregion // 打开状态和波形信息展示 openSarStatusDetail(data) { - console.log(data, 444444444444); - // changeJobStatus(data.id).then(() => { // this.$message.success('已切换到状态展示') // }) diff --git a/frontend/Skyeye-sys-ui/src/views/home/components/twin-situation/index.vue b/frontend/Skyeye-sys-ui/src/views/home/components/twin-situation/index.vue index 189b121..5625786 100644 --- a/frontend/Skyeye-sys-ui/src/views/home/components/twin-situation/index.vue +++ b/frontend/Skyeye-sys-ui/src/views/home/components/twin-situation/index.vue @@ -147,7 +147,9 @@ { loaderPicture[loader.payloadId] = []