import { PublicConfigClass } from '@/packages/public'
import { CreateComponentType } from '@/packages/index.d'
import { Mars3dConfig } from './index'
import { chartInitConfig } from '@/settings/designSetting'
import cloneDeep from 'lodash/cloneDeep'
import dataJson from './data.json'

export enum ThemeEnum {
  NORMAL = 'normal',
  DARK = 'dark',
  LIGHT = 'light',
  WHITES_MOKE = 'whitesmoke',
  FRESH = 'fresh',
  GREY = 'grey',
  GRAFFITI = 'graffiti',
  MACARON = 'macaron',
  BLUE = 'blue',
  DARKBLUE = 'darkblue',
  WINE = 'wine'
}

export enum LangEnum {
  ZH_CN = 'zh_cn',
  EN = 'en',
  ZH_EN = 'zh_en'
}

export enum ViewModeEnum {
  PLANE = '2D',
  STEREOSCOPIC = '3D'
}

export const ShowHideEnum = {
  SHOW: true,
  HIDE: false
}

export enum FeaturesEnum {
  BG = 'bg',
  POINT = 'point',
  ROAD = 'road',
  BUILDING = 'building'
}

export enum MarkerEnum {
  // 圆圈
  CIRCLE_MARKER = 'CircleMarker',
  // 定位标点
  MARKER = 'Marker',
  // 暂无
  NONE = 'none'
}

export const option = {
  dataset: dataJson,
  mapOptions:{
    "scene": {
      "center": {"lat":35.362625,"lng":118.033886,"alt":8306.3,"heading":360,"pitch":-45},
      "scene3DOnly": false,
      "shadows": false,
      "removeDblClick": true,
      "sceneMode": 3,
      "showSun": true,
      "showMoon": true,
      "showSkyBox": true,
      "showSkyAtmosphere": true,
      "fog": true,
      "fxaa": true,
      "requestRenderMode": true,
      "contextOptions": {
        "requestWebgl1": false,
        "webgl": {
          "preserveDrawingBuffer": true
        }
      },
      "globe": {
        "depthTestAgainstTerrain": false,
        "baseColor": "#546a53",
        "showGroundAtmosphere": true,
        "enableLighting": false
      },
      "cameraController": {
        "zoomFactor": 3.0,
        "minimumZoomDistance": 1,
        "maximumZoomDistance": 50000000,
        "enableRotate": true,
        "enableTranslate": true,
        "enableTilt": true,
        "enableZoom": true,
        "enableCollisionDetection": true,
        "minimumCollisionTerrainHeight": 15000
      }
    },
    "control": {
      "homeButton": true,
      "baseLayerPicker": false,
      "sceneModePicker": true,
      "vrButton": false,
      "fullscreenButton": true,
      "navigationHelpButton": true,
      "animation": false,
      "timeline": false,
      "infoBox": false,
      "geocoder": false,
      "selectionIndicator": false,
      "showRenderLoopErrors": true,
      "contextmenu": {
        "hasDefault": true
      },
      "mouseDownView": true,
      "zoom": {
        "insertIndex": 1
      },
      "compass": {
        "bottom": "toolbar",
        "left": "5px"
      },
      "distanceLegend": {
        "left": "10px",
        "bottom": "2px"
      },
      "locationBar": {
        "crs": "CGCS2000_GK_Zone_3",
        "crsDecimal": 0,
        "template": "<div>经度:{lng}</div> <div>纬度:{lat}</div> <div class='hide1000'>横{crsx}  纵{crsy}</div> <div>海拔：{alt}米</div> <div class='hide700'>层级：{level}</div><div>方向：{heading}°</div> <div>俯仰角：{pitch}°</div><div class='hide700'>视高：{cameraHeight}米</div>"
      }
    },
    "method": {
      "templateValues": {
        "dataServer": "//data.mars3d.cn",
        "gltfServerUrl": "//data.mars3d.cn/gltf"
      }
    },
    "terrain": {
      "url": "//data.mars3d.cn/terrain",
      "show": true,
      "clip": true
    },
    "basemaps": [
      {
        "id": 10,
        "name": "地图底图",
        "type": "group"
      },
      {
        "pid": 10,
        "name": "天地图影像",
        "icon": "//data.mars3d.cn/img/thumbnail/basemap/tdt_img.png",
        "type": "group",
        "layers": [
          {
            "name": "底图",
            "type": "tdt",
            "layer": "img_d"
          },
          {
            "name": "注记",
            "type": "tdt",
            "layer": "img_z"
          }
        ],
        "show": false
      }
    ],
    "layers": []
  }
}

export default class Config extends PublicConfigClass implements CreateComponentType {
  public key = Mars3dConfig.key
  public attr = { ...chartInitConfig, w: 1000, h: 800, zIndex: -1 }
  public chartConfig = cloneDeep(Mars3dConfig)
  public option = cloneDeep(option)
}
