import { VectorTileLayer } from '../../plugin'

class IGSVectorTileLayerUtil {}

IGSVectorTileLayerUtil.addIGSVectorTileLayer = function (
  layer,
  mapView,
  addCallback
) {
  const vectorTileLayer = new VectorTileLayer(mapView, {
    style: layer.style || layer.url,
    addCallback
  })

  vectorTileLayer.id = layer.id

  return vectorTileLayer
}

/**
 * 移除图层
 * @param {Object} layer 图层对象
 * @param {Viewer} sceneView Cesium的视图对象
 * */
IGSVectorTileLayerUtil.removeLayer = function (layer, sceneView) {
  sceneView.imageryLayers.remove(layer)
}
export default IGSVectorTileLayerUtil
