@arcgis/core 6.0.0-next.14 → 6.0.0-next.16
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/analysis/LineOfSightAnalysis.d.ts +49 -32
- package/analysis/LineOfSightAnalysisObserver.d.ts +19 -3
- package/analysis/LineOfSightAnalysisTarget.d.ts +19 -3
- package/analysis/Viewshed.d.ts +23 -3
- package/analysis/ViewshedAnalysis.d.ts +33 -13
- package/arcade/geometry/operatorsWorkerConnection.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/00d66e3fba5ab4d2aa3c.js +1 -0
- package/assets/esri/core/workers/chunks/{d994bcf0a65d1c07160f.js → 0320cbd825f9a4222042.js} +1 -1
- package/assets/esri/core/workers/chunks/08fe248e412bb170210d.js +1 -0
- package/assets/esri/core/workers/chunks/{fb444954be74c1962ced.js → 10d80e793019dfb45ca2.js} +1 -1
- package/assets/esri/core/workers/chunks/14d5d219e7fe017f23f0.js +1 -0
- package/assets/esri/core/workers/chunks/164e74d586297946a717.js +1 -0
- package/assets/esri/core/workers/chunks/{1bca39e0e651426bdbb5.js → 1b1d3f6916d2cb751435.js} +1 -1
- package/assets/esri/core/workers/chunks/{ed6e9d7f71bfd2691717.js → 1c77de1e79860f8d2228.js} +1 -1
- package/assets/esri/core/workers/chunks/1e40a26dcce4d1dadc28.js +1 -0
- package/assets/esri/core/workers/chunks/237a1f68a0efbfe5b77c.js +1 -0
- package/assets/esri/core/workers/chunks/23c43f09c4a4749516e1.js +1 -0
- package/assets/esri/core/workers/chunks/{3418877328f4f0830300.js → 24dac4970526a4e0ae63.js} +1 -1
- package/assets/esri/core/workers/chunks/26ceb0ff8d93dbb9b84f.js +1 -0
- package/assets/esri/core/workers/chunks/2acf2952cef69e382a35.js +1 -0
- package/assets/esri/core/workers/chunks/{481589c3eddad6e026ad.js → 369780276b2755361f7d.js} +1 -1
- package/assets/esri/core/workers/chunks/{4df6cb1bee5d0720a43e.js → 36cbd614454581aaf334.js} +1 -1
- package/assets/esri/core/workers/chunks/{1e0d2715d603f48a7e0b.js → 370aad23df597db80d65.js} +1 -1
- package/assets/esri/core/workers/chunks/3baa4a9c52f41bfd6abb.js +1 -0
- package/assets/esri/core/workers/chunks/42d44c7d532df5ee70e9.js +1 -0
- package/assets/esri/core/workers/chunks/42e985a576d7aaeed0cf.js +1 -0
- package/assets/esri/core/workers/chunks/{6400446b7615b97c3521.js → 45f826554499c38968c6.js} +1 -1
- package/assets/esri/core/workers/chunks/48cc58890fddbcf69cef.js +1 -0
- package/assets/esri/core/workers/chunks/494bd434fee9032e1d02.js +1 -0
- package/assets/esri/core/workers/chunks/{33e4ff228a8c81b99022.js → 4abd3753cd9b80e4d937.js} +1 -1
- package/assets/esri/core/workers/chunks/4bbe1f28f5f16a6bef05.js +1 -0
- package/assets/esri/core/workers/chunks/4c389472b8cdb0c55154.js +1 -0
- package/assets/esri/core/workers/chunks/4e4f747de424941a0bfa.js +1 -0
- package/assets/esri/core/workers/chunks/5529831dd891382c79df.js +1 -0
- package/assets/esri/core/workers/chunks/5736feefa261589b6273.js +1 -0
- package/assets/esri/core/workers/chunks/576248e9ae2654569420.js +1 -0
- package/assets/esri/core/workers/chunks/5acb422fe3cf693d9d4f.js +1 -0
- package/assets/esri/core/workers/chunks/{aeaaff7a4b1a99540f52.js → 5cb26bbaa08114aec5ce.js} +1 -1
- package/assets/esri/core/workers/chunks/661c6324529dd17b297e.js +1 -0
- package/assets/esri/core/workers/chunks/68dd1fd2025c7125ead1.js +1 -0
- package/assets/esri/core/workers/chunks/{89e76de5ae3328d821a4.js → 69f6d5997b8ff1326e39.js} +1 -1
- package/assets/esri/core/workers/chunks/6a8dd8b18b0b825b0c1b.js +1 -0
- package/assets/esri/core/workers/chunks/{a40b6d8b5c73e06e14d4.js → 6c255c029d67423e4dac.js} +1 -1
- package/assets/esri/core/workers/chunks/7446d0dfebf93e86c098.js +1 -0
- package/assets/esri/core/workers/chunks/{688f2dbf784e66082308.js → 74c866e0b66e61751861.js} +1 -1
- package/assets/esri/core/workers/chunks/{3ffda5bf0b91700dc308.js → 78643f116677950ea29a.js} +1 -1
- package/assets/esri/core/workers/chunks/{916b363c342b61ba5461.js → 787c1a8bda7d745633f2.js} +1 -1
- package/assets/esri/core/workers/chunks/7b5f3c79e0605c32b267.js +1 -0
- package/assets/esri/core/workers/chunks/7bbfe9ff352afc566367.js +1 -0
- package/assets/esri/core/workers/chunks/{ac5a6603f7fa78d3e4c8.js → 7e8611cb709f105946f5.js} +1 -1
- package/assets/esri/core/workers/chunks/{05cd33d41d91f8d09633.js → 7fb7493f483cd9878bfa.js} +1 -1
- package/assets/esri/core/workers/chunks/{acfa03c65ba3ca6c5685.js → 8715661a838361d4211a.js} +1 -1
- package/assets/esri/core/workers/chunks/{601e1d020b8115497944.js → 8a485130781b49dbf608.js} +1 -1
- package/assets/esri/core/workers/chunks/{0ccab50877b24f862d6e.js → 8ac2098ecdc40ad41055.js} +1 -1
- package/assets/esri/core/workers/chunks/{a655ebdb4bf0660615a2.js → 8b4e9fd88c0c313416d4.js} +1 -1
- package/assets/esri/core/workers/chunks/{4e544de61f07ca660236.js → 8c12269d26f5a4c753cb.js} +1 -1
- package/assets/esri/core/workers/chunks/8e19629899a5becf8e19.js +1 -0
- package/assets/esri/core/workers/chunks/91dd65cf877c8f2e01a7.js +1 -0
- package/assets/esri/core/workers/chunks/{46b4fb6a7fe4877b0efc.js → 94baa354e50c03b82b25.js} +2 -2
- package/assets/esri/core/workers/chunks/950d4578dc450467404c.js +1 -0
- package/assets/esri/core/workers/chunks/{68be3fb88ca61f82fb90.js → 95dbbddac6581b9d671f.js} +1 -1
- package/assets/esri/core/workers/chunks/98be2f621801e230aa01.js +1 -0
- package/assets/esri/core/workers/chunks/9b051745d24d1f43480b.js +1 -0
- package/assets/esri/core/workers/chunks/9d61740ef8bdcc162be1.js +1 -0
- package/assets/esri/core/workers/chunks/{eb04e1717a1002cda3ab.js → 9f06ec95bdf0d0b52b41.js} +1 -1
- package/assets/esri/core/workers/chunks/{fafb92ca2c5e4b0b2c23.js → a09d2e1e2540921e4717.js} +1 -1
- package/assets/esri/core/workers/chunks/{3b3e519f15ed52c83f0c.js → a49fe94933b65b4b64f8.js} +1 -1
- package/assets/esri/core/workers/chunks/{1819c45655c836b9a8d7.js → a4d3944700f1cc240176.js} +1 -1
- package/assets/esri/core/workers/chunks/{90bdf86f553e2742d67c.js → a7bd5ba4d7d97411fd33.js} +1 -1
- package/assets/esri/core/workers/chunks/{900181f68449d8f82eeb.js → aa1ac7954e4f0fefe15b.js} +1 -1
- package/assets/esri/core/workers/chunks/ac24b4370dc7194a3107.js +1 -0
- package/assets/esri/core/workers/chunks/{b8337492e2b753aefac4.js → ace41659a5ca0e5abfc3.js} +1 -1
- package/assets/esri/core/workers/chunks/{3c0ed15b544df6fb0903.js → b48952e1fb4cb7360dd0.js} +1 -1
- package/assets/esri/core/workers/chunks/b5e7475cc5fbf31289d3.js +1 -0
- package/assets/esri/core/workers/chunks/{f3da30d7300b92bd8bb0.js → befa32b9e7b3fbdd431e.js} +1 -1
- package/assets/esri/core/workers/chunks/{0f617980c7dd9ad0444f.js → bf35927979fc5e7e0478.js} +1 -1
- package/assets/esri/core/workers/chunks/c4ddac23bd649d24f3f2.js +1 -0
- package/assets/esri/core/workers/chunks/{4e6f40cbdb8c508e6df1.js → c5a9e77977e867a75ff2.js} +1 -1
- package/assets/esri/core/workers/chunks/{25f19fc929f25ddd628c.js → c79934cd6883307203f8.js} +1 -1
- package/assets/esri/core/workers/chunks/cddc3e285f763ccf33c2.js +1 -0
- package/assets/esri/core/workers/chunks/d08ff41e2a9bcd58b64a.js +1 -0
- package/assets/esri/core/workers/chunks/d311ff96a5a2791d8cfc.js +1 -0
- package/assets/esri/core/workers/chunks/d62afb71f4ece4283994.js +1 -0
- package/assets/esri/core/workers/chunks/dc1761cba0454fda3cf9.js +1 -0
- package/assets/esri/core/workers/chunks/{4ac1d3e49e242e373a92.js → e0650b1408197d3ac862.js} +1 -1
- package/assets/esri/core/workers/chunks/{3ff6d1ed3c0f1285f3e7.js → e0d9dc97985561320bd4.js} +1 -1
- package/assets/esri/core/workers/chunks/eaddffcc7004101fc230.js +1 -0
- package/assets/esri/core/workers/chunks/eb2652ec48faa78de3c5.js +1 -0
- package/assets/esri/core/workers/chunks/eca44e53bcee9b08d70a.js +1 -0
- package/assets/esri/core/workers/chunks/f00458654c7c34c369ef.js +1 -0
- package/assets/esri/core/workers/chunks/f3cd610084e3f4d8656b.js +1 -0
- package/assets/esri/core/workers/chunks/f47fe4433b05fca5c3ad.js +1 -0
- package/assets/esri/core/workers/chunks/f7bfa3d33b05b250ce33.js +1 -0
- package/assets/esri/core/workers/chunks/f91bc1cb1014e05be763.js +1 -0
- package/assets/esri/core/workers/chunks/{aadfe34a99c9ec7a0e11.js → f9c5aa0bbf23e780fecc.js} +1 -1
- package/assets/esri/core/workers/chunks/f9ff27cfcf0538ac5e26.js +1 -0
- package/assets/esri/core/workers/chunks/{19676b2c5f8b0a5ee680.js → facd1ff23203fed67686.js} +1 -1
- package/assets/esri/core/workers/chunks/{40a584cb952e94326e9e.js → fcb86d24fc7e0666b564.js} +1 -1
- package/assets/esri/libs/pdfjs/wasm/openjpeg_nowasm_fallback.js +1 -0
- package/chunks/Distance2DCalculator-DjIp2uQi.js +1 -1
- package/chunks/Envelope.js +1 -1
- package/chunks/MultiPathImpl.js +1 -1
- package/chunks/OperatorGeodeticArea.js +1 -1
- package/chunks/OperatorShapePreservingLength.js +1 -1
- package/chunks/OperatorShapePreservingProject.js +1 -1
- package/chunks/UnitFactory.js +1 -1
- package/chunks/basis_encoder.js +1 -1
- package/chunks/basis_transcoder.js +1 -1
- package/chunks/index.js +1 -1
- package/chunks/lclayout.js +1 -1
- package/config.d.ts +2 -0
- package/config.js +1 -1
- package/core/ObjectPool.js +1 -1
- package/core/PooledArray.js +1 -1
- package/core/accessorSupport/DefaultsStore.js +1 -1
- package/core/accessorSupport/MultiOriginStore.js +1 -1
- package/core/accessorSupport/Store.js +1 -1
- package/core/accessorSupport/decorators/reader.js +1 -1
- package/core/accessorSupport/decorators/writer.js +1 -1
- package/core/accessorSupport/tracking/SimpleTrackingTarget.js +1 -1
- package/core/workers/WorkerOwner.js +1 -1
- package/core/workers/workerFactory.js +1 -1
- package/core/workers/workers.js +2 -2
- package/core/workers.d.ts +9 -0
- package/form/elements/inputs/DynamicChoiceInput.d.ts +4 -2
- package/geometry/Mesh.js +1 -1
- package/geometry/operators/gx/operatorAlphaShape.js +1 -1
- package/geometry/operators/gx/operatorOffset.js +1 -1
- package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/geometry/support/buffer/BufferPool.js +1 -1
- package/geometry/support/coordsUtils.js +1 -1
- package/geometry/support/curves/bezierCurveUtils.js +1 -1
- package/geometry/support/curves/ellipticArc7Utils.js +1 -1
- package/geometry/support/meshUtils/merge.js +1 -1
- package/geometry/support/meshUtils/rotate.js +1 -1
- package/geometry/support/meshUtils.d.ts +5 -6
- package/geometry/support/polygonExtentClipping.js +1 -1
- package/identity/Credential.js +1 -1
- package/interfaces.d.ts +18 -9
- package/kernel.js +1 -1
- package/layers/AnnotationFeatureLayer.d.ts +2 -2
- package/layers/AnnotationFeatureLayer.js +1 -1
- package/layers/CatalogLayer.d.ts +2 -2
- package/layers/CatalogLayer.js +1 -1
- package/layers/DimensionFeatureLayer.d.ts +2 -2
- package/layers/DimensionFeatureLayer.js +1 -1
- package/layers/FeatureLayer.d.ts +4 -4
- package/layers/FeatureLayer.js +1 -1
- package/layers/GeospatialPDFLayer.d.ts +154 -4
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/Layer.d.ts +2 -0
- package/layers/LineOfSightLayer.d.ts +10 -8
- package/layers/SceneLayer.js +1 -1
- package/layers/SubtypeGroupLayer.d.ts +2 -2
- package/layers/SubtypeGroupLayer.js +1 -1
- package/layers/ViewshedLayer.d.ts +1 -1
- package/layers/VoxelLayer.js +1 -1
- package/layers/WMSLayer.js +1 -1
- package/layers/geospatialPDF/GeospatialPDFFrame.js +1 -1
- package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +9 -9
- package/layers/geospatialPDF/GeospatialPDFWorkerClient.js +1 -1
- package/layers/geospatialPDF/LGIDictMapFrame.js +1 -1
- package/layers/geospatialPDF/ViewportMeasureFrame.js +1 -1
- package/layers/geospatialPDF/geospatialPDFParserUtils.js +1 -1
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/sources/connections/WebSocketConnection.js +1 -1
- package/layers/graphics/sources/parquet/FileProvider.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/mixins/{FeatureLayerReload.d.ts → ReloadableLayer.d.ts} +5 -3
- package/layers/mixins/ReloadableLayer.js +2 -0
- package/layers/raster/datasets/BaseRaster.js +1 -1
- package/layers/raster/datasets/GeospatialPDFRaster.js +1 -1
- package/layers/raster/datasets/ImageAuxRaster.js +2 -2
- package/layers/raster/datasets/ImageServerRaster.js +1 -1
- package/layers/raster/datasets/InMemoryRaster.js +1 -1
- package/layers/raster/datasets/MRFRaster.js +1 -1
- package/layers/raster/datasets/TIFFRaster.js +1 -1
- package/layers/raster/datasets/WCSRaster.js +1 -1
- package/layers/raster/formats/ImageCanvasDecoder.js +1 -1
- package/layers/raster/formats/RasterCodec.js +1 -1
- package/layers/raster/formats/TiffDecoder.js +1 -1
- package/layers/raster/formats/Zlib.js +1 -1
- package/layers/raster/functions/stretchUtils.js +1 -1
- package/layers/raster/functions/vectorFieldUtils.js +1 -1
- package/layers/support/FieldsIndex.js +1 -1
- package/layers/support/LabelClass.d.ts +3 -2
- package/layers/support/PortalItemData.d.ts +31 -8
- package/layers/support/RasterWorker.js +1 -1
- package/layers/support/featureReductionProperties.js +1 -1
- package/layers/support/kmlUtils.js +1 -1
- package/layers/support/types.d.ts +4 -1
- package/layers/video/VideoController.js +10 -10
- package/libs/maquette/projection.js +1 -1
- package/networks/UtilityNetworkTraceAnalysis.js +1 -1
- package/package.json +5 -5
- package/popup/FeatureModel.js +1 -1
- package/popup/FeaturesModel.js +1 -1
- package/portal/Portal.js +1 -1
- package/request/process.js +1 -1
- package/request/types.d.ts +7 -0
- package/rest/knowledgeGraph/ObjectValue.js +1 -1
- package/rest/knowledgeGraphService.js +1 -1
- package/rest/networks/trace.js +1 -1
- package/rest/query/executeQuery.js +1 -1
- package/smartMapping/raster/renderers/shadedRelief.js +1 -1
- package/smartMapping/renderers/univariateColorSize.js +1 -1
- package/smartMapping/statistics/support/statsWorker.js +1 -1
- package/smartMapping/statistics/support/utils.js +1 -1
- package/smartMapping/support/clusterUtils.js +1 -1
- package/statistics/utils.js +1 -1
- package/symbols/cim/CIMCursor.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/support/ElevationInfo.d.ts +4 -3
- package/undoredo/support/Services.js +1 -1
- package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +2 -2
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/grid/GridView2D.js +1 -1
- package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
- package/views/2d/layers/features/sources/strategies/FeatureHybridTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/FeaturePagedTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/FeatureSnapshotLoadStrategy.js +1 -1
- package/views/2d/viewpointUtils.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
- package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightPlacementController.js +1 -1
- package/views/3d/analysis/LineOfSight/{LineOfSightRootPlugin.js → LineOfSightPlacementRootPlugin.js} +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/analysis/LineOfSight/types.d.ts +14 -3
- package/views/3d/analysis/LineOfSightAnalysisView3D.d.ts +39 -13
- package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedTool.js +1 -1
- package/views/3d/analysis/Viewshed/types.d.ts +7 -0
- package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +43 -15
- package/views/3d/input/handlers/KeyboardNavigation.js +1 -1
- package/views/3d/interactive/editingTools/ManipulatedObject3DGraphic.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
- package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/SpatialIndex2D.js +1 -1
- package/views/3d/layers/i3s/I3SNode.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3DDebugger.js +1 -1
- package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/support/MemoryController.js +1 -1
- package/views/3d/support/elevationUpdateExtentUtils.js +1 -1
- package/views/3d/support/elevationUpdateUtils.js +1 -1
- package/views/3d/support/pointsOfInterest/Focus.js +1 -1
- package/views/3d/support/sphereExtentUtils.js +2 -0
- package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/terrain/TerrainData.js +1 -1
- package/views/3d/terrain/terrainUtils.js +1 -1
- package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
- package/views/3d/webgl-engine/effects/geometry/RenderOccluded.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
- package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/PathCapBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/PathEvaluator.js +1 -1
- package/views/3d/webgl-engine/lib/PathExtruder.js +1 -1
- package/views/3d/webgl-engine/lib/PathProfile.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/pathGeometryUtils.js +1 -1
- package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/ToolViewManager.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/support/InteractiveHandle.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/createUtils.js +1 -1
- package/views/draw/support/editingSessionUtils.js +1 -1
- package/views/draw/support/managers/InteractiveHandleManager.js +1 -1
- package/views/interactive/SegmentLabels.js +1 -1
- package/views/interactive/editGeometry/EditGeometry.js +1 -1
- package/views/interactive/editGeometry/EditGeometryOperations.js +1 -1
- package/views/interactive/editGeometry/operations/SetAllVertexPositions.js +1 -1
- package/views/interactive/editGeometry/operations/UndoGroup.js +1 -1
- package/views/interactive/options/TooltipOptions.d.ts +2 -0
- package/views/interactive/sketch/SketchTooltipOptions.d.ts +2 -0
- package/views/interactive/sketch/constraintUtils.js +1 -1
- package/views/interactive/snapping/SnappingDragPipelineStep.js +1 -1
- package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
- package/views/layers/LayerView.js +1 -1
- package/views/layers/LineOfSightLayerView.d.ts +35 -13
- package/views/layers/SketchLayerView.d.ts +1 -0
- package/views/layers/ViewshedLayerView.d.ts +36 -12
- package/views/webgl/Program.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/widgets/BasemapToggle/BasemapToggleViewModel.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/DynamicChoiceController.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.d.ts +10 -1
- package/widgets/Editor/legacy/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor.d.ts +10 -1
- package/widgets/ElevationProfile/support/chartUtils.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/FeatureTable/support/GroupColumnTemplate.js +1 -1
- package/widgets/FeatureTable/support/TableTemplate.js +1 -1
- package/widgets/HistogramRangeSlider.d.ts +2 -2
- package/widgets/HistogramRangeSlider.js +1 -1
- package/widgets/Legend.d.ts +1 -0
- package/widgets/Print.js +1 -1
- package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.d.ts +5 -2
- package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
- package/widgets/ScaleRangeSlider.js +1 -1
- package/widgets/Slice.js +1 -1
- package/widgets/UtilityNetworkTraceAnalysis/UtilityNetworkTraceAnalysisViewModel.js +1 -1
- package/widgets/ValuePicker/ValuePickerBaseComponent.d.ts +5 -1
- package/widgets/ValuePicker/ValuePickerCollection.d.ts +2 -0
- package/widgets/ValuePicker/ValuePickerCombobox.d.ts +7 -1
- package/widgets/ValuePicker/ValuePickerLabel.d.ts +7 -1
- package/widgets/ValuePicker/ValuePickerSlider.d.ts +2 -0
- package/widgets/ValuePicker/ValuePickerSliderVisibleElements.d.ts +5 -1
- package/widgets/ValuePicker/ValuePickerVisibleElements.d.ts +5 -1
- package/widgets/ValuePicker/types.d.ts +2 -0
- package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
- package/widgets/support/SelectionList.js +1 -1
- package/widgets/support/componentsUtils.js +1 -1
- package/assets/esri/core/workers/chunks/024b44c0c8876627f904.js +0 -1
- package/assets/esri/core/workers/chunks/02c5d027bdaee67869cf.js +0 -1
- package/assets/esri/core/workers/chunks/03261b9451e293a0fac8.js +0 -1
- package/assets/esri/core/workers/chunks/037a8cc19debbaaa4e10.js +0 -1
- package/assets/esri/core/workers/chunks/0c8c01097847617261b9.js +0 -1
- package/assets/esri/core/workers/chunks/0d931c7579b6409a696d.js +0 -1
- package/assets/esri/core/workers/chunks/12c154342fff876f2f1e.js +0 -1
- package/assets/esri/core/workers/chunks/1c65ab9ed611c322ce27.js +0 -1
- package/assets/esri/core/workers/chunks/1e11d2e97d17685b878a.js +0 -1
- package/assets/esri/core/workers/chunks/1f339247b68b061ab0a4.js +0 -1
- package/assets/esri/core/workers/chunks/21ddb26526bcb2b122c3.js +0 -1
- package/assets/esri/core/workers/chunks/22e8c0aad2fe75943865.js +0 -1
- package/assets/esri/core/workers/chunks/2eae542fe7f0f6576ac1.js +0 -1
- package/assets/esri/core/workers/chunks/408e81c8f1eff8a7b379.js +0 -1
- package/assets/esri/core/workers/chunks/444e5f214abce3d607cd.js +0 -1
- package/assets/esri/core/workers/chunks/46a7da93a63663878583.js +0 -1
- package/assets/esri/core/workers/chunks/4a1e23e021bac37a88ab.js +0 -1
- package/assets/esri/core/workers/chunks/4c4117e28ea358a32088.js +0 -1
- package/assets/esri/core/workers/chunks/54b18559280a7d2a8d93.js +0 -1
- package/assets/esri/core/workers/chunks/59b216b60464611742d4.js +0 -1
- package/assets/esri/core/workers/chunks/5bfea0c55aca826de536.js +0 -1
- package/assets/esri/core/workers/chunks/62ac588f7dd1d24d0c9d.js +0 -1
- package/assets/esri/core/workers/chunks/62c8c9ad09e0166207fd.js +0 -1
- package/assets/esri/core/workers/chunks/62d6e101e9bd9557a410.js +0 -1
- package/assets/esri/core/workers/chunks/6558488ea96620439f34.js +0 -1
- package/assets/esri/core/workers/chunks/665e31c494d2af505acc.js +0 -1
- package/assets/esri/core/workers/chunks/6f4e6022a52de0c54aab.js +0 -1
- package/assets/esri/core/workers/chunks/7267b17de212207142c9.js +0 -1
- package/assets/esri/core/workers/chunks/7ef182e24cad50815b4e.js +0 -1
- package/assets/esri/core/workers/chunks/8293600f94553afc8c38.js +0 -1
- package/assets/esri/core/workers/chunks/8431ca60ad33d594e323.js +0 -1
- package/assets/esri/core/workers/chunks/876f7633c15f1e31078d.js +0 -1
- package/assets/esri/core/workers/chunks/8ca9648eacb894283513.js +0 -1
- package/assets/esri/core/workers/chunks/91ebb2ccab1889eb7e81.js +0 -1
- package/assets/esri/core/workers/chunks/9ce91a909eccc4dfe388.js +0 -1
- package/assets/esri/core/workers/chunks/9e1a3b6a08c96dcefdde.js +0 -1
- package/assets/esri/core/workers/chunks/9e3e442a9874ed23a043.js +0 -1
- package/assets/esri/core/workers/chunks/ad76f7ab2f3e6d5a5b3c.js +0 -1
- package/assets/esri/core/workers/chunks/aff32980d91dab07dfb7.js +0 -1
- package/assets/esri/core/workers/chunks/bbf993dba74850bbf9d7.js +0 -1
- package/assets/esri/core/workers/chunks/d8f1cefcad02d7353d4b.js +0 -1
- package/assets/esri/core/workers/chunks/d938987344bce83cc660.js +0 -1
- package/assets/esri/core/workers/chunks/ddf0671976648f621269.js +0 -1
- package/assets/esri/core/workers/chunks/de02f60258e6985ef676.js +0 -1
- package/assets/esri/core/workers/chunks/e10b57aefcc89671116e.js +0 -1
- package/assets/esri/core/workers/chunks/e65dfa19f030ec298437.js +0 -1
- package/assets/esri/core/workers/chunks/f122c18af10e56f9ec2b.js +0 -1
- package/assets/esri/core/workers/chunks/f92364afaefbac7e8f77.js +0 -1
- package/assets/esri/core/workers/chunks/fd9663952d5a94f3a83f.js +0 -1
- package/assets/esri/core/workers/chunks/fe9879ecd69ac4329291.js +0 -1
- package/layers/mixins/FeatureLayerReload.js +0 -2
- /package/views/3d/analysis/LineOfSight/{lineOfSightPlacementUtils.js → placementUtils.js} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../core/Error.js";import{Loadable as n}from"../../core/Loadable.js";import{open as r}from"../../core/workers.js";import{subclass as i}from"../../core/accessorSupport/decorators.js";import a from"./GeospatialPDFFrame.js";import{parse as o}from"./geospatialPDFParserUtils.js";let s=class extends n{constructor(){super(...arguments),this._connection=null,this._workerHandler=null}load(e){let t=r(`GeospatialPDFLayerWorker`,{...e,strategy:`dedicated`,registryTarget:this}).then(e=>{this._connection=e,this._workerHandler=this._connection.createInvokeProxy()});return this.addResolvingPromise(t),Promise.resolve(this)}destroy(){this._connection?.close(),this._connection=null,this._workerHandler=null,super.destroy()}async loadPDF(e,n={}){await this.load(n);let{geospatialMetadata:r}=await this._workerHandler.loadPDF(e,n),i=o(r,0),s=i.lgiDictFrame??i.vpFrame;if(!s)throw new t(`geospatial-pdf-layer:load`,`pdf does not contain supported LGIDict or VP/Measure.`);let c=new a(s);return{frame:c,sourceSpatialReference:c.spatialReference.toJSON(),
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../core/Error.js";import{Loadable as n}from"../../core/Loadable.js";import{open as r}from"../../core/workers.js";import{subclass as i}from"../../core/accessorSupport/decorators.js";import a from"./GeospatialPDFFrame.js";import{parse as o}from"./geospatialPDFParserUtils.js";let s=class extends n{constructor(){super(...arguments),this._connection=null,this._workerHandler=null}load(e){let t=r(`GeospatialPDFLayerWorker`,{...e,strategy:`dedicated`,registryTarget:this}).then(e=>{this._connection=e,this._workerHandler=this._connection.createInvokeProxy()});return this.addResolvingPromise(t),Promise.resolve(this)}destroy(){this._connection?.close(),this._connection=null,this._workerHandler=null,super.destroy()}async loadPDF(e,n={}){await this.load(n);let{geospatialMetadata:r}=await this._workerHandler.loadPDF(e,n),i=o(r,0),s=i.lgiDictFrame??i.vpFrame;if(!s)throw new t(`geospatial-pdf-layer:load`,`pdf does not contain supported LGIDict or VP/Measure.`);let c=new a(s);return{frame:c,sourceSpatialReference:c.spatialReference.toJSON(),neatlineExtent:c.toExtent()}}async render(e,t,n,r,i,a){let o={sourceExtentAsJSON:e.toJSON(),width:t,height:n,ctm:r,currentRing:i};return this._workerHandler.renderPDF(o,a)}};s=e([i(`esri.layers.geospatialPDF.GeospatialPDFWorkerClient`)],s);export{s as GeospatialPDFWorkerClient};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../core/Error.js";import{fromValues as t}from"../../core/libs/gl-matrix-2/factories/mat2df64.js";import{fromValues as n}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{expandMediaBox as r,createGeoreferencer as i,validateTransform as a,affineTransformationFromGeoreference as o}from"./sharedUtils.js";class s{constructor(e){let t=this.
|
|
2
|
+
import e from"../../core/Error.js";import{fromValues as t}from"../../core/libs/gl-matrix-2/factories/mat2df64.js";import{fromValues as n}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import{expandMediaBox as r,createGeoreferencer as i,validateTransform as a,affineTransformationFromGeoreference as o}from"./sharedUtils.js";class s{constructor(e){let t=this._inputValidation(e);this._registration=t.registration,this._projection=t.projection,this._neatline=t.neatline,this.spatialReference=this._projection,this.pairedNeatline=f(this._neatline),this.outerExtentMediaBox=r(t.mediaBox),this.geoControlPoints=u(`geo`,this._registration),this.ctm=t.ctm??c(this.outerExtentMediaBox,this.pairedNeatline,this._registration,this.spatialReference),this._outputValidation()}_inputValidation(n){let{ctm:r,registration:i,projection:a,display:o,neatline:s,mediaBox:c}=n;if(r&&r.length!==6)throw new e(`geospatial-pdf-layer:invalid-frame`,`LGIDict has invalid CTM.`);if(!r&&(!i||i.length<3))throw new e(`geospatial-pdf-layer:invalid-frame`,`LGIDict missing CTM and minimum registration points`);if(!c||c.length!==4)throw new e(`geospatial-pdf-layer:invalid-frame`,`LGIDict missing or invalid MediaBox.`);if(!s||s.length<4||s.length%2!=0)throw new e(`geospatial-pdf-layer:invalid-frame`,`LGIDict missing or invalid amount of neatline points`);return{ctm:r?t(r[0],r[1],r[2],r[3],r[4],r[5]):void 0,registration:i??[],projection:a,display:o,neatline:s,mediaBox:c}}_outputValidation(){if(this.ctm.length!==6)throw new e(`geospatial-pdf-layer:invalid-frame`,`LGIDict missing or invalid CTM`);if(this.pairedNeatline.length<4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Map Frame should have at least 4 neatline points.`);if(this.outerExtentMediaBox.length!==4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Failed to generate outerextent from mediaBox.`);if(!this.ctm&&this.geoControlPoints.length<2)throw new e(`geospatial-pdf-layer:invalid-frame`,`Map Frame should have at least 2 geoControlPoints if defaulting.`)}}function c(e,t,r,s){let c=[],l=[];for(let e of r)e.length<4||(c.push(n(e[0],e[1])),l.push(n(e[2],e[3])));let u=d(e,t,r),f=i(c,l,s,u),p=a(f);return o(p)}function l(t){let n=1/0,r=1/0,i=-1/0,a=-1/0;for(let e=0;e<t.length;e++){let o=t[e];n=Math.min(n,o[0]),r=Math.min(r,o[1]),i=Math.max(i,o[0]),a=Math.max(a,o[1])}if(!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(a))throw new e(`geospatial-pdf-layer: invalid-frame`,`Failed to compute extent from registration.`);return{xmin:n,ymin:r,xmax:i,ymax:a}}function u(e,t){let[n,r]=e===`page`?[0,1]:[2,3];return t.filter(e=>e.length>r).map(e=>[e[n],e[r]])}function d(t,n,r){if(t.length===4)return l(t);if(n.length>=6)return l(n);let i=u(`page`,r);if(i.length>=2)return l(i);throw new e(`geospatial-pdf-layer: invalid-frame`,`Cannot build source rectangle from Neatline or Registration points.`)}function f(e){let t=[];for(let n=0;n<e.length;n+=2){let r=e[n],i=e[n+1];Number.isFinite(r)&&Number.isFinite(i)&&t.push([r,i])}return t.length===2&&(t.splice(1,0,[t[1][0],t[0][1]]),t.push([t[0][0],t[2][1]])),t}export{s as LGIDictMapFrame,l as extentFromArray,f as pairNeatline};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../core/Error.js";import{fromValues as t}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import n from"../../geometry/Point.js";import r from"../../geometry/SpatialReference.js";import{projectExecute as i}from"../../geometry/operators/projectOperator.js";import{expandMediaBox as a,validateTransform as o,affineTransformationFromGeoreference as s,createGeoreferencer as c}from"./sharedUtils.js";class l{constructor(e){let{bbox:t,bounds:n,gpts:r,lpts:i,gcs:c,mediaBox:l}=this.
|
|
2
|
+
import e from"../../core/Error.js";import{fromValues as t}from"../../core/libs/gl-matrix-2/factories/vec2f64.js";import n from"../../geometry/Point.js";import r from"../../geometry/SpatialReference.js";import{projectExecute as i}from"../../geometry/operators/projectOperator.js";import{expandMediaBox as a,validateTransform as o,affineTransformationFromGeoreference as s,createGeoreferencer as c}from"./sharedUtils.js";class l{constructor(e){let{bbox:t,bounds:n,gpts:r,lpts:i,gcs:c,mediaBox:l}=this._inputValidation(e);this._bbox=t,this._bounds=n,this._gpts=r,this._lpts=i,this._gcs=c,this.spatialReference=_(this._gcs),this.outerExtentMediaBox=a(l),this.geoControlPoints=f(this._gpts,this.spatialReference).map(e=>[e[0],e[1]]);let p=u(this._bbox,this._bounds)??d(this._lpts,this._bbox);this.pairedNeatline=p.map(e=>[e[0],e[1]]),this.neatLine=this.pairedNeatline.flat(),this._georeference=m(this._bbox,this._lpts,this._gpts,this.spatialReference);let h=o(this._georeference);this.ctm=s(h),this._outputValidation()}_inputValidation(t){let{bbox:n,bounds:r,gpts:i,lpts:a,gcs:o,mediaBox:s}=t;if(!n||n.length!==4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Viewport missing or invalid BBox`);if(!s||s.length!==4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Viewport missing or invalid MediaBox`);if(!i||i.length<6||i.length%2!=0)throw new e(`geospatial-pdf-layer:invalid-frame`,`MeasureFrame missing or invalid GPTS`);if(!a||a.length<6||a.length%2!=0)throw new e(`geospatial-pdf-layer:invalid-frame`,`MeasureFrame missing or invalid LPTS`);if(a.length!==i.length)throw new e(`geospatial-pdf-layer: invalid-frame`,`MeasureFrame LPTS and GPTS must be same length`);if(!o?.WKT&&!o?.EPSG)throw new e(`geospatial-pdf-layer:invalid-frame`,`MeasureFrame missing a WKT or EPSG code`);return{bbox:n,bounds:r,gpts:i,lpts:a,gcs:o,mediaBox:s}}_outputValidation(){if(this.outerExtentMediaBox.length!==4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Failed to generate outer extent from mediaBox`);if(this.geoControlPoints.length<2)throw new e(`geospatial-pdf-layer:invalid-frame`,`Map Frame should have at least 2 geoControlPoints`);if(this.pairedNeatline.length<4)throw new e(`geospatial-pdf-layer:invalid-frame`,`Map Frame should have at least 4 neatline points`);if(!this.ctm||this.ctm.length!==6)throw new e(`geospatial-pdf-layer:invalid-frame`,`Missing or invalid Map Frame CTM`)}}function u(e,t){return h(t)?.map(t=>p(e,t.u,t.v))??null}function d(e,t){let n=[];for(let r=0;r<e.length;r+=2){let i=e[r],a=e[r+1];n.push(p(t,i,a))}return n}function f(e,r){let a=[];for(let o=0;o<e.length;o+=2){let s=e[o],c=e[o+1],l=new n({x:c,y:s}),u=i(l,r);a.push(t(u.x,u.y))}return a}function p(e,n,r){let[i,a,o,s]=e;return t(i+n*(o-i),a+r*(s-a))}function m(e,t,n,r){let i=d(t,e),a=f(n,r),o=g(e);return c(i,a,r,o)}function h(e){if(!e||e.length<8||e.length%2!=0)return null;let t=[];for(let n=0;n<e.length;n+=2)t.push({u:e[n],v:e[n+1]});return t}function g(e){let[t,n,r,i]=e;return{xmin:Math.min(t,r),ymin:Math.min(n,i),xmax:Math.max(t,r),ymax:Math.max(n,i)}}function _(t){if(t?.WKT)return new r({wkt:t.WKT});if(t?.EPSG)return new r({wkid:t.EPSG});throw new e(`geospatial-pdf-layer: invalid-frame`,`MeasureFrame missing WKT or EPSG.`)}export{l as ViewportMeasureFrame};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../core/Error.js";import"../../core/has.js";import{LGIDictMapFrame as t}from"./LGIDictMapFrame.js";import{projectionToSpatialReference as
|
|
2
|
+
import e from"../../core/Error.js";import"../../core/has.js";import{LGIDictMapFrame as t,pairNeatline as n,extentFromArray as r}from"./LGIDictMapFrame.js";import{projectionToSpatialReference as i}from"./projectionToWKTUtils.js";import{ViewportMeasureFrame as a}from"./ViewportMeasureFrame.js";function o(n,r=0){let o={mediaBox:y(n.MediaBox),rotate:C(n.Rotate),hasLGIDict:n.LGIDict!=null,hasVP:n.VP!=null};if(o.hasVP){let t=c(n.VP,r);if(!t)throw new e(`geospatial-pdf-layer:invalid frame`,`Failed to parse VP frame at index ${r}`);return{result:o,vpFrame:new a({bbox:t.BBox,bounds:t.Measure?.Bounds,gpts:t.Measure?.GPTS,lpts:t.Measure?.LPTS,gcs:t.Measure?.GCS,mediaBox:y(n.MediaBox)})}}if(o.hasLGIDict){let a=s(n.LGIDict,r);if(!a)throw new e(`geospatial-pdf-layer:invalid frame`,`Failed to parse LGI Dict frame at index ${r}`);if(!a.Projection)throw new e(`geospatial-pdf-layer:parse`,`LGIDict map frame missing Projection.`);let c=i(a.Projection),l;try{l=a.Display?i(a.Display):void 0}catch{l=c}return{result:o,lgiDictFrame:new t({ctm:a.CTM,registration:a.Registration,projection:c,display:l,neatline:a.Neatline,mediaBox:y(n.MediaBox)})}}return{result:o}}function s(e,t){let n=l(e);try{let e=n[0],t=E(e);for(let r of n){let n=E(r);n>t&&(t=n,e=r)}return e}catch{return n[t]}}function c(e,t){return u(e)[t]}function l(e){return e==null?[]:Array.isArray(e)?e.map(e=>d(e)):[d(e)]}function u(e){return e==null?[]:Array.isArray(e)?e.map(e=>f(e)):[f(e)]}function d(e){let t=T(e,`LGIDict map frame must be an object.`);return{CTM:y(t.CTM),Registration:b(t.Registration),Neatline:y(t.Neatline),Projection:h(t.Projection),Display:h(t.Display)}}function f(e){let t=T(e,`Viewport frame must be an object.`),n=p(t.Measure);return{BBox:y(t.BBox),Measure_Raw:t.Measure,Measure:n,Raw:t}}function p(e){if(w(e))return{Bounds:y(e.Bounds),GPTS:y(e.GPTS),LPTS:y(e.LPTS),GCS:m(e.GCS)}}function m(e){if(w(e))return{WKT:x(e.WKT),EPSG:C(e.EPSG)}}function h(e){if(w(e))return{Type:S(e.Type),Units:S(e.Units),Datum:g(e.Datum),Projection_Type:S(e.ProjectionType),Central_Meridian:C(e.CentralMeridian),False_Easting:C(e.FalseEasting),False_Northing:C(e.FalseNorthing),Height:C(e.Height),Hemisphere:S(e.Hemisphere),Latitude_One:C(e.LatitudeOne),Latitude_Two:C(e.LatitudeTwo),Latitude_Of_True_Scale:C(e.LatitudeOfTrueScale),Longitude_One:C(e.LongitudeOne),Longitude_Two:C(e.LongitudeTwo),Longitude_Down_From_Pole:C(e.LongitudeDownFromPole),Orientation:S(e.Orientation),Origin_Height:C(e.OriginHeight),Origin_Latitude:C(e.OriginLatitude),Origin_Longitude:C(e.OriginLongitude),Scale_Factor:C(e.ScaleFactor),Standard_Parallel:C(e.StandardParallel),Standard_Parallel_One:C(e.StandardParallelOne),Standard_Parallel_Two:C(e.StandardParallelTwo),Zone:C(e.Zone),Description:S(e.Description),raw:e}}function g(e){return e==null?null:typeof e==`string`?{kind:`name`,name:S(e),ellipsoid:null,to_WGS84:null,raw:e}:w(e)?{kind:`definition`,name:S(e.Description),ellipsoid:_(e.Ellipsoid),to_WGS84:v(e.ToWGS84),raw:e}:{kind:`unknown`,name:S(e),ellipsoid:null,to_WGS84:null,raw:e}}function _(e){if(w(e))return{semi_Major_Axis:C(e.SemiMajorAxis),inverse_Flattening:C(e.InvFlattening),semi_Minor_Axis:C(e.SemiMinorAxis),description:S(e.Description)}}function v(e){if(w(e))return{dx:C(e.dx)??0,dy:C(e.dy)??0,dz:C(e.dz)??0,rx:C(e.rx)??0,ry:C(e.ry)??0,rz:C(e.rz)??0,sf:C(e.sf)??0}}function y(e){if(!Array.isArray(e))return;let t=[];for(let n of e){let e=C(n);if(e===void 0)return;t.push(e)}return t}function b(e){if(Array.isArray(e))return e.filter(e=>Array.isArray(e)).map(e=>e.map(e=>C(e)).filter(e=>e!==void 0))}function x(e){if(e!=null)return typeof e==`string`?e:String(e)}function S(e){let t=x(e);if(t!==void 0)return t.trim()}function C(e){if(e==null)return;if(typeof e==`number`)return Number.isFinite(e)?e:void 0;if(typeof e!=`string`)return;let t=e.trim();if(t===``)return;let n=Number(t);return Number.isFinite(n)?n:void 0}function w(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function T(t,n){if(!w(t))throw new e(`geospatial-pdf-layer:parse`,n);return t}function E(e){let t=e.Neatline;if(!t)return 0;let i=n(t),a=r(i);return(a.xmax-a.xmin)*(a.ymax-a.ymin)}export{o as parse};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{result as n}from"../../../core/asyncUtils.js";import r from"../../../core/Collection.js";import i from"../../../core/Error.js";import has from"../../../core/has.js";import{clone as a}from"../../../core/lang.js";import o from"../../../core/Logger.js";import{destroyMaybe as s,removeMaybe as c,abortMaybe as l}from"../../../core/maybe.js";import{EsriPromiseMixin as u}from"../../../core/Promise.js";import{createAbortError as d,isAbortError as f}from"../../../core/promiseUtils.js";import{initial as p,watch as m,syncAndInitial as h,sync as g}from"../../../core/reactiveUtils.js";import{sqlAnd as _}from"../../../core/sql.js";import{property as v,subclass as y}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as b}from"../../../core/support/UpdatingHandles.js";import{projectAsync as x}from"../../../geometry/projectionUtils.js";import{isHostedAgolService as S}from"../../support/arcgisLayerUrl.js";import{checkServiceCurrentUserSupport as C}from"../../support/featureLayerUtils.js";import{getEffectiveLayerCapabilities as w}from"../../support/layerUtils.js";import T from"../../../rest/support/StatisticDefinition.js";import{FeatureTileDescriptor as E,virtualSnapshotTileId as D,virtualDisplayFilterHighlightTileId as O}from"../../../views/3d/layers/support/FeatureTileDescriptor.js";import{FeatureTileFetcher3D as k}from"../../../views/3d/layers/support/FeatureTileFetcher3D.js";import{FeatureTileFetcher3DDebugger as A}from"../../../views/3d/layers/support/FeatureTileFetcher3DDebugger.js";import{debugFlags as j}from"../../../views/3d/support/debugFlags.js";let M=class extends u(t){get dataUpdating(){return this._tileFetcher?.dataUpdating??!1}set extent(e){if(e!=null&&!e.spatialReference.equals(this.layerView.view.spatialReference)){o.getLogger(this).error(`#extent=`,`extent needs to be in the same spatial reference as the view`);return}let t=this._get(`extent`);if(t===e||t!=null&&e&&t.equals(e))return;let n=e==null?null:e.clone();this._set(`extent`,n)}get updating(){return!!(this._tileFetcher?.updating||this._fetchDataInfoPromise!=null||this.mode===`tiles`&&this.layerView.view.featureTiles?.updating||this._updatingHandles?.updating)}get updatingTotal(){return this.updating&&this._tileFetcher!=null?this._tileFetcher.updatingTotal:0}get updatingRemaining(){return this.updating&&this._tileFetcher!=null?this._tileFetcher.updatingRemaining:0}get expectedFeatureDiff(){return this.updating&&this._tileFetcher!=null?this._tileFetcher.expectedFeatureDiff:0}get usedMemory(){return this._tileFetcher?.usedMemory??0}get usedMemoryPerFeature(){return this._tileFetcher?.usedMemoryPerFeature??0}get maximumNumberOfFeaturesExceeded(){return!!(this._tileFetcher!=null&&this._tileFetcher.maximumNumberOfFeaturesExceeded)}get snappingComplexityExceeded(){return this._tileFetcher?.snappingComplexityExceeded??!0}get maximumNumberOfFeatures(){return this.displayFeatureLimit?.maximumNumberOfFeatures??0}set maximumNumberOfFeatures(e){e!==this.maximumNumberOfFeatures&&this._overrideIfSome(`maximumNumberOfFeatures`,e)}get hasMaximumNumberOfFeaturesOverride(){return this._isOverridden(`maximumNumberOfFeatures`)}get hasAllFeatures(){return this.serviceDataCount===I.noServiceDataCount&&this.mode===`snapshot`&&this.hasAllFeaturesInView||this.serviceDataCount===this.graphics.length}get hasAllFeaturesInView(){let e=this.context.effectiveDisplayFilter?.where||null,t=e!=null&&e!==`1=1`;return this.mode===`tiles`&&t?!1:this._tileFetcher?.showsAllFeatures??!1}get hasFullGeometries(){return this._tileFetcher?.hasFullGeometries??!1}get mode(){let e=this.layerView.layer;if(e.type===`feature`&&e.infoFor3D!=null)return`snapshot`;if(e.type===`catalog-footprint`||this._forceTilesMode)return`tiles`;let t=this.layerView.view;if(t.qualitySettings?.graphics3D?.snapshotAvailable===!1||this.serviceDataCount===I.noServiceDataCount||this._snapshotLimitExceeded||this.maximumNumberOfFeaturesExceeded||t.quality<1)return`tiles`;let n=(t&&t.featureTiles)?.tilingScheme;if(e&&e.minScale&&this.serviceDataExtent&&n){let t=this._approximateExtentSizeAtScale(e.minScale,n);if((this.serviceDataExtent.width/t+this.serviceDataExtent.height/t)/2>I.maxSnapshotMinScaleFactor)return`tiles`}return!this.maximumNumberOfFeatures||this.serviceDataCount<=this.maximumNumberOfFeatures?`snapshot`:`tiles`}get maxTotalSnapshotVertices(){let e=this._get(`maxTotalSnapshotVertices`)||0,t=this.mode===`snapshot`&&this._tileFetcher?.totalVertices||0;return Math.max(e,t)}_approximateExtentSizeAtScale(e,t){let n=this.layerView.view,r=Math.ceil((n.width/t.pixelSize+n.height/t.pixelSize)/2),i=t.levels[0];return r*((i.tileSize[0]/(i.scale/e)+i.tileSize[1]/(i.scale/e))/2)}get tileDescriptors(){if(this.mode===`snapshot`){let e=new E(0,0,0,null,D);return new r([e])}let e=this.layerView.view.featureTiles;if(!e)return new r;let t=e.tiles;if(this.layerView.displayFilterEnabled&&this.layerView.effectiveDisplayFilterClause!=null&&this.layerView.effectiveDisplayFilterClause!==`1=1`&&this.layerView.highlightIds?.length>0){let e=new E(0,0,0,this.layerView.view.featureTiles?.tilingScheme,O);return new r([...t,e])}return t}get test(){}constructor(e){super(e),this.type=`feature-tile-3d`,this._updatingHandles=new b,this.serviceDataExtent=null,this.serviceDataCount=I.noServiceDataCount,this._snapshotLimitExceeded=!1,this.displayFeatureLimit=null,this._forceTilesMode=!1,this._suspended=!1,this._tileFetcher=null,this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null,this._lifeCycleAbortController=new AbortController}initialize(){this._updatingHandles.add(()=>this.displayFeatureLimit,e=>this._updatingHandles.addPromise(this._updateSnapshotLimit(e,null,this._lifeCycleAbortController.signal))),this._updatingHandles.add(()=>this.mode,()=>this._modeChanged(),p),this._updatingHandles.add(()=>this.mode,(e,t)=>{e===`tiles`&&t===`snapshot`&&(this._forceTilesMode=!0)},p),this.addResolvingPromise(Promise.resolve().then(()=>this._verifyCapabilities()).then(()=>this._updatingHandles.addPromise(this._fetchServiceDataInfo())).then(()=>this._initializeTileFetcher()))}_verifyCapabilities(){let e=this.layerView.layer;if(e.type!==`ogc-feature`&&!w(e)?.operations.supportsQuery)throw new i(`graphicscontroller:query-capability-required`,`Service requires query capabilities to be used as a feature layer`,{layer:e})}destroy(){this._cancelFetchServiceDataInfo(),this._tileFetcher=s(this._tileFetcher),this._tilesHandle=c(this._tilesHandle),this._lifeCycleAbortController=l(this._lifeCycleAbortController),this._updatingHandles.destroy(),this._set(`_updatingHandles`,null)}suspend(){this._suspended||(this._suspended=!0,this._tileFetcher!=null&&this._tileFetcher.suspend())}resume(){this._suspended&&(this._suspended=!1,this._tileFetcher!=null&&this._tileFetcher.resume())}restart(){let e=()=>{this._tileFetcher!=null&&this._tileFetcher.restart()};this._updatingHandles.consumePromise(this._fetchServiceDataInfo().then(e,e))}refetch(){this._refetch({resetForceTilesMode:!1})}getMissingAttributesForFeature(e){return this._tileFetcher?.getMissingAttributesForFeature(e)}_refetch(e){let t=()=>{this._tileFetcher!=null&&(e.resetForceTilesMode&&(this._forceTilesMode=!1),this._tileFetcher.refetch())};this._updatingHandles.consumePromise(this._fetchServiceDataInfo().then(t,t))}_initializeTileFetcher(){let e=this.layerView.view;if(!e)return;let{layerView:t,tileDescriptors:n}=this,r=t.layer,i=new k({context:this.context,filterExtent:this.extent,tileDescriptors:n,features:this.graphics});this._tileFetcher=i,this._suspended?i.suspend():i.resume(),e&&this.addHandles(m(()=>e.quality,e=>i.memoryFactor=e,h));let a=this.context.geometryType===`polygon`?`polygonLodFactor`:this.context.geometryType===`polyline`?`polylineLodFactor`:null;a&&this.addHandles(m(()=>this.layerView.view?.qualitySettings?.graphics3D?.[a],e=>i.lodFactor=e||1,p)),r.type!==`ogc-feature`&&this._updatingHandles.add(()=>r.createQueryVersion,()=>this._dataFilterChanged()),this._updatingHandles.add(()=>this.layerView.effectiveDisplayFilter,()=>this._effectiveDisplayFilterChanged()),this._updatingHandles.add(()=>this.layerView.highlightIds,()=>this._displayFilterHighlightIdsChanged()),this._updatingHandles.add(()=>t.availableFields,(e,t)=>this._availableFieldsChanged(t,e)),this._updatingHandles.add(()=>t.requiredFields,(e,t)=>this._requiredFieldsChanged(t,e)),`customParameters`in r&&this._updatingHandles.add(()=>r.customParameters,()=>this.restart()),this.addHandles([r.on(`apply-edits`,e=>this._applyEdits(e)),m(()=>this.extent,e=>i.filterExtent=e,g),m(()=>this.tileDescriptors,e=>i.tileDescriptors=e,g),m(()=>this.maximumNumberOfFeatures,e=>{i.maximumNumberOfFeatures=e,i.useTileCount=this.serviceDataCount>e},h),m(()=>this.serviceDataCount,e=>{i.useTileCount=e>this.maximumNumberOfFeatures},h),m(()=>({featureTiles:e.featureTiles,show:j.FEATURE_TILE_FETCH_SHOW_TILES}),({show:t,featureTiles:n})=>{t&&i&&n?i.debugger??=new A(i,n.tilingScheme.toTileInfo(),e):i.debugger=s(i.debugger)},p)]),this._supportsExceedsLimitQuery||this._updatingHandles.add(()=>this.maxTotalSnapshotVertices,()=>this._updatingHandles.addPromise(this._updateSnapshotLimit(this.displayFeatureLimit,null,this._lifeCycleAbortController.signal)))}_modeChanged(){switch(this.mode){case`tiles`:this._tilesHandle||=this.layerView.view.enableFeatureTiles();break;default:o.getLogger(this).warn(`Unhandled feature layer mode `+this.mode);case`snapshot`:this._tilesHandle!=null&&(this._tilesHandle.remove(),this._tilesHandle=null)}}_dataFilterChanged(){this._set(`maxTotalSnapshotVertices`,0),this.notifyChange(`maxTotalSnapshotVertices`),this._refetch({resetForceTilesMode:!0})}_effectiveDisplayFilterChanged(){this.mode!==`snapshot`&&this._refetch({resetForceTilesMode:!1})}_displayFilterHighlightIdsChanged(){this.mode!==`snapshot`&&this._tileFetcher!=null&&this._tileFetcher.refetchDisplayFilterHighlightTile()}_applyEdits(e){let t=this.layerView.layer;this._tileFetcher!=null&&this._tileFetcher.applyEdits(e).then(e=>{if(e){if(!this._lifeCycleAbortController)throw d();e.exceededTransferLimit&&`refresh`in t?t.refresh():(e.deletedFeatures.length||e.updatedFeatures.length||e.addedFeatures.length)&&this._updatingHandles.consumePromise(this._updateServiceDataExtent(this._lifeCycleAbortController.signal))}}).catch(e=>{if(!f(e))throw e})}_availableFieldsChanged(e,t){this._tileFetcher!=null&&F(this._tileFetcher.availableFields,t)&&this._refetch({resetForceTilesMode:!1})}_requiredFieldsChanged(e,t){this._tileFetcher!=null&&F(this._tileFetcher.availableFields,t)&&this.restart()}_createVertexLimitExceededQuery(e){let t=this.layerView.layer,n=t.createQuery();return n.returnGeometry=!1,n.outStatistics=[new T({statisticType:`exceedslimit`,maxVertexCount:e,outStatisticFieldName:`exceedslimit`,maxPointCount:1e8,maxRecordCount:1e8})],t.capabilities?.query.supportsCacheHint&&(n.cacheHint=!0),n}_createDataInfoQuery(){let e=this.layerView.layer,t=this.layerView,n=e.createQuery();return n.returnGeometry=!1,n.outSpatialReference=this.layerView.view.spatialReference,e.capabilities?.query.supportsCacheHint&&(n.cacheHint=!0),t.effectiveDisplayFilter&&(n.where=_(n.where,t.effectiveDisplayFilter.where)),n}_fullExtentIsAccurate(){let e=this.layerView.layer;if(`definitionExpression`in e&&e.definitionExpression)return!1;switch(e.type){case`feature`:case`catalog-footprint`:case`oriented-imagery`:return S(e.url);case`csv`:case`geojson`:case`ogc-feature`:case`wfs`:return!0;default:return}}async _updateServiceDataExtent(e){try{await this._tryUpdateServiceDataExtent(e)}catch(e){f(e)||this._set(`serviceDataExtent`,a(this.layerView.fullExtentInLocalViewSpatialReference)??null)}}async _tryUpdateServiceDataExtent(e){let t=this.layerView,n=t.layer,r=n.capabilities?.query.supportsExtent??!1,i=a(t.fullExtentInLocalViewSpatialReference),o=n.fullExtent,s=this._fullExtentIsAccurate(),c=this.serviceDataCount;if(r&&c<=I.maxFeatureCountForExtent&&(!i||!s)&&`queryExtent`in n){let t=this._createDataInfoQuery(),r=await n.queryExtent(t,{timeout:I.queryExtentTimeout,signal:e});this._set(`serviceDataExtent`,r.extent)}else if(i)this._set(`serviceDataExtent`,i);else if(o!=null){let e=o.spatialReference?await x(o,t.view.spatialReference):null;this._set(`serviceDataExtent`,e??null)}else this._set(`serviceDataExtent`,null)}async _updateServiceDataCount(e){let t=this.layerView.layer;if(!(`queryFeatureCount`in t)||!has(`featurelayer-snapshot-enabled`)){this._set(`serviceDataCount`,I.noServiceDataCount);return}let r=await n(t.queryFeatureCount(this._createDataInfoQuery(),{timeout:I.queryStatisticsTimeout,signal:e}));if(r.ok===!0)this._set(`serviceDataCount`,r.value);else{if(f(r.error))throw r.error;this._set(`serviceDataCount`,I.noServiceDataCount)}}get _supportsExceedsLimitQuery(){let e=this.layerView.layer;return e.capabilities!=null&&e.capabilities.operations&&e.capabilities.operations.supportsExceedsLimitStatistics}get _minimumNumberOfVerticesForGeometry(){switch(this.layerView.layer.geometryType){case`point`:return 1;case`multipoint`:return 1;case`polygon`:return 4;case`polyline`:return 2;case`multipatch`:case`mesh`:return 3;case null:case void 0:return 0;default:return 0}}async _updateSnapshotLimit(e,t,r){if(e?.averageSymbolComplexity==null){this._snapshotLimitExceeded=!1;return}let{maximumTotalNumberOfVertices:i,averageSymbolComplexity:a}=e,{verticesPerFeature:o,verticesPerCoordinate:s}=a,c=o<=0,l=this._minimumNumberOfVerticesForGeometry>1;if(!c&&!l){this._snapshotLimitExceeded=!1;return}o!==0&&t!=null&&await t;let u=Math.min(i,N),d=this.serviceDataCount,p=d!==I.noServiceDataCount,m=Math.ceil(p?(u-d*o)/(s||1):u/(s||1));if(l&&(m=Math.min(m,P)),p&&this._minimumNumberOfVerticesForGeometry*d>m){this._snapshotLimitExceeded=!0;return}if(!this._supportsExceedsLimitQuery||!has(`featurelayer-snapshot-enabled`)){this._snapshotLimitExceeded=this.maxTotalSnapshotVertices>m;return}let h=await n(this.layerView.layer.queryFeatures(this._createVertexLimitExceededQuery(m),{timeout:I.queryStatisticsTimeout,signal:r}));if(h.ok===!1){if(f(h.error))throw h.error;this._snapshotLimitExceeded=!1;return}let g=h.value.features[0];this._snapshotLimitExceeded=g?.attributes?!!g.attributes.exceedslimit:!1}async _fetchServiceDataInfo(){this._cancelFetchServiceDataInfo(),await C(this.layerView.layer);let e=new AbortController,t=e.signal,n=this._updateServiceDataCount(t),r=Promise.allSettled([n,this._updateSnapshotLimit(this.displayFeatureLimit,n,t)]),i=r.then(()=>this._updateServiceDataExtent(t)).catch(e=>{f(e)||o.getLogger(this).error(`#fetchServiceDataInfo()`,e)}).then(()=>{i===this._fetchDataInfoPromise&&(this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null),e=null});return e&&(this._fetchDataInfoPromise=i),this._fetchDataInfoAbortController=e,r.then(()=>{},()=>{})}_cancelFetchServiceDataInfo(){let e=this._fetchDataInfoAbortController;e&&(this._fetchDataInfoAbortController=null,this._fetchDataInfoPromise=null,e.abort())}get performanceInfo(){return{storedFeatures:this._tileFetcher?.storedFeatures??0,totalFeatures:this._tileFetcher?.totalFeatures??0,totalVertices:this._tileFetcher?.totalVertices??0,missingTiles:this._tileFetcher?.missingTiles??0}}};e([v({readOnly:!0})],M.prototype,`type`,void 0),e([v({constructOnly:!0})],M.prototype,`graphics`,void 0),e([v({constructOnly:!0})],M.prototype,`layerView`,void 0),e([v({constructOnly:!0})],M.prototype,`context`,void 0),e([v({readOnly:!0})],M.prototype,`dataUpdating`,null),e([v()],M.prototype,`extent`,null),e([v()],M.prototype,`updating`,null),e([v({readOnly:!0})],M.prototype,`_updatingHandles`,void 0),e([v()],M.prototype,`updatingTotal`,null),e([v()],M.prototype,`updatingRemaining`,null),e([v()],M.prototype,`expectedFeatureDiff`,null),e([v()],M.prototype,`usedMemory`,null),e([v()],M.prototype,`usedMemoryPerFeature`,null),e([v()],M.prototype,`maximumNumberOfFeaturesExceeded`,null),e([v()],M.prototype,`snappingComplexityExceeded`,null),e([v({readOnly:!0})],M.prototype,`serviceDataExtent`,void 0),e([v({readOnly:!0})],M.prototype,`serviceDataCount`,void 0),e([v()],M.prototype,`_snapshotLimitExceeded`,void 0),e([v()],M.prototype,`displayFeatureLimit`,void 0),e([v({type:Number})],M.prototype,`maximumNumberOfFeatures`,null),e([v({readOnly:!0})],M.prototype,`hasAllFeatures`,null),e([v({readOnly:!0})],M.prototype,`hasAllFeaturesInView`,null),e([v({readOnly:!0})],M.prototype,`hasFullGeometries`,null),e([v()],M.prototype,`_forceTilesMode`,void 0),e([v({readOnly:!0})],M.prototype,`mode`,null),e([v({readOnly:!0})],M.prototype,`maxTotalSnapshotVertices`,null),e([v({readOnly:!0})],M.prototype,`tileDescriptors`,null),e([v()],M.prototype,`_tileFetcher`,void 0),e([v()],M.prototype,`_fetchDataInfoPromise`,void 0),M=e([y(`esri.layers.graphics.controllers.FeatureTileController3D`)],M);const N=1e6,P=5e6;function F(e,t){if(!t)return!1;for(let n of t)if(!e.has(n))return!0;return!1}class I{static{this.noServiceDataCount=1/0}static{this.maxSnapshotMinScaleFactor=5}static reset(){I.maxFeatureCountForExtent=1e4,I.queryStatisticsTimeout=12e3,I.queryExtentTimeout=1e4}}I.reset();export{M as FeatureTileController3D,I as FeatureTileController3DConstants};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{result as n}from"../../../core/asyncUtils.js";import r from"../../../core/Collection.js";import i from"../../../core/Error.js";import has from"../../../core/has.js";import{clone as a}from"../../../core/lang.js";import o from"../../../core/Logger.js";import{destroyMaybe as s,removeMaybe as c,abortMaybe as l}from"../../../core/maybe.js";import{EsriPromiseMixin as u}from"../../../core/Promise.js";import{createAbortError as d,isAbortError as f}from"../../../core/promiseUtils.js";import{initial as p,watch as m,syncAndInitial as h,sync as g}from"../../../core/reactiveUtils.js";import{sqlAnd as _}from"../../../core/sql.js";import{property as v,subclass as y}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as b}from"../../../core/support/UpdatingHandles.js";import{projectAsync as x}from"../../../geometry/projectionUtils.js";import{isHostedAgolService as S}from"../../support/arcgisLayerUrl.js";import{checkServiceCurrentUserSupport as C}from"../../support/featureLayerUtils.js";import{getEffectiveLayerCapabilities as w}from"../../support/layerUtils.js";import T from"../../../rest/support/StatisticDefinition.js";import{FeatureTileDescriptor as E,virtualSnapshotTileId as D,virtualDisplayFilterHighlightTileId as O}from"../../../views/3d/layers/support/FeatureTileDescriptor.js";import{FeatureTileFetcher3D as k}from"../../../views/3d/layers/support/FeatureTileFetcher3D.js";import{FeatureTileFetcher3DDebugger as A}from"../../../views/3d/layers/support/FeatureTileFetcher3DDebugger.js";import{debugFlags as j}from"../../../views/3d/support/debugFlags.js";let M=class extends u(t){get dataUpdating(){return this._tileFetcher?.dataUpdating??!1}set extent(e){if(e!=null&&!e.spatialReference.equals(this.layerView.view.spatialReference)){o.getLogger(this).error(`#extent=`,`extent needs to be in the same spatial reference as the view`);return}let t=this._get(`extent`);if(t===e||t!=null&&e&&t.equals(e))return;let n=e==null?null:e.clone();this._set(`extent`,n)}get updating(){return!!(this._tileFetcher?.updating||this._fetchDataInfoPromise!=null||this.mode===`tiles`&&this.layerView.view.featureTiles?.updating||this._updatingHandles?.updating)}get updatingTotal(){return this.updating&&this._tileFetcher!=null?this._tileFetcher.updatingTotal:0}get updatingRemaining(){return this.updating&&this._tileFetcher!=null?this._tileFetcher.updatingRemaining:0}get expectedFeatureDiff(){return this.updating&&this._tileFetcher!=null?this._tileFetcher.expectedFeatureDiff:0}get usedMemory(){return this._tileFetcher?.usedMemory??0}get usedMemoryPerFeature(){return this._tileFetcher?.usedMemoryPerFeature??0}get maximumNumberOfFeaturesExceeded(){return!!(this._tileFetcher!=null&&this._tileFetcher.maximumNumberOfFeaturesExceeded)}get snappingComplexityExceeded(){return this._tileFetcher?.snappingComplexityExceeded??!0}get maximumNumberOfFeatures(){return this.displayFeatureLimit?.maximumNumberOfFeatures??0}set maximumNumberOfFeatures(e){e!==this.maximumNumberOfFeatures&&this._overrideIfSome(`maximumNumberOfFeatures`,e)}get hasMaximumNumberOfFeaturesOverride(){return this._isOverridden(`maximumNumberOfFeatures`)}get hasAllFeatures(){return this.serviceDataCount===I.noServiceDataCount&&this.mode===`snapshot`&&this.hasAllFeaturesInView||this.serviceDataCount===this.graphics.length}get hasAllFeaturesInView(){let e=this.context.effectiveDisplayFilter?.where||null,t=e!=null&&e!==`1=1`;return this.mode===`tiles`&&t?!1:this._tileFetcher?.showsAllFeatures??!1}get hasFullGeometries(){return this._tileFetcher?.hasFullGeometries??!1}get mode(){let e=this.layerView.layer;if(e.type===`feature`&&e.infoFor3D!=null)return`snapshot`;if(e.type===`catalog-footprint`||this._forceTilesMode)return`tiles`;let t=this.layerView.view;if(t.qualitySettings?.graphics3D?.snapshotAvailable===!1||this.serviceDataCount===I.noServiceDataCount||this._snapshotLimitExceeded||this.maximumNumberOfFeaturesExceeded||t.quality<1)return`tiles`;let n=(t&&t.featureTiles)?.tilingScheme;if(e&&e.minScale&&this.serviceDataExtent&&n){let t=this._approximateExtentSizeAtScale(e.minScale,n);if((this.serviceDataExtent.width/t+this.serviceDataExtent.height/t)/2>I.maxSnapshotMinScaleFactor)return`tiles`}return!this.maximumNumberOfFeatures||this.serviceDataCount<=this.maximumNumberOfFeatures?`snapshot`:`tiles`}get maxTotalSnapshotVertices(){let e=this._get(`maxTotalSnapshotVertices`)||0,t=this.mode===`snapshot`&&this._tileFetcher?.totalVertices||0;return Math.max(e,t)}_approximateExtentSizeAtScale(e,t){let n=this.layerView.view,r=Math.ceil((n.width/t.pixelSize+n.height/t.pixelSize)/2),i=t.levels[0];return r*((i.tileSize[0]/(i.scale/e)+i.tileSize[1]/(i.scale/e))/2)}get tileDescriptors(){if(this.mode===`snapshot`){let e=new E(0,0,0,null,D);return new r([e])}let e=this.layerView.view.featureTiles;if(!e)return new r;let t=e.tiles;if(this.layerView.displayFilterEnabled&&this.layerView.effectiveDisplayFilterClause!=null&&this.layerView.effectiveDisplayFilterClause!==`1=1`&&this.layerView.highlightIds?.length>0){let e=new E(0,0,0,this.layerView.view.featureTiles?.tilingScheme,O);return new r([...t,e])}return t}get test(){}constructor(e){super(e),this.type=`feature-tile-3d`,this._updatingHandles=new b,this.serviceDataExtent=null,this.serviceDataCount=I.noServiceDataCount,this._snapshotLimitExceeded=!1,this.displayFeatureLimit=null,this._forceTilesMode=!1,this._suspended=!1,this._tileFetcher=null,this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null,this._lifeCycleAbortController=new AbortController}initialize(){this._updatingHandles.add(()=>this.displayFeatureLimit,e=>this._updatingHandles.addPromise(this._updateSnapshotLimit(e,null,this._lifeCycleAbortController.signal))),this._updatingHandles.add(()=>this.mode,()=>this._modeChanged(),p),this._updatingHandles.add(()=>this.mode,(e,t)=>{e===`tiles`&&t===`snapshot`&&(this._forceTilesMode=!0)},p),this.addResolvingPromise(Promise.resolve().then(()=>this._verifyCapabilities()).then(()=>this._updatingHandles.addPromise(this._fetchServiceDataInfo())).then(()=>this._initializeTileFetcher()))}_verifyCapabilities(){let e=this.layerView.layer;if(e.type!==`ogc-feature`&&!w(e)?.operations.supportsQuery)throw new i(`graphicscontroller:query-capability-required`,`Service requires query capabilities to be used as a feature layer`,{layer:e})}destroy(){this._cancelFetchServiceDataInfo(),this._tileFetcher=s(this._tileFetcher),this._tilesHandle=c(this._tilesHandle),this._lifeCycleAbortController=l(this._lifeCycleAbortController),this._updatingHandles.destroy(),this._set(`_updatingHandles`,null)}suspend(){this._suspended||(this._suspended=!0,this._tileFetcher!=null&&this._tileFetcher.suspend())}resume(){this._suspended&&(this._suspended=!1,this._tileFetcher!=null&&this._tileFetcher.resume())}restart(){let e=()=>{this._tileFetcher!=null&&this._tileFetcher.restart()};this._updatingHandles.consumePromise(this._fetchServiceDataInfo().then(e,e))}refetch(){this._refetch({resetForceTilesMode:!1})}getMissingAttributesForFeature(e){return this._tileFetcher?.getMissingAttributesForFeature(e)}_refetch(e){let t=()=>{this._tileFetcher!=null&&(e.resetForceTilesMode&&(this._forceTilesMode=!1),this._tileFetcher.refetch())};this._updatingHandles.consumePromise(this._fetchServiceDataInfo().then(t,t))}_initializeTileFetcher(){let e=this.layerView.view;if(!e)return;let{layerView:t,tileDescriptors:n}=this,r=t.layer,i=new k({context:this.context,filterExtent:this.extent,tileDescriptors:n,features:this.graphics});this._tileFetcher=i,this._suspended?i.suspend():i.resume(),e&&this.addHandles(m(()=>e.quality,e=>i.memoryFactor=e,h));let a=this.context.geometryType===`polygon`?`polygonLodFactor`:this.context.geometryType===`polyline`?`polylineLodFactor`:null;a&&this.addHandles(m(()=>this.layerView.view?.qualitySettings?.graphics3D?.[a],e=>i.lodFactor=e||1,p)),r.type!==`ogc-feature`&&this._updatingHandles.add(()=>r.createQueryVersion,()=>this._dataFilterChanged()),this._updatingHandles.add(()=>this.layerView.effectiveDisplayFilter,()=>this._effectiveDisplayFilterChanged()),this._updatingHandles.add(()=>this.layerView.highlightIds,()=>this._displayFilterHighlightIdsChanged()),this._updatingHandles.add(()=>t.availableFields,(e,t)=>this._availableFieldsChanged(t,e)),this._updatingHandles.add(()=>t.requiredFields,(e,t)=>this._requiredFieldsChanged(t,e)),`customParameters`in r&&this._updatingHandles.add(()=>r.customParameters,()=>this.restart()),this.addHandles([r.on(`apply-edits`,e=>this._applyEdits(e)),m(()=>this.extent,e=>i.filterExtent=e,g),m(()=>this.tileDescriptors,e=>i.tileDescriptors=e,g),m(()=>this.maximumNumberOfFeatures,e=>{i.maximumNumberOfFeatures=e,i.useTileCount=this.serviceDataCount>e},h),m(()=>this.serviceDataCount,e=>{i.useTileCount=e>this.maximumNumberOfFeatures},h),m(()=>({featureTiles:e.featureTiles,show:j.FEATURE_TILE_FETCH_SHOW_TILES}),({show:t,featureTiles:n})=>{t&&i&&n?i.debugger??=new A(i,n.tilingScheme.toTileInfo(),e):i.debugger=s(i.debugger)},p)]),this._supportsExceedsLimitQuery||this._updatingHandles.add(()=>this.maxTotalSnapshotVertices,()=>this._updatingHandles.addPromise(this._updateSnapshotLimit(this.displayFeatureLimit,null,this._lifeCycleAbortController.signal)))}_modeChanged(){switch(this.mode){case`tiles`:this._tilesHandle||=this.layerView.view.enableFeatureTiles();break;default:o.getLogger(this).warn(`Unhandled feature layer mode `+this.mode);case`snapshot`:this._tilesHandle!=null&&(this._tilesHandle.remove(),this._tilesHandle=null)}}_dataFilterChanged(){this._set(`maxTotalSnapshotVertices`,0),this.notifyChange(`maxTotalSnapshotVertices`),this._refetch({resetForceTilesMode:!0})}_effectiveDisplayFilterChanged(){this.mode!==`snapshot`&&this._refetch({resetForceTilesMode:!1})}_displayFilterHighlightIdsChanged(){this.mode!==`snapshot`&&this._tileFetcher!=null&&this._tileFetcher.refetchDisplayFilterHighlightTile()}_applyEdits(e){let t=this.layerView.layer;this._tileFetcher!=null&&this._tileFetcher.applyEdits(e).then(e=>{if(e){if(!this._lifeCycleAbortController)throw d();e.exceededTransferLimit&&`refresh`in t?t.refresh():(e.deletedFeatures.length||e.updatedFeatures.length||e.addedFeatures.length)&&this._updatingHandles.consumePromise(this._updateServiceDataExtent(this._lifeCycleAbortController.signal))}}).catch(e=>{if(!f(e))throw e})}_availableFieldsChanged(e,t){this._tileFetcher!=null&&F(this._tileFetcher.availableFields,t)&&this._refetch({resetForceTilesMode:!1})}_requiredFieldsChanged(e,t){this._tileFetcher!=null&&F(this._tileFetcher.availableFields,t)&&this.restart()}_createVertexLimitExceededQuery(e){let t=this.layerView.layer,n=t.createQuery();return n.returnGeometry=!1,n.outStatistics=[new T({statisticType:`exceedslimit`,maxVertexCount:e,outStatisticFieldName:`exceedslimit`,maxPointCount:1e8,maxRecordCount:1e8})],t.capabilities?.query.supportsCacheHint&&(n.cacheHint=!0),n}_createDataInfoQuery(){let e=this.layerView.layer,t=this.layerView,n=e.createQuery();return n.returnGeometry=!1,n.outSpatialReference=this.layerView.view.spatialReference,e.capabilities?.query.supportsCacheHint&&(n.cacheHint=!0),t.effectiveDisplayFilter&&(n.where=_(n.where,t.effectiveDisplayFilter.where)),n}_fullExtentIsAccurate(){let e=this.layerView.layer;if(`definitionExpression`in e&&e.definitionExpression)return!1;switch(e.type){case`feature`:case`catalog-footprint`:case`oriented-imagery`:return S(e.url);case`csv`:case`geojson`:case`ogc-feature`:case`wfs`:return!0;default:return}}async _updateServiceDataExtent(e){try{await this._tryUpdateServiceDataExtent(e)}catch(e){f(e)||this._set(`serviceDataExtent`,a(this.layerView.fullExtentInLocalViewSpatialReference)??null)}}async _tryUpdateServiceDataExtent(e){let t=this.layerView,n=t.layer,r=n.capabilities?.query.supportsExtent??!1,i=a(t.fullExtentInLocalViewSpatialReference),o=n.fullExtent,s=this._fullExtentIsAccurate(),c=this.serviceDataCount;if(r&&c<=I.maxFeatureCountForExtent&&(!i||!s)&&`queryExtent`in n){let t=this._createDataInfoQuery(),r=await n.queryExtent(t,{timeout:I.queryExtentTimeout,signal:e});this._set(`serviceDataExtent`,r.extent)}else if(i)this._set(`serviceDataExtent`,i);else if(o!=null){let e=o.spatialReference?await x(o,t.view.spatialReference):null;this._set(`serviceDataExtent`,e??null)}else this._set(`serviceDataExtent`,null)}async _updateServiceDataCount(e){let t=this.layerView.layer;if(!(`queryFeatureCount`in t)||!has(`featurelayer-snapshot-enabled`)){this._set(`serviceDataCount`,I.noServiceDataCount);return}let r=await n(t.queryFeatureCount(this._createDataInfoQuery(),{timeout:I.queryStatisticsTimeout,signal:e}));if(r.ok===!0)this._set(`serviceDataCount`,r.value);else{if(f(r.error))throw r.error;this._set(`serviceDataCount`,I.noServiceDataCount)}}get _supportsExceedsLimitQuery(){let e=this.layerView.layer;return e.capabilities!=null&&e.capabilities.operations&&e.capabilities.operations.supportsExceedsLimitStatistics}get _minimumNumberOfVerticesForGeometry(){switch(this.layerView.layer.geometryType){case`point`:return 1;case`multipoint`:return 1;case`polygon`:return 4;case`polyline`:return 2;case`multipatch`:case`mesh`:return 3;case null:case void 0:return 0;default:return 0}}async _updateSnapshotLimit(e,t,r){if(e?.averageSymbolComplexity==null){this._snapshotLimitExceeded=!1;return}let{maximumTotalNumberOfVertices:i,averageSymbolComplexity:a}=e,{verticesPerFeature:o,verticesPerCoordinate:s}=a,c=o<=0,l=this._minimumNumberOfVerticesForGeometry>1;if(!c&&!l){this._snapshotLimitExceeded=!1;return}o!==0&&t!=null&&await t;let u=Math.min(i,N),d=this.serviceDataCount,p=d!==I.noServiceDataCount,m=Math.ceil(p?(u-d*o)/(s||1):u/(s||1));if(l&&(m=Math.min(m,P)),p&&this._minimumNumberOfVerticesForGeometry*d>m){this._snapshotLimitExceeded=!0;return}if(!this._supportsExceedsLimitQuery||!has(`featurelayer-snapshot-enabled`)){this._snapshotLimitExceeded=this.maxTotalSnapshotVertices>m;return}let h=await n(this.layerView.layer.queryFeatures(this._createVertexLimitExceededQuery(m),{timeout:I.queryStatisticsTimeout,signal:r}));if(h.ok===!1){if(f(h.error))throw h.error;this._snapshotLimitExceeded=!1;return}let g=h.value.features[0];this._snapshotLimitExceeded=g?.attributes?!!g.attributes.exceedslimit:!1}async _fetchServiceDataInfo(){this._cancelFetchServiceDataInfo(),await C(this.layerView.layer);let e=new AbortController,t=e.signal,n=this._updateServiceDataCount(t),r=Promise.allSettled([n,this._updateSnapshotLimit(this.displayFeatureLimit,n,t)]),i=r.then(()=>this._updateServiceDataExtent(t)).catch(e=>{f(e)||o.getLogger(this).error(`#fetchServiceDataInfo()`,e)}).then(()=>{i===this._fetchDataInfoPromise&&(this._fetchDataInfoPromise=null,this._fetchDataInfoAbortController=null),e=null});return e&&(this._fetchDataInfoPromise=i),this._fetchDataInfoAbortController=e,r.then(()=>{},()=>{})}_cancelFetchServiceDataInfo(){let e=this._fetchDataInfoAbortController;e&&(this._fetchDataInfoAbortController=null,this._fetchDataInfoPromise=null,e.abort())}get performanceInfo(){return{storedFeatures:this._tileFetcher?.storedFeatures??0,totalFeatures:this._tileFetcher?.totalFeatures??0,totalVertices:this._tileFetcher?.totalVertices??0,missingTiles:this._tileFetcher?.missingTiles??0}}};e([v({readOnly:!0})],M.prototype,`type`,void 0),e([v({constructOnly:!0})],M.prototype,`graphics`,void 0),e([v({constructOnly:!0})],M.prototype,`layerView`,void 0),e([v({constructOnly:!0})],M.prototype,`context`,void 0),e([v({readOnly:!0})],M.prototype,`dataUpdating`,null),e([v()],M.prototype,`extent`,null),e([v()],M.prototype,`updating`,null),e([v({readOnly:!0})],M.prototype,`_updatingHandles`,void 0),e([v()],M.prototype,`updatingTotal`,null),e([v()],M.prototype,`updatingRemaining`,null),e([v()],M.prototype,`expectedFeatureDiff`,null),e([v()],M.prototype,`usedMemory`,null),e([v()],M.prototype,`usedMemoryPerFeature`,null),e([v()],M.prototype,`maximumNumberOfFeaturesExceeded`,null),e([v()],M.prototype,`snappingComplexityExceeded`,null),e([v({readOnly:!0})],M.prototype,`serviceDataExtent`,void 0),e([v({readOnly:!0})],M.prototype,`serviceDataCount`,void 0),e([v()],M.prototype,`_snapshotLimitExceeded`,void 0),e([v()],M.prototype,`displayFeatureLimit`,void 0),e([v({type:Number})],M.prototype,`maximumNumberOfFeatures`,null),e([v({readOnly:!0})],M.prototype,`hasAllFeatures`,null),e([v({readOnly:!0})],M.prototype,`hasAllFeaturesInView`,null),e([v({readOnly:!0})],M.prototype,`hasFullGeometries`,null),e([v()],M.prototype,`_forceTilesMode`,void 0),e([v({readOnly:!0})],M.prototype,`mode`,null),e([v({readOnly:!0})],M.prototype,`maxTotalSnapshotVertices`,null),e([v({readOnly:!0})],M.prototype,`tileDescriptors`,null),e([v()],M.prototype,`_tileFetcher`,void 0),e([v()],M.prototype,`_fetchDataInfoPromise`,void 0),M=e([y(`esri.layers.graphics.controllers.FeatureTileController3D`)],M);const N=has(`esri-tests-maximum-vertices-for-snapshot`)??1e6,P=5e6;function F(e,t){if(!t)return!1;for(let n of t)if(!e.has(n))return!0;return!1}class I{static{this.noServiceDataCount=1/0}static{this.maxSnapshotMinScaleFactor=5}static reset(){I.maxFeatureCountForExtent=1e4,I.queryStatisticsTimeout=12e3,I.queryExtentTimeout=1e4}}I.reset();export{M as FeatureTileController3D,I as FeatureTileController3DConstants};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import has from"../../../core/has.js";import n from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import i from"../../../core/PooledArray.js";import{EsriPromiseMixin as a}from"../../../core/Promise.js";import{isAbortError as o}from"../../../core/promiseUtils.js";import{watch as s,sync as c,initial as l}from"../../../core/reactiveUtils.js";import{property as u,subclass as d}from"../../../core/accessorSupport/decorators.js";import{runUntracked as f}from"../../../core/accessorSupport/tracking.js";import{exactEquals as p}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{UpdatingHandles as m}from"../../../core/support/UpdatingHandles.js";import{projectBoundingRect as h}from"../../../geometry/projection/projectBoundingRect.js";import{create as g}from"../../../geometry/support/aaBoundingRect.js";import{viewingModeFromString as _}from"../../../views/ViewingMode.js";import{I3SClientNodeLoader as v}from"../../../views/3d/layers/i3s/I3SClientNodeLoader.js";import{I3SDataRequester as y}from"../../../views/3d/layers/i3s/I3SDataRequester.js";import{addCallback as b}from"../../../views/3d/layers/i3s/I3SFrameTask.js";import{I3SIndex as x}from"../../../views/3d/layers/i3s/I3SIndex.js";import S from"../../../views/3d/layers/i3s/I3SLodHandling.js";import C from"../../../views/3d/layers/i3s/I3SNodeLoader.js";import{getVertexCrs as w,getIndexCrs as T,findIntersectingNodes as E}from"../../../views/3d/layers/i3s/I3SUtil.js";import D from"../../../views/3d/layers/i3s/I3SViewportQueries.js";import{toBoundingRect as O}from"../../../views/3d/support/extentUtils.js";import{minQuality as k}from"../../../views/3d/support/MemoryController.js";import{PromiseQueue as A}from"../../../views/support/PromiseQueue.js";import{noBudget as j}from"../../../views/support/Scheduler.js";const M=1e4,N=1e-4;let P=class extends a(t){get isMeshPyramid(){return this.layer.profile===`mesh-pyramids`||this.layer.store?.lodType===`MeshPyramid`}get isGraphics3D(){return this.layer.profile===`points`}get useMaximumNumberOfFeatures(){return!this.isMeshPyramid&&(this.layer.priority==null||this.layer.priority===`High`)}get indexRequester(){return new y(this.layer.customParameters,this.layer.apiKey)}get dataRequester(){return new y(this.layer.customParameters,this.layer.apiKey)}get crsVertex(){return w(this.layer)}get crsIndex(){return T(this.layer)}get layer(){return this.layerView.layer}get updating(){return this.running||this._updatingHandles.updating}get rootNodeVisible(){return f(()=>{if(this._index){let e=this._index.rootNode;if(e)return this._updateViewData(),this._index.isNodeVisible(e.index)}return!0})}get index(){return this._index}get requiredAttributes(){return this._requiredAttributes}constructor(e){super(e),this.featureTarget=5e4,this.fixedFeatureTarget=!1,this._updatingHandles=new m,this.running=!0,this.updatingProgress=1,this.leavesReached=!1,this.worker=null,this._featureLOD=1,this._stableFeatureLOD=!1,this._isIdle=!1,this._cameraDirty=!0,this._invisibleDirty=!1,this._newLoadingNodes=new i({deallocator:null}),this._modificationsNodeFilteringArray=new i,this._downloadingCount=0,this._loadingNodes=new Map,this._updatingNodes=new Map,this._progressMaxNumNodes=1,this._requiredAttributes=[],this._requiredAttributesDirty=!0,this._updatesDisabled=!1,this.disableIDBCache=!1,this._disableMemCache=!1,this._restartNodeLoading=!1,this._fields=null,this._attributeStorageInfo=null,this._idleQueue=new A,this._elevationUpdateNodes=new i({deallocator:null}),this._errorCount=0}initialize(){let{layerView:e,layer:t}=this;this._disableMemCache=!e.loadCachedGPUData||!e.addCachedGPUData,this._lodHandling=new S(e),this._defaultGeometrySchema=t.store.defaultGeometrySchema,this.disableIDBCache=!!has(`disable-feature:idb-cache`),`fields`in t&&(this._fields=t.fields,this._attributeStorageInfo=t.attributeStorageInfo),this.addResolvingPromise(Promise.all([t.indexInfo,t.when(),e.when()]).then(([r])=>{if(this.destroyed||!e||e.destroyed||!r)return;let{view:i,clientGeometry:a}=e;if(this._setClippingArea(i.clippingArea),this.addHandles([this._updatingHandles.add(()=>i?.pointsOfInterest?.focus?.renderLocation,e=>this._pointOfInterestChanged(e),{initial:!0,equals:p}),s(()=>i.quality,()=>this._setCameraDirty(),c),this._updatingHandles.add(()=>i.state.mode===2,t=>{this._updateIdleState(t),t&&(this._index?.resetFailedNodes(),e.contentVisible||this._updateViewData())},l),this._updatingHandles.add(()=>e.contentVisible,e=>{e&&this._index?.invalidateAllElevationRanges(),this.restartNodeLoading()},l),b(e.view.resourceController.scheduler,this),this._updatingHandles.add(()=>[this.featureTarget,this.fixedFeatureTarget],()=>{this._setCameraDirty(),this._stableFeatureLOD=!1}),this._updatingHandles.add(()=>i.state?.contentCamera,()=>this._setCameraDirty()),this._updatingHandles.add(()=>t.elevationInfo,e=>this._elevationInfoChanged(e),c),this._updatingHandles.add(()=>e.lodFactor,()=>this._setCameraDirty()),this._updatingHandles.add(()=>e.availableFields,()=>this._requiredFieldsChange()),this._updatingHandles.add(()=>e.holeFilling,e=>this._index!=null&&(this._index.holeFilling=e))]),this._viewportQueries=new D(this.crsIndex,i.renderCoordsHelper,i.state.contentCamera,!i.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,this.isMeshPyramid?i.groundView:i.elevationProvider,_(i.viewingMode),this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this._lod,angleDependentLoD:this._lod<.5}),this._clientNodeLoader=new v(this.layer.uid,{indexSR:this.crsIndex,vertexSR:this.crsVertex,renderSR:i.renderCoordsHelper.spatialReference},i.resourceController.memoryController,this.worker),this._index=new x(_(i.viewingMode),t,r,this.indexRequester,this._clientNodeLoader,this._viewportQueries,n.getLogger(this),e.holeFilling,t=>e.isNodeLoaded(t),t=>e.isNodeReloading(t),e=>this._shouldLoadNode(e),e=>this._enableFromGPUCache(e,1),e=>this._needsUpdate(e),t=>e.computeVisibilityObb?.(t)??null,e?.computeNodeFiltering?t=>e.computeNodeFiltering(t):void 0),this._index.updateElevationInfo(this.layer.elevationInfo,this.isMeshPyramid||this.isGraphics3D),this._index.imModificationsChanged(!!e.hasModifications),this._index.layerFilterChanged(!!e.hasGeometryFilter),a!=null){for(let e of a)this._addMesh(e.mesh,e.oid);this.addHandles(a.on(`change`,e=>{for(let t of e.removed)this._removeMesh(t.oid);for(let t of e.added)this._addMesh(t.mesh,t.oid)}))}this._startNodeLoading()}))}updateNodeModificationStatus(e){let t=this._index,n=this.layerView;t!=null&&n?.updateNodeModificationStatus&&(this._modificationsNodeFilteringArray.clear(),e.forAll(e=>{let n=t.getNode(e);n!=null&&this._modificationsNodeFilteringArray.push(n)}),n.updateNodeModificationStatus(this._modificationsNodeFilteringArray),this._invisibleDirty=!0)}destroy(){this.cancelNodeLoading(),this._updatingHandles.destroy(),this._nodeLoader=null,F.prune(),this._newLoadingNodes.prune(),this._modificationsNodeFilteringArray.prune(),this._elevationUpdateNodes.prune(),I!=null&&(I.hide(),I=null),this._index=null,this._lodHandling=r(this._lodHandling),this._nodeLoader=null,this._clientNodeLoader=null,this._viewportQueries=null,this._set(`worker`,null)}get viewportQueries(){return this._viewportQueries}_getRequiredAttributes(){if(this._attributeStorageInfo==null||!this._fields||!this.layerView.availableFields)return[];let e=this._attributeStorageInfo,t=this._fields,n=this.layer.objectIdField;return this.layerView.availableFields.map(n=>{let r=R(e,n),i=R(t,n);return r>=0&&i>=0?{index:r,name:t[i].name,field:t[i],attributeStorageInfo:e[r]}:null}).filter(e=>e!=null&&e.name!==n)}_requiredFieldsChange(){let e=this._getRequiredAttributes();L(this._requiredAttributes,e)||(this._requiredAttributes=e,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(e){let t=g();this._clippingArea=O(e,t,this.layerView.view.renderSpatialReference)?t:null}_pointOfInterestChanged(e){this._viewportQueries!=null&&(this._viewportQueries.setPointOfInterest(e),this._index!=null&&this._index.requestUpdate())}updateClippingArea(e){this._setClippingArea(e),this._viewportQueries!=null&&this._index!=null&&(this._viewportQueries.updateClippingArea(this._clippingArea),this._index.invalidateVisibilityCache()),this._setCameraDirty()}_setCameraDirty(){this._cameraDirty=!0,this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}_addMesh(e,t){if(this._index==null)return;let n=this._clientNodeLoader.createMeshNodeInfo(e,t),r=this._index.addClientNodeToIndex(n.id,n.mbs);this._clientNodeLoader.addMeshNode(r,n),this._evaluateRunning(),this.notifyChange(`rootNodeVisible`)}_removeMesh(e){let t=this._clientNodeLoader.getMeshNodeIndex(e);if(t!=null){if(this._index!=null)this._index.removeClientNodeFromIndex(t,(e,t)=>{this.layerView.removeNode(t),this._clientNodeLoader.removeNode(e),this.layerView.deleteCachedNodeData&&e!=null&&this.layerView.deleteCachedNodeData(e),this.layerView.deleteCachedGPUData?.(this.layerView.loadCachedGPUData?.(t))},(e,t,n)=>{this._clientNodeLoader.updateNodeIndex(e,t,n),this.layerView.updateNodeIndex&&this.layerView.updateNodeIndex(t,n)}),this.notifyChange(`rootNodeVisible`);else throw Error(`delayed removal of client side i3s node geometry not supported yet.`)}}updateElevationChanged(e,t){let n=this._index;if(n?.rootNode==null||t==null)return null;this.crsIndex.equals(t)||(h(e,t,z,this.crsIndex),e=z);let r=this._elevationUpdateNodes;return r.clear(),E(e,n.rootNode,n,e=>r.push(e.index)),r.length&&(r.forAll(e=>n.updateElevationChanged(e)),this._setCameraDirty()),r}removeAllGeometryObbs(){this._index!=null&&this._index.removeAllGeometryObbs()}getRenderMbs(e){return this._viewportQueries==null?null:this._viewportQueries.calculateServiceMbsInRenderSRElevationAdjusted(e)}_elevationInfoChanged(e){this._index!=null&&(this._index.updateElevationInfo(e,this.isMeshPyramid||this.isGraphics3D),this._setCameraDirty())}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateRunning()}schedule(e,t){let n=this._idleQueue.push(e,t);return this._evaluateRunning(),n}reschedule(e,t){let n=this._idleQueue.unshift(e,t);return this._evaluateRunning(),n}get _isIntegratedMesh(){return this.layer.type===`integrated-mesh`}get unloadedMemoryEstimate(){return this._index==null||!this.layerView.contentVisible?0:this._index.unloadedMemoryEstimate*this._lodDropFactor}async _loadNodeData(e,t){return e.index<0?this._clientNodeLoader.loadNodeData(e.id,t):this._nodeLoader.loadNodeData(e,t)}async _loadAttributes(e,t,n){return(e.index<0?this._clientNodeLoader:this._nodeLoader).loadAttributes(e,t,n)}get indexDepth(){return this._index==null?0:this._index.maxLevel}set disableMemCache(e){this._disableMemCache=!this.layerView.loadCachedGPUData||!this.layerView.addCachedGPUData||e}runTask(e,t){return this.layerView.contentVisible?!this.layerView.visible||this._index==null?-1/0:(this._processWithErrorLogging(e,t),this._index.maxPriority):(this._updateViewData(),this._evaluateRunning(),-1/0)}_processWithErrorLogging(e,t){try{this._process(e,t)}catch(e){this._errorCount<50?n.getLogger(this).error(`Error during processing: ${e} at ${e.stack}`):this._errorCount===50&&n.getLogger(this).error(`Too many errors for this layer. Further errors will not be displayed.`),this._errorCount++}}_process(e,t){this._restartNodeLoading&&this._startNodeLoading(),this._nodeLoader!=null&&this._index!=null&&(this._updateViewData(),this._invisibleDirty&&this._removeInvisibleNodes(e)&&(this._invisibleDirty=!1),this._isIntegratedMesh&&(e.enabled=!1),e.run(()=>this._processIndex(e)),this._updateFeatureLOD(),e.run(()=>this._processCache(e)),this._isIntegratedMesh&&(e.enabled=!0),e.run(()=>this._processNodes(e,t)),this._idleQueue.runTask(e),e.run(()=>this._prefetchIndex()),t.numIndexLoading+=this._index.indexLoading,t.numNodesLoading+=this._downloadingCount,e.run(()=>this._lodHandling.lodGlobalHandling(e)),this._evaluateRunning())}_processIndex(e){if(this._index==null)return!1;if(this._index.dirty){this._newLoadingNodes.clear(),this._index.update(Array.from(this._loadingNodes.keys()),e,e=>this.updateNodeModificationStatus(e)),this._disableMemCache||(this._newLoadingNodes.pushArray(this._index.updates.add.data,this._index.updates.add.length),this._newLoadingNodes.pushAll(this._index.updates.missing));let t=this._index.featureEstimate.leavesReached;!this._index.isLoading&&t!==this._get(`leavesReached`)&&this._set(`leavesReached`,t)}return this._index.load()}_prefetchIndex(){return this._index==null||this._loadingNodes.size>0||this._index.updates.add.length>0?!1:this._index.prefetch()}_updateFeatureLOD(){if(!this.useMaximumNumberOfFeatures||this._index==null||this._viewportQueries==null)return;let e=!this._index.isLoading,t=this.featureTarget*this._baseLOD,n=this._index.featureEstimate;if(n.estimate=n.estimate||t/2,this._index.indexMissing>500){if(this._featureLOD<=N)return;this._featureLOD/=1.5,this._stableFeatureLOD=!1}else if(e&&n.estimate<t){if(n.leavesReached||this._featureLOD>=M||this._stableFeatureLOD)return;let e=Math.min(10,Math.max(t/n.estimate,1.001));this._featureLOD*=e;let r=this._lod,i=this._index.checkFeatureTarget(t,r);i!==r&&(this._featureLOD=i/this._baseLOD,this._stableFeatureLOD=!0)}else if(n.estimate>t*1.2||e&&n.estimate>t){if(this._featureLOD<=N)return;this._featureLOD/=1+(n.estimate/t-1)*.25,this._stableFeatureLOD=!1}else return;this._featureLOD=Math.min(M,Math.max(N,this._featureLOD)),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.requestUpdate()}_processCache(e){let t=this._index;if(t==null)return!1;for(;this._newLoadingNodes.length>0&&!e.done;){let n=this._newLoadingNodes.pop();for(let r=t.getParent(n);r!=null&&!this.layerView.isNodeLoaded(r.index);r=t.getParent(r.index))if(this._enableFromGPUCache(r,0)){e.madeProgress();break}}return e.hasProgressed}_processNodes(e,t){if(this._index==null)return!1;let n=(this._isIdle?100:2)-this._loadingNodes.size,r=this._index.updates;for(r.cancel.forEach(this._cancelNode,this),r.cancel=[];r.remove.length>0&&!e.done;)this.layerView.removeNode(r.remove.pop()),e.madeProgress();for(;r.update.length>0&&!e.done;){let t=this._index.getNode(r.update.pop());t!=null&&(this._updateLoadedNode(t),e.madeProgress())}for(;r.add.length>0&&!e.done&&n>0;){--n;let i=this._index.getNode(r.add.back());if(i==null||i.cacheState!==2&&!this._hasNodeLoadToken(t))break;r.add.pop(),this._loadNode(i),e.madeProgress()}return e.hasProgressed}_cancelAllNodes(){this._loadingNodes.forEach(e=>e.abort()),this._loadingNodes.clear(),this._updatingNodes.forEach(e=>e.abort()),this._updatingNodes.clear()}_cancelNode(e){let t=this._loadingNodes.get(e);t&&(t.abort(),this._loadingNodes.delete(e))}_hasNodeLoadToken(e){return!this._isIdle&&e.numNodesLoading+this._loadingNodes.size>=2?!1:this.index==null||!this.dataRequester.isFull(this._index.urlPrefix)}_evaluateRunning(){let e=!1,t=0;if(this.layerView){if(!this.layerView.contentVisible)e=this._cameraDirty,t=+!e;else{let n=(this._index?.indexMissing??0)+(this._index?.updates.add.length??0)*3+this._loadingNodes.size*2;e=!!(n>0||this._updatingNodes.size>0||this._restartNodeLoading||this._cameraDirty||this._idleQueue.updating||this._lodHandling&&this._lodHandling.requiresLODGlobalHandling||this._index!=null&&this._index.isPrefetching),n===0&&(this._progressMaxNumNodes=1),this._progressMaxNumNodes=Math.max(n,this._progressMaxNumNodes),t=1-n/this._progressMaxNumNodes}this.running=e,this.updatingProgress=t}}_updateViewData(){if(!this._cameraDirty||this._index==null||this._viewportQueries==null)return;let e=this.layerView.view,{contentCamera:t,fixedContentCamera:n}=e.state;this._viewportQueries.updateCamera(t,!n||this.isGraphics3D),this._viewportQueries.setPointOfInterest(e.pointsOfInterest.focus.renderLocation),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.invalidateVisibilityCache(),this._index.requestUpdate(),this._stableFeatureLOD=!1,this._invisibleDirty=!0,this._cameraDirty=!1,this.notifyChange(`rootNodeVisible`)}_getProgressiveLoadFactor(){return this.layerView.view.quality<1?1:this.layerView.progressiveLoadFactor}get _lod(){return this._featureLOD*this._baseLOD}get _baseLOD(){let e=this.layerView.lodFactor;return this.fixedFeatureTarget?1:(e>0?e:1)*this.layerView.view.quality}get _lodDropFactor(){return this.fixedFeatureTarget?1:(Math.min(this.layerView.view.quality,.5)-k)/(.5-k)}isGeometryVisible(e){return!!this._index?.isGeometryVisible(e.index)}updateVisibility(e){this._index?.invalidateNodeVisibilityCache(e)}invalidateGeometryVisibility(e){this._index?.invalidateGeometryVisibility(e)}invalidateVisibilityObbs(){this._index?.invalidateVisibilityObbs()}modificationsChanged(){this._index?.imModificationsChanged(!!this.layerView.hasModifications),this._invisibleDirty=!0}_shouldLoadNode(e){return!(!this._lodHandling.shouldLoadNode(e)||this._shouldDropNode(e)||this._index==null||!this._index.isGeometryVisible(e.index))}_shouldDropNode(e){if(this._viewportQueries==null)return!1;let t=this._lodDropFactor;return t>=1||!this._lodHandling.hasNoVisibleChildren(e)?!1:Math.abs(this._viewportQueries.calcCameraDistanceToCenterAndUpdateMinmax(e))-this._viewportQueries.minCenterDistance>(this._viewportQueries.maxCenterDistance-this._viewportQueries.minCenterDistance)*t}_startNodeLoading(){this._restartNodeLoading=!1;let e=this._index;if(this._updatesDisabled||e==null||this._viewportQueries==null)return;this._updateViewData(),this._requiredAttributesDirty&&=(this._requiredAttributes=this._getRequiredAttributes(),!1);let t={textureEncodings:this.layerView.supportedTextureEncodings,textureUsageMask:this.layerView.rendererTextureUsage,loadFeatureData:this.useMaximumNumberOfFeatures};this._nodeLoader=new C(this.layer,this.dataRequester,n.getLogger(this),this._defaultGeometrySchema,this._requiredAttributes,t),e.requestUpdate(),this._lodHandling.startNodeLoading((e,t)=>this._removeNodes(e,t,1),e,{maxLodLevel:this._viewportQueries.maxLodLevel}),this._evaluateRunning()}isNodeLoading(){return this._nodeLoader!=null&&this._index!=null}cancelNodeLoading(){this.isNodeLoading()&&(this.indexRequester.cancelAll(),this.dataRequester.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateRunning())}_removeInvisibleNodes(e){let t=this._index;if(t==null||this._viewportQueries==null)return!1;F.clear(),this.layerView.getLoadedNodeIndices(F);let n=this._viewportQueries.maxCenterDistance===0,r=n?()=>!1:e=>this._shouldDropNode(e);return F.filterInPlace(e=>{let n=t.getNode(e);return n==null||!t.isGeometryVisible(e)||r(n)}),F.length>0&&this._lodHandling.setLodGlobalDirty(),this._removeNodes(F,e,0),n&&this._lodDropFactor<1?!1:F.length===0||(F.clear(),!1)}markNodeToRemove(e){F.push(e)}removeMarkedNodes(){this._removeNodes(F,j,0)}_removeNodes(e,t,n){if(!(e.length===0||t.done))for(this._index!=null&&this._index.requestUpdate();e.length>0&&!t.done;){let r=e.pop(),i=this._index;n===1&&this.layerView.nodeFadeoutEnabled&&i!=null&&i.isGeometryVisible(r)?this.layerView.fadeNode(r,1,!0):this.layerView.removeNode(r),t.madeProgress()}}_needsUpdate(e){if(e.resources.isEmpty||this._updatingNodes.has(e.index))return!1;let t=this.layerView.getLoadedAttributes(e.index);return t!=null&&t!==this._requiredAttributes}async _updateLoadedNode(e){let t=new AbortController;this._updatingNodes.set(e.index,t),this._evaluateRunning();try{let n=L(this.layerView.getLoadedAttributes(e.index),this._requiredAttributes)?this.layerView.getAttributeData(e.index):await this._loadAttributes(e,this._requiredAttributes,t.signal);await this.schedule(()=>this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:n},t.signal),t.signal)}catch(n){if(!o(n))return this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:{}},t.signal)}this._updatingNodes.delete(e.index),this._evaluateRunning()}_loadNode(e){if(this._loadingNodes.has(e.index)){n.getLogger(this).error(`already loading node `+e.index);return}let t=new AbortController;this._loadingNodes.set(e.index,t),this._evaluateRunning(),this._loadAndAddNode(e,t.signal).then(n=>{n&&this._index!=null&&this._loadingNodes.get(e.index)===t&&(this._loadingNodes.delete(e.index),this._index.requestUpdate())}).catch(()=>{}).finally(()=>{this._loadingNodes.get(e.index)===t&&this._loadingNodes.delete(e.index),this._evaluateRunning()})}_loadAndAddNode(e,t){return e.cacheState===1?this._loadUncached(e,t).then(()=>!1):this._loadCached(e,t).then(t=>!t&&(e.cacheState=1,!0)).catch(t=>!o(t)&&(e.cacheState=1,!0))}_enableFromGPUCache(e,t){if(this._disableMemCache||this._index==null)return!1;if(t===0&&!this._index.useNodeAsHole(e.index))return!0;let n=this._loadCachedGPUData(e);return n?(this.layerView.addCachedGPUData(e,n,t),this._nodeAdded(),!0):!1}_loadCachedGPUData(e){let t=this.layerView.loadCachedGPUData(e.index);return t?.attributeInfo!=null&&L(t.attributeInfo.loadedAttributes,this._requiredAttributes)?t:(this.layerView.deleteCachedGPUData(t),null)}_nodeAdded(){this._index!=null&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}updateLoadStatus(e,t){this._index?.updateChildrenLoaded(e,t?1:-1)}async _loadCached(e,t){if(this._enableFromGPUCache(e,1))return!0;let n=this.layerView;if(this.disableIDBCache||!n.loadCachedNodeData||!n.addCachedNodeData)return!1;let r=e.index>=0?(t,n)=>this._nodeLoader.loadTextures(e,t,n):t=>this._clientNodeLoader.loadTextures(e,t),i=await this.schedule(()=>n.loadCachedNodeData(e,t,r),t);if(i==null)return!1;let a=this._requiredAttributes,o=await this.reschedule(()=>this._loadAttributes(e,a,t),t);return await this.reschedule(()=>n.addCachedNodeData(e,i,{loadedAttributes:a,attributeData:o},t),t),this._nodeAdded(),!0}_loadUncached(e,t){return this._downloadingCount++,this._loadNodeData(e,t).then(n=>this.schedule(()=>this.layerView.addNode(e,n,t),t)).finally(()=>this._downloadingCount--).then(()=>{this._nodeAdded(),e.cacheState=2}).catch(t=>{if(!o(t))throw n.getLogger(this).error(`#loadNodeData()`,this.layer,`Failed to load node '${e.id}'`,t),e.failed=!0,this._index?.requestUpdate(),t})}_updateIdleState(e){e!==this._isIdle&&(this._isIdle=e,this._evaluateRunning())}get test(){}notifyLODUpdate(){this._lodHandling.setLodGlobalDirty(),this._evaluateRunning(),this._index!=null&&this._index.requestUpdate()}geometryFilterChanged(e){this._index?.layerFilterChanged(e),this._setCameraDirty()}};e([u({readOnly:!0})],P.prototype,`isMeshPyramid`,null),e([u({readOnly:!0})],P.prototype,`isGraphics3D`,null),e([u({readOnly:!0})],P.prototype,`useMaximumNumberOfFeatures`,null),e([u({readOnly:!0})],P.prototype,`indexRequester`,null),e([u({readOnly:!0})],P.prototype,`dataRequester`,null),e([u({readOnly:!0})],P.prototype,`crsVertex`,null),e([u({readOnly:!0})],P.prototype,`crsIndex`,null),e([u()],P.prototype,`featureTarget`,void 0),e([u()],P.prototype,`fixedFeatureTarget`,void 0),e([u()],P.prototype,`layerView`,void 0),e([u()],P.prototype,`layer`,null),e([u()],P.prototype,`_updatingHandles`,void 0),e([u()],P.prototype,`updating`,null),e([u()],P.prototype,`running`,void 0),e([u()],P.prototype,`updatingProgress`,void 0),e([u({readOnly:!0})],P.prototype,`leavesReached`,void 0),e([u({constructOnly:!0})],P.prototype,`worker`,void 0),e([u({readOnly:!0})],P.prototype,`rootNodeVisible`,null),P=e([d(`esri.layers.graphics.controllers.I3SOnDemandController`)],P);const F=new i({deallocator:null});let I;function L(e,t){return e!=null&&e.length===t.length&&e.every(e=>R(t,e.name)>=0)}function R(e,t){let n=t.toLowerCase();for(let t=0;t<e.length;t++)if(e[t].name.toLowerCase()===n)return t;return-1}const z=g(),B=P;export{B as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import has from"../../../core/has.js";import n from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import i from"../../../core/PooledArray.js";import{EsriPromiseMixin as a}from"../../../core/Promise.js";import{isAbortError as o}from"../../../core/promiseUtils.js";import{watch as s,sync as c,initial as l}from"../../../core/reactiveUtils.js";import{property as u,subclass as d}from"../../../core/accessorSupport/decorators.js";import{runUntracked as f}from"../../../core/accessorSupport/tracking.js";import{exactEquals as p}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{UpdatingHandles as m}from"../../../core/support/UpdatingHandles.js";import{create as h,fromValues as g}from"../../../geometry/support/aaBoundingRect.js";import{viewingModeFromString as _}from"../../../views/ViewingMode.js";import{I3SClientNodeLoader as v}from"../../../views/3d/layers/i3s/I3SClientNodeLoader.js";import{I3SDataRequester as y}from"../../../views/3d/layers/i3s/I3SDataRequester.js";import{addCallback as b}from"../../../views/3d/layers/i3s/I3SFrameTask.js";import{I3SIndex as x}from"../../../views/3d/layers/i3s/I3SIndex.js";import S from"../../../views/3d/layers/i3s/I3SLodHandling.js";import C from"../../../views/3d/layers/i3s/I3SNodeLoader.js";import{getVertexCrs as w,getIndexCrs as T,findIntersectingNodes as E}from"../../../views/3d/layers/i3s/I3SUtil.js";import D from"../../../views/3d/layers/i3s/I3SViewportQueries.js";import{projectElevationUpdateExtent as O}from"../../../views/3d/support/elevationUpdateExtentUtils.js";import{toBoundingRect as k}from"../../../views/3d/support/extentUtils.js";import{minQuality as A}from"../../../views/3d/support/MemoryController.js";import{PromiseQueue as j}from"../../../views/support/PromiseQueue.js";import{noBudget as M}from"../../../views/support/Scheduler.js";const N=1e4,P=1e-4;let F=class extends a(t){get isMeshPyramid(){return this.layer.profile===`mesh-pyramids`||this.layer.store?.lodType===`MeshPyramid`}get isGraphics3D(){return this.layer.profile===`points`}get useMaximumNumberOfFeatures(){return!this.isMeshPyramid&&(this.layer.priority==null||this.layer.priority===`High`)}get indexRequester(){return new y(this.layer.customParameters,this.layer.apiKey)}get dataRequester(){return new y(this.layer.customParameters,this.layer.apiKey)}get crsVertex(){return w(this.layer)}get crsIndex(){return T(this.layer)}get layer(){return this.layerView.layer}get updating(){return this.running||this._updatingHandles.updating}get rootNodeVisible(){return f(()=>{if(this._index){let e=this._index.rootNode;if(e)return this._updateViewData(),this._index.isNodeVisible(e.index)}return!0})}get index(){return this._index}get requiredAttributes(){return this._requiredAttributes}constructor(e){super(e),this.featureTarget=5e4,this.fixedFeatureTarget=!1,this._updatingHandles=new m,this.running=!0,this.updatingProgress=1,this.leavesReached=!1,this.worker=null,this._featureLOD=1,this._stableFeatureLOD=!1,this._isIdle=!1,this._cameraDirty=!0,this._invisibleDirty=!1,this._newLoadingNodes=new i({deallocator:null}),this._modificationsNodeFilteringArray=new i,this._downloadingCount=0,this._loadingNodes=new Map,this._updatingNodes=new Map,this._progressMaxNumNodes=1,this._requiredAttributes=[],this._requiredAttributesDirty=!0,this._updatesDisabled=!1,this.disableIDBCache=!1,this._disableMemCache=!1,this._restartNodeLoading=!1,this._fields=null,this._attributeStorageInfo=null,this._idleQueue=new j,this._elevationUpdateNodes=new i({deallocator:null}),this._errorCount=0}initialize(){let{layerView:e,layer:t}=this;this._disableMemCache=!e.loadCachedGPUData||!e.addCachedGPUData,this._lodHandling=new S(e),this._defaultGeometrySchema=t.store.defaultGeometrySchema,this.disableIDBCache=!!has(`disable-feature:idb-cache`),`fields`in t&&(this._fields=t.fields,this._attributeStorageInfo=t.attributeStorageInfo),this.addResolvingPromise(Promise.all([t.indexInfo,t.when(),e.when()]).then(([r])=>{if(this.destroyed||!e||e.destroyed||!r)return;let{view:i,clientGeometry:a}=e;if(this._setClippingArea(i.clippingArea),this.addHandles([this._updatingHandles.add(()=>i?.pointsOfInterest?.focus?.renderLocation,e=>this._pointOfInterestChanged(e),{initial:!0,equals:p}),s(()=>i.quality,()=>this._setCameraDirty(),c),this._updatingHandles.add(()=>i.state.mode===2,t=>{this._updateIdleState(t),t&&(this._index?.resetFailedNodes(),e.contentVisible||this._updateViewData())},l),this._updatingHandles.add(()=>e.contentVisible,e=>{e&&this._index?.invalidateAllElevationRanges(),this.restartNodeLoading()},l),b(e.view.resourceController.scheduler,this),this._updatingHandles.add(()=>[this.featureTarget,this.fixedFeatureTarget],()=>{this._setCameraDirty(),this._stableFeatureLOD=!1}),this._updatingHandles.add(()=>i.state?.contentCamera,()=>this._setCameraDirty()),this._updatingHandles.add(()=>t.elevationInfo,e=>this._elevationInfoChanged(e),c),this._updatingHandles.add(()=>e.lodFactor,()=>this._setCameraDirty()),this._updatingHandles.add(()=>e.availableFields,()=>this._requiredFieldsChange()),this._updatingHandles.add(()=>e.holeFilling,e=>this._index!=null&&(this._index.holeFilling=e))]),this._viewportQueries=new D(this.crsIndex,i.renderCoordsHelper,i.state.contentCamera,!i.state.fixedContentCamera||this.isGraphics3D,this._clippingArea,this.isMeshPyramid?i.groundView:i.elevationProvider,_(i.viewingMode),this.layer.elevationInfo,{progressiveLoadFactor:this._getProgressiveLoadFactor(),screenspaceErrorBias:this._lod,angleDependentLoD:this._lod<.5}),this._clientNodeLoader=new v(this.layer.uid,{indexSR:this.crsIndex,vertexSR:this.crsVertex,renderSR:i.renderCoordsHelper.spatialReference},i.resourceController.memoryController,this.worker),this._index=new x(_(i.viewingMode),t,r,this.indexRequester,this._clientNodeLoader,this._viewportQueries,n.getLogger(this),e.holeFilling,t=>e.isNodeLoaded(t),t=>e.isNodeReloading(t),e=>this._shouldLoadNode(e),e=>this._enableFromGPUCache(e,1),e=>this._needsUpdate(e),t=>e.computeVisibilityObb?.(t)??null,e?.computeNodeFiltering?t=>e.computeNodeFiltering(t):void 0),this._index.updateElevationInfo(this.layer.elevationInfo,this.isMeshPyramid||this.isGraphics3D),this._index.imModificationsChanged(!!e.hasModifications),this._index.layerFilterChanged(!!e.hasGeometryFilter),a!=null){for(let e of a)this._addMesh(e.mesh,e.oid);this.addHandles(a.on(`change`,e=>{for(let t of e.removed)this._removeMesh(t.oid);for(let t of e.added)this._addMesh(t.mesh,t.oid)}))}this._startNodeLoading()}))}updateNodeModificationStatus(e){let t=this._index,n=this.layerView;t!=null&&n?.updateNodeModificationStatus&&(this._modificationsNodeFilteringArray.clear(),e.forAll(e=>{let n=t.getNode(e);n!=null&&this._modificationsNodeFilteringArray.push(n)}),n.updateNodeModificationStatus(this._modificationsNodeFilteringArray),this._invisibleDirty=!0)}destroy(){this.cancelNodeLoading(),this._updatingHandles.destroy(),this._nodeLoader=null,I.prune(),this._newLoadingNodes.prune(),this._modificationsNodeFilteringArray.prune(),this._elevationUpdateNodes.prune(),L!=null&&(L.hide(),L=null),this._index=null,this._lodHandling=r(this._lodHandling),this._nodeLoader=null,this._clientNodeLoader=null,this._viewportQueries=null,this._set(`worker`,null)}get viewportQueries(){return this._viewportQueries}_getRequiredAttributes(){if(this._attributeStorageInfo==null||!this._fields||!this.layerView.availableFields)return[];let e=this._attributeStorageInfo,t=this._fields,n=this.layer.objectIdField;return this.layerView.availableFields.map(n=>{let r=z(e,n),i=z(t,n);return r>=0&&i>=0?{index:r,name:t[i].name,field:t[i],attributeStorageInfo:e[r]}:null}).filter(e=>e!=null&&e.name!==n)}_requiredFieldsChange(){let e=this._getRequiredAttributes();R(this._requiredAttributes,e)||(this._requiredAttributes=e,this._requiredAttributesDirty=!1,this.restartNodeLoading())}requestUpdate(){this._requiredAttributesDirty=!0,this.restartNodeLoading()}_setClippingArea(e){let t=h();this._clippingArea=k(e,t,this.layerView.view.renderSpatialReference)?t:null}_pointOfInterestChanged(e){this._viewportQueries!=null&&(this._viewportQueries.setPointOfInterest(e),this._index!=null&&this._index.requestUpdate())}updateClippingArea(e){this._setClippingArea(e),this._viewportQueries!=null&&this._index!=null&&(this._viewportQueries.updateClippingArea(this._clippingArea),this._index.invalidateVisibilityCache()),this._setCameraDirty()}_setCameraDirty(){this._cameraDirty=!0,this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}_addMesh(e,t){if(this._index==null)return;let n=this._clientNodeLoader.createMeshNodeInfo(e,t),r=this._index.addClientNodeToIndex(n.id,n.mbs);this._clientNodeLoader.addMeshNode(r,n),this._evaluateRunning(),this.notifyChange(`rootNodeVisible`)}_removeMesh(e){let t=this._clientNodeLoader.getMeshNodeIndex(e);if(t!=null){if(this._index!=null)this._index.removeClientNodeFromIndex(t,(e,t)=>{this.layerView.removeNode(t),this._clientNodeLoader.removeNode(e),this.layerView.deleteCachedNodeData&&e!=null&&this.layerView.deleteCachedNodeData(e),this.layerView.deleteCachedGPUData?.(this.layerView.loadCachedGPUData?.(t))},(e,t,n)=>{this._clientNodeLoader.updateNodeIndex(e,t,n),this.layerView.updateNodeIndex&&this.layerView.updateNodeIndex(t,n)}),this.notifyChange(`rootNodeVisible`);else throw Error(`delayed removal of client side i3s node geometry not supported yet.`)}}updateElevationChanged(e,t){let n=this._index,r=this._viewportQueries;if(n?.rootNode==null||t==null||r==null)return null;let i=r.elevationIntersectionSpatialReference;i.equals(t)||(O(e,t,B,i)||g(-1/0,-1/0,1/0,1/0,B),e=B);let a=this._elevationUpdateNodes;return a.clear(),E(e,n.rootNode,n,e=>a.push(e.index),r),a.length&&(a.forAll(e=>n.updateElevationChanged(e)),this._setCameraDirty()),a}removeAllGeometryObbs(){this._index!=null&&this._index.removeAllGeometryObbs()}getRenderMbs(e){return this._viewportQueries==null?null:this._viewportQueries.calculateServiceMbsInRenderSRElevationAdjusted(e)}_elevationInfoChanged(e){this._index!=null&&(this._index.updateElevationInfo(e,this.isMeshPyramid||this.isGraphics3D),this._setCameraDirty())}restartNodeLoading(){this._restartNodeLoading=!0,this.cancelNodeLoading(),this._evaluateRunning()}schedule(e,t){let n=this._idleQueue.push(e,t);return this._evaluateRunning(),n}reschedule(e,t){let n=this._idleQueue.unshift(e,t);return this._evaluateRunning(),n}get _isIntegratedMesh(){return this.layer.type===`integrated-mesh`}get unloadedMemoryEstimate(){return this._index==null||!this.layerView.contentVisible?0:this._index.unloadedMemoryEstimate*this._lodDropFactor}async _loadNodeData(e,t){return e.index<0?this._clientNodeLoader.loadNodeData(e.id,t):this._nodeLoader.loadNodeData(e,t)}async _loadAttributes(e,t,n){return(e.index<0?this._clientNodeLoader:this._nodeLoader).loadAttributes(e,t,n)}get indexDepth(){return this._index==null?0:this._index.maxLevel}set disableMemCache(e){this._disableMemCache=!this.layerView.loadCachedGPUData||!this.layerView.addCachedGPUData||e}runTask(e,t){return this.layerView.contentVisible?!this.layerView.visible||this._index==null?-1/0:(this._processWithErrorLogging(e,t),this._index.maxPriority):(this._updateViewData(),this._evaluateRunning(),-1/0)}_processWithErrorLogging(e,t){try{this._process(e,t)}catch(e){this._errorCount<50?n.getLogger(this).error(`Error during processing: ${e} at ${e.stack}`):this._errorCount===50&&n.getLogger(this).error(`Too many errors for this layer. Further errors will not be displayed.`),this._errorCount++}}_process(e,t){this._restartNodeLoading&&this._startNodeLoading(),this._nodeLoader!=null&&this._index!=null&&(this._updateViewData(),this._invisibleDirty&&this._removeInvisibleNodes(e)&&(this._invisibleDirty=!1),this._isIntegratedMesh&&(e.enabled=!1),e.run(()=>this._processIndex(e)),this._updateFeatureLOD(),e.run(()=>this._processCache(e)),this._isIntegratedMesh&&(e.enabled=!0),e.run(()=>this._processNodes(e,t)),this._idleQueue.runTask(e),e.run(()=>this._prefetchIndex()),t.numIndexLoading+=this._index.indexLoading,t.numNodesLoading+=this._downloadingCount,e.run(()=>this._lodHandling.lodGlobalHandling(e)),this._evaluateRunning())}_processIndex(e){if(this._index==null)return!1;if(this._index.dirty){this._newLoadingNodes.clear(),this._index.update(Array.from(this._loadingNodes.keys()),e,e=>this.updateNodeModificationStatus(e)),this._disableMemCache||(this._newLoadingNodes.pushArray(this._index.updates.add.data,this._index.updates.add.length),this._newLoadingNodes.pushAll(this._index.updates.missing));let t=this._index.featureEstimate.leavesReached;!this._index.isLoading&&t!==this._get(`leavesReached`)&&this._set(`leavesReached`,t)}return this._index.load()}_prefetchIndex(){return this._index==null||this._loadingNodes.size>0||this._index.updates.add.length>0?!1:this._index.prefetch()}_updateFeatureLOD(){if(!this.useMaximumNumberOfFeatures||this._index==null||this._viewportQueries==null)return;let e=!this._index.isLoading,t=this.featureTarget*this._baseLOD,n=this._index.featureEstimate;if(n.estimate=n.estimate||t/2,this._index.indexMissing>500){if(this._featureLOD<=P)return;this._featureLOD/=1.5,this._stableFeatureLOD=!1}else if(e&&n.estimate<t){if(n.leavesReached||this._featureLOD>=N||this._stableFeatureLOD)return;let e=Math.min(10,Math.max(t/n.estimate,1.001));this._featureLOD*=e;let r=this._lod,i=this._index.checkFeatureTarget(t,r);i!==r&&(this._featureLOD=i/this._baseLOD,this._stableFeatureLOD=!0)}else if(n.estimate>t*1.2||e&&n.estimate>t){if(this._featureLOD<=P)return;this._featureLOD/=1+(n.estimate/t-1)*.25,this._stableFeatureLOD=!1}else return;this._featureLOD=Math.min(N,Math.max(P,this._featureLOD)),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.requestUpdate()}_processCache(e){let t=this._index;if(t==null)return!1;for(;this._newLoadingNodes.length>0&&!e.done;){let n=this._newLoadingNodes.pop();for(let r=t.getParent(n);r!=null&&!this.layerView.isNodeLoaded(r.index);r=t.getParent(r.index))if(this._enableFromGPUCache(r,0)){e.madeProgress();break}}return e.hasProgressed}_processNodes(e,t){if(this._index==null)return!1;let n=(this._isIdle?100:2)-this._loadingNodes.size,r=this._index.updates;for(r.cancel.forEach(this._cancelNode,this),r.cancel=[];r.remove.length>0&&!e.done;)this.layerView.removeNode(r.remove.pop()),e.madeProgress();for(;r.update.length>0&&!e.done;){let t=this._index.getNode(r.update.pop());t!=null&&(this._updateLoadedNode(t),e.madeProgress())}for(;r.add.length>0&&!e.done&&n>0;){--n;let i=this._index.getNode(r.add.back());if(i==null||i.cacheState!==2&&!this._hasNodeLoadToken(t))break;r.add.pop(),this._loadNode(i),e.madeProgress()}return e.hasProgressed}_cancelAllNodes(){this._loadingNodes.forEach(e=>e.abort()),this._loadingNodes.clear(),this._updatingNodes.forEach(e=>e.abort()),this._updatingNodes.clear()}_cancelNode(e){let t=this._loadingNodes.get(e);t&&(t.abort(),this._loadingNodes.delete(e))}_hasNodeLoadToken(e){return!this._isIdle&&e.numNodesLoading+this._loadingNodes.size>=2?!1:this.index==null||!this.dataRequester.isFull(this._index.urlPrefix)}_evaluateRunning(){let e=!1,t=0;if(this.layerView){if(!this.layerView.contentVisible)e=this._cameraDirty,t=+!e;else{let n=(this._index?.indexMissing??0)+(this._index?.updates.add.length??0)*3+this._loadingNodes.size*2;e=!!(n>0||this._updatingNodes.size>0||this._restartNodeLoading||this._cameraDirty||this._idleQueue.updating||this._lodHandling&&this._lodHandling.requiresLODGlobalHandling||this._index!=null&&this._index.isPrefetching),n===0&&(this._progressMaxNumNodes=1),this._progressMaxNumNodes=Math.max(n,this._progressMaxNumNodes),t=1-n/this._progressMaxNumNodes}this.running=e,this.updatingProgress=t}}_updateViewData(){if(!this._cameraDirty||this._index==null||this._viewportQueries==null)return;let e=this.layerView.view,{contentCamera:t,fixedContentCamera:n}=e.state;this._viewportQueries.updateCamera(t,!n||this.isGraphics3D),this._viewportQueries.setPointOfInterest(e.pointsOfInterest.focus.renderLocation),this._viewportQueries.updateScreenSpaceErrorBias(this._lod),this._index.invalidateVisibilityCache(),this._index.requestUpdate(),this._stableFeatureLOD=!1,this._invisibleDirty=!0,this._cameraDirty=!1,this.notifyChange(`rootNodeVisible`)}_getProgressiveLoadFactor(){return this.layerView.view.quality<1?1:this.layerView.progressiveLoadFactor}get _lod(){return this._featureLOD*this._baseLOD}get _baseLOD(){let e=this.layerView.lodFactor;return this.fixedFeatureTarget?1:(e>0?e:1)*this.layerView.view.quality}get _lodDropFactor(){return this.fixedFeatureTarget?1:(Math.min(this.layerView.view.quality,.5)-A)/(.5-A)}isGeometryVisible(e){return!!this._index?.isGeometryVisible(e.index)}updateVisibility(e){this._index?.invalidateNodeVisibilityCache(e)}invalidateGeometryVisibility(e){this._index?.invalidateGeometryVisibility(e)}invalidateVisibilityObbs(){this._index?.invalidateVisibilityObbs()}modificationsChanged(){this._index?.imModificationsChanged(!!this.layerView.hasModifications),this._invisibleDirty=!0}_shouldLoadNode(e){return!(!this._lodHandling.shouldLoadNode(e)||this._shouldDropNode(e)||this._index==null||!this._index.isGeometryVisible(e.index))}_shouldDropNode(e){if(this._viewportQueries==null)return!1;let t=this._lodDropFactor;return t>=1||!this._lodHandling.hasNoVisibleChildren(e)?!1:Math.abs(this._viewportQueries.calcCameraDistanceToCenterAndUpdateMinmax(e))-this._viewportQueries.minCenterDistance>(this._viewportQueries.maxCenterDistance-this._viewportQueries.minCenterDistance)*t}_startNodeLoading(){this._restartNodeLoading=!1;let e=this._index;if(this._updatesDisabled||e==null||this._viewportQueries==null)return;this._updateViewData(),this._requiredAttributesDirty&&=(this._requiredAttributes=this._getRequiredAttributes(),!1);let t={textureEncodings:this.layerView.supportedTextureEncodings,textureUsageMask:this.layerView.rendererTextureUsage,loadFeatureData:this.useMaximumNumberOfFeatures};this._nodeLoader=new C(this.layer,this.dataRequester,n.getLogger(this),this._defaultGeometrySchema,this._requiredAttributes,t),e.requestUpdate(),this._lodHandling.startNodeLoading((e,t)=>this._removeNodes(e,t,1),e,{maxLodLevel:this._viewportQueries.maxLodLevel}),this._evaluateRunning()}isNodeLoading(){return this._nodeLoader!=null&&this._index!=null}cancelNodeLoading(){this.isNodeLoading()&&(this.indexRequester.cancelAll(),this.dataRequester.cancelAll(),this._idleQueue.cancelAll(),this._cancelAllNodes(),this._nodeLoader=null,this._evaluateRunning())}_removeInvisibleNodes(e){let t=this._index;if(t==null||this._viewportQueries==null)return!1;I.clear(),this.layerView.getLoadedNodeIndices(I);let n=this._viewportQueries.maxCenterDistance===0,r=n?()=>!1:e=>this._shouldDropNode(e);return I.filterInPlace(e=>{let n=t.getNode(e);return n==null||!t.isGeometryVisible(e)||r(n)}),I.length>0&&this._lodHandling.setLodGlobalDirty(),this._removeNodes(I,e,0),n&&this._lodDropFactor<1?!1:I.length===0||(I.clear(),!1)}markNodeToRemove(e){I.push(e)}removeMarkedNodes(){this._removeNodes(I,M,0)}_removeNodes(e,t,n){if(!(e.length===0||t.done))for(this._index!=null&&this._index.requestUpdate();e.length>0&&!t.done;){let r=e.pop(),i=this._index;n===1&&this.layerView.nodeFadeoutEnabled&&i!=null&&i.isGeometryVisible(r)?this.layerView.fadeNode(r,1,!0):this.layerView.removeNode(r),t.madeProgress()}}_needsUpdate(e){if(e.resources.isEmpty||this._updatingNodes.has(e.index))return!1;let t=this.layerView.getLoadedAttributes(e.index);return t!=null&&t!==this._requiredAttributes}async _updateLoadedNode(e){let t=new AbortController;this._updatingNodes.set(e.index,t),this._evaluateRunning();try{let n=R(this.layerView.getLoadedAttributes(e.index),this._requiredAttributes)?this.layerView.getAttributeData(e.index):await this._loadAttributes(e,this._requiredAttributes,t.signal);await this.schedule(()=>this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:n},t.signal),t.signal)}catch(n){if(!o(n))return this.layerView.updateAttributes(e.index,{loadedAttributes:this._requiredAttributes,attributeData:{}},t.signal)}this._updatingNodes.delete(e.index),this._evaluateRunning()}_loadNode(e){if(this._loadingNodes.has(e.index)){n.getLogger(this).error(`already loading node `+e.index);return}let t=new AbortController;this._loadingNodes.set(e.index,t),this._evaluateRunning(),this._loadAndAddNode(e,t.signal).then(n=>{n&&this._index!=null&&this._loadingNodes.get(e.index)===t&&(this._loadingNodes.delete(e.index),this._index.requestUpdate())}).catch(()=>{}).finally(()=>{this._loadingNodes.get(e.index)===t&&this._loadingNodes.delete(e.index),this._evaluateRunning()})}_loadAndAddNode(e,t){return e.cacheState===1?this._loadUncached(e,t).then(()=>!1):this._loadCached(e,t).then(t=>!t&&(e.cacheState=1,!0)).catch(t=>!o(t)&&(e.cacheState=1,!0))}_enableFromGPUCache(e,t){if(this._disableMemCache||this._index==null)return!1;if(t===0&&!this._index.useNodeAsHole(e.index))return!0;let n=this._loadCachedGPUData(e);return n?(this.layerView.addCachedGPUData(e,n,t),this._nodeAdded(),!0):!1}_loadCachedGPUData(e){let t=this.layerView.loadCachedGPUData(e.index);return t?.attributeInfo!=null&&R(t.attributeInfo.loadedAttributes,this._requiredAttributes)?t:(this.layerView.deleteCachedGPUData(t),null)}_nodeAdded(){this._index!=null&&this._index.requestUpdate(),this._lodHandling.setLodGlobalDirty(),this._evaluateRunning()}updateLoadStatus(e,t){this._index?.updateChildrenLoaded(e,t?1:-1)}async _loadCached(e,t){if(this._enableFromGPUCache(e,1))return!0;let n=this.layerView;if(this.disableIDBCache||!n.loadCachedNodeData||!n.addCachedNodeData)return!1;let r=e.index>=0?(t,n)=>this._nodeLoader.loadTextures(e,t,n):t=>this._clientNodeLoader.loadTextures(e,t),i=await this.schedule(()=>n.loadCachedNodeData(e,t,r),t);if(i==null)return!1;let a=this._requiredAttributes,o=await this.reschedule(()=>this._loadAttributes(e,a,t),t);return await this.reschedule(()=>n.addCachedNodeData(e,i,{loadedAttributes:a,attributeData:o},t),t),this._nodeAdded(),!0}_loadUncached(e,t){return this._downloadingCount++,this._loadNodeData(e,t).then(n=>this.schedule(()=>this.layerView.addNode(e,n,t),t)).finally(()=>this._downloadingCount--).then(()=>{this._nodeAdded(),e.cacheState=2}).catch(t=>{if(!o(t))throw n.getLogger(this).error(`#loadNodeData()`,this.layer,`Failed to load node '${e.id}'`,t),e.failed=!0,this._index?.requestUpdate(),t})}_updateIdleState(e){e!==this._isIdle&&(this._isIdle=e,this._evaluateRunning())}get test(){}notifyLODUpdate(){this._lodHandling.setLodGlobalDirty(),this._evaluateRunning(),this._index!=null&&this._index.requestUpdate()}geometryFilterChanged(e){this._index?.layerFilterChanged(e),this._setCameraDirty()}};e([u({readOnly:!0})],F.prototype,`isMeshPyramid`,null),e([u({readOnly:!0})],F.prototype,`isGraphics3D`,null),e([u({readOnly:!0})],F.prototype,`useMaximumNumberOfFeatures`,null),e([u({readOnly:!0})],F.prototype,`indexRequester`,null),e([u({readOnly:!0})],F.prototype,`dataRequester`,null),e([u({readOnly:!0})],F.prototype,`crsVertex`,null),e([u({readOnly:!0})],F.prototype,`crsIndex`,null),e([u()],F.prototype,`featureTarget`,void 0),e([u()],F.prototype,`fixedFeatureTarget`,void 0),e([u()],F.prototype,`layerView`,void 0),e([u()],F.prototype,`layer`,null),e([u()],F.prototype,`_updatingHandles`,void 0),e([u()],F.prototype,`updating`,null),e([u()],F.prototype,`running`,void 0),e([u()],F.prototype,`updatingProgress`,void 0),e([u({readOnly:!0})],F.prototype,`leavesReached`,void 0),e([u({constructOnly:!0})],F.prototype,`worker`,void 0),e([u({readOnly:!0})],F.prototype,`rootNodeVisible`,null),F=e([d(`esri.layers.graphics.controllers.I3SOnDemandController`)],F);const I=new i({deallocator:null});let L;function R(e,t){return e!=null&&e.length===t.length&&e.every(e=>z(t,e.name)>=0)}function z(e,t){let n=t.toLowerCase();for(let t=0;t<e.length;t++)if(e[t].name.toLowerCase()===n)return t;return-1}const B=h(),V=F;export{V as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{insertSortedStableTopN as e}from"../../../core/arrayUtils.js";import{importLazily as t}from"../../../core/importUtils.js";import{clone as n}from"../../../core/lang.js";import r from"../../../geometry/SpatialReference.js";import{polygonCentroid as i,extentCentroid as a}from"../../../geometry/support/centroid.js";import{getPolygonExtent as o,getGeometryExtent as s,expandExtent as c}from"../../../geometry/support/extentUtils.js";import{toQuantizationTransform as l}from"../../../geometry/support/quantizationUtils.js";import{isValid as u,equals as d}from"../../../geometry/support/spatialReferenceUtils.js";import{closestPointOnCurve as f}from"../../../geometry/support/curves/closestPointOnCurve.js";import{getEndpoint as p,isCoordinate as m,cloneCurve as h}from"../../../geometry/support/curves/curveUtils.js";import g from"./AttributesBuilder.js";import{getGeometry as _,transformCentroid as v}from"./geometryUtils.js";import{project as y}from"./projectionSupport.js";import{getDateInNumber as b}from"./queryUtils.js";import{SnappingCandidateEdge as x,SnappingCandidateVertex as S}from"./SnappingCandidate.js";import{isDateField as C,isDateOnlyField as w,isTimestampOffsetField as T,isStringField as E,isTimeOnlyField as D}from"../../support/fieldUtils.js";import O from"../../../rest/support/AutoIntervalBinParameters.js";import k from"../../../rest/support/DateBinParameters.js";import{unitsDict as A}from"../../../rest/support/DateBinUtils.js";import j from"../../../rest/support/FixedBoundariesBinParameters.js";import M from"../../../rest/support/FixedIntervalBinParameters.js";import{calculateStringStatistics as N,calculateStatistics as P,processSummaryStatisticsResult as F,calculateUniqueValuesCount as I,createUVResult as L,calculateClassBreaks as R,resolveCBResult as z,calculateHistogram as B,calculatePercentile as V,binIndex as H,getBinParams as U,isNullCountSupported as W,getAttributeComparator as G}from"../../../statistics/utils.js";import{utc as K}from"../../../time/constants.js";import{DateTime as q}from"luxon";const J=t(()=>import(`../../../geometry/operators/json/convexHullOperator.js`));class Y{constructor(e,t,n){this.items=e,this.query=t,this.geometryType=n.geometryType,this.hasZ=!!t.returnZ&&n.hasZ,this.hasM=!!t.returnM&&n.hasM,this.fieldsIndex=n.fieldsIndex,this.spatialReference=n.spatialReference,this.featureAdapter=n.featureAdapter,this.featureIdInfo=n.featureIdInfo}get size(){return this.items.length}createQueryResponseForCount(){let e=new g(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);let{groupByFieldsForStatistics:t,having:n,outStatistics:r}=this.query;if(!t?.length)return 1;let i=new Map,a=new Map,o=new Set;for(let s of r){let{statisticType:r}=s,c=r===`exceedslimit`?void 0:s.onStatisticField;if(!a.has(c)){let n=[];for(let r of t){let t=this._getAttributeValues(e,r,this.items,i);n.push(t)}a.set(c,this._calculateUniqueValues(n,this.items,e.returnDistinctValues))}let l=a.get(c);for(let t in l){let{data:r,items:i}=l[t],a=r.join(`,`);(!n||e.validateItems(i,n))&&o.add(a)}}return o.size}async createQueryResponse(){let e;if(e=this.query.outStatistics?this.query.outStatistics.some(e=>e.statisticType===`exceedslimit`)?this._createExceedsLimitQueryResponse():await this._createStatisticsQueryResponse(this.query,this.items):this._createFeatureQueryResponse(this.query),this.query.returnQueryGeometry){let t=this.query.geometry;e.queryGeometry={spatialReference:this.query.outSR,...u(this.query.outSR)&&!d(t.spatialReference,this.query.outSR)?y(t,t.spatialReference,this.query.outSR):t}}return e}createSnappingResponse(e,t,n){let r=this.featureAdapter,{point:i}=e,a=typeof e.distance==`number`?e.distance:e.distance.x,o=typeof e.distance==`number`?e.distance:e.distance.y;function s(e,t){let n=(e-i.x)/a,r=(t-i.y)/o;return n*n+r*r}let c={candidates:[]},l=this.geometryType===`esriGeometryPolygon`,u=this.geometryType===`esriGeometryPolyline`||this.geometryType===`esriGeometryPoint`,d=this._getPointCreator(t,this.spatialReference,n),g=new Q(null,0),_=new Q(null,0),v={x:0,y:0,z:0};for(let e of this.items){let t=r.getObjectId(e),n=r.getGeometryWithCurves?.(e);if(n!=null){b(n,t);continue}let i=r.getGeometry(e);i!=null&&y(i,t)}return c.candidates.sort((e,t)=>e.distance-t.distance),c;function y(t,n){let{coords:r,stride:a}=t,o=t.isPoint?ee:t.lengths;if(g.coords=r,_.coords=r,e.returnEdge){let e=0;for(let t=0;t<o.length;t++){let r=o[t],u=e;for(let t=0;t<r;t++,e+=a){if(!l&&t===r-1||(g.coordsIndex=e,_.coordsIndex=t===r-1?u:e+a,!Z(v,i,g,_)))continue;let o=s(v.x,v.y);o<=1&&c.candidates.push(new x(n,d(v),Math.sqrt(o),d(g),d(_)))}}}if(e.vertexMode===`all`){let e=0;for(let t=0;t<o.length;t++){let r=o[t],i=e,u=_;u.coordsIndex=i;for(let t=0;t<r;t++,e+=a){if(g.coordsIndex=e,l&&t===r-1&&g.x===u.x&&g.y===u.y)continue;let i=s(g.x,g.y);i<=1&&c.candidates.push(new S(n,d(g),Math.sqrt(i)))}}}else if(u&&e.vertexMode===`ends`){let e=0,t=[];for(let n=0;n<o.length;n++){t.push(e);let r=o[n];e+=r*a,r>1&&t.push(e-a)}for(let e of t){g.coordsIndex=e;let t=s(g.x,g.y);t<=1&&c.candidates.push(new S(n,d(g),Math.sqrt(t)))}}}function b(t,n){let{candidates:r}=c,a={x:0,y:0,z:0};if(e.returnEdge){let e=[i.x,i.y],o=new Q(e,0),c=new Q(e,0);for(let{segments:i}of t.parts)for(let{start:t,curve:l}of i){let{curvePoint:i}=f(t,l,e),u=s(...i);if(u>1)continue;[a.x,a.y]=i,o.coords=t,c.coords=p(l);let g=m(l)?null:h(l);r.push(new x(n,d(a),Math.sqrt(u),d(o),d(c),!1,g))}}function o(e){a.x=t.vertexXY[e*2],a.y=t.vertexXY[e*2+1];let i=s(a.x,a.y);i>1||(a.z=t.vertexZ?.[e]??0,r.push(new S(n,d(a),Math.sqrt(i))))}if(e.vertexMode===`all`){let{vertexCount:e}=t;for(let t=0;t<e;++t)o(t)}else if(e.vertexMode===`ends`)switch(t.type){case`point`:o(0);break;case`polyline`:for(let e=0;e<t.partCount;++e){let n=t.partOffsets[e],r=t.partOffsets[e+1]-1;o(n),r!==n&&o(r)}}}}_getPointCreator(e,t,n){let r=n!=null&&!d(t,n)?e=>y(e,t,n):e=>e,{hasZ:i}=this;return i&&e?({x:e,y:t,z:n})=>r({x:e,y:t,z:n}):({x:e,y:t})=>r({x:e,y:t,z:0})}async createSummaryStatisticsResponse(e){let{field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,minValue:o,maxValue:s,scale:c,timeZone:l,outStatisticTypes:u}=e,d=this.fieldsIndex.get(t),f=C(d)||w(d)||T(d),p=await this._getDataValues({field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,scale:c,timeZone:l},this.items),m=W({normalizationType:i,normalizationField:r,minValue:o,maxValue:s}),h={value:.5,fieldType:d?.type},g=E(d)?N({values:p,supportsNullCount:m,percentileParams:h,outStatisticTypes:u}):P({values:p,minValue:o,maxValue:s,useSampleStdDev:!i,supportsNullCount:m,percentileParams:h,outStatisticTypes:u});return F(g,u,f)}async createUniqueValuesResponse(e){let{field:t,valueExpression:n,domains:r,returnAllCodedValues:i,scale:a,timeZone:o}=e,s=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:n,scale:a,timeZone:o},this.items,!1),c=I(s);return L(c,r,i,e.fieldDelimiter)}async createClassBreaksResponse(e){let{field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numClasses:u,scale:d,timeZone:f}=e,p=await this._getDataValues({field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,scale:d,timeZone:f},this.items),m=R(p,{field:t,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numClasses:u});return z(m,o)}async createHistogramResponse(e){let{field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numBins:u,scale:d,timeZone:f}=e,p=await this._getDataValues({field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,scale:d,timeZone:f},this.items);return B(p,{field:t,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numBins:u})}_sortFeatures(e,t,n){if(e.length>1&&t?.length)for(let r of t.slice().reverse()){let{compare:t,fieldOrExpression:i,fieldInfo:a}=$(r,this.fieldsIndex);e.sort((e,r)=>t(n(e,i,a),n(r,i,a)))}}_topNFeatures(t,n,r,i){if(t.length>1&&n?.length){let a=n.map(e=>{let{compare:t,fieldOrExpression:n,fieldInfo:r}=$(e,this.fieldsIndex);return(e,a)=>t(i(e,n,r),i(a,n,r))}).reduceRight((e,t)=>(n,r)=>{let i=t(n,r);return i!==0&&!Number.isNaN(i)?i:e(n,r)}),o=[];for(let n of t)e(o,n,r,a);return o}return t.slice(0,r)}_createFeatureQueryResponse(e){let{items:t,geometryType:n,hasM:r,hasZ:i,featureIdInfo:a,spatialReference:o}=this,{outFields:s,outSR:c,quantizationParameters:u,resultRecordCount:d,resultOffset:f,returnZ:p,returnM:m}=e,h=d!=null&&t.length>(f||0)+d,g=s&&(s.includes(`*`)?[...this.fieldsIndex.fields]:s.map(e=>this.fieldsIndex.get(e)));return{exceededTransferLimit:h,features:this._createFeatures(e,t),fields:g,geometryType:n,hasM:r&&m,hasZ:i&&p,objectIdFieldName:a.type===`object-id`?a.fieldName:null,spatialReference:c||o,transform:u&&l(u)||null}}_createFeatures(e,t){let n=new g(e,this.featureAdapter,this.fieldsIndex),{hasM:r,hasZ:i}=this,{orderByFields:a,quantizationParameters:o,returnGeometry:s,returnCentroid:c,maxAllowableOffset:u,resultOffset:d,resultRecordCount:f,returnZ:p=!1,returnM:m=!1}=e,h=i&&p,y=r&&m,b,x=d||0,S=f==null?null:x+f;S!=null&&S<=5e3&&S<t.length?b=this._topNFeatures(t,a,S,(e,t,r)=>n.getFieldValue(e,t,r)):(b=[...t],this._sortFeatures(b,a,(e,t,r)=>n.getFieldValue(e,t,r))),(x>0||S!=null)&&(b=b.slice(x,S??void 0));let C=[],w=0;if(!this.geometryType||!s&&!c)for(let e of b){let t=n.getAttributes(e);t&&(C[w++]=this._addFeatureJSONMetadata(e,{attributes:t}))}else{let e=l(o)??void 0,t=this.geometryType===`esriGeometryPolygon`||this.geometryType===`esriGeometryPolyline`;if(s&&!c)for(let r of b){let i=this.featureAdapter.getGeometry(r),a=this._addFeatureJSONMetadata(r,{attributes:n.getAttributes(r),geometry:_(this.geometryType,i,u,e,h,y)});t&&i&&!a.geometry&&(a.centroid=v(this,this.featureAdapter.getCentroid(r,this),e)),C[w++]=a}else if(!s&&c)for(let t of b)C[w++]=this._addFeatureJSONMetadata(t,{attributes:n.getAttributes(t),centroid:v(this,this.featureAdapter.getCentroid(t,this),e)});else for(let t of b)C[w++]=this._addFeatureJSONMetadata(t,{attributes:n.getAttributes(t),centroid:v(this,this.featureAdapter.getCentroid(t,this),e),geometry:_(this.geometryType,this.featureAdapter.getGeometry(t),u,e,h,y)})}return C}_addFeatureJSONMetadata(e,t){let n=this.featureAdapter.getMetadata?.(e);return n!==void 0&&(t.metadata=n),t}_createExceedsLimitQueryResponse(){let e=!1,t=1/0,n=1/0,r=1/0;for(let e of this.query.outStatistics??[])if(e.statisticType===`exceedslimit`){t=e.maxPointCount==null?1/0:e.maxPointCount,n=e.maxRecordCount==null?1/0:e.maxRecordCount,r=e.maxVertexCount==null?1/0:e.maxVertexCount;break}return e=this.geometryType===`esriGeometryPoint`?this.items.length>t:this.items.length>n||this.items.reduce((e,t)=>e+(this.featureAdapter.getGeometry(t)?.size??0),0)>r,{fields:[{name:`exceedslimit`,type:`esriFieldTypeInteger`,alias:`exceedslimit`,sqlType:`sqlTypeInteger`,domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(e)}}]}}async _createStatisticsQueryResponse(e,t,n={attributes:{}}){let r=[],i=new Map,a=new Map,o=new Map,s=new Map,c=new g(e,this.featureAdapter,this.fieldsIndex),l=e.outStatistics,{groupByFieldsForStatistics:u,having:d,orderByFields:f,resultRecordCount:p}=e,m=u?.length,h=!!m,_=h?u[0]:null,v=h&&!this.fieldsIndex.get(_);for(let f of l??[]){let{outStatisticFieldName:l,statisticType:p}=f,g=f,y=p===`exceedslimit`?void 0:f.onStatisticField,b=p===`percentile_disc`||p===`percentile_cont`,x=p===`EnvelopeAggregate`||p===`CentroidAggregate`||p===`ConvexHullAggregate`,S=h&&m===1&&(y===_||v)&&p===`count`;if(h){if(!o.has(y)){let e=[];for(let n of u){let r=this._getAttributeValues(c,n,t,i);e.push(r)}o.set(y,this._calculateUniqueValues(e,t,!x&&c.returnDistinctValues))}let n=o.get(y);if(!n)continue;let r=Object.keys(n);for(let a of r){let{count:r,data:o,items:f,itemPositions:p}=n[a],m=o.join(`,`);if(!d||c.validateItems(f,d)){let n=s.get(m)||{attributes:{}};if(e.returnAggIds&&(n.aggregateIds=f.map(e=>this.featureAdapter.getObjectId(e)).filter(e=>e!=null)),x){n.aggregateGeometries||={};let{aggregateGeometries:e,outStatisticFieldName:t}=await this._getAggregateGeometry(g,f);n.aggregateGeometries[t]=e}else{let e=null;if(S)e=r;else{let n=this._getAttributeValues(c,y,t,i),r=p.map(e=>n[e]);e=b&&`statisticParameters`in g?this._getPercentileValue(g,r):this._getStatisticValue(g,r,null,c.returnDistinctValues)}n.attributes[l]=e}let a=0;u.forEach((e,t)=>n.attributes[this.fieldsIndex.get(e)?e:`EXPR_${++a}`]=o[t]),s.set(m,n)}}}else if(x){n.aggregateGeometries||={};let{aggregateGeometries:e,outStatisticFieldName:r}=await this._getAggregateGeometry(g,t);n.aggregateGeometries[r]=e}else{let e=this._getAttributeValues(c,y,t,i);n.attributes[l]=b&&`statisticParameters`in g?this._getPercentileValue(g,e):this._getStatisticValue(g,e,a,c.returnDistinctValues)}let C=(p===`min`||p===`max`)&&(E(this.fieldsIndex.get(y))||this._isAnyDateField(y))?this.fieldsIndex.get(y)?.type:null;r.push({name:l,alias:l,type:C||`esriFieldTypeDouble`})}let y=h?Array.from(s.values()):[n];return this._sortFeatures(y,f,(e,t)=>e.attributes[t]),p&&(y.length=Math.min(p,y.length)),{fields:r,features:y}}_isAnyDateField(e){let t=this.fieldsIndex.get(e);return C(t)||w(t)||T(t)||D(t)}async _getAggregateGeometry(e,t){let{statisticType:n,outStatisticFieldName:r}=e,{featureAdapter:s,spatialReference:c,geometryType:l}=this,u=t.map(e=>_(l,s.getGeometry(e))),d={aggregateGeometries:null,outStatisticFieldName:null},{convexHullExecuteMany:f}=await J.getImportPromise(),[p]=f(u,{merge:!0});if(p&&p.rings[0].length<=3&&(p=null),n===`EnvelopeAggregate`)d.aggregateGeometries={...p?o(p):X(u),spatialReference:c},d.outStatisticFieldName=r||`extent`;else if(n===`CentroidAggregate`){let[e,t]=p?i(p):a(X(u));d.aggregateGeometries={x:e,y:t,spatialReference:c},d.outStatisticFieldName=r||`centroid`}else n===`ConvexHullAggregate`&&(d.aggregateGeometries=p&&{...p,spatialReference:c},d.outStatisticFieldName=r||`convexHull`);return d}_getStatisticValue(e,t,n,r){let{onStatisticField:i,statisticType:a}=e,o=null;return o=n?.has(i)?n.get(i):E(this.fieldsIndex.get(i))||this._isAnyDateField(i)?N({values:t,returnDistinct:r}):P({values:r?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),n&&n.set(i,o),o[a===`var`?`variance`:a]}_getPercentileValue(e,t){let{onStatisticField:n,statisticParameters:r,statisticType:i}=e,{value:a,orderBy:o}=r,s={value:a,orderBy:o,fieldType:this.fieldsIndex.get(n)?.type,isDiscrete:i===`percentile_disc`};return V(t,s)}_getAttributeValues(e,t,n,r){if(r.has(t))return r.get(t);let i=this.fieldsIndex.get(t),a=n.map(n=>e.getFieldValue(n,t,i));return r.set(t,a),a}_calculateUniqueValues(e,t,n){let r={},i=t.length;for(let a=0;a<i;a++){let i=t[a],o=[];for(let t of e)o.push(t[a]);let s=o.join(`,`);r[s]==null?r[s]={count:1,data:o,items:[i],itemPositions:[a]}:(n||r[s].count++,r[s].items.push(i),r[s].itemPositions.push(a))}return r}async _getDataValues(e,t,i=!0){let a=new g(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:o,scale:s,timeZone:c}=e,l=r.fromJSON(this.query.outSR||this.spatialReference);return o?a.getExpressionValues(t,o,{viewingMode:`map`,scale:s,spatialReference:l},{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM},c):a.getDataValues(t,n(e),i)}_calculateHistogramBins(e,t,n){if(t.min==null&&t.max==null)return[];let r=t.intervals,i=t.min??0,a=t.max??0,o=r.map(([e,t])=>({minValue:e,maxValue:t,count:0,items:[]}));for(let t=0;t<e.length;t++){let s=e[t],c=n[t];if(s!=null&&s>=i&&s<=a){let e=H(r,s);e>-1&&(o[e].count++,o[e].items.push(c))}}return o}async createQueryBinsResponse(e){let t=e.bin?.splitBy;if(!t)return this._createBinsResponse(e);let{value:n,outAlias:r,valueType:i}=t,a=[],o=[{name:r??n,alias:r??n,type:i??`esriFieldTypeString`},{name:`bin`,alias:`bin`,type:`esriFieldTypeInteger`}],s=new g(e,this.featureAdapter,this.fieldsIndex),c=new Map,l=[...this.items];this._sortFeatures(l,[n],(e,t,n)=>s.getFieldValue(e,t,n));let u=this._getAttributeValues(s,n,l,c),d=this._calculateUniqueValues([u],l,s.returnDistinctValues);for(let t in d){let{items:i}=d[t],s=await this._createBinsResponse(e,i);if(a.push(...s.features.map(e=>({...e,attributes:{...e.attributes,[r??n]:t}}))),s.fields)for(let e of s.fields)o.some(t=>t.name===e.name)||o.push(e)}return{fields:o,features:a}}async _createBinsResponse(e,t){let n=e.bin;switch(t??=this.items,n.type){case`autoIntervalBin`:return this._createAutoIntervalBinsResponse(O.fromJSON(n),e,t);case`dateBin`:return this._createDateBinsResponse(k.fromJSON(n),e,t);case`fixedBoundariesBin`:return this._createFixedBoundariesBinsResponse(j.fromJSON(n),e,t);case`fixedIntervalBin`:return this._createFixedIntervalBinsResponse(M.fromJSON(n),e,t)}}async _createAutoIntervalBinsResponse(e,t,n){let{field:r,normalizationField:i,numBins:a,normalizationType:o,normalizationTotal:s,start:c,end:l}=e,u=await this._getDataValues({field:e.field||e.expression,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},n),d=U(u,{field:r,normalizationField:i,normalizationType:o,normalizationTotal:s,numBins:a,minValue:b(o?e.normalizationMinValue:c,!1),maxValue:b(o?e.normalizationMaxValue:l,!1)}),f=this._calculateHistogramBins(u,d,n);return this._createFeaturesFromHistogramBins(f,t)}async _createDateBinsResponse(e,t,n){let{field:r,interval:i,start:a,end:o,snapToData:s,returnFullIntervalBin:c,offset:l,firstDayOfWeek:u}=e,d=i.unit,f=await this._getDataValues({field:r||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},n),p=D(this.fieldsIndex.get(r)),m=A.toJSON(d),h=f.filter(Boolean).sort((e,t)=>e-t),g=a==null?h[0]:b(a,p),_=o==null?h[h.length-1]:b(o,p),v=[];if(g!=null&&_!=null){let e={zone:t.outTimeReference?.ianaTimeZone??K},n={[l?.unit?A.toJSON(l.unit):`milliseconds`]:l?.value||0},r=q.fromMillis(g,e).minus(n),a=q.fromMillis(_,e).minus(n),o=typeof u==`number`&&u>=1&&u<=7?u:7,d=(e,t)=>{let n=(e.weekday-t+7)%7;return e.minus({days:n}).startOf(`day`)},f=(e,t)=>d(e,t).plus({days:7});if(s===`last`){let e=m===`week`?f(a,o):a;for(;e>r;){let t=e.minus({[m]:i.value});if(t<r){v.unshift([c?t.plus(n).toMillis():r.plus(n).toMillis(),e.plus(n).toMillis()]);break}v.unshift([t.plus(n).toMillis(),e.plus(n).toMillis()]),e=t}}else{let e=s===`first`?r:m===`week`?d(r,o):r.startOf(m);for(;e<=a;){let t=e.plus({[m]:i.value});if(t>a){v.push([e.plus(n).toMillis(),c?t.plus(n).toMillis():a.plus(n).toMillis()]);break}v.push([e.plus(n).toMillis(),t.plus(n).toMillis()]),e=t}}}let y=this._calculateHistogramBins(f,{intervals:v,min:g,max:_},n);return this._createFeaturesFromHistogramBins(y,t)}async _createFixedBoundariesBinsResponse(e,t,n){let{field:r}=e,i=await this._getDataValues({field:r||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},n),a=D(this.fieldsIndex.get(r)),o=e.boundaries.map(e=>b(e,a)).sort((e,t)=>e-t),s=[];for(let e=0;e<o.length-1;e++)s.push([o[e],o[e+1]]);let c={intervals:s,min:o.at(0),max:o.at(-1)},l=this._calculateHistogramBins(i,c,n);return this._createFeaturesFromHistogramBins(l,t)}async _createFixedIntervalBinsResponse(e,t,n){let{field:r,interval:i,normalizationType:a,start:o,end:s}=e,c=await this._getDataValues({field:r||e.expression,normalizationField:e.normalizationField,normalizationType:a,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},n),l=D(this.fieldsIndex.get(r)),u=U(c,{field:r,classificationMethod:`defined-interval`,definedInterval:i,minValue:b(a?e.normalizationMinValue:o,l),maxValue:b(a?e.normalizationMaxValue:s,l)},!0),d=this._calculateHistogramBins(c,u,n);return this._createFeaturesFromHistogramBins(d,t)}async _createFeaturesFromHistogramBins(e,t){let{upperBoundaryAlias:n,lowerBoundaryAlias:r}=t,i=r||`lowerBoundary`,a=n||`upperBoundary`,o=[],s=[{name:i,alias:i,type:`esriFieldTypeDouble`},{name:a,alias:a,type:`esriFieldTypeDouble`}],c=t.bin?.stackBy?.value,l=t.bin?.stackBy?.outAlias;c&&s.push({name:`bin`,alias:`bin`,type:`esriFieldTypeInteger`},{name:l??c,alias:l??c,type:`esriFieldTypeString`});let u=0,d=t.bin.type===`dateBin`,f=t.outTimeReference?.ianaTimeZone;for(let n of e){let{minValue:e,maxValue:r,items:p}=n,m={attributes:{}};m.attributes[i]=d&&f&&e!=null?q.fromMillis(e,{zone:f}).toISO():e,t.bin.hideUpperBound||(m.attributes[a]=d&&f&&r!=null?q.fromMillis(r,{zone:f}).toISO():r),t.returnAggIds&&(m.aggregateIds=p.map(e=>this.featureAdapter.getObjectId(e)).filter(e=>e!=null));let h;if(c?(h=await this._createStatisticsQueryResponse({...t,groupByFieldsForStatistics:[c],orderByFields:[c]},p),m.attributes.bin=++u,t.bin.jsonStyle===`flat`?o.push(...h.features.map(({attributes:{EXPR_1:e,...t},...n})=>({...n,attributes:l??e?{...t,[l??e]:e,...m.attributes}:{...t,...m.attributes}}))):(m.stackedAttributes=h.features.map(({attributes:{EXPR_1:e,...t}})=>l??e?{...t,[l??e]:e}:t),o.push(m))):(t.bin?.splitBy&&(m.attributes.bin=++u),h=await this._createStatisticsQueryResponse(t,p,m),o.push(m)),h.fields)for(let e of h.fields)s.some(t=>t.name===e.name)||s.push(e)}return t.binOrder===`desc`&&o.reverse(),{fields:s,features:o}}}function X(e){let t=s(e[0]);for(let n of e.slice(1))c(t,s(n));return t}function Z(e,t,n,r){let i=r.x-n.x,a=r.y-n.y,o=t.x-n.x,s=t.y-n.y,c=i*i+a*a;if(c===0)return!1;let l=o*i+s*a,u=Math.min(1,Math.max(0,l/c));return e.x=n.x+i*u,e.y=n.y+a*u,!0}class Q{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 ee=[1];function $(e,t){let n=e.split(` `),r=n[0],i=t.get(r),a=n[1]?n[1].toLowerCase()===`desc`:!1;return{compare:G(i?.type,a,`case-insensitive`),fieldOrExpression:r,fieldInfo:i}}export{Y as QueryEngineResult};
|
|
2
|
+
import{insertSortedStableTopN as e}from"../../../core/arrayUtils.js";import{importLazily as t}from"../../../core/importUtils.js";import{clone as n}from"../../../core/lang.js";import r from"../../../geometry/SpatialReference.js";import{polygonCentroid as i,extentCentroid as a}from"../../../geometry/support/centroid.js";import{getPolygonExtent as o,getGeometryExtent as s,expandExtent as c}from"../../../geometry/support/extentUtils.js";import{toQuantizationTransform as l}from"../../../geometry/support/quantizationUtils.js";import{isValid as u,equals as d}from"../../../geometry/support/spatialReferenceUtils.js";import{closestPointOnCurve as f}from"../../../geometry/support/curves/closestPointOnCurve.js";import{getEndpoint as p,isCoordinate as m,cloneCurve as h}from"../../../geometry/support/curves/curveUtils.js";import g from"./AttributesBuilder.js";import{getGeometry as _,transformCentroid as v}from"./geometryUtils.js";import{project as y}from"./projectionSupport.js";import{getDateInNumber as b}from"./queryUtils.js";import{SnappingCandidateEdge as x,SnappingCandidateVertex as S}from"./SnappingCandidate.js";import{isDateField as C,isDateOnlyField as w,isTimestampOffsetField as T,isStringField as E,isTimeOnlyField as D}from"../../support/fieldUtils.js";import O from"../../../rest/support/AutoIntervalBinParameters.js";import k from"../../../rest/support/DateBinParameters.js";import{unitsDict as A}from"../../../rest/support/DateBinUtils.js";import j from"../../../rest/support/FixedBoundariesBinParameters.js";import M from"../../../rest/support/FixedIntervalBinParameters.js";import{isNullCountSupported as N,calculateStringStatistics as P,calculateStatistics as F,processSummaryStatisticsResult as I,calculateUniqueValuesCount as L,createUVResult as R,calculateClassBreaks as z,resolveCBResult as B,calculateHistogram as V,calculatePercentile as H,binIndex as U,getBinParams as W,getAttributeComparator as G}from"../../../statistics/utils.js";import{utc as K}from"../../../time/constants.js";import{DateTime as q}from"luxon";const J=t(()=>import(`../../../geometry/operators/json/convexHullOperator.js`));class Y{constructor(e,t,n){this.items=e,this.query=t,this.geometryType=n.geometryType,this.hasZ=!!t.returnZ&&n.hasZ,this.hasM=!!t.returnM&&n.hasM,this.fieldsIndex=n.fieldsIndex,this.spatialReference=n.spatialReference,this.featureAdapter=n.featureAdapter,this.featureIdInfo=n.featureIdInfo}get size(){return this.items.length}createQueryResponseForCount(){let e=new g(this.query,this.featureAdapter,this.fieldsIndex);if(!this.query.outStatistics)return e.countDistinctValues(this.items);let{groupByFieldsForStatistics:t,having:n,outStatistics:r}=this.query;if(!t?.length)return 1;let i=new Map,a=new Map,o=new Set;for(let s of r){let{statisticType:r}=s,c=r===`exceedslimit`?void 0:s.onStatisticField;if(!a.has(c)){let n=[];for(let r of t){let t=this._getAttributeValues(e,r,this.items,i);n.push(t)}a.set(c,this._calculateUniqueValues(n,this.items,e.returnDistinctValues))}let l=a.get(c);for(let t in l){let{data:r,items:i}=l[t],a=r.join(`,`);(!n||e.validateItems(i,n))&&o.add(a)}}return o.size}async createQueryResponse(){let e;if(e=this.query.outStatistics?this.query.outStatistics.some(e=>e.statisticType===`exceedslimit`)?this._createExceedsLimitQueryResponse():await this._createStatisticsQueryResponse(this.query,this.items):this._createFeatureQueryResponse(this.query),this.query.returnQueryGeometry){let t=this.query.geometry;e.queryGeometry={spatialReference:this.query.outSR,...u(this.query.outSR)&&!d(t.spatialReference,this.query.outSR)?y(t,t.spatialReference,this.query.outSR):t}}return e}createSnappingResponse(e,t,n){let r=this.featureAdapter,{point:i}=e,a=typeof e.distance==`number`?e.distance:e.distance.x,o=typeof e.distance==`number`?e.distance:e.distance.y;function s(e,t){let n=(e-i.x)/a,r=(t-i.y)/o;return n*n+r*r}let c={candidates:[]},l=this.geometryType===`esriGeometryPolygon`,u=this.geometryType===`esriGeometryPolyline`||this.geometryType===`esriGeometryPoint`,d=this._getPointCreator(t,this.spatialReference,n),g=new Q(null,0),_=new Q(null,0),v={x:0,y:0,z:0};for(let e of this.items){let t=r.getObjectId(e),n=r.getGeometryWithCurves?.(e);if(n!=null){b(n,t);continue}let i=r.getGeometry(e);i!=null&&y(i,t)}return c.candidates.sort((e,t)=>e.distance-t.distance),c;function y(t,n){let{coords:r,stride:a}=t,o=t.isPoint?ee:t.lengths;if(g.coords=r,_.coords=r,e.returnEdge){let e=0;for(let t=0;t<o.length;t++){let r=o[t],u=e;for(let t=0;t<r;t++,e+=a){if(!l&&t===r-1||(g.coordsIndex=e,_.coordsIndex=t===r-1?u:e+a,!Z(v,i,g,_)))continue;let o=s(v.x,v.y);o<=1&&c.candidates.push(new x(n,d(v),Math.sqrt(o),d(g),d(_)))}}}if(e.vertexMode===`all`){let e=0;for(let t=0;t<o.length;t++){let r=o[t],i=e,u=_;u.coordsIndex=i;for(let t=0;t<r;t++,e+=a){if(g.coordsIndex=e,l&&t===r-1&&g.x===u.x&&g.y===u.y)continue;let i=s(g.x,g.y);i<=1&&c.candidates.push(new S(n,d(g),Math.sqrt(i)))}}}else if(u&&e.vertexMode===`ends`){let e=0,t=[];for(let n=0;n<o.length;n++){t.push(e);let r=o[n];e+=r*a,r>1&&t.push(e-a)}for(let e of t){g.coordsIndex=e;let t=s(g.x,g.y);t<=1&&c.candidates.push(new S(n,d(g),Math.sqrt(t)))}}}function b(t,n){let{candidates:r}=c,a={x:0,y:0,z:0};if(e.returnEdge){let e=[i.x,i.y],o=new Q(e,0),c=new Q(e,0);for(let{segments:i}of t.parts)for(let{start:t,curve:l}of i){let{curvePoint:i}=f(t,l,e),u=s(...i);if(u>1)continue;[a.x,a.y]=i,o.coords=t,c.coords=p(l);let g=m(l)?null:h(l);r.push(new x(n,d(a),Math.sqrt(u),d(o),d(c),!1,g))}}function o(e){a.x=t.vertexXY[e*2],a.y=t.vertexXY[e*2+1];let i=s(a.x,a.y);i>1||(a.z=t.vertexZ?.[e]??0,r.push(new S(n,d(a),Math.sqrt(i))))}if(e.vertexMode===`all`){let{vertexCount:e}=t;for(let t=0;t<e;++t)o(t)}else if(e.vertexMode===`ends`)switch(t.type){case`point`:o(0);break;case`polyline`:for(let e=0;e<t.partCount;++e){let n=t.partOffsets[e],r=t.partOffsets[e+1]-1;o(n),r!==n&&o(r)}}}}_getPointCreator(e,t,n){let r=n!=null&&!d(t,n)?e=>y(e,t,n):e=>e,{hasZ:i}=this;return i&&e?({x:e,y:t,z:n})=>r({x:e,y:t,z:n}):({x:e,y:t})=>r({x:e,y:t,z:0})}async createSummaryStatisticsResponse(e){let{field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,minValue:o,maxValue:s,scale:c,timeZone:l,outStatisticTypes:u}=e,d=this.fieldsIndex.get(t),f=C(d)||w(d)||T(d),p=await this._getDataValues({field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,scale:c,timeZone:l},this.items),m=N({normalizationType:i,normalizationField:r,minValue:o,maxValue:s}),h={value:.5,fieldType:d?.type},g=E(d)?P({values:p,supportsNullCount:m,percentileParams:h,outStatisticTypes:u}):F({values:p,minValue:o,maxValue:s,useSampleStdDev:!i,supportsNullCount:m,percentileParams:h,outStatisticTypes:u});return I(g,u,f)}async createUniqueValuesResponse(e){let{field:t,valueExpression:n,domains:r,returnAllCodedValues:i,scale:a,timeZone:o}=e,s=await this._getDataValues({field:t,field2:e.field2,field3:e.field3,fieldDelimiter:e.fieldDelimiter,valueExpression:n,scale:a,timeZone:o},this.items,!1),c=L(s);return R(c,r,i,e.fieldDelimiter)}async createClassBreaksResponse(e){let{field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numClasses:u,scale:d,timeZone:f}=e,p=await this._getDataValues({field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,scale:d,timeZone:f},this.items),m=z(p,{field:t,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numClasses:u});return B(m,o)}async createHistogramResponse(e){let{field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numBins:u,scale:d,timeZone:f}=e,p=await this._getDataValues({field:t,valueExpression:n,normalizationField:r,normalizationType:i,normalizationTotal:a,scale:d,timeZone:f},this.items);return V(p,{field:t,normalizationField:r,normalizationType:i,normalizationTotal:a,classificationMethod:o,standardDeviationInterval:s,minValue:c,maxValue:l,numBins:u})}_sortFeatures(e,t,n){if(e.length>1&&t?.length)for(let r of t.slice().reverse()){let{compare:t,fieldOrExpression:i,fieldInfo:a}=$(r,this.fieldsIndex);e.sort((e,r)=>t(n(e,i,a),n(r,i,a)))}}_topNFeatures(t,n,r,i){if(t.length>1&&n?.length){let a=n.map(e=>{let{compare:t,fieldOrExpression:n,fieldInfo:r}=$(e,this.fieldsIndex);return(e,a)=>t(i(e,n,r),i(a,n,r))}).reduceRight((e,t)=>(n,r)=>{let i=t(n,r);return i!==0&&!Number.isNaN(i)?i:e(n,r)}),o=[];for(let n of t)e(o,n,r,a);return o}return t.slice(0,r)}_createFeatureQueryResponse(e){let{items:t,geometryType:n,hasM:r,hasZ:i,featureIdInfo:a,spatialReference:o}=this,{outFields:s,outSR:c,quantizationParameters:u,resultRecordCount:d,resultOffset:f,returnZ:p,returnM:m}=e,h=d!=null&&t.length>(f||0)+d,g=s&&(s.includes(`*`)?[...this.fieldsIndex.fields]:s.map(e=>this.fieldsIndex.get(e)));return{exceededTransferLimit:h,features:this._createFeatures(e,t),fields:g,geometryType:n,hasM:r&&m,hasZ:i&&p,objectIdFieldName:a.type===`object-id`?a.fieldName:null,spatialReference:c||o,transform:u&&l(u)||null}}_createFeatures(e,t){let n=new g(e,this.featureAdapter,this.fieldsIndex),{hasM:r,hasZ:i}=this,{orderByFields:a,quantizationParameters:o,returnGeometry:s,returnCentroid:c,maxAllowableOffset:u,resultOffset:d,resultRecordCount:f,returnZ:p=!1,returnM:m=!1}=e,h=i&&p,y=r&&m,b,x=d||0,S=f==null?null:x+f;S!=null&&S<=5e3&&S<t.length?b=this._topNFeatures(t,a,S,(e,t,r)=>n.getFieldValue(e,t,r)):(b=[...t],this._sortFeatures(b,a,(e,t,r)=>n.getFieldValue(e,t,r))),(x>0||S!=null)&&(b=b.slice(x,S??void 0));let C=[],w=0;if(!this.geometryType||!s&&!c)for(let e of b){let t=n.getAttributes(e);t&&(C[w++]=this._addFeatureJSONMetadata(e,{attributes:t}))}else{let e=l(o)??void 0,t=this.geometryType===`esriGeometryPolygon`||this.geometryType===`esriGeometryPolyline`;if(s&&!c)for(let r of b){let i=this.featureAdapter.getGeometry(r),a=this._addFeatureJSONMetadata(r,{attributes:n.getAttributes(r),geometry:_(this.geometryType,i,u,e,h,y)});t&&i&&!a.geometry&&(a.centroid=v(this,this.featureAdapter.getCentroid(r,this),e)),C[w++]=a}else if(!s&&c)for(let t of b)C[w++]=this._addFeatureJSONMetadata(t,{attributes:n.getAttributes(t),centroid:v(this,this.featureAdapter.getCentroid(t,this),e)});else for(let t of b)C[w++]=this._addFeatureJSONMetadata(t,{attributes:n.getAttributes(t),centroid:v(this,this.featureAdapter.getCentroid(t,this),e),geometry:_(this.geometryType,this.featureAdapter.getGeometry(t),u,e,h,y)})}return C}_addFeatureJSONMetadata(e,t){let n=this.featureAdapter.getMetadata?.(e);return n!==void 0&&(t.metadata=n),t}_createExceedsLimitQueryResponse(){let e=!1,t=1/0,n=1/0,r=1/0;for(let e of this.query.outStatistics??[])if(e.statisticType===`exceedslimit`){t=e.maxPointCount==null?1/0:e.maxPointCount,n=e.maxRecordCount==null?1/0:e.maxRecordCount,r=e.maxVertexCount==null?1/0:e.maxVertexCount;break}return e=this.geometryType===`esriGeometryPoint`?this.items.length>t:this.items.length>n||this.items.reduce((e,t)=>e+(this.featureAdapter.getGeometry(t)?.size??0),0)>r,{fields:[{name:`exceedslimit`,type:`esriFieldTypeInteger`,alias:`exceedslimit`,sqlType:`sqlTypeInteger`,domain:null,defaultValue:null}],features:[{attributes:{exceedslimit:Number(e)}}]}}async _createStatisticsQueryResponse(e,t,n={attributes:{}}){let r=[],i=new Map,a=new Map,o=new Map,s=new Map,c=new g(e,this.featureAdapter,this.fieldsIndex),l=e.outStatistics,{groupByFieldsForStatistics:u,having:d,orderByFields:f,resultRecordCount:p}=e,m=u?.length,h=!!m,_=h?u[0]:null,v=h&&!this.fieldsIndex.get(_);for(let f of l??[]){let{outStatisticFieldName:l,statisticType:p}=f,g=f,y=p===`exceedslimit`?void 0:f.onStatisticField,b=p===`percentile_disc`||p===`percentile_cont`,x=p===`EnvelopeAggregate`||p===`CentroidAggregate`||p===`ConvexHullAggregate`,S=h&&m===1&&(y===_||v)&&p===`count`;if(h){if(!o.has(y)){let e=[];for(let n of u){let r=this._getAttributeValues(c,n,t,i);e.push(r)}o.set(y,this._calculateUniqueValues(e,t,!x&&c.returnDistinctValues))}let n=o.get(y);if(!n)continue;let r=Object.keys(n);for(let a of r){let{count:r,data:o,items:f,itemPositions:p}=n[a],m=o.join(`,`);if(!d||c.validateItems(f,d)){let n=s.get(m)||{attributes:{}};if(e.returnAggIds&&(n.aggregateIds=f.map(e=>this.featureAdapter.getObjectId(e)).filter(e=>e!=null)),x){n.aggregateGeometries||={};let{aggregateGeometries:e,outStatisticFieldName:t}=await this._getAggregateGeometry(g,f);n.aggregateGeometries[t]=e}else{let e=null;if(S)e=r;else{let n=this._getAttributeValues(c,y,t,i),r=p.map(e=>n[e]);e=b&&`statisticParameters`in g?this._getPercentileValue(g,r):this._getStatisticValue(g,r,null,c.returnDistinctValues)}n.attributes[l]=e}let a=0;u.forEach((e,t)=>n.attributes[this.fieldsIndex.get(e)?e:`EXPR_${++a}`]=o[t]),s.set(m,n)}}}else if(x){n.aggregateGeometries||={};let{aggregateGeometries:e,outStatisticFieldName:r}=await this._getAggregateGeometry(g,t);n.aggregateGeometries[r]=e}else{let e=this._getAttributeValues(c,y,t,i);n.attributes[l]=b&&`statisticParameters`in g?this._getPercentileValue(g,e):this._getStatisticValue(g,e,a,c.returnDistinctValues)}let C=(p===`min`||p===`max`)&&(E(this.fieldsIndex.get(y))||this._isAnyDateField(y))?this.fieldsIndex.get(y)?.type:null;r.push({name:l,alias:l,type:C||`esriFieldTypeDouble`})}let y=h?Array.from(s.values()):[n];return this._sortFeatures(y,f,(e,t)=>e.attributes[t]),p&&(y.length=Math.min(p,y.length)),{fields:r,features:y}}_isAnyDateField(e){let t=this.fieldsIndex.get(e);return C(t)||w(t)||T(t)||D(t)}async _getAggregateGeometry(e,t){let{statisticType:n,outStatisticFieldName:r}=e,{featureAdapter:s,spatialReference:c,geometryType:l}=this,u=t.map(e=>_(l,s.getGeometry(e))),d={aggregateGeometries:null,outStatisticFieldName:null},{convexHullExecuteMany:f}=await J.getImportPromise(),[p]=f(u,{merge:!0});if(p&&p.rings[0].length<=3&&(p=null),n===`EnvelopeAggregate`)d.aggregateGeometries={...p?o(p):X(u),spatialReference:c},d.outStatisticFieldName=r||`extent`;else if(n===`CentroidAggregate`){let[e,t]=p?i(p):a(X(u));d.aggregateGeometries={x:e,y:t,spatialReference:c},d.outStatisticFieldName=r||`centroid`}else n===`ConvexHullAggregate`&&(d.aggregateGeometries=p&&{...p,spatialReference:c},d.outStatisticFieldName=r||`convexHull`);return d}_getStatisticValue(e,t,n,r){let{onStatisticField:i,statisticType:a}=e,o=null;return o=n?.has(i)?n.get(i):E(this.fieldsIndex.get(i))||this._isAnyDateField(i)?P({values:t,returnDistinct:r}):F({values:r?[...new Set(t)]:t,minValue:null,maxValue:null,useSampleStdDev:!0}),n&&n.set(i,o),o[a===`var`?`variance`:a]}_getPercentileValue(e,t){let{onStatisticField:n,statisticParameters:r,statisticType:i}=e,{value:a,orderBy:o}=r,s={value:a,orderBy:o,fieldType:this.fieldsIndex.get(n)?.type,isDiscrete:i===`percentile_disc`};return H(t,s)}_getAttributeValues(e,t,n,r){if(r.has(t))return r.get(t);let i=this.fieldsIndex.get(t),a=n.map(n=>e.getFieldValue(n,t,i));return r.set(t,a),a}_calculateUniqueValues(e,t,n){let r={},i=t.length;for(let a=0;a<i;a++){let i=t[a],o=[];for(let t of e)o.push(t[a]);let s=o.join(`,`);r[s]==null?r[s]={count:1,data:o,items:[i],itemPositions:[a]}:(n||r[s].count++,r[s].items.push(i),r[s].itemPositions.push(a))}return r}async _getDataValues(e,t,i=!0){let a=new g(this.query,this.featureAdapter,this.fieldsIndex),{valueExpression:o,scale:s,timeZone:c}=e,l=r.fromJSON(this.query.outSR||this.spatialReference);return o?a.getExpressionValues(t,o,{viewingMode:`map`,scale:s,spatialReference:l},{geometryType:this.geometryType,hasZ:this.hasZ,hasM:this.hasM},c):a.getDataValues(t,n(e),i)}_calculateHistogramBins(e,t,n){if(t.min==null&&t.max==null)return[];let r=t.intervals,i=t.min??0,a=t.max??0,o=r.map(([e,t])=>({minValue:e,maxValue:t,count:0,items:[]}));for(let t=0;t<e.length;t++){let s=e[t],c=n[t];if(s!=null&&s>=i&&s<=a){let e=U(r,s);e>-1&&(o[e].count++,o[e].items.push(c))}}return o}async createQueryBinsResponse(e){let t=e.bin?.splitBy;if(!t)return this._createBinsResponse(e);let{value:n,outAlias:r,valueType:i}=t,a=[],o=[{name:r??n,alias:r??n,type:i??`esriFieldTypeString`},{name:`bin`,alias:`bin`,type:`esriFieldTypeInteger`}],s=new g(e,this.featureAdapter,this.fieldsIndex),c=new Map,l=[...this.items];this._sortFeatures(l,[n],(e,t,n)=>s.getFieldValue(e,t,n));let u=this._getAttributeValues(s,n,l,c),d=this._calculateUniqueValues([u],l,s.returnDistinctValues);for(let t in d){let{items:i}=d[t],s=await this._createBinsResponse(e,i);if(a.push(...s.features.map(e=>({...e,attributes:{...e.attributes,[r??n]:t}}))),s.fields)for(let e of s.fields)o.some(t=>t.name===e.name)||o.push(e)}return{fields:o,features:a}}async _createBinsResponse(e,t){let n=e.bin;switch(t??=this.items,n.type){case`autoIntervalBin`:return this._createAutoIntervalBinsResponse(O.fromJSON(n),e,t);case`dateBin`:return this._createDateBinsResponse(k.fromJSON(n),e,t);case`fixedBoundariesBin`:return this._createFixedBoundariesBinsResponse(j.fromJSON(n),e,t);case`fixedIntervalBin`:return this._createFixedIntervalBinsResponse(M.fromJSON(n),e,t)}}async _createAutoIntervalBinsResponse(e,t,n){let{field:r,normalizationField:i,numBins:a,normalizationType:o,normalizationTotal:s,start:c,end:l}=e,u=await this._getDataValues({field:e.field||e.expression,normalizationField:e.normalizationField,normalizationType:e.normalizationType,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},n),d=W(u,{field:r,normalizationField:i,normalizationType:o,normalizationTotal:s,numBins:a,minValue:b(o?e.normalizationMinValue:c,!1),maxValue:b(o?e.normalizationMaxValue:l,!1)}),f=this._calculateHistogramBins(u,d,n);return this._createFeaturesFromHistogramBins(f,t)}async _createDateBinsResponse(e,t,n){let{field:r,interval:i,start:a,end:o,snapToData:s,returnFullIntervalBin:c,offset:l,firstDayOfWeek:u}=e,d=i.unit,f=await this._getDataValues({field:r||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},n),p=D(this.fieldsIndex.get(r)),m=A.toJSON(d),h=f.filter(Boolean).sort((e,t)=>e-t),g=a==null?h[0]:b(a,p),_=o==null?h[h.length-1]:b(o,p),v=[];if(g!=null&&_!=null){let e={zone:t.outTimeReference?.ianaTimeZone??K},n={[l?.unit?A.toJSON(l.unit):`milliseconds`]:l?.value||0},r=q.fromMillis(g,e).minus(n),a=q.fromMillis(_,e).minus(n),o=typeof u==`number`&&u>=1&&u<=7?u:7,d=(e,t)=>{let n=(e.weekday-t+7)%7;return e.minus({days:n}).startOf(`day`)},f=(e,t)=>d(e,t).plus({days:7});if(s===`last`){let e=m===`week`?f(a,o):a;for(;e>r;){let t=e.minus({[m]:i.value});if(t<r){v.unshift([c?t.plus(n).toMillis():r.plus(n).toMillis(),e.plus(n).toMillis()]);break}v.unshift([t.plus(n).toMillis(),e.plus(n).toMillis()]),e=t}}else{let e=s===`first`?r:m===`week`?d(r,o):r.startOf(m);for(;e<=a;){let t=e.plus({[m]:i.value});if(t>a){v.push([e.plus(n).toMillis(),c?t.plus(n).toMillis():a.plus(n).toMillis()]);break}v.push([e.plus(n).toMillis(),t.plus(n).toMillis()]),e=t}}}let y=this._calculateHistogramBins(f,{intervals:v,min:g,max:_},n);return this._createFeaturesFromHistogramBins(y,t)}async _createFixedBoundariesBinsResponse(e,t,n){let{field:r}=e,i=await this._getDataValues({field:r||e.expression,timeZone:t.outTimeReference?.ianaTimeZone},n),a=D(this.fieldsIndex.get(r)),o=e.boundaries.map(e=>b(e,a)).sort((e,t)=>e-t),s=[];for(let e=0;e<o.length-1;e++)s.push([o[e],o[e+1]]);let c={intervals:s,min:o.at(0),max:o.at(-1)},l=this._calculateHistogramBins(i,c,n);return this._createFeaturesFromHistogramBins(l,t)}async _createFixedIntervalBinsResponse(e,t,n){let{field:r,interval:i,normalizationType:a,start:o,end:s}=e,c=await this._getDataValues({field:r||e.expression,normalizationField:e.normalizationField,normalizationType:a,normalizationTotal:e.normalizationTotal,timeZone:t.outTimeReference?.ianaTimeZone},n),l=D(this.fieldsIndex.get(r)),u=W(c,{field:r,classificationMethod:`defined-interval`,definedInterval:i,minValue:b(a?e.normalizationMinValue:o,l),maxValue:b(a?e.normalizationMaxValue:s,l)},!0),d=this._calculateHistogramBins(c,u,n);return this._createFeaturesFromHistogramBins(d,t)}async _createFeaturesFromHistogramBins(e,t){let{upperBoundaryAlias:n,lowerBoundaryAlias:r}=t,i=r||`lowerBoundary`,a=n||`upperBoundary`,o=[],s=[{name:i,alias:i,type:`esriFieldTypeDouble`},{name:a,alias:a,type:`esriFieldTypeDouble`}],c=t.bin?.stackBy?.value,l=t.bin?.stackBy?.outAlias;c&&s.push({name:`bin`,alias:`bin`,type:`esriFieldTypeInteger`},{name:l??c,alias:l??c,type:`esriFieldTypeString`});let u=0,d=t.bin.type===`dateBin`,f=t.outTimeReference?.ianaTimeZone;for(let n of e){let{minValue:e,maxValue:r,items:p}=n,m={attributes:{}};m.attributes[i]=d&&f&&e!=null?q.fromMillis(e,{zone:f}).toISO():e,t.bin.hideUpperBound||(m.attributes[a]=d&&f&&r!=null?q.fromMillis(r,{zone:f}).toISO():r),t.returnAggIds&&(m.aggregateIds=p.map(e=>this.featureAdapter.getObjectId(e)).filter(e=>e!=null));let h;if(c?(h=await this._createStatisticsQueryResponse({...t,groupByFieldsForStatistics:[c],orderByFields:[c]},p),m.attributes.bin=++u,t.bin.jsonStyle===`flat`?o.push(...h.features.map(({attributes:{EXPR_1:e,...t},...n})=>({...n,attributes:l??e?{...t,[l??e]:e,...m.attributes}:{...t,...m.attributes}}))):(m.stackedAttributes=h.features.map(({attributes:{EXPR_1:e,...t}})=>l??e?{...t,[l??e]:e}:t),o.push(m))):(t.bin?.splitBy&&(m.attributes.bin=++u),h=await this._createStatisticsQueryResponse(t,p,m),o.push(m)),h.fields)for(let e of h.fields)s.some(t=>t.name===e.name)||s.push(e)}return t.binOrder===`desc`&&o.reverse(),{fields:s,features:o}}}function X(e){let t=s(e[0]);for(let n of e.slice(1))c(t,s(n));return t}function Z(e,t,n,r){let i=r.x-n.x,a=r.y-n.y,o=t.x-n.x,s=t.y-n.y,c=i*i+a*a;if(c===0)return!1;let l=o*i+s*a,u=Math.min(1,Math.max(0,l/c));return e.x=n.x+i*u,e.y=n.y+a*u,!0}class Q{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 ee=[1];function $(e,t){let n=e.split(` `),r=n[0],i=t.get(r),a=n[1]?n[1].toLowerCase()===`desc`:!1;return{compare:G(i?.type,a,`case-insensitive`),fieldOrExpression:r,fieldInfo:i}}export{Y as QueryEngineResult};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Error.js";import n from"../../../../core/Logger.js";import{after as r}from"../../../../core/promiseUtils.js";import{addQueryParameters as i}from"../../../../core/urlUtils.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{getGeometryZScaler as s}from"../../../../geometry/support/zscale.js";import{serializeStreamServiceFilter as c}from"./websocketUils.js";import l from"../../../support/StreamConnection.js";let u=class extends l{constructor(e,t){super({}),this._outSpatialReference=t,this._outstandingMessages=[],this.errorString=null;let{geometryType:n,sourceSpatialReference:r}=e;this._config=e,this._featureZScaler=s(n,r,this._outSpatialReference),this._open()}normalizeCtorArgs(){return{}}async _open(){await this._tryCreateWebSocket(),this.destroyed||await this._handshake()}destroy(){super.destroy(),this._websocket!=null&&(this._websocket.onopen=null,this._websocket.onclose=null,this._websocket.onerror=null,this._websocket.onmessage=null,this._websocket.close()),this._websocket=null}get connectionStatus(){if(this._websocket==null)return`disconnected`;switch(this._websocket.readyState){case 0:case 1:return`connected`;case 2:case 3:return`disconnected`}}sendMessageToSocket(e){this._websocket==null?this._outstandingMessages.push(e):this._websocket.send(JSON.stringify(e))}sendMessageToClient(e){this._onMessage(e)}updateCustomParameters(e){this._config.customParameters=e,this._websocket!=null&&this._websocket.close()}async _tryCreateWebSocket(e=this._config.url.path,a=1e3,o=0){try{if(this.destroyed)return;let t=i(e,this._config.customParameters??{});this._websocket=await this._createWebSocket(t),this.notifyChange(`connectionStatus`)}catch(i){let s=a/1e3;if(this._config.maxReconnectionAttempts&&o>=this._config.maxReconnectionAttempts){n.getLogger(this).error(new t(`websocket-connection`,`Exceeded maxReconnectionAttempts attempts. No further attempts will be made`)),this.destroy();return}return n.getLogger(this).error(new t(`websocket-connection`,`Failed to connect. Attempting to reconnect in ${s}s`,i)),await r(a),this._tryCreateWebSocket(e,Math.min(a*1.5,this._config.maxReconnectionInterval*1e3),o+1)}}_setWebSocketJSONParseHandler(e){e.onmessage=e=>{try{let t=JSON.parse(e.data);this._onMessage(t)}catch(e){n.getLogger(this).error(new t(`websocket-connection`,`Failed to parse message, invalid JSON`,{error:e}));return}}}_createWebSocket(e){return new Promise((t,n)=>{let r=new WebSocket(e);r.onopen=()=>{r.onopen=null,this.destroyed?(r.onclose=null,r.close()):(r.onclose=e=>this._onClose(e),r.onerror=e=>this._onError(e),this._setWebSocketJSONParseHandler(r),t(r))},r.onclose=e=>{r.onopen=r.onclose=null,n(e)}})}async _handshake(e=1e4){let r=this._websocket;if(r==null)return;let i=Promise.withResolvers(),a=r.onmessage,o=c(this._config.definitionExpression,this._config.geometryDefinition),{outFields:s}=this._config,l=setTimeout(()=>i.reject(),e),u=()=>{clearTimeout(l),i.reject()};return r.onmessage=e=>{let c=null;try{c=JSON.parse(e.data)}catch{}
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Error.js";import n from"../../../../core/Logger.js";import{after as r}from"../../../../core/promiseUtils.js";import{addQueryParameters as i}from"../../../../core/urlUtils.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{getGeometryZScaler as s}from"../../../../geometry/support/zscale.js";import{serializeStreamServiceFilter as c}from"./websocketUils.js";import l from"../../../support/StreamConnection.js";let u=class extends l{constructor(e,t){super({}),this._outSpatialReference=t,this._outstandingMessages=[],this.errorString=null;let{geometryType:n,sourceSpatialReference:r}=e;this._config=e,this._featureZScaler=s(n,r,this._outSpatialReference),this._open()}normalizeCtorArgs(){return{}}async _open(){await this._tryCreateWebSocket(),this.destroyed||await this._handshake()}destroy(){super.destroy(),this._websocket!=null&&(this._websocket.onopen=null,this._websocket.onclose=null,this._websocket.onerror=null,this._websocket.onmessage=null,this._websocket.close()),this._websocket=null}get connectionStatus(){if(this._websocket==null)return`disconnected`;switch(this._websocket.readyState){case 0:case 1:return`connected`;case 2:case 3:return`disconnected`}}sendMessageToSocket(e){this._websocket==null?this._outstandingMessages.push(e):this._websocket.send(JSON.stringify(e))}sendMessageToClient(e){this._onMessage(e)}updateCustomParameters(e){this._config.customParameters=e,this._websocket!=null&&this._websocket.close()}async _tryCreateWebSocket(e=this._config.url.path,a=1e3,o=0){try{if(this.destroyed)return;let t=i(e,this._config.customParameters??{});this._websocket=await this._createWebSocket(t),this.notifyChange(`connectionStatus`)}catch(i){let s=a/1e3;if(this._config.maxReconnectionAttempts&&o>=this._config.maxReconnectionAttempts){n.getLogger(this).error(new t(`websocket-connection`,`Exceeded maxReconnectionAttempts attempts. No further attempts will be made`)),this.destroy();return}return n.getLogger(this).error(new t(`websocket-connection`,`Failed to connect. Attempting to reconnect in ${s}s`,i)),await r(a),this._tryCreateWebSocket(e,Math.min(a*1.5,this._config.maxReconnectionInterval*1e3),o+1)}}_setWebSocketJSONParseHandler(e){e.onmessage=e=>{try{let t=JSON.parse(e.data);this._onMessage(t)}catch(e){n.getLogger(this).error(new t(`websocket-connection`,`Failed to parse message, invalid JSON`,{error:e}));return}}}_createWebSocket(e){return new Promise((t,n)=>{let r=new WebSocket(e);r.onopen=()=>{r.onopen=null,this.destroyed?(r.onclose=null,r.close()):(r.onclose=e=>this._onClose(e),r.onerror=e=>this._onError(e),this._setWebSocketJSONParseHandler(r),t(r))},r.onclose=e=>{r.onopen=r.onclose=null,n(e)}})}async _handshake(e=1e4){let r=this._websocket;if(r==null)return;let i=Promise.withResolvers(),a=r.onmessage,o=c(this._config.definitionExpression,this._config.geometryDefinition),{outFields:s}=this._config,l=setTimeout(()=>i.reject(),e),u=()=>{clearTimeout(l),i.reject()};return r.onmessage=e=>{let c=null;try{c=JSON.parse(e.data)}catch{}c&&typeof c==`object`||(n.getLogger(this).error(new t(`websocket-connection`,`Protocol violation. Handshake failed - malformed message`,e.data)),u(),this.destroy()),c.spatialReference?.wkid!==this._outSpatialReference?.wkid&&(n.getLogger(this).error(new t(`websocket-connection`,`Protocol violation. Handshake failed - expected wkid of ${this._outSpatialReference.wkid}`,e.data)),u(),this.destroy()),c.format!==`json`&&(n.getLogger(this).error(new t(`websocket-connection`,`Protocol violation. Handshake failed - format is not set`,e.data)),u(),this.destroy()),o&&c.filter!==o&&n.getLogger(this).error(new t(`websocket-connection`,`Tried to set filter, but server doesn't support it`)),s&&c.outFields!==s&&n.getLogger(this).error(new t(`websocket-connection`,`Tried to set outFields, but server doesn't support it`)),r.onmessage=a;for(let e of this._outstandingMessages)r.send(JSON.stringify(e));this._outstandingMessages=[],clearTimeout(l),i.resolve()},r.send(JSON.stringify({filter:o,outFields:s,format:`json`,spatialReference:{wkid:this._outSpatialReference.wkid}})),i.promise}_onMessage(e){if(this.onMessage(e),`type`in e)switch(e.type){case`features`:case`featureResult`:for(let t of e.features)this._featureZScaler!=null&&this._featureZScaler(t.geometry),this.onFeature(t)}}_onError(e){let t=`Encountered an error over WebSocket connection`;this._set(`errorString`,t),n.getLogger(this).error(`websocket-connection`,t)}_onClose(e){this._websocket=null,this.notifyChange(`connectionStatus`),e.code!==1e3&&n.getLogger(this).error(`websocket-connection`,`WebSocket closed unexpectedly with error code ${e.code}`),this.destroyed||this._open()}};e([a()],u.prototype,`connectionStatus`,null),e([a()],u.prototype,`errorString`,void 0),u=e([o(`esri.layers.graphics.sources.connections.WebSocketConnection`)],u);export{u as WebSocketConnection};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import n from"../../../../request.js";import r from"../../../../core/Error.js";import{EventEmitter as i}from"../../../../core/Evented.js";import has from"../../../../core/has.js";import{QueueProcessor as a}from"../../../../core/QueueProcessor.js";import{isBlobProtocol as o}from"../../../../core/urlUtils.js";import{createParquetFile as s,readMetadata as c}from"../../../parquet.js";import{ParquetFileInfo as l}from"./ParquetFileInfo.js";import{parseFileStatisticsMap as u}from"./ParquetFileStatistics.js";const d=`_spatial.json`,f=new a({concurrency:12,process:async e=>{let{data:t}=await n(e.url,e.options);return t}});let p=1;class m{constructor(e,t=()=>{}){this._geometryInfo=e,this._getCustomParameters=t,this.events=new i}async destroy(){await this.clear()}async clear(){if(this._infos){let e=await this._infos;for(let t of e.values())t.destroy();e.clear(),this._infos=null}}async getMetadata(){let n={stack:[],error:void 0,hasError:!1};try{let t=(await this._getParquetFileNames()).at(0);if(!t)return null;let r=e(n,await s(t,{provider:this}),!1);return c(r)}catch(e){n.error=e,n.hasError=!0}finally{t(n)}}getGeometryInfo(){return this._geometryInfo}async getFiles(){let e=await this._getInfoMap();return Array.from(e.values())}async updateGeometryInfo(e){if(this._geometryInfo)throw Error(`GeometryInfo already set`);await this.clear(),this._geometryInfo=e}async fetchLength(e){let{byteLength:t,cacheTag:n}=await this._fetchLengthAndTag(e);if(!has(`parquetlayer-cache-enabled`))return t;try{await this._createOrResetCache(e,n)}catch{}return t}async fetchRange(e,t,n,r){let i={fileId:e,requestId:p++,range:{start:t,end:n+1}};this.events.emit(`rangeRead`,{...i,phase:`start`});try{let a=await this._fetchRangeWithCache(e,t,n,r);return this.events.emit(`rangeRead`,{...i,phase:`complete`}),a}catch(e){throw this.events.emit(`rangeRead`,{...i,phase:`error`}),e}}_getCacheFileName(e){return e}async _requestStatistics(e){let{data:t}=await n(e,{responseType:`json`,query:this._getCustomParameters()});return t}async _fetchRange(e,t,n,i){let a={url:e,options:{responseType:`array-buffer`,query:this._getCustomParameters()??{},cacheMode:`no-store`,useQueue:!0,headers:{range:`bytes=${t}-${n}`}}},o=await f.push(a),s=n-t+1;if(o.byteLength!==s)throw new r(`InvalidRangeRequest`,`request returned ${o.byteLength} bytes for range ${t}-${n}, expected ${s}.`);return o}async _fetchLengthAndTag(e){if(o(e)){let{data:t}=await n(e,{responseType:`blob`});return{byteLength:t.size,cacheTag:null}}let t=await this._requestHead(e),r=t.headers.get(`Content-Length`);if(r==null)throw Error(`Unable to parse content length`);let i=t.headers.get(`etag`)??t.headers.get(`Last-Modified`);return{byteLength:parseInt(r,10),cacheTag:i}}async _getInfoMap(){return this._infos||=this._fetchParquetFiles(),this._infos}async _updateParquetFileInfos(e){let t=await this._getInfoMap(),n=new Set(e);for(let e of n)if(!t.get(e)){let n=t.size,r=await l.create(this.getGeometryInfo(),this,e,n,null);t.set(e,r)}for(let e of t.keys())if(!n.has(e))throw Error(`Deletion not supported`)}async _getFileStatistics(e){this._statistics||=this._fetchStatistics();let t=await this._statistics,n=g(e);return t.get(n)}async _fetchParquetFiles(){let e=(await this._getParquetFileNames()).map(async(e,t)=>{let n=t,r=await this._getFileStatistics(e);return l.create(this.getGeometryInfo(),this,e,n,r)}),t=await Promise.all(e),n=new Map;for(let e of t)n.set(e.url,e);return n}async _fetchStatistics(){let e=await this._getStatisticsFileName();if(e==null)return new Map;let t=await this._resolveFileUrl(e),n=await this._requestStatistics(t);return u(n)}async _requestHead(e){let{data:t}=await n(e,{responseType:`native`,method:`head`,query:this._getCustomParameters()});return t}async _openCache(e){return caches.open(this._getCacheName(e))}async _fetchRangeWithCache(e,t,n,r){if(!has(`parquetlayer-cache-enabled`))return this._fetchRange(e,t,n,r);let i=new URL(this._getCacheFileName(e));i.searchParams.append(`range`,`${t}-${n}`);try{let a=await this._openCache(e),o=await a.match(i);if(o)return await o.arrayBuffer();let s=await this._fetchRange(e,t,n,r);return await a.put(i,new Response(s,{headers:{"Content-Type":`application/octet-stream`,"Content-Length":s.byteLength.toString()}})),s}catch{return this._fetchRange(e,t,n,r)}}_getCacheName(e){return`parquet.v1:${this._getCacheFileName(e)}`}async _createOrResetCache(e,t){let n=this._getCacheName(e),r=new URL(this._getCacheFileName(e));if(r.searchParams.append(`metadata`,`true`),t==null){await caches.delete(n);return}let i=await caches.open(n);(await(await i.match(r))?.json())?.tag!==t&&(await caches.delete(n),i=await caches.open(n));let a=JSON.stringify({tag:t});await i.put(r,new Response(a,{headers:{"Content-Type":`application/json`,"Content-Length":a.length.toString()}}))}}function h(e){let t=e.split(/[?#]/)[0];return t===d||t.endsWith(d)}function g(e){return e.split(/[?#]/)[0].split(`/`).at(-1)??e}export{m as FileProvider,h as isStatisticsFileName,d as spatialFileName};
|
|
2
|
+
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import n from"../../../../request.js";import r from"../../../../core/Error.js";import{EventEmitter as i}from"../../../../core/Evented.js";import has from"../../../../core/has.js";import{QueueProcessor as a}from"../../../../core/QueueProcessor.js";import{isBlobProtocol as o}from"../../../../core/urlUtils.js";import{createParquetFile as s,readMetadata as c}from"../../../parquet.js";import{ParquetFileInfo as l}from"./ParquetFileInfo.js";import{parseFileStatisticsMap as u}from"./ParquetFileStatistics.js";const d=`_spatial.json`,f=new a({concurrency:12,process:async e=>{let{data:t}=await n(e.url,e.options);return t}});let p=1;class m{constructor(e,t=()=>{}){this._geometryInfo=e,this._getCustomParameters=t,this.events=new i}async destroy(){await this.clear()}async clear(){if(this._infos){let e=await this._infos;for(let t of e.values())t.destroy();e.clear(),this._infos=null}}async getMetadata(){let n={stack:[],error:void 0,hasError:!1};try{let t=(await this._getParquetFileNames()).at(0);if(!t)return null;let r=e(n,await s(t,{provider:this}),!1);return c(r)}catch(e){n.error=e,n.hasError=!0}finally{t(n)}}getGeometryInfo(){return this._geometryInfo}async getFiles(){let e=await this._getInfoMap();return Array.from(e.values())}async updateGeometryInfo(e){if(this._geometryInfo)throw Error(`GeometryInfo already set`);await this.clear(),this._geometryInfo=e}async fetchLength(e){let{byteLength:t,cacheTag:n}=await this._fetchLengthAndTag(e);if(!has(`parquetlayer-cache-enabled`))return t;try{await this._createOrResetCache(e,n)}catch{}return t}async fetchRange(e,t,n,r){let i={fileId:e,requestId:p++,range:{start:t,end:n+1}};this.events.emit(`rangeRead`,{...i,phase:`start`});try{let a=await this._fetchRangeWithCache(e,t,n,r);return this.events.emit(`rangeRead`,{...i,phase:`complete`}),a}catch(e){throw this.events.emit(`rangeRead`,{...i,phase:`error`}),e}}_getCacheFileName(e){return e}async _requestStatistics(e){let{data:t}=await n(e,{responseType:`json`,maxUrlLength:0,query:this._getCustomParameters()});return t}async _fetchRange(e,t,n,i){let a={url:e,options:{responseType:`array-buffer`,query:this._getCustomParameters()??{},cacheMode:`no-store`,maxUrlLength:0,useQueue:!0,headers:{range:`bytes=${t}-${n}`}}},o=await f.push(a),s=n-t+1;if(o.byteLength!==s)throw new r(`InvalidRangeRequest`,`request returned ${o.byteLength} bytes for range ${t}-${n}, expected ${s}.`);return o}async _fetchLengthAndTag(e){if(o(e)){let{data:t}=await n(e,{responseType:`blob`});return{byteLength:t.size,cacheTag:null}}let t=await this._requestHead(e),r=t.headers.get(`Content-Length`);if(r==null)throw Error(`Unable to parse content length`);let i=t.headers.get(`etag`)??t.headers.get(`Last-Modified`);return{byteLength:parseInt(r,10),cacheTag:i}}async _getInfoMap(){return this._infos||=this._fetchParquetFiles(),this._infos}async _updateParquetFileInfos(e){let t=await this._getInfoMap(),n=new Set(e);for(let e of n)if(!t.get(e)){let n=t.size,r=await l.create(this.getGeometryInfo(),this,e,n,null);t.set(e,r)}for(let e of t.keys())if(!n.has(e))throw Error(`Deletion not supported`)}async _getFileStatistics(e){this._statistics||=this._fetchStatistics();let t=await this._statistics,n=g(e);return t.get(n)}async _fetchParquetFiles(){let e=(await this._getParquetFileNames()).map(async(e,t)=>{let n=t,r=await this._getFileStatistics(e);return l.create(this.getGeometryInfo(),this,e,n,r)}),t=await Promise.all(e),n=new Map;for(let e of t)n.set(e.url,e);return n}async _fetchStatistics(){let e=await this._getStatisticsFileName();if(e==null)return new Map;let t=await this._resolveFileUrl(e),n=await this._requestStatistics(t);return u(n)}async _requestHead(e){let{data:t}=await n(e,{responseType:`native`,method:`head`,maxUrlLength:0,query:this._getCustomParameters()});return t}async _openCache(e){return caches.open(this._getCacheName(e))}async _fetchRangeWithCache(e,t,n,r){if(!has(`parquetlayer-cache-enabled`))return this._fetchRange(e,t,n,r);let i=new URL(this._getCacheFileName(e));i.searchParams.append(`range`,`${t}-${n}`);try{let a=await this._openCache(e),o=await a.match(i);if(o)return await o.arrayBuffer();let s=await this._fetchRange(e,t,n,r);return await a.put(i,new Response(s,{headers:{"Content-Type":`application/octet-stream`,"Content-Length":s.byteLength.toString()}})),s}catch{return this._fetchRange(e,t,n,r)}}_getCacheName(e){return`parquet.v1:${this._getCacheFileName(e)}`}async _createOrResetCache(e,t){let n=this._getCacheName(e),r=new URL(this._getCacheFileName(e));if(r.searchParams.append(`metadata`,`true`),t==null){await caches.delete(n);return}let i=await caches.open(n);(await(await i.match(r))?.json())?.tag!==t&&(await caches.delete(n),i=await caches.open(n));let a=JSON.stringify({tag:t});await i.put(r,new Response(a,{headers:{"Content-Type":`application/json`,"Content-Length":a.length.toString()}}))}}function h(e){let t=e.split(/[?#]/)[0];return t===d||t.endsWith(d)}function g(e){return e.split(/[?#]/)[0].split(`/`).at(-1)??e}export{m as FileProvider,h as isStatisticsFileName,d as spatialFileName};
|