类名 common/base/symbol/Symbol3D.js
import Zondy from '../Zondy'
import { defaultValue } from '../../util'
import Collection from '../Collection'
import Symbol from './Symbol'
import {createSymbol3DLayer} from './symbol3DLayer';

/**
 * 三维符号基类,仅会支持三维场景,不支持二维场景<br/>
 * 几何类型对应的符号类型如下:<br/>
 * 点几何:PointSymbol3D, LabelSymbol3D<br/>
 * 线几何:LineSymbol3D, LabelSymbol3D<br/>
 * 区几何:PolygonSymbol3D, LabelSymbol3D<br/>
 * gltf:MeshSymbol3D, LabelSymbol3D<br/>
 * @param {Object} options 初始化参数
 * @param {Collection} [options.symbolLayers] symbolLayers 符号图层集合,用于可视化要素对象
 * */
class Symbol3D extends Symbol {
  constructor(options) {
    super(options)
    options = defaultValue(options, {})
    this.styleOrigin = undefined
    /**
     * 符号图层集合,用于可视化要素对象
     * @member {Collection} Symbol3D.prototype.symbolLayers
     */
    this.symbolLayers = new Collection()
    // 更新symbolLayers
    const _symbolLayers = defaultValue(options.symbolLayers, [])
    if (_symbolLayers instanceof Array && _symbolLayers.length > 0) {
      for (let i = 0; i < _symbolLayers.length; i++) {
        this.symbolLayers.add(createSymbol3DLayer(_symbolLayers[i]))
      }
    }
  }

  /**
   * <a id='toJSON'></a>
   * 导出为JSON对象
   * @return {Object} JSON对像
   */
  toJSON() {
    const _symbolLayers = []
    this.symbolLayers.forEach(function (symbol) {
      _symbolLayers.push(symbol.toJSON())
    })

    return {
      type: this.type,
      styleOrigin: this.styleOrigin,
      symbolLayers: _symbolLayers
    }
  }
}

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