@arcgis/core 4.33.0-next.20250205 → 4.33.0-next.20250207
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/arcade.js +1 -1
- package/assets/components/assets/icon/dualImageArea16.json +1 -0
- package/assets/components/assets/icon/dualImageArea24.json +1 -0
- package/assets/components/assets/icon/dualImageArea32.json +1 -0
- package/assets/components/assets/icon/dualImageDistance16.json +1 -0
- package/assets/components/assets/icon/dualImageDistance24.json +1 -0
- package/assets/components/assets/icon/dualImageDistance32.json +1 -0
- package/assets/components/assets/icon/dualImageLocation16.json +1 -0
- package/assets/components/assets/icon/dualImageLocation24.json +1 -0
- package/assets/components/assets/icon/dualImageLocation32.json +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{24a86c52c8bdd0b5eb4d.js → 09a99c556089c166d1f8.js} +1 -1
- package/assets/esri/core/workers/chunks/0a8e388e96af44deeabb.js +1 -0
- package/assets/esri/core/workers/chunks/12d6baeffd55a98a7c75.js +1 -0
- package/assets/esri/core/workers/chunks/143a193fa3a6e645c8ac.js +1 -0
- package/assets/esri/core/workers/chunks/{9b4f471fcd8a3b5e089f.js → 192569dfa7c0ea8dd864.js} +1 -1
- package/assets/esri/core/workers/chunks/{ad215219e5eef8598745.js → 28dbbfc44cc2bdcd221d.js} +1 -1
- package/assets/esri/core/workers/chunks/308ec51ff4a66f7fcb0d.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{72cf9192292e5c85c6df.js → 32d3657dcae89b740f8b.js} +2 -2
- package/assets/esri/core/workers/chunks/{72cf9192292e5c85c6df.js.LICENSE.txt → 32d3657dcae89b740f8b.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/333091ab2e267652ed56.js +1 -0
- package/assets/esri/core/workers/chunks/354531dc2f0dea2ad96f.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/35e4af82a08b4eadbfab.js +1 -0
- package/assets/esri/core/workers/chunks/369a2b8484a8807bde38.js +1 -0
- package/assets/esri/core/workers/chunks/4040158835f9036967cd.js +2 -0
- package/assets/esri/core/workers/chunks/{1a2e1a414e651e988435.js.LICENSE.txt → 4040158835f9036967cd.js.LICENSE.txt} +1 -6
- package/assets/esri/core/workers/chunks/{8a1e4f65fc81aba7a704.js → 4122d10bc910e888eee1.js} +1 -1
- package/assets/esri/core/workers/chunks/433576983754f690bcc7.js +1 -0
- package/assets/esri/core/workers/chunks/459af0c3d62c3ed11c19.js +1 -0
- package/assets/esri/core/workers/chunks/53810519ff5922b42cd2.js +1 -0
- package/assets/esri/core/workers/chunks/5721557a1d8eab23a55b.js +1 -0
- package/assets/esri/core/workers/chunks/594d923400fd74881833.js +1 -0
- package/assets/esri/core/workers/chunks/{7a0415db78c68d31733f.js → 6039da57a2adedd3b83f.js} +1 -1
- package/assets/esri/core/workers/chunks/62a1d60ad4bf6469c4dd.js +1 -0
- package/assets/esri/core/workers/chunks/{81aa8cc289fd02ca4da6.js → 7058001bf66f9f3d5d45.js} +1 -1
- package/assets/esri/core/workers/chunks/{e8ae8a11d8439e2a66ad.js → 706f867a9034d62a8ef7.js} +1 -1
- package/assets/esri/core/workers/chunks/73d03c208242778e67bf.js +1 -0
- package/assets/esri/core/workers/chunks/77764ca90bdd13ee2167.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{1ab83753d9eec0463461.js → 7b367bb0ed9c218ca595.js} +1 -1
- package/assets/esri/core/workers/chunks/{723a9fba144e2fa6d017.js → 7cb09e58bcc537ec1f7a.js} +1 -1
- package/assets/esri/core/workers/chunks/8191dd3d7451b2e7b95e.js +1 -0
- package/assets/esri/core/workers/chunks/842db06ce62758fab1e7.js +1 -0
- package/assets/esri/core/workers/chunks/8c32cee395da0a7b9a8e.js +1 -0
- package/assets/esri/core/workers/chunks/8d8f5f08d730270e1165.js +1 -0
- package/assets/esri/core/workers/chunks/94225d92afbdb10dfedb.js +1 -0
- package/assets/esri/core/workers/chunks/94490937dca566fe2640.js +1 -0
- package/assets/esri/core/workers/chunks/{b9ce0049e27a3e1ed9f9.js → 9b2fab133786e5d47631.js} +1 -1
- package/assets/esri/core/workers/chunks/9d61590c4d21c7421925.js +1 -0
- package/assets/esri/core/workers/chunks/{610b33b7291cffcc4e5d.js → a42ae5d5e5f66d120b4d.js} +1 -1
- package/assets/esri/core/workers/chunks/a5e9ea13e844a62b2a7f.js +1 -0
- package/assets/esri/core/workers/chunks/b21b152fa15896577242.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/b43d88b6e7dc4ab13599.js +1 -0
- package/assets/esri/core/workers/chunks/{6d5bfcc7856cafe7b043.js → b765670b47d209d7655a.js} +2 -2
- package/assets/esri/core/workers/chunks/{6d5bfcc7856cafe7b043.js.LICENSE.txt → b765670b47d209d7655a.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/d29c3bf29fcd7fa31f1a.js +1 -0
- package/assets/esri/core/workers/chunks/d339dee99c4820b63f39.js +1 -0
- package/assets/esri/core/workers/chunks/{9c5c6ecaf5be24279fa5.js → ddc30044f61a2c2df3fe.js} +1 -1
- package/assets/esri/core/workers/chunks/de1f3c4b8000c2d73013.js +1 -0
- package/assets/esri/core/workers/chunks/e4b3f2d5c43518b0cde7.js +1 -0
- package/assets/esri/core/workers/chunks/e5e3b6d00d27b5bb354f.js +1 -0
- package/assets/esri/core/workers/chunks/ef6279f5c63ab1e88c71.js +1 -0
- package/assets/esri/core/workers/chunks/{0711d3ad4d403bcfdcad.js → f117a89d1f4001a1f9f0.js} +1 -1
- package/assets/esri/core/workers/chunks/f14b318bab5efcf43419.js +1 -0
- package/assets/esri/core/workers/chunks/f32ca4381e804cc3481e.js +1 -0
- package/assets/esri/core/workers/chunks/f9070edd8e0b2a57af79.js +1 -0
- package/assets/esri/core/workers/chunks/f9e48205178a5a804d38.js +1 -0
- package/assets/esri/themes/base/widgets/_Directions.scss +15 -6
- package/assets/esri/themes/base/widgets/_ItemList.scss +6 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/WaterSurface.glsl.js +2 -2
- package/geometry/operators/projectOperator.js +1 -1
- package/geometry/operators/shapePreservingProjectOperator.js +1 -1
- package/geometry/support/meshUtils/elevation.js +1 -1
- package/interfaces.d.ts +121 -84
- package/layers/FeatureLayer.js +1 -1
- package/layers/Layer.js +1 -1
- package/layers/SubtypeGroupLayer.js +1 -1
- package/layers/WCSLayer.js +1 -1
- package/layers/graphics/data/FeatureStore.js +1 -1
- package/layers/graphics/data/QueryEngineCapabilities.js +1 -1
- package/layers/graphics/sources/FeatureLayerSource.js +1 -1
- package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
- package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
- package/layers/graphics/sources/support/clientSideDefaults.js +1 -1
- package/layers/graphics/sources/support/sourceUtils.js +1 -1
- package/layers/mixins/BlendLayer.js +1 -1
- package/layers/mixins/FeatureLayerBase.js +1 -1
- package/layers/mixins/OperationalLayer.js +1 -1
- package/layers/mixins/operationalLayerModuleMap.js +1 -1
- package/layers/ogc/wcsUtils.js +1 -1
- package/layers/support/RasterFunctionTemplate.js +1 -1
- package/layers/support/SubtypeSublayer.js +1 -1
- package/layers/support/arcadeUtils.js +1 -1
- package/layers/support/commonProperties.js +1 -1
- package/layers/support/layersCreator.js +1 -1
- package/layers/support/rasterDatasets/WCSRaster.js +1 -1
- package/layers/support/rasterDatasets/multipartParser.js +1 -1
- package/layers/support/rasterDatasets/wcsCapabilitiesParser.js +1 -1
- package/layers/support/rasterFunctionUtils.d.ts +2 -1
- package/layers/support/rasterFunctionUtils.js +1 -1
- package/layers/support/rasterFunctions/creators/createDataManagementFunctions.js +1 -1
- package/package.json +2 -2
- package/portal/support/layersLoader.js +1 -1
- package/portal/support/loadUtils.js +1 -1
- package/rest/imageService.js +1 -1
- package/rest/support/ImageSampleParameters.js +1 -1
- package/rest/support/ImageSampleResult.js +1 -1
- package/rest/support/ImageVolumeResult.js +1 -1
- package/smartMapping/support/adapters/InMemoryLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/support/histogramUtils.js +1 -1
- package/support/TablesMixin.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMSymbolRasterizer.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/cim/fitVectorMarker.js +5 -0
- package/symbols/support/previewCIMSymbol.js +1 -1
- package/views/2d/engine/webgl/TextureManager.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapResources.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/GraphicsLayerView2D.js +1 -1
- package/views/2d/layers/ImageryLayerView2D.js +1 -1
- package/views/2d/layers/LayerView2D.js +1 -1
- package/views/2d/layers/MapImageLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/features/schema/SourceSchema.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
- package/views/2d/layers/features/sources/strategies/DrillDownTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/PagedTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/ParquetLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/SnapshotLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/StreamLoadStrategy.js +1 -1
- package/views/2d/layers/graphics/HighlightGraphicContainer.js +1 -1
- package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
- package/views/2d/layers/support/util.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/Stage.js +1 -1
- package/views/3d/webgl-engine/effects/haze/Haze.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
- package/views/LayerViewManager.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileCache.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileStore.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiledFetcher.js +1 -1
- package/views/layers/support/MapServiceLayerViewHelper.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor/VisibleElements.js +1 -1
- package/widgets/Editor/components/FeatureList.js +1 -1
- package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
- package/widgets/Editor/support/EditorItem.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
- package/widgets/Feature/FeatureViewModel.js +1 -1
- package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageLocationWidget.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/support/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/07bff9e742f3e5877f3f.js +0 -1
- package/assets/esri/core/workers/chunks/1a2e1a414e651e988435.js +0 -2
- package/assets/esri/core/workers/chunks/287362f9af132fafe4de.js +0 -1
- package/assets/esri/core/workers/chunks/2ea5e5e6c4660a06b516.js +0 -1
- package/assets/esri/core/workers/chunks/380d37ceb8cf52bad190.js +0 -1
- package/assets/esri/core/workers/chunks/3984bf01f055fc42bfbf.js +0 -1
- package/assets/esri/core/workers/chunks/39e38aab86dcee3f79be.js +0 -1
- package/assets/esri/core/workers/chunks/41cd1a5c99ab3bbd1fb4.js +0 -1
- package/assets/esri/core/workers/chunks/5e7f16b312077ca8c18d.js +0 -1
- package/assets/esri/core/workers/chunks/69d307758262e5d7a32e.js +0 -1
- package/assets/esri/core/workers/chunks/6ef2514a6b7bbfb8e37d.js +0 -1
- package/assets/esri/core/workers/chunks/7e4d72279cc599b7029c.js +0 -1
- package/assets/esri/core/workers/chunks/82d26884127ed772cc4b.js +0 -1
- package/assets/esri/core/workers/chunks/8438fba57e82e4cc7c11.js +0 -1
- package/assets/esri/core/workers/chunks/858b191c078d04232342.js +0 -1
- package/assets/esri/core/workers/chunks/918bdba41fa470cf77fd.js +0 -1
- package/assets/esri/core/workers/chunks/91d2bdfa6e34c10b7f50.js +0 -1
- package/assets/esri/core/workers/chunks/92155d112ebb6a4c6c6e.js +0 -1
- package/assets/esri/core/workers/chunks/991e0f619f1f81f94d56.js +0 -1
- package/assets/esri/core/workers/chunks/9a27824d94df702e6e28.js +0 -1
- package/assets/esri/core/workers/chunks/b1269b51cef3e11c85e3.js +0 -1
- package/assets/esri/core/workers/chunks/b33122adfd1fb68f7c0f.js +0 -1
- package/assets/esri/core/workers/chunks/bbbe5d6cb8b737811c84.js +0 -1
- package/assets/esri/core/workers/chunks/bf26f58210755875748c.js +0 -1
- package/assets/esri/core/workers/chunks/c1fd87af3129873369fd.js +0 -1
- package/assets/esri/core/workers/chunks/c4c2b94e5cee7b824093.js +0 -1
- package/assets/esri/core/workers/chunks/c85374360ac5e169af16.js +0 -1
- package/assets/esri/core/workers/chunks/c94ec324ecad77c53a87.js +0 -1
- package/assets/esri/core/workers/chunks/d175953337fa655dc6b0.js +0 -1
- package/assets/esri/core/workers/chunks/d8c762ca94e3a11b125d.js +0 -1
- package/assets/esri/core/workers/chunks/dbc447413ab40a79ba87.js +0 -1
- package/assets/esri/core/workers/chunks/e26dc0c1654316bb1558.js +0 -1
- package/assets/esri/core/workers/chunks/e410a09650530d7aad10.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../core/Accessor.js";import{difference as r}from"../../../core/arrayUtils.js";import s from"../../../core/CollectionFlattener.js";import 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 p from"../../../core/PooledArray.js";import{throwIfAborted as u,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{property as T}from"../../../core/accessorSupport/decorators/property.js";import{subclass as v}from"../../../core/accessorSupport/decorators/subclass.js";import{i as E,c as S}from"../../../chunks/vec32.js";import{create as w}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as C}from"../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as L}from"../../../geometry/ellipsoidUtils.js";import b from"../../../geometry/SpatialReference.js";import{getProjector as P}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 x,equals as U,intersection as R,intersectsSphere as j,empty as A,expand as I}from"../../../geometry/support/aaBoundingRect.js";import{create as B,copy as V}from"../../../geometry/support/frustum.js";import{isPlateCarree as k}from"../../../geometry/support/spatialReferenceUtils.js";import{e as O,a as G,c as N}from"../../../chunks/sphere.js";import{ElevationQueryTileCache as q}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as F}from"../../../layers/support/layerUtils.js";import{debugFlags as W}from"../support/debugFlags.js";import{ElevationRange as $}from"../support/ElevationRange.js";import{ElevationUpdateEvent as H}from"../support/ElevationUpdateEvent.js";import{toBoundingRect as Q}from"../support/extentUtils.js";import{ClientType as z}from"../support/index.js";import{updatingProgress as X}from"../support/updatingProperties.js";import{ElevationBounds as Y}from"./ElevationBounds.js";import{ElevationData as K,sampleElevation as J}from"./ElevationData.js";import{create as Z}from"./ExtentHelper.js";import{TextureUpdate as ee}from"./interfaces.js";import{LayerClass as te,LayerClasses as ie}from"./LayerClass.js";import{OverlayManager as re}from"./OverlayManager.js";import{PlanarPatch as se}from"./PlanarPatch.js";import{RenderOrder as ae}from"./RenderOrder.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 pe,maxTileNeighborLevelDelta as ue,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 Ee,isGroupLayerView as Se,isMapTileLayerView as we,isBlendableLayerView as Ce,isElevationLayerView as Le,releaseTerrainData as be,enableTerrainInternalChecks as Pe,neighborCornerIndices as Me,oppositeCorner as De,enableWaterproofTests as xe,enableInternalTerrainChecks as Ue,enableTerrainWaterproofChecks as Re}from"./terrainUtils.js";import{Tile as je,lijEquals as Ae}from"./Tile.js";import{printAllocations as Ie}from"./TilePerLayerInfo.js";import{TileUpdate as Be}from"./TileUpdate.js";import{IteratorPreorder as Ve,IteratorPostorder as ke,compareTilesByLij as Oe,hasLoadableSiblings as Ge,sortTilesByPOI as Ne}from"./tileUtils.js";import{TilingSchemeLogic as qe}from"./TilingSchemeLogic.js";import{TransparencyMode as Fe}from"./TransparencyMode.js";import{UpsampleInfo as We}from"./UpsampleInfo.js";import{isCompositeBlendMode as $e,blendModeFromString as He}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{PBRMode as Qe}from"../webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{RenderRequestType as ze}from"../webgl-engine/lib/basicInterfaces.js";import{RenderState as Xe}from"../../support/RenderState.js";import{ImmediateTask as Ye,TaskPriority as Ke,noBudget as Je}from"../../support/Scheduler.js";import{Yield as Ze}from"../../support/Yield.js";var et;let tt=et=class extends(a.EventedMixin(i)){get allTiles(){return this._allTiles}constructor(e){super(e),this._scaleRangeQueries=new ne,this._iteratorPool=new d(Ve,(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 _e,this._viewChanged=!1,this.heading=0,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=w(),this._eyePosSurfaceSR=w(),this._splitLimits=new oe,this._frustum=B(),this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._watchUpdatingTracking=new C,this._frameTask=Ye,this._allTiles=new p,this._upsampleInfoPool=new d(We),this._shouldEmitChangeEvent=!1,this._destroying=!1,this._rootTilesExtent=x(),this.updatingProgress=.5,this._maxNumUpdating=1,this.maxTextureScale=1.2,this._spatialReference=b.WebMercator,this._elevationProjectorCache=new Map,this.visibleElevationBounds=new Y(1/0,-1/0),this.rootTileElevationBounds=new Y(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.overlayManager=new re({...e,surface:this}),this._isGlobal=!e.view?.state?.isLocal,this._isGeographic=this._spatialReference?.isGeographic??!1,this._tileConstructor=this._isGlobal?le:se,this._ellipsoid=L(e.view.spatialReference)}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 q(i.newCache("elevation-query"));const r=this.overlayManager;this._renderer=new ge(r.renderer,e._stage,this._allTiles,this._ellipsoid.radius,i),this.addHandles([_((()=>r.renderer.isEmpty),(()=>this._evaluateTransparency())),_((()=>this.renderer.visible),(e=>this.suspended=!e)),_((()=>this.heading),(e=>{this._renderer.updateHeading(e),this._updateTileTextures(ee.FADING)})),_((()=>({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);(t===Xe.IDLE||Math.min(r,360-r)>=30)&&(this.heading=i)}))],"overlayManager"),this.addHandles([_((()=>this.baseOpacity),(()=>{this._handleLayerViewChanges(),this._updateTileTextures(this._evaluateTransparency()?ee.UNFADED:ee.IMMEDIATE)}),m),_((()=>this.hasCompositeBlendMode),(()=>this._updateTileTextures(this._evaluateTransparency()?ee.UNFADED:ee.IMMEDIATE)),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))})),_((()=>W.TERRAIN_TILE_TREE_SHOW_TILES),(t=>{t&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then((({TerrainTileTree3DDebugger:t})=>{!this._treeDebugger&&W.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new t({view:e}))})):t||(this._treeDebugger=o(this._treeDebugger))}),y)]),this.addHandles([_((()=>this._renderer.tileRenderer?.texturesBeingCompressed),((e,t)=>{t&&e<t&&(this.setMemoryDirty(),this._allTiles.forAll((e=>e.setMemoryDirty())))}))]),this.addHandles([_((()=>this._renderer.texturesBeingCompressed),((e,t)=>{0===e&&e!==t&&this.requestRender()}))]);const{spatialReference:a}=e;this._extentHelper=Z(this.viewingMode,{layers:e.map.allLayers,layerViews:e.allLayerViews,viewSpatialReference:a});const n=new s({getCollections:()=>e.defaultsFromMap?.mapCollections?.map((({layers:e})=>e)),getChildrenFunction:e=>e&&"layers"in e?e.layers:null}),l=new qe({layers:n,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:a});this._set("tilingSchemeLogic",l),this._updateTilingScheme(),this._elevationDataRequester=t.createStreamDataRequester(z.ELEVATION),this._mapDataRequester=t.createStreamDataRequester(z.BASEMAP);const d=t.scheduler;this._frameTask=d.registerTask(Ke.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?Qe.Simplified:Qe.Disabled),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)}destroy(){this._destroying=!0,this._frameTask.remove(),this._watchUpdatingTracking.destroy(),this._removeAllTiles(),this._set("tilingSchemeLogic",o(this.tilingSchemeLogic)),this._basemapLayerViewHandles.forEach(((e,t)=>this._unregisterTiledLayerView(t))),this._elevationDataRequester=null,this._mapDataRequester=null,this._set("overlayManager",o(this.overlayManager)),this._tileCache=o(this._tileCache),je.prune(),this._treeDebugger=o(this._treeDebugger),this._renderer=o(this._renderer),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()}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,{clippingArea:t}=this.view;if(null==t||null==e)return null;const i=x(),r=Q(t,i,e)?i:null,s=this._get("extent");return U(r,s)?s:r}get rootTilesExtent(){return this._rootTilesExtent}get extent(){const e=R(this.groundExtent,this._userClippingExtent,x()),t=this._get("extent");return U(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.running||this._watchUpdatingTracking?.updating||this._asyncWorkItems>0)&&this.ready&&!this.suspended||this.overlayManager?.updating||this.renderer.texturesBeingCompressed)}get running(){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}set renderOrder(e){this._renderer.renderOrder=e,this._set("renderOrder",e)}get rootTiles(){return this._rootTiles}get spatialReference(){return this.tilingScheme?.spatialReference??null}get backgroundColor(){return this.view?.map?.ground?.surfaceColor}set backgroundColor(e){this.view.map.ground.surfaceColor=e}set slicePlaneEnabled(e){this._renderer.slicePlaneEnabled=e,this._set("slicePlaneEnabled",e),this._evaluateTransparency()}get tilingSchemeLocked(){return this.tilingSchemeLogic?.tilingSchemeLocked??!1}get wireframe(){return this._renderer?.wireframe}set wireframe(e){e!==this._renderer.wireframe&&(this._renderer.wireframe=e,this._updateAllTileGeometries())}get opaque(){return this._renderer.transparency===Fe.Opaque}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)return null;if(0===s[0].layerInfo[te.ELEVATION].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=E(rt,e,t,i);a(l,0,l,0);return ot(s,l[0],l[1])}getElevations(e,t,i){const r=this._rootTiles,s=r?r[0].layerInfo[te.ELEVATION].length:0;if(r?.length&&0!==s)for(let a=0;a<t;++a){const t=3*a;i(a,ot(r,e[t],e[t+1]))}else for(let a=0;a<t;++a)i(a,null)}getScale(e){if(!this.tilingScheme)return null;if(!M(e,rt,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(rt)){let e=i;for(;e.children[0]&&!e.rendered;){const t=e.children[0].extent;let i=0;rt[0]>t[2]&&(i+=1),rt[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,st);const r=G(st);i(r,0,r,0);const s=new $,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,!j(i.extent,st))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 $(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,G(st),this.spatialReference))return n.getLogger(this).error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;st[3]=t;let i=null;const r=e=>{if(e&&j(e.extent,st)){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){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._allSurfaceLayersTransparent()?t?Fe.Invisible:Fe.InvisibleWithDraped:e>=1&&!this.hasCompositeBlendMode&&!this._renderer.slicePlaneEnabled?Fe.Opaque:Fe.Transparent;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??b.WebMercator;this._spatialReference=t,this._isWebMercator=!!t?.isWebMercator,this._isWebMercatorOnPlateCarree=this._isWebMercator&&k(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.setSpatialReference(e.spatialReference),this._updateRootTiles())}_acquireTile(e,t,i,r){const s=this._tileCache.pop(et._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 i=at;let s=t.rootTilesInExtent(e,i,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=r(e,s,Ae);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){const e=this._rootTiles.filter((e=>!(t.removed.findIndex((t=>Ae(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(pe),s=t.rootTilesInExtent(e,i,he)),this._setRootTiles(s.map((e=>this._newRootTile(e))));U(i,this._rootTilesExtent)||(this._rootTilesExtent=x(i)),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(Oe),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(Oe);const t=this.renderer;e.forEach((e=>t.updateGeometryIfNeeded(e))),e.forEach((e=>this._pendingTilesForElevationUpdateEvent.add(e)))}_shouldSplit(e){return e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.snapLevel)===Be.SPLIT}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return this._shouldSplit(t)&&t.setPendingUpdate(Be.SPLIT),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)}_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(Be.GEOMETRY)&&this._updateTileGeometryState(e)}_updateTilesVisibility(e){if(null==e)return;const t=Ge(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(Be.GEOMETRY)&&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 Y(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 Y(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??B(),t.frustum):this._splitLimits.frustum=null,V(this._frustum,e.frustum),S(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[te.MAP].some(fe)&&e.setPendingUpdate(Be.TEXTURE_FADING),this._pendingTilesToUpdate.add(e)}))}_updateTileTexture(e,t){const i=e.resetPendingUpdate(Be.TEXTURE_FADING)?Be.TEXTURE_FADING:!!e.resetPendingUpdate(Be.TEXTURE_NOFADING)&&Be.TEXTURE_NOFADING;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=null,t.madeProgress())}_emitElevationUpdateEventForTiles(){if(!this._shouldEmitChangeEvent)return;const e=nt.extent;A(e),this._pendingTilesForElevationUpdateEvent.forEach((t=>I(e,t.extent,e))),this._pendingTilesForElevationUpdateEvent.clear(),nt.spatialReference=this.spatialReference,this.emit("elevation-change",nt),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"),Pe&&this._checkTileInvariant(),!e.hasProgressed)return Ze}_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(Be.MERGE)){me(!t.hasPendingUpdate(Be.SPLIT),"Tile can be both split and merge at the same time");for(const e of t.children)me(e.leaf||e.hasPendingUpdate(Be.MERGE),"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}])`),me(r,`tile level delta [${t.level}] vs [${e.level}] > ${ue}`))}me(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(ye[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(!Ae(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<=ue,`Tile level delta [${t.level}] vs [${a.level}] > ${ue}`)}}})),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 ht(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(Be.MERGE),o=l?Be.MERGE:e.shouldSplit(r,s,i),h=o===Be.SPLIT;e.leaf?dt(e,h):t.pushAll(e.children),l?(e.resetPendingUpdate(Be.SPLIT),e.leaf||e.setPendingUpdate(Be.MERGE),this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(a)):h?(e.resetPendingUpdate(Be.MERGE),e.leaf&&e.setPendingUpdate(Be.SPLIT)):(e.resetPendingUpdate(Be.SPLIT)&&e.updateAgentSuspension(),o===Be.ELEVATION&&e.updateAgents(te.ELEVATION),e.leaf||(e.setPendingUpdate(Be.MERGE),e.resetPendingUpdate(Be.SPLIT)))}this.requestUpdate(),(this._shortBatches||!this._oneBatchPerFrameTask)&&this._updatePendingTileGeometries(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||(Ne(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger&&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(Oe);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=Me[e];i(r,l.cornerPeerNeighbors[e]?.findCorner(De(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)||Oe(r,t)<0),i(r,t),!0))),o((t+1)%4),o(t)}}e.clear(),this._updateTilesGeometries(t),this._shouldEmitChangeEvent=!0,Pe&&xe&&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(Be.MERGE)){if(!t||s.unmergableChildCount>0)return e.done;for(s.resetPendingUpdate(Be.MERGE);null!=n.parent&&0===n.parent.unmergableChildCount&&n.parent.resetPendingUpdate(Be.MERGE);)n=n.parent;this._mergeTile(n),a=!0,e.madeProgress()}else if(s.resetPendingUpdate(Be.SPLIT)){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(ye[r],e);null!=a&&i-a.level===ue&&(t=!1,Pe&&(Te(a.leaf),Te(a.hasPendingUpdate(Be.SPLIT))))}}t?(this._splitTile(s),e.madeProgress(),a=!0):s.setPendingUpdate(Be.SPLIT)}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(Be.GEOMETRY)&&(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(ze.UPDATE),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.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?ut(e):this._purgeSubtree(e),this._allTiles.removeUnordered(e),this._unloadTile(e),e.dispose(),this._tileCache.put(et._tileMemcacheKey,e)}_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"),ut(e);const t=e.createChildren();this._allTiles.pushArray(t),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=>dt(e,e.hasPendingUpdate(Be.SPLIT)))),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){lt.spatialReference=this.spatialReference,lt.extent=e.extent,lt.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",lt)}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(Be.SPLIT),s}get _shortBatches(){return this.view.state.mode!==Xe.IDLE}_mergeTile(e){me(!e.hasPendingUpdate(Be.SPLIT),"_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(),dt(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=Je){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),Ee(e)||Se(e))if(this._basemapLayerViewHandles.has(e.uid)&&!Se(e)){const i=this._layerClassFromLayerView(e),s=this._getLayerIdxByUID(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()}_allSurfaceLayersTransparent(){let e=0===this.view.map?.ground?.opacity;for(const t of this.view.allLayerViews.items)if(we(t)&&!F(t.layer)&&0!==t.fullOpacity)return e=!1,e;return e}_hasCompositeBlendMode(){for(const e of this.view.allLayerViews.items)if((Ce(e)||Se(e))&&$e(He[e.layer.blendMode]))return!0;return!1}_layerClassFromLayerView(e){return Le(e)?te.ELEVATION:te.MAP}_registerTiledLayerView(e){const t=[];if((Ce(e)||Se(e))&&t.push(_((()=>e.layer.blendMode),(()=>{this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._updateTileTextures(ee.UNFADED)}))),!Se(e)){const i=this._layerClassFromLayerView(e);t.push(_((()=>e.suspended),(()=>this._updateTiledLayers()))),t.push(_((()=>e.fullOpacity),(()=>this._updateTileTextures(ee.UNFADED)))),t.push(_((()=>"effectiveScaleRange"in e.layer?e.layer.effectiveScaleRange:null),(()=>this._restartAllAgents(i)))),t.push(e.on("data-changed",(()=>{const t=this._getLayerIdxByUID(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||!Ee(e)||!e.fullExtent)return;const r=this._layerClassFromLayerView(e);if(r===te.MAP){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),e===te.ELEVATION&&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(te.MAP),e===ee.IMMEDIATE?this.renderer.updateTileTexture(t,Be.TEXTURE_NOFADING):t.updateRenderData(te.MAP,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=ze.UPDATE){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,u(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=t===te.ELEVATION;return r.requester??=s?this._elevationDataRequester:this._mapDataRequester,s?Le(i)?this._requestElevationTileData(e,i,r):Promise.reject():we(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 ${te.ELEVATION}/${t.uid} error ${i}`),this._dataMissing(e,te.ELEVATION,t),this.requestUpdate())};return t.fetchTile(e.lij,i).then((e=>this._frameTask.schedule((()=>r(e)))),s).finally((()=>--this._asyncWorkItems))}_elevationDataArrived(e,t,i){const r=this._layerIndexByUid[te.ELEVATION].get(t.uid);if(null==r)return void n.getLogger(this).warn("TerrainSurface: received data from unknown layer %d %s",te.ELEVATION,e.lij.toString());const s=new K(e.lij,e.extent,i);e.dataArrived(r,te.ELEVATION,s);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)=>{be(s),g(i)||(console.error(`Tile ${e.lij.toString()} layer ${te.MAP}/${t.uid} error ${r}`),this._dataMissing(e,te.MAP,t),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule((()=>{this.requestUpdate(),g(i)?be(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._getLayerIdxByUID(te.MAP,t.uid);if(null==r)return be(i),void n.getLogger(this).warn("TerrainSurface: received data from unknown layer");e.dataArrived(r,te.MAP,i)}_getLayerIdxByUID(e,t){return this._layerIndexByUid[e].get(t)}_dataMissing(e,t,i){const r=this._getLayerIdxByUID(t,i.uid);null!=r?e.dataMissing(r,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._getLayerIdxByUID(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(!xe)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){Re(e)}};tt._tileMemcacheKey="TerrainTileMemcache",e([T()],tt.prototype,"_renderer",void 0),e([T({constructOnly:!0})],tt.prototype,"_scaleRangeQueries",void 0),e([T({constructOnly:!0})],tt.prototype,"view",void 0),e([T({constructOnly:!0})],tt.prototype,"overlayManager",void 0),e([T()],tt.prototype,"_hasPendingUpdates",void 0),e([T()],tt.prototype,"_asyncWorkItems",void 0),e([T()],tt.prototype,"_allTilesDirty",void 0),e([T()],tt.prototype,"_allTilesSorted",void 0),e([T()],tt.prototype,"_viewChanged",void 0),e([T({type:Number})],tt.prototype,"heading",void 0),e([T()],tt.prototype,"_splitLimits",void 0),e([T({readOnly:!0})],tt.prototype,"_watchUpdatingTracking",void 0),e([T()],tt.prototype,"_frameTask",void 0),e([T({readOnly:!0})],tt.prototype,"snapLevel",null),e([T({readOnly:!0})],tt.prototype,"lodSnappingEnabled",null),e([T()],tt.prototype,"_userClippingExtent",null),e([T()],tt.prototype,"_rootTilesExtent",void 0),e([T({readOnly:!0})],tt.prototype,"extent",null),e([T({readOnly:!0})],tt.prototype,"groundExtent",null),e([T({readOnly:!0})],tt.prototype,"_tilingSchemeExtent",null),e([T({readOnly:!0})],tt.prototype,"updating",null),e([T({readOnly:!0})],tt.prototype,"running",null),e([T(X)],tt.prototype,"updatingProgress",void 0),e([T({readOnly:!0})],tt.prototype,"updatingProgressValue",null),e([T()],tt.prototype,"_maxNumUpdating",void 0),e([T()],tt.prototype,"baseOpacity",null),e([T()],tt.prototype,"hasCompositeBlendMode",void 0),e([T({readOnly:!0})],tt.prototype,"viewingMode",null),e([T()],tt.prototype,"maxTextureScale",void 0),e([T({readOnly:!0})],tt.prototype,"ready",null),e([T({value:ae.FRONT_TO_BACK})],tt.prototype,"renderOrder",null),e([T({readOnly:!0})],tt.prototype,"rootTiles",null),e([T()],tt.prototype,"_rootTiles",void 0),e([T({readOnly:!0})],tt.prototype,"spatialReference",null),e([T({type:t})],tt.prototype,"backgroundColor",null),e([T({value:!1})],tt.prototype,"slicePlaneEnabled",null),e([T({readOnly:!0})],tt.prototype,"tilingScheme",void 0),e([T({readOnly:!0})],tt.prototype,"tilingSchemeLocked",null),e([T({readOnly:!0})],tt.prototype,"tilingSchemeLogic",void 0),e([T()],tt.prototype,"wireframe",null),e([T({value:!1})],tt.prototype,"suspended",null),e([T()],tt.prototype,"fadeDuration",null),e([T()],tt.prototype,"visibleElevationBounds",void 0),e([T()],tt.prototype,"rootTileElevationBounds",void 0),e([T()],tt.prototype,"_layerViewsDirty",void 0),e([T()],tt.prototype,"renderPatchBorders",null),e([T()],tt.prototype,"visualizeNormals",null),e([T()],tt.prototype,"renderingDisabled",null),tt=et=e([v("esri.views.3d.terrain.TerrainSurface")],tt);const it=tt,rt=w(),st=N(),at=x();new p;const nt=new H("ground"),lt={spatialReference:null,extent:null,scale:0};function ot(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 J(t,i,s)}return null}class ht{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 dt(e,t){!e.leaf||e.level<ue||gt(e,(e=>{t&&pt(e);const i=ct(e);if(e.maxLevelDeltaNeighborCount++,i){let t=e.parent;for(;t;){const e=ct(t);if(t.unmergableChildCount++,!e)break;t=t.parent}}}))}function pt(e){if(e.hasPendingUpdate(Be.SPLIT))return;let t=e.parent;for(;t?.resetPendingUpdate(Be.MERGE);)t=t.parent;e.resetPendingUpdate(Be.MERGE),e.leaf&&e.setPendingUpdate(Be.SPLIT),e.level<ue||gt(e,(e=>{pt(e)}))}function ut(e){e.level<ue||gt(e,(e=>{if(e.maxLevelDeltaNeighborCount--,0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount){let t=e.parent;for(;t&&(t.unmergableChildCount--,ct(t));)t=t.parent}}))}function ct(e){return 0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount}function gt(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(ye[n],a);if(!l||l.level!==i)continue;const o=l.lij;o[1]===r&&o[2]===s||t(l)}}export{it as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../core/Accessor.js";import{difference as r}from"../../../core/arrayUtils.js";import s from"../../../core/CollectionFlattener.js";import 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 p from"../../../core/PooledArray.js";import{throwIfAborted as u,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{property as T}from"../../../core/accessorSupport/decorators/property.js";import{subclass as v}from"../../../core/accessorSupport/decorators/subclass.js";import{i as E,c as S}from"../../../chunks/vec32.js";import{create as w}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as C}from"../../../core/support/UpdatingHandles.js";import{getReferenceEllipsoid as L}from"../../../geometry/ellipsoidUtils.js";import b from"../../../geometry/SpatialReference.js";import{getProjector as P}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 x,equals as U,intersection as R,intersectsSphere as j,empty as A,expand as I}from"../../../geometry/support/aaBoundingRect.js";import{create as B,copy as V}from"../../../geometry/support/frustum.js";import{isPlateCarree as k}from"../../../geometry/support/spatialReferenceUtils.js";import{e as O,a as G,c as N}from"../../../chunks/sphere.js";import{ElevationQueryTileCache as q}from"../../../layers/support/ElevationQueryTileCache.js";import{isBaseLayer as F}from"../../../layers/support/layerUtils.js";import{debugFlags as W}from"../support/debugFlags.js";import{ElevationRange as $}from"../support/ElevationRange.js";import{ElevationUpdateEvent as H}from"../support/ElevationUpdateEvent.js";import{toBoundingRect as Q}from"../support/extentUtils.js";import{ClientType as z}from"../support/index.js";import{updatingProgress as X}from"../support/updatingProperties.js";import{ElevationBounds as Y}from"./ElevationBounds.js";import{ElevationData as K,sampleElevation as J}from"./ElevationData.js";import{create as Z}from"./ExtentHelper.js";import{TextureUpdate as ee}from"./interfaces.js";import{LayerClass as te,LayerClasses as ie}from"./LayerClass.js";import{OverlayManager as re}from"./OverlayManager.js";import{PlanarPatch as se}from"./PlanarPatch.js";import{RenderOrder as ae}from"./RenderOrder.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 pe,maxTileNeighborLevelDelta as ue,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 Ee,isGroupLayerView as Se,isMapTileLayerView as we,isBlendableLayerView as Ce,isElevationLayerView as Le,releaseTerrainData as be,enableTerrainInternalChecks as Pe,neighborCornerIndices as Me,oppositeCorner as De,enableWaterproofTests as xe,enableInternalTerrainChecks as Ue,enableTerrainWaterproofChecks as Re}from"./terrainUtils.js";import{Tile as je,lijEquals as Ae}from"./Tile.js";import{printAllocations as Ie}from"./TilePerLayerInfo.js";import{TileUpdate as Be}from"./TileUpdate.js";import{IteratorPreorder as Ve,IteratorPostorder as ke,compareTilesByLij as Oe,hasLoadableSiblings as Ge,sortTilesByPOI as Ne}from"./tileUtils.js";import{TilingSchemeLogic as qe}from"./TilingSchemeLogic.js";import{TransparencyMode as Fe}from"./TransparencyMode.js";import{UpsampleInfo as We}from"./UpsampleInfo.js";import{isCompositeBlendMode as $e,blendModeFromString as He}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{PBRMode as Qe}from"../webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{RenderRequestType as ze}from"../webgl-engine/lib/basicInterfaces.js";import{RenderState as Xe}from"../../support/RenderState.js";import{ImmediateTask as Ye,TaskPriority as Ke,noBudget as Je}from"../../support/Scheduler.js";import{Yield as Ze}from"../../support/Yield.js";var et;let tt=et=class extends(a.EventedMixin(i)){get allTiles(){return this._allTiles}constructor(e){super(e),this._scaleRangeQueries=new ne,this._iteratorPool=new d(Ve,(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 _e,this._viewChanged=!1,this.heading=0,this._inFrameTask=!1,this._viewChangeUpdateDirty=!1,this._eyePosRenderSR=w(),this._eyePosSurfaceSR=w(),this._splitLimits=new oe,this._frustum=B(),this._layerViews=[new Array,new Array],this._layerIndexByUid=[new Map,new Map],this._basemapLayerViewHandles=new Map,this._watchUpdatingTracking=new C,this._frameTask=Ye,this._allTiles=new p,this._upsampleInfoPool=new d(We),this._shouldEmitChangeEvent=!1,this._destroying=!1,this._rootTilesExtent=x(),this.updatingProgress=.5,this._maxNumUpdating=1,this.maxTextureScale=1.2,this._spatialReference=b.WebMercator,this._elevationProjectorCache=new Map,this.visibleElevationBounds=new Y(1/0,-1/0),this.rootTileElevationBounds=new Y(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.overlayManager=new re({...e,surface:this}),this._isGlobal=!e.view?.state?.isLocal,this._isGeographic=this._spatialReference?.isGeographic??!1,this._tileConstructor=this._isGlobal?le:se,this._ellipsoid=L(e.view.spatialReference)}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 q(i.newCache("elevation-query"));const r=this.overlayManager;this._renderer=new ge(r.renderer,e._stage,this._allTiles,this._ellipsoid.radius,i),this.addHandles([_((()=>r.renderer.isEmpty),(()=>this._evaluateTransparency())),_((()=>this.renderer.visible),(e=>this.suspended=!e)),_((()=>this.heading),(e=>{this._renderer.updateHeading(e),this._updateTileTextures(ee.FADING)})),_((()=>({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);(t===Xe.IDLE||Math.min(r,360-r)>=30)&&(this.heading=i)}))],"overlayManager"),this.addHandles([_((()=>this.baseOpacity),(()=>{this._handleLayerViewChanges(),this._updateTileTextures(this._evaluateTransparency()?ee.UNFADED:ee.IMMEDIATE)}),m),_((()=>this.hasCompositeBlendMode),(()=>this._updateTileTextures(this._evaluateTransparency()?ee.UNFADED:ee.IMMEDIATE)),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))})),_((()=>W.TERRAIN_TILE_TREE_SHOW_TILES),(t=>{t&&!this._treeDebugger?import("../layers/support/TerrainTileTree3DDebugger.js").then((({TerrainTileTree3DDebugger:t})=>{!this._treeDebugger&&W.TERRAIN_TILE_TREE_SHOW_TILES&&(this._treeDebugger=new t({view:e}))})):t||(this._treeDebugger=o(this._treeDebugger))}),y)]),this.addHandles([_((()=>this._renderer.tileRenderer?.texturesBeingCompressed),((e,t)=>{t&&e<t&&(this.setMemoryDirty(),this._allTiles.forAll((e=>e.setMemoryDirty())))}))]),this.addHandles([_((()=>this._renderer.texturesBeingCompressed),((e,t)=>{0===e&&e!==t&&this.requestRender()}))]);const{spatialReference:a}=e;this._extentHelper=Z(this.viewingMode,{layers:e.map.allLayers,layerViews:e.allLayerViews,viewSpatialReference:a});const n=new s({getCollections:()=>e.defaultsFromMap?.mapCollections?.map((({layers:e})=>e)),getChildrenFunction:e=>e&&"layers"in e?e.layers:null}),l=new qe({layers:n,extentHelper:this._extentHelper,viewingMode:this.viewingMode,viewSpatialReference:a});this._set("tilingSchemeLogic",l),this._updateTilingScheme(),this._elevationDataRequester=t.createStreamDataRequester(z.ELEVATION),this._mapDataRequester=t.createStreamDataRequester(z.BASEMAP);const d=t.scheduler;this._frameTask=d.registerTask(Ke.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?Qe.Simplified:Qe.Disabled),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)}destroy(){this._destroying=!0,this._frameTask.remove(),this._watchUpdatingTracking.destroy(),this._removeAllTiles(),this._set("tilingSchemeLogic",o(this.tilingSchemeLogic)),this._basemapLayerViewHandles.forEach(((e,t)=>this._unregisterTiledLayerView(t))),this._elevationDataRequester=null,this._mapDataRequester=null,this._set("overlayManager",o(this.overlayManager)),this._tileCache=o(this._tileCache),je.prune(),this._treeDebugger=o(this._treeDebugger),this._renderer=o(this._renderer),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()}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,{clippingArea:t}=this.view;if(null==t||null==e)return null;const i=x(),r=Q(t,i,e)?i:null,s=this._get("extent");return U(r,s)?s:r}get rootTilesExtent(){return this._rootTilesExtent}get extent(){const e=R(this.groundExtent,this._userClippingExtent,x()),t=this._get("extent");return U(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.running||this._watchUpdatingTracking?.updating||this._asyncWorkItems>0)&&this.ready&&!this.suspended||this.overlayManager?.updating||this.renderer.texturesBeingCompressed)}get running(){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}set renderOrder(e){this._renderer.renderOrder=e,this._set("renderOrder",e)}get rootTiles(){return this._rootTiles}get spatialReference(){return this.tilingScheme?.spatialReference??null}get backgroundColor(){return this.view?.map?.ground?.surfaceColor}set backgroundColor(e){this.view.map.ground.surfaceColor=e}set slicePlaneEnabled(e){this._renderer.slicePlaneEnabled=e,this._set("slicePlaneEnabled",e),this._evaluateTransparency()}get tilingSchemeLocked(){return this.tilingSchemeLogic?.tilingSchemeLocked??!1}get wireframe(){return this._renderer?.wireframe}set wireframe(e){e!==this._renderer.wireframe&&(this._renderer.wireframe=e,this._updateAllTileGeometries())}get opaque(){return this._renderer.transparency===Fe.Opaque}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)return null;if(0===s[0].layerInfo[te.ELEVATION].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=E(rt,e,t,i);a(l,0,l,0);return ot(s,l[0],l[1])}getElevations(e,t,i){const r=this._rootTiles,s=r?r[0].layerInfo[te.ELEVATION].length:0;if(r?.length&&0!==s)for(let a=0;a<t;++a){const t=3*a;i(a,ot(r,e[t],e[t+1]))}else for(let a=0;a<t;++a)i(a,null)}getScale(e){if(!this.tilingScheme)return null;if(!M(e,rt,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(rt)){let e=i;for(;e.children[0]&&!e.rendered;){const t=e.children[0].extent;let i=0;rt[0]>t[2]&&(i+=1),rt[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,st);const r=G(st);i(r,0,r,0);const s=new $,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,!j(i.extent,st))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 $(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,G(st),this.spatialReference))return n.getLogger(this).error("TerrainSurface.getSphereScale(): could not project given point to tiling scheme coordinate system"),null;st[3]=t;let i=null;const r=e=>{if(e&&j(e.extent,st)){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){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._allSurfaceLayersTransparent()?t?Fe.Invisible:Fe.InvisibleWithDraped:e>=1&&!this.hasCompositeBlendMode&&!this._renderer.slicePlaneEnabled?Fe.Opaque:Fe.Transparent;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??b.WebMercator;this._spatialReference=t,this._isWebMercator=!!t?.isWebMercator,this._isWebMercatorOnPlateCarree=this._isWebMercator&&k(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())}_acquireTile(e,t,i,r){const s=this._tileCache.pop(et._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 i=at;let s=t.rootTilesInExtent(e,i,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=r(e,s,Ae);if(this._updatingRootTiles=!0,t.removed.length>0||t.added.length>0){const e=this._rootTiles.filter((e=>!(t.removed.findIndex((t=>Ae(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(pe),s=t.rootTilesInExtent(e,i,he)),this._setRootTiles(s.map((e=>this._newRootTile(e))));U(i,this._rootTilesExtent)||(this._rootTilesExtent=x(i)),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(Oe),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(Oe);const t=this.renderer;e.forEach((e=>t.updateGeometryIfNeeded(e))),e.forEach((e=>this._pendingTilesForElevationUpdateEvent.add(e)))}_shouldSplit(e){return e.shouldSplit(this._splitLimits,this._eyePosRenderSR,this.snapLevel)===Be.SPLIT}_newRootTile(e){const t=this._acquireTile(0,e[1],e[2],null);return this._shouldSplit(t)&&t.setPendingUpdate(Be.SPLIT),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)}_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(Be.GEOMETRY)&&this._updateTileGeometryState(e)}_updateTilesVisibility(e){if(null==e)return;const t=Ge(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(Be.GEOMETRY)&&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 Y(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 Y(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??B(),t.frustum):this._splitLimits.frustum=null,V(this._frustum,e.frustum),S(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[te.MAP].some(fe)&&e.setPendingUpdate(Be.TEXTURE_FADING),this._pendingTilesToUpdate.add(e)}))}_updateTileTexture(e,t){const i=e.resetPendingUpdate(Be.TEXTURE_FADING)?Be.TEXTURE_FADING:!!e.resetPendingUpdate(Be.TEXTURE_NOFADING)&&Be.TEXTURE_NOFADING;i&&(this._renderer.updateTileTexture(e,i),this._usedMemory=null,t.madeProgress())}_emitElevationUpdateEventForTiles(){if(!this._shouldEmitChangeEvent)return;const e=nt.extent;A(e),this._pendingTilesForElevationUpdateEvent.forEach((t=>I(e,t.extent,e))),this._pendingTilesForElevationUpdateEvent.clear(),nt.spatialReference=this.spatialReference,this.emit("elevation-change",nt),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"),Pe&&this._checkTileInvariant(),!e.hasProgressed)return Ze}_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(Be.MERGE)){me(!t.hasPendingUpdate(Be.SPLIT),"Tile can be both split and merge at the same time");for(const e of t.children)me(e.leaf||e.hasPendingUpdate(Be.MERGE),"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}])`),me(r,`tile level delta [${t.level}] vs [${e.level}] > ${ue}`))}me(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(ye[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(!Ae(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<=ue,`Tile level delta [${t.level}] vs [${a.level}] > ${ue}`)}}})),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 ht(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(Be.MERGE),o=l?Be.MERGE:e.shouldSplit(r,s,i),h=o===Be.SPLIT;e.leaf?dt(e,h):t.pushAll(e.children),l?(e.resetPendingUpdate(Be.SPLIT),e.leaf||e.setPendingUpdate(Be.MERGE),this._updateClippingStatus(e),e.updateVisibility(),e.updateScreenDepth(a)):h?(e.resetPendingUpdate(Be.MERGE),e.leaf&&e.setPendingUpdate(Be.SPLIT)):(e.resetPendingUpdate(Be.SPLIT)&&e.updateAgentSuspension(),o===Be.ELEVATION&&e.updateAgents(te.ELEVATION),e.leaf||(e.setPendingUpdate(Be.MERGE),e.resetPendingUpdate(Be.SPLIT)))}this.requestUpdate(),(this._shortBatches||!this._oneBatchPerFrameTask)&&this._updatePendingTileGeometries(),e.madeProgress()}_sortTiles(e){e.done||this._allTilesSorted||(Ne(this._allTiles,this.view.pointsOfInterest.focus.renderLocation),this._allTilesSorted=!0,this._treeDebugger&&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(Oe);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=Me[e];i(r,l.cornerPeerNeighbors[e]?.findCorner(De(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)||Oe(r,t)<0),i(r,t),!0))),o((t+1)%4),o(t)}}e.clear(),this._updateTilesGeometries(t),this._shouldEmitChangeEvent=!0,Pe&&xe&&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(Be.MERGE)){if(!t||s.unmergableChildCount>0)return e.done;for(s.resetPendingUpdate(Be.MERGE);null!=n.parent&&0===n.parent.unmergableChildCount&&n.parent.resetPendingUpdate(Be.MERGE);)n=n.parent;this._mergeTile(n),a=!0,e.madeProgress()}else if(s.resetPendingUpdate(Be.SPLIT)){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(ye[r],e);null!=a&&i-a.level===ue&&(t=!1,Pe&&(Te(a.leaf),Te(a.hasPendingUpdate(Be.SPLIT))))}}t?(this._splitTile(s),e.madeProgress(),a=!0):s.setPendingUpdate(Be.SPLIT)}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(Be.GEOMETRY)&&(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(ze.UPDATE),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.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?ut(e):this._purgeSubtree(e),this._allTiles.removeUnordered(e),this._unloadTile(e),e.dispose(),this._tileCache.put(et._tileMemcacheKey,e)}_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"),ut(e);const t=e.createChildren();this._allTiles.pushArray(t),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=>dt(e,e.hasPendingUpdate(Be.SPLIT)))),++this._performanceInfo.numSplit}_emitTileScaleChange(e,t=e.level){lt.spatialReference=this.spatialReference,lt.extent=e.extent,lt.scale=this._getLodBiasCorrectedScale(t),this.emit("scale-change",lt)}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(Be.SPLIT),s}get _shortBatches(){return this.view.state.mode!==Xe.IDLE}_mergeTile(e){me(!e.hasPendingUpdate(Be.SPLIT),"_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(),dt(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=Je){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),Ee(e)||Se(e))if(this._basemapLayerViewHandles.has(e.uid)&&!Se(e)){const i=this._layerClassFromLayerView(e),s=this._getLayerIdxByUID(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()}_allSurfaceLayersTransparent(){let e=0===this.view.map?.ground?.opacity;for(const t of this.view.allLayerViews.items)if(we(t)&&!F(t.layer)&&0!==t.fullOpacity)return e=!1,e;return e}_hasCompositeBlendMode(){for(const e of this.view.allLayerViews.items)if((Ce(e)||Se(e))&&$e(He[e.layer.blendMode]))return!0;return!1}_layerClassFromLayerView(e){return Le(e)?te.ELEVATION:te.MAP}_registerTiledLayerView(e){const t=[];if((Ce(e)||Se(e))&&t.push(_((()=>e.layer.blendMode),(()=>{this.hasCompositeBlendMode=this._hasCompositeBlendMode(),this._updateTileTextures(ee.UNFADED)}))),!Se(e)){const i=this._layerClassFromLayerView(e);t.push(_((()=>e.suspended),(()=>this._updateTiledLayers()))),t.push(_((()=>e.fullOpacity),(()=>this._updateTileTextures(ee.UNFADED)))),t.push(_((()=>"effectiveScaleRange"in e.layer?e.layer.effectiveScaleRange:null),(()=>this._restartAllAgents(i)))),t.push(e.on("data-changed",(()=>{const t=this._getLayerIdxByUID(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||!Ee(e)||!e.fullExtent)return;const r=this._layerClassFromLayerView(e);if(r===te.MAP){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),e===te.ELEVATION&&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(te.MAP),e===ee.IMMEDIATE?this.renderer.updateTileTexture(t,Be.TEXTURE_NOFADING):t.updateRenderData(te.MAP,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=ze.UPDATE){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,u(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=t===te.ELEVATION;return r.requester??=s?this._elevationDataRequester:this._mapDataRequester,s?Le(i)?this._requestElevationTileData(e,i,r):Promise.reject():we(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 ${te.ELEVATION}/${t.uid} error ${i}`),this._dataMissing(e,te.ELEVATION,t),this.requestUpdate())};return t.fetchTile(e.lij,i).then((e=>this._frameTask.schedule((()=>r(e)))),s).finally((()=>--this._asyncWorkItems))}_elevationDataArrived(e,t,i){const r=this._layerIndexByUid[te.ELEVATION].get(t.uid);if(null==r)return void n.getLogger(this).warn("TerrainSurface: received data from unknown layer %d %s",te.ELEVATION,e.lij.toString());const s=new K(e.lij,e.extent,i);e.dataArrived(r,te.ELEVATION,s);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)=>{be(s),g(i)||(console.error(`Tile ${e.lij.toString()} layer ${te.MAP}/${t.uid} error ${r}`),this._dataMissing(e,te.MAP,t),this.requestUpdate())},s=e=>t=>r(t,e),a=r=>this._frameTask.schedule((()=>{this.requestUpdate(),g(i)?be(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._getLayerIdxByUID(te.MAP,t.uid);if(null==r)return be(i),void n.getLogger(this).warn("TerrainSurface: received data from unknown layer");e.dataArrived(r,te.MAP,i)}_getLayerIdxByUID(e,t){return this._layerIndexByUid[e].get(t)}_dataMissing(e,t,i){const r=this._getLayerIdxByUID(t,i.uid);null!=r?e.dataMissing(r,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._getLayerIdxByUID(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(!xe)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){Re(e)}};tt._tileMemcacheKey="TerrainTileMemcache",e([T()],tt.prototype,"_renderer",void 0),e([T({constructOnly:!0})],tt.prototype,"_scaleRangeQueries",void 0),e([T({constructOnly:!0})],tt.prototype,"view",void 0),e([T({constructOnly:!0})],tt.prototype,"overlayManager",void 0),e([T()],tt.prototype,"_hasPendingUpdates",void 0),e([T()],tt.prototype,"_asyncWorkItems",void 0),e([T()],tt.prototype,"_allTilesDirty",void 0),e([T()],tt.prototype,"_allTilesSorted",void 0),e([T()],tt.prototype,"_viewChanged",void 0),e([T({type:Number})],tt.prototype,"heading",void 0),e([T()],tt.prototype,"_splitLimits",void 0),e([T({readOnly:!0})],tt.prototype,"_watchUpdatingTracking",void 0),e([T()],tt.prototype,"_frameTask",void 0),e([T({readOnly:!0})],tt.prototype,"snapLevel",null),e([T({readOnly:!0})],tt.prototype,"lodSnappingEnabled",null),e([T()],tt.prototype,"_userClippingExtent",null),e([T()],tt.prototype,"_rootTilesExtent",void 0),e([T({readOnly:!0})],tt.prototype,"extent",null),e([T({readOnly:!0})],tt.prototype,"groundExtent",null),e([T({readOnly:!0})],tt.prototype,"_tilingSchemeExtent",null),e([T({readOnly:!0})],tt.prototype,"updating",null),e([T({readOnly:!0})],tt.prototype,"running",null),e([T(X)],tt.prototype,"updatingProgress",void 0),e([T({readOnly:!0})],tt.prototype,"updatingProgressValue",null),e([T()],tt.prototype,"_maxNumUpdating",void 0),e([T()],tt.prototype,"baseOpacity",null),e([T()],tt.prototype,"hasCompositeBlendMode",void 0),e([T({readOnly:!0})],tt.prototype,"viewingMode",null),e([T()],tt.prototype,"maxTextureScale",void 0),e([T({readOnly:!0})],tt.prototype,"ready",null),e([T({value:ae.FRONT_TO_BACK})],tt.prototype,"renderOrder",null),e([T({readOnly:!0})],tt.prototype,"rootTiles",null),e([T()],tt.prototype,"_rootTiles",void 0),e([T({readOnly:!0})],tt.prototype,"spatialReference",null),e([T({type:t})],tt.prototype,"backgroundColor",null),e([T({value:!1})],tt.prototype,"slicePlaneEnabled",null),e([T({readOnly:!0})],tt.prototype,"tilingScheme",void 0),e([T({readOnly:!0})],tt.prototype,"tilingSchemeLocked",null),e([T({readOnly:!0})],tt.prototype,"tilingSchemeLogic",void 0),e([T()],tt.prototype,"wireframe",null),e([T({value:!1})],tt.prototype,"suspended",null),e([T()],tt.prototype,"fadeDuration",null),e([T()],tt.prototype,"visibleElevationBounds",void 0),e([T()],tt.prototype,"rootTileElevationBounds",void 0),e([T()],tt.prototype,"_layerViewsDirty",void 0),e([T()],tt.prototype,"renderPatchBorders",null),e([T()],tt.prototype,"visualizeNormals",null),e([T()],tt.prototype,"renderingDisabled",null),tt=et=e([v("esri.views.3d.terrain.TerrainSurface")],tt);const it=tt,rt=w(),st=N(),at=x();new p;const nt=new H("ground"),lt={spatialReference:null,extent:null,scale:0};function ot(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 J(t,i,s)}return null}class ht{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 dt(e,t){!e.leaf||e.level<ue||gt(e,(e=>{t&&pt(e);const i=ct(e);if(e.maxLevelDeltaNeighborCount++,i){let t=e.parent;for(;t;){const e=ct(t);if(t.unmergableChildCount++,!e)break;t=t.parent}}}))}function pt(e){if(e.hasPendingUpdate(Be.SPLIT))return;let t=e.parent;for(;t?.resetPendingUpdate(Be.MERGE);)t=t.parent;e.resetPendingUpdate(Be.MERGE),e.leaf&&e.setPendingUpdate(Be.SPLIT),e.level<ue||gt(e,(e=>{pt(e)}))}function ut(e){e.level<ue||gt(e,(e=>{if(e.maxLevelDeltaNeighborCount--,0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount){let t=e.parent;for(;t&&(t.unmergableChildCount--,ct(t));)t=t.parent}}))}function ct(e){return 0===e.maxLevelDeltaNeighborCount&&0===e.unmergableChildCount}function gt(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(ye[n],a);if(!l||l.level!==i)continue;const o=l.lij;o[1]===r&&o[2]===s||t(l)}}export{it as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import r from"../../../core/PooledArray.js";import{isPromiseLike as s}from"../../../core/promiseUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{isIntersectionHandler as o}from"../state/helpers/SceneIntersectionHelper.js";import{ChangeSet as d}from"./lib/ChangeSet.js";import{UpdatePolicy as a}from"./lib/UpdatePolicy.js";import{isWebGLLayer as h}from"./lib/WebGLLayer.js";import{Model as y}from"./parts/Model.js";import{RenderView as c}from"./parts/RenderView.js";import{TaskPriority as l,noBudget as m}from"../../support/Scheduler.js";import{Yield as p}from"../../support/Yield.js";let _=class extends t{constructor(e){super(e),this._model=new y,this._layers=new r,this._asyncChangeSet=new d,this._syncChangeSet=new d,this._layerSyncSet=new Set}initialize(){this._set("renderView",new c({stage:this})),this._frameTask=this.view.resourceController.scheduler.registerTask(l.STAGE,this),this.addHandles(this._frameTask)}destroy(){this.renderView.destroy()}get viewingMode(){return this.view.state.viewingMode}get updating(){return this.running||this.renderView.updating||this._frameTask.updating}get renderer(){return this.renderView?.renderer}add(e){this._model.add(e),h(e)&&this._addLayer(e),this.renderView.requestRender()}remove(e){null!=e&&!this.destroyed&&this._model.remove(e)&&(h(e)&&this._removeLayer(e),this.renderView.requestRender())}addMany(e){null!=e&&(this._model.addMany(e),this.renderView.requestRender())}removeMany(e){null!=e&&(this._model?.removeMany(e),this.renderView?.requestRender())}forEachOfType(e,t){this._model.forEachOfType(e,t)}handleEvent(e,t){this.destroyed||(this._model.dirtySet[e](t),this.renderView.requestRender())}get running(){return this._model.dirtySet.dirty||!this._asyncChangeSet.empty}runTask(e){if(this._frameTask.processQueue(e),this._commit(e),!e.hasProgressed)return p}_commit(e){const t=this._model.dirtySet;this._asyncChangeSet.empty||e.done||(this.renderer.modify(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()),this._layers.forAll((r=>{if(e.done)return;const s=this._layerSyncSet.has(r.id)||r.updatePolicy===a.SYNC,i=s?this._syncChangeSet:this._asyncChangeSet;t.commitLayer(r.id,i),this._layerSyncSet.delete(r.id),i.empty||(this.renderer.modify(i,s?m:e),this.renderView.requestRender(),e.madeProgress())})),this._syncChangeSet.empty||(this.renderer.modify(this._syncChangeSet,m),this.renderView.requestRender(),e.madeProgress()),this._layers.forAll((r=>{e.done||this._layerSyncSet.has(r.id)||r.updatePolicy!==a.ASYNC||(t.commitLayer(r.id,this._asyncChangeSet),this._asyncChangeSet.empty||(this.renderer.modify(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()))})),this._layerSyncSet.clear(),this.notifyChange("running")}commitSyncLayers(){const e=this._model.dirtySet;this._layers.forAll((t=>{this._layerSyncSet.has(t.id)||t.updatePolicy===a.SYNC?(e.commitLayer(t.id,this._syncChangeSet),this._layerSyncSet.delete(t.id)):e.commitSyncUpdates(t.id,this._syncChangeSet)}));for(const t of this._layerSyncSet)e.commitLayer(t,this._syncChangeSet);this._layerSyncSet.clear(),this._syncChangeSet.empty||(this.renderer.modify(this._syncChangeSet,m),this.renderView.requestRender())}_commitLayer(e){this._model.dirtySet.commitLayer(e.id,this._syncChangeSet),this._layerSyncSet.delete(e.id),this._syncChangeSet.empty||(this.renderer.modify(this._syncChangeSet,m),this.renderView.requestRender())}schedule(e,t){return this._frameTask.schedule(e,t)}reschedule(e,t){return this._frameTask.reschedule(e,t)}syncLayer(e){this._layerSyncSet.add(e),this.renderView.requestRender()}getObject(e){return this._model.getObject(e)}get layers(){return this._layers}_addLayer(e){this._layers.includes(e)||this._layers.push(e)}_removeLayer(e){this._commitLayer(e),null!=this._layers.removeUnordered(e)&&(this._model.dirtySet.getResidentRenderGeometries(e.id,this._syncChangeSet.removes),this.renderer.modify(this._syncChangeSet,m))}addRenderPlugin(e,t){const r=this.renderer.plugins.add(e,t),i=()=>{o(e)&&this.view.sceneIntersectionHelper.addIntersectionHandler(e)};if(s(r))return r.then(i);i()}removeRenderPlugin(e){this.destroyed||(o(e)&&this.view.sceneIntersectionHelper.removeIntersectionHandler(e),this.renderer.plugins.remove(e))}get performanceInfo(){return this._model.getStats()}get test(){}};e([i({constructOnly:!0})],_.prototype,"view",void 0),e([i({constructOnly:!0})],_.prototype,"options",void 0),e([i({readOnly:!0})],_.prototype,"viewingMode",null),e([i({constructOnly:!0})],_.prototype,"container",void 0),e([i({readOnly:!0})],_.prototype,"updating",null),e([i({constructOnly:!0})],_.prototype,"_model",void 0),e([i()],_.prototype,"renderView",void 0),e([i({readOnly:!0})],_.prototype,"renderer",null),e([i({readOnly:!0})],_.prototype,"running",null),_=e([n("esri.views.3d.webgl-engine.Stage")],_);export{_ as Stage};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{lerp as t,clamp as s,smoothstep as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../../../core/maybe.js";import{watch as o,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as m}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{l as h,k as c}from"../../../../../chunks/vec32.js";import{s as p}from"../../../../../chunks/vec42.js";import{earth as u}from"../../../../../geometry/support/Ellipsoid.js";import{InternalRenderCategory as d}from"../../../webgl.js";import{ColorFormat as l}from"../../../webgl/formats.js";import{TransparentEnvironment as _}from"../TransparentEnvironment.js";import{H as f}from"../../../../../chunks/HazeCompositing.glsl.js";import{HazeCompositingTechnique as g}from"./HazeCompositingTechnique.js";import{HazePassParameters as b,HazeTechnique as w}from"./HazeTechnique.js";import{HazeTechniqueConfiguration as P}from"./HazeTechniqueConfiguration.js";import{createQuadVAO as j,Layout as v}from"../../lib/glUtil3D.js";import{applyTextureResizeModulo as A}from"../../lib/textureUtils.js";import{PrimitiveType as T}from"../../../../webgl/enums.js";let C=class extends _{constructor(e){super(e),this._compositingPassParameters=new f,this._passParameters=new b,this._hazeConfiguration=new P,this._vao=null,this.requireGeometryDepth=!0,this._oldAmount=1,this._newAmount=1,this._amount=this._newAmount;const t=e.view._stage.renderView.techniques;t.precompile(w,new P);const s=new P;s.reduced=!0,t.precompile(w,s),t.precompile(g)}initialize(){this.addHandles([o((()=>this.view.environment.atmosphereEnabled),(e=>e?this._enable():this._disable()),a),o((()=>this.view._stage?.renderer.renderContext.bind.clouds.fadeFactor??1),(e=>this._fade(e)),a),o((()=>this.view.environment.weather.type),(e=>this._newAmount="rainy"===e?0:1),a),o((()=>this.view._stage.renderer?.fullResolutionAtmosphere),(e=>this._hazeConfiguration.reduced=!e),a)])}_fade(e){e>=1?(this._amount=this._newAmount,this._oldAmount=this._newAmount):this._amount=e<=0?this._oldAmount:t(this._oldAmount,this._newAmount,e)}destroy(){this._vao=i(this._vao)}render(e){const s=e.find((({name:e})=>e===d.TRANSPARENT_ENVIRONMENT));if(!this.bindParameters.mainDepth)return s;const r=this.renderingContext;this._vao??=j(r,v.Pos2Tex);const i=this.techniques.get(w,this._hazeConfiguration);if(!i.compiled)return s;const o=s.getAttachment(r.gl.DEPTH_STENCIL_ATTACHMENT);if(this._update(),!this._hazeConfiguration.reduced)return s.detachDepth(),r.bindFramebuffer(s.fbo),r.bindTechnique(i,this.bindParameters,this._passParameters),this._renderCommon(r),s.attachDepth(o),s;const a=this.techniques.get(g);if(!a.compiled)return s;const n=r.getViewport(),m=this.camera,c=h(m.eye)-u.radius;let p;const _=u.atmosphereHeight;if(c<_){const e=Math.min(1,Math.max(0,c/_));p=t(.4,.5,e)}else{const e=Math.min(1,Math.max(0,(c-_)/(15*_)));p=t(.5,1,e)}const f=A(Math.round(p*m.fullViewport[2])),b=A(Math.round(p*m.fullViewport[3]));r.setViewport(0,0,f,b);const P=this.fboCache.acquire(f,b,"haze",l.RGBA);return r.bindFramebuffer(P.fbo),r.clearFramebuffer([0,0,0,1],!0,!0),r.bindTechnique(i,this.bindParameters,this._passParameters),this._renderCommon(r),r.setViewport(n.x,n.y,n.width,n.height),this._compositingPassParameters.color=P.getTexture(),s.detachDepth(),r.bindFramebuffer(s.fbo),r.bindTechnique(a,this.bindParameters,this._compositingPassParameters),r.screen.draw(),s.attachDepth(o),P.release(),s}_renderCommon(e){null!=this._vao&&(e.bindVAO(this._vao),e.drawArrays(T.TRIANGLE_STRIP,0,4))}_update(){const e=this.bindParameters.camera,i=c(e.eye),o=Math.sqrt(i),a=i-this._passParameters.radii[1]*this._passParameters.radii[1],n=s((o-this._passParameters.radii[0])/u.atmosphereHeight,0,1);p(this._passParameters.heightParameters,o,i,a,n);const h=this.view.basemapTerrain
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{lerp as t,clamp as s,smoothstep as r}from"../../../../../core/mathUtils.js";import{disposeMaybe as i}from"../../../../../core/maybe.js";import{watch as o,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import"../../../../../core/Logger.js";import"../../../../../core/has.js";import"../../../../../core/RandomLCG.js";import"../../../../../core/Error.js";import{subclass as n}from"../../../../../core/accessorSupport/decorators/subclass.js";import{set as m}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{l as h,k as c}from"../../../../../chunks/vec32.js";import{s as p}from"../../../../../chunks/vec42.js";import{earth as u}from"../../../../../geometry/support/Ellipsoid.js";import{InternalRenderCategory as d}from"../../../webgl.js";import{ColorFormat as l}from"../../../webgl/formats.js";import{TransparentEnvironment as _}from"../TransparentEnvironment.js";import{H as f}from"../../../../../chunks/HazeCompositing.glsl.js";import{HazeCompositingTechnique as g}from"./HazeCompositingTechnique.js";import{HazePassParameters as b,HazeTechnique as w}from"./HazeTechnique.js";import{HazeTechniqueConfiguration as P}from"./HazeTechniqueConfiguration.js";import{createQuadVAO as j,Layout as v}from"../../lib/glUtil3D.js";import{applyTextureResizeModulo as A}from"../../lib/textureUtils.js";import{PrimitiveType as T}from"../../../../webgl/enums.js";let C=class extends _{constructor(e){super(e),this._compositingPassParameters=new f,this._passParameters=new b,this._hazeConfiguration=new P,this._vao=null,this.requireGeometryDepth=!0,this._oldAmount=1,this._newAmount=1,this._amount=this._newAmount;const t=e.view._stage.renderView.techniques;t.precompile(w,new P);const s=new P;s.reduced=!0,t.precompile(w,s),t.precompile(g)}initialize(){this.addHandles([o((()=>this.view.environment.atmosphereEnabled),(e=>e?this._enable():this._disable()),a),o((()=>this.view._stage?.renderer.renderContext.bind.clouds.fadeFactor??1),(e=>this._fade(e)),a),o((()=>this.view.environment.weather.type),(e=>this._newAmount="rainy"===e?0:1),a),o((()=>this.view._stage.renderer?.fullResolutionAtmosphere),(e=>this._hazeConfiguration.reduced=!e),a)])}_fade(e){e>=1?(this._amount=this._newAmount,this._oldAmount=this._newAmount):this._amount=e<=0?this._oldAmount:t(this._oldAmount,this._newAmount,e)}destroy(){this._vao=i(this._vao)}render(e){const s=e.find((({name:e})=>e===d.TRANSPARENT_ENVIRONMENT));if(!this.bindParameters.mainDepth)return s;const r=this.renderingContext;this._vao??=j(r,v.Pos2Tex);const i=this.techniques.get(w,this._hazeConfiguration);if(!i.compiled)return s;const o=s.getAttachment(r.gl.DEPTH_STENCIL_ATTACHMENT);if(this._update(),!this._hazeConfiguration.reduced)return s.detachDepth(),r.bindFramebuffer(s.fbo),r.bindTechnique(i,this.bindParameters,this._passParameters),this._renderCommon(r),s.attachDepth(o),s;const a=this.techniques.get(g);if(!a.compiled)return s;const n=r.getViewport(),m=this.camera,c=h(m.eye)-u.radius;let p;const _=u.atmosphereHeight;if(c<_){const e=Math.min(1,Math.max(0,c/_));p=t(.4,.5,e)}else{const e=Math.min(1,Math.max(0,(c-_)/(15*_)));p=t(.5,1,e)}const f=A(Math.round(p*m.fullViewport[2])),b=A(Math.round(p*m.fullViewport[3]));r.setViewport(0,0,f,b);const P=this.fboCache.acquire(f,b,"haze",l.RGBA);return r.bindFramebuffer(P.fbo),r.clearFramebuffer([0,0,0,1],!0,!0),r.bindTechnique(i,this.bindParameters,this._passParameters),this._renderCommon(r),r.setViewport(n.x,n.y,n.width,n.height),this._compositingPassParameters.color=P.getTexture(),s.detachDepth(),r.bindFramebuffer(s.fbo),r.bindTechnique(a,this.bindParameters,this._compositingPassParameters),r.screen.draw(),s.attachDepth(o),P.release(),s}_renderCommon(e){null!=this._vao&&(e.bindVAO(this._vao),e.drawArrays(T.TRIANGLE_STRIP,0,4))}_update(){const e=this.bindParameters.camera,i=c(e.eye),o=Math.sqrt(i),a=i-this._passParameters.radii[1]*this._passParameters.radii[1],n=s((o-this._passParameters.radii[0])/u.atmosphereHeight,0,1);p(this._passParameters.heightParameters,o,i,a,n);const h=this.view.basemapTerrain?.getLowerBoundRadius()??0;m(this._passParameters.radii,h,h+u.atmosphereHeight),this._passParameters.hazeStrength=t(t(.6,1,r(9500,10500,o-u.radius)),1,this._amount)}};C=e([n("esri.views.3d.webgl-engine.effects.haze.Haze")],C);export{C as Haze};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Evented.js";import{unpackFloatRGBA as s}from"../../../../core/floatRGBA.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{removeMaybe as n,destroyMaybe as o}from"../../../../core/maybe.js";import{watch as a,initial as h,syncAndInitial as p}from"../../../../core/reactiveUtils.js";import{addFrameTask as c}from"../../../../core/scheduling.js";import{Milliseconds as d}from"../../../../core/time.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{isMoon as u,isMars as f}from"../../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as _}from"../../../ViewingMode.js";import{ChapmanAtmosphere as g}from"../../environment/ChapmanAtmosphere.js";import{CloudsComposition as w}from"../../environment/CloudsComposition.js";import{Fog as v}from"../../environment/Fog.js";import{LocalAtmosphere as x}from"../../environment/LocalAtmosphere.js";import j from"../../environment/MarsAtmosphere.js";import{ComponentObjectCollection as y}from"../collections/Component/ComponentObjectCollection.js";import{ShaderTechniqueConstructionContext as R}from"../core/shaderTechnique/ShaderTechniqueConstructionContext.js";import{ShaderTechniqueRepository as b}from"../core/shaderTechnique/ShaderTechniqueRepository.js";import{ObjectAndLayerIDRenderNode as A}from"../effects/geometry/ObjectAndLayerIDRenderNode.js";import{olidEnabled as C}from"../effects/geometry/olidUtils.js";import{RenderOccludedRenderNode as T}from"../effects/geometry/RenderOccludedRenderNode.js";import{Haze as O}from"../effects/haze/Haze.js";import{Highlight as S}from"../effects/highlight/Highlight.js";import{ShadowHighlight as U}from"../effects/highlight/ShadowHighlight.js";import{Magnifier as q}from"../effects/magnifier/Magnifier.js";import{SMAA as L}from"../effects/smaa/SMAA.js";import{SSAO as M}from"../effects/ssao/SSAO.js";import{Stars as D}from"../effects/stars/Stars.js";import{RenderRequestType as k}from"../lib/basicInterfaces.js";import E from"../lib/CompositingHelper.js";import{GLMaterialRepository as H}from"../lib/GLMaterialRepository.js";import{ObjectAndLayerIdRenderHelper as W}from"../lib/ObjectAndLayerIdRenderHelper.js";import{Renderer as B}from"../lib/Renderer.js";import{RenderingContext as F}from"../lib/RenderingContext.js";import{TextureRepository as G}from"../lib/TextureRepository.js";import{createMarkerTextureRepository as N}from"../materials/markerTextureRepository.js";import{createStippleTextureRepository as I}from"../materials/stippleTextureRepository.js";import{WaterTextureRepository as z}from"../materials/internal/WaterTextureRepository.js";import{getContextCache as P}from"./contextCache.js";import{removeLoadedShaderModules as K}from"./renderUtils.js";import{ScreenshotManager as V,ScreenshotContext as X}from"./ScreenshotManager.js";import{contextCache as J}from"./testUtils.js";import{RenderState as Q}from"../../../support/RenderState.js";let Y=class extends t{constructor(e){super({}),this.events=new r,this.waterTextures=new z,this.olidRenderHelper=C()?new W:null,this._needsUpdate=!0,this._needsRender=!0,this._idleSuspend=!0,this._needsWaterReflectionUpdate=!1,this._lastAnimationUpdate=0,this._container=e.container,this._viewingMode=e.viewingMode;try{this._initializeContext(e)}catch(i){return void console.error("Failed to initialize context",i)}const{memoryController:t}=e.view.resourceController;this.stippleTextures=I(this._rctx,t),this.markerTextures=N(this._rctx,t),this._techniques=new b(new R(this._rctx,e.viewingMode,this.stippleTextures,this.waterTextures,this.markerTextures)),this._textures=new G(e,this._techniques,this._rctx),this.addHandles(this._textures.events.on("changed",(e=>this.requestRender(e)))),this._materials=new H(this._textures,this._techniques,(()=>this.requestRender()),(()=>this.requestRender())),this._compositingHelper=new E(this._rctx,this._techniques),this.renderer=new B(e,this._materials,this._techniques,this._rctx,this._compositingHelper,(e=>this.requestRender(e))),this.addHandles([a((()=>e.view.ready),(t=>{t&&this._createRenderNodes(e.view,e.viewingMode)}),h),a((()=>this.waterTextures?.updating),(()=>this.requestRender()),h),a((()=>e.view.qualityProfile),(e=>this.renderer?.updateRenderFeatures(e)),p)]);const s={renderScene:(e,t,r,s)=>this.renderer.render(e,t,r,s),requestRenderScene:e=>this.requestRender(e),prepareOverlay:()=>e.options.screenshot.prepareOverlay(),renderOverlay:(t,r,s)=>e.options.screenshot.renderOverlay(t,r,s)};this._screenshotManager=new V(this._rctx,s,(e=>this.events.emit("force-camera-for-screenshot",e))),this._registerFrameTask(e)}normalizeCtorArgs(){return{}}destroy(){this._container.contains(this._canvas)&&this._container.removeChild(this._canvas),this._frameTask=n(this._frameTask),this._techniques=o(this._techniques),this._componentObjects=o(this._componentObjects),this._screenshotManager=o(this._screenshotManager),o(this.renderer),this._textures=o(this._textures),o(this.waterTextures),o(this.markerTextures),o(this.stippleTextures),this._canvas=null,this._container=null,this._rctx=o(this._rctx)}_createRenderNodes(e,t){new D({view:e}),u(e.spatialReference)||(t===_.Local?new x({view:e}):f(e.spatialReference)?new j({view:e}):(new g({view:e}),new w({view:e}),new O({view:e}),new v({view:e}))),new M({view:e,isEnabled:()=>this.renderer.hasSSAO}),new L({view:e,isEnabled:()=>this.renderer.hasSMAA}),new q({view:e}),new S({view:e}),new U({view:e,viewingMode:t}),new T({view:e}),C()&&new A({view:e})}requestRender(e=k.UPDATE){this._needsRender=!0,e===k.UPDATE&&(this._needsUpdate=!0)}get updating(){return this._needsUpdate||this._needsWaterReflectionUpdate||this.renderer.updating||this._textures.updating||this.waterTextures.updating}get textures(){return this._textures}get techniques(){return this._techniques}get compositingHelper(){return this._compositingHelper}setIdleSuspend(e){this._idleSuspend!==e&&(this._idleSuspend=e,this.requestRender())}get renderingContext(){return this._rctx}get capabilities(){return this._rctx.capabilities}get canvas(){return this._canvas}takeScreenshot(e){return this._screenshotManager.takeScreenshot(e).then((e=>e[0]))}takeScreenshotWithOID(e){return e.objectAndLayerIdColor=!0,this._screenshotManager.takeScreenshot(e)}getAlpha(){return!!this._rctx.contextAttributes.alpha}getMinimalDepthForArea(e,t,r,i,n,o=n){const a=i.constrainWindowSize(t,r,n*i.pixelRatio,o*i.pixelRatio),h=this._ensureLinearDepthArrayBuffer(a);this.renderer.readMainDepth(a,h);const p=(e,t,r)=>s(t,e)*(r[1]-r[0])+r[0];let c=Number.MAX_VALUE;for(let s=0;s<a[2]*a[3];s++){const e=p(4*s,h,i.nearFar);c>e&&e!==i.nearFar[0]&&e!==i.nearFar[1]&&(c=e)}if(e){const s=e.pickDepth(t*i.pixelRatio,r*i.pixelRatio,i);null!=s&&c>s&&s!==i.nearFar[0]&&s!==i.nearFar[1]&&(c=s)}return c===Number.MAX_VALUE?void 0:c}_ensureLinearDepthArrayBuffer(e){const t=4*e[2]*e[3];return(null==this._tmpDepthBuffer||this._tmpDepthBuffer.byteLength<t)&&(this._tmpDepthBuffer=new Uint8Array(t)),this._tmpDepthBuffer}async reloadShaders(){K(),await this._techniques.reloadAll(),this.renderer.overlay?.reloadShaders(),this.requestRender()}_registerFrameTask(e){const t=e.view.state;let r=!1,s=k.BACKGROUND,i=!1;const n={preRender:({time:i})=>{r=this.updating,s=this._needsUpdate?k.UPDATE:k.BACKGROUND,e.commitSyncLayers();(d(i-this._lastAnimationUpdate)>this.renderer.animationTimestep||null!=t.forcedAnimationTime||r||this._needsRender)&&(this.renderer.updateAnimation(t,i)&&this.requestRender(k.BACKGROUND),this._lastAnimationUpdate=i)},render:({time:e})=>{if((this._needsRender||!this._idleSuspend||!this.renderer.isCameraFinal||this._needsWaterReflectionUpdate)&&t.camera.fullWidth>0&&t.camera.fullHeight>0){const r=this._needsUpdate&&this._idleSuspend&&this.renderer.isCameraFinal;this._needsRender=!1,this._needsUpdate=!1,this._needsWaterReflectionUpdate=!1,this.renderer.render(t,e),i=!0,r&&this.renderer.hasReflections&&(this.requestRender(k.BACKGROUND),this._needsWaterReflectionUpdate=!0)}},update:({time:e})=>{this._textures.update();const r=new X(t,this.renderer.fboCache);this._screenshotManager.update(r,e)},finish:()=>{i&&(this.renderer.finish(t.mode===Q.IDLE?s:k.UPDATE),i=!1)}};this._frameTask=c(n)}_initializeContext(e){const t=e.options;this._canvas=t.canvas??document.createElement("canvas"),this._canvas.setAttribute("style","width: 100%; height:100%; display:block;");const r={alpha:t.alpha||!1,premultipliedAlpha:!0,antialias:!1,depth:!0,stencil:t.stencil??!0,powerPreference:"high-performance",preserveDrawingBuffer:t.preserveDrawingBuffer??!1},s=this._canvas.getContext("webgl2",r);null!=s?(this._rctx=Z(s,e),this._loadShaderOnlyExtensions(),!t.alpha&&this._rctx.contextAttributes.alpha&&i.getLogger(this).error("WebGL context has alpha channel even though no alpha channel was requested"),!this._rctx.contextAttributes.alpha&&has("safari")>=11&&(this._container.style.backgroundColor="black"),this._container.contains(this._canvas)||this._container.appendChild(this._canvas)):i.getLogger(this).error("A WebGL2 context could not be created.")}_loadShaderOnlyExtensions(){this._rctx.capabilities.enable("textureFloatLinear")}getObjectAndLayerIdColor(e){return this.olidRenderHelper?.getObjectAndLayerIdColor(e)}get componentObjectCollection(){return null==this._componentObjects&&(this._componentObjects=new y(this.renderer.renderPassManager,this._viewingMode)),this._componentObjects}set componentObjectCollection(e){this._componentObjects=e}};function Z(e,t){const r=(e,r)=>t.view.resourceController.memoryController.newCache(e,r),s={disabledExtensions:t.options.deactivatedWebGLExtensions||{},debugWebGLExtensions:t.options.debugWebGLExtensions||{},maxAnisotropy:8,newCache:r};if(J.enabled){let t=$.get(e);return t?(t.configure(s),t.ref(),t):(t=new F(e,s),$.set(e,t),t.ref(),t)}return new F(e,s)}e([l({type:Boolean,readOnly:!0})],Y.prototype,"updating",null),e([l()],Y.prototype,"_rctx",void 0),e([l()],Y.prototype,"_container",void 0),e([l()],Y.prototype,"_canvas",void 0),e([l()],Y.prototype,"stippleTextures",void 0),e([l()],Y.prototype,"markerTextures",void 0),e([l()],Y.prototype,"waterTextures",void 0),e([l({readOnly:!0})],Y.prototype,"olidRenderHelper",void 0),e([l()],Y.prototype,"_textures",void 0),e([l({readOnly:!0})],Y.prototype,"renderer",void 0),e([l()],Y.prototype,"_screenshotManager",void 0),e([l()],Y.prototype,"componentObjectCollection",null),e([l()],Y.prototype,"_componentObjects",void 0),e([l()],Y.prototype,"_needsUpdate",void 0),e([l()],Y.prototype,"_needsWaterReflectionUpdate",void 0),Y=e([m("esri.views.3d.webgl-engine.parts.RenderView")],Y);const $=P();export{Y as RenderView};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import r from"../../../../core/Evented.js";import{unpackFloatRGBA as s}from"../../../../core/floatRGBA.js";import has from"../../../../core/has.js";import i from"../../../../core/Logger.js";import{removeMaybe as n,destroyMaybe as o}from"../../../../core/maybe.js";import{watch as a,initial as h,syncAndInitial as d}from"../../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../../core/scheduling.js";import{Milliseconds as c}from"../../../../core/time.js";import{property as l}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/RandomLCG.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{isMoon as u,isMars as f}from"../../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as _}from"../../../ViewingMode.js";import{ChapmanAtmosphere as g}from"../../environment/ChapmanAtmosphere.js";import{CloudsComposition as w}from"../../environment/CloudsComposition.js";import{Fog as v}from"../../environment/Fog.js";import{LocalAtmosphere as x}from"../../environment/LocalAtmosphere.js";import y from"../../environment/MarsAtmosphere.js";import{ComponentObjectCollection as j}from"../collections/Component/ComponentObjectCollection.js";import{ShaderTechniqueConstructionContext as R}from"../core/shaderTechnique/ShaderTechniqueConstructionContext.js";import{ShaderTechniqueRepository as b}from"../core/shaderTechnique/ShaderTechniqueRepository.js";import{ObjectAndLayerIDRenderNode as A}from"../effects/geometry/ObjectAndLayerIDRenderNode.js";import{olidEnabled as T}from"../effects/geometry/olidUtils.js";import{RenderOccludedRenderNode as C}from"../effects/geometry/RenderOccludedRenderNode.js";import{Haze as S}from"../effects/haze/Haze.js";import{Highlight as O}from"../effects/highlight/Highlight.js";import{ShadowHighlight as U}from"../effects/highlight/ShadowHighlight.js";import{Magnifier as q}from"../effects/magnifier/Magnifier.js";import{SMAA as D}from"../effects/smaa/SMAA.js";import{SSAO as L}from"../effects/ssao/SSAO.js";import{Stars as M}from"../effects/stars/Stars.js";import{RenderRequestType as k}from"../lib/basicInterfaces.js";import E from"../lib/CompositingHelper.js";import{GLMaterialRepository as F}from"../lib/GLMaterialRepository.js";import{ObjectAndLayerIdRenderHelper as H}from"../lib/ObjectAndLayerIdRenderHelper.js";import{Renderer as W}from"../lib/Renderer.js";import{RenderingContext as B}from"../lib/RenderingContext.js";import{TextureRepository as G}from"../lib/TextureRepository.js";import{createMarkerTextureRepository as N}from"../materials/markerTextureRepository.js";import{createStippleTextureRepository as I}from"../materials/stippleTextureRepository.js";import{WaterTextureRepository as P}from"../materials/internal/WaterTextureRepository.js";import{getContextCache as z}from"./contextCache.js";import{removeLoadedShaderModules as K}from"./renderUtils.js";import{ScreenshotManager as V,ScreenshotContext as Q}from"./ScreenshotManager.js";import{contextCache as X}from"./testUtils.js";import{RenderState as J}from"../../../support/RenderState.js";let Y=class extends t{constructor(e){super(e),this.events=new r,this.waterTextures=new P,this.olidRenderHelper=T()?new H:null,this._needsUpdate=!0,this._needsRender=!0,this._idleSuspend=!0,this._needsWaterReflectionUpdate=!1,this._lastAnimationUpdate=0,this._savedFadeDuration=c(0);const t=e.stage;try{this._initializeContext(t)}catch(n){return void console.error("Failed to initialize context",n)}const{memoryController:s}=t.view.resourceController;this.stippleTextures=I(this._rctx,s),this.markerTextures=N(this._rctx,s),this._techniques=new b(new R(this._rctx,t.viewingMode,this.stippleTextures,this.waterTextures,this.markerTextures)),this._textures=new G(t,this._techniques,this._rctx),this.addHandles(this._textures.events.on("changed",(e=>this.requestRender(e)))),this._materials=new F(this._textures,this._techniques,(()=>this.requestRender()),(()=>this.requestRender())),this._compositingHelper=new E(this._rctx,this._techniques),this.renderer=new W(t,this._materials,this._techniques,this._rctx,this._compositingHelper,(e=>this.requestRender(e))),this.addHandles([a((()=>t.view.ready),(e=>{e&&this._createRenderNodes()}),h),a((()=>this.waterTextures?.updating),(()=>this.requestRender()),h),a((()=>t.view.qualityProfile),(e=>this.renderer?.updateRenderFeatures(e)),d)]);const i={renderScene:(e,t,r,s)=>this.renderer.render(e,t,r,s),requestRenderScene:e=>this.requestRender(e),prepareOverlay:()=>t.options.screenshot.prepareOverlay(),renderOverlay:(e,r,s)=>t.options.screenshot.renderOverlay(e,r,s)};this._screenshotManager=new V(this._rctx,i,(e=>this.events.emit("force-camera-for-screenshot",e))),this._registerFrameTask(t)}destroy(){const e=this.stage?.container;e?.contains(this._canvas)&&e.removeChild(this._canvas),this._frameTask=n(this._frameTask),this._techniques=o(this._techniques),this._componentObjects=o(this._componentObjects),this._screenshotManager=o(this._screenshotManager),o(this.renderer),this._textures=o(this._textures),o(this.waterTextures),o(this.markerTextures),o(this.stippleTextures),this._canvas=null,this._rctx=o(this._rctx)}_createRenderNodes(){const{view:e,viewingMode:t}=this.stage;new M({view:e}),u(e.spatialReference)||(t===_.Local?new x({view:e}):f(e.spatialReference)?new y({view:e}):(new g({view:e}),new w({view:e}),new S({view:e}),new v({view:e}))),new L({view:e,isEnabled:()=>this.renderer.hasSSAO}),new D({view:e,isEnabled:()=>this.renderer.hasSMAA}),new q({view:e}),new O({view:e}),new U({view:e,viewingMode:t}),new C({view:e}),T()&&new A({view:e})}requestRender(e=k.UPDATE){this._needsRender=!0,e===k.UPDATE&&(this._needsUpdate=!0)}get updating(){return this._needsUpdate||this._needsWaterReflectionUpdate||this.renderer.updating||this._textures.updating||this.waterTextures.updating}get textures(){return this._textures}get techniques(){return this._techniques}get compositingHelper(){return this._compositingHelper}setIdleSuspend(e){this._idleSuspend!==e&&(this._idleSuspend=e,this.requestRender())}get renderingContext(){return this._rctx}get capabilities(){return this._rctx.capabilities}get canvas(){return this._canvas}takeScreenshot(e){return this._screenshotManager.takeScreenshot(e).then((e=>e[0]))}takeScreenshotWithOID(e){return e.objectAndLayerIdColor=!0,this._screenshotManager.takeScreenshot(e)}getAlpha(){return!!this._rctx.contextAttributes.alpha}getMinimalDepthForArea(e,t,r,i,n,o=n){const a=i.constrainWindowSize(t,r,n*i.pixelRatio,o*i.pixelRatio),h=this._ensureLinearDepthArrayBuffer(a);this.renderer.readMainDepth(a,h);const d=(e,t,r)=>s(t,e)*(r[1]-r[0])+r[0];let p=Number.MAX_VALUE;for(let s=0;s<a[2]*a[3];s++){const e=d(4*s,h,i.nearFar);p>e&&e!==i.nearFar[0]&&e!==i.nearFar[1]&&(p=e)}if(e){const s=e.pickDepth(t*i.pixelRatio,r*i.pixelRatio,i);null!=s&&p>s&&s!==i.nearFar[0]&&s!==i.nearFar[1]&&(p=s)}return p===Number.MAX_VALUE?void 0:p}_ensureLinearDepthArrayBuffer(e){const t=4*e[2]*e[3];return(null==this._tmpDepthBuffer||this._tmpDepthBuffer.byteLength<t)&&(this._tmpDepthBuffer=new Uint8Array(t)),this._tmpDepthBuffer}async reloadShaders(){K(),await this._techniques.reloadAll(),this.renderer.overlay?.reloadShaders(),this.requestRender()}_registerFrameTask(e){const t=e.view.state;let r=!1,s=k.BACKGROUND,i=!1;const n={preRender:({time:i})=>{r=this.updating,s=this._needsUpdate?k.UPDATE:k.BACKGROUND,e.commitSyncLayers(),i=this._testTime??i;(c(i-this._lastAnimationUpdate)>this.renderer.animationTimestep||null!=t.forcedAnimationTime||r||this._needsRender)&&(this.renderer.updateAnimation(t,i)&&this.requestRender(k.BACKGROUND),this._lastAnimationUpdate=i)},render:({time:e})=>{if((this._needsRender||!this._idleSuspend||!this.renderer.isCameraFinal||this._needsWaterReflectionUpdate)&&t.camera.fullWidth>0&&t.camera.fullHeight>0){const r=this._needsUpdate&&this._idleSuspend&&this.renderer.isCameraFinal;this._needsRender=!1,this._needsUpdate=!1,this._needsWaterReflectionUpdate=!1,e=this._testTime??e,this.renderer.render(t,e),i=!0,r&&this.renderer.hasReflections&&(this.requestRender(k.BACKGROUND),this._needsWaterReflectionUpdate=!0)}},update:({time:e})=>{this._textures.update();const r=new Q(t,this.renderer.fboCache);e=this._testTime??e,this._screenshotManager.update(r,e)},finish:()=>{i&&(this.renderer.finish(t.mode===J.IDLE?s:k.UPDATE),i=!1)}};this._frameTask=p(n)}_initializeContext(e){const{options:t}=e,r=t.canvas??document.createElement("canvas");r.setAttribute("style","width: 100%; height:100%; display:block;"),this._canvas=r;const s={alpha:t.alpha||!1,premultipliedAlpha:!0,antialias:!1,depth:!0,stencil:t.stencil??!0,powerPreference:"high-performance",preserveDrawingBuffer:t.preserveDrawingBuffer??!1},n=r.getContext("webgl2",s);if(null==n)return void i.getLogger(this).error("A WebGL2 context could not be created.");this._rctx=Z(n,e),this._loadShaderOnlyExtensions(),!t.alpha&&this._rctx.contextAttributes.alpha&&i.getLogger(this).error("WebGL context has alpha channel even though no alpha channel was requested");const{container:o}=e;!this._rctx.contextAttributes.alpha&&has("safari")>=11&&(o.style.backgroundColor="black"),o.contains(r)||o.appendChild(r)}_loadShaderOnlyExtensions(){this._rctx.capabilities.enable("textureFloatLinear")}get _viewingMode(){return this.stage.viewingMode}getObjectAndLayerIdColor(e){return this.olidRenderHelper?.getObjectAndLayerIdColor(e)}get componentObjectCollection(){return null==this._componentObjects&&(this._componentObjects=new j(this.renderer.renderPassManager,this._viewingMode)),this._componentObjects}set componentObjectCollection(e){this._componentObjects=e}updateQualitySettings(e){null!=this._testTime&&(this._savedFadeDuration=e.fadeDuration,e.fadeDuration=c(0))}set testTime(e){this._testTime=e,null==e?this.stage.view.qualitySettings.fadeDuration=this._savedFadeDuration:this.updateQualitySettings(this.stage.view.qualitySettings)}get testTime(){return this._testTime}};function Z(e,t){const r=(e,r)=>t.view.resourceController.memoryController.newCache(e,r),s={disabledExtensions:t.options.deactivatedWebGLExtensions||{},debugWebGLExtensions:t.options.debugWebGLExtensions||{},maxAnisotropy:8,newCache:r};if(X.enabled){let t=$.get(e);return t?(t.configure(s),t.ref(),t):(t=new B(e,s),$.set(e,t),t.ref(),t)}return new B(e,s)}e([l({type:Boolean,readOnly:!0})],Y.prototype,"updating",null),e([l({constructOnly:!0})],Y.prototype,"stage",void 0),e([l()],Y.prototype,"_rctx",void 0),e([l()],Y.prototype,"_canvas",void 0),e([l()],Y.prototype,"stippleTextures",void 0),e([l()],Y.prototype,"markerTextures",void 0),e([l()],Y.prototype,"waterTextures",void 0),e([l({readOnly:!0})],Y.prototype,"olidRenderHelper",void 0),e([l()],Y.prototype,"_textures",void 0),e([l({readOnly:!0})],Y.prototype,"renderer",void 0),e([l()],Y.prototype,"_screenshotManager",void 0),e([l()],Y.prototype,"componentObjectCollection",null),e([l()],Y.prototype,"_componentObjects",void 0),e([l()],Y.prototype,"_needsUpdate",void 0),e([l()],Y.prototype,"_needsWaterReflectionUpdate",void 0),Y=e([m("esri.views.3d.webgl-engine.parts.RenderView")],Y);const $=z();export{Y as RenderView};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{createResolver as e}from"../../../../core/promiseUtils.js";import{clone as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderRequestType as r}from"../lib/basicInterfaces.js";import{RendererTarget as i}from"../lib/rendererUtils.js";import{RenderState as s}from"../../../support/RenderState.js";import{resampleHermite as o}from"../../../support/screenshotUtils.js";import{PixelFormat as n,DataType as a}from"../../../webgl/enums.js";import{ensureAttachmentMaxSize as c}from"../../../webgl/FramebufferObject.js";import{createEmptyImageData as h}from"../../../../core/imageUtils.js";class l{constructor(e,t){this.parameters=e,this.fbos=t}}class d{constructor(e,t,r){this._rctx=e,this._renderFunctions=t,this._forceCameraHook=r,this.supersample=!0,this._screenshotQueue=new Array}destroy(){this._rctx=null}async takeScreenshot(t){await this._renderFunctions.prepareOverlay(),this._renderFunctions.requestRenderScene(r.BACKGROUND);const i=e();return this._screenshotQueue.push({settings:t,resolver:i}),i.promise}update(e,t){for(const r of this._screenshotQueue){if(null==this._rctx){r.resolver.reject();continue}const i={...r.settings,pixelRatio:r.settings.pixelRatio*e.parameters.camera.pixelRatio},s=this._renderScreenshot(e,i,t);r.resolver(s)}this._screenshotQueue.length=0}_renderScreenshotOverlay(e,t,r){e.width=t.width,e.height=t.height;const i=e.getContext("2d"),s=r.pixelRatio;return i.save(),i.translate(0,t.height),i.scale(1,-1),r.region&&i.translate(-r.region.x,-r.region.y),i.scale(s,s),t=this._renderFunctions.renderOverlay(e,r.disableDecorations,t),i.restore(),t}_readbackScreenshot(e,t){return e.resample?this._readbackScreenshotResampled({...e,resample:e.resample},t):this._readbackScreenshotImmediate(e,t)}_readbackScreenshotResampled(e,t){const{framebufferWidth:r,framebufferHeight:i,region:s,resample:c}=e,l=this._ensureScreenshotEncodeCanvas();let d=h(r,i,l);this._rctx.gl.readPixels(0,0,r,i,n.RGBA,a.UNSIGNED_BYTE,new Uint8Array(d.data.buffer)),t(),d=this._renderScreenshotOverlay(l,d,{...e,region:void 0});const f=h(s.width,s.height,l);return o(d,f,!0,c.region.x,i-(c.region.y+c.region.height),c.region.width,c.region.height)}_readbackScreenshotImmediate(e,t){const{framebufferHeight:r,region:i}=e,s=this._ensureScreenshotEncodeCanvas(),o=h(i.width,i.height,s);return this._rctx.gl.readPixels(i.x,r-(i.y+i.height),i.width,i.height,n.RGBA,a.UNSIGNED_BYTE,new Uint8Array(o.data.buffer)),t(),this._renderScreenshotOverlay(s,o,e)}_renderScreenshot(e,r,o){const n=e.parameters.camera,a={width:r.framebufferWidth,height:r.framebufferHeight};c(a,Math.min(this._rctx.parameters.maxTextureSize,this._rctx.parameters.maxRenderbufferSize));let h=!1;const l=a.width!==n.fullWidth||a.height!==n.fullHeight,d=r.ignorePadding&&n.pixelRatio!==r.pixelRatio,f=l||r.disableDecorations||d||r.objectAndLayerIdColor;let m=null,u=null;if(f){const c=n.clone();if(r.ignorePadding){const e=t(c.padding);for(let t=0;t<4;t++)e[t]=Math.round(e[t]/c.pixelRatio*r.pixelRatio);c.padding=e}c.fullWidth=a.width,c.fullHeight=a.height,c.pixelRatio=r.pixelRatio;const l=n.fovX-c.fovX,d=n.fovY-c.fovY;l<0&&l<d?c.fovX=n.fovX:d<0&&d<l&&(c.fovY=n.fovY);const f={camera:c,contentCamera:c,mode:s.IDLE,alignPixelEnabled:!0,contentPixelRatio:c.pixelRatio,forcedAnimationTime:e.parameters.forcedAnimationTime};this._forceCameraHook(f),h=!0;const p=this._renderFunctions.renderScene(f,o,r.objectAndLayerIdColor?i.ObjectAndLayerID:i.Screenshot,r.disableDecorations);u=p.screen,m=p.olid}const p=()=>{this._rctx.bindFramebuffer(null),u?.release()};this._rctx.bindFramebuffer(u?.fbo);const g=this._readbackScreenshot(r,p);let b=null;if(r.objectAndLayerIdColor){const e=()=>{this._rctx.bindFramebuffer(null),m?.release()};this._rctx.bindFramebuffer(m?.fbo),b=this._readbackScreenshot(r,e),this._rctx.bindFramebuffer(null)}if(f&&!this._rctx.contextAttributes.alpha)for(let t=3;t<g.data.length;t+=4)g.data[t]=255;if(b&&!this._rctx.contextAttributes.alpha)for(let t=3;t<b.data.length;t+=4)b.data[t]=255;return h&&this._forceCameraHook(e.parameters),[g,b]}_ensureScreenshotEncodeCanvas(){return this._screenshotEncodeCanvas
|
|
5
|
+
import{createResolver as e}from"../../../../core/promiseUtils.js";import{clone as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{RenderRequestType as r}from"../lib/basicInterfaces.js";import{RendererTarget as i}from"../lib/rendererUtils.js";import{RenderState as s}from"../../../support/RenderState.js";import{resampleHermite as o}from"../../../support/screenshotUtils.js";import{PixelFormat as n,DataType as a}from"../../../webgl/enums.js";import{ensureAttachmentMaxSize as c}from"../../../webgl/FramebufferObject.js";import{createEmptyImageData as h}from"../../../../core/imageUtils.js";class l{constructor(e,t){this.parameters=e,this.fbos=t}}class d{constructor(e,t,r){this._rctx=e,this._renderFunctions=t,this._forceCameraHook=r,this.supersample=!0,this._screenshotQueue=new Array}destroy(){this._rctx=null}async takeScreenshot(t){await this._renderFunctions.prepareOverlay(),this._renderFunctions.requestRenderScene(r.BACKGROUND);const i=e();return this._screenshotQueue.push({settings:t,resolver:i}),i.promise}update(e,t){for(const r of this._screenshotQueue){if(null==this._rctx){r.resolver.reject();continue}const i={...r.settings,pixelRatio:r.settings.pixelRatio*e.parameters.camera.pixelRatio},s=this._renderScreenshot(e,i,t);r.resolver(s)}this._screenshotQueue.length=0}_renderScreenshotOverlay(e,t,r){e.width=t.width,e.height=t.height;const i=e.getContext("2d"),s=r.pixelRatio;return i.save(),i.translate(0,t.height),i.scale(1,-1),r.region&&i.translate(-r.region.x,-r.region.y),i.scale(s,s),t=this._renderFunctions.renderOverlay(e,r.disableDecorations,t),i.restore(),t}_readbackScreenshot(e,t){return e.resample?this._readbackScreenshotResampled({...e,resample:e.resample},t):this._readbackScreenshotImmediate(e,t)}_readbackScreenshotResampled(e,t){const{framebufferWidth:r,framebufferHeight:i,region:s,resample:c}=e,l=this._ensureScreenshotEncodeCanvas();let d=h(r,i,l);this._rctx.gl.readPixels(0,0,r,i,n.RGBA,a.UNSIGNED_BYTE,new Uint8Array(d.data.buffer)),t(),d=this._renderScreenshotOverlay(l,d,{...e,region:void 0});const f=h(s.width,s.height,l);return o(d,f,!0,c.region.x,i-(c.region.y+c.region.height),c.region.width,c.region.height)}_readbackScreenshotImmediate(e,t){const{framebufferHeight:r,region:i}=e,s=this._ensureScreenshotEncodeCanvas(),o=h(i.width,i.height,s);return this._rctx.gl.readPixels(i.x,r-(i.y+i.height),i.width,i.height,n.RGBA,a.UNSIGNED_BYTE,new Uint8Array(o.data.buffer)),t(),this._renderScreenshotOverlay(s,o,e)}_renderScreenshot(e,r,o){const n=e.parameters.camera,a={width:r.framebufferWidth,height:r.framebufferHeight};c(a,Math.min(this._rctx.parameters.maxTextureSize,this._rctx.parameters.maxRenderbufferSize));let h=!1;const l=a.width!==n.fullWidth||a.height!==n.fullHeight,d=r.ignorePadding&&n.pixelRatio!==r.pixelRatio,f=l||r.disableDecorations||d||r.objectAndLayerIdColor;let m=null,u=null;if(f){const c=n.clone();if(r.ignorePadding){const e=t(c.padding);for(let t=0;t<4;t++)e[t]=Math.round(e[t]/c.pixelRatio*r.pixelRatio);c.padding=e}c.fullWidth=a.width,c.fullHeight=a.height,c.pixelRatio=r.pixelRatio;const l=n.fovX-c.fovX,d=n.fovY-c.fovY;l<0&&l<d?c.fovX=n.fovX:d<0&&d<l&&(c.fovY=n.fovY);const f={camera:c,contentCamera:c,mode:s.IDLE,alignPixelEnabled:!0,contentPixelRatio:c.pixelRatio,forcedAnimationTime:e.parameters.forcedAnimationTime};this._forceCameraHook(f),h=!0;const p=this._renderFunctions.renderScene(f,o,r.objectAndLayerIdColor?i.ObjectAndLayerID:i.Screenshot,r.disableDecorations);u=p.screen,m=p.olid}const p=()=>{this._rctx.bindFramebuffer(null),u?.release()};this._rctx.bindFramebuffer(u?.fbo);const g=this._readbackScreenshot(r,p);let b=null;if(r.objectAndLayerIdColor){const e=()=>{this._rctx.bindFramebuffer(null),m?.release()};this._rctx.bindFramebuffer(m?.fbo),b=this._readbackScreenshot(r,e),this._rctx.bindFramebuffer(null)}if(f&&!this._rctx.contextAttributes.alpha)for(let t=3;t<g.data.length;t+=4)g.data[t]=255;if(b&&!this._rctx.contextAttributes.alpha)for(let t=3;t<b.data.length;t+=4)b.data[t]=255;return h&&this._forceCameraHook(e.parameters),[g,b]}_ensureScreenshotEncodeCanvas(){return this._screenshotEncodeCanvas??=document.createElement("canvas"),this._screenshotEncodeCanvas}}export{l as ScreenshotContext,d as ScreenshotManager};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import r from"../core/Accessor.js";import i from"../core/Error.js";import t from"../core/Logger.js";import{someMap as s}from"../core/MapUtils.js";import{removeMaybe as a}from"../core/maybe.js";import{createResolver as o,createAbortError as l,isAbortError as n,onAbort as y,throwIfAborted as h}from"../core/promiseUtils.js";import{on as c,watch as p,syncAndInitial as w}from"../core/reactiveUtils.js";import{schedule as d}from"../core/scheduling.js";import{property as m}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import{get as u}from"../core/accessorSupport/get.js";import{UpdatingHandles as _}from"../core/support/UpdatingHandles.js";import{destroyMap as
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import r from"../core/Accessor.js";import i from"../core/Error.js";import t from"../core/Logger.js";import{someMap as s}from"../core/MapUtils.js";import{removeMaybe as a}from"../core/maybe.js";import{createResolver as o,createAbortError as l,isAbortError as n,onAbort as y,throwIfAborted as h}from"../core/promiseUtils.js";import{on as c,watch as p,syncAndInitial as w}from"../core/reactiveUtils.js";import{schedule as d}from"../core/scheduling.js";import{property as m}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as f}from"../core/accessorSupport/decorators/subclass.js";import{get as u}from"../core/accessorSupport/get.js";import{UpdatingHandles as _}from"../core/support/UpdatingHandles.js";import g from"../layers/Layer.js";import{destroyMap as V}from"../support/collectionUtils.js";function v(e){return"tryRecycleWith"in e}function L(e){return null!=e&&"object"==typeof e&&"layerViews"in e}class M{constructor(e,r,t){this.layer=e,this.view=r,this.layerViewImporter=t,this._controller=new AbortController,this._deferred=o(),this._started=!1,this.done=!1,this.promise=this._deferred.promise,y(this._controller.signal,(()=>{const r=new i("cancelled:layerview-create","layerview creation cancelled",{layer:e});this._deferred.reject(r)}))}tryRecycle(e){if(!this.done||!this.layerView||!v(this.layerView))return null;const r=this.layer.type,i=this._controller.signal;for(let t=0;t<e.length;t++){const s=e[t];if(s.type!==r)continue;const a=this.layerView.tryRecycleWith(s,{signal:i});if(a){e.splice(t,1),this.layer=s;const r=this.layerView,i=r.view;return this.promise=Promise.race([a.then((()=>(h(this._controller.signal),s.emit("layerview-destroy",{view:i,layerView:r}),i.emit("layerview-destroy",{view:i,layerView:r}),s.emit("layerview-create",{view:i,layerView:r}),i.emit("layerview-create",{view:i,layerView:r}),r))),new Promise(((e,r)=>y(this._controller.signal,(()=>r(l())))))]),this.promise}}return null}destroy(){this._controller.abort();const{layerView:e}=this;if(e){const{layer:r,view:i}=this;r.emit("layerview-destroy",{view:i,layerView:e}),i.emit("layerview-destroy",{layer:r,layerView:e})}this.done=!0,this.layer=null,this.layerView=null,this.view=null,this.layerViewImporter=null,this._map=null}async start(){if(this._started)return;this._started=!0;const{_controller:{signal:e},layer:r,view:t}=this;this._map=t.map;try{let o,l;if(await r.load({signal:e}),r.prefetchResources&&await r.prefetchResources({signal:e}),C(r))o=await r.createLayerView(t,{signal:e});else{if(!this.layerViewImporter.hasLayerViewModule(r))throw new i("layer:view-not-supported","No layerview implementation was found");const s=await this.layerViewImporter.importLayerView(r);h(e),o="default"in s?new s.default({layer:r,view:t}):new s({layer:r,view:t})}const n=()=>{l=a(l),o.destroyed||o.destroy(),o.layer=null,o.parent=null,o.view=null,this.done=!0};l=y(e,n),h(e);try{await o.when()}catch(s){throw n(),s}const c=this._map?.allLayers?.includes(r);if(!c)return n(),void this._deferred.reject(new i("view:no-layerview-for-layer","The layer has been removed from the map",{layer:r}));this.layerView=o,r.emit("layerview-create",{view:t,layerView:o}),t.emit("layerview-create",{layer:r,layerView:o}),this.done=!0,this._deferred.resolve(o)}catch(s){r.emit("layerview-create-error",{view:t,error:s}),t.emit("layerview-create-error",{layer:r,error:s}),this.done=!0,this._deferred.reject(new i("layerview:create-error","layerview creation failed",{layer:r,error:s}))}}}let I=class extends r{constructor(e){super(e),this._layerLayerViewInfoMap=new Map,this._recyclingInfoMap=new Map,this._watchUpdatingTracking=new _,this.supportsGround=!0,this._preloadLayerViewModules=()=>{const e=this.view.map?.allLayers;if(e)for(const r of e)this.layerViewImporter.hasLayerViewModule(r)&&this.layerViewImporter.importLayerView(r)},this._reschedule=()=>this.destroyed?Promise.reject():(null==this._workPromise&&(this._workPromise=o(),this._workPromise.promise.catch((()=>{}))),this.removeHandles("reschedule"),this.addHandles(d(this._doWork),"reschedule"),this._workPromise.promise),this._doWork=()=>{if(this.destroyed)return;const e=this.view.map;if(this._map!==e&&(this.clear(),this._map=e),null==this._workPromise)return void this.notifyChange("updating");this.removeHandles("reschedule"),this.removeHandles("collection-change");const r=new Set,i=[],t=this.view.ready,s=e=>{if(null!=e)for(const a of e)if(a){r.add(a);const e=this._layerLayerViewInfoMap.get(a);e&&t?e.start():e||this._recyclingInfoMap.has(a)||i.push(a),"layers"in a&&a.layers&&s(a.layers)}};for(const o of this._rootCollectionNames)s(u(this,o));for(const[o,l]of this._layerLayerViewInfoMap)if(!r.has(o)){this._layerLayerViewInfoMap.delete(l.layer);const e=l.tryRecycle(i);e?(this.notifyChange("updating"),this._recyclingInfoMap.set(l.layer,l),e.then((()=>{this.notifyChange("updating"),this._recyclingInfoMap.delete(l.layer),this._layerLayerViewInfoMap.set(l.layer,l),this._reschedule()})).catch((()=>{this.notifyChange("updating"),this._recyclingInfoMap.delete(l.layer),l.destroy(),this._reschedule()}))):l.destroy()}for(const[o,l]of this._recyclingInfoMap)r.has(o)||(this.notifyChange("updating"),this._recyclingInfoMap.delete(l.layer),l.destroy());for(const o of i)this._createLayerView(o);this._refreshCollections();const a=[e?.ground?.layers,e?.basemap?.baseLayers,e?.basemap?.referenceLayers,e?.layers].filter((e=>!!e));r.forEach((e=>"layers"in e&&a.push(e.layers))),this.addHandles(a.map((e=>this._watchUpdatingTracking.addOnCollectionChange((()=>e),this._reschedule))),"collection-change"),this._workPromise.resolve(),this._workPromise=null}}initialize(){this.addHandles([c((()=>this.view?.map?.allLayers),"change",this._preloadLayerViewModules,{onListenerAdd:this._preloadLayerViewModules}),p((()=>{const e=this.view,r=e?.map;return[r?.basemap,r?.ground,r?.layers,e?.ready]}),(()=>this._reschedule()),w)]),this._preloadLayerViewModules(),this._reschedule()}destroy(){this.clear(),V(this._recyclingInfoMap),V(this._layerLayerViewInfoMap),this._watchUpdatingTracking.destroy(),this._map=null,null!=this._workPromise&&(this._workPromise.reject(l()),this._workPromise=null)}get _layersToLayerViews(){const e=[["view.map.basemap.baseLayers","view.basemapView.baseLayerViews"],["view.map.layers","view.layerViews"],["view.map.basemap.referenceLayers","view.basemapView.referenceLayerViews"]];return this.supportsGround&&e.push(["view.map.ground.layers","view.groundView.layerViews"]),new Map(e)}get _rootCollectionNames(){return Array.from(this._layersToLayerViews.keys())}get updating(){return null!=this._workPromise||this._watchUpdatingTracking.updating||s(this._layerLayerViewInfoMap,(e=>!e.done))||this._recyclingInfoMap.size>0}get updatingRemaining(){let e=0;for(const r of this._layerLayerViewInfoMap.values())r.done||++e;return e}clear(){this.destroyed||(V(this._layerLayerViewInfoMap),this._refreshCollections())}async whenLayerView(e){if(await this._reschedule(),!this._layerLayerViewInfoMap.has(e)){if(this._recyclingInfoMap.has(e))return this._recyclingInfoMap.get(e).promise;throw new i("view:no-layerview-for-layer","No layerview has been found for the layer",{layer:e})}return this._layerLayerViewInfoMap.get(e).promise}isCreatingLayerViewsForLayer(e,r){this.commitProperty("updatingRemaining");const i=this._layerLayerViewInfoMap.get(e);if(!i?.done)return!0;const t=i.layerView;return!(!t||!r||t.parent===r)||!!(i.done&&t&&"layers"in e&&e.layers?.length)&&e.layers.some((e=>this.isCreatingLayerViewsForLayer(e,t)))}_refreshCollections(){for(const[e,r]of this._layersToLayerViews)this._populateLayerViewsOwners(u(this,e),u(this,r),this.view);this.notifyChange("updating"),this.notifyChange("updatingRemaining")}_populateLayerViewsOwners(e,r,i){if(!e||!r)return void(r&&r.removeAll());let t=0;for(const s of e){const e=this._layerLayerViewInfoMap.get(s);if(!e?.layerView)continue;const a=e.layerView;a.layer=s,a.parent=i,r.at(t)!==a&&r.splice(t,0,a),"layers"in s&&L(a)&&this._populateLayerViewsOwners(s.layers,a.layerViews,a),t+=1}t<r.length&&r.splice(t,r.length)}_createLayerView(e){e.load().catch((()=>{})),this.layerViewImporter.hasLayerViewModule(e)&&this.layerViewImporter.importLayerView(e);const r=new M(e,this.view,this.layerViewImporter);r.promise.then((()=>this._refreshCollections()),(r=>{r&&(n(r)||"cancelled:layerview-create"===r.name)||t.getLogger(this).error(`Failed to create layerview for layer title:'${e.title??"no title"}', id:'${e.id??"no id"}' of type '${e.type}'.`,{layer:e,error:r}),this._refreshCollections()})),this._layerLayerViewInfoMap.set(e,r),this.view.ready&&r.start(),this.notifyChange("updating"),this.notifyChange("updatingRemaining")}};e([m()],I.prototype,"_workPromise",void 0),e([m({readOnly:!0})],I.prototype,"_watchUpdatingTracking",void 0),e([m({readOnly:!0})],I.prototype,"_layersToLayerViews",null),e([m({readOnly:!0})],I.prototype,"_rootCollectionNames",null),e([m()],I.prototype,"layerViewImporter",void 0),e([m()],I.prototype,"supportsGround",void 0),e([m({readOnly:!0})],I.prototype,"updating",null),e([m({readOnly:!0})],I.prototype,"updatingRemaining",null),e([m({constructOnly:!0})],I.prototype,"view",void 0),I=e([f("esri.views.LayerViewManager")],I);const j=I;function C(e){return e.createLayerView!==g.prototype.createLayerView}export{j as default};
|