类名 common/base/symbol/support/LineStyleMarker3D.js
import Zondy from '../../Zondy'
import { defaultValue } from '../../../util'
import { LineMarkerPlacement, LineMarkerStyle } from '../../enum'

/**
 * 设置线的端点的Marker的样式
 *
 * @class LineStyleMarker3D
 * @moduleEX SymbolModule
 * @param {Object} options 构造参数
 * @param {Color} [options.color = null] 线端点Marker的颜色
 * @param {LineMarkerPlacement} [options.placement = LineMarkerPlacement.beginAndEnd] 线端点Marker的摆放位置
 * @param {LineMarkerStyle} [options.placement = LineMarkerStyle.arrow] 线端点Marker的样式
 *
 * @summary <h5>支持如下方法:</h5>
 * <a href='#fromJSON'>[1、通过json数据构造一个LineStyleMarker3D对象]</a><br/>
 * <a href='#toJSON'>[2、导出为json数据]</a><br/>
 * <a href='#clone'>[3、克隆并返回一个新的LineStyleMarker3D对象]</a><br/>
 * */
class LineStyleMarker3D {
  constructor(options) {
    options = defaultValue(options, {})
    /**
     * 线端点Marker的颜色
     * @member {Color} LineStyleMarker3D.prototype.color
     */
    this.color = defaultValue(options.color, undefined)
    /**
     * 线端点Marker的摆放位置
     * @member {LineMarkerPlacement} LineStyleMarker3D.prototype.placement
     */
    this.placement = defaultValue(
      options.placement,
      LineMarkerPlacement.beginAndEnd
    )
    /**
     * 线端点Marker的样式
     * @member {LineMarkerStyle} LineStyleMarker3D.prototype.style
     */
    this.style = defaultValue(options.style, LineMarkerStyle.arrow)
    /**
     * 类型
     * @member {String} LineStyleMarker3D.prototype.type
     */
    this.type = 'style'
  }

  /**
   * <a id='fromJSON'/>
   * 通过json数据构造一个LineStyleMarker3D对象
   * @param {Object} json json数据
   * @return {LineCallout3D} 新的LineStyleMarker3D对象
   * */
  static fromJSON(json) {
    return new LineStyleMarker3D(json)
  }

  /**
   * <a id='toJSON'/>
   * 导出为json数据
   * @return {Object} 导出的json数据
   * */
  toJSON() {
    return {
      color: this.color.toJSON(),
      placement: this.placement,
      type: this.type,
      style: this.style
    }
  }

  /**
   * <a id='clone'/>
   * 克隆并返回一个新的LineStyleMarker3D对象
   * @return {LineStyleMarker3D} 新的LineStyleMarker3D对象
   * */
  clone() {
    return new LineStyleMarker3D(this.toJSON())
  }
}

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