@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 1.75 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
*/
import{_ as r}from"../../chunks/tslib.es6.js";import e from"../../Graphic.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{reader as o}from"../../core/accessorSupport/decorators/reader.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../geometry/Polyline.js";import n from"./DirectionsEvent.js";import i from"./DirectionsString.js";function c(r){if(null==r||""===r)return null;let e=0,t=0,o=0,s=0;const p=[];let n,i,c,a,m,l,u,y,d=0,f=0,h=0;if(m=r.match(/((\+|-)[^+\-|]+|\|)/g),m||(m=[]),0===parseInt(m[d],32)){d=2;const r=parseInt(m[d],32);d++,l=parseInt(m[d],32),d++,1&r&&(f=m.indexOf("|")+1,u=parseInt(m[f],32),f++),2&r&&(h=m.indexOf("|",f)+1,y=parseInt(m[h],32),h++)}else l=parseInt(m[d],32),d++;for(;d<m.length&&"|"!==m[d];){n=parseInt(m[d],32)+e,d++,e=n,i=parseInt(m[d],32)+t,d++,t=i;const r=[n/l,i/l];f&&(a=parseInt(m[f],32)+o,f++,o=a,r.push(a/u)),h&&(c=parseInt(m[h],32)+s,h++,s=c,r.push(c/y)),p.push(r)}return{paths:[p],hasZ:f>0,hasM:h>0}}let a=class extends e{constructor(r){super(r),this.events=null,this.geometry=null,this.strings=null}readGeometry(r,e){const t=c(e.compressedGeometry);return null!=t?p.fromJSON(t):null}};r([t({type:[n]})],a.prototype,"events",void 0),r([t({type:p})],a.prototype,"geometry",void 0),r([o("geometry",["compressedGeometry"])],a.prototype,"readGeometry",null),r([t({type:[i]})],a.prototype,"strings",void 0),a=r([s("esri.rest.support.DirectionsFeature")],a);const m=a;export{m as default};