删除多余的代码

master
叶志超 2021-12-23 10:13:30 +08:00
parent 141aa83f2d
commit 1aba962b06
3 changed files with 7 additions and 56 deletions

View File

@ -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 } })

View File

@ -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
// })
// /
// /
let vcViewerInstance = null
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

View File

@ -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
}