类名 common/document/layer/overLay/MapVLayer.js
import OverlayLayer from './OverlayLayer'
import { defaultValue } from '../../../util'
import { Zondy } from '../../../base'
import { LayerType, LoadStatus } from '../../../base/enum'

/**
 * MapV图层
 * @class MapVLayer
 * @moduleEX LayerModule
 * @extends VectorTileLayer
 * @param {Object} options 构造参数
 * @param {Object} [options.mapVOptions] mapV的构造参数
 */
class MapVLayer extends OverlayLayer {
  constructor(options) {
    super(options)
    options = defaultValue(options, {})

    /**
     * mapV的构造参数
     * @member {Object} MapVLayer.prototype.mapVOptions
     */
    this.mapVOptions = defaultValue(options.mapVOptions, {})
    /**
     * 图层类型
     * @member {String} MapVLayer.prototype.type
     */
    this.type = LayerType.mapv
    /**
     * MapV的元数据
     * @member {Object} MapVLayer.prototype.data
     */
    this.data = defaultValue(options.data, {})
  }

  /**
   * 从igs获取图层信息
   */
  load() {
    return new Promise((resolve) => {
      this.loadStatus = LoadStatus.loaded
      this.loaded = true
      resolve(this)
    })
  }

  /**
   * 将图层转为json对象
   * @return {Object} josn对象
   * */
  toJSON() {
    const json = {
      mapVOptions: this.mapVOptions,
      data: this.data
    }
    return JSON.parse(JSON.stringify(json))
  }

  /**
   * 克隆并返回一个新图层
   * @return {MapVLayer} 新的图层对象
   * */
  clone() {
    return new MapVLayer(this.toJSON())
  }
}

Zondy.Layer.MapVLayer = MapVLayer
export default MapVLayer
构造函数
成员变量
方法
事件