@arcgis/core 4.27.0-next.20230320 → 4.27.0-next.20230321
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/29ee4f14602caf6967e4.js +1 -0
- package/assets/esri/core/workers/chunks/{c36efbdd0a84fe851bbb.js → 433686dfda9e2ff1f98b.js} +1 -1
- package/assets/esri/core/workers/chunks/70ea44365021b665c213.js +1 -0
- package/assets/esri/core/workers/chunks/{f150bd21c3b9e098da57.js → 92951b85676df776961f.js} +56 -56
- package/assets/esri/core/workers/chunks/{19355af765993931a7c0.js → 9b196a726c6d175ca60f.js} +1 -1
- package/assets/esri/core/workers/chunks/bc002e4dff8859571a7a.js +1 -0
- package/assets/esri/core/workers/chunks/c5dd23d11fa91b0f318e.js +1 -0
- package/assets/esri/core/workers/chunks/c8f019d13f6b22481f2e.js +1 -0
- package/assets/esri/core/workers/chunks/f1ab86dbbd5b04e2a96c.js +1 -0
- package/assets/esri/themes/base/widgets/_Editor.scss +18 -0
- package/assets/esri/themes/base/widgets/_ItemList.scss +13 -33
- 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/Editor/t9n/Editor.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_en.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/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ar.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_bg.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_bs.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ca.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_cs.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_da.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_de.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_el.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_es.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_et.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_fi.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_fr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_he.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_hr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_hu.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_id.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_it.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ja.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ko.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_lt.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_lv.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_nb.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_nl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_pl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_pt-BR.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_pt-PT.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ro.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_ru.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sk.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sl.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_sv.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_th.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_tr.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_uk.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_vi.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_zh-CN.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_zh-HK.json +1 -1
- package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_zh-TW.json +1 -1
- package/chunks/ColorMaterial.glsl.js +16 -14
- package/interfaces.d.ts +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/environment/CloudsData.js +1 -1
- package/views/3d/environment/CloudsGenerator.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/GraphicScaleRotateTransform.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/GraphicTransformTool.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateMeshAdapter.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateObjectSymbol3DAdapter.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFeatureProcessor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.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/Graphics3DSymbol.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
- package/views/3d/layers/graphics/interfaces.js +1 -1
- package/views/3d/layers/graphics/polygonUtils.js +1 -1
- package/views/3d/layers/support/FastSymbolUpdates.js +1 -1
- package/views/3d/support/buffer/InterleavedLayout.js +1 -1
- package/views/3d/support/buffer/glUtil.js +1 -1
- package/views/3d/support/buffer/workerHelper.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/DefaultVertexAttributeLocations.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterialTechniqueConfiguration.js +1 -1
- package/views/interactive/tooltip/TransformTooltipInfos.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformRotate.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformScale.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflowData.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/Upload.js +5 -0
- package/widgets/Editor/UploadState.js +4 -0
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/FeatureTemplates/ItemList.js +1 -1
- package/widgets/FeatureTemplates/TemplateItem.js +1 -1
- package/widgets/FeatureTemplates.js +1 -1
- package/widgets/LayerList/LayerListViewModel.js +1 -1
- package/widgets/ScaleBar/ScaleBarViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/1ee774c3f29d8074da12.js +0 -1
- package/assets/esri/core/workers/chunks/2883a59fc1fc9e4d71af.js +0 -1
- package/assets/esri/core/workers/chunks/4d4cbfe72835c0460b09.js +0 -1
- package/assets/esri/core/workers/chunks/5bded2588008117d0c35.js +0 -1
- package/assets/esri/core/workers/chunks/9f02a0670ad73718d8f9.js +0 -1
- package/assets/esri/core/workers/chunks/ec73d16ef169adfc34fb.js +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_ar.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_bg.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_bs.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_ca.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_cs.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_da.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_de.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_el.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_en.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_es.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_et.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_fi.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_fr.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_he.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_hr.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_hu.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_id.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_it.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_ja.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_ko.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_lt.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_lv.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_nb.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_nl.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_pl.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_pt-BR.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_pt-PT.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_ro.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_ru.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_sk.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_sl.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_sr.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_sv.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_th.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_tr.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_uk.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_vi.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_zh-CN.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_zh-HK.json +0 -1
- package/assets/esri/widgets/Directions/t9n/Printout_zh-TW.json +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.27/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{destroyMaybe as h,removeMaybe as d,get as p,disposeMaybe as c,isSome as y}from"../../../../core/maybe.js";import m from"../../../../core/PooledArray.js";import{throwIfAborted as g,eachAlways as u,createDeferred as b,isAbortError as _}from"../../../../core/promiseUtils.js";import{watch as f,when as v,on as C,syncAndInitial as S,whenOnce as w}from"../../../../core/reactiveUtils.js";import{schedule as G}from"../../../../core/scheduling.js";import{property as x}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as P}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as R,isEmpty as D}from"../../../../core/accessorSupport/diffUtils.js";import{s as E,a as I,g as U}from"../../../../chunks/vec3.js";import{c as A}from"../../../../chunks/vec3f64.js";import{projectVectorToVector as O,projectXYZToVector as L,canProjectWithoutEngine as j,projectBuffer as V}from"../../../../geometry/projection.js";import{create as F,center as T,fromRect as k,equals as z}from"../../../../geometry/support/aaBoundingBox.js";import{create as W}from"../../../../geometry/support/aaBoundingRect.js";import{equals as M}from"../../../../geometry/support/spatialReferenceUtils.js";import N from"../../../../layers/Layer.js";import{getObjectId as B,computeAABB as H,hasGeometry as q}from"../../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as Y}from"../../../../layers/graphics/hydratedFeatures.js";import{isSupportedRenderer3D as $,validateTo3D as Z}from"../../../../renderers/support/rendererConversion.js";import{loadArcade as J}from"../../../../support/arcadeOnDemand.js";import{getDefaultSymbol3D as Q}from"../../../../symbols/support/defaults3D.js";import{to3D as K}from"../../../../symbols/support/symbolConversion.js";import{ViewElevationProvider as X}from"./ElevationQuery.js";import{VisibilityFlag as ee,VisibilityGroup as ie}from"./enums.js";import{extractExpressionInfo as te,createContext as re}from"./featureExpressionInfoUtils.js";import{Graphics3DFeatureStore as se}from"./Graphics3DFeatureStore.js";import ae from"./Graphics3DGraphicCreationContext.js";import{Graphics3DSymbolCreationContext as ne}from"./Graphics3DSymbolCreationContext.js";import{make as oe}from"./Graphics3DSymbolFactory.js";import le from"./Graphics3DWebStyleSymbol.js";import{GraphicStateTracking as he}from"./GraphicStateTracking.js";import{computeCentroid as de}from"./graphicUtils.js";import{ApplyRendererDiffResult as pe}from"./interfaces.js";import{LoadStatus as ce}from"./Loadable.js";import{SpatialIndex2D as ye}from"./SpatialIndex2D.js";import{averageSymbolComplexities as me,defaultSymbolComplexity as ge}from"./symbolComplexity.js";import{StageLayerElevationProvider as ue}from"../support/StageLayerElevationProvider.js";import{toBoundingRect as be}from"../../support/extentUtils.js";import{PropertiesPool as _e}from"../../support/PropertiesPool.js";import{GridLocalOriginFactory as fe}from"../../webgl-engine/lib/GridLocalOriginFactory.js";import{UpdatePolicy as ve}from"../../webgl-engine/lib/UpdatePolicy.js";import{WebGLLayer as Ce}from"../../webgl-engine/lib/WebGLLayer.js";import{ImmediateTask as Se,noBudget as we,TaskPriority as Ge,Task as xe}from"../../../support/Scheduler.js";import Pe from"../../../../geometry/Extent.js";import Re from"../../../../geometry/Point.js";import De from"../../../../symbols/LabelSymbol3D.js";import Ee from"../../../../symbols/TextSymbol.js";import Ie from"../../../../symbols/WebStyleSymbol.js";var Ue;const Ae=A(),Oe=F(),Le="esri.views.3d.layers.graphics.Graphics3DCore",je=n.getLogger(Le);let Ve=Ue=class extends t{get _viewSpatialReference(){return this.owner.view.spatialReference}get spatialIndex(){return this._spatialIndex||(this._spatialIndex=new ye({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 null!=this.currentRenderer&&"dictionary"===this.currentRenderer.type?ve.ASYNC: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||null!=this._scaleVisibility&&this._scaleVisibility.updating||null!=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,null!=s?s.primitivesPerFeature:1),n=null!=s&&s.drawCallsPerFeature>0?t/s.drawCallsPerFeature*.3:t,o=Math.ceil(r/a),l=Math.max(i,Math.min(t,o,n)),h=this._get("displayFeatureLimit");return h&&h.minimumTotalNumberOfFeatures===i&&h.maximumTotalNumberOfFeatures===t&&h.maximumTotalNumberOfPrimitives===r&&h.averageSymbolComplexity===s&&h.maximumNumberOfFeatures===l?h:{minimumTotalNumberOfFeatures:i,maximumTotalNumberOfFeatures:t,maximumTotalNumberOfPrimitives:r,averageSymbolComplexity:s,maximumNumberOfFeatures:l}}get averageSymbolComplexity(){const e=me(this._symbolComplexities),i=this._get("averageSymbolComplexity");return 0===e.numComplexities||null!=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=null!=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(null!=this.averageSymbolComplexity){const e=this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel:0;return this.averageSymbolComplexity.memory.bytesPerFeature+e}return 0}get unprocessedMemoryEstimate(){return(this._pendingAdds-this._pendingRemoves)*this.usedMemoryPerGraphic}get _symbolComplexities(){return this.currentRenderer?this._getSymbolComplexitiesUsedOrRenderer(this.currentRenderer):this._getSymbolComplexitiesUsed()}get visible(){return this._visible}_getConvertedSymbol(e){if("web-style"===e.type)return e.clone();const i=this._symbolConversionCache.get(e.id);if(null!=i)return i;const t=K(e,{geometryType:this.layer?.geometryType??void 0,retainId:!0,hasLabelingContext:this._hasLabelingContext(e)}),r=t.symbol||null;return null==r&&t.error&&je.error(t.error.message),this._symbolConversionCache.set(e.id,r),r}_getSymbolComplexitiesUsedOrRenderer(e){if(null==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);null!=s&&r.push(s);for(const a of i){const e=this._getSymbolComplexityUsedOrRenderer(a);null!=e&&r.push(e)}return r}_getSymbolComplexityUsedOrRenderer(e){if(null==e)return null;const i=this._symbols.get(e.id);if(null!=i)return i.complexity;const t=this._getConvertedSymbol(e);return null!=t?ge(t):null}_getSymbolComplexitiesUsed(){const e=[];return this._symbols.forEach((i=>{null!=i&&e.push(i.complexity)})),e}get _objectIdField(){return this.layer.objectIdField}constructor(e){super(e),this._propertiesPool=new _e({computedExtent:Pe},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=Se,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 m({allocator:e=>e||new Te,deallocator:e=>(e.clear(),e)}),this._symbolWarningLogged=!1,this._geometryWarningLogged=!1,this._objectIdInvisibleSet=new Set,this._whenSymbolRemoved=new m,this.preferredUpdatePolicy=ve.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 ne(e.owner.view.resourceController.scheduler,((e,i)=>this._frameTask.schedule(e,i)))}initialize(){this._featureStore=new se({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(null!=i.elevationAlignment){const t=i.elevationAlignment(this,e);this._elevationAlignment=t}if(null!=i.scaleVisibility){const t=i.scaleVisibility(this,e);this._scaleVisibility=t}if(null!=i.filterVisibility){const e=i.filterVisibility({featureStore:this._featureStore,getFeatureCount:()=>this.graphics3DGraphics.size,updateFeatureVisibilities:e=>this.modifyGraphics3DGraphicVisibilities((i=>i.setVisibilityFlag(ee.FILTER,e(B(i.graphic,this._objectIdField)),ie.GRAPHIC))),setAllFeaturesVisibility:e=>this.modifyGraphics3DGraphicVisibilities((i=>i.setVisibilityFlag(ee.FILTER,e,ie.GRAPHIC))),clearFeaturesVisibility:()=>this.modifyGraphics3DGraphicVisibilities((e=>e.clearVisibilityFlag(ee.FILTER)))});this._filterVisibility=e}if(null!=i.deconflictor){const e=i.deconflictor(this);this._deconflictor=e}if(null!=i.labeler&&null!=this._scaleVisibility){const e=i.labeler(this,this._scaleVisibility);this._labeler=e}if(null!=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 X(this._viewSpatialReference,i),this._initializeStage(i,this.layer.uid);const t=i.sharedSymbolResources;this.symbolCreationContext.sharedResources=t,this._sharedSymbolResourcesOwnerHandle=t.addGraphicsOwner(this.owner),null!=this.currentRenderer&&(this.symbolCreationContext.renderer=this.currentRenderer),this.symbolCreationContext.stage=this.stage,this.symbolCreationContext.streamDataRequester=t.streamDataRequester,this.symbolCreationContext.renderCoordsHelper=i.renderCoordsHelper,this.symbolCreationContext.layer=this.layer,this.symbolCreationContext.graphicsCoreOwner=this.owner,this.symbolCreationContext.localOriginFactory=new fe(i.renderSpatialReference),this.symbolCreationContext.elevationProvider=i.elevationProvider,this.symbolCreationContext.notifyGraphicGeometryChanged=e=>this.notifyGraphicGeometryChanged(e),this.symbolCreationContext.notifyGraphicVisibilityChanged=e=>this.notifyGraphicVisibilityChanged(e);const r=te(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);if(this.symbolCreationContext.featureExpressionInfoContext=await re(r,this._viewSpatialReference,e,je),g(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([f((()=>this.suspendedOrOutsideOfView),(()=>this._frameTask.reschedule((()=>this._updateLayerVisibility())))),f((()=>[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())})),f((()=>this.owner.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(!!e))),f((()=>this.owner.view.state?.rasterPixelRatio),(()=>this._pixelRatioChange())),f((()=>!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled),(e=>this._physicalBasedRenderingChange(e))),f((()=>!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods),(e=>this._skipHighSymbolLoDsChange(e))),v((()=>i.basemapTerrain?.tilingScheme),(e=>{if(e.spatialReference.equals(this.symbolCreationContext.overlaySR)||null==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([C(e,"change",(e=>{this._graphicsCollectionChanged(e),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}),{onListenerAdd:()=>{this.recreateAllGraphics(),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}})],"loaded-graphics")}}),{initial:!0}),f((()=>this.effectiveUpdatePolicy),(e=>{null!=this.stageLayer&&(this.stageLayer.updatePolicy=e),this.symbolCreationContext.isAsync=this.effectiveUpdatePolicy===ve.ASYNC,e===ve.SYNC&&this.runTask(we)}),S)]),this._frameTask=i.resourceController.scheduler.registerTask(Ge.GRAPHICS_CORE,this),this.layer&&"featureReduction"in this.layer&&this._handles.add(f((()=>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=Se,this.owner.view?.deconflictor?.removeGraphicsOwner(this),this.owner.view?.labeler?.removeGraphicsOwner(this),this._elevationAlignment=h(this._elevationAlignment),this._scaleVisibility=h(this._scaleVisibility),this._filterVisibility=h(this._filterVisibility),this._deconflictor=null,this._labeler=null,this._objectStates=h(this._objectStates),this.clear(),this._featureStore=h(this._featureStore),this._updatingPendingLoadedGraphicsChange=d(this._updatingPendingLoadedGraphicsChange),this._graphicStateTracking=h(this._graphicStateTracking),this.stage&&(this.stageLayer=h(this.stageLayer),this.stage=null),this._handles=h(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=d(this._sharedSymbolResourcesOwnerHandle),this._propertiesPool=h(this._propertiesPool),this._pendingUpdatesPool=null,this._symbolConversionCache.clear(),this._objectIdInvisibleSet.clear(),this._spatialIndex=h(this._spatialIndex)}clear(){this._objectStates?.allGraphicsDeleted(),null!=this._graphicStateTracking&&this._graphicStateTracking.allGraphicsDeleted(),this.graphics3DGraphics.forEach((e=>e.destroy())),this._spatialIndex?.clear(),this.graphics3DGraphics.clear(),this._numberOfGraphics=0,this._usedMemory=0,this._updateLayerVisibility(),this._symbols.forEach(h),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 Ce(this.stage,{pickable:!this.suspendedOrOutsideOfView,updatePolicy:this.effectiveUpdatePolicy},i);const t=this.stageLayer.events;t.on("objectTransformation",(e=>this.notifyGraphicGeometryChanged(e.graphicUid))),t.on("visibilityChanged",(e=>this.notifyGraphicVisibilityChanged(e.graphicUid))),t.on("objectGeometryAdded",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid))),t.on("objectGeometryRemoved",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid))),t.on("objectGeometryUpdated",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid)))}notifyGraphicGeometryChanged(e){if(null==this._graphicStateTracking||null==e)return;const i=this.graphics3DGraphics.get(e);i&&this._graphicStateTracking.updateGraphicGeometry(i)}notifyGraphicVisibilityChanged(e){if(null==this._graphicStateTracking||null==e)return;const i=this.graphics3DGraphics.get(e);i&&this._graphicStateTracking.updateGraphicVisibility(i)}_updateLayerVisibility(){const e=this.displayFeatureLimit.maximumNumberOfFeatures,i=this._numberOfGraphics>e*ke,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 B(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);null!=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 u([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(null!=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 xe.YIELD}setObjectIdVisibility(e,i){i?this._objectIdInvisibleSet.delete(e):this._objectIdInvisibleSet.add(e);const t=this._findGraphics3DGraphicByObjectId(e);null!=t&&this._updateUserVisibility(t)}_findGraphics3DGraphicByObjectId(e){return l(this.graphics3DGraphics,(i=>this._getGraphicObjectID(i.graphic)===e))}_updateUserVisibility(e){if(null==e)return!1;const i=e.graphic,t=this._getGraphicObjectID(i),r=i.visible&&!this.owner.suspended&&(null==t||!this._objectIdInvisibleSet.has(t));return e.setVisibilityFlag(ee.USER_SETTING,r,ie.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=b();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)=>V(e,r,i,e,t,i,s),n=(e,i,r)=>V(e,s,i,e,t,i,r),o=this._viewElevationProvider?{service:this._viewElevationProvider,useViewElevation:null!=i&&!!i.useViewElevation,minDemResolution:null!=i?i.minDemResolution:null,minDemResolutionForPoints:this.owner.view.resolution}:null,l=await e.getProjectedBoundingBox(a,n,o,p(i,"signal"));if(!l)return null;const h=l.boundingBox;if(l.requiresDrapedElevation){const e=this.symbolCreationContext.elevationProvider;if(e){T(h,Ae);const i=e.getElevation(Ae[0],Ae[1],0,t,"ground")??0;h[2]=Math.min(h[2],i),h[5]=Math.max(h[5],i)}}return{boundingBox:h,screenSpaceObjects:l.screenSpaceObjects}}async whenGraphicBounds(e,i){await w((()=>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;E(ze,0,0,0);let s=0;if(r.render.num>0){if(!O(r.render.origin,this.symbolCreationContext.renderCoordsHelper.spatialReference,We,i))return null;I(ze,ze,We),s++}if(r.draped.num>0){const[e,t]=r.draped.origin,a=this._viewElevationProvider.getElevation(e,t,"ground")??0;if(E(We,e,t,a),!O(We,this._viewElevationProvider.spatialReference,We,i))return null;I(ze,ze,We),s++}return s>1&&U(ze,ze,1/s),new Re({x:ze[0],y:ze[1],z:ze[2],spatialReference:i})}getSymbolLayerSize(e,i){const t=this._symbols.get(e.id);if(null==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(null==a)throw new r("internal:missing-size","Symbol layer has no valid size");return a}_graphicsCollectionChanged(e){this._startCreateGraphics&&(this.add(e.added),this.remove(e.removed))}graphicUpdateHandler(e){const i=e.graphic.uid,t=this.graphics3DGraphics.get(i);if(null!=t||null!=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(null==t)return void this._recreateGraphic(i.graphic);if(null==e){const e=i.graphic.symbol&&i.graphic.symbol.id;if(e){const i=this._symbols.get(e);if(null!=i&&i.loadStatus===ce.LOADING)return}return void this._recreateGraphic(i.graphic)}const r=e.graphics3DSymbol;null!=i.newValue&&r.updateGeometry(e,i.newValue)||this._recreateGraphic(e.graphic),this._expandComputedExtent(t)}_graphicUpdateSymbolHandler(e,i){const t=i.graphic,r=null!=e?e.graphics3DSymbol:null!=i.oldValue?this._symbols.get(i.oldValue.id):null;if(null==r||null==i.newValue)return void this._recreateGraphic(t);const s=r.symbol,a=this._getConvertedSymbol(i.newValue);if(null!=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=R(s,a);if(null==o)return void this._updateSymbolMapping(s.id,a);const l={diff:o,graphics3DGraphicPatches:[],symbolStatePatches:[]};if(r.prepareSymbolPatch(l),!D(l.diff))return void this._recreateGraphic(t);const h=this._getRenderingInfo(t);if(null==h)return void this._recreateGraphic(t);const d=r.extentPadding;for(const p of l.symbolStatePatches)p();if(d!==r.extentPadding&&this._recomputeExtentPadding(),null!=e)for(const p of l.graphics3DGraphicPatches)p(e,h);this._updateSymbolMapping(s.id,a)}_graphicUpdateVisibleHandler(e){this._updateUserVisibility(e)&&(this._labeler&&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===ve.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=>{null!=i&&(e=Math.max(e,i.extentPadding))})),this._set("extentPadding",e)}_expandComputedExtent(e){const i=Oe,t=e.spatialReference;H(e,i);const r=this._viewSpatialReference,s=Ue.tmpVec;if(M(t,r)||L(i[0],i[1],0,t,s,r)&&(i[0]=s[0],i[1]=s[1],L(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=te(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);this.symbolCreationContext.featureExpressionInfoContext=await re(i,this._viewSpatialReference,e.signal,je),g(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=c(this._stageLayerElevationProvider)):(!this.layer.elevationInfo||this.layer.elevationInfo&&"relative-to-scene"!==this.layer.elevationInfo.mode)&&this._numberOfGraphicsProvidingElevation>0&&(this._stageLayerElevationProvider=new ue({layer:this.layer,stageLayer:this.stageLayer,view:this.owner.view}),this.owner.view.elevationProvider.register("scene",this._stageLayerElevationProvider))}_clearSymbolsAndGraphics(){this.clear(),null!=this._filterVisibility&&this._filterVisibility.clear(),this._labeler?.reset(),this._deconflictor?.clear(),this._elevationAlignment?.clear(),this.stageLayer?.invalidateSpatialQueryAccelerator(),this._stageLayerElevationProvider&&(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=c(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);h(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),null!=this._graphicStateTracking&&this._graphicStateTracking.removeGraphic(e)}add(e){e&&0!==e.length&&(this.owner.view.basemapTerrain&&this.owner.view.basemapTerrain.tilingScheme?(this._updatePolicyForGraphics(e)===ve.ASYNC?this._addDelayed(e):this._addImmediate(e),this.notifyChange("updating")):je.error("#add()","Cannot add graphics before terrain surface has been initialized"))}_updatePolicyForGraphics(e){if(this.effectiveUpdatePolicy===ve.SYNC&&("mesh"===this.layer.geometryType||null==this.layer.geometryType))for(const i of e)if(null!=i.geometry&&"mesh"===i.geometry.type&&!i.geometry.loaded)return ve.ASYNC;return this.effectiveUpdatePolicy}_addImmediate(e){this._geometryWarningLogged=!1,this._symbolWarningLogged=!1;for(const i of e)this._addGraphic(i,this._getRenderingInfo(i,je),ve.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!==Fe.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===ve.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===Fe.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)&&je.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===Fe.NEW&&this._processPendingUpdateNew(t);let r=this.effectiveUpdatePolicy;if(!t.remove||t.add&&t.state!==Fe.READY||(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(t.remove),t.remove=null,r=ve.SYNC),t.add)switch(t.state){case Fe.READY:this._addGraphic(t.add,t.renderingInfo,r),t.add=null,this._pendingAdds--,e.madeProgress();break;case Fe.REJECTED:t.add=null,this._pendingAdds--;case Fe.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=Fe.READY);const i=e.add.geometry;null==i||"mesh"!==i.type||i.loaded?this._processPendingUpdateNewRenderingInfo(e):this._processPendingUpdateNewMesh(e,i)}async _processPendingUpdateNewMesh(e,i){e.state=Fe.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,_(i)?e.state=Fe.NEW:e.state=Fe.REJECTED}async _processPendingUpdateNewRenderingInfo(e){if(null==this.layer.renderer||"dictionary"!==this.layer.renderer.type)return e.renderingInfo=this._getRenderingInfo(e.add,je),void(e.state=Fe.READY);e.state=Fe.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(_(t)?e.state=Fe.NEW:e.state=Fe.REJECTED)}null==i||null==i.symbol?(je&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,je.warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),e.renderingInfo=null):e.renderingInfo=i,e.state=Fe.READY}_addGraphic(e,i,t){if(this._graphicsWithoutSymbol.set(e.uid,e),null==i||null==i.symbol||!q(e))return;null!=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(null==s)return;this._expandComputedExtent(e.geometry);const a=this._beginGraphicUpdate(e),n=new ae(e,i,this.layer);let o=!1;const l=e=>{e===s.symbol.id&&(o=!0)};this._whenSymbolRemoved.push(l);const h=()=>{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&&null!=i&&this._spatialIndex.add(i),--s.referenced,this._endGraphicUpdate(e)}this._featureStore.events.emit("changed"),this._labeler&&this.owner.view.labeler.setDirty()},d=i=>{--this._loadingSymbols,this.destroyed||(this._whenSymbolRemoved.removeUnordered(l),o||(_(i)?this.add([e]):s.destroyed||this._endGraphicUpdate(e)))};++this._loadingSymbols,t===ve.ASYNC?s.load((()=>this._frameTask.schedule(h)),(e=>this._frameTask.schedule((()=>d(e))))):s.load(h,d)}_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 De||e instanceof Ee){const i=this.symbolCreationContext.layer;return!!i.labelingInfo&&i.labelingInfo.some((i=>i.symbol===e))}return!1}_hasValidSymbolCreationContext(e){return!(e instanceof De&&!this._hasLabelingContext(e))||(je.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(null==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(!j(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&&null!=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?Y(e,this.layer):e;let s;if(this.owner.getRenderingInfo&&(this.getRenderingInfoWithoutRenderer||null!=this.currentRenderer))s=this.owner.getRenderingInfo(r,this.currentRenderer,this._arcadeOnDemand);else{s={symbol:r.symbol||Q(r.geometry)}}return null==s||null==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){if(null==e.geometry)return je&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,je.warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return je&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,je.warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const t=this.rendererHasGeometryOperations?Y(e,this.layer):e;return this.owner.getRenderingInfoAsync(t,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(null!=i&&"backgroundFillSymbol"in i&&i.backgroundFillSymbol){const e=K(i.backgroundFillSymbol,{ignoreDrivers:!0});null!=e.symbol&&"web-style"!==e.symbol.type&&"cim"!==e.symbol.type&&(r=e.symbol.symbolLayers)}const s=oe(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 Ie?new le(e,(e=>this._frameTask.schedule(e)),(e=>this._createGraphics3DSymbol(e,i))):this._createGraphics3DSymbol(e,i),this._symbols.set(e.id,t)),null!=t&&++t.referenced,t}trackGraphicState(e){return null==this._graphicStateTracking&&(this._graphicStateTracking=new he(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(null==r)return null;this._addGraphics3DGraphic(r);const s=e.symbol.id;this._graphicsBySymbol.has(s)||this._graphicsBySymbol.set(s,new Map),this._graphicsBySymbol.get(s).set(t.uid,r);if(r.isDraped&&this._graphicsDrapedUids.add(t.uid),r.centroid=null,null!=t.geometry&&"point"!==t.geometry.type&&(r.centroid=de(t.geometry,this._viewSpatialReference)),this._updateUserVisibility(r),null!=this._scaleVisibility&&this._scaleVisibility.updateVisibility(r),null!=this._filterVisibility){const{defaultVisibility:e}=this._filterVisibility;r.setVisibilityFlag(ee.FILTER,e,ie.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.stageLayer,this.owner),null!=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),null==e&&this._currentRendererChange(null,!1),$(e))if(null!=e&&e.arcadeRequired){const i=new AbortController;this._rendererChangeAbortController=i;const{arcadeUtils:t}=await this._ensureArcade();g(i);const r=t.hasGeometryOperations(e);r&&(await t.enableGeometryOperations(),g(i)),this.effectiveUpdatePolicy===ve.ASYNC?await this._frameTask.schedule((()=>this._currentRendererChange(e,r)),i.signal):this._currentRendererChange(e,r),this._rendererChangeAbortController=null}else if(this.effectiveUpdatePolicy===ve.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 null==this._arcadeOnDemand?(this._arcadeOnDemand=await J(),this._arcadeOnDemand):this._arcadeOnDemand}_currentRendererChange(e,i){this.currentRenderer=e,this.rendererHasGeometryOperations=i,this.symbolCreationContext.arcade=this._arcadeOnDemand;const t=this.symbolCreationContext.renderer;if(e===t)return;if(this._symbolConversionCache.clear(),null==e)return this.symbolCreationContext.renderer=null,void this.recreateAllGraphicsAndSymbols();const r=R(t,e);this._updateUnchangedSymbolMappings(r,e,t),this.symbolCreationContext.renderer=e,null!=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 N?this.layer:null,h=this._arcadeOnDemand;if(s===t.defaultSymbol&&t.getSymbol(Y(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(y):[],n=s?s.removed.map((e=>e.symbol)).filter(y):[];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||null!=e&&"partial"!==e.type)return[];const r=e=>null!=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=null!=i&&i?"string"==typeof i?i:i.id:null;if(null==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),null!=s)){const e="string"==typeof i?null:i;null!=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(null!=r)switch(r.applyRendererDiff(e,t)){case pe.Recreate_Symbol:this._recreateSymbol(i);break;case pe.Recreate_Graphics:this._recreateGraphicsForSymbol(i);case pe.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)=>{e.globalPropertyChanged("skipHighSymbolLods",i)||this._recreateSymbol(t)}))}_pixelRatioChange(){this.forEachGraphics3DSymbol(((e,i,t)=>{e.globalPropertyChanged("pixelRatio",i)||this._recreateSymbol(t)}))}_signalUpdatingDuringAsyncLoadedGraphicsChange(){this._updatingPendingLoadedGraphicsChange&&this._updatingPendingLoadedGraphicsChange.remove(),this._updatingPendingLoadedGraphicsChange=G((()=>{this._updatingPendingLoadedGraphicsChange=null}))}setClippingExtent(e,i){const t=this.symbolCreationContext.clippingExtent,r=W();return be(e,r,i)?this.symbolCreationContext.clippingExtent=k(F(),r):this.symbolCreationContext.clippingExtent=null,!z(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(null==t)return;e(t,this._graphicsBySymbol.get(i)||Me,i)}}updateAllGraphicsVisibility(){null!=this._filterVisibility&&this._filterVisibility.reapply(),this.modifyGraphics3DGraphicVisibilities((e=>{const i=this._updateUserVisibility(e),t=null!=this._scaleVisibility&&this._scaleVisibility.updateVisibility(e);return i||t}))}_hideAllGraphics(){this.modifyGraphics3DGraphicVisibilities((e=>e.setVisibilityFlag(ee.USER_SETTING,!1,ie.GRAPHIC)))}_validateRenderer(e){const i=Z(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`;je.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(null==i||i.referenced>0)return;const r=this._graphicsBySymbol.get(t);r&&0!==r.size||(this._graphicsBySymbol.delete(t),this._symbols.delete(t),h(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 Fe;Ve.tmpVec=A(),e([x({readOnly:!0})],Ve.prototype,"computedExtent",void 0),e([x()],Ve.prototype,"currentRenderer",void 0),e([x()],Ve.prototype,"rendererHasGeometryOperations",void 0),e([x()],Ve.prototype,"_frameTask",void 0),e([x({readOnly:!0})],Ve.prototype,"_viewSpatialReference",null),e([x()],Ve.prototype,"_rendererChangeAbortController",void 0),e([x()],Ve.prototype,"_elevationInfoChangeAbortController",void 0),e([x()],Ve.prototype,"_initializeAbortController",void 0),e([x()],Ve.prototype,"_elevationAlignment",void 0),e([x()],Ve.prototype,"_scaleVisibility",void 0),e([x()],Ve.prototype,"_filterVisibility",void 0),e([x()],Ve.prototype,"_initializePromise",void 0),e([x()],Ve.prototype,"_spatialIndex",void 0),e([x({readOnly:!0})],Ve.prototype,"extentPadding",void 0),e([x()],Ve.prototype,"_updatingPendingLoadedGraphicsChange",void 0),e([x()],Ve.prototype,"_featureStore",void 0),e([x()],Ve.prototype,"_deconflictor",void 0),e([x()],Ve.prototype,"_labeler",void 0),e([x()],Ve.prototype,"_objectStates",void 0),e([x()],Ve.prototype,"_loadingSymbols",void 0),e([x()],Ve.prototype,"preferredUpdatePolicy",void 0),e([x()],Ve.prototype,"_forcedUpdatePolicy",void 0),e([x({readOnly:!0})],Ve.prototype,"effectiveUpdatePolicy",null),e([x({constructOnly:!0})],Ve.prototype,"elevationFeatureExpressionEnabled",void 0),e([x({constructOnly:!0})],Ve.prototype,"owner",void 0),e([x({constructOnly:!0})],Ve.prototype,"layer",void 0),e([x({constructOnly:!0})],Ve.prototype,"graphicSymbolSupported",void 0),e([x({constructOnly:!0})],Ve.prototype,"getRenderingInfoWithoutRenderer",void 0),e([x({constructOnly:!0})],Ve.prototype,"componentFactories",void 0),e([x({constructOnly:!0})],Ve.prototype,"setUidToIdOnAdd",void 0),e([x()],Ve.prototype,"featureStore",null),e([x()],Ve.prototype,"initializePromise",null),e([x()],Ve.prototype,"scaleVisibility",null),e([x()],Ve.prototype,"elevationAlignment",null),e([x()],Ve.prototype,"objectStates",null),e([x()],Ve.prototype,"filterVisibility",null),e([x({readOnly:!0})],Ve.prototype,"updating",null),e([x({readOnly:!0})],Ve.prototype,"running",null),e([x({readOnly:!0})],Ve.prototype,"suspendedOrOutsideOfView",null),e([x({readOnly:!0,dependsOn:[]})],Ve.prototype,"updatingRemaining",null),e([x({readOnly:!0,dependsOn:["owner.view.qualitySettings.graphics3D.maxTotalNumberOfPrimitives","owner.view.qualitySettings.graphics3D.maxTotalNumberOfFeatures","averageSymbolComplexity"]})],Ve.prototype,"displayFeatureLimit",null),e([x({readOnly:!0,dependsOn:[]})],Ve.prototype,"averageSymbolComplexity",null),e([x({constructOnly:!0})],Ve.prototype,"hasZ",void 0),e([x({constructOnly:!0})],Ve.prototype,"hasM",void 0),e([x()],Ve.prototype,"_objectIdField",null),Ve=Ue=e([P(Le)],Ve),function(e){e[e.NEW=0]="NEW",e[e.LOADING=1]="LOADING",e[e.READY=2]="READY",e[e.REJECTED=3]="REJECTED"}(Fe||(Fe={}));class Te{constructor(){this.add=null,this.renderingInfo=null,this.state=Fe.NEW,this.abortController=null,this.remove=null}clear(){this.add=null,this.renderingInfo=null,this.state=Fe.NEW,this.abortController=null,this.remove=null}}const ke=10,ze=A(),We=A(),Me=new Map;export{Ve 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{destroyMaybe as h,removeMaybe as d,get as p,disposeMaybe as c,isSome as y}from"../../../../core/maybe.js";import m from"../../../../core/PooledArray.js";import{throwIfAborted as g,eachAlways as u,createDeferred as b,isAbortError as _}from"../../../../core/promiseUtils.js";import{watch as f,when as v,on as C,syncAndInitial as S,whenOnce as w}from"../../../../core/reactiveUtils.js";import{schedule as G}from"../../../../core/scheduling.js";import{property as x}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import{subclass as P}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as R,isEmpty as D}from"../../../../core/accessorSupport/diffUtils.js";import{s as E,a as I,g as U}from"../../../../chunks/vec3.js";import{c as A}from"../../../../chunks/vec3f64.js";import{projectVectorToVector as O,projectXYZToVector as L,canProjectWithoutEngine as j,projectBuffer as V}from"../../../../geometry/projection.js";import{create as F,center as T,fromRect as k,equals as z}from"../../../../geometry/support/aaBoundingBox.js";import{create as W}from"../../../../geometry/support/aaBoundingRect.js";import{equals as M}from"../../../../geometry/support/spatialReferenceUtils.js";import N from"../../../../layers/Layer.js";import{getObjectId as B,computeAABB as H,hasGeometry as q}from"../../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as Y}from"../../../../layers/graphics/hydratedFeatures.js";import{isSupportedRenderer3D as $,validateTo3D as Z}from"../../../../renderers/support/rendererConversion.js";import{loadArcade as J}from"../../../../support/arcadeOnDemand.js";import{getDefaultSymbol3D as Q}from"../../../../symbols/support/defaults3D.js";import{to3D as K}from"../../../../symbols/support/symbolConversion.js";import{ViewElevationProvider as X}from"./ElevationQuery.js";import{VisibilityFlag as ee,VisibilityGroup as ie}from"./enums.js";import{extractExpressionInfo as te,createContext as re}from"./featureExpressionInfoUtils.js";import{Graphics3DFeatureStore as se}from"./Graphics3DFeatureStore.js";import ae from"./Graphics3DGraphicCreationContext.js";import{Graphics3DSymbolCreationContext as ne}from"./Graphics3DSymbolCreationContext.js";import{make as oe}from"./Graphics3DSymbolFactory.js";import le from"./Graphics3DWebStyleSymbol.js";import{GraphicStateTracking as he}from"./GraphicStateTracking.js";import{computeCentroid as de}from"./graphicUtils.js";import{ApplyRendererDiffResult as pe}from"./interfaces.js";import{LoadStatus as ce}from"./Loadable.js";import{SpatialIndex2D as ye}from"./SpatialIndex2D.js";import{averageSymbolComplexities as me,defaultSymbolComplexity as ge}from"./symbolComplexity.js";import{StageLayerElevationProvider as ue}from"../support/StageLayerElevationProvider.js";import{toBoundingRect as be}from"../../support/extentUtils.js";import{PropertiesPool as _e}from"../../support/PropertiesPool.js";import{GridLocalOriginFactory as fe}from"../../webgl-engine/lib/GridLocalOriginFactory.js";import{UpdatePolicy as ve}from"../../webgl-engine/lib/UpdatePolicy.js";import{WebGLLayer as Ce}from"../../webgl-engine/lib/WebGLLayer.js";import{ImmediateTask as Se,noBudget as we,TaskPriority as Ge,Task as xe}from"../../../support/Scheduler.js";import Pe from"../../../../geometry/Extent.js";import Re from"../../../../geometry/Point.js";import De from"../../../../symbols/LabelSymbol3D.js";import Ee from"../../../../symbols/TextSymbol.js";import Ie from"../../../../symbols/WebStyleSymbol.js";var Ue;const Ae=A(),Oe=F(),Le="esri.views.3d.layers.graphics.Graphics3DCore",je=n.getLogger(Le);let Ve=Ue=class extends t{get _viewSpatialReference(){return this.owner.view.spatialReference}get spatialIndex(){return this._spatialIndex||(this._spatialIndex=new ye({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 null!=this.currentRenderer&&"dictionary"===this.currentRenderer.type?ve.ASYNC: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||null!=this._scaleVisibility&&this._scaleVisibility.updating||null!=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,null!=s?s.primitivesPerFeature:1),n=null!=s&&s.drawCallsPerFeature>0?t/s.drawCallsPerFeature*.3:t,o=Math.ceil(r/a),l=Math.max(i,Math.min(t,o,n)),h=this._get("displayFeatureLimit");return h&&h.minimumTotalNumberOfFeatures===i&&h.maximumTotalNumberOfFeatures===t&&h.maximumTotalNumberOfPrimitives===r&&h.averageSymbolComplexity===s&&h.maximumNumberOfFeatures===l?h:{minimumTotalNumberOfFeatures:i,maximumTotalNumberOfFeatures:t,maximumTotalNumberOfPrimitives:r,averageSymbolComplexity:s,maximumNumberOfFeatures:l}}get averageSymbolComplexity(){const e=me(this._symbolComplexities),i=this._get("averageSymbolComplexity");return 0===e.numComplexities||null!=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=null!=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(null!=this.averageSymbolComplexity){const e=this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel:0;return this.averageSymbolComplexity.memory.bytesPerFeature+e}return 0}get unprocessedMemoryEstimate(){return(this._pendingAdds-this._pendingRemoves)*this.usedMemoryPerGraphic}get _symbolComplexities(){return this.currentRenderer?this._getSymbolComplexitiesUsedOrRenderer(this.currentRenderer):this._getSymbolComplexitiesUsed()}get visible(){return this._visible}_getConvertedSymbol(e){if("web-style"===e.type)return e.clone();const i=this._symbolConversionCache.get(e.id);if(null!=i)return i;const t=K(e,{geometryType:this.layer?.geometryType??void 0,retainId:!0,hasLabelingContext:this._hasLabelingContext(e)}),r=t.symbol||null;return null==r&&t.error&&je.error(t.error.message),this._symbolConversionCache.set(e.id,r),r}_getSymbolComplexitiesUsedOrRenderer(e){if(null==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);null!=s&&r.push(s);for(const a of i){const e=this._getSymbolComplexityUsedOrRenderer(a);null!=e&&r.push(e)}return r}_getSymbolComplexityUsedOrRenderer(e){if(null==e)return null;const i=this._symbols.get(e.id);if(null!=i)return i.complexity;const t=this._getConvertedSymbol(e);return null!=t?ge(t):null}_getSymbolComplexitiesUsed(){const e=[];return this._symbols.forEach((i=>{null!=i&&e.push(i.complexity)})),e}get _objectIdField(){return this.layer.objectIdField}constructor(e){super(e),this._propertiesPool=new _e({computedExtent:Pe},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=Se,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 m({allocator:e=>e||new Te,deallocator:e=>(e.clear(),e)}),this._symbolWarningLogged=!1,this._geometryWarningLogged=!1,this._objectIdInvisibleSet=new Set,this._whenSymbolRemoved=new m,this.preferredUpdatePolicy=ve.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 ne(e.owner.view.resourceController.scheduler,((e,i)=>this._frameTask.schedule(e,i)))}initialize(){this._featureStore=new se({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(null!=i.elevationAlignment){const t=i.elevationAlignment(this,e);this._elevationAlignment=t}if(null!=i.scaleVisibility){const t=i.scaleVisibility(this,e);this._scaleVisibility=t}if(null!=i.filterVisibility){const e=i.filterVisibility({featureStore:this._featureStore,getFeatureCount:()=>this.graphics3DGraphics.size,updateFeatureVisibilities:e=>this.modifyGraphics3DGraphicVisibilities((i=>i.setVisibilityFlag(ee.FILTER,e(B(i.graphic,this._objectIdField)),ie.GRAPHIC))),setAllFeaturesVisibility:e=>this.modifyGraphics3DGraphicVisibilities((i=>i.setVisibilityFlag(ee.FILTER,e,ie.GRAPHIC))),clearFeaturesVisibility:()=>this.modifyGraphics3DGraphicVisibilities((e=>e.clearVisibilityFlag(ee.FILTER)))});this._filterVisibility=e}if(null!=i.deconflictor){const e=i.deconflictor(this);this._deconflictor=e}if(null!=i.labeler&&null!=this._scaleVisibility){const e=i.labeler(this,this._scaleVisibility);this._labeler=e}if(null!=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 X(this._viewSpatialReference,i),this._initializeStage(i,this.layer.uid);const t=i.sharedSymbolResources;this.symbolCreationContext.sharedResources=t,this._sharedSymbolResourcesOwnerHandle=t.addGraphicsOwner(this.owner),null!=this.currentRenderer&&(this.symbolCreationContext.renderer=this.currentRenderer),this.symbolCreationContext.stage=this.stage,this.symbolCreationContext.streamDataRequester=t.streamDataRequester,this.symbolCreationContext.renderCoordsHelper=i.renderCoordsHelper,this.symbolCreationContext.layer=this.layer,this.symbolCreationContext.graphicsCoreOwner=this.owner,this.symbolCreationContext.localOriginFactory=new fe(i.renderSpatialReference),this.symbolCreationContext.elevationProvider=i.elevationProvider,this.symbolCreationContext.notifyGraphicGeometryChanged=e=>this.notifyGraphicGeometryChanged(e),this.symbolCreationContext.notifyGraphicVisibilityChanged=e=>this.notifyGraphicVisibilityChanged(e);const r=te(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);if(this.symbolCreationContext.featureExpressionInfoContext=await re(r,this._viewSpatialReference,e,je),g(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([f((()=>this.suspendedOrOutsideOfView),(()=>this._frameTask.reschedule((()=>this._updateLayerVisibility())))),f((()=>[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())})),f((()=>this.owner.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(!!e))),f((()=>this.owner.view.state?.rasterPixelRatio),(()=>this._pixelRatioChange())),f((()=>!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled),(e=>this._physicalBasedRenderingChange(e))),f((()=>!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods),(e=>this._skipHighSymbolLoDsChange(e))),v((()=>i.basemapTerrain?.tilingScheme),(e=>{if(e.spatialReference.equals(this.symbolCreationContext.overlaySR)||null==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([C(e,"change",(e=>{this._graphicsCollectionChanged(e),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}),{onListenerAdd:()=>{this.recreateAllGraphics(),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}})],"loaded-graphics")}}),{initial:!0}),f((()=>this.effectiveUpdatePolicy),(e=>{null!=this.stageLayer&&(this.stageLayer.updatePolicy=e),this.symbolCreationContext.isAsync=this.effectiveUpdatePolicy===ve.ASYNC,e===ve.SYNC&&this.runTask(we)}),S)]),this._frameTask=i.resourceController.scheduler.registerTask(Ge.GRAPHICS_CORE,this),this.layer&&"featureReduction"in this.layer&&this._handles.add(f((()=>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=Se,this.owner.view?.deconflictor?.removeGraphicsOwner(this),this.owner.view?.labeler?.removeGraphicsOwner(this),this._elevationAlignment=h(this._elevationAlignment),this._scaleVisibility=h(this._scaleVisibility),this._filterVisibility=h(this._filterVisibility),this._deconflictor=null,this._labeler=null,this._objectStates=h(this._objectStates),this.clear(),this._featureStore=h(this._featureStore),this._updatingPendingLoadedGraphicsChange=d(this._updatingPendingLoadedGraphicsChange),this._graphicStateTracking=h(this._graphicStateTracking),this.stage&&(this.stageLayer=h(this.stageLayer),this.stage=null),this._handles=h(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=d(this._sharedSymbolResourcesOwnerHandle),this._propertiesPool=h(this._propertiesPool),this._pendingUpdatesPool=null,this._symbolConversionCache.clear(),this._objectIdInvisibleSet.clear(),this._spatialIndex=h(this._spatialIndex)}clear(){this._objectStates?.allGraphicsDeleted(),null!=this._graphicStateTracking&&this._graphicStateTracking.allGraphicsDeleted(),this.graphics3DGraphics.forEach((e=>e.destroy())),this._spatialIndex?.clear(),this.graphics3DGraphics.clear(),this._numberOfGraphics=0,this._usedMemory=0,this._updateLayerVisibility(),this._symbols.forEach(h),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 Ce(this.stage,{pickable:!this.suspendedOrOutsideOfView,updatePolicy:this.effectiveUpdatePolicy},i);const t=this.stageLayer.events;t.on("objectTransformation",(e=>this.notifyGraphicGeometryChanged(e.graphicUid))),t.on("visibilityChanged",(e=>this.notifyGraphicVisibilityChanged(e.graphicUid))),t.on("objectGeometryAdded",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid))),t.on("objectGeometryRemoved",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid))),t.on("objectGeometryUpdated",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid)))}notifyGraphicGeometryChanged(e){if(null==this._graphicStateTracking||null==e)return;const i=this.graphics3DGraphics.get(e);i&&this._graphicStateTracking.updateGraphicGeometry(i)}notifyGraphicVisibilityChanged(e){if(null==this._graphicStateTracking||null==e)return;const i=this.graphics3DGraphics.get(e);i&&this._graphicStateTracking.updateGraphicVisibility(i)}_updateLayerVisibility(){const e=this.displayFeatureLimit.maximumNumberOfFeatures,i=this._numberOfGraphics>e*ke,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 B(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);null!=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 u([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(null!=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 xe.YIELD}setObjectIdVisibility(e,i){i?this._objectIdInvisibleSet.delete(e):this._objectIdInvisibleSet.add(e);const t=this._findGraphics3DGraphicByObjectId(e);null!=t&&this._updateUserVisibility(t)}_findGraphics3DGraphicByObjectId(e){return l(this.graphics3DGraphics,(i=>this._getGraphicObjectID(i.graphic)===e))}_updateUserVisibility(e){if(null==e)return!1;const i=e.graphic,t=this._getGraphicObjectID(i),r=i.visible&&!this.owner.suspended&&(null==t||!this._objectIdInvisibleSet.has(t));return e.setVisibilityFlag(ee.USER_SETTING,r,ie.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=b();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)=>V(e,r,i,e,t,i,s),n=(e,i,r)=>V(e,s,i,e,t,i,r),o=this._viewElevationProvider?{service:this._viewElevationProvider,useViewElevation:null!=i&&!!i.useViewElevation,minDemResolution:null!=i?i.minDemResolution:null,minDemResolutionForPoints:this.owner.view.resolution}:null,l=await e.getProjectedBoundingBox(a,n,o,p(i,"signal"));if(!l)return null;const h=l.boundingBox;if(l.requiresDrapedElevation){const e=this.symbolCreationContext.elevationProvider;if(e){T(h,Ae);const i=e.getElevation(Ae[0],Ae[1],0,t,"ground")??0;h[2]=Math.min(h[2],i),h[5]=Math.max(h[5],i)}}return{boundingBox:h,screenSpaceObjects:l.screenSpaceObjects}}async whenGraphicBounds(e,i){await w((()=>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;E(ze,0,0,0);let s=0;if(r.render.num>0){if(!O(r.render.origin,this.symbolCreationContext.renderCoordsHelper.spatialReference,We,i))return null;I(ze,ze,We),s++}if(r.draped.num>0){const[e,t]=r.draped.origin,a=this._viewElevationProvider.getElevation(e,t,"ground")??0;if(E(We,e,t,a),!O(We,this._viewElevationProvider.spatialReference,We,i))return null;I(ze,ze,We),s++}return s>1&&U(ze,ze,1/s),new Re({x:ze[0],y:ze[1],z:ze[2],spatialReference:i})}getSymbolLayerSize(e,i){const t=this._symbols.get(e.id);if(null==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(null==a)throw new r("internal:missing-size","Symbol layer has no valid size");return a}_graphicsCollectionChanged(e){this._startCreateGraphics&&(this.add(e.added),this.remove(e.removed))}graphicUpdateHandler(e){const i=e.graphic.uid,t=this.graphics3DGraphics.get(i);if(null!=t||null!=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(null==t)return void this._recreateGraphic(i.graphic);if(null==e){const e=i.graphic.symbol&&i.graphic.symbol.id;if(e){const i=this._symbols.get(e);if(null!=i&&i.loadStatus===ce.LOADING)return}return void this._recreateGraphic(i.graphic)}const r=e.graphics3DSymbol;null!=i.newValue&&r.updateGeometry(e,i.newValue)||this._recreateGraphic(e.graphic),this._expandComputedExtent(t)}_graphicUpdateSymbolHandler(e,i){const t=i.graphic,r=null!=e?e.graphics3DSymbol:null!=i.oldValue?this._symbols.get(i.oldValue.id):null;if(null==r||null==i.newValue)return void this._recreateGraphic(t);const s=r.symbol,a=this._getConvertedSymbol(i.newValue);if(null!=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=R(s,a);if(null==o)return void this._updateSymbolMapping(s.id,a);const l={diff:o,graphics3DGraphicPatches:[],symbolStatePatches:[]};if(r.prepareSymbolPatch(l),!D(l.diff))return void this._recreateGraphic(t);const h=this._getRenderingInfo(t);if(null==h)return void this._recreateGraphic(t);const d=r.extentPadding;for(const p of l.symbolStatePatches)p();if(d!==r.extentPadding&&this._recomputeExtentPadding(),null!=e)for(const p of l.graphics3DGraphicPatches)p(e,h);this._updateSymbolMapping(s.id,a)}_graphicUpdateVisibleHandler(e){this._updateUserVisibility(e)&&(this._labeler&&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===ve.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=>{null!=i&&(e=Math.max(e,i.extentPadding))})),this._set("extentPadding",e)}_expandComputedExtent(e){const i=Oe,t=e.spatialReference;H(e,i);const r=this._viewSpatialReference,s=Ue.tmpVec;if(M(t,r)||L(i[0],i[1],0,t,s,r)&&(i[0]=s[0],i[1]=s[1],L(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=te(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);this.symbolCreationContext.featureExpressionInfoContext=await re(i,this._viewSpatialReference,e.signal,je),g(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=c(this._stageLayerElevationProvider)):(!this.layer.elevationInfo||this.layer.elevationInfo&&"relative-to-scene"!==this.layer.elevationInfo.mode)&&this._numberOfGraphicsProvidingElevation>0&&(this._stageLayerElevationProvider=new ue({layer:this.layer,stageLayer:this.stageLayer,view:this.owner.view}),this.owner.view.elevationProvider.register("scene",this._stageLayerElevationProvider))}_clearSymbolsAndGraphics(){this.clear(),null!=this._filterVisibility&&this._filterVisibility.clear(),this._labeler?.reset(),this._deconflictor?.clear(),this._elevationAlignment?.clear(),this.stageLayer?.invalidateSpatialQueryAccelerator(),this._stageLayerElevationProvider&&(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=c(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);h(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),null!=this._graphicStateTracking&&this._graphicStateTracking.removeGraphic(e)}add(e){e&&0!==e.length&&(this.owner.view.basemapTerrain&&this.owner.view.basemapTerrain.tilingScheme?(this._updatePolicyForGraphics(e)===ve.ASYNC?this._addDelayed(e):this._addImmediate(e),this.notifyChange("updating")):je.error("#add()","Cannot add graphics before terrain surface has been initialized"))}_updatePolicyForGraphics(e){if(this.effectiveUpdatePolicy===ve.SYNC&&("mesh"===this.layer.geometryType||null==this.layer.geometryType))for(const i of e)if(null!=i.geometry&&"mesh"===i.geometry.type&&!i.geometry.loaded)return ve.ASYNC;return this.effectiveUpdatePolicy}_addImmediate(e){this._geometryWarningLogged=!1,this._symbolWarningLogged=!1;for(const i of e)this._addGraphic(i,this._getRenderingInfo(i,je),ve.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!==Fe.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===ve.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===Fe.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)&&je.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===Fe.NEW&&this._processPendingUpdateNew(t);let r=this.effectiveUpdatePolicy;if(!t.remove||t.add&&t.state!==Fe.READY||(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(t.remove),t.remove=null,r=ve.SYNC),t.add)switch(t.state){case Fe.READY:this._addGraphic(t.add,t.renderingInfo,r),t.add=null,this._pendingAdds--,e.madeProgress();break;case Fe.REJECTED:t.add=null,this._pendingAdds--;case Fe.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=Fe.READY);const i=e.add.geometry;null==i||"mesh"!==i.type||i.loaded?this._processPendingUpdateNewRenderingInfo(e):this._processPendingUpdateNewMesh(e,i)}async _processPendingUpdateNewMesh(e,i){e.state=Fe.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,_(i)?e.state=Fe.NEW:e.state=Fe.REJECTED}async _processPendingUpdateNewRenderingInfo(e){if(null==this.layer.renderer||"dictionary"!==this.layer.renderer.type)return e.renderingInfo=this._getRenderingInfo(e.add,je),void(e.state=Fe.READY);e.state=Fe.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(_(t)?e.state=Fe.NEW:e.state=Fe.REJECTED)}null==i||null==i.symbol?(je&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,je.warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),e.renderingInfo=null):e.renderingInfo=i,e.state=Fe.READY}_addGraphic(e,i,t){if(this._graphicsWithoutSymbol.set(e.uid,e),null==i||null==i.symbol||!q(e))return;null!=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(null==s)return;this._expandComputedExtent(e.geometry);const a=this._beginGraphicUpdate(e),n=new ae(e,i,this.layer);let o=!1;const l=e=>{e===s.symbol.id&&(o=!0)};this._whenSymbolRemoved.push(l);const h=()=>{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&&null!=i&&this._spatialIndex.add(i),--s.referenced,this._endGraphicUpdate(e)}this._featureStore.events.emit("changed"),this._labeler&&this.owner.view.labeler.setDirty()},d=i=>{--this._loadingSymbols,this.destroyed||(this._whenSymbolRemoved.removeUnordered(l),o||(_(i)?this.add([e]):s.destroyed||this._endGraphicUpdate(e)))};++this._loadingSymbols,t===ve.ASYNC?s.load((()=>this._frameTask.schedule(h)),(e=>this._frameTask.schedule((()=>d(e))))):s.load(h,d)}_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 De||e instanceof Ee){const i=this.symbolCreationContext.layer;return!!i.labelingInfo&&i.labelingInfo.some((i=>i.symbol===e))}return!1}_hasValidSymbolCreationContext(e){return!(e instanceof De&&!this._hasLabelingContext(e))||(je.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(null==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(!j(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&&null!=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?Y(e,this.layer):e;let s;if(this.owner.getRenderingInfo&&(this.getRenderingInfoWithoutRenderer||null!=this.currentRenderer))s=this.owner.getRenderingInfo(r,this.currentRenderer,this._arcadeOnDemand);else{s={symbol:r.symbol||Q(r.geometry)}}return null==s||null==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){if(null==e.geometry)return je&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,je.warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return je&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,je.warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const t=this.rendererHasGeometryOperations?Y(e,this.layer):e;return this.owner.getRenderingInfoAsync(t,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(null!=i&&"backgroundFillSymbol"in i&&i.backgroundFillSymbol){const e=K(i.backgroundFillSymbol,{ignoreDrivers:!0});null!=e.symbol&&"web-style"!==e.symbol.type&&"cim"!==e.symbol.type&&(r=e.symbol.symbolLayers)}const s=oe(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 Ie?new le(e,(e=>this._frameTask.schedule(e)),(e=>this._createGraphics3DSymbol(e,i))):this._createGraphics3DSymbol(e,i),this._symbols.set(e.id,t)),null!=t&&++t.referenced,t}trackGraphicState(e){return null==this._graphicStateTracking&&(this._graphicStateTracking=new he(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(null==r)return null;this._addGraphics3DGraphic(r);const s=e.symbol.id;this._graphicsBySymbol.has(s)||this._graphicsBySymbol.set(s,new Map),this._graphicsBySymbol.get(s).set(t.uid,r);if(r.isDraped&&this._graphicsDrapedUids.add(t.uid),r.centroid=null,null!=t.geometry&&"point"!==t.geometry.type&&(r.centroid=de(t.geometry,this._viewSpatialReference)),this._updateUserVisibility(r),null!=this._scaleVisibility&&this._scaleVisibility.updateVisibility(r),null!=this._filterVisibility){const{defaultVisibility:e}=this._filterVisibility;r.setVisibilityFlag(ee.FILTER,e,ie.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.stageLayer,this.owner),null!=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),null==e&&this._currentRendererChange(null,!1),$(e))if(null!=e&&e.arcadeRequired){const i=new AbortController;this._rendererChangeAbortController=i;const{arcadeUtils:t}=await this._ensureArcade();g(i);const r=t.hasGeometryOperations(e);r&&(await t.enableGeometryOperations(),g(i)),this.effectiveUpdatePolicy===ve.ASYNC?await this._frameTask.schedule((()=>this._currentRendererChange(e,r)),i.signal):this._currentRendererChange(e,r),this._rendererChangeAbortController=null}else if(this.effectiveUpdatePolicy===ve.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 null==this._arcadeOnDemand?(this._arcadeOnDemand=await J(),this._arcadeOnDemand):this._arcadeOnDemand}_currentRendererChange(e,i){this.currentRenderer=e,this.rendererHasGeometryOperations=i,this.symbolCreationContext.arcade=this._arcadeOnDemand;const t=this.symbolCreationContext.renderer;if(e===t)return;if(this._symbolConversionCache.clear(),null==e)return this.symbolCreationContext.renderer=null,void this.recreateAllGraphicsAndSymbols();const r=R(t,e);this._updateUnchangedSymbolMappings(r,e,t),this.symbolCreationContext.renderer=e,null!=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 N?this.layer:null,h=this._arcadeOnDemand;if(s===t.defaultSymbol&&t.getSymbol(Y(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(y):[],n=s?s.removed.map((e=>e.symbol)).filter(y):[];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||null!=e&&"partial"!==e.type)return[];const r=e=>null!=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=null!=i&&i?"string"==typeof i?i:i.id:null;if(null==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),null!=s)){const e="string"==typeof i?null:i;null!=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(null!=r)switch(r.applyRendererDiff(e,t)){case pe.RecreateSymbol:this._recreateSymbol(i);break;case pe.RecreateGraphics:this._recreateGraphicsForSymbol(i);case pe.FastUpdate:}}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)=>{e.globalPropertyChanged("skipHighSymbolLods",i)||this._recreateSymbol(t)}))}_pixelRatioChange(){this.forEachGraphics3DSymbol(((e,i,t)=>{e.globalPropertyChanged("pixelRatio",i)||this._recreateSymbol(t)}))}_signalUpdatingDuringAsyncLoadedGraphicsChange(){this._updatingPendingLoadedGraphicsChange&&this._updatingPendingLoadedGraphicsChange.remove(),this._updatingPendingLoadedGraphicsChange=G((()=>{this._updatingPendingLoadedGraphicsChange=null}))}setClippingExtent(e,i){const t=this.symbolCreationContext.clippingExtent,r=W();return be(e,r,i)?this.symbolCreationContext.clippingExtent=k(F(),r):this.symbolCreationContext.clippingExtent=null,!z(this.symbolCreationContext.clippingExtent,t)}modifyGraphics3DGraphicVisibilities(e){if(this.destroyed)return;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(null==t)return;e(t,this._graphicsBySymbol.get(i)||Me,i)}}updateAllGraphicsVisibility(){null!=this._filterVisibility&&this._filterVisibility.reapply(),this.modifyGraphics3DGraphicVisibilities((e=>{const i=this._updateUserVisibility(e),t=null!=this._scaleVisibility&&this._scaleVisibility.updateVisibility(e);return i||t}))}_hideAllGraphics(){this.modifyGraphics3DGraphicVisibilities((e=>e.setVisibilityFlag(ee.USER_SETTING,!1,ie.GRAPHIC)))}_validateRenderer(e){const i=Z(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`;je.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(null==i||i.referenced>0)return;const r=this._graphicsBySymbol.get(t);r&&0!==r.size||(this._graphicsBySymbol.delete(t),this._symbols.delete(t),h(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 Fe;Ve.tmpVec=A(),e([x({readOnly:!0})],Ve.prototype,"computedExtent",void 0),e([x()],Ve.prototype,"currentRenderer",void 0),e([x()],Ve.prototype,"rendererHasGeometryOperations",void 0),e([x()],Ve.prototype,"_frameTask",void 0),e([x({readOnly:!0})],Ve.prototype,"_viewSpatialReference",null),e([x()],Ve.prototype,"_rendererChangeAbortController",void 0),e([x()],Ve.prototype,"_elevationInfoChangeAbortController",void 0),e([x()],Ve.prototype,"_initializeAbortController",void 0),e([x()],Ve.prototype,"_elevationAlignment",void 0),e([x()],Ve.prototype,"_scaleVisibility",void 0),e([x()],Ve.prototype,"_filterVisibility",void 0),e([x()],Ve.prototype,"_initializePromise",void 0),e([x()],Ve.prototype,"_spatialIndex",void 0),e([x({readOnly:!0})],Ve.prototype,"extentPadding",void 0),e([x()],Ve.prototype,"_updatingPendingLoadedGraphicsChange",void 0),e([x()],Ve.prototype,"_featureStore",void 0),e([x()],Ve.prototype,"_deconflictor",void 0),e([x()],Ve.prototype,"_labeler",void 0),e([x()],Ve.prototype,"_objectStates",void 0),e([x()],Ve.prototype,"_loadingSymbols",void 0),e([x()],Ve.prototype,"preferredUpdatePolicy",void 0),e([x()],Ve.prototype,"_forcedUpdatePolicy",void 0),e([x({readOnly:!0})],Ve.prototype,"effectiveUpdatePolicy",null),e([x({constructOnly:!0})],Ve.prototype,"elevationFeatureExpressionEnabled",void 0),e([x({constructOnly:!0})],Ve.prototype,"owner",void 0),e([x({constructOnly:!0})],Ve.prototype,"layer",void 0),e([x({constructOnly:!0})],Ve.prototype,"graphicSymbolSupported",void 0),e([x({constructOnly:!0})],Ve.prototype,"getRenderingInfoWithoutRenderer",void 0),e([x({constructOnly:!0})],Ve.prototype,"componentFactories",void 0),e([x({constructOnly:!0})],Ve.prototype,"setUidToIdOnAdd",void 0),e([x()],Ve.prototype,"featureStore",null),e([x()],Ve.prototype,"initializePromise",null),e([x()],Ve.prototype,"scaleVisibility",null),e([x()],Ve.prototype,"elevationAlignment",null),e([x()],Ve.prototype,"objectStates",null),e([x()],Ve.prototype,"filterVisibility",null),e([x({readOnly:!0})],Ve.prototype,"updating",null),e([x({readOnly:!0})],Ve.prototype,"running",null),e([x({readOnly:!0})],Ve.prototype,"suspendedOrOutsideOfView",null),e([x({readOnly:!0,dependsOn:[]})],Ve.prototype,"updatingRemaining",null),e([x({readOnly:!0,dependsOn:["owner.view.qualitySettings.graphics3D.maxTotalNumberOfPrimitives","owner.view.qualitySettings.graphics3D.maxTotalNumberOfFeatures","averageSymbolComplexity"]})],Ve.prototype,"displayFeatureLimit",null),e([x({readOnly:!0,dependsOn:[]})],Ve.prototype,"averageSymbolComplexity",null),e([x({constructOnly:!0})],Ve.prototype,"hasZ",void 0),e([x({constructOnly:!0})],Ve.prototype,"hasM",void 0),e([x()],Ve.prototype,"_objectIdField",null),Ve=Ue=e([P(Le)],Ve),function(e){e[e.NEW=0]="NEW",e[e.LOADING=1]="LOADING",e[e.READY=2]="READY",e[e.REJECTED=3]="REJECTED"}(Fe||(Fe={}));class Te{constructor(){this.add=null,this.renderingInfo=null,this.state=Fe.NEW,this.abortController=null,this.remove=null}clear(){this.add=null,this.renderingInfo=null,this.state=Fe.NEW,this.abortController=null,this.remove=null}}const ke=10,ze=A(),We=A(),Me=new Map;export{Ve 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.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/has.js";import t from"../../../../core/Error.js";import{clone as e}from"../../../../core/lang.js";import{get as s}from"../../../../core/maybe.js";import{getMetersPerVerticalUnitForSR as r}from"../../../../core/unitUtils.js";import{e as n}from"../../../../chunks/earcut.js";import{b as o}from"../../../../chunks/mat3.js";import{c as i}from"../../../../chunks/mat3f64.js";import{a,u as l}from"../../../../chunks/mat4.js";import{c}from"../../../../chunks/mat4f64.js";import{c as h,n as m,s as p,b as d,f as g,m as u}from"../../../../chunks/vec3.js";import{d as f,c as y}from"../../../../chunks/vec3f64.js";import{computeTranslationToOriginAndRotation as b}from"../../../../geometry/projection.js";import{create as _,empty as x,expandWithBuffer as j,intersectsClippingArea as P}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as S}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as v,getZeroIndexArray as E}from"../../../../geometry/support/Indices.js";import{t as w,a as L}from"../../../../chunks/vec32.js";import{makeVertexCandidate as C,makeEdgeCandidate as I}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as O}from"../../../../renderers/support/renderingInfoUtils.js";import{ViewingMode as M}from"../../../ViewingMode.js";import{needsElevationUpdates3D as A,SampleElevationInfo as z}from"./elevationAlignmentUtils.js";import{ElevationContext as D}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as R}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as G}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as B,computeCentroid as U}from"./graphicUtils.js";import{ApplyRendererDiffResult as k}from"./interfaces.js";import{geometryAsPolygon as T}from"./polygonUtils.js";import{createMaterial as V}from"../support/edgeUtils.js";import N from"../../support/debugFlags.js";import{SamplePosition as H}from"../../support/ElevationProvider.js";import{geometryToRenderInfo as F}from"../../support/renderInfoUtils/polygon.js";import{Attribute as W}from"../../webgl-engine/lib/Attribute.js";import{CullFaceOptions as q}from"../../webgl-engine/lib/basicInterfaces.js";import{ContentObjectType as Z}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as J}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as K}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{Object3D as Q}from"../../webgl-engine/lib/Object3D.js";import{VertexAttribute as X}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as Y}from"../../webgl-engine/materials/DefaultMaterial.js";const $=["polygon","extent"];class tt extends G{constructor(t,e,s,r){super(t,e,s,r),this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const e=B(this._getSymbolSize());if(e)throw new t("graphics3dextrudesymbollayer:invalid-size",e)}const e=s(this.symbolLayer,"material","color"),r=this._getCombinedOpacityAndColor(e),n=f(r),o=r[3],i=o<1||this.needsDrivenTransparentPass,a={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,diffuse:n,ambient:n,opacity:o,transparent:i,cullFace:i?q.None:q.Back,hasVertexColors:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0};this._material=new Y(a),this._bottomMaterial=new Y({...a,cullFace:q.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(t){const e=t.graphic;if(!this._validateGeometry(e.geometry,$,this.symbolLayer.type))return null;const s=this._getVertexOpacityAndColor(t.renderingInfo,255),r=this.setGraphicElevationContext(e,new D);return this._createAs3DShape(e,t.renderingInfo,s,r,e.uid)}layerOpacityChanged(t,e){const r=s(this.symbolLayer,"material","color"),n=this._getCombinedOpacity(r),o=n<1||this.needsDrivenTransparentPass;this._material.setParameters({opacity:n,transparent:o}),this._bottomMaterial.setParameters({opacity:n,transparent:o});const i=this._getLayerOpacity();t.forEach((t=>{const s=e(t);null!=s&&s.layerOpacityChanged(i,this._context.isAsync)}))}layerElevationInfoChanged(t,e){return this.updateGraphics3DGraphicElevationInfo(t,e,A)}slicePlaneEnabledChanged(t,e){return this._material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._bottomMaterial.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),t.forEach((t=>{const s=e(t);null!=s&&s.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}_getExtrusionSize(t){let e;return e=t.size&&this._drivenProperties.size?O(t.size,2)??0:this._getSymbolSize(),e/=this._context.renderCoordsHelper.unitInMeters,e}applyRendererDiff(t,e){return this._drivenPropertiesChanged(e)?k.Recreate_Symbol:k.Recreate_Graphics}async queryForSnapping(t,s,n,o){const i=this._getExtrusionSize(n)*this._context.renderCoordsHelper.unitInMeters/r(s),{objectId:a,target:l}=t,c=e(l);switch(c.z=(c.z??0)+i,t.type){case"edge":{const{start:s,end:r}=t,n=e(s),o=e(r);return n.z=(n.z??0)+i,o.z=(o.z??0)+i,[I(a,c,1/0,n,o)]}case"vertex":return[C(a,c,1/0),I(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(t,e,s,r,l){const h=T(t.geometry);if(null==h)return null;if(0===h.rings.length||!h.rings.some((t=>t.length>0)))return this._logGeometryValidationWarnings(h.rings,"rings","ExtrudeSymbol3DLayer"),null;const m=F(h,this._context.elevationProvider,this._context.renderCoordsHelper,r);this._logGeometryCreationWarnings(m,h.rings,"rings","ExtrudeSymbol3DLayer");const p=U(h);if(null==p)return null;const d=new Array,g=new Array,u=_(),f=c(),E=y(),C=this._context.renderCoordsHelper.viewingMode===M.Global;C||this._context.renderCoordsHelper.worldUpAtPosition(null,E),b(h.spatialReference,[p.x,p.y,0],f,this._context.renderCoordsHelper.spatialReference);const I=c();a(I,f);const O=i();o(O,I);const{polygons:z,mapPositions:D,position:G}=m;for(const o of z){const t=o.count;if(this._context.clippingExtent&&(x(u),j(u,o.mapPositions),!P(u,this._context.clippingExtent)))continue;const r=n(o.mapPositions,o.holeIndices,3);if(0===r.length)continue;const i=r.length,a=6*t,c=v(a+i),h=v(i),m=S(3*a),p=S(3*a),f=S(3*a),y=S(a);st(G,D,r,o,m,f,p,y,c,h,this._getExtrusionSize(e),E,C),w(m,m,I),L(p,p,O);const b=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:l,layerUid:this._context.layer.uid}),_=new jt(m,f,p,y);d.push(et(this._material,c,c.length-h.length,_,s,b),et(this._bottomMaterial,h,0,_,s,b)),g.push(_.heights)}if(0===d.length)return null;const B=new Q({geometries:d,layerUid:this._context.layer.uid,graphicUid:l,isElevationSource:!0});B.transformation=f;const k=V(this.symbolLayer,{opacity:this._getLayerOpacity()}),N=null!=k?{baseMaterial:this._material,edgeMaterials:[k],properties:{mergeGeometries:!0,hasSlicePlane:this._context.slicePlaneEnabled}}:null,H=new R(this,B,d,null,null,((t,e,s,r,n)=>gt(t,e,s,r,n,g)),r,N);return H.alignedSampledElevation=m.sampledElevation,H.needsElevationUpdates=A(r.mode),H}}function et(t,e,s,r,n,o){const i=E(e.length),a=[[X.POSITION,new W(r.positions,3,!0)],[X.NORMAL,new W(r.normals,3,!0)],[X.COLOR,new W(n,4,!0)]],l=[[X.POSITION,e],[X.NORMAL,e],[X.COLOR,i]];return new J(t,a,l,r.elevation,Z.Mesh,o,s)}function st(t,e,s,r,n,o,i,a,l,c,h,m,p){const d=s.length/3;let g=0,u=2*r.count;rt(t,e,r.index,r.count,s,0,d,n,o,i,a,l,c,u,h,m,p);let f=2*r.count;u=0,it(n,o,a,i,g,r.pathLengths[0],r.count,f,l,u,h),f+=4*r.pathLengths[0],u+=2*r.pathLengths[0],g+=r.pathLengths[0];for(let y=1;y<r.pathLengths.length;++y)it(n,o,a,i,g,r.pathLengths[y],r.count,f,l,u,h),f+=4*r.pathLengths[y],u+=2*r.pathLengths[y],g+=r.pathLengths[y]}function rt(t,e,s,r,n,o,i,a,l,c,p,d,g,u,f,y,b){h(ft,y);const _=f>0?1:-1;let x=3*s,j=0,P=3*j,S=r,v=3*S;for(let h=0;h<r;++h)b&&(ft[0]=t[x],ft[1]=t[x+1],ft[2]=t[x+2],m(ft,ft)),a[P]=t[x],a[P+1]=t[x+1],a[P+2]=t[x+2],l[P]=e[x],l[P+1]=e[x+1],l[P+2]=e[x+2],c[P]=-_*ft[0],c[P+1]=-_*ft[1],c[P+2]=-_*ft[2],p[j]=0,a[v]=t[x]+f*ft[0],a[v+1]=t[x+1]+f*ft[1],a[v+2]=t[x+2]+f*ft[2],l[v]=e[x],l[v+1]=e[x+1],l[v+2]=e[x+2],c[v]=_*ft[0],c[v+1]=_*ft[1],c[v+2]=_*ft[2],p[S]=f,P+=3,v+=3,x+=3,j+=1,S+=1;x=3*o,P=0,v=3*u;const E=f<0?_t:bt,w=f<0?bt:_t;for(let h=0;h<i;++h)g[P]=n[x+E[0]],g[P+1]=n[x+E[1]],g[P+2]=n[x+E[2]],d[v]=n[x+w[0]]+r,d[v+1]=n[x+w[1]]+r,d[v+2]=n[x+w[2]]+r,P+=3,v+=3,x+=3}function nt(t,e,s,r,n,o,i){r[o]=r[i],i*=3,t[o*=3]=t[i],t[o+1]=t[i+1],t[o+2]=t[i+2],e[o]=e[i],e[o+1]=e[i+1],e[o+2]=e[i+2],s[o]=n[0],s[o+1]=n[1],s[o+2]=n[2]}const ot=y();function it(t,e,s,r,n,o,i,a,l,c,h){let m=n,p=n+1,d=n+i,g=n+i+1,u=a,f=a+1,y=a+2*o,b=a+2*o+1;h<0&&(m=n+i+1,g=n),c*=3;for(let _=0;_<o;++_)_===o-1&&(h>0?(p=n,g=n+i):(p=n,m=n+i)),pt(t,m,p,d,ot),nt(t,e,r,s,ot,u,m),nt(t,e,r,s,ot,f,p),nt(t,e,r,s,ot,y,d),nt(t,e,r,s,ot,b,g),l[c++]=u,l[c++]=y,l[c++]=b,l[c++]=u,l[c++]=b,l[c++]=f,m++,p++,d++,g++,u+=2,f+=2,y+=2,b+=2}const at=y(),lt=y(),ct=y(),ht=y(),mt=y();function pt(t,e,s,r,n){e*=3,s*=3,r*=3,p(at,t[e++],t[e++],t[e++]),p(lt,t[s++],t[s++],t[s++]),p(ct,t[r++],t[r++],t[r++]),d(ht,lt,at),d(mt,ct,at),g(n,mt,ht),m(n,n)}const dt=y();function gt(t,e,s,r,n,o){const i=t.stageObject,a=i.geometries,h=a.length,m="absolute-height"!==e.mode;let d=0;const g=i.transformation,f=l(c(),g);for(let l=0;l<h;l+=2){const t=a[l];if(!K(t))continue;const e=t.getMutableAttribute(X.POSITION).data,c=o[l/2],h=new H(t.mapPositions),y=e.length/3;let b=0,_=!1,x=0;for(let o=0;o<y;o++){dt[0]=e[b],dt[1]=e[b+1],dt[2]=e[b+2],r(h,yt),m&&(x+=yt.sampledElevation),N.TESTS_DISABLE_OPTIMIZATIONS?(p(ut,h.array[h.offset],h.array[h.offset+1],yt.z+c[b/3]),null!=s&&n.toRenderCoords(ut,s,ut),u(ut,ut,f)):(p(ut,e[b],e[b+1],e[b+2]),u(ut,ut,g),n.setAltitude(ut,yt.z+c[b/3]),u(ut,ut,f)),e[b]=ut[0],e[b+1]=ut[1],e[b+2]=ut[2];const t=xt/n.unitInMeters;(Math.abs(dt[0]-e[b])>=t||Math.abs(dt[1]-e[b+1])>=t||Math.abs(dt[2]-e[b+2])>=t)&&(_=!0),h.offset+=3,b+=3}_&&(t.invalidateBoundingInfo(),i.geometryVertexAttrsUpdated(a[l]),a[l+1].invalidateBoundingInfo(),i.geometryVertexAttrsUpdated(a[l+1])),d+=x/y}return d/h}const ut=y(),ft=y(),yt=new z,bt=[0,2,1],_t=[0,1,2],xt=.01;class jt{constructor(t,e,s,r){this.positions=t,this.elevation=e,this.normals=s,this.heights=r}}export{tt as Graphics3DExtrudeSymbolLayer};
|
|
5
|
+
import"../../../../core/has.js";import t from"../../../../core/Error.js";import{clone as e}from"../../../../core/lang.js";import{get as s}from"../../../../core/maybe.js";import{getMetersPerVerticalUnitForSR as r}from"../../../../core/unitUtils.js";import{e as n}from"../../../../chunks/earcut.js";import{b as o}from"../../../../chunks/mat3.js";import{c as i}from"../../../../chunks/mat3f64.js";import{a,u as l}from"../../../../chunks/mat4.js";import{c}from"../../../../chunks/mat4f64.js";import{c as h,n as m,s as p,b as d,f as g,m as u}from"../../../../chunks/vec3.js";import{d as f,c as y}from"../../../../chunks/vec3f64.js";import{computeTranslationToOriginAndRotation as b}from"../../../../geometry/projection.js";import{create as _,empty as x,expandWithBuffer as j,intersectsClippingArea as P}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as S}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as v,getZeroIndexArray as E}from"../../../../geometry/support/Indices.js";import{t as w,a as L}from"../../../../chunks/vec32.js";import{makeVertexCandidate as C,makeEdgeCandidate as I}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as O}from"../../../../renderers/support/renderingInfoUtils.js";import{ViewingMode as M}from"../../../ViewingMode.js";import{needsElevationUpdates3D as A,SampleElevationInfo as z}from"./elevationAlignmentUtils.js";import{ElevationContext as D}from"./ElevationContext.js";import{Graphics3DObject3DGraphicLayer as R}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as G}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as B,computeCentroid as U}from"./graphicUtils.js";import{ApplyRendererDiffResult as k}from"./interfaces.js";import{geometryAsPolygon as T}from"./polygonUtils.js";import{createMaterial as V}from"../support/edgeUtils.js";import N from"../../support/debugFlags.js";import{SamplePosition as H}from"../../support/ElevationProvider.js";import{geometryToRenderInfo as F}from"../../support/renderInfoUtils/polygon.js";import{Attribute as W}from"../../webgl-engine/lib/Attribute.js";import{CullFaceOptions as q}from"../../webgl-engine/lib/basicInterfaces.js";import{ContentObjectType as Z}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as J}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as K}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{Object3D as Q}from"../../webgl-engine/lib/Object3D.js";import{VertexAttribute as X}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as Y}from"../../webgl-engine/materials/DefaultMaterial.js";const $=["polygon","extent"];class tt extends G{constructor(t,e,s,r){super(t,e,s,r),this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const e=B(this._getSymbolSize());if(e)throw new t("graphics3dextrudesymbollayer:invalid-size",e)}const e=s(this.symbolLayer,"material","color"),r=this._getCombinedOpacityAndColor(e),n=f(r),o=r[3],i=o<1||this.needsDrivenTransparentPass,a={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,diffuse:n,ambient:n,opacity:o,transparent:i,cullFace:i?q.None:q.Back,hasVertexColors:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0};this._material=new Y(a),this._bottomMaterial=new Y({...a,cullFace:q.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(t){const e=t.graphic;if(!this._validateGeometry(e.geometry,$,this.symbolLayer.type))return null;const s=this._getVertexOpacityAndColor(t.renderingInfo,255),r=this.setGraphicElevationContext(e,new D);return this._createAs3DShape(e,t.renderingInfo,s,r,e.uid)}layerOpacityChanged(t,e){const r=s(this.symbolLayer,"material","color"),n=this._getCombinedOpacity(r),o=n<1||this.needsDrivenTransparentPass;this._material.setParameters({opacity:n,transparent:o}),this._bottomMaterial.setParameters({opacity:n,transparent:o});const i=this._getLayerOpacity();t.forEach((t=>{const s=e(t);null!=s&&s.layerOpacityChanged(i,this._context.isAsync)}))}layerElevationInfoChanged(t,e){return this.updateGraphics3DGraphicElevationInfo(t,e,A)}slicePlaneEnabledChanged(t,e){return this._material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._bottomMaterial.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),t.forEach((t=>{const s=e(t);null!=s&&s.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}_getExtrusionSize(t){let e;return e=t.size&&this._drivenProperties.size?O(t.size,2)??0:this._getSymbolSize(),e/=this._context.renderCoordsHelper.unitInMeters,e}applyRendererDiff(t,e){return this._drivenPropertiesChanged(e)?k.RecreateSymbol:k.RecreateGraphics}async queryForSnapping(t,s,n,o){const i=this._getExtrusionSize(n)*this._context.renderCoordsHelper.unitInMeters/r(s),{objectId:a,target:l}=t,c=e(l);switch(c.z=(c.z??0)+i,t.type){case"edge":{const{start:s,end:r}=t,n=e(s),o=e(r);return n.z=(n.z??0)+i,o.z=(o.z??0)+i,[I(a,c,1/0,n,o)]}case"vertex":return[C(a,c,1/0),I(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(t,e,s,r,l){const h=T(t.geometry);if(null==h)return null;if(0===h.rings.length||!h.rings.some((t=>t.length>0)))return this._logGeometryValidationWarnings(h.rings,"rings","ExtrudeSymbol3DLayer"),null;const m=F(h,this._context.elevationProvider,this._context.renderCoordsHelper,r);this._logGeometryCreationWarnings(m,h.rings,"rings","ExtrudeSymbol3DLayer");const p=U(h);if(null==p)return null;const d=new Array,g=new Array,u=_(),f=c(),E=y(),C=this._context.renderCoordsHelper.viewingMode===M.Global;C||this._context.renderCoordsHelper.worldUpAtPosition(null,E),b(h.spatialReference,[p.x,p.y,0],f,this._context.renderCoordsHelper.spatialReference);const I=c();a(I,f);const O=i();o(O,I);const{polygons:z,mapPositions:D,position:G}=m;for(const o of z){const t=o.count;if(this._context.clippingExtent&&(x(u),j(u,o.mapPositions),!P(u,this._context.clippingExtent)))continue;const r=n(o.mapPositions,o.holeIndices,3);if(0===r.length)continue;const i=r.length,a=6*t,c=v(a+i),h=v(i),m=S(3*a),p=S(3*a),f=S(3*a),y=S(a);st(G,D,r,o,m,f,p,y,c,h,this._getExtrusionSize(e),E,C),w(m,m,I),L(p,p,O);const b=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:l,layerUid:this._context.layer.uid}),_=new jt(m,f,p,y);d.push(et(this._material,c,c.length-h.length,_,s,b),et(this._bottomMaterial,h,0,_,s,b)),g.push(_.heights)}if(0===d.length)return null;const B=new Q({geometries:d,layerUid:this._context.layer.uid,graphicUid:l,isElevationSource:!0});B.transformation=f;const k=V(this.symbolLayer,{opacity:this._getLayerOpacity()}),N=null!=k?{baseMaterial:this._material,edgeMaterials:[k],properties:{mergeGeometries:!0,hasSlicePlane:this._context.slicePlaneEnabled}}:null,H=new R(this,B,d,null,null,((t,e,s,r,n)=>gt(t,e,s,r,n,g)),r,N);return H.alignedSampledElevation=m.sampledElevation,H.needsElevationUpdates=A(r.mode),H}}function et(t,e,s,r,n,o){const i=E(e.length),a=[[X.POSITION,new W(r.positions,3,!0)],[X.NORMAL,new W(r.normals,3,!0)],[X.COLOR,new W(n,4,!0)]],l=[[X.POSITION,e],[X.NORMAL,e],[X.COLOR,i]];return new J(t,a,l,r.elevation,Z.Mesh,o,s)}function st(t,e,s,r,n,o,i,a,l,c,h,m,p){const d=s.length/3;let g=0,u=2*r.count;rt(t,e,r.index,r.count,s,0,d,n,o,i,a,l,c,u,h,m,p);let f=2*r.count;u=0,it(n,o,a,i,g,r.pathLengths[0],r.count,f,l,u,h),f+=4*r.pathLengths[0],u+=2*r.pathLengths[0],g+=r.pathLengths[0];for(let y=1;y<r.pathLengths.length;++y)it(n,o,a,i,g,r.pathLengths[y],r.count,f,l,u,h),f+=4*r.pathLengths[y],u+=2*r.pathLengths[y],g+=r.pathLengths[y]}function rt(t,e,s,r,n,o,i,a,l,c,p,d,g,u,f,y,b){h(ft,y);const _=f>0?1:-1;let x=3*s,j=0,P=3*j,S=r,v=3*S;for(let h=0;h<r;++h)b&&(ft[0]=t[x],ft[1]=t[x+1],ft[2]=t[x+2],m(ft,ft)),a[P]=t[x],a[P+1]=t[x+1],a[P+2]=t[x+2],l[P]=e[x],l[P+1]=e[x+1],l[P+2]=e[x+2],c[P]=-_*ft[0],c[P+1]=-_*ft[1],c[P+2]=-_*ft[2],p[j]=0,a[v]=t[x]+f*ft[0],a[v+1]=t[x+1]+f*ft[1],a[v+2]=t[x+2]+f*ft[2],l[v]=e[x],l[v+1]=e[x+1],l[v+2]=e[x+2],c[v]=_*ft[0],c[v+1]=_*ft[1],c[v+2]=_*ft[2],p[S]=f,P+=3,v+=3,x+=3,j+=1,S+=1;x=3*o,P=0,v=3*u;const E=f<0?_t:bt,w=f<0?bt:_t;for(let h=0;h<i;++h)g[P]=n[x+E[0]],g[P+1]=n[x+E[1]],g[P+2]=n[x+E[2]],d[v]=n[x+w[0]]+r,d[v+1]=n[x+w[1]]+r,d[v+2]=n[x+w[2]]+r,P+=3,v+=3,x+=3}function nt(t,e,s,r,n,o,i){r[o]=r[i],i*=3,t[o*=3]=t[i],t[o+1]=t[i+1],t[o+2]=t[i+2],e[o]=e[i],e[o+1]=e[i+1],e[o+2]=e[i+2],s[o]=n[0],s[o+1]=n[1],s[o+2]=n[2]}const ot=y();function it(t,e,s,r,n,o,i,a,l,c,h){let m=n,p=n+1,d=n+i,g=n+i+1,u=a,f=a+1,y=a+2*o,b=a+2*o+1;h<0&&(m=n+i+1,g=n),c*=3;for(let _=0;_<o;++_)_===o-1&&(h>0?(p=n,g=n+i):(p=n,m=n+i)),pt(t,m,p,d,ot),nt(t,e,r,s,ot,u,m),nt(t,e,r,s,ot,f,p),nt(t,e,r,s,ot,y,d),nt(t,e,r,s,ot,b,g),l[c++]=u,l[c++]=y,l[c++]=b,l[c++]=u,l[c++]=b,l[c++]=f,m++,p++,d++,g++,u+=2,f+=2,y+=2,b+=2}const at=y(),lt=y(),ct=y(),ht=y(),mt=y();function pt(t,e,s,r,n){e*=3,s*=3,r*=3,p(at,t[e++],t[e++],t[e++]),p(lt,t[s++],t[s++],t[s++]),p(ct,t[r++],t[r++],t[r++]),d(ht,lt,at),d(mt,ct,at),g(n,mt,ht),m(n,n)}const dt=y();function gt(t,e,s,r,n,o){const i=t.stageObject,a=i.geometries,h=a.length,m="absolute-height"!==e.mode;let d=0;const g=i.transformation,f=l(c(),g);for(let l=0;l<h;l+=2){const t=a[l];if(!K(t))continue;const e=t.getMutableAttribute(X.POSITION).data,c=o[l/2],h=new H(t.mapPositions),y=e.length/3;let b=0,_=!1,x=0;for(let o=0;o<y;o++){dt[0]=e[b],dt[1]=e[b+1],dt[2]=e[b+2],r(h,yt),m&&(x+=yt.sampledElevation),N.TESTS_DISABLE_OPTIMIZATIONS?(p(ut,h.array[h.offset],h.array[h.offset+1],yt.z+c[b/3]),null!=s&&n.toRenderCoords(ut,s,ut),u(ut,ut,f)):(p(ut,e[b],e[b+1],e[b+2]),u(ut,ut,g),n.setAltitude(ut,yt.z+c[b/3]),u(ut,ut,f)),e[b]=ut[0],e[b+1]=ut[1],e[b+2]=ut[2];const t=xt/n.unitInMeters;(Math.abs(dt[0]-e[b])>=t||Math.abs(dt[1]-e[b+1])>=t||Math.abs(dt[2]-e[b+2])>=t)&&(_=!0),h.offset+=3,b+=3}_&&(t.invalidateBoundingInfo(),i.geometryVertexAttrsUpdated(a[l]),a[l+1].invalidateBoundingInfo(),i.geometryVertexAttrsUpdated(a[l+1])),d+=x/y}return d/h}const ut=y(),ft=y(),yt=new z,bt=[0,2,1],_t=[0,1,2],xt=.01;class jt{constructor(t,e,s,r){this.positions=t,this.elevation=e,this.normals=s,this.heights=r}}export{tt 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.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../Graphic.js";import{XXH as i}from"../../../../arcade/functions/hash.js";import{neverReached as s}from"../../../../core/compilerUtils.js";import{HandleOwner as r}from"../../../../core/HandleOwner.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{logOnError as a}from"../../../../core/promiseUtils.js";import{watch as o,initial as l,when as p}from"../../../../core/reactiveUtils.js";import{property as u}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 h}from"../../../../core/accessorSupport/diffUtils.js";import{canProject as c,project as m}from"../../../../geometry/support/webMercatorUtils.js";import{matchRandomRotationExpression as y}from"../../../../renderers/support/randomRotationExpression.js";import{getRenderingInfo as g,getRenderingInfoAsync as b}from"../../../../renderers/support/renderingInfoUtils.js";import f from"../../../../rest/support/Query.js";import{DrapeSourceType as E}from"../interfaces.js";import{SUSPEND_RESUME_EXTENT_OPTIMISM as C}from"./constants.js";import{Graphics3DCore as x}from"./Graphics3DCore.js";import v from"./Graphics3DElevationAlignment.js";import w from"./Graphics3DFrustumVisibility.js";import{Graphics3DObjectStates as V}from"./Graphics3DObjectStates.js";import j from"./Graphics3DScaleVisibility.js";import{enlargeExtent as S}from"./graphicUtils.js";import{attributeLookup as R}from"../support/attributeUtils.js";import{FeatureVisibilityFilter as O}from"../support/FeatureVisibilityFilter.js";import{Object3DState as I}from"../../webgl-engine/lib/basicInterfaces.js";import{UpdatePolicy as G}from"../../webgl-engine/lib/UpdatePolicy.js";let _=class extends r{constructor(e){super(e),this.type="graphics-3d",this._randomRotationRenderers=null,this.elevationFeatureExpressionEnabled=!1,this.scaleVisibilityEnabled=!1,this.filterVisibilityEnabled=!1,this.frustumVisibilityEnabled=!1,this.elevationAlignmentEnabled=!1,this.timeExtentEnabled=!1,this.setUidToIdOnAdd=!0,this.dataExtent=null,this.drapeSourceType=E.Features,this.preferredUpdatePolicy=G.ASYNC,this._suspendResumeExtent=null}initialize(){const e=this.owner,t=(this.filterVisibilityEnabled||this.timeExtentEnabled)&&"multipatch"!==e.layer.geometryType,i=new x({owner:this,layer:this.layer,preferredUpdatePolicy:this.preferredUpdatePolicy,elevationFeatureExpressionEnabled:this.elevationFeatureExpressionEnabled,graphicSymbolSupported:!1,hasZ:e.hasZ,hasM:e.hasM,setUidToIdOnAdd:this.setUidToIdOnAdd,componentFactories:{deconflictor:t=>e.view.deconflictor.addGraphicsOwner(t),labeler:(t,i)=>e.view.labeler.addGraphicsOwner(t,i),elevationAlignment:this.elevationAlignmentEnabled?(t,i)=>new v({graphicsCoreOwner:this,graphicsCore:t,queryGraphicUIDsInExtent:i,elevationProvider:e.view.elevationProvider}):null,scaleVisibility:this.scaleVisibilityEnabled?(t,i)=>new j({graphicsCoreOwner:this,layer:this.layer,queryGraphicUIDsInExtent:i,graphicsCore:t,basemapTerrain:e.view.basemapTerrain}):null,filterVisibility:t?t=>new O({context:{layerView:e,...t}}):null,objectStates:e=>new V(e)}});this._set("graphicsCore",i),this.frustumVisibilityEnabled&&this._set("frustumVisibility",new w({graphicsCoreOwner:this})),this.elevationAlignment&&this.updatingHandles.add((()=>this.layer.elevationInfo),((e,t)=>{h(e,t)&&this.updatingHandles.addPromise(this.graphicsCore.elevationInfoChange())})),this.updatingHandles.add((()=>this.layer.labelsVisible),(()=>this.graphicsCore.updateVisibilityInfo())),this.updatingHandles.add((()=>this.layer.labelingInfo),((e,t)=>{h(e,t)&&this.graphicsCore.updateLabelingInfo()})),this.updatingHandles.add((()=>this.preferredUpdatePolicy),(e=>this.graphicsCore.preferredUpdatePolicy=e)),this._set("initializePromise",this._initializeAsync()),this.updatingHandles.addPromise(this.initializePromise)}async _initializeAsync(){await a(this.graphicsCore.initializePromise);const e=this.owner;this.updatingHandles.add((()=>this.renderer),(e=>this.updatingHandles.addPromise(this.graphicsCore.rendererChange(e)))),this.updatingHandles.add((()=>e.fullOpacity),(()=>this.graphicsCore.opacityChange())),this._setupSuspendResumeExtent(),this.updateClippingExtent&&(this.updatingHandles.add((()=>e.view.clippingArea),(()=>this._updateClippingExtent())),this._updateClippingExtent()),this.graphicsCore.startCreateGraphics(),this.graphicsCore.labelsEnabled&&await a(this.graphicsCore.updateLabelingInfo())}destroy(){this.handles.removeAll(),this.updatingHandles.removeAll(),this._set("frustumVisibility",n(this.frustumVisibility)),this._set("graphicsCore",n(this.graphicsCore)),this._set("owner",null)}get layer(){return this.owner.layer}get renderer(){const{renderer:e,objectIdField:t}=this.layer;if(!e||!t||"heatmap"===e.type||!e.visualVariables)return e;const i=e.visualVariables.findIndex((e=>"rotation"===e.type&&null!=e.valueExpression&&y(e.valueExpression)===t&&(null==e.axis||"heading"===e.axis)&&"geographic"===e.rotationType));if(i<0)return e;const s=e.clone();return s.visualVariables.splice(i,1),this._randomRotationRenderers||(this._randomRotationRenderers=new WeakMap),this._randomRotationRenderers.set(s,t),s}get scaleVisibility(){return this.graphicsCore?.scaleVisibility}get filterVisibility(){return this.graphicsCore?.filterVisibility}get elevationAlignment(){return this.graphicsCore?.elevationAlignment}get objectStates(){return this.graphicsCore?.objectStates}get suspendResumeExtentMode(){return"suspendResumeExtentMode"in this.owner?this.owner.suspendResumeExtentMode:"computed"}get scaleVisibilitySuspended(){return null!=this.scaleVisibility&&this.scaleVisibility.suspended}get suspended(){return this.owner.suspended}get legendEnabled(){return null==this.frustumVisibility||!this.frustumVisibility.suspended}get suspendInfo(){const e={};return this.scaleVisibilitySuspended&&(e.outsideScaleRange=!0),null!=this.frustumVisibility&&this.frustumVisibility.suspended&&(e.outsideOfView=!0),e}get updating(){return!!(this.graphicsCore?.updating||null!=this.frustumVisibility&&this.frustumVisibility.updating||this.updatingHandles?.updating)}get updatingRemaining(){return this.graphicsCore?.updatingRemaining??0}get featureStore(){return this.graphicsCore?.featureStore}get view(){return this.owner.view}get loadedGraphics(){return this.owner.loadedGraphics}get fullOpacity(){return this.owner?.fullOpacity}get filter(){return"filter"in this.owner?this.owner.filter:null}get slicePlaneEnabled(){return this.owner.slicePlaneEnabled}get updatePolicy(){return this.owner.updatePolicy}get featureSpatialReference(){return"featureSpatialReference"in this.owner?this.owner.featureSpatialReference:this.owner.view.spatialReference}get graphics3DGraphics(){return this.graphicsCore?.graphics3DGraphics}get graphics3DGraphicsByObjectID(){return this.graphicsCore?.graphics3DGraphicsByObjectID}get symbolUpdateType(){return this.graphicsCore?.symbolUpdateType}get displayFeatureLimit(){const e=this.view.resourceController.memoryController.memoryFactor,t=this.graphicsCore?.displayFeatureLimit;if(1===e)return t;const i=Math.ceil(t.maximumNumberOfFeatures*e),s=Math.ceil(t.maximumTotalNumberOfFeatures*e),r=Math.ceil(t.minimumTotalNumberOfFeatures*e);return{...t,maximumNumberOfFeatures:i,maximumTotalNumberOfFeatures:s,minimumTotalNumberOfFeatures:r}}get usedMemory(){return this.graphicsCore?.usedMemory??0}get loadedFeatures(){return this.graphicsCore?.numberOfGraphics??0}get usedMemoryPerFeature(){return this.graphicsCore?.usedMemoryPerGraphic??0}get unprocessedMemoryEstimate(){return this.graphicsCore?.unprocessedMemoryEstimate??0}get performanceInfo(){return{core:this.graphicsCore.performanceInfo,elevationUpdating:this.elevationAlignment.updating,visibilityFrustum:null==this.frustumVisibility||!this.frustumVisibility.suspended,visibilityScale:!this.scaleVisibilitySuspended}}maskOccludee(e){const{set:t,handle:i}=this.objectStates.acquireSet(I.MaskOccludee,null);return this.objectStates.setUid(t,e.uid),i}highlight(e,i){if(e instanceof f){const{set:t,handle:s}=this.objectStates.acquireSet(I.Highlight,i);return this.owner.queryObjectIds(e).then((e=>this.objectStates.setObjectIds(t,e))),s}if("number"==typeof e||"string"==typeof e)return this.highlight([e],i);if(e instanceof t)return this.highlight([e],i);if("toArray"in e&&(e=e.toArray()),Array.isArray(e)&&e.length>0){if(e[0]instanceof t){const t=e;if(null==R(this.layer.fieldsIndex,t[0].attributes,i)){const e=t.map((e=>e.uid)),{set:i,handle:s}=this.objectStates.acquireSet(I.Highlight,null);return this.objectStates.setUids(i,e),s}e=t.map((e=>R(this.layer.fieldsIndex,e.attributes,i)))}if("number"==typeof e[0]||"string"==typeof e[0]){const t=e,{set:s,handle:r}=this.objectStates.acquireSet(I.Highlight,i);return this.objectStates.setObjectIds(s,t),r}}return U}resetObjectStates(){this.objectStates.reset()}whenGraphicBounds(e,t){return this.graphicsCore?.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.graphicsCore?.computeAttachmentOrigin(e,t)}notifyGraphicGeometryChanged(e){this.graphicsCore.notifyGraphicGeometryChanged(e)}notifyGraphicVisibilityChanged(e){this.graphicsCore.notifyGraphicVisibilityChanged(e)}getRenderingInfo(e,t,s){const r=g(e,{renderer:t,arcade:s});if(null!=r&&r.color){const e=r.color;e[0]=e[0]/255,e[1]=e[1]/255,e[2]=e[2]/255}if(null!=r&&null!=t&&this._randomRotationRenderers?.has(t)){const s=this._randomRotationRenderers.get(t),n=e.attributes[s],a=new i(0);a.updateFloatArray([n]),a.updateUint8Array([173]),r.heading=8.381e-8*a.digest()}return r}getRenderingInfoAsync(e,t,i,s){return b(e,{renderer:t,arcade:i,...s})}getSymbolLayerSize(e,t){return this.graphicsCore?.getSymbolLayerSize(e,t)}setObjectIdVisibility(e,t){this.graphicsCore?.setObjectIdVisibility(e,t)}refreshFilter(){null!=this.filterVisibility&&this.filterVisibility.reapply()}getGraphics3DGraphicByObjectId(e){return this.graphicsCore?.getGraphics3DGraphicByObjectId(e)}_updateClippingExtent(){const e=this.owner.view.clippingArea;this.graphicsCore.setClippingExtent(e,this.owner.view.spatialReference)&&(this.updateClippingExtent(e)||this.graphicsCore.recreateAllGraphics())}_setupSuspendResumeExtent(){(this.frustumVisibility||this.scaleVisibility)&&this.handles.add(o((()=>this.suspendResumeExtentMode),(()=>{switch(this.handles.remove(P),this.suspendResumeExtentMode){case"computed":this.handles.add([o((()=>this.graphicsCore.computedExtent),(e=>this._updateSuspendResumeExtent(e)),l),o((()=>this.graphicsCore.extentPadding),(()=>this._updateSuspendResumeExtent(this.graphicsCore.computedExtent)))],P);break;case"data":this.handles.add([p((()=>this.dataExtent),(e=>this._updateSuspendResumeExtent(e)),l),o((()=>this.graphicsCore.extentPadding),(()=>this._updateSuspendResumeExtent(this.dataExtent)))],P);break;default:s(this.suspendResumeExtentMode)}}),l))}_updateSuspendResumeExtent(e){e?this._suspendResumeExtentChanged(this._extentToSuspendResumeRect(e,this._suspendResumeExtent)):this._suspendResumeExtentChanged(null)}_extentToSuspendResumeRect(e,t){const i=this.owner.view.spatialReference;if(!e.spatialReference.equals(i)){if(!c(e,i))return;e=m(e,i)}return S(e,t,C,this.graphicsCore.extentPadding)}_suspendResumeExtentChanged(e){null!=this.frustumVisibility&&this.frustumVisibility.setExtent(e),null!=this.scaleVisibility&&this.scaleVisibility.setExtent(e)}};e([u()],_.prototype,"type",void 0),e([u({constructOnly:!0})],_.prototype,"owner",void 0),e([u()],_.prototype,"layer",null),e([u()],_.prototype,"renderer",null),e([u({constructOnly:!0})],_.prototype,"updateClippingExtent",void 0),e([u({constructOnly:!0})],_.prototype,"elevationFeatureExpressionEnabled",void 0),e([u({constructOnly:!0})],_.prototype,"graphicsCore",void 0),e([u({constructOnly:!0})],_.prototype,"scaleVisibilityEnabled",void 0),e([u({constructOnly:!0})],_.prototype,"filterVisibilityEnabled",void 0),e([u({constructOnly:!0})],_.prototype,"frustumVisibilityEnabled",void 0),e([u({constructOnly:!0})],_.prototype,"elevationAlignmentEnabled",void 0),e([u({constructOnly:!0})],_.prototype,"timeExtentEnabled",void 0),e([u({constructOnly:!0})],_.prototype,"setUidToIdOnAdd",void 0),e([u()],_.prototype,"scaleVisibility",null),e([u()],_.prototype,"filterVisibility",null),e([u()],_.prototype,"elevationAlignment",null),e([u({constructOnly:!0})],_.prototype,"frustumVisibility",void 0),e([u()],_.prototype,"objectStates",null),e([u()],_.prototype,"initializePromise",void 0),e([u()],_.prototype,"suspendResumeExtentMode",null),e([u()],_.prototype,"dataExtent",void 0),e([u()],_.prototype,"scaleVisibilitySuspended",null),e([u()],_.prototype,"suspended",null),e([u()],_.prototype,"legendEnabled",null),e([u()],_.prototype,"suspendInfo",null),e([u()],_.prototype,"updating",null),e([u()],_.prototype,"updatingRemaining",null),e([u()],_.prototype,"featureStore",null),e([u()],_.prototype,"view",null),e([u()],_.prototype,"loadedGraphics",null),e([u()],_.prototype,"fullOpacity",null),e([u()],_.prototype,"filter",null),e([u()],_.prototype,"slicePlaneEnabled",null),e([u()],_.prototype,"drapeSourceType",void 0),e([u()],_.prototype,"updatePolicy",null),e([u()],_.prototype,"preferredUpdatePolicy",void 0),e([u()],_.prototype,"displayFeatureLimit",null),_=e([d("esri.views.3d.layers.graphics.Graphics3DFeatureProcessor")],_);const A=_,P="suspendResumeExtentMode",U={remove(){},pause(){},resume(){}};export{A as default};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../Graphic.js";import{XXH as i}from"../../../../arcade/functions/hash.js";import{neverReached as s}from"../../../../core/compilerUtils.js";import{HandleOwner as r}from"../../../../core/HandleOwner.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{logOnError as a}from"../../../../core/promiseUtils.js";import{watch as o,initial as l,when as p}from"../../../../core/reactiveUtils.js";import{property as u}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 h}from"../../../../core/accessorSupport/diffUtils.js";import{canProject as c,project as m}from"../../../../geometry/support/webMercatorUtils.js";import{matchRandomRotationExpression as y}from"../../../../renderers/support/randomRotationExpression.js";import{getRenderingInfo as g,getRenderingInfoAsync as b}from"../../../../renderers/support/renderingInfoUtils.js";import f from"../../../../rest/support/Query.js";import{DrapeSourceType as E}from"../interfaces.js";import{SUSPEND_RESUME_EXTENT_OPTIMISM as C}from"./constants.js";import{Graphics3DCore as x}from"./Graphics3DCore.js";import v from"./Graphics3DElevationAlignment.js";import w from"./Graphics3DFrustumVisibility.js";import{Graphics3DObjectStates as V}from"./Graphics3DObjectStates.js";import j from"./Graphics3DScaleVisibility.js";import{enlargeExtent as S}from"./graphicUtils.js";import{attributeLookup as R}from"../support/attributeUtils.js";import{FeatureVisibilityFilter as O}from"../support/FeatureVisibilityFilter.js";import{Object3DState as I}from"../../webgl-engine/lib/basicInterfaces.js";import{UpdatePolicy as G}from"../../webgl-engine/lib/UpdatePolicy.js";let _=class extends r{constructor(e){super(e),this.type="graphics-3d",this._randomRotationRenderers=null,this.elevationFeatureExpressionEnabled=!1,this.scaleVisibilityEnabled=!1,this.filterVisibilityEnabled=!1,this.frustumVisibilityEnabled=!1,this.elevationAlignmentEnabled=!1,this.timeExtentEnabled=!1,this.setUidToIdOnAdd=!0,this.dataExtent=null,this.drapeSourceType=E.Features,this.preferredUpdatePolicy=G.ASYNC,this._suspendResumeExtent=null}initialize(){const e=this.owner,t=(this.filterVisibilityEnabled||this.timeExtentEnabled)&&"multipatch"!==e.layer.geometryType,i=new x({owner:this,layer:this.layer,preferredUpdatePolicy:this.preferredUpdatePolicy,elevationFeatureExpressionEnabled:this.elevationFeatureExpressionEnabled,graphicSymbolSupported:!1,hasZ:e.hasZ,hasM:e.hasM,setUidToIdOnAdd:this.setUidToIdOnAdd,componentFactories:{deconflictor:t=>e.view.deconflictor.addGraphicsOwner(t),labeler:(t,i)=>e.view.labeler.addGraphicsOwner(t,i),elevationAlignment:this.elevationAlignmentEnabled?(t,i)=>new v({graphicsCoreOwner:this,graphicsCore:t,queryGraphicUIDsInExtent:i,elevationProvider:e.view.elevationProvider}):null,scaleVisibility:this.scaleVisibilityEnabled?(t,i)=>new j({graphicsCoreOwner:this,layer:this.layer,queryGraphicUIDsInExtent:i,graphicsCore:t,basemapTerrain:e.view.basemapTerrain}):null,filterVisibility:t?t=>new O({context:{layerView:e,...t}}):null,objectStates:e=>new V(e)}});this._set("graphicsCore",i),this.frustumVisibilityEnabled&&this._set("frustumVisibility",new w({graphicsCoreOwner:this})),this.elevationAlignment&&this.updatingHandles.add((()=>this.layer.elevationInfo),((e,t)=>{h(e,t)&&this.updatingHandles.addPromise(this.graphicsCore.elevationInfoChange())})),this.updatingHandles.add((()=>this.layer.labelsVisible),(()=>this.graphicsCore.updateVisibilityInfo())),this.updatingHandles.add((()=>this.layer.labelingInfo),((e,t)=>{h(e,t)&&this.graphicsCore.updateLabelingInfo()})),this.updatingHandles.add((()=>this.preferredUpdatePolicy),(e=>this.graphicsCore.preferredUpdatePolicy=e)),this._set("initializePromise",this._initializeAsync()),this.updatingHandles.addPromise(this.initializePromise)}async _initializeAsync(){await a(this.graphicsCore.initializePromise);const e=this.owner;this.updatingHandles.add((()=>this.renderer),(e=>this.updatingHandles.addPromise(this.graphicsCore.rendererChange(e)))),this.updatingHandles.add((()=>e.fullOpacity),(()=>this.graphicsCore.opacityChange())),this._setupSuspendResumeExtent(),this.updateClippingExtent&&(this.updatingHandles.add((()=>e.view.clippingArea),(()=>this._updateClippingExtent())),this._updateClippingExtent()),this.graphicsCore.startCreateGraphics(),this.graphicsCore.labelsEnabled&&await a(this.graphicsCore.updateLabelingInfo())}destroy(){this.handles.removeAll(),this.updatingHandles.removeAll(),this._set("frustumVisibility",n(this.frustumVisibility)),this._set("graphicsCore",n(this.graphicsCore)),this._set("owner",null)}get layer(){return this.owner.layer}get renderer(){const{renderer:e,objectIdField:t}=this.layer;if(!e||!t||"heatmap"===e.type||!e.visualVariables)return e;const i=e.visualVariables.findIndex((e=>"rotation"===e.type&&null!=e.valueExpression&&y(e.valueExpression)===t&&(null==e.axis||"heading"===e.axis)&&"geographic"===e.rotationType));if(i<0)return e;const s=e.clone();return s.visualVariables.splice(i,1),this._randomRotationRenderers||(this._randomRotationRenderers=new WeakMap),this._randomRotationRenderers.set(s,t),s}get scaleVisibility(){return this.graphicsCore?.scaleVisibility}get filterVisibility(){return this.graphicsCore?.filterVisibility}get elevationAlignment(){return this.graphicsCore?.elevationAlignment}get objectStates(){return this.graphicsCore?.objectStates}get suspendResumeExtentMode(){return"suspendResumeExtentMode"in this.owner?this.owner.suspendResumeExtentMode:"computed"}get scaleVisibilitySuspended(){return null!=this.scaleVisibility&&this.scaleVisibility.suspended}get suspended(){return this.owner.suspended}get legendEnabled(){return null==this.frustumVisibility||!this.frustumVisibility.suspended}get suspendInfo(){const e={};return this.scaleVisibilitySuspended&&(e.outsideScaleRange=!0),null!=this.frustumVisibility&&this.frustumVisibility.suspended&&(e.outsideOfView=!0),e}get updating(){return!!(this.graphicsCore?.updating||null!=this.frustumVisibility&&this.frustumVisibility.updating||this.updatingHandles?.updating)}get updatingRemaining(){return this.graphicsCore?.updatingRemaining??0}get featureStore(){return this.graphicsCore?.featureStore}get view(){return this.owner.view}get loadedGraphics(){return this.owner.loadedGraphics}get fullOpacity(){return this.owner?.fullOpacity}get filter(){return"filter"in this.owner?this.owner.filter:null}get slicePlaneEnabled(){return this.owner.slicePlaneEnabled}get updatePolicy(){return this.owner.updatePolicy}get featureSpatialReference(){return"featureSpatialReference"in this.owner?this.owner.featureSpatialReference:this.owner.view.spatialReference}get graphics3DGraphics(){return this.graphicsCore?.graphics3DGraphics}get graphics3DGraphicsByObjectID(){return this.graphicsCore?.graphics3DGraphicsByObjectID}get symbolUpdateType(){return this.graphicsCore?.symbolUpdateType}get displayFeatureLimit(){const e=this.view.resourceController?.memoryController?.memoryFactor,t=this.graphicsCore?.displayFeatureLimit;if(null==e||1===e)return t;const i=Math.ceil(t.maximumNumberOfFeatures*e),s=Math.ceil(t.maximumTotalNumberOfFeatures*e),r=Math.ceil(t.minimumTotalNumberOfFeatures*e);return{...t,maximumNumberOfFeatures:i,maximumTotalNumberOfFeatures:s,minimumTotalNumberOfFeatures:r}}get usedMemory(){return this.graphicsCore?.usedMemory??0}get loadedFeatures(){return this.graphicsCore?.numberOfGraphics??0}get usedMemoryPerFeature(){return this.graphicsCore?.usedMemoryPerGraphic??0}get unprocessedMemoryEstimate(){return this.graphicsCore?.unprocessedMemoryEstimate??0}get performanceInfo(){return{core:this.graphicsCore.performanceInfo,elevationUpdating:this.elevationAlignment.updating,visibilityFrustum:null==this.frustumVisibility||!this.frustumVisibility.suspended,visibilityScale:!this.scaleVisibilitySuspended}}maskOccludee(e){const{set:t,handle:i}=this.objectStates.acquireSet(I.MaskOccludee,null);return this.objectStates.setUid(t,e.uid),i}highlight(e,i){if(e instanceof f){const{set:t,handle:s}=this.objectStates.acquireSet(I.Highlight,i);return this.owner.queryObjectIds(e).then((e=>this.objectStates.setObjectIds(t,e))),s}if("number"==typeof e||"string"==typeof e)return this.highlight([e],i);if(e instanceof t)return this.highlight([e],i);if("toArray"in e&&(e=e.toArray()),Array.isArray(e)&&e.length>0){if(e[0]instanceof t){const t=e;if(null==R(this.layer.fieldsIndex,t[0].attributes,i)){const e=t.map((e=>e.uid)),{set:i,handle:s}=this.objectStates.acquireSet(I.Highlight,null);return this.objectStates.setUids(i,e),s}e=t.map((e=>R(this.layer.fieldsIndex,e.attributes,i)))}if("number"==typeof e[0]||"string"==typeof e[0]){const t=e,{set:s,handle:r}=this.objectStates.acquireSet(I.Highlight,i);return this.objectStates.setObjectIds(s,t),r}}return U}resetObjectStates(){this.objectStates.reset()}whenGraphicBounds(e,t){return this.graphicsCore?.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.graphicsCore?.computeAttachmentOrigin(e,t)}notifyGraphicGeometryChanged(e){this.graphicsCore.notifyGraphicGeometryChanged(e)}notifyGraphicVisibilityChanged(e){this.graphicsCore.notifyGraphicVisibilityChanged(e)}getRenderingInfo(e,t,s){const r=g(e,{renderer:t,arcade:s});if(null!=r&&r.color){const e=r.color;e[0]=e[0]/255,e[1]=e[1]/255,e[2]=e[2]/255}if(null!=r&&null!=t&&this._randomRotationRenderers?.has(t)){const s=this._randomRotationRenderers.get(t),n=e.attributes[s],a=new i(0);a.updateFloatArray([n]),a.updateUint8Array([173]),r.heading=8.381e-8*a.digest()}return r}getRenderingInfoAsync(e,t,i,s){return b(e,{renderer:t,arcade:i,...s})}getSymbolLayerSize(e,t){return this.graphicsCore?.getSymbolLayerSize(e,t)}setObjectIdVisibility(e,t){this.graphicsCore?.setObjectIdVisibility(e,t)}refreshFilter(){null!=this.filterVisibility&&this.filterVisibility.reapply()}getGraphics3DGraphicByObjectId(e){return this.graphicsCore?.getGraphics3DGraphicByObjectId(e)}_updateClippingExtent(){const e=this.owner.view.clippingArea;this.graphicsCore.setClippingExtent(e,this.owner.view.spatialReference)&&(this.updateClippingExtent(e)||this.graphicsCore.recreateAllGraphics())}_setupSuspendResumeExtent(){(this.frustumVisibility||this.scaleVisibility)&&this.handles.add(o((()=>this.suspendResumeExtentMode),(()=>{switch(this.handles.remove(P),this.suspendResumeExtentMode){case"computed":this.handles.add([o((()=>this.graphicsCore.computedExtent),(e=>this._updateSuspendResumeExtent(e)),l),o((()=>this.graphicsCore.extentPadding),(()=>this._updateSuspendResumeExtent(this.graphicsCore.computedExtent)))],P);break;case"data":this.handles.add([p((()=>this.dataExtent),(e=>this._updateSuspendResumeExtent(e)),l),o((()=>this.graphicsCore.extentPadding),(()=>this._updateSuspendResumeExtent(this.dataExtent)))],P);break;default:s(this.suspendResumeExtentMode)}}),l))}_updateSuspendResumeExtent(e){e?this._suspendResumeExtentChanged(this._extentToSuspendResumeRect(e,this._suspendResumeExtent)):this._suspendResumeExtentChanged(null)}_extentToSuspendResumeRect(e,t){const i=this.owner.view.spatialReference;if(!e.spatialReference.equals(i)){if(!c(e,i))return;e=m(e,i)}return S(e,t,C,this.graphicsCore.extentPadding)}_suspendResumeExtentChanged(e){null!=this.frustumVisibility&&this.frustumVisibility.setExtent(e),null!=this.scaleVisibility&&this.scaleVisibility.setExtent(e)}};e([u()],_.prototype,"type",void 0),e([u({constructOnly:!0})],_.prototype,"owner",void 0),e([u()],_.prototype,"layer",null),e([u()],_.prototype,"renderer",null),e([u({constructOnly:!0})],_.prototype,"updateClippingExtent",void 0),e([u({constructOnly:!0})],_.prototype,"elevationFeatureExpressionEnabled",void 0),e([u({constructOnly:!0})],_.prototype,"graphicsCore",void 0),e([u({constructOnly:!0})],_.prototype,"scaleVisibilityEnabled",void 0),e([u({constructOnly:!0})],_.prototype,"filterVisibilityEnabled",void 0),e([u({constructOnly:!0})],_.prototype,"frustumVisibilityEnabled",void 0),e([u({constructOnly:!0})],_.prototype,"elevationAlignmentEnabled",void 0),e([u({constructOnly:!0})],_.prototype,"timeExtentEnabled",void 0),e([u({constructOnly:!0})],_.prototype,"setUidToIdOnAdd",void 0),e([u()],_.prototype,"scaleVisibility",null),e([u()],_.prototype,"filterVisibility",null),e([u()],_.prototype,"elevationAlignment",null),e([u({constructOnly:!0})],_.prototype,"frustumVisibility",void 0),e([u()],_.prototype,"objectStates",null),e([u()],_.prototype,"initializePromise",void 0),e([u()],_.prototype,"suspendResumeExtentMode",null),e([u()],_.prototype,"dataExtent",void 0),e([u()],_.prototype,"scaleVisibilitySuspended",null),e([u()],_.prototype,"suspended",null),e([u()],_.prototype,"legendEnabled",null),e([u()],_.prototype,"suspendInfo",null),e([u()],_.prototype,"updating",null),e([u()],_.prototype,"updatingRemaining",null),e([u()],_.prototype,"featureStore",null),e([u()],_.prototype,"view",null),e([u()],_.prototype,"loadedGraphics",null),e([u()],_.prototype,"fullOpacity",null),e([u()],_.prototype,"filter",null),e([u()],_.prototype,"slicePlaneEnabled",null),e([u()],_.prototype,"drapeSourceType",void 0),e([u()],_.prototype,"updatePolicy",null),e([u()],_.prototype,"preferredUpdatePolicy",void 0),e([u()],_.prototype,"displayFeatureLimit",null),_=e([d("esri.views.3d.layers.graphics.Graphics3DFeatureProcessor")],_);const A=_,P="suspendResumeExtentMode",U={remove(){},pause(){},resume(){}};export{A 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.27/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{get as i,releaseMaybe as s}from"../../../../core/maybe.js";import{throwIfAbortError as a,throwIfAborted as o}from"../../../../core/promiseUtils.js";import{pt2px as n,px2pt as l}from"../../../../core/screenUtils.js";import{dataComponents as c}from"../../../../core/urlUtils.js";import{c as h}from"../../../../chunks/mat4f64.js";import{f as m,a as u}from"../../../../chunks/vec2f64.js";import{f as d}from"../../../../chunks/vec3f64.js";import{f as _,c as p}from"../../../../chunks/vec4f64.js";import{projectPointToVector as f}from"../../../../geometry/projection.js";import{containsPoint as y}from"../../../../geometry/support/aaBoundingBox.js";import{createRendererExpression as g}from"../../../../support/arcadeOnDemand.js";import{defaultPrimitive as x}from"../../../../symbols/support/IconSymbol3DLayerResource.js";import{getIconHref as S}from"../../../../symbols/support/utils.js";import b from"../../../2d/arcade/callExpressionWithFeature.js";import{TRANSPARENT_UNIT as v}from"./constants.js";import{perObjectElevationAligner as z}from"./ElevationAligners.js";import{SymbolUpdateType as P,elevationModeChangeUpdateType as R,needsElevationUpdates2D as C}from"./elevationAlignmentUtils.js";import{ElevationContext as M}from"./ElevationContext.js";import j from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as I}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as w}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as O}from"./graphicUtils.js";import{ApplyRendererDiffResult as T}from"./interfaces.js";import{namedAnchorToHUDMaterialAnchorPos as U}from"./placementUtils.js";import{placePointOnGeometry as E,createStageObject as L,extendPointGraphicElevationContext as D}from"./pointUtils.js";import{initFastSymbolUpdatesState as F,updateFastSymbolUpdatesState as A,evaluateModelTransform as G,ConvertOptions as V}from"../support/FastSymbolUpdates.js";import{createTexture as B,DEFAULT_SYMBOL_SIZE_RATIO as N,DEFAULT_TEX_SIZE as q}from"../../support/engineContent/sdfPrimitives.js";import{DRAPED_Z as H}from"../../terrain/OverlayRenderer.js";import{PowerOfTwoResizeMode as k}from"../../webgl-engine/lib/basicInterfaces.js";import{createPointGeometry as W}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as $}from"../../webgl-engine/lib/RenderGeometry.js";import{Texture as J}from"../../webgl-engine/lib/Texture.js";import{HUDMaterial as Z}from"../../webgl-engine/materials/HUDMaterial.js";import K from"../../../../symbols/CIMSymbol.js";const Q=h(),X=d(0,0,1),Y=16,ee=1.5,te=N,re=[te/2,te/2,1-te/2,1-te/2],ie=[q*te,q*te];class se extends w{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(null!=r)this._prepareResourcesPrimitive(t,r);else{const r=S(this.symbolLayer),i=c(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=O(this._getIconSize());if(e)throw new r("graphics3diconsymbollayer:invalid-size",e)}_getIconSize(){const e=this.symbolLayer,t=Math.round(null!=e.size?n(e.size):Y);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,void 0,void 0);this._cimMaterialParametersInfo.anchorPosition=this._getAnchorPos("relative",s.anchorPosition);const a={width:s.imageData.width,height:s.imageData.height,powerOfTwoResizeMode:k.PAD};r=new J(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(ae(t)){const{screenLength:r,minWorldLength:i,maxWorldLength:s}=t.verticalOffset;e.verticalOffset={screenLength:n(r),minWorldLength:i||0,maxWorldLength:null!=s?s: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(oe(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,null!=this._context.sharedResources.textures){const r=this._context.sharedResources.textures.fromData(`${t}-icon`,(()=>B(t)));this._texture=r.texture,this._releaseTexture=r,e.textureId=this._texture.id}e.textureIsSignedDistanceField=!0,e.distanceFieldBoundingBox=re;const i=this._getIconSize();this._size=[i,i],this._symbolTextureRatio=1/te,this._createMaterialAndAddToStage(e,this._context.stage)}async _prepareResourcesHref(e,i,s){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.rasterPixelRatio;if(null!=this._context.sharedResources.textures){const l=await t(this._context.sharedResources.textures.fromUrl(i,n,{signal:s}));if(!1===l.ok){a(l.error);throw new r("graphics3diconsymbollayer:request-failed",`Failed to load (Request for icon resource failed: ${i})`)}this._releaseTexture=l.value;const c=l.value.texture,h=c.params;this._size=this._computeSize(h,o),e.textureId=c.id}this._createMaterialAndAddToStage(e,this._context.stage)}async _prepareResourcesCIM(e,t,r){const i=new K({data:t});if(!this._context.sharedResources.cimSymbolRasterizer){const e=(await import("../../../../symbols/cim/CIMSymbolRasterizer.js")).CIMSymbolRasterizer;o(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,n;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 g(t,this._context.layer.spatialReference,s);n=(e,t,i)=>{const s=b(r,e,{$view:i},"esriGeometryPoint",t);return null!==s?s:1}}else a=Number(e.scaleExpression)}this._cimScaleFactorOrFunction=a||n||1;const l=this._context.renderer?await this._context.renderer.getRequiredFields(this._context.layer.fieldsIndex):[];o(r);const c=this._context.layer.fieldsIndex;this._cimRequiredFields=l.map((e=>c.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||x}_getOutlineSize(){let e=0;const t=this.symbolLayer;if(null!=t.outline&&null!=t.outline.size)return Math.max(n(t.outline.size),0);return e=oe(this._getPrimitive())?ee:0,Math.max(e,0)}_getOutlineColor(){const t=this._getLayerOpacity(),r=this.symbolLayer,s=i(r,"outline","color");if(null!=s){const r=e.toUnitRGB(s),i=s.a*t;return[r[0],r[1],r[2],i]}return[0,0,0,0]}_getFillColor(){if(oe(this._getPrimitive()))return v;const e=null==this._getPrimitive(),t=i(this.symbolLayer,"material","color");return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}_getAnchorPos(e,t){return"relative"===e?m((t.x||0)+.5,.5-(t.y||0)):e in U?U[e]:U.center}_createMaterialAndAddToStage(e,t){if(this._cimLayers?this._fastUpdates=null:this._fastUpdates=F(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastUpdates&&Object.assign(e,this._fastUpdates.materialParameters),this._cimLayers){let r=null!=e.textureId?this._cimSymbolMaterials.get(e.textureId):null;return r||(r=new Z(e),this._cimSymbolMaterials.set(e.textureId??0,r),t.add(r)),r}return this._material=new Z(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=s(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]=n(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=[0,0];if(this._cimLayers){if(!this._cimLayers.length)return null;const e=this._generateTextureCIM(t),s={textureId:e.id,...this._cimMaterialParametersInfo};r=this._createMaterialAndAddToStage(s,this._context.stage),i=[e.params.width,e.params.height]}else i=this._size,r=this._material;const s=E(t.geometry);if(null==s)return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const a=e.renderingInfo,o=this._getVertexOpacityAndColor(a);let n=1;if(!this._fastUpdates?.visualVariables.size){const e=i[0]>i[1]?i[0]:i[1];n=this._getScaleFactor(a,e)}n*=this._symbolTextureRatio;const l=m(i[0]*n,i[1]*n),c=this.setGraphicElevationContext(t,new M);return this.ensureDrapedStatus("on-the-ground"===c.mode)&&this._setDrapingDependentMaterialParameters(),this.draped?this._createAsOverlay(t,s,r,o,l,e.layer.uid):this._createAs3DShape(t,s,r,o,l,c,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=R(se.elevationModeChangeTypes,r,i);if(s!==P.UPDATE)return s;const a=C(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}get pixelRatioChanged(){return null!=this._getPrimitive()}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return T.Recreate_Symbol;if(!A(this._fastUpdates,t,this._fastVisualVariableConvertOptions()))return T.Recreate_Symbol;null!=this._material&&this._material.setParameters(this._fastUpdates.materialParameters)}return T.Fast_Update}_defaultElevationInfoNoZ(){return ne}_createAs3DShape(e,t,r,i,s,a,o){const n=this.getFastUpdateAttrValues(e),l=n&&this._fastUpdates?e=>G(this._fastUpdates.materialParameters,n,e):void 0,c=this._context.layer.uid,h=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerUid:c}),m=W(r,X,null,i,s,le,null,n,h),u=L(this._context,t,m,a,o,l);if(null==u)return null;const d=new I(this,u.object,[m],null,null,z,a);return d.alignedSampledElevation=u.sampledElevation,d.needsElevationUpdates=C(a.mode)||"absolute-height"===a.mode,d.getScreenSize=this._createScreenSizeGetter(s,l),d.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(d.getScreenSize(),1,e),D(d,t,this._context.elevationProvider),d}_createAsOverlay(e,t,r,i,s,a){r.renderPriority=this._renderPriority;const o=p();f(t,o,this._context.overlaySR),o[2]=H;const n=this._context.clippingExtent;if(null!=n&&!y(n,o))return null;const l=this.getFastUpdateAttrValues(e),c=l&&this._fastUpdates?e=>G(this._fastUpdates.materialParameters,l,e):void 0,h=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:e.uid,layerUid:this._context.layer.uid}),m=W(r,X,o,i,s,null,null,l,h),u=new $(m,{layerUid:a,graphicUid:e.uid,shaderTransformer:c}),d=new j(this,[u],null,this._context.drapeSourceRenderer);return d.getScreenSize=this._createScreenSizeGetter(s,c),d.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(d.getScreenSize(),1,e),d}_createScreenSizeGetter(e,t){const r=this._outlineSize+2;if(this._fastUpdates&&t){const i=e[0]/this._symbolTextureRatio,s=e[1]/this._symbolTextureRatio;return(e=u())=>{const a=t(Q);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=u())=>(e[0]=t,e[1]=i,e)}}_fastVisualVariableConvertOptions(){const e=Math.max(this._size[0],this._size[1]),t=d(e,e,e),r=l(1),i=e*r,s=d(i,i,i);return new V(t,s,r)}_getGraphicHash(e){let t="";for(const r of this._cimRequiredFields)t+=r+e.attributes[r];return t}_forEachMaterial(e){null!=this._material&&e(this._material),this._cimSymbolMaterials.forEach(e)}test(){return{...super.test(),material:this._material}}}function ae(e){return e&&"point-3d"===e.type&&e.hasVisibleVerticalOffset()}function oe(e){return null!=e&&("cross"===e||"x"===e)}se.PRIMITIVE_SIZE=ie,se.elevationModeChangeTypes={definedChanged:P.UPDATE,staysOnTheGround:P.NONE,onTheGroundChanged:P.RECREATE};const ne={mode:"relative-to-ground",offset:0},le=_(0,0,0,1);export{se as Graphics3DIconSymbolLayer};
|
|
5
|
+
import e from"../../../../Color.js";import"../../../../symbols.js";import{result as t}from"../../../../core/asyncUtils.js";import r from"../../../../core/Error.js";import{get as i,releaseMaybe as s}from"../../../../core/maybe.js";import{throwIfAbortError as a,throwIfAborted as o}from"../../../../core/promiseUtils.js";import{pt2px as n,px2pt as l}from"../../../../core/screenUtils.js";import{dataComponents as c}from"../../../../core/urlUtils.js";import{c as h}from"../../../../chunks/mat4f64.js";import{f as m,a as u}from"../../../../chunks/vec2f64.js";import{f as d}from"../../../../chunks/vec3f64.js";import{f as _,c as p}from"../../../../chunks/vec4f64.js";import{projectPointToVector as f}from"../../../../geometry/projection.js";import{containsPoint as y}from"../../../../geometry/support/aaBoundingBox.js";import{createRendererExpression as g}from"../../../../support/arcadeOnDemand.js";import{defaultPrimitive as x}from"../../../../symbols/support/IconSymbol3DLayerResource.js";import{getIconHref as S}from"../../../../symbols/support/utils.js";import b from"../../../2d/arcade/callExpressionWithFeature.js";import{TRANSPARENT_UNIT as v}from"./constants.js";import{perObjectElevationAligner as z}from"./ElevationAligners.js";import{SymbolUpdateType as P,elevationModeChangeUpdateType as R,needsElevationUpdates2D as C}from"./elevationAlignmentUtils.js";import{ElevationContext as M}from"./ElevationContext.js";import j from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as I}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as w}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as O}from"./graphicUtils.js";import{ApplyRendererDiffResult as T}from"./interfaces.js";import{namedAnchorToHUDMaterialAnchorPos as U}from"./placementUtils.js";import{placePointOnGeometry as E,createStageObject as L,extendPointGraphicElevationContext as D}from"./pointUtils.js";import{initFastSymbolUpdatesState as F,updateFastSymbolUpdatesState as A,evaluateModelTransform as G,ConvertOptions as V}from"../support/FastSymbolUpdates.js";import{createTexture as B,DEFAULT_SYMBOL_SIZE_RATIO as N,DEFAULT_TEX_SIZE as q}from"../../support/engineContent/sdfPrimitives.js";import{DRAPED_Z as H}from"../../terrain/OverlayRenderer.js";import{PowerOfTwoResizeMode as k}from"../../webgl-engine/lib/basicInterfaces.js";import{createPointGeometry as W}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as $}from"../../webgl-engine/lib/RenderGeometry.js";import{Texture as J}from"../../webgl-engine/lib/Texture.js";import{HUDMaterial as Z}from"../../webgl-engine/materials/HUDMaterial.js";import K from"../../../../symbols/CIMSymbol.js";const Q=h(),X=d(0,0,1),Y=16,ee=1.5,te=N,re=[te/2,te/2,1-te/2,1-te/2],ie=[q*te,q*te];class se extends w{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(null!=r)this._prepareResourcesPrimitive(t,r);else{const r=S(this.symbolLayer),i=c(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=O(this._getIconSize());if(e)throw new r("graphics3diconsymbollayer:invalid-size",e)}_getIconSize(){const e=this.symbolLayer,t=Math.round(null!=e.size?n(e.size):Y);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,void 0,void 0);this._cimMaterialParametersInfo.anchorPosition=this._getAnchorPos("relative",s.anchorPosition);const a={width:s.imageData.width,height:s.imageData.height,powerOfTwoResizeMode:k.PAD};r=new J(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(ae(t)){const{screenLength:r,minWorldLength:i,maxWorldLength:s}=t.verticalOffset;e.verticalOffset={screenLength:n(r),minWorldLength:i||0,maxWorldLength:null!=s?s: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(oe(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,null!=this._context.sharedResources.textures){const r=this._context.sharedResources.textures.fromData(`${t}-icon`,(()=>B(t)));this._texture=r.texture,this._releaseTexture=r,e.textureId=this._texture.id}e.textureIsSignedDistanceField=!0,e.distanceFieldBoundingBox=re;const i=this._getIconSize();this._size=[i,i],this._symbolTextureRatio=1/te,this._createMaterialAndAddToStage(e,this._context.stage)}async _prepareResourcesHref(e,i,s){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.rasterPixelRatio;if(null!=this._context.sharedResources.textures){const l=await t(this._context.sharedResources.textures.fromUrl(i,n,{signal:s}));if(!1===l.ok){a(l.error);throw new r("graphics3diconsymbollayer:request-failed",`Failed to load (Request for icon resource failed: ${i})`)}this._releaseTexture=l.value;const c=l.value.texture,h=c.params;this._size=this._computeSize(h,o),e.textureId=c.id}this._createMaterialAndAddToStage(e,this._context.stage)}async _prepareResourcesCIM(e,t,r){const i=new K({data:t});if(!this._context.sharedResources.cimSymbolRasterizer){const e=(await import("../../../../symbols/cim/CIMSymbolRasterizer.js")).CIMSymbolRasterizer;o(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,n;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 g(t,this._context.layer.spatialReference,s);n=(e,t,i)=>{const s=b(r,e,{$view:i},"esriGeometryPoint",t);return null!==s?s:1}}else a=Number(e.scaleExpression)}this._cimScaleFactorOrFunction=a||n||1;const l=this._context.renderer?await this._context.renderer.getRequiredFields(this._context.layer.fieldsIndex):[];o(r);const c=this._context.layer.fieldsIndex;this._cimRequiredFields=l.map((e=>c.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||x}_getOutlineSize(){let e=0;const t=this.symbolLayer;if(null!=t.outline&&null!=t.outline.size)return Math.max(n(t.outline.size),0);return e=oe(this._getPrimitive())?ee:0,Math.max(e,0)}_getOutlineColor(){const t=this._getLayerOpacity(),r=this.symbolLayer,s=i(r,"outline","color");if(null!=s){const r=e.toUnitRGB(s),i=s.a*t;return[r[0],r[1],r[2],i]}return[0,0,0,0]}_getFillColor(){if(oe(this._getPrimitive()))return v;const e=null==this._getPrimitive(),t=i(this.symbolLayer,"material","color");return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}_getAnchorPos(e,t){return"relative"===e?m((t.x||0)+.5,.5-(t.y||0)):e in U?U[e]:U.center}_createMaterialAndAddToStage(e,t){if(this._cimLayers){this._fastUpdates=null;let r=e.textureId?this._cimSymbolMaterials.get(e.textureId):null;return r||(r=new Z(e),this._cimSymbolMaterials.set(e.textureId??0,r),t.add(r)),r}return this._fastUpdates=F(this._context.renderer,this._fastVisualVariableConvertOptions()),this._fastUpdates&&(e={...e,...this._fastUpdates.materialParameters}),this._material=new Z(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=s(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]=n(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=[0,0];if(this._cimLayers){if(!this._cimLayers.length)return null;const e=this._generateTextureCIM(t),s={textureId:e.id,...this._cimMaterialParametersInfo};r=this._createMaterialAndAddToStage(s,this._context.stage),i=[e.params.width,e.params.height]}else i=this._size,r=this._material;const s=E(t.geometry);if(null==s)return this.logger.warn(`unsupported geometry type for icon symbol: ${t.geometry.type}`),null;const a=e.renderingInfo,o=this._getVertexOpacityAndColor(a);let n=1;if(!this._fastUpdates?.visualVariables.size){const e=i[0]>i[1]?i[0]:i[1];n=this._getScaleFactor(a,e)}n*=this._symbolTextureRatio;const l=m(i[0]*n,i[1]*n),c=this.setGraphicElevationContext(t,new M);return this.ensureDrapedStatus("on-the-ground"===c.mode)&&this._setDrapingDependentMaterialParameters(),this.draped?this._createAsOverlay(t,s,r,o,l,e.layer.uid):this._createAs3DShape(t,s,r,o,l,c,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=R(se.elevationModeChangeTypes,r,i);if(s!==P.UPDATE)return s;const a=C(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}get pixelRatioChanged(){return null!=this._getPrimitive()}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return T.RecreateSymbol;if(!A(this._fastUpdates,t,this._fastVisualVariableConvertOptions()))return T.RecreateSymbol;null!=this._material&&this._material.setParameters(this._fastUpdates.materialParameters)}return T.FastUpdate}_defaultElevationInfoNoZ(){return ne}_createAs3DShape(e,t,r,i,s,a,o){const n=this.getFastUpdateAttrValues(e),l=n&&this._fastUpdates?e=>G(this._fastUpdates.materialParameters,n,e):void 0,c=this._context.layer.uid,h=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerUid:c}),m=W(r,X,null,i,s,le,null,n,h),u=L(this._context,t,m,a,o,l);if(null==u)return null;const d=new I(this,u.object,[m],null,null,z,a);return d.alignedSampledElevation=u.sampledElevation,d.needsElevationUpdates=C(a.mode)||"absolute-height"===a.mode,d.getScreenSize=this._createScreenSizeGetter(s,l),d.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(d.getScreenSize(),1,e),D(d,t,this._context.elevationProvider),d}_createAsOverlay(e,t,r,i,s,a){r.renderPriority=this._renderPriority;const o=p();f(t,o,this._context.overlaySR),o[2]=H;const n=this._context.clippingExtent;if(null!=n&&!y(n,o))return null;const l=this.getFastUpdateAttrValues(e),c=l&&this._fastUpdates?e=>G(this._fastUpdates.materialParameters,l,e):void 0,h=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:e.uid,layerUid:this._context.layer.uid}),m=W(r,X,o,i,s,null,null,l,h),u=new $(m,{layerUid:a,graphicUid:e.uid,shaderTransformer:c}),d=new j(this,[u],null,this._context.drapeSourceRenderer);return d.getScreenSize=this._createScreenSizeGetter(s,c),d.calculateRelativeScreenBounds=e=>r.calculateRelativeScreenBounds(d.getScreenSize(),1,e),d}_createScreenSizeGetter(e,t){const r=this._outlineSize+2;if(this._fastUpdates&&t){const i=e[0]/this._symbolTextureRatio,s=e[1]/this._symbolTextureRatio;return(e=u())=>{const a=t(Q);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=u())=>(e[0]=t,e[1]=i,e)}}_fastVisualVariableConvertOptions(){const e=Math.max(this._size[0],this._size[1]),t=d(e,e,e),r=l(1),i=e*r,s=d(i,i,i);return new V({size:!0,color:!0,rotation:!0,opacity:!1},t,s,r)}_getGraphicHash(e){let t="";for(const r of this._cimRequiredFields)t+=r+e.attributes[r];return t}_forEachMaterial(e){null!=this._material&&e(this._material),this._cimSymbolMaterials.forEach(e)}test(){return{...super.test(),material:this._material}}}function ae(e){return e&&"point-3d"===e.type&&e.hasVisibleVerticalOffset()}function oe(e){return null!=e&&("cross"===e||"x"===e)}se.PRIMITIVE_SIZE=ie,se.elevationModeChangeTypes={definedChanged:P.UPDATE,staysOnTheGround:P.NONE,onTheGroundChanged:P.RECREATE};const ne={mode:"relative-to-ground",offset:0},le=_(0,0,0,1);export{se 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.27/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../geometry.js";import e from"../../../../core/Error.js";import{applySome as t,releaseMaybe as r,get as i}from"../../../../core/maybe.js";import{px2pt as a,pt2px as s}from"../../../../core/screenUtils.js";import{f as l,d as o}from"../../../../chunks/vec4f64.js";import{create as n,empty as h,expandWithBuffer as c,intersectsClippingArea as p,expandWithAABB as m}from"../../../../geometry/support/aaBoundingBox.js";import{getDriverAxisSizeValueAny as d}from"../../../../renderers/support/renderingInfoUtils.js";import{sharedGeometryElevationAligner as _}from"./ElevationAligners.js";import{SymbolUpdateType as u,elevationModeChangeUpdateType as y,needsElevationUpdates2D as g}from"./elevationAlignmentUtils.js";import{ElevationContext as f}from"./ElevationContext.js";import C from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as M}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as b,getAttributeValue as v}from"./Graphics3DSymbolLayer.js";import{ApplyRendererDiffResult as E}from"./interfaces.js";import{parseLineMarkerStyle as L,parseCapType as P}from"./lineUtils.js";import{ConvertOptions as w,initFastSymbolUpdatesState as x,updateFastSymbolUpdatesState as k}from"../support/FastSymbolUpdates.js";import D from"../../support/debugFlags.js";import{createGeometry as R}from"../../support/engineContent/line.js";import{prepareMarkerResources as A}from"../../support/engineContent/marker.js";import{geometryToRenderInfo as j,geometryToRenderInfoDraped as S}from"../../support/renderInfoUtils/line.js";import{Object3D as U}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as O}from"../../webgl-engine/lib/RenderGeometry.js";import{LineMarkerMaterial as z}from"../../webgl-engine/materials/LineMarkerMaterial.js";import{getStipplePatternForLinePattern as G}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as V}from"../../webgl-engine/materials/RibbonLineMaterial.js";import F from"../../../../geometry/Extent.js";import I from"../../../../geometry/Polygon.js";const T=["polyline","polygon","extent"];class W extends b{constructor(e,t,r,i){super(e,t,r,i),this._vvConvertOptions=new w}async doLoad(){if(this._vvConvertOptions.supportsOpacity=!0,this._vvConvertOptions.supportsRotation=!1,this._fastUpdates=x(this._context.renderer,this._vvConvertOptions),!this._drivenProperties.size){if((null!=this.symbolLayer.size?this.symbolLayer.size:a(1))<0)throw new e("graphics3dlinesymbollayer:invalid-size","Symbol sizes may not be negative values")}this._markerTexture=null!=this.symbolLayer.marker&&null!=this._context.sharedResources.textures?A(this._context.sharedResources.textures,L(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 i={width:this._computeMaterialWidth(this.symbolLayer?.size),color:r,hasPolygonOffset:!0,join:this.symbolLayer.join||"miter",cap:P(this.symbolLayer.cap||"butt"),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:e,stipplePattern:G(this.symbolLayer.pattern),stippleScaleWithLineWidth:!0};return this._fastUpdates?.visualVariables?{...i,...this._fastUpdates.materialParameters}:i}get _materialColor(){return t(this.symbolLayer.material,(e=>e.color))}get _markerColor(){return t(this.symbolLayer.marker,(e=>e.color))}get _lineMaterial(){return null==this._lineMaterialCached&&(this._lineMaterialCached=new V(this._getMaterialParameters(!1)),this._context.stage.add(this._lineMaterialCached)),this._lineMaterialCached}get _ringMaterial(){return null==this._ringMaterialCached&&(this._ringMaterialCached=new V(this._getMaterialParameters(!0)),this._context.stage.add(this._ringMaterialCached)),this._ringMaterialCached}get _wireframeLineMaterial(){return null==this._wireframeLineMaterialCached&&(this._wireframeLineMaterialCached=new V({...this._getMaterialParameters(!1),wireframe:!0}),this._context.stage.add(this._wireframeLineMaterialCached)),this._wireframeLineMaterialCached}get _wireframeRingMaterial(){return null==this._wireframeRingMaterialCached&&(this._wireframeRingMaterialCached=new V({...this._getMaterialParameters(!0),wireframe:!0}),this._context.stage.add(this._wireframeRingMaterialCached)),this._wireframeRingMaterialCached}get _markerMaterial(){return null==this._markerMaterialCached&&null!=this.symbolLayer.marker&&null!=this._markerTexture&&(this._markerMaterialCached=new z({...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=r(this._markerTexture)}_getDrivenSize(e){return this._drivenProperties.size&&e.size?s(d(e.size)):1}_getSizeFeatureAttributeData(e){return this._fastUpdates&&this._fastUpdates.visualVariables.size?v(this._fastUpdates.visualVariables.size.field,e):null}_getDrivenColor(e){const t=l(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?.visualVariables.color?v(this._fastUpdates.visualVariables.color.field,e):null}_getOpacityFeatureAttributeData(e){return this._fastUpdates?.visualVariables.opacity?v(this._fastUpdates.visualVariables.opacity.field,e):null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,T,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t,new f);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 E.Recreate_Symbol;{const e=this._fastUpdates;if(!k(e,t,this._vvConvertOptions))return E.Recreate_Symbol;this._forEachMaterial((t=>t.setParameters(e.materialParameters)))}}return E.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=P(t.cap.newValue??"butt"),delete t.cap);const i=this._prepareMarkerPatch(e,t);this._prepareMaterialPatch(e,t,i),e.symbolLayerStatePatches.push((()=>this._forEachMaterial((e=>e.setParameters(r)))))}layerOpacityChanged(){this._forEachMaterial(((e,t)=>this._updateMaterialLayerOpacity(e,t)))}_forEachMaterial(e){null!=this._lineMaterialCached&&e(this._lineMaterialCached),null!=this._ringMaterialCached&&e(this._ringMaterialCached),null!=this._wireframeLineMaterialCached&&e(this._wireframeLineMaterialCached),null!=this._wireframeRingMaterialCached&&e(this._wireframeRingMaterialCached),null!=this._markerMaterialCached&&e(this._markerMaterialCached,!0)}_updateMaterialLayerOpacity(e,t=!1){const r=e.parameters.color,a=i(this.symbolLayer,"material","color"),s=this._patternHidesLine&&!t?0:this._getCombinedOpacity(a),o=l(r[0],r[1],r[2],s);e.setParameters({color:o})}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,a=y(W.elevationModeChangeTypes,r,i);if(a!==u.UPDATE)return a;const s=g(i);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>s))}slicePlaneEnabledChanged(){const e={hasSlicePlane:this._context.slicePlaneEnabled};return this._forEachMaterial((t=>t.setParameters(e))),!0}physicalBasedRenderingChanged(){return!0}_getGeometryAsPolygonOrPolyline(e){switch(e.type){case"extent":if(e instanceof F)return I.fromExtent(e);break;case"polygon":case"polyline":return e}return null}_createAs3DShape(e,t,r){const i=e.graphic,a=this._getGeometryAsPolygonOrPolyline(i.geometry),s="polygon"===a.type?a.rings:a.paths,l=new Array,o=n(),m=j(a,this._context.elevationProvider,this._context.renderCoordsHelper,t),d="polygon"===a.type?"rings":"paths";this._logGeometryCreationWarnings(m,s,d,"LineSymbol3DLayer");for(let n=0;n<m.lines.length;n++){const t=m.lines[n],i=t.position,s=t.mapPositions;if(null!=this._context.clippingExtent&&(h(o),c(o,s),!p(o,this._context.clippingExtent)))continue;const d=this._createGeometry("polygon"===a.type?this._ringMaterial:this._lineMaterial,e,i,s,a.type,H.ELEVATED,r);l.push(d),D.LINE_WIREFRAMES&&l.push(d.instantiate({material:"polygon"===a.type?this._wireframeRingMaterial:this._wireframeLineMaterial})),null!=this._markerMaterial&&l.push(d.instantiate({material:this._markerMaterial}))}if(0===l.length)return null;const u=new U({geometries:l,castShadow:!1,layerUid:this._context.layer.uid,graphicUid:r}),y=new M(this,u,l,null,null,_,t);return y.alignedSampledElevation=m.sampledElevation,y.needsElevationUpdates=g(t.mode),y}_createGeometry(e,t,r,i,a,s,l){const o="polygon"===a,n=this._fastUpdates?.visualVariables.color,h=this._fastUpdates?.visualVariables.size,c=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:l,layerUid:this._context.layer.uid});return R(e,{overlayInfo:s===H.DRAPED?{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper}:null,removeDuplicateStartEnd:o,mapPositions:i,attributeData:{position:r,size:h?null:this._getDrivenSize(t.renderingInfo),color:n?null:this._getDrivenColor(t.renderingInfo),sizeFeature:this._getSizeFeatureAttributeData(t.graphic),colorFeature:this._getColorFeatureAttributeData(t.graphic),opacityFeature:this._getOpacityFeatureAttributeData(t.graphic)}},c)}_createAsOverlay(e,t){const r=e.graphic,i=this._getGeometryAsPolygonOrPolyline(r.geometry),a="polygon"===i.type?i.rings:i.paths,s="polygon"===i.type?this._ringMaterial:this._lineMaterial;s.renderPriority=this._renderPriority;const l=D.LINE_WIREFRAMES?"polygon"===i.type?this._wireframeRingMaterial:this._wireframeLineMaterial:null,o=this._markerMaterial;null!=l&&(l.renderPriority=this._renderPriority-.001),null!=o&&(o.renderPriority=this._renderPriority-.002);const d=new Array,_=n(),u=h(),y=S(i,this._context.overlaySR),g="polygon"===i.type?"rings":"paths";this._logGeometryCreationWarnings(y,a,g,"LineSymbol3DLayer");for(const n of y.lines){if(h(_),c(_,n.position),!p(_,this._context.clippingExtent))continue;m(u,_);const a=a=>{const s=this._createGeometry(a,e,n.position,void 0,i.type,H.DRAPED,r.uid),l=new O(s,{layerUid:t,graphicUid:r.uid});d.push(l)};if(null!=o){a(o);const e=this.symbolLayer.marker.placement;"begin"!==e&&"begin-end"!==e||c(_,n.position,0,1),"end"!==e&&"begin-end"!==e||c(_,n.position,n.position.length-3,1)}a(s),D.LINE_WIREFRAMES&&a(l)}return new C(this,d,u,this._context.drapeSourceRenderer)}get _patternHidesLine(){const e=this.symbolLayer.pattern;return null!=e&&"style"===e.type&&"none"===e.style}_computeMaterialWidth(e){return e=e??a(1),this._drivenProperties.size?this._fastUpdates?.visualVariables.size?s(1):1:s(e)}_prepareMaterialPatch(e,r,i){const a=r.material;if(null==a)return void(i.changed&&i.useMaterialColor&&this._patchMaterialColor(this._getCombinedOpacityAndColor(this._materialColor),this._markerMaterialCached,e));if("collection"===a.type)return;const s="complete"===a.type?t(a.newValue,(e=>e.color)):"complete"===a.diff.color?.type?a.diff.color.newValue:null,l=this._getCombinedOpacityAndColor(s);i.useMaterialColor&&this._patchMaterialColor(o(l),this._markerMaterialCached,e),this._patternHidesLine&&(l[3]=0),this._patchMaterialColor(l,this._lineMaterialCached,e),delete r.material}_prepareMarkerPatch(e,t){const r=t.marker;if(null==r||"partial"!==r.type||null!=r.diff.style||null!=r.diff.placement||null!=r.diff.color&&"complete"!==r.diff.color.type)return{changed:!1,useMaterialColor:null==this._markerColor};const i=r.diff.color;if(null==i)return delete t.marker,{changed:!1,useMaterialColor:null==this._markerColor};const a=i.newValue;return null==a?(delete t.marker,{changed:!0,useMaterialColor:!0}):(this._patchMaterialColor(this._getCombinedOpacityAndColor(a),this._markerMaterialCached,e),delete t.marker,{changed:!0,useMaterialColor:!1})}_patchMaterialColor(e,t,r){null!=t&&r.symbolLayerStatePatches.push((()=>t.setParameters({color:e})))}}var H;W.elevationModeChangeTypes={definedChanged:u.RECREATE,staysOnTheGround:u.NONE,onTheGroundChanged:u.RECREATE},function(e){e[e.DRAPED=0]="DRAPED",e[e.ELEVATED=1]="ELEVATED"}(H||(H={}));export{W as Graphics3DLineSymbolLayer};
|
|
5
|
+
import"../../../../geometry.js";import e from"../../../../core/Error.js";import{applySome as t,releaseMaybe as r,get as i}from"../../../../core/maybe.js";import{px2pt as a,pt2px as s}from"../../../../core/screenUtils.js";import{f as l,d as o}from"../../../../chunks/vec4f64.js";import{create as n,empty as h,expandWithBuffer as c,intersectsClippingArea as p,expandWithAABB as m}from"../../../../geometry/support/aaBoundingBox.js";import{getDriverAxisSizeValueAny as d}from"../../../../renderers/support/renderingInfoUtils.js";import{sharedGeometryElevationAligner as y}from"./ElevationAligners.js";import{SymbolUpdateType as _,elevationModeChangeUpdateType as u,needsElevationUpdates2D as g}from"./elevationAlignmentUtils.js";import{ElevationContext as f}from"./ElevationContext.js";import M from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as C}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as b}from"./Graphics3DSymbolLayer.js";import{ApplyRendererDiffResult as E}from"./interfaces.js";import{parseLineMarkerStyle as L,parseCapType as P}from"./lineUtils.js";import{ConvertOptions as w,initFastSymbolUpdatesState as x,updateFastSymbolUpdatesState as v,getAttributeValue as k}from"../support/FastSymbolUpdates.js";import R from"../../support/debugFlags.js";import{createGeometry as j}from"../../support/engineContent/line.js";import{prepareMarkerResources as D}from"../../support/engineContent/marker.js";import{geometryToRenderInfo as A,geometryToRenderInfoDraped as S}from"../../support/renderInfoUtils/line.js";import{Object3D as U}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as G}from"../../webgl-engine/lib/RenderGeometry.js";import{LineMarkerMaterial as z}from"../../webgl-engine/materials/LineMarkerMaterial.js";import{getStipplePatternForLinePattern as O}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as I}from"../../webgl-engine/materials/RibbonLineMaterial.js";import T from"../../../../geometry/Extent.js";import V from"../../../../geometry/Polygon.js";const W=["polyline","polygon","extent"],F=new w({size:!0,color:!0,rotation:!1,opacity:!0});class H extends b{constructor(e,t,r,i){super(e,t,r,i)}async doLoad(){if(this._fastUpdates=x(this._context.renderer,F),!this._drivenProperties.size){if((null!=this.symbolLayer.size?this.symbolLayer.size:a(1))<0)throw new e("graphics3dlinesymbollayer:invalid-size","Symbol sizes may not be negative values")}this._markerTexture=null!=this.symbolLayer.marker&&null!=this._context.sharedResources.textures?D(this._context.sharedResources.textures,L(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 i={width:this._computeMaterialWidth(this.symbolLayer?.size),color:r,hasPolygonOffset:!0,join:this.symbolLayer.join||"miter",cap:P(this.symbolLayer.cap||"butt"),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:e,stipplePattern:O(this.symbolLayer.pattern),stippleScaleWithLineWidth:!0};return this._fastUpdates?.visualVariables?{...i,...this._fastUpdates.materialParameters}:i}get _materialColor(){return t(this.symbolLayer.material,(e=>e.color))}get _markerColor(){return t(this.symbolLayer.marker,(e=>e.color))}get _lineMaterial(){return null==this._lineMaterialCached&&(this._lineMaterialCached=new I(this._getMaterialParameters(!1)),this._context.stage.add(this._lineMaterialCached)),this._lineMaterialCached}get _ringMaterial(){return null==this._ringMaterialCached&&(this._ringMaterialCached=new I(this._getMaterialParameters(!0)),this._context.stage.add(this._ringMaterialCached)),this._ringMaterialCached}get _wireframeLineMaterial(){return null==this._wireframeLineMaterialCached&&(this._wireframeLineMaterialCached=new I({...this._getMaterialParameters(!1),wireframe:!0}),this._context.stage.add(this._wireframeLineMaterialCached)),this._wireframeLineMaterialCached}get _wireframeRingMaterial(){return null==this._wireframeRingMaterialCached&&(this._wireframeRingMaterialCached=new I({...this._getMaterialParameters(!0),wireframe:!0}),this._context.stage.add(this._wireframeRingMaterialCached)),this._wireframeRingMaterialCached}get _markerMaterial(){return null==this._markerMaterialCached&&null!=this.symbolLayer.marker&&null!=this._markerTexture&&(this._markerMaterialCached=new z({...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=r(this._markerTexture)}_getDrivenSize(e){return this._drivenProperties.size&&e.size?s(d(e.size)):1}_getDrivenColor(e){const t=l(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}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,W,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t,new f);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 E.RecreateSymbol;{const e=this._fastUpdates;if(!v(e,t,F))return E.RecreateSymbol;this._forEachMaterial((t=>t.setParameters(e.materialParameters)))}}return E.FastUpdate}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=P(t.cap.newValue??"butt"),delete t.cap);const i=this._prepareMarkerPatch(e,t);this._prepareMaterialPatch(e,t,i),e.symbolLayerStatePatches.push((()=>this._forEachMaterial((e=>e.setParameters(r)))))}layerOpacityChanged(){this._forEachMaterial(((e,t)=>this._updateMaterialLayerOpacity(e,t)))}_forEachMaterial(e){null!=this._lineMaterialCached&&e(this._lineMaterialCached),null!=this._ringMaterialCached&&e(this._ringMaterialCached),null!=this._wireframeLineMaterialCached&&e(this._wireframeLineMaterialCached),null!=this._wireframeRingMaterialCached&&e(this._wireframeRingMaterialCached),null!=this._markerMaterialCached&&e(this._markerMaterialCached,!0)}_updateMaterialLayerOpacity(e,t=!1){const r=e.parameters.color,a=i(this.symbolLayer,"material","color"),s=this._patternHidesLine&&!t?0:this._getCombinedOpacity(a),o=l(r[0],r[1],r[2],s);e.setParameters({color:o})}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,a=u(H.elevationModeChangeTypes,r,i);if(a!==_.UPDATE)return a;const s=g(i);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>s))}slicePlaneEnabledChanged(){const e={hasSlicePlane:this._context.slicePlaneEnabled};return this._forEachMaterial((t=>t.setParameters(e))),!0}physicalBasedRenderingChanged(){return!0}_getGeometryAsPolygonOrPolyline(e){switch(e.type){case"extent":if(e instanceof T)return V.fromExtent(e);break;case"polygon":case"polyline":return e}return null}_createAs3DShape(e,t,r){const i=e.graphic,a=this._getGeometryAsPolygonOrPolyline(i.geometry),s="polygon"===a.type?a.rings:a.paths,l=new Array,o=n(),m=A(a,this._context.elevationProvider,this._context.renderCoordsHelper,t),d="polygon"===a.type?"rings":"paths";this._logGeometryCreationWarnings(m,s,d,"LineSymbol3DLayer");for(let n=0;n<m.lines.length;n++){const t=m.lines[n],i=t.position,s=t.mapPositions;if(null!=this._context.clippingExtent&&(h(o),c(o,s),!p(o,this._context.clippingExtent)))continue;const d=this._createGeometry("polygon"===a.type?this._ringMaterial:this._lineMaterial,e,i,s,a.type,N.ELEVATED,r);l.push(d),R.LINE_WIREFRAMES&&l.push(d.instantiate({material:"polygon"===a.type?this._wireframeRingMaterial:this._wireframeLineMaterial})),null!=this._markerMaterial&&l.push(d.instantiate({material:this._markerMaterial}))}if(0===l.length)return null;const _=new U({geometries:l,castShadow:!1,layerUid:this._context.layer.uid,graphicUid:r}),u=new C(this,_,l,null,null,y,t);return u.alignedSampledElevation=m.sampledElevation,u.needsElevationUpdates=g(t.mode),u}_createGeometry(e,t,r,i,a,s,l){const o=s===N.DRAPED?{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper}:null,n="polygon"===a,h=this._fastUpdates?.visualVariables.color,c=this._fastUpdates?.visualVariables.size,p=this._fastUpdates?.visualVariables.opacity,m=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:l,layerUid:this._context.layer.uid}),d={position:r,size:c?null:this._getDrivenSize(t.renderingInfo),color:h?null:this._getDrivenColor(t.renderingInfo),sizeFeature:c?k(c.field,t.graphic):null,colorFeature:h?k(h.field,t.graphic):null,opacityFeature:p?k(p.field,t.graphic):null};return j(e,{overlayInfo:o,removeDuplicateStartEnd:n,mapPositions:i,attributeData:d},m)}_createAsOverlay(e,t){const r=e.graphic,i=this._getGeometryAsPolygonOrPolyline(r.geometry),a="polygon"===i.type?i.rings:i.paths,s="polygon"===i.type?this._ringMaterial:this._lineMaterial;s.renderPriority=this._renderPriority;const l=R.LINE_WIREFRAMES?"polygon"===i.type?this._wireframeRingMaterial:this._wireframeLineMaterial:null,o=this._markerMaterial;null!=l&&(l.renderPriority=this._renderPriority-.001),null!=o&&(o.renderPriority=this._renderPriority-.002);const d=new Array,y=n(),_=h(),u=S(i,this._context.overlaySR),g="polygon"===i.type?"rings":"paths";this._logGeometryCreationWarnings(u,a,g,"LineSymbol3DLayer");for(const n of u.lines){if(h(y),c(y,n.position),!p(y,this._context.clippingExtent))continue;m(_,y);const a=a=>{const s=this._createGeometry(a,e,n.position,void 0,i.type,N.DRAPED,r.uid),l=new G(s,{layerUid:t,graphicUid:r.uid});d.push(l)};if(null!=o){a(o);const e=this.symbolLayer.marker.placement;"begin"!==e&&"begin-end"!==e||c(y,n.position,0,1),"end"!==e&&"begin-end"!==e||c(y,n.position,n.position.length-3,1)}a(s),R.LINE_WIREFRAMES&&a(l)}return new M(this,d,_,this._context.drapeSourceRenderer)}get _patternHidesLine(){const e=this.symbolLayer.pattern;return null!=e&&"style"===e.type&&"none"===e.style}_computeMaterialWidth(e){return e=e??a(1),this._drivenProperties.size?this._fastUpdates?.visualVariables.size?s(1):1:s(e)}_prepareMaterialPatch(e,r,i){const a=r.material;if(null==a)return void(i.changed&&i.useMaterialColor&&this._patchMaterialColor(this._getCombinedOpacityAndColor(this._materialColor),this._markerMaterialCached,e));if("collection"===a.type)return;const s="complete"===a.type?t(a.newValue,(e=>e.color)):"complete"===a.diff.color?.type?a.diff.color.newValue:null,l=this._getCombinedOpacityAndColor(s);i.useMaterialColor&&this._patchMaterialColor(o(l),this._markerMaterialCached,e),this._patternHidesLine&&(l[3]=0),this._patchMaterialColor(l,this._lineMaterialCached,e),delete r.material}_prepareMarkerPatch(e,t){const r=t.marker;if(null==r||"partial"!==r.type||null!=r.diff.style||null!=r.diff.placement||null!=r.diff.color&&"complete"!==r.diff.color.type)return{changed:!1,useMaterialColor:null==this._markerColor};const i=r.diff.color;if(null==i)return delete t.marker,{changed:!1,useMaterialColor:null==this._markerColor};const a=i.newValue;return null==a?(delete t.marker,{changed:!0,useMaterialColor:!0}):(this._patchMaterialColor(this._getCombinedOpacityAndColor(a),this._markerMaterialCached,e),delete t.marker,{changed:!0,useMaterialColor:!1})}_patchMaterialColor(e,t,r){null!=t&&r.symbolLayerStatePatches.push((()=>t.setParameters({color:e})))}}var N;H.elevationModeChangeTypes={definedChanged:_.RECREATE,staysOnTheGround:_.NONE,onTheGroundChanged:_.RECREATE},function(e){e[e.DRAPED=0]="DRAPED",e[e.ELEVATED=1]="ELEVATED"}(N||(N={}));export{H as Graphics3DLineSymbolLayer};
|