@arcgis/core 4.33.0-next.20250219 → 4.33.0-next.20250221
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/applications/ExperienceBuilder/sketchUtils.d.ts +1 -0
- package/applications/ExperienceBuilder/sketchUtils.js +1 -1
- package/arcade/featureSetUtils.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/arcade/treeAnalysis.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0c3930e40fc9f8a84599.js +2 -0
- package/assets/esri/core/workers/chunks/{ccee343fb8c415b59ce3.js.LICENSE.txt → 0c3930e40fc9f8a84599.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/333bb93a28209c997d8b.js +314 -0
- package/assets/esri/core/workers/chunks/469c50c49447f0d602c0.js +1 -0
- package/assets/esri/core/workers/chunks/486df1e042204b90b0dd.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/4f764b952c6463fc7c88.js +1 -0
- package/assets/esri/core/workers/chunks/{c2d539359f321bba3432.js → 52c13b3c074c9f6dadde.js} +2 -2
- package/assets/esri/core/workers/chunks/{c2d539359f321bba3432.js.LICENSE.txt → 52c13b3c074c9f6dadde.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/5693d9ce4472a4c5959f.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/5b56b271afb0fadf48b4.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/63d8d507f073a8ed42d2.js +1 -0
- package/assets/esri/core/workers/chunks/6518954889df2e781c47.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/68322a63ec92d33701ea.js +1 -0
- package/assets/esri/core/workers/chunks/70574e0e3de729187d98.js +1 -0
- package/assets/esri/core/workers/chunks/78c066e8fe167d4ab817.js +1 -0
- package/assets/esri/core/workers/chunks/875a200f215e472d147e.js +1 -0
- package/assets/esri/core/workers/chunks/{f976233ad5e5b718ba83.js → 8d1f49927738ad3601d2.js} +1 -1
- package/assets/esri/core/workers/chunks/9050dad7e4f093568026.js +1 -0
- package/assets/esri/core/workers/chunks/930544d3b2c1d9c035c7.js +1 -0
- package/assets/esri/core/workers/chunks/{962cad03be1b7aa52ebe.js → 95835a62712fe4f24205.js} +1 -1
- package/assets/esri/core/workers/chunks/{030384851fa745908a6e.js → 9dbdb88cdac993104740.js} +2 -2
- package/assets/esri/core/workers/chunks/aacebda644be06ad1a61.js +1 -0
- package/assets/esri/core/workers/chunks/b0952b81d5be214262dd.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/b7c6d0ff4c085c8d0596.js +1 -0
- package/assets/esri/core/workers/chunks/e0cd4815149d1ff4d31e.js +1 -0
- package/assets/esri/core/workers/chunks/e2df18662cc4d6e47715.js +1 -0
- package/assets/esri/core/workers/chunks/{0a82c13828ffd4780419.js → f51fc2370fb486233499.js} +1 -1
- package/assets/esri/core/workers/chunks/fcbe65256a71b34ac9cf.js +1 -0
- package/assets/esri/themes/base/widgets/_Editor.scss +7 -0
- package/assets/esri/themes/base/widgets/_ResponsiveToolbar.scss +9 -3
- package/assets/esri/themes/base/widgets/_Sketch.scss +32 -24
- 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/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ar.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bg.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bs.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ca.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_cs.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_da.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_de.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_el.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_es.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_et.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fi.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_he.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hu.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_id.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_it.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ja.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ko.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lt.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lv.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_nl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_no.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-BR.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-PT.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ro.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ru.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sk.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sl.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sv.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_th.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_tr.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_uk.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_vi.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-CN.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-HK.json +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-TW.json +1 -1
- package/chunks/ColorMaterial.glsl.js +1 -1
- package/chunks/DefaultMaterial.glsl.js +1 -1
- package/chunks/ImageMaterial.glsl.js +3 -3
- package/chunks/LineMarker.glsl.js +11 -11
- package/chunks/NativeLine.glsl.js +1 -1
- package/chunks/Path.glsl.js +11 -11
- package/chunks/Pattern.glsl.js +2 -2
- package/chunks/RealisticTree.glsl.js +1 -1
- package/chunks/RibbonLine.glsl.js +1 -1
- package/chunks/Terrain.glsl.js +1 -1
- package/chunks/WaterSurface.glsl.js +9 -9
- package/copyright.txt +20 -0
- package/editing/sharedTemplates/SharedTemplate.js +1 -1
- package/editing/sharedTemplates/SharedTemplateMetadata.js +1 -1
- package/editing/sharedTemplates/SharedTemplateProvider.js +1 -1
- package/editing/sharedTemplates/executor/support/createServiceEdit.js +1 -1
- package/editing/sharedTemplates/support/sharedTemplateErrors.js +1 -1
- package/editing/sharedTemplates/templateDefinitions/FeatureTemplateDefinition.js +1 -1
- package/editing/sharedTemplates/templateDefinitions/GroupTemplateDefinition.js +1 -1
- package/editing/sharedTemplates/templateDefinitions/PresetTemplateDefinition.js +1 -1
- package/editing/sharedTemplates/templateDefinitions/TemplateDefinitionBase.js +1 -1
- package/editing/sharedTemplates/templateDefinitions/parts/FeatureTemplateRelationshipPart.js +1 -1
- package/editing/sharedTemplates/templateDefinitions/parts/GroupTemplatePart.js +1 -1
- package/editing/sharedTemplates/templateDefinitions/parts/TemplatePartBase.js +1 -1
- package/interfaces.d.ts +427 -93
- package/layers/ImageryLayer.js +1 -1
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/RouteLayer.js +1 -1
- package/layers/WCSLayer.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/mixins/ImageryTileMixin.js +1 -1
- package/layers/mixins/RasterJobHandlerMixin.js +5 -0
- package/layers/orientedImagery/transformations/utils.js +1 -1
- package/layers/orientedImagery/transformations/worldToImage.js +1 -1
- package/layers/support/Relationship.js +1 -1
- package/layers/support/rasterFunctionUtils.d.ts +11 -0
- package/networks/UtilityNetwork.js +1 -1
- package/package.json +2 -2
- package/rest/route.js +1 -1
- package/rest/support/RouteParameters.js +1 -1
- package/rest/support/RouteSolveResult.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMEffects.js +1 -1
- package/symbols/cim/effects/EffectAddControlPoints.js +1 -1
- package/symbols/cim/effects/EffectBuffer.js +1 -1
- package/symbols/cim/effects/EffectDonut.js +1 -1
- package/symbols/cim/effects/EffectOffset.js +1 -1
- package/undoredo/support/Services.js +1 -1
- package/views/2d/AnimationManager.js +1 -1
- package/views/2d/engine/webgl/TextureManager.js +1 -1
- package/views/2d/engine/webgl/Utils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
- package/views/2d/layers/imagery/VectorFieldTileView2D.js +1 -1
- package/views/2d/layers/imagery/VectorFieldView2D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
- package/views/3d/layers/graphics/pipeline/Tile.js +1 -1
- package/views/3d/layers/graphics/pipeline/Tile3DManager.js +1 -1
- package/views/3d/layers/graphics/pipeline/featureData/FeatureData.js +1 -1
- package/views/3d/layers/graphics/pipeline/featureData/FeatureDataSubset.js +5 -0
- package/views/3d/layers/graphics/pipeline/featureData/processingUtils.js +1 -1
- package/views/3d/layers/graphics/pipeline/featureSet/PBFPointFeatureSetView.js +1 -1
- package/views/3d/layers/graphics/pipeline/featureSet/TiledFeatureStore.js +1 -1
- package/views/3d/layers/graphics/pipeline/fetching/Tile3DFetcher.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/TestObjectSymbol.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/TestSymbol.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/UniqueValueFeatureRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticComponentBVH.js +1 -1
- package/views/3d/webgl-engine/collections/Component/IndexRange/ComponentRange.js +5 -0
- package/views/3d/webgl-engine/lib/ComponentUtils.js +1 -1
- package/views/View.js +1 -1
- package/views/animation/easing.js +1 -1
- package/views/webgl/ShaderBuilder.js +1 -1
- package/webmap/utils.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Directions/DirectionsViewModel.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/components/Prompt.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/ElevationProfile/components/LegendItem.js +1 -1
- package/widgets/ElevationProfile/components/SettingsButton.js +1 -1
- package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
- package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
- package/widgets/FeatureForm/featureFormUtils.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/Legend/styles/support/utils.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
- package/widgets/OrientedImageryViewer/symbols.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch/support/ResponsiveToolbar/OverflowGroup.js +1 -1
- package/widgets/Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js +1 -1
- package/widgets/Sketch/support/ResponsiveToolbar/SplitButton.js +1 -1
- package/widgets/Sketch/support/sketchUtils.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/support/FilterCondition.js +1 -1
- package/widgets/support/GoTo.js +1 -1
- package/widgets/support/UtilityNetworkAssociations/utilityNetworkUtils.js +1 -1
- package/widgets/support/goToUtils.js +1 -1
- package/assets/esri/core/workers/chunks/0c85731e9bf3eaeb96a2.js +0 -1
- package/assets/esri/core/workers/chunks/1b36d4400ab841c978c8.js +0 -1
- package/assets/esri/core/workers/chunks/3c44b4bf7fe407ec1d70.js +0 -1
- package/assets/esri/core/workers/chunks/4e3e141b3fd8bb652798.js +0 -1
- package/assets/esri/core/workers/chunks/544ad8fa4777ba8ec177.js +0 -1
- package/assets/esri/core/workers/chunks/717d7e9912d948e44d8d.js +0 -1
- package/assets/esri/core/workers/chunks/7bf9ebff90bb02bec8e7.js +0 -1
- package/assets/esri/core/workers/chunks/905cf2bb280479cd4f80.js +0 -1
- package/assets/esri/core/workers/chunks/b8fae500c69ca2cff62a.js +0 -1
- package/assets/esri/core/workers/chunks/b90b7ffc1e9363ed18e0.js +0 -1
- package/assets/esri/core/workers/chunks/bdc9dec6a359d2e3705c.js +0 -1
- package/assets/esri/core/workers/chunks/bf127fe767174e2715b5.js +0 -1
- package/assets/esri/core/workers/chunks/ccee343fb8c415b59ce3.js +0 -2
- package/assets/esri/core/workers/chunks/dc68246df91af766593a.js +0 -1
- package/assets/esri/core/workers/chunks/e862f1b9ecafc6c92b86.js +0 -314
- package/assets/esri/core/workers/chunks/f06231c14c0c0e5525bd.js +0 -1
- package/views/3d/layers/graphics/pipeline/featureData/FeatureDataStore.js +0 -5
- package/views/3d/webgl-engine/collections/Component/IndexRange/ComponentRangeRunLengthEncoded.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.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"../../../Graphic.js";import{isSome as s,removeUnordered as r}from"../../../core/arrayUtils.js";import{ByteSizeUnit as o}from"../../../core/ByteSizeUnit.js";import has from"../../../core/has.js";import a from"../../../core/Logger.js";import{destroyMaybe as n}from"../../../core/maybe.js";import l from"../../../core/PooledArray.js";import{ignoreAbortErrors as d,isAbortError as h,throwIfAborted as c,createResolver as u}from"../../../core/promiseUtils.js";import{initial as _,watch as m}from"../../../core/reactiveUtils.js";import{schedule as g}from"../../../core/scheduling.js";import{isArrayBuffer as p}from"../../../core/typedArrayUtil.js";import{property as f}from"../../../core/accessorSupport/decorators/property.js";import{subclass as b}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as y,invert as v}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as I}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{multiply as M,getTranslation as C}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{clone as x,create as O}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as E}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{i as j,t as w,q as R,a as S,g as A,h as D,d as T,H as N}from"../../../chunks/vec32.js";import{create as F}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as V}from"../../../chunks/vec42.js";import{fromValues as P}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as H}from"../../../core/support/UpdatingHandles.js";import{getSphericalPCPF as U}from"../../../geometry/spatialReferenceEllipsoidUtils.js";import{localLinearScaleFactors as G}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectBoundingSphere as L}from"../../../geometry/projection/projectBoundingSphere.js";import{projectBuffer as k}from"../../../geometry/projection/projectBuffer.js";import{getProjectorName as B}from"../../../geometry/projection/projectors.js";import{projectVectorToVector as q}from"../../../geometry/projection/projectVectorToVector.js";import{create as K,fromBuffer as W,toRect as z}from"../../../geometry/support/aaBoundingBox.js";import{create as $,intersects as Q}from"../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as X}from"../../../geometry/support/DoubleArray.js";import{compactFloatArray as Y}from"../../../geometry/support/FloatArray.js";import{compactIndices as J}from"../../../geometry/support/Indices.js";import{a as Z,f as ee,g as te}from"../../../chunks/sphere.js";import{newUByteArray as ie}from"../../../geometry/support/UByteArray.js";import{fallbackObjectIDAttribute as se}from"../../../layers/LayerConstants.js";import re from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as oe}from"../../../layers/support/fieldUtils.js";import ae from"../../../layers/support/SceneModification.js";import{getColor as ne,getOpacity as le}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{loadArcade as de}from"../../../support/arcadeOnDemand.js";import{isBasemapLayer as he}from"../../../support/basemapUtils.js";import{getElevationOffset as ce}from"../../../support/elevationInfoUtils.js";import{isQuery as ue}from"../../../support/guards.js";import _e from"../../../symbols/MeshSymbol3D.js";import me from"../../../symbols/SimpleFillSymbol.js";import ge from"./I3SMeshViewLabeler.js";import{I3SMeshViewPerformanceInfo as pe}from"./I3SMeshViewPerformanceInfo.js";import{I3SMeshWorkerHandle as fe,toWasmModification as be}from"./I3SMeshWorkerHandle.js";import{ElevationMode as ye,ForAllFeaturesReturnType as ve,ForAllFeaturesMode as Ie}from"./II3SMeshView3D.js";import{initialize as Me,setModificationsSync as Ce,filterObbsForModificationsSync as xe,interpretObbModificationResults as Oe}from"./SceneLayerWorker.js";import{overrideColor as Ee}from"./graphics/graphicUtils.js";import{areLabelsVisible as je}from"./graphics/Labeler.js";import{TextureUsage as we,TextureEncoding as Re}from"./i3s/enums.js";import Se from"./i3s/Highlights.js";import{I3SAsyncElevationUpdater as Ae}from"./i3s/I3SAsyncElevationUpdater.js";import{I3SCrossfadeHelper as De,NodeCrossfadeMetaData as Te}from"./i3s/I3SCrossfadeHelper.js";import{boundingBoxCornerPoints as Ne}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as Fe}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as Ve,selectEncoding as Pe,defaultMaterial as He,createTexture as Ue,configureMaterial as Ge}from"./i3s/I3SMaterialUtil.js";import{NodeIMModificationImpact as Le,NodeState as ke}from"./i3s/I3SNode.js";import{I3SOverrides as Be}from"./i3s/I3SOverrides.js";import{computeGlobalTransformation as qe}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as Ke,checkSceneLayerValid as We,checkSceneLayerCompatibleWithView as ze,whenGraphicAttributes as $e,computeVisibilityObb as Qe,filterInPlace as Xe,getCachedAttributeValue as Ye,intersectBoundingRectWithMbs as Je,MbsIntersectResult as Ze,addWraparound as et,getSymbolInfo as tt,transparentEdgeMaterial as it,getClipRect as st}from"./i3s/I3SUtil.js";import{IDBCache as rt}from"./i3s/IDBCache.js";import{IDBMockCache as ot}from"./i3s/IDBMockCache.js";import{LayerElevationProvider as at}from"./i3s/LayerElevationProvider.js";import{SymbologyInfo as nt}from"./i3s/SymbologyInfo.js";import{attributeLookup as lt}from"./support/attributeUtils.js";import{emptyHighlightHandle as dt,normalizeHighlightTargetExceptQuery as ht}from"./support/highlightUtils.js";import{makeScheduleFunction as ct}from"./support/makeScheduleFunction.js";import{ColorMixModeEnum as ut}from"./support/symbolColorUtils.js";import{debugFlags as _t}from"../support/debugFlags.js";import{ElevationRange as mt}from"../support/ElevationRange.js";import{toBoundingRect as gt}from"../support/extentUtils.js";import{Obb as pt}from"../support/orientedBoundingBox.js";import{updatingProgress as ft}from"../support/updatingProperties.js";import{glLayout as bt}from"../support/buffer/glUtil.js";import{ObjectParameters as yt}from"../webgl-engine/collections/Component/ObjectParameters.js";import{createVertexBufferLayout as vt,GeometryParameters as It}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as Mt}from"../webgl-engine/collections/Component/Transform.js";import{TextureCoordinateType as Ct}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{loadBasisTranscoder as xt}from"../webgl-engine/lib/BasisUtil.js";import{Transparency as Ot}from"../webgl-engine/lib/edgeRendering/interfaces.js";import{defaultHighlightName as Et}from"../../support/HighlightDefaults.js";import{alphaCutoff as jt}from"../../../webscene/support/AlphaCutoff.js";const wt="esri.views.3d.layers.I3SMeshView3D",Rt=()=>a.getLogger(wt),St=[1,1,1,1];class At extends Te{constructor(e,t,i,s,r,o,a,n,l){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=a,this.anchorIds=n,this.anchors=l,this.cachedElevationAnchors=null,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0}get cachedMemory(){return this.node.memory}get featureExtents(){return this._featureExtents??=new Float64Array(6*this.featureIds.length).fill(Number.POSITIVE_INFINITY),this._featureExtents}}var Dt;!function(e){e[e.CastShadows=4]="CastShadows",e[e.Pickable=5]="Pickable"}(Dt||(Dt={}));const Tt=26,Nt=100*o.MEGABYTES,Ft=t=>{let o=class extends t{constructor(){super(...arguments),this._applySSAO=!0,this._shadeNormals=!0,this._updatingHandles=new H,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._snappingSourcesTrackers=[],this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,this._currentRenderer=null,this._rendererVersion=0,this._colorVariable=null,this._opacityVariable=null,this._rendererFields=null,this._symbologyFields=null,this._symbologyOverride=null,this._symbologyOverrideFields=null,this._symbolInfos=new Map,this._visibleGeometryChangedSchedulerHandle=null,this._hasComponentData=!1,this._hasVertexColors=!1,this._nodeColorOverride=null,this.updating=!0,this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.slicePlaneEnabled=!1,this._modifications=new Array,this.ignoresMemoryFactor=!1,this._layerUrl="",this._cacheKeySuffix=null,this._planetRadiusInGlobalMode=0,this._elevationTask=null,this._filters=[],this._arcade=null,this._tmpAttributeOnlyGraphic=new i,this._crossfadeHelper=new De(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerUid(){return this.i3slayer&&this.i3slayer.uid}get sublayerUid(){return null}get layerId(){return this.i3slayer&&this.i3slayer.id}get sublayerId(){return null}get contentVisible(){return!this.suspended&&this._controller?.rootNodeVisible}get legendEnabled(){return this.contentVisible&&!0===this.i3slayer?.legendEnabled}get updatingProgressValue(){return this._controller?.updatingProgress??0}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return Ke(this._currentRenderer)?this._usePBR||this._hasLoadedPBRTextures?we.AllTexturesPBR:we.AllTextures:this._usePBR||this._hasLoadedPBRTextures?we.GeometryTexturesPBR:we.GeometryTextures}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;return null!=e&&"absolute-height"===e.mode?ce(e,this.i3slayer.spatialReference):0}get elevationInfo(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null==e)return new Jt(ye.Absolute,0);const t=ce(e,this.i3slayer.spatialReference);switch(e.mode){case"absolute-height":return new Jt(ye.Absolute,t);case"relative-to-ground":return new Jt(ye.RelativeToGround,t);case"on-the-ground":return new Jt(ye.OnTheGround,0);default:return new Jt(ye.Absolute,0)}}get supportedTextureEncodings(){return Ve(this.view._stage.renderView.capabilities)}get clientGeometry(){return this.i3sOverrides.geometryOverrides}get elevationRange(){const e=this._nodeId2Meta,t=new mt;for(const i of e.values()){if(null==i)continue;const{node:{serviceMbsInIndexSR:e}}=i,[s,r,o,a]=e;t.expandElevationRangeValues(o-a,o+a)}return t.elevationRangeValid?t:null}get fullExtent(){return this.i3slayer.fullExtent}initialize(){const e=has("enable-feature:idb-mock-cache");this._idbCache=e?new ot(this.view,e):new rt("esri-scenelayer-cache","geometries"),this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const t=this.view.resourceController,i=t.memoryController;this.i3sOverrides=new Be({view:this.view,layer:this.i3slayer,memoryController:i}),this._worker=new fe(ct(t)),this.addResolvingPromise(this._worker.promise);const s=this.i3slayer.store;this.addResolvingPromise(this._worker.setLegacySchema(this.uid,s.defaultGeometrySchema).catch(d)),We(this.i3slayer),ze(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new re({layerView:this,worker:this._worker}),this._gpuMemoryEstimate=0,this._texMemoryEstimate=0,this._geoMemoryEstimate=0,this._stage=this.view._stage,this._collection=this._stage.renderView.componentObjectCollection,this.resetHighlights();const r=s.defaultGeometrySchema;if(this._isIntegratedMesh||!r)this._hasComponentData=!1;else{const e=r.featureAttributes;this._hasComponentData=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=(r?.vertexAttributes.color??null)&&!this.i3slayer.cachedDrawingInfo?.color;const o=this.view.resourceController.memoryController.newCache(`sl-${this.uid}`,(e=>this._deleteComponentObject(e)));this._memCache=o;const a=this._controller,l=this._nodeId2Meta,h=this._nodeId2MetaReloading,c=e=>{const t=a.index;if(!t)return;const i=t.rootNode;if(!i)return;const s=t=>{const i=t.index,s=l.get(i)||h.get(i);return e(t,s?.objectHandle??null)};t.traverse(i,s)};this._intersectionHandler=new Fe({layerUid:this.layerUid,sublayerUid:this.sublayerUid,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:c}),this._updatingHandles.add((()=>this.layerUid),(e=>this._intersectionHandler.layerUid=e)),this._updatingHandles.add((()=>this.sublayerUid),(e=>this._intersectionHandler.sublayerUid=e)),this._elevationProvider=new at({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR,this._updatingHandles.add((()=>this.view.clippingArea),(()=>this._clippingAreaChanged()),_),this._updatingHandles.add((()=>this.fullOpacity),(e=>this._opacityChange(e))),this._updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(e))),this._updatingHandles.add((()=>this.elevationOffset),((e,t)=>{this._reloadAll(t),this._controller.invalidateVisibilityObbs()})),this._updatingHandles.add((()=>this.elevationInfo),((e,t)=>this._elevationInfoChanged(e,t)),_),this._updatingHandles.add((()=>!this.suspended&&this.elevationInfo.mode!==ye.Absolute),((e,t)=>{e?this.addHandles(this.view.basemapTerrain.on("elevation-change",(({extent:e})=>this._ensureElevationTask().addExtent(e))),ti):t&&this.removeHandles(ti)}),_),this._updatingHandles.add((()=>this._usePBR),(e=>this._updatePBR(e)));const u=()=>{this._reloadAll(),this.clearMemCache()};this._updatingHandles.add((()=>this.rendererTextureUsage),u),this._updatingHandles.add((()=>this.contentVisible),(e=>this._contentVisibleChanged(e)),_),this._updatingHandles.add((()=>this.i3slayer.labelsVisible),(()=>this._labelingChanged()),_),this._updatingHandles.add((()=>this.i3slayer.labelingInfo),(()=>this._labelingChanged()),_),this._updatingHandles.add((()=>this._modifications),(()=>this._modificationsChanged()),_),this.addHandles([m((()=>_t.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&_t.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||_t.I3S_TREE_SHOW_TILES||(this._treeDebugger=n(this._treeDebugger))}),_),m((()=>_t.I3S_SHOW_MODIFICATIONS),(()=>this._showModifications()),_)]),this._cacheKeySuffix=this._getCacheKeySuffix(),this._idbCache.init().catch((e=>Rt().warn(`Failed to initialize IndexedDB cache: ${e}`)));const{view:g}=this,{viewingMode:p,renderCoordsHelper:f}=g;this._planetRadiusInGlobalMode="local"===p?0:f.referenceEllipsoid.radius}destroy(){this._clearAddTasks(),this._elevationTask=n(this._elevationTask),this.i3sOverrides=n(this.i3sOverrides),this._elevationProvider&&(this._elevationProvider.objectsChanged(this.getVisibleObbs()),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._worker;e&&(e.destroyContext(this.uid).then((()=>e.destroy())),this._worker=null),this._removeAllNodeDataFromStage(),this._memCache=n(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=n(this._labeler),this._treeDebugger=n(this._treeDebugger),this._controller=n(this._controller),this._highlights.destroy(),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this._crossfadeHelper=n(this._crossfadeHelper),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null),this._updatingHandles=n(this._updatingHandles)}_memEstimateTextureAdded(e){const t=e.usedMemory;return this._gpuMemoryEstimate+=t,this._texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(null!=e){const t=e.usedMemory;this._gpuMemoryEstimate-=t,this._texMemoryEstimate-=t}}_memEstimateGeometryAdded(e){const t=this._collection.getObjectGPUMemoryUsage(e);return this._gpuMemoryEstimate+=t,this._geoMemoryEstimate+=t,t}_memEstimateGeometryRemoved(e){const t=this._collection.getObjectGPUMemoryUsage(e);this._gpuMemoryEstimate-=t,this._geoMemoryEstimate-=t}isNodeLoaded(e){return this._nodeId2Meta.has(e)}isNodeReloading(e){return this._nodeId2MetaReloading.has(e)}get usedMemory(){let e=null!=this._labeler?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach((t=>e+=null!=t?t.node.memory:0)),this._nodeId2MetaReloading.forEach((t=>e+=null!=t?t.node.memory:0)),e}get unloadedMemory(){return(null!=this._controller?this._controller.unloadedMemoryEstimate:0)+(null!=this._labeler?this._labeler.unloadedMemoryEstimate:0)}_labelingChanged(){if(!(je(this.i3slayer)&&this._supportsLabeling))return void(null!=this._labeler&&(this._labeler.destroy(),this._labeler=null));if(null!=this._labeler)return;const e=new ge({view:this.view,layer:this.i3slayer,collection:this._collection,overrides:this.i3sOverrides});this._nodeId2Meta.forEach((t=>null!=t&&this._addMetaToLabeler(e,t))),this._labeler=e}_loadAsyncModule(e){return++this._asyncModuleLoading,e.then((e=>(--this._asyncModuleLoading,e)),(e=>{throw--this._asyncModuleLoading,e}))}_modificationsChanged(){if(!this._i3sWasmLoaded&&this.hasModifications)return this._i3sWasmLoaded=Me().then((()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()})),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=this.uid,t=this.i3slayer.spatialReference;this._worker.setModifications(e,this._layerClippingArea,this._modifications,t);const i=be(this._layerClippingArea,this._modifications,t);Ce({context:e,modifications:i,isGeodetic:t.isGeographic}),this._controller.modificationsChanged();const s=this.hasModifications?new l:null;this._nodeId2Meta.forEach(((e,t)=>{null==e?(this._nodeId2Meta.delete(t),this._controller.updateLoadStatus(t,!1)):e.node.hasModifications?(this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):null!=s&&s.push(e.node)})),this.notifyChange("elevationRange"),null!=s&&this._nodeId2MetaReloading.forEach((e=>s.push(e.node))),null!=s&&s.length>0&&(this.updateNodeModificationStatus(s),s.forAll((e=>{if(e.imModificationImpact!==Le.Culled){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),null!=t?(this._nodeId2Meta.delete(e.index),this._nodeId2MetaReloading.set(e.index,t),this.notifyChange("elevationRange")):this._nodeId2Meta.has(e.index)&&(this._nodeId2Meta.delete(e.index),this._controller.updateLoadStatus(e.index,!1))}}))),this.clearMemCache(),this._controller.restartNodeLoading(),this._showModifications()}_showModifications(){if(null!=this._modificationGraphics&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!_t.I3S_SHOW_MODIFICATIONS||0===this._modifications.length)return;const e={clip:[227,227,79,.8],mask:[227,139,79,.8],replace:[139,227,79,.8]},t={outline:{color:[255,255,255],width:1}};this._modificationGraphics=new Array;for(const s of this._modifications){const r=s.geometry;r.spatialReference=this.i3slayer.spatialReference;const o=new me({...t,color:e[s.type]});this._modificationGraphics.push(new i({geometry:r,symbol:o}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,((e,t)=>this._createAttributes(e,t)))}_contentVisibleChanged(e){e?(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler)):(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(null!=t?.attributeInfo)return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(null!=t?.attributeInfo)return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);null!=i?.attributeInfo&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);null!=s&&(await this.i3sOverrides.applyAttributeOverrides(s.featureIds,t,i,this._controller.requiredAttributes),s.attributeInfo=t,this._controller.reschedule((()=>this._attributeValuesChanged(s)),i).catch((e=>{h(e)||Rt().warn("Error while updating attribute values. Layer might not display correctly.",e)})))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.filteredIds=null,null!=this._labeler&&this._labeler.setNodeMetaAttributes(e,((e,t)=>this._createAttributes(e,t))),this._updateEngineObject(e)}clearMemCache(){null!=this._memCache&&this._memCache.clear(),this._addTasks.forEach((e=>e.allowMemCache=!1))}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach((t=>null!=t&&e.push(t.node))),e}getVisibleObbs(){const e=new Array;return this._nodeId2Meta.forEach((t=>t&&e.push(this._collection.getComponentObb(t.objectHandle)))),e}getLoadedNodeIndices(e){this._nodeId2Meta.forEach(((t,i)=>e.push(i))),this._nodeId2MetaReloading.forEach(((t,i)=>e.push(i)))}_preLoadBasis(){!has("disable-feature:i3s-basis")&&this.supportedTextureEncodings&Re.Basis&&this.i3slayer.textureSetDefinitions?.some((e=>e.formats.some((e=>"basis"===e.format||"ktx2"===e.format))))&&xt()}_getVertexBufferLayout(e,t){return bt(vt(this._getGeometryParameters({hasTexture:qt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion})))}_getObjectIdField(){return this.i3slayer.objectIdField||se}_getGlobalIdField(){return this.i3slayer.associatedLayer?.globalIdField}_findGraphicNodeAndIndex(e){const t=lt(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());for(const i of this._nodeId2Meta.values()){const e=i?.featureIds.indexOf(t);if(null!=e&&e>=0)return{node:i.node,index:e}}return null}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(null==i)return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const a of t){const e=lt(o,a.attributes,r),t=i.featureIds.indexOf(e);-1!==t&&s.push(t)}return s}whenGraphicBounds(e){const t=this._findGraphicNodeAndIndex(e);if(!t)return Promise.reject();const i=this._getAABB(t.node.index,t.index);return null==i?Promise.reject():Promise.resolve({boundingBox:i,screenSpaceObjects:[]})}getAABBFromIntersectorTarget(e){return null==e.nodeIndex||null==e.componentIndex?null:this._getAABB(e.nodeIndex,e.componentIndex)}_getAABB(e,t){const i=this._nodeId2Meta.get(e);if(null==i?.featureIds||t>=i.featureIds.length)return null;const s=i.objectHandle,r=Ne(t,this._collection,s,X(24),0),o=this.view.renderSpatialReference,a=this.view.spatialReference;return k(r,o,0,r,a,0)?W(r):null}whenGraphicAttributes(e,t){return $e(this.i3slayer,e,this._getObjectIdField(),t,(()=>[...this._nodeId2Meta.values()].filter(s)))}getGraphicFromIntersectorTarget(e){if(null==e.nodeIndex||null==e.componentIndex)return null;const t=this._nodeId2Meta.get(e.nodeIndex);return null==t?.featureIds||e.componentIndex>=t.featureIds.length?null:this._createGraphic(e.componentIndex,t)}_getCacheKey(e){return`${this._layerUrl}/v${Tt}/${e}${this._cacheKeySuffix}`}_getCacheKeySuffix(){const e=this.view.renderSpatialReference;if(null==e)return si;if(e===U(e))return ri;return this.i3slayer.spatialReference.equals(e)?ii:null!=e.wkid?`@${e.wkid}`:null}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&!this.hasModifications&&0===this.elevationOffset&&null!=this._cacheKeySuffix}loadCachedGPUData(e){return null!=this._memCache?this._memCache.pop(this._getMemCacheKey(e)):null}deleteCachedGPUData(e){null!=e&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(null==this._memCache)return void this._deleteComponentObject(e);const i=this._controller.indexDepth-e.node.level;this._memCache.put(this._getMemCacheKey(e.node.index,t),e,i)}loadMissingTextures(e,t,i,s){const r=e?.filter(((e,i)=>{if(!(e.usage&this.rendererTextureUsage))return!1;if(null==t)return!0;const s=Pe(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(null==r?.data||s&&r.encoding!==s.encoding)}))??[];return 0===r.length?Promise.resolve(!1):i(r,s).then((i=>{let s=0;for(let r=0;r<e.length;r++)s<i.length&&i[s].id===e[r].id&&(t[r]=i[s],s++);return!0}))}loadCachedNodeData(e,t,i){return this._idbCacheEnabled?this._idbCache.get(this._getCacheKey(e.id),t).then((s=>null==s?null:s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e.id)),null):(this.elevationInfo.mode===ye.Absolute&&(e.geometryObbInRenderSR=pt.fromData(s.geometryObbData)),this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then((i=>(i&&this._idbCache.initialized&&null!=s.textureData&&(s.byteSize=zt(s.transformedGeometry,s.textureData),s.textureData.every(Wt)&&$t(e,s)&&this._idbCache.put(this._getCacheKey(e.id),s).catch((t=>Rt().warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`)))),c(t),s)))))):Promise.resolve(null)}addNode(e,t,i){return Kt(t)?null==t.geometryBuffer?(this._addNodeMeta(e.index,null),Promise.resolve()):this._addData(e,t.attributeDataInfo,(()=>this._transformNode(e,t,i).then((s=>this._safeReschedule((()=>{if(null==s)return e.hasModifications=!1,this._addCachedNodeData(e,null,i);e.hasModifications=s.transformedGeometry.hasModifications;const{obb:r,componentOffsets:o,featureIds:a,anchorIds:n,anchors:l,transformedGeometry:d,globalTrafo:h}=s,c=j(Zt,r.center.x,r.center.y,r.center.z);w(c,c,h);const u=new pt(c,[r.extents.x,r.extents.y,r.extents.z],E(r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w));this.elevationInfo.mode===ye.Absolute&&(e.geometryObbInRenderSR=u),t.geometryData.componentOffsets=o,a&&(t.geometryData.featureIds=Array.from(a)),t.geometryData.anchorIds=n,t.geometryData.anchors=l;const _={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:d,globalTrafo:h,geometryObbData:u.data,byteSize:zt(d,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&$t(e,_)){const t=null!=_.textureData?_.textureData.map((e=>Wt(e)?e:null)):null;this._idbCache.put(this._getCacheKey(e.id),{..._,textureData:t}).catch((t=>Rt().warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`)))}return this._addCachedNodeData(e,_,i)}),i))))):Promise.reject()}getElevationRange(e){const t=new mt,i=this._controller,{index:s}=i;if(!s)return t;const{rootNode:r}=s;if(!r)return t;const o=this._nodeId2Meta,a=e[3],n=i.viewportQueries,l=this._planetRadiusInGlobalMode,{view:d}=this,{renderCoordsHelper:h}=d,c=h.referenceEllipsoid.radius,u=this._collection,_=i=>{const{childrenLoaded:s}=i;if(0===s)return!1;const r=n.getAndUpdateVisibilityObbInRenderSR(i);let d=null,_=-1;if(r){if(_=r.radius,!r.intersectSphereWithMBS(e,_))return!1}else d=n.getServiceMbsInRenderSR(i),d&&(_=d[3]);if(_>=0&&a>=1*_)return null!=r?ni(t,r,l):null!=d&&d[3]>=0&&li(t,d,l),!1;const m=ai;if(m.elevationRangeMin=1/0,m.elevationRangeMax=-1/0,(null!=r||null!=d)&&(null!=r?ni(m,r,l):null!=d&&li(m,d,l),m.elevationRangeMin>=t.elevationRangeMin&&m.elevationRangeMax<=t.elevationRangeMax))return!1;const g=o.get(i.index);if(g){const{geometryObbInRenderSR:s}=i;if(!s||s.intersectSphereWithMBS(e)){if(s){if(a>0*s.radius)return ni(t,s,l),!1}const{objectHandle:e}=g,i=u.getObjectTransform(e),r=h.getAltitude(i.position);u.expandRangeWithComponentObjectElevationRange(e,r,c,t)}}return s-(g?1:0)>0};return s.traverse(r,_),t}computeVisibilityObb(e){return Qe(e,this.view.renderSpatialReference,this._controller.crsIndex,this.i3slayer.spatialReference,this.elevationOffset,this._modifications,this.view.renderCoordsHelper.sphericalPCPF)}_transformNode(e,t,i){const s=t.geometryData.geometries??[],r=new Array(s.length);for(let p=0;p<s.length;++p)r[p]=this._getVertexBufferLayout(s[p],t.geometryDescriptor);const o=this.i3slayer.normalReferenceFrame,a=t.normalReferenceFrame??o??"none",n=e.serviceMbsInIndexSR,l=this.elevationOffset,d=this._controller.crsIndex,h=this._controller.crsVertex,c=this.view.renderSpatialReference,u=qe(n,l,a,d,c),_=B(d,h),m=B(h,c);if(null==_||null==m)return Promise.resolve(null);const g={context:this.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,globalTrafo:u,mbs:n,obbData:e.serviceObbInIndexSR?.data,elevationOffset:l,needNormals:this._controller.isMeshPyramid,normalReferenceFrame:a,indexToVertexProjector:_,vertexToRenderProjector:m};return this._worker.invoke(g,i)}get _supportsNodeCrossFading(){return!this.view?._stage?.renderer.shadowsEnabled}get nodeCrossfadingEnabled(){return this._supportsNodeCrossFading&&(this.lodCrossfadeinDuration>0||this.lodCrossfadeoutDuration>0||this.lodCrossfadeUncoveredDuration>0)}get nodeFadeoutEnabled(){return this._supportsNodeCrossFading&&this.lodCrossfadeoutDuration>0}_setNewNodeOpacity(e){const t=this.nodeCrossfadingEnabled?0:this.fullOpacity;this._setNodeOpacity(e,t)}addCachedGPUData(e,t,i){if(this.elevationInfo.mode===ye.Absolute&&(e.geometryObbInRenderSR=this._collection.getComponentObb(t.objectHandle).clone()),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);null!=this._labeler&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,!0),this._updateMaterial(t),this._setNewNodeOpacity(t),this.elevationInfo.mode!==ye.Absolute&&this._ensureElevationTask().schedule(s),this._updateEngineObject(t),this._highlights.objectCreated(t),null!=this._treeDebugger&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,(()=>this._addCachedNodeData(e,t,s)))}async deleteCachedNodeData(e){if(this._idbCacheEnabled)return this._idbCache.remove(this._getCacheKey(e))}async _addCachedNodeData(e,t,i){if(!this.contentVisible||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(null==t)return void this._addNodeMeta(e.index,null);const s=this._addTasks.get(e.index),{geometryData:r,transformedGeometry:o,globalTrafo:a}=t;await this.i3sOverrides.applyAttributeOverrides(r.featureIds,s.attributeInfo,i,this._controller.requiredAttributes);const n=null!=t.textureData?t.textureData.filter((e=>null!=e&&!!(e.usage&this.rendererTextureUsage))):[];!has("disable-feature:i3s-basis")&&n.some((e=>null!=e&&(e.encoding===Re.Basis||e.encoding===Re.KTX2)))&&await xt(),e.memory=0;const{componentOffsets:l,geometries:d,featureIds:h,anchorIds:c,anchors:u}=r,_=this._collection,m=d[0],{layout:g,indices:p,interleavedVertexData:f,positionData:b,hasColors:E}=o,{material:j,geometryParameters:w}=this._materialParameters(m,g),A=l||new Uint32Array([0,p?p.length:f.byteLength/g[0].stride]),D={vertices:{data:f,count:f.byteLength/g[0].stride,layoutParameters:w},positionData:{positions:Y(b.data),indices:J(b.indices)},indices:p,componentOffsets:A},T=m.transformation?x(m.transformation):O();M(T,a,T);const N=C(F(),T),V=y(I(),T),H=this.view.renderSpatialReference,U=this.view.basemapTerrain.spatialReference,L=pt.fromData(t.geometryObbData).center,k=[1,1,1];G(L,H,k,U)||Rt().errorOnce("Unsupported coordinate system for IM overlay");const B=F();q(L,H,B,U);const K=I();v(K,V);const W=F();R(W,S(W,L,N),K);const z=B[0]-W[0]*k[0],$=B[1]-W[1]*k[1],Q=_.createObject(new yt(P(z,$,k[0],k[1]),new Mt(N,V),pt.fromData(t.geometryObbData),D)),X=w.textureCoordinates===Ct.Atlas,{textures:Z,texturePromise:ee}=this._initMaterialAndTextures(Q,j,n,X);e.memory+=this._memEstimateGeometryAdded(Q),e.memory+=Z.reduce(((e,t)=>e+(null!=t?this._memEstimateTextureAdded(t):0)),0);const te=!!j.hasParametersFromSource,ie="blend"!==j.alphaMode&&j.metallicRoughness.baseColorFactor[3]>=1,se=new At(e,h,Q,this._getInvalidRendererVersion(),s.attributeInfo,{hasParametersFromSource:te,isOpaque:ie},Z,c,u);s.meta=se,this._hasTextures||=t.requiredTextures?.some((({usage:e})=>!!(e&we.ColorTextures))),this._hasData=!0,this._hasColors||=E,this._hasTextures||=!!e.resources.texture,this.notifyChange("hasTexturesOrVertexColors");const re=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering(se),ee]).then((([t,s])=>(this._addTasks.has(e.index)&&t?.updateObjectVisibility(se.objectHandle,!1).catch((e=>Vt(e,this.i3slayer.title))),this._safeReschedule((()=>{const i=this._addTasks.get(e.index);if(!i)return;if(this._addNodeMeta(e.index,se),i.meta=null,!this.contentVisible)return void this._removeNodeStageData(e.index,this.elevationOffset);_.setObjectVisibility(Q,!0),t?.updateObjectVisibility(se.objectHandle,!0).catch((e=>Vt(e,this.i3slayer.title))),se.attributeInfo=i.attributeInfo;const s=se.cachedRendererVersion!==this._rendererVersion,r=re!==this.slicePlaneEnabled;this._updateElevationOffsets(se);const o=se.elevationOffsets;this._updateComponentData(se);const a=this._applyFiltersToNode(se);(s||null!=t&&(r||a||o))&&this._addOrUpdateEdgeRendering(se),null!=this._labeler&&this._addMetaToLabeler(this._labeler,se),this._visibleGeometryChanged(se,Pt.ADD),this._highlights.objectCreated(se),this._updateMaterial(se),this._setNewNodeOpacity(se),null!=this._treeDebugger&&this._treeDebugger.update()}),i)))).catch((e=>{const{meta:t,allowMemCache:i}=s;throw s.meta=null,t&&i?this._cacheGPUData(t):t&&this._deleteComponentObject(t),e}))}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){Rt().error("Removing duplicated node");const t=this._nodeId2Meta.get(e);null!=t&&this._deleteComponentObject(t)}else this._controller.updateLoadStatus(e,!0);null!=t&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&Yt(t.cachedEdgeMaterials,0)),this._nodeId2Meta.set(e,t),this.notifyChange("elevationRange")}_updateElevationOffsets(e){const t=this.view.renderSpatialReference,i=this._controller.crsIndex,s=this.elevationInfo,r=this.view.basemapTerrain,o=r.spatialReference,a=s.mode;if(null==t||null==o||a===ye.Absolute)return void(e.elevationOffsets=null);const n=this._collection.getObjectTransform(e.objectHandle);e.elevationOffsets=e.elevationOffsets??[];const l=Zt,d=ei,h=a===ye.OnTheGround,c=this.view.renderCoordsHelper,u=e.featureIds.length,_=(()=>{if(e.cachedElevationAnchors)return e.cachedElevationAnchors;const s=X(3*u);e.cachedElevationAnchors=s;for(let r=0;r<u;r++){const a=3*r,h=e.anchorIds?.indexOf(r)??-1;e.anchors&&h>=0?(j(l,e.anchors[3*h],e.anchors[3*h+1],e.anchors[3*h+2]),A(l,l,Z(e.node.serviceMbsInIndexSR)),q(l,i,l,o),s[a]=l[0],s[a+1]=l[1],s[a+2]=c.getAltitude(l)):(this._collection.getComponentAabb(e.objectHandle,r,d,!0),j(l,(d[0]+d[3])/2,(d[1]+d[4])/2,d[2]),R(l,l,n.rotationScale),A(l,l,n.position),s[a+2]=c.getAltitude(l),q(l,t,l,o),s[a]=l[0],s[a+1]=l[1])}return s})(),m=s.offset,g=e.elevationOffsets,p=(e,t)=>{const i=h?_[3*e+2]:0;g[e]=m+(t??0)-i};r.getElevations(_,u,p)}_ensureElevationTask(){return null!=this._elevationTask||(this._elevationTask=new Ae(this.view.resourceController.scheduler,(e=>this._controller.updateElevationChanged(e,this.view.basemapTerrain.spatialReference)?.filterInPlace((e=>null!=this._nodeId2Meta.get(e)))),(e=>this._nodeElevationAlignmentChanged(this._nodeId2Meta.get(e))),(()=>this.elevationInfo?.mode))),this._elevationTask}_elevationInfoChanged(e,t){const i=e.mode!==ye.Absolute,s=!!t&&t!==e&&t.mode!==ye.Absolute;this._intersectionHandler.updateElevationAlignState(i,this.view.state.viewingMode),i&&!s&&this._controller.removeAllGeometryObbs(),this._nodeId2Meta.forEach((e=>this._nodeElevationAlignmentChanged(e)))}_nodeElevationAlignmentChanged(e){null!=e&&(this._updateElevationOffsets(e),this._updateComponentData(e),this._updateEdgeRendering(e),null!=this._labeler&&this._labeler.updateLabelPositions(e),this._updateSnappingSources(e,Pt.UPDATE),this._elevationProvider.objectChanged(this._collection.getComponentObb(e.objectHandle)))}_safeReschedule(e,t){return c(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=null!=e.params.material?e.params.material:He(),s=t.some((e=>"uvRegion"===e.name)),r=t.some((e=>"normalCompressed"===e.name)),o=qt(i);return{geometryParameters:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=i.map((e=>Ue(e,t,s,r)));this._stage.addMany(o);let a=null;return this._collection.updateMaterial(e,(e=>{a=Ge(e,t,o,i,this.view._stage.renderView.textures,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR,isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference}),this._updateMaterialOverlay(e)})),{textures:o,texturePromise:a}}_getGeometryParameters(e){return new It(this._hasVertexColors,e.hasTexture?e.hasRegions?Ct.Atlas:Ct.Default:Ct.None,e.hasNormals,this._shadeNormals,this._applySSAO)}_addData(e,t,i){let s=this._addTasks.get(e.index);if(s)s.attributeInfo=t;else{const r=u();s=new Xt(t,null,r.promise),this._addTasks.set(e.index,s),i().then(r.resolve,r.reject).then((()=>this._addTasks.delete(e.index))).catch((t=>{throw this._addTasks.delete(e.index),t}))}return s.promise}_clearAddTasks(){this._addTasks.forEach((e=>{null!=e.meta&&(this._cacheGPUData(e.meta),e.meta=null)})),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,i=$();this._renderClippingArea=gt(this.view.clippingArea,i,e)?i:null;const s=$();this._layerClippingArea=gt(this.view.clippingArea,s,t)?s:null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea),this._isIntegratedMesh&&this._modificationsChanged()}get hasGeometryFilter(){return!1}_geometryFilterChange(){const e=this.hasGeometryFilter;this._controller.geometryFilterChanged(e),this._applyFilters(e)}_filterChange(){this._applyFilters(this.hasGeometryFilter)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach((e=>{null!=e&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,Pt.UPDATE))}))}getFilters(){const e=[],t=this._renderClippingArea;return null!=t&&e.push(((e,i)=>this._boundingRectFilter(e,i,t))),e}addSqlFilter(e,t,i){if(null!=t){const s=t.fieldNames;e.push(((e,r)=>this._sqlFilter(e,r,t,s,i)))}}_sqlFilter(e,t,i,s,r){const o={},a=this._createLayerGraphic(o),n=this.i3slayer.objectIdField,l=t.featureIds,d=t.attributeInfo?.attributeData;s.every((e=>e===n||null!=d?.[e]))&&Xe(e,l,(e=>{o[n]=l[e];for(const i of s)i!==n&&(o[i]=d?Ye(d[i],e):null);try{return i.testFeature(a)}catch(t){return r(t),!1}}))}_boundingRectNodeTest(e,t){return L(e.node.serviceMbsInIndexSR,this._controller.crsIndex,Bt,this.view.renderSpatialReference),Je(t,Bt)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,Ht),z(Ht,Ut),Q(i,Ut)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(r===Ze.INSIDE)return;if(r===Ze.OUTSIDE)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const a=this._transformClippingArea(Gt,i,t.objectHandle);Xe(e,t.featureIds,(e=>this._boundingRectFeatureTest(t,e,a)))}_transformClippingArea(e,t,i){const s=this._collection.getObjectTransform(i),r=s.position,o=s.rotationScale;return e[0]=(t[0]-r[0])/o[0],e[1]=(t[1]-r[1])/o[4],e[2]=(t[2]-r[0])/o[0],e[3]=(t[3]-r[1])/o[4],e}async _addOrUpdateEdgeRendering(e,t=!0){const i=e.objectHandle,{hasEdges:s,perFeatureEdgeMaterials:r}=this._getFilteredEdgeMaterials(e);s&&!this._edgeView&&(this._edgeView=await this._stage.renderer.loadEdgeView());const o=this._edgeView;if(!o)return null;const a=o.hasObject(i);if(s){if(a){if(this.nodeCrossfadingEnabled){Yt(r,this.getNodeOpacity(e))}return o.updateAllComponentMaterials(i,r,this.slicePlaneEnabled,t).catch((e=>Vt(e,this.i3slayer.title))),o.updateObjectVisibility(i,!0).catch((e=>Vt(e,this.i3slayer.title))),o.updateAllVerticalOffsets(i,e.elevationOffsets).catch((e=>Vt(e,this.i3slayer.title))),o}const s=await this._collection.addEdges(i,o,r,this.slicePlaneEnabled,e.elevationOffsets);return e.edgeMemoryUsage=s,e.node.memory+=s,o}return a&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,o.removeObject(i)),null}_applyFiltersToNode(e){return!!this._applyFiltersToNodeComponents(e)&&(null!=this._labeler&&this._labeler.applyFilterChange(e),!0)}_applyFiltersToNodeComponents(e){const t=this._collection,i=t.getComponentCount(e.objectHandle),s=null!=e.filteredIds,r=0===i.invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!r;if(this._updateCachedFilteredIds(e),s&&e.filteredIds===e.featureIds)return!r;const o=this._computeFilteredComponentIndices(e);return t.setAllComponentVisibilities(e.objectHandle,o),!0}_updateCachedFilteredIds(e){null!=e.filteredIds&&e.appliedFilters===this._filters||(e.filteredIds=this._computeFilteredIds(e),e.appliedFilters=this._filters)}_computeFilteredIds(e){const t=e.featureIds.slice();for(const i of this._filters)if(i(t,e),0===t.length)break;return t.length===e.featureIds.length?e.featureIds:t}_computeFilteredComponentIndices(e){const t=new Array,i=e.filteredIds;return null!=i&&e.featureIds.forEach(((e,s)=>{i[t.length]===e&&t.push(s)})),t}_removeAllNodeDataFromStage(e=this.elevationOffset){this._nodeId2Meta.forEach(((t,i)=>this._removeNodeStageData(i,e))),this._nodeId2MetaReloading.forEach(((t,i)=>this._removeNodeStageData(i,e,this._nodeId2MetaReloading))),this._elevationTask=n(this._elevationTask)}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading),null!=this._elevationTask&&this._elevationTask.remove(e)}_removeNodeStageData(e,t,i=this._nodeId2Meta){i.has(e)&&this._controller.updateLoadStatus(e,!1);const s=i.get(e);null!=s?(this._collection.setObjectVisibility(s.objectHandle,!1),null!=this._edgeView&&this._edgeView.hasObject(s.objectHandle)&&this._edgeView.updateObjectVisibility(s.objectHandle,!1).catch((e=>Vt(e,this.i3slayer.title))),this._visibleGeometryChanged(s,Pt.REMOVE),null!=this._labeler&&this._labeler.removeNodeMeta(s),i.delete(e),this._highlights.objectDeleted(s),i===this._nodeId2Meta?(this._cacheGPUData(s,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(s)):this._deleteComponentObject(s),null!=this._treeDebugger&&this._treeDebugger.update()):i.delete(e)}_deleteComponentObject(e){if(null!=this._edgeView&&this._edgeView.removeObject(e.objectHandle),this._memEstimateGeometryRemoved(e.objectHandle),this._collection.destroyObject(e.objectHandle),e.textures)for(const t of e.textures)this._memEstimateTextureRemoved(t),this._stage.remove(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);null!=i&&this._collection.updateMaterial(i.objectHandle,(e=>e.polygonOffsetEnabled=t===ke.Hole))}updateNodeIndex(e,t){if(this._nodeId2Meta.has(e)){const i=this._nodeId2Meta.get(e);this._nodeId2Meta.delete(e),this._nodeId2Meta.set(t,i),this.notifyChange("elevationRange")}const i=this._nodeId2MetaReloading.get(e);i&&(this._nodeId2MetaReloading.delete(e),this._nodeId2MetaReloading.set(t,i))}_invalidateAllSymbols(){this._rendererVersion=et(this._rendererVersion,1),this._controller&&this._controller.requestUpdate()}_getInvalidRendererVersion(){return et(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=et(this._rendererVersion,1),this._rendererFields=null,this._colorVariable=null,this._opacityVariable=null,this._invalidateAllSymbols(),e&&(this._rendererFields=await e.getRequiredFields(this.i3slayer.fieldsIndex)),this._updateSymbologyFields(),!this._arcade&&e&&"arcadeRequired"in e&&e.arcadeRequired&&(this._arcade=await de()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:Rt().warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.symbols)"mesh-3d"!==t.type&&Rt().error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getComponentParameters(e){this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(i,s)=>{const r=5*i;V(s.externalColor,t[r]/255,t[r+1]/255,t[r+2]/255,t[r+3]/255);const o=this._stage.renderView.olidRenderHelper;if(o){const t=e.featureIds[i],r=he(this.view.map,this.layerUid);o.setUidToObjectAndLayerId(t,t,this.layerId,this.layerUid+"_"+this.sublayerId,this.layerPopupEnabledAndHasTemplate&&!r,e.node.resources.attributes,i,this.sublayerId),s.objectAndLayerIdColor=this._stage.renderView.getObjectAndLayerIdColor({graphicUid:t,layerUid:this.layerUid+"_"+this.sublayerId})}s.externalColorMixMode=t[r+4]&(1<<Dt.CastShadows)-1,s.castShadows=!!(t[r+4]&1<<Dt.CastShadows),s.pickable=!!(t[r+4]&1<<Dt.Pickable),s.elevationOffset=e.elevationOffsets?.[i]??0}}_getSymbolInfo(e,t){const i=e?.getSymbol(t,{arcade:this._arcade});if(!(i instanceof _e))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=tt(i);return this._symbolInfos.set(s,r),r}_setSymbologyOverride(e,t){this._symbologyOverride!==e&&(this._symbologyOverride=e,this._symbologyOverrideFields=t,this._invalidateAllSymbols(),this._updateSymbologyFields())}_updateSymbologyFields(){this._symbologyFields=null!=this._symbologyOverrideFields&&this._symbologyOverrideFields.length>0?null!=this._rendererFields&&this._rendererFields.length>0?oe(this.i3slayer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){if(e.cachedRendererVersion=this._rendererVersion,!this._hasComponentData)return;const t=this._tmpAttributeOnlyGraphic,i={};t.attributes=i;const s=this._currentRenderer,r=e.attributeInfo?.attributeData,o=e.featureIds?this.i3slayer.objectIdField:null,a=null!=r&&null!=this._symbologyFields&&this._symbologyFields.length>0;let n=null,l=null;if(a&&null!=this._symbologyFields){n=[],l=[];for(const e of this._symbologyFields){const t=r[e];t&&(n.push(e),l.push(t))}}e.cachedSymbology||(e.cachedSymbology=ie(5*e.featureIds.length));const d=new nt,h=this.fullOpacity,c=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):h;let u=null,_=Ot.OPAQUE,m=it,g=0;for(let p=0;p<e.featureIds.length;p++){if(null!=o&&(i[o]=e.featureIds[p]),a&&n)for(let e=0;e<n.length;e++)i[n[e]]=Ye(l[e],p);const r=s?this._getSymbolInfo(s,t):null;let h,f;if(d.pickable=!0,s&&"visualVariables"in s){if(this._colorVariable){const e=ne(this._colorVariable,t,{color:kt,arcade:this._arcade});e&&(h=d.color,h[0]=e.r/255,h[1]=e.g/255,h[2]=e.b/255,h[3]=e.a??1,this._opacityVariable||null===e.a||(f=e.a))}this._opacityVariable&&(f=le(this._opacityVariable,t,{arcade:this._arcade}))}if(r?.material){const e=r.material;h=null==h||null==f?Ee(h,f,e.color,e.alpha,St,d.color):Ee(h,f,null,null,St,d.color)}if(h??=V(d.color,1,1,1,1),d.colorMixMode=r?.material?.colorMixMode??ut.Multiply,d.edgeMaterial=r?.edgeMaterial,this._symbologyOverride?.(t,d),null!=this._nodeColorOverride&&(this._nodeColorOverride(e.node,h),d.colorMixMode=ut.Replace),d.pickable&&=h[3]>=jt,d.castShadows=r?r.castShadows:d.pickable,null!=d.edgeMaterial){const t=h[3]>=1&&(e.material.isOpaque||d.colorMixMode===ut.Replace)?Ot.OPAQUE:Ot.TRANSPARENT;d.edgeMaterial===u&&t===_||(m={...d.edgeMaterial,opacity:c,objectTransparency:t},u=d.edgeMaterial,_=t),e.cachedEdgeMaterials[p]=m}else e.cachedEdgeMaterials[p]=it;e.cachedSymbology[g++]=Math.round(255*h[0]),e.cachedSymbology[g++]=Math.round(255*h[1]),e.cachedSymbology[g++]=Math.round(255*h[2]),e.cachedSymbology[g++]=Math.round(255*h[3]),e.cachedSymbology[g++]=d.colorMixMode|+d.castShadows<<Dt.CastShadows|+d.pickable<<Dt.Pickable}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);this.nodeCrossfadingEnabled||Yt(t,this.fullOpacity);const i=e.filteredIds;if(null==i){return{hasEdges:t.some((e=>e!==it)),perFeatureEdgeMaterials:t}}let s=0,r=!1;const o=t.map(((t,o)=>e.featureIds[o]!==i[s]?it:(r=r||t!==it,s++,t)));return{hasEdges:r,perFeatureEdgeMaterials:o}}_updateComponentData(e){if(!this._hasComponentData)return;const t=e.objectHandle,i=this._getComponentParameters(e);this._collection.setComponentData(t,i),this._stage.renderView.requestRender()}_reloadAll(e=this.elevationOffset){this._removeAllNodeDataFromStage(e),null!=this._controller&&this._controller.restartNodeLoading()}_opacityChange(e){this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopAllNodeFading(),this._nodeId2Meta.forEach((t=>{null!=t&&(this._collection.updateMaterial(t.objectHandle,(t=>t.objectOpacity=e)),Yt(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))}))}_updateMaterial(e){this._collection.updateMaterial(e.objectHandle,(e=>{e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.usePBR=this._usePBR,this._updateMaterialOverlay(e)}))}_updateMaterialOverlay(e){}_updateEngineObject(e){this._updateComponentData(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,Pt.UPDATE)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),null!=this._labeler&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach((t=>{null!=t&&(this._collection.updateMaterial(t.objectHandle,(t=>t.commonMaterialParameters.hasSlicePlane=e)),this._updateEdgeRendering(t,!1))}))}_updatePBR(e){this._nodeId2Meta.forEach((t=>{null!=t&&this._collection.updateMaterial(t.objectHandle,(t=>t.usePBR=e))})),this._hasLoadedPBRTextures=!0}get _usePBR(){return this._shadeNormals&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){null!=this._edgeView&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_ignoreClientNodeOverriddenFeatures(e){return this.i3sOverrides.hasGeometryChanges?(t,i,s)=>s.node.index>=0&&this.i3sOverrides.featureHasGeometryChanges(t)?ve.CONTINUE:e(t,i,s):e}_forAllFeatures(e,t,i){for(const s of this._nodeId2Meta.values()){if(null==s)continue;if(null!=t){switch(t(s)){case ve.EXIT:return;case ve.SKIP:continue}}let r=ve.CONTINUE;switch(i){case Ie.ALL:r=this._forAllFeaturesOfNode(s,e);break;case Ie.VISIBLE_ONLY:r=this._forAllVisibleFeaturesOfNode(s,e);break;case Ie.QUERYABLE:r=this._forAllQueryableFeaturesOfNode(s,e)}if(r===ve.EXIT)return}}_forAllFeaturesOfNode(e,t){let i=ve.CONTINUE;const s=e.featureIds;for(let r=0;r<s.length;r++)if(i=t(s[r],r,e),i===ve.EXIT)return i;return i}_forAllVisibleFeaturesOfNode(e,t){let i=ve.CONTINUE;const s=e.featureIds;return this._collection.forEachVisibleComponent(e.objectHandle,(r=>(i=t(s[r],r,e),i===ve.CONTINUE))),i}_forAllQueryableFeaturesOfNode(e,t){const i=this._ignoreClientNodeOverriddenFeatures(t);if(null==this._renderClippingArea)return this._forAllFeaturesOfNode(e,i);const s=this._boundingRectNodeTest(e,this._renderClippingArea);if(s===Ze.OUTSIDE)return ve.CONTINUE;if(s===Ze.INSIDE)return this._forAllFeaturesOfNode(e,i);const r=ve.CONTINUE,o=e.featureIds,a=e.objectHandle,n=st(this._renderClippingArea,this._collection.getObjectTransform(a));for(let l=0;l<o.length;l++){if(!this._boundingRectFeatureTest(e,l,n))continue;const t=i(o[l],l,e);if(t===ve.EXIT)return t}return r}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=t.attributeInfo?.attributeData;if(null!=s)for(const r of Object.keys(s))i[r]=Ye(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e,t){if(ue(e))return dt;const s=ht(e);if(0===s.length)return dt;const r=t?.name??Et,o=s[0]instanceof i?this._featureIdsFromGraphics(s):"number"==typeof s[0]?s:null;if(!o)return dt;const{set:a,handle:n}=this._highlights.acquireSet(r);return this._highlights.setFeatureIds(a,o),n}_featureIdsFromGraphics(e){const t=this.i3slayer.fieldsIndex,i=this._getObjectIdField();return e.map((e=>lt(t,e.attributes,i)))}resetHighlights(){n(this._highlights),this._highlights=new Se({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,Ie.ALL),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)})}_visibleGeometryChanged(e,t){this._elevationProvider&&(null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=g((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))),this._updateSnappingSources(e,t),this._elevationProvider.objectChanged(this._collection.getComponentObb(e.objectHandle)))}get performanceInfo(){return new pe(this.usedMemory,this._nodeId2Meta.size,Math.round(this._gpuMemoryEstimate/1048576),Math.round(this._geoMemoryEstimate/1048576),Math.round(this._texMemoryEstimate/1048576),Math.round(this.unloadedMemory/1048576),this._idbCacheEnabled?Math.round(100*this._idbCache.getHitRate()):0)}get test(){}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return null!=e?this._collection.getMaterial(e.objectHandle).objectOpacity:0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach(e)}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);null!=s&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);null!=i&&this._setNodeOpacity(i,t)}_setNodeOpacity(e,t){this._collection.updateMaterial(e.objectHandle,(e=>e.objectOpacity=t)),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(null==this._edgeView||!e.cachedEdgeMaterials)return;Yt(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t).catch((e=>Vt(e,this.i3slayer.title)))}get hasModifications(){return this._isIntegratedMesh&&null!=this._layerClippingArea||this._modifications&&this._modifications.length>0}updateNodeModificationStatus(e){const t=e.length;if(!this.hasModifications||t<=0||!0!==this._i3sWasmLoaded)return;const i=this.uid,s=Qt(e);if(s){const t={context:i,buffer:s.buffer};xe(t);const r=new Float64Array(s.buffer);e.forAll(((e,t)=>{const i=r[t],s=Oe(i);e.imModificationImpact=s,s!==Le.Unmodified&&this._controller.invalidateGeometryVisibility(e.index)}))}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||null!=this._labeler&&this._labeler.updating||this._crossfadeHelper?.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0||null!=this._elevationTask&&this._elevationTask.running}trackSnappingSources(e){const t={events:e,fetchEdgeLocations:async(e,t,i)=>{const s=this._nodeId2Meta.get(e);if(null==s)throw new Error("invalid-node");const{origin:r,buffer:o}=await this._collection.extractEdgeInformation(s.objectHandle,t,i);return this._snappingLocationsApplyElevation(s,o,r),{type:"components",objectIds:s.featureIds,locations:o,origin:r}},remove:()=>r(this._snappingSourcesTrackers,t)};return this._snappingSourcesTrackers.push(t),this._nodeId2Meta.forEach(((t,i)=>{if(null==t)return;const s=this._controller.getRenderMbs(t.node);s&&e.add(i,s)})),t}_snappingLocationsApplyElevation(e,t,i){if(!e.elevationOffsets||this.elevationInfo.mode===ye.Absolute)return;const s=t.position0,r=t.position1,o=t.componentIndex,a=F(),n=F(),l=(e,t)=>{A(e,e,i),this.view.renderCoordsHelper.worldUpAtPosition(e,n),A(e,e,D(n,n,t)),T(e,e,i)};for(let d=0;d<s.count;d++){const t=e.elevationOffsets[o.get(d)];s.getVec(d,a),l(a,t),s.setVec(d,a),r.getVec(d,a),l(a,t),r.setVec(d,a)}}_updateSnappingSources(e,t){const{index:i}=e.node,s=this._controller.getRenderMbs(e.node);if(null!=s)for(const r of this._snappingSourcesTrackers)t!==Pt.REMOVE&&t!==Pt.UPDATE||r.events.remove(i),t!==Pt.ADD&&t!==Pt.UPDATE||r.events.add(i,s)}};return e([f()],o.prototype,"_hasLoadedPBRTextures",void 0),e([f()],o.prototype,"_asyncModuleLoading",void 0),e([f()],o.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([f()],o.prototype,"view",void 0),e([f()],o.prototype,"i3slayer",void 0),e([f()],o.prototype,"_controller",void 0),e([f()],o.prototype,"_labeler",void 0),e([f()],o.prototype,"updating",void 0),e([f()],o.prototype,"suspended",void 0),e([f()],o.prototype,"contentVisible",null),e([f({readOnly:!0})],o.prototype,"legendEnabled",null),e([f()],o.prototype,"holeFilling",void 0),e([f(ft)],o.prototype,"updatingProgress",void 0),e([f()],o.prototype,"updatingProgressValue",null),e([f()],o.prototype,"hasTexturesOrVertexColors",null),e([f()],o.prototype,"rendererTextureUsage",null),e([f()],o.prototype,"elevationOffset",null),e([f()],o.prototype,"elevationInfo",null),e([f({type:Boolean})],o.prototype,"slicePlaneEnabled",void 0),e([f()],o.prototype,"supportedTextureEncodings",null),e([f({type:[ae]})],o.prototype,"_modifications",void 0),e([f({readOnly:!0})],o.prototype,"clientGeometry",null),e([f()],o.prototype,"elevationRange",null),e([f()],o.prototype,"fullExtent",null),e([f()],o.prototype,"_elevationTask",void 0),e([f({readOnly:!0})],o.prototype,"_usePBR",null),o=e([b(wt)],o),o};function Vt(e,t){h(e)||Rt().warn("Error while processing edges. Edges on this layer might not display correctly",t,e)}var Pt;!function(e){e[e.ADD=0]="ADD",e[e.REMOVE=1]="REMOVE",e[e.UPDATE=2]="UPDATE"}(Pt||(Pt={}));const Ht=K(),Ut=$(),Gt=$(),Lt=new pt,kt=new t([0,0,0,0]),Bt=ee(0,0,0,0);function qt(e){if(null==e)return!1;const t=e.metallicRoughness;return t&&t.baseColorTextureId>=0||t&&t.metallicRoughnessTextureId>=0||e.normalTextureId>=0||e.emissiveTextureId>=0||e.occlusionTextureId>=0}function Kt(e){return"geometryData"in e}function Wt(e){return null!=e&&p(e.data)}function zt(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(null!=t)for(const s of t)null!=s&&p(s.data)&&(i+=s.data.byteLength);return i}function $t(e,t){return t.byteSize>Nt?(Rt().warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}function Qt(e){if(0===e.length)return;const t=10*e.length,i=new Float64Array(t);let s=0;return e.forAll((e=>{let t=e.serviceObbInIndexSR;null==t&&(t=Lt,t.center=Z(e.serviceMbsInIndexSR),t.halfSize=[e.serviceMbsInIndexSR[3],e.serviceMbsInIndexSR[3],e.serviceMbsInIndexSR[3]]);const r=t.data;i[s++]=r[0],i[s++]=r[1],i[s++]=r[2],i[s++]=r[3],i[s++]=r[4],i[s++]=r[5],i[s++]=r[6],i[s++]=r[7],i[s++]=r[8],i[s++]=r[9]})),i}class Xt{constructor(e,t,i){this.attributeInfo=e,this.meta=t,this.promise=i,this.allowMemCache=!0}}function Yt(e,t){e.forEach((e=>e.opacity=t))}class Jt{constructor(e,t){this.mode=e,this.offset=t}}const Zt=F(),ei=K(),ti="elevation-change",ii="",si="@null",ri="@ECEF",oi=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],ai=new mt;function ni(e,t,i){let s=e.elevationRangeMin,r=e.elevationRangeMax;const o=i;if(o>0){t.getCorners(oi);for(const e of oi){const t=N(e)-o;s=Math.min(s,t),r=Math.max(r,t)}}else{t.getCorners(oi);for(const e of oi){const t=e[2];s=Math.min(s,t),r=Math.max(r,t)}}e.expandElevationRangeValues(s,r)}function li(e,t,i){const s=Z(t),r=i>0?N(s)-i:s[2],o=te(t);e.expandElevationRangeValues(r-o,r+o)}export{Ft as I3SMeshView3D};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../Graphic.js";import{isSome as s,removeUnordered as r}from"../../../core/arrayUtils.js";import{ByteSizeUnit as o}from"../../../core/ByteSizeUnit.js";import has from"../../../core/has.js";import a from"../../../core/Logger.js";import{destroyMaybe as n}from"../../../core/maybe.js";import l from"../../../core/PooledArray.js";import{ignoreAbortErrors as d,isAbortError as h,throwIfAborted as c,createResolver as u}from"../../../core/promiseUtils.js";import{initial as _,watch as m}from"../../../core/reactiveUtils.js";import{schedule as g}from"../../../core/scheduling.js";import{isArrayBuffer as p}from"../../../core/typedArrayUtil.js";import{property as f}from"../../../core/accessorSupport/decorators/property.js";import{subclass as b}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as y,invert as v}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as I}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{multiply as M,getTranslation as C}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{clone as x,create as O}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as E}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{i as j,t as w,q as R,a as S,g as A,h as D,d as T,H as N}from"../../../chunks/vec32.js";import{create as F}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as V}from"../../../chunks/vec42.js";import{fromValues as P}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as H}from"../../../core/support/UpdatingHandles.js";import{getSphericalPCPF as U}from"../../../geometry/spatialReferenceEllipsoidUtils.js";import{localLinearScaleFactors as G}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectBoundingSphere as L}from"../../../geometry/projection/projectBoundingSphere.js";import{projectBuffer as k}from"../../../geometry/projection/projectBuffer.js";import{getProjectorName as B}from"../../../geometry/projection/projectors.js";import{projectVectorToVector as q}from"../../../geometry/projection/projectVectorToVector.js";import{create as K,fromBuffer as W,toRect as z}from"../../../geometry/support/aaBoundingBox.js";import{create as $,intersects as Q}from"../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as X}from"../../../geometry/support/DoubleArray.js";import{compactFloatArray as Y}from"../../../geometry/support/FloatArray.js";import{compactIndices as J}from"../../../geometry/support/Indices.js";import{a as Z,f as ee,g as te}from"../../../chunks/sphere.js";import{newUByteArray as ie}from"../../../geometry/support/UByteArray.js";import{fallbackObjectIDAttribute as se}from"../../../layers/LayerConstants.js";import re from"../../../layers/graphics/controllers/I3SOnDemandController.js";import{fixFields as oe}from"../../../layers/support/fieldUtils.js";import ae from"../../../layers/support/SceneModification.js";import{getColor as ne,getOpacity as le}from"../../../renderers/visualVariables/support/visualVariableUtils.js";import{loadArcade as de}from"../../../support/arcadeOnDemand.js";import{isBasemapLayer as he}from"../../../support/basemapUtils.js";import{getElevationOffset as ce}from"../../../support/elevationInfoUtils.js";import{isQuery as ue}from"../../../support/guards.js";import _e from"../../../symbols/MeshSymbol3D.js";import me from"../../../symbols/SimpleFillSymbol.js";import ge from"./I3SMeshViewLabeler.js";import{I3SMeshViewPerformanceInfo as pe}from"./I3SMeshViewPerformanceInfo.js";import{I3SMeshWorkerHandle as fe,toWasmModification as be}from"./I3SMeshWorkerHandle.js";import{ElevationMode as ye,ForAllFeaturesReturnType as ve,ForAllFeaturesMode as Ie}from"./II3SMeshView3D.js";import{initialize as Me,setModificationsSync as Ce,filterObbsForModificationsSync as xe,interpretObbModificationResults as Oe}from"./SceneLayerWorker.js";import{overrideColor as Ee}from"./graphics/graphicUtils.js";import{areLabelsVisible as je}from"./graphics/Labeler.js";import{TextureUsage as we,TextureEncoding as Re}from"./i3s/enums.js";import Se from"./i3s/Highlights.js";import{I3SAsyncElevationUpdater as Ae}from"./i3s/I3SAsyncElevationUpdater.js";import{I3SCrossfadeHelper as De,NodeCrossfadeMetaData as Te}from"./i3s/I3SCrossfadeHelper.js";import{boundingBoxCornerPoints as Ne}from"./i3s/I3SGeometryUtil.js";import{I3SIntersectionHandler as Fe}from"./i3s/I3SIntersectionHandler.js";import{getSupportedEncodings as Ve,selectEncoding as Pe,defaultMaterial as He,createTexture as Ue,configureMaterial as Ge}from"./i3s/I3SMaterialUtil.js";import{NodeIMModificationImpact as Le,NodeState as ke}from"./i3s/I3SNode.js";import{I3SOverrides as Be}from"./i3s/I3SOverrides.js";import{computeGlobalTransformation as qe}from"./i3s/I3SProjectionUtil.js";import{rendererNeedsTextures as Ke,checkSceneLayerValid as We,checkSceneLayerCompatibleWithView as ze,whenGraphicAttributes as $e,computeVisibilityObb as Qe,filterInPlace as Xe,getCachedAttributeValue as Ye,intersectBoundingRectWithMbs as Je,MbsIntersectResult as Ze,addWraparound as et,getSymbolInfo as tt,transparentEdgeMaterial as it,getClipRect as st}from"./i3s/I3SUtil.js";import{IDBCache as rt}from"./i3s/IDBCache.js";import{IDBMockCache as ot}from"./i3s/IDBMockCache.js";import{LayerElevationProvider as at}from"./i3s/LayerElevationProvider.js";import{SymbologyInfo as nt}from"./i3s/SymbologyInfo.js";import{attributeLookup as lt}from"./support/attributeUtils.js";import{emptyHighlightHandle as dt,normalizeHighlightTargetExceptQuery as ht}from"./support/highlightUtils.js";import{makeScheduleFunction as ct}from"./support/makeScheduleFunction.js";import{ColorMixModeEnum as ut}from"./support/symbolColorUtils.js";import{debugFlags as _t}from"../support/debugFlags.js";import{ElevationRange as mt}from"../support/ElevationRange.js";import{toBoundingRect as gt}from"../support/extentUtils.js";import{Obb as pt}from"../support/orientedBoundingBox.js";import{updatingProgress as ft}from"../support/updatingProperties.js";import{glLayout as bt}from"../support/buffer/glUtil.js";import{ObjectParameters as yt}from"../webgl-engine/collections/Component/ObjectParameters.js";import{createVertexBufferLayout as vt,GeometryParameters as It}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as Mt}from"../webgl-engine/collections/Component/Transform.js";import{TextureCoordinateType as Ct}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{loadBasisTranscoder as xt}from"../webgl-engine/lib/BasisUtil.js";import{Transparency as Ot}from"../webgl-engine/lib/edgeRendering/interfaces.js";import{defaultHighlightName as Et}from"../../support/HighlightDefaults.js";import{alphaCutoff as jt}from"../../../webscene/support/AlphaCutoff.js";const wt="esri.views.3d.layers.I3SMeshView3D",Rt=()=>a.getLogger(wt),St=[1,1,1,1];class At extends Te{constructor(e,t,i,s,r,o,a,n,l){super(),this.node=e,this.featureIds=t,this.objectHandle=i,this.cachedRendererVersion=s,this.attributeInfo=r,this.material=o,this.textures=a,this.anchorIds=n,this.anchors=l,this.cachedElevationAnchors=null,this.cachedEdgeMaterials=new Array,this.edgeMemoryUsage=0}get cachedMemory(){return this.node.memory}get featureExtents(){return this._featureExtents??=new Float64Array(6*this.featureIds.length).fill(Number.POSITIVE_INFINITY),this._featureExtents}}var Dt;!function(e){e[e.CastShadows=4]="CastShadows",e[e.Pickable=5]="Pickable"}(Dt||(Dt={}));const Tt=26,Nt=100*o.MEGABYTES,Ft=t=>{let o=class extends t{constructor(){super(...arguments),this._applySSAO=!0,this._shadeNormals=!0,this._updatingHandles=new H,this._nodeId2Meta=new Map,this._nodeId2MetaReloading=new Map,this._i3sWasmLoaded=!1,this._snappingSourcesTrackers=[],this._hasLoadedPBRTextures=!1,this._asyncModuleLoading=0,this._addTasks=new Map,this._currentRenderer=null,this._rendererVersion=0,this._colorVariable=null,this._opacityVariable=null,this._rendererFields=null,this._symbologyFields=null,this._symbologyOverride=null,this._symbologyOverrideFields=null,this._symbolInfos=new Map,this._visibleGeometryChangedSchedulerHandle=null,this._hasComponentData=!1,this._hasVertexColors=!1,this._nodeColorOverride=null,this.updating=!0,this.holeFilling="auto",this._hasColors=!1,this._hasTextures=!1,this._hasData=!1,this.slicePlaneEnabled=!1,this._modifications=new Array,this.ignoresMemoryFactor=!1,this._layerUrl="",this._cacheKeySuffix=null,this._planetRadiusInGlobalMode=0,this._elevationTask=null,this._filters=[],this._arcade=null,this._tmpAttributeOnlyGraphic=new i,this._crossfadeHelper=new De(this)}get lodCrossfadeoutDuration(){return 0}get lodCrossfadeinDuration(){return 0}get lodCrossfadeUncoveredDuration(){return 0}get layerUid(){return this.i3slayer&&this.i3slayer.uid}get sublayerUid(){return null}get layerId(){return this.i3slayer&&this.i3slayer.id}get sublayerId(){return null}get contentVisible(){return!this.suspended&&this._controller?.rootNodeVisible&&this.fullOpacity>jt}get legendEnabled(){return this.contentVisible&&!0===this.i3slayer?.legendEnabled}get updatingProgressValue(){return this._controller?.updatingProgress??0}get hasTexturesOrVertexColors(){return this._hasData?this._hasTextures||this._hasColors?"yes":"probably-not":"unknown"}get rendererTextureUsage(){return Ke(this._currentRenderer)?this._usePBR||this._hasLoadedPBRTextures?we.AllTexturesPBR:we.AllTextures:this._usePBR||this._hasLoadedPBRTextures?we.GeometryTexturesPBR:we.GeometryTextures}get elevationOffset(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;return null!=e&&"absolute-height"===e.mode?ce(e,this.i3slayer.spatialReference):0}get elevationInfo(){const e=null!=this.i3slayer?this.i3slayer.elevationInfo:null;if(null==e)return new Jt(ye.Absolute,0);const t=ce(e,this.i3slayer.spatialReference);switch(e.mode){case"absolute-height":return new Jt(ye.Absolute,t);case"relative-to-ground":return new Jt(ye.RelativeToGround,t);case"on-the-ground":return new Jt(ye.OnTheGround,0);default:return new Jt(ye.Absolute,0)}}get supportedTextureEncodings(){return Ve(this.view._stage.renderView.capabilities)}get clientGeometry(){return this.i3sOverrides.geometryOverrides}get elevationRange(){const e=this._nodeId2Meta,t=new mt;for(const i of e.values()){if(null==i)continue;const{node:{serviceMbsInIndexSR:e}}=i,[s,r,o,a]=e;t.expandElevationRangeValues(o-a,o+a)}return t.elevationRangeValid?t:null}get fullExtent(){return this.i3slayer.fullExtent}initialize(){const e=has("enable-feature:idb-mock-cache");this._idbCache=e?new ot(this.view,e):new rt("esri-scenelayer-cache","geometries"),this._preLoadBasis(),this.addResolvingPromise(this.i3slayer.indexInfo);const t=this.view.resourceController,i=t.memoryController;this.i3sOverrides=new Be({view:this.view,layer:this.i3slayer,memoryController:i}),this._worker=new fe(ct(t)),this.addResolvingPromise(this._worker.promise);const s=this.i3slayer.store;this.addResolvingPromise(this._worker.setLegacySchema(this.uid,s.defaultGeometrySchema).catch(d)),We(this.i3slayer),ze(this.i3slayer,this.view),this._layerUrl=this.i3slayer.parsedUrl.path,this._controller=new re({layerView:this,worker:this._worker}),this._gpuMemoryEstimate=0,this._texMemoryEstimate=0,this._geoMemoryEstimate=0,this._stage=this.view._stage,this._collection=this._stage.renderView.componentObjectCollection,this.resetHighlights();const r=s.defaultGeometrySchema;if(this._isIntegratedMesh||!r)this._hasComponentData=!1;else{const e=r.featureAttributes;this._hasComponentData=!!(e&&e.faceRange&&e.id)}this._hasVertexColors=null!=(r?.vertexAttributes.color??null)&&!this.i3slayer.cachedDrawingInfo?.color;const o=this.view.resourceController.memoryController.newCache(`sl-${this.uid}`,(e=>this._deleteComponentObject(e)));this._memCache=o;const a=this._controller,l=this._nodeId2Meta,h=this._nodeId2MetaReloading,c=e=>{const t=a.index;if(!t)return;const i=t.rootNode;if(!i)return;const s=t=>{const i=t.index,s=l.get(i)||h.get(i);return e(t,s?.objectHandle??null)};t.traverse(i,s)};this._intersectionHandler=new Fe({layerUid:this.layerUid,sublayerUid:this.sublayerUid,collection:this._collection,slicePlaneEnabled:this.slicePlaneEnabled,isGround:this._isIntegratedMesh,traverseNodeHierarchy:c}),this._updatingHandles.add((()=>this.layerUid),(e=>this._intersectionHandler.layerUid=e)),this._updatingHandles.add((()=>this.sublayerUid),(e=>this._intersectionHandler.sublayerUid=e)),this._elevationProvider=new at({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this._hasLoadedPBRTextures=this._usePBR,this._updatingHandles.add((()=>this.view.clippingArea),(()=>this._clippingAreaChanged()),_),this._updatingHandles.add((()=>this.fullOpacity),(e=>this._opacityChange(e))),this._updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(e))),this._updatingHandles.add((()=>this.elevationOffset),((e,t)=>{this._reloadAll(t),this._controller.invalidateVisibilityObbs()})),this._updatingHandles.add((()=>this.elevationInfo),((e,t)=>this._elevationInfoChanged(e,t)),_),this._updatingHandles.add((()=>!this.suspended&&this.elevationInfo.mode!==ye.Absolute),((e,t)=>{e?this.addHandles(this.view.basemapTerrain.on("elevation-change",(({extent:e})=>this._ensureElevationTask().addExtent(e))),ti):t&&this.removeHandles(ti)}),_),this._updatingHandles.add((()=>this._usePBR),(e=>this._updatePBR(e)));const u=()=>{this._reloadAll(),this.clearMemCache()};this._updatingHandles.add((()=>this.rendererTextureUsage),u),this._updatingHandles.add((()=>this.contentVisible),(e=>this._contentVisibleChanged(e)),_),this._updatingHandles.add((()=>this.i3slayer.labelsVisible),(()=>this._labelingChanged()),_),this._updatingHandles.add((()=>this.i3slayer.labelingInfo),(()=>this._labelingChanged()),_),this._updatingHandles.add((()=>this._modifications),(()=>this._modificationsChanged()),_),this.addHandles([m((()=>_t.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&_t.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||_t.I3S_TREE_SHOW_TILES||(this._treeDebugger=n(this._treeDebugger))}),_),m((()=>_t.I3S_SHOW_MODIFICATIONS),(()=>this._showModifications()),_)]),this._cacheKeySuffix=this._getCacheKeySuffix(),this._idbCache.init().catch((e=>Rt().warn(`Failed to initialize IndexedDB cache: ${e}`)));const{view:g}=this,{viewingMode:p,renderCoordsHelper:f}=g;this._planetRadiusInGlobalMode="local"===p?0:f.referenceEllipsoid.radius}destroy(){this._clearAddTasks(),this._elevationTask=n(this._elevationTask),this.i3sOverrides=n(this.i3sOverrides),this._elevationProvider&&(this._elevationProvider.objectsChanged(this.getVisibleObbs()),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._intersectionHandler&&(this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null);const e=this._worker;e&&(e.destroyContext(this.uid).then((()=>e.destroy())),this._worker=null),this._removeAllNodeDataFromStage(),this._memCache=n(this._memCache),this._collection=null,this._stage=null,this._edgeView=null,this._labeler=n(this._labeler),this._treeDebugger=n(this._treeDebugger),this._controller=n(this._controller),this._highlights.destroy(),this._nodeId2Meta.clear(),this._nodeId2MetaReloading.clear(),this._crossfadeHelper=n(this._crossfadeHelper),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null),this._updatingHandles=n(this._updatingHandles)}_memEstimateTextureAdded(e){const t=e.usedMemory;return this._gpuMemoryEstimate+=t,this._texMemoryEstimate+=t,t}_memEstimateTextureRemoved(e){if(null!=e){const t=e.usedMemory;this._gpuMemoryEstimate-=t,this._texMemoryEstimate-=t}}_memEstimateGeometryAdded(e){const t=this._collection.getObjectGPUMemoryUsage(e);return this._gpuMemoryEstimate+=t,this._geoMemoryEstimate+=t,t}_memEstimateGeometryRemoved(e){const t=this._collection.getObjectGPUMemoryUsage(e);this._gpuMemoryEstimate-=t,this._geoMemoryEstimate-=t}isNodeLoaded(e){return this._nodeId2Meta.has(e)}isNodeReloading(e){return this._nodeId2MetaReloading.has(e)}get usedMemory(){let e=null!=this._labeler?this._labeler.usedMemory:0;return this._nodeId2Meta.forEach((t=>e+=null!=t?t.node.memory:0)),this._nodeId2MetaReloading.forEach((t=>e+=null!=t?t.node.memory:0)),e}get unloadedMemory(){return(null!=this._controller?this._controller.unloadedMemoryEstimate:0)+(null!=this._labeler?this._labeler.unloadedMemoryEstimate:0)}_labelingChanged(){if(!(je(this.i3slayer)&&this._supportsLabeling))return void(null!=this._labeler&&(this._labeler.destroy(),this._labeler=null));if(null!=this._labeler)return;const e=new ge({view:this.view,layer:this.i3slayer,collection:this._collection,overrides:this.i3sOverrides});this._nodeId2Meta.forEach((t=>null!=t&&this._addMetaToLabeler(e,t))),this._labeler=e}_loadAsyncModule(e){return++this._asyncModuleLoading,e.then((e=>(--this._asyncModuleLoading,e)),(e=>{throw--this._asyncModuleLoading,e}))}_modificationsChanged(){if(!this._i3sWasmLoaded&&this.hasModifications)return this._i3sWasmLoaded=Me().then((()=>{this._i3sWasmLoaded=!0,this._modificationsChanged(),this.notifyUpdate()})),void this.notifyUpdate();if(!0!==this._i3sWasmLoaded)return;const e=this.uid,t=this.i3slayer.spatialReference;this._worker.setModifications(e,this._layerClippingArea,this._modifications,t);const i=be(this._layerClippingArea,this._modifications,t);Ce({context:e,modifications:i,isGeodetic:t.isGeographic}),this._controller.modificationsChanged();const s=this.hasModifications?new l:null;this._nodeId2Meta.forEach(((e,t)=>{null==e?(this._nodeId2Meta.delete(t),this._controller.updateLoadStatus(t,!1)):e.node.hasModifications?(this._nodeId2Meta.delete(t),this._nodeId2MetaReloading.set(t,e)):null!=s&&s.push(e.node)})),this.notifyChange("elevationRange"),null!=s&&this._nodeId2MetaReloading.forEach((e=>s.push(e.node))),null!=s&&s.length>0&&(this.updateNodeModificationStatus(s),s.forAll((e=>{if(e.imModificationImpact!==Le.Culled){const t=this._nodeId2Meta.get(e.index);this._controller.invalidateGeometryVisibility(e.index),null!=t?(this._nodeId2Meta.delete(e.index),this._nodeId2MetaReloading.set(e.index,t),this.notifyChange("elevationRange")):this._nodeId2Meta.has(e.index)&&(this._nodeId2Meta.delete(e.index),this._controller.updateLoadStatus(e.index,!1))}}))),this.clearMemCache(),this._controller.restartNodeLoading(),this._showModifications()}_showModifications(){if(null!=this._modificationGraphics&&(this.view.graphics.removeMany(this._modificationGraphics),this._modificationGraphics=null),!_t.I3S_SHOW_MODIFICATIONS||0===this._modifications.length)return;const e={clip:[227,227,79,.8],mask:[227,139,79,.8],replace:[139,227,79,.8]},t={outline:{color:[255,255,255],width:1}};this._modificationGraphics=new Array;for(const s of this._modifications){const r=s.geometry;r.spatialReference=this.i3slayer.spatialReference;const o=new me({...t,color:e[s.type]});this._modificationGraphics.push(new i({geometry:r,symbol:o}))}this.view.graphics.addMany(this._modificationGraphics)}_addMetaToLabeler(e,t){e.addNodeMeta(t,((e,t)=>this._createAttributes(e,t)))}_contentVisibleChanged(e){e?(this.view.elevationProvider.register(this._elevationContext,this._elevationProvider),this._stage.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler)):(this._removeAllNodeDataFromStage(),this.view.elevationProvider&&this.view.elevationProvider.unregister(this._elevationProvider),this._stage.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler))}getLoadedAttributes(e){const t=this._nodeId2Meta.get(e);if(null!=t?.attributeInfo)return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this._nodeId2Meta.get(e);if(null!=t?.attributeInfo)return t.attributeInfo.attributeData}setAttributeData(e,t){const i=this._nodeId2Meta.get(e);null!=i?.attributeInfo&&(i.attributeInfo.attributeData=t,this._attributeValuesChanged(i))}async updateAttributes(e,t,i){const s=this._nodeId2Meta.get(e);null!=s&&(await this.i3sOverrides.applyAttributeOverrides(s.featureIds,t,i,this._controller.requiredAttributes),s.attributeInfo=t,this._controller.reschedule((()=>this._attributeValuesChanged(s)),i).catch((e=>{h(e)||Rt().warn("Error while updating attribute values. Layer might not display correctly.",e)})))}_attributeValuesChanged(e){e.cachedRendererVersion=this._getInvalidRendererVersion(),e.filteredIds=null,null!=this._labeler&&this._labeler.setNodeMetaAttributes(e,((e,t)=>this._createAttributes(e,t))),this._updateEngineObject(e)}clearMemCache(){null!=this._memCache&&this._memCache.clear(),this._addTasks.forEach((e=>e.allowMemCache=!1))}getVisibleNodes(){const e=new Array;return this._nodeId2Meta.forEach((t=>null!=t&&e.push(t.node))),e}getVisibleObbs(){const e=new Array;return this._nodeId2Meta.forEach((t=>t&&e.push(this._collection.getComponentObb(t.objectHandle)))),e}getLoadedNodeIndices(e){this._nodeId2Meta.forEach(((t,i)=>e.push(i))),this._nodeId2MetaReloading.forEach(((t,i)=>e.push(i)))}_preLoadBasis(){!has("disable-feature:i3s-basis")&&this.supportedTextureEncodings&Re.Basis&&this.i3slayer.textureSetDefinitions?.some((e=>e.formats.some((e=>"basis"===e.format||"ktx2"===e.format))))&&xt()}_getVertexBufferLayout(e,t){return bt(vt(this._getGeometryParameters({hasTexture:qt(e.params.material),hasNormals:t.normal,hasRegions:t.uvRegion})))}_getObjectIdField(){return this.i3slayer.objectIdField||se}_getGlobalIdField(){return this.i3slayer.associatedLayer?.globalIdField}_findGraphicNodeAndIndex(e){const t=lt(this.i3slayer.fieldsIndex,e.attributes,this._getObjectIdField());for(const i of this._nodeId2Meta.values()){const e=i?.featureIds.indexOf(t);if(null!=e&&e>=0)return{node:i.node,index:e}}return null}_getGraphicIndices(e,t){const i=this._nodeId2Meta.get(e.index);if(null==i)return[];const s=[],r=this._getObjectIdField(),o=this.i3slayer.fieldsIndex;for(const a of t){const e=lt(o,a.attributes,r),t=i.featureIds.indexOf(e);-1!==t&&s.push(t)}return s}whenGraphicBounds(e){const t=this._findGraphicNodeAndIndex(e);if(!t)return Promise.reject();const i=this._getAABB(t.node.index,t.index);return null==i?Promise.reject():Promise.resolve({boundingBox:i,screenSpaceObjects:[]})}getAABBFromIntersectorTarget(e){return null==e.nodeIndex||null==e.componentIndex?null:this._getAABB(e.nodeIndex,e.componentIndex)}_getAABB(e,t){const i=this._nodeId2Meta.get(e);if(null==i?.featureIds||t>=i.featureIds.length)return null;const s=i.objectHandle,r=Ne(t,this._collection,s,X(24),0),o=this.view.renderSpatialReference,a=this.view.spatialReference;return k(r,o,0,r,a,0)?W(r):null}whenGraphicAttributes(e,t){return $e(this.i3slayer,e,this._getObjectIdField(),t,(()=>[...this._nodeId2Meta.values()].filter(s)))}getGraphicFromIntersectorTarget(e){if(null==e.nodeIndex||null==e.componentIndex)return null;const t=this._nodeId2Meta.get(e.nodeIndex);return null==t?.featureIds||e.componentIndex>=t.featureIds.length?null:this._createGraphic(e.componentIndex,t)}_getCacheKey(e){return`${this._layerUrl}/v${Tt}/${e}${this._cacheKeySuffix}`}_getCacheKeySuffix(){const e=this.view.renderSpatialReference;if(null==e)return si;if(e===U(e))return ri;return this.i3slayer.spatialReference.equals(e)?ii:null!=e.wkid?`@${e.wkid}`:null}_getMemCacheKey(e,t=this.elevationOffset){return e+"#"+t}get _idbCacheEnabled(){return!this._controller.disableIDBCache&&!this.hasModifications&&0===this.elevationOffset&&null!=this._cacheKeySuffix}loadCachedGPUData(e){return null!=this._memCache?this._memCache.pop(this._getMemCacheKey(e)):null}deleteCachedGPUData(e){null!=e&&this._deleteComponentObject(e)}_cacheGPUData(e,t=this.elevationOffset){if(null==this._memCache)return void this._deleteComponentObject(e);const i=this._controller.indexDepth-e.node.level;this._memCache.put(this._getMemCacheKey(e.node.index,t),e,i)}loadMissingTextures(e,t,i,s){const r=e?.filter(((e,i)=>{if(!(e.usage&this.rendererTextureUsage))return!1;if(null==t)return!0;const s=Pe(e.encodings,this.supportedTextureEncodings),r=t[i];return!!(null==r?.data||s&&r.encoding!==s.encoding)}))??[];return 0===r.length?Promise.resolve(!1):i(r,s).then((i=>{let s=0;for(let r=0;r<e.length;r++)s<i.length&&i[s].id===e[r].id&&(t[r]=i[s],s++);return!0}))}loadCachedNodeData(e,t,i){return this._idbCacheEnabled?this._idbCache.get(this._getCacheKey(e.id),t).then((s=>null==s?null:s.nodeVersion!==e.version?(this._idbCache.remove(this._getCacheKey(e.id)),null):(this.elevationInfo.mode===ye.Absolute&&(e.geometryObbInRenderSR=pt.fromData(s.geometryObbData)),this.loadMissingTextures(s.requiredTextures,s.textureData,i,t).then((i=>(i&&this._idbCache.initialized&&null!=s.textureData&&(s.byteSize=zt(s.transformedGeometry,s.textureData),s.textureData.every(Wt)&&$t(e,s)&&this._idbCache.put(this._getCacheKey(e.id),s).catch((t=>Rt().warn(`Failed to update node with textures in IndexedDB cache: ${e.id}: ${t}`)))),c(t),s)))))):Promise.resolve(null)}addNode(e,t,i){return Kt(t)?null==t.geometryBuffer?(this._addNodeMeta(e.index,null),Promise.resolve()):this._addData(e,t.attributeDataInfo,(()=>this._transformNode(e,t,i).then((s=>this._safeReschedule((()=>{if(null==s)return e.hasModifications=!1,this._addCachedNodeData(e,null,i);e.hasModifications=s.transformedGeometry.hasModifications;const{obb:r,componentOffsets:o,featureIds:a,anchorIds:n,anchors:l,transformedGeometry:d,globalTrafo:h}=s,c=j(Zt,r.center.x,r.center.y,r.center.z);w(c,c,h);const u=new pt(c,[r.extents.x,r.extents.y,r.extents.z],E(r.orientation.x,r.orientation.y,r.orientation.z,r.orientation.w));this.elevationInfo.mode===ye.Absolute&&(e.geometryObbInRenderSR=u),t.geometryData.componentOffsets=o,a&&(t.geometryData.featureIds=Array.from(a)),t.geometryData.anchorIds=n,t.geometryData.anchors=l;const _={nodeVersion:e.version,geometryData:t.geometryData,requiredTextures:t.requiredTextures,textureData:t.textureData,transformedGeometry:d,globalTrafo:h,geometryObbData:u.data,byteSize:zt(d,t.textureData)};if(this._idbCacheEnabled&&this._idbCache.initialized&&$t(e,_)){const t=null!=_.textureData?_.textureData.map((e=>Wt(e)?e:null)):null;this._idbCache.put(this._getCacheKey(e.id),{..._,textureData:t}).catch((t=>Rt().warn(`Failed to store node in IndexedDB cache: ${e.id}: ${t}`)))}return this._addCachedNodeData(e,_,i)}),i))))):Promise.reject()}getElevationRange(e){const t=new mt,i=this._controller,{index:s}=i;if(!s)return t;const{rootNode:r}=s;if(!r)return t;const o=this._nodeId2Meta,a=e[3],n=i.viewportQueries,l=this._planetRadiusInGlobalMode,{view:d}=this,{renderCoordsHelper:h}=d,c=h.referenceEllipsoid.radius,u=this._collection,_=i=>{const{childrenLoaded:s}=i;if(0===s)return!1;const r=n.getAndUpdateVisibilityObbInRenderSR(i);let d=null,_=-1;if(r){if(_=r.radius,!r.intersectSphereWithMBS(e,_))return!1}else d=n.getServiceMbsInRenderSR(i),d&&(_=d[3]);if(_>=0&&a>=1*_)return null!=r?ni(t,r,l):null!=d&&d[3]>=0&&li(t,d,l),!1;const m=ai;if(m.elevationRangeMin=1/0,m.elevationRangeMax=-1/0,(null!=r||null!=d)&&(null!=r?ni(m,r,l):null!=d&&li(m,d,l),m.elevationRangeMin>=t.elevationRangeMin&&m.elevationRangeMax<=t.elevationRangeMax))return!1;const g=o.get(i.index);if(g){const{geometryObbInRenderSR:s}=i;if(!s||s.intersectSphereWithMBS(e)){if(s){if(a>0*s.radius)return ni(t,s,l),!1}const{objectHandle:e}=g,i=u.getObjectTransform(e),r=h.getAltitude(i.position);u.expandRangeWithComponentObjectElevationRange(e,r,c,t)}}return s-(g?1:0)>0};return s.traverse(r,_),t}computeVisibilityObb(e){return Qe(e,this.view.renderSpatialReference,this._controller.crsIndex,this.i3slayer.spatialReference,this.elevationOffset,this._modifications,this.view.renderCoordsHelper.sphericalPCPF)}_transformNode(e,t,i){const s=t.geometryData.geometries??[],r=new Array(s.length);for(let p=0;p<s.length;++p)r[p]=this._getVertexBufferLayout(s[p],t.geometryDescriptor);const o=this.i3slayer.normalReferenceFrame,a=t.normalReferenceFrame??o??"none",n=e.serviceMbsInIndexSR,l=this.elevationOffset,d=this._controller.crsIndex,h=this._controller.crsVertex,c=this.view.renderSpatialReference,u=qe(n,l,a,d,c),_=B(d,h),m=B(h,c);if(null==_||null==m)return Promise.resolve(null);const g={context:this.uid,geometryBuffer:t.geometryBuffer,geometryData:t.geometryData,geometryDescriptor:t.geometryDescriptor,layouts:r,globalTrafo:u,mbs:n,obbData:e.serviceObbInIndexSR?.data,elevationOffset:l,needNormals:this._controller.isMeshPyramid,normalReferenceFrame:a,indexToVertexProjector:_,vertexToRenderProjector:m};return this._worker.invoke(g,i)}get _supportsNodeCrossFading(){return!this.view?._stage?.renderer.shadowsEnabled}get nodeCrossfadingEnabled(){return this._supportsNodeCrossFading&&(this.lodCrossfadeinDuration>0||this.lodCrossfadeoutDuration>0||this.lodCrossfadeUncoveredDuration>0)}get nodeFadeoutEnabled(){return this._supportsNodeCrossFading&&this.lodCrossfadeoutDuration>0}_setNewNodeOpacity(e){const t=this.nodeCrossfadingEnabled?0:this.fullOpacity;this._setNodeOpacity(e,t)}addCachedGPUData(e,t,i){if(this.elevationInfo.mode===ye.Absolute&&(e.geometryObbInRenderSR=this._collection.getComponentObb(t.objectHandle).clone()),!this._controller.isGeometryVisible(e))return void this._cacheGPUData(t);null!=this._labeler&&this._addMetaToLabeler(this._labeler,t);const s=e.index;this._addNodeMeta(s,t),this.updateNodeState(s,i),this._collection.setObjectVisibility(t.objectHandle,!0),this._updateMaterial(t),this._setNewNodeOpacity(t),this.elevationInfo.mode!==ye.Absolute&&this._ensureElevationTask().schedule(s),this._updateEngineObject(t),this._highlights.objectCreated(t),null!=this._treeDebugger&&this._treeDebugger.update()}addCachedNodeData(e,t,i,s){return this._addData(e,i,(()=>this._addCachedNodeData(e,t,s)))}async deleteCachedNodeData(e){if(this._idbCacheEnabled)return this._idbCache.remove(this._getCacheKey(e))}async _addCachedNodeData(e,t,i){if(!this.contentVisible||!this._controller.isGeometryVisible(e))return void this._removeNodeStageData(e.index,this.elevationOffset,this._nodeId2MetaReloading);if(null==t)return void this._addNodeMeta(e.index,null);const s=this._addTasks.get(e.index),{geometryData:r,transformedGeometry:o,globalTrafo:a}=t;await this.i3sOverrides.applyAttributeOverrides(r.featureIds,s.attributeInfo,i,this._controller.requiredAttributes);const n=null!=t.textureData?t.textureData.filter((e=>null!=e&&!!(e.usage&this.rendererTextureUsage))):[];!has("disable-feature:i3s-basis")&&n.some((e=>null!=e&&(e.encoding===Re.Basis||e.encoding===Re.KTX2)))&&await xt(),e.memory=0;const{componentOffsets:l,geometries:d,featureIds:h,anchorIds:c,anchors:u}=r,_=this._collection,m=d[0],{layout:g,indices:p,interleavedVertexData:f,positionData:b,hasColors:E}=o,{material:j,geometryParameters:w}=this._materialParameters(m,g),A=l||new Uint32Array([0,p?p.length:f.byteLength/g[0].stride]),D={vertices:{data:f,count:f.byteLength/g[0].stride,layoutParameters:w},positionData:{positions:Y(b.data),indices:J(b.indices)},indices:p,componentOffsets:A},T=m.transformation?x(m.transformation):O();M(T,a,T);const N=C(F(),T),V=y(I(),T),H=this.view.renderSpatialReference,U=this.view.basemapTerrain.spatialReference,L=pt.fromData(t.geometryObbData).center,k=[1,1,1];G(L,H,k,U)||Rt().errorOnce("Unsupported coordinate system for IM overlay");const B=F();q(L,H,B,U);const K=I();v(K,V);const W=F();R(W,S(W,L,N),K);const z=B[0]-W[0]*k[0],$=B[1]-W[1]*k[1],Q=_.createObject(new yt(P(z,$,k[0],k[1]),new Mt(N,V),pt.fromData(t.geometryObbData),D)),X=w.textureCoordinates===Ct.Atlas,{textures:Z,texturePromise:ee}=this._initMaterialAndTextures(Q,j,n,X);e.memory+=this._memEstimateGeometryAdded(Q),e.memory+=Z.reduce(((e,t)=>e+(null!=t?this._memEstimateTextureAdded(t):0)),0);const te=!!j.hasParametersFromSource,ie="blend"!==j.alphaMode&&j.metallicRoughness.baseColorFactor[3]>=1,se=new At(e,h,Q,this._getInvalidRendererVersion(),s.attributeInfo,{hasParametersFromSource:te,isOpaque:ie},Z,c,u);s.meta=se,this._hasTextures||=t.requiredTextures?.some((({usage:e})=>!!(e&we.ColorTextures))),this._hasData=!0,this._hasColors||=E,this._hasTextures||=!!e.resources.texture,this.notifyChange("hasTexturesOrVertexColors");const re=this.slicePlaneEnabled;return Promise.all([this._addOrUpdateEdgeRendering(se),ee]).then((([t,s])=>(this._addTasks.has(e.index)&&t?.updateObjectVisibility(se.objectHandle,!1).catch((e=>Vt(e,this.i3slayer.title))),this._safeReschedule((()=>{const i=this._addTasks.get(e.index);if(!i)return;if(this._addNodeMeta(e.index,se),i.meta=null,!this.contentVisible)return void this._removeNodeStageData(e.index,this.elevationOffset);_.setObjectVisibility(Q,!0),t?.updateObjectVisibility(se.objectHandle,!0).catch((e=>Vt(e,this.i3slayer.title))),se.attributeInfo=i.attributeInfo;const s=se.cachedRendererVersion!==this._rendererVersion,r=re!==this.slicePlaneEnabled;this._updateElevationOffsets(se);const o=se.elevationOffsets;this._updateComponentData(se);const a=this._applyFiltersToNode(se);(s||null!=t&&(r||a||o))&&this._addOrUpdateEdgeRendering(se),null!=this._labeler&&this._addMetaToLabeler(this._labeler,se),this._visibleGeometryChanged(se,Pt.ADD),this._highlights.objectCreated(se),this._updateMaterial(se),this._setNewNodeOpacity(se),null!=this._treeDebugger&&this._treeDebugger.update()}),i)))).catch((e=>{const{meta:t,allowMemCache:i}=s;throw s.meta=null,t&&i?this._cacheGPUData(t):t&&this._deleteComponentObject(t),e}))}_addNodeMeta(e,t){if(this._removeNodeStageData(e,this.elevationOffset,this._nodeId2MetaReloading),this._nodeId2Meta.has(e)){Rt().error("Removing duplicated node");const t=this._nodeId2Meta.get(e);null!=t&&this._deleteComponentObject(t)}else this._controller.updateLoadStatus(e,!0);null!=t&&(t.lodCrossfadeProgress=null,this.nodeCrossfadingEnabled&&Yt(t.cachedEdgeMaterials,0)),this._nodeId2Meta.set(e,t),this.notifyChange("elevationRange")}_updateElevationOffsets(e){const t=this.view.renderSpatialReference,i=this._controller.crsIndex,s=this.elevationInfo,r=this.view.basemapTerrain,o=r.spatialReference,a=s.mode;if(null==t||null==o||a===ye.Absolute)return void(e.elevationOffsets=null);const n=this._collection.getObjectTransform(e.objectHandle);e.elevationOffsets=e.elevationOffsets??[];const l=Zt,d=ei,h=a===ye.OnTheGround,c=this.view.renderCoordsHelper,u=e.featureIds.length,_=(()=>{if(e.cachedElevationAnchors)return e.cachedElevationAnchors;const s=X(3*u);e.cachedElevationAnchors=s;for(let r=0;r<u;r++){const a=3*r,h=e.anchorIds?.indexOf(r)??-1;e.anchors&&h>=0?(j(l,e.anchors[3*h],e.anchors[3*h+1],e.anchors[3*h+2]),A(l,l,Z(e.node.serviceMbsInIndexSR)),q(l,i,l,o),s[a]=l[0],s[a+1]=l[1],s[a+2]=c.getAltitude(l)):(this._collection.getComponentAabb(e.objectHandle,r,d,!0),j(l,(d[0]+d[3])/2,(d[1]+d[4])/2,d[2]),R(l,l,n.rotationScale),A(l,l,n.position),s[a+2]=c.getAltitude(l),q(l,t,l,o),s[a]=l[0],s[a+1]=l[1])}return s})(),m=s.offset,g=e.elevationOffsets,p=(e,t)=>{const i=h?_[3*e+2]:0;g[e]=m+(t??0)-i};r.getElevations(_,u,p)}_ensureElevationTask(){return null!=this._elevationTask||(this._elevationTask=new Ae(this.view.resourceController.scheduler,(e=>this._controller.updateElevationChanged(e,this.view.basemapTerrain.spatialReference)?.filterInPlace((e=>null!=this._nodeId2Meta.get(e)))),(e=>this._nodeElevationAlignmentChanged(this._nodeId2Meta.get(e))),(()=>this.elevationInfo?.mode))),this._elevationTask}_elevationInfoChanged(e,t){const i=e.mode!==ye.Absolute,s=!!t&&t!==e&&t.mode!==ye.Absolute;this._intersectionHandler.updateElevationAlignState(i,this.view.state.viewingMode),i&&!s&&this._controller.removeAllGeometryObbs(),this._nodeId2Meta.forEach((e=>this._nodeElevationAlignmentChanged(e)))}_nodeElevationAlignmentChanged(e){null!=e&&(this._updateElevationOffsets(e),this._updateComponentData(e),this._updateEdgeRendering(e),null!=this._labeler&&this._labeler.updateLabelPositions(e),this._updateSnappingSources(e,Pt.UPDATE),this._elevationProvider.objectChanged(this._collection.getComponentObb(e.objectHandle)))}_safeReschedule(e,t){return c(t),this._controller.reschedule(e,t)}_materialParameters(e,t){const i=null!=e.params.material?e.params.material:He(),s=t.some((e=>"uvRegion"===e.name)),r=t.some((e=>"normalCompressed"===e.name)),o=qt(i);return{geometryParameters:this._getGeometryParameters({hasTexture:o,hasNormals:r,hasRegions:s}),material:i}}_initMaterialAndTextures(e,t,i,s){const r=this._stage.renderView,o=i.map((e=>Ue(e,t,s,r)));this._stage.addMany(o);let a=null;return this._collection.updateMaterial(e,(e=>{a=Ge(e,t,o,i,this.view._stage.renderView.textures,{rendererTextureUsage:this.rendererTextureUsage,usePBR:this._usePBR,isIntegratedMesh:this._isIntegratedMesh,slicePlaneEnabled:this.slicePlaneEnabled,viewSpatialReference:this.view.spatialReference}),this._updateMaterialOverlay(e)})),{textures:o,texturePromise:a}}_getGeometryParameters(e){return new It(this._hasVertexColors,e.hasTexture?e.hasRegions?Ct.Atlas:Ct.Default:Ct.None,e.hasNormals,this._shadeNormals,this._applySSAO)}_addData(e,t,i){let s=this._addTasks.get(e.index);if(s)s.attributeInfo=t;else{const r=u();s=new Xt(t,null,r.promise),this._addTasks.set(e.index,s),i().then(r.resolve,r.reject).then((()=>this._addTasks.delete(e.index))).catch((t=>{throw this._addTasks.delete(e.index),t}))}return s.promise}_clearAddTasks(){this._addTasks.forEach((e=>{null!=e.meta&&(this._cacheGPUData(e.meta),e.meta=null)})),this._addTasks.clear()}_clippingAreaChanged(){const e=this.view.renderSpatialReference,t=this.i3slayer.spatialReference,i=$();this._renderClippingArea=gt(this.view.clippingArea,i,e)?i:null;const s=$();this._layerClippingArea=gt(this.view.clippingArea,s,t)?s:null,this._filterChange(),this._controller&&this._controller.updateClippingArea(this.view.clippingArea),this._isIntegratedMesh&&this._modificationsChanged()}get hasGeometryFilter(){return!1}_geometryFilterChange(){const e=this.hasGeometryFilter;this._controller.geometryFilterChanged(e),this._applyFilters(e)}_filterChange(){this._applyFilters(this.hasGeometryFilter)}_applyFilters(e){this._filters=this.getFilters(),e?this._controller&&this._controller.requestUpdate():this._nodeId2Meta.forEach((e=>{null!=e&&this._applyFiltersToNode(e)&&(this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,Pt.UPDATE))}))}getFilters(){const e=[],t=this._renderClippingArea;return null!=t&&e.push(((e,i)=>this._boundingRectFilter(e,i,t))),e}addSqlFilter(e,t,i){if(null!=t){const s=t.fieldNames;e.push(((e,r)=>this._sqlFilter(e,r,t,s,i)))}}_sqlFilter(e,t,i,s,r){const o={},a=this._createLayerGraphic(o),n=this.i3slayer.objectIdField,l=t.featureIds,d=t.attributeInfo?.attributeData;s.every((e=>e===n||null!=d?.[e]))&&Xe(e,l,(e=>{o[n]=l[e];for(const i of s)i!==n&&(o[i]=d?Ye(d[i],e):null);try{return i.testFeature(a)}catch(t){return r(t),!1}}))}_boundingRectNodeTest(e,t){return L(e.node.serviceMbsInIndexSR,this._controller.crsIndex,Bt,this.view.renderSpatialReference),Je(t,Bt)}_boundingRectFeatureTest(e,t,i){return this._collection.getComponentAabb(e.objectHandle,t,Ht),z(Ht,Ut),Q(i,Ut)}_boundingRectFilter(e,t,i){const s=this._collection,r=this._boundingRectNodeTest(t,i);if(r===Ze.INSIDE)return;if(r===Ze.OUTSIDE)return void(e.length=0);const o=s.getComponentCount(t.objectHandle);if(o.invisible+o.visible!==t.featureIds.length)return;const a=this._transformClippingArea(Gt,i,t.objectHandle);Xe(e,t.featureIds,(e=>this._boundingRectFeatureTest(t,e,a)))}_transformClippingArea(e,t,i){const s=this._collection.getObjectTransform(i),r=s.position,o=s.rotationScale;return e[0]=(t[0]-r[0])/o[0],e[1]=(t[1]-r[1])/o[4],e[2]=(t[2]-r[0])/o[0],e[3]=(t[3]-r[1])/o[4],e}async _addOrUpdateEdgeRendering(e,t=!0){const i=e.objectHandle,{hasEdges:s,perFeatureEdgeMaterials:r}=this._getFilteredEdgeMaterials(e);s&&!this._edgeView&&(this._edgeView=await this._stage.renderer.loadEdgeView());const o=this._edgeView;if(!o)return null;const a=o.hasObject(i);if(s){if(a){if(this.nodeCrossfadingEnabled){Yt(r,this.getNodeOpacity(e))}return o.updateAllComponentMaterials(i,r,this.slicePlaneEnabled,t).catch((e=>Vt(e,this.i3slayer.title))),o.updateObjectVisibility(i,!0).catch((e=>Vt(e,this.i3slayer.title))),o.updateAllVerticalOffsets(i,e.elevationOffsets).catch((e=>Vt(e,this.i3slayer.title))),o}const s=await this._collection.addEdges(i,o,r,this.slicePlaneEnabled,e.elevationOffsets);return e.edgeMemoryUsage=s,e.node.memory+=s,o}return a&&(e.node.memory-=e.edgeMemoryUsage,e.edgeMemoryUsage=0,o.removeObject(i)),null}_applyFiltersToNode(e){return!!this._applyFiltersToNodeComponents(e)&&(null!=this._labeler&&this._labeler.applyFilterChange(e),!0)}_applyFiltersToNodeComponents(e){const t=this._collection,i=t.getComponentCount(e.objectHandle),s=null!=e.filteredIds,r=0===i.invisible;if(t.setAllComponentVisibilities(e.objectHandle,"all"),0===this._filters.length)return e.filteredIds=null,!r;if(this._updateCachedFilteredIds(e),s&&e.filteredIds===e.featureIds)return!r;const o=this._computeFilteredComponentIndices(e);return t.setAllComponentVisibilities(e.objectHandle,o),!0}_updateCachedFilteredIds(e){null!=e.filteredIds&&e.appliedFilters===this._filters||(e.filteredIds=this._computeFilteredIds(e),e.appliedFilters=this._filters)}_computeFilteredIds(e){const t=e.featureIds.slice();for(const i of this._filters)if(i(t,e),0===t.length)break;return t.length===e.featureIds.length?e.featureIds:t}_computeFilteredComponentIndices(e){const t=new Array,i=e.filteredIds;return null!=i&&e.featureIds.forEach(((e,s)=>{i[t.length]===e&&t.push(s)})),t}_removeAllNodeDataFromStage(e=this.elevationOffset){this._nodeId2Meta.forEach(((t,i)=>this._removeNodeStageData(i,e))),this._nodeId2MetaReloading.forEach(((t,i)=>this._removeNodeStageData(i,e,this._nodeId2MetaReloading))),this._elevationTask=n(this._elevationTask)}removeNode(e){const t=this.elevationOffset;this._removeNodeStageData(e,t),this._removeNodeStageData(e,t,this._nodeId2MetaReloading),null!=this._elevationTask&&this._elevationTask.remove(e)}_removeNodeStageData(e,t,i=this._nodeId2Meta){i.has(e)&&this._controller.updateLoadStatus(e,!1);const s=i.get(e);null!=s?(this._collection.setObjectVisibility(s.objectHandle,!1),null!=this._edgeView&&this._edgeView.hasObject(s.objectHandle)&&this._edgeView.updateObjectVisibility(s.objectHandle,!1).catch((e=>Vt(e,this.i3slayer.title))),this._visibleGeometryChanged(s,Pt.REMOVE),null!=this._labeler&&this._labeler.removeNodeMeta(s),i.delete(e),this._highlights.objectDeleted(s),i===this._nodeId2Meta?(this._cacheGPUData(s,t),this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopNodeFading(s)):this._deleteComponentObject(s),null!=this._treeDebugger&&this._treeDebugger.update()):i.delete(e)}_deleteComponentObject(e){if(null!=this._edgeView&&this._edgeView.removeObject(e.objectHandle),this._memEstimateGeometryRemoved(e.objectHandle),this._collection.destroyObject(e.objectHandle),e.textures)for(const t of e.textures)this._memEstimateTextureRemoved(t),this._stage.remove(t)}updateNodeState(e,t){const i=this._nodeId2Meta.get(e);null!=i&&this._collection.updateMaterial(i.objectHandle,(e=>e.polygonOffsetEnabled=t===ke.Hole))}updateNodeIndex(e,t){if(this._nodeId2Meta.has(e)){const i=this._nodeId2Meta.get(e);this._nodeId2Meta.delete(e),this._nodeId2Meta.set(t,i),this.notifyChange("elevationRange")}const i=this._nodeId2MetaReloading.get(e);i&&(this._nodeId2MetaReloading.delete(e),this._nodeId2MetaReloading.set(t,i))}_invalidateAllSymbols(){this._rendererVersion=et(this._rendererVersion,1),this._controller&&this._controller.requestUpdate()}_getInvalidRendererVersion(){return et(this._rendererVersion,-1)}async _rendererChange(e){if(this._currentRenderer=e,this.notifyChange("rendererTextureUsage"),this._rendererVersion=et(this._rendererVersion,1),this._rendererFields=null,this._colorVariable=null,this._opacityVariable=null,this._invalidateAllSymbols(),e&&(this._rendererFields=await e.getRequiredFields(this.i3slayer.fieldsIndex)),this._updateSymbologyFields(),!this._arcade&&e&&"arcadeRequired"in e&&e.arcadeRequired&&(this._arcade=await de()),e&&"visualVariables"in e&&e.visualVariables)for(const t of e.visualVariables)"color"===t.type?this._colorVariable=t:"opacity"===t.type?this._opacityVariable=t:Rt().warn(`Unsupported visual variable type for 3D Object Scene Services: ${t.type}`);if(e)for(const t of e.symbols)"mesh-3d"!==t.type&&Rt().error(`Symbols of type '${t.type}' are not supported for 3D Object Scene Services.`);this._controller&&this._controller.requestUpdate()}_getCachedEdgeMaterials(e){return this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e),e.cachedEdgeMaterials}_getComponentParameters(e){this._hasComponentData&&e.cachedRendererVersion!==this._rendererVersion&&this._updateCachedRendererData(e);const t=e.cachedSymbology;return(i,s)=>{const r=5*i;V(s.externalColor,t[r]/255,t[r+1]/255,t[r+2]/255,t[r+3]/255);const o=this._stage.renderView.olidRenderHelper;if(o){const t=e.featureIds[i],r=he(this.view.map,this.layerUid);o.setUidToObjectAndLayerId(t,t,this.layerId,this.layerUid+"_"+this.sublayerId,this.layerPopupEnabledAndHasTemplate&&!r,e.node.resources.attributes,i,this.sublayerId),s.objectAndLayerIdColor=this._stage.renderView.getObjectAndLayerIdColor({graphicUid:t,layerUid:this.layerUid+"_"+this.sublayerId})}s.externalColorMixMode=t[r+4]&(1<<Dt.CastShadows)-1,s.castShadows=!!(t[r+4]&1<<Dt.CastShadows),s.pickable=!!(t[r+4]&1<<Dt.Pickable),s.elevationOffset=e.elevationOffsets?.[i]??0}}_getSymbolInfo(e,t){const i=e?.getSymbol(t,{arcade:this._arcade});if(!(i instanceof _e))return null;const s=i.id;if(this._symbolInfos.has(s))return this._symbolInfos.get(s);const r=tt(i);return this._symbolInfos.set(s,r),r}_setSymbologyOverride(e,t){this._symbologyOverride!==e&&(this._symbologyOverride=e,this._symbologyOverrideFields=t,this._invalidateAllSymbols(),this._updateSymbologyFields())}_updateSymbologyFields(){this._symbologyFields=null!=this._symbologyOverrideFields&&this._symbologyOverrideFields.length>0?null!=this._rendererFields&&this._rendererFields.length>0?oe(this.i3slayer.fieldsIndex,[...this._rendererFields,...this._symbologyOverrideFields]):this._symbologyOverrideFields:this._rendererFields}_updateCachedRendererData(e){if(e.cachedRendererVersion=this._rendererVersion,!this._hasComponentData)return;const t=this._tmpAttributeOnlyGraphic,i={};t.attributes=i;const s=this._currentRenderer,r=e.attributeInfo?.attributeData,o=e.featureIds?this.i3slayer.objectIdField:null,a=null!=r&&null!=this._symbologyFields&&this._symbologyFields.length>0;let n=null,l=null;if(a&&null!=this._symbologyFields){n=[],l=[];for(const e of this._symbologyFields){const t=r[e];t&&(n.push(e),l.push(t))}}e.cachedSymbology||(e.cachedSymbology=ie(5*e.featureIds.length));const d=new nt,h=this.fullOpacity,c=this.nodeCrossfadingEnabled?this.getNodeOpacity(e):h;let u=null,_=Ot.OPAQUE,m=it,g=0;for(let p=0;p<e.featureIds.length;p++){if(null!=o&&(i[o]=e.featureIds[p]),a&&n)for(let e=0;e<n.length;e++)i[n[e]]=Ye(l[e],p);const r=s?this._getSymbolInfo(s,t):null;let h,f;if(d.pickable=!0,s&&"visualVariables"in s){if(this._colorVariable){const e=ne(this._colorVariable,t,{color:kt,arcade:this._arcade});e&&(h=d.color,h[0]=e.r/255,h[1]=e.g/255,h[2]=e.b/255,h[3]=e.a??1,this._opacityVariable||null===e.a||(f=e.a))}this._opacityVariable&&(f=le(this._opacityVariable,t,{arcade:this._arcade}))}if(r?.material){const e=r.material;h=null==h||null==f?Ee(h,f,e.color,e.alpha,St,d.color):Ee(h,f,null,null,St,d.color)}if(h??=V(d.color,1,1,1,1),d.colorMixMode=r?.material?.colorMixMode??ut.Multiply,d.edgeMaterial=r?.edgeMaterial,this._symbologyOverride?.(t,d),null!=this._nodeColorOverride&&(this._nodeColorOverride(e.node,h),d.colorMixMode=ut.Replace),d.pickable&&=h[3]>=jt,d.castShadows=r?r.castShadows:d.pickable,null!=d.edgeMaterial){const t=h[3]>=1&&(e.material.isOpaque||d.colorMixMode===ut.Replace)?Ot.OPAQUE:Ot.TRANSPARENT;d.edgeMaterial===u&&t===_||(m={...d.edgeMaterial,opacity:c,objectTransparency:t},u=d.edgeMaterial,_=t),e.cachedEdgeMaterials[p]=m}else e.cachedEdgeMaterials[p]=it;e.cachedSymbology[g++]=Math.round(255*h[0]),e.cachedSymbology[g++]=Math.round(255*h[1]),e.cachedSymbology[g++]=Math.round(255*h[2]),e.cachedSymbology[g++]=Math.round(255*h[3]),e.cachedSymbology[g++]=d.colorMixMode|+d.castShadows<<Dt.CastShadows|+d.pickable<<Dt.Pickable}}_getFilteredEdgeMaterials(e){const t=this._getCachedEdgeMaterials(e);this.nodeCrossfadingEnabled||Yt(t,this.fullOpacity);const i=e.filteredIds;if(null==i){return{hasEdges:t.some((e=>e!==it)),perFeatureEdgeMaterials:t}}let s=0,r=!1;const o=t.map(((t,o)=>e.featureIds[o]!==i[s]?it:(r=r||t!==it,s++,t)));return{hasEdges:r,perFeatureEdgeMaterials:o}}_updateComponentData(e){if(!this._hasComponentData)return;const t=e.objectHandle,i=this._getComponentParameters(e);this._collection.setComponentData(t,i),this._stage.renderView.requestRender()}_reloadAll(e=this.elevationOffset){this._removeAllNodeDataFromStage(e),null!=this._controller&&this._controller.restartNodeLoading()}_opacityChange(e){this.nodeCrossfadingEnabled&&this._crossfadeHelper.stopAllNodeFading(),this._nodeId2Meta.forEach((t=>{null!=t&&(this._collection.updateMaterial(t.objectHandle,(t=>t.objectOpacity=e)),Yt(t.cachedEdgeMaterials,e),this._updateEdgeRendering(t))}))}_updateMaterial(e){this._collection.updateMaterial(e.objectHandle,(e=>{e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.usePBR=this._usePBR,this._updateMaterialOverlay(e)}))}_updateMaterialOverlay(e){}_updateEngineObject(e){this._updateComponentData(e),this._applyFiltersToNode(e),this._addOrUpdateEdgeRendering(e),this._visibleGeometryChanged(e,Pt.UPDATE)}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),null!=this._labeler&&(this._labeler.slicePlaneEnabled=e),this._nodeId2Meta.forEach((t=>{null!=t&&(this._collection.updateMaterial(t.objectHandle,(t=>t.commonMaterialParameters.hasSlicePlane=e)),this._updateEdgeRendering(t,!1))}))}_updatePBR(e){this._nodeId2Meta.forEach((t=>{null!=t&&this._collection.updateMaterial(t.objectHandle,(t=>t.usePBR=e))})),this._hasLoadedPBRTextures=!0}get _usePBR(){return this._shadeNormals&&this.view.qualitySettings.physicallyBasedRenderingEnabled}_updateEdgeRendering(e,t=!0){null!=this._edgeView&&this._edgeView.hasObject(e.objectHandle)&&this._addOrUpdateEdgeRendering(e,t)}_forAllNodes(e){this._nodeId2Meta.forEach(e)}_ignoreClientNodeOverriddenFeatures(e){return this.i3sOverrides.hasGeometryChanges?(t,i,s)=>s.node.index>=0&&this.i3sOverrides.featureHasGeometryChanges(t)?ve.CONTINUE:e(t,i,s):e}_forAllFeatures(e,t,i){for(const s of this._nodeId2Meta.values()){if(null==s)continue;if(null!=t){switch(t(s)){case ve.EXIT:return;case ve.SKIP:continue}}let r=ve.CONTINUE;switch(i){case Ie.ALL:r=this._forAllFeaturesOfNode(s,e);break;case Ie.VISIBLE_ONLY:r=this._forAllVisibleFeaturesOfNode(s,e);break;case Ie.QUERYABLE:r=this._forAllQueryableFeaturesOfNode(s,e)}if(r===ve.EXIT)return}}_forAllFeaturesOfNode(e,t){let i=ve.CONTINUE;const s=e.featureIds;for(let r=0;r<s.length;r++)if(i=t(s[r],r,e),i===ve.EXIT)return i;return i}_forAllVisibleFeaturesOfNode(e,t){let i=ve.CONTINUE;const s=e.featureIds;return this._collection.forEachVisibleComponent(e.objectHandle,(r=>(i=t(s[r],r,e),i===ve.CONTINUE))),i}_forAllQueryableFeaturesOfNode(e,t){const i=this._ignoreClientNodeOverriddenFeatures(t);if(null==this._renderClippingArea)return this._forAllFeaturesOfNode(e,i);const s=this._boundingRectNodeTest(e,this._renderClippingArea);if(s===Ze.OUTSIDE)return ve.CONTINUE;if(s===Ze.INSIDE)return this._forAllFeaturesOfNode(e,i);const r=ve.CONTINUE,o=e.featureIds,a=e.objectHandle,n=st(this._renderClippingArea,this._collection.getObjectTransform(a));for(let l=0;l<o.length;l++){if(!this._boundingRectFeatureTest(e,l,n))continue;const t=i(o[l],l,e);if(t===ve.EXIT)return t}return r}_createAttributes(e,t){const i={};null!=t.featureIds&&(i[this._getObjectIdField()]=t.featureIds[e]);const s=t.attributeInfo?.attributeData;if(null!=s)for(const r of Object.keys(s))i[r]=Ye(s[r],e);return i}_createGraphic(e,t){return this._createLayerGraphic(this._createAttributes(e,t))}highlight(e,t){if(ue(e))return dt;const s=ht(e);if(0===s.length)return dt;const r=t?.name??Et,o=s[0]instanceof i?this._featureIdsFromGraphics(s):"number"==typeof s[0]?s:null;if(!o)return dt;const{set:a,handle:n}=this._highlights.acquireSet(r);return this._highlights.setFeatureIds(a,o),n}_featureIdsFromGraphics(e){const t=this.i3slayer.fieldsIndex,i=this._getObjectIdField();return e.map((e=>lt(t,e.attributes,i)))}resetHighlights(){n(this._highlights),this._highlights=new Se({collection:this._collection,forAllFeatures:e=>this._forAllFeatures(e,null,Ie.ALL),forAllFeaturesOfNode:(e,t)=>this._forAllFeaturesOfNode(e,t)})}_visibleGeometryChanged(e,t){this._elevationProvider&&(null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=g((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null}))),this._updateSnappingSources(e,t),this._elevationProvider.objectChanged(this._collection.getComponentObb(e.objectHandle)))}get performanceInfo(){return new pe(this.usedMemory,this._nodeId2Meta.size,Math.round(this._gpuMemoryEstimate/1048576),Math.round(this._geoMemoryEstimate/1048576),Math.round(this._texMemoryEstimate/1048576),Math.round(this.unloadedMemory/1048576),this._idbCacheEnabled?Math.round(100*this._idbCache.getHitRate()):0)}get test(){}getNodeOpacityByIndex(e){const t=this._nodeId2Meta.get(e);return this.getNodeOpacity(t)}getNodeOpacity(e){return null!=e?this._collection.getMaterial(e.objectHandle).objectOpacity:0}isNodeFullyFadedIn(e){return this._crossfadeHelper.isNodeFullyFadedIn(e)}getNodeCrossfadeMetaData(e){return this._nodeId2Meta.get(e)}markNodeToRemove(e){this._controller&&this._controller.markNodeToRemove(e)}removeMarkedNodes(){this._controller&&this._controller.removeMarkedNodes()}foreachCrossfadeNode(e){this._nodeId2Meta.forEach(e)}fadeNode(e,t,i){if(!this.nodeCrossfadingEnabled)return;const s=this._nodeId2Meta.get(e);null!=s&&this._crossfadeHelper.fadeNode(e,s,t,i)}setNodeOpacityByIndex(e,t){const i=this._nodeId2Meta.get(e);null!=i&&this._setNodeOpacity(i,t)}_setNodeOpacity(e,t){this._collection.updateMaterial(e.objectHandle,(e=>e.objectOpacity=t)),this._setNodeEdgeOpacity(e,t)}_setNodeEdgeOpacity(e,t){if(null==this._edgeView||!e.cachedEdgeMaterials)return;Yt(e.cachedEdgeMaterials,t);const i=e.objectHandle;this._edgeView.hasObject(i)&&this._edgeView.updateAllComponentOpacities(i,t).catch((e=>Vt(e,this.i3slayer.title)))}get hasModifications(){return this._isIntegratedMesh&&null!=this._layerClippingArea||this._modifications&&this._modifications.length>0}updateNodeModificationStatus(e){const t=e.length;if(!this.hasModifications||t<=0||!0!==this._i3sWasmLoaded)return;const i=this.uid,s=Qt(e);if(s){const t={context:i,buffer:s.buffer};xe(t);const r=new Float64Array(s.buffer);e.forAll(((e,t)=>{const i=r[t],s=Oe(i);e.imModificationImpact=s,s!==Le.Unmodified&&this._controller.invalidateGeometryVisibility(e.index)}))}}notifyUpdate(){this.notifyChange("updating")}notifyLODUpdate(){this._controller.notifyLODUpdate()}isUpdating(){return!(!this._controller||!this._controller.updating)||!!this._visibleGeometryChangedSchedulerHandle||null!=this._labeler&&this._labeler.updating||this._crossfadeHelper?.updating||this._i3sWasmLoaded instanceof Promise||this._asyncModuleLoading>0||null!=this._elevationTask&&this._elevationTask.running}trackSnappingSources(e){const t={events:e,fetchEdgeLocations:async(e,t,i)=>{const s=this._nodeId2Meta.get(e);if(null==s)throw new Error("invalid-node");const{origin:r,buffer:o}=await this._collection.extractEdgeInformation(s.objectHandle,t,i);return this._snappingLocationsApplyElevation(s,o,r),{type:"components",objectIds:s.featureIds,locations:o,origin:r}},remove:()=>r(this._snappingSourcesTrackers,t)};return this._snappingSourcesTrackers.push(t),this._nodeId2Meta.forEach(((t,i)=>{if(null==t)return;const s=this._controller.getRenderMbs(t.node);s&&e.add(i,s)})),t}_snappingLocationsApplyElevation(e,t,i){if(!e.elevationOffsets||this.elevationInfo.mode===ye.Absolute)return;const s=t.position0,r=t.position1,o=t.componentIndex,a=F(),n=F(),l=(e,t)=>{A(e,e,i),this.view.renderCoordsHelper.worldUpAtPosition(e,n),A(e,e,D(n,n,t)),T(e,e,i)};for(let d=0;d<s.count;d++){const t=e.elevationOffsets[o.get(d)];s.getVec(d,a),l(a,t),s.setVec(d,a),r.getVec(d,a),l(a,t),r.setVec(d,a)}}_updateSnappingSources(e,t){const{index:i}=e.node,s=this._controller.getRenderMbs(e.node);if(null!=s)for(const r of this._snappingSourcesTrackers)t!==Pt.REMOVE&&t!==Pt.UPDATE||r.events.remove(i),t!==Pt.ADD&&t!==Pt.UPDATE||r.events.add(i,s)}};return e([f()],o.prototype,"_hasLoadedPBRTextures",void 0),e([f()],o.prototype,"_asyncModuleLoading",void 0),e([f()],o.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([f()],o.prototype,"view",void 0),e([f()],o.prototype,"i3slayer",void 0),e([f()],o.prototype,"_controller",void 0),e([f()],o.prototype,"_labeler",void 0),e([f()],o.prototype,"updating",void 0),e([f()],o.prototype,"suspended",void 0),e([f()],o.prototype,"contentVisible",null),e([f({readOnly:!0})],o.prototype,"legendEnabled",null),e([f()],o.prototype,"holeFilling",void 0),e([f(ft)],o.prototype,"updatingProgress",void 0),e([f()],o.prototype,"updatingProgressValue",null),e([f()],o.prototype,"hasTexturesOrVertexColors",null),e([f()],o.prototype,"rendererTextureUsage",null),e([f()],o.prototype,"elevationOffset",null),e([f()],o.prototype,"elevationInfo",null),e([f({type:Boolean})],o.prototype,"slicePlaneEnabled",void 0),e([f()],o.prototype,"supportedTextureEncodings",null),e([f({type:[ae]})],o.prototype,"_modifications",void 0),e([f({readOnly:!0})],o.prototype,"clientGeometry",null),e([f()],o.prototype,"elevationRange",null),e([f()],o.prototype,"fullExtent",null),e([f()],o.prototype,"_elevationTask",void 0),e([f({readOnly:!0})],o.prototype,"_usePBR",null),o=e([b(wt)],o),o};function Vt(e,t){h(e)||Rt().warn("Error while processing edges. Edges on this layer might not display correctly",t,e)}var Pt;!function(e){e[e.ADD=0]="ADD",e[e.REMOVE=1]="REMOVE",e[e.UPDATE=2]="UPDATE"}(Pt||(Pt={}));const Ht=K(),Ut=$(),Gt=$(),Lt=new pt,kt=new t([0,0,0,0]),Bt=ee(0,0,0,0);function qt(e){if(null==e)return!1;const t=e.metallicRoughness;return t&&t.baseColorTextureId>=0||t&&t.metallicRoughnessTextureId>=0||e.normalTextureId>=0||e.emissiveTextureId>=0||e.occlusionTextureId>=0}function Kt(e){return"geometryData"in e}function Wt(e){return null!=e&&p(e.data)}function zt(e,t){let i=1024+e.interleavedVertexData.byteLength+(e.indices?e.indices.byteLength:0)+e.positionData.data.byteLength+e.positionData.indices.byteLength;if(null!=t)for(const s of t)null!=s&&p(s.data)&&(i+=s.data.byteLength);return i}function $t(e,t){return t.byteSize>Nt?(Rt().warn(`Node is too big to store in IndexedDB cache: ${e.id} (${t.byteSize} bytes)`),!1):t.byteSize>0}function Qt(e){if(0===e.length)return;const t=10*e.length,i=new Float64Array(t);let s=0;return e.forAll((e=>{let t=e.serviceObbInIndexSR;null==t&&(t=Lt,t.center=Z(e.serviceMbsInIndexSR),t.halfSize=[e.serviceMbsInIndexSR[3],e.serviceMbsInIndexSR[3],e.serviceMbsInIndexSR[3]]);const r=t.data;i[s++]=r[0],i[s++]=r[1],i[s++]=r[2],i[s++]=r[3],i[s++]=r[4],i[s++]=r[5],i[s++]=r[6],i[s++]=r[7],i[s++]=r[8],i[s++]=r[9]})),i}class Xt{constructor(e,t,i){this.attributeInfo=e,this.meta=t,this.promise=i,this.allowMemCache=!0}}function Yt(e,t){e.forEach((e=>e.opacity=t))}class Jt{constructor(e,t){this.mode=e,this.offset=t}}const Zt=F(),ei=K(),ti="elevation-change",ii="",si="@null",ri="@ECEF",oi=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],ai=new mt;function ni(e,t,i){let s=e.elevationRangeMin,r=e.elevationRangeMax;const o=i;if(o>0){t.getCorners(oi);for(const e of oi){const t=N(e)-o;s=Math.min(s,t),r=Math.max(r,t)}}else{t.getCorners(oi);for(const e of oi){const t=e[2];s=Math.min(s,t),r=Math.max(r,t)}}e.expandElevationRangeValues(s,r)}function li(e,t,i){const s=Z(t),r=i>0?N(s)-i:s[2],o=te(t);e.expandElevationRangeValues(r-o,r+o)}export{Ft as I3SMeshView3D};
|
|
@@ -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/Evented.js";import{throwIfAborted as r}from"../../../../../core/promiseUtils.js";import{watch as a,initial as i}from"../../../../../core/reactiveUtils.js";import{property as n}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Evented.js";import{throwIfAborted as r}from"../../../../../core/promiseUtils.js";import{watch as a,initial as i}from"../../../../../core/reactiveUtils.js";import{property as n}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import o from"../../../../../geometry/Extent.js";import{initializeProjection as u,project as m}from"../../../../../geometry/projection.js";import d from"../../../../../geometry/SpatialReference.js";import{QueryEngine as c}from"../../../../../layers/graphics/data/QueryEngine.js";import l from"../../../../../rest/support/Query.js";import{Tile3DManager as p}from"./Tile3DManager.js";import{TiledFeatureStore as y}from"./featureSet/TiledFeatureStore.js";import{Tile3DFetcher as h}from"./fetching/Tile3DFetcher.js";import{RenderCommandContext as f}from"./rendering/RenderCommandContext.js";import{UniqueValueFeatureRenderer as _}from"./symbolization/UniqueValueFeatureRenderer.js";import{RenderCoordsHelper as g}from"../../../support/RenderCoordsHelper.js";let C=class extends t.EventedAccessor{constructor(){super(...arguments),this.remoteClient=null,this._featureStore=new y,this._tileManager=null,this._renderer=null,this._fetcher=null,this._queryEngine=null,this._defaultQueryJSON=null}get updating(){return this._tileManager.updating}destroy(){this._featureStore.clear(),this._tileManager?.destroy()}async setup({viewSpatialReference:e,renderSpatialReference:t,viewingMode:r,baseQuery:n,url:s,objectIdField:y,capabilities:C,fieldsIndex:S,timeInfo:F,fullExtent:j}){const Q=d.fromJSON(e),x=d.fromJSON(t);this._fetcher=new h(Q,l.fromJSON(n),s,y,C),this._queryEngine=new c({hasZ:!0,hasM:!1,geometryType:"esriGeometryPoint",objectIdField:y,fieldsIndex:S,availableFields:[y],spatialReference:e,featureStore:this._featureStore,timeInfo:F}),this._renderer=new _({viewSpatialReference:Q,renderSpatialReference:x,renderCoordsHelper:g.create(r,x),renderCommandContext:new f(r,(async(e,t)=>{const r={materialId:e,type:t};await this.remoteClient.invoke("createMaterial",r)}),(async e=>{const t={materialId:e};await this.remoteClient.invoke("createDirectRenderer",t)}),(async(e,t,r)=>{const a={rendererId:e,lodRenderGeometry:t};await this.remoteClient.invoke("createLoDRenderer",a,{transferList:r})}),(async(e,t)=>{const r={commands:e};await this.remoteClient.invoke("dispatchRenderCommands",r,{transferList:t})}))}),this._defaultQueryJSON=new l({outSpatialReference:Q}).toJSON();let v=null;if(null!=j){const e=o.fromJSON(j);await u(e.spatialReference,Q),v=m(e,Q)}return this._tileManager=new p({loadTile:(e,t)=>this._fetcher.fetch(e,t),createAddFeatureDataCommand:(e,t)=>this._createAddFeatureDataCommand(e,t),createRemoveFeatureDataCommand:e=>this._createRemoveFeatureDataCommand(e),createUpdateFeatureDataVisibilityCommand:(e,t)=>this._createUpdateFeatureDataVisibilityCommand(e,t),extent:v}),this.addHandles(a((()=>this.updating),(e=>{this.emit("notify-updating",{updating:e})})),i),await this._renderer.load(),w}async executeQuery(e,t){return{result:await this._queryEngine.executeQuery(this._ensureQuery(e),t)}}async executeQueryForIds(e,t){const r=await this._queryEngine.executeQueryForIdSet(this._ensureQuery(e),t);return{result:Array.from(r)}}async executeQueryForCount(e,t){return{result:await this._queryEngine.executeQueryForCount(this._ensureQuery(e),t)}}async executeQueryForExtent(e,t){return{result:await this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t)}}async executeQueryForLatestObservations(e,t){return{result:await this._queryEngine.executeQueryForLatestObservations(this._ensureQuery(e),t)}}async onTileTreeChange(e){return await this._tileManager.onTileTreeChange(e),w}async _createAddFeatureDataCommand(e,t){const a=this._featureStore,i=await this._renderer.createAddCommand(e);return r(t),i.appendPipelineStateCommand((()=>{a.addTile(e)})),i}async _createRemoveFeatureDataCommand(e){const t=this._featureStore,r=this._renderer,a=await r.createRemoveCommand(e);return a.appendPipelineStateCommand((()=>{t.removeTile(e)})),a}async _createUpdateFeatureDataVisibilityCommand(e,t){const a=this._renderer,i=await a.createUpdateVisibilityCommand(e);return r(t),i}_ensureQuery(e){return e??this._defaultQueryJSON}};e([n()],C.prototype,"updating",null),C=e([s("esri.views.3d.layers.graphics.pipeline.Feature3DPipelineWorker")],C);const S=C,w={result:void 0};export{S 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{baseArrayMemory as e,
|
|
5
|
+
import{baseArrayMemory as e,baseObjectMemory as t,estimateNumberMemory as s}from"../../../../../core/memoryEstimations.js";class n{constructor(n,a,r){this.descriptor=n,this._pages=a,this._pageSize=r;const i=e+a.reduce(((e,{usedMemory:t})=>e+t),0),d=3*s;this.usedMemory=t+i+d,this.featureCount=a.reduce(((e,t)=>e+t.featureCount),0)}get id(){return this.descriptor.id}getObjectId(e){const{pageIndex:t,featurePageIndex:s}=this._translateIndex(e);return this._pages[t].getObjectId(s)}getAttribute(e,t){const{pageIndex:s,featurePageIndex:n}=this._translateIndex(e);return this._pages[s].getAttribute(n,t)}getAttributeAsTimestamp(e,t){const{pageIndex:s,featurePageIndex:n}=this._translateIndex(e);return this._pages[s].getAttributeAsTimestamp(n,t)}getAttributes(e){const{pageIndex:t,featurePageIndex:s}=this._translateIndex(e);return this._pages[t].getAttributes(s)}getCoordinates(e,t,s){const{pageIndex:n,featurePageIndex:a}=this._translateIndex(e);this._pages[n].getCoordinates(a,t,s)}getOptimizedGeometry(e){const{pageIndex:t,featurePageIndex:s}=this._translateIndex(e);return this._pages[t].getOptimizedGeometry(s)}getCentroid(e,t){const{pageIndex:s,featurePageIndex:n}=this._translateIndex(e);return this._pages[s].getCentroid(n,t)}getBounds(e){const{pageIndex:t,featurePageIndex:s}=this._translateIndex(e);return this._pages[t].getBounds(s)}getBoundingBox(e){const{pageIndex:t,featurePageIndex:s}=this._translateIndex(e);return this._pages[t].getBoundingBox(s)}getObjectIdsArray(e,t=this._allFeatureIndices(),s=0){let n=s;for(const{page:a,indices:r}of this._batchPageIndices(t))n=a.getObjectIdsArray(e,r,n);return n}getCoordinatesArray(e,t=this._allFeatureIndices(),s=0){let n=s;for(const{page:a,indices:r}of this._batchPageIndices(t))n=a.getCoordinatesArray(e,r,n);return n}*objectIds(e=this._allFeatureIndices()){for(const{page:t,indices:s}of this._batchPageIndices(e))for(const e of t.objectIds(s))yield e}*_allFeatureIndices(){const{featureCount:e}=this;for(let t=0;t<e;++t)yield t}_translateIndex(e){const{_pageSize:t}=this;return{pageIndex:Math.floor(e/t),featurePageIndex:e%t}}*_batchPageIndices(e){const t=new Array;{let s=0,n=new Array;for(const a of e){const{pageIndex:e,featurePageIndex:r}=this._translateIndex(a);s!==e&&(0!==n.length&&t.push({pageIndex:s,indices:n}),s=e,n=[]),n.push(r)}0!==n.length&&t.push({pageIndex:s,indices:n})}const{_pages:s}=this;for(const{pageIndex:n,indices:a}of t)yield{page:s[n],indices:a}}}export{n as Tile};
|
|
@@ -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 t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{isSome as
|
|
5
|
+
import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{isSome as a}from"../../../../../core/arrayUtils.js";import has from"../../../../../core/has.js";import{createAbortError as o,isAbortError as n}from"../../../../../core/promiseUtils.js";import i from"../../../../../core/ReactiveMap.js";import{signal as s}from"../../../../../core/signal.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromExtent as d,intersects as c}from"../../../../../geometry/support/aaBoundingRect.js";import{FeatureData as u}from"./featureData/FeatureData.js";let f=class extends e{constructor(t){super(t),this._updatingCount=0,this.extent=null,this._tileHandles=new i,this._wanted=new i}destroy(){for(const t of this._tileHandles.values())t.abort();this._tileHandles.clear(),this._wanted.clear()}get updating(){return this._updatingCount>0}get _boundingRect(){const{extent:t}=this;return null==t?null:d(t)}get _missingTiles(){const t=new Array,e=this._wanted;for(const a of this._tileHandles.values())e.has(a.id)&&!h(a)&&t.push(a);return t}async onTileTreeChange(t){++this._updatingCount;try{const{added:e,removed:a}=t,o=this._tileHandles,{_boundingRect:n}=this,i=null!=n?e.filter((t=>c(n,t.extent))):e,s=this._wanted,r=new Array;for(const t of a){const{id:a}=t;s.delete(a);if(e.some((e=>m(e,t)||m(t,e))))continue;const n=o.get(a);null!=n&&r.push(this._removeTile(n))}for(const t of i)s.set(t.id,t),r.push(this._addTile(t));await Promise.allSettled(r)}finally{--this._updatingCount}}async _removeTile(t){this._tileHandles.delete(t.id),this._validate(),t.abort();const{featureData:e}=t,a=new _(t.untilSettled(),null!=e?this.createRemoveFeatureDataCommand(e.id):null);t.nextEvent=null;const{command:o}=await a.getCommand();o?.execute()}async _addTile(t){const{_tileHandles:e}=this,a=e.get(t.id);if(null!=a)return!h(a)||a.featureData.isFullyEnabled||(a.featureData.enableAll(),a.nextEvent=this._onTileLoad(a)),void await a.untilSettled();const n=new p(t);this._tileHandles.set(n.id,n);const i=this.loadTile(t,n.signal);n.nextEvent=i;const s=await i;if(n.aborted)throw o();n.featureData=new u(s),g(n),n.nextEvent=this._onTileLoad(n),await n.untilSettled()}async _onTileLoad(t){const{_wanted:e,_tileHandles:a,_missingTiles:o}=this,n=t.descriptor,i=new Array,s=new Array,r=new Set;for(const d of a.values()){if(d===t)continue;const{descriptor:l,id:c}=d;if(e.has(c)||o.some((({descriptor:t})=>m(t,l)||m(l,t)))){if(h(d)){if(m(n,l)){const t=d.featureData;for(const e of t.objectIds())r.add(e)}if(m(l,n)){const e=t.featureData,a=new Set(e.objectIds()),{featureData:o}=d;o.disableObjectIds(a);const n=AbortSignal.any([d.signal,t.signal]),r=d.untilSettled();i.push(new _(r,this.createUpdateFeatureDataVisibilityCommand(o),n)),s.push(d),this._validateRemoval(o,a)}}}else{d.abort(),a.delete(c);const{featureData:t}=d;null!=t&&i.push(new _(d.untilSettled(),this.createRemoveFeatureDataCommand(t.id))),d.nextEvent=null}}r.size>0&&(t.featureData.disableObjectIds(r),this._validateRemoval(t.featureData,r)),this._validate(),i.push(new _(t.untilSettled(),this.createAddFeatureDataCommand(t.featureData,t.signal),t.signal)),s.push(t);const l=this._joinCommands(i);for(const d of s)d.nextEvent=l;await l}async _joinCommands(t){const e=(await Promise.allSettled(t.map((async t=>t.getCommand())))).map((t=>"fulfilled"!==t.status||t.value.signal?.aborted?null:t.value.command)).filter(a);if(0===e.length)return;e.reduce(((t,e)=>(t.append(e),t))).execute()}_validate(){if(!has("feature-pipeline-3d-test-validation"))return;const t=new Array;for(const e of this._tileHandles.values()){if(!h(e))continue;const{featureData:a}=e;t.push({featureData:a,objectIds:new Set(a.enabledObjectIds())})}for(let e=0;e<t.length;++e){const{featureData:a,objectIds:o}=t[e];for(let n=e+1;n<t.length;++n){const{featureData:e,objectIds:i}=t[n];for(const t of i)if(o.has(t))throw new Error(`${a.id} and ${e.id} both contain ${t}.`)}}}_validateRemoval(t,e){if(has("feature-pipeline-3d-test-validation"))for(const a of t.enabledObjectIds())if(e.has(a))throw new Error(`Failed to remove ${a} from ${t.id}!`)}};function m({lij:[t,e,a]},{lij:[o,n,i]}){const s=o-t;return s>=0&&e===n>>s&&a===i>>s}t([r()],f.prototype,"updating",null),t([r({constructOnly:!0})],f.prototype,"loadTile",void 0),t([r({constructOnly:!0})],f.prototype,"createAddFeatureDataCommand",void 0),t([r({constructOnly:!0})],f.prototype,"createRemoveFeatureDataCommand",void 0),t([r({constructOnly:!0})],f.prototype,"createUpdateFeatureDataVisibilityCommand",void 0),t([r()],f.prototype,"_updatingCount",void 0),t([r()],f.prototype,"extent",void 0),t([r()],f.prototype,"_boundingRect",null),t([r()],f.prototype,"_missingTiles",null),f=t([l("esri.views.3d.layers.graphics.pipeline.Tile3DManager")],f);class p{constructor(t){this.descriptor=t,this._controller=new AbortController,this._featureData=s(null),this.nextEvent=null}get id(){return this.descriptor.id}get featureData(){return this._featureData.value}set featureData(t){this._featureData.value=t}get signal(){return this._controller.signal}abort(){this._controller.abort()}get aborted(){return this._controller.signal.aborted}async untilSettled(){try{await this.nextEvent}catch(t){n(t)||console.error(t)}}}function h(t){return null!=t.featureData}function g(t){if(!h(t))throw new Error}class _{constructor(t,e,a){this.previousEventSettled=t,this.commandPromise=e,this.signal=a}async getCommand(){const{previousEventSettled:t,commandPromise:e,signal:a}=this,[n]=await Promise.all([e,t]);if(a?.aborted)throw o();return{command:n,signal:a}}}export{f as Tile3DManager};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{baseObjectMemory as t}from"../../../../../../core/memoryEstimations.js";import{generateId as
|
|
5
|
+
import{baseObjectMemory as t,estimateStringMemory as e}from"../../../../../../core/memoryEstimations.js";import{generateId as r}from"../utils.js";import{FeatureDataSubset as i}from"./FeatureDataSubset.js";class s{constructor(t){this._tile=t,this.id=r(`featureData-${t.id}-`),this._enabled=new Array(t.featureCount).fill(!0)}get featureCount(){return this._tile.featureCount}get usedMemory(){return t+e(this.id)}get extent(){return this._tile.descriptor.extent}get isFullyEnabled(){return this._enabled.every((t=>t))}getObjectId(t){return this._tile.getObjectId(t)}getAttribute(t,e){return this._tile.getAttribute(t,e)}getAttributeAsTimestamp(t,e){return this._tile.getAttribute(t,e)}getAttributes(t){return this._tile.getAttributes(t)}getCoordinates(t,e,r){return this._tile.getCoordinates(t,e,r)}getOptimizedGeometry(t){return this._tile.getOptimizedGeometry(t)}getCentroid(t,e){return this._tile.getCentroid(t,e)}getBounds(t){return this._tile.getBounds(t)}getBoundingBox(t){return this._tile.getBoundingBox(t)}getObjectIdsArray(t,e,r){return this._tile.getObjectIdsArray(t,e,r)}getCoordinatesArray(t,e,r){return this._tile.getCoordinatesArray(t,e,r)}objectIds(t){return this._tile.objectIds(t)}subset(t){return new i(this,t)}disableObjectIds(t){if(0===t.size)return;const{_enabled:e}=this,r=new Array;for(const i of this._allFeatureIndices())e[i]&&t.has(this.getObjectId(i))&&r.push(i);if(0!==r.length)for(const i of r)e[i]=!1}setEnabled(t,e){this._enabled[t]=e}getEnabled(t){return this._enabled[t]}enableAll(){this._enabled.fill(!0)}getVisibilityArray(t,e=this._allFeatureIndices(),r=0){const{_enabled:i}=this;for(const s of e)t[r++]=Number(i[s]);return r}*enabledObjectIds(t=this._allFeatureIndices()){const{_enabled:e}=this;for(const r of t)e[r]&&(yield this.getObjectId(r))}*_allFeatureIndices(){const{featureCount:t}=this;for(let e=0;e<t;++e)yield e}}export{s as FeatureData};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{baseObjectMemory as t}from"../../../../../../core/memoryEstimations.js";import{generateId as e}from"../utils.js";class s{constructor(t,s){this._parent=t,this._subsetIndices=s,this.id=e(`featureDataSubset-${t.id}-`)}get extent(){return this._parent.extent}get featureCount(){return this._subsetIndices.length}get usedMemory(){return this._parent.usedMemory+t+this._subsetIndices.byteLength}get isFullyEnabled(){for(const t of this._subsetIndices)if(!this._parent.getEnabled(t))return!1;return!0}getObjectId(t){return this._parent.getObjectId(this._subsetIndices[t])}getAttribute(t,e){return this._parent.getAttribute(this._subsetIndices[t],e)}getAttributeAsTimestamp(t,e){return this._parent.getAttribute(this._subsetIndices[t],e)}getAttributes(t){return this._parent.getAttributes(this._subsetIndices[t])}getCoordinates(t,e,s){return this._parent.getCoordinates(this._subsetIndices[t],e,s)}getOptimizedGeometry(t){return this._parent.getOptimizedGeometry(this._subsetIndices[t])}getCentroid(t,e){return this._parent.getCentroid(this._subsetIndices[t],e)}getBounds(t){return this._parent.getBounds(this._subsetIndices[t])}getBoundingBox(t){return this._parent.getBoundingBox(this._subsetIndices[t])}getObjectIdsArray(t,e,s){return this._parent.getObjectIdsArray(t,this._translatedIndices(e),s)}getCoordinatesArray(t,e,s){return this._parent.getCoordinatesArray(t,this._translatedIndices(e),s)}objectIds(t){return this._parent.objectIds(this._translatedIndices(t))}subset(t){const{_subsetIndices:e}=this,n=new Uint32Array(t.length);for(let s=0;s<n.length;++s)n[s]=e[t[s]];return new s(this._parent,n)}disableObjectIds(t){if(0===t.size)return;const{featureCount:e}=this,s=new Array;for(let n=0;n<e;++n)this.getEnabled(n)&&t.has(this.getObjectId(n))&&s.push(n);if(0!==s.length)for(const n of s)this.setEnabled(n,!1)}setEnabled(t,e){this._parent.setEnabled(this._subsetIndices[t],e)}getEnabled(t){return this._parent.getEnabled(this._subsetIndices[t])}enableAll(){const{_subsetIndices:t,_parent:e}=this;for(const s of t)e.setEnabled(s,!0)}getVisibilityArray(t,e,s){return this._parent.getVisibilityArray(t,this._translatedIndices(e),s)}enabledObjectIds(t){return this._parent.enabledObjectIds(this._translatedIndices(t))}*_translatedIndices(t){const{_subsetIndices:e}=this;if(null!=t)for(const s of t)yield e[s];else yield*e}}export{s as FeatureDataSubset};
|
|
@@ -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{create as
|
|
5
|
+
import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBuffer as e}from"../../../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as t}from"../../../../../../geometry/projection/projectVectorToVector.js";import{center as o}from"../../../../../../geometry/support/aaBoundingRect.js";function n(r){const{featureCount:e}=r;if(0===e)return new Uint32Array;const t=new Uint32Array(e);return r.getObjectIdsArray(t),t}function a(r){const{featureCount:e}=r;if(0===e)return new Float64Array;const t=new Float64Array(3*e);return r.getCoordinatesArray(t),t}function i(r,t){const{featureCount:o}=r;if(0===o)return new Float64Array;const n=a(r),i=t.viewSpatialReference,c=t.renderSpatialReference,f=new Float64Array(3*o);if(!e(n,i,0,f,c,0,o))throw new Error("Failed to project coordinates");return f}function c(e,n){const a=n.viewSpatialReference,i=n.renderSpatialReference,{extent:c}=e,f=o(c),u=r();return t([f[0],f[1],0],a,u,i),u}export{i as computeRenderCoordinates,c as computeTileCenterRenderCoordinates,a as readMapCoordinates,n as readObjectIds};
|
|
@@ -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 e from"../../../../../../core/Error.js";import t from"../../../../../../core/pbf.js";import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{BBox as s}from"../../../../../../core/libs/rbush/PooledRBush.js";import{fromValues as n}from"../../../../../../geometry/support/aaBoundingBox.js";import{normalizeTransform as o}from"../../../../../../geometry/support/quantizationUtils.js";import i from"../../../../../../layers/graphics/OptimizedGeometry.js";import a from"../../../../../../layers/support/FieldsIndex.js";import{parseField as d,parseTransform as c}from"../../../../../../rest/query/operations/pbfFeatureServiceParser.js";class u{constructor(e){this._reader=new t(new Uint8Array(e),new DataView(e)),this._index=g(this._reader)}get featureCount(){return this._index.featureIndices.length}get exceededTransferLimit(){return this._index.exceededTransferLimit}get usedMemory(){return this._reader.usedMemory}getObjectId(e){return this.getAttribute(e,this._index.objectIdFieldName)}getAttribute(e,t){const{_index:{fieldsIndex:r,attributeIndices:s}}=this,n=r.get(t)?.index;if(null==n)return;const o=s[e*r.fields.length+n],i=this._reader;return i.move(o),m(i)}getAttributeAsTimestamp(e,t){const r=this.getAttribute(e,t);return"string"==typeof r?new Date(r).getTime():"number"==typeof r||null==r?r:null}getAttributes(e){const{_index:{fieldsIndex:t,attributeIndices:r}}=this,s=e*t.fields.length,n=this._reader,o={};for(const i of t.fields){const e=r[s+i.index];n.move(e),o[i.name]=m(n)}return o}getCoordinates(e,t,r=0){const s=this._reader,{transform:n,featureIndices:o}=this._index,{scale:i,translate:a}=n;s.move(o[e]),this._readCoordinates(i,a,t,r)}getOptimizedGeometry(e){const t=r();return this.getCoordinates(e,t),new i([],t)}getCentroid(e,{hasZ:t,hasM:r}){this.getCoordinates(e,p);const[s,n,o]=p,a=[s,n];return t&&(a[3]=o),r&&(a[t?4:3]=0),new i([],a)}getBounds(e){this.getCoordinates(e,p);const[t,r]=p,n=new s;return n.minX=t,n.minY=r,n.maxX=t,n.maxY=r,n}getBoundingBox(e){this.getCoordinates(e,p);const[t,r,s]=p;return n(t,r,s,t,r,s)}
|
|
5
|
+
import e from"../../../../../../core/Error.js";import t from"../../../../../../core/pbf.js";import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{BBox as s}from"../../../../../../core/libs/rbush/PooledRBush.js";import{fromValues as n}from"../../../../../../geometry/support/aaBoundingBox.js";import{normalizeTransform as o}from"../../../../../../geometry/support/quantizationUtils.js";import i from"../../../../../../layers/graphics/OptimizedGeometry.js";import a from"../../../../../../layers/support/FieldsIndex.js";import{parseField as d,parseTransform as c}from"../../../../../../rest/query/operations/pbfFeatureServiceParser.js";class u{constructor(e){this._reader=new t(new Uint8Array(e),new DataView(e)),this._index=g(this._reader)}get featureCount(){return this._index.featureIndices.length}get exceededTransferLimit(){return this._index.exceededTransferLimit}get usedMemory(){return this._reader.usedMemory}getObjectId(e){return this.getAttribute(e,this._index.objectIdFieldName)}getAttribute(e,t){const{_index:{fieldsIndex:r,attributeIndices:s}}=this,n=r.get(t)?.index;if(null==n)return;const o=s[e*r.fields.length+n],i=this._reader;return i.move(o),m(i)}getAttributeAsTimestamp(e,t){const r=this.getAttribute(e,t);return"string"==typeof r?new Date(r).getTime():"number"==typeof r||null==r?r:null}getAttributes(e){const{_index:{fieldsIndex:t,attributeIndices:r}}=this,s=e*t.fields.length,n=this._reader,o={};for(const i of t.fields){const e=r[s+i.index];n.move(e),o[i.name]=m(n)}return o}getCoordinates(e,t,r=0){const s=this._reader,{transform:n,featureIndices:o}=this._index,{scale:i,translate:a}=n;s.move(o[e]),this._readCoordinates(i,a,t,r)}getOptimizedGeometry(e){const t=r();return this.getCoordinates(e,t),new i([],t)}getCentroid(e,{hasZ:t,hasM:r}){this.getCoordinates(e,p);const[s,n,o]=p,a=[s,n];return t&&(a[3]=o),r&&(a[t?4:3]=0),new i([],a)}getBounds(e){this.getCoordinates(e,p);const[t,r]=p,n=new s;return n.minX=t,n.minY=r,n.maxX=t,n.maxY=r,n}getBoundingBox(e){this.getCoordinates(e,p);const[t,r,s]=p;return n(t,r,s,t,r,s)}getObjectIdsArray(e,t=this._allFeatureIndices(),r=0){const s=this._reader,{objectIdFieldName:n,attributeIndices:o,fieldsIndex:i}=this._index,a=i.get(n).index,d=i.fields.length;for(const c of t){const t=o[c*d+a];s.move(t),e[r++]=m(s)}return r}getCoordinatesArray(e,t=this._allFeatureIndices(),r=0){const s=this._reader,{transform:n,featureIndices:o}=this._index,{scale:i,translate:a}=n;for(const d of t){const t=o[d];s.move(t),r=this._readCoordinates(i,a,e,r)}return r}*objectIds(e=this._allFeatureIndices()){const t=this._reader,{objectIdFieldName:r,attributeIndices:s,fieldsIndex:n}=this._index,o=n.get(r).index,i=n.fields.length;for(const a of e){const e=s[a*i+o];t.move(e),yield m(t)}}*_allFeatureIndices(){const{featureCount:e}=this;for(let t=0;t<e;++t)yield t}_readCoordinates([e,t,r],[s,n,o],i,a){const d=2,c=3,u=this._reader,g=u.getLength(),l=u.pos()+g;for(;u.pos()<l&&u.next();)switch(u.tag()){case d:{const d=u.getLength(),g=u.pos()+d;for(;u.pos()<g&&u.next();)if(u.tag()===c)u.getUInt32(),i[a++]=s+e*u.getSInt64(),i[a++]=n+t*u.getSInt64(),i[a++]=o+r*u.getSInt64();else u.skip();break}default:u.skip()}return a}}function g(e){const t=2;for(;e.next();){if(e.tag()===t)return l(e.getMessage());e.skip()}h()}function l(e){const t=1;for(;e.next();){if(e.tag()===t)return f(e.getMessage());e.skip()}h()}function f(e){const t=9,r=12,s=13,n=15,i=7,u=0,g=10,l=1,f=1;let m,p,x=!1,I=!1,b=0;const _=new Array,w=new Array,y=new Array;for(;e.next();)switch(e.tag()){case f:p=e.getString();break;case i:e.getEnum()!==u&&h();break;case t:x=e.getBool()??!1;break;case r:m=o(e.processMessage(c));break;case s:{const t=e.processMessage(d);t.index=b++,_.push(t);break}case n:{w.push(e.pos());const t=e.getUInt32(),r=e.pos()+t;for(;e.pos()<r&&e.next();)if(e.tag()===l)y.push(e.pos()),e.skip();else e.skip();break}case g:I=e.getBool()??!1;break;default:e.skip()}const j=new a(_);return null!=m&&I&&null!=p&&j.has(p)||h(),{transform:m,exceededTransferLimit:x,fieldsIndex:j,objectIdFieldName:p,featureIndices:w,attributeIndices:y}}function h(){const t=new e("pbf-parsing-failed","Error while parsing PBF",new Error);throw console.error(t),t}function m(e){const t=1,r=2,s=3,n=4,o=5,i=6,a=7,d=8,c=9,u=e.getLength(),g=e.pos()+u;for(;e.pos()<g&&e.next();)switch(e.tag()){case t:return e.getString();case r:return e.getFloat();case s:return e.getDouble();case n:return e.getSInt32();case o:return e.getUInt32();case i:return e.getInt64();case a:return e.getUInt64();case d:return e.getSInt64();case c:return e.getBool();default:return e.skip(),null}return null}const p=r();export{u as PBFPointFeatureSetView};
|
|
@@ -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 t from"../../../../../../core/Evented.js";import{baseObjectMemory as e,estimateNumberMemory as i}from"../../../../../../core/memoryEstimations.js";import{PooledRBush as r,BBox as s}from"../../../../../../core/libs/rbush/PooledRBush.js";import{getCentroidOptimizedGeometry as n}from"../../../../../../layers/graphics/centroid.js";import o from"../../../../../../layers/graphics/OptimizedGeometry.js";class u{constructor(t,e){this._index=t,this._view=e}get usedMemory(){return e+i}getObjectId(){return this._view.getObjectId(this._index)}getAttribute(t){return this._view.getAttribute(this._index,t)}getAttributeAsTimestamp(t){return this._view.getAttributeAsTimestamp(this._index,t)}getAttributes(){return this._view.getAttributes(this._index)}getOptimizedGeometry(){return this._view.getOptimizedGeometry(this._index)}getCentroid(t){return this._view.getCentroid(this._index,t)}getBounds(){return this._view.getBounds(this._index)}getBoundingBox(){return this._view.getBoundingBox(this._index)}cloneWithGeometry(t){return new
|
|
5
|
+
import t from"../../../../../../core/Evented.js";import{baseObjectMemory as e,estimateNumberMemory as i}from"../../../../../../core/memoryEstimations.js";import{PooledRBush as r,BBox as s}from"../../../../../../core/libs/rbush/PooledRBush.js";import{getCentroidOptimizedGeometry as n}from"../../../../../../layers/graphics/centroid.js";import o from"../../../../../../layers/graphics/OptimizedGeometry.js";class u{constructor(t,e){this._index=t,this._view=e}get usedMemory(){return e+i}getObjectId(){return this._view.getObjectId(this._index)}getAttribute(t){return this._view.getAttribute(this._index,t)}getAttributeAsTimestamp(t){return this._view.getAttributeAsTimestamp(this._index,t)}getAttributes(){return this._view.getAttributes(this._index)}getOptimizedGeometry(){return this._view.getOptimizedGeometry(this._index)}getCentroid(t){return this._view.getCentroid(this._index,t)}getBounds(){return this._view.getBounds(this._index)}getBoundingBox(){return this._view.getBoundingBox(this._index)}cloneWithGeometry(t){return new d(this._index,this._view,t)}}class d extends u{constructor(t,e,i){super(t,e),this._geometryOverride=i}getOptimizedGeometry(){return this._geometryOverride}getCentroid(t){return n(new o,this._geometryOverride,t.hasZ,t.hasM)}}class a{constructor(t,e){this.featureData=t,this.bounds=e}}class h{constructor(){this._tileBounds=new Map,this.events=new t,this.featureAdapter=m.shared}get usedMemory(){return e+e*this._tileBounds.size}addTile(t){const{featureCount:e}=t;if(0===e)return;const i=new r(9,(e=>t.getBounds(e))),s=new Array;for(let r=0;r<e;++r)s[r]=r;i.load(s),this._tileBounds.set(t.id,new a(t,i)),this.events.emit("changed")}removeTile(t){this._tileBounds.delete(t),this.events.emit("changed")}clear(){this._tileBounds.clear(),this.events.emit("changed")}forEach(t){for(const{featureData:e,bounds:i}of this._tileBounds.values())i.all((i=>{e.getEnabled(i)&&t(new u(i,e))}))}forEachInBounds(t,e){g.minX=t[0],g.minY=t[1],g.maxX=t[2],g.maxY=t[3];for(const{featureData:i,bounds:r}of this._tileBounds.values())r.search(g,(t=>{i.getEnabled(t)&&e(new u(t,i))}))}forEachBounds(t,e){for(const i of t)e(i.getBoundingBox())}getFullExtent(t){let e=1/0,i=1/0,r=-1/0,s=-1/0;for(const{bounds:n}of this._tileBounds.values()){const{minX:t,minY:o,maxX:u,maxY:d}=n.toJSON();e=Math.min(e,t),i=Math.min(i,o),r=Math.min(r,u),s=Math.min(s,d)}return{xmin:e,ymin:i,xmax:r,ymax:s,spatialReference:t}}}class m{static{this.shared=new m}getObjectId(t){return t.getObjectId()}getAttribute(t,e){return t.getAttribute(e)}getAttributeAsTimestamp(t,e){return t.getAttributeAsTimestamp(e)}getAttributes(t){return t.getAttributes()}getGeometry(t){return t.getOptimizedGeometry()}getCentroid(t,e){return t.getCentroid(e)}cloneWithGeometry(t,e){return t.cloneWithGeometry(e)}}const g=new s;export{u as FeatureHandle,h as TiledFeatureStore};
|
|
@@ -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{throwIfAborted as e}from"../../../../../../core/promiseUtils.js";import{toExtent as t}from"../../../../../../geometry/support/aaBoundingRect.js";import{executeQueryPBFBuffer as r}from"../../../../../../rest/query/operations/query.js";import{Tile as o}from"../Tile.js";import{PBFPointFeatureSetView as s}from"../featureSet/PBFPointFeatureSetView.js";const i=8e3,a=4,n=4;class c{constructor(e,t,r,o,s){this.spatialReference=e,this.url=r,this.objectIdField=o,this.capabilities=s;const{supportsMaxRecordCountFactor:n,maxRecordCount:c}=this.capabilities.query,u=n?a:1,p=(c??i)*u;this._pageSize=Math.min(i,p);const l=t.clone();l.cacheHint=!0,l.resultType="tile",l.outSpatialReference=e,l.returnGeometry=!0,l.returnZ=!0,l.maxRecordCountFactor=u,l.num=this._pageSize,l.outFields=[o],this._baseQuery=l}async fetch(r,s){const{spatialReference:i}=this,
|
|
5
|
+
import{throwIfAborted as e}from"../../../../../../core/promiseUtils.js";import{toExtent as t}from"../../../../../../geometry/support/aaBoundingRect.js";import{executeQueryPBFBuffer as r}from"../../../../../../rest/query/operations/query.js";import{Tile as o}from"../Tile.js";import{PBFPointFeatureSetView as s}from"../featureSet/PBFPointFeatureSetView.js";const i=8e3,a=4,n=4;class c{constructor(e,t,r,o,s){this.spatialReference=e,this.url=r,this.objectIdField=o,this.capabilities=s;const{supportsMaxRecordCountFactor:n,maxRecordCount:c}=this.capabilities.query,u=n?a:1,p=(c??i)*u;this._pageSize=Math.min(i,p);const l=t.clone();l.cacheHint=!0,l.resultType="tile",l.outSpatialReference=e,l.returnGeometry=!0,l.returnZ=!0,l.maxRecordCountFactor=u,l.num=this._pageSize,l.outFields=[o],this._baseQuery=l}async fetch(r,s){const{spatialReference:i,_pageSize:a}=this,c=t(r.extent,i),u=this._baseQuery.clone();u.geometry=c;const p=new Array;let l=0,h=!1,m=1;for(;!h;){const t=[];for(let e=0;e<m;++e)t.push(this._fetchPage(u,l++,s));const r=await Promise.all(t);e(s);for(const e of r){const t=0!==e.featureCount;h||=!e.exceededTransferLimit||!t,t&&p.push(e)}m=Math.min(m+1,n)}return new o(r,p,a)}async _fetchPage(t,o,i){const a=t.clone();a.start=o*this._pageSize;const n=(await r(this.url,a,{signal:i})).data;return e(i),new s(n)}}export{c as Tile3DFetcher};
|
|
@@ -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{identity as e,scale as t}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as o,create as i}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as n}from"../../../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as s,size as a}from"../../../../../../geometry/support/aaBoundingBox.js";import{objectSymbolLayerPrimitiveBoundingBox as l,objectSymbolLayerSizeWithResourceSize as d}from"../../../../../../symbols/support/symbolLayerUtils3D.js";import{computeObjectScale as c}from"../../graphicUtils.js";import{readMapCoordinates as m,readObjectIds as p}from"../featureData/processingUtils.js";import{createPrimitiveGeometry as
|
|
5
|
+
import{identity as e,scale as t}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as o,create as i}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as n}from"../../../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as s,size as a}from"../../../../../../geometry/support/aaBoundingBox.js";import{objectSymbolLayerPrimitiveBoundingBox as l,objectSymbolLayerSizeWithResourceSize as d}from"../../../../../../symbols/support/symbolLayerUtils3D.js";import{computeObjectScale as c}from"../../graphicUtils.js";import{readMapCoordinates as m,readObjectIds as p}from"../featureData/processingUtils.js";import{createPrimitiveGeometry as u}from"./primitiveObjectUtils.js";class f{constructor(e){this._context=e,this.lodRendererId=null,this._loaded=!1,this._loadingPromise=null,this._primitive="cone"}get loaded(){return this._loaded}load(){return null==this._loadingPromise&&(this._loadingPromise=this._load()),this._loadingPromise}async _load(){const e=this._context.renderCommandContext,t=await e.createMaterial("default"),r=u(this._primitive,t);this.lodRendererId=await e.createLodRenderer(r),this._loaded=!0}async createAddCommand(e){const t=this._context.renderCommandContext.createEncoder();if(null==this.lodRendererId)throw new Error("expected lod renderer id to not be null");const{featureCount:r}=e;if(0===r)return t;const i=!0,n=s(l(this._primitive)),c=o(a(n)),u=o(d(c,{isPrimitive:i,width:100,depth:null,height:null})),f=new Float64Array(16*r),h=new Float64Array(16*r),x=m(e);for(let o=0;o<r;++o){const e=o,t=x[3*o+0],r=x[3*o+1],i=x[3*o+2],n=this._computeGlobalTransform(t,r,i,this._context.viewSpatialReference,y),s=this._computeLocalTransform(u,c,_);this._writeMatrixToTypedBuffer(f,e,s),this._writeMatrixToTypedBuffer(h,e,n)}const g=p(e),b=new Uint8Array(r);e.getVisibilityArray(b);const w={featureIds:new Uint32Array(g),visibility:b,localTransforms:f,globalTransforms:h};return t.addLodInstances(this.lodRendererId,e.id,w),t}async createRemoveCommand(e){const t=this._context.renderCommandContext.createEncoder();return null==this.lodRendererId||t.removeLodInstances(this.lodRendererId,e),t}async createUpdateVisibilityCommand(e){const{lodRendererId:t,_context:r}=this,o=r.renderCommandContext.createEncoder();if(null==t)return o;const i=new Uint8Array(e.featureCount);return e.getVisibilityArray(i),o.updateVisibility(t,e.id,i),o}_writeMatrixToTypedBuffer(e,t,r){let o=16*t;for(let i=0;i<16;i++)e[o++]=r[i]}_computeGlobalTransform(e,t,r,o,i){return h[0]=e,h[1]=t,h[2]=r,n(o,h,i,this._context.renderSpatialReference),i}_computeLocalTransform(t,r,o){return e(o),this._applyObjectScale(t,r,o),o}_applyObjectScale(e,r,o){const i=c(e,e,r,this._context.renderCoordsHelper.unitInMeters);1===i[0]&&1===i[1]&&1===i[2]||t(o,o,i)}}const h=i(),_=r(),y=r();export{f as TestObjectSymbol};
|
|
@@ -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{create as
|
|
5
|
+
import{create as t}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{readObjectIds as e,computeRenderCoordinates as r,computeTileCenterRenderCoordinates as i}from"../featureData/processingUtils.js";import{inputAttributesToAttributesMap as n}from"./symbolizationUtils.js";import{Attribute as a}from"../../../../webgl-engine/lib/Attribute.js";import{VertexAttribute as o}from"../../../../webgl-engine/lib/VertexAttribute.js";class l{constructor(t){this._context=t,this.materialId=null,this._loaded=!1,this._loadingPromise=null}get loaded(){return this._loaded}load(){return null==this._loadingPromise&&(this._loadingPromise=this._load()),this._loadingPromise}async _load(){const t=this._context.renderCommandContext;this.materialId=await t.createMaterial("hud"),await t.createDirectRenderer(this.materialId),this._loaded=!0}async createAddCommand(l){if(null==this.materialId)throw new Error("expected material not to be null");const s=this._context,d=s.renderCommandContext.createEncoder(),{featureCount:m,id:c}=l;if(0===m)return d;const u=e(l),y=r(l,s),w=i(l,s),h=new Float64Array([0,0,1]),A=new Float64Array([255,255,255,255]),b=new Float64Array([24,24]),C=new Float64Array([0,0,0,1]),f=new Float64Array([0,0]),I=new Float64Array([0]),_=new Uint32Array(m);for(let t=0;t<m;++t)_[t]=t;const g=new Uint32Array(m);for(let t=0;t<m;++t)g[t]=0;const x=new a(y,_,3,!0),p=new a(h,g,3,!0),E=new a(f,g,2,!0),F=new a(A,g,4,!0),O=new a(I,g,1,!0),R=new a(b,g,2,!0),U=new a(C,g,4,!0),j=[[o.POSITION,x],[o.NORMAL,p],[o.UV0,E],[o.COLOR,F],[o.ROTATION,O],[o.SIZE,R],[o.CENTEROFFSETANDDISTANCE,U]],D=new Uint8Array(m);l.getVisibilityArray(D);const N={attributes:n(j),objectAndLayerIdColor:void 0,transformation:t(),materialId:this.materialId,objectIds:u,visibilities:D};return d.addDirectRendererGeometry(c,N,w),d}async createRemoveCommand(t){const{materialId:e,_context:r}=this,i=r.renderCommandContext.createEncoder();return null==e||i.removeDirectRendererGeometry(e,t),i}async createUpdateVisibilityCommand(t){const{materialId:e,_context:r}=this,i=r.renderCommandContext.createEncoder();if(null==e)return i;const n=new Uint8Array(t.featureCount);return t.getVisibilityArray(n),i.updateVisibility(e,t.id,n),i}}export{l as TestSymbol};
|
|
@@ -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{PipelineCommand as t}from"../PipelineCommand.js";import{readObjectIds as e}from"../featureData/processingUtils.js";import{TestObjectSymbol as n}from"./TestObjectSymbol.js";import{TestSymbol as o}from"./TestSymbol.js";class r{constructor(t){this._symbols=new Array,this._featureDataPartitioning=new Map,this._context=t}async load(){this._symbols[0]=new o(this._context),this._symbols[1]=new n(this._context)}async createAddCommand(e){const n=this._partition(e),o=await Promise.all(n.map((async({index:t,features:e})=>{const n=await this._provisionSymbol(t);return await(n?.createAddCommand(e))}))),r=this._context.renderCommandContext.createEncoder();for(const t of o)null!=t&&r.append(t);return new t(r,[()=>{this._featureDataPartitioning.set(e.id,n)}])}async createRemoveCommand(e){const{_featureDataPartitioning:n}=this,o=n.get(e),r=this._context.renderCommandContext.createEncoder();if(null==o)return new t(this._context.renderCommandContext.createEncoder(),[]);const a=await Promise.all(o.map((async({index:t,features:e})=>{const n=this._getLoadedSymbol(t);return await(n?.createRemoveCommand(e.id))})));for(const t of a)null!=t&&r.append(t);return new t(r,[()=>{n.delete(e)}])}async _provisionSymbol(t){if(null==t)return null;const e=this._symbols[t];return e?(e.loaded||await e.load(),e):null}_getLoadedSymbol(t){if(null==t)return null;const e=this._symbols[t];return null!=e&&e.loaded?e:null}_partition(t){const n=e(t);if(null==n)throw new Error("unable to fetch objectIds");const{featureCount:o}=t,r=[[],[]];for(let e=0;e<o;++e){r[n[e]%2].push(e)}return r.map(((e,n)=>new a(n,t.subset(new Uint32Array(e))))).filter((t=>t.features.featureCount>0))}}class a{constructor(t,e){this.index=t,this.features=e}}export{r as UniqueValueFeatureRenderer};
|
|
5
|
+
import{PipelineCommand as t}from"../PipelineCommand.js";import{readObjectIds as e}from"../featureData/processingUtils.js";import{TestObjectSymbol as n}from"./TestObjectSymbol.js";import{TestSymbol as o}from"./TestSymbol.js";class r{constructor(t){this._symbols=new Array,this._featureDataPartitioning=new Map,this._context=t}async load(){this._symbols[0]=new o(this._context),this._symbols[1]=new n(this._context)}async createAddCommand(e){const n=this._partition(e),o=await Promise.all(n.map((async({index:t,features:e})=>{const n=await this._provisionSymbol(t);return await(n?.createAddCommand(e))}))),r=this._context.renderCommandContext.createEncoder();for(const t of o)null!=t&&r.append(t);return new t(r,[()=>{this._featureDataPartitioning.set(e.id,n)}])}async createRemoveCommand(e){const{_featureDataPartitioning:n}=this,o=n.get(e),r=this._context.renderCommandContext.createEncoder();if(null==o)return new t(this._context.renderCommandContext.createEncoder(),[]);const a=await Promise.all(o.map((async({index:t,features:e})=>{const n=this._getLoadedSymbol(t);return await(n?.createRemoveCommand(e.id))})));for(const t of a)null!=t&&r.append(t);return new t(r,[()=>{n.delete(e)}])}async createUpdateVisibilityCommand(e){const{_featureDataPartitioning:n}=this,o=n.get(e.id),r=this._context.renderCommandContext.createEncoder();if(null==o)return new t(this._context.renderCommandContext.createEncoder(),[]);const a=await Promise.all(o.map((async({index:t,features:e})=>{const n=this._getLoadedSymbol(t);return await(n?.createUpdateVisibilityCommand(e))})));for(const t of a)null!=t&&r.append(t);return new t(r,[])}async _provisionSymbol(t){if(null==t)return null;const e=this._symbols[t];return e?(e.loaded||await e.load(),e):null}_getLoadedSymbol(t){if(null==t)return null;const e=this._symbols[t];return null!=e&&e.loaded?e:null}_partition(t){const n=e(t);if(null==n)throw new Error("unable to fetch objectIds");const{featureCount:o}=t,r=[[],[]];for(let e=0;e<o;++e){r[n[e]%2].push(e)}return r.map(((e,n)=>new a(n,t.subset(new Uint32Array(e))))).filter((t=>t.features.featureCount>0))}}class a{constructor(t,e){this.index=t,this.features=e}}export{r as UniqueValueFeatureRenderer};
|