@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 653 B
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
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};