处理cesium上已添加的entity

This commit is contained in:
wxs 2026-03-06 10:44:38 +08:00
parent 6babecf7f3
commit 825c319d33
6 changed files with 59 additions and 7 deletions

View File

@ -1,5 +1,3 @@
import { h } from "vue";
// English translations // English translations
export default { export default {
app: { app: {

View File

@ -2,6 +2,41 @@ import Vue from 'vue'
import VueI18n from 'vue-i18n' import VueI18n from 'vue-i18n'
import zh from './zh'; import zh from './zh';
import en from './en'; import en from './en';
export const gisLabels = {
planArea: {
zh_CN: '规划区域',
en_US: 'Plan Area'
},
planAirline: {
zh_CN: '规划航线',
en_US: 'Plan Airline'
},
startPoint: {
zh_CN: '起点',
en_US: 'Start Point'
},
endPoint: {
zh_CN: '终点',
en_US: 'end Point'
},
task: {
zh_CN: '任务',
en_US: 'Task'
},
point: {
zh_CN: '点',
en_US: 'Point'
},
line: {
zh_CN: '线',
en_US: 'Line'
},
PowerOnPoint: {
zh_CN: '开机点',
en_US: 'Power-on point'
}
}
Vue.use(VueI18n) Vue.use(VueI18n)
// load locale messages // load locale messages

View File

@ -1,4 +1,3 @@
// Chinese translations
export default { export default {
app: { app: {
title: '空域快视系统', title: '空域快视系统',

View File

@ -4,6 +4,7 @@ import { constantRoutes } from '@/router'
import { mapMutations, mapGetters, mapActions } from 'vuex' import { mapMutations, mapGetters, mapActions } from 'vuex'
import ChangePassword from '@/layout/components/change-password/index.vue' import ChangePassword from '@/layout/components/change-password/index.vue'
import { getTreeAllItems, judgeArrayRepeat } from '@/utils' import { getTreeAllItems, judgeArrayRepeat } from '@/utils'
import { gisLabels } from '../../../lang'
export default { export default {
name: 'Header', name: 'Header',
components: { ChangePassword }, components: { ChangePassword },
@ -178,6 +179,20 @@ export default {
changeLocale(lang) { changeLocale(lang) {
this.$i18n.locale = lang this.$i18n.locale = lang
localStorage.setItem('locale', lang) localStorage.setItem('locale', lang)
// 处理gis上已添加的entity
viewer.entities.values.forEach(el => {
if (el.id.includes('area')) {
let obj = el.label.text._value.split('-')
obj[1] = gisLabels.planArea[lang]
el.label.text = obj.join('-')
}
if (el.id.includes('planLine')) {
let obj = el.label.text._value.split('-')
obj[0] = gisLabels.planAirline[lang]
obj[2] = gisLabels.startPoint[lang]
el.label.text = obj.join('-')
}
});
}, },
goHome() { goHome() {
this.SET_MENUS_CHOSE('1') this.SET_MENUS_CHOSE('1')

View File

@ -33,6 +33,7 @@ import PicturesUpload from '../pictures-upload/index.vue'
import RightSlide from '@/components/RightSlide.vue' import RightSlide from '@/components/RightSlide.vue'
import LeftSlide from '@/components/LeftSlide.vue' import LeftSlide from '@/components/LeftSlide.vue'
import { debounce } from '@/utils' import { debounce } from '@/utils'
import { gisLabels } from '@/lang/index'
let handler = undefined let handler = undefined
let broadcastChannel = null let broadcastChannel = null
let broadcastChannelInterval = null let broadcastChannelInterval = null
@ -57,6 +58,7 @@ let radarSceneEntity = {}
let sceneEntity = {} let sceneEntity = {}
let taskListResource = [] let taskListResource = []
let orthoManager = null let orthoManager = null
const lang = window.localStorage.getItem('locale') || 'zh_CN'
export default { export default {
name: 'TwinSituation', name: 'TwinSituation',
props: { props: {
@ -1164,8 +1166,9 @@ export default {
allPositions = allPositions.concat(positions) allPositions = allPositions.concat(positions)
let entity = viewer.entities.add({ let entity = viewer.entities.add({
position: positions[0], position: positions[0],
id: `${taskId}-area`,
label: { label: {
text: `${taskName}任务-规划区域${index + 1}`, text: `${taskName}-${gisLabels.planArea[lang]}-${index + 1}`,
disableDepthTestDistance: 10000, disableDepthTestDistance: 10000,
font: '14px sans-serif', font: '14px sans-serif',
fillColor: DT.Cesium.Color.RED, fillColor: DT.Cesium.Color.RED,
@ -1193,8 +1196,9 @@ export default {
allPositions.push(position) allPositions.push(position)
let entity = viewer.entities.add({ let entity = viewer.entities.add({
position, position,
id: `${taskId}-area`,
label: { label: {
text: `${taskName}任务-规划区域${index + 1}`, text: `${taskName}-${gisLabels.planArea[lang]}-${index + 1}`,
disableDepthTestDistance: 10000, disableDepthTestDistance: 10000,
font: '14px sans-serif', font: '14px sans-serif',
fillColor: DT.Cesium.Color.RED, fillColor: DT.Cesium.Color.RED,

View File

@ -1,5 +1,6 @@
import * as DT from 'dt-sdk' import * as DT from 'dt-sdk'
import { viewer } from '@/components/dt-scene' import { viewer } from '@/components/dt-scene'
import { gisLabels } from '@/lang/index'
export default class UavTarget { export default class UavTarget {
planLines = new DT.Cesium.AssociativeArray() planLines = new DT.Cesium.AssociativeArray()
uavEntity = null uavEntity = null
@ -14,7 +15,7 @@ export default class UavTarget {
this.uavId = options.uavId this.uavId = options.uavId
this.jobName = options.jobName this.jobName = options.jobName
this.startAltitude = options.startAltitude this.startAltitude = options.startAltitude
this.lang = window.localStorage.getItem('locale') || 'zh_CN'
this.addPlanLine(options.airlineList) this.addPlanLine(options.airlineList)
console.log(options, '飞机数据'); console.log(options, '飞机数据');
if (options.startLon) { if (options.startLon) {
@ -336,7 +337,7 @@ export default class UavTarget {
id, id,
position: positions[0], position: positions[0],
label: { label: {
text: `规划航线${index + 1}起点`, text: `${gisLabels.planAirline[this.lang]}-${index + 1}-${gisLabels.startPoint[this.lang]}`,
disableDepthTestDistance: 10000, disableDepthTestDistance: 10000,
font: '14px sans-serif', font: '14px sans-serif',
fillColor: DT.Cesium.Color.RED, fillColor: DT.Cesium.Color.RED,