    import Layer from './Layer'
    import { Zondy, ElevationInfo } from '../../../base'
    import { GeometryType, LayerType } from '../../../base/enum'
    import {defaultValue, toJSON} from '../../../util'
    import { BaseRenderer } from '../../renderer'

    /**
     * 要素图层基类
     * @class FeatureLayer
     * @moduleEX LayerModule
     * @extends Layer
     * @param {Object} options 构造参数
     * @param {String} [options.id = 随机] 图层id
     * @param {Array} [options.features = []] 要素集合
     * @param {Object} [options.renderer = undefined] 渲染样式
     * @param {Number} [options.minScale = 0] 最小缩放级数
     * @param {Number} [options.maxScale = 20] 最大缩放级数
     * @param {String} [options.tokenKey = 'token'] token名
     * @param {String} [options.tokenValue = ''] token值
     * @param {ElevationInfo} [options.ElevationInfo = new ElevationInfo()] 三维描述信息，暂时不支持
     */
    class FeatureLayer extends Layer {
      constructor(options) {
        super(options)
        options = defaultValue(options, {})
        this.type = LayerType.feature
        /**
         * 三维描述信息
         * @member {ElevationInfo} FeatureLayer.prototype.elevationInfo
         */
        this.elevationInfo = new ElevationInfo(options.elevationInfo)
        /**
         * 几何类型
         * @member {String} FeatureLayer.prototype.geometryType
         */
        this.geometryType = GeometryType.geometry
        /**
         * 渲染器
         * @member {BaseRenderer} FeatureLayer.prototype.renderer
         */
        this.renderer = this._decorate(
          'renderer',
          options.renderer,
          BaseRenderer,
          BaseRenderer.fromJSON
        )
      }

      /**
       * @description 转换为json对象
       * @return {Object} json对象
       */
      toJSON() {
        const json = super.toJSON()
        json.renderer = toJSON(this.renderer, BaseRenderer)
        json.elevationInfo = toJSON(this.elevationInfo, ElevationInfo)
        json.geometryType = this.geometryType

        return json
      }

      /**
       * @description 克隆方法
       * @return {FeatureLayer} 图层
       */
      clone() {
        return new FeatureLayer(this.toJSON())
      }
    }

    Zondy.Layer.FeatureLayer = FeatureLayer
    export default FeatureLayer