@arcgis/core 4.28.0-next.20230921 → 4.28.0-next.20230922
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/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/date.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/arcade/functions/featuresetstats.js +1 -1
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{2cb36f9686693234991a.js → 07a2dab2f645dcd7d8d6.js} +1 -1
- 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/{580039dd491854ca325c.js → 21fc02f0d5716c4a7acd.js} +1 -1
- package/assets/esri/core/workers/chunks/{072b4e041b8630c513a0.js → 243b1f9b2fba02946481.js} +1 -1
- package/assets/esri/core/workers/chunks/{dff1c3c38dda2bd1a9d6.js → 246a954347fe9318190e.js} +1 -1
- package/assets/esri/core/workers/chunks/{314c307e30f308a40a28.js → 25b09e9c0511c8e1cf8a.js} +1 -1
- package/assets/esri/core/workers/chunks/28a5ef2e2daa4207dd8b.js +1 -0
- package/assets/esri/core/workers/chunks/2b017e1aa1be71974c2e.js +1 -0
- package/assets/esri/core/workers/chunks/425b5733bb88e6efe242.js +1 -0
- package/assets/esri/core/workers/chunks/{c9dfb145f0c1d93e0fbd.js → 4bcca5fffb1fcc2d4353.js} +1 -1
- 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/{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/609a475ab395f2ce63e2.js +1 -0
- 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/{bbc0dcd316c5598bc9ad.js → 74368a5213def6c200a2.js} +1 -1
- package/assets/esri/core/workers/chunks/78e7af899d9d50aa7e74.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/83a15aa4b1c5252c651b.js +1 -0
- package/assets/esri/core/workers/chunks/85e436decdd693f240ee.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/{1f7e041140088f8ac489.js → 97073a60f0ea2a397165.js} +1 -1
- package/assets/esri/core/workers/chunks/{101f776316a85b708927.js → a99070ec4c06c435b744.js} +1 -1
- package/assets/esri/core/workers/chunks/{21a9c8aa2a9e9990df41.js → b499b4fa771e8c422b43.js} +1 -1
- package/assets/esri/core/workers/chunks/bffad8aec92f982cc75a.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/{3ca759f72d3bb29e9ea9.js → e14da83329f7771135bc.js} +2 -2
- 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/fb87fd64411b78afea23.js +1 -0
- 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/config.js +1 -1
- package/core/Accessor.js +1 -1
- package/core/has.js +1 -1
- package/core/sql/DateOnly.js +1 -1
- package/core/sql/WhereClause.js +1 -1
- package/core/sql.js +1 -1
- package/identity/IdentityForm.js +1 -1
- package/identity/IdentityModal.js +1 -1
- package/interfaces.d.ts +28 -199
- package/layers/OrientedImageryLayer.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/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/networks/Network.js +1 -1
- package/package.json +1 -1
- package/rest/featureService/FeatureService.js +1 -1
- package/support/arcadeUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/support/svgUtils.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/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.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/support/DisplayGL.js +1 -1
- package/views/2d/webglDeps.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/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/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/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/webgl/Texture.js +1 -1
- package/views/webgl/contextUtils.js +1 -1
- package/widgets/AreaMeasurement2D.js +1 -1
- package/widgets/AreaMeasurement3D.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/support/FeatureContentMixin.js +1 -1
- package/widgets/Feature/support/FeatureElementInfo.js +1 -1
- package/widgets/Feature.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.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/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.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/assets/esri/core/workers/chunks/092920c25cac89c038ee.js +0 -1
- package/assets/esri/core/workers/chunks/1b3655f5bf5d90fa8730.js +0 -1
- package/assets/esri/core/workers/chunks/1cf7bb514e7eefc3e9c6.js +0 -1
- package/assets/esri/core/workers/chunks/24629402c647ef6b5f6b.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/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/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/c4bb67150ccd01ea6014.js +0 -1
- package/assets/esri/core/workers/chunks/c60cf62f374e71e562fc.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/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/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"../../../../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};
|
|
@@ -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 t from"../../../../core/Accessor.js";import{forEach as s,result as l}from"../../../../core/asyncUtils.js";import i from"../../../../core/Logger.js";import{someMap as a}from"../../../../core/MapUtils.js";import{disposeMaybe as r,abortMaybe as o}from"../../../../core/maybe.js";import{throwIfAborted as n,isAbortError as c}from"../../../../core/promiseUtils.js";import{watch as h}from"../../../../core/reactiveUtils.js";import{property as b}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{f as u}from"../../../../chunks/vec2f64.js";import{hydrateGraphic as p}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as y}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as g}from"../../../../symbols/callouts/calloutUtils.js";import{VisibilityGroup as f,VisibilityFlag as m}from"./enums.js";import{make as x}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutSymbolLayerRenderingInfo as C,LineCalloutCreationContext as _}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as L}from"./graphicSymbolUtils.js";import{LabelParameters as v}from"./LabelParameters.js";import{getLabelPlacement as T,LabelInfo as A}from"./labelPlacement.js";import{horizontalPlacementFromAnchor as D,verticalPlacementFromAnchor as G,textRenderAlignmentFromHorizontalPlacement as w}from"./placementUtils.js";import{MaterialCollection as I}from"../../webgl-engine/lib/MaterialCollection.js";import{TextRenderer as R}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as S}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as P}from"../../webgl-engine/lib/TextTextureAtlas.js";import{WebGLLayer as j}from"../../webgl-engine/lib/WebGLLayer.js";import{TaskPriority as E,Task as O}from"../../../support/Scheduler.js";class z{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.addedToTextureAtlas=!1,this.textInitialized=!1,this.textRenderers=new Array,this.textLabelPlacements=new Array}}class V{constructor(e,t,s,l,i){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=s,this.textRenderParameters=l,this.labelFunction=i,this.calloutSymbolLayerIndex=0}}class F{constructor(e,t,s,l,i,a,r,o){this.layer=t,this.graphics3DCore=s,this.scaleVisibility=l,this.emptySymbolLabelSupported=i,this.elevationInfoOverride=a,this.disablePlacement=r,this.active=o,this.labelClassAbortController=new AbortController,this.labelClassContexts=new Array,this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new j(e,{pickable:!0,disableOctree:!0},t.uid)}destroy(){this.stageLayer.destroy()}}let M=class extends t{constructor(e){super(e),this._dirty=!1,this._labels=new Map,this._labelingContexts=new Array}setup(){this.dispose(),this.addHandles([h((()=>this.view.state?.camera),(()=>this.setDirty())),h((()=>this.view.state?.rasterPixelRatio),(()=>this._resetAllLabels())),this.view.resourceController.scheduler.registerTask(E.LABELER,this)]),this._textTextureAtlas=new P({view:this.view}),this._hudMaterialCollection=new I(this.view._stage),this._calloutMaterialCollection=new I(this.view._stage)}dispose(){this.removeAllHandles(),this._textTextureAtlas=r(this._textTextureAtlas),this._hudMaterialCollection=r(this._hudMaterialCollection),this._calloutMaterialCollection=r(this._calloutMaterialCollection),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),H.graphic=null,H.renderingInfo=null,H.layer=null}_activateLabelingContext(e){e.graphics.forEach(((t,s)=>{const l=new z(e,t);this._labels.set(s,l),e.labelsToInitialize.set(s,l),t.setVisibilityFlag(f.LABEL,m.USER,!0)})),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach(((e,t)=>{e.setVisibilityFlag(f.LABEL,m.USER,!1),this.setLabelGraphicVisibility(e,!1),this._labels.delete(t)})),e.active=!1}_addLabelTextureToAtlas(e){for(const t of e.graphics3DGraphic.labelLayers){if(!t._labelClass)continue;const s=e.textRenderers[t._labelIndex];s&&(this._textTextureAtlas.addTextTexture(s,t.stageObject),e.addedToTextureAtlas=!0)}}_removeLabelTextureFromAtlas(e){for(const t of e.graphics3DGraphic.labelLayers){if(!t._labelClass)continue;const s=e.textRenderers[t._labelIndex];null!=s&&(this._textTextureAtlas.removeTextTexture(s,t.stageObject),e.addedToTextureAtlas=!1)}}get running(){return this.view.ready&&(this._dirty||this.deconflictor.running)}runTask(e){return this._updateLabels(e),!this._dirty&&this.deconflictor.running&&this.deconflictor.runTask(e),O.YIELD}_updateLabels(e){if(this._dirty){this._dirty=!1;for(const t of this._labelingContexts)if(t.active)if(U(t))this._dirty=!0;else if(k(t.labelClassContexts)){if(null===t.labelClassContexts){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else a(t.labelsToInitialize,((s,l)=>(this._ensureGraphics3DResources(s)&&(this._labels.set(l,s),this.deconflictor.setDirty(),e.madeProgress()),(s.visible&&s.textInitialized||!s.visible&&s.hasGraphics3DResources)&&(t.labelsToInitialize.delete(l),e.madeProgress()),e.done)))&&(this._dirty=!0);this._dirty||this.notifyChange("updating")}}async _createLabelClassContextAsync(e){const t=e.labelClassAbortController?.signal;e.layer.when&&await e.layer.when(),n(t),e.scaleVisibility&&e.scaleVisibility.updateScaleRangeActive();const a=e.graphics3DCore,r=a.layer,o=r.labelingInfo&&r.labelingInfo.filter((e=>!!e.symbol));if(!o||0===o.length)return;let c=!1;await s(o,(async(s,r)=>{const o=s.symbol,h=L(a.getOrCreateGraphics3DSymbol(o));if(null==h)return void i.getLogger(this).error("Failed to create Graphics3DSymbol for label");await h.load(),n(t);let b=null;g(o)&&o.hasVisibleCallout()&&(b=x(o,a.symbolCreationContext),await b.load(),n(t));const d=await l(y(s,e.layer.fieldsIndex,this.view.spatialReference));if(n(t),!0===d.ok){const l=await this._createTextRenderParameters(h.symbol);n(t),e.labelClassContexts[r]=new V(s,h,b,l,d.value)}else i.getLogger(this).error(`Label expression failed to evaluate: ${d.error}`),c=!0})),n(t)}async _createLabelClassContext(e){return null==e.labelClassPromise&&(e.labelClassPromise=this._createLabelClassContextAsync(e).catch((t=>{if(c(t))throw t;e.labelClassContexts.length=0})).then((()=>{e.labelClassAbortController=null,this.notifyChange("updating")})).catch((()=>{})),this.notifyChange("updating")),e.labelClassPromise}async _createTextRenderParameters(e){const t=e.symbolLayers.at(0);return"text"!==t?.type?null:S.fromSymbol(t,this.view.state.rasterPixelRatio)}_destroyLabelClassContext(e){for(const s of e.labelClassContexts)--s.graphics3DSymbol.referenced;const t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,o(t),e.labelClassContexts.length=0,e.labelClassPromise=null,this.notifyChange("updating")}_createTextSymbolGraphic(e,t,s,l,i,a){const r=new v(s,D(s.anchor),G(s.anchor),e.text,u(e.displayWidth,e.displayHeight));return H.graphic=t,H.renderingInfo=null,H.layer=l,i.createLabel(H,r,this._hudMaterialCollection,this._textTextureAtlas,(()=>{const e=T(a);return e?e.elevationOffset:null}))}_createLineCalloutGraphic(e,t,s,l,i){H.graphic=e,H.layer=i;const a=l.screenOffset[0];return H.renderingInfo=new C(null,t,l.translation,l.centerOffset,a,l.centerOffsetUnits,l.elevationOffset,this._calloutMaterialCollection),s.createGraphics3DGraphic(H)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;const t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);const s=e.labelingContext,l=s.labelClassContexts;if(k(l)||!s.emptySymbolLabelSupported&&0===t.layers.length)return!1;let i=!1;const a=t.graphic,r=s.layer,o=B(s.layer);for(let n=0;n<l.length;n++){const c=e.textRenderers[n],h=e.textLabelPlacements[n];if(null==c||null==h)continue;const b=l[n],d=b.graphics3DSymbol,u=d.symbol&&"label-3d"===d.symbol.type?d.symbol:null,p=d.symbolLayers[0];if(!p)continue;p.setElevationInfoOverride(s.elevationInfoOverride);const y=new A(t,u,b.labelClass),g=this._createTextSymbolGraphic(c,a,h,r,p,y);if(null==g)return!1;g._labelClass=b.labelClass,g._labelIndex=n,t.addLabelGraphic(g,s.stageLayer),t.deconflictionPriority=b.textRenderParameters?.definition.size??0,t.setVisibilityFlag(f.LABEL,m.USER,o),t.setVisibilityFlag(f.LABEL,m.SCALE_RANGE,!0),t.setVisibilityFlag(f.LABEL,m.DECONFLICTION,!1),i=!0;const x=b.graphics3DCalloutSymbolLayer;if(x&&h.hasLabelVerticalOffset){x.setElevationInfoOverride(s.elevationInfoOverride);const e=this._createLineCalloutGraphic(a,u,x,h,r);null!=e&&(b.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,s.stageLayer))}break}return s.scaleVisibility&&i&&s.scaleVisibility.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){const t=e.labelingContext.labelClassContexts;for(const s of e.graphics3DGraphic.labelLayers){if(null==s._labelClass)continue;const e=t[s._labelIndex].graphics3DSymbol.symbolLayers[0];e?.onRemoveGraphic(s)}e.graphics3DGraphic.deconflictionPriority=0,e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;const t=e.labelingContext,s=t.labelClassContexts;if(k(s))return;const l=e.graphics3DGraphic.graphic;for(let a=0;a<s.length;a++){const r=s[a];if(e.textRenderers[a]=null,e.textLabelPlacements[a]=null,null==r?.textRenderParameters)continue;const o=r.labelFunction;let n;if("arcade"===o.type)try{const e=o.needsHydrationToEvaluate()?p(l,t.layer):l;n=o.evaluate(e)}catch(i){n=null}else n=o.evaluate(l);if(null==n||""===n||/^\s+$/.test(n))continue;const c=r.graphics3DSymbol,h="label-3d"===c.symbol?.type?c.symbol:null;if(!c.symbolLayers[0])continue;const b=e.graphics3DGraphic,d=r.labelClass,u=t.disablePlacement,y=T({graphics3DGraphic:b,labelSymbol:h,labelClass:d,disablePlacement:u});if(null==y)continue;const g=D(y.anchor),f=w(g);e.textRenderers[a]=new R(n,f,r.textRenderParameters,this._textTextureAtlas.maxSize),e.textLabelPlacements[a]=y}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){const s=t.graphic.uid;if(e.graphics.set(s,t),e.active){const l=new z(e,t);this._labels.set(s,l),e.labelsToInitialize.set(s,l)}this.setDirty(),this.deconflictor.setDirty()}_removeGraphic(e,t){const s=t.graphic.uid,l=this._labels.get(s);e.graphics.delete(s),l&&(this._destroyGraphic(l,s),e.labelsToInitialize.delete(s),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.delete(t),e.addedToTextureAtlas&&this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(!t)return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e);for(const s of t){const t=e.graphics.get(s);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}}_globalPropertyChanged(e,t){for(const s of t.labelClassContexts){const l=new Map;t.graphics.forEach((e=>l.set(e.graphic.uid,e)));const i=e=>e.labelLayers[0];if(s.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,l,i),s.graphics3DCalloutSymbolLayer){const t=e=>e.labelLayers[s.calloutSymbolLayerIndex];s.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,l,t)}}}_visibilityInfoChange(e){const t=B(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(const e of this._labelingContexts)this._resetLabels(e)}_resetLabels(e){e.graphics.forEach(((t,s)=>{const l=this._labels.get(s);l&&(this._destroyGraphic(l,s),l.visible=!1,e.labelsToInitialize.set(s,l))})),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(const t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,s){const l=s&&s.emptySymbolLabelSupported||!1,i=s&&s.elevationInfoOverride||null,a=s&&s.disablePlacement||null;if(this._findLabelingContext(e))return;const r=e.layer,o=new F(this.view._stage,r,e,t,l,i,a,B(r));return this._labelingContexts.push(o),this.setDirty(),{addGraphic:e=>this._addGraphic(o,e),removeGraphic:e=>this._removeGraphic(o,e),featureReductionChange:()=>{},layerLabelsEnabled:()=>B(o.layer),labelingInfoChange:e=>this._labelingInfoChange(o,e),elevationInfoChange:()=>this._globalPropertyChanged("elevationInfo",o),slicePlaneEnabledChange:()=>this._globalPropertyChanged("slicePlaneEnabled",o),visibilityInfoChange:()=>this._visibilityInfoChange(o),reset:()=>this._resetLabels(o),clear:()=>{}}}removeGraphicsOwner(e){const t=this._findLabelingContext(e);if(!t)return;const s=this._labelingContexts.indexOf(t);this._labelingContexts.splice(s,1),t.graphics.forEach((e=>this._removeGraphic(t,e))),t.destroy(),this.setDirty()}setLabelGraphicVisibility(e,t){const s=e.graphic.uid,l=this._labels.get(s);l&&l.visible!==t&&(t&&!l.addedToTextureAtlas?(this._addLabelTextureToAtlas(l),l.textInitialized||l.labelingContext.labelsToInitialize.set(s,l)):!t&&l.addedToTextureAtlas&&this._removeLabelTextureFromAtlas(l),l.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some((e=>U(e)))}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;const e=this._labelingContexts.length>0?this._labelingContexts.reduce(((e,t)=>e+(U(t)?0:1)),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+.1*e+.5*this.deconflictor.updatingProgress}get test(){return{textTextureAtlas:this._textTextureAtlas,resetAllLabels:()=>this._resetAllLabels()}}};function U(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function k(e){return!e||0===e.length}function B(e){return!0===e.labelsVisible&&!!e.labelingInfo?.some((e=>!!e.symbol))}e([b({constructOnly:!0})],M.prototype,"view",void 0),e([b({constructOnly:!0})],M.prototype,"deconflictor",void 0),e([b()],M.prototype,"_textTextureAtlas",void 0),e([b({type:Boolean,readOnly:!0})],M.prototype,"updating",null),M=e([d("esri.views.3d.layers.graphics.Labeler")],M);const H=new _(null,null,null);export{M as Labeler,B as areLabelsVisible};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{forEach as s,result as l}from"../../../../core/asyncUtils.js";import i from"../../../../core/Logger.js";import{someMap as a}from"../../../../core/MapUtils.js";import{disposeMaybe as r,abortMaybe as o}from"../../../../core/maybe.js";import{throwIfAborted as n,isAbortError as c}from"../../../../core/promiseUtils.js";import{watch as h}from"../../../../core/reactiveUtils.js";import{property as b}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{f as u}from"../../../../chunks/vec2f64.js";import{hydrateGraphic as p}from"../../../../layers/graphics/hydratedFeatures.js";import{createLabelFunction as y}from"../../../../layers/support/labelFormatUtils.js";import{hasCalloutSupport as g}from"../../../../symbols/callouts/calloutUtils.js";import{VisibilityGroup as f,VisibilityFlag as m}from"./enums.js";import{make as x}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutSymbolLayerRenderingInfo as C,LineCalloutCreationContext as _}from"./Graphics3DLineCalloutSymbolLayer.js";import{getGraphics3DSymbol as L}from"./graphicSymbolUtils.js";import{LabelParameters as v}from"./LabelParameters.js";import{getLabelPlacement as T,LabelInfo as A}from"./labelPlacement.js";import{horizontalPlacementFromAnchor as D,verticalPlacementFromAnchor as G,textRenderAlignmentFromHorizontalPlacement as w}from"./placementUtils.js";import{MaterialCollection as I}from"../../webgl-engine/lib/MaterialCollection.js";import{TextRenderer as R}from"../../webgl-engine/lib/TextRenderer.js";import{TextRenderParameters as S}from"../../webgl-engine/lib/TextRenderParameters.js";import{TextTextureAtlas as P}from"../../webgl-engine/lib/TextTextureAtlas.js";import{WebGLLayer as j}from"../../webgl-engine/lib/WebGLLayer.js";import{TaskPriority as E,Task as O}from"../../../support/Scheduler.js";class z{constructor(e,t){this.labelingContext=e,this.graphics3DGraphic=t,this.hasGraphics3DResources=!1,this.visible=!1,this.addedToTextureAtlas=!1,this.textInitialized=!1,this.textRenderers=new Array,this.textLabelPlacements=new Array}}class V{constructor(e,t,s,l,i){this.labelClass=e,this.graphics3DSymbol=t,this.graphics3DCalloutSymbolLayer=s,this.textRenderParameters=l,this.labelFunction=i,this.calloutSymbolLayerIndex=0}}class F{constructor(e,t,s,l,i,a,r,o){this.layer=t,this.graphics3DCore=s,this.scaleVisibility=l,this.emptySymbolLabelSupported=i,this.elevationInfoOverride=a,this.disablePlacement=r,this.active=o,this.labelClassAbortController=new AbortController,this.labelClassContexts=new Array,this.graphics=new Map,this.labelsToInitialize=new Map,this.stageLayer=new j(e,{pickable:!0,disableOctree:!0},t.uid)}destroy(){this.stageLayer.destroy()}}let M=class extends t{constructor(e){super(e),this._dirty=!1,this._labels=new Map,this._labelingContexts=new Array}setup(){this.dispose(),this.addHandles([h((()=>this.view.state?.camera),(()=>this.setDirty())),h((()=>this.view.state?.rasterPixelRatio),(()=>this._resetAllLabels())),this.view.resourceController.scheduler.registerTask(E.LABELER,this)]),this._textTextureAtlas=new P({view:this.view}),this._hudMaterialCollection=new I(this.view._stage),this._calloutMaterialCollection=new I(this.view._stage)}dispose(){this.removeAllHandles(),this._textTextureAtlas=r(this._textTextureAtlas),this._hudMaterialCollection=r(this._hudMaterialCollection),this._calloutMaterialCollection=r(this._calloutMaterialCollection),this._labelingContexts.length=0,this._labels.clear()}destroy(){this.dispose(),H.graphic=null,H.renderingInfo=null,H.layer=null}_activateLabelingContext(e){e.graphics.forEach(((t,s)=>{const l=new z(e,t);this._labels.set(s,l),e.labelsToInitialize.set(s,l),t.setVisibilityFlag(f.LABEL,m.USER,!0)})),e.active=!0}_deactivateLabelingContext(e){e.graphics.forEach(((e,t)=>{e.setVisibilityFlag(f.LABEL,m.USER,!1),this.setLabelGraphicVisibility(e,!1),this._labels.delete(t)})),e.active=!1}_addLabelTextureToAtlas(e){for(const t of e.graphics3DGraphic.labelLayers){if(!t._labelClass)continue;const s=e.textRenderers[t._labelIndex];s&&(this._textTextureAtlas.addTextTexture(s,t.stageObject),e.addedToTextureAtlas=!0)}}_removeLabelTextureFromAtlas(e){for(const t of e.graphics3DGraphic.labelLayers){if(!t._labelClass)continue;const s=e.textRenderers[t._labelIndex];null!=s&&(this._textTextureAtlas.removeTextTexture(s,t.stageObject),e.addedToTextureAtlas=!1)}}get running(){return this.view.ready&&(this._dirty||this.deconflictor.running)}runTask(e){return this._updateLabels(e),!this._dirty&&this.deconflictor.running&&this.deconflictor.runTask(e),O.YIELD}_updateLabels(e){if(this._dirty){this._dirty=!1;for(const t of this._labelingContexts)if(t.active)if(U(t))this._dirty=!0;else if(k(t.labelClassContexts)){if(null===t.labelClassContexts){this._deactivateLabelingContext(t);continue}this._createLabelClassContext(t),this._dirty=!0}else a(t.labelsToInitialize,((s,l)=>(this._ensureGraphics3DResources(s)&&(this._labels.set(l,s),this.deconflictor.setDirty(),e.madeProgress()),(s.visible&&s.textInitialized||!s.visible&&s.hasGraphics3DResources)&&(t.labelsToInitialize.delete(l),e.madeProgress()),e.done)))&&(this._dirty=!0);this._dirty||this.notifyChange("updating")}}async _createLabelClassContextAsync(e){const t=e.labelClassAbortController?.signal;e.layer.when&&await e.layer.when(),n(t),e.scaleVisibility&&e.scaleVisibility.updateScaleRangeActive();const a=e.graphics3DCore,r=a.layer,o=r.labelingInfo&&r.labelingInfo.filter((e=>!!e.symbol));if(!o||0===o.length)return;let c=!1;await s(o,(async(s,r)=>{const o=s.symbol,h=L(a.getOrCreateGraphics3DSymbol(o));if(null==h)return void i.getLogger(this).error("Failed to create Graphics3DSymbol for label");await h.load(),n(t);let b=null;g(o)&&o.hasVisibleCallout()&&(b=x(o,a.symbolCreationContext),await b.load(),n(t));const d=await l(y(s,e.layer.fieldsIndex,this.view.spatialReference));if(n(t),!0===d.ok){const l=await this._createTextRenderParameters(h.symbol);n(t),e.labelClassContexts[r]=new V(s,h,b,l,d.value)}else i.getLogger(this).error(`Label expression failed to evaluate: ${d.error}`),c=!0})),n(t)}async _createLabelClassContext(e){return null==e.labelClassPromise&&(e.labelClassPromise=this._createLabelClassContextAsync(e).catch((t=>{if(c(t))throw t;e.labelClassContexts.length=0})).then((()=>{e.labelClassAbortController=null,this.notifyChange("updating")})).catch((()=>{})),this.notifyChange("updating")),e.labelClassPromise}async _createTextRenderParameters(e){const t=e.symbolLayers.at(0);return"text"!==t?.type?null:S.fromSymbol(t,this.view.state.rasterPixelRatio)}_destroyLabelClassContext(e){for(const s of e.labelClassContexts)--s.graphics3DSymbol.referenced;const t=e.labelClassAbortController;e.labelClassAbortController=new AbortController,o(t),e.labelClassContexts.length=0,e.labelClassPromise=null,this.notifyChange("updating")}_createTextSymbolGraphic(e,t,s,l,i,a){const r=new v(s,D(s.anchor),G(s.anchor),e.text,u(e.displayWidth,e.displayHeight));return H.graphic=t,H.renderingInfo=null,H.layer=l,i.createLabel(H,r,this._hudMaterialCollection,this._textTextureAtlas,(()=>{const e=T(a);return e?e.elevationOffset:null}))}_createLineCalloutGraphic(e,t,s,l,i){H.graphic=e,H.layer=i;const a=l.screenOffset[0];return H.renderingInfo=new C(null,t,l.translation,l.centerOffset,a,l.centerOffsetUnits,l.elevationOffset,this._calloutMaterialCollection),s.createGraphics3DGraphic(H)}_ensureGraphics3DResources(e){if(e.hasGraphics3DResources)return!1;const t=e.graphics3DGraphic;if(t.destroyed)return!1;this._ensureTextTextureResources(e);const s=e.labelingContext,l=s.labelClassContexts;if(k(l)||!s.emptySymbolLabelSupported&&0===t.layers.length)return!1;let i=!1;const a=t.graphic,r=s.layer,o=B(s.layer);for(let n=0;n<l.length;n++){const c=e.textRenderers[n],h=e.textLabelPlacements[n];if(null==c||null==h)continue;const b=l[n],d=b.graphics3DSymbol,u=d.symbol&&"label-3d"===d.symbol.type?d.symbol:null,p=d.symbolLayers[0];if(!p)continue;p.setElevationInfoOverride(s.elevationInfoOverride);const y=new A(t,u,b.labelClass),g=this._createTextSymbolGraphic(c,a,h,r,p,y);if(null==g)return!1;g._labelClass=b.labelClass,g._labelIndex=n,t.addLabelGraphic(g,s.stageLayer),t.deconflictionPriority=b.textRenderParameters?.definition.size??0,t.setVisibilityFlag(f.LABEL,m.USER,o),t.setVisibilityFlag(f.LABEL,m.SCALE_RANGE,!0),t.setVisibilityFlag(f.LABEL,m.DECONFLICTION,!1),i=!0;const x=b.graphics3DCalloutSymbolLayer;if(x&&h.hasLabelVerticalOffset){x.setElevationInfoOverride(s.elevationInfoOverride);const e=this._createLineCalloutGraphic(a,u,x,h,r);null!=e&&(b.calloutSymbolLayerIndex=t.labelLayers.length,t.addLabelGraphic(e,s.stageLayer))}break}return s.scaleVisibility&&i&&s.scaleVisibility.updateGraphicLabelScaleVisibility(t),e.hasGraphics3DResources=!0,!0}_destroyGraphics3DResources(e){const t=e.labelingContext.labelClassContexts;for(const s of e.graphics3DGraphic.labelLayers){if(null==s._labelClass)continue;const e=t[s._labelIndex].graphics3DSymbol.symbolLayers[0];e?.onRemoveGraphic(s)}e.graphics3DGraphic.deconflictionPriority=0,e.graphics3DGraphic.clearLabelGraphics(),e.hasGraphics3DResources=!1}_ensureTextTextureResources(e){if(e.textInitialized)return;const t=e.labelingContext,s=t.labelClassContexts;if(k(s))return;const l=e.graphics3DGraphic.graphic;for(let a=0;a<s.length;a++){const r=s[a];if(e.textRenderers[a]=null,e.textLabelPlacements[a]=null,null==r?.textRenderParameters)continue;const o=r.labelFunction;let n;if("arcade"===o.type)try{const e=o.needsHydrationToEvaluate()?p(l,t.layer):l;n=o.evaluate(e)}catch(i){n=null}else n=o.evaluate(l);if(null==n||""===n||/^\s+$/.test(n))continue;const c=r.graphics3DSymbol,h="label-3d"===c.symbol?.type?c.symbol:null;if(!c.symbolLayers[0])continue;const b=e.graphics3DGraphic,d=r.labelClass,u=t.disablePlacement,y=T({graphics3DGraphic:b,labelSymbol:h,labelClass:d,disablePlacement:u});if(null==y)continue;const g=D(y.anchor),f=w(g);e.textRenderers[a]=new R(n,f,r.textRenderParameters,P.maxSize),e.textLabelPlacements[a]=y}e.textInitialized=!0}_destroyTextTextureResources(e){e.textInitialized=!1,e.textRenderers.length=0,e.textLabelPlacements.length=0}_addGraphic(e,t){const s=t.graphic.uid;if(e.graphics.set(s,t),e.active){const l=new z(e,t);this._labels.set(s,l),e.labelsToInitialize.set(s,l)}this.setDirty(),this.deconflictor.setDirty()}_removeGraphic(e,t){const s=t.graphic.uid,l=this._labels.get(s);e.graphics.delete(s),l&&(this._destroyGraphic(l,s),e.labelsToInitialize.delete(s),this.setDirty(),this.deconflictor.setDirty())}_destroyGraphic(e,t){this._labels.delete(t),e.addedToTextureAtlas&&this._removeLabelTextureFromAtlas(e),this._destroyTextTextureResources(e),e.hasGraphics3DResources&&this._destroyGraphics3DResources(e)}async _labelingInfoChange(e,t){if(!t)return this._visibilityInfoChange(e),this._resetLabels(e),this._createLabelClassContext(e);for(const s of t){const t=e.graphics.get(s);t&&(this._removeGraphic(e,t),this._addGraphic(e,t))}}_globalPropertyChanged(e,t){for(const s of t.labelClassContexts){const l=new Map;t.graphics.forEach((e=>l.set(e.graphic.uid,e)));const i=e=>e.labelLayers[0];if(s.graphics3DSymbol.symbolLayers[0].globalPropertyChanged(e,l,i),s.graphics3DCalloutSymbolLayer){const t=e=>e.labelLayers[s.calloutSymbolLayerIndex];s.graphics3DCalloutSymbolLayer.globalPropertyChanged(e,l,t)}}}_visibilityInfoChange(e){const t=B(e.layer);t&&!e.active&&this._activateLabelingContext(e),!t&&e.active&&this._deactivateLabelingContext(e),this.setDirty()}_resetAllLabels(){for(const e of this._labelingContexts)this._resetLabels(e)}_resetLabels(e){e.graphics.forEach(((t,s)=>{const l=this._labels.get(s);l&&(this._destroyGraphic(l,s),l.visible=!1,e.labelsToInitialize.set(s,l))})),this._destroyLabelClassContext(e),this.setDirty(),this.deconflictor.setDirty()}_findLabelingContext(e){for(const t of this._labelingContexts)if(t.graphics3DCore===e)return t;return null}addGraphicsOwner(e,t,s){const l=s&&s.emptySymbolLabelSupported||!1,i=s&&s.elevationInfoOverride||null,a=s&&s.disablePlacement||null;if(this._findLabelingContext(e))return;const r=e.layer,o=new F(this.view._stage,r,e,t,l,i,a,B(r));return this._labelingContexts.push(o),this.setDirty(),{addGraphic:e=>this._addGraphic(o,e),removeGraphic:e=>this._removeGraphic(o,e),featureReductionChange:()=>{},layerLabelsEnabled:()=>B(o.layer),labelingInfoChange:e=>this._labelingInfoChange(o,e),elevationInfoChange:()=>this._globalPropertyChanged("elevationInfo",o),slicePlaneEnabledChange:()=>this._globalPropertyChanged("slicePlaneEnabled",o),visibilityInfoChange:()=>this._visibilityInfoChange(o),reset:()=>this._resetLabels(o),clear:()=>{}}}removeGraphicsOwner(e){const t=this._findLabelingContext(e);if(!t)return;const s=this._labelingContexts.indexOf(t);this._labelingContexts.splice(s,1),t.graphics.forEach((e=>this._removeGraphic(t,e))),t.destroy(),this.setDirty()}setLabelGraphicVisibility(e,t){const s=e.graphic.uid,l=this._labels.get(s);l&&l.visible!==t&&(t&&!l.addedToTextureAtlas?(this._addLabelTextureToAtlas(l),l.textInitialized||l.labelingContext.labelsToInitialize.set(s,l)):!t&&l.addedToTextureAtlas&&this._removeLabelTextureFromAtlas(l),l.visible=t,this.setDirty())}setDirty(){!this._dirty&&this._labelingContexts.length>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._dirty||this._textTextureAtlas?.updating||this.deconflictor.updating||this._labelingContexts.some((e=>U(e)))}get updatingProgress(){if(!this.updating||!this._textTextureAtlas)return 1;const e=this._labelingContexts.length>0?this._labelingContexts.reduce(((e,t)=>e+(U(t)?0:1)),0)/this._labelingContexts.length:1;return(this._dirty?0:.3)+(this._textTextureAtlas.updating?0:.1)+.1*e+.5*this.deconflictor.updatingProgress}get test(){return{textTextureAtlas:this._textTextureAtlas,resetAllLabels:()=>this._resetAllLabels()}}};function U(e){return!!e.labelClassPromise&&!!e.labelClassAbortController}function k(e){return!e||0===e.length}function B(e){return!0===e.labelsVisible&&!!e.labelingInfo?.some((e=>!!e.symbol))}e([b({constructOnly:!0})],M.prototype,"view",void 0),e([b({constructOnly:!0})],M.prototype,"deconflictor",void 0),e([b()],M.prototype,"_textTextureAtlas",void 0),e([b({type:Boolean,readOnly:!0})],M.prototype,"updating",null),M=e([d("esri.views.3d.layers.graphics.Labeler")],M);const H=new _(null,null,null);export{M as Labeler,B as areLabelsVisible};
|
|
@@ -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{getMetersPerUnitForSR as t}from"../../../../core/unitUtils.js";import{o as e,r as n,n as r}from"../../../../chunks/mat4.js";import{a as o}from"../../../../chunks/mat4f64.js";import{e as i,O as s}from"../../../../chunks/vec3f64.js";import{s as l}from"../../../../chunks/vec4.js";import{d as u,O as a}from"../../../../chunks/vec4f64.js";import{projectPoint as m}from"../../../../geometry/projection.js";import{width as c,depth as f,height as p}from"../../../../geometry/support/aaBoundingBox.js";import{create as h}from"../../../../geometry/support/aaBoundingRect.js";import{ringsCentroid as g}from"../../../../geometry/support/centroid.js";import{getPointOnPath as y,getPathLength as d}from"../../../../geometry/support/coordsUtils.js";import{makeDehydratedPoint as x}from"../../../../layers/graphics/dehydratedPoint.js";import{isHydratedGeometry as j,clonePoint as b}from"../../../../layers/graphics/hydratedFeatures.js";import{VertexAttribute as v}from"../../webgl-engine/lib/VertexAttribute.js";function w(t,e){if("point"===t.type)return
|
|
5
|
+
import{getMetersPerUnitForSR as t}from"../../../../core/unitUtils.js";import{o as e,r as n,n as r}from"../../../../chunks/mat4.js";import{a as o}from"../../../../chunks/mat4f64.js";import{e as i,O as s}from"../../../../chunks/vec3f64.js";import{s as l}from"../../../../chunks/vec4.js";import{d as u,O as a}from"../../../../chunks/vec4f64.js";import{projectPoint as m}from"../../../../geometry/projection.js";import{width as c,depth as f,height as p}from"../../../../geometry/support/aaBoundingBox.js";import{create as h}from"../../../../geometry/support/aaBoundingRect.js";import{ringsCentroid as g}from"../../../../geometry/support/centroid.js";import{getPointOnPath as y,getPathLength as d}from"../../../../geometry/support/coordsUtils.js";import{makeDehydratedPoint as x}from"../../../../layers/graphics/dehydratedPoint.js";import{isHydratedGeometry as j,clonePoint as b}from"../../../../layers/graphics/hydratedFeatures.js";import{VertexAttribute as v}from"../../webgl-engine/lib/VertexAttribute.js";function w(t,e){if("point"===t.type)return M(t,e,!1);if(j(t))switch(t.type){case"extent":return M(t.center,e,!1);case"polygon":return M(t.centroid,e,!1);case"polyline":return M(A(t),e,!0);case"mesh":return M(t.origin,e,!1)}else switch(t.type){case"extent":return M(P(t),e,!0);case"polygon":return M(z(t),e,!0);case"polyline":return M(A(t),e,!0)}}function A(t){const e=t.paths[0];if(!e||0===e.length)return null;const n=y(e,d(e)/2);return x(n[0],n[1],n[2],t.spatialReference)}function P(t){return x(.5*(t.xmax+t.xmin),.5*(t.ymax+t.ymin),null!=t.zmin&&null!=t.zmax&&isFinite(t.zmin)&&isFinite(t.zmax)?.5*(t.zmax+t.zmin):void 0,t.spatialReference)}function z(t){const e=t.rings[0];if(!e||0===e.length)return null;const n=g(t.rings,!!t.hasZ);return x(n[0],n[1],n[2],t.spatialReference)}function M(t,e,n){const r=n?t:b(t);return e&&t?m(t,r,e)?r:null:r}function R(t,e,n,r=0){if(t){e||(e=h());const o=t;let i=.5*o.width*(n-1),s=.5*o.height*(n-1);return o.width<1e-7*o.height?i+=s/20:o.height<1e-7*o.width&&(s+=i/20),l(e,o.xmin-i-r,o.ymin-s-r,o.xmax+i+r,o.ymax+s+r),e}return null}function k(t,e){for(let n=0;n<t.geometries.length;++n){const r=t.geometries[n].getMutableAttribute(v.AUXPOS1);r&&r.data[3]!==e&&(r.data[3]=e,t.geometryVertexAttributeUpdated(t.geometries[n],v.AUXPOS1))}}function F(t,e,n=null){const r=u(a);return null!=t&&(r[0]=t[0],r[1]=t[1],r[2]=t[2]),null!=e?r[3]=e:null!=t&&t.length>3&&(r[3]=t[3]),n&&(r[0]*=n,r[1]*=n,r[2]*=n,r[3]*=n),r}function U(t,e,n,r,o,i=[0,0,0,0]){for(let s=0;s<3;++s)null!=t&&null!=t[s]?i[s]=t[s]:null!=n&&null!=n[s]?i[s]=n[s]:i[s]=o[s];return i[3]=null!=e?e:null!=r?r:o[3],i}function O(t=s,e,n,r=1){const o=new Array(3);if(null==e||null==n)o[0]=1,o[1]=1,o[2]=1;else{let r,i=0;for(let s=2;s>=0;s--){const l=t[s];let u;const a=null!=l,m=0===s&&!r&&!a,c=n[s];"symbol-value"===l||m?u=0!==c?e[s]/c:1:a&&"proportional"!==l&&isFinite(l)&&(u=0!==c?l/c:1),null!=u&&(o[s]=u,r=u,i=Math.max(i,Math.abs(u)))}for(let t=2;t>=0;t--)null==o[t]?o[t]=r:0===o[t]&&(o[t]=.001*i)}for(let i=2;i>=0;i--)o[i]/=r;return i(o)}function B(t){return null!=t.isPrimitive}function D(t){return I(B(t)?[t.width,t.depth,t.height]:t)?null:"Symbol sizes may not be negative values"}function I(t){const e=t=>null==t||t>=0;return Array.isArray(t)?t.every(e):e(t)}function S(t,i,s,l=o()){return t&&e(l,l,-t/180*Math.PI),i&&n(l,l,i/180*Math.PI),s&&r(l,l,s/180*Math.PI),l}function V(e,n,r){if(null!=r.minDemResolution)return r.minDemResolution;const o=t(n),i=c(e)*o,s=f(e)*o,l=p(e)*(n.isGeographic?1:o);return 0===i&&0===s&&0===l?r.minDemResolutionForPoints:.01*Math.max(i,s,l)}export{w as computeCentroid,S as computeObjectRotation,O as computeObjectScale,V as demResolutionForBoundingBox,R as enlargeExtent,I as isValidSize,F as mixinColorAndOpacity,U as overrideColor,k as updateVertexAttributeAuxpos1w,D as validateSymbolLayerSize};
|
|
@@ -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{clone as t}from"../../../../core/lang.js";import{
|
|
5
|
+
import{resultOrAbort as e}from"../../../../core/asyncUtils.js";import{clone as t}from"../../../../core/lang.js";import{queryAllJSON as n}from"../../../../layers/support/featureQueryAll.js";const o={setAttribute(){},rollback(){},commit(){}};var r;function i(e,n){const i=n.attributes[e.objectIdField];if(null==i)return o;const s=e.sessions.get(i);if(s)return s;const l=t(n.attributes),a=new Set,u=e.i3sOverrides.createInteractiveEditSession(i),d=new Map,f=(e,t)=>{const n=d.get(e);if(null==n){const n=t.indexOf(i);return d.set(e,n),n}return n};let c=r.EDITING;const I={setAttribute(t,o){if(c!==r.EDITING)return;const i=e.fieldsIndex.get(t);if(!i)return;const s=e.attributeStorageInfo.findIndex((e=>e.name===i.name));if(s<0)return;if(!(t in l))throw new Error(`Attribute "${t}" is not an attribute of the edited feature.`);u.setAttribute(s,o);const d=e.attributeStorageInfo[s];let I=!1;a.add(t),e.forEachNode(((t,r)=>{const i=f(t,r);if(-1===i)return;const s=e.getAttributeData(t.index);if(s){const r=s[d.name];r&&(r[i]=o,e.setAttributeData(t.index,s,n),I=!0)}})),I&&e.clearMemCache()},rollback(){if(c===r.EDITING){for(const e of a)this.setAttribute(e,l[e]);u.remove(),c=r.ROLLED_BACK,e.sessions.delete(i)}},commit(){c===r.EDITING&&(u.remove(),c=r.COMMITTED,e.sessions.delete(i))}};return e.sessions.set(i,I),I}function s(e,t,n){const{gidToFeatureInfo:o,oidToFeatureInfo:r,fieldsIndex:i,objectIdField:s,globalIdField:l,featureOrIdentifierList:a}=n;if(!n.featuresResolved&&null!=a){for(const e of a){const t={feature:null,oid:-1,gid:null};if("attributes"in e){t.feature=e;const n=e.attributes;if(null!=n)for(const e in n){if(-1!==t.oid&&null!=t.gid)break;const o=i.normalizeFieldName(e);o===s&&(t.oid=n[e]??-1),o===l&&(t.gid=n[e])}}else t.oid=e.objectId??-1,t.gid=e.globalId;null!=t.gid&&o.set(t.gid,t),-1!==t.oid&&r.set(t.oid,t)}n.featuresResolved=!0}return(-1!==e?r.get(e):null)??(null!=t?o.get(t):null)}function l(e,t,n,o,r=!0){const i=[],l={gidToFeatureInfo:new Map,oidToFeatureInfo:new Map,featuresResolved:null==n,fieldsIndex:e.fieldsIndex,objectIdField:e.objectIdField,globalIdField:e.globalIdField,featureOrIdentifierList:n};for(const a of t){if(null!=a.error)continue;const e=a.objectId??-1,t=a.globalId,n=(-1===e||r?s(e,t,l):null)??{feature:null,oid:e,gid:t},u={oid:-1===e?n.oid:e,gid:t??n.gid,feature:n.feature,result:a};if(i.push(u),-1===u.oid&&null!=u.gid){let e=o.get(u.gid);null==e&&(e=[],o.set(u.gid,e)),e.push(u)}}return i}async function a(e,t){const n=new Map,o=l(e,t.addedFeatures,t.edits?.addFeatures,n),r=l(e,t.updatedFeatures,t.edits?.updateFeatures,n),i=l(e,t.deletedFeatures,t.edits?.deleteFeatures,n,!1);return n.size>0&&await u(e,n),{adds:o.filter((e=>-1!==e.oid)),updates:r.filter((e=>-1!==e.oid)),deletes:i.filter((e=>-1!==e.oid))}}async function u(t,o){const r=t.i3sOverrides.layer.associatedLayer;if(null==r?.globalIdField)return;const i=r.createQuery(),{objectIdField:s,globalIdField:l}=r;i.where=Array.from(o.keys()).map((e=>`${l}='${e}'`)).join(" OR "),i.returnGeometry=!1,i.outFields=[s,l],i.cacheHint=!1;const a=await e(n(r,i));if(!a.ok)return;const u=a.value.features;for(const e of u){const t=e.attributes[l],n=e.attributes[s];if(null==t||null==n||-1===n)continue;const r=o.get(t);if(null!=r)for(const e of r)e.oid=n}}function d(e,t){const n=new Map,o=t.adds,r=t.updates,i=t.deletes;if(o.length>0)for(const s of o){const e=s.oid,t=s.feature;"mesh"===t?.geometry?.type&&n.set(e,t.geometry)}if(r.length>0)for(const s of r){const e=s.oid,t=s.feature;"mesh"===t?.geometry?.type&&n.set(e,t.geometry)}if(i.length>0)for(const s of i)n.set(s.oid,null);for(const[s,l]of n)e.i3sOverrides.updateGeometry(s,l)}function f(e,t){const n=I(e,t),o=c(e,t);if(0===n.size&&0===o.size)return;const r=new Map;for(let c=0;c<e.attributeStorageInfo.length;c++)r.set(e.attributeStorageInfo[c].name,c);let i=!1;n.forEach(((t,n)=>{const o=e.getAttributeData(n);let s=!1;t.forEach(((t,n)=>{const l=null!=o?o[n]:null,a=r.get(n);for(const{featureIndex:o,value:r,featureId:u}of t)l&&(l[o]=r,s=!0,i=!0),e.i3sOverrides.updateAttributeValue(u,a,r)})),s&&e.setAttributeData(n,o,null)})),i&&e.clearMemCache();const{fieldsIndex:s,i3sOverrides:l,objectIdField:a,globalIdField:u}=e,d=l.layer.associatedLayer?.infoFor3D,f=new Set(d?[...Object.values(d.assetMapFieldRoles),...Object.values(d.transformFieldRoles)]:[]);for(const[c,I]of o){l.featureAdded(c);const{attributes:e}=I;for(const t in e){if(t!==a&&t!==u&&f.has(t))continue;const n=s.normalizeFieldName(t),o=null!=n?r.get(n):null;if(null==o)continue;const i=e[t];l.updateAttributeValue(c,o,i)}}}function c(e,t){const n=new Map,o=t.adds;if(!o||0===o.length||null==e.globalIdField)return n;for(const r of o){const e=r.oid,t=r.feature;"mesh"===t?.geometry?.type&&n.set(e,t)}return n}function I(e,t){const n=t.updates;if(!n||0===n.length)return new p;const o=new p,r=new Map;for(let i=0;i<e.attributeStorageInfo.length;i++)r.set(e.attributeStorageInfo[i].name,i);return e.forEachNode(((t,r)=>{for(const i of n){if(null==i.feature)continue;const n=i.feature,s=i.oid,l=r.indexOf(s);for(const r in n.attributes){const i=e.fieldsIndex.normalizeFieldName(r),a=g(o,t.index,i),u=n.attributes[r];a.push({featureIndex:l,featureId:s,value:u})}}})),o}function g(e,t,n){const o=b(e,t),r=null!=n&&o.get(n);if(r)return r;const i=new Array;return o.set(n,i),i}function b(e,t){const n=e.get(t);if(n)return n;const o=new m;return e.set(t,o),o}!function(e){e[e.EDITING=0]="EDITING",e[e.ROLLED_BACK=1]="ROLLED_BACK",e[e.COMMITTED=2]="COMMITTED"}(r||(r={}));const m=Map,p=Map;export{i as createInteractiveEditSession,a as normalizeEditResultsEvent,f as processAttributeEdits,d as processGeometryEdits};
|
|
@@ -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 t from"../../../../core/Accessor.js";import o from"../../../../core/Evented.js";import r from"../../../../core/Logger.js";import{getMetersPerVerticalUnitForSR as s}from"../../../../core/unitUtils.js";import{property as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import o from"../../../../core/Evented.js";import r from"../../../../core/Logger.js";import{getMetersPerVerticalUnitForSR as s}from"../../../../core/unitUtils.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as n}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as a}from"../../../../chunks/vec3.js";import{c as l}from"../../../../chunks/vec3f64.js";import{empty as c,toRect as d,expandWithVec3 as p}from"../../../../geometry/support/aaBoundingBox.js";import{empty as m}from"../../../../geometry/support/aaBoundingRect.js";import{getMetersPerUnit as h}from"../../../../symbols/support/unitConversionUtils.js";import{newIntersector as u}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as f}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{VertexAttribute as _}from"../../webgl-engine/lib/VertexAttribute.js";const y=1;let g=class extends(o.EventedMixin(t)){get spatialReference(){return this.view?.spatialReference}constructor(e){super(e),this._elevationOffset=0,this._layerHandlesKey="layerHandles"}initialize(){this._renderCoordsHelper=this.view.renderCoordsHelper,this._intersectLayers=[this.stageLayer],this._intersector=u(this.view.state.viewingMode),this._intersector.options.store=f.MIN;const e=this._computeLayerExtent(this.spatialReference,this.stageLayer);this._zmin=e[2],this._zmax=e[5];const t=this.stageLayer.events;this.addHandles([t.on("layerObjectAdded",(e=>this._objectChanged(e.object))),t.on("layerObjectRemoved",(e=>this._objectChanged(e.object))),t.on("objectGeometryAdded",(e=>this._objectChanged(e.object))),t.on("objectGeometryRemoved",(e=>this._objectChanged(e.object))),t.on("objectGeometryUpdated",(e=>e.attribute===_.POSITION&&this._objectChanged(e.object))),t.on("objectTransformation",(e=>this._objectChanged(e)))],this._layerHandlesKey)}dispose(){this.removeHandles(this._layerHandlesKey)}elevationInfoChanged(){const e=null!=this.layer?this.layer.elevationInfo:null;if(null!=e&&"on-the-ground"!==e.mode){const t=s(this.layer.spatialReference),o=h(e.unit??"meters");this._elevationOffset=(e.offset??0)*o/t}else this._elevationOffset=0}getElevation(e,t,o,s){if(x[0]=e,x[1]=t,x[2]=o,!this._renderCoordsHelper.toRenderCoords(x,s,x))return r.getLogger(this).error("could not project point for elevation alignment"),null;const i=this._elevationOffset,n=this._zmin+i,a=this._zmax+i;this._renderCoordsHelper.setAltitude(C,a,x),this._renderCoordsHelper.setAltitude(E,n,x);const l=e=>!!e.lastValidElevationBB;return this._intersector.reset(C,E,null),this._intersector.intersect(this._intersectLayers,null,y,null,l),this._intersector.results.min.getIntersectionPoint(x)?this._renderCoordsHelper.getAltitude(x):null}_objectChanged(e){const t=this.spatialReference;if(!e.lastValidElevationBB||!t)return;c(j);const o=e.lastValidElevationBB;o.isEmpty()||this._expandExtent(t,o.min,o.max,j);const{min:r,max:s}=e.boundingVolumeWorldSpace;this._expandExtent(t,r,s,j),d(j,b),this._zmin=Math.min(this._zmin,j[2]),this._zmax=Math.max(this._zmax,j[5]),v.extent=b,v.spatialReference=t,this.emit("elevation-change",v),a(o.min,r),a(o.max,s)}_computeLayerExtent(e,t){return c(j),null!=e&&t.objects.forAll((t=>this._expandExtent(e,t.boundingVolumeWorldSpace.min,t.boundingVolumeWorldSpace.max,j))),j}_expandExtent(e,t,o,r){for(let s=0;s<8;++s)x[0]=1&s?t[0]:o[0],x[1]=2&s?t[1]:o[1],x[2]=4&s?t[2]:o[2],this._renderCoordsHelper.fromRenderCoords(x,x,e),p(r,x);return r}};e([i({constructOnly:!0})],g.prototype,"layer",void 0),e([i({constructOnly:!0})],g.prototype,"stageLayer",void 0),e([i({constructOnly:!0})],g.prototype,"view",void 0),e([i()],g.prototype,"spatialReference",null),g=e([n("esri.views.3d.layers.support.StageLayerElevationProvider")],g);const j=c(),b=m(),v={spatialReference:null,extent:b,context:"scene"},x=l(),C=l(),E=l();export{g as StageLayerElevationProvider};
|
|
@@ -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{DataType as
|
|
5
|
+
import{DataType as e}from"../../../webgl/enums.js";import{VertexElementDescriptor as t}from"../../../webgl/VertexElementDescriptor.js";function r(e,r=0){const n=e.stride;return Array.from(e.fields.keys()).map((i=>{const s=e.fields.get(i),u=s.constructor.ElementCount,f=o(s.constructor.ElementType),c=s.offset,l=!(!s.optional||!s.optional.glNormalized);return new t(i,u,f,c,n,l,r)}))}function o(e){const t=n[e];if(t)return t;throw new Error("BufferType not supported in WebGL")}const n={u8:e.UNSIGNED_BYTE,u16:e.UNSIGNED_SHORT,u32:e.UNSIGNED_INT,i8:e.BYTE,i16:e.SHORT,i32:e.INT,f32:e.FLOAT};export{r as glLayout};
|
|
@@ -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{p as t}from"../../../../chunks/vec2.js";import{s as e}from"../../../../chunks/vec3.js";import{c as r}from"../../../../chunks/vec3f64.js";import{O as o}from"../../../../chunks/vec4f64.js";import{getReferenceEllipsoid as n}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as i}from"../../../../geometry/projection/projectors.js";import{newDoubleArray as a}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as u}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as s}from"../../../../geometry/support/Indices.js";import{ViewingMode as l}from"../../../ViewingMode.js";import{Attribute as c}from"../../webgl-engine/lib/Attribute.js";import{ContentObjectType as p}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as f}from"../../webgl-engine/lib/Geometry.js";import{VertexAttribute as m}from"../../webgl-engine/lib/VertexAttribute.js";function b(t,e,r=null){const o=[],n=e.mapPositions;g(e,o);const i=o[0][1].data,a=o[0][1].indices.length
|
|
5
|
+
import{p as t}from"../../../../chunks/vec2.js";import{s as e}from"../../../../chunks/vec3.js";import{c as r}from"../../../../chunks/vec3f64.js";import{O as o}from"../../../../chunks/vec4f64.js";import{getReferenceEllipsoid as n}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as i}from"../../../../geometry/projection/projectors.js";import{newDoubleArray as a}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as u}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as s}from"../../../../geometry/support/Indices.js";import{ViewingMode as l}from"../../../ViewingMode.js";import{Attribute as c}from"../../webgl-engine/lib/Attribute.js";import{ContentObjectType as p}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as f}from"../../webgl-engine/lib/Geometry.js";import{VertexAttribute as m}from"../../webgl-engine/lib/VertexAttribute.js";function b(t,e,r=null){const o=[],n=e.mapPositions;g(e,o);const i=o[0][1].data,a=o[0][1].indices.length,u=s(a);return h(e,o,u),j(e,o,u),T(e,o,u),D(e,o,u),w(e,o,u),y(e,o,u),E(e,o,i),new f(t,o,n,p.Line,r)}function g(t,e){const{attributeData:{position:r},removeDuplicateStartEnd:o}=t,n=A(r)&&o,i=r.length/3-(n?1:0),a=new Array(2*(i-1)),u=n?r.slice(0,-3):r;let s=0;for(let l=0;l<i-1;l++)a[s++]=l,a[s++]=l+1;e.push([m.POSITION,new c(u,a,3,n)])}function h(t,e,r){if(null!=t.attributeData.colorFeature)return;const n=t.attributeData.color;e.push([m.COLOR,new c(n??o,r,4)])}function T(t,e,r){t.attributeData.normal&&e.push([m.NORMAL,new c(t.attributeData.normal,r,3)])}function D(t,e,r){null!=t.attributeData.colorFeature&&e.push([m.COLORFEATUREATTRIBUTE,new c([t.attributeData.colorFeature],r,1,!0)])}function j(t,e,r){null==t.attributeData.sizeFeature&&e.push([m.SIZE,new c([t.attributeData.size??1],r,1,!0)])}function w(t,e,r){null!=t.attributeData.sizeFeature&&e.push([m.SIZEFEATUREATTRIBUTE,new c([t.attributeData.sizeFeature],r,1,!0)])}function y(t,e,r){null!=t.attributeData.opacityFeature&&e.push([m.OPACITYFEATUREATTRIBUTE,new c([t.attributeData.opacityFeature],r,1,!0)])}function E(r,o,s){if(null==r.overlayInfo||r.overlayInfo.renderCoordsHelper.viewingMode!==l.Global||!r.overlayInfo.spatialReference.isGeographic)return;const p=a(s.length),f=n(r.overlayInfo.spatialReference);for(let t=0;t<p.length;t+=3)i(s,t,p,t,f);const b=s.length/3,g=u(b+1);let h=I,T=F,D=0,j=0;e(h,p[j++],p[j++],p[j++]),g[0]=0;for(let n=1;n<b+1;++n)n===b&&(j=0),e(T,p[j++],p[j++],p[j++]),D+=t(h,T),g[n]=D,[h,T]=[T,h];o.push([m.DISTANCETOSTART,new c(g,o[0][1].indices,1,!0)])}function A(t){const e=t.length;return t[0]===t[e-3]&&t[1]===t[e-2]&&t[2]===t[e-1]}const I=r(),F=r();function R(t,e){if(null==t||0===t.length)return[];const r=[];return t.forEach((t=>{const o=t.length,n=a(3*o);t.forEach(((t,e)=>{n[3*e]=t[0],n[3*e+1]=t[1],n[3*e+2]=t[2]}));const i={attributeData:{position:n,normal:e},removeDuplicateStartEnd:!1};r.push(i)})),r}export{b as createGeometry,R as lineStripsToParameters};
|
|
@@ -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 t from"../../../Camera.js";import"../../../geometry.js";import e from"../../../Graphic.js";import n from"../../../Viewpoint.js";import{result as a}from"../../../core/asyncUtils.js";import"../../../core/has.js";import{cyclicalDegrees as o}from"../../../core/Cyclical.js";import r from"../../../core/Error.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import{f as s,t as c}from"../../../chunks/mat3.js";import{a as l}from"../../../chunks/mat3f64.js";import{a as m}from"../../../chunks/mat4f64.js";import{i as u,g as f,o as p,c as g,f as h,s as y,t as d}from"../../../chunks/vec3.js";import{c as w}from"../../../chunks/vec3f64.js";import{project as x,projectWithZConversion as j}from"../../../geometry/projection.js";import{computeTranslationToOriginAndRotation as v}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectPointToVectorWithEngine as b}from"../../../geometry/projection/projectPointToVectorWithEngine.js";import{projectVectorToPoint as R}from"../../../geometry/projection/projectVectorToPoint.js";import{projectVectorToVector as z}from"../../../geometry/projection/projectVectorToVector.js";import{create as G,empty as S,center as B,toRect as T,isPoint as M,expandWithVec3 as A,expandWithAABB as E,width as Z,height as k,depth as F}from"../../../geometry/support/aaBoundingBox.js";import{create as O,isPoint as P}from"../../../geometry/support/aaBoundingRect.js";import{intersectsPoint as D}from"../../../geometry/support/frustum.js";import{getResolutionInMetersForScale as U}from"../../../geometry/support/scaleUtils.js";import{cameraOnContentAlongViewDirection as V}from"../camera/intersectionUtils.js";import{getViewSR as C,fromExtentSync as I,fromExtentAsync as J,internalToExternal as K,OrientationMode as L,scaleToDistance as N,fromCenterDistanceSync as W,fromCenterDistanceAsync as Y,externalToInternal as q,computeScale as X,distanceToScale as _,fromCenterScale as H,directionToHeadingTilt as Q,zoomToScale as $}from"./cameraUtils.js";import{getElevationAtPoint as tt}from"./ElevationProvider.js";import et from"../../../geometry/Point.js";import nt from"../../../geometry/Extent.js";import at from"../../../geometry/SpatialReference.js";import ot from"../../../geometry/Geometry.js";import rt from"../../../geometry/Multipoint.js";const it=.66;function st(t){return 360-o.normalize(t)}function ct(t){return o.normalize(360-t)}function lt(t,e,n){const a=e.camera;if(null!=a)return ut(a,C(t));const{targetGeometry:o}=e;if(null==o)return null;const{camera:r,mode:i}=pt(t,e.rotation,n);if("point"===o.type)return gt(t,e,o,r,i);const s=o.extent;return null==s?null:I(t,s,r.heading,r.tilt,i)}async function mt(t,e,n,a){const o=e.camera;if(null!=o)return ft(o,C(t),a);const{targetGeometry:r}=e;if(null==r)throw new Error("Viewpoint has no targetGeometry!");const{camera:i,mode:s}=pt(t,e.rotation,n);if("point"===r.type)return ht(t,e,r,i,s,a);const c=r.extent;if(null==c)throw new Error("Target geometry has no extent!");return J(t,c,i.heading,i.tilt,s,a)}function ut(t,e){const n=t.position;let a;try{a=x(n,e)}catch(r){return null}const o=t.clone();return o.position=a.clone(),o}async function ft(t,e,n){const a=t.position,o=await j(a,e,{signal:n});i(n);const r=t.clone();return r.position=o.clone(),r}function pt(t,e,n){const a=K(t,t.state.camera);let o=L.ADJUST;return null!=e&&(a.heading=st(e),o=L.LOCKED),null!=n&&(a.tilt=n),{camera:a,mode:o}}function gt(t,e,n,a,o){const r=t.spatialReference;let i;try{i=x(n.clone(),r)}catch(c){return null}const s=null!=e.scale?N(t,e.scale,i.latitude):t.state.camera.distance;return W(t,i,s,a,o)}async function ht(t,e,n,a,o,r){const s=t.spatialReference,c=await j(n.clone(),s,{signal:r});i(r);const l=null!=e.scale?N(t,e.scale,c.latitude):t.state.camera.distance;return Y(t,c,l,a,o,r)}function yt(t,e,a=null){return null==a&&(a=new n),vt(t,null,e.clone(),a)}async function dt(e,a,o){const i=Ft(e,a);if(!i)throw new r("viewpointutils-create:no-target","Missing target for creating viewpoint");const s=new t({fov:e.camera.fov}),c=new n({camera:s});if(i.target instanceof n){return Ot(await Gt(e,i.target,i,o,c))}if(i.target instanceof t)return Ot(await St(e,i.target,o,c));const l=null!=i.scale||null!=i.zoom;if(i.target instanceof nt){const t=i.target.xmin===i.target.xmax||i.target.ymin===i.target.ymax;return Ot(l||t?await Tt(e,i,i.target.center,s,o,c):await Et(e,i,i.target,s,o,c))}const m={boundingBox:S(),hasZ:!1,screenSpaceObjects:[]},u=l?xt(e,i):void 0;if(await zt(e,i.target,u,m,o),isFinite(m.boundingBox[0])){let t;if(B(m.boundingBox,Dt),Wt.x=Dt[0],Wt.y=Dt[1],Wt.z=Dt[2],Wt.spatialReference=e.spatialReference,isFinite(Wt.z)&&m.hasZ?t=M(m.boundingBox):(Wt.z=void 0,t=P(T(m.boundingBox,It))),l||t)return Ot(await Tt(e,i,Wt,s,o,c));const n=Pt(e,m.screenSpaceObjects);return Ot(await kt(e,i,Wt,m.boundingBox,n,s,o,c))}return i.position?Ot(await Mt(e,i,s,c,o)):Ot(await At(e,i,s,o,c))}function wt(t,e){return null==e.scale&&null!=e.zoom?$(t,e.zoom):e.scale}function xt(t,e){const n=wt(t,e);return n?U(n):void 0}function jt(t,e){let n=!1;return null!=e.heading?(t.heading=e.heading,n=!0):null!=e.rotation&&(t.heading=st(e.rotation),n=!0),null!=e.tilt&&(t.tilt=e.tilt,n=!0),null!=e.fov&&(t.fov=e.fov),n}function vt(t,e,n,a){const o=t.spatialReference||at.WGS84;return null==(e=null!=e?e:q(t,n))||(a.targetGeometry=R(e.center,t.renderSpatialReference,o),a.scale=X(t,e),a.rotation=ct(n.heading),a.camera=n),a}async function bt(t,e,n,a){const o=()=>new r("viewpointutils:invalid-geometry","The target is missing a valid geometry");if(!e)throw o();const i=e.spatialReference,s=t.spatialReference,c=t.basemapTerrain.spatialReference;if(!e.hasZ&&t.basemapTerrain){let n;switch(e.type){case"point":n=e;break;case"multipoint":case"polyline":n=e.extent?.center;break;case"mesh":n=e.origin;break;case"extent":n=e.center;break;case"polygon":n=e.centroid}null!=n&&null!=c&&null!=t.elevationProvider?(n=await j(n,c,{signal:a}),Dt[2]=tt(t.elevationProvider,n)??0):Dt[2]=0}const l=Yt[e.type],m=new Array;if(l(e,e.hasZ?t=>{m.push([t[0],t[1],t[2]])}:t=>{m.push([t[0],t[1]])},Dt),0===m.length)throw o();const u=await j(new rt({spatialReference:i,hasZ:e.hasZ,hasM:!1,points:m}),s,{signal:a});if(e.hasZ&&(n.hasZ=!0),e.hasZ)for(const[r,f,p]of u.points)Dt[0]=r,Dt[1]=f,Dt[2]=p,A(n.boundingBox,Dt);else for(const[r,f]of u.points)Dt[0]=r,Dt[1]=f,A(n.boundingBox,Dt)}async function Rt(t,e,n,o,r){const i=await a(t.whenViewForGraphic(e));if(!1===i.ok||null==i.value||!("whenGraphicBounds"in i.value))return void await bt(t,e.geometry,o,r);const s=i.value,c=await a(s.whenGraphicBounds(e,{minDemResolution:n}));if(!1===c.ok||!c.value)return void await bt(t,e.geometry,o,r);const{screenSpaceObjects:l,boundingBox:m}=c.value;E(o.boundingBox,m),l&&l.forEach((t=>{o.screenSpaceObjects.push(t)})),isFinite(m[2])&&(o.hasZ=!0)}async function zt(t,n,a,o,r){if(Array.isArray(n)&&2===n.length){const e=n[0],a=n[1];if("number"==typeof e&&"number"==typeof a)return Wt.x=e,Wt.y=a,Wt.z=void 0,Wt.spatialReference=t.spatialReference?.isGeographic?t.spatialReference:at.WGS84,void await bt(t,Wt,o,r)}n&&"map"in n&&"function"==typeof n.map?await Promise.allSettled(n.map((e=>zt(t,e,a,o,r)))):n instanceof ot?await bt(t,n,o,r):n instanceof e&&await Rt(t,n,a,o,r)}async function Gt(t,e,n,a,o){if(null!=e.camera)return St(t,e.camera,a,o);o.scale=e.scale,o.rotation=e.rotation,o.targetGeometry=null!=e.targetGeometry?e.targetGeometry.clone():null,o.camera=null,null!=n.heading?o.rotation=ct(n.heading):null!=n.rotation&&(o.rotation=n.rotation);const r=wt(t,n);return null!=r&&(o.scale=r),o.camera=await mt(t,o,n.tilt,a),o}async function St(t,e,n,a){const o=t.spatialReference,r=await j(e.position,o,{signal:n});return(e=e.clone()).fov=t.camera.fov,e.position=r,vt(t,null,e,a)}async function Bt(t,e,n,a,o,r,i){const s=t.renderSpatialReference;return await b(e,Lt,s,0,{signal:i}),await b(n,Kt,s,0,{signal:i}),r.targetGeometry=new et(e),o.position=new et(n),h(Jt,Lt,Kt),Q(t,Kt,Jt,a.up,o),r.scale=_(t,p(Kt,Lt),r.targetGeometry.latitude),r.rotation=ct(o.heading),r.camera=o,r}async function Tt(t,e,n,a,o,i){if(null==n)throw new r("createfromcenter","invalid point");i.targetGeometry=n.clone();const s=V(t);if(e.position)return Bt(t,i.targetGeometry,e.position,s,a,i,o);if(e.zoomFactor){const a=s.distance/e.zoomFactor,o=u(Dt,s.viewForward,-a);s.eye=f(Dt,s.center,o),i.scale=_(t,a,n.latitude)}K(t,s,a);const c=jt(a,e)?L.LOCKED:L.ADJUST;if(!e.zoomFactor){const r=wt(t,e);if(null==r){const{renderSpatialReference:e}=t;await b(n,Dt,e,0,{signal:o}),D(s.frustum,Dt)?i.scale=_(t,p(s.eye,Dt),n.latitude):i.scale=X(t,s)}else i.scale=r;i.camera=await H(t,i.targetGeometry,i.scale,a,c,o)}return i}async function Mt(t,e,n,a,o){const r=V(t);g(Jt,r.viewForward),Q(t,r.eye,Jt,r.up,Nt);const i=t.spatialReference,{position:s}=e;if(s){const t=await j(s,i,{signal:o});n.position=t}else n.position=new et;return n.heading=null!=e.heading?e.heading:Nt.heading,n.tilt=null!=e.tilt?e.tilt:Nt.tilt,vt(t,null,n,a)}async function At(t,e,n,a,o){const r=V(t),{spatialReference:i,renderSpatialReference:s}=t;return Tt(t,e,R(r.center,s,i),n,a,o)}async function Et(t,e,n,a,o,r){r.targetGeometry=n.clone();const i=V(t);K(t,i,a);const s=jt(a,e)?L.LOCKED:L.ADJUST;return r.camera=await J(t,n,a.heading,a.tilt,s,o),r}function Zt(t,e,n,a,o){let r=0;null!=n.z?r=n.z:t.basemapTerrain&&t.elevationProvider&&(r=tt(t.elevationProvider,n)),y(Dt,n.x,n.y,r),v(t.spatialReference,Dt,Ut,t.renderSpatialReference),s(Vt,Ut),c(Vt,Vt),S(Ct);const i=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]];for(let s=0;s<i.length;s++){const e=i[s];let n=a[e[2]];isFinite(n)||(n=r),y(Dt,a[e[0]],a[e[1]],n),z(Dt,t.spatialReference,Dt,t.renderSpatialReference),A(Ct,d(Dt,Dt,Vt))}const l=Z(Ct),m=k(Ct),u=F(Ct),f=1/Math.tan(e.fovX/2),p=1/Math.tan(e.fovY/2),g=.5*Math.sqrt(l*l+u*u)*Math.max(p,f)+.5*m,h=.5*m*p+.5*Math.max(l,u);return Math.max(g,h)/o}async function kt(t,e,n,a,o,r,i,s){s.targetGeometry=n.clone();const c=V(t),l=Zt(t,c,n,a,o);K(t,c,r);const m=jt(r,e)?L.LOCKED:L.ADJUST;return s.scale=_(t,l,s.targetGeometry.latitude),s.camera=await H(t,s.targetGeometry,s.scale,r,m,i),s}function Ft(t,e){if(!e||!t.spatialReference)return null;const n={target:void 0};return"declaredClass"in e||Array.isArray(e)?n.target=e:(Object.assign(n,e),e.center&&!n.target&&(n.target=e.center)),n}function Ot(t){return t&&null!=t.camera&&(t.rotation=ct(t.camera.heading)),t}function Pt(t,e){const n=it;if(!e.length)return n;let a=Number.NEGATIVE_INFINITY;for(let o=0;o<e.length;o++){const t=e[o].screenSpaceBoundingRect;a=Math.max(a,Math.abs(t[0]),Math.abs(t[1]),Math.abs(t[2]),Math.abs(t[3]))}return n-a/Math.min(t.width,t.height)*2}const Dt=w(),Ut=m(),Vt=l(),Ct=G(),It=O(),Jt=w(),Kt=w(),Lt=w(),Nt={heading:0,tilt:0},Wt=new et,Yt={point(t,e,n){n[0]=t.x,n[1]=t.y,null!=t.z&&(n[2]=t.z),e(n)},polygon(t,e,n){const a=t.hasZ;for(let o=0;o<t.rings.length;o++){const r=t.rings[o];for(let t=0;t<r.length;t++)n[0]=r[t][0],n[1]=r[t][1],a&&(n[2]=r[t][2]),e(n)}},polyline(t,e,n){const a=t.hasZ;for(let o=0;o<t.paths.length;o++){const r=t.paths[o];for(let t=0;t<r.length;t++)n[0]=r[t][0],n[1]=r[t][1],a&&(n[2]=r[t][2]),e(n)}},multipoint(t,e,n){const a=t.points,o=t.hasZ;for(let r=0;r<a.length;r++)n[0]=a[r][0],n[1]=a[r][1],o&&(n[2]=a[r][2]),e(n)},extent(t,e,n){null!=t.zmin&&null!=t.zmax?(e(y(n,t.xmin,t.ymin,t.zmin)),e(y(n,t.xmax,t.ymin,t.zmin)),e(y(n,t.xmin,t.ymax,t.zmin)),e(y(n,t.xmax,t.ymax,t.zmin)),e(y(n,t.xmin,t.ymin,t.zmax)),e(y(n,t.xmax,t.ymin,t.zmax)),e(y(n,t.xmin,t.ymax,t.zmax)),e(y(n,t.xmax,t.ymax,t.zmax))):(e(y(n,t.xmin,t.ymin,n[2])),e(y(n,t.xmax,t.ymin,n[2])),e(y(n,t.xmin,t.ymax,n[2])),e(y(n,t.xmax,t.ymax,n[2])))},mesh(t,e,n){const a=t.vertexAttributes&&t.vertexAttributes.position;if(a)for(let o=0;o<a.length;o+=3)e(y(n,a[o],a[o+1],a[o+2]))}};export{dt as create,yt as fromCamera,mt as toCameraAsync,lt as toCameraSync};
|
|
5
|
+
import t from"../../../Camera.js";import"../../../geometry.js";import e from"../../../Graphic.js";import n from"../../../Viewpoint.js";import{result as a}from"../../../core/asyncUtils.js";import"../../../core/has.js";import{cyclicalDegrees as o}from"../../../core/Cyclical.js";import r from"../../../core/Error.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import{f as s,t as c}from"../../../chunks/mat3.js";import{a as l}from"../../../chunks/mat3f64.js";import{a as m}from"../../../chunks/mat4f64.js";import{i as u,g as f,o as p,c as g,f as y,s as h,t as d}from"../../../chunks/vec3.js";import{c as w}from"../../../chunks/vec3f64.js";import{project as x,projectWithZConversion as j}from"../../../geometry/projection.js";import{computeTranslationToOriginAndRotation as v}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectPointToVectorWithEngine as R}from"../../../geometry/projection/projectPointToVectorWithEngine.js";import{projectVectorToPoint as b}from"../../../geometry/projection/projectVectorToPoint.js";import{projectVectorToVector as z}from"../../../geometry/projection/projectVectorToVector.js";import{create as G,empty as S,center as B,toRect as T,isPoint as M,expandWithVec3 as E,expandWithAABB as Z,width as A,height as F,depth as k}from"../../../geometry/support/aaBoundingBox.js";import{create as O,isPoint as P}from"../../../geometry/support/aaBoundingRect.js";import{intersectsPoint as D}from"../../../geometry/support/frustum.js";import{getResolutionInMetersForScale as U}from"../../../geometry/support/scaleUtils.js";import{cameraOnContentAlongViewDirection as V}from"../camera/intersectionUtils.js";import{getViewSR as C,fromExtentSync as I,fromExtentAsync as J,internalToExternal as K,OrientationMode as L,scaleToDistance as N,fromCenterDistanceSync as W,fromCenterDistanceAsync as Y,externalToInternal as q,computeScale as X,distanceToScale as _,fromCenterScale as H,directionToHeadingTilt as Q,zoomToScale as $}from"./cameraUtils.js";import{getElevationAtPoint as tt}from"./ElevationProvider.js";import et from"../../../geometry/Point.js";import nt from"../../../geometry/Extent.js";import at from"../../../geometry/SpatialReference.js";import ot from"../../../geometry/Geometry.js";import rt from"../../../geometry/Multipoint.js";const it=.66;function st(t){return 360-o.normalize(t)}function ct(t){return o.normalize(360-t)}function lt(t,e,n){const a=e.camera;if(null!=a)return ut(a,C(t));const{targetGeometry:o}=e;if(null==o)return null;const{camera:r,mode:i}=pt(t,e.rotation,n);if("point"===o.type)return gt(t,e,o,r,i);const s=o.extent;return null==s?null:I(t,s,r.heading,r.tilt,i)}async function mt(t,e,n,a){const o=e.camera;if(null!=o)return ft(o,C(t),a);const{targetGeometry:r}=e;if(null==r)throw new Error("Viewpoint has no targetGeometry!");const{camera:i,mode:s}=pt(t,e.rotation,n);if("point"===r.type)return yt(t,e,r,i,s,a);const c=r.extent;if(null==c)throw new Error("Target geometry has no extent!");return J(t,c,i.heading,i.tilt,s,a)}function ut(t,e){const n=t.position;let a;try{a=x(n,e)}catch(r){return null}const o=t.clone();return o.position=a.clone(),o}async function ft(t,e,n){const a=t.position,o=await j(a,e,{signal:n});i(n);const r=t.clone();return r.position=o.clone(),r}function pt(t,e,n){const a=K(t,t.state.camera);let o=L.ADJUST;return null!=e&&(a.heading=st(e),o=L.LOCKED),null!=n&&(a.tilt=n),{camera:a,mode:o}}function gt(t,e,n,a,o){const r=t.spatialReference;let i;try{i=x(n.clone(),r)}catch(c){return null}const s=null!=e.scale?N(t,e.scale,i.latitude):t.state.camera.distance;return W(t,i,s,a,o)}async function yt(t,e,n,a,o,r){const s=t.spatialReference,c=await j(n.clone(),s,{signal:r});i(r);const l=null!=e.scale?N(t,e.scale,c.latitude):t.state.camera.distance;return Y(t,c,l,a,o,r)}function ht(t,e,a=null){return null==a&&(a=new n),vt(t,null,e.clone(),a)}async function dt(e,a,o){const i=kt(e,a);if(!i)throw new r("viewpointutils-create:no-target","Missing target for creating viewpoint");const s=new t({fov:e.camera.fov}),c=new n({camera:s});if(i.target instanceof n){return Ot(await Gt(e,i.target,i,o,c))}if(i.target instanceof t)return Ot(await St(e,i.target,o,c));const l=null!=i.scale||null!=i.zoom;if(i.target instanceof nt){const t=i.target.xmin===i.target.xmax||i.target.ymin===i.target.ymax;return Ot(l||t?await Tt(e,i,i.target.center,s,o,c):await Zt(e,i,i.target,s,o,c))}const m={boundingBox:S(),hasZ:!1,screenSpaceObjects:[]},u=l?xt(e,i):void 0;if(await zt(e,i.target,u,m,o),isFinite(m.boundingBox[0])){let t;if(B(m.boundingBox,Dt),Wt.x=Dt[0],Wt.y=Dt[1],Wt.z=Dt[2],Wt.spatialReference=e.spatialReference,isFinite(Wt.z)&&m.hasZ?t=M(m.boundingBox):(Wt.z=void 0,t=P(T(m.boundingBox,It))),l||t)return Ot(await Tt(e,i,Wt,s,o,c));const n=Pt(e,m.screenSpaceObjects);return Ot(await Ft(e,i,Wt,m.boundingBox,n,s,o,c))}return i.position?Ot(await Mt(e,i,s,c,o)):Ot(await Et(e,i,s,o,c))}function wt(t,e){return null==e.scale&&null!=e.zoom?$(t,e.zoom):e.scale}function xt(t,e){const n=wt(t,e);return n?U(n):void 0}function jt(t,e){let n=!1;return null!=e.heading?(t.heading=e.heading,n=!0):null!=e.rotation&&(t.heading=st(e.rotation),n=!0),null!=e.tilt&&(t.tilt=e.tilt,n=!0),null!=e.fov&&(t.fov=e.fov),n}function vt(t,e,n,a){const o=t.spatialReference||at.WGS84;return null==(e=null!=e?e:q(t,n))||(a.targetGeometry=b(e.center,t.renderSpatialReference,o),a.scale=X(t,e),a.rotation=ct(n.heading),a.camera=n),a}async function Rt(t,e,n,a){const o=()=>new r("viewpointutils:invalid-geometry","The target is missing a valid geometry");if(!e)throw o();"mesh"===e.type&&(e=e.extent);const i=e.spatialReference,s=t.spatialReference,c=t.basemapTerrain.spatialReference;if(!e.hasZ&&t.basemapTerrain){let n;switch(e.type){case"point":n=e;break;case"multipoint":case"polyline":n=e.extent?.center;break;case"extent":n=e.center;break;case"polygon":n=e.centroid}null!=n&&null!=c&&null!=t.elevationProvider?(n=await j(n,c,{signal:a}),Dt[2]=tt(t.elevationProvider,n)??0):Dt[2]=0}const l=Yt[e.type],m=new Array;if(l(e,e.hasZ?t=>{m.push([t[0],t[1],t[2]])}:t=>{m.push([t[0],t[1]])},Dt),0===m.length)throw o();const u=await j(new rt({spatialReference:i,hasZ:e.hasZ,hasM:!1,points:m}),s,{signal:a});if(e.hasZ&&(n.hasZ=!0),e.hasZ)for(const[r,f,p]of u.points)Dt[0]=r,Dt[1]=f,Dt[2]=p,E(n.boundingBox,Dt);else for(const[r,f]of u.points)Dt[0]=r,Dt[1]=f,E(n.boundingBox,Dt)}async function bt(t,e,n,o,r){const i=await a(t.whenViewForGraphic(e));if(!1===i.ok||null==i.value||!("whenGraphicBounds"in i.value))return void await Rt(t,e.geometry,o,r);const s=i.value,c=await a(s.whenGraphicBounds(e,{minDemResolution:n}));if(!1===c.ok||!c.value)return void await Rt(t,e.geometry,o,r);const{screenSpaceObjects:l,boundingBox:m}=c.value;Z(o.boundingBox,m),l&&l.forEach((t=>{o.screenSpaceObjects.push(t)})),isFinite(m[2])&&(o.hasZ=!0)}async function zt(t,n,a,o,r){if(Array.isArray(n)&&2===n.length){const e=n[0],a=n[1];if("number"==typeof e&&"number"==typeof a)return Wt.x=e,Wt.y=a,Wt.z=void 0,Wt.spatialReference=t.spatialReference?.isGeographic?t.spatialReference:at.WGS84,void await Rt(t,Wt,o,r)}n&&"map"in n&&"function"==typeof n.map?await Promise.allSettled(n.map((e=>zt(t,e,a,o,r)))):n instanceof ot?await Rt(t,n,o,r):n instanceof e&&await bt(t,n,a,o,r)}async function Gt(t,e,n,a,o){if(null!=e.camera)return St(t,e.camera,a,o);o.scale=e.scale,o.rotation=e.rotation,o.targetGeometry=null!=e.targetGeometry?e.targetGeometry.clone():null,o.camera=null,null!=n.heading?o.rotation=ct(n.heading):null!=n.rotation&&(o.rotation=n.rotation);const r=wt(t,n);return null!=r&&(o.scale=r),o.camera=await mt(t,o,n.tilt,a),o}async function St(t,e,n,a){const o=t.spatialReference,r=await j(e.position,o,{signal:n});return(e=e.clone()).fov=t.camera.fov,e.position=r,vt(t,null,e,a)}async function Bt(t,e,n,a,o,r,i){const s=t.renderSpatialReference;return await R(e,Lt,s,0,{signal:i}),await R(n,Kt,s,0,{signal:i}),r.targetGeometry=new et(e),o.position=new et(n),y(Jt,Lt,Kt),Q(t,Kt,Jt,a.up,o),r.scale=_(t,p(Kt,Lt),r.targetGeometry.latitude),r.rotation=ct(o.heading),r.camera=o,r}async function Tt(t,e,n,a,o,i){if(null==n)throw new r("createfromcenter","invalid point");i.targetGeometry=n.clone();const s=V(t);if(e.position)return Bt(t,i.targetGeometry,e.position,s,a,i,o);if(e.zoomFactor){const a=s.distance/e.zoomFactor,o=u(Dt,s.viewForward,-a);s.eye=f(Dt,s.center,o),i.scale=_(t,a,n.latitude)}K(t,s,a);const c=jt(a,e)?L.LOCKED:L.ADJUST;if(!e.zoomFactor){const r=wt(t,e);if(null==r){const{renderSpatialReference:e}=t;await R(n,Dt,e,0,{signal:o}),D(s.frustum,Dt)?i.scale=_(t,p(s.eye,Dt),n.latitude):i.scale=X(t,s)}else i.scale=r;i.camera=await H(t,i.targetGeometry,i.scale,a,c,o)}return i}async function Mt(t,e,n,a,o){const r=V(t);g(Jt,r.viewForward),Q(t,r.eye,Jt,r.up,Nt);const i=t.spatialReference,{position:s}=e;if(s){const t=await j(s,i,{signal:o});n.position=t}else n.position=new et;return n.heading=null!=e.heading?e.heading:Nt.heading,n.tilt=null!=e.tilt?e.tilt:Nt.tilt,vt(t,null,n,a)}async function Et(t,e,n,a,o){const r=V(t),{spatialReference:i,renderSpatialReference:s}=t;return Tt(t,e,b(r.center,s,i),n,a,o)}async function Zt(t,e,n,a,o,r){r.targetGeometry=n.clone();const i=V(t);K(t,i,a);const s=jt(a,e)?L.LOCKED:L.ADJUST;return r.camera=await J(t,n,a.heading,a.tilt,s,o),r}function At(t,e,n,a,o){let r=0;null!=n.z?r=n.z:t.basemapTerrain&&t.elevationProvider&&(r=tt(t.elevationProvider,n)),h(Dt,n.x,n.y,r),v(t.spatialReference,Dt,Ut,t.renderSpatialReference),s(Vt,Ut),c(Vt,Vt),S(Ct);const i=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]];for(let s=0;s<i.length;s++){const e=i[s];let n=a[e[2]];isFinite(n)||(n=r),h(Dt,a[e[0]],a[e[1]],n),z(Dt,t.spatialReference,Dt,t.renderSpatialReference),E(Ct,d(Dt,Dt,Vt))}const l=A(Ct),m=F(Ct),u=k(Ct),f=1/Math.tan(e.fovX/2),p=1/Math.tan(e.fovY/2),g=.5*Math.sqrt(l*l+u*u)*Math.max(p,f)+.5*m,y=.5*m*p+.5*Math.max(l,u);return Math.max(g,y)/o}async function Ft(t,e,n,a,o,r,i,s){s.targetGeometry=n.clone();const c=V(t),l=At(t,c,n,a,o);K(t,c,r);const m=jt(r,e)?L.LOCKED:L.ADJUST;return s.scale=_(t,l,s.targetGeometry.latitude),s.camera=await H(t,s.targetGeometry,s.scale,r,m,i),s}function kt(t,e){if(!e||!t.spatialReference)return null;const n={target:void 0};return"declaredClass"in e||Array.isArray(e)?n.target=e:(Object.assign(n,e),e.center&&!n.target&&(n.target=e.center)),n}function Ot(t){return t&&null!=t.camera&&(t.rotation=ct(t.camera.heading)),t}function Pt(t,e){const n=it;if(!e.length)return n;let a=Number.NEGATIVE_INFINITY;for(let o=0;o<e.length;o++){const t=e[o].screenSpaceBoundingRect;a=Math.max(a,Math.abs(t[0]),Math.abs(t[1]),Math.abs(t[2]),Math.abs(t[3]))}return n-a/Math.min(t.width,t.height)*2}const Dt=w(),Ut=m(),Vt=l(),Ct=G(),It=O(),Jt=w(),Kt=w(),Lt=w(),Nt={heading:0,tilt:0},Wt=new et,Yt={point(t,e,n){n[0]=t.x,n[1]=t.y,null!=t.z&&(n[2]=t.z),e(n)},polygon(t,e,n){const a=t.hasZ;for(let o=0;o<t.rings.length;o++){const r=t.rings[o];for(let t=0;t<r.length;t++)n[0]=r[t][0],n[1]=r[t][1],a&&(n[2]=r[t][2]),e(n)}},polyline(t,e,n){const a=t.hasZ;for(let o=0;o<t.paths.length;o++){const r=t.paths[o];for(let t=0;t<r.length;t++)n[0]=r[t][0],n[1]=r[t][1],a&&(n[2]=r[t][2]),e(n)}},multipoint(t,e,n){const a=t.points,o=t.hasZ;for(let r=0;r<a.length;r++)n[0]=a[r][0],n[1]=a[r][1],o&&(n[2]=a[r][2]),e(n)},extent(t,e,n){null!=t.zmin&&null!=t.zmax?(e(h(n,t.xmin,t.ymin,t.zmin)),e(h(n,t.xmax,t.ymin,t.zmin)),e(h(n,t.xmin,t.ymax,t.zmin)),e(h(n,t.xmax,t.ymax,t.zmin)),e(h(n,t.xmin,t.ymin,t.zmax)),e(h(n,t.xmax,t.ymin,t.zmax)),e(h(n,t.xmin,t.ymax,t.zmax)),e(h(n,t.xmax,t.ymax,t.zmax))):(e(h(n,t.xmin,t.ymin,n[2])),e(h(n,t.xmax,t.ymin,n[2])),e(h(n,t.xmin,t.ymax,n[2])),e(h(n,t.xmax,t.ymax,n[2])))}};export{dt as create,ht as fromCamera,mt as toCameraAsync,lt as toCameraSync};
|
|
@@ -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 t from"../../../core/Accessor.js";import r from"../../../core/PooledArray.js";import{isPromiseLike as s}from"../../../core/promiseUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{isIntersectionHandler as o}from"../state/helpers/SceneIntersectionHelper.js";import{ChangeSet as d}from"./lib/ChangeSet.js";import{UpdatePolicy as a}from"./lib/UpdatePolicy.js";import{isWebGLLayer as h}from"./lib/WebGLLayer.js";import{Model as y}from"./parts/Model.js";import{RenderView as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import r from"../../../core/PooledArray.js";import{isPromiseLike as s}from"../../../core/promiseUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{isIntersectionHandler as o}from"../state/helpers/SceneIntersectionHelper.js";import{ChangeSet as d}from"./lib/ChangeSet.js";import{UpdatePolicy as a}from"./lib/UpdatePolicy.js";import{isWebGLLayer as h}from"./lib/WebGLLayer.js";import{Model as y}from"./parts/Model.js";import{RenderView as c}from"./parts/RenderView.js";import{TaskPriority as l,noBudget as m}from"../../support/Scheduler.js";let p=class extends t{constructor(e){super(e),this._model=new y,this._layers=new r,this._asyncChangeSet=new d,this._syncChangeSet=new d,this._layerSyncSet=new Set}initialize(){this._set("renderView",new c(this)),this._frameTask=this.view.resourceController.scheduler.registerTask(l.STAGE,this),this.addHandles(this._frameTask)}get viewingMode(){return this.view.state.viewingMode}get updating(){return this.running||this.renderView.updating||this._frameTask.updating}get renderer(){return this.renderView?.renderer}add(e){this._model.add(e),h(e)&&this._addLayer(e),this.renderView.requestRender()}remove(e){null!=e&&!this.destroyed&&this._model.remove(e)&&(h(e)&&this._removeLayer(e),this.renderView.requestRender())}addMany(e){null!=e&&(this._model.addMany(e),this.renderView.requestRender())}removeMany(e){null!=e&&(this._model?.removeMany(e),this.renderView?.requestRender())}forEachOfType(e,t){this._model.forEachOfType(e,t)}handleEvent(e,t){this.destroyed||(this._model.dirtySet[e](t),this.renderView.requestRender())}get running(){return this._model.dirtySet.dirty||!this._asyncChangeSet.empty}runTask(e){this._frameTask.processQueue(e),this._commit(e)}_commit(e){const t=this._model.dirtySet;this._asyncChangeSet.empty||e.done||(this.renderer.modify(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()),this._layers.forAll((r=>{if(e.done)return;const s=this._layerSyncSet.has(r.id)||r.updatePolicy===a.SYNC,i=s?this._syncChangeSet:this._asyncChangeSet;t.commitLayer(r.id,i),this._layerSyncSet.delete(r.id),i.empty||(this.renderer.modify(i,s?m:e),this.renderView.requestRender(),e.madeProgress())})),this._syncChangeSet.empty||(this.renderer.modify(this._syncChangeSet,m),this.renderView.requestRender(),e.madeProgress()),this._layers.forAll((r=>{e.done||this._layerSyncSet.has(r.id)||r.updatePolicy!==a.ASYNC||(t.commitLayer(r.id,this._asyncChangeSet),this._asyncChangeSet.empty||(this.renderer.modify(this._asyncChangeSet,e),this.renderView.requestRender(),e.madeProgress()))})),this._layerSyncSet.clear(),this.notifyChange("running")}commitSyncLayers(){const e=this._model.dirtySet;this._layers.forAll((t=>{this._layerSyncSet.has(t.id)||t.updatePolicy===a.SYNC?(e.commitLayer(t.id,this._syncChangeSet),this._layerSyncSet.delete(t.id)):e.commitSyncUpdates(t.id,this._syncChangeSet)}));for(const t of this._layerSyncSet)e.commitLayer(t,this._syncChangeSet);this._layerSyncSet.clear(),this._syncChangeSet.empty||(this.renderer.modify(this._syncChangeSet,m),this.renderView.requestRender())}_commitLayer(e){this._model.dirtySet.commitLayer(e.id,this._syncChangeSet),this._layerSyncSet.delete(e.id),this._syncChangeSet.empty||(this.renderer.modify(this._syncChangeSet,m),this.renderView.requestRender())}schedule(e,t){return this._frameTask.schedule(e,t)}reschedule(e,t){return this._frameTask.reschedule(e,t)}syncLayer(e){this._layerSyncSet.add(e),this.renderView.requestRender()}getObject(e){return this._model.getObject(e)}get layers(){return this._layers}_addLayer(e){this._layers.includes(e)||this._layers.push(e)}_removeLayer(e){this._commitLayer(e),null!=this._layers.removeUnordered(e)&&(this._model.dirtySet.getResidentRenderGeometries(e.id,this._syncChangeSet.removes),this.renderer.modify(this._syncChangeSet,m))}addRenderPlugin(e,t){const r=this.renderer.renderPlugins.add(e,t),i=()=>{o(e)&&this.view.sceneIntersectionHelper.addIntersectionHandler(e)};if(s(r))return r.then(i);i()}removeRenderPlugin(e){this.destroyed||(o(e)&&this.view.sceneIntersectionHelper.removeIntersectionHandler(e),this.renderer.renderPlugins.remove(e))}get performanceInfo(){return this._model.getStats()}get test(){const e=this;return{getCount:t=>e._model.test.content.filter((e=>e.type===t)).length,model:e._model}}};p.DebugSettings={endFrameContentValidation:!1},e([i({constructOnly:!0})],p.prototype,"view",void 0),e([i({constructOnly:!0})],p.prototype,"options",void 0),e([i({readOnly:!0})],p.prototype,"viewingMode",null),e([i({constructOnly:!0})],p.prototype,"container",void 0),e([i({readOnly:!0})],p.prototype,"updating",null),e([i({constructOnly:!0})],p.prototype,"_model",void 0),e([i({autoDestroy:!0})],p.prototype,"renderView",void 0),e([i({readOnly:!0})],p.prototype,"renderer",null),e([i({readOnly:!0})],p.prototype,"running",null),p=e([n("esri.views.3d.webgl-engine.Stage")],p);export{p as Stage};
|
|
@@ -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
|
-
class
|
|
5
|
+
class l{constructor(l=null,t=null,s=null){this.composite=l,this.normal=t,this.highlight=s}}export{l as RenderPluginInput};
|
|
@@ -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{unitRGBAFromColor as t}from"../../../../../core/colorUtils.js";import{releaseMaybe as r,disposeMaybe as i}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{property as a}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{s as l}from"../../../../../chunks/vec2.js";import{ColorFormat as
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{unitRGBAFromColor as t}from"../../../../../core/colorUtils.js";import{releaseMaybe as r,disposeMaybe as i}from"../../../../../core/maybe.js";import{watch as s,syncAndInitial as o}from"../../../../../core/reactiveUtils.js";import{property as a}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{s as l}from"../../../../../chunks/vec2.js";import{ColorFormat as c}from"../../core/FBOCache.js";import{SyncRenderPlugin as n,ConsumesHighlight as p}from"../RenderPlugin.js";import{HighlightApplyTechnique as u}from"./HighlightApplyTechnique.js";import{HighlightBlurTechnique as m}from"./HighlightBlurTechnique.js";import{defaultColor as _,defaultHaloOpacity as d,defaultFillOpacity as g}from"./HighlightDefaults.js";import{HighlightDownsampleTechnique as b}from"./HighlightDownsampleTechnique.js";import{HighlightPassParameters as f}from"./HighlightPassParameters.js";import{Default3D as w}from"../../lib/DefaultVertexAttributeLocations.js";import{Pos2Tex as T}from"../../lib/DefaultVertexBufferLayouts.js";import{RenderSlot as q}from"../../lib/RenderSlot.js";import{VertexArrayObject as v}from"../../lib/VertexArrayObject.js";import{H as x}from"../../../../../chunks/HighlightBlur.glsl.js";import{H as P,g as y}from"../../../../../chunks/HighlightDownsample.glsl.js";import{BufferObject as j}from"../../../../webgl/BufferObject.js";import{ClearBufferBit as C,Usage as O}from"../../../../webgl/enums.js";import{vertexCount as R}from"../../../../webgl/Util.js";let D=class extends n{constructor(e){super(e),this._context=null,this._passParameters=new f,this._downsampleDrawParameters=new P,this._blurDrawParameters=new x,this._grid={coverage:null,vao:null,verticalCellCount:0,horizontalCellCount:0,viewportWidth:0,viewportHeight:0},this.produces=new Map([[q.HIGHLIGHT,()=>!0]])}consumes(){return p}initializeRenderContext(e){this._context=e,null==this._blurTechnique&&(this._blurTechnique=this._context.techniqueRepository.acquire(m)),null==this._downsampleTechnique&&(this._downsampleTechnique=this._context.techniqueRepository.acquire(b)),null==this._applyTechnique&&(this._applyTechnique=this._context.techniqueRepository.acquire(u)),this.addHandles([s((()=>this.view.highlightOptions.color),(e=>{this._passParameters.color=t(e??_),this.view.highlightOptions.haloColor||(this._passParameters.haloColor=this._passParameters.color),this._context.requestRender()}),o),s((()=>this.view.highlightOptions.haloColor),(e=>{this._passParameters.haloColor=null!=e?t(e):this._passParameters.color,this._context.requestRender()}),o),s((()=>this.view.highlightOptions.haloOpacity),(e=>{this._passParameters.haloOpacity=e??d,this._passParameters.haloOpacityOccluded=.25*this._passParameters.haloOpacity,this._context.requestRender()}),o),s((()=>this.view.highlightOptions.fillOpacity),(e=>{this._passParameters.fillOpacity=e??g,this._passParameters.fillOpacityOccluded=.25*this._passParameters.fillOpacity,this._context.requestRender()}),o)])}uninitializeRenderContext(){this._context=null}dispose(){this._blurTechnique=r(this._blurTechnique),this._downsampleTechnique=r(this._downsampleTechnique),this._applyTechnique=r(this._applyTechnique),this._grid.coverage=r(this._grid.coverage),this._grid.vao=i(this._grid.vao)}renderNode(e,t,r,i){const s=r?.highlight?.colorTexture;if(!this._context||!s)return;if(!(this._blurTechnique.compiled&&this._downsampleTechnique.compiled&&this._applyTechnique.compiled))return void this._context.requestRender();const o=e.bindParameters.camera,a=o.fullWidth,h=o.fullHeight,n=o.pixelRatio,p=Math.ceil(a/n),u=Math.ceil(h/n),m=this._context.fbos.rctx,_=this._context.fbos;this._gridUpdateResources(s),this._gridComputeCoverage(s,e.bindParameters),this._passParameters.highlightTexture=s,this._passParameters.coverageTexture=this._grid.coverage?.colorTexture;const d=m.bindTechnique(this._blurTechnique,this._passParameters,e.bindParameters),g=this._grid.vao;m.bindVAO(g);const b=_.acquire(c.RGBA4,p,u);m.bindFramebuffer(b.fbo),m.setViewport(0,0,p,u),m.setClearColor(0,0,0,0),m.clear(C.COLOR_BUFFER_BIT),this._blurDrawParameters.blurInputTexture=s,l(this._blurDrawParameters.blurSize,1/p,0),d.bindDraw(this._blurDrawParameters,e.bindParameters,this._passParameters),m.drawArrays(this._blurTechnique.primitiveType,0,R(g,"geometry"));const f=_.acquire(c.RGBA4,p,u);m.bindFramebuffer(f.fbo),m.clear(C.COLOR_BUFFER_BIT),this._blurDrawParameters.blurInputTexture=b.colorTexture,l(this._blurDrawParameters.blurSize,0,1/u),d.bindDraw(this._blurDrawParameters,e.bindParameters,this._passParameters),m.drawArrays(this._blurTechnique.primitiveType,0,R(g,"geometry")),m.bindFramebuffer(i?.fbo),m.setViewport4fv(o.fullViewport),this._passParameters.blurTexture=f.colorTexture,m.bindTechnique(this._applyTechnique,this._passParameters,e.bindParameters),m.drawArrays(this._applyTechnique.primitiveType,0,R(g,"geometry")),f.release(),b.release()}_gridUpdateResources(e){if(!this._context)return;const t=this._context.fbos.rctx,r=this._grid,s=Math.ceil(e.descriptor.height/y),o=Math.ceil(e.descriptor.width/y);if(!r.vao||r.verticalCellCount!==s||r.horizontalCellCount!==o){r.verticalCellCount=s,r.horizontalCellCount=o;const e=s+1,a=o+1,h=1/s,l=1/o,c=6,n=4,p=new Float32Array(c*n*e*a);let u=0;for(let t=0;t<e;t++)for(let e=0;e<a;e++)p[u]=(e-.5)*l*2-1,p[u+1]=(t-.5)*h*2-1,p[u+2]=e*l,p[u+3]=t*h,p[u+4]=(e+.5)*l*2-1,p[u+5]=(t-.5)*h*2-1,p[u+6]=e*l,p[u+7]=t*h,p[u+8]=(e-.5)*l*2-1,p[u+9]=(t+.5)*h*2-1,p[u+10]=e*l,p[u+11]=t*h,p[u+12]=(e-.5)*l*2-1,p[u+13]=(t+.5)*h*2-1,p[u+14]=e*l,p[u+15]=t*h,p[u+16]=(e+.5)*l*2-1,p[u+17]=(t-.5)*h*2-1,p[u+18]=e*l,p[u+19]=t*h,p[u+20]=(e+.5)*l*2-1,p[u+21]=(t+.5)*h*2-1,p[u+22]=e*l,p[u+23]=t*h,u+=c*n;r.vao=i(r.vao),r.vao=new v(t,w,{geometry:T},{geometry:j.createVertex(t,O.STATIC_DRAW,p)})}}_gridComputeCoverage(e,t){if(!this._context)return;const r=this._context.fbos.rctx,i=this._grid,s=r.bindTechnique(this._downsampleTechnique,this._passParameters,t),o=e.descriptor;i.coverage?.release(),i.coverage=this._context.fbos.acquire(c.RG,Math.ceil(o.width/y),Math.ceil(o.height/y)),r.bindFramebuffer(i.coverage.fbo),this._downsampleDrawParameters.input=e,s.bindDraw(this._downsampleDrawParameters,t,this._passParameters);const{width:a,height:h}=o;r.setViewport(0,0,a,h),r.screen.draw()}get test(){return{coverage:this._grid.coverage}}};e([a()],D.prototype,"_context",void 0),e([a()],D.prototype,"view",void 0),D=e([h("esri.views.3d.webgl-engine.lib.Highlight")],D);export{D as Highlight};
|
|
@@ -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 t}from"../../../../../chunks/tslib.es6.js";import{unitRGBAFromColor as e}from"../../../../../core/colorUtils.js";import{smoothstep as s,clamp as i}from"../../../../../core/mathUtils.js";import{watch as a,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{n as c,s as n,j as p}from"../../../../../chunks/vec3.js";import{c as d}from"../../../../../chunks/vec3f64.js";import{ViewingMode as m}from"../../../../ViewingMode.js";import{ReadShadowMapDrawParameters as l}from"../../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{SyncRenderPlugin as
|
|
5
|
+
import{_ as t}from"../../../../../chunks/tslib.es6.js";import{unitRGBAFromColor as e}from"../../../../../core/colorUtils.js";import{smoothstep as s,clamp as i}from"../../../../../core/mathUtils.js";import{watch as a,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{n as c,s as n,j as p}from"../../../../../chunks/vec3.js";import{c as d}from"../../../../../chunks/vec3f64.js";import{ViewingMode as m}from"../../../../ViewingMode.js";import{ReadShadowMapDrawParameters as l}from"../../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{SyncRenderPlugin as _,ConsumesHighlight as u}from"../RenderPlugin.js";import{defaultShadowOpacity as w,defaultShadowDifference as f,defaultShadowColor as g}from"./HighlightDefaults.js";import{ShadowHighlightPassParameters as y,ShadowHighlightTechnique as O}from"./ShadowHighlightTechnique.js";import{RenderSlot as x}from"../../lib/RenderSlot.js";const b=.001953125,P=4e4,j=5e4;let v=class extends _{constructor(t){super(t),this._maxOpacity=1,this._passParameters=new y,this._drawParameters=new l,this._shadowDifference=.2,this._context=null,this.produces=new Map([[x.SHADOW_HIGHLIGHT,()=>this._isVisible]])}consumes(){return u}initializeRenderContext(t){this._context=t,this.addHandles([a((()=>this.view.highlightOptions.shadowOpacity),(t=>{this._passParameters.shadowOpacity=t??w,this._updateOccludedShadowOpacity(),this._updateMaxOpacity()}),r),a((()=>this.view.highlightOptions.shadowDifference),(t=>{this._shadowDifference=t??f,this._updateOccludedShadowOpacity(),this._updateMaxOpacity()}),r),a((()=>this.view.highlightOptions.shadowColor),(t=>{this._passParameters.shadowColor=e(t??g),this._updateMaxOpacity()}),r)])}_updateOccludedShadowOpacity(){this._passParameters.occludedShadowOpacity=this._passParameters.shadowOpacity*(1-this._shadowDifference)}_updateMaxOpacity(){const t=Math.max(this._passParameters.shadowOpacity,this._passParameters.occludedShadowOpacity);this._maxOpacity=t*this._passParameters.shadowColor[3]}uninitializeRenderContext(){this._context=null}enable(){this._context&&null==this._technique&&(this._technique=this._context.techniqueRepository.acquire(O))}renderNode(t,e,s,i){const a=s?.highlight?.colorTexture;if(!(this._context&&s&&a&&this._isVisible))return;if(!this._technique?.compiled)return void this._context.requestRender();const r=t.bindParameters;if(!r.shadowMap.enabled||!r.linearDepth)return;const o=t.rctx,h=this._technique;this._passParameters.highlight=a,this._drawParameters.origin=r.camera.center,o.bindFramebuffer(i?.fbo),o.bindTechnique(h,this._passParameters,r).bindDraw(this._drawParameters,r,this._passParameters),o.screen.draw()}updateParameters(t,e){this._passParameters.opacityElevation=1-s(P,j,t.relativeElevation);const a=this.viewingMode===m.Global?c(S,t.center):n(S,0,0,1),r=p(a,e);this._passParameters.dayNightTerminator=s(0,1,i(30*r,0,1)),this._isVisible&&this.enable()}get _isVisible(){const{opacityElevation:t,dayNightTerminator:e}=this._passParameters;return this._maxOpacity*t*e>=b}};t([o()],v.prototype,"_context",void 0),t([o()],v.prototype,"view",void 0),t([o()],v.prototype,"viewingMode",void 0),v=t([h("esri.views.3d.webgl-engine.lib.ShadowHighlight")],v);const S=d();export{v as ShadowHighlight};
|
|
@@ -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{disposeMaybe as t,abortMaybe as r}from"../../../../../core/maybe.js";import{isAbortError as s,throwIfAborted as i,isAborted as o}from"../../../../../core/promiseUtils.js";import{watch as a,syncAndInitial as n}from"../../../../../core/reactiveUtils.js";import{property as h}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{requestImage as u}from"../../../../../support/requestImageUtils.js";import{ColorFormat as c}from"../../core/FBOCache.js";import{SyncRenderPlugin as d}from"../RenderPlugin.js";import{SMAABlendWeightsTechnique as _}from"./SMAABlendWeightsTechnique.js";import{SMAABlurTechnique as m}from"./SMAABlurTechnique.js";import{SMAAEdgeDetectTechnique as p}from"./SMAAEdgeDetectTechnique.js";import{SMAAPassParameters as b}from"./SMAAPassParameters.js";import{RenderFeature as T}from"../../lib/RenderFeature.js";import{RenderSlot as x}from"../../lib/RenderSlot.js";import{PixelFormat as f,TextureSamplingMode as q,ClearBufferBit as g,TextureWrapMode as C}from"../../../../webgl/enums.js";import{Texture as j}from"../../../../webgl/Texture.js";import{TextureDescriptor as A}from"../../../../webgl/TextureDescriptor.js";let w=class extends d{constructor(e){super(e),this._context=null,this._areaTexture=null,this._searchTexture=null,this._isEnabled=!1,this._smaaParameters=new b,this.produces=new Map([[x.ANTIALIASING,()=>this._isEnabled&&null!=this._context]])}get updating(){return null!=this._abortController}initializeRenderContext(e){this._context=e,this.addHandles([a((()=>this.view.qualitySettings.antialiasingEnabled),(e=>e||this._context?.isFeatureEnabled(T.Antialiasing)?this.enable():this.disable()),n)])}renderFeatureChanged(){this.view.qualitySettings.antialiasingEnabled||this._context?.isFeatureEnabled(T.Antialiasing)?this.enable():this.disable()}uninitializeRenderContext(){this.disable(),this._context=null}enable(){if(this._isEnabled||!this._context||this._abortController)return;if(null==this._edgeTechnique&&(this._edgeTechnique=this._context.techniqueRepository.acquire(p)),null==this._blendTechnique&&(this._blendTechnique=this._context.techniqueRepository.acquire(_)),null==this._blurTechnique&&(this._blurTechnique=this._context.techniqueRepository.acquire(m)),this._areaTexture&&this._searchTexture)return void(this._isEnabled=!0);this._abortController=new AbortController;const e=this._abortController.signal;import("./SMAAData.js").then((t=>this._loadTextures(this._context,t,e))).then((()=>{this._context?.requestRender(),this._abortController=null})).catch((e=>{s(e)||this._disposeTextures()}))}_loadTextures(e,t,r){return i(r),e?Promise.all([u(t.areaTexture).then((t=>E(e.fbos.rctx,q.LINEAR,f.RGB,t))),u(t.searchTexure).then((t=>E(e.fbos.rctx,q.NEAREST,f.LUMINANCE,t)))]).then((([e,t])=>{o(r)?(e.dispose(),t.dispose(),i(r)):(this._areaTexture=e,this._searchTexture=t,this._isEnabled=!0)})):Promise.reject()}_disposeTextures(){this._areaTexture=t(this._areaTexture),this._searchTexture=t(this._searchTexture)}disable(){this._abortController=r(this._abortController),this._isEnabled=!1}destroy(){this.disable(),this._disposeTextures()}renderNode(e,t,r,s){if(!(this._isEnabled&&this._context&&r&&
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{disposeMaybe as t,abortMaybe as r}from"../../../../../core/maybe.js";import{isAbortError as s,throwIfAborted as i,isAborted as o}from"../../../../../core/promiseUtils.js";import{watch as a,syncAndInitial as n}from"../../../../../core/reactiveUtils.js";import{property as h}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{requestImage as u}from"../../../../../support/requestImageUtils.js";import{ColorFormat as c}from"../../core/FBOCache.js";import{SyncRenderPlugin as d}from"../RenderPlugin.js";import{SMAABlendWeightsTechnique as _}from"./SMAABlendWeightsTechnique.js";import{SMAABlurTechnique as m}from"./SMAABlurTechnique.js";import{SMAAEdgeDetectTechnique as p}from"./SMAAEdgeDetectTechnique.js";import{SMAAPassParameters as b}from"./SMAAPassParameters.js";import{RenderFeature as T}from"../../lib/RenderFeature.js";import{RenderSlot as x}from"../../lib/RenderSlot.js";import{PixelFormat as f,TextureSamplingMode as q,ClearBufferBit as g,TextureWrapMode as C}from"../../../../webgl/enums.js";import{Texture as j}from"../../../../webgl/Texture.js";import{TextureDescriptor as A}from"../../../../webgl/TextureDescriptor.js";let w=class extends d{constructor(e){super(e),this._context=null,this._areaTexture=null,this._searchTexture=null,this._isEnabled=!1,this._smaaParameters=new b,this.produces=new Map([[x.ANTIALIASING,()=>this._isEnabled&&null!=this._context]])}get updating(){return null!=this._abortController}initializeRenderContext(e){this._context=e,this.addHandles([a((()=>this.view.qualitySettings.antialiasingEnabled),(e=>e||this._context?.isFeatureEnabled(T.Antialiasing)?this.enable():this.disable()),n)])}renderFeatureChanged(){this.view.qualitySettings.antialiasingEnabled||this._context?.isFeatureEnabled(T.Antialiasing)?this.enable():this.disable()}uninitializeRenderContext(){this.disable(),this._context=null}enable(){if(this._isEnabled||!this._context||this._abortController)return;if(null==this._edgeTechnique&&(this._edgeTechnique=this._context.techniqueRepository.acquire(p)),null==this._blendTechnique&&(this._blendTechnique=this._context.techniqueRepository.acquire(_)),null==this._blurTechnique&&(this._blurTechnique=this._context.techniqueRepository.acquire(m)),this._areaTexture&&this._searchTexture)return void(this._isEnabled=!0);this._abortController=new AbortController;const e=this._abortController.signal;import("./SMAAData.js").then((t=>this._loadTextures(this._context,t,e))).then((()=>{this._context?.requestRender(),this._abortController=null})).catch((e=>{s(e)||this._disposeTextures()}))}_loadTextures(e,t,r){return i(r),e?Promise.all([u(t.areaTexture).then((t=>E(e.fbos.rctx,q.LINEAR,f.RGB,t))),u(t.searchTexure).then((t=>E(e.fbos.rctx,q.NEAREST,f.LUMINANCE,t)))]).then((([e,t])=>{o(r)?(e.dispose(),t.dispose(),i(r)):(this._areaTexture=e,this._searchTexture=t,this._isEnabled=!0)})):Promise.reject()}_disposeTextures(){this._areaTexture=t(this._areaTexture),this._searchTexture=t(this._searchTexture)}disable(){this._abortController=r(this._abortController),this._isEnabled=!1}destroy(){this.disable(),this._disposeTextures()}renderNode(e,t,r,s){const i=r?.composite?.colorTexture;if(!(this._isEnabled&&this._context&&r&&i))return s;if(!(this._edgeTechnique?.compiled&&this._blendTechnique?.compiled&&this._blurTechnique?.compiled))return this._context.requestRender(),s;const o=i.descriptor.width,a=i.descriptor.height,n=this._context.fbos,h=e.rctx;h.setViewport(0,0,o,a);const l=n.acquire(c.RG,o,a);h.bindFramebuffer(l.fbo),h.setClearColor(0,0,0,1),h.clear(g.COLOR_BUFFER_BIT),this._smaaParameters.color=i,h.bindTechnique(this._edgeTechnique,this._smaaParameters),h.screen.draw();const u=n.acquire(c.RGBA,o,a);return h.bindFramebuffer(u.fbo),h.setClearColor(0,0,1,1),h.clear(g.COLOR_BUFFER_BIT),this._smaaParameters.inputTexture=l.colorTexture,this._smaaParameters.areaTexture=this._areaTexture,this._smaaParameters.searchTexture=this._searchTexture,h.bindTechnique(this._blendTechnique,this._smaaParameters),h.screen.draw(),h.bindFramebuffer(s?.fbo),l.release(),h.setClearColor(0,1,0,1),h.clear(g.COLOR_BUFFER_BIT),this._smaaParameters.inputTexture=u.colorTexture,h.bindTechnique(this._blurTechnique,this._smaaParameters),h.screen.draw(),u.release(),s}};function E(e,t,r,s){const i=new A;return i.pixelFormat=r,i.wrapMode=C.CLAMP_TO_EDGE,i.width=s.width,i.height=s.height,i.samplingMode=t,new j(e,i,s)}e([h()],w.prototype,"view",void 0),e([h()],w.prototype,"_context",void 0),e([h()],w.prototype,"_abortController",void 0),e([h({readOnly:!0})],w.prototype,"updating",null),w=e([l("esri.views.3d.webgl-engine.lib.SMAA")],w);export{w as SMAA};
|
|
@@ -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{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as r,syncAndInitial as s}from"../../../../../core/reactiveUtils.js";import{Milliseconds as i}from"../../../../../core/time.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{s as n}from"../../../../../chunks/vec2.js";import{ColorFormat as c}from"../../core/FBOCache.js";import{SyncRenderPlugin as
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{disposeMaybe as t}from"../../../../../core/maybe.js";import{watch as r,syncAndInitial as s}from"../../../../../core/reactiveUtils.js";import{Milliseconds as i}from"../../../../../core/time.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as a}from"../../../../../core/accessorSupport/decorators/subclass.js";import{s as n}from"../../../../../chunks/vec2.js";import{ColorFormat as c}from"../../core/FBOCache.js";import{SyncRenderPlugin as l,ConsumesDepthNormal as m,ConsumesNone as u}from"../RenderPlugin.js";import{SSAOBlurTechnique as h}from"./SSAOBlurTechnique.js";import{noiseData as p}from"./SSAONoiseData.js";import{SSAOPassParameters as _,BlurDrawParameters as d}from"./SSAOParameters.js";import{SSAOTechnique as b}from"./SSAOTechnique.js";import{RenderFeature as w}from"../../lib/RenderFeature.js";import{RenderSlot as T}from"../../lib/RenderSlot.js";import{g as f}from"../../../../../chunks/SSAO.glsl.js";import{TextureWrapMode as x,PixelFormat as P,ClearBufferBit as S}from"../../../../webgl/enums.js";import{Texture as q}from"../../../../webgl/Texture.js";import{TextureDescriptor as j}from"../../../../webgl/TextureDescriptor.js";const R=2;let y=class extends l{constructor(e){super(e),this._context=null,this._passParameters=new _,this._drawParameters=new d,this.produces=new Map([[T.SSAO,()=>this._produces()]])}_produces(){return null!=this._enableTime&&null!=this._context}consumes(){return this._produces()?m:u}initializeRenderContext(e){this._context=e,this.addHandles([r((()=>this.view.qualitySettings.ambientOcclusion||this._context?.isFeatureEnabled(w.SSAO)),(e=>e?this._enable():this._disable()),s)])}uninitializeRenderContext(){this._disable(),this._context=null}_disable(){this._passParameters.noiseTexture=t(this._passParameters.noiseTexture),this._enableTime=null}destroy(){this._disable()}_enable(){if(null!=this._enableTime||!this._context)return;const e=Uint8Array.from(atob(p),(e=>e.charCodeAt(0))),t=new j;t.wrapMode=x.CLAMP_TO_EDGE,t.pixelFormat=P.RGB,t.wrapMode=x.REPEAT,t.hasMipmap=!0,t.width=32,t.height=32,this._passParameters.noiseTexture=new q(this._context.renderContext.rctx,t,e),null==this._ssaoTechnique&&(this._ssaoTechnique=this._context.techniqueRepository.acquire(b)),null==this._blurTechnique&&(this._blurTechnique=this._context.techniqueRepository.acquire(h)),this._enableTime=i(0),this._context?.requestRender()}renderNode(e,t,r){const s=e.bindParameters,i=s.linearDepth?.colorTexture,o=r?.normal?.colorTexture;if(null==this._enableTime||null==this._context||null==i||!o)return;if(!this._ssaoTechnique.compiled||!this._blurTechnique.compiled)return this._enableTime=e.time,void this._context.requestRender();0===this._enableTime&&(this._enableTime=e.time);const a=e.rctx,l=s.camera,m=this.view.qualitySettings.fadeDuration,u=m>0?Math.min(m,e.time-this._enableTime)/m:1;this._passParameters.normalTexture=o,this._passParameters.depthTexture=i,this._passParameters.projScale=1/l.computeScreenPixelSizeAtDist(1),this._passParameters.intensity=4*O/f(l)**6*u;const h=l.fullViewport[2],p=l.fullViewport[3],_=h/R,d=p/R,b=this._context.fbos,w=b.acquire(c.RED,h,p);a.bindFramebuffer(w.fbo),a.setViewport(0,0,h,p);a.bindTechnique(this._ssaoTechnique,this._passParameters,s).bindDraw(this._drawParameters,s,this._passParameters),a.screen.draw();const T=a.bindTechnique(this._blurTechnique,this._passParameters,s);a.setViewport(0,0,_,d);const x=b.acquire(c.RED,_,d);a.bindFramebuffer(x.fbo),this._drawParameters.colorTexture=w.colorTexture,n(this._drawParameters.blurSize,0,R/p),T.bindDraw(this._drawParameters,s,this._passParameters),a.setViewport(0,0,_,d),a.screen.draw(),w.release();const P=b.acquire(c.RED,_,d);return a.bindFramebuffer(P.fbo),a.setViewport(0,0,h,p),a.setClearColor(1,1,1,0),a.clear(S.COLOR_BUFFER_BIT),a.setViewport(0,0,_,d),this._drawParameters.colorTexture=x.colorTexture,n(this._drawParameters.blurSize,R/h,0),T.bindDraw(this._drawParameters,s,this._passParameters),a.screen.draw(),a.setViewport4fv(l.fullViewport),x.release(),u<1&&this._context.requestRender(),P}};e([o({constructOnly:!0})],y.prototype,"view",void 0),e([o()],y.prototype,"_context",void 0),y=e([a("esri.views.3d.webgl-engine.lib.SSAO")],y);const O=.5;export{y as SSAO,R as blurSizePixels};
|
|
@@ -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{I as t,b as i}from"../../../../chunks/mat4f64.js";import{e}from"../../../../chunks/vec3.js";import{
|
|
5
|
+
import{I as t,b as i}from"../../../../chunks/mat4f64.js";import{e}from"../../../../chunks/vec3.js";import{compactIndices as n,getContinuousIndexArray as s}from"../../../../geometry/support/Indices.js";import{cloneAttributeData as r}from"./AttributeArray.js";import{Object3DState as o}from"./basicInterfaces.js";import{BoundingInfo as h}from"./BoundingInfo.js";import{ContentObject as a}from"./ContentObject.js";import{ContentObjectType as u}from"./ContentObjectType.js";import{computeAttachmentOriginTriangles as g,computeAttachmentOriginLines as c,computeAttachmentOriginPoints as m}from"./geometryDataUtils.js";import{Object3DStateID as l}from"./Object3DStateID.js";import{assert as d}from"./Util.js";import{VertexAttribute as f}from"./VertexAttribute.js";import{addObject3DStateID as b,removeObject3DStateID as p}from"../materials/renderers/utils.js";class I extends a{constructor(t,i,e=null,s=u.Mesh,r=null,o=-1){super(),this.material=t,this.mapPositions=e,this.type=s,this.objectAndLayerIdColor=r,this.edgeIndicesLength=o,this.visible=!0,this._attributes=new Map,this._boundingInfo=null;for(const[h,a]of i)this._attributes.set(h,{...a,indices:n(a.indices)}),h===f.POSITION&&(this.edgeIndicesLength=this.edgeIndicesLength<0?this._attributes.get(h).indices.length:this.edgeIndicesLength)}instantiate(t={}){const i=new I(t.material||this.material,[],this.mapPositions,this.type,this.objectAndLayerIdColor,this.edgeIndicesLength);return this._attributes.forEach(((t,e)=>{t.exclusive=!1,i._attributes.set(e,t)})),i._boundingInfo=this._boundingInfo,i.transformation=t.transformation||this.transformation,i}get attributes(){return this._attributes}getMutableAttribute(t){let i=this._attributes.get(t);return i&&!i.exclusive&&(i={...i,exclusive:!0,data:r(i.data)},this._attributes.set(t,i)),i}setAttributeData(t,i){const e=this._attributes.get(t);e&&this._attributes.set(t,{...e,exclusive:!0,data:i})}get indexCount(){const t=this._attributes.values().next().value.indices;return t?.length??0}get faceCount(){return this.indexCount/3}get boundingInfo(){return null==this._boundingInfo&&(this._boundingInfo=this._calculateBoundingInfo()),this._boundingInfo}computeAttachmentOrigin(t){return!!(this.type===u.Mesh?this._computeAttachmentOriginTriangles(t):this.type===u.Line?this._computeAttachmentOriginLines(t):this._computeAttachmentOriginPoints(t))&&(null!=this._transformation&&e(t,t,this._transformation),!0)}_computeAttachmentOriginTriangles(t){const i=this.attributes.get(f.POSITION);return g(i,t)}_computeAttachmentOriginLines(t){const i=this.attributes.get(f.POSITION);return c(i,_(this.material.parameters,i),t)}_computeAttachmentOriginPoints(t){const i=this.attributes.get(f.POSITION);return m(i,t)}invalidateBoundingInfo(){this._boundingInfo=null}_calculateBoundingInfo(){const t=this.attributes.get(f.POSITION);if(!t||0===t.indices.length)return null;const i=this.type===u.Mesh?3:1;d(t.indices.length%i==0,"Indexing error: "+t.indices.length+" not divisible by "+i);const e=s(t.indices.length/i);return new h(e,i,t)}get transformation(){return this._transformation??t}set transformation(e){this._transformation=e&&e!==t?i(e):null}addHighlight(){const t=new l(o.Highlight);return this.highlights=b(this.highlights,t),t}removeHighlight(t){this.highlights=p(this.highlights,t)}}function _(t,i){return!(!("isClosed"in t)||!t.isClosed)&&i.indices.length>2}export{I as Geometry};
|