You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
10 lines
3.3 KiB
10 lines
3.3 KiB
// All material copyright Esri, All Rights Reserved, unless otherwise specified. |
|
// See https://js.arcgis.com/4.30/esri/copyright.txt for details. |
|
//>>built |
|
define("exports ../../../geometry/GeometryCursor ../../../geometry/geometryCursorCollectUtils ../CIMCursor ../CurveHelper ../enums".split(" "),function(n,q,m,r,p,k){const t=k.GeometricEffectArrowType.OpenEnded;class h{static local(){null===h.instance&&(h.instance=new h);return h.instance}execute(a,b,c,d,f){return new u(a,b,c)}}h.instance=null;class u extends r.PathEffectCursor{constructor(a,b,c){super(a,!1,!0);this._curveHelper=new p.CurveHelper;this._width=(void 0!==b.width?b.width:5)*c;this._arrowType= |
|
void 0!==b.geometricEffectArrowType?b.geometricEffectArrowType:void 0!==b.arrowType?b.arrowType:t;this._offsetFlattenError=p.pixelTolerance*c}processPath(a){const b=q.GeometryCursor.createEmptyOptimizedCIM(a.geometryType);switch(this._arrowType){default:this._constructSimpleArrow(b,a,!0);break;case k.GeometricEffectArrowType.Block:this._constructSimpleArrow(b,a,!1);break;case k.GeometricEffectArrowType.Crossed:this._constructCrossedArrow(b,a)}return b}_constructSimpleArrow(a,b,c){var d=b.pathLength(), |
|
f=this._width;d<2*f&&(f=d/2);var e=this._curveHelper.getSubCurve(b,0,d-f);if(e&&e.nextPath()&&(e.seekPathStart(),d=f/2,!this._curveHelper.isEmpty(e)&&(e=m.collectPath(e),f=this._constructOffset(e,-d)))&&(e=this._constructOffset(e,d))){var g=this._constructArrowBasePoint(f,-d/2);g&&(d=this._constructArrowBasePoint(e,d/2))&&(b.seekInPath(b.pathSize-1),b=[b.x,b.y],a.pushPath(e),a.nextPath(),a.nextPoint(),a.setControlPoint(),a.pushPoint(d),a.nextPoint(),a.setControlPoint(),a.pushPoint(b),a.nextPoint(), |
|
a.setControlPoint(),a.pushPoint(g),a.nextPoint(),a.setControlPoint(),a.pushPoints(f.reverse()),a.setControlPoint(),c||(a.setControlPointAt(0),a.setControlPointAt(a.pathSize-1),a.pushPoint(e[0])),a.reset())}}_constructCrossedArrow(a,b){var c=b.pathLength(),d=this._width;c<3.732050807568877*d&&(d=c/3.732050807568877);b.seekPathStart();var f=this._curveHelper.getSubCurve(b,0,c-2.732050807568877*d);if(f){f.nextPath();var e=d/2;if(!this._curveHelper.isEmpty(f)){var g=m.collectPath(f);if(f=this._constructOffset(g, |
|
e))if(g=this._constructOffset(g,-e))if(c=this._curveHelper.getSubCurve(b,0,c-d))if(c.nextPath(),!this._curveHelper.isEmpty(c)&&(c=m.collectPath(c),d=this._constructOffset(c,e))){var l=this._constructOffset(c,-e);if(l&&(c=d[d.length-1],d=this._constructArrowBasePoint(d,e/2))){var v=l[l.length-1];if(e=this._constructArrowBasePoint(l,-e/2))b.seekInPath(b.pathSize-1),b=[b.x,b.y],a.pushPath(f),a.nextPath(),a.nextPoint(),a.setControlPoint(),a.pushPoint(v),a.nextPoint(),a.setControlPoint(),a.pushPoint(e), |
|
a.nextPoint(),a.setControlPoint(),a.pushPoint(b),a.nextPoint(),a.setControlPoint(),a.pushPoint(d),a.nextPoint(),a.setControlPoint(),a.pushPoint(c),a.nextPoint(),a.setControlPoint(),a.pushPoints(g.reverse()),a.nextPoint(),a.setControlPoint(),a.reset()}}}}}_constructOffset(a,b){return this._curveHelper.offset(a,b,k.GeometricEffectOffsetMethod.Rounded,4,this._offsetFlattenError)}_constructArrowBasePoint(a,b){if(!a||2>a.length)return null;var c=a[a.length-2];a=a[a.length-1];c=[a[0]-c[0],a[1]-c[1]];this._curveHelper.normalize(c); |
|
return[a[0]+c[1]*b,a[1]-c[0]*b]}}n.EffectArrow=h;Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})}); |