@arcgis/core 6.0.0-next.36 → 6.0.0-next.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analysis/DimensionAnalysis.js +1 -1
- package/analysis/DimensionSimpleStyle.js +1 -1
- package/analysis/LengthDimension.js +1 -1
- package/analysis/LineOfSightAnalysis.js +1 -1
- package/analysis/LineOfSightAnalysisTarget.js +1 -1
- package/analysis/Viewshed.js +1 -1
- package/analysis/ViewshedAnalysis.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{0202eb8c2b2865f99981.js → 00311d1b18d5952a014b.js} +1 -1
- package/assets/esri/core/workers/chunks/{9503eedfdda55fc5adab.js → 091ec4fe83038f3558f4.js} +1 -1
- package/assets/esri/core/workers/chunks/0b21d0e2e5a91c34a108.js +1 -0
- package/assets/esri/core/workers/chunks/{322b22a5d54e404bebd5.js → 0c893837f67829757df7.js} +1 -1
- package/assets/esri/core/workers/chunks/123541f79be7adff0818.js +1 -0
- package/assets/esri/core/workers/chunks/{155861fbd0e5fc2db80c.js → 1a91443970d64a59521d.js} +1 -1
- package/assets/esri/core/workers/chunks/1e37337f47f45d6d8005.js +1 -0
- package/assets/esri/core/workers/chunks/{4e5405134d079bdf9b7a.js → 1f76f6dcdae9f55389cb.js} +1 -1
- package/assets/esri/core/workers/chunks/{f717005e14a7e9141df7.js → 2050c844b5a29b1df28a.js} +1 -1
- package/assets/esri/core/workers/chunks/2c3612379111457c3221.js +1 -0
- package/assets/esri/core/workers/chunks/2d16b5a44f840147e882.js +1 -0
- package/assets/esri/core/workers/chunks/{d9a240a3c6bf85124474.js → 342a97974a78007b25e0.js} +1 -1
- package/assets/esri/core/workers/chunks/34467f7d84baffd772a3.js +1 -0
- package/assets/esri/core/workers/chunks/396299c22994c502e41c.js +1 -0
- package/assets/esri/core/workers/chunks/{03daf6f235c6edef6268.js → 398ec098fffe6abceedd.js} +1 -1
- package/assets/esri/core/workers/chunks/3b32a24488b3068f0cb7.js +1 -0
- package/assets/esri/core/workers/chunks/3b5e9e0b180dc10491ec.js +1 -0
- package/assets/esri/core/workers/chunks/{4d18b48d4a282a0f341c.js → 427d929dc7f89b0a1ea9.js} +1 -1
- package/assets/esri/core/workers/chunks/432728c557be5dfa26b5.js +1 -0
- package/assets/esri/core/workers/chunks/46969f379623810b2eca.js +1 -0
- package/assets/esri/core/workers/chunks/46edd6c9ed6701e6b975.js +1 -0
- package/assets/esri/core/workers/chunks/{8b0d5551978ab0aac0d1.js → 520f499d79fa71f262c7.js} +1 -1
- package/assets/esri/core/workers/chunks/5473409fee59db80f87d.js +1 -0
- package/assets/esri/core/workers/chunks/553a8bf5bc5c56d1bcaf.js +1 -0
- package/assets/esri/core/workers/chunks/{2211ff0a1f1ae8100231.js → 585ae43c7bcb86a26762.js} +1 -1
- package/assets/esri/core/workers/chunks/58716a3a6106a1b0fb9d.js +1 -0
- package/assets/esri/core/workers/chunks/{aa6ee2aa4ff6e6d41efb.js → 5882f349f3771868e67f.js} +1 -1
- package/assets/esri/core/workers/chunks/592b5db1459c02cf6a0c.js +1 -0
- package/assets/esri/core/workers/chunks/{1b17f5f720f6cf3f6d73.js → 5be386b3af867b19ff39.js} +1 -1
- package/assets/esri/core/workers/chunks/{ea81f9d71b0842a4be26.js → 5e48898cebb6dbaf09b5.js} +1 -1
- package/assets/esri/core/workers/chunks/6a21dc13a465757ba007.js +1 -0
- package/assets/esri/core/workers/chunks/{139e753d95cfc9470e74.js → 6a65fc1a2931230fe994.js} +1 -1
- package/assets/esri/core/workers/chunks/{3e406043a374ee17475b.js → 6f2e7e663229b223b4df.js} +1 -1
- package/assets/esri/core/workers/chunks/{379db67f78161ebd5468.js → 7023651ed6398dcf8efb.js} +1 -1
- package/assets/esri/core/workers/chunks/{90360c0bd053d3e3fd77.js → 7027a0e7bfabb3bb7fc2.js} +1 -1
- package/assets/esri/core/workers/chunks/76e80381fa6d1e084796.js +1 -0
- package/assets/esri/core/workers/chunks/78818c2a898444f7e890.js +1 -0
- package/assets/esri/core/workers/chunks/{40c2674dae73f0942751.js → 7d497df6e13162156342.js} +1 -1
- package/assets/esri/core/workers/chunks/{3b380e64566a6cce59e2.js → 7e0ed6e8f7b77e43f628.js} +1 -1
- package/assets/esri/core/workers/chunks/8c3779de09291170497f.js +1 -0
- package/assets/esri/core/workers/chunks/8e391b5b82429f39791e.js +1 -0
- package/assets/esri/core/workers/chunks/947f3a1cad976bba9738.js +1 -0
- package/assets/esri/core/workers/chunks/{59a1b637d2c107504a04.js → 966204d6dedc8149c3e9.js} +1 -1
- package/assets/esri/core/workers/chunks/9826baa3c15ea2062669.js +1 -0
- package/assets/esri/core/workers/chunks/{d3369ffed19f4c264dcd.js → 9ab0735e86cf8932bf9d.js} +1 -1
- package/assets/esri/core/workers/chunks/ab0ea4042f4e13874aed.js +1 -0
- package/assets/esri/core/workers/chunks/ab98ade3257360015d6c.js +1 -0
- package/assets/esri/core/workers/chunks/ac107079342251a984dd.js +1 -0
- package/assets/esri/core/workers/chunks/{572aec57593a08b8045b.js → b15a8d4322f3b7819d2f.js} +1 -1
- package/assets/esri/core/workers/chunks/{552c36b40e5a5ec117fb.js → b472c0a21ae29e653f7d.js} +1 -1
- package/assets/esri/core/workers/chunks/b90271ce38522bcf813b.js +1 -0
- package/assets/esri/core/workers/chunks/ba91df9835cdea7698a9.js +1 -0
- package/assets/esri/core/workers/chunks/bdd76a0b6c14e7fb6984.js +1 -0
- package/assets/esri/core/workers/chunks/bfe13ac9fa1aafb190a1.js +1 -0
- package/assets/esri/core/workers/chunks/{f372f4eb5527238c46f5.js → c31830ee897d5a7f2582.js} +1 -1
- package/assets/esri/core/workers/chunks/c48d97c38e821be17dc5.js +1 -0
- package/assets/esri/core/workers/chunks/{0a508e25ec05363e1f04.js → c7ad62f54d2abe1d17a0.js} +1 -1
- package/assets/esri/core/workers/chunks/cb1642ea8b66231cbfb5.js +1 -0
- package/assets/esri/core/workers/chunks/ce0274847ccce6a1ac53.js +1 -0
- package/assets/esri/core/workers/chunks/cf21b217b13770757cb8.js +1 -0
- package/assets/esri/core/workers/chunks/cf2e5f827cea7d7319ce.js +1 -0
- package/assets/esri/core/workers/chunks/d42a4f47843e075c56a8.js +1 -0
- package/assets/esri/core/workers/chunks/dae2036faa28dade2119.js +1 -0
- package/assets/esri/core/workers/chunks/e2430bc3a1edeb5c3266.js +1 -0
- package/assets/esri/core/workers/chunks/e9457a67befc61e11095.js +1 -0
- package/assets/esri/core/workers/chunks/f06ef153e106b26a6748.js +1 -0
- package/assets/esri/core/workers/chunks/faae3c43048b42341536.js +1 -0
- package/assets/esri/core/workers/chunks/fc77eb7683e708774168.js +1 -0
- package/assets/esri/core/workers/chunks/fd967a9f3cf0e2890dbb.js +1 -0
- package/chunks/Clouds.glsl.js +7 -11
- package/chunks/h.js +2 -0
- package/chunks/projector.js +2 -0
- package/config.js +1 -1
- package/core/libs/gl-matrix-2/math/vec3.js +1 -1
- package/core/sanitizerUtils.js +1 -1
- package/form/FormTemplate.js +1 -1
- package/form/elements/Element.js +1 -1
- package/form/elements/FieldElement.js +1 -1
- package/geometry/ellipsoidUtils.js +4 -4
- package/geometry/support/frustumPlanes.js +1 -1
- package/geometry/support/plane.js +1 -1
- package/geometry/support/triangle.js +1 -1
- package/kernel.js +1 -1
- package/layers/BaseElevationLayer.js +1 -1
- package/layers/ElevationLayer.js +1 -1
- package/layers/GraphicsLayer.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/IntegratedMeshLayer.d.ts +2 -0
- package/layers/IntegratedMeshLayer.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/geospatialPDF/geospatialPDFParserUtils.js +1 -1
- package/layers/geospatialPDF/support/datumUtils.js +2 -0
- package/layers/geospatialPDF/support/ellipsoidUtils.js +2 -0
- package/layers/geospatialPDF/support/geographicProjectionUtils.js +2 -0
- package/layers/geospatialPDF/support/parameterUtils.js +2 -0
- package/layers/geospatialPDF/support/projectedProjectionUtils.js +3 -0
- package/layers/geospatialPDF/support/projectionToSpatialReference.js +2 -0
- package/layers/geospatialPDF/support/statePlaneUtils.js +2 -0
- package/layers/geospatialPDF/support/unitUtils.js +2 -0
- package/layers/geospatialPDF/support/validateProjectionUtils.js +2 -0
- package/layers/graphics/sources/support/clientSideDefaults.js +2 -2
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
- package/layers/ogc/ogcFeatureUtils.js +1 -1
- package/layers/save/imageryUtils.js +1 -1
- package/layers/save/mediaLayerUtils.js +1 -1
- package/layers/save/streamLayerUtils.js +1 -1
- package/layers/support/ControlPoint.js +1 -1
- package/layers/support/ControlPointsGeoreference.js +1 -1
- package/layers/support/DimensionalDefinition.js +1 -1
- package/layers/support/ElevationQuery.js +1 -1
- package/layers/support/LabelClass.js +1 -1
- package/layers/support/LabelExpressionInfo.js +1 -1
- package/layers/support/MediaElementBase.js +1 -1
- package/layers/support/MosaicRule.js +1 -1
- package/layers/support/MultidimensionalSubset.js +1 -1
- package/layers/support/RasterBandInfo.js +1 -1
- package/layers/support/RasterFunction.js +1 -1
- package/layers/support/RasterFunctionTemplate.js +1 -1
- package/layers/support/RasterInfo.js +1 -1
- package/layers/support/RasterSensorInfo.js +1 -1
- package/layers/support/RasterStorageInfo.js +1 -1
- package/layers/support/VideoElement.js +1 -1
- package/layers/support/layersLoader.js +1 -1
- package/layers/video/VideoController.js +3 -3
- package/layers/video/types.d.ts +12 -0
- package/legend/ActiveLayerInfo.d.ts +5 -1
- package/legend/ActiveLayerInfo.js +1 -1
- package/libs/maquette-advanced-projector/projector.js +1 -1
- package/linkChart/LayoutSettings.js +1 -1
- package/linkChart/RootedLayoutSettings.js +1 -1
- package/package.json +3 -3
- package/renderers/FlowRenderer.js +1 -1
- package/renderers/RasterColormapRenderer.js +1 -1
- package/renderers/RasterShadedReliefRenderer.js +1 -1
- package/renderers/RasterStretchRenderer.js +1 -1
- package/renderers/VectorFieldRenderer.js +1 -1
- package/renderers/support/ColormapInfo.js +1 -1
- package/renderers/support/RasterPresetRenderer.js +1 -1
- package/renderers/support/rasterRendererHelper.js +1 -1
- package/rest/knowledgeGraph/GraphApplyEdits.js +1 -1
- package/rest/support/BaseImageMeasureParameters.js +1 -1
- package/rest/support/BaseImageMeasureResult.js +1 -1
- package/rest/support/FindImagesParameters.js +1 -1
- package/rest/support/FindImagesResult.js +1 -1
- package/rest/support/ImageAngleParameters.js +1 -1
- package/rest/support/ImageAngleResult.js +1 -1
- package/rest/support/ImageAreaParameters.js +1 -1
- package/rest/support/ImageAreaResult.js +1 -1
- package/rest/support/ImageBoundaryParameters.js +1 -1
- package/rest/support/ImageBoundaryResult.js +1 -1
- package/rest/support/ImageDistanceParameters.js +1 -1
- package/rest/support/ImageDistanceResult.js +1 -1
- package/rest/support/ImageGPSInfoParameters.js +1 -1
- package/rest/support/ImageGPSInfoResult.js +1 -1
- package/rest/support/ImageHeightParameters.js +1 -1
- package/rest/support/ImageHeightResult.js +1 -1
- package/rest/support/ImageHistogramParameters.js +1 -1
- package/rest/support/ImageIdentifyParameters.js +1 -1
- package/rest/support/ImageIdentifyResult.js +1 -1
- package/rest/support/ImagePixelLocationParameters.js +1 -1
- package/rest/support/ImagePixelLocationResult.js +1 -1
- package/rest/support/ImagePointParameters.js +1 -1
- package/rest/support/ImagePointResult.js +1 -1
- package/rest/support/ImageSample.js +1 -1
- package/rest/support/ImageSampleParameters.js +1 -1
- package/rest/support/ImageSampleResult.js +1 -1
- package/rest/support/ImageToMapMultirayParameters.js +1 -1
- package/rest/support/ImageToMapParameters.js +1 -1
- package/rest/support/ImageUrlParameters.js +1 -1
- package/rest/support/ImageUrlResult.js +1 -1
- package/rest/support/ImageVolumeParameters.js +1 -1
- package/rest/support/ImageVolumeResult.js +1 -1
- package/rest/support/MapToImageParameters.js +1 -1
- package/rest/support/MeasureAreaFromImageResult.js +1 -1
- package/rest/support/MeasureFromImageParameters.js +1 -1
- package/rest/support/MeasureLengthFromImageResult.js +1 -1
- package/symbols/support/cimSymbolUtils.js +1 -1
- package/symbols/support/renderUtils.js +1 -1
- package/views/2d/ViewState.d.ts +3 -3
- package/views/2d/ViewState.js +1 -1
- package/views/2d/ViewStateManager.js +1 -1
- package/views/2d/engine/Bitmap.js +1 -1
- package/views/2d/engine/flow/styles/Imagery.js +1 -1
- package/views/2d/engine/vectorTiles/SpriteMosaic.js +1 -1
- package/views/2d/engine/vectorTiles/VTLPainter3D.js +1 -1
- package/views/2d/engine/vectorTiles/decluttering/CollisionJob.js +1 -1
- package/views/2d/engine/vectorTiles/style/geoJSONVectorTileUtils.js +1 -1
- package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
- package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
- package/views/2d/engine/webgl/Overlay.js +1 -1
- package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
- package/views/2d/engine/webgl/SpriteMosaic.js +1 -1
- package/views/2d/engine/webgl/VideoScreenRenderer.js +1 -1
- package/views/2d/engine/webgl/animations/store/AnimationStore.js +1 -1
- package/views/2d/engine/webgl/collisions/LabelMetric.js +1 -1
- package/views/2d/engine/webgl/collisions/LabelStore.js +1 -1
- package/views/2d/engine/webgl/effects/highlight/HighlightGradient.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/TextureStatisticsTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/blend/BlendTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/colorize/ColorizeTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityResources.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/drop-shadow/DropShadowTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapResources.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/magnifier/MagnifierTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/opacity/OpacityTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterHighlightTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/textureUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/AFeatureShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/FillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/OutlineFillShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileDebugInfoTexture.js +1 -1
- package/views/2d/engine/webgl/textureUtils.js +1 -1
- package/views/2d/engine/webgl/util/IntervalMatcher.js +1 -1
- package/views/2d/layers/LayerView2D.js +1 -1
- package/views/2d/webglDeps.js +1 -1
- package/views/3d/FocusAreasView.js +1 -1
- package/views/3d/GroundView3D.js +1 -1
- package/views/3d/input/SceneInputManager.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/layers/graphics/ElevationAligners.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
- package/views/3d/layers/i3s/I3SBinaryReader.js +1 -1
- package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
- package/views/3d/state/ConstraintsManager.js +1 -1
- package/views/3d/state/ViewState.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/support/engineContent/marker.js +1 -1
- package/views/3d/support/flow/StreamlineResources3D.js +1 -1
- package/views/3d/support/flow/StreamlineResources3DOverlay.js +1 -1
- package/views/3d/support/flow/StreamlineResources3DShape.js +1 -1
- package/views/3d/support/flow/geometryUtils.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianTileBuilder.js +2 -0
- package/views/3d/support/gaussianSplatting/GaussianTileLifecycle.js +2 -0
- package/views/3d/support/gaussianSplatting/formatConstants.js +2 -0
- package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/terrain/TileCompositor.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/terrain/tileUtils.js +1 -1
- package/views/3d/webgl/RenderNode.d.ts +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/readShadow.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatUnpacking.glsl.js +15 -11
- package/views/3d/webgl-engine/effects/WeatherFader.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/LocalAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/MarsAtmosphere.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/CloudsRenderer.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +19 -9
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
- package/views/3d/webgl-engine/lib/AttributeView.js +1 -1
- package/views/3d/webgl-engine/lib/BasisUtil.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/DDSUtil.js +1 -1
- package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderUtils.js +1 -1
- package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
- package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBuffer.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBufferView.js +1 -1
- package/views/3d/webgl-engine/lib/VerticesView.js +2 -0
- package/views/3d/webgl-engine/lib/attributeViewUtils.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/strokes.js +1 -1
- package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
- package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
- package/views/3d/webgl-engine/lib/screenPolygonOverlapUtils.js +1 -1
- package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterialBaseInstance.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/WaterTextureRepository.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/3d/webgl-engine/materials/internal/lineMarkerBufferUtils.js +2 -0
- package/views/3d/webgl-engine/materials/internal/ribbonLineBufferUtils.js +2 -0
- package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/stippleTextureRepository.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarkerTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/hudMaterialLayouts.js +2 -0
- package/views/3d/webgl-engine/shaders/lineMarkerLayouts.js +2 -0
- package/views/draw/support/ManagedTooltipField.js +1 -1
- package/views/overlay/LineOverlayItem.js +1 -1
- package/views/overlay/TextOverlayItem.js +1 -1
- package/views/overlay/ViewOverlay.js +1 -1
- package/views/support/GroundElevationSampler.js +1 -1
- package/views/support/HighlightOptions.d.ts +2 -2
- package/views/support/HighlightOptions.js +1 -1
- package/views/support/TextureCompressionHelper.js +1 -1
- package/views/support/imageReprojection.js +1 -1
- package/views/webgl/FramebufferObject.js +1 -1
- package/views/webgl/RenderingContext.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/Util.js +1 -1
- package/views/webgl/rasterUtils.js +1 -1
- package/views/webgl/testSVGPremultipliedAlpha.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/Legend/styles/support/univariateUtils.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/ScaleRangeSlider/types.d.ts +3 -3
- package/assets/esri/core/workers/chunks/01f55004d64309f8538b.js +0 -1
- package/assets/esri/core/workers/chunks/039d9bc5b5015012f811.js +0 -1
- package/assets/esri/core/workers/chunks/08140725277de5d2e41a.js +0 -1
- package/assets/esri/core/workers/chunks/0d99bfb75dcb9fa29080.js +0 -1
- package/assets/esri/core/workers/chunks/144bad0c2415c345736a.js +0 -1
- package/assets/esri/core/workers/chunks/165ca7a97b611c8f26c4.js +0 -1
- package/assets/esri/core/workers/chunks/16cda273927ab0a39544.js +0 -1
- package/assets/esri/core/workers/chunks/1989410a618865f02dec.js +0 -1
- package/assets/esri/core/workers/chunks/29c610ce1c81ebb84a6b.js +0 -1
- package/assets/esri/core/workers/chunks/3223f9fbc76ba9ef8d13.js +0 -1
- package/assets/esri/core/workers/chunks/338d800d4efcc91cead1.js +0 -1
- package/assets/esri/core/workers/chunks/3415531224f8494d79ca.js +0 -1
- package/assets/esri/core/workers/chunks/3fdcc383bbd9cf0d274c.js +0 -1
- package/assets/esri/core/workers/chunks/46c290108a90518ef695.js +0 -1
- package/assets/esri/core/workers/chunks/48b8b57f559a53c6c513.js +0 -1
- package/assets/esri/core/workers/chunks/4a979fce1c971b614a18.js +0 -1
- package/assets/esri/core/workers/chunks/59a88dd53f8806bbec06.js +0 -1
- package/assets/esri/core/workers/chunks/5aeb5e18514644fe2cf9.js +0 -1
- package/assets/esri/core/workers/chunks/5bd1414220e42cb8ebcf.js +0 -1
- package/assets/esri/core/workers/chunks/5d781c2c6204cffffd0d.js +0 -1
- package/assets/esri/core/workers/chunks/6edc13a426e00bb93a9b.js +0 -1
- package/assets/esri/core/workers/chunks/723df53cfa0189837d01.js +0 -1
- package/assets/esri/core/workers/chunks/7400b8c454b47ee4fb3c.js +0 -1
- package/assets/esri/core/workers/chunks/7862abd24fb5c3b12e6b.js +0 -1
- package/assets/esri/core/workers/chunks/796c6195b6bf59dcc9bd.js +0 -1
- package/assets/esri/core/workers/chunks/7af4edc6e87d27b9d467.js +0 -1
- package/assets/esri/core/workers/chunks/81bcc495e6eaf2cf7474.js +0 -1
- package/assets/esri/core/workers/chunks/934e1f2153e6fad6ed23.js +0 -1
- package/assets/esri/core/workers/chunks/990e96139b5a1dccb061.js +0 -1
- package/assets/esri/core/workers/chunks/a607541959169741a943.js +0 -1
- package/assets/esri/core/workers/chunks/aa779896fd9e5c341349.js +0 -1
- package/assets/esri/core/workers/chunks/c131e0dd180a4c10e12e.js +0 -1
- package/assets/esri/core/workers/chunks/c7adb7b77721c75891f4.js +0 -1
- package/assets/esri/core/workers/chunks/cd55cad81accf51d2989.js +0 -1
- package/assets/esri/core/workers/chunks/ce324dde6d7daea33638.js +0 -1
- package/assets/esri/core/workers/chunks/d3412518a7b518860fbb.js +0 -1
- package/assets/esri/core/workers/chunks/dac69c0047488fdf986d.js +0 -1
- package/assets/esri/core/workers/chunks/dba5f44c4e4a3f075df2.js +0 -1
- package/assets/esri/core/workers/chunks/e67ea2f1714e5abeae44.js +0 -1
- package/assets/esri/core/workers/chunks/e8fb2ba7b7a4f0916325.js +0 -1
- package/assets/esri/core/workers/chunks/f10c883eb26330e3421c.js +0 -1
- package/assets/esri/core/workers/chunks/f3b4159c0722df8ffe13.js +0 -1
- package/assets/esri/core/workers/chunks/f75eec2cbc541eec9712.js +0 -1
- package/layers/geospatialPDF/projectionToWKTUtils.js +0 -3
- package/libs/maquette/cache.js +0 -2
- package/libs/maquette/dom.js +0 -2
- package/libs/maquette/h.js +0 -2
- package/libs/maquette/index.js +0 -2
- package/libs/maquette/mapping.js +0 -2
- package/libs/maquette/projection.js +0 -2
- package/libs/maquette/projector.js +0 -2
- package/libs/maquette/utilities/window-performance-projector-logger.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../Color.js";import{filterInPlace as n,difference as r}from"../../../core/arrayUtils.js";import i from"../../../core/CollectionFlattener.js";import{toConst as a}from"../../../core/compilerUtils.js";import{EventedAccessor as o}from"../../../core/Evented.js";import has from"../../../core/has.js";import s from"../../../core/Logger.js";import{clamp as c}from"../../../core/mathUtils.js";import{removeMaybe as l,destroyMaybe as u}from"../../../core/maybe.js";import{MemCachePool as ee}from"../../../core/MemCachePool.js";import d from"../../../core/ObjectPool.js";import f from"../../../core/PooledArray.js";import{throwIfAborted as te,isAbortError as ne,isAborted as p}from"../../../core/promiseUtils.js";import{watch as m,syncAndInitial as h,initial as g,sync as _}from"../../../core/reactiveUtils.js";import"../../../core/scheduling.js";import{getMetersPerUnitForSR as re}from"../../../core/units.js";import{property as v,subclass as ie}from"../../../core/accessorSupport/decorators.js";import{exactEquals as ae,set as oe,copy as se}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as ce}from"../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as b,radiusModifier as le}from"../../../geometry/ellipsoidUtils.js";import{projectWithoutEngine as ue}from"../../../geometry/projectionUtils.js";import x from"../../../geometry/SpatialReference.js";import{projectBoundingSphere as de}from"../../../geometry/projection/projectBoundingSphere.js";import{getProjector as fe}from"../../../geometry/projection/projectors.js";import{projectPointToVector as pe}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as me}from"../../../geometry/projection/projectVectorToVector.js";import{create as S,fromExtent as he,equals as C,intersection as ge,intersectsSphere as _e}from"../../../geometry/support/aaBoundingRect.js";import{copy as ve,create as ye}from"../../../geometry/support/frustumPlanes.js";import{createSpatialReferenceCyclical as be}from"../../../geometry/support/normalizeUtils.js";import{isGeographic as w,isPlateCarree as xe}from"../../../geometry/support/spatialReferenceUtils.js";import{Sphere as Se}from"../../../geometry/support/sphere.js";import{ElevationQueryTileCache as Ce}from"../../../layers/support/ElevationQueryTileCache.js";import{isIntegratedMeshLayer as we,isBaseLayer as Te}from"../../../layers/support/layerUtils.js";import{queueHighPriority as Ee}from"../../../request/queue.js";import{debugFlags as T}from"../support/debugFlags.js";import{ElevationRange as E}from"../support/ElevationRange.js";import{ElevationUpdateEvent as De}from"../support/ElevationUpdateEvent.js";import{calculateElevationUpdateExtents as Oe}from"../support/elevationUpdateExtentUtils.js";import{toBoundingRect as ke}from"../support/extentUtils.js";import{geographicMbsToGeographicExtent as Ae,mbsToGeographicExtent as je,intersectsGeographicExtent as Me}from"../support/sphereExtentUtils.js";import{isSupportedGCSOnGlobe as D}from"../support/supportedSpatialReference.js";import{updatingProgress as Ne}from"../support/updatingProperties.js";import{ElevationBounds as O}from"./ElevationBounds.js";import{ElevationData as Pe,sampleElevation as Fe}from"./ElevationData.js";import{create as Ie}from"./ExtentHelper.js";import{LayerClasses as Le}from"./LayerClass.js";import{OverlayManager as Re}from"./OverlayManager.js";import{PlanarPatch as ze}from"./PlanarPatch.js";import{Queue as Be}from"./Queue.js";import{ScaleRangeQueries as Ve}from"./ScaleRangeQueries.js";import{SphericalPatch as He}from"./SphericalPatch.js";import{SplitLimits as Ue}from"./SplitLimits.js";import{maxRootTiles as k,tooManyRootTilesAfterChangeError as We,tooManyRootTilesForLayerError as Ge,maxTileNeighborLevelDelta as A,maxMemoryLodBias as Ke}from"./TerrainConst.js";import{TerrainRenderer as qe}from"./TerrainRenderer.js";import Je from"./TerrainSurfacePerformanceInfo.js";import{weakAssert as j,isVectorTileLayerView as M,internalAssert as N,oppositeEdge as Ye,neighborEdgeIndices as P,isSurfaceLayerView as F,isGroupLayerView as I,isMapTileLayerView as L,isBlendableLayerView as R,isElevationLayerView as z,releaseTerrainData as B,oppositeCorner as Xe,enableTerrainInternalChecks as V,enableWaterproofTests as Ze,enableInternalTerrainChecks as Qe,enableTerrainWaterproofChecks as $e,neighborCornerIndices as et}from"./terrainUtils.js";import{Tile as tt,lijEquals as H}from"./Tile.js";import{printAllocations as nt}from"./TilePerLayerInfo.js";import{sortTiles as rt,IteratorPreorder as it,IteratorPostorder as at,compareTilesByLij as U,hasLoadableSiblings as ot,sortTilesByPOI as st,traverseTilesPreorder as W}from"./tileUtils.js";import{TilingSchemeLogic as ct}from"./TilingSchemeLogic.js";import{getGroundTransparencyModeFromOpacity as lt}from"./TransparencyMode.js";import{UpsampleInfo as ut}from"./UpsampleInfo.js";import{isCompositeBlendMode as dt,blendModeFromString as ft}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{hasLayerBasedScaleVisibility as pt}from"../../support/layerViewUtils.js";import{ImmediateTask as G,TaskPriority as mt,noBudget as ht}from"../../support/Scheduler.js";import{TextureCompressionTracker as gt}from"../../support/TextureCompressionTracker.js";import{Yield as _t}from"../../support/Yield.js";var K;let q=class extends o{static{K=this}get allTilesCreated(){return this._allTilesCreated}get allTiles(){return a(this._allTiles)}get renderedTiles(){return rt(n(this._allTiles.toArray(),e=>e.visible&&e.rendered))}get demResolution(){let{_allTiles:e,tilingScheme:t}=this;if(e.length===0)return{min:1,max:1};let n=re(t.spatialReference),r=1/0,i=-1/0;for(let a of e){let e=t.resolutionAtLevel(a.level)*n;r=Math.min(r,e),i=Math.max(i,e)}return{min:r,max:i}}constructor(e){super(e),this.terrainTextureCompressionTracker=new gt,this._iteratorPool=new d(()=>new it,e=>e.remove=()=>this._iteratorPool.release(e)),this._postorderIterator=new at,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._allTilesCreated=!1,this._usedMemory=null,this._performanceInfo=new Je,this._waterproofnessErrorHandle=null,this._viewChanged=!1,this.heading=0,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=y(),this._eyePosSurfaceSR=y(),this._splitLimits=new Ue,this._layerViews=[[],[]],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._updatingHandles=new ce,this._poiWatchHandle=null,this._frameTask=G,this._allTiles=new f,this._upsampleInfoPool=new d(()=>new ut),this._shouldEmitChangeEvent=!1,this._rootTilesExtent=S(),this.updatingProgress=.5,this._maxNumUpdating=1,this.maxTextureScale=1.2,this._spatialReference=x.WebMercator,this._elevationProjectorCache=new Map,this.visibleElevationRange=new E(1/0,-1/0),this._rootTileElevationRange=new E(1/0,-1/0),this._tilingSchemeSpatialReference=null,this._updatingRootTiles=!1,this._pendingTilesForElevationUpdateEvent=new Set,this._pendingTilesToUpdate=new Set,this.totalGeometryUpdates=0,this.totalTileUpdates=0,this._layerViewsDirty=!1,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._isWebMercator=!1,this._isWebMercatorOnPlateCarree=!1,this.enabled=!0;let{view:t}=e;this.overlayManager=new Re({...e,terrainSurface:this}),this._isGlobal=!t.state?.isLocal,this._isGeographic=this._spatialReference?.isGeographic??!1,this._tileConstructor=this._isGlobal?He:ze,this._ellipsoid=b(t.spatialReference),this._renderer=new qe(this,this.overlayManager.renderer,this._allTiles,this.terrainTextureCompressionTracker,t.resourceController.memoryController),pt()||(this._scaleRangeQueries=new Ve)}initialize(){let{view:e}=this,{resourceController:t}=e,{memoryController:n}=t;e.stage.addRenderPlugin(this._renderer),this._tileCache=new ee((e,t)=>n.newCache(e,t),`terrain-tile`),this._upsampleMapCache=n.newCache(`terrain-upsample`,({tile:e})=>e.unloadMapData()),this._elevationQueryCache=new Ce(n.newCache(`elevation-query`));let r=this.overlayManager;this.addHandles([m(()=>r.renderer.isEmpty,()=>this._evaluateTransparency()),m(()=>this.renderer.visible,e=>this.freeze=!e),m(()=>this.heading,e=>{this._renderer.updateHeading(e),this._updateTileTextures(0)},h)],`overlayManager`),this._updatingHandles.add(()=>({heading:e.camera?.heading,state:e.state?.mode}),({heading:e,state:t})=>{if(e==null)return;if(this.isGlobal&&this.isGeographic||this.isWebMercatorOnPlateCarree){this.heading=Math.round(e/90)*90%360;return}let n=Math.round(e)%360,r=Math.abs(n-this.heading);(t===2||Math.min(r,360-r)>=30)&&(this.heading=n)},g),this.addHandles([m(()=>this.baseOpacity,()=>{this._handleLayerViewChanges(),this._updateTileTextures(this._evaluateTransparency()?1:2)},h),m(()=>this.hasCompositeBlendMode,()=>this._updateTileTextures(this._evaluateTransparency()?1:2),h),m(()=>this.backgroundColor,(e,t)=>{e?.equals(t)||(this._handleLayerViewChanges(),this._renderer.updateTileBackground(e))},_),m(()=>this.snapLevel,()=>this._viewChanged=!0,_),m(()=>this.view.pointsOfInterest,e=>{this._renderer.pointsOfInterest=e,this._poiWatchHandle=l(this._poiWatchHandle),e&&(this._poiWatchHandle=this._updatingHandles.add(()=>e.focus?.renderLocation,()=>this._allTilesSorted=!1,{equals:ae}))}),m(()=>T.TERRAIN_TILE_TREE_SHOW_TILES,t=>{t&&!this._treeDebugger?import(`../layers/support/TerrainTileTree3DDebugger.js`).then(({TerrainTileTree3DDebugger:t})=>{!this._treeDebugger&&T.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new t({view:e}))}):t||(this._treeDebugger=u(this._treeDebugger))},g)]);let{spatialReference:a}=e;this._extentHelper=Ie(this.viewingMode,{layers:e.map.allLayers,layerViews:e.allLayerViews,viewSpatialReference:a});let o=new i({getCollections:()=>e.defaultsFromMap?.mapCollections?.map(({layers:e})=>e),getChildrenFunction:e=>e&&`layers`in e?e.layers:null}),s=new ct({layers:o,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:a});this._set(`tilingSchemeLogic`,s),this._updateTilingScheme();let c=t.scheduler;this._frameTask=c.registerTask(mt.TERRAIN_SURFACE,this),this.addHandles([m(()=>this._stencilEnabledExtents,e=>this._renderer.setStencilEnabledLayerExtents(e),g),m(()=>this.tilingSchemeLogic.tilingScheme,()=>this._updateTilingScheme(),_),m(()=>this.groundExtent,()=>this._updateRootTiles(),g),e.on(`resize`,()=>this._viewChangeUpdate()),m(()=>{let t=e.state;return[this._lodBias,this.lodSnappingEnabled,e.quality,t.camera,t.contentCamera,t.fixedContentCamera]},()=>this._viewChangeUpdate(),h),m(()=>e.qualitySettings?.fadeDuration,e=>this._renderer.textureFadingEnabled=e>0,g),m(()=>e.qualitySettings?.physicallyBasedRenderingEnabled,e=>this._renderer.pbrMode=e?5:0,g),m(()=>e.qualitySettings?.tiledSurface.elevationLevelDelta,()=>{this._allTiles.forAll(e=>this.updateElevationSources(e)),this._updateAllTileGeometries()}),m(()=>this.userClippingExtent,()=>this._updateClippingExtent(),_)]),this.addHandles(e.allLayerViews.on(`after-changes`,()=>this._layerViewsDirty=!0)),this._layerViewsDirty=!0,this._handleLayerViewChanges(),this._renderer.updateTileBackground(this.backgroundColor)}clearHandles(){this._updatingHandles?.removeAll(),this.removeAllHandles(),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear()}destroy(){this._waterproofnessErrorHandle?.remove(),this._waterproofnessErrorHandle=null,this._frameTask.remove(),this._frameTask=G,this._updatingHandles?.destroy(),this._removeAllTiles(),this._set(`tilingSchemeLogic`,u(this.tilingSchemeLogic)),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear(),this._set(`overlayManager`,u(this.overlayManager)),this._tileCache=u(this._tileCache),this._allTiles.prune(),tt.prune(),this._treeDebugger=u(this._treeDebugger),this._renderer.destroyed||(this.view.stage.removeRenderPlugin(this._renderer),this._renderer.destroy()),this._renderer=null,this._iteratorPool=u(this._iteratorPool),this._upsampleMapCache=u(this._upsampleMapCache),this._elevationQueryCache=u(this._elevationQueryCache),this._set(`view`,null),this._extentHelper=u(this._extentHelper),this._upsampleInfoPool=u(this._upsampleInfoPool),nt(),this._layerViews.forEach(e=>e.length=0),this._performanceInfo=null}get renderer(){return this._renderer}get frustum(){return this.view.state.camera.frustum}get snapLevel(){return this.lodSnappingEnabled?this.view.terrainLevel:null}get lodSnappingEnabled(){return this.view.qualitySettings.tiledSurface.reduceTileLevelDifferences}get upsampleInfoPool(){return this._upsampleInfoPool}get upsampleMapCache(){return this._upsampleMapCache}get elevationQueryCache(){return this._elevationQueryCache}get hasStencilEnabledExtents(){return!!this._stencilEnabledExtents?.length}get _stencilEnabledExtents(){let e=this.spatialReference,t=!!has(`enable-feature:im-as-ground`);return e==null?null:Iterator.from(this.view.allLayerViews).map(n=>{let{layer:r}=n;if(!we(r)||t&&!r.isUsedAsGroundLayer)return null;let{fullExtent:i}=r,a=i==null||i.spatialReference.equals(e)?i:ue(i,i.spatialReference,e);return a?he(a):null}).filter(e=>e!=null).toArray()}get userClippingExtent(){let{spatialReference:e}=this,t=this.view?.clippingArea;if(t==null||e==null)return null;let n=S(),r=ke(t,n,e)?n:null,i=this._get(`userClippingExtent`);return C(r,i)?i:r}get rootTilesExtent(){return this._rootTilesExtent}get groundExtent(){let e=ge(this.fullGroundExtent,this.userClippingExtent,S()),t=this._get(`groundExtent`);return C(e,t)?t:e}get fullGroundExtent(){return this._tilingSchemeExtent==null?this._rootTilesExtent:this._tilingSchemeExtent}get _tilingSchemeExtent(){return this.tilingSchemeLogic?.extent}get updating(){return this._hasPendingUpdates||(this._maxNumUpdating=1),this.enabled&&!!((this.readyToRun||this._updatingHandles?.updating||this._asyncWorkItems>0)&&this.ready&&!this.freeze||this.overlayManager?.updating||this.terrainTextureCompressionTracker.compressing)}get readyToRun(){return this.enabled&&(this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||!this._allTilesSorted||this._layerViewsDirty||this._scaleRangeQueries?.updating||this._frameTask.updating)&&this.ready&&!this.freeze}get updatingProgressValue(){return this._maxNumUpdating=Math.max(this._pendingUpdates,this._maxNumUpdating),1-this._pendingUpdates/this._maxNumUpdating}get baseOpacity(){return this.view?.map?.ground?.opacity??1}set baseOpacity(e){this.view.map.ground.opacity=e}get viewingMode(){return this.view.state.viewingMode}get ready(){return!this.enabled||this._rootTiles!=null}get rootTiles(){return this._rootTiles}get spatialReference(){return this.tilingScheme?.spatialReference??null}get backgroundColor(){return this.view?.map?.ground?.surfaceColor}set backgroundColor(e){this.view.map.ground.surfaceColor=e}set slicePlaneEnabled(e){this._renderer.slicePlaneEnabled=e,this._set(`slicePlaneEnabled`,e),this._evaluateTransparency()}get tilingSchemeLocked(){return this.tilingSchemeLogic?.tilingSchemeLocked??!1}get wireframe(){return this._renderer?.wireframe}set wireframe(e){e!==this._renderer.wireframe&&(this._renderer.wireframe=e,this._updateAllTileGeometries())}get opaque(){return this._renderer.transparency===0}get invisible(){return this._renderer.transparency===3}set freeze(e){this._set(`freeze`,e),this._viewChangeUpdate()}get fadeDuration(){return this.view.qualitySettings.fadeDuration??0}intersect(e,t,n,r){this._renderer.intersectRay(e,t,n,r)}getElevationLevelDelta(e){return e<4?3:this.view.qualitySettings.tiledSurface.elevationLevelDelta}get _xNormalizer(){return be(this._spatialReference)}getElevation(e,t,n,r){let i=this._rootTiles;if(!i?.length||!this.enabled||i[0].layerInfo[0].length===0)return null;let a=this._elevationProjectorCache.get(r);if(a===void 0&&(a=fe(r,this._spatialReference)??null,this._elevationProjectorCache.set(r,a)),a==null)return s.getLogger(this).error(`TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system`),null;let o=oe(J,e,t,n);a(o,0,o,0);let c=this._xNormalizer?.normalize(o[0])??o[0],l=o[1];return St(i,c,l)}getElevations(e,t,n){let r=this._rootTiles,i=r?r[0].layerInfo[0].length:0;if(!r?.length||i===0||!this.enabled)for(let e=0;e<t;++e)n(e,null);else for(let i=0;i<t;++i){let t=i*3,a=e[t],o=e[t+1],s=St(r,a,o);n(i,s)}}getLayerIndexByUID(e,t){return this._layerIndexByUid[e].get(t)}getScale(e){if(!this.tilingScheme)return null;if(!pe(e,J,this.spatialReference))return s.getLogger(this).error(`TerrainSurface.getScale(): could not project given point to tiling scheme coordinate system`),null;let t=this._rootTiles;if(t!=null){for(let e of t)if(e?.containsPoint(J)){let t=e;for(;t.children[0]&&!t.rendered;){let e=t.children[0].extent,n=0;J[0]>e[2]&&(n+=1),J[1]<e[1]&&(n+=2),t=t.children[n]}return this._getLodBiasCorrectedScale(t.level)}}return 1/0}getSphereElevationRange(e,t){if(!this.enabled)return null;let n=this._rootTiles,r=this._tilingSchemeSpatialReference;if(n==null||r==null||n.length===0)return null;let i=w(r);if(i){let n=w(t)&&D(t),i=b(t);if(n&&D(r)&&i===b(r))Ae(e,Y,i.radius);else if(!je(e,t,Y,r))return s.getLogger(this).error(`TerrainSurface.getSphereElevationRange(): could not project the query sphere`),null}else if(!de(e,t,yt,r))return s.getLogger(this).error(`TerrainSurface.getSphereElevationRange(): could not project the query sphere`),null;let a=new E,o=[];for(let e of n)o.push(e);let c=0;for(;c<o.length;){let e=o[c];if(++c,!(i?Me(e.extent,Y,r):_e(e.extent,yt)))continue;let t=e.children;if(t[0]==null||e.rendered)a.expandElevationRangeValues(e.elevationBoundsMin,e.elevationBoundsMax);else for(let e of t)o.push(e)}return a}getRootElevationRange(){return this.enabled&&this._rootTiles!=null?new E(this._rootTileElevationRange.minElevation,this._rootTileElevationRange.maxElevation):null}getLowerBoundRadius(){let e=(this._ellipsoid.radius+this.visibleElevationRange.minElevation)*le;return Math.min(e,this._ellipsoid.radius)}queryVisibleScaleRange(e,t,n,r){if(!this._scaleRangeQueries)return;let i=t?this.tilingScheme.levelAtScale(t):0,a=n?this.tilingScheme.levelAtScale(n):1/0,o=this._lodBias;this._scaleRangeQueries.queryVisibleLevelRange(e,i+o,a+o,r)}_evaluateTransparency(){let e=this.baseOpacity,t=this.overlayManager.renderer.isEmpty,n=this._renderer.transparency,r=this._isFullyTransparent?lt(0,t):e>=1&&!this.hasCompositeBlendMode&&!this._renderer.slicePlaneEnabled?0:1;return this._renderer.transparency=r,n!==r&&(this.notifyChange(`opaque`),this.notifyChange(`invisible`),!0)}_updateTilingScheme(){let{tilingScheme:e}=this.tilingSchemeLogic;if(e===this.tilingScheme)return;j(!!e,`tiling scheme cannot be reset to undefined`),this._isGlobal=!this.view?.state?.isLocal,this.tilingScheme&&this._removeAllTiles();let t=e?.spatialReference??x.WebMercator;this._spatialReference=t,this._isWebMercator=!!t?.isWebMercator,this._isWebMercatorOnPlateCarree=this._isWebMercator&&xe(this.view?.renderSpatialReference),this._isGeographic=t?.isGeographic??!1,this._set(`tilingScheme`,e),this._tilingSchemeSpatialReference=this.tilingScheme?.spatialReference,this._updateClippingExtent(),e&&(this._updateTiledLayers(),this._renderer.tileSize=e.pixelSize,this.overlayManager.spatialReference=e.spatialReference,this._updateRootTiles())}static{this._tileMemcacheKey=`TerrainTileMemcache`}_acquireTile(e,t,n,r){let i=this._tileCache.pop(K._tileMemcacheKey);return i?(i.init(e,t,n,r,this),i):new this._tileConstructor(e,t,n,r,this)}get updatingRootTiles(){return this._updatingRootTiles}_updateRootTiles(){let{groundExtent:e,tilingScheme:t}=this;if(!t)return;if(!this.enabled){this._setRootTiles(null);return}let n=bt,i=t.rootTilesInExtent(e,n,k*5);if(this._rootTiles!=null){if(i.length>k){s.getLogger(this).warn(We);return}let e=this._rootTiles.map(e=>e.lij),t=r(e,i,H);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){let e=this._rootTiles.filter(e=>t.removed.findIndex(t=>H(t,e.lij))>-1?(this._purgeTile(e),!1):!0);t.added.forEach(t=>e.push(this._newRootTile(t))),this._setRootTiles(e)}}else this._updatingRootTiles=!0,i.length>k&&(s.getLogger(this).warn(Ge),i=t.rootTilesInExtent(e,n,k)),this._setRootTiles(i.map(e=>this._newRootTile(e)));C(n,this._rootTilesExtent)||(this._rootTilesExtent=S(n)),this.renderer.visible=!0,this._viewChangeUpdate(),this.overlayManager.setPlacementDirty(),this.notifyChange(`ready`),this._updateAllTileGeometries(),this._updatingRootTiles=!1,this.checkAllTilesWaterproofness(`root-tiles-updated`)}_updateAllTileGeometries(){let e=this._allTiles.filter(e=>this._canUpdateTileGeometry(e));e.length===0||(e.sort(U),e.forEach(e=>this._renderer.updateTileGeometryState(e)),e.forEach(e=>e.renderData.updateNeighborData()),this._updateTilesGeometries(e)),this._pendingTilesToUpdate.clear()}_updateTilesGeometries(e){let t=e.filter(e=>this._canUpdateTileGeometry(e));if(t.length===0)return;let n=this.renderer;for(let e of t)n.updateGeometryIfNeeded(e);for(let e of t)this._pendingTilesForElevationUpdateEvent.add(e)}_canUpdateTileGeometry(e){return e.loaded&&e.intersectsClippingArea&&e.hasGeometryState}_shouldSplit(e){return e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.snapLevel)===1}_newRootTile(e){let t=this._acquireTile(0,e[1],e[2],null);return this._shouldSplit(t)&&t.setPendingUpdate(1),this._loadTile(t),this._markTileToUpdate(t),this._updateRootTileElevationRange(),t}_setRootTiles(e){if(this._rootTiles=e,this._allTiles.clear(),e!=null){let t=this._iteratorPool.acquire();for(t.reset(e);!t.done;)this._allTiles.push(t.next());t.remove()}this._renderer.setRootTiles(this._rootTiles),this._updateTilesVisibility(e),this.notifyChange(`demResolution`),this.emit(`tiles-changed`,{allTiles:this.allTiles})}_runViewChangeUpdateIfDirty(){this._viewChangeUpdateDirty&&(this._viewChangeUpdateDirty=!1,this._viewChangeUpdate())}_viewChangeUpdate(){this.view&&!this.freeze&&this.tilingScheme&&this.renderer.visible&&(this._inFrameTask?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateTilesVisibility(this._rootTiles)))}_updateClippingStatus(e){e.updateClippingStatus(this.groundExtent)&&e.resetPendingUpdate(8)&&this._updateTileGeometryState(e)}_updateTilesVisibility(e){if(e==null)return;let t=ot(e),n=this.visibleElevationRange,r=t?n.minElevation:1/0,i=t?n.maxElevation:-1/0,a=this.groundExtent,o=this.view.state.contentCamera.viewProjectionMatrix;this.setTileTreeDirty(!1);let s=this._iteratorPool.acquire();for(s.reset(e);!s.done;){let e=s.next();e.updateClippingStatus(a)&&e.resetPendingUpdate(8)&&this._updateTileGeometryState(e),e.computeVisibility(),e.updateScreenDepth(o),e.renderData&&(r=Math.min(e.elevationBoundsMin,r),i=Math.max(e.elevationBoundsMax,i))}s.remove(),this._viewChanged=!0,this._allTilesDirty=!0,this._updatePendingTileGeometries(),isFinite(r)&&isFinite(i)&&(n.minElevation!==r||n.maxElevation!==i)&&(this.visibleElevationRange=new O(r,i))}_updateRootTileElevationRange(){let e=1/0,t=-1/0;this._rootTiles?.forEach(({elevationBoundsMin:n,elevationBoundsMax:r})=>{e=Math.min(e,n),t=Math.max(t,r)});let n=this._rootTileElevationRange;(n.minElevation!==e||n.maxElevation!==t)&&(this._rootTileElevationRange=new O(e,t))}_updateViewDependentParameters(){let{camera:e,contentCamera:t}=this.view.state,n=Math.tan(t.fovX*.5),r=Math.tan(t.fovY*.5),i=this.tilingScheme.pixelSize,a=2**-this._lodBias*e.pixelRatio;this._splitLimits.aboveGround=e.aboveGround,this._splitLimits.fovX=n,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=i/e.width*this.maxTextureScale*a,this._splitLimits.relativeHeightLimit=i/e.height*this.maxTextureScale*a,this._splitLimits.maxLod=this.tilingScheme.getMaxLod(),this._splitLimits.angledSplitBias=this.view.qualitySettings.tiledSurface.angledSplitBias,this.view.state.fixedContentCamera?this._splitLimits.frustum=ve(this._splitLimits.frustum??ye(),t.frustum):this._splitLimits.frustum=null,se(this._eyePosRenderSR,t.eye),me(e.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateTileGeometryState(e){e.updateVisibility(),this._renderer.updateTileGeometryState(e)&&this._markTileToUpdate(e),this.setMemoryDirty()}_markAllTileNeighborsForUpdate(e){let t;e.forEachLoadedNeighbor(e=>{t??=this._layerViews[1].some(M),t&&e.setPendingUpdate(32),this._pendingTilesToUpdate.add(e)})}_updateTileTexture(e,t){let n=e.resetPendingUpdate(32)?32:e.resetPendingUpdate(16)?16:!1;n&&(this._renderer.updateTileTexture(e,n),this._usedMemory=null,t.madeProgress())}_emitElevationUpdateEventForTiles(){if(!this._shouldEmitChangeEvent)return;let e=this._pendingTilesForElevationUpdateEvent;if(e.size>0){let t=new Float64Array(4*e.size),n=0;for(let r of e)t.set(r.extent,4*n),++n;e.clear();for(let e of Oe(t,this.spatialReference)){let t=new De(this.spatialReference,e,`ground`);this.emit(`elevation-change`,t)}}this._shouldEmitChangeEvent=!1}runTask(e){this._handleLayerViewChanges(e),this._frameTask.processQueue(e),this.renderer.processScaleRangeQueries(this._scaleRangeQueries,e),this._inFrameTask=!0,this._pendingUpdates=0,this._hasPendingUpdates=!1,this._updateAllTilesStatus(e),this._sortTiles(e);let t=!this.view.state.fixedContentCamera;this._mergeAndSplit(e,t),this._updateElevation(e),this._updateTextures(e),t||this._mergeAndSplit(e,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty();let n=this._pendingTilesToUpdate.size>0,r=n&&this._hasPendingGeometryWithoutIndices();if((!e.done||r)&&this._updatePendingTileGeometries(),this._emitElevationUpdateEventForTiles(),e.done&&(e.hasProgressed||n&&!r)&&this.requestUpdate(),this.notifyChange(`updatingProgressValue`),!e.hasProgressed)return _t}_checkTileInvariant(){}_updateAllTilesStatus(e){if(!this._viewChanged||!this._rootTiles||e.done)return;this._viewChanged=!1;let t=!1,n=new Be(this._allTiles.length);n.pushAll(this._rootTiles);let r=this.snapLevel,i=this._splitLimits,a=this._eyePosRenderSR;this._allTiles.forAll(e=>{e.maxLevelDeltaNeighborCount=0,e.unmergableChildCount=0});let o=this.view.state.contentCamera.viewProjectionMatrix;for(;!n.empty;){let e=n.pop(),s=e.parent?.hasPendingUpdate(4),c=e.elevationLevel,l=s?4:e.shouldSplit(i,a,r),u=l===1;e.leaf?Z(e,u):n.pushAll(e.children),s?(e.resetPendingUpdate(1),e.leaf||(e.setPendingUpdate(4),t=!0),this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(o)):(u?(e.resetPendingUpdate(4),e.leaf&&(e.setPendingUpdate(1),t=!0)):(e.resetPendingUpdate(1)&&e.updateAgentSuspension(),l===2&&e.updateAgents(0),e.leaf||(e.setPendingUpdate(4),e.resetPendingUpdate(1),t=!0)),e.elevationLevel!==c&&this.updateElevationSources(e))}this._allTilesDirty=t,this.requestUpdate(),this._shortBatches&&this._updatePendingTileGeometries(),e.madeProgress()}_sortTiles(e){!e.done&&!this._allTilesSorted&&this.view.pointsOfInterest?.focus&&(st(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger?.update(),e.madeProgress())}_markTileToUpdate(e){N(e.loaded),e.intersectsClippingArea&&(this._pendingTilesToUpdate.add(e),this._markAllTileNeighborsForUpdate(e))}_hasPendingGeometryWithoutIndices(){for(let e of this._pendingTilesToUpdate)if(e.loaded&&e.intersectsClippingArea&&e.renderData?.vao?.indexBuffer==null)return!0;return!1}_updatePendingTileGeometries(){let e=this._pendingTilesToUpdate,t=[];if(e.forEach(e=>{this._canUpdateTileGeometry(e)&&t.push(e)}),t.length===0){e.clear();return}let n=(n,r)=>{!r||!this._canUpdateTileGeometry(r)||r.level<n.level||e.has(r)||(e.add(r),t.push(r),r.renderData.updateNeighborData())};t.sort(U);let r=t.length;for(let i=0;i<r;++i){let r=t[i];N(r.loaded),N(r.intersectsClippingArea);let a=r.renderData;if(!a?.geometryState)continue;a.updateNeighborData();let o=a.dirtyEdgeResolutions,s=a.geometryState,c=e=>{let t=et[e];n(r,s.cornerPeerNeighbors[e]?.findCorner(Xe(t),e=>e.loaded))};for(let t=0;t<4;++t)if(o&1<<t){let i=a.geometryState.edgePeerNeighbors[t];i&&i?.level>=r.level&&i.forAllSubtreeOnSide(Ye(P[t]),t=>this._canUpdateTileGeometry(t)?(N(e.has(t)||U(r,t)<0),n(r,t),!0):!1),c((t+1)%4),c(t)}}e.clear(),t.sort(U),this._updateTilesGeometries(t),this._shouldEmitChangeEvent=!0,V&&Ze&&this.checkAllTilesWaterproofness(`pending-geometries-updated`)}_mergeAndSplit(e,t){if(this.freeze||e.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate();let n=!1,r=this.view.state.fixedContentCamera,i=!1;for(;!e.done;){i=!0;let a=!1,o=!this._allTiles.some(i=>{if(!n&&!r&&!i.visible)return e.done;let o=i;if(i.hasPendingUpdate(4)){if(!t||i.unmergableChildCount>0)return e.done;for(i.resetPendingUpdate(4);o.parent!=null&&o.parent.unmergableChildCount===0&&o.parent.resetPendingUpdate(4);)o=o.parent;this._mergeTile(o),a=!0,e.madeProgress()}else if(i.resetPendingUpdate(1)){let t=!0,n=i.level;if(n>=A){let e=e=>e.leaf||n-e.level<A;for(let r=0;r<4;++r){let a=i.findNeighborTile(P[r],e);a!=null&&n-a.level===A&&(t=!1,V&&(N(a.leaf),N(a.hasPendingUpdate(1))))}}t?(this._splitTile(i),e.madeProgress(),a=!0):i.setPendingUpdate(1)}return e.done});if(a&&(this._allTilesSorted=!1,this._allTilesDirty=!0),o){if(!n){n=!0;continue}if(!a)break}else this._allTilesDirty=!0}i?e.madeProgress():this._allTilesDirty=!0,this._allTilesCreated=!this.allTiles.some(e=>e.hasPendingUpdate(1)||e.hasPendingUpdate(4)&&e.unmergableChildCount===0),this._sortTiles(e)}_updateElevation(e){e.done||this._allTiles.some(t=>(t.resetPendingUpdate(8)&&(this._updateTileGeometryState(t),e.madeProgress()),e.done))}updateElevationSources(e){e.needsElevationSourceUpdate()&&(e.updateAgents(0),e.markElevationSourceUpdateRequested(),this.requestUpdate())}_updateTextures(e){e.done||this._allTiles.some(t=>(this._updateTileTexture(t,e),e.done))}_updateClippingExtent(){this.spatialReference&&(this.updateOverlayParameters(),this.requestRender(1),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get _lodBias(){return this.view.qualitySettings.tiledSurface.lodBias-(1-this.view.quality)*Ke}_getLodBiasCorrectedScale(e){let t=this.tilingScheme.levels,n=c(e-this._lodBias,0,t.length-1),r=n-Math.floor(n),i=t[Math.floor(n)].scale,a=t[Math.ceil(n)].scale;return i*(1-r)+a*r}_removeAllTiles(){this._pendingTilesToUpdate.clear(),this._pendingTilesForElevationUpdateEvent.clear(),this._rootTiles!=null&&(this._rootTiles.forEach(e=>this._purgeTile(e)),this._setRootTiles(null),this.notifyChange(`ready`)),this._allTiles.clear(),this.notifyChange(`demResolution`),this.emit(`tiles-changed`,{allTiles:this.allTiles}),this.renderer.visible=!1}_purgeSubtree(e){let t=e.children;t[0]&&(this._purgeTile(t[0]),this._purgeTile(t[1]),this._purgeTile(t[2]),this._purgeTile(t[3]),e.clearChildren())}_purgeTile(e){e.leaf?wt(e):this._purgeSubtree(e),this._allTiles.removeUnordered(e),this._unloadTile(e),e.dispose(),this._tileCache.put(K._tileMemcacheKey,e),this.notifyChange(`demResolution`),this.emit(`tiles-changed`,{allTiles:this.allTiles})}_unloadTile(e){this._pendingTilesToUpdate.delete(e),this._pendingTilesForElevationUpdateEvent.delete(e),e.unload()}_splitTile(e){j(e.leaf,`Tile that is already split should not be split again!`),j(e.rendered,`Tile marked to split is not rendered`),wt(e);let t=e.createChildren();this._allTiles.pushArray(t),this.notifyChange(`demResolution`),this.emit(`tiles-changed`,{allTiles:this.allTiles}),e.updateAgentSuspension(),j(e.rendered,`parent should be rendered`),t.forEach(e=>this._loadTile(e)),t.forEach(e=>this._pendingTilesToUpdate.add(e)),this._unloadTile(e),this._markAllTileNeighborsForUpdate(e),this._emitTileScaleChange(e,e.level+1),this._allTilesDirty=!0,this._shortBatches&&this._updatePendingTileGeometries(),t.forEach(e=>Z(e,e.hasPendingUpdate(1))),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){X.spatialReference=this.spatialReference,X.extent=e.extent,X.scale=this._getLodBiasCorrectedScale(t),this.emit(`scale-change`,X)}createTile(e,t,n,r){j(!!r,`createTile sanity check`);let i=this._acquireTile(e,t,n,r);return i.updateClippingStatus(this.groundExtent),i.updateScreenDepth(this.view.state.contentCamera.viewProjectionMatrix),this._shouldSplit(i)&&i.setPendingUpdate(1),i}get _shortBatches(){return this.view.state.mode!==2}_mergeTile(e){j(!e.hasPendingUpdate(1),`_mergeTile sanity check`),j(!e.leaf,`Cannot merge a leaf`),e.leaf||(this._purgeSubtree(e),j(!e.renderData,`Merging tile with existing render data?`),this._loadTile(e),this._markTileToUpdate(e),this._emitTileScaleChange(e),this._shortBatches&&this._updatePendingTileGeometries(),Z(e,!1),this._allTilesDirty=!0,++this._performanceInfo.numMerged)}_loadTile(e){e.load(),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager?.hasOverlays&&e.updateOverlayParameters(this.overlayManager)}_handleLayerViewChanges(e=ht){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let t=!1,n=new Set,r=-1;for(let e=this.view.allLayerViews.length-1;e>=0;e--){let i=this.view.allLayerViews.items[e];if(n.add(i.uid),F(i)||I(i)){if(this._basemapLayerViewHandles.has(i.uid)&&!I(i)){let e=this._layerClassFromLayerView(i),n=this.getLayerIndexByUID(e,i.uid);n!=null&&((n<r||r==null)&&(t=!0),r=n)}else this._registerTiledLayerView(i),i.layer.loaded&&(t=!0)}}this._basemapLayerViewHandles.forEach((e,r)=>{n.has(r)||(this._unregisterTiledLayerView(r),t=!0)}),t&&this._updateTiledLayers(),this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._evaluateTransparency(),e.madeProgress()}get _isFullyTransparent(){if(this.view.map?.ground?.opacity>0)return!1;for(let e of this.view.allLayerViews.items)if(L(e)&&!Te(e.layer)&&e.fullOpacity!==0)return!1;return!0}_hasCompositeBlendMode(){for(let e of this.view.allLayerViews.items)if((R(e)||I(e))&&dt(ft[e.layer.blendMode]))return!0;return!1}_layerClassFromLayerView(e){return+!z(e)}_registerTiledLayerView(e){let t=[];if((R(e)||I(e))&&t.push(m(()=>e.layer.blendMode,()=>{this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._updateTileTextures(2)})),!I(e)){let n=this._layerClassFromLayerView(e);t.push(m(()=>!e.destroyed&&e.suspended,()=>this._updateTiledLayers())),t.push(m(()=>!e.destroyed&&e.fullOpacity,()=>this._updateTileTextures(2)));let{layer:r}=e;`effectiveScaleRange`in r&&t.push(m(()=>!e.destroyed&&r.effectiveScaleRange,()=>this._restartAllAgents(n))),t.push(e.on(`data-changed`,()=>{let t=this.getLayerIndexByUID(n,e.uid);t!=null&&this._invalidateLayerData(t,n)}))}this._unregisterTiledLayerView(e.uid),this._basemapLayerViewHandles.set(e.uid,t)}_unregisterTiledLayerView(e){let t=this._basemapLayerViewHandles.get(e);if(t){for(let e of t)e.remove();this._basemapLayerViewHandles.delete(e)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;let e=this.view.allLayerViews,t=[[],[]],n=null;e.forEach(e=>{if(!e.layer||e.suspended||!F(e)||!e.fullExtent)return;let r=this._layerClassFromLayerView(e);if(r===1){let t=e.displayLevelRange.maxLevel;t!==1/0&&(n===null||t>n)&&(n=t)}t[r].push(e)});for(let e of Le){let n=this._layerViews[e],r=t[e];r.reverse();let i=r.length,a=n.length!==i,o=Array(i),s=Array(n.length);this._layerIndexByUid[e].clear();for(let t=0;t<i;t++){let i=r[t].uid;this._layerIndexByUid[e].set(i,t);let c=n.indexOf(r[t]);o[t]=c,t!==c&&(a=!0),c>-1&&(s[c]=t)}if(a){let t=this._postorderIterator;for(t.reset(this._rootTiles);!t.done;)t.next().modifyLayers(s,o,e);this._layerViews[e]=r,this._restartAllAgents(e),this._updateTilesVisibility(this._rootTiles)}}this.tilingScheme.ensureMaxLod(n)&&(this._viewChangeUpdate(),this.notifyChange(`tilingScheme`))}_restartAllAgents(e){let t=this._postorderIterator;for(t.reset(this._rootTiles);!t.done;){let n=t.next();n.restartAgents(e),e===0&&n.computeElevationBounds()}this._updateRootTileElevationRange()}layerViewByIndex(e,t){return this._layerViews[t][e]}numLayers(e){return this._layerViews[e].length}_updateTileTextures(e){this._allTiles.forAll(t=>{t.updateAgents(1),e===1?this.renderer.updateTileTexture(t,16):t.updateRenderData(1,e)}),this._evaluateTransparency()}_invalidateLayerData(e,t){this._rootTiles!=null&&(W(this._rootTiles,n=>n.removeLayerAgent(e,t)),W(this._rootTiles,n=>{n.invalidateLayerData(e,t),n.restartAgents(t)}))}setTileTreeDirty(e){this._allTilesDirty=!0,e&&(this._allTilesCreated=!1)}requestRender(e=1){this.renderer.requestRender(e)}requestUpdate(){++this._pendingUpdates===1&&(this._hasPendingUpdates=!0)}requestTileData(e,t,n,r){let i=this.layerViewByIndex(t,n),{tilemapCache:a}=i;return!a||M(i)?this._requestTileData(e,n,i,r):(++this._asyncWorkItems,a.fetchAvailability(e.level,e.lij[1],e.lij[2],{...r,timeout:6e3}).catch(t=>{throw te(r),ne(t)||this._dataMissing(e,n,i),t}).then(()=>this._frameTask.schedule(()=>this._requestTileData(e,n,i,r),r.signal)).finally(()=>--this._asyncWorkItems))}_requestTileData(e,t,n,r){return this.destroying?Promise.resolve():t===0?z(n)?this._requestElevationTileData(e,n,r):Promise.reject():L(n)?this._requestMapTileData(e,n,r):Promise.reject()}_requestElevationTileData(e,t,n){++this._asyncWorkItems;let r=r=>{!p(n)&&r&&(this.setMemoryDirty(),this.requestUpdate(),this._elevationDataArrived(e,t,r))},i=n=>{ne(n)||(s.getLogger(this).error(`Tile ${e.lij.toString()} layer 0/${t.uid} error ${n}`),this._dataMissing(e,0,t),this.requestUpdate())};return t.fetchElevationTile(e,{...Ee,...n}).then(e=>this._frameTask.schedule(()=>r(e)),i).finally(()=>--this._asyncWorkItems)}_elevationDataArrived(e,t,n){let r=this._layerIndexByUid[0].get(t.uid);if(r==null){s.getLogger(this).warn(`TerrainSurface: received data from unknown layer %d %s`,0,e.lij.toString());return}let i=new Pe(e.lij,e.extent,n);e.dataArrived(r,0,i),this.emit(`tile-data-changed`,{tile:e,layerIndex:r,layerClass:0});let a=[e],o=e.level,c=this._iteratorPool.acquire();for(c.reset(a);!c.done;){let e=c.next();e.findElevationBoundsForLayer(r,o),e.computeElevationBounds()}o===0&&this._updateRootTileElevationRange(),c.remove(),this._updateTilesVisibility(a)}_requestMapTileData(e,t,n){++this._asyncWorkItems;let r=(r,i)=>{B(i),p(n)||(console.error(`Tile ${e.lij.toString()} layer 1/${t.uid} error ${r}`),this._dataMissing(e,1,t),this.requestUpdate())},i=e=>t=>r(t,e);return t.fetchTile(e.lij,n).then(r=>this._frameTask.schedule(()=>{this.requestUpdate(),p(n)?B(r):this._mapTileDataArrived(e,t,r)},n.signal,i(r)).catch(i(r)),(e,t=null)=>this._frameTask.schedule(()=>r(e,t))).finally(()=>--this._asyncWorkItems)}_mapTileDataArrived(e,t,n){let r=this.getLayerIndexByUID(1,t.uid);r==null?(B(n),s.getLogger(this).warn(`TerrainSurface: received data from unknown layer`)):(e.dataArrived(r,1,n),this.emit(`tile-data-changed`,{tile:e,layerIndex:r,layerClass:1}))}_dataMissing(e,t,n){let r=this.getLayerIndexByUID(t,n.uid);r==null?s.getLogger(this).warn(`TerrainSurface: received data from unknown layer`):(e.dataMissing(r,t),this.emit(`tile-data-changed`,{tile:e,layerIndex:r,layerClass:t}))}get performanceInfo(){let e=this._performanceInfo;return e.numNodes=this._allTiles.length,e.numLeaves=e.numVisible=e.numRendered=e.numLoadedPerLevel.length=e.numRenderedPerLevel.length=0,this._allTiles.forAll(t=>{t.leaf&&e.numLeaves++;let n=t.level;t.renderData&&(e.numLoadedPerLevel[n]=(e.numLoadedPerLevel[n]||0)+1),t.visible&&(e.numVisible++,t.rendered&&(e.numRenderedPerLevel[n]=(e.numRenderedPerLevel[n]||0)+1,e.numRendered++))}),e}setMemoryDirty(){this._usedMemory=null}get usedMemory(){return this.tilingScheme?(this._usedMemory??=this._recalculateUsedMemory(),this._usedMemory??0):0}_recalculateUsedMemory(){return this.tilingScheme?Math.round(this._allTiles.reduce((e,t)=>e+t.usedMemory,0)):null}getUsedMemoryForLayerView(e){let t=0,n=this._layerClassFromLayerView(e),r=this.getLayerIndexByUID(n,e.uid);return r!=null&&this._allTiles.forAll(e=>t+=e.getUsedMemoryForLayer(n,r)),t}get renderPatchBorders(){return this._renderer.renderPatchBorders}set renderPatchBorders(e){this._renderer.renderPatchBorders=e}get renderingDisabled(){return this._renderer.renderingDisabled}set renderingDisabled(e){this._renderer.renderingDisabled=e}get test(){}checkAllTilesWaterproofness(e=`render-patch-groups`){}get isGlobal(){return this._isGlobal}get isGeographic(){return this._isGeographic}get isWebMercator(){return this._isWebMercator}get isWebMercatorOnPlateCarree(){return this._isWebMercatorOnPlateCarree}isEastEndWrap(e){return this._isGlobal&&e[2]===this.lijEastEnd(e[0])-1}isWestEndWrap(e){return this._isGlobal&&e[2]===0}lijEastEnd(e){return 1<<e+ +!!this._isGeographic}wrapEastWest(e){let t=this.lijEastEnd(e[0]),n=e[2];if(0<=n&&n<t)return e;if(!this._isGlobal)return null;let r=(n+(n<0?t:0))%t;return[e[0],e[1],r]}enableInternalChecks(e){Qe(e)}enableWaterproofnessChecks(e){$e(e)}static cleanupTerrainSurface(){xt.prune()}enable(e){e!==this.enabled&&(this._set(`enabled`,e),e?(this._updateRootTiles(),this.freeze=!1,this.view.elevationProvider.register(0,this)):(this.view.elevationProvider.unregister(this),this.freeze=!0,this._removeAllTiles(),this._setRootTiles(null)),this.notifyChange(`ready`))}updateOverlayParameters(){let{overlayManager:e}=this;this.allTiles.forAll(t=>t.updateOverlayParameters(e))}};e([v()],q.prototype,`_renderer`,void 0),e([v({constructOnly:!0})],q.prototype,`_scaleRangeQueries`,void 0),e([v({constructOnly:!0})],q.prototype,`view`,void 0),e([v({constructOnly:!0})],q.prototype,`overlayManager`,void 0),e([v()],q.prototype,`_hasPendingUpdates`,void 0),e([v()],q.prototype,`_asyncWorkItems`,void 0),e([v()],q.prototype,`_allTilesDirty`,void 0),e([v()],q.prototype,`_allTilesSorted`,void 0),e([v()],q.prototype,`allTilesCreated`,null),e([v()],q.prototype,`_allTilesCreated`,void 0),e([v()],q.prototype,`_viewChanged`,void 0),e([v({type:Number})],q.prototype,`heading`,void 0),e([v()],q.prototype,`_splitLimits`,void 0),e([v()],q.prototype,`_frameTask`,void 0),e([v()],q.prototype,`demResolution`,null),e([v({readOnly:!0})],q.prototype,`snapLevel`,null),e([v({readOnly:!0})],q.prototype,`lodSnappingEnabled`,null),e([v()],q.prototype,`_stencilEnabledExtents`,null),e([v({readOnly:!0})],q.prototype,`userClippingExtent`,null),e([v()],q.prototype,`_rootTilesExtent`,void 0),e([v({readOnly:!0})],q.prototype,`groundExtent`,null),e([v({readOnly:!0})],q.prototype,`fullGroundExtent`,null),e([v({readOnly:!0})],q.prototype,`_tilingSchemeExtent`,null),e([v({readOnly:!0})],q.prototype,`updating`,null),e([v({readOnly:!0})],q.prototype,`readyToRun`,null),e([v(Ne)],q.prototype,`updatingProgress`,void 0),e([v({readOnly:!0})],q.prototype,`updatingProgressValue`,null),e([v()],q.prototype,`_maxNumUpdating`,void 0),e([v()],q.prototype,`baseOpacity`,null),e([v()],q.prototype,`hasCompositeBlendMode`,void 0),e([v({readOnly:!0})],q.prototype,`viewingMode`,null),e([v()],q.prototype,`maxTextureScale`,void 0),e([v({readOnly:!0})],q.prototype,`ready`,null),e([v({readOnly:!0})],q.prototype,`rootTiles`,null),e([v()],q.prototype,`_rootTiles`,void 0),e([v({readOnly:!0})],q.prototype,`spatialReference`,null),e([v({type:t})],q.prototype,`backgroundColor`,null),e([v({value:!1})],q.prototype,`slicePlaneEnabled`,null),e([v({readOnly:!0})],q.prototype,`tilingScheme`,void 0),e([v({readOnly:!0})],q.prototype,`tilingSchemeLocked`,null),e([v({readOnly:!0})],q.prototype,`tilingSchemeLogic`,void 0),e([v()],q.prototype,`wireframe`,null),e([v()],q.prototype,`opaque`,null),e([v()],q.prototype,`invisible`,null),e([v({value:!1})],q.prototype,`freeze`,null),e([v()],q.prototype,`fadeDuration`,null),e([v()],q.prototype,`_xNormalizer`,null),e([v()],q.prototype,`visibleElevationRange`,void 0),e([v()],q.prototype,`_rootTileElevationRange`,void 0),e([v()],q.prototype,`_layerViewsDirty`,void 0),e([v()],q.prototype,`renderPatchBorders`,null),e([v()],q.prototype,`renderingDisabled`,null),e([v({readOnly:!0})],q.prototype,`enabled`,void 0),q=K=e([ie(`esri.views.3d.terrain.TerrainSurface`)],q);const vt=q,J=y(),yt=new Se,Y=S(),bt=S(),xt=new f,X={spatialReference:null,extent:null,scale:0};function St(e,t,n){for(let r of e){if(!r.containsPointXY(t,n))continue;let e=r;for(;e&&!e.renderData;){let r=+(t>e.extentMidX)+(n<e.extentMidY?2:0);e=e.children[r]}let i=e?.renderData?.geometryState.samplerData??null;return Fe(t,n,i)}return null}function Z(e,t){!e.leaf||e.level<A||$(e,e=>{t&&Ct(e);let n=Q(e);if(e.maxLevelDeltaNeighborCount++,n){let t=e.parent;for(;t;){let e=Q(t);if(t.unmergableChildCount++,e)t=t.parent;else break}}})}function Ct(e){if(e.hasPendingUpdate(1))return;let t=e.parent;for(;t?.resetPendingUpdate(4);)t=t.parent;e.resetPendingUpdate(4),e.leaf&&e.setPendingUpdate(1),e.level<A||$(e,e=>{Ct(e)})}function wt(e){e.level<A||$(e,e=>{if(e.maxLevelDeltaNeighborCount--,e.maxLevelDeltaNeighborCount===0&&e.unmergableChildCount===0){let t=e.parent;for(;t&&(t.unmergableChildCount--,Q(t));)t=t.parent}})}function Q(e){return e.maxLevelDeltaNeighborCount===0&&e.unmergableChildCount===0}function $(e,t){if(e.level<A)return;let n=e.level-A,r=e.lij[1]>>A,i=e.lij[2]>>A,a=e=>e.leaf||e.level===n;for(let o=0;o<4;++o){let s=e.findNeighborTile(P[o],a);if(!s||s.level!==n)continue;let c=s.lij;(c[1]!==r||c[2]!==i)&&t(s)}}export{vt as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../Color.js";import{filterInPlace as n,difference as r}from"../../../core/arrayUtils.js";import i from"../../../core/CollectionFlattener.js";import{toConst as a}from"../../../core/compilerUtils.js";import{EventedAccessor as o}from"../../../core/Evented.js";import has from"../../../core/has.js";import s from"../../../core/Logger.js";import{clamp as c}from"../../../core/mathUtils.js";import{removeMaybe as l,destroyMaybe as u}from"../../../core/maybe.js";import{MemCachePool as ee}from"../../../core/MemCachePool.js";import d from"../../../core/ObjectPool.js";import f from"../../../core/PooledArray.js";import{throwIfAborted as te,isAbortError as p,isAborted as m}from"../../../core/promiseUtils.js";import{watch as h,syncAndInitial as g,initial as _,sync as v}from"../../../core/reactiveUtils.js";import"../../../core/scheduling.js";import{getMetersPerUnitForSR as ne}from"../../../core/units.js";import{property as y,subclass as re}from"../../../core/accessorSupport/decorators.js";import{exactEquals as ie,set as ae,copy as oe}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as se}from"../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as x,radiusModifier as ce}from"../../../geometry/ellipsoidUtils.js";import{projectWithoutEngine as le}from"../../../geometry/projectionUtils.js";import ue from"../../../geometry/SpatialReference.js";import{projectBoundingSphere as de}from"../../../geometry/projection/projectBoundingSphere.js";import{getProjector as fe}from"../../../geometry/projection/projectors.js";import{projectPointToVector as pe}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as me}from"../../../geometry/projection/projectVectorToVector.js";import{create as S,fromExtent as he,equals as C,intersection as ge,intersectsSphere as _e}from"../../../geometry/support/aaBoundingRect.js";import{copy as ve,create as ye}from"../../../geometry/support/frustumPlanes.js";import{createSpatialReferenceCyclical as be}from"../../../geometry/support/normalizeUtils.js";import{isGeographic as w,isPlateCarree as xe}from"../../../geometry/support/spatialReferenceUtils.js";import{Sphere as Se}from"../../../geometry/support/sphere.js";import{ElevationQueryTileCache as Ce}from"../../../layers/support/ElevationQueryTileCache.js";import{isIntegratedMeshLayer as we,isBaseLayer as Te}from"../../../layers/support/layerUtils.js";import{queueHighPriority as Ee}from"../../../request/queue.js";import{debugFlags as T}from"../support/debugFlags.js";import{ElevationRange as E}from"../support/ElevationRange.js";import{ElevationUpdateEvent as De}from"../support/ElevationUpdateEvent.js";import{calculateElevationUpdateExtents as Oe}from"../support/elevationUpdateExtentUtils.js";import{toBoundingRect as ke}from"../support/extentUtils.js";import{geographicMbsToGeographicExtent as Ae,mbsToGeographicExtent as je,intersectsGeographicExtent as Me}from"../support/sphereExtentUtils.js";import{isSupportedGCSOnGlobe as D}from"../support/supportedSpatialReference.js";import{updatingProgress as Ne}from"../support/updatingProperties.js";import{ElevationBounds as Pe}from"./ElevationBounds.js";import{ElevationData as Fe,sampleElevation as Ie}from"./ElevationData.js";import{create as Le}from"./ExtentHelper.js";import{LayerClasses as Re}from"./LayerClass.js";import{OverlayManager as ze}from"./OverlayManager.js";import{PlanarPatch as Be}from"./PlanarPatch.js";import{Queue as Ve}from"./Queue.js";import{ScaleRangeQueries as He}from"./ScaleRangeQueries.js";import{SphericalPatch as Ue}from"./SphericalPatch.js";import{SplitLimits as We}from"./SplitLimits.js";import{maxRootTiles as O,tooManyRootTilesAfterChangeError as Ge,tooManyRootTilesForLayerError as Ke,maxTileNeighborLevelDelta as k,maxMemoryLodBias as qe}from"./TerrainConst.js";import{TerrainRenderer as Je}from"./TerrainRenderer.js";import Ye from"./TerrainSurfacePerformanceInfo.js";import{weakAssert as A,isVectorTileLayerView as j,internalAssert as M,oppositeEdge as Xe,neighborEdgeIndices as N,isSurfaceLayerView as P,isGroupLayerView as F,isMapTileLayerView as I,isBlendableLayerView as L,isElevationLayerView as R,releaseTerrainData as z,oppositeCorner as Ze,enableTerrainInternalChecks as B,enableWaterproofTests as Qe,enableInternalTerrainChecks as $e,enableTerrainWaterproofChecks as et,neighborCornerIndices as tt}from"./terrainUtils.js";import{Tile as nt,lijEquals as V}from"./Tile.js";import{printAllocations as rt}from"./TilePerLayerInfo.js";import{sortTiles as it,IteratorPreorder as at,IteratorPostorder as ot,compareTilesByLij as H,sortTilesByPOI as st,traverseTilesPreorder as U}from"./tileUtils.js";import{TilingSchemeLogic as ct}from"./TilingSchemeLogic.js";import{getGroundTransparencyModeFromOpacity as lt}from"./TransparencyMode.js";import{UpsampleInfo as ut}from"./UpsampleInfo.js";import{isCompositeBlendMode as dt,blendModeFromString as ft}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{hasLayerBasedScaleVisibility as pt}from"../../support/layerViewUtils.js";import{ImmediateTask as mt,TaskPriority as ht,noBudget as gt}from"../../support/Scheduler.js";import{TextureCompressionTracker as _t}from"../../support/TextureCompressionTracker.js";import{Yield as vt}from"../../support/Yield.js";var W;let G=class extends o{static{W=this}get allTilesCreated(){return this._allTilesCreated}get allTiles(){return a(this._allTiles)}get renderedTiles(){return it(n(this._allTiles.toArray(),e=>e.visible&&e.rendered))}get demResolution(){let{_allTiles:e,tilingScheme:t}=this;if(e.length===0)return{min:1,max:1};let n=ne(t.spatialReference),r=1/0,i=-1/0;for(let a of e){let e=t.resolutionAtLevel(a.level)*n;r=Math.min(r,e),i=Math.max(i,e)}return{min:r,max:i}}constructor(e){super(e),this.terrainTextureCompressionTracker=new _t,this._iteratorPool=new d(()=>new at,e=>e.remove=()=>this._iteratorPool.release(e)),this._postorderIterator=new ot,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._allTilesCreated=!1,this._usedMemory=null,this._performanceInfo=new Ye,this._waterproofnessErrorHandle=null,this._viewChanged=!1,this.heading=0,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=b(),this._eyePosSurfaceSR=b(),this._splitLimits=new We,this._layerViews=[[],[]],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._updatingHandles=new se,this._poiWatchHandle=null,this._frameTask=mt,this._allTiles=new f,this._upsampleInfoPool=new d(()=>new ut),this._shouldEmitChangeEvent=!1,this._rootTilesExtent=S(),this.updatingProgress=.5,this._maxNumUpdating=1,this.maxTextureScale=1.2,this._spatialReference=ue.WebMercator,this._elevationProjectorCache=new Map,this._rootTileElevationRange=new E(1/0,-1/0),this._tilingSchemeSpatialReference=null,this._updatingRootTiles=!1,this._pendingTilesForElevationUpdateEvent=new Set,this._pendingTilesToUpdate=new Set,this.totalGeometryUpdates=0,this.totalTileUpdates=0,this._layerViewsDirty=!1,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._isWebMercator=!1,this._isWebMercatorOnPlateCarree=!1,this.enabled=!0;let{view:t}=e;this.overlayManager=new ze({...e,terrainSurface:this}),this._isGlobal=!t.state?.isLocal,this._isGeographic=this._spatialReference?.isGeographic??!1,this._tileConstructor=this._isGlobal?Ue:Be,this._ellipsoid=x(t.spatialReference),this._renderer=new Je(this,this.overlayManager.renderer,this._allTiles,this.terrainTextureCompressionTracker,t.resourceController.memoryController),pt()||(this._scaleRangeQueries=new He)}initialize(){let{view:e}=this,{resourceController:t}=e,{memoryController:n}=t;e.stage.addRenderPlugin(this._renderer),this._tileCache=new ee((e,t)=>n.newCache(e,t),`terrain-tile`),this._upsampleMapCache=n.newCache(`terrain-upsample`,({tile:e})=>e.unloadMapData()),this._elevationQueryCache=new Ce(n.newCache(`elevation-query`));let r=this.overlayManager;this.addHandles([h(()=>r.renderer.isEmpty,()=>this._evaluateTransparency()),h(()=>this.renderer.visible,e=>this.freeze=!e),h(()=>this.heading,e=>{this._renderer.updateHeading(e),this._updateTileTextures(0)},g)],`overlayManager`),this._updatingHandles.add(()=>({heading:e.camera?.heading,state:e.state?.mode}),({heading:e,state:t})=>{if(e==null)return;if(this.isGlobal&&this.isGeographic||this.isWebMercatorOnPlateCarree){this.heading=Math.round(e/90)*90%360;return}let n=Math.round(e)%360,r=Math.abs(n-this.heading);(t===2||Math.min(r,360-r)>=30)&&(this.heading=n)},_),this.addHandles([h(()=>this.baseOpacity,()=>{this._handleLayerViewChanges(),this._updateTileTextures(this._evaluateTransparency()?1:2)},g),h(()=>this.hasCompositeBlendMode,()=>this._updateTileTextures(this._evaluateTransparency()?1:2),g),h(()=>this.backgroundColor,(e,t)=>{e?.equals(t)||(this._handleLayerViewChanges(),this._renderer.updateTileBackground(e))},v),h(()=>this.snapLevel,()=>this._viewChanged=!0,v),h(()=>this.view.pointsOfInterest,e=>{this._renderer.pointsOfInterest=e,this._poiWatchHandle=l(this._poiWatchHandle),e&&(this._poiWatchHandle=this._updatingHandles.add(()=>e.focus?.renderLocation,()=>this._allTilesSorted=!1,{equals:ie}))}),h(()=>T.TERRAIN_TILE_TREE_SHOW_TILES,t=>{t&&!this._treeDebugger?import(`../layers/support/TerrainTileTree3DDebugger.js`).then(({TerrainTileTree3DDebugger:t})=>{!this._treeDebugger&&T.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new t({view:e}))}):t||(this._treeDebugger=u(this._treeDebugger))},_)]);let{spatialReference:a}=e;this._extentHelper=Le(this.viewingMode,{layers:e.map.allLayers,layerViews:e.allLayerViews,viewSpatialReference:a});let o=new i({getCollections:()=>e.defaultsFromMap?.mapCollections?.map(({layers:e})=>e),getChildrenFunction:e=>e&&`layers`in e?e.layers:null}),s=new ct({layers:o,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:a});this._set(`tilingSchemeLogic`,s),this._updateTilingScheme();let c=t.scheduler;this._frameTask=c.registerTask(ht.TERRAIN_SURFACE,this),this.addHandles([h(()=>this._stencilEnabledExtents,e=>this._renderer.setStencilEnabledLayerExtents(e),_),h(()=>this.tilingSchemeLogic.tilingScheme,()=>this._updateTilingScheme(),v),h(()=>this.groundExtent,()=>this._updateRootTiles(),_),e.on(`resize`,()=>this._viewChangeUpdate()),h(()=>{let t=e.state;return[this._lodBias,this.lodSnappingEnabled,e.quality,t.camera,t.contentCamera,t.fixedContentCamera]},()=>this._viewChangeUpdate(),g),h(()=>e.qualitySettings?.fadeDuration,e=>this._renderer.textureFadingEnabled=e>0,_),h(()=>e.qualitySettings?.physicallyBasedRenderingEnabled,e=>this._renderer.pbrMode=e?5:0,_),h(()=>e.qualitySettings?.tiledSurface.elevationLevelDelta,()=>{this._allTiles.forAll(e=>this.updateElevationSources(e)),this._updateAllTileGeometries()}),h(()=>this.userClippingExtent,()=>this._updateClippingExtent(),v)]),this.addHandles(e.allLayerViews.on(`after-changes`,()=>this._layerViewsDirty=!0)),this._layerViewsDirty=!0,this._handleLayerViewChanges(),this._renderer.updateTileBackground(this.backgroundColor)}clearHandles(){this._updatingHandles?.removeAll(),this.removeAllHandles(),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear()}destroy(){this._waterproofnessErrorHandle?.remove(),this._waterproofnessErrorHandle=null,this._frameTask.remove(),this._frameTask=mt,this._updatingHandles?.destroy(),this._removeAllTiles(),this._set(`tilingSchemeLogic`,u(this.tilingSchemeLogic)),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear(),this._set(`overlayManager`,u(this.overlayManager)),this._tileCache=u(this._tileCache),this._allTiles.prune(),nt.prune(),this._treeDebugger=u(this._treeDebugger),this._renderer.destroyed||(this.view.stage.removeRenderPlugin(this._renderer),this._renderer.destroy()),this._renderer=null,this._iteratorPool=u(this._iteratorPool),this._upsampleMapCache=u(this._upsampleMapCache),this._elevationQueryCache=u(this._elevationQueryCache),this._set(`view`,null),this._extentHelper=u(this._extentHelper),this._upsampleInfoPool=u(this._upsampleInfoPool),rt(),this._layerViews.forEach(e=>e.length=0),this._performanceInfo=null}get renderer(){return this._renderer}get frustum(){return this.view.state.camera.frustum}get snapLevel(){return this.lodSnappingEnabled?this.view.terrainLevel:null}get lodSnappingEnabled(){return this.view.qualitySettings.tiledSurface.reduceTileLevelDifferences}get upsampleInfoPool(){return this._upsampleInfoPool}get upsampleMapCache(){return this._upsampleMapCache}get elevationQueryCache(){return this._elevationQueryCache}get hasStencilEnabledExtents(){return!!this._stencilEnabledExtents?.length}get _stencilEnabledExtents(){let e=this.spatialReference,t=!!has(`enable-feature:im-as-ground`);return e==null?null:Iterator.from(this.view.allLayerViews).map(n=>{let{layer:r}=n;if(!we(r)||t&&!r.isUsedAsGroundLayer)return null;let{fullExtent:i}=r,a=i==null||i.spatialReference.equals(e)?i:le(i,i.spatialReference,e);return a?he(a):null}).filter(e=>e!=null).toArray()}get userClippingExtent(){let{spatialReference:e}=this,t=this.view?.clippingArea;if(t==null||e==null)return null;let n=S(),r=ke(t,n,e)?n:null,i=this._get(`userClippingExtent`);return C(r,i)?i:r}get rootTilesExtent(){return this._rootTilesExtent}get groundExtent(){let e=ge(this.fullGroundExtent,this.userClippingExtent,S()),t=this._get(`groundExtent`);return C(e,t)?t:e}get fullGroundExtent(){return this._tilingSchemeExtent==null?this._rootTilesExtent:this._tilingSchemeExtent}get _tilingSchemeExtent(){return this.tilingSchemeLogic?.extent}get updating(){return this._hasPendingUpdates||(this._maxNumUpdating=1),this.enabled&&!!((this.readyToRun||this._updatingHandles?.updating||this._asyncWorkItems>0)&&this.ready&&!this.freeze||this.overlayManager?.updating||this.terrainTextureCompressionTracker.compressing)}get readyToRun(){return this.enabled&&(this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||!this._allTilesSorted||this._layerViewsDirty||this._scaleRangeQueries?.updating||this._frameTask.updating)&&this.ready&&!this.freeze}get updatingProgressValue(){return this._maxNumUpdating=Math.max(this._pendingUpdates,this._maxNumUpdating),1-this._pendingUpdates/this._maxNumUpdating}get baseOpacity(){return this.view?.map?.ground?.opacity??1}set baseOpacity(e){this.view.map.ground.opacity=e}get viewingMode(){return this.view.state.viewingMode}get ready(){return!this.enabled||this._rootTiles!=null}get rootTiles(){return this._rootTiles}get spatialReference(){return this.tilingScheme?.spatialReference??null}get backgroundColor(){return this.view?.map?.ground?.surfaceColor}set backgroundColor(e){this.view.map.ground.surfaceColor=e}set slicePlaneEnabled(e){this._renderer.slicePlaneEnabled=e,this._set(`slicePlaneEnabled`,e),this._evaluateTransparency()}get tilingSchemeLocked(){return this.tilingSchemeLogic?.tilingSchemeLocked??!1}get wireframe(){return this._renderer?.wireframe}set wireframe(e){e!==this._renderer.wireframe&&(this._renderer.wireframe=e,this._updateAllTileGeometries())}get opaque(){return this._renderer.transparency===0}get invisible(){return this._renderer.transparency===3}set freeze(e){this._set(`freeze`,e),this._viewChangeUpdate()}get fadeDuration(){return this.view.qualitySettings.fadeDuration??0}intersect(e,t,n,r){this._renderer.intersectRay(e,t,n,r)}getElevationLevelDelta(e){return e<4?3:this.view.qualitySettings.tiledSurface.elevationLevelDelta}get _xNormalizer(){return be(this._spatialReference)}getElevation(e,t,n,r){let i=this._rootTiles;if(!i?.length||!this.enabled||i[0].layerInfo[0].length===0)return null;let a=this._elevationProjectorCache.get(r);if(a===void 0&&(a=fe(r,this._spatialReference)??null,this._elevationProjectorCache.set(r,a)),a==null)return s.getLogger(this).error(`TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system`),null;let o=ae(K,e,t,n);a(o,0,o,0);let c=this._xNormalizer?.normalize(o[0])??o[0],l=o[1];return Y(i,c,l)}getElevations(e,t,n){let r=this._rootTiles,i=r?r[0].layerInfo[0].length:0;if(!r?.length||i===0||!this.enabled)for(let e=0;e<t;++e)n(e,null);else for(let i=0;i<t;++i){let t=i*3,a=e[t],o=e[t+1],s=Y(r,a,o);n(i,s)}}getLayerIndexByUID(e,t){return this._layerIndexByUid[e].get(t)}get visibleElevationRange(){let e=1/0,t=-1/0;for(let n of this._allTiles)n.renderData&&(e=Math.min(e,n.elevationBoundsMin),t=Math.max(t,n.elevationBoundsMax));let n=this._get(`visibleElevationRange`);return n?.minElevation===e&&n.maxElevation===t?n:new E(e,t)}invalidateElevationRange(){this.notifyChange(`visibleElevationRange`)}tileElevationRangeChanged(e,t=1/0,n=-1/0){let r=this._get(`visibleElevationRange`);(!r||t===r.minElevation||n===r.maxElevation||e.renderData&&(e.elevationBoundsMin<r.minElevation||e.elevationBoundsMax>r.maxElevation))&&this.invalidateElevationRange()}getScale(e){if(!this.tilingScheme)return null;if(!pe(e,K,this.spatialReference))return s.getLogger(this).error(`TerrainSurface.getScale(): could not project given point to tiling scheme coordinate system`),null;let t=this._rootTiles;if(t!=null){for(let e of t)if(e?.containsPoint(K)){let t=e;for(;t.children[0]&&!t.rendered;){let e=t.children[0].extent,n=0;K[0]>e[2]&&(n+=1),K[1]<e[1]&&(n+=2),t=t.children[n]}return this._getLodBiasCorrectedScale(t.level)}}return 1/0}getSphereElevationRange(e,t){if(!this.enabled)return null;let n=this._rootTiles,r=this._tilingSchemeSpatialReference;if(n==null||r==null||n.length===0)return null;let i=w(r);if(i){let n=w(t)&&D(t),i=x(t);if(n&&D(r)&&i===x(r))Ae(e,q,i.radius);else if(!je(e,t,q,r))return s.getLogger(this).error(`TerrainSurface.getSphereElevationRange(): could not project the query sphere`),null}else if(!de(e,t,bt,r))return s.getLogger(this).error(`TerrainSurface.getSphereElevationRange(): could not project the query sphere`),null;let a=new E,o=[];for(let e of n)o.push(e);let c=0;for(;c<o.length;){let e=o[c];if(++c,!(i?Me(e.extent,q,r):_e(e.extent,bt)))continue;let t=e.children;if(t[0]==null||e.rendered)a.expandElevationRangeValues(e.elevationBoundsMin,e.elevationBoundsMax);else for(let e of t)o.push(e)}return a}getRootElevationRange(){return this.enabled&&this._rootTiles!=null?new E(this._rootTileElevationRange.minElevation,this._rootTileElevationRange.maxElevation):null}getLowerBoundRadius(){let e=this.visibleElevationRange,t=(this._ellipsoid.radius+(e.isEmpty?0:e.minElevation))*ce;return Math.min(t,this._ellipsoid.radius)}queryVisibleScaleRange(e,t,n,r){if(!this._scaleRangeQueries)return;let i=t?this.tilingScheme.levelAtScale(t):0,a=n?this.tilingScheme.levelAtScale(n):1/0,o=this._lodBias;this._scaleRangeQueries.queryVisibleLevelRange(e,i+o,a+o,r)}_evaluateTransparency(){let e=this.baseOpacity,t=this.overlayManager.renderer.isEmpty,n=this._renderer.transparency,r=this._isFullyTransparent?lt(0,t):e>=1&&!this.hasCompositeBlendMode&&!this._renderer.slicePlaneEnabled?0:1;return this._renderer.transparency=r,n!==r&&(this.notifyChange(`opaque`),this.notifyChange(`invisible`),!0)}_updateTilingScheme(){let{tilingScheme:e}=this.tilingSchemeLogic;if(e===this.tilingScheme)return;A(!!e,`tiling scheme cannot be reset to undefined`),this._isGlobal=!this.view?.state?.isLocal,this.tilingScheme&&this._removeAllTiles();let t=e?.spatialReference??ue.WebMercator;this._spatialReference=t,this._isWebMercator=!!t?.isWebMercator,this._isWebMercatorOnPlateCarree=this._isWebMercator&&xe(this.view?.renderSpatialReference),this._isGeographic=t?.isGeographic??!1,this._set(`tilingScheme`,e),this._tilingSchemeSpatialReference=this.tilingScheme?.spatialReference,this._updateClippingExtent(),e&&(this._updateTiledLayers(),this._renderer.tileSize=e.pixelSize,this.overlayManager.spatialReference=e.spatialReference,this._updateRootTiles())}static{this._tileMemcacheKey=`TerrainTileMemcache`}_acquireTile(e,t,n,r){let i=this._tileCache.pop(W._tileMemcacheKey);return i?(i.init(e,t,n,r,this),i):new this._tileConstructor(e,t,n,r,this)}get updatingRootTiles(){return this._updatingRootTiles}_updateRootTiles(){let{groundExtent:e,tilingScheme:t}=this;if(!t)return;if(!this.enabled){this._setRootTiles(null);return}let n=xt,i=t.rootTilesInExtent(e,n,O*5);if(this._rootTiles!=null){if(i.length>O){s.getLogger(this).warn(Ge);return}let e=this._rootTiles.map(e=>e.lij),t=r(e,i,V);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){let e=this._rootTiles.filter(e=>t.removed.findIndex(t=>V(t,e.lij))>-1?(this._purgeTile(e),!1):!0);t.added.forEach(t=>e.push(this._newRootTile(t))),this._setRootTiles(e)}}else this._updatingRootTiles=!0,i.length>O&&(s.getLogger(this).warn(Ke),i=t.rootTilesInExtent(e,n,O)),this._setRootTiles(i.map(e=>this._newRootTile(e)));C(n,this._rootTilesExtent)||(this._rootTilesExtent=S(n)),this.renderer.visible=!0,this.overlayManager.setPlacementDirty(),this.notifyChange(`ready`),this._updateAllTileGeometries(),this._updatingRootTiles=!1,this._viewChangeUpdate(),this.checkAllTilesWaterproofness(`root-tiles-updated`)}_updateAllTileGeometries(){let e=this._allTiles.filter(e=>this._canUpdateTileGeometry(e));e.length===0||(e.sort(H),e.forEach(e=>this._renderer.updateTileGeometryState(e)),e.forEach(e=>e.renderData.updateNeighborData()),this._updateTilesGeometries(e)),this._pendingTilesToUpdate.clear()}_updateTilesGeometries(e){let t=e.filter(e=>this._canUpdateTileGeometry(e));if(t.length===0)return;let n=this.renderer;for(let e of t)n.updateGeometryIfNeeded(e);for(let e of t)this._pendingTilesForElevationUpdateEvent.add(e)}_canUpdateTileGeometry(e){return e.loaded&&e.intersectsClippingArea&&e.hasGeometryState}_shouldSplit(e){return e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.snapLevel)===1}_newRootTile(e){let t=this._acquireTile(0,e[1],e[2],null);return this._shouldSplit(t)&&t.setPendingUpdate(1),this._loadTile(t),this._markTileToUpdate(t),this._updateRootTileElevationRange(),t}_setRootTiles(e){if(this._rootTiles=e,this._allTiles.clear(),e!=null){let t=this._iteratorPool.acquire();for(t.reset(e);!t.done;)this._allTiles.push(t.next());t.remove()}this.invalidateElevationRange(),this._renderer.setRootTiles(this._rootTiles),this._updateTilesVisibility(e),this.notifyChange(`demResolution`),this.emit(`tiles-changed`,{allTiles:this.allTiles})}_runViewChangeUpdateIfDirty(){this._viewChangeUpdateDirty&&(this._viewChangeUpdateDirty=!1,this._viewChangeUpdate())}_viewChangeUpdate(){this.view&&!this.freeze&&this.tilingScheme&&this.renderer.visible&&(this._inFrameTask||this._updatingRootTiles?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateTilesVisibility(this._rootTiles)))}_updateClippingStatus(e){e.updateClippingStatus(this.groundExtent)&&e.resetPendingUpdate(8)&&this._updateTileGeometryState(e)}_updateTilesVisibility(e){if(e==null)return;let t=this.groundExtent,n=this.view.state.contentCamera.viewProjectionMatrix;this.setTileTreeDirty(!1);let r=this._iteratorPool.acquire();for(r.reset(e);!r.done;){let e=r.next();e.updateClippingStatus(t)&&e.resetPendingUpdate(8)&&this._updateTileGeometryState(e),e.computeVisibility(),e.updateScreenDepth(n)}r.remove(),this._viewChanged=!0,this._allTilesDirty=!0,this._updatePendingTileGeometries()}_updateRootTileElevationRange(){let e=1/0,t=-1/0;this._rootTiles?.forEach(({elevationBoundsMin:n,elevationBoundsMax:r})=>{e=Math.min(e,n),t=Math.max(t,r)});let n=this._rootTileElevationRange;(n.minElevation!==e||n.maxElevation!==t)&&(this._rootTileElevationRange=new Pe(e,t))}_updateViewDependentParameters(){let{camera:e,contentCamera:t}=this.view.state,n=Math.tan(t.fovX*.5),r=Math.tan(t.fovY*.5),i=this.tilingScheme.pixelSize,a=2**-this._lodBias*e.pixelRatio;this._splitLimits.aboveGround=e.aboveGround,this._splitLimits.fovX=n,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=i/e.width*this.maxTextureScale*a,this._splitLimits.relativeHeightLimit=i/e.height*this.maxTextureScale*a,this._splitLimits.maxLod=this.tilingScheme.getMaxLod(),this._splitLimits.angledSplitBias=this.view.qualitySettings.tiledSurface.angledSplitBias,this.view.state.fixedContentCamera?this._splitLimits.frustum=ve(this._splitLimits.frustum??ye(),t.frustum):this._splitLimits.frustum=null,oe(this._eyePosRenderSR,t.eye),me(e.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateTileGeometryState(e){e.updateVisibility(),this._renderer.updateTileGeometryState(e)&&this._markTileToUpdate(e),this.setMemoryDirty()}_markAllTileNeighborsForUpdate(e){let t;e.forEachLoadedNeighbor(e=>{t??=this._layerViews[1].some(j),t&&e.setPendingUpdate(32),this._pendingTilesToUpdate.add(e)})}_updateTileTexture(e,t){let n=e.hasPendingUpdate(32)?32:e.hasPendingUpdate(16)?16:!1;if(n){let r=this._renderer.updateTileTexture(e,n);return this._usedMemory=null,r&&e.resetPendingUpdate(n),t.madeProgress(),r}return!0}_emitElevationUpdateEventForTiles(){if(!this._shouldEmitChangeEvent)return;let e=this._pendingTilesForElevationUpdateEvent;if(e.size>0){let t=new Float64Array(4*e.size),n=0;for(let r of e)t.set(r.extent,4*n),++n;e.clear();for(let e of Oe(t,this.spatialReference)){let t=new De(this.spatialReference,e,`ground`);this.emit(`elevation-change`,t)}}this._shouldEmitChangeEvent=!1}runTask(e){this._handleLayerViewChanges(e),this._frameTask.processQueue(e),this.renderer.processScaleRangeQueries(this._scaleRangeQueries,e),this._inFrameTask=!0,this._pendingUpdates=0,this._hasPendingUpdates=!1,this._updateAllTilesStatus(e),this._sortTiles(e);let t=!this.view.state.fixedContentCamera;this._mergeAndSplit(e,t),this._updateElevation(e);let n=this._updateTextures(e);t||this._mergeAndSplit(e,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty();let r=this._pendingTilesToUpdate.size>0,i=r&&this._hasPendingGeometryWithoutIndices();if((!e.done||i)&&this._updatePendingTileGeometries(),this._emitElevationUpdateEventForTiles(),e.done&&(e.hasProgressed||r&&!i)&&this.requestUpdate(),this.notifyChange(`updatingProgressValue`),!n||!e.hasProgressed)return vt}_checkTileInvariant(){}_updateAllTilesStatus(e){if(!this._viewChanged||!this._rootTiles||e.done)return;this._viewChanged=!1;let t=!1,n=new Ve(this._allTiles.length);n.pushAll(this._rootTiles);let r=this.snapLevel,i=this._splitLimits,a=this._eyePosRenderSR;this._allTiles.forAll(e=>{e.maxLevelDeltaNeighborCount=0,e.unmergableChildCount=0});let o=this.view.state.contentCamera.viewProjectionMatrix;for(;!n.empty;){let e=n.pop(),s=e.parent?.hasPendingUpdate(4),c=e.elevationLevel,l=s?4:e.shouldSplit(i,a,r),u=l===1;e.leaf?X(e,u):n.pushAll(e.children),s?(e.resetPendingUpdate(1),e.leaf||(e.setPendingUpdate(4),t=!0),this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(o)):(u?(e.resetPendingUpdate(4),e.leaf&&(e.setPendingUpdate(1),t=!0)):(e.resetPendingUpdate(1)&&e.updateAgentSuspension(),l===2&&e.updateAgents(0),e.leaf||(e.setPendingUpdate(4),e.resetPendingUpdate(1),t=!0)),e.elevationLevel!==c&&this.updateElevationSources(e))}this._allTilesDirty=t,this.requestUpdate(),this._shortBatches&&this._updatePendingTileGeometries(),e.madeProgress()}_sortTiles(e){!e.done&&!this._allTilesSorted&&this.view.pointsOfInterest?.focus&&(st(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger?.update(),e.madeProgress())}_markTileToUpdate(e){M(e.loaded),e.intersectsClippingArea&&(this._pendingTilesToUpdate.add(e),this._markAllTileNeighborsForUpdate(e))}_hasPendingGeometryWithoutIndices(){for(let e of this._pendingTilesToUpdate)if(e.loaded&&e.intersectsClippingArea&&e.renderData?.vao?.indexBuffer==null)return!0;return!1}_updatePendingTileGeometries(){let e=this._pendingTilesToUpdate,t=[];if(e.forEach(e=>{this._canUpdateTileGeometry(e)&&t.push(e)}),t.length===0){e.clear();return}let n=(n,r)=>{!r||!this._canUpdateTileGeometry(r)||r.level<n.level||e.has(r)||(e.add(r),t.push(r),r.renderData.updateNeighborData())};t.sort(H);let r=t.length;for(let i=0;i<r;++i){let r=t[i];M(r.loaded),M(r.intersectsClippingArea);let a=r.renderData;if(!a?.geometryState)continue;a.updateNeighborData();let o=a.dirtyEdgeResolutions,s=a.geometryState,c=e=>{let t=tt[e];n(r,s.cornerPeerNeighbors[e]?.findCorner(Ze(t),e=>e.loaded))};for(let t=0;t<4;++t)if(o&1<<t){let i=a.geometryState.edgePeerNeighbors[t];i&&i?.level>=r.level&&i.forAllSubtreeOnSide(Xe(N[t]),t=>this._canUpdateTileGeometry(t)?(M(e.has(t)||H(r,t)<0),n(r,t),!0):!1),c((t+1)%4),c(t)}}e.clear(),t.sort(H),this._updateTilesGeometries(t),this._shouldEmitChangeEvent=!0,B&&Qe&&this.checkAllTilesWaterproofness(`pending-geometries-updated`)}_mergeAndSplit(e,t){if(this.freeze||e.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate();let n=!1,r=this.view.state.fixedContentCamera,i=!1;for(;!e.done;){i=!0;let a=!1,o=!this._allTiles.some(i=>{if(!n&&!r&&!i.visible)return e.done;let o=i;if(i.hasPendingUpdate(4)){if(!t||i.unmergableChildCount>0)return e.done;for(i.resetPendingUpdate(4);o.parent!=null&&o.parent.unmergableChildCount===0&&o.parent.resetPendingUpdate(4);)o=o.parent;this._mergeTile(o),a=!0,e.madeProgress()}else if(i.resetPendingUpdate(1)){let t=!0,n=i.level;if(n>=k){let e=e=>e.leaf||n-e.level<k;for(let r=0;r<4;++r){let a=i.findNeighborTile(N[r],e);a!=null&&n-a.level===k&&(t=!1,B&&(M(a.leaf),M(a.hasPendingUpdate(1))))}}t?(this._splitTile(i),e.madeProgress(),a=!0):i.setPendingUpdate(1)}return e.done});if(a&&(this._allTilesSorted=!1,this._allTilesDirty=!0),o){if(!n){n=!0;continue}if(!a)break}else this._allTilesDirty=!0}i?e.madeProgress():this._allTilesDirty=!0,this._allTilesCreated=!this.allTiles.some(e=>e.hasPendingUpdate(1)||e.hasPendingUpdate(4)&&e.unmergableChildCount===0),this._sortTiles(e)}_updateElevation(e){e.done||this._allTiles.some(t=>(t.resetPendingUpdate(8)&&(this._updateTileGeometryState(t),e.madeProgress()),e.done))}updateElevationSources(e){e.needsElevationSourceUpdate()&&(e.updateAgents(0),e.markElevationSourceUpdateRequested(),this.requestUpdate())}_updateTextures(e){if(e.done)return!0;let t=!0;return this._allTiles.some(n=>(this._updateTileTexture(n,e)||(t=!1),e.done)),t}_updateClippingExtent(){this.spatialReference&&(this.updateOverlayParameters(),this.requestRender(1),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get _lodBias(){return this.view.qualitySettings.tiledSurface.lodBias-(1-this.view.quality)*qe}_getLodBiasCorrectedScale(e){let t=this.tilingScheme.levels,n=c(e-this._lodBias,0,t.length-1),r=n-Math.floor(n),i=t[Math.floor(n)].scale,a=t[Math.ceil(n)].scale;return i*(1-r)+a*r}_removeAllTiles(){this.renderer.visible=!1,this._pendingTilesToUpdate.clear(),this._pendingTilesForElevationUpdateEvent.clear(),this._rootTiles!=null&&(this._rootTiles.forEach(e=>this._purgeTile(e)),this._setRootTiles(null),this.notifyChange(`ready`)),this._allTiles.clear(),this.notifyChange(`demResolution`),this.emit(`tiles-changed`,{allTiles:this.allTiles})}_purgeSubtree(e){let t=e.children;t[0]&&(this._purgeTile(t[0]),this._purgeTile(t[1]),this._purgeTile(t[2]),this._purgeTile(t[3]),e.clearChildren())}_purgeTile(e){e.leaf?Z(e):this._purgeSubtree(e),this._allTiles.removeUnordered(e),this._unloadTile(e),e.dispose(),this._tileCache.put(W._tileMemcacheKey,e),this.notifyChange(`demResolution`),this.emit(`tiles-changed`,{allTiles:this.allTiles})}_unloadTile(e){this._pendingTilesToUpdate.delete(e),this._pendingTilesForElevationUpdateEvent.delete(e),e.unload()}_splitTile(e){A(e.leaf,`Tile that is already split should not be split again!`),A(e.rendered,`Tile marked to split is not rendered`),Z(e);let t=e.createChildren();this._allTiles.pushArray(t),this.notifyChange(`demResolution`),this.emit(`tiles-changed`,{allTiles:this.allTiles}),e.updateAgentSuspension(),A(e.rendered,`parent should be rendered`),t.forEach(e=>this._loadTile(e)),t.forEach(e=>this._pendingTilesToUpdate.add(e)),this._unloadTile(e),this._markAllTileNeighborsForUpdate(e),this._emitTileScaleChange(e,e.level+1),this._allTilesDirty=!0,this._shortBatches&&this._updatePendingTileGeometries(),t.forEach(e=>X(e,e.hasPendingUpdate(1))),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){J.spatialReference=this.spatialReference,J.extent=e.extent,J.scale=this._getLodBiasCorrectedScale(t),this.emit(`scale-change`,J)}createTile(e,t,n,r){A(!!r,`createTile sanity check`);let i=this._acquireTile(e,t,n,r);return i.updateClippingStatus(this.groundExtent),i.updateScreenDepth(this.view.state.contentCamera.viewProjectionMatrix),this._shouldSplit(i)&&i.setPendingUpdate(1),i}get _shortBatches(){return this.view.state.mode!==2}_mergeTile(e){A(!e.hasPendingUpdate(1),`_mergeTile sanity check`),A(!e.leaf,`Cannot merge a leaf`),e.leaf||(this._purgeSubtree(e),A(!e.renderData,`Merging tile with existing render data?`),this._loadTile(e),this._markTileToUpdate(e),this._emitTileScaleChange(e),this._shortBatches&&this._updatePendingTileGeometries(),X(e,!1),this._allTilesDirty=!0,++this._performanceInfo.numMerged)}_loadTile(e){e.load(),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager?.hasOverlays&&e.updateOverlayParameters(this.overlayManager)}_handleLayerViewChanges(e=gt){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let t=!1,n=new Set,r=-1;for(let e=this.view.allLayerViews.length-1;e>=0;e--){let i=this.view.allLayerViews.items[e];if(n.add(i.uid),P(i)||F(i)){if(this._basemapLayerViewHandles.has(i.uid)&&!F(i)){let e=this._layerClassFromLayerView(i),n=this.getLayerIndexByUID(e,i.uid);n!=null&&((n<r||r==null)&&(t=!0),r=n)}else this._registerTiledLayerView(i),i.layer.loaded&&(t=!0)}}this._basemapLayerViewHandles.forEach((e,r)=>{n.has(r)||(this._unregisterTiledLayerView(r),t=!0)}),t&&this._updateTiledLayers(),this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._evaluateTransparency(),e.madeProgress()}get _isFullyTransparent(){if(this.view.map?.ground?.opacity>0)return!1;for(let e of this.view.allLayerViews.items)if(I(e)&&!Te(e.layer)&&e.fullOpacity!==0)return!1;return!0}_hasCompositeBlendMode(){for(let e of this.view.allLayerViews.items)if((L(e)||F(e))&&dt(ft[e.layer.blendMode]))return!0;return!1}_layerClassFromLayerView(e){return+!R(e)}_registerTiledLayerView(e){let t=[];if((L(e)||F(e))&&t.push(h(()=>e.layer.blendMode,()=>{this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._updateTileTextures(2)})),!F(e)){let n=this._layerClassFromLayerView(e);t.push(h(()=>!e.destroyed&&e.suspended,()=>this._updateTiledLayers())),t.push(h(()=>!e.destroyed&&e.fullOpacity,()=>this._updateTileTextures(2)));let{layer:r}=e;`effectiveScaleRange`in r&&t.push(h(()=>!e.destroyed&&r.effectiveScaleRange,()=>this._restartAllAgents(n))),t.push(e.on(`data-changed`,()=>{let t=this.getLayerIndexByUID(n,e.uid);t!=null&&this._invalidateLayerData(t,n)}))}this._unregisterTiledLayerView(e.uid),this._basemapLayerViewHandles.set(e.uid,t)}_unregisterTiledLayerView(e){let t=this._basemapLayerViewHandles.get(e);if(t){for(let e of t)e.remove();this._basemapLayerViewHandles.delete(e)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;let e=this.view.allLayerViews,t=[[],[]],n=null;e.forEach(e=>{if(!e.layer||e.suspended||!P(e)||!e.fullExtent)return;let r=this._layerClassFromLayerView(e);if(r===1){let t=e.displayLevelRange.maxLevel;t!==1/0&&(n===null||t>n)&&(n=t)}t[r].push(e)});for(let e of Re){let n=this._layerViews[e],r=t[e];r.reverse();let i=r.length,a=n.length!==i,o=Array(i),s=Array(n.length);this._layerIndexByUid[e].clear();for(let t=0;t<i;t++){let i=r[t].uid;this._layerIndexByUid[e].set(i,t);let c=n.indexOf(r[t]);o[t]=c,t!==c&&(a=!0),c>-1&&(s[c]=t)}if(a){let t=this._postorderIterator;for(t.reset(this._rootTiles);!t.done;)t.next().modifyLayers(s,o,e);this._layerViews[e]=r,this._restartAllAgents(e),this._updateTilesVisibility(this._rootTiles)}}this.tilingScheme.ensureMaxLod(n)&&(this._viewChangeUpdate(),this.notifyChange(`tilingScheme`))}_restartAllAgents(e){let t=this._postorderIterator;for(t.reset(this._rootTiles);!t.done;){let n=t.next();n.restartAgents(e),e===0&&n.computeElevationBounds()}this._updateRootTileElevationRange()}layerViewByIndex(e,t){return this._layerViews[t][e]}numLayers(e){return this._layerViews[e].length}_updateTileTextures(e){this._allTiles.forAll(t=>{t.updateAgents(1),e===1?this.renderer.updateTileTexture(t,16):t.updateRenderData(1,e)}),this._evaluateTransparency()}_invalidateLayerData(e,t){this._rootTiles!=null&&(U(this._rootTiles,n=>n.removeLayerAgent(e,t)),U(this._rootTiles,n=>{n.invalidateLayerData(e,t),n.restartAgents(t)}))}setTileTreeDirty(e){this._allTilesDirty=!0,e&&(this._allTilesCreated=!1)}requestRender(e=1){this.renderer.requestRender(e)}requestUpdate(){++this._pendingUpdates===1&&(this._hasPendingUpdates=!0)}requestTileData(e,t,n,r){let i=this.layerViewByIndex(t,n),{tilemapCache:a}=i;return!a||j(i)?this._requestTileData(e,n,i,r):(++this._asyncWorkItems,a.fetchAvailability(e.level,e.lij[1],e.lij[2],{...r,timeout:6e3}).catch(t=>{throw te(r),p(t)||this._dataMissing(e,n,i),t}).then(()=>this._frameTask.schedule(()=>this._requestTileData(e,n,i,r),r.signal)).finally(()=>--this._asyncWorkItems))}_requestTileData(e,t,n,r){return this.destroying?Promise.resolve():t===0?R(n)?this._requestElevationTileData(e,n,r):Promise.reject():I(n)?this._requestMapTileData(e,n,r):Promise.reject()}_requestElevationTileData(e,t,n){++this._asyncWorkItems;let r=r=>{!m(n)&&r&&(this.setMemoryDirty(),this.requestUpdate(),this._elevationDataArrived(e,t,r))},i=n=>{p(n)||(s.getLogger(this).error(`Tile ${e.lij.toString()} layer 0/${t.uid} error ${n}`),this._dataMissing(e,0,t),this.requestUpdate())};return t.fetchElevationTile(e,{...Ee,...n}).then(e=>this._frameTask.schedule(()=>r(e)),i).finally(()=>--this._asyncWorkItems)}_elevationDataArrived(e,t,n){let r=this._layerIndexByUid[0].get(t.uid);if(r==null){s.getLogger(this).warn(`TerrainSurface: received data from unknown layer %d %s`,0,e.lij.toString());return}let i=new Fe(e.lij,e.extent,n);e.dataArrived(r,0,i),this.emit(`tile-data-changed`,{tile:e,layerIndex:r,layerClass:0});let a=[e],o=e.level,c=this._iteratorPool.acquire();for(c.reset(a);!c.done;){let e=c.next();e.findElevationBoundsForLayer(r,o),e.computeElevationBounds()}o===0&&this._updateRootTileElevationRange(),c.remove(),this._updateTilesVisibility(a)}_requestMapTileData(e,t,n){++this._asyncWorkItems;let r=(r,i)=>{z(i),m(n)||(console.error(`Tile ${e.lij.toString()} layer 1/${t.uid} error ${r}`),this._dataMissing(e,1,t),this.requestUpdate())},i=e=>t=>r(t,e);return t.fetchTile(e.lij,n).then(r=>this._frameTask.schedule(()=>{this.requestUpdate(),m(n)?z(r):this._mapTileDataArrived(e,t,r)},n.signal,i(r)).catch(i(r)),(e,t=null)=>this._frameTask.schedule(()=>r(e,t))).finally(()=>--this._asyncWorkItems)}_mapTileDataArrived(e,t,n){let r=this.getLayerIndexByUID(1,t.uid);r==null?(z(n),s.getLogger(this).warn(`TerrainSurface: received data from unknown layer`)):(e.dataArrived(r,1,n),this.emit(`tile-data-changed`,{tile:e,layerIndex:r,layerClass:1}))}_dataMissing(e,t,n){let r=this.getLayerIndexByUID(t,n.uid);r==null?s.getLogger(this).warn(`TerrainSurface: received data from unknown layer`):(e.dataMissing(r,t),this.emit(`tile-data-changed`,{tile:e,layerIndex:r,layerClass:t}))}get performanceInfo(){let e=this._performanceInfo;return e.numNodes=this._allTiles.length,e.numLeaves=e.numVisible=e.numRendered=e.numLoadedPerLevel.length=e.numRenderedPerLevel.length=0,this._allTiles.forAll(t=>{t.leaf&&e.numLeaves++;let n=t.level;t.renderData&&(e.numLoadedPerLevel[n]=(e.numLoadedPerLevel[n]||0)+1),t.visible&&(e.numVisible++,t.rendered&&(e.numRenderedPerLevel[n]=(e.numRenderedPerLevel[n]||0)+1,e.numRendered++))}),e}setMemoryDirty(){this._usedMemory=null}get usedMemory(){return this.tilingScheme?(this._usedMemory??=this._recalculateUsedMemory(),this._usedMemory??0):0}_recalculateUsedMemory(){return this.tilingScheme?Math.round(this._allTiles.reduce((e,t)=>e+t.usedMemory,0)):null}getUsedMemoryForLayerView(e){let t=0,n=this._layerClassFromLayerView(e),r=this.getLayerIndexByUID(n,e.uid);return r!=null&&this._allTiles.forAll(e=>t+=e.getUsedMemoryForLayer(n,r)),t}get renderPatchBorders(){return this._renderer.renderPatchBorders}set renderPatchBorders(e){this._renderer.renderPatchBorders=e}get renderingDisabled(){return this._renderer.renderingDisabled}set renderingDisabled(e){this._renderer.renderingDisabled=e}get test(){}checkAllTilesWaterproofness(e=`render-patch-groups`){}get isGlobal(){return this._isGlobal}get isGeographic(){return this._isGeographic}get isWebMercator(){return this._isWebMercator}get isWebMercatorOnPlateCarree(){return this._isWebMercatorOnPlateCarree}isEastEndWrap(e){return this._isGlobal&&e[2]===this.lijEastEnd(e[0])-1}isWestEndWrap(e){return this._isGlobal&&e[2]===0}lijEastEnd(e){return 1<<e+ +!!this._isGeographic}wrapEastWest(e){let t=this.lijEastEnd(e[0]),n=e[2];if(0<=n&&n<t)return e;if(!this._isGlobal)return null;let r=(n+(n<0?t:0))%t;return[e[0],e[1],r]}enableInternalChecks(e){$e(e)}enableWaterproofnessChecks(e){et(e)}static cleanupTerrainSurface(){St.prune()}enable(e){e!==this.enabled&&(this._set(`enabled`,e),e?(this._updateRootTiles(),this.freeze=!1,this.view.elevationProvider.register(0,this)):(this.view.elevationProvider.unregister(this),this.freeze=!0,this._removeAllTiles(),this._setRootTiles(null)),this.notifyChange(`ready`))}updateOverlayParameters(){let{overlayManager:e}=this;this.allTiles.forAll(t=>t.updateOverlayParameters(e))}};e([y()],G.prototype,`_renderer`,void 0),e([y({constructOnly:!0})],G.prototype,`_scaleRangeQueries`,void 0),e([y({constructOnly:!0})],G.prototype,`view`,void 0),e([y({constructOnly:!0})],G.prototype,`overlayManager`,void 0),e([y()],G.prototype,`_hasPendingUpdates`,void 0),e([y()],G.prototype,`_asyncWorkItems`,void 0),e([y()],G.prototype,`_allTilesDirty`,void 0),e([y()],G.prototype,`_allTilesSorted`,void 0),e([y()],G.prototype,`allTilesCreated`,null),e([y()],G.prototype,`_allTilesCreated`,void 0),e([y()],G.prototype,`_viewChanged`,void 0),e([y({type:Number})],G.prototype,`heading`,void 0),e([y()],G.prototype,`_splitLimits`,void 0),e([y()],G.prototype,`_frameTask`,void 0),e([y()],G.prototype,`demResolution`,null),e([y({readOnly:!0})],G.prototype,`snapLevel`,null),e([y({readOnly:!0})],G.prototype,`lodSnappingEnabled`,null),e([y()],G.prototype,`_stencilEnabledExtents`,null),e([y({readOnly:!0})],G.prototype,`userClippingExtent`,null),e([y()],G.prototype,`_rootTilesExtent`,void 0),e([y({readOnly:!0})],G.prototype,`groundExtent`,null),e([y({readOnly:!0})],G.prototype,`fullGroundExtent`,null),e([y({readOnly:!0})],G.prototype,`_tilingSchemeExtent`,null),e([y({readOnly:!0})],G.prototype,`updating`,null),e([y({readOnly:!0})],G.prototype,`readyToRun`,null),e([y(Ne)],G.prototype,`updatingProgress`,void 0),e([y({readOnly:!0})],G.prototype,`updatingProgressValue`,null),e([y()],G.prototype,`_maxNumUpdating`,void 0),e([y()],G.prototype,`baseOpacity`,null),e([y()],G.prototype,`hasCompositeBlendMode`,void 0),e([y({readOnly:!0})],G.prototype,`viewingMode`,null),e([y()],G.prototype,`maxTextureScale`,void 0),e([y({readOnly:!0})],G.prototype,`ready`,null),e([y({readOnly:!0})],G.prototype,`rootTiles`,null),e([y()],G.prototype,`_rootTiles`,void 0),e([y({readOnly:!0})],G.prototype,`spatialReference`,null),e([y({type:t})],G.prototype,`backgroundColor`,null),e([y({value:!1})],G.prototype,`slicePlaneEnabled`,null),e([y({readOnly:!0})],G.prototype,`tilingScheme`,void 0),e([y({readOnly:!0})],G.prototype,`tilingSchemeLocked`,null),e([y({readOnly:!0})],G.prototype,`tilingSchemeLogic`,void 0),e([y()],G.prototype,`wireframe`,null),e([y()],G.prototype,`opaque`,null),e([y()],G.prototype,`invisible`,null),e([y({value:!1})],G.prototype,`freeze`,null),e([y()],G.prototype,`fadeDuration`,null),e([y()],G.prototype,`_xNormalizer`,null),e([y()],G.prototype,`visibleElevationRange`,null),e([y()],G.prototype,`_rootTileElevationRange`,void 0),e([y()],G.prototype,`_layerViewsDirty`,void 0),e([y()],G.prototype,`renderPatchBorders`,null),e([y()],G.prototype,`renderingDisabled`,null),e([y({readOnly:!0})],G.prototype,`enabled`,void 0),G=W=e([re(`esri.views.3d.terrain.TerrainSurface`)],G);const yt=G,K=b(),bt=new Se,q=S(),xt=S(),St=new f,J={spatialReference:null,extent:null,scale:0};function Y(e,t,n){for(let r of e){if(!r.containsPointXY(t,n))continue;let e=r;for(;e&&!e.renderData;){let r=+(t>e.extentMidX)+(n<e.extentMidY?2:0);e=e.children[r]}let i=e?.renderData?.geometryState.samplerData??null;return Ie(t,n,i)}return null}function X(e,t){!e.leaf||e.level<k||$(e,e=>{t&&Ct(e);let n=Q(e);if(e.maxLevelDeltaNeighborCount++,n){let t=e.parent;for(;t;){let e=Q(t);if(t.unmergableChildCount++,e)t=t.parent;else break}}})}function Ct(e){if(e.hasPendingUpdate(1))return;let t=e.parent;for(;t?.resetPendingUpdate(4);)t=t.parent;e.resetPendingUpdate(4),e.leaf&&e.setPendingUpdate(1),e.level<k||$(e,e=>{Ct(e)})}function Z(e){e.level<k||$(e,e=>{if(e.maxLevelDeltaNeighborCount--,e.maxLevelDeltaNeighborCount===0&&e.unmergableChildCount===0){let t=e.parent;for(;t&&(t.unmergableChildCount--,Q(t));)t=t.parent}})}function Q(e){return e.maxLevelDeltaNeighborCount===0&&e.unmergableChildCount===0}function $(e,t){if(e.level<k)return;let n=e.level-k,r=e.lij[1]>>k,i=e.lij[2]>>k,a=e=>e.leaf||e.level===n;for(let o=0;o<4;++o){let s=e.findNeighborTile(N[o],a);if(!s||s.level!==n)continue;let c=s.lij;(c[1]!==r||c[2]!==i)&&t(s)}}export{yt as default};
|
package/views/3d/terrain/Tile.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{toConst as e}from"../../../core/compilerUtils.js";import"../../../core/has.js";import{clamp as t}from"../../../core/mathUtils.js";import{abortMaybe as n}from"../../../core/maybe.js";import r from"../../../core/ObjectPool.js";import{subtract as i,squaredLength as a,dot as o,scale as s,add as c,length as l,copy as u}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d,unitZ as f}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as p}from"../../../geometry/ellipsoidUtils.js";import{create as m,equals as h,rectangleContainsRectangleCyclicalAware as g,rectanglesIntersectCyclicalAware as _,width as v,height as y}from"../../../geometry/support/aaBoundingRect.js";import{Sphere as b}from"../../../geometry/support/sphere.js";import{isGroupLayer as x}from"../../../layers/support/layerUtils.js";import{isLayerViewWithFlowRenderer as S}from"../support/flowUtils.js";import{ElevationBounds as C}from"./ElevationBounds.js";import{ElevationTileAgent as w,isElevationTileAgent as T}from"./ElevationTileAgent.js";import{LayerClasses as E}from"./LayerClass.js";import{MapDataCacheItem as D}from"./MapDataCacheItem.js";import{MapTileAgent as O,isMapTileAgent as ee}from"./MapTileAgent.js";import{maxPatchTesselation as te}from"./TerrainConst.js";import{isVectorTile as k,isTileTexture as ne,isRasterTile as re,isCreateBitmapResult as ie}from"./TerrainData.js";import{weakAssert as A,isBlendableLayerView as ae,oppositeCorner as j,internalAssert as M,enableTerrainInternalChecks as N,neighborEdgeIndices as P,oppositeEdge as F,neighborCornerIndices as I,almostEquals as L,isNorth as R,isSouth as z,isWest as B,isEast as V,isWestCorner as oe,isNorthCorner as se}from"./terrainUtils.js";import{tileAgentDone as H}from"./TileAgent.js";import{TilePerLayerInfo as U}from"./TilePerLayerInfo.js";import{fallsWithinLayerView as W}from"./tileUtils.js";class ce{constructor(){this._lij=[0,0,0],this._children=[null,null,null,null],this._pendingUpdates=0,this._dirty=!0,this._previouslyRendered=!1,this._lastElevationSourceUpdateRequestSignature=null,this.extent=m(),this._elevationBoundsMin=NaN,this._elevationBoundsMax=0,this.layerInfo=[[],[]],this.extentInRadians=m(),this.centerAtSeaLevel=d(),this._center=[d(),new b,d()],this.up=f(),this._withinClippingArea=!0,this._intersectsClippingArea=!0,this._maxTesselation=0,this._usedMemory=0,this._rasterTileMemory=0,this._vectorTileMemory=0,this._mapDataRefCount=0,this.screenDepth=0,this.renderOrder=0,this._edgeLen=0,this._edgeLen2=0,this._curvatureHeight=0,this.onCompressionFinished=()=>{this.setPendingUpdate(16),this.setMemoryDirty()},this.extentMidX=0,this.extentMidY=0,this.distanceToPOI=-1,this._lastPOI=d(),this.maxLevelDeltaNeighborCount=0,this.unmergableChildCount=0}get lij(){return this._lij}get spatialReference(){return this._surface.spatialReference??this._surface.tilingScheme.spatialReference}get isDisposed(){return this._surface==null}get elevationLevelDelta(){return this._surface.getElevationLevelDelta(this.level)}_setPendingUpdateForDescendants(){let e=this._children;if(e[0])for(let t of e)t.renderData&&(t.setPendingUpdate(16),t.setMemoryDirty()),t._setPendingUpdateForDescendants()}static prune(){K.prune(0),q.prune(0),U.prune()}get _cached(){return!this.leaf&&this._mapDataRefCount<=0}get withinClippingArea(){return this._withinClippingArea}get intersectsClippingArea(){return this._intersectsClippingArea}get clippingArea(){return this._clippingArea}get parent(){return this._parent}get children(){return this._children}get surface(){return this._surface}get elevationBoundsMin(){return this._elevationBoundsMin}get elevationBoundsMax(){return this._elevationBoundsMax}get level(){return this._lij[0]}get key(){return`${this._lij[0]}/${this._lij[1]}/${this._lij[2]}`}get edgeLen(){return this._edgeLen}get radius(){return this._center[1].radius}get visible(){return this._dirty&&this.computeVisibility(),this._visible}get frustumVisibility(){return this._dirty&&this.computeVisibility(),this._frustumVisibility}checkVisibility(e){if(this._dirty)return null;let t=this._calculateVisibility(e);if(this._frustumVisibility!==t||this._visible!==(t!==2&&this._intersectsClippingArea))throw Error(`Assertion failed: waterproof.visibility-cache-mismatch: Tile[${this.lij}]`);return t}computeVisibility(){this._dirty=!1;let e=this.parent?.frustumVisibility??1;this._frustumVisibility=this._calculateVisibility(e);let t=this._frustumVisibility!==2&&this._intersectsClippingArea;t!==this._visible&&(this._visible=t,this._surface.emit(`tiles-visibility-changed`),this._surface.renderer.setDirty(),this.updateAgentSuspension())}_calculateVisibility(e){let t=this.parent;return e===0?0:t!=null&&e===2&&this._elevationBoundsMin>=t._elevationBoundsMin&&this._elevationBoundsMax<=t._elevationBoundsMax?2:this._calculateFrustumVisibility(this.surface.frustum,this._surface.view.frustum.boundingSphere)}get _loadable(){return this.visible||this._surface.view.state.fixedContentCamera}get rendered(){let e=!!this.renderData;return e!==this._previouslyRendered&&(this._surface.emit(`tiles-visibility-changed`),this._previouslyRendered=e,this._surface.renderer.setDirty()),e}init(e,t,n,r,i){this._lij[0]=e,this._lij[1]=t,this._lij[2]=n,this.ellipsoid=p(i.tilingScheme.spatialReference),i.tilingScheme.getExtent(e,t,n,this.extent),i.tilingScheme.convertExtentToRadians(this.extent,this.extentInRadians),this.extentMidX=.5*(this.extent[0]+this.extent[2]),this.extentMidY=.5*(this.extent[1]+this.extent[3]),this._withinClippingArea=!0,this._intersectsClippingArea=!0,this._clippingArea=null,this._mapDataRefCount=0,i.upsampleMapCache.pop(this.key),this._edgeLen=0,this._edgeLen2=0,this._center[1].radius=0,this.elevationLevel=e,this._lastElevationSourceUpdateRequestSignature=null,r&&!Number.isNaN(r.elevationBoundsMin)?(this._elevationBoundsMin=r.elevationBoundsMin,this._elevationBoundsMax=r.elevationBoundsMax):(this._elevationBoundsMin=0,this._elevationBoundsMax=0),this._pendingUpdates=0,this.renderData=null,this.screenDepth=0,this._visible=!1,this._previouslyRendered=!1,this._parent=r,this.clearChildren(),this._surface=i,this.updateVisibility(),this.maxLevelDeltaNeighborCount=0,this.unmergableChildCount=0;for(let e of E){let t=i.numLayers(e),n=this.layerInfo[e];for(let e of n)e.release();n.length=t;for(let r=0;r<t;r++)n[r]=U.acquire(this._surface.upsampleInfoPool),e===0&&this.findElevationBoundsForLayer(r,-1)}this.computeElevationBounds(),this._maxTesselation=Math.min(i.tilingScheme.pixelSize,te)}dispose(){A(!this.renderData,`tile.renderData was not unloaded`),this._surface?.upsampleMapCache.pop(this.key),this.layerInfo.forEach(e=>{e.forEach(e=>e.release()),e.length=0}),this._surface=this._parent=null,this.clearChildren(),this.setMemoryDirty()}refMapData(){++this._mapDataRefCount,this._cached||this._surface.upsampleMapCache.pop(this.key)}unrefMapData(){--this._mapDataRefCount,this._cached&&this.cachedMemory>0&&this._surface.upsampleMapCache.put(this.key,new D(e(this)))}setMemoryDirty(){this._usedMemory=0}get usedMemory(){return this._ensureUsedMemory()+(this._cached?0:this.mapDataMemory)}get cachedMemory(){return this._ensureUsedMemory(),this._surface==null?this.usedMemory:this._cached?this.mapDataMemory:0}get mapDataMemory(){return this._rasterTileMemory+this._vectorTileMemory}get _cpuImageMemorySize(){let e=this._surface.tilingScheme.pixelSize;return e*e*4}_ensureUsedMemory(){if(this._usedMemory>0)return this._vectorTileMemory=this.layerInfo[1].reduce((e,{data:t})=>e+(k(t)?t.usedMemoryPerReference:0),0),this._usedMemory;this._usedMemory=this._baseUsedMemory,this._rasterTileMemory=0,this._vectorTileMemory=0;for(let{data:e}of this.layerInfo[1])k(e)?this._vectorTileMemory+=e.usedMemoryPerReference:this._rasterTileMemory+=this.getTerrainDataMemory(e);for(let e of this.layerInfo[0])this._usedMemory+=e.data?this._cpuImageMemorySize:0;return this.renderData&&(this._usedMemory+=this.renderData.estimatedGeometryMemoryUsage,this._rasterTileMemory+=this.renderData.texture?.usedMemory??0),this._cached&&this._surface.upsampleMapCache.updateSize(this.key),this._usedMemory}getUsedMemoryForLayer(e,t){let n=this.layerInfo[e][t];return n?.data?e===1?this._cached?0:this.getTerrainDataMemory(n.data):e===0?this._cpuImageMemorySize:0:0}getTerrainDataMemory(e){return ne(e)?e.texture.usedMemory:re(e)?e.memoryUsage:k(e)?e.usedMemoryPerReference:ie(e)?this._cpuImageMemorySize:0}updateScreenDepth(e){let[t,n,r]=this._center[1].center,i=e,a=i[2]*t+i[6]*n+i[10]*r+i[14];this.screenDepth=a<0?0:a/(i[3]*t+i[7]*n+i[11]*r+i[15])}shouldSplit(e,t,n){if(!this.visible||e.frustum&&!(this._intersectsClippingArea&&this._calculateFrustumVisibility(e.frustum)!==2))return 0;let r=this.level;i(Q,this._center[1].center,t);let u=a(Q),d=this._closestCenterOnElevationRange(t,fe),f=i(pe,d,t),p=Math.min(u,a(f));if(this._edgeLen2>p&&r<e.maxLod)return 1;let m=Math.sqrt(p),h=e.fovX*m*2,g=this._edgeLen/h,_=()=>{if(r<e.maxLod)return this.elevationLevel=r,0;let t=r+Math.ceil(-Math.log2(e.relativeWidthLimit/g));return t===this.elevationLevel?0:(this.elevationLevel=t,2)},v=n==null?1/0:n-r;if(v<=.5)return _();let y=o(this.up,Q),b=this._elevationBoundsMax-this._elevationBoundsMin,x=b/this.edgeLen;if(e.aboveGround&&y>0&&x<.001&&y/m-Math.sin(this._curvatureHeight/(this.edgeLen*Math.SQRT1_2)*Math.PI)-x>0)return _();let S=n==null?1:3-Math.min(v,2);if(g*S<e.relativeWidthLimit||r>=e.maxLod)return _();if(r<7)return 1;s($,this.up,y),i($,$,f);let C=a($);if(C<=this.radius*this.radius)return 1;s($,$,this.radius/Math.sqrt(C)),c($,$,d),i($,t,$);let w=Math.min(1,(Math.abs(o($,this.up))+.5*b+this._curvatureHeight)/l($)),T=.1/e.angledSplitBias,E=e.fovY*m*2;return w*(this._edgeLen/E*S)<T*e.relativeHeightLimit?_():1}needsElevationSourceUpdate(){let e=this.renderData?.geometryState.samplerDataSourceLevels;if(e==null)return!1;let t=Math.max(this.elevationLevel-this.elevationLevelDelta,0);return e.some(e=>e>t)&&this._lastElevationSourceUpdateRequestSignature!==this._elevationSourceUpdateRequestSignature(e)}markElevationSourceUpdateRequested(){let e=this.renderData?.geometryState.samplerDataSourceLevels;this._lastElevationSourceUpdateRequestSignature=e==null?null:this._elevationSourceUpdateRequestSignature(e)}_elevationSourceUpdateRequestSignature(e){return`${Math.max(this.elevationLevel-this.elevationLevelDelta,0)}:${e.join(`,`)}`}createChildren(){let e=this._children,t=this.lij[0]+1,n=this.lij[1]*2,r=this.lij[2]*2;return e[0]=this.surface.createTile(t,n,r,this),e[1]=this.surface.createTile(t,n,r+1,this),e[2]=this.surface.createTile(t,n+1,r,this),e[3]=this.surface.createTile(t,n+1,r+1,this),e}clearChildren(){this._children[0]=this._children[1]=this._children[2]=this._children[3]=null}get loaded(){return this.renderData?.hasGeometry??!1}get hasGeometryState(){return this.renderData?.geometryState!=null}load(){this.refMapData();for(let e of E)this._createOrUpdateAgents(0,e);this.surface.renderer.loadTile(this)}unload(){this.renderData&&this.unrefMapData(),this.surface.renderer.unloadTile(this);for(let e of E){let t=this.layerInfo[e];for(let e of t)e.loadingAgent&&e.loadingAgent!==H&&(G(e.loadingAgent),e.loadingAgent=null),e.pendingUpdates=0}this.resetPendingUpdate(8),this.resetPendingUpdate(16),this.resetPendingUpdate(32)}unloadMapData(){let e=this.layerInfo[1];for(let t of e)t.loadingAgent&&t.loadingAgent!==H&&(G(t.loadingAgent),t.loadingAgent=null),t.pendingUpdates=0,t.invalidateSourceData();this.renderData?.releaseTexture(),this.setMemoryDirty()}updateClippingStatus(e){if(h(e,this._clippingArea))return!1;let t=this._intersectsClippingArea,n=this._withinClippingArea;e==null?(this._intersectsClippingArea=!0,this._withinClippingArea=!0):(this._intersectsClippingArea=this.intersectsExtent(e),this._withinClippingArea=this._isWithinExtent(e)),this._clippingArea=e,this.updateVisibility();let r=n&&this._withinClippingArea,i=!n&&!t&&!this._withinClippingArea&&!this._intersectsClippingArea;return this.renderData&&!(r||i)&&this.setPendingUpdate(8),!0}updateVisibility(){this._dirty=!0,this._surface.setTileTreeDirty(!1)}getLayerInfo(e,t){return this.layerInfo[t][e]}hasLayerData(e,t){let n=this.layerInfo[t][e];return!(!n?.data||n.dataInvalidated)}get updating(){if(this.hasPendingUpdates)return!0;for(let e of E){let t=this.layerInfo[e];for(let e of t)if(e.loadingAgent&&e.loadingAgent!==H&&e.loadingAgent.updating)return!0}return!1}_isSuspended(e){return this.hasPendingUpdate(1)?!0:e!==0&&!this._loadable}get hasPendingUpdates(){return this._pendingUpdates!==0}hasPendingUpdate(e){return(this._pendingUpdates&e)===e}setPendingUpdate(e){let t=this._pendingUpdates;return this._pendingUpdates|=e,e===1||e===4?this._surface.setTileTreeDirty(!0):this._surface.requestUpdate(),t!==this._pendingUpdates}resetPendingUpdate(e){return this.hasPendingUpdate(e)?(this._pendingUpdates&=~e,!0):!1}requestLayerData(e,t,r){let i=this.layerInfo[t][e];if(i.waitingAgents.has(r))return console.warn(`agent already requested this piece of map data (tile %s, agent tile %s, layer: %d/%d)`,this._lij.toString(),r.tile.lij.toString(),t,e),!0;if(i.waitingAgents.push(r),i.data&&!i.dataInvalidated){console.warn(`agent requested existing data (tile %s, agent tile %s, layer: %d/%d)`,this._lij.toString(),r.tile.lij.toString(),t,e);let n=k(i.data);return r.dataArrived(this,n),!0}if(i.requestPromise)return!0;n(i.requestAbort),i.requestAbort=new AbortController;let a=this._surface.requestTileData(this,e,t,{signal:i.requestAbort.signal});if(!a)return i.requestAbort=null,!1;let o=()=>{i.requestPromise===a&&(i.requestPromise=null,i.requestAbort=null)};return i.requestPromise=a,a.then(o,o),!0}get leaf(){return this._children[0]==null}hasLij(e){return this._lij[0]===e[0]&&this._lij[1]===e[1]&&this._lij[2]===e[2]}findByLij(e){if(this.hasLij(e))return this;let t=this._children;return t[0]?t[0].findByLij(e)||t[1].findByLij(e)||t[2].findByLij(e)||t[3].findByLij(e):null}distanceToSquared(e){return a(i($,this._center[1].center,e))}containsPoint(e){let t=this.extent;return e[0]>=t[0]&&e[1]>=t[1]&&e[0]<=t[2]&&e[1]<=t[3]}containsPointXY(e,t){let n=this.extent;return e>=n[0]&&t>=n[1]&&e<=n[2]&&t<=n[3]}unrequestLayerData(e,t,n){let r=this.layerInfo[t][e],i=r.waitingAgents,a=i.removeUnordered(n)!=null;A(a,`agent has not requested this piece of map data`),i.length<1&&(r.abortRequest(),this.setMemoryDirty())}dataArrived(e,t,n){let r=k(n),i=this.layerInfo[t][e];i.data=n,i.dataInvalidated=!1,i.waitingAgents.forAll(e=>e.dataArrived(this,r)),i.waitingAgents.clear(),this.setMemoryDirty()}dataMissing(e,t){let n=this.layerInfo[t][e];n.dataMissing=!0,n.waitingAgents.forAll(e=>e.dataMissing()),n.waitingAgents.clear(),this.setMemoryDirty()}updateRenderData(e,t,n){switch(n&&this.forEachLoadedNeighbor(n=>n.updateRenderData(e,t)),e){case 1:return this._updateTexture(t);case 0:return this._updateGeometry()}}_updateTexture(e){this.renderData&&(this.resetPendingUpdate(e===0?16:32),this.setPendingUpdate(e===0?32:16))}_updateGeometry(){this.setPendingUpdate(8);for(let e of this.layerInfo[0])e.pendingUpdates|=8}invalidateLayerData(e,t){this.layerInfo[t][e].invalidateSourceData()}computeElevationBounds(){let e=this._elevationBoundsMin,t=this._elevationBoundsMax,n=1/0,r=-1/0,i=this.layerInfo[0],a=!0;for(let e of i)e.elevationBounds!=null&&(n=Math.min(n,e.elevationBounds.minElevation),r=Math.max(r,e.elevationBounds.maxElevation),e.elevationBounds.hasNoDataValues||(a=!1));a&&(n=Math.min(n,0),r=Math.max(r,0)),(e!==n||t!==r)&&(this._elevationBoundsMin=n,this._elevationBoundsMax=r,this.updateRadiusAndCenter(),this._surface.setTileTreeDirty(!1))}_updateCenter(){let e=this._elevationBoundsMin,t=this._elevationBoundsMax,n=.5*(e+t),r=this._center;s($,this.up,n),c(r[1].center,this.centerAtSeaLevel,$),s($,this.up,e),c(r[0],this.centerAtSeaLevel,$),s($,this.up,t),c(r[2],this.centerAtSeaLevel,$)}_closestCenterOnElevationRange(e,t){if(this._surface.viewingMode===1){if(this.level===0)return u(t,this._center[1].center);let n=o(this.up,e),r=Math.max(this.ellipsoid.radius+this._elevationBoundsMin,Math.min(this.ellipsoid.radius+this._elevationBoundsMax,n));return s(t,this.up,r)}let n=Math.max(this._elevationBoundsMin,Math.min(this._elevationBoundsMax,e[2]));return t[0]=this.centerAtSeaLevel[0],t[1]=this.centerAtSeaLevel[1],t[2]=n,t}findElevationBoundsForLayer(e,t){let n=this.layerInfo[0][e],r=this.elevationLevelDelta,i=Math.max(this.elevationLevel-r,0),a=n.elevationBounds;if(a!=null&&a.level>t&&a.level<=i)return;let o=this._surface.layerViewByIndex(e,0);if(!W(this,o))return;let s=ue,c=!1,l=n.data;if(l&&l.level<=i){let e=n.data;s.minElevation=e.samplerData.data.minValue,s.maxElevation=e.samplerData.data.maxValue,s.hasNoDataValues=e.samplerData.data.hasNoDataValues,s.level=this.level,c=!0}else{let t=0,n,a;for(let o=this._parent;o&&(!a||t<r)&&(t=this.elevationLevel-o.level,n=a||n,a=o.layerInfo[0][e].data,!(!a&&n&&o.level<=i));o=o.parent);a||=n,a&&(a.computeMinMaxValue(this._lij[0],this._lij[1],this._lij[2],s),s.minElevation!==1/0&&(s.level=a.level,c=!0))}c&&(n.elevationBounds??=new C,n.elevationBounds.copyFrom(s))}modifyLayers(e,t,n){let r=this.layerInfo[n];for(let e of r)e.loadingAgent&&e.loadingAgent!==H&&(G(e.loadingAgent),e.loadingAgent=null),e.waitingAgents.clear();for(let t=0;t<r.length;++t)e[t]===void 0&&r[t].release();let i=new Array(...r),a=t.length;r.length=a;for(let e=0;e<a;e++){let n=t[e];r[e]=n>-1?i[n]:U.acquire(this._surface.upsampleInfoPool)}this.setMemoryDirty()}restartAgents(e){this.renderData&&(this._createOrUpdateAgents(0,e),this.updateRenderData(e,0))}updateAgents(e){if(this.renderData){let t=this.layerInfo[e];for(let e of t)e.loadingAgent===H&&(e.loadingAgent=null);this._createOrUpdateAgents(0,e)}}updateAgentSuspension(){for(let e of E){let t=this._isSuspended(e);for(let n of this.layerInfo[e])n.loadingAgent&&n.loadingAgent!==H&&(n.loadingAgent.setSuspension(t),n.loadingAgent===H&&this.updateRenderData(e,0))}}removeLayerAgent(e,t){let n=this.layerInfo[t][e];n.loadingAgent&&n.loadingAgent!==H&&n.loadingAgent.dispose(),n.loadingAgent=null}agentDone(e,t){let n=this.layerInfo[t][e];n.loadingAgent=H,!n.data&&n.upsampleInfo==null&&this._createOrUpdateAgents(e+1,t)}_hasBlendableAncestor(e){return e.blendMode!==`normal`||x(e.parent)&&this._hasBlendableAncestor(e.parent)}_hasBlendModes(e,t,n){for(let r=e;r<t;++r){let e=this._surface.layerViewByIndex(r,n);if(ae(e)&&e?.layer?.blendMode!==`normal`||x(e?.layer?.parent)&&this._hasBlendableAncestor(e?.layer?.parent))return!0}return!1}_createOrUpdateAgents(e,t){let n=this.layerInfo[t];if(n.length===0)return;let r=this._isSuspended(t),i=!1;for(let a=e;a<n.length;++a){let o=n[a],s=this._surface.layerViewByIndex(a,t),c=!1;(!i||S(s))&&(o.loadingAgent?W(this,s)?(o.loadingAgent!==H&&o.loadingAgent.setSuspension(r),o.loadingAgent!==H&&(c=o.loadingAgent.update())):o.dispose():W(this,s)&&(o.loadingAgent=le(this,a,t,r),c=o.loadingAgent.startLoading(),c?o.loadingAgent===H&&this.setPendingUpdate(8):(G(o.loadingAgent),o.loadingAgent=H)),o.loadingAgent===H&&this.updateRenderData(t,0),!s.destroyed&&!this._hasBlendModes(e,n.length,t)&&c&&s.isOpaque&&(i||=!0))}}_isWithinExtent(e){let t=this.extent;return t[0]>=e[0]&&e[2]>=t[2]&&t[1]>=e[1]&&e[3]>=t[3]}intersectsExtent(e){let t=this.extent;return t[2]>=e[0]&&e[2]>=t[0]&&t[3]>=e[1]&&e[3]>=t[1]}getElevationVerticesPerSide(e){let n=this.elevationLevel-this.level,r=Math.max(this.level-e,this.elevationLevelDelta-n),i=t((this._maxTesselation>>r)+1,2,this._maxTesselation+1),a=this.minimumVerticesPerSide;return Math.max(i,a)}_findLIJ(e,t){if(!e)return null;let{rootTiles:n}=this.surface;if(n!=null){for(let r of n)if(de(r,e)){let n=r,i=e[0]-n.level-1;for(;i>=0&&!n.leaf&&!t(n);){let t=e[1]>>i&1,r=e[2]>>i&1;n=n.children[t*2+r],i--}return t(n)?n:null}}return null}findNeighborTile(e,t){let n=this._lij,r=this._getNeighborLIJ(n,e);return r?J(n,r)?t(this)?this:null:this._findLIJ(r,t):null}findCorner(e,t){let n=e===1?1:e===7?0:e===5?2:3,r=this;for(;r.children[0]&&(!t||!t(r));)r=r.children[n];return r}findNeighborCornerTileExact(e,t){return this.findNeighborTile(e,e=>t(e)||e.level===this.level)?.findCorner(j(e),t)||null}forAllSubtreeOnSide(e,t){let n=e===0?[0,1]:e===1?[1]:e===2?[1,3]:e===3?[3]:e===4?[2,3]:e===5?[2]:e===6?[0,2]:[0],r=e=>{let i=e.children;!t(e)&&i[0]&&n.forEach(e=>r(i[e]))};r(this)}getNeighborEdgeStartVertexIndex(e,t){if(!t)return 0;let n=this.level-t.level;if(M(!N||n>=0),n===0)return 0;let r=2**n,i=(e&1)==1,a=+!i,o=t.lij[a+1]*r,s=this._lij[a+1],c=s-o,l=i?r-1-c:c;return N&&(M(o<=s&&s<o+r),M(0<=l&&l<r)),l}forEachLoadedNeighbor(e){let t=this.level,n=e=>e.level===t||e.loaded;P.forEach(t=>{let r=this.findNeighborTile(t,n);r!=null&&r!==this&&r.forAllSubtreeOnSide(F(t),n=>n.loaded?(e(n,t),!0):!1)}),I.forEach(t=>{let r=this.findNeighborTile(t,n)?.findCorner(j(t),e=>e.loaded);N&&M(!r||Y(this,r,t)),r?.loaded&&e(r,t)})}_getNeighborLIJ(e,t){let n=R(t)?-1:+!!z(t),r=B(t)?-1:+!!V(t),i=[e[0],e[1]+n,e[2]+r];return i[1]<0?null:this.surface.isGlobal?this._wrapLIJ(i):i[2]<0?null:i}_wrapLIJ(e){return!e||e[1]<0||e[1]>=2**e[0]?null:this.surface.wrapEastWest(e)}isEdgeNeighbor(e,t){if(e==null)return!1;if(this.level===0&&e.level===0&&(this._eastEnd&&e._westEnd&&t===2||this._westEnd&&e._eastEnd&&t===6))return!0;let n=Math.max((this.extent[2]-this.extent[0])*1e-6,1);switch(t){case 0:return L(this.extent[3],e.extent[1],n);case 4:return L(this.extent[1],e.extent[3],n);case 2:return L(this.extent[2],e.extent[0],n)||L(this.extent[2],-e.extent[0],n);case 6:return L(this.extent[0],e.extent[2],n)||L(this.extent[0],-e.extent[2],n)}}get _eastEnd(){return this._lij[2]===this.surface.lijEastEnd(this.level)-1}get _westEnd(){return this._lij[2]===0}checkGeometryWaterproofness(){}shouldHaveNeighbor(e){let t=this.extent,{rootTilesExtent:n}=this._surface,r=(t[2]-t[0])*.25;if(R(e)&&t[3]+r>=n[3]||z(e)&&t[1]-r<=n[1])return!1;let i=this.surface.isGlobal;return!(!i&&B(e)&&t[0]-r<=n[0]||!i&&V(e)&&t[2]+r>=n[2])}updateDistanceToPOI(e){let t=this._lastPOI;if(this.distanceToPOI>=0&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return;u(this._lastPOI,e);let n=this._center[1].center,r=e[0]-n[0],i=e[1]-n[1],a=e[2]-n[2];this.distanceToPOI=r*r+i*i+a*a}updateOverlayParameters(e){let{renderData:t}=this;if(!t)return;let{overlays:n,longitudeCyclical:r}=e,i=t.overlay;if(n.length===0)this._clearTileOverlayData(0,i),this._clearTileOverlayData(1,i);else{let[e,t]=n,a=this.extent;g(e.extent,a,r)||_(a,e.extent,r)||_(a,t.extent,r)?(this._setOverlayData(n,r,a,0,i),this._setOverlayData(n,r,a,1,i)):(this._clearTileOverlayData(0,i),this._clearTileOverlayData(1,i))}}_setOverlayData(e,t,n,r,i){let a=e[r].extent,o=v(a),s=y(a),c=n[0];if(t){c=t.minimalMonotonic(a[0],c);let e=t.minimalMonotonic(a[0],n[2]);c>e&&(c=e-(n[2]-n[0]))}if(o===0||s===0){i.setOffsetAndScale(r,0,0,1,1);return}let l=v(n)/o,u=y(n)/s,d=(c-a[0])/o,f=(n[1]-a[1])/s;i.setOffsetAndScale(r,d,f,l,u)}_clearTileOverlayData(e,t){t.setOffsetAndScale(e,-1,-1,-1,-1)}}function le(e,t,n,r){let i=n===0?q.acquire():K.acquire();return i.init(e,t,n,r),i}function G(e){e.dispose(),T(e)?q.release(e):ee(e)&&K.release(e)}const K=new r(()=>new O),q=new r(()=>new w),ue=new C;function de(e,t){let n=e.lij,r=t[0]-n[0];return r<0?!1:t[1]>>r===n[1]&&t[2]>>r===n[2]}function J(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Y(e,t,n){return e==null||t==null||t===e?!1:e.level>=t.level?X(e,t,n):X(t,e,j(n))}function X(e,t,n){M(e.level>=t.level);let r=oe(n),i=se(n),a=e.extent,o=t.extent,s=[r?a[0]:a[2],i?a[3]:a[1]],c=[r?o[2]:o[0],i?o[1]:o[3]],l=(a[2]-a[0])*1e-5,u=L(s[0],c[0],l)||e.surface.isGlobal&&L(s[0],-c[0],l),d=L(s[1],c[1],l);if(u&&d)return!0;if(e.level===t.level||!u&&!d)return M(!1),!1;let f=u?Z(o[1],o[3],a[1],a[3],l):Z(o[0],o[2],a[0],a[2],l);return M(f),f}function Z(e,t,n,r,i){return e-i<=n&&n<=r&&r<=t+i}const Q=d(),fe=d(),pe=d(),$=d();export{ce as Tile,Y as isCornerNeighbor,J as lijEquals};
|
|
2
|
+
import{toConst as e}from"../../../core/compilerUtils.js";import"../../../core/has.js";import{clamp as t}from"../../../core/mathUtils.js";import{abortMaybe as n}from"../../../core/maybe.js";import r from"../../../core/ObjectPool.js";import{subtract as i,squaredLength as a,dot as o,scale as s,add as c,length as l,copy as u}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d,unitZ as f}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as p}from"../../../geometry/ellipsoidUtils.js";import{create as m,equals as h,rectangleContainsRectangleCyclicalAware as g,rectanglesIntersectCyclicalAware as _,width as v,height as y}from"../../../geometry/support/aaBoundingRect.js";import{Sphere as b}from"../../../geometry/support/sphere.js";import{isGroupLayer as x}from"../../../layers/support/layerUtils.js";import{isLayerViewWithFlowRenderer as S}from"../support/flowUtils.js";import{ElevationBounds as C}from"./ElevationBounds.js";import{ElevationTileAgent as w,isElevationTileAgent as T}from"./ElevationTileAgent.js";import{LayerClasses as E}from"./LayerClass.js";import{MapDataCacheItem as D}from"./MapDataCacheItem.js";import{MapTileAgent as O,isMapTileAgent as ee}from"./MapTileAgent.js";import{maxPatchTesselation as te}from"./TerrainConst.js";import{isVectorTile as k,isTileTexture as ne,isRasterTile as re,isCreateBitmapResult as ie}from"./TerrainData.js";import{weakAssert as A,isBlendableLayerView as ae,oppositeCorner as j,internalAssert as M,enableTerrainInternalChecks as N,neighborEdgeIndices as P,oppositeEdge as F,neighborCornerIndices as I,almostEquals as L,isNorth as R,isSouth as z,isWest as B,isEast as V,isWestCorner as oe,isNorthCorner as se}from"./terrainUtils.js";import{tileAgentDone as H}from"./TileAgent.js";import{TilePerLayerInfo as U}from"./TilePerLayerInfo.js";import{fallsWithinLayerView as W}from"./tileUtils.js";class ce{constructor(){this._lij=[0,0,0],this._children=[null,null,null,null],this._pendingUpdates=0,this._dirty=!0,this._previouslyRendered=!1,this._lastElevationSourceUpdateRequestSignature=null,this.extent=m(),this._elevationBoundsMin=NaN,this._elevationBoundsMax=0,this.layerInfo=[[],[]],this.extentInRadians=m(),this.centerAtSeaLevel=d(),this._center=[d(),new b,d()],this.up=f(),this._withinClippingArea=!0,this._intersectsClippingArea=!0,this._maxTesselation=0,this._usedMemory=0,this._rasterTileMemory=0,this._vectorTileMemory=0,this._mapDataRefCount=0,this.screenDepth=0,this.renderOrder=0,this._edgeLen=0,this._edgeLen2=0,this._curvatureHeight=0,this.onCompressionFinished=()=>{this.setPendingUpdate(16),this.setMemoryDirty()},this.extentMidX=0,this.extentMidY=0,this.distanceToPOI=-1,this._lastPOI=d(),this.maxLevelDeltaNeighborCount=0,this.unmergableChildCount=0}get lij(){return this._lij}get spatialReference(){return this._surface.spatialReference??this._surface.tilingScheme.spatialReference}get isDisposed(){return this._surface==null}get elevationLevelDelta(){return this._surface.getElevationLevelDelta(this.level)}_setPendingUpdateForDescendants(){let e=this._children;if(e[0])for(let t of e)t.renderData&&(t.setPendingUpdate(16),t.setMemoryDirty()),t._setPendingUpdateForDescendants()}static prune(){K.prune(0),q.prune(0),U.prune()}get _cached(){return!this.leaf&&this._mapDataRefCount<=0}get withinClippingArea(){return this._withinClippingArea}get intersectsClippingArea(){return this._intersectsClippingArea}get clippingArea(){return this._clippingArea}get parent(){return this._parent}get children(){return this._children}get surface(){return this._surface}get elevationBoundsMin(){return this._elevationBoundsMin}get elevationBoundsMax(){return this._elevationBoundsMax}get level(){return this._lij[0]}get key(){return`${this._lij[0]}/${this._lij[1]}/${this._lij[2]}`}get edgeLen(){return this._edgeLen}get radius(){return this._center[1].radius}get visible(){return this._dirty&&this.computeVisibility(),this._visible}get frustumVisibility(){return this._dirty&&this.computeVisibility(),this._frustumVisibility}checkVisibility(e){if(this._dirty)return null;let t=this._calculateVisibility(e);if(this._frustumVisibility!==t||this._visible!==(t!==2&&this._intersectsClippingArea))throw Error(`Assertion failed: waterproof.visibility-cache-mismatch: Tile[${this.lij}]`);return t}computeVisibility(){this._dirty=!1;let e=this.parent?.frustumVisibility??1;this._frustumVisibility=this._calculateVisibility(e);let t=this._frustumVisibility!==2&&this._intersectsClippingArea;t!==this._visible&&(this._visible=t,this._surface.emit(`tiles-visibility-changed`),this._surface.renderer.setDirty(),this.updateAgentSuspension())}_calculateVisibility(e){let t=this.parent;return e===0?0:t!=null&&e===2&&this._elevationBoundsMin>=t._elevationBoundsMin&&this._elevationBoundsMax<=t._elevationBoundsMax?2:this._calculateFrustumVisibility(this.surface.frustum,this._surface.view.frustum.boundingSphere)}get _loadable(){return this.visible||this._surface.view.state.fixedContentCamera}get rendered(){let e=!!this.renderData;return e!==this._previouslyRendered&&(this._surface.emit(`tiles-visibility-changed`),this._previouslyRendered=e,this._surface.renderer.setDirty()),e}init(e,t,n,r,i){this._lij[0]=e,this._lij[1]=t,this._lij[2]=n,this.ellipsoid=p(i.tilingScheme.spatialReference),i.tilingScheme.getExtent(e,t,n,this.extent),i.tilingScheme.convertExtentToRadians(this.extent,this.extentInRadians),this.extentMidX=.5*(this.extent[0]+this.extent[2]),this.extentMidY=.5*(this.extent[1]+this.extent[3]),this._withinClippingArea=!0,this._intersectsClippingArea=!0,this._clippingArea=null,this._mapDataRefCount=0,i.upsampleMapCache.pop(this.key),this._edgeLen=0,this._edgeLen2=0,this._center[1].radius=0,this.elevationLevel=e,this._lastElevationSourceUpdateRequestSignature=null,r&&!Number.isNaN(r.elevationBoundsMin)?(this._elevationBoundsMin=r.elevationBoundsMin,this._elevationBoundsMax=r.elevationBoundsMax):(this._elevationBoundsMin=0,this._elevationBoundsMax=0),this._pendingUpdates=0,this.renderData=null,this.screenDepth=0,this._visible=!1,this._previouslyRendered=!1,this._parent=r,this.clearChildren(),this._surface=i,this.updateVisibility(),this.maxLevelDeltaNeighborCount=0,this.unmergableChildCount=0;for(let e of E){let t=i.numLayers(e),n=this.layerInfo[e];for(let e of n)e.release();n.length=t;for(let r=0;r<t;r++)n[r]=U.acquire(this._surface.upsampleInfoPool),e===0&&this.findElevationBoundsForLayer(r,-1)}this.computeElevationBounds(),this._maxTesselation=Math.min(i.tilingScheme.pixelSize,te)}dispose(){A(!this.renderData,`tile.renderData was not unloaded`),this._surface?.upsampleMapCache.pop(this.key),this.layerInfo.forEach(e=>{e.forEach(e=>e.release()),e.length=0}),this._surface=this._parent=null,this.clearChildren(),this.setMemoryDirty()}refMapData(){++this._mapDataRefCount,this._cached||this._surface.upsampleMapCache.pop(this.key)}unrefMapData(){--this._mapDataRefCount,this._cached&&this.cachedMemory>0&&this._surface.upsampleMapCache.put(this.key,new D(e(this)))}setMemoryDirty(){this._usedMemory=0}get usedMemory(){return this._ensureUsedMemory()+(this._cached?0:this.mapDataMemory)}get cachedMemory(){return this._ensureUsedMemory(),this._surface==null?this.usedMemory:this._cached?this.mapDataMemory:0}get mapDataMemory(){return this._rasterTileMemory+this._vectorTileMemory}get _cpuImageMemorySize(){let e=this._surface.tilingScheme.pixelSize;return e*e*4}_ensureUsedMemory(){if(this._usedMemory>0)return this._vectorTileMemory=this.layerInfo[1].reduce((e,{data:t})=>e+(k(t)?t.usedMemoryPerReference:0),0),this._usedMemory;this._usedMemory=this._baseUsedMemory,this._rasterTileMemory=0,this._vectorTileMemory=0;for(let{data:e}of this.layerInfo[1])k(e)?this._vectorTileMemory+=e.usedMemoryPerReference:this._rasterTileMemory+=this.getTerrainDataMemory(e);for(let e of this.layerInfo[0])this._usedMemory+=e.data?this._cpuImageMemorySize:0;return this.renderData&&(this._usedMemory+=this.renderData.estimatedGeometryMemoryUsage,this._rasterTileMemory+=this.renderData.texture?.usedMemory??0),this._cached&&this._surface.upsampleMapCache.updateSize(this.key),this._usedMemory}getUsedMemoryForLayer(e,t){let n=this.layerInfo[e][t];return n?.data?e===1?this._cached?0:this.getTerrainDataMemory(n.data):e===0?this._cpuImageMemorySize:0:0}getTerrainDataMemory(e){return ne(e)?e.texture.usedMemory:re(e)?e.memoryUsage:k(e)?e.usedMemoryPerReference:ie(e)?this._cpuImageMemorySize:0}updateScreenDepth(e){let[t,n,r]=this._center[1].center,i=e,a=i[2]*t+i[6]*n+i[10]*r+i[14];this.screenDepth=a<0?0:a/(i[3]*t+i[7]*n+i[11]*r+i[15])}shouldSplit(e,t,n){if(!this.visible||e.frustum&&!(this._intersectsClippingArea&&this._calculateFrustumVisibility(e.frustum)!==2))return 0;let r=this.level;i(Q,this._center[1].center,t);let u=a(Q),d=this._closestCenterOnElevationRange(t,fe),f=i(pe,d,t),p=Math.min(u,a(f));if(this._edgeLen2>p&&r<e.maxLod)return 1;let m=Math.sqrt(p),h=e.fovX*m*2,g=this._edgeLen/h,_=()=>{if(r<e.maxLod)return this.elevationLevel=r,0;let t=r+Math.ceil(-Math.log2(e.relativeWidthLimit/g));return t===this.elevationLevel?0:(this.elevationLevel=t,2)},v=n==null?1/0:n-r;if(v<=.5)return _();let y=o(this.up,Q),b=this._elevationBoundsMax-this._elevationBoundsMin,x=b/this.edgeLen;if(e.aboveGround&&y>0&&x<.001&&y/m-Math.sin(this._curvatureHeight/(this.edgeLen*Math.SQRT1_2)*Math.PI)-x>0)return _();let S=n==null?1:3-Math.min(v,2);if(g*S<e.relativeWidthLimit||r>=e.maxLod)return _();if(r<7)return 1;s($,this.up,y),i($,$,f);let C=a($);if(C<=this.radius*this.radius)return 1;s($,$,this.radius/Math.sqrt(C)),c($,$,d),i($,t,$);let w=Math.min(1,(Math.abs(o($,this.up))+.5*b+this._curvatureHeight)/l($)),T=.1/e.angledSplitBias,E=e.fovY*m*2;return w*(this._edgeLen/E*S)<T*e.relativeHeightLimit?_():1}needsElevationSourceUpdate(){let e=this.renderData?.geometryState.samplerDataSourceLevels;if(e==null)return!1;let t=Math.max(this.elevationLevel-this.elevationLevelDelta,0);return e.some(e=>e>t)&&this._lastElevationSourceUpdateRequestSignature!==this._elevationSourceUpdateRequestSignature(e)}markElevationSourceUpdateRequested(){let e=this.renderData?.geometryState.samplerDataSourceLevels;this._lastElevationSourceUpdateRequestSignature=e==null?null:this._elevationSourceUpdateRequestSignature(e)}_elevationSourceUpdateRequestSignature(e){return`${Math.max(this.elevationLevel-this.elevationLevelDelta,0)}:${e.join(`,`)}`}createChildren(){let e=this._children,t=this.lij[0]+1,n=this.lij[1]*2,r=this.lij[2]*2;return e[0]=this.surface.createTile(t,n,r,this),e[1]=this.surface.createTile(t,n,r+1,this),e[2]=this.surface.createTile(t,n+1,r,this),e[3]=this.surface.createTile(t,n+1,r+1,this),e}clearChildren(){this._children[0]=this._children[1]=this._children[2]=this._children[3]=null}get loaded(){return this.renderData?.hasGeometry??!1}get hasGeometryState(){return this.renderData?.geometryState!=null}load(){this.refMapData();for(let e of E)this._createOrUpdateAgents(0,e);this.surface.renderer.loadTile(this)}unload(){this.renderData&&this.unrefMapData(),this.surface.renderer.unloadTile(this);for(let e of E){let t=this.layerInfo[e];for(let e of t)e.loadingAgent&&e.loadingAgent!==H&&(G(e.loadingAgent),e.loadingAgent=null),e.pendingUpdates=0}this.resetPendingUpdate(8),this.resetPendingUpdate(16),this.resetPendingUpdate(32)}unloadMapData(){let e=this.layerInfo[1];for(let t of e)t.loadingAgent&&t.loadingAgent!==H&&(G(t.loadingAgent),t.loadingAgent=null),t.pendingUpdates=0,t.invalidateSourceData();this.renderData?.releaseTexture(),this.setMemoryDirty()}updateClippingStatus(e){if(h(e,this._clippingArea))return!1;let t=this._intersectsClippingArea,n=this._withinClippingArea;e==null?(this._intersectsClippingArea=!0,this._withinClippingArea=!0):(this._intersectsClippingArea=this.intersectsExtent(e),this._withinClippingArea=this._isWithinExtent(e)),this._clippingArea=e,this.updateVisibility();let r=n&&this._withinClippingArea,i=!n&&!t&&!this._withinClippingArea&&!this._intersectsClippingArea;return this.renderData&&!(r||i)&&this.setPendingUpdate(8),!0}updateVisibility(){this._dirty=!0,this._surface.setTileTreeDirty(!1)}getLayerInfo(e,t){return this.layerInfo[t][e]}hasLayerData(e,t){let n=this.layerInfo[t][e];return!(!n?.data||n.dataInvalidated)}get updating(){if(this.hasPendingUpdates)return!0;for(let e of E){let t=this.layerInfo[e];for(let e of t)if(e.loadingAgent&&e.loadingAgent!==H&&e.loadingAgent.updating)return!0}return!1}_isSuspended(e){return this.hasPendingUpdate(1)?!0:e!==0&&!this._loadable}get hasPendingUpdates(){return this._pendingUpdates!==0}hasPendingUpdate(e){return(this._pendingUpdates&e)===e}setPendingUpdate(e){let t=this._pendingUpdates;return this._pendingUpdates|=e,e===1||e===4?this._surface.setTileTreeDirty(!0):this._surface.requestUpdate(),t!==this._pendingUpdates}resetPendingUpdate(e){return this.hasPendingUpdate(e)?(this._pendingUpdates&=~e,!0):!1}requestLayerData(e,t,r){let i=this.layerInfo[t][e];if(i.waitingAgents.has(r))return console.warn(`agent already requested this piece of map data (tile %s, agent tile %s, layer: %d/%d)`,this._lij.toString(),r.tile.lij.toString(),t,e),!0;if(i.waitingAgents.push(r),i.data&&!i.dataInvalidated){console.warn(`agent requested existing data (tile %s, agent tile %s, layer: %d/%d)`,this._lij.toString(),r.tile.lij.toString(),t,e);let n=k(i.data);return r.dataArrived(this,n),!0}if(i.requestPromise)return!0;n(i.requestAbort),i.requestAbort=new AbortController;let a=this._surface.requestTileData(this,e,t,{signal:i.requestAbort.signal});if(!a)return i.requestAbort=null,!1;let o=()=>{i.requestPromise===a&&(i.requestPromise=null,i.requestAbort=null)};return i.requestPromise=a,a.then(o,o),!0}get leaf(){return this._children[0]==null}hasLij(e){return this._lij[0]===e[0]&&this._lij[1]===e[1]&&this._lij[2]===e[2]}findByLij(e){if(this.hasLij(e))return this;let t=this._children;return t[0]?t[0].findByLij(e)||t[1].findByLij(e)||t[2].findByLij(e)||t[3].findByLij(e):null}distanceToSquared(e){return a(i($,this._center[1].center,e))}containsPoint(e){let t=this.extent;return e[0]>=t[0]&&e[1]>=t[1]&&e[0]<=t[2]&&e[1]<=t[3]}containsPointXY(e,t){let n=this.extent;return e>=n[0]&&t>=n[1]&&e<=n[2]&&t<=n[3]}unrequestLayerData(e,t,n){let r=this.layerInfo[t][e],i=r.waitingAgents,a=i.removeUnordered(n)!=null;A(a,`agent has not requested this piece of map data`),i.length<1&&(r.abortRequest(),this.setMemoryDirty())}dataArrived(e,t,n){let r=k(n),i=this.layerInfo[t][e];i.data=n,i.dataInvalidated=!1,i.waitingAgents.forAll(e=>e.dataArrived(this,r)),i.waitingAgents.clear(),this.setMemoryDirty()}dataMissing(e,t){let n=this.layerInfo[t][e];n.dataMissing=!0,n.waitingAgents.forAll(e=>e.dataMissing()),n.waitingAgents.clear(),this.setMemoryDirty()}updateRenderData(e,t,n){switch(n&&this.forEachLoadedNeighbor(n=>n.updateRenderData(e,t)),e){case 1:return this._updateTexture(t);case 0:return this._updateGeometry()}}_updateTexture(e){this.renderData&&(this.resetPendingUpdate(e===0?16:32),this.setPendingUpdate(e===0?32:16))}_updateGeometry(){this.setPendingUpdate(8);for(let e of this.layerInfo[0])e.pendingUpdates|=8}invalidateLayerData(e,t){this.layerInfo[t][e].invalidateSourceData()}computeElevationBounds(){let e=this._elevationBoundsMin,t=this._elevationBoundsMax,n=1/0,r=-1/0,i=this.layerInfo[0],a=!0;for(let e of i)e.elevationBounds!=null&&(n=Math.min(n,e.elevationBounds.minElevation),r=Math.max(r,e.elevationBounds.maxElevation),e.elevationBounds.hasNoDataValues||(a=!1));a&&(n=Math.min(n,0),r=Math.max(r,0)),(e!==n||t!==r)&&(this._elevationBoundsMin=n,this._elevationBoundsMax=r,this.updateRadiusAndCenter(),this._surface.setTileTreeDirty(!1),this.renderData&&this._surface.tileElevationRangeChanged(this,e,t))}_updateCenter(){let e=this._elevationBoundsMin,t=this._elevationBoundsMax,n=.5*(e+t),r=this._center;s($,this.up,n),c(r[1].center,this.centerAtSeaLevel,$),s($,this.up,e),c(r[0],this.centerAtSeaLevel,$),s($,this.up,t),c(r[2],this.centerAtSeaLevel,$)}_closestCenterOnElevationRange(e,t){if(this._surface.viewingMode===1){if(this.level===0)return u(t,this._center[1].center);let n=o(this.up,e),r=Math.max(this.ellipsoid.radius+this._elevationBoundsMin,Math.min(this.ellipsoid.radius+this._elevationBoundsMax,n));return s(t,this.up,r)}let n=Math.max(this._elevationBoundsMin,Math.min(this._elevationBoundsMax,e[2]));return t[0]=this.centerAtSeaLevel[0],t[1]=this.centerAtSeaLevel[1],t[2]=n,t}findElevationBoundsForLayer(e,t){let n=this.layerInfo[0][e],r=this.elevationLevelDelta,i=Math.max(this.elevationLevel-r,0),a=n.elevationBounds;if(a!=null&&a.level>t&&a.level<=i)return;let o=this._surface.layerViewByIndex(e,0);if(!W(this,o))return;let s=ue,c=!1,l=n.data;if(l&&l.level<=i){let e=n.data;s.minElevation=e.samplerData.data.minValue,s.maxElevation=e.samplerData.data.maxValue,s.hasNoDataValues=e.samplerData.data.hasNoDataValues,s.level=this.level,c=!0}else{let t=0,n,a;for(let o=this._parent;o&&(!a||t<r)&&(t=this.elevationLevel-o.level,n=a||n,a=o.layerInfo[0][e].data,!(!a&&n&&o.level<=i));o=o.parent);a||=n,a&&(a.computeMinMaxValue(this._lij[0],this._lij[1],this._lij[2],s),s.minElevation!==1/0&&(s.level=a.level,c=!0))}c&&(n.elevationBounds??=new C,n.elevationBounds.copyFrom(s))}modifyLayers(e,t,n){let r=this.layerInfo[n];for(let e of r)e.loadingAgent&&e.loadingAgent!==H&&(G(e.loadingAgent),e.loadingAgent=null),e.waitingAgents.clear();for(let t=0;t<r.length;++t)e[t]===void 0&&r[t].release();let i=new Array(...r),a=t.length;r.length=a;for(let e=0;e<a;e++){let n=t[e];r[e]=n>-1?i[n]:U.acquire(this._surface.upsampleInfoPool)}this.setMemoryDirty()}restartAgents(e){this.renderData&&(this._createOrUpdateAgents(0,e),this.updateRenderData(e,0))}updateAgents(e){if(this.renderData){let t=this.layerInfo[e];for(let e of t)e.loadingAgent===H&&(e.loadingAgent=null);this._createOrUpdateAgents(0,e)}}updateAgentSuspension(){for(let e of E){let t=this._isSuspended(e);for(let n of this.layerInfo[e])n.loadingAgent&&n.loadingAgent!==H&&(n.loadingAgent.setSuspension(t),n.loadingAgent===H&&this.updateRenderData(e,0))}}removeLayerAgent(e,t){let n=this.layerInfo[t][e];n.loadingAgent&&n.loadingAgent!==H&&n.loadingAgent.dispose(),n.loadingAgent=null}agentDone(e,t){let n=this.layerInfo[t][e];n.loadingAgent=H,!n.data&&n.upsampleInfo==null&&this._createOrUpdateAgents(e+1,t)}_hasBlendableAncestor(e){return e.blendMode!==`normal`||x(e.parent)&&this._hasBlendableAncestor(e.parent)}_hasBlendModes(e,t,n){for(let r=e;r<t;++r){let e=this._surface.layerViewByIndex(r,n);if(ae(e)&&e?.layer?.blendMode!==`normal`||x(e?.layer?.parent)&&this._hasBlendableAncestor(e?.layer?.parent))return!0}return!1}_createOrUpdateAgents(e,t){let n=this.layerInfo[t];if(n.length===0)return;let r=this._isSuspended(t),i=!1;for(let a=e;a<n.length;++a){let o=n[a],s=this._surface.layerViewByIndex(a,t),c=!1;(!i||S(s))&&(o.loadingAgent?W(this,s)?(o.loadingAgent!==H&&o.loadingAgent.setSuspension(r),o.loadingAgent!==H&&(c=o.loadingAgent.update())):o.dispose():W(this,s)&&(o.loadingAgent=le(this,a,t,r),c=o.loadingAgent.startLoading(),c?o.loadingAgent===H&&this.setPendingUpdate(8):(G(o.loadingAgent),o.loadingAgent=H)),o.loadingAgent===H&&this.updateRenderData(t,0),!s.destroyed&&!this._hasBlendModes(e,n.length,t)&&c&&s.isOpaque&&(i||=!0))}}_isWithinExtent(e){let t=this.extent;return t[0]>=e[0]&&e[2]>=t[2]&&t[1]>=e[1]&&e[3]>=t[3]}intersectsExtent(e){let t=this.extent;return t[2]>=e[0]&&e[2]>=t[0]&&t[3]>=e[1]&&e[3]>=t[1]}getElevationVerticesPerSide(e){let n=this.elevationLevel-this.level,r=Math.max(this.level-e,this.elevationLevelDelta-n),i=t((this._maxTesselation>>r)+1,2,this._maxTesselation+1),a=this.minimumVerticesPerSide;return Math.max(i,a)}_findLIJ(e,t){if(!e)return null;let{rootTiles:n}=this.surface;if(n!=null){for(let r of n)if(de(r,e)){let n=r,i=e[0]-n.level-1;for(;i>=0&&!n.leaf&&!t(n);){let t=e[1]>>i&1,r=e[2]>>i&1;n=n.children[t*2+r],i--}return t(n)?n:null}}return null}findNeighborTile(e,t){let n=this._lij,r=this._getNeighborLIJ(n,e);return r?J(n,r)?t(this)?this:null:this._findLIJ(r,t):null}findCorner(e,t){let n=e===1?1:e===7?0:e===5?2:3,r=this;for(;r.children[0]&&(!t||!t(r));)r=r.children[n];return r}findNeighborCornerTileExact(e,t){return this.findNeighborTile(e,e=>t(e)||e.level===this.level)?.findCorner(j(e),t)||null}forAllSubtreeOnSide(e,t){let n=e===0?[0,1]:e===1?[1]:e===2?[1,3]:e===3?[3]:e===4?[2,3]:e===5?[2]:e===6?[0,2]:[0],r=e=>{let i=e.children;!t(e)&&i[0]&&n.forEach(e=>r(i[e]))};r(this)}getNeighborEdgeStartVertexIndex(e,t){if(!t)return 0;let n=this.level-t.level;if(M(!N||n>=0),n===0)return 0;let r=2**n,i=(e&1)==1,a=+!i,o=t.lij[a+1]*r,s=this._lij[a+1],c=s-o,l=i?r-1-c:c;return N&&(M(o<=s&&s<o+r),M(0<=l&&l<r)),l}forEachLoadedNeighbor(e){let t=this.level,n=e=>e.level===t||e.loaded;P.forEach(t=>{let r=this.findNeighborTile(t,n);r!=null&&r!==this&&r.forAllSubtreeOnSide(F(t),n=>n.loaded?(e(n,t),!0):!1)}),I.forEach(t=>{let r=this.findNeighborTile(t,n)?.findCorner(j(t),e=>e.loaded);N&&M(!r||Y(this,r,t)),r?.loaded&&e(r,t)})}_getNeighborLIJ(e,t){let n=R(t)?-1:+!!z(t),r=B(t)?-1:+!!V(t),i=[e[0],e[1]+n,e[2]+r];return i[1]<0?null:this.surface.isGlobal?this._wrapLIJ(i):i[2]<0?null:i}_wrapLIJ(e){return!e||e[1]<0||e[1]>=2**e[0]?null:this.surface.wrapEastWest(e)}isEdgeNeighbor(e,t){if(e==null)return!1;if(this.level===0&&e.level===0&&(this._eastEnd&&e._westEnd&&t===2||this._westEnd&&e._eastEnd&&t===6))return!0;let n=Math.max((this.extent[2]-this.extent[0])*1e-6,1);switch(t){case 0:return L(this.extent[3],e.extent[1],n);case 4:return L(this.extent[1],e.extent[3],n);case 2:return L(this.extent[2],e.extent[0],n)||L(this.extent[2],-e.extent[0],n);case 6:return L(this.extent[0],e.extent[2],n)||L(this.extent[0],-e.extent[2],n)}}get _eastEnd(){return this._lij[2]===this.surface.lijEastEnd(this.level)-1}get _westEnd(){return this._lij[2]===0}checkGeometryWaterproofness(){}shouldHaveNeighbor(e){let t=this.extent,{rootTilesExtent:n}=this._surface,r=(t[2]-t[0])*.25;if(R(e)&&t[3]+r>=n[3]||z(e)&&t[1]-r<=n[1])return!1;let i=this.surface.isGlobal;return!(!i&&B(e)&&t[0]-r<=n[0]||!i&&V(e)&&t[2]+r>=n[2])}updateDistanceToPOI(e){let t=this._lastPOI;if(this.distanceToPOI>=0&&t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2])return;u(this._lastPOI,e);let n=this._center[1].center,r=e[0]-n[0],i=e[1]-n[1],a=e[2]-n[2];this.distanceToPOI=r*r+i*i+a*a}updateOverlayParameters(e){let{renderData:t}=this;if(!t)return;let{overlays:n,longitudeCyclical:r}=e,i=t.overlay;if(n.length===0)this._clearTileOverlayData(0,i),this._clearTileOverlayData(1,i);else{let[e,t]=n,a=this.extent;g(e.extent,a,r)||_(a,e.extent,r)||_(a,t.extent,r)?(this._setOverlayData(n,r,a,0,i),this._setOverlayData(n,r,a,1,i)):(this._clearTileOverlayData(0,i),this._clearTileOverlayData(1,i))}}_setOverlayData(e,t,n,r,i){let a=e[r].extent,o=v(a),s=y(a),c=n[0];if(t){c=t.minimalMonotonic(a[0],c);let e=t.minimalMonotonic(a[0],n[2]);c>e&&(c=e-(n[2]-n[0]))}if(o===0||s===0){i.setOffsetAndScale(r,0,0,1,1);return}let l=v(n)/o,u=y(n)/s,d=(c-a[0])/o,f=(n[1]-a[1])/s;i.setOffsetAndScale(r,d,f,l,u)}_clearTileOverlayData(e,t){t.setOffsetAndScale(e,-1,-1,-1,-1)}}function le(e,t,n,r){let i=n===0?q.acquire():K.acquire();return i.init(e,t,n,r),i}function G(e){e.dispose(),T(e)?q.release(e):ee(e)&&K.release(e)}const K=new r(()=>new O),q=new r(()=>new w),ue=new C;function de(e,t){let n=e.lij,r=t[0]-n[0];return r<0?!1:t[1]>>r===n[1]&&t[2]>>r===n[2]}function J(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function Y(e,t,n){return e==null||t==null||t===e?!1:e.level>=t.level?X(e,t,n):X(t,e,j(n))}function X(e,t,n){M(e.level>=t.level);let r=oe(n),i=se(n),a=e.extent,o=t.extent,s=[r?a[0]:a[2],i?a[3]:a[1]],c=[r?o[2]:o[0],i?o[1]:o[3]],l=(a[2]-a[0])*1e-5,u=L(s[0],c[0],l)||e.surface.isGlobal&&L(s[0],-c[0],l),d=L(s[1],c[1],l);if(u&&d)return!0;if(e.level===t.level||!u&&!d)return M(!1),!1;let f=u?Z(o[1],o[3],a[1],a[3],l):Z(o[0],o[2],a[0],a[2],l);return M(f),f}function Z(e,t,n,r,i){return e-i<=n&&n<=r&&r<=t+i}const Q=d(),fe=d(),pe=d(),$=d();export{ce as Tile,Y as isCornerNeighbor,J as lijEquals};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../core/Logger.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{ZEROS as n}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{VectorTileRendererHelper3D as r}from"../../2d/engine/vectorTiles/VectorTileRendererHelper3D.js";import{updateUniformBufferObject as i}from"../../2d/engine/webgl/shaderGraph/uniformBufferUtils.js";import{tileInfoUniformBlockBinding as a,getTileInfoUniforms as o}from"../../2d/engine/webgl/shaderGraph/techniques/shaders/TileInfo.js";import{viewInfoUniformBlockBinding as s,getViewUniforms as c}from"../../2d/engine/webgl/shaderGraph/techniques/shaders/ViewInfo.js";import{BlendLayersTechnique as l}from"./BlendLayersTechnique.js";import{BlendLayersTechniqueConfiguration as u}from"./BlendLayersTechniqueConfiguration.js";import{RasterColorizerTechnique as d}from"./RasterColorizerTechnique.js";import{RasterColorizerTechniqueConfiguration as f}from"./RasterColorizerTechniqueConfiguration.js";import{MultiSizeFramebuffer as p}from"./support/MultiSizeFramebuffer.js";import{BindParameters as m}from"../webgl-engine/lib/BindParameters.js";import{createQuadVAO as h}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as g}from"../../webgl/enums.js";import _ from"../../webgl/Texture.js";import{UniformBufferObject as
|
|
2
|
+
import e from"../../../core/Logger.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{ZEROS as n}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{VectorTileRendererHelper3D as r}from"../../2d/engine/vectorTiles/VectorTileRendererHelper3D.js";import{updateUniformBufferObject as i}from"../../2d/engine/webgl/shaderGraph/uniformBufferUtils.js";import{tileInfoUniformBlockBinding as a,getTileInfoUniforms as o}from"../../2d/engine/webgl/shaderGraph/techniques/shaders/TileInfo.js";import{viewInfoUniformBlockBinding as s,getViewUniforms as c}from"../../2d/engine/webgl/shaderGraph/techniques/shaders/ViewInfo.js";import{BlendLayersTechnique as l}from"./BlendLayersTechnique.js";import{BlendLayersTechniqueConfiguration as u}from"./BlendLayersTechniqueConfiguration.js";import{RasterColorizerTechnique as d}from"./RasterColorizerTechnique.js";import{RasterColorizerTechniqueConfiguration as f}from"./RasterColorizerTechniqueConfiguration.js";import{MultiSizeFramebuffer as p}from"./support/MultiSizeFramebuffer.js";import{BindParameters as m}from"../webgl-engine/lib/BindParameters.js";import{createQuadVAO as h}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as g}from"../../webgl/enums.js";import{makePipelineState as _,defaultColorWrite as v,premultipliedAlpha as y}from"../../webgl/renderState.js";import{Texture as b}from"../../webgl/Texture.js";import{UniformBufferObject as x}from"../../webgl/UniformBufferObject.js";const S=()=>e.getLogger(`esri.views.3d.terrain`);class C{constructor(e,t){this._rctx=e,this._techniques=t,this._fbos=[],this._vectorTileHelper=new r,this._tileInfoUniformBufferObject=null,this._viewInfoUniformBufferObject=null,this._blendConfiguration=new u,this._current=0,this._lastUsedIds=[],this._lastCreatedBufferId=0,this._onHoldIds=[],this._vao=h(this._rctx,1),this._bindParameters=new m(null)}dispose(){this._bindParameters.destroy(),this._fbos.forEach(t),this._fbos=null,this._vtFBO=t(this._vtFBO),this._vao=t(this._vao),this._vectorTileHelper=t(this._vectorTileHelper),this._tileInfoUniformBufferObject?.dispose(),this._tileInfoUniformBufferObject=null,this._viewInfoUniformBufferObject?.dispose(),this._viewInfoUniformBufferObject=null}updateHeading(e){this._vectorTileHelper?.updateHeading(e)}_acquireBlendTechnique(e,t,n,r=!1,i=0){return this._blendConfiguration.output=t,this._blendConfiguration.blendMode=e,this._blendConfiguration.applyBaseOpacity=n,this._blendConfiguration.premultipliedAlphaSource=r,this._blendConfiguration.background=i,this._techniques.getCompiled(l,this._blendConfiguration)}drawBackground(e,t){let n=this._acquireBlendTechnique(0,t?2:3,!1,!1,1);if(!n)return!1;let r=this._rctx.bindTechnique(n,this._bindParameters,e);return this._render(r),!0}_render(e){this._rctx.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),this._rctx.drawArrays(g.TRIANGLE_STRIP,0,this._vao.vertexCount(`geometry`))}drawGroup(e,t,n,r,i=!0){let a=e.baseOpacity<1,o=this._acquireBlendTechnique(r,t,a,i);if(!o)return!1;t===1&&(e.fboTexture=this._fbos[this.getLastOnHoldId()].get(n).colorTexture??this._rctx.emptyTexture),e.texture=this.currentFBO(n).colorTexture,this.closeGroup(n);let s=this._rctx.bindTechnique(o,this._bindParameters,e);return this._render(s),!0}drawImageData(e,t,n,r,i=!1){if(e.texture==null)return!0;let a=e.baseOpacity<1,o=this._acquireBlendTechnique(r,t,a,i);if(!o)return!1;e.fboTexture=(t===4||r===0&&!a&&!i?null:this.switch(n).colorTexture)??this._rctx.emptyTexture;let s=this._rctx.bindTechnique(o,this._bindParameters,e);return this._render(s),!0}drawRasterData(e,t,n,r,i){let a=i.sourceLayerInfo.data;if(!a.source)return!0;let o=i.tile.surface.layerViewByIndex(i.layerIndex,1);if(`ensureSymbolizerParameters`in o&&o.ensureSymbolizerParameters(a),!a.bind(this._rctx))return!0;let s=e.baseOpacity<1,c=this._acquireRasterTechnique(a,t,r,s);if(!c)return!0;if(!c.compiled)return!1;e.fboTexture=(r===0&&!s?null:this.switch(n).colorTexture)??this._rctx.emptyTexture,a.opacity=e.opacity;let l=a.getUniforms(this._rctx);l.scale=i.scale,l.offset=i.offset,l.backgroundColor=e.backgroundColor,l.fboTexture=e.fboTexture,l.baseOpacity=e.baseOpacity;let u=this._rctx.bindTechnique(c,this._bindParameters,l);return this._render(u),!0}_acquireRasterTechnique(e,t,n,r){if(!this._rctx.capabilities.colorBufferFloat)return null;let i=e.symbolizerParameters,a=[`stretch`,`lut`,`hillshade`].indexOf(i.type);this._rasterConfiguration??=new f,this._rasterConfiguration.output=t,this._rasterConfiguration.blendMode=n,this._rasterConfiguration.applyBaseOpacity=r,this._rasterConfiguration.colorizerType=a,this._rasterConfiguration.applyColormap=!!i.colormap,this._rasterConfiguration.requireBilinearWithNN=e.isBilinearWithStretchColorRamp,this._rasterConfiguration.stretchType=+!e.hasStretchTypeNone(),++this._techniques.precompiling;let o=this._techniques.get(d,this._rasterConfiguration);return--this._techniques.precompiling,o}drawVectorData(e,t,r,i,a,o,s,c){let l=this._rctx,u=a.sourceLayerInfo.data,d=a.tile.surface.layerViewByIndex(a.layerIndex,1),{painter:f,schemaHelper:m,tilingScheme:h,contentZoom:g}=d,_=d.layer.styleRepository,v=Math.round(1/a.scale),y=e.baseOpacity<1,b=y||e.opacity<1||i!==0||t!==1,x=b;if(b&&!this._acquireBlendTechnique(i,t,y,x))return 0;l.setPipelineState(w);let C=null,T=null;b?(T=this.currentFBO(r),this._vtFBO??=new p(this._rctx),C=this._vtFBO.get(r),l.bindFramebuffer(C),this._clearCurrentFBO()):c&&l.clear(256);try{if(u||_.backgroundBucketIds.length>0){let e=this._vectorTileHelper.updateViewRenderParameters(l,a.sourceLod,u,f,m,h,v,a.offset,s,o,g);this._updateViewInfo(e),this._updateTileInfo(e)}this._vectorTileHelper.renderBackground(l,a.sourceLod,u,f,_,m,h),u&&this._vectorTileHelper.renderContent(l,u,a.vtlNeighborInfos,f,_)}catch(e){S().warnOnce(`A render call containing vector tiles did not resolve correctly.`,e)}return C?(l.bindFramebuffer(T),e.texture=C.colorTexture,e.offset=n,e.scale=1,this.drawImageData(e,t,r,i,x)?c?2:1:0):2}_updateTileInfo(e){let t=this._tileInfoUniformBufferObject??=new x(this._rctx,a.descriptor);i(t,a,o(e)),this._rctx.bindUBO(a.bindingPoint,t)}_updateViewInfo(e){let t=this._viewInfoUniformBufferObject??=new x(this._rctx,s.descriptor);i(t,s,c(e)),this._rctx.bindUBO(s.bindingPoint,t)}copyFBOToTexture(e){let t=this._rctx,n=t.bindTexture(e.texture,b.TEXTURE_UNIT_FOR_UPDATES),r=e.descriptor;t.gl.copyTexImage2D(3553,0,r.pixelFormat,0,0,r.width,r.height,0),e.generateMipmap(),t.bindTexture(n,b.TEXTURE_UNIT_FOR_UPDATES)}_clearCurrentFBO(){this._rctx.setStencilWriteMask(255),this._rctx.setClearColor(0,0,0,0),this._rctx.setClearDepth(1),this._rctx.setClearStencil(0),this._rctx.clear(17664)}_initFBO(e,t,n){this._rctx.bindFramebuffer(e),n&&(this._rctx.setViewport(0,0,t,t),this._clearCurrentFBO())}ensureBuffer(e){this._lastUsedIds.length=0,this._lastUsedIds.push(1),this._lastCreatedBufferId=1,this._onHoldIds.length=0,this.bind(e)}bind(e,t=0,n=!0){if(this._current=t,t>=this._fbos.length)for(let e=this._fbos.length;e<=t;e++)this._fbos.push(new p(this._rctx));this._initFBO(this._fbos[t].get(e),e,n)}_bindNextFreeBuffer(e){this._lastUsedIds.length>0?this.bind(e,this._lastUsedIds.pop()):(this._lastCreatedBufferId++,this.bind(e,this._lastCreatedBufferId))}openGroup(e){this._onHoldIds.push(this._current),this._bindNextFreeBuffer(e)}switch(e){let t=this.currentFBO(e),n=this._current;return this._bindNextFreeBuffer(e),this._lastUsedIds.push(n),t}getLastOnHoldId(){return this._onHoldIds[this._onHoldIds.length-1]}closeGroup(e){let t=this._current;this._bindNextFreeBuffer(e),this._lastUsedIds.push(t),this._lastUsedIds.push(this._onHoldIds.pop())}unbind(){this._rctx.bindFramebuffer(null)}currentFBO(e){return this._fbos[this._current].get(e)}}const w=_({blending:y,colorWrite:v});export{C as TileCompositor};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import"../../../core/has.js";import{disposeMaybe as e,releaseMaybe as t}from"../../../core/maybe.js";import{set as n,copy as r}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as i}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as a}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isBaseLayer as o,isGroupLayer as s,isReferenceLayer as c}from"../../../layers/support/layerUtils.js";import{isLayerViewWithFlowRenderer as l}from"../support/flowUtils.js";import{BlendLayersPassParameters as u}from"./BlendLayersTechnique.js";import{isBlendableLayerView as d,isVectorTileLayerView as f,isVectorTileRenderInfo as p,isImageryTileRenderInfo as m,isImageSourceRenderInfo as h,isTextureTileRenderInfo as g,isVectorTilePerLayerInfo as _}from"./terrainUtils.js";import{TextureReference as v}from"./TextureReference.js";import{TileCompositor as y}from"./TileCompositor.js";import{TileRenderInfo as b}from"./TileRenderInfo.js";import{getCacheKey as x,TileTexture as S}from"./TileTexture.js";import{fallsWithinLayerView as C}from"./tileUtils.js";import{blendModeFromString as w}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{isCompressible as T}from"../../support/TextureCompressionWorkerHandle.js";import E from"../../webgl/Texture.js";import{TextureDescriptor as D}from"../../webgl/TextureDescriptor.js";class O{constructor(e,t,n,r,i,a){this._surface=e,this._rctx=t,this.tileSize=n,this._techniques=r,this._cache=i,this._compressionTracker=a,this._passParameters=new u,this._backgroundColor=null,this._maxAnisotropy=this._rctx.parameters.maxMaxAnisotropy,this._compositor=new y(this._rctx,this._techniques)}dispose(){this._compositor=e(this._compositor),this._sharedBackground=t(this._sharedBackground)}get backgroundIsGrid(){return this._backgroundColor==null}get backgroundColor(){return this._backgroundColor}updateHeading(e){this._compositor?.updateHeading(e)}updateTileTexture(e,t){if(!e.renderData)return;let n=this._prepareComposite(e),r=n.targetTextureSize/this.tileSize;n.numTexturedLayers===0||n.firstTexturedLayerIndex===null?this._useBackgroundTexture(e,n,t!==0):(n.numTexturedLayers!==1||n.backgroundVTLIndex!=null||n.foundBlendMode||!this._useLayerTexture(e,n.firstTexturedLayerIndex??0))&&this._composeLayers(e,t,r,F,n)}_prepareComposite(e){let t=this._surface,n=t.baseOpacity,r=t.view.state.contentPixelRatio,i=e.layerInfo[1],a=new P(e.lij,this.tileSize);F.clear(),I.length=0;for(let u=0;u<i.length;u++){let p=t.layerViewByIndex(u,1),m=p.layer,h=!C(e,p),g=m.opacity,_=p.fullOpacity;if(a.hasBasemapLayers=a.hasBasemapLayers||o(m),l(p))continue;if(d(p)){let e=p.layer.blendMode!==`normal`;if(s(m.parent)){let t=m.parent.uid;t!=null&&t!==``&&(e=j(m.parent)||e)}e&&(a.foundBlendMode=e,a.backgroundCovered=!1)}if(this._canSkipLayer(g,h,a.foundBlendMode)){this._clearTexturePendingUpdates(i[u]);continue}++a.numVisibleLayers;let v=f(p);a.backgroundVTLIndex==null&&v&&p.layer.styleRepository.backgroundBucketIds.length>0&&(a.backgroundVTLIndex=u);let y=k(e,u,v);if(!(!y||(this._clearTexturePendingUpdates(i[u]),!y.sourceLayerInfo.data))){if(s(m.parent)){let e=m.parent.uid;e!=null&&e!==``&&M(m.parent,u)}if(v)a.targetTextureSize=Math.max(a.targetTextureSize,this.tileSize*r);else{let e=this._prepareTextureForBackgroundCoverageCheck(y,c(m));n===1&&_===1&&(p.isOpaque||e?.descriptor.isOpaque===!0)&&(a.backgroundCovered=!0)}++a.numTexturedLayers,a.firstTexturedLayerIndex??=u}}return a.lastLayerIndex=i.length-1,a}_canSkipLayer(e,t,n){return this._isLayerNonContributing(e,t)&&!n}_isLayerNonContributing(e,t){return e===0||t}_clearTexturePendingUpdates(e){e.pendingUpdates&=-1}_prepareTextureForBackgroundCoverageCheck(e,t){return this._dataToTexture(e,t)?e.sourceLayerInfo.data:null}setBackground(e){this._backgroundColor!==e&&(this._backgroundColor=e,this._sharedBackground&&this._drawBackgroundTexture(this._sharedBackground))}_drawBackgroundTexture(e,t,n){if(e.texture.setSamplingMode(9987),this._passParameters.offset=i,this._passParameters.scale=1,this._passParameters.opacity=1,this.backgroundColor&&(this._passParameters.backgroundColor=this.backgroundColor),this._compositor.bind(this.tileSize),n?.backgroundVTLIndex==null||t==null)this._compositor.drawBackground(this._passParameters,this.backgroundColor!=null);else{let e=k(t,n.backgroundVTLIndex,!0);this._passParameters.opacity=this._surface.layerViewByIndex(n.backgroundVTLIndex,1).layer.opacity,this._compositor.drawVectorData(this._passParameters,this.backgroundIsGrid?3:2,n.targetTextureSize,0,e,n.targetTextureSize/this.tileSize,this.tileSize,!1)}this._compositor.copyFBOToTexture(e),this._compositor.unbind()}_useBackgroundTexture(e,t,n){let r=e.renderData,i=!n&&!r.textureReference?.isBackground&&(this._surface.view.layerViewManager.updating||t.numVisibleLayers>0)?5e3:0;r.setTextureReference(new v(this._composeBackground(e,t),!0,0,R,this._surface.baseOpacity,0,1),i)}_composeBackground(e,t){if(t?.backgroundVTLIndex==null)return this._sharedBackground??(this._sharedBackground=this._buildTexture(this.tileSize,!1),this._drawBackgroundTexture(this._sharedBackground)),this._sharedBackground;let n=e.renderData.ensureTexture(this.tileSize,!1,0,()=>this._buildTexture(this.tileSize,!1,9987));return this._drawBackgroundTexture(n,e,t),n}_useLayerTexture(e,t){let n=this._surface.layerViewByIndex(t,1),r=o(n.layer),i=r?this._surface.baseOpacity:1,s=r?1:this._surface.baseOpacity,l=n.fullOpacity,u=k(e,t,!1);return this._dataToTexture(u,c(n.layer))?(e.renderData.setTextureReference(new v(u.sourceLayerInfo.data,!1,0,a(u.offset[0],u.offset[1],u.scale,u.scale),i,s,l)),!0):!1}_composeLayers(e,t,n,r,a){let{lastLayerIndex:s,hasBasemapLayers:u,targetTextureSize:h,backgroundCovered:g,foundBlendMode:_,backgroundVTLIndex:y}=a;this._compositor.ensureBuffer(h);let b=!g||_,x=this._surface.baseOpacity,S=!1,T=9987,E=!1,D=0;for(let t=s;t>=0;t--){let a=this._surface.layerViewByIndex(t,1);if(l(a))continue;let s=a.layer,g=f(a),v=k(e,t,g),O=s.opacity,j=!C(e,a),M=!v?.sourceLayerInfo.data&&t===y;if(!v?.sourceLayerInfo.data&&!M||this._canSkipLayer(O,j,_))continue;let N=!o(s)&&!S;S||=N;let P=this._openGroupsAtLayer(t,h,x,u,b,N,r),F=P?4:b&&D===0?this.backgroundIsGrid?3:2:1,L=w[d(a)?a.layer.blendMode:`normal`];for(this._passParameters.baseOpacity=N&&!P&&x<1?x:1,this._passParameters.opacity=O,M||p(v)?E=this._compositor.drawVectorData(this._passParameters,F,h,L,v,n,this.tileSize,E):m(v)?(this._compositor.drawRasterData(this._passParameters,F,h,L,v),A(v)&&(T=9728)):this._dataToTexture(v,c(s))&&(this._passParameters.texture=v.sourceLayerInfo.data.texture,this._passParameters.offset=v.offset,this._passParameters.scale=v.scale,this._compositor.drawImageData(this._passParameters,F,h,L));I.length>0&&I[I.length-1].end===t;){let e=I.pop();this._passParameters.baseOpacity=e.baseOpacity,this._passParameters.opacity=e.opacity,this._passParameters.offset=i,this._passParameters.scale=1,this._compositor.drawGroup(this._passParameters,e.output,h,w[e.blendMode])}D++}let O=e.renderData,j=_||S&&x<1,M=O.ensureTexture(h,j,t,()=>this._buildTexture(h,j,T));M.texture.setSamplingMode(T),this._compositor.copyFBOToTexture(M),this._compositor.unbind(),O.setTextureReference(new v(M,!1,t,R,S?1:x,0,1))}_openGroupsAtLayer(e,t,n,r,i,a,o){let s=!1;return o.forEach(o=>{o.start===e&&(o.output=r?1:i&&a?this.backgroundIsGrid?3:2:1,o.baseOpacity=a?n:1,I.push(o),this._compositor.openGroup(t),s=!0)}),s}_dataToTexture(e,t){if(h(e)){let n=e.sourceLayerInfo,r=!t;n.data=this._buildTexture(n.data,!0,r,e.scale!==1,e.tile.onCompressionFinished),e.tile.setMemoryDirty()}return g(e)}_buildTexture(e,t,n=9987,r=!1,i=()=>{}){return e==null?null:typeof e==`number`?this._buildTextureFromSize(e,t,n):this._buildTextureFromImage(e,t,n,r,i)}_buildTextureFromSize(e,t,n){let r=this._createTextureDescriptor(t,typeof n==`boolean`?9987:n);return r.width=r.height=e,this._buildTileTexture(r)}_buildTextureFromImage(e,t,n,r,i){let a=this._createTextureDescriptor(t,typeof n==`boolean`?9987:n);a.isOpaque=e.isOpaque,a.isOpaque&&(a.pixelFormat=6407);let{bitmap:o}=e;a.width=o.width,a.height=o.height;let s=typeof n==`boolean`&&n;return this._buildTileTexture(a,s,r,i,o)}_createTextureDescriptor(e,t){let n=new D;return n.wrapMode=33071,n.samplingMode=t,n.maxAnisotropy=this._maxAnisotropy,n.preMultiplyAlpha=!0,n.flipped=!0,n.hasMipmap=!0,e||(n.pixelFormat=6407),n}_buildTileTexture(e,t=!1,n=!1,r=()=>{},i){let a=this._cache.pop(x(e,!1))??this._cache.pop(x(e,!0));if(t&&=T(i,e),a)return a.retain(),a.texture.setSamplingMode(e.samplingMode),t?a.texture.enableCompression({compressionTracker:this._compressionTracker,compressionCallback:r,preserveSourceBitmap:n}):a.texture.disableCompression(),a.texture.setData(i),a;e.compress=t?{compressionTracker:this._compressionTracker,compressionCallback:r,preserveSourceBitmap:n}:void 0;let o=new E(this._rctx,e,i);return new S(o,this._cache)}get test(){}}function k(e,t,i){L.layerIndex=t,L.vtlNeighborInfos.clear();let a=e.layerInfo[1][t];if(n(L.offset,0,0),L.tile=e,L.scale=1,L.sourceLod=e.lij,L.sourceLayerInfo=a,a.data)return i&&e.forEachLoadedNeighbor((n,r)=>{if(n.level!==e.level)return;let i=n.layerInfo[1][t];if(!_(i)||a.data===i.data)return;let o=L.vtlNeighborInfos.pushNew();o.offset=z[r],o.sourceLod=n.lij,o.sourceLayerInfo=i}),L;let o=a.upsampleInfo,s=o?.tile?.layerInfo[1][t];return s&&o.tile?(L.tile=o.tile,r(L.offset,o.offset),L.scale=o.scale,L.sourceLod=o.tile.lij,L.sourceLayerInfo=s,L):i?L:null}function A(e){let t=e.sourceLayerInfo.data;return t.source?t.interpolation===`nearest`:!1}function j(e){let t=e.blendMode!==`normal`;return s(e.parent)&&(t=j(e.parent)||t),t}function M(e,t){s(e.parent)&&M(e.parent,t);let n=e.uid;if(n!=null&&n!==``){let r=F.get(n);r?r.start=t:F.set(n,new N(t,t,e.blendMode,e.opacity,1,1))}}class N{constructor(e,t,n,r,i,a){this.start=e,this.end=t,this.blendMode=n,this.opacity=r,this.output=i,this.baseOpacity=a}}class P{constructor(e,t){this.lij=e,this.targetTextureSize=t,this.numTexturedLayers=0,this.numVisibleLayers=0,this.backgroundCovered=!1,this.hasBasemapLayers=!1,this.foundBlendMode=!1,this.lastLayerIndex=0}}const F=new Map,I=[],L=new b,R=a(0,0,1,1),z=[];z[0]=[0,-1],z[1]=[-1,-1],z[2]=[-1,0],z[3]=[-1,1],z[4]=[0,1],z[5]=[1,1],z[6]=[1,0],z[7]=[1,-1];function B(){L.sourceLayerInfo=null,L.tile=null,L.vtlNeighborInfos.prune()}export{N as GroupInfo,O as TileRenderer,B as cleanupTileRenderer};
|
|
2
|
+
import"../../../core/has.js";import{disposeMaybe as e,releaseMaybe as t}from"../../../core/maybe.js";import{set as n,copy as r}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{ZEROS as i}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as a}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isBaseLayer as o,isGroupLayer as s,isReferenceLayer as c}from"../../../layers/support/layerUtils.js";import{isLayerViewWithFlowRenderer as l}from"../support/flowUtils.js";import{BlendLayersPassParameters as u}from"./BlendLayersTechnique.js";import{isBlendableLayerView as d,isVectorTileLayerView as f,isVectorTileRenderInfo as p,isImageryTileRenderInfo as m,isImageSourceRenderInfo as h,isTextureTileRenderInfo as g,isVectorTilePerLayerInfo as _}from"./terrainUtils.js";import{TextureReference as v}from"./TextureReference.js";import{TileCompositor as y}from"./TileCompositor.js";import{TileRenderInfo as b}from"./TileRenderInfo.js";import{getCacheKey as x,TileTexture as S}from"./TileTexture.js";import{fallsWithinLayerView as C}from"./tileUtils.js";import{blendModeFromString as w}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{isCompressible as T}from"../../support/TextureCompressionWorkerHandle.js";import{Texture as E}from"../../webgl/Texture.js";import{TextureDescriptor as D}from"../../webgl/TextureDescriptor.js";class O{constructor(e,t,n,r,i,a){this._surface=e,this._rctx=t,this.tileSize=n,this._techniques=r,this._cache=i,this._compressionTracker=a,this._passParameters=new u,this._backgroundColor=null,this._maxAnisotropy=this._rctx.parameters.maxMaxAnisotropy,this._compositor=new y(this._rctx,this._techniques)}dispose(){this._compositor=e(this._compositor),this._sharedBackground=t(this._sharedBackground)}get backgroundIsGrid(){return this._backgroundColor==null}get backgroundColor(){return this._backgroundColor}updateHeading(e){this._compositor?.updateHeading(e)}updateTileTexture(e,t){if(!e.renderData)return!0;let n=this._prepareComposite(e),r=n.targetTextureSize/this.tileSize;return n.numTexturedLayers===0||n.firstTexturedLayerIndex===null?this._useBackgroundTexture(e,n,t!==0):n.numTexturedLayers===1&&n.backgroundVTLIndex==null&&!n.foundBlendMode&&this._useLayerTexture(e,n.firstTexturedLayerIndex??0)?!0:this._composeLayers(e,t,r,F,n)}_prepareComposite(e){let t=this._surface,n=t.baseOpacity,r=t.view.state.contentPixelRatio,i=e.layerInfo[1],a=new P(e.lij,this.tileSize);F.clear(),I.length=0;for(let u=0;u<i.length;u++){let p=t.layerViewByIndex(u,1),m=p.layer,h=!C(e,p),g=m.opacity,_=p.fullOpacity;if(a.hasBasemapLayers=a.hasBasemapLayers||o(m),l(p))continue;if(d(p)){let e=p.layer.blendMode!==`normal`;if(s(m.parent)){let t=m.parent.uid;t!=null&&t!==``&&(e=j(m.parent)||e)}e&&(a.foundBlendMode=e,a.backgroundCovered=!1)}if(this._canSkipLayer(g,h,a.foundBlendMode)){this._clearTexturePendingUpdates(i[u]);continue}++a.numVisibleLayers;let v=f(p);a.backgroundVTLIndex==null&&v&&p.layer.styleRepository.backgroundBucketIds.length>0&&(a.backgroundVTLIndex=u);let y=k(e,u,v);if(!(!y||(this._clearTexturePendingUpdates(i[u]),!y.sourceLayerInfo.data))){if(s(m.parent)){let e=m.parent.uid;e!=null&&e!==``&&M(m.parent,u)}if(v)a.targetTextureSize=Math.max(a.targetTextureSize,this.tileSize*r);else{let e=this._prepareTextureForBackgroundCoverageCheck(y,c(m));n===1&&_===1&&(p.isOpaque||e?.descriptor.isOpaque===!0)&&(a.backgroundCovered=!0)}++a.numTexturedLayers,a.firstTexturedLayerIndex??=u}}return a.lastLayerIndex=i.length-1,a}_canSkipLayer(e,t,n){return this._isLayerNonContributing(e,t)&&!n}_isLayerNonContributing(e,t){return e===0||t}_clearTexturePendingUpdates(e){e.pendingUpdates&=-1}_prepareTextureForBackgroundCoverageCheck(e,t){return this._dataToTexture(e,t)?e.sourceLayerInfo.data:null}setBackground(e){this._backgroundColor!==e&&(this._backgroundColor=e,this._sharedBackground&&(this._drawBackground()?(this._sharedBackground.texture.setSamplingMode(9987),this._compositor.copyFBOToTexture(this._sharedBackground),this._compositor.unbind()):this._sharedBackground=t(this._sharedBackground)))}_drawBackground(e,t){if(this._passParameters.offset=i,this._passParameters.scale=1,this._passParameters.opacity=1,this.backgroundColor&&(this._passParameters.backgroundColor=this.backgroundColor),this._compositor.bind(this.tileSize),t?.backgroundVTLIndex==null||e==null){if(!this._compositor.drawBackground(this._passParameters,this.backgroundColor!=null))return this._compositor.unbind(),!1}else{let n=k(e,t.backgroundVTLIndex,!0);if(this._passParameters.opacity=this._surface.layerViewByIndex(t.backgroundVTLIndex,1).layer.opacity,this._compositor.drawVectorData(this._passParameters,this.backgroundIsGrid?3:2,t.targetTextureSize,0,n,t.targetTextureSize/this.tileSize,this.tileSize,!1)===0)return this._compositor.unbind(),!1}return!0}_useBackgroundTexture(e,t,n){let r=this._composeBackground(e,t);if(!r)return!1;let i=e.renderData,a=!n&&!i.textureReference?.isBackground&&(this._surface.view.layerViewManager.updating||t.numVisibleLayers>0)?5e3:0;return i.setTextureReference(new v(r,!0,0,R,this._surface.baseOpacity,0,1),a),!0}_composeBackground(e,t){if(t?.backgroundVTLIndex==null){if(this._sharedBackground==null){if(!this._drawBackground())return null;this._sharedBackground=this._buildTexture(this.tileSize,!1),this._sharedBackground.texture.setSamplingMode(9987),this._compositor.copyFBOToTexture(this._sharedBackground),this._compositor.unbind()}return this._sharedBackground}if(!this._drawBackground(e,t))return null;let n=e.renderData.ensureTexture(this.tileSize,!1,0,()=>this._buildTexture(this.tileSize,!1,9987));return n.texture.setSamplingMode(9987),this._compositor.copyFBOToTexture(n),this._compositor.unbind(),n}_useLayerTexture(e,t){let n=this._surface.layerViewByIndex(t,1),r=o(n.layer),i=r?this._surface.baseOpacity:1,s=r?1:this._surface.baseOpacity,l=n.fullOpacity,u=k(e,t,!1);return this._dataToTexture(u,c(n.layer))?(e.renderData.setTextureReference(new v(u.sourceLayerInfo.data,!1,0,a(u.offset[0],u.offset[1],u.scale,u.scale),i,s,l)),!0):!1}_composeLayers(e,t,n,r,a){let{lastLayerIndex:s,hasBasemapLayers:u,targetTextureSize:h,backgroundCovered:g,foundBlendMode:_,backgroundVTLIndex:y}=a;this._compositor.ensureBuffer(h);let b=!g||_,x=this._surface.baseOpacity,S=!1,T=9987,E=!1,D=0;for(let t=s;t>=0;t--){let a=this._surface.layerViewByIndex(t,1);if(l(a))continue;let s=a.layer,g=f(a),v=k(e,t,g),O=s.opacity,j=!C(e,a),M=!v?.sourceLayerInfo.data&&t===y;if(!v?.sourceLayerInfo.data&&!M||this._canSkipLayer(O,j,_))continue;let N=!o(s)&&!S;S||=N;let P=this._openGroupsAtLayer(t,h,x,u,b,N,r),F=P?4:b&&D===0?this.backgroundIsGrid?3:2:1,L=w[d(a)?a.layer.blendMode:`normal`];if(this._passParameters.baseOpacity=N&&!P&&x<1?x:1,this._passParameters.opacity=O,M||p(v)){let e=this._compositor.drawVectorData(this._passParameters,F,h,L,v,n,this.tileSize,E);if(e===0)return this._compositor.unbind(),!1;E=e===2}else if(m(v)){if(!this._compositor.drawRasterData(this._passParameters,F,h,L,v))return this._compositor.unbind(),!1;A(v)&&(T=9728)}else if(this._dataToTexture(v,c(s))&&(this._passParameters.texture=v.sourceLayerInfo.data.texture,this._passParameters.offset=v.offset,this._passParameters.scale=v.scale,!this._compositor.drawImageData(this._passParameters,F,h,L)))return this._compositor.unbind(),!1;for(;I.length>0&&I[I.length-1].end===t;){let e=I.pop();if(this._passParameters.baseOpacity=e.baseOpacity,this._passParameters.opacity=e.opacity,this._passParameters.offset=i,this._passParameters.scale=1,!this._compositor.drawGroup(this._passParameters,e.output,h,w[e.blendMode]))return this._compositor.unbind(),!1}D++}let O=e.renderData,j=_||S&&x<1,M=O.ensureTexture(h,j,t,()=>this._buildTexture(h,j,T));return M.texture.setSamplingMode(T),this._compositor.copyFBOToTexture(M),this._compositor.unbind(),O.setTextureReference(new v(M,!1,t,R,S?1:x,0,1)),!0}_openGroupsAtLayer(e,t,n,r,i,a,o){let s=!1;return o.forEach(o=>{o.start===e&&(o.output=r?1:i&&a?this.backgroundIsGrid?3:2:1,o.baseOpacity=a?n:1,I.push(o),this._compositor.openGroup(t),s=!0)}),s}_dataToTexture(e,t){if(h(e)){let n=e.sourceLayerInfo,r=!t;n.data=this._buildTexture(n.data,!0,r,e.scale!==1,e.tile.onCompressionFinished),e.tile.setMemoryDirty()}return g(e)}_buildTexture(e,t,n=9987,r=!1,i=()=>{}){return e==null?null:typeof e==`number`?this._buildTextureFromSize(e,t,n):this._buildTextureFromImage(e,t,n,r,i)}_buildTextureFromSize(e,t,n){let r=this._createTextureDescriptor(t,typeof n==`boolean`?9987:n);return r.width=r.height=e,this._buildTileTexture(r)}_buildTextureFromImage(e,t,n,r,i){let a=this._createTextureDescriptor(t,typeof n==`boolean`?9987:n);a.isOpaque=e.isOpaque,a.isOpaque&&(a.pixelFormat=6407);let{bitmap:o}=e;a.width=o.width,a.height=o.height;let s=typeof n==`boolean`&&n;return this._buildTileTexture(a,s,r,i,o)}_createTextureDescriptor(e,t){let n=new D;return n.wrapMode=33071,n.samplingMode=t,n.maxAnisotropy=this._maxAnisotropy,n.preMultiplyAlpha=!0,n.flipped=!0,n.hasMipmap=!0,e||(n.pixelFormat=6407),n}_buildTileTexture(e,t=!1,n=!1,r=()=>{},i){let a=this._cache.pop(x(e,!1))??this._cache.pop(x(e,!0));if(t&&=T(i,e),a)return a.retain(),a.texture.setSamplingMode(e.samplingMode),t?a.texture.enableCompression({compressionTracker:this._compressionTracker,compressionCallback:r,preserveSourceBitmap:n}):a.texture.disableCompression(),a.texture.setData(i),a;e.compress=t?{compressionTracker:this._compressionTracker,compressionCallback:r,preserveSourceBitmap:n}:void 0;let o=new E(this._rctx,e,i);return new S(o,this._cache)}get test(){}}function k(e,t,i){L.layerIndex=t,L.vtlNeighborInfos.clear();let a=e.layerInfo[1][t];if(n(L.offset,0,0),L.tile=e,L.scale=1,L.sourceLod=e.lij,L.sourceLayerInfo=a,a.data)return i&&e.forEachLoadedNeighbor((n,r)=>{if(n.level!==e.level)return;let i=n.layerInfo[1][t];if(!_(i)||a.data===i.data)return;let o=L.vtlNeighborInfos.pushNew();o.offset=z[r],o.sourceLod=n.lij,o.sourceLayerInfo=i}),L;let o=a.upsampleInfo,s=o?.tile?.layerInfo[1][t];return s&&o.tile?(L.tile=o.tile,r(L.offset,o.offset),L.scale=o.scale,L.sourceLod=o.tile.lij,L.sourceLayerInfo=s,L):i?L:null}function A(e){let t=e.sourceLayerInfo.data;return t.source?t.interpolation===`nearest`:!1}function j(e){let t=e.blendMode!==`normal`;return s(e.parent)&&(t=j(e.parent)||t),t}function M(e,t){s(e.parent)&&M(e.parent,t);let n=e.uid;if(n!=null&&n!==``){let r=F.get(n);r?r.start=t:F.set(n,new N(t,t,e.blendMode,e.opacity,1,1))}}class N{constructor(e,t,n,r,i,a){this.start=e,this.end=t,this.blendMode=n,this.opacity=r,this.output=i,this.baseOpacity=a}}class P{constructor(e,t){this.lij=e,this.targetTextureSize=t,this.numTexturedLayers=0,this.numVisibleLayers=0,this.backgroundCovered=!1,this.hasBasemapLayers=!1,this.foundBlendMode=!1,this.lastLayerIndex=0}}const F=new Map,I=[],L=new b,R=a(0,0,1,1),z=[];z[0]=[0,-1],z[1]=[-1,-1],z[2]=[-1,0],z[3]=[-1,1],z[4]=[0,1],z[5]=[1,1],z[6]=[1,0],z[7]=[1,-1];function B(){L.sourceLayerInfo=null,L.tile=null,L.vtlNeighborInfos.prune()}export{N as GroupInfo,O as TileRenderer,B as cleanupTileRenderer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../core/PooledArray.js";import{isImageryTileLayerView as t}from"./terrainUtils.js";class n{constructor(){this._queue=new e,this.remove=()=>{}}get done(){return this._queue.length===0&&(!this._last||this._last.leaf)}resetOne(e){this._queue.clear(),this._queue.push(e),this._last=void 0}reset(e=null){this._queue.clear(),e!=null&&this._queue.pushArray(e),this._last=void 0}skipSubtree(){this._last=void 0}next(){let e=this._last?.children;return e?.[0]&&this._queue.pushArray(e),this._last=this._queue.pop(),this._last}}class r{constructor(){this._q=new e}get done(){return this._q.length===0}reset(e){if(this._q.clear(),e!=null){this._q.pushArray(e);for(let e=0;e<this._q.length;++e){let t=this._q.data[e];t.leaf||this._q.pushArray(t.children)}}}next(){return this._q.pop()}}function i(e,t,n=()=>!0){if(Array.isArray(e))for(let r=0;r<e.length;r++)a(e[r],t,n);else a(e,t,n)}function a(e,t,n=()=>!0){if(t(e),!e.leaf&&n(e))for(let n of e.children)a(n,t)}function o(e,t){let n=e.extent;return!(t.xmin>n[2]||t.ymin>n[3]||t.xmax<n[0]||t.ymax<n[1])}function s(e,t,n){let r=e.surface.tilingScheme.levels[e.level].scale;return!(t&&t>0&&r>t*1.00000001||n&&n>0&&r<n*.99999999)}function c(e,t){if(t==null||t.destroyed)return!1;let n=l(t);return!(n?.fullExtent==null||!o(e,n.fullExtent)||!s(e,n.minScale,n.maxScale))}function l(e){return t(e)||e.type===`wmts-3d`?{fullExtent:e.fullExtent,minScale:e.layer.minScale,maxScale:e.layer.maxScale}:e.layer}function u(e,t){let n=e.lij,r=t.lij;return n[0]-r[0]||n[1]-r[1]||n[2]-r[2]}function d(e,t=null){return t==null||t.length===0?e.sort(f):e.sort((e,n)=>m(e,n,t))}function f(e,t){let n=e.screenDepth-t.screenDepth;if(n!==0)return n;let r=e.lij,i=t.lij;return r[0]-i[0]||r[1]-i[1]||r[2]-i[2]}function p(e,t){let n=e.screenDepth,r=t.screenDepth;return n<r?-1:n>r?1:u(e,t)}function m(e,t,n){let r=h(e,n);return r===h(t,n)?p(e,t):r?1:-1}function h(e,t){return t?.some(t=>e.intersectsExtent(t))??!1}function g(e,t){let n=e.distanceToPOI-t.distanceToPOI;if(n!==0)return n;let r=e.lij,i=t.lij;return r[0]-i[0]||r[1]-i[1]||r[2]-i[2]}function _(e,t){let n=e.length;for(let r=0;r<n;++r)e.at(r).updateDistanceToPOI(t);e.sort(g)}function v(e,t,n){let r=1,i=0,a=0;for(;e!==t;)if(r*=.5,i*=.5,a*=.5,e.lij[2]&1&&(i+=.5),e.lij[1]&1||(a+=.5),e=e.parent,e==null)throw Error(`tile was not a descendant of upsampleTile`);n.init(t,i,a,r)}function y(e
|
|
2
|
+
import e from"../../../core/PooledArray.js";import{isImageryTileLayerView as t}from"./terrainUtils.js";class n{constructor(){this._queue=new e,this.remove=()=>{}}get done(){return this._queue.length===0&&(!this._last||this._last.leaf)}resetOne(e){this._queue.clear(),this._queue.push(e),this._last=void 0}reset(e=null){this._queue.clear(),e!=null&&this._queue.pushArray(e),this._last=void 0}skipSubtree(){this._last=void 0}next(){let e=this._last?.children;return e?.[0]&&this._queue.pushArray(e),this._last=this._queue.pop(),this._last}}class r{constructor(){this._q=new e}get done(){return this._q.length===0}reset(e){if(this._q.clear(),e!=null){this._q.pushArray(e);for(let e=0;e<this._q.length;++e){let t=this._q.data[e];t.leaf||this._q.pushArray(t.children)}}}next(){return this._q.pop()}}function i(e,t,n=()=>!0){if(Array.isArray(e))for(let r=0;r<e.length;r++)a(e[r],t,n);else a(e,t,n)}function a(e,t,n=()=>!0){if(t(e),!e.leaf&&n(e))for(let n of e.children)a(n,t)}function o(e,t){let n=e.extent;return!(t.xmin>n[2]||t.ymin>n[3]||t.xmax<n[0]||t.ymax<n[1])}function s(e,t,n){let r=e.surface.tilingScheme.levels[e.level].scale;return!(t&&t>0&&r>t*1.00000001||n&&n>0&&r<n*.99999999)}function c(e,t){if(t==null||t.destroyed)return!1;let n=l(t);return!(n?.fullExtent==null||!o(e,n.fullExtent)||!s(e,n.minScale,n.maxScale))}function l(e){return t(e)||e.type===`wmts-3d`?{fullExtent:e.fullExtent,minScale:e.layer.minScale,maxScale:e.layer.maxScale}:e.layer}function u(e,t){let n=e.lij,r=t.lij;return n[0]-r[0]||n[1]-r[1]||n[2]-r[2]}function d(e,t=null){return t==null||t.length===0?e.sort(f):e.sort((e,n)=>m(e,n,t))}function f(e,t){let n=e.screenDepth-t.screenDepth;if(n!==0)return n;let r=e.lij,i=t.lij;return r[0]-i[0]||r[1]-i[1]||r[2]-i[2]}function p(e,t){let n=e.screenDepth,r=t.screenDepth;return n<r?-1:n>r?1:u(e,t)}function m(e,t,n){let r=h(e,n);return r===h(t,n)?p(e,t):r?1:-1}function h(e,t){return t?.some(t=>e.intersectsExtent(t))??!1}function g(e,t){let n=e.distanceToPOI-t.distanceToPOI;if(n!==0)return n;let r=e.lij,i=t.lij;return r[0]-i[0]||r[1]-i[1]||r[2]-i[2]}function _(e,t){let n=e.length;for(let r=0;r<n;++r)e.at(r).updateDistanceToPOI(t);e.sort(g)}function v(e,t,n){let r=1,i=0,a=0;for(;e!==t;)if(r*=.5,i*=.5,a*=.5,e.lij[2]&1&&(i+=.5),e.lij[1]&1||(a+=.5),e=e.parent,e==null)throw Error(`tile was not a descendant of upsampleTile`);n.init(t,i,a,r)}function y(e,t){if(!e||!t||e[0]===t[0])return!1;let n=e[0]<t[0],r=n?e:t,i=n?t:e,a=1<<i[0]-r[0];return Math.floor(i[1]/a)===r[1]&&Math.floor(i[2]/a)===r[2]}function b(e,t){if(t<=e[0])return[[...e]];let n=1<<t-e[0],r=[],i=e[1]*n,a=e[2]*n;for(let e=0;e<n;++e)for(let o=0;o<n;++o)r.push([t,e+i,o+a]);return r}export{r as IteratorPostorder,n as IteratorPreorder,p as compareTiles,u as compareTilesByLij,m as compareTilesWithStencil,v as computeUpsampleInfo,b as descendantsAtLevel,c as fallsWithinLayerView,d as sortTiles,_ as sortTilesByPOI,y as tilesAreRelated,i as traverseTilesPreorder,h as usesStencil};
|
|
@@ -202,7 +202,7 @@ export interface RenderNodeProperties extends Partial<Pick<RenderNode, "produces
|
|
|
202
202
|
* @see [Sample - Custom Render Node - Windmills](https://developers.arcgis.com/javascript/latest/sample-code/custom-render-node-windmills/)
|
|
203
203
|
*/
|
|
204
204
|
export default abstract class RenderNode extends Accessor {
|
|
205
|
-
constructor(properties
|
|
205
|
+
constructor(properties: RenderNodeProperties);
|
|
206
206
|
/** Get the render representation of the current camera of a view. */
|
|
207
207
|
get camera(): RenderCamera;
|
|
208
208
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthTexture as t}from"../../webgl/ManagedDepthTexture.js";import n from"../../webgl/ManagedFBO.js";import{isDepthFormat as r,formatString as i,DepthTextureFormats as a,ColorFormats as o}from"./FBOCacheFormats.js";import{FBOCacheUsage as s}from"./FBOCacheUsage.js";import{FBOPool as c}from"./FBOPool.js";import{DepthStencilAttachment as l,ColorAttachment0 as u}from"../../../webgl/enums.js";import{DisposableFramebufferObject as d}from"../../../webgl/FramebufferObject.js";import f
|
|
2
|
+
import e from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthTexture as t}from"../../webgl/ManagedDepthTexture.js";import n from"../../webgl/ManagedFBO.js";import{isDepthFormat as r,formatString as i,DepthTextureFormats as a,ColorFormats as o}from"./FBOCacheFormats.js";import{FBOCacheUsage as s}from"./FBOCacheUsage.js";import{FBOPool as c}from"./FBOPool.js";import{DepthStencilAttachment as l,ColorAttachment0 as u}from"../../../webgl/enums.js";import{DisposableFramebufferObject as d}from"../../../webgl/FramebufferObject.js";import{Texture as f}from"../../../webgl/Texture.js";class p{constructor(e){this.rctx=e,this._interactive=!1,this._usage=new s,this._acquired=new Set,this._cache=new c(e.newCache,`FBOCache`),this._colorCache=new c(e.newCache,`ColorAttachmentCache`),this._depthCache=new c(e.newCache,`DepthAttachmentCache`)}destroy(){this._cache.destroy(),this._depthCache.destroy(),this._colorCache.destroy()}clean(){this._cache.clean(),this._colorCache.clean(),this._depthCache.clean()}frameStart(){this._cache.frame(),this._colorCache.frame(),this._depthCache.frame(),this.debugCallback?.(),this._usage.clear()}frameEnd(){this.debugCallback&&(this._usage.summarize(),this._acquired.forEach(e=>this.debugCallback?.(e.name,e.fbo)))}get usedMemory(){return this._acquired.values().reduce((e,t)=>e+t.usedMemory,this._cache.usedMemory+this._colorCache.usedMemory+this._depthCache.usedMemory)}set interactive(e){this._cache.interactive=this._colorCache.interactive=this._depthCache.interactive=e,this._interactive=e}get interactive(){return this._interactive}acquire(e,t,a,o=5){let s=g(o,e,t),c=this._cache.pop(s),{rctx:f}=this;if(c){c.retain(),c.setName(a);let e=c.getAttachment(l);e&&(e.name=h);let t=c.getAttachment(u);t&&(t.name=m(0)),f.unbindTexture(c.fbo.colorTexture)}else{let i=new d(f);c=new n(s,a,i,(n,r,i)=>{r??=5,i??=m(n-u);let a=this._acquireColor(r,e,t,i);return this.rctx.unbindTexture(a.attachment),c.attachColor(a,n),a.release(),c},n=>{n??=14;let r=this.acquireDepth(n,e,t,`${c.name} ${h}`);return c.attachDepth(r),r.release(),c},()=>{if(!c)return;this.debugCallback?.(c.name,c.fbo),this._acquired.delete(c);let e=r(o);e&&c.getAttachment(l)!=null||!e&&c.getAttachment(u)!=null?(e?(c.fbo?.invalidateAttachments([l]),c.detachAllColors()):(c.fbo?.invalidateAttachments([u]),c.detachAllButColor0()),this._trackRelease(c),this._cache.put(c)):c.dispose()}),r(o)?c.acquireDepth(o):c.acquireColor(u,o)}return this._trackAcquire(c,`f `+i(o),e,t),this._trackHandle(c)}acquireDepth(e,n,r,o){let s=g(e,n,r),c=this._depthCache.pop(s);if(c)c.retain(),c.attachment.setShadowFiltering(!1);else{let i=new f(this.rctx,{...a[e],width:n,height:r});c=new t(s,i,()=>{this._trackRelease(c),this._depthCache.put(c)})}return c.name=o,this._trackAcquire(c,`d `+i(e),n,r),c}_acquireColor(t,n,r,a){let s=g(t,n,r),c=this._colorCache.pop(s);if(c)c.retain();else{let i=new f(this.rctx,{...o[t],width:n,height:r,isImmutable:!0});c=new e(s,i,()=>{this._trackRelease(c),this._colorCache.put(c)})}return c.name=a,this._trackAcquire(c,`c `+i(t),n,r),c}_trackHandle(e){return this._acquired.add(e),e}_trackAcquire(e,t,n,r){this.debugCallback&&this._usage.add(e,t,n,r)}_trackRelease(e){this.debugCallback&&this._usage.remove(e)}}function m(e=0){return`color${e}`}const h=`depth`;function g(e,t,n){return`${t}x${n}:${e}`}export{p as FBOCache};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{fromMat4 as r,transpose as i,invert as a}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{set as s,copy as c}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{MaterialPassParameters as u,ShadowMapPassParameters as d,HighlightPassParameters as f,ViewshedShadowMapPassParameters as p,AllRenderPasses as m}from"./AllRenderPasses.js";import{TwoVectorPosition as h}from"../util/TwoVectorPosition.js";import{SyncRenderPlugin as g}from"../../effects/RenderPlugin.js";import{getEmissions as _}from"../../effects/emissive/emissions.js";import{DepthRange as v}from"../../lib/DepthRange.js";import{SizedPixelFormat as y,DataType as b}from"../../../../webgl/enums.js";import x
|
|
2
|
+
import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{fromMat4 as r,transpose as i,invert as a}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{set as s,copy as c}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{MaterialPassParameters as u,ShadowMapPassParameters as d,HighlightPassParameters as f,ViewshedShadowMapPassParameters as p,AllRenderPasses as m}from"./AllRenderPasses.js";import{TwoVectorPosition as h}from"../util/TwoVectorPosition.js";import{SyncRenderPlugin as g}from"../../effects/RenderPlugin.js";import{getEmissions as _}from"../../effects/emissive/emissions.js";import{DepthRange as v}from"../../lib/DepthRange.js";import{SizedPixelFormat as y,DataType as b}from"../../../../webgl/enums.js";import{Texture as x}from"../../../../webgl/Texture.js";import{TextureDescriptor as S}from"../../../../webgl/TextureDescriptor.js";let C=class extends g{constructor(){super(...arguments),this.produces=new Map([[2,e=>this._produces(e,2)],[4,e=>this._produces(e,4)],[0,e=>this._produces(e,0)],[6,e=>this._produces(e,6)],[9,e=>this._produces(e,9)]]),this._drawParametersArray=[],this._drawParametersSet=new Set,this._materialPassParameters=new u,this._shadowPassParameters=new d,this._highlightPassParameters=new f,this._viewshedPassParameters=new p,this._systems=[]}initializeRenderContext(e){this._context=e,this._passes=new m(e,this)}get rctx(){return this._context.renderContext.rctx}get bind(){return this._context.renderContext.bind}uninitializeRenderContext(){}dispose(){this._context=null,this._systems.length=0,this._transformationTexture=t(this._transformationTexture),Object.values(this._passes).forEach(e=>e.destroy())}register(e){this._systems.push(e)}_produces(e,t){return!!this._invoke(e,t,e=>e.count>0)}prepareRender(e){let{_systems:n,_passes:r}=this;n.length!==0&&(this._drawParametersSet.clear(),this._drawParametersArray.length=0,this._transformationTexture=t(this._transformationTexture),Object.values(this._passes).forEach(e=>e.prepareSubmit()),n.forEach(t=>t.submit(r,e.bind)),this._updateTransformationTexture(),Object.values(this._passes).forEach(e=>e.finishSubmit()),this._context.techniques.frameUpdate())}acquireTechniques(e){if(this._systems.length===0)return null;let{output:t,bind:n}=e;return this._invoke(t,n.slot,(t,r)=>(this._updateParameters(n.camera,r,n.slot),r.transformationTexture=this._transformationTexture,t.acquire(r,e.bind)))}render(e,t){this._invoke(e.output,e.bind.slot,(n,r)=>n.dispatch(r,e.bind,t))}_invoke(e,t,n){switch(t){case 2:switch(e){case 0:case 1:case 2:case 3:case 4:case 11:return n(this._passes.opaque,this._materialPassParameters);case 10:return n(this._passes.highlight,this._highlightPassParameters);case 5:return n(this._passes.shadowMap,this._shadowPassParameters);case 6:return n(this._passes.highlightShadowMap,this._shadowPassParameters);case 7:return n(this._passes.defaultShadowMap,this._shadowPassParameters);case 8:return n(this._passes.viewshedShadowMap,this._viewshedPassParameters)}break;case 4:switch(e){case 0:case 1:case 2:case 3:case 4:case 11:return n(this._passes.transparent,this._materialPassParameters)}break;case 0:switch(e){case 0:case 1:case 2:case 3:case 4:case 11:case 9:return n(this._passes.integratedMesh,this._materialPassParameters);case 10:return n(this._passes.highlightIntegratedMesh,this._highlightPassParameters)}break;case 6:switch(e){case 0:case 1:case 2:return n(this._passes.transparentIntegratedMesh,this._materialPassParameters)}break;case 9:switch(e){case 0:case 1:case 2:case 3:case 4:case 11:return n(this._passes.occludedGround,this._materialPassParameters)}}return null}requestRender(){this._context.requestRender()}queryDepthRange(e){return this._systems.reduce((t,n)=>t.union(n.queryDepthRange(e)),new v)}get emissions(){return _(this._systems)}_updateParameters(e,t,n){let o=e.viewInverseTransposeMatrix,l=n===4,u=n===9;s(w,o[3],o[7],o[11]),E.set(w),c(t.transformWorldFromViewTH,E.high),c(t.transformWorldFromViewTL,E.low),c(t.slicePlaneLocalOrigin,w),r(t.transformViewFromCameraRelativeRS,e.viewMatrix),t.identifier===0&&(this._materialPassParameters.transparent=l,this._materialPassParameters.occludedGround=u,i(T,t.transformViewFromCameraRelativeRS),a(t.transformNormalViewFromGlobal,T))}hasHighlight(e){return this._systems.some(t=>t.hasHighlight(e))}registerDrawParameters(e){if(!this._drawParametersSet.has(e)){this._drawParametersSet.add(e);let t=this._drawParametersArray.length;this._drawParametersArray.push(e),e.setTransformationDrawId(t)}}_updateTransformationTexture(){let e=this._drawParametersArray.length;if(e===0)return;let t=2**Math.ceil(Math.log2(e)),n=new Float32Array(t*15);for(let t=0;t<e;t++){let e=this._drawParametersArray[t];e.setTransformationDrawId(t);let r=t*15;n.set(e.transformationFloats,r)}if(this._transformationTexture&&this._transformationTexture.descriptor.height>=e)this._transformationTexture.updateData(0,0,0,5,e,n);else{this._transformationTexture?.dispose();let e=new S(5,t);e.internalFormat=y.RGB32F,e.dataType=b.FLOAT,e.hasMipmap=!1,e.isImmutable=!0,e.pixelFormat=6407,e.samplingMode=9728,this._transformationTexture=new x(this.rctx,e,n)}}};C=e([n(`esri.views.3d.webgl-engine.core.renderPasses.RenderPassManager`)],C);const w=l(),T=o(),E=new h;export{C as RenderPassManager};
|
|
@@ -23,7 +23,7 @@ posView /= factor;
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
return groundRelative;
|
|
26
|
-
}`),(!p.draped||p.hasVerticalOffset)&&m.uniforms.add(n),p.draped||(m.uniforms.add(new c(`hudPixelSizePerDistance`,e=>Math.tan(e.camera.fovY/2)/(e.camera.fullViewport[
|
|
26
|
+
}`),(!p.draped||p.hasVerticalOffset)&&m.uniforms.add(n),p.draped||(m.uniforms.add(new c(`hudPixelSizePerDistance`,e=>Math.tan(e.camera.fovY/2)/(e.camera.fullViewport[3]/2))),m.code.add(u`
|
|
27
27
|
void applyHUDVerticalGroundOffset(vec3 normalModel, inout vec3 posModel, inout vec3 posView) {
|
|
28
28
|
float distanceToCamera = length(posView);
|
|
29
29
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{shadowHighlight as t}from"../bindUniforms.js";import{ForwardLinearDepthConfiguration as n}from"../ForwardLinearDepth.glsl.js";import{forwardLinearDepthToReadShadow as r}from"../forwardLinearDepthToReadShadow.glsl.js";import{
|
|
2
|
+
import{__decorate as e}from"tslib";import{shadowHighlight as t}from"../bindUniforms.js";import{ForwardLinearDepthConfiguration as n}from"../ForwardLinearDepth.glsl.js";import{forwardLinearDepthToReadShadow as r}from"../forwardLinearDepthToReadShadow.glsl.js";import{calculateUVZShadowDraw as i,calculateUVZShadowPass as a,ReadShadowMapOrigin as o}from"./calculateUVZShadow.glsl.js";import{lightingGlobalFactor as s}from"./lightingUniforms.js";import{glsl as c,If as l}from"../../shaderModules/glsl.js";import{Texture2DShadowBindUniform as u}from"../../shaderModules/Texture2DShadowBindUniform.js";import{parameter as d}from"../../shaderTechnique/ShaderTechniqueConfiguration.js";class f extends o{}class p extends o{}class m extends n{constructor(){super(...arguments),this.hasShadowHighlights=!1,this.receiveShadows=!0}}e([d()],m.prototype,`hasShadowHighlights`,void 0),e([d()],m.prototype,`receiveShadows`,void 0);function h(e,t){t.receiveShadows&&e.fragment.include(a),_(e,t)}function g(e,t){t.receiveShadows&&e.fragment.include(i),_(e,t)}function _(e,t){e.include(r,t);let{hasShadowHighlights:n,receiveShadows:i,spherical:a}=t;i&&(v(e.fragment,n),e.fragment.code.add(c`float readShadowMap(const in vec3 _worldPos, float _linearDepth) {
|
|
3
3
|
vec3 uvzShadow = calculateUVZShadow(_worldPos, _linearDepth, textureSize(shadowMap, 0));
|
|
4
4
|
return readShadowMaps(uvzShadow);
|
|
5
5
|
}
|