@arcgis/core 4.34.0-next.24 → 4.34.0-next.25
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/Basemap.js +1 -1
- package/analysis/VolumeMeasurement/CutFillOptions.d.ts +4 -0
- package/analysis/VolumeMeasurement/CutFillOptions.js +1 -1
- package/analysis/VolumeMeasurementAnalysis.js +1 -1
- package/applications/Components/imageryUtils.d.ts +4 -0
- package/applications/Components/imageryUtils.js +5 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{0867aa688fa8938906da.js → 03bef3f4b6b09b1e864b.js} +1 -1
- package/assets/esri/core/workers/chunks/06cdbccc9f325dcc303d.js +1 -0
- package/assets/esri/core/workers/chunks/07613c89255bdab6b7c6.js +1 -0
- package/assets/esri/core/workers/chunks/09618761df5c4fdd52a0.js +1 -0
- package/assets/esri/core/workers/chunks/0ae00339991f5387203e.js +1 -0
- package/assets/esri/core/workers/chunks/0b4b294f3ce74fde5620.js +1 -0
- package/assets/esri/core/workers/chunks/{146520d263b910b5bdc7.js → 0e96a3b7228f1ff8e6c5.js} +1 -1
- package/assets/esri/core/workers/chunks/109ef17dd4f9430bb686.js +1 -0
- package/assets/esri/core/workers/chunks/1597aca21334cab3b802.js +1 -0
- package/assets/esri/core/workers/chunks/196564ad230bef6b59cf.js +1 -0
- package/assets/esri/core/workers/chunks/19f8d551cbebc11db1eb.js +1 -0
- package/assets/esri/core/workers/chunks/1ceee047e3fa617b0600.js +1 -0
- package/assets/esri/core/workers/chunks/1d27701832ea139fcc20.js +1 -0
- package/assets/esri/core/workers/chunks/1f296f85becf1ca6714d.js +1 -0
- package/assets/esri/core/workers/chunks/1f8d7bd44d53c30df383.js +1 -0
- package/assets/esri/core/workers/chunks/1fabb5ec59da698c1618.js +1 -0
- package/assets/esri/core/workers/chunks/{919d2fd7ebc0c840a759.js → 219b2911668db120452b.js} +1 -1
- package/assets/esri/core/workers/chunks/29ae5723fa35aa73ff9b.js +1 -0
- package/assets/esri/core/workers/chunks/2b4b073254fe8b6a081c.js +1 -0
- package/assets/esri/core/workers/chunks/30293b88501b5d6162fc.js +1 -0
- package/assets/esri/core/workers/chunks/31533f5e8b76b307f61c.js +1 -0
- package/assets/esri/core/workers/chunks/347117e61e1c6edd074f.js +1 -0
- package/assets/esri/core/workers/chunks/3616eb2607843524483f.js +1 -0
- package/assets/esri/core/workers/chunks/36648facd56ee91afc7c.js +1 -0
- package/assets/esri/core/workers/chunks/394477e88be0c6790f02.js +1 -0
- package/assets/esri/core/workers/chunks/3b80b01551d124534a1b.js +1 -0
- package/assets/esri/core/workers/chunks/{89d91ce2f566dd3f57f7.js → 3be9ec0503a669bcfce6.js} +1 -1
- package/assets/esri/core/workers/chunks/3c9cf06ac6aa1db6c4f6.js +1 -0
- package/assets/esri/core/workers/chunks/40fc7c43feaeef8b814d.js +1 -0
- package/assets/esri/core/workers/chunks/42cddc8f8c8d73e22ee2.js +1 -0
- package/assets/esri/core/workers/chunks/437a4100a837ee16df7c.js +1 -0
- package/assets/esri/core/workers/chunks/453e536f566d80a9863b.js +1 -0
- package/assets/esri/core/workers/chunks/472c677a74d779ce62d7.js +1 -0
- package/assets/esri/core/workers/chunks/4b68b6985430c42316b7.js +1 -0
- package/assets/esri/core/workers/chunks/4ce671bc4d36387b55fa.js +1 -0
- package/assets/esri/core/workers/chunks/51cfa2f70ec222e1582b.js +1 -0
- package/assets/esri/core/workers/chunks/5284d46aecd6fe0345b8.js +1 -0
- package/assets/esri/core/workers/chunks/567385709e18ace93b1e.js +1 -0
- package/assets/esri/core/workers/chunks/5a9b27f2b343cd5b0852.js +1 -0
- package/assets/esri/core/workers/chunks/{4c2f3e43992a918e4c2d.js → 5ef3256c32c4b622bd11.js} +1 -1
- package/assets/esri/core/workers/chunks/{5ce62d9fff80d014d186.js → 60aeb7a5ccd8bc71be02.js} +1 -1
- package/assets/esri/core/workers/chunks/{55e9b02d70812f7cdac2.js → 63966066a963e9a1fb14.js} +1 -1
- package/assets/esri/core/workers/chunks/63f50ff2ae94f684d56b.js +1 -0
- package/assets/esri/core/workers/chunks/{8bf04be4052bf148777a.js → 6a1cf6b0ffdf6080b5c4.js} +1 -1
- package/assets/esri/core/workers/chunks/6deaa08e3a61a455e564.js +1 -0
- package/assets/esri/core/workers/chunks/6e9b4bfe2a1497c96100.js +1 -0
- package/assets/esri/core/workers/chunks/6efc3d120c9c2c09cb06.js +1 -0
- package/assets/esri/core/workers/chunks/7338ce95bceb2c7fab87.js +1 -0
- package/assets/esri/core/workers/chunks/{c64fa94cba71ba2794e2.js → 771012f129890f9a089c.js} +1 -1
- package/assets/esri/core/workers/chunks/{d1b363c418a67b087306.js → 780ff9314f26ae62f75f.js} +1 -1
- package/assets/esri/core/workers/chunks/820cf4337b248a0cb63c.js +1 -0
- package/assets/esri/core/workers/chunks/{fedbf639a0788417a70f.js → 86abfce1f2ac93cc4d54.js} +1 -1
- package/assets/esri/core/workers/chunks/{c94cc026c4ed330408fb.js → 8894483b91bcda845b6f.js} +1 -1
- package/assets/esri/core/workers/chunks/{f050ab9d100012b77bb9.js → 8c5b1114cc2a58305a81.js} +1 -1
- package/assets/esri/core/workers/chunks/{6ca764b4baadef5c1515.js → 92737419b66894799a34.js} +1 -1
- package/assets/esri/core/workers/chunks/9511e55e4fabb3235eac.js +1 -0
- package/assets/esri/core/workers/chunks/{909a6218db87cba2c9ba.js → 9a78cb291c966f8ddda6.js} +1 -1
- package/assets/esri/core/workers/chunks/9f8341caab3b1d02f387.js +1 -0
- package/assets/esri/core/workers/chunks/a08d018d8c137fc4ca17.js +1 -0
- package/assets/esri/core/workers/chunks/{7051bcc178eb512819f6.js → a55338add265d330124b.js} +1 -1
- package/assets/esri/core/workers/chunks/afe4fd3b1b3521712edd.js +1 -0
- package/assets/esri/core/workers/chunks/{9991bd3c7991bffd8260.js → b37f3c416cefc1a6ea2c.js} +1 -1
- package/assets/esri/core/workers/chunks/bb50b4a3af627f91d789.js +1 -0
- package/assets/esri/core/workers/chunks/{f42155b7a4e6c5e80757.js → bbc2a4976d044b990193.js} +1 -1
- package/assets/esri/core/workers/chunks/bbf2c31d217de1b8ba6e.js +1 -0
- package/assets/esri/core/workers/chunks/be3977f7fe0c46a1b493.js +1 -0
- package/assets/esri/core/workers/chunks/befba7ceeb26a38732c1.js +1 -0
- package/assets/esri/core/workers/chunks/bf3fc71881aa559fc931.js +1 -0
- package/assets/esri/core/workers/chunks/c19421707257fc93acb9.js +1 -0
- package/assets/esri/core/workers/chunks/c1fb5290e0e259b74389.js +1 -0
- package/assets/esri/core/workers/chunks/c361bf4d41a1843d4640.js +1 -0
- package/assets/esri/core/workers/chunks/c51099eab5a99c88e5de.js +1 -0
- package/assets/esri/core/workers/chunks/c56b05a8be498b6f3ee7.js +1 -0
- package/assets/esri/core/workers/chunks/c82e78590c2fabc67609.js +1 -0
- package/assets/esri/core/workers/chunks/{7d7f8f2936ddee65e3da.js → c9e580867f7ac17be329.js} +1 -1
- package/assets/esri/core/workers/chunks/{92ad9098006568358550.js → cafcb46d723d38b377a9.js} +1 -1
- package/assets/esri/core/workers/chunks/{1d75cb1747ffb7b8b050.js → cb81d448ed6bad205346.js} +1 -1
- package/assets/esri/core/workers/chunks/{0f6203ae32663b2b52db.js → d08a523b548e892e1222.js} +1 -1
- package/assets/esri/core/workers/chunks/d29ae64703a947bfb83b.js +1 -0
- package/assets/esri/core/workers/chunks/{04c17957c15234ca0321.js → d81260303a11d3fbe940.js} +1 -1
- package/assets/esri/core/workers/chunks/de1457b07f4e263f1524.js +1 -0
- package/assets/esri/core/workers/chunks/{6bf43bc3714d7b3878fa.js → e547318638c8f496c1a0.js} +1 -1
- package/assets/esri/core/workers/chunks/e8e993fb8697b8f3e0c7.js +346 -0
- package/assets/esri/core/workers/chunks/{53781ccca16e53d4a8c3.js → f291ccf9da6aa7d7ae23.js} +1 -1
- package/assets/esri/core/workers/chunks/f61a8cc7e2b198e521ba.js +1 -0
- package/assets/esri/core/workers/chunks/f9442a281cb91c64c7cd.js +1 -0
- package/assets/esri/core/workers/chunks/fb785bc38323cce6e549.js +1 -0
- package/assets/esri/core/workers/chunks/{c3213b487c11076985af.js → fbf3240b36718fa5dc76.js} +1 -1
- package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
- package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
- package/chunks/ComponentShader.glsl.js +36 -36
- package/chunks/RibbonLine.glsl.js +40 -33
- package/chunks/persistableUrlUtils.js +1 -1
- package/config.js +1 -1
- package/core/AsyncUpdate.js +1 -1
- package/core/Clonable.js +1 -1
- package/core/Evented.js +1 -1
- package/core/Identifiable.js +1 -1
- package/core/JSONSupport.js +1 -1
- package/core/Loadable.js +1 -1
- package/core/MapUtils.js +1 -1
- package/core/MemCache.js +1 -1
- package/core/MultiOriginJSONSupport.js +1 -1
- package/core/ObjectPool.js +1 -1
- package/core/Promise.js +1 -1
- package/core/ReadOnlyMultiOriginJSONSupport.js +1 -1
- package/core/quantity.d.ts +1 -0
- package/geometry/support/buffer/BufferPool.js +1 -1
- package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
- package/interfaces.d.ts +147 -12
- package/kernel.js +1 -1
- package/layers/CatalogLayer.js +1 -1
- package/layers/FeatureLayer.js +1 -1
- package/layers/GeoJSONLayer.js +1 -1
- package/layers/SubtypeGroupLayer.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphSublayerBase.js +1 -1
- package/layers/mixins/APIKeyMixin.js +1 -1
- package/layers/mixins/ArcGISCachedService.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/mixins/ArcGISMapService.js +1 -1
- package/layers/mixins/ArcGISService.js +1 -1
- package/layers/mixins/BlendLayer.js +1 -1
- package/layers/mixins/CustomParametersMixin.js +1 -1
- package/layers/mixins/DisplayFilteredLayer.js +1 -1
- package/layers/mixins/EditBusLayer.js +1 -1
- package/layers/mixins/FeatureEffectLayer.js +1 -1
- package/layers/mixins/FeatureLayerBase.js +1 -1
- package/layers/mixins/FeatureReductionLayer.js +1 -1
- package/layers/mixins/ImageryTileMixin.js +1 -1
- package/layers/mixins/OperationalLayer.js +1 -1
- package/layers/mixins/OrderedLayer.js +1 -1
- package/layers/mixins/PortalLayer.js +1 -1
- package/layers/mixins/PublishableLayer.js +1 -1
- package/layers/mixins/RasterJobHandlerMixin.js +1 -1
- package/layers/mixins/RasterPresetRendererMixin.js +1 -1
- package/layers/mixins/RefreshableLayer.js +1 -1
- package/layers/mixins/ScaleRangeLayer.js +1 -1
- package/layers/mixins/SceneService.js +1 -1
- package/layers/mixins/SublayersOwner.js +1 -1
- package/layers/mixins/TemporalLayer.js +1 -1
- package/layers/mixins/TemporalSceneLayer.js +1 -1
- package/layers/mixins/TrackableLayer.js +1 -1
- package/layers/ogc/wfsUtils.js +1 -1
- package/layers/support/RasterJobHandler.js +1 -1
- package/layers/support/RasterWorker.js +1 -1
- package/layers/support/Sublayer.js +1 -1
- package/layers/support/arcgisLayerUrl.js +1 -1
- package/layers/support/multiLayerServiceUtils.js +1 -1
- package/layers/support/rasterDatasets/pixelReader.js +5 -0
- package/layers/support/rasterFormats/pixelRangeUtils.js +1 -1
- package/layers/support/rasterFunctions/pixelUtils.js +1 -1
- package/package.json +1 -1
- package/renderers/mixins/VisualVariablesMixin.js +1 -1
- package/rest/support/CameraInfoMixin.js +1 -1
- package/rest/support/NormalizationBinParametersMixin.js +1 -1
- package/smartMapping/renderers/color.js +1 -1
- package/smartMapping/renderers/heatmap.js +1 -1
- package/smartMapping/renderers/pieChart.js +1 -1
- package/smartMapping/renderers/size.js +1 -1
- package/smartMapping/renderers/support/regenerateUtils.js +1 -1
- package/smartMapping/renderers/support/rendererUtils.js +1 -1
- package/smartMapping/renderers/type.js +1 -1
- package/smartMapping/symbology/color.js +1 -1
- package/smartMapping/symbology/support/utils.js +1 -1
- package/support/LayersMixin.js +1 -1
- package/support/TablesMixin.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/support/utils.js +1 -1
- package/views/2d/engine/ParentChildStage.js +1 -1
- package/views/2d/engine/webgl/VideoScreenRenderer.js +1 -1
- package/views/2d/engine/webgl/meshing/Mesh.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/MultiRasterMixin.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/videoScreenRenderer/VideoScreenTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/typed/TypedShaderProgram.js +1 -1
- package/views/2d/engine/webgl/textureUtils.js +1 -1
- package/views/2d/layers/BitmapTileLayerView2D.js +1 -1
- package/views/2d/layers/LayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/support/DebugOverlay.js +1 -1
- package/views/3d/analysis/AnalysisView3D.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/CutFillVolumeMeasurementController.js +5 -0
- package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
- package/views/3d/glTF/DefaultLoadingContext.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
- package/views/3d/layers/BuildingSublayerView3D.js +1 -1
- package/views/3d/layers/ElevationLayerView3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/ImageryLayerView3D.js +1 -1
- package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
- package/views/3d/layers/LayerView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/StreamLayerView3D.js +1 -1
- package/views/3d/layers/TiledLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/graphics/StreamController.js +5 -0
- package/views/3d/layers/graphics/StreamGraphics3DGraphicsPipeline.js +1 -1
- package/views/3d/layers/graphics/defaultSymbolComplexity.js +1 -1
- package/views/3d/layers/graphics/wosrLoader.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SNodeLoader.js +1 -1
- package/views/3d/layers/support/DefinitionExpressionSceneLayerView.js +1 -1
- package/views/3d/layers/support/PopupSceneLayerView.js +1 -1
- package/views/3d/layers/support/TemporalSceneLayerView.js +1 -1
- package/views/3d/layers/support/fetchTile.js +1 -1
- package/views/3d/support/MemoryController.js +1 -1
- package/views/3d/support/ResourceController.js +1 -1
- package/views/3d/support/StreamDataLoader.js +1 -1
- package/views/3d/support/StreamDataRequester.js +5 -0
- package/views/3d/support/StreamTextureCollection.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/support/flow/FlowSubViewExtent3D.js +1 -1
- package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
- package/views/3d/support/flow/StreamlinesResources3D.js +1 -1
- package/views/3d/support/flow/geometryUtils.js +1 -1
- package/views/3d/support/index.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +3 -3
- package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
- package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultLayouts.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/shaders/AnimatedLine.glsl.js +17 -0
- package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
- package/views/BreakpointsOwner.js +1 -1
- package/views/DOMContainer.js +1 -1
- package/views/PopupView.js +1 -1
- package/views/VideoView.js +1 -1
- package/views/Viewport2DBaseMixin.js +1 -1
- package/views/Viewport2DMixin.js +1 -1
- package/views/draw/DrawGraphicTool.js +1 -1
- package/views/draw/DrawScreenTool.js +1 -1
- package/views/draw/DrawTool.js +1 -1
- package/views/interactive/tooltip/infos/TooltipInfoWithCoordinates.js +1 -1
- package/views/layers/CatalogDynamicGroupLayerView.js +1 -1
- package/views/layers/CatalogFootprintLayerView.js +1 -1
- package/views/layers/CatalogLayerView.js +1 -1
- package/views/layers/DimensionLayerView.js +1 -1
- package/views/layers/FeatureLayerView.js +1 -1
- package/views/layers/ImageryLayerView.js +1 -1
- package/views/layers/ImageryTileLayerView.js +1 -1
- package/views/layers/LineOfSightLayerView.js +1 -1
- package/views/layers/MapImageLayerView.js +1 -1
- package/views/layers/MediaLayerView.js +1 -1
- package/views/layers/OGCFeatureLayerView.js +1 -1
- package/views/layers/PointCloudLayerView.js +1 -1
- package/views/layers/RefreshableLayerView.js +1 -1
- package/views/layers/StreamLayerView.js +1 -1
- package/views/layers/ViewshedLayerView.js +1 -1
- package/views/layers/WMSLayerView.js +1 -1
- package/views/support/Scheduler.js +1 -1
- package/views/video/VideoOperationalDataView.js +1 -1
- package/views/webgl/BufferObject.js +1 -1
- package/views/webgl/Program.js +1 -1
- package/views/webgl/Renderbuffer.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/Util.js +1 -1
- package/webscene/SunLighting.js +1 -1
- package/webscene/VirtualLighting.js +1 -1
- package/widgets/BasemapGallery/support/PortalBasemapsSource.js +1 -1
- package/widgets/Directions/DirectionsSearchTool.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
- package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
- package/widgets/Feature/support/FeatureContentMixin.js +1 -1
- package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
- package/widgets/FeatureTable/support/EditableColumnTemplateMixin.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/mixins/ImageMeasurementMixin.js +1 -1
- package/widgets/OrientedImageryViewer/mixins/SketchHandlerMixin.js +1 -1
- package/widgets/OrientedImageryViewer/mixins/TriangulatedImageMeasurementMixin.js +1 -1
- package/widgets/OrientedImageryViewer/mixins/TriangulatedSketchHandlerMixin.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer/PanoramicZoomConditions.js +1 -1
- package/widgets/PanoramicViewer.js +1 -1
- package/widgets/Sketch/support/ResponsiveToolbar/ToolbarGroupBase.js +1 -1
- package/widgets/support/GoTo.js +1 -1
- package/assets/esri/core/workers/chunks/0202c2ac73354e3970b2.js +0 -1
- package/assets/esri/core/workers/chunks/02dc6e31b1244e5bb785.js +0 -1
- package/assets/esri/core/workers/chunks/080c79d6caca3b6a2db2.js +0 -1
- package/assets/esri/core/workers/chunks/084236ca316aad980192.js +0 -1
- package/assets/esri/core/workers/chunks/0b484224a92b52c34330.js +0 -1
- package/assets/esri/core/workers/chunks/16a78f5a82f5ca163816.js +0 -1
- package/assets/esri/core/workers/chunks/1cc30073f8200b67cff6.js +0 -1
- package/assets/esri/core/workers/chunks/242b216d61940aebe8e1.js +0 -1
- package/assets/esri/core/workers/chunks/32756905bcf11699b3f7.js +0 -1
- package/assets/esri/core/workers/chunks/35d238a5a6501f89bed7.js +0 -1
- package/assets/esri/core/workers/chunks/36a2a8b6547604bad2ab.js +0 -1
- package/assets/esri/core/workers/chunks/3fcd73ba832cb53d3a07.js +0 -1
- package/assets/esri/core/workers/chunks/40c1d65039c8f1d6afa0.js +0 -1
- package/assets/esri/core/workers/chunks/49dce142ad1ea4c01d00.js +0 -1
- package/assets/esri/core/workers/chunks/4b89d5b9e35bf79b321e.js +0 -1
- package/assets/esri/core/workers/chunks/4c47d327815e281c457e.js +0 -1
- package/assets/esri/core/workers/chunks/4ea96aff38bb301dc40d.js +0 -346
- package/assets/esri/core/workers/chunks/54a49a25845897a15ab1.js +0 -1
- package/assets/esri/core/workers/chunks/576e408fb0834f3948e8.js +0 -1
- package/assets/esri/core/workers/chunks/5e805c9e9012dd39ec86.js +0 -1
- package/assets/esri/core/workers/chunks/6136bf09950adc46bc33.js +0 -1
- package/assets/esri/core/workers/chunks/666afe669866c44830bd.js +0 -1
- package/assets/esri/core/workers/chunks/6a0fbc54638f7de138c1.js +0 -1
- package/assets/esri/core/workers/chunks/843b6029d4c13115e1ac.js +0 -1
- package/assets/esri/core/workers/chunks/86d6007c45f2aa643ac8.js +0 -1
- package/assets/esri/core/workers/chunks/8ea34878a1ef24b4ded3.js +0 -1
- package/assets/esri/core/workers/chunks/8eea6251aa09725e654e.js +0 -1
- package/assets/esri/core/workers/chunks/90145d49a0cec902435c.js +0 -1
- package/assets/esri/core/workers/chunks/916691122d7fb38497d6.js +0 -1
- package/assets/esri/core/workers/chunks/9ae18a17f62d91167202.js +0 -1
- package/assets/esri/core/workers/chunks/9c510df592befb9ff892.js +0 -1
- package/assets/esri/core/workers/chunks/a273f80298417edecc07.js +0 -1
- package/assets/esri/core/workers/chunks/a2ed7a3cd518dd136ec7.js +0 -1
- package/assets/esri/core/workers/chunks/a6a7279b09d7962147ec.js +0 -1
- package/assets/esri/core/workers/chunks/aba520714efc01bead36.js +0 -1
- package/assets/esri/core/workers/chunks/acb9c166259872828646.js +0 -1
- package/assets/esri/core/workers/chunks/accff253af360c34e8a8.js +0 -1
- package/assets/esri/core/workers/chunks/ae6eed26fc932bc08356.js +0 -1
- package/assets/esri/core/workers/chunks/b32c1b60896a72e0ae90.js +0 -1
- package/assets/esri/core/workers/chunks/b4bb461955a4c2bce072.js +0 -1
- package/assets/esri/core/workers/chunks/b98279213f45a0c27600.js +0 -1
- package/assets/esri/core/workers/chunks/ba5b24beebeb703b5919.js +0 -1
- package/assets/esri/core/workers/chunks/bd7d19ba0c7d9143a455.js +0 -1
- package/assets/esri/core/workers/chunks/bffaf1f20f18c75fad4e.js +0 -1
- package/assets/esri/core/workers/chunks/c4f8da6c238eb5e91f91.js +0 -1
- package/assets/esri/core/workers/chunks/cdabea4718a7e7d34cb8.js +0 -1
- package/assets/esri/core/workers/chunks/ce7155ae63e7bb74be00.js +0 -1
- package/assets/esri/core/workers/chunks/d45383d76ba99718b6d9.js +0 -1
- package/assets/esri/core/workers/chunks/d915d0a30d9beb24bd3a.js +0 -1
- package/assets/esri/core/workers/chunks/dc6538a2d5a1e60d0209.js +0 -1
- package/assets/esri/core/workers/chunks/dca633ae3bfd4a3f9bb3.js +0 -1
- package/assets/esri/core/workers/chunks/dfa7976085f7408a366c.js +0 -1
- package/assets/esri/core/workers/chunks/e0a5b499b3ae38c21278.js +0 -1
- package/assets/esri/core/workers/chunks/e1a20ba7d6279f59adc0.js +0 -1
- package/assets/esri/core/workers/chunks/e49a135a2933306a6105.js +0 -1
- package/assets/esri/core/workers/chunks/e9a9174c4d1a0a9effb6.js +0 -1
- package/assets/esri/core/workers/chunks/edead1a123860cc74b1b.js +0 -1
- package/assets/esri/core/workers/chunks/f90573c9dc36e51cd588.js +0 -1
- package/assets/esri/core/workers/chunks/fa9658dbfb921f9c13af.js +0 -1
- package/assets/esri/core/workers/chunks/fb5e2b1ced03eef28e96.js +0 -1
- package/assets/esri/core/workers/chunks/fd8f4eabb8bbc593dd9c.js +0 -1
- package/assets/esri/core/workers/chunks/fe1902d63f610cebd947.js +0 -1
- package/layers/graphics/controllers/StreamController.js +0 -5
|
@@ -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 has from"../../../../core/has.js";import e from"../../../../core/PooledArray.js";import{isAbortError as t}from"../../../../core/promiseUtils.js";import{projectBoundingSphere as i}from"../../../../geometry/projection/projectBoundingSphere.js";import{l as s,h as n,c as o,u as r}from"../../../../chunks/sphere.js";import{LodMetric as a,NodeBase as l,Node as d,NodeFilterImpact as h,NodeIMModificationImpact as u,NodeTraversalState as c}from"./I3SNode.js";import{invalidateMbs as g,addWraparound as _}from"./I3SUtil.js";import{ValidatedNode as f}from"./ValidatedNode.js";import{ElevationRange as m}from"../../support/ElevationRange.js";import{Obb as v}from"../../support/orientedBoundingBox.js";class N{constructor(e,t,i,s,n){this.childOffset=e,this.childCount=t,this.visibilityCache=i,this.ref=s,this.node=n,this.useAsHole=0,this.filterImpact=h.NotChecked,this.traversalState=null,this.parent=-1}invalidateBounds(){this.node?.invalidateServiceBVsInRenderSR(),this.ref?.invalidateServiceBVsInRenderSR()}}class p{constructor(e=new Array,t=new Array){this.nodes=e,this.children=t,this.lastTraversed=0,this.numNodesWithLoadedChildren=0}}class b{get _useNodePages(){return this._pageSize>0}constructor(t,i,s,n,o,r,l,d,h,u,c,g,_,f,m,v){this.viewingMode=t,this._layer=i,this._streamDataController=n,this._clientNodeLoader=o,this._viewportQueries=r,this._logger=l,this.holeFilling=d,this._isLoaded=h,this._isReloading=u,this._isSelected=c,this._enable=g,this._needsUpdate=_,this._canRequest=f,this._computeVisibilityObb=m,this._computeNodeFiltering=v,this._dirty=!0,this._nodePages=new Map,this._clientNodePage=null,this._pageSize=0,this._rootIndex=0,this._lodMetric=a.None,this._lodConversion=e=>e,this._isEditable=!1,this._urlPrefix="",this._loadingNodes=new Set,this._loadingPages=new Set,this._failedNodes=new Set,this._failedPages=new Set,this._indexMissing=1,this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.POSITIVE_INFINITY,this._version=x(0),this._visibilityCacheVersion=x(0),this._maxLevel=1,this._featureEstimate={estimate:0,leavesReached:!1},this._unloadedMemoryEstimate=0,this._missingPagesAndNodes=new e({deallocator:null}),this._prefetchNodes=new e({deallocator:null}),this._updates=new y(this._missingPagesAndNodes),this._imModificationUncategorized=new e({deallocator:null}),this.ignoreServiceObb=!1,this.progressiveLoadPenalty=0,this._pageQueue=new Array,this._newPages=new Array,this.needNodeElevationRange=!1,this.layerHasModifications=!1,this._layerHasFilter=!1,this._frameNumber=0,this._traverseDescendantsQueue=[0],this._traverseDescendantsNestingLevel=0,this._isEditable=null!=i.associatedLayer?.infoFor3D,i.serviceUpdateTimeStamp?.lastUpdate&&(this._lastUpdate=`${i.serviceUpdateTimeStamp.lastUpdate}`),this._maxLodLevel=this._viewportQueries?this._viewportQueries.maxLodLevel:1,this._init(s)}_init(e){if("page"===e.type){const t=e.rootPage;switch(this._urlPrefix=e.urlPrefix,this._pageSize=e.pageSize,e.lodMetric){case"maxScreenThreshold":this._lodMetric=a.MaxScreenThreshold;break;case"maxScreenThresholdSQ":this._lodMetric=a.MaxScreenThreshold,this._lodConversion=F}if(this._isEditable){this._rootIndex=-1;const i=E(e.rootIndex,e.pageSize),s=t.nodes[i],n={nodes:[{index:this._rootIndex,children:[e.rootIndex],mesh:void 0,obb:s.obb,lodThreshold:s.lodThreshold}]};this._addPage(w(this._rootIndex,this._pageSize),n),this.getNode(-1).serviceObbInIndexSR=void 0}else this._rootIndex=e.rootIndex;this._addPage(w(e.rootIndex,this._pageSize),t),this._updateParentsAndLevel()}else if("node"===e.type){this._urlPrefix=e.urlPrefix;const t=new p;if(this._nodePages.set(0,t),this._isEditable){this._clientNodePage=new p;const t={id:"-1",version:null,mbs:e.rootNode.mbs,obb:e.rootNode.obb,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:[{id:"root",href:"../root",mbs:e.rootNode.mbs,obb:e.rootNode.obb}]};this._rootIndex=this._makeClientRefNode(new l(t.id,null),-1);const i=this._validateNode(t.id,t);i&&this._addNode(i,this._rootIndex)}else this._rootIndex=this._makeRefNode(new l(e.rootNode.id,null),-1);const i=this._validateNode(e.rootNode.id,e.rootNode);i&&this._addNode(i,0)}}addClientNodeToIndex(e,t){const i=-1,s=new l(e,t),n=this._makeClientRefNode(s,i);return this._linkChildToParentNode(i,n),this.requestUpdate(),n}removeClientNodeFromIndex(e,t,i){this._destroyClientRefNode(e,t,i),this.requestUpdate()}_loadPage(e){this._loadingPages.add(e);const i=this._urlPrefix+e;this._streamDataController.request(i,"json").then(t=>{this._pageQueue.push({pageIndex:e,page:t})}).catch(i=>{this._loadingPages.delete(e),t(i)||(this._failedPages.add(e),this._logger.error("#loadPage()",this._layer,`Error when loading page ${e}`,i))})}_addQueuedPages(e){for(;this._pageQueue.length>0&&!e.done;){const{pageIndex:t,page:i}=this._pageQueue.shift();this._addPage(t,i),this._loadingPages.delete(t),e.madeProgress(),this.needNodeElevationRange&&this._newPages.push(t)}this._updateParentsAndLevel()}_invalidateElevationRangeForNewPages(e){if(this.needNodeElevationRange)for(;this._newPages.length>0&&!e.done;){const e=this._nodePages.get(this._newPages.shift());e?.nodes.forEach(e=>{let t=e.parent;for(;null!=t&&t!==this._rootIndex;){const e=this.getNode(t);e&&!Number.isNaN(e?.elevationRangeMin)&&(e.invalidateElevationRange(),this.invalidateBoundingVolumeCache(t)),t=this.getParentIndex(t)}})}}_addPage(e,t){const i=[],n=[],o=t.nodes.map((t,o)=>{const r=i.length,a=t.children?t.children.length:0;n.push(this._rootIndex);for(let e=0;e<a;e++)i.push(t.children[e]);const l=`${t.index}`,h=v.fromJSON(t.obb),u=s(h.center,h.radius),c=t.mesh?.attribute,g=t.mesh?.geometry,_=t.mesh?.material,f={hasSharedResource:!1,isEmpty:null==g,attributes:null!=c?.resource?`${c.resource}`:void 0,geometry:null!=g?.resource?`${g.resource}`:void 0,texture:null!=_?.resource?`${_.resource}`:void 0,geometryDefinition:g?g.definition:-1,materialDefinition:_?_.definition:-1},m=new d(l,M(o,e,this._pageSize),u,a,0,f,this._lastUpdate,this._lodMetric,this._lodConversion(t.lodThreshold),g?.featureCount??null);return m.serviceObbInIndexSR=h,m.visibilityObbInRenderSR=this._computeVisibilityObb(m),m.vertexCount=g?g.vertexCount:0,new N(r,a,P(this._visibilityCacheVersion),null,m)}),r=new p(o,i);-1===e?this._clientNodePage=r:this._nodePages.set(e,r)}_updateParentsAndLevel(){const e=new Array,t=(t,i,s)=>{const n=this._getPage(t);if(null!=n){const o=E(t,this._pageSize),r=n.nodes[o];r.parent=null!=i?i:-1;const a=r.node;null!=a&&(a.level=s,e.push(t))}};for(t(this._rootIndex,null,0);e.length;){const i=e.pop(),s=this.getNode(i);if(null!=s)for(let e=0;e<s.childCount;e++){t(this.getChildIndex(s.index,e),i,s.level+1),this._maxLevel=Math.max(this._maxLevel,s.level+1)}}}_getPage(e){const t=w(e,this._pageSize);return this._getPageFromPageIndex(t)}_getPageFromPageIndex(e){return e<0?this._clientNodePage:this._nodePages.get(e)}_getNodeInternal(e){const t=this._getPage(e);return null==t?null:(t.lastTraversed=this._frameNumber,t.nodes[E(e,this._pageSize)])}_addNode(e,t){e.children&&this.populateChildren(t,e.children);const i=this.getParent(t),s=null!=i?i.level+1:0;this._maxLevel=Math.max(this._maxLevel,e.children?s+1:s);const{lodMetric:n,maxError:o}=O(e.lodSelection),r=this._getNodeInternal(t),a=new d(e.id,t,e.mbs,r.childCount,s,e.resources,e.version,n,o,e.numFeatures);r.node=a,e.obb&&(a.serviceObbInIndexSR=v.fromJSON(e.obb)),a.visibilityObbInRenderSR=this._computeVisibilityObb(a);const l=r.ref;return null!=l&&(null==l.serviceMbsInIndexSR&&(l.serviceMbsInIndexSR=e.mbs),a.shareServiceBVsInRenderSRWith(l),l.visibilityObbInRenderSR=a.visibilityObbInRenderSR),a}_makeRefNode(e,t){const i=this._nodePages.get(0);if(t<-1)return this._makeClientRefNode(e,t);if(null==i)return-1;const s=i.nodes.length,n=new N(0,0,P(this._visibilityCacheVersion),e,null);return i.nodes.push(n),n.parent=t,e.invalidateServiceBVsInRenderSR(),s}_makeClientRefNode(e,t){const i=this._clientNodePage;if(null==i)return-1;if(t>=0)throw new Error("I3SIndex::client side nodes can not be made children of service side nodes.");const s=-(i.nodes.length+1),n=new N(0,0,P(this._visibilityCacheVersion),e,null);return i.nodes.push(n),n.parent=t,e.invalidateServiceBVsInRenderSR(),s}_linkChildToParentNode(e,t){const i=this._clientNodePage;if(null==i||e>=0)return;const s=E(e,this._pageSize),n=E(t,this._pageSize),o=i.nodes[s],r=o.childOffset;i.children.splice(o.childOffset+o.childCount,0,t);const a=1;o.childCount+=a,null!=o.node&&(o.node.childCount+=a);for(const l of i.nodes)l.childOffset>r&&(l.childOffset+=a);i.nodes[n].parent=e,this._updateParentBoundingInformation(e)}_destroyClientRefNode(e,t,i){const s=this._clientNodePage;if(null==s)return;const n=this.getParentIndex(e);if(null==n)return;const o=new Set,r=new Map,a=e=>{const i=E(e,this._pageSize),n=s.nodes[i];if(n.childCount>0)for(let t=n.childOffset;t<n.childOffset+n.childCount;++t)a(s.children[t]);const r=n.node?.id??n.ref?.id;if(null==r)throw new Error("Node has no id");t(r,e),o.add(n)};a(e);const l=s.nodes,d=s.children,h=s.nodes.map(()=>-1),u=[],c=[];for(let g=0;g<l.length;++g){const e=l[g];if(o.has(e))continue;const t=u.length,s=M(g,-1,this._pageSize),n=M(t,-1,this._pageSize);if(e.node&&(e.node.index=n),h[g]=n,u.push(e),s!==n){const t=e.node?.id??e.ref?.id;if(null==t)throw new Error("Node has no id");i(t,s,n),r.set(s,n)}}for(let g=0;g<u.length;++g){const e=M(g,-1,this._pageSize),t=u[g],i=c.length;for(let s=t.childOffset;s<t.childOffset+t.childCount;++s){const t=d[s];if(t>=0)c.push(t);else{const i=E(t,this._pageSize),s=l[i];if(o.has(s))continue;const n=h[i];c.push(n),s.parent=e}}t.childOffset=i,t.childCount=c.length-i,t.node&&(t.node.childCount=t.childCount)}s.nodes=u,s.children=c,this._updateParentBoundingInformation(h[E(n,this._pageSize)])}_updateParentBoundingInformation(e){let t=e;do{let e=null;const s=this._clientNodeLoader.indexSR,a=this._clientNodeLoader.renderSR,l=this._getNodeInternal(t);if(null==l)return;for(let o=0;o<l.childCount;o++){const l=this.getChildIndex(t,o),d=this._getNodeInternal(l),h=null!=d?d.ref||d.node:null;if(null!=h&&h.serviceMbsInIndexSR[3]>0)if(null==e)e=n(h.serviceMbsInIndexSR,D);else{const t=z,n=k,o=T;i(h.serviceMbsInIndexSR,s,t,a),i(e,s,n,a),r(t,n,o),i(o,a,e,s)}}const d=t=>{null!=t&&(t.serviceObbInIndexSR=null,null!=e?(t.serviceMbsInIndexSR??=o(),n(e,t.serviceMbsInIndexSR)):g(t.serviceMbsInIndexSR),t.invalidateServiceBVsInRenderSR(),t.geometryObbInRenderSR=null)};d(l.ref),d(l.node),this.invalidateNodeVisibilityCacheInternal(l),t=this.getParentIndex(t)}while(null!=t)}populateChildren(e,t){const i=this._getNodeInternal(e),s=this._getPage(e);i.childOffset=s.children.length,i.childCount=t.length;for(let n=0;n<t.length;n++){const i=this._makeRefNode(t[n],e);s.children.push(i)}}getNode(e){const t=this._getNodeInternal(e);return null!=t?t.node:null}getIndexById(e){let t;return this._forAllNodes((i,s)=>{(null!=i.node&&i.node.id===e||null!=i.ref&&i.ref.id===e)&&(t=s)}),t}getNodeById(e){const t=this.getIndexById(e);return null!=t&&t>=0?this.getNode(t):null}getChildIndex(e,t){const i=this._getPage(e);if(null==i)return-1;const s=i.nodes[E(e,this._pageSize)];return i.children[s.childOffset+t]}getParentIndex(e){const t=this._getPage(e);return null!=t&&e!==this._rootIndex?t.nodes[E(e,this._pageSize)]?.parent:null}getParent(e){const t=this.getParentIndex(e);return null!=t?this.getNode(t):null}isLeaf(e){const t=this._getNodeInternal(e);return null!=t&&0===t.childCount}get rootNode(){return this.getNode(this._rootIndex)}get isEditable(){return this._isEditable}removeAllGeometryObbs(){this._forAllNodes(e=>{null!=e.node&&(e.node.geometryObbInRenderSR=null)})}invalidateVisibilityCache(){this._visibilityCacheVersion=x(this._visibilityCacheVersion)}invalidateNodeVisibilityCache(e){const t=this._getNodeInternal(e);null!=t&&this.invalidateNodeVisibilityCacheInternal(t)}invalidateNodeVisibilityCacheInternal(e){e.visibilityCache=P(this._visibilityCacheVersion)}invalidateBoundingVolumeCache(e){const t=this._getNodeInternal(e);null!=t&&(t?.invalidateBounds(),this.invalidateNodeVisibilityCacheInternal(t))}updateElevationChanged(e){const t=this._getNodeInternal(e);if(null==t)return;if(!this.needNodeElevationRange)return void this.invalidateBoundingVolumeCache(e);const i=null!=t.node?t.node:t.ref;null!=i&&i.invalidateElevationRange()}invalidateGeometryVisibility(e){const t=this._getNodeInternal(e),i=t?.node;i&&(i.geometryObbInRenderSR=null,i.invalidateServiceBVsInRenderSR())}invalidateVisibilityObbs(){null!=this.rootNode&&this.traverse(this.rootNode,e=>(e.visibilityObbInRenderSR=this._computeVisibilityObb(e),e.geometryObbInRenderSR=null,!0))}_isElevationRangeUpToDate(e){if(!this.needNodeElevationRange)return!0;const t=e?.node??e?.ref;return!t||t.elevationRangeValid}updateElevationRange(e){this._updateElevationRangeInternal(e,null)}_updateElevationRangeInternal(e,t){const i=this._getNodeInternal(e);if(!i)return!1;const s=i?.node??i?.ref;if(!s)return!1;if(s.elevationRangeValid)return t?.expandElevationRange(s),!0;const n=new m;let o=!1;for(let l=0;l<i.childCount;l++){const t=this.getChildIndex(e,l),i=this._updateElevationRangeInternal(t,n);o=o||!i}if(0===i.childCount||o){const e=!i.node?.resources.isEmpty;this._viewportQueries.expandElevationRange(s,e,n)}const r=s.elevationRangeMin,a=s.elevationRangeMax;return r===n.elevationRangeMin&&a===n.elevationRangeMax?(t?.expandElevationRange(s),!0):(i.node?.setElevationRange(n),i.ref?.setElevationRange(n),this.invalidateBoundingVolumeCache(e),t?.expandElevationRange(s),!0)}isNodeVisible(e){const t=this._getNodeInternal(e);if(null==t)return!0;const i=t.ref;if(null!=i&&!i.serviceMbsInIndexSR)return!0;if(this._isElevationRangeUpToDate(t)&&R(t.visibilityCache,this._visibilityCacheVersion))return C(t.visibilityCache);const s=t.node,n=this._viewportQueries;if(s){const e=n.ensureElevationAgnosticBoundingVolume(s),i=n.isElevationAgnosticBoundingVolumeVisible(e);let o=i;if(this.needNodeElevationRange&&i){const t=n.getNodeObbInRenderSRIndependentOfElevationOffset(s);null!=t&&(o=n.isObbVisibleIndependentOfElevation(e,t))}if(!o)return t.visibilityCache=S(!1,this._visibilityCacheVersion),!1}if(this._layerHasFilter&&this._computeNodeFiltering&&(null!=s||null!=i)&&t.filterImpact===h.NotChecked){const e=null!=s?s.serviceMbsInIndexSR:null!=i?i.serviceMbsInIndexSR:null;t.filterImpact=null!=e?this._computeNodeFiltering(e):h.Unmodified}const o=null!=s&&t.filterImpact===h.Culled;let r=!(null!=s&&s.imModificationImpact===u.Culled)&&!o;if(r){const t=!s||i&&!s.visibilityObbInRenderSR?i??null:s;if(null!=t){this.needNodeElevationRange&&this.updateElevationRange(e);r=n.isNodeVisible(t)}}return t.visibilityCache=S(r,this._visibilityCacheVersion),r}isGeometryVisible(e){if(!this.isNodeVisible(e))return!1;const t=this._getNodeInternal(e);return!!(null==t?.node?.geometryObbInRenderSR||this.layerHasModifications&&t.node.imModificationImpact===u.NotChecked)||this._viewportQueries.isGeometryVisible(t.node)}_traverseCoverage(e,t,i,s,n){const o=this._getPage(e);if(null==o||0===t.childCount)return;const r=t.childOffset+t.childCount,a=new Array;for(let l=t.childOffset;l<r;++l){const e=o.children[l],t=this._getNodeInternal(e);null!=t?.node&&this.isGeometryVisible(e)&&a.push(t)}s/=a.length;for(const l of a){const e=l.node.index;this._isLoaded(e)||this._isReloading(e)?(n.delta=Math.max(n.delta,i),n.coverage+=s):this._traverseCoverage(e,l,i+1,s,n)}}useNodeAsHole(e){if("off"===this.holeFilling)return!1;const t=this._getNodeInternal(e);if(null==t)return!1;if("always"===this.holeFilling)return!0;if(R(t.useAsHole,this._version))return C(t.useAsHole);const i={delta:0,coverage:0};this._traverseCoverage(e,t,0,1,i);const s=i.delta*i.coverage<=.5;return t.useAsHole=S(s,this._version),s}get maxLevel(){return this._maxLevel}get dirty(){return this._dirty}destroy(){this._updates.destroy(),this._nodePages.clear(),this._clientNodePage=null,this._layer=null,this._missingPagesAndNodes.prune(),this._prefetchNodes.prune(),this._imModificationUncategorized.prune()}requestUpdate(){this._dirty=!0,this._indexMissing=1,this._version=x(this._version)}imModificationsChanged(e){this.layerHasModifications=e,this._forAllNodes(({node:e})=>{null!=e&&(e.imModificationImpact=u.NotChecked,e.visibilityObbInRenderSR=this._computeVisibilityObb(e),e.hasModifications&&this.invalidateGeometryVisibility(e.index))}),this.invalidateVisibilityCache()}layerFilterChanged(e){this._layerHasFilter=e,this._forAllNodes(e=>{if(null!=e){e.filterImpact=h.NotChecked;const t=e.node;null!=t&&this.invalidateNodeVisibilityCache(t.index)}}),this.invalidateVisibilityCache()}update(e,t,i){if(!this._dirty)return;this._pageQueue.length>0&&this._addQueuedPages(t),this._invalidateElevationRangeForNewPages(t),this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.NEGATIVE_INFINITY,this._missingPagesAndNodes.clear(),this._prefetchNodes.clear(),this._updates.reset(e),I.clear();let s=!0;const n=new A,o=new L,r=this._imModificationUncategorized;r.clear();const a=new Set;let l=0;const d=(a,d,h)=>{const c=w(a,this._pageSize);if(null==d){let e=this._entryPriority(a);return e===1/0&&(e=this._entryPriority(h)),I.set(c,Math.max(e,I.get(c)||0)),this._loadingPages.has(c)||this._failedPages.has(c)||(this._missingPagesAndNodes.push(c),++l),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const g=d.node;if(this._updateNodeFeatureEstimate(g,o),null==g){const e=this._entryPriority(a);return this._loadingNodes.has(a)||this._failedNodes.has(a)||(this._missingPagesAndNodes.push(a),I.set(a,e)),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const _=this._getPage(a);if(0===this._missingPagesAndNodes.length&&!this._useNodePages)for(let e=0;e<d.childCount;e++){const t=_.children[d.childOffset+e],i=this._getNodeInternal(t);null!=i&&!i.node&&!this._loadingNodes.has(t)&&!this._failedNodes.has(t)&&t>=0&&(I.set(t,this._entryPriority(t)),this._prefetchNodes.push(t))}if(g.failed||g.resources.isEmpty)return void(s&&d.childCount>0&&this._isSelected(g)&&(s=!1));if(this._isLoaded(a)){if(n.known+=g.memory,++n.knownNodes,this._isSelected(g)?d.childCount>0&&(s=!1):(n.unremoved+=g.memory,s=!1),this._needsUpdate(g)){const e=this._entryPriority(a);I.set(a,e),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e),this._updates.update.push(a)}return}if(g.memory&&(n.known+=g.memory,++n.knownNodes),!this._isSelected(g))return void(this._isReloading(a)&&this._updates.remove.push(a));if(d.childCount>0&&(s=!1),g.memory?(n.missing+=g.memory,n.known+=g.memory,++n.knownNodes):++n.missingNodes,e.includes(g.index))return this._maxProcessingPrio=Math.max(this._maxProcessingPrio,this._entryPriority(a)),void(this._updates.cancel=this._updates.cancel.filter(e=>e!==g.index));if(!t.done&&this._enable(g))return void t.madeProgress();const f=this._entryPriority(a);I.set(a,f),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,f),this._updates.add.push(a),this.layerHasModifications&&i&&null!=g&&g.imModificationImpact===u.NotChecked&&r.push(a)};this.traverseVisible(d,a),this._frameNumber++,this._missingPagesAndNodes.sort((e,t)=>e-t),this._missingPagesAndNodes.filterInPlace((e,t)=>t<1||this._missingPagesAndNodes.data[t-1]!==e),this._missingPagesAndNodes.sort((e,t)=>I.get(e)-I.get(t)),this._missingPagesAndNodes.length>0&&(this._maxUnloadedPrio=I.get(this._missingPagesAndNodes.back()),this._prefetchNodes.clear()),this._removeUnusedNodePages(a,l);const h=this._updates.add;h.length>0&&this.layerHasModifications&&(r.length>0&&i?.(r),h.filterInPlace(e=>{const t=this._getNodeInternal(e),i=null==t?.node||t.node.imModificationImpact!==u.Culled;return i||this.invalidateNodeVisibilityCache(e),i})),this._unloadedMemoryEstimate=n.missing-n.unremoved,n.knownNodes>3&&n.missingNodes>0&&(this._unloadedMemoryEstimate+=n.known/n.knownNodes*n.missingNodes),this._unloadedMemoryEstimate=.8*Math.max(0,this._unloadedMemoryEstimate),this._featureEstimate.estimate=this._computeFeatureEstimate(o),this._featureEstimate.leavesReached=s,this._updates.add.filterInPlace(e=>I.get(e)>=this._maxUnloadedPrio).sort((e,t)=>I.get(e)-I.get(t)),this._updates.update.sort((e,t)=>I.get(e)-I.get(t)),this._indexMissing=this._loadingPages.size+this._loadingNodes.size+this._missingPagesAndNodes.length,this._dirty=this._indexMissing>0,I.clear()}checkFeatureTarget(e,t){const i=this._viewportQueries.updateScreenSpaceErrorBias(t);let s=t,n=t,o=i,r=10;for(;r--;){const i=new L;this._updateFeatureEstimate(s,i);if(this._computeFeatureEstimate(i)<=e){if(s>=t||i.missingNodes>0||0===r)break;o=s,s=.5*(s+n)}else n=s,s=.5*(s+o)}return this._version=x(this._version),this._viewportQueries.updateScreenSpaceErrorBias(i),Math.min(t,s)}_removeUnusedNodePages(e,t){if(!this._useNodePages)return;const i=e.size,s=this._nodePages,n=s.size+this._loadingPages.size+t;if(n>B&&n>i){const t=new Array;for(const[i,n]of s)0!==n.numNodesWithLoadedChildren||e.has(i)||t.push([n.lastTraversed,i]);t.sort((e,t)=>e[0]-t[0]).some(e=>{const t=e[1];return this._deleteNodePage(t),s.size<=B})}}_updateFeatureEstimate(e,t){this._version=x(this._version),this._viewportQueries.updateScreenSpaceErrorBias(e),this.traverseVisible((e,i)=>this._updateNodeFeatureEstimate(i?.node,t))}_updateNodeFeatureEstimate(e,t){null!=e&&!e.failed&&this._isSelected(e)&&(null!=e.numFeatures?(t.numFeatures+=e.numFeatures,++t.knownNodes):++t.missingNodes)}_computeFeatureEstimate(e){let t=e.numFeatures;return e.knownNodes>3&&e.missingNodes>0&&(t+=e.numFeatures/e.knownNodes*e.missingNodes),Math.max(0,t)}load(){return this._load(this._missingPagesAndNodes)}prefetch(){return this._prefetchNodes.sort((e,t)=>I.get(e)-I.get(t)),this._load(this._prefetchNodes)}_load(e){if(0===e.length||!this._canRequest())return!1;for(;e.length>0&&this._canRequest();){const t=e.pop();this._useNodePages&&t>=0?this._loadPage(t):this._loadNode(t)}return!0}get isLoading(){return this._indexMissing>0}get isPrefetching(){return this._prefetchNodes.length>0}get indexLoading(){return this._loadingPages.size+this._loadingNodes.size}get indexMissing(){return this._indexMissing}get unloadedMemoryEstimate(){return this._unloadedMemoryEstimate}get updates(){return this._updates}get featureEstimate(){return this._featureEstimate}get maxPriority(){return Math.max(this._maxProcessingPrio,this._maxUnloadedPrio)}nodeTraversalState(e){if(null==e)return null;const t=e.index,i=this._getNodeInternal(t);if(!i)return null;let s=i?.traversalState;if(s&&R(s.version,this._version))return s;const n=this._viewportQueries.getLodLevel(e),o=this._viewportQueries.hasLOD(e);let r=!0;if(o){const e=this.getParentIndex(t);if(null!=e){const t=this._getNodeInternal(e),i=t?.traversalState;r=!!i&&n>i.lodLevel}else r=n>0}else r=0===e.childCount;return s?(s.lodLevel=n,s.isChosen=r,s.version=S(!0,this._version),s):(s=new c(o,r,n,S(!0,this._version)),i.traversalState=s,s)}async _loadNode(e){this._loadingNodes.add(e);const i=this._getNodeInternal(e).ref;if(null==i)return void this._failedNodes.add(e);const s=i.id,n=this._urlPrefix+s,o=()=>{this._loadingNodes.delete(e),0===this._missingPagesAndNodes.length&&0===this._loadingNodes.size&&this.requestUpdate()};let r=null;try{r=e>=0?await this._streamDataController.request(n,"json"):await this._clientNodeLoader.loadNodeJSON(s)}catch(d){return o(),void(t(d)||(this._logger.error("#loadNode()",this._layer,"Error loading node: "+n),this._failedNodes.add(e)))}o();const a=this._validateNode(s,r);if(null==a)return;a.obb&&this.invalidateNodeVisibilityCache(e);const l=this._addNode(a,e);this.nodeTraversalState(l)}_validateNode(e,t){if(null==t||"object"!=typeof t||t.id!==e)return this._logger.error("#validateNode()",this._layer,`Invalid node. Wrong type or wrong id "${e}"`),null;if(!Array.isArray(t.mbs))return this._logger.error("#validateNode()",this._layer,`Invalid bounding volume on node ${e}.`),null;t.sharedResource&&"./shared"!==t.sharedResource.href&&"./shared/"!==t.sharedResource.href&&this._logger.warn("#validateNode()",this._layer,`Invalid shared resource href on node "${e}"`);const i=t.geometryData;null==i||Array.isArray(i)&&0===i.length||Array.isArray(i)&&1===i.length&&"./geometries/0"===i[0].href||this._logger.warn("#validateNode()",this._layer,`Invalid geometry data on node "${e}"`);const s=t.attributeData,n=this._layer.attributeStorageInfo;null==s||Array.isArray(s)&&!s.some((e,t)=>e.href!==`./attributes/${n?.[t]?.key??`f_${t}`}/0`)||this._logger.warn("#validateNode()",this._layer,`Invalid attribute data on node "${e}"`),t.featureData&&t.featureData.length>1&&this._logger.warn("#validateNode()",this._layer,`Node ${e} has ${t.featureData.length} bundles. Only the first bundle will be loaded.`);const o=t.hasOwnProperty("obb")&&!this.ignoreServiceObb?t.obb:void 0,r=t.featureData&&1===t.featureData.length&&t.featureData[0].featureRange?t.featureData[0].featureRange[1]-t.featureData[0].featureRange[0]+1:void 0,a=t=>{if(null==t)return null;const i=t=>this._logger.error("#validateNode()",this._layer,`Invalid node reference on node ${e}: ${t}`);if("number"==typeof t.id)i(`id ${t.id} is a number instead of a string.`);else if("string"!=typeof t.id||!Array.isArray(t.mbs))return i("Missing or invalid id."),null;if(!Array.isArray(t.mbs))return i(`Invalid bounding volume on reference ${t.id}.`),null;t.href&&t.href!=="../"+t.id&&this._logger.error("#validateNode()",this._layer,`Invalid node href on node "${e}"`);const s=new l(`${t.id}`,t.mbs);return s.serviceObbInIndexSR=!this.ignoreServiceObb&&t.hasOwnProperty("obb")&&t.obb?v.fromJSON(t.obb):null,s.visibilityObbInRenderSR=this._computeVisibilityObb(s),s},d=Array.isArray(t.children)?t.children.map(a).filter(e=>null!=e):null,h=t.featureData?.length??!1,u=!0===t.isEmpty;return new f(e,t.mbs,o,"string"==typeof t.version?t.version:null,{isEmpty:!h&&u,hasSharedResource:null!=t.sharedResource,attributes:t.attributeData?e:void 0,texture:t.textureData&&t.textureData.length>0?e:void 0,geometry:null!=t.geometryData?e:void 0},d,Array.isArray(t.lodSelection)?t.lodSelection:null,r)}resetFailedNodes(){this._failedNodes.clear(),this._failedPages.clear(),this._forAllNodes(e=>{null!=e.node&&(e.node.failed=!1)})}_entryPriority(e){const t=this._getNodeInternal(e),i=this.getParentIndex(e);if(null==t||null==i&&null==t.node)return null==i?1/0:this._entryPriority(i);let s=0;if(t.node&&null!=i){const e=this._getNodeInternal(i).traversalState;null!=e&&(s=e.lodLevel)}let n=this.progressiveLoadPenalty;for(let r=e;null!=r;r=this.getParentIndex(r))if(this._isLoaded(r)){n=0;break}const o=null!=t.ref?this._viewportQueries.distToPOI(t.ref):null!=t.node?this._viewportQueries.distToPOI(t.node):0;return-o-s*(o+this.progressiveLoadPenalty)+n}traverseVisible(e,t){const i=this._getNodeInternal(this._rootIndex);null!=i?this._traverseVisible(this._rootIndex,null,i,e,t):e(this._rootIndex,null,null)}_traverseVisible(e,t,i,s,n){const o=w(e,this._pageSize);if(n&&n.add(o),i.node&&0===i.childCount)return void(this.isGeometryVisible(e)&&s(e,i,t));if(!this.isNodeVisible(e))return;if(s(e,i,t),null==i.node)return;const r=this.nodeTraversalState(i.node);if(r?.nodeHasLOD&&r.lodLevel===this._maxLodLevel)return;const a=this._getPageFromPageIndex(o);for(let l=0;l<i.childCount;l++){const t=a.children[i.childOffset+l],o=this._getNodeInternal(t);if(o)this._traverseVisible(t,e,o,s,n);else{if(n){const e=w(t,this._pageSize);n.add(e)}s(t,null,e)}}}traverse(e,t){t(e)&&this.traverseDescendants(e,t)}traverseDescendants(e,t){++this._traverseDescendantsNestingLevel;const i=e.index,s=this._pageSize,n=w(i,s),o=this._getPageFromPageIndex(n);if(null==o)return;const r=this._frameNumber,a=this._nodePages,l=E(i,s),d=o.nodes[l],h=d.childCount;if(o.lastTraversed=r,0===h)return;const u=new Array,c=1===this._traverseDescendantsNestingLevel?this._traverseDescendantsQueue:[0];let g=0;{const{childOffset:e,childCount:t}=d,{children:i}=o;c.length=2**Math.ceil(Math.log2(g+t));for(let s=e;s<e+t;++s){const e=i[s];e>=0?(c[g]=e,++g):u.push(e)}}if(u.length>0){const e=this._clientNodePage;if(e){const i=e.children;let s=0;for(;s<u.length;){const n=u[s];++s;const o=-n-1,r=e.nodes[o],a=r.node;if(!a||!t(a))continue;const{childCount:l}=r;if(0===l)continue;const{childOffset:d}=r,h=d+l;for(let e=d;e<h;++e)u.push(i[e])}}}if(g>0){let e=0;if(s>0){let i=n*s,l=o,d=l.nodes;for(;e<g;){const n=c[e];let o;if(++e,i<=n&&n<i+s)o=l;else{const e=n/s|0,t=a.get(e);if(void 0===t)continue;o=t,o.lastTraversed=r,l=o,d=l.nodes,i=s*e}const h=d[n-i],u=h.node;if(null==u||!1===t(u))continue;const{childCount:_}=h;if(0===_)continue;const f=g+_;for(c.length<f&&(c.length=2**Math.ceil(Math.log2(g+_)));c.length<g+_;)c.length+=c.length;const m=o.children,{childOffset:v}=h,N=v+_;for(let e=v;e<N;++e)c[g]=m[e],++g}}else{const i=a.get(0);if(i)for(;e<g;){const s=c[e++],n=i.nodes[s],o=n.node;if(!o||!t(o))continue;const{childCount:r}=n;if(0===r)continue;c.length=Math.max(c.length,2**Math.ceil(Math.log2(g+r)));const a=i.children,{childOffset:l}=n,d=l+r;for(let e=l;e<d;++e)c[g]=a[e],++g}}}--this._traverseDescendantsNestingLevel}updateChildrenLoaded(e,t){let i=this.getNode(e);for(;null!=i;){const e=i.childrenLoaded,s=e+t;i.childrenLoaded=s;const n=0===e?1:0===s?-1:0,o=i.index;if(0!==n){this._getPage(o).numNodesWithLoadedChildren+=n}i=this.getParent(o)}}checkChildrenLoadedInvariant(){return!0}updateElevationInfo(e,t){this.needNodeElevationRange=t&&!!e&&("relative-to-ground"===e.mode||"relative-to-scene"===e.mode||"on-the-ground"===e.mode),this._viewportQueries.updateElevationInfo(e),this.invalidateAllElevationRanges()}invalidateAllElevationRanges(){this._forAllNodes(e=>{e?.invalidateBounds(),e.node?.invalidateElevationRange(),e.ref?.invalidateElevationRange()})}_forAllNodes(e){if(null!=this._clientNodePage){const t=this._clientNodePage;for(let i=0;i<t.nodes.length;i++)e(t.nodes[i],-(i+1))}for(const[t,i]of this._nodePages){const s=t*this._pageSize;for(let t=0;t<i.nodes.length;t++)e(i.nodes[t],s+t)}}clearCaches(){if(this._useNodePages){const e=this._nodePages,t=new Set;this.traverseVisible(e=>t.add(w(e,this._pageSize)));for(const[i,s]of e)if(0!==s.numNodesWithLoadedChildren||t.has(i))for(const e of s.nodes)e.traversalState=null;else this._deleteNodePage(i)}}_deleteNodePage(e){this._nodePages.delete(e)}get test(){}}const I=new Map;class y{constructor(t){this.missing=t,this.update=new e({deallocator:null}),this.add=new e({deallocator:null}),this.remove=new e({deallocator:null}),this.cancel=[]}destroy(){this.update.prune(),this.add.prune(),this.remove.prune(),this.cancel.length=0}reset(e){this.add.clear(),this.update.clear(),this.cancel=e}}function P(e){return _(e,-2)}function x(e){return _(e,2)}function S(e,t){return t+(e?1:0)}function R(e,t){return(-2&e)===t}function C(e){return!(1&~e)}function w(e,t){return e<0?-1:t>0?e/t|0:0}function E(e,t){return e<0?-e-1:0===t?e:e%t}function M(e,t,i){return-1===t?-(e+1):0===i?e:t*i+e}const V=[["maxScreenThreshold",a.MaxScreenThreshold],["screenSpaceRelative",a.ScreenSpaceRelative],["removedFeatureDiameter",a.RemovedFeatureDiameter],["distanceRangeFromDefaultCamera",a.DistanceRangeFromDefaultCamera]];function O(e){if(e)for(let t=0;t<e.length;t++)for(const i of V)if(i[0]===e[t].metricType)return{lodMetric:i[1],maxError:e[t].maxError};return{lodMetric:a.None,maxError:0}}class A{constructor(){this.known=0,this.knownNodes=0,this.missing=0,this.missingNodes=0,this.unremoved=0}}class L{constructor(){this.numFeatures=0,this.knownNodes=0,this.missingNodes=0}}function F(e){return Math.sqrt(e*(4/Math.PI))}const D=o(),z=o(),k=o(),T=o(),B=has("esri-mobile")?100:300;export{b as I3SIndex,O as selectErrorMetric};
|
|
5
|
+
import has from"../../../../core/has.js";import e from"../../../../core/PooledArray.js";import{isAbortError as t}from"../../../../core/promiseUtils.js";import{projectBoundingSphere as i}from"../../../../geometry/projection/projectBoundingSphere.js";import{l as s,h as n,c as o,u as r}from"../../../../chunks/sphere.js";import{DocType as a}from"../../support/index.js";import{LodMetric as l,NodeBase as d,Node as h,NodeFilterImpact as u,NodeIMModificationImpact as c,NodeTraversalState as g}from"./I3SNode.js";import{invalidateMbs as _,addWraparound as f}from"./I3SUtil.js";import{ValidatedNode as m}from"./ValidatedNode.js";import{ElevationRange as v}from"../../support/ElevationRange.js";import{Obb as N}from"../../support/orientedBoundingBox.js";class p{constructor(e,t,i,s,n){this.childOffset=e,this.childCount=t,this.visibilityCache=i,this.ref=s,this.node=n,this.useAsHole=0,this.filterImpact=u.NotChecked,this.traversalState=null,this.parent=-1}invalidateBounds(){this.node?.invalidateServiceBVsInRenderSR(),this.ref?.invalidateServiceBVsInRenderSR()}}class b{constructor(e=new Array,t=new Array){this.nodes=e,this.children=t,this.lastTraversed=0,this.numNodesWithLoadedChildren=0}}class I{get _useNodePages(){return this._pageSize>0}constructor(t,i,s,n,o,r,a,d,h,u,c,g,_,f,m,v){this.viewingMode=t,this._layer=i,this._streamDataController=n,this._clientNodeLoader=o,this._viewportQueries=r,this._logger=a,this.holeFilling=d,this._isLoaded=h,this._isReloading=u,this._isSelected=c,this._enable=g,this._needsUpdate=_,this._canRequest=f,this._computeVisibilityObb=m,this._computeNodeFiltering=v,this._dirty=!0,this._nodePages=new Map,this._clientNodePage=null,this._pageSize=0,this._rootIndex=0,this._lodMetric=l.None,this._lodConversion=e=>e,this._isEditable=!1,this._urlPrefix="",this._loadingNodes=new Set,this._loadingPages=new Set,this._failedNodes=new Set,this._failedPages=new Set,this._indexMissing=1,this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.POSITIVE_INFINITY,this._version=S(0),this._visibilityCacheVersion=S(0),this._maxLevel=1,this._featureEstimate={estimate:0,leavesReached:!1},this._unloadedMemoryEstimate=0,this._missingPagesAndNodes=new e({deallocator:null}),this._prefetchNodes=new e({deallocator:null}),this._updates=new P(this._missingPagesAndNodes),this._imModificationUncategorized=new e({deallocator:null}),this.ignoreServiceObb=!1,this.progressiveLoadPenalty=0,this._pageQueue=new Array,this._newPages=new Array,this.needNodeElevationRange=!1,this.layerHasModifications=!1,this._layerHasFilter=!1,this._frameNumber=0,this._traverseDescendantsQueue=[0],this._traverseDescendantsNestingLevel=0,this._isEditable=null!=i.associatedLayer?.infoFor3D,i.serviceUpdateTimeStamp?.lastUpdate&&(this._lastUpdate=`${i.serviceUpdateTimeStamp.lastUpdate}`),this._maxLodLevel=this._viewportQueries?this._viewportQueries.maxLodLevel:1,this._init(s)}_init(e){if("page"===e.type){const t=e.rootPage;switch(this._urlPrefix=e.urlPrefix,this._pageSize=e.pageSize,e.lodMetric){case"maxScreenThreshold":this._lodMetric=l.MaxScreenThreshold;break;case"maxScreenThresholdSQ":this._lodMetric=l.MaxScreenThreshold,this._lodConversion=D}if(this._isEditable){this._rootIndex=-1;const i=M(e.rootIndex,e.pageSize),s=t.nodes[i],n={nodes:[{index:this._rootIndex,children:[e.rootIndex],mesh:void 0,obb:s.obb,lodThreshold:s.lodThreshold}]};this._addPage(E(this._rootIndex,this._pageSize),n),this.getNode(-1).serviceObbInIndexSR=void 0}else this._rootIndex=e.rootIndex;this._addPage(E(e.rootIndex,this._pageSize),t),this._updateParentsAndLevel()}else if("node"===e.type){this._urlPrefix=e.urlPrefix;const t=new b;if(this._nodePages.set(0,t),this._isEditable){this._clientNodePage=new b;const t={id:"-1",version:null,mbs:e.rootNode.mbs,obb:e.rootNode.obb,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:[{id:"root",href:"../root",mbs:e.rootNode.mbs,obb:e.rootNode.obb}]};this._rootIndex=this._makeClientRefNode(new d(t.id,null),-1);const i=this._validateNode(t.id,t);i&&this._addNode(i,this._rootIndex)}else this._rootIndex=this._makeRefNode(new d(e.rootNode.id,null),-1);const i=this._validateNode(e.rootNode.id,e.rootNode);i&&this._addNode(i,0)}}addClientNodeToIndex(e,t){const i=-1,s=new d(e,t),n=this._makeClientRefNode(s,i);return this._linkChildToParentNode(i,n),this.requestUpdate(),n}removeClientNodeFromIndex(e,t,i){this._destroyClientRefNode(e,t,i),this.requestUpdate()}_loadPage(e){this._loadingPages.add(e);const i=this._urlPrefix+e;this._streamDataController.request(i,a.JSON).then(t=>{this._pageQueue.push({pageIndex:e,page:t})}).catch(i=>{this._loadingPages.delete(e),t(i)||(this._failedPages.add(e),this._logger.error("#loadPage()",this._layer,`Error when loading page ${e}`,i))})}_addQueuedPages(e){for(;this._pageQueue.length>0&&!e.done;){const{pageIndex:t,page:i}=this._pageQueue.shift();this._addPage(t,i),this._loadingPages.delete(t),e.madeProgress(),this.needNodeElevationRange&&this._newPages.push(t)}this._updateParentsAndLevel()}_invalidateElevationRangeForNewPages(e){if(this.needNodeElevationRange)for(;this._newPages.length>0&&!e.done;){const e=this._nodePages.get(this._newPages.shift());e?.nodes.forEach(e=>{let t=e.parent;for(;null!=t&&t!==this._rootIndex;){const e=this.getNode(t);e&&!Number.isNaN(e?.elevationRangeMin)&&(e.invalidateElevationRange(),this.invalidateBoundingVolumeCache(t)),t=this.getParentIndex(t)}})}}_addPage(e,t){const i=[],n=[],o=t.nodes.map((t,o)=>{const r=i.length,a=t.children?t.children.length:0;n.push(this._rootIndex);for(let e=0;e<a;e++)i.push(t.children[e]);const l=`${t.index}`,d=N.fromJSON(t.obb),u=s(d.center,d.radius),c=t.mesh?.attribute,g=t.mesh?.geometry,_=t.mesh?.material,f={hasSharedResource:!1,isEmpty:null==g,attributes:null!=c?.resource?`${c.resource}`:void 0,geometry:null!=g?.resource?`${g.resource}`:void 0,texture:null!=_?.resource?`${_.resource}`:void 0,geometryDefinition:g?g.definition:-1,materialDefinition:_?_.definition:-1},m=new h(l,O(o,e,this._pageSize),u,a,0,f,this._lastUpdate,this._lodMetric,this._lodConversion(t.lodThreshold),g?.featureCount??null);return m.serviceObbInIndexSR=d,m.visibilityObbInRenderSR=this._computeVisibilityObb(m),m.vertexCount=g?g.vertexCount:0,new p(r,a,x(this._visibilityCacheVersion),null,m)}),r=new b(o,i);-1===e?this._clientNodePage=r:this._nodePages.set(e,r)}_updateParentsAndLevel(){const e=new Array,t=(t,i,s)=>{const n=this._getPage(t);if(null!=n){const o=M(t,this._pageSize),r=n.nodes[o];r.parent=null!=i?i:-1;const a=r.node;null!=a&&(a.level=s,e.push(t))}};for(t(this._rootIndex,null,0);e.length;){const i=e.pop(),s=this.getNode(i);if(null!=s)for(let e=0;e<s.childCount;e++){t(this.getChildIndex(s.index,e),i,s.level+1),this._maxLevel=Math.max(this._maxLevel,s.level+1)}}}_getPage(e){const t=E(e,this._pageSize);return this._getPageFromPageIndex(t)}_getPageFromPageIndex(e){return e<0?this._clientNodePage:this._nodePages.get(e)}_getNodeInternal(e){const t=this._getPage(e);return null==t?null:(t.lastTraversed=this._frameNumber,t.nodes[M(e,this._pageSize)])}_addNode(e,t){e.children&&this.populateChildren(t,e.children);const i=this.getParent(t),s=null!=i?i.level+1:0;this._maxLevel=Math.max(this._maxLevel,e.children?s+1:s);const{lodMetric:n,maxError:o}=A(e.lodSelection),r=this._getNodeInternal(t),a=new h(e.id,t,e.mbs,r.childCount,s,e.resources,e.version,n,o,e.numFeatures);r.node=a,e.obb&&(a.serviceObbInIndexSR=N.fromJSON(e.obb)),a.visibilityObbInRenderSR=this._computeVisibilityObb(a);const l=r.ref;return null!=l&&(null==l.serviceMbsInIndexSR&&(l.serviceMbsInIndexSR=e.mbs),a.shareServiceBVsInRenderSRWith(l),l.visibilityObbInRenderSR=a.visibilityObbInRenderSR),a}_makeRefNode(e,t){const i=this._nodePages.get(0);if(t<-1)return this._makeClientRefNode(e,t);if(null==i)return-1;const s=i.nodes.length,n=new p(0,0,x(this._visibilityCacheVersion),e,null);return i.nodes.push(n),n.parent=t,e.invalidateServiceBVsInRenderSR(),s}_makeClientRefNode(e,t){const i=this._clientNodePage;if(null==i)return-1;if(t>=0)throw new Error("I3SIndex::client side nodes can not be made children of service side nodes.");const s=-(i.nodes.length+1),n=new p(0,0,x(this._visibilityCacheVersion),e,null);return i.nodes.push(n),n.parent=t,e.invalidateServiceBVsInRenderSR(),s}_linkChildToParentNode(e,t){const i=this._clientNodePage;if(null==i||e>=0)return;const s=M(e,this._pageSize),n=M(t,this._pageSize),o=i.nodes[s],r=o.childOffset;i.children.splice(o.childOffset+o.childCount,0,t);const a=1;o.childCount+=a,null!=o.node&&(o.node.childCount+=a);for(const l of i.nodes)l.childOffset>r&&(l.childOffset+=a);i.nodes[n].parent=e,this._updateParentBoundingInformation(e)}_destroyClientRefNode(e,t,i){const s=this._clientNodePage;if(null==s)return;const n=this.getParentIndex(e);if(null==n)return;const o=new Set,r=new Map,a=e=>{const i=M(e,this._pageSize),n=s.nodes[i];if(n.childCount>0)for(let t=n.childOffset;t<n.childOffset+n.childCount;++t)a(s.children[t]);const r=n.node?.id??n.ref?.id;if(null==r)throw new Error("Node has no id");t(r,e),o.add(n)};a(e);const l=s.nodes,d=s.children,h=s.nodes.map(()=>-1),u=[],c=[];for(let g=0;g<l.length;++g){const e=l[g];if(o.has(e))continue;const t=u.length,s=O(g,-1,this._pageSize),n=O(t,-1,this._pageSize);if(e.node&&(e.node.index=n),h[g]=n,u.push(e),s!==n){const t=e.node?.id??e.ref?.id;if(null==t)throw new Error("Node has no id");i(t,s,n),r.set(s,n)}}for(let g=0;g<u.length;++g){const e=O(g,-1,this._pageSize),t=u[g],i=c.length;for(let s=t.childOffset;s<t.childOffset+t.childCount;++s){const t=d[s];if(t>=0)c.push(t);else{const i=M(t,this._pageSize),s=l[i];if(o.has(s))continue;const n=h[i];c.push(n),s.parent=e}}t.childOffset=i,t.childCount=c.length-i,t.node&&(t.node.childCount=t.childCount)}s.nodes=u,s.children=c,this._updateParentBoundingInformation(h[M(n,this._pageSize)])}_updateParentBoundingInformation(e){let t=e;do{let e=null;const s=this._clientNodeLoader.indexSR,a=this._clientNodeLoader.renderSR,l=this._getNodeInternal(t);if(null==l)return;for(let o=0;o<l.childCount;o++){const l=this.getChildIndex(t,o),d=this._getNodeInternal(l),h=null!=d?d.ref||d.node:null;if(null!=h&&h.serviceMbsInIndexSR[3]>0)if(null==e)e=n(h.serviceMbsInIndexSR,z);else{const t=k,n=T,o=B;i(h.serviceMbsInIndexSR,s,t,a),i(e,s,n,a),r(t,n,o),i(o,a,e,s)}}const d=t=>{null!=t&&(t.serviceObbInIndexSR=null,null!=e?(t.serviceMbsInIndexSR??=o(),n(e,t.serviceMbsInIndexSR)):_(t.serviceMbsInIndexSR),t.invalidateServiceBVsInRenderSR(),t.geometryObbInRenderSR=null)};d(l.ref),d(l.node),this.invalidateNodeVisibilityCacheInternal(l),t=this.getParentIndex(t)}while(null!=t)}populateChildren(e,t){const i=this._getNodeInternal(e),s=this._getPage(e);i.childOffset=s.children.length,i.childCount=t.length;for(let n=0;n<t.length;n++){const i=this._makeRefNode(t[n],e);s.children.push(i)}}getNode(e){const t=this._getNodeInternal(e);return null!=t?t.node:null}getIndexById(e){let t;return this._forAllNodes((i,s)=>{(null!=i.node&&i.node.id===e||null!=i.ref&&i.ref.id===e)&&(t=s)}),t}getNodeById(e){const t=this.getIndexById(e);return null!=t&&t>=0?this.getNode(t):null}getChildIndex(e,t){const i=this._getPage(e);if(null==i)return-1;const s=i.nodes[M(e,this._pageSize)];return i.children[s.childOffset+t]}getParentIndex(e){const t=this._getPage(e);return null!=t&&e!==this._rootIndex?t.nodes[M(e,this._pageSize)]?.parent:null}getParent(e){const t=this.getParentIndex(e);return null!=t?this.getNode(t):null}isLeaf(e){const t=this._getNodeInternal(e);return null!=t&&0===t.childCount}get rootNode(){return this.getNode(this._rootIndex)}get isEditable(){return this._isEditable}removeAllGeometryObbs(){this._forAllNodes(e=>{null!=e.node&&(e.node.geometryObbInRenderSR=null)})}invalidateVisibilityCache(){this._visibilityCacheVersion=S(this._visibilityCacheVersion)}invalidateNodeVisibilityCache(e){const t=this._getNodeInternal(e);null!=t&&this.invalidateNodeVisibilityCacheInternal(t)}invalidateNodeVisibilityCacheInternal(e){e.visibilityCache=x(this._visibilityCacheVersion)}invalidateBoundingVolumeCache(e){const t=this._getNodeInternal(e);null!=t&&(t?.invalidateBounds(),this.invalidateNodeVisibilityCacheInternal(t))}updateElevationChanged(e){const t=this._getNodeInternal(e);if(null==t)return;if(!this.needNodeElevationRange)return void this.invalidateBoundingVolumeCache(e);const i=null!=t.node?t.node:t.ref;null!=i&&i.invalidateElevationRange()}invalidateGeometryVisibility(e){const t=this._getNodeInternal(e),i=t?.node;i&&(i.geometryObbInRenderSR=null,i.invalidateServiceBVsInRenderSR())}invalidateVisibilityObbs(){null!=this.rootNode&&this.traverse(this.rootNode,e=>(e.visibilityObbInRenderSR=this._computeVisibilityObb(e),e.geometryObbInRenderSR=null,!0))}_isElevationRangeUpToDate(e){if(!this.needNodeElevationRange)return!0;const t=e?.node??e?.ref;return!t||t.elevationRangeValid}updateElevationRange(e){this._updateElevationRangeInternal(e,null)}_updateElevationRangeInternal(e,t){const i=this._getNodeInternal(e);if(!i)return!1;const s=i?.node??i?.ref;if(!s)return!1;if(s.elevationRangeValid)return t?.expandElevationRange(s),!0;const n=new v;let o=!1;for(let l=0;l<i.childCount;l++){const t=this.getChildIndex(e,l),i=this._updateElevationRangeInternal(t,n);o=o||!i}if(0===i.childCount||o){const e=!i.node?.resources.isEmpty;this._viewportQueries.expandElevationRange(s,e,n)}const r=s.elevationRangeMin,a=s.elevationRangeMax;return r===n.elevationRangeMin&&a===n.elevationRangeMax?(t?.expandElevationRange(s),!0):(i.node?.setElevationRange(n),i.ref?.setElevationRange(n),this.invalidateBoundingVolumeCache(e),t?.expandElevationRange(s),!0)}isNodeVisible(e){const t=this._getNodeInternal(e);if(null==t)return!0;const i=t.ref;if(null!=i&&!i.serviceMbsInIndexSR)return!0;if(this._isElevationRangeUpToDate(t)&&C(t.visibilityCache,this._visibilityCacheVersion))return w(t.visibilityCache);const s=t.node,n=this._viewportQueries;if(s){const e=n.ensureElevationAgnosticBoundingVolume(s),i=n.isElevationAgnosticBoundingVolumeVisible(e);let o=i;if(this.needNodeElevationRange&&i){const t=n.getNodeObbInRenderSRIndependentOfElevationOffset(s);null!=t&&(o=n.isObbVisibleIndependentOfElevation(e,t))}if(!o)return t.visibilityCache=R(!1,this._visibilityCacheVersion),!1}if(this._layerHasFilter&&this._computeNodeFiltering&&(null!=s||null!=i)&&t.filterImpact===u.NotChecked){const e=null!=s?s.serviceMbsInIndexSR:null!=i?i.serviceMbsInIndexSR:null;t.filterImpact=null!=e?this._computeNodeFiltering(e):u.Unmodified}const o=null!=s&&t.filterImpact===u.Culled;let r=!(null!=s&&s.imModificationImpact===c.Culled)&&!o;if(r){const t=!s||i&&!s.visibilityObbInRenderSR?i??null:s;if(null!=t){this.needNodeElevationRange&&this.updateElevationRange(e);r=n.isNodeVisible(t)}}return t.visibilityCache=R(r,this._visibilityCacheVersion),r}isGeometryVisible(e){if(!this.isNodeVisible(e))return!1;const t=this._getNodeInternal(e);return!!(null==t?.node?.geometryObbInRenderSR||this.layerHasModifications&&t.node.imModificationImpact===c.NotChecked)||this._viewportQueries.isGeometryVisible(t.node)}_traverseCoverage(e,t,i,s,n){const o=this._getPage(e);if(null==o||0===t.childCount)return;const r=t.childOffset+t.childCount,a=new Array;for(let l=t.childOffset;l<r;++l){const e=o.children[l],t=this._getNodeInternal(e);null!=t?.node&&this.isGeometryVisible(e)&&a.push(t)}s/=a.length;for(const l of a){const e=l.node.index;this._isLoaded(e)||this._isReloading(e)?(n.delta=Math.max(n.delta,i),n.coverage+=s):this._traverseCoverage(e,l,i+1,s,n)}}useNodeAsHole(e){if("off"===this.holeFilling)return!1;const t=this._getNodeInternal(e);if(null==t)return!1;if("always"===this.holeFilling)return!0;if(C(t.useAsHole,this._version))return w(t.useAsHole);const i={delta:0,coverage:0};this._traverseCoverage(e,t,0,1,i);const s=i.delta*i.coverage<=.5;return t.useAsHole=R(s,this._version),s}get maxLevel(){return this._maxLevel}get dirty(){return this._dirty}destroy(){this._updates.destroy(),this._nodePages.clear(),this._clientNodePage=null,this._layer=null,this._missingPagesAndNodes.prune(),this._prefetchNodes.prune(),this._imModificationUncategorized.prune()}requestUpdate(){this._dirty=!0,this._indexMissing=1,this._version=S(this._version)}imModificationsChanged(e){this.layerHasModifications=e,this._forAllNodes(({node:e})=>{null!=e&&(e.imModificationImpact=c.NotChecked,e.visibilityObbInRenderSR=this._computeVisibilityObb(e),e.hasModifications&&this.invalidateGeometryVisibility(e.index))}),this.invalidateVisibilityCache()}layerFilterChanged(e){this._layerHasFilter=e,this._forAllNodes(e=>{if(null!=e){e.filterImpact=u.NotChecked;const t=e.node;null!=t&&this.invalidateNodeVisibilityCache(t.index)}}),this.invalidateVisibilityCache()}update(e,t,i){if(!this._dirty)return;this._pageQueue.length>0&&this._addQueuedPages(t),this._invalidateElevationRangeForNewPages(t),this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.NEGATIVE_INFINITY,this._missingPagesAndNodes.clear(),this._prefetchNodes.clear(),this._updates.reset(e),y.clear();let s=!0;const n=new L,o=new F,r=this._imModificationUncategorized;r.clear();const a=new Set;let l=0;const d=(a,d,h)=>{const u=E(a,this._pageSize);if(null==d){let e=this._entryPriority(a);return e===1/0&&(e=this._entryPriority(h)),y.set(u,Math.max(e,y.get(u)||0)),this._loadingPages.has(u)||this._failedPages.has(u)||(this._missingPagesAndNodes.push(u),++l),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const g=d.node;if(this._updateNodeFeatureEstimate(g,o),null==g){const e=this._entryPriority(a);return this._loadingNodes.has(a)||this._failedNodes.has(a)||(this._missingPagesAndNodes.push(a),y.set(a,e)),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const _=this._getPage(a);if(0===this._missingPagesAndNodes.length&&!this._useNodePages)for(let e=0;e<d.childCount;e++){const t=_.children[d.childOffset+e],i=this._getNodeInternal(t);null!=i&&!i.node&&!this._loadingNodes.has(t)&&!this._failedNodes.has(t)&&t>=0&&(y.set(t,this._entryPriority(t)),this._prefetchNodes.push(t))}if(g.failed||g.resources.isEmpty)return void(s&&d.childCount>0&&this._isSelected(g)&&(s=!1));if(this._isLoaded(a)){if(n.known+=g.memory,++n.knownNodes,this._isSelected(g)?d.childCount>0&&(s=!1):(n.unremoved+=g.memory,s=!1),this._needsUpdate(g)){const e=this._entryPriority(a);y.set(a,e),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e),this._updates.update.push(a)}return}if(g.memory&&(n.known+=g.memory,++n.knownNodes),!this._isSelected(g))return void(this._isReloading(a)&&this._updates.remove.push(a));if(d.childCount>0&&(s=!1),g.memory?(n.missing+=g.memory,n.known+=g.memory,++n.knownNodes):++n.missingNodes,e.includes(g.index))return this._maxProcessingPrio=Math.max(this._maxProcessingPrio,this._entryPriority(a)),void(this._updates.cancel=this._updates.cancel.filter(e=>e!==g.index));if(!t.done&&this._enable(g))return void t.madeProgress();const f=this._entryPriority(a);y.set(a,f),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,f),this._updates.add.push(a),this.layerHasModifications&&i&&null!=g&&g.imModificationImpact===c.NotChecked&&r.push(a)};this.traverseVisible(d,a),this._frameNumber++,this._missingPagesAndNodes.sort((e,t)=>e-t),this._missingPagesAndNodes.filterInPlace((e,t)=>t<1||this._missingPagesAndNodes.data[t-1]!==e),this._missingPagesAndNodes.sort((e,t)=>y.get(e)-y.get(t)),this._missingPagesAndNodes.length>0&&(this._maxUnloadedPrio=y.get(this._missingPagesAndNodes.back()),this._prefetchNodes.clear()),this._removeUnusedNodePages(a,l);const h=this._updates.add;h.length>0&&this.layerHasModifications&&(r.length>0&&i?.(r),h.filterInPlace(e=>{const t=this._getNodeInternal(e),i=null==t?.node||t.node.imModificationImpact!==c.Culled;return i||this.invalidateNodeVisibilityCache(e),i})),this._unloadedMemoryEstimate=n.missing-n.unremoved,n.knownNodes>3&&n.missingNodes>0&&(this._unloadedMemoryEstimate+=n.known/n.knownNodes*n.missingNodes),this._unloadedMemoryEstimate=.8*Math.max(0,this._unloadedMemoryEstimate),this._featureEstimate.estimate=this._computeFeatureEstimate(o),this._featureEstimate.leavesReached=s,this._updates.add.filterInPlace(e=>y.get(e)>=this._maxUnloadedPrio).sort((e,t)=>y.get(e)-y.get(t)),this._updates.update.sort((e,t)=>y.get(e)-y.get(t)),this._indexMissing=this._loadingPages.size+this._loadingNodes.size+this._missingPagesAndNodes.length,this._dirty=this._indexMissing>0,y.clear()}checkFeatureTarget(e,t){const i=this._viewportQueries.updateScreenSpaceErrorBias(t);let s=t,n=t,o=i,r=10;for(;r--;){const i=new F;this._updateFeatureEstimate(s,i);if(this._computeFeatureEstimate(i)<=e){if(s>=t||i.missingNodes>0||0===r)break;o=s,s=.5*(s+n)}else n=s,s=.5*(s+o)}return this._version=S(this._version),this._viewportQueries.updateScreenSpaceErrorBias(i),Math.min(t,s)}_removeUnusedNodePages(e,t){if(!this._useNodePages)return;const i=e.size,s=this._nodePages,n=s.size+this._loadingPages.size+t;if(n>U&&n>i){const t=new Array;for(const[i,n]of s)0!==n.numNodesWithLoadedChildren||e.has(i)||t.push([n.lastTraversed,i]);t.sort((e,t)=>e[0]-t[0]).some(e=>{const t=e[1];return this._deleteNodePage(t),s.size<=U})}}_updateFeatureEstimate(e,t){this._version=S(this._version),this._viewportQueries.updateScreenSpaceErrorBias(e),this.traverseVisible((e,i)=>this._updateNodeFeatureEstimate(i?.node,t))}_updateNodeFeatureEstimate(e,t){null!=e&&!e.failed&&this._isSelected(e)&&(null!=e.numFeatures?(t.numFeatures+=e.numFeatures,++t.knownNodes):++t.missingNodes)}_computeFeatureEstimate(e){let t=e.numFeatures;return e.knownNodes>3&&e.missingNodes>0&&(t+=e.numFeatures/e.knownNodes*e.missingNodes),Math.max(0,t)}load(){return this._load(this._missingPagesAndNodes)}prefetch(){return this._prefetchNodes.sort((e,t)=>y.get(e)-y.get(t)),this._load(this._prefetchNodes)}_load(e){if(0===e.length||!this._canRequest())return!1;for(;e.length>0&&this._canRequest();){const t=e.pop();this._useNodePages&&t>=0?this._loadPage(t):this._loadNode(t)}return!0}get isLoading(){return this._indexMissing>0}get isPrefetching(){return this._prefetchNodes.length>0}get indexLoading(){return this._loadingPages.size+this._loadingNodes.size}get indexMissing(){return this._indexMissing}get unloadedMemoryEstimate(){return this._unloadedMemoryEstimate}get updates(){return this._updates}get featureEstimate(){return this._featureEstimate}get maxPriority(){return Math.max(this._maxProcessingPrio,this._maxUnloadedPrio)}nodeTraversalState(e){if(null==e)return null;const t=e.index,i=this._getNodeInternal(t);if(!i)return null;let s=i?.traversalState;if(s&&C(s.version,this._version))return s;const n=this._viewportQueries.getLodLevel(e),o=this._viewportQueries.hasLOD(e);let r=!0;if(o){const e=this.getParentIndex(t);if(null!=e){const t=this._getNodeInternal(e),i=t?.traversalState;r=!!i&&n>i.lodLevel}else r=n>0}else r=0===e.childCount;return s?(s.lodLevel=n,s.isChosen=r,s.version=R(!0,this._version),s):(s=new g(o,r,n,R(!0,this._version)),i.traversalState=s,s)}async _loadNode(e){this._loadingNodes.add(e);const i=this._getNodeInternal(e).ref;if(null==i)return void this._failedNodes.add(e);const s=i.id,n=this._urlPrefix+s,o=()=>{this._loadingNodes.delete(e),0===this._missingPagesAndNodes.length&&0===this._loadingNodes.size&&this.requestUpdate()};let r=null;try{r=e>=0?await this._streamDataController.request(n,a.JSON):await this._clientNodeLoader.loadNodeJSON(s)}catch(h){return o(),void(t(h)||(this._logger.error("#loadNode()",this._layer,"Error loading node: "+n),this._failedNodes.add(e)))}o();const l=this._validateNode(s,r);if(null==l)return;l.obb&&this.invalidateNodeVisibilityCache(e);const d=this._addNode(l,e);this.nodeTraversalState(d)}_validateNode(e,t){if(null==t||"object"!=typeof t||t.id!==e)return this._logger.error("#validateNode()",this._layer,`Invalid node. Wrong type or wrong id "${e}"`),null;if(!Array.isArray(t.mbs))return this._logger.error("#validateNode()",this._layer,`Invalid bounding volume on node ${e}.`),null;t.sharedResource&&"./shared"!==t.sharedResource.href&&"./shared/"!==t.sharedResource.href&&this._logger.warn("#validateNode()",this._layer,`Invalid shared resource href on node "${e}"`);const i=t.geometryData;null==i||Array.isArray(i)&&0===i.length||Array.isArray(i)&&1===i.length&&"./geometries/0"===i[0].href||this._logger.warn("#validateNode()",this._layer,`Invalid geometry data on node "${e}"`);const s=t.attributeData,n=this._layer.attributeStorageInfo;null==s||Array.isArray(s)&&!s.some((e,t)=>e.href!==`./attributes/${n?.[t]?.key??`f_${t}`}/0`)||this._logger.warn("#validateNode()",this._layer,`Invalid attribute data on node "${e}"`),t.featureData&&t.featureData.length>1&&this._logger.warn("#validateNode()",this._layer,`Node ${e} has ${t.featureData.length} bundles. Only the first bundle will be loaded.`);const o=t.hasOwnProperty("obb")&&!this.ignoreServiceObb?t.obb:void 0,r=t.featureData&&1===t.featureData.length&&t.featureData[0].featureRange?t.featureData[0].featureRange[1]-t.featureData[0].featureRange[0]+1:void 0,a=t=>{if(null==t)return null;const i=t=>this._logger.error("#validateNode()",this._layer,`Invalid node reference on node ${e}: ${t}`);if("number"==typeof t.id)i(`id ${t.id} is a number instead of a string.`);else if("string"!=typeof t.id||!Array.isArray(t.mbs))return i("Missing or invalid id."),null;if(!Array.isArray(t.mbs))return i(`Invalid bounding volume on reference ${t.id}.`),null;t.href&&t.href!=="../"+t.id&&this._logger.error("#validateNode()",this._layer,`Invalid node href on node "${e}"`);const s=new d(`${t.id}`,t.mbs);return s.serviceObbInIndexSR=!this.ignoreServiceObb&&t.hasOwnProperty("obb")&&t.obb?N.fromJSON(t.obb):null,s.visibilityObbInRenderSR=this._computeVisibilityObb(s),s},l=Array.isArray(t.children)?t.children.map(a).filter(e=>null!=e):null,h=t.featureData?.length??!1,u=!0===t.isEmpty;return new m(e,t.mbs,o,"string"==typeof t.version?t.version:null,{isEmpty:!h&&u,hasSharedResource:null!=t.sharedResource,attributes:t.attributeData?e:void 0,texture:t.textureData&&t.textureData.length>0?e:void 0,geometry:null!=t.geometryData?e:void 0},l,Array.isArray(t.lodSelection)?t.lodSelection:null,r)}resetFailedNodes(){this._failedNodes.clear(),this._failedPages.clear(),this._forAllNodes(e=>{null!=e.node&&(e.node.failed=!1)})}_entryPriority(e){const t=this._getNodeInternal(e),i=this.getParentIndex(e);if(null==t||null==i&&null==t.node)return null==i?1/0:this._entryPriority(i);let s=0;if(t.node&&null!=i){const e=this._getNodeInternal(i).traversalState;null!=e&&(s=e.lodLevel)}let n=this.progressiveLoadPenalty;for(let r=e;null!=r;r=this.getParentIndex(r))if(this._isLoaded(r)){n=0;break}const o=null!=t.ref?this._viewportQueries.distToPOI(t.ref):null!=t.node?this._viewportQueries.distToPOI(t.node):0;return-o-s*(o+this.progressiveLoadPenalty)+n}traverseVisible(e,t){const i=this._getNodeInternal(this._rootIndex);null!=i?this._traverseVisible(this._rootIndex,null,i,e,t):e(this._rootIndex,null,null)}_traverseVisible(e,t,i,s,n){const o=E(e,this._pageSize);if(n&&n.add(o),i.node&&0===i.childCount)return void(this.isGeometryVisible(e)&&s(e,i,t));if(!this.isNodeVisible(e))return;if(s(e,i,t),null==i.node)return;const r=this.nodeTraversalState(i.node);if(r?.nodeHasLOD&&r.lodLevel===this._maxLodLevel)return;const a=this._getPageFromPageIndex(o);for(let l=0;l<i.childCount;l++){const t=a.children[i.childOffset+l],o=this._getNodeInternal(t);if(o)this._traverseVisible(t,e,o,s,n);else{if(n){const e=E(t,this._pageSize);n.add(e)}s(t,null,e)}}}traverse(e,t){t(e)&&this.traverseDescendants(e,t)}traverseDescendants(e,t){++this._traverseDescendantsNestingLevel;const i=e.index,s=this._pageSize,n=E(i,s),o=this._getPageFromPageIndex(n);if(null==o)return;const r=this._frameNumber,a=this._nodePages,l=M(i,s),d=o.nodes[l],h=d.childCount;if(o.lastTraversed=r,0===h)return;const u=new Array,c=1===this._traverseDescendantsNestingLevel?this._traverseDescendantsQueue:[0];let g=0;{const{childOffset:e,childCount:t}=d,{children:i}=o;c.length=2**Math.ceil(Math.log2(g+t));for(let s=e;s<e+t;++s){const e=i[s];e>=0?(c[g]=e,++g):u.push(e)}}if(u.length>0){const e=this._clientNodePage;if(e){const i=e.children;let s=0;for(;s<u.length;){const n=u[s];++s;const o=-n-1,r=e.nodes[o],a=r.node;if(!a||!t(a))continue;const{childCount:l}=r;if(0===l)continue;const{childOffset:d}=r,h=d+l;for(let e=d;e<h;++e)u.push(i[e])}}}if(g>0){let e=0;if(s>0){let i=n*s,l=o,d=l.nodes;for(;e<g;){const n=c[e];let o;if(++e,i<=n&&n<i+s)o=l;else{const e=n/s|0,t=a.get(e);if(void 0===t)continue;o=t,o.lastTraversed=r,l=o,d=l.nodes,i=s*e}const h=d[n-i],u=h.node;if(null==u||!1===t(u))continue;const{childCount:_}=h;if(0===_)continue;const f=g+_;for(c.length<f&&(c.length=2**Math.ceil(Math.log2(g+_)));c.length<g+_;)c.length+=c.length;const m=o.children,{childOffset:v}=h,N=v+_;for(let e=v;e<N;++e)c[g]=m[e],++g}}else{const i=a.get(0);if(i)for(;e<g;){const s=c[e++],n=i.nodes[s],o=n.node;if(!o||!t(o))continue;const{childCount:r}=n;if(0===r)continue;c.length=Math.max(c.length,2**Math.ceil(Math.log2(g+r)));const a=i.children,{childOffset:l}=n,d=l+r;for(let e=l;e<d;++e)c[g]=a[e],++g}}}--this._traverseDescendantsNestingLevel}updateChildrenLoaded(e,t){let i=this.getNode(e);for(;null!=i;){const e=i.childrenLoaded,s=e+t;i.childrenLoaded=s;const n=0===e?1:0===s?-1:0,o=i.index;if(0!==n){this._getPage(o).numNodesWithLoadedChildren+=n}i=this.getParent(o)}}checkChildrenLoadedInvariant(){return!0}updateElevationInfo(e,t){this.needNodeElevationRange=t&&!!e&&("relative-to-ground"===e.mode||"relative-to-scene"===e.mode||"on-the-ground"===e.mode),this._viewportQueries.updateElevationInfo(e),this.invalidateAllElevationRanges()}invalidateAllElevationRanges(){this._forAllNodes(e=>{e?.invalidateBounds(),e.node?.invalidateElevationRange(),e.ref?.invalidateElevationRange()})}_forAllNodes(e){if(null!=this._clientNodePage){const t=this._clientNodePage;for(let i=0;i<t.nodes.length;i++)e(t.nodes[i],-(i+1))}for(const[t,i]of this._nodePages){const s=t*this._pageSize;for(let t=0;t<i.nodes.length;t++)e(i.nodes[t],s+t)}}clearCaches(){if(this._useNodePages){const e=this._nodePages,t=new Set;this.traverseVisible(e=>t.add(E(e,this._pageSize)));for(const[i,s]of e)if(0!==s.numNodesWithLoadedChildren||t.has(i))for(const e of s.nodes)e.traversalState=null;else this._deleteNodePage(i)}}_deleteNodePage(e){this._nodePages.delete(e)}get test(){}}const y=new Map;class P{constructor(t){this.missing=t,this.update=new e({deallocator:null}),this.add=new e({deallocator:null}),this.remove=new e({deallocator:null}),this.cancel=[]}destroy(){this.update.prune(),this.add.prune(),this.remove.prune(),this.cancel.length=0}reset(e){this.add.clear(),this.update.clear(),this.cancel=e}}function x(e){return f(e,-2)}function S(e){return f(e,2)}function R(e,t){return t+(e?1:0)}function C(e,t){return(-2&e)===t}function w(e){return!(1&~e)}function E(e,t){return e<0?-1:t>0?e/t|0:0}function M(e,t){return e<0?-e-1:0===t?e:e%t}function O(e,t,i){return-1===t?-(e+1):0===i?e:t*i+e}const V=[["maxScreenThreshold",l.MaxScreenThreshold],["screenSpaceRelative",l.ScreenSpaceRelative],["removedFeatureDiameter",l.RemovedFeatureDiameter],["distanceRangeFromDefaultCamera",l.DistanceRangeFromDefaultCamera]];function A(e){if(e)for(let t=0;t<e.length;t++)for(const i of V)if(i[0]===e[t].metricType)return{lodMetric:i[1],maxError:e[t].maxError};return{lodMetric:l.None,maxError:0}}class L{constructor(){this.known=0,this.knownNodes=0,this.missing=0,this.missingNodes=0,this.unremoved=0}}class F{constructor(){this.numFeatures=0,this.knownNodes=0,this.missingNodes=0}}function D(e){return Math.sqrt(e*(4/Math.PI))}const z=o(),k=o(),T=o(),B=o(),U=has("esri-mobile")?100:300;export{I as I3SIndex,A as selectErrorMetric};
|
|
@@ -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{result as e,assertResult as t}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{clone as r}from"../../../../core/lang.js";import{throwIfAbortError as i}from"../../../../core/promiseUtils.js";import{makeAbsolute as o}from"../../../../core/urlUtils.js";import{TextureEncoding as n}from"./enums.js";import{readBinaryAttribute as
|
|
5
|
+
import{result as e,assertResult as t}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{clone as r}from"../../../../core/lang.js";import{throwIfAbortError as i}from"../../../../core/promiseUtils.js";import{makeAbsolute as o}from"../../../../core/urlUtils.js";import{DocType as s}from"../../support/index.js";import{TextureEncoding as n}from"./enums.js";import{readBinaryAttribute as a,createGeometryDescriptor as u}from"./I3SBinaryReader.js";import{getMaterialAndTextures as l,getMaterialAndTexturesFromShared as f,selectEncoding as d}from"./I3SMaterialUtil.js";class c{constructor(e,t,r,i,o,s){if(this._streamDataController=t,this._logger=r,this._defaultGeometrySchema=i,this._requiredAttributes=o,this._options=s,this._logLayer=e,this._layerUrl=e.parsedUrl.path,this._geometryDefinitions=e.geometryDefinitions,e.materialDefinitions){const t=e.textureSetDefinitions;this._materialAndTextures=e.materialDefinitions.map(r=>l(t,r,"integrated-mesh"===e.type))}}_load(e,t,r){return this._streamDataController.request(e,t,r)}_loadAttribute(e,t,r){const i=`${this._layerUrl}/nodes/${e.resources.attributes}/attributes/${t.key}/0`;return this._load(i,s.BINARY,r).then(e=>a(t,e))}async loadAttributes(e,t,r){const o=await Promise.allSettled(t.map(t=>this._loadAttribute(e,t.attributeStorageInfo,r))),s={};for(let n=0;n<t.length;++n){const r=o[n],a=t[n];if("fulfilled"===r.status){const e=r.value;s[a.name]=e}else{const t=r.reason;i(t),this._logger.error("#loadAttributes",this._logLayer,`Failed to load attributeData for '${a.name}' on node '${e.id}'`,t)}}return s}async loadNodeData(r,i){const o=null!=this._requiredAttributes&&r.resources.attributes?e(this.loadAttributes(r,this._requiredAttributes,i)):null,{bufferDefinition:s,bufferIndex:n}=y(this._geometryDefinitions,r),a=!!r.resources.geometry,l=a?e(this._loadGeometry(r.resources.geometry,n,i)):null,d=r.resources.hasSharedResource?await this._loadShared(r,i):null,c=r.resources.materialDefinition,D=this._materialAndTextures&&null!=c&&c>=0?this._materialAndTextures[c]:null!=d?f(d):null,p=D?.material,x=D?.textures??[],b=`${r.id}`,A=!a&&this._options.loadFeatureData,$=A?await this._loadFeatureData(b,i):null,I=A?h($):m(p),T=null==I?g($):null,S=x.length>0?e(this.loadTextures(r,x,i)):null;let j=null,w=null;if(l){j=t(await l);const e=_(this._defaultGeometrySchema,d);w=u(s,e)}const U=S?t(await S):null,B=o?t(await o):{},q=B?{attributeData:B,loadedAttributes:this._requiredAttributes}:null;if(null!=I)return{geometryData:I,attributeDataInfo:q,geometryBuffer:j,geometryDescriptor:w,requiredTextures:x,textureData:U};if(null!=T)return{pointData:T,attributeDataInfo:q,geometryBuffer:j,geometryDescriptor:w,requiredTextures:x,textureData:U};throw new Error}static _addAbsoluteHrefTexture(e,t){const r=e.textureDefinitions;if(null!=r)for(const i of Object.keys(r))for(const e of r[i].images)Array.isArray(e.href)?e.hrefConcat=e.href.map(e=>o(e,t)):e.hrefConcat=o(e.href,t)}static _fixTextureEncodings(e){const t=e.textureDefinitions;if(null!=t)for(const r in t){const e=t[r];if(Array.isArray(e.encoding))for(let t=0;t<e.encoding.length;t++){const r=e.encoding[t];"data:"===r.slice(0,5)&&(e.encoding[t]=r.slice(5))}else{const t=e.encoding;"data:"===t.slice(0,5)&&(e.encoding=t.slice(5))}}}async _loadShared(e,t){if(null==e.resources.geometry)return{};const r=`${this._layerUrl}/nodes/${e.resources.geometry}/shared`,i=await this._load(r,s.JSON,t);return c._fixTextureEncodings(i),c._addAbsoluteHrefTexture(i,r),i}_loadTexture(e,t,r,i,o){return i===n.DDS_S3TC||i===n.KTX2||i===n.Basis?this._load(e,s.BINARY,o).then(e=>({id:t,usage:r,data:e,encoding:i})):this._load(e,s.IMAGE,o).then(e=>({id:t,usage:r,data:e,encoding:i}))}loadTextures(e,t,r){const i=this._options.textureUsageMask;return Promise.all(t.map(t=>{if(0===(t.usage&i))return null;const o=d(t.encodings,this._options.textureEncodings);if(null==o)return this._logger.error("#loadTextures",this._logLayer,`No known encoding for texture found on node ${e.id}`),Promise.reject();const s=e.resources.texture||e.id,n=`${this._layerUrl}/nodes/${s}/textures/${o.name}`;return this._loadTexture(n,t.id,t.usage,o.encoding,r)}))}_loadFeatureData(e,t){const r=`${this._layerUrl}/nodes/${e}/features/0`;return this._load(r,s.JSON,t)}_loadGeometry(e,t,r){const i=`${this._layerUrl}/nodes/${e}/geometries/${t}`;return this._load(i,s.BINARY,r)}}function m(e){return{featureIds:[],geometries:[{type:"ArrayBufferView",params:{material:e}}],featureDataPosition:[0,0,0]}}function h(e){if(!e)return null;for(const t of e.featureData){const e=t.geometries;if(null!=e)for(const r of e)return{featureIds:[t.id],featureDataPosition:t.position,geometries:[r]}}return null}function g(e){if(!e)return null;const t=new Array;for(const r of e.featureData)null!=r.position&&t.push({featureIds:[r.id],featureDataPosition:r.position,geometries:[]});return t}function _(e,t){if(!e||!t?.materialDefinitions)return e;const i=Object.keys(t.materialDefinitions)[0];return!t.materialDefinitions[i].params.vertexRegions&&e.vertexAttributes.region&&delete(e=r(e)).vertexAttributes.region,e}function y(e,t){const r={bufferDefinition:null,bufferIndex:0},i=t.resources.geometryDefinition;if(null==e||null==i||i<0)return r;const o=i>=0?e[i].geometryBuffers:null;if(null==o)return r;for(let s=0;s<o.length;s++){const e=o[s];if(null==e.compressedAttributes)r.bufferIndex=s,r.bufferDefinition=o[s];else if("draco"===e.compressedAttributes.encoding&&!has("disable-feature:i3s-draco"))return r.bufferIndex=s,r.bufferDefinition=e,r}return r}export{c as default};
|
|
@@ -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{_ as r}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Logger.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import o from"../../../../core/sql/WhereClause.js";import{findFieldsCaseInsensitive as n}from"../i3s/I3SUtil.js";const t=t=>{
|
|
5
|
+
import{_ as r}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Logger.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as s}from"../../../../core/accessorSupport/decorators/subclass.js";import o from"../../../../core/sql/WhereClause.js";import{findFieldsCaseInsensitive as n}from"../i3s/I3SUtil.js";const t=t=>{const p=t;let d=class extends p{constructor(){super(...arguments),this._definitionExpressionErrors=0,this._maxDefinitionExpressionErrors=20,this.logError=r=>{this._definitionExpressionErrors<this._maxDefinitionExpressionErrors&&e.getLogger(this).error("Error while evaluating definitionExpression: "+r),this._definitionExpressionErrors++,this._definitionExpressionErrors===this._maxDefinitionExpressionErrors&&e.getLogger(this).error("Further errors are ignored")}}get parsedDefinitionExpression(){if(!this.i3slayer?.definitionExpression)return null;try{const r=o.create(this.i3slayer.definitionExpression,{fieldsIndex:this.i3slayer.fieldsIndex});if(!r.isStandardized)return e.getLogger(this).error("definitionExpression is using non standard function"),null;const i=[],s=r.fieldNames;return n(s,this.i3slayer.fieldsIndex,{missingFields:i}),i.length>0?(e.getLogger(this).error(`definitionExpression references unknown fields: ${i.join(", ")}`),null):(this._definitionExpressionErrors=0,r)}catch(r){return e.getLogger(this).error("Failed to parse definitionExpression: "+r),null}}get definitionExpressionFields(){return this.parsedDefinitionExpression?this.parsedDefinitionExpression.fieldNames:[]}_evaluateClause(r,e){if(null==r)return!0;try{return r.testFeature(e)}catch(i){return this.logError(i),!1}}_addDefinitionExpressionToQuery(r){if(!this.parsedDefinitionExpression)return r;const e=this.i3slayer.definitionExpression,i=r.clone();return i.where?i.where=`(${e}) AND (${i.where})`:i.where=e,i}};return r([i({readOnly:!0})],d.prototype,"parsedDefinitionExpression",null),r([i({readOnly:!0})],d.prototype,"definitionExpressionFields",null),d=r([s("esri.views.3d.layers.support.DefinitionExpressionSceneLayerView")],d),d};export{t as DefinitionExpressionSceneLayerView};
|
|
@@ -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{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Error.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{unpackFieldNames as s,populateMissingFields as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Error.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{unpackFieldNames as s,populateMissingFields as o}from"../../../../layers/support/fieldUtils.js";import{getFetchPopupTemplate as a,getRequiredFields as p}from"../../../layers/support/popupUtils.js";const i=i=>{const c=i;let n=class extends c{_validateFetchPopupFeatures(e){const{layer:r}=this,{popupEnabled:s}=r;if(!s)throw new t("scenelayerview3d:fetchPopupFeatures","Popups are disabled",{layer:r});if(!a(r,e))throw new t("scenelayerview3d:fetchPopupFeatures","Layer does not define a popup template",{layer:r})}async prepareFetchPopupFeatures(e){}async fetchPopupFeaturesFromGraphics(e,t){if(this._validateFetchPopupFeatures(t),0===e.length)return[];const r="scene"===this.layer.type&&null!=this.layer.associatedLayer?this.layer.associatedLayer:this.layer;let i=[];"fieldsIndex"in this.layer&&(i=s(this.layer.fieldsIndex,await p(r,a(this.layer,t)))),await this.prepareFetchPopupFeatures(i);const c=new Set,n=[],l=[];for(const s of e)o(s,i,c)?l.push(s):n.push(s);if(0===l.length)return n;const u=new Map;for(let s=0;s<e.length;s++)u.set(e[s].getObjectId()??0,s);const h=await this.whenGraphicAttributes(l,[...c]).catch(()=>l).then(e=>n.concat(e));return h.sort((e,t)=>{const r=e.getObjectId()??0,s=u.get(r)??0,o=t.getObjectId()??0;return s-(u.get(o)??0)}),h}};return n=e([r("esri.views.3d.layers.support.PopupSceneLayerView")],n),n};export{i as PopupSceneLayerView};
|
|
@@ -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{_ as t}from"../../../../chunks/tslib.es6.js";import{property as e}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{getTimeOperator as i}from"../../../../layers/graphics/data/timeSupport.js";import s from"../../../../layers/support/FeatureFilter.js";import{combineTimeExtent as n}from"../../../../layers/support/timeSupport.js";import{getCachedAttributeValue as o}from"../i3s/I3SBinaryReader.js";import{filterInPlace as l}from"../i3s/I3SUtil.js";const u=i=>{
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import{property as e}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{getTimeOperator as i}from"../../../../layers/graphics/data/timeSupport.js";import s from"../../../../layers/support/FeatureFilter.js";import{combineTimeExtent as n}from"../../../../layers/support/timeSupport.js";import{getCachedAttributeValue as o}from"../i3s/I3SBinaryReader.js";import{filterInPlace as l}from"../i3s/I3SUtil.js";const u=i=>{const o=i;let l=class extends o{get timeExtent(){return n(this.i3slayer,this.view?.timeExtent,this._get("timeExtent"))}get mergedFilter(){const{filter:t,timeExtent:e}=this;if(null==e)return t;const r=t?.clone()??new s;return null!=e&&(r.timeExtent=r.timeExtent?.intersection(e)??e),r}getTimeFilterDependencies(){const{timeInfo:t}=this.i3slayer;if(null==t)return[];const{startField:e,endField:r}=t;return[e,r]}addTimeFilter(t,e){if(null==e)return;const{timeInfo:r}=this.i3slayer;if(null==r)return;const{startField:i,endField:s,useTime:n}=r;if(!n||null==i&&null==s)return;const o=r.toJSON(),l=e.toJSON();t.push((t,e)=>a(t,e,o,l))}};return t([e({readOnly:!0})],l.prototype,"timeExtent",null),t([e()],l.prototype,"mergedFilter",null),l=t([r("esri.views.3d.layers.support.TemporalSceneLayerView")],l),l};function a(t,e,r,s){const n=e.attributeInfo?.attributeData;if(null==n)return;const{startTimeField:o,endTimeField:u}=r;if(!!(null!=o&&null==n[o]||null!=u&&null==n[u]))return;const a=i(r,s,new m(n));if(null==a)return;const{featureIds:p}=e;l(t,p,a)}class m{constructor(t){this.attributeData=t}getAttribute(t,e){return o(this.attributeData[e],t)}getAttributeAsTimestamp(t,e){const r=this.getAttribute(t,e);return"string"==typeof r?new Date(r).getTime():"number"==typeof r||null==r?r:null}}export{u as TemporalSceneLayerView};
|
|
@@ -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/Logger.js";import{isAborted as r,createAbortError as t}from"../../../../core/promiseUtils.js";import{isRefreshableLayer as s}from"../../../../layers/mixins/RefreshableLayer.js";import{
|
|
5
|
+
import e from"../../../../core/Logger.js";import{isAborted as r,createAbortError as t}from"../../../../core/promiseUtils.js";import{isRefreshableLayer as s}from"../../../../layers/mixins/RefreshableLayer.js";import{DocType as o}from"../../support/index.js";import{useFetchTileForLayer as i}from"../../terrain/terrainUtils.js";async function a(a,n,l){const m=a.layer;if(i(m)){const s=await m.fetchTile(n[0],n[1],n[2],l);if(r(l))throw e.getLogger(a).warnOnce("A call to fetchTile resolved even though the request was aborted. fetchTile should not resolve if options.signal.aborted is true."),t();return s}let f=a.getTileUrl(n);s(m)&&m.refreshTimestamp&&(f+=`${f.includes("?")?"&":"?"}_ts=${m.refreshTimestamp}`);const c=a.hasMixedImageFormats?o.IMAGE_AND_TYPE:o.IMAGE;return l.requester.request(f,c,l)}export{a as fetchTile};
|
|
@@ -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{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import i from"../../../core/Logger.js";import{MemCacheStorage as s,MemCache as r}from"../../../core/MemCache.js";import{addFrameTask as a}from"../../../core/scheduling.js";import{Milliseconds as o}from"../../../core/time.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{isMemoryManagedView as y}from"./MemoryManagedView.js";import{makeBudget as l}from"../../support/Scheduler.js";function m(e){return new
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import has from"../../../core/has.js";import i from"../../../core/Logger.js";import{MemCacheStorage as s,MemCache as r}from"../../../core/MemCache.js";import{addFrameTask as a}from"../../../core/scheduling.js";import{Milliseconds as o}from"../../../core/time.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{isMemoryManagedView as y}from"./MemoryManagedView.js";import{makeBudget as l}from"../../support/Scheduler.js";function m(e){return new w({view:e})}const u=.1,n=1,c=1,_=.75,p=.6,M=1.3,g=!!has("esri-tests-disable-memory-pools");let w=class extends t{constructor(e){super(e),this._quality=1,this._usedMemory=0,this._updating=!1,this._stableQuality=0,this._downscaleMemoryUsed=0,this._canFastRecover=!1,this._predictedMemory=0,this._cacheStorage=new s,this._warnMemoryUsage=null,this._numQualityChanges=0,this._maxMemory=g?4096:750,this._additionalCacheMemory=g?-4096:0,this.addHandles(a({prepare:()=>this._updateMemory()}))}destroy(){this._cacheStorage.destroy()}get maxMemory(){return this._maxMemory}set maxMemory(e){null==e||e<=0||g||(this._stableQuality=0,this._canFastRecover=!1,this._maxMemory<e&&this._updateQuality(n),this._maxMemory=e)}get additionalCacheMemory(){return this._additionalCacheMemory}set additionalCacheMemory(e){null==e||g||(this._additionalCacheMemory=e)}get memoryFactor(){return this._quality}get updating(){return this._updating}get usedMemory(){return this._usedMemory}get usedCacheMemory(){return this._cacheStorage.size}newCache(e,t,i){return new r(e,this._cacheStorage,t,i)}resetStableQuality(){this._stableQuality=0}disableMemCache(){this.additionalCacheMemory=-4096}update(){if(this._predictedMemory<=0&&!this._updating)return;let e=this._layersUpdating();if(this._predictedMemory<p&&this._canFastRecover)this._downscaleMemoryUsed=0,this._stableQuality=0,this._canFastRecover=!1,this._updateQuality(n);else if(e){if(this._predictedMemory>1.1*c||this._usedMemory>c)if(this._stableQuality>0)this._downscaleMemoryUsed=0,this._updateQuality(this._stableQuality);else if(this._quality>u&&this._downscaleMemoryUsed<this._usedMemory){if(this._compactAndUpdate())return;this._updateQuality(this._quality/M),this._downscaleMemoryUsed=this._usedMemory,this._canFastRecover=!1}}else if(this._downscaleMemoryUsed=0,this._usedMemory>c){if(this._compactAndUpdate())return;this._stableQuality=0,this._canFastRecover=!1,e=this._updateQuality(this._quality/M),this._downscaleMemoryUsed=this._predictedMemory}else if(this._stableQuality!==this._quality)if(this._usedMemory<_&&this._quality<n){this._stableQuality=this._quality;const t=.05;e=this._updateQuality(this._quality+t)}else this._quality<1&&(this._canFastRecover=!0);this._updating=e}_compactAndUpdate(){const e=l(o(100)),t=this.view.stage.compact(e);return this.view.basemapTerrain.overlayManager.renderer.compact(e)||t}_updateQuality(e){return(e=Math.min(Math.max(e,u),n))!==this._quality&&(this._quality=e,++this._numQualityChanges,!0)}_layersUpdating(){return this.view.allLayerViews.some(e=>!!e.updating)}_updateMemory(){if(!this.view)return;this.view.stage?.renderer?.tick();const e=this.view.stage?.renderer?.usedMemory;let t=(this.view.basemapTerrain?.usedMemory??0)+(e?e.fbos+e.edges+e.plugins:0)+this.view.labeler?.usedMemory,s=0;this.view.allLayerViews&&this.view.allLayerViews.forEach(e=>{if(y(e)){const i=e.ignoresMemoryFactor?this._quality:1;t+=e.usedMemory*i,s+=e.unloadedMemory*i}});const r=null==this._warnMemoryUsage||Math.round(10*t)!==Math.round(10*this._warnMemoryUsage),a=1048576*this.maxMemory;if(t>a&&r){this._warnMemoryUsage=t;const e=e=>(e/1048576).toLocaleString(void 0,{maximumFractionDigits:1})+" MB",r=Math.round(100*this._quality);i.getLogger(this).warn(`Memory Limit exceeded! Limit: ${e(a)} Current: ${e(t)} Projected: ${e(t+s)} Quality: ${r}%`)}this._usedMemory=t/a,this._predictedMemory=(t+s)/a;const o=a-t;this._cacheStorage.maxSize=Math.max(0,o+1048576*this.additionalCacheMemory)}get test(){}};e([h({constructOnly:!0})],w.prototype,"view",void 0),e([h()],w.prototype,"maxMemory",null),e([h()],w.prototype,"additionalCacheMemory",null),e([h({readOnly:!0})],w.prototype,"memoryFactor",null),e([h({readOnly:!0})],w.prototype,"updating",null),e([h({readOnly:!0})],w.prototype,"usedMemory",null),e([h({readOnly:!0})],w.prototype,"usedCacheMemory",null),e([h()],w.prototype,"_quality",void 0),e([h()],w.prototype,"_usedMemory",void 0),e([h()],w.prototype,"_updating",void 0),e([h()],w.prototype,"_stableQuality",void 0),e([h()],w.prototype,"_maxMemory",void 0),e([h()],w.prototype,"_additionalCacheMemory",void 0),w=e([d("esri.views.3d.support.MemoryController")],w);export{u as minQuality,m as newMemoryController};
|
|
@@ -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{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{makeHandle as r}from"../../../core/handleUtils.js";import"../../../core/has.js";import{removeMaybe as s,destroyMaybe as o}from"../../../core/maybe.js";import{watch as a,sync as i}from"../../../core/reactiveUtils.js";import{addFrameTask as m}from"../../../core/scheduling.js";import{signal as l}from"../../../core/signal.js";import{secondsFromMilliseconds as d}from"../../../core/time.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{maxDownloadSlots as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import{makeHandle as r}from"../../../core/handleUtils.js";import"../../../core/has.js";import{removeMaybe as s,destroyMaybe as o}from"../../../core/maybe.js";import{watch as a,sync as i}from"../../../core/reactiveUtils.js";import{addFrameTask as m}from"../../../core/scheduling.js";import{signal as l}from"../../../core/signal.js";import{secondsFromMilliseconds as d}from"../../../core/time.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{maxDownloadSlots as p,downloadSlotsPerClient as u}from"./index.js";import{newMemoryController as c}from"./MemoryController.js";import{StreamDataLoader as _}from"./StreamDataLoader.js";import{StreamDataRequesterImpl as g}from"./StreamDataRequester.js";import{ImmediateTask as y,newScheduler as v,TaskPriority as f}from"../../support/Scheduler.js";let j=class extends t{constructor(){super(...arguments),this.updating=!1}};function T(e){return new C({view:e})}e([n({readOnly:!0})],j.prototype,"updating",void 0),j=e([h("esri.views.3d.support.ResourceController.ResourceControllerMain")],j);let C=class extends j{constructor(){super(...arguments),this._immediateTask=y,this._normalTask=y,this._updatingObjects=l([]),this._frameTask=null}get immediate(){return this._immediateTask}get normal(){return this._normalTask}initialize(){this._scheduler=v(),this._memoryController=c(this.view),this._streamDataLoader=new _,this._streamDataLoader.setup(p,u,this._scheduler),this.addHandles([a(()=>this.view.state?.mode,e=>{null!=e&&(this._scheduler.state=e)},i),a(()=>this.view.stationary,()=>this._stationaryChangedHandler())]),this._frameTask=m({update:e=>this._frame(e)}),this._immediateTask=this._scheduler.registerTask(f.RESOURCE_CONTROLLER_IMMEDIATE),this._normalTask=this._scheduler.registerTask(f.RESOURCE_CONTROLLER)}destroy(){this._immediateTask.remove(),this._normalTask.remove(),this._frameTask=s(this._frameTask),this._streamDataLoader=o(this._streamDataLoader),this._memoryController=o(this._memoryController),this._scheduler=o(this._scheduler),this.view=null}get updating(){return!!(this._memoryController?.updating||this._streamDataLoader?.updating||this._immediateTask?.updating)||this._updatingObjects?.value.some(e=>e.updating)}get scheduler(){return this._scheduler}get memoryController(){return this._memoryController}createStreamDataRequester(e){return new g(this._streamDataLoader,e)}addUpdatingObject(e){const t=this._updatingObjects;return t.value=[...t.value,e],r(()=>{t.value=t.value.filter(t=>t!==e)})}_frame(e){this.view.suspended||this.view.stateManager&&(this.view.stateManager.step(d(e.deltaTime)),!this._scheduler)||(this._memoryController.update(),this._scheduler.frame(e))}_stationaryChangedHandler(){this.memoryController.resetStableQuality()}get test(){}};e([n()],C.prototype,"view",void 0),e([n()],C.prototype,"_scheduler",void 0),e([n()],C.prototype,"_memoryController",void 0),e([n()],C.prototype,"_streamDataLoader",void 0),e([n()],C.prototype,"_immediateTask",void 0),e([n()],C.prototype,"_normalTask",void 0),e([n({readOnly:!0})],C.prototype,"updating",null),C=e([h("esri.views.3d.support.ResourceController")],C);export{T as newResourceController};
|
|
@@ -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{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../request.js";import s from"../../../core/Accessor.js";import{removeUnordered as r}from"../../../core/arrayUtils.js";import o from"../../../core/Error.js";import"../../../core/has.js";import{clone as a}from"../../../core/lang.js";import{removeMaybe as n,abortMaybe as i,destroyMaybe as u}from"../../../core/maybe.js";import{createResolver as l,createAbortError as h,onAbort as d,throwIfAborted as c,isAbortError as m}from"../../../core/promiseUtils.js";import{property as p}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{AsyncWorkerQueue as g,BaseTask as f}from"./AsyncWorkerQueue.js";import{ImageWithType as k}from"./ImageWithType.js";import{
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../request.js";import s from"../../../core/Accessor.js";import{removeUnordered as r}from"../../../core/arrayUtils.js";import o from"../../../core/Error.js";import"../../../core/has.js";import{clone as a}from"../../../core/lang.js";import{removeMaybe as n,abortMaybe as i,destroyMaybe as u}from"../../../core/maybe.js";import{createResolver as l,createAbortError as h,onAbort as d,throwIfAborted as c,isAbortError as m}from"../../../core/promiseUtils.js";import{property as p}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{AsyncWorkerQueue as g,BaseTask as f}from"./AsyncWorkerQueue.js";import{ImageWithType as k}from"./ImageWithType.js";import{DocType as L}from"./index.js";import{isImageWithType as D}from"../terrain/TerrainData.js";import{assert as b}from"../webgl-engine/lib/Util.js";import{TaskPriority as T}from"../../support/Scheduler.js";let y=class extends s{constructor(){super(...arguments),this._tasks=new Map,this._onLoadQueue=new Array,this._doneQueue=new Array,this.updating=!1}setup(e,t,s){this._loadQueue=new g((e,t)=>this._startLoading(e,t),(e,t)=>this._doneLoadingCB(e,t),e,t),s&&(this._frameTask=s.registerTask(T.STREAM_DATA_LOADER,this))}destroy(){this._frameTask=n(this._frameTask),this._tasks.forEach(e=>i(e.abortController)),this._loadQueue=u(this._loadQueue),this._onLoadQueue.length=0,this._onLoadQueue=null,this._doneQueue.length=0,this._doneQueue=null,this._tasks.forEach(e=>e.destroy()),this._tasks.clear(),this._tasks=null}hasDownloadSlots(e){return this._loadQueue.hasQuota(e)}request(e,t,s,r={}){const o=l();return o.__signal=null!=r?r.signal:null,this._createOrUpdateTask(e,t,s,r,o),o.promise}_createTask(e,t,s,r,o,a){const n=new Q(e,t,s,r,o);return this._updateTask(n,a),this._tasks.set(o,n),1===this._tasks.size&&this._set("updating",!0),this._loadQueue.push(n),n}_cancelRequest(e,t){const s=this._tasks.get(e);s&&(r(s.resolvers,t),t.reject(h()),0===s.resolvers.length&&(s.status===j.DOWNLOADING&&this._loadQueue.cancel(s),s.status=j.CANCELLED,this._removeTask(s)))}_updateTask(e,t){e.resolvers.push(t)}_createOrUpdateTask(e,t,s,r,o){const a=O(r?.uid||e,t,s);let n=this._tasks.get(a);n?this._updateTask(n,o):(n=this._createTask(e,r,t,s,a,o),n.abortHandle=d(r,()=>this._cancelRequest(a,o)))}_doneLoadingCB(e,t){this._loadQueue&&(b(e.status===j.DOWNLOADING),e.status=j.DOWNLOADED,this._frameTask?this._doneQueue.push({task:e,err:t}):this._doneLoading(e,t))}get running(){return this._doneQueue.length>0||this._onLoadQueue.length>0}runTask(e){for(;!e.done&&this._onLoadQueue.length>0;){const t=this._onLoadQueue.shift();c(t.task.abortController),t.task.abortController=null,t.callback(t.task),e.madeProgress()}for(;!e.done&&this._doneQueue.length>0;){const t=this._doneQueue.shift();t.task.status!==j.DOWNLOADED&&(t.err=t.err||h()),this._doneLoading(t.task,t.err),e.madeProgress()}}_doneLoading(e,t){if(t&&!m(t)&&e.numRetries>0)return--e.numRetries,void this._loadQueue.push(e);let s=D(e.result)||e.result instanceof HTMLImageElement?0:e.resolvers.length;for(const r of e.resolvers)if(t)m(t)?r.reject(t):r.reject(new o("stream-data-loader:request-error",`Failed to request resource at '${e.url}'. ${t}`,{url:e.url,error:t}));else{--s;const t=s>0?a(e.result):e.result;r.resolve(t)}this._removeTask(e)}_removeTask(e){this._tasks.delete(e.key),e.destroy(),0===this._tasks.size&&this._set("updating",!1)}_startLoading(e,s){if(e.status===j.CANCELLED)return!1;let r,o;switch(e.startTime=performance.now(),e.status=j.DOWNLOADING,e.docType){case L.BINARY:o="array-buffer",r=0;break;case L.IMAGE:o="image";break;case L.IMAGE_AND_TYPE:o="array-buffer";break;default:o="json"}e.abortController=new AbortController;const a=e.abortController.signal;e.request=t(e.url,{...e.options,responseType:o,timeout:r,signal:a});const n=t=>{e.duration=performance.now()-e.startTime,e.size=t instanceof ArrayBuffer?t.byteLength:e.size||0,e.result=t,this._frameTask?this._onLoadQueue.push({callback:s,task:e}):(e.abortController=null,s(e))},i=t=>{e.status===j.DOWNLOADING&&s(e,t)};return e.docType!==L.IMAGE_AND_TYPE?(e.request.then(e=>n(e.data),i),!0):(e.request.then(s=>{const u=s.data,l=E(u);if(o="image",e.size=u.byteLength,"unknown"===l)return e.request=t(e.url,{responseType:o,timeout:r,signal:a}),void e.request.then(e=>n(e.data),i);const h=new Blob([u],{type:l}),d=window.URL.createObjectURL(h);e.request=t(d,{responseType:o,timeout:r,signal:a}),e.request.then(e=>n(new k(e.data,l)),i).finally(()=>window.URL.revokeObjectURL(d))},i),!0)}get test(){}};e([p({readOnly:!0})],y.prototype,"updating",void 0),y=e([_("esri.views.3d.support.StreamDataLoader")],y);const A={numRetries:0};function E(e){if(e.byteLength<2)return"unknown";const t=new Uint8Array(e,0,e.byteLength);return 137===t[0]&&80===t[1]?"image/png":71===t[0]&&73===t[1]?"image/gif":66===t[0]&&77===t[1]?"image/bmp":255===t[0]&&216===t[1]?"image/jpeg":"unknown"}class Q extends f{constructor(e,t,s,r,o){super(r),this.url=e,this.options=t,this.docType=s,this.key=o,this.abortHandle=null,this.result=null,this.status=j.QUEUED,this.request=null,this.abortController=null,this.resolvers=new Array,this.startTime=0,this.numRetries=A.numRetries}destroy(){this.result=null,this.request=null,this.abortController?.abort(),this.abortController=null,this.resolvers.length=0,this.options=null,this.abortHandle=n(this.abortHandle)}}function O(e,t,s){return`${e}:${t}:${s}`}var j;!function(e){e[e.QUEUED=1]="QUEUED",e[e.DOWNLOADING=2]="DOWNLOADING",e[e.DOWNLOADED=3]="DOWNLOADED",e[e.CANCELLED=4]="CANCELLED"}(j||(j={}));export{y as StreamDataLoader,j as TaskStatus,A as test};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
class t{constructor(t,e){this._loader=t,this._clientType=e}request(t,e,s={}){return this._loader.request(t,e,this._clientType,s)}get busy(){return!this._loader.hasDownloadSlots(this._clientType)}}export{t as StreamDataRequesterImpl};
|
|
@@ -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{throwIfAborted as e,whenOrAbort as t}from"../../../core/promiseUtils.js";import{isSVG as r}from"../../../core/urlUtils.js";import{TextureCollection as
|
|
5
|
+
import{throwIfAborted as e,whenOrAbort as t}from"../../../core/promiseUtils.js";import{isSVG as r}from"../../../core/urlUtils.js";import{DocType as s}from"./index.js";import{TextureCollection as i,TextureRequest as o,TextureHandle as n}from"./TextureCollection.js";import{Texture as l}from"../webgl-engine/lib/Texture.js";import{TextureWrapMode as h}from"../../webgl/enums.js";class a extends i{constructor(e,t,r){super(t,r),this._streamDataRequester=e}async fromUrl(r,i,l){e(l);const h=l?.signal,a=this.makeUid(r,i);let u=this._textureRequests.get(a);if(!u){const e=new AbortController,t=this._streamDataRequester.request(r,s.IMAGE,{uid:a,signal:e.signal});u=new o,u.abortController=e;const l=u;this._textureRequests.set(a,u),u.textureAsync=t.then(async e=>{const t=this._createTexture(r,e,i);return l.texture=t,l.abortController=null,await t.load(this._stage.renderView.renderingContext),this._stage.addTexture(t),new n(a,t,()=>this._release(a))},e=>{throw l.abortController=null,e})}u.referenceCount++;try{return await t(u.textureAsync,h)}catch(d){throw this._release(a),d}}_createTexture(e,t,s){const i={width:t.width,height:t.height,wrap:{s:h.CLAMP_TO_EDGE,t:h.CLAMP_TO_EDGE},preMultiplyAlpha:!0,reloadable:!0};if(r(e)){if(s||0===t.width&&0===t.height){const e=t.width?t.height/t.width:1;s=s||64,e>1?(t.width=Math.round(s/e),t.height=s):(t.width=s,t.height=Math.round(s*e))}this._stage.renderView?.renderingContext.driverTest.svgPremultipliesAlpha.result&&(i.preMultiplyAlpha=!1)}return new l(t,i)}}export{a as StreamTextureCollection};
|
|
@@ -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{set as t,dist as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{ONES as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as n}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as i}from"../../../../geometry/projection/projectors.js";import{newDoubleArray as a}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as l}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as u}from"../../../../geometry/support/Indices.js";import{ViewingMode as
|
|
5
|
+
import{set as t,dist as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{ONES as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as n}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as i}from"../../../../geometry/projection/projectors.js";import{newDoubleArray as a}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as l}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as s}from"../../../../geometry/support/HalfFloatArray.js";import{getZeroIndexArray as u}from"../../../../geometry/support/Indices.js";import{ViewingMode as c}from"../../../ViewingMode.js";import{Attribute as f}from"../../webgl-engine/lib/Attribute.js";import{Geometry as p}from"../../webgl-engine/lib/Geometry.js";import{VertexAttribute as m}from"../../webgl-engine/lib/VertexAttribute.js";import{GeometryType as g}from"../../webgl-engine/lib/IntersectableGeometry.js";function b(t,e,r=null){const o=[],n=e.mapPositions;h(e,o);const i=o[0][1].data,a=o[0][1].indices.length,l=u(a);return T(e,o,l),w(e,o,l),y(e,o,l),D(e,o,l),A(e,o,l),E(e,o),j(e,o,l),I(e,o,i),new p(t,o,n,g.Line,r)}function h(t,e){const{attributeData:{position:r},removeDuplicateStartEnd:o}=t,n=F(r)&&o,i=r.length/3-(n?1:0),a=new Array(2*(i-1)),l=n?r.slice(0,-3):r;let s=0;for(let u=0;u<i-1;u++)a[s++]=u,a[s++]=u+1;e.push([m.POSITION,new f(l,a,3,n)])}function T(t,e,r){if(null!=t.attributeData.colorFeature)return;const n=t.attributeData.color;e.push([m.COLOR,new f(n??o,r,4)])}function y(t,e,r){t.attributeData.normal&&e.push([m.NORMAL,new f(t.attributeData.normal,r,3)])}function D(t,e,r){null!=t.attributeData.colorFeature&&e.push([m.COLORFEATUREATTRIBUTE,new f([t.attributeData.colorFeature],r,1,!0)])}function w(t,e,r){null==t.attributeData.sizeFeature&&e.push([m.SIZE,new f([t.attributeData.size??1],r,1,!0)])}function A(t,e,r){null!=t.attributeData.sizeFeature&&e.push([m.SIZEFEATUREATTRIBUTE,new f([t.attributeData.sizeFeature],r,1,!0)])}function E(t,e){const{attributeData:{position:r,timeStamps:o}}=t;if(!o)return;const n=r.length/3,i=new Array(2*(n-1));let a=0;for(let l=0;l<n-1;l++)i[a++]=l,i[a++]=l+1;e.push([m.TIMESTAMPS,new f(o,i,3)])}function j(t,e,r){null!=t.attributeData.opacityFeature&&e.push([m.OPACITYFEATUREATTRIBUTE,new f([t.attributeData.opacityFeature],r,1,!0)])}function I(r,o,s){if(null==r.overlayInfo||r.overlayInfo.renderCoordsHelper.viewingMode!==c.Global||!r.overlayInfo.spatialReference.isGeographic)return;const u=a(s.length),p=n(r.overlayInfo.spatialReference);for(let t=0;t<u.length;t+=3)i(s,t,u,t,p);const g=s.length/3,b=l(g+1);let h=d,T=R,y=0,D=0;t(h,u[D++],u[D++]),D++,b[0]=0;for(let n=1;n<g+1;++n)n===g&&(D=0),t(T,u[D++],u[D++]),D++,y+=e(h,T),b[n]=y,[h,T]=[T,h];o.push([m.DISTANCETOSTART,new f(b,o[0][1].indices,1,!0)])}function F(t){const e=t.length;return t[0]===t[e-3]&&t[1]===t[e-2]&&t[2]===t[e-1]}const d=r(),R=r();function v(t,e,r){if(null==t||0===t.length)return[];const o=[];return t.forEach((t,n)=>{const i=t.length,l=a(3*i);t.forEach((t,e)=>{l[3*e]=t[0],l[3*e+1]=t[1],l[3*e+2]=t[2]});const s=null!=r?O(r[n]):void 0,u={attributeData:{position:l,normal:e,timeStamps:s},removeDuplicateStartEnd:!1};o.push(u)}),o}function S(t,e=0,r=.01){const o=[0];for(let i=1;i<t.length;i++){const e=t[i-1],r=t[i],n=Math.sqrt((r[0]-e[0])**2+(r[1]-e[1])**2+(r[2]-e[2])**2);o.push(o[i-1]+n)}const n=o.map(t=>t*r);if(0!==e&&e<n.length){const t=n[e];for(let e=0;e<n.length;e++)n[e]-=t}return n}function O(t){const e=s(3*t.length),r=t[0],o=t[t.length-1];for(let n=0;n<t.length;n++)e[3*n]=t[n],e[3*n+1]=r,e[3*n+2]=o;return e}export{b as createGeometry,S as getLinearTimeStamps,v as lineStripsToParameters,O as timeStampsToAttribute};
|
|
@@ -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{_ as t}from"../../../../chunks/tslib.es6.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";import{loadImagery as r,createFlowFieldFromData as s,getStreamlines as o}from"../../../2d/engine/flow/dataUtils.js";import i from"../../layers/FlowSubView3D.js";import{StreamlinesResources3D as n}from"./StreamlinesResources3D.js";let a=class extends i{constructor(t){super(t)}initialize(){this.updatingHandles.add(()=>this.renderedTiles,()=>this.triggerLoad())}async load(t,e){const{simulationSettings:i}=this,{size:a,extent:l,timeExtent:c}=t;if(null==i)return;const m=await r(this.layer,l,a[0],a[1],c,e);if(null==m)return null;const u=s(i,m),p=o(i,u,a[0],a[1]),d=this.createGeometry(t,p);return new n(p,d)}};a=t([e("esri.views.3d.support.flow.FlowSubViewExtent3D")],a);export{a as default};
|
|
@@ -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{_ as t}from"../../../../chunks/tslib.es6.js";import{waitTick as e}from"../../../../core/promiseUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{clone as
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import{waitTick as e}from"../../../../core/promiseUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{clone as a}from"../../../../geometry/support/aaBoundingRect.js";import{getStreamlines as s,toFlowData as r}from"../../../2d/engine/flow/dataUtils.js";import l from"../../layers/FlowSubView3D.js";import{createFlowFieldFromDataTiled as o,FlowDataTile as n}from"./loadUtils.js";import{StreamlinesResources3D as d}from"./StreamlinesResources3D.js";import{LayerClass as u}from"../../terrain/LayerClass.js";import{isRasterTile as h}from"../../terrain/TerrainData.js";let c=class extends l{constructor(t){super(t),this._tileData=new Map}initialize(){this.addHandles([this.surface.on("tile-data-changed",({tile:t,layerIndex:e,layerClass:i})=>{const{renderedTiles:a}=this;null!=a&&e===this._layerIndex&&i===u.MAP&&this._updateFlowDataTile(t)})]),this.updatingHandles.add(()=>this.renderedTiles,t=>{const e=new Map;this.abort(),t?.forEach(t=>{const i=this._tileData.get(t.lij)??this._getFlowDataCopy(t);null!=i&&e.set(t.lij,i)}),this._tileData=e,this.triggerLoad()})}get _layerIndex(){return this.surface.getLayerIndexByUID(u.MAP,this.layerView.uid)}async load(t,i){const{simulationSettings:a,_tileData:r}=this,{size:l,extent:n}=t;if(null==a)return;if(null==r)return;await e({signal:i});const u={tileData:r,width:l[0],height:l[1]},h=o(a,u,n,this.surface.tilingScheme.pixelSize),c=s(a,h,l[0],l[1]),p=this.createGeometry(t,c);return new d(c,p)}_getFlowDataCopy(t){const{_layerIndex:e}=this;if(null==e)return null;const i=t.getLayerInfo(e,u.MAP);if(i.dataMissing||!t.hasLayerData(e,u.MAP))return null;const{data:s}=i;if(!h(s))return null;const l=r(this.layer.serviceRasterInfo.dataType,s.source);return new n(l.data,l.mask,l.width,l.height,t.lij,a(t.extent))}async _updateFlowDataTile(t){const{_layerIndex:e}=this;if(null==e)return;if(!this.renderedTiles?.has(t))return void(this._tileData.delete(t.lij)&&await this.triggerLoad());const i=this._tileData.get(t.lij),a=this._getFlowDataCopy(t);this._swapFlowData(t.lij,i,a)&&await this.triggerLoad()}_swapFlowData(t,e,i){return(null!=i||null!=e)&&(!(null!=i||!this._tileData.delete(t))||null!=i&&(this._tileData.set(t,i),!0))}};c=t([i("esri.views.3d.support.flow.FlowSubViewTiles3D")],c);export{c as default};
|
|
@@ -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,disposeMaybe as t}from"../../../../core/maybe.js";import{Object3D as i}from"../../webgl-engine/lib/Object3D.js";import{UpdatePolicy as s}from"../../webgl-engine/lib/UpdatePolicy.js";import{WebGLLayer as
|
|
5
|
+
import{destroyMaybe as e,disposeMaybe as t}from"../../../../core/maybe.js";import{Object3D as i}from"../../webgl-engine/lib/Object3D.js";import{UpdatePolicy as s}from"../../webgl-engine/lib/UpdatePolicy.js";import{WebGLLayer as r}from"../../webgl-engine/lib/WebGLLayer.js";class a{constructor(e,t){this.streamlines=e,this._geometries=t,this._object3D=null,this._engineLayer=null}get attached(){return null!=this._object3D&&null!=this._engineLayer}attach(e){const{_geometries:t}=this;if(null==t)return;this.detach();const a=new r(e,{pickable:!1,updatePolicy:s.SYNC}),n=new i({geometries:t});n.visible=!0,a.add(n),this._object3D=n,this._engineLayer=a}detach(){this.attached&&(this._engineLayer=e(this._engineLayer),this._object3D=t(this._object3D))}setMaterialParameters(e){this.attached&&this._geometries.forEach(t=>t.material.setParameters(e))}}export{a as StreamlinesResources3D};
|
|
@@ -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
|
|
5
|
+
import e from"../../../../Color.js";import n from"../../../../core/RandomLCG.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{zValueInAbsoluteHeightMode as o}from"../../../../support/elevationInfoUtils.js";import{lineStripsToParameters as r,createGeometry as i}from"../engineContent/line.js";import{RibbonLineMaterial as a}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{Animation as l}from"../../webgl-engine/shaders/AnimatedLine.glsl.js";import{CapType as m}from"../../webgl-engine/shaders/RibbonLineTechniqueConfiguration.js";function s(e,r,i,a,l){const{spatialReference:m}=e,s=i.map(n=>n.map(n=>{const[i,l]=f(n,r),{absoluteZ:s}=o(i,l,0,m,e,a),p=t(i,l,s);return e.renderCoordsHelper.toRenderCoords(p,m,p),p})),g=new n;return p(s,i.map(e=>{const n=e.map(e=>e.t),t=n[Math.floor(g.getIntRange(0,n.length))];for(let o=0;o<n.length;o++)n[o]-=t;return n}),c(l))}function p(e,n,t={}){const o=r(e,void 0,n),l=new a(t);return o.map(e=>i(l,e))}function f({x:e,y:n},t){const{extent:o,size:[r,i]}=t;return[e/r*o.width+o.xmin,(i-n)/i*o.height+o.ymin]}function c(n){return null==n?{}:{color:e.toUnitRGBA(n.color),width:n.trailWidth,cap:m.ROUND,animationSpeed:n.flowSpeed,trailLength:n.trailLength,animation:l.FadingTrail}}export{s as createFlowGeometry,c as materialParametersFromRenderer};
|
|
@@ -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
|
-
var A;!function(A){A[A.ELEVATION=0]="ELEVATION",A[A.BASEMAP=1]="BASEMAP",A[A.I3S_INDEX=2]="I3S_INDEX",A[A.I3S_DATA=3]="I3S_DATA",A[A.SYMBOLOGY=4]="SYMBOLOGY"}(A||(A={}));const
|
|
5
|
+
var A,E;!function(A){A[A.ELEVATION=0]="ELEVATION",A[A.BASEMAP=1]="BASEMAP",A[A.I3S_INDEX=2]="I3S_INDEX",A[A.I3S_DATA=3]="I3S_DATA",A[A.SYMBOLOGY=4]="SYMBOLOGY"}(A||(A={})),function(A){A[A.JSON=0]="JSON",A[A.BINARY=1]="BINARY",A[A.IMAGE=2]="IMAGE",A[A.IMAGE_AND_TYPE=3]="IMAGE_AND_TYPE"}(E||(E={}));const I=(()=>{const E=new Array;return E[A.ELEVATION]=10,E[A.BASEMAP]=10,E[A.I3S_INDEX]=10,E[A.I3S_DATA]=10,E[A.SYMBOLOGY]=5,E})(),S=30;export{A as ClientType,E as DocType,I as downloadSlotsPerClient,S as maxDownloadSlots};
|
|
@@ -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{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as t}from"../../../core/MapUtils.js";import{disposeMaybe as s}from"../../../core/maybe.js";import i from"../../../core/PooledArray.js";import{watch as n,on as o,syncAndInitial as a,initial as h}from"../../../core/reactiveUtils.js";import{someSet as l}from"../../../core/SetUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{ortho as u,fromTranslation as p}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{i as g}from"../../../chunks/vec32.js";import{ones as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{DrapeTargetType as m,DrapeSourceType as f,DrapedRenderGroup as y}from"../layers/interfaces.js";import{debugFlags as R}from"../support/debugFlags.js";import{OverlayIndex as b}from"./interfaces.js";import{Overlay as T}from"./Overlay.js";import{OverlayContent as x}from"./OverlayContent.js";import{OverlayRenderTargets as D}from"./OverlayRenderTargets.js";import w from"../webgl/RenderCamera.js";import{ShaderOutput as v}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{OverlayMode as C}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as O}from"../../../chunks/TextureOnly.glsl.js";import{SyncRenderPlugin as S}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as E,renderHighlightBuffer as P}from"../webgl-engine/effects/highlight/Highlight.js";import{RenderRequestType as j}from"../webgl-engine/lib/basicInterfaces.js";import{GLMaterialRepository as A}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as M}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderOccludedFlag as W}from"../webgl-engine/lib/Material.js";import{OITPass as I}from"../webgl-engine/lib/OITPass.js";import{RenderContext as N,defaultRenderOccludedMask as q}from"../webgl-engine/lib/RenderContext.js";import{RenderSlot as L}from"../webgl-engine/lib/RenderSlot.js";import{ShadowMap as V}from"../webgl-engine/lib/ShadowMap.js";import{TextureTechnique as F}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as H}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{Update as U}from"../webgl-engine/lib/Update.js";import{UpdatePolicy as k}from"../webgl-engine/lib/UpdatePolicy.js";import{AmbientLight as G}from"../webgl-engine/lighting/Lightsources.js";import{O as B}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as z}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as Y,noBudget as X}from"../../support/Scheduler.js";import{FramebufferBit as K,TextureSamplingMode as J}from"../../webgl/enums.js";import{Texture as Q}from"../../webgl/Texture.js";import{TextureDescriptor as Z}from"../../webgl/TextureDescriptor.js";let $=class extends S{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new B,this.hasHighlights=!1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new i,this._passParameters=new O,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new w,this.events=new r,this.longitudeCyclical=null,this.produces=new Map([[L.DRAPED_MATERIAL,e=>e!==v.Highlight||this.hasHighlights],[L.DRAPED_WATER,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1}initialize(){const e=this._view,r=e.stage,t=r.renderer.fboCache,{waterTextures:s,techniques:i}=r.renderView;this._renderContext=new N(this._rctx,new V(t,e.state.viewingMode),i),this.addHandles([n(()=>s.updating,()=>this.events.emit("content-changed"),a),n(()=>this.spatialReference,e=>this._localOriginFactory=new M(e),a),o(()=>e.allLayerViews,"after-changes",()=>this._sortedDrapeSourceRenderersDirty=!0),n(()=>E(e.state.highlights),()=>this._sortedDrapeSourceRenderersDirty=!0,h),n(()=>e.state.highlights,r=>{this._bindParameters.highlights=r,this._bindParameters.highlightOrderMap=e.state.highlightOrderMap},h),e.resourceController.scheduler.registerTask(Y.OVERLAY_RENDERER,this)]);const{_bindParameters:l,_camera:d}=this;d.near=1,d.far=1e4,d.relativeElevation=null,l.slot=L.DRAPED_MATERIAL,l.mainDepth=null,l.camera=d,l.oitPass=I.NONE,l.updateLighting([new G(_())],0,0,U.Immediate)}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._passParameters.texture=s(this._passParameters.texture),this.disposeOverlays(),this._renderContext=null,this._sortedRenderers.prune()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view.stage}get spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._pluginContext.materials}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}get pluginContext(){return this._pluginContext}initializeRenderContext(e){const r=new A(this._view.stage.renderView.textures,this._techniques,()=>{this.notifyChange("rendersOccludedDraped"),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")},()=>this.events.emit("content-changed"));this._pluginContext={...e,materials:r},this._techniques.precompile(z)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||t(this._renderers,e=>e.updating||e.canCompact)}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMaterialRenderer(e){for(const r of this._renderers.values()){const t=r.getMaterialRenderer(e);if(t)return t}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),this._sortedRenderers.map(e=>e.drapeSource.layer).filter(e=>!!e)}registerDrapeSource(e,r){const t=this._renderers.get(e);null!=t&&t.destroy(),this._renderers.set(e,r),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(n(()=>e.fullOpacity,()=>this.events.emit("content-changed")),e)}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(e){this._renderTargets?.dispose(e)}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&l(e,e=>e.drapeTargetType===m.WithoutRasterImage)}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=l(e,e=>e.drapeSourceType===f.Features),this._hasDrapedRasterSource=l(e,e=>e.drapeSourceType===f.RasterImage)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new D(this._stage.renderer.fboCache),this._overlays=[new T,new T]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(j.UPDATE),this._renderTargets=null,this.events.emit("textures-disposed")}getTexture(e){return e===x.ColorNoRasterImage&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource?this._renderTargets?.getTexture(x.Color):this._renderTargets?.getTexture(e)}get running(){return this.updating}runTask(e){this._processDrapeSources(e,()=>!0)}_processDrapeSources(e,r){let s=!1;for(const[t,i]of this._renderers){if(e.done)break;(t.destroyed||r(t))&&(i.commitChanges()&&(s=!0,e.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,s=!0,this._updateSortedDrapeSourceRenderers(),e.madeProgress()),this.compact(e),s&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this.events.emit("content-changed"),this.hasHighlights=t(this._renderers,e=>e.hasHighlights),this.notifyChange("rendersOccludedDraped"))}compact(e){let r=!1;for(const t of this._renderers.values()){if(e.done)break;r=t.compact(e)||r}return r&&this.notifyChange("updating"),r}hasHighlight(e){return t(this._renderers,r=>r.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(X,e=>e.updatePolicy===k.SYNC)}get isEmpty(){return!R.OVERLAY_DRAW_DEBUG_TEXTURE&&!t(this._renderers,e=>!e.isEmpty)}get hasWater(){const e=t(this._renderers,({hasWater:e})=>e);return e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water")),this._hasWater}get rendersOccludedDraped(){const e=this._renderContext.renderOccludedMask;this._renderContext.renderOccludedMask=se,++this._techniques.precompiling;const r=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._renderContext.renderOccludedMask=e,r}renders(e){if(R.OVERLAY_DRAW_DEBUG_TEXTURE&&e!==x.Occluded&&e!==x.Highlight)return!0;if(!this._overlays)return!1;const r=this._overlays[b.INNER];for(const i of this._overlays)i.setupGeometryViews(this.longitudeCyclical);if(!r.hasSomeSizedView())return!1;const t=this._renderContext.output;this._renderContext.output=this._renderTargets?.targets.find(r=>r.content===e)?.output??v.Color,++this._techniques.precompiling;const s=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._renderContext.output=t,s}get mode(){return this.isEmpty?C.Disabled:this.hasWater&&this.renders(x.WaterNormal)?C.EnabledWithWater:this._renderTargets?.getTexture(x.Color)?C.Enabled:C.Disabled}updateAnimation(e){let r=!1;return this._renderers.forEach(t=>r=t.updateAnimation(e)||r),r&&this.parent.requestRender(j.BACKGROUND),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;const r=this._bindParameters;r.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const t of this._renderTargets.targets){if(t.content===x.ColorNoRasterImage&&!this._needsColorWithoutRasterImage)continue;const e=t.output;this._renderContext.output=e,r.slot=e===v.Normal?L.DRAPED_WATER:L.DRAPED_MATERIAL,e===v.Highlight&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null),t.content===x.Occluded&&(this._renderContext.renderOccludedMask=se),this._sortedRenderers.forAll(({drapeSource:e,renderer:r})=>{t.content===x.ColorNoRasterImage&&e.drapeSourceType===f.RasterImage||r.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=q,r.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,r){if(this._overlays&&this._renderTargets){for(const e of this._overlays)e.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;for(const e of this._renderTargets.targets){if(r===j.BACKGROUND&&e.content!==x.WaterNormal||e.content===x.ColorNoRasterImage&&!this._needsColorWithoutRasterImage)continue;const t=this._drawTarget(b.INNER,e),s=this._drawTarget(b.OUTER,e);(t||s)&&e.fbo.generateMipMap()}}}_drawTarget(e,r){const t=this._overlays[e],s=t.canvasGeometries;if(0===s.numViews)return!1;const i=this._view.state.contentPixelRatio;this._screenToWorldRatio=i*t.mapUnitsPerPixel/this._bindParameters.overlayStretch;const{output:n}=r;if(this.isEmpty||n===v.Normal&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:o,_camera:a,_renderContext:h,_bindParameters:l}=this;if(a.pixelRatio=t.pixelRatio*i,h.output=n,l.screenToWorldRatio=this._screenToWorldRatio,l.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,l.slot=n===v.Normal?L.DRAPED_WATER:L.DRAPED_MATERIAL,r.content===x.Occluded&&(h.renderOccludedMask=se),!this.renders(r.content))return h.renderOccludedMask=q,!1;const{resolution:d}=t,c=e===b.INNER,u=c?0:d;if(o.setViewport(u,0,d,d),this._bindTargetFBO(r),c)if(r.output!==v.Highlight)o.setClearColor(0,0,0,0),o.clear(K.COLOR);else{const{gl:e}=o;e.clearBufferuiv(e.COLOR,0,[0,0,0,0])}if(R.OVERLAY_DRAW_DEBUG_TEXTURE&&r.content!==x.Occluded&&r.content!==x.Highlight){this._techniques.precompile(F,ie);const r=this._techniques.get(F,ie);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,re[e]),o.bindTechnique(r,l,this._passParameters),o.screen.draw()}if(r.output===v.Highlight){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),P(o,t,{width:s,height:s},l,()=>this._renderAllGeometry(e,r),u)}else this._renderAllGeometry(e,r);return o.bindFramebuffer(null),h.renderOccludedMask=q,!0}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:n})=>{if(r.content===x.ColorNoRasterImage&&i.drapeSourceType===f.RasterImage)return;const{fullOpacity:o}=i,a=null!=o&&o<1&&r.output===v.Color&&this._bindTemporaryFBO();for(let e=0;e<s.numViews;e++)this._setViewParameters(s.extents[e],t),n.render(this._renderContext);if(a){this._bindTargetFBO(r),this._overlayParameters.texture=a.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const t=this._techniques.get(z);this._rctx.bindTechnique(t,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),a.release()}})}_bindTargetFBO(e){const r=this._resolution,t=2*r;e.fbo.ensureFramebuffer(t,r),e.fbo.bind(this._rctx)}_bindTemporaryFBO(){const e=this._resolution,r=2*e,t=this._stage.renderer.fboCache,s=t.acquire(r,e,"overlay tmp");return t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(K.COLOR),s}get _resolution(){return this._overlays?.[b.INNER].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}intersect(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:n}of this._sortedRenderers)i=n.intersect?.(e,r,t,s,i)??i}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this._view.map.allLayers,r=e.length;this._renderers.forEach((t,s)=>{const i=e.indexOf(s.layer),n=i>=0,o=s.renderGroup??(n?y.MapLayer:y.ViewLayer),a=s.drapeSourcePriorityOffset??0,h=r*o+(n?i:0)+a;this._sortedRenderers.push(new ee(s,t,h))}),this._sortedRenderers.sort((e,r)=>e.index-r.index)}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],u(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),p(t.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,r){if(g(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let n=0;n<e;n++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(n/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&n?0:255:1&i^1&o?0:128)}const i=new Z(e);i.samplingMode=J.NEAREST,this._passParameters.texture=new Q(this._rctx,i,t)}get test(){}};e([d()],$.prototype,"hasHighlights",void 0),e([d()],$.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([d({constructOnly:!0})],$.prototype,"parent",void 0),e([d({readOnly:!0})],$.prototype,"_techniques",null),e([d({type:Boolean,readOnly:!0})],$.prototype,"updating",null),e([d()],$.prototype,"isEmpty",null),e([d({readOnly:!0})],$.prototype,"rendersOccludedDraped",null),$=e([c("esri.views.3d.terrain.OverlayRenderer")],$);class ee{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const re=[[1,.5,.5],[.5,.5,1]],te=-2,se=W.OccludeAndTransparent,ie=new H;ie.hasAlpha=!0;export{$ as OverlayRenderer,te as drapedZ,se as overlayRenderOccludedFlag};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Evented.js";import"../../../core/has.js";import{someMap as t,everyMap as s}from"../../../core/MapUtils.js";import{disposeMaybe as i}from"../../../core/maybe.js";import n from"../../../core/PooledArray.js";import{watch as o,on as a,syncAndInitial as h,initial as l}from"../../../core/reactiveUtils.js";import{someSet as d}from"../../../core/SetUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{ortho as p,fromTranslation as g}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{i as _}from"../../../chunks/vec32.js";import{ones as m}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{DrapeTargetType as f,DrapeSourceType as y,DrapedRenderGroup as R}from"../layers/interfaces.js";import{debugFlags as b}from"../support/debugFlags.js";import{OverlayIndex as T}from"./interfaces.js";import{Overlay as x}from"./Overlay.js";import{OverlayContent as D}from"./OverlayContent.js";import{OverlayRenderTargets as w}from"./OverlayRenderTargets.js";import v from"../webgl/RenderCamera.js";import{ShaderOutput as O}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{OverlayMode as C}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as S}from"../../../chunks/TextureOnly.glsl.js";import{SyncRenderPlugin as E}from"../webgl-engine/effects/RenderPlugin.js";import{trackHighlightOptions as P,renderHighlightBuffer as j}from"../webgl-engine/effects/highlight/Highlight.js";import{RenderRequestType as A}from"../webgl-engine/lib/basicInterfaces.js";import{GLMaterialRepository as M}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as W}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderOccludedFlag as I}from"../webgl-engine/lib/Material.js";import{OITPass as N}from"../webgl-engine/lib/OITPass.js";import{RenderContext as q,defaultRenderOccludedMask as L}from"../webgl-engine/lib/RenderContext.js";import{RenderSlot as V}from"../webgl-engine/lib/RenderSlot.js";import{ShadowMap as F}from"../webgl-engine/lib/ShadowMap.js";import{TextureTechnique as H}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as U}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{Update as k}from"../webgl-engine/lib/Update.js";import{UpdatePolicy as G}from"../webgl-engine/lib/UpdatePolicy.js";import{AmbientLight as B}from"../webgl-engine/lighting/Lightsources.js";import{O as z}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as Y}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as X,noBudget as K}from"../../support/Scheduler.js";import{FramebufferBit as J,TextureSamplingMode as Q}from"../../webgl/enums.js";import{Texture as Z}from"../../webgl/Texture.js";import{TextureDescriptor as $}from"../../webgl/TextureDescriptor.js";let ee=class extends E{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new z,this.hasHighlights=!1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new n,this._passParameters=new S,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new v,this.events=new r,this.longitudeCyclical=null,this.produces=new Map([[V.DRAPED_MATERIAL,e=>e!==O.Highlight||this.hasHighlights],[V.DRAPED_WATER,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1}initialize(){const e=this._view,r=e.stage,t=r.renderer.fboCache,{waterTextures:s,techniques:i}=r.renderView;this._renderContext=new q(this._rctx,new F(t,e.state.viewingMode),i),this.addHandles([o(()=>s.updating,()=>this.events.emit("content-changed"),h),o(()=>this.spatialReference,e=>this._localOriginFactory=new W(e),h),a(()=>e.allLayerViews,"after-changes",()=>this._sortedDrapeSourceRenderersDirty=!0),o(()=>P(e.state.highlights),()=>this._sortedDrapeSourceRenderersDirty=!0,l),o(()=>e.state.highlights,r=>{this._bindParameters.highlights=r,this._bindParameters.highlightOrderMap=e.state.highlightOrderMap},l),e.resourceController.scheduler.registerTask(X.OVERLAY_RENDERER,this)]);const{_bindParameters:n,_camera:d}=this;d.near=1,d.far=1e4,d.relativeElevation=null,n.slot=V.DRAPED_MATERIAL,n.mainDepth=null,n.camera=d,n.oitPass=N.NONE,n.updateLighting([new B(m())],0,0,k.Immediate)}destroy(){this._renderers.forEach(e=>e.destroy()),this._renderers.clear(),this._passParameters.texture=i(this._passParameters.texture),this.disposeOverlays(),this._renderContext=null,this._sortedRenderers.prune()}get _bindParameters(){return this._renderContext.bind}get _rctx(){return this._stage.renderView.renderingContext}get _view(){return this.parent.view}get _stage(){return this.parent.view.stage}get spatialReference(){return this.parent.spatialReference}get _techniques(){return this._stage.renderView.techniques}get rctx(){return this._rctx}get materials(){return this._pluginContext.materials}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}get pluginContext(){return this._pluginContext}initializeRenderContext(e){const r=new M(this._view.stage.renderView.textures,this._techniques,()=>{this.notifyChange("rendersOccludedDraped"),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")},()=>this.events.emit("content-changed"));this._pluginContext={...e,materials:r},this._techniques.precompile(Y)}uninitializeRenderContext(){}acquireTechniques(){return[]}render(){}get updating(){return this._sortedDrapeSourceRenderersDirty||t(this._renderers,e=>e.updating||e.canCompact)}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMaterialRenderer(e){for(const r of this._renderers.values()){const t=r.getMaterialRenderer(e);if(t)return t}return null}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),this._sortedRenderers.map(e=>e.drapeSource.layer).filter(e=>!!e)}registerDrapeSource(e,r){const t=this._renderers.get(e);null!=t&&t.destroy(),this._renderers.set(e,r),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(o(()=>e.fullOpacity,()=>this.events.emit("content-changed")),e)}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(e){this._renderTargets?.dispose(e)}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&d(e,e=>e.drapeTargetType===f.WithoutRasterImage)}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=d(e,e=>e.drapeSourceType===y.Features),this._hasDrapedRasterSource=d(e,e=>e.drapeSourceType===y.RasterImage)):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new w(this._stage.renderer.fboCache),this._overlays=[new x,new x]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets?.dispose(A.UPDATE),this._renderTargets=null,this.events.emit("textures-disposed")}_useOverlayColorInsteadOfColorNoRasterImage(e){return e===D.ColorNoRasterImage&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource}getTexture(e){return this._useOverlayColorInsteadOfColorNoRasterImage(e)?this._renderTargets?.getTexture(D.Color):this._renderTargets?.getTexture(e)}get running(){return this.updating}runTask(e){this._processDrapeSources(e,()=>!0)}_processDrapeSources(e,r){let s=!1;for(const[t,i]of this._renderers){if(e.done)break;(t.destroyed||r(t))&&(i.commitChanges()&&(s=!0,e.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,s=!0,this._updateSortedDrapeSourceRenderers(),e.madeProgress()),this.compact(e),s&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this.events.emit("content-changed"),this.hasHighlights=t(this._renderers,e=>e.hasHighlights),this.notifyChange("rendersOccludedDraped"))}compact(e){let r=!1;for(const t of this._renderers.values()){if(e.done)break;r=t.compact(e)||r}return r&&this.notifyChange("updating"),r}hasHighlight(e){return t(this._renderers,r=>r.hasHighlight(e))}processSyncDrapeSources(){this._processDrapeSources(K,e=>e.updatePolicy===G.SYNC)}get isEmpty(){return!b.OVERLAY_DRAW_DEBUG_TEXTURE&&s(this._renderers,e=>e.isEmpty)}get hasWater(){const e=t(this._renderers,({hasWater:e})=>e);return e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water")),this._hasWater}get rendersOccludedDraped(){const e=this._renderContext.renderOccludedMask;this._renderContext.renderOccludedMask=ie,++this._techniques.precompiling;const r=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._renderContext.renderOccludedMask=e,r}renders(e){if(b.OVERLAY_DRAW_DEBUG_TEXTURE&&e!==D.Occluded&&e!==D.Highlight)return!0;if(!this._overlays)return!1;const r=this._overlays[T.INNER];for(const i of this._overlays)i.setupGeometryViews(this.longitudeCyclical);if(!r.hasSomeSizedView())return!1;const t=this._renderContext.output;this._renderContext.output=this._renderTargets?.targets.find(r=>r.content===e)?.output??O.Color,++this._techniques.precompiling;const s=this._sortedRenderers.some(({renderer:e})=>e.precompile(this._renderContext));return--this._techniques.precompiling,this._renderContext.output=t,s}get mode(){return this.isEmpty?C.Disabled:this.hasWater&&this.renders(D.WaterNormal)?C.EnabledWithWater:this._renderTargets?.getTexture(D.Color)?C.Enabled:C.Disabled}updateAnimation(e){let r=!1;return this._renderers.forEach(t=>r=t.updateAnimation(e)||r),r&&this.parent.requestRender(A.BACKGROUND),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}precompileShaders(e){if(!this._overlays||!this._renderTargets)return!1;const r=this._bindParameters;r.alignPixelEnabled=e.alignPixelEnabled,++this._techniques.precompiling;for(const t of this._renderTargets.targets){if(t.content===D.ColorNoRasterImage&&!this._needsColorWithoutRasterImage)continue;const e=t.output;this._renderContext.output=e,r.slot=e===O.Normal?V.DRAPED_WATER:V.DRAPED_MATERIAL,e===O.Highlight&&(r.highlightMixTexture=r.highlights.length>1?this._rctx.emptyTexture:null),t.content===D.Occluded&&(this._renderContext.renderOccludedMask=ie),this._sortedRenderers.forAll(({drapeSource:e,renderer:r})=>{t.content===D.ColorNoRasterImage&&e.drapeSourceType===y.RasterImage||r.precompile(this._renderContext)}),this._renderContext.renderOccludedMask=L,r.highlightMixTexture=null}return--this._techniques.precompiling,!0}drawOverlays(e,r){if(!this._overlays||!this._renderTargets)return;for(const s of this._overlays)s.setupGeometryViews(this.longitudeCyclical);this._bindParameters.alignPixelEnabled=e.alignPixelEnabled;const t=this.allSourcesOccludees;for(const s of this._renderTargets.targets){if(r===A.BACKGROUND&&s.content!==D.WaterNormal||s.content===D.ColorNoRasterImage&&!this._needsColorWithoutRasterImage||s.content===D.Occluded&&t)continue;const e=this._drawTarget(T.INNER,s),i=this._drawTarget(T.OUTER,s);(e||i)&&s.fbo.generateMipMap()}}_drawTarget(e,r){const t=this._overlays[e],s=t.canvasGeometries;if(0===s.numViews)return!1;const i=this._view.state.contentPixelRatio;this._screenToWorldRatio=i*t.mapUnitsPerPixel/this._bindParameters.overlayStretch;const{output:n}=r;if(this.isEmpty||n===O.Normal&&!this.hasWater||!t.hasSomeSizedView())return!1;const{_rctx:o,_camera:a,_renderContext:h,_bindParameters:l}=this;if(a.pixelRatio=t.pixelRatio*i,h.output=n,l.screenToWorldRatio=this._screenToWorldRatio,l.screenToPCSRatio=this._screenToWorldRatio*this.parent.worldToPCSRatio,l.slot=n===O.Normal?V.DRAPED_WATER:V.DRAPED_MATERIAL,r.content===D.Occluded&&(h.renderOccludedMask=ie),!this.renders(r.content))return h.renderOccludedMask=L,!1;const{resolution:d}=t,c=e===T.INNER,u=c?0:d;if(o.setViewport(u,0,d,d),this._bindTargetFBO(r),c)if(r.output!==O.Highlight)o.setClearColor(0,0,0,0),o.clear(J.COLOR);else{const{gl:e}=o;e.clearBufferuiv(e.COLOR,0,[0,0,0,0])}if(b.OVERLAY_DRAW_DEBUG_TEXTURE&&r.content!==D.Occluded&&r.content!==D.Highlight){this._techniques.precompile(H,ne);const r=this._techniques.get(H,ne);for(let i=0;i<s.numViews;i++)this._setViewParameters(s.extents[i],t),this._ensureDebugPatternResources(t.resolution,te[e]),o.bindTechnique(r,l,this._passParameters),o.screen.draw()}if(r.output===O.Highlight){const{fboCache:t}=this._stage.renderer,s=this._resolution;this._bindTargetFBO(r),j(o,t,{width:s,height:s},l,()=>this._renderAllGeometry(e,r),u)}else this._renderAllGeometry(e,r);return o.bindFramebuffer(null),h.renderOccludedMask=L,!0}get allSourcesOccludees(){const e=s(this._renderers,e=>e.hasOnlyOccludees);return this._renderers?.size>0&&e}_renderAllGeometry(e,r){const t=this._overlays[e],s=t.canvasGeometries;this._sortedRenderers.forAll(({drapeSource:i,renderer:n})=>{if(r.content===D.ColorNoRasterImage&&i.drapeSourceType===y.RasterImage)return;const{fullOpacity:o}=i,a=null!=o&&o<1&&r.output===O.Color&&this._bindTemporaryFBO();for(let e=0;e<s.numViews;e++)this._setViewParameters(s.extents[e],t),n.render(this._renderContext);if(a){this._bindTargetFBO(r),this._overlayParameters.texture=a.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const t=this._techniques.get(Y);this._rctx.bindTechnique(t,this._bindParameters,this._overlayParameters),this._rctx.screen.draw(),a.release()}})}_bindTargetFBO(e){const r=this._resolution,t=2*r;e.fbo.ensureFramebuffer(t,r),e.fbo.bind(this._rctx)}_bindTemporaryFBO(){const e=this._resolution,r=2*e,t=this._stage.renderer.fboCache,s=t.acquire(r,e,"overlay tmp");return t.rctx.bindFramebuffer(s.fbo),t.rctx.clear(J.COLOR),s}get _resolution(){return this._overlays?.[T.INNER].resolution??0}notifyContentChanged(){this.events.emit("content-changed")}intersect(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:n}of this._sortedRenderers)i=n.intersect?.(e,r,t,s,i)??i}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this._view.map.allLayers,r=e.length;this._renderers.forEach((t,s)=>{const i=e.indexOf(s.layer),n=i>=0,o=s.renderGroup??(n?R.MapLayer:R.ViewLayer),a=s.drapeSourcePriorityOffset??0,h=r*o+(n?i:0)+a;this._sortedRenderers.push(new re(s,t,h))}),this._sortedRenderers.sort((e,r)=>e.index-r.index)}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],p(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),g(t.viewMatrix,[-e[0],-e[1],0])}_ensureDebugPatternResources(e,r){if(_(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let n=0;n<e;n++)for(let r=0;r<e;r++){const i=Math.floor(r/10),o=Math.floor(n/10);i<2||o<2||10*i>e-20||10*o>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&o?1&r^1&n?0:255:1&i^1&o?0:128)}const i=new $(e);i.samplingMode=Q.NEAREST,this._passParameters.texture=new Z(this._rctx,i,t)}get test(){}};e([c()],ee.prototype,"hasHighlights",void 0),e([c()],ee.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([c({constructOnly:!0})],ee.prototype,"parent",void 0),e([c({readOnly:!0})],ee.prototype,"_techniques",null),e([c({type:Boolean,readOnly:!0})],ee.prototype,"updating",null),e([c()],ee.prototype,"isEmpty",null),e([c({readOnly:!0})],ee.prototype,"rendersOccludedDraped",null),ee=e([u("esri.views.3d.terrain.OverlayRenderer")],ee);class re{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const te=[[1,.5,.5],[.5,.5,1]],se=-2,ie=I.OccludeAndTransparent,ne=new U;ne.hasAlpha=!0;export{ee as OverlayRenderer,se as drapedZ,ie as overlayRenderOccludedFlag};
|