    import { defaultValue } from '../../../util'
    import { Extent } from '../../../base/geometry'
    import { SubLayer } from '../baseLayer'

    /**
     * ArcGIS地图图片子图层
     * @class ArcGISMapImageSubLayer
     * @moduleEX LayerModule
     * @extends SubLayer
     * @param {Object} options 构造参数
     * @param {String} [options.url] 服务基地址
     * @param {String} [options.name] 图层名称
     * @param {SpatialReference} [options.spatialReference] 图层坐标系
     * @param {Boolean} [options.visible = true] 图层可见性
     * @param {IGSMapImageLayer} [options.layer] 图层的父图层对象
     * @param {String} [options.id] 图层id
     */
    class ArcGISMapImageSubLayer extends SubLayer {
      constructor(options) {
        super(options)
        this.url = defaultValue(options.url, '')
        this.name = defaultValue(options.name, '')
        this.type = defaultValue(options.type, '')
        this.fields = defaultValue(options.fields, [])
        this.geomType = defaultValue(options.geomType || options.GeomType, '')
        this.maxScale = defaultValue(options.maxScale, 0)
        this.minScale = defaultValue(options.minScale, 0)
        if (options.range) {
          this.extent = new Extent({
            xmin: options.range.xmin,
            ymin: options.range.ymin,
            xmax: options.range.xmax,
            ymax: options.range.ymax
          })
        } else {
          this.extent = new Extent({
            xmin: -180,
            ymin: -90,
            xmax: 180,
            ymax: 90
          })
        }
        this.spatialReference = defaultValue(options.spatialReference, undefined)
        this.supportedMethods = defaultValue(options.supportedMethods, [])
        this.systemLibGuid = defaultValue(options.systemLibGuid, undefined)
        this.systemLibName = defaultValue(options.systemLibName, undefined)
        this.id = options.id
        this.index = defaultValue(options.index, undefined)
        this.moveIndex = defaultValue(options.moveIndex, undefined)
        this._renderer = defaultValue(options.renderer, undefined)
        this.layer = defaultValue(options.layer, undefined)
      }

      static fromJSON(json) {
        json = defaultValue(json, {})
        return new ArcGISMapImageSubLayer(json)
      }
    }

    Object.defineProperties(ArcGISMapImageSubLayer.prototype, {
      /**
       * 渲染样式对象
       * @readonly
       * @member {BaseRenderer} ArcGISMapImageSubLayer.prototype.renderer
       */
      renderer: {
        get() {
          return this._renderer
        },
        set(value) {
          this._renderer = value
          // 更新子图层
          this.layer.setSubLayer(this)
        }
      }
    })
    export default ArcGISMapImageSubLayer