@arcgis/core 4.30.0-next.20240313 → 4.30.0-next.20240315
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/arcade/featureset/support/FeatureSet.js +1 -1
- package/arcade/functions/knowledgegraph.js +1 -1
- package/arcade/functions/maths.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{90c569353df5af9ed368.js → 0877c99e0338f8e7c0c8.js} +1 -1
- package/assets/esri/core/workers/chunks/{c76e155332aa0491de3d.js → 0ef3fee7614596d591ba.js} +1 -1
- package/assets/esri/core/workers/chunks/{2d60f3af5886b7dea9ee.js → 12b95408753cea053a40.js} +1 -1
- package/assets/esri/core/workers/chunks/{b93e601da1592f153a3d.js → 13b6de78894ba1a70ace.js} +1 -1
- package/assets/esri/core/workers/chunks/14b9001a3233075dd1b7.js +1 -0
- package/assets/esri/core/workers/chunks/16397420fb6067b47b25.js +1 -0
- package/assets/esri/core/workers/chunks/{67abe8171d41cf21624f.js → 1696784da83588878989.js} +1 -1
- package/assets/esri/core/workers/chunks/{a38ab7cb733426de9588.js → 25d68c7837631f497edb.js} +1 -1
- package/assets/esri/core/workers/chunks/{39ff4d571abbd2df5d5b.js → 2707b8ef8ca636e184ba.js} +1 -1
- package/assets/esri/core/workers/chunks/2d0a01d0957b3e4512f6.js +1 -0
- package/assets/esri/core/workers/chunks/4b25dc661bb958e651fd.js +1 -0
- package/assets/esri/core/workers/chunks/{f5a0f106d9edaddb83fa.js → 4e4c146796a47da2c5a1.js} +1 -1
- package/assets/esri/core/workers/chunks/{f46bc8e507d75d218ac7.js → 5929931ff9ecde6cc084.js} +1 -1
- package/assets/esri/core/workers/chunks/5a747af5273646ab848c.js +1 -0
- package/assets/esri/core/workers/chunks/{da7189c3077f49858dc8.js → 5b6fe9c935e065d59ab7.js} +1 -1
- package/assets/esri/core/workers/chunks/6867fe9937c49e99eb6f.js +2 -0
- package/assets/esri/core/workers/chunks/{fd4ec788953d9776126f.js → 7bc977db7b2dc3d238b5.js} +1 -1
- package/assets/esri/core/workers/chunks/7d7c0aee461571a7c1f8.js +1 -0
- package/assets/esri/core/workers/chunks/{03ae0196aafcb6146f61.js → 7f87af6ec7160e9fd713.js} +1 -1
- package/assets/esri/core/workers/chunks/8ca8ae3207b1025d0116.js +1 -0
- package/assets/esri/core/workers/chunks/8cdfd39b5f4d12c77f0b.js +1 -0
- package/assets/esri/core/workers/chunks/{893d96c21d929d38ab58.js → 8efb216c3250bd3a5bd8.js} +1 -1
- package/assets/esri/core/workers/chunks/{c0217dde5ff4d6a4c14c.js → 8fc69ac4cce6d4dd5513.js} +1 -1
- package/assets/esri/core/workers/chunks/{a1a557cbfb0aa915f81b.js → 95d7b168991ddb3a96ca.js} +1 -1
- package/assets/esri/core/workers/chunks/{67ab6af927ea04c01a40.js → a658dd87b1b59e9cf2a3.js} +1 -1
- package/assets/esri/core/workers/chunks/{c67b99d2a8376a15a71b.js → bd6a9816d88d757f143e.js} +1 -1
- package/assets/esri/core/workers/chunks/{933f56e7299a5844e367.js → de33bb5df97c66623b68.js} +1 -1
- package/assets/esri/core/workers/chunks/{9656002ff528a7eda746.js → e5cb8297d5824f139b3e.js} +1 -1
- package/assets/esri/core/workers/chunks/eb3e82ed1653ecf348da.js +1 -0
- package/assets/esri/core/workers/chunks/f969c134b1694c4c7cb4.js +1 -0
- package/assets/esri/core/workers/chunks/{85d573c58a6b80c38c1d.js → fe7dfb8546d0fc40843c.js} +1 -1
- package/assets/esri/themes/base/widgets/_Popup.scss +4 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/terrainUtilsPlanar.js +1 -1
- package/chunks/terrainUtilsSpherical.js +1 -1
- package/core/arrayUtils.js +1 -1
- package/interfaces.d.ts +93 -18
- package/layers/support/ControlPointsGeoreference.js +1 -1
- package/layers/support/CornersGeoreference.js +1 -1
- package/layers/support/ExtentAndRotationGeoreference.js +1 -1
- package/layers/support/LocalMediaElementSource.js +1 -1
- package/networks/Network.js +1 -1
- package/networks/UtilityNetwork.js +1 -1
- package/package.json +1 -1
- package/portal/PortalItemResource.js +1 -1
- package/renderers/support/DictionaryLoader.js +1 -1
- package/renderers/support/RasterSymbolizer.js +1 -1
- package/rest/featureService/FeatureService.js +1 -1
- package/rest/geoprocessor/utils.js +1 -1
- package/smartMapping/raster/support/adapters/ImageryTileLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/cim/Rasterizer.js +1 -1
- package/symbols/cim/TextRasterizer.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/undoredo/support/ApplySet.js +5 -0
- package/undoredo/support/ApplySetItem.js +5 -0
- package/versionManagement/VersionManagementService.js +1 -1
- package/views/2d/engine/DisplayObject.js +1 -1
- package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/GraphShaderModule.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/TechniqueDebugContainer.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/TechniqueDebugLayer.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/TestDisplayObject.js +1 -1
- package/views/2d/interactive/editingTools/TransformTool.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/features/FeatureContainer.js +1 -1
- package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/magnifier/MagnifierView2D.js +1 -1
- package/views/2d/support/hitTestUtils.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionVisualization.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/environment/LocalAtmosphere.js +1 -1
- package/views/3d/environment/Precipitation.js +1 -1
- package/views/3d/environment/Stars.js +1 -1
- package/views/3d/glTF/internal/Resource.js +1 -1
- package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
- package/views/3d/interactive/editingTools/ManipulatedObject3DGraphic.js +5 -0
- package/views/3d/interactive/editingTools/ManipulatedObject3DMediaElement.js +5 -0
- package/views/3d/interactive/editingTools/lineObjectVisualElementUtils.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/MoveXYObjectManipulation.js +1 -1
- package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
- package/views/3d/interactive/editingTools/media/MediaElementControllerControlPoints.js +5 -0
- package/views/3d/interactive/editingTools/media/MediaElementControllerShape.js +5 -0
- package/views/3d/interactive/editingTools/media/MediaElementManipulator3D.js +5 -0
- package/views/3d/interactive/editingTools/media/mediaElementUtils.js +5 -0
- package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeTool3D.js +1 -1
- package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
- package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/ExtentRotate.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/PreserveAspectRatio.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/SnapRotation.js +5 -0
- package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudWorker.js +1 -1
- package/views/3d/layers/PointCloudWorkerHandle.js +1 -1
- package/views/3d/layers/TiledLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshObject3DGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectStates.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/ObjectResourceCache.js +1 -1
- package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
- package/views/3d/layers/support/MediaLayerInteraction.js +5 -0
- package/views/3d/layers/support/MediaLayerInteractionOptions.js +5 -0
- package/views/3d/layers/support/TemporalSceneLayerView.js +1 -1
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/terrain/ExtentHelper.js +1 -1
- package/views/3d/terrain/TilingScheme.js +1 -1
- package/views/3d/terrain/terrainUtils.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/MapView.js +1 -1
- package/views/draw/DrawAction.js +1 -1
- package/views/draw/support/Box.js +1 -1
- package/views/draw/support/GraphicMover.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/input/ViewEvents.js +1 -1
- package/views/input/gamepad/GamepadSource.js +1 -1
- package/views/input/recognizers/DoubleTapDrag.js +1 -1
- package/views/input/recognizers/PointerClickHoldAndDrag.js +1 -1
- package/views/input/recognizers/SingleAndDoubleClick.js +1 -1
- package/views/interactive/ToolViewManagerManipulatorState.js +1 -1
- package/views/interactive/keybindings.js +1 -1
- package/views/interactive/snapping/FeatureSnappingSourceInfo.js +1 -1
- package/views/interactive/snapping/LineSnapper.js +1 -1
- package/views/interactive/snapping/ParallelLineSnapper.js +1 -1
- package/views/interactive/snapping/RightAngleSnapper.js +1 -1
- package/views/interactive/snapping/SnappingManager.js +1 -1
- package/views/interactive/snapping/SnappingVisualizer.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorkerHandle.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileStore.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/PendingFeatureTile.js +1 -1
- package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
- package/views/interactive/snapping/featureSources/snappingCandidateElevationAlignment.js +1 -1
- package/views/interactive/tooltip/components/DrawHeaderActions.js +1 -1
- package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
- package/views/layers/MediaLayerView.d.ts +4 -0
- package/views/layers/MediaLayerView.js +5 -0
- package/views/support/waitForResources.js +1 -1
- package/views/webgl/ContextState.js +1 -1
- package/views/webgl/RenderingContext.js +1 -1
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/Bookmarks.js +1 -1
- package/widgets/Home.js +1 -1
- package/widgets/LayerList/support/layerListUtils.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/utils.js +1 -1
- package/widgets/Popup/css.js +1 -1
- package/widgets/Popup.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/TableList.js +1 -1
- package/widgets/UtilityNetworkAssociations.js +1 -1
- package/widgets/Zoom.js +1 -1
- package/assets/esri/core/workers/chunks/0feee6447793bc42df9d.js +0 -1
- package/assets/esri/core/workers/chunks/1805a6e63a1bfe6950be.js +0 -1
- package/assets/esri/core/workers/chunks/2ceebeac397374a126ba.js +0 -2
- package/assets/esri/core/workers/chunks/678ffc061fe5dec51930.js +0 -1
- package/assets/esri/core/workers/chunks/6c5ea910265d4f6a368d.js +0 -1
- package/assets/esri/core/workers/chunks/6fa0abf415859f40ea6c.js +0 -1
- package/assets/esri/core/workers/chunks/a1978ae86e466020dd28.js +0 -1
- package/assets/esri/core/workers/chunks/bf041907bac8fae05c2b.js +0 -1
- package/assets/esri/core/workers/chunks/c018ce3935d5f1e60e3c.js +0 -1
- package/assets/esri/core/workers/chunks/cccf63c65070c6a47b16.js +0 -1
- package/assets/esri/core/workers/chunks/d2e4c01e33691801f9ef.js +0 -1
- package/views/3d/interactive/editingTools/ManipulatedObjectGraphic3D.js +0 -5
- /package/assets/esri/core/workers/chunks/{2ceebeac397374a126ba.js.LICENSE.txt → 6867fe9937c49e99eb6f.js.LICENSE.txt} +0 -0
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{update as r}from"../../../../core/arrayUtils.js";import{unitRGBAFromColor as t}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{removeMaybe as s,destroyMaybe as i,releaseMaybe as a}from"../../../../core/maybe.js";import n from"../../../../core/PooledArray.js";import{watch as h,syncAndInitial as o,initial as d,sync as l}from"../../../../core/reactiveUtils.js";import{signal as _}from"../../../../core/signal.js";import{property as p}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/accessorSupport/interfaces.js";import"../../../../core/accessorSupport/tracking/Flags.js";import"../../../../core/Warning.js";import"../../../../core/Error.js";import{equals as u,invert as c,multiply as m}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as g,create as f}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as T}from"../../../../chunks/vec42.js";import{fromValues as A,ZEROS as E}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{a as b}from"../../../../chunks/boundedPlane.js";import{debugFlags as R}from"../../support/debugFlags.js";import{TransparencyMode as P}from"../../terrain/TerrainRenderer.js";import{DepthFormat as S,ColorFormat as C}from"../../webgl/formats.js";import{FBOCache as I}from"../core/FBOCache.js";import{RenderPassManager as O}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as w}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as y}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{RenderNodes as D}from"../effects/RenderNodes.js";import{isPrepareRenderPlugin as N}from"../effects/RenderPlugin.js";import{RenderPluginManager as L}from"../effects/RenderPluginManager.js";import{Blit as H}from"../effects/blit/Blit.js";import{Highlight as M}from"../effects/highlight/Highlight.js";import{ShadowHighlight as x}from"../effects/highlight/ShadowHighlight.js";import{SMAA as v}from"../effects/smaa/SMAA.js";import{SSAO as F}from"../effects/ssao/SSAO.js";import{AnimationTimeStep as U}from"./AnimationTimeStep.js";import{Decorations as q,RenderRequestType as j,StencilBits as G}from"./basicInterfaces.js";import{BoundingInfo as B}from"./BoundingInfo.js";import{zero as V,union as Q}from"./depthRange.js";import{depthRangeFromScene as k}from"./depthRangeUtils.js";import{RenderOccludedFlag as W}from"./Material.js";import{OffscreenRendering as X}from"./OffscreenRendering.js";import{RenderContext as Y,defaultRenderOccludedMask as z}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as J,RendererTarget as K}from"./rendererUtils.js";import{setupFeatureDefaults as Z,RenderFeature as $}from"./RenderFeature.js";import{RenderSlot as ee}from"./RenderSlot.js";import{ShadowAccumulator as re}from"./ShadowAccumulator.js";import{ShadowMap as te,SnapshotSlot as se}from"./ShadowMap.js";import ie from"./SliceHelper.js";import{TransparencyPassType as ae}from"./TransparencyPassType.js";import{EdgeView as ne}from"./edgeRendering/EdgeView.js";import{Transparency as he}from"./edgeRendering/interfaces.js";import{MergedRenderer as oe}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as de}from"../shaders/CompositingTechniqueConfiguration.js";import{RendererPerformanceInfo as le,PerformanceCategory as _e}from"../statistics/RendererPerformanceInfo.js";import{RenderState as pe}from"../../../support/RenderState.js";import{PixelFormat as ue,PixelType as ce,ClearBufferBit as me,DepthStencilAttachment as ge}from"../../../webgl/enums.js";class fe{constructor(e,r,s,i,a,n,l,p){this._stage=e,this._techniqueRepository=i,this._rctx=a,this._compositingHelper=n,this._magnifierHelper=l,this._requestRender=p,this._pluginsHas={hudElements:!1,water:!1},this._hasOverlayWater=!1,this.renderOverlay=e=>{},this._isRendering=!1,this._backgroundColor=A(0,0,0,1),this._sliceHelper=new ie,this._state=_(pe.IDLE),this._highQualityTransparencyEnabled=!0,this._terrainTransparency=P.Opaque,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new U,this._reprojectionMatrixVersion=_(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new Map,this._releaseNormals=e=>{e.find((({name:e})=>"normals"===e))?.release()&&this._pluginInput.delete("normals")},this._debugLinearDepth=!1,this.fboCache=new I(a),this._renderStateFeatures=_(Z(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._offscreen=new X(this.fboCache,this._compositingHelper),this.performanceInfo=new le(this._rctx),this._shadowMap=new te(this.fboCache,e.viewingMode),this._highlight=new M({view:e.view}),this._shadowHighlight=new x({view:e.view,viewingMode:e.viewingMode}),this._shadowAccumulator=new re(this.fboCache,i,e,(e=>{const r=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=r}),((e,r,t)=>{const s=this._stage.view.qualitySettings.maximumPixelRatio;e.shadowMap.start(e.camera,r,t,!0,s),this._renderShadowCascades(w.Shadow,e.shadowMap),e.shadowMap.finish(),e.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(e.camera,e.contentCamera)}),p),this._ssao=new F({view:this._stage.view}),this._renderContext=new Y(this._rctx,this._offscreen,this._shadowMap,this._sliceHelper),this._nodes=new D(this._renderContext),this._plugins=new L({renderContext:this._renderContext,techniqueRepository:i,textureRepository:s,materialRepository:r,requestRender:p,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this.renderPassManager=new O,this._plugins.add(this.renderPassManager),this._smaa=new v({view:this._stage.view}),this._plugins.add(this._smaa),this._blit=new H({opacity:1,alphaMode:de.None}),this._plugins.add(this._blit),this._plugins.add(this._ssao),this._plugins.add(this._highlight),this._plugins.add(this._shadowHighlight),this._handles=[h((()=>this._stage.view.state.camera),(()=>p()),o),h((()=>R.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(he.TRANSPARENT):()=>{},p()}),d),h((()=>this._stage.view.environment.background?.color),(e=>{const r=e?t(e):E;T(this._backgroundColor,r[0]*r[3],r[1]*r[3],r[2]*r[3],r[3]),p()}),o)]}destroy(){this._handles.forEach((e=>e.remove())),this._gpuTimerHandle=s(this._gpuTimerHandle),this._nodes.destroy(),this._offscreen.dispose(),this._shadowMap.dispose(),this._highlight.dispose(),this._shadowAccumulator.dispose(),this._edgeView=i(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),B.prune()}get _bindParameters(){return this._renderContext.bindParameters}updateRenderFeatures(e=null,r=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=Z(r,e),this._plugins.renderFeatureChanged(),this._requestRender()}isFeatureEnabled(e,r=this._state.value){return this._renderStateFeatures.value.get(r,e)??!1}setFeatureEnabled(e,r,t){this._renderStateFeatures.mutate((s=>s.set(r,e,t))),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled($.HighQualityTransparency)}get hasReflections(){return(this._pluginsHas.water||this._hasOverlayWater)&&(this._ssrEnabled||this.isFeatureEnabled($.WaterReflection))}get hasDecorations(){return this._plugins.hasDecorations}get hasHighlights(){return this._plugins.produces(ee.OPAQUE_MATERIAL,w.Highlight)||this._plugins.produces(ee.TRANSPARENT_MATERIAL,w.Highlight)||this._plugins.produces(ee.DRAPED_MATERIAL,w.Highlight)}get _magnifierEnabled(){return this._bindParameters.decorations===q.ON&&this._magnifierHelper.enabled}get fullResolutionAtmosphere(){return this._stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled($.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=a(this._bindParameters.ssr.lastFrameColor),this._bindParameters.multipassTerrain.linearDepth=a(this._bindParameters.multipassTerrain.linearDepth),this._bindParameters.multipassGeometry.linearDepth=a(this._bindParameters.multipassGeometry.linearDepth)}_disposeOffscreenBuffers(){this._offscreen.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.linearDepth=a(this._bindParameters.linearDepth),this._bindParameters.hudVisibility=a(this._bindParameters.hudVisibility)}get updating(){return this._smaa.updating||null!=this._edgeView&&this._edgeView.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}ensureEdgeView(){if(null==this._edgeView){const e=this._stage.view.resourceController;this._edgeView=new ne({rctx:this._rctx,renderSR:this._stage.view.renderSpatialReference,viewingMode:this._stage.viewingMode,techniqueRepository:this._techniqueRepository,setNeedsRender:()=>this._requestRender(),schedule:Ce(e)}),this._handles.push(h((()=>this._edgeView?.updating),(()=>this._requestRender()),l)),this._requestRender()}return this._edgeView}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&u(this._bindParameters.ssr.reprojectionMatrix,g)}set _reprojectionMatrix(e){r(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:r,_bindParameters:t}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&r.maxCascades!==e.shadowMapMaxCascades&&(r.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const r="virtual"!==e.environment.lighting.type;t.enableFillLights!==r&&(t.enableFillLights=r,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=e.slicePlane,this._requestRender()),void 0!==e.terrainTransparency&&this._terrainTransparency!==e.terrainTransparency&&(this._terrainTransparency=e.terrainTransparency,this._requestRender()),void 0!==e.shadowCastOptions&&this._shadowAccumulator.setOptions(e.shadowCastOptions)}get hasSlicePlane(){return!!this._sliceHelper.plane}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,r){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:t,removes:s,updates:i}=e;if(0===t.length&&0===s.length&&0===i.length)return;const a=J(e);let n=!1;a.forEach(((t,s)=>{if(r.done)return;let i=this._plugins.getMaterialRenderer(s);if(null==i&&t.adds.length>0){const e=new oe({material:s});e.initializeRenderContext(this._plugins._context),i=e,this._plugins.add(i)}i&&(i.modify(t),0===i.numGeometries&&(n=!0)),t.removes.forEach((r=>e.removes.removeUnordered(r))),t.adds.forEach((r=>e.adds.removeUnordered(r))),t.updates.forEach((r=>e.updates.removeUnordered(r))),r.madeProgress()})),n&&this._plugins.removeEmptyMaterialRenderers(),this._updateHasFlags(),this._requestRender()}_updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(ee.LINE_CALLOUTS_HUD_DEPTH)||this._plugins.produces(ee.HUD_MATERIAL)||this._plugins.produces(ee.LABEL_MATERIAL),has.water=this._plugins.produces(ee.DRAPED_WATER,w.Normal),this._bindParameters.hasOccludees=this._plugins.hasOccludees}updateAnimation(e){const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(e),this._hasAnimations=this._nodes.updateAnimation()||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?s(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,r,t=K.Default,s=q.ON){this._isRendering=!0,this.performanceInfo.startFrame(),this.fboCache.frameStart(),this._disposeBindBuffers();const i=this._offscreen,{camera:n,contentCamera:h,mode:o,alignPixelEnabled:d}=e;this._state.value=o,this._bindParameters.overlay=this.renderOverlay(r),this.performanceInfo.advance(_e.OVERLAY),this._renderContext.time=r,this._bindParameters.transparencyPassType=ae.NONE,this._bindParameters.alignPixelEnabled=d,this._bindParameters.decorations=s,this._bindParameters.mainColor=this._bindParameters.mainDepth=null;const l=b(this._sliceHelper.plane);s===q.OFF&&(this._sliceHelper.plane=null),n.setGLViewport(this._rctx);const _=i.initializeFrame(n,this._backgroundColor,t);this.hasReflections?this._bindParameters.ssr.lastFrameColor=_:_?.release(),this._ensureBindParametersCamera(n,h),this._plugins.prepareRender(),this.performanceInfo.advance(_e.PREPARE);const p=this._computeDepthRange(n);this._renderShadowMap(n,this._bindParameters.lighting.mainLight.direction,p),this.performanceInfo.advance(_e.SHADOW_MAP),this._ensureBindParametersCamera(n,h);const u=this._plugins.produces(ee.OPAQUE_TERRAIN)&&(this._terrainTransparency===P.Semitransparent||this._terrainTransparency===P.TransparentWithDraped),c=this._highQualityTransparency&&u,m=this._plugins.produces(ee.TRANSPARENT_MATERIAL,w.Color);this._prepareShaders(c,m),this._pluginInput.set("normals",this._renderNormals()),this.performanceInfo.advance(_e.NORMALS),this._renderSSAO(),this.performanceInfo.advance(_e.SSAO),this._renderLinearDepth(),this.performanceInfo.advance(_e.LINEAR_DEPTH),this._renderShadowAccumulation(p,n,h),this.performanceInfo.advance(_e.ACCUMULATED_SHADOWS),this._ensureBindParametersSSR(r),this._renderContext.output=w.Color,i.bindFbo(),this._bindParameters.mainColor=i.colorTexture,this._bindParameters.mainDepth=i.depthTexture,this._renderOpaqueGeometry(),this._offscreen.updateColor((e=>this._invokeRenderNodes(e)),"opaque-color"),this._plugins.render(ee.ENVIRONMENT_OPAQUE),this.performanceInfo.advance(_e.OPAQUE),this.fboCache.debugCallback&&this.fboCache.debugCallback("opaque-color",this._offscreen.color.fbo),this._renderTerrainLinearDepth(c),this._setMultipassTerrain(c),this._renderEdges(he.OPAQUE),this.performanceInfo.advance(_e.OPAQUE_EDGES),i.bindFbo(),this._plugins.render(ee.VOXEL),this.performanceInfo.advance(_e.VOXEL),this._renderHiddenTransparentEdges(),m&&(this._oitEnabled?this._renderOITPass(Te.Geometry):this._renderTransparentMaterial()),this._offscreen.updateColor((e=>this._invokeRenderNodes(e)),"transparent-color"),this.performanceInfo.advance(_e.TRANSPARENT);const g=this._renderGeometryLinearDepth(c);this._renderHUDVisibility(g),c||this._plugins.render(ee.LINE_CALLOUTS),this.performanceInfo.advance(_e.HUD_VISIBILITY);const f=t===K.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;this.performanceInfo.advance(_e.OBJECT_AND_LAYER_ID_COLOR),this._renderEdges(he.TRANSPARENT,g),g?.release(),this.performanceInfo.advance(_e.TRANSPARENT_EDGES);const T=u?this._renderTransparentTerrain():null;T&&this._bindParameters.hudVisibility&&(c?this._renderLineCallouts(y.Occluded):i.compositeToHUDVisibility(this._bindParameters,T.getTexture()),this._renderHUD(y.Occluded,i.color),this.performanceInfo.advance(_e.HUD_OCCLUDED)),this.performanceInfo.advance(_e.TRANSPARENT_TERRAIN),this._setTerrainCulling(!1),T&&(i.compositeToFramebuffer(this._bindParameters,T.getTexture(),de.PremultipliedAlpha,1),T.release(),c&&(this._renderEdges(he.OPAQUE),this.performanceInfo.advance(_e.OPAQUE_EDGES),m&&(this._oitEnabled?this._renderOITPass(Te.Geometry):this._renderTransparentMaterial()),this.performanceInfo.advance(_e.TRANSPARENT),this._renderEdges(he.TRANSPARENT),this.performanceInfo.advance(_e.TRANSPARENT_EDGES))),this._bindParameters.ssao=a(this._bindParameters.ssao),c&&this._renderLineCallouts(y.NotOccluded),this._setMultipassEnabled(!1),this._shadowAccumulator.render(this._bindParameters),i.bindFbo(),this._plugins.render(ee.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._plugins.render(ee.ENVIRONMENT_TRANSPARENT),this.performanceInfo.advance(_e.ENVIRONMENT),this._renderLaserlines(),this.performanceInfo.advance(_e.LASER_LINES),this._renderOccluded(),this.performanceInfo.advance(_e.OCCLUDED);let A=this._renderHighlightPrepass();A&&this._renderShadowHighlights(A,this._bindParameters);const E=this._magnifierEnabled&&t===K.Default?this.fboCache.acquire(this._offscreen.width,this._offscreen.height,"magnifier"):null,R=t!==K.Default?this.fboCache.acquire(this._offscreen.width,this._offscreen.height,"screenshot"):null,S=this._renderComposite(E??R,A)??R;return this.performanceInfo.advance(_e.ANTIALIASING),this._renderHUD(y.NotOccluded,S),this.performanceInfo.advance(_e.HUD),A&&(this._renderHighlights(S,A,this._bindParameters),A=a(A)),this.performanceInfo.advance(_e.HIGHLIGHTS),this._magnifierEnabled&&this._magnifierHelper.render(this._rctx,this._bindParameters),S!==R&&(this._rctx.bindFramebuffer(R?.fbo),this._compositingHelper.composite(this._bindParameters,E?.getTexture(),de.None)),t===K.Default&&E?.release(),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),this._offscreen.releaseBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=l,this._isRendering=!1,this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),t!==K.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),{screen:R,oid:f}}_prepareShaders(e,r){this._renderContext.output=w.Color,this._prepareOpaqueGeometry(),this._setMultipassTerrain(e),this._plugins.prepare(ee.TRANSPARENT_TERRAIN),this._setMultipassTerrain(!1),e||this._plugins.prepare(ee.LINE_CALLOUTS),r&&this._prepareTransparencySlots(),this._plugins.prepare(ee.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._plugins.prepare(ee.ENVIRONMENT_TRANSPARENT),this._plugins.prepare(ee.LASERLINES),this._rctx.gl.flush()}_renderObjectAndLayerIdColor(){if(!has("enable-feature:objectAndLayerId-rendering"))return;const e=this._renderContext.output,r=this.fboCache.acquire(this._offscreen.width,this._offscreen.height,"oid");return r.acquireDepth(S.DEPTH_STENCIL_TEXTURE),this._rctx.bindFramebuffer(r.fbo),this.fboCache.rctx.clearFramebuffer([0,0,0,0],!0,!0),this._renderAllGeometry(w.ObjectAndLayerIdColor),this._rctx.bindFramebuffer(r.fbo),this.fboCache.rctx.clearFramebuffer(void 0,!0,!0),this._bindParameters.hudRenderStyle=y.NotOccluded,this._plugins.render(ee.HUD_MATERIAL),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const r=this.performanceInfo.gpuSamplingEnabled,t=e===j.BACKGROUND;if(t||r){const e=t?this.performanceInfo.elapsedTime:0,s=r?this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.getError(),i=Math.max(e,s);this._animationTimestep.frame(i,t)}}readDepthPixels(e,r,t){const s=this._bindParameters.linearDepth?.fbo;if(s?.colorTexture)return void s.readPixels(r[0],r[1],r[2],r[3],ue.RGBA,ce.UNSIGNED_BYTE,t);const i=this.fboCache.acquire(this._offscreen.width,this._offscreen.height,"depth").acquireDepth(S.DEPTH16_BUFFER);this._rctx.bindFramebuffer(i.fbo),this._ensureBindParametersCamera(e,e),this._bindParameters.camera.setGLViewport(this._rctx),this._rctx.setClearColor(0,0,0,0);const a=me.COLOR_BUFFER_BIT|me.DEPTH_BUFFER_BIT|me.STENCIL_BUFFER_BIT;this._rctx.clear(a),this._renderAllGeometry(w.LinearDepth),i.fbo.readPixels(r[0],r[1],r[2],r[3],ue.RGBA,ce.UNSIGNED_BYTE,t),i.release()}readHUDVisibility(e,r,t,s,i){this._bindParameters.hudVisibility?.fbo.readPixels(e,r,t,s,ue.RGBA,ce.UNSIGNED_BYTE,i)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_setMultipassTerrain(e){this._setMultipassEnabled(e),this._setTerrainCulling(e)}_setMultipassEnabled(e){this._bindParameters.multipassEnabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_renderEdges(e,r){const t=this._edgeView;if(t?.shouldRender()){const{width:s,height:i,depth:a}=this._offscreen,n=this.fboCache.acquire(s,i,"edges"),h=()=>t.render(this._bindParameters,e);this._offscreen.renderToTargets(h,n,r??a,Ee),this._offscreen.compositeToFramebuffer(this._bindParameters,n.getTexture(),de.Alpha,1),n.release()}}_renderShadowMap(e,r,t){const s=this._shadowMap;s.enabled&&(s.start(e,r,t,this.isFeatureEnabled($.HighResolutionShadows),this._stage.view.qualitySettings.maximumPixelRatio),this._shadowHighlight.updateParameters(e,r),this._needsShadowHighlight?(this._renderShadowCascades(w.ShadowHighlight,this._shadowMap),s.moveSnapshot(se.Highlight),this._renderShadowCascades(w.ShadowExcludeHighlight,this._shadowMap),s.copySnapshot(se.ExcludeHighlight),this._renderShadowCascades(w.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(w.Shadow),s.finish(),e.setGLViewport(this._rctx))}_renderShadowCascades(e,r=this._shadowMap){for(const t of r.cascades)t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.camera),this._renderAllGeometry(e)}get _needsLinearDepth(){return this._plugins.consumes(w.LinearDepth)||this.hasReflections||this._needsShadowHighlight||this._needsShadowCast||this._debugLinearDepth}_renderLinearDepth(){this._needsLinearDepth?(this._bindParameters.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.linearDepth,"linear-depth",(()=>this._renderAllGeometry(w.LinearDepth)),[0,0,0,0],C.RGBA,S.DEPTH_STENCIL_TEXTURE),this._bindParameters.linearDepth.detachDepth()):this._bindParameters.linearDepth=a(this._bindParameters.linearDepth)}_renderTerrainLinearDepth(e){if(e){const e=this._renderContext.output;this._renderContext.output=w.LinearDepth,this._bindParameters.multipassTerrain.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.multipassTerrain.linearDepth,"terrain depth",(()=>this._renderTransparentTerrain()),[-1e10,-1e10,-1e10,1]),this._bindParameters.multipassTerrain.linearDepth.detachDepth(),this._renderContext.output=e}else this._bindParameters.multipassTerrain.linearDepth=a(this._bindParameters.multipassTerrain.linearDepth)}_renderGeometryLinearDepth(e){if(!e)return void(this._bindParameters.multipassGeometry.linearDepth=a(this._bindParameters.multipassGeometry.linearDepth));const r=this._renderContext.output;this._bindParameters.multipassGeometry.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.multipassGeometry.linearDepth,"geometry depth",(()=>this._renderOpaqueGeometryAndTransparentMaterial(w.LinearDepth)),[1,1,1,1]),this._renderContext.output=r;const t=this._bindParameters.multipassGeometry.linearDepth.getAttachment(ge);return t?.retain(),this._bindParameters.multipassGeometry.linearDepth.detachDepth(),t}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return V;const r=k(e,this._plugins.plugins,this._stage.layers);return Q(r,this._plugins.queryDepthRange(e)),r.near=Math.max(e.near,r.near),r.far=Math.min(e.far,r.far),r}_renderNormals(){const e=this._plugins.produces(ee.SSAO),r=this._nodes.require("normals","composite-color")+this._nodes.require("normals","opaque-color")+this._nodes.require("normals","transparent-color");let t=(e?1:0)+r+(e||r>0?this._nodes.optional("normals","composite-color")+this._nodes.optional("normals","opaque-color")+this._nodes.optional("normals","transparent-color"):0);if(0===t)return;const s=this._offscreen.renderToCachedFBO(null,"normals",(()=>this._renderGeometryForSSAO(w.Normal)),[0,0,0,0],C.RGBA,S.DEPTH_STENCIL_TEXTURE);for(;--t>0;)s.retain();return s}_renderSSAO(){const e=this._pluginInput.get("normals");this._plugins.produces(ee.SSAO)&&e&&(this._bindParameters.ssao=this._plugins.render(ee.SSAO,this._pluginInput),e.detachDepth(),e.release()&&this._pluginInput.delete("normals"))}_renderAllGeometry(e){this._renderContext.output=e,this._plugins.prepare(ee.TRANSPARENT_TERRAIN),this._renderOpaqueGeometryAndTransparentMaterial(e),this._renderTransparentTerrain()}_renderOpaqueGeometryAndTransparentMaterial(e){this._renderContext.output=e,this._plugins.prepare(ee.TRANSPARENT_MATERIAL),this._plugins.prepare(ee.TRANSPARENT_NO_SSAO_DEPTH),this._renderOpaqueGeometry(),this._renderTransparentMaterial()}_renderGeometryForSSAO(e){this._renderContext.output=e,this._plugins.render(ee.INTEGRATED_MESH),this._plugins.render(ee.OPAQUE_TERRAIN),this._plugins.render(ee.OPAQUE_MATERIAL),this._plugins.render(ee.TRANSPARENT_MATERIAL),this._renderTransparentTerrain()}_prepareOpaqueGeometry(){this._plugins.prepare(ee.INTEGRATED_MESH),this._plugins.prepare(ee.OPAQUE_TERRAIN),this._plugins.prepare(ee.OPAQUE_MATERIAL),this._plugins.prepare(ee.OPAQUE_NO_SSAO_DEPTH),this._plugins.prepare(ee.ENVIRONMENT_OPAQUE)}_renderOpaqueGeometry(){this._plugins.render(ee.INTEGRATED_MESH),this._plugins.render(ee.OPAQUE_TERRAIN),this._plugins.render(ee.OPAQUE_MATERIAL),this._plugins.render(ee.OPAQUE_NO_SSAO_DEPTH)}_renderTransparentMaterial(){this._plugins.render(ee.TRANSPARENT_MATERIAL),this._plugins.render(ee.TRANSPARENT_NO_SSAO_DEPTH)}_renderTransparentTerrain(){if(!this._plugins.produces(ee.TRANSPARENT_TERRAIN))return;const e=()=>this._plugins.render(ee.TRANSPARENT_TERRAIN,null);if(this._renderContext.output!==w.Color)return void e();const{width:r,height:t,depth:s}=this._offscreen,i=this.fboCache.acquire(r,t,"transparent terrain");return this._offscreen.renderToTargets(e,i,s,[0,0,0,0]),i}_renderHUDVisibility(e){this._plugins.produces(ee.OCCLUSION_PIXELS)?(this._bindParameters.hudVisibility=this._offscreen.renderHUDVisibility(this._bindParameters.hudVisibility,(()=>this._plugins.render(ee.OCCLUSION_PIXELS)),e),this._offscreen.bindFbo()):this._bindParameters.hudVisibility=a(this._bindParameters.hudVisibility)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===y.Occluded){const e=()=>{this._plugins.render(ee.LINE_CALLOUTS)},{width:r,height:t,color:s}=this._offscreen,i=this.fboCache.acquireDepth(S.DEPTH16_BUFFER,r,t,"line callouts");this._offscreen.renderToTargets(e,s,i,void 0,!0,!0),i.release()}else this._plugins.render(ee.LINE_CALLOUTS)}_renderLaserlines(){if(this._plugins.render(ee.LASERLINES),this._plugins.produces(ee.LASERLINES_CONTRAST_CONTROL)){const e=this._offscreen,{width:r,height:t,depth:s}=e,i=this.fboCache.acquire(r,t,"laser lines"),a=()=>this._plugins.render(ee.LASERLINES_CONTRAST_CONTROL);e.renderToTargets(a,i,s,Ee),e.compositeToFramebuffer(this._bindParameters,i.getTexture(),de.PremultipliedAlpha,1),i.release()}}_renderHUD(e,r){if(this._pluginsHas.hudElements)if(this._oitEnabled){const t=this._renderOITPass(Te.HUD,e);this._rctx.bindFramebuffer(r?.fbo),this._compositingHelper.composite(this._bindParameters,t.getTexture(),de.PremultipliedAlpha),t.release()}else if(e===y.Occluded){this._renderContext.output=w.Color;const r=()=>this._renderHUDElements(e),{width:t,height:s,color:i}=this._offscreen,a=this.fboCache.acquireDepth(S.DEPTH16_BUFFER,t,s,"hud");this._offscreen.renderToTargets(r,i,a,void 0,!0,!0),a.release()}else this._renderContext.output=w.Color,this._rctx.bindFramebuffer(null),r?.acquireDepth(S.DEPTH16_BUFFER),this._rctx.bindFramebuffer(r?.fbo),this._renderHUDElements(e),r?.detachDepth()}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.prepare(ee.LINE_CALLOUTS_HUD_DEPTH),this._plugins.prepare(ee.HUD_MATERIAL),this._plugins.prepare(ee.LABEL_MATERIAL),this._plugins.render(ee.LINE_CALLOUTS_HUD_DEPTH),this._plugins.render(ee.HUD_MATERIAL),this._plugins.render(ee.LABEL_MATERIAL)}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._plugins.produces(ee.SHADOW_HIGHLIGHT)&&this._plugins.produces(ee.OPAQUE_MATERIAL,w.ShadowHighlight)}_renderHighlightPrepass(){if(!this.hasHighlights)return;const e=()=>{this._renderAllGeometry(w.Highlight),this._rctx.clear(me.DEPTH_BUFFER_BIT),this._renderHUDElements(y.Both)},r=this._offscreen.renderToCachedFBO(null,"highlights",e,[0,0,0,0],C.RGBA4,S.DEPTH_STENCIL_TEXTURE);return r.detachDepth(),r}_renderShadowHighlights(e,r){this.hasHighlights&&r.decorations!==q.OFF&&this._needsShadowHighlight&&this._offscreen.updateColor((r=>(this._pluginInput.set("highlights",e),this._plugins.render(ee.SHADOW_HIGHLIGHT,this._pluginInput,r),r)),"transparent-color")}_renderHighlights(e,r,t){this.hasHighlights&&t.decorations!==q.OFF&&this._plugins.produces(ee.HIGHLIGHT)&&(this._pluginInput.set("highlights",r),this._plugins.render(ee.HIGHLIGHT,this._pluginInput,e))}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_renderShadowAccumulation(e,r,t){this._needsShadowCast&&this._bindParameters.linearDepth?.getTexture()&&this._shadowAccumulator.renderAccumulation(this._bindParameters.linearDepth,e,r,t)}_prepareTransparencySlots(){this._renderContext.output=w.Alpha,this._bindParameters.transparencyPassType=ae.Alpha,this._plugins.prepare(ee.TRANSPARENT_MATERIAL),this._renderContext.output=w.Color,this._bindParameters.transparencyPassType=ae.Color,this._plugins.prepare(ee.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=ae.FrontFace,this._plugins.prepare(ee.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=ae.NONE}_renderOITPass(e,r=y.Both){const t=e===Te.HUD,s=t?this.fboCache.acquire(this._offscreen.width,this._offscreen.height,"oit hud composite"):null,i=t?()=>this._renderHUDElements(r):()=>this._renderTransparentMaterial(),a=this._renderContext.output;this._renderContext.output=w.Alpha,this._bindParameters.transparencyPassType=ae.Alpha;const n=this._offscreen.renderOITPass(i,ae.Alpha,t);this._renderContext.output=w.Color,this._bindParameters.transparencyPassType=ae.Color;const h=this._offscreen.renderOITPass(i,ae.Color,t);this._bindParameters.transparencyPassType=ae.FrontFace;const o=this._offscreen.renderOITPass(i,ae.FrontFace,t);return this._offscreen.compositeTransparentOntoOpaque(this._bindParameters,h,n,o,s),s?.detachDepth(),o.release(),h.release(),n.release(),this._bindParameters.transparencyPassType=ae.NONE,this._renderContext.output=a,s}_renderOccluded(){let e=0;be.clear(),this._plugins.plugins.forAll((r=>{if(!r.materialReference)return;r.queryRenderOccludedState(W.OccludeAndTransparentStencil)&&(e|=W.OccludeAndTransparentStencil,be.push(r))}));const r=this._offscreen,t=(t,s,i,a,n)=>{if(!(e&s))return;const{width:h,height:o,depth:d}=r,l=this.fboCache.acquire(h,o,"tmp color");r.renderToTargets(i,l,d,[0,0,0,0],a,n),r.compositeToFramebuffer(this._bindParameters,l.getTexture(),de.PremultipliedAlpha,t),l.release()},s=(e,r)=>{this._bindParameters.slot=e,r.forAll((e=>{if(N(e)){const r=e.prepareTechnique(this._renderContext);r&&e.renderNode(this._renderContext,r)}}))};0!==be.length&&(s(ee.OCCLUDER_MATERIAL,be),t(.5,W.OccludeAndTransparentStencil,(()=>s(ee.TRANSPARENT_OCCLUDER_MATERIAL,be)),!1,!1)),be.clear(),this._plugins.plugins.forAll((r=>{if(!r.materialReference)return;const t=r.queryRenderOccludedState(W.OccludeAndTransparent),s=r.queryRenderOccludedState(W.Transparent),i=r.queryRenderOccludedState(W.Opaque);(t||s||i)&&(e|=t?W.OccludeAndTransparent:s?W.Transparent:W.Opaque,be.push(r))}));const i=this._plugins.renderOccludedFlags;if(e|=i,!e)return;const a=e=>{this._renderContext.renderOccludedMask=e,i>W.Occlude&&this._plugins.render(ee.OCCLUDED_TERRAIN),s(ee.OPAQUE_MATERIAL,be),s(ee.TRANSPARENT_MATERIAL,be),s(ee.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,be),this._renderContext.renderOccludedMask=z};this._renderContext.output=w.Color,t(.5,W.OccludeAndTransparent,(()=>a(W.OccludeAndTransparent)),!0,G.OutlineVisualElementMask),t(.5,W.Transparent,(()=>a(W.Transparent)),!0,G.OutlineVisualElementMask),t(1,W.Opaque,(()=>a(W.Opaque)),!0,G.OutlineVisualElementMask),be.clear()}_invokeRenderNodes(e){return this._nodes.render(e,this._pluginInput,this._releaseNormals)}_renderComposite(e,r){this._offscreen.updateColor((e=>(this._pluginInput.set("highlights",r),e=this._nodes.render(e,this._pluginInput,this._releaseNormals),this._pluginInput.set(e.name,e),this._pluginInput.delete("highlights"),e)),"composite-color");const t=this._plugins.produces(ee.ANTIALIASING);return this._plugins.render(t?ee.ANTIALIASING:ee.BLIT,this._pluginInput,e)}_ensureBindParametersCamera(e,r){this._bindParameters.camera=e,this._bindParameters.contentCamera=r}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=g:(c(Pe,this._bindParameters.camera.viewMatrix),c(Re,this._bindParameters.camera.projectionMatrix),m(Se,Pe,Re),m(Se,this._renderContext.lastFrameCamera.viewMatrix,Se),m(Se,this._renderContext.lastFrameCamera.projectionMatrix,Se),this._reprojectionMatrix=Se);const r=this._stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=r>0?Math.min(r,e-this._ssrEnableTime)/r:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=g,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}get test(){return{offscreen:this._offscreen,shadowMap:this._shadowMap,highlight:this._highlight,lighting:this._bindParameters.lighting,renderPlugins:this._plugins,shadowAccumulator:this._shadowAccumulator,weatherIsFading:this._bindParameters.cloudsFade.isFading,resetRenderStateFeatures:()=>{this._renderStateFeatures.value=Z(),this._plugins.renderFeatureChanged(),this._requestRender()},getFramebufferTexture:e=>{switch(e){case Ae.Color:return this._offscreen.colorTexture;case Ae.LinearDepth:return this._bindParameters.linearDepth?.getTexture();case Ae.ShadowMap:return this._shadowMap.depthTexture;case Ae.HudVisibility:return this._bindParameters.hudVisibility?.getTexture()}},debugLinearDepth:e=>{this._debugLinearDepth=e,this._requestRender()}}}}var Te,Ae;e([p({readOnly:!0})],fe.prototype,"fullResolutionAtmosphere",null),e([p()],fe.prototype,"_smaa",void 0),e([p()],fe.prototype,"_blit",void 0),e([p()],fe.prototype,"_edgeView",void 0),e([p()],fe.prototype,"updating",null),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(Te||(Te={})),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.ShadowMap=2]="ShadowMap",e[e.HudVisibility=3]="HudVisibility"}(Ae||(Ae={}));const Ee=[0,0,0,0],be=new n,Re=f(),Pe=f(),Se=f();function Ce(e){return r=>e.immediate.schedule(r)}export{Ae as FramebufferId,fe as Renderer};
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{update as r}from"../../../../core/arrayUtils.js";import{createTask as t}from"../../../../core/asyncUtils.js";import{unitRGBAFromColor as s}from"../../../../core/colorUtils.js";import has from"../../../../core/has.js";import{removeMaybe as i,abortMaybe as a,destroyMaybe as n,releaseMaybe as h}from"../../../../core/maybe.js";import o from"../../../../core/PooledArray.js";import{throwIfAborted as d}from"../../../../core/promiseUtils.js";import{watch as l,syncAndInitial as _,initial as p,sync as u}from"../../../../core/reactiveUtils.js";import{signal as c}from"../../../../core/signal.js";import{property as m}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/accessorSupport/interfaces.js";import"../../../../core/accessorSupport/tracking/Flags.js";import"../../../../core/Warning.js";import"../../../../core/Error.js";import{equals as g,invert as f,multiply as T}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as E,create as A}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as b}from"../../../../chunks/vec42.js";import{fromValues as R,ZEROS as P}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{a as S}from"../../../../chunks/boundedPlane.js";import{debugFlags as C}from"../../support/debugFlags.js";import{TransparencyMode as w}from"../../terrain/TerrainRenderer.js";import{DepthFormat as I,ColorFormat as O}from"../../webgl/formats.js";import{FBOCache as y}from"../core/FBOCache.js";import{RenderPassManager as D}from"../core/renderPasses/RenderPassManager.js";import{ShaderOutput as N}from"../core/shaderLibrary/ShaderOutput.js";import{HUDRenderStyle as L}from"../core/shaderLibrary/hud/HUDRenderStyle.js";import{RenderNodes as H}from"../effects/RenderNodes.js";import{isPrepareRenderPlugin as M}from"../effects/RenderPlugin.js";import{RenderPluginManager as x}from"../effects/RenderPluginManager.js";import{Blit as v}from"../effects/blit/Blit.js";import{Highlight as F}from"../effects/highlight/Highlight.js";import{ShadowHighlight as U}from"../effects/highlight/ShadowHighlight.js";import{SMAA as q}from"../effects/smaa/SMAA.js";import{SSAO as j}from"../effects/ssao/SSAO.js";import{AnimationTimeStep as G}from"./AnimationTimeStep.js";import{Decorations as B,RenderRequestType as V,StencilBits as Q}from"./basicInterfaces.js";import{BoundingInfo as k}from"./BoundingInfo.js";import{zero as W,union as X}from"./depthRange.js";import{depthRangeFromScene as Y}from"./depthRangeUtils.js";import{RenderOccludedFlag as z}from"./Material.js";import{OffscreenRendering as J}from"./OffscreenRendering.js";import{RenderContext as K,defaultRenderOccludedMask as Z}from"./RenderContext.js";import{splitRenderGeometryChangeSetByMaterial as $,RendererTarget as ee}from"./rendererUtils.js";import{setupFeatureDefaults as re,RenderFeature as te}from"./RenderFeature.js";import{RenderSlot as se}from"./RenderSlot.js";import{ShadowAccumulator as ie}from"./ShadowAccumulator.js";import{ShadowMap as ae,SnapshotSlot as ne}from"./ShadowMap.js";import he from"./SliceHelper.js";import{TransparencyPassType as oe}from"./TransparencyPassType.js";import{Transparency as de}from"./edgeRendering/interfaces.js";import{MergedRenderer as le}from"../materials/renderers/MergedRenderer.js";import{AlphaMode as _e}from"../shaders/CompositingTechniqueConfiguration.js";import{RendererPerformanceInfo as pe,PerformanceCategory as ue}from"../statistics/RendererPerformanceInfo.js";import{RenderState as ce}from"../../../support/RenderState.js";import{PixelFormat as me,PixelType as ge,ClearBufferBit as fe,DepthStencilAttachment as Te}from"../../../webgl/enums.js";class Ee{constructor(e,r,t,i,a,n,h,o){this._stage=e,this._techniqueRepository=i,this._rctx=a,this._compositingHelper=n,this._magnifierHelper=h,this._requestRender=o,this._pluginsHas={hudElements:!1,water:!1},this._hasOverlayWater=!1,this.renderOverlay=e=>{},this._isRendering=!1,this._backgroundColor=R(0,0,0,1),this._sliceHelper=new he,this._state=c(ce.IDLE),this._highQualityTransparencyEnabled=!0,this._terrainTransparency=w.Opaque,this._ssrEnabled=!1,this._hasAnimations=!1,this._animationTimestep=new G,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=c(0),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new Map,this._releaseNormals=e=>{e.find((({name:e})=>"normals"===e))?.release()&&this._pluginInput.delete("normals")},this._debugLinearDepth=!1,this.fboCache=new y(a),this._renderStateFeatures=c(re(!has("disable-feature:high-quality-idle"),e.view.qualityProfile)),this._offscreen=new J(this.fboCache,this._compositingHelper),this.performanceInfo=new pe(this._rctx),this._shadowMap=new ae(this.fboCache,e.viewingMode),this._highlight=new F({view:e.view}),this._shadowHighlight=new U({view:e.view,viewingMode:e.viewingMode}),this._shadowAccumulator=new ie(this.fboCache,i,e,(e=>{const r=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=r}),((e,r,t)=>{const s=this._stage.view.qualitySettings.maximumPixelRatio;e.shadowMap.start(e.camera,r,t,!0,s),this._renderShadowCascades(N.Shadow,e.shadowMap),e.shadowMap.finish(),e.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(e.camera,e.contentCamera)}),o),this._ssao=new j({view:this._stage.view}),this._renderContext=new K(this._rctx,this._offscreen,this._shadowMap,this._sliceHelper),this._nodes=new H(this._renderContext),this._plugins=new x({renderContext:this._renderContext,techniqueRepository:i,textureRepository:t,materialRepository:r,requestRender:o,controller:e,fbos:this.fboCache,isFeatureEnabled:e=>this.isFeatureEnabled(e)}),this.renderPassManager=new D,this._plugins.add(this.renderPassManager),this._smaa=new q({view:this._stage.view}),this._plugins.add(this._smaa),this._blit=new v({opacity:1,alphaMode:_e.None}),this._plugins.add(this._blit),this._plugins.add(this._ssao),this._plugins.add(this._highlight),this._plugins.add(this._shadowHighlight),this._handles=[l((()=>this._stage.view.state.camera),(()=>o()),_),l((()=>C.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES),(e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(de.TRANSPARENT):()=>{},o()}),p),l((()=>this._stage.view.environment.background?.color),(e=>{const r=e?s(e):P;b(this._backgroundColor,r[0]*r[3],r[1]*r[3],r[2]*r[3],r[3]),o()}),_)]}destroy(){this._handles.forEach((e=>e.remove())),this._gpuTimerHandle=i(this._gpuTimerHandle),this._nodes.destroy(),this._offscreen.dispose(),this._shadowMap.dispose(),this._highlight.dispose(),this._shadowAccumulator.dispose(),this._loadEdgeViewTask=a(this._loadEdgeViewTask),this._edgeView=n(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this.fboCache.destroy(),this._plugins.destroy(),k.prune()}get _bindParameters(){return this._renderContext.bindParameters}updateRenderFeatures(e=null,r=!has("disable-feature:high-quality-idle")){this._renderStateFeatures.value=re(r,e),this._plugins.renderFeatureChanged(),this._requestRender()}isFeatureEnabled(e,r=this._state.value){return this._renderStateFeatures.value.get(r,e)??!1}setFeatureEnabled(e,r,t){this._renderStateFeatures.mutate((s=>s.set(r,e,t))),this._requestRender()}get _highQualityTransparency(){return this._highQualityTransparencyEnabled||this.isFeatureEnabled(te.HighQualityTransparency)}get hasReflections(){return(this._pluginsHas.water||this._hasOverlayWater)&&(this._ssrEnabled||this.isFeatureEnabled(te.WaterReflection))}get hasDecorations(){return this._plugins.hasDecorations}get hasHighlights(){return this._plugins.produces(se.OPAQUE_MATERIAL,N.Highlight)||this._plugins.produces(se.TRANSPARENT_MATERIAL,N.Highlight)||this._plugins.produces(se.DRAPED_MATERIAL,N.Highlight)}get _magnifierEnabled(){return this._bindParameters.decorations===B.ON&&this._magnifierHelper.enabled}get fullResolutionAtmosphere(){return this._stage.view.qualitySettings.highResolutionAtmosphere||this.isFeatureEnabled(te.HighResolutionAtmosphere)}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=h(this._bindParameters.ssr.lastFrameColor),this._bindParameters.multipassTerrain.linearDepth=h(this._bindParameters.multipassTerrain.linearDepth),this._bindParameters.multipassGeometry.linearDepth=h(this._bindParameters.multipassGeometry.linearDepth)}_disposeOffscreenBuffers(){this._offscreen.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOffscreenBuffers(),this._bindParameters.linearDepth=h(this._bindParameters.linearDepth),this._bindParameters.hudVisibility=h(this._bindParameters.hudVisibility)}get updating(){return this._smaa.updating||null!=this._edgeView&&this._edgeView.updating||this._shadowAccumulator.running||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=t((async e=>{const{EdgeView:r}=await import("./edgeRendering/EdgeView.js");d(e);const t=this._edgeView=new r({rctx:this._rctx,renderSR:this._stage.view.renderSpatialReference,viewingMode:this._stage.viewingMode,techniqueRepository:this._techniqueRepository,setNeedsRender:()=>this._requestRender(),schedule:Ie(this._stage.view.resourceController)});return this._handles.push(l((()=>t.updating),(()=>this._requestRender()),u)),this._requestRender(),this._edgeViewCallbacks.forEach((e=>e(t))),this._edgeViewCallbacks.length=0,t}))),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&g(this._bindParameters.ssr.reprojectionMatrix,E)}set _reprojectionMatrix(e){r(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){const{_shadowMap:r,_bindParameters:t}=this;if(void 0!==e.qualitySettings?.reflections&&this._ssrEnabled!==e.qualitySettings.reflections&&(this._ssrEnabled=e.qualitySettings.reflections,this._requestRender()),void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),void 0!==e.shadowMapMaxCascades&&r.maxCascades!==e.shadowMapMaxCascades&&(r.maxCascades=e.shadowMapMaxCascades,this._requestRender()),null!=e.environment){null!=e.environment.weather&&(this._bindParameters.weather=e.environment.weather,this._bindParameters.weatherVisible=!!e.weatherVisible);const r="virtual"!==e.environment.lighting.type;t.enableFillLights!==r&&(t.enableFillLights=r,this._requestRender())}void 0!==e.highQualityTransparency&&this._highQualityTransparencyEnabled!==e.highQualityTransparency&&(this._highQualityTransparencyEnabled=e.highQualityTransparency,this._requestRender()),void 0!==e.hasOverlayWater&&this._hasOverlayWater!==e.hasOverlayWater&&(this._hasOverlayWater=e.hasOverlayWater,this._requestRender()),void 0!==e.slicePlane&&this._sliceHelper.plane!==e.slicePlane&&(this._sliceHelper.plane=e.slicePlane,this._requestRender()),void 0!==e.terrainTransparency&&this._terrainTransparency!==e.terrainTransparency&&(this._terrainTransparency=e.terrainTransparency,this._requestRender()),void 0!==e.shadowCastOptions&&this._shadowAccumulator.setOptions(e.shadowCastOptions)}get hasSlicePlane(){return!!this._sliceHelper.plane}get plugins(){return this._plugins}get _hasOITSupport(){return this._rctx.driverTest.floatBufferBlend.result}get _oitEnabled(){return this._highQualityTransparency&&this._hasOITSupport}modify(e,r){this._isRendering&&console.warn("Renderer.modify called while rendering");const{adds:t,removes:s,updates:i}=e;if(0===t.length&&0===s.length&&0===i.length)return;const a=$(e);let n=!1;a.forEach(((t,s)=>{if(r.done)return;let i=this._plugins.getMaterialRenderer(s);if(null==i&&t.adds.length>0){const e=new le({material:s});e.initializeRenderContext(this._plugins._context),i=e,this._plugins.add(i)}i&&(i.modify(t),0===i.numGeometries&&(n=!0)),t.removes.forEach((r=>e.removes.removeUnordered(r))),t.adds.forEach((r=>e.adds.removeUnordered(r))),t.updates.forEach((r=>e.updates.removeUnordered(r))),r.madeProgress()})),n&&this._plugins.removeEmptyMaterialRenderers(),this._updateHasFlags(),this._requestRender()}_updateHasFlags(){const has=this._pluginsHas;has.hudElements=this._plugins.produces(se.LINE_CALLOUTS_HUD_DEPTH)||this._plugins.produces(se.HUD_MATERIAL)||this._plugins.produces(se.LABEL_MATERIAL),has.water=this._plugins.produces(se.DRAPED_WATER,N.Normal),this._bindParameters.hasOccludees=this._plugins.hasOccludees}updateAnimation(e){const r=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(e),this._hasAnimations=this._nodes.updateAnimation()||this._hasAnimations,this._hasAnimations!==r&&(this._gpuTimerHandle=r?i(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,r,t=ee.Default,s=B.ON){this._isRendering=!0,this.performanceInfo.startFrame(),this.fboCache.frameStart(),this._disposeBindBuffers();const i=this._offscreen,{camera:a,contentCamera:n,mode:o,alignPixelEnabled:d}=e;this._state.value=o,this._bindParameters.overlay=this.renderOverlay(r),this.performanceInfo.advance(ue.OVERLAY),this._renderContext.time=r,this._bindParameters.transparencyPassType=oe.NONE,this._bindParameters.alignPixelEnabled=d,this._bindParameters.decorations=s,this._bindParameters.mainColor=this._bindParameters.mainDepth=null;const l=S(this._sliceHelper.plane);s===B.OFF&&(this._sliceHelper.plane=null),a.setGLViewport(this._rctx);const _=i.initializeFrame(a,this._backgroundColor,t);this.hasReflections?this._bindParameters.ssr.lastFrameColor=_:_?.release(),this._ensureBindParametersCamera(a,n),this._plugins.prepareRender(),this.performanceInfo.advance(ue.PREPARE);const p=this._computeDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,p),this.performanceInfo.advance(ue.SHADOW_MAP),this._ensureBindParametersCamera(a,n);const u=this._plugins.produces(se.OPAQUE_TERRAIN)&&(this._terrainTransparency===w.Semitransparent||this._terrainTransparency===w.TransparentWithDraped),c=this._highQualityTransparency&&u,m=this._plugins.produces(se.TRANSPARENT_MATERIAL,N.Color);this._prepareShaders(c,m),this._pluginInput.set("normals",this._renderNormals()),this.performanceInfo.advance(ue.NORMALS),this._renderSSAO(),this.performanceInfo.advance(ue.SSAO),this._renderLinearDepth(),this.performanceInfo.advance(ue.LINEAR_DEPTH),this._renderShadowAccumulation(p,a,n),this.performanceInfo.advance(ue.ACCUMULATED_SHADOWS),this._ensureBindParametersSSR(r),this._renderContext.output=N.Color,i.bindFbo(),this._bindParameters.mainColor=i.colorTexture,this._bindParameters.mainDepth=i.depthTexture,this._renderOpaqueGeometry(),this._offscreen.updateColor((e=>this._invokeRenderNodes(e)),"opaque-color"),this._plugins.render(se.ENVIRONMENT_OPAQUE),this.performanceInfo.advance(ue.OPAQUE),this.fboCache.debugCallback&&this.fboCache.debugCallback("opaque-color",this._offscreen.color.fbo),this._renderTerrainLinearDepth(c),this._setMultipassTerrain(c),this._renderEdges(de.OPAQUE),this.performanceInfo.advance(ue.OPAQUE_EDGES),i.bindFbo(),this._plugins.render(se.VOXEL),this.performanceInfo.advance(ue.VOXEL),this._renderHiddenTransparentEdges(),m&&(this._oitEnabled?this._renderOITPass(Ae.Geometry):this._renderTransparentMaterial()),this._offscreen.updateColor((e=>this._invokeRenderNodes(e)),"transparent-color"),this.performanceInfo.advance(ue.TRANSPARENT);const g=this._renderGeometryLinearDepth(c);this._renderHUDVisibility(g),c||this._plugins.render(se.LINE_CALLOUTS),this.performanceInfo.advance(ue.HUD_VISIBILITY);const f=t===ee.ObjectAndLayerID?this._renderObjectAndLayerIdColor():null;this.performanceInfo.advance(ue.OBJECT_AND_LAYER_ID_COLOR),this._renderEdges(de.TRANSPARENT,g),g?.release(),this.performanceInfo.advance(ue.TRANSPARENT_EDGES);const T=u?this._renderTransparentTerrain():null;T&&this._bindParameters.hudVisibility&&(c?this._renderLineCallouts(L.Occluded):i.compositeToHUDVisibility(this._bindParameters,T.getTexture()),this._renderHUD(L.Occluded,i.color),this.performanceInfo.advance(ue.HUD_OCCLUDED)),this.performanceInfo.advance(ue.TRANSPARENT_TERRAIN),this._setTerrainCulling(!1),T&&(i.compositeToFramebuffer(this._bindParameters,T.getTexture(),_e.PremultipliedAlpha,1),T.release(),c&&(this._renderEdges(de.OPAQUE),this.performanceInfo.advance(ue.OPAQUE_EDGES),m&&(this._oitEnabled?this._renderOITPass(Ae.Geometry):this._renderTransparentMaterial()),this.performanceInfo.advance(ue.TRANSPARENT),this._renderEdges(de.TRANSPARENT),this.performanceInfo.advance(ue.TRANSPARENT_EDGES))),this._bindParameters.ssao=h(this._bindParameters.ssao),c&&this._renderLineCallouts(L.NotOccluded),this._setMultipassEnabled(!1),this._shadowAccumulator.render(this._bindParameters),i.bindFbo(),this._plugins.render(se.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._plugins.render(se.ENVIRONMENT_TRANSPARENT),this.performanceInfo.advance(ue.ENVIRONMENT),this._renderLaserlines(),this.performanceInfo.advance(ue.LASER_LINES),this._renderOccluded(),this.performanceInfo.advance(ue.OCCLUDED);let E=this._renderHighlightPrepass();E&&this._renderShadowHighlights(E,this._bindParameters);const A=this._magnifierEnabled&&t===ee.Default?this.fboCache.acquire(this._offscreen.width,this._offscreen.height,"magnifier"):null,b=t!==ee.Default?this.fboCache.acquire(this._offscreen.width,this._offscreen.height,"screenshot"):null,R=this._renderComposite(A??b,E)??b;return this.performanceInfo.advance(ue.ANTIALIASING),this._renderHUD(L.NotOccluded,R),this.performanceInfo.advance(ue.HUD),E&&(this._renderHighlights(R,E,this._bindParameters),E=h(E)),this.performanceInfo.advance(ue.HIGHLIGHTS),this._magnifierEnabled&&this._magnifierHelper.render(this._rctx,this._bindParameters),R!==b&&(this._rctx.bindFramebuffer(b?.fbo),this._compositingHelper.composite(this._bindParameters,A?.getTexture(),_e.None)),t===ee.Default&&A?.release(),this.onPostRender&&this.onPostRender(),this._releaseFBOs(),this._offscreen.releaseBuffers(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this._sliceHelper.plane=l,this._isRendering=!1,this.fboCache.frameEnd(),this.performanceInfo.finishFrame(),t!==ee.Default&&(this._releaseFBOs(),this._disposeOffscreenBuffers()),{screen:b,oid:f}}_prepareShaders(e,r){this._renderContext.output=N.Color,this._prepareOpaqueGeometry(),this._setMultipassTerrain(e),this._plugins.prepare(se.TRANSPARENT_TERRAIN),this._setMultipassTerrain(!1),e||this._plugins.prepare(se.LINE_CALLOUTS),r&&this._prepareTransparencySlots(),this._plugins.prepare(se.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),this._plugins.prepare(se.ENVIRONMENT_TRANSPARENT),this._plugins.prepare(se.LASERLINES),this._rctx.gl.flush()}_renderObjectAndLayerIdColor(){if(!has("enable-feature:objectAndLayerId-rendering"))return;const e=this._renderContext.output,r=this.fboCache.acquire(this._offscreen.width,this._offscreen.height,"oid");return r.acquireDepth(I.DEPTH_STENCIL_TEXTURE),this._rctx.bindFramebuffer(r.fbo),this.fboCache.rctx.clearFramebuffer([0,0,0,0],!0,!0),this._renderAllGeometry(N.ObjectAndLayerIdColor),this._rctx.bindFramebuffer(r.fbo),this.fboCache.rctx.clearFramebuffer(void 0,!0,!0),this._bindParameters.hudRenderStyle=L.NotOccluded,this._plugins.render(se.HUD_MATERIAL),this._renderContext.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const r=this.performanceInfo.gpuSamplingEnabled,t=e===V.BACKGROUND;if(t||r){const e=t?this.performanceInfo.elapsedTime:0,s=r?this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.getError(),i=Math.max(e,s);this._animationTimestep.frame(i,t)}}readDepthPixels(e,r,t){const s=this._bindParameters.linearDepth?.fbo;if(s?.colorTexture)return void s.readPixels(r[0],r[1],r[2],r[3],me.RGBA,ge.UNSIGNED_BYTE,t);const i=this.fboCache.acquire(this._offscreen.width,this._offscreen.height,"depth").acquireDepth(I.DEPTH16_BUFFER);this._rctx.bindFramebuffer(i.fbo),this._ensureBindParametersCamera(e,e),this._bindParameters.camera.setGLViewport(this._rctx),this._rctx.setClearColor(0,0,0,0);const a=fe.COLOR_BUFFER_BIT|fe.DEPTH_BUFFER_BIT|fe.STENCIL_BUFFER_BIT;this._rctx.clear(a),this._renderAllGeometry(N.LinearDepth),i.fbo.readPixels(r[0],r[1],r[2],r[3],me.RGBA,ge.UNSIGNED_BYTE,t),i.release()}readHUDVisibility(e,r,t,s,i){this._bindParameters.hudVisibility?.fbo.readPixels(e,r,t,s,me.RGBA,ge.UNSIGNED_BYTE,i)}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}_setMultipassTerrain(e){this._setMultipassEnabled(e),this._setTerrainCulling(e)}_setMultipassEnabled(e){this._bindParameters.multipassEnabled=e}_setTerrainCulling(e){this._bindParameters.multipassTerrain.cullAboveGround=e}_renderEdges(e,r){const t=this._edgeView;if(t?.shouldRender()){const{width:s,height:i,depth:a}=this._offscreen,n=this.fboCache.acquire(s,i,"edges"),h=()=>t.render(this._bindParameters,e);this._offscreen.renderToTargets(h,n,r??a,Re),this._offscreen.compositeToFramebuffer(this._bindParameters,n.getTexture(),_e.Alpha,1),n.release()}}_renderShadowMap(e,r,t){const s=this._shadowMap;s.enabled&&(s.start(e,r,t,this.isFeatureEnabled(te.HighResolutionShadows),this._stage.view.qualitySettings.maximumPixelRatio),this._shadowHighlight.updateParameters(e,r),this._needsShadowHighlight?(this._renderShadowCascades(N.ShadowHighlight,this._shadowMap),s.moveSnapshot(ne.Highlight),this._renderShadowCascades(N.ShadowExcludeHighlight,this._shadowMap),s.copySnapshot(ne.ExcludeHighlight),this._renderShadowCascades(N.ShadowHighlight,this._shadowMap)):this._renderShadowCascades(N.Shadow),s.finish(),e.setGLViewport(this._rctx))}_renderShadowCascades(e,r=this._shadowMap){for(const t of r.cascades)t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.camera),this._renderAllGeometry(e)}get _needsLinearDepth(){return this._plugins.consumes(N.LinearDepth)||this.hasReflections||this._needsShadowHighlight||this._needsShadowCast||this._debugLinearDepth}_renderLinearDepth(){this._needsLinearDepth?(this._bindParameters.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.linearDepth,"linear-depth",(()=>this._renderAllGeometry(N.LinearDepth)),[0,0,0,0],O.RGBA,I.DEPTH_STENCIL_TEXTURE),this._bindParameters.linearDepth.detachDepth()):this._bindParameters.linearDepth=h(this._bindParameters.linearDepth)}_renderTerrainLinearDepth(e){if(e){const e=this._renderContext.output;this._renderContext.output=N.LinearDepth,this._bindParameters.multipassTerrain.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.multipassTerrain.linearDepth,"terrain depth",(()=>this._renderTransparentTerrain()),[-1e10,-1e10,-1e10,1]),this._bindParameters.multipassTerrain.linearDepth.detachDepth(),this._renderContext.output=e}else this._bindParameters.multipassTerrain.linearDepth=h(this._bindParameters.multipassTerrain.linearDepth)}_renderGeometryLinearDepth(e){if(!e)return void(this._bindParameters.multipassGeometry.linearDepth=h(this._bindParameters.multipassGeometry.linearDepth));const r=this._renderContext.output;this._bindParameters.multipassGeometry.linearDepth=this._offscreen.renderToCachedFBO(this._bindParameters.multipassGeometry.linearDepth,"geometry depth",(()=>this._renderOpaqueGeometryAndTransparentMaterial(N.LinearDepth)),[1,1,1,1]),this._renderContext.output=r;const t=this._bindParameters.multipassGeometry.linearDepth.getAttachment(Te);return t?.retain(),this._bindParameters.multipassGeometry.linearDepth.detachDepth(),t}get _needsDepthRange(){return this._shadowMap.enabled||this._needsShadowCast}_computeDepthRange(e){if(!this._needsDepthRange)return W;const r=Y(e,this._plugins.plugins,this._stage.layers);return X(r,this._plugins.queryDepthRange(e)),r.near=Math.max(e.near,r.near),r.far=Math.min(e.far,r.far),r}_renderNormals(){const e=this._plugins.produces(se.SSAO),r=this._nodes.require("normals","composite-color")+this._nodes.require("normals","opaque-color")+this._nodes.require("normals","transparent-color");let t=(e?1:0)+r+(e||r>0?this._nodes.optional("normals","composite-color")+this._nodes.optional("normals","opaque-color")+this._nodes.optional("normals","transparent-color"):0);if(0===t)return;const s=this._offscreen.renderToCachedFBO(null,"normals",(()=>this._renderGeometryForSSAO(N.Normal)),[0,0,0,0],O.RGBA,I.DEPTH_STENCIL_TEXTURE);for(;--t>0;)s.retain();return s}_renderSSAO(){const e=this._pluginInput.get("normals");this._plugins.produces(se.SSAO)&&e&&(this._bindParameters.ssao=this._plugins.render(se.SSAO,this._pluginInput),e.detachDepth(),e.release()&&this._pluginInput.delete("normals"))}_renderAllGeometry(e){this._renderContext.output=e,this._plugins.prepare(se.TRANSPARENT_TERRAIN),this._renderOpaqueGeometryAndTransparentMaterial(e),this._renderTransparentTerrain()}_renderOpaqueGeometryAndTransparentMaterial(e){this._renderContext.output=e,this._plugins.prepare(se.TRANSPARENT_MATERIAL),this._plugins.prepare(se.TRANSPARENT_NO_SSAO_DEPTH),this._renderOpaqueGeometry(),this._renderTransparentMaterial()}_renderGeometryForSSAO(e){this._renderContext.output=e,this._plugins.render(se.INTEGRATED_MESH),this._plugins.render(se.OPAQUE_TERRAIN),this._plugins.render(se.OPAQUE_MATERIAL),this._plugins.render(se.TRANSPARENT_MATERIAL),this._renderTransparentTerrain()}_prepareOpaqueGeometry(){this._plugins.prepare(se.INTEGRATED_MESH),this._plugins.prepare(se.OPAQUE_TERRAIN),this._plugins.prepare(se.OPAQUE_MATERIAL),this._plugins.prepare(se.OPAQUE_NO_SSAO_DEPTH),this._plugins.prepare(se.ENVIRONMENT_OPAQUE)}_renderOpaqueGeometry(){this._plugins.render(se.INTEGRATED_MESH),this._plugins.render(se.OPAQUE_TERRAIN),this._plugins.render(se.OPAQUE_MATERIAL),this._plugins.render(se.OPAQUE_NO_SSAO_DEPTH)}_renderTransparentMaterial(){this._plugins.render(se.TRANSPARENT_MATERIAL),this._plugins.render(se.TRANSPARENT_NO_SSAO_DEPTH)}_renderTransparentTerrain(){if(!this._plugins.produces(se.TRANSPARENT_TERRAIN))return;const e=()=>this._plugins.render(se.TRANSPARENT_TERRAIN,null);if(this._renderContext.output!==N.Color)return void e();const{width:r,height:t,depth:s}=this._offscreen,i=this.fboCache.acquire(r,t,"transparent terrain");return this._offscreen.renderToTargets(e,i,s,[0,0,0,0]),i}_renderHUDVisibility(e){this._plugins.produces(se.OCCLUSION_PIXELS)?(this._bindParameters.hudVisibility=this._offscreen.renderHUDVisibility(this._bindParameters.hudVisibility,(()=>this._plugins.render(se.OCCLUSION_PIXELS)),e),this._offscreen.bindFbo()):this._bindParameters.hudVisibility=h(this._bindParameters.hudVisibility)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,e===L.Occluded){const e=()=>{this._plugins.render(se.LINE_CALLOUTS)},{width:r,height:t,color:s}=this._offscreen,i=this.fboCache.acquireDepth(I.DEPTH16_BUFFER,r,t,"line callouts");this._offscreen.renderToTargets(e,s,i,void 0,!0,!0),i.release()}else this._plugins.render(se.LINE_CALLOUTS)}_renderLaserlines(){if(this._plugins.render(se.LASERLINES),this._plugins.produces(se.LASERLINES_CONTRAST_CONTROL)){const e=this._offscreen,{width:r,height:t,depth:s}=e,i=this.fboCache.acquire(r,t,"laser lines"),a=()=>this._plugins.render(se.LASERLINES_CONTRAST_CONTROL);e.renderToTargets(a,i,s,Re),e.compositeToFramebuffer(this._bindParameters,i.getTexture(),_e.PremultipliedAlpha,1),i.release()}}_renderHUD(e,r){if(this._pluginsHas.hudElements)if(this._oitEnabled){const t=this._renderOITPass(Ae.HUD,e);this._rctx.bindFramebuffer(r?.fbo),this._compositingHelper.composite(this._bindParameters,t.getTexture(),_e.PremultipliedAlpha),t.release()}else if(e===L.Occluded){this._renderContext.output=N.Color;const r=()=>this._renderHUDElements(e),{width:t,height:s,color:i}=this._offscreen,a=this.fboCache.acquireDepth(I.DEPTH16_BUFFER,t,s,"hud");this._offscreen.renderToTargets(r,i,a,void 0,!0,!0),a.release()}else this._renderContext.output=N.Color,this._rctx.bindFramebuffer(null),r?.acquireDepth(I.DEPTH16_BUFFER),this._rctx.bindFramebuffer(r?.fbo),this._renderHUDElements(e),r?.detachDepth()}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.prepare(se.LINE_CALLOUTS_HUD_DEPTH),this._plugins.prepare(se.HUD_MATERIAL),this._plugins.prepare(se.LABEL_MATERIAL),this._plugins.render(se.LINE_CALLOUTS_HUD_DEPTH),this._plugins.render(se.HUD_MATERIAL),this._plugins.render(se.LABEL_MATERIAL)}get _needsShadowHighlight(){return this._shadowMap.enabled&&this._plugins.produces(se.SHADOW_HIGHLIGHT)&&this._plugins.produces(se.OPAQUE_MATERIAL,N.ShadowHighlight)}_renderHighlightPrepass(){if(!this.hasHighlights)return;const e=()=>{this._renderAllGeometry(N.Highlight),this._rctx.clear(fe.DEPTH_BUFFER_BIT),this._renderHUDElements(L.Both)},r=this._offscreen.renderToCachedFBO(null,"highlights",e,[0,0,0,0],O.RGBA4,I.DEPTH_STENCIL_TEXTURE);return r.detachDepth(),r}_renderShadowHighlights(e,r){this.hasHighlights&&r.decorations!==B.OFF&&this._needsShadowHighlight&&this._offscreen.updateColor((r=>(this._pluginInput.set("highlights",e),this._plugins.render(se.SHADOW_HIGHLIGHT,this._pluginInput,r),r)),"transparent-color")}_renderHighlights(e,r,t){this.hasHighlights&&t.decorations!==B.OFF&&this._plugins.produces(se.HIGHLIGHT)&&(this._pluginInput.set("highlights",r),this._plugins.render(se.HIGHLIGHT,this._pluginInput,e))}get _needsShadowCast(){return this._shadowAccumulator.isAccumulating}_renderShadowAccumulation(e,r,t){this._needsShadowCast&&this._bindParameters.linearDepth?.getTexture()&&this._shadowAccumulator.renderAccumulation(this._bindParameters.linearDepth,e,r,t)}_prepareTransparencySlots(){this._renderContext.output=N.Alpha,this._bindParameters.transparencyPassType=oe.Alpha,this._plugins.prepare(se.TRANSPARENT_MATERIAL),this._renderContext.output=N.Color,this._bindParameters.transparencyPassType=oe.Color,this._plugins.prepare(se.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=oe.FrontFace,this._plugins.prepare(se.TRANSPARENT_MATERIAL),this._bindParameters.transparencyPassType=oe.NONE}_renderOITPass(e,r=L.Both){const t=e===Ae.HUD,s=t?this.fboCache.acquire(this._offscreen.width,this._offscreen.height,"oit hud composite"):null,i=t?()=>this._renderHUDElements(r):()=>this._renderTransparentMaterial(),a=this._renderContext.output;this._renderContext.output=N.Alpha,this._bindParameters.transparencyPassType=oe.Alpha;const n=this._offscreen.renderOITPass(i,oe.Alpha,t);this._renderContext.output=N.Color,this._bindParameters.transparencyPassType=oe.Color;const h=this._offscreen.renderOITPass(i,oe.Color,t);this._bindParameters.transparencyPassType=oe.FrontFace;const o=this._offscreen.renderOITPass(i,oe.FrontFace,t);return this._offscreen.compositeTransparentOntoOpaque(this._bindParameters,h,n,o,s),s?.detachDepth(),o.release(),h.release(),n.release(),this._bindParameters.transparencyPassType=oe.NONE,this._renderContext.output=a,s}_renderOccluded(){let e=0;Pe.clear(),this._plugins.plugins.forAll((r=>{if(!r.materialReference)return;r.queryRenderOccludedState(z.OccludeAndTransparentStencil)&&(e|=z.OccludeAndTransparentStencil,Pe.push(r))}));const r=this._offscreen,t=(t,s,i,a,n)=>{if(!(e&s))return;const{width:h,height:o,depth:d}=r,l=this.fboCache.acquire(h,o,"tmp color");r.renderToTargets(i,l,d,[0,0,0,0],a,n),r.compositeToFramebuffer(this._bindParameters,l.getTexture(),_e.PremultipliedAlpha,t),l.release()},s=(e,r)=>{this._bindParameters.slot=e,r.forAll((e=>{if(M(e)){const r=e.prepareTechnique(this._renderContext);r&&e.renderNode(this._renderContext,r)}}))};0!==Pe.length&&(s(se.OCCLUDER_MATERIAL,Pe),t(.5,z.OccludeAndTransparentStencil,(()=>s(se.TRANSPARENT_OCCLUDER_MATERIAL,Pe)),!1,!1)),Pe.clear(),this._plugins.plugins.forAll((r=>{if(!r.materialReference)return;const t=r.queryRenderOccludedState(z.OccludeAndTransparent),s=r.queryRenderOccludedState(z.Transparent),i=r.queryRenderOccludedState(z.Opaque);(t||s||i)&&(e|=t?z.OccludeAndTransparent:s?z.Transparent:z.Opaque,Pe.push(r))}));const i=this._plugins.renderOccludedFlags;if(e|=i,!e)return;const a=e=>{this._renderContext.renderOccludedMask=e,i>z.Occlude&&this._plugins.render(se.OCCLUDED_TERRAIN),s(se.OPAQUE_MATERIAL,Pe),s(se.TRANSPARENT_MATERIAL,Pe),s(se.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,Pe),this._renderContext.renderOccludedMask=Z};this._renderContext.output=N.Color,t(.5,z.OccludeAndTransparent,(()=>a(z.OccludeAndTransparent)),!0,Q.OutlineVisualElementMask),t(.5,z.Transparent,(()=>a(z.Transparent)),!0,Q.OutlineVisualElementMask),t(1,z.Opaque,(()=>a(z.Opaque)),!0,Q.OutlineVisualElementMask),Pe.clear()}_invokeRenderNodes(e){return this._nodes.render(e,this._pluginInput,this._releaseNormals)}_renderComposite(e,r){this._offscreen.updateColor((e=>(this._pluginInput.set("highlights",r),e=this._nodes.render(e,this._pluginInput,this._releaseNormals),this._pluginInput.set(e.name,e),this._pluginInput.delete("highlights"),e)),"composite-color");const t=this._plugins.produces(se.ANTIALIASING);return this._plugins.render(t?se.ANTIALIASING:se.BLIT,this._pluginInput,e)}_ensureBindParametersCamera(e,r){this._bindParameters.camera=e,this._bindParameters.contentCamera=r}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=E:(f(Ce,this._bindParameters.camera.viewMatrix),f(Se,this._bindParameters.camera.projectionMatrix),T(we,Ce,Se),T(we,this._renderContext.lastFrameCamera.viewMatrix,we),T(we,this._renderContext.lastFrameCamera.projectionMatrix,we),this._reprojectionMatrix=we);const r=this._stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=r>0?Math.min(r,e-this._ssrEnableTime)/r:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=E,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}get test(){return{offscreen:this._offscreen,shadowMap:this._shadowMap,highlight:this._highlight,lighting:this._bindParameters.lighting,renderPlugins:this._plugins,shadowAccumulator:this._shadowAccumulator,weatherIsFading:this._bindParameters.cloudsFade.isFading,resetRenderStateFeatures:()=>{this._renderStateFeatures.value=re(),this._plugins.renderFeatureChanged(),this._requestRender()},getFramebufferTexture:e=>{switch(e){case be.Color:return this._offscreen.colorTexture;case be.LinearDepth:return this._bindParameters.linearDepth?.getTexture();case be.ShadowMap:return this._shadowMap.depthTexture;case be.HudVisibility:return this._bindParameters.hudVisibility?.getTexture()}},debugLinearDepth:e=>{this._debugLinearDepth=e,this._requestRender()}}}}var Ae,be;e([m({readOnly:!0})],Ee.prototype,"fullResolutionAtmosphere",null),e([m()],Ee.prototype,"_smaa",void 0),e([m()],Ee.prototype,"_blit",void 0),e([m()],Ee.prototype,"_edgeView",void 0),e([m()],Ee.prototype,"updating",null),function(e){e[e.Geometry=0]="Geometry",e[e.HUD=1]="HUD"}(Ae||(Ae={})),function(e){e[e.Color=0]="Color",e[e.LinearDepth=1]="LinearDepth",e[e.ShadowMap=2]="ShadowMap",e[e.HudVisibility=3]="HudVisibility"}(be||(be={}));const Re=[0,0,0,0],Pe=new o,Se=A(),Ce=A(),we=A();function Ie(e){return r=>e.immediate.schedule(r)}export{be as FramebufferId,Ee as Renderer};
|
package/views/MapView.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Viewpoint.js";import i from"../core/Collection.js";import r from"../core/CollectionFlattener.js";import s from"../core/Error.js";import has from"../core/has.js";import a from"../core/Logger.js";import{destroyMaybe as n}from"../core/maybe.js";import{watch as o,sync as p,syncAndInitial as l}from"../core/reactiveUtils.js";import{initialize as h}from"../core/workers/workers.js";import{property as g}from"../core/accessorSupport/decorators/property.js";import{cast as d}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import{isLoadedOrLoadFor as m}from"../geometry/projection.js";import y from"../layers/support/TileInfo.js";import{BreakpointsOwner as w}from"./BreakpointsOwner.js";import{DOMContainer as f}from"./DOMContainer.js";import{PopupView as M}from"./PopupView.js";import V from"./View.js";import v from"./2d/AnimationManager.js";import b from"./2d/FrameTask.js";import{GoToManager as _}from"./2d/GoToManager.js";import{layerView2DImporter as S}from"./2d/layerViewModuleImportUtils.js";import j from"./2d/MapViewConstraints.js";import T from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{extentToScale as L}from"./2d/viewpointUtils.js";import{ViewStateManager as O}from"./2d/ViewStateManager.js";import k from"./2d/input/MapViewInputManager.js";import R from"./2d/layers/features/support/TileStore.js";import C from"./2d/support/HighlightOptions.js";import{hitTest as x}from"./2d/support/hitTestUtils.js";import{takeRawScreenshot as D,takeScreenshot as E}from"./2d/support/screenshotUtils.js";import{StationaryManager as P}from"./2d/support/StationaryManager.js";import{Timeline as z}from"./2d/support/Timeline.js";import{isSupportedScreenPointEvent as G,createScreenPointFromSupportedEvent as q}from"./support/screenUtils.js";import{check as I}from"./support/WebGLRequirements.js";import U from"./ui/DefaultUI.js";import A from"./ui/2d/DefaultUI2D.js";import{isWebMap as F}from"../webmap/utils.js";import N from"../webmap/background/ColorBackground.js";let W,$,H,B,Z,J;async function K(){const[,{GraphicsView2D:e,GraphicContainer:t,LabelManager:i,MapViewNavigation:r,MagnifierView2D:s,Stage:a}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);$=e,H=t,B=i,Z=r,J=s,W=a}let Q=class extends(w(M(f(V)))){constructor(e){super(e),this._magnifierView=null,this.stage=null,this._resolveWhenReady=[],this.rootLayerViews=new r({getCollections:()=>[this.basemapView?.baseLayerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.fullOpacity=1,this.goToManager=new _({view:this}),this.graphicsView=null,this.stateManager=new O({constraints:new j({view:this})}),this.stationaryManager=new P,this.labelManager=null,this.mapViewNavigation=null,this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.supersampleScreenshotsEnabled=!0,this.supportsGround=!1,this.frameTask=new b(this),this.floors=new i,this.highlightOptions=new C,this.inputManager=new k({view:this}),this.map=null,this.spatialReferenceLocked=!1,this.timeline=new z,this.type="2d",this.ui=new A,this.test={takeScreenshot:async e=>D(this._getScreenshotView(e),e)},this.padding={top:0,right:0,bottom:0,left:0},this.addHandles([o((()=>this.viewpoint),(()=>this.stationaryManager.flip()),p),this.on("resize",(e=>this.stateManager.resize(e.width,e.height)))]),h()}destroy(){this._set("preconditionsReady",!1),this.frameTask=n(this.frameTask),this.goToManager.destroy(),this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new R(this.featuresTilingScheme)}get constraintsInfo(){const e=this.defaultsFromMap?.tileInfo,t=this.spatialReference;return{lods:e?.spatialReference?.equals(t)?e.lods:null,spatialReference:t}}get state(){return this.stateManager.state}get initialExtentRequired(){if(!this.stateManager)return!1;const{scale:e,constraints:t,center:i,viewpoint:r,extent:s}=this;let a=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.viewpoint)&&(!s&&(t?.effectiveLODs||(a=-1),(!i||0===e&&-1===a)&&(null==r?.targetGeometry||"extent"!==r.targetGeometry.type&&!r.scale)))}get _defaultsFromMapSettings(){return{required:{tileInfo:!0,heightModelInfo:!1,extent:!1},requiresExtentInSpatialReference:this.spatialReferenceLocked}}get typeSpecificPreconditionsReady(){const e=this._getDefaultViewpoint();if(!e)return!1;const t=e.targetGeometry,i=this.spatialReference;return m(t.spatialReference,i)}set animation(e){const t=this._get("animation");if(e===t)return;if(t&&t.stop(),e!==this.animationManager.animation&&this.animationManager.stop(),!e||e.isFulfilled())return this._set("animation",null),void(this.frameTask.animationInProgress=!1);this._set("animation",e),this.frameTask.animationInProgress=!0;const i=()=>{this.destroyed||(e===this._get("animation")&&(this._set("animation",null),this.frameTask?.requestFrame()),this.frameTask.animationInProgress=!1)};e.when(i,i)}get background(){return F(this.map)?this.map.initialViewProperties.background:null}set background(e){this._override("background",e)}get center(){return this.stateManager?.center??null}set center(e){this.stateManager.center=e}get constraints(){return this.stateManager?.constraints}set constraints(e){e.view=this;const t=this.stateManager.constraints;this.stateManager.constraints=e,t?.destroy()}get extent(){return this.stateManager?.extent??null}set extent(e){this.stateManager.extent=e}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get rendering(){return this.stage?.renderRequested??!1}get resizeAlign(){return this.stateManager.resizeAlign}set resizeAlign(e){this.stateManager.resizeAlign=e}get resolution(){return this.stateManager.resolution??0}get rotation(){return this.stateManager.rotation??0}set rotation(e){const{rotationEnabled:t}=this.constraints;this.constraints.rotationEnabled=!0,this.stateManager.rotation=e,this.constraints.rotationEnabled=t}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get stationary(){return!this.animation&&!this.navigating&&!this.resizing&&this.stationaryManager.stationary}get updating(){const e=!this.destroyed&&(!this.layerViewManager||!this.labelManager||!this.graphicsView||!0===this.layerViewManager.updating||!0===this.labelManager.updating||!0===this.graphicsView.updating||this.allLayerViews.some((e=>!e.destroyed&&!("layerViews"in e)&&!0===e.updating)));if(has("esri-2d-log-updating")){const t=this.allLayerViews.reduce(((e,t)=>({...e,[`${t.layer.id}(${t.layer.type})`]:!t.destroyed&&!("layerViews"in t)&&t.updating})),{});console.log(`Updating MapView: ${e}\n-> Null LayerViewManager: ${!this.layerViewManager}\n-> Null LabelManager: ${!this.labelManager}\n-> Null GraphicsView: ${!this.graphicsView}\n-> layerViewManager.updating: ${this.layerViewManager?.updating}\n-> labelManager.updating: ${this.labelManager?.updating}\n-> graphicsView.updating: ${this.graphicsView?.updating}\n-> allLayerViews: ${JSON.stringify(t)}\n`)}return e}get viewpoint(){return this.stateManager.viewpoint??null}set viewpoint(e){this.stateManager.viewpoint=e,this.frameTask.requestFrame()}get zoom(){return this.stateManager.zoom??-1}set zoom(e){this.stateManager.zoom=e}get navigating(){return this.mapViewNavigation?.interacting??!1}goTo(e,t){return this.goToManager.goTo(e,t)}async hitTest(e,t){return x(this,e,t)}async takeScreenshot(e){return E(this._getScreenshotView(e),e)}toMap(e){if(!this.ready)return null;const t=G(e)?q(this,e):e;return this.stateManager.toMap(t)}toScreen(e,t){return this.stateManager.toScreen(e,t)}on(e,t,i,r){const s=this.inputManager&&this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map?.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||null}getDefaultTimeZone(){return F(this.map)?this.map.initialViewProperties.timeZone:null}hasLayerViewModule(e){return S.hasLayerViewModule(e)}importLayerView(e){return S.importLayerView(e)}pixelSizeAt(){return this.ready?this.resolution:(a.getLogger(this).error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}async popupHitTest(e){const t=this.toMap(e),i=await this.hitTest(e),r=this.allLayerViews.toArray().reverse(),s=new globalThis.Map(r.map((e=>[e.layer.uid,e]))),a=[];let n=0,o=0;for(;n<i.results.length||o<r.length;){const e=i.results.at(n);if(e&&"graphic"!==e.type){++n;continue}const p=s.get((e?.layer??e?.graphic.layer)?.uid);if((!e||p)&&o<r.length&&r.at(o)!==p){const e=r.at(o);"fetchPopupFeaturesAtLocation"in e&&a.push({mapPoint:t,layerView:e}),++o}else e&&(a.push({graphic:e.graphic,layerView:p}),++n)}return{hits:a,location:t}}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}async validate(){let e=I(this.type);if(has("safari")&&has("safari")<9&&(e=new s("mapview:browser-not-supported","This browser is not supported by MapView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:has("safari")})),null!=e)throw a.getLogger(this).warn("#validate()",e.message),e}loadAsyncDependencies(){return K()}_getDefaultViewpoint(){const{constraints:e,initialExtent:i,map:r,padding:s,size:a}=this;if(!e)return null;const n=r&&"initialViewProperties"in r?r.initialViewProperties:void 0,o=this.stateManager.getUserStartupOptions(this.size),p=n?.viewpoint,l=p?.targetGeometry?.extent??i,h=l?.center,g=p?.rotation??0,d=p?.scale||l&&L(l,[a[0]-s.left-s.right,a[1]-s.top-s.bottom]),u=o.center??h,c=o.rotation??g,m=o.scale??d;return u&&m?new t({targetGeometry:u,scale:m,rotation:c}):null}_startup(){this.timeline.begin("MapView Startup");const e=this._getDefaultViewpoint();this.stateManager.startup(e,this.size,this.spatialReference,this.defaultsFromMap.extent?.center),this.graphics.owner=this;const t=new W(this.surface,{canvas:this.renderCanvas,contextOptions:{disabledExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions},renderingOptions:this.renderingOptions,timeline:this.timeline});this.stage=t,this._magnifierView=new J,this._magnifierView.magnifier=this.magnifier;const i=new B({view:this});this._set("labelManager",i);const r=new v({view:this});this._set("animationManager",r);const s=new Z({view:this,animationManager:r});this._set("mapViewNavigation",s),this._setupSpatialReferenceDependentProperties(),this.addHandles([this.rootLayerViews.on("change",(()=>this._updateStageChildren())),t.on("webgl-error",(e=>this.fatalError=e.error)),o((()=>this.stationary),(e=>t.stationary=e),l),o((()=>this.background),(e=>{t.backgroundColor=e?.color,this._magnifierView.backgroundColor=e?.color}),l),o((()=>this.magnifier),(e=>this._magnifierView.magnifier=e),l),o((()=>this.renderingOptions),(e=>t.renderingOptions=e),l),o((()=>this.highlightOptions),(e=>t.highlightOptions=e),l),o((()=>this.state.id),(()=>t.state=this.state),l)],"map-view"),this._updateStageChildren();const a=this._resolveWhenReady;this._resolveWhenReady=[],a.forEach((e=>e(this))),this.timeline.end("MapView Startup"),this.frameTask.start(),this._set("ready",!0)}_teardown(){this._destroySpatialReferenceDependentProperties(),this.removeHandles("map-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animation=null,this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this.labelManager.destroy(),this._magnifierView.destroy(),this.stage.destroy(),this.stage=null,this._set("graphicsView",null),this._magnifierView=null,this._set("labelManager",null),this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask.stop(),this.stationaryManager.clear(),this._set("ready",!1),this.stateManager.teardown()}_updateStageChildren(){this.stage.removeAllChildren(),this.rootLayerViews.forEach((e=>{this.stage.addChild(e.container)}));const e=this.graphicsView;this.stage.addChild(e.container),this.stage.addChild(this._magnifierView)}_setupSpatialReferenceDependentProperties(){const e=new T(y.create({spatialReference:this.spatialReference,size:512,numLODs:36}));this._set("featuresTilingScheme",e);const t=new $({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new H(e)});this._set("graphicsView",t)}_destroySpatialReferenceDependentProperties(){const e=this.graphicsView;this._set("graphicsView",null),e.destroy(),this._set("featuresTilingScheme",null)}_getScreenshotView(e){const{allLayerViews:t,padding:i,size:r,stage:s}=this;return{allLayerViews:t,backgroundColor:e?.ignoreBackground?null:this.background?.color,padding:i,size:r,stage:s}}_spatialReferenceChanged(e){if(this.ready){this.frameTask.stop();for(const e of this.allLayerViews)e.processDetach();this._destroySpatialReferenceDependentProperties(),this.stateManager.changeSpatialReference(e),this.stage.state=this.state,this._setupSpatialReferenceDependentProperties();for(const e of this.allLayerViews)e.processAttach();this.frameTask.requestFrame(),this.frameTask.start(),this._updateStageChildren()}}};Q.type="2d",e([g({readOnly:!0})],Q.prototype,"animationManager",void 0),e([g({constructOnly:!0})],Q.prototype,"deactivatedWebGLExtensions",void 0),e([g({constructOnly:!0})],Q.prototype,"debugWebGLExtensions",void 0),e([g({readOnly:!0})],Q.prototype,"featuresTilingScheme",void 0),e([g({readOnly:!0})],Q.prototype,"fullOpacity",void 0),e([g()],Q.prototype,"goToManager",void 0),e([g({readOnly:!0})],Q.prototype,"graphicsTileStore",null),e([g()],Q.prototype,"graphicsView",void 0),e([g()],Q.prototype,"stateManager",void 0),e([g()],Q.prototype,"constraintsInfo",null),e([g({readOnly:!0})],Q.prototype,"state",null),e([g()],Q.prototype,"initialExtentRequired",null),e([g()],Q.prototype,"labelManager",void 0),e([g({readOnly:!0})],Q.prototype,"mapViewNavigation",void 0),e([g({constructOnly:!0})],Q.prototype,"renderCanvas",void 0),e([g()],Q.prototype,"renderingOptions",void 0),e([g({constructOnly:!0})],Q.prototype,"supersampleScreenshotsEnabled",void 0),e([g({readOnly:!0})],Q.prototype,"supportsGround",void 0),e([g()],Q.prototype,"_defaultsFromMapSettings",null),e([g({readOnly:!0})],Q.prototype,"typeSpecificPreconditionsReady",null),e([g()],Q.prototype,"animation",null),e([g({type:N})],Q.prototype,"background",null),e([g()],Q.prototype,"center",null),e([g({type:j})],Q.prototype,"constraints",null),e([g()],Q.prototype,"extent",null),e([g()],Q.prototype,"floors",void 0),e([g({type:C})],Q.prototype,"highlightOptions",void 0),e([g({readOnly:!0})],Q.prototype,"inputManager",void 0),e([g()],Q.prototype,"map",void 0),e([g()],Q.prototype,"padding",null),e([g({readOnly:!0})],Q.prototype,"rendering",null),e([g()],Q.prototype,"resizeAlign",null),e([g({readOnly:!0})],Q.prototype,"resolution",null),e([g()],Q.prototype,"rotation",null),e([g()],Q.prototype,"scale",null),e([g({constructOnly:!0})],Q.prototype,"spatialReferenceLocked",void 0),e([g()],Q.prototype,"stationary",null),e([g({type:z,readOnly:!0})],Q.prototype,"timeline",void 0),e([g({readOnly:!0})],Q.prototype,"type",void 0),e([g({readOnly:!0})],Q.prototype,"updating",null),e([g()],Q.prototype,"viewpoint",null),e([g()],Q.prototype,"zoom",null),e([g({readOnly:!0})],Q.prototype,"navigating",null),e([g(),d((e=>e instanceof U?e:c(A,e)))],Q.prototype,"ui",void 0),Q=e([u("esri.views.MapView")],Q);const X=Q;export{X as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Viewpoint.js";import i from"../core/Collection.js";import r from"../core/CollectionFlattener.js";import s from"../core/Error.js";import has from"../core/has.js";import a from"../core/Logger.js";import{destroyMaybe as n}from"../core/maybe.js";import{watch as o,sync as p,syncAndInitial as l}from"../core/reactiveUtils.js";import{initialize as h}from"../core/workers/workers.js";import{property as g}from"../core/accessorSupport/decorators/property.js";import{cast as d}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as u}from"../core/accessorSupport/decorators/subclass.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import{isLoadedOrLoadFor as m}from"../geometry/projection.js";import y from"../layers/support/TileInfo.js";import{BreakpointsOwner as f}from"./BreakpointsOwner.js";import{DOMContainer as w}from"./DOMContainer.js";import{PopupView as M}from"./PopupView.js";import V from"./View.js";import v from"./2d/AnimationManager.js";import b from"./2d/FrameTask.js";import{GoToManager as _}from"./2d/GoToManager.js";import{layerView2DImporter as S}from"./2d/layerViewModuleImportUtils.js";import j from"./2d/MapViewConstraints.js";import T from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{extentToScale as L}from"./2d/viewpointUtils.js";import{ViewStateManager as O}from"./2d/ViewStateManager.js";import k from"./2d/input/MapViewInputManager.js";import R from"./2d/layers/features/support/TileStore.js";import C from"./2d/support/HighlightOptions.js";import{hitTest as x}from"./2d/support/hitTestUtils.js";import{takeRawScreenshot as D,takeScreenshot as E}from"./2d/support/screenshotUtils.js";import{StationaryManager as P}from"./2d/support/StationaryManager.js";import{Timeline as z}from"./2d/support/Timeline.js";import{isSupportedScreenPointEvent as G,createScreenPointFromSupportedEvent as q}from"./support/screenUtils.js";import{check as I}from"./support/WebGLRequirements.js";import U from"./ui/DefaultUI.js";import A from"./ui/2d/DefaultUI2D.js";import{isWebMap as F}from"../webmap/utils.js";import N from"../webmap/background/ColorBackground.js";let $,W,H,B,Z,J;async function K(){const[,{GraphicsView2D:e,GraphicContainer:t,LabelManager:i,MapViewNavigation:r,MagnifierView2D:s,Stage:a}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);W=e,H=t,B=i,Z=r,J=s,$=a}let Q=class extends(f(M(w(V)))){constructor(e){super(e),this._magnifierView=null,this.stage=null,this._resolveWhenReady=[],this.rootLayerViews=new r({getCollections:()=>[this.basemapView?.baseLayerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.fullOpacity=1,this.goToManager=new _({view:this}),this.graphicsView=null,this.stateManager=new O({constraints:new j({view:this})}),this.stationaryManager=new P,this.labelManager=null,this.mapViewNavigation=null,this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.supersampleScreenshotsEnabled=!0,this.supportsGround=!1,this.frameTask=new b(this),this.floors=new i,this.highlightOptions=new C,this.inputManager=new k({view:this}),this.map=null,this.spatialReferenceLocked=!1,this.timeline=new z,this.type="2d",this.ui=new A,this.test={takeScreenshot:async e=>D(this._getScreenshotView(e),e)},this.padding={top:0,right:0,bottom:0,left:0},this.addHandles([o((()=>this.viewpoint),(()=>this.stationaryManager.flip()),p),this.on("resize",(e=>this.stateManager.resize(e.width,e.height)))]),h()}destroy(){this._set("preconditionsReady",!1),this.frameTask=n(this.frameTask),this.goToManager.destroy(),this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new R(this.featuresTilingScheme)}get constraintsInfo(){const e=this.defaultsFromMap?.tileInfo,t=this.spatialReference;return{lods:e?.spatialReference?.equals(t)?e.lods:null,spatialReference:t}}get state(){return this.stateManager.state}get initialExtentRequired(){if(!this.stateManager)return!1;const{scale:e,constraints:t,center:i,viewpoint:r,extent:s}=this;let a=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.viewpoint)&&(!s&&(t?.effectiveLODs||(a=-1),(!i||0===e&&-1===a)&&(null==r?.targetGeometry||"extent"!==r.targetGeometry.type&&!r.scale)))}get _defaultsFromMapSettings(){return{required:{tileInfo:!0,heightModelInfo:!1,extent:!1},requiresExtentInSpatialReference:this.spatialReferenceLocked}}get typeSpecificPreconditionsReady(){const e=this._getDefaultViewpoint();if(!e)return!1;const t=e.targetGeometry,i=this.spatialReference;return m(t.spatialReference,i)}set animation(e){const t=this._get("animation");if(e===t)return;if(t&&t.stop(),e!==this.animationManager.animation&&this.animationManager.stop(),!e||e.isFulfilled())return this._set("animation",null),void(this.frameTask.animationInProgress=!1);this._set("animation",e),this.frameTask.animationInProgress=!0;const i=()=>{this.destroyed||(e===this._get("animation")&&(this._set("animation",null),this.frameTask?.requestFrame()),this.frameTask.animationInProgress=!1)};e.when(i,i)}get background(){return F(this.map)?this.map.initialViewProperties.background:null}set background(e){this._override("background",e)}get center(){return this.stateManager?.center??null}set center(e){this.stateManager.center=e}get constraints(){return this.stateManager?.constraints}set constraints(e){e.view=this;const t=this.stateManager.constraints;this.stateManager.constraints=e,t?.destroy()}get extent(){return this.stateManager?.extent??null}set extent(e){this.stateManager.extent=e}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get rendering(){return this.stage?.renderRequested??!1}get resizeAlign(){return this.stateManager.resizeAlign}set resizeAlign(e){this.stateManager.resizeAlign=e}get resolution(){return this.stateManager.resolution??0}get rotation(){return this.stateManager.rotation??0}set rotation(e){const{rotationEnabled:t}=this.constraints;this.constraints.rotationEnabled=!0,this.stateManager.rotation=e,this.constraints.rotationEnabled=t}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get stationary(){return!this.animation&&!this.navigating&&!this.resizing&&this.stationaryManager.stationary}get updating(){const e=!(!this.magnifier.visible||null===this.magnifier.position||!this._magnifierView?.updatingHandles.updating),t=!this.destroyed&&(!this.layerViewManager||!this.labelManager||!this.graphicsView||!0===this.layerViewManager.updating||!0===this.labelManager.updating||!0===this.graphicsView.updating||this.allLayerViews.some((e=>!e.destroyed&&!("layerViews"in e)&&!0===e.updating))||e);if(has("esri-2d-log-updating")){const i=this.allLayerViews.reduce(((e,t)=>({...e,[`${t.layer.id}(${t.layer.type})`]:!t.destroyed&&!("layerViews"in t)&&t.updating})),{});console.log(`Updating MapView: ${t}\n-> Null LayerViewManager: ${!this.layerViewManager}\n-> Null LabelManager: ${!this.labelManager}\n-> Null GraphicsView: ${!this.graphicsView}\n-> layerViewManager.updating: ${this.layerViewManager?.updating}\n-> labelManager.updating: ${this.labelManager?.updating}\n-> graphicsView.updating: ${this.graphicsView?.updating}\n-> allLayerViews: ${JSON.stringify(i)}\n-> updatingMagnifier: ${e}\n`)}return t}get viewpoint(){return this.stateManager.viewpoint??null}set viewpoint(e){this.stateManager.viewpoint=e,this.frameTask.requestFrame()}get zoom(){return this.stateManager.zoom??-1}set zoom(e){this.stateManager.zoom=e}get navigating(){return this.mapViewNavigation?.interacting??!1}goTo(e,t){return this.goToManager.goTo(e,t)}async hitTest(e,t){return x(this,e,t)}async takeScreenshot(e){return E(this._getScreenshotView(e),e)}toMap(e){if(!this.ready)return null;const t=G(e)?q(this,e):e;return this.stateManager.toMap(t)}toScreen(e,t){return this.stateManager.toScreen(e,t)}on(e,t,i,r){const s=this.inputManager&&this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map?.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||null}getDefaultTimeZone(){return F(this.map)?this.map.initialViewProperties.timeZone:null}hasLayerViewModule(e){return S.hasLayerViewModule(e)}importLayerView(e){return S.importLayerView(e)}pixelSizeAt(){return this.ready?this.resolution:(a.getLogger(this).error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}async popupHitTest(e){const t=this.toMap(e),i=await this.hitTest(e),r=this.allLayerViews.toArray().reverse(),s=new globalThis.Map(r.map((e=>[e.layer.uid,e]))),a=[];let n=0,o=0;for(;n<i.results.length||o<r.length;){const e=i.results.at(n);if(e&&"graphic"!==e.type){++n;continue}const p=s.get((e?.layer??e?.graphic.layer)?.uid);if((!e||p)&&o<r.length&&r.at(o)!==p){const e=r.at(o);"fetchPopupFeaturesAtLocation"in e&&a.push({mapPoint:t,layerView:e}),++o}else e&&(a.push({graphic:e.graphic,layerView:p}),++n)}return{hits:a,location:t}}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}async validate(){let e=I(this.type);if(has("safari")&&has("safari")<9&&(e=new s("mapview:browser-not-supported","This browser is not supported by MapView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:has("safari")})),null!=e)throw a.getLogger(this).warn("#validate()",e.message),e}loadAsyncDependencies(){return K()}_getDefaultViewpoint(){const{constraints:e,initialExtent:i,map:r,padding:s,size:a}=this;if(!e)return null;const n=r&&"initialViewProperties"in r?r.initialViewProperties:void 0,o=this.stateManager.getUserStartupOptions(this.size),p=n?.viewpoint,l=p?.targetGeometry?.extent??i,h=l?.center,g=p?.rotation??0,d=p?.scale||l&&L(l,[a[0]-s.left-s.right,a[1]-s.top-s.bottom]),u=o.center??h,c=o.rotation??g,m=o.scale??d;return u&&m?new t({targetGeometry:u,scale:m,rotation:c}):null}_startup(){this.timeline.begin("MapView Startup");const e=this._getDefaultViewpoint();this.stateManager.startup(e,this.size,this.spatialReference,this.defaultsFromMap.extent?.center),this.graphics.owner=this;const t=new $(this.surface,{canvas:this.renderCanvas,contextOptions:{disabledExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions},renderingOptions:this.renderingOptions,timeline:this.timeline});this.stage=t,this._magnifierView=new J,this._magnifierView.magnifier=this.magnifier;const i=new B({view:this});this._set("labelManager",i);const r=new v({view:this});this._set("animationManager",r);const s=new Z({view:this,animationManager:r});this._set("mapViewNavigation",s),this._setupSpatialReferenceDependentProperties(),this.addHandles([this.rootLayerViews.on("change",(()=>this._updateStageChildren())),t.on("webgl-error",(e=>this.fatalError=e.error)),o((()=>this.stationary),(e=>t.stationary=e),l),o((()=>this.background),(e=>{t.backgroundColor=e?.color,this._magnifierView.backgroundColor=e?.color}),l),o((()=>this.magnifier),(e=>this._magnifierView.magnifier=e),l),o((()=>this.renderingOptions),(e=>t.renderingOptions=e),l),o((()=>this.highlightOptions),(e=>t.highlightOptions=e),l),o((()=>this.state.id),(()=>t.state=this.state),l)],"map-view"),this._updateStageChildren();const a=this._resolveWhenReady;this._resolveWhenReady=[],a.forEach((e=>e(this))),this.timeline.end("MapView Startup"),this.frameTask.start(),this._set("ready",!0)}_teardown(){this._destroySpatialReferenceDependentProperties(),this.removeHandles("map-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animation=null,this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this.labelManager.destroy(),this._magnifierView.destroy(),this.stage.destroy(),this.stage=null,this._set("graphicsView",null),this._magnifierView=null,this._set("labelManager",null),this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask.stop(),this.stationaryManager.clear(),this._set("ready",!1),this.stateManager.teardown()}_updateStageChildren(){this.stage.removeAllChildren(),this.rootLayerViews.forEach((e=>{this.stage.addChild(e.container)}));const e=this.graphicsView;this.stage.addChild(e.container),this.stage.addChild(this._magnifierView)}_setupSpatialReferenceDependentProperties(){const e=new T(y.create({spatialReference:this.spatialReference,size:512,numLODs:36}));this._set("featuresTilingScheme",e);const t=new W({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new H(e)});this._set("graphicsView",t)}_destroySpatialReferenceDependentProperties(){const e=this.graphicsView;this._set("graphicsView",null),e.destroy(),this._set("featuresTilingScheme",null)}_getScreenshotView(e){const{allLayerViews:t,padding:i,size:r,stage:s}=this;return{allLayerViews:t,backgroundColor:e?.ignoreBackground?null:this.background?.color,padding:i,size:r,stage:s}}_spatialReferenceChanged(e){if(this.ready){this.frameTask.stop();for(const e of this.allLayerViews)e.processDetach();this._destroySpatialReferenceDependentProperties(),this.stateManager.changeSpatialReference(e),this.stage.state=this.state,this._setupSpatialReferenceDependentProperties();for(const e of this.allLayerViews)e.processAttach();this.frameTask.requestFrame(),this.frameTask.start(),this._updateStageChildren()}}};Q.type="2d",e([g({readOnly:!0})],Q.prototype,"animationManager",void 0),e([g({constructOnly:!0})],Q.prototype,"deactivatedWebGLExtensions",void 0),e([g({constructOnly:!0})],Q.prototype,"debugWebGLExtensions",void 0),e([g({readOnly:!0})],Q.prototype,"featuresTilingScheme",void 0),e([g({readOnly:!0})],Q.prototype,"fullOpacity",void 0),e([g()],Q.prototype,"goToManager",void 0),e([g({readOnly:!0})],Q.prototype,"graphicsTileStore",null),e([g()],Q.prototype,"graphicsView",void 0),e([g()],Q.prototype,"stateManager",void 0),e([g()],Q.prototype,"constraintsInfo",null),e([g({readOnly:!0})],Q.prototype,"state",null),e([g()],Q.prototype,"initialExtentRequired",null),e([g()],Q.prototype,"labelManager",void 0),e([g({readOnly:!0})],Q.prototype,"mapViewNavigation",void 0),e([g({constructOnly:!0})],Q.prototype,"renderCanvas",void 0),e([g()],Q.prototype,"renderingOptions",void 0),e([g({constructOnly:!0})],Q.prototype,"supersampleScreenshotsEnabled",void 0),e([g({readOnly:!0})],Q.prototype,"supportsGround",void 0),e([g()],Q.prototype,"_defaultsFromMapSettings",null),e([g({readOnly:!0})],Q.prototype,"typeSpecificPreconditionsReady",null),e([g()],Q.prototype,"animation",null),e([g({type:N})],Q.prototype,"background",null),e([g()],Q.prototype,"center",null),e([g({type:j})],Q.prototype,"constraints",null),e([g()],Q.prototype,"extent",null),e([g()],Q.prototype,"floors",void 0),e([g({type:C})],Q.prototype,"highlightOptions",void 0),e([g({readOnly:!0})],Q.prototype,"inputManager",void 0),e([g()],Q.prototype,"map",void 0),e([g()],Q.prototype,"padding",null),e([g({readOnly:!0})],Q.prototype,"rendering",null),e([g()],Q.prototype,"resizeAlign",null),e([g({readOnly:!0})],Q.prototype,"resolution",null),e([g()],Q.prototype,"rotation",null),e([g()],Q.prototype,"scale",null),e([g({constructOnly:!0})],Q.prototype,"spatialReferenceLocked",void 0),e([g()],Q.prototype,"stationary",null),e([g({type:z,readOnly:!0})],Q.prototype,"timeline",void 0),e([g({readOnly:!0})],Q.prototype,"type",void 0),e([g({readOnly:!0})],Q.prototype,"updating",null),e([g()],Q.prototype,"viewpoint",null),e([g()],Q.prototype,"zoom",null),e([g({readOnly:!0})],Q.prototype,"navigating",null),e([g(),d((e=>e instanceof U?e:c(A,e)))],Q.prototype,"ui",void 0),Q=e([u("esri.views.MapView")],Q);const X=Q;export{X as default};
|
package/views/draw/DrawAction.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Evented.js";import{clone as i}from"../../core/lang.js";import{destroyMaybe as r}from"../../core/maybe.js";import{ignoreAbortErrors as n}from"../../core/promiseUtils.js";import{createScreenPointArray as s}from"../../core/screenUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../layers/GraphicsLayer.js";import{makeDehydratedPoint as d}from"../../layers/graphics/dehydratedPoint.js";import{ViewingMode as
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Evented.js";import{clone as i}from"../../core/lang.js";import{destroyMaybe as r}from"../../core/maybe.js";import{ignoreAbortErrors as n}from"../../core/promiseUtils.js";import{createScreenPointArray as s}from"../../core/screenUtils.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{subclass as a}from"../../core/accessorSupport/decorators/subclass.js";import p from"../../layers/GraphicsLayer.js";import{makeDehydratedPoint as d}from"../../layers/graphics/dehydratedPoint.js";import{ViewingMode as l}from"../ViewingMode.js";import{SnappingVisualizer2D as h}from"../2d/interactive/SnappingVisualizer2D.js";import{createCoordinateHelper as c}from"../interactive/coordinateHelper.js";import{EditGeometry as m,Component as _}from"../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as u}from"../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as y}from"../interactive/snapping/SnappingContext.js";import{SnappingOperation as g}from"../interactive/snapping/SnappingOperation.js";var v;let f=v=class extends t.EventedAccessor{constructor(e){super(e),this._hasZ=null,this._cursorScreenPoint=null,this._activePointerId=null,this._stagedVertexUnsnapped=null,this._lastVertexUnsnapped=null,this.interactiveUndoDisabled=!1,this.history=[],this.redoHistory=[],this.snapToScene=!1,this.view=null,this.elevationInfo=null,this.defaultZ=0,this._coordinateHelper=c(!!e.hasZ,!1,e.view.spatialReference),this._snappingManager=e.snappingManager,this._editGeometryOperations=new u(new m(e.editGeometryType??"polygon",this._coordinateHelper),l.Local),this._snappingGraphicsLayer=new p({id:v.SNAPPING_GRAPHICS_LAYER_ID,listMode:"hide",internal:!0}),this._snappingContext=new y({editGeometryOperations:this._editGeometryOperations,elevationInfo:{mode:"on-the-ground",offset:0},pointer:"mouse",visualizer:new h(this._snappingGraphicsLayer)}),this._activeComponent=new _(e.view.spatialReference,l.Local),this._editGeometryOperations.data.components.push(this._activeComponent)}normalizeCtorArgs(e){const t={...e};return delete t.editGeometryType,delete t.snappingManager,t}initialize(){this._snappingOperation=new g({view:this.view}),"2d"===this.view.type&&this.view.map.layers.add(this._snappingGraphicsLayer)}destroy(){this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy(),null!=this._snappingManager&&this._snappingManager.doneSnapping(),this._snappingOperation=r(this._snappingOperation),this._editGeometryOperations.destroy()}get _committedVertices(){return this._editGeometryOperations.data.components[0].vertices.map((e=>e.pos))}get vertices(){return null!=this._stagedVertex?[...this._committedVertices,this._coordinateHelper.pointToArray(this._stagedVertex)]:this._committedVertices}get hasZ(){return null!=this._hasZ?this._hasZ:"3d"===this.view.type}set hasZ(e){this._hasZ=e,this.notifyChange("hasZ")}get _stagedVertex(){return this._snappingOperation.stagedPoint}set _stagedVertex(e){this._snappingOperation.stagedPoint=i(e)}canUndo(){return this._editGeometryOperations.canUndo}canRedo(){return this._editGeometryOperations.canRedo}undo(){this.canUndo&&this._editGeometryOperations.undo()}redo(){this.canRedo&&this._editGeometryOperations.redo()}getCoordsFromScreenPoint(e){const t=e&&this.screenToMap(e);return null==t?null:t.hasZ?[t.x,t.y,t.z]:[t.x,t.y]}getCoordsAndPointFromScreenPoint(e){const t=this.screenToMap(e);return null==t?null:t.hasZ?{vertex:[t.x,t.y,t.z],mapPoint:t}:{vertex:[t.x,t.y],mapPoint:t}}screenToMap(e){let t=null;if("3d"===this.view.type)if(this.hasZ){const i=this.elevationInfo??x;t=this.view.sceneIntersectionHelper.intersectElevationFromScreen(s(e.x,e.y),i,this._getGeometryZValue())}else{const i=this.elevationInfo??G;t=this.view.sceneIntersectionHelper.intersectElevationFromScreen(s(e.x,e.y),i,0),null!=t&&(t.z=void 0)}else t=this.view.toMap(e),null!=t&&(t.z=this.hasZ?this._getGeometryZValue():void 0);return t}_pushCursorVertex(e,t){const i=d(e[0],e[1],void 0,this.view.spatialReference);this._stagedVertexUnsnapped=i;const r=this._snappingManager;if(null==r)return this._stagedVertex=i,void t();n(this._snappingOperation.snap({point:i},r,this._snappingContext)).then((()=>{t()}))}_popCursorVertex(){this._stagedVertexUnsnapped=null,this._stagedVertex=null}_getGeometryZValue(){return this.defaultZ}_abortSnapping(){this._snappingOperation.abort()}_isDuplicateOfLastVertex(e){const t=this._editGeometryOperations.data.components[0].getLastVertex()?.pos;if(t&&e[0]===t[0]&&e[1]===t[1])return!0;const{x:i,y:r}=this._coordinateHelper.vectorToDehydratedPoint(e);return null!=this._lastVertexUnsnapped&&i===this._lastVertexUnsnapped.x&&r===this._lastVertexUnsnapped.y}_shouldHandlePointerEvent(e){return w(e)&&(null==this._activePointerId||this._activePointerId===e.pointerId)}_vertexAddHandler(e){const t=null!=this._stagedVertex?this._coordinateHelper.pointToArray(this._stagedVertex):this.getCoordsFromScreenPoint(this._cursorScreenPoint);null!=t&&this._addVertex(t,e.native)}_drawCompleteHandler(e){this._completeDrawing(e.native)}};f.SNAPPING_GRAPHICS_LAYER_ID="DrawAction-snapping-graphics-layer",e([o({readOnly:!0})],f.prototype,"vertices",null),e([o({type:Boolean,nonNullable:!0})],f.prototype,"interactiveUndoDisabled",void 0),e([o({readOnly:!0})],f.prototype,"history",void 0),e([o({readOnly:!0})],f.prototype,"redoHistory",void 0),e([o()],f.prototype,"snapToScene",void 0),e([o()],f.prototype,"view",void 0),e([o()],f.prototype,"elevationInfo",void 0),e([o({nonNullable:!0})],f.prototype,"defaultZ",void 0),e([o()],f.prototype,"hasZ",null),e([o()],f.prototype,"_snappingOperation",void 0),e([o()],f.prototype,"_stagedVertex",null),f=v=e([a("esri.views.draw.DrawAction")],f);const x={mode:"absolute-height",offset:0},G={mode:"on-the-ground",offset:0};function w(e){return"mouse"!==e.pointerType||0===e.button}const V=f;export{V as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import e from"../../../Graphic.js";import i from"../../../core/Evented.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{zeroMeters as o}from"../../../core/quantityUtils.js";import{when as r,watch as a,syncAndInitial as h,initial as c}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{create as p}from"../../../geometry/support/aaBoundingRect.js";import{getRingsOrPathsBounds as _}from"../../../geometry/support/boundsUtils.js";import{geometryToCoordinates as d}from"../../../geometry/support/coordsUtils.js";import m from"../../../geometry/support/rotate.js";import u from"../../../symbols/SimpleFillSymbol.js";import g from"../../../symbols/SimpleLineSymbol.js";import v from"../../../symbols/SimpleMarkerSymbol.js";import{cloneMove as y,scale as f,getRotationAngle as G,getScaleRatio as b}from"./drawUtils.js";import w from"./GraphicMover.js";import x from"./HighlightHelper.js";import{addUniqueLayer as S}from"./layerUtils.js";import{settings as k}from"./settings.js";import R from"../../interactive/sketch/SketchOptions.js";import{ExtentRotateTooltipInfo as M,ExtentScaleTooltipInfo as H}from"../../interactive/tooltip/ExtentTooltipInfos.js";import{Tooltip as I}from"../../interactive/tooltip/Tooltip.js";import{TranslateTooltipInfo as C}from"../../interactive/tooltip/TranslateTooltipInfos.js";import{autoDistanceBetweenPoints2D as O}from"../../support/automaticLengthMeasurementUtils.js";import{autoSize2D as j}from"../../support/extentUtils.js";import T from"../../../geometry/Point.js";import E from"../../../geometry/Polygon.js";import L from"../../../geometry/Polyline.js";class z{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move-start"}}class P{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move"}}class B{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move-stop"}}class Y{constructor(t,e,i){this.graphics=t,this.mover=e,this.angle=i,this.type="rotate-start"}}class N{constructor(t,e,i){this.graphics=t,this.mover=e,this.angle=i,this.type="rotate"}}class U{constructor(t,e,i){this.graphics=t,this.mover=e,this.angle=i,this.type="rotate-stop"}}class A{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.xScale=i,this.yScale=s,this.type="scale-start"}}class X{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.xScale=i,this.yScale=s,this.type="scale"}}class F{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.xScale=i,this.yScale=s,this.type="scale-stop"}}const D=k.transformGraphics,V={centerIndicator:new v({style:"cross",size:D.center.size,color:D.center.color}),fill:{default:new u({color:D.fill.color,outline:{color:D.fill.outlineColor,join:"round",width:1}}),active:new u({color:D.fill.stagedColor,outline:{color:D.fill.outlineColor,join:"round",style:"dash",width:1}})},handles:{default:new v({style:"square",size:D.vertex.size,color:D.vertex.color,outline:{color:D.vertex.outlineColor,width:1}}),hover:new v({style:"square",size:D.vertex.hoverSize,color:D.vertex.hoverColor,outline:{color:D.vertex.hoverOutlineColor,width:1}})},rotator:{default:new v({style:"circle",size:D.vertex.size,color:D.vertex.color,outline:{color:D.vertex.outlineColor,width:1}}),hover:new v({style:"circle",size:D.vertex.hoverSize,color:D.vertex.hoverColor,outline:{color:D.vertex.hoverOutlineColor,width:1}})},rotatorLine:new g({color:D.line.color,width:1})};let q=class extends i.EventedAccessor{constructor(t){super(t),this._activeHandleGraphic=null,this._graphicAttributes={esriSketchTool:"box"},this._mover=null,this._centerGraphic=null,this._backgroundGraphic=null,this._vertexGraphics=[],this._rotateHandleGraphic=null,this._rotateGraphicOffset=20,this._angleOfRotation=0,this._rotateLineGraphic=null,this._startInfo=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this.tooltip=null,this.type="box",this.callbacks={onMoveStart(){},onMove(){},onMoveStop(){},onScaleStart(){},onScale(){},onScaleStop(){},onRotateStart(){},onRotate(){},onRotateStop(){},onGraphicClick(){}},this.enableMovement=!0,this.enableRotation=!0,this.enableScaling=!0,this.graphics=[],this.highlightsEnabled=!0,this.layer=null,this.preserveAspectRatio=!1,this.showCenterGraphic=!0,this.symbols=V,this.sketchOptions=new R,this.view=null,this._getBounds=(()=>{const t=p();return(e,i)=>{e[0]=Number.POSITIVE_INFINITY,e[1]=Number.POSITIVE_INFINITY,e[2]=Number.NEGATIVE_INFINITY,e[3]=Number.NEGATIVE_INFINITY;for(const s of i){if(!s)continue;let i,o,r,a;if("point"===s.type)i=r=s.x,o=a=s.y;else if("multipoint"===s.type){const e=d(s);[i,o,r,a]=_(t,[e])}else if("extent"===s.type)[i,o,r,a]=[s.xmin,s.ymin,s.xmax,s.ymax];else{const e=d(s);[i,o,r,a]=_(t,e)}e[0]=Math.min(i,e[0]),e[1]=Math.min(o,e[1]),e[2]=Math.max(r,e[2]),e[3]=Math.max(a,e[3])}return e}})()}initialize(){const t=this.view;this._highlightHelper=new x({view:t}),this.tooltip=new I({view:t}),this._setup(),this.addHandles([r((()=>t?.ready),(()=>{const{layer:t,view:e}=this;S(e,t)}),{once:!0,initial:!0}),a((()=>this.preserveAspectRatio),(()=>{this._activeHandleGraphic&&(this._scaleGraphic(this._activeHandleGraphic),this._updateGraphics(),this._updateTooltip(this._activeHandleGraphic))})),a((()=>t?.scale),(()=>{this._updateRotateGraphic(),this._updateRotateLineGraphic()})),a((()=>this.graphics),(()=>this.refresh())),a((()=>this.layer),((t,e)=>{e&&this._resetGraphics(e),this.refresh()})),a((()=>this.highlightsEnabled),(()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()})),a((()=>this.sketchOptions.tooltips.effectiveEnabled),(t=>{this.tooltip=t?new I({view:this.view}):s(this.tooltip)}),h),a((()=>this.view.effectiveTheme.accentColor),(()=>this._updateSymbolsForTheme()),c),this.on("move-start",(t=>this.callbacks?.onMoveStart?.(t))),this.on("move",(t=>this.callbacks?.onMove?.(t))),this.on("move-stop",(t=>this.callbacks?.onMoveStop?.(t))),this.on("rotate-start",(t=>this.callbacks?.onRotateStart?.(t))),this.on("rotate",(t=>this.callbacks?.onRotate?.(t))),this.on("rotate-stop",(t=>this.callbacks?.onRotateStop?.(t))),this.on("scale-start",(t=>this.callbacks?.onScaleStart?.(t))),this.on("scale",(t=>this.callbacks?.onScale?.(t))),this.on("scale-stop",(t=>this.callbacks?.onScaleStop?.(t)))])}destroy(){this._reset(),this.tooltip=s(this.tooltip)}get state(){const t=this.view?.ready??!1,e=this.graphics.length&&this.layer;return t&&e?"active":t?"ready":"disabled"}isUIGraphic(t){return this._vertexGraphics.includes(t)||t===this._backgroundGraphic||t===this._centerGraphic||t===this._rotateHandleGraphic||t===this._rotateLineGraphic}move(t,e){if(this._mover&&this.graphics.length){for(const i of this.graphics){const s=i.geometry,o=y(s,t,e,this.view);i.geometry=o}this.refresh(),this.emit("move-stop",new B(this.graphics,null,t,e))}}scale(t,e){if(this._mover&&this.graphics.length){for(const i of this.graphics){const s=i.geometry,o=f(s,t,e);i.geometry=o}this.refresh(),this.emit("scale-stop",new F(this.graphics,null,t,e))}}rotate(t,e){if(this._mover&&this.graphics.length){if(!e){const t=this._vertexGraphics[1].geometry.x,i=this._vertexGraphics[3].geometry.y;e=new T(t,i,this.view.spatialReference)}for(const i of this.graphics){const s=i.geometry,o=m(s,t,e);i.geometry=o}this.refresh(),this.emit("rotate-stop",new U(this.graphics,null,t))}}refresh(){this._reset(),this._setup()}reset(){this.graphics=[]}_setup(){"active"===this.state&&(this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._updateGraphics())}_reset(){this._highlightHelper?.removeAll(),this._resetGraphicStateVars(),this._resetGraphics(),this._updateTooltip(),this._mover&&this._mover.destroy(),this._mover=null,this.view.cursor="default"}_resetGraphicStateVars(){this._startInfo=null,this._activeHandleGraphic=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this._angleOfRotation=0}_resetGraphics(t){(t=t||this.layer)&&(t.removeMany(this._vertexGraphics),t.remove(this._backgroundGraphic),t.remove(this._centerGraphic),t.remove(this._rotateHandleGraphic),t.remove(this._rotateLineGraphic)),this._vertexGraphics.forEach((t=>!t.destroyed&&t.destroy())),!this._backgroundGraphic.destroyed&&this._backgroundGraphic.destroy(),!this._centerGraphic.destroyed&&this._centerGraphic.destroy(),!this._rotateHandleGraphic.destroyed&&this._rotateHandleGraphic.destroy(),!this._rotateLineGraphic.destroyed&&this._rotateLineGraphic.destroy(),this._vertexGraphics=[],this._backgroundGraphic=null,this._centerGraphic=null,this._rotateHandleGraphic=null,this._rotateLineGraphic=null}_setupMover(){let t=[];this.enableScaling&&(t=t.concat(this._vertexGraphics)),this.enableMovement&&(t=t.concat(this.graphics,this._backgroundGraphic)),this.enableRotation&&t.push(this._rotateHandleGraphic),this.showCenterGraphic&&t.push(this._centerGraphic),this._mover=new w({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,view:this.view,graphics:t,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_getStartInfo(t){const[e,i,s,o]=this._getBoxBounds(p()),r=Math.abs(s-e),a=Math.abs(o-i),h=(s+e)/2,c=(o+i)/2,{x:n,y:l}=t.geometry;return{width:r,height:a,centerX:h,centerY:c,startX:n,startY:l,graphicInfos:this._getGraphicInfos(),box:this._backgroundGraphic.geometry,rotate:this._rotateHandleGraphic.geometry}}_getGraphicInfos(){return this.graphics.map((t=>this._getGraphicInfo(t)))}_getGraphicInfo(t){const e=t.geometry,[i,s,o,r]=this._getBounds(p(),[e]);return{width:Math.abs(o-i),height:Math.abs(r-s),centerX:(o+i)/2,centerY:(r+s)/2,geometry:e}}_onGraphicClickCallback(t){t.viewEvent.stopPropagation(),this.emit("graphic-click",t),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(t)}_onGraphicMoveStartCallback(t){const{_angleOfRotation:e,_xScale:i,_yScale:s,_backgroundGraphic:o,_vertexGraphics:r,_rotateHandleGraphic:a,symbols:h}=this,c=t.graphic;this._resetGraphicStateVars(),this._hideGraphicsBeforeUpdate(),o.symbol=h.fill.active,this._startInfo=this._getStartInfo(c),this._updateTooltip(c,t.viewEvent),c===a?(this.view.cursor="grabbing",this.emit("rotate-start",new Y(this.graphics,c,e))):r.includes(c)?(this._activeHandleGraphic=c,this.emit("scale-start",new A(this.graphics,c,i,s))):this.emit("move-start",new z(this.graphics,c,t.dx,t.dy))}_onGraphicMoveCallback(t){const e=t.graphic;if(this._startInfo)if(this._vertexGraphics.includes(e))this._scaleGraphic(e),this._updateTooltip(e,t.viewEvent),this.emit("scale",new X(this.graphics,e,this._xScale,this._yScale));else if(e===this._rotateHandleGraphic)this._rotateGraphic(e),this._updateTooltip(e,t.viewEvent),this.emit("rotate",new N(this.graphics,e,this._angleOfRotation));else{const{dx:i,dy:s}=t;this._totalDx+=i,this._totalDy+=s,this._moveGraphic(e,i,s),this._updateTooltip(e,t.viewEvent),this.emit("move",new P(this.graphics,e,i,s))}}_onGraphicMoveStopCallback(t){const e=t.graphic;if(!this._startInfo)return void this.refresh();const{_angleOfRotation:i,_totalDx:s,_totalDy:o,_xScale:r,_yScale:a,_vertexGraphics:h,_rotateHandleGraphic:c}=this;this.refresh(),e===c?(this.view.cursor="pointer",this.emit("rotate-stop",new U(this.graphics,e,i))):h.includes(e)?this.emit("scale-stop",new F(this.graphics,e,r,a)):this.emit("move-stop",new B(this.graphics,e,s,o))}_onGraphicPointerOverCallback(t){const{_backgroundGraphic:e,_vertexGraphics:i,graphics:s,_rotateHandleGraphic:o,symbols:r,view:a}=this,h=t.graphic;if(this._hoveredGraphic=h,h===o)return o.symbol=r.rotator.hover,a.cursor="pointer",void this._updateTooltip(h);if(s.includes(h)||h===e)return void(a.cursor="move");if(!i.includes(h))return void(a.cursor="pointer");this._updateTooltip(h),t.graphic.symbol=r.handles.hover;const c=a.rotation;let n,l=t.index;switch(l<8&&(c>=0&&c<45?l%=8:l=c>=45&&c<90?(l+1)%8:c>=90&&c<135?(l+2)%8:c>=135&&c<180?(l+3)%8:c>=180&&c<225?(l+4)%8:c>=225&&c<270?(l+5)%8:c>=270&&c<315?(l+6)%8:(l+7)%8),l){case 0:case 4:n="nwse-resize";break;case 1:case 5:n="ns-resize";break;case 2:case 6:n="nesw-resize";break;case 3:case 7:n="ew-resize";break;default:n="pointer"}a.cursor=n}_onGraphicPointerOutCallback(t){const{_vertexGraphics:e,_rotateHandleGraphic:i,symbols:s,view:o}=this;this._hoveredGraphic=null,t.graphic===i?i.symbol=s.rotator.default:e.includes(t.graphic)&&(t.graphic.symbol=s.handles.default),o.cursor="default",this._updateTooltip()}_toPrecision(t,e=2){return Number.parseFloat(t.toFixed(e))}_scaleGraphic(t){const{_startInfo:e,_vertexGraphics:i,preserveAspectRatio:s,view:o}=this,{centerX:r,centerY:a,graphicInfos:h,height:c,startX:n,startY:l,width:p}=e,{resolution:_,transform:d}=o.state,m=i.indexOf(t);1!==m&&5!==m||this._updateX(t,r),3!==m&&7!==m||this._updateY(t,a);const{x:u,y:g}=t.geometry,v=d[0]*u+d[2]*g+d[4],G=d[1]*u+d[3]*g+d[5],w=h?.map((t=>t.geometry))??[],x=w.every((t=>"point"===t.type));if((0===p||0===c)&&x){const t=this._toPrecision((u-n)/_),i=this._toPrecision((l-g)/_);for(let e=0;e<w.length;e++)this.graphics[e].geometry=y(w[e],t,i,o,!0);return this._centerGraphic.geometry=new T(u,g,o.spatialReference),void(this._backgroundGraphic.geometry=y(e.box,t,i,o,!0))}if(s){const t=this._toPrecision(d[0]*r+d[2]*a+d[4],2),e=this._toPrecision(d[1]*r+d[3]*a+d[5],2),i=this._toPrecision(d[0]*n+d[2]*l+d[4],2),s=this._toPrecision(d[1]*n+d[3]*l+d[5],2);let o=b(t,e,i,s,v,G);0!==o&&Math.abs(o)!==1/0||(o=1),this._xScale=this._yScale=o;for(const h of w){const t=w.indexOf(h);this.graphics[t].geometry=f(h,this._xScale,this._yScale,[r,a])}this._updateBackgroundGraphic()}else{let t=u-n,i=l-g;if(1===m||5===m?t=0:3!==m&&7!==m||(i=0),0===t&&0===i)return;const s=r+t/2,h=a+i/2;let d=(p+(n>r?t:-1*t))/p,v=(c+(l<a?i:-1*i))/c;1!==m&&5!==m&&0!==d&&Math.abs(d)!==1/0||(d=1),3!==m&&7!==m&&0!==v&&Math.abs(v)!==1/0||(v=1),this._xScale=d,this._yScale=v;const G=(s-r)/_,b=(h-a)/_,x=f(e.box,this._xScale,this._yScale);this._backgroundGraphic.geometry=y(x,G,b,o,!0);const{centerX:S,centerY:k}=this._getGraphicInfo(this._backgroundGraphic),R=(S-r)/_,M=-1*(k-a)/_;for(const e of w){const t=w.indexOf(e),i=f(e,this._xScale,this._yScale,[r,a]);this.graphics[t].geometry=y(i,R,M,o,!0)}this._centerGraphic.geometry=new T(S,k,o.spatialReference)}}_rotateGraphic(t){const{centerX:e,centerY:i,startX:s,startY:o,box:r,rotate:a}=this._startInfo,h=this.view.spatialReference,c=new T(s,o,h),n=new T(e,i,h),l=t.geometry;this._angleOfRotation=G(c,l,n);const p=this._startInfo.graphicInfos?.map((t=>t.geometry))??[];for(const _ of p){const t=p.indexOf(_),e=m(_,this._angleOfRotation,n);this.graphics[t].geometry=e}this._backgroundGraphic.geometry=m(r,this._angleOfRotation,n),this._rotateHandleGraphic.geometry=m(a,this._angleOfRotation,n)}_moveGraphic(t,e,i){if(this.graphics.includes(t)){const s=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=y(s,e,i,this.view);for(const o of this.graphics)o!==t&&(o.geometry=y(o.geometry,e,i,this.view))}else if(t===this._centerGraphic){const t=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=y(t,e,i,this.view)}if(t===this._backgroundGraphic||t===this._centerGraphic)for(const s of this.graphics)s.geometry=y(s.geometry,e,i,this.view)}_setUpHighlights(){this.highlightsEnabled&&this.graphics.length&&this._highlightHelper?.add(this.graphics)}_setupGraphics(){const{_graphicAttributes:t,symbols:i}=this;this._centerGraphic=new e(null,i.centerIndicator,t),this.showCenterGraphic&&this.layer.add(this._centerGraphic),this._backgroundGraphic=new e(null,i.fill.default,t),this.layer.add(this._backgroundGraphic),this._rotateLineGraphic=new e(null,i.rotatorLine,t),this._rotateHandleGraphic=new e(null,i.rotator.default,t),this.enableRotation&&!this._hasExtentGraphic()&&this.layer.addMany([this._rotateLineGraphic,this._rotateHandleGraphic]);for(let s=0;s<8;s++)this._vertexGraphics.push(new e(null,i.handles.default,t));this.enableScaling&&this.layer.addMany(this._vertexGraphics)}_updateSymbolsForTheme(){const t=this.view.effectiveTheme.accentColor;this.symbols={...this.symbols,fill:{active:this.symbols.fill.active?.clone().set("outline.color",t),default:this.symbols.fill.default?.clone().set("outline.color",t)},handles:{...this.symbols.handles,default:this.symbols.handles.default.clone().set("outline.color",t)},rotator:{...this.symbols.rotator,default:this.symbols.rotator.default.clone().set("outline.color",t)},rotatorLine:this.symbols.rotatorLine.clone().set("color",t)};for(const e of this._vertexGraphics)e.symbol=e===this._hoveredGraphic?this.symbols.handles.hover:this.symbols.handles.default;this._backgroundGraphic.symbol=this.symbols.fill.default,this._rotateHandleGraphic.symbol=this._rotateHandleGraphic===this._hoveredGraphic?this.symbols.rotator.hover:this.symbols.rotator.default,this._rotateLineGraphic.symbol=this.symbols.rotatorLine}_updateGraphics(){this._updateBackgroundGraphic(),this._updateHandleGraphics(),this._updateCenterGraphic(),this._updateRotateGraphic(),this._updateRotateLineGraphic()}_hideGraphicsBeforeUpdate(){this._centerGraphic.visible=!1,this._rotateHandleGraphic.visible=!1,this._rotateLineGraphic.visible=!1,this._vertexGraphics.forEach((t=>t.visible=!1))}_updateHandleGraphics(){const t=this._getCoordinates(!0);this._vertexGraphics.forEach(((e,i)=>{const[s,o]=t[i];this._updateXY(e,s,o)}))}_updateBackgroundGraphic(){const t=this._getCoordinates();this._backgroundGraphic.geometry=new E({rings:t,spatialReference:this.view.spatialReference})}_updateCenterGraphic(){const[t,e,i,s]=this._getBoxBounds(p()),o=(i+t)/2,r=(s+e)/2;this._centerGraphic.geometry=new T(o,r,this.view.spatialReference)}_updateRotateGraphic(){if(!this._vertexGraphics.length)return;const{x:t,y:e}=this._vertexGraphics[1].geometry,i=e+this.view.state.resolution*this._rotateGraphicOffset;this._rotateHandleGraphic.geometry=new T(t,i,this.view.spatialReference)}_updateRotateLineGraphic(){if(!this._vertexGraphics.length||!this._rotateHandleGraphic?.geometry)return;const t=this._vertexGraphics[1].geometry,e=this._rotateHandleGraphic.geometry;this._rotateLineGraphic.geometry=new L({paths:[[t.x,t.y],[e.x,e.y]],spatialReference:this.view.spatialReference})}_updateXY(t,e,i){t.geometry=new T(e,i,this.view.spatialReference)}_updateX(t,e){const i=t.geometry.y;t.geometry=new T(e,i,this.view.spatialReference)}_updateY(t,e){const i=t.geometry.x;t.geometry=new T(i,e,this.view.spatialReference)}_hasExtentGraphic(){return this.graphics.some((t=>null!=t?.geometry&&"extent"===t.geometry.type))}_getBoxBounds(t){const e=this.graphics.map((t=>t.geometry));return this._getBounds(t,e)}_getCoordinates(t){const[e,i,s,o]=this._getBoxBounds(p());if(t){const t=(e+s)/2,r=(o+i)/2;return[[e,o],[t,o],[s,o],[s,r],[s,i],[t,i],[e,i],[e,r]]}return[[e,o],[s,o],[s,i],[e,i]]}_updateTooltip(t,e){if(null==this.tooltip)return;if(!t)return void this.tooltip.clear();const{_backgroundGraphic:i,graphics:s,_vertexGraphics:o,_rotateHandleGraphic:r}=this;t===r?this._updateRotateTooltip():o.includes(t)?this._updateScaleTooltip():(s.includes(t)||t===i)&&this._updateMoveTooltip(e)}_updateRotateTooltip(){null!=this.tooltip&&(this.tooltip.info=new M({sketchOptions:this.sketchOptions,angle:-this._angleOfRotation}))}_updateScaleTooltip(){const{tooltip:t,_xScale:e,_yScale:i,sketchOptions:s,view:o}=this;if(null==t)return;const r=this._getCoordinates(),a=j({topLeft:r[0],topRight:r[1],bottomRight:r[2],bottomLeft:r[3],spatialReference:o.spatialReference});if(null==a)return;const{xSize:h,ySize:c}=a,n=Math.abs(e),l=Math.abs(i);t.info=new H({sketchOptions:s,xScale:n,yScale:l,xSize:h,ySize:c})}_updateMoveTooltip(t){const{tooltip:e,sketchOptions:i,view:s}=this;if(null==e)return;const r=new C({sketchOptions:i});if(t){const{x:e,y:i}=t.origin,a=s.toMap(t),h=s.toMap({x:e,y:i}),c=O(h,a);r.distance=null!=c?c:o}e.info=r}};t([n()],q.prototype,"tooltip",void 0),t([n({readOnly:!0})],q.prototype,"type",void 0),t([n()],q.prototype,"callbacks",void 0),t([n()],q.prototype,"enableMovement",void 0),t([n()],q.prototype,"enableRotation",void 0),t([n()],q.prototype,"enableScaling",void 0),t([n()],q.prototype,"graphics",void 0),t([n()],q.prototype,"highlightsEnabled",void 0),t([n()],q.prototype,"layer",void 0),t([n()],q.prototype,"preserveAspectRatio",void 0),t([n()],q.prototype,"showCenterGraphic",void 0),t([n({readOnly:!0})],q.prototype,"state",null),t([n()],q.prototype,"symbols",void 0),t([n({type:R})],q.prototype,"sketchOptions",void 0),t([n({constructOnly:!0})],q.prototype,"view",void 0),q=t([l("esri.views.draw.support.Box")],q);const J=q;export{J as default};
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import e from"../../../Graphic.js";import i from"../../../core/Evented.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{zeroMeters as o}from"../../../core/quantityUtils.js";import{when as r,watch as a,syncAndInitial as h,initial as c}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{create as p}from"../../../geometry/support/aaBoundingRect.js";import{getRingsOrPathsBounds as _}from"../../../geometry/support/boundsUtils.js";import{geometryToCoordinates as d}from"../../../geometry/support/coordsUtils.js";import m from"../../../geometry/support/rotate.js";import u from"../../../symbols/SimpleFillSymbol.js";import g from"../../../symbols/SimpleLineSymbol.js";import v from"../../../symbols/SimpleMarkerSymbol.js";import{cloneMove as y,scale as f,getRotationAngle as G,getScaleRatio as b}from"./drawUtils.js";import w from"./GraphicMover.js";import x from"./HighlightHelper.js";import{addUniqueLayer as S}from"./layerUtils.js";import{settings as k}from"./settings.js";import R from"../../interactive/sketch/SketchOptions.js";import{ExtentRotateTooltipInfo as M,ExtentScaleTooltipInfo as H}from"../../interactive/tooltip/ExtentTooltipInfos.js";import{Tooltip as I}from"../../interactive/tooltip/Tooltip.js";import{TranslateTooltipInfo as C}from"../../interactive/tooltip/TranslateTooltipInfos.js";import{autoDistanceBetweenPoints2D as O}from"../../support/automaticLengthMeasurementUtils.js";import{autoSize2D as j}from"../../support/extentUtils.js";import T from"../../../geometry/Point.js";import E from"../../../geometry/Polygon.js";import L from"../../../geometry/Polyline.js";class z{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move-start"}}class B{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move"}}class Y{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.dx=i,this.dy=s,this.type="move-stop"}}class N{constructor(t,e,i){this.graphics=t,this.mover=e,this.angle=i,this.type="rotate-start"}}class U{constructor(t,e,i){this.graphics=t,this.mover=e,this.angle=i,this.type="rotate"}}class A{constructor(t,e,i){this.graphics=t,this.mover=e,this.angle=i,this.type="rotate-stop"}}class P{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.xScale=i,this.yScale=s,this.type="scale-start"}}class X{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.xScale=i,this.yScale=s,this.type="scale"}}class F{constructor(t,e,i,s){this.graphics=t,this.mover=e,this.xScale=i,this.yScale=s,this.type="scale-stop"}}const D=k.transformGraphics,V={centerIndicator:new v({style:"cross",size:D.center.size,color:D.center.color}),fill:{default:new u({color:D.fill.color,outline:{color:D.fill.outlineColor,join:"round",width:1}}),active:new u({color:D.fill.stagedColor,outline:{color:D.fill.outlineColor,join:"round",style:"dash",width:1}})},handles:{default:new v({style:"square",size:D.vertex.size,color:D.vertex.color,outline:{color:D.vertex.outlineColor,width:1}}),hover:new v({style:"square",size:D.vertex.hoverSize,color:D.vertex.hoverColor,outline:{color:D.vertex.hoverOutlineColor,width:1}})},rotator:{default:new v({style:"circle",size:D.vertex.size,color:D.vertex.color,outline:{color:D.vertex.outlineColor,width:1}}),hover:new v({style:"circle",size:D.vertex.hoverSize,color:D.vertex.hoverColor,outline:{color:D.vertex.hoverOutlineColor,width:1}})},rotatorLine:new g({color:D.line.color,width:1})};let q=class extends i.EventedAccessor{constructor(t){super(t),this._activeHandleGraphic=null,this._graphicAttributes={esriSketchTool:"box"},this._mover=null,this._centerGraphic=null,this._backgroundGraphic=null,this._vertexGraphics=[],this._rotateHandleGraphic=null,this._rotateGraphicOffset=20,this._angleOfRotation=0,this._rotateLineGraphic=null,this._startInfo=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this.tooltip=null,this.type="box",this.callbacks={onMoveStart(){},onMove(){},onMoveStop(){},onScaleStart(){},onScale(){},onScaleStop(){},onRotateStart(){},onRotate(){},onRotateStop(){},onGraphicClick(){}},this.enableMovement=!0,this.enableRotation=!0,this.enableScaling=!0,this.graphics=[],this.highlightsEnabled=!0,this.layer=null,this.preserveAspectRatio=!1,this.showCenterGraphic=!0,this.symbols=V,this.sketchOptions=new R,this.view=null,this._getBounds=(()=>{const t=p();return(e,i)=>{e[0]=Number.POSITIVE_INFINITY,e[1]=Number.POSITIVE_INFINITY,e[2]=Number.NEGATIVE_INFINITY,e[3]=Number.NEGATIVE_INFINITY;for(const s of i){if(!s)continue;let i,o,r,a;if("point"===s.type)i=r=s.x,o=a=s.y;else if("multipoint"===s.type){const e=d(s);[i,o,r,a]=_(t,[e])}else if("extent"===s.type)[i,o,r,a]=[s.xmin,s.ymin,s.xmax,s.ymax];else{const e=d(s);[i,o,r,a]=_(t,e)}e[0]=Math.min(i,e[0]),e[1]=Math.min(o,e[1]),e[2]=Math.max(r,e[2]),e[3]=Math.max(a,e[3])}return e}})()}initialize(){const t=this.view;this._highlightHelper=new x({view:t}),this.tooltip=new I({view:t}),this._setup(),this.addHandles([r((()=>t?.ready),(()=>{const{layer:t,view:e}=this;S(e,t)}),{once:!0,initial:!0}),a((()=>this.preserveAspectRatio),(()=>{this._activeHandleGraphic&&(this._scaleGraphic(this._activeHandleGraphic),this._updateGraphics(),this._updateTooltip(this._activeHandleGraphic))})),a((()=>t?.scale),(()=>{this._updateRotateGraphic(),this._updateRotateLineGraphic()})),a((()=>this.graphics),(()=>this.refresh())),a((()=>this.layer),((t,e)=>{e&&this._resetGraphics(e),this.refresh()})),a((()=>this.highlightsEnabled),(()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()})),a((()=>this.sketchOptions.tooltips.effectiveEnabled),(t=>{this.tooltip=t?new I({view:this.view}):s(this.tooltip)}),h),a((()=>this.view.effectiveTheme.accentColor),(()=>this._updateSymbolsForTheme()),c),this.on("move-start",(t=>this.callbacks?.onMoveStart?.(t))),this.on("move",(t=>this.callbacks?.onMove?.(t))),this.on("move-stop",(t=>this.callbacks?.onMoveStop?.(t))),this.on("rotate-start",(t=>this.callbacks?.onRotateStart?.(t))),this.on("rotate",(t=>this.callbacks?.onRotate?.(t))),this.on("rotate-stop",(t=>this.callbacks?.onRotateStop?.(t))),this.on("scale-start",(t=>this.callbacks?.onScaleStart?.(t))),this.on("scale",(t=>this.callbacks?.onScale?.(t))),this.on("scale-stop",(t=>this.callbacks?.onScaleStop?.(t)))])}destroy(){this._reset(),this.tooltip=s(this.tooltip)}get state(){const t=this.view?.ready??!1,e=this.graphics.length&&this.layer;return t&&e?"active":t?"ready":"disabled"}isUIGraphic(t){return this._vertexGraphics.includes(t)||t===this._backgroundGraphic||t===this._centerGraphic||t===this._rotateHandleGraphic||t===this._rotateLineGraphic}move(t,e){if(this._mover&&this.graphics.length){for(const i of this.graphics){const s=i.geometry,o=y(s,t,e,this.view);i.geometry=o}this.refresh(),this.emit("move-stop",new Y(this.graphics,null,t,e))}}scale(t,e){if(this._mover&&this.graphics.length){for(const i of this.graphics){const s=i.geometry,o=f(s,t,e);i.geometry=o}this.refresh(),this.emit("scale-stop",new F(this.graphics,null,t,e))}}rotate(t,e){if(this._mover&&this.graphics.length){if(!e){const t=this._vertexGraphics[1].geometry.x,i=this._vertexGraphics[3].geometry.y;e=new T(t,i,this.view.spatialReference)}for(const i of this.graphics){const s=i.geometry,o=m(s,t,e);i.geometry=o}this.refresh(),this.emit("rotate-stop",new A(this.graphics,null,t))}}refresh(){this._reset(),this._setup()}reset(){this.graphics=[]}_setup(){"active"===this.state&&(this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._updateGraphics())}_reset(){this._highlightHelper?.removeAll(),this._resetGraphicStateVars(),this._resetGraphics(),this._updateTooltip(),this._mover&&this._mover.destroy(),this._mover=null,this.view.cursor="default"}_resetGraphicStateVars(){this._startInfo=null,this._activeHandleGraphic=null,this._totalDx=0,this._totalDy=0,this._xScale=1,this._yScale=1,this._angleOfRotation=0}_resetGraphics(t){(t=t||this.layer)&&(t.removeMany(this._vertexGraphics),t.remove(this._backgroundGraphic),t.remove(this._centerGraphic),t.remove(this._rotateHandleGraphic),t.remove(this._rotateLineGraphic)),this._vertexGraphics.forEach((t=>!t.destroyed&&t.destroy())),!this._backgroundGraphic.destroyed&&this._backgroundGraphic.destroy(),!this._centerGraphic.destroyed&&this._centerGraphic.destroy(),!this._rotateHandleGraphic.destroyed&&this._rotateHandleGraphic.destroy(),!this._rotateLineGraphic.destroyed&&this._rotateLineGraphic.destroy(),this._vertexGraphics=[],this._backgroundGraphic=null,this._centerGraphic=null,this._rotateHandleGraphic=null,this._rotateLineGraphic=null}_setupMover(){let t=[];this.enableScaling&&(t=t.concat(this._vertexGraphics)),this.enableMovement&&(t=t.concat(this.graphics,this._backgroundGraphic)),this.enableRotation&&t.push(this._rotateHandleGraphic),this.showCenterGraphic&&t.push(this._centerGraphic),this._mover=new w({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,view:this.view,graphics:t,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_getStartInfo(t){const[e,i,s,o]=this._getBoxBounds(p()),r=Math.abs(s-e),a=Math.abs(o-i),h=(s+e)/2,c=(o+i)/2,{x:n,y:l}=t.geometry;return{width:r,height:a,centerX:h,centerY:c,startX:n,startY:l,graphicInfos:this._getGraphicInfos(),box:this._backgroundGraphic.geometry,rotate:this._rotateHandleGraphic.geometry}}_getGraphicInfos(){return this.graphics.map((t=>this._getGraphicInfo(t)))}_getGraphicInfo(t){const e=t.geometry,[i,s,o,r]=this._getBounds(p(),[e]);return{width:Math.abs(o-i),height:Math.abs(r-s),centerX:(o+i)/2,centerY:(r+s)/2,geometry:e}}_onGraphicClickCallback(t){t.viewEvent.stopPropagation(),this.emit("graphic-click",t),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(t)}_onGraphicMoveStartCallback(t){const{_angleOfRotation:e,_xScale:i,_yScale:s,_backgroundGraphic:o,_vertexGraphics:r,_rotateHandleGraphic:a,symbols:h}=this,c=t.graphic;this._resetGraphicStateVars(),this._hideGraphicsBeforeUpdate(),o.symbol=h.fill.active,this._startInfo=this._getStartInfo(c),this._updateTooltip(c,t.viewEvent),c===a?(this.view.cursor="grabbing",this.emit("rotate-start",new N(this.graphics,c,e))):r.includes(c)?(this._activeHandleGraphic=c,this.emit("scale-start",new P(this.graphics,c,i,s))):this.emit("move-start",new z(this.graphics,c,t.dx,t.dy))}_onGraphicMoveCallback(t){const e=t.graphic;if(this._startInfo)if(this._vertexGraphics.includes(e))this._scaleGraphic(e),this._updateTooltip(e,t.viewEvent),this.emit("scale",new X(this.graphics,e,this._xScale,this._yScale));else if(e===this._rotateHandleGraphic)this._rotateGraphic(e),this._updateTooltip(e,t.viewEvent),this.emit("rotate",new U(this.graphics,e,this._angleOfRotation));else{const{dx:i,dy:s}=t;this._totalDx+=i,this._totalDy+=s,this._moveGraphic(e,i,s),this._updateTooltip(e,t.viewEvent),this.emit("move",new B(this.graphics,e,i,s))}}_onGraphicMoveStopCallback(t){const e=t.graphic;if(!this._startInfo)return void this.refresh();const{_angleOfRotation:i,_totalDx:s,_totalDy:o,_xScale:r,_yScale:a,_vertexGraphics:h,_rotateHandleGraphic:c}=this;this.refresh(),e===c?(this.view.cursor="pointer",this.emit("rotate-stop",new A(this.graphics,e,i))):h.includes(e)?this.emit("scale-stop",new F(this.graphics,e,r,a)):this.emit("move-stop",new Y(this.graphics,e,s,o))}_onGraphicPointerOverCallback(t){const{_backgroundGraphic:e,_vertexGraphics:i,graphics:s,_rotateHandleGraphic:o,symbols:r,view:a}=this,h=t.graphic;if(this._hoveredGraphic=h,h===o)return o.symbol=r.rotator.hover,a.cursor="pointer",void this._updateTooltip(h);if(s.includes(h)||h===e)return void(a.cursor="move");if(!i.includes(h))return void(a.cursor="pointer");this._updateTooltip(h),t.graphic.symbol=r.handles.hover;const c=a.rotation;let n,l=t.index;switch(l<8&&(c>=0&&c<45?l%=8:l=c>=45&&c<90?(l+1)%8:c>=90&&c<135?(l+2)%8:c>=135&&c<180?(l+3)%8:c>=180&&c<225?(l+4)%8:c>=225&&c<270?(l+5)%8:c>=270&&c<315?(l+6)%8:(l+7)%8),l){case 0:case 4:n="nwse-resize";break;case 1:case 5:n="ns-resize";break;case 2:case 6:n="nesw-resize";break;case 3:case 7:n="ew-resize";break;default:n="pointer"}a.cursor=n}_onGraphicPointerOutCallback(t){const{_vertexGraphics:e,_rotateHandleGraphic:i,symbols:s,view:o}=this;this._hoveredGraphic=null,t.graphic===i?i.symbol=s.rotator.default:e.includes(t.graphic)&&(t.graphic.symbol=s.handles.default),o.cursor="default",this._updateTooltip()}_scaleGraphic(t){const{_startInfo:e,_vertexGraphics:i,preserveAspectRatio:s,view:o}=this,{centerX:r,centerY:a,graphicInfos:h,height:c,startX:n,startY:l,width:p}=e,{resolution:_,transform:d}=o.state,m=i.indexOf(t);1!==m&&5!==m||this._updateX(t,r),3!==m&&7!==m||this._updateY(t,a);const{x:u,y:g}=t.geometry,v=d[0]*u+d[2]*g+d[4],G=d[1]*u+d[3]*g+d[5],w=h?.map((t=>t.geometry))??[],x=w.every((t=>"point"===t.type));if((0===p||0===c)&&x){const t=J((u-n)/_),i=J((l-g)/_);for(let e=0;e<w.length;e++)this.graphics[e].geometry=y(w[e],t,i,o,!0);return this._centerGraphic.geometry=new T(u,g,o.spatialReference),void(this._backgroundGraphic.geometry=y(e.box,t,i,o,!0))}if(s){const t=J(d[0]*r+d[2]*a+d[4],2),e=J(d[1]*r+d[3]*a+d[5],2),i=J(d[0]*n+d[2]*l+d[4],2),s=J(d[1]*n+d[3]*l+d[5],2);let o=b(t,e,i,s,v,G);0!==o&&Math.abs(o)!==1/0||(o=1),this._xScale=this._yScale=o;for(const h of w){const t=w.indexOf(h);this.graphics[t].geometry=f(h,this._xScale,this._yScale,[r,a])}this._updateBackgroundGraphic()}else{let t=u-n,i=l-g;if(1===m||5===m?t=0:3!==m&&7!==m||(i=0),0===t&&0===i)return;const s=r+t/2,h=a+i/2;let d=(p+(n>r?t:-1*t))/p,v=(c+(l<a?i:-1*i))/c;1!==m&&5!==m&&0!==d&&Math.abs(d)!==1/0||(d=1),3!==m&&7!==m&&0!==v&&Math.abs(v)!==1/0||(v=1),this._xScale=d,this._yScale=v;const G=(s-r)/_,b=(h-a)/_,x=f(e.box,this._xScale,this._yScale);this._backgroundGraphic.geometry=y(x,G,b,o,!0);const{centerX:S,centerY:k}=this._getGraphicInfo(this._backgroundGraphic),R=(S-r)/_,M=-1*(k-a)/_;for(const e of w){const t=w.indexOf(e),i=f(e,this._xScale,this._yScale,[r,a]);this.graphics[t].geometry=y(i,R,M,o,!0)}this._centerGraphic.geometry=new T(S,k,o.spatialReference)}}_rotateGraphic(t){const{centerX:e,centerY:i,startX:s,startY:o,box:r,rotate:a}=this._startInfo,h=this.view.spatialReference,c=new T(s,o,h),n=new T(e,i,h),l=t.geometry;this._angleOfRotation=G(c,l,n);const p=this._startInfo.graphicInfos?.map((t=>t.geometry))??[];for(const _ of p){const t=p.indexOf(_),e=m(_,this._angleOfRotation,n);this.graphics[t].geometry=e}this._backgroundGraphic.geometry=m(r,this._angleOfRotation,n),this._rotateHandleGraphic.geometry=m(a,this._angleOfRotation,n)}_moveGraphic(t,e,i){if(this.graphics.includes(t)){const s=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=y(s,e,i,this.view);for(const o of this.graphics)o!==t&&(o.geometry=y(o.geometry,e,i,this.view))}else if(t===this._centerGraphic){const t=this._backgroundGraphic.geometry;this._backgroundGraphic.geometry=y(t,e,i,this.view)}if(t===this._backgroundGraphic||t===this._centerGraphic)for(const s of this.graphics)s.geometry=y(s.geometry,e,i,this.view)}_setUpHighlights(){this.highlightsEnabled&&this.graphics.length&&this._highlightHelper?.add(this.graphics)}_setupGraphics(){const{_graphicAttributes:t,symbols:i}=this;this._centerGraphic=new e(null,i.centerIndicator,t),this.showCenterGraphic&&this.layer.add(this._centerGraphic),this._backgroundGraphic=new e(null,i.fill.default,t),this.layer.add(this._backgroundGraphic),this._rotateLineGraphic=new e(null,i.rotatorLine,t),this._rotateHandleGraphic=new e(null,i.rotator.default,t),this.enableRotation&&!this._hasExtentGraphic()&&this.layer.addMany([this._rotateLineGraphic,this._rotateHandleGraphic]);for(let s=0;s<8;s++)this._vertexGraphics.push(new e(null,i.handles.default,t));this.enableScaling&&this.layer.addMany(this._vertexGraphics)}_updateSymbolsForTheme(){const t=this.view.effectiveTheme.accentColor;this.symbols={...this.symbols,fill:{active:this.symbols.fill.active?.clone().set("outline.color",t),default:this.symbols.fill.default?.clone().set("outline.color",t)},handles:{...this.symbols.handles,default:this.symbols.handles.default.clone().set("outline.color",t)},rotator:{...this.symbols.rotator,default:this.symbols.rotator.default.clone().set("outline.color",t)},rotatorLine:this.symbols.rotatorLine.clone().set("color",t)};for(const e of this._vertexGraphics)e.symbol=e===this._hoveredGraphic?this.symbols.handles.hover:this.symbols.handles.default;this._backgroundGraphic.symbol=this.symbols.fill.default,this._rotateHandleGraphic.symbol=this._rotateHandleGraphic===this._hoveredGraphic?this.symbols.rotator.hover:this.symbols.rotator.default,this._rotateLineGraphic.symbol=this.symbols.rotatorLine}_updateGraphics(){this._updateBackgroundGraphic(),this._updateHandleGraphics(),this._updateCenterGraphic(),this._updateRotateGraphic(),this._updateRotateLineGraphic()}_hideGraphicsBeforeUpdate(){this._centerGraphic.visible=!1,this._rotateHandleGraphic.visible=!1,this._rotateLineGraphic.visible=!1,this._vertexGraphics.forEach((t=>t.visible=!1))}_updateHandleGraphics(){const t=this._getCoordinates(!0);this._vertexGraphics.forEach(((e,i)=>{const[s,o]=t[i];this._updateXY(e,s,o)}))}_updateBackgroundGraphic(){const t=this._getCoordinates();this._backgroundGraphic.geometry=new E({rings:t,spatialReference:this.view.spatialReference})}_updateCenterGraphic(){const[t,e,i,s]=this._getBoxBounds(p()),o=(i+t)/2,r=(s+e)/2;this._centerGraphic.geometry=new T(o,r,this.view.spatialReference)}_updateRotateGraphic(){if(!this._vertexGraphics.length)return;const{x:t,y:e}=this._vertexGraphics[1].geometry,i=e+this.view.state.resolution*this._rotateGraphicOffset;this._rotateHandleGraphic.geometry=new T(t,i,this.view.spatialReference)}_updateRotateLineGraphic(){if(!this._vertexGraphics.length||!this._rotateHandleGraphic?.geometry)return;const t=this._vertexGraphics[1].geometry,e=this._rotateHandleGraphic.geometry;this._rotateLineGraphic.geometry=new L({paths:[[t.x,t.y],[e.x,e.y]],spatialReference:this.view.spatialReference})}_updateXY(t,e,i){t.geometry=new T(e,i,this.view.spatialReference)}_updateX(t,e){const i=t.geometry.y;t.geometry=new T(e,i,this.view.spatialReference)}_updateY(t,e){const i=t.geometry.x;t.geometry=new T(i,e,this.view.spatialReference)}_hasExtentGraphic(){return this.graphics.some((t=>null!=t?.geometry&&"extent"===t.geometry.type))}_getBoxBounds(t){const e=this.graphics.map((t=>t.geometry));return this._getBounds(t,e)}_getCoordinates(t){const[e,i,s,o]=this._getBoxBounds(p());if(t){const t=(e+s)/2,r=(o+i)/2;return[[e,o],[t,o],[s,o],[s,r],[s,i],[t,i],[e,i],[e,r]]}return[[e,o],[s,o],[s,i],[e,i]]}_updateTooltip(t,e){if(null==this.tooltip)return;if(!t)return void this.tooltip.clear();const{_backgroundGraphic:i,graphics:s,_vertexGraphics:o,_rotateHandleGraphic:r}=this;t===r?this._updateRotateTooltip():o.includes(t)?this._updateScaleTooltip():(s.includes(t)||t===i)&&this._updateMoveTooltip(e)}_updateRotateTooltip(){null!=this.tooltip&&(this.tooltip.info=new M({sketchOptions:this.sketchOptions,angle:-this._angleOfRotation}))}_updateScaleTooltip(){const{tooltip:t,_xScale:e,_yScale:i,sketchOptions:s,view:o}=this;if(null==t)return;const r=this._getCoordinates(),a=j({topLeft:r[0],topRight:r[1],bottomRight:r[2],bottomLeft:r[3],spatialReference:o.spatialReference});if(null==a)return;const{xSize:h,ySize:c}=a,n=Math.abs(e),l=Math.abs(i);t.info=new H({sketchOptions:s,xScale:n,yScale:l,xSize:h,ySize:c})}_updateMoveTooltip(t){const{tooltip:e,sketchOptions:i,view:s}=this;if(null==e)return;const r=new C({sketchOptions:i});if(t){const{x:e,y:i}=t.origin,a=s.toMap(t),h=s.toMap({x:e,y:i}),c=O(h,a);r.distance=null!=c?c:o}e.info=r}};function J(t,e=2){return Number.parseFloat(t.toFixed(e))}t([n()],q.prototype,"tooltip",void 0),t([n({readOnly:!0})],q.prototype,"type",void 0),t([n()],q.prototype,"callbacks",void 0),t([n()],q.prototype,"enableMovement",void 0),t([n()],q.prototype,"enableRotation",void 0),t([n()],q.prototype,"enableScaling",void 0),t([n()],q.prototype,"graphics",void 0),t([n()],q.prototype,"highlightsEnabled",void 0),t([n()],q.prototype,"layer",void 0),t([n()],q.prototype,"preserveAspectRatio",void 0),t([n()],q.prototype,"showCenterGraphic",void 0),t([n({readOnly:!0})],q.prototype,"state",null),t([n()],q.prototype,"symbols",void 0),t([n({type:R})],q.prototype,"sketchOptions",void 0),t([n({constructOnly:!0})],q.prototype,"view",void 0),q=t([l("esri.views.draw.support.Box")],q);const K=q;export{K as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as i}from"../../../chunks/tslib.es6.js";import"../../../symbols.js";import t from"../../../core/Evented.js";import{clone as e}from"../../../core/lang.js";import{watch as s,when as r}from"../../../core/reactiveUtils.js";import{property as
|
|
5
|
+
import{_ as i}from"../../../chunks/tslib.es6.js";import"../../../symbols.js";import t from"../../../core/Evented.js";import{clone as e}from"../../../core/lang.js";import{watch as s,when as r}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import a from"../../../layers/GraphicsLayer.js";import{cloneMove as c}from"./drawUtils.js";import n from"./HighlightHelper.js";import{addUniqueLayer as l,findLayerView as p}from"./layerUtils.js";import{GraphicClickEvent as d,GraphicDoubleClickEvent as g,GraphicPointerDownEvent as v,GraphicPointerUpEvent as m,GraphicPointerOutEvent as _,GraphicMoveStartEvent as y,GraphicMoveEvent as u,GraphicMoveStopEvent as f,GraphicPointerOverEvent as G}from"./input/GraphicMoverEvents.js";import{ViewEventPriorities as w}from"../../input/InputManager.js";import{GraphicManipulator as b}from"../../interactive/GraphicManipulator.js";import{createScreenPointFromEvent as k}from"../../support/screenUtils.js";import O from"../../../symbols/SimpleMarkerSymbol.js";import x from"../../../symbols/SimpleLineSymbol.js";import H from"../../../symbols/SimpleFillSymbol.js";const M="indicator-symbols";let E=class extends t.EventedAccessor{constructor(i){super(i),this._activeGraphic=null,this._dragEvent=null,this._hoverGraphic=null,this._indicators=[],this._initialDragGeometry=null,this._manipulators=[],this._layerViews=null,this.type="graphic-mover",this.callbacks={onGraphicClick(){},onGraphicDoubleClick(){},onGraphicMoveStart(){},onGraphicMove(){},onGraphicMoveStop(){},onGraphicPointerOver(){},onGraphicPointerOut(){},onGraphicPointerDown(){},onGraphicPointerUp(){}},this.enableMoveAllGraphics=!1,this.graphics=[],this.indicatorsEnabled=!1,this.layer=new a({listMode:"hide",internal:!0,title:"GraphicMover highlight layer"}),this.view=null}initialize(){l(this.view,this.layer),this._highlightHelper=new n({view:this.view}),this.refresh(),this.addHandles([s((()=>this.graphics.length),(()=>this.refresh())),r((()=>this.view?.ready),(()=>{this.addHandles([this.view.on("immediate-click",(i=>this._clickHandler(i)),w.TOOL),this.view.on("double-click",(i=>this._doubleClickHandler(i)),w.TOOL),this.view.on("pointer-down",(i=>this._pointerDownHandler(i)),w.TOOL),this.view.on("pointer-move",(i=>this._pointerMoveHandler(i)),w.TOOL),this.view.on("pointer-up",(i=>this._pointerUpHandler(i)),w.TOOL),this.view.on("drag",(i=>this._dragHandler(i)),w.TOOL),this.view.on("key-down",(i=>this._keyDownHandler(i)),w.TOOL)])}),{once:!0,initial:!0}),s((()=>this.view),(i=>{this._highlightHelper.removeAll(),this._highlightHelper.view=i}))])}destroy(){this._removeIndicators(),this.view.map?.remove(this.layer),this.layer.destroy(),this.reset(),this._manipulators.forEach((i=>i.destroy())),this._manipulators=null}set highlightsEnabled(i){this._highlightHelper?.removeAll(),this._set("highlightsEnabled",i),i&&this._highlightHelper?.add(this.graphics)}get state(){const i=this.view.ready,t=this.graphics.length>0,e=this._activeGraphic;return i&&t?e?"moving":"active":i?"ready":"disabled"}refresh(){this.reset(),this._setup()}reset(){this._activeGraphic=null,this._hoverGraphic=null,this._dragEvent=null,this._highlightHelper.removeAll()}updateGeometry(i,t){const e=this.graphics[i];e&&(e.set("geometry",t),this._setUpIndicators())}_setup(){this._setUpHighlights(),this._setUpIndicators(),this._setUpManipulators(),this._syncLayerViews()}_clickHandler(i){const t=this._findTargetGraphic(k(i));if(t){const e=new d(t,this.graphics.indexOf(t),i.x,i.y,i);this.emit("graphic-click",e),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(e)}}_doubleClickHandler(i){const t=this._findTargetGraphic(k(i));if(t){const e=new g(t,this.graphics.indexOf(t),i.x,i.y,i);this.emit("graphic-double-click",e),this.callbacks.onGraphicDoubleClick&&this.callbacks.onGraphicDoubleClick(e)}}_pointerDownHandler(i){const t=this._findTargetGraphic(k(i));if(t){this._activeGraphic=t;const{x:e,y:s}=i,r=new v(t,this.graphics.indexOf(t),e,s,i);this.emit("graphic-pointer-down",r),this.callbacks.onGraphicPointerDown&&this.callbacks.onGraphicPointerDown(r)}else this._activeGraphic=null}_pointerUpHandler(i){if(this._activeGraphic){const{x:t,y:e}=i,s=this.graphics.indexOf(this._activeGraphic),r=new m(this._activeGraphic,s,t,e,i);this.emit("graphic-pointer-up",r),this.callbacks.onGraphicPointerUp&&this.callbacks.onGraphicPointerUp(r)}}_pointerMoveHandler(i){if(this._dragEvent)return;const t=this._findTargetGraphic(k(i));if(t){const{x:e,y:s}=i;if(this._hoverGraphic){if(this._hoverGraphic===t)return;const r=this.graphics.indexOf(this._hoverGraphic),h=new _(this.graphics[r],r,e,s,i);this._hoverGraphic=null,this.emit("graphic-pointer-out",h),this.callbacks.onGraphicPointerOut&&this.callbacks.onGraphicPointerOut(h)}const r=this.graphics.indexOf(t),h=new G(t,r,e,s,i);return this._hoverGraphic=t,this.emit("graphic-pointer-over",h),void(this.callbacks.onGraphicPointerOver&&this.callbacks.onGraphicPointerOver(h))}if(this._hoverGraphic){const{x:t,y:e}=i,s=this.graphics.indexOf(this._hoverGraphic),r=new _(this.graphics[s],s,t,e,i);this._hoverGraphic=null,this.emit("graphic-pointer-out",r),this.callbacks.onGraphicPointerOut&&this.callbacks.onGraphicPointerOut(r)}}_dragHandler(i){if("start"!==i.action&&!this._dragEvent||!this._activeGraphic?.geometry)return;"start"===i.action&&this._removeIndicators(),i.stopPropagation();const{action:t,x:s,y:r}=i,h=this.graphics.indexOf(this._activeGraphic),o=this._dragEvent?s-this._dragEvent.x:0,a=this._dragEvent?r-this._dragEvent.y:0,n=s-i.origin.x,l=r-i.origin.y,p="start"===t?this._activeGraphic.geometry:this._initialDragGeometry,d=c(p,n,l,this.view);if(this._activeGraphic.geometry=d,this.enableMoveAllGraphics&&this.graphics.forEach((i=>{i!==this._activeGraphic&&(i.geometry=c(i.geometry,o,a,this.view))})),this._dragEvent=i,"start"===t){this._initialDragGeometry=e(p);const t=new y(this._activeGraphic,this.graphics,h,s,r,o,a,n,l,i);this.emit("graphic-move-start",t),this.callbacks.onGraphicMoveStart&&this.callbacks.onGraphicMoveStart(t),t.defaultPrevented&&this._activeGraphic.set("geometry",p)}else if("update"===t){const t=new u(this._activeGraphic,this.graphics,h,s,r,o,a,n,l,i);this.emit("graphic-move",t),this.callbacks.onGraphicMove&&this.callbacks.onGraphicMove(t),t.defaultPrevented&&(this._activeGraphic.geometry=p)}else{const t=new f(this._activeGraphic,this.graphics,h,s,r,o,a,n,l,i);this._dragEvent=null,this._activeGraphic=null,this._setUpIndicators(),this.emit("graphic-move-stop",t),this.callbacks.onGraphicMoveStop&&this.callbacks.onGraphicMoveStop(t),t.defaultPrevented&&(this.graphics[h].set("geometry",this._initialDragGeometry),this._setUpIndicators()),this._initialDragGeometry=null}}_keyDownHandler(i){"a"!==i.key&&"d"!==i.key&&"n"!==i.key||"moving"!==this.state||i.stopPropagation()}_findTargetGraphic(i){const t=this.view.toMap(i),e=this.graphics;let s=null,r=Number.MAX_VALUE;this._syncLayerViews();const h=this._layerViews.flatMap((i=>"graphicsViews"in i?Array.from(i.graphicsViews(),(i=>i.hitTest(t))).flat():i.graphicsView.hitTest(t))).filter((i=>e.includes(i))).sort(((i,t)=>e.indexOf(i)-e.indexOf(t)));return h.length?h[0]:(this._manipulators.forEach((t=>{const e=t.intersectionDistance(i);null!=e&&e<r&&(r=e,s=t.graphic)})),s)}_syncLayerViews(){this._layerViews=[];const i=new Set;for(const t of this.graphics){const e=p(this.view,t.layer);e&&i.add(e)}this._layerViews=[...i]}_setUpManipulators(){const{graphics:i,view:t}=this;this._manipulators.forEach((i=>i.destroy())),this._manipulators=i.length?i.map((i=>new b({graphic:i,view:t}))):[]}_setUpHighlights(){this.highlightsEnabled&&this._highlightHelper.add(this.graphics)}_setUpIndicators(){if(this._removeIndicators(),this.indicatorsEnabled){for(const i of this.graphics){const t=i.clone();t.symbol=j(i),this._indicators.push(t),this.addHandles(s((()=>i.symbol),(()=>this._setUpIndicators())),M)}this.layer.addMany(this._indicators)}}_removeIndicators(){this.removeHandles(M),this._indicators.length&&(this.layer.removeMany(this._indicators),this._indicators.forEach((i=>i.destroy())),this._indicators=[])}};function j(i){const t=12;if(null==i.symbol)return null;switch(i.symbol.type){case"cim":return new O({style:"circle",size:t,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}});case"picture-marker":{const{xoffset:t,yoffset:e,height:s,width:r}=i.symbol,h=s===r?r:Math.max(s,r);return new O({xoffset:t,yoffset:e,size:h,style:"square",color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}case"simple-marker":{const{xoffset:t,yoffset:e,size:s,style:r}=i.symbol;return new O({xoffset:t,yoffset:e,style:"circle"===r?"circle":"square",size:s+2,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}case"simple-fill":return new H({color:[0,0,0,0],outline:{style:"dash",color:[255,127,0,1],width:1}});case"simple-line":return new x({color:[255,127,0,1],style:"dash",width:1});case"text":{const{xoffset:e,yoffset:s}=i.symbol;return new O({xoffset:e,yoffset:s,size:t,color:[0,0,0,0],outline:{color:[255,127,0,1],width:1}})}default:return null}}i([h()],E.prototype,"_activeGraphic",void 0),i([h({readOnly:!0})],E.prototype,"type",void 0),i([h()],E.prototype,"callbacks",void 0),i([h()],E.prototype,"enableMoveAllGraphics",void 0),i([h()],E.prototype,"graphics",void 0),i([h({value:!1})],E.prototype,"highlightsEnabled",null),i([h()],E.prototype,"indicatorsEnabled",void 0),i([h()],E.prototype,"layer",void 0),i([h({readOnly:!0})],E.prototype,"state",null),i([h()],E.prototype,"view",void 0),E=i([o("esri.views.draw.support.GraphicMover")],E);const U=E;export{U as default};
|