@arcgis/core 4.34.0-next.34 → 4.34.0-next.36
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/Graphic.js +1 -1
- package/analysis/ElevationProfileAnalysis.d.ts +4 -0
- package/analysis/ElevationProfileAnalysis.js +5 -0
- package/analysis/ElevationProfileLine.d.ts +4 -0
- package/analysis/ElevationProfileLine.js +5 -0
- package/analysis/ElevationProfileLineChartOptions.d.ts +4 -0
- package/analysis/ElevationProfileLineChartOptions.js +5 -0
- package/analysis/ElevationProfileLineGround.d.ts +4 -0
- package/analysis/ElevationProfileLineGround.js +5 -0
- package/analysis/ElevationProfileLineInput.d.ts +4 -0
- package/analysis/ElevationProfileLineInput.js +5 -0
- package/analysis/ElevationProfileLineQuery.d.ts +4 -0
- package/analysis/ElevationProfileLineQuery.js +5 -0
- package/analysis/ElevationProfileLineScene.d.ts +4 -0
- package/analysis/ElevationProfileLineScene.js +5 -0
- package/analysis/ElevationProfileLineViewOptions.d.ts +4 -0
- package/analysis/ElevationProfileLineViewOptions.js +5 -0
- package/analysis/ElevationProfileUnits.d.ts +4 -0
- package/analysis/ElevationProfileUnits.js +5 -0
- package/analysis/support/elevationProfileLineTypes.js +5 -0
- package/arcade/ArcadeDate.js +1 -1
- package/arcade/ArcadeModuleResolver.js +1 -1
- package/arcade/arcadeAsyncRuntime.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/arcadeRuntime.js +1 -1
- package/arcade/compilerUtils.js +5 -0
- package/arcade/containerUtils.js +1 -1
- package/arcade/featureset/actions/GroupBy.js +1 -1
- package/arcade/functions/convertdirection.js +1 -1
- package/arcade/functions/date.js +1 -1
- package/arcade/functions/feature.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/arcade/functions/featuresetgeom.js +1 -1
- package/arcade/functions/featuresetstring.js +1 -1
- package/arcade/functions/fieldStats.js +1 -1
- package/arcade/functions/geomasync.js +1 -1
- package/arcade/functions/geometry.js +1 -1
- package/arcade/functions/geomsync.js +1 -1
- package/arcade/functions/knowledgegraph.js +1 -1
- package/arcade/functions/maths.js +1 -1
- package/arcade/functions/string.js +1 -1
- package/arcade/functions/track.js +1 -1
- package/arcade/geometry/functions.js +1 -1
- package/arcade/languageUtils.js +1 -1
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0550e775677597f3752c.js +1 -0
- package/assets/esri/core/workers/chunks/{b4b30a7f1b673461dc55.js → 0997e09fe5b0aba1f804.js} +1 -1
- package/assets/esri/core/workers/chunks/0c0080b652cf8afc4e6b.js +1 -0
- package/assets/esri/core/workers/chunks/152128775b4740e779ab.js +1 -0
- package/assets/esri/core/workers/chunks/{847455bf4fc33d6e6efc.js → 1dc410bc070cabb7198d.js} +1 -1
- package/assets/esri/core/workers/chunks/1e58b1e191498417c21d.js +1 -0
- package/assets/esri/core/workers/chunks/2032b649350a75ba294f.js +1 -0
- package/assets/esri/core/workers/chunks/{55a763662bad03ae6bae.js → 209c70ba2925171ef742.js} +1 -1
- package/assets/esri/core/workers/chunks/2105d2cc75e75bf8f1c0.js +1 -0
- package/assets/esri/core/workers/chunks/236fc659747e812f6424.js +1 -0
- package/assets/esri/core/workers/chunks/2c29f8a708a03cb703ab.js +1 -0
- package/assets/esri/core/workers/chunks/{94a3474e3f45efa4a4fe.js → 2c816d3a737e39e6eb84.js} +1 -1
- package/assets/esri/core/workers/chunks/40b0c5368b8322498189.js +1 -0
- package/assets/esri/core/workers/chunks/{4778acd0cfaf0cebeec7.js → 439128f23fa091633d2d.js} +1 -1
- package/assets/esri/core/workers/chunks/{ddaaff5d6036a5eed50f.js → 44116cf0bd4d6a127c96.js} +1 -1
- package/assets/esri/core/workers/chunks/4c54239974a5847b8fdd.js +1 -0
- package/assets/esri/core/workers/chunks/4fb13252a985131d3dae.js +1 -0
- package/assets/esri/core/workers/chunks/{b89aacec211c66e3a011.js → 5d8c64693830506c8776.js} +1 -1
- package/assets/esri/core/workers/chunks/5f995450f720483fcffa.js +1 -0
- package/assets/esri/core/workers/chunks/{5d0c92aaa5891e6cb8f0.js → 641ca71d7c1a07bde66a.js} +1 -1
- package/assets/esri/core/workers/chunks/{b78d00c4e493086741e1.js → 7d25f57299c642e727a6.js} +1 -1
- package/assets/esri/core/workers/chunks/81be8d23b8dfa4937eaf.js +1 -0
- package/assets/esri/core/workers/chunks/8b7f6f2d1692b6b6dbd5.js +1 -0
- package/assets/esri/core/workers/chunks/{0ec7b5f1a614a86ad3db.js → 948ecf0bfbc886ec3b52.js} +1 -1
- package/assets/esri/core/workers/chunks/9f43736d6d80c8e858b2.js +1 -0
- package/assets/esri/core/workers/chunks/a36be186ad10200c420c.js +1 -0
- package/assets/esri/core/workers/chunks/a44f17397d8589433dae.js +1 -0
- package/assets/esri/core/workers/chunks/a53f2529b7067c28f320.js +1 -0
- package/assets/esri/core/workers/chunks/a6b6915b7321f77f765f.js +1 -0
- package/assets/esri/core/workers/chunks/aa12ba96fb8c91105473.js +1 -0
- package/assets/esri/core/workers/chunks/ab73df4f809430db6249.js +1 -0
- package/assets/esri/core/workers/chunks/ae7f1499912c86973921.js +1 -0
- package/assets/esri/core/workers/chunks/b331543767c35e5edcc6.js +1 -0
- package/assets/esri/core/workers/chunks/b98a049561b12a0555b7.js +1 -0
- package/assets/esri/core/workers/chunks/bf60d4da0dff1e14da8e.js +1 -0
- package/assets/esri/core/workers/chunks/{4784af2b04fafacfcc1b.js → c6077a893d5b5c34a46c.js} +1 -1
- package/assets/esri/core/workers/chunks/{a809042fdce7ced2a415.js → cc3ca1729af33688c1e3.js} +1 -1
- package/assets/esri/core/workers/chunks/cd150c7e1516134c7437.js +1 -0
- package/assets/esri/core/workers/chunks/cde79c3644166d4798a8.js +1 -0
- package/assets/esri/core/workers/chunks/{181f8bbe670b4468307a.js → ce8f0ed9179c0d314df8.js} +1 -1
- package/assets/esri/core/workers/chunks/d4cadde4a9cbfe2c51d8.js +1 -0
- package/assets/esri/core/workers/chunks/{ac30cf2f9a94597f7665.js → d6b2ab614f308db50c4a.js} +2 -2
- package/assets/esri/core/workers/chunks/dab82564928265b9f22d.js +1 -0
- package/assets/esri/core/workers/chunks/dec9656997683ef01ba6.js +1 -0
- package/assets/esri/core/workers/chunks/e892ed8b0b990d7eba28.js +1 -0
- package/assets/esri/core/workers/chunks/e897c5ce83db8a71b0a2.js +1 -0
- package/assets/esri/core/workers/chunks/{41071e672dcddec47492.js → f4e9640306f64b1af7a3.js} +1 -1
- package/assets/esri/core/workers/chunks/fa01d418237d7fa67efc.js +1 -0
- package/assets/esri/core/workers/chunks/ff736cb5a9fd18368244.js +1 -0
- package/chunks/arcade.js +1 -1
- package/chunks/array.js +1 -1
- package/chunks/languageUtils.js +1 -1
- package/config.js +1 -1
- package/copyright.txt +27 -0
- package/core/BidiEngine.js +1 -1
- package/core/Promise.js +1 -1
- package/core/accessorSupport/ensureType.js +1 -1
- package/core/promiseUtils.js +1 -1
- package/core/sql/SqlInterval.js +1 -1
- package/core/sql/sqlDateParsingUtils.js +1 -1
- package/core/unitUtils.js +1 -1
- package/geometry/support/DoubleArray.js +1 -1
- package/geometry/support/coordinateSystem.js +1 -1
- package/graphic/BuildingGraphicOrigin.d.ts +4 -0
- package/graphic/BuildingGraphicOrigin.js +5 -0
- package/graphic/CSVGraphicOrigin.d.ts +4 -0
- package/graphic/CSVGraphicOrigin.js +5 -0
- package/graphic/CatalogGraphicOrigin.d.ts +4 -0
- package/graphic/CatalogGraphicOrigin.js +5 -0
- package/graphic/FeatureGraphicOrigin.d.ts +4 -0
- package/graphic/FeatureGraphicOrigin.js +5 -0
- package/graphic/GeoJSONGraphicOrigin.d.ts +4 -0
- package/graphic/GeoJSONGraphicOrigin.js +5 -0
- package/graphic/GraphicOrigin.d.ts +4 -0
- package/graphic/GraphicOrigin.js +5 -0
- package/graphic/IntegratedMesh3DTilesGraphicOrigin.d.ts +4 -0
- package/graphic/IntegratedMesh3DTilesGraphicOrigin.js +5 -0
- package/graphic/IntegratedMeshGraphicOrigin.d.ts +4 -0
- package/graphic/IntegratedMeshGraphicOrigin.js +5 -0
- package/graphic/OGCFeatureGraphicOrigin.d.ts +4 -0
- package/graphic/OGCFeatureGraphicOrigin.js +5 -0
- package/graphic/PointCloudGraphicOrigin.d.ts +4 -0
- package/graphic/PointCloudGraphicOrigin.js +5 -0
- package/graphic/SceneGraphicOrigin.d.ts +4 -0
- package/graphic/SceneGraphicOrigin.js +5 -0
- package/graphic/StreamGraphicOrigin.d.ts +4 -0
- package/graphic/StreamGraphicOrigin.js +5 -0
- package/graphic/VectorTileGraphicOrigin.d.ts +4 -0
- package/graphic/VectorTileGraphicOrigin.js +5 -0
- package/graphic/VoxelGraphicOrigin.d.ts +4 -0
- package/graphic/VoxelGraphicOrigin.js +5 -0
- package/graphic/WFSGraphicOrigin.d.ts +4 -0
- package/graphic/WFSGraphicOrigin.js +5 -0
- package/graphic/graphicOriginUtils.js +5 -0
- package/graphic/graphicOrigins.d.ts +14 -0
- package/graphic/graphicOrigins.js +5 -0
- package/graphic/isBuildingGraphicOrigin.js +5 -0
- package/graphic/isCSVGraphicOrigin.js +5 -0
- package/graphic/isCatalogGraphicOrigin.js +5 -0
- package/graphic/isFeatureGraphicOrigin.js +5 -0
- package/graphic/isGeoJSONGraphicOrigin.js +5 -0
- package/graphic/isIntegratedMesh3DTilesGraphicOrigin.js +5 -0
- package/graphic/isIntegratedMeshGraphicOrigin.js +5 -0
- package/graphic/isOGCFeatureGraphicOrigin.js +5 -0
- package/graphic/isPointCloudGraphicOrigin.js +5 -0
- package/graphic/isSceneGraphicOrigin.js +5 -0
- package/graphic/isStreamGraphicOrigin.js +5 -0
- package/graphic/isVectorTileGraphicOrigin.js +5 -0
- package/graphic/isVoxelGraphicOrigin.js +5 -0
- package/graphic/isWFSGraphicOrigin.js +5 -0
- package/interfaces.d.ts +1025 -63
- package/kernel.js +1 -1
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/layers/support/Field.js +1 -1
- package/layers/support/PromiseQueue.js +1 -1
- package/layers/support/featurePopupQueryUtils.js +1 -1
- package/layers/voxel/NCTimeParser.js +1 -1
- package/package.json +1 -1
- package/rest/knowledgeGraphService.js +1 -1
- package/smartMapping/statistics/support/utils.js +1 -1
- package/support/arcadeExpressionUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/support/svgUtils.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileFeatureIndex.js +1 -1
- package/views/2d/engine/webgl/FeatureDisplayList.js +1 -1
- package/views/2d/engine/webgl/Painter.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/segmentUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/VectorTileLayerView2D.js +1 -1
- package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
- package/views/3d/FocusAreasView.js +1 -1
- package/views/3d/analysis/AnalysisViewManager3D.js +1 -1
- package/views/3d/analysis/ElevationProfileAnalysisView3D.d.ts +4 -0
- package/views/3d/analysis/ElevationProfileAnalysisView3D.js +5 -0
- package/views/3d/analysis/Slice/SliceController.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/CutFillVolumeMeasurementComputation.js +5 -0
- package/views/3d/analysis/VolumeMeasurement/CutFillVolumeMeasurementController.js +1 -1
- package/views/3d/environment/Clouds.js +1 -1
- package/views/3d/environment/CloudsRenderer.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles3D.js +1 -1
- package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
- package/views/3d/layers/CSVLayerView3D.js +1 -1
- package/views/3d/layers/CatalogFootprintLayerView3D.js +1 -1
- package/views/3d/layers/FeatureLayerView3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/GeoJSONLayerView3D.js +1 -1
- package/views/3d/layers/GraphicsView3D.js +1 -1
- package/views/3d/layers/GraphicsView3DDummyLayer.js +5 -0
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/layers/OGCFeatureLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerWorker.js +1 -1
- package/views/3d/layers/StreamLayerView3D.js +1 -1
- package/views/3d/layers/WFSLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/ElevationQuery.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/Graphics3DFeatureProcessor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
- package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
- package/views/3d/layers/graphics/GraphicsDeconflictor.js +1 -1
- package/views/3d/layers/graphics/LabelDeconflictor.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/graphics/StreamController.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipeline.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
- package/views/3d/layers/graphics/pipeline/Tile3DManager.js +1 -1
- package/views/3d/layers/i3s/I3SAsyncElevationUpdater.js +1 -1
- package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SFrameTask.js +1 -1
- package/views/3d/layers/support/FeatureTileDescriptor.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3DContext.js +1 -1
- package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
- package/views/3d/layers/support/FeatureTileTree3D.js +1 -1
- package/views/3d/layers/support/FeatureTileTree3DDebugger.js +1 -1
- package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
- package/views/3d/layers/support/FeatureVisibilityFilter.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
- package/views/3d/state/ConstraintsManager.js +1 -1
- package/views/3d/support/StreamDataLoader.js +1 -1
- package/views/3d/support/flow/geometryUtils.js +1 -1
- package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/Focus.js +1 -1
- package/views/3d/support/pointsOfInterest/SurfaceGeometryUpdates.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/webgl-engine/Stage.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
- package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/analysis/ElevationProfileResult.d.ts +4 -0
- package/views/analysis/ElevationProfileResult.js +5 -0
- package/views/interactive/Tooltip.js +1 -1
- package/views/layers/FeatureLayerView.js +1 -1
- package/views/layers/support/popupUtils.js +1 -1
- package/views/support/ScheduledQueueProcessor.js +1 -1
- package/views/support/Scheduler.js +1 -1
- package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileLine.d.ts +2 -2
- package/widgets/ElevationProfile/ElevationProfileLine.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileLineGround.d.ts +2 -2
- package/widgets/ElevationProfile/ElevationProfileLineInput.d.ts +2 -2
- package/widgets/ElevationProfile/ElevationProfileLineQuery.d.ts +2 -2
- package/assets/esri/core/workers/chunks/07b2cc0f6b064277632f.js +0 -1
- package/assets/esri/core/workers/chunks/086f3bc5938bf9a37274.js +0 -1
- package/assets/esri/core/workers/chunks/13f9e92e7e5d44d9f95c.js +0 -1
- package/assets/esri/core/workers/chunks/140efe4735605258ecc9.js +0 -1
- package/assets/esri/core/workers/chunks/20aed6e1d9b6bf06a398.js +0 -1
- package/assets/esri/core/workers/chunks/28e04ef3575f164f611a.js +0 -1
- package/assets/esri/core/workers/chunks/2b76e716f478468b6798.js +0 -1
- package/assets/esri/core/workers/chunks/386ab72a45102c2d47f2.js +0 -1
- package/assets/esri/core/workers/chunks/39bff604d4b4a1295038.js +0 -1
- package/assets/esri/core/workers/chunks/3cd1ab26396052f17832.js +0 -1
- package/assets/esri/core/workers/chunks/3fb6146d914f9b410c2e.js +0 -1
- package/assets/esri/core/workers/chunks/432365fcd7becd508541.js +0 -1
- package/assets/esri/core/workers/chunks/439ce953a25b2776cb7f.js +0 -1
- package/assets/esri/core/workers/chunks/4c8d2334fcdb1354ff43.js +0 -1
- package/assets/esri/core/workers/chunks/50f58b2a933b56effd70.js +0 -1
- package/assets/esri/core/workers/chunks/5f321be63ed5447b04a1.js +0 -1
- package/assets/esri/core/workers/chunks/6006fbdb90c3bfc493a6.js +0 -1
- package/assets/esri/core/workers/chunks/674970c539d336a93ba1.js +0 -1
- package/assets/esri/core/workers/chunks/700c641347853b1034d9.js +0 -1
- package/assets/esri/core/workers/chunks/7c35c61e3673cf94cdfd.js +0 -1
- package/assets/esri/core/workers/chunks/7c75876a0c6460585055.js +0 -1
- package/assets/esri/core/workers/chunks/7d852617e91b51121ea7.js +0 -1
- package/assets/esri/core/workers/chunks/949dc266ac6f3505d357.js +0 -1
- package/assets/esri/core/workers/chunks/98f6d4ea026ed96fd3f3.js +0 -1
- package/assets/esri/core/workers/chunks/9bc6d974b0fce9db64ef.js +0 -1
- package/assets/esri/core/workers/chunks/a84af1b8b64b86b49bd3.js +0 -1
- package/assets/esri/core/workers/chunks/a9d83a442d8d7a376fc0.js +0 -1
- package/assets/esri/core/workers/chunks/abe2cdfc2eda46b00812.js +0 -1
- package/assets/esri/core/workers/chunks/ba1b21a90b257ac9a342.js +0 -1
- package/assets/esri/core/workers/chunks/c30adbead0ba4722acf9.js +0 -1
- package/assets/esri/core/workers/chunks/ca46f78aac1133d127fa.js +0 -1
- package/assets/esri/core/workers/chunks/dc5a8cf2a44a5ac201c5.js +0 -1
- package/assets/esri/core/workers/chunks/ea240d9e594bfbd8af68.js +0 -1
- package/assets/esri/core/workers/chunks/f9ad37dfbe1d14c6a352.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import s from"../../../../core/Accessor.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import o from"../../../../core/Promise.js";import{watch as a,initial as n}from"../../../../core/reactiveUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import s from"../../../../core/Accessor.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import o from"../../../../core/Promise.js";import{watch as a,initial as n}from"../../../../core/reactiveUtils.js";import{property as c}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as p}from"../../../../core/accessorSupport/decorators/subclass.js";import{featureGeometryTypeKebabDictionary as d}from"../../../../geometry/support/typeUtils.js";import h from"../../../../graphic/StreamGraphicOrigin.js";import{StreamFeatureManager as l}from"../../../../layers/graphics/data/StreamFeatureManager.js";import{createConnection as u}from"../../../../layers/graphics/sources/connections/createConnection.js";import{EventedSet as m}from"../../support/EventedSet.js";import{TaskPriority as y}from"../../../support/Scheduler.js";import{Yield as g}from"../../../support/Yield.js";const f=2500;let _=class extends t{constructor(e){super(e)}getObjectId(){return this.objectId}};e([c({type:Number,json:{read:!0}})],_.prototype,"objectId",void 0),_=e([p("esri.views.3d.layers.graphics.StreamController.StreamGraphic")],_);class v{constructor(e){this.onUpdate=e,this._idToGraphic=new Map}destroy(){this._idToGraphic.clear()}add(e){this._idToGraphic.set(e.objectId,e)}get(e){return this._idToGraphic.get(e)}forEach(e){this._idToGraphic.forEach(e)}removeById(e){const t=this._idToGraphic.get(e);return t?(t.sourceLayer=t.layer=t.origin=null,this._idToGraphic.delete(e),t):null}update(e,t){this.onUpdate(e,t)}get size(){return this._idToGraphic.size}}const j=Symbol("startup-watches"),w=Symbol("update-interval");let R=class extends(o.EsriPromiseMixin(s)){constructor(){super(...arguments),this.isPaused=!1,this.graphics=new m,this._updateInfo={websocket:0,client:0},this._updateRequested=!1,this._lastUpdateRateTime=0,this._outSpatialReference=null}initialize(){this.addResolvingPromise(this.layer.when(()=>this._startup()))}destroy(){this.clear()}clear(){this._shutdown(),this.graphics.clear()}get updating(){return!this.connection||this.readyToRun}get readyToRun(){return!this.isPaused&&null!=this.connection&&this._updateRequested}get _graphicOrigin(){return new h(this.layer)}runTask(){if(this._updateRequested=!1,this._emitUpdateRate(),!this.featuresManager.checkForUpdates())return g}_emitUpdateRate(){const e=performance.now(),t=e-this._lastUpdateRateTime;if(t<f)return;this._lastUpdateRateTime=e;const s=Math.round(this._updateInfo.client/(t/1e3)),r=Math.round(this._updateInfo.websocket/(t/1e3));this._updateInfo.client=0,this._updateInfo.websocket=0,this.layerView.emit("update-rate",{client:s,websocket:r})}_shutdown(){this.connection=i(this.connection),this.store=i(this.store),this.removeAllHandles()}_startup(){const{layer:e,layerView:t}=this,{spatialReference:s,definitionExpression:i,geometryDefinition:o,timeInfo:c,purgeOptions:p,maxReconnectionAttempts:h,maxReconnectionInterval:m,customParameters:g}=e,f=e.geometryType?d.toJSON(e.geometryType):null,_=s,R=t.view.spatialReference,b={type:"object-id",fieldName:e.objectIdField};this.clear(),this._set("connection",u(e.parsedUrl,_,R,f,i,o,h,m,g??void 0)),this._outSpatialReference=R.toJSON(),this.store=new v(this._onUpdate.bind(this)),this.featuresManager=new l(this.store,b,c.toJSON(),p),this.removeHandles(j),this.removeHandles(w),this.addHandles([e.on("send-message-to-socket",e=>this.connection.sendMessageToSocket(e)),e.on("send-message-to-client",e=>this.connection.sendMessageToClient(e)),this.connection.on("data-received",e=>this._onFeature(e)),this.connection.on("message-received",e=>this._onWebSocketMessage(e)),a(()=>[e.definitionExpression,e.geometryDefinition,e.purgeOptions],()=>this._startup()),a(()=>this.isPaused?null:this.layer.updateInterval,e=>{if(this.removeHandles(w),null==e)return;const t=setInterval(()=>{this._updateRequested=!0},e);this.addHandles(r(()=>clearInterval(t)),w)},n),this.layerView.view.resourceController.scheduler.registerTask(y.STREAM_CONTROLLER,this)],j),this._updateRequested=!0}_onWebSocketMessage(e){if(this.layerView.emit("message-received",e),"type"in e)switch(e.type){case"delete":if(e.objectIds)for(const t of e.objectIds)this.featuresManager.removeById(t);if(e.trackIds)for(const t of e.trackIds)this.featuresManager.removeByTrackId(t);break;case"clear":this.store.forEach(e=>this.featuresManager.removeById(e.objectId))}}_onFeature(e){this._updateInfo.websocket++,this.layerView.hasEventListener("data-received")&&this.layerView.emit("data-received",{attributes:e.attributes,centroid:e.centroid,geometry:e.geometry});try{null==e.geometry||e.geometry.spatialReference||(e.geometry.spatialReference=this._outSpatialReference);const t=_.fromJSON(e);t.sourceLayer=t.layer=this.layer,t.origin=this._graphicOrigin,this.featuresManager.add(t)}catch{}}_onUpdate(e,t){null!=t&&this.graphics.removeMany(t),null!=e&&(this._updateInfo.client+=e.length,this.graphics.addMany(e))}pauseStream(){this.isPaused=!0}resumeStream(){this.isPaused=!1}disconnect(){this._shutdown()}connect(){null==this.connection&&this._startup()}clearGraphics(){this.graphics.clear()}};e([c()],R.prototype,"isPaused",void 0),e([c({constructOnly:!0})],R.prototype,"layer",void 0),e([c({constructOnly:!0})],R.prototype,"layerView",void 0),e([c()],R.prototype,"connection",void 0),e([c({readOnly:!0})],R.prototype,"updating",null),e([c()],R.prototype,"readyToRun",null),e([c()],R.prototype,"_updateRequested",void 0),e([c()],R.prototype,"_graphicOrigin",null),R=e([p("esri.views.3d.layers.graphics.StreamController")],R);export{R as StreamController,_ as StreamGraphic};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import r from"../../../../../core/Error.js";import{makeHandle as t}from"../../../../../core/handleUtils.js";import{destroyMaybe as n}from"../../../../../core/maybe.js";import o from"../../../../../core/Promise.js";import{on as i,watch as a}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as u}from"../../../../../core/accessorSupport/decorators/subclass.js";import{FeatureLayerViewPerformanceInfo as l}from"../../FeatureLayerViewPerformanceInfo.js";import{Feature3DPipelineWorkerHandle as d}from"./Feature3DPipelineWorkerHandle.js";import{FeaturePipelineRenderManager as p}from"./rendering/FeaturePipelineRenderManager.js";import{emptyHighlightHandle as y}from"../../support/highlightUtils.js";import{LayerViewPerformanceInfo as m}from"../../support/LayerViewPerformanceInfo.js";let c=class extends o{constructor(e){super(e),this._renderer=null,this.graphicsQuery={queryForSymbologySnapping:(e,t)=>{throw new r("featurelayer:unsupported-symbology-snapping","Symbology snapping not supported")},executeQuery:async(e,r)=>await this._workerHandle.executeQuery(e,r),executeQueryForIds:async(e,r)=>await this._workerHandle.executeQueryForIds(e,r),executeQueryForCount:async(e,r)=>await this._workerHandle.executeQueryForCount(e,r),executeQueryForExtent:async(e,r)=>await this._workerHandle.executeQueryForExtent(e,r),executeQueryForLatestObservations:async(e,r)=>await this._workerHandle.executeQueryForLatestObservations(e,r)},this.maximumNumberOfFeatures=1e3}initialize(){if("point"!==this.layerView.layer.geometryType)throw new r("featurelayer:unsupported-geometry-type",`${this.layerView.layer.geometryType} is not supported`);this.addResolvingPromise(this.setup())}destroy(){this.removeAllHandles(),this._workerHandle.destroy(),n(this._renderer)}async setup(){const e=this.layerView,{layer:t,view:n,uid:o}=e,{spatialReference:s,renderSpatialReference:u,resourceController:l,renderCoordsHelper:y,elevationProvider:m}=n,c=n.state.viewingMode;if(this._renderer=new p({view:n,layerViewUid:o}),"feature"!==t.type)throw new r("featurelayer:unsupported-layertype","Only FeatureLayer is supported");const h=new d({schedule:e=>l.immediate.schedule(e),layer:t,layerView:e,viewSpatialReference:s,renderSpatialReference:u,viewingMode:c,renderer:this._renderer,elevationProvider:m,renderCoordsHelper:y});this._workerHandle=await h.when(),this.addHandles([this.layerView.view.
|
|
5
|
+
import{__decorate as e}from"tslib";import r from"../../../../../core/Error.js";import{makeHandle as t}from"../../../../../core/handleUtils.js";import{destroyMaybe as n}from"../../../../../core/maybe.js";import o from"../../../../../core/Promise.js";import{on as i,watch as a}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as u}from"../../../../../core/accessorSupport/decorators/subclass.js";import{FeatureLayerViewPerformanceInfo as l}from"../../FeatureLayerViewPerformanceInfo.js";import{Feature3DPipelineWorkerHandle as d}from"./Feature3DPipelineWorkerHandle.js";import{FeaturePipelineRenderManager as p}from"./rendering/FeaturePipelineRenderManager.js";import{emptyHighlightHandle as y}from"../../support/highlightUtils.js";import{LayerViewPerformanceInfo as m}from"../../support/LayerViewPerformanceInfo.js";let c=class extends o{constructor(e){super(e),this._renderer=null,this.graphicsQuery={queryForSymbologySnapping:(e,t)=>{throw new r("featurelayer:unsupported-symbology-snapping","Symbology snapping not supported")},executeQuery:async(e,r)=>await this._workerHandle.executeQuery(e,r),executeQueryForIds:async(e,r)=>await this._workerHandle.executeQueryForIds(e,r),executeQueryForCount:async(e,r)=>await this._workerHandle.executeQueryForCount(e,r),executeQueryForExtent:async(e,r)=>await this._workerHandle.executeQueryForExtent(e,r),executeQueryForLatestObservations:async(e,r)=>await this._workerHandle.executeQueryForLatestObservations(e,r)},this.maximumNumberOfFeatures=1e3}initialize(){if("point"!==this.layerView.layer.geometryType)throw new r("featurelayer:unsupported-geometry-type",`${this.layerView.layer.geometryType} is not supported`);this.addResolvingPromise(this.setup())}destroy(){this.removeAllHandles(),this._workerHandle.destroy(),n(this._renderer)}async setup(){const e=this.layerView,{layer:t,view:n,uid:o}=e,{spatialReference:s,renderSpatialReference:u,resourceController:l,renderCoordsHelper:y,elevationProvider:m}=n,c=n.state.viewingMode;if(this._renderer=new p({view:n,layerViewUid:o}),"feature"!==t.type)throw new r("featurelayer:unsupported-layertype","Only FeatureLayer is supported");const h=new d({schedule:e=>l.immediate.schedule(e),layer:t,layerView:e,viewSpatialReference:s,renderSpatialReference:u,viewingMode:c,renderer:this._renderer,elevationProvider:m,renderCoordsHelper:y});this._workerHandle=await h.when(),this.addHandles([this.layerView.view.enableFeatureTiles(),i(()=>this.layerView.view.featureTiles?.tiles,"change",e=>{this._workerHandle.onTileTreeChange(e.target)},{onListenerAdd:e=>this._workerHandle.onTileTreeChange(e),onListenerRemove:e=>this._workerHandle.onTileTreeChange(e)}),n.elevationProvider.on("elevation-change",e=>this._workerHandle.onElevationChange(e)),a(()=>this.layerView.fullOpacity,e=>this._workerHandle.onLayerViewOpacityChange(e),{sync:!1}),a(()=>t.renderer,e=>this._workerHandle.onRendererChange(e),{sync:!1})])}get legendEnabled(){return!1}get hasAllFeatures(){return!1}get hasAllFeaturesInView(){return!1}get hasFullGeometries(){return!1}get symbologySnappingSupported(){return!1}get scaleVisibilitySuspended(){return!1}get suspendInfo(){return{}}get updating(){return this._workerHandle.updating}get dataUpdating(){return!1}get updatePolicy(){return 0}get maximumNumberOfFeaturesExceeded(){return!1}get updatingProgressValue(){return 1}get usedMemory(){return this._renderer?.usedMemory??0}get unloadedMemory(){return 0}get ignoresMemoryFactor(){return!0}get totalFeatures(){return this._renderer?.totalFeatures??0}get performanceInfo(){const e=this.totalFeatures;return new l(new m(this.usedMemory,e,e,this.maximumNumberOfFeatures,0,null),e,e,this.maximumNumberOfFeaturesExceeded,"tiles","n/a")}get suspendResumeExtentMode(){return"computed"}forEachGraphic(e){}findGraphic(e){return null}highlightByObjectIds(e,r){return y}highlightByGraphics(e,r){return y}maskOccludee(e){return t()}async whenGraphicBounds(e,r){return null}computeAttachmentOrigin(e,r){return null}elevationAlignPointsInFeatures(e,t){throw new r("featurelayer:unsupported-elevation-alignment","Elevation alignment not supported")}async doRefresh(e){}setVisibility(e,r){}getMissingAttributesForFeature(e){return null}getHydratedGeometry(e){return null}};e([s()],c.prototype,"layerView",void 0),e([s()],c.prototype,"updating",null),e([s()],c.prototype,"totalFeatures",null),c=e([u("esri.views.3d.layers.graphics.pipeline.Feature3DPipeline")],c);export{c as Feature3DPipeline};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import r from"../../../../../core/Promise.js";import{property as t}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{WorkerHandle as n}from"../../../../../core/workers/WorkerHandle.js";import
|
|
5
|
+
import{__decorate as e}from"tslib";import r from"../../../../../core/Promise.js";import{property as t}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{WorkerHandle as n}from"../../../../../core/workers/WorkerHandle.js";import i from"../../../../../geometry/Extent.js";import{clone as a}from"../../../../../geometry/support/aaBoundingRect.js";import s from"../../../../../graphic/FeatureGraphicOrigin.js";import d from"../../../../../rest/support/FeatureSet.js";import{ElevationContext as c}from"../ElevationContext.js";import{applyElevationAlignment as l}from"./utils.js";let p=class extends r{constructor(e){super(e),this.schedule=null,this._workerUpdating=!0}get updating(){return this._workerUpdating}get _graphicOrigin(){return new s(this.layer)}initialize(){const{layer:e,layerView:r,viewSpatialReference:t,renderSpatialReference:o}=this,n=e.elevationInfo;this._elevationContext=c.fromElevationInfo(n),this._workerHandle=new u(this.schedule,{createTexture:async({data:e,parameters:r})=>({result:await this.renderer.createTexture(e,r),transferList:[]}),releaseTexture:async({uid:e})=>(await this.renderer.releaseTexture(e),h),createMaterial:async({materialJSON:e})=>(await this.renderer.createMaterial(e),h),destroyMaterial:async({materialId:e})=>(await this.renderer.destroyMaterial(e),h),createDirectRenderer:async({materialId:e})=>(await this.renderer.createDirectRenderer(e),h),destroyDirectRenderer:async({materialId:e})=>(await this.renderer.destroyDirectRenderer(e),h),createLoDRenderer:async({rendererId:e,lodRenderGeometry:r},t)=>(await this.renderer.createLoDRenderer(e,r,t?.signal??void 0),h),destroyLoDRenderer:async({rendererId:e},r)=>(await this.renderer.destroyLoDRenderer(e,r?.signal??void 0),h),dispatchRenderCommands:async({commands:e})=>(await this.renderer.executeRenderCommands(e),h),applyElevationAlignment:async({mapPoints:e})=>{const{viewSpatialReference:r,elevationProvider:t,renderCoordsHelper:o}=this,n=l(e,r,this._elevationContext,t,o);return{result:n,transferList:[n.buffer]}}}),this.addResolvingPromise((async()=>{await e.load();const i={url:e.parsedUrl?.path??"",baseQuery:e.createQuery().toJSON(),objectIdField:e.objectIdField,capabilities:e.capabilities,fieldIndex:e.fieldsIndex.toJSON(),timeInfo:e.timeInfo?.toJSON(),elevationInfo:n?.toJSON(),fullExtent:e.fullExtent?.toJSON(),renderer:e.renderer?.toJSON()},a={fullOpacity:r.fullOpacity};await this._workerHandle.invokeMethod("setup",{viewSpatialReference:t.toJSON(),renderSpatialReference:o.toJSON(),viewingMode:this.viewingMode,layerInfo:i,layerViewInfo:a})})()),this.addHandles(this._workerHandle.on("notify-updating",({updating:e})=>{this._workerUpdating=e}))}onTileTreeChange(e){this._workerHandle.invokeMethod("onTileTreeChange",{tiles:e.items.map(y)})}onElevationChange(e){this._workerHandle.invokeMethod("onElevationChange",{context:e.context,spatialReference:e.spatialReference?.toJSON(),extent:a(e.extent)})}onLayerViewOpacityChange(e){this._workerHandle.invokeMethod("onLayerViewOpacityChange",e)}onRendererChange(e){const r=e?.toJSON();this._workerHandle.invokeMethod("onRendererChange",r)}async executeQuery(e,r){const t=await this._workerHandle.invokeMethod("executeQuery",e?.toJSON(),r),o=d.fromJSON(t);return this._ensureLayerOnFeatures(o),o}async executeQueryForIds(e,r){return await this._workerHandle.invokeMethod("executeQueryForIds",e?.toJSON(),r)}async executeQueryForCount(e,r){return await this._workerHandle.invokeMethod("executeQueryForCount",e?.toJSON(),r)}async executeQueryForExtent(e,r){const{count:t,extent:o}=await this._workerHandle.invokeMethod("executeQueryForExtent",e?.toJSON(),r);return{count:t,extent:i.fromJSON(o)}}async executeQueryForLatestObservations(e,r){const t=await this._workerHandle.invokeMethod("executeQueryForLatestObservations",e?.toJSON(),r),o=d.fromJSON(t);return this._ensureLayerOnFeatures(o),o}_ensureLayerOnFeatures(e){const{layer:r,_graphicOrigin:t}=this;for(const o of e.features)o.layer=r,o.sourceLayer=r,o.origin=t}};e([t()],p.prototype,"updating",null),e([t({constructOnly:!0})],p.prototype,"schedule",void 0),e([t({constructOnly:!0})],p.prototype,"layer",void 0),e([t({constructOnly:!0})],p.prototype,"layerView",void 0),e([t({constructOnly:!0})],p.prototype,"viewSpatialReference",void 0),e([t({constructOnly:!0})],p.prototype,"renderSpatialReference",void 0),e([t({constructOnly:!0})],p.prototype,"viewingMode",void 0),e([t({constructOnly:!0})],p.prototype,"renderer",void 0),e([t({constructOnly:!0})],p.prototype,"elevationProvider",void 0),e([t({constructOnly:!0})],p.prototype,"renderCoordsHelper",void 0),e([t()],p.prototype,"_workerUpdating",void 0),e([t()],p.prototype,"_graphicOrigin",null),p=e([o("esri.views.3d.layers.graphics.pipeline.Feature3DPipelineWorkerHandle")],p);class u extends n{constructor(e,r){super("Feature3DPipelineWorker","setup",{},e,{strategy:"dedicated",client:r})}}function y({id:e,lij:r,extent:t}){return{id:e,lij:r,extent:t}}const h={result:void 0};export{p as Feature3DPipelineWorkerHandle};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__addDisposableResource as t,__disposeResources as e,__decorate as s}from"tslib";import o from"../../../../../core/Accessor.js";import{isSome as a}from"../../../../../core/arrayUtils.js";import{createTask as i}from"../../../../../core/asyncUtils.js";import has from"../../../../../core/has.js";import{throwIfAborted as r,throwIfNotAbortError as n}from"../../../../../core/promiseUtils.js";import l from"../../../../../core/ReactiveMap.js";import{whenOnce as c}from"../../../../../core/reactiveUtils.js";import{waitTick as d}from"../../../../../core/scheduling.js";import{property as u}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromExtent as f,intersects as p}from"../../../../../geometry/support/aaBoundingRect.js";import{joinCommands as m}from"./PipelineCommand.js";import{FeatureData as y}from"./featureData/FeatureData.js";let _=class extends o{constructor(t){super(t),this.extent=null,this._tileHandles=new l,this._wanted=new l,this._updateRequested=!1,this._synchronizationTask=null,this._requestedTiles=new Array}destroy(){this._tileHandles.clear(),this._wanted.clear()}get updating(){return this._updateRequested||!(this._synchronizationTask?.finished??1)}get _boundingRect(){const{extent:t}=this;return null==t?null:f(t)}get _missingTiles(){const t=new Array,e=this._wanted,s=this._tileHandles;for(const o of e.values())null==s.get(o.id)?.featureData&&t.push(o);return t}onTileTreeChange({tiles:t}){this._requestedTiles=t,this._scheduleTilesSync()}_scheduleTilesSync(){if(this._updateRequested)return;this._updateRequested=!0;const t=this._synchronizationTask,e=i(async()=>{try{await c(()=>t?.finished??!0),await d(),this._updateRequested=!1,await this._synchronizeTiles()}finally{this._synchronizationTask===e&&(this._synchronizationTask=null)}});this._synchronizationTask=e}async _synchronizeTiles(){const t=this._requestedTiles,e=this._tileHandles,s=new Array;for(const u of t)e.has(u.id)||s.push(u);const o=new Array;for(const u of e.values()){const{id:e}=u;t.every(t=>t.id!==e)&&o.push(u.descriptor)}const a=this._tileHandles,{_boundingRect:i}=this,r=null!=i?s.filter(t
|
|
5
|
+
import{__addDisposableResource as t,__disposeResources as e,__decorate as s}from"tslib";import o from"../../../../../core/Accessor.js";import{isSome as a}from"../../../../../core/arrayUtils.js";import{createTask as i}from"../../../../../core/asyncUtils.js";import has from"../../../../../core/has.js";import{throwIfAborted as r,throwIfNotAbortError as n}from"../../../../../core/promiseUtils.js";import l from"../../../../../core/ReactiveMap.js";import{whenOnce as c}from"../../../../../core/reactiveUtils.js";import{waitTick as d}from"../../../../../core/scheduling.js";import{property as u}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromExtent as f,intersects as p}from"../../../../../geometry/support/aaBoundingRect.js";import{joinCommands as m}from"./PipelineCommand.js";import{FeatureData as y}from"./featureData/FeatureData.js";let _=class extends o{constructor(t){super(t),this.extent=null,this._tileHandles=new l,this._wanted=new l,this._updateRequested=!1,this._synchronizationTask=null,this._requestedTiles=new Array}destroy(){this._tileHandles.clear(),this._wanted.clear()}get updating(){return this._updateRequested||!(this._synchronizationTask?.finished??1)}get _boundingRect(){const{extent:t}=this;return null==t?null:f(t)}get _missingTiles(){const t=new Array,e=this._wanted,s=this._tileHandles;for(const o of e.values())null==s.get(o.id)?.featureData&&t.push(o);return t}onTileTreeChange({tiles:t}){this._requestedTiles=t,this._scheduleTilesSync()}_scheduleTilesSync(){if(this._updateRequested)return;this._updateRequested=!0;const t=this._synchronizationTask,e=i(async()=>{try{await c(()=>t?.finished??!0),await d(),this._updateRequested=!1,await this._synchronizeTiles()}finally{this._synchronizationTask===e&&(this._synchronizationTask=null)}});this._synchronizationTask=e}async _synchronizeTiles(){const t=this._requestedTiles,e=this._tileHandles,s=new Array;for(const u of t)e.has(u.id)||s.push(u);const o=new Array;for(const u of e.values()){const{id:e}=u;t.every(t=>t.id!==e)&&o.push(u.descriptor)}const a=this._tileHandles,{_boundingRect:i}=this,r=null!=i?s.filter(t=>!t.extent||p(i,t.extent)):s,n=this._wanted,l=new Array;for(const{id:u}of o)n.delete(u);for(const u of r)n.set(u.id,u);const c=this._missingTiles;for(const u of o){const{id:t}=u;if(c.some(t=>w(t,u)||w(u,t)))continue;const e=a.get(t);null!=e&&l.push(this._removeTile(e))}for(const u of r)l.push(this._addTile(u));const d=await Promise.allSettled(l);for(const u of d)"rejected"===u.status&&console.error(u.reason)}forEachTile(t){for(const e of this._tileHandles.values()){const s=e.featureData;null!=s&&t(s)}}*loadedTiles(){for(const t of this._tileHandles.values()){const e=t.featureData;null!=e&&(yield e)}}async _removeTile(s){s.loadTask.abort(),this._tileHandles.delete(s.id),this._validate();const{featureData:o}=s;if(null!=o){const s={stack:[],error:void 0,hasError:!1};try{t(s,await this.tileLocks.lock([o.tileId]),!1);const e=await this.createRemoveCommand(o.id);await(e?.execute())}catch(a){s.error=a,s.hasError=!0}finally{e(s)}}}async _addTile(t){const{_tileHandles:e}=this,s=e.get(t.id);if(null!=s){if(!T(s)||s.featureData.isFullyEnabled)return;return s.featureData.enableAll(),void await this._onTileLoad(s)}const o=new v(t,i(async e=>{const s=await this.loadTile(t,e);return r(e),new y(s)}));this._tileHandles.set(o.id,o);try{await o.loadTask.promise}catch(a){return void n(a)}g(o),await this._onTileLoad(o)}async _onTileLoad(s){const o={stack:[],error:void 0,hasError:!1};try{const{_wanted:e,_tileHandles:i,_missingTiles:r}=this,n=s.descriptor,l=new Array,c=new Array,d=new Array,u=new Set;for(const t of i.values()){if(t===s)continue;const{descriptor:o,id:a}=t;if(!(e.has(a)||r.some(t=>w(t,o)||w(o,t)))){i.delete(a),t.loadTask.abort();const{featureData:e}=t;null!=e&&l.push(e);continue}if(T(t)){if(w(n,o)){const e=t.featureData;for(const t of e.objectIds())u.add(t)}if(w(o,n)){const{featureData:e}=t;c.push(e)}}}u.size>0&&(s.featureData.disableObjectIds(u),this._validateRemoval(s.featureData,u)),this._validate(),d.push(s.featureData);const h=[...d,...l,...c].map(t=>t.tileId);t(o,await this.tileLocks.lock(h),!1);if(0!==c.length){const t=s.featureData,e=new Set(t.objectIds());for(const s of c)s.disableObjectIds(e),this._validateRemoval(s,e)}const f=l.map(t=>this.createRemoveCommand(t.id)),p=d.map(t=>this.createAddCommand(t)),y=c.map(t=>this.createUpdateCommand(t)),_=await Promise.all([...f,...p,...y]),v=m(_.filter(a));await(v?.execute())}catch(i){o.error=i,o.hasError=!0}finally{e(o)}}_validate(){if(!has("feature-pipeline-3d-test-validation"))return;const t=new Array;for(const e of this._tileHandles.values()){if(!T(e))continue;const{featureData:s}=e;t.push({featureData:s,objectIds:new Set(s.enabledObjectIds())})}for(let e=0;e<t.length;++e){const{featureData:s,objectIds:o}=t[e];for(let a=e+1;a<t.length;++a){const{featureData:e,objectIds:i}=t[a];for(const t of i)if(o.has(t))throw new Error(`${s.id} and ${e.id} both contain ${t}.`)}}}_validateRemoval(t,e){if(has("feature-pipeline-3d-test-validation"))for(const s of t.enabledObjectIds())if(e.has(s))throw new Error(`Failed to remove ${s} from ${t.id}!`)}};function w({lij:[t,e,s]},{lij:[o,a,i]}){const r=o-t;return r>=0&&e===a>>r&&s===i>>r}s([u()],_.prototype,"updating",null),s([u({constructOnly:!0})],_.prototype,"loadTile",void 0),s([u({constructOnly:!0})],_.prototype,"createAddCommand",void 0),s([u({constructOnly:!0})],_.prototype,"createRemoveCommand",void 0),s([u({constructOnly:!0})],_.prototype,"createUpdateCommand",void 0),s([u({constructOnly:!0})],_.prototype,"tileLocks",void 0),s([u()],_.prototype,"extent",void 0),s([u()],_.prototype,"_boundingRect",null),s([u()],_.prototype,"_missingTiles",null),s([u()],_.prototype,"_updateRequested",void 0),s([u()],_.prototype,"_synchronizationTask",void 0),_=s([h("esri.views.3d.layers.graphics.pipeline.Tile3DManager")],_);class v{constructor(t,e){this.descriptor=t,this.loadTask=e}get id(){return this.descriptor.id}get featureData(){return this.loadTask.value}}function T(t){return null!=t.featureData}function g(t){if(!T(t))throw new Error}export{_ as Tile3DManager};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import e from"../../../../core/Accessor.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{ExtentSet as
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../../../../core/Accessor.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{ExtentSet as o}from"../graphics/ExtentSet.js";import{TaskPriority as i}from"../../../support/Scheduler.js";let a=class extends e{constructor(t,e,s,r){super({}),this._updateExtent=e,this._updateNode=s,this._getElevationMode=r,this.readyToRun=!1,this._extentSet=new o,this._nodeSet=new Set;const i=this._taskPriority,a=t.registerTask(this._taskPriority,this);this.addHandles(a),this._task=a,this._lastTaskPriority=i}destroy(){this._extentSet.destroy()}get _taskPriority(){const t=this._getElevationMode();return t&&1===t?i.ELEVATION_ALIGNMENT_SCENE:i.ELEVATION_ALIGNMENT}_updateTaskPriority(){const t=this._taskPriority;t!==this._lastTaskPriority&&(this._task.priority=t,this._lastTaskPriority=t)}addExtent(t){this._extentSet.add(t),this._updateTaskPriority(),this.readyToRun=!0}schedule(t){this._nodeSet.add(t),this._updateTaskPriority(),this.readyToRun=!0}remove(t){this._nodeSet.delete(t),this._updateRunning()}runTask(t){const e=this._extentSet;for(t.run(()=>e.merge(t));!e.empty&&!t.done;){const s=this._updateExtent(e.pop());null!=s&&s.forAll(t=>this.schedule(t)),t.madeProgress()}if(t.done)return;const s=this._nodeSet;for(const r of s)if(s.delete(r),this._updateNode(r),t.madeProgress(),t.done)break;this._updateRunning()}_updateRunning(){this.readyToRun=this._nodeSet.size>0||this._extentSet.size>0}};t([s()],a.prototype,"readyToRun",void 0),a=t([r("esri.views.3d.layers.i3s.I3SAsyncElevationUpdater")],a);export{a as I3SAsyncElevationUpdater};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Error.js";import{assertIsSome as t}from"../../../../core/maybe.js";import{MinPriority as r}from"../../../../core/MemCache.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{generateUUID as n}from"../../../../core/uuid.js";import{normalFromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{q as i}from"../../../../chunks/vec32.js";import{ONES as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBoundingSphere as d}from"../../../../geometry/projection/projectBoundingSphere.js";import{
|
|
5
|
+
import e from"../../../../core/Error.js";import{assertIsSome as t}from"../../../../core/maybe.js";import{MinPriority as r}from"../../../../core/MemCache.js";import{throwIfAborted as o}from"../../../../core/promiseUtils.js";import{generateUUID as n}from"../../../../core/uuid.js";import{normalFromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{q as i}from"../../../../chunks/vec32.js";import{ONES as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBoundingSphere as d}from"../../../../geometry/projection/projectBoundingSphere.js";import{ensurePackedArray as c}from"../../../../geometry/support/DoubleArray.js";import{isRelativeVertexSpace as u}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{l as m}from"../../../../chunks/sphere.js";import{CachedMeshData as h}from"./CachedMeshData.js";import{convertMeshMaterialToPBRMaterial as f}from"./I3SClientMaterialUtil.js";class p{constructor(e,t,r,o){this._uid=e,this._worker=o,this._id2Meta=new Map,this._oid2Meta=new Map,this._indexSR=t.indexSR,this._vertexSR=t.vertexSR,this._renderSR=t.renderSR,this._memCache=r.newCache(`sl-client-mesh-data-${this._uid}`)}get uid(){return this._uid}get worker(){return this._worker}get indexSR(){return this._indexSR}get renderSR(){return this._renderSR}createMeshNodeInfo(e,t){const r=`mesh${t}`,o=e.extent,n=o.spatialReference,s=this._indexSR,a=x(o,e.origin);d(a,n,a,s);return{type:"mesh",id:r,version:S(e),oid:t,mbs:a,componentNodeIds:[],unloadedMesh:e,nodeIndex:null,loadMeshPromise:null}}addMeshNode(t,r){if(null!=this.getMeshNodeIndex(r.oid))throw new e("scenelayer",`I3SClientNodeLoader: client side mesh for feature oid=${r.oid} already exists`);r.nodeIndex=t,this._id2Meta.set(r.id,r),this._oid2Meta.set(r.oid,r)}getMeshNodeIndex(e){const t=this._oid2Meta.get(e);return null==t||"mesh"!==t.type?null:t.nodeIndex}getMeshNodeInfo(e){const t=this._oid2Meta.values();for(const r of t)if("mesh"===r.type&&r.id===e)return r;return null}removeNode(e){const t=this._id2Meta.get(e);null!=t&&(this._id2Meta.delete(e),"mesh"===t.type&&this._oid2Meta.delete(t.oid))}async loadNodeJSON(t){const r=this._id2Meta.get(t);if(null==r)throw new e("scenelayer",`I3SClientNodeLoader::loadNodeJSON unable to find node ${t}`);switch(r.type){case"mesh":return this._loadMeshNodeJSON(r);case"mesh-component":return y(r);default:throw new e("scenelayer",`I3SClientNodeLoader::loadNodeJSON unable to handle node ${t}`)}}async _loadMeshNodeJSON(e){const t=e.id,r=(await this._getMeshData(e)).loadedMesh;if(null==r.components||0===r.components.length)return{id:t,version:null,mbs:e.mbs,obb:null,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:null};const o=[],n=r.components;for(let s=0;s<n.length;++s){const r=`${t}-component${s}`,n={type:"mesh-component",id:r,mbs:e.mbs,componentIndex:s,meshNodeInfo:e,textureData:new Map};this._id2Meta.set(n.id,n),e.componentNodeIds.push(r),o.push({id:n.id,href:null,mbs:n.mbs,obb:null})}return{id:t,version:null,mbs:e.mbs,obb:null,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:o}}updateNodeIndex(e,t,r){const o=this._id2Meta.get(e);o&&"mesh"===o.type&&(o.nodeIndex=r)}async loadNodeData(r,n){const s=this._id2Meta.get(r);if(null==s||"mesh-component"!==s.type)throw new e("scenelayer",`Failed to load client node data for node ${r} (unexpected node info)`);const a=s.meshNodeInfo,i=await this._getMeshData(a),l=i.loadedMesh,d=a.oid;if(null==l.components)throw new e("scenelayer",`Failed to load client node data for node ${r} (unexpected null reference)`);const u=l.components[s.componentIndex],{material:m,requiredTextures:h,textureData:p}=await f(u.material);if(null!=p)for(const e of p)null!=e&&s.textureData.set(e.id,e);const y={params:{material:m},type:"ArrayBufferView"},{vertexSpace:x,origin:w,transform:S}=l,b=[w.x,w.y,w.z??0];i.projectionPromise||(t(this._worker,"SceneLayerWorker is needed to project mesh"),i.projectionPromise=this._worker.project({positions:l.vertexAttributes.position,localMatrix:S?.localMatrix,vertexSpace:x.toJSON(),origin:b,inSpatialReference:l.spatialReference.toJSON(),outSpatialReference:this._vertexSR.toJSON()},n));const{projected:_,original:N,projectedOrigin:v}=await i.projectionPromise,D=c(v);l.vertexAttributes.position=N;const{transformed:j,original:R}=await g(u,i,this._worker,n);l.vertexAttributes.normal=R,o(n);const{geometryBuffer:I,geometryDescriptor:A}=M(_,u.faces,j,l.vertexAttributes.uv,l.vertexAttributes.color,d);return{geometryData:{featureDataPosition:D,featureIds:[],geometries:[y]},attributeDataInfo:{attributeData:{},loadedAttributes:[]},geometryBuffer:I,geometryDescriptor:A,requiredTextures:h,textureData:p,normalReferenceFrame:this._vertexSR.isGeographic?"east-north-up":"vertex-reference-frame"}}async loadAttributes(e,t,r){const o=e.numFeatures,n={};for(const{field:{name:s}}of t)n[s]=new Array(o);return n}async loadTextures(e,t,r){const o=e.id,n=this._id2Meta.get(o);if(null==n||"mesh-component"!==n.type)throw new Error(`Failed to load textures for node ${e.id} (unexpected node info)`);const s=[];for(const a of t)s.push(n.textureData.get(a.id)||null);return s}async _getMeshData(e){const t=e.version,o=this._memCache.get(t);if(null==o){if(null!=e.loadMeshPromise)return e.loadMeshPromise;const o=async(o,n)=>{const s=e.unloadedMesh.clone();try{await s.load()}catch(i){n(i)}const a=new h(s);this._memCache.put(t,a,r),e.loadMeshPromise=null,o(a)};return e.loadMeshPromise=new Promise((e,t)=>o(e,t)),e.loadMeshPromise}return o}}async function y(e){return{id:e.id,version:e.meshNodeInfo.version,mbs:e.mbs,obb:null,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:null,isEmpty:!1}}function x(e,t){const{spatialReference:r}=e,o=[1,-1],n=[.5*e.width,.5*e.height,e.hasZ?.5*(e.zmax-e.zmin):0],s=r.isGeographic?r.metersPerUnit:1,a=e.center;let i=0;if(e.hasZ)for(let l=0;l<2;++l)for(let e=0;e<2;++e)for(let r=0;r<2;++r){const d=(a.x+o[l]*n[0]-t.x)*s,c=(a.y+o[e]*n[1]-t.y)*s,u=a.z+o[r]*n[2]-t.z;i=Math.max(d*d+c*c+u*u,i)}else for(let l=0;l<2;++l)for(let e=0;e<2;++e){const r=(a.x+o[l]*n[0]-t.x)*s,d=(a.y+o[e]*n[1]-t.y)*s;i=Math.max(r*r+d*d,i)}return m([t.x,t.y,t.z],Math.sqrt(i))}async function g(e,r,o,n){const{transform:d,vertexAttributes:c}=r.loadedMesh,u="source"===e.shading?c.normal:null;if(!(null!=u&&null!=d&&(0!==d.rotationAngle||!i(d.scale,l))))return{transformed:u,original:c.normal};if(!r.normalsTransformPromise){t(o,"SceneLayerWorker is needed to transform mesh normals");const e=a();s(e,d.localMatrix),r.normalsTransformPromise=o.transformNormals({normalMatrix:e,normals:u},n)}return r.normalsTransformPromise}function M(e,t,r,o,n,s){const a=1,i=(t?.length??0)/3,l=3*i;let d=0,c=0,u=!1,m=0,h=!1,f=0,p=!1,y=0,x=0,g=0;d+=b,d+=b,c=d,d+=3*l*_,null!=r&&(u=!0,m=d,d+=3*l*_),null!=o&&(h=!0,f=d,d+=2*l*_),null!=n&&(p=!0,y=d,d+=4*l*N),x=d,d+=a*v,g=d,d+=2*a*b;const M=new ArrayBuffer(d),S=new Uint8Array(M);w(S,0,l),w(S,b,a);const D=new Float32Array(M,c),j=null!=r?new Float32Array(M,m):null,R=null!=o?new Float32Array(M,f):null,I=null!=n?new Uint8Array(M,y):null;for(let w=0;w<i;++w){const s=3*w;for(let a=0;a<3;++a){const i=t[s+a],l=3*i,d=9*w+3*a;if(D[d]=e[l],D[d+1]=e[l+1],D[d+2]=e[l+2],j&&(j[d]=r[l],j[d+1]=r[l+1],j[d+2]=r[l+2]),R){const e=2*i,t=6*w+2*a;R[t]=o[e],R[t+1]=o[e+1]}if(I){const e=4*i,t=12*w+4*a;I[t]=n[e],I[t+1]=n[e+1],I[t+2]=n[e+2],I[t+3]=n[e+3]}}}w(S,x,s),w(S,x+b,s/2**32),w(S,g,0),w(S,g+b,i-1);return{geometryBuffer:M,geometryDescriptor:{isDraco:!1,isLegacy:!0,color:p,normal:u,uv0:h,uvRegion:!1,featureIndex:!0}}}function w(e,t,r){e[t]=255&r,e[t+1]=255&r>>8,e[t+2]=255&r>>16,e[t+3]=255&r>>24}function S(e){const t=e.metadata.displaySource?.source;if(null==t||!Array.isArray(t)||!t.length||t[0]instanceof File)return n();const r=t;let o="";for(const n of r)o+=n.makeHash();return o+JSON.stringify(e.transform?.toJSON()??"")+(u(e.vertexSpace)?JSON.stringify(e.vertexSpace.origin):"")+JSON.stringify(e.spatialReference)}const b=4,_=4,N=1,v=8;export{p as I3SClientNodeLoader,x as createSphereFromExtent,_ as sizeOfFloat32,b as sizeOfInt32,v as sizeOfUInt64,N as sizeOfUInt8,g as transformNormals};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as r}from"tslib";import t from"../../../../core/Accessor.js";import{removeUnordered as s}from"../../../../core/arrayUtils.js";import{makeHandle as e}from"../../../../core/handleUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{TaskPriority as i}from"../../../support/Scheduler.js";let a=class extends t{constructor(){super(),this.referenceCount=0,this.callbacks=new Array,this.runIndex=0}get
|
|
5
|
+
import{__decorate as r}from"tslib";import t from"../../../../core/Accessor.js";import{removeUnordered as s}from"../../../../core/arrayUtils.js";import{makeHandle as e}from"../../../../core/handleUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{TaskPriority as i}from"../../../support/Scheduler.js";let a=class extends t{constructor(){super(),this.referenceCount=0,this.callbacks=new Array,this.runIndex=0}get readyToRun(){return this.callbacks.some(r=>r.running)}runTask(r){this._sort();const t=this.callbacks,s={numIndexLoading:0,numNodesLoading:0};for(let e=0;e<t.length&&!r.done;++e)t[e].priority=t[e].runTask(r,s),this.runIndex=e}_sort(){const r=this.callbacks;let t=r.length;for(let s=this.runIndex;s>0;s--){const e=r[s-1];let o=s;for(;o<r.length&&e.priority<=r[o].priority&&(o!==t||e.priority<r[o].priority);)r[o-1]=r[o],o++;r[o-1]=e,t=o-1}this.runIndex=0}add(r){this._sort(),r.priority=1/0,this.callbacks.unshift(r),this.notifyChange("readyToRun")}remove(r){s(this.callbacks,r),this.runIndex=this.callbacks.length,this._sort(),this.notifyChange("readyToRun")}};r([o({readOnly:!0})],a.prototype,"readyToRun",null),a=r([n("esri.views.3d.layers.i3s.I3SFrameTask")],a);class l{constructor(r,t){this.task=r,this.handle=t}}const c=new Map;function h(r,t){let s=c.get(r);if(null==s){const t=new a,e=r.registerTask(i.I3S_CONTROLLER,t);s=new l(t,e),c.set(r,s)}return s.task.add(t),e(()=>{if(null==s)return;s.task.remove(t);s.task.callbacks.length>0||(c.delete(r),s.handle.remove(),s.task.destroy()),s=null})}export{h as addCallback};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{getReferenceEllipsoid as e}from"../../../../geometry/ellipsoidUtils.js";import{create as t}from"../../../../geometry/support/aaBoundingRect.js";const i="virtual-snapshot-tile",s="virtual-display-filter-highlight-tile";class l{constructor(e,i,s,l,n=h(e,i,s)){this._tilingScheme=l,this.id=n,this.lij=[0,0,0],this.extent=
|
|
5
|
+
import{getReferenceEllipsoid as e}from"../../../../geometry/ellipsoidUtils.js";import{create as t}from"../../../../geometry/support/aaBoundingRect.js";const i="virtual-snapshot-tile",s="virtual-display-filter-highlight-tile";class l{constructor(e,i,s,l,n=h(e,i,s)){this._tilingScheme=l,this.id=n,this.lij=[0,0,0],this.extent=null,this.measures=new r,this.loadPriority=0,this.used=!1,this.lij[0]=this.measures.lodLevel=e,this.lij[1]=i,this.lij[2]=s,l&&(this.extent=t(),l?.getExtent(e,i,s,this.extent))}get planetRadius(){return e(this.spatialReference).radius}get spatialReference(){return this._tilingScheme?.spatialReference}get resolution(){return this._tilingScheme?.resolutionAtLevel(this.measures.lodLevel)??0}get level(){return this.lij[0]}get lodLevelDelta(){return this.measures.lodLevel-this.level}createChildren(){const e=this.lij[0]+1,t=2*this.lij[1],i=2*this.lij[2];return[new l(e,t,i,this._tilingScheme),new l(e,t+1,i,this._tilingScheme),new l(e,t,i+1,this._tilingScheme),new l(e,t+1,i+1,this._tilingScheme)]}}class r{constructor(){this.visible=!0,this.distance=0,this.lodLevel=0,this.splitPriority=0,this.mergeable=!0}}function h(e,t,i){return`${e}/${t}/${i}`}export{l as FeatureTileDescriptor,h as getFeatureTileId,s as virtualDisplayFilterHighlightTileId,i as virtualSnapshotTileId};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{filterInPlace as s}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{getOrCreateMapValue as r}from"../../../../core/MapUtils.js";import{isAbortError as a,throwIfAborted as n}from"../../../../core/promiseUtils.js";import o from"../../../../core/ReactiveMap.js";import{on as u,watch as l}from"../../../../core/reactiveUtils.js";import{schedule as h}from"../../../../core/scheduling.js";import{signal as d}from"../../../../core/signal.js";import{sqlAnd as c}from"../../../../core/sql.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as f}from"../../../../core/accessorSupport/decorators/subclass.js";import{getEpsilon as _}from"../../../../core/libs/gl-matrix-2/math/common.js";import{create as m,equals as g,clone as F,expand as y,toExtent as T,width as x,height as v}from"../../../../geometry/support/aaBoundingRect.js";import{getObjectId as R,hasVertices as b,computeAABR as E}from"../../../../layers/graphics/dehydratedFeatures.js";import C from"../../../../rest/support/QuantizationParameters.js";import D from"../../../../rest/support/Query.js";import{MultiFeatureReference as w,SingleFeatureReference as M}from"./featureReference.js";import{failedFeatureCount as U,FeatureTile as j}from"./FeatureTile.js";import{virtualDisplayFilterHighlightTileId as A,virtualSnapshotTileId as I}from"./FeatureTileDescriptor.js";import{tilesAreRelated as O}from"../../terrain/tileUtils.js";import{ImmediateTask as P,TaskPriority as z}from"../../../support/Scheduler.js";let q=class extends t{set maximumNumberOfFeatures(e){e=e||1/0;const t=this._get("maximumNumberOfFeatures");e===t||e<1||(this._set("maximumNumberOfFeatures",e),this._maximumFeaturesUpdated(t,e))}set memoryFactor(e){this.memoryFactor!==e&&(this._set("memoryFactor",e),this._setDirty())}set lodFactor(e){this.lodFactor!==e&&(this._set("lodFactor",e),this._supportsResolution&&this.refetch())}get useTileCount(){return this._useTileCount&&null!=this.context.query.queryFeatureCount}set useTileCount(e){this._useTileCount=e,this.notifyChange("useTileCount")}get updating(){return this._dirty||!!this._pendingEdits||this._isFetching||(this.tileDescriptors?.updating??!1)}get running(){return this._dirty}get memoryForUnusedFeatures(){let e=0;return this._featureTiles.forEach(t=>e+=t.estimatedUnusedSize),e}get totalVertices(){let e=0;return this._featureTiles.forEach(t=>e+=t.numVertices),e}get totalFeatures(){let e=0;return this._featureTiles.forEach(t=>e+=t.numFeatures),e}get showsAllFeatures(){if(this._paused||this.dataUpdating)return!1;for(const e of this._featureTiles.values())if(!this.hasFullGeometries&&0!==e.emptyFeatureRatio||!e.showsAllFeatures)return!1;return!0}get hasFullGeometries(){if(!this._supportsResolution)return!0;const e=this.tileDescriptors?.some(Q);return e||!this.context.capabilities.supportsQuantization&&"polyline"!==this.context.geometryType}set filterExtent(e){if(null!=e&&this.context.tilingScheme&&!e.spatialReference.equals(this.context.tilingScheme.spatialReference))return void i.getLogger(this).error("#filterExtent=","extent needs to be in the same spatial reference as the tiling scheme");const t=this._get("filterExtent");if(t===e||null!=t&&e&&t.equals(e))return;const s=null!=e?e.clone():null;this._set("filterExtent",s),this._reclip(s,t)}_updateTileZQuantization(e){if(1===this.context.viewingMode){const t=e.computeZQuantizationFactor();this._zQuantizationFactor.value<t&&(this._zQuantizationFactor.value=t)}}get _tileZQuantization(){return this.context.isDraped?1:this._zQuantizationFactor.value}constructor(e){super(e),this._useTileCount=!1,this.dataUpdating=!1,this.updatingTotal=0,this.updatingRemaining=0,this.expectedFeatureDiff=0,this.maximumNumberOfFeaturesExceeded=!1,this._fullRatio=1,this._farRatio=1,this._zQuantizationFactor=d(1),this._changes={updates:{adds:new Array,removes:new Array},adds:new Array,removes:new Array},this._featureTiles=new o,this._displayingFeatureReferences=new Map,this._numDisplayingFeatureReferences=0,this._dirty=!1,this._suspended=!0,this._pendingEdits=null,this._applyEditsTilesUpdated=!1,this._isFetching=!1;const t=e.context;this._frameTask=t.scheduler?.registerTask(z.FEATURE_TILE_FETCHER,this)??P,this.FeatureReferenceClass=t.capabilities.supportsMultipleResolutions?w:M,this._objectIdField=t.objectIdField}initialize(){this.addHandles([u(()=>this.tileDescriptors,"change",()=>this._setDirty()),l(()=>this._tileZQuantization,()=>this.refetch())]),this._setDirty()}destroy(){this._frameTask.remove(),this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._removeTile(e)}),this._featureTiles.clear(),this._displayingFeatureReferences.clear(),this._pendingEdits?.controller.abort(),this._pendingEdits=null}get _paused(){return this._suspended||!!this._pendingEdits}restart(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._clearTile(e),this._resetFetchTile(e)}),null!=this.context.memoryCache&&this.context.memoryCache.clear(),this._setDirty()}refetch(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._resetFetchTile(e)}),null!=this.context.memoryCache&&this.context.memoryCache.clear(),this._setDirty()}refetchDisplayFilterHighlightTile(){const e=this._featureTiles.get(A);e&&(this._cancelFetchTile(e),this._resetFetchTile(e),this._setDirty())}suspend(){this._suspended||(this._suspended=!0,this._pause(),this._setDirty())}resume(){this._suspended&&(this._suspended=!1,this._unpause())}getMissingAttributesForFeature(e){for(const t of this._featureTiles.values()){const s=t.missingAttributes?.get(e);if(null!=s)return s}}_pause(){this._paused&&(this._featureTiles.forEach(e=>this._cancelFetchTile(e)),this._updated())}_unpause(){this._paused||this._setDirty()}get availableFields(){let e=null;return this._featureTiles.forEach(t=>{null!=t.displayingFeatures&&0!==t.displayingFeatures.length&&(null==e?e=new Set(t.availableFields):e.forEach(s=>{t.availableFields?.has(s)||e.delete(s)}))}),null!=e?e:new Set}applyEdits(e){this._pendingEdits||(this._pendingEdits={edits:Promise.resolve(),count:0,controller:new AbortController},this._pause());const t=this._pendingEdits;t.count++;const s=t.edits.then(()=>e.result.catch(e=>{if(a(e))throw e;return null}).then(e=>e?(this._applyEditsDeleteFeatures(e.deletedFeatures),this._applyEditsAddUpdateFeatures(e.addedFeatures,e.updatedFeatures,t.controller.signal).then(()=>e)):e).then(e=>(0===--t.count&&(this._pendingEdits===t&&(this._pendingEdits=null),null!=this.context.memoryCache&&this.context.memoryCache.clear(),this._applyEditsTilesUpdated=!1,this._unpause()),e)));return t.edits=s,this._updated(),s}_applyEditsDeleteFeatures(e){if(0===e.length)return;const t=this.context.globalIdField,s=t&&this.availableFields.has(t),r=new Set,a=this._objectIdField;e.forEach(({objectId:e,globalId:n})=>{(!e||e<0)&&t&&n&&(s||i.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected in the view`),e=this._objectIdFromGlobalId(n,a,t)),null!=e&&e>=0&&r.add(e)}),this._featureTiles.forEach(e=>{if(!e.features)return;const t=e.features.filter(e=>!r.has(R(e,this._objectIdField)));t.length!==e.features.length&&(this._applyEditsTileUpdated(),e.setFeatures(t,0,e.availableFields,e.missingAttributes),this._updateTileZQuantization(e),this._invalidateCounts())})}_objectIdFromGlobalId(e,t,s){if(null==e)return null;const i=this.features.find(t=>t.attributes?.[s]===e);return i?R(i,t):null}async _applyEditsAddUpdateFeatures(e,t,s){const{objectIdField:r,globalIdField:a}=this.context,n=a&&this.availableFields.has(a),o=new Set,u=new Set;for(const i of e){const e=i.objectId;null!=e&&o.add(e)}for(const{objectId:h,globalId:d}of t){let e=h;(null==e||e<0)&&a&&(n||i.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${a} to be included the layer's outFields for updates to be reflected in the view`),e=this._objectIdFromGlobalId(d,r,a)),null!=e&&e>=0&&(o.add(e),u.add(e))}if(0===o.size)return;const l=[];this._featureTiles.forEach(e=>{const t=this._applyEditsAddUpdateTile(e,o,u,s);t&&l.push(t)}),this._updated(),await Promise.allSettled(l)}async _applyEditsAddUpdateTile(e,t,s,i){if(!e.features)return;e.fetchingResolution=e.descriptor.resolution;const r=this._createQuery(e);r.resultType=void 0,r.cacheHint=!1,r.objectIds=Array.from(t);const a=await this._queryFeatures(r,i);let n=null;if(s.size>0){const t=e.features.filter(e=>!s.has(R(e,this._objectIdField)));t.length!==e.features.length&&(n=t)}if(a.features.length>0){n||(n=e.features.slice());for(const e of a.features)n.push(e)}n&&(e.hasPreciseFeatureCount&&(e.numFeatures=Math.max(e.numFeatures,n.length)),this._applyEditsTileUpdated(),e.setFeatures(n,0,Z(e.availableFields,a.fields),V(e.missingAttributes,a.missingAttributes)),this._updateTileZQuantization(e),this._invalidateCounts())}_applyEditsTileUpdated(){this._applyEditsTilesUpdated||(this._applyEditsTilesUpdated=!0,this._updated())}_queryFeatures(e,t){return this.context.query.queryFeaturesDehydrated(e,{signal:t,timeout:J})}_setDirty(){this._dirty=!0,this._updated()}runTask(e){const t=this._frameTask.processQueue(e);if(!this._dirty||!this.initialized)return t;this._dirty=!1;const s=this._featureTilesArray;if(this._markTilesNotAlive(s),!e.run(()=>this._addTiles(s,e))||!e.run(()=>this._filterExtentTiles(s,e))||!e.run(()=>this._removeTiles(s,e))||e.done)return void this._setDirty();const i=this._sortTiles(s);e.run(()=>this._showTiles(i,e))&&e.run(()=>this._fetchTiles(i,e))&&e.run(()=>this._updateMemoryEstimates(i,e))||this._setDirty(),this._updated(),this.updating||this._updateMaximumNumberOfFeaturesExceeded()}_markTilesNotAlive(e){for(const t of e)t.alive=!1}_addTiles(e,t){return!(this._suspended||!this.tileDescriptors)&&(this.tileDescriptors.forEach(s=>{const i=this._featureTiles.get(s.id);i?i.alive=!0:t.done||(e.push(this._addTile(s)),t.madeProgress())}),t.hasProgressed)}_filterExtentTiles(e,t){for(const s of e){if(t.done)break;s.alive&&(s.filtered=!s.intersects(this.filterExtent),s.filtered&&(this._clearTile(s),t.madeProgress()))}return t.hasProgressed}_removeTiles(e,t){for(let s=e.length-1;s>=0&&!t.done;s--){const i=e[s];i.alive||(this._removeTile(i),s!==e.length-1&&(e[s]=e[e.length-1]),e.pop(),t.madeProgress())}return t.hasProgressed}_sortTiles(e){return e.sort((e,t)=>e.descriptor.loadPriority-t.descriptor.loadPriority),e}_showTiles(e,t){const s=this._updateRatio(e),i=e=>{const t=this._fullRatio<1?s(e)*this._farRatio:1;e.reduceFeatures(t,this.memoryFactor,this._objectIdField,this._reduceMode)&&this._setDirty();const{numFeatures:i,fetchingResolution:r,descriptor:a,isFetched:n}=e;return this._supportsResolution&&i>0&&r!==a.resolution&&n&&(e.requestRefetch(),this._setDirty()),this._showTile(e)};for(const r of e)if(!t.run(()=>i(r))){this._setDirty();break}return t.hasProgressed}_fetchTiles(e,t){if(this._paused)return!1;let s=!1;for(const i of e){if(!i.needsFetch)continue;const e=null!=this.context.memoryCache?this.context.memoryCache.pop(i.id):null;if(e?.resolution!==i.displayingResolution){if(this._needsNumFeatures(i)){const e=new AbortController,r=this._fetchTileCount(i,e.signal);this._handleRequest(i,r,e,()=>i.resetFetching(),()=>i.numFeatures=U),s=!0,t.madeProgress()}if(t.done)return!0}else i.cache=e,i.numFeatures&&this._notifyDataUpdating(),this._setDirty(),this._scheduleUpdated(),t.madeProgress()}if(s)return t.hasProgressed;for(const r of e){if(!r.needsFetch)continue;const e=new AbortController,s=this._fetchTile(r,e.signal);if(this._handleRequest(r,s,e,e=>r.fetchDone(e),e=>{r.fetchFailed=!0,this.context.logFetchError(i.getLogger(this),e)}),t.madeProgress(),t.done)return!0}return t.hasProgressed}_updateMemoryEstimates(e,t){return e.some(e=>!t.run(()=>e.updateMemoryEstimates())&&(this._setDirty(),!0)),t.hasProgressed}_reclip(e,t){if(!this.initialized)return;const s=new Array;this._featureTiles.forEach(i=>{null!=i.displayingFeatures&&0!==i.displayingFeatures.length&&(i.intersectionIncludingBorrowed(t,B),i.intersectionIncludingBorrowed(e,G),g(B,G)||s.push(i))}),this._refreshDisplayingFeatures(s),this._updated()}_refreshDisplayingFeatures(e){const t=new Set,s=this._changes.updates;for(const i of e)if(null!=i.displayingFeatures)for(const e of i.displayingFeatures){const i=R(e,this._objectIdField);if(t.has(i))continue;t.add(i);const r=this._displayingFeatureReferences.get(i).feature;s.removes.push(r),s.adds.push(r)}this._applyChanges()}_updated(){let e=0;if(this._paused||this._featureTiles.forEach(t=>t.isFetching?++e:0),this._isFetching=e>0,e>0||this._applyEditsTilesUpdated?this._notifyDataUpdating():this._dirty||this._set("dataUpdating",!1),this.updating){let t=0,s=0,i=0,r=0,a=0;const n=this._displayingFeatureReferences.size/this._numDisplayingFeatureReferences;this._featureTiles.forEach(e=>{if(++s,e.isFetching&&e.hasPreciseFeatureCount){const t=this._maximumFeaturesForTile(e)*(1-e.emptyFeatureRatio),s=null!=e.displayingFeatures?e.displayingFeatures.length*n:0;a+=t-s}e.needsFetch?++r:e.numFeatures>0&&(++i,t+=e.numFeatures)}),r+=e;let o=0,u=0;t?(u=t,o=Math.min(r*t/i,t)):(u=s,o=r),a=Math.min(this.maximumNumberOfFeatures-this.features.length,a),this._set("updatingTotal",u),this._set("updatingRemaining",o),this._set("expectedFeatureDiff",a)}else this._set("updatingTotal",0),this._set("updatingRemaining",0),this._set("expectedFeatureDiff",0);this.debugger?.update()}_updateMaximumNumberOfFeaturesExceeded(){for(const{perTileMaximumNumberOfFeaturesExceeded:e}of this._featureTiles.values())if(e)return void this._set("maximumNumberOfFeaturesExceeded",!0);this._set("maximumNumberOfFeaturesExceeded",!1)}_updateRatio(e){const t=k(e),s=e=>1/(1<<Math.max(0,t-e.descriptor.lij[0]));let i=0,r=0;for(const a of e){const e=a.numFeatures;i+=e,r+=e*s(a)}return this._fullRatio=Math.min(1,this.maximumNumberOfFeatures/i),this._farRatio=this.maximumNumberOfFeatures/r,this._scheduleUpdated(),s}_maximumFeaturesUpdated(e,t){e!==t&&(t>e&&this._featureTiles.forEach(e=>{if(!e.featuresMissing)return;const t=this._maximumFeaturesForTile(e);e.isFullyFetched(t)||(this._cancelFetchTile(e),this._resetFetchTile(e))}),this._setDirty())}_addTile(e){const t=new j(e);return this._featureTiles.set(t.id,t),this._resetFetchTile(t),this._referenceDisplayingFeaturesFromRelatedTiles(t),t}_referenceDisplayingFeaturesFromRelatedTiles(e){const t=e.displayingResolution;this._featureTiles.forEach(s=>{if(null!=s.displayingFeatures&&e!==s&&O(e.descriptor.lij,s.descriptor.lij)){null==e.displayingFeatures&&(e.displayingFeatures=[]),e.descriptor.extent&&s.descriptor.extent&&(e.extentIncludingBorrowedFeatures??=F(e.descriptor.extent),y(e.extentIncludingBorrowedFeatures,s.descriptor.extent,e.extentIncludingBorrowedFeatures));for(const i of s.displayingFeatures){e.displayingFeatures.push(i);const s=this._displayingFeatureReferences.get(R(i,this._objectIdField));s.ref(s.feature,t),this._numDisplayingFeatureReferences++}}})}_removeTile(e){this._clearTile(e),this._featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetch&&e.fetchDone(4):e.requestFetch()}_cancelFetchTile(e){const t=e.requestController;null!=t&&(e.requestController=null,e.resetFetching(),t.abort())}async _fetchTileCount(e,t){e.numFeatures=await this._fetchCount(e,t),this._updateRatio(this._featureTilesArray)}async _fetchTile(e,t){e.fetchFailed=!1;const s=this._maximumFeaturesForTile(e);if(s<=0)return e.hasPreciseFeatureCount&&0===e.numFeatures||(e.fetchFailed=!0),L(e),e.fetchInformation.value="Empty tile",4;const i=this._getMaxRecordCount(e),r=Math.ceil(s/i);if(e.fetchingResolution=e.descriptor.resolution,S(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=s&&r>D.MAX_MAX_RECORD_COUNT_FACTOR)return this._fetchPagedTile(e,t);const a=this._createQuery(e);if(a.maxRecordCountFactor=r,e.isRefetching&&e.features&&e.features.length>0){const t=Math.ceil(e.features.length/(1-e.emptyFeatureRatio)/i);a.maxRecordCountFactor=Math.max(t+1,a.maxRecordCountFactor)}e.fetchInformation.value=`Single fetch\n${s} features`;const{features:o,exceededTransferLimit:u,fields:l,missingAttributes:h}=await this._queryFeatures(a,t),d=u||a.maxRecordCountFactor>=D.MAX_MAX_RECORD_COUNT_FACTOR||s===this._totalFeaturesForTile(e)?5:4,c=await this._frameTask.schedule(()=>{e.exceededTransferLimit.value=!!u;const t=this._removeEmptyFeatures(o,this._getEffectiveTileResolution(e));return e.fetchInformation.value=`Single fetch\n${o.length}/${s} features`,e.setFeatures(o,t,H(l),V(void 0,h)),this._updateTileZQuantization(e),this._maximumFeaturesForTile(e)>s?1:d},t);return n(t),this._invalidateCounts(),c}async _fetchCount(e,t){return this.context.query.queryFeatureCount(this._createFeatureCountQuery(e),{signal:t})}async _fetchPagedTile(e,t){let s,i=0,r=0,a=0,o=this._maximumFeaturesForTile(e)-a;const u=this._getMaxRecordCount(e);let l,h=null;for(;;){const d=this._createQuery(e),c=this._setPagingParameters(d,i,o,u);e.fetchInformation.value=`Paged fetch\n${e.features?.length}/${o} features`;const{features:p,exceededTransferLimit:f,fields:_,missingAttributes:m}=await this._queryFeatures(d,t);if(await this._frameTask.schedule(()=>{c&&(i+=d.num),a+=p.length,r+=this._removeEmptyFeatures(p,this._getEffectiveTileResolution(e)),e.exceededTransferLimit.value=!!f,s=s?.concat(p)??p,h=Z(h,_),l=V(l,m),e.setFeatures(s,r,h,l),this._updateTileZQuantization(e),this._invalidateCounts(),this._setDirty()},t),n(t),o=this._maximumFeaturesForTile(e)-(s?.length??0),!c||!f||o<=0)return f?4:5}}_createFeatureCountQuery(e){const t=this._createQuery(e);return this.context.capabilities.supportsCacheHint&&(t.resultType=void 0,t.cacheHint=!0),t}_createQuery(e){const t=this.context.createQuery();return t.resultType=this._resultType(e),S(e)||(t.geometry=T(e.descriptor.extent,this.context.tilingScheme.spatialReference)),this._setResolutionParams(t,e),"tile"!==t.resultType&&this.context.capabilities.supportsCacheHint&&(t.cacheHint=!0),N(e)&&this.context.highlightIds?.length?t.objectIds=this.context.highlightIds:!Q(e)&&this.context.effectiveDisplayFilter&&(t.where=c(t.where,this.context.effectiveDisplayFilter.where)),t}_setPagingParameters(e,t,s,i){return!!this.context.capabilities.supportsPagination&&(e.start=t,s>0&&this.context.capabilities.supportsMaxRecordCountFactor?(e.maxRecordCountFactor=Math.ceil(s/i),e.num=Math.min(e.maxRecordCountFactor*i,s)):e.num=Math.min(i),!0)}_getEffectiveTileResolution(e){if(S(e)||!this._supportsResolution)return null;const t=1===this.context.viewingMode?this.context.tilingScheme.resolutionAtLevel(3):1/0;return Math.min(e.fetchingResolution,t)/this.lodFactor/this._tileZQuantization}get _supportsResolution(){return this.context.capabilities.supportsMultipleResolutions&&"point"!==this.context.geometryType}_setResolutionParams(e,t){const s=this._getEffectiveTileResolution(t);null!=s&&(this.context.capabilities.supportsQuantization?e.quantizationParameters=new C({mode:"view",originPosition:"upper-left",tolerance:s,extent:this.context.fullExtent}):"polyline"===this.context.geometryType&&(e.maxAllowableOffset=s))}_removeEmptyFeatures(e,t){const i=e.length;if(t&&this._supportsResolution){const i=t*(1+_());s(e,({geometry:e})=>!(!e||!b(e))&&(E(e,X),x(X)>i||v(X)>i))}else s(e,({geometry:e})=>b(e));return i-e.length}_needsNumFeatures(e){return this.useTileCount&&e.needsFeatureCount&&!Q(e)}_getMaxRecordCount(e){switch(this._resultType(e)){case"tile":if(this.context.tileMaxRecordCount)return this.context.tileMaxRecordCount;break;case"standard":if(this.context.standardMaxRecordCount)return this.context.standardMaxRecordCount}return this.context.maxRecordCount||$}_resultType(e){if(this.context.capabilities.supportsResultType)return Q(e)?"standard":"tile"}get _reduceMode(){const e=this.context.geometryType;return"polygon"===e||"polyline"===e?0:1}_handleRequest(e,t,s,i,r){e.startFetch(),e.requestController=s;let n=!1;t.then(t=>{e.requestController=null,i(t)}).catch(t=>{e.requestController===s&&(e.requestController=null,e.fetchDone(4)),a(t)?n=!0:r(t)}).then(()=>{n||this._setDirty(),this._scheduleUpdated()})}_scheduleUpdated(){this.hasHandles("scheduleUpdated")||this.addHandles(h(()=>{this.removeHandles("scheduleUpdated"),this._updated()}),"scheduleUpdated")}_showTile(e){if(e.displayingFeatures&&!e.needsDisplayUpdate)return!1;const t=e.features;if(0===e.featureLimit||!t){const t=null!=e.displayingFeatures&&e.displayingFeatures.length>0;return this._hideTileFeatures(e),e.displayingFeatures=[],t}const s=e.fetchingResolution,{adds:i,updates:r}=this._changes,a=Math.min(e.featureLimit,t.length);for(let n=0;n<a;++n){const e=t[n],a=R(e,this._objectIdField),o=this._displayingFeatureReferences.get(a);if(o){const{oldVersion:t,newVersion:i}=o.ref(e,s);t!==i&&(t&&r.removes.push(t),i&&r.adds.push(i))}else this._displayingFeatureReferences.set(a,new this.FeatureReferenceClass(e,s)),i.push(e);this._numDisplayingFeatureReferences++}return this._hideTileFeatures(e),e.displayingResolution=e.fetchingResolution,this._applyChanges(),e.displayingFeatures=t.slice(0,a),!0}_hideTile(e){this._cancelFetchTile(e),this._hideTileFeatures(e)}_hideTileFeatures(e){if(null==e.displayingFeatures)return;const{updates:t,removes:s}=this._changes;for(const i of e.displayingFeatures){const r=R(i,this._objectIdField),a=this._displayingFeatureReferences.get(r);if(!a)continue;const{oldVersion:n,newVersion:o}=a.unref(e.displayingResolution);this._numDisplayingFeatureReferences--,n!==o&&(null==o?(this._displayingFeatureReferences.delete(r),n&&s.push(n)):(t.adds.push(o),n&&t.removes.push(n)))}this._applyChanges(),e.displayingFeatures=null}_notifyDataUpdating(){this._get("dataUpdating")||this._set("dataUpdating",!0)}_applyChanges(){const e=this._changes.updates;e.removes.length>0&&(this._notifyDataUpdating(),this.features.removeMany(e.removes),e.removes.length=0),e.adds.length>0&&(this._notifyDataUpdating(),this.features.addMany(e.adds),e.adds.length=0);const t=this._changes.adds,s=this._changes.removes,i=Math.min(t.length,s.length);let r=0;for(;r<i;){const e=Math.min(r+K,i);this._notifyDataUpdating(),this.features.addMany(t.slice(r,e)),this.features.removeMany(s.slice(r,e)),r=e}t.length>i&&(this._notifyDataUpdating(),this.features.addMany(0===r?t:t.slice(r))),s.length>i&&(this._notifyDataUpdating(),this.features.removeMany(0===r?s:s.slice(r))),t.length=0,s.length=0}_clearTile(e){this._hideTile(e),e.features&&null!=this.context.memoryCache&&this.context.memoryCache.put(e.id,e.cache),e.setFeatures(null,0,null,void 0),this._invalidateCounts()}_invalidateCounts(){this.notifyChange("totalVertices"),this.notifyChange("totalFeatures"),this.notifyChange("memoryForUnusedFeatures")}get _featureTilesArray(){return Array.from(this._featureTiles.values())}get featureTiles(){return this._featureTiles}get storedFeatures(){return this._featureTilesArray.reduce((e,t)=>e+(t.features?t.features.length:0),0)}get missingTiles(){return Array.from(this._featureTiles.values()).reduce((e,t)=>e+(t.needsFetch||t.isFetching?1:0),0)}_totalFeaturesForTile(e){return e.hasPreciseFeatureCount?e.numFeatures:this.maximumNumberOfFeatures}_maximumFeaturesForTile(e){const t=this._totalFeaturesForTile(e),s=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(t*s/(1-e.emptyFeatureRatio)),t)}get test(){}};function Q(e){return e.id===I}function N(e){return e.id===A}function S(e){return Q(e)||N(e)}function k(e){let t=0;for(const s of e)s.features&&s.features.length>0&&s.alive&&(t=Math.max(t,s.descriptor.lij[0]));return t}function L(e){e.setFeatures([],0,null,void 0)}function H(e){return null==e?new Set:new Set(e.map(e=>e.name))}function Z(e,t){if(null==e||null==t)return H(t);const s=new Set;for(const{name:i}of t)e.has(i)&&s.add(i);return s}function V(e,t){if(!t?.length)return e;e??=new Map;const s=()=>new Set;for(const{objectId:i,attribute:a}of t)r(e,i,s).add(a);return e}e([p({constructOnly:!0})],q.prototype,"features",void 0),e([p()],q.prototype,"tileDescriptors",void 0),e([p({value:1/0})],q.prototype,"maximumNumberOfFeatures",null),e([p({value:1})],q.prototype,"memoryFactor",null),e([p({value:1})],q.prototype,"lodFactor",null),e([p()],q.prototype,"useTileCount",null),e([p({readOnly:!0})],q.prototype,"updating",null),e([p({readOnly:!0})],q.prototype,"dataUpdating",void 0),e([p({readOnly:!0})],q.prototype,"updatingTotal",void 0),e([p({readOnly:!0})],q.prototype,"updatingRemaining",void 0),e([p({readOnly:!0})],q.prototype,"expectedFeatureDiff",void 0),e([p({readOnly:!0})],q.prototype,"memoryForUnusedFeatures",null),e([p({readOnly:!0})],q.prototype,"maximumNumberOfFeaturesExceeded",void 0),e([p({readOnly:!0})],q.prototype,"totalVertices",null),e([p({readOnly:!0})],q.prototype,"totalFeatures",null),e([p({readOnly:!0})],q.prototype,"showsAllFeatures",null),e([p({readOnly:!0})],q.prototype,"hasFullGeometries",null),e([p()],q.prototype,"filterExtent",null),e([p({constructOnly:!0})],q.prototype,"context",void 0),e([p()],q.prototype,"_dirty",void 0),e([p()],q.prototype,"_suspended",void 0),e([p()],q.prototype,"_pendingEdits",void 0),e([p()],q.prototype,"_applyEditsTilesUpdated",void 0),e([p()],q.prototype,"_paused",null),e([p()],q.prototype,"_isFetching",void 0),q=e([f("esri.views.3d.layers.support.FeatureTileFetcher3D")],q);const $=2e3,B=m(),G=m(),X=m(),J=6e5,K=200;export{q as FeatureTileFetcher3D};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{filterInPlace as s}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{getOrCreateMapValue as r}from"../../../../core/MapUtils.js";import{isAbortError as a,throwIfAborted as n}from"../../../../core/promiseUtils.js";import o from"../../../../core/ReactiveMap.js";import{on as l,watch as u}from"../../../../core/reactiveUtils.js";import{schedule as h}from"../../../../core/scheduling.js";import{signal as d}from"../../../../core/signal.js";import{sqlAnd as c}from"../../../../core/sql.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as f}from"../../../../core/accessorSupport/decorators/subclass.js";import{getEpsilon as _}from"../../../../core/libs/gl-matrix-2/math/common.js";import{create as m,equals as g,clone as F,expand as y,toExtent as T,width as x,height as v}from"../../../../geometry/support/aaBoundingRect.js";import{getObjectId as R,hasVertices as b,computeAABR as E}from"../../../../layers/graphics/dehydratedFeatures.js";import C from"../../../../rest/support/QuantizationParameters.js";import D from"../../../../rest/support/Query.js";import{MultiFeatureReference as w,SingleFeatureReference as M}from"./featureReference.js";import{failedFeatureCount as U,FeatureTile as j}from"./FeatureTile.js";import{virtualDisplayFilterHighlightTileId as A,virtualSnapshotTileId as I}from"./FeatureTileDescriptor.js";import{tilesAreRelated as O}from"../../terrain/tileUtils.js";import{ImmediateTask as P,TaskPriority as z}from"../../../support/Scheduler.js";let q=class extends t{set maximumNumberOfFeatures(e){e=e||1/0;const t=this._get("maximumNumberOfFeatures");e===t||e<1||(this._set("maximumNumberOfFeatures",e),this._maximumFeaturesUpdated(t,e))}set memoryFactor(e){this.memoryFactor!==e&&(this._set("memoryFactor",e),this._setDirty())}set lodFactor(e){this.lodFactor!==e&&(this._set("lodFactor",e),this._supportsResolution&&this.refetch())}get useTileCount(){return this._useTileCount&&null!=this.context.query.queryFeatureCount}set useTileCount(e){this._useTileCount=e,this.notifyChange("useTileCount")}get updating(){return this._dirty||!!this._pendingEdits||this._isFetching||(this.tileDescriptors?.updating??!1)}get readyToRun(){return this._dirty}get memoryForUnusedFeatures(){let e=0;return this._featureTiles.forEach(t=>e+=t.estimatedUnusedSize),e}get totalVertices(){let e=0;return this._featureTiles.forEach(t=>e+=t.numVertices),e}get totalFeatures(){let e=0;return this._featureTiles.forEach(t=>e+=t.numFeatures),e}get showsAllFeatures(){if(this._paused||this.dataUpdating)return!1;for(const e of this._featureTiles.values())if(!this.hasFullGeometries&&0!==e.emptyFeatureRatio||!e.showsAllFeatures)return!1;return!0}get hasFullGeometries(){if(!this._supportsResolution)return!0;const e=this.tileDescriptors?.some(Q);return e||!this.context.capabilities.supportsQuantization&&"polyline"!==this.context.geometryType}set filterExtent(e){if(null!=e&&this.context.tilingScheme&&!e.spatialReference.equals(this.context.tilingScheme.spatialReference))return void i.getLogger(this).error("#filterExtent=","extent needs to be in the same spatial reference as the tiling scheme");const t=this._get("filterExtent");if(t===e||null!=t&&e&&t.equals(e))return;const s=null!=e?e.clone():null;this._set("filterExtent",s),this._reclip(s,t)}_updateTileZQuantization(e){if(1===this.context.viewingMode){const t=e.computeZQuantizationFactor();this._zQuantizationFactor.value<t&&(this._zQuantizationFactor.value=t)}}get _tileZQuantization(){return this.context.isDraped?1:this._zQuantizationFactor.value}constructor(e){super(e),this._useTileCount=!1,this.dataUpdating=!1,this.updatingTotal=0,this.updatingRemaining=0,this.expectedFeatureDiff=0,this.maximumNumberOfFeaturesExceeded=!1,this._fullRatio=1,this._farRatio=1,this._zQuantizationFactor=d(1),this._changes={updates:{adds:new Array,removes:new Array},adds:new Array,removes:new Array},this._featureTiles=new o,this._displayingFeatureReferences=new Map,this._numDisplayingFeatureReferences=0,this._dirty=!1,this._suspended=!0,this._pendingEdits=null,this._applyEditsTilesUpdated=!1,this._isFetching=!1;const t=e.context;this._frameTask=t.scheduler?.registerTask(z.FEATURE_TILE_FETCHER,this)??P,this.FeatureReferenceClass=t.capabilities.supportsMultipleResolutions?w:M,this._objectIdField=t.objectIdField}initialize(){this.addHandles([l(()=>this.tileDescriptors,"change",()=>this._setDirty(),{onListenerAdd:()=>this._setDirty(),onListenerRemove:()=>this._setDirty()}),u(()=>this._tileZQuantization,()=>this.refetch())]),this._setDirty()}destroy(){this._frameTask.remove(),this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._removeTile(e)}),this._featureTiles.clear(),this._displayingFeatureReferences.clear(),this._pendingEdits?.controller.abort(),this._pendingEdits=null}get _paused(){return this._suspended||!!this._pendingEdits}restart(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._clearTile(e),this._resetFetchTile(e)}),null!=this.context.memoryCache&&this.context.memoryCache.clear(),this._setDirty()}refetch(){this._featureTiles.forEach(e=>{this._cancelFetchTile(e),this._resetFetchTile(e)}),null!=this.context.memoryCache&&this.context.memoryCache.clear(),this._setDirty()}refetchDisplayFilterHighlightTile(){const e=this._featureTiles.get(A);e&&(this._cancelFetchTile(e),this._resetFetchTile(e),this._setDirty())}suspend(){this._suspended||(this._suspended=!0,this._pause(),this._setDirty())}resume(){this._suspended&&(this._suspended=!1,this._unpause())}getMissingAttributesForFeature(e){for(const t of this._featureTiles.values()){const s=t.missingAttributes?.get(e);if(null!=s)return s}}_pause(){this._paused&&(this._featureTiles.forEach(e=>this._cancelFetchTile(e)),this._updated())}_unpause(){this._paused||this._setDirty()}get availableFields(){let e=null;return this._featureTiles.forEach(t=>{null!=t.displayingFeatures&&0!==t.displayingFeatures.length&&(null==e?e=new Set(t.availableFields):e.forEach(s=>{t.availableFields?.has(s)||e.delete(s)}))}),null!=e?e:new Set}applyEdits(e){this._pendingEdits||(this._pendingEdits={edits:Promise.resolve(),count:0,controller:new AbortController},this._pause());const t=this._pendingEdits;t.count++;const s=t.edits.then(()=>e.result.catch(e=>{if(a(e))throw e;return null}).then(e=>e?(this._applyEditsDeleteFeatures(e.deletedFeatures),this._applyEditsAddUpdateFeatures(e.addedFeatures,e.updatedFeatures,t.controller.signal).then(()=>e)):e).then(e=>(0===--t.count&&(this._pendingEdits===t&&(this._pendingEdits=null),null!=this.context.memoryCache&&this.context.memoryCache.clear(),this._applyEditsTilesUpdated=!1,this._unpause()),e)));return t.edits=s,this._updated(),s}_applyEditsDeleteFeatures(e){if(0===e.length)return;const t=this.context.globalIdField,s=t&&this.availableFields.has(t),r=new Set,a=this._objectIdField;e.forEach(({objectId:e,globalId:n})=>{(!e||e<0)&&t&&n&&(s||i.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${t} to be included the layer's outFields for updates to be reflected in the view`),e=this._objectIdFromGlobalId(n,a,t)),null!=e&&e>=0&&r.add(e)}),this._featureTiles.forEach(e=>{if(!e.features)return;const t=e.features.filter(e=>!r.has(R(e,this._objectIdField)));t.length!==e.features.length&&(this._applyEditsTileUpdated(),e.setFeatures(t,0,e.availableFields,e.missingAttributes),this._updateTileZQuantization(e),this._invalidateCounts())})}_objectIdFromGlobalId(e,t,s){if(null==e)return null;const i=this.features.find(t=>t.attributes?.[s]===e);return i?R(i,t):null}async _applyEditsAddUpdateFeatures(e,t,s){const{objectIdField:r,globalIdField:a}=this.context,n=a&&this.availableFields.has(a),o=new Set,l=new Set;for(const i of e){const e=i.objectId;null!=e&&o.add(e)}for(const{objectId:h,globalId:d}of t){let e=h;(null==e||e<0)&&a&&(n||i.getLogger(this).errorOncePerTick(`Editing the specified service requires the layer's globalIdField, ${a} to be included the layer's outFields for updates to be reflected in the view`),e=this._objectIdFromGlobalId(d,r,a)),null!=e&&e>=0&&(o.add(e),l.add(e))}if(0===o.size)return;const u=[];this._featureTiles.forEach(e=>{const t=this._applyEditsAddUpdateTile(e,o,l,s);t&&u.push(t)}),this._updated(),await Promise.allSettled(u)}async _applyEditsAddUpdateTile(e,t,s,i){if(!e.features)return;e.fetchingResolution=e.descriptor.resolution;const r=this._createQuery(e);r.resultType=void 0,r.cacheHint=!1,r.objectIds=Array.from(t);const a=await this._queryFeatures(r,i);let n=null;if(s.size>0){const t=e.features.filter(e=>!s.has(R(e,this._objectIdField)));t.length!==e.features.length&&(n=t)}if(a.features.length>0){n||(n=e.features.slice());for(const e of a.features)n.push(e)}n&&(e.hasPreciseFeatureCount&&(e.numFeatures=Math.max(e.numFeatures,n.length)),this._applyEditsTileUpdated(),e.setFeatures(n,0,Z(e.availableFields,a.fields),V(e.missingAttributes,a.missingAttributes)),this._updateTileZQuantization(e),this._invalidateCounts())}_applyEditsTileUpdated(){this._applyEditsTilesUpdated||(this._applyEditsTilesUpdated=!0,this._updated())}_queryFeatures(e,t){return this.context.query.queryFeaturesDehydrated(e,{signal:t,timeout:J})}_setDirty(){this._dirty=!0,this._updated()}runTask(e){const t=this._frameTask.processQueue(e);if(!this._dirty||!this.initialized)return t;this._dirty=!1;const s=this._featureTilesArray;if(this._markTilesNotAlive(s),!e.run(()=>this._addTiles(s,e))||!e.run(()=>this._filterExtentTiles(s,e))||!e.run(()=>this._removeTiles(s,e))||e.done)return void this._setDirty();const i=this._sortTiles(s);e.run(()=>this._showTiles(i,e))&&e.run(()=>this._fetchTiles(i,e))&&e.run(()=>this._updateMemoryEstimates(i,e))||this._setDirty(),this._updated(),this.updating||this._updateMaximumNumberOfFeaturesExceeded()}_markTilesNotAlive(e){for(const t of e)t.alive=!1}_addTiles(e,t){return!(this._suspended||!this.tileDescriptors)&&(this.tileDescriptors.forEach(s=>{const i=this._featureTiles.get(s.id);i?i.alive=!0:t.done||(e.push(this._addTile(s)),t.madeProgress())}),t.hasProgressed)}_filterExtentTiles(e,t){for(const s of e){if(t.done)break;s.alive&&(s.filtered=!s.intersects(this.filterExtent),s.filtered&&(this._clearTile(s),t.madeProgress()))}return t.hasProgressed}_removeTiles(e,t){for(let s=e.length-1;s>=0&&!t.done;s--){const i=e[s];i.alive||(this._removeTile(i),s!==e.length-1&&(e[s]=e[e.length-1]),e.pop(),t.madeProgress())}return t.hasProgressed}_sortTiles(e){return e.sort((e,t)=>e.descriptor.loadPriority-t.descriptor.loadPriority),e}_showTiles(e,t){const s=this._updateRatio(e),i=e=>{const t=this._fullRatio<1?s(e)*this._farRatio:1;e.reduceFeatures(t,this.memoryFactor,this._objectIdField,this._reduceMode)&&this._setDirty();const{numFeatures:i,fetchingResolution:r,descriptor:a,isFetched:n}=e;return this._supportsResolution&&i>0&&r!==a.resolution&&n&&(e.requestRefetch(),this._setDirty()),this._showTile(e)};for(const r of e)if(!t.run(()=>i(r))){this._setDirty();break}return t.hasProgressed}_fetchTiles(e,t){if(this._paused)return!1;let s=!1;for(const i of e){if(!i.needsFetch)continue;const e=null!=this.context.memoryCache?this.context.memoryCache.pop(i.id):null;if(e?.resolution!==i.displayingResolution){if(this._needsNumFeatures(i)){const e=new AbortController,r=this._fetchTileCount(i,e.signal);this._handleRequest(i,r,e,()=>i.resetFetching(),()=>i.numFeatures=U),s=!0,t.madeProgress()}if(t.done)return!0}else i.cache=e,i.numFeatures&&this._notifyDataUpdating(),this._setDirty(),this._scheduleUpdated(),t.madeProgress()}if(s)return t.hasProgressed;for(const r of e){if(!r.needsFetch)continue;const e=new AbortController,s=this._fetchTile(r,e.signal);if(this._handleRequest(r,s,e,e=>r.fetchDone(e),e=>{r.fetchFailed=!0,this.context.logFetchError(i.getLogger(this),e)}),t.madeProgress(),t.done)return!0}return t.hasProgressed}_updateMemoryEstimates(e,t){return e.some(e=>!t.run(()=>e.updateMemoryEstimates())&&(this._setDirty(),!0)),t.hasProgressed}_reclip(e,t){if(!this.initialized)return;const s=new Array;this._featureTiles.forEach(i=>{null!=i.displayingFeatures&&0!==i.displayingFeatures.length&&(i.intersectionIncludingBorrowed(t,B),i.intersectionIncludingBorrowed(e,G),g(B,G)||s.push(i))}),this._refreshDisplayingFeatures(s),this._updated()}_refreshDisplayingFeatures(e){const t=new Set,s=this._changes.updates;for(const i of e)if(null!=i.displayingFeatures)for(const e of i.displayingFeatures){const i=R(e,this._objectIdField);if(t.has(i))continue;t.add(i);const r=this._displayingFeatureReferences.get(i).feature;s.removes.push(r),s.adds.push(r)}this._applyChanges()}_updated(){let e=0;if(this._paused||this._featureTiles.forEach(t=>t.isFetching?++e:0),this._isFetching=e>0,e>0||this._applyEditsTilesUpdated?this._notifyDataUpdating():this._dirty||this._set("dataUpdating",!1),this.updating){let t=0,s=0,i=0,r=0,a=0;const n=this._displayingFeatureReferences.size/this._numDisplayingFeatureReferences;this._featureTiles.forEach(e=>{if(++s,e.isFetching&&e.hasPreciseFeatureCount){const t=this._maximumFeaturesForTile(e)*(1-e.emptyFeatureRatio),s=null!=e.displayingFeatures?e.displayingFeatures.length*n:0;a+=t-s}e.needsFetch?++r:e.numFeatures>0&&(++i,t+=e.numFeatures)}),r+=e;let o=0,l=0;t?(l=t,o=Math.min(r*t/i,t)):(l=s,o=r),a=Math.min(this.maximumNumberOfFeatures-this.features.length,a),this._set("updatingTotal",l),this._set("updatingRemaining",o),this._set("expectedFeatureDiff",a)}else this._set("updatingTotal",0),this._set("updatingRemaining",0),this._set("expectedFeatureDiff",0);this.debugger?.update()}_updateMaximumNumberOfFeaturesExceeded(){for(const{perTileMaximumNumberOfFeaturesExceeded:e}of this._featureTiles.values())if(e)return void this._set("maximumNumberOfFeaturesExceeded",!0);this._set("maximumNumberOfFeaturesExceeded",!1)}_updateRatio(e){const t=L(e),s=e=>1/(1<<Math.max(0,t-e.descriptor.lij[0]));let i=0,r=0;for(const a of e){const e=a.numFeatures;i+=e,r+=e*s(a)}return this._fullRatio=Math.min(1,this.maximumNumberOfFeatures/i),this._farRatio=this.maximumNumberOfFeatures/r,this._scheduleUpdated(),s}_maximumFeaturesUpdated(e,t){e!==t&&(t>e&&this._featureTiles.forEach(e=>{if(!e.featuresMissing)return;const t=this._maximumFeaturesForTile(e);e.isFullyFetched(t)||(this._cancelFetchTile(e),this._resetFetchTile(e))}),this._setDirty())}_addTile(e){const t=new j(e);return this._featureTiles.set(t.id,t),this._resetFetchTile(t),this._referenceDisplayingFeaturesFromRelatedTiles(t),t}_referenceDisplayingFeaturesFromRelatedTiles(e){const t=e.displayingResolution;this._featureTiles.forEach(s=>{if(null!=s.displayingFeatures&&e!==s&&O(e.descriptor.lij,s.descriptor.lij)){null==e.displayingFeatures&&(e.displayingFeatures=[]),e.descriptor.extent&&s.descriptor.extent&&(e.extentIncludingBorrowedFeatures??=F(e.descriptor.extent),y(e.extentIncludingBorrowedFeatures,s.descriptor.extent,e.extentIncludingBorrowedFeatures));for(const i of s.displayingFeatures){e.displayingFeatures.push(i);const s=this._displayingFeatureReferences.get(R(i,this._objectIdField));s.ref(s.feature,t),this._numDisplayingFeatureReferences++}}})}_removeTile(e){this._clearTile(e),this._featureTiles.delete(e.id)}_resetFetchTile(e){e.filtered=!e.intersects(this.filterExtent),e.filtered?e.needsFetch&&e.fetchDone(4):e.requestFetch()}_cancelFetchTile(e){const t=e.requestController;null!=t&&(e.requestController=null,e.resetFetching(),t.abort())}async _fetchTileCount(e,t){e.numFeatures=await this._fetchCount(e,t),this._updateRatio(this._featureTilesArray)}async _fetchTile(e,t){e.fetchFailed=!1;const s=this._maximumFeaturesForTile(e);if(s<=0)return e.hasPreciseFeatureCount&&0===e.numFeatures||(e.fetchFailed=!0),k(e),e.fetchInformation.value="Empty tile",4;const i=this._getMaxRecordCount(e),r=Math.ceil(s/i);if(e.fetchingResolution=e.descriptor.resolution,N(e)||!this.context.capabilities.supportsMaxRecordCountFactor||e.numFeatures<=s&&r>D.MAX_MAX_RECORD_COUNT_FACTOR)return this._fetchPagedTile(e,t);const a=this._createQuery(e);if(a.maxRecordCountFactor=r,e.isRefetching&&e.features&&e.features.length>0){const t=Math.ceil(e.features.length/(1-e.emptyFeatureRatio)/i);a.maxRecordCountFactor=Math.max(t+1,a.maxRecordCountFactor)}e.fetchInformation.value=`Single fetch\n${s} features`;const{features:o,exceededTransferLimit:l,fields:u,missingAttributes:h}=await this._queryFeatures(a,t),d=l||a.maxRecordCountFactor>=D.MAX_MAX_RECORD_COUNT_FACTOR||s===this._totalFeaturesForTile(e)?5:4,c=await this._frameTask.schedule(()=>{e.exceededTransferLimit.value=!!l;const t=this._removeEmptyFeatures(o,this._getEffectiveTileResolution(e));return e.fetchInformation.value=`Single fetch\n${o.length}/${s} features`,e.setFeatures(o,t,H(u),V(void 0,h)),this._updateTileZQuantization(e),this._maximumFeaturesForTile(e)>s?1:d},t);return n(t),this._invalidateCounts(),c}async _fetchCount(e,t){return this.context.query.queryFeatureCount(this._createFeatureCountQuery(e),{signal:t})}async _fetchPagedTile(e,t){let s,i=0,r=0,a=0,o=this._maximumFeaturesForTile(e)-a;const l=this._getMaxRecordCount(e);let u,h=null;for(;;){const d=this._createQuery(e),c=this._setPagingParameters(d,i,o,l);e.fetchInformation.value=`Paged fetch\n${e.features?.length}/${o} features`;const{features:p,exceededTransferLimit:f,fields:_,missingAttributes:m}=await this._queryFeatures(d,t);if(await this._frameTask.schedule(()=>{c&&(i+=d.num),a+=p.length,r+=this._removeEmptyFeatures(p,this._getEffectiveTileResolution(e)),e.exceededTransferLimit.value=!!f,s=s?.concat(p)??p,h=Z(h,_),u=V(u,m),e.setFeatures(s,r,h,u),this._updateTileZQuantization(e),this._invalidateCounts(),this._setDirty()},t),n(t),o=this._maximumFeaturesForTile(e)-(s?.length??0),!c||!f||o<=0)return f?4:5}}_createFeatureCountQuery(e){const t=this._createQuery(e);return this.context.capabilities.supportsCacheHint&&(t.resultType=void 0,t.cacheHint=!0),t}_createQuery(e){const t=this.context.createQuery();return t.resultType=this._resultType(e),!N(e)&&e.descriptor.extent&&this.context.tilingScheme&&(t.geometry=T(e.descriptor.extent,this.context.tilingScheme.spatialReference)),this._setResolutionParams(t,e),"tile"!==t.resultType&&this.context.capabilities.supportsCacheHint&&(t.cacheHint=!0),S(e)&&this.context.highlightIds?.length?t.objectIds=this.context.highlightIds:!Q(e)&&this.context.effectiveDisplayFilter&&(t.where=c(t.where,this.context.effectiveDisplayFilter.where)),t}_setPagingParameters(e,t,s,i){return!!this.context.capabilities.supportsPagination&&(e.start=t,s>0&&this.context.capabilities.supportsMaxRecordCountFactor?(e.maxRecordCountFactor=Math.ceil(s/i),e.num=Math.min(e.maxRecordCountFactor*i,s)):e.num=Math.min(i),!0)}_getEffectiveTileResolution(e){if(N(e)||!this._supportsResolution)return null;const t=1===this.context.viewingMode&&this.context.tilingScheme?this.context.tilingScheme.resolutionAtLevel(3):1/0;return Math.min(e.fetchingResolution,t)/this.lodFactor/this._tileZQuantization}get _supportsResolution(){return this.context.capabilities.supportsMultipleResolutions&&"point"!==this.context.geometryType}_setResolutionParams(e,t){const s=this._getEffectiveTileResolution(t);null!=s&&(this.context.capabilities.supportsQuantization?e.quantizationParameters=new C({mode:"view",originPosition:"upper-left",tolerance:s,extent:this.context.fullExtent}):"polyline"===this.context.geometryType&&(e.maxAllowableOffset=s))}_removeEmptyFeatures(e,t){const i=e.length;if(t&&this._supportsResolution){const i=t*(1+_());s(e,({geometry:e})=>!(!e||!b(e))&&(E(e,X),x(X)>i||v(X)>i))}else s(e,({geometry:e})=>b(e));return i-e.length}_needsNumFeatures(e){return this.useTileCount&&e.needsFeatureCount&&!Q(e)}_getMaxRecordCount(e){switch(this._resultType(e)){case"tile":if(this.context.tileMaxRecordCount)return this.context.tileMaxRecordCount;break;case"standard":if(this.context.standardMaxRecordCount)return this.context.standardMaxRecordCount}return this.context.maxRecordCount||$}_resultType(e){if(this.context.capabilities.supportsResultType)return Q(e)?"standard":"tile"}get _reduceMode(){const e=this.context.geometryType;return"polygon"===e||"polyline"===e?0:1}_handleRequest(e,t,s,i,r){e.startFetch(),e.requestController=s;let n=!1;t.then(t=>{e.requestController=null,i(t)}).catch(t=>{e.requestController===s&&(e.requestController=null,e.fetchDone(4)),a(t)?n=!0:r(t)}).then(()=>{n||this._setDirty(),this._scheduleUpdated()})}_scheduleUpdated(){this.hasHandles("scheduleUpdated")||this.addHandles(h(()=>{this.removeHandles("scheduleUpdated"),this._updated()}),"scheduleUpdated")}_showTile(e){if(e.displayingFeatures&&!e.needsDisplayUpdate)return!1;const t=e.features;if(0===e.featureLimit||!t){const t=null!=e.displayingFeatures&&e.displayingFeatures.length>0;return this._hideTileFeatures(e),e.displayingFeatures=[],t}const s=e.fetchingResolution,{adds:i,updates:r}=this._changes,a=Math.min(e.featureLimit,t.length);for(let n=0;n<a;++n){const e=t[n],a=R(e,this._objectIdField),o=this._displayingFeatureReferences.get(a);if(o){const{oldVersion:t,newVersion:i}=o.ref(e,s);t!==i&&(t&&r.removes.push(t),i&&r.adds.push(i))}else this._displayingFeatureReferences.set(a,new this.FeatureReferenceClass(e,s)),i.push(e);this._numDisplayingFeatureReferences++}return this._hideTileFeatures(e),e.displayingResolution=e.fetchingResolution,this._applyChanges(),e.displayingFeatures=t.slice(0,a),!0}_hideTile(e){this._cancelFetchTile(e),this._hideTileFeatures(e)}_hideTileFeatures(e){if(null==e.displayingFeatures)return;const{updates:t,removes:s}=this._changes;for(const i of e.displayingFeatures){const r=R(i,this._objectIdField),a=this._displayingFeatureReferences.get(r);if(!a)continue;const{oldVersion:n,newVersion:o}=a.unref(e.displayingResolution);this._numDisplayingFeatureReferences--,n!==o&&(null==o?(this._displayingFeatureReferences.delete(r),n&&s.push(n)):(t.adds.push(o),n&&t.removes.push(n)))}this._applyChanges(),e.displayingFeatures=null}_notifyDataUpdating(){this._get("dataUpdating")||this._set("dataUpdating",!0)}_applyChanges(){const e=this._changes.updates;e.removes.length>0&&(this._notifyDataUpdating(),this.features.removeMany(e.removes),e.removes.length=0),e.adds.length>0&&(this._notifyDataUpdating(),this.features.addMany(e.adds),e.adds.length=0);const t=this._changes.adds,s=this._changes.removes,i=Math.min(t.length,s.length);let r=0;for(;r<i;){const e=Math.min(r+K,i);this._notifyDataUpdating(),this.features.addMany(t.slice(r,e)),this.features.removeMany(s.slice(r,e)),r=e}t.length>i&&(this._notifyDataUpdating(),this.features.addMany(0===r?t:t.slice(r))),s.length>i&&(this._notifyDataUpdating(),this.features.removeMany(0===r?s:s.slice(r))),t.length=0,s.length=0}_clearTile(e){this._hideTile(e),e.features&&null!=this.context.memoryCache&&this.context.memoryCache.put(e.id,e.cache),e.setFeatures(null,0,null,void 0),this._invalidateCounts()}_invalidateCounts(){this.notifyChange("totalVertices"),this.notifyChange("totalFeatures"),this.notifyChange("memoryForUnusedFeatures")}get _featureTilesArray(){return Array.from(this._featureTiles.values())}get featureTiles(){return this._featureTiles}get storedFeatures(){return this._featureTilesArray.reduce((e,t)=>e+(t.features?t.features.length:0),0)}get missingTiles(){return Array.from(this._featureTiles.values()).reduce((e,t)=>e+(t.needsFetch||t.isFetching?1:0),0)}_totalFeaturesForTile(e){return e.hasPreciseFeatureCount?e.numFeatures:this.maximumNumberOfFeatures}_maximumFeaturesForTile(e){const t=this._totalFeaturesForTile(e),s=this._fullRatio<1?this._farRatio:1;return Math.min(Math.ceil(t*s/(1-e.emptyFeatureRatio)),t)}get test(){}};function Q(e){return e.id===I}function S(e){return e.id===A}function N(e){return Q(e)||S(e)}function L(e){let t=0;for(const s of e)s.features&&s.features.length>0&&s.alive&&(t=Math.max(t,s.descriptor.lij[0]));return t}function k(e){e.setFeatures([],0,null,void 0)}function H(e){return null==e?new Set:new Set(e.map(e=>e.name))}function Z(e,t){if(null==e||null==t)return H(t);const s=new Set;for(const{name:i}of t)e.has(i)&&s.add(i);return s}function V(e,t){if(!t?.length)return e;e??=new Map;const s=()=>new Set;for(const{objectId:i,attribute:a}of t)r(e,i,s).add(a);return e}e([p({constructOnly:!0})],q.prototype,"features",void 0),e([p()],q.prototype,"tileDescriptors",void 0),e([p({value:1/0})],q.prototype,"maximumNumberOfFeatures",null),e([p({value:1})],q.prototype,"memoryFactor",null),e([p({value:1})],q.prototype,"lodFactor",null),e([p()],q.prototype,"useTileCount",null),e([p({readOnly:!0})],q.prototype,"updating",null),e([p({readOnly:!0})],q.prototype,"dataUpdating",void 0),e([p({readOnly:!0})],q.prototype,"updatingTotal",void 0),e([p({readOnly:!0})],q.prototype,"updatingRemaining",void 0),e([p({readOnly:!0})],q.prototype,"expectedFeatureDiff",void 0),e([p({readOnly:!0})],q.prototype,"memoryForUnusedFeatures",null),e([p({readOnly:!0})],q.prototype,"maximumNumberOfFeaturesExceeded",void 0),e([p({readOnly:!0})],q.prototype,"totalVertices",null),e([p({readOnly:!0})],q.prototype,"totalFeatures",null),e([p({readOnly:!0})],q.prototype,"showsAllFeatures",null),e([p({readOnly:!0})],q.prototype,"hasFullGeometries",null),e([p()],q.prototype,"filterExtent",null),e([p({constructOnly:!0})],q.prototype,"context",void 0),e([p()],q.prototype,"_dirty",void 0),e([p()],q.prototype,"_suspended",void 0),e([p()],q.prototype,"_pendingEdits",void 0),e([p()],q.prototype,"_applyEditsTilesUpdated",void 0),e([p()],q.prototype,"_paused",null),e([p()],q.prototype,"_isFetching",void 0),q=e([f("esri.views.3d.layers.support.FeatureTileFetcher3D")],q);const $=2e3,B=m(),G=m(),X=m(),J=6e5,K=200;export{q as FeatureTileFetcher3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{destroyMaybe as e}from"../../../../core/maybe.js";import{createFeatureTileQuery3D as t}from"./featureTileQuery3D.js";class r{constructor(e){this._memoryCache=null;const r=e.layerView.layer;this._layerView=e.layerView,this.objectIdField=r.objectIdField,this.globalIdField="globalIdField"in r?r.globalIdField:null,this._returnZ=e.returnZ,this._returnM=e.returnM;const i=this._layerView.view.resourceController;this.query=t(this._layerView,i.normal),i&&this._memoryCacheEnabled&&(this._memoryCache=i.memoryController.newCache(`fl-${r.uid}`))}get _memoryCacheEnabled(){switch(this._layerView.layer.source.type){case"feature-layer":case"ogc-feature":case"oriented-imagery":return!0;case"csv":case"parquet":case"geojson":case"memory":case"wfs":return!1}}destroy(){this._memoryCache=e(this._memoryCache),this.query.destroy()}createQuery(){const e=this._layerView.layer.createQuery();return e.outFields=this._layerView.availableFields,e.returnZ=this._returnZ,e.returnM=this._returnM,e.outSpatialReference=this.tilingScheme.spatialReference,e}get memoryCache(){return this._memoryCache}get viewingMode(){return this._layerView.view.state.viewingMode}get tilingScheme(){return this._layerView.view.featureTiles
|
|
5
|
+
import{destroyMaybe as e}from"../../../../core/maybe.js";import{createFeatureTileQuery3D as t}from"./featureTileQuery3D.js";class r{constructor(e){this._memoryCache=null;const r=e.layerView.layer;this._layerView=e.layerView,this.objectIdField=r.objectIdField,this.globalIdField="globalIdField"in r?r.globalIdField:null,this._returnZ=e.returnZ,this._returnM=e.returnM;const i=this._layerView.view.resourceController;this.query=t(this._layerView,i.normal),i&&this._memoryCacheEnabled&&(this._memoryCache=i.memoryController.newCache(`fl-${r.uid}`))}get _memoryCacheEnabled(){switch(this._layerView.layer.source.type){case"feature-layer":case"ogc-feature":case"oriented-imagery":return!0;case"csv":case"parquet":case"geojson":case"memory":case"wfs":return!1}}destroy(){this._memoryCache=e(this._memoryCache),this.query.destroy()}createQuery(){const e=this._layerView.layer.createQuery();return e.outFields=this._layerView.availableFields,e.returnZ=this._returnZ,e.returnM=this._returnM,e.outSpatialReference=this.tilingScheme?.spatialReference??this._layerView.view.spatialReference,e}get memoryCache(){return this._memoryCache}get viewingMode(){return this._layerView.view.state.viewingMode}get tilingScheme(){return this._layerView.view.featureTiles?.tilingScheme}get scheduler(){return this._layerView.view.resourceController?.scheduler}get geometryType(){return this._layerView.layer.geometryType}get fullExtent(){return this._layerView.layer.fullExtent}get tileMaxRecordCount(){return this._layerView.layer.capabilities.query.tileMaxRecordCount}get standardMaxRecordCount(){return this._layerView.layer.capabilities.query.standardMaxRecordCount}get maxRecordCount(){return this._layerView.layer.capabilities.query.maxRecordCount}get isDraped(){return"on-the-ground"===this._layerView.layer.elevationInfo?.mode}get effectiveDisplayFilter(){return this._layerView.displayFilterEnabled?this._layerView.effectiveDisplayFilter:null}get highlightIds(){return this._layerView.displayFilterEnabled?this._layerView.highlightIds:null}get capabilities(){return this._capabilities??=i(this._layerView.layer),this._capabilities}logFetchError(e,t){e.error("#fetchTile()",this._layerView.layer,t?.message??t)}}function i(e){const t=e.capabilities.query;return{supportsMultipleResolutions:a(e),supportsPagination:!(!t||!t.supportsPagination),supportsResultType:!(!t||!t.supportsResultType),supportsCacheHint:!(!t||!t.supportsCacheHint),supportsQuantization:!(!t||!t.supportsQuantization),supportsQuantizationEditMode:!(!t||!t.supportsQuantizationEditMode),supportsMaxRecordCountFactor:!(!t||!t.supportsMaxRecordCountFactor),supportsFormatPBF:!(!t||!t.supportsFormatPBF)}}function a(e){switch(e.geometryType){case"polyline":return!0;case"polygon":return e.capabilities&&e.capabilities.query&&e.capabilities.query.supportsQuantization;default:return!1}}export{r as FeatureTileFetcher3DContext,i as contextCapabilitiesFromLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{H as e,i as t,n as s,e as i,g as o,c as r,F as a}from"../../../../chunks/vec32.js";import{
|
|
5
|
+
import{H as e,i as t,n as s,e as i,g as o,c as r,F as a}from"../../../../chunks/vec32.js";import{create as n,freeze as l,ZEROS as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{distance as d}from"../../../../geometry/support/aaBoundingRect.js";import{intersectsPoint as h}from"../../../../geometry/support/frustum.js";import{fromValues as m}from"../../../../geometry/support/ray.js";import{FeatureTileVisibility3D as p,minTileLOD as u}from"./FeatureTileVisibility3D.js";import _ from"../../webgl/RenderCamera.js";class f{constructor(e,t,s){this._renderCoordsHelper=e,this._tilingScheme=t,this._camera=new _,this._surfaceElevation=0,this._focusOnMap=[0,0],this._visibility=new p(e,s)}set opaqueGround(e){this._visibility.opaqueGround=e}setup(e,t,s){this._camera.copyFrom(e),this._surfaceElevation=s,this._focusOnMap[0]=t.x,this._focusOnMap[1]=t.y,this._visibility.setup(this._camera)}done(){this._visibility.done()}update(e){const{measures:t,extent:s,level:i}=e;s&&(t.visible=this._visibility.compute(e),t.distance=d(s,this._focusOnMap),t.mergeable=!0,t.lodLevel=u,t.splitPriority=Math.max(0,u-i),t.visible&&(this._isGlobal?this._updateSplitAndLodGlobal(e):this._updateSplitAndLodLocal(e)))}_updateSplitAndLodGlobal(r){const a=r.level,n=this._renderCoordsHelper,{eye:l,fov:c}=this._camera,d=n.referenceEllipsoid.radius,h=e(l)-d;if(2*Math.atan(d/h)<c&&h>0)return void(r.measures.lodLevel=Math.max(a,u));const m=v,{extent:p}=r;if(!p)return;const{_surfaceElevation:_}=this;t(m[0],p[0],p[1],_),t(m[1],p[2],p[1],_),t(m[2],p[2],p[3],_),t(m[3],p[0],p[3],_);const f=t(M,.5*(p[0]+p[2]),.5*(p[1]+p[3]),_),y=this._tilingScheme.spatialReference;for(let e=0;e<4;++e)n.toRenderCoords(m[e],y,m[e]);n.toRenderCoords(f,y,f);const x=s(b.direction,f),L=i(l,x),S=o(g,x,L);this._updateSplitAndLod(r,m,f,S)}_updateSplitAndLodLocal(e){const s=v,{extent:i}=e;if(!i)return;const{_surfaceElevation:o}=this;t(s[0],i[0],i[1],o),t(s[1],i[2],i[1],o),t(s[2],i[2],i[3],o),t(s[3],i[0],i[3],o);const a=this._tilingScheme.spatialReference;for(let t=0;t<4;++t)this._renderCoordsHelper.toRenderCoords(s[t],a,s[t]);const n=t(M,.5*(s[0][0]+s[2][0]),.5*(s[0][1]+s[2][1]),.25*(s[0][2]+s[1][2]+s[2][2]+s[3][2])),l=t(y,n[0],n[1],0),{eye:c,far:d}=this._camera,h=t(g,l[0],l[1],c[2]);t(b.origin,l[0],l[1],c[2]-2*d),r(b.direction,x),this._updateSplitAndLod(e,s,n,h)}_updateSplitAndLod(e,t,s,o){const r=Math.max(a(t[0],t[2]),a(t[1],t[3]),a(t[0],s)+a(s,t[2]),a(t[1],s)+a(s,t[3])),{eye:n,near:l,fov:c,viewForward:d,width:m,height:p,pixelRatio:u,frustum:_}=this._camera,f=i(n,d),v=i(s,d)-f,M=a(s,n);let y=v,g=v,x=M,b=M;const R=(e,t)=>t<l?1:Math.sqrt(e*e-t*t)/t;let j=R(M,v);for(const h of t){const e=i(h,d)-f;y=Math.min(y,e),g=Math.max(g,e);const t=a(h,n);b=Math.max(b,t),x=Math.min(x,t);const s=R(t,e);j=Math.min(j,s)}if(g<l)return void(e.measures.lodLevel=0);const w=Math.cos(.5*c),A=a(n,o);j>w&&A>S*r&&(g=C*b,y=C*x);const G=.5*Math.sqrt(m*m+p*p)/u,E=2*Math.tan(.5*c),H=e=>Math.max(l,e)*L/G*E,q=e.level,F=r*2**q*Math.max(1,E),O=H(y),P=Math.ceil(Math.log2(Math.max(1,F/O)));if(e.measures.lodLevel=Math.max(P,e.measures.lodLevel),e.measures.splitPriority+=e.measures.lodLevel-q,q<P){const s=+h(_,t[0])+ +h(_,t[1])+ +h(_,t[2])+ +h(_,t[3]);e.measures.splitPriority+=s}const k=H(g)/O;k>2.5&&(e.measures.splitPriority+=k)}get _isGlobal(){return 1===this._renderCoordsHelper.viewingMode}}const v=[n(),n(),n(),n()],M=n(),y=n(),g=n(),x=l(0,0,1),b=m(c,x),L=312,S=.5,C=2;export{f as FeatureTileMeasurements3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import s from"../../../../core/Collection.js";import
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import s from"../../../../core/Collection.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{removeMaybe as r}from"../../../../core/maybe.js";import o from"../../../../core/PooledArray.js";import{watch as n,syncAndInitial as l,sync as a}from"../../../../core/reactiveUtils.js";import{signal as u}from"../../../../core/signal.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as m,intersects as p}from"../../../../geometry/support/aaBoundingRect.js";import{FeatureTileDescriptor as c,getFeatureTileId as _}from"./FeatureTileDescriptor.js";import{FeatureTileMeasurements3D as f}from"./FeatureTileMeasurements3D.js";import{maxLODLevelDelta as g}from"./FeatureTileVisibility3D.js";import{toBoundingRect as T}from"../../support/extentUtils.js";import{TaskPriority as v,noBudget as y}from"../../../support/Scheduler.js";const w=60;let E=class extends t{constructor(e){super(e),this.tiles=new s,this.tileSize=512,this._idToTile=new Map,this._dirty=u(!1),this._pendingTiles=u(null),this._newTiles=new o,this._tests=!1,this._measurements=new f(e.renderCoordsHelper,e.terrain.tilingScheme,this._opaqueGround)}initialize(){this.addHandles([n(()=>this.tileSize,()=>this._reset(),l),n(()=>[this.pointsOfInterest.cameraOnSurface?.location,this.viewState?.contentCamera,this.pointsOfInterest.focus?.location,this.terrain?.baseOpacity??1],()=>this._setDirty(),l),n(()=>this.tilingScheme,e=>{this._reset(),this._measurements=new f(this.renderCoordsHelper,e,this._opaqueGround)},a),n(()=>this._opaqueGround,e=>this._measurements.opaqueGround=e,a)]),this._frameWorker=this.scheduler?.registerTask(v.FEATURE_TILE_TREE,this)}destroy(){this._frameWorker=r(this._frameWorker),this._measurements=null,this._newTiles.prune()}get tilingScheme(){return this.terrain.tilingScheme?.clone()}set filterExtent(e){if(null!=e&&!e.spatialReference.equals(this.viewState.spatialReference))return void i.getLogger(this).error("#extent","extent spatial reference needs to be in the same spatial reference as the view");const t=this._get("filterExtent");if(t===e||null!=t&&e&&t.equals(e))return;const s=null!=e?e.clone():null;this._set("filterExtent",s),this._setDirty()}get _filterExtentRect(){if(null==this.filterExtent)return null;const e=m();return T(this.filterExtent,e,this.tilingScheme.spatialReference),e}get _rootTileIds(){const{tilingScheme:e}=this;return this._filterExtentRect&&e?e.rootTilesInExtent(this._filterExtentRect):[[0,0,0]]}set suspended(e){e!==this._get("suspended")&&(this._set("suspended",e),this._setDirty())}get updating(){return this._dirty.value||!!this._pendingTiles.value}get _opaqueGround(){return 1===(this.terrain?.baseOpacity??1)}_setDirty(){this.suspended||(this._frameWorker?this._dirty.value=!0:this.runTask(y))}_clear(){this.tiles.removeAll(),this._idToTile.clear(),this._reset(!1),this._dirty.value=!1}get readyToRun(){return this.updating}_reset(e=!0){this._newTiles.clear(),this._pendingTiles.value=null,e&&this._setDirty()}_getRootTiles(){const e=this.tilingScheme;return this._rootTileIds.map(t=>new c(t[0],t[1],t[2],e))}runTask(e){e=this._tests?y:e,this._dirty.value=!1,this._pendingTiles.value||(this._startUpdate(e),null!=this._frameWorker&&(this._frameWorker.priority=v.FEATURE_TILE_TREE_ACTIVE)),this._splitPendingTiles(e),this._pendingTiles.value||null==this._frameWorker||(this._frameWorker.priority=v.FEATURE_TILE_TREE)}_startUpdate(e){if(this.suspended)return;if(!this.tilingScheme)return void this._clear();const{_measurements:t,_filterExtentRect:s,_newTiles:i}=this;t.setup(this.viewState.contentCamera,this.pointsOfInterest.focus.location,this.pointsOfInterest.cameraOnSurface.location.z??0),this._pendingTiles.value=this._getRootTiles().filter(e=>{if(t.update(e),e.measures.visible&&(!s||!e.extent||p(e.extent,s))){if(e.measures.splitPriority>0)return!0;i.push(e)}return!1}).sort(x),this._newTiles.clear(),e.madeProgress()}_splitPendingTiles(e){const t=this._pendingTiles.value;if(!t)return;const{tilingScheme:s,_filterExtentRect:i,_newTiles:r,_measurements:o}=this;for(;t.length>0&&this._tileBudgetRatio<=2;){const n=t.pop();if(e.madeProgress(),n.measures.splitPriority>0){s.ensureMaxLod(n.level+1);const e=n.createChildren();for(const s of e)o.update(s),!s.measures.visible||i&&s.extent&&!p(s.extent,i)||(s.measures.splitPriority>0?t.push(s):r.push(s));t.sort(x),this._mergeNewTiles(2),this._mergeNewTiles(2,!0)}else r.push(n);if(e.done)return}r.pushArray(t),this._pendingTiles.value=null,this._updateTiles(),r.clear(),o.done()}get _tileBudgetRatio(){return(this._newTiles.length+(this._pendingTiles.value?.length??0))/w}_mergeNewTiles(e,t=!1){if(this._tileBudgetRatio<=e)return;const{_newTiles:s,_measurements:i}=this;s.sort((e,t)=>t.measures.distance-e.measures.distance);const r=new Map(s.map(e=>[e.id,e])),o=s.length;for(const n of r.values()){const{lij:o,measures:l}=n;if(!l.mergeable||o[1]%2!=0||o[2]%2!=0||o[0]<=1||n.lodLevelDelta>=g)continue;const a=l.lodLevel;let u=a,h=!0;const d=r.get(_(o[0],o[1]+1,o[2]));let m=Math.abs((d?.measures.lodLevel??0)-a),p=0===m||t&&d?.measures.mergeable&&m<=1;if(!d||!p)continue;u+=d.measures.lodLevel,h&&=0===m;const f=r.get(_(o[0],o[1],o[2]+1));if(m=Math.abs((f?.measures.lodLevel??0)-a),p=0===m||t&&f?.measures.mergeable&&m<=1,!f||!p)continue;u+=f.measures.lodLevel,h&&=0===m;const T=r.get(_(o[0],o[1]+1,o[2]+1));if(m=Math.abs((T?.measures.lodLevel??0)-a),p=0===m||t&&T?.measures.mergeable&&m<=1,!T||!p)continue;u+=T.measures.lodLevel,h&&=0===m,s.removeUnordered(n),s.removeUnordered(d),s.removeUnordered(f),s.removeUnordered(T),r.delete(n.id),r.delete(d.id),r.delete(f.id),r.delete(T.id);const v=new c(o[0]-1,o[1]/2,o[2]/2,this.tilingScheme);if(i.update(v),v.measures.visible=!0,v.measures.lodLevel=u/4,v.measures.mergeable=h,s.push(v),r.set(v.id,v),this._tileBudgetRatio<=e)return}s.length<o&&this._mergeNewTiles(e,t)}_updateTiles(){this._mergeNewTiles(1),this._mergeNewTiles(1,!0);for(const i of this.tiles.items)i.used=!1;let e=!1;const t=this._newTiles.filter(t=>{const s=this._idToTile.get(t.id);return s?(e||=s.measures.lodLevel!==t.measures.lodLevel,s.measures={...t.measures},s.used=!0):this._idToTile.set(t.id,t),!s}),s=this.tiles.items.filter(e=>!e.used&&(this._idToTile.delete(e.id),!0));this.tiles.removeMany(s),this.tiles.addMany(t),this._sortTiles(),!e||s.length||t.length||this.tiles.emit("change")}_sortTiles(){this.viewState.fixedContentCamera||this.tiles.sort((e,t)=>e.measures.distance-t.measures.distance),this.tiles.forEach((e,t)=>e.loadPriority=t)}};function x(e,t){return e.lodLevelDelta-t.lodLevelDelta||e.measures.splitPriority-t.measures.splitPriority||t.measures.distance-e.measures.distance}e([h({constructOnly:!0})],E.prototype,"scheduler",void 0),e([h({constructOnly:!0})],E.prototype,"renderCoordsHelper",void 0),e([h({constructOnly:!0})],E.prototype,"pointsOfInterest",void 0),e([h({constructOnly:!0})],E.prototype,"viewState",void 0),e([h({constructOnly:!0})],E.prototype,"terrain",void 0),e([h()],E.prototype,"tiles",void 0),e([h()],E.prototype,"tileSize",void 0),e([h({readOnly:!0})],E.prototype,"tilingScheme",null),e([h()],E.prototype,"filterExtent",null),e([h({readOnly:!0})],E.prototype,"_filterExtentRect",null),e([h({readOnly:!0})],E.prototype,"_rootTileIds",null),e([h({value:!1})],E.prototype,"suspended",null),e([h({readOnly:!0})],E.prototype,"updating",null),E=e([d("esri.views.3d.layers.support.FeatureTileTree3D")],E);export{E as FeatureTileTree3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{initial as e}from"../../../../core/reactiveUtils.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as i}from"../../../../core/support/UpdatingHandles.js";import s from"../../../../geometry/Polygon.js";import{TileTreeDebugger as a}from"../../../support/TileTreeDebugger.js";let p=class extends a{get updating(){return this._watchUpdatingTracking?.updating??!1}constructor(t){super(t),this._watchUpdatingTracking=new i}initialize(){
|
|
5
|
+
import{__decorate as t}from"tslib";import{initial as e}from"../../../../core/reactiveUtils.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as i}from"../../../../core/support/UpdatingHandles.js";import s from"../../../../geometry/Polygon.js";import{TileTreeDebugger as a}from"../../../support/TileTreeDebugger.js";let p=class extends a{get updating(){return this._watchUpdatingTracking?.updating??!1}constructor(t){super(t),this._watchUpdatingTracking=new i}initialize(){this.addHandles(this.view.enableFeatureTiles()),this._watchUpdatingTracking.addOnCollectionChange(()=>this.view.featureTiles?.tiles,()=>this.update(),e)}destroy(){this._watchUpdatingTracking.destroy()}getTiles(){const t=this.view.featureTiles;if(!t)return[];const e=e=>{const[r,o,i]=e.lij;return s.fromExtent(t.tilingScheme.getExtentGeometry(r,o,i))};return t.tiles.toArray().sort((t,e)=>t.loadPriority-e.loadPriority).map(t=>({...t,level:t.level,geometry:e(t)}))}};t([r()],p.prototype,"_watchUpdatingTracking",void 0),t([r()],p.prototype,"updating",null),t([r()],p.prototype,"view",void 0),p=t([o("esri.views.3d.layers.support.FeatureTileTree3DDebugger")],p);export{p as FeatureTileTree3DDebugger};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{n as t,c as r,a as n,e,b as s,i as o,F as i,h as u,f as c,g as f,H as a}from"../../../../chunks/vec32.js";import{create as h,fromValues as l,freeze as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as p}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as d}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBuffer as _}from"../../../../geometry/projection/projectBuffer.js";import{projectVec3Array as g}from"../../../../geometry/projection/projectVec3Array.js";import{fromValues as b,signedDistance as F}from"../../../../geometry/support/plane.js";import{Frustum as M}from"../../state/Frustum.js";class S{constructor(t,r){this._renderCoordsHelper=t,this.opaqueGround=r,this._cache=new Map,this._cameraForward=h(),this._cameraEye=h(),this._cameraFovY=55*Math.PI/180,this._frustumBoundingSphereCenter=h(),this._frustumBoundingSphereRadius=0,this._frustum=new M(t),this._renderSR=t.spatialReference;const n=d(this._renderSR);this._renderSREllipsoidRadius=p(n).radius}setup(n){this._aboveGround=n.aboveGround,this._frustum.update(n),t(this._cameraForward,n.viewForward),r(this._cameraEye,n.eye),this._cameraFovY=n.fovY,this._updateFrustumBoundingSphere()}done(){this._cache.clear()}compute(t){if(this._cache.has(t.id))return this._cache.get(t.id);const r=this._isVisibleInFrustum(t);return this._cache.set(t.id,r),r}_isVisibleInFrustum(t){return 2===this._renderCoordsHelper.viewingMode?this._isTileVisibleInFrustumLocal(t):this._isTileVisibleInFrustumGlobal(t)}_updateFrustumBoundingSphere(){const r=this._frustum,o=r.origin,i=A;t(i,r.direction);const u=r.points,c=W;n(c,u[4],o);const f=.5*e(c,c)/e(i,c),a=this._frustumBoundingSphereCenter;s(a,o,i,f);const h=1+f;this._frustumBoundingSphereRadius=h}_isTileVisibleInFrustumLocal(t){const r=t.spatialReference,u=t.extent,c=this._renderSR;if(C[0]=u[0],C[1]=u[1],C[2]=0,C[3]=u[2],C[4]=u[3],C[5]=0,!_(C,r,0,C,c,0))return!1;o(E[0],C[0],C[1],0),o(E[1],C[3],C[1],0),o(E[2],C[3],C[4],0),o(E[3],C[0],C[4],0),o(k,.5*(C[0]+C[3]),.5*(C[1]+C[4]),.5*(C[2]+C[5]));const f=St,a=.5*i(E[0],E[2]),h=this._frustum,l=this._frustumBoundingSphereRadius,m=this._frustumBoundingSphereCenter,p=D;n(p,m,k);const d=e(f,p),g=z;s(g,k,f,d);if(i(g,m)>a+l)return!1;const b=this._cameraForward,F=e(b,St),M=this._cameraFovY,S=this._cameraEye;if(Math.abs(F)<Math.abs(Math.cos(.5*M))){let t=!0;const r=o(Rt,b[0],b[1],0),n=e(S,r);for(let s=0;s<4;++s){const o=E[s];if(e(o,r)-n>0){t=!1;break}}if(t)return!1}{const t=E[0],r=E[2];if(t[0]<=S[0]&&S[0]<=r[0]&&t[1]<=S[1]&&S[1]<=r[1])return!0}const R=x,v=this.opaqueGround&&this._aboveGround,G=this.opaqueGround&&!this._aboveGround,j=Math.min(G?gt:1/0,d+l),B=Math.max(v?-gt:-1/0,d-l);for(let n=0;n<4;++n)s(R[n],E[n],f,j),s(R[n+4],E[n],f,B);if(y(h.planes,R,8))return!1;if(q(h.planes,R,8))return!0;for(let n=0;n<4;++n){const t=R[n],r=R[n+4];if(vt(h.planes,t,r))return!0;const e=R[(n+1)%4];if(vt(h.planes,t,e))return!0;const s=R[4+(n+1)%4];if(vt(h.planes,r,s))return!0}if(Bt[0][3]=+E[0][0],Bt[1][3]=-E[2][0],Bt[2][3]=+E[0][1],Bt[3][3]=-E[2][1],Bt[4][3]=+B,Bt[5][3]=-j,q(Bt,h.points))return!0;if(q(Bt,h.points))return!0;for(let n=0;n<4;++n){const t=S,r=h.points[n+4];if(Gt(Bt,t,r))return!0;const e=h.points[4+(n+1)%4];if(Gt(Bt,r,e))return!0}return!1}_isTileVisibleInFrustumGlobal(r){if(r.level<w)return!0;const l=r.spatialReference,m=r.extent
|
|
5
|
+
import{n as t,c as r,a as n,e,b as s,i as o,F as i,h as u,f as c,g as f,H as a}from"../../../../chunks/vec32.js";import{create as h,fromValues as l,freeze as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as p}from"../../../../geometry/ellipsoidUtils.js";import{getSphericalPCPF as d}from"../../../../geometry/spatialReferenceEllipsoidUtils.js";import{projectBuffer as _}from"../../../../geometry/projection/projectBuffer.js";import{projectVec3Array as g}from"../../../../geometry/projection/projectVec3Array.js";import{fromValues as b,signedDistance as F}from"../../../../geometry/support/plane.js";import{Frustum as M}from"../../state/Frustum.js";class S{constructor(t,r){this._renderCoordsHelper=t,this.opaqueGround=r,this._cache=new Map,this._cameraForward=h(),this._cameraEye=h(),this._cameraFovY=55*Math.PI/180,this._frustumBoundingSphereCenter=h(),this._frustumBoundingSphereRadius=0,this._frustum=new M(t),this._renderSR=t.spatialReference;const n=d(this._renderSR);this._renderSREllipsoidRadius=p(n).radius}setup(n){this._aboveGround=n.aboveGround,this._frustum.update(n),t(this._cameraForward,n.viewForward),r(this._cameraEye,n.eye),this._cameraFovY=n.fovY,this._updateFrustumBoundingSphere()}done(){this._cache.clear()}compute(t){if(this._cache.has(t.id))return this._cache.get(t.id);const r=this._isVisibleInFrustum(t);return this._cache.set(t.id,r),r}_isVisibleInFrustum(t){return 2===this._renderCoordsHelper.viewingMode?this._isTileVisibleInFrustumLocal(t):this._isTileVisibleInFrustumGlobal(t)}_updateFrustumBoundingSphere(){const r=this._frustum,o=r.origin,i=A;t(i,r.direction);const u=r.points,c=W;n(c,u[4],o);const f=.5*e(c,c)/e(i,c),a=this._frustumBoundingSphereCenter;s(a,o,i,f);const h=1+f;this._frustumBoundingSphereRadius=h}_isTileVisibleInFrustumLocal(t){const r=t.spatialReference,u=t.extent,c=this._renderSR;if(!u)return!0;if(C[0]=u[0],C[1]=u[1],C[2]=0,C[3]=u[2],C[4]=u[3],C[5]=0,!_(C,r,0,C,c,0))return!1;o(E[0],C[0],C[1],0),o(E[1],C[3],C[1],0),o(E[2],C[3],C[4],0),o(E[3],C[0],C[4],0),o(k,.5*(C[0]+C[3]),.5*(C[1]+C[4]),.5*(C[2]+C[5]));const f=St,a=.5*i(E[0],E[2]),h=this._frustum,l=this._frustumBoundingSphereRadius,m=this._frustumBoundingSphereCenter,p=D;n(p,m,k);const d=e(f,p),g=z;s(g,k,f,d);if(i(g,m)>a+l)return!1;const b=this._cameraForward,F=e(b,St),M=this._cameraFovY,S=this._cameraEye;if(Math.abs(F)<Math.abs(Math.cos(.5*M))){let t=!0;const r=o(Rt,b[0],b[1],0),n=e(S,r);for(let s=0;s<4;++s){const o=E[s];if(e(o,r)-n>0){t=!1;break}}if(t)return!1}{const t=E[0],r=E[2];if(t[0]<=S[0]&&S[0]<=r[0]&&t[1]<=S[1]&&S[1]<=r[1])return!0}const R=x,v=this.opaqueGround&&this._aboveGround,G=this.opaqueGround&&!this._aboveGround,j=Math.min(G?gt:1/0,d+l),B=Math.max(v?-gt:-1/0,d-l);for(let n=0;n<4;++n)s(R[n],E[n],f,j),s(R[n+4],E[n],f,B);if(y(h.planes,R,8))return!1;if(q(h.planes,R,8))return!0;for(let n=0;n<4;++n){const t=R[n],r=R[n+4];if(vt(h.planes,t,r))return!0;const e=R[(n+1)%4];if(vt(h.planes,t,e))return!0;const s=R[4+(n+1)%4];if(vt(h.planes,r,s))return!0}if(Bt[0][3]=+E[0][0],Bt[1][3]=-E[2][0],Bt[2][3]=+E[0][1],Bt[3][3]=-E[2][1],Bt[4][3]=+B,Bt[5][3]=-j,q(Bt,h.points))return!0;if(q(Bt,h.points))return!0;for(let n=0;n<4;++n){const t=S,r=h.points[n+4];if(Gt(Bt,t,r))return!0;const e=h.points[4+(n+1)%4];if(Gt(Bt,r,e))return!0}return!1}_isTileVisibleInFrustumGlobal(r){if(r.level<w)return!0;const l=r.spatialReference,m=r.extent;if(!m||!l)return!0;const p=this.opaqueGround&&this._aboveGround,d=this.opaqueGround&&!this._aboveGround,_=E,b=.5*(m[0]+m[2]);if(o(_[0],m[0],m[1],0),o(_[1],m[2],m[1],0),o(_[2],m[2],m[3],0),o(_[3],m[0],m[3],0),o(_[4],b,m[1],0),o(_[5],b,m[3],0),!g(_,l,0,_,this._renderSR,0,6))return!1;const M=_[0][2]>0,S=_[3][2]<0,j=M||S,B=this._renderSREllipsoidRadius;if(j){const t=T;R(t,yt,_[0]);const r=Y;if(R(r,yt,_[1]),M){const n=P,e=_[4],s=H;R(s,e,yt),R(n,s,e);const o=_[0];u(o,t,n),G(o,B);const i=_[1];u(i,r,n),G(i,B)}else if(S){const n=P,e=_[5],s=H;R(s,e,yt),R(n,e,s);const o=_[3];u(o,n,t),G(o,B);const i=_[2];u(i,n,r),G(i,B)}}const q=k,I=n(Q,_[3],_[0]);t(I,I);const x=c(X,_[0],_[3]);f(x,x,.5);const C=-e(x,I),A=c(Z,_[0],_[1]);f(A,A,.5);const W=c($,_[2],_[3]);f(W,W,.5);const z=n(tt,W,A);t(z,z);const D=-(C+e(I,A))/e(I,z);s(q,A,z,D),G(q,B);const ot=this._frustumBoundingSphereRadius,mt=this._frustumBoundingSphereCenter,pt=this._frustum,dt=pt.planes,St=L;t(St,q);const Rt=e(_[0],St)/a(_[0]),vt=pt.origin,Gt=pt.points;let jt=!1;if(p){{jt=!0;const r=t(bt,vt);for(let s=0;s<4;++s){const o=Gt[4+s],i=n(h(),o,vt);t(i,i);const c=u(h(),r,i);t(c,c);const f=u(h(),i,c);t(f,f);if(e(vt,f)>B){jt=!1;break}}}if(jt){if(e(vt,St)<B*Rt-gt)return!1}const r=t(bt,pt.origin);if(e(r,St)<0)return!1;{const r=t(Ft,pt.direction);if(e(r,St)>Mt)return!1}}const Bt=Math.sqrt(1-Rt*Rt);if(Bt>.9)return!0;let qt=!1;const wt=e(St,mt),It=a(mt);if(It<=ot&&!dt.some(t=>F(t,J)>0)){if(!p)return!0;qt=!0}const Vt=wt/It;if(!qt&&wt<=0){if(-wt>ot)return!1}const xt=ot/It;if(Math.sqrt(1-Vt*Vt)*Math.sqrt(1-xt*xt)-xt*Vt>Bt)return!1;if(!jt){if(_.some(t=>pt.intersectsPoint(t)))return!0;if(pt.intersectsPoint(q))return!0}const Ct=K;n(Ct,mt,J);const Et=e(Ct,St),kt=U;f(kt,St,Et);const Pt=i(kt,mt),Tt=l.isWGS84,Yt=r.lij,Ht=Tt&&Yt[2]===2**Yt[0]-1,Lt=Tt&&0===Yt[2],Ut=Lt?at:Ht?ct:it,At=Lt?ht:Ht?ft:ut;if(!qt){const t=_,r=lt,n=rt,e=nt,s=J;for(const o of Ut){const i=t[o];if(v(n,t[(o+1)%4],i),v(e,s,i),R(r,e,n),V(r,Gt,1))return!1}}let Wt=null;if(!p&&Et<1.01*ot){const t=2.5*ot;if(Pt>Rt*t+ot)return!1;const r=O,n=t/Rt;for(let e=0;e<4;++e)f(r[e],_[e],n/B);o(r[4],0,0,0),Wt=r}else{const t=(d?B+gt:Et+ot)/Rt,r=p?B-gt:(Et-ot)/Rt,n=N;for(let e=0;e<4;++e){const s=_[e];f(n[e],s,r/B),f(n[e+4],s,t/B)}Wt=n}if(y(dt,Wt,Wt.length))return!1;const zt=pt.lines,Dt=et,Jt=st;for(const e of zt){t(Jt,e.direction);for(const r of At){const e=Wt[r];if(t(Dt,e),_t(Jt,Dt,Wt,Gt))return!1;const s=(r+1)%4;if(p){const r=Wt[s];if(n(Dt,r,e),t(Dt,Dt),_t(Jt,Dt,Wt,Gt))return!1}if(d){const e=Wt[4+r],o=Wt[4+s];if(n(Dt,o,e),t(Dt,Dt),_t(Jt,Dt,Wt,Gt))return!1}}}return!0}}function R(r,n,e){return u(r,n,e),t(r,r),r}function v(r,e,s){return n(r,e,s),t(r,r),r}function G(t,r){return f(t,t,r/a(t)),t}const j=[0,1,2,3,5];function B(t,r,n){for(let e=0;e<n;++e)if(F(t,r[e])<=0)return!1;return!0}function y(t,r,n){for(const e of j)if(B(t[e],r,n))return!0;return!1}function q(t,r,n=r.length){for(let e=0;e<n;++e){const n=r[e];let s=!0;for(const r of t){if(F(r,n)>0){s=!1;break}}if(s)return!0}return!1}const w=2,I=4;function V(t,r,n){for(const s of r)if(e(s,t)<n)return!1;return!0}const x=[h(),h(),h(),h(),h(),h(),h(),h()],C=[0,0,0,0,0,0],E=[h(),h(),h(),h(),h(),h()],k=h(),P=h(),T=h(),Y=h(),H=h(),L=h(),U=h(),A=h(),W=h(),z=h(),D=h(),J=m(0,0,0),K=h(),N=[h(),h(),h(),h(),h(),h(),h(),h()],O=[h(),h(),h(),h(),h()],Q=h(),X=h(),Z=h(),$=h(),tt=h(),rt=h(),nt=h(),et=h(),st=h(),ot=h(),it=[0,1,2,3],ut=[0,1,2,3],ct=[0,1,3],ft=[0,1,3],at=[1,2,3],ht=[1,2,3],lt=h();function mt(t,r,n){let s=1/0,o=-1/0;for(const i of n){const t=e(r,i);s=Math.min(s,t),o=Math.max(o,t)}t[0]=s,t[1]=o}function pt(t,r,n,s){let o=1/0,i=-1/0;for(const u of s){const s=e(n,u);if(o=Math.min(o,s),i=Math.max(i,s),o<=r&&i>=t)return!1}return!0}const dt=[0,0];function _t(t,r,n,e){const s=n.length,o=e.length;if(0===s||0===o)return!0;const i=ot;R(i,t,r);const u=o<s,c=u?n:e,f=dt;return mt(f,i,u?e:n),pt(f[0],f[1],i,c)}const gt=430,bt=h(),Ft=h(),Mt=Math.cos(.25*Math.PI),St=l(0,0,1),Rt=h();function vt(t,r,n){const e={t0:0,t1:1};for(const s of j){if(!jt(t[s],r,n,e))return!1}return e.t0<e.t1}function Gt(t,r,n){const e={t0:0,t1:1};for(const s of t){if(!jt(s,r,n,e))return!1}return e.t0<e.t1}function jt(t,r,n,e){let{t0:s,t1:o}=e;const i=F(t,r),u=F(t,n);if(i>=0&&u>=0)return!1;if(i<0&&u>=0){const t=-i/(u-i);if(t<s)return!1;t<o&&(o=t)}else if(i>=0&&u<0){const t=i/(i-u);if(t>o)return!1;t>s&&(s=t)}return e.t0=s,e.t1=o,!0}const Bt=[b(-1,0,0,1),b(1,0,0,-1),b(0,-1,0,1),b(0,1,0,-1),b(0,0,-1,1),b(0,0,1,-1)],yt=m(0,0,1);export{S as FeatureTileVisibility3D,q as isAnyVertexInPolyhedron,y as isConvexHullOutsideOfFrustum,I as maxLODLevelDelta,w as minTileLOD};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import r from"../../../../core/Logger.js";import{removeMaybe as i,destroyMaybe as
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import r from"../../../../core/Logger.js";import{removeMaybe as i,destroyMaybe as o}from"../../../../core/maybe.js";import{throwIfNotAbortError as s,throwIfAborted as n,throwIfAbortError as l}from"../../../../core/promiseUtils.js";import{initial as a}from"../../../../core/reactiveUtils.js";import{sqlAnd as u}from"../../../../core/sql.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as h}from"../../../../core/support/UpdatingHandles.js";import _ from"../../../../layers/support/FeatureFilter.js";import{getFloorFilterClause as f}from"../../../../layers/support/floorFilterUtils.js";import{QueryEngine as d}from"../graphics/QueryEngine.js";import{QueryEngineContext as g}from"../graphics/QueryEngineContext.js";import{TaskPriority as m}from"../../../support/Scheduler.js";let y=class extends t{constructor(e){super(e),this._frameTask=null,this._queryEngine=null,this._updateRequested=!0,this._updatingHandles=new h,this._abortController=new AbortController}initialize(){const e=m.FILTER_VISIBILITY,{layer:t,view:r}=this._configuration,{featureStore:i}=this.context,{spatialReference:o,resourceController:n}=r,l=this._configuration.hasZ??!1,u=this._configuration.hasM??!1,p=new g(o,t,n,()=>i,l,u);this._queryEngine=new d({context:p,priority:e}),this._frameTask=r.resourceController.scheduler.registerTask(e),this._updatingHandles.add(()=>[this._compositedFeatureFilter,this._sceneFilter],()=>this.reapply(),a),this._updatingHandles.addWhen(()=>!this._frameTask.updating&&this._updateRequested,()=>{this._frameTask.scheduleGenerator(()=>this._updateVisibility(),this._abortController.signal).catch(s)},a)}destroy(){this._abortController.abort(),this._updatingHandles.destroy(),this.clear(),this._frameTask=i(this._frameTask),this._queryEngine=o(this._queryEngine),this._set("context",null)}get updating(){return this._updateRequested||this._updatingHandles.updating||this._frameTask.updating}get defaultVisibility(){return null==this._compositedFeatureFilter&&null==this._sceneFilter}get _featureFilter(){return"filter"in this._configuration?this._configuration.filter:null}get _effectiveDisplayFilterClause(){return"effectiveDisplayFilterClause"in this._configuration?this._configuration.effectiveDisplayFilterClause:null}get _sceneFilter(){return"layerFilter"in this._configuration?this._configuration.layerFilter:null}get _floorFilter(){return f(this._configuration)}get _timeExtent(){return"timeExtent"in this._configuration?this._configuration.timeExtent:null}get _compositedFeatureFilter(){const{_featureFilter:e,_effectiveDisplayFilterClause:t,_timeExtent:r,_floorFilter:i}=this;let o=e?.clone();if(null!=t&&(o??=new _,o.where=u(o.where,t)),null!=r&&(o??=new _,o.timeExtent=o.timeExtent?.intersection(r)??r),null!=i){o??=new _;const e=null==o.where||""===o.where;o.where=e?i:u(o.where,i)}return o}get _configuration(){return this.context.configuration}reapply(){this._updateRequested=!0}clear(){this._queryEngine.clear(),this.context.clearFeaturesVisibility()}async*_updateVisibility(){this._updateRequested=!1;const{context:e,_sceneFilter:t,_compositedFeatureFilter:i,_abortController:{signal:o}}=this;if(n(o),null==i&&null==t||0===e.getFeatureCount())return this.clear();try{const r=await this._queryEngine.executeQueryForIdSet(i,t,o);n(o),yield,n(o),e.updateFeatureVisibilities(e=>r.has(e))}catch(s){l(s),r.getLogger(this).warn(`FeatureFilter query failed: ${s}`,{error:s}),e.setAllFeaturesVisibility(!0)}}};e([p({constructOnly:!0})],y.prototype,"context",void 0),e([p()],y.prototype,"updating",null),e([p()],y.prototype,"defaultVisibility",null),e([p()],y.prototype,"_featureFilter",null),e([p()],y.prototype,"_effectiveDisplayFilterClause",null),e([p()],y.prototype,"_sceneFilter",null),e([p()],y.prototype,"_floorFilter",null),e([p()],y.prototype,"_timeExtent",null),e([p()],y.prototype,"_compositedFeatureFilter",null),e([p()],y.prototype,"_configuration",null),e([p()],y.prototype,"_updateRequested",void 0),y=e([c("esri.views.3d.layers.support.FeatureVisibilityFilter")],y);export{y as FeatureVisibilityFilter};
|