@arcgis/core 4.26.0-next.20221221 → 4.26.0-next.20221223
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/WebScene.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{2163b9ee4d639d5ed6f3.js → 05bba3ba2f9ee02f52b5.js} +1 -1
- package/assets/esri/core/workers/chunks/{bbccf69f4aa1b1761265.js → 0b8dc54801a7aa5e6be3.js} +1 -1
- package/assets/esri/core/workers/chunks/{6dbd3aabfe4d5d593205.js → 0b9c53e01d6ac1e7d5ca.js} +29 -29
- package/assets/esri/core/workers/chunks/1039cd48a12e88baa97a.js +1 -0
- package/assets/esri/core/workers/chunks/{634e7957696f72c8b8b1.js → 3fb4ae8d6e8563a1c255.js} +1 -1
- package/assets/esri/core/workers/chunks/{b61ce04af4e57b1856cb.js → d447ebc944a9867f5a99.js} +1 -1
- package/assets/esri/core/workers/chunks/e3ba96417fd75a5d2feb.js +1 -0
- package/assets/esri/core/workers/chunks/{099765dff2b7e6958d3d.js → efc9030af5aac27055a1.js} +1 -1
- package/assets/esri/themes/base/widgets/_UtilityNetworkTrace.scss +1 -1
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ar.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_bg.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_bs.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ca.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_cs.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_da.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_de.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_el.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_es.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_et.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_fi.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_fr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_he.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_hr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_hu.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_id.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_it.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ja.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ko.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_lt.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_lv.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_nb.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_nl.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_pl.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_pt-BR.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_pt-PT.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ro.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_ru.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sk.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sl.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_sv.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_th.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_tr.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_uk.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_vi.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_zh-CN.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_zh-HK.json +1 -1
- package/assets/esri/widgets/Directions/t9n/Directions_zh-TW.json +1 -1
- package/assets/esri/widgets/Feature/t9n/Feature_he.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_ar.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_bg.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_bs.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_ca.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_cs.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_da.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_de.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_el.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_es.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_et.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_fi.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_fr.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_he.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_hr.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_hu.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_id.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_it.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_ja.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_ko.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_lt.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_lv.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_nb.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_nl.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_pl.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_pt-BR.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_pt-PT.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_ro.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_ru.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_sk.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_sl.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_sr.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_sv.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_th.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_tr.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_uk.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_vi.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_zh-CN.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_zh-HK.json +1 -1
- package/assets/esri/widgets/Popup/t9n/Popup_zh-TW.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ar.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_bg.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_bs.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ca.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_cs.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_da.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_de.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_el.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_es.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_et.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_fi.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_fr.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_he.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_hr.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_hu.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_id.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_it.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ja.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ko.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_lt.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_lv.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_nb.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_nl.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_pl.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_pt-BR.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_pt-PT.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ro.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_ru.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_sk.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_sl.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_sr.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_sv.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_th.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_tr.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_uk.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_vi.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_zh-CN.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_zh-HK.json +1 -1
- package/assets/esri/widgets/Slice/t9n/Slice_zh-TW.json +1 -1
- package/core/workers/workers.js +1 -1
- package/geometry/support/intersects.js +1 -1
- package/geometry/support/meshUtils/elevation.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/index.js +1 -1
- package/geometry.js +1 -1
- package/interfaces.d.ts +868 -0
- package/intl.js +1 -1
- package/layers/support/ImageParameters.js +1 -1
- package/layers/support/VoxelVariable.js +1 -1
- package/layers/support/VoxelVolumeStyle.js +1 -1
- package/layers/support/domains.js +1 -1
- package/layers/support/rasterDatasets/wcsCoverageParser.js +1 -1
- package/libs/maquette/projection.js +1 -1
- package/package.json +1 -1
- package/pointCloudRenderers.js +1 -1
- package/popup/content.js +1 -1
- package/rasterRenderers.js +1 -1
- package/renderers.js +1 -1
- package/rest/locator/addressesToLocations.js +1 -1
- package/support/arcadeUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/support/unitConversionUtils.js +1 -1
- package/symbols.js +1 -1
- package/views/2d/engine/FeatureContainer.js +1 -1
- package/views/2d/layers/BaseLayerViewGL2D.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/GraphicsLayerView2D.js +1 -1
- package/views/2d/layers/KMLLayerView2D.js +1 -1
- package/views/2d/layers/LayerView2D.js +1 -1
- package/views/2d/layers/MapImageLayerView2D.js +1 -1
- package/views/2d/layers/MapNotesLayerView2D.js +1 -1
- package/views/2d/layers/RouteLayerView2D.js +1 -1
- package/views/2d/layers/StreamLayerView2D.js +1 -1
- package/views/2d/layers/VectorTileLayerView2D.js +1 -1
- package/views/2d/layers/WMSLayerView2D.js +1 -1
- package/views/2d/layers/WMTSLayerView2D.js +1 -1
- package/views/2d/layers/features/FeatureStore2D.js +1 -1
- package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
- package/views/2d/layers/features/processors/HeatmapProcessor.js +1 -1
- package/views/2d/layers/features/processors/SymbolProcessor.js +1 -1
- package/views/2d/layers/features/schemaUtils.js +1 -1
- package/views/2d/layers/features/sources/BaseFeatureSource.js +1 -1
- package/views/2d/layers/features/sources/DataTileSource.js +1 -1
- package/views/2d/layers/features/sources/DataTileSubscription.js +1 -1
- package/views/2d/layers/features/sources/GeoEventSource.js +1 -1
- package/views/2d/layers/features/sources/SnapshotFeatureSource.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/rendererUtils.js +1 -1
- package/views/2d/layers/features/tileRenderers/SymbolTileRenderer.js +1 -1
- package/views/2d/layers/features/tileRenderers/support/HeatmapSource.js +1 -1
- package/views/2d/layers/features/tileRenderers/support/WGLFeatureView.js +1 -1
- package/views/2d/layers/features/tileRenderers/support/visualVariablesUtils.js +1 -1
- package/views/2d/layers/graphics/BaseGraphicContainer.js +1 -1
- package/views/2d/layers/graphics/GraphicBoundsRenderer.js +1 -1
- package/views/2d/layers/graphics/graphicsUtils.js +1 -1
- package/views/2d/layers/imagery/ImageryView2D.js +1 -1
- package/views/2d/layers/support/DebugOverlay.js +1 -1
- package/views/2d/layers/support/ExportStrategy.js +1 -1
- package/views/2d/layers/support/FeatureLayerProxy.js +1 -1
- package/views/2d/magnifier/MagnifierView2D.js +1 -1
- package/views/2d/navigation/MapViewNavigation.js +1 -1
- package/views/2d/navigation/ZoomBox.js +1 -1
- package/views/2d/navigation/actions/Pan.js +1 -1
- package/views/2d/navigation/actions/Pinch.js +1 -1
- package/views/2d/tiling/TileManager.js +1 -1
- package/views/3d/analysis/DirectLineMeasurementAnalysisView3D.js +1 -1
- package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/GraphicsView3D.js +1 -1
- package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/TiledLayerView3D.js +1 -1
- package/views/3d/layers/VectorTileLayerView3D.js +1 -1
- package/views/3d/layers/WMTSLayerView3D.js +1 -1
- package/views/3d/layers/graphics/ElevationAligners.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DElevationAlignment.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFeatureStore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFrustumVisibility.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/QueryEngine.js +1 -1
- package/views/3d/layers/graphics/SpatialIndex2D.js +1 -1
- package/views/3d/layers/graphics/elevationAlignmentUtils.js +1 -1
- package/views/3d/layers/graphics/featureExpressionInfoUtils.js +1 -1
- package/views/3d/layers/graphics/graphicUtils.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/graphics/queryForSymbologySnapping.js +1 -1
- package/views/3d/layers/graphics/symbolComplexity.js +1 -1
- package/views/3d/layers/graphics/wosrLoader.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SOverrides.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/attributeEditing.js +1 -1
- package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3DDebugger.js +1 -1
- package/views/3d/layers/support/FeatureTileTree3DDebugger.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/layers/support/featureTileQuery3D.js +1 -1
- package/views/3d/layers/support/projectExtentUtils.js +1 -1
- package/views/3d/support/PBFDecoderWorker.js +1 -1
- package/views/3d/support/SharedSymbolResources.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/support/geometry3dUtils.js +1 -1
- package/widgets/BasemapGallery/support/basemapCompatibilityUtils.js +1 -1
- package/widgets/Daylight.js +1 -1
- package/widgets/Directions/components/SaveLayer.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTemplates/ItemList.js +1 -1
- package/widgets/Popup.js +1 -1
- package/widgets/ShadowCast/components/Label.js +1 -1
- package/widgets/Slice/SlicePlane.js +1 -1
- package/widgets/Slice.js +1 -1
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/widgets/Weather.js +1 -1
- package/widgets/support/SnappingControls.js +1 -1
- package/assets/esri/core/workers/chunks/7ce1b3056f392cd10031.js +0 -1
- package/assets/esri/core/workers/chunks/fc197a387187daab1df3.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import"../../../../renderers/ClassBreaksRenderer.js";import"../../../../renderers/DictionaryRenderer.js";import"../../../../renderers/DotDensityRenderer.js";import"../../../../renderers/HeatmapRenderer.js";import"../../../../renderers/PieChartRenderer.js";import"../../../../renderers/Renderer.js";import"../../../../renderers/SimpleRenderer.js";import i from"../../../../renderers/UniqueValueRenderer.js";import"../../../../renderers/support/jsonUtils.js";import"../../../../symbols.js";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import r from"../../../../core/Error.js";import s from"../../../../core/Handles.js";import{makeHandle as a}from"../../../../core/handleUtils.js";import n from"../../../../core/Logger.js";import{someMap as o,findInMap as l}from"../../../../core/MapUtils.js";import{isSome as h,unwrapOr as d,isNone as p,destroyMaybe as c,removeMaybe as y,get as m,unwrap as g}from"../../../../core/maybe.js";import u from"../../../../core/PooledArray.js";import{throwIfAborted as b,eachAlways as _,createDeferred as f,isAbortError as v}from"../../../../core/promiseUtils.js";import{watch as S,when as C,on as w,syncAndInitial as G,whenOnce as x}from"../../../../core/reactiveUtils.js";import{schedule as R}from"../../../../core/scheduling.js";import{property as P}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as D}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as I,isEmpty as E}from"../../../../core/accessorSupport/diffUtils.js";import{s as U,a as A,g as O}from"../../../../chunks/vec3.js";import{c as L}from"../../../../chunks/vec3f64.js";import{projectVectorToVector as j,projectXYZToVector as V,canProjectWithoutEngine as F,projectBuffer as T}from"../../../../geometry/projection.js";import{create as k,center as z,fromRect as W,equals as M}from"../../../../geometry/support/aaBoundingBox.js";import{create as N}from"../../../../geometry/support/aaBoundingRect.js";import{equals as B}from"../../../../geometry/support/spatialReferenceUtils.js";import H from"../../../../layers/Layer.js";import{getObjectId as q,computeAABB as Y,hasGeometry as $}from"../../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as Z}from"../../../../layers/graphics/hydratedFeatures.js";import{isSupportedRenderer3D as J,validateTo3D as Q}from"../../../../renderers/support/rendererConversion.js";import{loadArcade as K}from"../../../../support/arcadeOnDemand.js";import{getDefaultSymbol3D as X}from"../../../../symbols/support/defaults3D.js";import{to3D as ee}from"../../../../symbols/support/symbolConversion.js";import{ViewElevationProvider as ie}from"./ElevationQuery.js";import{VisibilityFlag as te,VisibilityGroup as re}from"./enums.js";import{extractExpressionInfo as se,createContext as ae}from"./featureExpressionInfoUtils.js";import{Graphics3DFeatureStore as ne}from"./Graphics3DFeatureStore.js";import oe from"./Graphics3DGraphicCreationContext.js";import{Graphics3DSymbolCreationContext as le}from"./Graphics3DSymbolCreationContext.js";import{make as he}from"./Graphics3DSymbolFactory.js";import de from"./Graphics3DWebStyleSymbol.js";import{GraphicStateTracking as pe}from"./GraphicStateTracking.js";import{computeCentroid as ce}from"./graphicUtils.js";import{ApplyRendererDiffResult as ye}from"./interfaces.js";import{LoadStatus as me}from"./Loadable.js";import{SpatialIndex2D as ge}from"./SpatialIndex2D.js";import{averageSymbolComplexities as ue,defaultSymbolComplexity as be}from"./symbolComplexity.js";import{StageLayerElevationProvider as _e}from"../support/StageLayerElevationProvider.js";import{toBoundingRect as fe}from"../../support/extentUtils.js";import{PropertiesPool as ve}from"../../support/PropertiesPool.js";import{UpdatePolicy as Se}from"../../webgl-engine/lib/basicInterfaces.js";import{GridLocalOriginFactory as Ce}from"../../webgl-engine/lib/GridLocalOriginFactory.js";import{WebGLLayer as we}from"../../webgl-engine/lib/WebGLLayer.js";import{ImmediateTask as Ge,noBudget as xe,TaskPriority as Re,Task as Pe}from"../../../support/Scheduler.js";import De from"../../../../geometry/Extent.js";import Ie from"../../../../geometry/Point.js";import Ee from"../../../../symbols/LabelSymbol3D.js";import Ue from"../../../../symbols/TextSymbol.js";import Ae from"../../../../symbols/WebStyleSymbol.js";var Oe;const Le=L(),je=k(),Ve="esri.views.3d.layers.graphics.Graphics3DCore",Fe=n.getLogger(Ve);let Te=Oe=class extends t{get _viewSpatialReference(){return this.owner.view.spatialReference}get spatialIndex(){return this._spatialIndex||(this._spatialIndex=new ge({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 numberOfGraphics(){return this._numberOfGraphics}get effectiveUpdatePolicy(){return h(this.currentRenderer)&&"dictionary"===this.currentRenderer.type?Se.ASYNC:d(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._graphicsWaitingForSymbol.size>0||this.running||this._elevationAlignment?.updating||h(this._scaleVisibility)&&this._scaleVisibility.updating||h(this._filterVisibility)&&this._filterVisibility.updating||this._rendererChangeAbortController||this._elevationInfoChangeAbortController||this._updatingPendingLoadedGraphicsChange||this._frameTask.updating||this._loadingSymbols>0)}get running(){return this._pendingUpdates.size>0||!!this._spatialIndex?.updating}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,i=e?e.graphics3D.minTotalNumberOfFeatures:0,t=e?e.graphics3D.maxTotalNumberOfFeatures:0,r=e?e.graphics3D.maxTotalNumberOfPrimitives:0,s=this.averageSymbolComplexity,a=Math.max(1,h(s)?s.primitivesPerFeature:1),n=h(s)&&s.drawCallsPerFeature>0?t/s.drawCallsPerFeature*.3:t,o=Math.ceil(r/a),l=Math.max(i,Math.min(t,o,n)),d=this._get("displayFeatureLimit");return d&&d.minimumTotalNumberOfFeatures===i&&d.maximumTotalNumberOfFeatures===t&&d.maximumTotalNumberOfPrimitives===r&&d.averageSymbolComplexity===s&&d.maximumNumberOfFeatures===l?d:{minimumTotalNumberOfFeatures:i,maximumTotalNumberOfFeatures:t,maximumTotalNumberOfPrimitives:r,averageSymbolComplexity:s,maximumNumberOfFeatures:l}}get averageSymbolComplexity(){const e=ue(this._symbolComplexities),i=this._get("averageSymbolComplexity");return 0===e.numComplexities||h(i)&&(e.estimated&&(i.primitivesPerFeature>=e.primitivesPerFeature||i.primitivesPerCoordinate>=e.primitivesPerCoordinate||i.drawCallsPerFeature>=e.drawCallsPerFeature)||i.primitivesPerFeature===e.primitivesPerFeature&&i.primitivesPerCoordinate===e.primitivesPerCoordinate&&i.drawCallsPerFeature===e.drawCallsPerFeature)?i:e}get usedMemory(){const e=h(this.averageSymbolComplexity)&&this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel*this._numberOfGraphics:0,i=this._getSymbolComplexitiesUsed().reduce(((e,i)=>e+i.memory.resourceBytes),0);return this._usedMemory+e+i}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(h(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){if("web-style"===e.type)return e.clone();const i=this._symbolConversionCache.get(e.id);if(h(i))return i;const t=ee(e,{geometryType:this.layer?.geometryType,retainId:!0,hasLabelingContext:this._hasLabelingContext(e)}),r=t.symbol||null;return p(r)&&t.error&&Fe.error(t.error.message),this._symbolConversionCache.set(e.id,r),r}_getSymbolComplexitiesUsedOrRenderer(e){if(p(e))return[];const i=e.getSymbols(),t="backgroundFillSymbol"in e&&e.backgroundFillSymbol;if(!(t||i&&i.length))return[];const r=[],s=this._getSymbolComplexityUsedOrRenderer(t);h(s)&&r.push(s);for(const a of i){const e=this._getSymbolComplexityUsedOrRenderer(a);h(e)&&r.push(e)}return r}_getSymbolComplexityUsedOrRenderer(e){if(p(e))return null;const i=this._symbols.get(e.id);if(h(i))return i.complexity;const t=this._getConvertedSymbol(e);return h(t)?be(t):null}_getSymbolComplexitiesUsed(){const e=[];return this._symbols.forEach((i=>{h(i)&&e.push(i.complexity)})),e}get _objectIdField(){return this.layer.objectIdField}constructor(e){super(e),this._propertiesPool=new ve({computedExtent:De},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._handles=new s,this._frameTask=Ge,this._suspendSymbolCleanup=!1,this._arcadeOnDemand=null,this._rendererChangeAbortController=null,this._elevationInfoChangeAbortController=null,this._initializeAbortController=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._sharedSymbolResourcesOwnerHandle=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._pendingUpdatesPool=new u({allocator:e=>e||new ze,deallocator:e=>(e.clear(),e)}),this._symbolWarningLogged=!1,this._geometryWarningLogged=!1,this._objectIdInvisibleSet=new Set,this._whenSymbolRemoved=new u,this.preferredUpdatePolicy=Se.SYNC,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=void 0,this._startCreateGraphics=!1,this.symbolCreationContext=new le(e.owner.view.resourceController.scheduler,((e,i)=>this._frameTask.schedule(e,i)))}initialize(){this._featureStore=new ne({objectIdField:this.owner.layer&&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,i,t)=>this.spatialIndex.queryGraphicUIDsInExtent(e,i,t),{componentFactories:i}=this;if(h(i.elevationAlignment)){const t=i.elevationAlignment(this,e);this._elevationAlignment=t}if(h(i.scaleVisibility)){const t=i.scaleVisibility(this,e);this._scaleVisibility=t}if(h(i.filterVisibility)){const e=i.filterVisibility({featureStore:this._featureStore,getFeatureCount:()=>this.graphics3DGraphics.size,updateFeatureVisibilities:e=>this.modifyGraphics3DGraphicVisibilities((i=>i.setVisibilityFlag(te.FILTER,e(q(i.graphic,this._objectIdField)),re.GRAPHIC))),setAllFeaturesVisibility:e=>this.modifyGraphics3DGraphicVisibilities((i=>i.setVisibilityFlag(te.FILTER,e,re.GRAPHIC))),clearFeaturesVisibility:()=>this.modifyGraphics3DGraphicVisibilities((e=>e.clearVisibilityFlag(te.FILTER)))});this._filterVisibility=e}if(h(i.deconflictor)){const e=i.deconflictor(this);this._deconflictor=e}if(h(i.labeler)&&h(this._scaleVisibility)){const e=i.labeler(this,this._scaleVisibility);this._labeler=e}if(h(i.objectStates)){const e=i.objectStates(this);this._objectStates=e}this._initializeAbortController=new AbortController,this._initializePromise=this._initializeAsync()}async _initializeAsync(){const e=this._initializeAbortController.signal,i=this.owner.view;this._viewElevationProvider=new ie(this._viewSpatialReference,i),this._initializeStage(i,this.layer.uid),this.symbolCreationContext.sharedResources=i.sharedSymbolResources,this._sharedSymbolResourcesOwnerHandle=i.sharedSymbolResources.addGraphicsOwner(this.owner),h(this.currentRenderer)&&(this.symbolCreationContext.renderer=this.currentRenderer),this.symbolCreationContext.stage=this.stage,this.symbolCreationContext.streamDataRequester=i.sharedSymbolResources.streamDataRequester,this.symbolCreationContext.renderCoordsHelper=i.renderCoordsHelper,this.symbolCreationContext.layer=this.layer,this.symbolCreationContext.graphicsCoreOwner=this.owner,this.symbolCreationContext.localOriginFactory=new Ce(i.renderSpatialReference),this.symbolCreationContext.elevationProvider=i.elevationProvider,this.symbolCreationContext.notifyGraphicGeometryChanged=e=>this.notifyGraphicGeometryChanged(e),this.symbolCreationContext.notifyGraphicVisibilityChanged=e=>this.notifyGraphicVisibilityChanged(e);const t=se(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);if(this.symbolCreationContext.featureExpressionInfoContext=await ae(t,this._viewSpatialReference,e,Fe),b(e),this.symbolCreationContext.screenSizePerspectiveEnabled=i.screenSizePerspectiveEnabled&&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=i.basemapTerrain.overlayManager.registerGeometryDrapeSource(e),this._handles.add(a((()=>i.basemapTerrain.overlayManager.unregisterDrapeSource(e))))}this._handles.add([S((()=>this.suspendedOrOutsideOfView),(()=>this._frameTask.reschedule((()=>this._updateLayerVisibility())))),S((()=>[this.layer?.screenSizePerspectiveEnabled,this.owner.view.screenSizePerspectiveEnabled]),(()=>{const e=i.screenSizePerspectiveEnabled&&this.layer.screenSizePerspectiveEnabled;e!==this.symbolCreationContext.screenSizePerspectiveEnabled&&(this.symbolCreationContext.screenSizePerspectiveEnabled=e,this._labeler?.reset(),this.recreateAllGraphicsAndSymbols())})),S((()=>this.owner.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(!!e))),S((()=>this.owner.view.state?.pixelRatio),(()=>this._pixelRatioChange())),S((()=>!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled),(e=>this._physicalBasedRenderingChange(e))),S((()=>!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods),(e=>this._skipHighSymbolLoDsChange(e))),C((()=>i.basemapTerrain?.tilingScheme),(e=>{if(!e.spatialReference.equals(this.symbolCreationContext.overlaySR)&&h(i.basemapTerrain.spatialReference)&&(this.symbolCreationContext.overlaySR=i.basemapTerrain.spatialReference),this._handles.has("loaded-graphics"))this.recreateAllGraphics();else{const e=()=>this.owner?.loadedGraphics;this._handles.add([w(e,"change",(e=>{this._graphicsCollectionChanged(e),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}),{onListenerAdd:()=>{this.recreateAllGraphics(),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}})],"loaded-graphics")}}),{initial:!0}),S((()=>this.effectiveUpdatePolicy),(e=>{h(this.stageLayer)&&(this.stageLayer.updatePolicy=e),this.symbolCreationContext.isAsync=this.effectiveUpdatePolicy===Se.ASYNC,e===Se.SYNC&&this.runTask(xe)}),G)]),this._frameTask=i.resourceController.scheduler.registerTask(Re.GRAPHICS_CORE,this),this.layer&&"featureReduction"in this.layer&&this._handles.add(S((()=>this.layer.featureReduction),(()=>this._deconflictor.featureReductionChange()))),this.notifyChange("averageSymbolComplexity"),this.rendererChange(this.owner.renderer).catch((()=>{})),this._initializeAbortController=null}_abortInitialize(){this._initializeAbortController&&(this._initializeAbortController.abort(),this._initializeAbortController=null)}destroy(){this._abortInitialize(),this._abortRendererChange(),this._abortElevationInfoChange(),this._frameTask.remove(),this._frameTask=Ge,this.owner.view.deconflictor.removeGraphicsOwner(this),this.owner.view.labeler.removeGraphicsOwner(this),this._elevationAlignment=c(this._elevationAlignment),this._scaleVisibility=c(this._scaleVisibility),this._filterVisibility=c(this._filterVisibility),this._deconflictor=null,this._labeler=null,this._objectStates=c(this._objectStates),this.clear(),this._featureStore=c(this._featureStore),this._updatingPendingLoadedGraphicsChange=y(this._updatingPendingLoadedGraphicsChange),this._graphicStateTracking=c(this._graphicStateTracking),this.stage&&(this.stage.remove(this.stageLayer),this.stageLayer=null,this.stage=null),this._handles=c(this._handles),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._sharedSymbolResourcesOwnerHandle=y(this._sharedSymbolResourcesOwnerHandle),this._propertiesPool=c(this._propertiesPool),this._pendingUpdatesPool=null,this._symbolConversionCache.clear(),this._objectIdInvisibleSet.clear(),this._spatialIndex=c(this._spatialIndex)}clear(){this._objectStates?.allGraphicsDeleted(),h(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(c),this._symbols.clear(),this._graphicsBySymbol.clear(),this._graphicsWithoutSymbol.clear(),this._graphicsWaitingForSymbol.clear(),this._pendingUpdates.clear(),this._pendingUpdatesPool.clear(),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this.notifyChange("updating"),this.notifyChange("running"),this.notifyChange("updatingRemaining"),this._featureStore.events.emit("changed")}_initializeStage(e,i){this.stage=e._stage,this.stageLayer=new we({pickable:!this.suspendedOrOutsideOfView,updatePolicy:this.effectiveUpdatePolicy},i),this.stage.add(this.stageLayer);const t=this.stageLayer.events;t.on("objectTransformation",(e=>this.notifyGraphicGeometryChanged(e.metadata.graphicUid))),t.on("visibilityChanged",(e=>this.notifyGraphicVisibilityChanged(e.metadata.graphicUid))),t.on("objectGeometryAdded",(e=>this.notifyGraphicGeometryChanged(e.object.metadata.graphicUid))),t.on("objectGeometryRemoved",(e=>this.notifyGraphicGeometryChanged(e.object.metadata.graphicUid))),t.on("objectGeometryUpdated",(e=>this.notifyGraphicGeometryChanged(e.object.metadata.graphicUid)))}notifyGraphicGeometryChanged(e){if(p(this._graphicStateTracking)||p(e))return;const i=this.graphics3DGraphics.get(e);i&&this._graphicStateTracking.updateGraphicGeometry(i)}notifyGraphicVisibilityChanged(e){if(p(this._graphicStateTracking)||p(e))return;const i=this.graphics3DGraphics.get(e);i&&this._graphicStateTracking.updateGraphicVisibility(i)}_updateLayerVisibility(){const e=this.displayFeatureLimit.maximumNumberOfFeatures,i=this._numberOfGraphics>e*We,t=!this.suspendedOrOutsideOfView&&!i;t!==this._visible&&(this._visible=t,t?(this.stageLayer.pickable=!0,this.updateAllGraphicsVisibility()):(this.stageLayer.pickable=!1,this._hideAllGraphics()),this._updateStageLayerVisibility())}_updateStageLayerVisibility(){this.stageLayer.visible=this._visible&&(null==this.layer.opacity||this.layer.opacity>0)}getGraphics3DGraphicById(e){return this.graphics3DGraphics.get(e)}getGraphics3DGraphicByObjectId(e){return this.owner.layer?.objectIdField?this._findGraphics3DGraphicByObjectId(e):null}_getGraphicObjectID(e,i=this.owner.layer&&this.owner.layer.objectIdField){return q(e,i)}get graphics3DGraphicsByObjectID(){const e=this.owner.layer&&this.owner.layer.objectIdField;if(!e)return null;const i=new Map;return this.graphics3DGraphics.forEach((t=>{if(!t)return;const r=t.graphic,s=this._getGraphicObjectID(r,e);h(s)&&i.set(s,t)})),i}get labelsEnabled(){return!(!this._labeler||!this._labeler.layerLabelsEnabled())}async updateLabelingInfo(e){const i=this._deconflictor&&this._deconflictor.labelingInfoChange(e),t=this._labeler&&this._labeler.labelingInfoChange(e);await _([i,t])}updateVisibilityInfo(){this._deconflictor&&this._deconflictor.labelingInfoChange(),this._labeler&&this._labeler.visibilityInfoChange()}get symbolUpdateType(){if(this._pendingUpdates.size>0)return"unknown";let e=0,i=0;return o(this._symbols,((t,r)=>{if(h(t)){const s=t.getFastUpdateStatus();if(s.loading>0)return!0;this._graphicsBySymbol.has(r)&&(i+=s.fast,e+=s.slow)}return!1}))?"unknown":i>=0&&0===e?"fast":e>=0&&0===i?"slow":"mixed"}runTask(e){if(this._frameTask.processQueue(e),this._applyPendingUpdates(e),this.notifyChange("running"),this.running||this.notifyChange("updating"),this.notifyChange("updatingRemaining"),!e.hasProgressed)return Pe.YIELD}setObjectIdVisibility(e,i){i?this._objectIdInvisibleSet.delete(e):this._objectIdInvisibleSet.add(e);const t=this._findGraphics3DGraphicByObjectId(e);h(t)&&this._updateUserVisibility(t)}_findGraphics3DGraphicByObjectId(e){return l(this.graphics3DGraphics,(i=>this._getGraphicObjectID(i.graphic)===e))}_updateUserVisibility(e){if(p(e))return!1;const i=e.graphic,t=this._getGraphicObjectID(i),r=i.visible&&!this.owner.suspended&&(p(t)||!this._objectIdInvisibleSet.has(t));return e.setVisibilityFlag(te.USER_SETTING,r,re.GRAPHIC)}_whenGraphics3DGraphic(e){const i=this.graphics3DGraphics.get(e.uid);if(i)return Promise.resolve(i);const t=this._whenGraphics3DGraphicRequests[e.uid];if(t)return t.promise;const r=f();return this._whenGraphics3DGraphicRequests[e.uid]=r,r.promise}async _boundsForGraphics3DGraphic(e,i){const t=this._viewSpatialReference,r=this.owner.view.renderSpatialReference,s=this.owner.view.basemapTerrain.spatialReference,a=(e,i,s)=>T(e,r,i,e,t,i,s),n=(e,i,r)=>T(e,s,i,e,t,i,r),o=this._viewElevationProvider?{service:this._viewElevationProvider,useViewElevation:h(i)&&i.useViewElevation,minDemResolution:h(i)&&i.minDemResolution,minDemResolutionForPoints:this.owner.view.resolution}:null,l=await e.getProjectedBoundingBox(a,n,o,m(i,"signal"));if(!l)return null;const p=l.boundingBox;if(l.requiresDrapedElevation){const e=this.symbolCreationContext.elevationProvider;if(e){z(p,Le);const i=d(e.getElevation(Le[0],Le[1],0,t,"ground"),0);p[2]=Math.min(p[2],i),p[5]=Math.max(p[5],i)}}return{boundingBox:p,screenSpaceObjects:l.screenSpaceObjects}}async whenGraphicBounds(e,i){await x((()=>this.owner?.loadedGraphics));const t=this.owner.layer&&this.owner.layer.objectIdField,s=this.owner.loadedGraphics.find((i=>i===e||t&&i.attributes&&e.attributes&&i.attributes[t]===e.attributes[t]));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,i)}computeAttachmentOrigin(e,i){const t=this.graphics3DGraphics.get(e.uid);if(!t)return null;const r=t.computeAttachmentOrigin();if(0===r.render.num&&0===r.draped.num)return null;U(Me,0,0,0);let s=0;if(r.render.num>0){if(!j(r.render.origin,this.symbolCreationContext.renderCoordsHelper.spatialReference,Ne,i))return null;A(Me,Me,Ne),s++}if(r.draped.num>0){const[e,t]=r.draped.origin,a=d(this._viewElevationProvider.getElevation(e,t,"ground"),0);if(U(Ne,e,t,a),!j(Ne,this._viewElevationProvider.spatialReference,Ne,i))return null;A(Me,Me,Ne),s++}return s>1&&O(Me,Me,1/s),new Ie({x:Me[0],y:Me[1],z:Me[2],spatialReference:i})}getSymbolLayerSize(e,i){const t=this._symbols.get(e.id);if(p(t))throw new r("internal:symbol-not-part-of-view","Symbol is not part of this view");const s=e.symbolLayers.indexOf(i);if(-1===s)throw new r("internal:missing-symbol-layer","Symbol layer is not in symbol");const a=t.getSymbolLayerSize(s);if(p(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 i=e.graphic.uid,t=this.graphics3DGraphics.get(i);if(!p(t)||!p(this._graphicsWithoutSymbol.get(i)))switch(e.property){case"visible":this._graphicUpdateVisibleHandler(t);break;case"geometry":this._graphicUpdateGeometryHandler(t,e);break;case"symbol":this._graphicUpdateSymbolHandler(t,e);break;case"attributes":break;case"transform":this._graphicUpdateTransformHandler(t,e)}}_graphicUpdateGeometryHandler(e,i){const t=i.graphic.geometry;if(p(t))return void this._recreateGraphic(i.graphic);if(p(e)){const e=i.graphic.symbol&&i.graphic.symbol.id;if(e){const i=this._symbols.get(e);if(h(i)&&i.loadStatus===me.LOADING)return}return void this._recreateGraphic(i.graphic)}const r=e.graphics3DSymbol;!p(i.newValue)&&r.updateGeometry(e,i.newValue)||this._recreateGraphic(e.graphic),this._expandComputedExtent(t)}_graphicUpdateSymbolHandler(e,i){const t=i.graphic,r=h(e)?e.graphics3DSymbol:h(i.oldValue)?this._symbols.get(i.oldValue.id):null;if(p(r)||p(i.newValue))return void this._recreateGraphic(t);const s=r.symbol,a=this._getConvertedSymbol(i.newValue);if(h(a)&&(a.type!==s.type||"web-style"===a.type)||"web-style"===s.type)return void this._recreateGraphic(t);const n=this._graphicsBySymbol.get(s.id);if(n&&1!==n.size)return void this._recreateGraphic(t);const o=I(s,a);if(p(o))return void this._updateSymbolMapping(s.id,a);const l={diff:o,graphics3DGraphicPatches:[],symbolStatePatches:[]};if(r.prepareSymbolPatch(l),!E(l.diff))return void this._recreateGraphic(t);const d=this._getRenderingInfo(t);if(p(d))return void this._recreateGraphic(t);const c=r.extentPadding;for(const h of l.symbolStatePatches)h();if(c!==r.extentPadding&&this._recomputeExtentPadding(),h(e))for(const h of l.graphics3DGraphicPatches)h(e,d);this._updateSymbolMapping(s.id,a)}_graphicUpdateVisibleHandler(e){this._updateUserVisibility(e)&&(this._labeler&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty())}_graphicUpdateTransformHandler(e,i){}recreateGraphics(e){this._suspendSymbolCleanup=!0,this.remove(e),this.add(e),this._suspendSymbolCleanup=!1,this.effectiveUpdatePolicy===Se.SYNC&&this._cleanupSymbols()}_recreateGraphic(e){this.recreateGraphics([e])}_beginGraphicUpdate(e){const i=this._graphicsUpdateId;return this._graphicsUpdateId++,this._graphicsWaitingForSymbol.set(e.uid,i),1===this._graphicsWaitingForSymbol.size&&this.notifyChange("updating"),i}_endGraphicUpdate(e){e&&(this._graphicsWaitingForSymbol.delete(e.uid),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("updating")))}_recomputeExtentPadding(){let e=0;this._symbols.forEach((i=>{h(i)&&(e=Math.max(e,i.extentPadding))})),this._set("extentPadding",e)}_expandComputedExtent(e){const i=je,t=e.spatialReference;Y(e,i);const r=this._viewSpatialReference,s=Oe.tmpVec;if(B(t,r)||V(i[0],i[1],0,t,s,r)&&(i[0]=s[0],i[1]=s[1],V(i[3],i[4],0,t,s,r),i[3]=s[0],i[4]=s[1]),!(isFinite(i[0])&&isFinite(i[3])&&isFinite(i[1])&&isFinite(i[4])))return;const a=this.computedExtent;let n=null;const o=isFinite(i[2])&&isFinite(i[5]),l=o&&(!a||null==a.zmin||i[2]<a.zmin),h=o&&(!a||null==a.zmax||i[5]>a.zmax);if(a){(i[0]<a.xmin||i[1]<a.ymin||i[3]>a.xmax||i[4]>a.ymax||l||h)&&(n=this._propertiesPool.get("computedExtent"),n.xmin=Math.min(i[0],a.xmin),n.ymin=Math.min(i[1],a.ymin),n.xmax=Math.max(i[3],a.xmax),n.ymax=Math.max(i[4],a.ymax),n.spatialReference=r)}else n=this._propertiesPool.get("computedExtent"),n.xmin=i[0],n.ymin=i[1],n.xmax=i[3],n.ymax=i[4],n.spatialReference=r;n&&(l&&(n.zmin=i[2]),h&&(n.zmax=i[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 i=se(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);this.symbolCreationContext.featureExpressionInfoContext=await ae(i,this._viewSpatialReference,e.signal,Fe),b(e.signal),this._elevationInfoChangeAbortController=null,this._labeler?.elevationInfoChange(),this.forEachGraphics3DSymbol(((e,i,t)=>{e.globalPropertyChanged("elevationInfo",i)?i.forEach((e=>{const i=e.graphic,t=e.labelLayers;for(const r of t){r.graphics3DSymbolLayer.updateGraphicElevationContext(i,r)}})):this._recreateSymbol(t)})),this.updateStageLayerElevationProvider(),this._elevationAlignment?.elevationInfoChange()}updateStageLayerElevationProvider(){this._stageLayerElevationProvider?(this.layer.elevationInfo&&"relative-to-scene"===this.layer.elevationInfo.mode||0===this._numberOfGraphicsProvidingElevation)&&(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider.dispose(),this._stageLayerElevationProvider=null):(!this.layer.elevationInfo||this.layer.elevationInfo&&"relative-to-scene"!==this.layer.elevationInfo.mode)&&this._numberOfGraphicsProvidingElevation>0&&(this._stageLayerElevationProvider=new _e({layer:this.layer,stageLayer:this.stageLayer,view:this.owner.view}),this.owner.view.elevationProvider.register("scene",this._stageLayerElevationProvider))}_clearSymbolsAndGraphics(){this.clear(),h(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.dispose(),this._stageLayerElevationProvider=null)}startCreateGraphics(){this._startCreateGraphics=!0,this.recreateAllGraphics()}recreateAllGraphics(){this._recreateAllGraphics(!1)}recreateAllGraphicsAndSymbols(){this._recreateAllGraphics(!0)}_recreateAllGraphics(e=!1){if(!this._startCreateGraphics)return;const{loadedGraphics:i,view:t}=this.owner,r=t.basemapTerrain.tilingScheme&&i&&i.length?i.toArray():null;!e&&r||this._clearSymbolsAndGraphics(),this.symbolCreationContext.screenSizePerspectiveEnabled=this.owner.view.screenSizePerspectiveEnabled&&this.layer.screenSizePerspectiveEnabled,this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this._set("computedExtent",null),r&&(e?this.add(r):this.recreateGraphics(r))}_recreateSymbol(e){const i=this._graphicsBySymbol.get(e),t=[];i&&(i.forEach(((e,i)=>{const r=e.usedMemory;this._conditionalRemove(e,i),this._spatialIndex?.remove(e),t.push(e.graphic),e.destroy(),this._removeGraphics3DGraphic(i,r),this._updateLayerVisibility(),this._featureStore.events.emit("changed")})),this._graphicsBySymbol.set(e,new Map));const r=this._symbols.get(e);c(r),this._symbols.delete(e),this.add(t)}_recreateGraphicsForSymbol(e){const i=this._graphicsBySymbol.get(e);if(i){const e=[];i.forEach((i=>e.push(i.graphic))),this.recreateGraphics(e)}}_conditionalRemove(e,i){this._graphicsDrapedUids.delete(i),this._objectStates?.removeGraphic(e),this._labeler?.removeGraphic(e),this._deconflictor?.removeGraphic(e),h(this._graphicStateTracking)&&this._graphicStateTracking.removeGraphic(e)}add(e){e&&0!==e.length&&(this.owner.view.basemapTerrain&&this.owner.view.basemapTerrain.tilingScheme?(this._updatePolicyForGraphics(e)===Se.ASYNC?this._addDelayed(e):this._addImmediate(e),this.notifyChange("updating")):Fe.error("#add()","Cannot add graphics before terrain surface has been initialized"))}_updatePolicyForGraphics(e){if(this.effectiveUpdatePolicy===Se.SYNC&&("mesh"===this.layer.geometryType||null==this.layer.geometryType))for(const i of e)if(h(i.geometry)&&"mesh"===i.geometry.type&&!i.geometry.loaded)return Se.ASYNC;return this.effectiveUpdatePolicy}_addImmediate(e){this._geometryWarningLogged=!1,this._symbolWarningLogged=!1;for(const i of e)this._addGraphic(i,this._getRenderingInfo(i,Fe),Se.SYNC);this._cleanupSymbols(),this._labeler&&(this.owner.view.labeler.setDirty(),this._cleanupSymbols()),this.owner.view.deconflictor.setDirty()}_addDelayed(e){for(const i of e){const e=i.uid;let t=this._pendingUpdates.get(e);t?t.add?t.state!==ke.NEW&&t.abortController.abort():this._pendingAdds++:(t=this._pendingUpdatesPool.pushNew(),this._pendingAdds++,this._pendingUpdates.set(e,t)),t.add=i}this.notifyChange("running"),this.notifyChange("updatingRemaining")}remove(e){this.effectiveUpdatePolicy===Se.ASYNC?this._removeDelayed(e):this._removeImmediate(e),this.notifyChange("updating")}_removeImmediate(e){for(const i of e)this._removeGraphic(i);this._cleanupSymbols(),this._labeler&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty()}_removeDelayed(e){for(const i of e){const e=i.uid,t=this._pendingUpdates.get(e);if(t)t.add&&(t.remove?t.add=null:this._pendingUpdates.delete(e),t.state===ke.LOADING&&t.abortController.abort(),this._pendingAdds--);else{const t=this._pendingUpdatesPool.pushNew();t.remove=i,this._pendingUpdates.set(e,t),this._pendingRemoves++,this._applyPendingRemovesFirst=!0}}0===this._pendingUpdates.size&&this._finishPendingUpdates(),this.notifyChange("running"),this.notifyChange("updatingRemaining")}_finishPendingUpdates(){this._pendingUpdatesPool.clear(),this._cleanupSymbols(),(this._pendingAdds||this._pendingRemoves)&&Fe.warn("pendingAdds/Removes in inconsistent state!"),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1}_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[i,t]of this._pendingUpdates){if(e.done){this._applyPendingRemovesFirst=!0;break}if(t.remove&&!t.add&&(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(t.remove),t.remove=null,this._pendingUpdates.delete(i),0===this._pendingRemoves))break}}for(const[i,t]of this._pendingUpdates){if(e.done)break;t.add&&t.state===ke.NEW&&this._processPendingUpdateNew(t);let r=this.effectiveUpdatePolicy;if(!t.remove||t.add&&t.state!==ke.READY||(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(t.remove),t.remove=null,r=Se.SYNC),t.add)switch(t.state){case ke.READY:this._addGraphic(t.add,t.renderingInfo,r),t.add=null,this._pendingAdds--,e.madeProgress();break;case ke.REJECTED:t.add=null,this._pendingAdds--;case ke.LOADING:}null==t.remove&&null==t.add&&this._pendingUpdates.delete(i)}0===this._pendingUpdates.size&&(this._finishPendingUpdates(),this.notifyChange("running"))}_processPendingUpdateNew(e){if(!e.add)return void(e.state=ke.READY);const i=e.add.geometry;h(i)&&"mesh"===i.type&&!i.loaded?this._processPendingUpdateNewMesh(e,i):this._processPendingUpdateNewRenderingInfo(e)}async _processPendingUpdateNewMesh(e,i){e.state=ke.LOADING,e.abortController=new AbortController;const t=e.abortController.signal;try{await i.load({signal:t})}catch(r){return this._processPendingUpdateNewError(e,r)}e.abortController=null,this._processPendingUpdateNewRenderingInfo(e)}_processPendingUpdateNewError(e,i){e.abortController=null,v(i)?e.state=ke.NEW:e.state=ke.REJECTED}async _processPendingUpdateNewRenderingInfo(e){if(p(this.layer.renderer)||"dictionary"!==this.layer.renderer.type)return e.renderingInfo=this._getRenderingInfo(e.add,Fe),void(e.state=ke.READY);e.state=ke.LOADING,e.abortController=new AbortController;let i=null;try{i=await this._getRenderingInfoAsync(e.add,{signal:e.abortController.signal})}catch(t){return e.abortController=null,void(v(t)?e.state=ke.NEW:e.state=ke.REJECTED)}p(i)||p(i.symbol)?(Fe&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,Fe.warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),e.renderingInfo=null):e.renderingInfo=i,e.state=ke.READY}_addGraphic(e,i,t){if(this._graphicsWithoutSymbol.set(e.uid,e),p(i)||p(i.symbol)||!$(e))return;h(this.stage.renderView.objectAndLayerIdRenderHelper)&&this.setUidToIdOnAdd&&this.stage.renderView.objectAndLayerIdRenderHelper.setUidToObjectAndLayerId(e.objectId,e.uid,this.layer.id,this.layer.uid,this.layer.popupEnabled);const r=i.symbol,s=this.getOrCreateGraphics3DSymbol(r,i.renderer);if(p(s))return;this._expandComputedExtent(e.geometry);const a=this._beginGraphicUpdate(e),n=new oe(e,i,this.layer);let o=!1;const l=e=>{e===s.symbol.id&&(o=!0)};this._whenSymbolRemoved.push(l);const d=()=>{if(--this._loadingSymbols,this.destroyed)return;this._whenSymbolRemoved.removeUnordered(l);if(this._graphicsWaitingForSymbol.get(e.uid)!==a||o||s.destroyed||this.graphicSymbolSupported&&e.symbol&&e.symbol.id!==s.symbol.id)--s.referenced,this._cleanupSymbols();else{const i=this._createGraphics3DGraphic(s,n);this._spatialIndex&&h(i)&&this._spatialIndex.add(i),--s.referenced,this._endGraphicUpdate(e)}this._featureStore.events.emit("changed"),this._labeler&&this.owner.view.labeler.setDirty()},c=i=>{--this._loadingSymbols,this.destroyed||(this._whenSymbolRemoved.removeUnordered(l),o||(v(i)?this.add([e]):s.destroyed||this._endGraphicUpdate(e)))};++this._loadingSymbols,t===Se.ASYNC?s.load((()=>this._frameTask.schedule(d)),(e=>this._frameTask.schedule((()=>c(e))))):s.load(d,c)}_removeGraphic(e){const i=e.uid,t=this.graphics3DGraphics.get(i);if(t){t.graphics3DSymbol.onRemoveGraphic(t);const e=t.usedMemory,r=t.isElevationSource;this._conditionalRemove(t,i),this._spatialIndex?.remove(t);const s=t.graphics3DSymbol.symbol.id;this._graphicsBySymbol.get(s).delete(i),this._graphicsWithoutSymbol.delete(i),this._removeGraphics3DGraphic(i,e,r),t.destroy(),this._featureStore.events.emit("changed")}else this._graphicsWithoutSymbol.delete(i),this._graphicsWaitingForSymbol.delete(i),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("updating"))}_hasLabelingContext(e){if(e instanceof Ee||e instanceof Ue){const i=this.symbolCreationContext.layer;return!!i.labelingInfo&&i.labelingInfo.some((i=>i.symbol===e))}return!1}_hasValidSymbolCreationContext(e){return!(e instanceof Ee&&!this._hasLabelingContext(e))||(Fe.error("LabelSymbol3D is only valid as part of a LabelClass. Using LabelSymbol3D as a renderer symbol is not supported."),!1)}_getRenderingInfo(e,i){const t=e.geometry;if(p(t))return i&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,i.warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!F(t.spatialReference,this._viewSpatialReference))return i&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,i.warn(`Graphic in layer ${this.layer.id} has incompatible spatial reference and will not render`)),null;if(!this.graphicSymbolSupported&&h(e.symbol))return i&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,i.warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const r=this.rendererHasGeometryOperations?Z(e,this.layer):e;let s;if(this.owner.getRenderingInfo&&(this.getRenderingInfoWithoutRenderer||h(this.currentRenderer)))s=this.owner.getRenderingInfo(r,this.currentRenderer,this._arcadeOnDemand);else{s={symbol:r.symbol||X(r.geometry)}}return p(s)||p(s.symbol)?(i&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,i.warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),null):s}_getRenderingInfoAsync(e,i){const t=e.geometry;if(p(t))return Fe&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,Fe.warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!this.graphicSymbolSupported&&h(e.symbol))return Fe&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,Fe.warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const r=this.rendererHasGeometryOperations?Z(e,this.layer):e;return this.owner.getRenderingInfoAsync(r,this.currentRenderer,this._arcadeOnDemand,i)}_createGraphics3DSymbol(e,i){if(!this._hasValidSymbolCreationContext(e))return null;const t=this._getConvertedSymbol(e);if(!t)return null;let r;if(h(i)&&"backgroundFillSymbol"in i&&i.backgroundFillSymbol){const e=ee(i.backgroundFillSymbol,{ignoreDrivers:!0});h(e.symbol)&&"web-style"!==e.symbol.type&&"cim"!==e.symbol.type&&(r=e.symbol.symbolLayers)}const s=he(t,this.symbolCreationContext,r);return s.load((()=>{const e=s.extentPadding;e>this.extentPadding&&this._set("extentPadding",e),this.notifyChange("averageSymbolComplexity")}),(()=>{})),s}getOrCreateGraphics3DSymbol(e,i){let t=this._symbols.get(e.id);return void 0===t&&(t=e instanceof Ae?new de(e,(e=>this._frameTask.schedule(e)),(e=>this._createGraphics3DSymbol(e,i))):this._createGraphics3DSymbol(e,i),this._symbols.set(e.id,t)),h(t)&&++t.referenced,t}trackGraphicState(e){return p(this._graphicStateTracking)&&(this._graphicStateTracking=new pe(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,i,t=!1){this._usedMemory-=i,this.graphics3DGraphics.delete(e),this._numberOfGraphics--,t&&(this._numberOfGraphicsProvidingElevation--,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_createGraphics3DGraphic(e,i){const t=i.graphic;if(this._graphicsWithoutSymbol.delete(t.uid),!this._symbols.has(e.symbol.id))return this.add([t]),null;if(this.graphics3DGraphics.has(t.uid))return null;const r=e.createGraphics3DGraphic(i);if(p(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(t.uid,r);if(r.isDraped&&this._graphicsDrapedUids.add(t.uid),r.centroid=null,h(t.geometry)&&"point"!==t.geometry.type&&(r.centroid=ce(t.geometry,this._viewSpatialReference)),this._updateUserVisibility(r),h(this._scaleVisibility)&&this._scaleVisibility.updateVisibility(r),h(this._filterVisibility)){const{defaultVisibility:e}=this._filterVisibility;r.setVisibilityFlag(te.FILTER,e,re.GRAPHIC),e||this._filterVisibility.reapply()}this._deconflictor?.addGraphic(r),this._labeler?.addGraphic(r),this._objectStates?.addGraphic(r),this._deconflictor&&this.owner.view.deconflictor.setInitialIconVisibilityFlag(this,r),r.initialize(this.stage,this.stageLayer,this.owner),h(this._graphicStateTracking)&&this._graphicStateTracking.addGraphic(r);const a=this._whenGraphics3DGraphicRequests[t.uid];return a&&(delete this._whenGraphics3DGraphicRequests[t.uid],a.resolve(r)),r}_abortRendererChange(){this._rendererChangeAbortController&&(this._rendererChangeAbortController.abort(),this._rendererChangeAbortController=null)}async rendererChange(e){if(this._abortRendererChange(),e!==this.currentRenderer)if(this._validateRenderer(e),p(e)&&this._currentRendererChange(null,!1),J(e))if(h(e)&&e.arcadeRequired){const i=new AbortController;this._rendererChangeAbortController=i;const{arcadeUtils:t}=await this._ensureArcade();b(i);const r=t.hasGeometryOperations(e);r&&(await t.enableGeometryOperations(),b(i)),this.effectiveUpdatePolicy===Se.ASYNC?await this._frameTask.schedule((()=>this._currentRendererChange(e,r)),i.signal):this._currentRendererChange(e,r),this._rendererChangeAbortController=null}else if(this.effectiveUpdatePolicy===Se.ASYNC){const i=new AbortController;this._rendererChangeAbortController=i,await this._frameTask.schedule((()=>this._currentRendererChange(e,!1)),i.signal),this._rendererChangeAbortController=null}else this._currentRendererChange(e,!1);else this._currentRendererChange(e,!1)}async _ensureArcade(){return p(this._arcadeOnDemand)?(this._arcadeOnDemand=await K(),this._arcadeOnDemand):this._arcadeOnDemand}_currentRendererChange(e,i){this.currentRenderer=e,this.rendererHasGeometryOperations=i,this.symbolCreationContext.arcade=g(this._arcadeOnDemand);const t=this.symbolCreationContext.renderer;if(e===t)return;if(this._symbolConversionCache.clear(),p(e))return this.symbolCreationContext.renderer=null,void this.recreateAllGraphicsAndSymbols();const r=I(t,e);this._updateUnchangedSymbolMappings(r,e,t),this.symbolCreationContext.renderer=e,p(r)||("complete"===r.type?this.recreateAllGraphicsAndSymbols():"partial"===r.type&&(this._applyRendererDiff(r,e,t)?this._volatileGraphicsUpdated():this.recreateAllGraphicsAndSymbols()),this.notifyChange("averageSymbolComplexity"))}_diffHasSymbolChange(e){for(const i in e.diff)switch(i){case"visualVariables":case"defaultSymbol":case"uniqueValueInfos":break;case"uniqueValueGroups":case"authoringInfo":case"fieldDelimiter":delete e.diff[i];break;default:return!0}return!1}_applySymbolSetDiff(e,i,t){e=e||[],i=i||[];const r=[];for(const s of i){const i=this._graphicsBySymbol.get(s.id);i&&i.forEach(((a,n)=>{const o=a.graphic,l=this.layer instanceof H?this.layer:null,h=g(this._arcadeOnDemand);if(s===t.defaultSymbol&&t.getSymbol(Z(o,l),{arcade:h})===t.defaultSymbol)return;const d=a.usedMemory;e.length||t.defaultSymbol?r.push(o):this._graphicsWithoutSymbol.set(n,o);const p=this.graphics3DGraphics.get(n);this._conditionalRemove(p,n),a.destroy(),i.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&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty()}_applyUniqueValueRendererDiff(e,i,t){const r=e.diff.defaultSymbol,s=e.diff.uniqueValueInfos;if(r||s){const a=s?s.added.map((e=>e.symbol)):[],n=s?s.removed.map((e=>e.symbol)):[];if(s)for(let e=0;e<s.changed.length;e++)a.push(s.changed[e].newValue.symbol),n.push(s.changed[e].oldValue.symbol);return r?(t.defaultSymbol&&n.push(t.defaultSymbol),i.defaultSymbol&&a.push(i.defaultSymbol)):t.defaultSymbol&&a.length&&n.push(i.defaultSymbol),this._applySymbolSetDiff(a,n,i),delete e.diff.defaultSymbol,delete e.diff.uniqueValueInfos,!0}return!1}_calculateUnchangedSymbolMapping(e,i,t){if("unique-value"!==i?.type||"unique-value"!==t?.type||h(e)&&"partial"!==e.type)return[];const r=e=>h(e)?e.id:null,s=e&&e.diff,a=s&&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 t.uniqueValueInfos){const t=r(e.symbol),s=i.uniqueValueInfos.find((i=>i.value===e.value));s&&t!==r(s.symbol)&&o.push({oldId:t,newId:r(s.symbol)})}}return!a&&t.defaultSymbol&&o.push({oldId:r(t.defaultSymbol),newId:r(i.defaultSymbol)}),o}_updateSymbolMapping(e,i){const t=h(i)&&i?"string"==typeof i?i:i.id:null;if(!e||e===t)return;const r=this._graphicsBySymbol.get(e);this._graphicsBySymbol.delete(e),void 0!==r&&this._graphicsBySymbol.set(t,r);const s=this._symbols.get(e);if(void 0!==s&&(this._symbols.delete(e),this._symbols.set(t,s),h(s))){const e="string"==typeof i?null:i;h(e)?s.symbol=e:s.symbol.id=t}}_updateUnchangedSymbolMappings(e,i,t){const r=this._calculateUnchangedSymbolMapping(e,i,t);for(const{oldId:s,newId:a}of r)this._updateSymbolMapping(s,a)}_applyRendererDiff(e,t,r){if(this._diffHasSymbolChange(e))return!1;if(t instanceof i&&r instanceof i&&this._applyUniqueValueRendererDiff(e,t,r)&&0===Object.keys(e.diff).length)return!0;for(const[i]of this._graphicsBySymbol){const r=this._symbols.get(i);if(h(r))switch(r.applyRendererDiff(e,t)){case ye.Recreate_Symbol:this._recreateSymbol(i);break;case ye.Recreate_Graphics:this._recreateGraphicsForSymbol(i);case ye.Fast_Update:}}return!0}opacityChange(){this.forEachGraphics3DSymbol(((e,i)=>e.globalPropertyChanged("opacity",i))),this._updateStageLayerVisibility()}_slicePlaneEnabledChange(e){e!==this.symbolCreationContext.slicePlaneEnabled&&(this.symbolCreationContext.slicePlaneEnabled=e,this.stageLayer.sliceable=e,this.forEachGraphics3DSymbol(((e,i)=>e.globalPropertyChanged("slicePlaneEnabled",i))),this._deconflictor&&this._deconflictor.slicePlaneEnabledChange(),this._labeler&&this._labeler.slicePlaneEnabledChange())}_physicalBasedRenderingChange(e){this.symbolCreationContext.physicalBasedRenderingEnabled=e,this.forEachGraphics3DSymbol(((e,i,t)=>{e.globalPropertyChanged("physicalBasedRenderingEnabled",i)||this._recreateSymbol(t)}))}_skipHighSymbolLoDsChange(e){this.symbolCreationContext.skipHighSymbolLods=e,this.forEachGraphics3DSymbol(((e,i,t)=>this._recreateSymbol(t)))}_pixelRatioChange(){this.forEachGraphics3DSymbol(((e,i,t)=>{e.globalPropertyChanged("pixelRatio",i)||this._recreateSymbol(t)}))}_signalUpdatingDuringAsyncLoadedGraphicsChange(){this._updatingPendingLoadedGraphicsChange&&this._updatingPendingLoadedGraphicsChange.remove(),this._updatingPendingLoadedGraphicsChange=R((()=>{this._updatingPendingLoadedGraphicsChange=null}))}setClippingExtent(e,i){const t=this.symbolCreationContext.clippingExtent,r=N();return fe(e,r,i)?this.symbolCreationContext.clippingExtent=W(k(),r):this.symbolCreationContext.clippingExtent=null,!M(this.symbolCreationContext.clippingExtent,t)}modifyGraphics3DGraphicVisibilities(e){let i=!1;this.graphics3DGraphics.forEach((t=>{e(t)&&(i=!0)})),i&&(this.owner.view.labeler?.setDirty(),this.owner.view.deconflictor.setDirty())}forEachGraphics3DSymbol(e){for(const[i,t]of this._symbols){if(p(t))return;e(t,this._graphicsBySymbol.get(i)||Be,i)}}updateAllGraphicsVisibility(){h(this._filterVisibility)&&this._filterVisibility.reapply(),this.modifyGraphics3DGraphicVisibilities((e=>{const i=this._updateUserVisibility(e),t=h(this._scaleVisibility)&&this._scaleVisibility.updateVisibility(e);return i||t}))}_hideAllGraphics(){this.modifyGraphics3DGraphicVisibilities((e=>e.setVisibilityFlag(te.USER_SETTING,!1,re.GRAPHIC)))}_validateRenderer(e){const i=Q(e,{geometryType:this.layer?.geometryType});if(i){const e=`Renderer for layer '${this.layer.title?`${this.layer.title}, `:""}, id:${this.layer.id}' is not supported in a SceneView`;Fe.warn(e,i.message)}}_volatileGraphicsUpdated(){this._labeler?.reset(),this.stageLayer.shaderTransformationChanged(),this.notifyChange("updating")}_cleanupSymbols(){if(this._graphicsWaitingForSymbol.size>0||this._suspendSymbolCleanup)return;let e=!1;this._symbols.forEach(((i,t)=>{if(p(i)||i.referenced>0)return;const r=this._graphicsBySymbol.get(t);r&&0!==r.size||(this._graphicsBySymbol.delete(t),this._symbols.delete(t),c(i),e=!0)})),e&&(this._recomputeExtentPadding(),this.notifyChange("averageSymbolComplexity"))}get test(){return{snapshotInternals:()=>({graphics:[...this.graphics3DGraphics.keys()].sort(),symbols:[...this._symbols.keys()].sort(),graphicsBySymbol:[...this._graphicsBySymbol.keys()].sort().map((e=>({symbolId:e,graphics:[...this._graphicsBySymbol.get(e).keys()].sort()}))),graphicsWithoutSymbol:[...this._graphicsWithoutSymbol.keys()].sort(),graphicsDrapedUids:[...this._graphicsDrapedUids].sort(),pendingUpdates:this._pendingUpdates}),symbols:this._symbols,filterVisibility:this._filterVisibility,numPending:this._pendingUpdates.size,forceUpdatePolicy:e=>{this._forcedUpdatePolicy=e}}}get performanceInfo(){return{visible:this.graphics3DGraphics.size,missing:this._graphicsWithoutSymbol.size,pending:this._pendingUpdates.size}}};var ke;Te.tmpVec=L(),e([P({readOnly:!0})],Te.prototype,"computedExtent",void 0),e([P()],Te.prototype,"currentRenderer",void 0),e([P()],Te.prototype,"rendererHasGeometryOperations",void 0),e([P()],Te.prototype,"_frameTask",void 0),e([P({readOnly:!0})],Te.prototype,"_viewSpatialReference",null),e([P()],Te.prototype,"_rendererChangeAbortController",void 0),e([P()],Te.prototype,"_elevationInfoChangeAbortController",void 0),e([P()],Te.prototype,"_initializeAbortController",void 0),e([P()],Te.prototype,"_elevationAlignment",void 0),e([P()],Te.prototype,"_scaleVisibility",void 0),e([P()],Te.prototype,"_filterVisibility",void 0),e([P()],Te.prototype,"_initializePromise",void 0),e([P()],Te.prototype,"_spatialIndex",void 0),e([P({readOnly:!0})],Te.prototype,"extentPadding",void 0),e([P()],Te.prototype,"_updatingPendingLoadedGraphicsChange",void 0),e([P()],Te.prototype,"_featureStore",void 0),e([P()],Te.prototype,"_deconflictor",void 0),e([P()],Te.prototype,"_labeler",void 0),e([P()],Te.prototype,"_objectStates",void 0),e([P()],Te.prototype,"_loadingSymbols",void 0),e([P()],Te.prototype,"preferredUpdatePolicy",void 0),e([P()],Te.prototype,"_forcedUpdatePolicy",void 0),e([P({readOnly:!0})],Te.prototype,"effectiveUpdatePolicy",null),e([P({constructOnly:!0})],Te.prototype,"elevationFeatureExpressionEnabled",void 0),e([P({constructOnly:!0})],Te.prototype,"owner",void 0),e([P({constructOnly:!0})],Te.prototype,"layer",void 0),e([P({constructOnly:!0})],Te.prototype,"graphicSymbolSupported",void 0),e([P({constructOnly:!0})],Te.prototype,"getRenderingInfoWithoutRenderer",void 0),e([P({constructOnly:!0})],Te.prototype,"componentFactories",void 0),e([P({constructOnly:!0})],Te.prototype,"setUidToIdOnAdd",void 0),e([P()],Te.prototype,"featureStore",null),e([P()],Te.prototype,"initializePromise",null),e([P()],Te.prototype,"scaleVisibility",null),e([P()],Te.prototype,"elevationAlignment",null),e([P()],Te.prototype,"objectStates",null),e([P()],Te.prototype,"filterVisibility",null),e([P({readOnly:!0})],Te.prototype,"updating",null),e([P({readOnly:!0})],Te.prototype,"running",null),e([P({readOnly:!0})],Te.prototype,"suspendedOrOutsideOfView",null),e([P({readOnly:!0,dependsOn:[]})],Te.prototype,"updatingRemaining",null),e([P({readOnly:!0,dependsOn:["owner.view.qualitySettings.graphics3D.maxTotalNumberOfPrimitives","owner.view.qualitySettings.graphics3D.maxTotalNumberOfFeatures","averageSymbolComplexity"]})],Te.prototype,"displayFeatureLimit",null),e([P({readOnly:!0,dependsOn:[]})],Te.prototype,"averageSymbolComplexity",null),e([P({constructOnly:!0})],Te.prototype,"hasZ",void 0),e([P({constructOnly:!0})],Te.prototype,"hasM",void 0),e([P()],Te.prototype,"_objectIdField",null),Te=Oe=e([D(Ve)],Te),function(e){e[e.NEW=0]="NEW",e[e.LOADING=1]="LOADING",e[e.READY=2]="READY",e[e.REJECTED=3]="REJECTED"}(ke||(ke={}));class ze{constructor(){this.add=null,this.renderingInfo=null,this.state=ke.NEW,this.remove=null}clear(){this.add=null,this.renderingInfo=null,this.state=ke.NEW,this.abortController=null,this.remove=null}}const We=10,Me=L(),Ne=L(),Be=new Map;export{Te as Graphics3DCore};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import"../../../../renderers/ClassBreaksRenderer.js";import"../../../../renderers/DictionaryRenderer.js";import"../../../../renderers/DotDensityRenderer.js";import"../../../../renderers/HeatmapRenderer.js";import"../../../../renderers/PieChartRenderer.js";import"../../../../renderers/Renderer.js";import"../../../../renderers/SimpleRenderer.js";import i from"../../../../renderers/UniqueValueRenderer.js";import"../../../../renderers/support/jsonUtils.js";import"../../../../symbols.js";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import r from"../../../../core/Error.js";import s from"../../../../core/Handles.js";import{makeHandle as a}from"../../../../core/handleUtils.js";import n from"../../../../core/Logger.js";import{someMap as o,findInMap as l}from"../../../../core/MapUtils.js";import{isSome as h,unwrapOr as d,isNone as p,destroyMaybe as c,removeMaybe as y,get as m,disposeMaybe as g,unwrap as u}from"../../../../core/maybe.js";import b from"../../../../core/PooledArray.js";import{throwIfAborted as _,eachAlways as f,createDeferred as v,isAbortError as C}from"../../../../core/promiseUtils.js";import{watch as S,when as w,on as G,syncAndInitial as x,whenOnce as R}from"../../../../core/reactiveUtils.js";import{schedule as P}from"../../../../core/scheduling.js";import{property as D}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as I}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as E,isEmpty as U}from"../../../../core/accessorSupport/diffUtils.js";import{s as A,a as O,g as L}from"../../../../chunks/vec3.js";import{c as j}from"../../../../chunks/vec3f64.js";import{projectVectorToVector as V,projectXYZToVector as F,canProjectWithoutEngine as T,projectBuffer as k}from"../../../../geometry/projection.js";import{create as z,center as W,fromRect as M,equals as N}from"../../../../geometry/support/aaBoundingBox.js";import{create as B}from"../../../../geometry/support/aaBoundingRect.js";import{equals as H}from"../../../../geometry/support/spatialReferenceUtils.js";import q from"../../../../layers/Layer.js";import{getObjectId as Y,computeAABB as $,hasGeometry as Z}from"../../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as J}from"../../../../layers/graphics/hydratedFeatures.js";import{isSupportedRenderer3D as Q,validateTo3D as K}from"../../../../renderers/support/rendererConversion.js";import{loadArcade as X}from"../../../../support/arcadeOnDemand.js";import{getDefaultSymbol3D as ee}from"../../../../symbols/support/defaults3D.js";import{to3D as ie}from"../../../../symbols/support/symbolConversion.js";import{ViewElevationProvider as te}from"./ElevationQuery.js";import{VisibilityFlag as re,VisibilityGroup as se}from"./enums.js";import{extractExpressionInfo as ae,createContext as ne}from"./featureExpressionInfoUtils.js";import{Graphics3DFeatureStore as oe}from"./Graphics3DFeatureStore.js";import le from"./Graphics3DGraphicCreationContext.js";import{Graphics3DSymbolCreationContext as he}from"./Graphics3DSymbolCreationContext.js";import{make as de}from"./Graphics3DSymbolFactory.js";import pe from"./Graphics3DWebStyleSymbol.js";import{GraphicStateTracking as ce}from"./GraphicStateTracking.js";import{computeCentroid as ye}from"./graphicUtils.js";import{ApplyRendererDiffResult as me}from"./interfaces.js";import{LoadStatus as ge}from"./Loadable.js";import{SpatialIndex2D as ue}from"./SpatialIndex2D.js";import{averageSymbolComplexities as be,defaultSymbolComplexity as _e}from"./symbolComplexity.js";import{StageLayerElevationProvider as fe}from"../support/StageLayerElevationProvider.js";import{toBoundingRect as ve}from"../../support/extentUtils.js";import{PropertiesPool as Ce}from"../../support/PropertiesPool.js";import{UpdatePolicy as Se}from"../../webgl-engine/lib/basicInterfaces.js";import{GridLocalOriginFactory as we}from"../../webgl-engine/lib/GridLocalOriginFactory.js";import{WebGLLayer as Ge}from"../../webgl-engine/lib/WebGLLayer.js";import{ImmediateTask as xe,noBudget as Re,TaskPriority as Pe,Task as De}from"../../../support/Scheduler.js";import Ie from"../../../../geometry/Extent.js";import Ee from"../../../../geometry/Point.js";import Ue from"../../../../symbols/LabelSymbol3D.js";import Ae from"../../../../symbols/TextSymbol.js";import Oe from"../../../../symbols/WebStyleSymbol.js";var Le;const je=j(),Ve=z(),Fe="esri.views.3d.layers.graphics.Graphics3DCore",Te=n.getLogger(Fe);let ke=Le=class extends t{get _viewSpatialReference(){return this.owner.view.spatialReference}get spatialIndex(){return this._spatialIndex||(this._spatialIndex=new ue({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 numberOfGraphics(){return this._numberOfGraphics}get effectiveUpdatePolicy(){return h(this.currentRenderer)&&"dictionary"===this.currentRenderer.type?Se.ASYNC:d(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._graphicsWaitingForSymbol.size>0||this.running||this._elevationAlignment?.updating||h(this._scaleVisibility)&&this._scaleVisibility.updating||h(this._filterVisibility)&&this._filterVisibility.updating||this._rendererChangeAbortController||this._elevationInfoChangeAbortController||this._updatingPendingLoadedGraphicsChange||this._frameTask.updating||this._loadingSymbols>0)}get running(){return this._pendingUpdates.size>0||!!this._spatialIndex?.updating}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,i=e?e.graphics3D.minTotalNumberOfFeatures:0,t=e?e.graphics3D.maxTotalNumberOfFeatures:0,r=e?e.graphics3D.maxTotalNumberOfPrimitives:0,s=this.averageSymbolComplexity,a=Math.max(1,h(s)?s.primitivesPerFeature:1),n=h(s)&&s.drawCallsPerFeature>0?t/s.drawCallsPerFeature*.3:t,o=Math.ceil(r/a),l=Math.max(i,Math.min(t,o,n)),d=this._get("displayFeatureLimit");return d&&d.minimumTotalNumberOfFeatures===i&&d.maximumTotalNumberOfFeatures===t&&d.maximumTotalNumberOfPrimitives===r&&d.averageSymbolComplexity===s&&d.maximumNumberOfFeatures===l?d:{minimumTotalNumberOfFeatures:i,maximumTotalNumberOfFeatures:t,maximumTotalNumberOfPrimitives:r,averageSymbolComplexity:s,maximumNumberOfFeatures:l}}get averageSymbolComplexity(){const e=be(this._symbolComplexities),i=this._get("averageSymbolComplexity");return 0===e.numComplexities||h(i)&&(e.estimated&&(i.primitivesPerFeature>=e.primitivesPerFeature||i.primitivesPerCoordinate>=e.primitivesPerCoordinate||i.drawCallsPerFeature>=e.drawCallsPerFeature)||i.primitivesPerFeature===e.primitivesPerFeature&&i.primitivesPerCoordinate===e.primitivesPerCoordinate&&i.drawCallsPerFeature===e.drawCallsPerFeature)?i:e}get usedMemory(){const e=h(this.averageSymbolComplexity)&&this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel*this._numberOfGraphics:0,i=this._getSymbolComplexitiesUsed().reduce(((e,i)=>e+i.memory.resourceBytes),0);return this._usedMemory+e+i}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(h(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){if("web-style"===e.type)return e.clone();const i=this._symbolConversionCache.get(e.id);if(h(i))return i;const t=ie(e,{geometryType:this.layer?.geometryType??void 0,retainId:!0,hasLabelingContext:this._hasLabelingContext(e)}),r=t.symbol||null;return p(r)&&t.error&&Te.error(t.error.message),this._symbolConversionCache.set(e.id,r),r}_getSymbolComplexitiesUsedOrRenderer(e){if(p(e))return[];const i=e.getSymbols(),t="backgroundFillSymbol"in e?e.backgroundFillSymbol:null;if(!(t||i&&i.length))return[];const r=[],s=this._getSymbolComplexityUsedOrRenderer(t);h(s)&&r.push(s);for(const a of i){const e=this._getSymbolComplexityUsedOrRenderer(a);h(e)&&r.push(e)}return r}_getSymbolComplexityUsedOrRenderer(e){if(p(e))return null;const i=this._symbols.get(e.id);if(h(i))return i.complexity;const t=this._getConvertedSymbol(e);return h(t)?_e(t):null}_getSymbolComplexitiesUsed(){const e=[];return this._symbols.forEach((i=>{h(i)&&e.push(i.complexity)})),e}get _objectIdField(){return this.layer.objectIdField}constructor(e){super(e),this._propertiesPool=new Ce({computedExtent:Ie},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._handles=new s,this._frameTask=xe,this._suspendSymbolCleanup=!1,this._arcadeOnDemand=null,this._rendererChangeAbortController=null,this._elevationInfoChangeAbortController=null,this._initializeAbortController=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._sharedSymbolResourcesOwnerHandle=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._pendingUpdatesPool=new b({allocator:e=>e||new We,deallocator:e=>(e.clear(),e)}),this._symbolWarningLogged=!1,this._geometryWarningLogged=!1,this._objectIdInvisibleSet=new Set,this._whenSymbolRemoved=new b,this.preferredUpdatePolicy=Se.SYNC,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.symbolCreationContext=new he(e.owner.view.resourceController.scheduler,((e,i)=>this._frameTask.schedule(e,i)))}initialize(){this._featureStore=new oe({objectIdField:this.owner.layer&&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,i,t)=>this.spatialIndex.queryGraphicUIDsInExtent(e,i,t),{componentFactories:i}=this;if(h(i.elevationAlignment)){const t=i.elevationAlignment(this,e);this._elevationAlignment=t}if(h(i.scaleVisibility)){const t=i.scaleVisibility(this,e);this._scaleVisibility=t}if(h(i.filterVisibility)){const e=i.filterVisibility({featureStore:this._featureStore,getFeatureCount:()=>this.graphics3DGraphics.size,updateFeatureVisibilities:e=>this.modifyGraphics3DGraphicVisibilities((i=>i.setVisibilityFlag(re.FILTER,e(Y(i.graphic,this._objectIdField)),se.GRAPHIC))),setAllFeaturesVisibility:e=>this.modifyGraphics3DGraphicVisibilities((i=>i.setVisibilityFlag(re.FILTER,e,se.GRAPHIC))),clearFeaturesVisibility:()=>this.modifyGraphics3DGraphicVisibilities((e=>e.clearVisibilityFlag(re.FILTER)))});this._filterVisibility=e}if(h(i.deconflictor)){const e=i.deconflictor(this);this._deconflictor=e}if(h(i.labeler)&&h(this._scaleVisibility)){const e=i.labeler(this,this._scaleVisibility);this._labeler=e}if(h(i.objectStates)){const e=i.objectStates(this);this._objectStates=e}this._initializeAbortController=new AbortController,this._initializePromise=this._initializeAsync()}async _initializeAsync(){const e=this._initializeAbortController?.signal,i=this.owner.view;this._viewElevationProvider=new te(this._viewSpatialReference,i),this._initializeStage(i,this.layer.uid),this.symbolCreationContext.sharedResources=i.sharedSymbolResources,this._sharedSymbolResourcesOwnerHandle=i.sharedSymbolResources.addGraphicsOwner(this.owner),h(this.currentRenderer)&&(this.symbolCreationContext.renderer=this.currentRenderer),this.symbolCreationContext.stage=this.stage,this.symbolCreationContext.streamDataRequester=i.sharedSymbolResources.streamDataRequester,this.symbolCreationContext.renderCoordsHelper=i.renderCoordsHelper,this.symbolCreationContext.layer=this.layer,this.symbolCreationContext.graphicsCoreOwner=this.owner,this.symbolCreationContext.localOriginFactory=new we(i.renderSpatialReference),this.symbolCreationContext.elevationProvider=i.elevationProvider,this.symbolCreationContext.notifyGraphicGeometryChanged=e=>this.notifyGraphicGeometryChanged(e),this.symbolCreationContext.notifyGraphicVisibilityChanged=e=>this.notifyGraphicVisibilityChanged(e);const t=ae(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);if(this.symbolCreationContext.featureExpressionInfoContext=await ne(t,this._viewSpatialReference,e,Te),_(e),this.symbolCreationContext.screenSizePerspectiveEnabled=i.screenSizePerspectiveEnabled&&!!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=i.basemapTerrain.overlayManager.registerGeometryDrapeSource(e),this._handles.add(a((()=>i.basemapTerrain.overlayManager.unregisterDrapeSource(e))))}this._handles.add([S((()=>this.suspendedOrOutsideOfView),(()=>this._frameTask.reschedule((()=>this._updateLayerVisibility())))),S((()=>[this.layer?.screenSizePerspectiveEnabled,this.owner.view.screenSizePerspectiveEnabled]),(()=>{const e=i.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled;e!==this.symbolCreationContext.screenSizePerspectiveEnabled&&(this.symbolCreationContext.screenSizePerspectiveEnabled=e,this._labeler?.reset(),this.recreateAllGraphicsAndSymbols())})),S((()=>this.owner.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(!!e))),S((()=>this.owner.view.state?.pixelRatio),(()=>this._pixelRatioChange())),S((()=>!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled),(e=>this._physicalBasedRenderingChange(e))),S((()=>!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods),(e=>this._skipHighSymbolLoDsChange(e))),w((()=>i.basemapTerrain?.tilingScheme),(e=>{if(!e.spatialReference.equals(this.symbolCreationContext.overlaySR)&&h(i.basemapTerrain.spatialReference)&&(this.symbolCreationContext.overlaySR=i.basemapTerrain.spatialReference),this._handles.has("loaded-graphics"))this.recreateAllGraphics();else{const e=()=>this.owner?.loadedGraphics;this._handles.add([G(e,"change",(e=>{this._graphicsCollectionChanged(e),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}),{onListenerAdd:()=>{this.recreateAllGraphics(),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}})],"loaded-graphics")}}),{initial:!0}),S((()=>this.effectiveUpdatePolicy),(e=>{h(this.stageLayer)&&(this.stageLayer.updatePolicy=e),this.symbolCreationContext.isAsync=this.effectiveUpdatePolicy===Se.ASYNC,e===Se.SYNC&&this.runTask(Re)}),x)]),this._frameTask=i.resourceController.scheduler.registerTask(Pe.GRAPHICS_CORE,this),this.layer&&"featureReduction"in this.layer&&this._handles.add(S((()=>this.layer.featureReduction),(()=>this._deconflictor.featureReductionChange()))),this.notifyChange("averageSymbolComplexity"),this.rendererChange(this.owner.renderer).catch((()=>{})),this._initializeAbortController=null}_abortInitialize(){this._initializeAbortController&&(this._initializeAbortController.abort(),this._initializeAbortController=null)}destroy(){this._abortInitialize(),this._abortRendererChange(),this._abortElevationInfoChange(),this._frameTask.remove(),this._frameTask=xe,this.owner.view.deconflictor.removeGraphicsOwner(this),this.owner.view.labeler.removeGraphicsOwner(this),this._elevationAlignment=c(this._elevationAlignment),this._scaleVisibility=c(this._scaleVisibility),this._filterVisibility=c(this._filterVisibility),this._deconflictor=null,this._labeler=null,this._objectStates=c(this._objectStates),this.clear(),this._featureStore=c(this._featureStore),this._updatingPendingLoadedGraphicsChange=y(this._updatingPendingLoadedGraphicsChange),this._graphicStateTracking=c(this._graphicStateTracking),this.stage&&(this.stage.remove(this.stageLayer),this.stageLayer=null,this.stage=null),this._handles=c(this._handles),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._sharedSymbolResourcesOwnerHandle=y(this._sharedSymbolResourcesOwnerHandle),this._propertiesPool=c(this._propertiesPool),this._pendingUpdatesPool=null,this._symbolConversionCache.clear(),this._objectIdInvisibleSet.clear(),this._spatialIndex=c(this._spatialIndex)}clear(){this._objectStates?.allGraphicsDeleted(),h(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(c),this._symbols.clear(),this._graphicsBySymbol.clear(),this._graphicsWithoutSymbol.clear(),this._graphicsWaitingForSymbol.clear(),this._pendingUpdates.clear(),this._pendingUpdatesPool.clear(),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this.notifyChange("updating"),this.notifyChange("running"),this.notifyChange("updatingRemaining"),this._featureStore.events.emit("changed")}_initializeStage(e,i){this.stage=e._stage,this.stageLayer=new Ge({pickable:!this.suspendedOrOutsideOfView,updatePolicy:this.effectiveUpdatePolicy},i),this.stage.add(this.stageLayer);const t=this.stageLayer.events;t.on("objectTransformation",(e=>this.notifyGraphicGeometryChanged(e.metadata.graphicUid))),t.on("visibilityChanged",(e=>this.notifyGraphicVisibilityChanged(e.metadata.graphicUid))),t.on("objectGeometryAdded",(e=>this.notifyGraphicGeometryChanged(e.object.metadata.graphicUid))),t.on("objectGeometryRemoved",(e=>this.notifyGraphicGeometryChanged(e.object.metadata.graphicUid))),t.on("objectGeometryUpdated",(e=>this.notifyGraphicGeometryChanged(e.object.metadata.graphicUid)))}notifyGraphicGeometryChanged(e){if(p(this._graphicStateTracking)||p(e))return;const i=this.graphics3DGraphics.get(e);i&&this._graphicStateTracking.updateGraphicGeometry(i)}notifyGraphicVisibilityChanged(e){if(p(this._graphicStateTracking)||p(e))return;const i=this.graphics3DGraphics.get(e);i&&this._graphicStateTracking.updateGraphicVisibility(i)}_updateLayerVisibility(){const e=this.displayFeatureLimit.maximumNumberOfFeatures,i=this._numberOfGraphics>e*Me,t=!this.suspendedOrOutsideOfView&&!i;t!==this._visible&&(this._visible=t,t?(this.stageLayer.pickable=!0,this.updateAllGraphicsVisibility()):(this.stageLayer.pickable=!1,this._hideAllGraphics()),this._updateStageLayerVisibility())}_updateStageLayerVisibility(){this.stageLayer.visible=this._visible&&(null==this.layer.opacity||this.layer.opacity>0)}getGraphics3DGraphicById(e){return null!=e?this.graphics3DGraphics.get(e):void 0}getGraphics3DGraphicByObjectId(e){return this.owner.layer?.objectIdField?this._findGraphics3DGraphicByObjectId(e):null}_getGraphicObjectID(e,i=this.owner.layer&&this.owner.layer.objectIdField){return Y(e,i)}get graphics3DGraphicsByObjectID(){const e=this.owner.layer&&this.owner.layer.objectIdField;if(!e)return;const i=new Map;return this.graphics3DGraphics.forEach((t=>{if(!t)return;const r=t.graphic,s=this._getGraphicObjectID(r,e);h(s)&&i.set(s,t)})),i}get labelsEnabled(){return!(!this._labeler||!this._labeler.layerLabelsEnabled())}async updateLabelingInfo(e){const i=this._deconflictor&&this._deconflictor.labelingInfoChange(e),t=this._labeler&&this._labeler.labelingInfoChange(e);await f([i,t])}updateVisibilityInfo(){this._deconflictor&&this._deconflictor.labelingInfoChange(),this._labeler&&this._labeler.visibilityInfoChange()}get symbolUpdateType(){if(this._pendingUpdates.size>0)return"unknown";let e=0,i=0;return o(this._symbols,((t,r)=>{if(h(t)){const s=t.getFastUpdateStatus();if(s.loading>0)return!0;this._graphicsBySymbol.has(r)&&(i+=s.fast,e+=s.slow)}return!1}))?"unknown":i>=0&&0===e?"fast":e>=0&&0===i?"slow":"mixed"}runTask(e){if(this._frameTask.processQueue(e),this._applyPendingUpdates(e),this.notifyChange("running"),this.running||this.notifyChange("updating"),this.notifyChange("updatingRemaining"),!e.hasProgressed)return De.YIELD}setObjectIdVisibility(e,i){i?this._objectIdInvisibleSet.delete(e):this._objectIdInvisibleSet.add(e);const t=this._findGraphics3DGraphicByObjectId(e);h(t)&&this._updateUserVisibility(t)}_findGraphics3DGraphicByObjectId(e){return l(this.graphics3DGraphics,(i=>this._getGraphicObjectID(i.graphic)===e))}_updateUserVisibility(e){if(p(e))return!1;const i=e.graphic,t=this._getGraphicObjectID(i),r=i.visible&&!this.owner.suspended&&(p(t)||!this._objectIdInvisibleSet.has(t));return e.setVisibilityFlag(re.USER_SETTING,r,se.GRAPHIC)}_whenGraphics3DGraphic(e){const i=this.graphics3DGraphics.get(e.uid);if(i)return Promise.resolve(i);const t=this._whenGraphics3DGraphicRequests[e.uid];if(t)return t.promise;const r=v();return this._whenGraphics3DGraphicRequests[e.uid]=r,r.promise}async _boundsForGraphics3DGraphic(e,i){const t=this._viewSpatialReference,r=this.owner.view.renderSpatialReference,s=this.owner.view.basemapTerrain.spatialReference,a=(e,i,s)=>k(e,r,i,e,t,i,s),n=(e,i,r)=>k(e,s,i,e,t,i,r),o=this._viewElevationProvider?{service:this._viewElevationProvider,useViewElevation:!!h(i)&&!!i.useViewElevation,minDemResolution:h(i)?i.minDemResolution:null,minDemResolutionForPoints:this.owner.view.resolution}:null,l=await e.getProjectedBoundingBox(a,n,o,m(i,"signal"));if(!l)return null;const p=l.boundingBox;if(l.requiresDrapedElevation){const e=this.symbolCreationContext.elevationProvider;if(e){W(p,je);const i=d(e.getElevation(je[0],je[1],0,t,"ground"),0);p[2]=Math.min(p[2],i),p[5]=Math.max(p[5],i)}}return{boundingBox:p,screenSpaceObjects:l.screenSpaceObjects}}async whenGraphicBounds(e,i){await R((()=>this.owner?.loadedGraphics));const t=this.owner.layer&&this.owner.layer.objectIdField,s=this.owner.loadedGraphics.find((i=>i===e||null!=t&&null!=i.attributes&&e.attributes&&i.attributes[t]===e.attributes[t]));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,i)}computeAttachmentOrigin(e,i){const t=this.graphics3DGraphics.get(e.uid);if(!t)return null;const r=t.computeAttachmentOrigin();if(0===r.render.num&&0===r.draped.num)return null;A(Ne,0,0,0);let s=0;if(r.render.num>0){if(!V(r.render.origin,this.symbolCreationContext.renderCoordsHelper.spatialReference,Be,i))return null;O(Ne,Ne,Be),s++}if(r.draped.num>0){const[e,t]=r.draped.origin,a=d(this._viewElevationProvider.getElevation(e,t,"ground"),0);if(A(Be,e,t,a),!V(Be,this._viewElevationProvider.spatialReference,Be,i))return null;O(Ne,Ne,Be),s++}return s>1&&L(Ne,Ne,1/s),new Ee({x:Ne[0],y:Ne[1],z:Ne[2],spatialReference:i})}getSymbolLayerSize(e,i){const t=this._symbols.get(e.id);if(p(t))throw new r("internal:symbol-not-part-of-view","Symbol is not part of this view");const s=e.symbolLayers.indexOf(i);if(-1===s)throw new r("internal:missing-symbol-layer","Symbol layer is not in symbol");const a=t.getSymbolLayerSize(s);if(p(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 i=e.graphic.uid,t=this.graphics3DGraphics.get(i);if(!p(t)||!p(this._graphicsWithoutSymbol.get(i)))switch(e.property){case"visible":this._graphicUpdateVisibleHandler(t);break;case"geometry":this._graphicUpdateGeometryHandler(t,e);break;case"symbol":this._graphicUpdateSymbolHandler(t,e);break;case"attributes":break;case"transform":this._graphicUpdateTransformHandler(t,e)}}_graphicUpdateGeometryHandler(e,i){const t=i.graphic.geometry;if(p(t))return void this._recreateGraphic(i.graphic);if(p(e)){const e=i.graphic.symbol&&i.graphic.symbol.id;if(e){const i=this._symbols.get(e);if(h(i)&&i.loadStatus===ge.LOADING)return}return void this._recreateGraphic(i.graphic)}const r=e.graphics3DSymbol;!p(i.newValue)&&r.updateGeometry(e,i.newValue)||this._recreateGraphic(e.graphic),this._expandComputedExtent(t)}_graphicUpdateSymbolHandler(e,i){const t=i.graphic,r=h(e)?e.graphics3DSymbol:h(i.oldValue)?this._symbols.get(i.oldValue.id):null;if(p(r)||p(i.newValue))return void this._recreateGraphic(t);const s=r.symbol,a=this._getConvertedSymbol(i.newValue);if(h(a)&&(a.type!==s.type||"web-style"===a.type)||"web-style"===s.type)return void this._recreateGraphic(t);const n=this._graphicsBySymbol.get(s.id);if(n&&1!==n.size)return void this._recreateGraphic(t);const o=E(s,a);if(p(o))return void this._updateSymbolMapping(s.id,a);const l={diff:o,graphics3DGraphicPatches:[],symbolStatePatches:[]};if(r.prepareSymbolPatch(l),!U(l.diff))return void this._recreateGraphic(t);const d=this._getRenderingInfo(t);if(p(d))return void this._recreateGraphic(t);const c=r.extentPadding;for(const h of l.symbolStatePatches)h();if(c!==r.extentPadding&&this._recomputeExtentPadding(),h(e))for(const h of l.graphics3DGraphicPatches)h(e,d);this._updateSymbolMapping(s.id,a)}_graphicUpdateVisibleHandler(e){this._updateUserVisibility(e)&&(this._labeler&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty())}_graphicUpdateTransformHandler(e,i){}recreateGraphics(e){this._suspendSymbolCleanup=!0,this.remove(e),this.add(e),this._suspendSymbolCleanup=!1,this.effectiveUpdatePolicy===Se.SYNC&&this._cleanupSymbols()}_recreateGraphic(e){this.recreateGraphics([e])}_beginGraphicUpdate(e){const i=this._graphicsUpdateId;return this._graphicsUpdateId++,this._graphicsWaitingForSymbol.set(e.uid,i),1===this._graphicsWaitingForSymbol.size&&this.notifyChange("updating"),i}_endGraphicUpdate(e){e&&(this._graphicsWaitingForSymbol.delete(e.uid),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("updating")))}_recomputeExtentPadding(){let e=0;this._symbols.forEach((i=>{h(i)&&(e=Math.max(e,i.extentPadding))})),this._set("extentPadding",e)}_expandComputedExtent(e){const i=Ve,t=e.spatialReference;$(e,i);const r=this._viewSpatialReference,s=Le.tmpVec;if(H(t,r)||F(i[0],i[1],0,t,s,r)&&(i[0]=s[0],i[1]=s[1],F(i[3],i[4],0,t,s,r),i[3]=s[0],i[4]=s[1]),!(isFinite(i[0])&&isFinite(i[3])&&isFinite(i[1])&&isFinite(i[4])))return;const a=this.computedExtent;let n=null;const o=isFinite(i[2])&&isFinite(i[5]),l=o&&(!a||null==a.zmin||i[2]<a.zmin),h=o&&(!a||null==a.zmax||i[5]>a.zmax);if(a){(i[0]<a.xmin||i[1]<a.ymin||i[3]>a.xmax||i[4]>a.ymax||l||h)&&(n=this._propertiesPool.get("computedExtent"),n.xmin=Math.min(i[0],a.xmin),n.ymin=Math.min(i[1],a.ymin),n.xmax=Math.max(i[3],a.xmax),n.ymax=Math.max(i[4],a.ymax),n.spatialReference=r)}else n=this._propertiesPool.get("computedExtent"),n.xmin=i[0],n.ymin=i[1],n.xmax=i[3],n.ymax=i[4],n.spatialReference=r;n&&(l&&(n.zmin=i[2]),h&&(n.zmax=i[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 i=ae(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);this.symbolCreationContext.featureExpressionInfoContext=await ne(i,this._viewSpatialReference,e.signal,Te),_(e.signal),this._elevationInfoChangeAbortController=null,this._labeler?.elevationInfoChange(),this.forEachGraphics3DSymbol(((e,i,t)=>{e.globalPropertyChanged("elevationInfo",i)?i.forEach((e=>{const i=e.graphic,t=e.labelLayers;for(const r of t){r.graphics3DSymbolLayer.updateGraphicElevationContext(i,r)}})):this._recreateSymbol(t)})),this.updateStageLayerElevationProvider(),this._elevationAlignment?.elevationInfoChange()}updateStageLayerElevationProvider(){this._stageLayerElevationProvider?(this.layer.elevationInfo&&"relative-to-scene"===this.layer.elevationInfo.mode||0===this._numberOfGraphicsProvidingElevation)&&(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=g(this._stageLayerElevationProvider)):(!this.layer.elevationInfo||this.layer.elevationInfo&&"relative-to-scene"!==this.layer.elevationInfo.mode)&&this._numberOfGraphicsProvidingElevation>0&&(this._stageLayerElevationProvider=new fe({layer:this.layer,stageLayer:this.stageLayer,view:this.owner.view}),this.owner.view.elevationProvider.register("scene",this._stageLayerElevationProvider))}_clearSymbolsAndGraphics(){this.clear(),h(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=g(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:i,view:t}=this.owner,r=t.basemapTerrain.tilingScheme&&i&&i.length?i.toArray():null;!e&&r||this._clearSymbolsAndGraphics(),this.symbolCreationContext.screenSizePerspectiveEnabled=this.owner.view.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled,this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this._set("computedExtent",null),r&&(e?this.add(r):this.recreateGraphics(r))}_recreateSymbol(e){const i=this._graphicsBySymbol.get(e),t=[];i&&(i.forEach(((e,i)=>{const r=e.usedMemory;this._conditionalRemove(e,i),this._spatialIndex?.remove(e),t.push(e.graphic),e.destroy(),this._removeGraphics3DGraphic(i,r),this._updateLayerVisibility(),this._featureStore.events.emit("changed")})),this._graphicsBySymbol.set(e,new Map));const r=this._symbols.get(e);c(r),this._symbols.delete(e),this.add(t)}_recreateGraphicsForSymbol(e){const i=this._graphicsBySymbol.get(e);if(i){const e=[];i.forEach((i=>e.push(i.graphic))),this.recreateGraphics(e)}}_conditionalRemove(e,i){this._graphicsDrapedUids.delete(i),this._objectStates?.removeGraphic(e),this._labeler?.removeGraphic(e),this._deconflictor?.removeGraphic(e),h(this._graphicStateTracking)&&this._graphicStateTracking.removeGraphic(e)}add(e){e&&0!==e.length&&(this.owner.view.basemapTerrain&&this.owner.view.basemapTerrain.tilingScheme?(this._updatePolicyForGraphics(e)===Se.ASYNC?this._addDelayed(e):this._addImmediate(e),this.notifyChange("updating")):Te.error("#add()","Cannot add graphics before terrain surface has been initialized"))}_updatePolicyForGraphics(e){if(this.effectiveUpdatePolicy===Se.SYNC&&("mesh"===this.layer.geometryType||null==this.layer.geometryType))for(const i of e)if(h(i.geometry)&&"mesh"===i.geometry.type&&!i.geometry.loaded)return Se.ASYNC;return this.effectiveUpdatePolicy}_addImmediate(e){this._geometryWarningLogged=!1,this._symbolWarningLogged=!1;for(const i of e)this._addGraphic(i,this._getRenderingInfo(i,Te),Se.SYNC);this._cleanupSymbols(),this._labeler&&(this.owner.view.labeler.setDirty(),this._cleanupSymbols()),this.owner.view.deconflictor.setDirty()}_addDelayed(e){for(const i of e){const e=i.uid;let t=this._pendingUpdates.get(e);t?t.add?t.state!==ze.NEW&&t.abortController?.abort():this._pendingAdds++:(t=this._pendingUpdatesPool.pushNew(),this._pendingAdds++,this._pendingUpdates.set(e,t)),t.add=i}this.notifyChange("running"),this.notifyChange("updatingRemaining")}remove(e){this.effectiveUpdatePolicy===Se.ASYNC?this._removeDelayed(e):this._removeImmediate(e),this.notifyChange("updating")}_removeImmediate(e){for(const i of e)this._removeGraphic(i);this._cleanupSymbols(),this._labeler&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty()}_removeDelayed(e){for(const i of e){const e=i.uid,t=this._pendingUpdates.get(e);if(t)t.add&&(t.remove?t.add=null:this._pendingUpdates.delete(e),t.state===ze.LOADING&&t.abortController?.abort(),this._pendingAdds--);else{const t=this._pendingUpdatesPool.pushNew();t.remove=i,this._pendingUpdates.set(e,t),this._pendingRemoves++,this._applyPendingRemovesFirst=!0}}0===this._pendingUpdates.size&&this._finishPendingUpdates(),this.notifyChange("running"),this.notifyChange("updatingRemaining")}_finishPendingUpdates(){this._pendingUpdatesPool.clear(),this._cleanupSymbols(),(this._pendingAdds||this._pendingRemoves)&&Te.warn("pendingAdds/Removes in inconsistent state!"),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1}_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[i,t]of this._pendingUpdates){if(e.done){this._applyPendingRemovesFirst=!0;break}if(t.remove&&!t.add&&(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(t.remove),t.remove=null,this._pendingUpdates.delete(i),0===this._pendingRemoves))break}}for(const[i,t]of this._pendingUpdates){if(e.done)break;t.add&&t.state===ze.NEW&&this._processPendingUpdateNew(t);let r=this.effectiveUpdatePolicy;if(!t.remove||t.add&&t.state!==ze.READY||(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(t.remove),t.remove=null,r=Se.SYNC),t.add)switch(t.state){case ze.READY:this._addGraphic(t.add,t.renderingInfo,r),t.add=null,this._pendingAdds--,e.madeProgress();break;case ze.REJECTED:t.add=null,this._pendingAdds--;case ze.LOADING:}null==t.remove&&null==t.add&&this._pendingUpdates.delete(i)}0===this._pendingUpdates.size&&(this._finishPendingUpdates(),this.notifyChange("running"))}_processPendingUpdateNew(e){if(!e.add)return void(e.state=ze.READY);const i=e.add.geometry;h(i)&&"mesh"===i.type&&!i.loaded?this._processPendingUpdateNewMesh(e,i):this._processPendingUpdateNewRenderingInfo(e)}async _processPendingUpdateNewMesh(e,i){e.state=ze.LOADING,e.abortController=new AbortController;const t=e.abortController.signal;try{await i.load({signal:t})}catch(r){return this._processPendingUpdateNewError(e,r)}e.abortController=null,this._processPendingUpdateNewRenderingInfo(e)}_processPendingUpdateNewError(e,i){e.abortController=null,C(i)?e.state=ze.NEW:e.state=ze.REJECTED}async _processPendingUpdateNewRenderingInfo(e){if(p(this.layer.renderer)||"dictionary"!==this.layer.renderer.type)return e.renderingInfo=this._getRenderingInfo(e.add,Te),void(e.state=ze.READY);e.state=ze.LOADING,e.abortController=new AbortController;let i=null;try{i=await this._getRenderingInfoAsync(e.add,{signal:e.abortController.signal})}catch(t){return e.abortController=null,void(C(t)?e.state=ze.NEW:e.state=ze.REJECTED)}p(i)||p(i.symbol)?(Te&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,Te.warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),e.renderingInfo=null):e.renderingInfo=i,e.state=ze.READY}_addGraphic(e,i,t){if(this._graphicsWithoutSymbol.set(e.uid,e),p(i)||p(i.symbol)||!Z(e))return;h(this.stage.renderView.objectAndLayerIdRenderHelper)&&this.setUidToIdOnAdd&&this.stage.renderView.objectAndLayerIdRenderHelper.setUidToObjectAndLayerId(e.objectId,e.uid,this.layer.id,this.layer.uid,!!this.layer.popupEnabled);const r=i.symbol,s=this.getOrCreateGraphics3DSymbol(r,i.renderer);if(p(s))return;this._expandComputedExtent(e.geometry);const a=this._beginGraphicUpdate(e),n=new le(e,i,this.layer);let o=!1;const l=e=>{e===s.symbol.id&&(o=!0)};this._whenSymbolRemoved.push(l);const d=()=>{if(--this._loadingSymbols,this.destroyed)return;this._whenSymbolRemoved.removeUnordered(l);if(this._graphicsWaitingForSymbol.get(e.uid)!==a||o||s.destroyed||this.graphicSymbolSupported&&e.symbol&&e.symbol.id!==s.symbol.id)--s.referenced,this._cleanupSymbols();else{const i=this._createGraphics3DGraphic(s,n);this._spatialIndex&&h(i)&&this._spatialIndex.add(i),--s.referenced,this._endGraphicUpdate(e)}this._featureStore.events.emit("changed"),this._labeler&&this.owner.view.labeler.setDirty()},c=i=>{--this._loadingSymbols,this.destroyed||(this._whenSymbolRemoved.removeUnordered(l),o||(C(i)?this.add([e]):s.destroyed||this._endGraphicUpdate(e)))};++this._loadingSymbols,t===Se.ASYNC?s.load((()=>this._frameTask.schedule(d)),(e=>this._frameTask.schedule((()=>c(e))))):s.load(d,c)}_removeGraphic(e){const i=e.uid,t=this.graphics3DGraphics.get(i);if(t){t.graphics3DSymbol.onRemoveGraphic(t);const e=t.usedMemory,r=t.isElevationSource;this._conditionalRemove(t,i),this._spatialIndex?.remove(t);const s=t.graphics3DSymbol.symbol.id;this._graphicsBySymbol.get(s)?.delete(i),this._graphicsWithoutSymbol.delete(i),this._removeGraphics3DGraphic(i,e,r),t.destroy(),this._featureStore.events.emit("changed")}else this._graphicsWithoutSymbol.delete(i),this._graphicsWaitingForSymbol.delete(i),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("updating"))}_hasLabelingContext(e){if(e instanceof Ue||e instanceof Ae){const i=this.symbolCreationContext.layer;return!!i.labelingInfo&&i.labelingInfo.some((i=>i.symbol===e))}return!1}_hasValidSymbolCreationContext(e){return!(e instanceof Ue&&!this._hasLabelingContext(e))||(Te.error("LabelSymbol3D is only valid as part of a LabelClass. Using LabelSymbol3D as a renderer symbol is not supported."),!1)}_getRenderingInfo(e,i){const t=e.geometry;if(p(t))return i&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,i.warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!T(t.spatialReference,this._viewSpatialReference))return i&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,i.warn(`Graphic in layer ${this.layer.id} has incompatible spatial reference and will not render`)),null;if(!this.graphicSymbolSupported&&h(e.symbol))return i&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,i.warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const r=this.rendererHasGeometryOperations?J(e,this.layer):e;let s;if(this.owner.getRenderingInfo&&(this.getRenderingInfoWithoutRenderer||h(this.currentRenderer)))s=this.owner.getRenderingInfo(r,this.currentRenderer,this._arcadeOnDemand);else{s={symbol:r.symbol||ee(r.geometry)}}return p(s)||p(s.symbol)?(i&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,i.warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),null):s}_getRenderingInfoAsync(e,i){const t=e.geometry;if(p(t))return Te&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,Te.warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!this.graphicSymbolSupported&&h(e.symbol))return Te&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,Te.warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const r=this.rendererHasGeometryOperations?J(e,this.layer):e;return this.owner.getRenderingInfoAsync(r,this.currentRenderer,this._arcadeOnDemand,i)}_createGraphics3DSymbol(e,i){if(!this._hasValidSymbolCreationContext(e))return null;const t=this._getConvertedSymbol(e);if(!t)return null;let r;if(h(i)&&"backgroundFillSymbol"in i&&i.backgroundFillSymbol){const e=ie(i.backgroundFillSymbol,{ignoreDrivers:!0});h(e.symbol)&&"web-style"!==e.symbol.type&&"cim"!==e.symbol.type&&(r=e.symbol.symbolLayers)}const s=de(t,this.symbolCreationContext,r);return s.load((()=>{const e=s.extentPadding;e>this.extentPadding&&this._set("extentPadding",e),this.notifyChange("averageSymbolComplexity")}),(()=>{})),s}getOrCreateGraphics3DSymbol(e,i){let t=this._symbols.get(e.id);return void 0===t&&(t=e instanceof Oe?new pe(e,(e=>this._frameTask.schedule(e)),(e=>this._createGraphics3DSymbol(e,i))):this._createGraphics3DSymbol(e,i),this._symbols.set(e.id,t)),h(t)&&++t.referenced,t}trackGraphicState(e){return p(this._graphicStateTracking)&&(this._graphicStateTracking=new ce(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,i,t=!1){this._usedMemory-=i,this.graphics3DGraphics.delete(e),this._numberOfGraphics--,t&&(this._numberOfGraphicsProvidingElevation--,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_createGraphics3DGraphic(e,i){const t=i.graphic;if(this._graphicsWithoutSymbol.delete(t.uid),!this._symbols.has(e.symbol.id))return this.add([t]),null;if(this.graphics3DGraphics.has(t.uid))return null;const r=e.createGraphics3DGraphic(i);if(p(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(t.uid,r);if(r.isDraped&&this._graphicsDrapedUids.add(t.uid),r.centroid=null,h(t.geometry)&&"point"!==t.geometry.type&&(r.centroid=ye(t.geometry,this._viewSpatialReference)),this._updateUserVisibility(r),h(this._scaleVisibility)&&this._scaleVisibility.updateVisibility(r),h(this._filterVisibility)){const{defaultVisibility:e}=this._filterVisibility;r.setVisibilityFlag(re.FILTER,e,se.GRAPHIC),e||this._filterVisibility.reapply()}this._deconflictor?.addGraphic(r),this._labeler?.addGraphic(r),this._objectStates?.addGraphic(r),this._deconflictor&&this.owner.view.deconflictor.setInitialIconVisibilityFlag(this,r),r.initialize(this.stage,this.stageLayer,this.owner),h(this._graphicStateTracking)&&this._graphicStateTracking.addGraphic(r);const a=this._whenGraphics3DGraphicRequests[t.uid];return a&&(delete this._whenGraphics3DGraphicRequests[t.uid],a.resolve(r)),r}_abortRendererChange(){this._rendererChangeAbortController&&(this._rendererChangeAbortController.abort(),this._rendererChangeAbortController=null)}async rendererChange(e){if(this._abortRendererChange(),e!==this.currentRenderer)if(this._validateRenderer(e),p(e)&&this._currentRendererChange(null,!1),Q(e))if(h(e)&&e.arcadeRequired){const i=new AbortController;this._rendererChangeAbortController=i;const{arcadeUtils:t}=await this._ensureArcade();_(i);const r=t.hasGeometryOperations(e);r&&(await t.enableGeometryOperations(),_(i)),this.effectiveUpdatePolicy===Se.ASYNC?await this._frameTask.schedule((()=>this._currentRendererChange(e,r)),i.signal):this._currentRendererChange(e,r),this._rendererChangeAbortController=null}else if(this.effectiveUpdatePolicy===Se.ASYNC){const i=new AbortController;this._rendererChangeAbortController=i,await this._frameTask.schedule((()=>this._currentRendererChange(e,!1)),i.signal),this._rendererChangeAbortController=null}else this._currentRendererChange(e,!1);else this._currentRendererChange(e,!1)}async _ensureArcade(){return p(this._arcadeOnDemand)?(this._arcadeOnDemand=await X(),this._arcadeOnDemand):this._arcadeOnDemand}_currentRendererChange(e,i){this.currentRenderer=e,this.rendererHasGeometryOperations=i,this.symbolCreationContext.arcade=u(this._arcadeOnDemand);const t=this.symbolCreationContext.renderer;if(e===t)return;if(this._symbolConversionCache.clear(),p(e))return this.symbolCreationContext.renderer=null,void this.recreateAllGraphicsAndSymbols();const r=E(t,e);this._updateUnchangedSymbolMappings(r,e,t),this.symbolCreationContext.renderer=e,p(r)||("complete"===r.type?this.recreateAllGraphicsAndSymbols():"partial"===r.type&&(this._applyRendererDiff(r,e,t)?this._volatileGraphicsUpdated():this.recreateAllGraphicsAndSymbols()),this.notifyChange("averageSymbolComplexity"))}_diffHasSymbolChange(e){for(const i in e.diff)switch(i){case"visualVariables":case"defaultSymbol":case"uniqueValueInfos":break;case"uniqueValueGroups":case"authoringInfo":case"fieldDelimiter":delete e.diff[i];break;default:return!0}return!1}_applySymbolSetDiff(e,i,t){e=e||[],i=i||[];const r=[];for(const s of i){const i=this._graphicsBySymbol.get(s.id);i&&i.forEach(((a,n)=>{const o=a.graphic,l=this.layer instanceof q?this.layer:null,h=u(this._arcadeOnDemand);if(s===t.defaultSymbol&&t.getSymbol(J(o,l),{arcade:h})===t.defaultSymbol)return;const d=a.usedMemory;e.length||t.defaultSymbol?r.push(o):this._graphicsWithoutSymbol.set(n,o);const p=this.graphics3DGraphics.get(n);this._conditionalRemove(p,n),a.destroy(),i.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&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty()}_applyUniqueValueRendererDiff(e,i,t){const r=e.diff.defaultSymbol,s=e.diff.uniqueValueInfos;if(r||s){const a=s?s.added.map((e=>e.symbol)).filter(h):[],n=s?s.removed.map((e=>e.symbol)).filter(h):[];if(s)for(let e=0;e<s.changed.length;e++)a.push(s.changed[e].newValue.symbol),n.push(s.changed[e].oldValue.symbol);return r?(t.defaultSymbol&&n.push(t.defaultSymbol),i.defaultSymbol&&a.push(i.defaultSymbol)):t.defaultSymbol&&a.length&&n.push(i.defaultSymbol),this._applySymbolSetDiff(a,n,i),delete e.diff.defaultSymbol,delete e.diff.uniqueValueInfos,!0}return!1}_calculateUnchangedSymbolMapping(e,i,t){if("unique-value"!==i?.type||"unique-value"!==t?.type||h(e)&&"partial"!==e.type)return[];const r=e=>h(e)?e.id:null,s=e&&e.diff,a=s&&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 t.uniqueValueInfos??[]){const t=r(e.symbol),s=i.uniqueValueInfos?.find((i=>i.value===e.value));s&&t!==r(s.symbol)&&o.push({oldId:t,newId:r(s.symbol)})}}return!a&&t.defaultSymbol&&o.push({oldId:r(t.defaultSymbol),newId:r(i.defaultSymbol)}),o}_updateSymbolMapping(e,i){const t=h(i)&&i?"string"==typeof i?i:i.id:null;if(p(e)||e===t)return;const r=this._graphicsBySymbol.get(e);this._graphicsBySymbol.delete(e),void 0!==r&&this._graphicsBySymbol.set(t,r);const s=this._symbols.get(e);if(void 0!==s&&(this._symbols.delete(e),this._symbols.set(t,s),h(s))){const e="string"==typeof i?null:i;h(e)?s.symbol=e:s.symbol.id=t}}_updateUnchangedSymbolMappings(e,i,t){const r=this._calculateUnchangedSymbolMapping(e,i,t);for(const{oldId:s,newId:a}of r)this._updateSymbolMapping(s,a)}_applyRendererDiff(e,t,r){if(this._diffHasSymbolChange(e))return!1;if(t instanceof i&&r instanceof i&&this._applyUniqueValueRendererDiff(e,t,r)&&0===Object.keys(e.diff).length)return!0;for(const[i]of this._graphicsBySymbol){const r=this._symbols.get(i);if(h(r))switch(r.applyRendererDiff(e,t)){case me.Recreate_Symbol:this._recreateSymbol(i);break;case me.Recreate_Graphics:this._recreateGraphicsForSymbol(i);case me.Fast_Update:}}return!0}opacityChange(){this.forEachGraphics3DSymbol(((e,i)=>e.globalPropertyChanged("opacity",i))),this._updateStageLayerVisibility()}_slicePlaneEnabledChange(e){e!==this.symbolCreationContext.slicePlaneEnabled&&(this.symbolCreationContext.slicePlaneEnabled=e,this.stageLayer.sliceable=e,this.forEachGraphics3DSymbol(((e,i)=>e.globalPropertyChanged("slicePlaneEnabled",i))),this._deconflictor&&this._deconflictor.slicePlaneEnabledChange(),this._labeler&&this._labeler.slicePlaneEnabledChange())}_physicalBasedRenderingChange(e){this.symbolCreationContext.physicalBasedRenderingEnabled=e,this.forEachGraphics3DSymbol(((e,i,t)=>{e.globalPropertyChanged("physicalBasedRenderingEnabled",i)||this._recreateSymbol(t)}))}_skipHighSymbolLoDsChange(e){this.symbolCreationContext.skipHighSymbolLods=e,this.forEachGraphics3DSymbol(((e,i,t)=>this._recreateSymbol(t)))}_pixelRatioChange(){this.forEachGraphics3DSymbol(((e,i,t)=>{e.globalPropertyChanged("pixelRatio",i)||this._recreateSymbol(t)}))}_signalUpdatingDuringAsyncLoadedGraphicsChange(){this._updatingPendingLoadedGraphicsChange&&this._updatingPendingLoadedGraphicsChange.remove(),this._updatingPendingLoadedGraphicsChange=P((()=>{this._updatingPendingLoadedGraphicsChange=null}))}setClippingExtent(e,i){const t=this.symbolCreationContext.clippingExtent,r=B();return ve(e,r,i)?this.symbolCreationContext.clippingExtent=M(z(),r):this.symbolCreationContext.clippingExtent=null,!N(this.symbolCreationContext.clippingExtent,t)}modifyGraphics3DGraphicVisibilities(e){let i=!1;this.graphics3DGraphics.forEach((t=>{e(t)&&(i=!0)})),i&&(this.owner.view.labeler?.setDirty(),this.owner.view.deconflictor.setDirty())}forEachGraphics3DSymbol(e){for(const[i,t]of this._symbols){if(p(t))return;e(t,this._graphicsBySymbol.get(i)||He,i)}}updateAllGraphicsVisibility(){h(this._filterVisibility)&&this._filterVisibility.reapply(),this.modifyGraphics3DGraphicVisibilities((e=>{const i=this._updateUserVisibility(e),t=h(this._scaleVisibility)&&this._scaleVisibility.updateVisibility(e);return i||t}))}_hideAllGraphics(){this.modifyGraphics3DGraphicVisibilities((e=>e.setVisibilityFlag(re.USER_SETTING,!1,se.GRAPHIC)))}_validateRenderer(e){const i=K(e,{geometryType:this.layer?.geometryType});if(i){const e=`Renderer for layer '${this.layer.title?`${this.layer.title}, `:""}, id:${this.layer.id}' is not supported in a SceneView`;Te.warn(e,i.message)}}_volatileGraphicsUpdated(){this._labeler?.reset(),this.stageLayer.shaderTransformationChanged(),this.notifyChange("updating")}_cleanupSymbols(){if(this._graphicsWaitingForSymbol.size>0||this._suspendSymbolCleanup)return;let e=!1;this._symbols.forEach(((i,t)=>{if(p(i)||i.referenced>0)return;const r=this._graphicsBySymbol.get(t);r&&0!==r.size||(this._graphicsBySymbol.delete(t),this._symbols.delete(t),c(i),e=!0)})),e&&(this._recomputeExtentPadding(),this.notifyChange("averageSymbolComplexity"))}get test(){return{snapshotInternals:()=>({graphics:[...this.graphics3DGraphics.keys()].sort(),symbols:[...this._symbols.keys()].sort(),graphicsBySymbol:[...this._graphicsBySymbol.keys()].sort().map((e=>({symbolId:e,graphics:[...this._graphicsBySymbol.get(e).keys()].sort()}))),graphicsWithoutSymbol:[...this._graphicsWithoutSymbol.keys()].sort(),graphicsDrapedUids:[...this._graphicsDrapedUids].sort(),pendingUpdates:this._pendingUpdates}),symbols:this._symbols,filterVisibility:this._filterVisibility,numPending:this._pendingUpdates.size,forceUpdatePolicy:e=>{this._forcedUpdatePolicy=e}}}get performanceInfo(){return{visible:this.graphics3DGraphics.size,missing:this._graphicsWithoutSymbol.size,pending:this._pendingUpdates.size}}};var ze;ke.tmpVec=j(),e([D({readOnly:!0})],ke.prototype,"computedExtent",void 0),e([D()],ke.prototype,"currentRenderer",void 0),e([D()],ke.prototype,"rendererHasGeometryOperations",void 0),e([D()],ke.prototype,"_frameTask",void 0),e([D({readOnly:!0})],ke.prototype,"_viewSpatialReference",null),e([D()],ke.prototype,"_rendererChangeAbortController",void 0),e([D()],ke.prototype,"_elevationInfoChangeAbortController",void 0),e([D()],ke.prototype,"_initializeAbortController",void 0),e([D()],ke.prototype,"_elevationAlignment",void 0),e([D()],ke.prototype,"_scaleVisibility",void 0),e([D()],ke.prototype,"_filterVisibility",void 0),e([D()],ke.prototype,"_initializePromise",void 0),e([D()],ke.prototype,"_spatialIndex",void 0),e([D({readOnly:!0})],ke.prototype,"extentPadding",void 0),e([D()],ke.prototype,"_updatingPendingLoadedGraphicsChange",void 0),e([D()],ke.prototype,"_featureStore",void 0),e([D()],ke.prototype,"_deconflictor",void 0),e([D()],ke.prototype,"_labeler",void 0),e([D()],ke.prototype,"_objectStates",void 0),e([D()],ke.prototype,"_loadingSymbols",void 0),e([D()],ke.prototype,"preferredUpdatePolicy",void 0),e([D()],ke.prototype,"_forcedUpdatePolicy",void 0),e([D({readOnly:!0})],ke.prototype,"effectiveUpdatePolicy",null),e([D({constructOnly:!0})],ke.prototype,"elevationFeatureExpressionEnabled",void 0),e([D({constructOnly:!0})],ke.prototype,"owner",void 0),e([D({constructOnly:!0})],ke.prototype,"layer",void 0),e([D({constructOnly:!0})],ke.prototype,"graphicSymbolSupported",void 0),e([D({constructOnly:!0})],ke.prototype,"getRenderingInfoWithoutRenderer",void 0),e([D({constructOnly:!0})],ke.prototype,"componentFactories",void 0),e([D({constructOnly:!0})],ke.prototype,"setUidToIdOnAdd",void 0),e([D()],ke.prototype,"featureStore",null),e([D()],ke.prototype,"initializePromise",null),e([D()],ke.prototype,"scaleVisibility",null),e([D()],ke.prototype,"elevationAlignment",null),e([D()],ke.prototype,"objectStates",null),e([D()],ke.prototype,"filterVisibility",null),e([D({readOnly:!0})],ke.prototype,"updating",null),e([D({readOnly:!0})],ke.prototype,"running",null),e([D({readOnly:!0})],ke.prototype,"suspendedOrOutsideOfView",null),e([D({readOnly:!0,dependsOn:[]})],ke.prototype,"updatingRemaining",null),e([D({readOnly:!0,dependsOn:["owner.view.qualitySettings.graphics3D.maxTotalNumberOfPrimitives","owner.view.qualitySettings.graphics3D.maxTotalNumberOfFeatures","averageSymbolComplexity"]})],ke.prototype,"displayFeatureLimit",null),e([D({readOnly:!0,dependsOn:[]})],ke.prototype,"averageSymbolComplexity",null),e([D({constructOnly:!0})],ke.prototype,"hasZ",void 0),e([D({constructOnly:!0})],ke.prototype,"hasM",void 0),e([D()],ke.prototype,"_objectIdField",null),ke=Le=e([I(Fe)],ke),function(e){e[e.NEW=0]="NEW",e[e.LOADING=1]="LOADING",e[e.READY=2]="READY",e[e.REJECTED=3]="REJECTED"}(ze||(ze={}));class We{constructor(){this.add=null,this.renderingInfo=null,this.state=ze.NEW,this.abortController=null,this.remove=null}clear(){this.add=null,this.renderingInfo=null,this.state=ze.NEW,this.abortController=null,this.remove=null}}const Me=10,Ne=j(),Be=j(),He=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/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import i from"../../../../core/Evented.js";import r from"../../../../core/Handles.js";import{isSome as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import i from"../../../../core/Evented.js";import r from"../../../../core/Handles.js";import{destroyMaybe as s,isSome as a}from"../../../../core/maybe.js";import{watch as n}from"../../../../core/reactiveUtils.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import{ExtentSet as p}from"./ExtentSet.js";import{UpdatePolicy as d}from"../../webgl-engine/lib/basicInterfaces.js";import{TaskPriority as c}from"../../../support/Scheduler.js";let l=class extends t{constructor(e){super(e),this._dirtyExtents=new p,this._globalDirty=!1,this._averageExtentUpdateSize=0,this._dirtyGraphicsSet=new Set,this._handles=new r,this._updateElevation=!1,this.graphicsCoreOwner=null,this.graphicsCore=null,this.events=new i}initialize(){const e=this.elevationProvider,t=this.graphicsCoreOwner.view.resourceController.scheduler;this._handles.add([e.on("elevation-change",(e=>this._elevationChanged(e))),n((()=>this.graphicsCoreOwner.suspended),(()=>this._suspendedChange())),t.registerTask(c.ELEVATION_ALIGNMENT,this)])}destroy(){this._dirtyGraphicsSet.clear(),this._handles=s(this._handles),this.graphicsCoreOwner=null,this.graphicsCore=null,this.queryGraphicUIDsInExtent=null,this.elevationProvider=null}clear(){this._dirtyGraphicsSet.clear(),this.notifyChange("updating")}_suspendedChange(){!0===this.graphicsCoreOwner.suspended?this._updateElevation=!1:!1===this.graphicsCoreOwner.suspended&&this._updateElevation&&(this._globalDirty=!0,this.notifyChange("updating"))}elevationInfoChange(){this._globalDirty=!0,this.notifyChange("updating")}get updating(){return this.running}get running(){return this._dirtyGraphicsSet.size>0||this._dirtyExtents&&!this._dirtyExtents.empty||this._globalDirty}get updatingRemaining(){return this._dirtyGraphicsSet.size+this._dirtyExtents.size*this._averageExtentUpdateSize}runTask(e){for(this._globalDirty&&(this._markAllGraphicsElevationDirty(),this._globalDirty=!1,e.madeProgress()),e.run((()=>this._dirtyExtents.merge(e)));this.running&&!e.done;)this._updateDirtyGraphics(e),this._updateDirtyExtents(e);this.notifyChange("updating")}_updateDirtyGraphics(e){const t=this.graphicsCoreOwner.view.renderCoordsHelper,i=this.graphicsCore.effectiveUpdatePolicy===d.ASYNC;for(const r of this._dirtyGraphicsSet.keys()){const s=this.graphicsCore.getGraphics3DGraphicById(r);if(this._dirtyGraphicsSet.delete(r),a(s)&&(s.alignWithElevation(this.elevationProvider,t,i),this.graphicsCoreOwner.view.deconflictor.setDirty(),e.madeProgress()),e.done)return}}_updateDirtyExtents(e){for(;!this._dirtyExtents.empty&&!e.done;){const t=this._dirtyExtents.pop(),i=this.elevationProvider.spatialReference;this.events.emit("invalidate-elevation",{extent:t,spatialReference:i});const r=this._dirtyGraphicsSet.size;this.queryGraphicUIDsInExtent(t,i,(e=>{const t=this.graphicsCore.getGraphics3DGraphicById(e);a(t)&&t.needsElevationUpdates()&&this._dirtyGraphicsSet.add(e)})),this._averageExtentUpdateSize=.1*(this._dirtyGraphicsSet.size-r)+.9*this._averageExtentUpdateSize,e.madeProgress()}}_markAllGraphicsElevationDirty(){this._dirtyExtents.clear(),this._dirtyGraphicsSet.clear(),this.graphicsCore.graphics3DGraphics.forEach(((e,t)=>this._dirtyGraphicsSet.add(t)))}_elevationChanged(e){if("scene"===e.context&&(!this.graphicsCore.layer.elevationInfo||"relative-to-scene"!==this.graphicsCore.layer.elevationInfo.mode))return;const{extent:t,spatialReference:i}=e;if(this.graphicsCoreOwner.suspended){if(!this._updateElevation){const e=this.graphicsCore.computedExtent;e&&t[2]>e.xmin&&t[0]<e.xmax&&t[3]>e.ymin&&t[1]<e.ymax&&(this._updateElevation=!0)}this.events.emit("invalidate-elevation",{extent:t,spatialReference:i})}else t[0]===-1/0?this._globalDirty=!0:this._dirtyExtents.add(t),this.notifyChange("updating")}};e([o()],l.prototype,"graphicsCoreOwner",void 0),e([o()],l.prototype,"graphicsCore",void 0),e([o()],l.prototype,"queryGraphicUIDsInExtent",void 0),e([o()],l.prototype,"elevationProvider",void 0),e([o({readOnly:!0})],l.prototype,"updating",null),e([o({readOnly:!0})],l.prototype,"updatingRemaining",null),l=e([h("esri.views.3d.layers.graphics.Graphics3DElevationAlignment")],l);const g=l;export{g as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/has.js";import e from"../../../../core/Error.js";import{clone as t}from"../../../../core/lang.js";import{get as r,isSome as s,isNone as n}from"../../../../core/maybe.js";import{getMetersPerVerticalUnitForSR as i}from"../../../../core/unitUtils.js";import{e as o}from"../../../../chunks/earcut.js";import{b as a}from"../../../../chunks/mat3.js";import{c as l}from"../../../../chunks/mat3f64.js";import{a as c}from"../../../../chunks/mat4.js";import{c as h}from"../../../../chunks/mat4f64.js";import{c as m,n as p,s as d,b as g,f,m as u}from"../../../../chunks/vec3.js";import{d as y,c as b}from"../../../../chunks/vec3f64.js";import{computeTranslationToOriginAndRotation as _}from"../../../../geometry/projection.js";import{create as E,empty as x,expandWithBuffer as j,intersectsClippingArea as w}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f64 as S}from"../../../../geometry/support/buffer/BufferView.js";import{t as P,a as v}from"../../../../chunks/vec32.js";import{makeVertexCandidate as L,makeEdgeCandidate as A}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as C}from"../../../../renderers/support/renderingInfoUtils.js";import{ViewingMode as M}from"../../../ViewingMode.js";import{needsElevationUpdates3D as I,SampleElevationInfo as O}from"./elevationAlignmentUtils.js";import{ElevationContext as B}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as R}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as z}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as T,computeCentroid as D}from"./graphicUtils.js";import{ApplyRendererDiffResult as G}from"./interfaces.js";import{geometryAsPolygon as U}from"./polygonUtils.js";import{createMaterial as k}from"../support/edgeUtils.js";import N from"../../support/debugFlags.js";import{SamplePosition as F}from"../../support/ElevationProvider.js";import{geometryToRenderInfo as V}from"../../support/renderInfoUtils/polygon.js";import{Attribute as H}from"../../webgl-engine/lib/Attribute.js";import{CullFaceOptions as Y}from"../../webgl-engine/lib/basicInterfaces.js";import{ContentObjectType as W}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as Z}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as q}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{Object3D as J}from"../../webgl-engine/lib/Object3D.js";import{VertexAttribute as K}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as Q}from"../../webgl-engine/materials/DefaultMaterial.js";const X=["polygon","extent"];class $ extends z{constructor(e,t,r,s){super(e,t,r,s),this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=T(this._getSymbolSize());if(t)throw new e("graphics3dextrudesymbollayer:invalid-size",t)}const t=r(this.symbolLayer,"material","color"),s=this._getCombinedOpacityAndColor(t),n=y(s),i=s[3],o=i<1||this.needsDrivenTransparentPass,a={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,diffuse:n,ambient:n,opacity:i,transparent:o,cullFace:o?Y.None:Y.Back,hasVertexColors:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0};this._material=new Q(a),this._bottomMaterial=new Q({...a,cullFace:Y.Back}),this._context.stage.add(this._material),this._context.stage.add(this._bottomMaterial)}destroy(){super.destroy(),this._material&&(this._context.stage.remove(this._material),this._context.stage.remove(this._bottomMaterial))}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,X,this.symbolLayer.type))return null;const r=this._getVertexOpacityAndColor(e.renderingInfo,255),s=this.setGraphicElevationContext(t,new B);return this._createAs3DShape(t,e.renderingInfo,r,s,t.uid)}layerOpacityChanged(e,t){const n=r(this.symbolLayer,"material","color"),i=this._getCombinedOpacity(n),o=i<1||this.needsDrivenTransparentPass;this._material.setParameters({opacity:i,transparent:o}),this._bottomMaterial.setParameters({opacity:i,transparent:o});const a=this._getLayerOpacity();e.forEach((e=>{const r=t(e);s(r)&&r.layerOpacityChanged(a,this._context.isAsync)}))}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,I)}slicePlaneEnabledChanged(e,t){return this._material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._bottomMaterial.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),e.forEach((e=>{const r=t(e);s(r)&&r.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)})),!0}physicalBasedRenderingChanged(){return this._material.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),this._bottomMaterial.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}pixelRatioChanged(){return!0}_getExtrusionSize(e){let t;return t=e.size&&this._drivenProperties.size?C(e.size,2)??0:this._getSymbolSize(),t/=this._context.renderCoordsHelper.unitInMeters,t}applyRendererDiff(e,t){return this._drivenPropertiesChanged(t)?G.Recreate_Symbol:G.Recreate_Graphics}async queryForSnapping(e,r,s,n){const o=this._getExtrusionSize(s)*this._context.renderCoordsHelper.unitInMeters/i(r),{objectId:a,target:l}=e,c=t(l);switch(c.z=(c.z??0)+o,e.type){case"edge":{const{start:r,end:s}=e,n=t(r),i=t(s);return n.z=(n.z??0)+o,i.z=(i.z??0)+o,[A(a,c,1/0,n,i)]}case"vertex":return[L(a,c,1/0),A(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(e,t,r,i,m){const p=U(e.geometry);if(n(p))return null;if(0===p.rings.length||!p.rings.some((e=>e.length>0)))return this._logGeometryValidationWarnings(p.rings,"rings","ExtrudeSymbol3DLayer"),null;const d=V(p,this._context.elevationProvider,this._context.renderCoordsHelper,i);this._logGeometryCreationWarnings(d,p.rings,"rings","ExtrudeSymbol3DLayer");const g=D(p);if(n(g))return null;const f=new Array,u=E(),y=h(),L=b(),A=this._context.renderCoordsHelper.viewingMode===M.Global;A||this._context.renderCoordsHelper.worldUpAtPosition(null,L),_(p.spatialReference,[g.x,g.y,0],y,this._context.renderCoordsHelper.spatialReference);const C=h();c(C,y);const O=l();a(O,C);const{polygons:B,mapPositions:z,position:T}=d,G=T.length/3,N=new Float64Array(3*G*6),F=new Float64Array(3*G*6),H=new Float64Array(3*G*6),Y=new Float64Array(1*G*6);let W=0;for(let s=0;s<B.length;++s){const e=B[s],n=e.count;if(this._context.clippingExtent&&(x(u),j(u,e.mapPositions),!w(u,this._context.clippingExtent)))continue;const i=o(e.mapPositions,e.holeIndices,3);if(0===i.length)continue;const a=3*n*2+i.length,l=new Array(a),c=new Array(i.length),h=6*n,p=3*N.BYTES_PER_ELEMENT,d=new S(N.buffer,W*p,p,(W+h)*p),g=3*F.BYTES_PER_ELEMENT,y=new S(F.buffer,W*g,g,(W+h)*g),b=new Float64Array(H.buffer,3*W*H.BYTES_PER_ELEMENT,3*h),_=new Float64Array(Y.buffer,1*W*Y.BYTES_PER_ELEMENT,1*h),E=this._getExtrusionSize(t);te(T,z,i,e,d.typedBuffer,b,y.typedBuffer,_,l,c,E,L,A),P(d,d,C),v(y,y,O),W+=6*n;const M=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:m,layerUid:this._context.layer.uid}),I=new Ee(d.typedBuffer,b,y.typedBuffer,_);f.push(ee(this._material,l,l.length-c.length,I,r,M)),f.push(ee(this._bottomMaterial,c,0,I,r,M))}if(0===f.length)return null;const Z=new J({geometries:f,metadata:{layerUid:this._context.layer.uid,graphicUid:m,isElevationSource:!0}});Z.transformation=y;const q=k(this.symbolLayer,{opacity:this._getLayerOpacity()}),K=s(q)?{baseMaterial:this._material,edgeMaterials:[q],properties:{mergeGeometries:!0,hasSlicePlane:this._context.slicePlaneEnabled}}:null,Q=new R(this,Z,f,null,null,de,i,K);return Q.alignedSampledElevation=d.sampledElevation,Q.needsElevationUpdates=I(i.mode),Q}}function ee(e,t,r,s,n,i){const o=new Array(t.length).fill(0),a=[[K.POSITION,new H(s.positions,3,!0)],[K.NORMAL,new H(s.normals,3,!0)],[K.COLOR,new H(n,4,!0)],[K.SIZE,new H(s.heights,1,!0)]],l=[[K.POSITION,t],[K.NORMAL,t],[K.COLOR,o]];return new Z(e,a,l,s.elevation,W.Mesh,i,r)}function te(e,t,r,s,n,i,o,a,l,c,h,m,p){const d=r.length/3;let g=0,f=2*s.count;re(e,t,s.index,s.count,r,0,d,n,i,o,a,l,c,f,h,m,p);let u=2*s.count;f=0,ie(n,i,a,o,g,s.pathLengths[0],s.count,u,l,f,h),u+=4*s.pathLengths[0],f+=2*s.pathLengths[0],g+=s.pathLengths[0];for(let y=1;y<s.pathLengths.length;++y)ie(n,i,a,o,g,s.pathLengths[y],s.count,u,l,f,h),u+=4*s.pathLengths[y],f+=2*s.pathLengths[y],g+=s.pathLengths[y]}function re(e,t,r,s,n,i,o,a,l,c,h,d,g,f,u,y,b){m(fe,y);const _=u>0?1:-1;let E=3*r,x=0,j=3*x,w=s,S=3*w;for(let m=0;m<s;++m)b&&(fe[0]=e[E+0],fe[1]=e[E+1],fe[2]=e[E+2],p(fe,fe)),a[j+0]=e[E+0],a[j+1]=e[E+1],a[j+2]=e[E+2],l[j+0]=t[E+0],l[j+1]=t[E+1],l[j+2]=t[E+2],c[j+0]=-_*fe[0],c[j+1]=-_*fe[1],c[j+2]=-_*fe[2],h[x]=0,a[S+0]=e[E+0]+u*fe[0],a[S+1]=e[E+1]+u*fe[1],a[S+2]=e[E+2]+u*fe[2],l[S+0]=t[E+0],l[S+1]=t[E+1],l[S+2]=t[E+2],c[S+0]=_*fe[0],c[S+1]=_*fe[1],c[S+2]=_*fe[2],h[w]=u,j+=3,S+=3,E+=3,x+=1,w+=1;E=3*i,j=0,S=3*f;const P=u<0?be:ye,v=u<0?ye:be;for(let m=0;m<o;++m)g[j+0]=n[E+P[0]],g[j+1]=n[E+P[1]],g[j+2]=n[E+P[2]],d[S+0]=n[E+v[0]]+s,d[S+1]=n[E+v[1]]+s,d[S+2]=n[E+v[2]]+s,j+=3,S+=3,E+=3}function se(e,t,r,s,n,i,o){s[i]=s[o],o*=3,e[(i*=3)+0]=e[o+0],e[i+1]=e[o+1],e[i+2]=e[o+2],t[i+0]=t[o+0],t[i+1]=t[o+1],t[i+2]=t[o+2],r[i+0]=n[0],r[i+1]=n[1],r[i+2]=n[2]}const ne=b();function ie(e,t,r,s,n,i,o,a,l,c,h){let m=n,p=n+1,d=n+o,g=n+o+1,f=a,u=a+1,y=a+2*i,b=a+2*i+1;h<0&&(m=n+o+1,g=n),c*=3;for(let _=0;_<i;++_)_===i-1&&(h>0?(p=n,g=n+o):(p=n,m=n+o)),me(e,m,p,d,ne),se(e,t,s,r,ne,f,m),se(e,t,s,r,ne,u,p),se(e,t,s,r,ne,y,d),se(e,t,s,r,ne,b,g),l[c++]=f,l[c++]=y,l[c++]=b,l[c++]=f,l[c++]=b,l[c++]=u,m++,p++,d++,g++,f+=2,u+=2,y+=2,b+=2}const oe=b(),ae=b(),le=b(),ce=b(),he=b();function me(e,t,r,s,n){t*=3,r*=3,s*=3,d(oe,e[t++],e[t++],e[t++]),d(ae,e[r++],e[r++],e[r++]),d(le,e[s++],e[s++],e[s++]),g(ce,ae,oe),g(he,le,oe),f(n,he,ce),p(n,n)}const pe=b();function de(e,t,r,n,i){const o=e.stageObject,a=o.geometries,l=a.length,m="absolute-height"!==t.mode;let p=0;const g=o.transformation,f=c(h(),g);for(let c=0;c<l;c+=2){const e=a[c];if(!q(e))continue;const t=e.getMutableAttribute(K.POSITION).data,l=e.vertexAttributes.get(K.SIZE).data,h=new F(e.mapPositions),y=t.length/3;let b=0,_=!1,E=0;for(let o=0;o<y;o++){pe[0]=t[b],pe[1]=t[b+1],pe[2]=t[b+2],n(h,ue),m&&(E+=ue.sampledElevation),N.TESTS_DISABLE_OPTIMIZATIONS?(d(ge,h.array[h.offset+0],h.array[h.offset+1],ue.z+l[b/3]),s(r)&&i.toRenderCoords(ge,r,ge),u(ge,ge,f)):(d(ge,t[b+0],t[b+1],t[b+2]),u(ge,ge,g),i.setAltitude(ge,ue.z+l[b/3]),u(ge,ge,f)),t[b]=ge[0],t[b+1]=ge[1],t[b+2]=ge[2];const e=_e/i.unitInMeters;(Math.abs(pe[0]-t[b])>=e||Math.abs(pe[1]-t[b+1])>=e||Math.abs(pe[2]-t[b+2])>=e)&&(_=!0),h.offset+=3,b+=3}_&&(e.invalidateBoundingInfo(),o.geometryVertexAttrsUpdated(a[c]),a[c+1].invalidateBoundingInfo(),o.geometryVertexAttrsUpdated(a[c+1])),p+=E/y}return p/l}const ge=b(),fe=b(),ue=new O,ye=[0,2,1],be=[0,1,2],_e=.01;class Ee{constructor(e,t,r,s){this.positions=e,this.elevation=t,this.normals=r,this.heights=s}}export{$ as Graphics3DExtrudeSymbolLayer};
|
|
5
|
+
import"../../../../core/has.js";import e from"../../../../core/Error.js";import{clone as t}from"../../../../core/lang.js";import{get as r,isSome as s,isNone as n}from"../../../../core/maybe.js";import{getMetersPerVerticalUnitForSR as i}from"../../../../core/unitUtils.js";import{e as o}from"../../../../chunks/earcut.js";import{b as a}from"../../../../chunks/mat3.js";import{c as l}from"../../../../chunks/mat3f64.js";import{a as c,x as h}from"../../../../chunks/mat4.js";import{c as m}from"../../../../chunks/mat4f64.js";import{c as p,n as d,s as g,b as f,f as u,m as y}from"../../../../chunks/vec3.js";import{d as b,c as _}from"../../../../chunks/vec3f64.js";import{computeTranslationToOriginAndRotation as E}from"../../../../geometry/projection.js";import{create as x,empty as j,expandWithBuffer as w,intersectsClippingArea as S}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f64 as P}from"../../../../geometry/support/buffer/BufferView.js";import{t as v,a as L}from"../../../../chunks/vec32.js";import{makeVertexCandidate as A,makeEdgeCandidate as C}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as M}from"../../../../renderers/support/renderingInfoUtils.js";import{ViewingMode as I}from"../../../ViewingMode.js";import{needsElevationUpdates3D as O,SampleElevationInfo as B}from"./elevationAlignmentUtils.js";import{ElevationContext as R}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as z}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as T}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as D,computeCentroid as G}from"./graphicUtils.js";import{ApplyRendererDiffResult as U}from"./interfaces.js";import{geometryAsPolygon as k}from"./polygonUtils.js";import{createMaterial as N}from"../support/edgeUtils.js";import F from"../../support/debugFlags.js";import{SamplePosition as V}from"../../support/ElevationProvider.js";import{geometryToRenderInfo as H}from"../../support/renderInfoUtils/polygon.js";import{Attribute as Y}from"../../webgl-engine/lib/Attribute.js";import{CullFaceOptions as W}from"../../webgl-engine/lib/basicInterfaces.js";import{ContentObjectType as Z}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as q}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as J}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{Object3D as K}from"../../webgl-engine/lib/Object3D.js";import{VertexAttribute as Q}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as X}from"../../webgl-engine/materials/DefaultMaterial.js";const $=["polygon","extent"];class ee extends T{constructor(e,t,r,s){super(e,t,r,s),this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=D(this._getSymbolSize());if(t)throw new e("graphics3dextrudesymbollayer:invalid-size",t)}const t=r(this.symbolLayer,"material","color"),s=this._getCombinedOpacityAndColor(t),n=b(s),i=s[3],o=i<1||this.needsDrivenTransparentPass,a={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,diffuse:n,ambient:n,opacity:i,transparent:o,cullFace:o?W.None:W.Back,hasVertexColors:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0};this._material=new X(a),this._bottomMaterial=new X({...a,cullFace:W.Back}),this._context.stage.add(this._material),this._context.stage.add(this._bottomMaterial)}destroy(){super.destroy(),this._material&&(this._context.stage.remove(this._material),this._context.stage.remove(this._bottomMaterial))}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,$,this.symbolLayer.type))return null;const r=this._getVertexOpacityAndColor(e.renderingInfo,255),s=this.setGraphicElevationContext(t,new R);return this._createAs3DShape(t,e.renderingInfo,r,s,t.uid)}layerOpacityChanged(e,t){const n=r(this.symbolLayer,"material","color"),i=this._getCombinedOpacity(n),o=i<1||this.needsDrivenTransparentPass;this._material.setParameters({opacity:i,transparent:o}),this._bottomMaterial.setParameters({opacity:i,transparent:o});const a=this._getLayerOpacity();e.forEach((e=>{const r=t(e);s(r)&&r.layerOpacityChanged(a,this._context.isAsync)}))}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,O)}slicePlaneEnabledChanged(e,t){return this._material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._bottomMaterial.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),e.forEach((e=>{const r=t(e);s(r)&&r.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)})),!0}physicalBasedRenderingChanged(){return this._material.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),this._bottomMaterial.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}pixelRatioChanged(){return!0}_getExtrusionSize(e){let t;return t=e.size&&this._drivenProperties.size?M(e.size,2)??0:this._getSymbolSize(),t/=this._context.renderCoordsHelper.unitInMeters,t}applyRendererDiff(e,t){return this._drivenPropertiesChanged(t)?U.Recreate_Symbol:U.Recreate_Graphics}async queryForSnapping(e,r,s,n){const o=this._getExtrusionSize(s)*this._context.renderCoordsHelper.unitInMeters/i(r),{objectId:a,target:l}=e,c=t(l);switch(c.z=(c.z??0)+o,e.type){case"edge":{const{start:r,end:s}=e,n=t(r),i=t(s);return n.z=(n.z??0)+o,i.z=(i.z??0)+o,[C(a,c,1/0,n,i)]}case"vertex":return[A(a,c,1/0),C(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(e,t,r,i,h){const p=k(e.geometry);if(n(p))return null;if(0===p.rings.length||!p.rings.some((e=>e.length>0)))return this._logGeometryValidationWarnings(p.rings,"rings","ExtrudeSymbol3DLayer"),null;const d=H(p,this._context.elevationProvider,this._context.renderCoordsHelper,i);this._logGeometryCreationWarnings(d,p.rings,"rings","ExtrudeSymbol3DLayer");const g=G(p);if(n(g))return null;const f=new Array,u=x(),y=m(),b=_(),A=this._context.renderCoordsHelper.viewingMode===I.Global;A||this._context.renderCoordsHelper.worldUpAtPosition(null,b),E(p.spatialReference,[g.x,g.y,0],y,this._context.renderCoordsHelper.spatialReference);const C=m();c(C,y);const M=l();a(M,C);const{polygons:B,mapPositions:R,position:T}=d,D=T.length/3,U=new Float64Array(3*D*6),F=new Float64Array(3*D*6),V=new Float64Array(3*D*6),Y=new Float64Array(1*D*6);let W=0;for(let s=0;s<B.length;++s){const e=B[s],n=e.count;if(this._context.clippingExtent&&(j(u),w(u,e.mapPositions),!S(u,this._context.clippingExtent)))continue;const i=o(e.mapPositions,e.holeIndices,3);if(0===i.length)continue;const a=3*n*2+i.length,l=new Array(a),c=new Array(i.length),m=6*n,p=3*U.BYTES_PER_ELEMENT,d=new P(U.buffer,W*p,p,(W+m)*p),g=3*F.BYTES_PER_ELEMENT,y=new P(F.buffer,W*g,g,(W+m)*g),_=new Float64Array(V.buffer,3*W*V.BYTES_PER_ELEMENT,3*m),E=new Float64Array(Y.buffer,1*W*Y.BYTES_PER_ELEMENT,1*m),x=this._getExtrusionSize(t);re(T,R,i,e,d.typedBuffer,_,y.typedBuffer,E,l,c,x,b,A),v(d,d,C),L(y,y,M),W+=6*n;const I=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:h,layerUid:this._context.layer.uid}),O=new xe(d.typedBuffer,_,y.typedBuffer,E);f.push(te(this._material,l,l.length-c.length,O,r,I)),f.push(te(this._bottomMaterial,c,0,O,r,I))}if(0===f.length)return null;const Z=new K({geometries:f,metadata:{layerUid:this._context.layer.uid,graphicUid:h,isElevationSource:!0}});Z.transformation=y;const q=N(this.symbolLayer,{opacity:this._getLayerOpacity()}),J=s(q)?{baseMaterial:this._material,edgeMaterials:[q],properties:{mergeGeometries:!0,hasSlicePlane:this._context.slicePlaneEnabled}}:null,Q=new z(this,Z,f,null,null,ge,i,J);return Q.alignedSampledElevation=d.sampledElevation,Q.needsElevationUpdates=O(i.mode),Q}}function te(e,t,r,s,n,i){const o=new Array(t.length).fill(0),a=[[Q.POSITION,new Y(s.positions,3,!0)],[Q.NORMAL,new Y(s.normals,3,!0)],[Q.COLOR,new Y(n,4,!0)],[Q.SIZE,new Y(s.heights,1,!0)]],l=[[Q.POSITION,t],[Q.NORMAL,t],[Q.COLOR,o]];return new q(e,a,l,s.elevation,Z.Mesh,i,r)}function re(e,t,r,s,n,i,o,a,l,c,h,m,p){const d=r.length/3;let g=0,f=2*s.count;se(e,t,s.index,s.count,r,0,d,n,i,o,a,l,c,f,h,m,p);let u=2*s.count;f=0,oe(n,i,a,o,g,s.pathLengths[0],s.count,u,l,f,h),u+=4*s.pathLengths[0],f+=2*s.pathLengths[0],g+=s.pathLengths[0];for(let y=1;y<s.pathLengths.length;++y)oe(n,i,a,o,g,s.pathLengths[y],s.count,u,l,f,h),u+=4*s.pathLengths[y],f+=2*s.pathLengths[y],g+=s.pathLengths[y]}function se(e,t,r,s,n,i,o,a,l,c,h,m,g,f,u,y,b){p(ue,y);const _=u>0?1:-1;let E=3*r,x=0,j=3*x,w=s,S=3*w;for(let p=0;p<s;++p)b&&(ue[0]=e[E+0],ue[1]=e[E+1],ue[2]=e[E+2],d(ue,ue)),a[j+0]=e[E+0],a[j+1]=e[E+1],a[j+2]=e[E+2],l[j+0]=t[E+0],l[j+1]=t[E+1],l[j+2]=t[E+2],c[j+0]=-_*ue[0],c[j+1]=-_*ue[1],c[j+2]=-_*ue[2],h[x]=0,a[S+0]=e[E+0]+u*ue[0],a[S+1]=e[E+1]+u*ue[1],a[S+2]=e[E+2]+u*ue[2],l[S+0]=t[E+0],l[S+1]=t[E+1],l[S+2]=t[E+2],c[S+0]=_*ue[0],c[S+1]=_*ue[1],c[S+2]=_*ue[2],h[w]=u,j+=3,S+=3,E+=3,x+=1,w+=1;E=3*i,j=0,S=3*f;const P=u<0?_e:be,v=u<0?be:_e;for(let p=0;p<o;++p)g[j+0]=n[E+P[0]],g[j+1]=n[E+P[1]],g[j+2]=n[E+P[2]],m[S+0]=n[E+v[0]]+s,m[S+1]=n[E+v[1]]+s,m[S+2]=n[E+v[2]]+s,j+=3,S+=3,E+=3}function ne(e,t,r,s,n,i,o){s[i]=s[o],o*=3,e[(i*=3)+0]=e[o+0],e[i+1]=e[o+1],e[i+2]=e[o+2],t[i+0]=t[o+0],t[i+1]=t[o+1],t[i+2]=t[o+2],r[i+0]=n[0],r[i+1]=n[1],r[i+2]=n[2]}const ie=_();function oe(e,t,r,s,n,i,o,a,l,c,h){let m=n,p=n+1,d=n+o,g=n+o+1,f=a,u=a+1,y=a+2*i,b=a+2*i+1;h<0&&(m=n+o+1,g=n),c*=3;for(let _=0;_<i;++_)_===i-1&&(h>0?(p=n,g=n+o):(p=n,m=n+o)),pe(e,m,p,d,ie),ne(e,t,s,r,ie,f,m),ne(e,t,s,r,ie,u,p),ne(e,t,s,r,ie,y,d),ne(e,t,s,r,ie,b,g),l[c++]=f,l[c++]=y,l[c++]=b,l[c++]=f,l[c++]=b,l[c++]=u,m++,p++,d++,g++,f+=2,u+=2,y+=2,b+=2}const ae=_(),le=_(),ce=_(),he=_(),me=_();function pe(e,t,r,s,n){t*=3,r*=3,s*=3,g(ae,e[t++],e[t++],e[t++]),g(le,e[r++],e[r++],e[r++]),g(ce,e[s++],e[s++],e[s++]),f(he,le,ae),f(me,ce,ae),u(n,me,he),d(n,n)}const de=_();function ge(e,t,r,n,i){const o=e.stageObject,a=o.geometries,l=a.length,c="absolute-height"!==t.mode;let p=0;const d=o.transformation,f=h(m(),d);for(let h=0;h<l;h+=2){const e=a[h];if(!J(e))continue;const t=e.getMutableAttribute(Q.POSITION).data,l=e.vertexAttributes.get(Q.SIZE).data,m=new V(e.mapPositions),u=t.length/3;let b=0,_=!1,E=0;for(let o=0;o<u;o++){de[0]=t[b],de[1]=t[b+1],de[2]=t[b+2],n(m,ye),c&&(E+=ye.sampledElevation),F.TESTS_DISABLE_OPTIMIZATIONS?(g(fe,m.array[m.offset+0],m.array[m.offset+1],ye.z+l[b/3]),s(r)&&i.toRenderCoords(fe,r,fe),y(fe,fe,f)):(g(fe,t[b+0],t[b+1],t[b+2]),y(fe,fe,d),i.setAltitude(fe,ye.z+l[b/3]),y(fe,fe,f)),t[b]=fe[0],t[b+1]=fe[1],t[b+2]=fe[2];const e=Ee/i.unitInMeters;(Math.abs(de[0]-t[b])>=e||Math.abs(de[1]-t[b+1])>=e||Math.abs(de[2]-t[b+2])>=e)&&(_=!0),m.offset+=3,b+=3}_&&(e.invalidateBoundingInfo(),o.geometryVertexAttrsUpdated(a[h]),a[h+1].invalidateBoundingInfo(),o.geometryVertexAttrsUpdated(a[h+1])),p+=E/u}return p/l}const fe=_(),ue=_(),ye=new B,be=[0,2,1],_e=[0,1,2],Ee=.01;class xe{constructor(e,t,r,s){this.positions=e,this.elevation=t,this.normals=r,this.heights=s}}export{ee as Graphics3DExtrudeSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Accessor.js";import r from"../../../../core/Evented.js";import{isSome as o,isNone as s}from"../../../../core/maybe.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{projectPoint as c}from"../../../../geometry/projection.js";import{getObjectId as p}from"../../../../layers/graphics/dehydratedFeatures.js";import{OptimizedFeature as n}from"../../../../layers/graphics/OptimizedFeature.js";import h from"../../../../layers/graphics/OptimizedGeometry.js";import{optimizedFeatureQueryEngineAdapter as d}from"../../../../layers/graphics/data/optimizedFeatureQueryEngineAdapter.js";let u=class extends e{constructor(t){super(t),this.events=new r,this.hasZ=null,this.hasM=null,this.objectIdField=null,this.featureAdapter={getAttribute:(t,e)=>"graphic"in t?t.graphic.attributes[e]:d.getAttribute(t,e),getAttributes:t=>"graphic"in t?t.graphic.attributes:d.getAttributes(t),getObjectId:t=>"graphic"in t?p(t.graphic,this.objectIdField):d.getObjectId(t),getGeometry:t=>"graphic"in t?t.getAsOptimizedGeometry(this.hasZ,this.hasM):d.getGeometry(t),getCentroid:(t,e)=>{if("graphic"in t){let r=null;o(t.centroid)?r=t.centroid:"point"===t.graphic.geometry.type&&c(t.graphic.geometry,l,this.viewSpatialReference)&&(r=l);const i=new Array(2+(e.hasZ?1:0)+(e.hasM?1:0));return s(r)?(i[0]=0,i[1]=0,i[2]=0,i[3]=0):(i[0]=r.x,i[1]=r.y,e.hasZ&&(i[2]=r.hasZ?r.z:0),e.hasM&&(i[e.hasZ?3:2]=r.hasM?r.m:0)),new h([],i)}return d.getCentroid(t,e)},cloneWithGeometry:(t,e)=>"graphic"in t?new n(e,this.featureAdapter.getAttributes(t),null,this.featureAdapter.getObjectId(t)):d.cloneWithGeometry(t,e)}}forEachInBounds(t,e){this.getSpatialIndex().forEachInBounds(t,e)}forEachBounds(t,e,r){const s=this.getSpatialIndex();for(const i of t){const t=this.featureAdapter.getObjectId(i);o(s.getBounds(t,r))&&e(r)}}};t([i({constructOnly:!0})],u.prototype,"getSpatialIndex",void 0),t([i({constructOnly:!0})],u.prototype,"forEach",void 0),t([i({constructOnly:!0})],u.prototype,"hasZ",void 0),t([i({constructOnly:!0})],u.prototype,"hasM",void 0),t([i({constructOnly:!0})],u.prototype,"objectIdField",void 0),t([i({constructOnly:!0})],u.prototype,"viewSpatialReference",void 0),t([i({constructOnly:!0})],u.prototype,"featureSpatialReference",void 0),u=t([a("esri.views.3d.layers.graphics.Graphics3DFeatureStore")],u);const l={type:"point",x:0,y:0,hasZ:!1,hasM:!1,spatialReference:null};export{u as Graphics3DFeatureStore};
|
|
5
|
+
import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Accessor.js";import r from"../../../../core/Evented.js";import{isSome as o,isNone as s}from"../../../../core/maybe.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{projectPoint as c}from"../../../../geometry/projection.js";import{getObjectId as p}from"../../../../layers/graphics/dehydratedFeatures.js";import{OptimizedFeature as n}from"../../../../layers/graphics/OptimizedFeature.js";import h from"../../../../layers/graphics/OptimizedGeometry.js";import{optimizedFeatureQueryEngineAdapter as d}from"../../../../layers/graphics/data/optimizedFeatureQueryEngineAdapter.js";let u=class extends e{constructor(t){super(t),this.events=new r,this.hasZ=null,this.hasM=null,this.objectIdField=null,this.featureAdapter={getAttribute:(t,e)=>"graphic"in t?t.graphic.attributes[e]:d.getAttribute(t,e),getAttributes:t=>"graphic"in t?t.graphic.attributes:d.getAttributes(t),getObjectId:t=>"graphic"in t?p(t.graphic,this.objectIdField)??void 0:d.getObjectId(t),getGeometry:t=>"graphic"in t?t.getAsOptimizedGeometry(this.hasZ,this.hasM):d.getGeometry(t),getCentroid:(t,e)=>{if("graphic"in t){let r=null;o(t.centroid)?r=t.centroid:"point"===t.graphic.geometry.type&&c(t.graphic.geometry,l,this.viewSpatialReference)&&(r=l);const i=new Array(2+(e.hasZ?1:0)+(e.hasM?1:0));return s(r)?(i[0]=0,i[1]=0,i[2]=0,i[3]=0):(i[0]=r.x,i[1]=r.y,e.hasZ&&(i[2]=r.hasZ?r.z:0),e.hasM&&(i[e.hasZ?3:2]=r.hasM?r.m:0)),new h([],i)}return d.getCentroid(t,e)},cloneWithGeometry:(t,e)=>"graphic"in t?new n(e,this.featureAdapter.getAttributes(t),null,this.featureAdapter.getObjectId(t)):d.cloneWithGeometry(t,e)}}forEachInBounds(t,e){this.getSpatialIndex().forEachInBounds(t,e)}forEachBounds(t,e,r){const s=this.getSpatialIndex();for(const i of t){const t=this.featureAdapter.getObjectId(i);o(s.getBounds(t,r))&&e(r)}}};t([i({constructOnly:!0})],u.prototype,"getSpatialIndex",void 0),t([i({constructOnly:!0})],u.prototype,"forEach",void 0),t([i({constructOnly:!0})],u.prototype,"hasZ",void 0),t([i({constructOnly:!0})],u.prototype,"hasM",void 0),t([i({constructOnly:!0})],u.prototype,"objectIdField",void 0),t([i({constructOnly:!0})],u.prototype,"viewSpatialReference",void 0),t([i({constructOnly:!0})],u.prototype,"featureSpatialReference",void 0),u=t([a("esri.views.3d.layers.graphics.Graphics3DFeatureStore")],u);const l={type:"point",x:0,y:0,hasZ:!1,hasM:!1,spatialReference:null};export{u as Graphics3DFeatureStore};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import s from"../../../../core/Handles.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as r,sync as n,initial as o}from"../../../../core/reactiveUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{getReferenceEllipsoid as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import s from"../../../../core/Handles.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as r,sync as n,initial as o}from"../../../../core/reactiveUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as c}from"../../../../core/accessorSupport/decorators/subclass.js";import{getReferenceEllipsoid as h}from"../../../../geometry/projectionEllipsoid.js";import{FrustumExtentIntersection as p}from"../../support/FrustumExtentIntersection.js";import{TaskPriority as l,Task as u}from"../../../support/Scheduler.js";const d=1.2;let _=class extends t{constructor(e){super(e),this.suspended=!1,this._extent=null,this._extentIntersectionDirty=!0,this._isVisibleBelowSurfaceInternal=!1,this._handles=new s,this.graphicsCoreOwner=null,this.updating=!0}initialize(){const{graphicsCoreOwner:e}=this;this._extentIntersection=new p({renderCoordsHelper:e.view.renderCoordsHelper});const t=e.view,s=t.basemapTerrain,i=t.resourceController.scheduler;this._handles.add([t.on("resize",(()=>this._viewChange())),r((()=>t.state.camera),(()=>this._viewChange()),n),i.registerTask(l.FRUSTUM_VISIBILITY,this),r((()=>s.visibleElevationBounds),(()=>this._elevationBoundsChange()))]),"local"===t.viewingMode?this._isVisibleBelowSurface=!0:this._handles.add([r((()=>[s.baseOpacity,s.wireframe,t.map?.ground?.navigationConstraint?.type]),(()=>this._updateIsVisibleBelowSurface()),o)])}destroy(){this._set("graphicsCoreOwner",null),this._extent=null,this._extentIntersection=null,this._handles=i(this._handles)}_setDirty(){this.updating||this._set("updating",!0)}setExtent(e){this._extent=e,this._extentIntersectionDirty=!0,this._setDirty()}_viewChange(){this._setDirty()}_elevationBoundsChange(){this._setDirty(),this._extentIntersectionDirty=!0}set _isVisibleBelowSurface(e){this._isVisibleBelowSurfaceInternal=e,this._setDirty(),this._extentIntersectionDirty=!0}_updateIsVisibleBelowSurface(){const e=this.graphicsCoreOwner.view,t=e.basemapTerrain,s="local"===e.viewingMode,i="none"===e.map.ground?.navigationConstraint?.type;this._isVisibleBelowSurface=s||!t.opaque||i}_updateExtentIntersection(){if(!this._extentIntersectionDirty)return;this._extentIntersectionDirty=!1;const e=this.graphicsCoreOwner.view;let t;if(this._isVisibleBelowSurfaceInternal)t=-.3*h(e.spatialReference).radius;else{const{min:s,max:i}=e.basemapTerrain.visibleElevationBounds;t=s-Math.max(1,(i-s)*(d-1))}this._extentIntersection.update(this._extent,e.spatialReference,t)}get running(){return this.updating}runTask(e){if(this._set("updating",!1),!this._extent)return this._set("suspended",!1),u.YIELD;this._updateExtentIntersection();const t=this.graphicsCoreOwner.view.frustum,s=h(this.graphicsCoreOwner.view.spatialReference).radius;this._set("suspended",!this._extentIntersection.isVisibleInFrustum(t,s)),e.madeProgress()}};e([a({readOnly:!0})],_.prototype,"suspended",void 0),e([a({constructOnly:!0})],_.prototype,"graphicsCoreOwner",void 0),e([a({readOnly:!0})],_.prototype,"updating",void 0),_=e([c("esri.views.3d.layers.graphics.Graphics3DFrustumVisibility")],_);const m=_;export{m as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import"../../../../symbols.js";import{result as t}from"../../../../core/asyncUtils.js";import r from"../../../../core/Error.js";import{isSome as i,get as s,isNone as a,unwrapOr as o,releaseMaybe as n,unwrap as l}from"../../../../core/maybe.js";import{throwIfAbortError as c,throwIfAborted as h}from"../../../../core/promiseUtils.js";import{pt2px as m,px2pt as u}from"../../../../core/screenUtils.js";import{dataComponents as d}from"../../../../core/urlUtils.js";import{c as _}from"../../../../chunks/mat4f64.js";import{f as p,a as f}from"../../../../chunks/vec2f64.js";import{Z as y,O as g,f as x}from"../../../../chunks/vec3f64.js";import{c as S}from"../../../../chunks/vec4.js";import{f as b,c as z}from"../../../../chunks/vec4f64.js";import{projectPointToVector as v}from"../../../../geometry/projection.js";import{containsPoint as P}from"../../../../geometry/support/aaBoundingBox.js";import{createRendererExpression as R}from"../../../../support/arcadeOnDemand.js";import{defaultPrimitive as C}from"../../../../symbols/support/IconSymbol3DLayerResource.js";import{getIconHref as M}from"../../../../symbols/support/utils.js";import j from"../../../2d/arcade/callExpressionWithFeature.js";import{TRANSPARENT_UNIT as I}from"./constants.js";import{perObjectElevationAligner as w}from"./ElevationAligners.js";import{SymbolUpdateType as O,elevationModeChangeUpdateType as T,needsElevationUpdates2D as E}from"./elevationAlignmentUtils.js";import{ElevationContext as U}from"./ElevationContext.js";import L from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as D}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as F}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as A}from"./graphicUtils.js";import{ApplyRendererDiffResult as G}from"./interfaces.js";import{namedAnchorToHUDMaterialAnchorPos as V}from"./placementUtils.js";import{placePointOnGeometry as B,createStageObject as N,extendPointGraphicElevationContext as k}from"./pointUtils.js";import{initFastSymbolUpdatesState as q,updateFastSymbolUpdatesState as H,evaluateModelTransform as W}from"../support/FastSymbolUpdates.js";import{createTexture as $,DEFAULT_SYMBOL_SIZE_RATIO as Z,DEFAULT_TEX_SIZE as J}from"../../support/engineContent/sdfPrimitives.js";import{DRAPED_Z as K}from"../../terrain/OverlayRenderer.js";import{PowerOfTwoResizeMode as Q}from"../../webgl-engine/lib/basicInterfaces.js";import{createPointGeometry as X}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as Y}from"../../webgl-engine/lib/RenderGeometry.js";import{Texture as ee}from"../../webgl-engine/lib/Texture.js";import{HUDMaterial as te}from"../../webgl-engine/materials/HUDMaterial.js";import re from"../../../../symbols/CIMSymbol.js";const ie=_(),se=x(0,0,1),ae=16,oe=1.5,ne=Z,le=[ne/2,ne/2,1-ne/2,1-ne/2],ce=[J*ne,J*ne];class he extends F{getCachedSize(){return{size:this._getIconSize()}}constructor(e,t,r,i){super(e,t,r,i),this._cimLayers=null,this._cimSymbolMaterials=new Map,this._cimSymbolTextures=new Map,this._cimMaterialParametersInfo=null,this._cimRequiredFields=null,this._cimScaleFactorOrFunction=null,this._size=null,this._symbolTextureRatio=1,this._outlineSize=0,this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!0}}async doLoad(e){this._validateOrThrow();const t=this._prepareMaterialParameters(),r=this._getPrimitive();if(i(r))this._prepareResourcesPrimitive(t,r);else{const r=M(this.symbolLayer),i=d(r);i&&"application/json"===i.mediaType?await this._prepareResourcesCIM(t,JSON.parse(i.data),e):await this._prepareResourcesHref(t,r,e)}}_validateOrThrow(){if(this._drivenProperties.size)return;const e=A(this._getIconSize());if(e)throw new r("graphics3diconsymbollayer:invalid-size",e)}_getIconSize(){const e=this.symbolLayer,t=Math.round(null!=e.size?m(e.size):ae);return this._drivenProperties.size?Math.max(t,64):t}_generateTextureCIM(e){const t=this._getGraphicHash(e);let r=""===t?null:this._cimSymbolTextures.get(t);if(!r){const i={scaleFactor:this._cimScaleFactorOrFunction},s=this._context.sharedResources.cimSymbolRasterizer.rasterizeCIMSymbol3D(this._cimLayers,e,"esriGeometryPoint",i,null,null);this._cimMaterialParametersInfo.anchorPosition=this._getAnchorPos("relative",s.anchorPosition);const a={width:s.imageData.width,height:s.imageData.height,powerOfTwoResizeMode:Q.PAD};r=new ee(s.imageData,a),this._cimSymbolTextures.set(t,r),this._context.stage.add(r)}return r}_computeSize(e,t){const r=e.width/e.height;return r>1?[t,Math.round(t/r)]:[Math.round(t*r),t]}_prepareMaterialParameters(){const e={anchorPosition:this._getAnchorPos(this.symbolLayer.anchor,this.symbolLayer.anchorPosition)},t=this.symbol;if(me(t)){const{screenLength:r,minWorldLength:s,maxWorldLength:a}=t.verticalOffset;e.verticalOffset={screenLength:m(r),minWorldLength:s||0,maxWorldLength:i(a)?a:1/0}}return this._context.screenSizePerspectiveEnabled&&(e.screenSizePerspective=this._context.sharedResources.screenSizePerspectiveSettings),e.occlusionTest=!0,e.hasSlicePlane=this._context.slicePlaneEnabled,e}_prepareResourcesPrimitive(e,t){const r=this._getOutlineSize();if(ue(t)&&0===r)throw new Error("Nothing to render");if(this._outlineSize=r,e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,i(this._context.sharedResources.textures)){const r=this._context.sharedResources.textures.fromData(`${t}-icon`,(()=>$(t)));this._texture=r.texture,this._releaseTexture=r,e.textureId=this._texture.id}e.textureIsSignedDistanceField=!0,e.distanceFieldBoundingBox=le;const s=this._getIconSize();this._size=[s,s],this._symbolTextureRatio=1/ne,this._createMaterialAndAddToStage(e,this._context.stage)}async _prepareResourcesHref(e,s,a){this._outlineSize=this._getOutlineSize(),e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,e.textureIsSignedDistanceField=!1;const o=this._getIconSize(),n=o*this._context.graphicsCoreOwner.view.state.pixelRatio;if(i(this._context.sharedResources.textures)){const i=await t(this._context.sharedResources.textures.fromUrl(s,n,{signal:a}));if(!1===i.ok){c(i.error);throw new r("graphics3diconsymbollayer:request-failed",`Failed to load (Request for icon resource failed: ${s})`)}this._releaseTexture=i.value;const l=i.value.texture,h=l.params;this._size=this._computeSize(h,o),e.textureId=l.id}this._createMaterialAndAddToStage(e,this._context.stage)}async _prepareResourcesCIM(e,t,r){const i=new re({data:t});if(!this._context.sharedResources.cimSymbolRasterizer){const e=(await import("../../../../symbols/cim/CIMSymbolRasterizer.js")).CIMSymbolRasterizer;h(r),this._context.sharedResources.cimSymbolRasterizer||(this._context.sharedResources.cimSymbolRasterizer=new e(this._context.renderCoordsHelper.spatialReference,!0))}const s=this._context.layer.fields?this._context.layer.fields.map((e=>e.toJSON())):null;let a,o;if(this._cimLayers=await this._context.sharedResources.cimSymbolRasterizer.analyzeCIMSymbol(i,s,this._context.renderer&&"dictionary"===this._context.renderer.type?this._context.renderer.fieldMap:null,"esriGeometryPoint",{signal:r}),this._context.renderer&&"dictionary"===this._context.renderer.type&&this._context.renderer.scaleExpression){const e=this._context.renderer;if(isNaN(e.scaleExpression)){const t=e.scaleExpression,r=await R(t,this._context.layer.spatialReference,s);o=(e,t,i)=>{const s=j(r,e,{$view:i},"esriGeometryPoint",t);return null!==s?s:1}}else a=Number(e.scaleExpression)}this._cimScaleFactorOrFunction=a||o||1;const n=this._context.renderer?await this._context.renderer.getRequiredFields(this._context.layer.fieldsIndex):[];h(r);const l=this._context.layer.fieldsIndex;this._cimRequiredFields=n.map((e=>l.get(e).name)),this._cimMaterialParametersInfo=e,this._cimMaterialParametersInfo.color=this._getFillColor(),this._cimMaterialParametersInfo.outlineColor=[0,0,0,0],this._cimMaterialParametersInfo.outlineSize=0,this._cimMaterialParametersInfo.textureIsSignedDistanceField=!1}_getPrimitive(){return this.symbolLayer.resource&&this.symbolLayer.resource.href?null:this.symbolLayer.resource&&this.symbolLayer.resource.primitive||C}_getOutlineSize(){let e=0;const t=this.symbolLayer;if(i(t.outline)&&null!=t.outline.size)return Math.max(m(t.outline.size),0);return e=ue(this._getPrimitive())?oe:0,Math.max(e,0)}_getOutlineColor(){const t=this._getLayerOpacity(),r=this.symbolLayer,a=s(r,"outline","color");if(i(a)){const r=e.toUnitRGB(a),i=a.a*t;return[r[0],r[1],r[2],i]}return[0,0,0,0]}_getFillColor(){if(ue(this._getPrimitive()))return I;const e=a(this._getPrimitive()),t=s(this.symbolLayer,"material","color");return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}_getAnchorPos(e,t){return"relative"===e?p((t.x||0)+.5,.5-(t.y||0)):e in V?V[e]:V.center}_createMaterialAndAddToStage(e,t){if(this._cimLayers?this._fastUpdates={enabled:!1}:this._fastUpdates=q(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastUpdates.enabled&&Object.assign(e,this._fastUpdates.materialParameters),this._cimLayers){let r=i(e.textureId)?this._cimSymbolMaterials.get(e.textureId):null;return r||(r=new te(e),this._cimSymbolMaterials.set(o(e.textureId,0),r),t.add(r)),r}return this._material=new te(e),t.add(this._material),this._material}_setDrapingDependentMaterialParameters(){this.draped&&(this._forEachMaterial((e=>{e.setParameters({verticalOffset:null,screenSizePerspective:null,occlusionTest:!1,hasSlicePlane:!1,shaderPolygonOffset:0,isDraped:this.draped})})),this.layerOpacityChanged())}destroy(){super.destroy(),this._forEachMaterial((e=>this._context.stage.remove(e))),this._material=null,this._cimSymbolMaterials.clear(),this._cimSymbolTextures.forEach((e=>this._context.stage.remove(e))),this._cimSymbolTextures.clear(),this._releaseTexture=n(this._releaseTexture)}_getScaleFactor(e,t){if(this._drivenProperties.size&&e.size){for(let t=0;t<3;t++){const r=e.size[t];r&&"symbol-value"!==r&&"proportional"!==r&&(e.size[t]=m(r))}if("symbol-value"===e.size[0])return 1;if(isFinite(+e.size[0]))return+e.size[0]/t;if(isFinite(+e.size[2]))return+e.size[2]/t}return 1}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;let r,i;if(this._cimLayers){if(!this._cimLayers.length)return null;const e=this._generateTextureCIM(t),s={textureId:e.id,...this._cimMaterialParametersInfo};i=this._createMaterialAndAddToStage(s,this._context.stage),r=[e.params.width,e.params.height]}else r=this._size,i=l(this._material);const s=B(t.geometry);if(a(s))return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const o=e.renderingInfo,n=this._getVertexOpacityAndColor(o);let c=1;if(!this._fastUpdates.enabled||!this._fastUpdates.visualVariables.size){const e=r[0]>r[1]?r[0]:r[1];c=this._getScaleFactor(o,e)}c*=this._symbolTextureRatio;const h=p(r[0]*c,r[1]*c),m=this.setGraphicElevationContext(t,new U);return this.ensureDrapedStatus("on-the-ground"===m.mode)&&this._setDrapingDependentMaterialParameters(),this.draped?this._createAsOverlay(t,s,i,n,h,e.layer.uid):this._createAs3DShape(t,s,i,n,h,m,t.uid)}layerOpacityChanged(){const e=this._getFillColor(),t=this._getOutlineColor();this._forEachMaterial((r=>{r.setParameters({color:e}),r.setParameters({outlineColor:t})}))}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=T(he.elevationModeChangeTypes,r,i);if(s!==O.UPDATE)return s;const a=E(i)||"absolute-height"===i;return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>a))}slicePlaneEnabledChanged(){return this.draped||this._forEachMaterial((e=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),!0}physicalBasedRenderingChanged(){return!0}pixelRatioChanged(){return!!this._getPrimitive()}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return G.Recreate_Symbol;if(!H(this._fastUpdates,t,this._fastVisualVariableConvertOptions()))return G.Recreate_Symbol;i(this._material)&&this._material.setParameters(this._fastUpdates.materialParameters)}return G.Fast_Update}_defaultElevationInfoNoZ(){return de}_createAs3DShape(e,t,r,i,s,o,n){const l=this.getFastUpdateAttrValues(e),c=l?e=>W(this._fastUpdates.materialParameters,l,e):null,h=this._context.layer.uid,m=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:n,layerUid:h}),u=X(r,se,null,i,s,_e,null,l,m),d=N(this._context,t,u,o,n,c);if(a(d))return null;const _=new D(this,d.object,[u],null,null,w,o);return _.alignedSampledElevation=d.sampledElevation,_.needsElevationUpdates=E(o.mode)||"absolute-height"===o.mode,_.getScreenSize=this._createScreenSizeGetter(s,c),_.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(_.getScreenSize(),1,e),k(_,t,this._context.elevationProvider),_}_createAsOverlay(e,t,r,s,a,o){r.renderPriority=this._renderPriority;const n=z();v(t,n,this._context.overlaySR),n[2]=K;const l=this._context.clippingExtent;if(i(l)&&!P(l,n))return null;const c=this.getFastUpdateAttrValues(e),h=c?e=>W(this._fastUpdates.materialParameters,c,e):null,m=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:e.uid,layerUid:this._context.layer.uid}),u=X(r,se,n,s,a,null,null,c,m),d=new Y(u,{layerUid:o,graphicUid:e.uid,shaderTransformer:h});n[3]=0,S(d.boundingSphere,n);const _=new L(this,[d],null,this._context.drapeSourceRenderer);return _.getScreenSize=this._createScreenSizeGetter(a,h),_.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(_.getScreenSize(),1,e),_}_createScreenSizeGetter(e,t){const r=this._outlineSize+2;if(this._fastUpdates.enabled){const i=e[0]/this._symbolTextureRatio,s=e[1]/this._symbolTextureRatio;return(e=f())=>{const a=t(ie);return e[0]=a[0]*i+r,e[1]=a[5]*s+r,e}}{const t=e[0]/this._symbolTextureRatio+r,i=e[1]/this._symbolTextureRatio+r;return(e=f())=>(e[0]=t,e[1]=i,e)}}_fastVisualVariableConvertOptions(){const e=this._size[0]>this._size[1]?this._size[0]:this._size[1],t=x(e,e,e),r=u(1),i=e*r;return{modelSize:t,symbolSize:x(i,i,i),unitInMeters:r,transformation:{anchor:y,scale:g,rotation:y}}}_getGraphicHash(e){let t="";for(const r of this._cimRequiredFields)t+=r+e.attributes[r];return t}_forEachMaterial(e){i(this._material)&&e(this._material),this._cimSymbolMaterials.forEach(e)}test(){return{...super.test(),material:this._material}}}function me(e){return e&&"point-3d"===e.type&&e.hasVisibleVerticalOffset()}function ue(e){return!a(e)&&("cross"===e||"x"===e)}he.PRIMITIVE_SIZE=ce,he.elevationModeChangeTypes={definedChanged:O.UPDATE,staysOnTheGround:O.NONE,onTheGroundChanged:O.RECREATE};const de={mode:"relative-to-ground",offset:0},_e=b(0,0,0,1);export{he as Graphics3DIconSymbolLayer};
|
|
5
|
+
import e from"../../../../Color.js";import"../../../../symbols.js";import{result as t}from"../../../../core/asyncUtils.js";import i from"../../../../core/Error.js";import{isSome as r,get as s,isNone as a,unwrapOr as o,releaseMaybe as n,unwrap as l}from"../../../../core/maybe.js";import{throwIfAbortError as c,throwIfAborted as h}from"../../../../core/promiseUtils.js";import{pt2px as m,px2pt as u}from"../../../../core/screenUtils.js";import{dataComponents as d}from"../../../../core/urlUtils.js";import{c as _}from"../../../../chunks/mat4f64.js";import{f as p,a as f}from"../../../../chunks/vec2f64.js";import{Z as y,O as g,f as x}from"../../../../chunks/vec3f64.js";import{c as S}from"../../../../chunks/vec4.js";import{f as b,c as v}from"../../../../chunks/vec4f64.js";import{projectPointToVector as z}from"../../../../geometry/projection.js";import{containsPoint as P}from"../../../../geometry/support/aaBoundingBox.js";import{createRendererExpression as R}from"../../../../support/arcadeOnDemand.js";import{defaultPrimitive as C}from"../../../../symbols/support/IconSymbol3DLayerResource.js";import{getIconHref as M}from"../../../../symbols/support/utils.js";import j from"../../../2d/arcade/callExpressionWithFeature.js";import{TRANSPARENT_UNIT as I}from"./constants.js";import{perObjectElevationAligner as w}from"./ElevationAligners.js";import{SymbolUpdateType as O,elevationModeChangeUpdateType as T,needsElevationUpdates2D as E}from"./elevationAlignmentUtils.js";import{ElevationContext as U}from"./ElevationContext.js";import L from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as D}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as F}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as A}from"./graphicUtils.js";import{ApplyRendererDiffResult as G}from"./interfaces.js";import{namedAnchorToHUDMaterialAnchorPos as V}from"./placementUtils.js";import{placePointOnGeometry as B,createStageObject as N,extendPointGraphicElevationContext as k}from"./pointUtils.js";import{initFastSymbolUpdatesState as q,updateFastSymbolUpdatesState as H,evaluateModelTransform as W}from"../support/FastSymbolUpdates.js";import{createTexture as $,DEFAULT_SYMBOL_SIZE_RATIO as Z,DEFAULT_TEX_SIZE as J}from"../../support/engineContent/sdfPrimitives.js";import{DRAPED_Z as K}from"../../terrain/OverlayRenderer.js";import{PowerOfTwoResizeMode as Q}from"../../webgl-engine/lib/basicInterfaces.js";import{createPointGeometry as X}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as Y}from"../../webgl-engine/lib/RenderGeometry.js";import{Texture as ee}from"../../webgl-engine/lib/Texture.js";import{HUDMaterial as te}from"../../webgl-engine/materials/HUDMaterial.js";import ie from"../../../../symbols/CIMSymbol.js";const re=_(),se=x(0,0,1),ae=16,oe=1.5,ne=Z,le=[ne/2,ne/2,1-ne/2,1-ne/2],ce=[J*ne,J*ne];class he extends F{getCachedSize(){return{size:this._getIconSize()}}constructor(e,t,i,r){super(e,t,i,r),this._cimLayers=null,this._cimSymbolMaterials=new Map,this._cimSymbolTextures=new Map,this._cimMaterialParametersInfo=null,this._cimRequiredFields=null,this._cimScaleFactorOrFunction=null,this._size=null,this._symbolTextureRatio=1,this._outlineSize=0,this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!0}}async doLoad(e){this._validateOrThrow();const t=this._prepareMaterialParameters(),i=this._getPrimitive();if(r(i))this._prepareResourcesPrimitive(t,i);else{const i=M(this.symbolLayer),r=d(i);r&&"application/json"===r.mediaType?await this._prepareResourcesCIM(t,JSON.parse(r.data),e):await this._prepareResourcesHref(t,i,e)}}_validateOrThrow(){if(this._drivenProperties.size)return;const e=A(this._getIconSize());if(e)throw new i("graphics3diconsymbollayer:invalid-size",e)}_getIconSize(){const e=this.symbolLayer,t=Math.round(null!=e.size?m(e.size):ae);return this._drivenProperties.size?Math.max(t,64):t}_generateTextureCIM(e){const t=this._getGraphicHash(e);let i=""===t?null:this._cimSymbolTextures.get(t);if(!i){const r={scaleFactor:this._cimScaleFactorOrFunction},s=this._context.sharedResources.cimSymbolRasterizer.rasterizeCIMSymbol3D(this._cimLayers,e,"esriGeometryPoint",r,void 0,void 0);this._cimMaterialParametersInfo.anchorPosition=this._getAnchorPos("relative",s.anchorPosition);const a={width:s.imageData.width,height:s.imageData.height,powerOfTwoResizeMode:Q.PAD};i=new ee(s.imageData,a),this._cimSymbolTextures.set(t,i),this._context.stage.add(i)}return i}_computeSize(e,t){const i=e.width/e.height;return i>1?[t,Math.round(t/i)]:[Math.round(t*i),t]}_prepareMaterialParameters(){const e={anchorPosition:this._getAnchorPos(this.symbolLayer.anchor,this.symbolLayer.anchorPosition)},t=this.symbol;if(me(t)){const{screenLength:i,minWorldLength:s,maxWorldLength:a}=t.verticalOffset;e.verticalOffset={screenLength:m(i),minWorldLength:s||0,maxWorldLength:r(a)?a:1/0}}return this._context.screenSizePerspectiveEnabled&&(e.screenSizePerspective=this._context.sharedResources.screenSizePerspectiveSettings),e.occlusionTest=!0,e.hasSlicePlane=this._context.slicePlaneEnabled,e}_prepareResourcesPrimitive(e,t){const i=this._getOutlineSize();if(ue(t)&&0===i)throw new Error("Nothing to render");if(this._outlineSize=i,e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,r(this._context.sharedResources.textures)){const i=this._context.sharedResources.textures.fromData(`${t}-icon`,(()=>$(t)));this._texture=i.texture,this._releaseTexture=i,e.textureId=this._texture.id}e.textureIsSignedDistanceField=!0,e.distanceFieldBoundingBox=le;const s=this._getIconSize();this._size=[s,s],this._symbolTextureRatio=1/ne,this._createMaterialAndAddToStage(e,this._context.stage)}async _prepareResourcesHref(e,s,a){this._outlineSize=this._getOutlineSize(),e.color=this._getFillColor(),e.outlineColor=this._getOutlineColor(),e.outlineSize=this._outlineSize,e.textureIsSignedDistanceField=!1;const o=this._getIconSize(),n=o*this._context.graphicsCoreOwner.view.state.pixelRatio;if(r(this._context.sharedResources.textures)){const r=await t(this._context.sharedResources.textures.fromUrl(s,n,{signal:a}));if(!1===r.ok){c(r.error);throw new i("graphics3diconsymbollayer:request-failed",`Failed to load (Request for icon resource failed: ${s})`)}this._releaseTexture=r.value;const l=r.value.texture,h=l.params;this._size=this._computeSize(h,o),e.textureId=l.id}this._createMaterialAndAddToStage(e,this._context.stage)}async _prepareResourcesCIM(e,t,i){const r=new ie({data:t});if(!this._context.sharedResources.cimSymbolRasterizer){const e=(await import("../../../../symbols/cim/CIMSymbolRasterizer.js")).CIMSymbolRasterizer;h(i),this._context.sharedResources.cimSymbolRasterizer||(this._context.sharedResources.cimSymbolRasterizer=new e(this._context.renderCoordsHelper.spatialReference,!0))}const s=this._context.layer.fields?this._context.layer.fields.map((e=>e.toJSON())):null;let a,o;if(this._cimLayers=await this._context.sharedResources.cimSymbolRasterizer.analyzeCIMSymbol(r,s,this._context.renderer&&"dictionary"===this._context.renderer.type?this._context.renderer.fieldMap:null,"esriGeometryPoint",{signal:i}),this._context.renderer&&"dictionary"===this._context.renderer.type&&this._context.renderer.scaleExpression){const e=this._context.renderer;if(isNaN(e.scaleExpression)){const t=e.scaleExpression,i=await R(t,this._context.layer.spatialReference,s);o=(e,t,r)=>{const s=j(i,e,{$view:r},"esriGeometryPoint",t);return null!==s?s:1}}else a=Number(e.scaleExpression)}this._cimScaleFactorOrFunction=a||o||1;const n=this._context.renderer?await this._context.renderer.getRequiredFields(this._context.layer.fieldsIndex):[];h(i);const l=this._context.layer.fieldsIndex;this._cimRequiredFields=n.map((e=>l.get(e).name)),this._cimMaterialParametersInfo=e,this._cimMaterialParametersInfo.color=this._getFillColor(),this._cimMaterialParametersInfo.outlineColor=[0,0,0,0],this._cimMaterialParametersInfo.outlineSize=0,this._cimMaterialParametersInfo.textureIsSignedDistanceField=!1}_getPrimitive(){return this.symbolLayer.resource&&this.symbolLayer.resource.href?null:this.symbolLayer.resource&&this.symbolLayer.resource.primitive||C}_getOutlineSize(){let e=0;const t=this.symbolLayer;if(r(t.outline)&&null!=t.outline.size)return Math.max(m(t.outline.size),0);return e=ue(this._getPrimitive())?oe:0,Math.max(e,0)}_getOutlineColor(){const t=this._getLayerOpacity(),i=this.symbolLayer,a=s(i,"outline","color");if(r(a)){const i=e.toUnitRGB(a),r=a.a*t;return[i[0],i[1],i[2],r]}return[0,0,0,0]}_getFillColor(){if(ue(this._getPrimitive()))return I;const e=a(this._getPrimitive()),t=s(this.symbolLayer,"material","color");return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}_getAnchorPos(e,t){return"relative"===e?p((t.x||0)+.5,.5-(t.y||0)):e in V?V[e]:V.center}_createMaterialAndAddToStage(e,t){if(this._cimLayers?this._fastUpdates={enabled:!1}:this._fastUpdates=q(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastUpdates.enabled&&Object.assign(e,this._fastUpdates.materialParameters),this._cimLayers){let i=r(e.textureId)?this._cimSymbolMaterials.get(e.textureId):null;return i||(i=new te(e),this._cimSymbolMaterials.set(o(e.textureId,0),i),t.add(i)),i}return this._material=new te(e),t.add(this._material),this._material}_setDrapingDependentMaterialParameters(){this.draped&&(this._forEachMaterial((e=>{e.setParameters({verticalOffset:null,screenSizePerspective:null,occlusionTest:!1,hasSlicePlane:!1,shaderPolygonOffset:0,isDraped:this.draped})})),this.layerOpacityChanged())}destroy(){super.destroy(),this._forEachMaterial((e=>this._context.stage.remove(e))),this._material=null,this._cimSymbolMaterials.clear(),this._cimSymbolTextures.forEach((e=>this._context.stage.remove(e))),this._cimSymbolTextures.clear(),this._releaseTexture=n(this._releaseTexture)}_getScaleFactor(e,t){if(this._drivenProperties.size&&e.size){for(let t=0;t<3;t++){const i=e.size[t];i&&"symbol-value"!==i&&"proportional"!==i&&(e.size[t]=m(i))}if("symbol-value"===e.size[0])return 1;if(isFinite(+e.size[0]))return+e.size[0]/t;if(isFinite(+e.size[2]))return+e.size[2]/t}return 1}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry))return null;let i,r=[0,0];if(this._cimLayers){if(!this._cimLayers.length)return null;const e=this._generateTextureCIM(t),s={textureId:e.id,...this._cimMaterialParametersInfo};i=this._createMaterialAndAddToStage(s,this._context.stage),r=[e.params.width,e.params.height]}else r=this._size,i=l(this._material);const s=B(t.geometry);if(a(s))return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const o=e.renderingInfo,n=this._getVertexOpacityAndColor(o);let c=1;if(!this._fastUpdates.enabled||!this._fastUpdates.visualVariables.size){const e=r[0]>r[1]?r[0]:r[1];c=this._getScaleFactor(o,e)}c*=this._symbolTextureRatio;const h=p(r[0]*c,r[1]*c),m=this.setGraphicElevationContext(t,new U);return this.ensureDrapedStatus("on-the-ground"===m.mode)&&this._setDrapingDependentMaterialParameters(),this.draped?this._createAsOverlay(t,s,i,n,h,e.layer.uid):this._createAs3DShape(t,s,i,n,h,m,t.uid)}layerOpacityChanged(){const e=this._getFillColor(),t=this._getOutlineColor();this._forEachMaterial((i=>{i.setParameters({color:e}),i.setParameters({outlineColor:t})}))}layerElevationInfoChanged(e,t,i){const r=this._elevationContext.mode,s=T(he.elevationModeChangeTypes,i,r);if(s!==O.UPDATE)return s;const a=E(r)||"absolute-height"===r;return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>a))}slicePlaneEnabledChanged(){return this.draped||this._forEachMaterial((e=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),!0}physicalBasedRenderingChanged(){return!0}pixelRatioChanged(){return!!this._getPrimitive()}applyRendererDiff(e,t){for(const i in e.diff){if("visualVariables"!==i)return G.Recreate_Symbol;if(!H(this._fastUpdates,t,this._fastVisualVariableConvertOptions()))return G.Recreate_Symbol;r(this._material)&&this._material.setParameters(this._fastUpdates.materialParameters)}return G.Fast_Update}_defaultElevationInfoNoZ(){return de}_createAs3DShape(e,t,i,r,s,o,n){const l=this.getFastUpdateAttrValues(e),c=l?e=>W(this._fastUpdates.materialParameters,l,e):void 0,h=this._context.layer.uid,m=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:n,layerUid:h}),u=X(i,se,null,r,s,_e,null,l,m),d=N(this._context,t,u,o,n,c);if(a(d))return null;const _=new D(this,d.object,[u],null,null,w,o);return _.alignedSampledElevation=d.sampledElevation,_.needsElevationUpdates=E(o.mode)||"absolute-height"===o.mode,_.getScreenSize=this._createScreenSizeGetter(s,c),_.calculateRelativeScreenBounds=e=>i.calculateRelativeScreenBounds(_.getScreenSize(),1,e),k(_,t,this._context.elevationProvider),_}_createAsOverlay(e,t,i,s,a,o){i.renderPriority=this._renderPriority;const n=v();z(t,n,this._context.overlaySR),n[2]=K;const l=this._context.clippingExtent;if(r(l)&&!P(l,n))return null;const c=this.getFastUpdateAttrValues(e),h=c?e=>W(this._fastUpdates.materialParameters,c,e):void 0,m=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:e.uid,layerUid:this._context.layer.uid}),u=X(i,se,n,s,a,null,null,c,m),d=new Y(u,{layerUid:o,graphicUid:e.uid,shaderTransformer:h});n[3]=0,S(d.boundingSphere,n);const _=new L(this,[d],null,this._context.drapeSourceRenderer);return _.getScreenSize=this._createScreenSizeGetter(a,h),_.calculateRelativeScreenBounds=e=>i.calculateRelativeScreenBounds(_.getScreenSize(),1,e),_}_createScreenSizeGetter(e,t){const i=this._outlineSize+2;if(this._fastUpdates.enabled){const r=e[0]/this._symbolTextureRatio,s=e[1]/this._symbolTextureRatio;return(e=f())=>{const a=t(re);return e[0]=a[0]*r+i,e[1]=a[5]*s+i,e}}{const t=e[0]/this._symbolTextureRatio+i,r=e[1]/this._symbolTextureRatio+i;return(e=f())=>(e[0]=t,e[1]=r,e)}}_fastVisualVariableConvertOptions(){const e=this._size[0]>this._size[1]?this._size[0]:this._size[1],t=x(e,e,e),i=u(1),r=e*i;return{modelSize:t,symbolSize:x(r,r,r),unitInMeters:i,transformation:{anchor:y,scale:g,rotation:y}}}_getGraphicHash(e){let t="";for(const i of this._cimRequiredFields)t+=i+e.attributes[i];return t}_forEachMaterial(e){r(this._material)&&e(this._material),this._cimSymbolMaterials.forEach(e)}test(){return{...super.test(),material:this._material}}}function me(e){return e&&"point-3d"===e.type&&e.hasVisibleVerticalOffset()}function ue(e){return!a(e)&&("cross"===e||"x"===e)}he.PRIMITIVE_SIZE=ce,he.elevationModeChangeTypes={definedChanged:O.UPDATE,staysOnTheGround:O.NONE,onTheGroundChanged:O.RECREATE};const de={mode:"relative-to-ground",offset:0},_e=b(0,0,0,1);export{he as Graphics3DIconSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.26/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../geometry.js";import e from"../../../../core/Error.js";import{isSome as t,applySome as r,isNone as a,releaseMaybe as i,unwrapOr as s,get as o,unwrap as n}from"../../../../core/maybe.js";import{px2pt as l,pt2px as h}from"../../../../core/screenUtils.js";import{s as c}from"../../../../chunks/vec4.js";import{f as p,d}from"../../../../chunks/vec4f64.js";import{create as m,empty as _,expandWithBuffer as y,intersectsClippingArea as u,expandWithAABB as g}from"../../../../geometry/support/aaBoundingBox.js";import{getDriverAxisSizeValueAny as f}from"../../../../renderers/support/renderingInfoUtils.js";import{sharedGeometryElevationAligner as M}from"./ElevationAligners.js";import{SymbolUpdateType as C,elevationModeChangeUpdateType as b,needsElevationUpdates2D as v}from"./elevationAlignmentUtils.js";import{ElevationContext as E}from"./ElevationContext.js";import L from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as P}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as w,getAttributeValue as x}from"./Graphics3DSymbolLayer.js";import{ApplyRendererDiffResult as k}from"./interfaces.js";import{parseLineMarkerStyle as D,parseCapType as U}from"./lineUtils.js";import{initFastSymbolUpdatesState as R,updateFastSymbolUpdatesState as S}from"../support/FastSymbolUpdates.js";import A from"../../support/debugFlags.js";import{createGeometry as j}from"../../support/engineContent/line.js";import{prepareMarkerResources as z}from"../../support/engineContent/marker.js";import{geometryToRenderInfo as O,geometryToRenderInfoDraped as G}from"../../support/renderInfoUtils/line.js";import{Object3D as V}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as I}from"../../webgl-engine/lib/RenderGeometry.js";import{LineMarkerMaterial as T}from"../../webgl-engine/materials/LineMarkerMaterial.js";import{getStipplePatternForLinePattern as F}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as W}from"../../webgl-engine/materials/RibbonLineMaterial.js";import B from"../../../../geometry/Extent.js";import H from"../../../../geometry/Polygon.js";const N=["polyline","polygon","extent"];class q extends w{constructor(e,t,r,a){super(e,t,r,a)}async doLoad(){if(this._vvConvertOptions={modelSize:[1,1,1],symbolSize:[1,1,1],unitInMeters:1,transformation:{anchor:[0,0,0],scale:[1,1,1],rotation:[0,0,0]},supportedTypes:{size:!0,color:!0,opacity:!0,rotation:!1}},this._context.renderer&&this._context.renderer.visualVariables&&this._context.renderer.visualVariables.length>0?this._fastUpdates=R(this._context.renderer,this._vvConvertOptions):this._fastUpdates={enabled:!1},!this._drivenProperties.size){if((null!=this.symbolLayer.size?this.symbolLayer.size:l(1))<0)throw new e("graphics3dlinesymbollayer:invalid-size","Symbol sizes may not be negative values")}this._markerTexture=t(this.symbolLayer.marker)&&t(this._context.sharedResources.textures)?z(this._context.sharedResources.textures,D(this.symbolLayer.marker.style)):null}_getMaterialParameters(e,t=!1){const r=this._getCombinedOpacityAndColor(t&&this._markerColor||this._materialColor);this._patternHidesLine&&!t&&(r[3]=0);const a={width:this._computeMaterialWidth(this.symbolLayer?.size),color:r,hasPolygonOffset:!0,join:this.symbolLayer.join||"miter",cap:U(this.symbolLayer.cap||"butt"),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:e,stipplePattern:F(this.symbolLayer.pattern),stippleScaleWithLineWidth:!0};return this._fastUpdates&&this._fastUpdates.visualVariables?{...a,...this._fastUpdates.materialParameters}:a}get _materialColor(){return r(this.symbolLayer.material,(e=>e.color))}get _markerColor(){return r(this.symbolLayer.marker,(e=>e.color))}get _lineMaterial(){return a(this._lineMaterialCached)&&(this._lineMaterialCached=new W(this._getMaterialParameters(!1)),this._context.stage.add(this._lineMaterialCached)),this._lineMaterialCached}get _ringMaterial(){return a(this._ringMaterialCached)&&(this._ringMaterialCached=new W(this._getMaterialParameters(!0)),this._context.stage.add(this._ringMaterialCached)),this._ringMaterialCached}get _wireframeLineMaterial(){return a(this._wireframeLineMaterialCached)&&(this._wireframeLineMaterialCached=new W({...this._getMaterialParameters(!1),wireframe:!0}),this._context.stage.add(this._wireframeLineMaterialCached)),this._wireframeLineMaterialCached}get _wireframeRingMaterial(){return a(this._wireframeRingMaterialCached)&&(this._wireframeRingMaterialCached=new W({...this._getMaterialParameters(!0),wireframe:!0}),this._context.stage.add(this._wireframeRingMaterialCached)),this._wireframeRingMaterialCached}get _markerMaterial(){return a(this._markerMaterialCached)&&t(this.symbolLayer.marker)&&t(this._markerTexture)&&(this._markerMaterialCached=new T({...this._getMaterialParameters(!1,!0),placement:this.symbolLayer.marker.placement,textureId:this._markerTexture.texture.id}),this._context.stage.add(this._markerMaterialCached)),this._markerMaterialCached}destroy(){super.destroy(),this._forEachMaterial((e=>this._context.stage.remove(e))),this._lineMaterialCached=null,this._ringMaterialCached=null,this._wireframeLineMaterialCached=null,this._wireframeRingMaterialCached=null,this._markerMaterialCached=null,this._markerTexture=i(this._markerTexture)}_getDrivenSize(e){return this._drivenProperties.size&&e.size?h(f(e.size)):1}_getSizeFeatureAttributeData(e){return this._fastUpdates.enabled&&this._fastUpdates.visualVariables.size?x(this._fastUpdates.visualVariables.size.field,e):null}_getDrivenColor(e){const t=p(1,1,1,1);return this._drivenProperties.color&&e.color&&(t[0]=e.color[0],t[1]=e.color[1],t[2]=e.color[2],e.color.length>0&&(t[3]=e.color[3])),this._drivenProperties.opacity&&e.opacity&&(t[3]=e.opacity),t}_getColorFeatureAttributeData(e){return this._fastUpdates.enabled&&this._fastUpdates.visualVariables.color?x(this._fastUpdates.visualVariables.color.field,e):null}_getOpacityFeatureAttributeData(e){return this._fastUpdates.enabled&&this._fastUpdates.visualVariables.opacity?x(this._fastUpdates.visualVariables.opacity.field,e):null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,N,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t,new E);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.draped?this._createAsOverlay(e,this._context.layer.uid):this._createAs3DShape(e,r,t.uid)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return k.Recreate_Symbol;if(!S(this._fastUpdates,t,this._vvConvertOptions))return k.Recreate_Symbol;this._forEachMaterial((e=>e.setParameters(this._fastUpdates.materialParameters)))}return k.Fast_Update}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff,r={};"complete"===t.size?.type&&(r.width=this._computeMaterialWidth(t.size.newValue),delete t.size),"complete"===t.cap?.type&&(r.cap=U(s(t.cap.newValue,"butt")),delete t.cap);const a=this._prepareMarkerPatch(e,t);this._prepareMaterialPatch(e,t,a),e.symbolLayerStatePatches.push((()=>this._forEachMaterial((e=>e.setParameters(r)))))}layerOpacityChanged(){this._forEachMaterial(((e,t)=>this._updateMaterialLayerOpacity(e,t)))}_forEachMaterial(e){t(this._lineMaterialCached)&&e(this._lineMaterialCached),t(this._ringMaterialCached)&&e(this._ringMaterialCached),t(this._wireframeLineMaterialCached)&&e(this._wireframeLineMaterialCached),t(this._wireframeRingMaterialCached)&&e(this._wireframeRingMaterialCached),t(this._markerMaterialCached)&&e(this._markerMaterialCached,!0)}_updateMaterialLayerOpacity(e,t=!1){const r=e.parameters.color,a=o(this.symbolLayer,"material","color"),i=this._patternHidesLine&&!t?0:this._getCombinedOpacity(a),s=p(r[0],r[1],r[2],i);e.setParameters({color:s})}layerElevationInfoChanged(e,t,r){const a=this._elevationContext.mode,i=b(q.elevationModeChangeTypes,r,a);if(i!==C.UPDATE)return i;const s=v(a);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>s))}slicePlaneEnabledChanged(){const e={hasSlicePlane:this._context.slicePlaneEnabled};return this._forEachMaterial((t=>t.setParameters(e))),!0}physicalBasedRenderingChanged(){return!0}pixelRatioChanged(){return!0}_getGeometryAsPolygonOrPolyline(e){switch(e.type){case"extent":if(e instanceof B)return H.fromExtent(e);break;case"polygon":case"polyline":return e}return null}_createAs3DShape(e,r,a){const i=e.graphic,s=this._getGeometryAsPolygonOrPolyline(i.geometry),o="polygon"===s.type?s.rings:s.paths,n=new Array,l=m(),h=O(s,this._context.elevationProvider,this._context.renderCoordsHelper,r),c="polygon"===s.type?"rings":"paths";this._logGeometryCreationWarnings(h,o,c,"LineSymbol3DLayer");for(let m=0;m<h.lines.length;m++){const{position:r,mapPositions:i}=h.lines[m];if(t(this._context.clippingExtent)&&(_(l),y(l,i),!u(l,this._context.clippingExtent)))continue;const o=this._createGeometry("polygon"===s.type?this._ringMaterial:this._lineMaterial,e,r,i,s.type,J.ELEVATED,a);n.push(o),A.LINE_WIREFRAMES&&n.push(o.instantiate({material:"polygon"===s.type?this._wireframeRingMaterial:this._wireframeLineMaterial})),t(this._markerMaterial)&&n.push(o.instantiate({material:this._markerMaterial}))}if(0===n.length)return null;const p=new V({geometries:n,castShadow:!1,metadata:{layerUid:this._context.layer.uid,graphicUid:a}}),d=new P(this,p,n,null,null,M,r);return d.alignedSampledElevation=h.sampledElevation,d.needsElevationUpdates=v(r.mode),d}_createGeometry(e,t,r,a,i,s,o){const n="polygon"===i,l=this._fastUpdates.enabled&&this._fastUpdates.visualVariables.color,h=this._fastUpdates.enabled&&this._fastUpdates.visualVariables.size,c=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerUid:this._context.layer.uid});return j(e,{overlayInfo:s===J.DRAPED?{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper}:null,removeDuplicateStartEnd:n,mapPositions:a,attributeData:{position:r,size:h?null:this._getDrivenSize(t.renderingInfo),color:l?null:this._getDrivenColor(t.renderingInfo),sizeFeature:this._getSizeFeatureAttributeData(t.graphic),colorFeature:this._getColorFeatureAttributeData(t.graphic),opacityFeature:this._getOpacityFeatureAttributeData(t.graphic)}},c)}_createAsOverlay(e,r){const a=e.graphic,i=this._getGeometryAsPolygonOrPolyline(a.geometry),s="polygon"===i.type?i.rings:i.paths,o="polygon"===i.type?this._ringMaterial:this._lineMaterial;o.renderPriority=this._renderPriority;const l=A.LINE_WIREFRAMES?"polygon"===i.type?this._wireframeRingMaterial:this._wireframeLineMaterial:null,h=this._markerMaterial;t(l)&&(l.renderPriority=this._renderPriority-.001),t(h)&&(h.renderPriority=this._renderPriority-.002);const c=new Array,p=m(),d=_(),f=G(i,this._context.overlaySR),M="polygon"===i.type?"rings":"paths";this._logGeometryCreationWarnings(f,s,M,"LineSymbol3DLayer");for(const m of f.lines){if(_(p),y(p,m.position),!u(p,this._context.clippingExtent))continue;g(d,p);const s=t=>{const s=this._createGeometry(t,e,m.position,null,i.type,J.DRAPED,a.uid),o=new I(s,{layerUid:r,graphicUid:a.uid});return c.push(o),o};if(t(h)){const e=s(h),t=n(this.symbolLayer.marker).placement;"begin"!==t&&"begin-end"!==t||y(p,m.position,0,1),"end"!==t&&"begin-end"!==t||y(p,m.position,m.position.length-3,1),this._updateBoundingSphere(e,p)}const f=s(o);if(this._updateBoundingSphere(f,p),A.LINE_WIREFRAMES){const e=s(l);this._updateBoundingSphere(e,p)}}return new L(this,c,d,this._context.drapeSourceRenderer)}_updateBoundingSphere(e,t){c(e.boundingSphere,.5*(t[0]+t[3]),.5*(t[1]+t[4]),0,.5*Math.sqrt((t[3]-t[0])*(t[3]-t[0])+(t[4]-t[1])*(t[4]-t[1])))}get _patternHidesLine(){const e=this.symbolLayer.pattern;return t(e)&&"style"===e.type&&"none"===e.style}_computeMaterialWidth(e){return e=s(e,l(1)),this._drivenProperties.size?this._fastUpdates.enabled&&this._fastUpdates.visualVariables.size?h(1):1:h(e)}_prepareMaterialPatch(e,t,i){const s=t.material;if(a(s))return void(i.changed&&i.useMaterialColor&&this._patchMaterialColor(this._getCombinedOpacityAndColor(this._materialColor),this._markerMaterialCached,e));if("collection"===s.type)return;const o="complete"===s.type?r(s.newValue,(e=>e.color)):"complete"===s.diff.color.type?s.diff.color.newValue:null,n=this._getCombinedOpacityAndColor(o);i.useMaterialColor&&this._patchMaterialColor(d(n),this._markerMaterialCached,e),this._patternHidesLine&&(n[3]=0),this._patchMaterialColor(n,this._lineMaterialCached,e),delete t.material}_prepareMarkerPatch(e,r){const i=r.marker;if(a(i)||"partial"!==i.type||t(i.diff.style)||t(i.diff.placement)||t(i.diff.color)&&"complete"!==i.diff.color.type)return{changed:!1,useMaterialColor:a(this._markerColor)};const s=i.diff.color;if(a(s))return delete r.marker,{changed:!1,useMaterialColor:a(this._markerColor)};const o=n(s.newValue);return a(o)?(delete r.marker,{changed:!0,useMaterialColor:!0}):(this._patchMaterialColor(this._getCombinedOpacityAndColor(o),this._markerMaterialCached,e),delete r.marker,{changed:!0,useMaterialColor:!1})}_patchMaterialColor(e,t,r){a(t)||r.symbolLayerStatePatches.push((()=>t.setParameters({color:e})))}}var J;q.elevationModeChangeTypes={definedChanged:C.RECREATE,staysOnTheGround:C.NONE,onTheGroundChanged:C.RECREATE},function(e){e[e.DRAPED=0]="DRAPED",e[e.ELEVATED=1]="ELEVATED"}(J||(J={}));export{q as Graphics3DLineSymbolLayer};
|
|
5
|
+
import"../../../../geometry.js";import e from"../../../../core/Error.js";import{isSome as t,applySome as r,isNone as a,releaseMaybe as i,unwrapOr as s,get as o,unwrap as n}from"../../../../core/maybe.js";import{px2pt as l,pt2px as h}from"../../../../core/screenUtils.js";import{s as c}from"../../../../chunks/vec4.js";import{f as p,d}from"../../../../chunks/vec4f64.js";import{create as m,empty as _,expandWithBuffer as y,intersectsClippingArea as u,expandWithAABB as g}from"../../../../geometry/support/aaBoundingBox.js";import{getDriverAxisSizeValueAny as f}from"../../../../renderers/support/renderingInfoUtils.js";import{sharedGeometryElevationAligner as M}from"./ElevationAligners.js";import{SymbolUpdateType as C,elevationModeChangeUpdateType as b,needsElevationUpdates2D as v}from"./elevationAlignmentUtils.js";import{ElevationContext as E}from"./ElevationContext.js";import L from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as P}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as w,getAttributeValue as x}from"./Graphics3DSymbolLayer.js";import{ApplyRendererDiffResult as k}from"./interfaces.js";import{parseLineMarkerStyle as D,parseCapType as U}from"./lineUtils.js";import{initFastSymbolUpdatesState as R,updateFastSymbolUpdatesState as S}from"../support/FastSymbolUpdates.js";import A from"../../support/debugFlags.js";import{createGeometry as j}from"../../support/engineContent/line.js";import{prepareMarkerResources as z}from"../../support/engineContent/marker.js";import{geometryToRenderInfo as O,geometryToRenderInfoDraped as G}from"../../support/renderInfoUtils/line.js";import{Object3D as V}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as I}from"../../webgl-engine/lib/RenderGeometry.js";import{LineMarkerMaterial as T}from"../../webgl-engine/materials/LineMarkerMaterial.js";import{getStipplePatternForLinePattern as F}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as W}from"../../webgl-engine/materials/RibbonLineMaterial.js";import B from"../../../../geometry/Extent.js";import H from"../../../../geometry/Polygon.js";const N=["polyline","polygon","extent"];class q extends w{constructor(e,t,r,a){super(e,t,r,a)}async doLoad(){if(this._vvConvertOptions={modelSize:[1,1,1],symbolSize:[1,1,1],unitInMeters:1,transformation:{anchor:[0,0,0],scale:[1,1,1],rotation:[0,0,0]},supportedTypes:{size:!0,color:!0,opacity:!0,rotation:!1}},this._context.renderer&&this._context.renderer.visualVariables&&this._context.renderer.visualVariables.length>0?this._fastUpdates=R(this._context.renderer,this._vvConvertOptions):this._fastUpdates={enabled:!1},!this._drivenProperties.size){if((null!=this.symbolLayer.size?this.symbolLayer.size:l(1))<0)throw new e("graphics3dlinesymbollayer:invalid-size","Symbol sizes may not be negative values")}this._markerTexture=t(this.symbolLayer.marker)&&t(this._context.sharedResources.textures)?z(this._context.sharedResources.textures,D(this.symbolLayer.marker.style)):null}_getMaterialParameters(e,t=!1){const r=this._getCombinedOpacityAndColor(t&&this._markerColor||this._materialColor);this._patternHidesLine&&!t&&(r[3]=0);const a={width:this._computeMaterialWidth(this.symbolLayer?.size),color:r,hasPolygonOffset:!0,join:this.symbolLayer.join||"miter",cap:U(this.symbolLayer.cap||"butt"),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:e,stipplePattern:F(this.symbolLayer.pattern),stippleScaleWithLineWidth:!0};return this._fastUpdates&&this._fastUpdates.visualVariables?{...a,...this._fastUpdates.materialParameters}:a}get _materialColor(){return r(this.symbolLayer.material,(e=>e.color))}get _markerColor(){return r(this.symbolLayer.marker,(e=>e.color))}get _lineMaterial(){return a(this._lineMaterialCached)&&(this._lineMaterialCached=new W(this._getMaterialParameters(!1)),this._context.stage.add(this._lineMaterialCached)),this._lineMaterialCached}get _ringMaterial(){return a(this._ringMaterialCached)&&(this._ringMaterialCached=new W(this._getMaterialParameters(!0)),this._context.stage.add(this._ringMaterialCached)),this._ringMaterialCached}get _wireframeLineMaterial(){return a(this._wireframeLineMaterialCached)&&(this._wireframeLineMaterialCached=new W({...this._getMaterialParameters(!1),wireframe:!0}),this._context.stage.add(this._wireframeLineMaterialCached)),this._wireframeLineMaterialCached}get _wireframeRingMaterial(){return a(this._wireframeRingMaterialCached)&&(this._wireframeRingMaterialCached=new W({...this._getMaterialParameters(!0),wireframe:!0}),this._context.stage.add(this._wireframeRingMaterialCached)),this._wireframeRingMaterialCached}get _markerMaterial(){return a(this._markerMaterialCached)&&t(this.symbolLayer.marker)&&t(this._markerTexture)&&(this._markerMaterialCached=new T({...this._getMaterialParameters(!1,!0),placement:this.symbolLayer.marker.placement,textureId:this._markerTexture.texture.id}),this._context.stage.add(this._markerMaterialCached)),this._markerMaterialCached}destroy(){super.destroy(),this._forEachMaterial((e=>this._context.stage.remove(e))),this._lineMaterialCached=null,this._ringMaterialCached=null,this._wireframeLineMaterialCached=null,this._wireframeRingMaterialCached=null,this._markerMaterialCached=null,this._markerTexture=i(this._markerTexture)}_getDrivenSize(e){return this._drivenProperties.size&&e.size?h(f(e.size)):1}_getSizeFeatureAttributeData(e){return this._fastUpdates.enabled&&this._fastUpdates.visualVariables.size?x(this._fastUpdates.visualVariables.size.field,e):null}_getDrivenColor(e){const t=p(1,1,1,1);return this._drivenProperties.color&&e.color&&(t[0]=e.color[0],t[1]=e.color[1],t[2]=e.color[2],e.color.length>0&&(t[3]=e.color[3])),this._drivenProperties.opacity&&e.opacity&&(t[3]=e.opacity),t}_getColorFeatureAttributeData(e){return this._fastUpdates.enabled&&this._fastUpdates.visualVariables.color?x(this._fastUpdates.visualVariables.color.field,e):null}_getOpacityFeatureAttributeData(e){return this._fastUpdates.enabled&&this._fastUpdates.visualVariables.opacity?x(this._fastUpdates.visualVariables.opacity.field,e):null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,N,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t,new E);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.draped?this._createAsOverlay(e,this._context.layer.uid):this._createAs3DShape(e,r,t.uid)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return k.Recreate_Symbol;if(!S(this._fastUpdates,t,this._vvConvertOptions))return k.Recreate_Symbol;this._forEachMaterial((e=>e.setParameters(this._fastUpdates.materialParameters)))}return k.Fast_Update}prepareSymbolLayerPatch(e){if("partial"!==e.diff.type)return;const t=e.diff.diff,r={};"complete"===t.size?.type&&(r.width=this._computeMaterialWidth(t.size.newValue),delete t.size),"complete"===t.cap?.type&&(r.cap=U(s(t.cap.newValue,"butt")),delete t.cap);const a=this._prepareMarkerPatch(e,t);this._prepareMaterialPatch(e,t,a),e.symbolLayerStatePatches.push((()=>this._forEachMaterial((e=>e.setParameters(r)))))}layerOpacityChanged(){this._forEachMaterial(((e,t)=>this._updateMaterialLayerOpacity(e,t)))}_forEachMaterial(e){t(this._lineMaterialCached)&&e(this._lineMaterialCached),t(this._ringMaterialCached)&&e(this._ringMaterialCached),t(this._wireframeLineMaterialCached)&&e(this._wireframeLineMaterialCached),t(this._wireframeRingMaterialCached)&&e(this._wireframeRingMaterialCached),t(this._markerMaterialCached)&&e(this._markerMaterialCached,!0)}_updateMaterialLayerOpacity(e,t=!1){const r=e.parameters.color,a=o(this.symbolLayer,"material","color"),i=this._patternHidesLine&&!t?0:this._getCombinedOpacity(a),s=p(r[0],r[1],r[2],i);e.setParameters({color:s})}layerElevationInfoChanged(e,t,r){const a=this._elevationContext.mode,i=b(q.elevationModeChangeTypes,r,a);if(i!==C.UPDATE)return i;const s=v(a);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>s))}slicePlaneEnabledChanged(){const e={hasSlicePlane:this._context.slicePlaneEnabled};return this._forEachMaterial((t=>t.setParameters(e))),!0}physicalBasedRenderingChanged(){return!0}pixelRatioChanged(){return!0}_getGeometryAsPolygonOrPolyline(e){switch(e.type){case"extent":if(e instanceof B)return H.fromExtent(e);break;case"polygon":case"polyline":return e}return null}_createAs3DShape(e,r,a){const i=e.graphic,s=this._getGeometryAsPolygonOrPolyline(i.geometry),o="polygon"===s.type?s.rings:s.paths,n=new Array,l=m(),h=O(s,this._context.elevationProvider,this._context.renderCoordsHelper,r),c="polygon"===s.type?"rings":"paths";this._logGeometryCreationWarnings(h,o,c,"LineSymbol3DLayer");for(let m=0;m<h.lines.length;m++){const r=h.lines[m],i=r.position,o=r.mapPositions;if(t(this._context.clippingExtent)&&(_(l),y(l,o),!u(l,this._context.clippingExtent)))continue;const c=this._createGeometry("polygon"===s.type?this._ringMaterial:this._lineMaterial,e,i,o,s.type,J.ELEVATED,a);n.push(c),A.LINE_WIREFRAMES&&n.push(c.instantiate({material:"polygon"===s.type?this._wireframeRingMaterial:this._wireframeLineMaterial})),t(this._markerMaterial)&&n.push(c.instantiate({material:this._markerMaterial}))}if(0===n.length)return null;const p=new V({geometries:n,castShadow:!1,metadata:{layerUid:this._context.layer.uid,graphicUid:a}}),d=new P(this,p,n,null,null,M,r);return d.alignedSampledElevation=h.sampledElevation,d.needsElevationUpdates=v(r.mode),d}_createGeometry(e,t,r,a,i,s,o){const n="polygon"===i,l=this._fastUpdates.enabled&&this._fastUpdates.visualVariables.color,h=this._fastUpdates.enabled&&this._fastUpdates.visualVariables.size,c=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerUid:this._context.layer.uid});return j(e,{overlayInfo:s===J.DRAPED?{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper}:null,removeDuplicateStartEnd:n,mapPositions:a,attributeData:{position:r,size:h?null:this._getDrivenSize(t.renderingInfo),color:l?null:this._getDrivenColor(t.renderingInfo),sizeFeature:this._getSizeFeatureAttributeData(t.graphic),colorFeature:this._getColorFeatureAttributeData(t.graphic),opacityFeature:this._getOpacityFeatureAttributeData(t.graphic)}},c)}_createAsOverlay(e,r){const a=e.graphic,i=this._getGeometryAsPolygonOrPolyline(a.geometry),s="polygon"===i.type?i.rings:i.paths,o="polygon"===i.type?this._ringMaterial:this._lineMaterial;o.renderPriority=this._renderPriority;const l=A.LINE_WIREFRAMES?"polygon"===i.type?this._wireframeRingMaterial:this._wireframeLineMaterial:null,h=this._markerMaterial;t(l)&&(l.renderPriority=this._renderPriority-.001),t(h)&&(h.renderPriority=this._renderPriority-.002);const c=new Array,p=m(),d=_(),f=G(i,this._context.overlaySR),M="polygon"===i.type?"rings":"paths";this._logGeometryCreationWarnings(f,s,M,"LineSymbol3DLayer");for(const m of f.lines){if(_(p),y(p,m.position),!u(p,this._context.clippingExtent))continue;g(d,p);const s=t=>{const s=this._createGeometry(t,e,m.position,void 0,i.type,J.DRAPED,a.uid),o=new I(s,{layerUid:r,graphicUid:a.uid});return c.push(o),o};if(t(h)){const e=s(h),t=n(this.symbolLayer.marker).placement;"begin"!==t&&"begin-end"!==t||y(p,m.position,0,1),"end"!==t&&"begin-end"!==t||y(p,m.position,m.position.length-3,1),this._updateBoundingSphere(e,p)}const f=s(o);if(this._updateBoundingSphere(f,p),A.LINE_WIREFRAMES){const e=s(l);this._updateBoundingSphere(e,p)}}return new L(this,c,d,this._context.drapeSourceRenderer)}_updateBoundingSphere(e,t){c(e.boundingSphere,.5*(t[0]+t[3]),.5*(t[1]+t[4]),0,.5*Math.sqrt((t[3]-t[0])*(t[3]-t[0])+(t[4]-t[1])*(t[4]-t[1])))}get _patternHidesLine(){const e=this.symbolLayer.pattern;return t(e)&&"style"===e.type&&"none"===e.style}_computeMaterialWidth(e){return e=s(e,l(1)),this._drivenProperties.size?this._fastUpdates.enabled&&this._fastUpdates.visualVariables.size?h(1):1:h(e)}_prepareMaterialPatch(e,t,i){const s=t.material;if(a(s))return void(i.changed&&i.useMaterialColor&&this._patchMaterialColor(this._getCombinedOpacityAndColor(this._materialColor),this._markerMaterialCached,e));if("collection"===s.type)return;const o="complete"===s.type?r(s.newValue,(e=>e.color)):"complete"===s.diff.color?.type?s.diff.color.newValue:null,n=this._getCombinedOpacityAndColor(o);i.useMaterialColor&&this._patchMaterialColor(d(n),this._markerMaterialCached,e),this._patternHidesLine&&(n[3]=0),this._patchMaterialColor(n,this._lineMaterialCached,e),delete t.material}_prepareMarkerPatch(e,r){const i=r.marker;if(a(i)||"partial"!==i.type||t(i.diff.style)||t(i.diff.placement)||t(i.diff.color)&&"complete"!==i.diff.color.type)return{changed:!1,useMaterialColor:a(this._markerColor)};const s=i.diff.color;if(a(s))return delete r.marker,{changed:!1,useMaterialColor:a(this._markerColor)};const o=n(s.newValue);return a(o)?(delete r.marker,{changed:!0,useMaterialColor:!0}):(this._patchMaterialColor(this._getCombinedOpacityAndColor(o),this._markerMaterialCached,e),delete r.marker,{changed:!0,useMaterialColor:!1})}_patchMaterialColor(e,t,r){a(t)||r.symbolLayerStatePatches.push((()=>t.setParameters({color:e})))}}var J;q.elevationModeChangeTypes={definedChanged:C.RECREATE,staysOnTheGround:C.NONE,onTheGroundChanged:C.RECREATE},function(e){e[e.DRAPED=0]="DRAPED",e[e.ELEVATED=1]="ELEVATED"}(J||(J={}));export{q as Graphics3DLineSymbolLayer};
|