@arcgis/core 4.34.0-next.53 → 4.34.0-next.55
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/ElevationProfile/ElevationProfileGroundLine.d.ts +4 -0
- package/analysis/ElevationProfile/ElevationProfileGroundLine.js +5 -0
- package/analysis/ElevationProfile/ElevationProfileInputLine.d.ts +4 -0
- package/analysis/ElevationProfile/ElevationProfileInputLine.js +5 -0
- package/analysis/ElevationProfile/ElevationProfileLine.d.ts +4 -0
- package/analysis/ElevationProfile/ElevationProfileLine.js +5 -0
- package/analysis/ElevationProfile/ElevationProfileLineChartOptions.d.ts +4 -0
- package/analysis/ElevationProfile/{LineChartOptions.js → ElevationProfileLineChartOptions.js} +1 -1
- package/analysis/ElevationProfile/ElevationProfileLineViewOptions.d.ts +4 -0
- package/analysis/ElevationProfile/{LineViewOptions.js → ElevationProfileLineViewOptions.js} +1 -1
- package/analysis/ElevationProfile/ElevationProfileQueryLine.d.ts +4 -0
- package/analysis/ElevationProfile/ElevationProfileQueryLine.js +5 -0
- package/analysis/ElevationProfile/ElevationProfileSceneLine.d.ts +4 -0
- package/analysis/ElevationProfile/ElevationProfileSceneLine.js +5 -0
- package/analysis/ElevationProfile/ElevationProfileUnits.d.ts +4 -0
- package/analysis/ElevationProfile/{Units.js → ElevationProfileUnits.js} +1 -1
- package/analysis/ElevationProfile/ElevationProfileViewOptions.d.ts +4 -0
- package/analysis/ElevationProfile/{ViewOptions.js → ElevationProfileViewOptions.js} +1 -1
- package/analysis/ElevationProfile/elevationProfileLineTypes.js +1 -1
- package/analysis/ElevationProfileAnalysis.js +1 -1
- package/applications/Components/formatUtils.d.ts +3 -0
- package/applications/Components/formatUtils.js +5 -0
- package/applications/KnowledgeStudio/resourceSerializationUtils.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/01e8b9dc77a57d1c2a52.js +1 -0
- package/assets/esri/core/workers/chunks/027cfcde29fe87aa2ffe.js +1 -0
- package/assets/esri/core/workers/chunks/{e58336aafe8c95bb6831.js → 0eb728cee6e40cb30c01.js} +1 -1
- package/assets/esri/core/workers/chunks/18ceea59e469a0f2721b.js +1 -0
- package/assets/esri/core/workers/chunks/199a17b0a0f75cbaed16.js +1 -0
- package/assets/esri/core/workers/chunks/1eee7cf11df01a52c1bf.js +1 -0
- package/assets/esri/core/workers/chunks/{ac41b882f9cbf8d56f0c.js → 222f981e876f60ae282f.js} +1 -1
- package/assets/esri/core/workers/chunks/22334a464f798b5279b2.js +1 -0
- package/assets/esri/core/workers/chunks/{99b9392946d776a62997.js → 23e600e368ac829680b5.js} +1 -1
- package/assets/esri/core/workers/chunks/23f54b49742098def8ae.js +1 -0
- package/assets/esri/core/workers/chunks/24ac204d8a045aa821be.js +1 -0
- package/assets/esri/core/workers/chunks/252ee00fd6c4ae0ee7fa.js +1 -0
- package/assets/esri/core/workers/chunks/27197b0a2ffb2b6104ea.js +1 -0
- package/assets/esri/core/workers/chunks/{93af38d29d066f27ed28.js → 2cb14d040e67a261b31c.js} +1 -1
- package/assets/esri/core/workers/chunks/{0021118bafefd1e47ff7.js → 31c088966ccfff2ea1db.js} +1 -1
- package/assets/esri/core/workers/chunks/3b51b61a7b8a1ef87c9b.js +1 -0
- package/assets/esri/core/workers/chunks/3d800fbc449bea18b1cd.js +1 -0
- package/assets/esri/core/workers/chunks/435169b455fd2846799b.js +1 -0
- package/assets/esri/core/workers/chunks/4874aabdb5c60ca66216.js +1 -0
- package/assets/esri/core/workers/chunks/4d2473e680324dc17cfa.js +1 -0
- package/assets/esri/core/workers/chunks/{2da12a64d3baef4aaaa1.js → 4f8dab492331c9a2d67a.js} +1 -1
- package/assets/esri/core/workers/chunks/527557b603400189d49a.js +1 -0
- package/assets/esri/core/workers/chunks/{4bd92232928b832dea76.js → 5900dde7a201a7d47469.js} +1 -1
- package/assets/esri/core/workers/chunks/62ade6f18b375795ddfd.js +1 -0
- package/assets/esri/core/workers/chunks/63f3e46bfa820436161c.js +1 -0
- package/assets/esri/core/workers/chunks/{b0ee061747bef6729bb9.js → 6801b92bce7a918fda6f.js} +1 -1
- package/assets/esri/core/workers/chunks/6940bb6524938894a246.js +1 -0
- package/assets/esri/core/workers/chunks/69e6000044bfb03776ac.js +1 -0
- package/assets/esri/core/workers/chunks/6b11476b2004b4db576e.js +1 -0
- package/assets/esri/core/workers/chunks/71cac356874b36f9a383.js +1 -0
- package/assets/esri/core/workers/chunks/{69dc5a7abc1fda2474ad.js → 722931d1a60be461e521.js} +1 -1
- package/assets/esri/core/workers/chunks/79ab06fb4c91ac8da323.js +1 -0
- package/assets/esri/core/workers/chunks/{0a4357af5b8c0532b439.js → 7bdfc7c7ce1d94c00745.js} +1 -1
- package/assets/esri/core/workers/chunks/813efde41e90e652b7db.js +1 -0
- package/assets/esri/core/workers/chunks/82404ff7c298493ff6f4.js +1 -0
- package/assets/esri/core/workers/chunks/{0ce671588de2858516d2.js → 83737d86584bf1b32368.js} +1 -1
- package/assets/esri/core/workers/chunks/{98ea12c7a000a30f3dc0.js → 87f68c2b9361bd3f8cac.js} +1 -1
- package/assets/esri/core/workers/chunks/97ae2fdb6cb98249f5fa.js +1 -0
- package/assets/esri/core/workers/chunks/9a20390602126995f831.js +1 -0
- package/assets/esri/core/workers/chunks/9cdeead9d444e8d95477.js +1 -0
- package/assets/esri/core/workers/chunks/a778a72456fefdf40115.js +1 -0
- package/assets/esri/core/workers/chunks/a999f804fc2f00b2e7ae.js +1 -0
- package/assets/esri/core/workers/chunks/ae73ac81bd10614c2b53.js +1 -0
- package/assets/esri/core/workers/chunks/c7d4c296011c5393bcaa.js +1 -0
- package/assets/esri/core/workers/chunks/c86e339e45900c54c9f5.js +1 -0
- package/assets/esri/core/workers/chunks/{a1d3f1c221389eb6090c.js → c95e6bef8c97cf647869.js} +1 -1
- package/assets/esri/core/workers/chunks/cbec768cd98caff212f2.js +1 -0
- package/assets/esri/core/workers/chunks/d81c4afad4abe2d1d0b9.js +1 -0
- package/assets/esri/core/workers/chunks/dd120d562b63618e71c0.js +1 -0
- package/assets/esri/core/workers/chunks/dfb12f42b8d319ffa5fc.js +1 -0
- package/assets/esri/core/workers/chunks/e04951ee32f041faaeca.js +1 -0
- package/assets/esri/core/workers/chunks/e982cf44906eb26164f2.js +1 -0
- package/assets/esri/core/workers/chunks/{081b22fa73ef7b696409.js → ead1acf95c3385630da8.js} +2 -2
- package/assets/esri/core/workers/chunks/f1c50f37a81c672263a1.js +1 -0
- package/assets/esri/core/workers/chunks/fe5c37c69da3ec1e56ac.js +1 -0
- package/assets/esri/core/workers/chunks/ff323db554c9e09749e8.js +1 -0
- package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
- package/chunks/Laserlines.glsl.js +1 -1
- package/chunks/LineSeries.js +1 -1
- package/chunks/Theme.js +1 -1
- package/chunks/boundedPlane.js +1 -1
- package/chunks/bundle.js +1 -1
- package/chunks/chartUtilsAm5.js +1 -1
- package/chunks/sphere.js +1 -1
- package/chunks/vec42.js +1 -1
- package/config.js +1 -1
- package/core/ArrayPool.js +1 -1
- package/core/Collection.js +1 -1
- package/core/ObjectPool.js +1 -1
- package/core/accessorSupport/Properties.js +1 -1
- package/core/accessorSupport/watch.js +1 -1
- package/core/arrayUtils.js +1 -1
- package/core/libs/gl-matrix-2/math/quat.js +1 -1
- package/core/libs/gl-matrix-2/math/vec4.js +1 -1
- package/core/pbf.js +1 -1
- package/core/typedArrayUtil.js +1 -1
- package/geohash/GeohashCell.js +1 -1
- package/geohash/GeohashTree.js +1 -1
- package/geometry/operators/json/graphicBufferOperator.js +5 -0
- package/geometry/support/DoubleArray.js +1 -1
- package/geometry/support/boundedPlane.js +1 -1
- package/geometry/support/coordinateSystem.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
- package/geometry/support/sphere.js +1 -1
- package/interfaces.d.ts +232 -322
- package/kernel.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/sources/ParquetSource.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/networks/support/typeUtils.js +1 -1
- package/package.json +1 -1
- package/rest/knowledgeGraphService.js +1 -1
- package/rest/networks/support/Circuit.js +5 -0
- package/rest/networks/support/CircuitSection.js +1 -1
- package/rest/networks/support/Subcircuit.js +1 -1
- package/rest/print.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMEffects.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/cim/effects/EffectOffset.js +1 -1
- package/views/2d/analysisViewModuleImportUtils.js +5 -0
- package/views/2d/engine/Container.js +1 -1
- package/views/2d/engine/DisplayObject.js +1 -1
- package/views/2d/engine/flow/dataUtils.js +1 -1
- package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
- package/views/2d/engine/webgl/DisplayEntity.js +1 -1
- package/views/2d/engine/webgl/DisplayRecord.js +1 -1
- package/views/2d/engine/webgl/FeatureDisplayList.js +1 -1
- package/views/2d/engine/webgl/FeatureTile.js +1 -1
- package/views/2d/engine/webgl/PooledUint32Array.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/Buffer.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/MappedMesh.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/input/MapViewInputManager.js +1 -1
- package/views/2d/interactive/editingTools/TransformTool.js +1 -1
- package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/LayerView2D.js +1 -1
- package/views/2d/layers/features/FeatureContainer.js +1 -1
- package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
- package/views/2d/layers/features/FeatureSourceEventLog.js +1 -1
- package/views/2d/layers/features/FeatureSpatialIndex.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/RenderState.js +1 -1
- package/views/2d/layers/features/aggregation/AccumulatedStatistics.js +1 -1
- package/views/2d/layers/features/aggregation/GeohashSpatialIndex.js +1 -1
- package/views/2d/layers/features/aggregation/GridCell.js +1 -1
- package/views/2d/layers/features/aggregation/GridSpatialIndex.js +1 -1
- package/views/2d/layers/features/processor/AProcessorStrategy.js +1 -1
- package/views/2d/layers/features/schema/processor/LabelMatcherSchema.js +1 -1
- package/views/2d/layers/features/schema/processor/symbols/ComplexSymbolSchema.js +1 -1
- package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/ASourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/DisplayIdGenerator.js +1 -1
- package/views/2d/layers/features/support/FeatureSetCache.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
- package/views/2d/layers/features/support/StaticBitSet.js +1 -1
- package/views/2d/tiling/TileCoverage.js +1 -1
- package/views/2d/tiling/TileKey.js +1 -1
- package/views/3d/FocusAreasView.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/ElevationProfile/{HoveredPointVisualization.js → ElevationProfileHoveredPointVisualization.js} +1 -1
- package/views/3d/analysis/ElevationProfile/ElevationProfileHoveredPointsVisualization.js +5 -0
- package/views/3d/analysis/ElevationProfile/ElevationProfileInputVisualization.js +5 -0
- package/views/3d/analysis/ElevationProfile/ElevationProfileLinesVisualization.js +5 -0
- package/views/3d/analysis/ElevationProfile/ElevationProfileSceneLineComputation.js +5 -0
- package/views/3d/analysis/ElevationProfile/ElevationProfileVisualization.js +5 -0
- package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
- package/views/3d/analysis/Slice/SliceController.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/analysis/Viewshed/FieldOfViewManipulation.js +1 -1
- package/views/3d/analysisViewModuleImportUtils.js +5 -0
- package/views/3d/camera/constraintUtils/distance.js +1 -1
- package/views/3d/input/SceneInputManager.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/MoveManipulation.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/ExtentRotate.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/i3s/I3SClientMaterialUtil.js +1 -1
- package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SNode.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/state/ViewState.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
- package/views/3d/support/ViewSlice.js +1 -1
- package/views/3d/support/orientedBoundingBox.js +1 -1
- package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/Focus.js +1 -1
- package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
- package/views/3d/terrain/ScaleRangeQueries.js +1 -1
- package/views/3d/terrain/SphericalPatch.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/TilePerLayerInfo.js +1 -1
- package/views/3d/webgl-engine/core/material/MaterialBase.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/Octree.js +1 -1
- package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/SliceHelper.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/InstanceOctree.js +1 -1
- package/views/3d/webgl-engine/lib/octreeUtils.js +1 -1
- package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/ToolViewManager.js +1 -1
- package/views/View.js +1 -1
- package/views/View2D.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileController.js +5 -0
- package/views/analysis/ElevationProfile/{ProfileGenerationError.js → ElevationProfileGenerationError.js} +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileGroundLineComputation.js +5 -0
- package/views/analysis/ElevationProfile/ElevationProfileInputLineComputation.js +5 -0
- package/views/analysis/ElevationProfile/ElevationProfileLineComputation.js +5 -0
- package/views/analysis/ElevationProfile/ElevationProfileQueryLineComputation.js +5 -0
- package/views/analysis/ElevationProfile/ElevationProfileResult.d.ts +4 -0
- package/views/analysis/ElevationProfile/ElevationProfileResult.js +5 -0
- package/views/analysis/ElevationProfile/elevationProfileGenerationUtils.js +5 -0
- package/views/analysis/ElevationProfile/elevationProfileGeometryUtils.js +5 -0
- package/views/draw/DrawGraphicTool.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/LegacyDrawManipulator.js +1 -1
- package/views/input/InputManager.js +1 -1
- package/views/input/handlers/LatestPointer.js +1 -1
- package/views/interactive/InteractiveToolBase.js +1 -1
- package/views/interactive/ToolViewManagerManipulatorState.js +1 -1
- package/views/interactive/Tooltip.js +1 -1
- package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
- package/views/interactive/sketch/constraints.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/tileUtils.js +1 -1
- package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
- package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
- package/views/layers/FeatureLayerView.js +1 -1
- package/views/support/AnalysisViewManager.js +5 -0
- package/views/support/PropertiesPool.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileLine.d.ts +2 -2
- package/widgets/Feature/FeatureViewModel.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/analysis/ElevationProfile/GroundLine.d.ts +0 -4
- package/analysis/ElevationProfile/GroundLine.js +0 -5
- package/analysis/ElevationProfile/InputLine.d.ts +0 -4
- package/analysis/ElevationProfile/InputLine.js +0 -5
- package/analysis/ElevationProfile/Line.d.ts +0 -4
- package/analysis/ElevationProfile/Line.js +0 -5
- package/analysis/ElevationProfile/LineChartOptions.d.ts +0 -4
- package/analysis/ElevationProfile/LineViewOptions.d.ts +0 -4
- package/analysis/ElevationProfile/QueryLine.d.ts +0 -4
- package/analysis/ElevationProfile/QueryLine.js +0 -5
- package/analysis/ElevationProfile/SceneLine.d.ts +0 -4
- package/analysis/ElevationProfile/SceneLine.js +0 -5
- package/analysis/ElevationProfile/Units.d.ts +0 -4
- package/analysis/ElevationProfile/ViewOptions.d.ts +0 -4
- package/assets/esri/core/workers/chunks/14c6ae4feb4859cfa7c5.js +0 -1
- package/assets/esri/core/workers/chunks/20a2b3d1f826e9059884.js +0 -1
- package/assets/esri/core/workers/chunks/250b1629becca0410f2a.js +0 -1
- package/assets/esri/core/workers/chunks/2b75212c31145cc07d16.js +0 -1
- package/assets/esri/core/workers/chunks/2efa4d8fe5454f8b2a05.js +0 -1
- package/assets/esri/core/workers/chunks/3149a86cd25684dcb0b3.js +0 -1
- package/assets/esri/core/workers/chunks/38f84294fb2fb4663ba5.js +0 -1
- package/assets/esri/core/workers/chunks/3eb3af0b6cf3c2f28131.js +0 -1
- package/assets/esri/core/workers/chunks/43bd338bb0de375b9bb7.js +0 -1
- package/assets/esri/core/workers/chunks/4622a3e64d3c4aafa56b.js +0 -1
- package/assets/esri/core/workers/chunks/47f2e905ef42e36897aa.js +0 -1
- package/assets/esri/core/workers/chunks/4c6862ad3af947c704f7.js +0 -1
- package/assets/esri/core/workers/chunks/50e9eafb118d2a221f10.js +0 -1
- package/assets/esri/core/workers/chunks/55588e668b6acb6aa390.js +0 -1
- package/assets/esri/core/workers/chunks/5b112471dca94b2e8462.js +0 -1
- package/assets/esri/core/workers/chunks/5dfe1aed10095385c066.js +0 -1
- package/assets/esri/core/workers/chunks/5fc414fc2cfc68828c5b.js +0 -1
- package/assets/esri/core/workers/chunks/7389841fabe0f319f1e5.js +0 -1
- package/assets/esri/core/workers/chunks/781b59ba0cabe78bc122.js +0 -1
- package/assets/esri/core/workers/chunks/8e0559cc6295008fcdf7.js +0 -1
- package/assets/esri/core/workers/chunks/944fa8261aad94ae0542.js +0 -1
- package/assets/esri/core/workers/chunks/9e479e7e2e51476c3d27.js +0 -1
- package/assets/esri/core/workers/chunks/a1e179dd6de9c8769b02.js +0 -1
- package/assets/esri/core/workers/chunks/a6493607b98783bf1ef2.js +0 -1
- package/assets/esri/core/workers/chunks/a829969ed44cdb814f27.js +0 -1
- package/assets/esri/core/workers/chunks/b2a035befeeff1a55ad8.js +0 -1
- package/assets/esri/core/workers/chunks/b4251e10621fb3ad03a3.js +0 -1
- package/assets/esri/core/workers/chunks/b877142a275188a16e17.js +0 -1
- package/assets/esri/core/workers/chunks/b9f5672093727c6f92c9.js +0 -1
- package/assets/esri/core/workers/chunks/ba45dccb4dab5a74d224.js +0 -1
- package/assets/esri/core/workers/chunks/cc0cb4906e4419f7c4a9.js +0 -1
- package/assets/esri/core/workers/chunks/cda27c0fafd687dfa72e.js +0 -1
- package/assets/esri/core/workers/chunks/ddd6597a66ec6b972f9c.js +0 -1
- package/assets/esri/core/workers/chunks/e28d3ed65c3a76a044c8.js +0 -1
- package/assets/esri/core/workers/chunks/e3f68f7b408a08d7cd5d.js +0 -1
- package/assets/esri/core/workers/chunks/e9716995ce0c3683eafc.js +0 -1
- package/assets/esri/core/workers/chunks/ed25bf087f52e5d3e71b.js +0 -1
- package/assets/esri/core/workers/chunks/f75ddd79be506423be09.js +0 -1
- package/assets/esri/core/workers/chunks/f8505bf69795f5293a79.js +0 -1
- package/assets/esri/core/workers/chunks/f92e608931b1c168cb45.js +0 -1
- package/assets/esri/core/workers/chunks/fb4950995f6780f6c22a.js +0 -1
- package/views/3d/analysis/AnalysisViewManager3D.js +0 -5
- package/views/3d/analysis/ElevationProfile/HoveredPointsVisualization.js +0 -5
- package/views/3d/analysis/ElevationProfile/InputVisualization.js +0 -5
- package/views/3d/analysis/ElevationProfile/ProfileLinesVisualization.js +0 -5
- package/views/3d/analysis/ElevationProfile/SceneLineComputation.js +0 -5
- package/views/3d/analysis/ElevationProfile/Visualization.js +0 -5
- package/views/analysis/ElevationProfile/Controller.js +0 -5
- package/views/analysis/ElevationProfile/GroundLineComputation.js +0 -5
- package/views/analysis/ElevationProfile/InputLineComputation.js +0 -5
- package/views/analysis/ElevationProfile/LineComputation.js +0 -5
- package/views/analysis/ElevationProfile/QueryLineComputation.js +0 -5
- package/views/analysis/ElevationProfile/Result.d.ts +0 -4
- package/views/analysis/ElevationProfile/Result.js +0 -5
- package/views/analysis/ElevationProfile/geometryUtils.js +0 -5
- package/views/analysis/ElevationProfile/profileGenerationUtils.js +0 -5
- /package/views/analysis/ElevationProfile/{elevationQuerySourceUtils.js → elevationProfileQuerySourceUtils.js} +0 -0
- /package/views/analysis/ElevationProfile/{statisticsUtils.js → elevationProfileStatisticsUtils.js} +0 -0
- /package/views/analysis/ElevationProfile/{traversalUtils.js → elevationProfileTraversalUtils.js} +0 -0
- /package/views/analysis/ElevationProfile/{unitUtils.js → elevationProfileUnitUtils.js} +0 -0
- /package/views/analysis/ElevationProfile/{visualizationUtils.js → elevationProfileVisualizationUtils.js} +0 -0
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{clamp as t}from"../../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{watch as o}from"../../../../core/reactiveUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{
|
|
5
|
+
import{__decorate as e}from"tslib";import{clamp as t}from"../../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{watch as o}from"../../../../core/reactiveUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{q as a,e as c,G as p,c as d,m as l,d as u,n as h}from"../../../../chunks/vec32.js";import{create as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import f from"../../../../geometry/Point.js";import{wrap as y}from"../../../../geometry/support/ray.js";import{PointOfInterest as g}from"./PointOfInterest.js";import{PropertiesPool as P}from"../../../support/PropertiesPool.js";import{TaskPriority as _}from"../../../support/Scheduler.js";import{Yield as L}from"../../../support/Yield.js";let j=class extends g{constructor(e){super(e),this._propertiesPool=new P({location:()=>new f,renderLocation:()=>m()},this),this._dirty=!0,this.renderLocation=this._propertiesPool.get("renderLocation")}initialize(){this.addHandles([o(()=>this.centerOnSurface.renderLocation,()=>this.updateRenderLocation(),{equals:a}),o(()=>this.state.contentCamera,()=>this.updateRenderLocation())]),this.scheduler&&this.addHandles(this.scheduler.registerTask(_.POINT_OF_INTEREST_FREQUENT,this))}destroy(){this._propertiesPool=r(this._propertiesPool)}get updating(){return this._dirty||this.centerOnSurface.updating}get location(){const e=this._propertiesPool.get("location");return e.spatialReference=this.state.spatialReference,this.renderCoordsHelper.fromRenderCoords(this.renderLocation,e),e}get worldUnitsPerContentPixel(){const{camera:e,contentPixelRatio:t}=this.state;return e.computeRenderPixelSizeAt(this.renderLocation)*(e.pixelRatio/t)}get readyToRun(){return this._dirty}runTask(){const e=this._get("renderLocation"),r=this.centerOnSurface.renderLocation,o=this.renderCoordsHelper,i=this.state.contentCamera;this._dirty=!1,o.worldUpAtPosition(r,R);const s=Math.max(0,(Math.acos(c(R,i.viewForward))-.5*Math.PI)*(i.aboveGround?1:-1));if(Number.isNaN(s)){if(!e||!p(e,r)){const e=this._propertiesPool.get("renderLocation");d(e,r),this._set("renderLocation",e)}return L}const n=1-t(s/(.5*Math.PI),0,1),a=n*n*n;this._calculateScreenHorizontalEdgeOnSurface(O);const u=this._propertiesPool.get("renderLocation");return l(u,r,O,a),e&&p(e,u)||this._set("renderLocation",u),L}_calculateScreenHorizontalEdgeOnSurface(e){const t=this.state.contentCamera,r=t.getRenderCenter(i());if(r[1]=t.aboveGround?t.padding[2]:t.fullHeight-t.padding[0],this.estimateSurfaceIntersectionAtRenderPoint(r,e))return e;const o=this.renderCoordsHelper.getAltitude(this.centerOnSurface.renderLocation);if(t.unprojectFromRenderScreen(r,S)){u(S,S,t.eye);const r=h(S,S);if(this.renderCoordsHelper.intersectInfiniteManifold(y(t.eye,r),o,e))return e}return this.renderCoordsHelper.setAltitude(e,o,t.eye)}updateRenderLocation(){this._dirty=!0}};e([s()],j.prototype,"_dirty",void 0),e([s({constructOnly:!0})],j.prototype,"scheduler",void 0),e([s({constructOnly:!0})],j.prototype,"centerOnSurface",void 0),e([s({constructOnly:!0})],j.prototype,"estimateSurfaceIntersectionAtRenderPoint",void 0),e([s()],j.prototype,"updating",null),e([s()],j.prototype,"location",null),e([s()],j.prototype,"renderLocation",void 0),e([s()],j.prototype,"worldUnitsPerContentPixel",null),j=e([n("esri.views.3d.support.pointsOfInterest.Focus")],j);const R=m(),S=m(),O=m();export{j as Focus};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import{watch as r,when as s,on as n,sync as i,initial as o}from"../../../../core/reactiveUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{f as u,q as d,c as h}from"../../../../chunks/vec32.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as f}from"../../../../core/support/UpdatingHandles.js";import{create as l}from"../../../../geometry/support/ray.js";import{debugFlags as _}from"../debugFlags.js";import{DebugPoint as m}from"../debugUtils.js";import{fromRenderAtEye as C}from"../geometryUtils/ray.js";import{CameraOnSurface as g}from"./CameraOnSurface.js";import{CenterOnSurface as y}from"./CenterOnSurface.js";import{ContentGeometryUpdates as O}from"./ContentGeometryUpdates.js";import{Focus as A}from"./Focus.js";import{StableSurfaceCenter as w}from"./StableSurfaceCenter.js";import{SurfaceGeometryUpdates as S}from"./SurfaceGeometryUpdates.js";import{Intersector as v}from"../../webgl-engine/lib/Intersector.js";import{terrainId as I}from"../../webgl-engine/lib/verticalOffsetUtils.js";import{PropertiesPool as b}from"../../../support/PropertiesPool.js";import{TaskPriority as R}from"../../../support/Scheduler.js";let P=class extends t{constructor(e){super(e),this.renderPointOfView=p(),this._pois=new Array,this._updatingHandles=new f,this._debugCenters=null,this._tmpRay=l(),this._centerRayDirty=!0,this._surfaceAltitudeAtCenter=0,this._surfaceAltitudeAtCenterDirty=!0,this._contentAltitudeAtCenter=0,this._contentAltitudeAtCenterDirty=!0,this._propertiesPool=new b({renderPointOfView:
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import{watch as r,when as s,on as n,sync as i,initial as o}from"../../../../core/reactiveUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{f as u,q as d,c as h}from"../../../../chunks/vec32.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as f}from"../../../../core/support/UpdatingHandles.js";import{create as l}from"../../../../geometry/support/ray.js";import{debugFlags as _}from"../debugFlags.js";import{DebugPoint as m}from"../debugUtils.js";import{fromRenderAtEye as C}from"../geometryUtils/ray.js";import{CameraOnSurface as g}from"./CameraOnSurface.js";import{CenterOnSurface as y}from"./CenterOnSurface.js";import{ContentGeometryUpdates as O}from"./ContentGeometryUpdates.js";import{Focus as A}from"./Focus.js";import{StableSurfaceCenter as w}from"./StableSurfaceCenter.js";import{SurfaceGeometryUpdates as S}from"./SurfaceGeometryUpdates.js";import{Intersector as v}from"../../webgl-engine/lib/Intersector.js";import{terrainId as I}from"../../webgl-engine/lib/verticalOffsetUtils.js";import{PropertiesPool as b}from"../../../support/PropertiesPool.js";import{TaskPriority as R}from"../../../support/Scheduler.js";let P=class extends t{constructor(e){super(e),this.renderPointOfView=p(),this._pois=new Array,this._updatingHandles=new f,this._debugCenters=null,this._tmpRay=l(),this._centerRayDirty=!0,this._surfaceAltitudeAtCenter=0,this._surfaceAltitudeAtCenterDirty=!0,this._contentAltitudeAtCenter=0,this._contentAltitudeAtCenterDirty=!0,this._propertiesPool=new b({renderPointOfView:()=>p()},this),this._contentIntersector=new v(e.view.state.viewingMode),this._surfaceIntersector=new v(e.view.state.viewingMode),this._surfaceIntersector.options.invisibleTerrain=!1,this._surfaceIntersector.options.store=0}initialize(){const{state:e,basemapTerrain:t,renderCoordsHelper:a,map:c}=this.view,u=()=>this._estimateSurfaceAltitudeAtCenter(),d=this.view.resourceController.scheduler,h=t?.elevationQueryCache,p={state:e,scheduler:d,surface:t,renderCoordsHelper:a};this._set("centerOnSurfaceInfrequent",new y({...p,task:R.POINT_OF_INTEREST_INFREQUENT,estimateSurfaceAltitudeAtCenter:u})),this._set("centerOnSurfaceFrequent",new y({...p,task:R.POINT_OF_INTEREST_FREQUENT,estimateSurfaceAltitudeAtCenter:u})),this._set("centerOnContent",new y({...p,task:R.POINT_OF_INTEREST_FREQUENT,estimateSurfaceAltitudeAtCenter:()=>this._estimateContentAltitudeAtCenter()})),this._set("cameraOnSurface",new g({...p,cache:h,task:R.POINT_OF_INTEREST_INFREQUENT,map:c})),this._set("surfaceGeometryUpdates",new S({...p,centerOnSurfaces:[this.centerOnSurfaceFrequent,this.centerOnContent,this.centerOnSurfaceInfrequent]})),this._set("contentGeometryUpdates",new O(this.view.allLayerViews)),this._set("surfaceOrigin",new w({cache:h,view:this.view})),this._set("focus",new A({state:e,scheduler:d,surface:t,renderCoordsHelper:a,centerOnSurface:this.centerOnSurfaceFrequent,estimateSurfaceIntersectionAtRenderPoint:(e,t)=>this._estimateSurfaceIntersectionAtRenderPoint(e,this.view.state.contentCamera,t)})),this._pois.push(this.centerOnContent,this.centerOnSurfaceFrequent,this.centerOnSurfaceInfrequent,this.cameraOnSurface,this.focus),this.addHandles([r(()=>e.contentCamera,e=>this._cameraChanged(e),i),this._updatingHandles.add(()=>t.extent,()=>this._updateCenterPointsOfInterest()),this._updatingHandles.add(()=>this.view.map?.ground?.navigationConstraint?.type,e=>{this._surfaceIntersector.options.backfacesTerrain="none"===e},o),s(()=>!t.updating,()=>this._updateCenterPointsOfInterest(),i),n(()=>this.surfaceGeometryUpdates.events,"request-update",()=>this._updateCenterPointsOfInterest()),n(()=>this.contentGeometryUpdates.events,"request-update",()=>this._updateCenterOnContent()),this._updatingHandles.add(()=>_.SHOW_POI,e=>this._setDebug(e),o)]),this._cameraChanged(this.view.state.contentCamera);for(const r of this._pois)r.runTask()}destroy(){this._setDebug(!1),this._propertiesPool.destroy();for(const e of this._pois)e.destroy();this._pois.length=0,this.surfaceOrigin.destroy(),this._updatingHandles.destroy(),this._set("centerOnSurfaceInfrequent",null),this._set("centerOnSurfaceFrequent",null),this._set("centerOnContent",null),this._set("cameraOnSurface",null),this._set("surfaceGeometryUpdates",null),this._set("contentGeometryUpdates",null),this._set("surfaceOrigin",null),this._set("focus",null)}get updating(){return!(!this.surfaceGeometryUpdates?.updating&&!this._pois.some(e=>e.updating))||this._updatingHandles.updating}get _centerRay(){return this._centerRayDirty&&(this._centerRayCached=this.view.sceneIntersectionHelper.getCenterRayWithSubpixelOffset(this.view.state.contentCamera,this._tmpRay),this._centerRayDirty=!1),this._centerRayCached}_estimateContentAltitudeAtCenter(){if(!this._contentAltitudeAtCenterDirty)return this._contentAltitudeAtCenter;this._contentAltitudeAtCenterDirty=!1;const e=this._centerRay;return null==e||(this.view.sceneIntersectionHelper.intersectRay(e,this._contentIntersector,j,H)?this._contentAltitudeAtCenter=this.view.renderCoordsHelper.getAltitude(j):this._contentAltitudeAtCenter=this._estimateSurfaceAltitudeAtCenter()),this._contentAltitudeAtCenter}_estimateSurfaceAltitudeAtCenter(){if(!this.view.basemapTerrain)return 0;if(!this._surfaceAltitudeAtCenterDirty)return this._surfaceAltitudeAtCenter;this._surfaceAltitudeAtCenterDirty=!1;const e=this._centerRay;if(null==e)return this._surfaceAltitudeAtCenter;const t=e.origin,r=u(j,e.origin,e.direction);return this._surfaceIntersector.resetWithRay(e,this.view.state.contentCamera),this.view.basemapTerrain.intersect(this._surfaceIntersector,null,t,r),this._surfaceIntersector.results.min.getIntersectionPoint(j)&&(this._surfaceAltitudeAtCenter=this.view.renderCoordsHelper.getAltitude(j)),this._surfaceAltitudeAtCenter}_estimateSurfaceIntersectionAtRenderPoint(e,t,r){const s=C(t,e,T);if(null==s)return null;const n=s.origin,i=u(j,s.origin,s.direction);return this._surfaceIntersector.resetWithRay(s,t),this.view.basemapTerrain.intersect(this._surfaceIntersector,null,n,i),this._surfaceIntersector.results.min.getIntersectionPoint(r)?r:null}_cameraChanged(e){this._updateCenterPointsOfInterest();const t=e.eye;d(this.renderPointOfView,t)||this._set("renderPointOfView",h(this._propertiesPool.get("renderPointOfView"),t))}_updateCenterPointsOfInterest(){this._centerRayDirty=!0,this._surfaceAltitudeAtCenterDirty=!0,this._contentAltitudeAtCenterDirty=!0;for(const e of this._pois)e.updateRenderLocation()}_updateCenterOnContent(){this._contentAltitudeAtCenterDirty=!0,this.centerOnContent.updateRenderLocation()}_setDebug(e){if(!e)return this._debugCenters?.forEach(e=>e.hide()),void this.removeHandles("debug");if(!this._debugCenters){this._debugCenters=new Map;const e=this.view.graphics;this._debugCenters.set(this.centerOnContent,new m(e,"red","CenterOnContent")),this._debugCenters.set(this.centerOnSurfaceFrequent,new m(e,"red","CenterOnSurface")),this._debugCenters.set(this.centerOnSurfaceInfrequent,new m(e,"red","CenterOnSurface")),this._debugCenters.set(this.cameraOnSurface,new m(e,"blue","CameraOnSurface")),this._debugCenters.set(this.focus,new m(e,"green","Focus"))}for(const t of this._pois)this.addHandles(this._updatingHandles.add(()=>t.renderLocation,e=>this._debugCenters?.get(t)?.show(e,t.renderCoordsHelper.spatialReference),o),"debug")}get test(){}};e([a()],P.prototype,"centerOnContent",void 0),e([a()],P.prototype,"centerOnSurfaceFrequent",void 0),e([a()],P.prototype,"centerOnSurfaceInfrequent",void 0),e([a()],P.prototype,"cameraOnSurface",void 0),e([a()],P.prototype,"focus",void 0),e([a()],P.prototype,"renderPointOfView",void 0),e([a()],P.prototype,"surfaceOrigin",void 0),e([a()],P.prototype,"contentGeometryUpdates",void 0),e([a()],P.prototype,"surfaceGeometryUpdates",void 0),e([a({constructOnly:!0})],P.prototype,"view",void 0),e([a()],P.prototype,"updating",null),P=e([c("esri.views.3d.support.pointsOfInterest.PointsOfInterest")],P);const j=p(),T=l(),H={exclude:new Set([I])};export{P as PointsOfInterest};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import r from"../../../core/ObjectPool.js";import s from"../../../core/PooledArray.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{d as u}from"../../../chunks/vec42.js";import{create as n}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";class l{constructor(){this.extent=n(),this.minLevel=0,this.maxLevel=0,this.callback=null}}let a=class extends t{constructor(){super(...arguments),this._queries=new s({initialSize:10}),this._queriesInvPtr=0,this._queryQueue=new s({initialSize:30}),this._queryPool=new r(l)}queryVisibleLevelRange(e,t,r,s){const i=this._queryPool.acquire();u(i.extent,e),i.minLevel=t??-Number.MAX_VALUE,i.maxLevel=r??Number.MAX_VALUE,i.callback=s,this._queryQueue.push(i),this.notifyChange("updating")}get updating(){return 0!==this._queryQueue.length}prepare(){for(;this._queries.length<this._queries.data.length&&this._queryQueue.length>0;){const e=this._queryQueue.pop();this._queries.push(e)}this._queriesInvPtr=this._queries.length}process(){for(let e=0;e<this._queries.length;e++){const t=this._queries.data[e];this._queryPool.release(t),t.callback(e>=this._queriesInvPtr),t.callback=null}this._queries.clear(),this.notifyChange("updating")}queriesForTile(e){const t=e.level;let r=0;for(;r<this._queriesInvPtr;){const s=this._queries.data[r],i=s.extent;t>=s.minLevel&&t<=s.maxLevel&&i[0]<=e.extent[2]&&i[2]>=e.extent[0]&&i[1]<=e.extent[3]&&i[3]>=e.extent[1]?(this._queries.swapElements(r,this._queriesInvPtr-1),this._queriesInvPtr--):r++}}};e([i()],a.prototype,"updating",null),a=e([o("esri.views.3d.terrain.ScaleRangeQueries")],a);export{a as ScaleRangeQueries};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import r from"../../../core/ObjectPool.js";import s from"../../../core/PooledArray.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{d as u}from"../../../chunks/vec42.js";import{create as n}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";class l{constructor(){this.extent=n(),this.minLevel=0,this.maxLevel=0,this.callback=null}}let a=class extends t{constructor(){super(...arguments),this._queries=new s({initialSize:10}),this._queriesInvPtr=0,this._queryQueue=new s({initialSize:30}),this._queryPool=new r(()=>new l)}queryVisibleLevelRange(e,t,r,s){const i=this._queryPool.acquire();u(i.extent,e),i.minLevel=t??-Number.MAX_VALUE,i.maxLevel=r??Number.MAX_VALUE,i.callback=s,this._queryQueue.push(i),this.notifyChange("updating")}get updating(){return 0!==this._queryQueue.length}prepare(){for(;this._queries.length<this._queries.data.length&&this._queryQueue.length>0;){const e=this._queryQueue.pop();this._queries.push(e)}this._queriesInvPtr=this._queries.length}process(){for(let e=0;e<this._queries.length;e++){const t=this._queries.data[e];this._queryPool.release(t),t.callback(e>=this._queriesInvPtr),t.callback=null}this._queries.clear(),this.notifyChange("updating")}queriesForTile(e){const t=e.level;let r=0;for(;r<this._queriesInvPtr;){const s=this._queries.data[r],i=s.extent;t>=s.minLevel&&t<=s.maxLevel&&i[0]<=e.extent[2]&&i[2]>=e.extent[0]&&i[1]<=e.extent[3]&&i[3]>=e.extent[1]?(this._queries.swapElements(r,this._queriesInvPtr-1),this._queriesInvPtr--):r++}}};e([i()],a.prototype,"updating",null),a=e([o("esri.views.3d.terrain.ScaleRangeQueries")],a);export{a as ScaleRangeQueries};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{lerp as t}from"../../../core/mathUtils.js";import{n as e,i,f as s,g as o,H as n,h as r,e as a,F as l,a as h}from"../../../chunks/vec32.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{lonLatToSphericalPCPF as d}from"../../../geometry/projection/lonLatToSphericalPCPF.js";import{newDoubleArray as c}from"../../../geometry/support/DoubleArray.js";import{intersectsSphere as p,numPlanes as f}from"../../../geometry/support/frustum.js";import{c as m,
|
|
5
|
+
import{lerp as t}from"../../../core/mathUtils.js";import{n as e,i,f as s,g as o,H as n,h as r,e as a,F as l,a as h}from"../../../chunks/vec32.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{lonLatToSphericalPCPF as d}from"../../../geometry/projection/lonLatToSphericalPCPF.js";import{newDoubleArray as c}from"../../../geometry/support/DoubleArray.js";import{intersectsSphere as p,numPlanes as f}from"../../../geometry/support/frustum.js";import{c as m,o as g,a as x,p as $,e as v,k as M}from"../../../chunks/sphere.js";import{createSphericalGlobePatch as _,updateCornerSpherical as b,updateEdgesAndCornersSpherical as j,updateEdgeElevationsAndResolutionsSpherical as y}from"./PatchGeometryFactory.js";import{enableTerrainInternalChecks as B,internalAssert as S,almostEquals as V}from"./terrainUtils.js";import{Tile as H}from"./Tile.js";import{compareTilesByLij as R}from"./tileUtils.js";class T extends H{constructor(t,e,i,s,o){super(),this._convexHull=new Array(24),this._boundingSphere=m(),this._baseUsedMemory=1816,this.init(t,e,i,s,o)}init(i,s,o,n,r){super.init(i,s,o,n,r);const a=this.ellipsoid.radius,l=this.extentInRadians[0],h=this.extentInRadians[1],u=this.extentInRadians[2],c=this.extentInRadians[3],p=t(h,c,.5),f=t(l,u,.5),m=0===i?0:Math.min(Math.abs(h),Math.abs(c));this._edgeLen=(u-l)*Math.cos(m)*a,this._edgeLen2=this._edgeLen*this._edgeLen,this._curvatureHeight=a-Math.sqrt(a*a-this._edgeLen2/4),d(this.centerAtSeaLevel,f,p,this.ellipsoid.radius),e(this.up,this.centerAtSeaLevel),this.updateRadiusAndCenter()}updateRadiusAndCenter(){this._updateBoundingVolumes();const t=this._center;if(0===this.lij[0])g(t[1],0,0,0),i(t[0],0,0,0),i(t[2],0,0,0),t[1][3]=this.ellipsoid.radius+this.elevationBoundsMax;else{this._updateCenter();const e=t[1],i=this.convexHull;let s=0;const o=x(e);for(let t=0;t<8;++t)s=Math.max(s,I(o,i,3*t));t[1][3]=Math.sqrt(s)}}_calculateFrustumVisibility(t){if(!p(t,this._boundingSphere))return 2;if(this.lij[0]<10)return 1;const e=this.convexHull,i=this.surface.view.state.camera.near;let s=!0;for(let o=0;o<f;o++){const n=4===o,r=t[o],a=r[0],l=r[1],h=r[2],u=r[3]-(n?i:0);let d=!1;for(let t=0;t<8;++t){const i=3*t;if(a*e[i]+l*e[i+1]+h*e[i+2]+u<0){if(d=!0,!s)break}else s=!1}if(!d)return 2}return s?0:1}computeElevationBounds(){super.computeElevationBounds(),this._updateBoundingVolumes()}createGeometry(){_(this.renderData,this._getPatchType()),this._updateBoundingVolumes(),this.setMemoryDirty()}_updateBoundingVolumes(){this._updateConvexHull(),this._updateBoundingSphere(),B&&this._checkBVs()}_updateBoundingSphere(){const t=this._boundingSphere,e=this.elevationBoundsMin,i=this.elevationBoundsMax,r=this.ellipsoid.radius,a=i;if(0===this.level)$(t,0,0,0,r+a);else{const a=this.extentInRadians,l=.5*(a[0]+a[2]),h=a[1],u=a[3];L(k,l,h,r),L(A,l,u,r),s(D,k,A);o(D,D,(r+.5*(e+i))/n(D));const d=this.convexHull;let c=0;const p=(t,e)=>{const i=t[0]-d[3*e],s=t[1]-d[3*e+1],o=t[2]-d[3*e+2];return Math.sqrt(i*i+s*s+o*o)};for(let t=0;t<8;++t){const e=p(D,t);c=Math.max(c,e)}v(t,D,c+2)}}_updateConvexHull(){const t=this.extentInRadians,i=this.ellipsoid.radius;if(0===this.level)return;const l=this.elevationBoundsMin,d=this.elevationBoundsMax,c=this._getPatchType(),p=this.surface.isWebMercator,f=p&&1===c,m=p&&2===c,g=m||f,x=Math.PI/2,$=t[0],v=t[2],M=m?-x:t[1],_=f?x:t[3],b=.5*($+v),j=l,y=i+(g?Math.min(0,j-1):j),B=(t,e,i)=>L(t,e,i,y),H=u(),R=u(),T=u(),C=u();B(H,$,M),B(R,$,_),B(T,v,_),B(C,v,M);const I=(t,e)=>{for(let i=0;i<3;++i)this._convexHull[3*e+i]=t[i]};I(H,0),I(R,1),I(T,2),I(C,3);const F=d,k=i+(g?Math.max(0,F+1):F),A=u(),D=u(),E=u();L(D,b,_,y),L(E,b,M,y),s(A,D,E),e(A,A);const w=u(),U=u(),q=(t,i)=>{h(U,t,i),e(U,U);const n=-a(t,w)/a(U,w);S(n>=0),o(U,U,n),s(t,t,U)};if(2**this.lij[0]>2*this.lij[1]){const t=E,i=u();r(i,P,t),e(i,i),r(w,t,i),e(w,w),S(V(a(w,t)/n(t),0)),q(H,R),q(C,T),I(H,0),I(C,3)}else if(2**this.lij[0]!==2*this.lij[1]){const t=D,i=u();r(i,P,t),e(i,i),r(w,i,t),e(w,w),q(R,H),q(T,C),I(R,1),I(T,2)}const N=(t,e)=>{const i=k/a(e,A);for(let s=0;s<3;++s)this._convexHull[3*t+s]=e[s]*i};N(4,H),N(5,R),N(6,T),N(7,C)}_getPatchType(){const t=this.lij[1],e=0===t,i=t===(1<<this.level)-1;return e?i?3:1:i?2:0}intersectsRay(t,e,i,s){const o=this._boundingSphere,n=o[3]+i,r=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],a=o[0]-t[0],l=o[1]-t[1],h=o[2]-t[2],u=(a*e[0]+l*e[1]+h*e[2])/r,d=e[0]*u-a,c=e[1]*u-l,p=e[2]*u-h;return d*d+c*c+p*p<n*n}get minimumVerticesPerSide(){return this.level<C.length?C[this.level]+1:2}updateCornerElevations(){b(this.renderData),this._updateBoundingVolumes()}updateEdgeElevations(){j(this.renderData),this._updateBoundingVolumes()}updateEdgeElevationsAndResolutions(){y(this.renderData),this._updateBoundingVolumes()}_checkBVs(){if(!B)return;if(this.level<=2)return;const t=this._boundingSphere,i=t[3],o=M(t,u()),d=u(),p=this.ellipsoid.radius,f=this.elevationBoundsMin,m=this.elevationBoundsMax,g=p+f,x=1,$=0,v=this._center[1];M(v,u());const _=v[3],b=this.convexHull,j=(t,e)=>{for(let i=0;i<3;++i)t[i]=b[3*e+i]};{const t=u(),i=u(),s=u(),o=u(),n=u(),l=(l,u,d,c)=>{j(i,l),j(s,u),j(o,d),h(i,i,s),h(o,o,s),r(t,i,o),e(t,t);const p=a(t,s);j(n,c);const f=a(t,n),m=Math.abs(f-p);S(V(m,0),`Non coplanar ${l},${u},${d},${c} diff = ${m}`)};l(0,1,2,3),l(4,5,6,7),l(0,1,4,5),l(1,2,5,6),l(2,3,6,7),l(3,0,7,4)}const y=c(24),H=(t,e,i)=>{const s=4*t;for(let o=0;o<3;++o)y[s+o]=e[o];y[s+3]=i},T=u(),C=u(),I=u(),P=u(),k=(t,i,s,o)=>{j(T,i),j(C,s),j(I,o),h(T,T,C),e(T,T),h(I,I,C),e(I,I),r(P,T,I),e(P,P);const n=a(P,C);H(t,P,n)};k(0,0,1,2),k(1,1,0,4),k(2,1,5,2),k(3,3,2,6),k(4,4,0,3),k(5,4,6,5);const A=(t,e,i,s)=>{const o=4*t;return y[o]*e+y[o+1]*i+y[o+2]*s-y[o+3]},D=(t,e,i,s)=>A(t,e,i,s)>=-1,E=(t,e)=>D(t,e[0],e[1],e[2]),w=2**this.lij[0]>2*this.lij[1],U=(t,e,s)=>Math.sqrt(F(t,e,s,o[0],o[1],o[2]))<i,q=t=>U(t[0],t[1],t[2]),N=(t,e)=>U(t[e],t[e+1],t[e+2]),G=this.extentInRadians,z=.5*(G[0]+G[2]),O=G[1],W=G[3],J=u(),K=u();L(J,z,W,g),L(K,z,O,g);const Q=w?"Upper":"Lower";let X=!0;for(let e=0;e<6;++e){for(let t=0;t<8;++t){const i=3*t,s=D(e,b[i],b[i+1],b[i+2]);X&&=s,S(s,`Tile[${this.lij}] Convex hull point ${t} outside of plane ${e}`)}S(E(e,K),`Tile[${this.lij}] (${Q}) bottom mid outside of plane ${e}`),S(E(e,J),`Tile[${this.lij}] (${Q}) top mid outside of plane ${e}`)}S(X,"Not all convex hull points are inside convex hull polyhedron"),S(q(K),`Tile[${this.lij}] (${Q}) bottom mid outside of bounding sphere`),S(q(J),`Tile[${this.lij}] (${Q}) top mid outside of bounding sphere`);for(let e=0;e<8;++e){const t=N(b,3*e);S(t,`Tile[${this.lij}] Convex hull point ${e} outside of bounding sphere`)}for(let e=0;e<6;++e)for(let t=0;t<8;++t){const i=3*t;D(e,b[i],b[i+1],b[i+2])||console.error(`Tile[${this.lij}] Convex hull point ${t} outside of plane ${e}`)}const{extentInRadians:Y}=this,Z=Math.max(Y[2]-Y[0],Y[3]-Y[1]),tt=Math.round(Z*p),{renderData:et}=this;if(!et)return;const{geometry:it,geometryState:st,localOrigin:ot}=et,nt=it.vertexAttributes?.position;if(!nt)return;const rt=u(),at=it.numVerticesPerSide-2,{indices:lt,indexCount:ht,edgeVerticesStartIndex:ut,poleVerticesStartIndex:dt}=it;if(!lt)return;const ct=new Set;for(let e=0;e<ht;++e){const t=lt[e];if(ct.has(t))continue;ct.add(t);const r=t<dt,a=t>=ut;let h=!1,u=-1;if(a){let e=ut;for(let i=0;i<4;++i){const s=st.edgeResolutions[i];if(t===e||t===e+s-1){h=!0;break}if(e+=s,t<e){u=i;break}}}const c=a?st.edgePeerNeighbors[u]:null,g=a&&c&&R(this,c)>0;nt.getVec(t,d),s(rt,d,ot);const v=n(rt)-p;let M=0,b=!1;const j=f-v,y=v-m,B=j>x,S=y>x,V=B||S,H=()=>{const e=r?"internal":a&&!h?"edge":h?"corner":"pole";return`Tile[${this.lij}].vertex[${t}]:${e}`+(B?"(below)":S?"(above)":"")+(g?"(Neighbor)":"")},T=l(rt,o);if(T>=i+$){const t=T-i;V||(console.error(`${H()} is out of the bounding sphere by ${t.toFixed(0)} / ${i.toFixed(0)}[tol=${$}] h=${v.toFixed(0)} / [${f.toFixed(0)}..${m.toFixed(0)}] (${(t/i).toFixed(0)})`),b=!0)}for(let e=0;e<6;++e)if(!D(e,rt[0],rt[1],rt[2])){const s=A(e,rt[0],rt[1],rt[2]),o=t%at,n=(t-o)/at;0===e&&j||5===e&&y||(console.error(`${H()} (${o},${n})|${at}] is out of the bounding trapezoid plane ${e} h=${Math.round(v)} / [${Math.round(f)}..${Math.round(m)}] dist=${Math.round(s)} radii = ${Math.round(i)}/${Math.round(_)}} : maxL = ${tt}`),++M)}if(b||M>0)break}}get convexHull(){return this._convexHull}}const C=[128,64,64,32,16,8,8,4];function I(t,e,i){return F(t[0],t[1],t[2],e[i],e[i+1],e[i+2])}function F(t,e,i,s,o,n){const r=s-t,a=o-e,l=n-i;return r*r+a*a+l*l}const L=(t,e,i,s)=>{const o=Math.cos(e),n=Math.sin(e),r=Math.cos(i),a=Math.sin(i);t[0]=s*r*o,t[1]=s*r*n,t[2]=s*a},P=[0,0,1],k=u(),A=u(),D=u();export{T as SphericalPatch};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../Color.js";import has from"../../../core/has.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import s from"../../../core/ObjectPool.js";import{watch as n,sync as a}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{d as c,i as d,e as h}from"../../../chunks/vec32.js";import{ZEROS as u,create as g,fromValues as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as f,ZEROS as p}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as m,set as y}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as b}from"../../../geometry/support/buffer/BufferView.js";import{overlayRenderOccludedFlag as T}from"./OverlayRenderer.js";import{PatchRenderData as x}from"./PatchRenderData.js";import{TerrainAttributesCache as v}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as R}from"./terrainUtils.js";import{TileRenderer as P}from"./TileRenderer.js";import{IteratorPreorder as O,sortTiles as w,compareTiles as S}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as D,ComponentIntersectionData as B}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{getOverlayContentForOutputTerrain as C}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{SyncRenderPlugin as j,ConsumesDepth as E,ConsumesNone as q}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as F}from"../webgl-engine/lib/Attribute.js";import{IntersectorResult as A}from"../webgl-engine/lib/IntersectorResult.js";import{intersectAabbInvDirBefore as k,MeshIntersectionOptions as M,intersectTriangles as N}from"../webgl-engine/lib/RayIntersections.js";import{getSettings as G}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{terrainId as z,getVerticalOffsetTerrain as U}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as I}from"../webgl-engine/materials/DrawParameters.js";import{T as L}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as V}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as H}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as W}from"../../webgl/enums.js";const Y=7,Q=10,Z=m();let J=class extends j{get visibleTiles(){return Array.from(this._visiblePatchesByOrigin.values()).flat()}get _isGlobal(){return 1===this._stage.viewingMode}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}constructor(e,t,i,n,a,o){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._ellipsoidRadius=n,this._compressionTracker=a,this.type=2,this.isGround=!0,this._passParameters=new L,this._drawParameters=new I,this._renderDataPool=new s(x),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new O,this._castShadows=!1,this._inViewshed=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=1,this.produces=new Map([[1,()=>this._produces()&&0===this.transparency],[6,()=>this._produces()&&(1===this.transparency||2===this.transparency)],[9,()=>this._produces()&&this.renderOccludedFlags===T]]),this._tileSize=256,this._configuration=new H(1===t.viewingMode),this._tileTextureCache=new r((e,t)=>o.newCache(e,t),"TileTexture"),this.tileGeometryCache=new v(o)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(n(()=>this._overlayRenderer.renderOccludedFlags,e=>{this.renderOccludedFlags=e,this.setNeedsRender()},a))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?E:q}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return this._configuration.visualizeNormals}set visualizeNormals(e){this._configuration.visualizeNormals!==e&&(this._configuration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._configuration.backfaceCullingEnabled}set cullBackFaces(e){this._configuration.backfaceCullingEnabled!==e&&(this._configuration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}get layerViewUid(){return z}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._configuration.screenSizePerspective!==e&&(this._configuration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,32)}reuseTextureFromParent(e){const t=e.parent;if(!t)return!1;const i=f(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,32===t?0:2),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[0])i.pendingUpdates&=-9;e.resetPendingUpdate(8);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=Q-Y,i=Math.max(0,Math.floor((e.level-t)/Y)*Y);if(this._isGlobal&&0===i)return u;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=1){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=1){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=1){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new P(this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&0!==this.transparency)return;const s=K,n=X;c(s,r,i),d(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,o=e.results.max,l=e.results.ground,u=0===e.options.store,g=!!e.results.ground.target,_=U(e.verticalOffset),f=e.tolerance;let p,m=u&&null!=a.distance?a.distance:1/0;const T=e.options,x=T.normalRequired||!T.backfacesTerrain,v=new M(!1,x),R=d=>{const g=d.renderData;if(!g?.vao)return;const R=g.geometry;y(Z,R.boundingBox);const P=g.localOrigin;null!=_&&(_.localOrigin=P,_.applyToAabb(Z));const O=Z;if($[0]=i[0]-P[0],$[1]=i[1]-P[1],$[2]=i[2]-P[2],!k(O,$,n,f,m))return;const w=(e,t,i)=>{e.set(this.type,d,t,i),m=u&&null!=a.distance?a.distance:1/0},S=(n,c,d)=>{if((!x||null!=d)&&n>=0&&(T.backfacesTerrain||h(d,s)<0)&&(T.invisibleTerrain||!T.selectionMode||null==t||t(i,r,n))){if((null==l.distance||n<l.distance)&&w(l,n,d),T.isFiltered)return;2===T.store&&(null==p?(p=new A(e.ray),w(p,n,d),e.results.all.push(p)):n<p.distance&&w(p,n,d)),(null==a.distance||n<a.distance)&&w(a,n,d),0!==T.store&&(null==o.distance||n>o.distance)&&w(o,n,d)}},C=ee;c(C,r,P);const{indices:j,indexCount:E}=R,q=R.vertexAttributes,M=q.getField("position",b),G=new F(M.typedBuffer,3,q.stride/4),z=E/3;if(!_&&z>D){const e=d.renderData;null==e.intersectionData&&(e.intersectionData=new B(j,0,z,G)),e.intersectionData.intersectRay($,C,v,S)}else N($,C,0,z,j,G,_,v,S)},P=this._rootTiles;if(null!=P){(()=>{const t=this._tileIterator;t.reset(P);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==_&&!e.intersectsRay(i,s,f,m)||g&&this._useStencilForTile(e)?t.skipSubtree():R(e)})()}}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}acquireTechniques(e){const t=!!has("enable-feature:terrain-shadows")&&e.bind.shadowMap.enabled;t!==this._castShadows&&(this._castShadows=t,this._patchesByOriginDirty=!0);const i=e.bind.viewshedEnabled;if(this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),9===e.bind.slot){if(0===(e.renderOccludedMask&T))return null}else{const t=0===this.transparency?1:6;if(e.bind.slot!==t)return null}if(3===this.transparency)return null;const r=this._configuration;switch(r.screenSpaceReflections=r.cloudReflections=r.receiveShadows=r.receiveAmbientOcclusion=r.renderOccluded=r.hasHighlightMixTexture=!1,r.overlayMode=this._overlayRenderer.mode,e.output){case 0:case 1:{r.screenSpaceReflections=null!=e.bind.ssr.lastFrameColor,r.cloudReflections=null!=e.bind.clouds.data;const t=9===e.bind.slot;return r.receiveShadows=e.bind.shadowMap.ready&&!t,r.renderOccluded=t,r.receiveAmbientOcclusion=!t&&null!=e.bind.ssao,this._acquireTechnique(e.output)}case 4:case 6:return this._castShadows?this._acquireTechnique(4):null;case 7:return this._inViewshed?this._acquireTechnique(7):null;case 2:case 3:return this._acquireTechnique(e.output);case 9:return this._acquireTechnique(9);case 8:return r.hasHighlightMixTexture=null!=e.bind.highlightMixTexture,this._overlayRenderer.hasHighlights?this._acquireTechnique(8):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,this._passParameters.overlayContent=C(e.output,e.bind),e.output){case 0:case 1:this._renderMaterialPass(e,t);break;case 2:case 3:case 9:this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break;case 8:{const i=e.bind.highlight?.name;i&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(2)&&this._overlayRenderer.hasHighlight(i)&&this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break}case 4:case 6:case 7:this._renderAuxiliaryPass(e,t,this._allPatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r;if(null!=e){const i=t.toUnitRGBA(e);r=_(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll(e=>i.updateTileTexture(e,0)),this._configuration.tileBlendInput=i.backgroundIsGrid?2:null!=i.backgroundColor?1:0,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)w(i,t);e.sort((e,t)=>S(e[0],t[0])),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this.notifyChange("visibleTiles"),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i){const{rctx:r,bind:s}=e;r.bindTechnique(t,s,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;i.forEach(e=>{this._drawParameters.origin=e[0].renderData.localOrigin,t.program.bindDraw(s,this._passParameters,this._drawParameters);for(let i=0;i<e.length;i++)this._renderPatch(r,t,e[i],W.TRIANGLES,n,null===this._passParameters.overlayContent)}),r.bindVAO(null)}_renderMaterialPass(e,t){const{rctx:i,bind:r}=e;i.bindTechnique(t,r,this._passParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const s=r.camera,n=t.program;if(this._configuration.screenSizePerspective&&this.pointsOfInterest){const e=G(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:s.fovY})}const a=this._stencilEnabledLayerExtents.length>0,o=9===r.slot;o&&(n.bindTexture("tex",i.emptyTexture),n.setUniform3fv("textureOpacities",u),n.setUniform4fv("texOffsetAndScale",p));const l=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:u;1===this._configuration.tileBlendInput&&n.setUniform3fv("backgroundColor",l);const c=this.wireframe?W.LINES:W.TRIANGLES;this._configuration.textureFadingEnabled&&n.bindTexture("texNext",i.emptyTexture);const d=this._visiblePatchesByOrigin;for(const h of d.values()){const e=h[0].renderData.localOrigin;this._drawParameters.origin=e,t.program.bindDraw(r,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const r of h){const e=r.renderData,s=e.textureReference;if(null!=s){if(!o){n.setUniform4fv("texOffsetAndScale",s.offsetAndScale),n.bindTexture("tex",s.texture.texture);const t=e.textureFadeFactor,i=t<1?e.nextTextureReference:null;this._configuration.textureFadingEnabled&&i&&t<1?(n.setUniform1f("fadeFactor",t),n.setUniform4fv("nextTexOffsetAndScale",i.offsetAndScale),n.setUniform3fv("nextTexOpacities",i.opacities),n.bindTexture("texNext",i.texture.texture)):n.setUniform1f("fadeFactor",1),e.textureIsFading&&this.setNeedsRender(),n.setUniform3fv("textureOpacities",s.opacities)}this._renderPatch(i,t,r,c,a),r.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}i.bindVAO(null)}_renderPatch(e,t,i,r,s,n=!1){const a=i.renderData,o=a.vao,l=o?.indexBuffer;if(!o||null==l)return void(R&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay),s&&(t.useStencil=this._useStencilForTile(i),e.setPipelineState(t.getPipeline()));const d=a.geometry.indexCount;e.bindVAO(o),c.assertCompatibleVertexAttributeLocations(o),e.drawElements(r,d,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(V,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([o({readOnly:!0})],J.prototype,"visibleTiles",null),e([o({readOnly:!0})],J.prototype,"_isGlobal",null),e([o()],J.prototype,"renderOccludedFlags",void 0),e([o({value:!1})],J.prototype,"renderingDisabled",null),e([o({value:!0})],J.prototype,"visible",null),e([o()],J.prototype,"renderPatchBorders",null),e([o()],J.prototype,"visualizeNormals",null),e([o()],J.prototype,"cullBackFaces",null),e([o()],J.prototype,"wireframe",null),J=e([l("esri.views.3d.terrain.TerrainRenderer")],J);const K=g(),X=g(),$=g(),ee=g();export{J as TerrainRenderer};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../Color.js";import has from"../../../core/has.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import s from"../../../core/ObjectPool.js";import{watch as n,sync as a}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{d as c,i as d,e as h}from"../../../chunks/vec32.js";import{ZEROS as u,create as g,fromValues as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as f,ZEROS as p}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as m,set as y}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as b}from"../../../geometry/support/buffer/BufferView.js";import{overlayRenderOccludedFlag as T}from"./OverlayRenderer.js";import{PatchRenderData as x}from"./PatchRenderData.js";import{TerrainAttributesCache as v}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as R}from"./terrainUtils.js";import{TileRenderer as P}from"./TileRenderer.js";import{IteratorPreorder as O,sortTiles as w,compareTiles as S}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as D,ComponentIntersectionData as B}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{getOverlayContentForOutputTerrain as C}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{SyncRenderPlugin as j,ConsumesDepth as E,ConsumesNone as q}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as F}from"../webgl-engine/lib/Attribute.js";import{IntersectorResult as A}from"../webgl-engine/lib/IntersectorResult.js";import{intersectAabbInvDirBefore as k,MeshIntersectionOptions as M,intersectTriangles as N}from"../webgl-engine/lib/RayIntersections.js";import{getSettings as G}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{terrainId as z,getVerticalOffsetTerrain as U}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as I}from"../webgl-engine/materials/DrawParameters.js";import{T as L}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as V}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as H}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as W}from"../../webgl/enums.js";const Y=7,Q=10,Z=m();let J=class extends j{get visibleTiles(){return Array.from(this._visiblePatchesByOrigin.values()).flat()}get _isGlobal(){return 1===this._stage.viewingMode}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}constructor(e,t,i,n,a,o){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._ellipsoidRadius=n,this._compressionTracker=a,this.type=2,this.isGround=!0,this._passParameters=new L,this._drawParameters=new I,this._renderDataPool=new s(()=>new x),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new O,this._castShadows=!1,this._inViewshed=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=1,this.produces=new Map([[1,()=>this._produces()&&0===this.transparency],[6,()=>this._produces()&&(1===this.transparency||2===this.transparency)],[9,()=>this._produces()&&this.renderOccludedFlags===T]]),this._tileSize=256,this._configuration=new H(1===t.viewingMode),this._tileTextureCache=new r((e,t)=>o.newCache(e,t),"TileTexture"),this.tileGeometryCache=new v(o)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(n(()=>this._overlayRenderer.renderOccludedFlags,e=>{this.renderOccludedFlags=e,this.setNeedsRender()},a))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?E:q}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return this._configuration.visualizeNormals}set visualizeNormals(e){this._configuration.visualizeNormals!==e&&(this._configuration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._configuration.backfaceCullingEnabled}set cullBackFaces(e){this._configuration.backfaceCullingEnabled!==e&&(this._configuration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}get layerViewUid(){return z}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._configuration.screenSizePerspective!==e&&(this._configuration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,32)}reuseTextureFromParent(e){const t=e.parent;if(!t)return!1;const i=f(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,32===t?0:2),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[0])i.pendingUpdates&=-9;e.resetPendingUpdate(8);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=Q-Y,i=Math.max(0,Math.floor((e.level-t)/Y)*Y);if(this._isGlobal&&0===i)return u;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=1){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=1){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=1){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new P(this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&0!==this.transparency)return;const s=K,n=X;c(s,r,i),d(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,o=e.results.max,l=e.results.ground,u=0===e.options.store,g=!!e.results.ground.target,_=U(e.verticalOffset),f=e.tolerance;let p,m=u&&null!=a.distance?a.distance:1/0;const T=e.options,x=T.normalRequired||!T.backfacesTerrain,v=new M(!1,x),R=d=>{const g=d.renderData;if(!g?.vao)return;const R=g.geometry;y(Z,R.boundingBox);const P=g.localOrigin;null!=_&&(_.localOrigin=P,_.applyToAabb(Z));const O=Z;if($[0]=i[0]-P[0],$[1]=i[1]-P[1],$[2]=i[2]-P[2],!k(O,$,n,f,m))return;const w=(e,t,i)=>{e.set(this.type,d,t,i),m=u&&null!=a.distance?a.distance:1/0},S=(n,c,d)=>{if((!x||null!=d)&&n>=0&&(T.backfacesTerrain||h(d,s)<0)&&(T.invisibleTerrain||!T.selectionMode||null==t||t(i,r,n))){if((null==l.distance||n<l.distance)&&w(l,n,d),T.isFiltered)return;2===T.store&&(null==p?(p=new A(e.ray),w(p,n,d),e.results.all.push(p)):n<p.distance&&w(p,n,d)),(null==a.distance||n<a.distance)&&w(a,n,d),0!==T.store&&(null==o.distance||n>o.distance)&&w(o,n,d)}},C=ee;c(C,r,P);const{indices:j,indexCount:E}=R,q=R.vertexAttributes,M=q.getField("position",b),G=new F(M.typedBuffer,3,q.stride/4),z=E/3;if(!_&&z>D){const e=d.renderData;null==e.intersectionData&&(e.intersectionData=new B(j,0,z,G)),e.intersectionData.intersectRay($,C,v,S)}else N($,C,0,z,j,G,_,v,S)},P=this._rootTiles;if(null!=P){(()=>{const t=this._tileIterator;t.reset(P);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==_&&!e.intersectsRay(i,s,f,m)||g&&this._useStencilForTile(e)?t.skipSubtree():R(e)})()}}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}acquireTechniques(e){const t=!!has("enable-feature:terrain-shadows")&&e.bind.shadowMap.enabled;t!==this._castShadows&&(this._castShadows=t,this._patchesByOriginDirty=!0);const i=e.bind.viewshedEnabled;if(this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),9===e.bind.slot){if(0===(e.renderOccludedMask&T))return null}else{const t=0===this.transparency?1:6;if(e.bind.slot!==t)return null}if(3===this.transparency)return null;const r=this._configuration;switch(r.screenSpaceReflections=r.cloudReflections=r.receiveShadows=r.receiveAmbientOcclusion=r.renderOccluded=r.hasHighlightMixTexture=!1,r.overlayMode=this._overlayRenderer.mode,e.output){case 0:case 1:{r.screenSpaceReflections=null!=e.bind.ssr.lastFrameColor,r.cloudReflections=null!=e.bind.clouds.data;const t=9===e.bind.slot;return r.receiveShadows=e.bind.shadowMap.ready&&!t,r.renderOccluded=t,r.receiveAmbientOcclusion=!t&&null!=e.bind.ssao,this._acquireTechnique(e.output)}case 4:case 6:return this._castShadows?this._acquireTechnique(4):null;case 7:return this._inViewshed?this._acquireTechnique(7):null;case 2:case 3:return this._acquireTechnique(e.output);case 9:return this._acquireTechnique(9);case 8:return r.hasHighlightMixTexture=null!=e.bind.highlightMixTexture,this._overlayRenderer.hasHighlights?this._acquireTechnique(8):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,this._passParameters.overlayContent=C(e.output,e.bind),e.output){case 0:case 1:this._renderMaterialPass(e,t);break;case 2:case 3:case 9:this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break;case 8:{const i=e.bind.highlight?.name;i&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(2)&&this._overlayRenderer.hasHighlight(i)&&this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break}case 4:case 6:case 7:this._renderAuxiliaryPass(e,t,this._allPatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r;if(null!=e){const i=t.toUnitRGBA(e);r=_(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll(e=>i.updateTileTexture(e,0)),this._configuration.tileBlendInput=i.backgroundIsGrid?2:null!=i.backgroundColor?1:0,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)w(i,t);e.sort((e,t)=>S(e[0],t[0])),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this.notifyChange("visibleTiles"),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i){const{rctx:r,bind:s}=e;r.bindTechnique(t,s,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;i.forEach(e=>{this._drawParameters.origin=e[0].renderData.localOrigin,t.program.bindDraw(s,this._passParameters,this._drawParameters);for(let i=0;i<e.length;i++)this._renderPatch(r,t,e[i],W.TRIANGLES,n,null===this._passParameters.overlayContent)}),r.bindVAO(null)}_renderMaterialPass(e,t){const{rctx:i,bind:r}=e;i.bindTechnique(t,r,this._passParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const s=r.camera,n=t.program;if(this._configuration.screenSizePerspective&&this.pointsOfInterest){const e=G(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:s.fovY})}const a=this._stencilEnabledLayerExtents.length>0,o=9===r.slot;o&&(n.bindTexture("tex",i.emptyTexture),n.setUniform3fv("textureOpacities",u),n.setUniform4fv("texOffsetAndScale",p));const l=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:u;1===this._configuration.tileBlendInput&&n.setUniform3fv("backgroundColor",l);const c=this.wireframe?W.LINES:W.TRIANGLES;this._configuration.textureFadingEnabled&&n.bindTexture("texNext",i.emptyTexture);const d=this._visiblePatchesByOrigin;for(const h of d.values()){const e=h[0].renderData.localOrigin;this._drawParameters.origin=e,t.program.bindDraw(r,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const r of h){const e=r.renderData,s=e.textureReference;if(null!=s){if(!o){n.setUniform4fv("texOffsetAndScale",s.offsetAndScale),n.bindTexture("tex",s.texture.texture);const t=e.textureFadeFactor,i=t<1?e.nextTextureReference:null;this._configuration.textureFadingEnabled&&i&&t<1?(n.setUniform1f("fadeFactor",t),n.setUniform4fv("nextTexOffsetAndScale",i.offsetAndScale),n.setUniform3fv("nextTexOpacities",i.opacities),n.bindTexture("texNext",i.texture.texture)):n.setUniform1f("fadeFactor",1),e.textureIsFading&&this.setNeedsRender(),n.setUniform3fv("textureOpacities",s.opacities)}this._renderPatch(i,t,r,c,a),r.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}i.bindVAO(null)}_renderPatch(e,t,i,r,s,n=!1){const a=i.renderData,o=a.vao,l=o?.indexBuffer;if(!o||null==l)return void(R&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay),s&&(t.useStencil=this._useStencilForTile(i),e.setPipelineState(t.getPipeline()));const d=a.geometry.indexCount;e.bindVAO(o),c.assertCompatibleVertexAttributeLocations(o),e.drawElements(r,d,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(V,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([o({readOnly:!0})],J.prototype,"visibleTiles",null),e([o({readOnly:!0})],J.prototype,"_isGlobal",null),e([o()],J.prototype,"renderOccludedFlags",void 0),e([o({value:!1})],J.prototype,"renderingDisabled",null),e([o({value:!0})],J.prototype,"visible",null),e([o()],J.prototype,"renderPatchBorders",null),e([o()],J.prototype,"visualizeNormals",null),e([o()],J.prototype,"cullBackFaces",null),e([o()],J.prototype,"wireframe",null),J=e([l("esri.views.3d.terrain.TerrainRenderer")],J);const K=g(),X=g(),$=g(),ee=g();export{J as TerrainRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../Color.js";import{difference as i}from"../../../core/arrayUtils.js";import r from"../../../core/CollectionFlattener.js";import{toConst as s}from"../../../core/compilerUtils.js";import{EventedAccessor as a}from"../../../core/Evented.js";import"../../../core/has.js";import n from"../../../core/Logger.js";import{clamp as l}from"../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{MemCachePool as h}from"../../../core/MemCachePool.js";import d from"../../../core/ObjectPool.js";import u from"../../../core/PooledArray.js";import{throwIfAborted as p,isAbortError as c,isAborted as g}from"../../../core/promiseUtils.js";import{watch as _,syncAndInitial as m,sync as f,initial as y}from"../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as T}from"../../../core/unitUtils.js";import{property as v}from"../../../core/accessorSupport/decorators/property.js";import{subclass as w}from"../../../core/accessorSupport/decorators/subclass.js";import{i as S,c as C}from"../../../chunks/vec32.js";import{create as b}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as x}from"../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as E}from"../../../geometry/ellipsoidUtils.js";import L from"../../../geometry/SpatialReference.js";import{getProjector as P}from"../../../geometry/projection/projectors.js";import{projectPointToVector as U}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as M}from"../../../geometry/projection/projectVectorToVector.js";import{create as D,equals as R,intersection as j,intersectsSphere as B,empty as I,expand as k}from"../../../geometry/support/aaBoundingRect.js";import{create as A,copy as V}from"../../../geometry/support/frustum.js";import{isPlateCarree as q}from"../../../geometry/support/spatialReferenceUtils.js";import{j as O,c as G,a as N,k as F,e as W}from"../../../chunks/sphere.js";import{ElevationQueryTileCache as H}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as $}from"../../../layers/support/layerUtils.js";import{debugFlags as Q}from"../support/debugFlags.js";import{ElevationRange as z}from"../support/ElevationRange.js";import{ElevationUpdateEvent as Y}from"../support/ElevationUpdateEvent.js";import{toBoundingRect as X}from"../support/extentUtils.js";import{updatingProgress as K}from"../support/updatingProperties.js";import{ElevationBounds as J}from"./ElevationBounds.js";import{ElevationData as Z,sampleElevation as ee}from"./ElevationData.js";import{create as te}from"./ExtentHelper.js";import{LayerClasses as ie}from"./LayerClass.js";import{OverlayManager as re}from"./OverlayManager.js";import{PlanarPatch as se}from"./PlanarPatch.js";import{ScaleRangeQueries as ae}from"./ScaleRangeQueries.js";import{SphericalPatch as ne}from"./SphericalPatch.js";import{SplitLimits as le}from"./SplitLimits.js";import{maxRootTiles as oe,tooManyRootTilesAfterChangeError as he,tooManyRootTilesForLayerError as de,maxTileNeighborLevelDelta as ue,maxMemoryLodBias as pe}from"./TerrainConst.js";import{TerrainRenderer as ce}from"./TerrainRenderer.js";import ge from"./TerrainSurfacePerformanceInfo.js";import{weakAssert as _e,isVectorTileLayerView as me,neighborEdgeIndices as fe,internalAssert as ye,oppositeEdge as Te,isSurfaceLayerView as ve,isGroupLayerView as we,isMapTileLayerView as Se,isBlendableLayerView as Ce,isElevationLayerView as be,releaseTerrainData as xe,enableTerrainInternalChecks as Ee,oppositeCorner as Le,enableWaterproofTests as Pe,enableInternalTerrainChecks as Ue,enableTerrainWaterproofChecks as Me,neighborCornerIndices as De}from"./terrainUtils.js";import{Tile as Re,lijEquals as je}from"./Tile.js";import{printAllocations as Be}from"./TilePerLayerInfo.js";import{IteratorPreorder as Ie,IteratorPostorder as ke,compareTilesByLij as Ae,hasLoadableSiblings as Ve,sortTilesByPOI as qe}from"./tileUtils.js";import{TilingSchemeLogic as Oe}from"./TilingSchemeLogic.js";import{UpsampleInfo as Ge}from"./UpsampleInfo.js";import{isCompositeBlendMode as Ne,blendModeFromString as Fe}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{hasLayerBasedScaleVisibility as We}from"../../support/layerViewUtils.js";import{ImmediateTask as He,TaskPriority as $e,noBudget as Qe}from"../../support/Scheduler.js";import{TextureCompressionTracker as ze}from"../../support/TextureCompressionTracker.js";import{Yield as Ye}from"../../support/Yield.js";var Xe;let Ke=class extends a{static{Xe=this}get allTiles(){return s(this._allTiles)}get demResolution(){const{_allTiles:e,tilingScheme:t}=this;if(0===e.length)return{min:1,max:1};const i=T(t.spatialReference);let r=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(const a of e){const e=t.resolutionAtLevel(a.level)*i;r=Math.min(r,e),s=Math.max(s,e)}return{min:r,max:s}}constructor(e){super(e),this.terrainTextureCompressionTracker=new ze,this._iteratorPool=new d(Ie,e=>e.remove=()=>this._iteratorPool.release(e)),this._postorderIterator=new ke,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._usedMemory=null,this._performanceInfo=new ge,this._viewChanged=!1,this.heading=0,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=b(),this._eyePosSurfaceSR=b(),this._splitLimits=new le,this._frustum=A(),this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._watchUpdatingTracking=new x,this._frameTask=He,this._allTiles=new u,this._upsampleInfoPool=new d(Ge),this._shouldEmitChangeEvent=!1,this._rootTilesExtent=D(),this.updatingProgress=.5,this._maxNumUpdating=1,this.maxTextureScale=1.2,this._spatialReference=L.WebMercator,this._elevationProjectorCache=new Map,this.visibleElevationBounds=new J(1/0,-1/0),this.rootTileElevationBounds=new J(1/0,-1/0),this._projectorCache=new Map,this._radiusModifier=Math.cos(Math.PI/16/16),this._tilingSchemeSpatialReference=null,this._updatingRootTiles=!1,this._pendingTilesForElevationUpdateEvent=new Set,this._pendingTilesToUpdate=new Set,this.totalGeometryUpdates=0,this.totalTileUpdates=0,this._oneBatchPerFrameTask=!0,this._layerViewsDirty=!1,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._isWebMercator=!1,this._isWebMercatorOnPlateCarree=!1,this._enabled=!0;const t=e.view;this.overlayManager=new re({...e,surface:this}),this._isGlobal=!t.state?.isLocal,this._isGeographic=this._spatialReference?.isGeographic??!1,this._tileConstructor=this._isGlobal?ne:se,this._ellipsoid=E(t.spatialReference),this._renderer=new ce(this.overlayManager.renderer,t.stage,this._allTiles,this._ellipsoid.radius,this.terrainTextureCompressionTracker,t.resourceController.memoryController),We()||(this._scaleRangeQueries=new ae)}initialize(){const e=this.view,t=e.resourceController,i=t.memoryController;this._tileCache=new h((e,t)=>i.newCache(e,t),"terrain-tile"),this._upsampleMapCache=i.newCache("terrain-upsample",e=>e.unloadMapData()),this._elevationQueryCache=new H(i.newCache("elevation-query"));const s=this.overlayManager;this.addHandles([_(()=>s.renderer.isEmpty,()=>this._evaluateTransparency()),_(()=>this.renderer.visible,e=>this.suspended=!e),_(()=>this.heading,e=>{this._renderer.updateHeading(e),this._updateTileTextures(0)}),_(()=>({heading:e.camera?.heading,state:e.state?.mode}),({heading:e,state:t})=>{if(null==e)return;if(this.isGlobal&&this.isGeographic||this.isWebMercatorOnPlateCarree)return void(this.heading=90*Math.round(e/90)%360);const i=Math.round(e)%360,r=Math.abs(i-this.heading);(2===t||Math.min(r,360-r)>=30)&&(this.heading=i)})],"overlayManager"),this.addHandles([_(()=>this.baseOpacity,()=>{this._handleLayerViewChanges(),this._updateTileTextures(this._evaluateTransparency()?1:2)},m),_(()=>this.hasCompositeBlendMode,()=>this._updateTileTextures(this._evaluateTransparency()?1:2),m),_(()=>this.backgroundColor,(e,t)=>{e?.equals(t)||(this._handleLayerViewChanges(),this._renderer.updateTileBackground(e))},f),_(()=>this.snapLevel,()=>this._viewChanged=!0,f),_(()=>this.view.pointsOfInterest,e=>{this._renderer.pointsOfInterest=e,this._watchUpdatingTracking.removeAll(),e&&this._watchUpdatingTracking.add(()=>e.focus?.renderLocation,()=>this._allTilesSorted=!1)}),_(()=>Q.TERRAIN_TILE_TREE_SHOW_TILES,t=>{t&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then(({TerrainTileTree3DDebugger:t})=>{!this._treeDebugger&&Q.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new t({view:e}))}):t||(this._treeDebugger=o(this._treeDebugger))},y)]);const{spatialReference:a}=e;this._extentHelper=te(this.viewingMode,{layers:e.map.allLayers,layerViews:e.allLayerViews,viewSpatialReference:a});const n=new r({getCollections:()=>e.defaultsFromMap?.mapCollections?.map(({layers:e})=>e),getChildrenFunction:e=>e&&"layers"in e?e.layers:null}),l=new Oe({layers:n,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:a});this._set("tilingSchemeLogic",l),this._updateTilingScheme(),this._elevationDataRequester=t.createStreamDataRequester(0),this._mapDataRequester=t.createStreamDataRequester(1);const d=t.scheduler;this._frameTask=d.registerTask($e.TERRAIN_SURFACE,this),this.addHandles([_(()=>this._extentHelper.stencilEnabledExtents,e=>this._renderer.setStencilEnabledLayerExtents(e),y),_(()=>this.tilingSchemeLogic.tilingScheme,()=>this._updateTilingScheme(),f),_(()=>this.extent,()=>this._updateRootTiles(),y),e.on("resize",()=>this._viewChangeUpdate()),_(()=>{const t=e.state;return[this._lodBias,this.lodSnappingEnabled,e.quality,t.camera,t.contentCamera,t.fixedContentCamera]},()=>this._viewChangeUpdate(),m),_(()=>e.qualitySettings?.fadeDuration,e=>this._renderer.textureFadingEnabled=e>0,y),_(()=>e.qualitySettings?.physicallyBasedRenderingEnabled,e=>this._renderer.pbrMode=e?5:0,y),_(()=>e.qualitySettings?.tiledSurface.elevationLevelDelta,()=>this._updateAllTileGeometries()),_(()=>this._userClippingExtent,()=>this._updateClippingExtent(),f)]),this.addHandles(e.allLayerViews.on("after-changes",()=>this._layerViewsDirty=!0)),this._layerViewsDirty=!0,this._handleLayerViewChanges(),this._renderer.updateTileBackground(this.backgroundColor)}clearHandles(){this._watchUpdatingTracking?.removeAll(),this.removeAllHandles(),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear()}destroy(){this._frameTask.remove(),this._frameTask=He,this._watchUpdatingTracking?.destroy(),this._removeAllTiles(),this._set("tilingSchemeLogic",o(this.tilingSchemeLogic)),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear(),this._elevationDataRequester=null,this._mapDataRequester=null,this._set("overlayManager",o(this.overlayManager)),this._tileCache=o(this._tileCache),this._allTiles.prune(),Re.prune(),this._treeDebugger=o(this._treeDebugger),this._renderer.destroyed||this._renderer.destroy(),this._renderer=null,this._iteratorPool=o(this._iteratorPool),this._upsampleMapCache=o(this._upsampleMapCache),this._elevationQueryCache=o(this._elevationQueryCache),this._set("view",null),this._extentHelper=o(this._extentHelper),this._upsampleInfoPool=o(this._upsampleInfoPool),Be(),this._layerViews.forEach(e=>e.length=0),this._performanceInfo=null}get renderer(){return this._renderer}get frustum(){return this._frustum}get snapLevel(){if(this.lodSnappingEnabled){const{view:e,tilingScheme:t}=this,i=e.scale;if(t&&i){const r=t.levelAtScale(i)+e.qualitySettings.tiledSurface.lodBias,s=t.getMaxLod();return r<=0?null:Math.min(r,s||1/0)}}return 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._extentHelper.stencilEnabledExtents.length>0}get _userClippingExtent(){const{spatialReference:e}=this,t=this.view?.clippingArea;if(null==t||null==e)return null;const i=D(),r=X(t,i,e)?i:null,s=this._get("extent");return R(r,s)?s:r}get rootTilesExtent(){return this._rootTilesExtent}get extent(){const e=j(this.groundExtent,this._userClippingExtent,D()),t=this._get("extent");return R(e,t)?t:e}get groundExtent(){return null!=this._tilingSchemeExtent?this._tilingSchemeExtent:this._rootTilesExtent}get _tilingSchemeExtent(){return this.tilingSchemeLogic?.extent}get updating(){return this._hasPendingUpdates||(this._maxNumUpdating=1),!!((this.readyToRun||this._watchUpdatingTracking?.updating||this._asyncWorkItems>0)&&this.ready&&!this.suspended||this.overlayManager?.updating||this.terrainTextureCompressionTracker.compressing)}get readyToRun(){return(this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||!this._allTilesSorted||this._layerViewsDirty||this._scaleRangeQueries?.updating||this._frameTask.updating)&&this.ready&&!this.suspended}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 null!=this._rootTiles}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 0===this._renderer.transparency}get invisible(){return 3===this._renderer.transparency}set suspended(e){this._set("suspended",e),this._viewChangeUpdate()}get fadeDuration(){return this.view.qualitySettings.fadeDuration??0}intersect(e,t,i,r){this._renderer.intersect(e,t,i,r)}getElevationLevelDelta(e){return e<4?3:this.view.qualitySettings.tiledSurface.elevationLevelDelta}getElevation(e,t,i,r){const s=this._rootTiles;if(!s?.length||!this._enabled)return null;if(0===s[0].layerInfo[0].length)return null;let a=this._elevationProjectorCache.get(r);if(void 0===a&&(a=P(r,this._spatialReference)??null,this._elevationProjectorCache.set(r,a)),null==a)return n.getLogger(this).error("TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system"),null;const l=S(Ze,e,t,i);a(l,0,l,0);return at(s,l[0],l[1])}getElevations(e,t,i){const r=this._rootTiles,s=r?r[0].layerInfo[0].length:0;if(r?.length&&0!==s&&this._enabled)for(let a=0;a<t;++a){const t=3*a;i(a,at(r,e[t],e[t+1]))}else for(let a=0;a<t;++a)i(a,null)}getLayerIndexByUID(e,t){return this._layerIndexByUid[e].get(t)}getScale(e){if(!this.tilingScheme)return null;if(!U(e,Ze,this.spatialReference))return n.getLogger(this).error("TerrainSurface.getScale(): could not project given point to tiling scheme coordinate system"),null;const t=this._rootTiles;if(null!=t)for(const i of t)if(i?.containsPoint(Ze)){let e=i;for(;e.children[0]&&!e.rendered;){const t=e.children[0].extent;let i=0;Ze[0]>t[2]&&(i+=1),Ze[1]<t[1]&&(i+=2),e=e.children[i]}return this._getLodBiasCorrectedScale(e.level)}return 1/0}_ensureProjector(e){const t=this._projectorCache.get(e);if(t)return t;const i=P(e,this._tilingSchemeSpatialReference)??null;return this._projectorCache.set(e,i),i}getSphereElevationBounds(e,t){const i=this._ensureProjector(t);if(null==i)return n.getLogger(this).error("TerrainSurface.getSphereElevationBounds(): could not project given point to tiling scheme coordinate system"),null;O(e,et);const r=N(et);i(r,0,r,0),F(et,r);const s=new z,a=this._rootTiles;if(null!=a){const e=[];for(const i of a)e.push(i);let t=0;for(;t<e.length;){const i=e[t];if(++t,!B(i.extent,et))continue;const r=i.children;if(null==r[0]||i.rendered)s.expandElevationRangeValues(i.elevationBoundsMin,i.elevationBoundsMax);else for(const t of r)e.push(t)}}return s}getRootElevationBounds(){return new z(this.rootTileElevationBounds.min,this.rootTileElevationBounds.max)}getLowerBoundRadius(){const e=(this._ellipsoid.radius+this.visibleElevationBounds.min)*this._radiusModifier;return Math.min(e,this._ellipsoid.radius)}getSphereScale(e,t){if(!this.tilingScheme)return null;if(!U(e,pt,this.spatialReference))return n.getLogger(this).error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;W(et,pt,t);let i=null;const r=e=>{if(e&&B(e.extent,et)){const t=e.children;if(t[0]&&!e.rendered)for(const e of t)r(e);else{const t=this._getLodBiasCorrectedScale(e.level);i=null==i?t:Math.min(i,t)}}},s=this._rootTiles;if(null!=s)for(const a of s)r(a);return i}queryVisibleScaleRange(e,t,i,r){if(!this._scaleRangeQueries)return;const s=t?this.tilingScheme.levelAtScale(t):0,a=i?this.tilingScheme.levelAtScale(i):1/0,n=this._lodBias;this._scaleRangeQueries.queryVisibleLevelRange(e,s+n,a+n,r)}_evaluateTransparency(){const e=this.baseOpacity,t=this.overlayManager.renderer.isEmpty,i=this._renderer.transparency,r=this._isFullyTransparent?t?3:2:e>=1&&!this.hasCompositeBlendMode&&!this._renderer.slicePlaneEnabled?0:1;return this._renderer.transparency=r,i!==r}_updateTilingScheme(){const e=this.tilingSchemeLogic.tilingScheme;if(!(e!==this.tilingScheme))return;_e(!!e,"tiling scheme cannot be reset to undefined"),this._isGlobal=!this.view?.state?.isLocal,this.tilingScheme&&this._removeAllTiles();const t=e?.spatialReference??L.WebMercator;this._spatialReference=t,this._isWebMercator=!!t?.isWebMercator,this._isWebMercatorOnPlateCarree=this._isWebMercator&&q(this.view?.renderSpatialReference),this._isGeographic=t?.isGeographic??!1,this._set("tilingScheme",e),this._tilingSchemeSpatialReference=this.tilingScheme?.spatialReference,this._projectorCache.clear(),this._updateClippingExtent(),e&&(this._updateTiledLayers(),this._renderer.tileSize=e.pixelSize,this.overlayManager.spatialReference=e.spatialReference,this._updateRootTiles())}static{this._tileMemcacheKey="TerrainTileMemcache"}_acquireTile(e,t,i,r){const s=this._tileCache.pop(Xe._tileMemcacheKey);return s?(s.init(e,t,i,r,this),s):new this._tileConstructor(e,t,i,r,this)}get updatingRootTiles(){return this._updatingRootTiles}_updateRootTiles(){const{extent:e,tilingScheme:t}=this;if(!t)return;const r=tt;let s=t.rootTilesInExtent(e,r,5*oe);if(null!=this._rootTiles){if(s.length>oe)return void n.getLogger(this).warn(he);const e=this._rootTiles.map(e=>e.lij),t=i(e,s,je);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){const e=this._rootTiles.filter(e=>!(t.removed.findIndex(t=>je(t,e.lij))>-1)||(this._purgeTile(e),!1));t.added.forEach(t=>e.push(this._newRootTile(t))),this._setRootTiles(e)}}else this._updatingRootTiles=!0,s.length>oe&&(n.getLogger(this).warn(de),s=t.rootTilesInExtent(e,r,oe)),this._setRootTiles(s.map(e=>this._newRootTile(e)));R(r,this._rootTilesExtent)||(this._rootTilesExtent=D(r)),this.renderer.visible=!0,this._viewChangeUpdate(),this.overlayManager.setPlacementDirty(),this.notifyChange("ready"),this._updateAllTileGeometries(),this._updatingRootTiles=!1,this.checkAllTilesWaterproofness()}_updateAllTileGeometries(){const e=this._allTiles.filter(e=>e.loaded&&e.intersectsClippingArea);e.sort(Ae),e.forEach(e=>this._renderer.updateTileGeometryState(e)),e.forEach(e=>e.renderData.updateNeighborData()),this._updateTilesGeometries(e),this._pendingTilesToUpdate.clear()}_updateTilesGeometries(e){if(0===e.length)return;e.sort(Ae);const t=this.renderer;e.forEach(e=>t.updateGeometryIfNeeded(e)),e.forEach(e=>this._pendingTilesForElevationUpdateEvent.add(e))}_shouldSplit(e){return 1===e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.snapLevel)}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return this._shouldSplit(t)&&t.setPendingUpdate(1),this._loadTile(t),this._markTileToUpdate(t),this._updateRootTileElevationBounds(),t}_setRootTiles(e){if(this._rootTiles=e,this._allTiles.clear(),null!=e){const 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.suspended&&this.tilingScheme&&this.renderer.visible&&(this._inFrameTask?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateTilesVisibility(this._rootTiles)))}_updateClippingStatus(e){e.updateClippingStatus(this.extent)&&e.resetPendingUpdate(8)&&this._updateTileGeometryState(e)}_updateTilesVisibility(e){if(null==e)return;const t=Ve(e),i=this.visibleElevationBounds;let r=t?i.min:1/0,s=t?i.max:-1/0;const a=this.extent,n=this.view.state.contentCamera.viewProjectionMatrix;this.setTileTreeDirty();const l=this._iteratorPool.acquire();for(l.reset(e);!l.done;){const e=l.next();e.updateClippingStatus(a)&&e.resetPendingUpdate(8)&&this._updateTileGeometryState(e),e.computeVisibility(),e.updateScreenDepth(n),e.renderData&&(r=Math.min(e.elevationBoundsMin,r),s=Math.max(e.elevationBoundsMax,s))}l.remove(),this._viewChanged=!0,this._allTilesDirty=!0,this._updatePendingTileGeometries(),isFinite(r)&&isFinite(s)&&(i.min!==r||i.max!==s)&&(this.visibleElevationBounds=new J(r,s))}_updateRootTileElevationBounds(){let e=1/0,t=-1/0;const i=this._rootTiles;null!=i&&i.forEach(({elevationBoundsMin:i,elevationBoundsMax:r})=>{e=Math.min(e,i),t=Math.max(t,r)});const r=this.rootTileElevationBounds;r.min===e&&r.max===t||(this.rootTileElevationBounds=new J(e,t))}_updateViewDependentParameters(){const{camera:e,contentCamera:t}=this.view.state,i=Math.tan(.5*t.fovX),r=Math.tan(.5*t.fovY),s=this.tilingScheme.pixelSize,a=2**-this._lodBias*e.pixelRatio;this._splitLimits.aboveGround=e.aboveGround,this._splitLimits.fovX=i,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=s/e.width*this.maxTextureScale*a,this._splitLimits.relativeHeightLimit=s/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=V(this._splitLimits.frustum??A(),t.frustum):this._splitLimits.frustum=null,V(this._frustum,e.frustum),C(this._eyePosRenderSR,t.eye),M(e.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateTileGeometryState(e){e.updateVisibility();this._renderer.updateTileGeometryState(e)&&this._markTileToUpdate(e),this.setMemoryDirty()}_markAllTileNeighborsForUpdate(e){e.forEachLoadedNeighbor(e=>{this._layerViews[1].some(me)&&e.setPendingUpdate(32),this._pendingTilesToUpdate.add(e)})}_updateTileTexture(e,t){const i=e.resetPendingUpdate(32)?32:!!e.resetPendingUpdate(16)&&16;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=null,t.madeProgress())}_emitElevationUpdateEventForTiles(){if(!this._shouldEmitChangeEvent)return;const e=rt.extent;I(e),this._pendingTilesForElevationUpdateEvent.forEach(t=>k(e,t.extent,e)),this._pendingTilesForElevationUpdateEvent.clear(),rt.spatialReference=this.spatialReference,this.emit("elevation-change",rt),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);const t=!this.view.state.fixedContentCamera;if(this._mergeAndSplit(e,t),this._updateElevation(e),this._updateTextures(e),t||this._mergeAndSplit(e,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty(),this._updatePendingTileGeometries(),this._emitElevationUpdateEventForTiles(),e.done&&e.hasProgressed&&this.requestUpdate(),this.notifyChange("updatingProgressValue"),Ee&&this._checkTileInvariant(),!e.hasProgressed)return Ye}_checkTileInvariant(){const e=new Map;this._allTiles.forAll(t=>e.set(t,new Set)),this._allTiles.forAll(t=>{if(_e(t.rendered===t.leaf,` rendered ${t.rendered} != ${t.leaf} leaf`),!t.leaf){const e=e=>0===e.unmergableChildCount&&0===e.maxLevelDeltaNeighborCount,i=t.children.reduce((t,i)=>t+(e(i)?0:1),0);if(_e(t.unmergableChildCount===i,` Tile[${t.lij.toString()}] unmergeable child count mismatch: actual ${t.unmergableChildCount} vs ${i}`),t.hasPendingUpdate(4)){_e(!t.hasPendingUpdate(1),"Tile can be both split and merge at the same time");for(const e of t.children)_e(e.leaf||e.hasPendingUpdate(4),"Child of tile to merge must also merge")}}for(let i=0;i<4;++i){if(t.rendered){const e=t.renderData?.geometryState.edgePeerNeighbors[i];if(null!=e){{const r=t.level-e.level<=ue;r||(console.log(`tile level delta [${t.lij.toString()}] vs [${e.lij.toString()}] > ${ue} (edge[${i}])`),_e(r,`tile level delta [${t.level}] vs [${e.level}] > ${ue}`))}_e(t.level-e.level<=ue,`Max tile lod delta exceeded: [${t.lij.toString()}] vs [${e.lij.toString()}]`)}}const r=t.level-ue,s=e=>e.leaf||e.level===t.level,a=t.findNeighborTile(fe[i],s);if(null!=a){if(t.leaf&&t.level>=ue){let i=a;for(;t.level-i.level<ue;)i=i.parent;const s=[r,t.lij[1]>>ue,t.lij[2]>>ue];if(!je(s,i.lij)){const r=e.get(i);_e(!r.has(t),"Cannot already have neighbor"),r.add(t)}}_e(a.rendered||a.level===t.level,"Non-same-level-neighbor of rendered must be rendered"),_e(t.level-a.level<=ue,`Tile level delta [${t.level}] vs [${a.level}] > ${ue}`)}}}),this._allTiles.forAll(t=>{const i=t.maxLevelDeltaNeighborCount,r=e.get(t);_e(i===r.size,`Tile[${t.lij.toString()}] merge-blocker mismatch: actual ${i} vs ${r.size}`)})}_updateAllTilesStatus(e){if(!this._viewChanged||!this._rootTiles||e.done)return;this._viewChanged=!1;const t=new nt(this._allTiles.length);t.pushAll(this._rootTiles);const i=this.snapLevel,r=this._splitLimits,s=this._eyePosRenderSR;this._allTiles.forAll(e=>{e.maxLevelDeltaNeighborCount=0,e.unmergableChildCount=0});const a=this.view.state.contentCamera.viewProjectionMatrix;for(;!t.empty;){const e=t.pop(),n=e.parent,l=null!=n&&n.hasPendingUpdate(4),o=l?4:e.shouldSplit(r,s,i),h=1===o;e.leaf?lt(e,h):t.pushAll(e.children),l?(e.resetPendingUpdate(1),e.leaf||e.setPendingUpdate(4),this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(a)):h?(e.resetPendingUpdate(4),e.leaf&&e.setPendingUpdate(1)):(e.resetPendingUpdate(1)&&e.updateAgentSuspension(),2===o&&e.updateAgents(0),e.leaf||(e.setPendingUpdate(4),e.resetPendingUpdate(1)))}this.requestUpdate(),(this._shortBatches||!this._oneBatchPerFrameTask)&&this._updatePendingTileGeometries(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||!this.view.pointsOfInterest?.focus||(qe(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger?.update(),e.madeProgress())}_markTileToUpdate(e){ye(e.loaded),e.intersectsClippingArea&&(this._pendingTilesToUpdate.add(e),this._markAllTileNeighborsForUpdate(e))}_updatePendingTileGeometries(){const e=this._pendingTilesToUpdate,t=Array.from(e.keys()).filter(e=>e.loaded&&e.intersectsClippingArea);if(0===t.length)return void e.clear();const i=(i,r)=>{!r?.loaded||!r.intersectsClippingArea||r.level<i.level||e.has(r)||(e.add(r),t.push(r),r.renderData.updateNeighborData())};t.sort(Ae);const r=t.length;for(let s=0;s<r;++s){const r=t[s];ye(r.loaded),ye(r.intersectsClippingArea);const a=r.renderData;a.updateNeighborData();const n=a.dirtyEdgeResolutions,l=a.geometryState,o=e=>{const t=De[e];i(r,l.cornerPeerNeighbors[e]?.findCorner(Le(t),e=>e.loaded))};for(let t=0;t<4;++t)if(n&1<<t){const s=a.geometryState.edgePeerNeighbors[t];s&&s?.level>=r.level&&s.forAllSubtreeOnSide(Te(fe[t]),t=>!(!t.loaded||!t.intersectsClippingArea)&&(ye(e.has(t)||Ae(r,t)<0),i(r,t),!0)),o((t+1)%4),o(t)}}e.clear(),this._updateTilesGeometries(t),this._shouldEmitChangeEvent=!0,Ee&&Pe&&this.checkAllTilesWaterproofness()}_mergeAndSplit(e,t){if(this.suspended||e.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate();let i=!1;const r=this.view.state.fixedContentCamera;let s=!1;for(;!e.done;){s=!0;let a=!1;const n=!this._allTiles.some(s=>{if(!i&&!r&&!s.visible)return e.done;let n=s;if(s.hasPendingUpdate(4)){if(!t||s.unmergableChildCount>0)return e.done;for(s.resetPendingUpdate(4);null!=n.parent&&0===n.parent.unmergableChildCount&&n.parent.resetPendingUpdate(4);)n=n.parent;this._mergeTile(n),a=!0,e.madeProgress()}else if(s.resetPendingUpdate(1)){let t=!0;const i=s.level;if(i>=ue){const e=e=>e.leaf||i-e.level<ue;for(let r=0;r<4;++r){const a=s.findNeighborTile(fe[r],e);null!=a&&i-a.level===ue&&(t=!1,Ee&&(ye(a.leaf),ye(a.hasPendingUpdate(1))))}}t?(this._splitTile(s),e.madeProgress(),a=!0):s.setPendingUpdate(1)}return e.done});if(a&&(this._allTilesSorted=!1,this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries()),n){if(!i){i=!0;continue}if(!a)break}else this._allTilesDirty=!0}s?e.madeProgress():this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries(),this._sortTiles(e)}_updateElevation(e){e.done||(this._allTiles.some(t=>(t.resetPendingUpdate(8)&&(this._updateTileGeometryState(t),this._shortBatches&&this._updatePendingTileGeometries(),e.madeProgress()),e.done)),!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries())}_updateTextures(e){e.done||this._allTiles.some(t=>(this._updateTileTexture(t,e),e.done))}_updateClippingExtent(){this.spatialReference&&(this.overlayManager?.updateOverlayParameters(1),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get _lodBias(){const e=this.view.quality;return this.view.qualitySettings.tiledSurface.lodBias-(1-e)*pe}_getLodBiasCorrectedScale(e){const t=this.tilingScheme.levels,i=l(e-this._lodBias,0,t.length-1),r=i-Math.floor(i);return t[Math.floor(i)].scale*(1-r)+t[Math.ceil(i)].scale*r}_removeAllTiles(){null!=this._rootTiles&&(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){const 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?ht(e):this._purgeSubtree(e),this._allTiles.removeUnordered(e),this._unloadTile(e),e.dispose(),this._tileCache.put(Xe._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){_e(e.leaf,"Tile that is already split should not be split again!"),_e(e.rendered,"Tile marked to split is not rendered"),ht(e);const t=e.createChildren();this._allTiles.pushArray(t),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles}),e.updateAgentSuspension(),_e(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=>lt(e,e.hasPendingUpdate(1))),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){st.spatialReference=this.spatialReference,st.extent=e.extent,st.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",st)}createTile(e,t,i,r){_e(!!r,"createTile sanity check");const s=this._acquireTile(e,t,i,r);return s.updateClippingStatus(this.extent),s.updateScreenDepth(this.view.state.contentCamera.viewProjectionMatrix),this._shouldSplit(s)&&s.setPendingUpdate(1),s}get _shortBatches(){return 2!==this.view.state.mode}_mergeTile(e){_e(!e.hasPendingUpdate(1),"_mergeTile sanity check"),_e(!e.leaf,"Cannot merge a leaf"),e.leaf||(this._purgeSubtree(e),_e(!e.renderData,"Merging tile with existing render data?"),this._loadTile(e),this._markTileToUpdate(e),this._emitTileScaleChange(e),this._shortBatches&&this._updatePendingTileGeometries(),lt(e,!1),this._allTilesDirty=!0,++this._performanceInfo.numMerged)}_loadTile(e){e.load(),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager?.hasOverlays&&this.overlayManager.updateTileOverlayParameters(e)}_handleLayerViewChanges(e=Qe){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let t=!1;const i=new Set;let r=-1;for(let s=this.view.allLayerViews.length-1;s>=0;s--){const e=this.view.allLayerViews.items[s];if(i.add(e.uid),ve(e)||we(e))if(this._basemapLayerViewHandles.has(e.uid)&&!we(e)){const i=this._layerClassFromLayerView(e),s=this.getLayerIndexByUID(i,e.uid);null!=s&&((s<r||null==r)&&(t=!0),r=s)}else this._registerTiledLayerView(e),e.layer.loaded&&(t=!0)}this._basemapLayerViewHandles.forEach((e,r)=>{i.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(const e of this.view.allLayerViews.items)if(Se(e)&&!$(e.layer)&&0!==e.fullOpacity)return!1;return!0}_hasCompositeBlendMode(){for(const e of this.view.allLayerViews.items)if((Ce(e)||we(e))&&Ne(Fe[e.layer.blendMode]))return!0;return!1}_layerClassFromLayerView(e){return be(e)?0:1}_registerTiledLayerView(e){const t=[];if((Ce(e)||we(e))&&t.push(_(()=>e.layer.blendMode,()=>{this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._updateTileTextures(2)})),!we(e)){const i=this._layerClassFromLayerView(e);t.push(_(()=>!e.destroyed&&e.suspended,()=>this._updateTiledLayers())),t.push(_(()=>!e.destroyed&&e.fullOpacity,()=>this._updateTileTextures(2)));const{layer:r}=e;"effectiveScaleRange"in r&&t.push(_(()=>!e.destroyed&&r.effectiveScaleRange,()=>this._restartAllAgents(i))),t.push(e.on("data-changed",()=>{const t=this.getLayerIndexByUID(i,e.uid);null!=t&&this._invalidateLayerData(t,i)}))}this._unregisterTiledLayerView(e.uid),this._basemapLayerViewHandles.set(e.uid,t)}_unregisterTiledLayerView(e){const t=this._basemapLayerViewHandles.get(e);if(t){for(const e of t)e.remove();this._basemapLayerViewHandles.delete(e)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;const e=this.view.allLayerViews,t=[[],[]];let i=null;e.forEach(e=>{if(!e.layer||e.suspended||!ve(e)||!e.fullExtent)return;const r=this._layerClassFromLayerView(e);if(1===r){const t=e.displayLevelRange.maxLevel;t!==1/0&&(null===i||t>i)&&(i=t)}t[r].push(e)});for(const r of ie){const e=this._layerViews[r],i=t[r];i.reverse();const s=i.length;let a=e.length!==s;const n=new Array(s),l=new Array(e.length);this._layerIndexByUid[r].clear();for(let t=0;t<s;t++){const s=i[t].uid;this._layerIndexByUid[r].set(s,t);const o=e.indexOf(i[t]);n[t]=o,t!==o&&(a=!0),o>-1&&(l[o]=t)}if(a){const e=this._postorderIterator;for(e.reset(this._rootTiles);!e.done;)e.next().modifyLayers(l,n,r);this._layerViews[r]=i,this._restartAllAgents(r),this._updateTilesVisibility(this._rootTiles)}}this.tilingScheme.ensureMaxLod(i)&&(this._viewChangeUpdate(),this.notifyChange("tilingScheme"))}_restartAllAgents(e){const t=this._postorderIterator;for(t.reset(this._rootTiles);!t.done;){const i=t.next();i.restartAgents(e),0===e&&i.computeElevationBounds()}this._updateRootTileElevationBounds()}layerViewByIndex(e,t){return this._layerViews[t][e]}numLayers(e){return this._layerViews[e].length}_updateTileTextures(e){this._allTiles.forAll(t=>{t.updateAgents(1),1===e?this.renderer.updateTileTexture(t,16):t.updateRenderData(1,e)}),this._evaluateTransparency()}_invalidateLayerData(e,t){this._allTiles.forAll(i=>i.removeLayerAgent(e,t)),this._allTiles.forAll(i=>i.invalidateLayerData(e,t))}setTileTreeDirty(){this._allTilesDirty=!0}requestRender(e=1){this.renderer.setNeedsRender(e)}requestUpdate(){1===++this._pendingUpdates&&(this._hasPendingUpdates=!0)}requestTileData(e,t,i,r){const s=this.layerViewByIndex(t,i),a=s.layer;return!a.tilemapCache||me(s)?this._requestTileData(e,i,s,r):(++this._asyncWorkItems,a.tilemapCache.fetchAvailability(e.level,e.lij[1],e.lij[2],{...r,timeout:6e3}).then(()=>--this._asyncWorkItems).catch(t=>{throw--this._asyncWorkItems,p(r),c(t)||this._dataMissing(e,i,s),t}).then(()=>this._frameTask.schedule(()=>this._requestTileData(e,i,s,r),r.signal)))}_requestTileData(e,t,i,r){if(this.destroying)return Promise.resolve();const s=0===t;return r.requester??=s?this._elevationDataRequester:this._mapDataRequester,s?be(i)?this._requestElevationTileData(e,i,r):Promise.reject():Se(i)?this._requestMapTileData(e,i,r):Promise.reject()}_requestElevationTileData(e,t,i){++this._asyncWorkItems;const r=r=>{!g(i)&&r&&(this.setMemoryDirty(),this.requestUpdate(),this._elevationDataArrived(e,t,r))},s=i=>{c(i)||(n.getLogger(this).error(`Tile ${e.lij.toString()} layer 0/${t.uid} error ${i}`),this._dataMissing(e,0,t),this.requestUpdate())};return t.fetchElevationTile(e,i).then(e=>this._frameTask.schedule(()=>r(e)),s).finally(()=>--this._asyncWorkItems)}_elevationDataArrived(e,t,i){const r=this._layerIndexByUid[0].get(t.uid);if(null==r)return void n.getLogger(this).warn("TerrainSurface: received data from unknown layer %d %s",0,e.lij.toString());const s=new Z(e.lij,e.extent,i);e.dataArrived(r,0,s),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:0});const a=[e],l=e.level,o=this._iteratorPool.acquire();for(o.reset(a);!o.done;){const e=o.next();e.findElevationBoundsForLayer(r,l),e.computeElevationBounds()}0===l&&this._updateRootTileElevationBounds(),o.remove(),this._updateTilesVisibility(a)}_requestMapTileData(e,t,i){++this._asyncWorkItems;const r=(r,s)=>{xe(s),g(i)||(console.error(`Tile ${e.lij.toString()} layer 1/${t.uid} error ${r}`),this._dataMissing(e,1,t),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule(()=>{this.requestUpdate(),g(i)?xe(r):this._mapTileDataArrived(e,t,r)},i.signal,s(r)).catch(s(r)),n=(e,t=null)=>this._frameTask.schedule(()=>r(e,t));return t.fetchTile(e.lij,i).then(a,n).finally(()=>--this._asyncWorkItems)}_mapTileDataArrived(e,t,i){const r=this.getLayerIndexByUID(1,t.uid);if(null==r)return xe(i),void n.getLogger(this).warn("TerrainSurface: received data from unknown layer");e.dataArrived(r,1,i),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:1})}_dataMissing(e,t,i){const r=this.getLayerIndexByUID(t,i.uid);null!=r?(e.dataMissing(r,t),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:t})):n.getLogger(this).warn("TerrainSurface: received data from unknown layer")}get performanceInfo(){const 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++;const i=t.level;t.renderData&&(e.numLoadedPerLevel[i]=(e.numLoadedPerLevel[i]||0)+1),t.visible&&(e.numVisible++,t.rendered&&(e.numRenderedPerLevel[i]=(e.numRenderedPerLevel[i]||0)+1,e.numRendered++))}),e}setMemoryDirty(){this._usedMemory=null}get usedMemory(){return this.tilingScheme?(null==this._usedMemory&&(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;const i=this._layerClassFromLayerView(e),r=this.getLayerIndexByUID(i,e.uid);return null!=r&&this._allTiles.forAll(e=>t+=e.getUsedMemoryForLayer(i,r)),t}get renderPatchBorders(){return this._renderer.renderPatchBorders}set renderPatchBorders(e){this._renderer.renderPatchBorders=e}get visualizeNormals(){return this._renderer.visualizeNormals}set visualizeNormals(e){this._renderer.visualizeNormals=e}get renderingDisabled(){return this._renderer.renderingDisabled}set renderingDisabled(e){this._renderer.renderingDisabled=e}get test(){}checkAllTilesWaterproofness(){if(!Pe)return;const e=this._rootTiles;if(null==e)return;const t=e=>e?.renderData?.geometry?.indices?.length>0,i=(e,i)=>{t(e)&&console.error("Tile[",e.lij,"] has geometry although parent[",i.lij,"] has geom")},r=e=>{if(e.intersectsClippingArea)if(e.renderData&&!e.renderData.geometryState&&console.error("Tile[",e.lij,"] has renderData but not geometryState"),e.renderData&&!e.renderData.geometry&&console.error("Tile[",e.lij,"] has renderData but not geometryInfo"),!e.renderData?.geometry||(e.renderData.geometry.indices?.length??0)>0||console.error("Tile[",e.lij,"] has renderData but no indices - geometryInfo: ",e.renderData.geometry),t(e)){e.checkGeometryWaterproofness();for(const t of e.children)i(t,e)}else if(e.leaf)console.error("Tile[",e.lij,"] has no geometry and no children, from root to leaf");else for(const t of e.children)r(t)},s=e=>{const t=e.parent?.visible??!0,i=e.visible;e.computeVisibility();const r=e.visible;if(i!==r&&t&&console.error(" Tile[",e.lij,"] has out of date visibility: ",i," instead of ",r),!e.leaf)for(const a of e.children)s(a)};for(const a of e)r(a),s(a)}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&&0===e[2]}lijEastEnd(e){return 1<<e+(this._isGeographic?1:0)}wrapEastWest(e){const t=this.lijEastEnd(e[0]),i=e[2];if(0<=i&&i<t)return e;if(!this._isGlobal)return null;const r=(i+(i<0?t:0))%t;return[e[0],e[1],r]}enableInternalChecks(e){Ue(e)}enableWaterproofnessChecks(e){Me(e)}static cleanupTerrainSurface(){it.prune()}enable(e){e!==this._enabled&&(e?(this._updateRootTiles(),this.suspended=!1):(this.suspended=!0,this._removeAllTiles(),this._setRootTiles(null)),this._enabled=e)}};e([v()],Ke.prototype,"_renderer",void 0),e([v({constructOnly:!0})],Ke.prototype,"_scaleRangeQueries",void 0),e([v({constructOnly:!0})],Ke.prototype,"view",void 0),e([v({constructOnly:!0})],Ke.prototype,"overlayManager",void 0),e([v({constructOnly:!0})],Ke.prototype,"terrainTextureCompressionTracker",void 0),e([v()],Ke.prototype,"_hasPendingUpdates",void 0),e([v()],Ke.prototype,"_asyncWorkItems",void 0),e([v()],Ke.prototype,"_allTilesDirty",void 0),e([v()],Ke.prototype,"_allTilesSorted",void 0),e([v()],Ke.prototype,"_viewChanged",void 0),e([v({type:Number})],Ke.prototype,"heading",void 0),e([v()],Ke.prototype,"_splitLimits",void 0),e([v({readOnly:!0})],Ke.prototype,"_watchUpdatingTracking",void 0),e([v()],Ke.prototype,"_frameTask",void 0),e([v()],Ke.prototype,"demResolution",null),e([v({readOnly:!0})],Ke.prototype,"snapLevel",null),e([v({readOnly:!0})],Ke.prototype,"lodSnappingEnabled",null),e([v()],Ke.prototype,"_userClippingExtent",null),e([v()],Ke.prototype,"_rootTilesExtent",void 0),e([v({readOnly:!0})],Ke.prototype,"extent",null),e([v({readOnly:!0})],Ke.prototype,"groundExtent",null),e([v({readOnly:!0})],Ke.prototype,"_tilingSchemeExtent",null),e([v({readOnly:!0})],Ke.prototype,"updating",null),e([v({readOnly:!0})],Ke.prototype,"readyToRun",null),e([v(K)],Ke.prototype,"updatingProgress",void 0),e([v({readOnly:!0})],Ke.prototype,"updatingProgressValue",null),e([v()],Ke.prototype,"_maxNumUpdating",void 0),e([v()],Ke.prototype,"baseOpacity",null),e([v()],Ke.prototype,"hasCompositeBlendMode",void 0),e([v({readOnly:!0})],Ke.prototype,"viewingMode",null),e([v()],Ke.prototype,"maxTextureScale",void 0),e([v({readOnly:!0})],Ke.prototype,"ready",null),e([v({readOnly:!0})],Ke.prototype,"rootTiles",null),e([v()],Ke.prototype,"_rootTiles",void 0),e([v({readOnly:!0})],Ke.prototype,"spatialReference",null),e([v({type:t})],Ke.prototype,"backgroundColor",null),e([v({value:!1})],Ke.prototype,"slicePlaneEnabled",null),e([v({readOnly:!0})],Ke.prototype,"tilingScheme",void 0),e([v({readOnly:!0})],Ke.prototype,"tilingSchemeLocked",null),e([v({readOnly:!0})],Ke.prototype,"tilingSchemeLogic",void 0),e([v()],Ke.prototype,"wireframe",null),e([v({value:!1})],Ke.prototype,"suspended",null),e([v()],Ke.prototype,"fadeDuration",null),e([v()],Ke.prototype,"visibleElevationBounds",void 0),e([v()],Ke.prototype,"rootTileElevationBounds",void 0),e([v()],Ke.prototype,"_layerViewsDirty",void 0),e([v()],Ke.prototype,"renderPatchBorders",null),e([v()],Ke.prototype,"visualizeNormals",null),e([v()],Ke.prototype,"renderingDisabled",null),Ke=Xe=e([w("esri.views.3d.terrain.TerrainSurface")],Ke);const Je=Ke,Ze=b(),et=G(),tt=D(),it=new u,rt=new Y("ground"),st={spatialReference:null,extent:null,scale:0};function at(e,t,i){for(const r of e){if(!r.containsPointXY(t,i))continue;let e=r;for(;e&&!e.renderData;){const r=(t>e.extentMidX?1:0)+(i<e.extentMidY?2:0);e=e.children[r]}const s=e?.renderData?.geometryState.samplerData??null;return ee(t,i,s)}return null}class nt{constructor(e){this.capacity=e,this._head=0,this._tail=0,this._data=new Array(e)}push(e){const t=this._tail;if(!(t<this.capacity))throw new Error("Queue full");this._data[t]=e,this._tail=t+1}pushAll(e){const t=e.length;if(0===t)return;const i=this._tail;if(!(i+t<=this.capacity))throw new Error("Queue full");for(let r=0;r<t;++r)this._data[i+r]=e[r];this._tail=i+t}pop(){const e=this._head;if(e<this._tail){const t=this._data[e];return this._head=e+1,t}}get empty(){return this._head>=this._tail}get full(){return this._tail>=this._data.length}}function lt(e,t){!e.leaf||e.level<ue||ut(e,e=>{t&&ot(e);const i=dt(e);if(e.maxLevelDeltaNeighborCount++,i){let t=e.parent;for(;t;){const e=dt(t);if(t.unmergableChildCount++,!e)break;t=t.parent}}})}function ot(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<ue||ut(e,e=>{ot(e)})}function ht(e){e.level<ue||ut(e,e=>{if(e.maxLevelDeltaNeighborCount--,0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount){let t=e.parent;for(;t&&(t.unmergableChildCount--,dt(t));)t=t.parent}})}function dt(e){return 0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount}function ut(e,t){if(e.level<ue)return;const i=e.level-ue,r=e.lij[1]>>ue,s=e.lij[2]>>ue,a=e=>e.leaf||e.level===i;for(let n=0;n<4;++n){const l=e.findNeighborTile(fe[n],a);if(!l||l.level!==i)continue;const o=l.lij;o[1]===r&&o[2]===s||t(l)}}const pt=b();export{Je as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../Color.js";import{difference as i}from"../../../core/arrayUtils.js";import r from"../../../core/CollectionFlattener.js";import{toConst as s}from"../../../core/compilerUtils.js";import{EventedAccessor as a}from"../../../core/Evented.js";import"../../../core/has.js";import n from"../../../core/Logger.js";import{clamp as l}from"../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{MemCachePool as h}from"../../../core/MemCachePool.js";import d from"../../../core/ObjectPool.js";import u from"../../../core/PooledArray.js";import{throwIfAborted as p,isAbortError as c,isAborted as g}from"../../../core/promiseUtils.js";import{watch as _,syncAndInitial as m,sync as f,initial as y}from"../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as T}from"../../../core/unitUtils.js";import{property as v}from"../../../core/accessorSupport/decorators/property.js";import{subclass as w}from"../../../core/accessorSupport/decorators/subclass.js";import{q as S,i as C,c as b}from"../../../chunks/vec32.js";import{create as x}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as E}from"../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as L}from"../../../geometry/ellipsoidUtils.js";import P from"../../../geometry/SpatialReference.js";import{getProjector as U}from"../../../geometry/projection/projectors.js";import{projectPointToVector as M}from"../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as D}from"../../../geometry/projection/projectVectorToVector.js";import{create as R,equals as j,intersection as B,intersectsSphere as I,empty as k,expand as A}from"../../../geometry/support/aaBoundingRect.js";import{create as V,copy as q}from"../../../geometry/support/frustum.js";import{isPlateCarree as O}from"../../../geometry/support/spatialReferenceUtils.js";import{j as G,c as N,k as F,l as W,e as H}from"../../../chunks/sphere.js";import{ElevationQueryTileCache as $}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as Q}from"../../../layers/support/layerUtils.js";import{debugFlags as z}from"../support/debugFlags.js";import{ElevationRange as Y}from"../support/ElevationRange.js";import{ElevationUpdateEvent as X}from"../support/ElevationUpdateEvent.js";import{toBoundingRect as K}from"../support/extentUtils.js";import{updatingProgress as J}from"../support/updatingProperties.js";import{ElevationBounds as Z}from"./ElevationBounds.js";import{ElevationData as ee,sampleElevation as te}from"./ElevationData.js";import{create as ie}from"./ExtentHelper.js";import{LayerClasses as re}from"./LayerClass.js";import{OverlayManager as se}from"./OverlayManager.js";import{PlanarPatch as ae}from"./PlanarPatch.js";import{ScaleRangeQueries as ne}from"./ScaleRangeQueries.js";import{SphericalPatch as le}from"./SphericalPatch.js";import{SplitLimits as oe}from"./SplitLimits.js";import{maxRootTiles as he,tooManyRootTilesAfterChangeError as de,tooManyRootTilesForLayerError as ue,maxTileNeighborLevelDelta as pe,maxMemoryLodBias as ce}from"./TerrainConst.js";import{TerrainRenderer as ge}from"./TerrainRenderer.js";import _e from"./TerrainSurfacePerformanceInfo.js";import{weakAssert as me,isVectorTileLayerView as fe,neighborEdgeIndices as ye,internalAssert as Te,oppositeEdge as ve,isSurfaceLayerView as we,isGroupLayerView as Se,isMapTileLayerView as Ce,isBlendableLayerView as be,isElevationLayerView as xe,releaseTerrainData as Ee,enableTerrainInternalChecks as Le,oppositeCorner as Pe,enableWaterproofTests as Ue,enableInternalTerrainChecks as Me,enableTerrainWaterproofChecks as De,neighborCornerIndices as Re}from"./terrainUtils.js";import{Tile as je,lijEquals as Be}from"./Tile.js";import{printAllocations as Ie}from"./TilePerLayerInfo.js";import{IteratorPreorder as ke,IteratorPostorder as Ae,compareTilesByLij as Ve,hasLoadableSiblings as qe,sortTilesByPOI as Oe}from"./tileUtils.js";import{TilingSchemeLogic as Ge}from"./TilingSchemeLogic.js";import{UpsampleInfo as Ne}from"./UpsampleInfo.js";import{isCompositeBlendMode as Fe,blendModeFromString as We}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{hasLayerBasedScaleVisibility as He}from"../../support/layerViewUtils.js";import{ImmediateTask as $e,TaskPriority as Qe,noBudget as ze}from"../../support/Scheduler.js";import{TextureCompressionTracker as Ye}from"../../support/TextureCompressionTracker.js";import{Yield as Xe}from"../../support/Yield.js";var Ke;let Je=class extends a{static{Ke=this}get allTiles(){return s(this._allTiles)}get demResolution(){const{_allTiles:e,tilingScheme:t}=this;if(0===e.length)return{min:1,max:1};const i=T(t.spatialReference);let r=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY;for(const a of e){const e=t.resolutionAtLevel(a.level)*i;r=Math.min(r,e),s=Math.max(s,e)}return{min:r,max:s}}constructor(e){super(e),this.terrainTextureCompressionTracker=new Ye,this._iteratorPool=new d(()=>new ke,e=>e.remove=()=>this._iteratorPool.release(e)),this._postorderIterator=new Ae,this._hasPendingUpdates=!1,this._pendingUpdates=0,this._asyncWorkItems=0,this._allTilesDirty=!0,this._allTilesSorted=!0,this._usedMemory=null,this._performanceInfo=new _e,this._viewChanged=!1,this.heading=0,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=x(),this._eyePosSurfaceSR=x(),this._splitLimits=new oe,this._frustum=V(),this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._watchUpdatingTracking=new E,this._frameTask=$e,this._allTiles=new u,this._upsampleInfoPool=new d(()=>new Ne),this._shouldEmitChangeEvent=!1,this._rootTilesExtent=R(),this.updatingProgress=.5,this._maxNumUpdating=1,this.maxTextureScale=1.2,this._spatialReference=P.WebMercator,this._elevationProjectorCache=new Map,this.visibleElevationBounds=new Z(1/0,-1/0),this.rootTileElevationBounds=new Z(1/0,-1/0),this._projectorCache=new Map,this._radiusModifier=Math.cos(Math.PI/16/16),this._tilingSchemeSpatialReference=null,this._updatingRootTiles=!1,this._pendingTilesForElevationUpdateEvent=new Set,this._pendingTilesToUpdate=new Set,this.totalGeometryUpdates=0,this.totalTileUpdates=0,this._oneBatchPerFrameTask=!0,this._layerViewsDirty=!1,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._isWebMercator=!1,this._isWebMercatorOnPlateCarree=!1,this._enabled=!0;const t=e.view;this.overlayManager=new se({...e,surface:this}),this._isGlobal=!t.state?.isLocal,this._isGeographic=this._spatialReference?.isGeographic??!1,this._tileConstructor=this._isGlobal?le:ae,this._ellipsoid=L(t.spatialReference),this._renderer=new ge(this.overlayManager.renderer,t.stage,this._allTiles,this._ellipsoid.radius,this.terrainTextureCompressionTracker,t.resourceController.memoryController),He()||(this._scaleRangeQueries=new ne)}initialize(){const e=this.view,t=e.resourceController,i=t.memoryController;this._tileCache=new h((e,t)=>i.newCache(e,t),"terrain-tile"),this._upsampleMapCache=i.newCache("terrain-upsample",e=>e.unloadMapData()),this._elevationQueryCache=new $(i.newCache("elevation-query"));const s=this.overlayManager;this.addHandles([_(()=>s.renderer.isEmpty,()=>this._evaluateTransparency()),_(()=>this.renderer.visible,e=>this.suspended=!e),_(()=>this.heading,e=>{this._renderer.updateHeading(e),this._updateTileTextures(0)}),_(()=>({heading:e.camera?.heading,state:e.state?.mode}),({heading:e,state:t})=>{if(null==e)return;if(this.isGlobal&&this.isGeographic||this.isWebMercatorOnPlateCarree)return void(this.heading=90*Math.round(e/90)%360);const i=Math.round(e)%360,r=Math.abs(i-this.heading);(2===t||Math.min(r,360-r)>=30)&&(this.heading=i)})],"overlayManager"),this.addHandles([_(()=>this.baseOpacity,()=>{this._handleLayerViewChanges(),this._updateTileTextures(this._evaluateTransparency()?1:2)},m),_(()=>this.hasCompositeBlendMode,()=>this._updateTileTextures(this._evaluateTransparency()?1:2),m),_(()=>this.backgroundColor,(e,t)=>{e?.equals(t)||(this._handleLayerViewChanges(),this._renderer.updateTileBackground(e))},f),_(()=>this.snapLevel,()=>this._viewChanged=!0,f),_(()=>this.view.pointsOfInterest,e=>{this._renderer.pointsOfInterest=e,this._watchUpdatingTracking.removeAll(),e&&this._watchUpdatingTracking.add(()=>e.focus?.renderLocation,()=>this._allTilesSorted=!1,{equals:S})}),_(()=>z.TERRAIN_TILE_TREE_SHOW_TILES,t=>{t&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then(({TerrainTileTree3DDebugger:t})=>{!this._treeDebugger&&z.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new t({view:e}))}):t||(this._treeDebugger=o(this._treeDebugger))},y)]);const{spatialReference:a}=e;this._extentHelper=ie(this.viewingMode,{layers:e.map.allLayers,layerViews:e.allLayerViews,viewSpatialReference:a});const n=new r({getCollections:()=>e.defaultsFromMap?.mapCollections?.map(({layers:e})=>e),getChildrenFunction:e=>e&&"layers"in e?e.layers:null}),l=new Ge({layers:n,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:a});this._set("tilingSchemeLogic",l),this._updateTilingScheme(),this._elevationDataRequester=t.createStreamDataRequester(0),this._mapDataRequester=t.createStreamDataRequester(1);const d=t.scheduler;this._frameTask=d.registerTask(Qe.TERRAIN_SURFACE,this),this.addHandles([_(()=>this._extentHelper.stencilEnabledExtents,e=>this._renderer.setStencilEnabledLayerExtents(e),y),_(()=>this.tilingSchemeLogic.tilingScheme,()=>this._updateTilingScheme(),f),_(()=>this.extent,()=>this._updateRootTiles(),y),e.on("resize",()=>this._viewChangeUpdate()),_(()=>{const t=e.state;return[this._lodBias,this.lodSnappingEnabled,e.quality,t.camera,t.contentCamera,t.fixedContentCamera]},()=>this._viewChangeUpdate(),m),_(()=>e.qualitySettings?.fadeDuration,e=>this._renderer.textureFadingEnabled=e>0,y),_(()=>e.qualitySettings?.physicallyBasedRenderingEnabled,e=>this._renderer.pbrMode=e?5:0,y),_(()=>e.qualitySettings?.tiledSurface.elevationLevelDelta,()=>this._updateAllTileGeometries()),_(()=>this._userClippingExtent,()=>this._updateClippingExtent(),f)]),this.addHandles(e.allLayerViews.on("after-changes",()=>this._layerViewsDirty=!0)),this._layerViewsDirty=!0,this._handleLayerViewChanges(),this._renderer.updateTileBackground(this.backgroundColor)}clearHandles(){this._watchUpdatingTracking?.removeAll(),this.removeAllHandles(),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear()}destroy(){this._frameTask.remove(),this._frameTask=$e,this._watchUpdatingTracking?.destroy(),this._removeAllTiles(),this._set("tilingSchemeLogic",o(this.tilingSchemeLogic)),this._basemapLayerViewHandles.forEach((e,t)=>this._unregisterTiledLayerView(t)),this._basemapLayerViewHandles.clear(),this._elevationDataRequester=null,this._mapDataRequester=null,this._set("overlayManager",o(this.overlayManager)),this._tileCache=o(this._tileCache),this._allTiles.prune(),je.prune(),this._treeDebugger=o(this._treeDebugger),this._renderer.destroyed||this._renderer.destroy(),this._renderer=null,this._iteratorPool=o(this._iteratorPool),this._upsampleMapCache=o(this._upsampleMapCache),this._elevationQueryCache=o(this._elevationQueryCache),this._set("view",null),this._extentHelper=o(this._extentHelper),this._upsampleInfoPool=o(this._upsampleInfoPool),Ie(),this._layerViews.forEach(e=>e.length=0),this._performanceInfo=null}get renderer(){return this._renderer}get frustum(){return this._frustum}get snapLevel(){if(this.lodSnappingEnabled){const{view:e,tilingScheme:t}=this,i=e.scale;if(t&&i){const r=t.levelAtScale(i)+e.qualitySettings.tiledSurface.lodBias,s=t.getMaxLod();return r<=0?null:Math.min(r,s||1/0)}}return 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._extentHelper.stencilEnabledExtents.length>0}get _userClippingExtent(){const{spatialReference:e}=this,t=this.view?.clippingArea;if(null==t||null==e)return null;const i=R(),r=K(t,i,e)?i:null,s=this._get("extent");return j(r,s)?s:r}get rootTilesExtent(){return this._rootTilesExtent}get extent(){const e=B(this.groundExtent,this._userClippingExtent,R()),t=this._get("extent");return j(e,t)?t:e}get groundExtent(){return null!=this._tilingSchemeExtent?this._tilingSchemeExtent:this._rootTilesExtent}get _tilingSchemeExtent(){return this.tilingSchemeLogic?.extent}get updating(){return this._hasPendingUpdates||(this._maxNumUpdating=1),!!((this.readyToRun||this._watchUpdatingTracking?.updating||this._asyncWorkItems>0)&&this.ready&&!this.suspended||this.overlayManager?.updating||this.terrainTextureCompressionTracker.compressing)}get readyToRun(){return(this._hasPendingUpdates||this._viewChanged||this._allTilesDirty||!this._allTilesSorted||this._layerViewsDirty||this._scaleRangeQueries?.updating||this._frameTask.updating)&&this.ready&&!this.suspended}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 null!=this._rootTiles}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 0===this._renderer.transparency}get invisible(){return 3===this._renderer.transparency}set suspended(e){this._set("suspended",e),this._viewChangeUpdate()}get fadeDuration(){return this.view.qualitySettings.fadeDuration??0}intersect(e,t,i,r){this._renderer.intersect(e,t,i,r)}getElevationLevelDelta(e){return e<4?3:this.view.qualitySettings.tiledSurface.elevationLevelDelta}getElevation(e,t,i,r){const s=this._rootTiles;if(!s?.length||!this._enabled)return null;if(0===s[0].layerInfo[0].length)return null;let a=this._elevationProjectorCache.get(r);if(void 0===a&&(a=U(r,this._spatialReference)??null,this._elevationProjectorCache.set(r,a)),null==a)return n.getLogger(this).error("TerrainSurface.getElevation(): could not project given point to tiling scheme coordinate system"),null;const l=C(et,e,t,i);a(l,0,l,0);return nt(s,l[0],l[1])}getElevations(e,t,i){const r=this._rootTiles,s=r?r[0].layerInfo[0].length:0;if(r?.length&&0!==s&&this._enabled)for(let a=0;a<t;++a){const t=3*a;i(a,nt(r,e[t],e[t+1]))}else for(let a=0;a<t;++a)i(a,null)}getLayerIndexByUID(e,t){return this._layerIndexByUid[e].get(t)}getScale(e){if(!this.tilingScheme)return null;if(!M(e,et,this.spatialReference))return n.getLogger(this).error("TerrainSurface.getScale(): could not project given point to tiling scheme coordinate system"),null;const t=this._rootTiles;if(null!=t)for(const i of t)if(i?.containsPoint(et)){let e=i;for(;e.children[0]&&!e.rendered;){const t=e.children[0].extent;let i=0;et[0]>t[2]&&(i+=1),et[1]<t[1]&&(i+=2),e=e.children[i]}return this._getLodBiasCorrectedScale(e.level)}return 1/0}_ensureProjector(e){const t=this._projectorCache.get(e);if(t)return t;const i=U(e,this._tilingSchemeSpatialReference)??null;return this._projectorCache.set(e,i),i}getSphereElevationBounds(e,t){const i=this._ensureProjector(t);if(null==i)return n.getLogger(this).error("TerrainSurface.getSphereElevationBounds(): could not project given point to tiling scheme coordinate system"),null;G(e,tt);const r=F(tt,x());i(r,0,r,0),W(tt,r);const s=new Y,a=this._rootTiles;if(null!=a){const e=[];for(const i of a)e.push(i);let t=0;for(;t<e.length;){const i=e[t];if(++t,!I(i.extent,tt))continue;const r=i.children;if(null==r[0]||i.rendered)s.expandElevationRangeValues(i.elevationBoundsMin,i.elevationBoundsMax);else for(const t of r)e.push(t)}}return s}getRootElevationBounds(){return new Y(this.rootTileElevationBounds.min,this.rootTileElevationBounds.max)}getLowerBoundRadius(){const e=(this._ellipsoid.radius+this.visibleElevationBounds.min)*this._radiusModifier;return Math.min(e,this._ellipsoid.radius)}getSphereScale(e,t){if(!this.tilingScheme)return null;if(!M(e,ct,this.spatialReference))return n.getLogger(this).error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;H(tt,ct,t);let i=null;const r=e=>{if(e&&I(e.extent,tt)){const t=e.children;if(t[0]&&!e.rendered)for(const e of t)r(e);else{const t=this._getLodBiasCorrectedScale(e.level);i=null==i?t:Math.min(i,t)}}},s=this._rootTiles;if(null!=s)for(const a of s)r(a);return i}queryVisibleScaleRange(e,t,i,r){if(!this._scaleRangeQueries)return;const s=t?this.tilingScheme.levelAtScale(t):0,a=i?this.tilingScheme.levelAtScale(i):1/0,n=this._lodBias;this._scaleRangeQueries.queryVisibleLevelRange(e,s+n,a+n,r)}_evaluateTransparency(){const e=this.baseOpacity,t=this.overlayManager.renderer.isEmpty,i=this._renderer.transparency,r=this._isFullyTransparent?t?3:2:e>=1&&!this.hasCompositeBlendMode&&!this._renderer.slicePlaneEnabled?0:1;return this._renderer.transparency=r,i!==r}_updateTilingScheme(){const e=this.tilingSchemeLogic.tilingScheme;if(!(e!==this.tilingScheme))return;me(!!e,"tiling scheme cannot be reset to undefined"),this._isGlobal=!this.view?.state?.isLocal,this.tilingScheme&&this._removeAllTiles();const t=e?.spatialReference??P.WebMercator;this._spatialReference=t,this._isWebMercator=!!t?.isWebMercator,this._isWebMercatorOnPlateCarree=this._isWebMercator&&O(this.view?.renderSpatialReference),this._isGeographic=t?.isGeographic??!1,this._set("tilingScheme",e),this._tilingSchemeSpatialReference=this.tilingScheme?.spatialReference,this._projectorCache.clear(),this._updateClippingExtent(),e&&(this._updateTiledLayers(),this._renderer.tileSize=e.pixelSize,this.overlayManager.spatialReference=e.spatialReference,this._updateRootTiles())}static{this._tileMemcacheKey="TerrainTileMemcache"}_acquireTile(e,t,i,r){const s=this._tileCache.pop(Ke._tileMemcacheKey);return s?(s.init(e,t,i,r,this),s):new this._tileConstructor(e,t,i,r,this)}get updatingRootTiles(){return this._updatingRootTiles}_updateRootTiles(){const{extent:e,tilingScheme:t}=this;if(!t)return;const r=it;let s=t.rootTilesInExtent(e,r,5*he);if(null!=this._rootTiles){if(s.length>he)return void n.getLogger(this).warn(de);const e=this._rootTiles.map(e=>e.lij),t=i(e,s,Be);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){const e=this._rootTiles.filter(e=>!(t.removed.findIndex(t=>Be(t,e.lij))>-1)||(this._purgeTile(e),!1));t.added.forEach(t=>e.push(this._newRootTile(t))),this._setRootTiles(e)}}else this._updatingRootTiles=!0,s.length>he&&(n.getLogger(this).warn(ue),s=t.rootTilesInExtent(e,r,he)),this._setRootTiles(s.map(e=>this._newRootTile(e)));j(r,this._rootTilesExtent)||(this._rootTilesExtent=R(r)),this.renderer.visible=!0,this._viewChangeUpdate(),this.overlayManager.setPlacementDirty(),this.notifyChange("ready"),this._updateAllTileGeometries(),this._updatingRootTiles=!1,this.checkAllTilesWaterproofness()}_updateAllTileGeometries(){const e=this._allTiles.filter(e=>e.loaded&&e.intersectsClippingArea);e.sort(Ve),e.forEach(e=>this._renderer.updateTileGeometryState(e)),e.forEach(e=>e.renderData.updateNeighborData()),this._updateTilesGeometries(e),this._pendingTilesToUpdate.clear()}_updateTilesGeometries(e){if(0===e.length)return;e.sort(Ve);const t=this.renderer;e.forEach(e=>t.updateGeometryIfNeeded(e)),e.forEach(e=>this._pendingTilesForElevationUpdateEvent.add(e))}_shouldSplit(e){return 1===e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.snapLevel)}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return this._shouldSplit(t)&&t.setPendingUpdate(1),this._loadTile(t),this._markTileToUpdate(t),this._updateRootTileElevationBounds(),t}_setRootTiles(e){if(this._rootTiles=e,this._allTiles.clear(),null!=e){const 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.suspended&&this.tilingScheme&&this.renderer.visible&&(this._inFrameTask?this._viewChangeUpdateDirty=!0:(this._viewChangeUpdateDirty=!1,this._updateViewDependentParameters(),this._updateTilesVisibility(this._rootTiles)))}_updateClippingStatus(e){e.updateClippingStatus(this.extent)&&e.resetPendingUpdate(8)&&this._updateTileGeometryState(e)}_updateTilesVisibility(e){if(null==e)return;const t=qe(e),i=this.visibleElevationBounds;let r=t?i.min:1/0,s=t?i.max:-1/0;const a=this.extent,n=this.view.state.contentCamera.viewProjectionMatrix;this.setTileTreeDirty();const l=this._iteratorPool.acquire();for(l.reset(e);!l.done;){const e=l.next();e.updateClippingStatus(a)&&e.resetPendingUpdate(8)&&this._updateTileGeometryState(e),e.computeVisibility(),e.updateScreenDepth(n),e.renderData&&(r=Math.min(e.elevationBoundsMin,r),s=Math.max(e.elevationBoundsMax,s))}l.remove(),this._viewChanged=!0,this._allTilesDirty=!0,this._updatePendingTileGeometries(),isFinite(r)&&isFinite(s)&&(i.min!==r||i.max!==s)&&(this.visibleElevationBounds=new Z(r,s))}_updateRootTileElevationBounds(){let e=1/0,t=-1/0;const i=this._rootTiles;null!=i&&i.forEach(({elevationBoundsMin:i,elevationBoundsMax:r})=>{e=Math.min(e,i),t=Math.max(t,r)});const r=this.rootTileElevationBounds;r.min===e&&r.max===t||(this.rootTileElevationBounds=new Z(e,t))}_updateViewDependentParameters(){const{camera:e,contentCamera:t}=this.view.state,i=Math.tan(.5*t.fovX),r=Math.tan(.5*t.fovY),s=this.tilingScheme.pixelSize,a=2**-this._lodBias*e.pixelRatio;this._splitLimits.aboveGround=e.aboveGround,this._splitLimits.fovX=i,this._splitLimits.fovY=r,this._splitLimits.relativeWidthLimit=s/e.width*this.maxTextureScale*a,this._splitLimits.relativeHeightLimit=s/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=q(this._splitLimits.frustum??V(),t.frustum):this._splitLimits.frustum=null,q(this._frustum,e.frustum),b(this._eyePosRenderSR,t.eye),D(e.eye,this.view.renderSpatialReference,this._eyePosSurfaceSR,this.spatialReference)}_updateTileGeometryState(e){e.updateVisibility();this._renderer.updateTileGeometryState(e)&&this._markTileToUpdate(e),this.setMemoryDirty()}_markAllTileNeighborsForUpdate(e){e.forEachLoadedNeighbor(e=>{this._layerViews[1].some(fe)&&e.setPendingUpdate(32),this._pendingTilesToUpdate.add(e)})}_updateTileTexture(e,t){const i=e.resetPendingUpdate(32)?32:!!e.resetPendingUpdate(16)&&16;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=null,t.madeProgress())}_emitElevationUpdateEventForTiles(){if(!this._shouldEmitChangeEvent)return;const e=st.extent;k(e),this._pendingTilesForElevationUpdateEvent.forEach(t=>A(e,t.extent,e)),this._pendingTilesForElevationUpdateEvent.clear(),st.spatialReference=this.spatialReference,this.emit("elevation-change",st),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);const t=!this.view.state.fixedContentCamera;if(this._mergeAndSplit(e,t),this._updateElevation(e),this._updateTextures(e),t||this._mergeAndSplit(e,!0),this._inFrameTask=!1,this._runViewChangeUpdateIfDirty(),this._updatePendingTileGeometries(),this._emitElevationUpdateEventForTiles(),e.done&&e.hasProgressed&&this.requestUpdate(),this.notifyChange("updatingProgressValue"),Le&&this._checkTileInvariant(),!e.hasProgressed)return Xe}_checkTileInvariant(){const e=new Map;this._allTiles.forAll(t=>e.set(t,new Set)),this._allTiles.forAll(t=>{if(me(t.rendered===t.leaf,` rendered ${t.rendered} != ${t.leaf} leaf`),!t.leaf){const e=e=>0===e.unmergableChildCount&&0===e.maxLevelDeltaNeighborCount,i=t.children.reduce((t,i)=>t+(e(i)?0:1),0);if(me(t.unmergableChildCount===i,` Tile[${t.lij.toString()}] unmergeable child count mismatch: actual ${t.unmergableChildCount} vs ${i}`),t.hasPendingUpdate(4)){me(!t.hasPendingUpdate(1),"Tile can be both split and merge at the same time");for(const e of t.children)me(e.leaf||e.hasPendingUpdate(4),"Child of tile to merge must also merge")}}for(let i=0;i<4;++i){if(t.rendered){const e=t.renderData?.geometryState.edgePeerNeighbors[i];if(null!=e){{const r=t.level-e.level<=pe;r||(console.log(`tile level delta [${t.lij.toString()}] vs [${e.lij.toString()}] > ${pe} (edge[${i}])`),me(r,`tile level delta [${t.level}] vs [${e.level}] > ${pe}`))}me(t.level-e.level<=pe,`Max tile lod delta exceeded: [${t.lij.toString()}] vs [${e.lij.toString()}]`)}}const r=t.level-pe,s=e=>e.leaf||e.level===t.level,a=t.findNeighborTile(ye[i],s);if(null!=a){if(t.leaf&&t.level>=pe){let i=a;for(;t.level-i.level<pe;)i=i.parent;const s=[r,t.lij[1]>>pe,t.lij[2]>>pe];if(!Be(s,i.lij)){const r=e.get(i);me(!r.has(t),"Cannot already have neighbor"),r.add(t)}}me(a.rendered||a.level===t.level,"Non-same-level-neighbor of rendered must be rendered"),me(t.level-a.level<=pe,`Tile level delta [${t.level}] vs [${a.level}] > ${pe}`)}}}),this._allTiles.forAll(t=>{const i=t.maxLevelDeltaNeighborCount,r=e.get(t);me(i===r.size,`Tile[${t.lij.toString()}] merge-blocker mismatch: actual ${i} vs ${r.size}`)})}_updateAllTilesStatus(e){if(!this._viewChanged||!this._rootTiles||e.done)return;this._viewChanged=!1;const t=new lt(this._allTiles.length);t.pushAll(this._rootTiles);const i=this.snapLevel,r=this._splitLimits,s=this._eyePosRenderSR;this._allTiles.forAll(e=>{e.maxLevelDeltaNeighborCount=0,e.unmergableChildCount=0});const a=this.view.state.contentCamera.viewProjectionMatrix;for(;!t.empty;){const e=t.pop(),n=e.parent,l=null!=n&&n.hasPendingUpdate(4),o=l?4:e.shouldSplit(r,s,i),h=1===o;e.leaf?ot(e,h):t.pushAll(e.children),l?(e.resetPendingUpdate(1),e.leaf||e.setPendingUpdate(4),this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(a)):h?(e.resetPendingUpdate(4),e.leaf&&e.setPendingUpdate(1)):(e.resetPendingUpdate(1)&&e.updateAgentSuspension(),2===o&&e.updateAgents(0),e.leaf||(e.setPendingUpdate(4),e.resetPendingUpdate(1)))}this.requestUpdate(),(this._shortBatches||!this._oneBatchPerFrameTask)&&this._updatePendingTileGeometries(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||!this.view.pointsOfInterest?.focus||(Oe(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger?.update(),e.madeProgress())}_markTileToUpdate(e){Te(e.loaded),e.intersectsClippingArea&&(this._pendingTilesToUpdate.add(e),this._markAllTileNeighborsForUpdate(e))}_updatePendingTileGeometries(){const e=this._pendingTilesToUpdate,t=Array.from(e.keys()).filter(e=>e.loaded&&e.intersectsClippingArea);if(0===t.length)return void e.clear();const i=(i,r)=>{!r?.loaded||!r.intersectsClippingArea||r.level<i.level||e.has(r)||(e.add(r),t.push(r),r.renderData.updateNeighborData())};t.sort(Ve);const r=t.length;for(let s=0;s<r;++s){const r=t[s];Te(r.loaded),Te(r.intersectsClippingArea);const a=r.renderData;a.updateNeighborData();const n=a.dirtyEdgeResolutions,l=a.geometryState,o=e=>{const t=Re[e];i(r,l.cornerPeerNeighbors[e]?.findCorner(Pe(t),e=>e.loaded))};for(let t=0;t<4;++t)if(n&1<<t){const s=a.geometryState.edgePeerNeighbors[t];s&&s?.level>=r.level&&s.forAllSubtreeOnSide(ve(ye[t]),t=>!(!t.loaded||!t.intersectsClippingArea)&&(Te(e.has(t)||Ve(r,t)<0),i(r,t),!0)),o((t+1)%4),o(t)}}e.clear(),this._updateTilesGeometries(t),this._shouldEmitChangeEvent=!0,Le&&Ue&&this.checkAllTilesWaterproofness()}_mergeAndSplit(e,t){if(this.suspended||e.done||!this._allTilesDirty)return;this._allTilesDirty=!1,this.requestUpdate();let i=!1;const r=this.view.state.fixedContentCamera;let s=!1;for(;!e.done;){s=!0;let a=!1;const n=!this._allTiles.some(s=>{if(!i&&!r&&!s.visible)return e.done;let n=s;if(s.hasPendingUpdate(4)){if(!t||s.unmergableChildCount>0)return e.done;for(s.resetPendingUpdate(4);null!=n.parent&&0===n.parent.unmergableChildCount&&n.parent.resetPendingUpdate(4);)n=n.parent;this._mergeTile(n),a=!0,e.madeProgress()}else if(s.resetPendingUpdate(1)){let t=!0;const i=s.level;if(i>=pe){const e=e=>e.leaf||i-e.level<pe;for(let r=0;r<4;++r){const a=s.findNeighborTile(ye[r],e);null!=a&&i-a.level===pe&&(t=!1,Le&&(Te(a.leaf),Te(a.hasPendingUpdate(1))))}}t?(this._splitTile(s),e.madeProgress(),a=!0):s.setPendingUpdate(1)}return e.done});if(a&&(this._allTilesSorted=!1,this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries()),n){if(!i){i=!0;continue}if(!a)break}else this._allTilesDirty=!0}s?e.madeProgress():this._allTilesDirty=!0,!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries(),this._sortTiles(e)}_updateElevation(e){e.done||(this._allTiles.some(t=>(t.resetPendingUpdate(8)&&(this._updateTileGeometryState(t),this._shortBatches&&this._updatePendingTileGeometries(),e.madeProgress()),e.done)),!this._oneBatchPerFrameTask&&this._updatePendingTileGeometries())}_updateTextures(e){e.done||this._allTiles.some(t=>(this._updateTileTexture(t,e),e.done))}_updateClippingExtent(){this.spatialReference&&(this.overlayManager?.updateOverlayParameters(1),this.overlayManager.setPlacementDirty(),this._updateRootTiles())}get _lodBias(){const e=this.view.quality;return this.view.qualitySettings.tiledSurface.lodBias-(1-e)*ce}_getLodBiasCorrectedScale(e){const t=this.tilingScheme.levels,i=l(e-this._lodBias,0,t.length-1),r=i-Math.floor(i);return t[Math.floor(i)].scale*(1-r)+t[Math.ceil(i)].scale*r}_removeAllTiles(){null!=this._rootTiles&&(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){const 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?dt(e):this._purgeSubtree(e),this._allTiles.removeUnordered(e),this._unloadTile(e),e.dispose(),this._tileCache.put(Ke._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){me(e.leaf,"Tile that is already split should not be split again!"),me(e.rendered,"Tile marked to split is not rendered"),dt(e);const t=e.createChildren();this._allTiles.pushArray(t),this.notifyChange("demResolution"),this.emit("tiles-changed",{allTiles:this.allTiles}),e.updateAgentSuspension(),me(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=>ot(e,e.hasPendingUpdate(1))),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){at.spatialReference=this.spatialReference,at.extent=e.extent,at.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",at)}createTile(e,t,i,r){me(!!r,"createTile sanity check");const s=this._acquireTile(e,t,i,r);return s.updateClippingStatus(this.extent),s.updateScreenDepth(this.view.state.contentCamera.viewProjectionMatrix),this._shouldSplit(s)&&s.setPendingUpdate(1),s}get _shortBatches(){return 2!==this.view.state.mode}_mergeTile(e){me(!e.hasPendingUpdate(1),"_mergeTile sanity check"),me(!e.leaf,"Cannot merge a leaf"),e.leaf||(this._purgeSubtree(e),me(!e.renderData,"Merging tile with existing render data?"),this._loadTile(e),this._markTileToUpdate(e),this._emitTileScaleChange(e),this._shortBatches&&this._updatePendingTileGeometries(),ot(e,!1),this._allTilesDirty=!0,++this._performanceInfo.numMerged)}_loadTile(e){e.load(),this.requestUpdate(),this._allTilesDirty=!0,this.overlayManager?.hasOverlays&&this.overlayManager.updateTileOverlayParameters(e)}_handleLayerViewChanges(e=ze){if(!this._layerViewsDirty)return;this._layerViewsDirty=!1;let t=!1;const i=new Set;let r=-1;for(let s=this.view.allLayerViews.length-1;s>=0;s--){const e=this.view.allLayerViews.items[s];if(i.add(e.uid),we(e)||Se(e))if(this._basemapLayerViewHandles.has(e.uid)&&!Se(e)){const i=this._layerClassFromLayerView(e),s=this.getLayerIndexByUID(i,e.uid);null!=s&&((s<r||null==r)&&(t=!0),r=s)}else this._registerTiledLayerView(e),e.layer.loaded&&(t=!0)}this._basemapLayerViewHandles.forEach((e,r)=>{i.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(const e of this.view.allLayerViews.items)if(Ce(e)&&!Q(e.layer)&&0!==e.fullOpacity)return!1;return!0}_hasCompositeBlendMode(){for(const e of this.view.allLayerViews.items)if((be(e)||Se(e))&&Fe(We[e.layer.blendMode]))return!0;return!1}_layerClassFromLayerView(e){return xe(e)?0:1}_registerTiledLayerView(e){const t=[];if((be(e)||Se(e))&&t.push(_(()=>e.layer.blendMode,()=>{this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._updateTileTextures(2)})),!Se(e)){const i=this._layerClassFromLayerView(e);t.push(_(()=>!e.destroyed&&e.suspended,()=>this._updateTiledLayers())),t.push(_(()=>!e.destroyed&&e.fullOpacity,()=>this._updateTileTextures(2)));const{layer:r}=e;"effectiveScaleRange"in r&&t.push(_(()=>!e.destroyed&&r.effectiveScaleRange,()=>this._restartAllAgents(i))),t.push(e.on("data-changed",()=>{const t=this.getLayerIndexByUID(i,e.uid);null!=t&&this._invalidateLayerData(t,i)}))}this._unregisterTiledLayerView(e.uid),this._basemapLayerViewHandles.set(e.uid,t)}_unregisterTiledLayerView(e){const t=this._basemapLayerViewHandles.get(e);if(t){for(const e of t)e.remove();this._basemapLayerViewHandles.delete(e)}}_updateTiledLayers(){if(!this.tilingScheme||this.view.suspended)return;const e=this.view.allLayerViews,t=[[],[]];let i=null;e.forEach(e=>{if(!e.layer||e.suspended||!we(e)||!e.fullExtent)return;const r=this._layerClassFromLayerView(e);if(1===r){const t=e.displayLevelRange.maxLevel;t!==1/0&&(null===i||t>i)&&(i=t)}t[r].push(e)});for(const r of re){const e=this._layerViews[r],i=t[r];i.reverse();const s=i.length;let a=e.length!==s;const n=new Array(s),l=new Array(e.length);this._layerIndexByUid[r].clear();for(let t=0;t<s;t++){const s=i[t].uid;this._layerIndexByUid[r].set(s,t);const o=e.indexOf(i[t]);n[t]=o,t!==o&&(a=!0),o>-1&&(l[o]=t)}if(a){const e=this._postorderIterator;for(e.reset(this._rootTiles);!e.done;)e.next().modifyLayers(l,n,r);this._layerViews[r]=i,this._restartAllAgents(r),this._updateTilesVisibility(this._rootTiles)}}this.tilingScheme.ensureMaxLod(i)&&(this._viewChangeUpdate(),this.notifyChange("tilingScheme"))}_restartAllAgents(e){const t=this._postorderIterator;for(t.reset(this._rootTiles);!t.done;){const i=t.next();i.restartAgents(e),0===e&&i.computeElevationBounds()}this._updateRootTileElevationBounds()}layerViewByIndex(e,t){return this._layerViews[t][e]}numLayers(e){return this._layerViews[e].length}_updateTileTextures(e){this._allTiles.forAll(t=>{t.updateAgents(1),1===e?this.renderer.updateTileTexture(t,16):t.updateRenderData(1,e)}),this._evaluateTransparency()}_invalidateLayerData(e,t){this._allTiles.forAll(i=>i.removeLayerAgent(e,t)),this._allTiles.forAll(i=>i.invalidateLayerData(e,t))}setTileTreeDirty(){this._allTilesDirty=!0}requestRender(e=1){this.renderer.setNeedsRender(e)}requestUpdate(){1===++this._pendingUpdates&&(this._hasPendingUpdates=!0)}requestTileData(e,t,i,r){const s=this.layerViewByIndex(t,i),a=s.layer;return!a.tilemapCache||fe(s)?this._requestTileData(e,i,s,r):(++this._asyncWorkItems,a.tilemapCache.fetchAvailability(e.level,e.lij[1],e.lij[2],{...r,timeout:6e3}).then(()=>--this._asyncWorkItems).catch(t=>{throw--this._asyncWorkItems,p(r),c(t)||this._dataMissing(e,i,s),t}).then(()=>this._frameTask.schedule(()=>this._requestTileData(e,i,s,r),r.signal)))}_requestTileData(e,t,i,r){if(this.destroying)return Promise.resolve();const s=0===t;return r.requester??=s?this._elevationDataRequester:this._mapDataRequester,s?xe(i)?this._requestElevationTileData(e,i,r):Promise.reject():Ce(i)?this._requestMapTileData(e,i,r):Promise.reject()}_requestElevationTileData(e,t,i){++this._asyncWorkItems;const r=r=>{!g(i)&&r&&(this.setMemoryDirty(),this.requestUpdate(),this._elevationDataArrived(e,t,r))},s=i=>{c(i)||(n.getLogger(this).error(`Tile ${e.lij.toString()} layer 0/${t.uid} error ${i}`),this._dataMissing(e,0,t),this.requestUpdate())};return t.fetchElevationTile(e,i).then(e=>this._frameTask.schedule(()=>r(e)),s).finally(()=>--this._asyncWorkItems)}_elevationDataArrived(e,t,i){const r=this._layerIndexByUid[0].get(t.uid);if(null==r)return void n.getLogger(this).warn("TerrainSurface: received data from unknown layer %d %s",0,e.lij.toString());const s=new ee(e.lij,e.extent,i);e.dataArrived(r,0,s),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:0});const a=[e],l=e.level,o=this._iteratorPool.acquire();for(o.reset(a);!o.done;){const e=o.next();e.findElevationBoundsForLayer(r,l),e.computeElevationBounds()}0===l&&this._updateRootTileElevationBounds(),o.remove(),this._updateTilesVisibility(a)}_requestMapTileData(e,t,i){++this._asyncWorkItems;const r=(r,s)=>{Ee(s),g(i)||(console.error(`Tile ${e.lij.toString()} layer 1/${t.uid} error ${r}`),this._dataMissing(e,1,t),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule(()=>{this.requestUpdate(),g(i)?Ee(r):this._mapTileDataArrived(e,t,r)},i.signal,s(r)).catch(s(r)),n=(e,t=null)=>this._frameTask.schedule(()=>r(e,t));return t.fetchTile(e.lij,i).then(a,n).finally(()=>--this._asyncWorkItems)}_mapTileDataArrived(e,t,i){const r=this.getLayerIndexByUID(1,t.uid);if(null==r)return Ee(i),void n.getLogger(this).warn("TerrainSurface: received data from unknown layer");e.dataArrived(r,1,i),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:1})}_dataMissing(e,t,i){const r=this.getLayerIndexByUID(t,i.uid);null!=r?(e.dataMissing(r,t),this.emit("tile-data-changed",{tile:e,layerIndex:r,layerClass:t})):n.getLogger(this).warn("TerrainSurface: received data from unknown layer")}get performanceInfo(){const 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++;const i=t.level;t.renderData&&(e.numLoadedPerLevel[i]=(e.numLoadedPerLevel[i]||0)+1),t.visible&&(e.numVisible++,t.rendered&&(e.numRenderedPerLevel[i]=(e.numRenderedPerLevel[i]||0)+1,e.numRendered++))}),e}setMemoryDirty(){this._usedMemory=null}get usedMemory(){return this.tilingScheme?(null==this._usedMemory&&(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;const i=this._layerClassFromLayerView(e),r=this.getLayerIndexByUID(i,e.uid);return null!=r&&this._allTiles.forAll(e=>t+=e.getUsedMemoryForLayer(i,r)),t}get renderPatchBorders(){return this._renderer.renderPatchBorders}set renderPatchBorders(e){this._renderer.renderPatchBorders=e}get visualizeNormals(){return this._renderer.visualizeNormals}set visualizeNormals(e){this._renderer.visualizeNormals=e}get renderingDisabled(){return this._renderer.renderingDisabled}set renderingDisabled(e){this._renderer.renderingDisabled=e}get test(){}checkAllTilesWaterproofness(){if(!Ue)return;const e=this._rootTiles;if(null==e)return;const t=e=>e?.renderData?.geometry?.indices?.length>0,i=(e,i)=>{t(e)&&console.error("Tile[",e.lij,"] has geometry although parent[",i.lij,"] has geom")},r=e=>{if(e.intersectsClippingArea)if(e.renderData&&!e.renderData.geometryState&&console.error("Tile[",e.lij,"] has renderData but not geometryState"),e.renderData&&!e.renderData.geometry&&console.error("Tile[",e.lij,"] has renderData but not geometryInfo"),!e.renderData?.geometry||(e.renderData.geometry.indices?.length??0)>0||console.error("Tile[",e.lij,"] has renderData but no indices - geometryInfo: ",e.renderData.geometry),t(e)){e.checkGeometryWaterproofness();for(const t of e.children)i(t,e)}else if(e.leaf)console.error("Tile[",e.lij,"] has no geometry and no children, from root to leaf");else for(const t of e.children)r(t)},s=e=>{const t=e.parent?.visible??!0,i=e.visible;e.computeVisibility();const r=e.visible;if(i!==r&&t&&console.error(" Tile[",e.lij,"] has out of date visibility: ",i," instead of ",r),!e.leaf)for(const a of e.children)s(a)};for(const a of e)r(a),s(a)}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&&0===e[2]}lijEastEnd(e){return 1<<e+(this._isGeographic?1:0)}wrapEastWest(e){const t=this.lijEastEnd(e[0]),i=e[2];if(0<=i&&i<t)return e;if(!this._isGlobal)return null;const r=(i+(i<0?t:0))%t;return[e[0],e[1],r]}enableInternalChecks(e){Me(e)}enableWaterproofnessChecks(e){De(e)}static cleanupTerrainSurface(){rt.prune()}enable(e){e!==this._enabled&&(e?(this._updateRootTiles(),this.suspended=!1):(this.suspended=!0,this._removeAllTiles(),this._setRootTiles(null)),this._enabled=e)}};e([v()],Je.prototype,"_renderer",void 0),e([v({constructOnly:!0})],Je.prototype,"_scaleRangeQueries",void 0),e([v({constructOnly:!0})],Je.prototype,"view",void 0),e([v({constructOnly:!0})],Je.prototype,"overlayManager",void 0),e([v({constructOnly:!0})],Je.prototype,"terrainTextureCompressionTracker",void 0),e([v()],Je.prototype,"_hasPendingUpdates",void 0),e([v()],Je.prototype,"_asyncWorkItems",void 0),e([v()],Je.prototype,"_allTilesDirty",void 0),e([v()],Je.prototype,"_allTilesSorted",void 0),e([v()],Je.prototype,"_viewChanged",void 0),e([v({type:Number})],Je.prototype,"heading",void 0),e([v()],Je.prototype,"_splitLimits",void 0),e([v({readOnly:!0})],Je.prototype,"_watchUpdatingTracking",void 0),e([v()],Je.prototype,"_frameTask",void 0),e([v()],Je.prototype,"demResolution",null),e([v({readOnly:!0})],Je.prototype,"snapLevel",null),e([v({readOnly:!0})],Je.prototype,"lodSnappingEnabled",null),e([v()],Je.prototype,"_userClippingExtent",null),e([v()],Je.prototype,"_rootTilesExtent",void 0),e([v({readOnly:!0})],Je.prototype,"extent",null),e([v({readOnly:!0})],Je.prototype,"groundExtent",null),e([v({readOnly:!0})],Je.prototype,"_tilingSchemeExtent",null),e([v({readOnly:!0})],Je.prototype,"updating",null),e([v({readOnly:!0})],Je.prototype,"readyToRun",null),e([v(J)],Je.prototype,"updatingProgress",void 0),e([v({readOnly:!0})],Je.prototype,"updatingProgressValue",null),e([v()],Je.prototype,"_maxNumUpdating",void 0),e([v()],Je.prototype,"baseOpacity",null),e([v()],Je.prototype,"hasCompositeBlendMode",void 0),e([v({readOnly:!0})],Je.prototype,"viewingMode",null),e([v()],Je.prototype,"maxTextureScale",void 0),e([v({readOnly:!0})],Je.prototype,"ready",null),e([v({readOnly:!0})],Je.prototype,"rootTiles",null),e([v()],Je.prototype,"_rootTiles",void 0),e([v({readOnly:!0})],Je.prototype,"spatialReference",null),e([v({type:t})],Je.prototype,"backgroundColor",null),e([v({value:!1})],Je.prototype,"slicePlaneEnabled",null),e([v({readOnly:!0})],Je.prototype,"tilingScheme",void 0),e([v({readOnly:!0})],Je.prototype,"tilingSchemeLocked",null),e([v({readOnly:!0})],Je.prototype,"tilingSchemeLogic",void 0),e([v()],Je.prototype,"wireframe",null),e([v({value:!1})],Je.prototype,"suspended",null),e([v()],Je.prototype,"fadeDuration",null),e([v()],Je.prototype,"visibleElevationBounds",void 0),e([v()],Je.prototype,"rootTileElevationBounds",void 0),e([v()],Je.prototype,"_layerViewsDirty",void 0),e([v()],Je.prototype,"renderPatchBorders",null),e([v()],Je.prototype,"visualizeNormals",null),e([v()],Je.prototype,"renderingDisabled",null),Je=Ke=e([w("esri.views.3d.terrain.TerrainSurface")],Je);const Ze=Je,et=x(),tt=N(),it=R(),rt=new u,st=new X("ground"),at={spatialReference:null,extent:null,scale:0};function nt(e,t,i){for(const r of e){if(!r.containsPointXY(t,i))continue;let e=r;for(;e&&!e.renderData;){const r=(t>e.extentMidX?1:0)+(i<e.extentMidY?2:0);e=e.children[r]}const s=e?.renderData?.geometryState.samplerData??null;return te(t,i,s)}return null}class lt{constructor(e){this.capacity=e,this._head=0,this._tail=0,this._data=new Array(e)}push(e){const t=this._tail;if(!(t<this.capacity))throw new Error("Queue full");this._data[t]=e,this._tail=t+1}pushAll(e){const t=e.length;if(0===t)return;const i=this._tail;if(!(i+t<=this.capacity))throw new Error("Queue full");for(let r=0;r<t;++r)this._data[i+r]=e[r];this._tail=i+t}pop(){const e=this._head;if(e<this._tail){const t=this._data[e];return this._head=e+1,t}}get empty(){return this._head>=this._tail}get full(){return this._tail>=this._data.length}}function ot(e,t){!e.leaf||e.level<pe||pt(e,e=>{t&&ht(e);const i=ut(e);if(e.maxLevelDeltaNeighborCount++,i){let t=e.parent;for(;t;){const e=ut(t);if(t.unmergableChildCount++,!e)break;t=t.parent}}})}function ht(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<pe||pt(e,e=>{ht(e)})}function dt(e){e.level<pe||pt(e,e=>{if(e.maxLevelDeltaNeighborCount--,0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount){let t=e.parent;for(;t&&(t.unmergableChildCount--,ut(t));)t=t.parent}})}function ut(e){return 0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount}function pt(e,t){if(e.level<pe)return;const i=e.level-pe,r=e.lij[1]>>pe,s=e.lij[2]>>pe,a=e=>e.leaf||e.level===i;for(let n=0;n<4;++n){const l=e.findNeighborTile(ye[n],a);if(!l||l.level!==i)continue;const o=l.lij;o[1]===r&&o[2]===s||t(l)}}const ct=x();export{Ze as default};
|