@arcgis/core 5.2.0-next.74 → 5.2.0-next.76
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/arcgisGlobal.d.ts +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/013c9cc198736a72f7f2.js +1 -0
- package/assets/esri/core/workers/chunks/0194244a3f437ad74045.js +1 -0
- package/assets/esri/core/workers/chunks/0502641d9a214b37ff29.js +1 -0
- package/assets/esri/core/workers/chunks/{4dcd4a052b40047a9230.js → 08cac27df6c216ae1995.js} +1 -1
- package/assets/esri/core/workers/chunks/08ec5461af74356e7570.js +1 -0
- package/assets/esri/core/workers/chunks/0909816f13d25cacf250.js +1 -0
- package/assets/esri/core/workers/chunks/0933203eee15ea50e123.js +1 -0
- package/assets/esri/core/workers/chunks/0d9fe49812554e7d7ba7.js +1 -0
- package/assets/esri/core/workers/chunks/{0e81c6d4f1c81f9b0a1b.js → 1142f8e9c80207d6bdae.js} +1 -1
- package/assets/esri/core/workers/chunks/16929524565a677db4dc.js +1 -0
- package/assets/esri/core/workers/chunks/16a04fc184728d66e6e1.js +1 -0
- package/assets/esri/core/workers/chunks/177c3b23c1cbd4737049.js +1 -0
- package/assets/esri/core/workers/chunks/18e0e993c0c39c962e61.js +1 -0
- package/assets/esri/core/workers/chunks/1a467da4c0b33f655199.js +1 -0
- package/assets/esri/core/workers/chunks/1ef28d4457c8c943ad19.js +1 -0
- package/assets/esri/core/workers/chunks/20b54e7872d967f3be32.js +1 -0
- package/assets/esri/core/workers/chunks/{5f31b375971ab067121e.js → 21f763694a41968ac21a.js} +1 -1
- package/assets/esri/core/workers/chunks/230925079cee040a8d77.js +1 -0
- package/assets/esri/core/workers/chunks/2501d9459f6d14c797e5.js +1 -0
- package/assets/esri/core/workers/chunks/257f1e8316877f611e11.js +1 -0
- package/assets/esri/core/workers/chunks/270ed3070d118edb3f37.js +1 -0
- package/assets/esri/core/workers/chunks/2740f755c3a322cbd477.js +1 -0
- package/assets/esri/core/workers/chunks/2e7c830b5b1fe406169f.js +1 -0
- package/assets/esri/core/workers/chunks/2f4ed8a63d57636a4ebe.js +1 -0
- package/assets/esri/core/workers/chunks/{31d19bb72a9e79b30070.js → 30818b5ff0ce51b25d6f.js} +1 -1
- package/assets/esri/core/workers/chunks/315031323e11a18154e3.js +1 -0
- package/assets/esri/core/workers/chunks/393f79843d5a78c1cc37.js +1 -0
- package/assets/esri/core/workers/chunks/3b5c5356353f1a2303a0.js +1 -0
- package/assets/esri/core/workers/chunks/3c28e2040cb4fb716eaa.js +1 -0
- package/assets/esri/core/workers/chunks/{99e3aa4832ed87474ab4.js → 44857a76be2c0ac65bb9.js} +1 -1
- package/assets/esri/core/workers/chunks/44a786aba84918f2b247.js +1 -0
- package/assets/esri/core/workers/chunks/{3e2b4e734aa20a308f3e.js → 46e56fac44e0fd26ba1d.js} +1 -1
- package/assets/esri/core/workers/chunks/{4491dc227c28e2ab4f8e.js → 484b251fbcbffcb58323.js} +1 -1
- package/assets/esri/core/workers/chunks/48e2d0bfb62e1f4f2ad9.js +1 -0
- package/assets/esri/core/workers/chunks/4945d6b0ca1812864185.js +1 -0
- package/assets/esri/core/workers/chunks/{7f2f2a92dce3f68e579b.js → 4b54444c04fbd6f42c18.js} +1 -1
- package/assets/esri/core/workers/chunks/4c82f5f23004f905a18f.js +1 -0
- package/assets/esri/core/workers/chunks/4d7a3b3aaf876da0891b.js +1 -0
- package/assets/esri/core/workers/chunks/4f8ce5887102971bfa34.js +2 -0
- package/assets/esri/core/workers/chunks/50b08415e072a49bc572.js +1 -0
- package/assets/esri/core/workers/chunks/{186bedc377cc97731ca2.js → 532e3a59888e4cc13bd3.js} +2 -2
- package/assets/esri/core/workers/chunks/53eed0941a39b56cc034.js +1 -0
- package/assets/esri/core/workers/chunks/{1a3afee3ecd806b4aa81.js → 552d6aecc7d88d16227b.js} +1 -1
- package/assets/esri/core/workers/chunks/56e6d8c4a9ed893ce951.js +1 -0
- package/assets/esri/core/workers/chunks/57159bcac86d660dcceb.js +1 -0
- package/assets/esri/core/workers/chunks/58026fc30d8a0ded4102.js +1 -0
- package/assets/esri/core/workers/chunks/59598023c0aea62a6297.js +1 -0
- package/assets/esri/core/workers/chunks/5bf2ce280ea35ea4c96b.js +1 -0
- package/assets/esri/core/workers/chunks/5fd2aa0be03dfb494efa.js +1 -0
- package/assets/esri/core/workers/chunks/619aa1381296172ff47b.js +1 -0
- package/assets/esri/core/workers/chunks/62f37d1075390a177ae9.js +1 -0
- package/assets/esri/core/workers/chunks/{2baa16ec8559e77c226f.js → 64a1ffc221e5b63b43fb.js} +1 -1
- package/assets/esri/core/workers/chunks/65d1e338612e59063eba.js +1 -0
- package/assets/esri/core/workers/chunks/680dd7b7638465eb33de.js +1 -0
- package/assets/esri/core/workers/chunks/69b0dcd7bcd8ec42e2c3.js +1 -0
- package/assets/esri/core/workers/chunks/6c740c411b085d2d08c4.js +1 -0
- package/assets/esri/core/workers/chunks/6c982779d6d47ec99899.js +1 -0
- package/assets/esri/core/workers/chunks/6dddd3df31961b9fda12.js +1 -0
- package/assets/esri/core/workers/chunks/{1ca04ecf010e68863014.js → 6e45ecf359bce3417f5d.js} +1 -1
- package/assets/esri/core/workers/chunks/702b2381acf4d1f90094.js +1 -0
- package/assets/esri/core/workers/chunks/{a52c88e2d837b525ff6c.js → 71ee7c51d2c60a180f1e.js} +1 -1
- package/assets/esri/core/workers/chunks/{ad1d06a91121ebfe9162.js → 755b2d883fba90c4e688.js} +2 -2
- package/assets/esri/core/workers/chunks/75fc0b1db8e2e3fd2458.js +1 -0
- package/assets/esri/core/workers/chunks/{9e25f715cda59c686a4c.js → 792303e4090c0c70c4ff.js} +1 -1
- package/assets/esri/core/workers/chunks/79429c8be5da85713200.js +1 -0
- package/assets/esri/core/workers/chunks/7b470d6ad182548b9e95.js +1 -0
- package/assets/esri/core/workers/chunks/7d8eb4dbea1916320f74.js +1 -0
- package/assets/esri/core/workers/chunks/83e54166ba634ec2bd89.js +1717 -0
- package/assets/esri/core/workers/chunks/841c81c280114412c95b.js +1 -0
- package/assets/esri/core/workers/chunks/87eaed6fdabd482d142e.js +1 -0
- package/assets/esri/core/workers/chunks/88d5541679e77117bf03.js +1 -0
- package/assets/esri/core/workers/chunks/894ebc64b698e5d7604b.js +1 -0
- package/assets/esri/core/workers/chunks/8a36b999cbd65dd2f16c.js +1 -0
- package/assets/esri/core/workers/chunks/8ae3a6ddc87bf8315583.js +1 -0
- package/assets/esri/core/workers/chunks/{67f54586156d1ab80257.js → 8b980c6b92cc4ea68ede.js} +1 -1
- package/assets/esri/core/workers/chunks/8d9a7fa14489897780d3.js +1 -0
- package/assets/esri/core/workers/chunks/8e225dd0319672103561.js +1 -0
- package/assets/esri/core/workers/chunks/9199300ffd225a1bbef1.js +1 -0
- package/assets/esri/core/workers/chunks/94b9a61b4dbb83425a78.js +1 -0
- package/assets/esri/core/workers/chunks/98613fded899c59f34a4.js +1 -0
- package/assets/esri/core/workers/chunks/{9ca59077712e45ef4d56.js → 9c3e6325dc60bcaf44d7.js} +1 -1
- package/assets/esri/core/workers/chunks/9e1392a0c608a13ab036.js +1 -0
- package/assets/esri/core/workers/chunks/9e2e4d197a7a57c2a691.js +1 -0
- package/assets/esri/core/workers/chunks/{d03e7be74c57c3dbf003.js → a014c17fc210620da738.js} +2 -2
- package/assets/esri/core/workers/chunks/{8302bffd28cc6720e0fe.js → a19be304219808268039.js} +2 -2
- package/assets/esri/core/workers/chunks/{bd311c85437743cf7d2f.js → a4e4fa4dd1a122bbf7cd.js} +1 -1
- package/assets/esri/core/workers/chunks/a5240c8a47842138f31f.js +1 -0
- package/assets/esri/core/workers/chunks/a69c10bfd632a5546b34.js +1 -0
- package/assets/esri/core/workers/chunks/{b6d26d9738c0787acc38.js → a6a2a4a2bae0d327d7ed.js} +1 -1
- package/assets/esri/core/workers/chunks/a7727a2377470d586ff9.js +1 -0
- package/assets/esri/core/workers/chunks/a91c1d782346a9c7e1ef.js +1 -0
- package/assets/esri/core/workers/chunks/{6cd6d0cfd313f0475d98.js → ac59218847e5ef4c4160.js} +1 -1
- package/assets/esri/core/workers/chunks/ac87be2210f868524996.js +1 -0
- package/assets/esri/core/workers/chunks/aed16c3e26652960ad3f.js +1 -0
- package/assets/esri/core/workers/chunks/b084829a3fd709dc47a8.js +1 -0
- package/assets/esri/core/workers/chunks/{05f6887805d92da03122.js → b24fc7eeda580ef020d2.js} +1 -1
- package/assets/esri/core/workers/chunks/b37a20c5c4a4686257d4.js +1 -0
- package/assets/esri/core/workers/chunks/{a0a1f0bd3648738354a6.js → b4abf82b8ac974a55ae1.js} +1 -1
- package/assets/esri/core/workers/chunks/b950ddafba8125c84a5b.js +1 -0
- package/assets/esri/core/workers/chunks/b9d1bb106737a05290e1.js +1 -0
- package/assets/esri/core/workers/chunks/bab5f4b2424b487b87ac.js +1 -0
- package/assets/esri/core/workers/chunks/bad2c7219e95750906e1.js +1 -0
- package/assets/esri/core/workers/chunks/bbc6b270d2032189107c.js +1 -0
- package/assets/esri/core/workers/chunks/{faa55265020591fd2224.js → bc0395777c5c1adb1ddb.js} +1 -1
- package/assets/esri/core/workers/chunks/bc6e488f5fbd50f9f3d0.js +1 -0
- package/assets/esri/core/workers/chunks/bd7d87d175ba933ab2ce.js +1 -0
- package/assets/esri/core/workers/chunks/{859dd86c921053bf03a1.js → c17dda6fadb8bfad0d51.js} +1 -1
- package/assets/esri/core/workers/chunks/c1e5ffe9a251be5a0744.js +1 -0
- package/assets/esri/core/workers/chunks/{94368a097e6190ce3c7a.js → c37b28f200b704ae6002.js} +1 -1
- package/assets/esri/core/workers/chunks/ca6652c6304ad0e37e8f.js +1 -0
- package/assets/esri/core/workers/chunks/{762be5d3e6aeaea33f74.js → cef02ed3942c010da2e8.js} +1 -1
- package/assets/esri/core/workers/chunks/cff6390b863361eaeeed.js +1 -0
- package/assets/esri/core/workers/chunks/d2172583ee6e481a66aa.js +1 -0
- package/assets/esri/core/workers/chunks/d520d407043bc52e5410.js +1 -0
- package/assets/esri/core/workers/chunks/da0ef984509057ec8507.js +1 -0
- package/assets/esri/core/workers/chunks/dbdd96e558936955acdb.js +1 -0
- package/assets/esri/core/workers/chunks/ddd8f6154e265dbb6f9f.js +1 -0
- package/assets/esri/core/workers/chunks/de601f0d5a2a282d2efd.js +1 -0
- package/assets/esri/core/workers/chunks/de927b1460bc384f5b87.js +1 -0
- package/assets/esri/core/workers/chunks/de9a1cce70581920f248.js +1 -0
- package/assets/esri/core/workers/chunks/dff932682d6386a861ce.js +1 -0
- package/assets/esri/core/workers/chunks/{2c31648a4b95275516ee.js → e227eb44cd139fe2bc1b.js} +1 -1
- package/assets/esri/core/workers/chunks/e4e5a171a4874c5af4a4.js +1 -0
- package/assets/esri/core/workers/chunks/{fdca9873914b9dbd9244.js → e59101f1d060d0a30a65.js} +1 -1
- package/assets/esri/core/workers/chunks/{ddb92c815d17c67a45e6.js → e5d114f2b57d2b8e2f1c.js} +1 -1
- package/assets/esri/core/workers/chunks/e89e6eea380ca2c13b64.js +1 -0
- package/assets/esri/core/workers/chunks/e9d352d030dcad1619a6.js +1 -0
- package/assets/esri/core/workers/chunks/{3de6e54b6ed0feae1940.js → eae51e827f629ab37207.js} +1 -1
- package/assets/esri/core/workers/chunks/eee1fd629619021ea279.js +1 -0
- package/assets/esri/core/workers/chunks/ef47a5da641cb0d33fdf.js +1 -0
- package/assets/esri/core/workers/chunks/f35e749bb5be39880cbe.js +1 -0
- package/assets/esri/core/workers/chunks/{3dff36f6de181d9dcdc5.js → f40e4433e7608d0962a6.js} +1 -1
- package/assets/esri/core/workers/chunks/f4aa6e90200f61e623e5.js +1 -0
- package/assets/esri/core/workers/chunks/ff578f0ca68d652fece5.js +1 -0
- package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
- package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
- package/assets/esri/libs/text/pkg/bundle_bg.wasm +0 -0
- package/chunks/GaussianSplat.glsl.js +8 -8
- package/chunks/GaussianSplatShadow.glsl.js +4 -5
- package/chunks/HeatmapDensity.glsl.js +5 -5
- package/chunks/OccludedGeometryDepth.glsl.js +5 -0
- package/chunks/ShadowCastVisualize.glsl.js +2 -2
- package/chunks/bundle2.js +1 -1
- package/chunks/lyr3DMain.js +1 -1
- package/chunks/lyr3DWorker.js +1 -1
- package/config.js +1 -1
- package/core/importUtils.js +2 -0
- package/geometry/geometryEngine.js +1 -1
- package/geometry/operators/importUtils.js +2 -0
- package/geometry/support/centroid.js +1 -1
- package/geometry/support/curves/densifyCurvedGeometry.js +1 -1
- package/geometry/support/extentUtils.js +1 -1
- package/geometry/support/frustum.js +1 -1
- package/geometry/support/normalizeUtils.d.ts +17 -15
- package/geometry/support/normalizeUtils.js +1 -1
- package/kernel.js +1 -1
- package/layers/FeatureLayer.d.ts +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/graphics/data/QueryEngine.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/data/projectionSupport.js +1 -1
- package/layers/graphics/data/queryUtils.js +1 -1
- package/layers/graphics/hydratedFeatures.js +1 -1
- package/layers/graphics/sources/support/sourceUtils.js +1 -1
- package/package.json +2 -2
- package/portal/schemas/definitions.js +1 -1
- package/rest/geoprocessor/utils.js +1 -1
- package/rest/identify.js +1 -1
- package/rest/imageService.js +1 -1
- package/rest/query/operations/query.js +1 -1
- package/rest/query/operations/queryAttributeBins.js +1 -1
- package/rest/query/operations/queryPivot.js +1 -1
- package/rest/query/operations/queryTopFeatures.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMEffects.js +1 -1
- package/symbols/cim/animationUtils.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/cim/effects/EffectCircularSector.js +1 -1
- package/symbols/cim/utils.js +1 -1
- package/views/2d/engine/BitmapTile.js +1 -1
- package/views/2d/engine/flow/styles/Imagery.js +1 -1
- package/views/2d/engine/flow/styles/Particles.js +1 -1
- package/views/2d/engine/flow/styles/Streamlines.js +1 -1
- package/views/2d/engine/imagery/RasterTile.js +1 -1
- package/views/2d/engine/imagery/RasterVFTile.js +1 -1
- package/views/2d/engine/vectorTiles/SpriteMosaic.js +1 -1
- package/views/2d/engine/vectorTiles/TileHandler3D.js +1 -1
- package/views/2d/engine/vectorTiles/VTLPainter3D.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileContainer.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileRendererHelper3D.js +1 -1
- package/views/2d/engine/webgl/FeatureDisplayList.js +1 -1
- package/views/2d/engine/webgl/Painter.js +1 -1
- package/views/2d/engine/webgl/RenderingDevice.js +1 -1
- package/views/2d/engine/webgl/TileContainer.js +1 -1
- package/views/2d/engine/webgl/TiledDisplayObject.js +1 -1
- package/views/2d/engine/webgl/animations/infos.js +1 -1
- package/views/2d/engine/webgl/animations/instructions.js +1 -1
- package/views/2d/engine/webgl/normalizedTileUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/GraphShaderModule.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/graph/ShaderGraphContext.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedLineShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/bitmap/BitmapTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityPointShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/drop-shadow/DropShadowTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/ComplexOutlineFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/FillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/GradientFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/OutlineFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/PatternOutlineFillTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/flow/FlowTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/GradientStrokeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/LineTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/line/TexturedLineTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/overlay/OverlayTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/VectorFieldTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/AFeatureShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BitmapShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/BlendShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ComplexFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/FillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/GradientFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/GradientStrokeShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/HeatmapAccumulateShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/OutlineFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/PatternFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TexturedLineShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/Tile.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TileInfo.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/ViewInfo.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/BaseRasterColorizerShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/MagDirShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/ScalarShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderBackground.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderCircle.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderFill.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderIcon.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderLine.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderOutline.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/vector-tiles/VTLShaderText.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileDebugInfoTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileStencilTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/utility/DebugOverlayTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueBackground.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueCircle.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueLine.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueSymbol.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/typed/TypedShaderProgram.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/types.js +2 -0
- package/views/2d/engine/webgl/shaderGraph/uniformBufferUtils.js +2 -0
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/support/DisplayGL.js +1 -1
- package/views/2d/layers/support/RouteLayerInteraction.js +1 -1
- package/views/2d/viewpointUtils.js +1 -1
- package/views/3d/environment/EnvironmentManager.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/manipulatorUtils.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/VerticesVisualElement.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/VectorTileLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/support/GaussianSplatSortWorker.js +1 -1
- package/views/3d/support/GaussianSplatWorkerHandle.js +1 -1
- package/views/3d/support/flow/geometryUtils.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/support/renderInfoUtils/line.js +1 -1
- package/views/3d/support/renderInfoUtils/polygon.js +1 -1
- package/views/3d/terrain/DrapedZ.js +2 -0
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TileCompositor.js +1 -1
- package/views/3d/webgl/RenderCamera.js +1 -1
- package/views/3d/webgl/RenderNode.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBuffer.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatCovariance.glsl.js +8 -3
- package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatEvaluation.glsl.js +8 -2
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowAccumulator.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastAccumulate.glsl.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastAccumulateTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastAccumulateTechniqueConfiguration.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastClear.glsl.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastClearTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastMaskTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastRenderer.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastVisualize.glsl.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastVisualizeTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastVisualizeTechniqueConfiguration.js +2 -0
- package/views/3d/webgl-engine/lib/CutFillVisualization.js +1 -1
- package/views/3d/webgl-engine/lib/PositionReader.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBuffer.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFields.js +1 -1
- package/views/3d/webgl-engine/lib/screenPolygonOverlapUtils.js +1 -1
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatPass.glsl.js +28 -21
- package/views/3d/webgl-engine/shaders/HeatmapDensity.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HeatmapDensityTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/OccludedGeometryDepth.glsl.js +2 -0
- package/views/3d/webgl-engine/shaders/OccludedGeometryDepthTechnique.js +2 -0
- package/views/VideoView.js +1 -1
- package/views/selection/SelectionOperation.js +1 -1
- package/views/webgl/RenderingContext.js +1 -1
- package/views/webgl/UniformBufferLayout.js +1 -1
- package/views/webgl/UniformBufferObject.js +1 -1
- package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +20 -6
- package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/MultipleChoiceController.d.ts +100 -0
- package/widgets/BatchAttributeForm/inputs/support/MultipleChoiceController.js +2 -0
- package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/multipleChoiceInputUtils.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/widgets/UtilityNetworkTrace/support/GeometryHandler.js +1 -1
- package/widgets/UtilityNetworkTrace/support/ResultAreaHandler.js +1 -1
- package/widgets/support/SelectionList/GroupLayerItem.d.ts +8 -1
- package/widgets/support/SelectionList/GroupLayerItem.js +1 -1
- package/widgets/support/SelectionList/LayerItem.d.ts +8 -1
- package/widgets/support/SelectionList/LayerItem.js +1 -1
- package/widgets/support/SelectionList/SelectionListViewModel.d.ts +29 -1
- package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
- package/widgets/support/SelectionList.js +1 -1
- package/widgets/support/SelectionToolbar.js +1 -1
- package/assets/esri/core/workers/chunks/01c92e68fb17cf2d0e08.js +0 -1
- package/assets/esri/core/workers/chunks/02dd79beb13eff6be85e.js +0 -1
- package/assets/esri/core/workers/chunks/0823961e5d0bdedbf8cf.js +0 -2
- package/assets/esri/core/workers/chunks/0aedeb837399d3f92e4a.js +0 -1
- package/assets/esri/core/workers/chunks/0bf644f93c180a2bc2f8.js +0 -705
- package/assets/esri/core/workers/chunks/0dbf31a663b5220a3136.js +0 -1
- package/assets/esri/core/workers/chunks/0df660dfd941cff3ea1d.js +0 -1
- package/assets/esri/core/workers/chunks/1119a33245138e7b3914.js +0 -1
- package/assets/esri/core/workers/chunks/1418c03c4ab87f7ab5f4.js +0 -1
- package/assets/esri/core/workers/chunks/160b204cbf5bda2a29e9.js +0 -1
- package/assets/esri/core/workers/chunks/193aed69de2dec4f36b6.js +0 -1
- package/assets/esri/core/workers/chunks/1cc063aa2ddf44bbd515.js +0 -1
- package/assets/esri/core/workers/chunks/264fd750691d517ab1f3.js +0 -1
- package/assets/esri/core/workers/chunks/2791f3fe16ca5ee2f39a.js +0 -1
- package/assets/esri/core/workers/chunks/2a2ed7bd44010f24c2dd.js +0 -1
- package/assets/esri/core/workers/chunks/2bdb9b5365869081c936.js +0 -1
- package/assets/esri/core/workers/chunks/2d45daacec0d5ed38782.js +0 -1
- package/assets/esri/core/workers/chunks/2e44978ee677aa23163d.js +0 -256
- package/assets/esri/core/workers/chunks/2ea3ca68cfa4d34e8f3b.js +0 -1
- package/assets/esri/core/workers/chunks/2f81047790c4890ae625.js +0 -1
- package/assets/esri/core/workers/chunks/32f5112c848efec6c33b.js +0 -1
- package/assets/esri/core/workers/chunks/35fd2f765d2cb3f59a22.js +0 -1462
- package/assets/esri/core/workers/chunks/3bc2943035391b44d4cf.js +0 -29
- package/assets/esri/core/workers/chunks/3d6b2d5ae647e140abaf.js +0 -1
- package/assets/esri/core/workers/chunks/44e8cd4b3dad777ab0c9.js +0 -1
- package/assets/esri/core/workers/chunks/45ccca01db0027b9dc16.js +0 -1
- package/assets/esri/core/workers/chunks/4710f21b138a2c9a0345.js +0 -1
- package/assets/esri/core/workers/chunks/4abd54518e35050feb90.js +0 -1
- package/assets/esri/core/workers/chunks/4b5bd0c9a55ea2998601.js +0 -1
- package/assets/esri/core/workers/chunks/4c2794687aea172775a0.js +0 -1
- package/assets/esri/core/workers/chunks/4cf2b0558a4acc141429.js +0 -1
- package/assets/esri/core/workers/chunks/4d9bde9f66817a92ceca.js +0 -1
- package/assets/esri/core/workers/chunks/4e129b9f5772a06e580c.js +0 -1
- package/assets/esri/core/workers/chunks/509aecafbc629bee1c15.js +0 -1
- package/assets/esri/core/workers/chunks/5441f96cdd0660229efe.js +0 -1
- package/assets/esri/core/workers/chunks/553be2bd69bd311477ea.js +0 -1
- package/assets/esri/core/workers/chunks/5600fc334d20c4f0c83d.js +0 -1
- package/assets/esri/core/workers/chunks/56bbde1dff96b423fbb9.js +0 -1
- package/assets/esri/core/workers/chunks/5bf4ab72b9634b06cc5d.js +0 -1
- package/assets/esri/core/workers/chunks/5e3d5347223f0111f40f.js +0 -1
- package/assets/esri/core/workers/chunks/613e799377bdb767c955.js +0 -1
- package/assets/esri/core/workers/chunks/623d5518bca227f643bd.js +0 -1
- package/assets/esri/core/workers/chunks/62811bca7ad2100c023c.js +0 -1
- package/assets/esri/core/workers/chunks/64176f7ae719289a2f79.js +0 -1
- package/assets/esri/core/workers/chunks/6f58cb9dffe8016397a2.js +0 -1
- package/assets/esri/core/workers/chunks/73f77f5a6907cb8d9a35.js +0 -1
- package/assets/esri/core/workers/chunks/76b573143d1a65fdbcb6.js +0 -1
- package/assets/esri/core/workers/chunks/7aaa051b51a8e34bbfb0.js +0 -1
- package/assets/esri/core/workers/chunks/7b5b66ae79e0287e3ade.js +0 -1
- package/assets/esri/core/workers/chunks/7e373d9c98ce910db9d2.js +0 -1
- package/assets/esri/core/workers/chunks/7f91e45156bbe88f9a62.js +0 -1
- package/assets/esri/core/workers/chunks/86a4057572755b403548.js +0 -1
- package/assets/esri/core/workers/chunks/877594b6db08da98acd7.js +0 -1
- package/assets/esri/core/workers/chunks/8a48a6760c33ed50b650.js +0 -1
- package/assets/esri/core/workers/chunks/8d21e2dabc5165f1c8ca.js +0 -1
- package/assets/esri/core/workers/chunks/903e1cd8b76eff19ebdf.js +0 -1
- package/assets/esri/core/workers/chunks/917c11cb40a7742d7f98.js +0 -1
- package/assets/esri/core/workers/chunks/91d133c04ca764d74934.js +0 -1
- package/assets/esri/core/workers/chunks/92c4464b67fce6cea134.js +0 -1
- package/assets/esri/core/workers/chunks/947f1ea4dbc3e3419ecc.js +0 -1
- package/assets/esri/core/workers/chunks/9482a6d7baa24bbf5693.js +0 -1
- package/assets/esri/core/workers/chunks/96cec8a02ca96175d602.js +0 -1
- package/assets/esri/core/workers/chunks/98e6c1d035755a074d24.js +0 -1
- package/assets/esri/core/workers/chunks/9902fcd2070c8eb6d043.js +0 -1
- package/assets/esri/core/workers/chunks/9b76c8974424a1908e86.js +0 -1
- package/assets/esri/core/workers/chunks/9be6827e5756031a56c1.js +0 -1
- package/assets/esri/core/workers/chunks/a101152066dd56259619.js +0 -1
- package/assets/esri/core/workers/chunks/a27cdf4c29dd50a6dab1.js +0 -1
- package/assets/esri/core/workers/chunks/a294dd12b5c708ce04af.js +0 -1
- package/assets/esri/core/workers/chunks/a2a2c7e274fb32fecffa.js +0 -1
- package/assets/esri/core/workers/chunks/a3bf8aa81ee398da5b52.js +0 -1
- package/assets/esri/core/workers/chunks/a9053ad0f4e8c4705665.js +0 -1
- package/assets/esri/core/workers/chunks/afeeb11b39e140303b5a.js +0 -1
- package/assets/esri/core/workers/chunks/b1a175b3b2d1a7ddde8e.js +0 -1
- package/assets/esri/core/workers/chunks/b33d870cbfa238762c5e.js +0 -1
- package/assets/esri/core/workers/chunks/b3b53cf0a3a30164d337.js +0 -1
- package/assets/esri/core/workers/chunks/b599b7dadce8b8bc88f6.js +0 -1
- package/assets/esri/core/workers/chunks/b858adff7043683fe41c.js +0 -1
- package/assets/esri/core/workers/chunks/b984b808d383974ca3d8.js +0 -1
- package/assets/esri/core/workers/chunks/be1d2c3a61e6447fbbc7.js +0 -1
- package/assets/esri/core/workers/chunks/bff75cc7413bf0d319db.js +0 -1
- package/assets/esri/core/workers/chunks/c02ae1d40c1fe95ae6c5.js +0 -1
- package/assets/esri/core/workers/chunks/c1189316d24fb4cdb2a0.js +0 -1
- package/assets/esri/core/workers/chunks/c1a4d499a30f3d80567b.js +0 -1
- package/assets/esri/core/workers/chunks/c25dc9073e73d6b44d88.js +0 -1
- package/assets/esri/core/workers/chunks/c45a5bcf26659daf02a1.js +0 -1
- package/assets/esri/core/workers/chunks/c46f79d5b7712adbbd1c.js +0 -1
- package/assets/esri/core/workers/chunks/c53b2be005721591e29b.js +0 -1
- package/assets/esri/core/workers/chunks/c82ab4f0908290e70ee9.js +0 -1
- package/assets/esri/core/workers/chunks/c866b66ba72d96453899.js +0 -1
- package/assets/esri/core/workers/chunks/c873383e7dae35dc1a61.js +0 -1
- package/assets/esri/core/workers/chunks/cc5ec6e99aa09342c704.js +0 -1
- package/assets/esri/core/workers/chunks/cd892c9603710d6130a9.js +0 -1
- package/assets/esri/core/workers/chunks/cf360767310fb45660a8.js +0 -1
- package/assets/esri/core/workers/chunks/d021775cf747556660a5.js +0 -1
- package/assets/esri/core/workers/chunks/d08f81d545930a79fb2e.js +0 -1
- package/assets/esri/core/workers/chunks/d607cf154218d20e4114.js +0 -1
- package/assets/esri/core/workers/chunks/d79ce047afbc034f6008.js +0 -1
- package/assets/esri/core/workers/chunks/da6134c7883531f21afe.js +0 -1
- package/assets/esri/core/workers/chunks/dbc9249dae41096d750d.js +0 -1
- package/assets/esri/core/workers/chunks/e4a2eefffe16cd5bb20f.js +0 -1
- package/assets/esri/core/workers/chunks/e602b91d8fdc36a92530.js +0 -1
- package/assets/esri/core/workers/chunks/ebfb3cdc0df15eb05d75.js +0 -1
- package/assets/esri/core/workers/chunks/ec1841e6e498d54012eb.js +0 -1
- package/assets/esri/core/workers/chunks/ed1de8b7406269e217b9.js +0 -29
- package/assets/esri/core/workers/chunks/f1727b4a32cb6f36a5e6.js +0 -1
- package/assets/esri/core/workers/chunks/f2ab8e49c7f17f488aa8.js +0 -1
- package/assets/esri/core/workers/chunks/f721756a6c1593f96409.js +0 -1
- package/assets/esri/core/workers/chunks/fb51f823b25c827c6b29.js +0 -1
- package/chunks/geometryEngineBase.js +0 -2
- package/geometry/geometryAdapters/json.js +0 -2
- package/geometry/geometryEngineJSON.js +0 -2
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +0 -2
- package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastAccumulate.glsl.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechnique.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechniqueConfiguration.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastClear.glsl.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastClearTechnique.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastMaskTechnique.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastVisualize.glsl.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechnique.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechniqueConfiguration.js +0 -2
- /package/assets/esri/core/workers/chunks/{0823961e5d0bdedbf8cf.js.LICENSE.txt → 4f8ce5887102971bfa34.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{186bedc377cc97731ca2.js.LICENSE.txt → 532e3a59888e4cc13bd3.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{ad1d06a91121ebfe9162.js.LICENSE.txt → 755b2d883fba90c4e688.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{d03e7be74c57c3dbf003.js.LICENSE.txt → a014c17fc210620da738.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{8302bffd28cc6720e0fe.js.LICENSE.txt → a19be304219808268039.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{collectPath as t}from"../geometryCursorCollectUtils.js";import{getMidpoint as n,getLength as e}from"./coordsUtils.js";function r(t){
|
|
2
|
+
import{collectPath as t}from"../geometryCursorCollectUtils.js";import{getMidpoint as n,getLength as e}from"./coordsUtils.js";function r({xmin:t,xmax:n,ymin:e,ymax:r,zmin:l,zmax:o,hasZ:u}){const s=[(t+n)/2,(e+r)/2];return u&&s.push((l+o)/2),s}function l(t){return u(t.rings,t.hasZ??!1)}function o(t){const n=l(t);if(!n)return null;const{hasZ:e,spatialReference:r}=t,[o,u,s]=n;return isNaN(o)||isNaN(u)||e&&isNaN(s)?null:{x:o,y:u,z:e?s:void 0,spatialReference:r}}function u(t,n){if(!t?.length)return null;const e=[],r=[],l=n?[1/0,-1/0,1/0,-1/0,1/0,-1/0]:[1/0,-1/0,1/0,-1/0];for(let o=0,u=t.length;o<u;o++){const e=s(t[o],n,l);e&&r.push(e)}if(r.sort((t,e)=>{let r=t[2]-e[2];return 0===r&&n&&(r=t[4]-e[4]),r}),r.length&&(e[0]=r[0][0],e[1]=r[0][1],n&&(e[2]=r[0][3]),(e[0]<l[0]||e[0]>l[1]||e[1]<l[2]||e[1]>l[3]||n&&(e[2]<l[4]||e[2]>l[5]))&&(e.length=0)),!e.length){const r=t[0]&&t[0].length?h(t[0],n):null;if(!r)return null;e[0]=r[0],e[1]=r[1],n&&r.length>2&&(e[2]=r[2])}return e}function s(t,n,e){let r=0,l=0,o=0,u=0,s=0;const i=t.length?t[0][0]:0,h=t.length?t[0][1]:0,c=t.length&&n?t[0][2]:0;for(let f=0;f<t.length;f++){const I=t[f],N=t[(f+1)%t.length],[a,g,x]=I,m=a-i,P=g-h,[T,p,E]=N,y=T-i,S=p-h,z=m*S-y*P;if(u+=z,r+=(m+y)*z,l+=(P+S)*z,n&&I.length>2&&N.length>2){const t=x-c,n=E-c,e=m*n-y*t;o+=(t+n)*e,s+=e}a<e[0]&&(e[0]=a),a>e[1]&&(e[1]=a),g<e[2]&&(e[2]=g),g>e[3]&&(e[3]=g),n&&(x<e[4]&&(e[4]=x),x>e[5]&&(e[5]=x))}if(u>0&&(u*=-1),s>0&&(s*=-1),!u)return null;u*=.5,s*=.5;const I=[r/(6*u)+i,l/(6*u)+h,u];return n&&(e[4]===e[5]||0===s?(I[3]=(e[4]+e[5])/2,I[4]=0):(I[3]=o/(6*s)+c,I[4]=s)),I}function i(t,n){let e=0,r=0,l=0;t.nextPoint();const o=t.pathSize?t.x:0,u=t.pathSize?t.y:0;for(let s=0;s<t.pathSize;s++){t.seekInPath(s);const i=[t.x,t.y];t.seekInPath((s+1)%t.pathSize);const h=[t.x,t.y],[c,I]=i,f=c-o,N=I-u,[a,g]=h,x=a-o,m=g-u,P=f*m-x*N;l+=P,e+=(f+x)*P,r+=(N+m)*P,c<n[0]&&(n[0]=c),c>n[1]&&(n[1]=c),I<n[2]&&(n[2]=I),I>n[3]&&(n[3]=I)}if(l>0&&(l*=-1),!l)return null;l*=.5;return[e/(6*l)+o,r/(6*l)+u,l]}function h(t,r){const l=r?[0,0,0]:[0,0],o=r?[0,0,0]:[0,0];let u=0,s=0,i=0,h=0;for(let c=0,I=t.length;c<I-1;c++){const I=t[c],f=t[c+1];if(I&&f){l[0]=I[0],l[1]=I[1],o[0]=f[0],o[1]=f[1],r&&I.length>2&&f.length>2&&(l[2]=I[2],o[2]=f[2]);const t=e(l,o);if(t){u+=t;const e=n(I,f);s+=t*e[0],i+=t*e[1],r&&e.length>2&&(h+=t*e[2])}}}return u>0?r?[s/u,i/u,h/u]:[s/u,i/u]:t.length?t[0]:null}function c(n){const{hasZ:e,totalSize:r}=n;if(0===r)return null;const l=[],o=[],u=e?[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY]:[Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.NEGATIVE_INFINITY];for(n.reset();n.nextPath();){const e=s(t(n),n.hasZ,u);e&&o.push(e)}if(o.sort((t,n)=>{let r=t[2]-n[2];return 0===r&&e&&(r=t[4]-n[4]),r}),o.length&&(l[0]=o[0][0],l[1]=o[0][1],e&&(l[2]=o[0][3]),(l[0]<u[0]||l[0]>u[1]||l[1]<u[2]||l[1]>u[3]||e&&(l[2]<u[4]||l[2]>u[5]))&&(l.length=0)),!l.length){n.reset(),n.nextPath();const t=n.pathSize?I(n):null;if(!t)return null;l[0]=t[0],l[1]=t[1],e&&t.length>2&&(l[2]=t[2])}return l}function I(t){const{hasZ:r}=t,l=r?[0,0,0]:[0,0],o=r?[0,0,0]:[0,0];let u=0,s=0,i=0,h=0;if(t.nextPoint()){let c=t.x,I=t.y,f=t.z;for(;t.nextPoint();){const N=t.x,a=t.y,g=t.z;l[0]=c,l[1]=I,o[0]=N,o[1]=a,r&&(l[2]=f,o[2]=g);const x=e(l,o);if(x){u+=x;const t=n(l,o);s+=x*t[0],i+=x*t[1],r&&t.length>2&&(h+=x*t[2])}c=N,I=a,f=g}}return u>0?r?[s/u,i/u,h/u]:[s/u,i/u]:t.pathSize?(t.seekPathStart(),t.nextPoint(),[t.x,t.y]):null}const f=1e-6;function N(t){let n=0;for(t.reset();t.nextPath();)n+=t.getCurrentRingArea();if(n<f){const n=c(t);return n?[n[0],n[1]]:null}const e=[0,0];if(t.reset(),!t.nextPath()||!t.nextPoint())return null;const r=[t.x,t.y];for(t.reset();t.nextPath();)g(e,r,t);return e[0]*=1/n,e[1]*=1/n,e[0]+=r[0],e[1]+=r[1],e}const a=1/3;function g(t,n,e){if(!t||!e||e.pathSize<3)return null;e.nextPoint();const r=e.x,l=e.y;e.nextPoint();let o,u=e.x-r,s=e.y-l,i=0,h=0;for(;e.nextPoint();)i=e.x-r,h=e.y-l,o=.5*a*(i*s-h*u),t[0]+=o*(u+i),t[1]+=o*(s+h),u=i,s=h;const c=e.getCurrentRingArea(),I=[r,l];return I[0]-=n[0],I[1]-=n[1],I[0]*=c,I[1]*=c,t[0]+=I[0],t[1]+=I[1],t}export{r as extentCentroid,h as lineCentroid,I as lineCentroidCursor,l as polygonCentroid,o as polygonCentroidPoint,s as ringCentroid,i as ringCentroidCursorXY,u as ringsCentroid,c as ringsCentroidCursor,N as weightedAreaCentroid};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import t from"../../../core/Error.js";import{memoize as e}from"../../../core/memoize.js";import{fromJSON as s}from"../jsonUtils.js";import{interpolateCubicBezier as n}from"./bezierCurveUtils.js";import{deriveCircleFromCircularArc as i}from"./circularArcUtils.js";import{isCurvedGeometry as r,
|
|
2
|
+
import t from"../../../core/Error.js";import{memoize as e}from"../../../core/memoize.js";import{fromJSON as s}from"../jsonUtils.js";import{interpolateCubicBezier as n}from"./bezierCurveUtils.js";import{deriveCircleFromCircularArc as i}from"./circularArcUtils.js";import{isCurvedGeometry as r,hasUnsupportedCurve as a,getCurves as o,getEndpoint as c,isCoordinate as h,isBezierCurve as u,isCircularArc as p,isEllipticArc4 as l,isEllipticArc7 as m,cloneCurve as d}from"./curveUtils.js";import{deriveCircleFromEllipticArc4 as f}from"./ellipticArc4Utils.js";import{deriveEllipse as S,interpolateEllipse as v}from"./ellipticArc7Utils.js";import{interpolateSegment as E,pointToSegmentDistance2 as g,distance2 as x}from"./mathUtils.js";const M={maxSegmentLength:0,maxDeviation:0,maxSegmentsPerCurve:12e3,minSegmentsPerCurve:1},P=100,k=1e-6,C=[0,0];function _(t){return{maxSegmentLength:t.maxSegmentLength??M.maxSegmentLength,maxDeviation:t.maxDeviation??M.maxDeviation,maxSegmentsPerCurve:t.maxSegmentsPerCurve??M.maxSegmentsPerCurve,minSegmentsPerCurve:Math.max(t.minSegmentsPerCurve??M.minSegmentsPerCurve,1)}}class y{constructor(t,e){this.curveStart=t,this.curveEnd=e,this.tStart=0,this.tEnd=0,this.tEndStack=[],this.arcEndStack=[]}get stackSize(){return this.tEndStack.length}initialize(t,e){this.tStart=0,this.arcStart=t,this.tEndStack.push(1),this.arcEndStack.push(e)}splitAt(t){this.tEndStack.push(this.tEnd),this.arcEndStack.push(this.arcEnd),this.tEndStack.push(t),this.arcEndStack.push(this.interpolate(t))}splitInHalf(){return this.splitAt((this.tStart+this.tEnd)/2)}pop(){this.tEnd=this.tEndStack.pop(),this.arcEnd=this.arcEndStack.pop()}next(){this.tStart=this.tEnd,this.arcStart=this.arcEnd}densify(t,{maxDeviation:e,maxSegmentLength:s,maxSegmentsPerCurve:n,minSegmentsPerCurve:i}){const r=s*s,a=e*e,o=1/n,c=this.interpolate(0),h=this.interpolate(1);x(this.curveStart,c)>k&&t.push(c),this.initialize(c,h);const u=1/i;for(let p=i-1;p>0;p--){const t=p*u;this.pop(),this.splitAt(t)}for(;this.stackSize>0;)this.pop(),this.tStart===this.tEnd||this.tEnd-this.tStart<o||(0===r||!isFinite(r)||x(this.arcStart,this.arcEnd)<r)&&(0===a||!isFinite(a)||this.getDeviation2()<a)?(t.push(this.arcEnd),this.next()):this.splitInHalf();return x(this.curveEnd,h)>k&&t.push([...this.curveEnd]),t}}class R extends y{constructor(t,e){const[s,n,i]=e.b;super(t,s),this._controlPointsStack=[],this._curveControlPoints=[n,i],this._arcControlPoints=[n,i],this._controlPointsStack.push(this._arcControlPoints)}splitAt(t){const{arcStart:e,arcEnd:s,tStart:n,tEnd:i}=this,[r,a]=this._arcControlPoints,o=(t-n)/(i-n),c=E([],e,r,o),h=E(C,r,a,o),u=E([],a,s,o),p=E([],c,h,o),l=E([],h,u,o),m=E([],p,l,o);this.tEndStack.push(this.tEnd),this.arcEndStack.push(this.arcEnd),this._controlPointsStack.push([l,u]),this.tEndStack.push(t),this.arcEndStack.push(m),this._arcControlPoints[0]=c,this._arcControlPoints[1]=p,this._controlPointsStack.push(this._arcControlPoints)}pop(){super.pop(),this._arcControlPoints=this._controlPointsStack.pop()}interpolate(t){const{curveStart:e,curveEnd:s}=this,[i,r]=this._curveControlPoints;return n(e,i,r,s,t)}getDeviation2(){const{arcStart:t,arcEnd:e}=this,[s,n]=this._arcControlPoints;return Math.max(g(s,t,e),g(n,t,e))}}class w extends y{constructor(t,e){const[s]=e.a;super(t,s),this._derivedEllipse=S(t,e)}pop(){super.pop(),this._tMid=(this.tStart+this.tEnd)/2,this._arcMid=this.interpolate(this._tMid)}splitInHalf(){this.tEndStack.push(this.tEnd),this.arcEndStack.push(this.arcEnd),this.tEndStack.push(this._tMid),this.arcEndStack.push(this._arcMid)}interpolate(t){return v(this._derivedEllipse,t)}getDeviation2(){return g(this._arcMid,this.arcStart,this.arcEnd)}}function b(t,e,s,{cx:n,cy:i,radius:r,thetaStart:a,thetaEnd:o,isInvalid:c},{maxDeviation:h,maxSegmentLength:u,maxSegmentsPerCurve:p,minSegmentsPerCurve:l}){if(c)return t.push([...s]),t;const m=2*r,d=[n+r*Math.cos(a),i+r*Math.sin(a)],f=[n+r*Math.cos(o),i+r*Math.sin(o)];x(e,d)>k&&t.push(d);const S=Math.abs(o-a),v=u>0&&u<m?2*Math.asin(u/m):S,E=h>0&&h<=r?2*Math.acos(1-h/r):S,g=Math.min(v,E),M=Math.min(p,Math.max(l,Math.ceil(Math.abs(S/g)))),P=1/M;for(let x=1;x<M;x++){const e=x*P,s=a*(1-e)+o*e;t.push([n+r*Math.cos(s),i+r*Math.sin(s)])}return t.push(f),x(s,f)>k&&t.push([...s]),t}function j(t,e,s,n){return new R(e,s).densify(t,n)}function Z(t,e,s,n){const r=i(e,s),[a]=s.c;return b(t,e,a,r,n)}function D(t,e,s,n){const i=f(e,s),[r]=s.a;return b(t,e,r,i,n)}function z(t,e,s,n){const[i,r,a,o,c,h,u]=s.a;return 0===h||0===u?(t.push([...i]),t):new w(e,s).densify(t,n)}function A(t,e,s,n){return h(s)?(t.push([...s]),t):u(s)?j(t,e,s,n):p(s)?Z(t,e,s,n):l(s)?D(t,e,s,n):z(t,e,s,n)}function L(t,e={}){if(!r(t))return t;const s=_(e),n=o(t),i=[];for(const r of n){const t=[];for(let e=0;e<r.length-1;e++){const n=e+1,i=[...c(r[e])];0===e&&t.push(i);A(t,i,r[n],s)}i.push(t)}return"curvePaths"in t?{...void 0!==t.hasZ?{hasZ:t.hasZ}:{},...void 0!==t.hasM?{hasM:t.hasM}:{},paths:i,spatialReference:t.spatialReference}:{...void 0!==t.hasZ?{hasZ:t.hasZ}:{},...void 0!==t.hasM?{hasM:t.hasM}:{},rings:i,spatialReference:t.spatialReference}}const U=e(t=>({maxDeviation:0,maxSegmentLength:t*P,maxSegmentsPerCurve:12e3,minSegmentsPerCurve:1}));function T(t,e,s){if(!r(t))return t;const n=new Set(e),i=_(s),a=o(t),f=[];let S=!1;for(const r of a){const t=[];for(let e=0;e<r.length-1;e++){const s=e+1,a=[...c(r[e])];0===e&&t.push(a);const o=r[s];h(o)?t.push([...o]):u(o)&&!n.has("cubic-bezier")?j(t,a,o,i):p(o)&&!n.has("circular-arc")?Z(t,a,o,i):l(o)&&!n.has("elliptic-arc")?D(t,a,o,i):m(o)&&!n.has("elliptic-arc")?z(t,a,o,i):(t.push(d(o)),S=!0)}f.push(t)}return"curvePaths"in t?{...void 0!==t.hasZ?{hasZ:t.hasZ}:{},...void 0!==t.hasM?{hasM:t.hasM}:{},spatialReference:t.spatialReference,...S?{curvePaths:f}:{paths:f}}:{hasZ:t.hasZ,hasM:t.hasM,spatialReference:t.spatialReference,...S?{curveRings:f}:{rings:f}}}async function I(t,e,n){const i=new Set(e);return await J(t,i,n),t.map(t=>{if(!t||!r(t))return t;const n=t.spatialReference.xyTolerance;if(null==n)return t;const i=U(n);return s(T(t,e,i))})}async function J(e,s,n){let i=null;for(const o of e)if(o&&r(o)&&null==o.spatialReference.xyTolerance&&a(o,s)){const e=o.spatialReference;if(!e)throw new t("geometry:missing-spatial-reference","Geometry contains an unsupported curve type, but it cannot be densified because it has no spatial reference.");const s=N(e);if(n.has(s))o.spatialReference=n.get(s);else{i||(i=await(import("../../operators/support/apiConverter.js")));const r=i.fromSpatialReference(e),a=r?.getTolerance();if(null==a)throw new t("geometry:missing-tolerance","Geometry contains an unsupported curve type, but it cannot be densified because the tolerance of its spatial reference is unknown. Set the `xyTolerance` property of the spatial reference.");const c=o.spatialReference.clone();c.read({xyTolerance:a}),o.spatialReference=c,n.set(s,c)}}}function N(t){if(null!=t.wkid)return`${t.wkid}`;if(null!=t.wkt)return t.wkt;const e="toJSON"in t&&"function"==typeof t.toJSON?t.toJSON():t;return JSON.stringify(e)}export{L as densifyCurvedGeometry,I as densifyUnsupportedCurves,U as getAutoDensifyOptions,N as getCacheKey,T as selectiveDensifyCurvedGeometryJSON};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{getRingsOrPathsBounds as n,getPointsBounds as
|
|
2
|
+
import{getRingsOrPathsBounds as n,getPointsBounds as m}from"./boundsUtils.js";function i(n){return void 0!==n.xmin&&void 0!==n.ymin&&void 0!==n.xmax&&void 0!==n.ymax}function t(n){return void 0!==n.points}function x(n){return void 0!==n.x&&void 0!==n.y}function a(n){return void 0!==n.paths}function u(n){return void 0!==n.rings}const r=[];function o(n,m,i,t){return{xmin:n,ymin:m,xmax:i,ymax:t}}function c(n,m,i,t,x,a){return{xmin:n,ymin:m,zmin:i,xmax:t,ymax:x,zmax:a}}function s(n,m,i,t,x,a){return{xmin:n,ymin:m,mmin:i,xmax:t,ymax:x,mmax:a}}function l(n,m,i,t,x,a,u,r){return{xmin:n,ymin:m,zmin:i,mmin:t,xmax:x,ymax:a,zmax:u,mmax:r}}function e(n,m=!1,i=!1){return m?i?l(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7]):c(n[0],n[1],n[2],n[3],n[4],n[5]):i?s(n[0],n[1],n[2],n[3],n[4],n[5]):o(n[0],n[1],n[2],n[3])}function y(n){return n?i(n)?n:x(n)?z(n):u(n)?v(n):a(n)?M(n):t(n)?h(n):null:null}function f(n,{xmin:m,ymin:i,zmin:t,mmin:x,xmax:a,ymax:u,zmax:r,mmax:o}){n.xmin=Math.min(n.xmin,m),n.xmax=Math.max(n.xmax,a),n.ymin=Math.min(n.ymin,i),n.ymax=Math.max(n.ymax,u),null!=n.zmin&&(n.zmin=Math.min(n.zmin,t),n.zmax=Math.max(n.zmax,r)),null!=n.mmin&&(n.mmin=Math.min(n.mmin,x),n.mmax=Math.max(n.mmax,o))}function h(n){const{hasZ:i,hasM:t,points:x}=n,a=m(r,x,i??!1,t??!1,i??!1,t??!1);return a?e(a,i,t):null}function z(n){const{x:m,y:i,z:t,m:x}=n,a=null!=x;return null!=t?a?l(m,i,t,x,m,i,t,x):c(m,i,t,m,i,t):a?s(m,i,x,m,i,x):o(m,i,m,i)}function v(m){const{hasZ:i,hasM:t,rings:x,curveRings:a}=m,u=n(r,a??x,i??!1,t??!1);return u?e(u,i,t):null}function M(m){const{hasZ:i,hasM:t,paths:x,curvePaths:a}=m,u=n(r,a??x,i??!1,t??!1);return u?e(u,i,t):null}export{f as expandExtent,y as getGeometryExtent,h as getMultipointExtent,z as getPointExtent,v as getPolygonExtent,M as getPolylineExtent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{ObjectStack as t}from"../../core/ObjectStack.js";import{multiply as r,invert as o}from"../../core/libs/gl-matrix-2/math/mat4.js";import{transformMat4 as n,set as e}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transformMat4 as c}from"../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as f}from"../../core/libs/gl-matrix-2/factories/vec4f64.js";import{center as a,width as s,depth as u,height as m}from"./aaBoundingBox.js";import{fromRay as l,fromLineSegmentAndDirection as p,create as b}from"./clipRay.js";import{create as g,fromPoints as j,signedDistance as h,clip as x,
|
|
2
|
+
import{ObjectStack as t}from"../../core/ObjectStack.js";import{multiply as r,invert as o}from"../../core/libs/gl-matrix-2/math/mat4.js";import{transformMat4 as n,set as e}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transformMat4 as c}from"../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as f}from"../../core/libs/gl-matrix-2/factories/vec4f64.js";import{center as a,width as s,depth as u,height as m}from"./aaBoundingBox.js";import{fromRay as l,fromLineSegmentAndDirection as p,create as b}from"./clipRay.js";import{create as g,fromPoints as j,signedDistance as h,clip as x,clipInfinite as M,copy as v}from"./plane.js";import{sm4d as d,sv4d as k}from"./vectorStacks.js";function y(t){return t?[g(t[0]),g(t[1]),g(t[2]),g(t[3]),g(t[4]),g(t[5])]:[g(),g(),g(),g(),g(),g()]}function B(){return[i(),i(),i(),i(),i(),i(),i(),i()]}function S(t,r){for(let o=0;o<J;o++)v(t[o],r[o]);return t}function w(t,n,i,f=P){const a=r(d.get(),n,t);o(a,a);for(let r=0;r<K;++r){const t=c(k.get(),L[r],a);e(f[r],t[0]/t[3],t[1]/t[3],t[2]/t[3])}O(i,f)}function O(t,r){j(r[4],r[0],r[3],t[0]),j(r[1],r[5],r[6],t[1]),j(r[4],r[5],r[1],t[2]),j(r[3],r[2],r[6],t[3]),j(r[0],r[1],r[2],t[4]),j(r[5],r[4],r[7],t[5])}function R(t,r){return q(t,r.center,r.radius)}function q(t,r,o){for(let n=0;n<J;n++){const e=t[n];if(e[0]*r[0]+e[1]*r[1]+e[2]*r[2]+e[3]>=o)return!1}return!0}function z(t,r,o){const n=a(r,Q),e=s(r)/2,i=u(r)/2,c=m(r)/2;return o?C(t,n,e,i,c,o):A(t,n,e,i,c)}function A(t,r,o,n,e){for(let i=0;i<J;i++){const c=t[i];if(c[0]*r[0]+c[1]*r[1]+c[2]*r[2]+c[3]-(Math.abs(c[0])*o+Math.abs(c[1])*n+Math.abs(c[2])*e)>0)return!1}return!0}function C(t,r,o,e,i,c){const f=n(T,r,c);for(let n=0;n<J;n++){const r=t[n];if(r[0]*f[0]+r[1]*f[1]+r[2]*f[2]+r[3]-(Math.abs(r[0]*c[0]+r[1]*c[1]+r[2]*c[2])*o+Math.abs(r[0]*c[4]+r[1]*c[5]+r[2]*c[6])*e+Math.abs(r[0]*c[8]+r[1]*c[9]+r[2]*c[10])*i)>0)return!1}return!0}function D(t,r){return H(t,l(r,N.get()))}function E(t,r){for(let o=0;o<J;o++){const n=t[o];if(!M(n,r))return!1}return!0}function F(t,r,o){return H(t,p(r,o,N.get()))}function G(t,r){for(let o=0;o<J;o++){if(h(t[o],r)>0)return!1}return!0}function H(t,r){for(let o=0;o<J;o++)if(!x(t[o],r))return!1;return!0}const I={bottom:[5,1,0,4],near:[0,1,2,3],far:[5,4,7,6],right:[1,5,6,2],left:[4,0,3,7],top:[7,3,2,6]},J=6,K=8,L=[f(-1,-1,-1,1),f(1,-1,-1,1),f(1,1,-1,1),f(-1,1,-1,1),f(-1,-1,1,1),f(1,-1,1,1),f(1,1,1,1),f(-1,1,1,1)],N=new t(b),P=B(),Q=i(),T=i();export{O as computePlanes,S as copy,y as create,B as createPoints,w as fromMatrix,E as intersectClipRay,F as intersectsLineSegment,G as intersectsPoint,D as intersectsRay,R as intersectsSphere,q as intersectsSphereCenterRadius,z as intersectsTransformedAabb,J as numPlanes,K as numPoints,I as planePointIndices};
|
|
@@ -6,25 +6,27 @@
|
|
|
6
6
|
* @since 4.3
|
|
7
7
|
*/
|
|
8
8
|
import type Extent from "../Extent.js";
|
|
9
|
-
import type
|
|
10
|
-
import type Multipoint from "../Multipoint.js";
|
|
11
|
-
import type Point from "../Point.js";
|
|
12
|
-
import type Polygon from "../Polygon.js";
|
|
13
|
-
import type Polyline from "../Polyline.js";
|
|
9
|
+
import type { GeometryUnion } from "../types.js";
|
|
14
10
|
import type { RequestOptions } from "../../request/types.js";
|
|
15
11
|
|
|
16
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Normalizes geometries that intersect the central meridian or fall outside the
|
|
14
|
+
* world extent so they stay within the coordinate system of the view.
|
|
15
|
+
*
|
|
16
|
+
* @deprecated since 5.2. Use a signature without the ignored url parameter.
|
|
17
|
+
* @param geometries - An array of geometries to normalize. All geometries should have identical SR.
|
|
18
|
+
* @param url - ignored
|
|
19
|
+
* @param requestOptions - Additional [options](https://developers.arcgis.com/javascript/latest/references/core/request/#request) whose abort signal will be handled.
|
|
20
|
+
* @returns Resolves to an array of the normalized geometries.
|
|
21
|
+
*/
|
|
22
|
+
export function normalizeCentralMeridian(geometries: (GeometryUnion | null | undefined) | (GeometryUnion | null | undefined)[], url: string | null, requestOptions?: RequestOptions): Promise<(GeometryUnion | null | undefined)[]>;
|
|
17
23
|
|
|
18
24
|
/**
|
|
19
25
|
* Normalizes geometries that intersect the central meridian or fall outside the
|
|
20
|
-
* world extent so they stay within the coordinate system of the view.
|
|
21
|
-
* for Web Mercator and WGS84 spatial references.
|
|
26
|
+
* world extent so they stay within the coordinate system of the view.
|
|
22
27
|
*
|
|
23
|
-
* @param geometries - An array of geometries to normalize.
|
|
24
|
-
* @param
|
|
25
|
-
* perform the normalization. If this value is `null` then the default geometry service URL in
|
|
26
|
-
* [esriConfig.geometryServiceUrl](https://developers.arcgis.com/javascript/latest/references/core/config/#Config-geometryServiceUrl) is used.
|
|
27
|
-
* @param requestOptions - Additional options to be used for the data request.
|
|
28
|
+
* @param geometries - An array of geometries to normalize. All geometries should have identical SR.
|
|
29
|
+
* @param requestOptions - Additional [options](https://developers.arcgis.com/javascript/latest/references/core/request/#request) whose abort signal will be handled.
|
|
28
30
|
* @returns Resolves to an array of the normalized geometries.
|
|
29
31
|
* @example
|
|
30
32
|
* // create a non-normalized line that crosses the dateline
|
|
@@ -45,7 +47,7 @@ export type Geometry = Extent | Multipoint | Point | Polygon | Polyline | Mesh;
|
|
|
45
47
|
* symbol: { type: "simple-line" }
|
|
46
48
|
* });
|
|
47
49
|
*/
|
|
48
|
-
export function normalizeCentralMeridian(geometries: (
|
|
50
|
+
export function normalizeCentralMeridian(geometries: (GeometryUnion | null | undefined) | (GeometryUnion | null | undefined)[], requestOptions?: RequestOptions): Promise<(GeometryUnion | null | undefined)[]>;
|
|
49
51
|
|
|
50
52
|
/**
|
|
51
53
|
* Returns an [Extent](https://developers.arcgis.com/javascript/latest/references/core/geometry/Extent/) over the dateline that is smaller than the normalized width if it visually contains the
|
|
@@ -71,4 +73,4 @@ export function normalizeCentralMeridian(geometries: (Geometry | null | undefine
|
|
|
71
73
|
* });
|
|
72
74
|
* const extent = normalizeUtils.getDenormalizedExtent(multipoint);
|
|
73
75
|
*/
|
|
74
|
-
export function getDenormalizedExtent(geometry:
|
|
76
|
+
export function getDenormalizedExtent(geometry: GeometryUnion | null | undefined): Extent | null | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import
|
|
2
|
+
import{Cyclical as t}from"../../core/Cyclical.js";import e from"../../core/Error.js";import{whenOrAbort as n}from"../../core/promiseUtils.js";import r from"../Extent.js";import o from"../Polygon.js";import i from"../Polyline.js";import s from"../SpatialReference.js";import{importLazily as l}from"../operators/importUtils.js";import{getGeometryParts as a}from"./normalizeUtilsCommon.js";import{getInfo as c}from"./spatialReferenceUtils.js";function p(t){const e=[];let n=0,r=0;for(let o=0;o<t.length;o++){const i=t[o];let s=null;for(let t=0;t<i.length;t++)s=i[t],e.push(s),0===t?(n=s[0],r=n):(n=Math.min(n,s[0]),r=Math.max(r,s[0]));s&&e.push([(n+r)/2,0])}return e}function f(t,n){switch(t.type){case"polygon":case"polyline":break;default:throw new e("internal:geometry","straightLineDensify: the input geometry is neither polyline nor polygon")}const r=a(t),s=[];for(const e of r){const t=[];s.push(t),t.push([e[0][0],e[0][1]]);for(let r=0;r<e.length-1;r++){const o=e[r][0],i=e[r][1],s=e[r+1][0],l=e[r+1][1],a=Math.sqrt((s-o)*(s-o)+(l-i)*(l-i)),c=(l-i)/a,p=(s-o)/a,f=a/n;if(f>1){for(let l=1;l<=f-1;l++){const e=l*n,r=p*e+o,s=c*e+i;t.push([r,s])}const e=(a+Math.floor(f-1)*n)/2,r=p*e+o,s=c*e+i;t.push([r,s])}t.push([s,l])}}return"polygon"===t.type?new o({rings:s,spatialReference:t.spatialReference}):new i({paths:s,spatialReference:t.spatialReference})}async function m(t,e,r){Array.isArray(t)||(t=[t]),null!=e&&"object"==typeof e&&"authMode"in e&&(r=e);let o=null;for(const n of t)o??=n?.spatialReference;if(!o)return t;const i=c(o);if(!i)return t;const[s,l]=i.valid;let a=!1;for(const n of t){if(!n)continue;if("point"===n.type){a||=n.x>=l,a||=n.x<=s;continue}const{extent:t}=n;if(null==t){a=!0;break}a||=t.xmin>=l,a||=t.xmin<=s,a||=t.xmax>=l,a||=t.xmax<=s}if(!a)return t;const[{foldInto360Range:p},f]=await n(Promise.all([u.getImportPromise(),h.getImportPromise()]),r),m=f.fromSpatialReference(o);return t.map(t=>{if(null==t||"mesh"===t.type)return t;const e=f.fromGeometry(t),n=f.toGeometry(p(e,m),o);return"extent"===t.type&&1===n?.rings.length?n.extent:n})}const u=l(()=>import("../operators/gx/operatorProject.js")),h=l(()=>import("../operators/support/apiConverter.js"));function x(t){if(!t||"mesh"===t.type)return null;const{extent:e,spatialReference:n}=t,o=n&&c(n);if("point"===t.type){const{x:e,y:o}=t;return new r({xmin:e,ymin:o,xmax:e,ymax:o,spatialReference:n})}if(!e||!o)return e;const[i,s]=o.valid,l=2*s,{width:a}=e;let f,{xmin:m,xmax:u}=e;if([m,u]=[u,m],"extent"===t.type||0===a||a<=s||a>l||m<i||u>s)return e;switch(t.type){case"polygon":if(!(t.rings.length>1))return e;f=p(t.rings);break;case"polyline":if(!(t.paths.length>1))return e;f=p(t.paths);break;case"multipoint":f=t.points}const h=e.clone();for(let r=0;r<f.length;r++){let t=f[r][0];t<0?(t+=s,u=Math.max(t,u)):(t-=s,m=Math.min(t,m))}return h.xmin=m,h.xmax=u,h.width<a?(h.xmin-=s,h.xmax-=s,h):e}function y(t,e,n){const r=c(n);if(null==r)return t;const[o,i]=r.valid,s=2*i;let l=0,a=0;e>i?l=Math.ceil(Math.abs(e-i)/s):e<o&&(l=-Math.ceil(Math.abs(e-o)/s)),t>i?a=Math.ceil(Math.abs(t-i)/s):t<o&&(a=-Math.ceil(Math.abs(t-o)/s));let p=t+(l-a)*s;const f=p-e;return f>i?p-=s:f<o&&(p+=s),p}function g(t,e){const n=M(e);return n?.normalize(t)??t}function M(e){const n=c(e);if(null==n)return null;const[r,o]=n.valid;return new t(r,o)}const j=M(s.WGS84),w=M(s.WebMercator);export{M as createSpatialReferenceCyclical,j as gcsCyclical,y as getClosestDenormalizedXToReference,x as getDenormalizedExtent,m as normalizeCentralMeridian,g as normalizeMapX,f as straightLineDensify,w as webMercatorCyclical};
|
package/kernel.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.2.0-next.
|
|
2
|
+
import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.2.0-next.76",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
|
package/layers/FeatureLayer.d.ts
CHANGED
|
@@ -606,7 +606,7 @@ export interface FeatureLayerEvents extends EditBusLayerEvents, RefreshableLayer
|
|
|
606
606
|
* initialization, the [geometryType](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#geometryType) cannot be inferred, and the layer will fail to initialize when the layer is added to the map.
|
|
607
607
|
*
|
|
608
608
|
* **Geometry type and spatial reference:** For spatial data, the [geometryType](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#geometryType) must be defined explicitly, if the [source](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#source)
|
|
609
|
-
* is empty at the time layer's initialization. A valid [spatialReference](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#spatialReference) is also required.
|
|
609
|
+
* is empty at the time of the layer's initialization. A valid [spatialReference](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#spatialReference) is also required.
|
|
610
610
|
*
|
|
611
611
|
* **Field schema:** Both spatial and non-spatial feature collections must include an [objectIdField](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#objectIdField), which provides a unique identifier
|
|
612
612
|
* for each feature. This must be indicated along with an array of [field](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/#fields) objects, providing the schema of each field.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../request.js";import{has}from"../applications/Components/baUtils.js";import i from"../core/Accessor.js";import s from"../core/Error.js";import r from"../core/Logger.js";import{someMap as a}from"../core/MapUtils.js";import{createAbortError as n,isAborted as o,isAbortError as l}from"../core/promiseUtils.js";import d from"../core/ReactiveMap.js";import{watch as h}from"../core/reactiveUtils.js";import{property as _,subclass as y}from"../core/accessorSupport/decorators.js";import u from"../geometry/SpatialReference.js";import{isGeographic as c}from"../geometry/support/spatialReferenceUtils.js";import m from"../geometry/support/WKIDUnitConversion.js";import{wasmFailedToInit as g,elevQueriesFull as p,elevQueriesGenericFail as f,invalidLayerView as w}from"./ILyr3DWasmPerSceneView.js";import{Lyr3DWorkerHandle as b}from"./Lyr3DWorkerHandle.js";import{getVCSFromHeightModelInfo as v}from"./support/tiles3DUtils.js";import{loadLyr3DMainWASM as D}from"../libs/lyr3d/Lyr3DModule.js";import{getElevationOffsetInMeters as L}from"../support/elevationInfoUtils.js";import{makeScheduleFunction as M}from"../views/3d/layers/support/makeScheduleFunction.js";import{TaskPriority as C}from"../views/support/Scheduler.js";import{Yield as R}from"../views/support/Yield.js";const k=3857,S=32662,I=4326,j=5773;let W=class extends i{constructor(e){super(e),this._lyr3DMainPromise=null,this._lyr3DMain=null,this._layers=new Map,this._viewSR=null,this._haveAddedViewSRForNoOpPrj=!1,this._lyr3DBusyCount=0,this._lyr3DInternalMemoryBytes=0,this._isTerrainReady=!1,this._hasLayerThatReplacesTerrain=!1,this._elevationQueries=new d,this._pendingJobCompleted=new Array,this._pendingJobFailed=new Array,this._pendingRenderableCreated=new Array,this._jobDataBufferPtr=0,this._jobDataBufferCapacity=0,this._debugFlags=new Set,this._debugLevel=2,this._wasmNotLoaded="method requiring WASM was called when WASM isn't loaded",this._pulseTaskHandle=null,this._cameraDirty=!0,this._cameraElevationDirty=!0,this._debugFlags.add(0),this._debugFlags.add(1),this._debugFlags.add(2)}_debugLog(e,t,i,s=!0){if(this._debugFlags.has(e)&&this._debugLevel>=t){const e=s?`[js] ${i}`:`${i}`;0===t||1===t?r.getLogger(this).error(e):2===t&&r.getLogger(this).warn(e),r.getLogger(this).info(e)}}get viewSR(){return this._viewSR}get lyr3DInternalMemoryBytes(){return this._lyr3DInternalMemoryBytes}initialize(){this._debugLevel>2&&(r.getLogger(this).level="info"),this._debugLog(0,3,"Lyr3DWasmPerSceneView.initialize()"),this.addHandles([h(()=>this.view.state?.contentCamera,()=>this._updateWasmCamera()),h(()=>this.view.state?.contentCamera.relativeElevation,()=>{this._cameraElevationDirty=!0,this._markAllLayerViewsUpdating()}),this.view.resourceController.addUpdatingObject(this)]),this._pulseTaskHandle=this.view.resourceController.scheduler.registerTask(C.LYR3D,this)}destroy(){this._debugLog(0,3,"Lyr3DWasmPerSceneView.destroy()"),this._lyr3DMain&&(this._jobDataBufferPtr&&(this._lyr3DMain._free(this._jobDataBufferPtr),this._jobDataBufferPtr=0,this._jobDataBufferCapacity=0),this._layers.forEach(e=>{e.abortController.abort()}),this._elevationQueries.forEach((e,t)=>{this._lyr3DMain.cancel_elevation_query(t),e.rejectCallback(n())}),this._elevationQueries.clear(),this._lyr3DMain.uninitialize_lyr3d_wasm(),this._lyr3DMain=null),this._pendingJobCompleted.length=0,this._pendingJobFailed.length=0,this._pendingRenderableCreated.length=0;const e=this._workerHandle;e&&e.destroyWasm().then(()=>{this._workerHandle?.destroy(),this._workerHandle=null}),this._pulseTaskHandle?.remove(),this._pulseTaskHandle=null}get readyToRun(){return this._hasPendingPulseWork()}get updating(){return this._elevationQueries.size>0}runTask(e){return this._pulseTask(e),R}_hasPendingPulseWork(){return!!this._lyr3DMain&&(this._cameraDirty||this._cameraElevationDirty||this._pendingJobCompleted.length>0||this._pendingJobFailed.length>0||this._pendingRenderableCreated.length>0||this._elevationQueries.size>0||a(this._layers,e=>this._isUpdating(e)))}addLayerView(e){return this._lyr3DMain?this._addLayerView(e):(this._debugLog(0,1,"Lyr3DWasmPerSceneView.add3DTilesLayerView() called when WASM wasn't initialized"),{wasmLayerId:g})}removeLayerView(e){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;this._doRemoveLayerView(e);const t=this._layers.size;return 0===t&&(this._debugLog(0,3,"Lyr3DWasmPerSceneView.remove3DTilesLayerView() no Lyr3D layers left after removing a layer, destroying"),this.destroy()),t}getValidLayerViewCount(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;let e=0;return this._layers.forEach(t=>{t.layerView.wasmLayerId>=0&&++e}),e}setEnabled(e,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const i=this._layers.get(e.wasmLayerId);if(i){this._lyr3DMain.set_enabled(e.wasmLayerId,t),i.needMemoryUsageUpdate=!0;const s=this._isUpdating(i);i.needFrame=!0,s||i.layerView.updatingFlagChanged()}}setLayerOffset(e,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const i=this._layers.get(e.wasmLayerId);i&&(this._lyr3DMain.set_carto_offset_z(e.wasmLayerId,t),i.needFrame=!0,i.layerView.updatingFlagChanged())}getAttributionText(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),[];return this._lyr3DMain.get_current_attribution_text().split("|")}onRenderableEvicted(e,t,i){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);this._layers.get(e.wasmLayerId)&&this._lyr3DMain.on_renderable_evicted(e.wasmLayerId,t,i)}setMeshModifications(e,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const i=this._layers.get(e.wasmLayerId);if(i){const s=this._lyr3DMain._malloc(8*t.length),r=new Float64Array(this._lyr3DMain.HEAPF64.buffer,s,t.length);for(let e=0;e<t.length;++e)r[e]=t[e];this._lyr3DMain.set_mesh_modification_polygons(e.wasmLayerId,s,t.length),this._lyr3DMain._free(s);const a=this._isUpdating(i);i.needFrame=!0,a||i.layerView.updatingFlagChanged()}}isUpdating(e){if(!this._lyr3DMain&&this._lyr3DMainPromise)return!0;const t=this._layers.get(e);return!!t&&this._isUpdating(t)}initializeWasm(e,t){return this._lyr3DMain?Promise.resolve():this.view.renderSpatialReference?(this._debugLog(0,3,"Lyr3DWasmPerSceneView.initializeWasm()"),this._lyr3DMainPromise||(this._lyr3DMainPromise=D().then(i=>{this._lyr3DMain=i,this._lyr3DMainPromise=null;const s=this._lyr3DMain.addFunction(this._onNewJob.bind(this),"v"),r=this._lyr3DMain.addFunction(this._onNewRenderable.bind(this),"v"),a=this._lyr3DMain.addFunction(this._freeRenderables.bind(this),"viii"),n=this._lyr3DMain.addFunction(this._setRenderableVisibility.bind(this),"viiii"),o=this._lyr3DMain.addFunction(this._onWasmError.bind(this),"viiii"),l=this._lyr3DMain.addFunction(this._onElevQueryComplete.bind(this),"vi");if(!this.view.renderSpatialReference)return void(this._lyr3DMain=null);this._viewSR=this.view.renderSpatialReference?.toJSON();let d="global"===this.view.viewingMode?6:4;6===d?(this._viewSR.wkid=this._viewSR.latestWkid=I,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=j,this._viewSR.wkt=""):(this._viewSR.vcsWkid||(this._viewSR.vcsWkid=v(this.view.heightModelInfo)),this.view.renderSpatialReference?.isWebMercator?(this._viewSR.wkid=this._viewSR.latestWkid=k,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=j):this.view.renderSpatialReference?.wkid===S?(this._viewSR.wkid=this._viewSR.latestWkid=I,d=3,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=j):this._viewSR.vcsWkid||this._viewSR.latestVcsWkid||(this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=-1));const h=has("esri-lyr3D-max-concurrent-requests")??16;return this._lyr3DMain.initialize_lyr3d_wasm(o,s,r,a,n,l,e,t,d,this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),Math.max(this._debugLevel,0),h)?(this._workerHandle=new b(M(this.view.resourceController)),this._workerHandle.promise?this._workerHandle.promise:void 0):(this._lyr3DMain=null,void this._debugLog(0,0,"Lyr3d Main WASM failed to initialize",!1))}).catch(e=>{this._debugLog(0,0,`Lyr3d WASM failed to download error = ${e}`,!1)})),this._lyr3DMainPromise):Promise.reject()}get isTerrainReady(){return this._isTerrainReady}setLodPixelThreshold(e,t){this._lyr3DMain?.set_lod_pixel_threshold(t);const i=this._layers.get(e.wasmLayerId);i&&(i.needFrame=!0,i.layerView.updatingFlagChanged())}setMaximumGaussianSplatCount(e){this._lyr3DMain.set_maximum_splat_count(e),this._layers.forEach(e=>{"gaussian-splat-3d"===e.layerView.type&&(e.needFrame=!0,e.layerView.updatingFlagChanged())})}queryElevation(e,t,i){if(!this._lyr3DMain)return Promise.reject(this._wasmNotLoaded);if(0===t.coordinates.length)return Promise.reject("no coordinates for elevation query");const s="global"===this.view.viewingMode?u.WGS84:this._viewSR.wkid===k?u.WebMercator:u.PlateCarree,r=t.projectSync(s);r&&(t=r);const a=2*t.coordinates.length,n=this._lyr3DMain._malloc(8*a),o=new Float64Array(this._lyr3DMain.HEAPF64.buffer,n,a);for(let y=0;y<t.coordinates.length;++y){const e=t.coordinates[y];o[2*y]=e.x,o[2*y+1]=e.y}const l=i?.maxGeometricError??0,d=this._lyr3DMain.create_elevation_query(e.wasmLayerId,l,n,a);if(this._lyr3DMain._free(n),d===p)return Promise.reject("max mesh elevation query limit exceeded");if(d===f)return Promise.reject("elevation query failed");const h={wasmLayerId:e.wasmLayerId,descriptor:t,signal:i?.signal,resolveCallback:null,rejectCallback:null},_=new Promise((e,t)=>{h.resolveCallback=e,h.rejectCallback=t});return this._elevationQueries.set(d,h),_}_checkForAbortedElevationQueries(){const e=[];this._elevationQueries.forEach((t,i)=>{o(t.signal)&&(this._lyr3DMain.cancel_elevation_query(i),t.rejectCallback(n()),e.push(i))});for(let t=0;t<e.length;++t)this._elevationQueries.delete(e[t])}_cancelElevationQueriesForLayer(e){const t=new Array;this._elevationQueries.forEach((i,s)=>{i.wasmLayerId===e&&(this._lyr3DMain.cancel_elevation_query(s),i.rejectCallback(n()),t.push(s))}),t.forEach(e=>this._elevationQueries.delete(e))}_pulseTask(e){const t=this._lyr3DMain;if(t){if(this._cameraDirty){const e=this.view.state?.contentCamera;if(e){const{eye:i,center:s,up:r,near:a,far:n,fovY:o}=e,l=[e.screenViewport[2],e.screenViewport[3]],d={eye:i,center:s,up:r,near:a,far:n,fov:o,aspectRatio:e.width/e.height,viewport:l};t.set_camera_parameters(d),this._cameraDirty=!1}}if(this._cameraElevationDirty){const e=this.view.state?.contentCamera.relativeElevation;t.set_camera_elevation(e),this._cameraElevationDirty=!1}this._checkForAbortedElevationQueries();let i=0,s=0;this._layers.forEach(e=>{i+=e.layerView.usedMemory,s+=e.layerView.cachedMemory}),i/=1048576,s/=1048576;const r=this.view.resourceController.memoryController,a=r.usedMemory*r.maxMemory-i-this._lyr3DInternalMemoryBytes/1048576;this._lyr3DBusyCount=this._lyr3DMain.frame_pulse(r.memoryFactor,i,s,a,r.maxMemory),this._lyr3DInternalMemoryBytes=this._lyr3DMain.get_index_memory_bytes(),this._layers.forEach(e=>{this._cameraElevationDirty||(e.needFrame=!1),e.layerView.updatingFlagChanged()}),this._hasLayerThatReplacesTerrain&&!this._isTerrainReady&&(this._isTerrainReady=this._lyr3DMain.is_terrain_ready(),this._isTerrainReady&&this.notifyChange("isTerrainReady")),this._flushPendingWasmCalls(e)}}_isUpdating(e){return e.outstandingJobCount>0||e.outstandingRenderableCount>0||e.needFrame||this._cameraDirty||this._cameraElevationDirty||this._lyr3DBusyCount>0}_incrementJobCount(e,t){if(t.isForElevationQuery)return;const i=this._isUpdating(e);e.outstandingJobCount+=1,i||e.layerView.updatingFlagChanged()}_decrementJobCount(e,t){if(t.isForElevationQuery)return;const i=this._isUpdating(e);e.outstandingJobCount-=1;i!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_incrementRenderableCount(e){const t=this._isUpdating(e);e.outstandingRenderableCount+=1,t||e.layerView.updatingFlagChanged()}_decrementRenderableCount(e){const t=this._isUpdating(e);e.outstandingRenderableCount-=1;t!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_flushPendingWasmCalls(e){this._lyr3DMain&&(this._flushPendingCalls(this._pendingJobFailed,e),this._flushPendingCalls(this._pendingJobCompleted,e),this._flushPendingCalls(this._pendingRenderableCreated,e))}_flushPendingCalls(e,t){for(;!t.done&&e.length>0;){e.shift()(this._lyr3DMain),t.madeProgress()}}_decrementJobCountIfLayerExists(e,t){this._layers.get(e.layerView.wasmLayerId)===e&&this._decrementJobCount(e,t)}_decrementRenderableCountIfLayerExists(e){this._layers.get(e.layerView.wasmLayerId)===e&&this._decrementRenderableCount(e)}_onJobFailed(e,t,i){t.error.length&&this._debugLog(1,1,t.error,!1),this._lyr3DMain&&!e.layerView.destroyed?this._pendingJobFailed.push(t=>{try{t.on_job_failed(i.jobId,i.desc)}finally{this._decrementJobCountIfLayerExists(e,i)}}):this._decrementJobCountIfLayerExists(e,i)}_onJobSucceeded(e,t,i){if(e.layerView.destroyed)return void(this._lyr3DMain?this._pendingJobFailed.push(t=>{try{t.on_job_failed(i.jobId,i.desc)}finally{this._decrementJobCountIfLayerExists(e,i)}}):this._decrementJobCountIfLayerExists(e,i));const{data:s}=t;if(this._lyr3DMain){const r=r=>{try{const e=s.byteLength,a=this._ensureJobDataBuffer(e);new Uint8Array(r.HEAPU8.buffer,a,e).set(s),r.on_job_completed(i.jobId,t.jobDescJson,a,e)}finally{this._decrementJobCountIfLayerExists(e,i)}};this._pendingJobCompleted.push(r)}else this._decrementJobCountIfLayerExists(e,i)}_ensureJobDataBuffer(e){return e<=this._jobDataBufferCapacity&&this._jobDataBufferPtr||(this._jobDataBufferPtr&&this._lyr3DMain._free(this._jobDataBufferPtr),this._jobDataBufferPtr=this._lyr3DMain._malloc(e),this._jobDataBufferCapacity=e),this._jobDataBufferPtr}_getRequestPromises(e,i,s,r){const a=[];for(const n of e){const e=new URL(n);if("integrated-mesh-3dtiles"===r.type){if(e.origin===s.origin&&e.pathname===s.pathname){if(r.rootTileset){a.push(Promise.resolve(r.rootTileset.slice()));continue}}else r.session&&e.searchParams.set("session",r.session)}a.push(t(e.toString(),i).then(e=>e.data))}return a}_getInitialPromise(e,t,i,s,r,a,n){const o=this._getRequestPromises(e.urls,t,i,s);return Promise.all(o).then(e=>(r.inputs=e,this._workerHandle.invoke(r,a))).then(e=>e).catch(t=>{let i=1;return l(t)?this._debugLog(1,2,`job ${e.jobId} was cancelled.`):n&&400===t.details?.httpStatus?(i=3,this._debugLog(1,2,"Session expired, trying to create new Session.")):this._debugLog(1,1,`job ${e.jobId} failed with error ${t}.`),{status:i,error:"",jobDescJson:"",data:new Uint8Array(0),missingInputUrls:[],inputs:[]}})}async _onNewJob(){const e=this._lyr3DMain.get_next_job(),t=this._layers.get(e.layerId);if(!t)return;this._incrementJobCount(t,e);const i=t.abortController.signal,s=t.layerView.layer,r="integrated-mesh-3dtiles"===s.type?s.key:null,a="integrated-mesh-3dtiles"===s.type?s.session:null,n={responseType:"array-buffer",signal:i,query:{...t.customParameters,token:t.apiKey,key:r}},o={id:e.jobId,inputs:[],jobDescJson:e.desc.slice(),isMissingResourceCase:!1},d=new URL(s.url),h=r=>{if(1===r.status)this._onJobFailed(t,r,e);else if(0===r.status)this._onJobSucceeded(t,r,e);else if(2===r.status){const a=this._getRequestPromises(r.missingInputUrls,n,d,s);Promise.all(a).then(e=>{o.jobDescJson=r.jobDescJson,r.originalInputs?o.inputs=r.originalInputs:o.inputs=[],o.isMissingResourceCase=!0;for(const t of e)o.inputs.push(t);return this._workerHandle.invoke(o,i)}).then(i=>{1===i.status?this._onJobFailed(t,i,e):0===i.status&&this._onJobSucceeded(t,i,e)}).catch(i=>{l(i)?this._debugLog(1,2,`job ${e.jobId} was cancelled.`):this._debugLog(1,1,`job ${e.jobId} failed with error ${i}.`),this._lyr3DMain?this._pendingJobFailed.push(i=>{try{i.on_job_failed(e.jobId,e.desc)}finally{this._decrementJobCountIfLayerExists(t,e)}}):this._decrementJobCountIfLayerExists(t,e)})}};try{const t=await this._getInitialPromise(e,n,d,s,o,i,a);if(3===t.status&&"integrated-mesh-3dtiles"===s.type){a===s.session&&null!==s.session&&await s.requestRootAndSession(i);h(await this._getInitialPromise(e,n,d,s,o,i,s.session))}else h(t)}catch(_){_&&this._debugLog(1,1,_.toString(),!1),this._lyr3DMain?this._pendingJobFailed.push(i=>{try{i.on_job_failed(e.jobId,e.desc)}finally{this._decrementJobCountIfLayerExists(t,e)}}):this._decrementJobCountIfLayerExists(t,e)}}_onNewRenderable(){const e=this._lyr3DMain.get_next_renderable(),{assets:t}=e.entity3d;for(const[s,r]of Object.entries(t))r.data=r.data.slice();e.entity3d.validPrimitiveIndices=e.entity3d.validPrimitiveIndices.slice();const i=this._layers.get(e.layerId);i&&(this._incrementRenderableCount(i),i.layerView.createRenderable(e).then(t=>{!this._lyr3DMain||i.layerView.destroyed?this._decrementRenderableCountIfLayerExists(i):this._pendingRenderableCreated.push(s=>{try{const{layerId:i,handle:r}=e,a=t();s.on_renderable_created(!0,i,r,a.memUsageBytes,a.numGaussians??0)}finally{this._decrementRenderableCountIfLayerExists(i)}})}).catch(t=>{l(t)||this._debugLog(2,1,`createRenderable failed with error ${t}.`),!this._lyr3DMain||i.layerView.destroyed?this._decrementRenderableCountIfLayerExists(i):this._pendingRenderableCreated.push(t=>{try{const{layerId:i,handle:s}=e;t.on_renderable_created(!1,i,s,0,0)}finally{this._decrementRenderableCountIfLayerExists(i)}})}))}_freeRenderables(e,t,i){if(i<1)return;const s=this._layers.get(e);if(!s)return;const r=s.layerView,a=[],n=new Uint32Array(this._lyr3DMain.HEAPU32.buffer,t,i);for(let o=0;o<i;++o)a.push(n[o]);for(let o=0;o<i;++o)r.freeRenderable(a[o])}_setRenderableVisibility(e,t,i,s){if(s<1)return;const r=this._layers.get(e);if(!r)return;const a=r.layerView,n=[],o=[],l=new Uint32Array(this._lyr3DMain.HEAPU32.buffer,t,s),d=new Uint8Array(this._lyr3DMain.HEAPU8.buffer,i,s);for(let h=0;h<s;++h)n.push(l[h]),o.push(!!(1&d[h]));a.setRenderableVisibility(n,o,s)}_onWasmError(e,t,i,s){this._lyr3DMain&&this._debugLog(i,s,this._lyr3DMain.UTF8ToString(e,t),!1)}_onElevQueryComplete(e){const t=this._elevationQueries.get(e),i=this._lyr3DMain.get_elevation_query_result(e);if(t)if(i.succeeded&&i.zs){const s=i.zs.slice(),r=t.descriptor.clone();for(let e=0;e<s.length;++e)r.coordinates[e].z=s[e];this._debugLog(2,3,`Success EQ ${e}, number points ${s.length}.`),t.resolveCallback(r),this._elevationQueries.delete(e)}else t.rejectCallback(new s("elevation-query:error",i?.error??"Elevation query failed")),this._elevationQueries.delete(e);else this._debugLog(2,1,`_onElevQueryComplete called for unknown queryId ${e}.`)}_doRemoveLayerView(e){const t=this._layers.get(e.wasmLayerId);return!!t&&(t.abortController.abort(),this._cancelElevationQueriesForLayer(e.wasmLayerId),this._lyr3DMain.remove_layer(e.wasmLayerId),this._is3DTilesIMLayerView(e)&&e.layer.replacesTerrain&&(this._hasLayerThatReplacesTerrain=!1,this._isTerrainReady=!1,this.notifyChange("isTerrainReady")),this._layers.delete(e.wasmLayerId),!0)}_is3DTilesIMLayerView(e){return"integrated-mesh-3dtiles"===e.layer.type}_is3DTilesIMLayer(e){return"integrated-mesh-3dtiles"===e.type}_isGaussianSplatLayerView(e){return"gaussian-splat"===e.layer.type}_isGaussianSplatLayer(e){return"gaussian-splat"===e.type}_toWasmQuality(e){switch(e){case"low":return 1;case"medium":return 2;case"high":return 3}}_addLayerView(e){const t=e.layer;if(!t.url||!t.rootTilesetJSON)return{wasmLayerId:w};const i="integrated-mesh-3dtiles"===t.type?0:2,s=this._lyr3DMain.validate_root_tileset(JSON.stringify(t.rootTilesetJSON),i);if(0!==s.errorCode)return{wasmLayerId:w,check:s};const a=this._lyr3DMain.get_next_layer_id(),n=new AbortController;this._layers.set(a,{layerView:e,abortController:n,needMemoryUsageUpdate:!1,outstandingJobCount:0,outstandingRenderableCount:0,customParameters:t.customParameters,apiKey:t.apiKey,needFrame:!0});const o=L(t.elevationInfo),l=this._toWasmQuality(this.view?.qualityProfile),d=e=>r.getLogger(this).error("add-spatial-reference-error","Error when adding SR:",e);let h=!1;if(this._isGaussianSplatLayerView(e)&&this._isGaussianSplatLayer(t)||this._is3DTilesIMLayerView(e)&&this._is3DTilesIMLayer(t)){let i=t.spatialReference;if(e.useEsriCrs&&t.esriCrsSpatialReference){i=t.esriCrsSpatialReference;const s=c(i);let r=1,a=1;!s&&i.wkid&&-1!==i.wkid&&(r=m.values[m[i.wkid]],a=e.metersPerVCSUnit),this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(i)),s,r,a).catch(d),!this._haveAddedViewSRForNoOpPrj&&i.vcsWkid&&this._viewSR.vcsWkid&&-1!==this._viewSR.vcsWkid&&this._viewSR.vcsWkid!==i.vcsWkid&&(this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),!1,1,1).catch(d),this._haveAddedViewSRForNoOpPrj=!0)}this._isGaussianSplatLayerView(e)?h=this._lyr3DMain.add_gaussian_splat_layer(l,t.url,a,o):this._is3DTilesIMLayerView(e)&&(h=this._lyr3DMain.add_3dtiles_layer(l,t.url,a,o,e.layer.replacesTerrain),h&&e.layer.replacesTerrain&&(this._hasLayerThatReplacesTerrain=!0,this._isTerrainReady=!1,this.notifyChange("isTerrainReady")))}return h?(this._updateWasmCamera(),e.updatingFlagChanged(),{wasmLayerId:a}):(this._layers.delete(a),{wasmLayerId:w})}_updateWasmCamera(){const e=this.view.state?.contentCamera;e&&this._lyr3DMain&&(this._cameraDirty=!0,this._markAllLayerViewsUpdating())}_markAllLayerViewsUpdating(){this._layers.forEach(e=>{const t=this._isUpdating(e);e.needFrame=!0,t||e.layerView.updatingFlagChanged()})}_makeSRWasmSerializable(e){return{wkid:e?.wkid??-1,latestWkid:e?.latestWkid??-1,vcsWkid:e?.vcsWkid??-1,latestVcsWkid:e?.latestVcsWkid??-1,wkt:e?.wkt??""}}_cleanUpSR(e){return-1===e?.wkid&&e.latestWkid&&-1!==e.latestWkid?e.wkid=e.latestWkid:-1===e?.latestWkid&&e.wkid&&-1!==e.wkid&&(e.latestWkid=e.wkid),-1===e?.vcsWkid&&e.latestVcsWkid&&-1!==e.latestVcsWkid?e.vcsWkid=e.latestVcsWkid:-1===e?.latestVcsWkid&&e.vcsWkid&&-1!==e.vcsWkid&&(e.latestVcsWkid=e.vcsWkid),e}};e([_({constructOnly:!0})],W.prototype,"view",void 0),e([_()],W.prototype,"updating",null),e([_({readOnly:!0})],W.prototype,"isTerrainReady",null),W=e([y("esri.layers.Lyr3DWasmPerSceneView")],W);const V=W;export{V as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../request.js";import{has}from"../applications/Components/baUtils.js";import i from"../core/Accessor.js";import s from"../core/Error.js";import r from"../core/Logger.js";import{someMap as a}from"../core/MapUtils.js";import{createAbortError as n,isAborted as o,isAbortError as l}from"../core/promiseUtils.js";import d from"../core/ReactiveMap.js";import{watch as h}from"../core/reactiveUtils.js";import{property as _,subclass as y}from"../core/accessorSupport/decorators.js";import u from"../geometry/SpatialReference.js";import{isGeographic as c}from"../geometry/support/spatialReferenceUtils.js";import g from"../geometry/support/WKIDUnitConversion.js";import{wasmFailedToInit as m,elevQueriesFull as p,elevQueriesGenericFail as w,invalidLayerView as f}from"./ILyr3DWasmPerSceneView.js";import{Lyr3DWorkerHandle as b}from"./Lyr3DWorkerHandle.js";import{getVCSFromHeightModelInfo as v}from"./support/tiles3DUtils.js";import{loadLyr3DMainWASM as D}from"../libs/lyr3d/Lyr3DModule.js";import{getElevationOffsetInMeters as L}from"../support/elevationInfoUtils.js";import{makeScheduleFunction as M}from"../views/3d/layers/support/makeScheduleFunction.js";import{TaskPriority as C}from"../views/support/Scheduler.js";import{Yield as R}from"../views/support/Yield.js";const k=3857,S=32662,I=4326,V=5773;let W=class extends i{constructor(e){super(e),this._lyr3DMainPromise=null,this._lyr3DMain=null,this._layers=new Map,this._viewSR=null,this._haveAddedViewSRForNoOpPrj=!1,this._lyr3DBusyCount=0,this._lyr3DInternalMemoryBytes=0,this._isTerrainReady=!1,this._hasLayerThatReplacesTerrain=!1,this._elevationQueries=new d,this._pendingJobCompleted=new Array,this._pendingJobFailed=new Array,this._pendingRenderableCreated=new Array,this._jobDataBufferPtr=0,this._jobDataBufferCapacity=0,this._debugFlags=new Set,this._debugLevel=2,this._wasmNotLoaded="method requiring WASM was called when WASM isn't loaded",this._pulseTaskHandle=null,this._cameraDirty=!0,this._cameraElevationDirty=!0,this._debugFlags.add(0),this._debugFlags.add(1),this._debugFlags.add(2)}_debugLog(e,t,i,s=!0){if(this._debugFlags.has(e)&&this._debugLevel>=t){const e=s?`[js] ${i}`:`${i}`;0===t||1===t?r.getLogger(this).error(e):2===t&&r.getLogger(this).warn(e),r.getLogger(this).info(e)}}get viewSR(){return this._viewSR}get lyr3DInternalMemoryBytes(){return this._lyr3DInternalMemoryBytes}initialize(){this._debugLevel>2&&(r.getLogger(this).level="info"),this._debugLog(0,3,"Lyr3DWasmPerSceneView.initialize()"),this.addHandles([h(()=>this.view.state?.contentCamera,()=>this._updateWasmCamera()),h(()=>this.view.state?.contentCamera.relativeElevation,()=>{this._cameraElevationDirty=!0,this._markAllLayerViewsUpdating()}),this.view.resourceController.addUpdatingObject(this)]),this._pulseTaskHandle=this.view.resourceController.scheduler.registerTask(C.LYR3D,this)}destroy(){this._debugLog(0,3,"Lyr3DWasmPerSceneView.destroy()"),this._lyr3DMain&&(this._jobDataBufferPtr&&(this._lyr3DMain._free(this._jobDataBufferPtr),this._jobDataBufferPtr=0,this._jobDataBufferCapacity=0),this._layers.forEach(e=>{e.abortController.abort()}),this._elevationQueries.forEach((e,t)=>{this._lyr3DMain.cancel_elevation_query(t),e.rejectCallback(n())}),this._elevationQueries.clear(),this._lyr3DMain.uninitialize_lyr3d_wasm(),this._lyr3DMain=null),this._pendingJobCompleted.length=0,this._pendingJobFailed.length=0,this._pendingRenderableCreated.length=0;const e=this._workerHandle;e&&e.destroyWasm().then(()=>{this._workerHandle?.destroy(),this._workerHandle=null}),this._pulseTaskHandle?.remove(),this._pulseTaskHandle=null}get readyToRun(){return this._hasPendingPulseWork()}get updating(){return this._elevationQueries.size>0}runTask(e){return this._pulseTask(e),R}_hasPendingPulseWork(){return!!this._lyr3DMain&&(this._cameraDirty||this._cameraElevationDirty||this._pendingJobCompleted.length>0||this._pendingJobFailed.length>0||this._pendingRenderableCreated.length>0||this._elevationQueries.size>0||a(this._layers,e=>this._isUpdating(e)))}addLayerView(e){return this._lyr3DMain?this._addLayerView(e):(this._debugLog(0,1,"Lyr3DWasmPerSceneView.add3DTilesLayerView() called when WASM wasn't initialized"),{wasmLayerId:m})}removeLayerView(e){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;this._doRemoveLayerView(e);const t=this._layers.size;return 0===t&&(this._debugLog(0,3,"Lyr3DWasmPerSceneView.remove3DTilesLayerView() no Lyr3D layers left after removing a layer, destroying"),this.destroy()),t}getValidLayerViewCount(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),0;let e=0;return this._layers.forEach(t=>{t.layerView.wasmLayerId>=0&&++e}),e}setEnabled(e,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const i=this._layers.get(e.wasmLayerId);if(i){this._lyr3DMain.set_enabled(e.wasmLayerId,t),i.needMemoryUsageUpdate=!0;const s=this._isUpdating(i);i.needFrame=!0,s||i.layerView.updatingFlagChanged()}}setLayerOffset(e,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const i=this._layers.get(e.wasmLayerId);i&&(this._lyr3DMain.set_carto_offset_z(e.wasmLayerId,t),i.needFrame=!0,i.layerView.updatingFlagChanged())}getAttributionText(){if(!this._lyr3DMain)return this._debugLog(0,1,this._wasmNotLoaded),[];return this._lyr3DMain.get_current_attribution_text().split("|")}onRenderableEvicted(e,t,i){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);this._layers.get(e.wasmLayerId)&&this._lyr3DMain.on_renderable_evicted(e.wasmLayerId,t,i)}setMeshModifications(e,t){if(!this._lyr3DMain)return void this._debugLog(0,1,this._wasmNotLoaded);const i=this._layers.get(e.wasmLayerId);if(i){this._lyr3DMain.set_mesh_modification_polygons(e.wasmLayerId,t);const s=this._isUpdating(i);i.needFrame=!0,s||i.layerView.updatingFlagChanged()}}isUpdating(e){if(!this._lyr3DMain&&this._lyr3DMainPromise)return!0;const t=this._layers.get(e);return!!t&&this._isUpdating(t)}initializeWasm(e,t){return this._lyr3DMain?Promise.resolve():this.view.renderSpatialReference?(this._debugLog(0,3,"Lyr3DWasmPerSceneView.initializeWasm()"),this._lyr3DMainPromise||(this._lyr3DMainPromise=D().then(i=>{this._lyr3DMain=i,this._lyr3DMainPromise=null;const s=this._lyr3DMain.addFunction(this._onNewJob.bind(this),"vi"),r=this._lyr3DMain.addFunction(this._onNewRenderable.bind(this),"vi"),a=this._lyr3DMain.addFunction(this._freeRenderables.bind(this),"vi"),n=this._lyr3DMain.addFunction(this._setRenderableVisibility.bind(this),"vi"),o=this._lyr3DMain.addFunction(this._onWasmError.bind(this),"viiii"),l=this._lyr3DMain.addFunction(this._onElevQueryComplete.bind(this),"vi");if(!this.view.renderSpatialReference)return void(this._lyr3DMain=null);this._viewSR=this.view.renderSpatialReference?.toJSON();let d="global"===this.view.viewingMode?6:4;6===d?(this._viewSR.wkid=this._viewSR.latestWkid=I,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=V,this._viewSR.wkt=""):(this._viewSR.vcsWkid||(this._viewSR.vcsWkid=v(this.view.heightModelInfo)),this.view.renderSpatialReference?.isWebMercator?(this._viewSR.wkid=this._viewSR.latestWkid=k,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=V):this.view.renderSpatialReference?.wkid===S?(this._viewSR.wkid=this._viewSR.latestWkid=I,d=3,this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=V):this._viewSR.vcsWkid||this._viewSR.latestVcsWkid||(this._viewSR.vcsWkid=this._viewSR.latestVcsWkid=-1));const h=has("esri-lyr3D-max-concurrent-requests")??16;return this._lyr3DMain.initialize_lyr3d_wasm(o,s,r,a,n,l,e,t,d,this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),Math.max(this._debugLevel,0),h)?(this._workerHandle=new b(M(this.view.resourceController)),this._workerHandle.promise?this._workerHandle.promise:void 0):(this._lyr3DMain=null,void this._debugLog(0,0,"Lyr3d Main WASM failed to initialize",!1))}).catch(e=>{this._debugLog(0,0,`Lyr3d WASM failed to download error = ${e}`,!1)})),this._lyr3DMainPromise):Promise.reject()}get isTerrainReady(){return this._isTerrainReady}setLodPixelThreshold(e,t){this._lyr3DMain?.set_lod_pixel_threshold(t);const i=this._layers.get(e.wasmLayerId);i&&(i.needFrame=!0,i.layerView.updatingFlagChanged())}setMaximumGaussianSplatCount(e){this._lyr3DMain.set_maximum_splat_count(e),this._layers.forEach(e=>{"gaussian-splat-3d"===e.layerView.type&&(e.needFrame=!0,e.layerView.updatingFlagChanged())})}queryElevation(e,t,i){if(!this._lyr3DMain)return Promise.reject(this._wasmNotLoaded);if(0===t.coordinates.length)return Promise.reject("no coordinates for elevation query");const s="global"===this.view.viewingMode?u.WGS84:this._viewSR.wkid===k?u.WebMercator:u.PlateCarree,r=t.projectSync(s);r&&(t=r);const a=2*t.coordinates.length,n=this._lyr3DMain._malloc(8*a),o=new Float64Array(this._lyr3DMain.HEAPF64.buffer,n,a);for(let y=0;y<t.coordinates.length;++y){const e=t.coordinates[y];o[2*y]=e.x,o[2*y+1]=e.y}const l=i?.maxGeometricError??0,d=this._lyr3DMain.create_elevation_query(e.wasmLayerId,l,n,a);if(this._lyr3DMain._free(n),d===p)return Promise.reject("max mesh elevation query limit exceeded");if(d===w)return Promise.reject("elevation query failed");const h={wasmLayerId:e.wasmLayerId,descriptor:t,signal:i?.signal,resolveCallback:null,rejectCallback:null},_=new Promise((e,t)=>{h.resolveCallback=e,h.rejectCallback=t});return this._elevationQueries.set(d,h),_}_checkForAbortedElevationQueries(){const e=[];this._elevationQueries.forEach((t,i)=>{o(t.signal)&&(this._lyr3DMain.cancel_elevation_query(i),t.rejectCallback(n()),e.push(i))});for(let t=0;t<e.length;++t)this._elevationQueries.delete(e[t])}_cancelElevationQueriesForLayer(e){const t=new Array;this._elevationQueries.forEach((i,s)=>{i.wasmLayerId===e&&(this._lyr3DMain.cancel_elevation_query(s),i.rejectCallback(n()),t.push(s))}),t.forEach(e=>this._elevationQueries.delete(e))}_pulseTask(e){const t=this._lyr3DMain;if(t){if(this._cameraDirty){const e=this.view.state?.contentCamera;if(e){const{eye:i,center:s,up:r,near:a,far:n,fovY:o}=e,l=[e.screenViewport[2],e.screenViewport[3]],d={eye:i,center:s,up:r,near:a,far:n,fov:o,aspectRatio:e.width/e.height,viewport:l};t.set_camera_parameters(d),this._cameraDirty=!1}}if(this._cameraElevationDirty){const e=this.view.state?.contentCamera.relativeElevation;t.set_camera_elevation(e),this._cameraElevationDirty=!1}this._checkForAbortedElevationQueries();let i=0,s=0;this._layers.forEach(e=>{i+=e.layerView.usedMemory,s+=e.layerView.cachedMemory}),i/=1048576,s/=1048576;const r=this.view.resourceController.memoryController,a=r.usedMemory*r.maxMemory-i-this._lyr3DInternalMemoryBytes/1048576;this._lyr3DBusyCount=this._lyr3DMain.frame_pulse(r.memoryFactor,i,s,a,r.maxMemory),this._lyr3DInternalMemoryBytes=this._lyr3DMain.get_index_memory_bytes(),this._layers.forEach(e=>{this._cameraElevationDirty||(e.needFrame=!1),e.layerView.updatingFlagChanged()}),this._hasLayerThatReplacesTerrain&&!this._isTerrainReady&&(this._isTerrainReady=this._lyr3DMain.is_terrain_ready(),this._isTerrainReady&&this.notifyChange("isTerrainReady")),this._flushPendingWasmCalls(e)}}_isUpdating(e){return e.outstandingJobCount>0||e.outstandingRenderableCount>0||e.needFrame||this._cameraDirty||this._cameraElevationDirty||this._lyr3DBusyCount>0}_incrementJobCount(e,t){if(t.isForElevationQuery)return;const i=this._isUpdating(e);e.outstandingJobCount+=1,i||e.layerView.updatingFlagChanged()}_decrementJobCount(e,t){if(t.isForElevationQuery)return;const i=this._isUpdating(e);e.outstandingJobCount-=1;i!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_incrementRenderableCount(e){const t=this._isUpdating(e);e.outstandingRenderableCount+=1,t||e.layerView.updatingFlagChanged()}_decrementRenderableCount(e){const t=this._isUpdating(e);e.outstandingRenderableCount-=1;t!==this._isUpdating(e)&&e.layerView.updatingFlagChanged()}_flushPendingWasmCalls(e){this._lyr3DMain&&(this._flushPendingCalls(this._pendingJobFailed,e),this._flushPendingCalls(this._pendingJobCompleted,e),this._flushPendingCalls(this._pendingRenderableCreated,e))}_flushPendingCalls(e,t){for(;!t.done&&e.length>0;){e.shift()(this._lyr3DMain),t.madeProgress()}}_decrementJobCountIfLayerExists(e,t){this._layers.get(e.layerView.wasmLayerId)===e&&this._decrementJobCount(e,t)}_decrementRenderableCountIfLayerExists(e){this._layers.get(e.layerView.wasmLayerId)===e&&this._decrementRenderableCount(e)}_onJobFailed(e,t,i){t.error.length&&this._debugLog(1,1,t.error,!1),this._lyr3DMain&&!e.layerView.destroyed?this._pendingJobFailed.push(t=>{try{t.on_job_failed(i.jobId,i.desc)}finally{this._decrementJobCountIfLayerExists(e,i)}}):this._decrementJobCountIfLayerExists(e,i)}_onJobSucceeded(e,t,i){if(e.layerView.destroyed)return void(this._lyr3DMain?this._pendingJobFailed.push(t=>{try{t.on_job_failed(i.jobId,i.desc)}finally{this._decrementJobCountIfLayerExists(e,i)}}):this._decrementJobCountIfLayerExists(e,i));const{data:s}=t;if(this._lyr3DMain){const r=r=>{try{const e=s.byteLength,a=this._ensureJobDataBuffer(e);new Uint8Array(r.HEAPU8.buffer,a,e).set(s),r.on_job_completed(i.jobId,t.jobDescJson,a,e)}finally{this._decrementJobCountIfLayerExists(e,i)}};this._pendingJobCompleted.push(r)}else this._decrementJobCountIfLayerExists(e,i)}_ensureJobDataBuffer(e){return e<=this._jobDataBufferCapacity&&this._jobDataBufferPtr||(this._jobDataBufferPtr&&this._lyr3DMain._free(this._jobDataBufferPtr),this._jobDataBufferPtr=this._lyr3DMain._malloc(e),this._jobDataBufferCapacity=e),this._jobDataBufferPtr}_getRequestPromises(e,i,s,r){const a=[];for(const n of e){const e=new URL(n);if("integrated-mesh-3dtiles"===r.type){if(e.origin===s.origin&&e.pathname===s.pathname){if(r.rootTileset){a.push(Promise.resolve(r.rootTileset.slice()));continue}}else r.session&&e.searchParams.set("session",r.session)}a.push(t(e.toString(),i).then(e=>e.data))}return a}_getInitialPromise(e,t,i,s,r,a,n){const o=this._getRequestPromises(e.urls,t,i,s);return Promise.all(o).then(e=>(r.inputs=e,this._workerHandle.invoke(r,a))).then(e=>e).catch(t=>{let i=1;return l(t)?this._debugLog(1,2,`job ${e.jobId} was cancelled.`):n&&400===t.details?.httpStatus?(i=3,this._debugLog(1,2,"Session expired, trying to create new Session.")):this._debugLog(1,1,`job ${e.jobId} failed with error ${t}.`),{status:i,error:"",jobDescJson:"",data:new Uint8Array(0),missingInputUrls:[],inputs:[]}})}async _onNewJob(e){let t;try{t=this._lyr3DMain.Emval.toValue(e);const s=this._layers.get(t.layerId);if(!s)return;this._incrementJobCount(s,t);const r=s.abortController.signal,a=s.layerView.layer,n="integrated-mesh-3dtiles"===a.type?a.key:null,o="integrated-mesh-3dtiles"===a.type?a.session:null,d={responseType:"array-buffer",signal:r,query:{...s.customParameters,token:s.apiKey,key:n}},h={id:t.jobId,inputs:[],jobDescJson:t.desc.slice(),isMissingResourceCase:!1},_=new URL(a.url),y=e=>{if(1===e.status)this._onJobFailed(s,e,t);else if(0===e.status)this._onJobSucceeded(s,e,t);else if(2===e.status){const i=this._getRequestPromises(e.missingInputUrls,d,_,a);Promise.all(i).then(t=>{h.jobDescJson=e.jobDescJson,e.originalInputs?h.inputs=e.originalInputs:h.inputs=[],h.isMissingResourceCase=!0;for(const e of t)h.inputs.push(e);return this._workerHandle.invoke(h,r)}).then(e=>{1===e.status?this._onJobFailed(s,e,t):0===e.status&&this._onJobSucceeded(s,e,t)}).catch(e=>{l(e)?this._debugLog(1,2,`job ${t.jobId} was cancelled.`):this._debugLog(1,1,`job ${t.jobId} failed with error ${e}.`),this._lyr3DMain?this._pendingJobFailed.push(e=>{try{e.on_job_failed(t.jobId,t.desc)}finally{this._decrementJobCountIfLayerExists(s,t)}}):this._decrementJobCountIfLayerExists(s,t)})}};try{const e=await this._getInitialPromise(t,d,_,a,h,r,o);if(3===e.status&&"integrated-mesh-3dtiles"===a.type){o===a.session&&null!==a.session&&await a.requestRootAndSession(r);y(await this._getInitialPromise(t,d,_,a,h,r,a.session))}else y(e)}catch(i){i&&this._debugLog(1,1,i.toString(),!1),this._lyr3DMain?this._pendingJobFailed.push(e=>{try{e.on_job_failed(t.jobId,t.desc)}finally{this._decrementJobCountIfLayerExists(s,t)}}):this._decrementJobCountIfLayerExists(s,t)}}catch(i){i&&this._debugLog(1,1,i.toString(),!1)}}_onNewRenderable(e){try{const t=this._lyr3DMain.Emval.toValue(e),i=this._layers.get(t.layerId);i&&(this._incrementRenderableCount(i),i.layerView.createRenderable(t).then(e=>{!this._lyr3DMain||i.layerView.destroyed?this._decrementRenderableCountIfLayerExists(i):this._pendingRenderableCreated.push(s=>{try{const{layerId:i,handle:r}=t,a=e();s.on_renderable_created(!0,i,r,a.memUsageBytes,a.numGaussians??0)}finally{this._decrementRenderableCountIfLayerExists(i)}})}).catch(e=>{l(e)||this._debugLog(2,1,`createRenderable failed with error ${e}.`),!this._lyr3DMain||i.layerView.destroyed?this._decrementRenderableCountIfLayerExists(i):this._pendingRenderableCreated.push(e=>{try{const{layerId:i,handle:s}=t;e.on_renderable_created(!1,i,s,0,0)}finally{this._decrementRenderableCountIfLayerExists(i)}})}))}catch(t){t&&this._debugLog(1,1,t.toString(),!1)}}_freeRenderables(e){try{const t=this._lyr3DMain.Emval.toValue(e),i=this._layers.get(t.layerId);if(t.handles.length<1||!i)return;const s=i.layerView;for(let e=0;e<t.handles.length;++e)s.freeRenderable(t.handles[e])}catch(t){t&&this._debugLog(1,1,t.toString(),!1)}}_setRenderableVisibility(e){try{const t=this._lyr3DMain.Emval.toValue(e),i=this._layers.get(t.layerId);if(t.handles.length<1||t.visibility.length!==t.handles.length||!i)return;const s=i.layerView,r=[],a=[];for(let e=0;e<t.handles.length;++e)r.push(t.handles[e]),a.push(!!(1&t.visibility[e]));s.setRenderableVisibility(r,a,t.handles.length)}catch(t){t&&this._debugLog(1,1,t.toString(),!1)}}_onWasmError(e,t,i,s){if(this._lyr3DMain)try{this._debugLog(i,s,this._lyr3DMain.UTF8ToString(e,t),!1)}catch(r){}}_onElevQueryComplete(e){try{const t=this._lyr3DMain.Emval.toValue(e),{queryId:i}=t,r=this._elevationQueries.get(i);if(!r)return void this._debugLog(2,1,`_onElevQueryComplete called for unknown queryId ${i}.`);if(t.succeeded&&t.zs){const{zs:e}=t,s=r.descriptor.clone();for(let t=0;t<e.length;++t)s.coordinates[t].z=e[t];this._debugLog(2,3,`Success EQ ${i}, number points ${e.length}.`),r.resolveCallback(s),this._elevationQueries.delete(i)}else r.rejectCallback(new s("elevation-query:error",t?.error??"Elevation query failed")),this._elevationQueries.delete(i)}catch(t){t&&this._debugLog(1,1,t.toString(),!1)}}_doRemoveLayerView(e){const t=this._layers.get(e.wasmLayerId);return!!t&&(t.abortController.abort(),this._cancelElevationQueriesForLayer(e.wasmLayerId),this._lyr3DMain.remove_layer(e.wasmLayerId),this._is3DTilesIMLayerView(e)&&e.layer.replacesTerrain&&(this._hasLayerThatReplacesTerrain=!1,this._isTerrainReady=!1,this.notifyChange("isTerrainReady")),this._layers.delete(e.wasmLayerId),!0)}_is3DTilesIMLayerView(e){return"integrated-mesh-3dtiles"===e.layer.type}_is3DTilesIMLayer(e){return"integrated-mesh-3dtiles"===e.type}_isGaussianSplatLayerView(e){return"gaussian-splat"===e.layer.type}_isGaussianSplatLayer(e){return"gaussian-splat"===e.type}_toWasmQuality(e){switch(e){case"low":return 1;case"medium":return 2;case"high":return 3}}_addLayerView(e){const t=e.layer;if(!t.url||!t.rootTilesetJSON)return{wasmLayerId:f};const i="integrated-mesh-3dtiles"===t.type?0:2,s=this._lyr3DMain.validate_root_tileset(JSON.stringify(t.rootTilesetJSON),i);if(0!==s.errorCode)return{wasmLayerId:f,check:s};const a=this._lyr3DMain.get_next_layer_id(),n=new AbortController;this._layers.set(a,{layerView:e,abortController:n,needMemoryUsageUpdate:!1,outstandingJobCount:0,outstandingRenderableCount:0,customParameters:t.customParameters,apiKey:t.apiKey,needFrame:!0});const o=L(t.elevationInfo),l=this._toWasmQuality(this.view?.qualityProfile),d=e=>r.getLogger(this).error("add-spatial-reference-error","Error when adding SR:",e);let h=!1;if(this._isGaussianSplatLayerView(e)&&this._isGaussianSplatLayer(t)||this._is3DTilesIMLayerView(e)&&this._is3DTilesIMLayer(t)){let i=t.spatialReference;if(e.useEsriCrs&&t.esriCrsSpatialReference){i=t.esriCrsSpatialReference;const s=c(i);let r=1,a=1;!s&&i.wkid&&-1!==i.wkid&&(r=g.values[g[i.wkid]],a=e.metersPerVCSUnit),this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(i)),s,r,a).catch(d),!this._haveAddedViewSRForNoOpPrj&&i.vcsWkid&&this._viewSR.vcsWkid&&-1!==this._viewSR.vcsWkid&&this._viewSR.vcsWkid!==i.vcsWkid&&(this._workerHandle.addSpatialReferenceInfo(this._cleanUpSR(this._makeSRWasmSerializable(this._viewSR)),!1,1,1).catch(d),this._haveAddedViewSRForNoOpPrj=!0)}this._isGaussianSplatLayerView(e)?h=this._lyr3DMain.add_gaussian_splat_layer(l,t.url,a,o):this._is3DTilesIMLayerView(e)&&(h=this._lyr3DMain.add_3dtiles_layer(l,t.url,a,o,e.layer.replacesTerrain),h&&e.layer.replacesTerrain&&(this._hasLayerThatReplacesTerrain=!0,this._isTerrainReady=!1,this.notifyChange("isTerrainReady")))}return h?(this._updateWasmCamera(),e.updatingFlagChanged(),{wasmLayerId:a}):(this._layers.delete(a),{wasmLayerId:f})}_updateWasmCamera(){const e=this.view.state?.contentCamera;e&&this._lyr3DMain&&(this._cameraDirty=!0,this._markAllLayerViewsUpdating())}_markAllLayerViewsUpdating(){this._layers.forEach(e=>{const t=this._isUpdating(e);e.needFrame=!0,t||e.layerView.updatingFlagChanged()})}_makeSRWasmSerializable(e){return{wkid:e?.wkid??-1,latestWkid:e?.latestWkid??-1,vcsWkid:e?.vcsWkid??-1,latestVcsWkid:e?.latestVcsWkid??-1,wkt:e?.wkt??""}}_cleanUpSR(e){return-1===e?.wkid&&e.latestWkid&&-1!==e.latestWkid?e.wkid=e.latestWkid:-1===e?.latestWkid&&e.wkid&&-1!==e.wkid&&(e.latestWkid=e.wkid),-1===e?.vcsWkid&&e.latestVcsWkid&&-1!==e.latestVcsWkid?e.vcsWkid=e.latestVcsWkid:-1===e?.latestVcsWkid&&e.vcsWkid&&-1!==e.vcsWkid&&(e.latestVcsWkid=e.vcsWkid),e}};e([_({constructOnly:!0})],W.prototype,"view",void 0),e([_()],W.prototype,"updating",null),e([_({readOnly:!0})],W.prototype,"isTerrainReady",null),W=e([y("esri.layers.Lyr3DWasmPerSceneView")],W);const j=W;export{j as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{indexOf as e,PositionHint as t}from"../../../core/arrayUtils.js";import{toConst as i}from"../../../core/compilerUtils.js";import r from"../../../core/Error.js";import"../../../core/has.js";import{clone as s}from"../../../core/lang.js";import{removeMaybe as a,destroyMaybe as n}from"../../../core/maybe.js";import{signalFromSignalOrOptions as l,throwIfAborted as o}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as u}from"../../../core/units.js";import{isSerializable as c}from"../../../core/support/jsonUtils.js";import{isLoaded as y}from"../../../geometry/projectionUtils.js";import{set as h,create as d,expandWithAABB as m,negativeInfinity as f}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as p,create as x}from"../../../geometry/support/aaBoundingRect.js";import{getBoundsXY as g}from"../../../geometry/support/boundsUtils.js";import{isExtent as _,isPolygon as F}from"../../../geometry/support/jsonTypeUtils.js";import{fromJSON as w}from"../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as Q}from"../../../geometry/support/normalizeUtils.js";import{equals as S,isValid as R}from"../../../geometry/support/spatialReferenceUtils.js";import{convertFromGeometry as I}from"../featureConversionUtils.js";import{getWhereClause as j}from"./attributeSupport.js";import{getGeometry as E,cleanFromGeometryEngine as b}from"./geometryUtils.js";import{checkProjectionSupport as T,project as A,projectMany as v}from"./projectionSupport.js";import{QueryEngineCache as G}from"./QueryEngineCache.js";import{queryCapabilities as k}from"./QueryEngineCapabilities.js";import{QueryEngineResult as C}from"./QueryEngineResult.js";import{queryEngineEmptyResult as O,normalizeAttributeBinsQuery as P,normalizeQueryLike as q,normalizeQuery as z}from"./queryUtils.js";import{validateAttributeBinsQuery as U,validateQuery as B,validateStatisticsQuery as M}from"./queryValidationUtils.js";import{getSpatialQueryOperator as H,canQueryWithRBush as Z}from"./spatialQuerySupport.js";import{getTimeExtent as J,getTimeOperator as L}from"./timeSupport.js";import N from"../../support/FieldsIndex.js";import{ImmediateTask as V}from"../../../views/support/Scheduler.js";const D="unsupported-query";class K{constructor(e,t=null,i,r,s){this.attributes=e,this.geometry=i,this.centroid=r,this.filterFlags=s,this.groupId=-1,this.displayId=t}}class W{constructor(e){this._changeHandle=null,this.capabilities={query:k},this.geometryType=e.geometryType,this.hasM=!!e.hasM,this.hasZ=!!e.hasZ,this.spatialReference=e.spatialReference,this.definitionExpression=e.definitionExpression,this.featureStore=e.featureStore,this.aggregateAdapter=e.aggregateAdapter,this._cache=e.cache??new G,this.timeInfo=e.timeInfo,this.featureIdInfo=e.featureIdInfo,this._changeHandle=this.featureStore.events.on("changed",()=>this._clearCache()),this.fieldsIndex=c(e.fieldsIndex)?e.fieldsIndex:N.fromJSON(e.fieldsIndex),!e.availableFields||1===e.availableFields.length&&"*"===e.availableFields[0]?this.availableFields=new Set(this.fieldsIndex.fields.map(e=>e.name)):this.availableFields=new Set(e.availableFields.map(e=>this.fieldsIndex.get(e)?.name).filter(e=>null!=e)),e.scheduler&&e.priority?this._frameTask=e.scheduler.registerTask(e.priority):this._frameTask=V}destroy(){this._changeHandle=a(this._changeHandle),this._frameTask=a(this._frameTask),this._clearCache(),n(this._cache)}get featureAdapter(){return this.featureStore.featureAdapter}async executeQuery(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryFeatureSet(e),i)}async executeQueryForCount(e={},t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForCount(e),i)}async executeQueryForExtent(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForExtent(e),i)}async executeQueryForIds(e,t){return Array.from(await this.executeQueryForIdSet(e,t))}async executeQueryForIdSet(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForIdSet(e),i)}async executeQueryForLatestObservations(e,t){const i=l(t);if(!this.timeInfo?.trackIdField)throw new r(D,"Missing timeInfo or timeInfo.trackIdField",{query:e,timeInfo:this.timeInfo});return await this._frameTask.scheduleGenerator(()=>this._executeQueryForLatestObservations(e),i)}async executeQueryForOpaqueFeatures(e,t){const i=l(t);return(await this._frameTask.scheduleGenerator(()=>this._executeQuery(e,{}),i)).items}async executeAttributeBinsQuery(e,t){const i=l(t);return e=s(e),await this._frameTask.scheduleGenerator(()=>this._executeAttributeBinsQuery(e),i)}async executeQueryForSummaryStatistics(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForSummaryStatistics(e,t),r)}async executeQueryForUniqueValues(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForUniqueValues(e,t),r)}async executeQueryForClassBreaks(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForClassBreaks(e,t),r)}async executeQueryForHistogram(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForHistogram(e,t),r)}async executeQueryForSnapping(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForSnapping(e,i),i)}async fetchRecomputedExtents(e){const t=l(e);this._timeExtentPromise||=J(this.timeInfo,this.featureStore);const[i,r]=await Promise.all([this._getFullExtent(),this._timeExtentPromise]);return o(t),{fullExtent:i,timeExtent:r}}_clearCache(){this._cache.clear(),this._allFeaturesPromise=null,this._timeExtentPromise=null,this._fullExtentPromise=null}async*_executeQueryFeatureSet(e){try{const t=yield*this._executeQuery(e,{});return yield,await t.createQueryResponse()}catch(t){if(t!==O)throw t;return await new C([],e,this).createQueryResponse()}}async*_executeQueryForCount(e){try{const t=yield*this._executeQuery(e,{returnGeometry:!1,returnCentroid:!1,outSR:null});return yield,t.createQueryResponseForCount()}catch(t){if(t!==O)throw t;return 0}}async*_executeQueryForExtent(e){const t=e.outSR;try{const i=yield*this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null});yield;const r=i.size;if(!r)return{count:0,extent:null};const s=await this._getBounds(i.items,i.spatialReference,t??this.spatialReference);return yield,{count:r,extent:s}}catch(i){if(i===O)return{count:0,extent:null};throw i}}async*_executeQueryForIdSet(e){try{const t=yield*this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null});yield;const i=t.items,r=new Set;for(const e of i)r.add(t.featureAdapter.getObjectId(e));return r}catch(t){if(t===O)return new Set;throw t}}async*_executeQueryForLatestObservations(e){try{const t=yield*this._executeQuery(e,{});return yield,this._filterLatest(t),yield,await t.createQueryResponse()}catch(t){if(t!==O)throw t;return await new C([],e,this).createQueryResponse()}}async*_executeAttributeBinsQuery(e){let t;try{e=await P(e,this.definitionExpression,this.spatialReference),yield,e=await U(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const i=yield*this._executeSceneFilterQuery(e);yield,t=yield*this._executeGeometryQuery(e,i),yield,this._executeAggregateIdsQuery(t),yield,this._executeObjectIdsQuery(t),yield,this._executeTimeQuery(t),yield,this._executeAttributesQuery(t),yield}catch(i){if(i!==O)throw i;t=new C([],e,this)}return await t.createQueryBinsResponse(e)}async*_executeQueryForSummaryStatistics(e={},t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createSummaryStatisticsResponse(t)}async*_executeQueryForUniqueValues(e={},t){const{field:i,field2:r,field3:s,valueExpression:a}=t,n=yield*this._executeQueryForStatistics(e,{field:i,field2:r,field3:s,valueExpression:a});return yield,await n.createUniqueValuesResponse(t)}async*_executeQueryForClassBreaks(e,t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createClassBreaksResponse(t)}async*_executeQueryForHistogram(e,t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createHistogramResponse(t)}async*_executeQueryForSnapping(e,t){const{point:i,distance:r,returnEdge:a,vertexMode:n}=e;if(!a&&"none"===n)return{candidates:[]};let l=s(e.query);l=await q(l,this.definitionExpression,this.spatialReference),yield,l=await B(l,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const o=!S(i.spatialReference,this.spatialReference);o&&(await T(i.spatialReference,this.spatialReference),yield);const u="number"==typeof r?r:r.x,c="number"==typeof r?r:r.y,y={xmin:i.x-u,xmax:i.x+u,ymin:i.y-c,ymax:i.y+c,spatialReference:i.spatialReference},h=o?A(y,this.spatialReference):y;if(!h)return{candidates:[]};const d=(await Q(w(i),null,{signal:t}))[0];yield;const m=(await Q(w(h),null,{signal:t}))[0];if(yield,null==d||null==m)return{candidates:[]};const f=await this._searchFeatures(X(m.toJSON()));yield;const p=new C(f,l,this);this._executeObjectIdsQuery(p),yield,this._executeTimeQuery(p),yield,this._executeAttributesQuery(p),yield,yield*this._executeGeometryQueryForSnapping(p),yield;const x=d.toJSON(),g=o?A(x,this.spatialReference):x,_=o?Math.max(h.xmax-h.xmin,h.ymax-h.ymin)/2:r;return p.createSnappingResponse({...e,point:g,distance:_},l.returnZ,i.spatialReference)}async _getBounds(e,t,i){const r=h(d(),f);return await this.featureStore.forEachBounds(e,e=>m(r,e)),Y(r,t,i,this.spatialReference,this.hasZ)}_getFullExtent(){return this._fullExtentPromise||="getFullExtent"in this.featureStore&&this.featureStore.getFullExtent?Promise.resolve(this.featureStore.getFullExtent(this.spatialReference)):this._getAllFeatures().then(e=>this._getBounds(e,this.spatialReference,this.spatialReference)),this._fullExtentPromise}async _getAllFeaturesQueryEngineResult(e){return new C(await this._getAllFeatures(),e,this)}async _getAllFeatures(){if(null==this._allFeaturesPromise){const e=[];this._allFeaturesPromise=(async()=>await this.featureStore.forEach(t=>e.push(t)))().then(()=>i(e))}const e=this._allFeaturesPromise,t=await e;return e===this._allFeaturesPromise?t.slice():this._getAllFeatures()}async*_executeQuery(e,t){e=s(e),e=await z(e,this.definitionExpression,this.spatialReference),yield,e=await B(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield,e={...e,...t};const i=yield*this._executeSceneFilterQuery(e);yield;const r=yield*this._executeGeometryQuery(e,i);return yield,this._executeAggregateIdsQuery(r),yield,this._executeObjectIdsQuery(r),yield,this._executeTimeQuery(r),yield,this._executeAttributesQuery(r),r}async*_executeSceneFilterQuery(e){if(null==e.sceneFilter)return null;const{outSR:t,returnGeometry:i,returnCentroid:r}=e,s=this.featureStore.featureSpatialReference,a=e.sceneFilter.geometry,n=null==s||S(s,a.spatialReference)?a:A(a,s);if(!n)return null;const l=i||r,o=R(t)&&!S(this.spatialReference,t)&&l?async e=>this._project(e,t):e=>e;yield;const u=this.featureAdapter,c=await this._searchFeatures(X(n));yield;if("disjoint"===e.sceneFilter.spatialRelationship){if(!c.length)return null;const t=new Set;for(const e of c)t.add(u.getObjectId(e));const i=await this._getAllFeatures();yield;const r=await H("esriSpatialRelDisjoint",n,this.geometryType);yield;const s=e=>!t.has(u.getObjectId(e))||r(u.getGeometry(e)),a=yield*this._runSpatialFilter(i,s);yield;const l=new C(a,e,this);return await o(l)}if(!c.length)return new C([],e,this);if(this._canExecuteSinglePass(n,e))return await o(new C(c,e,this));const y=await H("esriSpatialRelContains",n,this.geometryType);yield;const h=yield*this._runSpatialFilter(c,e=>y(u.getGeometry(e)));return yield,await o(new C(h,e,this))}async*_executeGeometryQuery(i,r){if(null!=r&&0===r.items.length)return r;const{geometry:s,outSR:a,returnGeometry:n,returnCentroid:l}=i,o=r?null:this._getCacheKey(i),u=o?this._cache.get(o):null;if(u)return new C(u,i,this);const c=R(a)&&!S(this.spatialReference,a),y=n||l,h=async e=>(c&&y&&await this._project(e,a),o&&this._cache.put(o,e.items),e),d=this.featureStore.featureSpatialReference,m=!s||null==d||S(d,s.spatialReference)?s:A(s,d);if(!m)return await h(null!=r?r:await this._getAllFeaturesQueryEngineResult(i));yield;const f=this.featureAdapter;let p=await this._searchFeatures(X(s));yield;const x=i.spatialRel??"esriSpatialRelIntersects";if("esriSpatialRelDisjoint"===x){if(!p.length)return await h(null!=r?r:await this._getAllFeaturesQueryEngineResult(i));const e=new Set;for(const i of p)e.add(f.getObjectId(i));let t;null!=r?t=r.items:(yield,t=await this._getAllFeatures(),yield);const s=await H(x,m,this.geometryType);yield;const a=t=>!e.has(f.getObjectId(t))||s(f.getGeometry(t)),n=yield*this._runSpatialFilter(t,a);yield;const l=new C(n,i,this);return await h(l)}if(null!=r){const i=new t;p=p.filter(t=>e(r.items,t,r.items.length,i)>=0)}if(!p.length){const e=new C([],i,this);return o&&this._cache.put(o,e.items),e}if(this._canExecuteSinglePass(m,i))return await h(new C(p,i,this));const g=await H(x,m,this.geometryType);yield;const _=yield*this._runSpatialFilter(p,e=>g(f.getGeometry(e)));return yield,await h(new C(_,i,this))}_executeAggregateIdsQuery(e){if(0===e.items.length||!e.query.aggregateIds?.length||null==this.aggregateAdapter)return;const t=new Set;for(const r of e.query.aggregateIds){this.aggregateAdapter.getFeatureObjectIds(r).forEach(e=>t.add(e))}const i=this.featureAdapter.getObjectId;e.items=e.items.filter(e=>t.has(i(e)))}_executeObjectIdsQuery(e){if(0===e.items.length||!e.query.objectIds?.length)return;const t=new Set(e.query.objectIds),i=this.featureAdapter.getObjectId;e.items=e.items.filter(e=>t.has(i(e)))}_executeTimeQuery(e){if(0===e.items.length)return;const t=L(this.timeInfo,e.query.timeExtent,this.featureAdapter);null!=t&&(e.items=e.items.filter(t))}_executeAttributesQuery(e){if(0===e.items.length)return;const t=j(e.query.where,this.fieldsIndex);if(t){if(!t.isStandardized)throw new TypeError("Where clause is not standardized");e.items=e.items.filter(e=>t.testFeature(e,this.featureAdapter))}}async*_executeGeometryQueryForSnapping(e){const{query:t}=e,{spatialRel:i}=t;if(!e?.items?.length||!t.geometry||!i)return;const r=await H(i,t.geometry,this.geometryType);yield;const s=this.featureAdapter,a=e=>r(s.getGeometry(e)),n=yield*this._runSpatialFilter(e.items,a);e.items=n}*_runSpatialFilter(e,t){if(!t)return e;if(null==this._frameTask)return e.filter(e=>t(e));let i=yield;const r=new Array;for(const s of e)t(s)&&r.push(s),i.madeProgress(),i.done&&(i=yield);return r}_filterLatest(e){const{trackIdField:t,startTimeField:i,endTimeField:r}=this.timeInfo,s=r||i,a=new Map,n=this.featureAdapter.getAttribute;for(const l of e.items){const e=n(l,t),i=n(l,s),r=a.get(e);(!r||i>n(r,s))&&a.set(e,l)}e.items=Array.from(a.values())}_getCacheKey(e){const{geometry:t,spatialRel:i,returnGeometry:r,returnCentroid:s,outSR:a,resultType:n,cacheHint:l}=e;if("tile"!==n&&!l)return null;const o=r||s;return R(a)&&!S(this.spatialReference,a)&&o?JSON.stringify([t,i,a]):JSON.stringify([t,i])}_canExecuteSinglePass(e,t){const{spatialRel:i}=t;return Z(e)&&("esriSpatialRelEnvelopeIntersects"===i||"esriGeometryPoint"===this.geometryType&&("esriSpatialRelIntersects"===i||"esriSpatialRelContains"===i))}async _project(e,t){if(!t||S(this.spatialReference,t))return e;const r=this.featureAdapter,s=y()?await this._getFullExtent():void 0,a=await v(e.items.map(e=>E(this.geometryType,r.getGeometry(e))),this.spatialReference,t,{areaOfInterestExtent:s});return e.items=i(a.map((t,i)=>r.cloneWithGeometry(e.items[i],I(t,this.hasZ,this.hasM),this.geometryType))),e}async _searchFeatures(e){const t=new Set;await Promise.all(e.map(e=>this.featureStore.forEachInBounds(e,e=>t.add(e))));const i=Array.from(t.values());return t.clear(),i}async*_executeQueryForStatistics(e,t){e=s(e);try{e=await z(e,this.definitionExpression,this.spatialReference),yield,e=await M(e,t,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const i=yield*this._executeSceneFilterQuery(e);yield;const r=yield*this._executeGeometryQuery(e,i);return yield,this._executeAggregateIdsQuery(r),yield,this._executeObjectIdsQuery(r),yield,this._executeTimeQuery(r),yield,this._executeAttributesQuery(r),yield,r}catch(i){if(i!==O)throw i;return new C([],e,this)}}get test(){}}function X(e){if(Z(e)){if(_(e))return[p(Math.min(e.xmin,e.xmax),Math.min(e.ymin,e.ymax),Math.max(e.xmin,e.xmax),Math.max(e.ymin,e.ymax))];if(F(e))return e.rings.map(e=>p(Math.min(e[0][0],e[2][0]),Math.min(e[0][1],e[2][1]),Math.max(e[0][0],e[2][0]),Math.max(e[0][1],e[2][1])))}return[g(x(),e)]}function Y(e,t,i,r,s){const a={xmin:e[0],ymin:e[1],xmax:e[3],ymax:e[4],spatialReference:b(r)};s&&isFinite(e[2])&&isFinite(e[5])&&(a.zmin=e[2],a.zmax=e[5],a.hasZ=!0);const n=A(a,t,i);if(n.spatialReference=b(i),n.xmax-n.xmin===0){const e=u(n.spatialReference);n.xmin-=e,n.xmax+=e}if(n.ymax-n.ymin===0){const e=u(n.spatialReference);n.ymin-=e,n.ymax+=e}if(s&&null!=n.zmin&&null!=n.zmax&&n.zmax-n.zmin===0){const e=u(n.spatialReference);n.zmin-=e,n.zmax+=e}return n}export{K as Feature,W as QueryEngine,X as getQueryBoundingRects,Y as getQueryResultExtent};
|
|
2
|
+
import{indexOf as e,PositionHint as t}from"../../../core/arrayUtils.js";import{toConst as i}from"../../../core/compilerUtils.js";import r from"../../../core/Error.js";import"../../../core/has.js";import{clone as s}from"../../../core/lang.js";import{removeMaybe as a,destroyMaybe as n}from"../../../core/maybe.js";import{signalFromSignalOrOptions as l,throwIfAborted as o}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as u}from"../../../core/units.js";import{isSerializable as c}from"../../../core/support/jsonUtils.js";import{isLoaded as y}from"../../../geometry/projectionUtils.js";import{set as h,create as d,expandWithAABB as m,negativeInfinity as f}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as p,create as x}from"../../../geometry/support/aaBoundingRect.js";import{getBoundsXY as g}from"../../../geometry/support/boundsUtils.js";import{isExtent as _,isPolygon as F}from"../../../geometry/support/jsonTypeUtils.js";import{fromJSON as w}from"../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as Q}from"../../../geometry/support/normalizeUtils.js";import{equals as S,isValid as R}from"../../../geometry/support/spatialReferenceUtils.js";import{convertFromGeometry as I}from"../featureConversionUtils.js";import{getWhereClause as j}from"./attributeSupport.js";import{getGeometry as E,cleanFromGeometryEngine as b}from"./geometryUtils.js";import{checkProjectionSupport as T,project as A,projectMany as v}from"./projectionSupport.js";import{QueryEngineCache as G}from"./QueryEngineCache.js";import{queryCapabilities as k}from"./QueryEngineCapabilities.js";import{QueryEngineResult as C}from"./QueryEngineResult.js";import{queryEngineEmptyResult as O,normalizeAttributeBinsQuery as P,normalizeQueryLike as q,normalizeQuery as z}from"./queryUtils.js";import{validateAttributeBinsQuery as U,validateQuery as B,validateStatisticsQuery as M}from"./queryValidationUtils.js";import{getSpatialQueryOperator as H,canQueryWithRBush as Z}from"./spatialQuerySupport.js";import{getTimeExtent as J,getTimeOperator as L}from"./timeSupport.js";import N from"../../support/FieldsIndex.js";import{ImmediateTask as V}from"../../../views/support/Scheduler.js";const D="unsupported-query";class K{constructor(e,t=null,i,r,s){this.attributes=e,this.geometry=i,this.centroid=r,this.filterFlags=s,this.groupId=-1,this.displayId=t}}class W{constructor(e){this._changeHandle=null,this.capabilities={query:k},this.geometryType=e.geometryType,this.hasM=!!e.hasM,this.hasZ=!!e.hasZ,this.spatialReference=e.spatialReference,this.definitionExpression=e.definitionExpression,this.featureStore=e.featureStore,this.aggregateAdapter=e.aggregateAdapter,this._cache=e.cache??new G,this.timeInfo=e.timeInfo,this.featureIdInfo=e.featureIdInfo,this._changeHandle=this.featureStore.events.on("changed",()=>this._clearCache()),this.fieldsIndex=c(e.fieldsIndex)?e.fieldsIndex:N.fromJSON(e.fieldsIndex),!e.availableFields||1===e.availableFields.length&&"*"===e.availableFields[0]?this.availableFields=new Set(this.fieldsIndex.fields.map(e=>e.name)):this.availableFields=new Set(e.availableFields.map(e=>this.fieldsIndex.get(e)?.name).filter(e=>null!=e)),e.scheduler&&e.priority?this._frameTask=e.scheduler.registerTask(e.priority):this._frameTask=V}destroy(){this._changeHandle=a(this._changeHandle),this._frameTask=a(this._frameTask),this._clearCache(),n(this._cache)}get featureAdapter(){return this.featureStore.featureAdapter}async executeQuery(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryFeatureSet(e),i)}async executeQueryForCount(e={},t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForCount(e),i)}async executeQueryForExtent(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForExtent(e),i)}async executeQueryForIds(e,t){return Array.from(await this.executeQueryForIdSet(e,t))}async executeQueryForIdSet(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForIdSet(e),i)}async executeQueryForLatestObservations(e,t){const i=l(t);if(!this.timeInfo?.trackIdField)throw new r(D,"Missing timeInfo or timeInfo.trackIdField",{query:e,timeInfo:this.timeInfo});return await this._frameTask.scheduleGenerator(()=>this._executeQueryForLatestObservations(e),i)}async executeQueryForOpaqueFeatures(e,t){const i=l(t);return(await this._frameTask.scheduleGenerator(()=>this._executeQuery(e,{}),i)).items}async executeAttributeBinsQuery(e,t){const i=l(t);return e=s(e),await this._frameTask.scheduleGenerator(()=>this._executeAttributeBinsQuery(e),i)}async executeQueryForSummaryStatistics(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForSummaryStatistics(e,t),r)}async executeQueryForUniqueValues(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForUniqueValues(e,t),r)}async executeQueryForClassBreaks(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForClassBreaks(e,t),r)}async executeQueryForHistogram(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForHistogram(e,t),r)}async executeQueryForSnapping(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForSnapping(e,i),i)}async fetchRecomputedExtents(e){const t=l(e);this._timeExtentPromise||=J(this.timeInfo,this.featureStore);const[i,r]=await Promise.all([this._getFullExtent(),this._timeExtentPromise]);return o(t),{fullExtent:i,timeExtent:r}}_clearCache(){this._cache.clear(),this._allFeaturesPromise=null,this._timeExtentPromise=null,this._fullExtentPromise=null}async*_executeQueryFeatureSet(e){try{const t=yield*this._executeQuery(e,{});return yield,await t.createQueryResponse()}catch(t){if(t!==O)throw t;return await new C([],e,this).createQueryResponse()}}async*_executeQueryForCount(e){try{const t=yield*this._executeQuery(e,{returnGeometry:!1,returnCentroid:!1,outSR:null});return yield,t.createQueryResponseForCount()}catch(t){if(t!==O)throw t;return 0}}async*_executeQueryForExtent(e){const t=e.outSR;try{const i=yield*this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null});yield;const r=i.size;if(!r)return{count:0,extent:null};const s=await this._getBounds(i.items,i.spatialReference,t??this.spatialReference);return yield,{count:r,extent:s}}catch(i){if(i===O)return{count:0,extent:null};throw i}}async*_executeQueryForIdSet(e){try{const t=yield*this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null});yield;const i=t.items,r=new Set;for(const e of i)r.add(t.featureAdapter.getObjectId(e));return r}catch(t){if(t===O)return new Set;throw t}}async*_executeQueryForLatestObservations(e){try{const t=yield*this._executeQuery(e,{});return yield,this._filterLatest(t),yield,await t.createQueryResponse()}catch(t){if(t!==O)throw t;return await new C([],e,this).createQueryResponse()}}async*_executeAttributeBinsQuery(e){let t;try{e=await P(e,this.definitionExpression,this.spatialReference),yield,e=await U(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const i=yield*this._executeSceneFilterQuery(e);yield,t=yield*this._executeGeometryQuery(e,i),yield,this._executeAggregateIdsQuery(t),yield,this._executeObjectIdsQuery(t),yield,this._executeTimeQuery(t),yield,this._executeAttributesQuery(t),yield}catch(i){if(i!==O)throw i;t=new C([],e,this)}return await t.createQueryBinsResponse(e)}async*_executeQueryForSummaryStatistics(e={},t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createSummaryStatisticsResponse(t)}async*_executeQueryForUniqueValues(e={},t){const{field:i,field2:r,field3:s,valueExpression:a}=t,n=yield*this._executeQueryForStatistics(e,{field:i,field2:r,field3:s,valueExpression:a});return yield,await n.createUniqueValuesResponse(t)}async*_executeQueryForClassBreaks(e,t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createClassBreaksResponse(t)}async*_executeQueryForHistogram(e,t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createHistogramResponse(t)}async*_executeQueryForSnapping(e,t){const{point:i,distance:r,returnEdge:a,vertexMode:n}=e;if(!a&&"none"===n)return{candidates:[]};let l=s(e.query);l=await q(l,this.definitionExpression,this.spatialReference),yield,l=await B(l,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const o=!S(i.spatialReference,this.spatialReference);o&&(await T(i.spatialReference,this.spatialReference),yield);const u="number"==typeof r?r:r.x,c="number"==typeof r?r:r.y,y={xmin:i.x-u,xmax:i.x+u,ymin:i.y-c,ymax:i.y+c,spatialReference:i.spatialReference},h=o?A(y,this.spatialReference):y;if(!h)return{candidates:[]};const[d]=await Q(w(i),{signal:t});yield;const[m]=await Q(w(h),{signal:t});if(yield,null==d||null==m)return{candidates:[]};const f=await this._searchFeatures(X(m.toJSON()));yield;const p=new C(f,l,this);this._executeObjectIdsQuery(p),yield,this._executeTimeQuery(p),yield,this._executeAttributesQuery(p),yield,yield*this._executeGeometryQueryForSnapping(p),yield;const x=d.toJSON(),g=o?A(x,this.spatialReference):x,_=o?Math.max(h.xmax-h.xmin,h.ymax-h.ymin)/2:r;return p.createSnappingResponse({...e,point:g,distance:_},l.returnZ,i.spatialReference)}async _getBounds(e,t,i){const r=h(d(),f);return await this.featureStore.forEachBounds(e,e=>m(r,e)),Y(r,t,i,this.spatialReference,this.hasZ)}_getFullExtent(){return this._fullExtentPromise||="getFullExtent"in this.featureStore&&this.featureStore.getFullExtent?Promise.resolve(this.featureStore.getFullExtent(this.spatialReference)):this._getAllFeatures().then(e=>this._getBounds(e,this.spatialReference,this.spatialReference)),this._fullExtentPromise}async _getAllFeaturesQueryEngineResult(e){return new C(await this._getAllFeatures(),e,this)}async _getAllFeatures(){if(null==this._allFeaturesPromise){const e=[];this._allFeaturesPromise=(async()=>await this.featureStore.forEach(t=>e.push(t)))().then(()=>i(e))}const e=this._allFeaturesPromise,t=await e;return e===this._allFeaturesPromise?t.slice():this._getAllFeatures()}async*_executeQuery(e,t){e=s(e),e=await z(e,this.definitionExpression,this.spatialReference),yield,e=await B(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield,e={...e,...t};const i=yield*this._executeSceneFilterQuery(e);yield;const r=yield*this._executeGeometryQuery(e,i);return yield,this._executeAggregateIdsQuery(r),yield,this._executeObjectIdsQuery(r),yield,this._executeTimeQuery(r),yield,this._executeAttributesQuery(r),r}async*_executeSceneFilterQuery(e){if(null==e.sceneFilter)return null;const{outSR:t,returnGeometry:i,returnCentroid:r}=e,s=this.featureStore.featureSpatialReference,a=e.sceneFilter.geometry,n=null==s||S(s,a.spatialReference)?a:A(a,s);if(!n)return null;const l=i||r,o=R(t)&&!S(this.spatialReference,t)&&l?async e=>this._project(e,t):e=>e;yield;const u=this.featureAdapter,c=await this._searchFeatures(X(n));yield;if("disjoint"===e.sceneFilter.spatialRelationship){if(!c.length)return null;const t=new Set;for(const e of c)t.add(u.getObjectId(e));const i=await this._getAllFeatures();yield;const r=await H("esriSpatialRelDisjoint",n,this.geometryType);yield;const s=e=>!t.has(u.getObjectId(e))||r(u.getGeometry(e)),a=yield*this._runSpatialFilter(i,s);yield;const l=new C(a,e,this);return await o(l)}if(!c.length)return new C([],e,this);if(this._canExecuteSinglePass(n,e))return await o(new C(c,e,this));const y=await H("esriSpatialRelContains",n,this.geometryType);yield;const h=yield*this._runSpatialFilter(c,e=>y(u.getGeometry(e)));return yield,await o(new C(h,e,this))}async*_executeGeometryQuery(i,r){if(null!=r&&0===r.items.length)return r;const{geometry:s,outSR:a,returnGeometry:n,returnCentroid:l}=i,o=r?null:this._getCacheKey(i),u=o?this._cache.get(o):null;if(u)return new C(u,i,this);const c=R(a)&&!S(this.spatialReference,a),y=n||l,h=async e=>(c&&y&&await this._project(e,a),o&&this._cache.put(o,e.items),e),d=this.featureStore.featureSpatialReference,m=!s||null==d||S(d,s.spatialReference)?s:A(s,d);if(!m)return await h(null!=r?r:await this._getAllFeaturesQueryEngineResult(i));yield;const f=this.featureAdapter;let p=await this._searchFeatures(X(s));yield;const x=i.spatialRel??"esriSpatialRelIntersects";if("esriSpatialRelDisjoint"===x){if(!p.length)return await h(null!=r?r:await this._getAllFeaturesQueryEngineResult(i));const e=new Set;for(const i of p)e.add(f.getObjectId(i));let t;null!=r?t=r.items:(yield,t=await this._getAllFeatures(),yield);const s=await H(x,m,this.geometryType);yield;const a=t=>!e.has(f.getObjectId(t))||s(f.getGeometry(t)),n=yield*this._runSpatialFilter(t,a);yield;const l=new C(n,i,this);return await h(l)}if(null!=r){const i=new t;p=p.filter(t=>e(r.items,t,r.items.length,i)>=0)}if(!p.length){const e=new C([],i,this);return o&&this._cache.put(o,e.items),e}if(this._canExecuteSinglePass(m,i))return await h(new C(p,i,this));const g=await H(x,m,this.geometryType);yield;const _=yield*this._runSpatialFilter(p,e=>g(f.getGeometry(e)));return yield,await h(new C(_,i,this))}_executeAggregateIdsQuery(e){if(0===e.items.length||!e.query.aggregateIds?.length||null==this.aggregateAdapter)return;const t=new Set;for(const r of e.query.aggregateIds){this.aggregateAdapter.getFeatureObjectIds(r).forEach(e=>t.add(e))}const i=this.featureAdapter.getObjectId;e.items=e.items.filter(e=>t.has(i(e)))}_executeObjectIdsQuery(e){if(0===e.items.length||!e.query.objectIds?.length)return;const t=new Set(e.query.objectIds),i=this.featureAdapter.getObjectId;e.items=e.items.filter(e=>t.has(i(e)))}_executeTimeQuery(e){if(0===e.items.length)return;const t=L(this.timeInfo,e.query.timeExtent,this.featureAdapter);null!=t&&(e.items=e.items.filter(t))}_executeAttributesQuery(e){if(0===e.items.length)return;const t=j(e.query.where,this.fieldsIndex);if(t){if(!t.isStandardized)throw new TypeError("Where clause is not standardized");e.items=e.items.filter(e=>t.testFeature(e,this.featureAdapter))}}async*_executeGeometryQueryForSnapping(e){const{query:t}=e,{spatialRel:i}=t;if(!e?.items?.length||!t.geometry||!i)return;const r=await H(i,t.geometry,this.geometryType);yield;const s=this.featureAdapter,a=e=>r(s.getGeometry(e)),n=yield*this._runSpatialFilter(e.items,a);e.items=n}*_runSpatialFilter(e,t){if(!t)return e;if(null==this._frameTask)return e.filter(e=>t(e));let i=yield;const r=new Array;for(const s of e)t(s)&&r.push(s),i.madeProgress(),i.done&&(i=yield);return r}_filterLatest(e){const{trackIdField:t,startTimeField:i,endTimeField:r}=this.timeInfo,s=r||i,a=new Map,n=this.featureAdapter.getAttribute;for(const l of e.items){const e=n(l,t),i=n(l,s),r=a.get(e);(!r||i>n(r,s))&&a.set(e,l)}e.items=Array.from(a.values())}_getCacheKey(e){const{geometry:t,spatialRel:i,returnGeometry:r,returnCentroid:s,outSR:a,resultType:n,cacheHint:l}=e;if("tile"!==n&&!l)return null;const o=r||s;return R(a)&&!S(this.spatialReference,a)&&o?JSON.stringify([t,i,a]):JSON.stringify([t,i])}_canExecuteSinglePass(e,t){const{spatialRel:i}=t;return Z(e)&&("esriSpatialRelEnvelopeIntersects"===i||"esriGeometryPoint"===this.geometryType&&("esriSpatialRelIntersects"===i||"esriSpatialRelContains"===i))}async _project(e,t){if(!t||S(this.spatialReference,t))return e;const r=this.featureAdapter,s=y()?await this._getFullExtent():void 0,a=await v(e.items.map(e=>E(this.geometryType,r.getGeometry(e))),this.spatialReference,t,{areaOfInterestExtent:s});return e.items=i(a.map((t,i)=>r.cloneWithGeometry(e.items[i],I(t,this.hasZ,this.hasM),this.geometryType))),e}async _searchFeatures(e){const t=new Set;await Promise.all(e.map(e=>this.featureStore.forEachInBounds(e,e=>t.add(e))));const i=Array.from(t.values());return t.clear(),i}async*_executeQueryForStatistics(e,t){e=s(e);try{e=await z(e,this.definitionExpression,this.spatialReference),yield,e=await M(e,t,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const i=yield*this._executeSceneFilterQuery(e);yield;const r=yield*this._executeGeometryQuery(e,i);return yield,this._executeAggregateIdsQuery(r),yield,this._executeObjectIdsQuery(r),yield,this._executeTimeQuery(r),yield,this._executeAttributesQuery(r),yield,r}catch(i){if(i!==O)throw i;return new C([],e,this)}}get test(){}}function X(e){if(Z(e)){if(_(e))return[p(Math.min(e.xmin,e.xmax),Math.min(e.ymin,e.ymax),Math.max(e.xmin,e.xmax),Math.max(e.ymin,e.ymax))];if(F(e))return e.rings.map(e=>p(Math.min(e[0][0],e[2][0]),Math.min(e[0][1],e[2][1]),Math.max(e[0][0],e[2][0]),Math.max(e[0][1],e[2][1])))}return[g(x(),e)]}function Y(e,t,i,r,s){const a={xmin:e[0],ymin:e[1],xmax:e[3],ymax:e[4],spatialReference:b(r)};s&&isFinite(e[2])&&isFinite(e[5])&&(a.zmin=e[2],a.zmax=e[5],a.hasZ=!0);const n=A(a,t,i);if(n.spatialReference=b(i),n.xmax-n.xmin===0){const e=u(n.spatialReference);n.xmin-=e,n.xmax+=e}if(n.ymax-n.ymin===0){const e=u(n.spatialReference);n.ymin-=e,n.ymax+=e}if(s&&null!=n.zmin&&null!=n.zmax&&n.zmax-n.zmin===0){const e=u(n.spatialReference);n.zmin-=e,n.zmax+=e}return n}export{K as Feature,W as QueryEngine,X as getQueryBoundingRects,Y as getQueryResultExtent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{insertSortedStableTopN as e}from"../../../core/arrayUtils.js";import{clone as t}from"../../../core/lang.js";import i from"../../../geometry/SpatialReference.js";import{polygonCentroid as s,extentCentroid as a}from"../../../geometry/support/centroid.js";import{getPolygonExtent as r,getGeometryExtent as n}from"../../../geometry/support/extentUtils.js";import{toQuantizationTransform as o}from"../../../geometry/support/quantizationUtils.js";import{isValid as l,equals as u}from"../../../geometry/support/spatialReferenceUtils.js";import{closestPointOnCurve as c}from"../../../geometry/support/curves/closestPointOnCurve.js";import{getEndpoint as m,isCoordinate as d,cloneCurve as f}from"../../../geometry/support/curves/curveUtils.js";import p from"./AttributesBuilder.js";import{cleanFromGeometryEngine as h,getGeometry as g,transformCentroid as y}from"./geometryUtils.js";import{project as x}from"./projectionSupport.js";import{getDateInNumber as I}from"./queryUtils.js";import{SnappingCandidateEdge as T,SnappingCandidateVertex as F}from"./SnappingCandidate.js";import{isDateField as _,isDateOnlyField as v,isTimestampOffsetField as V,isStringField as S,isTimeOnlyField as b}from"../../support/fieldUtils.js";import R from"../../../rest/support/AutoIntervalBinParameters.js";import z from"../../../rest/support/DateBinParameters.js";import{unitsDict as B}from"../../../rest/support/DateBinUtils.js";import M from"../../../rest/support/FixedBoundariesBinParameters.js";import A from"../../../rest/support/FixedIntervalBinParameters.js";import{calculateStringStatistics as N,calculateStatistics as w,processSummaryStatisticsResult as D,calculateUniqueValuesCount as P,createUVResult as O,calculateClassBreaks as q,resolveCBResult as j,calculateHistogram as C,calculatePercentile as G,binIndex as Z,getBinParams as E,isNullCountSupported as H,getAttributeComparator as U}from"../../../statistics/utils.js";import{utc as k}from"../../../time/constants.js";import{DateTime as J}from"luxon";const Q="bin";class Y{constructor(e,t,i){this.items=e,this.query=t,this.geometryType=i.geometryType,this.hasZ=!!t.returnZ&&i.hasZ,this.hasM=!!t.returnM&&i.hasM,this.fieldsIndex=i.fieldsIndex,this.spatialReference=i.spatialReference,this.featureAdapter=i.featureAdapter,this.featureIdInfo=i.featureIdInfo}get size(){return this.items.length}createQueryResponseForCount(){const e=new p(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);const{groupByFieldsForStatistics:t,having:i,outStatistics:s}=this.query,a=t?.length;if(!!!a)return 1;const r=new Map,n=new Map,o=new Set;for(const l of s){const{statisticType:s}=l,a="exceedslimit"!==s?l.onStatisticField:void 0;if(!n.has(a)){const i=[];for(const s of t){const t=this._getAttributeValues(e,s,this.items,r);i.push(t)}n.set(a,this._calculateUniqueValues(i,this.items,e.returnDistinctValues))}const u=n.get(a);for(const t in u){const{data:s,items:a}=u[t],r=s.join(",");i&&!e.validateItems(a,i)||o.add(r)}}return o.size}async createQueryResponse(){let e;if(this.query.outStatistics){e=this.query.outStatistics.some(e=>"exceedslimit"===e.statisticType)?this._createExceedsLimitQueryResponse():await this._createStatisticsQueryResponse(this.query,this.items)}else e=this._createFeatureQueryResponse(this.query);if(this.query.returnQueryGeometry){const t=this.query.geometry;l(this.query.outSR)&&!u(t.spatialReference,this.query.outSR)?e.queryGeometry=h({spatialReference:this.query.outSR,...x(t,t.spatialReference,this.query.outSR)}):e.queryGeometry=h({spatialReference:this.query.outSR,...t})}return e}createSnappingResponse(e,t,i){const s=this.featureAdapter,{point:a}=e,r="number"==typeof e.distance?e.distance:e.distance.x,n="number"==typeof e.distance?e.distance:e.distance.y;function o(e,t){const i=(e-a.x)/r,s=(t-a.y)/n;return i*i+s*s}const l={candidates:[]},u="esriGeometryPolygon"===this.geometryType,p="esriGeometryPolyline"===this.geometryType||"esriGeometryPoint"===this.geometryType,h=this._getPointCreator(t,this.spatialReference,i),g=new L(null,0),y=new L(null,0),x={x:0,y:0,z:0};for(const c of this.items){const e=s.getObjectId(c),t=s.getGeometryWithCurves?.(c);if(null!=t){_(t,e);continue}const i=s.getGeometry(c);null==i||I(i,e)}return l.candidates.sort((e,t)=>e.distance-t.distance),l;function I(t,i){const{coords:s,stride:r}=t,n=t.isPoint?W:t.lengths;if(g.coords=s,y.coords=s,e.returnEdge){let e=0;for(let t=0;t<n.length;t++){const s=n[t],c=e;for(let t=0;t<s;t++,e+=r){if(!u&&t===s-1)continue;if(g.coordsIndex=e,y.coordsIndex=t===s-1?c:e+r,!X(x,a,g,y))continue;const n=o(x.x,x.y);n<=1&&l.candidates.push(new T(i,h(x),Math.sqrt(n),h(g),h(y)))}}}if("all"===e.vertexMode){let e=0;for(let t=0;t<n.length;t++){const s=n[t],a=e,c=y;c.coordsIndex=a;for(let t=0;t<s;t++,e+=r){if(g.coordsIndex=e,u&&t===s-1&&g.x===c.x&&g.y===c.y)continue;const a=o(g.x,g.y);a<=1&&l.candidates.push(new F(i,h(g),Math.sqrt(a)))}}}else if(p&&"ends"===e.vertexMode){let e=0;const t=[];for(let i=0;i<n.length;i++){t.push(e);const s=n[i];e+=s*r,s>1&&t.push(e-r)}for(const s of t){g.coordsIndex=s;const e=o(g.x,g.y);e<=1&&l.candidates.push(new F(i,h(g),Math.sqrt(e)))}}}function _(t,i){const{candidates:s}=l,r={x:0,y:0,z:0};if(e.returnEdge){const e=[a.x,a.y],n=new L(e,0),l=new L(e,0);for(const{segments:a}of t.parts)for(const{start:t,curve:u}of a){const{curvePoint:a}=c(t,u,e),p=o(...a);if(p>1)continue;[r.x,r.y]=a,n.coords=t,l.coords=m(u);const g=d(u)?null:f(u);s.push(new T(i,h(r),Math.sqrt(p),h(n),h(l),!1,g))}}function n(e){r.x=t.vertexXY[2*e],r.y=t.vertexXY[2*e+1];const a=o(r.x,r.y);a>1||(r.z=t.vertexZ?.[e]??0,s.push(new F(i,h(r),Math.sqrt(a))))}if("all"===e.vertexMode){const{vertexCount:e}=t;for(let t=0;t<e;++t)n(t);return}if("ends"===e.vertexMode)switch(t.type){case"point":n(0);break;case"polyline":for(let e=0;e<t.partCount;++e){const i=t.partOffsets[e],s=t.partOffsets[e+1]-1;n(i),s!==i&&n(s)}}}}_getPointCreator(e,t,i){const s=null==i||u(t,i)?e=>e:e=>x(e,t,i),{hasZ:a}=this,r=0;return a&&e?({x:e,y:t,z:i})=>s({x:e,y:t,z:i}):({x:e,y:t})=>s({x:e,y:t,z:r})}async createSummaryStatisticsResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,minValue:n,maxValue:o,scale:l,timeZone:u,outStatisticTypes:c}=e,m=this.fieldsIndex.get(t),d=_(m)||v(m)||V(m),f=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:l,timeZone:u},this.items),p=H({normalizationType:a,normalizationField:s,minValue:n,maxValue:o}),h={value:.5,fieldType:m?.type},g=S(m)?N({values:f,supportsNullCount:p,percentileParams:h,outStatisticTypes:c}):w({values:f,minValue:n,maxValue:o,useSampleStdDev:!a,supportsNullCount:p,percentileParams:h,outStatisticTypes:c});return D(g,c,d)}async createUniqueValuesResponse(e){const{field:t,valueExpression:i,domains:s,returnAllCodedValues:a,scale:r,timeZone:n}=e,o=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:i,scale:r,timeZone:n},this.items,!1),l=P(o);return O(l,s,a,e.fieldDelimiter)}async createClassBreaksResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c,scale:m,timeZone:d}=e,f=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:m,timeZone:d},this.items),p=q(f,{field:t,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c});return j(p,n)}async createHistogramResponse(e){const{field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c,scale:m,timeZone:d}=e,f=await this._getDataValues({field:t,valueExpression:i,normalizationField:s,normalizationType:a,normalizationTotal:r,scale:m,timeZone:d},this.items);return C(f,{field:t,normalizationField:s,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c})}_sortFeatures(e,t,i){if(e.length>1&&t?.length)for(const s of t.slice().reverse()){const{compare:t,fieldOrExpression:a,fieldInfo:r}=K(s,this.fieldsIndex);e.sort((e,s)=>t(i(e,a,r),i(s,a,r)))}}_topNFeatures(t,i,s,a){if(t.length>1&&i?.length){const r=i.map(e=>{const{compare:t,fieldOrExpression:i,fieldInfo:s}=K(e,this.fieldsIndex);return(e,r)=>t(a(e,i,s),a(r,i,s))}).reduceRight((e,t)=>(i,s)=>{const a=t(i,s);return 0===a||Number.isNaN(a)?e(i,s):a}),n=[];for(const i of t)e(n,i,s,r);return n}return t.slice(0,s)}_createFeatureQueryResponse(e){const{items:t,geometryType:i,hasM:s,hasZ:a,featureIdInfo:r,spatialReference:n}=this,{outFields:l,outSR:u,quantizationParameters:c,resultRecordCount:m,resultOffset:d,returnZ:f,returnM:p}=e,g=null!=m&&t.length>(d||0)+m,y=l&&(l.includes("*")?[...this.fieldsIndex.fields]:l.map(e=>this.fieldsIndex.get(e)));return{exceededTransferLimit:g,features:this._createFeatures(e,t),fields:y,geometryType:i,hasM:s&&p,hasZ:a&&f,objectIdFieldName:"object-id"===r.type?r.fieldName:null,spatialReference:h(u||n),transform:c&&o(c)||null}}_createFeatures(e,t){const i=new p(e,this.featureAdapter,this.fieldsIndex),{hasM:s,hasZ:a}=this,{orderByFields:r,quantizationParameters:n,returnGeometry:l,returnCentroid:u,maxAllowableOffset:c,resultOffset:m,resultRecordCount:d,returnZ:f=!1,returnM:h=!1}=e,x=a&&f,I=s&&h;let T;const F=m||0,_=null!=d?F+d:null;null!=_&&_<=5e3&&_<t.length?T=this._topNFeatures(t,r,_,(e,t,s)=>i.getFieldValue(e,t,s)):(T=[...t],this._sortFeatures(T,r,(e,t,s)=>i.getFieldValue(e,t,s))),(F>0||null!=_)&&(T=T.slice(F,_??void 0));const v=[];let V=0;if(this.geometryType&&(l||u)){const e=o(n)??void 0,t="esriGeometryPolygon"===this.geometryType||"esriGeometryPolyline"===this.geometryType;if(l&&!u)for(const s of T){const a=this.featureAdapter.getGeometry(s),r=this._addFeatureJSONMetadata(s,{attributes:i.getAttributes(s),geometry:g(this.geometryType,a,c,e,x,I)});t&&a&&!r.geometry&&(r.centroid=y(this,this.featureAdapter.getCentroid(s,this),e)),v[V++]=r}else if(!l&&u)for(const s of T)v[V++]=this._addFeatureJSONMetadata(s,{attributes:i.getAttributes(s),centroid:y(this,this.featureAdapter.getCentroid(s,this),e)});else for(const s of T)v[V++]=this._addFeatureJSONMetadata(s,{attributes:i.getAttributes(s),centroid:y(this,this.featureAdapter.getCentroid(s,this),e),geometry:g(this.geometryType,this.featureAdapter.getGeometry(s),c,e,x,I)})}else for(const o of T){const e=i.getAttributes(o);e&&(v[V++]=this._addFeatureJSONMetadata(o,{attributes:e}))}return v}_addFeatureJSONMetadata(e,t){const i=this.featureAdapter.getMetadata?.(e);return void 0!==i&&(t.metadata=i),t}_createExceedsLimitQueryResponse(){let e=!1,t=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY;for(const a of this.query.outStatistics??[])if("exceedslimit"===a.statisticType){t=null!=a.maxPointCount?a.maxPointCount:Number.POSITIVE_INFINITY,i=null!=a.maxRecordCount?a.maxRecordCount:Number.POSITIVE_INFINITY,s=null!=a.maxVertexCount?a.maxVertexCount:Number.POSITIVE_INFINITY;break}if("esriGeometryPoint"===this.geometryType)e=this.items.length>t;else if(this.items.length>i)e=!0;else{e=this.items.reduce((e,t)=>{const i=this.featureAdapter.getGeometry(t);return e+(i?.size??0)},0)>s}return{fields:[{name:"exceedslimit",type:"esriFieldTypeInteger",alias:"exceedslimit",sqlType:"sqlTypeInteger",domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(e)}}]}}async _createStatisticsQueryResponse(e,t,i={attributes:{}}){const s=[],a=new Map,r=new Map,n=new Map,o=new Map,l=new p(e,this.featureAdapter,this.fieldsIndex),u=e.outStatistics,{groupByFieldsForStatistics:c,having:m,orderByFields:d,resultRecordCount:f}=e,h=c?.length,g=!!h,y=g?c[0]:null,x=g&&!this.fieldsIndex.get(y);for(const p of u??[]){const{outStatisticFieldName:u,statisticType:d}=p,f=p,I="exceedslimit"!==d?p.onStatisticField:void 0,T="percentile_disc"===d||"percentile_cont"===d,F="EnvelopeAggregate"===d||"CentroidAggregate"===d||"ConvexHullAggregate"===d,_=g&&1===h&&(I===y||x)&&"count"===d;if(g){if(!n.has(I)){const e=[];for(const i of c){const s=this._getAttributeValues(l,i,t,a);e.push(s)}n.set(I,this._calculateUniqueValues(e,t,!F&&l.returnDistinctValues))}const i=n.get(I);if(!i)continue;const s=Object.keys(i);for(const r of s){const{count:s,data:n,items:d,itemPositions:p}=i[r],h=n.join(",");if(!m||l.validateItems(d,m)){const i=o.get(h)||{attributes:{}};if(e.returnAggIds&&(i.aggregateIds=d.map(e=>this.featureAdapter.getObjectId(e)).filter(e=>null!=e)),F){i.aggregateGeometries||(i.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:t}=await this._getAggregateGeometry(f,d);i.aggregateGeometries[t]=e}else{let e=null;if(_)e=s;else{const i=this._getAttributeValues(l,I,t,a),s=p.map(e=>i[e]);e=T&&"statisticParameters"in f?this._getPercentileValue(f,s):this._getStatisticValue(f,s,null,l.returnDistinctValues)}i.attributes[u]=e}let r=0;c.forEach((e,t)=>i.attributes[this.fieldsIndex.get(e)?e:"EXPR_"+ ++r]=n[t]),o.set(h,i)}}}else if(F){i.aggregateGeometries||(i.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:s}=await this._getAggregateGeometry(f,t);i.aggregateGeometries[s]=e}else{const e=this._getAttributeValues(l,I,t,a);i.attributes[u]=T&&"statisticParameters"in f?this._getPercentileValue(f,e):this._getStatisticValue(f,e,r,l.returnDistinctValues)}const v="min"!==d&&"max"!==d||!S(this.fieldsIndex.get(I))&&!this._isAnyDateField(I)?null:this.fieldsIndex.get(I)?.type;s.push({name:u,alias:u,type:v||"esriFieldTypeDouble"})}const I=g?Array.from(o.values()):[i];return this._sortFeatures(I,d,(e,t)=>e.attributes[t]),f&&(I.length=Math.min(f,I.length)),{fields:s,features:I}}_isAnyDateField(e){const t=this.fieldsIndex.get(e);return _(t)||v(t)||V(t)||b(t)}async _getAggregateGeometry(e,t){const{convexHull:i,union:o}=await(import("../../../geometry/geometryEngineJSON.js")),{statisticType:l,outStatisticFieldName:u}=e,{featureAdapter:c,spatialReference:m,geometryType:d}=this,f=t.map(e=>g(d,c.getGeometry(e))),p=i(m,f,!0)[0],h={aggregateGeometries:null,outStatisticFieldName:null};if("EnvelopeAggregate"===l){const e=p?r(p):n(o(m,f));h.aggregateGeometries={...e,spatialReference:m},h.outStatisticFieldName=u||"extent"}else if("CentroidAggregate"===l){const e=p?s(p):a(n(o(m,f)));h.aggregateGeometries={x:e[0],y:e[1],spatialReference:m},h.outStatisticFieldName=u||"centroid"}else"ConvexHullAggregate"===l&&(h.aggregateGeometries=p,h.outStatisticFieldName=u||"convexHull");return h}_getStatisticValue(e,t,i,s){const{onStatisticField:a,statisticType:r}=e;let n=null;n=i?.has(a)?i.get(a):S(this.fieldsIndex.get(a))||this._isAnyDateField(a)?N({values:t,returnDistinct:s}):w({values:s?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),i&&i.set(a,n);return n["var"===r?"variance":r]}_getPercentileValue(e,t){const{onStatisticField:i,statisticParameters:s,statisticType:a}=e,{value:r,orderBy:n}=s,o=this.fieldsIndex.get(i);return G(t,{value:r,orderBy:n,fieldType:o?.type,isDiscrete:"percentile_disc"===a})}_getAttributeValues(e,t,i,s){if(s.has(t))return s.get(t);const a=this.fieldsIndex.get(t),r=i.map(i=>e.getFieldValue(i,t,a));return s.set(t,r),r}_calculateUniqueValues(e,t,i){const s={},a=t.length;for(let r=0;r<a;r++){const a=t[r],n=[];for(const t of e)n.push(t[r]);const o=n.join(",");null==s[o]?s[o]={count:1,data:n,items:[a],itemPositions:[r]}:(i||s[o].count++,s[o].items.push(a),s[o].itemPositions.push(r))}return s}async _getDataValues(e,s,a=!0){const r=new p(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:n,scale:o,timeZone:l}=e,u=i.fromJSON(this.query.outSR||this.spatialReference);return n?r.getExpressionValues(s,n,{viewingMode:"map",scale:o,spatialReference:u},{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM},l):r.getDataValues(s,t(e),a)}_calculateHistogramBins(e,t,i){if(null==t.min&&null==t.max)return[];const s=t.intervals,a=t.min??0,r=t.max??0,n=s.map(([e,t])=>({minValue:e,maxValue:t,count:0,items:[]}));for(let o=0;o<e.length;o++){const t=e[o],l=i[o];if(null!=t&&t>=a&&t<=r){const e=Z(s,t);e>-1&&(n[e].count++,n[e].items.push(l))}}return n}async createQueryBinsResponse(e){const t=e.bin?.splitBy;if(!t)return this._createBinsResponse(e);const{value:i,outAlias:s,valueType:a}=t,r=[],n=[{name:s??i,alias:s??i,type:a??"esriFieldTypeString"},{name:Q,alias:Q,type:"esriFieldTypeInteger"}],o=new p(e,this.featureAdapter,this.fieldsIndex),l=new Map,u=[...this.items];this._sortFeatures(u,[i],(e,t,i)=>o.getFieldValue(e,t,i));const c=this._getAttributeValues(o,i,u,l),m=this._calculateUniqueValues([c],u,o.returnDistinctValues);for(const d in m){const{items:t}=m[d],a=await this._createBinsResponse(e,t);if(r.push(...a.features.map(e=>({...e,attributes:{...e.attributes,[s??i]:d}}))),a.fields)for(const e of a.fields)n.some(t=>t.name===e.name)||n.push(e)}return{fields:n,features:r}}async _createBinsResponse(e,t){const i=e.bin;switch(t=t??this.items,i.type){case"autoIntervalBin":return this._createAutoIntervalBinsResponse(R.fromJSON(i),e,t);case"dateBin":return this._createDateBinsResponse(z.fromJSON(i),e,t);case"fixedBoundariesBin":return this._createFixedBoundariesBinsResponse(M.fromJSON(i),e,t);case"fixedIntervalBin":return this._createFixedIntervalBinsResponse(A.fromJSON(i),e,t)}}async _createAutoIntervalBinsResponse(e,t,i){const{field:s,normalizationField:a,numBins:r,normalizationType:n,normalizationTotal:o,start:l,end:u}=e,c=await this._getDataValues({field:e.field||e.expression,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},i),m=E(c,{field:s,normalizationField:a,normalizationType:n,normalizationTotal:o,numBins:r,minValue:I(n?e.normalizationMinValue:l,!1),maxValue:I(n?e.normalizationMaxValue:u,!1)}),d=this._calculateHistogramBins(c,m,i);return this._createFeaturesFromHistogramBins(d,t)}async _createDateBinsResponse(e,t,i){const{field:s,interval:a,start:r,end:n,snapToData:o,returnFullIntervalBin:l,offset:u,firstDayOfWeek:c}=e,m=a.unit,d=await this._getDataValues({field:s||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},i),f=b(this.fieldsIndex.get(s)),p=B.toJSON(m),h=d.filter(Boolean).sort((e,t)=>e-t),g=null!=r?I(r,f):h[0],y=null!=n?I(n,f):h[h.length-1],x=[];if(null!=g&&null!=y){const e={zone:t.outTimeReference?.ianaTimeZone??k},i=u?.unit?B.toJSON(u.unit):"milliseconds",s={[i]:u?.value||0},r=J.fromMillis(g,e).minus(s),n=J.fromMillis(y,e).minus(s),m="number"==typeof c&&c>=1&&c<=7?c:7,d=(e,t)=>{const i=(e.weekday-t+7)%7;return e.minus({days:i}).startOf("day")};if("last"===o){let e="week"===p?((e,t)=>d(e,t).plus({days:7}))(n,m):n;for(;e>r;){const t=e.minus({[p]:a.value});if(t<r){x.unshift([l?t.plus(s).toMillis():r.plus(s).toMillis(),e.plus(s).toMillis()]);break}x.unshift([t.plus(s).toMillis(),e.plus(s).toMillis()]),e=t}}else{let e="first"===o?r:"week"===p?d(r,m):r.startOf(p);for(;e<=n;){const t=e.plus({[p]:a.value});if(t>n){x.push([e.plus(s).toMillis(),l?t.plus(s).toMillis():n.plus(s).toMillis()]);break}x.push([e.plus(s).toMillis(),t.plus(s).toMillis()]),e=t}}}const T=this._calculateHistogramBins(d,{intervals:x,min:g,max:y},i);return this._createFeaturesFromHistogramBins(T,t)}async _createFixedBoundariesBinsResponse(e,t,i){const{field:s}=e,a=await this._getDataValues({field:s||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},i),r=b(this.fieldsIndex.get(s)),n=e.boundaries.map(e=>I(e,r)).sort((e,t)=>e-t),o=[];for(let c=0;c<n.length-1;c++)o.push([n[c],n[c+1]]);const l={intervals:o,min:n.at(0),max:n.at(-1)},u=this._calculateHistogramBins(a,l,i);return this._createFeaturesFromHistogramBins(u,t)}async _createFixedIntervalBinsResponse(e,t,i){const{field:s,interval:a,normalizationType:r,start:n,end:o}=e,l=await this._getDataValues({field:s||e.expression,normalizationField:e.normalizationField,normalizationType:r,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},i),u=b(this.fieldsIndex.get(s)),c=E(l,{field:s,classificationMethod:"defined-interval",definedInterval:a,minValue:I(r?e.normalizationMinValue:n,u),maxValue:I(r?e.normalizationMaxValue:o,u)},!0),m=this._calculateHistogramBins(l,c,i);return this._createFeaturesFromHistogramBins(m,t)}async _createFeaturesFromHistogramBins(e,t){const{upperBoundaryAlias:i,lowerBoundaryAlias:s}=t,a=s||"lowerBoundary",r=i||"upperBoundary",n=[],o=[{name:a,alias:a,type:"esriFieldTypeDouble"},{name:r,alias:r,type:"esriFieldTypeDouble"}],l=t.bin?.stackBy?.value,u=t.bin?.stackBy?.outAlias;l&&o.push({name:Q,alias:Q,type:"esriFieldTypeInteger"},{name:u??l,alias:u??l,type:"esriFieldTypeString"});let c=0;const m="dateBin"===t.bin.type,d=t.outTimeReference?.ianaTimeZone;for(const f of e){const{minValue:e,maxValue:i,items:s}=f,p={attributes:{}};let h;if(p.attributes[a]=m&&d&&null!=e?J.fromMillis(e,{zone:d}).toISO():e,t.bin.hideUpperBound||(p.attributes[r]=m&&d&&null!=i?J.fromMillis(i,{zone:d}).toISO():i),t.returnAggIds&&(p.aggregateIds=s.map(e=>this.featureAdapter.getObjectId(e)).filter(e=>null!=e)),l?(h=await this._createStatisticsQueryResponse({...t,groupByFieldsForStatistics:[l],orderByFields:[l]},s),p.attributes[Q]=++c,"flat"===t.bin.jsonStyle?n.push(...h.features.map(({attributes:{EXPR_1:e,...t},...i})=>({...i,attributes:u??e?{...t,[u??e]:e,...p.attributes}:{...t,...p.attributes}}))):(p.stackedAttributes=h.features.map(({attributes:{EXPR_1:e,...t}})=>u??e?{...t,[u??e]:e}:t),n.push(p))):(t.bin?.splitBy&&(p.attributes[Q]=++c),h=await this._createStatisticsQueryResponse(t,s,p),n.push(p)),h.fields)for(const t of h.fields)o.some(e=>e.name===t.name)||o.push(t)}return"desc"===t.binOrder&&n.reverse(),{fields:o,features:n}}}function X(e,t,i,s){const a=s.x-i.x,r=s.y-i.y,n=t.x-i.x,o=t.y-i.y,l=a*a+r*r;if(0===l)return!1;const u=n*a+o*r,c=Math.min(1,Math.max(0,u/l));return e.x=i.x+a*c,e.y=i.y+r*c,!0}class L{constructor(e,t){this.coords=e,this.coordsIndex=t}get x(){return this.coords[this.coordsIndex]}get y(){return this.coords[this.coordsIndex+1]}get z(){return this.coords[this.coordsIndex+2]}}const W=[1];function K(e,t){const i=e.split(" "),s=i[0],a=t.get(s),r=!!i[1]&&"desc"===i[1].toLowerCase();return{compare:U(a?.type,r,"case-insensitive"),fieldOrExpression:s,fieldInfo:a}}export{Y as QueryEngineResult};
|
|
2
|
+
import{insertSortedStableTopN as e}from"../../../core/arrayUtils.js";import{clone as t}from"../../../core/lang.js";import s from"../../../geometry/SpatialReference.js";import{importLazily as i}from"../../../geometry/operators/importUtils.js";import{polygonCentroid as a,extentCentroid as r}from"../../../geometry/support/centroid.js";import{getPolygonExtent as n,getGeometryExtent as o,expandExtent as l}from"../../../geometry/support/extentUtils.js";import{toQuantizationTransform as u}from"../../../geometry/support/quantizationUtils.js";import{isValid as c,equals as m}from"../../../geometry/support/spatialReferenceUtils.js";import{closestPointOnCurve as d}from"../../../geometry/support/curves/closestPointOnCurve.js";import{getEndpoint as f,isCoordinate as p,cloneCurve as h}from"../../../geometry/support/curves/curveUtils.js";import g from"./AttributesBuilder.js";import{cleanFromGeometryEngine as y,getGeometry as x,transformCentroid as I}from"./geometryUtils.js";import{project as T}from"./projectionSupport.js";import{getDateInNumber as F}from"./queryUtils.js";import{SnappingCandidateEdge as _,SnappingCandidateVertex as v}from"./SnappingCandidate.js";import{isDateField as V,isDateOnlyField as S,isTimestampOffsetField as b,isStringField as R,isTimeOnlyField as z}from"../../support/fieldUtils.js";import B from"../../../rest/support/AutoIntervalBinParameters.js";import M from"../../../rest/support/DateBinParameters.js";import{unitsDict as A}from"../../../rest/support/DateBinUtils.js";import w from"../../../rest/support/FixedBoundariesBinParameters.js";import N from"../../../rest/support/FixedIntervalBinParameters.js";import{calculateStringStatistics as P,calculateStatistics as D,processSummaryStatisticsResult as O,calculateUniqueValuesCount as j,createUVResult as q,calculateClassBreaks as C,resolveCBResult as G,calculateHistogram as Z,calculatePercentile as E,binIndex as U,getBinParams as H,isNullCountSupported as k,getAttributeComparator as J}from"../../../statistics/utils.js";import{utc as Q}from"../../../time/constants.js";import{DateTime as Y}from"luxon";const X="bin",L=i(()=>import("../../../geometry/operators/json/convexHullOperator.js"));class W{constructor(e,t,s){this.items=e,this.query=t,this.geometryType=s.geometryType,this.hasZ=!!t.returnZ&&s.hasZ,this.hasM=!!t.returnM&&s.hasM,this.fieldsIndex=s.fieldsIndex,this.spatialReference=s.spatialReference,this.featureAdapter=s.featureAdapter,this.featureIdInfo=s.featureIdInfo}get size(){return this.items.length}createQueryResponseForCount(){const e=new g(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);const{groupByFieldsForStatistics:t,having:s,outStatistics:i}=this.query,a=t?.length;if(!!!a)return 1;const r=new Map,n=new Map,o=new Set;for(const l of i){const{statisticType:i}=l,a="exceedslimit"!==i?l.onStatisticField:void 0;if(!n.has(a)){const s=[];for(const i of t){const t=this._getAttributeValues(e,i,this.items,r);s.push(t)}n.set(a,this._calculateUniqueValues(s,this.items,e.returnDistinctValues))}const u=n.get(a);for(const t in u){const{data:i,items:a}=u[t],r=i.join(",");s&&!e.validateItems(a,s)||o.add(r)}}return o.size}async createQueryResponse(){let e;if(this.query.outStatistics){e=this.query.outStatistics.some(e=>"exceedslimit"===e.statisticType)?this._createExceedsLimitQueryResponse():await this._createStatisticsQueryResponse(this.query,this.items)}else e=this._createFeatureQueryResponse(this.query);if(this.query.returnQueryGeometry){const t=this.query.geometry;c(this.query.outSR)&&!m(t.spatialReference,this.query.outSR)?e.queryGeometry=y({spatialReference:this.query.outSR,...T(t,t.spatialReference,this.query.outSR)}):e.queryGeometry=y({spatialReference:this.query.outSR,...t})}return e}createSnappingResponse(e,t,s){const i=this.featureAdapter,{point:a}=e,r="number"==typeof e.distance?e.distance:e.distance.x,n="number"==typeof e.distance?e.distance:e.distance.y;function o(e,t){const s=(e-a.x)/r,i=(t-a.y)/n;return s*s+i*i}const l={candidates:[]},u="esriGeometryPolygon"===this.geometryType,c="esriGeometryPolyline"===this.geometryType||"esriGeometryPoint"===this.geometryType,m=this._getPointCreator(t,this.spatialReference,s),g=new ee(null,0),y=new ee(null,0),x={x:0,y:0,z:0};for(const d of this.items){const e=i.getObjectId(d),t=i.getGeometryWithCurves?.(d);if(null!=t){T(t,e);continue}const s=i.getGeometry(d);null==s||I(s,e)}return l.candidates.sort((e,t)=>e.distance-t.distance),l;function I(t,s){const{coords:i,stride:r}=t,n=t.isPoint?te:t.lengths;if(g.coords=i,y.coords=i,e.returnEdge){let e=0;for(let t=0;t<n.length;t++){const i=n[t],c=e;for(let t=0;t<i;t++,e+=r){if(!u&&t===i-1)continue;if(g.coordsIndex=e,y.coordsIndex=t===i-1?c:e+r,!$(x,a,g,y))continue;const n=o(x.x,x.y);n<=1&&l.candidates.push(new _(s,m(x),Math.sqrt(n),m(g),m(y)))}}}if("all"===e.vertexMode){let e=0;for(let t=0;t<n.length;t++){const i=n[t],a=e,c=y;c.coordsIndex=a;for(let t=0;t<i;t++,e+=r){if(g.coordsIndex=e,u&&t===i-1&&g.x===c.x&&g.y===c.y)continue;const a=o(g.x,g.y);a<=1&&l.candidates.push(new v(s,m(g),Math.sqrt(a)))}}}else if(c&&"ends"===e.vertexMode){let e=0;const t=[];for(let s=0;s<n.length;s++){t.push(e);const i=n[s];e+=i*r,i>1&&t.push(e-r)}for(const i of t){g.coordsIndex=i;const e=o(g.x,g.y);e<=1&&l.candidates.push(new v(s,m(g),Math.sqrt(e)))}}}function T(t,s){const{candidates:i}=l,r={x:0,y:0,z:0};if(e.returnEdge){const e=[a.x,a.y],n=new ee(e,0),l=new ee(e,0);for(const{segments:a}of t.parts)for(const{start:t,curve:u}of a){const{curvePoint:a}=d(t,u,e),c=o(...a);if(c>1)continue;[r.x,r.y]=a,n.coords=t,l.coords=f(u);const g=p(u)?null:h(u);i.push(new _(s,m(r),Math.sqrt(c),m(n),m(l),!1,g))}}function n(e){r.x=t.vertexXY[2*e],r.y=t.vertexXY[2*e+1];const a=o(r.x,r.y);a>1||(r.z=t.vertexZ?.[e]??0,i.push(new v(s,m(r),Math.sqrt(a))))}if("all"===e.vertexMode){const{vertexCount:e}=t;for(let t=0;t<e;++t)n(t);return}if("ends"===e.vertexMode)switch(t.type){case"point":n(0);break;case"polyline":for(let e=0;e<t.partCount;++e){const s=t.partOffsets[e],i=t.partOffsets[e+1]-1;n(s),i!==s&&n(i)}}}}_getPointCreator(e,t,s){const i=null==s||m(t,s)?e=>e:e=>T(e,t,s),{hasZ:a}=this,r=0;return a&&e?({x:e,y:t,z:s})=>i({x:e,y:t,z:s}):({x:e,y:t})=>i({x:e,y:t,z:r})}async createSummaryStatisticsResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:r,minValue:n,maxValue:o,scale:l,timeZone:u,outStatisticTypes:c}=e,m=this.fieldsIndex.get(t),d=V(m)||S(m)||b(m),f=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:r,scale:l,timeZone:u},this.items),p=k({normalizationType:a,normalizationField:i,minValue:n,maxValue:o}),h={value:.5,fieldType:m?.type},g=R(m)?P({values:f,supportsNullCount:p,percentileParams:h,outStatisticTypes:c}):D({values:f,minValue:n,maxValue:o,useSampleStdDev:!a,supportsNullCount:p,percentileParams:h,outStatisticTypes:c});return O(g,c,d)}async createUniqueValuesResponse(e){const{field:t,valueExpression:s,domains:i,returnAllCodedValues:a,scale:r,timeZone:n}=e,o=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:s,scale:r,timeZone:n},this.items,!1),l=j(o);return q(l,i,a,e.fieldDelimiter)}async createClassBreaksResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c,scale:m,timeZone:d}=e,f=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:r,scale:m,timeZone:d},this.items),p=C(f,{field:t,normalizationField:i,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numClasses:c});return G(p,n)}async createHistogramResponse(e){const{field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c,scale:m,timeZone:d}=e,f=await this._getDataValues({field:t,valueExpression:s,normalizationField:i,normalizationType:a,normalizationTotal:r,scale:m,timeZone:d},this.items);return Z(f,{field:t,normalizationField:i,normalizationType:a,normalizationTotal:r,classificationMethod:n,standardDeviationInterval:o,minValue:l,maxValue:u,numBins:c})}_sortFeatures(e,t,s){if(e.length>1&&t?.length)for(const i of t.slice().reverse()){const{compare:t,fieldOrExpression:a,fieldInfo:r}=se(i,this.fieldsIndex);e.sort((e,i)=>t(s(e,a,r),s(i,a,r)))}}_topNFeatures(t,s,i,a){if(t.length>1&&s?.length){const r=s.map(e=>{const{compare:t,fieldOrExpression:s,fieldInfo:i}=se(e,this.fieldsIndex);return(e,r)=>t(a(e,s,i),a(r,s,i))}).reduceRight((e,t)=>(s,i)=>{const a=t(s,i);return 0===a||Number.isNaN(a)?e(s,i):a}),n=[];for(const s of t)e(n,s,i,r);return n}return t.slice(0,i)}_createFeatureQueryResponse(e){const{items:t,geometryType:s,hasM:i,hasZ:a,featureIdInfo:r,spatialReference:n}=this,{outFields:o,outSR:l,quantizationParameters:c,resultRecordCount:m,resultOffset:d,returnZ:f,returnM:p}=e,h=null!=m&&t.length>(d||0)+m,g=o&&(o.includes("*")?[...this.fieldsIndex.fields]:o.map(e=>this.fieldsIndex.get(e)));return{exceededTransferLimit:h,features:this._createFeatures(e,t),fields:g,geometryType:s,hasM:i&&p,hasZ:a&&f,objectIdFieldName:"object-id"===r.type?r.fieldName:null,spatialReference:y(l||n),transform:c&&u(c)||null}}_createFeatures(e,t){const s=new g(e,this.featureAdapter,this.fieldsIndex),{hasM:i,hasZ:a}=this,{orderByFields:r,quantizationParameters:n,returnGeometry:o,returnCentroid:l,maxAllowableOffset:c,resultOffset:m,resultRecordCount:d,returnZ:f=!1,returnM:p=!1}=e,h=a&&f,y=i&&p;let T;const F=m||0,_=null!=d?F+d:null;null!=_&&_<=5e3&&_<t.length?T=this._topNFeatures(t,r,_,(e,t,i)=>s.getFieldValue(e,t,i)):(T=[...t],this._sortFeatures(T,r,(e,t,i)=>s.getFieldValue(e,t,i))),(F>0||null!=_)&&(T=T.slice(F,_??void 0));const v=[];let V=0;if(this.geometryType&&(o||l)){const e=u(n)??void 0,t="esriGeometryPolygon"===this.geometryType||"esriGeometryPolyline"===this.geometryType;if(o&&!l)for(const i of T){const a=this.featureAdapter.getGeometry(i),r=this._addFeatureJSONMetadata(i,{attributes:s.getAttributes(i),geometry:x(this.geometryType,a,c,e,h,y)});t&&a&&!r.geometry&&(r.centroid=I(this,this.featureAdapter.getCentroid(i,this),e)),v[V++]=r}else if(!o&&l)for(const i of T)v[V++]=this._addFeatureJSONMetadata(i,{attributes:s.getAttributes(i),centroid:I(this,this.featureAdapter.getCentroid(i,this),e)});else for(const i of T)v[V++]=this._addFeatureJSONMetadata(i,{attributes:s.getAttributes(i),centroid:I(this,this.featureAdapter.getCentroid(i,this),e),geometry:x(this.geometryType,this.featureAdapter.getGeometry(i),c,e,h,y)})}else for(const u of T){const e=s.getAttributes(u);e&&(v[V++]=this._addFeatureJSONMetadata(u,{attributes:e}))}return v}_addFeatureJSONMetadata(e,t){const s=this.featureAdapter.getMetadata?.(e);return void 0!==s&&(t.metadata=s),t}_createExceedsLimitQueryResponse(){let e=!1,t=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,i=Number.POSITIVE_INFINITY;for(const a of this.query.outStatistics??[])if("exceedslimit"===a.statisticType){t=null!=a.maxPointCount?a.maxPointCount:Number.POSITIVE_INFINITY,s=null!=a.maxRecordCount?a.maxRecordCount:Number.POSITIVE_INFINITY,i=null!=a.maxVertexCount?a.maxVertexCount:Number.POSITIVE_INFINITY;break}if("esriGeometryPoint"===this.geometryType)e=this.items.length>t;else if(this.items.length>s)e=!0;else{e=this.items.reduce((e,t)=>{const s=this.featureAdapter.getGeometry(t);return e+(s?.size??0)},0)>i}return{fields:[{name:"exceedslimit",type:"esriFieldTypeInteger",alias:"exceedslimit",sqlType:"sqlTypeInteger",domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(e)}}]}}async _createStatisticsQueryResponse(e,t,s={attributes:{}}){const i=[],a=new Map,r=new Map,n=new Map,o=new Map,l=new g(e,this.featureAdapter,this.fieldsIndex),u=e.outStatistics,{groupByFieldsForStatistics:c,having:m,orderByFields:d,resultRecordCount:f}=e,p=c?.length,h=!!p,y=h?c[0]:null,x=h&&!this.fieldsIndex.get(y);for(const g of u??[]){const{outStatisticFieldName:u,statisticType:d}=g,f=g,I="exceedslimit"!==d?g.onStatisticField:void 0,T="percentile_disc"===d||"percentile_cont"===d,F="EnvelopeAggregate"===d||"CentroidAggregate"===d||"ConvexHullAggregate"===d,_=h&&1===p&&(I===y||x)&&"count"===d;if(h){if(!n.has(I)){const e=[];for(const s of c){const i=this._getAttributeValues(l,s,t,a);e.push(i)}n.set(I,this._calculateUniqueValues(e,t,!F&&l.returnDistinctValues))}const s=n.get(I);if(!s)continue;const i=Object.keys(s);for(const r of i){const{count:i,data:n,items:d,itemPositions:p}=s[r],h=n.join(",");if(!m||l.validateItems(d,m)){const s=o.get(h)||{attributes:{}};if(e.returnAggIds&&(s.aggregateIds=d.map(e=>this.featureAdapter.getObjectId(e)).filter(e=>null!=e)),F){s.aggregateGeometries||(s.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:t}=await this._getAggregateGeometry(f,d);s.aggregateGeometries[t]=e}else{let e=null;if(_)e=i;else{const s=this._getAttributeValues(l,I,t,a),i=p.map(e=>s[e]);e=T&&"statisticParameters"in f?this._getPercentileValue(f,i):this._getStatisticValue(f,i,null,l.returnDistinctValues)}s.attributes[u]=e}let r=0;c.forEach((e,t)=>s.attributes[this.fieldsIndex.get(e)?e:"EXPR_"+ ++r]=n[t]),o.set(h,s)}}}else if(F){s.aggregateGeometries||(s.aggregateGeometries={});const{aggregateGeometries:e,outStatisticFieldName:i}=await this._getAggregateGeometry(f,t);s.aggregateGeometries[i]=e}else{const e=this._getAttributeValues(l,I,t,a);s.attributes[u]=T&&"statisticParameters"in f?this._getPercentileValue(f,e):this._getStatisticValue(f,e,r,l.returnDistinctValues)}const v="min"!==d&&"max"!==d||!R(this.fieldsIndex.get(I))&&!this._isAnyDateField(I)?null:this.fieldsIndex.get(I)?.type;i.push({name:u,alias:u,type:v||"esriFieldTypeDouble"})}const I=h?Array.from(o.values()):[s];return this._sortFeatures(I,d,(e,t)=>e.attributes[t]),f&&(I.length=Math.min(f,I.length)),{fields:i,features:I}}_isAnyDateField(e){const t=this.fieldsIndex.get(e);return V(t)||S(t)||b(t)||z(t)}async _getAggregateGeometry(e,t){const{statisticType:s,outStatisticFieldName:i}=e,{featureAdapter:o,spatialReference:l,geometryType:u}=this,c=t.map(e=>x(u,o.getGeometry(e))),m={aggregateGeometries:null,outStatisticFieldName:null},d=await L.getImportPromise();let[f]=d.executeMany(c,{merge:!0});if(f&&f.rings[0].length<=3&&(f=null),"EnvelopeAggregate"===s){const e=f?n(f):K(c);m.aggregateGeometries={...e,spatialReference:l},m.outStatisticFieldName=i||"extent"}else if("CentroidAggregate"===s){const[e,t]=f?a(f):r(K(c));m.aggregateGeometries={x:e,y:t,spatialReference:l},m.outStatisticFieldName=i||"centroid"}else"ConvexHullAggregate"===s&&(m.aggregateGeometries=f&&{...f,spatialReference:l},m.outStatisticFieldName=i||"convexHull");return m}_getStatisticValue(e,t,s,i){const{onStatisticField:a,statisticType:r}=e;let n=null;n=s?.has(a)?s.get(a):R(this.fieldsIndex.get(a))||this._isAnyDateField(a)?P({values:t,returnDistinct:i}):D({values:i?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),s&&s.set(a,n);return n["var"===r?"variance":r]}_getPercentileValue(e,t){const{onStatisticField:s,statisticParameters:i,statisticType:a}=e,{value:r,orderBy:n}=i,o=this.fieldsIndex.get(s);return E(t,{value:r,orderBy:n,fieldType:o?.type,isDiscrete:"percentile_disc"===a})}_getAttributeValues(e,t,s,i){if(i.has(t))return i.get(t);const a=this.fieldsIndex.get(t),r=s.map(s=>e.getFieldValue(s,t,a));return i.set(t,r),r}_calculateUniqueValues(e,t,s){const i={},a=t.length;for(let r=0;r<a;r++){const a=t[r],n=[];for(const t of e)n.push(t[r]);const o=n.join(",");null==i[o]?i[o]={count:1,data:n,items:[a],itemPositions:[r]}:(s||i[o].count++,i[o].items.push(a),i[o].itemPositions.push(r))}return i}async _getDataValues(e,i,a=!0){const r=new g(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:n,scale:o,timeZone:l}=e,u=s.fromJSON(this.query.outSR||this.spatialReference);return n?r.getExpressionValues(i,n,{viewingMode:"map",scale:o,spatialReference:u},{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM},l):r.getDataValues(i,t(e),a)}_calculateHistogramBins(e,t,s){if(null==t.min&&null==t.max)return[];const i=t.intervals,a=t.min??0,r=t.max??0,n=i.map(([e,t])=>({minValue:e,maxValue:t,count:0,items:[]}));for(let o=0;o<e.length;o++){const t=e[o],l=s[o];if(null!=t&&t>=a&&t<=r){const e=U(i,t);e>-1&&(n[e].count++,n[e].items.push(l))}}return n}async createQueryBinsResponse(e){const t=e.bin?.splitBy;if(!t)return this._createBinsResponse(e);const{value:s,outAlias:i,valueType:a}=t,r=[],n=[{name:i??s,alias:i??s,type:a??"esriFieldTypeString"},{name:X,alias:X,type:"esriFieldTypeInteger"}],o=new g(e,this.featureAdapter,this.fieldsIndex),l=new Map,u=[...this.items];this._sortFeatures(u,[s],(e,t,s)=>o.getFieldValue(e,t,s));const c=this._getAttributeValues(o,s,u,l),m=this._calculateUniqueValues([c],u,o.returnDistinctValues);for(const d in m){const{items:t}=m[d],a=await this._createBinsResponse(e,t);if(r.push(...a.features.map(e=>({...e,attributes:{...e.attributes,[i??s]:d}}))),a.fields)for(const e of a.fields)n.some(t=>t.name===e.name)||n.push(e)}return{fields:n,features:r}}async _createBinsResponse(e,t){const s=e.bin;switch(t=t??this.items,s.type){case"autoIntervalBin":return this._createAutoIntervalBinsResponse(B.fromJSON(s),e,t);case"dateBin":return this._createDateBinsResponse(M.fromJSON(s),e,t);case"fixedBoundariesBin":return this._createFixedBoundariesBinsResponse(w.fromJSON(s),e,t);case"fixedIntervalBin":return this._createFixedIntervalBinsResponse(N.fromJSON(s),e,t)}}async _createAutoIntervalBinsResponse(e,t,s){const{field:i,normalizationField:a,numBins:r,normalizationType:n,normalizationTotal:o,start:l,end:u}=e,c=await this._getDataValues({field:e.field||e.expression,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},s),m=H(c,{field:i,normalizationField:a,normalizationType:n,normalizationTotal:o,numBins:r,minValue:F(n?e.normalizationMinValue:l,!1),maxValue:F(n?e.normalizationMaxValue:u,!1)}),d=this._calculateHistogramBins(c,m,s);return this._createFeaturesFromHistogramBins(d,t)}async _createDateBinsResponse(e,t,s){const{field:i,interval:a,start:r,end:n,snapToData:o,returnFullIntervalBin:l,offset:u,firstDayOfWeek:c}=e,m=a.unit,d=await this._getDataValues({field:i||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},s),f=z(this.fieldsIndex.get(i)),p=A.toJSON(m),h=d.filter(Boolean).sort((e,t)=>e-t),g=null!=r?F(r,f):h[0],y=null!=n?F(n,f):h[h.length-1],x=[];if(null!=g&&null!=y){const e={zone:t.outTimeReference?.ianaTimeZone??Q},s=u?.unit?A.toJSON(u.unit):"milliseconds",i={[s]:u?.value||0},r=Y.fromMillis(g,e).minus(i),n=Y.fromMillis(y,e).minus(i),m="number"==typeof c&&c>=1&&c<=7?c:7,d=(e,t)=>{const s=(e.weekday-t+7)%7;return e.minus({days:s}).startOf("day")};if("last"===o){let e="week"===p?((e,t)=>d(e,t).plus({days:7}))(n,m):n;for(;e>r;){const t=e.minus({[p]:a.value});if(t<r){x.unshift([l?t.plus(i).toMillis():r.plus(i).toMillis(),e.plus(i).toMillis()]);break}x.unshift([t.plus(i).toMillis(),e.plus(i).toMillis()]),e=t}}else{let e="first"===o?r:"week"===p?d(r,m):r.startOf(p);for(;e<=n;){const t=e.plus({[p]:a.value});if(t>n){x.push([e.plus(i).toMillis(),l?t.plus(i).toMillis():n.plus(i).toMillis()]);break}x.push([e.plus(i).toMillis(),t.plus(i).toMillis()]),e=t}}}const I=this._calculateHistogramBins(d,{intervals:x,min:g,max:y},s);return this._createFeaturesFromHistogramBins(I,t)}async _createFixedBoundariesBinsResponse(e,t,s){const{field:i}=e,a=await this._getDataValues({field:i||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},s),r=z(this.fieldsIndex.get(i)),n=e.boundaries.map(e=>F(e,r)).sort((e,t)=>e-t),o=[];for(let c=0;c<n.length-1;c++)o.push([n[c],n[c+1]]);const l={intervals:o,min:n.at(0),max:n.at(-1)},u=this._calculateHistogramBins(a,l,s);return this._createFeaturesFromHistogramBins(u,t)}async _createFixedIntervalBinsResponse(e,t,s){const{field:i,interval:a,normalizationType:r,start:n,end:o}=e,l=await this._getDataValues({field:i||e.expression,normalizationField:e.normalizationField,normalizationType:r,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},s),u=z(this.fieldsIndex.get(i)),c=H(l,{field:i,classificationMethod:"defined-interval",definedInterval:a,minValue:F(r?e.normalizationMinValue:n,u),maxValue:F(r?e.normalizationMaxValue:o,u)},!0),m=this._calculateHistogramBins(l,c,s);return this._createFeaturesFromHistogramBins(m,t)}async _createFeaturesFromHistogramBins(e,t){const{upperBoundaryAlias:s,lowerBoundaryAlias:i}=t,a=i||"lowerBoundary",r=s||"upperBoundary",n=[],o=[{name:a,alias:a,type:"esriFieldTypeDouble"},{name:r,alias:r,type:"esriFieldTypeDouble"}],l=t.bin?.stackBy?.value,u=t.bin?.stackBy?.outAlias;l&&o.push({name:X,alias:X,type:"esriFieldTypeInteger"},{name:u??l,alias:u??l,type:"esriFieldTypeString"});let c=0;const m="dateBin"===t.bin.type,d=t.outTimeReference?.ianaTimeZone;for(const f of e){const{minValue:e,maxValue:s,items:i}=f,p={attributes:{}};let h;if(p.attributes[a]=m&&d&&null!=e?Y.fromMillis(e,{zone:d}).toISO():e,t.bin.hideUpperBound||(p.attributes[r]=m&&d&&null!=s?Y.fromMillis(s,{zone:d}).toISO():s),t.returnAggIds&&(p.aggregateIds=i.map(e=>this.featureAdapter.getObjectId(e)).filter(e=>null!=e)),l?(h=await this._createStatisticsQueryResponse({...t,groupByFieldsForStatistics:[l],orderByFields:[l]},i),p.attributes[X]=++c,"flat"===t.bin.jsonStyle?n.push(...h.features.map(({attributes:{EXPR_1:e,...t},...s})=>({...s,attributes:u??e?{...t,[u??e]:e,...p.attributes}:{...t,...p.attributes}}))):(p.stackedAttributes=h.features.map(({attributes:{EXPR_1:e,...t}})=>u??e?{...t,[u??e]:e}:t),n.push(p))):(t.bin?.splitBy&&(p.attributes[X]=++c),h=await this._createStatisticsQueryResponse(t,i,p),n.push(p)),h.fields)for(const t of h.fields)o.some(e=>e.name===t.name)||o.push(t)}return"desc"===t.binOrder&&n.reverse(),{fields:o,features:n}}}function K(e){const t=o(e[0]);for(const s of e.slice(1))l(t,o(s));return t}function $(e,t,s,i){const a=i.x-s.x,r=i.y-s.y,n=t.x-s.x,o=t.y-s.y,l=a*a+r*r;if(0===l)return!1;const u=n*a+o*r,c=Math.min(1,Math.max(0,u/l));return e.x=s.x+a*c,e.y=s.y+r*c,!0}class ee{constructor(e,t){this.coords=e,this.coordsIndex=t}get x(){return this.coords[this.coordsIndex]}get y(){return this.coords[this.coordsIndex+1]}get z(){return this.coords[this.coordsIndex+2]}}const te=[1];function se(e,t){const s=e.split(" "),i=s[0],a=t.get(i),r=!!s[1]&&"desc"===s[1].toLowerCase();return{compare:J(a?.type,r,"case-insensitive"),fieldOrExpression:i,fieldInfo:a}}export{W as QueryEngineResult};
|