import WebGlobe from "./components/WebGlobe/WebGlobe";

// 工具
import { StateControl } from "./components/UI/Controls";

// 影像
import * as ImageryLayer from "./components/Provider/ImageProvider";
import { IgsDocLayer, IgsTileLayer } from "./components/Layer/IGServer";
import { RasterLayer } from "./components/Layer/RasterTile";

// 模型
import { IgsM3d, Tileset } from "./components/M3D";

import { Popup } from "./components/UI/Popup";
import { MapvLayer } from "./components/Overlay";

// 地形
// import * as CesiumTerrainProvider from './components/terrain/cesium'
// 数据源
import * as GeoJsonDataSource from "./components/DataSource/Geojson";

/**
 * @const {string} VueCesium version
 */
const VERSION = "C_PKG_VERSION";

const $vc = {
  VERSION
};

/**
 * Register all VueCesium components.
 * @param {Object} Vue
 * @param {Object} options
 */
function plugin(Vue, options = {}) {
  if (plugin.installed) {
    return;
  }
  plugin.installed = true;
  // 视图
  Vue.use(WebGlobe, options);
  Vue.use(Viewer, options);
  // 影像
  Vue.use(ImageryLayer, options);
  Vue.use(MapboxImageryProvider, options);
  Vue.use(CustomImageryProvider, options);

  Vue.use(GeoJsonDataSource, options);
  Vue.prototype.$vc = $vc;
}

export default plugin;

export const CesiumWebGlobe = WebGlobe;
export const CesiumStateControl = StateControl;

export const CesiumImageryLayer = ImageryLayer;
export const CesiumRasterLayer = RasterLayer;
export const CesiumIgsDocLayer = IgsDocLayer;
export const CesiumIgsTileLayer = IgsTileLayer;

export const Cesium3dTileset = Tileset;
export const CesiumIgsM3d = IgsM3d;

export const CesiumGeojsonDatasource = GeoJsonDataSource;
export const CesiumPopup = Popup;

export const CesiumMapvLayer = MapvLayer;

export {
  VERSION,
  plugin as install,
  WebGlobe,
  StateControl,
  RasterLayer,
  ImageryLayer,
  IgsDocLayer,
  IgsTileLayer,
  Popup,
  MapvLayer,
  GeoJsonDataSource,
  Tileset,
  IgsM3d
};
