# MapGIS Client for JavaScript API

Cesium MapboxGL Leaflet OpenLayers
API文档

    import VisualVariable from './VisualVariable'
    import { defaultValue } from '../../../util'
    import VisualVariableType from '../../../base/enum/VisualVariableType'
    import SizeStop from './support/SizeStop'
    import { Zondy } from '../../../base'
    /**
     * color视觉变量
     * @class SizeVariable
     * @moduleEX BaseModule
     * @param {Object} options 初始化参数
     * @param {Number} [options.maxDataValue] 最大数据值
     * @param {Number} [options.maxSize] 符号最大size
     * @param {Number} [options.minDataValue] 最小数据值
     * @param {Number} [options.minSize] 符号最小size
     * @param {String} [options.normalizationField] 归一化字段
     * @param {Array<SizeStop>} [options.stops] 颜色分段数组
     */
    class SizeVariable extends VisualVariable {
      constructor(options) {
        super(options)
        options = defaultValue(options, {})
        this.type = VisualVariableType.size
        /**
         * 最大数据值
         * @member {Number} SizeVariable.prototype.maxDataValue
         */
        this.maxDataValue = options.maxDataValue
        /**
         * 符号最大size
         * @member {Number} SizeVariable.prototype.maxSize
         */
        this.maxSize = options.maxSize
        /**
         * 最小数据值
         * @member {Number} SizeVariable.prototype.minDataValue
         */
        this.minDataValue = options.minDataValue
        /**
         * 符号最小size
         * @member {Number} SizeVariable.prototype.minSize
         */

        this.minSize = options.minSize
        /**
         * 归一化字段
         * @member {String} SizeVariable.prototype.normalizationField
         */
        this.normalizationField = defaultValue(options.normalizationField, '')
        /**
         * size分段数组
         * @member {Array<SizeStop>} SizeVariable.prototype.stops
         */
        this.stops = defaultValue(options.stops, [])
        this.stops = this.stops.map((v) => SizeStop.fromJSON(v))
      }

      /**
       * 通过json构造SizeVariable对象
       * @return {SizeVariable} json对象
       * */
      static fromJSON(json) {
        return new SizeVariable(json)
      }

      /**
       * 导出为json对象
       * @return {Object} json对象
       * */
      toJSON() {
        const json = super.toJSON()
        json.type = this.type
        json.minSize = this.minSize
        json.maxSize = this.maxSize
        json.minDataValue = this.minDataValue
        json.maxDataValue = this.maxDataValue
        json.normalizationField = this.normalizationField
        json.stops = this.stops.map((v) => v.toJSON())
        return json
      }

      /**
       * 克隆对象
       * @return {SizeVariable} 克隆后的SizeVariable对象
       */
      clone() {
        return new SizeVariable(this.toJSON())
      }
    }

    Zondy.Renderer.VisualVariable.SizeVariable = SizeVariable
    export default SizeVariable

构造函数
成员变量
方法
事件