UNPKG

@arcgis/core

Version:

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

3 lines (2 loc) 567 B
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */ class t{constructor(){this._polyline=[]}beginPath(t){this._polyline.push([t])}lineTo(t){if(0===this._polyline.length)throw new Error("No path started. Call beginPath first.");this._polyline[this._polyline.length-1].push(t)}getPointCount(){return this._polyline.reduce((t,e)=>t+e.length,0)}addSegment(t,e,l){l&&this.beginPath(t),this.lineTo(e)}getXY(t){let e=0;for(const l of this._polyline){if(t<e+l.length)return l[t-e];e+=l.length}return null}getGeometry(){return this._polyline}}export{t as default};