删除多余的代码
parent
141aa83f2d
commit
1aba962b06
|
@ -5,8 +5,6 @@ let entities = []
|
||||||
const load = (value) => {
|
const load = (value) => {
|
||||||
entities = value
|
entities = value
|
||||||
|
|
||||||
console.log(entities, store, "==================");
|
|
||||||
|
|
||||||
// 将卫星状态信息存储到store中
|
// 将卫星状态信息存储到store中
|
||||||
const satellites = filter('Satellite')
|
const satellites = filter('Satellite')
|
||||||
const satellite_state_arr = satellites.map(({ id, show }) => { return { id, show } })
|
const satellite_state_arr = satellites.map(({ id, show }) => { return { id, show } })
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, computed, watch } from 'vue'
|
import { computed } from 'vue'
|
||||||
import { useStore } from 'vuex'
|
import { useStore } from 'vuex'
|
||||||
import { VcViewer, VcLayerImagery, VcProviderImageryTianditu, VcNavigation, VcDatasourceCzml } from 'vue-cesium'
|
import { VcViewer, VcLayerImagery, VcProviderImageryTianditu, VcNavigation, VcDatasourceCzml } from 'vue-cesium'
|
||||||
// import 'vue-cesium/dist/index.css'
|
// import 'vue-cesium/dist/index.css'
|
||||||
|
@ -21,15 +21,9 @@ import earth from '../assets/earth.jpg'
|
||||||
|
|
||||||
import entity from '../api/entity'
|
import entity from '../api/entity'
|
||||||
|
|
||||||
|
// 卫星轨道数据处理
|
||||||
const store = useStore()
|
const store = useStore()
|
||||||
const czml = computed(() => './CZML/' + store.state.satelliteSystem.name + '.czml')
|
const czml = computed(() => './CZML/' + store.state.satelliteSystem.name + '.czml')
|
||||||
|
|
||||||
let entities = null
|
|
||||||
const getEntityById = id => {
|
|
||||||
if (!entities) return null
|
|
||||||
|
|
||||||
return entities.find(entity => entity.id === id)
|
|
||||||
}
|
|
||||||
const onDataSourceReady = ({ viewer, cesiumObject }) => {
|
const onDataSourceReady = ({ viewer, cesiumObject }) => {
|
||||||
viewer.flyTo(cesiumObject)
|
viewer.flyTo(cesiumObject)
|
||||||
entity.load(cesiumObject.entities.values)
|
entity.load(cesiumObject.entities.values)
|
||||||
|
@ -38,20 +32,10 @@ const onDataSourceReady = ({ viewer, cesiumObject }) => {
|
||||||
viewer.selectedEntity = entity.find('Constellation')
|
viewer.selectedEntity = entity.find('Constellation')
|
||||||
}
|
}
|
||||||
|
|
||||||
let vcViewerInstance = null
|
// 显示/隐藏、跟踪卫星等交互操作
|
||||||
// const trackedSatelliteId = computed(() => store.state.trackedSatellite.id)
|
let vcViewerInstance = null
|
||||||
// watch(trackedSatelliteId, (value) => {
|
|
||||||
// const entity = getEntityById(value)
|
|
||||||
|
|
||||||
// if (!entity || !vcViewerInstance) return
|
|
||||||
|
|
||||||
// vcViewerInstance.selectedEntity = entity
|
|
||||||
// vcViewerInstance.trackedEntity = entity
|
|
||||||
// })
|
|
||||||
|
|
||||||
|
|
||||||
// 显示/隐藏卫星
|
|
||||||
store.subscribe(({ type, payload }) => {
|
store.subscribe(({ type, payload }) => {
|
||||||
|
// 显示/隐藏卫星
|
||||||
if (type === 'satellites/toggleShow') {
|
if (type === 'satellites/toggleShow') {
|
||||||
const satellite = entity.get(payload)
|
const satellite = entity.get(payload)
|
||||||
if (!satellite) return
|
if (!satellite) return
|
||||||
|
@ -59,6 +43,7 @@ store.subscribe(({ type, payload }) => {
|
||||||
satellite.show = !satellite.show
|
satellite.show = !satellite.show
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 跟踪卫星
|
||||||
if (type === 'satellites/track') {
|
if (type === 'satellites/track') {
|
||||||
const satellite = entity.get(payload)
|
const satellite = entity.get(payload)
|
||||||
if (!satellite || !vcViewerInstance) return
|
if (!satellite || !vcViewerInstance) return
|
||||||
|
@ -67,10 +52,8 @@ store.subscribe(({ type, payload }) => {
|
||||||
vcViewerInstance.trackedEntity = satellite
|
vcViewerInstance.trackedEntity = satellite
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const onTrackedEntityChanged = entity => {
|
|
||||||
if (!entity) store.commit('trackedSatellite/set', null)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// 初始化视图参数
|
||||||
const onViewerReady = ({ viewer }) => {
|
const onViewerReady = ({ viewer }) => {
|
||||||
vcViewerInstance = viewer
|
vcViewerInstance = viewer
|
||||||
|
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
const state = {
|
|
||||||
id: null
|
|
||||||
}
|
|
||||||
|
|
||||||
// getters
|
|
||||||
// const getters = {
|
|
||||||
// get: (state) => state.value
|
|
||||||
// }
|
|
||||||
|
|
||||||
// actions
|
|
||||||
const actions = {
|
|
||||||
set ({ commit }, { trackedSatelliteId }) {
|
|
||||||
commit('set', trackedSatelliteId)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// mutations
|
|
||||||
const mutations = {
|
|
||||||
set (state, trackedSatelliteId) {
|
|
||||||
state.id = trackedSatelliteId
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
|
||||||
namespaced: true,
|
|
||||||
state,
|
|
||||||
// getters,
|
|
||||||
actions,
|
|
||||||
mutations
|
|
||||||
}
|
|
Loading…
Reference in New Issue