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