UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 1.94 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{b as e,c as t}from"./tslib.es6.js";import{a as r,c as n,G as o,f as s}from"./Geometry.js";import{O as a}from"./OperatorShapePreservingLength.js";import{c as i,P as c}from"./MultiPathImpl.js";import{E as m}from"./Point2D.js";import{v as l,w as u,x as g,y as p,z as y,P as f,A as x}from"./ProjectionTransformation.js";import{O as h}from"./OperatorDensify.js";class P{getOperatorType(){return 10311}supportsCurves(){return!0}accelerateGeometry(e,t,r){return!1}canAccelerateGeometry(e){return!1}execute(e,t,f,x){if(4===f)return(new a).execute(e,t,x);if(0===t.getCoordinateSystemType()&&r(""),n(e),e.isEmpty()||e.getDimension()<1)return 0;const P=t.getGCS(),S=l();P.querySpheroidData(S);const d=S.majorSemiAxis,j=S.e2,E=P.getUnit().getUnitToBaseFactor();let G;const v=e.getGeometryType();if(v===o.enumPolygon?G=e.getBoundary():v===o.enumEnvelope?G=i(e):s(v)?(G=new c({vd:e.getDescription()}),G.addSegment(e,!0)):G=e,G.hasNonLinearSegments()){G=(new h).execute(G,0,t.getTolerance(0),0,x)}if(P!==t){const r=t.getSRToGCSTransform();if(t.isPannable()){G=u(G,t),v===o.enumPolyline&&G===e&&(G=e.clone());const r=new m;t.getPannableExtent().queryIntervalX(r);for(let e=0,t=G.getPointCount();e<t;e++){const t=G.getXY(e);t.x=g(t.x,r),G.setXY(e,t)}}const n=G.createInstance();G=p(r,G,n,x)?n:(new y).execute(G,r,x)}return this._ExecuteMultiPathGeodeticLength(G,f,d,j,E)}_ExecuteMultiPathGeodeticLength(r,n,o,s,a){const i={stack:[],error:void 0,hasError:!1};try{const t=e(i,new f,!1);let c=0;const m=r.querySegmentIterator();for(;m.nextPath();)for(;m.hasNextSegment();){const e=m.nextSegment(),r=e.getStartXY(),i=e.getEndXY();r.scale(a),i.scale(a),x.geodeticDistance(o,s,r.x,r.y,i.x,i.y,t,null,null,n),c+=t.val}return c}catch(c){i.error=c,i.hasError=!0}finally{t(i)}}}export{P as OperatorGeodeticLength};