@arcgis/core 4.32.0-next.20250102 → 4.32.0-next.20250104
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/Color.js +1 -1
- package/PopupTemplate.js +1 -1
- package/arcade/functions/date.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/arcade/functions/featuresetstats.js +1 -1
- package/arcade/functions/featuresetstring.js +1 -1
- package/arcade/functions/geomasync.js +1 -1
- package/arcade/functions/geometry.js +1 -1
- package/arcade/functions/geomsync.js +1 -1
- package/arcade/functions/knowledgegraph.js +1 -1
- package/arcade/functions/string.js +1 -1
- package/arcade/geometry/extendedUnitData.js +5 -0
- package/arcade/geometry/functions.js +5 -0
- package/arcade/geometry/operators.js +5 -0
- package/arcade/geometry/unitConversion.js +5 -0
- package/arcade/geometry/wkt.js +5 -0
- package/arcade/languageUtils.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{e371f4f0eb3c22f222df.js → 005727711cca0614c2ab.js} +2 -2
- package/assets/esri/core/workers/chunks/{e371f4f0eb3c22f222df.js.LICENSE.txt → 005727711cca0614c2ab.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{2d908c115ea18e813b95.js → 00c0fbe19c12691cf2c3.js} +1 -1
- package/assets/esri/core/workers/chunks/08e28328385066c519c2.js +1 -0
- package/assets/esri/core/workers/chunks/{0e735d01296d340b393e.js → 0b95ec12218f3c04df18.js} +1 -1
- package/assets/esri/core/workers/chunks/{59bf879b4802a5ba431e.js → 0ee669947c23f469e357.js} +1 -1
- package/assets/esri/core/workers/chunks/116103ecec27cce47a2f.js +1 -0
- package/assets/esri/core/workers/chunks/11f00218905f0db447ff.js +1 -0
- package/assets/esri/core/workers/chunks/14b87f3dd9942e6b19d0.js +1 -0
- package/assets/esri/core/workers/chunks/16d7c07e1c11b88dae84.js +1 -0
- package/assets/esri/core/workers/chunks/1d04fe800cb98e4d6bc4.js +1 -0
- package/assets/esri/core/workers/chunks/{71f6e5742cf0c482066b.js → 1dc6b5b177022b80c473.js} +1 -1
- package/assets/esri/core/workers/chunks/{59455e2dd44b4c01cc76.js → 2586741c359057b3f626.js} +1 -1
- package/assets/esri/core/workers/chunks/{250a810dd4e1ff293564.js → 318a39b56851e707edad.js} +1 -1
- package/assets/esri/core/workers/chunks/{648d7d8fa19a2e772c89.js → 3582836342fa78873fe4.js} +1 -1
- package/assets/esri/core/workers/chunks/{b1e4813f0c73fc2a483c.js → 370b230fd2d7703d0698.js} +2 -2
- package/assets/esri/core/workers/chunks/{b1e4813f0c73fc2a483c.js.LICENSE.txt → 370b230fd2d7703d0698.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{ebf9caf2dc8af89afec2.js → 42aa697b4718b75b8cb2.js} +2 -2
- package/assets/esri/core/workers/chunks/{ebf9caf2dc8af89afec2.js.LICENSE.txt → 42aa697b4718b75b8cb2.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/44cc3ea8cec8ddd1e3ab.js +1 -0
- package/assets/esri/core/workers/chunks/{801dbea20966806db1c9.js → 53cd990b2c988518de6d.js} +1 -1
- package/assets/esri/core/workers/chunks/5a1eb0d1e25ff5574c43.js +1 -0
- package/assets/esri/core/workers/chunks/6157c49e7431f5868c77.js +1 -0
- package/assets/esri/core/workers/chunks/{eef2d94a73064f9bc085.js → 61d64f163840563017d5.js} +1 -1
- package/assets/esri/core/workers/chunks/6ed57d01be6bc054c7cd.js +1 -0
- package/assets/esri/core/workers/chunks/7254956381e823219db0.js +1 -0
- package/assets/esri/core/workers/chunks/740e6bdb3b76f2ea6d61.js +1 -0
- package/assets/esri/core/workers/chunks/756c2f7c8659deab6c96.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{56fc353421252f2d0a99.js → 75e8ba7e02647b7216ae.js} +1 -1
- package/assets/esri/core/workers/chunks/89d7eec47e5b29935d92.js +1 -0
- package/assets/esri/core/workers/chunks/8cd2c9ec1e541836b81c.js +1 -0
- package/assets/esri/core/workers/chunks/{0b3e1e903120da297641.js → 932375de79e3d33bc4d7.js} +1 -1
- package/assets/esri/core/workers/chunks/{263adfd1c2641ef5c0f5.js → 95f23bd17ce9e07fc8ef.js} +1 -1
- package/assets/esri/core/workers/chunks/{7de9c01849c4aa1940e7.js → 986889cea53c4a470347.js} +1 -1
- package/assets/esri/core/workers/chunks/{cc6160e8ab3cea4040c2.js → 9e9b2fd958e816b1b5f6.js} +1 -1
- package/assets/esri/core/workers/chunks/a57cead317eb2fc9afd8.js +1 -0
- package/assets/esri/core/workers/chunks/acec58a7f23b2cc938ee.js +1 -0
- package/assets/esri/core/workers/chunks/b0f4254d8a32dd713009.js +1 -0
- package/assets/esri/core/workers/chunks/b277b8c2f556918e4f9a.js +1 -0
- package/assets/esri/core/workers/chunks/{deffd56e39ce725ce377.js → b30046a40bcfbec8abe4.js} +1 -1
- package/assets/esri/core/workers/chunks/{5c11e2e65b97565e5003.js → b7db64b07edb0b37ece1.js} +1 -1
- package/assets/esri/core/workers/chunks/bd1fb82e8bac439d05ea.js +1 -0
- package/assets/esri/core/workers/chunks/bf0a0ca7fdac98f06a89.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/c44ce0302dc82fb66ada.js +1 -0
- package/assets/esri/core/workers/chunks/c52872a50a5989121388.js +1 -0
- package/assets/esri/core/workers/chunks/c8cd6ba5600d8ff8db0b.js +2 -0
- package/assets/esri/core/workers/chunks/{a100fb789d72410f8d4f.js.LICENSE.txt → c8cd6ba5600d8ff8db0b.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{57c1370b310768c0790a.js → ca1e186f136abb23ae4b.js} +1 -1
- package/assets/esri/core/workers/chunks/{d14e4fc82ad772899336.js → ca4a37bdc0f7fb705146.js} +1 -1
- package/assets/esri/core/workers/chunks/cb94fc9b0f613ad50b3f.js +1 -0
- package/assets/esri/core/workers/chunks/d20764cc99fcabcb7cbf.js +1 -0
- package/assets/esri/core/workers/chunks/df18a72e3625cbe31935.js +1 -0
- package/assets/esri/core/workers/chunks/eff8fcb6393cd1193cbc.js +1 -0
- package/assets/esri/core/workers/chunks/f19d3c855f6e93544918.js +1 -0
- package/assets/esri/core/workers/chunks/f4e3db71d1adae717535.js +2 -0
- package/assets/esri/core/workers/chunks/{d82b3e2905cab511ff3a.js.LICENSE.txt → f4e3db71d1adae717535.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{60b40b2319d1651dd150.js → f7e50a8284d12da21355.js} +1 -1
- package/assets/esri/core/workers/chunks/f9c0d571f62e611ffe2b.js +1 -0
- package/assets/esri/core/workers/chunks/fdfe8e0d942b78f08191.js +1 -0
- package/assets/esri/core/workers/chunks/ff21207f46a354786eed.js +1 -0
- package/assets/esri/libs/parquet/pkg/arcgis_parquet_bg.wasm +0 -0
- package/chunks/Bufferer-BiY2mtjI.js +1 -1
- package/chunks/Centroid-DZi-eb9F.js +1 -1
- package/chunks/Clipper-a9xfvRaw.js +1 -1
- package/chunks/CrackAndCluster-CfzXpEle.js +1 -1
- package/chunks/Distance2DCalculator-eS0piaux.js +1 -1
- package/chunks/GeodeticDistanceCalculator-bNilDneE.js +1 -1
- package/chunks/Geometry.js +1 -1
- package/chunks/GeometryCleaner-DVgW95-D.js +1 -1
- package/chunks/Intersector-K1VmdfQW.js +1 -1
- package/chunks/LineSeries.js +1 -1
- package/chunks/OperatorClip.js +1 -1
- package/chunks/OperatorCrosses.js +1 -1
- package/chunks/OperatorCut.js +1 -1
- package/chunks/OperatorDensify.js +1 -1
- package/chunks/OperatorDifference.js +1 -1
- package/chunks/OperatorGeneralize.js +1 -1
- package/chunks/OperatorGeodesicBuffer.js +1 -1
- package/chunks/OperatorGeodeticArea.js +1 -1
- package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
- package/chunks/OperatorGeodeticDistance.js +1 -1
- package/chunks/OperatorGeodeticLength.js +1 -1
- package/chunks/OperatorIntersection.js +1 -1
- package/chunks/OperatorIntersects.js +1 -1
- package/chunks/OperatorMultiPartToSinglePart.js +1 -1
- package/chunks/OperatorOverlaps.js +1 -1
- package/chunks/OperatorProject.js +1 -1
- package/chunks/OperatorProximity.js +1 -1
- package/chunks/OperatorProximityGeodesic.js +1 -1
- package/chunks/OperatorShapePreservingDensify.js +1 -1
- package/chunks/OperatorShapePreservingLength.js +1 -1
- package/chunks/OperatorSimplify.js +1 -1
- package/chunks/OperatorTouches.js +1 -1
- package/chunks/OperatorUnion.js +1 -1
- package/chunks/OperatorWithin.js +1 -1
- package/chunks/QuadraticBezier.js +1 -1
- package/chunks/SideCalculator2D-Bf4QCxCR.js +1 -1
- package/chunks/Theme.js +1 -1
- package/chunks/Tick.js +1 -1
- package/chunks/Transformation2D.js +1 -1
- package/chunks/arcade.js +1 -1
- package/chunks/areaOperator.js +5 -0
- package/chunks/array.js +1 -1
- package/chunks/bufferOperator.js +5 -0
- package/chunks/centroidOperator.js +5 -0
- package/chunks/chartUtilsAm5.js +1 -1
- package/chunks/clipOperator.js +5 -0
- package/chunks/containsOperator.js +5 -0
- package/chunks/convexHullOperator.js +5 -0
- package/chunks/crossesOperator.js +5 -0
- package/chunks/cutOperator.js +5 -0
- package/chunks/densifyOperator.js +5 -0
- package/chunks/differenceOperator.js +5 -0
- package/chunks/disjointOperator.js +5 -0
- package/chunks/distanceOperator.js +5 -0
- package/chunks/equalsOperator.js +5 -0
- package/chunks/generalizeOperator.js +5 -0
- package/chunks/geodesicBufferOperator.js +5 -0
- package/chunks/geodeticAreaOperator.js +5 -0
- package/chunks/geodeticDensifyOperator.js +5 -0
- package/chunks/geodeticLengthOperator.js +5 -0
- package/chunks/i3s.js +1 -1
- package/chunks/intersectionOperator.js +5 -0
- package/chunks/intersectsOperator.js +5 -0
- package/chunks/languageUtils.js +1 -1
- package/chunks/lclayout.js +1 -1
- package/chunks/lengthOperator.js +5 -0
- package/chunks/lyr3DMain.js +1 -1
- package/chunks/lyr3DWorker.js +1 -1
- package/chunks/offsetOperator.js +5 -0
- package/chunks/overlapsOperator.js +5 -0
- package/chunks/pe-wasm.js +1 -1
- package/chunks/proximityOperator.js +5 -0
- package/chunks/relateOperator.js +5 -0
- package/chunks/simplifyOperator.js +5 -0
- package/chunks/symmetricDifferenceOperator.js +5 -0
- package/chunks/touchesOperator.js +5 -0
- package/chunks/unionOperator.js +5 -0
- package/chunks/vxlLayer.js +1 -1
- package/chunks/withinOperator.js +5 -0
- package/copyright.txt +2 -2
- package/core/Evented.js +1 -1
- package/geometry/operators/areaOperator.js +1 -1
- package/geometry/operators/bufferOperator.js +1 -1
- package/geometry/operators/centroidOperator.js +1 -1
- package/geometry/operators/clipOperator.js +1 -1
- package/geometry/operators/containsOperator.js +1 -1
- package/geometry/operators/convexHullOperator.js +1 -1
- package/geometry/operators/crossesOperator.js +1 -1
- package/geometry/operators/cutOperator.js +1 -1
- package/geometry/operators/densifyOperator.js +1 -1
- package/geometry/operators/differenceOperator.js +1 -1
- package/geometry/operators/disjointOperator.js +1 -1
- package/geometry/operators/distanceOperator.js +1 -1
- package/geometry/operators/equalsOperator.js +1 -1
- package/geometry/operators/extendOperator.js +1 -1
- package/geometry/operators/generalizeOperator.js +1 -1
- package/geometry/operators/geodesicBufferOperator.js +1 -1
- package/geometry/operators/geodeticAreaOperator.js +1 -1
- package/geometry/operators/geodeticDensifyOperator.js +1 -1
- package/geometry/operators/geodeticLengthOperator.js +1 -1
- package/geometry/operators/gx/operatorAffineTransform.js +1 -1
- package/geometry/operators/gx/operatorAlphaShape.js +1 -1
- package/geometry/operators/gx/operatorAutoComplete.js +1 -1
- package/geometry/operators/gx/operatorBoundary.js +1 -1
- package/geometry/operators/gx/operatorBuffer.js +1 -1
- package/geometry/operators/gx/operatorConvexHull.js +1 -1
- package/geometry/operators/gx/operatorGraphicBuffer.js +1 -1
- package/geometry/operators/gx/operatorIntegrate.js +1 -1
- package/geometry/operators/gx/operatorLabelPoint.js +1 -1
- package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
- package/geometry/operators/gx/operatorLocateBetween.js +1 -1
- package/geometry/operators/gx/operatorMinimumBoundingCircle.js +1 -1
- package/geometry/operators/gx/operatorOffset.js +1 -1
- package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
- package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
- package/geometry/operators/gx/operatorSinglePartToMultiPart.js +1 -1
- package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
- package/geometry/operators/intersectionOperator.js +1 -1
- package/geometry/operators/intersectsOperator.js +1 -1
- package/geometry/operators/isNearOperator.js +1 -1
- package/geometry/operators/json/disjointOperator.js +1 -1
- package/geometry/operators/lengthOperator.js +1 -1
- package/geometry/operators/offsetOperator.js +1 -1
- package/geometry/operators/overlapsOperator.js +1 -1
- package/geometry/operators/proximityOperator.js +1 -1
- package/geometry/operators/relateOperator.js +1 -1
- package/geometry/operators/reshapeOperator.js +1 -1
- package/geometry/operators/simplifyOperator.js +1 -1
- package/geometry/operators/support/apiConverter.js +1 -1
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/geometry/operators/symmetricDifferenceOperator.js +1 -1
- package/geometry/operators/touchesOperator.js +1 -1
- package/geometry/operators/unionOperator.js +1 -1
- package/geometry/operators/withinOperator.js +1 -1
- package/geometry/support/contains.js +1 -1
- package/interfaces.d.ts +56 -0
- package/kernel.js +1 -1
- package/layers/KMLLayer.js +1 -1
- package/layers/WCSLayer.js +1 -1
- package/layers/graphics/sources/ParquetSource.js +1 -1
- package/layers/support/parquetLayerUtils.js +1 -1
- package/layers/support/rasterDatasets/WCSRaster.js +1 -1
- package/layers/support/rasterFormats/RasterCodec.js +1 -1
- package/layers/support/rasterFormats/TiffDecoder.js +1 -1
- package/layers/support/wmtsUtils.js +1 -1
- package/libs/parquet/parquet.js +1 -1
- package/package.json +3 -3
- package/smartMapping/renderers/support/utils.js +1 -1
- package/smartMapping/symbology/support/Theme.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/layers/features/FeatureContainer.js +1 -1
- package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/strategies/ParquetLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
- package/views/3d/support/DisplayQualityProfile.js +1 -1
- package/views/3d/webgl-engine/core/shaderModules/interfaces.js +1 -1
- package/views/3d/webgl-engine/lib/Octree.js +1 -1
- package/views/SelectionManager.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Feature/support/featureUtils.js +1 -1
- package/widgets/LayerList/LayerListItem.js +1 -1
- package/widgets/LayerList/support/layerListUtils.js +1 -1
- package/widgets/Legend/support/heatmapRampUtils.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerVisibleElements.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/support/widgetUtils.js +1 -1
- package/assets/esri/core/workers/chunks/015285436ca965f94e17.js +0 -1
- package/assets/esri/core/workers/chunks/048d296efa26ccd79056.js +0 -1
- package/assets/esri/core/workers/chunks/0e0b978459d70b15acb5.js +0 -1
- package/assets/esri/core/workers/chunks/10fa211987b16fd71a1a.js +0 -1
- package/assets/esri/core/workers/chunks/200a5f1864c2c2f7536c.js +0 -1
- package/assets/esri/core/workers/chunks/23a697d48f6e45cc033e.js +0 -1
- package/assets/esri/core/workers/chunks/29b610ff44708e044cbd.js +0 -1
- package/assets/esri/core/workers/chunks/3600125c58d5d04c515a.js +0 -1
- package/assets/esri/core/workers/chunks/457d4abc938d14f28e31.js +0 -1
- package/assets/esri/core/workers/chunks/4b5dbdcad438cb2dd4bf.js +0 -1
- package/assets/esri/core/workers/chunks/69efc716991a407c3d23.js +0 -1
- package/assets/esri/core/workers/chunks/6e254e846e284223ef63.js +0 -1
- package/assets/esri/core/workers/chunks/785610aa615198fd3815.js +0 -1
- package/assets/esri/core/workers/chunks/7bf7aace72f81f5de4e4.js +0 -1
- package/assets/esri/core/workers/chunks/7ea3d652536e1d79dfc6.js +0 -1
- package/assets/esri/core/workers/chunks/816c9c81352cd0ca8ce8.js +0 -1
- package/assets/esri/core/workers/chunks/9291508232b23f030178.js +0 -1
- package/assets/esri/core/workers/chunks/9fc49968dea8e2b64f3e.js +0 -1
- package/assets/esri/core/workers/chunks/a0b3d70a1b0360084593.js +0 -1
- package/assets/esri/core/workers/chunks/a100fb789d72410f8d4f.js +0 -2
- package/assets/esri/core/workers/chunks/b4d76d46661aba356ea3.js +0 -1
- package/assets/esri/core/workers/chunks/cb3af81e1fe6405c4885.js +0 -1
- package/assets/esri/core/workers/chunks/cbf57abb537e86c1dd7f.js +0 -1
- package/assets/esri/core/workers/chunks/cebdf2f88c4d2ad8baab.js +0 -1
- package/assets/esri/core/workers/chunks/d56d77125798beb7e493.js +0 -1
- package/assets/esri/core/workers/chunks/d82b3e2905cab511ff3a.js +0 -2
- package/assets/esri/core/workers/chunks/e2f91098793b8742fae6.js +0 -1
- package/assets/esri/core/workers/chunks/f25c04cf1a4bc1d2636a.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{b as e,c as t}from"./tslib.es6.js";import{G as n,v as i}from"./Geometry.js";import{H as r,P as s,a as o,E as m,S as a,g as u}from"./QuadraticBezier.js";import{m as c}from"./CrackAndCluster-CfzXpEle.js";import{P as h,b as l,l as g,o as y,f as _,j as D}from"./Transformation2D.js";function p(){return{outPoint:new h,index:-1,t:Number.NaN}}function v(e,t,n){return{outPoint:e.clone(),index:t,t:n}}function N(e,t,n,i){e.outPoint.assign(t),e.index=n,e.t=i}function f(e,t){e.outPoint.assign(t.outPoint),e.index=t.index,e.t=t.t}function P(e,t,n,i){e.index=n,e.t=i,t.queryCoord2D(e.t,e.outPoint)}function I(e,t){const n=p();f(n,e),f(e,t),f(t,n)}function d(e,t,i,r,s,o){if(e.getGeometryType()===n.enumPolygon){for(;r.nextPath();)if(r.hasNextSegment()){const t=r.nextSegment();if(0!==c(e,t.getEndXY(),0))return N(s,t.getEndXY(),-1,Number.NaN),N(o,t.getEndXY(),-1,Number.NaN),!0}r.resetToFirstPath()}if(t.getGeometryType()===n.enumPolygon){for(;i.nextPath();)if(i.hasNextSegment()){const e=i.nextSegment();if(0!==c(t,e.getEndXY(),0))return N(s,e.getEndXY(),-1,Number.NaN),N(o,e.getEndXY(),-1,Number.NaN),!0}i.resetToFirstPath()}return!1}function q(e){const t=e.getPathCount(),n=new Array(e.getSegmentCount());let i=0;for(let r=0;r<t;++r){const t=i+e.getSegmentCountPath(r);for(let s=i,o=e.getPathStart(r);s<t;++s,++o)n[s]=o;i=t}return r(e.getPointCount(),n),n}function M(e,t){return!!Number.isNaN(t)||e<=t}function x(e){const t=new u;return t.addEnvelope(e,!1),t}class E{constructor(e,t){if(this.m_env2DgeometryA=null,this.m_env2DgeometryB=null,this.m_progressCounter=0,this.m_progressTracker=t,this.m_maxSqrDistance=e*e,this.m_maxDistance=e,this.m_bIsNearCalc=!1,Number.isNaN(this.m_maxDistance)?this.m_maxDistance=Number.POSITIVE_INFINITY:this.m_maxDistance=e,this.m_maxSqrDistance=this.m_maxDistance*this.m_maxDistance,Number.isFinite(this.m_maxSqrDistance)){let e=Math.sqrt(this.m_maxSqrDistance);for(;e<this.m_maxDistance;)this.m_maxSqrDistance*=1+Number.EPSILON,e=Math.sqrt(this.m_maxSqrDistance)}}calculate(e,t,n,i){if(e.getGeometryType()!==s.type||t.getGeometryType()!==s.type){this.m_env2DgeometryA=new o,this.m_env2DgeometryB=new o,e.queryEnvelope(this.m_env2DgeometryA),t.queryEnvelope(this.m_env2DgeometryB);if(!M(this.m_env2DgeometryA.distanceFromEnvelope(this.m_env2DgeometryB),this.m_maxDistance))return Number.POSITIVE_INFINITY}const r=v(new h,D(),Number.NaN),m=v(new h,D(),Number.NaN),a=this._ExecuteBruteForce(e,t,r,m);return M(a,this.m_maxDistance)?(null!==n&&f(n,r),null!==i&&f(i,m),a):Number.POSITIVE_INFINITY}isNear(e,t){if(this.m_bIsNearCalc=!0,e.isEmpty()||t.isEmpty())return!1;if(e===t)return!0;let n=!0;if(e.getGeometryType()!==s.type&&e.getGeometryType()!==m.type||t.getGeometryType()!==s.type&&t.getGeometryType()!==m.type||(n=!1),n){if(this.m_env2DgeometryA=new o,this.m_env2DgeometryB=new o,e.queryEnvelope(this.m_env2DgeometryA),t.queryEnvelope(this.m_env2DgeometryB),!(this.m_env2DgeometryA.sqrMaxMinDistanceEnvelope(this.m_env2DgeometryB)>this.m_maxSqrDistance))return!0;if(this.m_env2DgeometryA.sqrDistanceEnvelope(this.m_env2DgeometryB,null,null)>this.m_maxSqrDistance)return!1}const i=v(new h,D(),Number.NaN),r=v(new h,D(),Number.NaN);return this._ExecuteBruteForce(e,t,i,r)<=this.m_maxDistance}progress_(e=!1){}_ExecuteBruteForce(e,t,i,r){switch(e.getGeometryType()){case n.enumPoint:return this.distancePointGeometry(e,t,i,r);case n.enumMultiPoint:return this.distanceMultipointGeometry(e,t,i,r);case n.enumEnvelope:return this.distanceEnvelopeGeometry(e,t,i,r);case n.enumPolyline:case n.enumPolygon:return this.distanceMultipathGeometry(e,t,i,r);default:return Number.NaN}}distancePointGeometry(e,t,i,r){switch(t.getGeometryType()){case n.enumPoint:return this.distancePointPoint(e,t,i,r);case n.enumMultiPoint:return this.distancePointMultipoint(e,t,i,r);case n.enumPolyline:case n.enumPolygon:return this.distancePointMultipath(e,t,i,r);case n.enumEnvelope:return this.distancePointEnvelope(e,t,i,r);default:return Number.NaN}}distancePointPoint(e,t,n,i){const r=e.getXY(),s=t.getXY();return N(n,r,0,0),N(i,s,0,0),Math.sqrt(h.sqrDistance(r,s))}distancePointMultipoint(e,t,n,i){const r=e.getXY();let s=this.m_maxSqrDistance,o=s,m=!1;const a=t.getPointCount(),u=new h;for(let c=0;c<a;++c)if(t.queryXY(c,u),o=h.sqrDistance(r,u),this.m_bIsNearCalc){if(o<=s)return 0}else if(!(o>s)&&(!m&&o===s||o<s)&&(s=o,N(n,r,0,0),N(i,u,c,0),m=!0,0===s))return 0;return m?Math.sqrt(s):Number.POSITIVE_INFINITY}distancePointMultipath(e,t,i,r){const s=!this.m_env2DgeometryA.isIntersecting(this.m_env2DgeometryB),m=e.getXY();if(!s&&t.getGeometryType()===n.enumPolygon&&0!==c(t,m,0))return N(i,m,0,0),N(r,m,-1,Number.NaN),0;t.getImpl().getAccelerators();let a=this.m_maxSqrDistance,u=a,l=-1;const g=new o,y=t.querySegmentIterator();let _=!1;for(;y.nextPath();)for(;y.hasNextSegment();){const e=y.nextSegment();e.queryEnvelope(g);const t=g.sqrDistance(m);if(t>a)continue;if(!this.m_bIsNearCalc&&_&&t===a)continue;l=e.getClosestCoordinate(m,!1);const n=e.getCoord2D(l);if(u=h.sqrDistance(m,n),this.m_bIsNearCalc){if(u<=a)return 0}else if(!(u>a)&&(!_||u<a)&&(a=u,N(i,m,0,0),N(r,n,y.getStartPointIndex(),l),_=!0,0===a))return 0}return _?Math.sqrt(a):Number.POSITIVE_INFINITY}distancePointEnvelope(e,t,n,i){const r=e.getXY();N(n,r,0,0),N(i,r,-1,Number.NaN);const s=t.asEnvelope2D();return!s.contains(r)?Math.sqrt(s.sqrDistance(r,i.outPoint)):0}distanceMultipointGeometry(e,t,i,r){switch(t.getGeometryType()){case n.enumPoint:{this.m_env2DgeometryB=l(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB);const n=this.distancePointMultipoint(t,e,r,i);return this.m_env2DgeometryB=l(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB),n}case n.enumMultiPoint:return this.distanceMultipointMultipoint(e,t,i,r,1,1);case n.enumPolyline:case n.enumPolygon:return this.distanceMultipointMultipath(e,t,i,r);case n.enumEnvelope:return this.distanceMultipointMultipath(e,x(t),i,r);default:return Number.NaN}}distanceMultipointMultipoint(n,i,r,s,o,m){const a={stack:[],error:void 0,hasError:!1};try{if(this.m_bIsNearCalc&&1===o&&1===m){const e=Math.trunc(g(Math.sqrt(n.getPointCount())+1,1,y())),t=Math.trunc(g(Math.sqrt(i.getPointCount())+1,1,y()));if((e>=4||t>=4)&&this.distanceMultipointMultipoint(n,i,r,s,e,t)<=this.m_maxSqrDistance)return 0}let t=this.m_maxSqrDistance;const u=[n],c=[i],D=this.swapGeometriesIfBGtA(u,c);D&&(this.m_env2DgeometryB=l(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB),m=l(o,o=m),I(r,s)),e(a,_((()=>{I(r,s),this.m_env2DgeometryB=l(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB)}),!D),!1);const p=u[0].getImpl(),v=c[0].getImpl(),f=p.getPointCount(),P=v.getPointCount(),d=P>1;let q=!1;const M=new h,x=new h;for(let e=0;e<f;e+=o){if(p.queryXY(e,M),d){const e=this.m_env2DgeometryB.sqrDistance(M);if(this.m_bIsNearCalc){if(e>t)continue;if(this.m_env2DgeometryB.sqrMaxMinDistance(M)<=t)return 0}else if(e>=t)continue}for(let n=0;n<P;n+=m){v.queryXY(n,x);const i=h.sqrDistance(M,x);if(this.m_bIsNearCalc){if(i<=t)return 0}else if(!(i>t||q&&i===t)&&(!q||i<t)&&(N(r,M,e,0),N(s,x,n,0),q=!0,t=i,0===t))return q?Math.sqrt(t):Number.POSITIVE_INFINITY}}return q?Math.sqrt(t):Number.POSITIVE_INFINITY}catch(u){a.error=u,a.hasError=!0}finally{t(a)}}distanceMultipointMultipath(e,t,i,r){let s=!!this.m_env2DgeometryA.isIntersecting(this.m_env2DgeometryB)&&t.getGeometryType()===n.enumPolygon;const m=t.querySegmentIterator();m.stripAttributes();const a=new o,u=new h;let l=this.m_maxSqrDistance;const g=e.getImpl(),y=g.getPointCount(),_=y>1;let D=!1;for(;m.nextPath();)for(;m.hasNextSegment();){const e=m.nextSegment();if(e.queryLooseEnvelope(a),_){const e=a.sqrDistanceEnvelope(this.m_env2DgeometryA,null,null);if(this.m_bIsNearCalc){if(e>l)continue}else if(e>l||D&&e===l)continue}for(let n=0;n<y;n++){if(g.queryXY(n,u),s&&0!==c(t,u,0))return N(i,u,-1,Number.NaN),N(r,u,n,0),0;{const e=a.sqrDistance(u);if(this.m_bIsNearCalc){if(e>l)continue}else if(e>l)continue}const o=e.getClosestCoordinate(u,!1),h=e.getCoord2D(o);u.subThis(h);const y=u.sqrLength();if(this.m_bIsNearCalc){if(y<=l)return 0}else if(!(y>l)&&(!D||y<l)&&(l=y,N(i,g.getXY(n),n,0),N(r,h,m.getStartPointIndex(),o),D=!0,0===l))return 0}s=!1}return D?Math.sqrt(l):Number.POSITIVE_INFINITY}distanceEnvelopeGeometry(e,t,i,r){switch(t.getGeometryType()){case n.enumPoint:return this.distancePointEnvelope(t,e,r,i);case n.enumMultiPoint:{this.m_env2DgeometryB=l(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB);const n=this.distanceMultipointMultipath(t,x(e),r,i);return this.m_env2DgeometryB=l(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB),n}case n.enumPolyline:case n.enumPolygon:return this.distanceMultipathMultipath(x(e),t,i,r);case n.enumEnvelope:return this.distanceEnvelopeEnvelope(e,t,i,r);default:return Number.NaN}}distanceEnvelopeEnvelope(e,t,n,i){n.t=Number.NaN,n.index=-1,i.t=Number.NaN,i.index=-1;const r=e.asEnvelope2D(),s=t.asEnvelope2D();return Math.sqrt(r.sqrDistanceEnvelope(s,n.outPoint,i.outPoint))}distanceMultipathGeometry(e,t,i,r){switch(t.getGeometryType()){case n.enumPoint:{this.m_env2DgeometryB=l(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB);const n=this.distancePointMultipath(t,e,r,i);return this.m_env2DgeometryB=l(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB),n}case n.enumMultiPoint:{this.m_env2DgeometryB=l(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB);const n=this.distanceMultipointMultipath(t,e,r,i);return this.m_env2DgeometryB=l(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB),n}case n.enumPolyline:case n.enumPolygon:return this.distanceMultipathMultipath(e,t,i,r);case n.enumEnvelope:return this.distanceMultipathMultipath(e,x(t),i,r);default:return Number.NaN}}distanceMultipathMultipath(n,i,r,s){const m={stack:[],error:void 0,hasError:!1};try{const t=[n],u=[i],c=this.swapGeometriesIfAGtB(t,u);c&&(this.m_env2DgeometryB=l(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB),I(r,s)),e(m,_((()=>{I(r,s),this.m_env2DgeometryB=l(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB)}),!c),!1);const h=t[0],D=u[0],v=h.querySegmentIterator();v.stripAttributes();const N=D.querySegmentIterator();if(N.stripAttributes(),this.m_bIsNearCalc&&this.m_env2DgeometryA.sqrMaxMinDistanceEnvelope(this.m_env2DgeometryB)<=this.m_maxSqrDistance)return 0;if(this.m_bIsNearCalc){const e=Math.trunc(g(Math.sqrt(h.getPointCount())+1,1,y())),t=Math.trunc(g(Math.sqrt(h.getPointCount())+1,1,y()));if(this.distanceMultipointMultipoint(h,D,r,s,e,t)<=this.m_maxSqrDistance)return 0}if(!!this.m_env2DgeometryA.isIntersecting(this.m_env2DgeometryB)){const e=p(),t=p();if(d(h,D,v,N,e,t))return f(r,e),f(s,t),0}const M=q(h),x=[],E=new a,b=new o,B=new o,S=new o;let A=this.m_maxSqrDistance,T=!0,C=!1;for(let e=0,n=M.length;e<n;++e){h.querySegment(M[e],E,!0);const t=E.get();if(t.queryEnvelope(b),!(b.sqrDistanceEnvelope(this.m_env2DgeometryB,null,null)>A)){if(this.m_bIsNearCalc&&b.sqrMaxDistanceEnvelope(this.m_env2DgeometryB)<=A)return 0;for(;N.nextPath();){if(this.progress_(),T)D.queryPathEnvelope(N.getPathIndex(),S),x[N.getPathIndex()]=S.clone();else if(b.sqrDistanceEnvelope(x[N.getPathIndex()],null,null)>A)continue;for(;N.hasNextSegment();){const n=N.nextSegment();if(n.queryEnvelope(B),b.sqrDistanceEnvelope(B,null,null)<=A){const i=!b.isIntersecting(B),o=[0],m=[0];let a=t.distance(n,i,o,m);if(a*=a,this.m_bIsNearCalc&&a<=this.m_maxSqrDistance)return 0;if(a<A||a===A&&M[e]<r.index){if(C=!0,P(r,t,M[e],o[0]),P(s,n,N.getStartPointIndex(),m[0]),0===a)return 0;A=a}}}}N.resetToFirstPath(),T=!1}}return C?Math.sqrt(A):Number.POSITIVE_INFINITY}catch(u){m.error=u,m.hasError=!0}finally{t(m)}}swapGeometriesIfAGtB(e,t){return i(e[0])>i(t[0])&&(t[0]=l(e[0],e[0]=t[0]),!0)}swapGeometriesIfBGtA(e,t){return this.swapGeometriesIfAGtB(t,e)}}export{E as D,p as m,q as s,d as w};
|
|
5
|
+
import{b as e,c as t}from"./tslib.es6.js";import{G as n,v as i}from"./Geometry.js";import{J as r,P as s,a as o,E as m,S as a,h as u}from"./QuadraticBezier.js";import{i as c}from"./CrackAndCluster-CfzXpEle.js";import{P as h,b as l,l as g,o as y,f as _,j as D}from"./Transformation2D.js";function p(){return{outPoint:new h,index:-1,t:Number.NaN}}function v(e,t,n){return{outPoint:e.clone(),index:t,t:n}}function N(e,t,n,i){e.outPoint.assign(t),e.index=n,e.t=i}function f(e,t){e.outPoint.assign(t.outPoint),e.index=t.index,e.t=t.t}function P(e,t,n,i){e.index=n,e.t=i,t.queryCoord2D(e.t,e.outPoint)}function I(e,t){const n=p();f(n,e),f(e,t),f(t,n)}function d(e,t,i,r,s,o){if(e.getGeometryType()===n.enumPolygon){for(;r.nextPath();)if(r.hasNextSegment()){const t=r.nextSegment();if(0!==c(e,t.getEndXY(),0))return N(s,t.getEndXY(),-1,Number.NaN),N(o,t.getEndXY(),-1,Number.NaN),!0}r.resetToFirstPath()}if(t.getGeometryType()===n.enumPolygon){for(;i.nextPath();)if(i.hasNextSegment()){const e=i.nextSegment();if(0!==c(t,e.getEndXY(),0))return N(s,e.getEndXY(),-1,Number.NaN),N(o,e.getEndXY(),-1,Number.NaN),!0}i.resetToFirstPath()}return!1}function q(e){const t=e.getPathCount(),n=new Array(e.getSegmentCount());let i=0;for(let r=0;r<t;++r){const t=i+e.getSegmentCountPath(r);for(let s=i,o=e.getPathStart(r);s<t;++s,++o)n[s]=o;i=t}return r(e.getPointCount(),n),n}function M(e,t){return!!Number.isNaN(t)||e<=t}function x(e){const t=new u;return t.addEnvelope(e,!1),t}class E{constructor(e,t){if(this.m_env2DgeometryA=null,this.m_env2DgeometryB=null,this.m_progressCounter=0,this.m_progressTracker=t,this.m_maxSqrDistance=e*e,this.m_maxDistance=e,this.m_bIsNearCalc=!1,Number.isNaN(this.m_maxDistance)?this.m_maxDistance=Number.POSITIVE_INFINITY:this.m_maxDistance=e,this.m_maxSqrDistance=this.m_maxDistance*this.m_maxDistance,Number.isFinite(this.m_maxSqrDistance)){let e=Math.sqrt(this.m_maxSqrDistance);for(;e<this.m_maxDistance;)this.m_maxSqrDistance*=1+Number.EPSILON,e=Math.sqrt(this.m_maxSqrDistance)}}calculate(e,t,n,i){if(e.getGeometryType()!==s.type||t.getGeometryType()!==s.type){this.m_env2DgeometryA=new o,this.m_env2DgeometryB=new o,e.queryEnvelope(this.m_env2DgeometryA),t.queryEnvelope(this.m_env2DgeometryB);if(!M(this.m_env2DgeometryA.distanceFromEnvelope(this.m_env2DgeometryB),this.m_maxDistance))return Number.POSITIVE_INFINITY}const r=v(new h,D(),Number.NaN),m=v(new h,D(),Number.NaN),a=this._ExecuteBruteForce(e,t,r,m);return M(a,this.m_maxDistance)?(null!==n&&f(n,r),null!==i&&f(i,m),a):Number.POSITIVE_INFINITY}isNear(e,t){if(this.m_bIsNearCalc=!0,e.isEmpty()||t.isEmpty())return!1;if(e===t)return!0;let n=!0;if(e.getGeometryType()!==s.type&&e.getGeometryType()!==m.type||t.getGeometryType()!==s.type&&t.getGeometryType()!==m.type||(n=!1),n){if(this.m_env2DgeometryA=new o,this.m_env2DgeometryB=new o,e.queryEnvelope(this.m_env2DgeometryA),t.queryEnvelope(this.m_env2DgeometryB),!(this.m_env2DgeometryA.sqrMaxMinDistanceEnvelope(this.m_env2DgeometryB)>this.m_maxSqrDistance))return!0;if(this.m_env2DgeometryA.sqrDistanceEnvelope(this.m_env2DgeometryB,null,null)>this.m_maxSqrDistance)return!1}const i=v(new h,D(),Number.NaN),r=v(new h,D(),Number.NaN);return this._ExecuteBruteForce(e,t,i,r)<=this.m_maxDistance}progress_(e=!1){}_ExecuteBruteForce(e,t,i,r){switch(e.getGeometryType()){case n.enumPoint:return this.distancePointGeometry(e,t,i,r);case n.enumMultiPoint:return this.distanceMultipointGeometry(e,t,i,r);case n.enumEnvelope:return this.distanceEnvelopeGeometry(e,t,i,r);case n.enumPolyline:case n.enumPolygon:return this.distanceMultipathGeometry(e,t,i,r);default:return Number.NaN}}distancePointGeometry(e,t,i,r){switch(t.getGeometryType()){case n.enumPoint:return this.distancePointPoint(e,t,i,r);case n.enumMultiPoint:return this.distancePointMultipoint(e,t,i,r);case n.enumPolyline:case n.enumPolygon:return this.distancePointMultipath(e,t,i,r);case n.enumEnvelope:return this.distancePointEnvelope(e,t,i,r);default:return Number.NaN}}distancePointPoint(e,t,n,i){const r=e.getXY(),s=t.getXY();return N(n,r,0,0),N(i,s,0,0),Math.sqrt(h.sqrDistance(r,s))}distancePointMultipoint(e,t,n,i){const r=e.getXY();let s=this.m_maxSqrDistance,o=s,m=!1;const a=t.getPointCount(),u=new h;for(let c=0;c<a;++c)if(t.queryXY(c,u),o=h.sqrDistance(r,u),this.m_bIsNearCalc){if(o<=s)return 0}else if(!(o>s)&&(!m&&o===s||o<s)&&(s=o,N(n,r,0,0),N(i,u,c,0),m=!0,0===s))return 0;return m?Math.sqrt(s):Number.POSITIVE_INFINITY}distancePointMultipath(e,t,i,r){const s=!this.m_env2DgeometryA.isIntersecting(this.m_env2DgeometryB),m=e.getXY();if(!s&&t.getGeometryType()===n.enumPolygon&&0!==c(t,m,0))return N(i,m,0,0),N(r,m,-1,Number.NaN),0;t.getImpl().getAccelerators();let a=this.m_maxSqrDistance,u=a,l=-1;const g=new o,y=t.querySegmentIterator();let _=!1;for(;y.nextPath();)for(;y.hasNextSegment();){const e=y.nextSegment();e.queryEnvelope(g);const t=g.sqrDistance(m);if(t>a)continue;if(!this.m_bIsNearCalc&&_&&t===a)continue;l=e.getClosestCoordinate(m,!1);const n=e.getCoord2D(l);if(u=h.sqrDistance(m,n),this.m_bIsNearCalc){if(u<=a)return 0}else if(!(u>a)&&(!_||u<a)&&(a=u,N(i,m,0,0),N(r,n,y.getStartPointIndex(),l),_=!0,0===a))return 0}return _?Math.sqrt(a):Number.POSITIVE_INFINITY}distancePointEnvelope(e,t,n,i){const r=e.getXY();N(n,r,0,0),N(i,r,-1,Number.NaN);const s=t.asEnvelope2D();return!s.contains(r)?Math.sqrt(s.sqrDistance(r,i.outPoint)):0}distanceMultipointGeometry(e,t,i,r){switch(t.getGeometryType()){case n.enumPoint:{this.m_env2DgeometryB=l(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB);const n=this.distancePointMultipoint(t,e,r,i);return this.m_env2DgeometryB=l(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB),n}case n.enumMultiPoint:return this.distanceMultipointMultipoint(e,t,i,r,1,1);case n.enumPolyline:case n.enumPolygon:return this.distanceMultipointMultipath(e,t,i,r);case n.enumEnvelope:return this.distanceMultipointMultipath(e,x(t),i,r);default:return Number.NaN}}distanceMultipointMultipoint(n,i,r,s,o,m){const a={stack:[],error:void 0,hasError:!1};try{if(this.m_bIsNearCalc&&1===o&&1===m){const e=Math.trunc(g(Math.sqrt(n.getPointCount())+1,1,y())),t=Math.trunc(g(Math.sqrt(i.getPointCount())+1,1,y()));if((e>=4||t>=4)&&this.distanceMultipointMultipoint(n,i,r,s,e,t)<=this.m_maxSqrDistance)return 0}let t=this.m_maxSqrDistance;const u=[n],c=[i],D=this.swapGeometriesIfBGtA(u,c);D&&(this.m_env2DgeometryB=l(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB),m=l(o,o=m),I(r,s)),e(a,_((()=>{I(r,s),this.m_env2DgeometryB=l(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB)}),!D),!1);const p=u[0].getImpl(),v=c[0].getImpl(),f=p.getPointCount(),P=v.getPointCount(),d=P>1;let q=!1;const M=new h,x=new h;for(let e=0;e<f;e+=o){if(p.queryXY(e,M),d){const e=this.m_env2DgeometryB.sqrDistance(M);if(this.m_bIsNearCalc){if(e>t)continue;if(this.m_env2DgeometryB.sqrMaxMinDistance(M)<=t)return 0}else if(e>=t)continue}for(let n=0;n<P;n+=m){v.queryXY(n,x);const i=h.sqrDistance(M,x);if(this.m_bIsNearCalc){if(i<=t)return 0}else if(!(i>t||q&&i===t)&&(!q||i<t)&&(N(r,M,e,0),N(s,x,n,0),q=!0,t=i,0===t))return q?Math.sqrt(t):Number.POSITIVE_INFINITY}}return q?Math.sqrt(t):Number.POSITIVE_INFINITY}catch(u){a.error=u,a.hasError=!0}finally{t(a)}}distanceMultipointMultipath(e,t,i,r){let s=!!this.m_env2DgeometryA.isIntersecting(this.m_env2DgeometryB)&&t.getGeometryType()===n.enumPolygon;const m=t.querySegmentIterator();m.stripAttributes();const a=new o,u=new h;let l=this.m_maxSqrDistance;const g=e.getImpl(),y=g.getPointCount(),_=y>1;let D=!1;for(;m.nextPath();)for(;m.hasNextSegment();){const e=m.nextSegment();if(e.queryLooseEnvelope(a),_){const e=a.sqrDistanceEnvelope(this.m_env2DgeometryA,null,null);if(this.m_bIsNearCalc){if(e>l)continue}else if(e>l||D&&e===l)continue}for(let n=0;n<y;n++){if(g.queryXY(n,u),s&&0!==c(t,u,0))return N(i,u,-1,Number.NaN),N(r,u,n,0),0;{const e=a.sqrDistance(u);if(this.m_bIsNearCalc){if(e>l)continue}else if(e>l)continue}const o=e.getClosestCoordinate(u,!1),h=e.getCoord2D(o);u.subThis(h);const y=u.sqrLength();if(this.m_bIsNearCalc){if(y<=l)return 0}else if(!(y>l)&&(!D||y<l)&&(l=y,N(i,g.getXY(n),n,0),N(r,h,m.getStartPointIndex(),o),D=!0,0===l))return 0}s=!1}return D?Math.sqrt(l):Number.POSITIVE_INFINITY}distanceEnvelopeGeometry(e,t,i,r){switch(t.getGeometryType()){case n.enumPoint:return this.distancePointEnvelope(t,e,r,i);case n.enumMultiPoint:{this.m_env2DgeometryB=l(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB);const n=this.distanceMultipointMultipath(t,x(e),r,i);return this.m_env2DgeometryB=l(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB),n}case n.enumPolyline:case n.enumPolygon:return this.distanceMultipathMultipath(x(e),t,i,r);case n.enumEnvelope:return this.distanceEnvelopeEnvelope(e,t,i,r);default:return Number.NaN}}distanceEnvelopeEnvelope(e,t,n,i){n.t=Number.NaN,n.index=-1,i.t=Number.NaN,i.index=-1;const r=e.asEnvelope2D(),s=t.asEnvelope2D();return Math.sqrt(r.sqrDistanceEnvelope(s,n.outPoint,i.outPoint))}distanceMultipathGeometry(e,t,i,r){switch(t.getGeometryType()){case n.enumPoint:{this.m_env2DgeometryB=l(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB);const n=this.distancePointMultipath(t,e,r,i);return this.m_env2DgeometryB=l(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB),n}case n.enumMultiPoint:{this.m_env2DgeometryB=l(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB);const n=this.distanceMultipointMultipath(t,e,r,i);return this.m_env2DgeometryB=l(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB),n}case n.enumPolyline:case n.enumPolygon:return this.distanceMultipathMultipath(e,t,i,r);case n.enumEnvelope:return this.distanceMultipathMultipath(e,x(t),i,r);default:return Number.NaN}}distanceMultipathMultipath(n,i,r,s){const m={stack:[],error:void 0,hasError:!1};try{const t=[n],u=[i],c=this.swapGeometriesIfAGtB(t,u);c&&(this.m_env2DgeometryB=l(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB),I(r,s)),e(m,_((()=>{I(r,s),this.m_env2DgeometryB=l(this.m_env2DgeometryA,this.m_env2DgeometryA=this.m_env2DgeometryB)}),!c),!1);const h=t[0],D=u[0],v=h.querySegmentIterator();v.stripAttributes();const N=D.querySegmentIterator();if(N.stripAttributes(),this.m_bIsNearCalc&&this.m_env2DgeometryA.sqrMaxMinDistanceEnvelope(this.m_env2DgeometryB)<=this.m_maxSqrDistance)return 0;if(this.m_bIsNearCalc){const e=Math.trunc(g(Math.sqrt(h.getPointCount())+1,1,y())),t=Math.trunc(g(Math.sqrt(h.getPointCount())+1,1,y()));if(this.distanceMultipointMultipoint(h,D,r,s,e,t)<=this.m_maxSqrDistance)return 0}if(!!this.m_env2DgeometryA.isIntersecting(this.m_env2DgeometryB)){const e=p(),t=p();if(d(h,D,v,N,e,t))return f(r,e),f(s,t),0}const M=q(h),x=[],E=new a,b=new o,B=new o,S=new o;let A=this.m_maxSqrDistance,T=!0,C=!1;for(let e=0,n=M.length;e<n;++e){h.querySegment(M[e],E,!0);const t=E.get();if(t.queryEnvelope(b),!(b.sqrDistanceEnvelope(this.m_env2DgeometryB,null,null)>A)){if(this.m_bIsNearCalc&&b.sqrMaxDistanceEnvelope(this.m_env2DgeometryB)<=A)return 0;for(;N.nextPath();){if(this.progress_(),T)D.queryPathEnvelope(N.getPathIndex(),S),x[N.getPathIndex()]=S.clone();else if(b.sqrDistanceEnvelope(x[N.getPathIndex()],null,null)>A)continue;for(;N.hasNextSegment();){const n=N.nextSegment();if(n.queryEnvelope(B),b.sqrDistanceEnvelope(B,null,null)<=A){const i=!b.isIntersecting(B),o=[0],m=[0];let a=t.distance(n,i,o,m);if(a*=a,this.m_bIsNearCalc&&a<=this.m_maxSqrDistance)return 0;if(a<A||a===A&&M[e]<r.index){if(C=!0,P(r,t,M[e],o[0]),P(s,n,N.getStartPointIndex(),m[0]),0===a)return 0;A=a}}}}N.resetToFirstPath(),T=!1}}return C?Math.sqrt(A):Number.POSITIVE_INFINITY}catch(u){m.error=u,m.hasError=!0}finally{t(m)}}swapGeometriesIfAGtB(e,t){return i(e[0])>i(t[0])&&(t[0]=l(e[0],e[0]=t[0]),!0)}swapGeometriesIfBGtA(e,t){return this.swapGeometriesIfAGtB(t,e)}}export{E as D,p as m,q as s,d as w};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{b as t,c as e}from"./tslib.es6.js";import{t as i,G as s,g as n,a as o,v as a,e as m}from"./Geometry.js";import{a as r,Q as u,S as c,J as h,g as l}from"./QuadraticBezier.js";import{g as _,e as p,o as d,q as g,z as x,K as y,M as P,N as S,y as f,Q as G,h as D,p as v,D as T,s as b}from"./OperatorProject.js";import{P as w,T as M,b as E,d as R,E as C,r as I}from"./Transformation2D.js";import{t as B}from"./CrackAndCluster-CfzXpEle.js";import{s as A,w as q,m as N}from"./Distance2DCalculator-eS0piaux.js";import{O as F}from"./OperatorShapePreservingDensify.js";import{O as X}from"./OperatorClip.js";function Y(){return new r}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 d,this.m_peR2=new d,this.m_peR3=new d,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;g.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,c=v.phiToEta(this.m_e2,u),h=Math.sin(n.val)*Math.cos(c);let l=e;if(m*r<0){const t=m<0?-1:1,e=Math.acos(Math.abs(h))*t;l=v.etaToPhi(this.m_e2,e)/this.m_unitToRad}let _=I((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);g.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),c=this.m_peR1,h=this.m_peR2;g.geodeticDistance(o,0,this.m_unitToRad*i,m,this.m_unitToRad*t,a,c,null,null,0),g.geodeticDistance(o,0,this.m_unitToRad*i,r,this.m_unitToRad*t,a,h,null,null,0);const l=x(1,0,new w(this.m_unitToRad*t,a)),_=x(1,0,new w(this.m_unitToRad*i,m)),p=x(1,0,new w(this.m_unitToRad*i,r));let d=new u;d.setCrossProductVector(_,p);const y=_.dotProduct(p);if(d.length()<1.568e-10)return y>=0?Math.min(c.val,h.val):0;d=d.getUnitVector();let P=new u;if(P.setCrossProductVector(d,l),P.length()<1.568e-10){return Math.min(c.val,h.val)-1e-5*o}P=P.getUnitVector();let S=l.sub(d.mul(l.dotProduct(d)));{const e=new u;e.setCrossProductVector(_,S);const i=new u;i.setCrossProductVector(S,p);let s=d.dotProduct(e)>0&&d.dotProduct(i)>0;if(s||(S.negateThis(),e.setCrossProductVector(_,S),i.setCrossProductVector(S,p),s=d.dotProduct(e)>0&&d.dotProduct(i)>0),s){S=S.getUnitVector();const e=T(1,0,S),i=this.m_peR3;g.geodeticDistance(o,0,this.m_unitToRad*t,a,e.x,e.y,i,null,null,0);const s=Math.min(c.val,h.val);return Math.min(s,i.val)}}return Math.min(c.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 w:t.clone()}}function z(t,e){t.outPoint.assign(e.outPoint)}function H(){return new r}class Q{constructor(t,e,i,s,n=0,o=4){this.m_ptDistFrom=new w,this.m_segStartPt=new w,this.m_segEndPt=new w,this.m_geodeticLength=new d,this.m_az12=new d,this.m_minGeodeticDist=new d,this.m_segStartPt3d=new u,this.m_segEndPt3d=new u,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=b();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(x(this.m_a,this.m_eSquared,this.m_segStartPt)),this.m_segEndPt3d.assign(x(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 d,!1),n=t(o,new d,!1);g.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 w(e.val,n.val);break}catch(n){o.error=n,o.hasError=!0}finally{e(o)}}case 2:{const t=u.lerp(this.m_segStartPt3d,this.m_segEndPt3d,i);s=T(this.m_a,this.m_eSquared,t);break}case 4:s=w.lerp(this.m_segStartPt,this.m_segEndPt,i),this.m_bIsPannablePcs&&(P(this.m_sr,0,[s],1),s.mulThis(this.m_rpu));break;default:o("Invalid curve type")}return g.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:g.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=w.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 J(){return new L}class K{[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 r,this.m_envGeomB=new r,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 M,this.m_scaleToDegrees=new M,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=b();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 Q(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 _).foldInto360Range(t,this.m_inputSR)),2===this.m_inputSR.getCoordinateSystemType()){const e=p(this.m_inputSR,this.m_inputGCS,null);t=(new _).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 d,!1);return g.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 c=x(this.m_a,this.m_eSquared,r),h=new w,l=s.getImpl(),_=t(a,new d,!1),p=l.getPointCount();for(let t=0;t<p;++t){l.queryXY(t,h),h.scale(this.m_rpu);const e=x(this.m_a,this.m_eSquared,h);if(!(u.distance(c,e)>m)&&(!(this.m_envHelper.minDistanceGeodesic(this.m_boxGeomA,this.m_boxGeomB)>m)&&(g.geodeticDistance(this.m_a,this.m_eSquared,r.x,r.y,h.x,h.y,_,null,null,this.m_distCurveType),_.val<m&&(m=_.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 w,r=new w;e.assign(i.getXY()),r.assign(i.getXY()),o.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(o,a);let c=u<this.m_maxDistance?u:this.m_maxDistance;const h=s.getImpl(),l=new w(0,0),_=new w(0,0),p=[1],d=this.canUseSpatialTree(i,s),g=J();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=h.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(x,i)>c)continue;const s=this.calculateDistanceGeodeticPointSegment(e,r,t,p,P);if(s.second<c&&(this.updateOutputSegment(a,t,s.first),c=s.second,0===c))return 0}return c===this.m_maxDistance?Number.POSITIVE_INFINITY:c}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 d,!1);this.computeEnvelopesAndBoxes(i,s);const m=this.estimateMinimumDistance(n,o);let r=m<this.m_maxDistance?m:this.m_maxDistance;const c=new w,h=new w,l=i.getImpl(),_=s.getImpl(),p=H(),y=l.getPointCount(),P=_.getPointCount();for(let t=0;t<y;++t){if(c.assign(l.getXY(t)),p.setCoords({xmin:c.x,ymin:c.y,xmax:c.x,ymax:c.y}),this.m_envHelper.minDistanceGeodesic(p,this.m_boxGeomB)>r)continue;c.scale(this.m_rpu);const i=x(this.m_a,this.m_eSquared,c);for(let t=0;t<P;++t){h.assign(_.getXY(t)),h.scale(this.m_rpu);const s=x(this.m_a,this.m_eSquared,h);if(!(u.distance(i,s)>=r)&&(g.geodeticDistance(this.m_a,this.m_eSquared,c.x,c.y,h.x,h.y,e,null,null,this.m_distCurveType),e.val<r&&(n.outPoint.assign(c),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 c=new w,h=new w(0,0),l=new w(0,0),_=new w(0,0),p=[0],d=H(),g=t(m,this.createDistanceFunctor(h,l,_),!1),x=J(),P=this.canUseSpatialTree(i,s);P&&this.buildSpatialTree(x,s);const S=i.getPointCount();for(let t=0;t<S;++t)if(c.assign(i.getXY(t)),h.assign(i.getXY(t)),this.m_bIsPannablePcs&&y(this.m_inputSR,[c],1,!1),d.setCoords({xmin:h.x,ymin:h.y,xmax:h.x,ymax:h.y}),!(this.m_envHelper.minDistanceGeodesic(d,this.m_boxGeomB)>u))if(g.setPointDistFrom(h),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(c,h,t,p,g);if(i.second<u&&(o.outPoint.assign(h.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),c=this.calculateDistanceGeodeticMultipathMultipath_(m,r,i,s,u);return a&&(s.outPoint=E(i.outPoint,i.outPoint=s.outPoint)),c}calculateDistanceGeodeticMultipathMultipath_(i,s,o,a,m=Number.MAX_VALUE){const r={stack:[],error:void 0,hasError:!1};try{let e=m;const u=new w(0,0),h=new w,l=new w(0,0),_=new w,p=new w(0,0),d=new w,g=new w,x=new w,y=[new w],f=[0],G=[0],D=H(),v=H(),T=t(r,this.createDistanceFunctor(p,u,l),!1),b=J(),M=this.canUseSpatialTree(i,s);M&&this.buildSpatialTree(b,s);const E=s.querySegmentIterator();E.stripAttributes();const R=new c,C=A(i);for(let t=0;t<C.length;++t){const s=C[t];i.getSegmentBuffer(s,R,!0);const m=R.get();if(D.assign(this.findOrComputeBoxSegment(s,m,this.m_segmentBoxesA)),M)n(0);else{if(p.assign(m.getStartXY()),d.assign(m.getStartXY()),g.assign(m.getEndXY()),x.assign(m.getEndXY()),this.m_bIsPannablePcs&&(P(this.m_inputSR,0,[d],1),P(this.m_inputSR,0,[x],1)),this.m_envHelper.minDistanceGeodesic(D,this.m_boxGeomB)>e)continue;for(;E.nextPath();){for(;E.hasNextSegment();){const t=E.nextSegment();if(u.assign(t.getStartXY()),h.assign(t.getStartXY()),l.assign(t.getEndXY()),_.assign(t.getEndXY()),m.intersect(t,y,f,G,this.m_tolerance))return this.updateOutputSegment(o,m,f[0]),this.updateOutputSegment(a,t,G[0]),0;if(this.m_bIsPannablePcs&&(P(this.m_inputSR,0,[h],1),P(this.m_inputSR,0,[_],1)),v.assign(this.findOrComputeBoxPoint(E.getStartPointIndex(),h,_,this.m_segmentBoxesB)),this.m_envHelper.minDistanceGeodesic(D,v)>e)continue;T.setSegmentEndPoints(u,l),T.setPointDistFrom(d);let i=S(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(x),i=S(T.makeFunctor(),0,1,1e-10),i.second<e&&(o.outPoint.assign(x.mul(this.m_rpu)),this.updateOutputSegment(a,t,i.first),e=i.second,0===e))break;if(T.setSegmentEndPoints(p,g),T.setPointDistFrom(h),i=S(T.makeFunctor(),0,1,1e-10),i.second<e&&(this.updateOutputSegment(o,m,i.first),a.outPoint.assign(h.mul(this.m_rpu)),e=i.second,0===e))break;if(T.setPointDistFrom(_),i=S(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(u){r.error=u,r.hasError=!0}finally{e(r)}}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),S(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=f(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 _).execute(e,t,this.m_progressTracker)}const n=new r;e.queryLooseEnvelope(n);const o=this.m_inputSR.getPannableExtent();if(n.ymin<o.ymin||n.ymax>o.ymax){const t=new r(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=G(e,-2*o.width(),2*o.width(),this.m_inputSR,!0,0,!0,this.m_progressTracker),e):e}prepareGeometryPannable(t,e){const i=new r;t.queryEnvelope(i);const s=this.m_inputSR.getPannableExtent();if(s.containsEnvelope(i))return t;const n=new C;s.queryIntervalX(n);const o=new C;return i.queryIntervalX(o),t=n.contains(o)?D(t,this.m_inputSR):(new _).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&&P(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 r(this.m_envGeomA);return i.mergeEnvelope2D(this.m_envGeomB),h(null,i)}envelopeToPolygon(t){const e=new l;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=1,e[0]=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=4;for(let t=0;t<e.length;++t)e[t]=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&&(P(this.m_inputSR,0,[a],1),P(this.m_inputSR,0,[m],1)),s){e.length=4;for(let t=0;t<e.length;++t)e[t]=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=w.construct(s.xmin,s.ymin),e=w.construct(s.xmax,s.ymax);P(this.m_inputSR,0,[t],1),P(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=>x(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,c=0;for(let t=0;t<o.length;++t)for(let e=0;e<a.length;++e){const i=u.distance(o[t],a[e]);i<m&&(m=i,r=t,c=e)}i.outPoint.assign(this.m_boundaryPtsA[r]),s.outPoint.assign(this.m_boundaryPtsB[c]);const h=t(n,new d,!1);return g.geodeticDistance(this.m_a,this.m_eSquared,this.m_boundaryPtsA[r].x,this.m_boundaryPtsA[r].y,this.m_boundaryPtsB[c].x,this.m_boundaryPtsB[c].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(B(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(B(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,c=t,h=e;if(o===s.enumEnvelope&&(r=this.envelopeToPolygon(t),c=r,o=s.enumPolygon),a===s.enumEnvelope&&(u=this.envelopeToPolygon(e),h=u,a=s.enumPolygon),m(o)&&m(a)){const t=c.querySegmentIterator(),e=h.querySegmentIterator(),s=N(),o=N();if(q(c,h,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(B(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{K as G,Q as a,j as m};
|
|
5
|
+
import{b as t,c as e}from"./tslib.es6.js";import{t as i,G as s,g as n,b as o,v as a,f as m}from"./Geometry.js";import{a as r,O as u,S as c,c as h,h as l}from"./QuadraticBezier.js";import{g as _,e as p,o as d,q as g,y as x,z as y,A as P,B as S,C as f,D as G,h as D,p as v,E as T,s as b}from"./OperatorProject.js";import{P as w,T as M,b as E,d as R,E as C,r as I}from"./Transformation2D.js";import{t as B}from"./CrackAndCluster-CfzXpEle.js";import{s as A,w as q,m as N}from"./Distance2DCalculator-eS0piaux.js";import{O as F}from"./OperatorShapePreservingDensify.js";import{O as X}from"./OperatorClip.js";function Y(){return new r}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 d,this.m_peR2=new d,this.m_peR3=new d,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;g.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,c=v.phiToEta(this.m_e2,u),h=Math.sin(n.val)*Math.cos(c);let l=e;if(m*r<0){const t=m<0?-1:1,e=Math.acos(Math.abs(h))*t;l=v.etaToPhi(this.m_e2,e)/this.m_unitToRad}let _=I((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);g.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),c=this.m_peR1,h=this.m_peR2;g.geodeticDistance(o,0,this.m_unitToRad*i,m,this.m_unitToRad*t,a,c,null,null,0),g.geodeticDistance(o,0,this.m_unitToRad*i,r,this.m_unitToRad*t,a,h,null,null,0);const l=x(1,0,new w(this.m_unitToRad*t,a)),_=x(1,0,new w(this.m_unitToRad*i,m)),p=x(1,0,new w(this.m_unitToRad*i,r));let d=new u;d.setCrossProductVector(_,p);const y=_.dotProduct(p);if(d.length()<1.568e-10)return y>=0?Math.min(c.val,h.val):0;d=d.getUnitVector();let P=new u;if(P.setCrossProductVector(d,l),P.length()<1.568e-10){return Math.min(c.val,h.val)-1e-5*o}P=P.getUnitVector();let S=l.sub(d.mul(l.dotProduct(d)));{const e=new u;e.setCrossProductVector(_,S);const i=new u;i.setCrossProductVector(S,p);let s=d.dotProduct(e)>0&&d.dotProduct(i)>0;if(s||(S.negateThis(),e.setCrossProductVector(_,S),i.setCrossProductVector(S,p),s=d.dotProduct(e)>0&&d.dotProduct(i)>0),s){S=S.getUnitVector();const e=T(1,0,S),i=this.m_peR3;g.geodeticDistance(o,0,this.m_unitToRad*t,a,e.x,e.y,i,null,null,0);const s=Math.min(c.val,h.val);return Math.min(s,i.val)}}return Math.min(c.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 w:t.clone()}}function z(t,e){t.outPoint.assign(e.outPoint)}function H(){return new r}class Q{constructor(t,e,i,s,n=0,o=4){this.m_ptDistFrom=new w,this.m_segStartPt=new w,this.m_segEndPt=new w,this.m_geodeticLength=new d,this.m_az12=new d,this.m_minGeodeticDist=new d,this.m_segStartPt3d=new u,this.m_segEndPt3d=new u,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=b();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(x(this.m_a,this.m_eSquared,this.m_segStartPt)),this.m_segEndPt3d.assign(x(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 d,!1),n=t(o,new d,!1);g.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 w(e.val,n.val);break}catch(n){o.error=n,o.hasError=!0}finally{e(o)}}case 2:{const t=u.lerp(this.m_segStartPt3d,this.m_segEndPt3d,i);s=T(this.m_a,this.m_eSquared,t);break}case 4:s=w.lerp(this.m_segStartPt,this.m_segEndPt,i),this.m_bIsPannablePcs&&(P(this.m_sr,0,[s],1),s.mulThis(this.m_rpu));break;default:o("Invalid curve type")}return g.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:g.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=w.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 J(){return new L}class K{[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 r,this.m_envGeomB=new r,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 M,this.m_scaleToDegrees=new M,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=b();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 Q(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 _).foldInto360Range(t,this.m_inputSR)),2===this.m_inputSR.getCoordinateSystemType()){const e=p(this.m_inputSR,this.m_inputGCS,null);t=(new _).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 d,!1);return g.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 c=x(this.m_a,this.m_eSquared,r),h=new w,l=s.getImpl(),_=t(a,new d,!1),p=l.getPointCount();for(let t=0;t<p;++t){l.queryXY(t,h),h.scale(this.m_rpu);const e=x(this.m_a,this.m_eSquared,h);if(!(u.distance(c,e)>m)&&(!(this.m_envHelper.minDistanceGeodesic(this.m_boxGeomA,this.m_boxGeomB)>m)&&(g.geodeticDistance(this.m_a,this.m_eSquared,r.x,r.y,h.x,h.y,_,null,null,this.m_distCurveType),_.val<m&&(m=_.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 w,r=new w;e.assign(i.getXY()),r.assign(i.getXY()),o.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(o,a);let c=u<this.m_maxDistance?u:this.m_maxDistance;const h=s.getImpl(),l=new w(0,0),_=new w(0,0),p=[1],d=this.canUseSpatialTree(i,s),g=J();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=h.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(x,i)>c)continue;const s=this.calculateDistanceGeodeticPointSegment(e,r,t,p,P);if(s.second<c&&(this.updateOutputSegment(a,t,s.first),c=s.second,0===c))return 0}return c===this.m_maxDistance?Number.POSITIVE_INFINITY:c}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 d,!1);this.computeEnvelopesAndBoxes(i,s);const m=this.estimateMinimumDistance(n,o);let r=m<this.m_maxDistance?m:this.m_maxDistance;const c=new w,h=new w,l=i.getImpl(),_=s.getImpl(),p=H(),y=l.getPointCount(),P=_.getPointCount();for(let t=0;t<y;++t){if(c.assign(l.getXY(t)),p.setCoords({xmin:c.x,ymin:c.y,xmax:c.x,ymax:c.y}),this.m_envHelper.minDistanceGeodesic(p,this.m_boxGeomB)>r)continue;c.scale(this.m_rpu);const i=x(this.m_a,this.m_eSquared,c);for(let t=0;t<P;++t){h.assign(_.getXY(t)),h.scale(this.m_rpu);const s=x(this.m_a,this.m_eSquared,h);if(!(u.distance(i,s)>=r)&&(g.geodeticDistance(this.m_a,this.m_eSquared,c.x,c.y,h.x,h.y,e,null,null,this.m_distCurveType),e.val<r&&(n.outPoint.assign(c),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 c=new w,h=new w(0,0),l=new w(0,0),_=new w(0,0),p=[0],d=H(),g=t(m,this.createDistanceFunctor(h,l,_),!1),x=J(),P=this.canUseSpatialTree(i,s);P&&this.buildSpatialTree(x,s);const S=i.getPointCount();for(let t=0;t<S;++t)if(c.assign(i.getXY(t)),h.assign(i.getXY(t)),this.m_bIsPannablePcs&&y(this.m_inputSR,[c],1,!1),d.setCoords({xmin:h.x,ymin:h.y,xmax:h.x,ymax:h.y}),!(this.m_envHelper.minDistanceGeodesic(d,this.m_boxGeomB)>u))if(g.setPointDistFrom(h),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(c,h,t,p,g);if(i.second<u&&(o.outPoint.assign(h.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),c=this.calculateDistanceGeodeticMultipathMultipath_(m,r,i,s,u);return a&&(s.outPoint=E(i.outPoint,i.outPoint=s.outPoint)),c}calculateDistanceGeodeticMultipathMultipath_(i,s,o,a,m=Number.MAX_VALUE){const r={stack:[],error:void 0,hasError:!1};try{let e=m;const u=new w(0,0),h=new w,l=new w(0,0),_=new w,p=new w(0,0),d=new w,g=new w,x=new w,y=[new w],f=[0],G=[0],D=H(),v=H(),T=t(r,this.createDistanceFunctor(p,u,l),!1),b=J(),M=this.canUseSpatialTree(i,s);M&&this.buildSpatialTree(b,s);const E=s.querySegmentIterator();E.stripAttributes();const R=new c,C=A(i);for(let t=0;t<C.length;++t){const s=C[t];i.getSegmentBuffer(s,R,!0);const m=R.get();if(D.assign(this.findOrComputeBoxSegment(s,m,this.m_segmentBoxesA)),M)n(0);else{if(p.assign(m.getStartXY()),d.assign(m.getStartXY()),g.assign(m.getEndXY()),x.assign(m.getEndXY()),this.m_bIsPannablePcs&&(P(this.m_inputSR,0,[d],1),P(this.m_inputSR,0,[x],1)),this.m_envHelper.minDistanceGeodesic(D,this.m_boxGeomB)>e)continue;for(;E.nextPath();){for(;E.hasNextSegment();){const t=E.nextSegment();if(u.assign(t.getStartXY()),h.assign(t.getStartXY()),l.assign(t.getEndXY()),_.assign(t.getEndXY()),m.intersect(t,y,f,G,this.m_tolerance))return this.updateOutputSegment(o,m,f[0]),this.updateOutputSegment(a,t,G[0]),0;if(this.m_bIsPannablePcs&&(P(this.m_inputSR,0,[h],1),P(this.m_inputSR,0,[_],1)),v.assign(this.findOrComputeBoxPoint(E.getStartPointIndex(),h,_,this.m_segmentBoxesB)),this.m_envHelper.minDistanceGeodesic(D,v)>e)continue;T.setSegmentEndPoints(u,l),T.setPointDistFrom(d);let i=S(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(x),i=S(T.makeFunctor(),0,1,1e-10),i.second<e&&(o.outPoint.assign(x.mul(this.m_rpu)),this.updateOutputSegment(a,t,i.first),e=i.second,0===e))break;if(T.setSegmentEndPoints(p,g),T.setPointDistFrom(h),i=S(T.makeFunctor(),0,1,1e-10),i.second<e&&(this.updateOutputSegment(o,m,i.first),a.outPoint.assign(h.mul(this.m_rpu)),e=i.second,0===e))break;if(T.setPointDistFrom(_),i=S(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(u){r.error=u,r.hasError=!0}finally{e(r)}}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),S(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=f(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 _).execute(e,t,this.m_progressTracker)}const n=new r;e.queryLooseEnvelope(n);const o=this.m_inputSR.getPannableExtent();if(n.ymin<o.ymin||n.ymax>o.ymax){const t=new r(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=G(e,-2*o.width(),2*o.width(),this.m_inputSR,!0,0,!0,this.m_progressTracker),e):e}prepareGeometryPannable(t,e){const i=new r;t.queryEnvelope(i);const s=this.m_inputSR.getPannableExtent();if(s.containsEnvelope(i))return t;const n=new C;s.queryIntervalX(n);const o=new C;return i.queryIntervalX(o),t=n.contains(o)?D(t,this.m_inputSR):(new _).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&&P(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 r(this.m_envGeomA);return i.mergeEnvelope2D(this.m_envGeomB),h(null,i)}envelopeToPolygon(t){const e=new l;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=1,e[0]=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=4;for(let t=0;t<e.length;++t)e[t]=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&&(P(this.m_inputSR,0,[a],1),P(this.m_inputSR,0,[m],1)),s){e.length=4;for(let t=0;t<e.length;++t)e[t]=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=w.construct(s.xmin,s.ymin),e=w.construct(s.xmax,s.ymax);P(this.m_inputSR,0,[t],1),P(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=>x(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,c=0;for(let t=0;t<o.length;++t)for(let e=0;e<a.length;++e){const i=u.distance(o[t],a[e]);i<m&&(m=i,r=t,c=e)}i.outPoint.assign(this.m_boundaryPtsA[r]),s.outPoint.assign(this.m_boundaryPtsB[c]);const h=t(n,new d,!1);return g.geodeticDistance(this.m_a,this.m_eSquared,this.m_boundaryPtsA[r].x,this.m_boundaryPtsA[r].y,this.m_boundaryPtsB[c].x,this.m_boundaryPtsB[c].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(B(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(B(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,c=t,h=e;if(o===s.enumEnvelope&&(r=this.envelopeToPolygon(t),c=r,o=s.enumPolygon),a===s.enumEnvelope&&(u=this.envelopeToPolygon(e),h=u,a=s.enumPolygon),m(o)&&m(a)){const t=c.querySegmentIterator(),e=h.querySegmentIterator(),s=N(),o=N();if(q(c,h,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(B(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{K as G,Q as a,j as m};
|
package/chunks/Geometry.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
function e(e){switch(e){case 1:return"Unknown error";case 2:return"Corrupted geometry";case 3:return"Empty geometry";case 4:return"Math singularity";case 5:return"Buffer is too small";case 6:return"Invalid shape type";case 7:return"Projection out of supported range";case 8:return"Non simple geometry";case 9:return"Cannot calculate geodesic";case 10:return"Notation conversion";case 11:return"Missing grid file";case 12:return"Invalid call";case 13:return"Internal error";case 14:return"Not implemented";case 15:return"IO error";case 16:return"Invalid 3D";case 17:return"An ambiguous geography edge with antipodal points";case 18:return"Geocentric coordinates require ellipsoidal height";case 19:return"Geography cannot be projected into a gnomonic plane or a result of an operation cannot fit into a gnomonic plane";case 20:return"Geometry is too large to be exported in to a given format";case 21:return"Operation is canceled by the user";default:return"unknown error"}}function n(e,n){try{if(!e)throw new Error(n)}catch(t){throw t}}class t extends Error{constructor(e,n){super(),this.m_AdditionalMessage=n,this.m_ErrorType=e}what(){return e(this.m_ErrorType)}additionalMessage(){return this.m_AdditionalMessage?this.m_AdditionalMessage:""}code(){return this.m_ErrorType}}class r extends t{constructor(e){super(2,e),this.name="corrupted geometry exception"}}class o extends t{constructor(e){super(3,e),this.name="empty gemetry exception"}}class i extends t{constructor(e){super(4,e),this.name="match singularity exception"}}class u extends t{constructor(e){super(8,e),this.name="non simple geometry exception"}}var a;!function(e){e[e.enumUnknown=0]="enumUnknown",e[e.enumPoint=513]="enumPoint",e[e.enumLine=5122]="enumLine",e[e.enumBezier=5123]="enumBezier",e[e.enumEllipticArc=5124]="enumEllipticArc",e[e.enumEnvelope=3077]="enumEnvelope",e[e.enumMultiPoint=8710]="enumMultiPoint",e[e.enumPolyline=25607]="enumPolyline",e[e.enumPolygon=27656]="enumPolygon",e[e.enumMultipatch=40969]="enumMultipatch",e[e.enumGeometryCollection=3594]="enumGeometryCollection",e[e.enumRationalBezier2=5134]="enumRationalBezier2",e[e.enumBezier2=5135]="enumBezier2",e[e.enumRationalBezier23d=5392]="enumRationalBezier23d",e[e.enumGreatArc3d=5393]="enumGreatArc3d"}(a||(a={}));const s=[0,0,1,1,1,2,0,1,2,3,-1,-1,-1,-1,1,1];function c(e){return s[15&e]}function m(e){return!!(512&e)}function l(e){return!!(1024&e)}function p(e){return!!(2048&e)}function f(e){return!!(4096&e)}function d(e){return!!(8192&e)}function y(e){return!!(16384&e)}function g(e){return!!(32768&e)}function h(e){const n=e.getGeometryType();return d(n)?e.getPointCount():e.isEmpty()?0:n===a.enumEnvelope?4:n===a.enumPoint?1:f(n)?2:void A("missing type")}function w(e){const n=e.getGeometryType();if(y(n))return e.hasNonLinearSegments();if(n===a.enumGeometryCollection){const n=e;for(let e=0,t=n.getGeometryCount();e<t;e++)if(w(n.getGeometry(e)))return!0;return!1}return!!f(n)&&n!==a.enumLine}function G(e){throw new r(e)}function x(e){const n=new Error(e);throw n.name="invalid argument exception",n}function E(e){const n=new i(e);throw n.name="invalid argument exception",n}function v(){x("Geometry type is not supported for 3D operations.")}function P(e){throw new t(12,e)}function B(e){throw new o(e)}function M(e){const n=new t(14,e);throw n.name="not implemented",n}function z(e){const n=new Error(e);throw n.name="out of range exception",n}function A(e){const n=new t(13,e);throw n.name="internal error",n}function C(e){const n=new Error(e);throw n.name="logic error exception",n}function b(e){throw new u(e)}function k(){M("operation does not support curves yet")}function T(e){e&&w(e)&&k()}function _(e){e&&g(e.getGeometryType())&&M("Unsupported geometry type.")}function I(e){e===a.enumGeometryCollection&&x("Geometry_collection instances are not supported in this operation")}function L(e){I(e.getGeometryType())}function N(e){x(`bad wkid: ${e}`)}function R(e){let n="bad wkt: ";n+=e,n+="...",x(n)}function U(e,n){e||x(n)}export{U as A,N as B,R as C,a as G,
|
|
5
|
+
function e(e){switch(e){case 1:return"Unknown error";case 2:return"Corrupted geometry";case 3:return"Empty geometry";case 4:return"Math singularity";case 5:return"Buffer is too small";case 6:return"Invalid shape type";case 7:return"Projection out of supported range";case 8:return"Non simple geometry";case 9:return"Cannot calculate geodesic";case 10:return"Notation conversion";case 11:return"Missing grid file";case 12:return"Invalid call";case 13:return"Internal error";case 14:return"Not implemented";case 15:return"IO error";case 16:return"Invalid 3D";case 17:return"An ambiguous geography edge with antipodal points";case 18:return"Geocentric coordinates require ellipsoidal height";case 19:return"Geography cannot be projected into a gnomonic plane or a result of an operation cannot fit into a gnomonic plane";case 20:return"Geometry is too large to be exported in to a given format";case 21:return"Operation is canceled by the user";default:return"unknown error"}}function n(e,n){try{if(!e)throw new Error(n)}catch(t){throw t}}class t extends Error{constructor(e,n){super(),this.m_AdditionalMessage=n,this.m_ErrorType=e}what(){return e(this.m_ErrorType)}additionalMessage(){return this.m_AdditionalMessage?this.m_AdditionalMessage:""}code(){return this.m_ErrorType}}class r extends t{constructor(e){super(2,e),this.name="corrupted geometry exception"}}class o extends t{constructor(e){super(3,e),this.name="empty gemetry exception"}}class i extends t{constructor(e){super(4,e),this.name="match singularity exception"}}class u extends t{constructor(e){super(8,e),this.name="non simple geometry exception"}}var a;!function(e){e[e.enumUnknown=0]="enumUnknown",e[e.enumPoint=513]="enumPoint",e[e.enumLine=5122]="enumLine",e[e.enumBezier=5123]="enumBezier",e[e.enumEllipticArc=5124]="enumEllipticArc",e[e.enumEnvelope=3077]="enumEnvelope",e[e.enumMultiPoint=8710]="enumMultiPoint",e[e.enumPolyline=25607]="enumPolyline",e[e.enumPolygon=27656]="enumPolygon",e[e.enumMultipatch=40969]="enumMultipatch",e[e.enumGeometryCollection=3594]="enumGeometryCollection",e[e.enumRationalBezier2=5134]="enumRationalBezier2",e[e.enumBezier2=5135]="enumBezier2",e[e.enumRationalBezier23d=5392]="enumRationalBezier23d",e[e.enumGreatArc3d=5393]="enumGreatArc3d"}(a||(a={}));const s=[0,0,1,1,1,2,0,1,2,3,-1,-1,-1,-1,1,1];function c(e){return s[15&e]}function m(e){return!!(512&e)}function l(e){return!!(1024&e)}function p(e){return!!(2048&e)}function f(e){return!!(4096&e)}function d(e){return!!(8192&e)}function y(e){return!!(16384&e)}function g(e){return!!(32768&e)}function h(e){const n=e.getGeometryType();return d(n)?e.getPointCount():e.isEmpty()?0:n===a.enumEnvelope?4:n===a.enumPoint?1:f(n)?2:void A("missing type")}function w(e){const n=e.getGeometryType();if(y(n))return e.hasNonLinearSegments();if(n===a.enumGeometryCollection){const n=e;for(let e=0,t=n.getGeometryCount();e<t;e++)if(w(n.getGeometry(e)))return!0;return!1}return!!f(n)&&n!==a.enumLine}function G(e){throw new r(e)}function x(e){const n=new Error(e);throw n.name="invalid argument exception",n}function E(e){const n=new i(e);throw n.name="invalid argument exception",n}function v(){x("Geometry type is not supported for 3D operations.")}function P(e){throw new t(12,e)}function B(e){throw new o(e)}function M(e){const n=new t(14,e);throw n.name="not implemented",n}function z(e){const n=new Error(e);throw n.name="out of range exception",n}function A(e){const n=new t(13,e);throw n.name="internal error",n}function C(e){const n=new Error(e);throw n.name="logic error exception",n}function b(e){throw new u(e)}function k(){M("operation does not support curves yet")}function T(e){e&&w(e)&&k()}function _(e){e&&g(e.getGeometryType())&&M("Unsupported geometry type.")}function I(e){e===a.enumGeometryCollection&&x("Geometry_collection instances are not supported in this operation")}function L(e){I(e.getGeometryType())}function N(e){x(`bad wkid: ${e}`)}function R(e){let n="bad wkt: ";n+=e,n+="...",x(n)}function U(e,n){e||x(n)}export{U as A,N as B,R as C,a as G,M as a,A as b,_ as c,c as d,f as e,y as f,n as g,m as h,d as i,I as j,b as k,v as l,L as m,w as n,G as o,T as p,g as q,p as r,l as s,x as t,P as u,h as v,z as w,E as x,B as y,C as z};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{G as t,e,
|
|
5
|
+
import{G as t,f as e,a as n}from"./Geometry.js";function i(i,a){const f=i.getGeometryType();return f===t.enumPoint?r(i):e(f)?u(i):f===t.enumMultiPoint?o(i):f===t.enumEnvelope?i:f===t.enumMultipatch?(n("not implemented for multipatch"),i):i}function r(t){return t}function u(e){if(a(e))return e;const n=e.createInstance();for(let i=0,r=e.getPathCount();i<r;i++){const r=e.getPathSize(i);if(0!==r){if(1===r){if(0===e.getSegmentCountPath(i))continue;if(e.getSegmentType(e.getPathStart(i))===t.enumLine)continue;if(!e.isClosedPath(i))continue}n.addPath(e,i,!0)}}return n}function o(t){return t}function a(e){for(let n=0,i=e.getPathCount();n<i;n++){const i=e.getPathSize(n);if(0===i)return!1;if(1===i){if(0===e.getSegmentCountPath(n))return!1;if(e.getSegmentType(e.getPathStart(n))===t.enumLine)return!1;if(!e.isClosedPath(n))return!1}}return!0}export{i as c};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.32/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{G as e,g as t,
|
|
5
|
+
import{G as e,g as t,d as r,b as s}from"./Geometry.js";import{S as n}from"./SimpleGeometryCursor.js";import{H as i,b as o,a as m,M as c,E as p,i as u,h as a}from"./QuadraticBezier.js";import{c as h}from"./Clipper-a9xfvRaw.js";import{b as l}from"./Transformation2D.js";import{i as _,c as y,e as G,f,g as E}from"./OperatorSimplify.js";function g(t,r,s){const n=new m;t.queryEnvelope(n);const i=new m;r.queryEnvelope(i);const o=new m(i);if(o.inflate(2*s),!o.isIntersecting(n))return 4;const c=t.getGeometryType(),p=r.getGeometryType();if(c===e.enumEnvelope&&n.containsEnvelope(o))return 1;if(p===e.enumEnvelope){const e=new m(n);if(e.inflate(2*s),i.containsEnvelope(e))return 2}return 0}class T{constructor(t,r,s,n){this.m_intersectorGeom=null,this.m_sr=null,this.m_dimensionMask=-1,this.m_progressTracker=null,this.m_intersectorGeomType=e.enumUnknown,this.m_geomIntersectorEmptyGeom=null,this.m_intersectorGeom=t,this.m_sr=r,this.m_dimensionMask=s,this.m_progressTracker=n,this.m_intersectorGeomType=t.getGeometryType()}intersect(e){const t=this.tryFastImplementation(e);if(null!==t)return t;const r=i(this.m_intersectorGeom,e),s=o(this.m_sr,r,!0).total(),n=m.constructEmpty();this.m_intersectorGeom.queryEnvelope(n);const c=m.constructEmpty();e.queryEnvelope(c),n.inflateCoords(2*s,2*s),n.intersect(c),n.inflateCoords(100*s,100*s);const p=0;let u=h(this.m_intersectorGeom,n,p,0,this.m_progressTracker),a=h(e,n,p,0,this.m_progressTracker);return e.getDimension()>this.m_intersectorGeom.getDimension()&&(u=l(a,a=u)),_(a,u,this.m_sr,this.m_progressTracker)}intersectEx(e){const t=this.tryFastImplementation(e);if(null!==t){const r=[];return r.length=3,r[t.getDimension()]=t,this.prepareVector(e.getDescription(),this.m_dimensionMask,r)}const r=i(this.m_intersectorGeom,e),s=o(this.m_sr,r,!0).total(),n=m.constructEmpty();this.m_intersectorGeom.queryEnvelope(n);const c=m.constructEmpty();e.queryEnvelope(c),n.inflateCoords(2*s,2*s),n.intersect(c),n.inflateCoords(100*s,100*s);const p=0;let u=h(this.m_intersectorGeom,n,p,0,this.m_progressTracker),a=h(e,n,p,0,this.m_progressTracker);e.getDimension()>this.m_intersectorGeom.getDimension()&&(u=l(a,a=u));const _=y(a,u,this.m_sr,this.m_progressTracker);return this.prepareVector(e.getDescription(),this.m_dimensionMask,_)}init(e,r,s,n=null){t(0)}static intersectPoints(e,t,r){const s=i(e,t),n=o(r,s,!0);return G(e,t,n)}tryFastImplementation(t){const n=t.getGeometryType();if(this.m_intersectorGeomType===e.enumPoint&&n===e.enumPoint){const e=T.intersectPoints(t,this.m_intersectorGeom,this.m_sr);if(-1!==this.m_dimensionMask){const t=new c({vd:e.getDescription()});return e.isEmpty()||t.add(e),t}return e}if(n===e.enumEnvelope&&this.m_intersectorGeomType===e.enumEnvelope&&(-1===this.m_dimensionMask||4===this.m_dimensionMask)){const e=t,r=this.m_intersectorGeom,s=new p({copy:e});return s.intersect(r),s}const u=i(t,this.m_intersectorGeom),a=o(this.m_sr,u,!0),l=t.isEmpty(),_=this.m_intersectorGeom.isEmpty();let y=l||_;if(!y){const e=g(this.m_intersectorGeom,t,a.total());if(4===e)y=!0;else{if(2&e)return this.m_intersectorGeom;if(1&e)return t}}if(y){const s=r(n),i=r(this.m_intersectorGeomType);return s<i?T.ReturnEmpty(t,l):s>i||0===s&&n===e.enumMultiPoint&&this.m_intersectorGeomType===e.enumPoint?this.ReturnEmptyIntersector():T.ReturnEmpty(t,l)}if(n===e.enumEnvelope&&0===r(this.m_intersectorGeomType)||this.m_intersectorGeomType===e.enumEnvelope&&0===r(n)){const r=n===e.enumEnvelope?t:this.m_intersectorGeom,s=n===e.enumEnvelope?this.m_intersectorGeom:t,i=m.constructEmpty();return r.queryEnvelope(i),h(s,i,a.total(),0,this.m_progressTracker)}if(0===r(n)&&r(this.m_intersectorGeomType)>0||r(n)>0&&0===r(this.m_intersectorGeomType)){if(n===e.enumMultiPoint)return f(t,this.m_intersectorGeom,a);if(n===e.enumPoint)return E(t,this.m_intersectorGeom,a);if(this.m_intersectorGeomType===e.enumMultiPoint)return f(this.m_intersectorGeom,t,a);if(this.m_intersectorGeomType===e.enumPoint)return E(this.m_intersectorGeom,t,a);s("")}return null}ReturnEmptyIntersector(){return null===this.m_geomIntersectorEmptyGeom&&(this.m_geomIntersectorEmptyGeom=this.m_intersectorGeom.createInstance()),this.m_geomIntersectorEmptyGeom}static ReturnEmpty(e,t){return t?e:e.createInstance()}prepareVector(e,t,r){let s=0;return 1&t?(r[0]||(r[0]=new c({vd:e})),s++):r.shift(),2&t?(r[s]||(r[s]=new u({vd:e})),s++):r.splice(s,1),4&t?r[s]||(r[s]=new a({vd:e})):r.splice(s,1),new n(r)}}export{T as I};
|