@arcgis/core 4.34.0-next.28 → 4.34.0-next.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/applications/Components/featureUtils.d.ts +6 -0
- package/applications/Components/featureUtils.js +5 -0
- package/arcade/arcade.js +1 -1
- package/arcade/arcadeAsyncRuntime.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/arcadeRuntime.js +1 -1
- package/arcade/functions/feature.js +1 -1
- package/arcade/functions/track.js +5 -0
- package/arcade/treeAnalysis.js +1 -1
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/086f3bc5938bf9a37274.js +1 -0
- package/assets/esri/core/workers/chunks/{7e5d3735a9c718591d64.js → 22f38cad0213f2112394.js} +1 -1
- package/assets/esri/core/workers/chunks/{746c78e1c84f9612d69b.js → 2f54776ff86f397adc55.js} +1 -1
- package/assets/esri/core/workers/chunks/{edfd8b482182803b44ca.js → 2fdf457786d2d5d7414f.js} +1 -1
- package/assets/esri/core/workers/chunks/5192f38682f1f9be7da0.js +1 -0
- package/assets/esri/core/workers/chunks/{7ee50f75914d8d650af4.js → 63cb3dcd359e96733b1b.js} +1 -1
- package/assets/esri/core/workers/chunks/{e49a95f2126ef9a994d3.js → 6ccd6171d3c572883034.js} +1 -1
- package/assets/esri/core/workers/chunks/89999baefa341bd3329c.js +1 -0
- package/assets/esri/core/workers/chunks/{629a924e99d5d6eb1998.js → 90a9b618058dc41294de.js} +1 -1
- package/assets/esri/core/workers/chunks/98f6d4ea026ed96fd3f3.js +1 -0
- package/assets/esri/core/workers/chunks/d3b1d1c389d70919fb02.js +1 -0
- package/assets/esri/core/workers/chunks/db81d881805f6f92a2e4.js +1 -0
- package/assets/esri/core/workers/chunks/e89698fc404379627349.js +1 -0
- package/assets/esri/core/workers/chunks/{0254ef9fb7f8ebb25304.js → ecc15622d6c434ea842b.js} +1 -1
- package/assets/esri/core/workers/chunks/{aa781b28dbe457427afc.js → fb71e533995c54cd806f.js} +1 -1
- package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
- package/chunks/GeodeticDistanceCalculator-Ce-woMPw.js +1 -1
- package/chunks/OperatorGeodesicBuffer.js +1 -1
- package/chunks/OperatorGeodeticArea.js +1 -1
- package/chunks/OperatorGeodeticLength.js +1 -1
- package/chunks/OperatorProximityGeodesic.js +1 -1
- package/chunks/OperatorShapePreservingLength.js +1 -1
- package/chunks/OperatorShapePreservingProject.js +1 -1
- package/chunks/Terrain.glsl.js +11 -11
- package/chunks/UnitFactory.js +1 -1
- package/chunks/arcade.js +1 -1
- package/chunks/bundle.js +1 -1
- package/config.js +1 -1
- package/geometry/operators/gx/operatorGeodeticDistance.js +1 -1
- package/interfaces.d.ts +80 -2
- package/kernel.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/ParquetLayer.js +1 -1
- package/layers/graphics/sources/ParquetSource.js +1 -1
- package/layers/orientedImagery/core/ExposurePoint.js +1 -1
- package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
- package/layers/orientedImagery/transformations/rectifyMapPoint.js +1 -1
- package/layers/orientedImagery/transformations/utils.js +1 -1
- package/layers/orientedImagery/transformations/worldToImage.js +1 -1
- package/layers/support/ParquetEncodingWkb.js +1 -1
- package/layers/support/layerUtils.js +1 -1
- package/layers/support/parquetUtils.js +1 -1
- package/libs/parquet/parquet.js +1 -1
- package/package.json +2 -2
- package/support/arcadeUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
- package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/strategies/ALoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/ParquetSnapshotLoadStrategy.js +5 -0
- package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +5 -0
- package/views/2d/layers/features/sources/strategies/chunks/FeatureSourceEndChunk.js +5 -0
- package/views/2d/layers/features/sources/strategies/chunks/ParquetSourceChunk.js +5 -0
- package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
- package/views/2d/layers/features/support/XZOrder.js +5 -0
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/webgl-engine/shaders/{ReadShadowMapConfiguration.js → ReceiveShadowsConfiguration.js} +1 -1
- package/views/draw/support/ConnectedReshapeManager.js +5 -0
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/layerUtils.js +1 -1
- package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
- package/widgets/Feature/support/featureUtils.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/view/MapViewAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageViewer.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/constants.js +1 -1
- package/widgets/OrientedImageryViewer/navigation/NavigationManager.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/16ff0bf4cb74f478ec1e.js +0 -1
- package/assets/esri/core/workers/chunks/1aff43dad2302677b4f4.js +0 -1
- package/assets/esri/core/workers/chunks/c6be02d2dff6e0734dab.js +0 -1
- package/assets/esri/core/workers/chunks/c8719205518e97131375.js +0 -1
- package/views/2d/layers/features/sources/strategies/ParquetLoadStrategy.js +0 -5
|
Binary file
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__addDisposableResource as t,__disposeResources as e}from"tslib";import{d as i,a as s,G as n,g as o,v as a,h as m}from"./Geometry.js";import{S as r,a as u}from"./MultiPathImpl.js";import{a7 as h,F as c,a8 as l,a9 as _,aa as p,ab as d,O as g,g as x,ac as y,ad as P,ae as S,af as f,ag as D,ah as G,ai as v}from"./UnitFactory.js";import{d as T,a as b}from"./Envelope.js";import{Envelope2D as w}from"./Envelope2D.js";import{P as M,c as E,k as R,E as I,l as C}from"./Point2D.js";import{T as B}from"./Transformation2D.js";import{s as A,w as q,m as N}from"./Distance2DCalculator-CXhBP-8I.js";import{O as F}from"./OperatorShapePreservingDensify.js";import{O as X}from"./OperatorClip.js";function Y(){return new w}class k{[Symbol.dispose](){this.m_peR1.destroy(),this.m_peR2.destroy(),this.m_peR3.destroy(),this.m_peR1=null,this.m_peR2=null,this.m_peR3=null}constructor(t,e,i){this.m_peR1=new h,this.m_peR2=new h,this.m_peR3=new h,void 0!==t?this.reset(t,e,i):this.reset(1,0,1)}reset(t,e,i){this.m_a=t,this.m_e2=e,this.m_b=this.m_a*Math.sqrt(1-this.m_e2),this.m_unitToDegree=i,this.m_unitToRad=.017453292519943295*i,this.m_u180=180/this.m_unitToDegree,this.m_u360=360/this.m_unitToDegree}calculateBbox(t,e,i,s){const n=this.m_peR1,o=this.m_peR2,a=this.m_peR3;d.geodeticDistance(this.m_a,this.m_e2,t*this.m_unitToRad,e*this.m_unitToRad,i*this.m_unitToRad,s*this.m_unitToRad,a,n,o,0);const m=Math.cos(n.val),r=Math.cos(o.val+3.141592653589793),u=e*this.m_unitToRad,h=v.phiToEta(this.m_e2,u),c=Math.sin(n.val)*Math.cos(h);let l=e;if(m*r<0){const t=m<0?-1:1,e=Math.acos(Math.abs(c))*t;l=v.etaToPhi(this.m_e2,e)/this.m_unitToRad}let _=C((i-t)*this.m_unitToRad,2*Math.PI);Math.abs(_)>Math.PI&&(_=_>0?_-2*Math.PI:_+2*Math.PI),_/=this.m_unitToRad,i=t+_;const p=Y();return p.xmin=Math.min(t,i),p.xmax=Math.max(t,i),p.ymin=Math.min(e,s),p.ymin=Math.min(p.ymin,l),p.ymax=Math.max(e,s),p.ymax=Math.max(p.ymax,l),p}minDistanceGeodesic(t,e){const i=O(t),s=O(e);if(i&&s)return this.lowerDistanceGeodetic_(t.xmin,t.ymin,e.xmin,e.ymin);const n=this.normalizeGeodesic_(e,t);return U(t,n)?t.ymin>=n.ymax?this.minDistanceGeodesicUpDown_(t,n):n.ymin>=t.ymax?this.minDistanceGeodesicUpDown_(n,t):t.xmin>n.xmax?this.minDistanceGeodesicLeftRight_(n,t):this.minDistanceGeodesicLeftRight_(t,n):0}normalizeGeodesic_(t,e){const i=t.clone(),s=t.clone();let n=V(i,e);if(0===n)return i;for(;s.xmax>e.xmin;){s.xmin-=this.m_u360,s.xmax-=this.m_u360;const t=V(s,e);if(t<n&&(i.assign(s),n=t,0===n))return i}for(s.assign(t);s.xmin<e.xmax;){s.xmin+=this.m_u360,s.xmax+=this.m_u360;const t=V(s,e);if(t<n&&(i.assign(s),n=t,0===n))return i}return i}lowerDistanceGeodetic_(t,e,i,s){const n=this.m_peR1;{const o=this.m_b*this.m_b/this.m_a,a=v.phiToPhig(this.m_e2,this.m_unitToRad*e),m=v.phiToPhig(this.m_e2,this.m_unitToRad*s);d.geodeticDistance(o,0,this.m_unitToRad*t,a,this.m_unitToRad*i,m,n,null,null,0)}return n.val}minDistanceGeodesicUpDown_(t,e){if(e.xmin<=t.xmin?e.xmax>=t.xmin:t.xmax>=e.xmin)return this.lowerDistanceGeodetic_(0,t.ymin,0,e.ymax);if(e.xmin>t.xmax){const i=this.lowerDistanceGeodeticSegMeridional_(t.xmax,t.ymin,t.ymax,e.xmin,e.ymin,e.ymax);if(e.xmax-t.xmin<this.m_u180)return i;const s=this.lowerDistanceGeodeticSegMeridional_(t.xmin,t.ymin,t.ymax,e.xmax,e.ymin,e.ymax);return Math.min(i,s)}{const i=this.lowerDistanceGeodeticSegMeridional_(t.xmin,t.ymin,t.ymax,e.xmax,e.ymin,e.ymax);if(t.xmax-e.xmin<this.m_u180)return i;const s=this.lowerDistanceGeodeticSegMeridional_(t.xmax,t.ymin,t.ymax,e.xmin,e.ymin,e.ymax);return Math.min(i,s)}}minDistanceGeodesicLeftRight_(t,e){let i=Math.abs(t.xmax-e.xmin);for(;i>this.m_u180;)i-=this.m_u360;let s=Math.abs(t.xmin-e.xmax);for(;s>this.m_u180;)s-=this.m_u360;return Math.abs(i)<=Math.abs(s)?this.minDistanceGeodesicLeftRightNormalized_(t,e):this.minDistanceGeodesicLeftRightNormalized_(e,t)}minDistanceGeodesicLeftRightNormalized_(t,e){let i,s;return i=this.lowerDistanceGeodetic_(t.xmax,t.ymin,e.xmin,e.ymin),t.ymin>=e.ymin&&t.ymin<=e.ymax&&(s=this.lowerDistanceGeodeticPtMeridional_(t.xmax,t.ymin,e.xmin,e.ymin,e.ymax),i=Math.min(i,s)),e.ymin>=t.ymin&&e.ymin<=t.ymax&&(s=this.lowerDistanceGeodeticPtMeridional_(e.xmin,e.ymin,t.xmax,t.ymin,t.ymax),i=Math.min(i,s)),s=this.lowerDistanceGeodetic_(t.xmax,t.ymax,e.xmin,e.ymax),i=Math.min(i,s),t.ymax>=e.ymin&&t.ymax<=e.ymax&&(s=this.lowerDistanceGeodeticPtMeridional_(t.xmax,t.ymax,e.xmin,e.ymin,e.ymax),i=Math.min(i,s)),e.ymax>=t.ymin&&e.ymax<=t.ymax&&(s=this.lowerDistanceGeodeticPtMeridional_(e.xmin,e.ymax,t.xmax,t.ymin,t.ymax),i=Math.min(i,s)),i}lowerDistanceGeodeticSegMeridional_(t,e,i,s,n,o){let a=this.lowerDistanceGeodeticPtMeridional_(t,e,s,n,o);const m=this.lowerDistanceGeodeticPtMeridional_(t,i,s,n,o);let r=this.lowerDistanceGeodeticPtMeridional_(s,n,t,e,i);const u=this.lowerDistanceGeodeticPtMeridional_(s,o,t,e,i);return a=Math.min(a,m),r=Math.min(r,u),Math.min(a,r)}lowerDistanceGeodeticPtMeridional_(t,e,i,s,n){const o=this.m_b*this.m_b/this.m_a,a=v.phiToPhig(this.m_e2,this.m_unitToRad*e),m=v.phiToPhig(this.m_e2,this.m_unitToRad*s),r=v.phiToPhig(this.m_e2,this.m_unitToRad*n),u=this.m_peR1,h=this.m_peR2;d.geodeticDistance(o,0,this.m_unitToRad*i,m,this.m_unitToRad*t,a,u,null,null,0),d.geodeticDistance(o,0,this.m_unitToRad*i,r,this.m_unitToRad*t,a,h,null,null,0);const c=l(1,0,new M(this.m_unitToRad*t,a)),_=l(1,0,new M(this.m_unitToRad*i,m)),g=l(1,0,new M(this.m_unitToRad*i,r));let x=new T;x.setCrossProductVector(_,g);const y=_.dotProduct(g);if(x.length()<1.568e-10)return y>=0?Math.min(u.val,h.val):0;x=x.getUnitVector();let P=new T;if(P.setCrossProductVector(x,c),P.length()<1.568e-10){return Math.min(u.val,h.val)-1e-5*o}P=P.getUnitVector();let S=c.sub(x.mul(c.dotProduct(x)));{const e=new T;e.setCrossProductVector(_,S);const i=new T;i.setCrossProductVector(S,g);let s=x.dotProduct(e)>0&&x.dotProduct(i)>0;if(s||(S.negateThis(),e.setCrossProductVector(_,S),i.setCrossProductVector(S,g),s=x.dotProduct(e)>0&&x.dotProduct(i)>0),s){S=S.getUnitVector();const e=p(1,0,S),i=this.m_peR3;d.geodeticDistance(o,0,this.m_unitToRad*t,a,e.x,e.y,i,null,null,0);const s=Math.min(u.val,h.val);return Math.min(s,i.val)}}return Math.min(u.val,h.val)}}function O(t){return t.xmin===t.xmax&&t.ymin===t.ymax}function U(t,e){return e.xmax<t.xmin||e.xmin>t.xmax||e.ymax<t.ymin||e.ymin>t.ymax}function V(t,e){let i,s=0;return i=t.xmin-e.xmax,i>s&&(s=i),i=e.xmin-t.xmax,i>s&&(s=i),s}class L{}function j(t){return{outPoint:void 0===t?new M:t.clone()}}function z(t,e){t.outPoint.assign(e.outPoint)}function H(){return new w}class J{constructor(t,e,i,s,n=0,o=4){this.m_ptDistFrom=new M,this.m_segStartPt=new M,this.m_segEndPt=new M,this.m_geodeticLength=new h,this.m_az12=new h,this.m_minGeodeticDist=new h,this.m_segStartPt3d=new T,this.m_segEndPt3d=new T,this.m_sr=s,this.m_distCurveType=n,this.m_segCurveType=o,this.m_inputGCS=this.m_sr.getGCS(),this.m_rpu=this.m_inputGCS.getUnit().getUnitToBaseFactor(),this.m_bIsPannablePcs=2===this.m_sr.getCoordinateSystemType()&&this.m_sr.isPannable();const a=c();this.m_inputGCS.querySpheroidData(a),this.m_a=a.majorSemiAxis,this.m_eSquared=a.e2,this.setPointDistFrom(t),this.setSegmentEndPoints(e,i)}setSegmentEndPoints(t,e){this.m_segStartPt.assign(t),this.m_segEndPt.assign(e),this.m_bIsPannablePcs||(this.m_segStartPt.mulThis(this.m_rpu),this.m_segEndPt.mulThis(this.m_rpu)),2===this.m_segCurveType&&(this.m_segStartPt3d.assign(l(this.m_a,this.m_eSquared,this.m_segStartPt)),this.m_segEndPt3d.assign(l(this.m_a,this.m_eSquared,this.m_segEndPt))),this.calculateAndUpdateSegmentLength()}setPointDistFrom(t){this.m_ptDistFrom.assign(t),this.m_ptDistFrom.scale(this.m_rpu)}setSegmentCurveType(t){this.m_segCurveType=t}setDistanceCurveType(t){this.m_distCurveType=t}makeFunctor(){return s=>{let n;switch(this.m_segCurveType){case 0:case 1:case 3:{const i={stack:[],error:void 0,hasError:!1};try{const e=t(i,new h,!1),o=t(i,new h,!1);d.geodeticCoordinate(this.m_a,this.m_eSquared,this.m_segStartPt.x,this.m_segStartPt.y,this.m_geodeticLength.val*s,this.m_az12.val,e,o,this.m_segCurveType),n=new M(e.val,o.val);break}catch(o){i.error=o,i.hasError=!0}finally{e(i)}}case 2:{const t=T.lerp(this.m_segStartPt3d,this.m_segEndPt3d,s);n=p(this.m_a,this.m_eSquared,t);break}case 4:n=M.lerp(this.m_segStartPt,this.m_segEndPt,s),this.m_bIsPannablePcs&&(_(this.m_sr,0,[n],1),n.mulThis(this.m_rpu));break;default:i("Invalid curve type")}return d.geodeticDistance(this.m_a,this.m_eSquared,this.m_ptDistFrom.x,this.m_ptDistFrom.y,n.x,n.y,this.m_minGeodeticDist,null,null,this.m_distCurveType),this.m_minGeodeticDist.val}}calculateAndUpdateSegmentLength(){switch(this.m_segCurveType){case 0:case 2:case 1:case 3:d.geodeticDistance(this.m_a,this.m_eSquared,this.m_segStartPt.x,this.m_segStartPt.y,this.m_segEndPt.x,this.m_segEndPt.y,this.m_geodeticLength,this.m_az12,null,this.m_segCurveType);break;case 4:this.m_geodeticLength.val=M.distance(this.m_segStartPt,this.m_segEndPt);break;default:i("Invalid curve type")}}[Symbol.dispose](){this.m_geodeticLength[Symbol.dispose](),this.m_az12[Symbol.dispose](),this.m_minGeodeticDist[Symbol.dispose]()}}function K(){return new L}class Q{[Symbol.dispose](){this.m_envHelper[Symbol.dispose]()}constructor(t,e,i,s,n){this.m_boxGeomA=H(),this.m_boxGeomB=H(),this.m_envGeomA=new w,this.m_envGeomB=new w,this.m_progressCounter=0,this.m_transformPCS2GCS=null,this.m_segmentBoxesA=new Map,this.m_segmentBoxesB=new Map,this.m_boundaryPtsA=[],this.m_boundaryPtsB=[],this.m_scaleToRadians=new B,this.m_scaleToDegrees=new B,this.m_inputSR=t,this.m_distCurveType=e,this.m_progressTracker=i,this.m_maxDistance=s,this.m_maxDeviation=n,this.m_inputGCS=t.getGCS(),this.m_peGeogcs=this.m_inputGCS.getPECoordSys(),this.m_tolerance=0;const o=c();this.m_inputGCS.querySpheroidData(o),this.m_a=o.majorSemiAxis,this.m_eSquared=o.e2,this.m_rpu=this.m_inputGCS.getUnit().getUnitToBaseFactor(),this.m_envHelper=new k(this.m_a,this.m_eSquared,1),4===this.m_distCurveType&&(this.m_distCurveType=0),this.m_boxGeomA.setEmpty(),this.m_boxGeomB.setEmpty(),this.m_envGeomA.setEmpty(),this.m_envGeomB.setEmpty(),this.m_bIsPannablePcs=2===this.m_inputSR.getCoordinateSystemType()&&this.m_inputSR.isPannable()}progress(t=!1){}calculate(t,e,i,s){const n=j(),o=j();if(t.queryEnvelope(this.m_envGeomA),e.queryEnvelope(this.m_envGeomB),this.checkGeometriesIntersect(t,e,n,o))return i&&z(i,n),s&&z(s,o),0;const a=this.prepareGeometry(t);if(a.isEmpty())return Number.NaN;const m=this.prepareGeometry(e);if(m.isEmpty())return Number.NaN;this.m_tolerance=this.computeTolerance(a,m);const r=this._ExecuteBruteForce(a,m,n,o);return r>=this.m_maxDistance?Number.NaN:(i&&(this.prepareOutput(n),z(i,n)),s&&(this.prepareOutput(o),z(s,o)),r)}createDistanceFunctor(t,e,i){const s=new J(t,e,i,this.m_inputSR,this.m_distCurveType);return this.m_bIsPannablePcs||1===this.m_inputSR.getCoordinateSystemType()||s.setSegmentCurveType(2),s}_NormalizeAndProject(t){if(this.m_inputSR.isPannable()&&(t=(new g).foldInto360Range(t,this.m_inputSR)),2===this.m_inputSR.getCoordinateSystemType()){const e=x(this.m_inputSR,this.m_inputGCS,null);t=(new g).execute(t,e,this.m_progressTracker)}return t}_ExecuteBruteForce(t,e,i,o){switch(t.getGeometryType()){case n.enumPoint:return this.calculateDistanceGeodeticPointGeometry(t,e,i,o);case n.enumMultiPoint:return this.calculateDistanceGeodeticMultipointGeometry(t,e,i,o);case n.enumPolyline:case n.enumPolygon:case n.enumEnvelope:return this.calculateDistanceGeodeticMultipathGeometry(t,e,i,o);default:s("")}}calculateDistanceGeodeticPointGeometry(t,e,i,o){switch(e.getGeometryType()){case n.enumPoint:return this.calculateDistanceGeodeticPointPoint(t,e,i,o);case n.enumMultiPoint:return this.calculateDistanceGeodeticPointMultipoint(t,e,i,o);case n.enumPolyline:case n.enumPolygon:return this.calculateDistanceGeodeticPointMultipath(t,e,i,o);default:s("")}}calculateDistanceGeodeticPointPoint(i,s,n,o){const a={stack:[],error:void 0,hasError:!1};try{const e=i.getXY();e.scale(this.m_rpu);const m=s.getXY();m.scale(this.m_rpu),n.outPoint.assign(e),o.outPoint.assign(m);const r=t(a,new h,!1);return d.geodeticDistance(this.m_a,this.m_eSquared,e.x,e.y,m.x,m.y,r,null,null,this.m_distCurveType),r.val}catch(m){a.error=m,a.hasError=!0}finally{e(a)}}calculateDistanceGeodeticPointMultipoint(i,s,n,o){const a={stack:[],error:void 0,hasError:!1};try{this.computeEnvelopesAndBoxes(i,s);const e=this.estimateMinimumDistance(n,o);let m=e<this.m_maxDistance?e:this.m_maxDistance;const r=i.getXY();r.scale(this.m_rpu),n.outPoint.assign(r);const u=l(this.m_a,this.m_eSquared,r),c=new M,_=s.getImpl(),p=t(a,new h,!1),g=_.getPointCount();for(let t=0;t<g;++t){_.queryXY(t,c),c.scale(this.m_rpu);const e=l(this.m_a,this.m_eSquared,c);if(!(T.distance(u,e)>m)&&(!(this.m_envHelper.minDistanceGeodesic(this.m_boxGeomA,this.m_boxGeomB)>m)&&(d.geodeticDistance(this.m_a,this.m_eSquared,r.x,r.y,c.x,c.y,p,null,null,this.m_distCurveType),p.val<m&&(m=p.val,o.outPoint=c,0===m))))return m}return m===this.m_maxDistance?Number.POSITIVE_INFINITY:m}catch(m){a.error=m,a.hasError=!0}finally{e(a)}}calculateDistanceGeodeticPointMultipath(i,s,n,a){const m={stack:[],error:void 0,hasError:!1};try{const e=new M,r=new M;e.assign(i.getXY()),r.assign(i.getXY()),n.outPoint.assign(r.mul(this.m_rpu)),this.m_bIsPannablePcs&&y(this.m_inputSR,[e],1,!1),this.computeEnvelopesAndBoxes(i,s);const u=this.estimateMinimumDistance(n,a);let h=u<this.m_maxDistance?u:this.m_maxDistance;const c=s.getImpl(),l=new M(0,0),_=new M(0,0),p=[1],d=this.canUseSpatialTree(i,s),g=K();d&&this.buildSpatialTree(g,s);const x=H();x.setCoords({xmin:r.x,ymin:r.y,xmax:r.x,ymax:r.y});const P=t(m,this.createDistanceFunctor(r,l,_),!1),S=c.querySegmentIterator();if(S.stripAttributes(),d)o(0);else for(;S.nextPath();)for(;S.hasNextSegment();){const t=S.nextSegment(),i=this.findOrComputeBoxSegment(S.getStartPointIndex(),t,this.m_segmentBoxesB);if(this.m_envHelper.minDistanceGeodesic(x,i)>h)continue;const s=this.calculateDistanceGeodeticPointSegment(e,r,t,p,P);if(s.second<h&&(this.updateOutputSegment(a,t,s.first),h=s.second,0===h))return 0}return h===this.m_maxDistance?Number.POSITIVE_INFINITY:h}catch(r){m.error=r,m.hasError=!0}finally{e(m)}}calculateDistanceGeodeticMultipointGeometry(t,e,i,o){switch(e.getGeometryType()){case n.enumPoint:return this.calculateDistanceGeodeticPointMultipoint(e,t,o,i);case n.enumMultiPoint:return this.calculateDistanceGeodeticMultipointMultipoint(t,e,i,o);case n.enumPolyline:case n.enumPolygon:case n.enumEnvelope:return this.calculateDistanceGeodeticMultipointMultipath(t,e,i,o);default:s("")}}calculateDistanceGeodeticMultipointMultipoint(i,s,n,o){const a={stack:[],error:void 0,hasError:!1};try{const e=t(a,new h,!1);this.computeEnvelopesAndBoxes(i,s);const m=this.estimateMinimumDistance(n,o);let r=m<this.m_maxDistance?m:this.m_maxDistance;const u=new M,c=new M,_=i.getImpl(),p=s.getImpl(),g=H(),x=_.getPointCount(),y=p.getPointCount();for(let t=0;t<x;++t){if(u.assign(_.getXY(t)),g.setCoords({xmin:u.x,ymin:u.y,xmax:u.x,ymax:u.y}),this.m_envHelper.minDistanceGeodesic(g,this.m_boxGeomB)>r)continue;u.scale(this.m_rpu);const i=l(this.m_a,this.m_eSquared,u);for(let t=0;t<y;++t){c.assign(p.getXY(t)),c.scale(this.m_rpu);const s=l(this.m_a,this.m_eSquared,c);if(!(T.distance(i,s)>=r)&&(d.geodeticDistance(this.m_a,this.m_eSquared,u.x,u.y,c.x,c.y,e,null,null,this.m_distCurveType),e.val<r&&(n.outPoint.assign(u),o.outPoint.assign(c),r=e.val,0===r)))return r}}return r===this.m_maxDistance?Number.POSITIVE_INFINITY:r}catch(m){a.error=m,a.hasError=!0}finally{e(a)}}calculateDistanceGeodeticMultipointMultipath(i,s,n,a){const m={stack:[],error:void 0,hasError:!1};try{const e=s.getImpl().querySegmentIterator();e.stripAttributes(),this.computeEnvelopesAndBoxes(i,s);const r=this.estimateMinimumDistance(n,a);let u=r<this.m_maxDistance?r:this.m_maxDistance;const h=new M,c=new M(0,0),l=new M(0,0),_=new M(0,0),p=[0],d=H(),g=t(m,this.createDistanceFunctor(c,l,_),!1),x=K(),P=this.canUseSpatialTree(i,s);P&&this.buildSpatialTree(x,s);const S=i.getPointCount();for(let t=0;t<S;++t)if(h.assign(i.getXY(t)),c.assign(i.getXY(t)),this.m_bIsPannablePcs&&y(this.m_inputSR,[h],1,!1),d.setCoords({xmin:c.x,ymin:c.y,xmax:c.x,ymax:c.y}),!(this.m_envHelper.minDistanceGeodesic(d,this.m_boxGeomB)>u))if(g.setPointDistFrom(c),P)o(0);else{for(;e.nextPath();)for(;e.hasNextSegment();){const t=e.nextSegment();if(this.m_envHelper.minDistanceGeodesic(d,this.findOrComputeBoxSegment(e.getStartPointIndex(),t,this.m_segmentBoxesB))>u)continue;const i=this.calculateDistanceGeodeticPointSegment(h,c,t,p,g);if(i.second<u&&(n.outPoint.assign(c.mul(this.m_rpu)),this.updateOutputSegment(a,t,i.first),u=i.second,0===u))return 0}e.resetToFirstPath()}return u===this.m_maxDistance?Number.POSITIVE_INFINITY:u}catch(r){m.error=r,m.hasError=!0}finally{e(m)}}calculateDistanceGeodeticMultipathGeometry(t,e,i,o){switch(e.getGeometryType()){case n.enumPoint:return this.calculateDistanceGeodeticPointMultipath(e,t,o,i);case n.enumMultiPoint:return this.calculateDistanceGeodeticMultipointMultipath(e,t,o,i);case n.enumPolyline:case n.enumPolygon:case n.enumEnvelope:return this.calculateDistanceGeodeticMultipathMultipath(t,e,i,o);default:s("")}}calculateDistanceGeodeticMultipathMultipath(t,e,i,s){const n=[t],o=[e],a=this.swapGeometries(n,o),m=n[0],r=o[0];this.computeEnvelopesAndBoxes(n[0],o[0]);const u=this.estimateMinimumDistance(i,s),h=this.calculateDistanceGeodeticMultipathMultipath_(m,r,i,s,u);return a&&(s.outPoint=E(i.outPoint,i.outPoint=s.outPoint)),h}calculateDistanceGeodeticMultipathMultipath_(i,s,n,a,m=Number.MAX_VALUE){const u={stack:[],error:void 0,hasError:!1};try{let e=m;const h=new M(0,0),c=new M,l=new M(0,0),p=new M,d=new M(0,0),g=new M,x=new M,y=new M,S=[new M],f=[0],D=[0],G=H(),v=H(),T=t(u,this.createDistanceFunctor(d,h,l),!1),b=K(),w=this.canUseSpatialTree(i,s);w&&this.buildSpatialTree(b,s);const E=s.querySegmentIterator();E.stripAttributes();const R=new r,I=A(i);for(let t=0;t<I.length;++t){const s=I[t];i.getSegmentBuffer(s,R,!0);const m=R.get();if(G.assign(this.findOrComputeBoxSegment(s,m,this.m_segmentBoxesA)),w)o(0);else{if(d.assign(m.getStartXY()),g.assign(m.getStartXY()),x.assign(m.getEndXY()),y.assign(m.getEndXY()),this.m_bIsPannablePcs&&(_(this.m_inputSR,0,[g],1),_(this.m_inputSR,0,[y],1)),this.m_envHelper.minDistanceGeodesic(G,this.m_boxGeomB)>e)continue;for(;E.nextPath();){for(;E.hasNextSegment();){const t=E.nextSegment();if(h.assign(t.getStartXY()),c.assign(t.getStartXY()),l.assign(t.getEndXY()),p.assign(t.getEndXY()),m.intersect(t,S,f,D,this.m_tolerance))return this.updateOutputSegment(n,m,f[0]),this.updateOutputSegment(a,t,D[0]),0;if(this.m_bIsPannablePcs&&(_(this.m_inputSR,0,[c],1),_(this.m_inputSR,0,[p],1)),v.assign(this.findOrComputeBoxPoint(E.getStartPointIndex(),c,p,this.m_segmentBoxesB)),this.m_envHelper.minDistanceGeodesic(G,v)>e)continue;T.setSegmentEndPoints(h,l),T.setPointDistFrom(g);let i=P(T.makeFunctor(),0,1,1e-10);if(i.second<e&&(n.outPoint.assign(g.mul(this.m_rpu)),this.updateOutputSegment(a,t,i.first),e=i.second,0===e))break;if(T.setPointDistFrom(y),i=P(T.makeFunctor(),0,1,1e-10),i.second<e&&(n.outPoint.assign(y.mul(this.m_rpu)),this.updateOutputSegment(a,t,i.first),e=i.second,0===e))break;if(T.setSegmentEndPoints(d,x),T.setPointDistFrom(c),i=P(T.makeFunctor(),0,1,1e-10),i.second<e&&(this.updateOutputSegment(n,m,i.first),a.outPoint.assign(c.mul(this.m_rpu)),e=i.second,0===e))break;if(T.setPointDistFrom(p),i=P(T.makeFunctor(),0,1,1e-10),i.second<e&&(this.updateOutputSegment(n,m,i.first),a.outPoint.assign(p.mul(this.m_rpu)),e=i.second,0===e))break}if(0===e)return 0}E.resetToFirstPath()}}return e===this.m_maxDistance?Number.POSITIVE_INFINITY:e}catch(h){u.error=h,u.hasError=!0}finally{e(u)}}calculateDistanceGeodeticPointSegment(t,e,i,s,n){const o=i.getStartXY(),a=i.getEndXY();return i.intersectPoint(t,s,this.m_tolerance)?R(s[0],0):(n.setPointDistFrom(e),n.setSegmentEndPoints(o,a),P(n.makeFunctor(),0,1,1e-10))}prepareGeometry(t){let e=t.clone();const i=t.getGeometryType();if(i===n.enumPoint||i===n.enumMultiPoint)return this._NormalizeAndProject(e);if(i===n.enumEnvelope&&(e=this.envelopeToPolygon(e)),this.m_inputSR.isPannable())return this.prepareGeometryPannable(e,4);if(2===this.m_inputSR.getCoordinateSystemType()){if(e=S(e,this.m_inputSR,0,null),e.isEmpty())return e;e=(new F).execute(e,this.m_inputSR,5e4,this.m_maxDeviation/2,0,null);const t=this.m_inputSR.getSRToGCSTransform();return(new g).execute(e,t,this.m_progressTracker)}const s=new w;e.queryLooseEnvelope(s);const o=this.m_inputSR.getPannableExtent();if(s.ymin<o.ymin||s.ymax>o.ymax){const t=new w(s.xmin-1,o.ymin,s.xmax+1,o.ymax);if(e=(new X).execute(e,t,this.m_inputSR,this.m_progressTracker),e.isEmpty())return e}return s.width()>2*o.width()?(e=f(e,-2*o.width(),2*o.width(),this.m_inputSR,!0,0,!0,this.m_progressTracker),e):e}prepareGeometryPannable(t,e){const i=new w;t.queryEnvelope(i);const s=this.m_inputSR.getPannableExtent();if(s.containsEnvelope(i))return t;const n=new I;s.queryIntervalX(n);const o=new I;return i.queryIntervalX(o),t=n.contains(o)?D(t,this.m_inputSR):(new g).foldInto360RangeGeodetic(t,this.m_inputSR,e)}prepareOutput(t){t.outPoint.scale(1/this.m_rpu),2===this.m_inputSR.getCoordinateSystemType()&&y(this.m_inputSR,[t.outPoint],1,!1)}updateOutputSegment(t,e,i){e.queryCoord2D(i,t.outPoint),this.m_bIsPannablePcs&&_(this.m_inputSR,0,[t.outPoint],1),t.outPoint.mulThis(this.m_rpu)}computeTolerance(t,e){t.queryEnvelope(this.m_envGeomA),e.queryEnvelope(this.m_envGeomB);const i=new w(this.m_envGeomA);return i.mergeEnvelope2D(this.m_envGeomB),b(null,i)}envelopeToPolygon(t){const e=new u;return e.addEnvelope(t,!1),e}computeEnvelopesAndBoxes(t,e){t.queryEnvelope(this.m_envGeomA),e.queryEnvelope(this.m_envGeomB),this.m_boxGeomA=this.computeBoxGeometry(t,this.m_boundaryPtsA,this.m_segmentBoxesA),this.m_boxGeomB=this.computeBoxGeometry(e,this.m_boundaryPtsB,this.m_segmentBoxesB)}computeBoxGeometry(t,e,s){switch(t.getGeometryType()){case n.enumPoint:return this.computeBoxPoint(t,e);case n.enumMultiPoint:return this.computeBoxMultiPoint(t,e);case n.enumPolyline:case n.enumPolygon:return this.computeBoxMultiPath(t,e,s);default:i("Invalid geometry type")}}computeBoxPoint(t,e){const i=t.getXY();e.length=0,e.push(i.mul(this.m_rpu));const s=H();return s.setCoords({xmin:i.x,ymin:i.y,xmax:i.x,ymax:i.y}),s}computeBoxMultiPoint(t,e){let i=!0;for(let n=0;n<t.getPointCount();++n){const s=t.getXY(n);if(i){e.length=0;for(let t=0;t<4;++t)e.push(s.clone());i=!1}s.x<e[0].x&&e[0].assign(s),s.y>e[1].y&&e[1].assign(s),s.x>e[2].x&&e[2].assign(s),s.y<e[3].y&&e[3].assign(s)}for(let n=0;n<e.length;++n)e[n].mulThis(this.m_rpu);const s=H();return t.queryEnvelope(s),s}computeBoxMultiPath(t,e,i){let s=!0;const n=H();n.setEmpty();const o=t.querySegmentIterator();for(o.stripAttributes();o.nextPath();)for(;o.hasNextSegment();){const t=o.nextSegment(),a=t.getStartXY(),m=t.getEndXY();if(this.m_bIsPannablePcs&&(_(this.m_inputSR,0,[a],1),_(this.m_inputSR,0,[m],1)),s){for(let t=0;t<4;++t)e.push(a.clone());s=!1}a.x<e[0].x&&e[0].assign(a),a.y>e[1].y&&e[1].assign(a),a.x>e[2].x&&e[2].assign(a),a.y<e[3].y&&e[3].assign(a),m.x<e[0].x&&e[0].assign(m),m.y>e[1].y&&e[1].assign(m),m.x>e[2].x&&e[2].assign(m),m.y<e[3].y&&e[3].assign(m);const r=this.findOrComputeBoxPoint(o.getStartPointIndex(),a,m,i);n.mergeEnvelope2D(r)}for(let a=0;a<e.length;++a)e[a].mulThis(this.m_rpu);return n}findOrComputeBoxSegment(t,e,i){if(!i.has(t)){let s=H();if(e.queryEnvelope(s),this.m_bIsPannablePcs){const t=M.construct(s.xmin,s.ymin),e=M.construct(s.xmax,s.ymax);_(this.m_inputSR,0,[t],1),_(this.m_inputSR,0,[e],1),s=this.m_envHelper.calculateBbox(t.x,t.y,e.x,e.y)}return i.set(t,s),s}return i.get(t)}findOrComputeBoxPoint(t,e,i,s){if(!s.has(t)){let n=H();return n.setCoords({xmin:e.x,ymin:e.y,xmax:i.x,ymax:i.y}),this.m_bIsPannablePcs&&(n=this.m_envHelper.calculateBbox(n.xmin,n.ymin,n.xmax,n.ymax)),s.set(t,n),n}return s.get(t)}estimateMinimumDistance(i,s){const n={stack:[],error:void 0,hasError:!1};try{const e=t=>l(this.m_a,this.m_eSquared,t),o=this.m_boundaryPtsA.map(e),a=this.m_boundaryPtsB.map(e);let m=Number.MAX_VALUE,r=0,u=0;for(let t=0;t<o.length;++t)for(let e=0;e<a.length;++e){const i=T.distance(o[t],a[e]);i<m&&(m=i,r=t,u=e)}i.outPoint.assign(this.m_boundaryPtsA[r]),s.outPoint.assign(this.m_boundaryPtsB[u]);const c=t(n,new h,!1);return d.geodeticDistance(this.m_a,this.m_eSquared,this.m_boundaryPtsA[r].x,this.m_boundaryPtsA[r].y,this.m_boundaryPtsB[u].x,this.m_boundaryPtsB[u].y,c,null,null,this.m_distCurveType),c.val}catch(o){n.error=o,n.hasError=!0}finally{e(n)}}swapGeometries(t,e){return a(t[0])>a(e[0])&&(e[0]=E(t[0],t[0]=e[0]),this.m_envGeomB=E(this.m_envGeomA,this.m_envGeomA=this.m_envGeomB),!0)}canUseSpatialTree(t,e){return!1}checkGeometriesIntersect(t,e,i,s){let o=t.getGeometryType(),a=e.getGeometryType();if(this.m_envGeomA.isIntersecting(this.m_envGeomB)){if(o===n.enumPoint&&2===e.getDimension()){const n=[0],o=[t.getXY()];if(G(e,o,1,this.m_tolerance,n),0!==n[0])return i.outPoint.assign(o[0]),s.outPoint.assign(o[0]),!0}else if(a===n.enumPoint&&2===t.getDimension()){const n=[2],o=[e.getXY()];if(G(t,o,1,this.m_tolerance,n),0!==n[0])return i.outPoint.assign(o[0]),s.outPoint.assign(o[0]),!0}if(o===n.enumMultiPoint&&2===e.getDimension())return this.multipointIntersectsArea(t,e,i,s);if(a===n.enumMultiPoint&&2===t.getDimension())return this.multipointIntersectsArea(e,t,s,i);let r,u,h=t,c=e;if(o===n.enumEnvelope&&(r=this.envelopeToPolygon(t),h=r,o=n.enumPolygon),a===n.enumEnvelope&&(u=this.envelopeToPolygon(e),c=u,a=n.enumPolygon),m(o)&&m(a)){const t=h.querySegmentIterator(),e=c.querySegmentIterator(),n=N(),o=N();if(q(h,c,t,e,n,o))return i.outPoint.assign(n.outPoint),s.outPoint.assign(n.outPoint),!0}}return!1}multipointIntersectsArea(t,e,i,s){const n=t.getPointCount();for(let o=0;o<n;++o){const n=[2],a=t.getXY(o);if(G(e,[a],1,this.m_tolerance,n),0!==n[0])return i.outPoint.assign(a),s.outPoint.assign(a),!0}return!1}getNearestNeighbourVisitor(t,e,i,s,n,a,m){return o(0),{}}buildSpatialTree(t,e){o(0)}}export{Q as G,J as a,j as m};
|
|
5
|
+
import{__addDisposableResource as t,__disposeResources as e}from"tslib";import{a as i,G as s,g as n,d as o,v as a,h as m}from"./Geometry.js";import{S as r,a as u}from"./MultiPathImpl.js";import{F as h,O as c,g as l,a7 as _,a8 as p,a9 as d,aa as g,ab as x,ac as y,ad as P,ae as S,af as f,ag as D,ah as G,ai as v}from"./UnitFactory.js";import{d as T,a as b}from"./Envelope.js";import{Envelope2D as w}from"./Envelope2D.js";import{P as M,c as E,k as R,E as I,l as C}from"./Point2D.js";import{T as B}from"./Transformation2D.js";import{s as A,w as q,m as N}from"./Distance2DCalculator-CXhBP-8I.js";import{O as F}from"./OperatorShapePreservingDensify.js";import{O as X}from"./OperatorClip.js";function Y(){return new w}class k{[Symbol.dispose](){this.m_peR1.destroy(),this.m_peR2.destroy(),this.m_peR3.destroy(),this.m_peR1=null,this.m_peR2=null,this.m_peR3=null}constructor(t,e,i){this.m_peR1=new _,this.m_peR2=new _,this.m_peR3=new _,void 0!==t?this.reset(t,e,i):this.reset(1,0,1)}reset(t,e,i){this.m_a=t,this.m_e2=e,this.m_b=this.m_a*Math.sqrt(1-this.m_e2),this.m_unitToDegree=i,this.m_unitToRad=.017453292519943295*i,this.m_u180=180/this.m_unitToDegree,this.m_u360=360/this.m_unitToDegree}calculateBbox(t,e,i,s){const n=this.m_peR1,o=this.m_peR2,a=this.m_peR3;p.geodeticDistance(this.m_a,this.m_e2,t*this.m_unitToRad,e*this.m_unitToRad,i*this.m_unitToRad,s*this.m_unitToRad,a,n,o,0);const m=Math.cos(n.val),r=Math.cos(o.val+3.141592653589793),u=e*this.m_unitToRad,h=v.phiToEta(this.m_e2,u),c=Math.sin(n.val)*Math.cos(h);let l=e;if(m*r<0){const t=m<0?-1:1,e=Math.acos(Math.abs(c))*t;l=v.etaToPhi(this.m_e2,e)/this.m_unitToRad}let _=C((i-t)*this.m_unitToRad,2*Math.PI);Math.abs(_)>Math.PI&&(_=_>0?_-2*Math.PI:_+2*Math.PI),_/=this.m_unitToRad,i=t+_;const d=Y();return d.xmin=Math.min(t,i),d.xmax=Math.max(t,i),d.ymin=Math.min(e,s),d.ymin=Math.min(d.ymin,l),d.ymax=Math.max(e,s),d.ymax=Math.max(d.ymax,l),d}minDistanceGeodesic(t,e){const i=O(t),s=O(e);if(i&&s)return this.lowerDistanceGeodetic_(t.xmin,t.ymin,e.xmin,e.ymin);const n=this.normalizeGeodesic_(e,t);return U(t,n)?t.ymin>=n.ymax?this.minDistanceGeodesicUpDown_(t,n):n.ymin>=t.ymax?this.minDistanceGeodesicUpDown_(n,t):t.xmin>n.xmax?this.minDistanceGeodesicLeftRight_(n,t):this.minDistanceGeodesicLeftRight_(t,n):0}normalizeGeodesic_(t,e){const i=t.clone(),s=t.clone();let n=V(i,e);if(0===n)return i;for(;s.xmax>e.xmin;){s.xmin-=this.m_u360,s.xmax-=this.m_u360;const t=V(s,e);if(t<n&&(i.assign(s),n=t,0===n))return i}for(s.assign(t);s.xmin<e.xmax;){s.xmin+=this.m_u360,s.xmax+=this.m_u360;const t=V(s,e);if(t<n&&(i.assign(s),n=t,0===n))return i}return i}lowerDistanceGeodetic_(t,e,i,s){const n=this.m_peR1;{const o=this.m_b*this.m_b/this.m_a,a=v.phiToPhig(this.m_e2,this.m_unitToRad*e),m=v.phiToPhig(this.m_e2,this.m_unitToRad*s);p.geodeticDistance(o,0,this.m_unitToRad*t,a,this.m_unitToRad*i,m,n,null,null,0)}return n.val}minDistanceGeodesicUpDown_(t,e){if(e.xmin<=t.xmin?e.xmax>=t.xmin:t.xmax>=e.xmin)return this.lowerDistanceGeodetic_(0,t.ymin,0,e.ymax);if(e.xmin>t.xmax){const i=this.lowerDistanceGeodeticSegMeridional_(t.xmax,t.ymin,t.ymax,e.xmin,e.ymin,e.ymax);if(e.xmax-t.xmin<this.m_u180)return i;const s=this.lowerDistanceGeodeticSegMeridional_(t.xmin,t.ymin,t.ymax,e.xmax,e.ymin,e.ymax);return Math.min(i,s)}{const i=this.lowerDistanceGeodeticSegMeridional_(t.xmin,t.ymin,t.ymax,e.xmax,e.ymin,e.ymax);if(t.xmax-e.xmin<this.m_u180)return i;const s=this.lowerDistanceGeodeticSegMeridional_(t.xmax,t.ymin,t.ymax,e.xmin,e.ymin,e.ymax);return Math.min(i,s)}}minDistanceGeodesicLeftRight_(t,e){let i=Math.abs(t.xmax-e.xmin);for(;i>this.m_u180;)i-=this.m_u360;let s=Math.abs(t.xmin-e.xmax);for(;s>this.m_u180;)s-=this.m_u360;return Math.abs(i)<=Math.abs(s)?this.minDistanceGeodesicLeftRightNormalized_(t,e):this.minDistanceGeodesicLeftRightNormalized_(e,t)}minDistanceGeodesicLeftRightNormalized_(t,e){let i,s;return i=this.lowerDistanceGeodetic_(t.xmax,t.ymin,e.xmin,e.ymin),t.ymin>=e.ymin&&t.ymin<=e.ymax&&(s=this.lowerDistanceGeodeticPtMeridional_(t.xmax,t.ymin,e.xmin,e.ymin,e.ymax),i=Math.min(i,s)),e.ymin>=t.ymin&&e.ymin<=t.ymax&&(s=this.lowerDistanceGeodeticPtMeridional_(e.xmin,e.ymin,t.xmax,t.ymin,t.ymax),i=Math.min(i,s)),s=this.lowerDistanceGeodetic_(t.xmax,t.ymax,e.xmin,e.ymax),i=Math.min(i,s),t.ymax>=e.ymin&&t.ymax<=e.ymax&&(s=this.lowerDistanceGeodeticPtMeridional_(t.xmax,t.ymax,e.xmin,e.ymin,e.ymax),i=Math.min(i,s)),e.ymax>=t.ymin&&e.ymax<=t.ymax&&(s=this.lowerDistanceGeodeticPtMeridional_(e.xmin,e.ymax,t.xmax,t.ymin,t.ymax),i=Math.min(i,s)),i}lowerDistanceGeodeticSegMeridional_(t,e,i,s,n,o){let a=this.lowerDistanceGeodeticPtMeridional_(t,e,s,n,o);const m=this.lowerDistanceGeodeticPtMeridional_(t,i,s,n,o);let r=this.lowerDistanceGeodeticPtMeridional_(s,n,t,e,i);const u=this.lowerDistanceGeodeticPtMeridional_(s,o,t,e,i);return a=Math.min(a,m),r=Math.min(r,u),Math.min(a,r)}lowerDistanceGeodeticPtMeridional_(t,e,i,s,n){const o=this.m_b*this.m_b/this.m_a,a=v.phiToPhig(this.m_e2,this.m_unitToRad*e),m=v.phiToPhig(this.m_e2,this.m_unitToRad*s),r=v.phiToPhig(this.m_e2,this.m_unitToRad*n),u=this.m_peR1,h=this.m_peR2;p.geodeticDistance(o,0,this.m_unitToRad*i,m,this.m_unitToRad*t,a,u,null,null,0),p.geodeticDistance(o,0,this.m_unitToRad*i,r,this.m_unitToRad*t,a,h,null,null,0);const c=d(1,0,new M(this.m_unitToRad*t,a)),l=d(1,0,new M(this.m_unitToRad*i,m)),_=d(1,0,new M(this.m_unitToRad*i,r));let g=new T;g.setCrossProductVector(l,_);const x=l.dotProduct(_);if(g.length()<1.568e-10)return x>=0?Math.min(u.val,h.val):0;g=g.getUnitVector();let y=new T;if(y.setCrossProductVector(g,c),y.length()<1.568e-10){return Math.min(u.val,h.val)-1e-5*o}y=y.getUnitVector();let P=c.sub(g.mul(c.dotProduct(g)));{const e=new T;e.setCrossProductVector(l,P);const i=new T;i.setCrossProductVector(P,_);let s=g.dotProduct(e)>0&&g.dotProduct(i)>0;if(s||(P.negateThis(),e.setCrossProductVector(l,P),i.setCrossProductVector(P,_),s=g.dotProduct(e)>0&&g.dotProduct(i)>0),s){P=P.getUnitVector();const e=G(1,0,P),i=this.m_peR3;p.geodeticDistance(o,0,this.m_unitToRad*t,a,e.x,e.y,i,null,null,0);const s=Math.min(u.val,h.val);return Math.min(s,i.val)}}return Math.min(u.val,h.val)}}function O(t){return t.xmin===t.xmax&&t.ymin===t.ymax}function U(t,e){return e.xmax<t.xmin||e.xmin>t.xmax||e.ymax<t.ymin||e.ymin>t.ymax}function V(t,e){let i,s=0;return i=t.xmin-e.xmax,i>s&&(s=i),i=e.xmin-t.xmax,i>s&&(s=i),s}class L{}function j(t){return{outPoint:void 0===t?new M:t.clone()}}function z(t,e){t.outPoint.assign(e.outPoint)}function H(){return new w}class J{constructor(t,e,i,s,n=0,o=4){this.m_ptDistFrom=new M,this.m_segStartPt=new M,this.m_segEndPt=new M,this.m_geodeticLength=new _,this.m_az12=new _,this.m_minGeodeticDist=new _,this.m_segStartPt3d=new T,this.m_segEndPt3d=new T,this.m_sr=s,this.m_distCurveType=n,this.m_segCurveType=o,this.m_inputGCS=this.m_sr.getGCS(),this.m_rpu=this.m_inputGCS.getUnit().getUnitToBaseFactor(),this.m_bIsPannablePcs=2===this.m_sr.getCoordinateSystemType()&&this.m_sr.isPannable();const a=h();this.m_inputGCS.querySpheroidData(a),this.m_a=a.majorSemiAxis,this.m_eSquared=a.e2,this.setPointDistFrom(t),this.setSegmentEndPoints(e,i)}setSegmentEndPoints(t,e){this.m_segStartPt.assign(t),this.m_segEndPt.assign(e),this.m_bIsPannablePcs||(this.m_segStartPt.mulThis(this.m_rpu),this.m_segEndPt.mulThis(this.m_rpu)),2===this.m_segCurveType&&(this.m_segStartPt3d.assign(d(this.m_a,this.m_eSquared,this.m_segStartPt)),this.m_segEndPt3d.assign(d(this.m_a,this.m_eSquared,this.m_segEndPt))),this.calculateAndUpdateSegmentLength()}setPointDistFrom(t){this.m_ptDistFrom.assign(t),this.m_ptDistFrom.scale(this.m_rpu)}setSegmentCurveType(t){this.m_segCurveType=t}setDistanceCurveType(t){this.m_distCurveType=t}makeFunctor(){return i=>{let s;switch(this.m_segCurveType){case 0:case 1:case 3:{const o={stack:[],error:void 0,hasError:!1};try{const e=t(o,new _,!1),n=t(o,new _,!1);p.geodeticCoordinate(this.m_a,this.m_eSquared,this.m_segStartPt.x,this.m_segStartPt.y,this.m_geodeticLength.val*i,this.m_az12.val,e,n,this.m_segCurveType),s=new M(e.val,n.val);break}catch(n){o.error=n,o.hasError=!0}finally{e(o)}}case 2:{const t=T.lerp(this.m_segStartPt3d,this.m_segEndPt3d,i);s=G(this.m_a,this.m_eSquared,t);break}case 4:s=M.lerp(this.m_segStartPt,this.m_segEndPt,i),this.m_bIsPannablePcs&&(x(this.m_sr,0,[s],1),s.mulThis(this.m_rpu));break;default:o("Invalid curve type")}return p.geodeticDistance(this.m_a,this.m_eSquared,this.m_ptDistFrom.x,this.m_ptDistFrom.y,s.x,s.y,this.m_minGeodeticDist,null,null,this.m_distCurveType),this.m_minGeodeticDist.val}}calculateAndUpdateSegmentLength(){switch(this.m_segCurveType){case 0:case 2:case 1:case 3:p.geodeticDistance(this.m_a,this.m_eSquared,this.m_segStartPt.x,this.m_segStartPt.y,this.m_segEndPt.x,this.m_segEndPt.y,this.m_geodeticLength,this.m_az12,null,this.m_segCurveType);break;case 4:this.m_geodeticLength.val=M.distance(this.m_segStartPt,this.m_segEndPt);break;default:o("Invalid curve type")}}[Symbol.dispose](){this.m_geodeticLength[Symbol.dispose](),this.m_az12[Symbol.dispose](),this.m_minGeodeticDist[Symbol.dispose]()}}function K(){return new L}class Q{[Symbol.dispose](){this.m_envHelper[Symbol.dispose]()}constructor(t,e,i,s,n){this.m_boxGeomA=H(),this.m_boxGeomB=H(),this.m_envGeomA=new w,this.m_envGeomB=new w,this.m_progressCounter=0,this.m_transformPCS2GCS=null,this.m_segmentBoxesA=new Map,this.m_segmentBoxesB=new Map,this.m_boundaryPtsA=[],this.m_boundaryPtsB=[],this.m_scaleToRadians=new B,this.m_scaleToDegrees=new B,this.m_inputSR=t,this.m_distCurveType=e,this.m_progressTracker=i,this.m_maxDistance=s,this.m_maxDeviation=n,this.m_inputGCS=t.getGCS(),this.m_peGeogcs=this.m_inputGCS.getPECoordSys(),this.m_tolerance=0;const o=h();this.m_inputGCS.querySpheroidData(o),this.m_a=o.majorSemiAxis,this.m_eSquared=o.e2,this.m_rpu=this.m_inputGCS.getUnit().getUnitToBaseFactor(),this.m_envHelper=new k(this.m_a,this.m_eSquared,1),4===this.m_distCurveType&&(this.m_distCurveType=0),this.m_boxGeomA.setEmpty(),this.m_boxGeomB.setEmpty(),this.m_envGeomA.setEmpty(),this.m_envGeomB.setEmpty(),this.m_bIsPannablePcs=2===this.m_inputSR.getCoordinateSystemType()&&this.m_inputSR.isPannable()}progress(t=!1){}calculate(t,e,i,s){const n=j(),o=j();if(t.queryEnvelope(this.m_envGeomA),e.queryEnvelope(this.m_envGeomB),this.checkGeometriesIntersect(t,e,n,o))return i&&z(i,n),s&&z(s,o),0;const a=this.prepareGeometry(t);if(a.isEmpty())return Number.NaN;const m=this.prepareGeometry(e);if(m.isEmpty())return Number.NaN;this.m_tolerance=this.computeTolerance(a,m);const r=this._ExecuteBruteForce(a,m,n,o);return r>=this.m_maxDistance?Number.NaN:(i&&(this.prepareOutput(n),z(i,n)),s&&(this.prepareOutput(o),z(s,o)),r)}createDistanceFunctor(t,e,i){const s=new J(t,e,i,this.m_inputSR,this.m_distCurveType);return this.m_bIsPannablePcs||1===this.m_inputSR.getCoordinateSystemType()||s.setSegmentCurveType(2),s}_NormalizeAndProject(t){if(this.m_inputSR.isPannable()&&(t=(new c).foldInto360Range(t,this.m_inputSR)),2===this.m_inputSR.getCoordinateSystemType()){const e=l(this.m_inputSR,this.m_inputGCS,null);t=(new c).execute(t,e,this.m_progressTracker)}return t}_ExecuteBruteForce(t,e,n,o){switch(t.getGeometryType()){case s.enumPoint:return this.calculateDistanceGeodeticPointGeometry(t,e,n,o);case s.enumMultiPoint:return this.calculateDistanceGeodeticMultipointGeometry(t,e,n,o);case s.enumPolyline:case s.enumPolygon:case s.enumEnvelope:return this.calculateDistanceGeodeticMultipathGeometry(t,e,n,o);default:i("")}}calculateDistanceGeodeticPointGeometry(t,e,n,o){switch(e.getGeometryType()){case s.enumPoint:return this.calculateDistanceGeodeticPointPoint(t,e,n,o);case s.enumMultiPoint:return this.calculateDistanceGeodeticPointMultipoint(t,e,n,o);case s.enumPolyline:case s.enumPolygon:return this.calculateDistanceGeodeticPointMultipath(t,e,n,o);default:i("")}}calculateDistanceGeodeticPointPoint(i,s,n,o){const a={stack:[],error:void 0,hasError:!1};try{const e=i.getXY();e.scale(this.m_rpu);const m=s.getXY();m.scale(this.m_rpu),n.outPoint.assign(e),o.outPoint.assign(m);const r=t(a,new _,!1);return p.geodeticDistance(this.m_a,this.m_eSquared,e.x,e.y,m.x,m.y,r,null,null,this.m_distCurveType),r.val}catch(m){a.error=m,a.hasError=!0}finally{e(a)}}calculateDistanceGeodeticPointMultipoint(i,s,n,o){const a={stack:[],error:void 0,hasError:!1};try{this.computeEnvelopesAndBoxes(i,s);const e=this.estimateMinimumDistance(n,o);let m=e<this.m_maxDistance?e:this.m_maxDistance;const r=i.getXY();r.scale(this.m_rpu),n.outPoint.assign(r);const u=d(this.m_a,this.m_eSquared,r),h=new M,c=s.getImpl(),l=t(a,new _,!1),g=c.getPointCount();for(let t=0;t<g;++t){c.queryXY(t,h),h.scale(this.m_rpu);const e=d(this.m_a,this.m_eSquared,h);if(!(T.distance(u,e)>m)&&(!(this.m_envHelper.minDistanceGeodesic(this.m_boxGeomA,this.m_boxGeomB)>m)&&(p.geodeticDistance(this.m_a,this.m_eSquared,r.x,r.y,h.x,h.y,l,null,null,this.m_distCurveType),l.val<m&&(m=l.val,o.outPoint=h,0===m))))return m}return m===this.m_maxDistance?Number.POSITIVE_INFINITY:m}catch(m){a.error=m,a.hasError=!0}finally{e(a)}}calculateDistanceGeodeticPointMultipath(i,s,o,a){const m={stack:[],error:void 0,hasError:!1};try{const e=new M,r=new M;e.assign(i.getXY()),r.assign(i.getXY()),o.outPoint.assign(r.mul(this.m_rpu)),this.m_bIsPannablePcs&&g(this.m_inputSR,[e],1,!1),this.computeEnvelopesAndBoxes(i,s);const u=this.estimateMinimumDistance(o,a);let h=u<this.m_maxDistance?u:this.m_maxDistance;const c=s.getImpl(),l=new M(0,0),_=new M(0,0),p=[1],d=this.canUseSpatialTree(i,s),x=K();d&&this.buildSpatialTree(x,s);const y=H();y.setCoords({xmin:r.x,ymin:r.y,xmax:r.x,ymax:r.y});const P=t(m,this.createDistanceFunctor(r,l,_),!1),S=c.querySegmentIterator();if(S.stripAttributes(),d)n(0);else for(;S.nextPath();)for(;S.hasNextSegment();){const t=S.nextSegment(),i=this.findOrComputeBoxSegment(S.getStartPointIndex(),t,this.m_segmentBoxesB);if(this.m_envHelper.minDistanceGeodesic(y,i)>h)continue;const s=this.calculateDistanceGeodeticPointSegment(e,r,t,p,P);if(s.second<h&&(this.updateOutputSegment(a,t,s.first),h=s.second,0===h))return 0}return h===this.m_maxDistance?Number.POSITIVE_INFINITY:h}catch(r){m.error=r,m.hasError=!0}finally{e(m)}}calculateDistanceGeodeticMultipointGeometry(t,e,n,o){switch(e.getGeometryType()){case s.enumPoint:return this.calculateDistanceGeodeticPointMultipoint(e,t,o,n);case s.enumMultiPoint:return this.calculateDistanceGeodeticMultipointMultipoint(t,e,n,o);case s.enumPolyline:case s.enumPolygon:case s.enumEnvelope:return this.calculateDistanceGeodeticMultipointMultipath(t,e,n,o);default:i("")}}calculateDistanceGeodeticMultipointMultipoint(i,s,n,o){const a={stack:[],error:void 0,hasError:!1};try{const e=t(a,new _,!1);this.computeEnvelopesAndBoxes(i,s);const m=this.estimateMinimumDistance(n,o);let r=m<this.m_maxDistance?m:this.m_maxDistance;const u=new M,h=new M,c=i.getImpl(),l=s.getImpl(),g=H(),x=c.getPointCount(),y=l.getPointCount();for(let t=0;t<x;++t){if(u.assign(c.getXY(t)),g.setCoords({xmin:u.x,ymin:u.y,xmax:u.x,ymax:u.y}),this.m_envHelper.minDistanceGeodesic(g,this.m_boxGeomB)>r)continue;u.scale(this.m_rpu);const i=d(this.m_a,this.m_eSquared,u);for(let t=0;t<y;++t){h.assign(l.getXY(t)),h.scale(this.m_rpu);const s=d(this.m_a,this.m_eSquared,h);if(!(T.distance(i,s)>=r)&&(p.geodeticDistance(this.m_a,this.m_eSquared,u.x,u.y,h.x,h.y,e,null,null,this.m_distCurveType),e.val<r&&(n.outPoint.assign(u),o.outPoint.assign(h),r=e.val,0===r)))return r}}return r===this.m_maxDistance?Number.POSITIVE_INFINITY:r}catch(m){a.error=m,a.hasError=!0}finally{e(a)}}calculateDistanceGeodeticMultipointMultipath(i,s,o,a){const m={stack:[],error:void 0,hasError:!1};try{const e=s.getImpl().querySegmentIterator();e.stripAttributes(),this.computeEnvelopesAndBoxes(i,s);const r=this.estimateMinimumDistance(o,a);let u=r<this.m_maxDistance?r:this.m_maxDistance;const h=new M,c=new M(0,0),l=new M(0,0),_=new M(0,0),p=[0],d=H(),x=t(m,this.createDistanceFunctor(c,l,_),!1),y=K(),P=this.canUseSpatialTree(i,s);P&&this.buildSpatialTree(y,s);const S=i.getPointCount();for(let t=0;t<S;++t)if(h.assign(i.getXY(t)),c.assign(i.getXY(t)),this.m_bIsPannablePcs&&g(this.m_inputSR,[h],1,!1),d.setCoords({xmin:c.x,ymin:c.y,xmax:c.x,ymax:c.y}),!(this.m_envHelper.minDistanceGeodesic(d,this.m_boxGeomB)>u))if(x.setPointDistFrom(c),P)n(0);else{for(;e.nextPath();)for(;e.hasNextSegment();){const t=e.nextSegment();if(this.m_envHelper.minDistanceGeodesic(d,this.findOrComputeBoxSegment(e.getStartPointIndex(),t,this.m_segmentBoxesB))>u)continue;const i=this.calculateDistanceGeodeticPointSegment(h,c,t,p,x);if(i.second<u&&(o.outPoint.assign(c.mul(this.m_rpu)),this.updateOutputSegment(a,t,i.first),u=i.second,0===u))return 0}e.resetToFirstPath()}return u===this.m_maxDistance?Number.POSITIVE_INFINITY:u}catch(r){m.error=r,m.hasError=!0}finally{e(m)}}calculateDistanceGeodeticMultipathGeometry(t,e,n,o){switch(e.getGeometryType()){case s.enumPoint:return this.calculateDistanceGeodeticPointMultipath(e,t,o,n);case s.enumMultiPoint:return this.calculateDistanceGeodeticMultipointMultipath(e,t,o,n);case s.enumPolyline:case s.enumPolygon:case s.enumEnvelope:return this.calculateDistanceGeodeticMultipathMultipath(t,e,n,o);default:i("")}}calculateDistanceGeodeticMultipathMultipath(t,e,i,s){const n=[t],o=[e],a=this.swapGeometries(n,o),m=n[0],r=o[0];this.computeEnvelopesAndBoxes(n[0],o[0]);const u=this.estimateMinimumDistance(i,s),h=this.calculateDistanceGeodeticMultipathMultipath_(m,r,i,s,u);return a&&(s.outPoint=E(i.outPoint,i.outPoint=s.outPoint)),h}calculateDistanceGeodeticMultipathMultipath_(i,s,o,a,m=Number.MAX_VALUE){const u={stack:[],error:void 0,hasError:!1};try{let e=m;const h=new M(0,0),c=new M,l=new M(0,0),_=new M,p=new M(0,0),d=new M,g=new M,P=new M,S=[new M],f=[0],D=[0],G=H(),v=H(),T=t(u,this.createDistanceFunctor(p,h,l),!1),b=K(),w=this.canUseSpatialTree(i,s);w&&this.buildSpatialTree(b,s);const E=s.querySegmentIterator();E.stripAttributes();const R=new r,I=A(i);for(let t=0;t<I.length;++t){const s=I[t];i.getSegmentBuffer(s,R,!0);const m=R.get();if(G.assign(this.findOrComputeBoxSegment(s,m,this.m_segmentBoxesA)),w)n(0);else{if(p.assign(m.getStartXY()),d.assign(m.getStartXY()),g.assign(m.getEndXY()),P.assign(m.getEndXY()),this.m_bIsPannablePcs&&(x(this.m_inputSR,0,[d],1),x(this.m_inputSR,0,[P],1)),this.m_envHelper.minDistanceGeodesic(G,this.m_boxGeomB)>e)continue;for(;E.nextPath();){for(;E.hasNextSegment();){const t=E.nextSegment();if(h.assign(t.getStartXY()),c.assign(t.getStartXY()),l.assign(t.getEndXY()),_.assign(t.getEndXY()),m.intersect(t,S,f,D,this.m_tolerance))return this.updateOutputSegment(o,m,f[0]),this.updateOutputSegment(a,t,D[0]),0;if(this.m_bIsPannablePcs&&(x(this.m_inputSR,0,[c],1),x(this.m_inputSR,0,[_],1)),v.assign(this.findOrComputeBoxPoint(E.getStartPointIndex(),c,_,this.m_segmentBoxesB)),this.m_envHelper.minDistanceGeodesic(G,v)>e)continue;T.setSegmentEndPoints(h,l),T.setPointDistFrom(d);let i=y(T.makeFunctor(),0,1,1e-10);if(i.second<e&&(o.outPoint.assign(d.mul(this.m_rpu)),this.updateOutputSegment(a,t,i.first),e=i.second,0===e))break;if(T.setPointDistFrom(P),i=y(T.makeFunctor(),0,1,1e-10),i.second<e&&(o.outPoint.assign(P.mul(this.m_rpu)),this.updateOutputSegment(a,t,i.first),e=i.second,0===e))break;if(T.setSegmentEndPoints(p,g),T.setPointDistFrom(c),i=y(T.makeFunctor(),0,1,1e-10),i.second<e&&(this.updateOutputSegment(o,m,i.first),a.outPoint.assign(c.mul(this.m_rpu)),e=i.second,0===e))break;if(T.setPointDistFrom(_),i=y(T.makeFunctor(),0,1,1e-10),i.second<e&&(this.updateOutputSegment(o,m,i.first),a.outPoint.assign(_.mul(this.m_rpu)),e=i.second,0===e))break}if(0===e)return 0}E.resetToFirstPath()}}return e===this.m_maxDistance?Number.POSITIVE_INFINITY:e}catch(h){u.error=h,u.hasError=!0}finally{e(u)}}calculateDistanceGeodeticPointSegment(t,e,i,s,n){const o=i.getStartXY(),a=i.getEndXY();return i.intersectPoint(t,s,this.m_tolerance)?R(s[0],0):(n.setPointDistFrom(e),n.setSegmentEndPoints(o,a),y(n.makeFunctor(),0,1,1e-10))}prepareGeometry(t){let e=t.clone();const i=t.getGeometryType();if(i===s.enumPoint||i===s.enumMultiPoint)return this._NormalizeAndProject(e);if(i===s.enumEnvelope&&(e=this.envelopeToPolygon(e)),this.m_inputSR.isPannable())return this.prepareGeometryPannable(e,4);if(2===this.m_inputSR.getCoordinateSystemType()){if(e=P(e,this.m_inputSR,0,null),e.isEmpty())return e;e=(new F).execute(e,this.m_inputSR,5e4,this.m_maxDeviation/2,0,null);const t=this.m_inputSR.getSRToGCSTransform();return(new c).execute(e,t,this.m_progressTracker)}const n=new w;e.queryLooseEnvelope(n);const o=this.m_inputSR.getPannableExtent();if(n.ymin<o.ymin||n.ymax>o.ymax){const t=new w(n.xmin-1,o.ymin,n.xmax+1,o.ymax);if(e=(new X).execute(e,t,this.m_inputSR,this.m_progressTracker),e.isEmpty())return e}return n.width()>2*o.width()?(e=S(e,-2*o.width(),2*o.width(),this.m_inputSR,!0,0,!0,this.m_progressTracker),e):e}prepareGeometryPannable(t,e){const i=new w;t.queryEnvelope(i);const s=this.m_inputSR.getPannableExtent();if(s.containsEnvelope(i))return t;const n=new I;s.queryIntervalX(n);const o=new I;return i.queryIntervalX(o),t=n.contains(o)?f(t,this.m_inputSR):(new c).foldInto360RangeGeodetic(t,this.m_inputSR,e)}prepareOutput(t){t.outPoint.scale(1/this.m_rpu),2===this.m_inputSR.getCoordinateSystemType()&&g(this.m_inputSR,[t.outPoint],1,!1)}updateOutputSegment(t,e,i){e.queryCoord2D(i,t.outPoint),this.m_bIsPannablePcs&&x(this.m_inputSR,0,[t.outPoint],1),t.outPoint.mulThis(this.m_rpu)}computeTolerance(t,e){t.queryEnvelope(this.m_envGeomA),e.queryEnvelope(this.m_envGeomB);const i=new w(this.m_envGeomA);return i.mergeEnvelope2D(this.m_envGeomB),b(null,i)}envelopeToPolygon(t){const e=new u;return e.addEnvelope(t,!1),e}computeEnvelopesAndBoxes(t,e){t.queryEnvelope(this.m_envGeomA),e.queryEnvelope(this.m_envGeomB),this.m_boxGeomA=this.computeBoxGeometry(t,this.m_boundaryPtsA,this.m_segmentBoxesA),this.m_boxGeomB=this.computeBoxGeometry(e,this.m_boundaryPtsB,this.m_segmentBoxesB)}computeBoxGeometry(t,e,i){switch(t.getGeometryType()){case s.enumPoint:return this.computeBoxPoint(t,e);case s.enumMultiPoint:return this.computeBoxMultiPoint(t,e);case s.enumPolyline:case s.enumPolygon:return this.computeBoxMultiPath(t,e,i);default:o("Invalid geometry type")}}computeBoxPoint(t,e){const i=t.getXY();e.length=0,e.push(i.mul(this.m_rpu));const s=H();return s.setCoords({xmin:i.x,ymin:i.y,xmax:i.x,ymax:i.y}),s}computeBoxMultiPoint(t,e){let i=!0;for(let n=0;n<t.getPointCount();++n){const s=t.getXY(n);if(i){e.length=0;for(let t=0;t<4;++t)e.push(s.clone());i=!1}s.x<e[0].x&&e[0].assign(s),s.y>e[1].y&&e[1].assign(s),s.x>e[2].x&&e[2].assign(s),s.y<e[3].y&&e[3].assign(s)}for(let n=0;n<e.length;++n)e[n].mulThis(this.m_rpu);const s=H();return t.queryEnvelope(s),s}computeBoxMultiPath(t,e,i){let s=!0;const n=H();n.setEmpty();const o=t.querySegmentIterator();for(o.stripAttributes();o.nextPath();)for(;o.hasNextSegment();){const t=o.nextSegment(),a=t.getStartXY(),m=t.getEndXY();if(this.m_bIsPannablePcs&&(x(this.m_inputSR,0,[a],1),x(this.m_inputSR,0,[m],1)),s){for(let t=0;t<4;++t)e.push(a.clone());s=!1}a.x<e[0].x&&e[0].assign(a),a.y>e[1].y&&e[1].assign(a),a.x>e[2].x&&e[2].assign(a),a.y<e[3].y&&e[3].assign(a),m.x<e[0].x&&e[0].assign(m),m.y>e[1].y&&e[1].assign(m),m.x>e[2].x&&e[2].assign(m),m.y<e[3].y&&e[3].assign(m);const r=this.findOrComputeBoxPoint(o.getStartPointIndex(),a,m,i);n.mergeEnvelope2D(r)}for(let a=0;a<e.length;++a)e[a].mulThis(this.m_rpu);return n}findOrComputeBoxSegment(t,e,i){if(!i.has(t)){let s=H();if(e.queryEnvelope(s),this.m_bIsPannablePcs){const t=M.construct(s.xmin,s.ymin),e=M.construct(s.xmax,s.ymax);x(this.m_inputSR,0,[t],1),x(this.m_inputSR,0,[e],1),s=this.m_envHelper.calculateBbox(t.x,t.y,e.x,e.y)}return i.set(t,s),s}return i.get(t)}findOrComputeBoxPoint(t,e,i,s){if(!s.has(t)){let n=H();return n.setCoords({xmin:e.x,ymin:e.y,xmax:i.x,ymax:i.y}),this.m_bIsPannablePcs&&(n=this.m_envHelper.calculateBbox(n.xmin,n.ymin,n.xmax,n.ymax)),s.set(t,n),n}return s.get(t)}estimateMinimumDistance(i,s){const n={stack:[],error:void 0,hasError:!1};try{const e=t=>d(this.m_a,this.m_eSquared,t),o=this.m_boundaryPtsA.map(e),a=this.m_boundaryPtsB.map(e);let m=Number.MAX_VALUE,r=0,u=0;for(let t=0;t<o.length;++t)for(let e=0;e<a.length;++e){const i=T.distance(o[t],a[e]);i<m&&(m=i,r=t,u=e)}i.outPoint.assign(this.m_boundaryPtsA[r]),s.outPoint.assign(this.m_boundaryPtsB[u]);const h=t(n,new _,!1);return p.geodeticDistance(this.m_a,this.m_eSquared,this.m_boundaryPtsA[r].x,this.m_boundaryPtsA[r].y,this.m_boundaryPtsB[u].x,this.m_boundaryPtsB[u].y,h,null,null,this.m_distCurveType),h.val}catch(o){n.error=o,n.hasError=!0}finally{e(n)}}swapGeometries(t,e){return a(t[0])>a(e[0])&&(e[0]=E(t[0],t[0]=e[0]),this.m_envGeomB=E(this.m_envGeomA,this.m_envGeomA=this.m_envGeomB),!0)}canUseSpatialTree(t,e){return!1}checkGeometriesIntersect(t,e,i,n){let o=t.getGeometryType(),a=e.getGeometryType();if(this.m_envGeomA.isIntersecting(this.m_envGeomB)){if(o===s.enumPoint&&2===e.getDimension()){const s=[0],o=[t.getXY()];if(D(e,o,1,this.m_tolerance,s),0!==s[0])return i.outPoint.assign(o[0]),n.outPoint.assign(o[0]),!0}else if(a===s.enumPoint&&2===t.getDimension()){const s=[2],o=[e.getXY()];if(D(t,o,1,this.m_tolerance,s),0!==s[0])return i.outPoint.assign(o[0]),n.outPoint.assign(o[0]),!0}if(o===s.enumMultiPoint&&2===e.getDimension())return this.multipointIntersectsArea(t,e,i,n);if(a===s.enumMultiPoint&&2===t.getDimension())return this.multipointIntersectsArea(e,t,n,i);let r,u,h=t,c=e;if(o===s.enumEnvelope&&(r=this.envelopeToPolygon(t),h=r,o=s.enumPolygon),a===s.enumEnvelope&&(u=this.envelopeToPolygon(e),c=u,a=s.enumPolygon),m(o)&&m(a)){const t=h.querySegmentIterator(),e=c.querySegmentIterator(),s=N(),o=N();if(q(h,c,t,e,s,o))return i.outPoint.assign(s.outPoint),n.outPoint.assign(s.outPoint),!0}}return!1}multipointIntersectsArea(t,e,i,s){const n=t.getPointCount();for(let o=0;o<n;++o){const n=[2],a=t.getXY(o);if(D(e,[a],1,this.m_tolerance,n),0!==n[0])return i.outPoint.assign(a),s.outPoint.assign(a),!0}return!1}getNearestNeighbourVisitor(t,e,i,s,o,a,m){return n(0),{}}buildSpatialTree(t,e){n(0)}}export{Q as G,J as a,j as m};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{S as e,G as t}from"./SimpleGeometryCursor.js";import{d as s,t as n,a as i,c as r,i as o,G as m,m as a,f as h,e as c,h as u,n as l}from"./Geometry.js";import{Envelope2D as _}from"./Envelope2D.js";import{W as f,g as d,F as g,ai as p,ak as P,O as x,ag as y,an as b,a3 as w,r as C,ao as v,ap as S,T as D,L as I,aq as G,ar as M,as as T,a7 as N,ab as k,at as A,au as E,av as q,aw as R,ax as z,ay as X}from"./UnitFactory.js";import{__addDisposableResource as B,__disposeResources as Y}from"tslib";import{a as O,P as F,E as j}from"./MultiPathImpl.js";import{e as W,c as J,P as U,b as H,f as L,h as V,s as K}from"./Envelope.js";import{T as Q}from"./Transformation2D.js";import{d as Z,m as $,P as ee,S as te,o as se,p as ne}from"./Point2D.js";import{c as ie}from"./OperatorClip.js";import{c as re}from"./GeometryCleaner-BEJM7I4l.js";import{O as oe}from"./OperatorDensify.js";function me(e,t,s,n,a,h){n<Number.MAX_VALUE&&n>-Number.MAX_VALUE||i("Geodesic_bufferer.buffer - bad distance"),r(e);const c=re(e),u=c.getGeometryType();if(o(u)){const e=c.getPointCount(),i=8e6;if(Math.abs(n)>i&&(e>50||u!==m.enumMultiPoint&&4===s&&e>2)){let e=c;const r=n>0?1:-1,o=7e6;let m=n,u=1;do{u++,m=(Math.abs(m)-o)*r}while(Math.abs(m)>i);m=n;for(let n=0;n<u-1;n++)e=he(e,t,s,o*r,a,u,h),m=(Math.abs(m)-o)*r;return e=he(e,t,s,m,a,u,h),e}}return he(c,t,s,n,a,1,h)}class ae{constructor(e){this.m_sr=null,this.m_gcs=null,this.m_transform=null,this.m_a=0,this.m_eSquared=0,this.m_rpu=0,this.m_radTolerance=0,this.m_q90=0,this.m_gcs90=0,this.m_gcs180=0,this.m_gcs360=0,this.m_gcs60=0,this.m_ellipticToGeodesicMaxRatio=0,this.m_curveType=0,this.m_bShapePreserving=!1,this.m_distance=0,this.m_absDistance=0,this.m_convergenceOffset=0,this.m_cornerStep=0,this.m_segmentStep=0,this.m_progressTracker=e}bufferPolygon(e){const t=new O,s=new we(this,e,t);return this.processGnomonicBufferPiecesCursor(!0,s)}bufferPolyline(e){const t=new we(this,e,null);return this.processGnomonicBufferPiecesCursor(!0,t)}bufferMultiPoint(e){const t=new Ce(this,e);return this.processGnomonicBufferPiecesCursor(!1,t)}bufferPoint(e){const t=e.getXY();t.scale(this.m_rpu);let s=new O;if(this.bufferPoint2D(t,!1,s)){const e=H(null,s,!0);s=w(s,e,!0,!0,-1,this.m_progressTracker,0,!1)}return s=(new x).foldInto360RangeGeodetic(s,this.m_gcs,2),s}processGnomonicBufferPiecesCursor(e,t){const s=t;let n=s.getGnomonic();const i=C(v());let r=new S,o=(new f).executeMany(r,i,this.m_progressTracker,2);const m=Z(6,!1),a=$(_,6);this.initializeGrid(m,a);const h=[null,null,null,null,null,null],c=[null,null,null,null,null,null],u=[null,null,null,null,null,null];let l,d,g;for(;null!==(l=s.next());){if(d=s.getGnomonic(),d!==n){if(null!==n){let t=o.next();if(r=null,o=null,null!=t){const s=H(i,t,!0),r=W(s);t=n.unproject(t,r,this.m_progressTracker),this.putInGridCursors(e,t,i,!0,m,a,h,c,u)}}null!==d&&(r=new S,o=(new f).executeMany(r,i,this.m_progressTracker,2)),n=d}if(s.isRunningInGnomonic()){if(d.project(l),s.needsSimplify()){const e=H(null,l,!0);l=w(l,e,!0,!0,-1,this.m_progressTracker,0,!1)}r.tick(ye(l)),o.tock()}else this.putInGridCursors(e,l,i,!0,m,a,h,c,u)}let p=!1;for(let _=0;_<6;_++)if(null!=u[_]){p=!0;break}if(p){let t=!1;const l=[null,null,null,null,null,null];if(e){const n=s.m_densified;if(s.m_densified=null,null!==n){const s=new Q;s.scale(1/this.m_rpu,1/this.m_rpu),n.applyTransformation(s),this.m_distance>0?this.putInGridCursors(e,n,i,!1,m,a,h,c,u):(this.processInGrid(e,n,!1,m,a,h,l),t=!0)}}const _=new S,d=(new f).executeMany(_,this.m_gcs,this.m_progressTracker,2);if(null!==o){let t=o.next();r=null,o=null;const s=H(i,t,!0),l=W(s);t=n.unproject(t,l,this.m_progressTracker),this.putInGridCursors(e,t,i,!0,m,a,h,c,u)}for(let e=0;e<6;e++)if(null!=u[e]){let s=u[e].next();u[e]=null,c[e]=null,t&&null!==l[e]&&(s=(new D).execute(l[e],s,i,this.m_progressTracker));const n=H(i,s,!0),r=W(n);s=h[e].unproject(s,r,this.m_progressTracker),s=(new I).execute(s,this.m_gcs,!0,this.m_progressTracker),_.tick(ye(s)),d.tock()}g=d.next()}else{let t,m=!1;if(e){let e=s.m_densified;if(s.m_densified=null,null!==e){const s=new Q;s.scale(1/this.m_rpu,1/this.m_rpu),e.applyTransformation(s),d.project(e);const n=H(null,e,!0);e=w(e,n,!1,!0,-1,this.m_progressTracker,0,!1),this.m_distance>0?(r.tick(ye(e)),o.tock()):(t=e,m=!0)}}let a=o.next();r=null,o=null,m&&(a=(new D).execute(t,a,i,this.m_progressTracker));const h=H(i,a,!0),c=W(h);g=n.unproject(a,c,this.m_progressTracker),g=(new I).execute(g,this.m_gcs,!0,this.m_progressTracker)}return g=(new x).foldInto360RangeGeodetic(g,this.m_gcs,2),g}putInGridCursors(e,t,s,n,i,r,o,m,a){const h=[null,null,null,null,null,null];this.processInGrid(e,t,n,i,r,o,h);for(let c=0;c<6;c++)null!==h[c]&&(null===m[c]&&(m[c]=new S,a[c]=(new f).executeMany(m[c],s,this.m_progressTracker,2)),m[c].tick(ye(h[c])),a[c].tock())}processInGrid(e,t,s,n,i,r,o){const m=.01,a=this.insertGeodeticPointsAlongGrid(t,i,m);for(let h=0;h<6;h++){if(n[h])continue;const e=i[h].clone();e.inflateCoords(m,m);const c=L(t,e),u=J(null,c,!1).total();let l=ie(a,e,u,Number.NaN,this.m_progressTracker);if(null!==l&&!l.isEmpty()){if(l===a&&(l=l.clone()),null===r[h]){const e=new ee;h<3?e.setCoords(0,1):e.setCoords(0,-1);const t=new ee;t.setAdd(i[h].getCenter(),e),r[h]=xe(this.m_gcs,t)}r[h].project(l);const e=H(null,l,!0);l=w(l,e,s,!0,-1,this.m_progressTracker,0,!1),o[h]=l}}}insertGeodeticPointsAlongGrid(e,t,s){const n=_.construct(t[3].xmin,t[3].ymin,t[2].xmax,t[2].ymax),i=G(this.m_gcs,n,e,!0,this.m_progressTracker),r=new j,o=r.addGeometry(i);return M(r,o,this.m_gcs,0,2,!0,t[0].xmax+s),M(r,o,this.m_gcs,0,2,!0,t[1].xmax+s),M(r,o,this.m_gcs,0,2,!1,t[1].ymin+s),0!==s&&(M(r,o,this.m_gcs,0,2,!0,t[0].xmax-s),M(r,o,this.m_gcs,0,2,!0,t[1].xmax-s),M(r,o,this.m_gcs,0,2,!1,t[1].ymin-s)),r.getGeometry(o)}initializeGrid(e,t){for(let s=0;s<6;s++)e[s]=!1;t[0].setCoords({xmin:-this.m_gcs180,ymin:0,xmax:-this.m_gcs60,ymax:this.m_gcs90}),t[1].setCoords({xmin:-this.m_gcs60,ymin:0,xmax:this.m_gcs60,ymax:this.m_gcs90}),t[2].setCoords({xmin:this.m_gcs60,ymin:0,xmax:this.m_gcs180,ymax:this.m_gcs90}),t[3].setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:-this.m_gcs60,ymax:0}),t[4].setCoords({xmin:-this.m_gcs60,ymin:-this.m_gcs90,xmax:this.m_gcs60,ymax:0}),t[5].setCoords({xmin:this.m_gcs60,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:0})}checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(e,t,s,n,i,r){const o=e[0],m=e.at(-1),a=o.y<m.y?o.y:m.y,h=o.y>m.y?o.y:m.y,c=p.q(this.m_a,this.m_eSquared,a),u=p.q(this.m_a,this.m_eSquared,h);if(this.m_q90-(c+t+this.m_absDistance)>.001&&this.m_q90+(u-t-this.m_absDistance)>.001)return!1;const l=s-se,_=n+se,f=l-Math.PI,d=l+Math.PI,g=_+Math.PI,P=[Number.NaN],x=[Number.NaN],y=[Number.NaN],b=[Number.NaN];let w=!1;if(le(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,o,l,f,m,_,P,x),le(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,m,g,_,o,f,y,b),(_<P[0]&&P[0]<g||_<x[0]&&x[0]<g)&&(w=!0),w||(f<y[0]&&y[0]<l||f<b[0]&&b[0]<l)&&(w=!0),!w&&i)return!1;const C=[];for(let p=e.length-1;p>=0;p--)C.push(e[p]);r.setEmpty(),r.addPathPoint2D(null,0,!0);let v=0;v=ce(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,this.m_curveType,e,l,_,i,v,r),v=ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,m,_,g,this.m_cornerStep,i,v,r,P[0],x[0]),v=ce(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,this.m_curveType,C,g,d,i,v,r),v=ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,o,f,l,this.m_cornerStep,i,v,r,y[0],b[0]);let S=!1;return i||(S=this.checkAndPrepForPole(r)),w||S}bufferPoint2D(e,t,s){s.setEmpty(),s.addPathPoint2D(null,0,!0);const n=0;ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,e,-this.m_cornerStep,2*Math.PI,this.m_cornerStep,t,n,s);let i=!1;return t||(i=this.checkAndPrepForPole(s)),i}checkAndPrepForPole(e){const t=this.checkAndPrepForPoleTouch(e),s=this.checkAndPrepForPoleWrap(e);return t||s}checkAndPrepForPoleTouch(e){const t=new _;return e.queryEnvelope(t),!(!T(t.ymax,this.m_gcs90)&&!T(t.ymin,-this.m_gcs90))&&(this.prepPoleTouch(e),!0)}checkAndPrepForPoleWrap(e){const t=e.getXY(0),s=e.getXY(e.getPointCount()-1);return Math.abs(t.x-s.x)>this.m_gcs180?(this.prepSinglePoleWrap(e),!0):this.checkAndPrepForDoublePoleWrap(e)}checkAndPrepForDoublePoleWrap(e){return e.calculateArea2D()<0&&(this.prepDoublePoleWrap(e),!0)}prepPoleTouch(e){const t=new O;t.insertPath2D(-1,null,0,0,!0);const s=e.getPathStart(0),n=e.getPathEnd(0),i=n-s;let r=-1;for(r=s;r<n;r++){const t=e.getXY(r),s=T(t.y,this.m_gcs90),n=T(t.y,-this.m_gcs90);if(!s&&!n)break}let o=r,m=!1,a=Number.NaN;do{const n=e.getXY(o),r=T(n.y,this.m_gcs90),h=T(n.y,-this.m_gcs90),c=s+(o+1-s)%i;if(r||h){let s=ee.construct(a,n.y);t.insertPoint2D(0,-1,s);const i=e.getXY(c),r=T(i.y,this.m_gcs90),o=T(i.y,-this.m_gcs90);r||o||(s=ee.construct(i.x,n.y),m?t.setXY(t.getPointCount()-1,s):t.insertPoint2D(0,-1,s)),m=!0}else t.insertPoint2D(0,-1,n),a=n.x,m=!1;o=c}while(o!==r);e.setEmpty(),e.add(t,!1)}prepSinglePoleWrap(e){const t=new O,s=new O,n=new Q,i=e.getXY(e.getPathStart(0)),r=e.getXY(e.getPathEnd(0)-1),o=this.m_gcs360,m=this.m_gcs180,a=new _;a.setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:this.m_gcs90});const h=new _;e.queryEnvelope(h);const c=Math.ceil(h.width()/o);let u,l;i.x>r.x?(u=-o,l=this.m_gcs90):(u=o,l=-this.m_gcs90),n.setShiftCoords(u,0),t.addPath(e,0,!0),s.add(t,!1);const f=new U;for(let _=0;_<c;_++)s.applyTransformation(n),s.getPointByVal(0,f),t.lineToPoint(f),t.addSegmentsFromPath(s,0,0,s.getSegmentCount()-1,!1);const d=t.getXY(0),g=t.getXY(t.getPointCount()-1);d.y=l,g.y=l,t.lineTo(g);const p=new ee;for(p.setCoordsPoint2D(g),p.x-=.5*u;Math.abs(p.x-d.x)>m;)t.lineTo(p),p.x-=.5*u;t.lineTo(d);const P=a.getCenterX(),x=new _;t.queryEnvelope(x);let y=0;const b=x.getCenter().x;b-P>m?y=-Math.ceil((b-P-m)/o):P-b>m&&(y=Math.ceil((P-b-m)/o)),0!==y&&(n.setShiftCoords(y*o,0),t.applyTransformation(n));const w=new j,C=w.addGeometry(t);M(w,C,this.m_gcs,0,2,!0,a.xmin),M(w,C,this.m_gcs,0,2,!0,a.xmax);const v=w.getGeometry(C),S=L(v,a);S.inflateCoords(0,1);const D=J(null,S,!0).total(),I=ie(v,a,D,Number.NaN,this.m_progressTracker);e.setEmpty(),e.add(I,!1)}prepDoublePoleWrap(e){const t=this.m_gcs360,s=this.m_gcs180,n=new _;n.setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:this.m_gcs90});const i=n.getCenter().x,r=new _;e.queryPathEnvelope(0,r);let o,m=0,a=r.getCenter().x;if(a-i>s?m=-Math.ceil((a-i-s)/t):i-a>s&&(m=Math.ceil((i-a-s)/t)),0!==m){const s=new Q;s.setShiftCoords(m*t,0),e.getImpl().applyTransformationToPath(s,0),e.queryPathEnvelope(0,r),a=r.getCenter().x}const h=new _;n.containsExclusiveEnvelope(r)?(o=!1,h.setCoords({env2D:n})):(o=!0,h.setCoords({env2D:n}),h.xmin-=t,h.xmax+=t);let c=e.createInstance();c.addPathPoint2D(null,0,!0);const u=new ee;if(u.setCoords(h.xmin,h.ymin),c.insertPoint2D(0,-1,u),u.setCoords(h.xmin,h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(.5*(h.xmin+h.xmax),h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(h.xmax,h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(h.xmax,h.ymin),c.insertPoint2D(0,-1,u),u.setCoords(.5*(h.xmin+h.xmax),h.ymin),c.insertPoint2D(0,-1,u),o){c.addPath(e,0,!0);const s=new Q;a<i?s.setShiftCoords(t,0):s.setShiftCoords(-t,0),e.getImpl().applyTransformationToPath(s,0),c.addPath(e,0,!0);const r=new j,o=r.addGeometry(c);M(r,o,this.m_gcs,0,2,!0,n.xmin),M(r,o,this.m_gcs,0,2,!0,n.xmax),c=r.getGeometry(o);const m=L(c,n);m.inflateCoords(0,1);const h=J(null,m,!0).total();c=ie(c,n,h,Number.NaN,this.m_progressTracker)}else c.addPath(e,0,!0);e.setEmpty(),e.add(c,!1)}setMinCornerStep(){const e={stack:[],error:void 0,hasError:!1};try{let s=Math.min(Math.PI*this.m_a-this.m_absDistance,this.m_absDistance);s=Math.min(s,.125*this.m_a*Math.PI);const n=new ee;n.setCoords(0,10*this.m_rpu);const i=0;let r=45*this.m_rpu;const o=B(e,new te(new N,new N),!1),m=B(e,new te(new N,new N),!1),a=B(e,new te(new N,new N),!1),h=B(e,new te(new N,new N),!1),c=new ee,u=new ee,l=new ee,_=new ee;for(k.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,i,o.at(0),o.at(1)),c.setCoords(o.at(0).val,o.at(1).val),k.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,r,m.at(0),m.at(1)),u.setCoords(m.at(0).val,m.at(1).val);;){const e={stack:[],error:void 0,hasError:!1};try{const t=.5*(i+r);k.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,t,a.at(0),a.at(1)),l.setCoords(a.at(0).val,a.at(1).val);const o=B(e,new N,!1),f=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,c.x,c.y,u.x,u.y,o,f,null,2),k.geodeticCoordinate(this.m_a,this.m_eSquared,c.x,c.y,.5*o.val,f.val,h.at(0),h.at(1),2),_.setCoords(h.at(0).val,h.at(1).val);const d=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,l.x,l.y,_.x,_.y,d,null,null,2);if(d.val<=this.m_convergenceOffset)break;r*=.9,k.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,r,m.at(0),m.at(1)),u.setCoords(m.at(0).val,m.at(1).val)}catch(t){e.error=t,e.hasError=!0}finally{Y(e)}}const f=r-i,d=2*Math.PI/Math.ceil(2*Math.PI/f);this.m_cornerStep=d}catch(s){e.error=s,e.hasError=!0}finally{Y(e)}}setMinSegmentStep(){const e={stack:[],error:void 0,hasError:!1};try{let n=Math.min(Math.PI*this.m_a-this.m_absDistance,this.m_absDistance);n=Math.min(n,.125*this.m_a*Math.PI);const i=new ee,r=new ee;i.setCoords(0,10*this.m_rpu),r.setCoords(10*this.m_rpu,10*this.m_rpu);const o=B(e,new N,!1),m=B(e,new N,!1),a=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,r.x,r.y,a,o,m,this.m_curveType);const h=B(e,new te(new N,new N),!1),c=B(e,new te(new N,new N),!1),u=new ee,l=B(e,new N,!1),_=B(e,new te(new N,new N),!1),f=B(e,new te(new N,new N),!1),d=B(e,new te(new N,new N),!1),g=B(e,new te(new N,new N),!1),p=new ee,P=new ee,x=new ee,y=new ee,b=0;let w=1;const C=o.val,v=m.val,S=C-.5*Math.PI,D=v+.5*Math.PI,I=a.val;for(k.geodesicCoordinate(this.m_a,this.m_eSquared,i.x,i.y,n,S,_.at(0),_.at(1)),p.setCoords(_.at(0).val,_.at(1).val),k.geodesicCoordinate(this.m_a,this.m_eSquared,r.x,r.y,n,D,f.at(0),f.at(1)),P.setCoords(f.at(0).val,f.at(1).val);;){const e={stack:[],error:void 0,hasError:!1};try{const s=.5*(b+w);k.geodeticCoordinate(this.m_a,this.m_eSquared,i.x,i.y,s*I,C,h.at(0),h.at(1),this.m_curveType),u.setCoords(h.at(0).val,h.at(1).val),k.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,u.x,u.y,null,null,l,this.m_curveType);const o=l.val+.5*Math.PI;k.geodesicCoordinate(this.m_a,this.m_eSquared,u.x,u.y,n,o,d.at(0),d.at(1)),x.setCoords(d.at(0).val,d.at(1).val);const m=B(e,new N,!1),a=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,p.x,p.y,P.x,P.y,m,a,null,2),k.geodeticCoordinate(this.m_a,this.m_eSquared,p.x,p.y,.5*m.val,a.val,g.at(0),g.at(1),2),y.setCoords(g.at(0).val,g.at(1).val);const _=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,x.x,x.y,y.x,y.y,_,null,null,2);if(_.val<=this.m_convergenceOffset)break;{const e={stack:[],error:void 0,hasError:!1};try{w*=.9,k.geodeticCoordinate(this.m_a,this.m_eSquared,i.x,i.y,w*I,C,c.at(0),c.at(1),this.m_curveType),r.setCoords(c.at(0).val,c.at(1).val);const t=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,r.x,r.y,null,null,t,this.m_curveType);const s=t.val+.5*Math.PI;k.geodesicCoordinate(this.m_a,this.m_eSquared,r.x,r.y,n,s,f.at(0),f.at(1)),P.setCoords(f.at(0).val,f.at(1).val)}catch(t){e.error=t,e.hasError=!0}finally{Y(e)}}}catch(s){e.error=s,e.hasError=!0}finally{Y(e)}}let G=w*I;G>1e5&&(G=1e5),this.m_segmentStep=G}catch(n){e.error=n,e.hasError=!0}finally{Y(e)}}setConvergenceOffset(){let e;e=this.m_absDistance>5e4?100:this.m_absDistance>1e4?10:1,this.m_absDistance/e<500&&(e=this.m_absDistance/500),e<.01&&(e=.01),this.m_convergenceOffset=e}}function he(e,t,s,n,i,r,o){if(e.isEmpty())return new O({vd:e.getDescription()});let f=e;if(a(f)){const e=10*t.getTolerance(0);f=(new oe).execute(f,0,e,0,o,12e3)}const w=new ae(o);w.m_sr=t,w.m_gcs=t.getGCS(),w.m_transform=d(t,w.m_gcs,null);const C=g();w.m_gcs.querySpheroidData(C);const v=new _;f.queryEnvelope(v),w.m_a=C.majorSemiAxis,w.m_eSquared=C.e2,w.m_rpu=w.m_gcs.getUnit().getUnitToBaseFactor(),w.m_gcs90=.5*Math.PI/w.m_rpu,w.m_gcs180=Math.PI/w.m_rpu,w.m_gcs360=2*Math.PI/w.m_rpu,w.m_gcs60=w.m_gcs360/6,w.m_q90=p.q90(w.m_a,w.m_eSquared),w.m_ellipticToGeodesicMaxRatio=.5*w.m_a*Math.PI/w.m_q90;const S=w.m_gcs.getTolerance(0);w.m_radTolerance=S*w.m_rpu,4===s?(w.m_curveType=2,w.m_bShapePreserving=!0):(w.m_curveType=s,w.m_bShapePreserving=!1),w.m_distance=n,w.m_absDistance=Math.abs(n),Number.isNaN(i)||i<=0?w.setConvergenceOffset():w.m_convergenceOffset=Math.max(i,.001),w.m_convergenceOffset/=r;let D,I=f.getGeometryType();if(h(I)){const e=new F({vd:f.getDescription()});e.addSegment(f,!0),D=e,I=m.enumPolyline}else if(I===m.enumEnvelope){const e=f,t=new _;e.queryEnvelope(t);const s=W(J(w.m_sr,v,!0));if(t.minDimension()<=s)if(0===t.maxDimension()){const t=new U({vd:f.getDescription()});e.getCenter(t),D=t,I=m.enumPoint}else{const t=new F({vd:f.getDescription()});t.addEnvelope(e,!1),D=t,I=m.enumPolyline}else{const t=new O({vd:f.getDescription()});t.addEnvelope(e,!1),D=t,I=m.enumPolygon}}else D=f;if(w.setMinCornerStep(),c(I)||w.setMinSegmentStep(),w.m_absDistance<=.5*w.m_convergenceOffset)return I!==m.enumPolygon?new O({vd:D.getDescription()}):w.m_bShapePreserving?D:P(D,w.m_sr,w.m_curveType,w.m_segmentStep,-1,o);if(w.m_distance<0&&I!==m.enumPolygon)return new O({vd:D.getDescription()});if(w.m_bShapePreserving&&u(I)){const e=P(D,t,4,Number.NaN,w.m_convergenceOffset,o);D=(new x).execute(e,w.m_transform,o)}else D=(new x).execute(D,w.m_transform,o);if(D=y(D,w.m_gcs),D.isEmpty())return new O({vd:D.getDescription()});!w.m_bShapePreserving&&u(I)&&(D=b(w.m_rpu,D)),D=fe(D,w.m_gcs);let G=new O;switch(I){case m.enumPolygon:G=w.bufferPolygon(D);break;case m.enumPolyline:G=w.bufferPolyline(D);break;case m.enumMultiPoint:G=w.bufferMultiPoint(D);break;case m.enumPoint:G=w.bufferPoint(D);break;default:l("")}const M=(new x).execute(G,w.m_transform.getInverse(),o);return M.mergeVertexDescription(D.getDescription()),M}function ce(e,t,s,n,i,r,o,m,a,h,c){const u={stack:[],error:void 0,hasError:!1};try{const l=new ee;l.setNAN(),a||c.getPointCount()>0&&(l.setCoordsPoint2D(c.getXY(c.getPointCount()-1)),l.scale(s));const _=B(u,new N,!1),f=B(u,new te(new N,new N),!1),d=new ee,g=new ee,p=r.at(-1),P=1/s;for(let s=0;s<r.length;s++){const u=r[s];let x;0===s?x=o:s===r.length-1?x=m:(k.geodeticDistance(e,t,p.x,p.y,u.x,u.y,null,null,_,i),x=_.val-.5*Math.PI),k.geodesicCoordinate(e,t,u.x,u.y,n,x,f.at(0),f.at(1)),a?g.setCoords(f.at(0).val,f.at(1).val):(d.setCoords(f.at(0).val,f.at(1).val),h=_e(u.x,d.x,l.x,h),g.setCoords(h+d.x,d.y),l.setCoordsPoint2D(g)),g.scale(P),c.insertPoint2D(0,-1,g)}return h}catch(l){u.error=l,u.hasError=!0}finally{Y(u)}}function ue(e,t,s,n,i,r,o,m,a,h,c,u=Number.NaN,l=Number.NaN){const _={stack:[],error:void 0,hasError:!1};try{if(o-r<m)return h;const f=B(_,new te(new N,new N),!1),d=new ee,g=new ee,p=new ee;g.setNAN(),a||c.getPointCount()>0&&(g.setCoordsPoint2D(c.getXY(c.getPointCount()-1)),g.scale(s));let P=Math.ceil(r/m),x=P++*m;x===r&&(x=P++*m);let y=r;const b=1/s;for(;x<o+m&&(y<u&&u<x?(x=u,P--):y<l&&l<x&&(x=l,P--),!(x>=o));)k.geodesicCoordinate(e,t,i.x,i.y,n,x,f.at(0),f.at(1)),a?p.setCoords(f.at(0).val,f.at(1).val):(d.setCoords(f.at(0).val,f.at(1).val),h=_e(i.x,d.x,g.x,h),p.setCoords(h+d.x,d.y),g.setCoordsPoint2D(p)),p.scale(b),c.insertPoint2D(0,-1,p),y=x,x=P++*m;return h}catch(f){_.error=f,_.hasError=!0}finally{Y(_)}}function le(e,t,s,n,i,r,o,m,a,h,c){const u={stack:[],error:void 0,hasError:!1};try{const s=new ee,l=new ee,_=B(u,new te(new N,new N),!1);k.geodesicCoordinate(e,t,i.x,i.y,n,r,_.at(0),_.at(1)),s.setCoords(_.at(0).val,_.at(1).val),k.geodesicCoordinate(e,t,i.x,i.y,n,o,_.at(0),_.at(1)),l.setCoords(_.at(0).val,_.at(1).val);const f=B(u,new N,!1);for(k.geodeticDistance(e,t,m.x,m.y,s.x,s.y,null,f,null,0),h[0]=f.val,k.geodeticDistance(e,t,m.x,m.y,l.x,l.y,null,f,null,0),c[0]=f.val;h[0]<=c[0];)h[0]+=ne;for(;h[0]>c[0];)h[0]-=ne;for(;h[0]>=a;)h[0]-=ne,c[0]-=ne;for(;h[0]<a;)h[0]+=ne,c[0]+=ne}catch(l){u.error=l,u.hasError=!0}finally{Y(u)}}function _e(e,t,s,n){if(Number.isNaN(s)){for(;n+t-e>Math.PI;)n-=ne;for(;e-(n+t)>Math.PI;)n+=ne;return n}return n+t-s>Math.PI?n-=ne:s-(n+t)>Math.PI&&(n+=ne),n}function fe(e,t){const s=e.getGeometryType();let n;if(n=u(s)?e.getPathCount():s===m.enumMultiPoint?e.getPointCount():1,1===n)return e;const i=[],r=[];for(let m=0;m<n;m++){i.push(m);const n=new ee;if(u(s)){const t=new _;e.queryPathEnvelope(m,t),n.assign(t.getCenter())}else n.assign(e.getXY(m));const o=t.toGeohash(n);r.push(o)}i.sort((e,t)=>r[e]<r[t]?-1:r[e]>r[t]?1:0);const o=e.createInstance();for(let m=0;m<n;m++){const t=i[m];u(s)?o.addPath(e,t,!0):o.addPoints(e,t,t+1)}return o}function de(e,t,s,n,i,r){const o={stack:[],error:void 0,hasError:!1};try{if(n>=r)return!1;const m=s[0],a=s.at(-1),h=B(o,new N,!1),c=B(o,new N,!1),u=B(o,new N,!1);k.greatEllipticDistance(e,t,i.x,i.y,m.x,m.y,h,null,null),k.greatEllipticDistance(e,t,i.x,i.y,a.x,a.y,c,null,null),k.greatEllipticDistance(e,t,m.x,m.y,a.x,a.y,u,null,null);let l=Math.min(h.val,c.val)+u.val,_=l+n;if(_<r)return!0;const f=B(o,new N,!1);l=Math.max(h.val,c.val);for(let n=1;n<s.length-1;n++){const r=s[n];k.greatEllipticDistance(e,t,i.x,i.y,r.x,r.y,f,null,null),f.val>l&&(l=f.val)}return _=l+n,_<r}catch(m){o.error=m,o.hasError=!0}finally{Y(o)}}function ge(e,t,s,n,i,r,o,m){let a;if(n.length%2==0){const e=n.length>>1,t=n[e],s=n[e-1];a=ee.lerp(t,s,.5)}else{a=n[n.length-1>>1].clone()}const h=a.clone(),c=A(e,t,h,75/180*Math.PI);return!!de(e,t,n,i,h,c)&&(null!==r&&(r.setCoordsPoint2D(a),r.scale(1/s)),null!==o&&o.setCoordsPoint2D(h),null!==m&&(m[0]=c),!0)}function pe(e,t,s,n,i,r){const o={stack:[],error:void 0,hasError:!1};try{if(n>=r)return!1;const m=B(o,new N,!1);k.greatEllipticDistance(e,t,i.x,i.y,s.x,s.y,m,null,null);return m.val+n<r}catch(m){o.error=m,o.hasError=!0}finally{Y(o)}}function Pe(e,t,s,n,i,r,o,m){const a=A(e,t,n,75/180*Math.PI);return!!pe(e,t,n,i,n,a)&&(null!==r&&(r.setCoordsPoint2D(n),r.scale(1/s)),null!==o&&o.setCoordsPoint2D(n),null!==m&&(m[0]=a),!0)}function xe(e,t){return new X(e,t)}function ye(e){return V(e,0)||K(e,0),e}class be{constructor(e){this.m_bRunningInGnomonic=!1,this.m_bNeedsSimplify=!1,this.m_gnomonic=null,this.m_gnomonicCenterRad=new ee,this.m_minGnomonicRadius=Number.NaN,this.m_progressTracker=e}isRunningInGnomonic(){return this.m_bRunningInGnomonic}needsSimplify(){return this.m_bNeedsSimplify}getGnomonic(){return this.m_gnomonic}}class we extends be{constructor(e,t,s){super(e.m_progressTracker),this.m_segIter=null,this.m_bNextSegmentCannotJoin=!1,this.m_currentDensifiedDelta=[0],this.m_currentBufferedDelta=0,this.m_lastAzimuth=0,this.m_startAzimuth=[0],this.m_endAzimuth=[0],this.m_numWinds=0,this.m_debugCounter=0,this.m_bufferHelper=new O,this.m_densifiedPoints=[],this.m_bufferer=e,this.m_multiPath=t,this.m_densified=s,this.m_bNeedsSimplify=!0;const n=new _;this.m_multiPath.queryEnvelope(n);const i=n.getCenter(),r=i.clone();r.scale(this.m_bufferer.m_rpu),this.m_gnomonic=xe(this.m_bufferer.m_gcs,i),this.m_gnomonicCenterRad=r.clone(),this.m_minGnomonicRadius=A(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,r,75/180*Math.PI)}next(){let e;if(this.m_bNextSegmentCannotJoin)return this.m_bNextSegmentCannotJoin=!1,this.m_segIter.nextSegment(),e=this.m_bufferHelper.clone(),e;if(null===this.m_segIter){if(this.m_segIter=this.m_multiPath.getImpl().querySegmentIterator(),!this.m_segIter.nextPath())return null;null!==this.m_densified&&this.m_densified.addPathPoint2D(null,0,!0)}if(!this.m_segIter.hasNextSegment()){if(!this.m_segIter.nextPath())return null;null!=this.m_densified&&this.m_densified.addPathPoint2D(null,0,!0)}let t=null;this.m_currentBufferedDelta=0,this.m_currentDensifiedDelta=[0],this.m_numWinds=0,this.m_lastAzimuth=Number.NaN,this.m_bNextSegmentCannotJoin=!1,this.m_densifiedPoints.length=0;const s=16;let n=0;const i=new ee,r=new ee;for(;this.m_segIter.hasNextSegment()&&this.m_numWinds<s;){const e=this.m_segIter.nextSegment();if(i.setCoordsPoint2D(e.getStartXY()),r.setCoordsPoint2D(e.getEndXY()),i.scale(this.m_bufferer.m_rpu),r.scale(this.m_bufferer.m_rpu),E(i,r))i.x=r.x;else if(q(i,r))r.x=i.x;else{let e=-1,t=-1;const s=this.m_segIter.getPathIndex(),n=this.m_multiPath.getPathStart(s),o=this.m_multiPath.getPathEnd(s);if(e=this.m_segIter.getStartPointIndex()-1,t=this.m_segIter.getEndPointIndex()+1,e<n&&(e=this.m_multiPath.isClosedPath(s)?o-1:-1),t>o-1&&(t=this.m_multiPath.isClosedPath(s)?n:-1),-1!==e){const t=this.m_multiPath.getXY(e);t.scale(this.m_bufferer.m_rpu),q(t,i)&&(i.x=t.x)}if(-1!==t){const e=this.m_multiPath.getXY(t);e.scale(this.m_bufferer.m_rpu),E(r,e)&&(r.x=e.x)}}this.m_densifiedPoints.length=0;const s=R(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_curveType,i,r,this.m_bufferer.m_segmentStep,Number.NaN,this.m_bufferer.m_radTolerance,this.m_startAzimuth,this.m_endAzimuth,this.m_densifiedPoints,this.m_currentDensifiedDelta);if(0===n)this.m_bRunningInGnomonic=this.isSegmentBufferInCurrentGnomonic(this.m_densifiedPoints),this.m_bRunningInGnomonic||(this.m_bRunningInGnomonic=this.tryUpdateGnomonic(this.m_densifiedPoints));else if(this.m_bRunningInGnomonic){if(!this.isSegmentBufferInCurrentGnomonic(this.m_densifiedPoints)){this.m_segIter.previousSegment(),this.m_segIter.previousSegment(),this.m_segIter.nextSegment();break}}else{if(ge(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_densifiedPoints,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,null,null,null)){this.m_segIter.previousSegment(),this.m_segIter.previousSegment(),this.m_segIter.nextSegment();break}}if(0===s||z(i,r)?(this.m_bufferHelper.setEmpty(),this.m_bufferer.bufferPoint2D(i,this.m_bRunningInGnomonic,this.m_bufferHelper),this.m_bNextSegmentCannotJoin=!0):(this.m_bufferHelper.setEmpty(),this.m_bNextSegmentCannotJoin=this.checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(s,this.m_bufferHelper)),this.m_bNextSegmentCannotJoin){this.m_segIter.previousSegment(),this.m_segIter.hasPreviousSegment()?(this.m_segIter.previousSegment(),this.m_segIter.nextSegment()):this.m_segIter.resetToFirstSegment(),null!=this.m_densified&&this.m_densified.insertPointsFromPoints(this.m_densified.getPathCount()-1,-1,this.m_densifiedPoints,0,this.m_densifiedPoints.length-1,!0);break}null!=this.m_densified&&this.m_densified.insertPointsFromPoints(this.m_densified.getPathCount()-1,-1,this.m_densifiedPoints,0,this.m_densifiedPoints.length-1,!0),null===t&&(t=new O,t.addPathPoint2D(null,0,!0)),this.addJoinAndBufferLeftSide(t),n++}if(this.m_currentDensifiedDelta=[0],n>0){const e=this.m_segIter.getStartPointIndex(),s=this.m_segIter.getPathIndex();for(;n>0;){if(this.m_segIter.previousSegment(),i.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getStartPointIndex())),r.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getEndPointIndex())),i.scale(this.m_bufferer.m_rpu),r.scale(this.m_bufferer.m_rpu),this.m_bRunningInGnomonic)if(E(i,r))i.x=r.x;else if(q(i,r))r.x=i.x;else{let e=-1,t=-1;const s=this.m_segIter.getPathIndex(),n=this.m_multiPath.getPathStart(s),o=this.m_multiPath.getPathEnd(s);if(e=this.m_segIter.getStartPointIndex()-1,t=this.m_segIter.getEndPointIndex()+1,e<n&&(e=this.m_multiPath.isClosedPath(s)?o-1:-1),t>o-1&&(t=this.m_multiPath.isClosedPath(s)?n:-1),-1!==e){const t=this.m_multiPath.getXY(e);t.scale(this.m_bufferer.m_rpu),q(t,i)&&(i.x=t.x)}if(-1!==t){const e=this.m_multiPath.getXY(t);e.scale(this.m_bufferer.m_rpu),E(r,e)&&(r.x=e.x)}}this.m_densifiedPoints.length=0,R(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_curveType,r,i,this.m_bufferer.m_segmentStep,Number.NaN,this.m_bufferer.m_radTolerance,this.m_startAzimuth,this.m_endAzimuth,this.m_densifiedPoints,this.m_currentDensifiedDelta),this.addJoinAndBufferLeftSide(t),n--}return i.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getStartPointIndex())),i.scale(this.m_bufferer.m_rpu),this.m_currentBufferedDelta=ue(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,i,this.m_lastAzimuth+.5*Math.PI,this.m_lastAzimuth+1.5*Math.PI,this.m_bufferer.m_cornerStep,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,t),this.m_segIter.resetToVertex(e,s),this.m_segIter.nextSegment(),t}return this.m_bNextSegmentCannotJoin=!1,this.m_segIter.nextSegment(),e=this.m_bufferHelper.clone(),e}isSegmentBufferInCurrentGnomonic(e){return null!==this.m_gnomonic&&de(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,this.m_gnomonicCenterRad,this.m_minGnomonicRadius)}tryUpdateGnomonic(e){const t=new ee,s=new ee,n=[0];return ge(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,t,s,n)?(this.m_gnomonicCenterRad.setCoordsPoint2D(s),this.m_minGnomonicRadius=n[0],this.m_gnomonic=xe(this.m_bufferer.m_gcs,t),!0):(this.m_gnomonic=null,!1)}checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(e,t){return this.m_bufferer.checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(this.m_densifiedPoints,e,this.m_startAzimuth[0],this.m_endAzimuth[0],this.m_bRunningInGnomonic,t)}addJoinAndBufferLeftSide(e){const t=this.m_densifiedPoints[0];let s=Number.NaN,n=this.m_startAzimuth[0]-se;const i=this.m_endAzimuth[0]+se;let r=!1;if(!Number.isNaN(this.m_lastAzimuth)){this.m_lastAzimuth>=this.m_startAzimuth[0]?(s=this.m_lastAzimuth+se,n=s+Math.PI-(this.m_lastAzimuth-this.m_startAzimuth[0])):(s=this.m_lastAzimuth+se,n=s+Math.PI-(ne-(this.m_startAzimuth[0]-this.m_lastAzimuth))),r=!(this.m_lastAzimuth>=this.m_startAzimuth[0]&&this.m_lastAzimuth-this.m_startAzimuth[0]<=Math.PI)&&!(this.m_lastAzimuth<this.m_startAzimuth[0]&&this.m_startAzimuth[0]-this.m_lastAzimuth>=Math.PI);let i=!1;if(Math.abs(n-s)<=.5*this.m_bufferer.m_cornerStep&&(r||(i=!0)),i){if(e.removePointFromPath(0,e.getPointCount()-1),!this.m_bRunningInGnomonic){const t=new ee;t.setCoordsPoint2D(e.getXY(e.getPointCount()-1)),t.scale(this.m_bufferer.m_rpu),t.x-this.m_currentBufferedDelta<-Math.PI?this.m_currentBufferedDelta-=ne:t.x-this.m_currentBufferedDelta>Math.PI&&(this.m_currentBufferedDelta+=ne)}n=.5*(n+s)}else if(r){const s=new ee;s.setCoordsPoint2D(t),s.scale(1/this.m_bufferer.m_rpu),e.insertPoint2D(0,-1,s)}else ue(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,this.m_densifiedPoints[0],s,n,this.m_bufferer.m_cornerStep,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,e)}this.m_startAzimuth[0]!==this.m_lastAzimuth&&this.m_numWinds++,ce(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,this.m_bufferer.m_curveType,this.m_densifiedPoints,n,i,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,e),this.m_lastAzimuth=this.m_endAzimuth[0]}}class Ce extends be{constructor(e,t){super(e.m_progressTracker),this.m_pointIndex=-1,this.m_bufferer=e,this.m_multiPoint=t,this.m_bNeedsSimplify=!1;const s=new _;this.m_multiPoint.queryEnvelope(s);const n=s.getCenter(),i=n.clone();i.scale(this.m_bufferer.m_rpu),this.m_gnomonic=xe(this.m_bufferer.m_gcs,n),this.m_gnomonicCenterRad=i.clone(),this.m_minGnomonicRadius=A(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,i,75/180*Math.PI)}next(){if(this.m_bNeedsSimplify=!1,++this.m_pointIndex===this.m_multiPoint.getPointCount())return null;const e=this.m_multiPoint.getXY(this.m_pointIndex);e.scale(this.m_bufferer.m_rpu),this.m_bRunningInGnomonic=this.isPointBufferInCurrentGnomonic(e),this.m_bRunningInGnomonic||(this.m_bRunningInGnomonic=this.tryUpdateGnomonic(e));const t=new O,s=this.m_bufferer.bufferPoint2D(e,this.m_bRunningInGnomonic,t);return this.m_bNeedsSimplify=s,t}isPointBufferInCurrentGnomonic(e){return null!==this.m_gnomonic&&pe(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,this.m_gnomonicCenterRad,this.m_minGnomonicRadius)}tryUpdateGnomonic(e){const t=new ee,s=new ee,n=[0];return Pe(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,t,s,n)?(this.m_gnomonicCenterRad.setCoordsPoint2D(s),this.m_minGnomonicRadius=n[0],this.m_gnomonic=xe(this.m_bufferer.m_gcs,t),!0):(this.m_gnomonic=null,!1)}}class ve{getOperatorType(){return 10110}supportsCurves(){return!0}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}executeMany(e,t,s,n,i,r,o,m){if(o){const o=new Se(e,t,s,n,i,!1,r,m);return(new f).executeMany(o,t,m)}return new Se(e,t,s,n,i,!1,r,m)}execute(t,n,i,r,o,m,a){const h=new e([t]),c=[r],u=this.executeMany(h,n,i,c,o,!1,m,a).next();return u||s("geodesic buffer null output"),u}}class Se extends t{constructor(e,t,s,r,o,m,a,h){super(),this.m_currentUnionEnvelope2D=new _,this.m_index=-1,this.m_dindex=-1,this.m_progressTracker=h,m&&n(""),t||i("");0===t.getCoordinateSystemType()&&i(""),this.m_inputGeoms=e,this.m_spatialReference=t,this.m_curveType=s,this.m_distances=r,this.m_convergenceOffset=o,this.m_bOutlineOnly=m,this.m_bUnion=a}next(){let e;for(;e=this.m_inputGeoms.next();)return r(e),this.m_index=this.m_inputGeoms.getGeometryID(),this.m_dindex+1<this.m_distances.length&&this.m_dindex++,this.geodesicBuffer(e,this.m_distances[this.m_dindex]);return null}getGeometryID(){return this.m_index}tock(){return!0}getRank(){return 1}geodesicBuffer(e,t){return me(e,this.m_spatialReference,this.m_curveType,t,this.m_convergenceOffset,this.m_progressTracker)}}export{ve as OperatorGeodesicBuffer};
|
|
5
|
+
import{S as e,G as t}from"./SimpleGeometryCursor.js";import{d as s,t as n,a as i,c as r,i as o,G as m,m as a,f as h,e as c,h as u,n as l}from"./Geometry.js";import{Envelope2D as _}from"./Envelope2D.js";import{W as f,g as d,F as g,ai as p,ak as P,O as x,af as y,an as b,a3 as w,r as C,ao as v,ap as S,T as D,L as I,aq as G,ar as M,as as T,a7 as N,a8 as k,at as A,au as E,av as q,aw as R,ax as z,ay as X}from"./UnitFactory.js";import{__addDisposableResource as B,__disposeResources as Y}from"tslib";import{a as O,P as F,E as j}from"./MultiPathImpl.js";import{e as W,c as J,P as U,b as H,f as L,h as V,s as K}from"./Envelope.js";import{T as Q}from"./Transformation2D.js";import{d as Z,m as $,P as ee,S as te,o as se,p as ne}from"./Point2D.js";import{c as ie}from"./OperatorClip.js";import{c as re}from"./GeometryCleaner-BEJM7I4l.js";import{O as oe}from"./OperatorDensify.js";function me(e,t,s,n,a,h){n<Number.MAX_VALUE&&n>-Number.MAX_VALUE||i("Geodesic_bufferer.buffer - bad distance"),r(e);const c=re(e),u=c.getGeometryType();if(o(u)){const e=c.getPointCount(),i=8e6;if(Math.abs(n)>i&&(e>50||u!==m.enumMultiPoint&&4===s&&e>2)){let e=c;const r=n>0?1:-1,o=7e6;let m=n,u=1;do{u++,m=(Math.abs(m)-o)*r}while(Math.abs(m)>i);m=n;for(let n=0;n<u-1;n++)e=he(e,t,s,o*r,a,u,h),m=(Math.abs(m)-o)*r;return e=he(e,t,s,m,a,u,h),e}}return he(c,t,s,n,a,1,h)}class ae{constructor(e){this.m_sr=null,this.m_gcs=null,this.m_transform=null,this.m_a=0,this.m_eSquared=0,this.m_rpu=0,this.m_radTolerance=0,this.m_q90=0,this.m_gcs90=0,this.m_gcs180=0,this.m_gcs360=0,this.m_gcs60=0,this.m_ellipticToGeodesicMaxRatio=0,this.m_curveType=0,this.m_bShapePreserving=!1,this.m_distance=0,this.m_absDistance=0,this.m_convergenceOffset=0,this.m_cornerStep=0,this.m_segmentStep=0,this.m_progressTracker=e}bufferPolygon(e){const t=new O,s=new we(this,e,t);return this.processGnomonicBufferPiecesCursor(!0,s)}bufferPolyline(e){const t=new we(this,e,null);return this.processGnomonicBufferPiecesCursor(!0,t)}bufferMultiPoint(e){const t=new Ce(this,e);return this.processGnomonicBufferPiecesCursor(!1,t)}bufferPoint(e){const t=e.getXY();t.scale(this.m_rpu);let s=new O;if(this.bufferPoint2D(t,!1,s)){const e=H(null,s,!0);s=w(s,e,!0,!0,-1,this.m_progressTracker,0,!1)}return s=(new x).foldInto360RangeGeodetic(s,this.m_gcs,2),s}processGnomonicBufferPiecesCursor(e,t){const s=t;let n=s.getGnomonic();const i=C(v());let r=new S,o=(new f).executeMany(r,i,this.m_progressTracker,2);const m=Z(6,!1),a=$(_,6);this.initializeGrid(m,a);const h=[null,null,null,null,null,null],c=[null,null,null,null,null,null],u=[null,null,null,null,null,null];let l,d,g;for(;null!==(l=s.next());){if(d=s.getGnomonic(),d!==n){if(null!==n){let t=o.next();if(r=null,o=null,null!=t){const s=H(i,t,!0),r=W(s);t=n.unproject(t,r,this.m_progressTracker),this.putInGridCursors(e,t,i,!0,m,a,h,c,u)}}null!==d&&(r=new S,o=(new f).executeMany(r,i,this.m_progressTracker,2)),n=d}if(s.isRunningInGnomonic()){if(d.project(l),s.needsSimplify()){const e=H(null,l,!0);l=w(l,e,!0,!0,-1,this.m_progressTracker,0,!1)}r.tick(ye(l)),o.tock()}else this.putInGridCursors(e,l,i,!0,m,a,h,c,u)}let p=!1;for(let _=0;_<6;_++)if(null!=u[_]){p=!0;break}if(p){let t=!1;const l=[null,null,null,null,null,null];if(e){const n=s.m_densified;if(s.m_densified=null,null!==n){const s=new Q;s.scale(1/this.m_rpu,1/this.m_rpu),n.applyTransformation(s),this.m_distance>0?this.putInGridCursors(e,n,i,!1,m,a,h,c,u):(this.processInGrid(e,n,!1,m,a,h,l),t=!0)}}const _=new S,d=(new f).executeMany(_,this.m_gcs,this.m_progressTracker,2);if(null!==o){let t=o.next();r=null,o=null;const s=H(i,t,!0),l=W(s);t=n.unproject(t,l,this.m_progressTracker),this.putInGridCursors(e,t,i,!0,m,a,h,c,u)}for(let e=0;e<6;e++)if(null!=u[e]){let s=u[e].next();u[e]=null,c[e]=null,t&&null!==l[e]&&(s=(new D).execute(l[e],s,i,this.m_progressTracker));const n=H(i,s,!0),r=W(n);s=h[e].unproject(s,r,this.m_progressTracker),s=(new I).execute(s,this.m_gcs,!0,this.m_progressTracker),_.tick(ye(s)),d.tock()}g=d.next()}else{let t,m=!1;if(e){let e=s.m_densified;if(s.m_densified=null,null!==e){const s=new Q;s.scale(1/this.m_rpu,1/this.m_rpu),e.applyTransformation(s),d.project(e);const n=H(null,e,!0);e=w(e,n,!1,!0,-1,this.m_progressTracker,0,!1),this.m_distance>0?(r.tick(ye(e)),o.tock()):(t=e,m=!0)}}let a=o.next();r=null,o=null,m&&(a=(new D).execute(t,a,i,this.m_progressTracker));const h=H(i,a,!0),c=W(h);g=n.unproject(a,c,this.m_progressTracker),g=(new I).execute(g,this.m_gcs,!0,this.m_progressTracker)}return g=(new x).foldInto360RangeGeodetic(g,this.m_gcs,2),g}putInGridCursors(e,t,s,n,i,r,o,m,a){const h=[null,null,null,null,null,null];this.processInGrid(e,t,n,i,r,o,h);for(let c=0;c<6;c++)null!==h[c]&&(null===m[c]&&(m[c]=new S,a[c]=(new f).executeMany(m[c],s,this.m_progressTracker,2)),m[c].tick(ye(h[c])),a[c].tock())}processInGrid(e,t,s,n,i,r,o){const m=.01,a=this.insertGeodeticPointsAlongGrid(t,i,m);for(let h=0;h<6;h++){if(n[h])continue;const e=i[h].clone();e.inflateCoords(m,m);const c=L(t,e),u=J(null,c,!1).total();let l=ie(a,e,u,Number.NaN,this.m_progressTracker);if(null!==l&&!l.isEmpty()){if(l===a&&(l=l.clone()),null===r[h]){const e=new ee;h<3?e.setCoords(0,1):e.setCoords(0,-1);const t=new ee;t.setAdd(i[h].getCenter(),e),r[h]=xe(this.m_gcs,t)}r[h].project(l);const e=H(null,l,!0);l=w(l,e,s,!0,-1,this.m_progressTracker,0,!1),o[h]=l}}}insertGeodeticPointsAlongGrid(e,t,s){const n=_.construct(t[3].xmin,t[3].ymin,t[2].xmax,t[2].ymax),i=G(this.m_gcs,n,e,!0,this.m_progressTracker),r=new j,o=r.addGeometry(i);return M(r,o,this.m_gcs,0,2,!0,t[0].xmax+s),M(r,o,this.m_gcs,0,2,!0,t[1].xmax+s),M(r,o,this.m_gcs,0,2,!1,t[1].ymin+s),0!==s&&(M(r,o,this.m_gcs,0,2,!0,t[0].xmax-s),M(r,o,this.m_gcs,0,2,!0,t[1].xmax-s),M(r,o,this.m_gcs,0,2,!1,t[1].ymin-s)),r.getGeometry(o)}initializeGrid(e,t){for(let s=0;s<6;s++)e[s]=!1;t[0].setCoords({xmin:-this.m_gcs180,ymin:0,xmax:-this.m_gcs60,ymax:this.m_gcs90}),t[1].setCoords({xmin:-this.m_gcs60,ymin:0,xmax:this.m_gcs60,ymax:this.m_gcs90}),t[2].setCoords({xmin:this.m_gcs60,ymin:0,xmax:this.m_gcs180,ymax:this.m_gcs90}),t[3].setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:-this.m_gcs60,ymax:0}),t[4].setCoords({xmin:-this.m_gcs60,ymin:-this.m_gcs90,xmax:this.m_gcs60,ymax:0}),t[5].setCoords({xmin:this.m_gcs60,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:0})}checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(e,t,s,n,i,r){const o=e[0],m=e.at(-1),a=o.y<m.y?o.y:m.y,h=o.y>m.y?o.y:m.y,c=p.q(this.m_a,this.m_eSquared,a),u=p.q(this.m_a,this.m_eSquared,h);if(this.m_q90-(c+t+this.m_absDistance)>.001&&this.m_q90+(u-t-this.m_absDistance)>.001)return!1;const l=s-se,_=n+se,f=l-Math.PI,d=l+Math.PI,g=_+Math.PI,P=[Number.NaN],x=[Number.NaN],y=[Number.NaN],b=[Number.NaN];let w=!1;if(le(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,o,l,f,m,_,P,x),le(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,m,g,_,o,f,y,b),(_<P[0]&&P[0]<g||_<x[0]&&x[0]<g)&&(w=!0),w||(f<y[0]&&y[0]<l||f<b[0]&&b[0]<l)&&(w=!0),!w&&i)return!1;const C=[];for(let p=e.length-1;p>=0;p--)C.push(e[p]);r.setEmpty(),r.addPathPoint2D(null,0,!0);let v=0;v=ce(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,this.m_curveType,e,l,_,i,v,r),v=ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,m,_,g,this.m_cornerStep,i,v,r,P[0],x[0]),v=ce(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,this.m_curveType,C,g,d,i,v,r),v=ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,o,f,l,this.m_cornerStep,i,v,r,y[0],b[0]);let S=!1;return i||(S=this.checkAndPrepForPole(r)),w||S}bufferPoint2D(e,t,s){s.setEmpty(),s.addPathPoint2D(null,0,!0);const n=0;ue(this.m_a,this.m_eSquared,this.m_rpu,this.m_absDistance,e,-this.m_cornerStep,2*Math.PI,this.m_cornerStep,t,n,s);let i=!1;return t||(i=this.checkAndPrepForPole(s)),i}checkAndPrepForPole(e){const t=this.checkAndPrepForPoleTouch(e),s=this.checkAndPrepForPoleWrap(e);return t||s}checkAndPrepForPoleTouch(e){const t=new _;return e.queryEnvelope(t),!(!T(t.ymax,this.m_gcs90)&&!T(t.ymin,-this.m_gcs90))&&(this.prepPoleTouch(e),!0)}checkAndPrepForPoleWrap(e){const t=e.getXY(0),s=e.getXY(e.getPointCount()-1);return Math.abs(t.x-s.x)>this.m_gcs180?(this.prepSinglePoleWrap(e),!0):this.checkAndPrepForDoublePoleWrap(e)}checkAndPrepForDoublePoleWrap(e){return e.calculateArea2D()<0&&(this.prepDoublePoleWrap(e),!0)}prepPoleTouch(e){const t=new O;t.insertPath2D(-1,null,0,0,!0);const s=e.getPathStart(0),n=e.getPathEnd(0),i=n-s;let r=-1;for(r=s;r<n;r++){const t=e.getXY(r),s=T(t.y,this.m_gcs90),n=T(t.y,-this.m_gcs90);if(!s&&!n)break}let o=r,m=!1,a=Number.NaN;do{const n=e.getXY(o),r=T(n.y,this.m_gcs90),h=T(n.y,-this.m_gcs90),c=s+(o+1-s)%i;if(r||h){let s=ee.construct(a,n.y);t.insertPoint2D(0,-1,s);const i=e.getXY(c),r=T(i.y,this.m_gcs90),o=T(i.y,-this.m_gcs90);r||o||(s=ee.construct(i.x,n.y),m?t.setXY(t.getPointCount()-1,s):t.insertPoint2D(0,-1,s)),m=!0}else t.insertPoint2D(0,-1,n),a=n.x,m=!1;o=c}while(o!==r);e.setEmpty(),e.add(t,!1)}prepSinglePoleWrap(e){const t=new O,s=new O,n=new Q,i=e.getXY(e.getPathStart(0)),r=e.getXY(e.getPathEnd(0)-1),o=this.m_gcs360,m=this.m_gcs180,a=new _;a.setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:this.m_gcs90});const h=new _;e.queryEnvelope(h);const c=Math.ceil(h.width()/o);let u,l;i.x>r.x?(u=-o,l=this.m_gcs90):(u=o,l=-this.m_gcs90),n.setShiftCoords(u,0),t.addPath(e,0,!0),s.add(t,!1);const f=new U;for(let _=0;_<c;_++)s.applyTransformation(n),s.getPointByVal(0,f),t.lineToPoint(f),t.addSegmentsFromPath(s,0,0,s.getSegmentCount()-1,!1);const d=t.getXY(0),g=t.getXY(t.getPointCount()-1);d.y=l,g.y=l,t.lineTo(g);const p=new ee;for(p.setCoordsPoint2D(g),p.x-=.5*u;Math.abs(p.x-d.x)>m;)t.lineTo(p),p.x-=.5*u;t.lineTo(d);const P=a.getCenterX(),x=new _;t.queryEnvelope(x);let y=0;const b=x.getCenter().x;b-P>m?y=-Math.ceil((b-P-m)/o):P-b>m&&(y=Math.ceil((P-b-m)/o)),0!==y&&(n.setShiftCoords(y*o,0),t.applyTransformation(n));const w=new j,C=w.addGeometry(t);M(w,C,this.m_gcs,0,2,!0,a.xmin),M(w,C,this.m_gcs,0,2,!0,a.xmax);const v=w.getGeometry(C),S=L(v,a);S.inflateCoords(0,1);const D=J(null,S,!0).total(),I=ie(v,a,D,Number.NaN,this.m_progressTracker);e.setEmpty(),e.add(I,!1)}prepDoublePoleWrap(e){const t=this.m_gcs360,s=this.m_gcs180,n=new _;n.setCoords({xmin:-this.m_gcs180,ymin:-this.m_gcs90,xmax:this.m_gcs180,ymax:this.m_gcs90});const i=n.getCenter().x,r=new _;e.queryPathEnvelope(0,r);let o,m=0,a=r.getCenter().x;if(a-i>s?m=-Math.ceil((a-i-s)/t):i-a>s&&(m=Math.ceil((i-a-s)/t)),0!==m){const s=new Q;s.setShiftCoords(m*t,0),e.getImpl().applyTransformationToPath(s,0),e.queryPathEnvelope(0,r),a=r.getCenter().x}const h=new _;n.containsExclusiveEnvelope(r)?(o=!1,h.setCoords({env2D:n})):(o=!0,h.setCoords({env2D:n}),h.xmin-=t,h.xmax+=t);let c=e.createInstance();c.addPathPoint2D(null,0,!0);const u=new ee;if(u.setCoords(h.xmin,h.ymin),c.insertPoint2D(0,-1,u),u.setCoords(h.xmin,h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(.5*(h.xmin+h.xmax),h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(h.xmax,h.ymax),c.insertPoint2D(0,-1,u),u.setCoords(h.xmax,h.ymin),c.insertPoint2D(0,-1,u),u.setCoords(.5*(h.xmin+h.xmax),h.ymin),c.insertPoint2D(0,-1,u),o){c.addPath(e,0,!0);const s=new Q;a<i?s.setShiftCoords(t,0):s.setShiftCoords(-t,0),e.getImpl().applyTransformationToPath(s,0),c.addPath(e,0,!0);const r=new j,o=r.addGeometry(c);M(r,o,this.m_gcs,0,2,!0,n.xmin),M(r,o,this.m_gcs,0,2,!0,n.xmax),c=r.getGeometry(o);const m=L(c,n);m.inflateCoords(0,1);const h=J(null,m,!0).total();c=ie(c,n,h,Number.NaN,this.m_progressTracker)}else c.addPath(e,0,!0);e.setEmpty(),e.add(c,!1)}setMinCornerStep(){const e={stack:[],error:void 0,hasError:!1};try{let s=Math.min(Math.PI*this.m_a-this.m_absDistance,this.m_absDistance);s=Math.min(s,.125*this.m_a*Math.PI);const n=new ee;n.setCoords(0,10*this.m_rpu);const i=0;let r=45*this.m_rpu;const o=B(e,new te(new N,new N),!1),m=B(e,new te(new N,new N),!1),a=B(e,new te(new N,new N),!1),h=B(e,new te(new N,new N),!1),c=new ee,u=new ee,l=new ee,_=new ee;for(k.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,i,o.at(0),o.at(1)),c.setCoords(o.at(0).val,o.at(1).val),k.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,r,m.at(0),m.at(1)),u.setCoords(m.at(0).val,m.at(1).val);;){const e={stack:[],error:void 0,hasError:!1};try{const t=.5*(i+r);k.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,t,a.at(0),a.at(1)),l.setCoords(a.at(0).val,a.at(1).val);const o=B(e,new N,!1),f=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,c.x,c.y,u.x,u.y,o,f,null,2),k.geodeticCoordinate(this.m_a,this.m_eSquared,c.x,c.y,.5*o.val,f.val,h.at(0),h.at(1),2),_.setCoords(h.at(0).val,h.at(1).val);const d=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,l.x,l.y,_.x,_.y,d,null,null,2);if(d.val<=this.m_convergenceOffset)break;r*=.9,k.geodesicCoordinate(this.m_a,this.m_eSquared,n.x,n.y,s,r,m.at(0),m.at(1)),u.setCoords(m.at(0).val,m.at(1).val)}catch(t){e.error=t,e.hasError=!0}finally{Y(e)}}const f=r-i,d=2*Math.PI/Math.ceil(2*Math.PI/f);this.m_cornerStep=d}catch(s){e.error=s,e.hasError=!0}finally{Y(e)}}setMinSegmentStep(){const e={stack:[],error:void 0,hasError:!1};try{let n=Math.min(Math.PI*this.m_a-this.m_absDistance,this.m_absDistance);n=Math.min(n,.125*this.m_a*Math.PI);const i=new ee,r=new ee;i.setCoords(0,10*this.m_rpu),r.setCoords(10*this.m_rpu,10*this.m_rpu);const o=B(e,new N,!1),m=B(e,new N,!1),a=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,r.x,r.y,a,o,m,this.m_curveType);const h=B(e,new te(new N,new N),!1),c=B(e,new te(new N,new N),!1),u=new ee,l=B(e,new N,!1),_=B(e,new te(new N,new N),!1),f=B(e,new te(new N,new N),!1),d=B(e,new te(new N,new N),!1),g=B(e,new te(new N,new N),!1),p=new ee,P=new ee,x=new ee,y=new ee,b=0;let w=1;const C=o.val,v=m.val,S=C-.5*Math.PI,D=v+.5*Math.PI,I=a.val;for(k.geodesicCoordinate(this.m_a,this.m_eSquared,i.x,i.y,n,S,_.at(0),_.at(1)),p.setCoords(_.at(0).val,_.at(1).val),k.geodesicCoordinate(this.m_a,this.m_eSquared,r.x,r.y,n,D,f.at(0),f.at(1)),P.setCoords(f.at(0).val,f.at(1).val);;){const e={stack:[],error:void 0,hasError:!1};try{const s=.5*(b+w);k.geodeticCoordinate(this.m_a,this.m_eSquared,i.x,i.y,s*I,C,h.at(0),h.at(1),this.m_curveType),u.setCoords(h.at(0).val,h.at(1).val),k.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,u.x,u.y,null,null,l,this.m_curveType);const o=l.val+.5*Math.PI;k.geodesicCoordinate(this.m_a,this.m_eSquared,u.x,u.y,n,o,d.at(0),d.at(1)),x.setCoords(d.at(0).val,d.at(1).val);const m=B(e,new N,!1),a=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,p.x,p.y,P.x,P.y,m,a,null,2),k.geodeticCoordinate(this.m_a,this.m_eSquared,p.x,p.y,.5*m.val,a.val,g.at(0),g.at(1),2),y.setCoords(g.at(0).val,g.at(1).val);const _=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,x.x,x.y,y.x,y.y,_,null,null,2);if(_.val<=this.m_convergenceOffset)break;{const e={stack:[],error:void 0,hasError:!1};try{w*=.9,k.geodeticCoordinate(this.m_a,this.m_eSquared,i.x,i.y,w*I,C,c.at(0),c.at(1),this.m_curveType),r.setCoords(c.at(0).val,c.at(1).val);const t=B(e,new N,!1);k.geodeticDistance(this.m_a,this.m_eSquared,i.x,i.y,r.x,r.y,null,null,t,this.m_curveType);const s=t.val+.5*Math.PI;k.geodesicCoordinate(this.m_a,this.m_eSquared,r.x,r.y,n,s,f.at(0),f.at(1)),P.setCoords(f.at(0).val,f.at(1).val)}catch(t){e.error=t,e.hasError=!0}finally{Y(e)}}}catch(s){e.error=s,e.hasError=!0}finally{Y(e)}}let G=w*I;G>1e5&&(G=1e5),this.m_segmentStep=G}catch(n){e.error=n,e.hasError=!0}finally{Y(e)}}setConvergenceOffset(){let e;e=this.m_absDistance>5e4?100:this.m_absDistance>1e4?10:1,this.m_absDistance/e<500&&(e=this.m_absDistance/500),e<.01&&(e=.01),this.m_convergenceOffset=e}}function he(e,t,s,n,i,r,o){if(e.isEmpty())return new O({vd:e.getDescription()});let f=e;if(a(f)){const e=10*t.getTolerance(0);f=(new oe).execute(f,0,e,0,o,12e3)}const w=new ae(o);w.m_sr=t,w.m_gcs=t.getGCS(),w.m_transform=d(t,w.m_gcs,null);const C=g();w.m_gcs.querySpheroidData(C);const v=new _;f.queryEnvelope(v),w.m_a=C.majorSemiAxis,w.m_eSquared=C.e2,w.m_rpu=w.m_gcs.getUnit().getUnitToBaseFactor(),w.m_gcs90=.5*Math.PI/w.m_rpu,w.m_gcs180=Math.PI/w.m_rpu,w.m_gcs360=2*Math.PI/w.m_rpu,w.m_gcs60=w.m_gcs360/6,w.m_q90=p.q90(w.m_a,w.m_eSquared),w.m_ellipticToGeodesicMaxRatio=.5*w.m_a*Math.PI/w.m_q90;const S=w.m_gcs.getTolerance(0);w.m_radTolerance=S*w.m_rpu,4===s?(w.m_curveType=2,w.m_bShapePreserving=!0):(w.m_curveType=s,w.m_bShapePreserving=!1),w.m_distance=n,w.m_absDistance=Math.abs(n),Number.isNaN(i)||i<=0?w.setConvergenceOffset():w.m_convergenceOffset=Math.max(i,.001),w.m_convergenceOffset/=r;let D,I=f.getGeometryType();if(h(I)){const e=new F({vd:f.getDescription()});e.addSegment(f,!0),D=e,I=m.enumPolyline}else if(I===m.enumEnvelope){const e=f,t=new _;e.queryEnvelope(t);const s=W(J(w.m_sr,v,!0));if(t.minDimension()<=s)if(0===t.maxDimension()){const t=new U({vd:f.getDescription()});e.getCenter(t),D=t,I=m.enumPoint}else{const t=new F({vd:f.getDescription()});t.addEnvelope(e,!1),D=t,I=m.enumPolyline}else{const t=new O({vd:f.getDescription()});t.addEnvelope(e,!1),D=t,I=m.enumPolygon}}else D=f;if(w.setMinCornerStep(),c(I)||w.setMinSegmentStep(),w.m_absDistance<=.5*w.m_convergenceOffset)return I!==m.enumPolygon?new O({vd:D.getDescription()}):w.m_bShapePreserving?D:P(D,w.m_sr,w.m_curveType,w.m_segmentStep,-1,o);if(w.m_distance<0&&I!==m.enumPolygon)return new O({vd:D.getDescription()});if(w.m_bShapePreserving&&u(I)){const e=P(D,t,4,Number.NaN,w.m_convergenceOffset,o);D=(new x).execute(e,w.m_transform,o)}else D=(new x).execute(D,w.m_transform,o);if(D=y(D,w.m_gcs),D.isEmpty())return new O({vd:D.getDescription()});!w.m_bShapePreserving&&u(I)&&(D=b(w.m_rpu,D)),D=fe(D,w.m_gcs);let G=new O;switch(I){case m.enumPolygon:G=w.bufferPolygon(D);break;case m.enumPolyline:G=w.bufferPolyline(D);break;case m.enumMultiPoint:G=w.bufferMultiPoint(D);break;case m.enumPoint:G=w.bufferPoint(D);break;default:l("")}const M=(new x).execute(G,w.m_transform.getInverse(),o);return M.mergeVertexDescription(D.getDescription()),M}function ce(e,t,s,n,i,r,o,m,a,h,c){const u={stack:[],error:void 0,hasError:!1};try{const l=new ee;l.setNAN(),a||c.getPointCount()>0&&(l.setCoordsPoint2D(c.getXY(c.getPointCount()-1)),l.scale(s));const _=B(u,new N,!1),f=B(u,new te(new N,new N),!1),d=new ee,g=new ee,p=r.at(-1),P=1/s;for(let s=0;s<r.length;s++){const u=r[s];let x;0===s?x=o:s===r.length-1?x=m:(k.geodeticDistance(e,t,p.x,p.y,u.x,u.y,null,null,_,i),x=_.val-.5*Math.PI),k.geodesicCoordinate(e,t,u.x,u.y,n,x,f.at(0),f.at(1)),a?g.setCoords(f.at(0).val,f.at(1).val):(d.setCoords(f.at(0).val,f.at(1).val),h=_e(u.x,d.x,l.x,h),g.setCoords(h+d.x,d.y),l.setCoordsPoint2D(g)),g.scale(P),c.insertPoint2D(0,-1,g)}return h}catch(l){u.error=l,u.hasError=!0}finally{Y(u)}}function ue(e,t,s,n,i,r,o,m,a,h,c,u=Number.NaN,l=Number.NaN){const _={stack:[],error:void 0,hasError:!1};try{if(o-r<m)return h;const f=B(_,new te(new N,new N),!1),d=new ee,g=new ee,p=new ee;g.setNAN(),a||c.getPointCount()>0&&(g.setCoordsPoint2D(c.getXY(c.getPointCount()-1)),g.scale(s));let P=Math.ceil(r/m),x=P++*m;x===r&&(x=P++*m);let y=r;const b=1/s;for(;x<o+m&&(y<u&&u<x?(x=u,P--):y<l&&l<x&&(x=l,P--),!(x>=o));)k.geodesicCoordinate(e,t,i.x,i.y,n,x,f.at(0),f.at(1)),a?p.setCoords(f.at(0).val,f.at(1).val):(d.setCoords(f.at(0).val,f.at(1).val),h=_e(i.x,d.x,g.x,h),p.setCoords(h+d.x,d.y),g.setCoordsPoint2D(p)),p.scale(b),c.insertPoint2D(0,-1,p),y=x,x=P++*m;return h}catch(f){_.error=f,_.hasError=!0}finally{Y(_)}}function le(e,t,s,n,i,r,o,m,a,h,c){const u={stack:[],error:void 0,hasError:!1};try{const s=new ee,l=new ee,_=B(u,new te(new N,new N),!1);k.geodesicCoordinate(e,t,i.x,i.y,n,r,_.at(0),_.at(1)),s.setCoords(_.at(0).val,_.at(1).val),k.geodesicCoordinate(e,t,i.x,i.y,n,o,_.at(0),_.at(1)),l.setCoords(_.at(0).val,_.at(1).val);const f=B(u,new N,!1);for(k.geodeticDistance(e,t,m.x,m.y,s.x,s.y,null,f,null,0),h[0]=f.val,k.geodeticDistance(e,t,m.x,m.y,l.x,l.y,null,f,null,0),c[0]=f.val;h[0]<=c[0];)h[0]+=ne;for(;h[0]>c[0];)h[0]-=ne;for(;h[0]>=a;)h[0]-=ne,c[0]-=ne;for(;h[0]<a;)h[0]+=ne,c[0]+=ne}catch(l){u.error=l,u.hasError=!0}finally{Y(u)}}function _e(e,t,s,n){if(Number.isNaN(s)){for(;n+t-e>Math.PI;)n-=ne;for(;e-(n+t)>Math.PI;)n+=ne;return n}return n+t-s>Math.PI?n-=ne:s-(n+t)>Math.PI&&(n+=ne),n}function fe(e,t){const s=e.getGeometryType();let n;if(n=u(s)?e.getPathCount():s===m.enumMultiPoint?e.getPointCount():1,1===n)return e;const i=[],r=[];for(let m=0;m<n;m++){i.push(m);const n=new ee;if(u(s)){const t=new _;e.queryPathEnvelope(m,t),n.assign(t.getCenter())}else n.assign(e.getXY(m));const o=t.toGeohash(n);r.push(o)}i.sort((e,t)=>r[e]<r[t]?-1:r[e]>r[t]?1:0);const o=e.createInstance();for(let m=0;m<n;m++){const t=i[m];u(s)?o.addPath(e,t,!0):o.addPoints(e,t,t+1)}return o}function de(e,t,s,n,i,r){const o={stack:[],error:void 0,hasError:!1};try{if(n>=r)return!1;const m=s[0],a=s.at(-1),h=B(o,new N,!1),c=B(o,new N,!1),u=B(o,new N,!1);k.greatEllipticDistance(e,t,i.x,i.y,m.x,m.y,h,null,null),k.greatEllipticDistance(e,t,i.x,i.y,a.x,a.y,c,null,null),k.greatEllipticDistance(e,t,m.x,m.y,a.x,a.y,u,null,null);let l=Math.min(h.val,c.val)+u.val,_=l+n;if(_<r)return!0;const f=B(o,new N,!1);l=Math.max(h.val,c.val);for(let n=1;n<s.length-1;n++){const r=s[n];k.greatEllipticDistance(e,t,i.x,i.y,r.x,r.y,f,null,null),f.val>l&&(l=f.val)}return _=l+n,_<r}catch(m){o.error=m,o.hasError=!0}finally{Y(o)}}function ge(e,t,s,n,i,r,o,m){let a;if(n.length%2==0){const e=n.length>>1,t=n[e],s=n[e-1];a=ee.lerp(t,s,.5)}else{a=n[n.length-1>>1].clone()}const h=a.clone(),c=A(e,t,h,75/180*Math.PI);return!!de(e,t,n,i,h,c)&&(null!==r&&(r.setCoordsPoint2D(a),r.scale(1/s)),null!==o&&o.setCoordsPoint2D(h),null!==m&&(m[0]=c),!0)}function pe(e,t,s,n,i,r){const o={stack:[],error:void 0,hasError:!1};try{if(n>=r)return!1;const m=B(o,new N,!1);k.greatEllipticDistance(e,t,i.x,i.y,s.x,s.y,m,null,null);return m.val+n<r}catch(m){o.error=m,o.hasError=!0}finally{Y(o)}}function Pe(e,t,s,n,i,r,o,m){const a=A(e,t,n,75/180*Math.PI);return!!pe(e,t,n,i,n,a)&&(null!==r&&(r.setCoordsPoint2D(n),r.scale(1/s)),null!==o&&o.setCoordsPoint2D(n),null!==m&&(m[0]=a),!0)}function xe(e,t){return new X(e,t)}function ye(e){return V(e,0)||K(e,0),e}class be{constructor(e){this.m_bRunningInGnomonic=!1,this.m_bNeedsSimplify=!1,this.m_gnomonic=null,this.m_gnomonicCenterRad=new ee,this.m_minGnomonicRadius=Number.NaN,this.m_progressTracker=e}isRunningInGnomonic(){return this.m_bRunningInGnomonic}needsSimplify(){return this.m_bNeedsSimplify}getGnomonic(){return this.m_gnomonic}}class we extends be{constructor(e,t,s){super(e.m_progressTracker),this.m_segIter=null,this.m_bNextSegmentCannotJoin=!1,this.m_currentDensifiedDelta=[0],this.m_currentBufferedDelta=0,this.m_lastAzimuth=0,this.m_startAzimuth=[0],this.m_endAzimuth=[0],this.m_numWinds=0,this.m_debugCounter=0,this.m_bufferHelper=new O,this.m_densifiedPoints=[],this.m_bufferer=e,this.m_multiPath=t,this.m_densified=s,this.m_bNeedsSimplify=!0;const n=new _;this.m_multiPath.queryEnvelope(n);const i=n.getCenter(),r=i.clone();r.scale(this.m_bufferer.m_rpu),this.m_gnomonic=xe(this.m_bufferer.m_gcs,i),this.m_gnomonicCenterRad=r.clone(),this.m_minGnomonicRadius=A(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,r,75/180*Math.PI)}next(){let e;if(this.m_bNextSegmentCannotJoin)return this.m_bNextSegmentCannotJoin=!1,this.m_segIter.nextSegment(),e=this.m_bufferHelper.clone(),e;if(null===this.m_segIter){if(this.m_segIter=this.m_multiPath.getImpl().querySegmentIterator(),!this.m_segIter.nextPath())return null;null!==this.m_densified&&this.m_densified.addPathPoint2D(null,0,!0)}if(!this.m_segIter.hasNextSegment()){if(!this.m_segIter.nextPath())return null;null!=this.m_densified&&this.m_densified.addPathPoint2D(null,0,!0)}let t=null;this.m_currentBufferedDelta=0,this.m_currentDensifiedDelta=[0],this.m_numWinds=0,this.m_lastAzimuth=Number.NaN,this.m_bNextSegmentCannotJoin=!1,this.m_densifiedPoints.length=0;const s=16;let n=0;const i=new ee,r=new ee;for(;this.m_segIter.hasNextSegment()&&this.m_numWinds<s;){const e=this.m_segIter.nextSegment();if(i.setCoordsPoint2D(e.getStartXY()),r.setCoordsPoint2D(e.getEndXY()),i.scale(this.m_bufferer.m_rpu),r.scale(this.m_bufferer.m_rpu),E(i,r))i.x=r.x;else if(q(i,r))r.x=i.x;else{let e=-1,t=-1;const s=this.m_segIter.getPathIndex(),n=this.m_multiPath.getPathStart(s),o=this.m_multiPath.getPathEnd(s);if(e=this.m_segIter.getStartPointIndex()-1,t=this.m_segIter.getEndPointIndex()+1,e<n&&(e=this.m_multiPath.isClosedPath(s)?o-1:-1),t>o-1&&(t=this.m_multiPath.isClosedPath(s)?n:-1),-1!==e){const t=this.m_multiPath.getXY(e);t.scale(this.m_bufferer.m_rpu),q(t,i)&&(i.x=t.x)}if(-1!==t){const e=this.m_multiPath.getXY(t);e.scale(this.m_bufferer.m_rpu),E(r,e)&&(r.x=e.x)}}this.m_densifiedPoints.length=0;const s=R(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_curveType,i,r,this.m_bufferer.m_segmentStep,Number.NaN,this.m_bufferer.m_radTolerance,this.m_startAzimuth,this.m_endAzimuth,this.m_densifiedPoints,this.m_currentDensifiedDelta);if(0===n)this.m_bRunningInGnomonic=this.isSegmentBufferInCurrentGnomonic(this.m_densifiedPoints),this.m_bRunningInGnomonic||(this.m_bRunningInGnomonic=this.tryUpdateGnomonic(this.m_densifiedPoints));else if(this.m_bRunningInGnomonic){if(!this.isSegmentBufferInCurrentGnomonic(this.m_densifiedPoints)){this.m_segIter.previousSegment(),this.m_segIter.previousSegment(),this.m_segIter.nextSegment();break}}else{if(ge(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_densifiedPoints,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,null,null,null)){this.m_segIter.previousSegment(),this.m_segIter.previousSegment(),this.m_segIter.nextSegment();break}}if(0===s||z(i,r)?(this.m_bufferHelper.setEmpty(),this.m_bufferer.bufferPoint2D(i,this.m_bRunningInGnomonic,this.m_bufferHelper),this.m_bNextSegmentCannotJoin=!0):(this.m_bufferHelper.setEmpty(),this.m_bNextSegmentCannotJoin=this.checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(s,this.m_bufferHelper)),this.m_bNextSegmentCannotJoin){this.m_segIter.previousSegment(),this.m_segIter.hasPreviousSegment()?(this.m_segIter.previousSegment(),this.m_segIter.nextSegment()):this.m_segIter.resetToFirstSegment(),null!=this.m_densified&&this.m_densified.insertPointsFromPoints(this.m_densified.getPathCount()-1,-1,this.m_densifiedPoints,0,this.m_densifiedPoints.length-1,!0);break}null!=this.m_densified&&this.m_densified.insertPointsFromPoints(this.m_densified.getPathCount()-1,-1,this.m_densifiedPoints,0,this.m_densifiedPoints.length-1,!0),null===t&&(t=new O,t.addPathPoint2D(null,0,!0)),this.addJoinAndBufferLeftSide(t),n++}if(this.m_currentDensifiedDelta=[0],n>0){const e=this.m_segIter.getStartPointIndex(),s=this.m_segIter.getPathIndex();for(;n>0;){if(this.m_segIter.previousSegment(),i.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getStartPointIndex())),r.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getEndPointIndex())),i.scale(this.m_bufferer.m_rpu),r.scale(this.m_bufferer.m_rpu),this.m_bRunningInGnomonic)if(E(i,r))i.x=r.x;else if(q(i,r))r.x=i.x;else{let e=-1,t=-1;const s=this.m_segIter.getPathIndex(),n=this.m_multiPath.getPathStart(s),o=this.m_multiPath.getPathEnd(s);if(e=this.m_segIter.getStartPointIndex()-1,t=this.m_segIter.getEndPointIndex()+1,e<n&&(e=this.m_multiPath.isClosedPath(s)?o-1:-1),t>o-1&&(t=this.m_multiPath.isClosedPath(s)?n:-1),-1!==e){const t=this.m_multiPath.getXY(e);t.scale(this.m_bufferer.m_rpu),q(t,i)&&(i.x=t.x)}if(-1!==t){const e=this.m_multiPath.getXY(t);e.scale(this.m_bufferer.m_rpu),E(r,e)&&(r.x=e.x)}}this.m_densifiedPoints.length=0,R(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_curveType,r,i,this.m_bufferer.m_segmentStep,Number.NaN,this.m_bufferer.m_radTolerance,this.m_startAzimuth,this.m_endAzimuth,this.m_densifiedPoints,this.m_currentDensifiedDelta),this.addJoinAndBufferLeftSide(t),n--}return i.setCoordsPoint2D(this.m_multiPath.getXY(this.m_segIter.getStartPointIndex())),i.scale(this.m_bufferer.m_rpu),this.m_currentBufferedDelta=ue(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,i,this.m_lastAzimuth+.5*Math.PI,this.m_lastAzimuth+1.5*Math.PI,this.m_bufferer.m_cornerStep,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,t),this.m_segIter.resetToVertex(e,s),this.m_segIter.nextSegment(),t}return this.m_bNextSegmentCannotJoin=!1,this.m_segIter.nextSegment(),e=this.m_bufferHelper.clone(),e}isSegmentBufferInCurrentGnomonic(e){return null!==this.m_gnomonic&&de(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,this.m_gnomonicCenterRad,this.m_minGnomonicRadius)}tryUpdateGnomonic(e){const t=new ee,s=new ee,n=[0];return ge(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,t,s,n)?(this.m_gnomonicCenterRad.setCoordsPoint2D(s),this.m_minGnomonicRadius=n[0],this.m_gnomonic=xe(this.m_bufferer.m_gcs,t),!0):(this.m_gnomonic=null,!1)}checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(e,t){return this.m_bufferer.checkAndPrepSegmentForCrossingAzimuthsOrPoleWrap(this.m_densifiedPoints,e,this.m_startAzimuth[0],this.m_endAzimuth[0],this.m_bRunningInGnomonic,t)}addJoinAndBufferLeftSide(e){const t=this.m_densifiedPoints[0];let s=Number.NaN,n=this.m_startAzimuth[0]-se;const i=this.m_endAzimuth[0]+se;let r=!1;if(!Number.isNaN(this.m_lastAzimuth)){this.m_lastAzimuth>=this.m_startAzimuth[0]?(s=this.m_lastAzimuth+se,n=s+Math.PI-(this.m_lastAzimuth-this.m_startAzimuth[0])):(s=this.m_lastAzimuth+se,n=s+Math.PI-(ne-(this.m_startAzimuth[0]-this.m_lastAzimuth))),r=!(this.m_lastAzimuth>=this.m_startAzimuth[0]&&this.m_lastAzimuth-this.m_startAzimuth[0]<=Math.PI)&&!(this.m_lastAzimuth<this.m_startAzimuth[0]&&this.m_startAzimuth[0]-this.m_lastAzimuth>=Math.PI);let i=!1;if(Math.abs(n-s)<=.5*this.m_bufferer.m_cornerStep&&(r||(i=!0)),i){if(e.removePointFromPath(0,e.getPointCount()-1),!this.m_bRunningInGnomonic){const t=new ee;t.setCoordsPoint2D(e.getXY(e.getPointCount()-1)),t.scale(this.m_bufferer.m_rpu),t.x-this.m_currentBufferedDelta<-Math.PI?this.m_currentBufferedDelta-=ne:t.x-this.m_currentBufferedDelta>Math.PI&&(this.m_currentBufferedDelta+=ne)}n=.5*(n+s)}else if(r){const s=new ee;s.setCoordsPoint2D(t),s.scale(1/this.m_bufferer.m_rpu),e.insertPoint2D(0,-1,s)}else ue(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,this.m_densifiedPoints[0],s,n,this.m_bufferer.m_cornerStep,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,e)}this.m_startAzimuth[0]!==this.m_lastAzimuth&&this.m_numWinds++,ce(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,this.m_bufferer.m_absDistance,this.m_bufferer.m_curveType,this.m_densifiedPoints,n,i,this.m_bRunningInGnomonic,this.m_currentBufferedDelta,e),this.m_lastAzimuth=this.m_endAzimuth[0]}}class Ce extends be{constructor(e,t){super(e.m_progressTracker),this.m_pointIndex=-1,this.m_bufferer=e,this.m_multiPoint=t,this.m_bNeedsSimplify=!1;const s=new _;this.m_multiPoint.queryEnvelope(s);const n=s.getCenter(),i=n.clone();i.scale(this.m_bufferer.m_rpu),this.m_gnomonic=xe(this.m_bufferer.m_gcs,n),this.m_gnomonicCenterRad=i.clone(),this.m_minGnomonicRadius=A(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,i,75/180*Math.PI)}next(){if(this.m_bNeedsSimplify=!1,++this.m_pointIndex===this.m_multiPoint.getPointCount())return null;const e=this.m_multiPoint.getXY(this.m_pointIndex);e.scale(this.m_bufferer.m_rpu),this.m_bRunningInGnomonic=this.isPointBufferInCurrentGnomonic(e),this.m_bRunningInGnomonic||(this.m_bRunningInGnomonic=this.tryUpdateGnomonic(e));const t=new O,s=this.m_bufferer.bufferPoint2D(e,this.m_bRunningInGnomonic,t);return this.m_bNeedsSimplify=s,t}isPointBufferInCurrentGnomonic(e){return null!==this.m_gnomonic&&pe(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,this.m_gnomonicCenterRad,this.m_minGnomonicRadius)}tryUpdateGnomonic(e){const t=new ee,s=new ee,n=[0];return Pe(this.m_bufferer.m_a,this.m_bufferer.m_eSquared,this.m_bufferer.m_rpu,e,this.m_bufferer.m_absDistance*this.m_bufferer.m_ellipticToGeodesicMaxRatio,t,s,n)?(this.m_gnomonicCenterRad.setCoordsPoint2D(s),this.m_minGnomonicRadius=n[0],this.m_gnomonic=xe(this.m_bufferer.m_gcs,t),!0):(this.m_gnomonic=null,!1)}}class ve{getOperatorType(){return 10110}supportsCurves(){return!0}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}executeMany(e,t,s,n,i,r,o,m){if(o){const o=new Se(e,t,s,n,i,!1,r,m);return(new f).executeMany(o,t,m)}return new Se(e,t,s,n,i,!1,r,m)}execute(t,n,i,r,o,m,a){const h=new e([t]),c=[r],u=this.executeMany(h,n,i,c,o,!1,m,a).next();return u||s("geodesic buffer null output"),u}}class Se extends t{constructor(e,t,s,r,o,m,a,h){super(),this.m_currentUnionEnvelope2D=new _,this.m_index=-1,this.m_dindex=-1,this.m_progressTracker=h,m&&n(""),t||i("");0===t.getCoordinateSystemType()&&i(""),this.m_inputGeoms=e,this.m_spatialReference=t,this.m_curveType=s,this.m_distances=r,this.m_convergenceOffset=o,this.m_bOutlineOnly=m,this.m_bUnion=a}next(){let e;for(;e=this.m_inputGeoms.next();)return r(e),this.m_index=this.m_inputGeoms.getGeometryID(),this.m_dindex+1<this.m_distances.length&&this.m_dindex++,this.geodesicBuffer(e,this.m_distances[this.m_dindex]);return null}getGeometryID(){return this.m_index}tock(){return!0}getRank(){return 1}geodesicBuffer(e,t){return me(e,this.m_spatialReference,this.m_curveType,t,this.m_convergenceOffset,this.m_progressTracker)}}export{ve as OperatorGeodesicBuffer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{a as e,c as t,G as i,d as s,g as n}from"./Geometry.js";import{a,x as _,L as r}from"./MultiPathImpl.js";import{O as h}from"./OperatorDensify.js";import{g as o,L as m,F as l,aj as p,O as u,aG as c,v as g,o as d,ag as E,am as f,aY as P,aZ as S,a7 as A,ab as x,a8 as y,a_ as R,aa as M,ad as C}from"./UnitFactory.js";import{P as T,K as w,d as N,k as q,o as b,a as I,E as v,n as $,f as z,c as O,x as D,y as G,z as L}from"./Point2D.js";import{Envelope2D as k}from"./Envelope2D.js";import{c as F,d as J}from"./Envelope.js";import{O as Y}from"./OperatorClip.js";import{O as U}from"./OperatorShapePreservingLength.js";import{__addDisposableResource as X,__disposeResources as j}from"tslib";import{T as B}from"./Transformation2D.js";import{a as H}from"./GeodeticDistanceCalculator-Ce-woMPw.js";class Q{constructor(e,t,i,s,n=100){this.m_startPt=e.clone(),this.m_endPt=t.clone(),this.m_cE2=s,this.m_cE=Math.sqrt(this.m_cE2),this.m_c1By2e=1/(2*this.m_cE),this.m_cRpu=i.getGCS().getUnit().getUnitToBaseFactor(),this.isPcs=2===i.getCoordinateSystemType(),this.PEProjcs=i.getPECoordSys(),this.m_points=N(2*n,Number.NaN)}setSegmentEndPoints(e,t){this.m_startPt.assign(e),this.m_endPt.assign(t)}makeFunctor(){return e=>{const t=[0,0];t[0]=this.m_startPt.x*(1-e)+this.m_endPt.x*e,t[1]=this.m_startPt.y*(1-e)+this.m_endPt.y*e,this.isPcs&&p.projToGeogCenter(this.PEProjcs,1,t,0);const i=Math.sin(t[1]*this.m_cRpu);if(0===this.m_cE2)return i;return-Math.log((1-this.m_cE*i)/(1+this.m_cE*i))*this.m_c1By2e+i/(1-this.m_cE2*i*i)}}}function V(e,t,i){const s=new k;e.queryEnvelope(s);const n=F(t,s,!0).total(),a=t.getPannableExtent();a.xmin=s.xmin-10*n,a.xmax=s.xmax+10*n;const r=(new Y).execute(e,a,t,i).getImpl().querySegmentIterator();r.stripAttributes();const h=l();t.querySpheroidData(h);const o=h.e2,m=0===o?2:1,p=new T(0,0),u=new T(0,0),c=new w(0),g=new Q(p,u,t,o,100);for(;r.nextPath();)for(;r.hasNextSegment();){const e=r.nextSegment();p.assign(e.getStartXY()),u.assign(e.getEndXY()),g.setSegmentEndPoints(p,u);const t=_(6,0,1,1e-12,1e-15,g.makeFunctor());c.pe((u.x-p.x)*t)}const d=h.majorSemiAxis;return m*d*d*(1-o)*Math.PI*c.getResult()/t.getPannableExtent().width()}function Z(e,t,i,s,n){const a=se(e,t,n);let _=W(e,a.first,i,s,n),r=1,h=0,o=0;do{if(r++,a.first*=.5,a.first<50*t.getTolerance(0))return _;a.second*=2,o=W(e,a.first,i,s,n),h=Math.abs(o-_),_=o}while(Math.abs(_)>1&&h>1e-8*Math.abs(_)&&(a.second<65e3&&r<8||r<4));return o}function W(e,t,i,s,n){const a=(new h).execute(e,t,0,0,n);let _;_=s?(new u).execute(a,s,n):a;const r=1===i.getUnit().getUnitToBaseFactor()?Math.PI/180:1,o=new k;_.queryEnvelope(o);const m=new k,l=new k,p=new k;m.setCoords({xmin:o.xmin,ymin:75*r,xmax:o.xmax,ymax:90*r}),l.setCoords({xmin:o.xmin,ymin:-60*r,xmax:o.xmax,ymax:75*r}),p.setCoords({xmin:o.xmin,ymin:-90*r,xmax:o.xmax,ymax:-60*r}),m.inflateCoords(.01*m.width(),0),l.inflateCoords(.01*l.width(),0),p.inflateCoords(.01*p.width(),0);let c=0;return c+=K(_,m,i,n),c+=K(_,l,i,n),c+=K(_,p,i,n),c}function K(e,t,i,s){const n=(new Y).execute(e,t,i,s);if(null!==n&&!n.isEmpty()){const e=new k;n.queryEnvelope(e);const{first:t,second:a}=ie(i,e,!1),_=o(i,t,null),r=(new u).execute(n,_,s).calculateArea2D();return a&&t.destroy(),r}return 0}const ee=[null,null,null,null,null,null,null];function te(e,t,i){const a=e.getUnit().getUnitToBaseFactor(),_=t.getCenter();_.scale(180*a/Math.PI);const r=new T;r.x=0,r.y=0;let h=0;if(0===h){_.y>45?(r.y=b,h=0):_.y<-45?(r.y=-b,h=1):_.x>=45&&_.x<135?(r.x=b,h=2):_.x>=135||_.x<-135?(r.x=b,h=3):_.x<-45&&_.x>=-135?(r.x=-b,h=4):(r.x=0,h=5);const e=a*Math.sqrt(I(t.xmin-t.xmax)+I(t.ymin-t.ymax)),i=r.clone(),s=t.getCenter();s.scale(a),h<2&&(i.x=s.x);if(T.distance(i,s)+.5*e>b)return null}const o=ee[h];if(null!==o&&o.getGCS().equalHorizontal(e))return o;const m=e.getText(),l=r.x,p=r.y,u=0,E=0;let f=0,P=-1;6!==h?P=c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA:(n(i),f=0,P=c.PE_PRJ_CYLINDRICAL_EQAREA);const S=g("EqualAreaPCS");let A;P===c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA?A=`PROJCS["${S}",${m},PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${u}],PARAMETER["False_Northing",${E}],PARAMETER["Central_Meridian",${l}],PARAMETER["Latitude_of_Origin",${p}],UNIT["Meter",1.0]]`:P===c.PE_PRJ_CYLINDRICAL_EQAREA?A=`PROJCS["${S}",${m},PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting",${u}],PARAMETER["False_Northing",${E}],PARAMETER["Central_Meridian",${l}],PARAMETER["Standard_Parallel_1",${f}],PARAMETER["Latitude_of_Origin",${p}],UNIT["Meter",1.0]]`:s("getEqualAreaPcsFixed");const x=d(A);return ee[h]&&ee[h].destroy(),ee[h]=x,x}function ie(e,t,i){const n=te(e,t,i);if(null!==n)return q(n,!1);const a=e.getText(),_=e.getUnit().getUnitToBaseFactor(),r=(t.xmin+t.width()/2)*_,h=(t.ymin+t.height()/2)*_,o=0,m=0;let l=0,p=0,u=-1;t.ymin*_>=75*Math.PI/180||t.ymax*_<=-60*Math.PI/180?u=c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA:t.ymin>0||t.ymax<0?(l=(t.ymin+1/3*t.height())*_,p=(t.ymin+2/3*t.height())*_,u=c.PE_PRJ_ALBERS):(l=(t.ymin+2/3*t.height())*_,u=c.PE_PRJ_CYLINDRICAL_EQAREA);const E=g("EqualAreaPCS");let f;return u===c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA?f=`PROJCS["${E}",${a},PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:u===c.PE_PRJ_ALBERS?f=`PROJCS["${E}",${a},PROJECTION["Albers"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Standard_Parallel_1",${l}],PARAMETER["Standard_Parallel_2",${p}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:u===c.PE_PRJ_CYLINDRICAL_EQAREA?f=`PROJCS["${E}",${a},PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Standard_Parallel_1",${l}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:s("getEqualAreaPCSInstance"),q(d(f),!0)}function se(e,t,i){const s=e.calculateLength2D(),n=(new U).execute(e,t,i)/25e3,a=s/e.getSegmentCount()*2;let _=Math.min(a,s/n);0===_&&(_=1);return q(_,s/_)}class ne{getOperatorType(){return 10314}supportsCurves(){return!0}accelerateGeometry(e,t,i){return!1}canAccelerateGeometry(e){return!1}execute(s,n,_){if(0===n.getCoordinateSystemType()&&e(""),s.isEmpty()||s.getDimension()<2)return 0;if(t(s),s.getGeometryType()===i.enumEnvelope){const e=new a;return e.addEnvelope(s,!1),this.execute(e,n,_)}let r=s;s.getDescription().getAttributeCount()>1&&(r=s.clone(),r.dropAllAttributes());const l=(new h).execute(r,0,n.getTolerance(0),0,_);let p=null;const u=n.getGCS();u!==n&&(p=o(n,u));let c=(new m).execute(l,n,!1,_);return c.isEmpty()?0:(c===s&&(c=s.clone()),n.isPannable()?V(c,n,_):Z(c,n,u,p,_))}}function ae(){return{m_p_PCS:new T,m_factor:Number.NaN,setValues:_e,assign:re}}function _e(e,t){this.m_factor=e,this.m_p_PCS.assign(t)}function re(e){this.m_factor=e.m_factor,this.m_p_PCS.assign(e.m_p_PCS)}class he{constructor(e,t,i,s){this.m_ptStart=new J,this.m_ptEnd=new J,this.m_ptStart.assign(t),this.m_ptEnd.assign(i),this.m_deltaX=this.m_ptEnd.x-this.m_ptStart.x,this.m_deltaY=this.m_ptEnd.y-this.m_ptStart.y,this.m_e=Math.sqrt(e),this.m_e2=e,this.m_c1MinusE2=1-e;const n=Math.sin(s);let a;a=0===this.m_e2?2*n:n*(G(this.m_e*n)+1/(1-this.m_e2*n*n)),this.m_baseA=a}setSegmentEndPoints(e,t){this.m_ptStart.assign(e),this.m_ptEnd.assign(t),this.m_deltaX=this.m_ptEnd.x-this.m_ptStart.x,this.m_deltaY=this.m_ptEnd.y-this.m_ptStart.y}makeFunctor(){return e=>{const t=1-e,i=t*this.m_ptStart.x+e*this.m_ptEnd.x,s=t*this.m_ptStart.y+e*this.m_ptEnd.y,n=t*this.m_ptStart.z+e*this.m_ptEnd.z,a=i*i+s*s,_=n/Math.sqrt(n*n+this.m_c1MinusE2*this.m_c1MinusE2*a);let r;if(0===this.m_e2)r=2*_;else{r=_*(G(this.m_e*_)+1/(1-this.m_e2*_*_))}return(this.m_deltaY*i-this.m_deltaX*s)/a*(r-this.m_baseA)}}}function oe(){return{e:Number.NaN,one_p_e:Number.NaN,one_m_e:Number.NaN,one_m_e_2:Number.NaN,atanh_e_over_e:Number.NaN,half_qp:Number.NaN,f:Number.NaN,z:Number.NaN}}function me(){return{sin_phi:Number.NaN,one_p_sin_phi:Number.NaN,one_m_sin_phi:Number.NaN,one_m_e_2_sin_2_phi:Number.NaN,sin_half_phi_pf:Number.NaN,sin_half_phi_pz:Number.NaN,sin_half_asin_e_sin_phi_pf:Number.NaN,sin_half_asin_e_sin_phi_pz:Number.NaN,atanh_sin_phi:Number.NaN,atanh_esin_phi:Number.NaN,make_negative:!1,initialize:le,changeSign:pe,assign:ue,clone:ce}}function le(e,t,i,s){const n=.5*e;this.sin_phi=Math.sin(e);const a=t*this.sin_phi,_=.5*Math.asin(a);this.one_p_sin_phi=1+this.sin_phi,this.one_m_sin_phi=1-this.sin_phi,this.one_m_e_2_sin_2_phi=(1+a)*(1-a),this.sin_half_phi_pf=Math.sin(n+i),this.sin_half_phi_pz=Math.sin(n+s),this.sin_half_asin_e_sin_phi_pf=Math.sin(_+i),this.sin_half_asin_e_sin_phi_pz=Math.sin(_+s),this.atanh_sin_phi=Math.log(this.sin_half_phi_pf/this.sin_half_phi_pz),this.atanh_esin_phi=Math.log(this.sin_half_asin_e_sin_phi_pf/this.sin_half_asin_e_sin_phi_pz)}function pe(){this.sin_phi=-this.sin_phi;let e=this.one_p_sin_phi;this.one_p_sin_phi=this.one_m_sin_phi,this.one_m_sin_phi=e,e=this.sin_half_phi_pf,this.sin_half_phi_pf=this.sin_half_phi_pz,this.sin_half_phi_pz=e,e=this.sin_half_asin_e_sin_phi_pf,this.sin_half_asin_e_sin_phi_pf=this.sin_half_asin_e_sin_phi_pz,this.sin_half_asin_e_sin_phi_pz=e,this.atanh_sin_phi=-this.atanh_sin_phi,this.atanh_esin_phi=-this.atanh_esin_phi}function ue(e){this.sin_phi=e.sin_phi,this.one_p_sin_phi=e.one_p_sin_phi,this.one_m_sin_phi=e.one_m_sin_phi,this.one_m_e_2_sin_2_phi=e.one_m_e_2_sin_2_phi,this.sin_half_phi_pf=e.sin_half_phi_pf,this.sin_half_phi_pz=e.sin_half_phi_pz,this.sin_half_asin_e_sin_phi_pf=e.sin_half_asin_e_sin_phi_pf,this.sin_half_asin_e_sin_phi_pz=e.sin_half_asin_e_sin_phi_pz,this.atanh_sin_phi=e.atanh_sin_phi,this.atanh_esin_phi=e.atanh_esin_phi,this.make_negative=e.make_negative}function ce(){return{...this}}class ge{constructor(t,i,s){this.m_transformPCS2GCS=null,this.m_scaleToRadians=new B,this.m_scaleToDegrees=new B,this.m_progressTracker=s,n(4!==i),this.m_curveType=i,this.m_inputSR=t,t&&0!==t.getCoordinateSystemType()||e(""),this.m_inputGCS=t.getGCS(),this.m_a=0,this.m_eSquared=0,this.m_b=0,this.m_rpu=0}executePolygonGeodeticArea(e){let t,i=e.clone();if(i.dropAllAttributes(),e.hasNonLinearSegments()){i=(new h).execute(i,0,this.m_inputSR.getTolerance(0),0,this.m_progressTracker)}if(this.m_inputSR.isPannable()){const e=new k;i.queryEnvelope(e);const t=this.m_inputSR.getPannableExtent();if(!t.containsEnvelope(e)){const s=t.getCenterX()-e.getCenterX(),n=new B;n.setShiftCoords(s,0),i.applyTransformation(n),e.move(s,0);const a=new v;t.queryIntervalX(a);const _=new v;e.queryIntervalX(_),i=a.contains(_)?E(i,this.m_inputSR):(new u).foldInto360RangeGeodetic(i,this.m_inputSR,this.m_curveType)}}if(this.m_transformPCS2GCS?(i=(new m).execute(i,this.m_inputSR,!1,this.m_progressTracker),t=i.createInstance(),f(this.m_transformPCS2GCS,i,t,this.m_progressTracker)||(t=(new u).execute(i,this.m_transformPCS2GCS,this.m_progressTracker))):t=(new m).execute(i,this.m_inputGCS,!1,this.m_progressTracker),t.isEmpty())return 0;if(1===this.m_curveType){const e=l();return this.m_inputGCS.querySpheroidData(e),this.m_a=e.majorSemiAxis,this.m_eSquared=e.e2,this.loxodromeArea(t)}const s=t.getImpl();this.m_rpu=this.m_inputGCS.getUnit().getUnitToBaseFactor(),this.m_scaleToRadians.setScale(this.m_rpu),s.applyTransformation(this.m_scaleToRadians),this.m_scaleToDegrees=this.m_scaleToRadians,this.m_scaleToDegrees.invertThis();const n=l();if(this.m_inputGCS.querySpheroidData(n),this.m_a=n.majorSemiAxis,this.m_b=n.minorSemiAxis,this.m_eSquared=n.e2,2===this.m_curveType)return this.executeClippedPolygonGreatEllipticArea(t);{const e={stack:[],error:void 0,hasError:!1};try{const i=P.unit(9101),s=this.m_inputGCS.getPECoordSys(),n=X(e,s.cloneAlterUnits(i),!1);let a,_,r=this.executeClippedPolygonGeodeticArea(t,n,0),h=0;do{h++,a=this.executeClippedPolygonGeodeticArea(t,n,h),_=Math.abs(a-r),r=a}while(Math.abs(a)>1&&_>1e-8*Math.abs(a)&&h<7);return a}catch(a){e.error=a,e.hasError=!0}finally{j(e)}}}executeClippedPolygonGeodeticArea(e,t,i){const s={stack:[],error:void 0,hasError:!1};try{const n=new k;e.queryEnvelope(n);const a=X(s,this.getEqualAreaPCSInstance(t,n),!1),_=e.clone();S(a,_);const r=50,h=_.getImpl().getAttributeStreamRef(0),o=e.getImpl().getAttributeStreamRef(0),m=X(s,new A,!1),l=X(s,new A,!1),u=40,c=[0,0],g=$(ae,u),d=N(u,-1),E=ae(),f=ae();let P,y;const R=a;let M=_.calculateArea2D();const C=new w(0),q=.5*Math.PI,b=1e-10*Math.abs(M)+1e-6,I=e.getPathCount();let v,O,D,G;const L=new T,F=new T,J=new T,Y=new T,U=new T,j=new T;let B,H;for(O=e.getPathStart(0),v=0;v<I;v++,O=D)for(D=e.getPathEnd(v),h.queryPoint2D(D-1<<1,J),o.queryPoint2D(D-1<<1,L),Math.abs(L.y)>q&&(L.y=z(q,L.y)),G=O;G<D;G++,J.assign(Y),L.assign(F)){if(h.queryPoint2D(G<<1,Y),o.queryPoint2D(G<<1,F),Math.abs(F.y)>q&&(F.y=z(q,F.y)),B=T.distance(J,Y),B<r||0===L.y&&0===F.y)continue;x.geodeticDistance(this.m_a,this.m_eSquared,L.x,L.y,F.x,F.y,m,l,null,this.m_curveType);const e=m.val,t=l.val;for(E.setValues(0,J),f.setValues(1,Y),y=i,g[0].assign(f),d[0]=i,P=0;P>=0;){H=.5*(E.m_factor+f.m_factor),x.geodeticCoordinate(this.m_a,this.m_eSquared,L.x,L.y,e*H,t,m,l,this.m_curveType),U.x=m.val,U.y=l.val,c[0]=U.x,c[1]=U.y,p.geogToProj(R,1,c),j.x=c[0],j.y=c[1];const i=-j.offset(E.m_p_PCS,f.m_p_PCS),s=.5*i*T.distance(E.m_p_PCS,f.m_p_PCS);if(C.pe(s),Math.abs(s)>b||Math.abs(s)>0&&y>0)f.setValues(H,j),P++,g[P].assign(f),Math.abs(s)<=b?(y--,d[P-1]=y,d[P]=y):(y=d[P-1],d[P]=y);else{if(P<=0)break;E.assign(f),P--,f.assign(g[P]),y=d[P]}}}return M+=C.getResult(),Math.abs(M)}catch(n){s.error=n,s.hasError=!0}finally{j(s)}}executeClippedPolygonGreatEllipticArea(e){const t=[],i=[],s=new T,n=new T,a=y(1,this.m_eSquared,new T(0,.5*Math.PI)),_=new w(0),r=new w(0),h=new w(0),o=new J,m=new J,l=new k;e.queryLooseEnvelope(l);let p=0;l.containsCoords(l.xmin,0)||(p=Math.abs(l.ymin)<Math.abs(l.ymax)?l.ymin:l.ymax);const u=new he(this.m_eSquared,o,m,p),c=this.m_a*this.m_a,g=e.getImpl().querySegmentIterator();for(g.stripAttributes();g.nextPath();)for(;g.hasNextSegment();){const e=g.nextSegment();s.assign(e.getStartXY()),n.assign(e.getEndXY()),n.x-s.x>Math.PI?s.x+=2*Math.PI:n.x-s.x<-Math.PI&&(n.x+=2*Math.PI),this.splitSegmentCrossingItegralThreshold(e,t,i);for(let i of t)o.assign(y(this.m_a,this.m_eSquared,i.getStartXY())),m.assign(y(this.m_a,this.m_eSquared,i.getEndXY())),u.setSegmentEndPoints(o,m),this.adaptiveIntegrationWithRomberg(u,_);for(let t of i){let e=t.getStartXY(),i=t.getEndXY(),s=p;e.y<0&&(i=O(e,e=i),e.y=-e.y,i.y=-i.y,s=-s);const n=y(1,this.m_eSquared,e),_=y(1,this.m_eSquared,i),o=Math.min(e.y,i.y),m=R(this.m_eSquared,e.x,i.x,s,o);r.pe(m);const l=Math.abs(R(this.m_eSquared,e.x,i.x,o,b)),u=new J;u.setSub(n,a);const g=new J;g.setSub(_,a);const d=new J;d.setCrossProductVector(u,g);let E=c*(l-.5*d.length());E=z(E,i.x-e.x),h.pe(E)}t.length=0,i.length=0}return h.getResult()+c*(.5*(1-this.m_eSquared)*_.getResult()+r.getResult())}getEqualAreaPCSInstance(e,t){const i=t.getCenterX(),s=0,n=0;let a,_;const r=t.height();let h,o;(h=t.ymin>45*Math.PI/180||t.ymax<45*-Math.PI/180)?a=z(.5*Math.PI,t.getCenterY()):(a=t.getCenterY(),_=t.ymin+r*(2/3));const m=g("EqualAreaPCS"),l=e.toString();return o=h?P.fromString(c.PE_TYPE_PROJCS,`PROJCS["${m}", ${l}, PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${s}],PARAMETER["False_Northing", ${n}],PARAMETER["Central_Meridian", ${i}], PARAMETER["Latitude_of_Origin", ${a}], UNIT["Meter",1.0]]`):P.fromString(c.PE_TYPE_PROJCS,`PROJCS["${m}", ${l}, PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting", ${s}],PARAMETER["False_Northing", ${n}],PARAMETER["Central_Meridian", ${i}],PARAMETER["Standard_Parallel_1", ${_}],PARAMETER["Latitude_of_Origin", ${a}],UNIT["Meter",1.0]]`),o}splitSegmentCrossingItegralThreshold(e,t,i){const s=100,n=20,a=n*n,_=y(this.m_a,this.m_eSquared,new T(0,b)),h=y(this.m_a,this.m_eSquared,new T(0,-b)),o=this.splitSegmentPassingThroughPole(e);for(let m of o){const e=m.getStartXY(),o=m.getEndXY(),l=y(this.m_a,this.m_eSquared,e),p=y(this.m_a,this.m_eSquared,o),u=new T,c=new J;let g=J.sqrDistance(_,l),d=J.sqrDistance(l,p);if(g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(l.add(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:e,end:u})),e.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),g=J.sqrDistance(_,p),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(p.sub(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:u,end:o})),o.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),p.assign(y(this.m_a,this.m_eSquared,o)),g=J.sqrDistance(h,l),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(l.add(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:e,end:u})),e.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),p.assign(y(this.m_a,this.m_eSquared,o)),g=J.sqrDistance(h,p),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(p.sub(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:u,end:o})),o.assign(u)}t.push(new r({start:e,end:o}))}}splitSegmentPassingThroughPole(e){const t={stack:[],error:void 0,hasError:!1};try{const i=[],s=new J,n=new J,a=new J,_=new T,h=20,o=3.124139361,m=10,l=e.getStartXY(),p=e.getEndXY(),u=X(t,new A,!1);if(x.geodeticDistance(this.m_a,this.m_eSquared,l.x,l.y,p.x,p.y,u,null,null,2),Math.abs(p.x-l.x)>o&&u.val>h){const e=new H(new T(0,90),l.divide(this.m_rpu),p.divide(this.m_rpu),this.m_inputGCS,2,2);let t=C(e.makeFunctor(),0,1,1e-10);if(t.second<=m&&t.first>0&&t.first<1)return s.assign(y(this.m_a,this.m_eSquared,l)),n.assign(y(this.m_a,this.m_eSquared,p)),D(s,n,t.first,a),_.assign(M(this.m_a,this.m_eSquared,a)),i.push(new r({start:l,end:_})),i.push(new r({start:_,end:p})),i;if(e.setPointDistFrom(new T(0,-90)),t=C(e.makeFunctor(),0,1,1e-10),t.second<=m&&t.first>0&&t.first<1)return s.assign(y(this.m_a,this.m_eSquared,l)),n.assign(y(this.m_a,this.m_eSquared,p)),D(s,n,t.first,a),_.assign(M(this.m_a,this.m_eSquared,a)),i.push(new r({start:l,end:_})),i.push(new r({start:_,end:p})),i}return i.push(new r({start:l,end:p})),i}catch(i){t.error=i,t.hasError=!0}finally{j(t)}}adaptiveIntegrationWithRomberg(e,t){const i=e.makeFunctor();let s=0,n=1,a=i(s),r=i(n);const h=1e-17,o=1e-14;let m=(s+n)/2,l=i(m),p=Math.abs(l-a),u=Math.abs(r-l),c=0;for(;c++<32&&(p/u<.1||u/p<.1);)p<u?(t.pe(_(5,s,m,o,h,i)),s=m,a=l):(t.pe(_(5,m,n,o,h,i)),n=m,r=l),m=(s+n)/2,l=Math.abs(i(m)),p=Math.abs(l-a),u=Math.abs(r-l);t.pe(_(5,s,n,o,h,i))}loxodromeAreaHemi(e,t,i,s,n){const a=i.clone(),_=n.clone();let r,h,o,m,l,p,u,c,g,d,E,f,P,S,A,x;return a.make_negative&&a.changeSign(),_.make_negative&&_.changeSign(),E=s-t,1===Math.abs(a.sin_phi)||1===Math.abs(_.sin_phi)?e.half_qp*E:a.sin_phi===_.sin_phi?(d=.5*e.one_m_e_2*a.sin_phi*(1/a.one_m_e_2_sin_2_phi+G(e.e*a.sin_phi))*E,d):(A=Math.log(_.sin_half_phi_pf*a.sin_half_phi_pz/(_.sin_half_phi_pz*a.sin_half_phi_pf)),x=Math.log(_.sin_half_asin_e_sin_phi_pf*a.sin_half_asin_e_sin_phi_pz/(_.sin_half_asin_e_sin_phi_pz*a.sin_half_asin_e_sin_phi_pf)),1===this.m_eSquared?(l=0,r=.5*(A+_.sin_phi/_.one_m_e_2_sin_2_phi-a.sin_phi/a.one_m_e_2_sin_2_phi),h=0):(l=-2*e.atanh_e_over_e*(Math.log(_.one_p_sin_phi/a.one_p_sin_phi)-e.e*x),r=(A-e.e*x)/e.one_m_e_2,h=(Math.log(_.one_m_e_2_sin_2_phi/a.one_m_e_2_sin_2_phi)+l/e.atanh_e_over_e)/e.one_m_e_2),o=-x*(a.atanh_esin_phi+_.atanh_esin_phi),m=1/a.one_m_e_2_sin_2_phi-1/_.one_m_e_2_sin_2_phi,p=L(_.one_m_sin_phi/e.one_p_e,e.e)-L(a.one_m_sin_phi/e.one_p_e,e.e),u=L(_.one_p_sin_phi/e.one_p_e,e.e)-L(a.one_p_sin_phi/e.one_p_e,e.e),c=L(a.one_m_sin_phi/-e.one_m_e,e.e)-L(_.one_m_sin_phi/-e.one_m_e,e.e),g=L(a.one_p_sin_phi/-e.one_m_e,e.e)-L(_.one_p_sin_phi/-e.one_m_e,e.e),d=.25/r*(h+o+m+l+.5*(p+u+c+g)),d+=e.half_qp,f=.5*e.one_m_e_2*a.sin_phi*(1/a.one_m_e_2_sin_2_phi+G(e.e*a.sin_phi)),P=.5*e.one_m_e_2*_.sin_phi*(1/_.one_m_e_2_sin_2_phi+G(e.e*_.sin_phi)),P<f&&(S=f,f=P,P=S),d<f&&(d=f),d>P&&(d=P),d*=E,d)}loxodromeArea(e){const t=Math.PI/180;let i=0;const s=oe(),n=me(),a=me();s.e=Math.sqrt(this.m_eSquared),s.one_p_e=1+s.e,s.one_m_e=1-s.e,s.one_m_e_2=1-this.m_eSquared,s.atanh_e_over_e=G(s.e),this.m_eSquared>=1?s.half_qp=1:s.half_qp=.5*(1+s.atanh_e_over_e*s.one_m_e_2),s.f=.25*Math.PI,s.z=.75*Math.PI,a.initialize(0,s.e,s.f,s.z);const _=e.getPathCount(),r=new T,h=new T,o=e.getImpl().getAttributeStreamRef(0);for(let m=0;m<_;m++){const _=e.getPathStart(m),l=e.getPathEnd(m);if(!(l-_<=1)){o.queryPoint2D(2*(l-1),r);for(let e=_;e<l;e++){o.queryPoint2D(2*e,h);const m=r.y*t,l=h.y*t;if(e===_?(n.initialize(m,s.e,s.f,s.z),n.make_negative=!1):n.assign(a),a.initialize(l,s.e,s.f,s.z),a.make_negative=!1,r.y*h.y<0){if(r.y>=90&&h.y<=-90||h.y>=90&&r.y<=-90)return Number.NaN;const e=me();e.initialize(0,s.e,s.f,s.z),e.make_negative=!1;const _=n.atanh_sin_phi-s.e*n.atanh_esin_phi,o=a.atanh_sin_phi-s.e*a.atanh_esin_phi,l=(o*r.x-_*h.x)/(o-_);m<0?(n.make_negative=!0,i-=this.loxodromeAreaHemi(s,r.x*t,n,l*t,e),n.make_negative=!1,i+=this.loxodromeAreaHemi(s,l*t,e,h.x*t,a)):(i+=this.loxodromeAreaHemi(s,r.x*t,n,l*t,e),a.make_negative=!0,i-=this.loxodromeAreaHemi(s,l*t,e,h.x*t,a),a.make_negative=!1)}else r.y>=0?i+=this.loxodromeAreaHemi(s,r.x*t,n,h.x*t,a):(n.make_negative=!0,a.make_negative=!0,i-=this.loxodromeAreaHemi(s,r.x*t,n,h.x*t,a),n.make_negative=!1,a.make_negative=!1);r.assign(h)}}}return this.m_a*i*this.m_a}calculate(e){if(e.isEmpty()||e.getDimension()<2)return 0;if(e.getGeometryType()===i.enumEnvelope){const t=new a;return t.addEnvelope(e,!1),this.calculate(t)}return this.m_inputSR!==this.m_inputGCS&&null===this.m_transformPCS2GCS&&(this.m_transformPCS2GCS=o(this.m_inputSR,this.m_inputGCS,null)),this.executePolygonGeodeticArea(e)}}class de{getOperatorType(){return 10311}supportsCurves(){return!0}accelerateGeometry(e,t,i){return!1}canAccelerateGeometry(e){return!1}execute(e,i,s,n){if(t(e),4===s)return(new ne).execute(e,i,n);return new ge(i,s,n).calculate(e)}}export{de as OperatorGeodeticArea};
|
|
5
|
+
import{a as e,c as t,G as i,d as s,g as n}from"./Geometry.js";import{a,x as _,L as r}from"./MultiPathImpl.js";import{O as h}from"./OperatorDensify.js";import{g as o,L as m,F as l,aj as p,O as u,aG as c,v as g,o as d,af as f,am as E,aY as P,aZ as S,a7 as A,a8 as x,a9 as y,a_ as R,ah as M,ac as C}from"./UnitFactory.js";import{P as T,K as w,d as N,k as q,o as b,a as I,E as v,n as $,f as z,c as O,x as D,y as G,z as L}from"./Point2D.js";import{Envelope2D as k}from"./Envelope2D.js";import{c as F,d as J}from"./Envelope.js";import{O as Y}from"./OperatorClip.js";import{O as U}from"./OperatorShapePreservingLength.js";import{__addDisposableResource as X,__disposeResources as j}from"tslib";import{T as B}from"./Transformation2D.js";import{a as H}from"./GeodeticDistanceCalculator-Ce-woMPw.js";class Q{constructor(e,t,i,s,n=100){this.m_startPt=e.clone(),this.m_endPt=t.clone(),this.m_cE2=s,this.m_cE=Math.sqrt(this.m_cE2),this.m_c1By2e=1/(2*this.m_cE),this.m_cRpu=i.getGCS().getUnit().getUnitToBaseFactor(),this.isPcs=2===i.getCoordinateSystemType(),this.PEProjcs=i.getPECoordSys(),this.m_points=N(2*n,Number.NaN)}setSegmentEndPoints(e,t){this.m_startPt.assign(e),this.m_endPt.assign(t)}makeFunctor(){return e=>{const t=[0,0];t[0]=this.m_startPt.x*(1-e)+this.m_endPt.x*e,t[1]=this.m_startPt.y*(1-e)+this.m_endPt.y*e,this.isPcs&&p.projToGeogCenter(this.PEProjcs,1,t,0);const i=Math.sin(t[1]*this.m_cRpu);if(0===this.m_cE2)return i;return-Math.log((1-this.m_cE*i)/(1+this.m_cE*i))*this.m_c1By2e+i/(1-this.m_cE2*i*i)}}}function V(e,t,i){const s=new k;e.queryEnvelope(s);const n=F(t,s,!0).total(),a=t.getPannableExtent();a.xmin=s.xmin-10*n,a.xmax=s.xmax+10*n;const r=(new Y).execute(e,a,t,i).getImpl().querySegmentIterator();r.stripAttributes();const h=l();t.querySpheroidData(h);const o=h.e2,m=0===o?2:1,p=new T(0,0),u=new T(0,0),c=new w(0),g=new Q(p,u,t,o,100);for(;r.nextPath();)for(;r.hasNextSegment();){const e=r.nextSegment();p.assign(e.getStartXY()),u.assign(e.getEndXY()),g.setSegmentEndPoints(p,u);const t=_(6,0,1,1e-12,1e-15,g.makeFunctor());c.pe((u.x-p.x)*t)}const d=h.majorSemiAxis;return m*d*d*(1-o)*Math.PI*c.getResult()/t.getPannableExtent().width()}function Z(e,t,i,s,n){const a=se(e,t,n);let _=W(e,a.first,i,s,n),r=1,h=0,o=0;do{if(r++,a.first*=.5,a.first<50*t.getTolerance(0))return _;a.second*=2,o=W(e,a.first,i,s,n),h=Math.abs(o-_),_=o}while(Math.abs(_)>1&&h>1e-8*Math.abs(_)&&(a.second<65e3&&r<8||r<4));return o}function W(e,t,i,s,n){const a=(new h).execute(e,t,0,0,n);let _;_=s?(new u).execute(a,s,n):a;const r=1===i.getUnit().getUnitToBaseFactor()?Math.PI/180:1,o=new k;_.queryEnvelope(o);const m=new k,l=new k,p=new k;m.setCoords({xmin:o.xmin,ymin:75*r,xmax:o.xmax,ymax:90*r}),l.setCoords({xmin:o.xmin,ymin:-60*r,xmax:o.xmax,ymax:75*r}),p.setCoords({xmin:o.xmin,ymin:-90*r,xmax:o.xmax,ymax:-60*r}),m.inflateCoords(.01*m.width(),0),l.inflateCoords(.01*l.width(),0),p.inflateCoords(.01*p.width(),0);let c=0;return c+=K(_,m,i,n),c+=K(_,l,i,n),c+=K(_,p,i,n),c}function K(e,t,i,s){const n=(new Y).execute(e,t,i,s);if(null!==n&&!n.isEmpty()){const e=new k;n.queryEnvelope(e);const{first:t,second:a}=ie(i,e,!1),_=o(i,t,null),r=(new u).execute(n,_,s).calculateArea2D();return a&&t.destroy(),r}return 0}const ee=[null,null,null,null,null,null,null];function te(e,t,i){const a=e.getUnit().getUnitToBaseFactor(),_=t.getCenter();_.scale(180*a/Math.PI);const r=new T;r.x=0,r.y=0;let h=0;if(0===h){_.y>45?(r.y=b,h=0):_.y<-45?(r.y=-b,h=1):_.x>=45&&_.x<135?(r.x=b,h=2):_.x>=135||_.x<-135?(r.x=b,h=3):_.x<-45&&_.x>=-135?(r.x=-b,h=4):(r.x=0,h=5);const e=a*Math.sqrt(I(t.xmin-t.xmax)+I(t.ymin-t.ymax)),i=r.clone(),s=t.getCenter();s.scale(a),h<2&&(i.x=s.x);if(T.distance(i,s)+.5*e>b)return null}const o=ee[h];if(null!==o&&o.getGCS().equalHorizontal(e))return o;const m=e.getText(),l=r.x,p=r.y,u=0,f=0;let E=0,P=-1;6!==h?P=c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA:(n(i),E=0,P=c.PE_PRJ_CYLINDRICAL_EQAREA);const S=g("EqualAreaPCS");let A;P===c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA?A=`PROJCS["${S}",${m},PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${u}],PARAMETER["False_Northing",${f}],PARAMETER["Central_Meridian",${l}],PARAMETER["Latitude_of_Origin",${p}],UNIT["Meter",1.0]]`:P===c.PE_PRJ_CYLINDRICAL_EQAREA?A=`PROJCS["${S}",${m},PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting",${u}],PARAMETER["False_Northing",${f}],PARAMETER["Central_Meridian",${l}],PARAMETER["Standard_Parallel_1",${E}],PARAMETER["Latitude_of_Origin",${p}],UNIT["Meter",1.0]]`:s("getEqualAreaPcsFixed");const x=d(A);return ee[h]&&ee[h].destroy(),ee[h]=x,x}function ie(e,t,i){const n=te(e,t,i);if(null!==n)return q(n,!1);const a=e.getText(),_=e.getUnit().getUnitToBaseFactor(),r=(t.xmin+t.width()/2)*_,h=(t.ymin+t.height()/2)*_,o=0,m=0;let l=0,p=0,u=-1;t.ymin*_>=75*Math.PI/180||t.ymax*_<=-60*Math.PI/180?u=c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA:t.ymin>0||t.ymax<0?(l=(t.ymin+1/3*t.height())*_,p=(t.ymin+2/3*t.height())*_,u=c.PE_PRJ_ALBERS):(l=(t.ymin+2/3*t.height())*_,u=c.PE_PRJ_CYLINDRICAL_EQAREA);const f=g("EqualAreaPCS");let E;return u===c.PE_PRJ_LAMBERT_AZIMUTHAL_EQAREA?E=`PROJCS["${f}",${a},PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:u===c.PE_PRJ_ALBERS?E=`PROJCS["${f}",${a},PROJECTION["Albers"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Standard_Parallel_1",${l}],PARAMETER["Standard_Parallel_2",${p}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:u===c.PE_PRJ_CYLINDRICAL_EQAREA?E=`PROJCS["${f}",${a},PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting",${o}],PARAMETER["False_Northing",${m}],PARAMETER["Central_Meridian",${r}],PARAMETER["Standard_Parallel_1",${l}],PARAMETER["Latitude_of_Origin",${h}],UNIT["Meter",1.0]]`:s("getEqualAreaPCSInstance"),q(d(E),!0)}function se(e,t,i){const s=e.calculateLength2D(),n=(new U).execute(e,t,i)/25e3,a=s/e.getSegmentCount()*2;let _=Math.min(a,s/n);0===_&&(_=1);return q(_,s/_)}class ne{getOperatorType(){return 10314}supportsCurves(){return!0}accelerateGeometry(e,t,i){return!1}canAccelerateGeometry(e){return!1}execute(s,n,_){if(0===n.getCoordinateSystemType()&&e(""),s.isEmpty()||s.getDimension()<2)return 0;if(t(s),s.getGeometryType()===i.enumEnvelope){const e=new a;return e.addEnvelope(s,!1),this.execute(e,n,_)}let r=s;s.getDescription().getAttributeCount()>1&&(r=s.clone(),r.dropAllAttributes());const l=(new h).execute(r,0,n.getTolerance(0),0,_);let p=null;const u=n.getGCS();u!==n&&(p=o(n,u));let c=(new m).execute(l,n,!1,_);return c.isEmpty()?0:(c===s&&(c=s.clone()),n.isPannable()?V(c,n,_):Z(c,n,u,p,_))}}function ae(){return{m_p_PCS:new T,m_factor:Number.NaN,setValues:_e,assign:re}}function _e(e,t){this.m_factor=e,this.m_p_PCS.assign(t)}function re(e){this.m_factor=e.m_factor,this.m_p_PCS.assign(e.m_p_PCS)}class he{constructor(e,t,i,s){this.m_ptStart=new J,this.m_ptEnd=new J,this.m_ptStart.assign(t),this.m_ptEnd.assign(i),this.m_deltaX=this.m_ptEnd.x-this.m_ptStart.x,this.m_deltaY=this.m_ptEnd.y-this.m_ptStart.y,this.m_e=Math.sqrt(e),this.m_e2=e,this.m_c1MinusE2=1-e;const n=Math.sin(s);let a;a=0===this.m_e2?2*n:n*(G(this.m_e*n)+1/(1-this.m_e2*n*n)),this.m_baseA=a}setSegmentEndPoints(e,t){this.m_ptStart.assign(e),this.m_ptEnd.assign(t),this.m_deltaX=this.m_ptEnd.x-this.m_ptStart.x,this.m_deltaY=this.m_ptEnd.y-this.m_ptStart.y}makeFunctor(){return e=>{const t=1-e,i=t*this.m_ptStart.x+e*this.m_ptEnd.x,s=t*this.m_ptStart.y+e*this.m_ptEnd.y,n=t*this.m_ptStart.z+e*this.m_ptEnd.z,a=i*i+s*s,_=n/Math.sqrt(n*n+this.m_c1MinusE2*this.m_c1MinusE2*a);let r;if(0===this.m_e2)r=2*_;else{r=_*(G(this.m_e*_)+1/(1-this.m_e2*_*_))}return(this.m_deltaY*i-this.m_deltaX*s)/a*(r-this.m_baseA)}}}function oe(){return{e:Number.NaN,one_p_e:Number.NaN,one_m_e:Number.NaN,one_m_e_2:Number.NaN,atanh_e_over_e:Number.NaN,half_qp:Number.NaN,f:Number.NaN,z:Number.NaN}}function me(){return{sin_phi:Number.NaN,one_p_sin_phi:Number.NaN,one_m_sin_phi:Number.NaN,one_m_e_2_sin_2_phi:Number.NaN,sin_half_phi_pf:Number.NaN,sin_half_phi_pz:Number.NaN,sin_half_asin_e_sin_phi_pf:Number.NaN,sin_half_asin_e_sin_phi_pz:Number.NaN,atanh_sin_phi:Number.NaN,atanh_esin_phi:Number.NaN,make_negative:!1,initialize:le,changeSign:pe,assign:ue,clone:ce}}function le(e,t,i,s){const n=.5*e;this.sin_phi=Math.sin(e);const a=t*this.sin_phi,_=.5*Math.asin(a);this.one_p_sin_phi=1+this.sin_phi,this.one_m_sin_phi=1-this.sin_phi,this.one_m_e_2_sin_2_phi=(1+a)*(1-a),this.sin_half_phi_pf=Math.sin(n+i),this.sin_half_phi_pz=Math.sin(n+s),this.sin_half_asin_e_sin_phi_pf=Math.sin(_+i),this.sin_half_asin_e_sin_phi_pz=Math.sin(_+s),this.atanh_sin_phi=Math.log(this.sin_half_phi_pf/this.sin_half_phi_pz),this.atanh_esin_phi=Math.log(this.sin_half_asin_e_sin_phi_pf/this.sin_half_asin_e_sin_phi_pz)}function pe(){this.sin_phi=-this.sin_phi;let e=this.one_p_sin_phi;this.one_p_sin_phi=this.one_m_sin_phi,this.one_m_sin_phi=e,e=this.sin_half_phi_pf,this.sin_half_phi_pf=this.sin_half_phi_pz,this.sin_half_phi_pz=e,e=this.sin_half_asin_e_sin_phi_pf,this.sin_half_asin_e_sin_phi_pf=this.sin_half_asin_e_sin_phi_pz,this.sin_half_asin_e_sin_phi_pz=e,this.atanh_sin_phi=-this.atanh_sin_phi,this.atanh_esin_phi=-this.atanh_esin_phi}function ue(e){this.sin_phi=e.sin_phi,this.one_p_sin_phi=e.one_p_sin_phi,this.one_m_sin_phi=e.one_m_sin_phi,this.one_m_e_2_sin_2_phi=e.one_m_e_2_sin_2_phi,this.sin_half_phi_pf=e.sin_half_phi_pf,this.sin_half_phi_pz=e.sin_half_phi_pz,this.sin_half_asin_e_sin_phi_pf=e.sin_half_asin_e_sin_phi_pf,this.sin_half_asin_e_sin_phi_pz=e.sin_half_asin_e_sin_phi_pz,this.atanh_sin_phi=e.atanh_sin_phi,this.atanh_esin_phi=e.atanh_esin_phi,this.make_negative=e.make_negative}function ce(){return{...this}}class ge{constructor(t,i,s){this.m_transformPCS2GCS=null,this.m_scaleToRadians=new B,this.m_scaleToDegrees=new B,this.m_progressTracker=s,n(4!==i),this.m_curveType=i,this.m_inputSR=t,t&&0!==t.getCoordinateSystemType()||e(""),this.m_inputGCS=t.getGCS(),this.m_a=0,this.m_eSquared=0,this.m_b=0,this.m_rpu=0}executePolygonGeodeticArea(e){let t,i=e.clone();if(i.dropAllAttributes(),e.hasNonLinearSegments()){i=(new h).execute(i,0,this.m_inputSR.getTolerance(0),0,this.m_progressTracker)}if(this.m_inputSR.isPannable()){const e=new k;i.queryEnvelope(e);const t=this.m_inputSR.getPannableExtent();if(!t.containsEnvelope(e)){const s=t.getCenterX()-e.getCenterX(),n=new B;n.setShiftCoords(s,0),i.applyTransformation(n),e.move(s,0);const a=new v;t.queryIntervalX(a);const _=new v;e.queryIntervalX(_),i=a.contains(_)?f(i,this.m_inputSR):(new u).foldInto360RangeGeodetic(i,this.m_inputSR,this.m_curveType)}}if(this.m_transformPCS2GCS?(i=(new m).execute(i,this.m_inputSR,!1,this.m_progressTracker),t=i.createInstance(),E(this.m_transformPCS2GCS,i,t,this.m_progressTracker)||(t=(new u).execute(i,this.m_transformPCS2GCS,this.m_progressTracker))):t=(new m).execute(i,this.m_inputGCS,!1,this.m_progressTracker),t.isEmpty())return 0;if(1===this.m_curveType){const e=l();return this.m_inputGCS.querySpheroidData(e),this.m_a=e.majorSemiAxis,this.m_eSquared=e.e2,this.loxodromeArea(t)}const s=t.getImpl();this.m_rpu=this.m_inputGCS.getUnit().getUnitToBaseFactor(),this.m_scaleToRadians.setScale(this.m_rpu),s.applyTransformation(this.m_scaleToRadians),this.m_scaleToDegrees=this.m_scaleToRadians,this.m_scaleToDegrees.invertThis();const n=l();if(this.m_inputGCS.querySpheroidData(n),this.m_a=n.majorSemiAxis,this.m_b=n.minorSemiAxis,this.m_eSquared=n.e2,2===this.m_curveType)return this.executeClippedPolygonGreatEllipticArea(t);{const e={stack:[],error:void 0,hasError:!1};try{const i=P.unit(9101),s=this.m_inputGCS.getPECoordSys(),n=X(e,s.cloneAlterUnits(i),!1);let a,_,r=this.executeClippedPolygonGeodeticArea(t,n,0),h=0;do{h++,a=this.executeClippedPolygonGeodeticArea(t,n,h),_=Math.abs(a-r),r=a}while(Math.abs(a)>1&&_>1e-8*Math.abs(a)&&h<7);return a}catch(a){e.error=a,e.hasError=!0}finally{j(e)}}}executeClippedPolygonGeodeticArea(e,t,i){const s={stack:[],error:void 0,hasError:!1};try{const n=new k;e.queryEnvelope(n);const a=X(s,this.getEqualAreaPCSInstance(t,n),!1),_=e.clone();S(a,_);const r=50,h=_.getImpl().getAttributeStreamRef(0),o=e.getImpl().getAttributeStreamRef(0),m=X(s,new A,!1),l=X(s,new A,!1),u=40,c=[0,0],g=$(ae,u),d=N(u,-1),f=ae(),E=ae();let P,y;const R=a;let M=_.calculateArea2D();const C=new w(0),q=.5*Math.PI,b=1e-10*Math.abs(M)+1e-6,I=e.getPathCount();let v,O,D,G;const L=new T,F=new T,J=new T,Y=new T,U=new T,j=new T;let B,H;for(O=e.getPathStart(0),v=0;v<I;v++,O=D)for(D=e.getPathEnd(v),h.queryPoint2D(D-1<<1,J),o.queryPoint2D(D-1<<1,L),Math.abs(L.y)>q&&(L.y=z(q,L.y)),G=O;G<D;G++,J.assign(Y),L.assign(F)){if(h.queryPoint2D(G<<1,Y),o.queryPoint2D(G<<1,F),Math.abs(F.y)>q&&(F.y=z(q,F.y)),B=T.distance(J,Y),B<r||0===L.y&&0===F.y)continue;x.geodeticDistance(this.m_a,this.m_eSquared,L.x,L.y,F.x,F.y,m,l,null,this.m_curveType);const e=m.val,t=l.val;for(f.setValues(0,J),E.setValues(1,Y),y=i,g[0].assign(E),d[0]=i,P=0;P>=0;){H=.5*(f.m_factor+E.m_factor),x.geodeticCoordinate(this.m_a,this.m_eSquared,L.x,L.y,e*H,t,m,l,this.m_curveType),U.x=m.val,U.y=l.val,c[0]=U.x,c[1]=U.y,p.geogToProj(R,1,c),j.x=c[0],j.y=c[1];const i=-j.offset(f.m_p_PCS,E.m_p_PCS),s=.5*i*T.distance(f.m_p_PCS,E.m_p_PCS);if(C.pe(s),Math.abs(s)>b||Math.abs(s)>0&&y>0)E.setValues(H,j),P++,g[P].assign(E),Math.abs(s)<=b?(y--,d[P-1]=y,d[P]=y):(y=d[P-1],d[P]=y);else{if(P<=0)break;f.assign(E),P--,E.assign(g[P]),y=d[P]}}}return M+=C.getResult(),Math.abs(M)}catch(n){s.error=n,s.hasError=!0}finally{j(s)}}executeClippedPolygonGreatEllipticArea(e){const t=[],i=[],s=new T,n=new T,a=y(1,this.m_eSquared,new T(0,.5*Math.PI)),_=new w(0),r=new w(0),h=new w(0),o=new J,m=new J,l=new k;e.queryLooseEnvelope(l);let p=0;l.containsCoords(l.xmin,0)||(p=Math.abs(l.ymin)<Math.abs(l.ymax)?l.ymin:l.ymax);const u=new he(this.m_eSquared,o,m,p),c=this.m_a*this.m_a,g=e.getImpl().querySegmentIterator();for(g.stripAttributes();g.nextPath();)for(;g.hasNextSegment();){const e=g.nextSegment();s.assign(e.getStartXY()),n.assign(e.getEndXY()),n.x-s.x>Math.PI?s.x+=2*Math.PI:n.x-s.x<-Math.PI&&(n.x+=2*Math.PI),this.splitSegmentCrossingItegralThreshold(e,t,i);for(let i of t)o.assign(y(this.m_a,this.m_eSquared,i.getStartXY())),m.assign(y(this.m_a,this.m_eSquared,i.getEndXY())),u.setSegmentEndPoints(o,m),this.adaptiveIntegrationWithRomberg(u,_);for(let t of i){let e=t.getStartXY(),i=t.getEndXY(),s=p;e.y<0&&(i=O(e,e=i),e.y=-e.y,i.y=-i.y,s=-s);const n=y(1,this.m_eSquared,e),_=y(1,this.m_eSquared,i),o=Math.min(e.y,i.y),m=R(this.m_eSquared,e.x,i.x,s,o);r.pe(m);const l=Math.abs(R(this.m_eSquared,e.x,i.x,o,b)),u=new J;u.setSub(n,a);const g=new J;g.setSub(_,a);const d=new J;d.setCrossProductVector(u,g);let f=c*(l-.5*d.length());f=z(f,i.x-e.x),h.pe(f)}t.length=0,i.length=0}return h.getResult()+c*(.5*(1-this.m_eSquared)*_.getResult()+r.getResult())}getEqualAreaPCSInstance(e,t){const i=t.getCenterX(),s=0,n=0;let a,_;const r=t.height();let h,o;(h=t.ymin>45*Math.PI/180||t.ymax<45*-Math.PI/180)?a=z(.5*Math.PI,t.getCenterY()):(a=t.getCenterY(),_=t.ymin+r*(2/3));const m=g("EqualAreaPCS"),l=e.toString();return o=h?P.fromString(c.PE_TYPE_PROJCS,`PROJCS["${m}", ${l}, PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["False_Easting",${s}],PARAMETER["False_Northing", ${n}],PARAMETER["Central_Meridian", ${i}], PARAMETER["Latitude_of_Origin", ${a}], UNIT["Meter",1.0]]`):P.fromString(c.PE_TYPE_PROJCS,`PROJCS["${m}", ${l}, PROJECTION["Cylindrical_Equal_Area"],PARAMETER["False_Easting", ${s}],PARAMETER["False_Northing", ${n}],PARAMETER["Central_Meridian", ${i}],PARAMETER["Standard_Parallel_1", ${_}],PARAMETER["Latitude_of_Origin", ${a}],UNIT["Meter",1.0]]`),o}splitSegmentCrossingItegralThreshold(e,t,i){const s=100,n=20,a=n*n,_=y(this.m_a,this.m_eSquared,new T(0,b)),h=y(this.m_a,this.m_eSquared,new T(0,-b)),o=this.splitSegmentPassingThroughPole(e);for(let m of o){const e=m.getStartXY(),o=m.getEndXY(),l=y(this.m_a,this.m_eSquared,e),p=y(this.m_a,this.m_eSquared,o),u=new T,c=new J;let g=J.sqrDistance(_,l),d=J.sqrDistance(l,p);if(g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(l.add(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:e,end:u})),e.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),g=J.sqrDistance(_,p),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(p.sub(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:u,end:o})),o.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),p.assign(y(this.m_a,this.m_eSquared,o)),g=J.sqrDistance(h,l),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(l.add(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:e,end:u})),e.assign(u)}if(l.assign(y(this.m_a,this.m_eSquared,e)),p.assign(y(this.m_a,this.m_eSquared,o)),g=J.sqrDistance(h,p),d=J.sqrDistance(l,p),g<=s){if(!(d>a)){i.push(new r({start:e,end:o}));continue}c.assign(p.sub(l)),c.normalizeThis(),c.assign(p.sub(c.mul(n))),u.assign(M(this.m_a,this.m_eSquared,c)),i.push(new r({start:u,end:o})),o.assign(u)}t.push(new r({start:e,end:o}))}}splitSegmentPassingThroughPole(e){const t={stack:[],error:void 0,hasError:!1};try{const i=[],s=new J,n=new J,a=new J,_=new T,h=20,o=3.124139361,m=10,l=e.getStartXY(),p=e.getEndXY(),u=X(t,new A,!1);if(x.geodeticDistance(this.m_a,this.m_eSquared,l.x,l.y,p.x,p.y,u,null,null,2),Math.abs(p.x-l.x)>o&&u.val>h){const e=new H(new T(0,90),l.divide(this.m_rpu),p.divide(this.m_rpu),this.m_inputGCS,2,2);let t=C(e.makeFunctor(),0,1,1e-10);if(t.second<=m&&t.first>0&&t.first<1)return s.assign(y(this.m_a,this.m_eSquared,l)),n.assign(y(this.m_a,this.m_eSquared,p)),D(s,n,t.first,a),_.assign(M(this.m_a,this.m_eSquared,a)),i.push(new r({start:l,end:_})),i.push(new r({start:_,end:p})),i;if(e.setPointDistFrom(new T(0,-90)),t=C(e.makeFunctor(),0,1,1e-10),t.second<=m&&t.first>0&&t.first<1)return s.assign(y(this.m_a,this.m_eSquared,l)),n.assign(y(this.m_a,this.m_eSquared,p)),D(s,n,t.first,a),_.assign(M(this.m_a,this.m_eSquared,a)),i.push(new r({start:l,end:_})),i.push(new r({start:_,end:p})),i}return i.push(new r({start:l,end:p})),i}catch(i){t.error=i,t.hasError=!0}finally{j(t)}}adaptiveIntegrationWithRomberg(e,t){const i=e.makeFunctor();let s=0,n=1,a=i(s),r=i(n);const h=1e-17,o=1e-14;let m=(s+n)/2,l=i(m),p=Math.abs(l-a),u=Math.abs(r-l),c=0;for(;c++<32&&(p/u<.1||u/p<.1);)p<u?(t.pe(_(5,s,m,o,h,i)),s=m,a=l):(t.pe(_(5,m,n,o,h,i)),n=m,r=l),m=(s+n)/2,l=Math.abs(i(m)),p=Math.abs(l-a),u=Math.abs(r-l);t.pe(_(5,s,n,o,h,i))}loxodromeAreaHemi(e,t,i,s,n){const a=i.clone(),_=n.clone();let r,h,o,m,l,p,u,c,g,d,f,E,P,S,A,x;return a.make_negative&&a.changeSign(),_.make_negative&&_.changeSign(),f=s-t,1===Math.abs(a.sin_phi)||1===Math.abs(_.sin_phi)?e.half_qp*f:a.sin_phi===_.sin_phi?(d=.5*e.one_m_e_2*a.sin_phi*(1/a.one_m_e_2_sin_2_phi+G(e.e*a.sin_phi))*f,d):(A=Math.log(_.sin_half_phi_pf*a.sin_half_phi_pz/(_.sin_half_phi_pz*a.sin_half_phi_pf)),x=Math.log(_.sin_half_asin_e_sin_phi_pf*a.sin_half_asin_e_sin_phi_pz/(_.sin_half_asin_e_sin_phi_pz*a.sin_half_asin_e_sin_phi_pf)),1===this.m_eSquared?(l=0,r=.5*(A+_.sin_phi/_.one_m_e_2_sin_2_phi-a.sin_phi/a.one_m_e_2_sin_2_phi),h=0):(l=-2*e.atanh_e_over_e*(Math.log(_.one_p_sin_phi/a.one_p_sin_phi)-e.e*x),r=(A-e.e*x)/e.one_m_e_2,h=(Math.log(_.one_m_e_2_sin_2_phi/a.one_m_e_2_sin_2_phi)+l/e.atanh_e_over_e)/e.one_m_e_2),o=-x*(a.atanh_esin_phi+_.atanh_esin_phi),m=1/a.one_m_e_2_sin_2_phi-1/_.one_m_e_2_sin_2_phi,p=L(_.one_m_sin_phi/e.one_p_e,e.e)-L(a.one_m_sin_phi/e.one_p_e,e.e),u=L(_.one_p_sin_phi/e.one_p_e,e.e)-L(a.one_p_sin_phi/e.one_p_e,e.e),c=L(a.one_m_sin_phi/-e.one_m_e,e.e)-L(_.one_m_sin_phi/-e.one_m_e,e.e),g=L(a.one_p_sin_phi/-e.one_m_e,e.e)-L(_.one_p_sin_phi/-e.one_m_e,e.e),d=.25/r*(h+o+m+l+.5*(p+u+c+g)),d+=e.half_qp,E=.5*e.one_m_e_2*a.sin_phi*(1/a.one_m_e_2_sin_2_phi+G(e.e*a.sin_phi)),P=.5*e.one_m_e_2*_.sin_phi*(1/_.one_m_e_2_sin_2_phi+G(e.e*_.sin_phi)),P<E&&(S=E,E=P,P=S),d<E&&(d=E),d>P&&(d=P),d*=f,d)}loxodromeArea(e){const t=Math.PI/180;let i=0;const s=oe(),n=me(),a=me();s.e=Math.sqrt(this.m_eSquared),s.one_p_e=1+s.e,s.one_m_e=1-s.e,s.one_m_e_2=1-this.m_eSquared,s.atanh_e_over_e=G(s.e),this.m_eSquared>=1?s.half_qp=1:s.half_qp=.5*(1+s.atanh_e_over_e*s.one_m_e_2),s.f=.25*Math.PI,s.z=.75*Math.PI,a.initialize(0,s.e,s.f,s.z);const _=e.getPathCount(),r=new T,h=new T,o=e.getImpl().getAttributeStreamRef(0);for(let m=0;m<_;m++){const _=e.getPathStart(m),l=e.getPathEnd(m);if(!(l-_<=1)){o.queryPoint2D(2*(l-1),r);for(let e=_;e<l;e++){o.queryPoint2D(2*e,h);const m=r.y*t,l=h.y*t;if(e===_?(n.initialize(m,s.e,s.f,s.z),n.make_negative=!1):n.assign(a),a.initialize(l,s.e,s.f,s.z),a.make_negative=!1,r.y*h.y<0){if(r.y>=90&&h.y<=-90||h.y>=90&&r.y<=-90)return Number.NaN;const e=me();e.initialize(0,s.e,s.f,s.z),e.make_negative=!1;const _=n.atanh_sin_phi-s.e*n.atanh_esin_phi,o=a.atanh_sin_phi-s.e*a.atanh_esin_phi,l=(o*r.x-_*h.x)/(o-_);m<0?(n.make_negative=!0,i-=this.loxodromeAreaHemi(s,r.x*t,n,l*t,e),n.make_negative=!1,i+=this.loxodromeAreaHemi(s,l*t,e,h.x*t,a)):(i+=this.loxodromeAreaHemi(s,r.x*t,n,l*t,e),a.make_negative=!0,i-=this.loxodromeAreaHemi(s,l*t,e,h.x*t,a),a.make_negative=!1)}else r.y>=0?i+=this.loxodromeAreaHemi(s,r.x*t,n,h.x*t,a):(n.make_negative=!0,a.make_negative=!0,i-=this.loxodromeAreaHemi(s,r.x*t,n,h.x*t,a),n.make_negative=!1,a.make_negative=!1);r.assign(h)}}}return this.m_a*i*this.m_a}calculate(e){if(e.isEmpty()||e.getDimension()<2)return 0;if(e.getGeometryType()===i.enumEnvelope){const t=new a;return t.addEnvelope(e,!1),this.calculate(t)}return this.m_inputSR!==this.m_inputGCS&&null===this.m_transformPCS2GCS&&(this.m_transformPCS2GCS=o(this.m_inputSR,this.m_inputGCS,null)),this.executePolygonGeodeticArea(e)}}class de{getOperatorType(){return 10311}supportsCurves(){return!0}accelerateGeometry(e,t,i){return!1}canAccelerateGeometry(e){return!1}execute(e,i,s,n){if(t(e),4===s)return(new ne).execute(e,i,n);return new ge(i,s,n).calculate(e)}}export{de as OperatorGeodeticArea};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{a as r,c as n,G as o,f as a}from"./Geometry.js";import{O as s}from"./OperatorShapePreservingLength.js";import{c as i,P as c}from"./MultiPathImpl.js";import{E as m}from"./Point2D.js";import{F as l,
|
|
5
|
+
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{a as r,c as n,G as o,f as a}from"./Geometry.js";import{O as s}from"./OperatorShapePreservingLength.js";import{c as i,P as c}from"./MultiPathImpl.js";import{E as m}from"./Point2D.js";import{F as l,af as u,al as g,am as p,O as y,a7 as f,a8 as x}from"./UnitFactory.js";import{O as h}from"./OperatorDensify.js";class S{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 s).execute(e,t,x);if(0===t.getCoordinateSystemType()&&r(""),n(e),e.isEmpty()||e.getDimension()<1)return 0;const S=t.getGCS(),P=l();S.querySpheroidData(P);const d=P.majorSemiAxis,E=P.e2,G=S.getUnit().getUnitToBaseFactor();let j;const v=e.getGeometryType();if(v===o.enumPolygon?j=e.getBoundary():v===o.enumEnvelope?j=i(e):a(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,x)}if(S!==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=p(r,j,n,x)?n:(new y).execute(j,r,x)}return this._ExecuteMultiPathGeodeticLength(j,f,d,E,G)}_ExecuteMultiPathGeodeticLength(r,n,o,a,s){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(s),i.scale(s),x.geodeticDistance(o,a,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{S as OperatorGeodeticLength};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{a as n,G as s,h as o,t as r,d as i,g as a}from"./Geometry.js";import{m as c,a as m,c as l}from"./SideCalculator2D-BNwb5gvz.js";import{a as u,b as g,S as f,s as y}from"./MultiPathImpl.js";import{P as S,d,c as N,m as x}from"./Point2D.js";import{P as h,d as p}from"./Envelope.js";import{G as A}from"./SimpleGeometryCursor.js";import{O as C,M as P,
|
|
5
|
+
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import{a as n,G as s,h as o,t as r,d as i,g as a}from"./Geometry.js";import{m as c,a as m,c as l}from"./SideCalculator2D-BNwb5gvz.js";import{a as u,b as g,S as f,s as y}from"./MultiPathImpl.js";import{P as S,d,c as N,m as x}from"./Point2D.js";import{P as h,d as p}from"./Envelope.js";import{G as A}from"./SimpleGeometryCursor.js";import{O as C,M as P,ad as w,F as E,a9 as _,az as T,aA as j,aB as G,ah as I,aC as D,aD as v,aE as b,a7 as R,a8 as U,aF as F,aG as q}from"./UnitFactory.js";import{O as B}from"./OperatorShapePreservingDensify.js";class M{getOperatorType(){return 10501}supportsCurves(){return!0}accelerateGeometry(e,t,n){return!1}canAccelerateGeometry(e){return!1}getNearestCoordinate(e,t,y,d,N,x){if(t.isNAN()&&n("NAN xy coordinates are not allowed"),e.isEmpty())return c();if(Number.isNaN(d)&&(d=0),d>=0||n("maxDeviationMeters"),0===e.getDimension())return this.getNearestVertex(e,t,y);const A=e.getGeometryType();if(A===s.enumGeometryCollection){const n=e;let s=c();for(let e=0,o=n.getGeometryCount();e<o;++e){const o=n.getGeometry(e),r=this.getNearestCoordinate(o,t,y,d,N,x);if(!r.isEmpty()){if(0===r.m_distance)return r;r.m_distance>=s.m_distance||(s=r,s.m_geometryIndex=e)}}return s}if(A===s.enumEnvelope){const n=new u;return n.addEnvelope(e,!1),this.getNearestCoordinate(n,t,y,d,N,x)}o(A)||r("Operation is not implemented for this geometry type");const D=e;if((N||x)&&A===s.enumPolygon){const n=()=>{const e=m(t,-1,0);return e.m_bRightSide=!0,e};if(y.isPannable()){const s=(new C).foldInto360Range(new h(t),y);if(s.isEmpty())return c();const o=(new C).foldInto360Range(e,y);if(o.isEmpty())return c();if((new P).execute(o,s,y,null)&&N)return n()}else{const e=(new C).clipToSpatialReference(new h(t),y,null,1);if(e.isEmpty())return c();const s=w(D,y,0,null);if(s.isEmpty())return c();if((new P).execute(s,e,y,null)&&N)return n()}}const v=y!==y.getGCS()?y.getSRToGCSTransform():null,b=new S;if(v?(new C).transform(v,[t],1,[b],!1):b.assign(t),b.isNAN())return c();const R=V(D,t,y,1);let U=R.m_distance;if(0===U)return R;Number.isNaN(U)?U=Number.POSITIVE_INFINITY:U*=1+1e-7;const F=y.getGCS(),q=F.getUnit().getUnitToBaseFactor(),M=b.clone();M.scale(q);const O=E();y.querySpheroidData(O);const k=_(O.majorSemiAxis,O.e2,M),L=T(O.majorSemiAxis,O.e2),z=new X(D.querySegmentIterator());0===d&&(d=.01);const H=O.majorSemiAxis*g(45),J=(new B).executeMany(z,y,H,d,0,null),K=[];let Q=-1;const W=new p,Z=new f;for(let n=J.next();null!==n;n=J.next()){if(n.isEmpty())continue;const t=J.getGeometryID(),s=e.getPathIndexFromPointIndex(t);e.isClosedPath(s)&&D.getPathEnd(s);const o=n;for(let e=0,n=o.getPathCount();e<n;++e){K.length=0;for(let t=o.getPathStart(e),r=o.getPathEnd(e);t<r;++t)K.push(o.getXY(t));if(v&&(new C).transform(v,K,K.length,K,!1),K.length>3){const e=Y(K,K.length,b,F,1);if(e.m_distance<U){U=e.m_distance,W.assign(_(O.majorSemiAxis,O.e2,e.m_coordinate.mul(q))),Q=t;let n=e.m_vertexIndex;n+1===K.length&&(n-=1),o.getSegmentBuffer(n,Z,!0)}}K.forEach(e=>e.mulThis(q));const n=_(O.majorSemiAxis,O.e2,K[0]),s=new p;for(let e=1,r=K.length;e<r;++e){const r=_(O.majorSemiAxis,O.e2,K[e]);if(j(L,k,n,r,s)<U){const{second:s}=G(O.majorSemiAxis,O.e2,k,n,r,2,null);if(s<=U){const s=new p,{second:i}=G(O.majorSemiAxis,O.e2,k,n,r,0,s);i<U&&(U=i,W.assign(s),Q=t,o.getSegmentBuffer(e-1,Z,!0))}}n.assign(r)}}}if(!Number.isFinite(U))return c();-1===Q&&n("");const $=I(O.majorSemiAxis,O.e2,W);$.divThis(q);const ee=$.clone(),te=y!==y.getGCS()?y.getGCSToSRTransform():null;te&&(new C).transform(te,[$],1,[ee],!1),ee.isNAN()&&i("closestPoint2DSr.isNAN()"),a(!Z.empty());const ne=Z.get().getClosestCoordinate(ee,!1);ee.assign(Z.get().getCoord2D(ne)),v?(new C).transform(v,[ee],1,[$],!1):$.assign(ee),a(!$.isNAN());const se=this.getNearestVertex(new h($),b,y.getGCS()),oe=m(ee,Q,se.m_distance);if(x&&e.getDimension()>0){const n=l(e,t,-1,-1),s=0!==n&&3!==n;oe.m_bRightSide=s}return oe}getNearestVertex(e,t,o){if(t.isNAN()&&n("NAN xy coordinates are not allowed"),e.isEmpty())return c();switch(e.getGeometryType()){case s.enumPoint:return O(e,t,o);case s.enumMultiPoint:case s.enumPolyline:case s.enumPolygon:return V(e,t,o);default:r("")}}getNearestVertexPoint2D(e,t,n,s){return Y(e,t,n,s)}getNearestVertices(e,t,o,i,a){if(t.isNAN()&&n("NAN xy coordinates are not allowed"),e.isEmpty())return[];switch(e.getGeometryType()){case s.enumPoint:{const n=O(e,t,o);if(!n.isEmpty()&&n.m_distance<i&&a>=1){const e=[];return e.push(n),e}return[]}case s.enumMultiPoint:case s.enumPolyline:case s.enumPolygon:return k(e,t,o,i,a);default:r("")}}}function O(s,o,r){const i={stack:[],error:void 0,hasError:!1};try{if(0===r.getCoordinateSystemType()&&n("Cannot use local SR"),1!==r.getCoordinateSystemType()){const e=new Array(2);e[0]=s.getXY(),e[1]=o.clone();const t=x(S,2);2!==F(r,e,2,t)&&n("Point cannot be projected to GCS");const i=r.getGCS(),a=O(new h(t[0]),t[1],i);return m(a.m_coordinate,0,a.m_distance)}const t=r.getUnit().getUnitToBaseFactor(),a=s.getXY();a.scale(t);const c=o.clone();c.scale(t);const l=E();r.querySpheroidData(l);const u=e(i,new R,!1);U.geodeticDistance(l.majorSemiAxis,l.e2,a.x,a.y,c.x,c.y,u,null,null,q.PE_LINETYPE_GEODESIC);const g=s.getXY();return m(g,0,u.val)}catch(a){i.error=a,i.hasError=!0}finally{t(i)}}function V(s,o,r,i=0){0===r.getCoordinateSystemType()&&n("Cannot use local SR");let a=s.getAttributeStreamRef(0),c=s.getPointCount();const l=r.getGCS(),u=o.clone();if(1!==r.getCoordinateSystemType()){const e=r.getSRToGCSTransform();if(D(e,[o],1,[u],null),u.isNAN())return m(S.getNAN(),-1,Number.NaN);const t=(new C).execute(s,e,null);a=t.getAttributeStreamRef(0),c=t.getPointCount()}const g=l.getUnit().getUnitToBaseFactor(),f=d(c,0);for(let e=0;e<c;++e)f[e]=e;y(c,f);const x=E();l.querySpheroidData(x);const h=u.clone();h.scale(g);const A=_(x.majorSemiAxis,x.e2,h);let P=-1,w=Number.MAX_VALUE;const T=v(x.majorSemiAxis,x.e2);let j=c;const G=new S,I=new S;for(let e=0;e<j;){if(a.queryPoint2D(2*f[e],G),G.isNAN())continue;I.assign(G),I.scale(g);const t=_(x.majorSemiAxis,x.e2,I);if(p.distance(t,A)>w){f[j-1]=N(f[e],f[e]=f[j-1]),j--;continue}const n=b(T,t,A);n<w&&(P=f[e],w=n),e++}if(0!==x.e2){const n={stack:[],error:void 0,hasError:!1};try{const t=e(n,new R,!1);for(let e=0;e<j;e++){if(a.queryPoint2D(2*f[e],G),G.isNAN())continue;I.assign(G),I.scale(g);const n=_(x.majorSemiAxis,x.e2,I);p.distance(n,A)>w||(U.geodeticDistance(x.majorSemiAxis,x.e2,h.x,h.y,I.x,I.y,t,null,null,i),t.val<w&&(P=f[e],w=t.val))}}catch(q){n.error=q,n.hasError=!0}finally{t(n)}}const F=new S;return-1!==P&&F.assign(s.getXY(P)),m(F,P,w)}function Y(s,o,r,i,a=0){0===i.getCoordinateSystemType()&&n("Cannot use local SR");const l=i.getGCS(),u=r.clone();if(1!==i.getCoordinateSystemType()){const e=i.getSRToGCSTransform();if(D(e,[r],1,[u],null),u.isNAN())return c();const t=x(S,o);D(e,s,o,t,null);const n=Y(t,o,r,l,a);return n.isEmpty()?n:m(s[n.m_vertexIndex],n.m_vertexIndex,n.m_distance)}const g=l.getUnit().getUnitToBaseFactor(),f=d(o,0);for(let e=0;e<o;++e)f[e]=e;y(o,f);const h=E();l.querySpheroidData(h);const A=u.clone();A.scale(g);const C=_(h.majorSemiAxis,h.e2,A);let P=-1,w=Number.MAX_VALUE;const T=v(h.majorSemiAxis,h.e2);let j=o;for(let e=0;e<j;){const t=s[f[e]];if(t.isNAN())continue;const n=t.clone();n.scale(g);const o=_(h.majorSemiAxis,h.e2,n);if(p.distance(o,C)>w){f[j-1]=N(f[e],f[e]=f[j-1]),j--;continue}const r=b(T,o,C);r<w&&(P=f[e],w=r),e++}if(0!==h.e2){const n={stack:[],error:void 0,hasError:!1};try{const t=e(n,new R,!1);for(let e=0;e<j;e++){const n=s[f[e]];if(n.isNAN())continue;const o=n.clone();o.scale(g);const r=_(h.majorSemiAxis,h.e2,o);p.distance(r,C)>w||(U.geodeticDistance(h.majorSemiAxis,h.e2,A.x,A.y,o.x,o.y,t,null,null,a),t.val<w&&(P=f[e],w=t.val))}}catch(I){n.error=I,n.hasError=!0}finally{t(n)}}const G=new S;return-1!==P&&G.assign(s[P]),m(G,P,w)}function k(s,o,r,i,a){const c={stack:[],error:void 0,hasError:!1};try{0===r.getCoordinateSystemType()&&n("Cannot use local SR");let t=s.getAttributeStreamRef(0),l=s.getPointCount();const u=r.getGCS(),g=o.clone();if(1!==r.getCoordinateSystemType()){const e=r.getSRToGCSTransform();if(D(e,[o],1,[g],null),g.isNAN())return[];const n=(new C).execute(s,e,null);t=n.getAttributeStreamRef(0),l=n.getPointCount()}const f=u.getUnit().getUnitToBaseFactor(),x=d(l,0);for(let e=0;e<l;++e)x[e]=e;y(l,x);const h=E();u.querySpheroidData(h);const A=g.clone();A.scale(f);const P=_(h.majorSemiAxis,h.e2,A),w=[];let T=l;const j=new S,G=new S;for(let e=0;e<T;){if(t.queryPoint2D(2*x[e],j),j.isNAN())continue;G.assign(j),G.scale(f);const n=_(h.majorSemiAxis,h.e2,G);p.distance(n,P)>i?(x[T-1]=N(x[e],x[e]=x[T-1]),T--):e++}const I=(e,t)=>e.m_distance-t.m_distance,v=e(c,new R,!1);for(let e=0;e<T;e++)t.queryPoint2D(2*x[e],j),j.isNAN()||(U.geodeticDistance(h.majorSemiAxis,h.e2,A.x,A.y,j.x*f,j.y*f,v,null,null,q.PE_LINETYPE_GEODESIC),v.val<i&&w.push(m(j,x[e],v.val)));return w.sort(I),w.slice(0,a)}catch(l){c.error=l,c.hasError=!0}finally{t(c)}}class X extends A{constructor(e){super(),this.m_first=!0,this.m_segIter=e,this.m_segIter.stripAttributes()}tock(){return!0}getRank(){return 1}next(){if(this.m_first){if(!this.m_segIter.nextPath())return null;this.m_first=!1}for(;;){if(this.m_segIter.hasNextSegment())return this.m_segIter.nextSegment().clone();if(!this.m_segIter.nextPath())break}return null}getGeometryID(){return this.m_segIter.getStartPointIndex()}}export{M as OperatorProximityGeodesic};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{a as e,G as t,f as s,d as n}from"./Geometry.js";import{aj as o,U as r,F as a,g as i,
|
|
5
|
+
import{a as e,G as t,f as s,d as n}from"./Geometry.js";import{aj as o,U as r,F as a,g as i,a9 as m}from"./UnitFactory.js";import{a as c,P as g}from"./MultiPathImpl.js";import{n as u,d as p,P as h}from"./Point2D.js";import{d as y}from"./Envelope.js";import{Envelope2D as l}from"./Envelope2D.js";import{O as f}from"./OperatorDensify.js";import{O as _}from"./OperatorClip.js";function x(){return{m_pGcs:new h,m_xyz:new y,m_factor:Number.NaN,m_geoLength:Number.NaN,setValues:d,setLength:P,assign:S}}function d(e,t,s,n){this.m_factor=e,this.m_pGcs.assign(t),this.m_xyz.assign(n),this.m_geoLength=s}function P(e){this.m_geoLength=e}function S(e){this.m_pGcs.assign(e.m_pGcs),this.m_xyz.assign(e.m_xyz),this.m_factor=e.m_factor,this.m_geoLength=e.m_geoLength}class w{getOperatorType(){return 10315}supportsCurves(){return!0}accelerateGeometry(e,t,s){return!1}canAccelerateGeometry(e){return!1}_ExecuteShapePreservingLength(e,t,s,n,a){if(e.hasNonLinearSegments()){e=(new f).execute(e,0,t.getTolerance(0),0,a)}if(t.isPannable()){let n=90,r=-90;if(1===s.getUnit().getUnitToBaseFactor()&&(n*=Math.PI/180,r*=Math.PI/180),2===t.getCoordinateSystemType()){let e=null;const s=[0,0,0,0];e=t.getPECoordSys(),s[0]=0,s[1]=n,s[2]=0,s[3]=r,o.geogToProj(e,2,s),n=s[1],r=s[3]}const i=new l;e.queryEnvelope(i),i.ymin=r,i.ymax=n,e=(new _).execute(e,i,t,a)}else{const s=t.getPCSHorizon();if((e=(new r).execute(e,s,t,a))===s){const t=e.clone();e=t}}return e.isEmpty()?0:this._ExecuteIterativeApproach(e,t,s,n,1,a)}_ExecuteIterativeApproach(e,t,s,r,i,m){const c=a();s.querySpheroidData(c);const g=c.majorSemiAxis,l=c.e2,f=s.getUnit().getUnitToBaseFactor(),_=40,d=u(x,_),P=p(_,Number.NaN),S=x(),w=x();let E;const G=[0,0,0,0],j=t.getPECoordSys(),L=new h,v=new h,T=new h,D=new h,b=new h;let z=0;const I=e.querySegmentIterator();for(;I.nextPath();)for(;I.hasNextSegment();){const e=I.nextSegment();L.assign(e.getStartXY()),v.assign(e.getEndXY()),2===t.getCoordinateSystemType()?(G[0]=L.x,G[1]=L.y,G[2]=v.x,G[3]=v.y,o.projToGeog(j,2,G),T.x=G[0]*f,T.y=G[1]*f,D.x=G[2]*f,D.y=G[3]*f):(T.setCoordsPoint2D(L),D.setCoordsPoint2D(v),T.scale(f),D.scale(f));const s=new y,r=new y;N(g,l,T,s),N(g,l,D,r);let a=C(g,s,r);S.setValues(0,T,Number.NaN,s),w.setValues(1,D,a,r),E=i,d[0].assign(w),P[0]=i;let m=0;for(;;){m>128&&n("iterations exceeded");const s=.5*(S.m_factor+w.m_factor),r=e.getCoord2D(s);2===t.getCoordinateSystemType()?(G[0]=r.x,G[1]=r.y,o.projToGeog(j,1,G),b.x=G[0]*f,b.y=G[1]*f):(b.setCoordsPoint2D(r),b.scale(f)),T.setCoordsPoint2D(S.m_pGcs),D.setCoordsPoint2D(w.m_pGcs);const c=new y;N(g,l,b,c);const u=C(g,S.m_xyz,c),p=C(g,w.m_xyz,c);a=w.m_geoLength,Number.isNaN(a)&&(a=C(g,S.m_xyz,w.m_xyz));const h=u+p,x=E===i&&h>=20&&Math.abs(h-a)>1e-8*(a+h);if(m+2<_&&(x||Math.abs(h-a)>0&&E>0))w.setLength(p),d[m].assign(w),w.setValues(s,b,u,c),d[++m].assign(w),x?(E=i,P[m]=i):(E--,P[m-1]=E,P[m]=E);else{if(z+=h,0===m)break;S.assign(w),w.assign(d[--m]),E=P[m]}}}return z}execute(n,o,r){if(o&&0!==o.getCoordinateSystemType()||e(""),n.isEmpty()||n.getDimension()<1)return 0;let a=null;const m=o.getGCS();m!==o&&(a=i(o,m,null));const u=n.getGeometryType();if(u===t.enumEnvelope){const e=new c;return e.addEnvelope(n,!1),this._ExecuteShapePreservingLength(e,o,m,a,r)}if(s(u)){const e=new g;return e.addSegment(n,!0),this._ExecuteShapePreservingLength(e,o,m,a,r)}return this._ExecuteShapePreservingLength(n,o,m,a,r)}}function N(e,t,s,n){n.assign(m(e,t,s))}function C(e,t,s){const n=e,o=new y;o.setSub(t,s);const r=o.length();return 2*n*Math.asin(r/(2*n))}export{w as O};
|