| 
                        123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 | 
                        - /**
 -  * @Author: Caven
 -  * @Date: 2020-08-29 22:38:10
 -  */
 - 
 - import { Cesium } from '@dc-modules/namespace'
 - import State from '@dc-modules/state/State'
 - import Parse from '@dc-modules/parse/Parse'
 - import { Util, PlotUtil } from '@dc-modules/utils'
 - import { Transform } from '@dc-modules/transform'
 - import Overlay from '../Overlay'
 - 
 - const HALF_PI = Math.PI / 2
 - 
 - class FineArrow extends Overlay {
 -   constructor(positions) {
 -     super()
 -     this._positions = Parse.parsePositions(positions)
 -     this._delegate = new Cesium.Entity({ polygon: {} })
 -     this.tailWidthFactor = 0.15
 -     this.neckWidthFactor = 0.2
 -     this.headWidthFactor = 0.25
 -     this.headAngle = Math.PI / 8.5
 -     this.neckAngle = Math.PI / 13
 -     this._state = State.INITIALIZED
 -   }
 - 
 -   get type() {
 -     return Overlay.getOverlayType('fine_arrow')
 -   }
 - 
 -   set positions(positions) {
 -     this._positions = Parse.parsePositions(positions)
 -     this._delegate.polygon.hierarchy = this._getHierarchy()
 -     return this
 -   }
 - 
 -   get positions() {
 -     return this._positions
 -   }
 - 
 -   _getHierarchy() {
 -     let pnts = Parse.parsePolygonCoordToArray(this._positions)[0]
 -     let pnt1 = pnts[0]
 -     let pnt2 = pnts[1]
 -     let len = PlotUtil.getBaseLength(pnts)
 -     let tailWidth = len * this.tailWidthFactor
 -     let neckWidth = len * this.neckWidthFactor
 -     let headWidth = len * this.headWidthFactor
 -     let tailLeft = PlotUtil.getThirdPoint(pnt2, pnt1, HALF_PI, tailWidth, true)
 -     let tailRight = PlotUtil.getThirdPoint(
 -       pnt2,
 -       pnt1,
 -       HALF_PI,
 -       tailWidth,
 -       false
 -     )
 -     let headLeft = PlotUtil.getThirdPoint(
 -       pnt1,
 -       pnt2,
 -       this.headAngle,
 -       headWidth,
 -       false
 -     )
 -     let headRight = PlotUtil.getThirdPoint(
 -       pnt1,
 -       pnt2,
 -       this.headAngle,
 -       headWidth,
 -       true
 -     )
 -     let neckLeft = PlotUtil.getThirdPoint(
 -       pnt1,
 -       pnt2,
 -       this.neckAngle,
 -       neckWidth,
 -       false
 -     )
 -     let neckRight = PlotUtil.getThirdPoint(
 -       pnt1,
 -       pnt2,
 -       this.neckAngle,
 -       neckWidth,
 -       true
 -     )
 -     return new Cesium.PolygonHierarchy(
 -       Transform.transformWGS84ArrayToCartesianArray(
 -         Parse.parsePositions([
 -           tailLeft,
 -           neckLeft,
 -           headLeft,
 -           pnt2,
 -           headRight,
 -           neckRight,
 -           tailRight
 -         ])
 -       )
 -     )
 -   }
 - 
 -   _mountedHook() {
 -     /**
 -      *  set the location
 -      */
 -     this.positions = this._positions
 -   }
 - 
 -   /**
 -    *
 -    * @param text
 -    * @param textStyle
 -    * @returns {FineArrow}
 -    */
 -   setLabel(text, textStyle) {
 -     return this
 -   }
 - 
 -   /**
 -    * Sets Style
 -    * @param style
 -    * @returns {FineArrow}
 -    */
 -   setStyle(style) {
 -     if (Object.keys(style).length === 0) {
 -       return this
 -     }
 -     delete style['positions']
 -     this._style = style
 -     Util.merge(this._delegate.polygon, this._style)
 -     return this
 -   }
 - }
 - 
 - Overlay.registerType('fine_arrow')
 - 
 - export default FineArrow
 
 
  |