类名 common/document/layer/ogc/OGCLayer.js
import { Zondy } from '../../../base'
import { defaultValue } from '../../../util'
import { Layer } from '../baseLayer'

/**
 * OGS图层基类
 * @classdesc OGS图层基类
 * @class OGCLayer
 * @moduleEX LayerModule
 * @extends Layer
 * @param {Object} options 构造参数
 * @param {Number} [options.minScale = 0] 最小缩放级数
 * @param {Number} [options.maxScale = 20] 最大缩放级数
 * @param {String} [options.tokenKey = 'token'] token名
 * @param {String} [options.tokenValue = undefined] token值
 * @param {String} [options.version = ''] 服务版本
 * @param {Object} [options.customParameters = {}] 自定义服务参数
 * @param {Object} [options.customLayerParameters = {}] 自定义图层参数
 */
class OGCLayer extends Layer {
  constructor(options) {
    super(options)
    // eslint-disable-next-line no-param-reassign
    options = defaultValue(options, {})

    /**
     * ogc版本号
     * @member {String} OGCLayer.prototype.version
     */
    this.version = defaultValue(options.version, '')

    /**
     * 自定义查询参数customParameters
     * @member {Object} OGCLayer.prototype.customParameters
     */
    this.customParameters = defaultValue(options.customParameters, {})
    /**
     * 图层自定义查询参数customLayerParameters
     * @member {Object} WFSLayer.OGCLayer.customLayerParameters
     */
    this.customLayerParameters = defaultValue(options.customLayerParameters, {})
  }

  /**
   * @description 转换为json对象
   * @return {Object} json对象
   */
  toJSON() {
    const _json = super.toJSON()
    _json.version = this.version
    _json.customParameters = JSON.parse(JSON.stringify(this.customParameters))
    _json.customLayerParameters = JSON.parse(
      JSON.stringify(this.customLayerParameters)
    )
    return _json
  }
}

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