UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 1.34 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{GeometryCursor as t}from"../../../geometry/GeometryCursor.js";import{ringsCentroidCursor as e}from"../../../geometry/support/centroid.js";import{defaultCIMValues as i}from"../defaultCIMValues.js";class n{static{this.instance=null}static local(){return null===n.instance&&(n.instance=new n),n.instance}execute(t,e,i,n,s){return new r(t,e,i)}}class r{constructor(t,e,n){this._inputGeometries=t,this._length=(void 0!==e.length?e.length:i.CIMGeometricEffectRadial.length)*n,this._angle=void 0!==e.angle?e.angle*Math.PI/180:i.CIMGeometricEffectRadial.angle,this._lx=Math.cos(this._angle)*this._length,this._ly=Math.sin(this._angle)*this._length}next(){let i=this._inputGeometries.next();for(;i;){if("esriGeometryPoint"===i.geometryType||"esriGeometryMultipoint"===i.geometryType){const e=t.createEmptyOptimizedCIM("esriGeometryPolyline");return i.nextPath()&&i.nextPoint()&&e.pushPath([[i.x,i.y],[i.x+this._lx,i.y+this._ly]]),e}if("esriGeometryPolygon"===i.geometryType){const n=e(i);if(!n)return null;const r=t.createEmptyOptimizedCIM("esriGeometryPolyline");return r.pushPath([[n[0],n[1]],[n[0]+this._lx,n[1]+this._ly]]),r}i=this._inputGeometries.next()}return null}}export{n as EffectRadial};