@arcgis/core 5.0.0-next.66 → 5.0.0-next.68
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/Ground.d.ts +4 -4
- package/Map.d.ts +1 -1
- package/WebDocument2D.d.ts +2 -3
- package/WebScene.d.ts +2 -3
- package/analysis/ElevationProfile/ElevationProfileLineViewOptions.d.ts +9 -6
- package/analysis/ElevationProfile/ElevationProfileLineViewOptions.js +1 -1
- package/applications/Components/QuantityFormatter.d.ts +14 -1
- package/applications/Components/SelectionOperation.d.ts +45 -9
- package/applications/Components/SketchTooltipControls.d.ts +31 -6
- package/applications/Components/actionUtils.d.ts +1 -0
- package/applications/Components/analysisUtils.d.ts +98 -26
- package/applications/Components/arcadeEditorUtils.d.ts +3 -0
- package/applications/Components/arcadeFeatureUtils.d.ts +34 -6
- package/applications/Components/baUtils.d.ts +8 -8
- package/applications/Components/basemapUtils.d.ts +2 -0
- package/applications/Components/drawUtils.d.ts +6 -1
- package/applications/Components/featureUtils.d.ts +9 -0
- package/applications/Components/fontUtils.d.ts +2 -0
- package/applications/Components/formatUtils.d.ts +2 -0
- package/applications/Components/getDefaultUnits.d.ts +2 -0
- package/applications/Components/imageryUtils.d.ts +135 -27
- package/applications/Components/layerOriginUtils.d.ts +5 -0
- package/applications/Components/layersEffectsJsonUtils.d.ts +2 -0
- package/applications/Components/previewSymbol2D.d.ts +2 -0
- package/applications/Components/reactiveUtils.d.ts +13 -9
- package/applications/Components/sanitizerUtils.d.ts +2 -0
- package/applications/Components/stringUtils.d.ts +5 -0
- package/applications/Components/styleUtils.d.ts +2 -0
- package/applications/Components/svgUtils.d.ts +4 -0
- package/applications/Components/testUtils.d.ts +3 -0
- package/applications/Components/viewUtils.d.ts +2 -0
- package/applications/Components/webStyleSymbolUtils.d.ts +2 -0
- package/applications/Excalibur/videoViewUtils.d.ts +19 -3
- package/applications/ExperienceBuilder/sketchUtils.d.ts +10 -1
- package/applications/KnowledgeStudio/dataModelVisualization.d.ts +2 -0
- package/applications/KnowledgeStudio/generalSdkInternalAccess.d.ts +33 -4
- package/applications/KnowledgeStudio/generalSharedKgUtils.d.ts +73 -10
- package/applications/KnowledgeStudio/layerInternalAccessUtils.d.ts +12 -1
- package/applications/KnowledgeStudio/reshape.d.ts +144 -28
- package/applications/KnowledgeStudio/resourceSerializationUtils.d.ts +17 -3
- package/applications/MapViewer/layerUtils.d.ts +2 -0
- package/applications/MapViewer/mediaUtils.d.ts +42 -8
- package/applications/MapViewer/templateUtils.d.ts +78 -16
- package/applications/PortalApp/layerUtils.d.ts +2 -0
- package/applications/SceneViewer/colorUtils.d.ts +2 -0
- package/applications/SceneViewer/devEnvironmentUtils.d.ts +3 -0
- package/applications/SceneViewer/layerUtils.d.ts +5 -3
- package/applications/SceneViewer/sceneViewerUtils.d.ts +52 -5
- package/applications/SceneViewer/symbolUtils.d.ts +2 -0
- package/applications/Urban/LineImagePattern3D.d.ts +8 -2
- package/applications/Urban/imagePatternUtils.d.ts +10 -2
- package/applications/Urban/meshUtils.d.ts +2 -0
- package/applications/WebEditor/sketchUtils.d.ts +24 -4
- package/arcade/arcadeAsyncRuntime.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/arcadeRuntime.js +1 -1
- package/arcade/batchExec.js +1 -1
- package/arcade/compilerUtils.js +1 -1
- package/arcade/featureset/actions/SpatialFilter.js +1 -1
- package/arcade/geometry/unitConversion.js +1 -1
- package/arcade/treeAnalysis.js +1 -1
- package/arcade.js +1 -1
- package/assets/components/assets/icon/fileEsl16.json +1 -0
- package/assets/components/assets/icon/fileEsl24.json +1 -0
- package/assets/components/assets/icon/fileEsl32.json +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{251eb6e00f99a816d55c.js → 0326314947734b8e640a.js} +1 -1
- package/assets/esri/core/workers/chunks/04176244b0a3539c9681.js +1 -0
- package/assets/esri/core/workers/chunks/04958494022f82dca473.js +1 -0
- package/assets/esri/core/workers/chunks/0b7bbdc0d71ee6721751.js +2 -0
- package/assets/esri/core/workers/chunks/{5909a0e763fddc3542e7.js.LICENSE.txt → 0b7bbdc0d71ee6721751.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/0f8149fdcf0adeca268e.js +1 -0
- package/assets/esri/core/workers/chunks/{aa7a1705266eec353cb6.js → 0fc22ad791d3ec0a9c5e.js} +1 -1
- package/assets/esri/core/workers/chunks/10e474d664b20adcd917.js +1 -0
- package/assets/esri/core/workers/chunks/12f9a55253084a910b2e.js +1 -0
- package/assets/esri/core/workers/chunks/14dedd80fb797303f91f.js +1 -0
- package/assets/esri/core/workers/chunks/1a6d2f525dd30d08cf9b.js +1 -0
- package/assets/esri/core/workers/chunks/{81d89107ff82604a3ea0.js → 1b445981fbc8373f4dd8.js} +1 -1
- package/assets/esri/core/workers/chunks/{6ba3c2b9f699d94d62b8.js → 1ec1a1997b5577619040.js} +1 -1
- package/assets/esri/core/workers/chunks/204d738c8b651314ae64.js +1 -0
- package/assets/esri/core/workers/chunks/2085084324cd5a81783f.js +1 -0
- package/assets/esri/core/workers/chunks/{e95821a199e10b389e29.js → 25f3ee666f545a7a7993.js} +2 -2
- package/assets/esri/core/workers/chunks/{e95821a199e10b389e29.js.LICENSE.txt → 25f3ee666f545a7a7993.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/2c2c0f66cffc521df736.js +1 -0
- package/assets/esri/core/workers/chunks/2dd347aa2a061d536e69.js +1 -0
- package/assets/esri/core/workers/chunks/2dfa7abf2d39fa5a3874.js +1 -0
- package/assets/esri/core/workers/chunks/322085d63719da6e443c.js +1 -0
- package/assets/esri/core/workers/chunks/{76086517591d0eb35156.js → 34a2e0462eb05986cdd1.js} +1 -1
- package/assets/esri/core/workers/chunks/{a6dcd13c792b6538ac50.js → 35593a9790818b689455.js} +1 -1
- package/assets/esri/core/workers/chunks/36ecf951c0c7dad84b69.js +1 -0
- package/assets/esri/core/workers/chunks/37002a46f03a9fc5f644.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/3a04153ca9d8e4f01185.js +1 -0
- package/assets/esri/core/workers/chunks/{4e9a8fce55cad841c731.js → 3b25f5d9c8f78bb6e011.js} +1 -1
- package/assets/esri/core/workers/chunks/3e7ea06b342e33bc48a5.js +1 -0
- package/assets/esri/core/workers/chunks/3ed317900f0edf635508.js +1 -0
- package/assets/esri/core/workers/chunks/401ce5cb98fa14c1a725.js +1 -0
- package/assets/esri/core/workers/chunks/4319b89cfa02894a8cae.js +1 -0
- package/assets/esri/core/workers/chunks/43e2c1d72cd9c8beed2f.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/45a9cd722e98dd1548ae.js +1 -0
- package/assets/esri/core/workers/chunks/4a060147d25929680ec8.js +1 -0
- package/assets/esri/core/workers/chunks/4bcd74951477e8977ba1.js +1 -0
- package/assets/esri/core/workers/chunks/4d0eaeb4cd6cd55e25fd.js +1 -0
- package/assets/esri/core/workers/chunks/{687d2b761dc5b5cf0c31.js → 4d4d71d24c1a9cb342b8.js} +1 -1
- package/assets/esri/core/workers/chunks/4fa230dc6e5e87b0dec1.js +1 -0
- package/assets/esri/core/workers/chunks/50f03813fba4b752ca9f.js +1 -0
- package/assets/esri/core/workers/chunks/{abc236e99b52be1c83b9.js → 52a14266fe239b95c5ce.js} +1 -1
- package/assets/esri/core/workers/chunks/53b5c77832df7df4d4e3.js +1 -0
- package/assets/esri/core/workers/chunks/{34178ace79e8dea3567d.js → 562cddaf63985e53ee6e.js} +1 -1
- package/assets/esri/core/workers/chunks/59a45533e96cedf1c480.js +1 -0
- package/assets/esri/core/workers/chunks/{c2aeecd27e004c6cd7e1.js → 5b9f2aa3ba1bf12c3240.js} +2 -2
- package/assets/esri/core/workers/chunks/{c2aeecd27e004c6cd7e1.js.LICENSE.txt → 5b9f2aa3ba1bf12c3240.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{6599cc702a46f81a5634.js → 5dd5be91038df8902dc4.js} +1 -1
- package/assets/esri/core/workers/chunks/{49a1b7f700b8a42de817.js → 60c7f896f2246a8aa6d7.js} +19 -19
- package/assets/esri/core/workers/chunks/60f363ee2add089e8f0b.js +1 -0
- package/assets/esri/core/workers/chunks/61801bb8c7be8fe77086.js +1 -0
- package/assets/esri/core/workers/chunks/679cd6424e0e2d7f372b.js +1 -0
- package/assets/esri/core/workers/chunks/68074a484d7f9bc713c0.js +1 -0
- package/assets/esri/core/workers/chunks/6acfa51b81e6f4255118.js +1 -0
- package/assets/esri/core/workers/chunks/{3fe7be535affae31de7e.js → 6b85a8776ec2beff63cb.js} +1 -1
- package/assets/esri/core/workers/chunks/6be530ab81291745485b.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/6df484faf54e90a6cc77.js +1 -0
- package/assets/esri/core/workers/chunks/6ea6ad894ac634aa4391.js +1 -0
- package/assets/esri/core/workers/chunks/6f8098f9fe233833245a.js +1 -0
- package/assets/esri/core/workers/chunks/73c416ae0ec5a1815591.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/75fd2ef1236a9364ca7f.js +1 -0
- package/assets/esri/core/workers/chunks/{23b623637126f8411a30.js → 7aec07f2482934259d12.js} +1 -1
- package/assets/esri/core/workers/chunks/7be9bbae23895d1cfa92.js +1 -0
- package/assets/esri/core/workers/chunks/{741d170187e58e81584d.js → 7d744554d14057d9b2b1.js} +1 -1
- package/assets/esri/core/workers/chunks/7ea48661f1087d06aa41.js +1 -0
- package/assets/esri/core/workers/chunks/{47e5149765beee46f208.js → 7ee68f67f9cc48a328f0.js} +1 -1
- package/assets/esri/core/workers/chunks/866477acdf03b8a40bc9.js +1 -0
- package/assets/esri/core/workers/chunks/8e83c133b201b9b61e70.js +1 -0
- package/assets/esri/core/workers/chunks/9086a4933d3d3d9ffa72.js +1 -0
- package/assets/esri/core/workers/chunks/94174d40de39dbe7d0bf.js +1 -0
- package/assets/esri/core/workers/chunks/98f4b44eca91c42ca08e.js +1 -0
- package/assets/esri/core/workers/chunks/9ccabf8142fb5de4d3e2.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{dd99b77a7c0a052507bb.js → 9d88b4ba8e511da64583.js} +3 -3
- package/assets/esri/core/workers/chunks/a808be466812db51813d.js +1 -0
- package/assets/esri/core/workers/chunks/{6b4a24248182245167ca.js → a931515a2569713e743b.js} +1 -1
- package/assets/esri/core/workers/chunks/a95e28ade258b144cbb5.js +1 -0
- package/assets/esri/core/workers/chunks/adc68e2c6d2698a52bfe.js +1 -0
- package/assets/esri/core/workers/chunks/aeb524eded012217a865.js +1 -0
- package/assets/esri/core/workers/chunks/b2a1e5e9182b643909eb.js +316 -0
- package/assets/esri/core/workers/chunks/{ac6f002cfad42e60de8f.js → b48033645091c91e0d88.js} +1 -1
- package/assets/esri/core/workers/chunks/b8988771bfa4e785ebd6.js +1 -0
- package/assets/esri/core/workers/chunks/bb4574a87ca21e719f0d.js +1 -0
- package/assets/esri/core/workers/chunks/{07639f406b71bb49ffd6.js → bdbb5b33f0f49661bf6d.js} +1 -1
- package/assets/esri/core/workers/chunks/c042269586921e337be9.js +1 -0
- package/assets/esri/core/workers/chunks/c623918e289a09905cd1.js +1 -0
- package/assets/esri/core/workers/chunks/c7391b0b5a9c916a53f7.js +1 -0
- package/assets/esri/core/workers/chunks/{ac83c2999a3d2ffb4356.js → c7838ac0db8570a2d2c1.js} +1 -1
- package/assets/esri/core/workers/chunks/c91ef3814e7f024043cf.js +1 -0
- package/assets/esri/core/workers/chunks/{43d28c6509c21b8917a8.js → ca7523c14d81c470e92e.js} +1 -1
- package/assets/esri/core/workers/chunks/cd2708fb7636b3ace229.js +1 -0
- package/assets/esri/core/workers/chunks/{310f3268582e61cd86da.js → d21480925a8bc9c7de96.js} +1 -1
- package/assets/esri/core/workers/chunks/d445e9399fe4ca3d2a50.js +1 -0
- package/assets/esri/core/workers/chunks/d7683a95775c9f401a7e.js +1 -0
- package/assets/esri/core/workers/chunks/{9d6945cda99d14af83ac.js → d7d9656b990ce8be2152.js} +1 -1
- package/assets/esri/core/workers/chunks/d9ca754f51b9812bb179.js +1 -0
- package/assets/esri/core/workers/chunks/d9ef0b3341e2744d8f2f.js +1 -0
- package/assets/esri/core/workers/chunks/df4a0af329ce94a47a7b.js +1 -0
- package/assets/esri/core/workers/chunks/e10d6e511921394474ca.js +1 -0
- package/assets/esri/core/workers/chunks/e4b6aa8f67c2bd285020.js +1 -0
- package/assets/esri/core/workers/chunks/e5aac523c37d906eece6.js +1 -0
- package/assets/esri/core/workers/chunks/e6ca02f98f855024f74b.js +1 -0
- package/assets/esri/core/workers/chunks/{892157696e8f9e38c472.js → e6e837e43b9348050832.js} +1 -1
- package/assets/esri/core/workers/chunks/{d3325ed8d224e2350db7.js → e8a3ad00936f2ccaf362.js} +1 -1
- package/assets/esri/core/workers/chunks/{f351007cdcd0938d3b6c.js → eeb24a4ab4993f1f4e8e.js} +1 -1
- package/assets/esri/core/workers/chunks/ef7063ee790d2d64d4b2.js +1 -0
- package/assets/esri/core/workers/chunks/{b65fcfde62d49de1fa54.js → ef977be20a647aeded0a.js} +1 -1
- package/assets/esri/core/workers/chunks/efb631371b6bb3f043bb.js +1 -0
- package/assets/esri/core/workers/chunks/{0f5693541111fcae0c2f.js → f0914715e90e43466f8c.js} +1 -1
- package/assets/esri/core/workers/chunks/f25bebd2b6eb0d0f6626.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/f95e488d2b86e320624f.js +1 -0
- package/assets/esri/core/workers/chunks/{bfc063d4431bfa162160.js → fd09f38fb4d99bf34988.js} +1 -1
- package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
- package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
- package/assets/esri/libs/text/pkg/bundle_bg.wasm +0 -0
- package/chunks/boundedPlane.js +1 -1
- package/chunks/bundle2.js +5 -0
- package/config.js +1 -1
- package/copyright.txt +70 -1
- package/core/BidiText.js +1 -1
- package/core/accessorSupport/ensureType.js +1 -1
- package/core/compilerUtils.js +1 -1
- package/core/typedArrayUtil.js +1 -1
- package/core/units.js +1 -1
- package/core/workers/loaderConfig.js +1 -1
- package/editing/sharedTemplates/SharedTemplate.js +1 -1
- package/geometry/support/FloatArray.js +1 -1
- package/geometry/support/Indices.js +1 -1
- package/geometry/support/MeshTexture.js +1 -1
- package/geometry/support/aaBoundingRect.js +1 -1
- package/geometry/support/boundedPlane.js +1 -1
- package/geometry/support/heightModelInfoUtils.js +1 -1
- package/geometry/support/meshUtils/External.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/imageutils.js +1 -1
- package/geometry/support/meshUtils/loadExternal.js +1 -1
- package/geometry/support/rotate.js +1 -1
- package/interfaces.d.ts +23 -24
- package/kernel.js +1 -1
- package/layers/BingMapsLayer.d.ts +2 -3
- package/layers/BuildingSceneLayer.d.ts +3 -5
- package/layers/CatalogLayer.d.ts +2 -4
- package/layers/DimensionLayer.d.ts +2 -3
- package/layers/ElevationLayer.d.ts +2 -4
- package/layers/FeatureLayer.d.ts +2 -4
- package/layers/GaussianSplatLayer.d.ts +1 -3
- package/layers/GeoJSONLayer.d.ts +2 -3
- package/layers/GeoRSSLayer.d.ts +2 -3
- package/layers/GroupLayer.d.ts +2 -3
- package/layers/ImageryLayer.d.ts +2 -5
- package/layers/ImageryTileLayer.d.ts +3 -7
- package/layers/IntegratedMesh3DTilesLayer.d.ts +2 -4
- package/layers/IntegratedMeshLayer.d.ts +2 -4
- package/layers/KMLLayer.d.ts +2 -3
- package/layers/KnowledgeGraphLayer.d.ts +2 -4
- package/layers/LineOfSightLayer.d.ts +2 -3
- package/layers/LinkChartLayer.d.ts +2 -3
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/MapImageLayer.d.ts +2 -4
- package/layers/MapNotesLayer.d.ts +2 -3
- package/layers/MediaLayer.d.ts +3 -4
- package/layers/OGCFeatureLayer.d.ts +2 -3
- package/layers/ParquetLayer.d.ts +2 -3
- package/layers/PointCloudLayer.d.ts +2 -4
- package/layers/RouteLayer.d.ts +2 -3
- package/layers/SceneLayer.d.ts +2 -4
- package/layers/StreamLayer.d.ts +2 -4
- package/layers/SubtypeGroupLayer.d.ts +2 -4
- package/layers/TileLayer.d.ts +2 -4
- package/layers/UnknownLayer.d.ts +2 -3
- package/layers/UnsupportedLayer.d.ts +2 -3
- package/layers/VectorTileLayer.d.ts +2 -4
- package/layers/VideoLayer.d.ts +8 -9
- package/layers/ViewshedLayer.d.ts +2 -3
- package/layers/VoxelLayer.d.ts +2 -4
- package/layers/WCSLayer.d.ts +2 -4
- package/layers/WFSLayer.d.ts +2 -3
- package/layers/WMSLayer.d.ts +5 -6
- package/layers/WMTSLayer.d.ts +4 -5
- package/layers/WebTileLayer.d.ts +2 -3
- package/layers/buildingSublayers/BuildingGroupSublayer.d.ts +1 -1
- package/layers/buildingSublayers/BuildingSublayer.d.ts +3 -3
- package/layers/buildingSublayers/BuildingSublayer.js +1 -1
- package/layers/catalog/CatalogDynamicGroupLayer.d.ts +2 -3
- package/layers/catalog/CatalogFootprintLayer.d.ts +2 -3
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/dehydratedFeatureComparison.js +1 -1
- package/layers/graphics/dehydratedFeatures.js +1 -1
- package/layers/graphics/hydratedFeatures.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphSublayer.d.ts +4 -6
- package/layers/{support/media.d.ts → media/types.d.ts} +9 -9
- package/layers/mixins/ArcGISImageService.d.ts +1 -1
- package/layers/mixins/ImageryTileMixin.d.ts +1 -1
- package/layers/orientedImagery/transformations/rectifyMapPoint.js +1 -1
- package/layers/raster/datasets/wcsCoverageParser.d.ts +1 -1
- package/layers/raster/functions/changeDetectionUtils.js +1 -1
- package/layers/raster/functions/creators/createLocalFunctions.d.ts +1 -1
- package/layers/raster/functions/customBandIndexUtils.js +1 -1
- package/layers/raster/functions/focalStatUtils.js +1 -1
- package/layers/raster/functions/pixelTransformUtils.js +1 -1
- package/layers/raster/functions/types.d.ts +1 -1
- package/layers/{support/RasterTypes.d.ts → raster/types.d.ts} +2 -2
- package/layers/save/featureLayerUtils.js +1 -1
- package/layers/support/ElevationQuery.d.ts +2 -2
- package/layers/support/ElevationSampler.js +1 -1
- package/layers/support/FeatureType.d.ts +2 -2
- package/layers/support/Field.d.ts +2 -3
- package/layers/support/FieldConfiguration.d.ts +1 -1
- package/layers/support/ImageElement.d.ts +3 -3
- package/layers/support/LocalMediaElementSource.d.ts +1 -1
- package/layers/support/MediaElementBase.d.ts +4 -7
- package/layers/support/PixelBlock.d.ts +1 -1
- package/layers/support/RasterFunction.d.ts +1 -1
- package/layers/support/RasterInfo.d.ts +1 -1
- package/layers/support/Sublayer.d.ts +2 -3
- package/layers/support/Subtype.d.ts +2 -2
- package/layers/support/SubtypeSublayer.d.ts +2 -3
- package/layers/support/SubtypeSublayer.js +1 -1
- package/layers/support/VideoElement.d.ts +2 -2
- package/layers/support/WMSSublayer.d.ts +6 -6
- package/layers/support/WMSSublayer.js +1 -1
- package/layers/support/domains.js +1 -1
- package/layers/support/rasterFunctionUtils.d.ts +1 -1
- package/layers/support/tiles3DUtils.js +1 -1
- package/layers/support/types.d.ts +33 -1
- package/layers/types.d.ts +17 -2
- package/layers/wmts/types.d.ts +2 -0
- package/libs/text/loadTextModule.js +5 -0
- package/linkChart/LinkChartProperties.d.ts +4 -6
- package/linkChart/LinkChartProperties.js +1 -1
- package/networks/Network.d.ts +2 -4
- package/networks/support/NamedTraceConfiguration.d.ts +3 -3
- package/networks/support/NamedTraceConfiguration.js +1 -1
- package/networks/support/TopologyValidationJobInfo.js +1 -1
- package/networks/support/TraceJobInfo.js +1 -1
- package/package.json +3 -3
- package/popup/FieldInfo.d.ts +1 -1
- package/renderers/support/RasterSymbolizer.js +1 -1
- package/renderers/support/rendererConversion.js +1 -1
- package/renderers/visualVariables/support/visualVariableUtils.js +1 -1
- package/request/process.js +1 -1
- package/rest/geometryService/types.d.ts +59 -0
- package/rest/geometryService.d.ts +3 -5
- package/rest/query/operations/pbfDehydratedFeatureSet.js +1 -1
- package/rest/query/operations/query.js +1 -1
- package/rest/query/support/AttachmentInfo.d.ts +2 -2
- package/rest/support/AlgorithmicColorRamp.d.ts +2 -2
- package/rest/support/BinParametersBase.d.ts +2 -2
- package/rest/support/BinParametersBase.js +1 -1
- package/rest/support/DateBinTimeInterval.d.ts +1 -1
- package/rest/support/GeneralizeParameters.d.ts +1 -1
- package/rest/support/ImageSampleParameters.d.ts +1 -1
- package/rest/support/JobInfo.js +1 -1
- package/rest/support/PrintTemplate.d.ts +4 -6
- package/rest/support/ServiceAreaParameters.js +1 -1
- package/rest/support/types.d.ts +17 -1
- package/smartMapping/heuristics/sizeRange.js +1 -1
- package/smartMapping/renderers/support/utils.js +1 -1
- package/smartMapping/statistics/support/statsWorker.js +1 -1
- package/smartMapping/statistics/support/utils.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/InMemoryLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/support/histogramUtils.js +1 -1
- package/smartMapping/support/adapters/support/utils.js +1 -1
- package/smartMapping/support/utils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/WebStyleSymbol.d.ts +0 -24
- package/symbols/WebStyleSymbol.js +1 -1
- package/symbols/support/ElevationInfo.d.ts +2 -2
- package/symbols/support/IconSymbol3DLayerResource.d.ts +1 -1
- package/symbols/support/defaults.js +1 -1
- package/symbols/support/defaults3D.js +1 -1
- package/symbols/support/previewSymbol3D.js +1 -1
- package/symbols/support/symbolLayerUtils3D.js +1 -1
- package/symbols/support/symbolUtils.js +1 -1
- package/symbols/support/utils.js +1 -1
- package/views/2d/analysis/ElevationProfile/ElevationProfileLineVisualization2D.js +1 -1
- package/views/2d/analysis/ElevationProfileAnalysisView2D.d.ts +16 -11
- package/views/2d/analysis/ElevationProfileAnalysisView2D.js +1 -1
- package/views/2d/engine/imagery/RasterVFDisplayObject.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTile.js +1 -1
- package/views/2d/engine/vectorTiles/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
- package/views/2d/engine/webgl/GlyphSDFCreator.js +5 -0
- package/views/2d/engine/webgl/GlyphSource.js +1 -1
- package/views/2d/engine/webgl/TextureManager.js +1 -1
- package/views/2d/engine/webgl/TextureUploadManager.js +1 -1
- package/views/2d/engine/webgl/definitions.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/constants.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/input/handlers/DoubleTapDragZoom.js +1 -1
- package/views/2d/input/handlers/KeyZoom.js +1 -1
- package/views/2d/layers/BaseLayerView2D.d.ts +3 -6
- package/views/2d/layers/BaseLayerViewGL2D.d.ts +3 -6
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/utils.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
- package/views/3d/analysis/ElevationProfile/ElevationProfileLineVisualization3D.js +1 -1
- package/views/3d/analysis/ElevationProfileAnalysisView3D.d.ts +16 -11
- package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementTool.js +1 -1
- package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
- package/views/3d/camera/constraintUtils/tilt.js +1 -1
- package/views/3d/environment/CloudsParameters.js +1 -1
- package/views/3d/environment/CloudsRenderer.js +1 -1
- package/views/3d/environment/SceneViewEnvironment.js +1 -1
- package/views/3d/glTF/internal/Resource.js +1 -1
- package/views/3d/glTF/internal/fillDefaults.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
- package/views/3d/interactive/editingTools/isSupportedObjectUtils.js +1 -1
- package/views/3d/interactive/editingTools/move/isSupportedObject.js +1 -1
- package/views/3d/interactive/editingTools/transform/isSupportedGraphic.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/LabelInfo.js +1 -1
- package/views/3d/layers/graphics/defaultSymbolComplexity.js +1 -1
- package/views/3d/layers/graphics/lineUtils.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/primitiveObjectUtils.js +1 -1
- package/views/3d/layers/graphics/primitiveObjectSymbolUtils.js +1 -1
- package/views/3d/layers/i3s/BuildingFilterUtil.js +1 -1
- package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
- package/views/3d/layers/i3s/I3SNode.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/PointCloudWorkerUtil.js +1 -1
- package/views/3d/layers/i3s/SphereCone.js +5 -0
- package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
- package/views/3d/layers/support/edgeUtils.js +1 -1
- package/views/3d/layers/support/featureReference.js +1 -1
- package/views/3d/layers/support/featureTileQuery3D.js +1 -1
- package/views/3d/layers/support/patternUtils.js +1 -1
- package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/support/FrustumExtentIntersection.js +1 -1
- package/views/3d/support/buffer/glUtil.js +1 -1
- package/views/3d/support/engineContent/sdfPrimitives.js +1 -1
- package/views/3d/support/viewpointUtils.js +1 -1
- package/views/3d/terrain/isTerrainSurfaceLayer.js +1 -1
- package/views/3d/webgl/RenderNode.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +8 -8
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js +4 -4
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexNormal.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeFragmentNormals.glsl.js +6 -6
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/Normals.glsl.js +5 -5
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/TileBackground.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/util/BlendModes.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeProcessingWorker.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeWorkerHandle.js +1 -1
- package/views/3d/webgl-engine/materials/lineStippleUtils.js +1 -1
- package/views/3d/webgl-engine/shaders/CompositingTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/LineAmplitude.glsl.js +4 -4
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/LineOffset.glsl.js +8 -8
- package/views/VideoView.d.ts +2 -3
- package/views/VideoView.js +1 -1
- package/views/View2D.d.ts +2 -3
- package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileIndicatorPointVisualization.js +5 -0
- package/views/analysis/ElevationProfile/ElevationProfileLineComputation.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileResult.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
- package/views/analysis/ElevationProfile/constants.js +1 -1
- package/views/draw/Draw.js +1 -1
- package/views/input/ViewEvents.js +1 -1
- package/views/interactive/editGeometry/EditGeometry.js +1 -1
- package/views/interactive/snapping/featureSources/snappingCandidateElevationAlignment.js +1 -1
- package/views/interactive/snapping/featureSources/snappingCandidateElevationFilter.js +1 -1
- package/views/interactive/snapping/featureSources/symbologySnappingCandidates.js +1 -1
- package/views/layers/MediaLayerViewMixin.d.ts +1 -1
- package/views/support/PromiseQueue.js +1 -1
- package/views/support/screenUtils.js +1 -1
- package/views/support/screenshotUtils.js +1 -1
- package/views/types.d.ts +1 -1
- package/views/webgl/FramebufferObject.js +1 -1
- package/views/webgl/Uniform.js +1 -1
- package/views/webgl/Util.js +1 -1
- package/webdoc/applicationProperties/SearchLayerField.d.ts +1 -1
- package/webdoc/applicationProperties/SearchTableField.d.ts +1 -1
- package/webscene/Slide.d.ts +2 -2
- package/webscene/spec-certification/api.js +1 -1
- package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
- package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +1 -1
- package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
- package/widgets/BatchAttributeForm/templates/support/hashElementTemplate.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Editor/components/PendingFeatureList.js +1 -1
- package/widgets/Editor/components/workflowAdapters/pendingFeatureList/{CreateFeaturesWorkflowPendingFeatureListAdapter.ts.js → CreateFeaturesWorkflowPendingFeatureListAdapter.js} +1 -1
- package/widgets/Editor/types.d.ts +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Feature.d.ts +3 -5
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/FieldInput.d.ts +2 -2
- package/widgets/FeatureForm/featureFormUtils.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTemplates/FeatureTemplatesViewModel.d.ts +1 -1
- package/widgets/FeatureTemplates/TemplateItem.d.ts +1 -1
- package/widgets/FeatureTemplates/types.d.ts +1 -1
- package/widgets/Features.d.ts +3 -5
- package/widgets/Print/CustomTemplate.d.ts +3 -4
- package/widgets/Print/TemplateOptions.d.ts +3 -4
- package/widgets/Print/types.d.ts +3 -4
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/widgets/Sketch/support/OperationHandle.js +1 -1
- package/widgets/TimeSlider.js +1 -1
- package/widgets/VideoPlayer/VideoPlayerViewModel.d.ts +1 -1
- package/widgets/support/SelectionList/GroupLayerItem.js +1 -1
- package/widgets/support/dateUtils.js +1 -1
- package/assets/esri/core/workers/chunks/0099f4729c94c779ba35.js +0 -1
- package/assets/esri/core/workers/chunks/058fb2cd6387acfd458c.js +0 -1
- package/assets/esri/core/workers/chunks/0ae018098906d6a88904.js +0 -1
- package/assets/esri/core/workers/chunks/0dc3a04ce717b7ddd957.js +0 -1
- package/assets/esri/core/workers/chunks/0e5cd0cf6ab7cb37d723.js +0 -1
- package/assets/esri/core/workers/chunks/0ee407b8db5c07a00d82.js +0 -1
- package/assets/esri/core/workers/chunks/10373885604655f673df.js +0 -1
- package/assets/esri/core/workers/chunks/13d61d34e55c80e4ecdf.js +0 -1
- package/assets/esri/core/workers/chunks/17dea03fc4eb414f0022.js +0 -1
- package/assets/esri/core/workers/chunks/1967239713b58dccfd81.js +0 -1
- package/assets/esri/core/workers/chunks/1ab98591d2f2bc604505.js +0 -1
- package/assets/esri/core/workers/chunks/1b838638e66e82d76cf3.js +0 -1
- package/assets/esri/core/workers/chunks/1c350a2c4014146dbcd9.js +0 -1
- package/assets/esri/core/workers/chunks/2266a8f2c2ec37c19bb4.js +0 -1
- package/assets/esri/core/workers/chunks/226acd251ad7d7ee3b57.js +0 -1
- package/assets/esri/core/workers/chunks/22b07c54a5fcc27771b0.js +0 -1
- package/assets/esri/core/workers/chunks/22ca80f491e070b2a5e7.js +0 -1
- package/assets/esri/core/workers/chunks/22dd5cecc7e2d4d0baf8.js +0 -316
- package/assets/esri/core/workers/chunks/2402d305a77fef4694a0.js +0 -1
- package/assets/esri/core/workers/chunks/27f096c434f049b8df01.js +0 -1
- package/assets/esri/core/workers/chunks/2a6231db5ee6cbfd59a5.js +0 -1
- package/assets/esri/core/workers/chunks/3371935a4fd6346d3a17.js +0 -1
- package/assets/esri/core/workers/chunks/3c4f8597f602779174f1.js +0 -1
- package/assets/esri/core/workers/chunks/3da53c017f9c5d2d778a.js +0 -1
- package/assets/esri/core/workers/chunks/45b898367b6224dda46f.js +0 -1
- package/assets/esri/core/workers/chunks/4785cd108e2dec6e1697.js +0 -1
- package/assets/esri/core/workers/chunks/4d6d962d25aa836f53ee.js +0 -1
- package/assets/esri/core/workers/chunks/4f33a2ecb154a2c2449c.js +0 -1
- package/assets/esri/core/workers/chunks/52726458f590e726d52c.js +0 -1
- package/assets/esri/core/workers/chunks/536c492fdda30f2f1288.js +0 -1
- package/assets/esri/core/workers/chunks/5909a0e763fddc3542e7.js +0 -2
- package/assets/esri/core/workers/chunks/5cee6c3ff23fb93f857a.js +0 -1
- package/assets/esri/core/workers/chunks/600e2e6b51e2fb9c598c.js +0 -1
- package/assets/esri/core/workers/chunks/6035daa65fc3ebf86515.js +0 -1
- package/assets/esri/core/workers/chunks/63b8cd7d5cafbaeed894.js +0 -1
- package/assets/esri/core/workers/chunks/6cb44cd319cb6c2539c8.js +0 -1
- package/assets/esri/core/workers/chunks/7033fa18b7dd7bd3e49c.js +0 -1
- package/assets/esri/core/workers/chunks/7306b5b66e738a281d83.js +0 -1
- package/assets/esri/core/workers/chunks/7694abe44d55dae8872d.js +0 -1
- package/assets/esri/core/workers/chunks/7f4fa2f2e85863d3cfb9.js +0 -1
- package/assets/esri/core/workers/chunks/8f4c480c418eba299c2b.js +0 -1
- package/assets/esri/core/workers/chunks/964de713042f52d71e42.js +0 -1
- package/assets/esri/core/workers/chunks/a3836f6a93924ee4816e.js +0 -1
- package/assets/esri/core/workers/chunks/ab520fd1ae917daf07d8.js +0 -1
- package/assets/esri/core/workers/chunks/acc7ff44bfcb5c195114.js +0 -1
- package/assets/esri/core/workers/chunks/ad92427bf597a6e0a299.js +0 -1
- package/assets/esri/core/workers/chunks/b25a131c04092c3ab75d.js +0 -1
- package/assets/esri/core/workers/chunks/b285de471ca90f38ec25.js +0 -1
- package/assets/esri/core/workers/chunks/b8f83a272fc41765031d.js +0 -1
- package/assets/esri/core/workers/chunks/b9909264cfea68d5f2a1.js +0 -1
- package/assets/esri/core/workers/chunks/bb08359610a41e304b55.js +0 -1
- package/assets/esri/core/workers/chunks/bcf612eabe7577540953.js +0 -1
- package/assets/esri/core/workers/chunks/bfbbcaa1fb04f17fc869.js +0 -1
- package/assets/esri/core/workers/chunks/c02b09f16241db233103.js +0 -1
- package/assets/esri/core/workers/chunks/c3007b916ba933137709.js +0 -1
- package/assets/esri/core/workers/chunks/cc5c1887e6d7079e5fe3.js +0 -1
- package/assets/esri/core/workers/chunks/ce8f075c814a8378c00c.js +0 -1
- package/assets/esri/core/workers/chunks/cfe1506a443fc84a0b91.js +0 -1
- package/assets/esri/core/workers/chunks/d30cfc5fa302cc08d862.js +0 -1
- package/assets/esri/core/workers/chunks/d723619579cc8f5ef2cd.js +0 -1
- package/assets/esri/core/workers/chunks/da99fd0d3106dd357743.js +0 -1
- package/assets/esri/core/workers/chunks/de71db3b0fb947b13c97.js +0 -1
- package/assets/esri/core/workers/chunks/dfbbead4c24d13682891.js +0 -1
- package/assets/esri/core/workers/chunks/e69255e38ff200dda14b.js +0 -1
- package/assets/esri/core/workers/chunks/e705d041f6c1632bfbcc.js +0 -1
- package/assets/esri/core/workers/chunks/e85da52d9cc7d9396872.js +0 -1
- package/assets/esri/core/workers/chunks/ee186ddbb1eb5144a790.js +0 -1
- package/assets/esri/core/workers/chunks/f9370830051865a3435b.js +0 -1
- package/core/MultiOriginJSONSupport.d.ts +0 -13
- package/core/NumericIdentifiable.d.ts +0 -6
- package/core/ReadOnlyMultiOriginJSONSupport.d.ts +0 -6
- package/core/WriteableMultiOriginJSONMixin.d.ts +0 -6
- package/layers/knowledgeGraph/KnowledgeGraphSublayerBase.d.ts +0 -6
- package/layers/mixins/ArcGISService.d.ts +0 -6
- package/layers/mixins/RasterJobHandlerMixin.d.ts +0 -6
- package/layers/support/RasterFunctionProperties.d.ts +0 -2
- package/layers/support/domains.d.ts +0 -5
- package/layers/support/editableLayers.d.ts +0 -11
- package/layers/support/exifUtils.d.ts +0 -21
- package/layers/support/fieldFormatUtils.d.ts +0 -4
- package/layers/support/fieldType.d.ts +0 -2
- package/layers/support/layerUtils.d.ts +0 -4
- package/layers/support/wmtsUtils.d.ts +0 -2
- package/layers/video/videoUtils.d.ts +0 -5
- package/rest/geometryService/cut.d.ts +0 -7
- package/rest/geometryService/fromGeoCoordinateString.d.ts +0 -28
- package/rest/geometryService/toGeoCoordinateString.d.ts +0 -25
- package/rest/operations/generalize.d.ts +0 -3
- package/rest/support/DateBinUtils.d.ts +0 -2
- package/rest/support/colorRamps.d.ts +0 -6
- package/rest/support/fileFormat.d.ts +0 -4
- package/rest/support/layoutTemplate.d.ts +0 -2
- package/rest/support/reportTemplate.d.ts +0 -2
- package/views/2d/layers/LayerView2D.d.ts +0 -6
- package/views/Viewport2DBaseMixin.d.ts +0 -6
- package/views/analysis/ElevationProfile/ElevationProfileHoveredPointVisualization.js +0 -5
- package/views/layers/RefreshableLayerView.d.ts +0 -6
- package/widgets/Feature/support/FeatureContentMixin.d.ts +0 -6
- /package/layers/video/{IVideoController.d.ts → types.d.ts} +0 -0
- /package/layers/{support/wmsUtils.d.ts → wms/types.d.ts} +0 -0
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import i from"../../../request.js";import{isSome as r}from"../../../core/arrayUtils.js";import{result as s,forEach as o}from"../../../core/asyncUtils.js";import"../../../core/has.js";import n from"../../../core/Logger.js";import{destroyMaybe as a,abortMaybe as d}from"../../../core/maybe.js";import{estimateNumberArrayMemory as l,baseObjectMemory as u,estimateNumberMemory as h,estimateFixedArrayMemory as p,baseArrayMemory as c}from"../../../core/memoryEstimations.js";import{isAbortError as _,allSettledValues as m,throwIfAborted as g}from"../../../core/promiseUtils.js";import{initial as f,watch as y,sync as b,syncAndInitial as w}from"../../../core/reactiveUtils.js";import{pt2px as P}from"../../../core/screenUtils.js";import{isArrayBuffer as N}from"../../../core/typedArrayUtil.js";import{property as v,subclass as x}from"../../../core/accessorSupport/decorators.js";import{b as C,i as S,g as I,d as A}from"../../../chunks/vec32.js";import{clone as j}from"../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{fromValues as R}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import k from"../../../geometry/Extent.js";import V from"../../../geometry/Point.js";import{projectBoundingSphere as Q}from"../../../geometry/projection/projectBoundingSphere.js";import{projectVectorToVector as F}from"../../../geometry/projection/projectVectorToVector.js";import{create as E,fromMinMax as O}from"../../../geometry/support/aaBoundingBox.js";import{fromNormalAndOffset as D,create as L}from"../../../geometry/support/plane.js";import{Sphere as U}from"../../../geometry/support/sphere.js";import W from"../../../layers/graphics/OptimizedGeometry.js";import{QueryEngine as G}from"../../../layers/graphics/data/QueryEngine.js";import M from"../../../layers/support/CodedValue.js";import q from"../../../layers/support/CodedValueDomain.js";import"../../../layers/support/Domain.js";import"../../../layers/support/InheritedDomain.js";import"../../../layers/support/RangeDomain.js";import{unpackFieldNames as z}from"../../../layers/support/fieldUtils.js";import{queueAutoPriority as H}from"../../../request/queue.js";import T from"../../../rest/support/FeatureSet.js";import B from"../../../rest/support/Query.js";import{getElevationOffset as $}from"../../../support/elevationInfoUtils.js";import{LayerView3D as J}from"./LayerView3D.js";import{PointCloudLayerViewPerformanceInfo as K,QueuePerformanceInfo as Z}from"./PointCloudLayerViewPerformanceInfo.js";import{PointCloudWorkerHandle as Y}from"./PointCloudWorkerHandle.js";import{I3SQueryFeatureStore as X}from"./i3s/I3SQueryFeatureStore.js";import{checkPointCloudLayerValid as ee,checkPointCloudLayerCompatibleWithView as te}from"./i3s/I3SUtil.js";import{nodeDiff as ie,sortFrontToBack as re,splitWorkEntries as se}from"./i3s/LoDUtil.js";import{PagedNodeIndex as oe}from"./i3s/PagedNodeIndex.js";import{PointCloudGraphic as ne}from"./i3s/PointCloudGraphic.js";import{PointCloudRenderer as ae}from"./i3s/PointCloudRenderer.js";import{isPointRendererNode as de,PointCloudRendererNode as le}from"./i3s/PointCloudRendererNode.js";import{getSplatSizeAlgorithm as ue,getFixedSizeAlgorithm as he,getRendererInfo as pe,getFilterInfo as ce,rendererUsesFixedSizes as _e,getAttributeInfo as me}from"./i3s/PointCloudRendererUtil.js";import{getAttributeValues as ge,readGeometry as fe,elevationFromPositions as ye}from"./i3s/PointCloudWorkerUtil.js";import{normalizeHighlightTarget as be,emptyHighlightHandle as we}from"./support/highlightUtils.js";import{PopupSceneLayerView as Pe}from"./support/PopupSceneLayerView.js";import{projectToBoundingBox as Ne}from"../support/extentUtils.js";import{computeMapPointFromVec3d as ve}from"../support/hitTest.js";import{Obb as xe}from"../support/orientedBoundingBox.js";import{updatingProgress as Ce}from"../support/updatingProperties.js";import Se from"../../layers/LayerView.js";import{PointCloudLayerViewMixin as Ie}from"../../layers/PointCloudLayerView.js";import{getHighlightName as Ae}from"../../support/highlightOptionsUtils.js";import{isInEffectiveScaleRange as je}from"../../support/layerViewUtils.js";import{PromiseQueue as Re}from"../../support/PromiseQueue.js";import{TaskPriority as ke}from"../../support/Scheduler.js";const Ve=8,Qe=L();let Fe=class extends(Ie(Pe(J(Se)))){constructor(){super(...arguments),this.type="point-cloud-3d",this.maximumPointCount=4e6,this.slicePlaneEnabled=!1,this._renderer=null,this._rendererAdded=!1,this._renderedNodes=new Set,this._updateViewNeeded=!0,this._lodFactor=1,this._maxLoggedBoxWarnings=5,this._pageMultiplier=1,this._nodeLoadEpoch=0,this._indexQueue=[],this._workQueue=new Array,this._idleQueue=new Re,this._loadingPages=new Map,this._loadingNodes=new Map,this._recalcWork=!0,this._layerIsVisible=!1,this._codedDomainPopulationPromise=null,this._codedDomainPopulationAbortController=null,this._totalWork=0,this._index=null,this._loadingInitNodePage=!1,this._nodeIdArray=[],this.ignoresMemoryFactor=!1}get baseUrl(){return this.layer.parsedUrl?.path??""}get pointScale(){const e=ue(this.layer?.renderer),t=1;return null!=e?.scaleFactor?e.scaleFactor:t}get useRealWorldSymbolSizes(){const e=he(this.layer?.renderer),t=!1;return null!=e?.useRealWorldSymbolSizes?e.useRealWorldSymbolSizes:t}get pointSize(){const e=he(this.layer?.renderer),t=0;return null!=e?.size?e.size:t}get inverseDensity(){const e=96;return this.layer?.renderer?1*e/this.layer.renderer.pointsPerInch:5}get availableFields(){const e=pe(this.layer),t=new Set;e.primaryAttribute&&t.add(e.primaryAttribute.name),e.modulationAttribute&&t.add(e.modulationAttribute.name);const i=ce(this.layer);if(i)for(const r of i)r.attributeInfo&&t.add(r.attributeInfo.name);if(this.layer.outFields)for(const r of z(this.layer.fieldsIndex,this.layer.outFields))t.add(r);return Array.from(t)}get _clippingBox(){if(!this.view||!this.view.clippingArea)return null;const e=E(),t=this.view.renderSpatialReference;return Ne(this.view.clippingArea,e,t)?e:null}get _elevationOffset(){const e=this.layer&&this.layer.elevationInfo;return"absolute-height"===e?.mode?$(e,this.layer.spatialReference):0}get _graphicOrigin(){return this.layer.graphicOrigin}initialize(){const e=this.view.resourceController,t=Ue(e);this._worker=new Y(t),this.addResolvingPromise(this._worker.promise),this.addResolvingPromise(this.layer.rootPagePromise),ee(this.layer),te(this.layer,this.view),this._initRenderer();const i=this._initNodePages(),r=this.view.resourceController.memoryController;this._memCache=r.newCache(`pcl-${this.layer.uid}`),this._queryFeaturesCache=r.newCache(`pcl-query-features-${this.layer.uid};`),this._updatingHandles.add(()=>this._clippingBox,()=>this._setUpdateViewNeeded(),f),this._updatingHandles.add(()=>this._elevationOffset,()=>this._elevationOffsetChanged(),f),this._updatingHandles.add(()=>this.layer.renderer,()=>this._rendererChanged(),f),this._updatingHandles.add(()=>this.layer.filters,()=>this._reload(),f),this._updatingHandles.add(()=>this.layer.outFields,()=>this._reload(),f),this._updatingHandles.add(()=>this.layer.effectiveScaleRange,()=>this._setUpdateViewNeeded()),this._updatingHandles.add(()=>this.view.state.contentCamera,()=>this._setUpdateViewNeeded()),this.addHandles([y(()=>this.view.quality,()=>this._setUpdateViewNeeded(),b)]),this.addResolvingPromise(i),this.when(()=>{this.addHandles([e.scheduler.registerTask(ke.POINT_CLOUD_LAYER,this),y(()=>2===this.view.state.mode,()=>this._setUpdateViewNeeded(),w),this._updatingHandles.add(()=>this.suspended,e=>{e?this._clearNodeState():this._setUpdateViewNeeded()},f)])},()=>{this._updatingHandles.removeAll(),this.removeAllHandles()})}_setUpdateViewNeeded(){this._updateViewNeeded=!0,this._updateLoading()}destroy(){this.cancelLoading(),this._worker=a(this._worker),this._destroyRenderer(),this._memCache=a(this._memCache),this._queryFeaturesCache=a(this._queryFeaturesCache),this._queryEngine=a(this._queryEngine),this._codedDomainPopulationAbortController=d(this._codedDomainPopulationAbortController),this._codedDomainPopulationPromise=null}_initRenderer(){this._renderer=new ae({createGraphic:(e,t,i)=>this._createGraphic(e,t,i)}),this._renderer.layerViewUid=this.uid,this._updatingHandles.add(()=>this._clippingBox,e=>this._renderer.clippingBox=e,f),this._updatingHandles.add(()=>this.suspended,e=>this._setPointsVisible(!e),f),this._updatingHandles.add(()=>this.pointScale,e=>this._renderer.scaleFactor=e,f),this._renderer.minSizePx=Math.sqrt(2),this._updatingHandles.add(()=>this.useRealWorldSymbolSizes,e=>this._renderer.useRealWorldSymbolSizes=e,f),this._updatingHandles.add(()=>this.pointSize,e=>{const t=P(e);this._renderer.size=e,this._renderer.sizePx=t},f),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._renderer.slicePlaneEnabled=e,f),this._updatingHandles.add(()=>this.inverseDensity,()=>this._setUpdateViewNeeded(),f),this._updatingHandles.add(()=>this.maximumPointCount,()=>this._setUpdateViewNeeded(),f),this._updatingHandles.add(()=>this.view.qualitySettings.sceneService.pointCloudLoDFactor,e=>{this._lodFactor=e,this._setUpdateViewNeeded()},f)}_destroyRenderer(){this._renderer.removeAll(),this._setPointsVisible(!1)}_createGraphic(e,t,i,r){const s=null!=e.pointIdFilterMap?e.pointIdFilterMap[t]:t,o=i?"declaredClass"in i?i:ve(this.view,i):null;return r??=this._createGraphicAttributes(e,s),new ne({pointCloudMetadata:{nodeId:e.id,pointIndexInNode:t,attributePointIndexInNode:s,epoch:this._nodeLoadEpoch},geometry:o,attributes:r,layer:this.layer,sourceLayer:this.layer,origin:this._graphicOrigin})}_createGraphicAttributes(e,t){const i={};for(const r of e.attributes)this._encodeGraphicAttribute(r.attributeInfo,r.values,t,i);return i}_getGraphicAttribute(e,t,i){const r=e.storageInfo?.attributeValues,s=r?.valuesPerElement??1;if(1===s)return t[i];if("UInt8"===r?.valueType&&s<=4){let e=0;const r=i*s;for(let i=r;i<r+s;i++)e=(e<<8)+t[i];return e}}_encodeGraphicAttribute(e,t,i,r){r[e.name]=this._getGraphicAttribute(e,t,i)}_setPointsVisible(e){e&&!this._rendererAdded?(this.view.stage.addRenderPlugin(this._renderer),this._rendererAdded=!0):!e&&this._rendererAdded&&(this.view.stage.removeRenderPlugin(this._renderer),this._rendererAdded=!1)}_rendererChanged(){this._renderer.useFixedSizes=_e(this.layer.renderer),this._reload()}_reload(){this._clearNodeState(),this._memCache.clear(),this._setUpdateViewNeeded()}_elevationOffsetChanged(){this._clearNodeState(),this._memCache.clear(),this._initNodePages()}_displayNodes(e){this._workQueue=ie([...this._renderedNodes],e,this._index),re(this._workQueue,this.view.state.contentCamera.viewForward,this._index),se(this._workQueue,Ve,this._index),this._updateQueues(),this._totalWork=this._computeWork(),this._updateLoading(),this._layerIsVisible=e.length>0||this._loadingInitNodePage,this.notifyChange("suspended")}cancelLoading(){this._cancelNodeLoading(),this._cancelIndexLoading()}_cancelNodeLoading(){[...this._loadingNodes.values()].forEach(e=>e.abort()),this._workQueue=[],this._idleQueue.cancelAll(),this._totalWork=this._computeWork(),this._updateLoading()}_updateQueues(){const e=new Set;this._workQueue.forEach(t=>t.load.forEach(t=>e.add(t)));const t=new Array;this._loadingNodes.forEach((i,r)=>{e.has(r)||(this._loadingNodes.delete(r),t.push(i))}),t.forEach(e=>e.abort()),this._workQueue=this._workQueue.filter(e=>{for(const t of e.load)if(this._loadingNodes.has(t))return this._recalcWork=!0,!1;return!0}),this._totalWork=this._computeWork(),this._updateLoading()}_cancelIndexLoading(){this._indexQueue=[],this._loadingPages.forEach(e=>e.abort()),this._loadingPages.clear(),this._totalWork=this._computeWork(),this._updateLoading()}_clearNodeState(){this._nodeLoadEpoch++,this._renderedNodes.forEach(e=>this._removeFromRenderer(e)),this._cancelNodeLoading()}get readyToRun(){return this.suspended?this._updateViewNeeded:this._updateViewNeeded||this._indexQueue.length>0||this._workQueue.length>0||this._idleQueue.readyToRun}runTask(e){if(this.suspended){if(this._updateViewNeeded){this._updateViewNeeded=!1;const e=this._isRootNodeVisible();e!==this._layerIsVisible&&(this._layerIsVisible=e,this.notifyChange("suspended")),this._updateLoading()}}else{for(e.run(()=>this._updateWorkQueues());this._indexQueue.length>0&&!e.done;)this._processIndexQueue(),e.madeProgress();this._processWorkQueue(e),this._idleQueue.runTask(e)}}async _processIndexQueue(){const e=this._indexQueue.shift(),t=new AbortController;this._loadingPages.set(e,t);try{const i=await this._loadNodePage(e,t.signal);this._index.addPage(e,i,this._elevationOffset),this._setUpdateViewNeeded(),this._loadingPages.delete(e)}catch(i){this._loadingPages.get(e)===t&&this._loadingPages.delete(e)}}_processWorkQueue(e){for(;!e.done;){const t=this._scheduleWorkEntry();if(null==t)return void e.madeProgress();this._processWorkEntry(t),e.madeProgress()}}_scheduleWorkEntry(){let e=this._workQueue.length;for(;e--;){const e=this._workQueue.shift();if(!e.remove.find(e=>!this._renderedNodes.has(e)))return e;this._workQueue.push(e)}return null}async _processWorkEntry(e){if(0===e.load.length){for(const t of e.remove)this._removeFromRenderer(t);return}const t=e.load.map(e=>{const t=new AbortController;return this._loadingNodes.set(e,t),t});this._updateLoading();try{const i=await Promise.all(e.load.map((e,i)=>this._memCache.pop(`${e}`)??this._loadNode(e,t[i].signal)));for(let t=0;t<e.load.length;t++)if(i[t]){const r=this._setupRendererData(e.load[t],i[t]);this._addToRenderer(r)}for(const t of e.remove)this._removeFromRenderer(t);for(const t of e.load)this._loadingNodes.delete(t)}catch(i){e.load.forEach((e,i)=>{this._loadingNodes.get(e)===t[i]&&this._loadingNodes.delete(e)})}this._updateLoading(),this._recalcWork&&!this._idleQueue.updating&&0===this._indexQueue.length&&0===this._loadingNodes.size&&(this._recalcWork=!1,this._setUpdateViewNeeded())}async _populateClassCodeCodedDomain(e,t){const i="CLASS_CODE",r=this.layer.fieldsIndex.get(i);if(!r||r.domain)return;if(!e.includes(r.name))return;const o=await s(this.layer.queryCachedStatistics(i,{signal:t}));if(!1===o.ok)return;const n=o.value?.stats?.labels?.labels;n&&Array.isArray(n)&&(r.domain=new q({name:"CLASS_CODE",codedValues:n.map(e=>new M({code:e.value,name:e.label}))}))}async prepareFetchPopupFeatures(e){return this._codedDomainPopulationPromise||(this._codedDomainPopulationAbortController=new AbortController,this._codedDomainPopulationPromise=this._populateClassCodeCodedDomain(e,this._codedDomainPopulationAbortController.signal).then(()=>{this._codedDomainPopulationAbortController=null})),this._codedDomainPopulationPromise}async whenGraphicAttributes(e,t){const i=this._splitGraphicsPerNode(e),s=this.layer.attributeStorageInfo,n=t.map(e=>me(s,e)).filter(r),a=async(e,t)=>{const i=this._index.getNode(t);await o(n,async t=>{const r=t.useElevation?await this._loadElevationAttributeFromGeometry(i.resourceId):await this._loadAndParseAttribute(i,t);if(r)for(const i of e)if(this._isValidPointGraphic(i)){const e=i.pointCloudMetadata.attributePointIndexInNode;this._encodeGraphicAttribute(t,r,e,i.attributes)}})},d=[];return i.forEach((e,t)=>{d.push(a(e,t))}),await Promise.allSettled(d),e}_isValidPointGraphic(e){return e instanceof ne&&e.pointCloudMetadata?.epoch===this._nodeLoadEpoch}_splitGraphicsPerNode(e){const t=new Map;for(const i of e){if(!this._isValidPointGraphic(i))continue;const e=i.pointCloudMetadata,r=t.get(e.nodeId);r?r.push(i):t.set(e.nodeId,[i])}return t}async _loadAndParseAttribute(e,t){const i=await this._loadAttribute(e.resourceId,t,null);return i?ge({attributeInfo:t,buffer:i},null,e.vertexCount):null}async _loadElevationAttributeFromGeometry(e){const t=this.layer.store.defaultGeometrySchema,i=fe(t,await this._loadGeometry(e,null));return ye(i,i.length/3)}highlight(e,i){const r=be(e);if(0===r.length)return we;if(!(r[0]instanceof t))return we;const s=r;return this._renderer.highlight(s.map(e=>this._graphicToPointDefinition(e)),Ae(i))}_graphicToPointDefinition(e){if(!this._isValidPointGraphic(e))return null;const{nodeId:t,pointIndexInNode:i}=e.pointCloudMetadata;return null!=t&&null!=i?{nodeId:t,pointId:i}:null}_computeWork(){let e=0;for(const t of this._workQueue)e+=t.load.length+t.remove.length;return e+=this._loadingNodes.size,e+=(this._indexQueue.length+this._loadingPages.size)*this._index.pageSize,e+=this._loadingInitNodePage?100:0,e+=this._updateViewNeeded?100:0,e}get updatingProgressValue(){if(this.suspended)return this._updateViewNeeded?0:1;const e=this._computeWork();return 1-Math.min(this._totalWork,e)/this._totalWork}_updateLoading(){this.notifyChange("updating"),this.notifyChange("updatingProgressValue")}canResume(){return super.canResume()&&this._layerIsVisible}isUpdating(){return this.suspended?this._updateViewNeeded:this._computeWork()>0}get visibleAtCurrentScale(){return je(this.layer.effectiveScaleRange,this.view.scale)}async queryFeatures(e,i){const r=await this._ensureQueryEngine().executeQuery(this._ensureQueryJSON(e),i?.signal),s=r.features;r.features=[];const o=T.fromJSON(r),n=this.view.spatialReference;return o.features=s.map(e=>{const{attributes:i,metadata:r}=e;if(!r){const i=t.fromJSON(e);return i.geometry&&(i.geometry.spatialReference=o.spatialReference??n),i.layer=this.layer,i.sourceLayer=this.layer,i.origin=this._graphicOrigin,i}const s=e.geometry?V.fromJSON(e.geometry):void 0;return s&&(s.spatialReference=o.spatialReference??n),this._createGraphic(r.node,r.pointId,s,i)}),o}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference,returnZ:!0};return new B(e)}async queryFeatureCount(e,t){return await this._ensureQueryEngine().executeQueryForCount(this._ensureQueryJSON(e),t?.signal)}async queryExtent(e,t){const{count:i,extent:r}=await this._ensureQueryEngine().executeQueryForExtent(this._ensureQueryJSON(e),t?.signal);return{count:i,extent:k.fromJSON(r)}}_ensureQueryJSON(e){return null==e?new B({outSpatialReference:this.view.spatialReference}).toJSON():B.from(e).toJSON()}_ensureQueryEngine(){if(this._queryEngine)return this._queryEngine;const{spatialReference:e}=this.view;return this._queryEngine=new G({fieldsIndex:this.layer.fieldsIndex.toJSON(),geometryType:"esriGeometryPoint",spatialReference:e,featureIdInfo:{type:"object-id",fieldName:"objectId"},hasZ:!0,featureStore:new X({sourceSpatialReference:e,viewSpatialReference:e,forAllFeatures:(e,t)=>{this._renderer.forEachNode(i=>{if(t){const e=i.obb,r=new U(e.center,C(e.halfSize));Q(r,this.view.renderSpatialReference,r,this.view.spatialReference);if(1===t(r))return}let r=this._queryFeaturesCache.get(`${i.id}`);r||(r=this._createQueryPointFeatures(i),this._queryFeaturesCache.put(`${i.id}`,r)),r.features.forEach(e)})},getFeatureExtent:({point:e},t)=>O(e,e,t),featureAdapter:{cloneWithGeometry:(e,t,i)=>new Oe(e.node,e.pointId,t.coords),getAttribute:({node:e,attributePointId:t},i)=>{for(const r of e.attributes)if(r.attributeInfo.name===i)return this._getGraphicAttribute(r.attributeInfo,r.values,t)},getAttributes:({node:e,attributePointId:t})=>this._createGraphicAttributes(e,t),getCentroid:e=>e.getGeometry(),getGeometry:e=>e.getGeometry(),getObjectId:()=>{},getMetadata:e=>e}})}),this._queryEngine}_createQueryPointFeatures(e){const t=e.coordinates,i=new Array;for(let r=0;r<t.length/3;r++){const s=3*r,o=R(t[s+0],t[s+1],t[s+2]);S(o,o,e.origin),F(o,this.view.renderSpatialReference,o,this.view.spatialReference);const n=new Oe(e,r,o);i.push(n)}return new De(i)}async _initNodePages(){const e=this.layer.store.index,t=e.nodesPerPage||e.nodePerIndexBlock;this._index=new oe(this.layer.spatialReference,this.view.renderCoordsHelper.spatialReference,t),this._cancelIndexLoading(),this._traverseVisible=this._index.createVisibilityTraverse(),this._loadingInitNodePage=!0,this._layerIsVisible=!0,this.notifyChange("suspended"),this._updateLoading(),this._pageMultiplier=null!=e.nodesPerPage?1:e.nodePerIndexBlock;const i=await this.layer.rootPagePromise;this._loadingInitNodePage=!1,i?(this._index.addPage(0,this._processJSONNodes(i,0),this._elevationOffset),this._setUpdateViewNeeded()):n.getLogger(this).error("Point cloud layer root page not loaded")}_loadNodePage(e,t){const i=`${this.baseUrl}/nodepages/${e*this._pageMultiplier}`;return this._requestNodePage(i,t).then(t=>this._processJSONNodes(t,e))}_processJSONNodes(e,t){const i=t*this._index.pageSize;return e.nodes.map((e,t)=>({resourceId:e.resourceId??i+t,obb:xe.fromJSON(e.obb),obbInRenderSR:new xe,firstChild:e.firstChild,childCount:e.childCount,vertexCount:e.vertexCount??e.pointCount,lodThreshold:e.lodThreshold??e.effectiveArea}))}_updateWorkQueues(){if(!this._updateViewNeeded)return!1;const e=this.view.quality;let t=this.inverseDensity/this._lodFactor*e;const i=this.maximumPointCount*this._lodFactor*e;let r=this._computeNodesForMinimumDensity(t),s=this._computePointCount(r),o=Math.sqrt(s/(.75*i));for(;s>i;)t*=o,r=this._computeNodesForMinimumDensity(t),s=this._computePointCount(r),o=Math.sqrt(2);return this._displayNodes(r),this._updateViewNeeded=!1,this._updateLoading(),!0}_computePointCount(e){let t=0;for(let i=0;i<e.length;i++){const r=this._index.getNode(e[i]);r&&(t+=r.vertexCount)}return t}_isRootNodeVisible(){let e=!1;return this._traverseVisible({frustum:this.view.state.contentCamera.frustum,clippingBox:this._clippingBox},{predicate:(t,i,r)=>(e=r,!1),pageMiss:()=>{}}),e}_computeNodesForMinimumDensity(e){const t=this.view.state.contentCamera,i=t.frustum,r=this._clippingBox,s=t.viewForward,o=I(s,t.eye),n=D(s,-o,Qe),a=t.perScreenPixelRatio/2,d=e*e,l=this._nodeIdArray;l.length=0;const u=e=>l.push(e);return this._traverseVisible({frustum:i,clippingBox:r},{predicate:(e,t,i)=>{if(!i)return!1;if(0===t.childCount)return u(e),!1;const r=this._index.getRenderObb(e);return!(this._computeAveragePixelArea(r,t.lodThreshold,t.vertexCount,n,a)<=d)||(u(e),!1)},pageMiss:(e,t)=>{u(e),this._indexQueue.includes(t)||this._indexQueue.push(t)}}),l}_computeAveragePixelArea(e,t,i,r,s){const o=1e-7,n=Math.max(o,e.minimumDistancePlane(r));return t/(n*n)/(4*s*s)/i}_loadNode(e,t){try{return this._loadNodeAsync(e,t)}catch(i){throw _(i)||n.getLogger(this).error(i),i}}async _loadAdditionalUserAttributes(e,t,i){const s=this.layer.outFields;if(!s)return[];const o=z(this.layer.fieldsIndex,s),n=new Set(e.map(e=>null!=e?e.name:null)),a=this.layer.attributeStorageInfo,d=[];for(const r of o){if(n.has(r))continue;const e=me(a,r);e&&d.push(t(e))}const l=await m(d);return g(i),l.filter(r)}async _loadNodeAsync(e,t){const i=this._index.getNode(e),r=pe(this.layer),s=ce(this.layer),o=i.resourceId,n=async e=>{if(!e)return null;if(e.useElevation)return{attributeInfo:e,buffer:null};const i=await this._loadAttribute(o,e,t);return null!=i?{attributeInfo:e,buffer:i}:null};return this._idleQueue.push(async()=>{const i=this._loadGeometry(o,t),{primaryAttribute:a,modulationAttribute:d}=r,l=n(a),u=n(d),h=s.map(e=>e.attributeInfo),p=h.map(e=>n(e)),c=this._loadAdditionalUserAttributes([a,d,...h],n,t),[_,m,f,y,b]=await Promise.all([i,l,u,Promise.all(p),c]);g(t);const w={geometryBuffer:_,primaryAttributeData:m,modulationAttributeData:f,filterAttributesData:y,userAttributesData:b,schema:this.layer.store.defaultGeometrySchema,rendererInfo:r,filterInfo:s,obbData:this._index.getRenderObb(e).data,elevationOffset:this._elevationOffset,inSR:this.layer.spatialReference.toJSON(),outSR:this.view.renderCoordsHelper.spatialReference.toJSON()};return this._worker.invoke(w,t)},t)}async _loadGeometry(e,t){return this._requestData(`${this.baseUrl}/nodes/${e}/geometries/0`,t)}async _loadAttribute(e,t,i){if(!t?.storageInfo)return null;const r=t.storageInfo.key;return this._requestData(`${this.baseUrl}/nodes/${e}/attributes/${r}`,i)}async _requestNodePage(e,t){const r={f:"json",...this.layer.customParameters,token:this.layer.apiKey},s={...H,query:r,responseType:"json",signal:t};return(await i(e,s)).data}async _requestData(e,t){const r={...this.layer.customParameters,token:this.layer.apiKey},s={...H,query:r,responseType:"array-buffer",signal:t};return(await i(e,s)).data}_removeFromRenderer(e){if(this._renderedNodes.has(e)){const t=this._renderer.removeNode(e);this._renderedNodes.delete(e),this._memCache.put(`${t.id}`,t)}}_addToRenderer(e){this._renderedNodes.has(e.id)||(this._renderedNodes.add(e.id),this._renderer.addNode(e))}_setupRendererData(e,t){const i=this._index.getNode(e),r=Math.sqrt(i.lodThreshold/i.vertexCount),s=this._index.getRenderObb(e);if(de(t))return t.splatSize=r,t.obb=s,A(t.origin,t.obb.center),t;const o=xe.fromData(t.obbData),a=o.halfSize,d=s.halfSize,l=.01*Math.max(d[0],d[1],d[2]);if(a[0]>d[0]+l||a[1]>d[1]+l||a[2]>d[2]+l){if(this._maxLoggedBoxWarnings>0){const t=e=>`[${e.halfSize[0]}, ${e.halfSize[1]}, ${e.halfSize[2]}]`;n.getLogger(this).warn(`Node ${e} reported bounding box too small. got ${t(s)} but points cover ${t(o)}`),0===--this._maxLoggedBoxWarnings&&n.getLogger(this).warn(" Too many bounding box errors, stopping reporting for this layer.")}this._index.setRenderObb(e,o)}return new le(e,r,j(s.center),s,0===i.childCount,t.points,t.rgb,t.attributes,t.pointIdFilterMap)}get usedMemory(){let e=0;return this._renderer.forEachNode(t=>{e+=Le,e+=l(t.coordinates);for(const i of t.attributes){const t=i.values;N(t.buffer)&&(e+=l(t))}}),e}get unloadedMemory(){const e=this._renderedNodes.size;if(e<4)return 0;const t=[...this._renderedNodes].reduce((e,t)=>e+this._index.getNode(t).vertexCount);let i=this._loadingNodes.size;for(let r=0;r<this._workQueue.length;r++)i+=this._workQueue[r].load.length,i-=this._workQueue[r].remove.length;if(i<0)return 0;return i*t/e*((this.usedMemory-e*Le)/t)+i*Le}get performanceInfo(){return new K(this.usedMemory,this._renderedNodes.size,[...this._renderedNodes].reduce((e,t)=>e+this._index.getNode(t).vertexCount,0),this.maximumPointCount,new Z(this._loadingNodes.size,this._indexQueue.length,this._workQueue.length,this._idleQueue.length))}get test(){}};e([v()],Fe.prototype,"layer",void 0),e([v()],Fe.prototype,"baseUrl",null),e([v()],Fe.prototype,"pointScale",null),e([v()],Fe.prototype,"useRealWorldSymbolSizes",null),e([v()],Fe.prototype,"pointSize",null),e([v()],Fe.prototype,"inverseDensity",null),e([v()],Fe.prototype,"maximumPointCount",void 0),e([v({readOnly:!0})],Fe.prototype,"availableFields",null),e([v({readOnly:!0})],Fe.prototype,"_clippingBox",null),e([v({readOnly:!0})],Fe.prototype,"_elevationOffset",null),e([v({type:Boolean})],Fe.prototype,"slicePlaneEnabled",void 0),e([v()],Fe.prototype,"_graphicOrigin",null),e([v()],Fe.prototype,"updating",void 0),e([v(Ce)],Fe.prototype,"updatingProgress",void 0),e([v({readOnly:!0})],Fe.prototype,"updatingProgressValue",null),e([v({readOnly:!0})],Fe.prototype,"visibleAtCurrentScale",null),Fe=e([x("esri.views.3d.layers.PointCloudLayerView3D")],Fe);const Ee=Fe;class Oe{constructor(e,t,i){this.node=e,this.pointId=t,this.point=i}getGeometry(){return new W([],Array.from(this.point),!0,!1)}get attributePointId(){const{node:e,pointId:t}=this;return null!=e.pointIdFilterMap?e.pointIdFilterMap[t]:t}get usedMemory(){return u+u+h+p(this.point,h)}}class De{constructor(e){this.features=e}get usedMemory(){return this.features.reduce((e,t)=>e+t.usedMemory,u+c)}}const Le=160;function Ue(e){return t=>e.immediate.schedule(t)}export{Ee as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import i from"../../../request.js";import{isSome as r}from"../../../core/arrayUtils.js";import{result as s,forEach as o}from"../../../core/asyncUtils.js";import"../../../core/has.js";import n from"../../../core/Logger.js";import{destroyMaybe as a,abortMaybe as d}from"../../../core/maybe.js";import{estimateNumberArrayMemory as l,baseObjectMemory as u,estimateNumberMemory as h,estimateFixedArrayMemory as p,baseArrayMemory as c}from"../../../core/memoryEstimations.js";import{isAbortError as _,allSettledValues as m,throwIfAborted as g}from"../../../core/promiseUtils.js";import{initial as f,watch as y,sync as b,syncAndInitial as w}from"../../../core/reactiveUtils.js";import{pt2px as P}from"../../../core/screenUtils.js";import{isArrayBuffer as N}from"../../../core/typedArrayUtil.js";import{property as v,subclass as x}from"../../../core/accessorSupport/decorators.js";import{b as C,i as S,g as I,d as A}from"../../../chunks/vec32.js";import{clone as R}from"../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{fromValues as j}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import k from"../../../geometry/Extent.js";import V from"../../../geometry/Point.js";import{projectBoundingSphere as Q}from"../../../geometry/projection/projectBoundingSphere.js";import{projectVectorToVector as F}from"../../../geometry/projection/projectVectorToVector.js";import{create as E,fromMinMax as O}from"../../../geometry/support/aaBoundingBox.js";import{fromNormalAndOffset as L,create as D}from"../../../geometry/support/plane.js";import{Sphere as U}from"../../../geometry/support/sphere.js";import W from"../../../layers/graphics/OptimizedGeometry.js";import{QueryEngine as G}from"../../../layers/graphics/data/QueryEngine.js";import M from"../../../layers/support/CodedValue.js";import q from"../../../layers/support/CodedValueDomain.js";import{unpackFieldNames as z}from"../../../layers/support/fieldUtils.js";import{queueAutoPriority as H}from"../../../request/queue.js";import T from"../../../rest/support/FeatureSet.js";import B from"../../../rest/support/Query.js";import{getElevationOffset as $}from"../../../support/elevationInfoUtils.js";import{LayerView3D as J}from"./LayerView3D.js";import{PointCloudLayerViewPerformanceInfo as K,QueuePerformanceInfo as Z}from"./PointCloudLayerViewPerformanceInfo.js";import{PointCloudWorkerHandle as Y}from"./PointCloudWorkerHandle.js";import{I3SQueryFeatureStore as X}from"./i3s/I3SQueryFeatureStore.js";import{checkPointCloudLayerValid as ee,checkPointCloudLayerCompatibleWithView as te}from"./i3s/I3SUtil.js";import{nodeDiff as ie,sortFrontToBack as re,splitWorkEntries as se}from"./i3s/LoDUtil.js";import{PagedNodeIndex as oe}from"./i3s/PagedNodeIndex.js";import{PointCloudGraphic as ne}from"./i3s/PointCloudGraphic.js";import{PointCloudRenderer as ae}from"./i3s/PointCloudRenderer.js";import{isPointRendererNode as de,PointCloudRendererNode as le}from"./i3s/PointCloudRendererNode.js";import{getSplatSizeAlgorithm as ue,getFixedSizeAlgorithm as he,getRendererInfo as pe,getFilterInfo as ce,rendererUsesFixedSizes as _e,getAttributeInfo as me}from"./i3s/PointCloudRendererUtil.js";import{getAttributeValues as ge,readGeometry as fe,elevationFromPositions as ye}from"./i3s/PointCloudWorkerUtil.js";import{normalizeHighlightTarget as be,emptyHighlightHandle as we}from"./support/highlightUtils.js";import{PopupSceneLayerView as Pe}from"./support/PopupSceneLayerView.js";import{projectToBoundingBox as Ne}from"../support/extentUtils.js";import{computeMapPointFromVec3d as ve}from"../support/hitTest.js";import{Obb as xe}from"../support/orientedBoundingBox.js";import{updatingProgress as Ce}from"../support/updatingProperties.js";import Se from"../../layers/LayerView.js";import{PointCloudLayerViewMixin as Ie}from"../../layers/PointCloudLayerView.js";import{getHighlightName as Ae}from"../../support/highlightOptionsUtils.js";import{isInEffectiveScaleRange as Re}from"../../support/layerViewUtils.js";import{PromiseQueue as je}from"../../support/PromiseQueue.js";import{TaskPriority as ke}from"../../support/Scheduler.js";const Ve=8,Qe=D();let Fe=class extends(Ie(Pe(J(Se)))){constructor(){super(...arguments),this.type="point-cloud-3d",this.maximumPointCount=4e6,this.slicePlaneEnabled=!1,this._renderer=null,this._rendererAdded=!1,this._renderedNodes=new Set,this._updateViewNeeded=!0,this._lodFactor=1,this._maxLoggedBoxWarnings=5,this._pageMultiplier=1,this._nodeLoadEpoch=0,this._indexQueue=[],this._workQueue=new Array,this._idleQueue=new je,this._loadingPages=new Map,this._loadingNodes=new Map,this._recalcWork=!0,this._layerIsVisible=!1,this._codedDomainPopulationPromise=null,this._codedDomainPopulationAbortController=null,this._totalWork=0,this._index=null,this._loadingInitNodePage=!1,this._nodeIdArray=[],this.ignoresMemoryFactor=!1}get baseUrl(){return this.layer.parsedUrl?.path??""}get pointScale(){const e=ue(this.layer?.renderer),t=1;return null!=e?.scaleFactor?e.scaleFactor:t}get useRealWorldSymbolSizes(){const e=he(this.layer?.renderer),t=!1;return null!=e?.useRealWorldSymbolSizes?e.useRealWorldSymbolSizes:t}get pointSize(){const e=he(this.layer?.renderer),t=0;return null!=e?.size?e.size:t}get inverseDensity(){const e=96;return this.layer?.renderer?1*e/this.layer.renderer.pointsPerInch:5}get availableFields(){const e=pe(this.layer),t=new Set;e.primaryAttribute&&t.add(e.primaryAttribute.name),e.modulationAttribute&&t.add(e.modulationAttribute.name);const i=ce(this.layer);if(i)for(const r of i)r.attributeInfo&&t.add(r.attributeInfo.name);if(this.layer.outFields)for(const r of z(this.layer.fieldsIndex,this.layer.outFields))t.add(r);return Array.from(t)}get _clippingBox(){if(!this.view||!this.view.clippingArea)return null;const e=E(),t=this.view.renderSpatialReference;return Ne(this.view.clippingArea,e,t)?e:null}get _elevationOffset(){const e=this.layer&&this.layer.elevationInfo;return"absolute-height"===e?.mode?$(e,this.layer.spatialReference):0}get _graphicOrigin(){return this.layer.graphicOrigin}initialize(){const e=this.view.resourceController,t=Ue(e);this._worker=new Y(t),this.addResolvingPromise(this._worker.promise),this.addResolvingPromise(this.layer.rootPagePromise),ee(this.layer),te(this.layer,this.view),this._initRenderer();const i=this._initNodePages(),r=this.view.resourceController.memoryController;this._memCache=r.newCache(`pcl-${this.layer.uid}`),this._queryFeaturesCache=r.newCache(`pcl-query-features-${this.layer.uid};`),this._updatingHandles.add(()=>this._clippingBox,()=>this._setUpdateViewNeeded(),f),this._updatingHandles.add(()=>this._elevationOffset,()=>this._elevationOffsetChanged(),f),this._updatingHandles.add(()=>this.layer.renderer,()=>this._rendererChanged(),f),this._updatingHandles.add(()=>this.layer.filters,()=>this._reload(),f),this._updatingHandles.add(()=>this.layer.outFields,()=>this._reload(),f),this._updatingHandles.add(()=>this.layer.effectiveScaleRange,()=>this._setUpdateViewNeeded()),this._updatingHandles.add(()=>this.view.state.contentCamera,()=>this._setUpdateViewNeeded()),this.addHandles([y(()=>this.view.quality,()=>this._setUpdateViewNeeded(),b)]),this.addResolvingPromise(i),this.when(()=>{this.addHandles([e.scheduler.registerTask(ke.POINT_CLOUD_LAYER,this),y(()=>2===this.view.state.mode,()=>this._setUpdateViewNeeded(),w),this._updatingHandles.add(()=>this.suspended,e=>{e?this._clearNodeState():this._setUpdateViewNeeded()},f)])},()=>{this._updatingHandles.removeAll(),this.removeAllHandles()})}_setUpdateViewNeeded(){this._updateViewNeeded=!0,this._updateLoading()}destroy(){this.cancelLoading(),this._worker=a(this._worker),this._destroyRenderer(),this._memCache=a(this._memCache),this._queryFeaturesCache=a(this._queryFeaturesCache),this._queryEngine=a(this._queryEngine),this._codedDomainPopulationAbortController=d(this._codedDomainPopulationAbortController),this._codedDomainPopulationPromise=null}_initRenderer(){this._renderer=new ae({createGraphic:(e,t,i)=>this._createGraphic(e,t,i)}),this._renderer.layerViewUid=this.uid,this._updatingHandles.add(()=>this._clippingBox,e=>this._renderer.clippingBox=e,f),this._updatingHandles.add(()=>this.suspended,e=>this._setPointsVisible(!e),f),this._updatingHandles.add(()=>this.pointScale,e=>this._renderer.scaleFactor=e,f),this._renderer.minSizePx=Math.sqrt(2),this._updatingHandles.add(()=>this.useRealWorldSymbolSizes,e=>this._renderer.useRealWorldSymbolSizes=e,f),this._updatingHandles.add(()=>this.pointSize,e=>{const t=P(e);this._renderer.size=e,this._renderer.sizePx=t},f),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._renderer.slicePlaneEnabled=e,f),this._updatingHandles.add(()=>this.inverseDensity,()=>this._setUpdateViewNeeded(),f),this._updatingHandles.add(()=>this.maximumPointCount,()=>this._setUpdateViewNeeded(),f),this._updatingHandles.add(()=>this.view.qualitySettings.sceneService.pointCloudLoDFactor,e=>{this._lodFactor=e,this._setUpdateViewNeeded()},f)}_destroyRenderer(){this._renderer.removeAll(),this._setPointsVisible(!1)}_createGraphic(e,t,i,r){const s=null!=e.pointIdFilterMap?e.pointIdFilterMap[t]:t,o=i?"declaredClass"in i?i:ve(this.view,i):null;return r??=this._createGraphicAttributes(e,s),new ne({pointCloudMetadata:{nodeId:e.id,pointIndexInNode:t,attributePointIndexInNode:s,epoch:this._nodeLoadEpoch},geometry:o,attributes:r,layer:this.layer,sourceLayer:this.layer,origin:this._graphicOrigin})}_createGraphicAttributes(e,t){const i={};for(const r of e.attributes)this._encodeGraphicAttribute(r.attributeInfo,r.values,t,i);return i}_getGraphicAttribute(e,t,i){const r=e.storageInfo?.attributeValues,s=r?.valuesPerElement??1;if(1===s)return t[i];if("UInt8"===r?.valueType&&s<=4){let e=0;const r=i*s;for(let i=r;i<r+s;i++)e=(e<<8)+t[i];return e}}_encodeGraphicAttribute(e,t,i,r){r[e.name]=this._getGraphicAttribute(e,t,i)}_setPointsVisible(e){e&&!this._rendererAdded?(this.view.stage.addRenderPlugin(this._renderer),this._rendererAdded=!0):!e&&this._rendererAdded&&(this.view.stage.removeRenderPlugin(this._renderer),this._rendererAdded=!1)}_rendererChanged(){this._renderer.useFixedSizes=_e(this.layer.renderer),this._reload()}_reload(){this._clearNodeState(),this._memCache.clear(),this._setUpdateViewNeeded()}_elevationOffsetChanged(){this._clearNodeState(),this._memCache.clear(),this._initNodePages()}_displayNodes(e){this._workQueue=ie([...this._renderedNodes],e,this._index),re(this._workQueue,this.view.state.contentCamera.viewForward,this._index),se(this._workQueue,Ve,this._index),this._updateQueues(),this._totalWork=this._computeWork(),this._updateLoading(),this._layerIsVisible=e.length>0||this._loadingInitNodePage,this.notifyChange("suspended")}cancelLoading(){this._cancelNodeLoading(),this._cancelIndexLoading()}_cancelNodeLoading(){[...this._loadingNodes.values()].forEach(e=>e.abort()),this._workQueue=[],this._idleQueue.cancelAll(),this._totalWork=this._computeWork(),this._updateLoading()}_updateQueues(){const e=new Set;this._workQueue.forEach(t=>t.load.forEach(t=>e.add(t)));const t=new Array;this._loadingNodes.forEach((i,r)=>{e.has(r)||(this._loadingNodes.delete(r),t.push(i))}),t.forEach(e=>e.abort()),this._workQueue=this._workQueue.filter(e=>{for(const t of e.load)if(this._loadingNodes.has(t))return this._recalcWork=!0,!1;return!0}),this._totalWork=this._computeWork(),this._updateLoading()}_cancelIndexLoading(){this._indexQueue=[],this._loadingPages.forEach(e=>e.abort()),this._loadingPages.clear(),this._totalWork=this._computeWork(),this._updateLoading()}_clearNodeState(){this._nodeLoadEpoch++,this._renderedNodes.forEach(e=>this._removeFromRenderer(e)),this._cancelNodeLoading()}get readyToRun(){return this.suspended?this._updateViewNeeded:this._updateViewNeeded||this._indexQueue.length>0||this._workQueue.length>0||this._idleQueue.readyToRun}runTask(e){if(this.suspended){if(this._updateViewNeeded){this._updateViewNeeded=!1;const e=this._isRootNodeVisible();e!==this._layerIsVisible&&(this._layerIsVisible=e,this.notifyChange("suspended")),this._updateLoading()}}else{for(e.run(()=>this._updateWorkQueues());this._indexQueue.length>0&&!e.done;)this._processIndexQueue(),e.madeProgress();this._processWorkQueue(e),this._idleQueue.runTask(e)}}async _processIndexQueue(){const e=this._indexQueue.shift(),t=new AbortController;this._loadingPages.set(e,t);try{const i=await this._loadNodePage(e,t.signal);this._index.addPage(e,i,this._elevationOffset),this._setUpdateViewNeeded(),this._loadingPages.delete(e)}catch(i){this._loadingPages.get(e)===t&&this._loadingPages.delete(e)}}_processWorkQueue(e){for(;!e.done;){const t=this._scheduleWorkEntry();if(null==t)return void e.madeProgress();this._processWorkEntry(t),e.madeProgress()}}_scheduleWorkEntry(){let e=this._workQueue.length;for(;e--;){const e=this._workQueue.shift();if(!e.remove.find(e=>!this._renderedNodes.has(e)))return e;this._workQueue.push(e)}return null}async _processWorkEntry(e){if(0===e.load.length){for(const t of e.remove)this._removeFromRenderer(t);return}const t=e.load.map(e=>{const t=new AbortController;return this._loadingNodes.set(e,t),t});this._updateLoading();try{const i=await Promise.all(e.load.map((e,i)=>this._memCache.pop(`${e}`)??this._loadNode(e,t[i].signal)));for(let t=0;t<e.load.length;t++)if(i[t]){const r=this._setupRendererData(e.load[t],i[t]);this._addToRenderer(r)}for(const t of e.remove)this._removeFromRenderer(t);for(const t of e.load)this._loadingNodes.delete(t)}catch(i){e.load.forEach((e,i)=>{this._loadingNodes.get(e)===t[i]&&this._loadingNodes.delete(e)})}this._updateLoading(),this._recalcWork&&!this._idleQueue.updating&&0===this._indexQueue.length&&0===this._loadingNodes.size&&(this._recalcWork=!1,this._setUpdateViewNeeded())}async _populateClassCodeCodedDomain(e,t){const i="CLASS_CODE",r=this.layer.fieldsIndex.get(i);if(!r||r.domain)return;if(!e.includes(r.name))return;const o=await s(this.layer.queryCachedStatistics(i,{signal:t}));if(!1===o.ok)return;const n=o.value?.stats?.labels?.labels;n&&Array.isArray(n)&&(r.domain=new q({name:"CLASS_CODE",codedValues:n.map(e=>new M({code:e.value,name:e.label}))}))}async prepareFetchPopupFeatures(e){return this._codedDomainPopulationPromise||(this._codedDomainPopulationAbortController=new AbortController,this._codedDomainPopulationPromise=this._populateClassCodeCodedDomain(e,this._codedDomainPopulationAbortController.signal).then(()=>{this._codedDomainPopulationAbortController=null})),this._codedDomainPopulationPromise}async whenGraphicAttributes(e,t){const i=this._splitGraphicsPerNode(e),s=this.layer.attributeStorageInfo,n=t.map(e=>me(s,e)).filter(r),a=async(e,t)=>{const i=this._index.getNode(t);await o(n,async t=>{const r=t.useElevation?await this._loadElevationAttributeFromGeometry(i.resourceId):await this._loadAndParseAttribute(i,t);if(r)for(const i of e)if(this._isValidPointGraphic(i)){const e=i.pointCloudMetadata.attributePointIndexInNode;this._encodeGraphicAttribute(t,r,e,i.attributes)}})},d=[];return i.forEach((e,t)=>{d.push(a(e,t))}),await Promise.allSettled(d),e}_isValidPointGraphic(e){return e instanceof ne&&e.pointCloudMetadata?.epoch===this._nodeLoadEpoch}_splitGraphicsPerNode(e){const t=new Map;for(const i of e){if(!this._isValidPointGraphic(i))continue;const e=i.pointCloudMetadata,r=t.get(e.nodeId);r?r.push(i):t.set(e.nodeId,[i])}return t}async _loadAndParseAttribute(e,t){const i=await this._loadAttribute(e.resourceId,t,null);return i?ge({attributeInfo:t,buffer:i},null,e.vertexCount):null}async _loadElevationAttributeFromGeometry(e){const t=this.layer.store.defaultGeometrySchema,i=fe(t,await this._loadGeometry(e,null));return ye(i,i.length/3)}highlight(e,i){const r=be(e);if(0===r.length)return we;if(!(r[0]instanceof t))return we;const s=r;return this._renderer.highlight(s.map(e=>this._graphicToPointDefinition(e)),Ae(i))}_graphicToPointDefinition(e){if(!this._isValidPointGraphic(e))return null;const{nodeId:t,pointIndexInNode:i}=e.pointCloudMetadata;return null!=t&&null!=i?{nodeId:t,pointId:i}:null}_computeWork(){let e=0;for(const t of this._workQueue)e+=t.load.length+t.remove.length;return e+=this._loadingNodes.size,e+=(this._indexQueue.length+this._loadingPages.size)*this._index.pageSize,e+=this._loadingInitNodePage?100:0,e+=this._updateViewNeeded?100:0,e}get updatingProgressValue(){if(this.suspended)return this._updateViewNeeded?0:1;const e=this._computeWork();return 1-Math.min(this._totalWork,e)/this._totalWork}_updateLoading(){this.notifyChange("updating"),this.notifyChange("updatingProgressValue")}canResume(){return super.canResume()&&this._layerIsVisible}isUpdating(){return this.suspended?this._updateViewNeeded:this._computeWork()>0}get visibleAtCurrentScale(){return Re(this.layer.effectiveScaleRange,this.view.scale)}async queryFeatures(e,i){const r=await this._ensureQueryEngine().executeQuery(this._ensureQueryJSON(e),i?.signal),s=r.features;r.features=[];const o=T.fromJSON(r),n=this.view.spatialReference;return o.features=s.map(e=>{const{attributes:i,metadata:r}=e;if(!r){const i=t.fromJSON(e);return i.geometry&&(i.geometry.spatialReference=o.spatialReference??n),i.layer=this.layer,i.sourceLayer=this.layer,i.origin=this._graphicOrigin,i}const s=e.geometry?V.fromJSON(e.geometry):void 0;return s&&(s.spatialReference=o.spatialReference??n),this._createGraphic(r.node,r.pointId,s,i)}),o}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference,returnZ:!0};return new B(e)}async queryFeatureCount(e,t){return await this._ensureQueryEngine().executeQueryForCount(this._ensureQueryJSON(e),t?.signal)}async queryExtent(e,t){const{count:i,extent:r}=await this._ensureQueryEngine().executeQueryForExtent(this._ensureQueryJSON(e),t?.signal);return{count:i,extent:k.fromJSON(r)}}_ensureQueryJSON(e){return null==e?new B({outSpatialReference:this.view.spatialReference}).toJSON():B.from(e).toJSON()}_ensureQueryEngine(){if(this._queryEngine)return this._queryEngine;const{spatialReference:e}=this.view;return this._queryEngine=new G({fieldsIndex:this.layer.fieldsIndex.toJSON(),geometryType:"esriGeometryPoint",spatialReference:e,featureIdInfo:{type:"object-id",fieldName:"objectId"},hasZ:!0,featureStore:new X({sourceSpatialReference:e,viewSpatialReference:e,forAllFeatures:(e,t)=>{this._renderer.forEachNode(i=>{if(t){const e=i.obb,r=new U(e.center,C(e.halfSize));Q(r,this.view.renderSpatialReference,r,this.view.spatialReference);if(1===t(r))return}let r=this._queryFeaturesCache.get(`${i.id}`);r||(r=this._createQueryPointFeatures(i),this._queryFeaturesCache.put(`${i.id}`,r)),r.features.forEach(e)})},getFeatureExtent:({point:e},t)=>O(e,e,t),featureAdapter:{cloneWithGeometry:(e,t,i)=>new Oe(e.node,e.pointId,t.coords),getAttribute:({node:e,attributePointId:t},i)=>{for(const r of e.attributes)if(r.attributeInfo.name===i)return this._getGraphicAttribute(r.attributeInfo,r.values,t)},getAttributes:({node:e,attributePointId:t})=>this._createGraphicAttributes(e,t),getCentroid:e=>e.getGeometry(),getGeometry:e=>e.getGeometry(),getObjectId:()=>{},getMetadata:e=>e}})}),this._queryEngine}_createQueryPointFeatures(e){const t=e.coordinates,i=new Array;for(let r=0;r<t.length/3;r++){const s=3*r,o=j(t[s+0],t[s+1],t[s+2]);S(o,o,e.origin),F(o,this.view.renderSpatialReference,o,this.view.spatialReference);const n=new Oe(e,r,o);i.push(n)}return new Le(i)}async _initNodePages(){const e=this.layer.store.index,t=e.nodesPerPage||e.nodePerIndexBlock;this._index=new oe(this.layer.spatialReference,this.view.renderCoordsHelper.spatialReference,t),this._cancelIndexLoading(),this._traverseVisible=this._index.createVisibilityTraverse(),this._loadingInitNodePage=!0,this._layerIsVisible=!0,this.notifyChange("suspended"),this._updateLoading(),this._pageMultiplier=null!=e.nodesPerPage?1:e.nodePerIndexBlock;const i=await this.layer.rootPagePromise;this._loadingInitNodePage=!1,i?(this._index.addPage(0,this._processJSONNodes(i,0),this._elevationOffset),this._setUpdateViewNeeded()):n.getLogger(this).error("Point cloud layer root page not loaded")}_loadNodePage(e,t){const i=`${this.baseUrl}/nodepages/${e*this._pageMultiplier}`;return this._requestNodePage(i,t).then(t=>this._processJSONNodes(t,e))}_processJSONNodes(e,t){const i=t*this._index.pageSize;return e.nodes.map((e,t)=>({resourceId:e.resourceId??i+t,obb:xe.fromJSON(e.obb),obbInRenderSR:new xe,firstChild:e.firstChild,childCount:e.childCount,vertexCount:e.vertexCount??e.pointCount,lodThreshold:e.lodThreshold??e.effectiveArea}))}_updateWorkQueues(){if(!this._updateViewNeeded)return!1;const e=this.view.quality;let t=this.inverseDensity/this._lodFactor*e;const i=this.maximumPointCount*this._lodFactor*e;let r=this._computeNodesForMinimumDensity(t),s=this._computePointCount(r),o=Math.sqrt(s/(.75*i));for(;s>i;)t*=o,r=this._computeNodesForMinimumDensity(t),s=this._computePointCount(r),o=Math.sqrt(2);return this._displayNodes(r),this._updateViewNeeded=!1,this._updateLoading(),!0}_computePointCount(e){let t=0;for(let i=0;i<e.length;i++){const r=this._index.getNode(e[i]);r&&(t+=r.vertexCount)}return t}_isRootNodeVisible(){let e=!1;return this._traverseVisible({frustum:this.view.state.contentCamera.frustum,clippingBox:this._clippingBox},{predicate:(t,i,r)=>(e=r,!1),pageMiss:()=>{}}),e}_computeNodesForMinimumDensity(e){const t=this.view.state.contentCamera,i=t.frustum,r=this._clippingBox,s=t.viewForward,o=I(s,t.eye),n=L(s,-o,Qe),a=t.perScreenPixelRatio/2,d=e*e,l=this._nodeIdArray;l.length=0;const u=e=>l.push(e);return this._traverseVisible({frustum:i,clippingBox:r},{predicate:(e,t,i)=>{if(!i)return!1;if(0===t.childCount)return u(e),!1;const r=this._index.getRenderObb(e);return!(this._computeAveragePixelArea(r,t.lodThreshold,t.vertexCount,n,a)<=d)||(u(e),!1)},pageMiss:(e,t)=>{u(e),this._indexQueue.includes(t)||this._indexQueue.push(t)}}),l}_computeAveragePixelArea(e,t,i,r,s){const o=1e-7,n=Math.max(o,e.minimumDistancePlane(r));return t/(n*n)/(4*s*s)/i}_loadNode(e,t){try{return this._loadNodeAsync(e,t)}catch(i){throw _(i)||n.getLogger(this).error(i),i}}async _loadAdditionalUserAttributes(e,t,i){const s=this.layer.outFields;if(!s)return[];const o=z(this.layer.fieldsIndex,s),n=new Set(e.map(e=>null!=e?e.name:null)),a=this.layer.attributeStorageInfo,d=[];for(const r of o){if(n.has(r))continue;const e=me(a,r);e&&d.push(t(e))}const l=await m(d);return g(i),l.filter(r)}async _loadNodeAsync(e,t){const i=this._index.getNode(e),r=pe(this.layer),s=ce(this.layer),o=i.resourceId,n=async e=>{if(!e)return null;if(e.useElevation)return{attributeInfo:e,buffer:null};const i=await this._loadAttribute(o,e,t);return null!=i?{attributeInfo:e,buffer:i}:null};return this._idleQueue.push(async()=>{const i=this._loadGeometry(o,t),{primaryAttribute:a,modulationAttribute:d}=r,l=n(a),u=n(d),h=s.map(e=>e.attributeInfo),p=h.map(e=>n(e)),c=this._loadAdditionalUserAttributes([a,d,...h],n,t),[_,m,f,y,b]=await Promise.all([i,l,u,Promise.all(p),c]);g(t);const w={geometryBuffer:_,primaryAttributeData:m,modulationAttributeData:f,filterAttributesData:y,userAttributesData:b,schema:this.layer.store.defaultGeometrySchema,rendererInfo:r,filterInfo:s,obbData:this._index.getRenderObb(e).data,elevationOffset:this._elevationOffset,inSR:this.layer.spatialReference.toJSON(),outSR:this.view.renderCoordsHelper.spatialReference.toJSON()};return this._worker.invoke(w,t)},t)}async _loadGeometry(e,t){return this._requestData(`${this.baseUrl}/nodes/${e}/geometries/0`,t)}async _loadAttribute(e,t,i){if(!t?.storageInfo)return null;const r=t.storageInfo.key;return this._requestData(`${this.baseUrl}/nodes/${e}/attributes/${r}`,i)}async _requestNodePage(e,t){const r={f:"json",...this.layer.customParameters,token:this.layer.apiKey},s={...H,query:r,responseType:"json",signal:t};return(await i(e,s)).data}async _requestData(e,t){const r={...this.layer.customParameters,token:this.layer.apiKey},s={...H,query:r,responseType:"array-buffer",signal:t};return(await i(e,s)).data}_removeFromRenderer(e){if(this._renderedNodes.has(e)){const t=this._renderer.removeNode(e);this._renderedNodes.delete(e),this._memCache.put(`${t.id}`,t)}}_addToRenderer(e){this._renderedNodes.has(e.id)||(this._renderedNodes.add(e.id),this._renderer.addNode(e))}_setupRendererData(e,t){const i=this._index.getNode(e),r=Math.sqrt(i.lodThreshold/i.vertexCount),s=this._index.getRenderObb(e);if(de(t))return t.splatSize=r,t.obb=s,A(t.origin,t.obb.center),t;const o=xe.fromData(t.obbData),a=o.halfSize,d=s.halfSize,l=.01*Math.max(d[0],d[1],d[2]);if(a[0]>d[0]+l||a[1]>d[1]+l||a[2]>d[2]+l){if(this._maxLoggedBoxWarnings>0){const t=e=>`[${e.halfSize[0]}, ${e.halfSize[1]}, ${e.halfSize[2]}]`;n.getLogger(this).warn(`Node ${e} reported bounding box too small. got ${t(s)} but points cover ${t(o)}`),0===--this._maxLoggedBoxWarnings&&n.getLogger(this).warn(" Too many bounding box errors, stopping reporting for this layer.")}this._index.setRenderObb(e,o)}return new le(e,r,R(s.center),s,0===i.childCount,t.points,t.rgb,t.attributes,t.pointIdFilterMap)}get usedMemory(){let e=0;return this._renderer.forEachNode(t=>{e+=De,e+=l(t.coordinates);for(const i of t.attributes){const t=i.values;N(t.buffer)&&(e+=l(t))}}),e}get unloadedMemory(){const e=this._renderedNodes.size;if(e<4)return 0;const t=[...this._renderedNodes].reduce((e,t)=>e+this._index.getNode(t).vertexCount);let i=this._loadingNodes.size;for(let r=0;r<this._workQueue.length;r++)i+=this._workQueue[r].load.length,i-=this._workQueue[r].remove.length;if(i<0)return 0;return i*t/e*((this.usedMemory-e*De)/t)+i*De}get performanceInfo(){return new K(this.usedMemory,this._renderedNodes.size,[...this._renderedNodes].reduce((e,t)=>e+this._index.getNode(t).vertexCount,0),this.maximumPointCount,new Z(this._loadingNodes.size,this._indexQueue.length,this._workQueue.length,this._idleQueue.length))}get test(){}};e([v()],Fe.prototype,"layer",void 0),e([v()],Fe.prototype,"baseUrl",null),e([v()],Fe.prototype,"pointScale",null),e([v()],Fe.prototype,"useRealWorldSymbolSizes",null),e([v()],Fe.prototype,"pointSize",null),e([v()],Fe.prototype,"inverseDensity",null),e([v()],Fe.prototype,"maximumPointCount",void 0),e([v({readOnly:!0})],Fe.prototype,"availableFields",null),e([v({readOnly:!0})],Fe.prototype,"_clippingBox",null),e([v({readOnly:!0})],Fe.prototype,"_elevationOffset",null),e([v({type:Boolean})],Fe.prototype,"slicePlaneEnabled",void 0),e([v()],Fe.prototype,"_graphicOrigin",null),e([v()],Fe.prototype,"updating",void 0),e([v(Ce)],Fe.prototype,"updatingProgress",void 0),e([v({readOnly:!0})],Fe.prototype,"updatingProgressValue",null),e([v({readOnly:!0})],Fe.prototype,"visibleAtCurrentScale",null),Fe=e([x("esri.views.3d.layers.PointCloudLayerView3D")],Fe);const Ee=Fe;class Oe{constructor(e,t,i){this.node=e,this.pointId=t,this.point=i}getGeometry(){return new W([],Array.from(this.point),!0,!1)}get attributePointId(){const{node:e,pointId:t}=this;return null!=e.pointIdFilterMap?e.pointIdFilterMap[t]:t}get usedMemory(){return u+u+h+p(this.point,h)}}class Le{constructor(e){this.features=e}get usedMemory(){return this.features.reduce((e,t)=>e+t.usedMemory,u+c)}}const De=160;function Ue(e){return t=>e.immediate.schedule(t)}export{Ee 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/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{isSome as i}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import r from"../../../../core/Error.js";import s from"../../../../core/Logger.js";import{findInMap as a}from"../../../../core/MapUtils.js";import{abortMaybe as n,removeMaybe as o,destroyMaybe as l}from"../../../../core/maybe.js";import{MinPriority as h}from"../../../../core/MemCache.js";import d from"../../../../core/PooledArray.js";import{throwIfAborted as p,ignoreAbortErrors as c,createResolver as y,isAbortError as u}from"../../../../core/promiseUtils.js";import g from"../../../../core/Queue.js";import{when as m,watch as b,on as _,syncAndInitial as f,whenOnce as v}from"../../../../core/reactiveUtils.js";import{schedule as C}from"../../../../core/scheduling.js";import{property as S,subclass as G}from"../../../../core/accessorSupport/decorators.js";import{diff as w,isEmpty as x}from"../../../../core/accessorSupport/diffUtils.js";import{h as P,i as R,j as U}from"../../../../chunks/vec32.js";import{create as D}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import I from"../../../../geometry/Extent.js";import E from"../../../../geometry/Point.js";import{canProjectWithoutEngine as L}from"../../../../geometry/projectionUtils.js";import{projectBuffer as j}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as V}from"../../../../geometry/projection/projectVectorToVector.js";import{projectXYZToVector as A}from"../../../../geometry/projection/projectXYZToVector.js";import{center as O,create as F,fromRect as T,equals as M}from"../../../../geometry/support/aaBoundingBox.js";import{create as k}from"../../../../geometry/support/aaBoundingRect.js";import{equals as z}from"../../../../geometry/support/spatialReferenceUtils.js";import{isPopupProvider as W}from"../../../../graphic/getPopupProvider.js";import H from"../../../../layers/Layer.js";import{getObjectId as B,computeAABB as q,hasGeometry as Q}from"../../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as N}from"../../../../layers/graphics/hydratedFeatures.js";import $ from"../../../../renderers/UniqueValueRenderer.js";import{isSupportedRenderer3D as Z,validateTo3D as Y}from"../../../../renderers/support/rendererConversion.js";import{RenderingInfo as X}from"../../../../renderers/support/RenderingInfo.js";import{isBasemapLayerView as J}from"../../../../support/basemapUtils.js";import{loadArcade as K}from"../../../../support/loadArcade.js";import ee from"../../../../symbols/LabelSymbol3D.js";import te from"../../../../symbols/TextSymbol.js";import ie from"../../../../symbols/WebStyleSymbol.js";import{getDefaultSymbol3D as re}from"../../../../symbols/support/defaults3D.js";import{to3D as se}from"../../../../symbols/support/symbolConversion.js";import{averageSymbolComplexities as ae,defaultSymbolComplexity as ne}from"./defaultSymbolComplexity.js";import{DisplayFeatureLimit as oe}from"./DisplayFeatureLimit.js";import{ViewElevationProvider as le}from"./ElevationQuery.js";import{extractExpressionInfo as he,createContext as de}from"./featureExpressionInfoUtils.js";import{Graphics3DFeatureStore as pe}from"./Graphics3DFeatureStore.js";import{Graphics3DGraphicCreationContext as ce}from"./Graphics3DGraphicCreationContext.js";import{Graphics3DSymbolCreationContext as ye}from"./Graphics3DSymbolCreationContext.js";import{make as ue}from"./Graphics3DSymbolFactory.js";import{Graphics3DWebStyleSymbol as ge}from"./Graphics3DWebStyleSymbol.js";import{GraphicsCorePerformanceInfo as me}from"./GraphicsCorePerformanceInfo.js";import{GraphicStateTracking as be}from"./GraphicStateTracking.js";import{computeCentroid as _e}from"./graphicUtils.js";import{placePointOnGeometry as fe}from"./pointUtils.js";import{SpatialIndex2D as ve}from"./SpatialIndex2D.js";import{StageLayerElevationProvider as Ce}from"../support/StageLayerElevationProvider.js";import{toBoundingRect as Se}from"../../support/extentUtils.js";import{GridLocalOriginFactory as Ge}from"../../webgl-engine/lib/GridLocalOriginFactory.js";import{isScreenSizePerspectiveEnabled as we}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{affectsGeometry as xe}from"../../webgl-engine/lib/VertexAttribute.js";import{WebGLLayer as Pe}from"../../webgl-engine/lib/WebGLLayer.js";import{HUDMaterial as Re}from"../../webgl-engine/materials/HUDMaterial.js";import{hasPopupTemplate as Ue}from"../../../layers/support/popupUtils.js";import{PromiseQueue as De}from"../../../support/PromiseQueue.js";import{PropertiesPool as Ie}from"../../../support/PropertiesPool.js";import{ImmediateTask as Ee,noBudget as Le,TaskPriority as je}from"../../../support/Scheduler.js";import{TextureCompressionTracker as Ve}from"../../../support/TextureCompressionTracker.js";import{Yield as Ae}from"../../../support/Yield.js";import{alphaCutoff as Oe}from"../../../../webscene/support/AlphaCutoff.js";var Fe;const Te=D(),Me=F();let ke=class extends t{static{Fe=this}static{this.tmpVec=D()}get _viewSpatialReference(){return this.owner.view.spatialReference}get spatialIndex(){return this._spatialIndex||(this._spatialIndex=new ve({objectIdField:this.owner.layer?.objectIdField,spatialReference:this._viewSpatialReference,hasZ:!!this.hasZ,hasM:!!this.hasM}),this._spatialIndex.setup(Array.from(this.graphics3DGraphics.values()))),this._spatialIndex.update(),this._spatialIndex}get deconflictor(){return this._deconflictor}get labeler(){return this._labeler}get numberOfGraphics(){return this._numberOfGraphics}get effectiveUpdatePolicy(){return null!=this.currentRenderer&&"dictionary"===this.currentRenderer.type?0:this._forcedUpdatePolicy??this.preferredUpdatePolicy}get featureStore(){return this._featureStore}get initializePromise(){return this._initializePromise}get scaleVisibility(){return this._scaleVisibility}get elevationAlignment(){return this._elevationAlignment}get objectStates(){return this._objectStates}get filterVisibility(){return this._filterVisibility}get updating(){return!!(this.dataUpdating||this._elevationAlignment?.updating||this._scaleVisibility?.updating||this._filterVisibility?.updating||this._rendererChangeAbortController||this._elevationInfoChangeAbortController||this._frameTaskHandle.updating||this._updateQueue.updating||this.readyToRun)}get dataUpdating(){return!!(this._graphicsWaitingForSymbol.size>0||this._pendingUpdates.size>0||this._spatialIndex?.updating||this._updatingPendingLoadedGraphicsChange||this._dataUpdateQueue.updating||this._loadingSymbols>0||this.compressionTracker.compressing)}get readyToRun(){return this._pendingUpdates.size>0||!!this._spatialIndex?.updating||this._dataUpdateQueue.readyToRun||this._updateQueue.readyToRun||this._focusAreasGraphicsQueue.length>0}get suspendedOrOutsideOfView(){return this.owner.suspended||!!this.owner.suspendInfo?.outsideOfView}get updatingRemaining(){return this.updating?this._pendingUpdates.size+.1*(this._spatialIndex?.updatingRemaining||0)+.1*(this._elevationAlignment?.updatingRemaining||0):0}get displayFeatureLimit(){const e=this.owner&&this.owner.view&&this.owner.view.qualitySettings,t=e?.graphics3D.minTotalNumberOfFeatures??0,i=e?.graphics3D.maxTotalNumberOfFeatures??0,r=e?.graphics3D.maxNumberOfDrawCalls??0,s=e?.graphics3D.maxTotalNumberOfVertices??0,a=this.averageSymbolComplexity,n=Math.max(1,a?.verticesPerFeature??1),o=a&&a.drawCallsPerFeature>0&&r>0?r/a.drawCallsPerFeature:i,l=Math.ceil(s/n),h=Math.max(t,Math.min(i,l,o)),d=this._get("displayFeatureLimit");return d&&d.maximumTotalNumberOfVertices===s&&d.averageSymbolComplexity===a&&d.maximumNumberOfFeatures===h?d:new oe(s,h,a)}get averageSymbolComplexity(){const e=ae(this._symbolComplexities),t=this._get("averageSymbolComplexity");return 0===e.numComplexities||null!=t&&(e.estimated&&(t.verticesPerFeature>=e.verticesPerFeature||t.verticesPerCoordinate>=e.verticesPerCoordinate||t.drawCallsPerFeature>=e.drawCallsPerFeature)||t.verticesPerFeature===e.verticesPerFeature&&t.verticesPerCoordinate===e.verticesPerCoordinate&&t.drawCallsPerFeature===e.drawCallsPerFeature)?t:e}get usedMemory(){const e=this.labelsEnabled?(this.averageSymbolComplexity?.memory.bytesPerFeatureLabel??0)*this._numberOfGraphics:0,t=this._getSymbolComplexitiesUsed().reduce((e,t)=>e+t.memory.resourceBytes,0);if(null==this._symbolMaterials){this._symbolMaterials=[];for(const e of this._symbols.values())if(null!=e)for(const t of e.symbolLayers)if(t)for(const e of t.materials)e&&this._symbolMaterials.push(e)}const i=this.owner.view.stage.renderer,r=this.owner.view.overlayManager.renderer,s=this._symbolMaterials.reduce((e,t)=>e+((i.getMaterialRenderer(t)||r.getMaterialRenderer(t))?.usedMemory??0),0);return this._usedMemory+e+t+s}get usedMemoryPerGraphic(){if(this._usedMemory&&this._numberOfGraphics){const e=this._numberOfGraphics/(this._numberOfGraphics+Math.max(this._pendingAdds,this._pendingRemoves));return this._usedMemory/this._numberOfGraphics*e}if(null!=this.averageSymbolComplexity){const e=this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel:0;return this.averageSymbolComplexity.memory.bytesPerFeature+e}return 0}get unprocessedMemoryEstimate(){return(this._pendingAdds-this._pendingRemoves)*this.usedMemoryPerGraphic}get _symbolComplexities(){return this.currentRenderer?this._getSymbolComplexitiesUsedOrRenderer(this.currentRenderer):this._getSymbolComplexitiesUsed()}get visible(){return this._visible}_getConvertedSymbol(e){const t=e;if("web-style"===t.type)return t.clone();const i=this._symbolConversionCache.get(t.id);if(null!=i)return i;const r=se(t,{geometryType:this.layer?.geometryType??void 0,retainId:!0,hasLabelingContext:this._hasLabelingContext(t),cimFallbackEnabled:!0}),a=r.symbol||null;return null==a&&r.error&&s.getLogger(this).error(r.error.message),this._symbolConversionCache.set(t.id,a),a}_getSymbolComplexitiesUsedOrRenderer(e){if(null==e)return[];const t=e.symbols,i="backgroundFillSymbol"in e?e.backgroundFillSymbol:null;if(!i&&!t.length)return[];const r=[],s=this._getSymbolComplexityUsedOrRenderer(i);null!=s&&r.push(s);for(const a of t){const e=this._getSymbolComplexityUsedOrRenderer(a);null!=e&&r.push(e)}return r}_getSymbolComplexityUsedOrRenderer(e){if(null==e)return null;const t=this._symbols.get(e.id);if(null!=t)return t.complexity;const i=this._getConvertedSymbol(e);return null!=i?ne(i):null}_getSymbolComplexitiesUsed(){const e=[];return this._symbols.forEach(t=>{null!=t&&e.push(t.complexity)}),e}get _objectIdField(){return this.layer.objectIdField}constructor(e){super(e),this._propertiesPool=new Ie({computedExtent:()=>new I},this),this.computedExtent=null,this.currentRenderer=null,this.rendererHasGeometryOperations=!1,this._graphicStateTracking=null,this.graphics3DGraphics=new Map,this.stageLayer=null,this.stage=null,this._graphicsDrapedUids=new Set,this._graphicsBySymbol=new Map,this._symbolConversionCache=new Map,this._symbols=new Map,this._graphicsWithoutSymbol=new Map,this._graphicsWaitingForSymbol=new Map,this._graphicsUpdateId=0,this._frameTaskHandle=Ee,this._dataUpdateQueue=new De,this._updateQueue=new De,this._focusAreasGraphicsQueue=new g,this._suspendSymbolCleanup=!1,this._arcadeOnDemand=null,this._rendererChangeAbortController=null,this._elevationInfoChangeAbortController=null,this._initializeAbortController=null,this._elevationAlignment=null,this._scaleVisibility=null,this._filterVisibility=null,this._spatialIndex=null,this.extentPadding=0,this._updatingPendingLoadedGraphicsChange=null,this._featureStore=null,this._deconflictor=null,this._labeler=null,this._objectStates=null,this._viewElevationProvider=null,this._stageLayerElevationProvider=null,this._whenGraphics3DGraphicRequests={},this._pendingUpdates=new Map,this._numberOfGraphics=0,this._numberOfGraphicsProvidingElevation=0,this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this._loadingSymbols=0,this.compressionTracker=new Ve,this._symbolWarningLogged=!1,this._geometryWarningLogged=!1,this._objectIdInvisibleSet=new Set,this._whenSymbolRemoved=new d,this.preferredUpdatePolicy=1,this._forcedUpdatePolicy=null,this.elevationFeatureExpressionEnabled=!0,this.owner=null,this.layer=null,this.graphicSymbolSupported=!0,this.getRenderingInfoWithoutRenderer=!1,this.setUidToIdOnAdd=!0,this.hasZ=null,this.hasM=null,this._usedMemory=0,this._visible=!1,this._startCreateGraphics=!1,this._unusedSymbolsCache=e.owner.view.resourceController.memoryController.newCache("graphics-3d-unused-symbols",e=>e.destroy()),this.symbolCreationContext=new ye(e.owner.view.resourceController.scheduler,(e,t)=>this._updateQueue.push(e,t),e.owner.layerViewUid,this.compressionTracker)}initialize(){this._featureStore=new pe({objectIdField:this.owner.layer?.objectIdField,hasZ:!!this.hasZ,hasM:!!this.hasM,viewSpatialReference:this._viewSpatialReference,featureSpatialReference:this.owner.featureSpatialReference,getSpatialIndex:()=>this.spatialIndex,forEach:e=>this.graphics3DGraphics.forEach(e)});const e=(e,t,i)=>this.spatialIndex.queryGraphicUIDsInExtent(e,t,i),{componentFactories:t}=this;this._elevationAlignment=t.elevationAlignment?.(this,e),this._scaleVisibility=t.scaleVisibility?.(this,e),this._filterVisibility=t.filterVisibility?.({featureStore:this._featureStore,getFeatureCount:()=>this.graphics3DGraphics.size,updateFeatureVisibilities:e=>this.modifyGraphics3DGraphicVisibilities(t=>t.setVisibilityFlag(1,4,e(B(t.graphic,this._objectIdField)))),setAllFeaturesVisibility:e=>this.modifyGraphics3DGraphicVisibilities(t=>t.setVisibilityFlag(1,4,e)),clearFeaturesVisibility:()=>this.modifyGraphics3DGraphicVisibilities(e=>e.setVisibilityFlag(1,4,!0))}),this._deconflictor=t.deconflictor?.(this),this._labeler=t.labeler?.(this,this._scaleVisibility),this._objectStates=t.objectStates?.(this),this._initializeAbortController=new AbortController,this.addHandles(m(()=>this.owner.view.state.highlights,()=>{const{highlightOrderMap:e}=this.owner.view.state;this.graphics3DGraphics.forEach(t=>t.updateHighlights(e))})),this._initializePromise=this._initializeAsync()}async _initializeAsync(){const e=this._initializeAbortController?.signal,t=this.owner.view;this._viewElevationProvider=new le(this._viewSpatialReference,t),this._initializeStage(t,this.owner.layerViewUid);const i=t.sharedSymbolResources;this.symbolCreationContext.sharedResources=i,null!=this.currentRenderer&&(this.symbolCreationContext.renderer=this.currentRenderer),this.symbolCreationContext.stage=this.stage,this.symbolCreationContext.renderCoordsHelper=t.renderCoordsHelper,this.symbolCreationContext.layer=this.layer,this.symbolCreationContext.graphicsCoreOwner=this.owner,this.symbolCreationContext.localOriginFactory=new Ge(t.renderSpatialReference),this.symbolCreationContext.elevationProvider=t.elevationProvider,this.symbolCreationContext.notifyGraphicGeometryChanged=e=>this.notifyGraphicGeometryChanged(e),this.symbolCreationContext.notifyGraphicVisibilityChanged=e=>this.notifyGraphicVisibilityChanged(e);const r=he(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);if(this.symbolCreationContext.featureExpressionInfoContext=await de(r,this._viewSpatialReference,e,s.getLogger(this)),p(e),this.symbolCreationContext.screenSizePerspectiveEnabled=we(this.layer.screenSizePerspectiveEnabled),this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this.symbolCreationContext.physicalBasedRenderingEnabled=!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled,this.symbolCreationContext.skipHighSymbolLods=!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods,"drapeSourceType"in this.owner){const{owner:e}=this;this.symbolCreationContext.drapeSourceRenderer=t.overlayManager.registerGeometryDrapeSource(e)}this.addHandles([b(()=>this.suspendedOrOutsideOfView,()=>this._updateQueue.unshift(()=>this._updateLayerVisibility(),null).catch(c)),b(()=>we(this.layer?.screenSizePerspectiveEnabled),e=>{e!==this.symbolCreationContext.screenSizePerspectiveEnabled&&(this.symbolCreationContext.screenSizePerspectiveEnabled=e,this._screenSizePerspectiveEnabledChange())}),b(()=>this.owner.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(!!e)),b(()=>this.owner.view.state?.rasterPixelRatio,()=>this._pixelRatioChange()),b(()=>!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled,e=>this._physicalBasedRenderingChange(e)),b(()=>!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods,e=>this._skipHighSymbolLoDsChange(e)),b(()=>this.owner.view.focusAreasView?.polygons,()=>this._updateFocusedLabels()),b(()=>this.owner.view.map?.focusAreas.style,()=>this.recreateAllGraphicsAndSymbols()),b(()=>!!t.basemapTerrain&&!t.basemapTerrain.opaque&&!t.basemapTerrain.invisible,()=>this.terrainTransparencyChange()),m(()=>t.basemapTerrain?.tilingScheme,e=>{if(e.spatialReference.equals(this.symbolCreationContext.overlaySR)||null==t.basemapTerrain.spatialReference||(this.symbolCreationContext.overlaySR=t.basemapTerrain.spatialReference),this.hasHandles("loaded-graphics"))this.recreateAllGraphics();else{const e=()=>this.owner?.loadedGraphics;this.addHandles([_(e,"change",e=>{this._graphicsCollectionChanged(e),this._signalUpdatingDuringAsyncLoadedGraphicsChange()},{onListenerAdd:()=>{this.recreateAllGraphics(),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}})],"loaded-graphics")}},{initial:!0}),b(()=>this.effectiveUpdatePolicy,e=>{null!=this.stageLayer&&(this.stageLayer.updatePolicy=e),this.symbolCreationContext.isAsync=0===this.effectiveUpdatePolicy,1===e&&this.runTask(Le)},f)]),this._frameTaskHandle=t.resourceController.scheduler.registerTask(je.GRAPHICS_CORE,this),this.layer&&"featureReduction"in this.layer&&this.addHandles(b(()=>this.layer.featureReduction,()=>this._deconflictor?.featureReductionChange())),this.notifyChange("averageSymbolComplexity"),this.rendererChange(this.owner.renderer).catch(()=>{}),this._initializeAbortController=null}_abortInitialize(){this._initializeAbortController=n(this._initializeAbortController)}_updateFocusedLabels(){this._focusAreasGraphicsQueue.clear(),this.forEachGraphics3DSymbol((e,t)=>{t&&e.needsUpdateFocus&&t.forEach(e=>{this._focusAreasGraphicsQueue.push(e)})})}destroy(){if(this._unusedSymbolsCache.destroy(),this._abortInitialize(),this._rendererChangeAbortController=n(this._rendererChangeAbortController),this._abortElevationInfoChange(),this._frameTaskHandle.remove(),this._frameTaskHandle=Ee,this._dataUpdateQueue.cancelAll(),this._updateQueue.cancelAll(),this._deconflictor=o(this._deconflictor),this._labeler=o(this._labeler),this._elevationAlignment=l(this._elevationAlignment),this._scaleVisibility=l(this._scaleVisibility),this._filterVisibility=l(this._filterVisibility),this._objectStates=l(this._objectStates),this.clear(),"drapeSourceType"in this.owner){const{owner:e}=this;this.stage.view.overlayManager.unregisterDrapeSource(e)}this._featureStore=l(this._featureStore),this._updatingPendingLoadedGraphicsChange=o(this._updatingPendingLoadedGraphicsChange),this._graphicStateTracking=l(this._graphicStateTracking),this.stage&&(this.stageLayer=l(this.stageLayer),this.stage=null),this._set("owner",null);for(const e in this._whenGraphics3DGraphicRequests)this._whenGraphics3DGraphicRequests[e].reject(new r("graphic:layer-destroyed","Layer has been destroyed"));this._whenGraphics3DGraphicRequests=null,this._propertiesPool=l(this._propertiesPool),this._whenSymbolRemoved.prune(),this._symbolConversionCache.clear(),this._objectIdInvisibleSet.clear(),this._spatialIndex=l(this._spatialIndex),this._symbolMaterials=null}clear(){this._objectStates?.allGraphicsDeleted(),null!=this._graphicStateTracking&&this._graphicStateTracking.allGraphicsDeleted(),this.graphics3DGraphics.forEach(e=>e.destroy()),this._spatialIndex?.clear(),this.graphics3DGraphics.clear(),this._numberOfGraphics=0,this._usedMemory=0,this._updateLayerVisibility(),this._symbols.forEach(l),this._symbols.clear(),this._symbolMaterials&&(this._symbolMaterials.length=0,this._symbolMaterials=null),this._graphicsBySymbol.clear(),this._graphicsWithoutSymbol.clear(),this._graphicsWaitingForSymbol.clear(),this._pendingUpdates.clear(),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this.notifyChange("dataUpdating"),this.notifyChange("readyToRun"),this.notifyChange("updatingRemaining"),this._featureStore.events.emit("changed"),this.owner.notifyContentGeometryUpdate?.()}_initializeStage(e,t){this.stage=e.stage,this.stageLayer=new Pe(this.stage,{visible:!this.suspendedOrOutsideOfView,updatePolicy:this.effectiveUpdatePolicy},t);const i=this.stageLayer.events;i.on("transformationChanged",e=>this.notifyGraphicGeometryChanged(e.graphicUid)),i.on("shaderTransformationChanged",e=>this.notifyGraphicGeometryChanged(e.graphicUid)),i.on("visibilityChanged",e=>this.notifyGraphicVisibilityChanged(e.graphicUid)),i.on("geometryAdded",e=>this.notifyGraphicGeometryChanged(e.object.graphicUid)),i.on("geometryRemoved",e=>this.notifyGraphicGeometryChanged(e.object.graphicUid)),i.on("attributesChanged",e=>xe(e.attribute)&&this.notifyGraphicGeometryChanged(e.object.graphicUid))}notifyGraphicGeometryChanged(e){if(this.owner.notifyContentGeometryUpdate?.(),null==this._graphicStateTracking||null==e)return;const t=this.graphics3DGraphics.get(e);t&&this._graphicStateTracking.updateGraphicGeometry(t)}notifyGraphicVisibilityChanged(e){if(this.owner.notifyContentGeometryUpdate?.(),null==this._graphicStateTracking||null==e)return;const t=this.graphics3DGraphics.get(e);t&&this._graphicStateTracking.updateGraphicVisibility(t)}_updateLayerVisibility(){const e=this.displayFeatureLimit.maximumNumberOfFeatures,t=this._numberOfGraphics>e*We,i=!this.suspendedOrOutsideOfView&&!t;i!==this._visible&&(this._visible=i,this._updateStageLayerVisibility())}_updateStageLayerVisibility(){const e=this._visible&&(null==this.layer.opacity||this.layer.opacity>=Oe);this.stageLayer.visible!==e&&(this.stageLayer.visible=e,e?this.updateGraphicsVisibilities():this._hideAllGraphics(),this.owner.notifyContentGeometryUpdate?.())}getGraphics3DGraphicById(e){return null!=e?this.graphics3DGraphics.get(e):void 0}getGraphics3DGraphicByObjectId(e){return this.owner.layer?.objectIdField?this._findGraphics3DGraphicByObjectId(e):null}_getGraphicObjectID(e,t=this.owner.layer?.objectIdField){return B(e,t)}get graphics3DGraphicsByObjectID(){const e=this.owner.layer?.objectIdField;if(!e)return;const t=new Map;return this.graphics3DGraphics.forEach(i=>{if(!i)return;const r=i.graphic,s=this._getGraphicObjectID(r,e);null!=s&&t.set(s,i)}),t}get labelsEnabled(){return!!this._labeler?.layerLabelsEnabled()}async updateLabelingInfo(e){const t=this._deconflictor?.labelingInfoChange(e),i=this._labeler?.labelingInfoChange(e);await Promise.allSettled([t,i])}updateVisibilityInfo(){this._deconflictor?.labelingInfoChange(),this._labeler?.visibilityInfoChange()}get symbolUpdateType(){if(this._pendingUpdates.size>0)return"unknown";let e=!1,t=!1;for(const[i,r]of this._symbols)if(null!=r){switch(r.getFastUpdateStatus()){case 3:return"unknown";case 1:this._graphicsBySymbol.has(i)&&(t=!0);break;case 0:this._graphicsBySymbol.has(i)&&(e=!0);break;case 2:this._graphicsBySymbol.has(i)&&(t=e=!0)}}return t?e?"mixed":"fast":e?"slow":"mixed"}runTask(e){if(this._dataUpdateQueue.runTask(e),this._updateQueue.runTask(e),this._applyPendingUpdates(e),this._applyFocusAreasUpdates(e),this.notifyChange("readyToRun"),this.readyToRun||this.notifyChange("dataUpdating"),this.notifyChange("updatingRemaining"),!e.hasProgressed)return Ae}setObjectIdVisibility(e,t){t?this._objectIdInvisibleSet.delete(e):this._objectIdInvisibleSet.add(e);const i=this._findGraphics3DGraphicByObjectId(e);null!=i&&this._updateUserVisibility(i)}_findGraphics3DGraphicByObjectId(e){return a(this.graphics3DGraphics,t=>this._getGraphicObjectID(t.graphic)===e)}_updateUserVisibility(e){if(null==e)return!1;const t=e.graphic,i=this._getGraphicObjectID(t),r=t.visible&&!this.owner.suspended&&this.stageLayer.visible&&(null==i||!this._objectIdInvisibleSet.has(i));return e.setVisibilityFlag(1,1,r)}_whenGraphics3DGraphic(e){const t=this.graphics3DGraphics.get(e.uid);if(t)return Promise.resolve(t);const i=this._whenGraphics3DGraphicRequests[e.uid];if(i)return i.promise;const r=y();return this._whenGraphics3DGraphicRequests[e.uid]=r,r.promise}async _boundsForGraphics3DGraphic(e,t){const i=this._viewSpatialReference,r=this.owner.view.renderSpatialReference,s=this.owner.view.basemapTerrain.spatialReference,a=(e,t,s)=>j(e,r,t,e,i,t,s),n=(e,t,r)=>j(e,s,t,e,i,t,r),o=this._viewElevationProvider?{service:this._viewElevationProvider,useViewElevation:null!=t&&!!t.useViewElevation,minDemResolution:null!=t?t.minDemResolution:null,minDemResolutionForPoints:this.owner.view.resolution}:null,l=await e.getProjectedBoundingBox(a,n,o,t?.signal);if(!l)return null;const h=l.boundingBox;if(l.requiresDrapedElevation){const e=this.symbolCreationContext.elevationProvider;if(e){O(h,Te);const t=e.getElevation(Te[0],Te[1],0,i,"ground")??0;h[2]=Math.min(h[2],t),h[5]=Math.max(h[5],t)}}return{boundingBox:h,screenSpaceObjects:l.screenSpaceObjects}}async whenGraphicBounds(e,t){await v(()=>this.owner?.loadedGraphics);const i=this.owner.layer?.objectIdField,s=this.owner.loadedGraphics.find(t=>t===e||null!=i&&null!=t.attributes&&e.attributes&&t.attributes[i]===e.attributes[i]);if(!s)throw new r("internal:graphic-not-part-of-view","Graphic is not part of this view");const a=await this._whenGraphics3DGraphic(s);return this._boundsForGraphics3DGraphic(a,t)}computeAttachmentOrigin(e,t){const i=this.graphics3DGraphics.get(e.uid);if(!i)return null;const r=i.computeAttachmentOrigin();if(0===r.render.num&&0===r.draped.num)return null;P(He,0,0,0);let s=0;if(r.render.num>0){if(!V(r.render.origin,this.symbolCreationContext.renderCoordsHelper.spatialReference,Be,t))return null;R(He,He,Be),s++}if(r.draped.num>0){const[e,i]=r.draped.origin,a=this._viewElevationProvider.getElevation(e,i,"ground")??0;if(P(Be,e,i,a),!V(Be,this._viewElevationProvider.spatialReference,Be,t))return null;R(He,He,Be),s++}return s>1&&U(He,He,1/s),new E({x:He[0],y:He[1],z:He[2],spatialReference:t})}getSymbolLayerSize(e,t){const i=this._symbols.get(e.id);if(null==i)throw new r("internal:symbol-not-part-of-view","Symbol is not part of this view");const s=e.symbolLayers.indexOf(t);if(-1===s)throw new r("internal:missing-symbol-layer","Symbol layer is not in symbol");const a=i.getSymbolLayerSize(s);if(null==a)throw new r("internal:missing-size","Symbol layer has no valid size");return a}_graphicsCollectionChanged(e){this._startCreateGraphics&&(this.add(e.added),this.remove(e.removed))}graphicUpdateHandler(e){const t=e.graphic.uid,i=this.graphics3DGraphics.get(t);if(null!=i||null!=this._graphicsWithoutSymbol.get(t)){switch(e.property){case"visible":this._graphicUpdateVisibleHandler(i);break;case"geometry":this._graphicUpdateGeometryHandler(i,e.graphic);break;case"symbol":this._graphicUpdateSymbolHandler(i,e);break;case"attributes":{const t=this.symbolCreationContext.featureExpressionInfoContext;t?.arcade&&this._graphicUpdateGeometryHandler(i,e.graphic)}break;case"popupTemplate":break;case"origin-transform":this._graphicUpdateTransformHandler(i,e)}this.owner.notifyContentGeometryUpdate?.()}}_graphicUpdateGeometryHandler(e,t){this._graphicUpdateGeometryOrTransformHandler(e,t,()=>!(null==e||!e.graphics3DSymbol.updateGeometry(e)||!(this._labeler?.updateGraphicGeometry(e)??1))&&(this._labeler?.setDirty(),this._deconflictor?.setDirty(),!0));const i=t.geometry;null!=i&&this._expandComputedExtent(i)}_graphicUpdateTransformHandler(e,t){const i=t.graphic.geometry;this._graphicUpdateGeometryOrTransformHandler(e,t.graphic,()=>null!=t.newValue&&null!=e&&null!=i&&e.graphics3DSymbol.updateTransform(e,i.spatialReference,t.newValue,t.action))}_graphicUpdateGeometryOrTransformHandler(e,t,i){if(null!=t.geometry){if(null==e){const e=t.symbol?.id;if(e){const t=this._symbols.get(e);if(null!=t&&0===t.loadStatus)return}return void this._recreateGraphic(t)}i()||this._recreateGraphic(e.graphic)}else this._recreateGraphic(t)}_graphicUpdateSymbolHandler(e,t){const i=t.graphic,r=null!=e?e.graphics3DSymbol:null!=t.oldValue?this._symbols.get(t.oldValue.id):null;if(null==r||null==t.newValue)return void this._recreateGraphic(i);const s=r.symbol,a=this._getConvertedSymbol(t.newValue);if(null!=a&&(a.type!==s.type||"web-style"===a.type)||"web-style"===s.type)return void this._recreateGraphic(i);const n=this._graphicsBySymbol.get(s.id);if(n&&1!==n.size)return void this._recreateGraphic(i);const o=w(s,a);if(null==o)return void this._updateSymbolMapping(s.id,a);const l={diff:o,graphics3DGraphicPatches:[],symbolStatePatches:[]};if(r.prepareSymbolPatch(l),!x(l.diff))return void this._recreateGraphic(i);const h=this._getRenderingInfo(i,!1);if(null==h)return void this._recreateGraphic(i);const d=r.extentPadding;for(const p of l.symbolStatePatches)p();if(d!==r.extentPadding&&this._recomputeExtentPadding(),null!=e)for(const p of l.graphics3DGraphicPatches)p(e,h);this._updateSymbolMapping(s.id,a)}_graphicUpdateVisibleHandler(e){this._updateUserVisibility(e)&&(this._labeler?.setDirty(),this._deconflictor?.setDirty())}recreateGraphics(e){this._suspendSymbolCleanup=!0,this.remove(e),this.add(e),this._suspendSymbolCleanup=!1,1===this.effectiveUpdatePolicy&&this._cleanupSymbols()}_recreateGraphic(e){this.recreateGraphics([e])}_beginGraphicUpdate(e){const t=this._graphicsUpdateId;return this._graphicsUpdateId++,this._graphicsWaitingForSymbol.set(e.uid,t),1===this._graphicsWaitingForSymbol.size&&this.notifyChange("dataUpdating"),t}_endGraphicUpdate(e,t){e&&(t&&this._graphicStateTracking?.updateGraphicError(e,t),this._graphicsWaitingForSymbol.delete(e.uid),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("dataUpdating")))}_recomputeExtentPadding(){let e=0;this._symbols.forEach(t=>{null!=t&&(e=Math.max(e,t.extentPadding))}),this._set("extentPadding",e)}_expandComputedExtent(e){const t=Me,i=e.spatialReference;q(e,t);const r=this._viewSpatialReference,s=Fe.tmpVec;if(z(i,r)||A(t[0],t[1],0,i,s,r)&&(t[0]=s[0],t[1]=s[1],A(t[3],t[4],0,i,s,r),t[3]=s[0],t[4]=s[1]),!(isFinite(t[0])&&isFinite(t[3])&&isFinite(t[1])&&isFinite(t[4])))return;const a=this.computedExtent;let n=null;const o=isFinite(t[2])&&isFinite(t[5]),l=o&&(null==a?.zmin||t[2]<a.zmin),h=o&&(null==a?.zmax||t[5]>a.zmax);if(a){(t[0]<a.xmin||t[1]<a.ymin||t[3]>a.xmax||t[4]>a.ymax||l||h)&&(n=this._propertiesPool.get("computedExtent"),n.xmin=Math.min(t[0],a.xmin),n.ymin=Math.min(t[1],a.ymin),n.xmax=Math.max(t[3],a.xmax),n.ymax=Math.max(t[4],a.ymax),n.spatialReference=r)}else n=this._propertiesPool.get("computedExtent"),n.xmin=t[0],n.ymin=t[1],n.xmax=t[3],n.ymax=t[4],n.spatialReference=r;n&&(l&&(n.zmin=t[2]),h&&(n.zmax=t[5]),this._set("computedExtent",n))}_abortElevationInfoChange(){this._elevationInfoChangeAbortController&&(this._elevationInfoChangeAbortController.abort(),this._elevationInfoChangeAbortController=null)}async elevationInfoChange(){this._abortElevationInfoChange();const e=new AbortController;this._elevationInfoChangeAbortController=e;const t=he(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);this.symbolCreationContext.featureExpressionInfoContext=await de(t,this._viewSpatialReference,e.signal,s.getLogger(this)),p(e.signal),this._elevationInfoChangeAbortController=null,this._labeler?.elevationInfoChange(),this.forEachGraphics3DSymbol((e,t,i)=>{e.globalPropertyChanged("elevationInfo",t)?t?.forEach(e=>{const t=e.graphic,i=e.labelLayers;for(const r of i){r.graphics3DSymbolLayer.graphics3DGraphicLayerElevationInfoChanged(t,r)}}):this._recreateSymbol(i)}),this.updateStageLayerElevationProvider(),this._elevationAlignment?.elevationInfoChange()}updateStageLayerElevationProvider(){this._stageLayerElevationProvider?"relative-to-scene"!==this.layer.elevationInfo?.mode&&0!==this._numberOfGraphicsProvidingElevation||(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=l(this._stageLayerElevationProvider)):(!this.layer.elevationInfo||this.layer.elevationInfo&&"relative-to-scene"!==this.layer.elevationInfo.mode)&&this._numberOfGraphicsProvidingElevation>0&&(this._stageLayerElevationProvider=new Ce({layer:this.layer,stageLayer:this.stageLayer,view:this.owner.view}),this.owner.view.elevationProvider.register(2,this._stageLayerElevationProvider))}_clearSymbolsAndGraphics(){this.clear(),null!=this._filterVisibility&&this._filterVisibility.clear(),this._labeler?.reset(),this._deconflictor?.clear(),this._elevationAlignment?.clear(),this.stageLayer?.invalidateSpatialQueryAccelerator(),this._stageLayerElevationProvider&&(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=l(this._stageLayerElevationProvider))}startCreateGraphics(){this._startCreateGraphics=!0,this.recreateAllGraphics()}recreateAllGraphics(){this._recreateAllGraphics(!1)}recreateAllGraphicsAndSymbols(){this._recreateAllGraphics(!0)}_recreateAllGraphics(e=!1){if(!this._startCreateGraphics)return;const{loadedGraphics:t,view:i}=this.owner,r=i.basemapTerrain?.tilingScheme&&t?.length?t.toArray():null;!e&&r||this._clearSymbolsAndGraphics(),this.symbolCreationContext.screenSizePerspectiveEnabled=we(this.layer.screenSizePerspectiveEnabled),this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this._set("computedExtent",null),r&&(e?this.add(r):this.recreateGraphics(r))}_recreateSymbol(e){const t=this._graphicsBySymbol.get(e),i=[];t&&(t.forEach((e,t)=>{const r=e.usedMemory;this._conditionalRemove(e,t),this._spatialIndex?.remove(e),i.push(e.graphic),e.destroy(),this._removeGraphics3DGraphic(t,r),this._updateLayerVisibility(),this._featureStore.events.emit("changed"),this.owner.notifyContentGeometryUpdate?.()}),this._graphicsBySymbol.set(e,new Map));const r=this._symbols.get(e);l(r),this._symbols.delete(e),this._symbolMaterials=null,l(this._unusedSymbolsCache.pop(e)),this.add(i)}_recreateGraphicsForSymbol(e){const t=this._graphicsBySymbol.get(e);if(t){const e=[];t.forEach(t=>e.push(t.graphic)),this.recreateGraphics(e)}}_conditionalRemove(e,t){this._graphicsDrapedUids.delete(t),this._objectStates?.removeGraphic(e),this._labeler?.removeGraphic(e),this._deconflictor?.removeGraphic(e),null!=this._graphicStateTracking&&this._graphicStateTracking.removeGraphic(e)}add(e){e&&0!==e.length&&(this.owner.view.basemapTerrain?.tilingScheme?(0===this._updatePolicyForGraphics(e)?this._addDelayed(e):this._addImmediate(e),this.notifyChange("dataUpdating")):s.getLogger(this).error("#add()","Cannot add graphics before terrain surface has been initialized"))}_updatePolicyForGraphics(e){if(1===this.effectiveUpdatePolicy&&("mesh"===this.layer.geometryType||null==this.layer.geometryType))for(const t of e)if(null!=t.geometry&&"mesh"===t.geometry.type&&!t.geometry.loaded)return 0;return this.effectiveUpdatePolicy}_addImmediate(e){this._geometryWarningLogged=!1,this._symbolWarningLogged=!1;for(const t of e)this._addGraphic(t,this._getRenderingInfo(t),1);this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_addDelayed(e){for(const t of e){const e=t.uid;let i=this._pendingUpdates.get(e);i?i.add?0!==i.state&&i.abortController?.abort():this._pendingAdds++:(i=new ze,this._pendingAdds++,this._pendingUpdates.set(e,i)),i.add=t}this.notifyChange("readyToRun"),this.notifyChange("updatingRemaining"),this.notifyChange("dataUpdating")}remove(e){0===this.effectiveUpdatePolicy?this._removeDelayed(e):this._removeImmediate(e),this.notifyChange("dataUpdating")}_removeImmediate(e){for(const t of e)this._removeGraphic(t);this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_removeDelayed(e){for(const t of e){const e=t.uid,i=this._pendingUpdates.get(e);if(i)i.add&&(i.remove?i.add=null:this._pendingUpdates.delete(e),1===i.state&&i.abortController?.abort(),this._pendingAdds--);else{const i=new ze;i.remove=t,this._pendingUpdates.set(e,i),this._pendingRemoves++,this._applyPendingRemovesFirst=!0}}0===this._pendingUpdates.size&&this._finishPendingUpdates(),this.notifyChange("readyToRun"),this.notifyChange("updatingRemaining"),this.notifyChange("dataUpdating")}_finishPendingUpdates(){this._cleanupSymbols(),(this._pendingAdds||this._pendingRemoves)&&s.getLogger(this).warn("pendingAdds/Removes in inconsistent state!"),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1}_applyFocusAreasUpdates(e){for(;this._focusAreasGraphicsQueue.length>0&&!e.done;){e.madeProgress();const t=this._focusAreasGraphicsQueue.pop(),i=fe(t.graphic.geometry);if(null==i)continue;const r=this.stage.view.focusAreasView?.containsGeometry(i)??!0;t.layers.forEach(e=>{if(e.stageObject){e.stageObject.geometries.some(e=>e.material instanceof Re&&e.material.parameters.isFocused!==r)&&this.recreateGraphics([t.graphic])}})}0===this._focusAreasGraphicsQueue.length&&this.notifyChange("readyToRun")}_applyPendingUpdates(e){if(this._geometryWarningLogged=!1,this._symbolWarningLogged=!1,0===this._pendingUpdates.size&&this._spatialIndex?.updating)return this._spatialIndex.update(),void e.madeProgress();if(this._applyPendingRemovesFirst){this._applyPendingRemovesFirst=!1;for(const[t,i]of this._pendingUpdates){if(e.done){this._applyPendingRemovesFirst=!0;break}if(i.remove&&!i.add&&(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(i.remove),i.remove=null,this._pendingUpdates.delete(t),0===this._pendingRemoves))break}}for(const[t,i]of this._pendingUpdates){if(e.done)break;i.add&&0===i.state&&this._processPendingUpdateNew(i);let r=this.effectiveUpdatePolicy;if(!i.remove||i.add&&2!==i.state||(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(i.remove),i.remove=null,r=1),i.add)switch(i.state){case 2:this._addGraphic(i.add,i.renderingInfo,r),i.add=null,this._pendingAdds--,e.madeProgress();break;case 3:i.add=null,this._pendingAdds--}null==i.remove&&null==i.add&&this._pendingUpdates.delete(t)}0===this._pendingUpdates.size&&(this._finishPendingUpdates(),this.notifyChange("readyToRun"),this.notifyChange("dataUpdating"))}_processPendingUpdateNew(e){if(!e.add)return void(e.state=2);const t=e.add.geometry;null==t||"mesh"!==t.type||t.loaded?this._processPendingUpdateNewRenderingInfo(e):this._processPendingUpdateNewMesh(e,t)}async _processPendingUpdateNewMesh(e,t){e.state=1,e.abortController=new AbortController;const i=e.abortController.signal;try{await t.load({signal:i})}catch(r){return this._processPendingUpdateNewError(e,r)}e.abortController=null,this._processPendingUpdateNewRenderingInfo(e)}_processPendingUpdateNewError(e,t){e.abortController=null,u(t)?e.state=0:e.state=3}async _processPendingUpdateNewRenderingInfo(e){if(null==this.layer.renderer||"dictionary"!==this.layer.renderer.type)return e.renderingInfo=this._getRenderingInfo(e.add),void(e.state=2);e.state=1,e.abortController=new AbortController;let t=null;try{t=await this._getRenderingInfoAsync(e.add,{signal:e.abortController.signal})}catch(i){return e.abortController=null,void(u(i)?e.state=0:e.state=3)}null==t?.symbol?(this._symbolWarningLogged||(this._symbolWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),e.renderingInfo=null):e.renderingInfo=t,e.state=2}_addGraphic(e,t,i){if(this._graphicsWithoutSymbol.set(e.uid,e),null==t?.symbol||!Q(e))return;const r=this.stage.renderView.olidRenderHelper;if(r&&this.setUidToIdOnAdd){const t=J(this.owner.view,this.owner.layerViewUid);r.setUidToObjectAndLayerId(e.objectId,e.uid,this.layer.id,this.owner.layerViewUid,W(this.layer)&&!!this.layer.popupEnabled&&!t&&Ue(this.layer,this.owner.view.popup?.defaultPopupTemplateEnabled))}const s=t.symbol,a=this.getOrCreateGraphics3DSymbol(s,t.renderer);if(null==a)return;this._expandComputedExtent(e.geometry);const n=this._beginGraphicUpdate(e),o=new ce(e,t,this.layer);let l=!1;const h=e=>{e===a.symbol.id&&(l=!0)};this._whenSymbolRemoved.push(h);const d=()=>{if(--this._loadingSymbols,this.destroyed)return;this._whenSymbolRemoved.removeUnordered(h);if(this._graphicsWaitingForSymbol.get(e.uid)!==n||l||a.destroyed||this.graphicSymbolSupported&&e.symbol&&e.symbol.id!==a.symbol.id)--a.referenced,this._cleanupSymbols();else{const t=this._createGraphics3DGraphic(a,o);this._spatialIndex&&null!=t&&this._spatialIndex.add(t),--a.referenced,this._endGraphicUpdate(e)}this._featureStore.events.emit("changed"),this.owner.notifyContentGeometryUpdate?.(),this._labeler?.setDirty()},p=t=>{--this._loadingSymbols,this.destroyed||(this._whenSymbolRemoved.removeUnordered(h),l||(u(t)?this.add([e]):a.destroyed||this._endGraphicUpdate(e,t)))};++this._loadingSymbols,0===i?a.load(()=>this._dataUpdateQueue.push(d,null).catch(c),e=>this._dataUpdateQueue.push(()=>p(e),null).catch(c)):a.load(d,p)}_removeGraphic(e){const t=e.uid,i=this.graphics3DGraphics.get(t);if(i){i.graphics3DSymbol.onRemoveGraphic(i);const e=i.usedMemory,r=i.isElevationSource;this._conditionalRemove(i,t),this._spatialIndex?.remove(i);const s=i.graphics3DSymbol.symbol.id;this._graphicsBySymbol.get(s)?.delete(t),this._graphicsWithoutSymbol.delete(t),this._removeGraphics3DGraphic(t,e,r),i.destroy(),this._featureStore.events.emit("changed"),this.owner.notifyContentGeometryUpdate?.()}else this._graphicsWithoutSymbol.delete(t),this._graphicsWaitingForSymbol.delete(t),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("dataUpdating"))}_hasLabelingContext(e){if(e instanceof ee||e instanceof te){const t=this.symbolCreationContext.layer;return!!t.labelingInfo&&t.labelingInfo.some(t=>t.symbol===e)}return!1}_hasValidSymbolCreationContext(e){return!(e instanceof ee&&!this._hasLabelingContext(e))||(s.getLogger(this).error("LabelSymbol3D is only valid as part of a LabelClass. Using LabelSymbol3D as a renderer symbol is not supported."),!1)}_getRenderingInfo(e,t=!0){const i=e.geometry;if(null==i)return t&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!L(i.spatialReference,this._viewSpatialReference))return t&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} has incompatible spatial reference and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return t&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const r=this.rendererHasGeometryOperations?N(e,this.layer,null):e;let a;if(this.owner.getRenderingInfo&&(this.getRenderingInfoWithoutRenderer||null!=this.currentRenderer))a=this.owner.getRenderingInfo(r,this.currentRenderer,this._arcadeOnDemand);else{const e=r.symbol||re(r.geometry);a=new X(null,e)}return null==a?.symbol?(t&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),null):a}_getRenderingInfoAsync(e,t){if(null==e.geometry)return this._geometryWarningLogged||(this._geometryWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return this._symbolWarningLogged||(this._symbolWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const i=this.rendererHasGeometryOperations?N(e,this.layer,null):e;return this.owner.getRenderingInfoAsync(i,this.currentRenderer,this._arcadeOnDemand,t)}_createGraphics3DSymbol(e,t){if(!this._hasValidSymbolCreationContext(e))return null;const i=this._getConvertedSymbol(e);if(!i)return null;let r;if(null!=t&&"backgroundFillSymbol"in t&&t.backgroundFillSymbol){const e=se(t.backgroundFillSymbol,{ignoreDrivers:!0});null!=e.symbol&&(r=e.symbol.symbolLayers)}const s=ue(i,this.symbolCreationContext,r);return s.load(()=>{const e=s.extentPadding;e>this.extentPadding&&this._set("extentPadding",e),this.notifyChange("averageSymbolComplexity")},()=>{}),s}getOrCreateGraphics3DSymbol(e,t){let i=this._symbols.get(e.id);if(void 0===i){const r=this._unusedSymbolsCache.pop(e.id);i=null!=r?r:e instanceof ie?new ge(e,e=>this._dataUpdateQueue.push(e,null),e=>this._createGraphics3DSymbol(e,t)):this._createGraphics3DSymbol(e,t),this._symbols.set(e.id,i),this._symbolMaterials=null}return null!=i&&++i.referenced,i}trackGraphicState(e){return null==this._graphicStateTracking&&(this._graphicStateTracking=new be(this)),this._graphicStateTracking.add(e)}_addGraphics3DGraphic(e){this._usedMemory+=e.usedMemory,this.graphics3DGraphics.set(e.graphic.uid,e),this._numberOfGraphics++,e.isElevationSource&&(this._numberOfGraphicsProvidingElevation++,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_removeGraphics3DGraphic(e,t,i=!1){this._usedMemory-=t,this.graphics3DGraphics.delete(e),this._numberOfGraphics--,i&&(this._numberOfGraphicsProvidingElevation--,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_createGraphics3DGraphic(e,t){const{graphic:i}=t;if(this._graphicsWithoutSymbol.delete(i.uid),!this._symbols.has(e.symbol.id))return this.add([i]),null;if(this.graphics3DGraphics.has(i.uid))return null;const r=e.createGraphics3DGraphic(t);if(null==r)return null;this._addGraphics3DGraphic(r);const s=e.symbol.id;this._graphicsBySymbol.has(s)||this._graphicsBySymbol.set(s,new Map),this._graphicsBySymbol.get(s).set(i.uid,r);if(r.isDraped&&this._graphicsDrapedUids.add(i.uid),r.centroid=null,null!=i.geometry&&"point"!==i.geometry.type&&(r.centroid=_e(i.geometry,this._viewSpatialReference)),this._updateUserVisibility(r),null!=this._scaleVisibility&&this._scaleVisibility.updateVisibility(r),null!=this._filterVisibility){const{defaultVisibility:e}=this._filterVisibility;r.setVisibilityFlag(1,4,e),e||this._filterVisibility.reapply()}this._deconflictor?.addGraphic(r),this._labeler?.addGraphic(r),this._objectStates?.addGraphic(r),r.initialize(this.stageLayer),null!=this._graphicStateTracking&&this._graphicStateTracking.addGraphic(r);const a=this._whenGraphics3DGraphicRequests[i.uid];return a&&(delete this._whenGraphics3DGraphicRequests[i.uid],a.resolve(r)),this._symbolMaterials=null,r}async rendererChange(e){if(this._rendererChangeAbortController=n(this._rendererChangeAbortController),e!==this.currentRenderer)if(this._validateRenderer(e),null==e&&this._currentRendererChange(null,!1),Z(e))if(e?.arcadeRequired){const t=new AbortController;this._rendererChangeAbortController=t;const{arcadeUtils:i}=await this._ensureArcade();p(t);const r=i.hasGeometryOperations(e);r&&(await i.enableGeometryOperations(),p(t)),0===this.effectiveUpdatePolicy?await this._updateQueue.push(()=>this._currentRendererChange(e,r),t.signal):this._currentRendererChange(e,r),this._rendererChangeAbortController=null}else if(0===this.effectiveUpdatePolicy){const t=new AbortController;this._rendererChangeAbortController=t,await this._updateQueue.push(()=>this._currentRendererChange(e,!1),t.signal),this._rendererChangeAbortController=null}else this._currentRendererChange(e,!1);else this._currentRendererChange(e,!1)}async _ensureArcade(){return null==this._arcadeOnDemand?(this._arcadeOnDemand=await K(),this._arcadeOnDemand):this._arcadeOnDemand}_currentRendererChange(e,t){this.currentRenderer=e,this.rendererHasGeometryOperations=t,this.symbolCreationContext.arcade=this._arcadeOnDemand;const i=this.symbolCreationContext.renderer;if(e===i)return;if(this._symbolConversionCache.clear(),this._unusedSymbolsCache.clear(),null==e)return this.symbolCreationContext.renderer=null,void this.recreateAllGraphicsAndSymbols();const r=w(i,e);this._updateUnchangedSymbolMappings(r,e,i),this.symbolCreationContext.renderer=e,null!=r&&("complete"===r.type?this.recreateAllGraphicsAndSymbols():"partial"===r.type&&(this._applyRendererDiff(r,e,i)?this._labeler?.reset():this.recreateAllGraphicsAndSymbols()),this.notifyChange("averageSymbolComplexity"))}_diffHasSymbolChange(e){for(const t in e.diff)switch(t){case"visualVariables":case"defaultSymbol":case"uniqueValueInfos":break;case"uniqueValueGroups":case"authoringInfo":case"fieldDelimiter":delete e.diff[t];break;default:return!0}return!1}_applySymbolSetDiff(e,t,i){e=e||[],t=t||[];const r=[];for(const s of t){const t=this._graphicsBySymbol.get(s.id);t&&t.forEach((a,n)=>{const o=a.graphic,l=this.layer instanceof H?this.layer:null,h=this._arcadeOnDemand;if(s===i.defaultSymbol&&i.getSymbol(N(o,l,null),{arcade:h})===i.defaultSymbol)return;const d=a.usedMemory;e.length||i.defaultSymbol?r.push(o):this._graphicsWithoutSymbol.set(n,o);const p=this.graphics3DGraphics.get(n);this._conditionalRemove(p,n),a.destroy(),t.delete(n),this._removeGraphics3DGraphic(n,d),this._updateLayerVisibility()}),this._whenSymbolRemoved.forAll(e=>e(s.id))}(e.length||r.length)&&(this._graphicsWithoutSymbol.forEach(e=>r.push(e)),this._graphicsWithoutSymbol.clear(),this.add(r)),this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_applyUniqueValueRendererDiff(e,t,r){const s=e.diff.defaultSymbol,a=e.diff.uniqueValueInfos;if(s||a){const n=a?.changed,o=a?.unchanged;if(n&&o&&n.some(e=>o.some(t=>t.oldValue.symbol?.id===e.oldValue.symbol?.id)))return!1;const l=a?a.added.map(e=>e.symbol).filter(i):[],h=a?a.removed.map(e=>e.symbol).filter(i):[];if(n)for(let e=0;e<n.length;e++)l.push(n[e].newValue.symbol),h.push(n[e].oldValue.symbol);return s?(r.defaultSymbol&&h.push(r.defaultSymbol),t.defaultSymbol&&l.push(t.defaultSymbol)):r.defaultSymbol&&l.length&&h.push(t.defaultSymbol),this._applySymbolSetDiff(l,h,t),delete e.diff.defaultSymbol,delete e.diff.uniqueValueInfos,!0}return!1}_calculateUnchangedSymbolMapping(e,t,i){if("unique-value"!==t?.type||"unique-value"!==i?.type||null!=e&&"partial"!==e.type)return[];const r=e=>null!=e?e.id:null,s=e&&e.diff,a=s?.defaultSymbol,n=s&&s.uniqueValueInfos;let o;if(n)o=n.unchanged.map(e=>({oldId:r(e.oldValue.symbol),newId:r(e.newValue.symbol)}));else{o=[];for(const e of i.uniqueValueInfos??[]){const i=r(e.symbol),s=t.uniqueValueInfos?.find(t=>t.value===e.value);s&&i!==r(s.symbol)&&o.push({oldId:i,newId:r(s.symbol)})}}return!a&&i.defaultSymbol&&o.push({oldId:r(i.defaultSymbol),newId:r(t.defaultSymbol)}),o}_updateSymbolMapping(e,t){const i=null!=t&&t?"string"==typeof t?t:t.id:null;if(null==e||e===i)return;const r=this._graphicsBySymbol.get(e);this._graphicsBySymbol.delete(e),void 0!==r&&this._graphicsBySymbol.set(i,r);const s=this._symbols.get(e);if(void 0!==s&&(this._symbols.delete(e),this._symbols.set(i,s),this._symbolMaterials=null,null!=s)){const e="string"==typeof t?null:t;null!=e?s.symbol=e:s.symbol.id=i}}_updateUnchangedSymbolMappings(e,t,i){const r=this._calculateUnchangedSymbolMapping(e,t,i);for(const{oldId:s,newId:a}of r)this._updateSymbolMapping(s,a)}_applyRendererDiff(e,t,i){if(this._diffHasSymbolChange(e))return!1;if(t instanceof $&&i instanceof $&&this._applyUniqueValueRendererDiff(e,t,i)&&0===Object.keys(e.diff).length)return!0;for(const r of this._graphicsBySymbol.keys()){const i=this._symbols.get(r);if(null!=i)switch(i.applyRendererDiff(e,t)){case 0:this._recreateSymbol(r);break;case 1:this._recreateGraphicsForSymbol(r)}}return!0}terrainTransparencyChange(){this.forEachGraphics3DSymbol((e,t,i)=>{e.globalPropertyChanged("terrainTransparency",t)||this._recreateSymbol(i)}),this.labeler?.reset()}opacityChange(){this._updateStageLayerVisibility(),this.forEachGraphics3DSymbol((e,t)=>e.globalPropertyChanged("opacity",t))}_screenSizePerspectiveEnabledChange(){this.forEachGraphics3DSymbol((e,t)=>e.globalPropertyChanged("screenSizePerspectiveEnabled",t)),this._labeler?.screenSizePerspectiveEnabledChanged(),this._deconflictor?.screenSizePerspectiveEnabledChanged()}_slicePlaneEnabledChange(e){e!==this.symbolCreationContext.slicePlaneEnabled&&(this.symbolCreationContext.slicePlaneEnabled=e,this.stageLayer.sliceable=e,this.forEachGraphics3DSymbol((e,t)=>e.globalPropertyChanged("slicePlaneEnabled",t)),this._deconflictor?.slicePlaneEnabledChange(),this._labeler?.slicePlaneEnabledChange())}_physicalBasedRenderingChange(e){this.symbolCreationContext.physicalBasedRenderingEnabled=e,this.forEachGraphics3DSymbol((e,t,i)=>{e.globalPropertyChanged("physicalBasedRenderingEnabled",t)||this._recreateSymbol(i)})}_skipHighSymbolLoDsChange(e){this.symbolCreationContext.skipHighSymbolLods=e,this.forEachGraphics3DSymbol((e,t,i)=>{e.globalPropertyChanged("skipHighSymbolLods",t)||this._recreateSymbol(i)})}_pixelRatioChange(){this.forEachGraphics3DSymbol((e,t,i)=>{e.globalPropertyChanged("pixelRatio",t)||this._recreateSymbol(i)})}_signalUpdatingDuringAsyncLoadedGraphicsChange(){this._updatingPendingLoadedGraphicsChange&&this._updatingPendingLoadedGraphicsChange.remove(),this._updatingPendingLoadedGraphicsChange=C(()=>{this._updatingPendingLoadedGraphicsChange=null})}setClippingExtent(e,t){const i=this.symbolCreationContext.clippingExtent,r=k();return Se(e,r,t)?this.symbolCreationContext.clippingExtent=T(F(),r):this.symbolCreationContext.clippingExtent=null,!M(this.symbolCreationContext.clippingExtent,i)}modifyGraphics3DGraphicVisibilities(e){if(this.destroyed)return;let t=!1;this.graphics3DGraphics.forEach(i=>{e(i)&&(t=!0)}),t&&(this._labeler?.setDirty(),this._deconflictor?.setDirty())}forEachGraphics3DSymbol(e,t){for(const[i,r]of this._symbols){if(null==r)return;e(r,this._graphicsBySymbol.get(i)||qe,i)}if(!t?.excludeUnused)for(const i of this._unusedSymbolsCache)e(i,void 0,i.symbol.id)}updateGraphicsVisibilities(){null!=this._filterVisibility&&this._filterVisibility.reapply(),this.modifyGraphics3DGraphicVisibilities(e=>{const t=this._updateUserVisibility(e),i=!!this._scaleVisibility?.updateVisibility(e);return t||i})}_hideAllGraphics(){this.modifyGraphics3DGraphicVisibilities(e=>e.setVisibilityFlag(1,1,!1))}_validateRenderer(e){const t=()=>`'${this.layer.title?`${this.layer.title}, `:""}id:${this.layer.id}'`,i=Y(e,{geometryType:this.layer?.geometryType,logWarning:(e,i)=>s.getLogger(this).warn(e,`Symbology conversion for layer ${t()}: ${i}`)});if(i){const e=`Renderer for layer ${t} is not supported in a SceneView`;s.getLogger(this).warn(e,i.message)}}_cleanupSymbols(){if(this._graphicsWaitingForSymbol.size>0||this._suspendSymbolCleanup)return;let e=!1;this._symbols.forEach((t,i)=>{if(null==t||t.referenced>0)return;const r=this._graphicsBySymbol.get(i);r&&0!==r.size||(this._graphicsBySymbol.delete(i),this._symbols.delete(i),this._symbolMaterials=null,this._unusedSymbolsCache.put(i,t,h),e=!0)}),e&&(this._recomputeExtentPadding(),this.notifyChange("averageSymbolComplexity"))}get test(){}get performanceInfo(){return new me(this.graphics3DGraphics.size,Array.from(this.graphics3DGraphics.values()).reduce((e,t)=>e+(t.isVisible()?1:0),0),this._graphicsWithoutSymbol.size,this._pendingUpdates.size)}};e([S({readOnly:!0})],ke.prototype,"computedExtent",void 0),e([S()],ke.prototype,"currentRenderer",void 0),e([S()],ke.prototype,"rendererHasGeometryOperations",void 0),e([S()],ke.prototype,"_frameTaskHandle",void 0),e([S()],ke.prototype,"_dataUpdateQueue",void 0),e([S()],ke.prototype,"_updateQueue",void 0),e([S({readOnly:!0})],ke.prototype,"_viewSpatialReference",null),e([S()],ke.prototype,"_rendererChangeAbortController",void 0),e([S()],ke.prototype,"_elevationInfoChangeAbortController",void 0),e([S()],ke.prototype,"_initializeAbortController",void 0),e([S()],ke.prototype,"_elevationAlignment",void 0),e([S()],ke.prototype,"_scaleVisibility",void 0),e([S()],ke.prototype,"_filterVisibility",void 0),e([S()],ke.prototype,"_initializePromise",void 0),e([S()],ke.prototype,"_spatialIndex",void 0),e([S({readOnly:!0})],ke.prototype,"extentPadding",void 0),e([S()],ke.prototype,"_updatingPendingLoadedGraphicsChange",void 0),e([S()],ke.prototype,"_featureStore",void 0),e([S()],ke.prototype,"_objectStates",void 0),e([S()],ke.prototype,"_loadingSymbols",void 0),e([S({constructOnly:!0})],ke.prototype,"compressionTracker",void 0),e([S()],ke.prototype,"preferredUpdatePolicy",void 0),e([S()],ke.prototype,"_forcedUpdatePolicy",void 0),e([S({readOnly:!0})],ke.prototype,"effectiveUpdatePolicy",null),e([S({constructOnly:!0})],ke.prototype,"elevationFeatureExpressionEnabled",void 0),e([S({constructOnly:!0})],ke.prototype,"owner",void 0),e([S({constructOnly:!0})],ke.prototype,"layer",void 0),e([S({constructOnly:!0})],ke.prototype,"graphicSymbolSupported",void 0),e([S({constructOnly:!0})],ke.prototype,"getRenderingInfoWithoutRenderer",void 0),e([S({constructOnly:!0})],ke.prototype,"componentFactories",void 0),e([S({constructOnly:!0})],ke.prototype,"setUidToIdOnAdd",void 0),e([S()],ke.prototype,"featureStore",null),e([S()],ke.prototype,"initializePromise",null),e([S()],ke.prototype,"scaleVisibility",null),e([S()],ke.prototype,"elevationAlignment",null),e([S()],ke.prototype,"objectStates",null),e([S()],ke.prototype,"filterVisibility",null),e([S({readOnly:!0})],ke.prototype,"updating",null),e([S({readOnly:!0})],ke.prototype,"dataUpdating",null),e([S({readOnly:!0})],ke.prototype,"readyToRun",null),e([S({readOnly:!0})],ke.prototype,"suspendedOrOutsideOfView",null),e([S({readOnly:!0,dependsOn:[]})],ke.prototype,"updatingRemaining",null),e([S({readOnly:!0})],ke.prototype,"displayFeatureLimit",null),e([S({readOnly:!0,dependsOn:[]})],ke.prototype,"averageSymbolComplexity",null),e([S({constructOnly:!0})],ke.prototype,"hasZ",void 0),e([S({constructOnly:!0})],ke.prototype,"hasM",void 0),e([S()],ke.prototype,"_objectIdField",null),ke=Fe=e([G("esri.views.3d.layers.graphics.Graphics3DCore")],ke);class ze{constructor(){this.add=null,this.renderingInfo=null,this.state=0,this.abortController=null,this.remove=null}clear(){this.add=null,this.renderingInfo=null,this.state=0,this.abortController=null,this.remove=null}}const We=10,He=D(),Be=D(),qe=new Map;export{ke as Graphics3DCore};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{isSome as i}from"../../../../core/arrayUtils.js";import r from"../../../../core/Error.js";import"../../../../core/has.js";import s from"../../../../core/Logger.js";import{findInMap as a}from"../../../../core/MapUtils.js";import{abortMaybe as n,removeMaybe as o,destroyMaybe as l}from"../../../../core/maybe.js";import{MinPriority as h}from"../../../../core/MemCache.js";import d from"../../../../core/PooledArray.js";import{throwIfAborted as p,ignoreAbortErrors as c,createResolver as y,isAbortError as u}from"../../../../core/promiseUtils.js";import g from"../../../../core/Queue.js";import{when as m,watch as b,on as _,syncAndInitial as f,whenOnce as v}from"../../../../core/reactiveUtils.js";import{schedule as C}from"../../../../core/scheduling.js";import{property as S,subclass as G}from"../../../../core/accessorSupport/decorators.js";import{diff as w,isEmpty as x}from"../../../../core/accessorSupport/diffUtils.js";import{h as P,i as R,j as U}from"../../../../chunks/vec32.js";import{create as D}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import I from"../../../../geometry/Extent.js";import E from"../../../../geometry/Point.js";import{canProjectWithoutEngine as L}from"../../../../geometry/projectionUtils.js";import{projectBuffer as j}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as V}from"../../../../geometry/projection/projectVectorToVector.js";import{projectXYZToVector as A}from"../../../../geometry/projection/projectXYZToVector.js";import{center as O,create as F,fromRect as T,equals as M}from"../../../../geometry/support/aaBoundingBox.js";import{create as k}from"../../../../geometry/support/aaBoundingRect.js";import{equals as z}from"../../../../geometry/support/spatialReferenceUtils.js";import{isPopupProvider as W}from"../../../../graphic/getPopupProvider.js";import H from"../../../../layers/Layer.js";import{getObjectId as B,computeAABB as q,hasGeometry as Q}from"../../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as N}from"../../../../layers/graphics/hydratedFeatures.js";import $ from"../../../../renderers/UniqueValueRenderer.js";import{isSupportedRenderer3D as Z,validateTo3D as Y}from"../../../../renderers/support/rendererConversion.js";import{RenderingInfo as X}from"../../../../renderers/support/RenderingInfo.js";import{isBasemapLayerView as J}from"../../../../support/basemapUtils.js";import{loadArcade as K}from"../../../../support/loadArcade.js";import ee from"../../../../symbols/LabelSymbol3D.js";import te from"../../../../symbols/TextSymbol.js";import ie from"../../../../symbols/WebStyleSymbol.js";import{getDefaultSymbol3D as re}from"../../../../symbols/support/defaults3D.js";import{to3D as se}from"../../../../symbols/support/symbolConversion.js";import{averageSymbolComplexities as ae,defaultSymbolComplexity as ne}from"./defaultSymbolComplexity.js";import{DisplayFeatureLimit as oe}from"./DisplayFeatureLimit.js";import{ViewElevationProvider as le}from"./ElevationQuery.js";import{extractExpressionInfo as he,createContext as de}from"./featureExpressionInfoUtils.js";import{Graphics3DFeatureStore as pe}from"./Graphics3DFeatureStore.js";import{Graphics3DGraphicCreationContext as ce}from"./Graphics3DGraphicCreationContext.js";import{Graphics3DSymbolCreationContext as ye}from"./Graphics3DSymbolCreationContext.js";import{make as ue}from"./Graphics3DSymbolFactory.js";import{Graphics3DWebStyleSymbol as ge}from"./Graphics3DWebStyleSymbol.js";import{GraphicsCorePerformanceInfo as me}from"./GraphicsCorePerformanceInfo.js";import{GraphicStateTracking as be}from"./GraphicStateTracking.js";import{computeCentroid as _e}from"./graphicUtils.js";import{placePointOnGeometry as fe}from"./pointUtils.js";import{SpatialIndex2D as ve}from"./SpatialIndex2D.js";import{StageLayerElevationProvider as Ce}from"../support/StageLayerElevationProvider.js";import{toBoundingRect as Se}from"../../support/extentUtils.js";import{GridLocalOriginFactory as Ge}from"../../webgl-engine/lib/GridLocalOriginFactory.js";import{isScreenSizePerspectiveEnabled as we}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{affectsGeometry as xe}from"../../webgl-engine/lib/VertexAttribute.js";import{WebGLLayer as Pe}from"../../webgl-engine/lib/WebGLLayer.js";import{HUDMaterial as Re}from"../../webgl-engine/materials/HUDMaterial.js";import{hasPopupTemplate as Ue}from"../../../layers/support/popupUtils.js";import{PromiseQueue as De}from"../../../support/PromiseQueue.js";import{PropertiesPool as Ie}from"../../../support/PropertiesPool.js";import{ImmediateTask as Ee,noBudget as Le,TaskPriority as je}from"../../../support/Scheduler.js";import{TextureCompressionTracker as Ve}from"../../../support/TextureCompressionTracker.js";import{Yield as Ae}from"../../../support/Yield.js";import{alphaCutoff as Oe}from"../../../../webscene/support/AlphaCutoff.js";var Fe;const Te=D(),Me=F();let ke=class extends t{static{Fe=this}static{this.tmpVec=D()}get _viewSpatialReference(){return this.owner.view.spatialReference}get spatialIndex(){return this._spatialIndex||(this._spatialIndex=new ve({objectIdField:this.owner.layer?.objectIdField,spatialReference:this._viewSpatialReference,hasZ:!!this.hasZ,hasM:!!this.hasM}),this._spatialIndex.setup(Array.from(this.graphics3DGraphics.values()))),this._spatialIndex.update(),this._spatialIndex}get deconflictor(){return this._deconflictor}get labeler(){return this._labeler}get numberOfGraphics(){return this._numberOfGraphics}get effectiveUpdatePolicy(){return null!=this.currentRenderer&&"dictionary"===this.currentRenderer.type?0:this._forcedUpdatePolicy??this.preferredUpdatePolicy}get featureStore(){return this._featureStore}get initializePromise(){return this._initializePromise}get scaleVisibility(){return this._scaleVisibility}get elevationAlignment(){return this._elevationAlignment}get objectStates(){return this._objectStates}get filterVisibility(){return this._filterVisibility}get updating(){return!!(this.dataUpdating||this._elevationAlignment?.updating||this._scaleVisibility?.updating||this._filterVisibility?.updating||this._rendererChangeAbortController||this._elevationInfoChangeAbortController||this._frameTaskHandle.updating||this._updateQueue.updating||this.readyToRun)}get dataUpdating(){return!!(this._graphicsWaitingForSymbol.size>0||this._pendingUpdates.size>0||this._spatialIndex?.updating||this._updatingPendingLoadedGraphicsChange||this._dataUpdateQueue.updating||this._loadingSymbols>0||this.compressionTracker.compressing)}get readyToRun(){return this._pendingUpdates.size>0||!!this._spatialIndex?.updating||this._dataUpdateQueue.readyToRun||this._updateQueue.readyToRun||this._focusAreasGraphicsQueue.length>0}get suspendedOrOutsideOfView(){return this.owner.suspended||!!this.owner.suspendInfo?.outsideOfView}get updatingRemaining(){return this.updating?this._pendingUpdates.size+.1*(this._spatialIndex?.updatingRemaining||0)+.1*(this._elevationAlignment?.updatingRemaining||0):0}get displayFeatureLimit(){const e=this.owner&&this.owner.view&&this.owner.view.qualitySettings,t=e?.graphics3D.minTotalNumberOfFeatures??0,i=e?.graphics3D.maxTotalNumberOfFeatures??0,r=e?.graphics3D.maxNumberOfDrawCalls??0,s=e?.graphics3D.maxTotalNumberOfVertices??0,a=this.averageSymbolComplexity,n=Math.max(1,a?.verticesPerFeature??1),o=a&&a.drawCallsPerFeature>0&&r>0?r/a.drawCallsPerFeature:i,l=Math.ceil(s/n),h=Math.max(t,Math.min(i,l,o)),d=this._get("displayFeatureLimit");return d&&d.maximumTotalNumberOfVertices===s&&d.averageSymbolComplexity===a&&d.maximumNumberOfFeatures===h?d:new oe(s,h,a)}get averageSymbolComplexity(){const e=ae(this._symbolComplexities),t=this._get("averageSymbolComplexity");return 0===e.numComplexities||null!=t&&(e.estimated&&(t.verticesPerFeature>=e.verticesPerFeature||t.verticesPerCoordinate>=e.verticesPerCoordinate||t.drawCallsPerFeature>=e.drawCallsPerFeature)||t.verticesPerFeature===e.verticesPerFeature&&t.verticesPerCoordinate===e.verticesPerCoordinate&&t.drawCallsPerFeature===e.drawCallsPerFeature)?t:e}get usedMemory(){const e=this.labelsEnabled?(this.averageSymbolComplexity?.memory.bytesPerFeatureLabel??0)*this._numberOfGraphics:0,t=this._getSymbolComplexitiesUsed().reduce((e,t)=>e+t.memory.resourceBytes,0);if(null==this._symbolMaterials){this._symbolMaterials=[];for(const e of this._symbols.values())if(null!=e)for(const t of e.symbolLayers)if(t)for(const e of t.materials)e&&this._symbolMaterials.push(e)}const i=this.owner.view.stage.renderer,r=this.owner.view.overlayManager.renderer,s=this._symbolMaterials.reduce((e,t)=>e+((i.getMaterialRenderer(t)||r.getMaterialRenderer(t))?.usedMemory??0),0);return this._usedMemory+e+t+s}get usedMemoryPerGraphic(){if(this._usedMemory&&this._numberOfGraphics){const e=this._numberOfGraphics/(this._numberOfGraphics+Math.max(this._pendingAdds,this._pendingRemoves));return this._usedMemory/this._numberOfGraphics*e}if(null!=this.averageSymbolComplexity){const e=this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel:0;return this.averageSymbolComplexity.memory.bytesPerFeature+e}return 0}get unprocessedMemoryEstimate(){return(this._pendingAdds-this._pendingRemoves)*this.usedMemoryPerGraphic}get _symbolComplexities(){return this.currentRenderer?this._getSymbolComplexitiesUsedOrRenderer(this.currentRenderer):this._getSymbolComplexitiesUsed()}get visible(){return this._visible}_getConvertedSymbol(e){const t=e;if("web-style"===t.type)return t.clone();const i=this._symbolConversionCache.get(t.id);if(null!=i)return i;const r=se(t,{geometryType:this.layer?.geometryType??void 0,retainId:!0,hasLabelingContext:this._hasLabelingContext(t),cimFallbackEnabled:!0}),a=r.symbol||null;return null==a&&r.error&&s.getLogger(this).error(r.error.message),this._symbolConversionCache.set(t.id,a),a}_getSymbolComplexitiesUsedOrRenderer(e){if(null==e)return[];const t=e.symbols,i="backgroundFillSymbol"in e?e.backgroundFillSymbol:null;if(!i&&!t.length)return[];const r=[],s=this._getSymbolComplexityUsedOrRenderer(i);null!=s&&r.push(s);for(const a of t){const e=this._getSymbolComplexityUsedOrRenderer(a);null!=e&&r.push(e)}return r}_getSymbolComplexityUsedOrRenderer(e){if(null==e)return null;const t=this._symbols.get(e.id);if(null!=t)return t.complexity;const i=this._getConvertedSymbol(e);return null!=i?ne(i):null}_getSymbolComplexitiesUsed(){const e=[];return this._symbols.forEach(t=>{null!=t&&e.push(t.complexity)}),e}get _objectIdField(){return this.layer.objectIdField}constructor(e){super(e),this._propertiesPool=new Ie({computedExtent:()=>new I},this),this.computedExtent=null,this.currentRenderer=null,this.rendererHasGeometryOperations=!1,this._graphicStateTracking=null,this.graphics3DGraphics=new Map,this.stageLayer=null,this.stage=null,this._graphicsDrapedUids=new Set,this._graphicsBySymbol=new Map,this._symbolConversionCache=new Map,this._symbols=new Map,this._graphicsWithoutSymbol=new Map,this._graphicsWaitingForSymbol=new Map,this._graphicsUpdateId=0,this._frameTaskHandle=Ee,this._dataUpdateQueue=new De,this._updateQueue=new De,this._focusAreasGraphicsQueue=new g,this._suspendSymbolCleanup=!1,this._arcadeOnDemand=null,this._rendererChangeAbortController=null,this._elevationInfoChangeAbortController=null,this._initializeAbortController=null,this._elevationAlignment=null,this._scaleVisibility=null,this._filterVisibility=null,this._spatialIndex=null,this.extentPadding=0,this._updatingPendingLoadedGraphicsChange=null,this._featureStore=null,this._deconflictor=null,this._labeler=null,this._objectStates=null,this._viewElevationProvider=null,this._stageLayerElevationProvider=null,this._whenGraphics3DGraphicRequests={},this._pendingUpdates=new Map,this._numberOfGraphics=0,this._numberOfGraphicsProvidingElevation=0,this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this._loadingSymbols=0,this.compressionTracker=new Ve,this._symbolWarningLogged=!1,this._geometryWarningLogged=!1,this._objectIdInvisibleSet=new Set,this._whenSymbolRemoved=new d,this.preferredUpdatePolicy=1,this._forcedUpdatePolicy=null,this.elevationFeatureExpressionEnabled=!0,this.owner=null,this.layer=null,this.graphicSymbolSupported=!0,this.getRenderingInfoWithoutRenderer=!1,this.setUidToIdOnAdd=!0,this.hasZ=null,this.hasM=null,this._usedMemory=0,this._visible=!1,this._startCreateGraphics=!1,this._unusedSymbolsCache=e.owner.view.resourceController.memoryController.newCache("graphics-3d-unused-symbols",e=>e.destroy()),this.symbolCreationContext=new ye(e.owner.view.resourceController.scheduler,(e,t)=>this._updateQueue.push(e,t),e.owner.layerViewUid,this.compressionTracker)}initialize(){this._featureStore=new pe({objectIdField:this.owner.layer?.objectIdField,hasZ:!!this.hasZ,hasM:!!this.hasM,viewSpatialReference:this._viewSpatialReference,featureSpatialReference:this.owner.featureSpatialReference,getSpatialIndex:()=>this.spatialIndex,forEach:e=>this.graphics3DGraphics.forEach(e)});const e=(e,t,i)=>this.spatialIndex.queryGraphicUIDsInExtent(e,t,i),{componentFactories:t}=this;this._elevationAlignment=t.elevationAlignment?.(this,e),this._scaleVisibility=t.scaleVisibility?.(this,e),this._filterVisibility=t.filterVisibility?.({featureStore:this._featureStore,getFeatureCount:()=>this.graphics3DGraphics.size,updateFeatureVisibilities:e=>this.modifyGraphics3DGraphicVisibilities(t=>t.setVisibilityFlag(1,4,e(B(t.graphic,this._objectIdField)))),setAllFeaturesVisibility:e=>this.modifyGraphics3DGraphicVisibilities(t=>t.setVisibilityFlag(1,4,e)),clearFeaturesVisibility:()=>this.modifyGraphics3DGraphicVisibilities(e=>e.setVisibilityFlag(1,4,!0))}),this._deconflictor=t.deconflictor?.(this),this._labeler=t.labeler?.(this,this._scaleVisibility),this._objectStates=t.objectStates?.(this),this._initializeAbortController=new AbortController,this.addHandles(m(()=>this.owner.view.state.highlights,()=>{const{highlightOrderMap:e}=this.owner.view.state;this.graphics3DGraphics.forEach(t=>t.updateHighlights(e))})),this._initializePromise=this._initializeAsync()}async _initializeAsync(){const e=this._initializeAbortController?.signal,t=this.owner.view;this._viewElevationProvider=new le(this._viewSpatialReference,t),this._initializeStage(t,this.owner.layerViewUid);const i=t.sharedSymbolResources;this.symbolCreationContext.sharedResources=i,null!=this.currentRenderer&&(this.symbolCreationContext.renderer=this.currentRenderer),this.symbolCreationContext.stage=this.stage,this.symbolCreationContext.renderCoordsHelper=t.renderCoordsHelper,this.symbolCreationContext.layer=this.layer,this.symbolCreationContext.graphicsCoreOwner=this.owner,this.symbolCreationContext.localOriginFactory=new Ge(t.renderSpatialReference),this.symbolCreationContext.elevationProvider=t.elevationProvider,this.symbolCreationContext.notifyGraphicGeometryChanged=e=>this.notifyGraphicGeometryChanged(e),this.symbolCreationContext.notifyGraphicVisibilityChanged=e=>this.notifyGraphicVisibilityChanged(e);const r=he(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);if(this.symbolCreationContext.featureExpressionInfoContext=await de(r,this._viewSpatialReference,e,s.getLogger(this)),p(e),this.symbolCreationContext.screenSizePerspectiveEnabled=we(this.layer.screenSizePerspectiveEnabled),this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this.symbolCreationContext.physicalBasedRenderingEnabled=!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled,this.symbolCreationContext.skipHighSymbolLods=!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods,"drapeSourceType"in this.owner){const{owner:e}=this;this.symbolCreationContext.drapeSourceRenderer=t.overlayManager.registerGeometryDrapeSource(e)}this.addHandles([b(()=>this.suspendedOrOutsideOfView,()=>this._updateQueue.unshift(()=>this._updateLayerVisibility(),null).catch(c)),b(()=>we(this.layer?.screenSizePerspectiveEnabled),e=>{e!==this.symbolCreationContext.screenSizePerspectiveEnabled&&(this.symbolCreationContext.screenSizePerspectiveEnabled=e,this._screenSizePerspectiveEnabledChange())}),b(()=>this.owner.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(!!e)),b(()=>this.owner.view.state?.rasterPixelRatio,()=>this._pixelRatioChange()),b(()=>!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled,e=>this._physicalBasedRenderingChange(e)),b(()=>!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods,e=>this._skipHighSymbolLoDsChange(e)),b(()=>this.owner.view.focusAreasView?.polygons,()=>this._updateFocusedLabels()),b(()=>this.owner.view.map?.focusAreas.style,()=>this.recreateAllGraphicsAndSymbols()),b(()=>!!t.basemapTerrain&&!t.basemapTerrain.opaque&&!t.basemapTerrain.invisible,()=>this.terrainTransparencyChange()),m(()=>t.basemapTerrain?.tilingScheme,e=>{if(e.spatialReference.equals(this.symbolCreationContext.overlaySR)||null==t.basemapTerrain.spatialReference||(this.symbolCreationContext.overlaySR=t.basemapTerrain.spatialReference),this.hasHandles("loaded-graphics"))this.recreateAllGraphics();else{const e=()=>this.owner?.loadedGraphics;this.addHandles([_(e,"change",e=>{this._graphicsCollectionChanged(e),this._signalUpdatingDuringAsyncLoadedGraphicsChange()},{onListenerAdd:()=>{this.recreateAllGraphics(),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}})],"loaded-graphics")}},{initial:!0}),b(()=>this.effectiveUpdatePolicy,e=>{null!=this.stageLayer&&(this.stageLayer.updatePolicy=e),this.symbolCreationContext.isAsync=0===this.effectiveUpdatePolicy,1===e&&this.runTask(Le)},f)]),this._frameTaskHandle=t.resourceController.scheduler.registerTask(je.GRAPHICS_CORE,this),this.layer&&"featureReduction"in this.layer&&this.addHandles(b(()=>this.layer.featureReduction,()=>this._deconflictor?.featureReductionChange())),this.notifyChange("averageSymbolComplexity"),this.rendererChange(this.owner.renderer).catch(()=>{}),this._initializeAbortController=null}_abortInitialize(){this._initializeAbortController=n(this._initializeAbortController)}_updateFocusedLabels(){this._focusAreasGraphicsQueue.clear(),this.forEachGraphics3DSymbol((e,t)=>{t&&e.needsUpdateFocus&&t.forEach(e=>{this._focusAreasGraphicsQueue.push(e)})})}destroy(){if(this._unusedSymbolsCache.destroy(),this._abortInitialize(),this._rendererChangeAbortController=n(this._rendererChangeAbortController),this._abortElevationInfoChange(),this._frameTaskHandle.remove(),this._frameTaskHandle=Ee,this._dataUpdateQueue.cancelAll(),this._updateQueue.cancelAll(),this._deconflictor=o(this._deconflictor),this._labeler=o(this._labeler),this._elevationAlignment=l(this._elevationAlignment),this._scaleVisibility=l(this._scaleVisibility),this._filterVisibility=l(this._filterVisibility),this._objectStates=l(this._objectStates),this.clear(),"drapeSourceType"in this.owner){const{owner:e}=this;this.stage.view.overlayManager.unregisterDrapeSource(e)}this._featureStore=l(this._featureStore),this._updatingPendingLoadedGraphicsChange=o(this._updatingPendingLoadedGraphicsChange),this._graphicStateTracking=l(this._graphicStateTracking),this.stage&&(this.stageLayer=l(this.stageLayer),this.stage=null),this._set("owner",null);for(const e in this._whenGraphics3DGraphicRequests)this._whenGraphics3DGraphicRequests[e].reject(new r("graphic:layer-destroyed","Layer has been destroyed"));this._whenGraphics3DGraphicRequests=null,this._propertiesPool=l(this._propertiesPool),this._whenSymbolRemoved.prune(),this._symbolConversionCache.clear(),this._objectIdInvisibleSet.clear(),this._spatialIndex=l(this._spatialIndex),this._symbolMaterials=null}clear(){this._objectStates?.allGraphicsDeleted(),null!=this._graphicStateTracking&&this._graphicStateTracking.allGraphicsDeleted(),this.graphics3DGraphics.forEach(e=>e.destroy()),this._spatialIndex?.clear(),this.graphics3DGraphics.clear(),this._numberOfGraphics=0,this._usedMemory=0,this._updateLayerVisibility(),this._symbols.forEach(l),this._symbols.clear(),this._symbolMaterials&&(this._symbolMaterials.length=0,this._symbolMaterials=null),this._graphicsBySymbol.clear(),this._graphicsWithoutSymbol.clear(),this._graphicsWaitingForSymbol.clear(),this._pendingUpdates.clear(),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this.notifyChange("dataUpdating"),this.notifyChange("readyToRun"),this.notifyChange("updatingRemaining"),this._featureStore.events.emit("changed"),this.owner.notifyContentGeometryUpdate?.()}_initializeStage(e,t){this.stage=e.stage,this.stageLayer=new Pe(this.stage,{visible:!this.suspendedOrOutsideOfView,updatePolicy:this.effectiveUpdatePolicy},t);const i=this.stageLayer.events;i.on("transformationChanged",e=>this.notifyGraphicGeometryChanged(e.graphicUid)),i.on("shaderTransformationChanged",e=>this.notifyGraphicGeometryChanged(e.graphicUid)),i.on("visibilityChanged",e=>this.notifyGraphicVisibilityChanged(e.graphicUid)),i.on("geometryAdded",e=>this.notifyGraphicGeometryChanged(e.object.graphicUid)),i.on("geometryRemoved",e=>this.notifyGraphicGeometryChanged(e.object.graphicUid)),i.on("attributesChanged",e=>xe(e.attribute)&&this.notifyGraphicGeometryChanged(e.object.graphicUid))}notifyGraphicGeometryChanged(e){if(this.owner.notifyContentGeometryUpdate?.(),null==this._graphicStateTracking||null==e)return;const t=this.graphics3DGraphics.get(e);t&&this._graphicStateTracking.updateGraphicGeometry(t)}notifyGraphicVisibilityChanged(e){if(this.owner.notifyContentGeometryUpdate?.(),null==this._graphicStateTracking||null==e)return;const t=this.graphics3DGraphics.get(e);t&&this._graphicStateTracking.updateGraphicVisibility(t)}_updateLayerVisibility(){const e=this.displayFeatureLimit.maximumNumberOfFeatures,t=this._numberOfGraphics>e*We,i=!this.suspendedOrOutsideOfView&&!t;i!==this._visible&&(this._visible=i,this._updateStageLayerVisibility())}_updateStageLayerVisibility(){const e=this._visible&&(null==this.layer.opacity||this.layer.opacity>=Oe);this.stageLayer.visible!==e&&(this.stageLayer.visible=e,e?this.updateGraphicsVisibilities():this._hideAllGraphics(),this.owner.notifyContentGeometryUpdate?.())}getGraphics3DGraphicById(e){return null!=e?this.graphics3DGraphics.get(e):void 0}getGraphics3DGraphicByObjectId(e){return this.owner.layer?.objectIdField?this._findGraphics3DGraphicByObjectId(e):null}_getGraphicObjectID(e,t=this.owner.layer?.objectIdField){return B(e,t)}get graphics3DGraphicsByObjectID(){const e=this.owner.layer?.objectIdField;if(!e)return;const t=new Map;return this.graphics3DGraphics.forEach(i=>{if(!i)return;const r=i.graphic,s=this._getGraphicObjectID(r,e);null!=s&&t.set(s,i)}),t}get labelsEnabled(){return!!this._labeler?.layerLabelsEnabled()}async updateLabelingInfo(e){const t=this._deconflictor?.labelingInfoChange(e),i=this._labeler?.labelingInfoChange(e);await Promise.allSettled([t,i])}updateVisibilityInfo(){this._deconflictor?.labelingInfoChange(),this._labeler?.visibilityInfoChange()}get symbolUpdateType(){if(this._pendingUpdates.size>0)return"unknown";let e=!1,t=!1;for(const[i,r]of this._symbols)if(null!=r){switch(r.getFastUpdateStatus()){case 3:return"unknown";case 1:this._graphicsBySymbol.has(i)&&(t=!0);break;case 0:this._graphicsBySymbol.has(i)&&(e=!0);break;case 2:this._graphicsBySymbol.has(i)&&(t=e=!0)}}return t?e?"mixed":"fast":e?"slow":"mixed"}runTask(e){if(this._dataUpdateQueue.runTask(e),this._updateQueue.runTask(e),this._applyPendingUpdates(e),this._applyFocusAreasUpdates(e),this.notifyChange("readyToRun"),this.readyToRun||this.notifyChange("dataUpdating"),this.notifyChange("updatingRemaining"),!e.hasProgressed)return Ae}setObjectIdVisibility(e,t){t?this._objectIdInvisibleSet.delete(e):this._objectIdInvisibleSet.add(e);const i=this._findGraphics3DGraphicByObjectId(e);null!=i&&this._updateUserVisibility(i)}_findGraphics3DGraphicByObjectId(e){return a(this.graphics3DGraphics,t=>this._getGraphicObjectID(t.graphic)===e)}_updateUserVisibility(e){if(null==e)return!1;const t=e.graphic,i=this._getGraphicObjectID(t),r=t.visible&&!this.owner.suspended&&this.stageLayer.visible&&(null==i||!this._objectIdInvisibleSet.has(i));return e.setVisibilityFlag(1,1,r)}_whenGraphics3DGraphic(e){const t=this.graphics3DGraphics.get(e.uid);if(t)return Promise.resolve(t);const i=this._whenGraphics3DGraphicRequests[e.uid];if(i)return i.promise;const r=y();return this._whenGraphics3DGraphicRequests[e.uid]=r,r.promise}async _boundsForGraphics3DGraphic(e,t){const i=this._viewSpatialReference,r=this.owner.view.renderSpatialReference,s=this.owner.view.basemapTerrain.spatialReference,a=(e,t,s)=>j(e,r,t,e,i,t,s),n=(e,t,r)=>j(e,s,t,e,i,t,r),o=this._viewElevationProvider?{service:this._viewElevationProvider,useViewElevation:null!=t&&!!t.useViewElevation,minDemResolution:null!=t?t.minDemResolution:null,minDemResolutionForPoints:this.owner.view.resolution}:null,l=await e.getProjectedBoundingBox(a,n,o,t?.signal);if(!l)return null;const h=l.boundingBox;if(l.requiresDrapedElevation){const e=this.symbolCreationContext.elevationProvider;if(e){O(h,Te);const t=e.getElevation(Te[0],Te[1],0,i,"ground")??0;h[2]=Math.min(h[2],t),h[5]=Math.max(h[5],t)}}return{boundingBox:h,screenSpaceObjects:l.screenSpaceObjects}}async whenGraphicBounds(e,t){await v(()=>this.owner?.loadedGraphics);const i=this.owner.layer?.objectIdField,s=this.owner.loadedGraphics.find(t=>t===e||null!=i&&null!=t.attributes&&e.attributes&&t.attributes[i]===e.attributes[i]);if(!s)throw new r("internal:graphic-not-part-of-view","Graphic is not part of this view");const a=await this._whenGraphics3DGraphic(s);return this._boundsForGraphics3DGraphic(a,t)}computeAttachmentOrigin(e,t){const i=this.graphics3DGraphics.get(e.uid);if(!i)return null;const r=i.computeAttachmentOrigin();if(0===r.render.num&&0===r.draped.num)return null;P(He,0,0,0);let s=0;if(r.render.num>0){if(!V(r.render.origin,this.symbolCreationContext.renderCoordsHelper.spatialReference,Be,t))return null;R(He,He,Be),s++}if(r.draped.num>0){const[e,i]=r.draped.origin,a=this._viewElevationProvider.getElevation(e,i,"ground")??0;if(P(Be,e,i,a),!V(Be,this._viewElevationProvider.spatialReference,Be,t))return null;R(He,He,Be),s++}return s>1&&U(He,He,1/s),new E({x:He[0],y:He[1],z:He[2],spatialReference:t})}getSymbolLayerSize(e,t){const i=this._symbols.get(e.id);if(null==i)throw new r("internal:symbol-not-part-of-view","Symbol is not part of this view");const s=e.symbolLayers.indexOf(t);if(-1===s)throw new r("internal:missing-symbol-layer","Symbol layer is not in symbol");const a=i.getSymbolLayerSize(s);if(null==a)throw new r("internal:missing-size","Symbol layer has no valid size");return a}_graphicsCollectionChanged(e){this._startCreateGraphics&&(this.add(e.added),this.remove(e.removed))}graphicUpdateHandler(e){const t=e.graphic.uid,i=this.graphics3DGraphics.get(t);if(null!=i||null!=this._graphicsWithoutSymbol.get(t)){switch(e.property){case"visible":this._graphicUpdateVisibleHandler(i);break;case"geometry":this._graphicUpdateGeometryHandler(i,e.graphic);break;case"symbol":this._graphicUpdateSymbolHandler(i,e);break;case"attributes":{const t=this.symbolCreationContext.featureExpressionInfoContext;t?.arcade&&this._graphicUpdateGeometryHandler(i,e.graphic)}break;case"popupTemplate":break;case"origin-transform":this._graphicUpdateTransformHandler(i,e)}this.owner.notifyContentGeometryUpdate?.()}}_graphicUpdateGeometryHandler(e,t){this._graphicUpdateGeometryOrTransformHandler(e,t,()=>!(null==e||!e.graphics3DSymbol.updateGeometry(e)||!(this._labeler?.updateGraphicGeometry(e)??1))&&(this._labeler?.setDirty(),this._deconflictor?.setDirty(),!0));const i=t.geometry;null!=i&&this._expandComputedExtent(i)}_graphicUpdateTransformHandler(e,t){const i=t.graphic.geometry;this._graphicUpdateGeometryOrTransformHandler(e,t.graphic,()=>null!=t.newValue&&null!=e&&null!=i&&e.graphics3DSymbol.updateTransform(e,i.spatialReference,t.newValue,t.action))}_graphicUpdateGeometryOrTransformHandler(e,t,i){if(null!=t.geometry){if(null==e){const e=t.symbol?.id;if(e){const t=this._symbols.get(e);if(null!=t&&0===t.loadStatus)return}return void this._recreateGraphic(t)}i()||this._recreateGraphic(e.graphic)}else this._recreateGraphic(t)}_graphicUpdateSymbolHandler(e,t){const i=t.graphic,r=null!=e?e.graphics3DSymbol:null!=t.oldValue?this._symbols.get(t.oldValue.id):null;if(null==r||null==t.newValue)return void this._recreateGraphic(i);const s=r.symbol,a=this._getConvertedSymbol(t.newValue);if(null!=a&&(a.type!==s.type||"web-style"===a.type)||"web-style"===s.type)return void this._recreateGraphic(i);const n=this._graphicsBySymbol.get(s.id);if(n&&1!==n.size)return void this._recreateGraphic(i);const o=w(s,a);if(null==o)return void this._updateSymbolMapping(s.id,a);const l={diff:o,graphics3DGraphicPatches:[],symbolStatePatches:[]};if(r.prepareSymbolPatch(l),!x(l.diff))return void this._recreateGraphic(i);const h=this._getRenderingInfo(i,!1);if(null==h)return void this._recreateGraphic(i);const d=r.extentPadding;for(const p of l.symbolStatePatches)p();if(d!==r.extentPadding&&this._recomputeExtentPadding(),null!=e)for(const p of l.graphics3DGraphicPatches)p(e,h);this._updateSymbolMapping(s.id,a)}_graphicUpdateVisibleHandler(e){this._updateUserVisibility(e)&&(this._labeler?.setDirty(),this._deconflictor?.setDirty())}recreateGraphics(e){this._suspendSymbolCleanup=!0,this.remove(e),this.add(e),this._suspendSymbolCleanup=!1,1===this.effectiveUpdatePolicy&&this._cleanupSymbols()}_recreateGraphic(e){this.recreateGraphics([e])}_beginGraphicUpdate(e){const t=this._graphicsUpdateId;return this._graphicsUpdateId++,this._graphicsWaitingForSymbol.set(e.uid,t),1===this._graphicsWaitingForSymbol.size&&this.notifyChange("dataUpdating"),t}_endGraphicUpdate(e,t){e&&(t&&this._graphicStateTracking?.updateGraphicError(e,t),this._graphicsWaitingForSymbol.delete(e.uid),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("dataUpdating")))}_recomputeExtentPadding(){let e=0;this._symbols.forEach(t=>{null!=t&&(e=Math.max(e,t.extentPadding))}),this._set("extentPadding",e)}_expandComputedExtent(e){const t=Me,i=e.spatialReference;q(e,t);const r=this._viewSpatialReference,s=Fe.tmpVec;if(z(i,r)||A(t[0],t[1],0,i,s,r)&&(t[0]=s[0],t[1]=s[1],A(t[3],t[4],0,i,s,r),t[3]=s[0],t[4]=s[1]),!(isFinite(t[0])&&isFinite(t[3])&&isFinite(t[1])&&isFinite(t[4])))return;const a=this.computedExtent;let n=null;const o=isFinite(t[2])&&isFinite(t[5]),l=o&&(null==a?.zmin||t[2]<a.zmin),h=o&&(null==a?.zmax||t[5]>a.zmax);if(a){(t[0]<a.xmin||t[1]<a.ymin||t[3]>a.xmax||t[4]>a.ymax||l||h)&&(n=this._propertiesPool.get("computedExtent"),n.xmin=Math.min(t[0],a.xmin),n.ymin=Math.min(t[1],a.ymin),n.xmax=Math.max(t[3],a.xmax),n.ymax=Math.max(t[4],a.ymax),n.spatialReference=r)}else n=this._propertiesPool.get("computedExtent"),n.xmin=t[0],n.ymin=t[1],n.xmax=t[3],n.ymax=t[4],n.spatialReference=r;n&&(l&&(n.zmin=t[2]),h&&(n.zmax=t[5]),this._set("computedExtent",n))}_abortElevationInfoChange(){this._elevationInfoChangeAbortController&&(this._elevationInfoChangeAbortController.abort(),this._elevationInfoChangeAbortController=null)}async elevationInfoChange(){this._abortElevationInfoChange();const e=new AbortController;this._elevationInfoChangeAbortController=e;const t=he(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);this.symbolCreationContext.featureExpressionInfoContext=await de(t,this._viewSpatialReference,e.signal,s.getLogger(this)),p(e.signal),this._elevationInfoChangeAbortController=null,this._labeler?.elevationInfoChange(),this.forEachGraphics3DSymbol((e,t,i)=>{e.globalPropertyChanged("elevationInfo",t)?t?.forEach(e=>{const t=e.graphic,i=e.labelLayers;for(const r of i){r.graphics3DSymbolLayer.graphics3DGraphicLayerElevationInfoChanged(t,r)}}):this._recreateSymbol(i)}),this.updateStageLayerElevationProvider(),this._elevationAlignment?.elevationInfoChange()}updateStageLayerElevationProvider(){this._stageLayerElevationProvider?"relative-to-scene"!==this.layer.elevationInfo?.mode&&0!==this._numberOfGraphicsProvidingElevation||(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=l(this._stageLayerElevationProvider)):(!this.layer.elevationInfo||this.layer.elevationInfo&&"relative-to-scene"!==this.layer.elevationInfo.mode)&&this._numberOfGraphicsProvidingElevation>0&&(this._stageLayerElevationProvider=new Ce({layer:this.layer,stageLayer:this.stageLayer,view:this.owner.view}),this.owner.view.elevationProvider.register(2,this._stageLayerElevationProvider))}_clearSymbolsAndGraphics(){this.clear(),null!=this._filterVisibility&&this._filterVisibility.clear(),this._labeler?.reset(),this._deconflictor?.clear(),this._elevationAlignment?.clear(),this.stageLayer?.invalidateSpatialQueryAccelerator(),this._stageLayerElevationProvider&&(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=l(this._stageLayerElevationProvider))}startCreateGraphics(){this._startCreateGraphics=!0,this.recreateAllGraphics()}recreateAllGraphics(){this._recreateAllGraphics(!1)}recreateAllGraphicsAndSymbols(){this._recreateAllGraphics(!0)}_recreateAllGraphics(e=!1){if(!this._startCreateGraphics)return;const{loadedGraphics:t,view:i}=this.owner,r=i.basemapTerrain?.tilingScheme&&t?.length?t.toArray():null;!e&&r||this._clearSymbolsAndGraphics(),this.symbolCreationContext.screenSizePerspectiveEnabled=we(this.layer.screenSizePerspectiveEnabled),this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this._set("computedExtent",null),r&&(e?this.add(r):this.recreateGraphics(r))}_recreateSymbol(e){const t=this._graphicsBySymbol.get(e),i=[];t&&(t.forEach((e,t)=>{const r=e.usedMemory;this._conditionalRemove(e,t),this._spatialIndex?.remove(e),i.push(e.graphic),e.destroy(),this._removeGraphics3DGraphic(t,r),this._updateLayerVisibility(),this._featureStore.events.emit("changed"),this.owner.notifyContentGeometryUpdate?.()}),this._graphicsBySymbol.set(e,new Map));const r=this._symbols.get(e);l(r),this._symbols.delete(e),this._symbolMaterials=null,l(this._unusedSymbolsCache.pop(e)),this.add(i)}_recreateGraphicsForSymbol(e){const t=this._graphicsBySymbol.get(e);if(t){const e=[];t.forEach(t=>e.push(t.graphic)),this.recreateGraphics(e)}}_conditionalRemove(e,t){this._graphicsDrapedUids.delete(t),this._objectStates?.removeGraphic(e),this._labeler?.removeGraphic(e),this._deconflictor?.removeGraphic(e),null!=this._graphicStateTracking&&this._graphicStateTracking.removeGraphic(e)}add(e){e&&0!==e.length&&(this.owner.view.basemapTerrain?.tilingScheme?(0===this._updatePolicyForGraphics(e)?this._addDelayed(e):this._addImmediate(e),this.notifyChange("dataUpdating")):s.getLogger(this).error("#add()","Cannot add graphics before terrain surface has been initialized"))}_updatePolicyForGraphics(e){if(1===this.effectiveUpdatePolicy&&("mesh"===this.layer.geometryType||null==this.layer.geometryType))for(const t of e)if(null!=t.geometry&&"mesh"===t.geometry.type&&!t.geometry.loaded)return 0;return this.effectiveUpdatePolicy}_addImmediate(e){this._geometryWarningLogged=!1,this._symbolWarningLogged=!1;for(const t of e)this._addGraphic(t,this._getRenderingInfo(t),1);this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_addDelayed(e){for(const t of e){const e=t.uid;let i=this._pendingUpdates.get(e);i?i.add?0!==i.state&&i.abortController?.abort():this._pendingAdds++:(i=new ze,this._pendingAdds++,this._pendingUpdates.set(e,i)),i.add=t}this.notifyChange("readyToRun"),this.notifyChange("updatingRemaining"),this.notifyChange("dataUpdating")}remove(e){0===this.effectiveUpdatePolicy?this._removeDelayed(e):this._removeImmediate(e),this.notifyChange("dataUpdating")}_removeImmediate(e){for(const t of e)this._removeGraphic(t);this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_removeDelayed(e){for(const t of e){const e=t.uid,i=this._pendingUpdates.get(e);if(i)i.add&&(i.remove?i.add=null:this._pendingUpdates.delete(e),1===i.state&&i.abortController?.abort(),this._pendingAdds--);else{const i=new ze;i.remove=t,this._pendingUpdates.set(e,i),this._pendingRemoves++,this._applyPendingRemovesFirst=!0}}0===this._pendingUpdates.size&&this._finishPendingUpdates(),this.notifyChange("readyToRun"),this.notifyChange("updatingRemaining"),this.notifyChange("dataUpdating")}_finishPendingUpdates(){this._cleanupSymbols(),(this._pendingAdds||this._pendingRemoves)&&s.getLogger(this).warn("pendingAdds/Removes in inconsistent state!"),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1}_applyFocusAreasUpdates(e){for(;this._focusAreasGraphicsQueue.length>0&&!e.done;){e.madeProgress();const t=this._focusAreasGraphicsQueue.pop(),i=fe(t.graphic.geometry);if(null==i)continue;const r=this.stage.view.focusAreasView?.containsGeometry(i)??!0;t.layers.forEach(e=>{if(e.stageObject){e.stageObject.geometries.some(e=>e.material instanceof Re&&e.material.parameters.isFocused!==r)&&this.recreateGraphics([t.graphic])}})}0===this._focusAreasGraphicsQueue.length&&this.notifyChange("readyToRun")}_applyPendingUpdates(e){if(this._geometryWarningLogged=!1,this._symbolWarningLogged=!1,0===this._pendingUpdates.size&&this._spatialIndex?.updating)return this._spatialIndex.update(),void e.madeProgress();if(this._applyPendingRemovesFirst){this._applyPendingRemovesFirst=!1;for(const[t,i]of this._pendingUpdates){if(e.done){this._applyPendingRemovesFirst=!0;break}if(i.remove&&!i.add&&(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(i.remove),i.remove=null,this._pendingUpdates.delete(t),0===this._pendingRemoves))break}}for(const[t,i]of this._pendingUpdates){if(e.done)break;i.add&&0===i.state&&this._processPendingUpdateNew(i);let r=this.effectiveUpdatePolicy;if(!i.remove||i.add&&2!==i.state||(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(i.remove),i.remove=null,r=1),i.add)switch(i.state){case 2:this._addGraphic(i.add,i.renderingInfo,r),i.add=null,this._pendingAdds--,e.madeProgress();break;case 3:i.add=null,this._pendingAdds--}null==i.remove&&null==i.add&&this._pendingUpdates.delete(t)}0===this._pendingUpdates.size&&(this._finishPendingUpdates(),this.notifyChange("readyToRun"),this.notifyChange("dataUpdating"))}_processPendingUpdateNew(e){if(!e.add)return void(e.state=2);const t=e.add.geometry;null==t||"mesh"!==t.type||t.loaded?this._processPendingUpdateNewRenderingInfo(e):this._processPendingUpdateNewMesh(e,t)}async _processPendingUpdateNewMesh(e,t){e.state=1,e.abortController=new AbortController;const i=e.abortController.signal;try{await t.load({signal:i})}catch(r){return this._processPendingUpdateNewError(e,r)}e.abortController=null,this._processPendingUpdateNewRenderingInfo(e)}_processPendingUpdateNewError(e,t){e.abortController=null,u(t)?e.state=0:e.state=3}async _processPendingUpdateNewRenderingInfo(e){if(null==this.layer.renderer||"dictionary"!==this.layer.renderer.type)return e.renderingInfo=this._getRenderingInfo(e.add),void(e.state=2);e.state=1,e.abortController=new AbortController;let t=null;try{t=await this._getRenderingInfoAsync(e.add,{signal:e.abortController.signal})}catch(i){return e.abortController=null,void(u(i)?e.state=0:e.state=3)}null==t?.symbol?(this._symbolWarningLogged||(this._symbolWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),e.renderingInfo=null):e.renderingInfo=t,e.state=2}_addGraphic(e,t,i){if(this._graphicsWithoutSymbol.set(e.uid,e),null==t?.symbol||!Q(e))return;const r=this.stage.renderView.olidRenderHelper;if(r&&this.setUidToIdOnAdd){const t=J(this.owner.view,this.owner.layerViewUid);r.setUidToObjectAndLayerId(e.objectId,e.uid,this.layer.id,this.owner.layerViewUid,W(this.layer)&&!!this.layer.popupEnabled&&!t&&Ue(this.layer,this.owner.view.popup?.defaultPopupTemplateEnabled))}const s=t.symbol,a=this.getOrCreateGraphics3DSymbol(s,t.renderer);if(null==a)return;this._expandComputedExtent(e.geometry);const n=this._beginGraphicUpdate(e),o=new ce(e,t,this.layer);let l=!1;const h=e=>{e===a.symbol.id&&(l=!0)};this._whenSymbolRemoved.push(h);const d=()=>{if(--this._loadingSymbols,this.destroyed)return;this._whenSymbolRemoved.removeUnordered(h);if(this._graphicsWaitingForSymbol.get(e.uid)!==n||l||a.destroyed||this.graphicSymbolSupported&&e.symbol&&e.symbol.id!==a.symbol.id)--a.referenced,this._cleanupSymbols();else{const t=this._createGraphics3DGraphic(a,o);this._spatialIndex&&null!=t&&this._spatialIndex.add(t),--a.referenced,this._endGraphicUpdate(e)}this._featureStore.events.emit("changed"),this.owner.notifyContentGeometryUpdate?.(),this._labeler?.setDirty()},p=t=>{--this._loadingSymbols,this.destroyed||(this._whenSymbolRemoved.removeUnordered(h),l||(u(t)?this.add([e]):a.destroyed||this._endGraphicUpdate(e,t)))};++this._loadingSymbols,0===i?a.load(()=>this._dataUpdateQueue.push(d,null).catch(c),e=>this._dataUpdateQueue.push(()=>p(e),null).catch(c)):a.load(d,p)}_removeGraphic(e){const t=e.uid,i=this.graphics3DGraphics.get(t);if(i){i.graphics3DSymbol.onRemoveGraphic(i);const e=i.usedMemory,r=i.isElevationSource;this._conditionalRemove(i,t),this._spatialIndex?.remove(i);const s=i.graphics3DSymbol.symbol.id;this._graphicsBySymbol.get(s)?.delete(t),this._graphicsWithoutSymbol.delete(t),this._removeGraphics3DGraphic(t,e,r),i.destroy(),this._featureStore.events.emit("changed"),this.owner.notifyContentGeometryUpdate?.()}else this._graphicsWithoutSymbol.delete(t),this._graphicsWaitingForSymbol.delete(t),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("dataUpdating"))}_hasLabelingContext(e){if(e instanceof ee||e instanceof te){const t=this.symbolCreationContext.layer;return!!t.labelingInfo&&t.labelingInfo.some(t=>t.symbol===e)}return!1}_hasValidSymbolCreationContext(e){return!(e instanceof ee&&!this._hasLabelingContext(e))||(s.getLogger(this).error("LabelSymbol3D is only valid as part of a LabelClass. Using LabelSymbol3D as a renderer symbol is not supported."),!1)}_getRenderingInfo(e,t=!0){const i=e.geometry;if(null==i)return t&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!L(i.spatialReference,this._viewSpatialReference))return t&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} has incompatible spatial reference and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return t&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const r=this.rendererHasGeometryOperations?N(e,this.layer,null):e;let a;if(this.owner.getRenderingInfo&&(this.getRenderingInfoWithoutRenderer||null!=this.currentRenderer))a=this.owner.getRenderingInfo(r,this.currentRenderer,this._arcadeOnDemand);else{const e=r.symbol||re(r.geometry);a=new X(null,e)}return null==a?.symbol?(t&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),null):a}_getRenderingInfoAsync(e,t){if(null==e.geometry)return this._geometryWarningLogged||(this._geometryWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return this._symbolWarningLogged||(this._symbolWarningLogged=!0,s.getLogger(this).warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const i=this.rendererHasGeometryOperations?N(e,this.layer,null):e;return this.owner.getRenderingInfoAsync(i,this.currentRenderer,this._arcadeOnDemand,t)}_createGraphics3DSymbol(e,t){if(!this._hasValidSymbolCreationContext(e))return null;const i=this._getConvertedSymbol(e);if(!i)return null;let r;if(null!=t&&"backgroundFillSymbol"in t&&t.backgroundFillSymbol){const e=se(t.backgroundFillSymbol,{ignoreDrivers:!0});null!=e.symbol&&(r=e.symbol.symbolLayers)}const s=ue(i,this.symbolCreationContext,r);return s.load(()=>{const e=s.extentPadding;e>this.extentPadding&&this._set("extentPadding",e),this.notifyChange("averageSymbolComplexity")},()=>{}),s}getOrCreateGraphics3DSymbol(e,t){let i=this._symbols.get(e.id);if(void 0===i){const r=this._unusedSymbolsCache.pop(e.id);i=null!=r?r:e instanceof ie?new ge(e,e=>this._dataUpdateQueue.push(e,null),e=>this._createGraphics3DSymbol(e,t)):this._createGraphics3DSymbol(e,t),this._symbols.set(e.id,i),this._symbolMaterials=null}return null!=i&&++i.referenced,i}trackGraphicState(e){return null==this._graphicStateTracking&&(this._graphicStateTracking=new be(this)),this._graphicStateTracking.add(e)}_addGraphics3DGraphic(e){this._usedMemory+=e.usedMemory,this.graphics3DGraphics.set(e.graphic.uid,e),this._numberOfGraphics++,e.isElevationSource&&(this._numberOfGraphicsProvidingElevation++,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_removeGraphics3DGraphic(e,t,i=!1){this._usedMemory-=t,this.graphics3DGraphics.delete(e),this._numberOfGraphics--,i&&(this._numberOfGraphicsProvidingElevation--,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_createGraphics3DGraphic(e,t){const{graphic:i}=t;if(this._graphicsWithoutSymbol.delete(i.uid),!this._symbols.has(e.symbol.id))return this.add([i]),null;if(this.graphics3DGraphics.has(i.uid))return null;const r=e.createGraphics3DGraphic(t);if(null==r)return null;this._addGraphics3DGraphic(r);const s=e.symbol.id;this._graphicsBySymbol.has(s)||this._graphicsBySymbol.set(s,new Map),this._graphicsBySymbol.get(s).set(i.uid,r);if(r.isDraped&&this._graphicsDrapedUids.add(i.uid),r.centroid=null,null!=i.geometry&&"point"!==i.geometry.type&&(r.centroid=_e(i.geometry,this._viewSpatialReference)),this._updateUserVisibility(r),null!=this._scaleVisibility&&this._scaleVisibility.updateVisibility(r),null!=this._filterVisibility){const{defaultVisibility:e}=this._filterVisibility;r.setVisibilityFlag(1,4,e),e||this._filterVisibility.reapply()}this._deconflictor?.addGraphic(r),this._labeler?.addGraphic(r),this._objectStates?.addGraphic(r),r.initialize(this.stageLayer),null!=this._graphicStateTracking&&this._graphicStateTracking.addGraphic(r);const a=this._whenGraphics3DGraphicRequests[i.uid];return a&&(delete this._whenGraphics3DGraphicRequests[i.uid],a.resolve(r)),this._symbolMaterials=null,r}async rendererChange(e){if(this._rendererChangeAbortController=n(this._rendererChangeAbortController),e!==this.currentRenderer)if(this._validateRenderer(e),null==e&&this._currentRendererChange(null,!1),Z(e))if(e?.arcadeRequired){const t=new AbortController;this._rendererChangeAbortController=t;const{arcadeUtils:i}=await this._ensureArcade();p(t);const r=i.hasGeometryOperations(e);r&&(await i.enableGeometryOperations(),p(t)),0===this.effectiveUpdatePolicy?await this._updateQueue.push(()=>this._currentRendererChange(e,r),t.signal):this._currentRendererChange(e,r),this._rendererChangeAbortController=null}else if(0===this.effectiveUpdatePolicy){const t=new AbortController;this._rendererChangeAbortController=t,await this._updateQueue.push(()=>this._currentRendererChange(e,!1),t.signal),this._rendererChangeAbortController=null}else this._currentRendererChange(e,!1);else this._currentRendererChange(e,!1)}async _ensureArcade(){return null==this._arcadeOnDemand?(this._arcadeOnDemand=await K(),this._arcadeOnDemand):this._arcadeOnDemand}_currentRendererChange(e,t){this.currentRenderer=e,this.rendererHasGeometryOperations=t,this.symbolCreationContext.arcade=this._arcadeOnDemand;const i=this.symbolCreationContext.renderer;if(e===i)return;if(this._symbolConversionCache.clear(),this._unusedSymbolsCache.clear(),null==e)return this.symbolCreationContext.renderer=null,void this.recreateAllGraphicsAndSymbols();const r=w(i,e);this._updateUnchangedSymbolMappings(r,e,i),this.symbolCreationContext.renderer=e,null!=r&&("complete"===r.type?this.recreateAllGraphicsAndSymbols():"partial"===r.type&&(this._applyRendererDiff(r,e,i)?this._labeler?.reset():this.recreateAllGraphicsAndSymbols()),this.notifyChange("averageSymbolComplexity"))}_diffHasSymbolChange(e){for(const t in e.diff)switch(t){case"visualVariables":case"defaultSymbol":case"uniqueValueInfos":break;case"uniqueValueGroups":case"authoringInfo":case"fieldDelimiter":delete e.diff[t];break;default:return!0}return!1}_applySymbolSetDiff(e,t,i){e=e||[],t=t||[];const r=[];for(const s of t){const t=this._graphicsBySymbol.get(s.id);t&&t.forEach((a,n)=>{const o=a.graphic,l=this.layer instanceof H?this.layer:null,h=this._arcadeOnDemand;if(s===i.defaultSymbol&&i.getSymbol(N(o,l,null),{arcade:h})===i.defaultSymbol)return;const d=a.usedMemory;e.length||i.defaultSymbol?r.push(o):this._graphicsWithoutSymbol.set(n,o);const p=this.graphics3DGraphics.get(n);this._conditionalRemove(p,n),a.destroy(),t.delete(n),this._removeGraphics3DGraphic(n,d),this._updateLayerVisibility()}),this._whenSymbolRemoved.forAll(e=>e(s.id))}(e.length||r.length)&&(this._graphicsWithoutSymbol.forEach(e=>r.push(e)),this._graphicsWithoutSymbol.clear(),this.add(r)),this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_applyUniqueValueRendererDiff(e,t,r){const s=e.diff.defaultSymbol,a=e.diff.uniqueValueInfos;if(s||a){const n=a?.changed,o=a?.unchanged;if(n&&o&&n.some(e=>o.some(t=>t.oldValue.symbol?.id===e.oldValue.symbol?.id)))return!1;const l=a?a.added.map(e=>e.symbol).filter(i):[],h=a?a.removed.map(e=>e.symbol).filter(i):[];if(n)for(let e=0;e<n.length;e++)l.push(n[e].newValue.symbol),h.push(n[e].oldValue.symbol);return s?(r.defaultSymbol&&h.push(r.defaultSymbol),t.defaultSymbol&&l.push(t.defaultSymbol)):r.defaultSymbol&&l.length&&h.push(t.defaultSymbol),this._applySymbolSetDiff(l,h,t),delete e.diff.defaultSymbol,delete e.diff.uniqueValueInfos,!0}return!1}_calculateUnchangedSymbolMapping(e,t,i){if("unique-value"!==t?.type||"unique-value"!==i?.type||null!=e&&"partial"!==e.type)return[];const r=e=>null!=e?e.id:null,s=e&&e.diff,a=s?.defaultSymbol,n=s&&s.uniqueValueInfos;let o;if(n)o=n.unchanged.map(e=>({oldId:r(e.oldValue.symbol),newId:r(e.newValue.symbol)}));else{o=[];for(const e of i.uniqueValueInfos??[]){const i=r(e.symbol),s=t.uniqueValueInfos?.find(t=>t.value===e.value);s&&i!==r(s.symbol)&&o.push({oldId:i,newId:r(s.symbol)})}}return!a&&i.defaultSymbol&&o.push({oldId:r(i.defaultSymbol),newId:r(t.defaultSymbol)}),o}_updateSymbolMapping(e,t){const i=null!=t&&t?"string"==typeof t?t:t.id:null;if(null==e||e===i)return;const r=this._graphicsBySymbol.get(e);this._graphicsBySymbol.delete(e),void 0!==r&&this._graphicsBySymbol.set(i,r);const s=this._symbols.get(e);if(void 0!==s&&(this._symbols.delete(e),this._symbols.set(i,s),this._symbolMaterials=null,null!=s)){const e="string"==typeof t?null:t;null!=e?s.symbol=e:s.symbol.id=i}}_updateUnchangedSymbolMappings(e,t,i){const r=this._calculateUnchangedSymbolMapping(e,t,i);for(const{oldId:s,newId:a}of r)this._updateSymbolMapping(s,a)}_applyRendererDiff(e,t,i){if(this._diffHasSymbolChange(e))return!1;if(t instanceof $&&i instanceof $&&this._applyUniqueValueRendererDiff(e,t,i)&&0===Object.keys(e.diff).length)return!0;for(const r of this._graphicsBySymbol.keys()){const i=this._symbols.get(r);if(null!=i)switch(i.applyRendererDiff(e,t)){case 0:this._recreateSymbol(r);break;case 1:this._recreateGraphicsForSymbol(r)}}return!0}terrainTransparencyChange(){this.forEachGraphics3DSymbol((e,t,i)=>{e.globalPropertyChanged("terrainTransparency",t)||this._recreateSymbol(i)}),this.labeler?.reset()}opacityChange(){this._updateStageLayerVisibility(),this.forEachGraphics3DSymbol((e,t)=>e.globalPropertyChanged("opacity",t))}_screenSizePerspectiveEnabledChange(){this.forEachGraphics3DSymbol((e,t)=>e.globalPropertyChanged("screenSizePerspectiveEnabled",t)),this._labeler?.screenSizePerspectiveEnabledChanged(),this._deconflictor?.screenSizePerspectiveEnabledChanged()}_slicePlaneEnabledChange(e){e!==this.symbolCreationContext.slicePlaneEnabled&&(this.symbolCreationContext.slicePlaneEnabled=e,this.stageLayer.sliceable=e,this.forEachGraphics3DSymbol((e,t)=>e.globalPropertyChanged("slicePlaneEnabled",t)),this._deconflictor?.slicePlaneEnabledChange(),this._labeler?.slicePlaneEnabledChange())}_physicalBasedRenderingChange(e){this.symbolCreationContext.physicalBasedRenderingEnabled=e,this.forEachGraphics3DSymbol((e,t,i)=>{e.globalPropertyChanged("physicalBasedRenderingEnabled",t)||this._recreateSymbol(i)})}_skipHighSymbolLoDsChange(e){this.symbolCreationContext.skipHighSymbolLods=e,this.forEachGraphics3DSymbol((e,t,i)=>{e.globalPropertyChanged("skipHighSymbolLods",t)||this._recreateSymbol(i)})}_pixelRatioChange(){this.forEachGraphics3DSymbol((e,t,i)=>{e.globalPropertyChanged("pixelRatio",t)||this._recreateSymbol(i)})}_signalUpdatingDuringAsyncLoadedGraphicsChange(){this._updatingPendingLoadedGraphicsChange&&this._updatingPendingLoadedGraphicsChange.remove(),this._updatingPendingLoadedGraphicsChange=C(()=>{this._updatingPendingLoadedGraphicsChange=null})}setClippingExtent(e,t){const i=this.symbolCreationContext.clippingExtent,r=k();return Se(e,r,t)?this.symbolCreationContext.clippingExtent=T(F(),r):this.symbolCreationContext.clippingExtent=null,!M(this.symbolCreationContext.clippingExtent,i)}modifyGraphics3DGraphicVisibilities(e){if(this.destroyed)return;let t=!1;this.graphics3DGraphics.forEach(i=>{e(i)&&(t=!0)}),t&&(this._labeler?.setDirty(),this._deconflictor?.setDirty())}forEachGraphics3DSymbol(e,t){for(const[i,r]of this._symbols){if(null==r)return;e(r,this._graphicsBySymbol.get(i)||qe,i)}if(!t?.excludeUnused)for(const i of this._unusedSymbolsCache)e(i,void 0,i.symbol.id)}updateGraphicsVisibilities(){null!=this._filterVisibility&&this._filterVisibility.reapply(),this.modifyGraphics3DGraphicVisibilities(e=>{const t=this._updateUserVisibility(e),i=!!this._scaleVisibility?.updateVisibility(e);return t||i})}_hideAllGraphics(){this.modifyGraphics3DGraphicVisibilities(e=>e.setVisibilityFlag(1,1,!1))}_validateRenderer(e){const t=()=>`'${this.layer.title?`${this.layer.title}, `:""}id:${this.layer.id}'`,i=Y(e,{geometryType:this.layer?.geometryType,logWarning:(e,i)=>s.getLogger(this).warn(e,`Symbology conversion for layer ${t()}: ${i}`)});if(i){const e=`Renderer for layer ${t} is not supported in a SceneView`;s.getLogger(this).warn(e,i.message)}}_cleanupSymbols(){if(this._graphicsWaitingForSymbol.size>0||this._suspendSymbolCleanup)return;let e=!1;this._symbols.forEach((t,i)=>{if(null==t||t.referenced>0)return;const r=this._graphicsBySymbol.get(i);r&&0!==r.size||(this._graphicsBySymbol.delete(i),this._symbols.delete(i),this._symbolMaterials=null,this._unusedSymbolsCache.put(i,t,h),e=!0)}),e&&(this._recomputeExtentPadding(),this.notifyChange("averageSymbolComplexity"))}get test(){}get performanceInfo(){return new me(this.graphics3DGraphics.size,Array.from(this.graphics3DGraphics.values()).reduce((e,t)=>e+(t.isVisible()?1:0),0),this._graphicsWithoutSymbol.size,this._pendingUpdates.size)}};e([S({readOnly:!0})],ke.prototype,"computedExtent",void 0),e([S()],ke.prototype,"currentRenderer",void 0),e([S()],ke.prototype,"rendererHasGeometryOperations",void 0),e([S()],ke.prototype,"_frameTaskHandle",void 0),e([S()],ke.prototype,"_dataUpdateQueue",void 0),e([S()],ke.prototype,"_updateQueue",void 0),e([S({readOnly:!0})],ke.prototype,"_viewSpatialReference",null),e([S()],ke.prototype,"_rendererChangeAbortController",void 0),e([S()],ke.prototype,"_elevationInfoChangeAbortController",void 0),e([S()],ke.prototype,"_initializeAbortController",void 0),e([S()],ke.prototype,"_elevationAlignment",void 0),e([S()],ke.prototype,"_scaleVisibility",void 0),e([S()],ke.prototype,"_filterVisibility",void 0),e([S()],ke.prototype,"_initializePromise",void 0),e([S()],ke.prototype,"_spatialIndex",void 0),e([S({readOnly:!0})],ke.prototype,"extentPadding",void 0),e([S()],ke.prototype,"_updatingPendingLoadedGraphicsChange",void 0),e([S()],ke.prototype,"_featureStore",void 0),e([S()],ke.prototype,"_objectStates",void 0),e([S()],ke.prototype,"_loadingSymbols",void 0),e([S({constructOnly:!0})],ke.prototype,"compressionTracker",void 0),e([S()],ke.prototype,"preferredUpdatePolicy",void 0),e([S()],ke.prototype,"_forcedUpdatePolicy",void 0),e([S({readOnly:!0})],ke.prototype,"effectiveUpdatePolicy",null),e([S({constructOnly:!0})],ke.prototype,"elevationFeatureExpressionEnabled",void 0),e([S({constructOnly:!0})],ke.prototype,"owner",void 0),e([S({constructOnly:!0})],ke.prototype,"layer",void 0),e([S({constructOnly:!0})],ke.prototype,"graphicSymbolSupported",void 0),e([S({constructOnly:!0})],ke.prototype,"getRenderingInfoWithoutRenderer",void 0),e([S({constructOnly:!0})],ke.prototype,"componentFactories",void 0),e([S({constructOnly:!0})],ke.prototype,"setUidToIdOnAdd",void 0),e([S()],ke.prototype,"featureStore",null),e([S()],ke.prototype,"initializePromise",null),e([S()],ke.prototype,"scaleVisibility",null),e([S()],ke.prototype,"elevationAlignment",null),e([S()],ke.prototype,"objectStates",null),e([S()],ke.prototype,"filterVisibility",null),e([S({readOnly:!0})],ke.prototype,"updating",null),e([S({readOnly:!0})],ke.prototype,"dataUpdating",null),e([S({readOnly:!0})],ke.prototype,"readyToRun",null),e([S({readOnly:!0})],ke.prototype,"suspendedOrOutsideOfView",null),e([S({readOnly:!0,dependsOn:[]})],ke.prototype,"updatingRemaining",null),e([S({readOnly:!0})],ke.prototype,"displayFeatureLimit",null),e([S({readOnly:!0,dependsOn:[]})],ke.prototype,"averageSymbolComplexity",null),e([S({constructOnly:!0})],ke.prototype,"hasZ",void 0),e([S({constructOnly:!0})],ke.prototype,"hasM",void 0),e([S()],ke.prototype,"_objectIdField",null),ke=Fe=e([G("esri.views.3d.layers.graphics.Graphics3DCore")],ke);class ze{constructor(){this.add=null,this.renderingInfo=null,this.state=0,this.abortController=null,this.remove=null}clear(){this.add=null,this.renderingInfo=null,this.state=0,this.abortController=null,this.remove=null}}const We=10,He=D(),Be=D(),qe=new Map;export{ke as Graphics3DCore};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/has.js";import{clone as t}from"../../../../core/lang.js";import{getMetersPerVerticalUnitForSR as e}from"../../../../core/units.js";import{e as r}from"../../../../chunks/earcut.js";import{normalFromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as n,invertOrIdentity as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{h as l,a as c,f as p,i as m,n as h,p as u,d,e as g}from"../../../../chunks/vec32.js";import{ONES as f,create as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as b}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as _,fromBuffer as x,intersectsClippingArea as j}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as S}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as w,getZeroIndexArray as P}from"../../../../geometry/support/Indices.js";import{t as v}from"../../../../chunks/vec3.js";import{SnappingCandidateVertex as C,SnappingCandidateEdge as E}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as A}from"../../../../renderers/support/renderingInfoUtils.js";import{needsElevationUpdates3D as D,SampleElevationInfo as I}from"./elevationAlignmentUtils.js";import{Object3DEdgeState as L,Graphics3DObject3DGraphicLayer as U}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as z}from"./Graphics3DSymbolLayer.js";import{computeCentroid as O}from"./graphicUtils.js";import{geometryAsPolygon as M}from"./polygonUtils.js";import{createMaterial as G}from"../support/edgeUtils.js";import{encodeNaNUInt8 as V}from"../support/symbolColorUtils.js";import{debugFlags as T}from"../../support/debugFlags.js";import{SamplePosition as B}from"../../support/ElevationProvider.js";import{polygonToRenderInfo as F}from"../../support/renderInfoUtils/polygon.js";import{Attribute as R}from"../../webgl-engine/lib/Attribute.js";import{Geometry as H}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as k}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{compressNormals as N,compressNormal as W}from"../../webgl-engine/lib/Normals.js";import{Object3D as q}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as Z}from"../../webgl-engine/materials/DefaultMaterial.js";const J=["polygon","extent"];class K extends z{constructor(t,e,r,s){super(t,e,r,s,mt(e)),this.ensureDrapedStatus(!1)}async doLoad(){const t=this.symbolLayer,e=t?.material,r=this.symbolLayer.material?.color?.a,s=this.needsDrivenTransparentPass||null!=r&&1!==r,o=e?.emissive,n=!this._hasDrivenColorOrOpacity&&(null==r||0===r),i={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,ambient:f,diffuse:f,opacity:n?0:1,layerOpacity:this._getLayerOpacity(),drivenOpacity:s,hasSymbolColors:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:t.castShadows,emissiveStrengthFromSymbol:o?.strength??0,emissiveSource:1,offsetTransparentBackfaces:!0,normalType:1},a=new Z(i,this._context),l=new Z({...i,cullFace:2},this._context);this._materials[0]=a,this._materials[1]=l,this._updateTransparentDepedentMaterialParameters()}destroy(){super.destroy(),this._materials.length=0}createGraphics3DGraphic(t){const e=t.graphic;if(!this._validateGeometry(e.geometry,J,this.symbolLayer.type))return null;const r=this._getDrivenUInt8ColorWithNaNSupport(t.renderingInfo,this._materialColor,!1);V(r,r);const s=this.createElevationContextForGraphic(e);return this._createAs3DShape(e,t.renderingInfo,r,s,e.uid)}layerOpacityChanged(t,e){const r=this._getLayerOpacity();this._materials[0]?.setParameters({layerOpacity:r}),this._materials[1]?.setParameters({layerOpacity:r}),this._updateTransparentDepedentMaterialParameters(),t?.forEach(t=>e(t)?.layerOpacityChanged(r,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(t,e){return this.updateGraphics3DGraphicElevationInfo(t,e,D)}slicePlaneEnabledChanged(t,e){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),t?.forEach(t=>{const r=e(t);null!=r&&r.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)}),!0}physicalBasedRenderingChanged(){const t={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0};return this._materials[0]?.setParameters(t),this._materials[1]?.setParameters(t),!0}_getExtrusionSize(t){let e;return e=t.size&&this._drivenProperties.size?A(t.size,2)??0:this._getSymbolSize(),e/=this._context.renderCoordsHelper.unitInMeters,e}applyRendererDiff(t,e){return this._drivenPropertiesChanged(e)?0:1}async queryForSnapping(r,s,o,n){const i=this._getExtrusionSize(o)*this._context.renderCoordsHelper.unitInMeters/e(s),{objectId:a,target:l}=r,c=t(l);switch(c.z=(c.z??0)+i,r.type){case"edge":{const{start:e,end:s}=r,o=t(e),n=t(s);return o.z=(o.z??0)+i,n.z=(n.z??0)+i,[new E(a,c,1/0,o,n)]}case"vertex":return[new C(a,c,1/0),new E(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(t,e,i,l,c){const p=M(t.geometry);if(null==p)return null;if(0===p.rings.length||!p.rings.some(t=>t.length>0))return this._logGeometryValidationWarnings(p.rings,"rings","ExtrudeSymbol3DLayer"),null;const m=F(p,this._context.elevationProvider,this._context.renderCoordsHelper,l);this._logGeometryCreationWarnings(m,p.rings,"rings","ExtrudeSymbol3DLayer");const h=O(p);if(null==h)return null;const u=new Array,d=new Array,g=_(),f=a(),P=y(),C=1===this._context.renderCoordsHelper.viewingMode;C||this._context.renderCoordsHelper.worldUpAtPosition(null,P),b(p.spatialReference,[h.x,h.y,0],f,this._context.renderCoordsHelper.spatialReference);const E=a();n(E,f);const A=o();s(A,E);const{polygons:I,mapPositions:z,position:V}=m,T=new Map,B=this._materials[0];for(const s of I){const t=s.count;if(this._context.clippingExtent&&(x(s.mapPositions,g),!j(g,this._context.clippingExtent)))continue;const o=r(s.mapPositions,s.holeIndices,3);if(0===o.length)continue;const n=o.length,a=6*t,l=w(a+n),p=w(n),m=S(3*a),h=S(3*a),y=S(3*a),b=S(a);X(V,z,o,s,m,y,h,b,l,p,this._getExtrusionSize(e),P,C),v(m,m,E);const _=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:c,layerViewUid:this._context.layerViewUid}),A=new jt(m,y,N(h),b),D=Q(B,l,l.length-p.length,A,i,_),I=t,L=t,U=2*s.count,O=new St(I,L,U,n/3);pt(D,O,f),T.set(D,O),u.push(D,Q(this._materials[1],p,0,A,i,_)),d.push(A.heights)}if(0===u.length)return null;const R=new q({geometries:u,layerViewUid:this._context.layerViewUid,graphicUid:c,isElevationSource:!0});R.transformation=f;const H=G(this.symbolLayer,{opacity:this._getLayerOpacity()}),k=H?new L(this._materials[0],H,this._context.slicePlaneEnabled):null,W=new U(this,R,null,(t,e,r,s,o)=>ct(t,e,r,s,o,d,T),l,k);return W.alignedSampledElevation=m.sampledElevation,W.needsElevationUpdates=D(l.mode),W}get _materialColor(){return this.symbolLayer.material?.color}_updateTransparentDepedentMaterialParameters(){const t=this._materials[0];t&&t.setParameters({cullFace:t.transparent?0:2})}}function Q(t,e,r,s,o,n){const i=P(e.length),a=[["position",new R(s.positions,e,3,!0)],["normalCompressed",new R(s.normals,e,2,!0)],["symbolColor",new R(o,i,4,!0)]];return new H(t,a,s.elevation,0,n,r)}function X(t,e,r,s,o,n,i,a,l,c,p,m,h){const u=r.length/3;let d=2*s.count;Y(t,e,s.index,s.count,r,0,u,o,n,i,a,l,c,d,p,m,h);let g=0,f=2*s.count;d=0;const y=s.pathLengths[0];et(o,n,a,i,g,y,s.count,f,l,d,p),f+=4*y,d+=2*y,g+=y;for(let b=1;b<s.pathLengths.length;++b){const t=s.pathLengths[b];et(o,n,a,i,g,t,s.count,f,l,d,p),f+=4*t,d+=2*t,g+=t}}function Y(t,e,r,s,o,n,i,a,l,c,p,m,u,g,f,y,b){d(ut,y),l??=[],c??=[],p??=[];const _=f>0?1:-1;let x=3*r,j=0,S=3*j,w=s,P=3*w;for(let d=0;d<s;++d){const r=t[x],s=t[x+1],o=t[x+2];b&&(ut[0]=r,ut[1]=s,ut[2]=o,h(ut,ut)),a[S+0]=r,a[S+1]=s,a[S+2]=o;const n=e[x+0],i=e[x+1],m=e[x+2];l[S+0]=n,l[S+1]=i,l[S+2]=m,c[S+0]=-_*ut[0],c[S+1]=-_*ut[1],c[S+2]=-_*ut[2],p[j]=0,a[P+0]=r+f*ut[0],a[P+1]=s+f*ut[1],a[P+2]=o+f*ut[2],l[P+0]=n,l[P+1]=i,l[P+2]=m,p[w]=f,S+=3,P+=3,x+=3,j+=1,w+=1}x=3*n,S=0,P=3*g;const v=f<0?ft:gt,C=f<0?gt:ft;for(let h=0;h<i;++h)u[S]=o[x+v[0]],u[S+1]=o[x+v[1]],u[S+2]=o[x+v[2]],m[P]=o[x+C[0]]+s,m[P+1]=o[x+C[1]]+s,m[P+2]=o[x+C[2]]+s,S+=3,P+=3,x+=3}function $(t,e,r,s,o,n,i){s[n]=s[i],i*=3,t[n*=3]=t[i],t[n+1]=t[i+1],t[n+2]=t[i+2],e[n]=e[i],e[n+1]=e[i+1],e[n+2]=e[i+2],r[n]=o[0],r[n+1]=o[1],r[n+2]=o[2]}const tt=y();function et(t,e,r,s,o,n,i,a,l,c,p){e??=[],r??=[],s??=[];let m=o,h=o+1,u=o+i,d=o+i+1,g=a,f=a+1,y=a+2*n,b=a+2*n+1;p<0&&(m=o+i+1,d=o);let _=3*c;for(let x=0;x<n;++x)x===n-1&&(h=o,p>0?d=o+i:m=o+i),at(t,m,h,u,tt),$(t,e,s,r,tt,g,m),$(t,e,s,r,tt,f,h),$(t,e,s,r,tt,y,u),$(t,e,s,r,tt,b,d),l[_]=g,l[_+1]=y,l[_+2]=b,l[_+3]=g,l[_+4]=b,l[_+5]=f,_+=6,m++,h++,u++,d++,g+=2,f+=2,y+=2,b+=2}const rt=y(),st=y(),ot=y(),nt=y(),it=y();function at(t,e,r,s,o){e*=3,r*=3,s*=3,l(rt,t[e++],t[e++],t[e++]),l(st,t[r++],t[r++],t[r++]),l(ot,t[s++],t[s++],t[s++]),g(nt,st,rt),g(it,ot,rt),p(o,it,nt),h(o,o)}const lt=y();function ct(t,e,r,s,o,n,c){const p=t.stageObject,m=p.geometries,h=m.length,d="absolute-height"!==e.mode;let g=0;const f=p.transformation,y=i(a(),f);for(let i=0;i<h;i+=2){const t=m[i];if(!k(t))continue;const e=t.getMutableAttribute("position").data,a=n[i/2],h=new B(t.mapPositions),b=e.length/3;let _=!1,x=0;{let t=0;for(let n=0;n<b;n++){lt[0]=e[t],lt[1]=e[t+1],lt[2]=e[t+2],s(h,dt),d&&(x+=dt.sampledElevation),T.TESTS_DISABLE_OPTIMIZATIONS?(l(ht,h.array[h.offset],h.array[h.offset+1],dt.z+a[t/3]),null!=r&&o.toRenderCoords(ht,r,ht),u(ht,ht,y)):(l(ht,e[t],e[t+1],e[t+2]),u(ht,ht,f),o.setAltitude(ht,dt.z+a[t/3]),u(ht,ht,y)),e[t]=ht[0],e[t+1]=ht[1],e[t+2]=ht[2];const n=yt/o.unitInMeters;(Math.abs(lt[0]-e[t])>=n||Math.abs(lt[1]-e[t+1])>=n||Math.abs(lt[2]-e[t+2])>=n)&&(_=!0),h.offset+=3,t+=3}}if(_){const e=c.get(t);e&&pt(t,e,f),p.geometryVertexAttributeUpdated(m[i],"normalCompressed"),t.invalidateBoundingInfo(),p.geometryVertexAttributeUpdated(m[i],"position"),m[i+1].invalidateBoundingInfo(),p.geometryVertexAttributeUpdated(m[i+1],"position")}g+=x/b}return g/h}function pt(t,e,r){const s=t.getMutableAttribute("position"),o=t.getMutableAttribute("normalCompressed").data,n=s.data,i=t.attributes.get("position").indices,{topVertexStart:a,topVertexCount:d,topFaceStart:g,topFaceCount:f}=e,y=g+f,b=a+d,_=bt,x=_t,j=xt,S=ut,w=ht;l(w,0,0,0);const P=(t,e)=>{const s=3*t;l(e,n[s+0],n[s+1],n[s+2]),u(e,e,r)};for(let l=g;l<y;++l){const t=3*l;P(i[t+0],_[0]),P(i[t+1],_[1]),P(i[t+2],_[2]),c(x,_[1],_[0]),c(j,_[2],_[0]),p(S,x,j),m(w,w,S)}h(w,w);for(let l=a;l<b;++l){const t=w[0],e=w[1],r=w[2];W(o,l,t,e,r)}}function mt(t){return 1===(t.material?.color?.a??0)}const ht=y(),ut=y(),dt=new I,gt=[0,2,1],ft=[0,1,2],yt=.01,bt=[y(),y(),y()],_t=y(),xt=y();class jt{constructor(t,e,r,s){this.positions=t,this.elevation=e,this.normals=r,this.heights=s}}class St{constructor(t,e,r,s){this.topVertexStart=t,this.topVertexCount=e,this.topFaceStart=r,this.topFaceCount=s}}export{K as Graphics3DExtrudeSymbolLayer,X as extrudePolygon};
|
|
5
|
+
import{clone as t}from"../../../../core/lang.js";import{getMetersPerVerticalUnitForSR as e}from"../../../../core/units.js";import{e as r}from"../../../../chunks/earcut.js";import{normalFromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as n,invertOrIdentity as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{h as l,a as c,f as p,i as m,n as h,p as u,d,e as g}from"../../../../chunks/vec32.js";import{ONES as f,create as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as b}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as _,fromBuffer as x,intersectsClippingArea as S}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as j}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as w,getZeroIndexArray as P}from"../../../../geometry/support/Indices.js";import{t as v}from"../../../../chunks/vec3.js";import{SnappingCandidateVertex as C,SnappingCandidateEdge as E}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as A}from"../../../../renderers/support/renderingInfoUtils.js";import{needsElevationUpdates3D as D,SampleElevationInfo as I}from"./elevationAlignmentUtils.js";import{Object3DEdgeState as L,Graphics3DObject3DGraphicLayer as U}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as z}from"./Graphics3DSymbolLayer.js";import{computeCentroid as O}from"./graphicUtils.js";import{geometryAsPolygon as M}from"./polygonUtils.js";import{createMaterial as G}from"../support/edgeUtils.js";import{encodeNaNUInt8 as V}from"../support/symbolColorUtils.js";import{debugFlags as T}from"../../support/debugFlags.js";import{SamplePosition as B}from"../../support/ElevationProvider.js";import{polygonToRenderInfo as F}from"../../support/renderInfoUtils/polygon.js";import{Attribute as R}from"../../webgl-engine/lib/Attribute.js";import{Geometry as H}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as k}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{compressNormals as N,compressNormal as W}from"../../webgl-engine/lib/Normals.js";import{Object3D as q}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as Z}from"../../webgl-engine/materials/DefaultMaterial.js";const J=["polygon","extent"];class K extends z{constructor(t,e,r,s){super(t,e,r,s,mt(e)),this.ensureDrapedStatus(!1)}async doLoad(){const t=this.symbolLayer,e=t?.material,r=this.symbolLayer.material?.color?.a,s=this.needsDrivenTransparentPass||null!=r&&1!==r,o=e?.emissive,n=!this._hasDrivenColorOrOpacity&&(null==r||0===r),i={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,ambient:f,diffuse:f,opacity:n?0:1,layerOpacity:this._getLayerOpacity(),drivenOpacity:s,hasSymbolColors:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:t.castShadows,emissiveStrengthFromSymbol:o?.strength??0,emissiveSource:1,offsetTransparentBackfaces:!0,normalType:1},a=new Z(i,this._context),l=new Z({...i,cullFace:2},this._context);this._materials[0]=a,this._materials[1]=l,this._updateTransparentDepedentMaterialParameters()}destroy(){super.destroy(),this._materials.length=0}createGraphics3DGraphic(t){const e=t.graphic;if(!this._validateGeometry(e.geometry,J,this.symbolLayer.type))return null;const r=this._getDrivenUInt8ColorWithNaNSupport(t.renderingInfo,this._materialColor,!1);V(r,r);const s=this.createElevationContextForGraphic(e);return this._createAs3DShape(e,t.renderingInfo,r,s,e.uid)}layerOpacityChanged(t,e){const r=this._getLayerOpacity();this._materials[0]?.setParameters({layerOpacity:r}),this._materials[1]?.setParameters({layerOpacity:r}),this._updateTransparentDepedentMaterialParameters(),t?.forEach(t=>e(t)?.layerOpacityChanged(r,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(t,e){return this.updateGraphics3DGraphicElevationInfo(t,e,D)}slicePlaneEnabledChanged(t,e){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),t?.forEach(t=>{const r=e(t);null!=r&&r.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)}),!0}physicalBasedRenderingChanged(){const t={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0};return this._materials[0]?.setParameters(t),this._materials[1]?.setParameters(t),!0}_getExtrusionSize(t){let e;return e=t.size&&this._drivenProperties.size?A(t.size,2)??0:this._getSymbolSize(),e/=this._context.renderCoordsHelper.unitInMeters,e}applyRendererDiff(t,e){return this._drivenPropertiesChanged(e)?0:1}async queryForSnapping(r,s,o,n){const i=this._getExtrusionSize(o)*this._context.renderCoordsHelper.unitInMeters/e(s),{objectId:a,target:l}=r,c=t(l);switch(c.z=(c.z??0)+i,r.type){case"edge":{const{start:e,end:s}=r,o=t(e),n=t(s);return o.z=(o.z??0)+i,n.z=(n.z??0)+i,[new E(a,c,1/0,o,n)]}case"vertex":return[new C(a,c,1/0),new E(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(t,e,i,l,c){const p=M(t.geometry);if(null==p)return null;if(0===p.rings.length||!p.rings.some(t=>t.length>0))return this._logGeometryValidationWarnings(p.rings,"rings","ExtrudeSymbol3DLayer"),null;const m=F(p,this._context.elevationProvider,this._context.renderCoordsHelper,l);this._logGeometryCreationWarnings(m,p.rings,"rings","ExtrudeSymbol3DLayer");const h=O(p);if(null==h)return null;const u=new Array,d=new Array,g=_(),f=a(),P=y(),C=1===this._context.renderCoordsHelper.viewingMode;C||this._context.renderCoordsHelper.worldUpAtPosition(null,P),b(p.spatialReference,[h.x,h.y,0],f,this._context.renderCoordsHelper.spatialReference);const E=a();n(E,f);const A=o();s(A,E);const{polygons:I,mapPositions:z,position:V}=m,T=new Map,B=this._materials[0];for(const s of I){const t=s.count;if(this._context.clippingExtent&&(x(s.mapPositions,g),!S(g,this._context.clippingExtent)))continue;const o=r(s.mapPositions,s.holeIndices,3);if(0===o.length)continue;const n=o.length,a=6*t,l=w(a+n),p=w(n),m=j(3*a),h=j(3*a),y=j(3*a),b=j(a);X(V,z,o,s,m,y,h,b,l,p,this._getExtrusionSize(e),P,C),v(m,m,E);const _=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:c,layerViewUid:this._context.layerViewUid}),A=new St(m,y,N(h),b),D=Q(B,l,l.length-p.length,A,i,_),I=t,L=t,U=2*s.count,O=new jt(I,L,U,n/3);pt(D,O,f),T.set(D,O),u.push(D,Q(this._materials[1],p,0,A,i,_)),d.push(A.heights)}if(0===u.length)return null;const R=new q({geometries:u,layerViewUid:this._context.layerViewUid,graphicUid:c,isElevationSource:!0});R.transformation=f;const H=G(this.symbolLayer,{opacity:this._getLayerOpacity()}),k=H?new L(this._materials[0],H,this._context.slicePlaneEnabled):null,W=new U(this,R,null,(t,e,r,s,o)=>ct(t,e,r,s,o,d,T),l,k);return W.alignedSampledElevation=m.sampledElevation,W.needsElevationUpdates=D(l.mode),W}get _materialColor(){return this.symbolLayer.material?.color}_updateTransparentDepedentMaterialParameters(){const t=this._materials[0];t&&t.setParameters({cullFace:t.transparent?0:2})}}function Q(t,e,r,s,o,n){const i=P(e.length),a=[["position",new R(s.positions,e,3,!0)],["normalCompressed",new R(s.normals,e,2,!0)],["symbolColor",new R(o,i,4,!0)]];return new H(t,a,s.elevation,0,n,r)}function X(t,e,r,s,o,n,i,a,l,c,p,m,h){const u=r.length/3;let d=2*s.count;Y(t,e,s.index,s.count,r,0,u,o,n,i,a,l,c,d,p,m,h);let g=0,f=2*s.count;d=0;const y=s.pathLengths[0];et(o,n,a,i,g,y,s.count,f,l,d,p),f+=4*y,d+=2*y,g+=y;for(let b=1;b<s.pathLengths.length;++b){const t=s.pathLengths[b];et(o,n,a,i,g,t,s.count,f,l,d,p),f+=4*t,d+=2*t,g+=t}}function Y(t,e,r,s,o,n,i,a,l,c,p,m,u,g,f,y,b){d(ut,y),l??=[],c??=[],p??=[];const _=f>0?1:-1;let x=3*r,S=0,j=3*S,w=s,P=3*w;for(let d=0;d<s;++d){const r=t[x],s=t[x+1],o=t[x+2];b&&(ut[0]=r,ut[1]=s,ut[2]=o,h(ut,ut)),a[j+0]=r,a[j+1]=s,a[j+2]=o;const n=e[x+0],i=e[x+1],m=e[x+2];l[j+0]=n,l[j+1]=i,l[j+2]=m,c[j+0]=-_*ut[0],c[j+1]=-_*ut[1],c[j+2]=-_*ut[2],p[S]=0,a[P+0]=r+f*ut[0],a[P+1]=s+f*ut[1],a[P+2]=o+f*ut[2],l[P+0]=n,l[P+1]=i,l[P+2]=m,p[w]=f,j+=3,P+=3,x+=3,S+=1,w+=1}x=3*n,j=0,P=3*g;const v=f<0?ft:gt,C=f<0?gt:ft;for(let h=0;h<i;++h)u[j]=o[x+v[0]],u[j+1]=o[x+v[1]],u[j+2]=o[x+v[2]],m[P]=o[x+C[0]]+s,m[P+1]=o[x+C[1]]+s,m[P+2]=o[x+C[2]]+s,j+=3,P+=3,x+=3}function $(t,e,r,s,o,n,i){s[n]=s[i],i*=3,t[n*=3]=t[i],t[n+1]=t[i+1],t[n+2]=t[i+2],e[n]=e[i],e[n+1]=e[i+1],e[n+2]=e[i+2],r[n]=o[0],r[n+1]=o[1],r[n+2]=o[2]}const tt=y();function et(t,e,r,s,o,n,i,a,l,c,p){e??=[],r??=[],s??=[];let m=o,h=o+1,u=o+i,d=o+i+1,g=a,f=a+1,y=a+2*n,b=a+2*n+1;p<0&&(m=o+i+1,d=o);let _=3*c;for(let x=0;x<n;++x)x===n-1&&(h=o,p>0?d=o+i:m=o+i),at(t,m,h,u,tt),$(t,e,s,r,tt,g,m),$(t,e,s,r,tt,f,h),$(t,e,s,r,tt,y,u),$(t,e,s,r,tt,b,d),l[_]=g,l[_+1]=y,l[_+2]=b,l[_+3]=g,l[_+4]=b,l[_+5]=f,_+=6,m++,h++,u++,d++,g+=2,f+=2,y+=2,b+=2}const rt=y(),st=y(),ot=y(),nt=y(),it=y();function at(t,e,r,s,o){e*=3,r*=3,s*=3,l(rt,t[e++],t[e++],t[e++]),l(st,t[r++],t[r++],t[r++]),l(ot,t[s++],t[s++],t[s++]),g(nt,st,rt),g(it,ot,rt),p(o,it,nt),h(o,o)}const lt=y();function ct(t,e,r,s,o,n,c){const p=t.stageObject,m=p.geometries,h=m.length,d="absolute-height"!==e.mode;let g=0;const f=p.transformation,y=i(a(),f);for(let i=0;i<h;i+=2){const t=m[i];if(!k(t))continue;const e=t.getMutableAttribute("position").data,a=n[i/2],h=new B(t.mapPositions),b=e.length/3;let _=!1,x=0;{let t=0;for(let n=0;n<b;n++){lt[0]=e[t],lt[1]=e[t+1],lt[2]=e[t+2],s(h,dt),d&&(x+=dt.sampledElevation),T.TESTS_DISABLE_OPTIMIZATIONS?(l(ht,h.array[h.offset],h.array[h.offset+1],dt.z+a[t/3]),null!=r&&o.toRenderCoords(ht,r,ht),u(ht,ht,y)):(l(ht,e[t],e[t+1],e[t+2]),u(ht,ht,f),o.setAltitude(ht,dt.z+a[t/3]),u(ht,ht,y)),e[t]=ht[0],e[t+1]=ht[1],e[t+2]=ht[2];const n=yt/o.unitInMeters;(Math.abs(lt[0]-e[t])>=n||Math.abs(lt[1]-e[t+1])>=n||Math.abs(lt[2]-e[t+2])>=n)&&(_=!0),h.offset+=3,t+=3}}if(_){const e=c.get(t);e&&pt(t,e,f),p.geometryVertexAttributeUpdated(m[i],"normalCompressed"),t.invalidateBoundingInfo(),p.geometryVertexAttributeUpdated(m[i],"position"),m[i+1].invalidateBoundingInfo(),p.geometryVertexAttributeUpdated(m[i+1],"position")}g+=x/b}return g/h}function pt(t,e,r){const s=t.getMutableAttribute("position"),o=t.getMutableAttribute("normalCompressed").data,n=s.data,i=t.attributes.get("position").indices,{topVertexStart:a,topVertexCount:d,topFaceStart:g,topFaceCount:f}=e,y=g+f,b=a+d,_=bt,x=_t,S=xt,j=ut,w=ht;l(w,0,0,0);const P=(t,e)=>{const s=3*t;l(e,n[s+0],n[s+1],n[s+2]),u(e,e,r)};for(let l=g;l<y;++l){const t=3*l;P(i[t+0],_[0]),P(i[t+1],_[1]),P(i[t+2],_[2]),c(x,_[1],_[0]),c(S,_[2],_[0]),p(j,x,S),m(w,w,j)}h(w,w);for(let l=a;l<b;++l){const t=w[0],e=w[1],r=w[2];W(o,l,t,e,r)}}function mt(t){return 1===(t.material?.color?.a??0)}const ht=y(),ut=y(),dt=new I,gt=[0,2,1],ft=[0,1,2],yt=.01,bt=[y(),y(),y()],_t=y(),xt=y();class St{constructor(t,e,r,s){this.positions=t,this.elevation=e,this.normals=r,this.heights=s}}class jt{constructor(t,e,r,s){this.topVertexStart=t,this.topVertexCount=e,this.topFaceStart=r,this.topFaceCount=s}}export{K as Graphics3DExtrudeSymbolLayer,X as extrudePolygon};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{XXH as t}from"../../../../arcade/functions/hash.js";import{createTask as i}from"../../../../core/asyncUtils.js";import{neverReached as r}from"../../../../core/compilerUtils.js";import{makeHandle as s}from"../../../../core/handleUtils.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{EsriPromise as a}from"../../../../core/Promise.js";import{logOnError as o,throwIfAborted as l}from"../../../../core/promiseUtils.js";import{watch as p,initial as d,when as u}from"../../../../core/reactiveUtils.js";import{property as h,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{diff as g}from"../../../../core/accessorSupport/diffUtils.js";import{UpdatingHandles as y}from"../../../../core/support/UpdatingHandles.js";import{canProject as m,project as f}from"../../../../geometry/support/webMercatorUtils.js";import{getRenderingInfo as b,getRenderingInfoAsync as C}from"../../../../renderers/support/renderingInfoUtils.js";import{matchRandomRotationExpression as E}from"../../../../support/arcadeExpressionUtils.js";import{suspendResumeExtentOptimism as w}from"./constants.js";import{DisplayFeatureLimit as x}from"./DisplayFeatureLimit.js";import{Graphics3DCore as v}from"./Graphics3DCore.js";import{Graphics3DElevationAlignment as V}from"./Graphics3DElevationAlignment.js";import{Graphics3DFrustumVisibility as R}from"./Graphics3DFrustumVisibility.js";import{Graphics3DObjectStates as O}from"./Graphics3DObjectStates.js";import{Graphics3DScaleVisibility as S}from"./Graphics3DScaleVisibility.js";import{enlargeExtent as j}from"./graphicUtils.js";import{FeatureVisibilityFilter as _}from"../support/FeatureVisibilityFilter.js";import{emptyHighlightHandle as U}from"../support/highlightUtils.js";let G=class extends a{constructor(e){super(e),this.type="graphics-3d",this._updatingHandles=new y,this.elevationFeatureExpressionEnabled=!1,this.scaleVisibilityEnabled=!1,this.filterVisibilityEnabled=!1,this.frustumVisibilityEnabled=!1,this.elevationAlignmentEnabled=!1,this.timeExtentEnabled=!1,this.setUidToIdOnAdd=!0,this.dataExtent=null,this.drapeSourceType=1,this.preferredUpdatePolicy=0,this._suspendResumeExtent=null}initialize(){const e=this.owner,t=(this.filterVisibilityEnabled||this.timeExtentEnabled)&&"multipatch"!==e.layer.geometryType,r=new v({owner:this,layer:this.layer,preferredUpdatePolicy:this.preferredUpdatePolicy,elevationFeatureExpressionEnabled:this.elevationFeatureExpressionEnabled,graphicSymbolSupported:!1,hasZ:e.hasZ,hasM:e.hasM,setUidToIdOnAdd:this.setUidToIdOnAdd,componentFactories:{deconflictor:t=>e.view.deconflictor.addGraphicsOwner(t),labeler:(t,i)=>e.view.labeler.addGraphicsOwner(t,i),elevationAlignment:this.elevationAlignmentEnabled?(t,i)=>new V({graphicsCoreOwner:this,graphicsCore:t,queryGraphicUIDsInExtent:i,elevationProvider:e.view.elevationProvider}):null,scaleVisibility:this.scaleVisibilityEnabled?(t,i)=>new S({graphicsCoreOwner:this,layer:this.layer,queryGraphicUIDsInExtent:i,graphicsCore:t,basemapTerrain:e.view.basemapTerrain}):null,filterVisibility:t?t=>new _({context:{...t,configuration:e}}):null,objectStates:e=>new O(e)}});this._set("graphicsCore",r),this.frustumVisibilityEnabled&&this._set("frustumVisibility",new R({graphicsCoreOwner:this})),this.elevationAlignment&&this._updatingHandles.add(()=>this.layer.elevationInfo,(e,t)=>{g(e,t)&&this._updatingHandles.addPromise(this.graphicsCore.elevationInfoChange())}),this._updatingHandles.add(()=>this.layer.labelsVisible,()=>this.graphicsCore.updateVisibilityInfo()),this._updatingHandles.add(()=>this.layer.labelingInfo,(e,t)=>{g(e,t)&&this.graphicsCore.updateLabelingInfo()}),this._updatingHandles.add(()=>this.preferredUpdatePolicy,e=>this.graphicsCore.preferredUpdatePolicy=e),this.addResolvingTask(i(e=>this._initializeAsync(e)))}async _initializeAsync(e){await o(this.graphicsCore.initializePromise),l(e);const t=this.owner;this._updatingHandles.add(()=>this.renderer,e=>this._updatingHandles.addPromise(this.graphicsCore.rendererChange(e))),this._updatingHandles.add(()=>t.fullOpacity,()=>this.graphicsCore.opacityChange()),this._setupSuspendResumeExtent(),this.updateClippingExtent&&(this._updatingHandles.add(()=>t.view.clippingArea,()=>this._updateClippingExtent()),this._updateClippingExtent()),this.graphicsCore.startCreateGraphics(),this.graphicsCore.labelsEnabled&&(await o(this.graphicsCore.updateLabelingInfo()),l(e))}destroy(){this._updatingHandles.destroy(),this._set("frustumVisibility",n(this.frustumVisibility)),this._set("graphicsCore",n(this.graphicsCore)),this._set("owner",null)}get layer(){return this.owner.layer}get layerViewUid(){return this.owner.layerViewUid}get dataUpdating(){return this.graphicsCore?.dataUpdating??!1}get renderer(){const{renderer:e,objectIdField:t}=this.layer;if(!e||!t||"heatmap"===e.type||!e.visualVariables)return e;const i=e.visualVariables.findIndex(e=>"rotation"===e.type&&null!=e.valueExpression&&E(e.valueExpression)===t&&(null==e.axis||"heading"===e.axis)&&"geographic"===e.rotationType);if(i<0)return e;const r=e.clone();return r.visualVariables?(r.visualVariables.splice(i,1),this._randomRotationRenderers??=new WeakMap,this._randomRotationRenderers.set(r,t),r):e}get scaleVisibility(){return this.graphicsCore?.scaleVisibility}get filterVisibility(){return this.graphicsCore?.filterVisibility}get elevationAlignment(){return this.graphicsCore?.elevationAlignment}get suspendResumeExtentMode(){return this.owner.suspendResumeExtentMode??"computed"}get scaleVisibilitySuspended(){return null!=this.scaleVisibility&&this.scaleVisibility.suspended}get suspended(){return this.owner.suspended}get legendEnabled(){return null==this.frustumVisibility||!this.frustumVisibility.suspended}get suspendInfo(){const e={};return this.scaleVisibilitySuspended&&(e.outsideScaleRange=!0),null!=this.frustumVisibility&&this.frustumVisibility.suspended&&(e.outsideOfView=!0),e}get updating(){return!!(this.graphicsCore?.updating||this.frustumVisibility?.updating||this._updatingHandles.updating)}get updatingRemaining(){return this.graphicsCore?.updatingRemaining??0}get featureStore(){return this.graphicsCore?.featureStore}get view(){return this.owner.view}get loadedGraphics(){return this.owner.loadedGraphics}get fullOpacity(){return this.owner?.fullOpacity}get filter(){return"filter"in this.owner?this.owner.filter:null}get slicePlaneEnabled(){return this.owner.slicePlaneEnabled}get updatePolicy(){return this.owner.updatePolicy}get featureSpatialReference(){return"featureSpatialReference"in this.owner?this.owner.featureSpatialReference:this.owner.view.spatialReference}get graphics3DGraphics(){return this.graphicsCore?.graphics3DGraphics}get graphics3DGraphicsByObjectID(){return this.graphicsCore?.graphics3DGraphicsByObjectID}get symbolUpdateType(){return this.graphicsCore?.symbolUpdateType}get displayFeatureLimit(){const e=this.view.quality,t=this.graphicsCore?.displayFeatureLimit;if(1===e)return t;const i=Math.ceil(t.maximumNumberOfFeatures*e);return new x(t.maximumTotalNumberOfVertices,i,t.averageSymbolComplexity)}get usedMemory(){return this.graphicsCore?.usedMemory??0}get loadedFeatures(){return this.graphicsCore?.numberOfGraphics??0}get usedMemoryPerFeature(){return this.graphicsCore?.usedMemoryPerGraphic??0}get unprocessedMemoryEstimate(){return this.graphicsCore?.unprocessedMemoryEstimate??0}get performanceInfo(){return this.graphicsCore.performanceInfo}maskOccludee(e){const t=this.graphicsCore?.objectStates;if(!t)return s();const{set:i,handle:r}=t.acquireOccludeeSet(null);return t.setUid(i,e.uid),r}highlightByGraphics(e,t){const i=this.graphicsCore?.objectStates;if(!i)return U;const r=e.map(e=>e.uid),{set:s,handle:n}=i.acquireHighlightSet(t,null);return i.setUids(s,r),n}highlightByObjectIds(e,t=null,i){const r=this.graphicsCore?.objectStates;if(!r)return U;const{set:s,handle:n}=r.acquireHighlightSet(i,t);return r.setObjectIds(s,e),n}resetObjectStates(){this.graphicsCore?.objectStates?.reset()}whenGraphicBounds(e,t){return this.graphicsCore?.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.graphicsCore?.computeAttachmentOrigin(e,t)}notifyGraphicGeometryChanged(e){this.graphicsCore.notifyGraphicGeometryChanged(e)}notifyGraphicVisibilityChanged(e){this.graphicsCore.notifyGraphicVisibilityChanged(e)}notifyContentGeometryUpdate(){this.owner.notifyContentGeometryUpdate?.()}getRenderingInfo(e,i,r){const s=b(e,{renderer:i,arcade:r});if(s?.color){const e=s.color;e[0]=e[0]/255,e[1]=e[1]/255,e[2]=e[2]/255}if(null!=s&&null!=i&&this._randomRotationRenderers?.has(i)){const r=this._randomRotationRenderers.get(i),n=e.attributes[r],a=new t(0);a.updateFloatArray([n]),a.updateUint8Array([173]),s.heading=8.381e-8*a.digest()}return s}getRenderingInfoAsync(e,t,i,r){return C(e,{renderer:t,arcade:i,...r})}getSymbolLayerSize(e,t){return this.graphicsCore?.getSymbolLayerSize(e,t)}setObjectIdVisibility(e,t){this.graphicsCore?.setObjectIdVisibility(e,t)}refreshFilter(){null!=this.filterVisibility&&this.filterVisibility.reapply()}getGraphics3DGraphicByObjectId(e){return this.graphicsCore?.getGraphics3DGraphicByObjectId(e)}_updateClippingExtent(){const e=this.owner.view.clippingArea;this.graphicsCore.setClippingExtent(e,this.owner.view.spatialReference)&&(this.updateClippingExtent(e)||this.graphicsCore.recreateAllGraphics())}_setupSuspendResumeExtent(){(this.frustumVisibility||this.scaleVisibility)&&this.addHandles(p(()=>this.suspendResumeExtentMode,()=>{switch(this.removeHandles(I),this.suspendResumeExtentMode){case"computed":this.addHandles([p(()=>this.graphicsCore.computedExtent,e=>this._updateSuspendResumeExtent(e),d),p(()=>this.graphicsCore.extentPadding,()=>this._updateSuspendResumeExtent(this.graphicsCore.computedExtent))],I);break;case"data":this.addHandles([u(()=>this.dataExtent,e=>this._updateSuspendResumeExtent(e),d),p(()=>this.graphicsCore.extentPadding,()=>this._updateSuspendResumeExtent(this.dataExtent))],I);break;default:r(this.suspendResumeExtentMode)}},d))}_updateSuspendResumeExtent(e){e?this._suspendResumeExtentChanged(this._extentToSuspendResumeRect(e,this._suspendResumeExtent)):this._suspendResumeExtentChanged(null)}_extentToSuspendResumeRect(e,t){const i=this.owner.view.spatialReference;if(!e.spatialReference.equals(i)){if(!m(e,i))return;e=f(e,i)}return j(e,t,w,this.graphicsCore.extentPadding)}_suspendResumeExtentChanged(e){null!=this.frustumVisibility&&this.frustumVisibility.setExtent(e),null!=this.scaleVisibility&&this.scaleVisibility.setExtent(e)}};e([h()],G.prototype,"type",void 0),e([h({constructOnly:!0})],G.prototype,"owner",void 0),e([h()],G.prototype,"layer",null),e([h()],G.prototype,"layerViewUid",null),e([h({readOnly:!0})],G.prototype,"dataUpdating",null),e([h()],G.prototype,"renderer",null),e([h({constructOnly:!0})],G.prototype,"updateClippingExtent",void 0),e([h({constructOnly:!0})],G.prototype,"elevationFeatureExpressionEnabled",void 0),e([h({constructOnly:!0})],G.prototype,"graphicsCore",void 0),e([h({constructOnly:!0})],G.prototype,"scaleVisibilityEnabled",void 0),e([h({constructOnly:!0})],G.prototype,"filterVisibilityEnabled",void 0),e([h({constructOnly:!0})],G.prototype,"frustumVisibilityEnabled",void 0),e([h({constructOnly:!0})],G.prototype,"elevationAlignmentEnabled",void 0),e([h({constructOnly:!0})],G.prototype,"timeExtentEnabled",void 0),e([h({constructOnly:!0})],G.prototype,"setUidToIdOnAdd",void 0),e([h()],G.prototype,"scaleVisibility",null),e([h()],G.prototype,"filterVisibility",null),e([h()],G.prototype,"elevationAlignment",null),e([h({constructOnly:!0})],G.prototype,"frustumVisibility",void 0),e([h()],G.prototype,"suspendResumeExtentMode",null),e([h()],G.prototype,"dataExtent",void 0),e([h()],G.prototype,"scaleVisibilitySuspended",null),e([h()],G.prototype,"suspended",null),e([h()],G.prototype,"legendEnabled",null),e([h()],G.prototype,"suspendInfo",null),e([h()],G.prototype,"updating",null),e([h()],G.prototype,"updatingRemaining",null),e([h()],G.prototype,"featureStore",null),e([h()],G.prototype,"view",null),e([h()],G.prototype,"loadedGraphics",null),e([h()],G.prototype,"fullOpacity",null),e([h()],G.prototype,"filter",null),e([h()],G.prototype,"slicePlaneEnabled",null),e([h()],G.prototype,"drapeSourceType",void 0),e([h()],G.prototype,"updatePolicy",null),e([h()],G.prototype,"preferredUpdatePolicy",void 0),e([h({readOnly:!0})],G.prototype,"displayFeatureLimit",null),G=e([c("esri.views.3d.layers.graphics.Graphics3DFeatureProcessor")],G);const I="suspendResumeExtentMode";export{G as Graphics3DFeatureProcessor};
|
|
5
|
+
import{__decorate as e}from"tslib";import{XXH as t}from"../../../../arcade/functions/hash.js";import{createTask as i}from"../../../../core/asyncUtils.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{EsriPromise as n}from"../../../../core/Promise.js";import{logOnError as a,throwIfAborted as o}from"../../../../core/promiseUtils.js";import{watch as l,initial as p,when as d}from"../../../../core/reactiveUtils.js";import{property as u,subclass as h}from"../../../../core/accessorSupport/decorators.js";import{diff as c}from"../../../../core/accessorSupport/diffUtils.js";import{UpdatingHandles as g}from"../../../../core/support/UpdatingHandles.js";import{canProject as y,project as m}from"../../../../geometry/support/webMercatorUtils.js";import{getRenderingInfo as f,getRenderingInfoAsync as b}from"../../../../renderers/support/renderingInfoUtils.js";import{matchRandomRotationExpression as C}from"../../../../support/arcadeExpressionUtils.js";import{suspendResumeExtentOptimism as E}from"./constants.js";import{DisplayFeatureLimit as w}from"./DisplayFeatureLimit.js";import{Graphics3DCore as x}from"./Graphics3DCore.js";import{Graphics3DElevationAlignment as v}from"./Graphics3DElevationAlignment.js";import{Graphics3DFrustumVisibility as V}from"./Graphics3DFrustumVisibility.js";import{Graphics3DObjectStates as R}from"./Graphics3DObjectStates.js";import{Graphics3DScaleVisibility as O}from"./Graphics3DScaleVisibility.js";import{enlargeExtent as S}from"./graphicUtils.js";import{FeatureVisibilityFilter as _}from"../support/FeatureVisibilityFilter.js";import{emptyHighlightHandle as j}from"../support/highlightUtils.js";let G=class extends n{constructor(e){super(e),this.type="graphics-3d",this._updatingHandles=new g,this.elevationFeatureExpressionEnabled=!1,this.scaleVisibilityEnabled=!1,this.filterVisibilityEnabled=!1,this.frustumVisibilityEnabled=!1,this.elevationAlignmentEnabled=!1,this.timeExtentEnabled=!1,this.setUidToIdOnAdd=!0,this.dataExtent=null,this.drapeSourceType=1,this.preferredUpdatePolicy=0,this._suspendResumeExtent=null}initialize(){const e=this.owner,t=(this.filterVisibilityEnabled||this.timeExtentEnabled)&&"multipatch"!==e.layer.geometryType,r=new x({owner:this,layer:this.layer,preferredUpdatePolicy:this.preferredUpdatePolicy,elevationFeatureExpressionEnabled:this.elevationFeatureExpressionEnabled,graphicSymbolSupported:!1,hasZ:e.hasZ,hasM:e.hasM,setUidToIdOnAdd:this.setUidToIdOnAdd,componentFactories:{deconflictor:t=>e.view.deconflictor.addGraphicsOwner(t),labeler:(t,i)=>e.view.labeler.addGraphicsOwner(t,i),elevationAlignment:this.elevationAlignmentEnabled?(t,i)=>new v({graphicsCoreOwner:this,graphicsCore:t,queryGraphicUIDsInExtent:i,elevationProvider:e.view.elevationProvider}):null,scaleVisibility:this.scaleVisibilityEnabled?(t,i)=>new O({graphicsCoreOwner:this,layer:this.layer,queryGraphicUIDsInExtent:i,graphicsCore:t,basemapTerrain:e.view.basemapTerrain}):null,filterVisibility:t?t=>new _({context:{...t,configuration:e}}):null,objectStates:e=>new R(e)}});this._set("graphicsCore",r),this.frustumVisibilityEnabled&&this._set("frustumVisibility",new V({graphicsCoreOwner:this})),this.elevationAlignment&&this._updatingHandles.add(()=>this.layer.elevationInfo,(e,t)=>{c(e,t)&&this._updatingHandles.addPromise(this.graphicsCore.elevationInfoChange())}),this._updatingHandles.add(()=>this.layer.labelsVisible,()=>this.graphicsCore.updateVisibilityInfo()),this._updatingHandles.add(()=>this.layer.labelingInfo,(e,t)=>{c(e,t)&&this.graphicsCore.updateLabelingInfo()}),this._updatingHandles.add(()=>this.preferredUpdatePolicy,e=>this.graphicsCore.preferredUpdatePolicy=e),this.addResolvingTask(i(e=>this._initializeAsync(e)))}async _initializeAsync(e){await a(this.graphicsCore.initializePromise),o(e);const t=this.owner;this._updatingHandles.add(()=>this.renderer,e=>this._updatingHandles.addPromise(this.graphicsCore.rendererChange(e))),this._updatingHandles.add(()=>t.fullOpacity,()=>this.graphicsCore.opacityChange()),this._setupSuspendResumeExtent(),this.updateClippingExtent&&(this._updatingHandles.add(()=>t.view.clippingArea,()=>this._updateClippingExtent()),this._updateClippingExtent()),this.graphicsCore.startCreateGraphics(),this.graphicsCore.labelsEnabled&&(await a(this.graphicsCore.updateLabelingInfo()),o(e))}destroy(){this._updatingHandles.destroy(),this._set("frustumVisibility",s(this.frustumVisibility)),this._set("graphicsCore",s(this.graphicsCore)),this._set("owner",null)}get layer(){return this.owner.layer}get layerViewUid(){return this.owner.layerViewUid}get dataUpdating(){return this.graphicsCore?.dataUpdating??!1}get renderer(){const{renderer:e,objectIdField:t}=this.layer;if(!e||!t||"heatmap"===e.type||!e.visualVariables)return e;const i=e.visualVariables.findIndex(e=>"rotation"===e.type&&null!=e.valueExpression&&C(e.valueExpression)===t&&(null==e.axis||"heading"===e.axis)&&"geographic"===e.rotationType);if(i<0)return e;const r=e.clone();return r.visualVariables?(r.visualVariables.splice(i,1),this._randomRotationRenderers??=new WeakMap,this._randomRotationRenderers.set(r,t),r):e}get scaleVisibility(){return this.graphicsCore?.scaleVisibility}get filterVisibility(){return this.graphicsCore?.filterVisibility}get elevationAlignment(){return this.graphicsCore?.elevationAlignment}get suspendResumeExtentMode(){return this.owner.suspendResumeExtentMode??"computed"}get scaleVisibilitySuspended(){return null!=this.scaleVisibility&&this.scaleVisibility.suspended}get suspended(){return this.owner.suspended}get legendEnabled(){return null==this.frustumVisibility||!this.frustumVisibility.suspended}get suspendInfo(){const e={};return this.scaleVisibilitySuspended&&(e.outsideScaleRange=!0),null!=this.frustumVisibility&&this.frustumVisibility.suspended&&(e.outsideOfView=!0),e}get updating(){return!!(this.graphicsCore?.updating||this.frustumVisibility?.updating||this._updatingHandles.updating)}get updatingRemaining(){return this.graphicsCore?.updatingRemaining??0}get featureStore(){return this.graphicsCore?.featureStore}get view(){return this.owner.view}get loadedGraphics(){return this.owner.loadedGraphics}get fullOpacity(){return this.owner?.fullOpacity}get filter(){return"filter"in this.owner?this.owner.filter:null}get slicePlaneEnabled(){return this.owner.slicePlaneEnabled}get updatePolicy(){return this.owner.updatePolicy}get featureSpatialReference(){return"featureSpatialReference"in this.owner?this.owner.featureSpatialReference:this.owner.view.spatialReference}get graphics3DGraphics(){return this.graphicsCore?.graphics3DGraphics}get graphics3DGraphicsByObjectID(){return this.graphicsCore?.graphics3DGraphicsByObjectID}get symbolUpdateType(){return this.graphicsCore?.symbolUpdateType}get displayFeatureLimit(){const e=this.view.quality,t=this.graphicsCore?.displayFeatureLimit;if(1===e)return t;const i=Math.ceil(t.maximumNumberOfFeatures*e);return new w(t.maximumTotalNumberOfVertices,i,t.averageSymbolComplexity)}get usedMemory(){return this.graphicsCore?.usedMemory??0}get loadedFeatures(){return this.graphicsCore?.numberOfGraphics??0}get usedMemoryPerFeature(){return this.graphicsCore?.usedMemoryPerGraphic??0}get unprocessedMemoryEstimate(){return this.graphicsCore?.unprocessedMemoryEstimate??0}get performanceInfo(){return this.graphicsCore.performanceInfo}maskOccludee(e){const t=this.graphicsCore?.objectStates;if(!t)return r();const{set:i,handle:s}=t.acquireOccludeeSet(null);return t.setUid(i,e.uid),s}highlightByGraphics(e,t){const i=this.graphicsCore?.objectStates;if(!i)return j;const r=e.map(e=>e.uid),{set:s,handle:n}=i.acquireHighlightSet(t,null);return i.setUids(s,r),n}highlightByObjectIds(e,t=null,i){const r=this.graphicsCore?.objectStates;if(!r)return j;const{set:s,handle:n}=r.acquireHighlightSet(i,t);return r.setObjectIds(s,e),n}resetObjectStates(){this.graphicsCore?.objectStates?.reset()}whenGraphicBounds(e,t){return this.graphicsCore?.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.graphicsCore?.computeAttachmentOrigin(e,t)}notifyGraphicGeometryChanged(e){this.graphicsCore.notifyGraphicGeometryChanged(e)}notifyGraphicVisibilityChanged(e){this.graphicsCore.notifyGraphicVisibilityChanged(e)}notifyContentGeometryUpdate(){this.owner.notifyContentGeometryUpdate?.()}getRenderingInfo(e,i,r){const s=f(e,{renderer:i,arcade:r});if(s?.color){const e=s.color;e[0]=e[0]/255,e[1]=e[1]/255,e[2]=e[2]/255}if(null!=s&&null!=i&&this._randomRotationRenderers?.has(i)){const r=this._randomRotationRenderers.get(i),n=e.attributes[r],a=new t(0);a.updateFloatArray([n]),a.updateUint8Array([173]),s.heading=8.381e-8*a.digest()}return s}getRenderingInfoAsync(e,t,i,r){return b(e,{renderer:t,arcade:i,...r})}getSymbolLayerSize(e,t){return this.graphicsCore?.getSymbolLayerSize(e,t)}setObjectIdVisibility(e,t){this.graphicsCore?.setObjectIdVisibility(e,t)}refreshFilter(){null!=this.filterVisibility&&this.filterVisibility.reapply()}getGraphics3DGraphicByObjectId(e){return this.graphicsCore?.getGraphics3DGraphicByObjectId(e)}_updateClippingExtent(){const e=this.owner.view.clippingArea;this.graphicsCore.setClippingExtent(e,this.owner.view.spatialReference)&&(this.updateClippingExtent(e)||this.graphicsCore.recreateAllGraphics())}_setupSuspendResumeExtent(){(this.frustumVisibility||this.scaleVisibility)&&this.addHandles(l(()=>this.suspendResumeExtentMode,()=>{switch(this.removeHandles(U),this.suspendResumeExtentMode){case"computed":this.addHandles([l(()=>this.graphicsCore.computedExtent,e=>this._updateSuspendResumeExtent(e),p),l(()=>this.graphicsCore.extentPadding,()=>this._updateSuspendResumeExtent(this.graphicsCore.computedExtent))],U);break;case"data":this.addHandles([d(()=>this.dataExtent,e=>this._updateSuspendResumeExtent(e),p),l(()=>this.graphicsCore.extentPadding,()=>this._updateSuspendResumeExtent(this.dataExtent))],U);break;default:this.suspendResumeExtentMode}},p))}_updateSuspendResumeExtent(e){e?this._suspendResumeExtentChanged(this._extentToSuspendResumeRect(e,this._suspendResumeExtent)):this._suspendResumeExtentChanged(null)}_extentToSuspendResumeRect(e,t){const i=this.owner.view.spatialReference;if(!e.spatialReference.equals(i)){if(!y(e,i))return;e=m(e,i)}return S(e,t,E,this.graphicsCore.extentPadding)}_suspendResumeExtentChanged(e){null!=this.frustumVisibility&&this.frustumVisibility.setExtent(e),null!=this.scaleVisibility&&this.scaleVisibility.setExtent(e)}};e([u()],G.prototype,"type",void 0),e([u({constructOnly:!0})],G.prototype,"owner",void 0),e([u()],G.prototype,"layer",null),e([u()],G.prototype,"layerViewUid",null),e([u({readOnly:!0})],G.prototype,"dataUpdating",null),e([u()],G.prototype,"renderer",null),e([u({constructOnly:!0})],G.prototype,"updateClippingExtent",void 0),e([u({constructOnly:!0})],G.prototype,"elevationFeatureExpressionEnabled",void 0),e([u({constructOnly:!0})],G.prototype,"graphicsCore",void 0),e([u({constructOnly:!0})],G.prototype,"scaleVisibilityEnabled",void 0),e([u({constructOnly:!0})],G.prototype,"filterVisibilityEnabled",void 0),e([u({constructOnly:!0})],G.prototype,"frustumVisibilityEnabled",void 0),e([u({constructOnly:!0})],G.prototype,"elevationAlignmentEnabled",void 0),e([u({constructOnly:!0})],G.prototype,"timeExtentEnabled",void 0),e([u({constructOnly:!0})],G.prototype,"setUidToIdOnAdd",void 0),e([u()],G.prototype,"scaleVisibility",null),e([u()],G.prototype,"filterVisibility",null),e([u()],G.prototype,"elevationAlignment",null),e([u({constructOnly:!0})],G.prototype,"frustumVisibility",void 0),e([u()],G.prototype,"suspendResumeExtentMode",null),e([u()],G.prototype,"dataExtent",void 0),e([u()],G.prototype,"scaleVisibilitySuspended",null),e([u()],G.prototype,"suspended",null),e([u()],G.prototype,"legendEnabled",null),e([u()],G.prototype,"suspendInfo",null),e([u()],G.prototype,"updating",null),e([u()],G.prototype,"updatingRemaining",null),e([u()],G.prototype,"featureStore",null),e([u()],G.prototype,"view",null),e([u()],G.prototype,"loadedGraphics",null),e([u()],G.prototype,"fullOpacity",null),e([u()],G.prototype,"filter",null),e([u()],G.prototype,"slicePlaneEnabled",null),e([u()],G.prototype,"drapeSourceType",void 0),e([u()],G.prototype,"updatePolicy",null),e([u()],G.prototype,"preferredUpdatePolicy",void 0),e([u({readOnly:!0})],G.prototype,"displayFeatureLimit",null),G=e([h("esri.views.3d.layers.graphics.Graphics3DFeatureProcessor")],G);const U="suspendResumeExtentMode";export{G as Graphics3DFeatureProcessor};
|