/*
 * @Author: 杨晓凡 154408238@qq.com
 * @Date: 2023-05-04 18:51:46
 * @LastEditors: 杨晓凡 154408238@qq.com
 * @LastEditTime: 2023-05-04 19:49:41
 * @FilePath: \vue_template\src\components\earth\Earth.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
// import LayerManager from './layerManager.js'
// import FlyManager from './flyManager.js'
// import WeahterManager from './weatherManager.js'
class Earth {
  constructor(elementId, configs) {
    try {
      Cesium.Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJmZWM5Zjc0MS1mMTNiLTQ5Y2QtOTFhNi0yMzY5YzNiOGRjODQiLCJpZCI6Njg1MDEsImlhdCI6MTYzMjY0ODA4Nn0.n2euazDMBBIBVAz-eWojvZ9Ervzwpnq7ccFl0nyuJew'
      const viewer = new Cesium.Viewer(elementId, {
        ...configs,
        infoBox: false, // 关闭信息展示
        navigation: false, // 指南针
        animation: false, // 原生左下角动画空间
        timeline: true, // 时间线
        // 右上角按钮
        baseLayerPicker: false,
        homeButton: false,
        sceneModePicker: false,
        navigationHelpButton: false,
        geocoder: false,
        baseLayer: undefined,
        // 动画自动播放
        // shouldAnimate: true,
        // contextOptions: {
        //   requestWebgl1: true // 指定上下文，使用webgl1的上下文
        // },

        selectionIndicator: false // 去除绿色选择框
      })
      viewer._cesiumWidget._creditContainer.style.display = 'none'
      viewer.timeline.container.style.display = 'none'
      this.viewer = viewer
      this.scene = viewer.scene

      // this.layerManager = new LayerManager(viewer)
      // this.flyManager = new FlyManager(viewer)
      // this.weatherManager = WeahterManager
    } catch (error) {
      console.error(error, 'cesium渲染遇到问题啦')
    }
  }

  //   控制地球的显隐
  globeShow(isGlobeShow) {
    this.scene.globe.show = isGlobeShow
  }

  // initFlymanager (routes) {
  //   this.flyManager = new FlyManager(this.viewer)
  //   this.flyManager.initFly(routes)
  // }
}

export default Earth
