@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
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
*/
import{b as e,c as t}from"./tslib.es6.js";import{t as r,d 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"./QuadraticBezier.js";import{E as m}from"./Point2D.js";import{w as u,_ as g,$ as l,v as p,E as f,F as y,G as x}from"./ProjectionTransformation.js";import{O as h}from"./OperatorDensify.js";class d{getOperatorType(){return 10311}supportsCurves(){return!0}accelerateGeometry(e,t,r){return!1}canAccelerateGeometry(e){return!1}execute(e,t,f,y){if(4===f)return(new a).execute(e,t,y);if(0===t.getCoordinateSystemType()&&r(""),n(e),e.isEmpty()||e.getDimension()<1)return 0;const d=t.getGCS(),S=x();d.querySpheroidData(S);const P=S.majorSemiAxis,E=S.e2,G=d.getUnit().getUnitToBaseFactor();let j;const v=e.getGeometryType();if(v===o.enumPolygon?j=e.getBoundary():v===o.enumEnvelope?j=i(e):s(v)?(j=new c({vd:e.getDescription()}),j.addSegment(e,!0)):j=e,j.hasNonLinearSegments()){j=(new h).execute(j,0,t.getTolerance(0),0,y)}if(d!==t){const r=t.getSRToGCSTransform();if(t.isPannable()){j=u(j,t),v===o.enumPolyline&&j===e&&(j=e.clone());const r=new m;t.getPannableExtent().queryIntervalX(r);for(let e=0,t=j.getPointCount();e<t;e++){const t=j.getXY(e);t.x=g(t.x,r),j.setXY(e,t)}}const n=j.createInstance();j=l(r,j,n,y)?n:(new p).execute(j,r,y)}return this._ExecuteMultiPathGeodeticLength(j,f,P,E,G)}_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),y.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{d as OperatorGeodeticLength};