@arcgis/core 4.28.0-next.20230921 → 4.28.0-next.20230923
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/Graphic.js +1 -1
- package/PopupTemplate.js +1 -1
- package/TimeExtent.js +1 -1
- package/arcade/ArcadeDate.js +1 -1
- package/arcade/Feature.js +1 -1
- package/arcade/featureSetUtils.js +1 -1
- package/arcade/featureset/actions/Adapted.js +1 -1
- package/arcade/featureset/actions/GroupBy.js +1 -1
- package/arcade/featureset/support/FeatureSet.js +1 -1
- package/arcade/featureset/support/FeatureSetIterator.js +1 -1
- package/arcade/featureset/support/StatsField.js +1 -1
- package/arcade/featureset/support/sqlUtils.js +1 -1
- package/arcade/functions/convertdirection.js +1 -1
- package/arcade/functions/date.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/arcade/functions/featuresetstats.js +1 -1
- package/arcade/treeAnalysis.js +1 -1
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/02156fd04279f4d0fd3f.js +1 -0
- package/assets/esri/core/workers/chunks/07f6175b52366b2c28bd.js +1 -0
- package/assets/esri/core/workers/chunks/098073c3b2849f56dad8.js +1 -0
- package/assets/esri/core/workers/chunks/1186ba1947bd0c32f148.js +1 -0
- package/assets/esri/core/workers/chunks/186445b9fbedd261f684.js +1 -0
- package/assets/esri/core/workers/chunks/{580039dd491854ca325c.js → 21fc02f0d5716c4a7acd.js} +1 -1
- package/assets/esri/core/workers/chunks/{dff1c3c38dda2bd1a9d6.js → 246a954347fe9318190e.js} +1 -1
- package/assets/esri/core/workers/chunks/{c9dfb145f0c1d93e0fbd.js → 250bb6ae6f1992b5b4f9.js} +1 -1
- package/assets/esri/core/workers/chunks/{314c307e30f308a40a28.js → 25b09e9c0511c8e1cf8a.js} +1 -1
- package/assets/esri/core/workers/chunks/2a0b3b52ecd787a613bc.js +1 -0
- package/assets/esri/core/workers/chunks/2bc9b55e655968229ef4.js +1 -0
- package/assets/esri/core/workers/chunks/2f0924e7aa89e689da4a.js +1 -0
- package/assets/esri/core/workers/chunks/3f218d65ec451b2a1027.js +1 -0
- package/assets/esri/core/workers/chunks/425b5733bb88e6efe242.js +1 -0
- package/assets/esri/core/workers/chunks/45d6b942cdccca2ce44a.js +1 -0
- package/assets/esri/core/workers/chunks/4bf1a7e82a68ccee0ee1.js +1 -0
- package/assets/esri/core/workers/chunks/4c110c7f4f940ec58010.js +1 -0
- package/assets/esri/core/workers/chunks/{bde89b2684b6185992ef.js → 4ed77097e69fa3096ce4.js} +1 -1
- package/assets/esri/core/workers/chunks/4fe5bac782a742d5b1c0.js +1 -0
- package/assets/esri/core/workers/chunks/{1cbaba30f55f00f7498b.js → 51324d042f469f3b8914.js} +1 -1
- package/assets/esri/core/workers/chunks/{3f4e9b1663ec521bfe00.js → 542ce10e1872399790b4.js} +1 -1
- package/assets/esri/core/workers/chunks/54d2b7e2ac4ba883bee8.js +1 -0
- package/assets/esri/core/workers/chunks/54ecb6cae310818d1aa2.js +1 -0
- package/assets/esri/core/workers/chunks/57c932e289d89d97da4b.js +1 -0
- package/assets/esri/core/workers/chunks/{6403de6fc067cf8f7436.js → 592c1fb531f2be928e8a.js} +1 -1
- package/assets/esri/core/workers/chunks/59a807220d6f0dd18776.js +1 -0
- package/assets/esri/core/workers/chunks/59dff10d7ad2b1bf469e.js +1 -0
- package/assets/esri/core/workers/chunks/609a475ab395f2ce63e2.js +1 -0
- package/assets/esri/core/workers/chunks/612c485c5aad1548d708.js +1 -0
- package/assets/esri/core/workers/chunks/{2bb69d76a13564e8e455.js → 645ba2d5c10184632d23.js} +1 -1
- package/assets/esri/core/workers/chunks/{332689bf60d246485993.js → 65186e168dd112ac6221.js} +1 -1
- package/assets/esri/core/workers/chunks/6b9248fb2d6aadbce7bb.js +1 -0
- package/assets/esri/core/workers/chunks/709465832d306e02df52.js +1 -0
- package/assets/esri/core/workers/chunks/72c5bd6f7b8541b8d69e.js +1 -0
- package/assets/esri/core/workers/chunks/{bbc0dcd316c5598bc9ad.js → 74368a5213def6c200a2.js} +1 -1
- package/assets/esri/core/workers/chunks/{94188fe381239d48a975.js → 76483c9a8848f3106126.js} +1 -1
- package/assets/esri/core/workers/chunks/7aa58c96798447ce5907.js +1 -0
- package/assets/esri/core/workers/chunks/7d078b8b9997b5300c0a.js +1 -0
- package/assets/esri/core/workers/chunks/7fe641cf1467496e670a.js +1 -0
- package/assets/esri/core/workers/chunks/{df8f62beb36fb9d2ac81.js → 810c8d6ff19976fd1366.js} +1 -1
- package/assets/esri/core/workers/chunks/8458ed96f3e72814cef2.js +1 -0
- package/assets/esri/core/workers/chunks/{243a4eed107d363dfad8.js → 887652bbdb3b71d0a089.js} +1 -1
- package/assets/esri/core/workers/chunks/896bfda379cf620b63ec.js +1 -0
- package/assets/esri/core/workers/chunks/91c9f0d59eaed7a735ce.js +1 -0
- package/assets/esri/core/workers/chunks/{1f7e041140088f8ac489.js → 97073a60f0ea2a397165.js} +1 -1
- package/assets/esri/core/workers/chunks/97658ac749664a07c92d.js +1 -0
- package/assets/esri/core/workers/chunks/{1da74a306aa5b4eacaae.js → 9866bbaeaf885c2dcca9.js} +1 -1
- package/assets/esri/core/workers/chunks/a39ae87298ac674f129d.js +1 -0
- package/assets/esri/core/workers/chunks/a7b3048c19348540e004.js +1 -0
- package/assets/esri/core/workers/chunks/a8ca4b116909e47722f9.js +1 -0
- package/assets/esri/core/workers/chunks/{101f776316a85b708927.js → a99070ec4c06c435b744.js} +1 -1
- package/assets/esri/core/workers/chunks/ab145d13932d87dd7bf9.js +1 -0
- package/assets/esri/core/workers/chunks/{77c15b1c2729c780f75a.js → aeeeb386134b341d7ad2.js} +1 -1
- package/assets/esri/core/workers/chunks/{3ca759f72d3bb29e9ea9.js → af54b233f6d6ad70b4a3.js} +2 -2
- package/assets/esri/core/workers/chunks/b9146daae8457224fd08.js +1 -0
- package/assets/esri/core/workers/chunks/bcdd2e8841abcb4df6da.js +1 -0
- package/assets/esri/core/workers/chunks/be05cc0cdabd5e051045.js +1 -0
- package/assets/esri/core/workers/chunks/c5f5f37bef11c6fbdc40.js +1 -0
- package/assets/esri/core/workers/chunks/d414dba3179bcf75bc6b.js +1 -0
- package/assets/esri/core/workers/chunks/{b449d6bd5851187d419f.js → d6e5408f9fa6b4bcd118.js} +1 -1
- package/assets/esri/core/workers/chunks/d9fb500cbd0f04d219a3.js +1 -0
- package/assets/esri/core/workers/chunks/e0dd6789fb797e9b7206.js +1 -0
- package/assets/esri/core/workers/chunks/{6f271249e042086d5a16.js → e4e49deae8da74f629db.js} +1 -1
- package/assets/esri/core/workers/chunks/e5dcff7a4fa84ba09670.js +1 -0
- package/assets/esri/core/workers/chunks/{f508ccfde6425dabe9ac.js → ee0bf611d191103a7046.js} +1 -1
- package/assets/esri/core/workers/chunks/{ed1fbc1bc8d50453e2f5.js → f793cd41fcd022baeea2.js} +1 -1
- package/assets/esri/core/workers/chunks/fad6a7bb82a0a2df726f.js +1 -0
- package/assets/esri/themes/base/widgets/_FeatureForm.scss +2 -84
- package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +2 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/arcade.js +1 -1
- package/config.js +1 -1
- package/core/Accessor.js +1 -1
- package/core/accessorSupport/diffUtils.js +1 -1
- package/core/has.js +1 -1
- package/core/number.js +1 -1
- package/core/reactiveUtils.js +1 -1
- package/core/sql/DateOnly.js +1 -1
- package/core/sql/WhereClause.js +1 -1
- package/core/sql.js +1 -1
- package/core/timeUtils.js +1 -1
- package/identity/IdentityForm.js +1 -1
- package/identity/IdentityModal.js +1 -1
- package/interfaces.d.ts +48 -203
- package/layers/LinkChartLayer.js +1 -1
- package/layers/OrientedImageryLayer.js +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/graphics/applyEditsUtils.js +5 -0
- package/layers/graphics/editingSupport.js +1 -1
- package/layers/graphics/sources/FeatureLayerSource.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/mixins/EditBusLayer.js +1 -1
- package/layers/orientedImagery/core/CameraOrientationLTP.js +1 -1
- package/layers/orientedImagery/core/ElevationSourceDefinitions.js +5 -0
- package/layers/orientedImagery/core/ExposurePoint.js +1 -1
- package/layers/orientedImagery/core/cameraOrientationFactory.js +1 -1
- package/layers/orientedImagery/core/utils.js +5 -0
- package/layers/orientedImagery/transformations/groundToImageUtils.js +1 -1
- package/layers/support/fieldProperties.js +1 -1
- package/layers/support/fieldUtils.js +1 -1
- package/layers/support/imageryRendererUtils.js +1 -1
- package/layers/support/kmlUtils.js +1 -1
- package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
- package/layers/support/rasterFunctions/creators/createDataManagementFunctions.js +1 -1
- package/networks/Network.js +1 -1
- package/package.json +1 -1
- package/request.js +1 -1
- package/rest/featureService/FeatureService.js +1 -1
- package/rest/support/DirectionsFeatureSet.js +1 -1
- package/smartMapping/renderers/pieChart.js +1 -1
- package/smartMapping/renderers/relationship.js +1 -1
- package/smartMapping/renderers/support/utils.js +1 -1
- package/smartMapping/statistics/support/ageUtils.js +1 -1
- package/smartMapping/support/adapters/support/utils.js +1 -1
- package/smartMapping/support/utils.js +1 -1
- package/support/apiKeyUtils.js +1 -1
- package/support/arcadeUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/support/svgUtils.js +1 -1
- package/time/TimeReference.js +1 -1
- package/time/timeReferenceUtils.js +1 -1
- package/versionManagement/VersionManagementService.js +1 -1
- package/versionManagement/support/EditMomentStack.js +5 -0
- package/versionManagement/support/versionManagementUtils.js +1 -1
- package/views/2d/engine/Container.js +1 -1
- package/views/2d/engine/DisplayObject.js +1 -1
- package/views/2d/engine/ManagedCanvas.js +5 -0
- package/views/2d/engine/Stage.js +1 -1
- package/views/2d/engine/webgl/GroupContainer.js +1 -1
- package/views/2d/engine/webgl/Painter.js +1 -1
- package/views/2d/engine/webgl/WGLContainer.js +1 -1
- package/views/2d/engine/webgl/WorldExtentClipRenderer.js +1 -1
- package/views/2d/engine/webgl/effects/FeatureEffect.js +1 -1
- package/views/2d/engine/webgl/effects/HighlightEffect.js +1 -1
- package/views/2d/engine/webgl/effects/HittestEffectVTL.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/interactive/editingTools/TransformTool.js +1 -1
- package/views/2d/layers/GeoRSSLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/WMTSLayerView2D.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
- package/views/2d/layers/features/tileRenderers/support/WGLFeatureView.js +1 -1
- package/views/2d/layers/graphics/BaseGraphicContainer.js +1 -1
- package/views/2d/layers/graphics/GraphicContainer.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/2d/layers/graphics/HighlightGraphicContainer.js +1 -1
- package/views/2d/layers/imagery/VectorFieldView2D.js +1 -1
- package/views/2d/layers/support/DisplayGL.js +1 -1
- package/views/2d/webglDeps.js +1 -1
- package/views/3d/glTF/loader.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/MoveManipulation.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/isSupportedGraphic.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/3d/layers/graphics/ElevationAligners.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/graphics/graphicUtils.js +1 -1
- package/views/3d/layers/i3s/featureEditing.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/support/buffer/glUtil.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/support/viewpointUtils.js +1 -1
- package/views/3d/webgl-engine/Stage.js +1 -1
- package/views/3d/webgl-engine/effects/RenderPluginInput.js +1 -1
- package/views/3d/webgl-engine/effects/blit/Blit.js +5 -0
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/lib/Geometry.js +1 -1
- package/views/3d/webgl-engine/lib/ModelDirtySet.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/RenderSlot.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureFactory.js +1 -1
- package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/bufferLayouts.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/edgeProcessing.js +1 -1
- package/views/View.js +1 -1
- package/views/interactive/tooltip/TooltipContentWithHelpMessage.js +1 -1
- package/views/interactive/tooltip/TooltipEditableField.js +1 -1
- package/views/interactive/tooltip/constraintUtils.js +1 -1
- package/views/interactive/tooltip/content/Fields.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawCircle.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawMesh.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPoint.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPolyline.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawRectangle.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentExtentRotate.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentExtentScale.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentReshapeEdgeOffset.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformAbsolute.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformRotate.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTransformScale.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateGraphic.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateGraphicXY.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateGraphicZ.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateVertex.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateVertexXY.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateVertexZ.js +1 -1
- package/views/support/angularMeasurementUtils.js +1 -1
- package/views/ui/UI.js +1 -1
- package/views/webgl/ShaderTranspiler.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/contextUtils.js +1 -1
- package/webmap/InitialViewProperties.js +1 -1
- package/widgets/AreaMeasurement2D.js +1 -1
- package/widgets/AreaMeasurement3D.js +1 -1
- package/widgets/Attachments/AttachmentsViewModel.js +1 -1
- package/widgets/Attachments.js +1 -1
- package/widgets/Attribution.js +1 -1
- package/widgets/BasemapGallery.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/BasemapToggle.js +1 -1
- package/widgets/Bookmarks.js +1 -1
- package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesNode.js +1 -1
- package/widgets/BuildingExplorer/BuildingDisciplinesTree/BuildingDisciplinesTree.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/BuildingLevelPicker.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/Label.js +1 -1
- package/widgets/BuildingExplorer/BuildingLevelPicker/LevelItem.js +1 -1
- package/widgets/BuildingExplorer/BuildingPhasePicker/BuildingPhasePicker.js +1 -1
- package/widgets/BuildingExplorer.js +1 -1
- package/widgets/Compass.js +1 -1
- package/widgets/CoordinateConversion.js +1 -1
- package/widgets/Daylight/support/SliderWithDropdown.js +1 -1
- package/widgets/Daylight.js +1 -1
- package/widgets/DirectLineMeasurement3D.js +1 -1
- package/widgets/DirectionalPad.js +1 -1
- package/widgets/Directions/components/SaveLayer.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/DistanceMeasurement2D.js +1 -1
- package/widgets/Editor/components/FooterActions.js +1 -1
- package/widgets/Editor/components/Notices.js +1 -1
- package/widgets/Editor/components/PanelContent.js +1 -1
- package/widgets/Editor/components/PanelToolbar.js +1 -1
- package/widgets/Editor/components/Prompt.js +1 -1
- package/widgets/Editor/components/Settings.js +1 -1
- package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
- package/widgets/Editor/components/UploadDetails.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/ElevationProfile/components/LegendItem.js +1 -1
- package/widgets/ElevationProfile/components/SettingsButton.js +1 -1
- package/widgets/ElevationProfile/components/Statistics.js +1 -1
- package/widgets/ElevationProfile.js +1 -1
- package/widgets/Expand.js +1 -1
- package/widgets/Feature/FeatureContent.js +1 -1
- package/widgets/Feature/FeatureExpression.js +1 -1
- package/widgets/Feature/FeatureFields.js +1 -1
- package/widgets/Feature/FeatureMedia.js +1 -1
- package/widgets/Feature/FeatureRelationship.js +1 -1
- package/widgets/Feature/FeatureViewModel.js +1 -1
- package/widgets/Feature/support/FeatureContentMixin.js +1 -1
- package/widgets/Feature/support/FeatureElementInfo.js +1 -1
- package/widgets/Feature.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureForm/GroupInput.js +1 -1
- package/widgets/FeatureForm/css.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/FeatureTable/Grid/support/ButtonMenu.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/FeatureTemplates/ItemList.js +1 -1
- package/widgets/FeatureTemplates.js +1 -1
- package/widgets/Features/FeaturesRelatedRecords.js +1 -1
- package/widgets/Features.js +1 -1
- package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
- package/widgets/FloorFilter.js +1 -1
- package/widgets/Fullscreen.js +1 -1
- package/widgets/Histogram.js +1 -1
- package/widgets/HistogramRangeSlider.js +1 -1
- package/widgets/Home.js +1 -1
- package/widgets/LayerList/ListItemPanel.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/Legend/LegendViewModel.js +1 -1
- package/widgets/Legend/styles/Card.js +1 -1
- package/widgets/Legend/styles/Classic.js +1 -1
- package/widgets/Legend/styles/support/relationshipUtils.js +1 -1
- package/widgets/Legend/styles/support/univariateUtils.js +1 -1
- package/widgets/LineOfSight.js +1 -1
- package/widgets/Locate.js +1 -1
- package/widgets/NavigationToggle.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/Popup.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/ScaleRangeSlider/scalePreviewUtils.js +1 -1
- package/widgets/ScaleRangeSlider.js +1 -1
- package/widgets/Search/SearchResultRenderer.js +1 -1
- package/widgets/Search.js +1 -1
- package/widgets/ShadowCast/components/DiscreteConfigurator.js +1 -1
- package/widgets/ShadowCast/components/DurationConfigurator.js +1 -1
- package/widgets/ShadowCast/components/ShadowTooltipContent.js +1 -1
- package/widgets/ShadowCast/components/ThresholdConfigurator.js +1 -1
- package/widgets/ShadowCast.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/Slice.js +1 -1
- package/widgets/Slider.js +1 -1
- package/widgets/Swipe.js +1 -1
- package/widgets/TableList.js +1 -1
- package/widgets/TimeSlider.js +1 -1
- package/widgets/Track.js +1 -1
- package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsLineSymbolPicker.js +1 -1
- package/widgets/UtilityNetworkAssociations.js +1 -1
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/widgets/UtilityNetworkValidateTopology.js +1 -1
- package/widgets/ValuePicker.js +1 -1
- package/widgets/VideoPlayer/components/PlayerControlsGroup.js +1 -1
- package/widgets/VideoPlayer/components/SettingsButton.js +1 -1
- package/widgets/VideoPlayer.js +1 -1
- package/widgets/Weather/LabeledSlider.js +1 -1
- package/widgets/Weather.js +1 -1
- package/widgets/Zoom/IconButton.js +1 -1
- package/widgets/smartMapping/BinaryColorSizeSlider.js +1 -1
- package/widgets/smartMapping/ClassedColorSlider.js +1 -1
- package/widgets/smartMapping/ClassedSizeSlider.js +1 -1
- package/widgets/smartMapping/ColorSizeSlider.js +1 -1
- package/widgets/smartMapping/ColorSlider.js +1 -1
- package/widgets/smartMapping/HeatmapSlider.js +1 -1
- package/widgets/smartMapping/OpacitySlider.js +1 -1
- package/widgets/smartMapping/SizeSlider.js +1 -1
- package/widgets/smartMapping/SmartMappingSliderBase.js +1 -1
- package/widgets/support/ColorPicker.js +1 -1
- package/widgets/support/DatePicker.js +1 -1
- package/widgets/support/Heading.js +1 -1
- package/widgets/support/LabeledSwitch.js +1 -1
- package/widgets/support/MeasurementWidgetContent.js +1 -1
- package/widgets/support/Popover.js +1 -1
- package/widgets/support/SelectionToolbar.js +1 -1
- package/widgets/support/SketchTooltipControls.js +1 -1
- package/widgets/support/SnappingControls.js +1 -1
- package/widgets/support/TimePicker.js +1 -1
- package/widgets/support/TimezonePicker.js +1 -1
- package/widgets/support/UnitSelect.js +1 -1
- package/widgets/support/dateUtils.js +1 -1
- package/assets/esri/core/workers/chunks/072b4e041b8630c513a0.js +0 -1
- package/assets/esri/core/workers/chunks/092920c25cac89c038ee.js +0 -1
- package/assets/esri/core/workers/chunks/114269dda1d296893908.js +0 -1
- package/assets/esri/core/workers/chunks/126df6237fc80608344e.js +0 -1
- package/assets/esri/core/workers/chunks/1b3655f5bf5d90fa8730.js +0 -1
- package/assets/esri/core/workers/chunks/1c83f47d446f2bca1721.js +0 -1
- package/assets/esri/core/workers/chunks/1cf7bb514e7eefc3e9c6.js +0 -1
- package/assets/esri/core/workers/chunks/21a9c8aa2a9e9990df41.js +0 -1
- package/assets/esri/core/workers/chunks/24629402c647ef6b5f6b.js +0 -1
- package/assets/esri/core/workers/chunks/2a1c1be9c202462cf54d.js +0 -1
- package/assets/esri/core/workers/chunks/2cb36f9686693234991a.js +0 -1
- package/assets/esri/core/workers/chunks/2d0d03cbea83c868edba.js +0 -1
- package/assets/esri/core/workers/chunks/2e130cb2f1038055c07b.js +0 -1
- package/assets/esri/core/workers/chunks/3619e04cbb6691549014.js +0 -1
- package/assets/esri/core/workers/chunks/3dbfb4f370a874393822.js +0 -1
- package/assets/esri/core/workers/chunks/406db5c90271a3a203d4.js +0 -1
- package/assets/esri/core/workers/chunks/4369a6c1e0a82ab4db6a.js +0 -1
- package/assets/esri/core/workers/chunks/4f4a424d1747d04501df.js +0 -1
- package/assets/esri/core/workers/chunks/59c00d6fba0fd1c03d01.js +0 -1
- package/assets/esri/core/workers/chunks/5a5720caa64a46daadf9.js +0 -1
- package/assets/esri/core/workers/chunks/5edb99b58549cd66b394.js +0 -1
- package/assets/esri/core/workers/chunks/6203ddf6caad3d356327.js +0 -1
- package/assets/esri/core/workers/chunks/650a317b6dc245a7060f.js +0 -1
- package/assets/esri/core/workers/chunks/7a358b1fd0c0cce59e9b.js +0 -1
- package/assets/esri/core/workers/chunks/83d1a1b3d371c991cc4c.js +0 -1
- package/assets/esri/core/workers/chunks/846b7a81b870c8b238a1.js +0 -1
- package/assets/esri/core/workers/chunks/8ab832468300cc4feb5a.js +0 -1
- package/assets/esri/core/workers/chunks/bc1dc6383e60e7e61d50.js +0 -1
- package/assets/esri/core/workers/chunks/bc6323bdc98013da6fe5.js +0 -1
- package/assets/esri/core/workers/chunks/c4bb67150ccd01ea6014.js +0 -1
- package/assets/esri/core/workers/chunks/c60cf62f374e71e562fc.js +0 -1
- package/assets/esri/core/workers/chunks/c6ea5aac232d1eca04dd.js +0 -1
- package/assets/esri/core/workers/chunks/c8438c2d9ac48afe4033.js +0 -1
- package/assets/esri/core/workers/chunks/c8f239c25fe864f0e47a.js +0 -1
- package/assets/esri/core/workers/chunks/cad260881653567bc8f9.js +0 -1
- package/assets/esri/core/workers/chunks/d824f4b405a72cd2fa74.js +0 -1
- package/assets/esri/core/workers/chunks/dd7508d4016715371e0c.js +0 -1
- package/assets/esri/core/workers/chunks/e55f7fc7eff0074ce0fc.js +0 -1
- package/assets/esri/core/workers/chunks/eef27d305023034084a4.js +0 -1
- package/assets/esri/core/workers/chunks/f38c54ada9e7012a2960.js +0 -1
- package/assets/esri/core/workers/chunks/f5e0ff5292b9fd18fc92.js +0 -1
- package/assets/esri/core/workers/chunks/f5eb8b5021620be7538e.js +0 -1
- package/core/watchUtils.d.ts +0 -4
- package/core/watchUtils.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/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 t from"../../../../renderers/UniqueValueRenderer.js";import"../../../../renderers/support/jsonUtils.js";import i from"../../../../core/Logger.js";import"../../../../symbols.js";import r from"../../../../core/Accessor.js";import{isSome as s}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import a from"../../../../core/Error.js";import{makeHandle as n}from"../../../../core/handleUtils.js";import{someMap as o,findInMap as l}from"../../../../core/MapUtils.js";import{destroyMaybe as h,removeMaybe as d,disposeMaybe as p}from"../../../../core/maybe.js";import c from"../../../../core/PooledArray.js";import{throwIfAborted as y,createResolver as g,isAbortError as m}from"../../../../core/promiseUtils.js";import{watch as u,when as b,on as _,syncAndInitial as f,whenOnce as v}from"../../../../core/reactiveUtils.js";import{schedule as C}from"../../../../core/scheduling.js";import{property as S}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as w}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as G,isEmpty as R}from"../../../../core/accessorSupport/diffUtils.js";import{s as P,g as x,i as D}from"../../../../chunks/vec3.js";import{c as E}from"../../../../chunks/vec3f64.js";import{canProjectWithoutEngine as I}from"../../../../geometry/projection.js";import{projectBuffer as U}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as j}from"../../../../geometry/projection/projectVectorToVector.js";import{projectXYZToVector as A}from"../../../../geometry/projection/projectXYZToVector.js";import{create as L,center as V,fromRect as O,equals as F}from"../../../../geometry/support/aaBoundingBox.js";import{create as T}from"../../../../geometry/support/aaBoundingRect.js";import{equals as k}from"../../../../geometry/support/spatialReferenceUtils.js";import z from"../../../../layers/Layer.js";import{getObjectId as M,computeAABB as W,hasGeometry as H}from"../../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as N}from"../../../../layers/graphics/hydratedFeatures.js";import{isSupportedRenderer3D as B,validateTo3D as q}from"../../../../renderers/support/rendererConversion.js";import{loadArcade as Y}from"../../../../support/arcadeOnDemand.js";import{isBasemapLayer as $}from"../../../../support/basemapUtils.js";import{getDefaultSymbol3D as Z}from"../../../../symbols/support/defaults3D.js";import{to3D as J}from"../../../../symbols/support/symbolConversion.js";import{averageSymbolComplexities as Q,defaultSymbolComplexity as X}from"./defaultSymbolComplexity.js";import{DisplayFeatureLimit as K}from"./DisplayFeatureLimit.js";import{ViewElevationProvider as ee}from"./ElevationQuery.js";import{VisibilityGroup as te,VisibilityFlag as ie}from"./enums.js";import{extractExpressionInfo as re,createContext as se}from"./featureExpressionInfoUtils.js";import{Graphics3DFeatureStore as ae}from"./Graphics3DFeatureStore.js";import{Graphics3DGraphicCreationContext as ne}from"./Graphics3DGraphicCreationContext.js";import{Graphics3DSymbolCreationContext as oe}from"./Graphics3DSymbolCreationContext.js";import{make as le}from"./Graphics3DSymbolFactory.js";import{Graphics3DWebStyleSymbol as he}from"./Graphics3DWebStyleSymbol.js";import{GraphicStateTracking as de}from"./GraphicStateTracking.js";import{computeCentroid as pe}from"./graphicUtils.js";import{ApplyRendererDiffResult as ce}from"./interfaces.js";import{LoadStatus as ye}from"./Loadable.js";import{SpatialIndex2D as ge}from"./SpatialIndex2D.js";import{StageLayerElevationProvider as me}from"../support/StageLayerElevationProvider.js";import{toBoundingRect as ue}from"../../support/extentUtils.js";import{PropertiesPool as be}from"../../support/PropertiesPool.js";import{GridLocalOriginFactory as _e}from"../../webgl-engine/lib/GridLocalOriginFactory.js";import{UpdatePolicy as fe}from"../../webgl-engine/lib/UpdatePolicy.js";import{WebGLLayer as ve}from"../../webgl-engine/lib/WebGLLayer.js";import{hasPopupTemplate as Ce}from"../../../layers/support/popupUtils.js";import{ImmediateTask as Se,noBudget as we,TaskPriority as Ge,Task as Re}from"../../../support/Scheduler.js";import Pe from"../../../../geometry/Extent.js";import xe 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 je=E(),Ae=L(),Le="esri.views.3d.layers.graphics.Graphics3DCore",Ve=i.getLogger(Le);let Oe=Ue=class extends r{get _viewSpatialReference(){return this.owner.view.spatialReference}get spatialIndex(){return this._spatialIndex||(this._spatialIndex=new ge({objectIdField:this.owner.layer?.objectIdField,spatialReference:this._viewSpatialReference,hasZ:!!this.hasZ,hasM:!!this.hasM}),this._spatialIndex.setup(Array.from(this.graphics3DGraphics.values()))),this._spatialIndex.update(),this._spatialIndex}get numberOfGraphics(){return this._numberOfGraphics}get effectiveUpdatePolicy(){return null!=this.currentRenderer&&"dictionary"===this.currentRenderer.type?fe.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,t=e?.graphics3D.minTotalNumberOfFeatures??0,i=e?.graphics3D.maxTotalNumberOfFeatures??0,r=e?.graphics3D.maxNumberOfDrawCalls??0,s=e?.graphics3D.maxTotalNumberOfVertices??0,a=this.averageSymbolComplexity,n=Math.max(1,a?.verticesPerFeature??1),o=a&&a.drawCallsPerFeature>0&&r>0?r/a.drawCallsPerFeature:i,l=Math.ceil(s/n),h=Math.max(t,Math.min(i,l,o)),d=this._get("displayFeatureLimit");return d&&d.maximumTotalNumberOfVertices===s&&d.averageSymbolComplexity===a&&d.maximumNumberOfFeatures===h?d:new K(s,h,a)}get averageSymbolComplexity(){const e=Q(this._symbolComplexities),t=this._get("averageSymbolComplexity");return 0===e.numComplexities||null!=t&&(e.estimated&&(t.verticesPerFeature>=e.verticesPerFeature||t.verticesPerCoordinate>=e.verticesPerCoordinate||t.drawCallsPerFeature>=e.drawCallsPerFeature)||t.verticesPerFeature===e.verticesPerFeature&&t.verticesPerCoordinate===e.verticesPerCoordinate&&t.drawCallsPerFeature===e.drawCallsPerFeature)?t:e}get usedMemory(){const e=null!=this.averageSymbolComplexity&&this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel*this._numberOfGraphics:0,t=this._getSymbolComplexitiesUsed().reduce(((e,t)=>e+t.memory.resourceBytes),0),i=this.owner.view._stage.renderer,r=this.owner.view.basemapTerrain.overlayManager.renderer,s=Array.from(this._symbols.values()).reduce(((e,t)=>e+(t?.symbolLayers.reduce(((e,t)=>e+(t?.materials.reduce(((e,t)=>e+i.getMemoryForMaterial(t)+r.getMemoryForMaterial(t)),0)??0)),0)??0)),0);return this._usedMemory+e+t+s}get usedMemoryPerGraphic(){if(this._usedMemory&&this._numberOfGraphics){const e=this._numberOfGraphics/(this._numberOfGraphics+Math.max(this._pendingAdds,this._pendingRemoves));return this._usedMemory/this._numberOfGraphics*e}if(null!=this.averageSymbolComplexity){const e=this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel:0;return this.averageSymbolComplexity.memory.bytesPerFeature+e}return 0}get unprocessedMemoryEstimate(){return(this._pendingAdds-this._pendingRemoves)*this.usedMemoryPerGraphic}get _symbolComplexities(){return this.currentRenderer?this._getSymbolComplexitiesUsedOrRenderer(this.currentRenderer):this._getSymbolComplexitiesUsed()}get visible(){return this._visible}_getConvertedSymbol(e){if("web-style"===e.type)return e.clone();const t=this._symbolConversionCache.get(e.id);if(null!=t)return t;const i=J(e,{geometryType:this.layer?.geometryType??void 0,retainId:!0,hasLabelingContext:this._hasLabelingContext(e)}),r=i.symbol||null;return null==r&&i.error&&Ve.error(i.error.message),this._symbolConversionCache.set(e.id,r),r}_getSymbolComplexitiesUsedOrRenderer(e){if(null==e)return[];const t=e.getSymbols(),i="backgroundFillSymbol"in e?e.backgroundFillSymbol:null;if(!(i||t&&t.length))return[];const r=[],s=this._getSymbolComplexityUsedOrRenderer(i);null!=s&&r.push(s);for(const a of t){const e=this._getSymbolComplexityUsedOrRenderer(a);null!=e&&r.push(e)}return r}_getSymbolComplexityUsedOrRenderer(e){if(null==e)return null;const t=this._symbols.get(e.id);if(null!=t)return t.complexity;const i=this._getConvertedSymbol(e);return null!=i?X(i):null}_getSymbolComplexitiesUsed(){const e=[];return this._symbols.forEach((t=>{null!=t&&e.push(t.complexity)})),e}get _objectIdField(){return this.layer.objectIdField}constructor(e){super(e),this._propertiesPool=new be({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._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 c({allocator:e=>e||new Te,deallocator:e=>(e.clear(),e)}),this._symbolWarningLogged=!1,this._geometryWarningLogged=!1,this._objectIdInvisibleSet=new Set,this._whenSymbolRemoved=new c,this.preferredUpdatePolicy=fe.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 oe(e.owner.view.resourceController.scheduler,((e,t)=>this._frameTask.schedule(e,t)))}initialize(){this._featureStore=new ae({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,t,i)=>this.spatialIndex.queryGraphicUIDsInExtent(e,t,i),{componentFactories:t}=this;if(null!=t.elevationAlignment){const i=t.elevationAlignment(this,e);this._elevationAlignment=i}if(null!=t.scaleVisibility){const i=t.scaleVisibility(this,e);this._scaleVisibility=i}if(null!=t.filterVisibility){const e=t.filterVisibility({featureStore:this._featureStore,getFeatureCount:()=>this.graphics3DGraphics.size,updateFeatureVisibilities:e=>this.modifyGraphics3DGraphicVisibilities((t=>t.setVisibilityFlag(te.GRAPHIC,ie.FILTER,e(M(t.graphic,this._objectIdField))))),setAllFeaturesVisibility:e=>this.modifyGraphics3DGraphicVisibilities((t=>t.setVisibilityFlag(te.GRAPHIC,ie.FILTER,e))),clearFeaturesVisibility:()=>this.modifyGraphics3DGraphicVisibilities((e=>e.setVisibilityFlag(te.GRAPHIC,ie.FILTER,!0)))});this._filterVisibility=e}if(null!=t.deconflictor){const e=t.deconflictor(this);this._deconflictor=e}if(null!=t.labeler&&null!=this._scaleVisibility){const e=t.labeler(this,this._scaleVisibility);this._labeler=e}if(null!=t.objectStates){const e=t.objectStates(this);this._objectStates=e}this._initializeAbortController=new AbortController,this._initializePromise=this._initializeAsync()}async _initializeAsync(){const e=this._initializeAbortController?.signal,t=this.owner.view;this._viewElevationProvider=new ee(this._viewSpatialReference,t),this._initializeStage(t,this.layer.uid);const i=t.sharedSymbolResources;this.symbolCreationContext.sharedResources=i,this._sharedSymbolResourcesOwnerHandle=i.addGraphicsOwner(this.owner),null!=this.currentRenderer&&(this.symbolCreationContext.renderer=this.currentRenderer),this.symbolCreationContext.stage=this.stage,this.symbolCreationContext.streamDataRequester=i.streamDataRequester,this.symbolCreationContext.renderCoordsHelper=t.renderCoordsHelper,this.symbolCreationContext.layer=this.layer,this.symbolCreationContext.graphicsCoreOwner=this.owner,this.symbolCreationContext.localOriginFactory=new _e(t.renderSpatialReference),this.symbolCreationContext.elevationProvider=t.elevationProvider,this.symbolCreationContext.notifyGraphicGeometryChanged=e=>this.notifyGraphicGeometryChanged(e),this.symbolCreationContext.notifyGraphicVisibilityChanged=e=>this.notifyGraphicVisibilityChanged(e);const r=re(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);if(this.symbolCreationContext.featureExpressionInfoContext=await se(r,this._viewSpatialReference,e,Ve),y(e),this.symbolCreationContext.screenSizePerspectiveEnabled=t.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=t.basemapTerrain.overlayManager.registerGeometryDrapeSource(e),this.addHandles(n((()=>t.basemapTerrain.overlayManager.unregisterDrapeSource(e))))}this.addHandles([u((()=>this.suspendedOrOutsideOfView),(()=>this._frameTask.reschedule((()=>this._updateLayerVisibility())))),u((()=>[this.layer?.screenSizePerspectiveEnabled,this.owner.view?.screenSizePerspectiveEnabled]),(()=>{const e=t.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled;e!==this.symbolCreationContext.screenSizePerspectiveEnabled&&(this.symbolCreationContext.screenSizePerspectiveEnabled=e,this._labeler?.reset(),this.recreateAllGraphicsAndSymbols())})),u((()=>this.owner.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(!!e))),u((()=>this.owner.view.state?.rasterPixelRatio),(()=>this._pixelRatioChange())),u((()=>!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled),(e=>this._physicalBasedRenderingChange(e))),u((()=>!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods),(e=>this._skipHighSymbolLoDsChange(e))),b((()=>t.basemapTerrain?.tilingScheme),(e=>{if(e.spatialReference.equals(this.symbolCreationContext.overlaySR)||null==t.basemapTerrain.spatialReference||(this.symbolCreationContext.overlaySR=t.basemapTerrain.spatialReference),this.hasHandles("loaded-graphics"))this.recreateAllGraphics();else{const e=()=>this.owner?.loadedGraphics;this.addHandles([_(e,"change",(e=>{this._graphicsCollectionChanged(e),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}),{onListenerAdd:()=>{this.recreateAllGraphics(),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}})],"loaded-graphics")}}),{initial:!0}),u((()=>this.effectiveUpdatePolicy),(e=>{null!=this.stageLayer&&(this.stageLayer.updatePolicy=e),this.symbolCreationContext.isAsync=this.effectiveUpdatePolicy===fe.ASYNC,e===fe.SYNC&&this.runTask(we)}),f)]),this._frameTask=t.resourceController.scheduler.registerTask(Ge.GRAPHICS_CORE,this),this.layer&&"featureReduction"in this.layer&&this.addHandles(u((()=>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._set("owner",null);for(const e in this._whenGraphics3DGraphicRequests)this._whenGraphics3DGraphicRequests[e].reject(new a("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,t){this.stage=e._stage,this.stageLayer=new ve(this.stage,{pickable:!this.suspendedOrOutsideOfView,updatePolicy:this.effectiveUpdatePolicy},t);const i=this.stageLayer.events;i.on("objectTransformation",(e=>this.notifyGraphicGeometryChanged(e.graphicUid))),i.on("objectShaderTransformation",(e=>this.notifyGraphicGeometryChanged(e.graphicUid))),i.on("visibilityChanged",(e=>this.notifyGraphicVisibilityChanged(e.graphicUid))),i.on("objectGeometryAdded",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid))),i.on("objectGeometryRemoved",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid))),i.on("objectGeometryUpdated",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid)))}notifyGraphicGeometryChanged(e){if(null==this._graphicStateTracking||null==e)return;const t=this.graphics3DGraphics.get(e);t&&this._graphicStateTracking.updateGraphicGeometry(t)}notifyGraphicVisibilityChanged(e){if(null==this._graphicStateTracking||null==e)return;const t=this.graphics3DGraphics.get(e);t&&this._graphicStateTracking.updateGraphicVisibility(t)}_updateLayerVisibility(){const e=this.displayFeatureLimit.maximumNumberOfFeatures,t=this._numberOfGraphics>e*ke,i=!this.suspendedOrOutsideOfView&&!t;i!==this._visible&&(this._visible=i,i?(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,t=this.owner.layer&&this.owner.layer.objectIdField){return M(e,t)}get graphics3DGraphicsByObjectID(){const e=this.owner.layer&&this.owner.layer.objectIdField;if(!e)return;const t=new Map;return this.graphics3DGraphics.forEach((i=>{if(!i)return;const r=i.graphic,s=this._getGraphicObjectID(r,e);null!=s&&t.set(s,i)})),t}get labelsEnabled(){return!(!this._labeler||!this._labeler.layerLabelsEnabled())}async updateLabelingInfo(e){const t=this._deconflictor&&this._deconflictor.labelingInfoChange(e),i=this._labeler&&this._labeler.labelingInfoChange(e);await Promise.allSettled([t,i])}updateVisibilityInfo(){this._deconflictor&&this._deconflictor.labelingInfoChange(),this._labeler&&this._labeler.visibilityInfoChange()}get symbolUpdateType(){if(this._pendingUpdates.size>0)return"unknown";let e=0,t=0;return o(this._symbols,((i,r)=>{if(null!=i){const s=i.getFastUpdateStatus();if(s.loading>0)return!0;this._graphicsBySymbol.has(r)&&(t+=s.fast,e+=s.slow)}return!1}))?"unknown":t>=0&&0===e?"fast":e>=0&&0===t?"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 Re.YIELD}setObjectIdVisibility(e,t){t?this._objectIdInvisibleSet.delete(e):this._objectIdInvisibleSet.add(e);const i=this._findGraphics3DGraphicByObjectId(e);null!=i&&this._updateUserVisibility(i)}_findGraphics3DGraphicByObjectId(e){return l(this.graphics3DGraphics,(t=>this._getGraphicObjectID(t.graphic)===e))}_updateUserVisibility(e){if(null==e)return!1;const t=e.graphic,i=this._getGraphicObjectID(t),r=t.visible&&!this.owner.suspended&&(null==i||!this._objectIdInvisibleSet.has(i));return e.setVisibilityFlag(te.GRAPHIC,ie.USER,r)}_whenGraphics3DGraphic(e){const t=this.graphics3DGraphics.get(e.uid);if(t)return Promise.resolve(t);const i=this._whenGraphics3DGraphicRequests[e.uid];if(i)return i.promise;const r=g();return this._whenGraphics3DGraphicRequests[e.uid]=r,r.promise}async _boundsForGraphics3DGraphic(e,t){const i=this._viewSpatialReference,r=this.owner.view.renderSpatialReference,s=this.owner.view.basemapTerrain.spatialReference,a=(e,t,s)=>U(e,r,t,e,i,t,s),n=(e,t,r)=>U(e,s,t,e,i,t,r),o=this._viewElevationProvider?{service:this._viewElevationProvider,useViewElevation:null!=t&&!!t.useViewElevation,minDemResolution:null!=t?t.minDemResolution:null,minDemResolutionForPoints:this.owner.view.resolution}:null,l=await e.getProjectedBoundingBox(a,n,o,t?.signal);if(!l)return null;const h=l.boundingBox;if(l.requiresDrapedElevation){const e=this.symbolCreationContext.elevationProvider;if(e){V(h,je);const t=e.getElevation(je[0],je[1],0,i,"ground")??0;h[2]=Math.min(h[2],t),h[5]=Math.max(h[5],t)}}return{boundingBox:h,screenSpaceObjects:l.screenSpaceObjects}}async whenGraphicBounds(e,t){await v((()=>this.owner?.loadedGraphics));const i=this.owner.layer&&this.owner.layer.objectIdField,r=this.owner.loadedGraphics.find((t=>t===e||null!=i&&null!=t.attributes&&e.attributes&&t.attributes[i]===e.attributes[i]));if(!r)throw new a("internal:graphic-not-part-of-view","Graphic is not part of this view");const s=await this._whenGraphics3DGraphic(r);return this._boundsForGraphics3DGraphic(s,t)}computeAttachmentOrigin(e,t){const i=this.graphics3DGraphics.get(e.uid);if(!i)return null;const r=i.computeAttachmentOrigin();if(0===r.render.num&&0===r.draped.num)return null;P(ze,0,0,0);let s=0;if(r.render.num>0){if(!j(r.render.origin,this.symbolCreationContext.renderCoordsHelper.spatialReference,Me,t))return null;x(ze,ze,Me),s++}if(r.draped.num>0){const[e,i]=r.draped.origin,a=this._viewElevationProvider.getElevation(e,i,"ground")??0;if(P(Me,e,i,a),!j(Me,this._viewElevationProvider.spatialReference,Me,t))return null;x(ze,ze,Me),s++}return s>1&&D(ze,ze,1/s),new xe({x:ze[0],y:ze[1],z:ze[2],spatialReference:t})}getSymbolLayerSize(e,t){const i=this._symbols.get(e.id);if(null==i)throw new a("internal:symbol-not-part-of-view","Symbol is not part of this view");const r=e.symbolLayers.indexOf(t);if(-1===r)throw new a("internal:missing-symbol-layer","Symbol layer is not in symbol");const s=i.getSymbolLayerSize(r);if(null==s)throw new a("internal:missing-size","Symbol layer has no valid size");return s}_graphicsCollectionChanged(e){this._startCreateGraphics&&(this.add(e.added),this.remove(e.removed))}graphicUpdateHandler(e){const t=e.graphic.uid,i=this.graphics3DGraphics.get(t);if(null!=i||null!=this._graphicsWithoutSymbol.get(t))switch(e.property){case"visible":this._graphicUpdateVisibleHandler(i);break;case"geometry":this._graphicUpdateGeometryHandler(i,e);break;case"symbol":this._graphicUpdateSymbolHandler(i,e);break;case"attributes":break;case"origin-transform":this._graphicUpdateTransformHandler(i,e)}}_graphicUpdateGeometryHandler(e,t){this._graphicUpdateGeometryOrTransformHandler(e,t,(()=>null!=t.newValue&&null!=e&&e.graphics3DSymbol.updateGeometry(e,t.newValue)));const i=t.graphic.geometry;null!=i&&this._expandComputedExtent(i)}_graphicUpdateTransformHandler(e,t){const i=t.graphic.geometry;this._graphicUpdateGeometryOrTransformHandler(e,t,(()=>null!=t.newValue&&null!=e&&null!=i&&e.graphics3DSymbol.updateTransform(e,i.spatialReference,t.newValue,t.action)))}_graphicUpdateGeometryOrTransformHandler(e,t,i){if(null!=t.graphic.geometry)if(null!=e)i()||this._recreateGraphic(e.graphic);else{const e=t.graphic.symbol&&t.graphic.symbol.id;if(e){const t=this._symbols.get(e);if(null!=t&&t.loadStatus===ye.LOADING)return}this._recreateGraphic(t.graphic)}else this._recreateGraphic(t.graphic)}_graphicUpdateSymbolHandler(e,t){const i=t.graphic,r=null!=e?e.graphics3DSymbol:null!=t.oldValue?this._symbols.get(t.oldValue.id):null;if(null==r||null==t.newValue)return void this._recreateGraphic(i);const s=r.symbol,a=this._getConvertedSymbol(t.newValue);if(null!=a&&(a.type!==s.type||"web-style"===a.type)||"web-style"===s.type)return void this._recreateGraphic(i);const n=this._graphicsBySymbol.get(s.id);if(n&&1!==n.size)return void this._recreateGraphic(i);const o=G(s,a);if(null==o)return void this._updateSymbolMapping(s.id,a);const l={diff:o,graphics3DGraphicPatches:[],symbolStatePatches:[]};if(r.prepareSymbolPatch(l),!R(l.diff))return void this._recreateGraphic(i);const h=this._getRenderingInfo(i);if(null==h)return void this._recreateGraphic(i);const d=r.extentPadding;for(const p of l.symbolStatePatches)p();if(d!==r.extentPadding&&this._recomputeExtentPadding(),null!=e)for(const p of l.graphics3DGraphicPatches)p(e,h);this._updateSymbolMapping(s.id,a)}_graphicUpdateVisibleHandler(e){this._updateUserVisibility(e)&&(this._labeler&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty())}recreateGraphics(e){this._suspendSymbolCleanup=!0,this.remove(e),this.add(e),this._suspendSymbolCleanup=!1,this.effectiveUpdatePolicy===fe.SYNC&&this._cleanupSymbols()}_recreateGraphic(e){this.recreateGraphics([e])}_beginGraphicUpdate(e){const t=this._graphicsUpdateId;return this._graphicsUpdateId++,this._graphicsWaitingForSymbol.set(e.uid,t),1===this._graphicsWaitingForSymbol.size&&this.notifyChange("updating"),t}_endGraphicUpdate(e){e&&(this._graphicsWaitingForSymbol.delete(e.uid),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("updating")))}_recomputeExtentPadding(){let e=0;this._symbols.forEach((t=>{null!=t&&(e=Math.max(e,t.extentPadding))})),this._set("extentPadding",e)}_expandComputedExtent(e){const t=Ae,i=e.spatialReference;W(e,t);const r=this._viewSpatialReference,s=Ue.tmpVec;if(k(i,r)||A(t[0],t[1],0,i,s,r)&&(t[0]=s[0],t[1]=s[1],A(t[3],t[4],0,i,s,r),t[3]=s[0],t[4]=s[1]),!(isFinite(t[0])&&isFinite(t[3])&&isFinite(t[1])&&isFinite(t[4])))return;const a=this.computedExtent;let n=null;const o=isFinite(t[2])&&isFinite(t[5]),l=o&&(!a||null==a.zmin||t[2]<a.zmin),h=o&&(!a||null==a.zmax||t[5]>a.zmax);if(a){(t[0]<a.xmin||t[1]<a.ymin||t[3]>a.xmax||t[4]>a.ymax||l||h)&&(n=this._propertiesPool.get("computedExtent"),n.xmin=Math.min(t[0],a.xmin),n.ymin=Math.min(t[1],a.ymin),n.xmax=Math.max(t[3],a.xmax),n.ymax=Math.max(t[4],a.ymax),n.spatialReference=r)}else n=this._propertiesPool.get("computedExtent"),n.xmin=t[0],n.ymin=t[1],n.xmax=t[3],n.ymax=t[4],n.spatialReference=r;n&&(l&&(n.zmin=t[2]),h&&(n.zmax=t[5]),this._set("computedExtent",n))}_abortElevationInfoChange(){this._elevationInfoChangeAbortController&&(this._elevationInfoChangeAbortController.abort(),this._elevationInfoChangeAbortController=null)}async elevationInfoChange(){this._abortElevationInfoChange();const e=new AbortController;this._elevationInfoChangeAbortController=e;const t=re(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);this.symbolCreationContext.featureExpressionInfoContext=await se(t,this._viewSpatialReference,e.signal,Ve),y(e.signal),this._elevationInfoChangeAbortController=null,this._labeler?.elevationInfoChange(),this.forEachGraphics3DSymbol(((e,t,i)=>{e.globalPropertyChanged("elevationInfo",t)?t.forEach((e=>{const t=e.graphic,i=e.labelLayers;for(const r of i){r.graphics3DSymbolLayer.updateGraphicElevationContext(t,r)}})):this._recreateSymbol(i)})),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=p(this._stageLayerElevationProvider)):(!this.layer.elevationInfo||this.layer.elevationInfo&&"relative-to-scene"!==this.layer.elevationInfo.mode)&&this._numberOfGraphicsProvidingElevation>0&&(this._stageLayerElevationProvider=new me({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=p(this._stageLayerElevationProvider))}startCreateGraphics(){this._startCreateGraphics=!0,this.recreateAllGraphics()}recreateAllGraphics(){this._recreateAllGraphics(!1)}recreateAllGraphicsAndSymbols(){this._recreateAllGraphics(!0)}_recreateAllGraphics(e=!1){if(!this._startCreateGraphics)return;const{loadedGraphics:t,view:i}=this.owner,r=i.basemapTerrain.tilingScheme&&t&&t.length?t.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 t=this._graphicsBySymbol.get(e),i=[];t&&(t.forEach(((e,t)=>{const r=e.usedMemory;this._conditionalRemove(e,t),this._spatialIndex?.remove(e),i.push(e.graphic),e.destroy(),this._removeGraphics3DGraphic(t,r),this._updateLayerVisibility(),this._featureStore.events.emit("changed")})),this._graphicsBySymbol.set(e,new Map));const r=this._symbols.get(e);h(r),this._symbols.delete(e),this.add(i)}_recreateGraphicsForSymbol(e){const t=this._graphicsBySymbol.get(e);if(t){const e=[];t.forEach((t=>e.push(t.graphic))),this.recreateGraphics(e)}}_conditionalRemove(e,t){this._graphicsDrapedUids.delete(t),this._objectStates?.removeGraphic(e),this._labeler?.removeGraphic(e),this._deconflictor?.removeGraphic(e),null!=this._graphicStateTracking&&this._graphicStateTracking.removeGraphic(e)}add(e){e&&0!==e.length&&(this.owner.view.basemapTerrain&&this.owner.view.basemapTerrain.tilingScheme?(this._updatePolicyForGraphics(e)===fe.ASYNC?this._addDelayed(e):this._addImmediate(e),this.notifyChange("updating")):Ve.error("#add()","Cannot add graphics before terrain surface has been initialized"))}_updatePolicyForGraphics(e){if(this.effectiveUpdatePolicy===fe.SYNC&&("mesh"===this.layer.geometryType||null==this.layer.geometryType))for(const t of e)if(null!=t.geometry&&"mesh"===t.geometry.type&&!t.geometry.loaded)return fe.ASYNC;return this.effectiveUpdatePolicy}_addImmediate(e){this._geometryWarningLogged=!1,this._symbolWarningLogged=!1;for(const t of e)this._addGraphic(t,this._getRenderingInfo(t,Ve),fe.SYNC);this._cleanupSymbols(),this._labeler&&(this.owner.view.labeler.setDirty(),this._cleanupSymbols()),this.owner.view.deconflictor.setDirty()}_addDelayed(e){for(const t of e){const e=t.uid;let i=this._pendingUpdates.get(e);i?i.add?i.state!==Fe.NEW&&i.abortController?.abort():this._pendingAdds++:(i=this._pendingUpdatesPool.pushNew(),this._pendingAdds++,this._pendingUpdates.set(e,i)),i.add=t}this.notifyChange("running"),this.notifyChange("updatingRemaining")}remove(e){this.effectiveUpdatePolicy===fe.ASYNC?this._removeDelayed(e):this._removeImmediate(e),this.notifyChange("updating")}_removeImmediate(e){for(const t of e)this._removeGraphic(t);this._cleanupSymbols(),this._labeler&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty()}_removeDelayed(e){for(const t of e){const e=t.uid,i=this._pendingUpdates.get(e);if(i)i.add&&(i.remove?i.add=null:this._pendingUpdates.delete(e),i.state===Fe.LOADING&&i.abortController?.abort(),this._pendingAdds--);else{const i=this._pendingUpdatesPool.pushNew();i.remove=t,this._pendingUpdates.set(e,i),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)&&Ve.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[t,i]of this._pendingUpdates){if(e.done){this._applyPendingRemovesFirst=!0;break}if(i.remove&&!i.add&&(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(i.remove),i.remove=null,this._pendingUpdates.delete(t),0===this._pendingRemoves))break}}for(const[t,i]of this._pendingUpdates){if(e.done)break;i.add&&i.state===Fe.NEW&&this._processPendingUpdateNew(i);let r=this.effectiveUpdatePolicy;if(!i.remove||i.add&&i.state!==Fe.READY||(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(i.remove),i.remove=null,r=fe.SYNC),i.add)switch(i.state){case Fe.READY:this._addGraphic(i.add,i.renderingInfo,r),i.add=null,this._pendingAdds--,e.madeProgress();break;case Fe.REJECTED:i.add=null,this._pendingAdds--;case Fe.LOADING:}null==i.remove&&null==i.add&&this._pendingUpdates.delete(t)}0===this._pendingUpdates.size&&(this._finishPendingUpdates(),this.notifyChange("running"))}_processPendingUpdateNew(e){if(!e.add)return void(e.state=Fe.READY);const t=e.add.geometry;null==t||"mesh"!==t.type||t.loaded?this._processPendingUpdateNewRenderingInfo(e):this._processPendingUpdateNewMesh(e,t)}async _processPendingUpdateNewMesh(e,t){e.state=Fe.LOADING,e.abortController=new AbortController;const i=e.abortController.signal;try{await t.load({signal:i})}catch(r){return this._processPendingUpdateNewError(e,r)}e.abortController=null,this._processPendingUpdateNewRenderingInfo(e)}_processPendingUpdateNewError(e,t){e.abortController=null,m(t)?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,Ve),void(e.state=Fe.READY);e.state=Fe.LOADING,e.abortController=new AbortController;let t=null;try{t=await this._getRenderingInfoAsync(e.add,{signal:e.abortController.signal})}catch(i){return e.abortController=null,void(m(i)?e.state=Fe.NEW:e.state=Fe.REJECTED)}null==t||null==t.symbol?(Ve&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,Ve.warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),e.renderingInfo=null):e.renderingInfo=t,e.state=Fe.READY}_addGraphic(e,t,i){if(this._graphicsWithoutSymbol.set(e.uid,e),null==t||null==t.symbol||!H(e))return;if(null!=this.stage.renderView.objectAndLayerIdRenderHelper&&this.setUidToIdOnAdd){const t=$(this.owner.view.map,this.layer.uid);this.stage.renderView.objectAndLayerIdRenderHelper.setUidToObjectAndLayerId(e.objectId,e.uid,this.layer.id,this.layer.uid,!!this.layer.popupEnabled&&!t&&Ce(this.layer,this.owner.view.popup?.defaultPopupTemplateEnabled))}const r=t.symbol,s=this.getOrCreateGraphics3DSymbol(r,t.renderer);if(null==s)return;this._expandComputedExtent(e.geometry);const a=this._beginGraphicUpdate(e),n=new ne(e,t,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 t=this._createGraphics3DGraphic(s,n);this._spatialIndex&&null!=t&&this._spatialIndex.add(t),--s.referenced,this._endGraphicUpdate(e)}this._featureStore.events.emit("changed"),this._labeler&&this.owner.view.labeler.setDirty()},d=t=>{--this._loadingSymbols,this.destroyed||(this._whenSymbolRemoved.removeUnordered(l),o||(m(t)?this.add([e]):s.destroyed||this._endGraphicUpdate(e)))};++this._loadingSymbols,i===fe.ASYNC?s.load((()=>this._frameTask.schedule(h)),(e=>this._frameTask.schedule((()=>d(e))))):s.load(h,d)}_removeGraphic(e){const t=e.uid,i=this.graphics3DGraphics.get(t);if(i){i.graphics3DSymbol.onRemoveGraphic(i);const e=i.usedMemory,r=i.isElevationSource;this._conditionalRemove(i,t),this._spatialIndex?.remove(i);const s=i.graphics3DSymbol.symbol.id;this._graphicsBySymbol.get(s)?.delete(t),this._graphicsWithoutSymbol.delete(t),this._removeGraphics3DGraphic(t,e,r),i.destroy(),this._featureStore.events.emit("changed")}else this._graphicsWithoutSymbol.delete(t),this._graphicsWaitingForSymbol.delete(t),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("updating"))}_hasLabelingContext(e){if(e instanceof De||e instanceof Ee){const t=this.symbolCreationContext.layer;return!!t.labelingInfo&&t.labelingInfo.some((t=>t.symbol===e))}return!1}_hasValidSymbolCreationContext(e){return!(e instanceof De&&!this._hasLabelingContext(e))||(Ve.error("LabelSymbol3D is only valid as part of a LabelClass. Using LabelSymbol3D as a renderer symbol is not supported."),!1)}_getRenderingInfo(e,t){const i=e.geometry;if(null==i)return t&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,t.warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!I(i.spatialReference,this._viewSpatialReference))return t&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,t.warn(`Graphic in layer ${this.layer.id} has incompatible spatial reference and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return t&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,t.warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const r=this.rendererHasGeometryOperations?N(e,this.layer):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||Z(r.geometry)}}return null==s||null==s.symbol?(t&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,t.warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),null):s}_getRenderingInfoAsync(e,t){if(null==e.geometry)return Ve&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,Ve.warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return Ve&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,Ve.warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const i=this.rendererHasGeometryOperations?N(e,this.layer):e;return this.owner.getRenderingInfoAsync(i,this.currentRenderer,this._arcadeOnDemand,t)}_createGraphics3DSymbol(e,t){if(!this._hasValidSymbolCreationContext(e))return null;const i=this._getConvertedSymbol(e);if(!i)return null;let r;if(null!=t&&"backgroundFillSymbol"in t&&t.backgroundFillSymbol){const e=J(t.backgroundFillSymbol,{ignoreDrivers:!0});null!=e.symbol&&"web-style"!==e.symbol.type&&"cim"!==e.symbol.type&&(r=e.symbol.symbolLayers)}const s=le(i,this.symbolCreationContext,r);return s.load((()=>{const e=s.extentPadding;e>this.extentPadding&&this._set("extentPadding",e),this.notifyChange("averageSymbolComplexity")}),(()=>{})),s}getOrCreateGraphics3DSymbol(e,t){let i=this._symbols.get(e.id);return void 0===i&&(i=e instanceof Ie?new he(e,(e=>this._frameTask.schedule(e)),(e=>this._createGraphics3DSymbol(e,t))):this._createGraphics3DSymbol(e,t),this._symbols.set(e.id,i)),null!=i&&++i.referenced,i}trackGraphicState(e){return null==this._graphicStateTracking&&(this._graphicStateTracking=new de(this)),this._graphicStateTracking.add(e)}_addGraphics3DGraphic(e){this._usedMemory+=e.usedMemory,this.graphics3DGraphics.set(e.graphic.uid,e),this._numberOfGraphics++,e.isElevationSource&&(this._numberOfGraphicsProvidingElevation++,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_removeGraphics3DGraphic(e,t,i=!1){this._usedMemory-=t,this.graphics3DGraphics.delete(e),this._numberOfGraphics--,i&&(this._numberOfGraphicsProvidingElevation--,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_createGraphics3DGraphic(e,t){const i=t.graphic;if(this._graphicsWithoutSymbol.delete(i.uid),!this._symbols.has(e.symbol.id))return this.add([i]),null;if(this.graphics3DGraphics.has(i.uid))return null;const r=e.createGraphics3DGraphic(t);if(null==r)return null;this._addGraphics3DGraphic(r);const s=e.symbol.id;this._graphicsBySymbol.has(s)||this._graphicsBySymbol.set(s,new Map),this._graphicsBySymbol.get(s).set(i.uid,r);if(r.isDraped&&this._graphicsDrapedUids.add(i.uid),r.centroid=null,null!=i.geometry&&"point"!==i.geometry.type&&(r.centroid=pe(i.geometry,this._viewSpatialReference)),this._updateUserVisibility(r),null!=this._scaleVisibility&&this._scaleVisibility.updateVisibility(r),null!=this._filterVisibility){const{defaultVisibility:e}=this._filterVisibility;r.setVisibilityFlag(te.GRAPHIC,ie.FILTER,e),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[i.uid];return a&&(delete this._whenGraphics3DGraphicRequests[i.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),B(e))if(null!=e&&e.arcadeRequired){const t=new AbortController;this._rendererChangeAbortController=t;const{arcadeUtils:i}=await this._ensureArcade();y(t);const r=i.hasGeometryOperations(e);r&&(await i.enableGeometryOperations(),y(t)),this.effectiveUpdatePolicy===fe.ASYNC?await this._frameTask.schedule((()=>this._currentRendererChange(e,r)),t.signal):this._currentRendererChange(e,r),this._rendererChangeAbortController=null}else if(this.effectiveUpdatePolicy===fe.ASYNC){const t=new AbortController;this._rendererChangeAbortController=t,await this._frameTask.schedule((()=>this._currentRendererChange(e,!1)),t.signal),this._rendererChangeAbortController=null}else this._currentRendererChange(e,!1);else this._currentRendererChange(e,!1)}async _ensureArcade(){return null==this._arcadeOnDemand?(this._arcadeOnDemand=await Y(),this._arcadeOnDemand):this._arcadeOnDemand}_currentRendererChange(e,t){this.currentRenderer=e,this.rendererHasGeometryOperations=t,this.symbolCreationContext.arcade=this._arcadeOnDemand;const i=this.symbolCreationContext.renderer;if(e===i)return;if(this._symbolConversionCache.clear(),null==e)return this.symbolCreationContext.renderer=null,void this.recreateAllGraphicsAndSymbols();const r=G(i,e);this._updateUnchangedSymbolMappings(r,e,i),this.symbolCreationContext.renderer=e,null!=r&&("complete"===r.type?this.recreateAllGraphicsAndSymbols():"partial"===r.type&&(this._applyRendererDiff(r,e,i)?this._labeler?.reset():this.recreateAllGraphicsAndSymbols()),this.notifyChange("averageSymbolComplexity"))}_diffHasSymbolChange(e){for(const t in e.diff)switch(t){case"visualVariables":case"defaultSymbol":case"uniqueValueInfos":break;case"uniqueValueGroups":case"authoringInfo":case"fieldDelimiter":delete e.diff[t];break;default:return!0}return!1}_applySymbolSetDiff(e,t,i){e=e||[],t=t||[];const r=[];for(const s of t){const t=this._graphicsBySymbol.get(s.id);t&&t.forEach(((a,n)=>{const o=a.graphic,l=this.layer instanceof z?this.layer:null,h=this._arcadeOnDemand;if(s===i.defaultSymbol&&i.getSymbol(N(o,l),{arcade:h})===i.defaultSymbol)return;const d=a.usedMemory;e.length||i.defaultSymbol?r.push(o):this._graphicsWithoutSymbol.set(n,o);const p=this.graphics3DGraphics.get(n);this._conditionalRemove(p,n),a.destroy(),t.delete(n),this._removeGraphics3DGraphic(n,d),this._updateLayerVisibility()})),this._whenSymbolRemoved.forAll((e=>e(s.id)))}(e.length||r.length)&&(this._graphicsWithoutSymbol.forEach((e=>r.push(e))),this._graphicsWithoutSymbol.clear(),this.add(r)),this._cleanupSymbols(),this._labeler&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty()}_applyUniqueValueRendererDiff(e,t,i){const r=e.diff.defaultSymbol,a=e.diff.uniqueValueInfos;if(r||a){const n=a?a.added.map((e=>e.symbol)).filter(s):[],o=a?a.removed.map((e=>e.symbol)).filter(s):[];if(a)for(let e=0;e<a.changed.length;e++)n.push(a.changed[e].newValue.symbol),o.push(a.changed[e].oldValue.symbol);return r?(i.defaultSymbol&&o.push(i.defaultSymbol),t.defaultSymbol&&n.push(t.defaultSymbol)):i.defaultSymbol&&n.length&&o.push(t.defaultSymbol),this._applySymbolSetDiff(n,o,t),delete e.diff.defaultSymbol,delete e.diff.uniqueValueInfos,!0}return!1}_calculateUnchangedSymbolMapping(e,t,i){if("unique-value"!==t?.type||"unique-value"!==i?.type||null!=e&&"partial"!==e.type)return[];const r=e=>null!=e?e.id:null,s=e&&e.diff,a=s&&s.defaultSymbol,n=s&&s.uniqueValueInfos;let o;if(n)o=n.unchanged.map((e=>({oldId:r(e.oldValue.symbol),newId:r(e.newValue.symbol)})));else{o=[];for(const e of i.uniqueValueInfos??[]){const i=r(e.symbol),s=t.uniqueValueInfos?.find((t=>t.value===e.value));s&&i!==r(s.symbol)&&o.push({oldId:i,newId:r(s.symbol)})}}return!a&&i.defaultSymbol&&o.push({oldId:r(i.defaultSymbol),newId:r(t.defaultSymbol)}),o}_updateSymbolMapping(e,t){const i=null!=t&&t?"string"==typeof t?t:t.id:null;if(null==e||e===i)return;const r=this._graphicsBySymbol.get(e);this._graphicsBySymbol.delete(e),void 0!==r&&this._graphicsBySymbol.set(i,r);const s=this._symbols.get(e);if(void 0!==s&&(this._symbols.delete(e),this._symbols.set(i,s),null!=s)){const e="string"==typeof t?null:t;null!=e?s.symbol=e:s.symbol.id=i}}_updateUnchangedSymbolMappings(e,t,i){const r=this._calculateUnchangedSymbolMapping(e,t,i);for(const{oldId:s,newId:a}of r)this._updateSymbolMapping(s,a)}_applyRendererDiff(e,i,r){if(this._diffHasSymbolChange(e))return!1;if(i instanceof t&&r instanceof t&&this._applyUniqueValueRendererDiff(e,i,r)&&0===Object.keys(e.diff).length)return!0;for(const[t]of this._graphicsBySymbol){const r=this._symbols.get(t);if(null!=r)switch(r.applyRendererDiff(e,i)){case ce.RecreateSymbol:this._recreateSymbol(t);break;case ce.RecreateGraphics:this._recreateGraphicsForSymbol(t);case ce.FastUpdate:}}return!0}opacityChange(){this.forEachGraphics3DSymbol(((e,t)=>e.globalPropertyChanged("opacity",t))),this._updateStageLayerVisibility()}_slicePlaneEnabledChange(e){e!==this.symbolCreationContext.slicePlaneEnabled&&(this.symbolCreationContext.slicePlaneEnabled=e,this.stageLayer.sliceable=e,this.forEachGraphics3DSymbol(((e,t)=>e.globalPropertyChanged("slicePlaneEnabled",t))),this._deconflictor&&this._deconflictor.slicePlaneEnabledChange(),this._labeler&&this._labeler.slicePlaneEnabledChange())}_physicalBasedRenderingChange(e){this.symbolCreationContext.physicalBasedRenderingEnabled=e,this.forEachGraphics3DSymbol(((e,t,i)=>{e.globalPropertyChanged("physicalBasedRenderingEnabled",t)||this._recreateSymbol(i)}))}_skipHighSymbolLoDsChange(e){this.symbolCreationContext.skipHighSymbolLods=e,this.forEachGraphics3DSymbol(((e,t,i)=>{e.globalPropertyChanged("skipHighSymbolLods",t)||this._recreateSymbol(i)}))}_pixelRatioChange(){this.forEachGraphics3DSymbol(((e,t,i)=>{e.globalPropertyChanged("pixelRatio",t)||this._recreateSymbol(i)}))}_signalUpdatingDuringAsyncLoadedGraphicsChange(){this._updatingPendingLoadedGraphicsChange&&this._updatingPendingLoadedGraphicsChange.remove(),this._updatingPendingLoadedGraphicsChange=C((()=>{this._updatingPendingLoadedGraphicsChange=null}))}setClippingExtent(e,t){const i=this.symbolCreationContext.clippingExtent,r=T();return ue(e,r,t)?this.symbolCreationContext.clippingExtent=O(L(),r):this.symbolCreationContext.clippingExtent=null,!F(this.symbolCreationContext.clippingExtent,i)}modifyGraphics3DGraphicVisibilities(e){if(this.destroyed)return;let t=!1;this.graphics3DGraphics.forEach((i=>{e(i)&&(t=!0)})),t&&(this.owner.view.labeler?.setDirty(),this.owner.view.deconflictor?.setDirty())}forEachGraphics3DSymbol(e){for(const[t,i]of this._symbols){if(null==i)return;e(i,this._graphicsBySymbol.get(t)||We,t)}}updateAllGraphicsVisibility(){null!=this._filterVisibility&&this._filterVisibility.reapply(),this.modifyGraphics3DGraphicVisibilities((e=>{const t=this._updateUserVisibility(e),i=null!=this._scaleVisibility&&this._scaleVisibility.updateVisibility(e);return t||i}))}_hideAllGraphics(){this.modifyGraphics3DGraphicVisibilities((e=>e.setVisibilityFlag(te.GRAPHIC,ie.USER,!1)))}_validateRenderer(e){const t=q(e,{geometryType:this.layer?.geometryType});if(t){const e=`Renderer for layer '${this.layer.title?`${this.layer.title}, `:""}, id:${this.layer.id}' is not supported in a SceneView`;Ve.warn(e,t.message)}}_cleanupSymbols(){if(this._graphicsWaitingForSymbol.size>0||this._suspendSymbolCleanup)return;let e=!1;this._symbols.forEach(((t,i)=>{if(null==t||t.referenced>0)return;const r=this._graphicsBySymbol.get(i);r&&0!==r.size||(this._graphicsBySymbol.delete(i),this._symbols.delete(i),h(t),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;Oe.tmpVec=E(),e([S({readOnly:!0})],Oe.prototype,"computedExtent",void 0),e([S()],Oe.prototype,"currentRenderer",void 0),e([S()],Oe.prototype,"rendererHasGeometryOperations",void 0),e([S()],Oe.prototype,"_frameTask",void 0),e([S({readOnly:!0})],Oe.prototype,"_viewSpatialReference",null),e([S()],Oe.prototype,"_rendererChangeAbortController",void 0),e([S()],Oe.prototype,"_elevationInfoChangeAbortController",void 0),e([S()],Oe.prototype,"_initializeAbortController",void 0),e([S()],Oe.prototype,"_elevationAlignment",void 0),e([S()],Oe.prototype,"_scaleVisibility",void 0),e([S()],Oe.prototype,"_filterVisibility",void 0),e([S()],Oe.prototype,"_initializePromise",void 0),e([S()],Oe.prototype,"_spatialIndex",void 0),e([S({readOnly:!0})],Oe.prototype,"extentPadding",void 0),e([S()],Oe.prototype,"_updatingPendingLoadedGraphicsChange",void 0),e([S()],Oe.prototype,"_featureStore",void 0),e([S()],Oe.prototype,"_deconflictor",void 0),e([S()],Oe.prototype,"_labeler",void 0),e([S()],Oe.prototype,"_objectStates",void 0),e([S()],Oe.prototype,"_loadingSymbols",void 0),e([S()],Oe.prototype,"preferredUpdatePolicy",void 0),e([S()],Oe.prototype,"_forcedUpdatePolicy",void 0),e([S({readOnly:!0})],Oe.prototype,"effectiveUpdatePolicy",null),e([S({constructOnly:!0})],Oe.prototype,"elevationFeatureExpressionEnabled",void 0),e([S({constructOnly:!0})],Oe.prototype,"owner",void 0),e([S({constructOnly:!0})],Oe.prototype,"layer",void 0),e([S({constructOnly:!0})],Oe.prototype,"graphicSymbolSupported",void 0),e([S({constructOnly:!0})],Oe.prototype,"getRenderingInfoWithoutRenderer",void 0),e([S({constructOnly:!0})],Oe.prototype,"componentFactories",void 0),e([S({constructOnly:!0})],Oe.prototype,"setUidToIdOnAdd",void 0),e([S()],Oe.prototype,"featureStore",null),e([S()],Oe.prototype,"initializePromise",null),e([S()],Oe.prototype,"scaleVisibility",null),e([S()],Oe.prototype,"elevationAlignment",null),e([S()],Oe.prototype,"objectStates",null),e([S()],Oe.prototype,"filterVisibility",null),e([S({readOnly:!0})],Oe.prototype,"updating",null),e([S({readOnly:!0})],Oe.prototype,"running",null),e([S({readOnly:!0})],Oe.prototype,"suspendedOrOutsideOfView",null),e([S({readOnly:!0,dependsOn:[]})],Oe.prototype,"updatingRemaining",null),e([S({readOnly:!0})],Oe.prototype,"displayFeatureLimit",null),e([S({readOnly:!0,dependsOn:[]})],Oe.prototype,"averageSymbolComplexity",null),e([S({constructOnly:!0})],Oe.prototype,"hasZ",void 0),e([S({constructOnly:!0})],Oe.prototype,"hasM",void 0),e([S()],Oe.prototype,"_objectIdField",null),Oe=Ue=e([w(Le)],Oe),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=E(),Me=E(),We=new Map;export{Oe 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 t from"../../../../renderers/UniqueValueRenderer.js";import"../../../../renderers/support/jsonUtils.js";import i from"../../../../core/Logger.js";import"../../../../symbols.js";import r from"../../../../core/Accessor.js";import{isSome as s}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import a from"../../../../core/Error.js";import{makeHandle as n}from"../../../../core/handleUtils.js";import{someMap as o,findInMap as l}from"../../../../core/MapUtils.js";import{destroyMaybe as h,removeMaybe as d,disposeMaybe as p}from"../../../../core/maybe.js";import c from"../../../../core/PooledArray.js";import{throwIfAborted as y,createResolver as g,isAbortError as m}from"../../../../core/promiseUtils.js";import{watch as u,when as b,on as _,syncAndInitial as f,whenOnce as v}from"../../../../core/reactiveUtils.js";import{schedule as C}from"../../../../core/scheduling.js";import{property as S}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as w}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as G,isEmpty as R}from"../../../../core/accessorSupport/diffUtils.js";import{s as P,g as x,i as D}from"../../../../chunks/vec3.js";import{c as I}from"../../../../chunks/vec3f64.js";import{canProjectWithoutEngine as E}from"../../../../geometry/projection.js";import{projectBuffer as U}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as j}from"../../../../geometry/projection/projectVectorToVector.js";import{projectXYZToVector as A}from"../../../../geometry/projection/projectXYZToVector.js";import{create as L,center as O,fromRect as V,equals as F}from"../../../../geometry/support/aaBoundingBox.js";import{create as T}from"../../../../geometry/support/aaBoundingRect.js";import{equals as k}from"../../../../geometry/support/spatialReferenceUtils.js";import z from"../../../../layers/Layer.js";import{getObjectId as M,computeAABB as W,hasGeometry as H}from"../../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as N}from"../../../../layers/graphics/hydratedFeatures.js";import{isSupportedRenderer3D as B,validateTo3D as q}from"../../../../renderers/support/rendererConversion.js";import{loadArcade as Y}from"../../../../support/arcadeOnDemand.js";import{isBasemapLayer as $}from"../../../../support/basemapUtils.js";import{getDefaultSymbol3D as Z}from"../../../../symbols/support/defaults3D.js";import{to3D as J}from"../../../../symbols/support/symbolConversion.js";import{averageSymbolComplexities as Q,defaultSymbolComplexity as X}from"./defaultSymbolComplexity.js";import{DisplayFeatureLimit as K}from"./DisplayFeatureLimit.js";import{ViewElevationProvider as ee}from"./ElevationQuery.js";import{VisibilityGroup as te,VisibilityFlag as ie}from"./enums.js";import{extractExpressionInfo as re,createContext as se}from"./featureExpressionInfoUtils.js";import{Graphics3DFeatureStore as ae}from"./Graphics3DFeatureStore.js";import{Graphics3DGraphicCreationContext as ne}from"./Graphics3DGraphicCreationContext.js";import{Graphics3DSymbolCreationContext as oe}from"./Graphics3DSymbolCreationContext.js";import{make as le}from"./Graphics3DSymbolFactory.js";import{Graphics3DWebStyleSymbol as he}from"./Graphics3DWebStyleSymbol.js";import{GraphicStateTracking as de}from"./GraphicStateTracking.js";import{computeCentroid as pe}from"./graphicUtils.js";import{ApplyRendererDiffResult as ce}from"./interfaces.js";import{LoadStatus as ye}from"./Loadable.js";import{SpatialIndex2D as ge}from"./SpatialIndex2D.js";import{StageLayerElevationProvider as me}from"../support/StageLayerElevationProvider.js";import{toBoundingRect as ue}from"../../support/extentUtils.js";import{PropertiesPool as be}from"../../support/PropertiesPool.js";import{GridLocalOriginFactory as _e}from"../../webgl-engine/lib/GridLocalOriginFactory.js";import{UpdatePolicy as fe}from"../../webgl-engine/lib/UpdatePolicy.js";import{VertexAttribute as ve}from"../../webgl-engine/lib/VertexAttribute.js";import{WebGLLayer as Ce}from"../../webgl-engine/lib/WebGLLayer.js";import{hasPopupTemplate as Se}from"../../../layers/support/popupUtils.js";import{ImmediateTask as we,noBudget as Ge,TaskPriority as Re,Task as Pe}from"../../../support/Scheduler.js";import xe from"../../../../geometry/Extent.js";import De from"../../../../geometry/Point.js";import Ie from"../../../../symbols/LabelSymbol3D.js";import Ee from"../../../../symbols/TextSymbol.js";import Ue from"../../../../symbols/WebStyleSymbol.js";var je;const Ae=I(),Le=L(),Oe="esri.views.3d.layers.graphics.Graphics3DCore",Ve=i.getLogger(Oe);let Fe=je=class extends r{get _viewSpatialReference(){return this.owner.view.spatialReference}get spatialIndex(){return this._spatialIndex||(this._spatialIndex=new ge({objectIdField:this.owner.layer?.objectIdField,spatialReference:this._viewSpatialReference,hasZ:!!this.hasZ,hasM:!!this.hasM}),this._spatialIndex.setup(Array.from(this.graphics3DGraphics.values()))),this._spatialIndex.update(),this._spatialIndex}get numberOfGraphics(){return this._numberOfGraphics}get effectiveUpdatePolicy(){return null!=this.currentRenderer&&"dictionary"===this.currentRenderer.type?fe.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,t=e?.graphics3D.minTotalNumberOfFeatures??0,i=e?.graphics3D.maxTotalNumberOfFeatures??0,r=e?.graphics3D.maxNumberOfDrawCalls??0,s=e?.graphics3D.maxTotalNumberOfVertices??0,a=this.averageSymbolComplexity,n=Math.max(1,a?.verticesPerFeature??1),o=a&&a.drawCallsPerFeature>0&&r>0?r/a.drawCallsPerFeature:i,l=Math.ceil(s/n),h=Math.max(t,Math.min(i,l,o)),d=this._get("displayFeatureLimit");return d&&d.maximumTotalNumberOfVertices===s&&d.averageSymbolComplexity===a&&d.maximumNumberOfFeatures===h?d:new K(s,h,a)}get averageSymbolComplexity(){const e=Q(this._symbolComplexities),t=this._get("averageSymbolComplexity");return 0===e.numComplexities||null!=t&&(e.estimated&&(t.verticesPerFeature>=e.verticesPerFeature||t.verticesPerCoordinate>=e.verticesPerCoordinate||t.drawCallsPerFeature>=e.drawCallsPerFeature)||t.verticesPerFeature===e.verticesPerFeature&&t.verticesPerCoordinate===e.verticesPerCoordinate&&t.drawCallsPerFeature===e.drawCallsPerFeature)?t:e}get usedMemory(){const e=null!=this.averageSymbolComplexity&&this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel*this._numberOfGraphics:0,t=this._getSymbolComplexitiesUsed().reduce(((e,t)=>e+t.memory.resourceBytes),0),i=this.owner.view._stage.renderer,r=this.owner.view.basemapTerrain.overlayManager.renderer,s=Array.from(this._symbols.values()).reduce(((e,t)=>e+(t?.symbolLayers.reduce(((e,t)=>e+(t?.materials.reduce(((e,t)=>e+i.getMemoryForMaterial(t)+r.getMemoryForMaterial(t)),0)??0)),0)??0)),0);return this._usedMemory+e+t+s}get usedMemoryPerGraphic(){if(this._usedMemory&&this._numberOfGraphics){const e=this._numberOfGraphics/(this._numberOfGraphics+Math.max(this._pendingAdds,this._pendingRemoves));return this._usedMemory/this._numberOfGraphics*e}if(null!=this.averageSymbolComplexity){const e=this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel:0;return this.averageSymbolComplexity.memory.bytesPerFeature+e}return 0}get unprocessedMemoryEstimate(){return(this._pendingAdds-this._pendingRemoves)*this.usedMemoryPerGraphic}get _symbolComplexities(){return this.currentRenderer?this._getSymbolComplexitiesUsedOrRenderer(this.currentRenderer):this._getSymbolComplexitiesUsed()}get visible(){return this._visible}_getConvertedSymbol(e){if("web-style"===e.type)return e.clone();const t=this._symbolConversionCache.get(e.id);if(null!=t)return t;const i=J(e,{geometryType:this.layer?.geometryType??void 0,retainId:!0,hasLabelingContext:this._hasLabelingContext(e)}),r=i.symbol||null;return null==r&&i.error&&Ve.error(i.error.message),this._symbolConversionCache.set(e.id,r),r}_getSymbolComplexitiesUsedOrRenderer(e){if(null==e)return[];const t=e.getSymbols(),i="backgroundFillSymbol"in e?e.backgroundFillSymbol:null;if(!(i||t&&t.length))return[];const r=[],s=this._getSymbolComplexityUsedOrRenderer(i);null!=s&&r.push(s);for(const a of t){const e=this._getSymbolComplexityUsedOrRenderer(a);null!=e&&r.push(e)}return r}_getSymbolComplexityUsedOrRenderer(e){if(null==e)return null;const t=this._symbols.get(e.id);if(null!=t)return t.complexity;const i=this._getConvertedSymbol(e);return null!=i?X(i):null}_getSymbolComplexitiesUsed(){const e=[];return this._symbols.forEach((t=>{null!=t&&e.push(t.complexity)})),e}get _objectIdField(){return this.layer.objectIdField}constructor(e){super(e),this._propertiesPool=new be({computedExtent:xe},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._frameTask=we,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 c({allocator:e=>e||new ke,deallocator:e=>(e.clear(),e)}),this._symbolWarningLogged=!1,this._geometryWarningLogged=!1,this._objectIdInvisibleSet=new Set,this._whenSymbolRemoved=new c,this.preferredUpdatePolicy=fe.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 oe(e.owner.view.resourceController.scheduler,((e,t)=>this._frameTask.schedule(e,t)))}initialize(){this._featureStore=new ae({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,t,i)=>this.spatialIndex.queryGraphicUIDsInExtent(e,t,i),{componentFactories:t}=this;if(null!=t.elevationAlignment){const i=t.elevationAlignment(this,e);this._elevationAlignment=i}if(null!=t.scaleVisibility){const i=t.scaleVisibility(this,e);this._scaleVisibility=i}if(null!=t.filterVisibility){const e=t.filterVisibility({featureStore:this._featureStore,getFeatureCount:()=>this.graphics3DGraphics.size,updateFeatureVisibilities:e=>this.modifyGraphics3DGraphicVisibilities((t=>t.setVisibilityFlag(te.GRAPHIC,ie.FILTER,e(M(t.graphic,this._objectIdField))))),setAllFeaturesVisibility:e=>this.modifyGraphics3DGraphicVisibilities((t=>t.setVisibilityFlag(te.GRAPHIC,ie.FILTER,e))),clearFeaturesVisibility:()=>this.modifyGraphics3DGraphicVisibilities((e=>e.setVisibilityFlag(te.GRAPHIC,ie.FILTER,!0)))});this._filterVisibility=e}if(null!=t.deconflictor){const e=t.deconflictor(this);this._deconflictor=e}if(null!=t.labeler&&null!=this._scaleVisibility){const e=t.labeler(this,this._scaleVisibility);this._labeler=e}if(null!=t.objectStates){const e=t.objectStates(this);this._objectStates=e}this._initializeAbortController=new AbortController,this._initializePromise=this._initializeAsync()}async _initializeAsync(){const e=this._initializeAbortController?.signal,t=this.owner.view;this._viewElevationProvider=new ee(this._viewSpatialReference,t),this._initializeStage(t,this.layer.uid);const i=t.sharedSymbolResources;this.symbolCreationContext.sharedResources=i,this._sharedSymbolResourcesOwnerHandle=i.addGraphicsOwner(this.owner),null!=this.currentRenderer&&(this.symbolCreationContext.renderer=this.currentRenderer),this.symbolCreationContext.stage=this.stage,this.symbolCreationContext.streamDataRequester=i.streamDataRequester,this.symbolCreationContext.renderCoordsHelper=t.renderCoordsHelper,this.symbolCreationContext.layer=this.layer,this.symbolCreationContext.graphicsCoreOwner=this.owner,this.symbolCreationContext.localOriginFactory=new _e(t.renderSpatialReference),this.symbolCreationContext.elevationProvider=t.elevationProvider,this.symbolCreationContext.notifyGraphicGeometryChanged=e=>this.notifyGraphicGeometryChanged(e),this.symbolCreationContext.notifyGraphicVisibilityChanged=e=>this.notifyGraphicVisibilityChanged(e);const r=re(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);if(this.symbolCreationContext.featureExpressionInfoContext=await se(r,this._viewSpatialReference,e,Ve),y(e),this.symbolCreationContext.screenSizePerspectiveEnabled=t.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=t.basemapTerrain.overlayManager.registerGeometryDrapeSource(e),this.addHandles(n((()=>t.basemapTerrain.overlayManager.unregisterDrapeSource(e))))}this.addHandles([u((()=>this.suspendedOrOutsideOfView),(()=>this._frameTask.reschedule((()=>this._updateLayerVisibility())))),u((()=>[this.layer?.screenSizePerspectiveEnabled,this.owner.view?.screenSizePerspectiveEnabled]),(()=>{const e=t.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled;e!==this.symbolCreationContext.screenSizePerspectiveEnabled&&(this.symbolCreationContext.screenSizePerspectiveEnabled=e,this._labeler?.reset(),this.recreateAllGraphicsAndSymbols())})),u((()=>this.owner.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(!!e))),u((()=>this.owner.view.state?.rasterPixelRatio),(()=>this._pixelRatioChange())),u((()=>!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled),(e=>this._physicalBasedRenderingChange(e))),u((()=>!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods),(e=>this._skipHighSymbolLoDsChange(e))),b((()=>t.basemapTerrain?.tilingScheme),(e=>{if(e.spatialReference.equals(this.symbolCreationContext.overlaySR)||null==t.basemapTerrain.spatialReference||(this.symbolCreationContext.overlaySR=t.basemapTerrain.spatialReference),this.hasHandles("loaded-graphics"))this.recreateAllGraphics();else{const e=()=>this.owner?.loadedGraphics;this.addHandles([_(e,"change",(e=>{this._graphicsCollectionChanged(e),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}),{onListenerAdd:()=>{this.recreateAllGraphics(),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}})],"loaded-graphics")}}),{initial:!0}),u((()=>this.effectiveUpdatePolicy),(e=>{null!=this.stageLayer&&(this.stageLayer.updatePolicy=e),this.symbolCreationContext.isAsync=this.effectiveUpdatePolicy===fe.ASYNC,e===fe.SYNC&&this.runTask(Ge)}),f)]),this._frameTask=t.resourceController.scheduler.registerTask(Re.GRAPHICS_CORE,this),this.layer&&"featureReduction"in this.layer&&this.addHandles(u((()=>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=we,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._set("owner",null);for(const e in this._whenGraphics3DGraphicRequests)this._whenGraphics3DGraphicRequests[e].reject(new a("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,t){this.stage=e._stage,this.stageLayer=new Ce(this.stage,{pickable:!this.suspendedOrOutsideOfView,updatePolicy:this.effectiveUpdatePolicy},t);const i=this.stageLayer.events;i.on("objectTransformation",(e=>this.notifyGraphicGeometryChanged(e.graphicUid))),i.on("objectShaderTransformation",(e=>this.notifyGraphicGeometryChanged(e.graphicUid))),i.on("visibilityChanged",(e=>this.notifyGraphicVisibilityChanged(e.graphicUid))),i.on("objectGeometryAdded",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid))),i.on("objectGeometryRemoved",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid))),i.on("objectGeometryUpdated",(e=>e.attribute===ve.POSITION&&this.notifyGraphicGeometryChanged(e.object.graphicUid)))}notifyGraphicGeometryChanged(e){if(null==this._graphicStateTracking||null==e)return;const t=this.graphics3DGraphics.get(e);t&&this._graphicStateTracking.updateGraphicGeometry(t)}notifyGraphicVisibilityChanged(e){if(null==this._graphicStateTracking||null==e)return;const t=this.graphics3DGraphics.get(e);t&&this._graphicStateTracking.updateGraphicVisibility(t)}_updateLayerVisibility(){const e=this.displayFeatureLimit.maximumNumberOfFeatures,t=this._numberOfGraphics>e*ze,i=!this.suspendedOrOutsideOfView&&!t;i!==this._visible&&(this._visible=i,i?(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,t=this.owner.layer&&this.owner.layer.objectIdField){return M(e,t)}get graphics3DGraphicsByObjectID(){const e=this.owner.layer&&this.owner.layer.objectIdField;if(!e)return;const t=new Map;return this.graphics3DGraphics.forEach((i=>{if(!i)return;const r=i.graphic,s=this._getGraphicObjectID(r,e);null!=s&&t.set(s,i)})),t}get labelsEnabled(){return!(!this._labeler||!this._labeler.layerLabelsEnabled())}async updateLabelingInfo(e){const t=this._deconflictor&&this._deconflictor.labelingInfoChange(e),i=this._labeler&&this._labeler.labelingInfoChange(e);await Promise.allSettled([t,i])}updateVisibilityInfo(){this._deconflictor&&this._deconflictor.labelingInfoChange(),this._labeler&&this._labeler.visibilityInfoChange()}get symbolUpdateType(){if(this._pendingUpdates.size>0)return"unknown";let e=0,t=0;return o(this._symbols,((i,r)=>{if(null!=i){const s=i.getFastUpdateStatus();if(s.loading>0)return!0;this._graphicsBySymbol.has(r)&&(t+=s.fast,e+=s.slow)}return!1}))?"unknown":t>=0&&0===e?"fast":e>=0&&0===t?"slow":"mixed"}runTask(e){if(this._frameTask.processQueue(e),this._applyPendingUpdates(e),this.notifyChange("running"),this.running||this.notifyChange("updating"),this.notifyChange("updatingRemaining"),!e.hasProgressed)return Pe.YIELD}setObjectIdVisibility(e,t){t?this._objectIdInvisibleSet.delete(e):this._objectIdInvisibleSet.add(e);const i=this._findGraphics3DGraphicByObjectId(e);null!=i&&this._updateUserVisibility(i)}_findGraphics3DGraphicByObjectId(e){return l(this.graphics3DGraphics,(t=>this._getGraphicObjectID(t.graphic)===e))}_updateUserVisibility(e){if(null==e)return!1;const t=e.graphic,i=this._getGraphicObjectID(t),r=t.visible&&!this.owner.suspended&&(null==i||!this._objectIdInvisibleSet.has(i));return e.setVisibilityFlag(te.GRAPHIC,ie.USER,r)}_whenGraphics3DGraphic(e){const t=this.graphics3DGraphics.get(e.uid);if(t)return Promise.resolve(t);const i=this._whenGraphics3DGraphicRequests[e.uid];if(i)return i.promise;const r=g();return this._whenGraphics3DGraphicRequests[e.uid]=r,r.promise}async _boundsForGraphics3DGraphic(e,t){const i=this._viewSpatialReference,r=this.owner.view.renderSpatialReference,s=this.owner.view.basemapTerrain.spatialReference,a=(e,t,s)=>U(e,r,t,e,i,t,s),n=(e,t,r)=>U(e,s,t,e,i,t,r),o=this._viewElevationProvider?{service:this._viewElevationProvider,useViewElevation:null!=t&&!!t.useViewElevation,minDemResolution:null!=t?t.minDemResolution:null,minDemResolutionForPoints:this.owner.view.resolution}:null,l=await e.getProjectedBoundingBox(a,n,o,t?.signal);if(!l)return null;const h=l.boundingBox;if(l.requiresDrapedElevation){const e=this.symbolCreationContext.elevationProvider;if(e){O(h,Ae);const t=e.getElevation(Ae[0],Ae[1],0,i,"ground")??0;h[2]=Math.min(h[2],t),h[5]=Math.max(h[5],t)}}return{boundingBox:h,screenSpaceObjects:l.screenSpaceObjects}}async whenGraphicBounds(e,t){await v((()=>this.owner?.loadedGraphics));const i=this.owner.layer&&this.owner.layer.objectIdField,r=this.owner.loadedGraphics.find((t=>t===e||null!=i&&null!=t.attributes&&e.attributes&&t.attributes[i]===e.attributes[i]));if(!r)throw new a("internal:graphic-not-part-of-view","Graphic is not part of this view");const s=await this._whenGraphics3DGraphic(r);return this._boundsForGraphics3DGraphic(s,t)}computeAttachmentOrigin(e,t){const i=this.graphics3DGraphics.get(e.uid);if(!i)return null;const r=i.computeAttachmentOrigin();if(0===r.render.num&&0===r.draped.num)return null;P(Me,0,0,0);let s=0;if(r.render.num>0){if(!j(r.render.origin,this.symbolCreationContext.renderCoordsHelper.spatialReference,We,t))return null;x(Me,Me,We),s++}if(r.draped.num>0){const[e,i]=r.draped.origin,a=this._viewElevationProvider.getElevation(e,i,"ground")??0;if(P(We,e,i,a),!j(We,this._viewElevationProvider.spatialReference,We,t))return null;x(Me,Me,We),s++}return s>1&&D(Me,Me,1/s),new De({x:Me[0],y:Me[1],z:Me[2],spatialReference:t})}getSymbolLayerSize(e,t){const i=this._symbols.get(e.id);if(null==i)throw new a("internal:symbol-not-part-of-view","Symbol is not part of this view");const r=e.symbolLayers.indexOf(t);if(-1===r)throw new a("internal:missing-symbol-layer","Symbol layer is not in symbol");const s=i.getSymbolLayerSize(r);if(null==s)throw new a("internal:missing-size","Symbol layer has no valid size");return s}_graphicsCollectionChanged(e){this._startCreateGraphics&&(this.add(e.added),this.remove(e.removed))}graphicUpdateHandler(e){const t=e.graphic.uid,i=this.graphics3DGraphics.get(t);if(null!=i||null!=this._graphicsWithoutSymbol.get(t))switch(e.property){case"visible":this._graphicUpdateVisibleHandler(i);break;case"geometry":this._graphicUpdateGeometryHandler(i,e);break;case"symbol":this._graphicUpdateSymbolHandler(i,e);break;case"attributes":break;case"origin-transform":this._graphicUpdateTransformHandler(i,e)}}_graphicUpdateGeometryHandler(e,t){this._graphicUpdateGeometryOrTransformHandler(e,t,(()=>null!=t.newValue&&null!=e&&e.graphics3DSymbol.updateGeometry(e,t.newValue)));const i=t.graphic.geometry;null!=i&&this._expandComputedExtent(i)}_graphicUpdateTransformHandler(e,t){const i=t.graphic.geometry;this._graphicUpdateGeometryOrTransformHandler(e,t,(()=>null!=t.newValue&&null!=e&&null!=i&&e.graphics3DSymbol.updateTransform(e,i.spatialReference,t.newValue,t.action)))}_graphicUpdateGeometryOrTransformHandler(e,t,i){if(null!=t.graphic.geometry)if(null!=e)i()||this._recreateGraphic(e.graphic);else{const e=t.graphic.symbol&&t.graphic.symbol.id;if(e){const t=this._symbols.get(e);if(null!=t&&t.loadStatus===ye.LOADING)return}this._recreateGraphic(t.graphic)}else this._recreateGraphic(t.graphic)}_graphicUpdateSymbolHandler(e,t){const i=t.graphic,r=null!=e?e.graphics3DSymbol:null!=t.oldValue?this._symbols.get(t.oldValue.id):null;if(null==r||null==t.newValue)return void this._recreateGraphic(i);const s=r.symbol,a=this._getConvertedSymbol(t.newValue);if(null!=a&&(a.type!==s.type||"web-style"===a.type)||"web-style"===s.type)return void this._recreateGraphic(i);const n=this._graphicsBySymbol.get(s.id);if(n&&1!==n.size)return void this._recreateGraphic(i);const o=G(s,a);if(null==o)return void this._updateSymbolMapping(s.id,a);const l={diff:o,graphics3DGraphicPatches:[],symbolStatePatches:[]};if(r.prepareSymbolPatch(l),!R(l.diff))return void this._recreateGraphic(i);const h=this._getRenderingInfo(i);if(null==h)return void this._recreateGraphic(i);const d=r.extentPadding;for(const p of l.symbolStatePatches)p();if(d!==r.extentPadding&&this._recomputeExtentPadding(),null!=e)for(const p of l.graphics3DGraphicPatches)p(e,h);this._updateSymbolMapping(s.id,a)}_graphicUpdateVisibleHandler(e){this._updateUserVisibility(e)&&(this._labeler&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty())}recreateGraphics(e){this._suspendSymbolCleanup=!0,this.remove(e),this.add(e),this._suspendSymbolCleanup=!1,this.effectiveUpdatePolicy===fe.SYNC&&this._cleanupSymbols()}_recreateGraphic(e){this.recreateGraphics([e])}_beginGraphicUpdate(e){const t=this._graphicsUpdateId;return this._graphicsUpdateId++,this._graphicsWaitingForSymbol.set(e.uid,t),1===this._graphicsWaitingForSymbol.size&&this.notifyChange("updating"),t}_endGraphicUpdate(e){e&&(this._graphicsWaitingForSymbol.delete(e.uid),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("updating")))}_recomputeExtentPadding(){let e=0;this._symbols.forEach((t=>{null!=t&&(e=Math.max(e,t.extentPadding))})),this._set("extentPadding",e)}_expandComputedExtent(e){const t=Le,i=e.spatialReference;W(e,t);const r=this._viewSpatialReference,s=je.tmpVec;if(k(i,r)||A(t[0],t[1],0,i,s,r)&&(t[0]=s[0],t[1]=s[1],A(t[3],t[4],0,i,s,r),t[3]=s[0],t[4]=s[1]),!(isFinite(t[0])&&isFinite(t[3])&&isFinite(t[1])&&isFinite(t[4])))return;const a=this.computedExtent;let n=null;const o=isFinite(t[2])&&isFinite(t[5]),l=o&&(!a||null==a.zmin||t[2]<a.zmin),h=o&&(!a||null==a.zmax||t[5]>a.zmax);if(a){(t[0]<a.xmin||t[1]<a.ymin||t[3]>a.xmax||t[4]>a.ymax||l||h)&&(n=this._propertiesPool.get("computedExtent"),n.xmin=Math.min(t[0],a.xmin),n.ymin=Math.min(t[1],a.ymin),n.xmax=Math.max(t[3],a.xmax),n.ymax=Math.max(t[4],a.ymax),n.spatialReference=r)}else n=this._propertiesPool.get("computedExtent"),n.xmin=t[0],n.ymin=t[1],n.xmax=t[3],n.ymax=t[4],n.spatialReference=r;n&&(l&&(n.zmin=t[2]),h&&(n.zmax=t[5]),this._set("computedExtent",n))}_abortElevationInfoChange(){this._elevationInfoChangeAbortController&&(this._elevationInfoChangeAbortController.abort(),this._elevationInfoChangeAbortController=null)}async elevationInfoChange(){this._abortElevationInfoChange();const e=new AbortController;this._elevationInfoChangeAbortController=e;const t=re(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);this.symbolCreationContext.featureExpressionInfoContext=await se(t,this._viewSpatialReference,e.signal,Ve),y(e.signal),this._elevationInfoChangeAbortController=null,this._labeler?.elevationInfoChange(),this.forEachGraphics3DSymbol(((e,t,i)=>{e.globalPropertyChanged("elevationInfo",t)?t.forEach((e=>{const t=e.graphic,i=e.labelLayers;for(const r of i){r.graphics3DSymbolLayer.updateGraphicElevationContext(t,r)}})):this._recreateSymbol(i)})),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=p(this._stageLayerElevationProvider)):(!this.layer.elevationInfo||this.layer.elevationInfo&&"relative-to-scene"!==this.layer.elevationInfo.mode)&&this._numberOfGraphicsProvidingElevation>0&&(this._stageLayerElevationProvider=new me({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=p(this._stageLayerElevationProvider))}startCreateGraphics(){this._startCreateGraphics=!0,this.recreateAllGraphics()}recreateAllGraphics(){this._recreateAllGraphics(!1)}recreateAllGraphicsAndSymbols(){this._recreateAllGraphics(!0)}_recreateAllGraphics(e=!1){if(!this._startCreateGraphics)return;const{loadedGraphics:t,view:i}=this.owner,r=i.basemapTerrain.tilingScheme&&t&&t.length?t.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 t=this._graphicsBySymbol.get(e),i=[];t&&(t.forEach(((e,t)=>{const r=e.usedMemory;this._conditionalRemove(e,t),this._spatialIndex?.remove(e),i.push(e.graphic),e.destroy(),this._removeGraphics3DGraphic(t,r),this._updateLayerVisibility(),this._featureStore.events.emit("changed")})),this._graphicsBySymbol.set(e,new Map));const r=this._symbols.get(e);h(r),this._symbols.delete(e),this.add(i)}_recreateGraphicsForSymbol(e){const t=this._graphicsBySymbol.get(e);if(t){const e=[];t.forEach((t=>e.push(t.graphic))),this.recreateGraphics(e)}}_conditionalRemove(e,t){this._graphicsDrapedUids.delete(t),this._objectStates?.removeGraphic(e),this._labeler?.removeGraphic(e),this._deconflictor?.removeGraphic(e),null!=this._graphicStateTracking&&this._graphicStateTracking.removeGraphic(e)}add(e){e&&0!==e.length&&(this.owner.view.basemapTerrain&&this.owner.view.basemapTerrain.tilingScheme?(this._updatePolicyForGraphics(e)===fe.ASYNC?this._addDelayed(e):this._addImmediate(e),this.notifyChange("updating")):Ve.error("#add()","Cannot add graphics before terrain surface has been initialized"))}_updatePolicyForGraphics(e){if(this.effectiveUpdatePolicy===fe.SYNC&&("mesh"===this.layer.geometryType||null==this.layer.geometryType))for(const t of e)if(null!=t.geometry&&"mesh"===t.geometry.type&&!t.geometry.loaded)return fe.ASYNC;return this.effectiveUpdatePolicy}_addImmediate(e){this._geometryWarningLogged=!1,this._symbolWarningLogged=!1;for(const t of e)this._addGraphic(t,this._getRenderingInfo(t,Ve),fe.SYNC);this._cleanupSymbols(),this._labeler&&(this.owner.view.labeler.setDirty(),this._cleanupSymbols()),this.owner.view.deconflictor.setDirty()}_addDelayed(e){for(const t of e){const e=t.uid;let i=this._pendingUpdates.get(e);i?i.add?i.state!==Te.NEW&&i.abortController?.abort():this._pendingAdds++:(i=this._pendingUpdatesPool.pushNew(),this._pendingAdds++,this._pendingUpdates.set(e,i)),i.add=t}this.notifyChange("running"),this.notifyChange("updatingRemaining")}remove(e){this.effectiveUpdatePolicy===fe.ASYNC?this._removeDelayed(e):this._removeImmediate(e),this.notifyChange("updating")}_removeImmediate(e){for(const t of e)this._removeGraphic(t);this._cleanupSymbols(),this._labeler&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty()}_removeDelayed(e){for(const t of e){const e=t.uid,i=this._pendingUpdates.get(e);if(i)i.add&&(i.remove?i.add=null:this._pendingUpdates.delete(e),i.state===Te.LOADING&&i.abortController?.abort(),this._pendingAdds--);else{const i=this._pendingUpdatesPool.pushNew();i.remove=t,this._pendingUpdates.set(e,i),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)&&Ve.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[t,i]of this._pendingUpdates){if(e.done){this._applyPendingRemovesFirst=!0;break}if(i.remove&&!i.add&&(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(i.remove),i.remove=null,this._pendingUpdates.delete(t),0===this._pendingRemoves))break}}for(const[t,i]of this._pendingUpdates){if(e.done)break;i.add&&i.state===Te.NEW&&this._processPendingUpdateNew(i);let r=this.effectiveUpdatePolicy;if(!i.remove||i.add&&i.state!==Te.READY||(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(i.remove),i.remove=null,r=fe.SYNC),i.add)switch(i.state){case Te.READY:this._addGraphic(i.add,i.renderingInfo,r),i.add=null,this._pendingAdds--,e.madeProgress();break;case Te.REJECTED:i.add=null,this._pendingAdds--;case Te.LOADING:}null==i.remove&&null==i.add&&this._pendingUpdates.delete(t)}0===this._pendingUpdates.size&&(this._finishPendingUpdates(),this.notifyChange("running"))}_processPendingUpdateNew(e){if(!e.add)return void(e.state=Te.READY);const t=e.add.geometry;null==t||"mesh"!==t.type||t.loaded?this._processPendingUpdateNewRenderingInfo(e):this._processPendingUpdateNewMesh(e,t)}async _processPendingUpdateNewMesh(e,t){e.state=Te.LOADING,e.abortController=new AbortController;const i=e.abortController.signal;try{await t.load({signal:i})}catch(r){return this._processPendingUpdateNewError(e,r)}e.abortController=null,this._processPendingUpdateNewRenderingInfo(e)}_processPendingUpdateNewError(e,t){e.abortController=null,m(t)?e.state=Te.NEW:e.state=Te.REJECTED}async _processPendingUpdateNewRenderingInfo(e){if(null==this.layer.renderer||"dictionary"!==this.layer.renderer.type)return e.renderingInfo=this._getRenderingInfo(e.add,Ve),void(e.state=Te.READY);e.state=Te.LOADING,e.abortController=new AbortController;let t=null;try{t=await this._getRenderingInfoAsync(e.add,{signal:e.abortController.signal})}catch(i){return e.abortController=null,void(m(i)?e.state=Te.NEW:e.state=Te.REJECTED)}null==t||null==t.symbol?(Ve&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,Ve.warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),e.renderingInfo=null):e.renderingInfo=t,e.state=Te.READY}_addGraphic(e,t,i){if(this._graphicsWithoutSymbol.set(e.uid,e),null==t||null==t.symbol||!H(e))return;if(null!=this.stage.renderView.objectAndLayerIdRenderHelper&&this.setUidToIdOnAdd){const t=$(this.owner.view.map,this.layer.uid);this.stage.renderView.objectAndLayerIdRenderHelper.setUidToObjectAndLayerId(e.objectId,e.uid,this.layer.id,this.layer.uid,!!this.layer.popupEnabled&&!t&&Se(this.layer,this.owner.view.popup?.defaultPopupTemplateEnabled))}const r=t.symbol,s=this.getOrCreateGraphics3DSymbol(r,t.renderer);if(null==s)return;this._expandComputedExtent(e.geometry);const a=this._beginGraphicUpdate(e),n=new ne(e,t,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 t=this._createGraphics3DGraphic(s,n);this._spatialIndex&&null!=t&&this._spatialIndex.add(t),--s.referenced,this._endGraphicUpdate(e)}this._featureStore.events.emit("changed"),this._labeler&&this.owner.view.labeler.setDirty()},d=t=>{--this._loadingSymbols,this.destroyed||(this._whenSymbolRemoved.removeUnordered(l),o||(m(t)?this.add([e]):s.destroyed||this._endGraphicUpdate(e)))};++this._loadingSymbols,i===fe.ASYNC?s.load((()=>this._frameTask.schedule(h)),(e=>this._frameTask.schedule((()=>d(e))))):s.load(h,d)}_removeGraphic(e){const t=e.uid,i=this.graphics3DGraphics.get(t);if(i){i.graphics3DSymbol.onRemoveGraphic(i);const e=i.usedMemory,r=i.isElevationSource;this._conditionalRemove(i,t),this._spatialIndex?.remove(i);const s=i.graphics3DSymbol.symbol.id;this._graphicsBySymbol.get(s)?.delete(t),this._graphicsWithoutSymbol.delete(t),this._removeGraphics3DGraphic(t,e,r),i.destroy(),this._featureStore.events.emit("changed")}else this._graphicsWithoutSymbol.delete(t),this._graphicsWaitingForSymbol.delete(t),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("updating"))}_hasLabelingContext(e){if(e instanceof Ie||e instanceof Ee){const t=this.symbolCreationContext.layer;return!!t.labelingInfo&&t.labelingInfo.some((t=>t.symbol===e))}return!1}_hasValidSymbolCreationContext(e){return!(e instanceof Ie&&!this._hasLabelingContext(e))||(Ve.error("LabelSymbol3D is only valid as part of a LabelClass. Using LabelSymbol3D as a renderer symbol is not supported."),!1)}_getRenderingInfo(e,t){const i=e.geometry;if(null==i)return t&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,t.warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!E(i.spatialReference,this._viewSpatialReference))return t&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,t.warn(`Graphic in layer ${this.layer.id} has incompatible spatial reference and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return t&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,t.warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const r=this.rendererHasGeometryOperations?N(e,this.layer):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||Z(r.geometry)}}return null==s||null==s.symbol?(t&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,t.warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),null):s}_getRenderingInfoAsync(e,t){if(null==e.geometry)return Ve&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,Ve.warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return Ve&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,Ve.warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const i=this.rendererHasGeometryOperations?N(e,this.layer):e;return this.owner.getRenderingInfoAsync(i,this.currentRenderer,this._arcadeOnDemand,t)}_createGraphics3DSymbol(e,t){if(!this._hasValidSymbolCreationContext(e))return null;const i=this._getConvertedSymbol(e);if(!i)return null;let r;if(null!=t&&"backgroundFillSymbol"in t&&t.backgroundFillSymbol){const e=J(t.backgroundFillSymbol,{ignoreDrivers:!0});null!=e.symbol&&"web-style"!==e.symbol.type&&"cim"!==e.symbol.type&&(r=e.symbol.symbolLayers)}const s=le(i,this.symbolCreationContext,r);return s.load((()=>{const e=s.extentPadding;e>this.extentPadding&&this._set("extentPadding",e),this.notifyChange("averageSymbolComplexity")}),(()=>{})),s}getOrCreateGraphics3DSymbol(e,t){let i=this._symbols.get(e.id);return void 0===i&&(i=e instanceof Ue?new he(e,(e=>this._frameTask.schedule(e)),(e=>this._createGraphics3DSymbol(e,t))):this._createGraphics3DSymbol(e,t),this._symbols.set(e.id,i)),null!=i&&++i.referenced,i}trackGraphicState(e){return null==this._graphicStateTracking&&(this._graphicStateTracking=new de(this)),this._graphicStateTracking.add(e)}_addGraphics3DGraphic(e){this._usedMemory+=e.usedMemory,this.graphics3DGraphics.set(e.graphic.uid,e),this._numberOfGraphics++,e.isElevationSource&&(this._numberOfGraphicsProvidingElevation++,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_removeGraphics3DGraphic(e,t,i=!1){this._usedMemory-=t,this.graphics3DGraphics.delete(e),this._numberOfGraphics--,i&&(this._numberOfGraphicsProvidingElevation--,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_createGraphics3DGraphic(e,t){const i=t.graphic;if(this._graphicsWithoutSymbol.delete(i.uid),!this._symbols.has(e.symbol.id))return this.add([i]),null;if(this.graphics3DGraphics.has(i.uid))return null;const r=e.createGraphics3DGraphic(t);if(null==r)return null;this._addGraphics3DGraphic(r);const s=e.symbol.id;this._graphicsBySymbol.has(s)||this._graphicsBySymbol.set(s,new Map),this._graphicsBySymbol.get(s).set(i.uid,r);if(r.isDraped&&this._graphicsDrapedUids.add(i.uid),r.centroid=null,null!=i.geometry&&"point"!==i.geometry.type&&(r.centroid=pe(i.geometry,this._viewSpatialReference)),this._updateUserVisibility(r),null!=this._scaleVisibility&&this._scaleVisibility.updateVisibility(r),null!=this._filterVisibility){const{defaultVisibility:e}=this._filterVisibility;r.setVisibilityFlag(te.GRAPHIC,ie.FILTER,e),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[i.uid];return a&&(delete this._whenGraphics3DGraphicRequests[i.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),B(e))if(null!=e&&e.arcadeRequired){const t=new AbortController;this._rendererChangeAbortController=t;const{arcadeUtils:i}=await this._ensureArcade();y(t);const r=i.hasGeometryOperations(e);r&&(await i.enableGeometryOperations(),y(t)),this.effectiveUpdatePolicy===fe.ASYNC?await this._frameTask.schedule((()=>this._currentRendererChange(e,r)),t.signal):this._currentRendererChange(e,r),this._rendererChangeAbortController=null}else if(this.effectiveUpdatePolicy===fe.ASYNC){const t=new AbortController;this._rendererChangeAbortController=t,await this._frameTask.schedule((()=>this._currentRendererChange(e,!1)),t.signal),this._rendererChangeAbortController=null}else this._currentRendererChange(e,!1);else this._currentRendererChange(e,!1)}async _ensureArcade(){return null==this._arcadeOnDemand?(this._arcadeOnDemand=await Y(),this._arcadeOnDemand):this._arcadeOnDemand}_currentRendererChange(e,t){this.currentRenderer=e,this.rendererHasGeometryOperations=t,this.symbolCreationContext.arcade=this._arcadeOnDemand;const i=this.symbolCreationContext.renderer;if(e===i)return;if(this._symbolConversionCache.clear(),null==e)return this.symbolCreationContext.renderer=null,void this.recreateAllGraphicsAndSymbols();const r=G(i,e);this._updateUnchangedSymbolMappings(r,e,i),this.symbolCreationContext.renderer=e,null!=r&&("complete"===r.type?this.recreateAllGraphicsAndSymbols():"partial"===r.type&&(this._applyRendererDiff(r,e,i)?this._labeler?.reset():this.recreateAllGraphicsAndSymbols()),this.notifyChange("averageSymbolComplexity"))}_diffHasSymbolChange(e){for(const t in e.diff)switch(t){case"visualVariables":case"defaultSymbol":case"uniqueValueInfos":break;case"uniqueValueGroups":case"authoringInfo":case"fieldDelimiter":delete e.diff[t];break;default:return!0}return!1}_applySymbolSetDiff(e,t,i){e=e||[],t=t||[];const r=[];for(const s of t){const t=this._graphicsBySymbol.get(s.id);t&&t.forEach(((a,n)=>{const o=a.graphic,l=this.layer instanceof z?this.layer:null,h=this._arcadeOnDemand;if(s===i.defaultSymbol&&i.getSymbol(N(o,l),{arcade:h})===i.defaultSymbol)return;const d=a.usedMemory;e.length||i.defaultSymbol?r.push(o):this._graphicsWithoutSymbol.set(n,o);const p=this.graphics3DGraphics.get(n);this._conditionalRemove(p,n),a.destroy(),t.delete(n),this._removeGraphics3DGraphic(n,d),this._updateLayerVisibility()})),this._whenSymbolRemoved.forAll((e=>e(s.id)))}(e.length||r.length)&&(this._graphicsWithoutSymbol.forEach((e=>r.push(e))),this._graphicsWithoutSymbol.clear(),this.add(r)),this._cleanupSymbols(),this._labeler&&this.owner.view.labeler.setDirty(),this.owner.view.deconflictor.setDirty()}_applyUniqueValueRendererDiff(e,t,i){const r=e.diff.defaultSymbol,a=e.diff.uniqueValueInfos;if(r||a){const n=a?a.added.map((e=>e.symbol)).filter(s):[],o=a?a.removed.map((e=>e.symbol)).filter(s):[];if(a)for(let e=0;e<a.changed.length;e++)n.push(a.changed[e].newValue.symbol),o.push(a.changed[e].oldValue.symbol);return r?(i.defaultSymbol&&o.push(i.defaultSymbol),t.defaultSymbol&&n.push(t.defaultSymbol)):i.defaultSymbol&&n.length&&o.push(t.defaultSymbol),this._applySymbolSetDiff(n,o,t),delete e.diff.defaultSymbol,delete e.diff.uniqueValueInfos,!0}return!1}_calculateUnchangedSymbolMapping(e,t,i){if("unique-value"!==t?.type||"unique-value"!==i?.type||null!=e&&"partial"!==e.type)return[];const r=e=>null!=e?e.id:null,s=e&&e.diff,a=s&&s.defaultSymbol,n=s&&s.uniqueValueInfos;let o;if(n)o=n.unchanged.map((e=>({oldId:r(e.oldValue.symbol),newId:r(e.newValue.symbol)})));else{o=[];for(const e of i.uniqueValueInfos??[]){const i=r(e.symbol),s=t.uniqueValueInfos?.find((t=>t.value===e.value));s&&i!==r(s.symbol)&&o.push({oldId:i,newId:r(s.symbol)})}}return!a&&i.defaultSymbol&&o.push({oldId:r(i.defaultSymbol),newId:r(t.defaultSymbol)}),o}_updateSymbolMapping(e,t){const i=null!=t&&t?"string"==typeof t?t:t.id:null;if(null==e||e===i)return;const r=this._graphicsBySymbol.get(e);this._graphicsBySymbol.delete(e),void 0!==r&&this._graphicsBySymbol.set(i,r);const s=this._symbols.get(e);if(void 0!==s&&(this._symbols.delete(e),this._symbols.set(i,s),null!=s)){const e="string"==typeof t?null:t;null!=e?s.symbol=e:s.symbol.id=i}}_updateUnchangedSymbolMappings(e,t,i){const r=this._calculateUnchangedSymbolMapping(e,t,i);for(const{oldId:s,newId:a}of r)this._updateSymbolMapping(s,a)}_applyRendererDiff(e,i,r){if(this._diffHasSymbolChange(e))return!1;if(i instanceof t&&r instanceof t&&this._applyUniqueValueRendererDiff(e,i,r)&&0===Object.keys(e.diff).length)return!0;for(const[t]of this._graphicsBySymbol){const r=this._symbols.get(t);if(null!=r)switch(r.applyRendererDiff(e,i)){case ce.RecreateSymbol:this._recreateSymbol(t);break;case ce.RecreateGraphics:this._recreateGraphicsForSymbol(t);case ce.FastUpdate:}}return!0}opacityChange(){this.forEachGraphics3DSymbol(((e,t)=>e.globalPropertyChanged("opacity",t))),this._updateStageLayerVisibility()}_slicePlaneEnabledChange(e){e!==this.symbolCreationContext.slicePlaneEnabled&&(this.symbolCreationContext.slicePlaneEnabled=e,this.stageLayer.sliceable=e,this.forEachGraphics3DSymbol(((e,t)=>e.globalPropertyChanged("slicePlaneEnabled",t))),this._deconflictor&&this._deconflictor.slicePlaneEnabledChange(),this._labeler&&this._labeler.slicePlaneEnabledChange())}_physicalBasedRenderingChange(e){this.symbolCreationContext.physicalBasedRenderingEnabled=e,this.forEachGraphics3DSymbol(((e,t,i)=>{e.globalPropertyChanged("physicalBasedRenderingEnabled",t)||this._recreateSymbol(i)}))}_skipHighSymbolLoDsChange(e){this.symbolCreationContext.skipHighSymbolLods=e,this.forEachGraphics3DSymbol(((e,t,i)=>{e.globalPropertyChanged("skipHighSymbolLods",t)||this._recreateSymbol(i)}))}_pixelRatioChange(){this.forEachGraphics3DSymbol(((e,t,i)=>{e.globalPropertyChanged("pixelRatio",t)||this._recreateSymbol(i)}))}_signalUpdatingDuringAsyncLoadedGraphicsChange(){this._updatingPendingLoadedGraphicsChange&&this._updatingPendingLoadedGraphicsChange.remove(),this._updatingPendingLoadedGraphicsChange=C((()=>{this._updatingPendingLoadedGraphicsChange=null}))}setClippingExtent(e,t){const i=this.symbolCreationContext.clippingExtent,r=T();return ue(e,r,t)?this.symbolCreationContext.clippingExtent=V(L(),r):this.symbolCreationContext.clippingExtent=null,!F(this.symbolCreationContext.clippingExtent,i)}modifyGraphics3DGraphicVisibilities(e){if(this.destroyed)return;let t=!1;this.graphics3DGraphics.forEach((i=>{e(i)&&(t=!0)})),t&&(this.owner.view.labeler?.setDirty(),this.owner.view.deconflictor?.setDirty())}forEachGraphics3DSymbol(e){for(const[t,i]of this._symbols){if(null==i)return;e(i,this._graphicsBySymbol.get(t)||He,t)}}updateAllGraphicsVisibility(){null!=this._filterVisibility&&this._filterVisibility.reapply(),this.modifyGraphics3DGraphicVisibilities((e=>{const t=this._updateUserVisibility(e),i=null!=this._scaleVisibility&&this._scaleVisibility.updateVisibility(e);return t||i}))}_hideAllGraphics(){this.modifyGraphics3DGraphicVisibilities((e=>e.setVisibilityFlag(te.GRAPHIC,ie.USER,!1)))}_validateRenderer(e){const t=q(e,{geometryType:this.layer?.geometryType});if(t){const e=`Renderer for layer '${this.layer.title?`${this.layer.title}, `:""}, id:${this.layer.id}' is not supported in a SceneView`;Ve.warn(e,t.message)}}_cleanupSymbols(){if(this._graphicsWaitingForSymbol.size>0||this._suspendSymbolCleanup)return;let e=!1;this._symbols.forEach(((t,i)=>{if(null==t||t.referenced>0)return;const r=this._graphicsBySymbol.get(i);r&&0!==r.size||(this._graphicsBySymbol.delete(i),this._symbols.delete(i),h(t),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 Te;Fe.tmpVec=I(),e([S({readOnly:!0})],Fe.prototype,"computedExtent",void 0),e([S()],Fe.prototype,"currentRenderer",void 0),e([S()],Fe.prototype,"rendererHasGeometryOperations",void 0),e([S()],Fe.prototype,"_frameTask",void 0),e([S({readOnly:!0})],Fe.prototype,"_viewSpatialReference",null),e([S()],Fe.prototype,"_rendererChangeAbortController",void 0),e([S()],Fe.prototype,"_elevationInfoChangeAbortController",void 0),e([S()],Fe.prototype,"_initializeAbortController",void 0),e([S()],Fe.prototype,"_elevationAlignment",void 0),e([S()],Fe.prototype,"_scaleVisibility",void 0),e([S()],Fe.prototype,"_filterVisibility",void 0),e([S()],Fe.prototype,"_initializePromise",void 0),e([S()],Fe.prototype,"_spatialIndex",void 0),e([S({readOnly:!0})],Fe.prototype,"extentPadding",void 0),e([S()],Fe.prototype,"_updatingPendingLoadedGraphicsChange",void 0),e([S()],Fe.prototype,"_featureStore",void 0),e([S()],Fe.prototype,"_deconflictor",void 0),e([S()],Fe.prototype,"_labeler",void 0),e([S()],Fe.prototype,"_objectStates",void 0),e([S()],Fe.prototype,"_loadingSymbols",void 0),e([S()],Fe.prototype,"preferredUpdatePolicy",void 0),e([S()],Fe.prototype,"_forcedUpdatePolicy",void 0),e([S({readOnly:!0})],Fe.prototype,"effectiveUpdatePolicy",null),e([S({constructOnly:!0})],Fe.prototype,"elevationFeatureExpressionEnabled",void 0),e([S({constructOnly:!0})],Fe.prototype,"owner",void 0),e([S({constructOnly:!0})],Fe.prototype,"layer",void 0),e([S({constructOnly:!0})],Fe.prototype,"graphicSymbolSupported",void 0),e([S({constructOnly:!0})],Fe.prototype,"getRenderingInfoWithoutRenderer",void 0),e([S({constructOnly:!0})],Fe.prototype,"componentFactories",void 0),e([S({constructOnly:!0})],Fe.prototype,"setUidToIdOnAdd",void 0),e([S()],Fe.prototype,"featureStore",null),e([S()],Fe.prototype,"initializePromise",null),e([S()],Fe.prototype,"scaleVisibility",null),e([S()],Fe.prototype,"elevationAlignment",null),e([S()],Fe.prototype,"objectStates",null),e([S()],Fe.prototype,"filterVisibility",null),e([S({readOnly:!0})],Fe.prototype,"updating",null),e([S({readOnly:!0})],Fe.prototype,"running",null),e([S({readOnly:!0})],Fe.prototype,"suspendedOrOutsideOfView",null),e([S({readOnly:!0,dependsOn:[]})],Fe.prototype,"updatingRemaining",null),e([S({readOnly:!0})],Fe.prototype,"displayFeatureLimit",null),e([S({readOnly:!0,dependsOn:[]})],Fe.prototype,"averageSymbolComplexity",null),e([S({constructOnly:!0})],Fe.prototype,"hasZ",void 0),e([S({constructOnly:!0})],Fe.prototype,"hasM",void 0),e([S()],Fe.prototype,"_objectIdField",null),Fe=je=e([w(Oe)],Fe),function(e){e[e.NEW=0]="NEW",e[e.LOADING=1]="LOADING",e[e.READY=2]="READY",e[e.REJECTED=3]="REJECTED"}(Te||(Te={}));class ke{constructor(){this.add=null,this.renderingInfo=null,this.state=Te.NEW,this.abortController=null,this.remove=null}clear(){this.add=null,this.renderingInfo=null,this.state=Te.NEW,this.abortController=null,this.remove=null}}const ze=10,Me=I(),We=I(),He=new Map;export{Fe 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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/has.js";import e from"../../../../core/Error.js";import{clone as t}from"../../../../core/lang.js";import{getMetersPerVerticalUnitForSR as s}from"../../../../core/unitUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{n}from"../../../../chunks/mat3.js";import{a as i}from"../../../../chunks/mat3f64.js";import{i as o,p as a}from"../../../../chunks/mat4.js";import{a as l}from"../../../../chunks/mat4f64.js";import{c,n as m,s as h,f as p,b as g,e as d}from"../../../../chunks/vec3.js";import{e as u,c as f}from"../../../../chunks/vec3f64.js";import{computeTranslationToOriginAndRotation as y}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as b,empty as _,expandWithBuffer as j,intersectsClippingArea as x}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as P}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as S,getZeroIndexArray as w}from"../../../../geometry/support/Indices.js";import{t as E}from"../../../../chunks/vec32.js";import{makeVertexCandidate as v,makeEdgeCandidate as C}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as L}from"../../../../renderers/support/renderingInfoUtils.js";import{ViewingMode as M}from"../../../ViewingMode.js";import{needsElevationUpdates3D as I,SampleElevationInfo as A}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as O}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as z}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as B,computeCentroid as D}from"./graphicUtils.js";import{ApplyRendererDiffResult as G}from"./interfaces.js";import{geometryAsPolygon as R}from"./polygonUtils.js";import{createMaterial as U}from"../support/edgeUtils.js";import{debugFlags as T}from"../../support/debugFlags.js";import{SamplePosition as k}from"../../support/ElevationProvider.js";import{geometryToRenderInfo as V}from"../../support/renderInfoUtils/polygon.js";import{NormalType as N}from"../../webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{Attribute as H}from"../../webgl-engine/lib/Attribute.js";import{CullFaceOptions as F}from"../../webgl-engine/lib/basicInterfaces.js";import{ContentObjectType as W}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as q}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as Z}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{compressNormals as J}from"../../webgl-engine/lib/Normals.js";import{Object3D as K}from"../../webgl-engine/lib/Object3D.js";import{VertexAttribute as Q}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as X}from"../../webgl-engine/materials/DefaultMaterial.js";const Y=["polygon","extent"];class $ extends z{constructor(e,t,s,r){super(e,t,s,r),this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=B(this._getSymbolSize());if(t)throw new e("graphics3dextrudesymbollayer:invalid-size",t)}const t=this.symbolLayer?.material?.color,s=this._getCombinedOpacityAndColor(t),r=u(s),n=s[3],i=n<1||this.needsDrivenTransparentPass,o={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,diffuse:r,ambient:r,opacity:n,transparent:i,cullFace:i?F.None:F.Back,hasVertexColors:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0,normalType:N.Compressed};this._materials[je.Main]=new X(o),this._materials[je.Bottom]=new X({...o,cullFace:F.Back}),this._context.stage.addMany(this._materials)}destroy(){super.destroy(),this._context.stage.removeMany(this._materials),this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Y,this.symbolLayer.type))return null;const s=this._getVertexOpacityAndColor(e.renderingInfo,255),r=this.setGraphicElevationContext(t);return this._createAs3DShape(t,e.renderingInfo,s,r,t.uid)}layerOpacityChanged(e,t){const s=this.symbolLayer?.material?.color,r=this._getCombinedOpacity(s),n=r<1||this.needsDrivenTransparentPass;this._materials[je.Main]?.setParameters({opacity:r,transparent:n}),this._materials[je.Bottom]?.setParameters({opacity:r,transparent:n});const i=this._getLayerOpacity();e.forEach((e=>{const s=t(e);null!=s&&s.layerOpacityChanged(i,this._context.isAsync)}))}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,I)}slicePlaneEnabledChanged(e,t){return this._materials[je.Main]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[je.Bottom]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),e.forEach((e=>{const s=t(e);null!=s&&s.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)})),!0}physicalBasedRenderingChanged(){const e={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0};return this._materials[je.Main]?.setParameters(e),this._materials[je.Bottom]?.setParameters(e),!0}_getExtrusionSize(e){let t;return t=e.size&&this._drivenProperties.size?L(e.size,2)??0:this._getSymbolSize(),t/=this._context.renderCoordsHelper.unitInMeters,t}applyRendererDiff(e,t){return this._drivenPropertiesChanged(t)?G.RecreateSymbol:G.RecreateGraphics}async queryForSnapping(e,r,n,i){const o=this._getExtrusionSize(n)*this._context.renderCoordsHelper.unitInMeters/s(r),{objectId:a,target:l}=e,c=t(l);switch(c.z=(c.z??0)+o,e.type){case"edge":{const{start:s,end:r}=e,n=t(s),i=t(r);return n.z=(n.z??0)+o,i.z=(i.z??0)+o,[C(a,c,1/0,n,i)]}case"vertex":return[v(a,c,1/0),C(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(e,t,s,a,c){const m=R(e.geometry);if(null==m)return null;if(0===m.rings.length||!m.rings.some((e=>e.length>0)))return this._logGeometryValidationWarnings(m.rings,"rings","ExtrudeSymbol3DLayer"),null;const h=V(m,this._context.elevationProvider,this._context.renderCoordsHelper,a);this._logGeometryCreationWarnings(h,m.rings,"rings","ExtrudeSymbol3DLayer");const p=D(m);if(null==p)return null;const g=new Array,d=new Array,u=b(),w=l(),v=f(),C=this._context.renderCoordsHelper.viewingMode===M.Global;C||this._context.renderCoordsHelper.worldUpAtPosition(null,v),y(m.spatialReference,[p.x,p.y,0],w,this._context.renderCoordsHelper.spatialReference);const L=l();o(L,w);const A=i();n(A,L);const{polygons:z,mapPositions:B,position:G}=h;for(const n of z){const e=n.count;if(this._context.clippingExtent&&(_(u),j(u,n.mapPositions),!x(u,this._context.clippingExtent)))continue;const i=r(n.mapPositions,n.holeIndices,3);if(0===i.length)continue;const o=i.length,a=6*e,l=S(a+o),m=S(o),h=P(3*a),p=P(3*a),f=P(3*a),y=P(a);te(G,B,i,n,h,f,p,y,l,m,this._getExtrusionSize(t),v,C),E(h,h,L);const b=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:c,layerUid:this._context.layer.uid}),w=new xe(h,f,J(p),y);g.push(ee(this._materials[je.Main],l,l.length-m.length,w,s,b),ee(this._materials[je.Bottom],m,0,w,s,b)),d.push(w.heights)}if(0===g.length)return null;const T=new K({geometries:g,layerUid:this._context.layer.uid,graphicUid:c,isElevationSource:!0});T.transformation=w;const k=U(this.symbolLayer,{opacity:this._getLayerOpacity()}),N=null!=k?{baseMaterial:this._materials[je.Main],edgeMaterials:[k],properties:{mergeGeometries:!0,hasSlicePlane:this._context.slicePlaneEnabled}}:null,H=new O(this,T,g,null,null,((e,t,s,r,n)=>ge(e,t,s,r,n,d)),a,N);return H.alignedSampledElevation=h.sampledElevation,H.needsElevationUpdates=I(a.mode),H}}function ee(e,t,s,r,n,i){const o=w(t.length),a=[[Q.POSITION,new H(r.positions,t,3,!0)],[Q.NORMALCOMPRESSED,new H(r.normals,t,2,!0)],[Q.COLOR,new H(n,o,4,!0)]];return new q(e,a,r.elevation,W.Mesh,i,s)}function te(e,t,s,r,n,i,o,a,l,c,m,h,p){const g=s.length/3;let d=0,u=2*r.count;se(e,t,r.index,r.count,s,0,g,n,i,o,a,l,c,u,m,h,p);let f=2*r.count;u=0,ie(n,i,a,o,d,r.pathLengths[0],r.count,f,l,u,m),f+=4*r.pathLengths[0],u+=2*r.pathLengths[0],d+=r.pathLengths[0];for(let y=1;y<r.pathLengths.length;++y)ie(n,i,a,o,d,r.pathLengths[y],r.count,f,l,u,m),f+=4*r.pathLengths[y],u+=2*r.pathLengths[y],d+=r.pathLengths[y]}function se(e,t,s,r,n,i,o,a,l,h,p,g,d,u,f,y,b){c(ue,y);const _=f>0?1:-1;let j=3*s,x=0,P=3*x,S=r,w=3*S;for(let c=0;c<r;++c)b&&(ue[0]=e[j],ue[1]=e[j+1],ue[2]=e[j+2],m(ue,ue)),a[P]=e[j],a[P+1]=e[j+1],a[P+2]=e[j+2],l[P]=t[j],l[P+1]=t[j+1],l[P+2]=t[j+2],h[P]=-_*ue[0],h[P+1]=-_*ue[1],h[P+2]=-_*ue[2],p[x]=0,a[w]=e[j]+f*ue[0],a[w+1]=e[j+1]+f*ue[1],a[w+2]=e[j+2]+f*ue[2],l[w]=t[j],l[w+1]=t[j+1],l[w+2]=t[j+2],h[w]=_*ue[0],h[w+1]=_*ue[1],h[w+2]=_*ue[2],p[S]=f,P+=3,w+=3,j+=3,x+=1,S+=1;j=3*i,P=0,w=3*u;const E=f<0?be:ye,v=f<0?ye:be;for(let c=0;c<o;++c)d[P]=n[j+E[0]],d[P+1]=n[j+E[1]],d[P+2]=n[j+E[2]],g[w]=n[j+v[0]]+r,g[w+1]=n[j+v[1]]+r,g[w+2]=n[j+v[2]]+r,P+=3,w+=3,j+=3}function re(e,t,s,r,n,i,o){r[i]=r[o],o*=3,e[i*=3]=e[o],e[i+1]=e[o+1],e[i+2]=e[o+2],t[i]=t[o],t[i+1]=t[o+1],t[i+2]=t[o+2],s[i]=n[0],s[i+1]=n[1],s[i+2]=n[2]}const ne=f();function ie(e,t,s,r,n,i,o,a,l,c,m){let h=n,p=n+1,g=n+o,d=n+o+1,u=a,f=a+1,y=a+2*i,b=a+2*i+1;m<0&&(h=n+o+1,d=n),c*=3;for(let _=0;_<i;++_)_===i-1&&(m>0?(p=n,d=n+o):(p=n,h=n+o)),he(e,h,p,g,ne),re(e,t,r,s,ne,u,h),re(e,t,r,s,ne,f,p),re(e,t,r,s,ne,y,g),re(e,t,r,s,ne,b,d),l[c++]=u,l[c++]=y,l[c++]=b,l[c++]=u,l[c++]=b,l[c++]=f,h++,p++,g++,d++,u+=2,f+=2,y+=2,b+=2}const oe=f(),ae=f(),le=f(),ce=f(),me=f();function he(e,t,s,r,n){t*=3,s*=3,r*=3,h(oe,e[t++],e[t++],e[t++]),h(ae,e[s++],e[s++],e[s++]),h(le,e[r++],e[r++],e[r++]),p(ce,ae,oe),p(me,le,oe),g(n,me,ce),m(n,n)}const pe=f();function ge(e,t,s,r,n,i){const o=e.stageObject,c=o.geometries,m=c.length,p="absolute-height"!==t.mode;let g=0;const u=o.transformation,f=a(l(),u);for(let a=0;a<m;a+=2){const e=c[a];if(!Z(e))continue;const t=e.getMutableAttribute(Q.POSITION).data,l=i[a/2],m=new k(e.mapPositions),y=t.length/3;let b=0,_=!1,j=0;for(let i=0;i<y;i++){pe[0]=t[b],pe[1]=t[b+1],pe[2]=t[b+2],r(m,fe),p&&(j+=fe.sampledElevation),T.TESTS_DISABLE_OPTIMIZATIONS?(h(de,m.array[m.offset],m.array[m.offset+1],fe.z+l[b/3]),null!=s&&n.toRenderCoords(de,s,de),d(de,de,f)):(h(de,t[b],t[b+1],t[b+2]),d(de,de,u),n.setAltitude(de,fe.z+l[b/3]),d(de,de,f)),t[b]=de[0],t[b+1]=de[1],t[b+2]=de[2];const e=_e/n.unitInMeters;(Math.abs(pe[0]-t[b])>=e||Math.abs(pe[1]-t[b+1])>=e||Math.abs(pe[2]-t[b+2])>=e)&&(_=!0),m.offset+=3,b+=3}_&&(e.invalidateBoundingInfo(),o.geometryVertexAttrsUpdated(c[a]),c[a+1].invalidateBoundingInfo(),o.geometryVertexAttrsUpdated(c[a+1])),g+=j/y}return g/m}const de=f(),ue=f(),fe=new A,ye=[0,2,1],be=[0,1,2],_e=.01;var je;!function(e){e[e.Main=0]="Main",e[e.Bottom=1]="Bottom"}(je||(je={}));class xe{constructor(e,t,s,r){this.positions=e,this.elevation=t,this.normals=s,this.heights=r}}export{$ as Graphics3DExtrudeSymbolLayer};
|
|
5
|
+
import"../../../../core/has.js";import e from"../../../../core/Error.js";import{clone as t}from"../../../../core/lang.js";import{getMetersPerVerticalUnitForSR as s}from"../../../../core/unitUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{n}from"../../../../chunks/mat3.js";import{a as i}from"../../../../chunks/mat3f64.js";import{i as o,p as a}from"../../../../chunks/mat4.js";import{a as l}from"../../../../chunks/mat4f64.js";import{c,n as m,s as h,f as p,b as g,e as d}from"../../../../chunks/vec3.js";import{e as u,c as f}from"../../../../chunks/vec3f64.js";import{computeTranslationToOriginAndRotation as y}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as b,empty as _,expandWithBuffer as j,intersectsClippingArea as x}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as P}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as S,getZeroIndexArray as w}from"../../../../geometry/support/Indices.js";import{t as E}from"../../../../chunks/vec32.js";import{makeVertexCandidate as v,makeEdgeCandidate as I}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as C}from"../../../../renderers/support/renderingInfoUtils.js";import{ViewingMode as L}from"../../../ViewingMode.js";import{needsElevationUpdates3D as M,SampleElevationInfo as O}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as A}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as z}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as B,computeCentroid as D}from"./graphicUtils.js";import{ApplyRendererDiffResult as G}from"./interfaces.js";import{geometryAsPolygon as R}from"./polygonUtils.js";import{createMaterial as T}from"../support/edgeUtils.js";import{debugFlags as U}from"../../support/debugFlags.js";import{SamplePosition as k}from"../../support/ElevationProvider.js";import{geometryToRenderInfo as N}from"../../support/renderInfoUtils/polygon.js";import{NormalType as V}from"../../webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{Attribute as H}from"../../webgl-engine/lib/Attribute.js";import{CullFaceOptions as F}from"../../webgl-engine/lib/basicInterfaces.js";import{ContentObjectType as W}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as q}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as Z}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{compressNormals as J}from"../../webgl-engine/lib/Normals.js";import{Object3D as K}from"../../webgl-engine/lib/Object3D.js";import{VertexAttribute as Q}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as X}from"../../webgl-engine/materials/DefaultMaterial.js";const Y=["polygon","extent"];class $ extends z{constructor(e,t,s,r){super(e,t,s,r),this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=B(this._getSymbolSize());if(t)throw new e("graphics3dextrudesymbollayer:invalid-size",t)}const t=this.symbolLayer?.material?.color,s=this._getCombinedOpacityAndColor(t),r=u(s),n=s[3],i=n<1||this.needsDrivenTransparentPass,o={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,diffuse:r,ambient:r,opacity:n,transparent:i,cullFace:i?F.None:F.Back,hasVertexColors:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0,normalType:V.Compressed};this._materials[je.Main]=new X(o),this._materials[je.Bottom]=new X({...o,cullFace:F.Back}),this._context.stage.addMany(this._materials)}destroy(){super.destroy(),this._context.stage.removeMany(this._materials),this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Y,this.symbolLayer.type))return null;const s=this._getVertexOpacityAndColor(e.renderingInfo,255),r=this.setGraphicElevationContext(t);return this._createAs3DShape(t,e.renderingInfo,s,r,t.uid)}layerOpacityChanged(e,t){const s=this.symbolLayer?.material?.color,r=this._getCombinedOpacity(s),n=r<1||this.needsDrivenTransparentPass;this._materials[je.Main]?.setParameters({opacity:r,transparent:n}),this._materials[je.Bottom]?.setParameters({opacity:r,transparent:n});const i=this._getLayerOpacity();e.forEach((e=>{const s=t(e);null!=s&&s.layerOpacityChanged(i,this._context.isAsync)}))}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,M)}slicePlaneEnabledChanged(e,t){return this._materials[je.Main]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[je.Bottom]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),e.forEach((e=>{const s=t(e);null!=s&&s.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)})),!0}physicalBasedRenderingChanged(){const e={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0};return this._materials[je.Main]?.setParameters(e),this._materials[je.Bottom]?.setParameters(e),!0}_getExtrusionSize(e){let t;return t=e.size&&this._drivenProperties.size?C(e.size,2)??0:this._getSymbolSize(),t/=this._context.renderCoordsHelper.unitInMeters,t}applyRendererDiff(e,t){return this._drivenPropertiesChanged(t)?G.RecreateSymbol:G.RecreateGraphics}async queryForSnapping(e,r,n,i){const o=this._getExtrusionSize(n)*this._context.renderCoordsHelper.unitInMeters/s(r),{objectId:a,target:l}=e,c=t(l);switch(c.z=(c.z??0)+o,e.type){case"edge":{const{start:s,end:r}=e,n=t(s),i=t(r);return n.z=(n.z??0)+o,i.z=(i.z??0)+o,[I(a,c,1/0,n,i)]}case"vertex":return[v(a,c,1/0),I(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(e,t,s,a,c){const m=R(e.geometry);if(null==m)return null;if(0===m.rings.length||!m.rings.some((e=>e.length>0)))return this._logGeometryValidationWarnings(m.rings,"rings","ExtrudeSymbol3DLayer"),null;const h=N(m,this._context.elevationProvider,this._context.renderCoordsHelper,a);this._logGeometryCreationWarnings(h,m.rings,"rings","ExtrudeSymbol3DLayer");const p=D(m);if(null==p)return null;const g=new Array,d=new Array,u=b(),w=l(),v=f(),I=this._context.renderCoordsHelper.viewingMode===L.Global;I||this._context.renderCoordsHelper.worldUpAtPosition(null,v),y(m.spatialReference,[p.x,p.y,0],w,this._context.renderCoordsHelper.spatialReference);const C=l();o(C,w);const O=i();n(O,C);const{polygons:z,mapPositions:B,position:G}=h;for(const n of z){const e=n.count;if(this._context.clippingExtent&&(_(u),j(u,n.mapPositions),!x(u,this._context.clippingExtent)))continue;const i=r(n.mapPositions,n.holeIndices,3);if(0===i.length)continue;const o=i.length,a=6*e,l=S(a+o),m=S(o),h=P(3*a),p=P(3*a),f=P(3*a),y=P(a);te(G,B,i,n,h,f,p,y,l,m,this._getExtrusionSize(t),v,I),E(h,h,C);const b=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:c,layerUid:this._context.layer.uid}),w=new xe(h,f,J(p),y);g.push(ee(this._materials[je.Main],l,l.length-m.length,w,s,b),ee(this._materials[je.Bottom],m,0,w,s,b)),d.push(w.heights)}if(0===g.length)return null;const U=new K({geometries:g,layerUid:this._context.layer.uid,graphicUid:c,isElevationSource:!0});U.transformation=w;const k=T(this.symbolLayer,{opacity:this._getLayerOpacity()}),V=null!=k?{baseMaterial:this._materials[je.Main],edgeMaterials:[k],properties:{mergeGeometries:!0,hasSlicePlane:this._context.slicePlaneEnabled}}:null,H=new A(this,U,g,null,null,((e,t,s,r,n)=>ge(e,t,s,r,n,d)),a,V);return H.alignedSampledElevation=h.sampledElevation,H.needsElevationUpdates=M(a.mode),H}}function ee(e,t,s,r,n,i){const o=w(t.length),a=[[Q.POSITION,new H(r.positions,t,3,!0)],[Q.NORMALCOMPRESSED,new H(r.normals,t,2,!0)],[Q.COLOR,new H(n,o,4,!0)]];return new q(e,a,r.elevation,W.Mesh,i,s)}function te(e,t,s,r,n,i,o,a,l,c,m,h,p){const g=s.length/3;let d=0,u=2*r.count;se(e,t,r.index,r.count,s,0,g,n,i,o,a,l,c,u,m,h,p);let f=2*r.count;u=0,ie(n,i,a,o,d,r.pathLengths[0],r.count,f,l,u,m),f+=4*r.pathLengths[0],u+=2*r.pathLengths[0],d+=r.pathLengths[0];for(let y=1;y<r.pathLengths.length;++y)ie(n,i,a,o,d,r.pathLengths[y],r.count,f,l,u,m),f+=4*r.pathLengths[y],u+=2*r.pathLengths[y],d+=r.pathLengths[y]}function se(e,t,s,r,n,i,o,a,l,h,p,g,d,u,f,y,b){c(ue,y);const _=f>0?1:-1;let j=3*s,x=0,P=3*x,S=r,w=3*S;for(let c=0;c<r;++c)b&&(ue[0]=e[j],ue[1]=e[j+1],ue[2]=e[j+2],m(ue,ue)),a[P]=e[j],a[P+1]=e[j+1],a[P+2]=e[j+2],l[P]=t[j],l[P+1]=t[j+1],l[P+2]=t[j+2],h[P]=-_*ue[0],h[P+1]=-_*ue[1],h[P+2]=-_*ue[2],p[x]=0,a[w]=e[j]+f*ue[0],a[w+1]=e[j+1]+f*ue[1],a[w+2]=e[j+2]+f*ue[2],l[w]=t[j],l[w+1]=t[j+1],l[w+2]=t[j+2],h[w]=_*ue[0],h[w+1]=_*ue[1],h[w+2]=_*ue[2],p[S]=f,P+=3,w+=3,j+=3,x+=1,S+=1;j=3*i,P=0,w=3*u;const E=f<0?be:ye,v=f<0?ye:be;for(let c=0;c<o;++c)d[P]=n[j+E[0]],d[P+1]=n[j+E[1]],d[P+2]=n[j+E[2]],g[w]=n[j+v[0]]+r,g[w+1]=n[j+v[1]]+r,g[w+2]=n[j+v[2]]+r,P+=3,w+=3,j+=3}function re(e,t,s,r,n,i,o){r[i]=r[o],o*=3,e[i*=3]=e[o],e[i+1]=e[o+1],e[i+2]=e[o+2],t[i]=t[o],t[i+1]=t[o+1],t[i+2]=t[o+2],s[i]=n[0],s[i+1]=n[1],s[i+2]=n[2]}const ne=f();function ie(e,t,s,r,n,i,o,a,l,c,m){let h=n,p=n+1,g=n+o,d=n+o+1,u=a,f=a+1,y=a+2*i,b=a+2*i+1;m<0&&(h=n+o+1,d=n),c*=3;for(let _=0;_<i;++_)_===i-1&&(m>0?(p=n,d=n+o):(p=n,h=n+o)),he(e,h,p,g,ne),re(e,t,r,s,ne,u,h),re(e,t,r,s,ne,f,p),re(e,t,r,s,ne,y,g),re(e,t,r,s,ne,b,d),l[c++]=u,l[c++]=y,l[c++]=b,l[c++]=u,l[c++]=b,l[c++]=f,h++,p++,g++,d++,u+=2,f+=2,y+=2,b+=2}const oe=f(),ae=f(),le=f(),ce=f(),me=f();function he(e,t,s,r,n){t*=3,s*=3,r*=3,h(oe,e[t++],e[t++],e[t++]),h(ae,e[s++],e[s++],e[s++]),h(le,e[r++],e[r++],e[r++]),p(ce,ae,oe),p(me,le,oe),g(n,me,ce),m(n,n)}const pe=f();function ge(e,t,s,r,n,i){const o=e.stageObject,c=o.geometries,m=c.length,p="absolute-height"!==t.mode;let g=0;const u=o.transformation,f=a(l(),u);for(let a=0;a<m;a+=2){const e=c[a];if(!Z(e))continue;const t=e.getMutableAttribute(Q.POSITION).data,l=i[a/2],m=new k(e.mapPositions),y=t.length/3;let b=0,_=!1,j=0;for(let i=0;i<y;i++){pe[0]=t[b],pe[1]=t[b+1],pe[2]=t[b+2],r(m,fe),p&&(j+=fe.sampledElevation),U.TESTS_DISABLE_OPTIMIZATIONS?(h(de,m.array[m.offset],m.array[m.offset+1],fe.z+l[b/3]),null!=s&&n.toRenderCoords(de,s,de),d(de,de,f)):(h(de,t[b],t[b+1],t[b+2]),d(de,de,u),n.setAltitude(de,fe.z+l[b/3]),d(de,de,f)),t[b]=de[0],t[b+1]=de[1],t[b+2]=de[2];const e=_e/n.unitInMeters;(Math.abs(pe[0]-t[b])>=e||Math.abs(pe[1]-t[b+1])>=e||Math.abs(pe[2]-t[b+2])>=e)&&(_=!0),m.offset+=3,b+=3}_&&(e.invalidateBoundingInfo(),o.geometryVertexAttributeUpdated(c[a],Q.POSITION),c[a+1].invalidateBoundingInfo(),o.geometryVertexAttributeUpdated(c[a+1],Q.POSITION)),g+=j/y}return g/m}const de=f(),ue=f(),fe=new O,ye=[0,2,1],be=[0,1,2],_e=.01;var je;!function(e){e[e.Main=0]="Main",e[e.Bottom=1]="Bottom"}(je||(je={}));class xe{constructor(e,t,s,r){this.positions=e,this.elevation=t,this.normals=s,this.heights=r}}export{$ 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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import"../../../../core/has.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{f as r,t as o}from"../../../../chunks/mat3.js";import{a}from"../../../../chunks/mat3f64.js";import{d as s,m as n,i}from"../../../../chunks/mat4.js";import{a as l,I as c,b as u}from"../../../../chunks/mat4f64.js";import{s as m,g as h,i as f,j as p,n as d,f as g,b as x}from"../../../../chunks/vec3.js";import{Z as _,O as T,c as y}from"../../../../chunks/vec3f64.js";import{O as b}from"../../../../chunks/vec4f64.js";import{canProjectWithoutEngine as v}from"../../../../geometry/projection.js";import{computeTranslationToOriginAndRotation as C}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as j}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToDehydratedPoint as w}from"../../../../geometry/projection/projectVectorToDehydratedPoint.js";import{create as M,empty as O,expandWithBuffer as P,intersectsClippingArea as R}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as A}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as E,getZeroIndexArray as I}from"../../../../geometry/support/Indices.js";import N from"../../../../geometry/support/MeshComponent.js";import B from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import F from"../../../../geometry/support/MeshTextureTransform.js";import{t as S,a as U}from"../../../../chunks/vec32.js";import{project as L}from"../../../../geometry/support/meshUtils/georeference.js";import{transformNormal as $,projectNormalToPCPF as G,transformTangent as V,projectTangentToPCPF as D}from"../../../../geometry/support/meshUtils/projection.js";import{makeDehydratedPoint as k}from"../../../../layers/graphics/dehydratedPoint.js";import{MeshTransformUpdateAction as H}from"../../../../layers/graphics/sources/interfaces.js";import{ViewingMode as q}from"../../../ViewingMode.js";import{isEncodedMeshTexture as W}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as z}from"../../glTF/internal/TextureTransformUtils.js";import{perObjectElevationAligner as Y}from"./ElevationAligners.js";import{needsElevationUpdates3D as Z,evaluateElevationInfoAtPoint as J}from"./elevationAlignmentUtils.js";import{Graphics3DMeshObject3DGraphicLayer as K}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as Q}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as X}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as ee,MeshFastUpdateProcessor as te}from"./MeshFastUpdateProcessor.js";import{createMaterial as re}from"../support/edgeUtils.js";import{parseColorMixMode as oe,encodeSymbolColor as ae}from"../support/symbolColorUtils.js";import{debugFlags as se}from"../../support/debugFlags.js";import{Attribute as ne}from"../../webgl-engine/lib/Attribute.js";import{AlphaDiscardMode as ie,CullFaceOptions as le}from"../../webgl-engine/lib/basicInterfaces.js";import{ContentObjectType as ce}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as ue}from"../../webgl-engine/lib/Geometry.js";import{Object3D as me}from"../../webgl-engine/lib/Object3D.js";import{Texture as he}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as fe}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as pe}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as de}from"../../webgl-engine/materials/NativeLineMaterial.js";import{useSchematicPBR as ge,defaultSchematicMRRFactors as xe,defaultAdvancedMRRFactors as _e}from"../../webgl-engine/materials/pbrUtils.js";import{TextureWrapMode as Te}from"../../../webgl/enums.js";const ye=["mesh"];class be extends X{constructor(e,t,r,o){super(e,t,r,o),this._materialInfoCache=new ee,this._fastUpdateProcessor=new te,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){se.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new de({color:[1,0,1,1]}),this._debugFaceNormalMaterial=new de({color:[0,1,1,1]}))}destroy(){super.destroy(),this._textures.forEach((e=>e.unload())),this._context.stage.removeMany(this._materialInfoCache.materials),this._context.stage.removeMany(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy(this._context.stage)}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,ye,"fill on mesh-3d"))return null;const r=this.setGraphicElevationContext(t),o=e.renderingInfo;return this._createAs3DShape(t,o,r,t.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache,this._context)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._updateMaterialParameters((e=>{e.material.setParameters({layerOpacity:r});const t=e.material.parameters;this._setMaterialTransparentParameter(t,e),e.material.setParameters({transparent:t.transparent})})),e.forEach((e=>t(e)?.layerOpacityChanged(r,this._context.isAsync)))}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,Z)}slicePlaneEnabledChanged(e,t){return this._updateMaterialParameters((({material:e})=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),e.forEach((e=>t(e)?.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync))),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._updateMaterialParameters((({material:t})=>t.setParameters({usePBR:e}))),!0}updateTransform(e,t,r,o){const a=this._context.renderCoordsHelper.spatialReference,s=Ae,{origin:n,transform:i}=r;switch(C(t,m(je,n.x,n.y,n.z??0),s,a),o){case H.EnableFastUpdates:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case H.DisableFastUpdates:this._fastUpdateProcessor.disable(e,this._materialInfoCache,this._context);break;case H.UpdateFastLocalOrigin:e.updateFastLocalOrigin(s,i,this._context.localOriginFactory)}const{elevationContext:l}=e;l.centerPointInElevationSR=this._getCenterPointInElevationSR(s);const{elevationProvider:c,renderCoordsHelper:u}=this._context,h=(e,t)=>J(e,c,l,u,t);return e.alignedSampledElevation=Y(e,l,c.spatialReference,h,u,s),e.updateTransform(s,i,this._context.isAsync),!0}_requiresSymbolVertexColors(){return this._drivenProperties.color||this._drivenProperties.opacity}_colorOrTextureUid(t){return null==t?"-":t instanceof e?t.toHex():t.contentHash}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),o=!!e.vertexAttributes.color,a=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:o,hasVertexTangents:a,uid:`vc:${o},vt:${a},vct${t},svc:${r}`}}_textureTransformUid(e){const{offset:t,scale:r,rotation:o}=e??Ne;return`${t[0]},${t[1]},${o},${r[0]},${r[1]}`}_materialProperties(e,t,r){const o=this._materialPropertiesDefault(e,r);if(!t.material)return o;const{color:a,colorTexture:s,colorTextureTransform:n,normalTexture:i,normalTextureTransform:l,doubleSided:c,alphaCutoff:u,alphaMode:m}=t.material,h=this._colorOrTextureUid(a),f=this._colorOrTextureUid(s),p=this._textureTransformUid(n),d=this._colorOrTextureUid(i),g=this._textureTransformUid(l);if(o.color=a,o.colorTexture=s,o.normalTexture=i,o.uid=`${o.uid},cmuid:${h},ctmuid:${f},cttuid:${p},ntmuid:${d},nttuid:${g},ds:${c},ac:${u},am:${m}`,t.material instanceof B){const{metallic:e,roughness:r,metallicRoughnessTexture:a,metallicRoughnessTextureTransform:s,emissiveColor:i,emissiveTexture:c,emissiveTextureTransform:u,occlusionTexture:m,occlusionTextureTransform:h}=t.material,f=this._colorOrTextureUid(a),p=this._textureTransformUid(s),d=this._colorOrTextureUid(i),g=this._colorOrTextureUid(c),x=this._textureTransformUid(u),_=this._colorOrTextureUid(m),T=this._textureTransformUid(h);o.metallic=e,o.roughness=r,o.metallicRoughnessTexture=a,o.emissiveColor=i,o.emissiveTexture=c,o.occlusionTexture=m,o.colorTextureTransform=this._convertTextureTransform(n),o.normalTextureTransform=this._convertTextureTransform(l),o.emissiveTextureTransform=this._convertTextureTransform(u),o.occlusionTextureTransform=this._convertTextureTransform(h),o.metallicRoughnessTextureTransform=this._convertTextureTransform(s),o.uid=`${o.uid},mrm:${e},mrr:${r},mrt:${f},mrtt:${p},emuid:${d},etmuid:${g},ett:${x},otmuid:${_},ott:${T}`}return o}_convertTextureTransform(e){if(!e)return null;const{scale:r,offset:o,rotation:a}=e;return{scale:r,offset:o,rotation:t(a)}}_setInternalColorValueParameters(t,r){r.diffuse=e.toUnitRGB(t),r.opacity=t.a}_getLoadableTextureResource(e){return e.data??e.url}_getInternalTextureId(e){const t=this._getInternalTexture(e,ie.Opaque);return t?.id}_getInternalTexture(e,t){const r=this._getLoadableTextureResource(e);if(!r)return null;const o=`${e.contentHash}/${t}`;let a=this._textures.get(o);return a||(a=new he(W(r)?r.data:r,{mipmap:!0,wrap:this._castTextureWrap(e.wrap),noUnpackFlip:!0,preMultiplyAlpha:!W(r)&&t!==ie.Opaque,encoding:W(r)&&null!=r.encoding?r.encoding:void 0}),this._textures.set(o,a),a.load(this._context.stage.renderView.renderingContext),this._context.stage.add(a)),a}_castTextureWrap(e="repeat"){if("string"==typeof e){const t=this._castTextureWrapIndividual(e);return{s:t,t}}return{s:this._castTextureWrapIndividual(e.horizontal),t:this._castTextureWrapIndividual(e.vertical)}}_castTextureWrapIndividual(e){switch(e){case"clamp":return Te.CLAMP_TO_EDGE;case"mirror":return Te.MIRRORED_REPEAT;default:return Te.REPEAT}}_setInternalMaterialParameters(t,r){if(null!=t.color&&this._setInternalColorValueParameters(t.color,r),null!=t.colorTexture){const e=this._getInternalTexture(t.colorTexture,r.textureAlphaMode);e?(r.textureId=e.id,r.textureAlphaPremultiplied=!!e.parameters.preMultiplyAlpha):r.textureId=void 0}t.normalTexture&&(r.normalTextureId=this._getInternalTextureId(t.normalTexture)),t.emissiveColor&&(r.emissiveFactor=e.toUnitRGB(t.emissiveColor)),t.emissiveTexture&&(r.emissiveTextureId=this._getInternalTextureId(t.emissiveTexture)),t.occlusionTexture&&(r.occlusionTextureId=this._getInternalTextureId(t.occlusionTexture)),t.metallicRoughnessTexture&&(r.metallicRoughnessTextureId=this._getInternalTextureId(t.metallicRoughnessTexture)),r.colorTextureTransformMatrix=z(t.colorTextureTransform),r.normalTextureTransformMatrix=z(t.normalTextureTransform),r.occlusionTextureTransformMatrix=z(t.occlusionTextureTransform),r.emissiveTextureTransformMatrix=z(t.emissiveTextureTransform),r.metallicRoughnessTextureTransformMatrix=z(t.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(t){const r=this._drivenProperties.color;let o=this.symbolLayer.material?.colorMixMode??null;if(r)t.externalColor=b;else{const r=this.symbolLayer.material?.color??null;r?t.externalColor=e.toUnitRGBA(r):(o=null,t.externalColor=b)}o&&(t.colorMixMode=o),t.castShadows=!!this.symbolLayer.castShadows}_hasTransparentVertexColors(e){const t=e.vertexAttributes.color;if(null==t)return!1;for(let r=3;r<t.length;r+=4)if(255!==t[r])return!0;return!1}_getOrCreateMaterial(t,r){const o=r.material?.color,a=r.material?.colorTexture,s=r.material?.alphaMode,n="blend"===s,i=!("opaque"===s)&&(this._hasTransparentVertexColors(t)||null!=o&&o.a<1||a?.transparent||n),l=this._materialProperties(t,r,i),c=this._materialInfoCache.byUid(l.uid);if(c)return c.material;const u={uid:l.uid,material:null,isComponentTransparent:i,alphaMode:r.material?r.material.alphaMode:"opaque"},m=ge({normalTexture:l.normalTexture,metallicRoughnessTexture:l.metallicRoughnessTexture,metallicFactor:l.metallic,roughnessFactor:l.roughness,emissiveTexture:l.emissiveTexture,emissiveFactor:e.toUnitRGB(l.emissiveColor),occlusionTexture:l.occlusionTexture}),h={usePBR:this._usePBR(),isSchematic:m,hasVertexColors:l.hasVertexColors,hasSymbolColors:l.hasSymbolVertexColors,hasVertexTangents:l.hasVertexTangents,ambient:_,diffuse:T,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:le.None,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled,initTextureTransparent:!0};h.mrrFactors=m?[...xe]:[l.metallic,l.roughness,_e[2]],r.material&&(h.doubleSided=r.material.doubleSided,h.cullFace=r.material.doubleSided?le.None:le.Back,h.textureAlphaCutoff=r.material.alphaCutoff),this._setExternalMaterialParameters(h),this._setMaterialTransparentParameter(h,u),this._setInternalMaterialParameters(l,h);const f=new pe(h);return u.material=f,this._materialInfoCache.set(l.uid,u),this._context.stage.add(f),f}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTransparentParameter(e,t){e.transparent=this.needsDrivenTransparentPass||t.isComponentTransparent||e.layerOpacity<1||e.opacity<1||e.externalColor&&e.externalColor[3]<1,"auto"===t.alphaMode?e.textureAlphaMode=e.transparent?ie.MaskBlend:ie.Opaque:e.textureAlphaMode="opaque"===t.alphaMode?ie.Opaque:"mask"===t.alphaMode?ie.Mask:ie.Blend}_addDebugNormals(e,t){const r=t.length,o=e.spatialReference.isGeographic?20015077/180:1,a=.1*Math.max(e.extent.width*o,e.extent.height*o,e.extent.zmax-e.extent.zmin),s=[],n=[],i=[],l=[];for(let p=0;p<r;p++){const e=t[p],r=e.attributes.get(fe.POSITION),o=e.attributes.get(fe.NORMAL),c=r.indices,u=o.indices,m=r.data,d=o.data;for(let t=0;t<c.length;t++){const e=3*c[t],r=3*u[t];for(let t=0;t<3;t++)s.push(m[e+t]);for(let t=0;t<3;t++)s.push(m[e+t]+d[r+t]*a);if(n.push(n.length),n.push(n.length),t%3==0){this._calculateFaceNormal(m,c,t,Oe),this._getFaceVertices(m,c,t,je,we,Me),h(je,je,we),h(je,je,Me),f(je,je,1/3);for(let e=0;e<3;e++)i.push(je[e]);for(let e=0;e<3;e++)i.push(je[e]+Oe[e]*a);l.push(l.length),l.push(l.length)}}}const c=t[0].transformation,u=new ue(this._debugVertexNormalMaterial,[[fe.POSITION,new ne(s,n,3,!0)]],null,ce.Line);t.push(u),u.transformation=c;const m=new ue(this._debugFaceNormalMaterial,[[fe.POSITION,new ne(i,l,3,!0)]],null,ce.Line);m.transformation=c,t.push(m)}_createAs3DShape(e,t,r,o){const a=e.geometry;if("mesh"!==a.type)return null;const s=this._createGeometryInfo(a,t,o);if(null==s)return null;const{geometries:n,objectTransformation:i}=s;se.DRAW_MESH_GEOMETRY_NORMALS&&this._addDebugNormals(a,n);const l=new me({geometries:n,layerUid:this._context.layer.uid,graphicUid:o});l.transformation=i;const c=re(this.symbolLayer,{opacity:this._getLayerOpacity()}),u=c?new Q(n[0].material,[c],{mergeGeometries:!0,hasSlicePlane:this._context.slicePlaneEnabled}):null,m=new K(this,l,n,null,null,Y,r,u);this._fastUpdateProcessor.onAddGraphic(),m.needsElevationUpdates=Z(r.mode),m.useObjectOriginAsAttachmentOrigin=!0,r.centerPointInElevationSR=this._getCenterPointInElevationSR(l.transformation);const{elevationProvider:h,renderCoordsHelper:f}=this._context,p=(e,t)=>J(e,h,r,f,t);return m.alignedSampledElevation=Y(m,r,h.spatialReference,p,f),m}_getCenterPointInElevationSR(e){const t=k(0,0,0,null!=this._context.elevationProvider.spatialReference?this._context.elevationProvider.spatialReference:null);return w([e[12],e[13],e[14]],this._context.renderCoordsHelper.spatialReference,t),t}_createComponentNormals(e,t,r,o){switch(r.shading||"flat"){default:case"source":return this._createComponentNormalsSource(e,t,r,o);case"flat":return this._createComponentNormalsFlat(e,o);case"smooth":return this._createComponentNormalsSmooth(e,o)}}_createComponentNormalsSource(e,t,r,o){if(null==t)return this._createComponentNormalsFlat(e,o);let a=!1;if(!r.trustSourceNormals)for(let s=0;s<o.length;s+=3){this._calculateFaceNormal(e,o,s,Oe);for(let e=0;e<3;e++){const r=3*o[s+e];je[0]=t[r],je[1]=t[r+1],je[2]=t[r+2],p(Oe,je)<0&&(t[r]=-t[r],t[r+1]=-t[r+1],t[r+2]=-t[r+2],a=!0)}}return new ve(t,o,a)}_createComponentNormalsFlat(e,t){const r=A(t.length),o=new Array(3*t.length);for(let a=0;a<t.length;a+=3){const s=this._calculateFaceNormal(e,t,a,Oe);for(let e=0;e<3;e++)r[a+e]=s[e],o[a+e]=a/3}return new ve(r,o,!1)}_createComponentNormalsSmooth(e,t){const r={};for(let s=0;s<t.length;s+=3){const o=this._calculateFaceNormal(e,t,s,Oe);for(let e=0;e<3;e++){const a=t[s+e];let n=r[a];n||(n={normal:y(),count:0},r[a]=n),h(n.normal,n.normal,o),n.count++}}const o=A(3*t.length),a=new Array(3*t.length);for(let s=0;s<t.length;s++){const e=r[t[s]];1!==e.count&&(d(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)o[3*s+t]=e.normal[t];a[s]=s}return new ve(o,a,!1)}_getFaceVertices(e,t,r,o,a,s){const n=3*t[r],i=3*t[r+1],l=3*t[r+2];o[0]=e[n],o[1]=e[n+1],o[2]=e[n+2],a[0]=e[i],a[1]=e[i+1],a[2]=e[i+2],s[0]=e[l],s[1]=e[l+1],s[2]=e[l+2]}_calculateFaceNormal(e,t,r,o){return this._getFaceVertices(e,t,r,je,we,Me),g(we,we,je),g(Me,Me,je),x(je,we,Me),d(o,je),o}_getOrCreateComponents(e){return e.components??Ie}_createPositionBuffer(e,t){let r=e.vertexAttributes.position;const o=t.reprojection===Be.ECEF?t.transformBeforeProject:null;if(o&&(r=S(new Float64Array(r.length),r,o)),t.reprojection===Be.NONE)return t.needsBufferCopy?new Float64Array(r):r;const a=o?r:new Float64Array(r.length);return j(r,e.spatialReference,0,a,this._context.renderCoordsHelper.spatialReference,0,r.length/3),a}_createNormalBuffer(e,t,r){let o=e.vertexAttributes.normal;if(null==o)return null;const a=r.reprojection===Be.ECEF?r.transformBeforeProject:null;a&&(o=$(o,new Float32Array(o.length),a));if("local"===this._context.graphicsCoreOwner.view.viewingMode||r.reprojection===Be.NONE)return r.needsBufferCopy&&e.vertexAttributes.normal===o?new Float32Array(o):o;const s=e.vertexAttributes.position,n=a?o:new Float32Array(o.length);return G(o,s,t,e.spatialReference,n)}_createTangentBuffer(e,t,r){let o=e.vertexAttributes.tangent;if(null==o)return null;const a=r.reprojection===Be.ECEF?r.transformBeforeProject:null;a&&(o=V(o,new Float32Array(o.length),a));if("local"===this._context.graphicsCoreOwner.view.viewingMode||r.reprojection===Be.NONE)return r.needsBufferCopy&&e.vertexAttributes.normal===o?new Float32Array(o):o;const s=e.vertexAttributes.position,n=a?o:new Float32Array(o.length);return D(o,s,t,e.spatialReference,n)}_createColorBuffer(e){return e.vertexAttributes.color}_createSymbolColorBuffer(e){if(this._requiresSymbolVertexColors()){const t=this._getVertexOpacityAndColor(e),r=oe(this.symbolLayer?.material?.colorMixMode),o=new Uint8Array(4);return ae(t,r,o),o}return null}_createBuffers(e,t){const r=e.vertexAttributes&&e.vertexAttributes.position;if(!r)return this.logger.warn("Mesh geometry must contain position vertex attributes"),null;const o=e.vertexAttributes.normal,a=e.vertexAttributes.uv,s=e.vertexAttributes.tangent;if(o&&o.length!==r.length)return this.logger.warn("Mesh normal vertex buffer must contain the same number of elements as the position buffer"),null;if(s&&s.length/4!=r.length/3)return this.logger.warn("Mesh tangent vertex buffer must contain the same number of elements as the position buffer"),null;if(a&&a.length/2!=r.length/3)return this.logger.warn("Mesh uv vertex buffer must contain the same number of elements as the position buffer"),null;const n=this._computeReprojectionInfo(e),i=this._createPositionBuffer(e,n),c=this._createColorBuffer(e),u=this._createSymbolColorBuffer(t),m=this._createNormalBuffer(e,i,n),h=this._createTangentBuffer(e,i,n);return{positionBuffer:i,normalBuffer:m,tangentBuffer:h,uvBuffer:a,colorBuffer:c,symbolColorBuffer:u,objectTransformation:n.reprojection===Be.NONE&&n.objectTransformation?n.objectTransformation:this._transformOriginLocal(e,i,m,h),geometryTransformation:n.reprojection===Be.NONE&&n.geometryTransformation?n.geometryTransformation:l()}}_computeReprojectionInfo(e){const{vertexSpace:t}=e,r=t.isRelative,o=t.isGeoreferenced?this._context.renderCoordsHelper.viewingMode===q.Local?Be.NONE:Be.ECEF:Be.NONE;if(r){const{origin:r}=t,a=l(),i=e.transform?.localMatrix??c;if(o===Be.NONE){C(e.spatialReference,r,a,this._context.renderCoordsHelper.spatialReference);return{reprojection:o,objectTransformation:a,geometryTransformation:u(i),needsBufferCopy:!1}}const m=s(l(),r);return n(m,m,i),{reprojection:o,transformBeforeProject:m,needsBufferCopy:!0}}return{reprojection:o,needsBufferCopy:!0}}_transformOriginLocal(e,t,a,s){const n=this._context.renderCoordsHelper.spatialReference,c=e.anchor;Ce[0]=c.x,Ce[1]=c.y,Ce[2]=c.z??0;const u=l();return C(e.spatialReference,Ce,u,n),i(Pe,u),S(t,t,Pe),(a||s)&&(r(Re,u),o(Re,Re),a&&U(a,a,Re),s&&U(s,s,Re,4)),u}_validateFaces(e,t){const r=e.vertexAttributes.position.length/3,o=t.faces;if(o){let e=-1;for(let t=0;t<o.length;t++){const r=o[t];r>e&&(e=r)}if(r<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(r%3!=0)return this.logger.warn("Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)"),!1;return!0}_getOrCreateFaces(e,t){return t.faces??E(e.vertexAttributes.position.length/3)}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes?.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference,o=L({positions:t,transform:e.transform,vertexSpace:e.vertexSpace,inSpatialReference:e.spatialReference,outSpatialReference:r??e.spatialReference}),a=o.length/3;return O(Ee),P(Ee,o,0,a),!R(Ee,this._context.clippingExtent)}_createGeometryInfo(e,t,r){if(!v(e.spatialReference,this._context.graphicsCoreOwner.view.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,t);if(null==o)return null;const{positionBuffer:a,uvBuffer:s,colorBuffer:n,symbolColorBuffer:i,normalBuffer:l,tangentBuffer:c,objectTransformation:u,geometryTransformation:m}=o,h=this._getOrCreateComponents(e),f=new Array;let p=!1;for(const d of h){if(!this._validateFaces(e,d))return null;const t=this._getOrCreateFaces(e,d);if(0===t.length)continue;const o=this._createComponentNormals(a,l,d,t);o.didFlipNormals&&(p=!0);const u=[[fe.POSITION,new ne(a,t,3,!0)],[fe.NORMAL,new ne(o.normals,o.indices,3,!0)]];n&&u.push([fe.COLOR,new ne(n,t,4,!0)]),i&&u.push([fe.SYMBOLCOLOR,new ne(i,I(t.length),4,!0)]),s&&u.push([fe.UV0,new ne(s,t,2,!0)]),c&&u.push([fe.TANGENT,new ne(c,t,4,!0)]);const h=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:r,layerUid:this._context.layer.uid}),g=this._getOrCreateMaterial(e,d),x=new ue(g,u,null,ce.Mesh,h);x.transformation=m,f.push(x)}return p&&this.logger.warn("Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals."),{geometries:f,objectTransformation:u}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial(((e,t)=>{t.setParameters(e.parameters)}))}test(){return{...super.test(),materials:this._materialInfoCache.materials}}}class ve{constructor(e,t,r){this.normals=e,this.indices=t,this.didFlipNormals=r}}const Ce=y(),je=y(),we=y(),Me=y(),Oe=y(),Pe=l(),Re=a(),Ae=l(),Ee=M(),Ie=[new N],Ne=new F;var Be;!function(e){e[e.NONE=0]="NONE",e[e.ECEF=1]="ECEF"}(Be||(Be={}));export{be as Graphics3DMeshFillSymbolLayer};
|
|
5
|
+
import e from"../../../../Color.js";import"../../../../core/has.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{f as r,t as o}from"../../../../chunks/mat3.js";import{a}from"../../../../chunks/mat3f64.js";import{d as s,m as n,i}from"../../../../chunks/mat4.js";import{a as l,I as c,b as u}from"../../../../chunks/mat4f64.js";import{s as m,g as h,i as f,j as p,n as d,f as g,b as x}from"../../../../chunks/vec3.js";import{Z as _,O as T,c as y}from"../../../../chunks/vec3f64.js";import{O as b}from"../../../../chunks/vec4f64.js";import{canProjectWithoutEngine as v}from"../../../../geometry/projection.js";import{computeTranslationToOriginAndRotation as C}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as j}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToDehydratedPoint as w}from"../../../../geometry/projection/projectVectorToDehydratedPoint.js";import{create as M,empty as O,expandWithBuffer as P,intersectsClippingArea as R}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as A}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as E,getZeroIndexArray as I}from"../../../../geometry/support/Indices.js";import N from"../../../../geometry/support/MeshComponent.js";import B from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import F from"../../../../geometry/support/MeshTextureTransform.js";import{t as S,a as U}from"../../../../chunks/vec32.js";import{project as L}from"../../../../geometry/support/meshUtils/georeference.js";import{transformNormal as $,projectNormalToPCPF as G,transformTangent as V,projectTangentToPCPF as D}from"../../../../geometry/support/meshUtils/projection.js";import{makeDehydratedPoint as k}from"../../../../layers/graphics/dehydratedPoint.js";import{MeshTransformUpdateAction as H}from"../../../../layers/graphics/sources/interfaces.js";import{ViewingMode as q}from"../../../ViewingMode.js";import{isEncodedMeshTexture as W}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as z}from"../../glTF/internal/TextureTransformUtils.js";import{perObjectElevationAligner as Y}from"./ElevationAligners.js";import{needsElevationUpdates3D as Z,evaluateElevationInfoAtPoint as J}from"./elevationAlignmentUtils.js";import{Graphics3DMeshObject3DGraphicLayer as K}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as Q}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as X}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as ee,MeshFastUpdateProcessor as te}from"./MeshFastUpdateProcessor.js";import{createMaterial as re}from"../support/edgeUtils.js";import{parseColorMixMode as oe,encodeSymbolColor as ae}from"../support/symbolColorUtils.js";import{debugFlags as se}from"../../support/debugFlags.js";import{Attribute as ne}from"../../webgl-engine/lib/Attribute.js";import{AlphaDiscardMode as ie,CullFaceOptions as le}from"../../webgl-engine/lib/basicInterfaces.js";import{ContentObjectType as ce}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as ue}from"../../webgl-engine/lib/Geometry.js";import{Object3D as me}from"../../webgl-engine/lib/Object3D.js";import{Texture as he}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as fe}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as pe}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as de}from"../../webgl-engine/materials/NativeLineMaterial.js";import{useSchematicPBR as ge,defaultSchematicMRRFactors as xe,defaultAdvancedMRRFactors as _e}from"../../webgl-engine/materials/pbrUtils.js";import{TextureWrapMode as Te}from"../../../webgl/enums.js";const ye=["mesh"];class be extends X{constructor(e,t,r,o){super(e,t,r,o),this._materialInfoCache=new ee,this._fastUpdateProcessor=new te,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){se.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new de({color:[1,0,1,1]}),this._debugFaceNormalMaterial=new de({color:[0,1,1,1]}))}destroy(){super.destroy(),this._textures.forEach((e=>e.unload())),this._context.stage.removeMany(this._materialInfoCache.materials),this._context.stage.removeMany(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy(this._context.stage)}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,ye,"fill on mesh-3d"))return null;const r=this.setGraphicElevationContext(t),o=e.renderingInfo;return this._createAs3DShape(t,o,r,t.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache,this._context)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._updateMaterialParameters((e=>{e.material.setParameters({layerOpacity:r});const t=e.material.parameters;this._setMaterialTransparentParameter(t,e),e.material.setParameters({transparent:t.transparent})})),e.forEach((e=>t(e)?.layerOpacityChanged(r,this._context.isAsync)))}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,Z)}slicePlaneEnabledChanged(e,t){return this._updateMaterialParameters((({material:e})=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),e.forEach((e=>t(e)?.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync))),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._updateMaterialParameters((({material:t})=>t.setParameters({usePBR:e}))),!0}updateTransform(e,t,r,o){const a=this._context.renderCoordsHelper.spatialReference,s=Ae,{origin:n,transform:i}=r;switch(C(t,m(je,n.x,n.y,n.z??0),s,a),o){case H.EnableFastUpdates:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case H.DisableFastUpdates:this._fastUpdateProcessor.disable(e,this._materialInfoCache,this._context);break;case H.UpdateFastLocalOrigin:e.updateFastLocalOrigin(s,i,this._context.localOriginFactory)}const{elevationContext:l}=e;l.centerPointInElevationSR=this._getCenterPointInElevationSR(s);const{elevationProvider:c,renderCoordsHelper:u}=this._context,h=(e,t)=>J(e,c,l,u,t);return e.alignedSampledElevation=Y(e,l,c.spatialReference,h,u,s),e.updateTransform(s,i,this._context.isAsync),!0}_requiresSymbolVertexColors(){return this._drivenProperties.color||this._drivenProperties.opacity}_colorOrTextureUid(t){return null==t?"-":t instanceof e?t.toHex():t.contentHash}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),o=!!e.vertexAttributes.color,a=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:o,hasVertexTangents:a,uid:`vc:${o},vt:${a},vct${t},svc:${r}`}}_textureTransformUid(e){const{offset:t,scale:r,rotation:o}=e??Ne;return`${t[0]},${t[1]},${o},${r[0]},${r[1]}`}_materialProperties(e,t,r){const o=this._materialPropertiesDefault(e,r);if(!t.material)return o;const{color:a,colorTexture:s,colorTextureTransform:n,normalTexture:i,normalTextureTransform:l,doubleSided:c,alphaCutoff:u,alphaMode:m}=t.material,h=this._colorOrTextureUid(a),f=this._colorOrTextureUid(s),p=this._textureTransformUid(n),d=this._colorOrTextureUid(i),g=this._textureTransformUid(l);if(o.color=a,o.colorTexture=s,o.normalTexture=i,o.uid=`${o.uid},cmuid:${h},ctmuid:${f},cttuid:${p},ntmuid:${d},nttuid:${g},ds:${c},ac:${u},am:${m}`,t.material instanceof B){const{metallic:e,roughness:r,metallicRoughnessTexture:a,metallicRoughnessTextureTransform:s,emissiveColor:i,emissiveTexture:c,emissiveTextureTransform:u,occlusionTexture:m,occlusionTextureTransform:h}=t.material,f=this._colorOrTextureUid(a),p=this._textureTransformUid(s),d=this._colorOrTextureUid(i),g=this._colorOrTextureUid(c),x=this._textureTransformUid(u),_=this._colorOrTextureUid(m),T=this._textureTransformUid(h);o.metallic=e,o.roughness=r,o.metallicRoughnessTexture=a,o.emissiveColor=i,o.emissiveTexture=c,o.occlusionTexture=m,o.colorTextureTransform=this._convertTextureTransform(n),o.normalTextureTransform=this._convertTextureTransform(l),o.emissiveTextureTransform=this._convertTextureTransform(u),o.occlusionTextureTransform=this._convertTextureTransform(h),o.metallicRoughnessTextureTransform=this._convertTextureTransform(s),o.uid=`${o.uid},mrm:${e},mrr:${r},mrt:${f},mrtt:${p},emuid:${d},etmuid:${g},ett:${x},otmuid:${_},ott:${T}`}return o}_convertTextureTransform(e){if(!e)return null;const{scale:r,offset:o,rotation:a}=e;return{scale:r,offset:o,rotation:t(a)}}_setInternalColorValueParameters(t,r){r.diffuse=e.toUnitRGB(t),r.opacity=t.a}_getLoadableTextureResource(e){return e.data??e.url}_getInternalTextureId(e){const t=this._getInternalTexture(e,ie.Opaque);return t?.id}_getInternalTexture(e,t){const r=this._getLoadableTextureResource(e);if(!r)return null;const o=`${e.contentHash}/${t}`;let a=this._textures.get(o);return a||(a=new he(W(r)?r.data:r,{mipmap:!0,wrap:this._castTextureWrap(e.wrap),noUnpackFlip:!0,preMultiplyAlpha:!W(r)&&t!==ie.Opaque,encoding:W(r)&&null!=r.encoding?r.encoding:void 0}),this._textures.set(o,a),a.load(this._context.stage.renderView.renderingContext),this._context.stage.add(a)),a}_castTextureWrap(e="repeat"){if("string"==typeof e){const t=this._castTextureWrapIndividual(e);return{s:t,t}}return{s:this._castTextureWrapIndividual(e.horizontal),t:this._castTextureWrapIndividual(e.vertical)}}_castTextureWrapIndividual(e){switch(e){case"clamp":return Te.CLAMP_TO_EDGE;case"mirror":return Te.MIRRORED_REPEAT;default:return Te.REPEAT}}_setInternalMaterialParameters(t,r){if(null!=t.color&&this._setInternalColorValueParameters(t.color,r),null!=t.colorTexture){const e=this._getInternalTexture(t.colorTexture,r.textureAlphaMode);e?(r.textureId=e.id,r.textureAlphaPremultiplied=!!e.parameters.preMultiplyAlpha):r.textureId=void 0}t.normalTexture&&(r.normalTextureId=this._getInternalTextureId(t.normalTexture)),t.emissiveColor&&(r.emissiveFactor=e.toUnitRGB(t.emissiveColor)),t.emissiveTexture&&(r.emissiveTextureId=this._getInternalTextureId(t.emissiveTexture)),t.occlusionTexture&&(r.occlusionTextureId=this._getInternalTextureId(t.occlusionTexture)),t.metallicRoughnessTexture&&(r.metallicRoughnessTextureId=this._getInternalTextureId(t.metallicRoughnessTexture)),r.colorTextureTransformMatrix=z(t.colorTextureTransform),r.normalTextureTransformMatrix=z(t.normalTextureTransform),r.occlusionTextureTransformMatrix=z(t.occlusionTextureTransform),r.emissiveTextureTransformMatrix=z(t.emissiveTextureTransform),r.metallicRoughnessTextureTransformMatrix=z(t.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(t){const r=this._drivenProperties.color;let o=this.symbolLayer.material?.colorMixMode??null;if(r)t.externalColor=b;else{const r=this.symbolLayer.material?.color??null;r?t.externalColor=e.toUnitRGBA(r):(o=null,t.externalColor=b)}o&&(t.colorMixMode=o),t.castShadows=!!this.symbolLayer.castShadows}_hasTransparentVertexColors(e){const t=e.vertexAttributes.color;if(null==t)return!1;for(let r=3;r<t.length;r+=4)if(255!==t[r])return!0;return!1}_getOrCreateMaterial(t,r){const o=r.material?.color,a=r.material?.colorTexture,s=r.material?.alphaMode,n="blend"===s,i=!("opaque"===s)&&(this._hasTransparentVertexColors(t)||null!=o&&o.a<1||a?.transparent||n),l=this._materialProperties(t,r,i),c=this._materialInfoCache.byUid(l.uid);if(c)return c.material;const u={uid:l.uid,material:null,isComponentTransparent:i,alphaMode:r.material?r.material.alphaMode:"opaque"},m=ge({normalTexture:l.normalTexture,metallicRoughnessTexture:l.metallicRoughnessTexture,metallicFactor:l.metallic,roughnessFactor:l.roughness,emissiveTexture:l.emissiveTexture,emissiveFactor:e.toUnitRGB(l.emissiveColor),occlusionTexture:l.occlusionTexture}),h={usePBR:this._usePBR(),isSchematic:m,hasVertexColors:l.hasVertexColors,hasSymbolColors:l.hasSymbolVertexColors,hasVertexTangents:l.hasVertexTangents,ambient:_,diffuse:T,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:le.None,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled,initTextureTransparent:!0};h.mrrFactors=m?[...xe]:[l.metallic,l.roughness,_e[2]],r.material&&(h.doubleSided=r.material.doubleSided,h.cullFace=r.material.doubleSided?le.None:le.Back,h.textureAlphaCutoff=r.material.alphaCutoff),this._setExternalMaterialParameters(h),this._setMaterialTransparentParameter(h,u),this._setInternalMaterialParameters(l,h);const f=new pe(h);return u.material=f,this._materialInfoCache.set(l.uid,u),this._context.stage.add(f),f}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTransparentParameter(e,t){e.transparent=this.needsDrivenTransparentPass||t.isComponentTransparent||e.layerOpacity<1||e.opacity<1||e.externalColor&&e.externalColor[3]<1,"auto"===t.alphaMode?e.textureAlphaMode=e.transparent?ie.MaskBlend:ie.Opaque:e.textureAlphaMode="opaque"===t.alphaMode?ie.Opaque:"mask"===t.alphaMode?ie.Mask:ie.Blend}_addDebugNormals(e,t){const r=t.length,o=e.spatialReference.isGeographic?20015077/180:1,a=.1*Math.max(e.extent.width*o,e.extent.height*o,e.extent.zmax-e.extent.zmin),s=[],n=[],i=[],l=[];for(let p=0;p<r;p++){const e=t[p],r=e.attributes.get(fe.POSITION),o=e.attributes.get(fe.NORMAL),c=r.data,u=r.indices,m=o.data,d=o.indices;for(let t=0;t<u.length;t++){const e=3*u[t],r=3*d[t];for(let t=0;t<3;t++)s.push(c[e+t]);for(let t=0;t<3;t++)s.push(c[e+t]+m[r+t]*a);if(n.push(n.length),n.push(n.length),t%3==0){this._calculateFaceNormal(c,u,t,Oe),this._getFaceVertices(c,u,t,je,we,Me),h(je,je,we),h(je,je,Me),f(je,je,1/3);for(let e=0;e<3;e++)i.push(je[e]);for(let e=0;e<3;e++)i.push(je[e]+Oe[e]*a);l.push(l.length),l.push(l.length)}}}const c=t[0].transformation,u=new ue(this._debugVertexNormalMaterial,[[fe.POSITION,new ne(s,n,3,!0)]],null,ce.Line);t.push(u),u.transformation=c;const m=new ue(this._debugFaceNormalMaterial,[[fe.POSITION,new ne(i,l,3,!0)]],null,ce.Line);m.transformation=c,t.push(m)}_createAs3DShape(e,t,r,o){const a=e.geometry;if("mesh"!==a.type)return null;const s=this._createGeometryInfo(a,t,o);if(null==s)return null;const{geometries:n,objectTransformation:i}=s;se.DRAW_MESH_GEOMETRY_NORMALS&&this._addDebugNormals(a,n);const l=new me({geometries:n,layerUid:this._context.layer.uid,graphicUid:o});l.transformation=i;const c=re(this.symbolLayer,{opacity:this._getLayerOpacity()}),u=c?new Q(n[0].material,[c],{mergeGeometries:!0,hasSlicePlane:this._context.slicePlaneEnabled}):null,m=new K(this,l,n,null,null,Y,r,u);this._fastUpdateProcessor.onAddGraphic(),m.needsElevationUpdates=Z(r.mode),m.useObjectOriginAsAttachmentOrigin=!0,r.centerPointInElevationSR=this._getCenterPointInElevationSR(l.transformation);const{elevationProvider:h,renderCoordsHelper:f}=this._context,p=(e,t)=>J(e,h,r,f,t);return m.alignedSampledElevation=Y(m,r,h.spatialReference,p,f),m}_getCenterPointInElevationSR(e){const t=k(0,0,0,null!=this._context.elevationProvider.spatialReference?this._context.elevationProvider.spatialReference:null);return w([e[12],e[13],e[14]],this._context.renderCoordsHelper.spatialReference,t),t}_createComponentNormals(e,t,r,o){switch(r.shading||"flat"){default:case"source":return this._createComponentNormalsSource(e,t,r,o);case"flat":return this._createComponentNormalsFlat(e,o);case"smooth":return this._createComponentNormalsSmooth(e,o)}}_createComponentNormalsSource(e,t,r,o){if(null==t)return this._createComponentNormalsFlat(e,o);let a=!1;if(!r.trustSourceNormals)for(let s=0;s<o.length;s+=3){this._calculateFaceNormal(e,o,s,Oe);for(let e=0;e<3;e++){const r=3*o[s+e];je[0]=t[r],je[1]=t[r+1],je[2]=t[r+2],p(Oe,je)<0&&(t[r]=-t[r],t[r+1]=-t[r+1],t[r+2]=-t[r+2],a=!0)}}return new ve(t,o,a)}_createComponentNormalsFlat(e,t){const r=A(t.length),o=new Array(3*t.length);for(let a=0;a<t.length;a+=3){const s=this._calculateFaceNormal(e,t,a,Oe);for(let e=0;e<3;e++)r[a+e]=s[e],o[a+e]=a/3}return new ve(r,o,!1)}_createComponentNormalsSmooth(e,t){const r={};for(let s=0;s<t.length;s+=3){const o=this._calculateFaceNormal(e,t,s,Oe);for(let e=0;e<3;e++){const a=t[s+e];let n=r[a];n||(n={normal:y(),count:0},r[a]=n),h(n.normal,n.normal,o),n.count++}}const o=A(3*t.length),a=new Array(3*t.length);for(let s=0;s<t.length;s++){const e=r[t[s]];1!==e.count&&(d(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)o[3*s+t]=e.normal[t];a[s]=s}return new ve(o,a,!1)}_getFaceVertices(e,t,r,o,a,s){const n=3*t[r],i=3*t[r+1],l=3*t[r+2];o[0]=e[n],o[1]=e[n+1],o[2]=e[n+2],a[0]=e[i],a[1]=e[i+1],a[2]=e[i+2],s[0]=e[l],s[1]=e[l+1],s[2]=e[l+2]}_calculateFaceNormal(e,t,r,o){return this._getFaceVertices(e,t,r,je,we,Me),g(we,we,je),g(Me,Me,je),x(je,we,Me),d(o,je),o}_getOrCreateComponents(e){return e.components??Ie}_createPositionBuffer(e,t){let r=e.vertexAttributes.position;const o=t.reprojection===Be.ECEF?t.transformBeforeProject:null;if(o&&(r=S(new Float64Array(r.length),r,o)),t.reprojection===Be.NONE)return t.needsBufferCopy?new Float64Array(r):r;const a=o?r:new Float64Array(r.length);return j(r,e.spatialReference,0,a,this._context.renderCoordsHelper.spatialReference,0,r.length/3),a}_createNormalBuffer(e,t,r){let o=e.vertexAttributes.normal;if(null==o)return null;const a=r.reprojection===Be.ECEF?r.transformBeforeProject:null;a&&(o=$(o,new Float32Array(o.length),a));if("local"===this._context.graphicsCoreOwner.view.viewingMode||r.reprojection===Be.NONE)return r.needsBufferCopy&&e.vertexAttributes.normal===o?new Float32Array(o):o;const s=e.vertexAttributes.position,n=a?o:new Float32Array(o.length);return G(o,s,t,e.spatialReference,n)}_createTangentBuffer(e,t,r){let o=e.vertexAttributes.tangent;if(null==o)return null;const a=r.reprojection===Be.ECEF?r.transformBeforeProject:null;a&&(o=V(o,new Float32Array(o.length),a));if("local"===this._context.graphicsCoreOwner.view.viewingMode||r.reprojection===Be.NONE)return r.needsBufferCopy&&e.vertexAttributes.normal===o?new Float32Array(o):o;const s=e.vertexAttributes.position,n=a?o:new Float32Array(o.length);return D(o,s,t,e.spatialReference,n)}_createColorBuffer(e){return e.vertexAttributes.color}_createSymbolColorBuffer(e){if(this._requiresSymbolVertexColors()){const t=this._getVertexOpacityAndColor(e),r=oe(this.symbolLayer?.material?.colorMixMode),o=new Uint8Array(4);return ae(t,r,o),o}return null}_createBuffers(e,t){const r=e.vertexAttributes&&e.vertexAttributes.position;if(!r)return this.logger.warn("Mesh geometry must contain position vertex attributes"),null;const o=e.vertexAttributes.normal,a=e.vertexAttributes.uv,s=e.vertexAttributes.tangent;if(o&&o.length!==r.length)return this.logger.warn("Mesh normal vertex buffer must contain the same number of elements as the position buffer"),null;if(s&&s.length/4!=r.length/3)return this.logger.warn("Mesh tangent vertex buffer must contain the same number of elements as the position buffer"),null;if(a&&a.length/2!=r.length/3)return this.logger.warn("Mesh uv vertex buffer must contain the same number of elements as the position buffer"),null;const n=this._computeReprojectionInfo(e),i=this._createPositionBuffer(e,n),c=this._createColorBuffer(e),u=this._createSymbolColorBuffer(t),m=this._createNormalBuffer(e,i,n),h=this._createTangentBuffer(e,i,n);return{positionBuffer:i,normalBuffer:m,tangentBuffer:h,uvBuffer:a,colorBuffer:c,symbolColorBuffer:u,objectTransformation:n.reprojection===Be.NONE&&n.objectTransformation?n.objectTransformation:this._transformOriginLocal(e,i,m,h),geometryTransformation:n.reprojection===Be.NONE&&n.geometryTransformation?n.geometryTransformation:l()}}_computeReprojectionInfo(e){const{vertexSpace:t}=e,r=t.isRelative,o=t.isGeoreferenced?this._context.renderCoordsHelper.viewingMode===q.Local?Be.NONE:Be.ECEF:Be.NONE;if(r){const{origin:r}=t,a=l(),i=e.transform?.localMatrix??c;if(o===Be.NONE){C(e.spatialReference,r,a,this._context.renderCoordsHelper.spatialReference);return{reprojection:o,objectTransformation:a,geometryTransformation:u(i),needsBufferCopy:!1}}const m=s(l(),r);return n(m,m,i),{reprojection:o,transformBeforeProject:m,needsBufferCopy:!0}}return{reprojection:o,needsBufferCopy:!0}}_transformOriginLocal(e,t,a,s){const n=this._context.renderCoordsHelper.spatialReference,c=e.anchor;Ce[0]=c.x,Ce[1]=c.y,Ce[2]=c.z??0;const u=l();return C(e.spatialReference,Ce,u,n),i(Pe,u),S(t,t,Pe),(a||s)&&(r(Re,u),o(Re,Re),a&&U(a,a,Re),s&&U(s,s,Re,4)),u}_validateFaces(e,t){const r=e.vertexAttributes.position.length/3,o=t.faces;if(o){let e=-1;for(let t=0;t<o.length;t++){const r=o[t];r>e&&(e=r)}if(r<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(r%3!=0)return this.logger.warn("Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)"),!1;return!0}_getOrCreateFaces(e,t){return t.faces??E(e.vertexAttributes.position.length/3)}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes?.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference,o=L({positions:t,transform:e.transform,vertexSpace:e.vertexSpace,inSpatialReference:e.spatialReference,outSpatialReference:r??e.spatialReference}),a=o.length/3;return O(Ee),P(Ee,o,0,a),!R(Ee,this._context.clippingExtent)}_createGeometryInfo(e,t,r){if(!v(e.spatialReference,this._context.graphicsCoreOwner.view.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,t);if(null==o)return null;const{positionBuffer:a,uvBuffer:s,colorBuffer:n,symbolColorBuffer:i,normalBuffer:l,tangentBuffer:c,objectTransformation:u,geometryTransformation:m}=o,h=this._getOrCreateComponents(e),f=new Array;let p=!1;for(const d of h){if(!this._validateFaces(e,d))return null;const t=this._getOrCreateFaces(e,d);if(0===t.length)continue;const o=this._createComponentNormals(a,l,d,t);o.didFlipNormals&&(p=!0);const u=[[fe.POSITION,new ne(a,t,3,!0)],[fe.NORMAL,new ne(o.normals,o.indices,3,!0)]];n&&u.push([fe.COLOR,new ne(n,t,4,!0)]),i&&u.push([fe.SYMBOLCOLOR,new ne(i,I(t.length),4,!0)]),s&&u.push([fe.UV0,new ne(s,t,2,!0)]),c&&u.push([fe.TANGENT,new ne(c,t,4,!0)]);const h=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:r,layerUid:this._context.layer.uid}),g=this._getOrCreateMaterial(e,d),x=new ue(g,u,null,ce.Mesh,h);x.transformation=m,f.push(x)}return p&&this.logger.warn("Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals."),{geometries:f,objectTransformation:u}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial(((e,t)=>{t.setParameters(e.parameters)}))}test(){return{...super.test(),materials:this._materialInfoCache.materials}}}class ve{constructor(e,t,r){this.normals=e,this.indices=t,this.didFlipNormals=r}}const Ce=y(),je=y(),we=y(),Me=y(),Oe=y(),Pe=l(),Re=a(),Ae=l(),Ee=M(),Ie=[new N],Ne=new F;var Be;!function(e){e[e.NONE=0]="NONE",e[e.ECEF=1]="ECEF"}(Be||(Be={}));export{be as Graphics3DMeshFillSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/has.js";import e from"../../../../core/Error.js";import{w as t}from"../../../../chunks/mat4.js";import{I as s,a as i}from"../../../../chunks/mat4f64.js";import{s as r,a}from"../../../../chunks/vec2.js";import{f as o,b as n}from"../../../../chunks/vec2f64.js";import{s as l}from"../../../../chunks/vec3.js";import{e as h,c}from"../../../../chunks/vec3f64.js";import{projectBuffer as p}from"../../../../geometry/projection/projectBuffer.js";import{create as m,empty as d,expandWithBuffer as f,intersectsClippingArea as u}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as y,doubleArrayFrom as b}from"../../../../geometry/support/DoubleArray.js";import{needsElevationUpdates3D as g,evaluateElevationAlignmentAtPoint as _,SampleElevationInfo as v}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as w}from"./Graphics3DObject3DGraphicLayer.js";import{pathNumRoundJoinSubdivisions as x,pathNumRoundCapExtrusionSubdivisions as P}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as j}from"./Graphics3DSymbolLayer.js";import{isValidSize as S}from"./graphicUtils.js";import{ApplyRendererDiffResult as D}from"./interfaces.js";import{ConvertOptions as C,initFastSymbolUpdatesState as L,updateFastSymbolUpdatesState as V,getAttributeValue as U}from"../support/FastSymbolUpdates.js";import{SamplePosition as k}from"../../support/ElevationProvider.js";import{NormalType as E}from"../../webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{CullFaceOptions as R}from"../../webgl-engine/lib/basicInterfaces.js";import{Object3D as z}from"../../webgl-engine/lib/Object3D.js";import{Path as A}from"../../webgl-engine/lib/Path.js";import{PathBuilder as G}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as I,TriangulationCapBuilder as B,NoCapBuilder as O}from"../../webgl-engine/lib/PathCapBuilder.js";import{SimpleExtruder as M,MiterExtruder as q}from"../../webgl-engine/lib/PathExtruder.js";import{UpVectorAlignment as F,PathGeometry as H,isPathGeometry as W}from"../../webgl-engine/lib/PathGeometry.js";import{FastUpdatePathGeometry as N,StaticPathGeometry as T}from"../../webgl-engine/lib/PathGeometryData.js";import{computeMinimumRotationTangentFrame as Z}from"../../webgl-engine/lib/pathGeometryUtils.js";import{quadProfiles as J,circleProfiles as K}from"../../webgl-engine/lib/PathProfile.js";import{newPathVertex as Q}from"../../webgl-engine/lib/PathVertex.js";import{DefaultMaterial as X}from"../../webgl-engine/materials/DefaultMaterial.js";import{PathMaterial as Y}from"../../webgl-engine/materials/PathMaterial.js";const $=["polyline"];class ee extends j{constructor(e,t,s,i){super(e,t,s,i),this._intrinsicSize=o(1,1),this._upVectorAlignment=F.Path,this._stencilWidth=.1,this.usedMemory=0,this.ensureDrapedStatus(!1)}async doLoad(){const t=null!=this.symbolLayer.width?this.symbolLayer.width:this.symbolLayer.height,s=null!=this.symbolLayer.height?this.symbolLayer.height:t;this._vvConvertOptions=new C({size:!0,color:!0,rotation:!1,opacity:!0},[1,1,1],[t,1,s],this._context.renderCoordsHelper.unitInMeters),this._fastUpdates=this._context.renderer?.visualVariables?.length>0?L(this._context.renderer,this._vvConvertOptions):null;const i=this.symbolLayer.anchor||"center";this._upVectorAlignment="heading"===this.symbolLayer.profileRotation?F.World:F.Path;const o=this.symbolLayer.profile||"circle";switch(o){default:case"circle":this._profile=K[i];break;case"quad":this._profile=J[i]}switch(this.symbolLayer.join){case"round":this._extruder=new q(0,x);break;case"bevel":this._extruder=new q(0,1);break;case"miter":this._extruder=new q(.8*Math.PI,1);break;default:this._extruder=new M}const l=this.symbolLayer.cap||"butt";switch(l){case"none":this._startCap=new O,this._endCap=new O;break;case"butt":default:this._startCap=new B(this._profile,0),this._endCap=new B(this._profile,0,!0);break;case"square":this._startCap=new B(this._profile,-.5),this._endCap=new B(this._profile,.5,!0);break;case"round":{const e="quad"===o;this._startCap=new I({profile:this._profile,flip:!1,breakNormals:e,subdivisions:P}),this._endCap=new I({profile:this._profile,flip:!0,breakNormals:e,subdivisions:P});break}}const c=this.symbolLayer?.material?.color,p=this._getCombinedOpacityAndColor(c),m=h(p),d=p[3],f=d<1||this.needsDrivenTransparentPass,u={diffuse:m,ambient:m,opacity:d,transparent:f,hasVertexColors:!1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,cullFace:f||"none"===l?R.None:R.Back,offsetTransparentBackfaces:!0};if(!this._drivenProperties.size&&(r(this._intrinsicSize,t,s),!S(this._intrinsicSize[0])||!S(this._intrinsicSize[1])))throw new e("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");if(this._fastUpdates&&this._fastUpdates.visualVariables.size||a(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters),this._fastUpdates){const e={...u,...this._fastUpdates.materialParameters,size:n(this._intrinsicSize)};this._materials[0]=new Y(e)}else u.hasVertexColors=this._drivenProperties.color||this._drivenProperties.opacity,u.normalType=E.Compressed,this._materials[0]=new X(u);this._materials[0].setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),this._context.stage.add(this._materials[0])}destroy(){super.destroy(),this._context.stage.remove(this._materials[0]),this._materials[0]=null,this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,$,this.symbolLayer.type))return null;const s=this.setGraphicElevationContext(t),i=e.renderingInfo;return this._createAs3DShape(t,i,s,t.uid)}layerOpacityChanged(){const e=this.symbolLayer?.material?.color,t=this._getCombinedOpacity(e),s=t<1||this.needsDrivenTransparentPass;this._materials[0]?.setParameters({opacity:t,transparent:s})}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,g)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._materials[0]?.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}applyRendererDiff(e,t){for(const s in e.diff){if("visualVariables"!==s)return D.RecreateSymbol;if(!V(this._fastUpdates,t,this._vvConvertOptions))return D.RecreateSymbol;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return D.FastUpdate}_getVertexData(e){let t=0;const s=e.paths,i=[],r=e.spatialReference,a=this._context.elevationProvider.spatialReference,o=this._context.renderCoordsHelper.spatialReference;for(const c of s)t+=c.length;const n=y(3*t);let l,h=0;for(const c of s){i.push({offset:h,numVertices:c.length});for(const t of c)n[h++]=t[0],n[h++]=t[1],n[h++]=e.hasZ?t[2]:0}return null==a||r.equals(a)||p(n,r,0,n,a,0,t)?(null==a||a.equals(o)?l=b(n):(l=y(3*t),p(n,a,0,l,o,0,t)),{pathVertexDataInfos:i,vertexDataES:n,vertexDataRS:l}):null}_createAs3DShape(e,r,a,o){this.usedMemory=0;const n=e.geometry,h=this._getVertexData(n);if(null==h)return this.logger.warn("PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)"),null;if(0===h.pathVertexDataInfos.length)return 0!==n.paths.length&&n.paths.some((e=>e.length>0))||this.logger.warn("PathSymbol3DLayer geometry failed to be created (no paths were defined)"),null;const c=new Array,p=n.spatialReference,y=m(),b=this._context.renderCoordsHelper,v=new k(h.vertexDataES);for(const m of h.pathVertexDataInfos){const n=m.numVertices;if(n<2)continue;const g=m.offset;if(null!=this._context.clippingExtent&&(d(y),f(y,h.vertexDataES,g,n),!u(y,this._context.clippingExtent)))continue;const w=new Array,x=g+3*n;for(let e=g;e<x;e+=3){v.offset=e;const t=_(v,this._context.elevationProvider,a,b);l(ae,h.vertexDataRS[e],h.vertexDataRS[e+1],h.vertexDataRS[e+2]),b.setAltitude(ae,t),h.vertexDataRS[e]=ae[0],h.vertexDataRS[e+1]=ae[1],h.vertexDataRS[e+2]=ae[2],w.push(Q(this._upVectorAlignment))}const P=new A(w,h.vertexDataES,h.vertexDataRS,g);te(P,this._upVectorAlignment,this._context.renderCoordsHelper);const j=new G(P,this._profile,this._extruder,this._startCap,this._endCap);let S=null;if(this._fastUpdates){const t=this._fastUpdates.visualVariables,s=U(t.size?.field,e)??0,i=U(t.color?.field,e)??0,r=U(t.opacity?.field,e)??0;S=new N(j,s,i,r)}else{const e=[this._intrinsicSize[0],this._intrinsicSize[1]];if(this._drivenProperties.size){const t=r.size;e[0]*=se(t[0],"symbol-value"===t[2]?this.symbolLayer.height||0:t[2],this.symbolLayer.width||0),e[1]*=se(t[2],"symbol-value"===t[0]?this.symbolLayer.width||0:t[0],this.symbolLayer.height||0)}let t;this._drivenProperties.color&&(t=r.color),this._drivenProperties.opacity&&null!=r.opacity&&(t=t?[t[0],t[1],t[2],r.opacity]:[1,1,1,r.opacity]);const s=new T(j);s.bake(e),t&&s.bakeVertexColors(t),S=s}const D=S.createGeometryData(),C=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerUid:this._context.layer.uid}),L=new H(this._materials[0],D,S,p,this._stencilWidth,C);L.transformation=t(i(),s,j.path.origin),c.push(L),this.usedMemory+=j.usedMemory}if(0===c.length)return null;const x=new z({geometries:c,layerUid:this._context.layer.uid,graphicUid:o}),P=new w(this,x,c,null,null,((e,t,s,i,r)=>re(e,t,i,r,this._upVectorAlignment)),a);return P.alignedSampledElevation=0,P.needsElevationUpdates=g(a.mode),P}}function te(e,t,s){const{origin:i,positions:r}=e;let a=e.offset;switch(t){default:case F.World:for(const t of e.vertices)ae[0]=r[a++]+i[0],ae[1]=r[a++]+i[1],ae[2]=r[a++]+i[2],s.worldUpAtPosition(ae,ae),t.setFrameFromUpVector(ae);break;case F.Path:ae[0]=r[a]+i[0],ae[1]=r[a+1]+i[1],ae[2]=r[a+2]+i[2],s.worldUpAtPosition(ae,ae),Z(e,ae)}}function se(e,t,s){switch(e){case"symbol-value":return s;case"proportional":return t;default:return e}}function ie(e,t,s,i){let r=0;const{origin:a,vertices:o,positions:n,positionsES:h}=e,c=e.offset+3*o.length;for(let p=e.offset;p<c;p+=3)l(ae,h[p],h[p+1],h[p+2]),s(ae,oe),r+=oe.sampledElevation,ae[0]=n[p]+a[0],ae[1]=n[p+1]+a[1],ae[2]=n[p+2]+a[2],i.setAltitude(ae,oe.z),n[p]=ae[0]-a[0],n[p+1]=ae[1]-a[1],n[p+2]=ae[2]-a[2];return e.updatePathVertexInformation(),r/o.length}function re(e,t,s,i,r){const a=e.stageObject,o=a.geometries;let n=0;for(const l of o){if(!W(l))continue;const e=l.path,o=e.builder.path;n+=ie(o,t,s,i),r!==F.World&&te(o,r,i),e.onPathChanged(l),l.invalidateBoundingInfo(),a.geometryVertexAttrsUpdated(l)}return n/o.length}const ae=c(),oe=new v;export{ee as Graphics3DPathSymbolLayer};
|
|
5
|
+
import"../../../../core/has.js";import e from"../../../../core/Error.js";import{w as t}from"../../../../chunks/mat4.js";import{I as s,a as i}from"../../../../chunks/mat4f64.js";import{s as r,a}from"../../../../chunks/vec2.js";import{f as o,b as n}from"../../../../chunks/vec2f64.js";import{s as l}from"../../../../chunks/vec3.js";import{e as h,c}from"../../../../chunks/vec3f64.js";import{projectBuffer as p}from"../../../../geometry/projection/projectBuffer.js";import{create as m,empty as d,expandWithBuffer as f,intersectsClippingArea as u}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as y,doubleArrayFrom as b}from"../../../../geometry/support/DoubleArray.js";import{needsElevationUpdates3D as g,evaluateElevationAlignmentAtPoint as _,SampleElevationInfo as v}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as w}from"./Graphics3DObject3DGraphicLayer.js";import{pathNumRoundJoinSubdivisions as x,pathNumRoundCapExtrusionSubdivisions as P}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as j}from"./Graphics3DSymbolLayer.js";import{isValidSize as S}from"./graphicUtils.js";import{ApplyRendererDiffResult as D}from"./interfaces.js";import{ConvertOptions as C,initFastSymbolUpdatesState as L,updateFastSymbolUpdatesState as V,getAttributeValue as U}from"../support/FastSymbolUpdates.js";import{SamplePosition as k}from"../../support/ElevationProvider.js";import{NormalType as E}from"../../webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{CullFaceOptions as R}from"../../webgl-engine/lib/basicInterfaces.js";import{Object3D as A}from"../../webgl-engine/lib/Object3D.js";import{Path as z}from"../../webgl-engine/lib/Path.js";import{PathBuilder as I}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as G,TriangulationCapBuilder as B,NoCapBuilder as O}from"../../webgl-engine/lib/PathCapBuilder.js";import{SimpleExtruder as M,MiterExtruder as q}from"../../webgl-engine/lib/PathExtruder.js";import{UpVectorAlignment as F,PathGeometry as H,isPathGeometry as N}from"../../webgl-engine/lib/PathGeometry.js";import{FastUpdatePathGeometry as T,StaticPathGeometry as W}from"../../webgl-engine/lib/PathGeometryData.js";import{computeMinimumRotationTangentFrame as Z}from"../../webgl-engine/lib/pathGeometryUtils.js";import{quadProfiles as J,circleProfiles as K}from"../../webgl-engine/lib/PathProfile.js";import{newPathVertex as Q}from"../../webgl-engine/lib/PathVertex.js";import{VertexAttribute as X}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as Y}from"../../webgl-engine/materials/DefaultMaterial.js";import{PathMaterial as $}from"../../webgl-engine/materials/PathMaterial.js";const ee=["polyline"];class te extends j{constructor(e,t,s,i){super(e,t,s,i),this._intrinsicSize=o(1,1),this._upVectorAlignment=F.Path,this._stencilWidth=.1,this.usedMemory=0,this.ensureDrapedStatus(!1)}async doLoad(){const t=null!=this.symbolLayer.width?this.symbolLayer.width:this.symbolLayer.height,s=null!=this.symbolLayer.height?this.symbolLayer.height:t;this._vvConvertOptions=new C({size:!0,color:!0,rotation:!1,opacity:!0},[1,1,1],[t,1,s],this._context.renderCoordsHelper.unitInMeters),this._fastUpdates=this._context.renderer?.visualVariables?.length>0?L(this._context.renderer,this._vvConvertOptions):null;const i=this.symbolLayer.anchor||"center";this._upVectorAlignment="heading"===this.symbolLayer.profileRotation?F.World:F.Path;const o=this.symbolLayer.profile||"circle";switch(o){default:case"circle":this._profile=K[i];break;case"quad":this._profile=J[i]}switch(this.symbolLayer.join){case"round":this._extruder=new q(0,x);break;case"bevel":this._extruder=new q(0,1);break;case"miter":this._extruder=new q(.8*Math.PI,1);break;default:this._extruder=new M}const l=this.symbolLayer.cap||"butt";switch(l){case"none":this._startCap=new O,this._endCap=new O;break;case"butt":default:this._startCap=new B(this._profile,0),this._endCap=new B(this._profile,0,!0);break;case"square":this._startCap=new B(this._profile,-.5),this._endCap=new B(this._profile,.5,!0);break;case"round":{const e="quad"===o;this._startCap=new G({profile:this._profile,flip:!1,breakNormals:e,subdivisions:P}),this._endCap=new G({profile:this._profile,flip:!0,breakNormals:e,subdivisions:P});break}}const c=this.symbolLayer?.material?.color,p=this._getCombinedOpacityAndColor(c),m=h(p),d=p[3],f=d<1||this.needsDrivenTransparentPass,u={diffuse:m,ambient:m,opacity:d,transparent:f,hasVertexColors:!1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,cullFace:f||"none"===l?R.None:R.Back,offsetTransparentBackfaces:!0};if(!this._drivenProperties.size&&(r(this._intrinsicSize,t,s),!S(this._intrinsicSize[0])||!S(this._intrinsicSize[1])))throw new e("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");if(this._fastUpdates&&this._fastUpdates.visualVariables.size||a(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters),this._fastUpdates){const e={...u,...this._fastUpdates.materialParameters,size:n(this._intrinsicSize)};this._materials[0]=new $(e)}else u.hasVertexColors=this._drivenProperties.color||this._drivenProperties.opacity,u.normalType=E.Compressed,this._materials[0]=new Y(u);this._materials[0].setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),this._context.stage.add(this._materials[0])}destroy(){super.destroy(),this._context.stage.remove(this._materials[0]),this._materials[0]=null,this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,ee,this.symbolLayer.type))return null;const s=this.setGraphicElevationContext(t),i=e.renderingInfo;return this._createAs3DShape(t,i,s,t.uid)}layerOpacityChanged(){const e=this.symbolLayer?.material?.color,t=this._getCombinedOpacity(e),s=t<1||this.needsDrivenTransparentPass;this._materials[0]?.setParameters({opacity:t,transparent:s})}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,g)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._materials[0]?.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}applyRendererDiff(e,t){for(const s in e.diff){if("visualVariables"!==s)return D.RecreateSymbol;if(!V(this._fastUpdates,t,this._vvConvertOptions))return D.RecreateSymbol;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return D.FastUpdate}_getVertexData(e){let t=0;const s=e.paths,i=[],r=e.spatialReference,a=this._context.elevationProvider.spatialReference,o=this._context.renderCoordsHelper.spatialReference;for(const c of s)t+=c.length;const n=y(3*t);let l,h=0;for(const c of s){i.push({offset:h,numVertices:c.length});for(const t of c)n[h++]=t[0],n[h++]=t[1],n[h++]=e.hasZ?t[2]:0}return null==a||r.equals(a)||p(n,r,0,n,a,0,t)?(null==a||a.equals(o)?l=b(n):(l=y(3*t),p(n,a,0,l,o,0,t)),{pathVertexDataInfos:i,vertexDataES:n,vertexDataRS:l}):null}_createAs3DShape(e,r,a,o){this.usedMemory=0;const n=e.geometry,h=this._getVertexData(n);if(null==h)return this.logger.warn("PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)"),null;if(0===h.pathVertexDataInfos.length)return 0!==n.paths.length&&n.paths.some((e=>e.length>0))||this.logger.warn("PathSymbol3DLayer geometry failed to be created (no paths were defined)"),null;const c=new Array,p=n.spatialReference,y=m(),b=this._context.renderCoordsHelper,v=new k(h.vertexDataES);for(const m of h.pathVertexDataInfos){const n=m.numVertices;if(n<2)continue;const g=m.offset;if(null!=this._context.clippingExtent&&(d(y),f(y,h.vertexDataES,g,n),!u(y,this._context.clippingExtent)))continue;const w=new Array,x=g+3*n;for(let e=g;e<x;e+=3){v.offset=e;const t=_(v,this._context.elevationProvider,a,b);l(oe,h.vertexDataRS[e],h.vertexDataRS[e+1],h.vertexDataRS[e+2]),b.setAltitude(oe,t),h.vertexDataRS[e]=oe[0],h.vertexDataRS[e+1]=oe[1],h.vertexDataRS[e+2]=oe[2],w.push(Q(this._upVectorAlignment))}const P=new z(w,h.vertexDataES,h.vertexDataRS,g);se(P,this._upVectorAlignment,this._context.renderCoordsHelper);const j=new I(P,this._profile,this._extruder,this._startCap,this._endCap);let S=null;if(this._fastUpdates){const t=this._fastUpdates.visualVariables,s=U(t.size?.field,e)??0,i=U(t.color?.field,e)??0,r=U(t.opacity?.field,e)??0;S=new T(j,s,i,r)}else{const e=[this._intrinsicSize[0],this._intrinsicSize[1]];if(this._drivenProperties.size){const t=r.size;e[0]*=ie(t[0],"symbol-value"===t[2]?this.symbolLayer.height||0:t[2],this.symbolLayer.width||0),e[1]*=ie(t[2],"symbol-value"===t[0]?this.symbolLayer.width||0:t[0],this.symbolLayer.height||0)}let t;this._drivenProperties.color&&(t=r.color),this._drivenProperties.opacity&&null!=r.opacity&&(t=t?[t[0],t[1],t[2],r.opacity]:[1,1,1,r.opacity]);const s=new W(j);s.bake(e),t&&s.bakeVertexColors(t),S=s}const D=S.createGeometryData(),C=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerUid:this._context.layer.uid}),L=new H(this._materials[0],D,S,p,this._stencilWidth,C);L.transformation=t(i(),s,j.path.origin),c.push(L),this.usedMemory+=j.usedMemory}if(0===c.length)return null;const x=new A({geometries:c,layerUid:this._context.layer.uid,graphicUid:o}),P=new w(this,x,c,null,null,((e,t,s,i,r)=>ae(e,t,i,r,this._upVectorAlignment)),a);return P.alignedSampledElevation=0,P.needsElevationUpdates=g(a.mode),P}}function se(e,t,s){const{origin:i,positions:r}=e;let a=e.offset;switch(t){default:case F.World:for(const t of e.vertices)oe[0]=r[a++]+i[0],oe[1]=r[a++]+i[1],oe[2]=r[a++]+i[2],s.worldUpAtPosition(oe,oe),t.setFrameFromUpVector(oe);break;case F.Path:oe[0]=r[a]+i[0],oe[1]=r[a+1]+i[1],oe[2]=r[a+2]+i[2],s.worldUpAtPosition(oe,oe),Z(e,oe)}}function ie(e,t,s){switch(e){case"symbol-value":return s;case"proportional":return t;default:return e}}function re(e,t,s,i){let r=0;const{origin:a,vertices:o,positions:n,positionsES:h}=e,c=e.offset+3*o.length;for(let p=e.offset;p<c;p+=3)l(oe,h[p],h[p+1],h[p+2]),s(oe,ne),r+=ne.sampledElevation,oe[0]=n[p]+a[0],oe[1]=n[p+1]+a[1],oe[2]=n[p+2]+a[2],i.setAltitude(oe,ne.z),n[p]=oe[0]-a[0],n[p+1]=oe[1]-a[1],n[p+2]=oe[2]-a[2];return e.updatePathVertexInformation(),r/o.length}function ae(e,t,s,i,r){const a=e.stageObject,o=a.geometries;let n=0;for(const l of o){if(!N(l))continue;const e=l.path,o=e.builder.path;n+=re(o,t,s,i),r!==F.World&&se(o,r,i),e.onPathChanged(l),l.invalidateBoundingInfo(),a.geometryVertexAttributeUpdated(l,X.POSITION)}return n/o.length}const oe=c(),ne=new v;export{te as Graphics3DPathSymbolLayer};
|