UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 1.51 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.32/esri/copyright.txt for details. */ import{GeometryCursor as e}from"../../../geometry/GeometryCursor.js";import{PathEffectCursor as t}from"../CIMCursor.js";import{CurveHelper as i}from"../CurveHelper.js";class r{static local(){return null===r.instance&&(r.instance=new r),r.instance}execute(e,t,i,r,n){return new u(e,t,i)}}r.instance=null;class u extends t{constructor(e,t,r){super(e,!0,!0),this._curveHelper=new i,this._beginCut=(void 0!==t.beginCut?t.beginCut:1)*r,this._endCut=(void 0!==t.endCut?t.endCut:1)*r,this._middleCut=(void 0!==t.middleCut?t.middleCut:0)*r,this._invert=void 0!==t.invert&&t.invert,this._beginCut<0&&(this._beginCut=0),this._endCut<0&&(this._endCut=0),this._middleCut<0&&(this._middleCut=0)}processPath(t){const{_beginCut:i,_endCut:r,_middleCut:u}=this,n=t.pathLength(),s=e.createEmptyOptimizedCIM("esriGeometryPolyline");if(this._invert){if(0!==i||0!==r||0!==u)if(i+r+u>=n)for(s.startPath();t.nextPoint();)s.pushXY(t.x,t.y);else this._curveHelper.appendSubCurve(s,t,0,i),this._curveHelper.appendSubCurve(s,t,.5*(n-u),.5*(n+u)),this._curveHelper.appendSubCurve(s,t,n-r,r)}else if(0===i&&0===r&&0===u)for(s.startPath();t.nextPoint();)s.pushXY(t.x,t.y);else i+r+u<n&&(0===u?this._curveHelper.appendSubCurve(s,t,i,n-r):(this._curveHelper.appendSubCurve(s,t,i,.5*(n-u)),this._curveHelper.appendSubCurve(s,t,.5*(n+u),n-r)));return 0===s.totalSize?null:s}}export{r as EffectCut};