修复勾选卫星再修改载荷出现多余载荷,修复多目标轨迹回放不显示目标(因为时间错了)
This commit is contained in:
		
							parent
							
								
									516a54ee59
								
							
						
					
					
						commit
						2cf73646a7
					
				@ -38,7 +38,7 @@ class SatelliteEntity {
 | 
				
			|||||||
  set sensor(showSensor) {
 | 
					  set sensor(showSensor) {
 | 
				
			||||||
    // console.log(showSensor, 'showSensor')
 | 
					    // console.log(showSensor, 'showSensor')
 | 
				
			||||||
    this._sensor = showSensor
 | 
					    this._sensor = showSensor
 | 
				
			||||||
    if (showSensor) {
 | 
					    if (showSensor && !this.sensorEntity) {
 | 
				
			||||||
      if (this._sensorType === 'conic') {
 | 
					      if (this._sensorType === 'conic') {
 | 
				
			||||||
        this.createConicSensor(this.entity)
 | 
					        this.createConicSensor(this.entity)
 | 
				
			||||||
      } else if (this._sensorType === 'rectangle') {
 | 
					      } else if (this._sensorType === 'rectangle') {
 | 
				
			||||||
@ -503,16 +503,17 @@ class SatelliteEntity {
 | 
				
			|||||||
        viewer.scene.primitives.remove(this.sensorEntity)
 | 
					        viewer.scene.primitives.remove(this.sensorEntity)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      this.sensorEntity = null
 | 
					      this.sensorEntity = null
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      viewer.scene.preRender.addEventListener(this._listener)
 | 
					      viewer.scene.preRender.addEventListener(this._listener)
 | 
				
			||||||
      this._listener = null
 | 
					      this._listener = null
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  destroy() {
 | 
					  destroy() {
 | 
				
			||||||
 | 
					    this.removeSensor()
 | 
				
			||||||
    viewer.entities.remove(this.entity)
 | 
					    viewer.entities.remove(this.entity)
 | 
				
			||||||
    this.underPointEntity && viewer.entities.remove(this.underPointEntity)
 | 
					    this.underPointEntity && viewer.entities.remove(this.underPointEntity)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.removeListener()
 | 
					    this.removeListener()
 | 
				
			||||||
    this.removeSensor()
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  removeListener() {
 | 
					  removeListener() {
 | 
				
			||||||
 | 
				
			|||||||
@ -226,18 +226,18 @@ function addDaodan(trajData, type = 0) {
 | 
				
			|||||||
let minTime = 0
 | 
					let minTime = 0
 | 
				
			||||||
function initDaodan() {
 | 
					function initDaodan() {
 | 
				
			||||||
  saveDataToStore()
 | 
					  saveDataToStore()
 | 
				
			||||||
  // minTime = getMinTime([
 | 
					  minTime = getMinTime([
 | 
				
			||||||
  //   ...toRaw(trajData.value.data),
 | 
					    ...toRaw(trajData.value.data),
 | 
				
			||||||
  //   ...toRaw(interceptData.value.map(item => toRaw(item.data))).flat(Infinity),
 | 
					    ...toRaw(interceptData.value.map(item => toRaw(item.data))).flat(Infinity),
 | 
				
			||||||
  // ])
 | 
					  ])
 | 
				
			||||||
  // // console.log(minTime)
 | 
					  // console.log(minTime)
 | 
				
			||||||
  // addDaodan(trajData.value)
 | 
					  addDaodan(trajData.value)
 | 
				
			||||||
  // aniIndexMap.set(trajData.value.id, 0)
 | 
					  aniIndexMap.set(trajData.value.id, 0)
 | 
				
			||||||
  // interceptData.value.forEach(item => {
 | 
					  interceptData.value.forEach(item => {
 | 
				
			||||||
  //   const { id, data } = item
 | 
					    const { id, data } = item
 | 
				
			||||||
  //   addDaodan(item, 1)
 | 
					    addDaodan(item, 1)
 | 
				
			||||||
  //   aniIndexMap.set(id, 0)
 | 
					    aniIndexMap.set(id, 0)
 | 
				
			||||||
  // })
 | 
					  })
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function getMinTime(data) {
 | 
					function getMinTime(data) {
 | 
				
			||||||
 | 
				
			|||||||
@ -17,6 +17,7 @@ import EventList from './components/EventList'
 | 
				
			|||||||
import NewTask from './components/TaskList/components/NewTask'
 | 
					import NewTask from './components/TaskList/components/NewTask'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import useTask from './components/TaskList/components/NewTask/hooks'
 | 
					import useTask from './components/TaskList/components/NewTask/hooks'
 | 
				
			||||||
 | 
					import { useEvent } from './components/EventList/hooks'
 | 
				
			||||||
export default defineComponent({
 | 
					export default defineComponent({
 | 
				
			||||||
  setup() {
 | 
					  setup() {
 | 
				
			||||||
    const show = ref(false)
 | 
					    const show = ref(false)
 | 
				
			||||||
@ -36,6 +37,13 @@ export default defineComponent({
 | 
				
			|||||||
    const dd = ref(`DD-1`)
 | 
					    const dd = ref(`DD-1`)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const paneClass = `border-1 h-full border-l-0 border-[var(--n-tab-border-color)] !p-2`
 | 
					    const paneClass = `border-1 h-full border-l-0 border-[var(--n-tab-border-color)] !p-2`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const { showMainEvent, mainEventData } = useEvent()
 | 
				
			||||||
 | 
					    const addNewMainEvent = () => {
 | 
				
			||||||
 | 
					      showMainEvent.value = true
 | 
				
			||||||
 | 
					      mainEventData.value = {}
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return () => (
 | 
					    return () => (
 | 
				
			||||||
      <div class="flex flex-col bg-[#1c202c] w-h-full">
 | 
					      <div class="flex flex-col bg-[#1c202c] w-h-full">
 | 
				
			||||||
        <div class="relative h-[60px]">
 | 
					        <div class="relative h-[60px]">
 | 
				
			||||||
@ -114,9 +122,9 @@ export default defineComponent({
 | 
				
			|||||||
                        type="daterange"
 | 
					                        type="daterange"
 | 
				
			||||||
                        clearable
 | 
					                        clearable
 | 
				
			||||||
                      />
 | 
					                      />
 | 
				
			||||||
                      {/* <NButton type="primary" onClick={addNewTask}>
 | 
					                      <NButton type="primary" onClick={addNewMainEvent}>
 | 
				
			||||||
                        添加事件
 | 
					                        添加事件
 | 
				
			||||||
                      </NButton> */}
 | 
					                      </NButton>
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
                    <div class="flex-1">
 | 
					                    <div class="flex-1">
 | 
				
			||||||
                      <EventList dd={dd.value} />
 | 
					                      <EventList dd={dd.value} />
 | 
				
			||||||
 | 
				
			|||||||
@ -23,6 +23,8 @@ export const useMultiMBTrajectory = () => {
 | 
				
			|||||||
  const isPaused = ref<boolean>(false)
 | 
					  const isPaused = ref<boolean>(false)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async function loadMultiHisTraj(timeRange: string[]) {
 | 
					  async function loadMultiHisTraj(timeRange: string[]) {
 | 
				
			||||||
 | 
					    removeEntities()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const mbIds = [...mubiaoMap.keys()]
 | 
					    const mbIds = [...mubiaoMap.keys()]
 | 
				
			||||||
    showEntity(false)
 | 
					    showEntity(false)
 | 
				
			||||||
    if (mbIds.length === 0) {
 | 
					    if (mbIds.length === 0) {
 | 
				
			||||||
@ -33,13 +35,14 @@ export const useMultiMBTrajectory = () => {
 | 
				
			|||||||
        id: mbId,
 | 
					        id: mbId,
 | 
				
			||||||
        timeRange,
 | 
					        timeRange,
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
 | 
					      // console.log(points, posArray, timeArray)
 | 
				
			||||||
      timesMap.value.set(mbId, timeArray)
 | 
					      timesMap.value.set(mbId, timeArray)
 | 
				
			||||||
      if (timeArray.length <= 1) {
 | 
					      if (timeArray.length <= 1) {
 | 
				
			||||||
        continue
 | 
					        continue
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      const color = Cesium.Color.fromRandom({ alpha: 1 })
 | 
					      const color = Cesium.Color.fromRandom({ alpha: 1 })
 | 
				
			||||||
      createTarget(mbId, points, posArray as number[], color)
 | 
					      createTarget(mbId, points, posArray as number[], color, timeArray)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const allTime = [...timesMap.value.values()].flat()
 | 
					    const allTime = [...timesMap.value.values()].flat()
 | 
				
			||||||
@ -49,29 +52,33 @@ export const useMultiMBTrajectory = () => {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  function showOrHideMultiHisTraj() {
 | 
					  function showOrHideMultiHisTraj() {
 | 
				
			||||||
    if (showMultiHisTrajCom.value) {
 | 
					    // if (showMultiHisTrajCom.value) {
 | 
				
			||||||
      reset()
 | 
					    reset()
 | 
				
			||||||
    }
 | 
					    // }
 | 
				
			||||||
    showMultiHisTrajCom.value = !showMultiHisTrajCom.value
 | 
					    showMultiHisTrajCom.value = !showMultiHisTrajCom.value
 | 
				
			||||||
    removeEntities()
 | 
					    if (!showMultiHisTrajCom.value) {
 | 
				
			||||||
 | 
					      removeEntities()
 | 
				
			||||||
 | 
					      showEntity(true)
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  function createTarget(
 | 
					  function createTarget(
 | 
				
			||||||
    mbId: string,
 | 
					    mbId: string,
 | 
				
			||||||
    points: TPoints,
 | 
					    points: TPoints,
 | 
				
			||||||
    posArray: number[],
 | 
					    posArray: number[],
 | 
				
			||||||
    color: Cesium.Color
 | 
					    color: Cesium.Color,
 | 
				
			||||||
 | 
					    timeArray: number[]
 | 
				
			||||||
  ) {
 | 
					  ) {
 | 
				
			||||||
    // const totalAnimationTime = points[points.length - 1].time
 | 
					    // const totalAnimationTime = points[points.length - 1].time
 | 
				
			||||||
    // console.log('totalAnimationTime', totalAnimationTime)
 | 
					    // console.log('totalAnimationTime', totalAnimationTime)
 | 
				
			||||||
    const positionProperty = new Cesium.SampledPositionProperty()
 | 
					    const positionProperty = new Cesium.SampledPositionProperty()
 | 
				
			||||||
    // const startTime = Cesium.JulianDate.now()
 | 
					    // const startTime = Cesium.JulianDate.now()
 | 
				
			||||||
    // 添加路径点到位置属性
 | 
					    // 添加路径点到位置属性
 | 
				
			||||||
    points.forEach(point => {
 | 
					    points.forEach((point, index) => {
 | 
				
			||||||
      const pointEntity = createPoint(point.position, color)
 | 
					      const pointEntity = createPoint(point.position, color)
 | 
				
			||||||
      pointsEntities.push(pointEntity)
 | 
					      pointsEntities.push(pointEntity)
 | 
				
			||||||
      const time = Cesium.JulianDate.fromDate(new Date(point.time))
 | 
					      const time = Cesium.JulianDate.fromDate(new Date(timeArray[index]))
 | 
				
			||||||
 | 
					      // console.log(new Date(timeArray[index]).toLocaleString())
 | 
				
			||||||
      positionProperty.addSample(time, point.position)
 | 
					      positionProperty.addSample(time, point.position)
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -79,8 +86,10 @@ export const useMultiMBTrajectory = () => {
 | 
				
			|||||||
      id: mbId,
 | 
					      id: mbId,
 | 
				
			||||||
      targetType: '甲',
 | 
					      targetType: '甲',
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					    // console.log(mbEntityOpt)
 | 
				
			||||||
    // 创建实体
 | 
					    // 创建实体
 | 
				
			||||||
    const mbTarget = viewer.entities.add({
 | 
					    const mbTarget = viewer.entities.add({
 | 
				
			||||||
 | 
					      show: true,
 | 
				
			||||||
      position: positionProperty,
 | 
					      position: positionProperty,
 | 
				
			||||||
      // point: { pixelSize: 10, color: Cesium.Color.RED },
 | 
					      // point: { pixelSize: 10, color: Cesium.Color.RED },
 | 
				
			||||||
      polyline: {
 | 
					      polyline: {
 | 
				
			||||||
@ -95,7 +104,6 @@ export const useMultiMBTrajectory = () => {
 | 
				
			|||||||
      ...mbEntityOpt,
 | 
					      ...mbEntityOpt,
 | 
				
			||||||
      orientation: new Cesium.VelocityOrientationProperty(positionProperty),
 | 
					      orientation: new Cesium.VelocityOrientationProperty(positionProperty),
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					 | 
				
			||||||
    mbTargetMap.set(mbId, mbTarget)
 | 
					    mbTargetMap.set(mbId, mbTarget)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  function createPoint(position: Cesium.Cartesian3, color: Cesium.Color) {
 | 
					  function createPoint(position: Cesium.Cartesian3, color: Cesium.Color) {
 | 
				
			||||||
@ -173,7 +181,6 @@ export const useMultiMBTrajectory = () => {
 | 
				
			|||||||
      viewer.entities.remove(mbTarget)
 | 
					      viewer.entities.remove(mbTarget)
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
    mbTargetMap.clear()
 | 
					    mbTargetMap.clear()
 | 
				
			||||||
    showEntity(true)
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return {
 | 
					  return {
 | 
				
			||||||
    customElapsedTime,
 | 
					    customElapsedTime,
 | 
				
			||||||
 | 
				
			|||||||
@ -56,6 +56,12 @@ export const useMubiao = () => {
 | 
				
			|||||||
    const addIds = difference(ids, [...mubiaoMap.keys()])
 | 
					    const addIds = difference(ids, [...mubiaoMap.keys()])
 | 
				
			||||||
    const removeIds = difference([...mubiaoMap.keys()], ids)
 | 
					    const removeIds = difference([...mubiaoMap.keys()], ids)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // 删除
 | 
				
			||||||
 | 
					    if (removeIds.length > 0) {
 | 
				
			||||||
 | 
					      removeIds.forEach(id => {
 | 
				
			||||||
 | 
					        removeMubiao(id)
 | 
				
			||||||
 | 
					      })
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    // 添加
 | 
					    // 添加
 | 
				
			||||||
    if (addIds.length > 0) {
 | 
					    if (addIds.length > 0) {
 | 
				
			||||||
      const nodes = filterTreeNodeByField({
 | 
					      const nodes = filterTreeNodeByField({
 | 
				
			||||||
@ -89,13 +95,6 @@ export const useMubiao = () => {
 | 
				
			|||||||
        mubiaoMap.set(id, mbEntity)
 | 
					        mubiaoMap.set(id, mbEntity)
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
    // 删除
 | 
					 | 
				
			||||||
    if (removeIds.length > 0) {
 | 
					 | 
				
			||||||
      removeIds.forEach(id => {
 | 
					 | 
				
			||||||
        removeMubiao(id)
 | 
					 | 
				
			||||||
      })
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  async function postCheckedIds(ids: Array<string | number>) {
 | 
					  async function postCheckedIds(ids: Array<string | number>) {
 | 
				
			||||||
 | 
				
			|||||||
@ -37,7 +37,9 @@ export function useSatellite() {
 | 
				
			|||||||
  function addSatellites(ids: Array<string | number>) {
 | 
					  function addSatellites(ids: Array<string | number>) {
 | 
				
			||||||
    const addIds = difference(ids, [...satelliteMap.keys()])
 | 
					    const addIds = difference(ids, [...satelliteMap.keys()])
 | 
				
			||||||
    const removeIds = difference([...satelliteMap.keys()], ids)
 | 
					    const removeIds = difference([...satelliteMap.keys()], ids)
 | 
				
			||||||
 | 
					    removeIds.forEach(id => {
 | 
				
			||||||
 | 
					      removeSatellite(id)
 | 
				
			||||||
 | 
					    })
 | 
				
			||||||
    if (addIds.length > 0) {
 | 
					    if (addIds.length > 0) {
 | 
				
			||||||
      const nodes = filterTreeNodeByField({
 | 
					      const nodes = filterTreeNodeByField({
 | 
				
			||||||
        treeData: satelliteList.value,
 | 
					        treeData: satelliteList.value,
 | 
				
			||||||
@ -53,10 +55,6 @@ export function useSatellite() {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
    removeIds.forEach(id => {
 | 
					 | 
				
			||||||
      removeSatellite(id)
 | 
					 | 
				
			||||||
    })
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  // 创建satellite entity 实例
 | 
					  // 创建satellite entity 实例
 | 
				
			||||||
  function addSatellite({ id, tle }: ISatellite) {
 | 
					  function addSatellite({ id, tle }: ISatellite) {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user