@arcgis/core 6.0.0-next.48 → 6.0.0-next.49
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/Ground.js +1 -1
- package/analysis/AreaMeasurementAnalysis.d.ts +12 -10
- package/analysis/AreaMeasurementAnalysis.js +1 -1
- package/applications/Components/formatUtils.d.ts +3 -2
- package/applications/MapViewer/templateUtils.d.ts +4 -1
- package/applications/SceneViewer/sceneViewerUtils.d.ts +12 -1
- package/applications/SceneViewer/sceneViewerUtils.js +1 -1
- package/arcade/featureset/actions/SpatialFilter.js +1 -1
- package/arcade/functions/featuresetgeom.js +1 -1
- package/arcade/functions/geomasync.js +1 -1
- package/arcade/geometry/operatorsWorker.js +1 -1
- package/arcade/geometry/operatorsWorkerConnection.js +1 -1
- package/arcgisGlobal.d.ts +4 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/063cc462524646cd45e8.js +1 -0
- package/assets/esri/core/workers/chunks/119c62e9c9c7440a6129.js +1 -0
- package/assets/esri/core/workers/chunks/14c04fde8d33b739b415.js +1 -0
- package/assets/esri/core/workers/chunks/27a91b52d1bee92b6f20.js +1 -0
- package/assets/esri/core/workers/chunks/31eb09e96f31bced71ad.js +1 -0
- package/assets/esri/core/workers/chunks/{056a815273653271bf75.js → 3236e18921955450fc0d.js} +5 -5
- package/assets/esri/core/workers/chunks/3ce7120056040af3bab1.js +1 -0
- package/assets/esri/core/workers/chunks/435dacf493aec07ff6e3.js +1 -0
- package/assets/esri/core/workers/chunks/4c26d6408ee7a3b9d163.js +1 -0
- package/assets/esri/core/workers/chunks/{73bf76a3a0418edb26a5.js → 506954fb374ea528d020.js} +1 -1
- package/assets/esri/core/workers/chunks/55db28616f810ca063b7.js +1 -0
- package/assets/esri/core/workers/chunks/59ae5bd0ee1bae7a9fb3.js +1 -0
- package/assets/esri/core/workers/chunks/630a36c4817f33f4cad2.js +1 -0
- package/assets/esri/core/workers/chunks/6779afc2d6ee46c301b5.js +1 -0
- package/assets/esri/core/workers/chunks/6a509ffb4852d694a097.js +1 -0
- package/assets/esri/core/workers/chunks/6d25a7071fceb707858a.js +1 -0
- package/assets/esri/core/workers/chunks/7a97eec9823941fd210f.js +29 -0
- package/assets/esri/core/workers/chunks/82bbf0c5e18fc1c795f4.js +1 -0
- package/assets/esri/core/workers/chunks/91019e9dff63107f8cb4.js +1 -0
- package/assets/esri/core/workers/chunks/{1345413ec0b4128849b1.js → 954f9854a9bf4a852b81.js} +1 -1
- package/assets/esri/core/workers/chunks/9846abf2d3991a15b2b5.js +1 -0
- package/assets/esri/core/workers/chunks/9f74b3f0f453bc957e3a.js +1 -0
- package/assets/esri/core/workers/chunks/a0e2a1c6f37454547193.js +1 -0
- package/assets/esri/core/workers/chunks/a1c45e8f5bba471b3905.js +1 -0
- package/assets/esri/core/workers/chunks/a2825285d46f8cd5d814.js +1 -0
- package/assets/esri/core/workers/chunks/{d4f6be8290ad0243e1b8.js → b511b5c68defefccde0b.js} +1 -1
- package/assets/esri/core/workers/chunks/bf81b3670b5323621e2d.js +1 -0
- package/assets/esri/core/workers/chunks/c4794d692934098988e7.js +1 -0
- package/assets/esri/core/workers/chunks/d0900a901197948bd7df.js +1 -0
- package/assets/esri/core/workers/chunks/d2ed93bbfa98395bbed7.js +1 -0
- package/assets/esri/core/workers/chunks/d486a8a61ff993f8202a.js +1 -0
- package/assets/esri/core/workers/chunks/e06036392a982dbf3ae3.js +1 -0
- package/assets/esri/core/workers/chunks/{773ba0909ccd3a034c31.js → ed1db6571b0c61fe4f91.js} +1 -1
- package/chunks/BlendWeights.glsl.js +4 -5
- package/chunks/Blur.glsl.js +10 -7
- package/chunks/BlurEmission.glsl.js +27 -7
- package/chunks/Clouds.glsl.js +2 -2
- package/chunks/Component.glsl.js +1 -1
- package/chunks/EdgeDetect.glsl.js +1 -1
- package/chunks/EdgeShader.glsl.js +1 -1
- package/chunks/EmissionComposite.glsl.js +2 -2
- package/chunks/Fog.glsl.js +4 -4
- package/chunks/GlobalIlluminationBlur.glsl.js +1 -1
- package/chunks/HighlightSharpApply.glsl.js +4 -1
- package/chunks/LineMarker.glsl.js +4 -4
- package/chunks/Magnifier.glsl.js +1 -1
- package/chunks/NoiseTextureAtlas.glsl.js +3 -3
- package/chunks/Pattern.glsl.js +35 -32
- package/chunks/{ChapmanAtmosphere.glsl.js → RealisticAtmosphere.glsl.js} +18 -9
- package/chunks/RealisticAtmosphereCompositing.glsl.js +35 -0
- package/chunks/SSAO.glsl.js +2 -2
- package/chunks/SimpleAtmosphere.glsl.js +1 -1
- package/config.js +1 -1
- package/core/accessorSupport/ObservableBase.js +1 -1
- package/core/accessorSupport/tracking/ObservationHandle.js +1 -1
- package/core/accessorSupport/tracking/SimpleObservable.js +1 -1
- package/core/accessorSupport/tracking/SimpleTrackingTarget.js +1 -1
- package/core/accessorSupport/tracking/TrackingTarget.js +1 -1
- package/core/quantity.js +1 -1
- package/core/timeUtils.js +1 -1
- package/geometry/coordinateConversion/CoordinateConversionModel.d.ts +258 -0
- package/geometry/coordinateConversion/CoordinateConversionModel.js +2 -0
- package/geometry/coordinateConversion/support/Conversion.d.ts +73 -0
- package/geometry/coordinateConversion/support/Conversion.js +2 -0
- package/geometry/coordinateConversion/support/Format.d.ts +131 -0
- package/geometry/coordinateConversion/support/Format.js +2 -0
- package/geometry/coordinateConversion/support/coordinateConversionUtils.js +2 -0
- package/geometry/coordinateConversion/support/formatUtils.js +2 -0
- package/geometry/coordinateConversion/types.d.ts +116 -0
- package/kernel.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/IntegratedMeshLayer.js +1 -1
- package/layers/catalog/CatalogFootprintLayer.d.ts +2 -2
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/knowledgeGraph/cypherUtils.js +1 -1
- package/layers/mixins/FeatureLayerBase.d.ts +2 -2
- package/layers/raster/formats/Lzw.js +1 -1
- package/layers/raster/formats/TiffDecoder.js +1 -1
- package/layers/raster/formats/tiffParser.js +1 -1
- package/layers/raster/formats/tiffTag.js +1 -1
- package/layers/support/IntegratedMeshSemantics.js +2 -0
- package/layers/support/VideoElement.js +1 -1
- package/legend/ActiveLayerInfo.js +1 -1
- package/package.json +2 -2
- package/symbols/FillSymbol3DLayer.d.ts +1 -4
- package/time/daylightUtils.d.ts +29 -0
- package/time/daylightUtils.js +2 -0
- package/time/timeZoneUtils.js +1 -1
- package/time/types.d.ts +57 -1
- package/views/2d/analysis/AreaMeasurement/AreaMeasurementTool.js +1 -1
- package/views/2d/analysis/AreaMeasurementAnalysisView2D.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/layers/GeospatialPDFLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/3d/GroundView3D.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
- package/views/3d/analysis/AreaMeasurementAnalysisView3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementController.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/Manipulator3DBase.js +2 -0
- 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/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWebStyleSymbol.js +1 -1
- package/views/3d/layers/graphics/SymbolComplexity.js +1 -1
- package/views/3d/layers/graphics/webStyleUtils.js +1 -1
- package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
- package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
- package/views/3d/layers/support/Tiles3DMeshIntersectionHandler.js +1 -1
- package/views/3d/layers/support/patternUtils.js +1 -1
- package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
- package/views/3d/support/GroundAndIMSurface.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/terrain/PatchRenderDataWaterproofness.js +1 -1
- package/views/3d/terrain/SphericalPatch.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialInitParameters.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterialRepository.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/WaterColor.glsl.js +6 -4
- package/views/3d/webgl-engine/core/shaderLibrary/util/BlendModes.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +10 -9
- package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatUnpacking.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/cameraUniforms.js +1 -1
- package/views/3d/webgl-engine/effects/WeatherFader.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/ChapmanApproximation.glsl.js +3 -3
- package/views/3d/webgl-engine/effects/atmosphere/{ChapmanAtmosphere.glsl.js → RealisticAtmosphere.glsl.js} +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/RealisticAtmosphere.js +2 -0
- package/views/3d/webgl-engine/effects/atmosphere/RealisticAtmosphereCompositing.glsl.js +2 -0
- package/views/3d/webgl-engine/effects/atmosphere/RealisticAtmosphereCompositingTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/atmosphere/RealisticAtmosphereTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
- package/views/3d/webgl-engine/effects/glow/BlurEmission.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/glow/applyEmissiveGlow.glsl.js +87 -41
- package/views/3d/webgl-engine/effects/precipitation/Precipitation.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/EmissionComposite.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/EmissionComposite.js +1 -1
- package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
- package/views/3d/webgl-engine/lib/Octree.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/intersectorUtilsConversions.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/InstanceOctree.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/Pattern.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/PatternLayouts.js +1 -1
- package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/PatternTechniqueConfiguration.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/VideoView.js +1 -1
- package/views/interactive/Tooltip.js +1 -1
- package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
- package/views/interactive/snapping/SnappingAlgorithm.js +1 -1
- package/views/interactive/tooltip/content/TooltipContent.js +1 -1
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.d.ts +3 -0
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
- package/widgets/CoordinateConversion.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/022565ef98a702ab952f.js +0 -1
- package/assets/esri/core/workers/chunks/163e97987e1f75610009.js +0 -1
- package/assets/esri/core/workers/chunks/1d57b1445afec89a7941.js +0 -1
- package/assets/esri/core/workers/chunks/3654672d772d11484883.js +0 -1
- package/assets/esri/core/workers/chunks/3af0ff5a0b82872aac38.js +0 -1
- package/assets/esri/core/workers/chunks/3b9415dfd7546aeec261.js +0 -1
- package/assets/esri/core/workers/chunks/5109b48666138df14038.js +0 -1
- package/assets/esri/core/workers/chunks/6b73dfc9252b32f1eae2.js +0 -1
- package/assets/esri/core/workers/chunks/6e4698879e7d8fbc4d12.js +0 -1
- package/assets/esri/core/workers/chunks/71295afd21fc5bc5ddbc.js +0 -1
- package/assets/esri/core/workers/chunks/794a9f116c4700bb1210.js +0 -1
- package/assets/esri/core/workers/chunks/8e0ecc7f55dd8bf2cf16.js +0 -1
- package/assets/esri/core/workers/chunks/9dece842ada6278c33ef.js +0 -1
- package/assets/esri/core/workers/chunks/a12e29f2cb78fdaa0753.js +0 -1
- package/assets/esri/core/workers/chunks/b70af9fb974ef9836efd.js +0 -1
- package/assets/esri/core/workers/chunks/c0f2b6a10bcc766318f5.js +0 -1
- package/assets/esri/core/workers/chunks/c248db5e4d92cfb3c4d1.js +0 -1
- package/assets/esri/core/workers/chunks/ce02adb527389b90223d.js +0 -1
- package/assets/esri/core/workers/chunks/d8eea5ffe05c620fac9e.js +0 -1
- package/assets/esri/core/workers/chunks/d997d81d0965c05447d4.js +0 -1
- package/assets/esri/core/workers/chunks/e1645882f54818c4036a.js +0 -1
- package/assets/esri/core/workers/chunks/e44679a0d271c1efb60d.js +0 -1
- package/assets/esri/core/workers/chunks/f11f40017ec97a2a6b5f.js +0 -29
- package/assets/esri/core/workers/chunks/f7f5d8256e63d303cbcb.js +0 -1
- package/assets/esri/core/workers/chunks/f87d5450190896e61ff8.js +0 -1
- package/assets/esri/core/workers/chunks/fdee2255f49b43056e9d.js +0 -1
- package/assets/esri/core/workers/chunks/ff1e614fde01781360fa.js +0 -1
- package/chunks/AtmosphereCompositing.glsl.js +0 -25
- package/views/3d/analysis/ShadowCast/sunlightUtils.js +0 -2
- package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.js +0 -2
- package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphereTechnique.js +0 -2
- package/views/3d/webgl-engine/shaders/AtmosphereCompositing.glsl.js +0 -2
- package/views/3d/webgl-engine/shaders/AtmosphereCompositingTechnique.js +0 -2
package/views/SceneView.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../Camera.js";import n from"../Viewpoint.js";import r from"../core/Collection.js";import{byId as i}from"../core/domUtils.js";import a from"../core/Error.js";import{on as o}from"../core/events.js";import{destroyHandle as s,makeHandle as c}from"../core/handleUtils.js";import has from"../core/has.js";import l from"../core/Logger.js";import{mapCollectionAsync as ee}from"../core/mapCollectionUtils.js";import{destroyMaybe as u,maybeProperty as d}from"../core/maybe.js";import{throwIfDestroyed as te,throwIfAborted as ne,createAbortError as re}from"../core/promiseUtils.js";import ie from"../core/ReactiveSet.js";import{on as f,watch as p,initial as m,sync as h,whenOnce as g,syncAndInitial as _}from"../core/reactiveUtils.js";import{setFrameDuration as ae,cleanupScheduling as oe}from"../core/scheduling.js";import{createScreenPoint as se,createScreenPointArray as ce}from"../core/screenUtils.js";import{cleanupWhereClauseCache as le}from"../core/sql.js";import{getDefaultVerticalUnitStringForSR as ue,getMetersPerUnitForSR as de}from"../core/units.js";import{property as v,cast as y,subclass as fe}from"../core/accessorSupport/decorators.js";import{ensureType as b,ensureClass as x}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as pe}from"../core/accessorSupport/overrideDefaultsFrom.js";import{runUntracked as me}from"../core/accessorSupport/tracking.js";import{drainNotificationQueue as he}from"../core/accessorSupport/trackingUtils.js";import{create as ge}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{cleanupPooledRBush as _e}from"../core/libs/rbush/PooledRBush.js";import{initialize as ve}from"../core/workers/workers.js";import S from"../geometry/Extent.js";import ye from"../geometry/HeightModelInfo.js";import C from"../geometry/Point.js";import{project as w,canProjectWithoutEngine as be}from"../geometry/projectionUtils.js";import T from"../geometry/SpatialReference.js";import{cleanupSpatialReferenceEllipsoidUtils as xe}from"../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingRect as Se}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as E}from"../geometry/projection/projectPointToVector.js";import{toExtent as Ce,create as we}from"../geometry/support/aaBoundingRect.js";import{renderSRFromViewSR as Te}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as Ee}from"../geometry/support/scaleUtils.js";import{wgs84 as De,webMercator as Oe}from"../geometry/support/spatialReferenceUtils.js";import{makeDehydratedPoint as ke}from"../layers/graphics/dehydratedPoint.js";import{isImageryTileLayer as D,isTiledLayer as O,isVoxelLayer as k,isIntegratedMeshLayer as A,isGaussianSplatLayer as Ae}from"../layers/support/layerUtils.js";import{TilemapCache as je}from"../layers/support/TilemapCache.js";import{clearDefaultPortalInstance as Me}from"../portal/portalDefault.js";import{WebSceneTag as Ne}from"../support/tagSymbols.js";import{BreakpointsOwner as Pe}from"./BreakpointsOwner.js";import{DOMContainer as Fe}from"./DOMContainer.js";import{PopupView as Ie}from"./PopupView.js";import j from"./View.js";import Le from"./ViewAnimation.js";import{stringFromViewingMode as M,viewingModeFromString as N}from"./ViewingMode.js";import{GroundView3D as Re}from"./3d/GroundView3D.js";import{layerView3DImporter as P}from"./3d/layerViewModuleImportUtils.js";import{importAnalysisViewModule as ze}from"./3d/analysis/analysisViewModuleImportUtils.js";import{cleanupIntersectionUtils as Be}from"./3d/camera/intersectionUtils.js";import F from"./3d/constraints/Constraints.js";import I from"./3d/environment/Environment.js";import{EnvironmentView as Ve}from"./3d/environment/EnvironmentView.js";import He from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as Ue}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as We}from"./3d/layers/graphics/Labeler.js";import Ge from"./3d/layers/i3s/I3SLodHandling.js";import{Navigation3D as Ke}from"./3d/navigation/Navigation3D.js";import{ScreenSizePerspective as qe}from"./3d/state/ScreenSizePerspective.js";import L from"./3d/state/ViewState.js";import{ViewStateManager as Je,cleanupViewStateManager as Ye}from"./3d/state/ViewStateManager.js";import{cleanupPointToPointAnimationController as Xe}from"./3d/state/controllers/PointToPointAnimationController.js";import{SceneIntersectionHelper as Ze}from"./3d/state/helpers/SceneIntersectionHelper.js";import{cleanupNavigationUtils as Qe}from"./3d/state/utils/navigationUtils.js";import $e from"./3d/support/Attribution3D.js";import{CombinedElevationProvider as et}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as R}from"./3d/support/debugFlags.js";import{getElevationAtPoint as tt}from"./3d/support/ElevationProvider.js";import{GroundAndIMSurface as nt}from"./3d/support/GroundAndIMSurface.js";import{toMap as rt,hitTest as it}from"./3d/support/hitTest.js";import{popupHitTest as at}from"./3d/support/popupHitTest.js";import{getDefaultQualityProfileName as ot,getQualityProfileSettings as z}from"./3d/support/QualityProfile.js";import B from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as st}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as ct}from"./3d/support/ResourceController.js";import lt from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as ut}from"./3d/support/SharedSymbolResources.js";import{ViewSlice as dt}from"./3d/support/ViewSlice.js";import{PointsOfInterest as V}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import H from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as ft,getTiledLayerInfo as pt,checkIfTileInfoSupportedForView as mt}from"./3d/terrain/terrainUtils.js";import{clearTilePerLayerInfo as ht}from"./3d/terrain/TilePerLayerInfo.js";import{cleanupTileRenderer as gt}from"./3d/terrain/TileRenderer.js";import{createWebGLContext as _t}from"./3d/webgl-engine/createWebGLContext.js";import{Stage as vt}from"./3d/webgl-engine/Stage.js";import{olidEnabled as yt}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{cleanupRenderOccluded as bt}from"./3d/webgl-engine/effects/geometry/RenderOccluded.js";import{defaultTolerance as U}from"./3d/webgl-engine/lib/Intersector.js";import{cleanupShadowmap as xt}from"./3d/webgl-engine/lib/ShadowMap.js";import{terrainId as W}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{cleanupEdgeProcessing as St}from"./3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js";import G from"./interactive/options/ViewOptions.js";import Ct from"./support/AnalysisViewManager.js";import{cleanupDrapedUtils as wt}from"./support/drapedUtils.js";import{occludeesSupported as Tt}from"./support/layerViewUtils.js";import{isSupportedScreenPointEvent as K,createScreenPointFromSupportedEvent as Et}from"./support/screenUtils.js";import{isSpatialReferenceSupported as Dt}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as Ot,destroyTextureCompressionWorker as kt}from"./support/TextureCompressionHelper.js";import At from"./ui/DefaultUI.js";import jt from"./ui/3d/DefaultUI3D.js";import Mt from"../webscene/Environment.js";import{clearVNodeCache as Nt}from"../widgets/support/vnodeCache.js";var q;const Pt=Symbol(),J=Symbol();function Ft(e){let t=x(G,e);return t!==e&&e.snapping?.enabled==null&&(t.snapping.enabled=!0),t}let Y=class extends Pe(Ie(Fe(j))){static{q=this}get timeZone(){return super.timeZone}set timeZone(e){super.timeZone=e}constructor(e){super(e),this.options=new G({snapping:{enabled:!0}}),this._userClippingArea=null,this._clippingArea=null,this._overrideDefaultEnvironmentOnly=!0,this._resolveWhenReady=[],this._resourceController=ct(this),this.deconflictor=new Ue({view:this}),this.attribution3D=new $e({view:this}),this.labeler=new We({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.navigation=new Ke({view:this}),this.basemapTerrain=null,this.elevationProvider=new et({view:this}),this._canvas=null,this.constraints=new F,this._environment=new I,this.environmentView=new Ve,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new Ct({importAnalysisViewModule:e=>ze(e),view:this}),this.groundView=null,this.groundAndIMSurface=null,this.map=null,this._featureTileTreeClients=new ie,this._featureTiles=null,this._featureTreeDebugger=null,this.state=new L({view:this}),this.slice=new dt,this.renderCoordsHelper=new st,this.spatialReference=null,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type=`3d`,this.ui=new jt,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this._importControllers=new Map,ve();let t=()=>this._updatingChanged();this.addHandles(s(ee(()=>this.map?.allLayers,async e=>{try{await e.when()}catch{}finally{t()}}))),this.addHandles([f(()=>this.map?.allLayers,`after-changes`,t,{onListenerAdd:t,onListenerRemove:t,sync:!0}),this.allLayerViews.on(`after-changes`,e=>this._updateUpdatingMonitors(e)),p(()=>this.scene,e=>e?.load().catch(()=>{}))]),this.inputManager=new He({view:this}),this.stateManager=new Je({view:this}),this.screenSizePerspective=new qe({view:this})}initialize(){if(has(`enable-feature:esri-compress-textures`)&&has(`wasm-simd`)){let e=Ot(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new Re({view:this}),this.groundAndIMSurface=new nt({view:this}),this._updateUpdatingMonitors(),this.updatingHandles.add(()=>this.qualitySettings.memoryLimit,e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)},m),this.updatingHandles.add(()=>this.qualitySettings.additionalCacheMemory,e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)},m),this.updatingHandles.add(()=>this.qualitySettings.frameRate??0,e=>ae(e>0?1e3/Math.ceil(e):0),m),this.addHandles([p(()=>this.spatialReference,()=>this.notifyChange(`clippingArea`),h),p(()=>({plane:this.slice.plane,isDecoration:this.slice.isDecoration}),()=>this._updateSlice(),h)])}destroy(){this.destroyed||(kt(this),this.updatingHandles.removeAll(),this.basemapTerrain?.clearHandles(),this.elevationProvider.destroy(),this.ui.removeAllHandles(),this.layerViewManager.clearHandles(),this.invalidate(),this.layerViewManager.clear(),this._set(`analysisViewManager`,u(this.analysisViewManager)),this._exitSurface(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this.sharedSymbolResources=u(this.sharedSymbolResources),this._set(`labeler`,u(this.labeler)),this._set(`deconflictor`,u(this.deconflictor)),this._resourceController=u(this._resourceController),this._set(`stateManager`,u(this.stateManager)),this._set(`inputManager`,u(this.inputManager)),this.state.destroy(),this.highlights.destroy(),this.removeHandles(`updatingMonitors`),this._set(`environmentView`,u(this.environmentView)),this._set(`environment`,u(this.environment)),this.groundView=u(this.groundView),this.groundAndIMSurface.destroy(),this.slice.destroy(),this._updatingObjectsWithProgress.length=0,this._updatingObjects.length=0,this.ui?.destroy(),this._set(`ui`,null),this._set(`renderCanvas`,null),this._set(`canvas`,null),this._canvas=null,this.screenSizePerspective.destroy(),this.attribution3D.destroy())}get stage(){return this._stage}get renderSpatialReference(){return this.renderCoordsHelper.spatialReference}get groundSpatialReference(){return this.groundView?.spatialReference}get analyses(){return super.analyses}set analyses(e){super.analyses=e}get animation(){return this.state?.animation}get overlayManager(){return this.basemapTerrain?.overlayManager}get camera(){return this.stateManager?.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){return this.stateManager?.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get canvas(){return this._canvas}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=b(C,e))}get clippingArea(){if(this.viewingMode===`global`)return null;let e=this.map,t=this._userClippingArea||d(e,`clippingArea`);return!(this._userClippingArea||d(e,`clippingEnabled`))||t==null?(this._clippingArea=null,null):t instanceof S?this.spatialReference&&(t=X(t,this.spatialReference),t==null)?(l.getLogger(this).error(`#clippingArea`,`setting clippingArea with incompatible SpatialReference`),this._clippingArea):(t=t.clone(),t.intersection(this._groundAndLayersExtent)??(t.xmin=t.xmax,t.ymin=t.ymax),t.zmin=void 0,t.zmax=void 0,t.equals(this._clippingArea)||(this._clippingArea=t),this._clippingArea):(l.getLogger(this).error(`#clippingArea`,`only clippingArea geometries of type Extent are supported`),this._clippingArea)}set clippingArea(e){this.ready&&this.viewingMode===`global`&&e!=null?l.getLogger(this).error(`#clippingArea=`,`Clipping area is only supported in local viewingMode`):this._userClippingArea=e}get renderDataExtent(){if(this.state.isGlobal)return null;let e=this.renderSpatialReference,t=this.dataExtent;return t==null||e==null||t.spatialReference.equals(e)?t:X(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent,t=this.spatialReference||T.WGS84,n=X(this.clippingArea,t);n!=null&&(e=e==null?n:e.intersection(n));let r=this._get(`dataExtent`);return e!=null&&e.equals(r)?r:e}get _groundAndLayersExtent(){let e=this.spatialReference||T.WGS84,t,n=n=>{let r=X(n,e);r!=null&&(t==null?t=r.clone():t.union(r))},{groundView:r}=this,i=r?.spatialReference,a=r?.fullGroundExtent;i&&a&&n(new S({xmin:a[0],ymin:a[1],zmin:0,xmax:a[2],ymax:a[3],zmax:0,spatialReference:i}));let o=e=>{e.fullExtent==null||e.type===`graphics`&&e.internal||n(e.fullExtent)};if(this.map?.allLayers.forEach(e=>o(e)),t==null)return null;t.hasZ?(t.zmin=Math.min(0,t.zmin??0),t.zmax=Math.max(0,t.zmax??0)):(t.zmin=0,t.zmax=0);let s=this._get(`_groundAndLayersExtent`);return t.equals(s)?s:t}get environment(){return this._environment}set environment(e){if(this._environment===e)return;let{_environment:t}=this;this._environment=null,t?.destroy(),this._environment=e,this.notifyChange(`environment`)}castEnvironment(e){return e?e instanceof I?e:e instanceof Mt?this.environment?.cloneWithWebsceneEnvironment(e)??I.fromWebsceneEnvironment(e):b(I,e):new I}get extent(){return this.stateManager?.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){return this.stateManager?.screenCenter}get frustum(){return this.stateManager?.frustum}get layerviewCollections(){return[this.basemapView?.baseLayerViews,this.basemapView?.groundLayerViews,this.groundView?.layerViews,this.layerViews,this.basemapView?.referenceLayerViews]}get _layerToLayerviewMapping(){return q._layerToLayerview}static{this._layerToLayerview=j._layerToLayerview.concat([[`view.map.ground.layers`,`view.groundView.layerViews`]])}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||(this.toolViewManager?.interacting??!1)}get stationary(){return!this.animation&&!this.resizing&&(this.state?.stationary??!0)}get navigating(){return this.state?.navigating??!1}get scene(){return this.map&&Ne in this.map?this.map:null}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get featureTiles(){return this._featureTiles}set qualityProfile(e){let t=z(e);t&&this._get(`qualityProfile`)!==e&&(this.qualitySettings=new B(t),this.stage?.renderView.updateQualitySettings(this.qualitySettings),this._set(`qualityProfile`,e))}get qualityProfile(){return this._get(`qualityProfile`)||ot()}_updateSlice(){this.stage!=null&&(this.stage.renderer.slice=this.slice)}get typeSpecificPreconditionsReady(){return this.viewingMode?!!this.stateManager?.preinit(this.spatialReference):!1}get resolution(){let{scale:e,spatialReference:t}=this;return t?me(()=>Ee(e,t)):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get terrainLevel(){let e=this.basemapTerrain?.tilingScheme,t=this.scale;if(!e||!t)return null;let n=e.levelAtScale(t)+this.qualitySettings.tiledSurface.lodBias,r=e.getMaxLod();return n<=0?null:Math.max(0,Math.min(n,r||1/0))}get heightModelInfo(){let e=this.getDefaultHeightModelInfo();if(!e)return null;let t=ue(this.spatialReference);if(t&&e.heightUnit!==t)return new ye({heightModel:e.heightModel,heightUnit:t,vertCRS:e.vertCRS,associatedSpatialReference:e.associatedSpatialReference});if(!e.associatedSpatialReference){let t=e.clone();return t.associatedSpatialReference=this.spatialReference,t}return e}get alphaCompositingEnabled(){return this._get(`alphaCompositingEnabled`)}set alphaCompositingEnabled(e){this._stage&&l.getLogger(this).warn(`alphaCompositingEnabled cannot be changed after the view has become ready`),this._set(`alphaCompositingEnabled`,e)}get updating(){if(this.destroying||this.destroyed)return!1;if(!this.initialized)return!0;let e=0,t=this.layerViewManager.updating,n=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach(r=>{if(!r.isFulfilled())++n;else if(r.updating){if(t=!0,r.suspended||ft(r))return;++n,e+=r.updatingProgress}});let r=.1;for(let t of this._updatingObjects)t?.updating&&(n+=r,e+=.5*r);for(let t of this._updatingObjectsWithProgress)t?.updating&&(++n,e+=t.updatingProgress);let i=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||n>0||this.updatingHandles.updating||!this.ready||!this.stationary||i||this._importControllers.size>0||this.inputManager?.updating||this.map?.allLayers?.some(e=>!e.isFulfilled())),t?(this._numUpdating=Math.max(n,this._numUpdating),e+=this._numUpdating-n):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=+!t,this._get(`updatingProgress`)!==e){let n=performance.now();if(e<1){let t=Math.min((n-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set(`updatingProgress`,e),this._lastUpdateTime=t&&e<1?n:0}return R.UPDATING&&console.log(`Updating:`,this._updatingObjectsToDebug.filter(e=>e!=null&&e.updating).map(({declaredClass:e})=>e)),t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this.groundView,this._resourceController,this.stage,this.featureTiles,this.pointsOfInterest,this.environmentView,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager,this.focusAreasView]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get _updatingObjectsToDebug(){return R.UPDATING?this._updatingObjects.concat(this._updatingObjectsWithProgress).concat(this.allLayerViews.toArray()):[]}get viewingMode(){let e=this._predeterminedViewingMode;if(e!=null)return M(e);let t=this.spatialReference;return t?this.defaultsFromMap?.viewingMode!=null&&t.equals(this.defaultsFromMap.spatialReference)?M(this.defaultsFromMap.viewingMode):Dt(t,1)?`global`:`local`:`global`}set viewingMode(e){this.ready?l.getLogger(this).error(`#viewingMode`,`viewingMode cannot be set once view is ready`):this._overrideIfSome(`viewingMode`,e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get visibleArea(){return this.stateManager?.visibleArea}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get resourceController(){return this._resourceController}get quality(){return this._resourceController?.memoryController?.memoryFactor??1}get resolutionScale(){return Math.sqrt(Math.min(1,this.quality/.75))}get performanceInfo(){return new lt(this)}on(e,t,n,r){return this.viewEvents.on(e,t,n,r)||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return l.getLogger(this).error(`#toMap()`,`Scene view cannot be used before it is ready`),null;let n=K(e)?Et(this,e):e;return rt(this,n,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return l.getLogger(this).error(`#toScreen()`,`Scene view cannot be used before it is ready`),null;let t=e;return e.z??(t=It,t.x=e.x,t.y=e.y,t.z=tt(this.elevationProvider,e)??0,t.spatialReference=e.spatialReference),E(t,Z,this.renderSpatialReference),this.state.camera.projectToScreen(Z,Q),se(Q[0],Q[1])}pixelSizeAt(e,t){if(!this.ready)return l.getLogger(this).error(`#pixelSizeAt()`,`Scene view cannot be used before it is ready`),null;if(!e)return 0;let n=this.renderSpatialReference;E(e,Z,n);let r=this.state.camera.computeScreenPixelSizeAt(Z);return t&&n!==t?r*de(n)/de(t):r}overlayPixelSizeInMapUnits(e){return this.overlayManager?.overlayPixelSizeInMapUnits(e,()=>this.pixelSizeAt(e))??1}hitTest(e,t){if(!this.ready)return l.getLogger(this).error(`#hitTest()`,`Scene view cannot be used before it is ready`),null;let n=K(e)?Et(this,e):e;return it(this,n,t,this._defaultHitTestOptions)}async popupHitTest(e){return at(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async zoomIn(){if(this.canZoomIn)return this.navigation.zoom(!0)}async zoomOut(){if(this.canZoomOut)return this.navigation.zoom(!1)}async whenAnalysisView(e){if(e.parent==null)throw new a(`view:no-analysisview-for-analysis`,`The analysis does not exist in view.analyses`,{analysis:e});switch(e.parent.type){case`line-of-sight`:case`dimension`:case`viewshed`:return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){let t=await this._completeSettings(e);await this.whenReady();let n=(await this.stage.renderView.takeScreenshot(t))[0];return(await import(`./support/screenshotUtils.js`)).encode(n,t,this._pixelFormat())}async _takeScreenshot(e){let t=await this._completeSettings(e);await this.whenReady();let n=(await this.stage.renderView.takeScreenshot(t))[0];return(await import(`./support/screenshotUtils.js`)).encodeData(n,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){let t=await this._completeSettings(e);t.olidColor=!0,await this.whenReady();let n=await this.stage.renderView.takeScreenshot(t),{encodeData:r}=await import(`./support/screenshotUtils.js`);return[r(n[0],this._pixelFormat()),r(n[1],this._pixelFormat())]}async _completeSettings(e){let{toRenderSettings:t,screenshotSuperSampleSettings:n}=await import(`./support/screenshotUtils.js`),r=t(e,this);return r.pixelRatio/=this.state.pixelRatio,n(r,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this.stage?.renderView.getAlpha()??!1}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!yt())throw new a(`360vr:objectAndLayerId-rendering-disabled`,`has enable-feature:objectAndLayerId-rendering must be true`);let{encode:t}=await import(`./support/screenshotUtils.js`),n=await this._completeSettings(e);n.olidColor=!0,await this.whenReady();let r=await this.stage.renderView.takeScreenshot(n),i=t(r[0],n,this._pixelFormat()),o=await this._completeSettings(e);return o.format=`png`,[i,t(r[1],o,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){let e=this.stage.renderView.olidRenderHelper;if(e)return e.getColorToObjectAndLayerIdMapping();throw new a(`360vr:objectAndLayerId-rendering-disabled`,`has enable-feature:objectAndLayerId-rendering must be true`)}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}getAttributionItems(){return super.getAttributionItems().concat(this.attribution3D.attributionItems)}importLayerView(e){return P.importLayerView(e)}hasLayerViewModule(e){return P.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getWebDocumentSpatialReference(){return this.scene?.initialViewProperties?.spatialReference}getDefaultTimeZone(){return this.scene?.initialViewProperties?.timeZone??null}getSurface(){return this.surface}get _predeterminedViewingMode(){let e=this._isOverridden(`viewingMode`)?this._get(`viewingMode`):this.scene?.initialViewProperties?.viewingMode;return e==null?null:N(e)}getSpatialReferenceSupport(e,t){let n=this._predeterminedViewingMode,r=r=>this._validateSpatialReferenceForViewingMode(e,t,r)?this._makeSpatialReferenceConstraints(e,t,r,n):null,i=n?r(n):[...r(1)??[],...r(2)??[]];return i?.length?{constraints:i}:null}_validateSpatialReferenceForViewingMode(e,t,n){return Dt(e,n)?t==null||D(t)?!0:!(O(t)&&pt(t,e,n)==null||k(t)&&n===1):!1}_makeSpatialReferenceConstraints(e,t,n,r){if(t==null)return[{spatialReference:e,viewingMode:n}];let{isWebMercator:i,isWGS84:a,vcsWkid:o,latestVcsWkid:s}=e,c=()=>o==null?i?T.WGS84:T.WebMercator:new T({...i?De:Oe,vcsWkid:o,latestVcsWkid:s});return D(t)&&(i||a)?!(a&&r!==2)||mt(t.tileInfo,t.fullExtent,e,1)===null?[{spatialReference:e,viewingMode:n},{spatialReference:c(),viewingMode:n}]:[{spatialReference:c(),viewingMode:n}]:!O(t)&&!k(t)&&(i||a)?[{spatialReference:e,viewingMode:n},{spatialReference:c(),viewingMode:n}]:O(t)&&i&&n!==1?[{spatialReference:e,viewingMode:n},{spatialReference:c(),viewingMode:2}]:[{spatialReference:e,viewingMode:n}]}_validateSpatialReference(e){let t=this.getSpatialReferenceSupport(e)!=null,n=this._predeterminedViewingMode;return t||(n==null?e.isGeographic&&l.getLogger(this).warnOnce(`Spatial reference is geographic but not supported.`):l.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${M(n)} viewing mode.`)),t}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}trackGraphicState(e){if(!e.graphic)return l.getLogger(this).error(`trackGraphicState`,`GraphicState.graphic must not be null or undefined to start tracking`),null;let t=this.getViewForGraphic(e.graphic),n=null,r=!1,i=t=>{!r&&t!=null&&`processor`in t&&t.processor?.type===`graphics-3d`&&t.processor.graphicsCore&&(n=t.processor.graphicsCore.trackGraphicState(e))};return t==null?this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then(e=>i(e),()=>{}).catch(()=>{}):i(t),c(()=>{r=!0,n!=null&&(n.remove(),n=null)})}maskOccludee(e){if(!e)return l.getLogger(this).error(`maskOccludee`,`GraphicState.graphic must not be null or undefined to mask an occludee`),null;let t=this.getViewForGraphic(e),n=null,r=!1,i=t=>{!r&&t!=null&&Tt(t)&&(n=t.maskOccludee(e))};return t==null?this.whenViewForGraphic(e,{waitForLayer:!0}).then(e=>i(e),()=>{}).catch(()=>{}):i(t),c(()=>{r=!0,n!=null&&(n.remove(),n=null)})}getViewForGraphic(e){return e.layer===this?this.graphicsView:e.layer?this.allLayerViews.filter(e=>e.type!==`media-3d`).find(t=>t.layer===e.layer):null}graphicChanged(e){this.graphicsView!=null&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){return e.layer===this?(await g(()=>this.graphicsView),this.graphicsView):!e.layer||!this.map?null:!t||!t.waitForLayer||this.map.allLayers.includes(e.layer)?this.whenLayerView(e.layer):new Promise((t,n)=>{let r=this.map.allLayers.on(`change`,i=>{i.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,n))})})}enableFeatureTiles(){let e=Symbol();return this._featureTileTreeClients.add(e),c(()=>this._featureTileTreeClients.delete(e))}async _importModule(e,t){let n=new AbortController;this._importControllers.set(e,n),this._updatingChanged();try{let r=await Lt[e]();if(t&&(te(this),ne(n.signal),await t(n.signal)),this.destroyed)throw re();return ne(n.signal),r}catch{return null}finally{this._importControllers.delete(e),this._updatingChanged()}}_abortImport(e){this._importControllers.get(e)?.abort(),this._importControllers.delete(e),this._updatingChanged()}_initBasemapTerrain(){this._set(`basemapTerrain`,new H({view:this})),this.elevationProvider.register(0,this.basemapTerrain)}_exitBasemapTerrain(){let{basemapTerrain:e,elevationProvider:t}=this;e&&(this._set(`basemapTerrain`,null),t.unregister(e),e.destroy())}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set(`pointsOfInterest`,new V({view:this})),this.addHandles([this.updatingHandles.add(()=>R.FEATURE_TILE_TREE_SHOW_TILES,e=>{e&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import(`./3d/layers/support/FeatureTileTree3DDebugger.js`)).then(({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&R.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))}):e||(this._featureTreeDebugger=u(this._featureTreeDebugger))},_),this.updatingHandles.add(()=>({basemapExtent:this.groundView?.groundExtent,basemapSpatialReference:this.groundView?.spatialReference,clippingArea:this.clippingArea,featureTiles:this._featureTiles}),({basemapExtent:e,basemapSpatialReference:t,clippingArea:n,featureTiles:r})=>{if(!r)return;let i=!!e;if(!n&&!i)r.filterExtent=null;else if(!i||!t)r.filterExtent=n;else{let i=e&&t?w(Ce(e,t),this.spatialReference):null;r.filterExtent=n?n.intersection(i):i}},_),this.updatingHandles.add(()=>this._featureTileTreeClients.size>0,e=>{e?this.updatingHandles.consumePromise(this._ensureFeatureTileTree()):this._featureTiles=u(this._featureTiles)},h)],Pt),this.stateManager.init()}async _ensureFeatureTileTree(){if(this._featureTiles||this._importControllers.has(`FeatureTileTree3D`))return;let e=(await this.updatingHandles.addPromise(this._importModule(`FeatureTileTree3D`)))?.FeatureTileTree3D;e&&(this._featureTiles=new e({renderCoordsHelper:this.renderCoordsHelper,pointsOfInterest:this.pointsOfInterest,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}),this._updatingChanged())}_exitTerrain(){this.stateManager.exit(),this.removeHandles(J),this.removeHandles(Pt),this._featureTiles=u(this.featureTiles),this._set(`pointsOfInterest`,u(this.pointsOfInterest)),this._exitBasemapTerrain(),this.state.reset(),this._exitCoordinateSystem()}_initCoordinateSystem(){if(this.spatialReference){let e=this.spatialReference,t=this.state.isGlobal,n=Te(t,e);n!==this.renderSpatialReference&&(this.renderCoordsHelper.viewingMode=this.state.viewingMode,this.renderCoordsHelper.spatialReference=n,t||this.addHandles(p(()=>this.groundView?.groundExtent,e=>{let t=this.renderCoordsHelper.spatialReference;e!=null&&(e[0]!==0||e[1]!==0||e[2]!==0||e[3]!==0)&&Se(e,this.groundView.spatialReference,$,t)&&(this.renderCoordsHelper.extent=$)},h),J),this.sceneIntersectionHelper?.setTolerance(U/this.renderCoordsHelper.unitInMeters))}}_exitCoordinateSystem(){this.removeHandles(J)}_updatingChanged(){this.notifyChange(`updating`)}_updateUpdatingMonitors(e=null){(e==null||e.type!==4)&&(this.removeHandles(`updatingMonitors`),this.allLayerViews.forEach(e=>{e.destroyed||(this.addHandles(p(()=>[e.updating,e.updatingProgress],()=>this._updatingChanged(),h),`updatingMonitors`),e.when(()=>this._updatingChanged(),()=>this._updatingChanged()))}),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t,n){if(!this.overlay||!this.overlay.hasVisibleItems)return n;let r=e.getContext(`2d`,{willReadFrequently:!0});return r.putImageData(n,0,0),this.overlay.renderCanvas(e,{disableDecorations:t}),r.getImageData(0,0,n.width,n.height)}_initStage(e){let t={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,context:e,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t,n)=>this._renderScreenshotOverlay(e,t,n)}},n=new Ze(this.state.viewingMode,e=>this.stage.layers.forEach(e),this);this._set(`sceneIntersectionHelper`,n);let r=i(this.surface);this._stage=new vt({view:this,options:t,container:r}),this.notifyChange(`stage`),this._updateSlice(),this.addHandles([this.on(`pointer-move`,()=>this.stage?.renderer.resetAnimation()),o(this.stage.renderView.canvas,`webglcontextlost`,e=>{this.fatalError=new a(`webgl-context-lost`,e.statusMessage||`WebGL context lost`)})],`stage`),this.sceneIntersectionHelper.setTolerance(U/this.renderCoordsHelper.unitInMeters),this._set(`canvas`,this.stage.renderView.canvas)}_exitStage(){this.sceneIntersectionHelper?.destroy(),this._set(`sceneIntersectionHelper`,null),this._stage=u(this.stage),this._set(`stage`,null),this.removeHandles(`stage`),this._set(`canvas`,null)}_initSurface(){this._exitSurface();let e=_t(this.renderCanvas,{alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled});this._initStage(e),this._initGlobe(),this.sharedSymbolResources=new ut({view:this,resourceController:this._resourceController})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitTerrain(),this._exitStage())}async _ensureGraphicsView(){if(this.graphicsView||this._importControllers.has(`GraphicsView3D`)||this.graphics.length===0)return;this.removeHandles(`GraphicsView3D`);let e=(await this.updatingHandles.addPromise(this._importModule(`GraphicsView3D`,e=>g(()=>this.groundView?.ready,e))))?.default;e&&this._set(`graphicsView`,new e({view:this,getGraphics:()=>this.graphics})),this._updatingChanged()}_disposeGraphicsView(){this._abortImport(`GraphicsView3D`),this.removeHandles(`GraphicsView3D`),this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set(`graphicsView`,null))}_disposeFocusAreasView(){this._abortImport(`FocusAreasView`),this.removeHandles(`FocusAreasView`),this.focusAreasView=u(this.focusAreasView)}async _ensureFocusAreasView(e){if(this.focusAreasView||this._importControllers.has(`FocusAreasView`)||e===0)return;this.removeHandles(`FocusAreasView`);let t=(await this.updatingHandles.addPromise(this._importModule(`FocusAreasView`)))?.FocusAreasView;t&&(this.focusAreasView=new t({view:this})),this._updatingChanged()}_startup(){N(this.viewingMode)===1&&(this._clippingArea=null),this._initSurface(),this._set(`ready`,!0),this.addHandles(f(()=>this.graphics,`after-changes`,()=>this._ensureGraphicsView()),`GraphicsView3D`),this._ensureGraphicsView(),this.addHandles(this.updatingHandles.add(()=>this.map?.focusAreas?.areas.length??0,e=>this._ensureFocusAreasView(e),{initial:!0}),`FocusAreasView`);let e=this.scene?.initialViewProperties??null,t=e?.environment;t&&(this._overrideDefaultEnvironmentOnly?pe(this.environment,t):this.environment=this.environment.cloneWithWebsceneEnvironment(t)),this.timeExtent=e?.timeExtent,e?.analyses.applyTo(this),this.labeler.setup(),this.environmentView.connectView(this),this.inputManager.connect();let n=this._resolveWhenReady;this._resolveWhenReady=[],n.forEach(e=>e(this))}_teardown(){this.inputManager.disconnect(),this.environmentView.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this._exitSurface(),this._set(`ready`,!1)}get _defaultToMapOptions(){let e={include:new Set};if(!this.map)return e;this.map.ground&&e.include.add(W);for(let t of this.allLayerViews)(A(t.layer)&&(!has(`enable-feature:im-as-ground`)||t.layer.isUsedAsGroundLayer)||Ae(t.layer))&&e.include.add(t.uid);return e}get _defaultHitTestOptions(){let e={exclude:new Set};if(!this.map)return e;this.map.ground&&this.map.ground.opacity<1&&e.exclude.add(W);for(let t of this.allLayerViews)(has(`enable-feature:im-as-ground`)?A(t.layer)&&t.layer.isUsedAsGroundLayer:A(t.layer))&&t.fullOpacity<1&&e.exclude.add(t.uid);return e}static{this.type=`3d`}static clearStatics(){Nt(),he(),le(),St(),Ye(),Be(),xe(),wt(),Me(),gt(),xt(),Xe(),Qe(),_e(),oe(),bt(),ht(),Ge.cleanupI3SLodHandling(),je.cleanupTilemapCache(),L.cleanupViewstate(),H.cleanupTerrainSurface()}};e([v({nonNullable:!0}),y(Ft)],Y.prototype,`options`,void 0),e([v()],Y.prototype,`_userClippingArea`,void 0),e([v()],Y.prototype,`_resourceController`,void 0),e([v()],Y.prototype,`stage`,null),e([v({readOnly:!0})],Y.prototype,`deconflictor`,void 0),e([v({readOnly:!0})],Y.prototype,`labeler`,void 0),e([v()],Y.prototype,`navigation`,void 0),e([v({type:Le,readOnly:!0})],Y.prototype,`animation`,null),e([v({readOnly:!0})],Y.prototype,`basemapTerrain`,void 0),e([v({readOnly:!0})],Y.prototype,`overlayManager`,null),e([v({readOnly:!0})],Y.prototype,`elevationProvider`,void 0),e([v()],Y.prototype,`camera`,null),e([v({type:t})],Y.prototype,`contentCamera`,null),e([v({readOnly:!0})],Y.prototype,`canvas`,null),e([v({type:C,useTypeForAutocast:!1})],Y.prototype,`center`,null),e([v({type:S})],Y.prototype,`clippingArea`,null),e([v({type:F,nonNullable:!0})],Y.prototype,`constraints`,void 0),e([v({type:S,readOnly:!0})],Y.prototype,`renderDataExtent`,null),e([v({readOnly:!0})],Y.prototype,`tileInfo`,null),e([v({type:S,readOnly:!0})],Y.prototype,`dataExtent`,null),e([v({type:S,readOnly:!0})],Y.prototype,`_groundAndLayersExtent`,null),e([v({type:I})],Y.prototype,`environment`,null),e([y(`environment`)],Y.prototype,`castEnvironment`,null),e([v({readOnly:!0})],Y.prototype,`environmentView`,void 0),e([v({type:S})],Y.prototype,`extent`,null),e([v({type:r})],Y.prototype,`floors`,void 0),e([v()],Y.prototype,`screenCenter`,null),e([v()],Y.prototype,`frustum`,null),e([v({type:Number,readOnly:!0})],Y.prototype,`fullOpacity`,void 0),e([v({readOnly:!0})],Y.prototype,`graphicsView`,void 0),e([v()],Y.prototype,`analysisViewManager`,void 0),e([v()],Y.prototype,`groundView`,void 0),e([v({readOnly:!0})],Y.prototype,`layerviewCollections`,null),e([v({type:Boolean})],Y.prototype,`initialExtentRequired`,null),e([v()],Y.prototype,`defaultsFromMapSettings`,null),e([v()],Y.prototype,`interacting`,null),e([v()],Y.prototype,`stationary`,null),e([v()],Y.prototype,`navigating`,null),e([v()],Y.prototype,`map`,void 0),e([v()],Y.prototype,`padding`,null),e([v({type:V,readOnly:!0})],Y.prototype,`pointsOfInterest`,void 0),e([v()],Y.prototype,`_featureTiles`,void 0),e([v()],Y.prototype,`featureTiles`,null),e([v()],Y.prototype,`_featureTreeDebugger`,void 0),e([v({constructOnly:!0})],Y.prototype,`deactivatedWebGLExtensions`,void 0),e([v({constructOnly:!0})],Y.prototype,`debugWebGLExtensions`,void 0),e([v({constructOnly:!0})],Y.prototype,`renderCanvas`,void 0),e([v({constructOnly:!0})],Y.prototype,`state`,void 0),e([v()],Y.prototype,`screenSizePerspective`,void 0),e([v({readOnly:!0})],Y.prototype,`inputManager`,void 0),e([v({readOnly:!0})],Y.prototype,`stateManager`,void 0),e([v({type:[`low`,`medium`,`high`]})],Y.prototype,`qualityProfile`,null),e([v({type:B,get(){let e=this._get(`qualitySettings`);if(!e){let t=z(this.qualityProfile);e=new B(t)}return e}})],Y.prototype,`qualitySettings`,void 0),e([v()],Y.prototype,`slice`,void 0),e([v({readOnly:!0})],Y.prototype,`typeSpecificPreconditionsReady`,null),e([v({readOnly:!0})],Y.prototype,`sceneIntersectionHelper`,void 0),e([v({type:Number,readOnly:!0})],Y.prototype,`resolution`,null),e([v({type:Number})],Y.prototype,`scale`,null),e([v({readOnly:!0,type:Number})],Y.prototype,`terrainLevel`,null),e([v()],Y.prototype,`heightModelInfo`,null),e([v({type:T})],Y.prototype,`spatialReference`,void 0),e([v({type:Boolean,value:!1})],Y.prototype,`alphaCompositingEnabled`,null),e([v({constructOnly:!0})],Y.prototype,`preserveDrawingBufferEnabled`,void 0),e([v({type:Boolean})],Y.prototype,`supersampleScreenshotsEnabled`,void 0),e([v({readOnly:!0})],Y.prototype,`type`,void 0),e([v(),y(e=>e instanceof At?e:x(jt,e))],Y.prototype,`ui`,void 0),e([v({type:Boolean,readOnly:!0})],Y.prototype,`updating`,null),e([v()],Y.prototype,`_updatingObjects`,null),e([v()],Y.prototype,`_updatingObjectsWithProgress`,null),e([v()],Y.prototype,`_updatingObjectsToDebug`,null),e([v({type:Number,readOnly:!0})],Y.prototype,`updatingProgress`,void 0),e([v({type:[`global`,`local`]})],Y.prototype,`viewingMode`,null),e([v({type:n})],Y.prototype,`viewpoint`,null),e([v({readOnly:!0})],Y.prototype,`visibleArea`,null),e([v({type:Number})],Y.prototype,`zoom`,null),e([v({readOnly:!0})],Y.prototype,`quality`,null),e([v({readOnly:!0})],Y.prototype,`resolutionScale`,null),e([v()],Y.prototype,`focusAreasView`,void 0),e([v()],Y.prototype,`_defaultToMapOptions`,null),e([v()],Y.prototype,`_defaultHitTestOptions`,null),Y=q=e([fe(`esri.views.SceneView`)],Y);function X(e,t){return e!=null&&be(e.spatialReference,t)?w(e,t):null}const Z=ge(),Q=ce(),$=we(),It=ke(0,0,0,T.WebMercator),Lt={GraphicsView3D:()=>import(`./3d/layers/GraphicsView3D.js`),FocusAreasView:()=>import(`./3d/FocusAreasView.js`),FeatureTileTree3D:()=>import(`./3d/layers/support/FeatureTileTree3D.js`)},Rt=Y;export{Rt as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../Camera.js";import n from"../Viewpoint.js";import r from"../core/Collection.js";import{byId as i}from"../core/domUtils.js";import a from"../core/Error.js";import{on as o}from"../core/events.js";import{destroyHandle as s,makeHandle as c}from"../core/handleUtils.js";import has from"../core/has.js";import l from"../core/Logger.js";import{mapCollectionAsync as ee}from"../core/mapCollectionUtils.js";import{destroyMaybe as u,maybeProperty as d}from"../core/maybe.js";import{throwIfDestroyed as te,throwIfAborted as ne,createAbortError as re}from"../core/promiseUtils.js";import ie from"../core/ReactiveSet.js";import{on as f,watch as p,initial as m,sync as h,whenOnce as g,syncAndInitial as _}from"../core/reactiveUtils.js";import{setFrameDuration as ae,cleanupScheduling as oe}from"../core/scheduling.js";import{createScreenPoint as se,createScreenPointArray as ce}from"../core/screenUtils.js";import{cleanupWhereClauseCache as le}from"../core/sql.js";import{getDefaultVerticalUnitStringForSR as ue,getMetersPerUnitForSR as de}from"../core/units.js";import{property as v,cast as y,subclass as fe}from"../core/accessorSupport/decorators.js";import{ensureType as b,ensureClass as x}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as pe}from"../core/accessorSupport/overrideDefaultsFrom.js";import{runUntracked as me}from"../core/accessorSupport/tracking.js";import{drainNotificationQueue as he}from"../core/accessorSupport/trackingUtils.js";import{create as ge}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{cleanupPooledRBush as _e}from"../core/libs/rbush/PooledRBush.js";import{initialize as ve}from"../core/workers/workers.js";import S from"../geometry/Extent.js";import ye from"../geometry/HeightModelInfo.js";import C from"../geometry/Point.js";import{project as w,canProjectWithoutEngine as be}from"../geometry/projectionUtils.js";import T from"../geometry/SpatialReference.js";import{cleanupSpatialReferenceEllipsoidUtils as xe}from"../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingRect as Se}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as E}from"../geometry/projection/projectPointToVector.js";import{toExtent as Ce,create as we}from"../geometry/support/aaBoundingRect.js";import{renderSRFromViewSR as Te}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as Ee}from"../geometry/support/scaleUtils.js";import{wgs84 as De,webMercator as Oe}from"../geometry/support/spatialReferenceUtils.js";import{makeDehydratedPoint as ke}from"../layers/graphics/dehydratedPoint.js";import{IntegratedMeshSemantics as D}from"../layers/support/IntegratedMeshSemantics.js";import{isImageryTileLayer as O,isTiledLayer as k,isVoxelLayer as A,isIntegratedMeshLayer as j,isGaussianSplatLayer as Ae}from"../layers/support/layerUtils.js";import{TilemapCache as je}from"../layers/support/TilemapCache.js";import{clearDefaultPortalInstance as Me}from"../portal/portalDefault.js";import{WebSceneTag as Ne}from"../support/tagSymbols.js";import{BreakpointsOwner as Pe}from"./BreakpointsOwner.js";import{DOMContainer as Fe}from"./DOMContainer.js";import{PopupView as Ie}from"./PopupView.js";import M from"./View.js";import Le from"./ViewAnimation.js";import{stringFromViewingMode as N,viewingModeFromString as P}from"./ViewingMode.js";import{GroundView3D as Re}from"./3d/GroundView3D.js";import{layerView3DImporter as F}from"./3d/layerViewModuleImportUtils.js";import{importAnalysisViewModule as ze}from"./3d/analysis/analysisViewModuleImportUtils.js";import{cleanupIntersectionUtils as Be}from"./3d/camera/intersectionUtils.js";import I from"./3d/constraints/Constraints.js";import L from"./3d/environment/Environment.js";import{EnvironmentView as Ve}from"./3d/environment/EnvironmentView.js";import He from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as Ue}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as We}from"./3d/layers/graphics/Labeler.js";import Ge from"./3d/layers/i3s/I3SLodHandling.js";import{Navigation3D as Ke}from"./3d/navigation/Navigation3D.js";import{ScreenSizePerspective as qe}from"./3d/state/ScreenSizePerspective.js";import R from"./3d/state/ViewState.js";import{ViewStateManager as Je,cleanupViewStateManager as Ye}from"./3d/state/ViewStateManager.js";import{cleanupPointToPointAnimationController as Xe}from"./3d/state/controllers/PointToPointAnimationController.js";import{SceneIntersectionHelper as Ze}from"./3d/state/helpers/SceneIntersectionHelper.js";import{cleanupNavigationUtils as Qe}from"./3d/state/utils/navigationUtils.js";import $e from"./3d/support/Attribution3D.js";import{CombinedElevationProvider as et}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as z}from"./3d/support/debugFlags.js";import{getElevationAtPoint as tt}from"./3d/support/ElevationProvider.js";import{GroundAndIMSurface as nt}from"./3d/support/GroundAndIMSurface.js";import{toMap as rt,hitTest as it}from"./3d/support/hitTest.js";import{popupHitTest as at}from"./3d/support/popupHitTest.js";import{getDefaultQualityProfileName as ot,getQualityProfileSettings as B}from"./3d/support/QualityProfile.js";import V from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as st}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as ct}from"./3d/support/ResourceController.js";import lt from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as ut}from"./3d/support/SharedSymbolResources.js";import{ViewSlice as dt}from"./3d/support/ViewSlice.js";import{PointsOfInterest as H}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import U from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as ft,getTiledLayerInfo as pt,checkIfTileInfoSupportedForView as mt}from"./3d/terrain/terrainUtils.js";import{clearTilePerLayerInfo as ht}from"./3d/terrain/TilePerLayerInfo.js";import{cleanupTileRenderer as gt}from"./3d/terrain/TileRenderer.js";import{createWebGLContext as _t}from"./3d/webgl-engine/createWebGLContext.js";import{Stage as vt}from"./3d/webgl-engine/Stage.js";import{olidEnabled as yt}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{cleanupRenderOccluded as bt}from"./3d/webgl-engine/effects/geometry/RenderOccluded.js";import{defaultTolerance as W}from"./3d/webgl-engine/lib/Intersector.js";import{cleanupShadowmap as xt}from"./3d/webgl-engine/lib/ShadowMap.js";import{terrainId as G}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{cleanupEdgeProcessing as St}from"./3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js";import K from"./interactive/options/ViewOptions.js";import Ct from"./support/AnalysisViewManager.js";import{cleanupDrapedUtils as wt}from"./support/drapedUtils.js";import{occludeesSupported as Tt}from"./support/layerViewUtils.js";import{isSupportedScreenPointEvent as Et,createScreenPointFromSupportedEvent as Dt}from"./support/screenUtils.js";import{isSpatialReferenceSupported as Ot}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as kt,destroyTextureCompressionWorker as At}from"./support/TextureCompressionHelper.js";import jt from"./ui/DefaultUI.js";import Mt from"./ui/3d/DefaultUI3D.js";import Nt from"../webscene/Environment.js";import{clearVNodeCache as Pt}from"../widgets/support/vnodeCache.js";var q;const Ft=Symbol(),J=Symbol();function It(e){let t=x(K,e);return t!==e&&e.snapping?.enabled==null&&(t.snapping.enabled=!0),t}let Y=class extends Pe(Ie(Fe(M))){static{q=this}get timeZone(){return super.timeZone}set timeZone(e){super.timeZone=e}constructor(e){super(e),this.options=new K({snapping:{enabled:!0}}),this._userClippingArea=null,this._clippingArea=null,this._overrideDefaultEnvironmentOnly=!0,this._resolveWhenReady=[],this._resourceController=ct(this),this.deconflictor=new Ue({view:this}),this.attribution3D=new $e({view:this}),this.labeler=new We({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.navigation=new Ke({view:this}),this.basemapTerrain=null,this.elevationProvider=new et({view:this}),this._canvas=null,this.constraints=new I,this._environment=new L,this.environmentView=new Ve,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new Ct({importAnalysisViewModule:e=>ze(e),view:this}),this.groundView=null,this.groundAndIMSurface=null,this.map=null,this._featureTileTreeClients=new ie,this._featureTiles=null,this._featureTreeDebugger=null,this.state=new R({view:this}),this.slice=new dt,this.renderCoordsHelper=new st,this.spatialReference=null,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type=`3d`,this.ui=new Mt,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this._importControllers=new Map,ve();let t=()=>this._updatingChanged();this.addHandles(s(ee(()=>this.map?.allLayers,async e=>{try{await e.when()}catch{}finally{t()}}))),this.addHandles([f(()=>this.map?.allLayers,`after-changes`,t,{onListenerAdd:t,onListenerRemove:t,sync:!0}),this.allLayerViews.on(`after-changes`,e=>this._updateUpdatingMonitors(e)),p(()=>this.scene,e=>e?.load().catch(()=>{}))]),this.inputManager=new He({view:this}),this.stateManager=new Je({view:this}),this.screenSizePerspective=new qe({view:this})}initialize(){if(has(`enable-feature:esri-compress-textures`)&&has(`wasm-simd`)){let e=kt(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new Re({view:this}),this.groundAndIMSurface=new nt({view:this}),this._updateUpdatingMonitors(),this.updatingHandles.add(()=>this.qualitySettings.memoryLimit,e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)},m),this.updatingHandles.add(()=>this.qualitySettings.additionalCacheMemory,e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)},m),this.updatingHandles.add(()=>this.qualitySettings.frameRate??0,e=>ae(e>0?1e3/Math.ceil(e):0),m),this.addHandles([p(()=>this.spatialReference,()=>this.notifyChange(`clippingArea`),h),p(()=>({plane:this.slice.plane,isDecoration:this.slice.isDecoration}),()=>this._updateSlice(),h)])}destroy(){this.destroyed||(At(this),this.updatingHandles.removeAll(),this.basemapTerrain?.clearHandles(),this.elevationProvider.destroy(),this.ui.removeAllHandles(),this.layerViewManager.clearHandles(),this.invalidate(),this.layerViewManager.clear(),this._set(`analysisViewManager`,u(this.analysisViewManager)),this._exitSurface(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this.sharedSymbolResources=u(this.sharedSymbolResources),this._set(`labeler`,u(this.labeler)),this._set(`deconflictor`,u(this.deconflictor)),this._resourceController=u(this._resourceController),this._set(`stateManager`,u(this.stateManager)),this._set(`inputManager`,u(this.inputManager)),this.state.destroy(),this.highlights.destroy(),this.removeHandles(`updatingMonitors`),this._set(`environmentView`,u(this.environmentView)),this._set(`environment`,u(this.environment)),this.groundView=u(this.groundView),this.groundAndIMSurface.destroy(),this.slice.destroy(),this._updatingObjectsWithProgress.length=0,this._updatingObjects.length=0,this.ui?.destroy(),this._set(`ui`,null),this._set(`renderCanvas`,null),this._set(`canvas`,null),this._canvas=null,this.screenSizePerspective.destroy(),this.attribution3D.destroy())}get stage(){return this._stage}get renderSpatialReference(){return this.renderCoordsHelper.spatialReference}get groundSpatialReference(){return this.groundView?.spatialReference}get analyses(){return super.analyses}set analyses(e){super.analyses=e}get animation(){return this.state?.animation}get overlayManager(){return this.basemapTerrain?.overlayManager}get camera(){return this.stateManager?.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){return this.stateManager?.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get canvas(){return this._canvas}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=b(C,e))}get clippingArea(){if(this.viewingMode===`global`)return null;let e=this.map,t=this._userClippingArea||d(e,`clippingArea`);return!(this._userClippingArea||d(e,`clippingEnabled`))||t==null?(this._clippingArea=null,null):t instanceof S?this.spatialReference&&(t=X(t,this.spatialReference),t==null)?(l.getLogger(this).error(`#clippingArea`,`setting clippingArea with incompatible SpatialReference`),this._clippingArea):(t=t.clone(),t.intersection(this._groundAndLayersExtent)??(t.xmin=t.xmax,t.ymin=t.ymax),t.zmin=void 0,t.zmax=void 0,t.equals(this._clippingArea)||(this._clippingArea=t),this._clippingArea):(l.getLogger(this).error(`#clippingArea`,`only clippingArea geometries of type Extent are supported`),this._clippingArea)}set clippingArea(e){this.ready&&this.viewingMode===`global`&&e!=null?l.getLogger(this).error(`#clippingArea=`,`Clipping area is only supported in local viewingMode`):this._userClippingArea=e}get renderDataExtent(){if(this.state.isGlobal)return null;let e=this.renderSpatialReference,t=this.dataExtent;return t==null||e==null||t.spatialReference.equals(e)?t:X(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent,t=this.spatialReference||T.WGS84,n=X(this.clippingArea,t);n!=null&&(e=e==null?n:e.intersection(n));let r=this._get(`dataExtent`);return e!=null&&e.equals(r)?r:e}get _groundAndLayersExtent(){let e=this.spatialReference||T.WGS84,t,n=n=>{let r=X(n,e);r!=null&&(t==null?t=r.clone():t.union(r))},{groundView:r}=this,i=r?.spatialReference,a=r?.fullGroundExtent;i&&a&&n(new S({xmin:a[0],ymin:a[1],zmin:0,xmax:a[2],ymax:a[3],zmax:0,spatialReference:i}));let o=e=>{e.fullExtent==null||e.type===`graphics`&&e.internal||n(e.fullExtent)};if(this.map?.allLayers.forEach(e=>o(e)),t==null)return null;t.hasZ?(t.zmin=Math.min(0,t.zmin??0),t.zmax=Math.max(0,t.zmax??0)):(t.zmin=0,t.zmax=0);let s=this._get(`_groundAndLayersExtent`);return t.equals(s)?s:t}get environment(){return this._environment}set environment(e){if(this._environment===e)return;let{_environment:t}=this;this._environment=null,t?.destroy(),this._environment=e,this.notifyChange(`environment`)}castEnvironment(e){return e?e instanceof L?e:e instanceof Nt?this.environment?.cloneWithWebsceneEnvironment(e)??L.fromWebsceneEnvironment(e):b(L,e):new L}get extent(){return this.stateManager?.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){return this.stateManager?.screenCenter}get frustum(){return this.stateManager?.frustum}get layerviewCollections(){return[this.basemapView?.baseLayerViews,this.basemapView?.groundLayerViews,this.groundView?.layerViews,this.layerViews,this.basemapView?.referenceLayerViews]}get _layerToLayerviewMapping(){return q._layerToLayerview}static{this._layerToLayerview=M._layerToLayerview.concat([[`view.map.ground.layers`,`view.groundView.layerViews`]])}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||(this.toolViewManager?.interacting??!1)}get stationary(){return!this.animation&&!this.resizing&&(this.state?.stationary??!0)}get navigating(){return this.state?.navigating??!1}get scene(){return this.map&&Ne in this.map?this.map:null}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get featureTiles(){return this._featureTiles}set qualityProfile(e){let t=B(e);t&&this._get(`qualityProfile`)!==e&&(this.qualitySettings=new V(t),this.stage?.renderView.updateQualitySettings(this.qualitySettings),this._set(`qualityProfile`,e))}get qualityProfile(){return this._get(`qualityProfile`)||ot()}_updateSlice(){this.stage!=null&&(this.stage.renderer.slice=this.slice)}get typeSpecificPreconditionsReady(){return this.viewingMode?!!this.stateManager?.preinit(this.spatialReference):!1}get resolution(){let{scale:e,spatialReference:t}=this;return t?me(()=>Ee(e,t)):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get terrainLevel(){let e=this.basemapTerrain?.tilingScheme,t=this.scale;if(!e||!t)return null;let n=e.levelAtScale(t)+this.qualitySettings.tiledSurface.lodBias,r=e.getMaxLod();return n<=0?null:Math.max(0,Math.min(n,r||1/0))}get heightModelInfo(){let e=this.getDefaultHeightModelInfo();if(!e)return null;let t=ue(this.spatialReference);if(t&&e.heightUnit!==t)return new ye({heightModel:e.heightModel,heightUnit:t,vertCRS:e.vertCRS,associatedSpatialReference:e.associatedSpatialReference});if(!e.associatedSpatialReference){let t=e.clone();return t.associatedSpatialReference=this.spatialReference,t}return e}get alphaCompositingEnabled(){return this._get(`alphaCompositingEnabled`)}set alphaCompositingEnabled(e){this._stage&&l.getLogger(this).warn(`alphaCompositingEnabled cannot be changed after the view has become ready`),this._set(`alphaCompositingEnabled`,e)}get updating(){if(this.destroying||this.destroyed)return!1;if(!this.initialized)return!0;let e=0,t=this.layerViewManager.updating,n=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach(r=>{if(!r.isFulfilled())++n;else if(r.updating){if(t=!0,r.suspended||ft(r))return;++n,e+=r.updatingProgress}});let r=.1;for(let t of this._updatingObjects)t?.updating&&(n+=r,e+=.5*r);for(let t of this._updatingObjectsWithProgress)t?.updating&&(++n,e+=t.updatingProgress);let i=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||n>0||this.updatingHandles.updating||!this.ready||!this.stationary||i||this._importControllers.size>0||this.inputManager?.updating||this.map?.allLayers?.some(e=>!e.isFulfilled())),t?(this._numUpdating=Math.max(n,this._numUpdating),e+=this._numUpdating-n):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=+!t,this._get(`updatingProgress`)!==e){let n=performance.now();if(e<1){let t=Math.min((n-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set(`updatingProgress`,e),this._lastUpdateTime=t&&e<1?n:0}return z.UPDATING&&console.log(`Updating:`,this._updatingObjectsToDebug.filter(e=>e!=null&&e.updating).map(({declaredClass:e})=>e)),t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this.groundView,this._resourceController,this.stage,this.featureTiles,this.pointsOfInterest,this.environmentView,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager,this.focusAreasView]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get _updatingObjectsToDebug(){return z.UPDATING?this._updatingObjects.concat(this._updatingObjectsWithProgress).concat(this.allLayerViews.toArray()):[]}get viewingMode(){let e=this._predeterminedViewingMode;if(e!=null)return N(e);let t=this.spatialReference;return t?this.defaultsFromMap?.viewingMode!=null&&t.equals(this.defaultsFromMap.spatialReference)?N(this.defaultsFromMap.viewingMode):Ot(t,1)?`global`:`local`:`global`}set viewingMode(e){this.ready?l.getLogger(this).error(`#viewingMode`,`viewingMode cannot be set once view is ready`):this._overrideIfSome(`viewingMode`,e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get visibleArea(){return this.stateManager?.visibleArea}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get resourceController(){return this._resourceController}get quality(){return this._resourceController?.memoryController?.memoryFactor??1}get resolutionScale(){return Math.sqrt(Math.min(1,this.quality/.75))}get performanceInfo(){return new lt(this)}on(e,t,n,r){return this.viewEvents.on(e,t,n,r)||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return l.getLogger(this).error(`#toMap()`,`Scene view cannot be used before it is ready`),null;let n=Et(e)?Dt(this,e):e;return rt(this,n,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return l.getLogger(this).error(`#toScreen()`,`Scene view cannot be used before it is ready`),null;let t=e;return e.z??(t=Lt,t.x=e.x,t.y=e.y,t.z=tt(this.elevationProvider,e)??0,t.spatialReference=e.spatialReference),E(t,Z,this.renderSpatialReference),this.state.camera.projectToScreen(Z,Q),se(Q[0],Q[1])}pixelSizeAt(e,t){if(!this.ready)return l.getLogger(this).error(`#pixelSizeAt()`,`Scene view cannot be used before it is ready`),null;if(!e)return 0;let n=this.renderSpatialReference;E(e,Z,n);let r=this.state.camera.computeScreenPixelSizeAt(Z);return t&&n!==t?r*de(n)/de(t):r}overlayPixelSizeInMapUnits(e){return this.overlayManager?.overlayPixelSizeInMapUnits(e,()=>this.pixelSizeAt(e))??1}hitTest(e,t){if(!this.ready)return l.getLogger(this).error(`#hitTest()`,`Scene view cannot be used before it is ready`),null;let n=Et(e)?Dt(this,e):e;return it(this,n,t,this._defaultHitTestOptions)}async popupHitTest(e){return at(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async zoomIn(){if(this.canZoomIn)return this.navigation.zoom(!0)}async zoomOut(){if(this.canZoomOut)return this.navigation.zoom(!1)}async whenAnalysisView(e){if(e.parent==null)throw new a(`view:no-analysisview-for-analysis`,`The analysis does not exist in view.analyses`,{analysis:e});switch(e.parent.type){case`line-of-sight`:case`dimension`:case`viewshed`:return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){let t=await this._completeSettings(e);await this.whenReady();let n=(await this.stage.renderView.takeScreenshot(t))[0];return(await import(`./support/screenshotUtils.js`)).encode(n,t,this._pixelFormat())}async _takeScreenshot(e){let t=await this._completeSettings(e);await this.whenReady();let n=(await this.stage.renderView.takeScreenshot(t))[0];return(await import(`./support/screenshotUtils.js`)).encodeData(n,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){let t=await this._completeSettings(e);t.olidColor=!0,await this.whenReady();let n=await this.stage.renderView.takeScreenshot(t),{encodeData:r}=await import(`./support/screenshotUtils.js`);return[r(n[0],this._pixelFormat()),r(n[1],this._pixelFormat())]}async _completeSettings(e){let{toRenderSettings:t,screenshotSuperSampleSettings:n}=await import(`./support/screenshotUtils.js`),r=t(e,this);return r.pixelRatio/=this.state.pixelRatio,n(r,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this.stage?.renderView.getAlpha()??!1}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!yt())throw new a(`360vr:objectAndLayerId-rendering-disabled`,`has enable-feature:objectAndLayerId-rendering must be true`);let{encode:t}=await import(`./support/screenshotUtils.js`),n=await this._completeSettings(e);n.olidColor=!0,await this.whenReady();let r=await this.stage.renderView.takeScreenshot(n),i=t(r[0],n,this._pixelFormat()),o=await this._completeSettings(e);return o.format=`png`,[i,t(r[1],o,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){let e=this.stage.renderView.olidRenderHelper;if(e)return e.getColorToObjectAndLayerIdMapping();throw new a(`360vr:objectAndLayerId-rendering-disabled`,`has enable-feature:objectAndLayerId-rendering must be true`)}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}getAttributionItems(){return super.getAttributionItems().concat(this.attribution3D.attributionItems)}importLayerView(e){return F.importLayerView(e)}hasLayerViewModule(e){return F.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getWebDocumentSpatialReference(){return this.scene?.initialViewProperties?.spatialReference}getDefaultTimeZone(){return this.scene?.initialViewProperties?.timeZone??null}getSurface(){return this.surface}get _predeterminedViewingMode(){let e=this._isOverridden(`viewingMode`)?this._get(`viewingMode`):this.scene?.initialViewProperties?.viewingMode;return e==null?null:P(e)}getSpatialReferenceSupport(e,t){let n=this._predeterminedViewingMode,r=r=>this._validateSpatialReferenceForViewingMode(e,t,r)?this._makeSpatialReferenceConstraints(e,t,r,n):null,i=n?r(n):[...r(1)??[],...r(2)??[]];return i?.length?{constraints:i}:null}_validateSpatialReferenceForViewingMode(e,t,n){return Ot(e,n)?t==null||O(t)?!0:!(k(t)&&pt(t,e,n)==null||A(t)&&n===1):!1}_makeSpatialReferenceConstraints(e,t,n,r){if(t==null)return[{spatialReference:e,viewingMode:n}];let{isWebMercator:i,isWGS84:a,vcsWkid:o,latestVcsWkid:s}=e,c=()=>o==null?i?T.WGS84:T.WebMercator:new T({...i?De:Oe,vcsWkid:o,latestVcsWkid:s});return O(t)&&(i||a)?!(a&&r!==2)||mt(t.tileInfo,t.fullExtent,e,1)===null?[{spatialReference:e,viewingMode:n},{spatialReference:c(),viewingMode:n}]:[{spatialReference:c(),viewingMode:n}]:!k(t)&&!A(t)&&(i||a)?[{spatialReference:e,viewingMode:n},{spatialReference:c(),viewingMode:n}]:k(t)&&i&&n!==1?[{spatialReference:e,viewingMode:n},{spatialReference:c(),viewingMode:2}]:[{spatialReference:e,viewingMode:n}]}_validateSpatialReference(e){let t=this.getSpatialReferenceSupport(e)!=null,n=this._predeterminedViewingMode;return t||(n==null?e.isGeographic&&l.getLogger(this).warnOnce(`Spatial reference is geographic but not supported.`):l.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${N(n)} viewing mode.`)),t}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}trackGraphicState(e){if(!e.graphic)return l.getLogger(this).error(`trackGraphicState`,`GraphicState.graphic must not be null or undefined to start tracking`),null;let t=this.getViewForGraphic(e.graphic),n=null,r=!1,i=t=>{!r&&t!=null&&`processor`in t&&t.processor?.type===`graphics-3d`&&t.processor.graphicsCore&&(n=t.processor.graphicsCore.trackGraphicState(e))};return t==null?this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then(e=>i(e),()=>{}).catch(()=>{}):i(t),c(()=>{r=!0,n!=null&&(n.remove(),n=null)})}maskOccludee(e){if(!e)return l.getLogger(this).error(`maskOccludee`,`GraphicState.graphic must not be null or undefined to mask an occludee`),null;let t=this.getViewForGraphic(e),n=null,r=!1,i=t=>{!r&&t!=null&&Tt(t)&&(n=t.maskOccludee(e))};return t==null?this.whenViewForGraphic(e,{waitForLayer:!0}).then(e=>i(e),()=>{}).catch(()=>{}):i(t),c(()=>{r=!0,n!=null&&(n.remove(),n=null)})}getViewForGraphic(e){return e.layer===this?this.graphicsView:e.layer?this.allLayerViews.filter(e=>e.type!==`media-3d`).find(t=>t.layer===e.layer):null}graphicChanged(e){this.graphicsView!=null&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){return e.layer===this?(await g(()=>this.graphicsView),this.graphicsView):!e.layer||!this.map?null:!t||!t.waitForLayer||this.map.allLayers.includes(e.layer)?this.whenLayerView(e.layer):new Promise((t,n)=>{let r=this.map.allLayers.on(`change`,i=>{i.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,n))})})}enableFeatureTiles(){let e=Symbol();return this._featureTileTreeClients.add(e),c(()=>this._featureTileTreeClients.delete(e))}async _importModule(e,t){let n=new AbortController;this._importControllers.set(e,n),this._updatingChanged();try{let r=await Rt[e]();if(t&&(te(this),ne(n.signal),await t(n.signal)),this.destroyed)throw re();return ne(n.signal),r}catch{return null}finally{this._importControllers.delete(e),this._updatingChanged()}}_abortImport(e){this._importControllers.get(e)?.abort(),this._importControllers.delete(e),this._updatingChanged()}_initBasemapTerrain(){this._set(`basemapTerrain`,new U({view:this})),this.elevationProvider.register(0,this.basemapTerrain)}_exitBasemapTerrain(){let{basemapTerrain:e,elevationProvider:t}=this;e&&(this._set(`basemapTerrain`,null),t.unregister(e),e.destroy())}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set(`pointsOfInterest`,new H({view:this})),this.addHandles([this.updatingHandles.add(()=>z.FEATURE_TILE_TREE_SHOW_TILES,e=>{e&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import(`./3d/layers/support/FeatureTileTree3DDebugger.js`)).then(({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&z.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))}):e||(this._featureTreeDebugger=u(this._featureTreeDebugger))},_),this.updatingHandles.add(()=>({basemapExtent:this.groundView?.groundExtent,basemapSpatialReference:this.groundView?.spatialReference,clippingArea:this.clippingArea,featureTiles:this._featureTiles}),({basemapExtent:e,basemapSpatialReference:t,clippingArea:n,featureTiles:r})=>{if(!r)return;let i=!!e;if(!n&&!i)r.filterExtent=null;else if(!i||!t)r.filterExtent=n;else{let i=e&&t?w(Ce(e,t),this.spatialReference):null;r.filterExtent=n?n.intersection(i):i}},_),this.updatingHandles.add(()=>this._featureTileTreeClients.size>0,e=>{e?this.updatingHandles.consumePromise(this._ensureFeatureTileTree()):this._featureTiles=u(this._featureTiles)},h)],Ft),this.stateManager.init()}async _ensureFeatureTileTree(){if(this._featureTiles||this._importControllers.has(`FeatureTileTree3D`))return;let e=(await this.updatingHandles.addPromise(this._importModule(`FeatureTileTree3D`)))?.FeatureTileTree3D;e&&(this._featureTiles=new e({renderCoordsHelper:this.renderCoordsHelper,pointsOfInterest:this.pointsOfInterest,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}),this._updatingChanged())}_exitTerrain(){this.stateManager.exit(),this.removeHandles(J),this.removeHandles(Ft),this._featureTiles=u(this.featureTiles),this._set(`pointsOfInterest`,u(this.pointsOfInterest)),this._exitBasemapTerrain(),this.state.reset(),this._exitCoordinateSystem()}_initCoordinateSystem(){if(this.spatialReference){let e=this.spatialReference,t=this.state.isGlobal,n=Te(t,e);n!==this.renderSpatialReference&&(this.renderCoordsHelper.viewingMode=this.state.viewingMode,this.renderCoordsHelper.spatialReference=n,t||this.addHandles(p(()=>this.groundView?.groundExtent,e=>{let t=this.renderCoordsHelper.spatialReference;e!=null&&(e[0]!==0||e[1]!==0||e[2]!==0||e[3]!==0)&&Se(e,this.groundView.spatialReference,$,t)&&(this.renderCoordsHelper.extent=$)},h),J),this.sceneIntersectionHelper?.setTolerance(W/this.renderCoordsHelper.unitInMeters))}}_exitCoordinateSystem(){this.removeHandles(J)}_updatingChanged(){this.notifyChange(`updating`)}_updateUpdatingMonitors(e=null){(e==null||e.type!==4)&&(this.removeHandles(`updatingMonitors`),this.allLayerViews.forEach(e=>{e.destroyed||(this.addHandles(p(()=>[e.updating,e.updatingProgress],()=>this._updatingChanged(),h),`updatingMonitors`),e.when(()=>this._updatingChanged(),()=>this._updatingChanged()))}),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t,n){if(!this.overlay||!this.overlay.hasVisibleItems)return n;let r=e.getContext(`2d`,{willReadFrequently:!0});return r.putImageData(n,0,0),this.overlay.renderCanvas(e,{disableDecorations:t}),r.getImageData(0,0,n.width,n.height)}_initStage(e){let t={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,context:e,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t,n)=>this._renderScreenshotOverlay(e,t,n)}},n=new Ze(this.state.viewingMode,e=>this.stage.layers.forEach(e),this);this._set(`sceneIntersectionHelper`,n);let r=i(this.surface);this._stage=new vt({view:this,options:t,container:r}),this.notifyChange(`stage`),this._updateSlice(),this.addHandles([this.on(`pointer-move`,()=>this.stage?.renderer.resetAnimation()),o(this.stage.renderView.canvas,`webglcontextlost`,e=>{this.fatalError=new a(`webgl-context-lost`,e.statusMessage||`WebGL context lost`)})],`stage`),this.sceneIntersectionHelper.setTolerance(W/this.renderCoordsHelper.unitInMeters),this._set(`canvas`,this.stage.renderView.canvas)}_exitStage(){this.sceneIntersectionHelper?.destroy(),this._set(`sceneIntersectionHelper`,null),this._stage=u(this.stage),this._set(`stage`,null),this.removeHandles(`stage`),this._set(`canvas`,null)}_initSurface(){this._exitSurface();let e=_t(this.renderCanvas,{alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled});this._initStage(e),this._initGlobe(),this.sharedSymbolResources=new ut({view:this,resourceController:this._resourceController})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitTerrain(),this._exitStage())}async _ensureGraphicsView(){if(this.graphicsView||this._importControllers.has(`GraphicsView3D`)||this.graphics.length===0)return;this.removeHandles(`GraphicsView3D`);let e=(await this.updatingHandles.addPromise(this._importModule(`GraphicsView3D`,e=>g(()=>this.groundView?.ready,e))))?.default;e&&this._set(`graphicsView`,new e({view:this,getGraphics:()=>this.graphics})),this._updatingChanged()}_disposeGraphicsView(){this._abortImport(`GraphicsView3D`),this.removeHandles(`GraphicsView3D`),this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set(`graphicsView`,null))}_disposeFocusAreasView(){this._abortImport(`FocusAreasView`),this.removeHandles(`FocusAreasView`),this.focusAreasView=u(this.focusAreasView)}async _ensureFocusAreasView(e){if(this.focusAreasView||this._importControllers.has(`FocusAreasView`)||e===0)return;this.removeHandles(`FocusAreasView`);let t=(await this.updatingHandles.addPromise(this._importModule(`FocusAreasView`)))?.FocusAreasView;t&&(this.focusAreasView=new t({view:this})),this._updatingChanged()}_startup(){P(this.viewingMode)===1&&(this._clippingArea=null),this._initSurface(),this._set(`ready`,!0),this.addHandles(f(()=>this.graphics,`after-changes`,()=>this._ensureGraphicsView()),`GraphicsView3D`),this._ensureGraphicsView(),this.addHandles(this.updatingHandles.add(()=>this.map?.focusAreas?.areas.length??0,e=>this._ensureFocusAreasView(e),{initial:!0}),`FocusAreasView`);let e=this.scene?.initialViewProperties??null,t=e?.environment;t&&(this._overrideDefaultEnvironmentOnly?pe(this.environment,t):this.environment=this.environment.cloneWithWebsceneEnvironment(t)),this.timeExtent=e?.timeExtent,e?.analyses.applyTo(this),this.labeler.setup(),this.environmentView.connectView(this),this.inputManager.connect();let n=this._resolveWhenReady;this._resolveWhenReady=[],n.forEach(e=>e(this))}_teardown(){this.inputManager.disconnect(),this.environmentView.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this._exitSurface(),this._set(`ready`,!1)}get _defaultToMapOptions(){let e={include:new Set};if(!this.map)return e;this.map.ground&&e.include.add(G);for(let t of this.allLayerViews)(j(t.layer)&&D.shouldIntersectAsGround(t.layer)||Ae(t.layer))&&e.include.add(t.uid);return e}get _defaultHitTestOptions(){let e={exclude:new Set};if(!this.map)return e;this.map.ground&&this.map.ground.opacity<1&&e.exclude.add(G);for(let t of this.allLayerViews)j(t.layer)&&D.shouldIntersectAsGround(t.layer)&&t.fullOpacity<1&&e.exclude.add(t.uid);return e}static{this.type=`3d`}static clearStatics(){Pt(),he(),le(),St(),Ye(),Be(),xe(),wt(),Me(),gt(),xt(),Xe(),Qe(),_e(),oe(),bt(),ht(),Ge.cleanupI3SLodHandling(),je.cleanupTilemapCache(),R.cleanupViewstate(),U.cleanupTerrainSurface()}};e([v({nonNullable:!0}),y(It)],Y.prototype,`options`,void 0),e([v()],Y.prototype,`_userClippingArea`,void 0),e([v()],Y.prototype,`_resourceController`,void 0),e([v()],Y.prototype,`stage`,null),e([v({readOnly:!0})],Y.prototype,`deconflictor`,void 0),e([v({readOnly:!0})],Y.prototype,`labeler`,void 0),e([v()],Y.prototype,`navigation`,void 0),e([v({type:Le,readOnly:!0})],Y.prototype,`animation`,null),e([v({readOnly:!0})],Y.prototype,`basemapTerrain`,void 0),e([v({readOnly:!0})],Y.prototype,`overlayManager`,null),e([v({readOnly:!0})],Y.prototype,`elevationProvider`,void 0),e([v()],Y.prototype,`camera`,null),e([v({type:t})],Y.prototype,`contentCamera`,null),e([v({readOnly:!0})],Y.prototype,`canvas`,null),e([v({type:C,useTypeForAutocast:!1})],Y.prototype,`center`,null),e([v({type:S})],Y.prototype,`clippingArea`,null),e([v({type:I,nonNullable:!0})],Y.prototype,`constraints`,void 0),e([v({type:S,readOnly:!0})],Y.prototype,`renderDataExtent`,null),e([v({readOnly:!0})],Y.prototype,`tileInfo`,null),e([v({type:S,readOnly:!0})],Y.prototype,`dataExtent`,null),e([v({type:S,readOnly:!0})],Y.prototype,`_groundAndLayersExtent`,null),e([v({type:L})],Y.prototype,`environment`,null),e([y(`environment`)],Y.prototype,`castEnvironment`,null),e([v({readOnly:!0})],Y.prototype,`environmentView`,void 0),e([v({type:S})],Y.prototype,`extent`,null),e([v({type:r})],Y.prototype,`floors`,void 0),e([v()],Y.prototype,`screenCenter`,null),e([v()],Y.prototype,`frustum`,null),e([v({type:Number,readOnly:!0})],Y.prototype,`fullOpacity`,void 0),e([v({readOnly:!0})],Y.prototype,`graphicsView`,void 0),e([v()],Y.prototype,`analysisViewManager`,void 0),e([v()],Y.prototype,`groundView`,void 0),e([v({readOnly:!0})],Y.prototype,`layerviewCollections`,null),e([v({type:Boolean})],Y.prototype,`initialExtentRequired`,null),e([v()],Y.prototype,`defaultsFromMapSettings`,null),e([v()],Y.prototype,`interacting`,null),e([v()],Y.prototype,`stationary`,null),e([v()],Y.prototype,`navigating`,null),e([v()],Y.prototype,`map`,void 0),e([v()],Y.prototype,`padding`,null),e([v({type:H,readOnly:!0})],Y.prototype,`pointsOfInterest`,void 0),e([v()],Y.prototype,`_featureTiles`,void 0),e([v()],Y.prototype,`featureTiles`,null),e([v()],Y.prototype,`_featureTreeDebugger`,void 0),e([v({constructOnly:!0})],Y.prototype,`deactivatedWebGLExtensions`,void 0),e([v({constructOnly:!0})],Y.prototype,`debugWebGLExtensions`,void 0),e([v({constructOnly:!0})],Y.prototype,`renderCanvas`,void 0),e([v({constructOnly:!0})],Y.prototype,`state`,void 0),e([v()],Y.prototype,`screenSizePerspective`,void 0),e([v({readOnly:!0})],Y.prototype,`inputManager`,void 0),e([v({readOnly:!0})],Y.prototype,`stateManager`,void 0),e([v({type:[`low`,`medium`,`high`]})],Y.prototype,`qualityProfile`,null),e([v({type:V,get(){let e=this._get(`qualitySettings`);if(!e){let t=B(this.qualityProfile);e=new V(t)}return e}})],Y.prototype,`qualitySettings`,void 0),e([v()],Y.prototype,`slice`,void 0),e([v({readOnly:!0})],Y.prototype,`typeSpecificPreconditionsReady`,null),e([v({readOnly:!0})],Y.prototype,`sceneIntersectionHelper`,void 0),e([v({type:Number,readOnly:!0})],Y.prototype,`resolution`,null),e([v({type:Number})],Y.prototype,`scale`,null),e([v({readOnly:!0,type:Number})],Y.prototype,`terrainLevel`,null),e([v()],Y.prototype,`heightModelInfo`,null),e([v({type:T})],Y.prototype,`spatialReference`,void 0),e([v({type:Boolean,value:!1})],Y.prototype,`alphaCompositingEnabled`,null),e([v({constructOnly:!0})],Y.prototype,`preserveDrawingBufferEnabled`,void 0),e([v({type:Boolean})],Y.prototype,`supersampleScreenshotsEnabled`,void 0),e([v({readOnly:!0})],Y.prototype,`type`,void 0),e([v(),y(e=>e instanceof jt?e:x(Mt,e))],Y.prototype,`ui`,void 0),e([v({type:Boolean,readOnly:!0})],Y.prototype,`updating`,null),e([v()],Y.prototype,`_updatingObjects`,null),e([v()],Y.prototype,`_updatingObjectsWithProgress`,null),e([v()],Y.prototype,`_updatingObjectsToDebug`,null),e([v({type:Number,readOnly:!0})],Y.prototype,`updatingProgress`,void 0),e([v({type:[`global`,`local`]})],Y.prototype,`viewingMode`,null),e([v({type:n})],Y.prototype,`viewpoint`,null),e([v({readOnly:!0})],Y.prototype,`visibleArea`,null),e([v({type:Number})],Y.prototype,`zoom`,null),e([v({readOnly:!0})],Y.prototype,`quality`,null),e([v({readOnly:!0})],Y.prototype,`resolutionScale`,null),e([v()],Y.prototype,`focusAreasView`,void 0),e([v()],Y.prototype,`_defaultToMapOptions`,null),e([v()],Y.prototype,`_defaultHitTestOptions`,null),Y=q=e([fe(`esri.views.SceneView`)],Y);function X(e,t){return e!=null&&be(e.spatialReference,t)?w(e,t):null}const Z=ge(),Q=ce(),$=we(),Lt=ke(0,0,0,T.WebMercator),Rt={GraphicsView3D:()=>import(`./3d/layers/GraphicsView3D.js`),FocusAreasView:()=>import(`./3d/FocusAreasView.js`),FeatureTileTree3D:()=>import(`./3d/layers/support/FeatureTileTree3D.js`)},zt=Y;export{zt as default};
|
package/views/VideoView.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../Color.js";import n from"../Viewpoint.js";import r from"../core/Accessor.js";import i from"../core/Error.js";import{EventedMixin as a}from"../core/Evented.js";import{destroyMaybe as o}from"../core/maybe.js";import{EsriPromiseMixin as s}from"../core/Promise.js";import{watch as c,syncAndInitial as l,whenOnce as u,when as d}from"../core/reactiveUtils.js";import{property as f,cast as p,subclass as m}from"../core/accessorSupport/decorators.js";import{ensureClass as h}from"../core/accessorSupport/ensureType.js";import{create as g,fromValues as _}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import v from"../geometry/Extent.js";import y from"../geometry/Point.js";import b from"../geometry/SpatialReference.js";import{projectLoad as x,projectExecute as S}from"../geometry/operators/projectOperator.js";import C from"../layers/support/ExtentAndRotationGeoreference.js";import{MediaElementView as w}from"../layers/support/MediaElementView.js";import T from"../layers/support/TileInfo.js";import E from"../layers/support/VideoElement.js";import{DOMContainer as D}from"./DOMContainer.js";import{Viewport2DBaseMixin as O}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as k}from"./Viewport2DMixin.js";import A from"./2d/AnimationManager.js";import j from"./2d/MapViewConstraints.js";import"./2d/engine/Stage.js";import"../core/libs/gl-matrix-2/factories/vec4f32.js";import"../core/RandomLCG.js";import"../core/has.js";import"../core/Logger.js";import"./2d/engine/transitions/FadeTransition.js";import"./webgl/BufferObject.js";import"./webgl/FramebufferObject.js";import"./webgl/Program.js";import"./webgl/Renderbuffer.js";import"./webgl/Texture.js";import"../core/memoryEstimations.js";import"./webgl/enums.js";import"./webgl/Util.js";import"./2d/engine/webgl/meshing/definitions.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"./2d/LabelManager.js";import"./2d/layers/graphics/GraphicsView2D.js";import{Container as M}from"./2d/engine/Container.js";import"./2d/engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileInfo.js";import"./2d/engine/webgl/AFeatureTile.js";import"./2d/engine/webgl/DisplayEntity.js";import"../geometry/Polygon.js";import"../core/libs/gl-matrix-2/factories/vec2f32.js";import"./2d/engine/webgl/number.js";import"./2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js";import"./webgl/UniformBufferLayout.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"../core/libs/gl-matrix-2/factories/vec3f32.js";import"../geometry/support/normalizeUtils.js";import"./2d/layers/support/util.js";import N from"./2d/navigation/MapViewNavigation.js";import"../request.js";import"../core/asyncUtils.js";import"../core/support/UpdatingHandles.js";import"../core/mathUtils.js";import"../core/urlUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../core/units.js";import"../geometry/ellipsoidUtils.js";import"../geometry/Geometry.js";import"../geometry/Multipoint.js";import"../geometry/Polyline.js";import"../geometry/spatialReferenceEllipsoidUtils.js";import"../geometry/operators/support/GeographicTransformation.js";import"../geometry/projection/projectors.js";import"../geometry/support/spatialReferenceUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../geometry/support/geodesicConstants.js";import"../geometry/support/Ellipsoid.js";import{ViewStateManager as P}from"./2d/ViewStateManager.js";import F from"./2d/engine/webgl/Overlay.js";import I from"./2d/engine/webgl/OverlayContainer.js";import{createScreenshotRegion as L}from"./2d/support/screenshotUtils.js";import R from"./navigation/Navigation.js";import{getMaximumResolutionScale as z,encode as B,getFormatAndQuality as V}from"./support/screenshotUtils.js";import H from"./ui/DefaultUI.js";import U from"./ui/video/DefaultUIVideo.js";const W=new t(`#000`);let G;async function K(){let[,{ParentStage:e}]=await Promise.all([import(`./2d/webglDeps.js`),import(`./2d/mapViewDeps.js`)]);G=e}const q=.01,J=[`feature`,`geojson`,`csv`,`stream`,`ogc-feature`,`catalog`,`wfs`,`parquet`,`graphics`,`group`];let Y=class extends k(O(D(a(s(r))))){constructor(e){super(e),this._isValid=!1,this._readyCycleForced=!1,this._prevZoomEnabled=!1,this._prevRotationEnabled=!1,this.stage=null,this.childStage=null,this._operationalDataView=null,this.operationalDataVisible=!1,this.map=null,this.navigation=new R,this.ready=!1,this.spatialReference=new b({wkid:0}),this.stateManager=new P({constraints:new j({view:this,minScale:1,maxScale:q})}),this.type=`2d`,this.ui=new U,this.view2dType=`video`,this.addHandles([c(()=>this.preconditionsReady,e=>e?this._startup():this._teardown()),c(()=>this.videoSize,([e,t])=>{this._extent&&e&&t&&(this._extent.xmax=e,this._extent.ymax=t)}),c(()=>this.size,e=>{this._operationalDataView&&this._operationalDataView.stateManager.resize(e[0],e[1])}),c(()=>[this.layer?.frameEffect,this._effectsContainer],()=>{this._effectsContainer&&(this._effectsContainer.effect=this.layer?.frameEffect??null)},l)])}initialize(){this._prevZoomEnabled=this.navigation.actionMap.mouseWheel===`zoom`&&this.ui.components.includes(`zoom`),this._prevRotationEnabled=this.navigation.actionMap.dragSecondary===`rotate`&&this.ui.components.includes(`compass`),this.addHandles([c(()=>[this.operationalDataVisible,this.childStage],()=>{this.childStage&&(this.childStage.videoScreenRenderer.visible=this.operationalDataVisible),this.operationalDataVisible&&(this.scale=1,this.rotation=0),this.navigation&&(this._prevZoomEnabled&&(this.navigation.actionMap.mouseWheel=this.operationalDataVisible?`none`:`zoom`,this.navigation.actionMap.dragPrimary=this.operationalDataVisible?`none`:`pan`,this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>e!==`zoom`):[...new Set([...this.ui.components,`zoom`])])),this._prevRotationEnabled&&(this.navigation.actionMap.dragSecondary=this.operationalDataVisible?`none`:`rotate`,this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>e!==`compass`):[...new Set([...this.ui.components,`compass`])])))},l)]),this.addResolvingPromise(K().then(()=>(this._isValid=!0,u(()=>this.ready))))}destroy(){this._teardown(),this.removeAllHandles(),this._set(`preconditionsReady`,!1),this.frameTask=o(this.frameTask),this.goToManager.destroy(),this.inputManager.destroy(),this._set(`inputManager`,null)}get constraintsInfo(){return{lods:null,spatialReference:this.spatialReference}}get focusRegion(){return super.focusRegion}get layer(){return this._get(`layer`)}set layer(e){e!==this._get(`layer`)&&(this.constructed&&!this.destroyed&&(this._forceReadyCycle(),this.addResolvingPromise(u(()=>this.ready))),this._set(`layer`,e))}get preconditionsReady(){return!(!this._isValid||this._readyCycleForced||this.width===0||this.height===0||this.videoSize[0]===0||this.videoSize[1]===0)}get rendering(){return this.stage?.renderRequested??!1}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get videoSize(){if(!this.layer?.videoWidth||!this.layer?.videoHeight)return[0,0];let[e,t]=this.size,n=(this.layer?.videoWidth||0)/(this.layer?.videoHeight||0),r=e/t,i=t*n,a=e/n;return r>=1?n>=1?i<=e?[i,t]:[e,a]:a<=t?[e,a]:[i,t]:n>=1?a<=t?[e,a]:[i,t]:i<=e?[i,t]:[e,a]}async hitTest(e,t){if(!this._operationalDataView||!this._operationalDataView.ready)return{screenPoint:e,results:[]};let n=this._operationalDataView.videoToMap(e);if(!n)return{screenPoint:e,results:[]};let r=this._operationalDataView.state.toScreen(g(),n);return this._operationalDataView.hitTest({x:r[0],y:r[1]},t)}async takeScreenshot(e){let t=this.stage,[n,r]=this.size;if(!this.ready||!t||n<=0||r<=0)throw new i(`videoview:not-ready`,`The VideoView must be ready before taking a screenshot.`);let a=L(e||{},Math.min(4,z(this.size,Math.min(4096,t.context.parameters.maxTextureSize))),this.size,this.padding),o=await t.takeScreenshot(a,void 0,e?.ignoreBackground?null:W,e?.rotation);return B(o,V(e?.format,e?.quality),{flipY:!0,premultipliedAlpha:!0})}_startup(){if(!this.layer)return;let e=this._getViewpoint();this.stateManager.startup(e,this.size,e.targetGeometry.spatialReference);let t={renderingOptions:this.renderingOptions,backgroundColor:W,groundControlPoints:()=>this._groundControlPoints(),getSize:()=>this.videoSize},n=new G(this._getOrCreateRenderCanvas(),t);this.stage=n,this._prepareStage(this.stage),this.childStage=n.childStage,this._prepareChildStage(this.childStage);let r=new A({view:this});this._set(`animationManager`,r);let i=new N({view:this,animationManager:r});this._set(`mapViewNavigation`,i),this._updateConstraints(),this.frameTask.start(),this._set(`ready`,!0)}_teardown(){this.frameTask?.stop(),this.stationaryManager?.clear(),this.stage?.destroy(),this.stage=null,this._videoElementView=null,this._overlayContainer?.removeAllChildren(),this._overlayContainer=null,this.removeHandles(`video-view`),this._set(`ready`,!1),this.stateManager?.ready&&this.stateManager.teardown()}_getViewpoint(){return new n({targetGeometry:new y({x:this.videoSize[0]/2,y:this.videoSize[1]/2,spatialReference:this.spatialReference}),scale:1})}_prepareStage(e){this.addHandles([c(()=>this.stationary,t=>e.stationary=t,l),c(()=>this.state.id,()=>e.state=this.state,l),c(()=>this.renderingOptions,t=>e.renderingOptions=t,l)],`video-view`),this._extent=new v({xmin:0,ymin:0,xmax:this.videoSize[0],ymax:this.videoSize[1],spatialReference:{wkid:0}}),this._videoElementView=new w({element:new E({video:this.layer?.videoElement,georeference:new C({extent:this._extent}),autoplay:!1}),spatialReference:this.spatialReference});let t=new F(this._videoElementView);this._overlayContainer=new I,this._overlayContainer.addChild(t),this._effectsContainer=new M,this._effectsContainer.addChild(this._overlayContainer),this.stage.addChild(this._effectsContainer);let n=document.createElement(`div`);n.classList.add(`esri-video-poster`),this.container?.classList.add(`esri-video-view`),this.container?.appendChild(n)}_prepareChildStage(e){this.addHandles([c(()=>this.map,async t=>{if(!t)return;let{default:n}=await import(`./video/VideoOperationalDataView.js`);this._operationalDataView=new n({stage:e,layerViewFilter:e=>new Set(J).has(e.type),width:this.size[0],height:this.size[1],map:t,groundControlPoints:()=>this._groundControlPoints(),getVideoResolution:()=>_(this.layer?.videoWidth||0,this.layer?.videoHeight||0),getSize:()=>this.size}),u(()=>this._operationalDataView?.ready).then(()=>{e.videoScreenRenderer.visible=this.operationalDataVisible})},l),c(()=>this.layer?.groundControlPoints,async()=>{if(!this.layer?.groundControlPoints||!e.state)return;let t=this.layer.groundControlPoints,n=t?.length;if(!n)return;await x();let r=Array(n),i=e.state.spatialReference;for(let e=0;e<n;e++){let{lat:n,lon:a}=t[e];r[e]=S(new y({x:a,y:n}),i)}let a=1/0,o=1/0,s=-1/0,c=-1/0;for(let e of r)a=Math.min(a,e.x),o=Math.min(o,e.y),s=Math.max(s,e.x),c=Math.max(c,e.y);let l=v.fromJSON({xmin:a,ymin:o,xmax:s,ymax:c,spatialReference:i});await this._operationalDataView?.goTo(l,{animate:!1}).catch(()=>{})},l)])}_updateConstraints(){this._updateZoomConstraints(),this._updatePanConstraints()}_updateZoomConstraints(){let e=this.videoSize,t=Math.max(e[0]/this.size[0],e[1]/this.size[1]),n=[];for(let e=t;e>q;e/=2)n.push(e);n.push(q);let{lods:r}=T.create({scales:n});this.constraints.set({lods:r,minScale:t})}_updatePanConstraints(){let e=e=>{if(!e.targetGeometry)return e;let[t,n]=this.videoSize,r=t*e.scale/2,i=n*e.scale/2,a=e.targetGeometry.clone();return a.x=Math.max(r,Math.min(t-r,a.x)),a.y=Math.max(i,Math.min(n-i,a.y)),e.targetGeometry=a,e};this.constraints.customConstraints.add({constrain:e,applyPanConstraint:e})}_forceReadyCycle(){this.ready&&(d(()=>this.destroyed||this.preconditionsReady===!1,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}_groundControlPoints(){return this.layer?.groundControlPoints}};e([f()],Y.prototype,`_overlayContainer`,void 0),e([f()],Y.prototype,`_isValid`,void 0),e([f()],Y.prototype,`_readyCycleForced`,void 0),e([f()],Y.prototype,`_effectsContainer`,void 0),e([f()],Y.prototype,`constraintsInfo`,null),e([f()],Y.prototype,`operationalDataVisible`,void 0),e([f()],Y.prototype,`layer`,null),e([f()],Y.prototype,`map`,void 0),e([f({type:R,nonNullable:!0})],Y.prototype,`navigation`,void 0),e([f({readOnly:!0})],Y.prototype,`preconditionsReady`,null),e([f({readOnly:!0})],Y.prototype,`ready`,void 0),e([f({readOnly:!0})],Y.prototype,`rendering`,null),e([f()],Y.prototype,`scale`,null),e([f()],Y.prototype,`spatialReference`,void 0),e([f()],Y.prototype,`stateManager`,void 0),e([f()],Y.prototype,`type`,void 0),e([f(),p(e=>e instanceof H?e:h(U,e))],Y.prototype,`ui`,void 0),e([f({readOnly:!0})],Y.prototype,`videoSize`,null),e([f({readOnly:!0})],Y.prototype,`view2dType`,void 0),Y=e([m(`esri.views.VideoView`)],Y);const X=Y;export{X as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../Color.js";import n from"../Viewpoint.js";import r from"../core/Accessor.js";import i from"../core/Error.js";import{EventedMixin as a}from"../core/Evented.js";import{destroyMaybe as o}from"../core/maybe.js";import{EsriPromiseMixin as s}from"../core/Promise.js";import{watch as c,syncAndInitial as l,whenOnce as u,when as d}from"../core/reactiveUtils.js";import{property as f,cast as p,subclass as m}from"../core/accessorSupport/decorators.js";import{ensureClass as h}from"../core/accessorSupport/ensureType.js";import{create as g,fromValues as _}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import v from"../geometry/Extent.js";import y from"../geometry/Point.js";import b from"../geometry/SpatialReference.js";import{projectLoad as x,projectExecute as S}from"../geometry/operators/projectOperator.js";import C from"../layers/support/ExtentAndRotationGeoreference.js";import{MediaElementView as w}from"../layers/support/MediaElementView.js";import T from"../layers/support/TileInfo.js";import E from"../layers/support/VideoElement.js";import{DOMContainer as D}from"./DOMContainer.js";import{Viewport2DBaseMixin as O}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as k}from"./Viewport2DMixin.js";import A from"./2d/AnimationManager.js";import j from"./2d/MapViewConstraints.js";import"./2d/engine/Stage.js";import"../core/libs/gl-matrix-2/factories/vec4f32.js";import"../core/RandomLCG.js";import"../core/has.js";import"../core/Logger.js";import"../core/accessorSupport/ObservableBase.js";import"./2d/engine/transitions/FadeTransition.js";import"./webgl/BufferObject.js";import"./webgl/FramebufferObject.js";import"./webgl/Program.js";import"./webgl/Renderbuffer.js";import"./webgl/Texture.js";import"../core/memoryEstimations.js";import"./webgl/enums.js";import"./webgl/Util.js";import"./2d/engine/webgl/meshing/definitions.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"./2d/LabelManager.js";import"./2d/layers/graphics/GraphicsView2D.js";import{Container as M}from"./2d/engine/Container.js";import"./2d/engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileInfo.js";import"./2d/engine/webgl/AFeatureTile.js";import"./2d/engine/webgl/DisplayEntity.js";import"../geometry/Polygon.js";import"../core/libs/gl-matrix-2/factories/vec2f32.js";import"./2d/engine/webgl/number.js";import"./2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js";import"./webgl/UniformBufferLayout.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"../core/libs/gl-matrix-2/factories/vec3f32.js";import"../geometry/support/normalizeUtils.js";import"./2d/layers/support/util.js";import N from"./2d/navigation/MapViewNavigation.js";import"../request.js";import"../core/asyncUtils.js";import"../core/support/UpdatingHandles.js";import"../core/mathUtils.js";import"../core/urlUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../core/units.js";import"../geometry/ellipsoidUtils.js";import"../geometry/Geometry.js";import"../geometry/Multipoint.js";import"../geometry/Polyline.js";import"../geometry/spatialReferenceEllipsoidUtils.js";import"../geometry/operators/support/GeographicTransformation.js";import"../geometry/projection/projectors.js";import"../geometry/support/spatialReferenceUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../geometry/support/geodesicConstants.js";import"../geometry/support/Ellipsoid.js";import{ViewStateManager as P}from"./2d/ViewStateManager.js";import F from"./2d/engine/webgl/Overlay.js";import I from"./2d/engine/webgl/OverlayContainer.js";import{createScreenshotRegion as L}from"./2d/support/screenshotUtils.js";import R from"./navigation/Navigation.js";import{getMaximumResolutionScale as z,encode as B,getFormatAndQuality as V}from"./support/screenshotUtils.js";import H from"./ui/DefaultUI.js";import U from"./ui/video/DefaultUIVideo.js";const W=new t(`#000`);let G;async function K(){let[,{ParentStage:e}]=await Promise.all([import(`./2d/webglDeps.js`),import(`./2d/mapViewDeps.js`)]);G=e}const q=.01,J=[`feature`,`geojson`,`csv`,`stream`,`ogc-feature`,`catalog`,`wfs`,`parquet`,`graphics`,`group`];let Y=class extends k(O(D(a(s(r))))){constructor(e){super(e),this._isValid=!1,this._readyCycleForced=!1,this._prevZoomEnabled=!1,this._prevRotationEnabled=!1,this.stage=null,this.childStage=null,this._operationalDataView=null,this.operationalDataVisible=!1,this.map=null,this.navigation=new R,this.ready=!1,this.spatialReference=new b({wkid:0}),this.stateManager=new P({constraints:new j({view:this,minScale:1,maxScale:q})}),this.type=`2d`,this.ui=new U,this.view2dType=`video`,this.addHandles([c(()=>this.preconditionsReady,e=>e?this._startup():this._teardown()),c(()=>this.videoSize,([e,t])=>{this._extent&&e&&t&&(this._extent.xmax=e,this._extent.ymax=t)}),c(()=>this.size,e=>{this._operationalDataView&&this._operationalDataView.stateManager.resize(e[0],e[1])}),c(()=>[this.layer?.frameEffect,this._effectsContainer],()=>{this._effectsContainer&&(this._effectsContainer.effect=this.layer?.frameEffect??null)},l)])}initialize(){this._prevZoomEnabled=this.navigation.actionMap.mouseWheel===`zoom`&&this.ui.components.includes(`zoom`),this._prevRotationEnabled=this.navigation.actionMap.dragSecondary===`rotate`&&this.ui.components.includes(`compass`),this.addHandles([c(()=>[this.operationalDataVisible,this.childStage],()=>{this.childStage&&(this.childStage.videoScreenRenderer.visible=this.operationalDataVisible),this.operationalDataVisible&&(this.scale=1,this.rotation=0),this.navigation&&(this._prevZoomEnabled&&(this.navigation.actionMap.mouseWheel=this.operationalDataVisible?`none`:`zoom`,this.navigation.actionMap.dragPrimary=this.operationalDataVisible?`none`:`pan`,this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>e!==`zoom`):[...new Set([...this.ui.components,`zoom`])])),this._prevRotationEnabled&&(this.navigation.actionMap.dragSecondary=this.operationalDataVisible?`none`:`rotate`,this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>e!==`compass`):[...new Set([...this.ui.components,`compass`])])))},l)]),this.addResolvingPromise(K().then(()=>(this._isValid=!0,u(()=>this.ready))))}destroy(){this._teardown(),this.removeAllHandles(),this._set(`preconditionsReady`,!1),this.frameTask=o(this.frameTask),this.goToManager.destroy(),this.inputManager.destroy(),this._set(`inputManager`,null)}get constraintsInfo(){return{lods:null,spatialReference:this.spatialReference}}get focusRegion(){return super.focusRegion}get layer(){return this._get(`layer`)}set layer(e){e!==this._get(`layer`)&&(this.constructed&&!this.destroyed&&(this._forceReadyCycle(),this.addResolvingPromise(u(()=>this.ready))),this._set(`layer`,e))}get preconditionsReady(){return!(!this._isValid||this._readyCycleForced||this.width===0||this.height===0||this.videoSize[0]===0||this.videoSize[1]===0)}get rendering(){return this.stage?.renderRequested??!1}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get videoSize(){if(!this.layer?.videoWidth||!this.layer?.videoHeight)return[0,0];let[e,t]=this.size,n=(this.layer?.videoWidth||0)/(this.layer?.videoHeight||0),r=e/t,i=t*n,a=e/n;return r>=1?n>=1?i<=e?[i,t]:[e,a]:a<=t?[e,a]:[i,t]:n>=1?a<=t?[e,a]:[i,t]:i<=e?[i,t]:[e,a]}async hitTest(e,t){if(!this._operationalDataView||!this._operationalDataView.ready)return{screenPoint:e,results:[]};let n=this._operationalDataView.videoToMap(e);if(!n)return{screenPoint:e,results:[]};let r=this._operationalDataView.state.toScreen(g(),n);return this._operationalDataView.hitTest({x:r[0],y:r[1]},t)}async takeScreenshot(e){let t=this.stage,[n,r]=this.size;if(!this.ready||!t||n<=0||r<=0)throw new i(`videoview:not-ready`,`The VideoView must be ready before taking a screenshot.`);let a=L(e||{},Math.min(4,z(this.size,Math.min(4096,t.context.parameters.maxTextureSize))),this.size,this.padding),o=await t.takeScreenshot(a,void 0,e?.ignoreBackground?null:W,e?.rotation);return B(o,V(e?.format,e?.quality),{flipY:!0,premultipliedAlpha:!0})}_startup(){if(!this.layer)return;let e=this._getViewpoint();this.stateManager.startup(e,this.size,e.targetGeometry.spatialReference);let t={renderingOptions:this.renderingOptions,backgroundColor:W,groundControlPoints:()=>this._groundControlPoints(),getSize:()=>this.videoSize},n=new G(this._getOrCreateRenderCanvas(),t);this.stage=n,this._prepareStage(this.stage),this.childStage=n.childStage,this._prepareChildStage(this.childStage);let r=new A({view:this});this._set(`animationManager`,r);let i=new N({view:this,animationManager:r});this._set(`mapViewNavigation`,i),this._updateConstraints(),this.frameTask.start(),this._set(`ready`,!0)}_teardown(){this.frameTask?.stop(),this.stationaryManager?.clear(),this.stage?.destroy(),this.stage=null,this._videoElementView=null,this._overlayContainer?.removeAllChildren(),this._overlayContainer=null,this.removeHandles(`video-view`),this._set(`ready`,!1),this.stateManager?.ready&&this.stateManager.teardown()}_getViewpoint(){return new n({targetGeometry:new y({x:this.videoSize[0]/2,y:this.videoSize[1]/2,spatialReference:this.spatialReference}),scale:1})}_prepareStage(e){this.addHandles([c(()=>this.stationary,t=>e.stationary=t,l),c(()=>this.state.id,()=>e.state=this.state,l),c(()=>this.renderingOptions,t=>e.renderingOptions=t,l)],`video-view`),this._extent=new v({xmin:0,ymin:0,xmax:this.videoSize[0],ymax:this.videoSize[1],spatialReference:{wkid:0}}),this._videoElementView=new w({element:new E({video:this.layer?.videoElement,georeference:new C({extent:this._extent}),autoplay:!1}),spatialReference:this.spatialReference});let t=new F(this._videoElementView);this._overlayContainer=new I,this._overlayContainer.addChild(t),this._effectsContainer=new M,this._effectsContainer.addChild(this._overlayContainer),this.stage.addChild(this._effectsContainer);let n=document.createElement(`div`);n.classList.add(`esri-video-poster`),this.container?.classList.add(`esri-video-view`),this.container?.appendChild(n)}_prepareChildStage(e){this.addHandles([c(()=>this.map,async t=>{if(!t)return;let{default:n}=await import(`./video/VideoOperationalDataView.js`);this._operationalDataView=new n({stage:e,layerViewFilter:e=>new Set(J).has(e.type),width:this.size[0],height:this.size[1],map:t,groundControlPoints:()=>this._groundControlPoints(),getVideoResolution:()=>_(this.layer?.videoWidth||0,this.layer?.videoHeight||0),getSize:()=>this.size}),u(()=>this._operationalDataView?.ready).then(()=>{e.videoScreenRenderer.visible=this.operationalDataVisible})},l),c(()=>this.layer?.groundControlPoints,async()=>{if(!this.layer?.groundControlPoints||!e.state)return;let t=this.layer.groundControlPoints,n=t?.length;if(!n)return;await x();let r=Array(n),i=e.state.spatialReference;for(let e=0;e<n;e++){let{lat:n,lon:a}=t[e];r[e]=S(new y({x:a,y:n}),i)}let a=1/0,o=1/0,s=-1/0,c=-1/0;for(let e of r)a=Math.min(a,e.x),o=Math.min(o,e.y),s=Math.max(s,e.x),c=Math.max(c,e.y);let l=v.fromJSON({xmin:a,ymin:o,xmax:s,ymax:c,spatialReference:i});await this._operationalDataView?.goTo(l,{animate:!1}).catch(()=>{})},l)])}_updateConstraints(){this._updateZoomConstraints(),this._updatePanConstraints()}_updateZoomConstraints(){let e=this.videoSize,t=Math.max(e[0]/this.size[0],e[1]/this.size[1]),n=[];for(let e=t;e>q;e/=2)n.push(e);n.push(q);let{lods:r}=T.create({scales:n});this.constraints.set({lods:r,minScale:t})}_updatePanConstraints(){let e=e=>{if(!e.targetGeometry)return e;let[t,n]=this.videoSize,r=t*e.scale/2,i=n*e.scale/2,a=e.targetGeometry.clone();return a.x=Math.max(r,Math.min(t-r,a.x)),a.y=Math.max(i,Math.min(n-i,a.y)),e.targetGeometry=a,e};this.constraints.customConstraints.add({constrain:e,applyPanConstraint:e})}_forceReadyCycle(){this.ready&&(d(()=>this.destroyed||this.preconditionsReady===!1,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}_groundControlPoints(){return this.layer?.groundControlPoints}};e([f()],Y.prototype,`_overlayContainer`,void 0),e([f()],Y.prototype,`_isValid`,void 0),e([f()],Y.prototype,`_readyCycleForced`,void 0),e([f()],Y.prototype,`_effectsContainer`,void 0),e([f()],Y.prototype,`constraintsInfo`,null),e([f()],Y.prototype,`operationalDataVisible`,void 0),e([f()],Y.prototype,`layer`,null),e([f()],Y.prototype,`map`,void 0),e([f({type:R,nonNullable:!0})],Y.prototype,`navigation`,void 0),e([f({readOnly:!0})],Y.prototype,`preconditionsReady`,null),e([f({readOnly:!0})],Y.prototype,`ready`,void 0),e([f({readOnly:!0})],Y.prototype,`rendering`,null),e([f()],Y.prototype,`scale`,null),e([f()],Y.prototype,`spatialReference`,void 0),e([f()],Y.prototype,`stateManager`,void 0),e([f()],Y.prototype,`type`,void 0),e([f(),p(e=>e instanceof H?e:h(U,e))],Y.prototype,`ui`,void 0),e([f({readOnly:!0})],Y.prototype,`videoSize`,null),e([f({readOnly:!0})],Y.prototype,`view2dType`,void 0),Y=e([m(`esri.views.VideoView`)],Y);const X=Y;export{X as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../core/Evented.js";import{on as n}from"../../core/events.js";import{destroyMaybe as r}from"../../core/maybe.js";import{watch as i,syncAndInitial as a,initial as o,when as s,sync as c}from"../../core/reactiveUtils.js";import{cloneScreenPoint as l,createScreenPoint as u}from"../../core/screenUtils.js";import{property as d,subclass as f}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as p}from"../../core/support/UpdatingHandles.js";import{setCalciteModeClass as m}from"../../support/modeUtils.js";import h from"./options/TooltipOptions.js";import{base as g}from"./tooltip/css.js";import{tooltipContentFactory as _}from"./tooltip/content/tooltipContentFactory.js";import{isRTL as v}from"../../widgets/support/widgetUtils.js";const y={base:`${g}`,ltr:`${g}--ltr`,rtl:`${g}--rtl`,debug:`${g}--debug`},b=`bottom-end`,x={topStart:`top-start`,topEnd:`top-end`,bottomStart:`bottom-start`,bottomEnd:`bottom-end`};let S=class extends t{constructor(e){super(e),this.info=null,this.position=null,this.inputModePosition=null,this.content=null,this._focused=!1,this.hidden=!1,this.outerContainer=document.createElement(`div`),this.debug=!1,this._updatingHandles=new p,this._lastPosition=null,this._rtl=!1,this._prevXY=[0,0]}initialize(){let{outerContainer:e}=this;this.addHandles([i(()=>this.view.overlay?.surface,t=>{e.remove(),t?.appendChild(e),this._rtl=v(t)},a),i(()=>this.info,(t,n)=>{if(this.content!=null&&t!=null&&n!=null&&t.type===n.type)this.content.info=t;else{r(this.content);let n=_(this,t);n?(this.content=n,n.container&&e.appendChild(n.container),this.exitInputMode()):this.content=null}},a),i(()=>({container:this.outerContainer,style:this._outerContainerStyle}),({container:e,style:t})=>{Object.assign(e.style,t)},o),i(()=>({outerContainer:this.outerContainer,placement:this.effectivePlacement,effectiveOffset:this._effectiveOffset,rtl:this._rtl,debug:this.debug}),({outerContainer:e,placement:t,effectiveOffset:n,rtl:r,debug:i})=>{let{classList:a}=e;a.add(y.base),a.toggle(y.rtl,r),a.toggle(y.ltr,!r),a.toggle(y.debug,i),this.outerContainer.style.setProperty(`--offset`,`${n}px`),m(e),E(e,t)},o),s(()=>this.mode===`feedback`,()=>{this.inputModePosition=null,this._clearOverride(`effectivePlacement`)},c),n(this.outerContainer,`paste`,e=>{this.emit(`paste`,e)}),n(this.outerContainer,[`focusin`,`focusout`],()=>{this._focused=this.content?.container?.contains(document.activeElement)??!1})])}destroy(){this.info=null,this.content=r(this.content),this.outerContainer.remove(),this._updatingHandles.destroy()}get options(){return this._get(`options`)}set options(e){this._set(`options`,e)}get isInInputMode(){return!!this.inputModePosition}get mode(){return this.content?.mode??`feedback`}get focused(){return this._focused}get visible(){return this._outerContainerStyle.display!==`none`}get contentContainer(){return this.content?.container}get effectivePlacement(){let e=this.options?.placement;return e===`auto`?D(this.view.inputManager?.latestPenInfo)??b:e??b}get updating(){return this._updatingHandles.updating}get _screenPoint(){let{inputManager:e}=this.view;return e?.multiTouchActive?null:e?.latestPointerInfo?.location}get _effectiveOffset(){return this.options?.offset??20}get _outerContainerStyle(){let e=this.inputModePosition??this.position??this._screenPoint;return this._lastPosition=l(e),e!=null&&this.content!=null&&(!this.hidden||this.inputModePosition)?{display:`block`,transform:`translate(${Math.round(e.x)}px, ${Math.round(e.y)}px)`}:{display:`none`,transform:`none`}}clear(){this.info=null}async enterInputMode(e){let t=this.position??this._lastPosition??this._screenPoint,n=this.inputModePosition=l(t),{effectivePlacement:r}=this;this._override(`effectivePlacement`,r),await this._updatingHandles.addPromise(this.content?.enterInputMode(e,()=>{n&&(this.inputModePosition=C(this.contentContainer,n,this._effectiveOffset,this.view),Object.assign(this.outerContainer.style,this._outerContainerStyle))}))}async exitInputMode(e){this.inputModePosition=null,await this._updatingHandles.addPromise(this.content?.exitInputMode(e))}onDragStart(e,t){this._prevXY=[e,t]}onDrag(e,t){let n=e-this._prevXY[0],r=t-this._prevXY[1];this._prevXY=[e,t];let{inputModePosition:i}=this;if(i){let{view:a}=this,o=e-a.position[0],s=t-a.position[1];if(o<0||o>a.width||s<0||s>a.height-16)return;this.inputModePosition=u(i.x+n,i.y+r)}}onDragEnd(){this._prevXY=[0,0]}};e([d({nonNullable:!0})],S.prototype,`view`,void 0),e([d()],S.prototype,`info`,void 0),e([d({type:h})],S.prototype,`options`,null),e([d()],S.prototype,`position`,void 0),e([d()],S.prototype,`inputModePosition`,void 0),e([d()],S.prototype,`isInInputMode`,null),e([d()],S.prototype,`content`,void 0),e([d({readOnly:!0})],S.prototype,`mode`,null),e([d()],S.prototype,`_focused`,void 0),e([d({readOnly:!0})],S.prototype,`focused`,null),e([d()],S.prototype,`hidden`,void 0),e([d({readOnly:!0})],S.prototype,`outerContainer`,void 0),e([d({readOnly:!0})],S.prototype,`contentContainer`,null),e([d({readOnly:!0})],S.prototype,`effectivePlacement`,null),e([d()],S.prototype,`debug`,void 0),e([d()],S.prototype,`updating`,null),e([d()],S.prototype,`_lastPosition`,void 0),e([d()],S.prototype,`_screenPoint`,null),e([d()],S.prototype,`_rtl`,void 0),e([d()],S.prototype,`_effectiveOffset`,null),e([d()],S.prototype,`_outerContainerStyle`,null),S=e([f(`esri.views.interactive.Tooltip`)],S);function C(e,t,n,r){if(!e||!r.container)return t;let i=e.getBoundingClientRect(),{left:a,top:o}=r.container.getBoundingClientRect(),{x:s,y:c}=t,l=i.left-a-n;l<0&&(s-=l);let d=i.right-a+n-r.width;d>0&&(s-=d);let f=i.top-o-n;f<0&&(c-=f);let p=i.bottom-o+n-r.height;return p>0&&(c-=p),u(s,c)}const w=[`top`,`bottom`,`leading`,`trailing`].flatMap(e=>[T(`${e}-start`),T(e),T(`${e}-end`)]);function T(e){return`${y.base}--${e}`}function E({classList:e},t){w.forEach(t=>e.remove(t)),e.add(T(t))}function D(e){if(e==null)return null;let{tiltX:t,tiltY:n}=e;return t<0&&n<0?x.bottomEnd:t<0&&n>0?x.topEnd:t>0&&n>0?x.topStart:t>0&&n<0?x.bottomStart:null}export{S as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../core/Evented.js";import{on as n}from"../../core/events.js";import{destroyMaybe as r}from"../../core/maybe.js";import{watch as i,syncAndInitial as a,initial as o,when as s,sync as c}from"../../core/reactiveUtils.js";import{cloneScreenPoint as l,createScreenPoint as u}from"../../core/screenUtils.js";import{property as d,subclass as f}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as p}from"../../core/support/UpdatingHandles.js";import{setCalciteModeClass as m}from"../../support/modeUtils.js";import h from"./options/TooltipOptions.js";import{base as g}from"./tooltip/css.js";import{tooltipContentFactory as _}from"./tooltip/content/tooltipContentFactory.js";import{isRTL as v}from"../../widgets/support/widgetUtils.js";const y={base:`${g}`,ltr:`${g}--ltr`,rtl:`${g}--rtl`,debug:`${g}--debug`},b=`bottom-end`,x={topStart:`top-start`,topEnd:`top-end`,bottomStart:`bottom-start`,bottomEnd:`bottom-end`};let S=class extends t{constructor(e){super(e),this.info=null,this.position=null,this.inputModePosition=null,this.content=null,this._focused=!1,this.hidden=!1,this.outerContainer=document.createElement(`div`),this.debug=!1,this._updatingHandles=new p,this._lastPosition=null,this._rtl=!1,this._prevXY=[0,0]}initialize(){let{outerContainer:e}=this;this.addHandles([i(()=>this.view.overlay?.surface,t=>{e.remove(),t?.appendChild(e),this._rtl=v(t)},a),i(()=>this.info,(t,n)=>{if(this.content!=null&&t!=null&&n!=null&&t.type===n.type)this.content.info=t;else{r(this.content);let n=_(this,t);n?(this.content=n,n.container&&e.appendChild(n.container),this.exitInputMode()):this.content=null}},a),i(()=>({container:this.outerContainer,style:this._outerContainerStyle}),({container:e,style:t})=>{Object.assign(e.style,t)},o),i(()=>({outerContainer:this.outerContainer,placement:this.effectivePlacement,effectiveOffset:this._effectiveOffset,rtl:this._rtl,debug:this.debug}),({outerContainer:e,placement:t,effectiveOffset:n,rtl:r,debug:i})=>{let{classList:a}=e;a.add(y.base),a.toggle(y.rtl,r),a.toggle(y.ltr,!r),a.toggle(y.debug,i),this.outerContainer.style.setProperty(`--offset`,`${n}px`),m(e),E(e,t)},o),s(()=>this.mode===`feedback`,()=>{this.inputModePosition=null,this._clearOverride(`effectivePlacement`)},c),s(()=>this.mode===`input`&&this.info?.toolOptions.tooltips.inputEnabled===!1,()=>void this.exitInputMode(),c),n(this.outerContainer,`paste`,e=>{this.emit(`paste`,e)}),n(this.outerContainer,[`focusin`,`focusout`],()=>{this._focused=this.content?.container?.contains(document.activeElement)??!1})])}destroy(){this.info=null,this.content=r(this.content),this.outerContainer.remove(),this._updatingHandles.destroy()}get options(){return this._get(`options`)}set options(e){this._set(`options`,e)}get isInInputMode(){return!!this.inputModePosition}get mode(){return this.content?.mode??`feedback`}get focused(){return this._focused}get visible(){return this._outerContainerStyle.display!==`none`}get contentContainer(){return this.content?.container}get effectivePlacement(){let e=this.options?.placement;return e===`auto`?D(this.view.inputManager?.latestPenInfo)??b:e??b}get updating(){return this._updatingHandles.updating}get _screenPoint(){let{inputManager:e}=this.view;return e?.multiTouchActive?null:e?.latestPointerInfo?.location}get _effectiveOffset(){return this.options?.offset??20}get _outerContainerStyle(){let e=this.inputModePosition??this.position??this._screenPoint;return this._lastPosition=l(e),e!=null&&this.content!=null&&(!this.hidden||this.inputModePosition)?{display:`block`,transform:`translate(${Math.round(e.x)}px, ${Math.round(e.y)}px)`}:{display:`none`,transform:`none`}}clear(){this.info=null}async enterInputMode(e){let t=this.position??this._lastPosition??this._screenPoint,n=this.inputModePosition=l(t),{effectivePlacement:r}=this;this._override(`effectivePlacement`,r),await this._updatingHandles.addPromise(this.content?.enterInputMode(e,()=>{n&&(this.inputModePosition=C(this.contentContainer,n,this._effectiveOffset,this.view),Object.assign(this.outerContainer.style,this._outerContainerStyle))}))}async exitInputMode(e){this.inputModePosition=null,await this._updatingHandles.addPromise(this.content?.exitInputMode(e))}onDragStart(e,t){this._prevXY=[e,t]}onDrag(e,t){let n=e-this._prevXY[0],r=t-this._prevXY[1];this._prevXY=[e,t];let{inputModePosition:i}=this;if(i){let{view:a}=this,o=e-a.position[0],s=t-a.position[1];if(o<0||o>a.width||s<0||s>a.height-16)return;this.inputModePosition=u(i.x+n,i.y+r)}}onDragEnd(){this._prevXY=[0,0]}};e([d({nonNullable:!0})],S.prototype,`view`,void 0),e([d()],S.prototype,`info`,void 0),e([d({type:h})],S.prototype,`options`,null),e([d()],S.prototype,`position`,void 0),e([d()],S.prototype,`inputModePosition`,void 0),e([d()],S.prototype,`isInInputMode`,null),e([d()],S.prototype,`content`,void 0),e([d({readOnly:!0})],S.prototype,`mode`,null),e([d()],S.prototype,`_focused`,void 0),e([d({readOnly:!0})],S.prototype,`focused`,null),e([d()],S.prototype,`hidden`,void 0),e([d({readOnly:!0})],S.prototype,`outerContainer`,void 0),e([d({readOnly:!0})],S.prototype,`contentContainer`,null),e([d({readOnly:!0})],S.prototype,`effectivePlacement`,null),e([d()],S.prototype,`debug`,void 0),e([d()],S.prototype,`updating`,null),e([d()],S.prototype,`_lastPosition`,void 0),e([d()],S.prototype,`_screenPoint`,null),e([d()],S.prototype,`_rtl`,void 0),e([d()],S.prototype,`_effectiveOffset`,null),e([d()],S.prototype,`_outerContainerStyle`,null),S=e([f(`esri.views.interactive.Tooltip`)],S);function C(e,t,n,r){if(!e||!r.container)return t;let i=e.getBoundingClientRect(),{left:a,top:o}=r.container.getBoundingClientRect(),{x:s,y:c}=t,l=i.left-a-n;l<0&&(s-=l);let d=i.right-a+n-r.width;d>0&&(s-=d);let f=i.top-o-n;f<0&&(c-=f);let p=i.bottom-o+n-r.height;return p>0&&(c-=p),u(s,c)}const w=[`top`,`bottom`,`leading`,`trailing`].flatMap(e=>[T(`${e}-start`),T(e),T(`${e}-end`)]);function T(e){return`${y.base}--${e}`}function E({classList:e},t){w.forEach(t=>e.remove(t)),e.add(T(t))}function D(e){if(e==null)return null;let{tiltX:t,tiltY:n}=e;return t<0&&n<0?x.bottomEnd:t<0&&n>0?x.topEnd:t>0&&n>0?x.topStart:t>0&&n<0?x.bottomStart:null}export{S as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{lerp as e,distance as t}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as n}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{absoluteHeightElevationInfo as r}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as i,asVec2 as a,markAsTarget as o,fromValues as s}from"../sketch/normalizedPoint.js";import{SnappingAlgorithm as c}from"./SnappingAlgorithm.js";import"../../../core/RandomLCG.js";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/accessorSupport/watch.js";import"../../../core/accessorSupport/tracking/SimpleTrackingTarget.js";import"../../../core/sql/UnknownTimeZone.js";import"../../../time/constants.js";import"luxon";import"../../../intl/date.js";import"../../../rest/support/Query.js";import"../../input/InputManager.js";import"../keybindings.js";import{squaredScreenDistance as l}from"../../../core/screenUtils.js";import{RightAngleTriangleSnappingCandidate as u}from"./candidates/RightAngleTriangleSnappingCandidate.js";import{vectorToScreenPoint as d}from"../support/viewUtils.js";import{projectPointToCircle as f}from"../../support/geometry2dUtils.js";class p extends c{async snapNewVertex(e,t){let n=t.editGeometryOperations.data.parts.at(-1),r=[];if(!n)return r;let a=n.vertices.length;if(t.editGeometryOperations.data.type!==`polygon`||a<2)return r;let{view:o}=this,s=n.vertices[0],c=n.vertices[a-1];if(c.leftSegment&&c.leftSegment.type!==`line`||c.rightSegment&&c.rightSegment.type!==`line`)return r;let l=i(s.pos,o,t),u=i(c.pos,o,t);return this._processCandidateProposal(l,u,e,t,r),r}async snapExistingVertex(e,t){let n=[],r=t.vertexHandle,{part:a,rightSegment:o,leftSegment:s}=r;if(a.segments.length<2||t.editGeometryOperations.data.type===`polyline`&&(r.index===0||r.index===a.vertices.length-1)||s?.type!==`line`||o&&o.type!==`line`)return n;let c=o?.rightVertex??(a.autoClose?a.getFirstVertex():null);if(!c)return n;let{view:l}=this,u=i(s.leftVertex.pos,l,t),d=i(c.pos,l,t);return this._processCandidateProposal(u,d,e,t,n),n}_processCandidateProposal(n,i,c,p,h){if(!this.exceedsShortLineThreshold(n,i,p))return;let g=e(m,a(n),a(i),.5),_=.5*t(a(n),a(i)),v=f(m,a(c),g,_),y=o(s(v[0],v[1],c[2])),{spatialReference:b,pointer:x}=p,S=d(c,b,r,this.view);if(l(S,d(y,b,r,this.view))<this.squaredProximityThreshold(x)){if(this.isVertical(n,y,p)||this.isVertical(y,i,p))return;h.push(new u({targetPoint:y,point1:n,point2:i,isDraped:p.elevationInfo?.mode===`on-the-ground`}))}}}const m=n();export{p as RightAngleTriangleSnapper};
|
|
2
|
+
import{lerp as e,distance as t}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as n}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{absoluteHeightElevationInfo as r}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as i,asVec2 as a,markAsTarget as o,fromValues as s}from"../sketch/normalizedPoint.js";import{SnappingAlgorithm as c}from"./SnappingAlgorithm.js";import"../../../core/RandomLCG.js";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/accessorSupport/watch.js";import"../../../core/accessorSupport/ObservableBase.js";import"../../../core/accessorSupport/tracking/SimpleTrackingTarget.js";import"../../../core/sql/UnknownTimeZone.js";import"../../../time/constants.js";import"luxon";import"../../../intl/date.js";import"../../../rest/support/Query.js";import"../../input/InputManager.js";import"../keybindings.js";import{squaredScreenDistance as l}from"../../../core/screenUtils.js";import{RightAngleTriangleSnappingCandidate as u}from"./candidates/RightAngleTriangleSnappingCandidate.js";import{vectorToScreenPoint as d}from"../support/viewUtils.js";import{projectPointToCircle as f}from"../../support/geometry2dUtils.js";class p extends c{async snapNewVertex(e,t){let n=t.editGeometryOperations.data.parts.at(-1),r=[];if(!n)return r;let a=n.vertices.length;if(t.editGeometryOperations.data.type!==`polygon`||a<2)return r;let{view:o}=this,s=n.vertices[0],c=n.vertices[a-1];if(c.leftSegment&&c.leftSegment.type!==`line`||c.rightSegment&&c.rightSegment.type!==`line`)return r;let l=i(s.pos,o,t),u=i(c.pos,o,t);return this._processCandidateProposal(l,u,e,t,r),r}async snapExistingVertex(e,t){let n=[],r=t.vertexHandle,{part:a,rightSegment:o,leftSegment:s}=r;if(a.segments.length<2||t.editGeometryOperations.data.type===`polyline`&&(r.index===0||r.index===a.vertices.length-1)||s?.type!==`line`||o&&o.type!==`line`)return n;let c=o?.rightVertex??(a.autoClose?a.getFirstVertex():null);if(!c)return n;let{view:l}=this,u=i(s.leftVertex.pos,l,t),d=i(c.pos,l,t);return this._processCandidateProposal(u,d,e,t,n),n}_processCandidateProposal(n,i,c,p,h){if(!this.exceedsShortLineThreshold(n,i,p))return;let g=e(m,a(n),a(i),.5),_=.5*t(a(n),a(i)),v=f(m,a(c),g,_),y=o(s(v[0],v[1],c[2])),{spatialReference:b,pointer:x}=p,S=d(c,b,r,this.view);if(l(S,d(y,b,r,this.view))<this.squaredProximityThreshold(x)){if(this.isVertical(n,y,p)||this.isVertical(y,i,p))return;h.push(new u({targetPoint:y,point1:n,point2:i,isDraped:p.elevationInfo?.mode===`on-the-ground`}))}}}const m=n();export{p as RightAngleTriangleSnapper};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{getMetersPerUnitForSR as e}from"../../../core/units.js";import{distance as t}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{absoluteHeightElevationInfo as n}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as r,asVec2 as i}from"../sketch/normalizedPoint.js";import{defaults as a}from"./Settings.js";import"../../../core/RandomLCG.js";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/accessorSupport/watch.js";import"../../../core/accessorSupport/tracking/SimpleTrackingTarget.js";import"../../../core/sql/UnknownTimeZone.js";import"../../../time/constants.js";import"luxon";import"../../../intl/date.js";import"../../../rest/support/Query.js";import"../../input/InputManager.js";import"../keybindings.js";import{squaredScreenDistance as o}from"../../../core/screenUtils.js";import{vectorToScreenPoint as s}from"../support/viewUtils.js";class c{constructor(e,t){this.view=e,this.options=t,this.squaredShortLineThreshold=a.shortLineThreshold*a.shortLineThreshold}async snap(e,t){return t.vertexHandle==null?this.snapNewVertex(e,t):t.vertexHandle.type===`vertex`?this.snapExistingVertex(e,t):[]}edgeExceedsShortLineThreshold(e,t){return this.exceedsShortLineThreshold(r(e.leftVertex.pos,this.view,t),r(e.rightVertex.pos,this.view,t),t)}exceedsShortLineThreshold(e,t,{spatialReference:r}){return this.squaredShortLineThreshold===0||o(s(t,r,n,this.view),s(e,r,n,this.view))>this.squaredShortLineThreshold}isVertical(n,r,{spatialReference:o}){let s=e(o);return t(i(n),i(r))*s<a.verticalLineThresholdMeters}squaredProximityThreshold(e){return e===`touch`?this._squaredTouchProximityThreshold:this._squaredMouseProximityThreshold}get _squaredMouseProximityThreshold(){return this.options.distance*this.options.distance}get _squaredTouchProximityThreshold(){let{distance:e,touchSensitivityMultiplier:t}=this.options,n=e*t;return n*n}}export{c as SnappingAlgorithm};
|
|
2
|
+
import{getMetersPerUnitForSR as e}from"../../../core/units.js";import{distance as t}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{absoluteHeightElevationInfo as n}from"../../../support/elevationInfoUtils.js";import{fromAnyMapPoint as r,asVec2 as i}from"../sketch/normalizedPoint.js";import{defaults as a}from"./Settings.js";import"../../../core/RandomLCG.js";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/accessorSupport/watch.js";import"../../../core/accessorSupport/ObservableBase.js";import"../../../core/accessorSupport/tracking/SimpleTrackingTarget.js";import"../../../core/sql/UnknownTimeZone.js";import"../../../time/constants.js";import"luxon";import"../../../intl/date.js";import"../../../rest/support/Query.js";import"../../input/InputManager.js";import"../keybindings.js";import{squaredScreenDistance as o}from"../../../core/screenUtils.js";import{vectorToScreenPoint as s}from"../support/viewUtils.js";class c{constructor(e,t){this.view=e,this.options=t,this.squaredShortLineThreshold=a.shortLineThreshold*a.shortLineThreshold}async snap(e,t){return t.vertexHandle==null?this.snapNewVertex(e,t):t.vertexHandle.type===`vertex`?this.snapExistingVertex(e,t):[]}edgeExceedsShortLineThreshold(e,t){return this.exceedsShortLineThreshold(r(e.leftVertex.pos,this.view,t),r(e.rightVertex.pos,this.view,t),t)}exceedsShortLineThreshold(e,t,{spatialReference:r}){return this.squaredShortLineThreshold===0||o(s(t,r,n,this.view),s(e,r,n,this.view))>this.squaredShortLineThreshold}isVertical(n,r,{spatialReference:o}){let s=e(o);return t(i(n),i(r))*s<a.verticalLineThresholdMeters}squaredProximityThreshold(e){return e===`touch`?this._squaredTouchProximityThreshold:this._squaredMouseProximityThreshold}get _squaredMouseProximityThreshold(){return this.options.distance*this.options.distance}get _squaredTouchProximityThreshold(){let{distance:e,touchSensitivityMultiplier:t}=this.options,n=e*t;return n*n}}export{c as SnappingAlgorithm};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{prefersReducedMotion as t}from"../../../../core/a11yUtils.js";import{on as n}from"../../../../core/events.js";import"../../../../core/has.js";import{memoize as r}from"../../../../core/memoize.js";import{
|
|
2
|
+
import{__decorate as e}from"tslib";import{prefersReducedMotion as t}from"../../../../core/a11yUtils.js";import{on as n}from"../../../../core/events.js";import"../../../../core/has.js";import{memoize as r}from"../../../../core/memoize.js";import{throwIfAborted as i,throwIfNotAbortError as a,after as o}from"../../../../core/promiseUtils.js";import{waitAnimationFrame as s,waitTick as c}from"../../../../core/scheduling.js";import{unitName as l}from"../../../../core/unitFormatUtils.js";import{defaultAreaUnit as u,defaultVerticalLengthUnit as d,defaultLengthUnit as f}from"../../../../core/units.js";import{property as p,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{getDefaultUnitForView as h}from"../../../../support/getDefaultUnitForView.js";import{tooltipKeys as g}from"../../keybindings.js";import{table as _,contentHeader as v,contentHeaderSpacer as y,contentHeaderActions as b,contentInputMode as x,content as S,helpMessageText as C,helpMessageIcon as w,helpMessage as T,drawContentHeaderActions as E}from"../css.js";import{getFormatters as D}from"../fields/parsingAndFormattingUtils.js";import O from"../../../../widgets/Widget.js";import{loadCalciteComponents as k}from"../../../../widgets/support/componentsUtils.js";import{tsx as A,tsxFragment as j,classes as M,messageBundle as N}from"../../../../widgets/support/widget.js";const P=Symbol(`dragHandles`);let F=class extends O{constructor(){super(...arguments),this._focusAbortController=new AbortController,this._transitionInfo=null,this._mode=`feedback`,this._getFormatters=r(D),this._onHeaderPointerDown=e=>{let t=e.target;if(!(t instanceof HTMLElement)||t?.tagName?.toLowerCase()===`calcite-button`)return;this.removeHandles(P),e.preventDefault(),e.stopPropagation();let r=process.env.NODE_ENV!==`test`;r&&t.setPointerCapture(e.pointerId),this.tooltip.onDragStart(e.clientX,e.clientY),this.addHandles([n(t,`pointermove`,({clientX:e,clientY:t})=>{this.tooltip.onDrag(e,t)}),n(t,[`pointerup`,`pointercancel`],n=>{this.removeHandles(P),r&&t.releasePointerCapture(e.pointerId),this.tooltip.onDragEnd()}),n(t,`touchstart`,e=>e.preventDefault())],P)},this._onDiscard=()=>{this.destroyed||(this.tooltip.emit(`discard`),this.info.clearInputValues(),this.exitInputMode())},this._onCommit=(e,t)=>{if(this.destroyed)return;if(this.tooltip.emit(`commit`,{type:t}),t===`commit-and-exit`){this.exitInputMode();return}if(t===`commit-on-blur`)return;let n=this._getFocusableElements(),r=n.length,i=n.indexOf(e);if(i===-1){this.exitInputMode();return}let a=((i+(t===`commit-and-next`?1:-1))%r+r)%r;I(n.at(a))},this._onKeyDown=e=>{switch(e.code){case g.next:return this._onNextKey(e);case g.discard:return e.stopPropagation(),this._onDiscard()}}}get mode(){return this._mode}get _displayUnits(){let{displayUnits:e}=this.info.toolOptions.values,t=h(this.tooltip.view);return{length:e.length??t,verticalLength:e.verticalLength??t,area:e.area??t}}get _inputUnitInfos(){let e=this._messagesUnits,t=t=>({unit:t,abbreviation:l(e,t,`abbr`)}),{inputUnits:n}=this.info.toolOptions.values,r=h(this.tooltip.view),i=n.length??r,a=n.verticalLength??r,o=n.area??r;return{length:t(f(i)),verticalLength:t(d(a)),area:t(u(o)),angle:t(`degrees`)}}get _formatters(){return this._getFormatters(this._messagesUnits,this._displayUnits)}get _elevationModeContext(){let{elevationModeContext:e}=this.info;return e&&{get mode(){return e.mode},get disabled(){return e.disabled},onChange:t=>{for(let e of this.info.editableFields){let t=this.domNode?.querySelector(`[data-field-id="${e.id}"]`);e.dirty&&t&&e.onCommit(`commit-on-blur`,t,this.fieldContext)}this.info.editableFields.some(e=>e.invalid)||e.onChange(t)}}}get fieldContext(){return{formatters:this._formatters,inputUnitInfos:this._inputUnitInfos,messages:this._messagesTooltip,toolOptions:this.info.toolOptions,elevationModeContext:this._elevationModeContext,topLayerDisabled:this.topLayerDisabled,onCommit:this._onCommit,onDiscard:this._onDiscard}}render(){let{visibleElements:e}=this.info.toolOptions.tooltips,t=this._renderedContent,n=this._renderedActions,r=this._renderedHelpMessage,i=t.length>0,a=i||!!r,o=this.mode===`input`;return A(`div`,{class:M(S,o&&x),tabIndex:-1,onkeydown:this._onKeyDown},o&&a&&e.header?A(`div`,{class:v,"data-testid":`tooltip-header`,key:`header`,onpointerdown:this._onHeaderPointerDown},A(`calcite-button`,{appearance:`transparent`,"data-testid":`tooltip-back-button`,iconFlipRtl:`both`,iconStart:`chevron-left`,key:`discard-button`,kind:`neutral`,scale:`s`,tabIndex:-1,onclick:this._onDiscard}),n.length>0?A(j,null,A(`div`,{class:y,key:`spacer`}),A(`div`,{class:b,key:`actions`},n)):null):null,i?A(`div`,{class:_,key:`content`},...t):null,r)}destroy(){this._focusAbortController.abort(),this._transitionInfo?.transition.skipTransition()}_renderActions(){return null}loadDependencies(){return k({button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),icon:()=>import(`@esri/calcite-components/dist/components/calcite-icon`),input:()=>import(`@esri/calcite-components/dist/components/calcite-input`)})}async enterInputMode(e,t){this._focusAbortController.abort(),this._focusAbortController=new AbortController;let{signal:n}=this._focusAbortController;try{await this._transitionTo(`input`,t,n),i(n),await this._focusField(n,e)}catch(e){a(e)}}async exitInputMode({focusOnView:e=!0}={}){this._focusAbortController.abort();try{let{container:t,info:n}=this;n.clearInputValues();let r=e?t?.closest(`.esri-view`)?.querySelector(`.esri-view-surface`):null;await this._transitionTo(`feedback`),r instanceof HTMLElement&&r.focus()}catch(e){a(e)}}_onNextKey(e){let t=this._getFocusableElements(),n=t.at(0),r=t.at(-1);n&&r&&(e.shiftKey?document.activeElement===n&&(e.preventDefault(),e.stopPropagation(),I(r)):document.activeElement===r&&(e.preventDefault(),e.stopPropagation(),I(n)))}get _renderedContent(){return L(this._renderContent())}get _renderedActions(){return L(this._renderActions())}get _renderedHelpMessage(){let{toolOptions:e,visibleElements:t}=this.info;if(!t.helpMessage)return null;let n=e.tooltips.helpMessage??this._defaultHelpMessage;if(!n)return null;let r=e.tooltips.helpMessageIcon??`information`;return A(`div`,{class:T,key:`help-message`},r?A(`calcite-icon`,{class:w,icon:r,scale:`s`}):null,A(`div`,{class:C},n))}get _defaultHelpMessage(){let{helpMessage:e,viewType:t}=this.info;if(e==null)return null;let n=t===`3d`?`helpMessages3d`:`helpMessages2d`;return this._messagesTooltip?.sketch?.[n]?.[e]}async _focusField(e,t){await this._waitForInputs(e),i(e);let n=this._getFocusableFields();await I(t?n.find(e=>e.getAttribute(`data-field-name`)===t):n.at(0))}async _transitionTo(e,n,r){if(this._mode===e&&!this._transitionInfo)return;if(this._transitionInfo?.mode===e&&!this._transitionInfo.signal?.aborted)return this._transitionInfo.transition.finished;this._transitionInfo?.transition.skipTransition();let i=async()=>{this.destroyed||r?.aborted||(this._mode=e,await c(),this.destroyed||r?.aborted||(this.renderNow(),await c(),this.destroyed||r?.aborted||n?.()))};if(process.env.NODE_ENV===`test`||!this.domNode?.firstChild||!document.startViewTransition||t()){await i();return}this.autoRenderingEnabled=!1;let a=this._transitionInfo={transition:document.startViewTransition(async()=>{this.destroyed||a!==this._transitionInfo||(this.autoRenderingEnabled=!0,await i())}),mode:e,signal:r};try{await a.transition.finished}finally{a===this._transitionInfo&&(this._transitionInfo=null)}}async _waitForInputs(e){let t=()=>Array.from(this.domNode?.querySelectorAll(`calcite-input`)??[]);for(;t().length===0;)await o(R,void 0,e);await s()}_getFocusableFields(){let e=Array.from(this.domNode?.querySelectorAll(`calcite-input:not([read-only]):not([disabled])`)??[]),t=Array.from(this.domNode?.querySelectorAll(`[data-tooltip-inline-control]:not([disabled])`)??[]);return[...e,...t]}_getFocusableElements(){let e=this.domNode?.querySelector(`.${E}`);return[...Array.from(e?.querySelectorAll(`.${b} calcite-button:not([disabled])`)??[]),...this._getFocusableFields()]}};e([N(`esri/core/t9n/Units`),p()],F.prototype,`_messagesUnits`,void 0),e([N(`esri/views/interactive/tooltip/t9n/Tooltip`),p()],F.prototype,`_messagesTooltip`,void 0),e([p()],F.prototype,`info`,void 0),e([p()],F.prototype,`tooltip`,void 0),e([p()],F.prototype,`_mode`,void 0),e([p()],F.prototype,`mode`,null),e([p()],F.prototype,`_displayUnits`,null),e([p()],F.prototype,`_inputUnitInfos`,null),e([p()],F.prototype,`_formatters`,null),e([p()],F.prototype,`_elevationModeContext`,null),e([p()],F.prototype,`fieldContext`,null),e([p()],F.prototype,`_renderedContent`,null),e([p()],F.prototype,`_renderedActions`,null),e([p()],F.prototype,`_renderedHelpMessage`,null),e([p()],F.prototype,`_defaultHelpMessage`,null),F=e([m(`esri.views.interactive.tooltip.content.TooltipContent`)],F);async function I(e){await e?.componentOnReady?.(),await e?.setFocus()}function L(e){return(Array.isArray(e)?e:[e]).flat(10).filter(e=>!!e)}const R=20;export{F as TooltipContent};
|
|
@@ -20,6 +20,7 @@ import type { PointSymbol3DProperties } from "../../symbols/PointSymbol3D.js";
|
|
|
20
20
|
import type { PictureMarkerSymbolProperties } from "../../symbols/PictureMarkerSymbol.js";
|
|
21
21
|
import type { SimpleMarkerSymbolProperties } from "../../symbols/SimpleMarkerSymbol.js";
|
|
22
22
|
|
|
23
|
+
/** @deprecated since 5.2. Use [CoordinateConversionModelProperties](https://developers.arcgis.com/javascript/latest/references/core/geometry/coordinateConversion/CoordinateConversionModel/#CoordinateConversionModelProperties) instead. */
|
|
23
24
|
export interface CoordinateConversionViewModelProperties extends GoToProperties, Partial<Pick<CoordinateConversionViewModel, "calculateCoordinatePrecision" | "mode" | "removeLeadingZeros" | "storageEnabled" | "storageType" | "verticalUnit" | "view">> {
|
|
24
25
|
/**
|
|
25
26
|
* A [Collection](https://developers.arcgis.com/javascript/latest/references/core/core/Collection/) containing every [Conversion](https://developers.arcgis.com/javascript/latest/references/core/widgets/CoordinateConversion/support/Conversion/)
|
|
@@ -52,11 +53,13 @@ export interface CoordinateConversionViewModelProperties extends GoToProperties,
|
|
|
52
53
|
locationSymbol?: (SimpleMarkerSymbolProperties & { type: "simple-marker" }) | (PictureMarkerSymbolProperties & { type: "picture-marker" }) | (PointSymbol3DProperties & { type: "point-3d" }) | (CIMSymbolProperties & { type: "cim" });
|
|
53
54
|
}
|
|
54
55
|
|
|
56
|
+
/** @deprecated since 5.2. Use [CoordinateConversionModelState](https://developers.arcgis.com/javascript/latest/references/core/geometry/coordinateConversion/CoordinateConversionModel/#CoordinateConversionModelState) instead. */
|
|
55
57
|
export type CoordinateConversionViewModelState = "ready" | "loading" | "disabled";
|
|
56
58
|
|
|
57
59
|
/**
|
|
58
60
|
* Provides the logic for the [CoordinateConversion](https://developers.arcgis.com/javascript/latest/references/core/widgets/CoordinateConversion/) widget and [component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-coordinate-conversion/).
|
|
59
61
|
*
|
|
62
|
+
* @deprecated since 5.2. Use [CoordinateConversionModel](https://developers.arcgis.com/javascript/latest/references/core/geometry/coordinateConversion/CoordinateConversionModel/) instead.
|
|
60
63
|
* @since 4.7
|
|
61
64
|
* @see [CoordinateConversion widget](https://developers.arcgis.com/javascript/latest/references/core/widgets/CoordinateConversion/) - _Deprecated since 4.34. Use the [Coordinate Conversion component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-coordinate-conversion/) instead._
|
|
62
65
|
* @see [Coordinate Conversion component](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-coordinate-conversion/)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{getAssetUrl as t}from"../../assets.js";import n from"../../Graphic.js";import{onLocaleChange as r,getLocale as i,fetchMessageBundle as a}from"../../intl.js";import o from"../../core/Collection.js";import s from"../../core/Error.js";import{EventedAccessor as c}from"../../core/Evented.js";import l from"../../core/Logger.js";import{watch as u,initial as d,when as f,whenOnce as p}from"../../core/reactiveUtils.js";import{property as m,subclass as h}from"../../core/accessorSupport/decorators.js";import{ensureType as g}from"../../core/accessorSupport/ensureType.js";import _ from"../../geometry/Point.js";import{load as v}from"../../geometry/projectionUtils.js";import y from"../../symbols/IconSymbol3DLayer.js";import b from"../../symbols/PictureMarkerSymbol.js";import x from"../../symbols/PointSymbol3D.js";import{pointSymbolTypes as S}from"../../symbols/support/typeUtils.js";import C from"./support/Conversion.js";import{isValidPoint as w,isSupportedNotation as T}from"./support/coordinateConversionUtils.js";import E from"./support/Format.js";import{generateDefaultFormats as D,setDefaultPatterns as O}from"./support/formatUtils.js";import{GoTo as k}from"../support/GoTo.js";const A=new _([0,0,500]),j=[`mgrs`,`utm`,`usng`,`dd`,`dms`,`ddm`],M=`esri__coordinateConversionWidgetState`,N={conversions:`conversions`,formats:`formats`,view:`view`,viewChange:`view-change`,cursor:`cursor`};let P=class extends k(c){constructor(e){super(e),this._conversionPromise=null,this._locationGraphic=null,this._pointerCount=0,this.calculateCoordinatePrecision=!0,this.formats=new o,this.formatterAvailable=!1,this.formatterLoading=!0,this.messages=null,this.filteredFormats=new o,this.removeLeadingZeros=!1,this.storageEnabled=!0,this.storageType=`session`,this.view=null,this._saveWidgetState=this._saveWidgetState.bind(this),this._handleFormatChange=this._handleFormatChange.bind(this),this._handleConversionChange=this._handleConversionChange.bind(this),this._handleViewChange=this._handleViewChange.bind(this),this._onClick=this._onClick.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this.conversions=new o}initialize(){let e=async()=>this.messages=await a(`esri/widgets/CoordinateConversion/t9n/CoordinateConversion`);this.formats.addMany(D()),e().then(()=>{this.destroyed||(O(this.messages,this.formats),this.storageEnabled&&this._loadWidgetState(),this.formats.forEach(e=>{e.viewModel=this,this.addHandles(u(()=>e.currentPattern,this._saveWidgetState),e.name??`unnamed-format`)}),this.addHandles(this.conversions.on(`change`,this._handleConversionChange),N.conversions),this.addHandles(this.formats.on(`change`,this._handleFormatChange),N.formats),this.addHandles(u(()=>this.verticalUnit,this._saveWidgetState)),this.addHandles(r(()=>{e().then(()=>{O(this.messages,this.formats)})})),v().then(()=>{this.formatterAvailable=!0}).catch(e=>{l.getLogger(this).error(new s(`coordinate-conversion:projection-load-failed`,`Failed to load the projection module.`,{error:e})),this.formatterAvailable=!1,this._filterFormatsAndConversions()}).then(()=>this.addHandles(u(()=>this.view,this._handleViewChange,d),N.viewChange)).finally(()=>this.formatterLoading=!1),this.conversions.length===0&&this._addDefaultConversion())})}destroy(){this.removeHandles(),this._cleanUpView(this.view),this.view=null}get conversions(){return this._get(`conversions`)}set conversions(e){let t=new o;e.forEach(e=>{let n=null;if(typeof e==`string`){let t=this.formats.find(t=>t.name===e);t&&(n=new C({format:t}))}else n=g(C,e);n&&t.add(n)}),this._set(`conversions`,t)}set currentLocation(e){this._set(`currentLocation`,e),this._updateConversions()}get currentLocation(){return this._get(`currentLocation`)||null}set mode(e){switch(e){case`capture`:this.currentLocation=null,this._startCaptureMode(),this._set(`mode`,e);break;case`live`:this._startLiveMode(),this._set(`mode`,e);break;case`idle`:this.removeHandles(N.view),this.removeHandles(N.cursor),this._set(`mode`,e)}}get mode(){return this._get(`mode`)||`live`}get state(){let{messages:e,view:t}=this,n=t?.ready;return e?n?`ready`:t?`loading`:`disabled`:`disabled`}get locationSymbol(){let e=this._userLocationSymbol;if(e)return e;let n=t(`esri/images/search/search-symbol-32.png`);return this.view?.type===`3d`?new x({symbolLayers:new o([new y({occludedVisibility:{mode:`visible`},resource:{href:n},size:24})])}):new b({url:n,width:24,height:24})}set locationSymbol(e){this._userLocationSymbol=e}get storage(){return this.storageType===`session`?sessionStorage:localStorage}get waitingForConversions(){return this._conversionPromise!=null}setLocation(e){this._locationGraphic&&this.view?.graphics.remove(this._locationGraphic),e&&(this._locationGraphic=new n({geometry:e.clone(),symbol:this.locationSymbol}),this.view?.graphics.add(this._locationGraphic))}async convert(e,t){if(!w(t))throw new s(`coordinate-conversion:invalid-point`,`Invalid point cannot be converted.`,{point:t});return await this._waitForFormatter(),Promise.resolve().then(()=>e.convert(t))}async goToLocation(e){let{view:t}=this;if(!t)throw new s(`coordinate-conversion:go-to-failed`,`no view`);let n=t.type===`3d`?t.clippingArea:null,r=t.map?.basemap?.baseLayers;if(n||(r?.length??0)>0){let t=n??r?.at(0)?.fullExtent;if(t!=null&&!t.contains(e))throw new s(`coordinate-conversion:go-to-failed`,`Point outside basemap extent.`,{point:e})}return this.callGoTo({target:e})}pause(){this.currentLocation=null,this.removeHandles(N.view),this.view&&(this.removeHandles(N.cursor),this._locationGraphic&&this.view.graphics.remove(this._locationGraphic))}async previewConversion(e,t=this.currentLocation||A){return(await F(e,t)).displayCoordinate}resume(){let{mode:e}=this;e===`capture`?this._startCaptureMode():this._startLiveMode()}async reverseConvert(e,t){return await this._waitForFormatter(),t.reverseConvert(e)}async updateConversions(e,t){if(await this._waitForFormatter(),t?.type!==`point`)throw this._clearConversions(this.conversions),new s(`coordinate-conversion:invalid-input-point`,`Point is invalid, conversions cannot be updated.`,{point:t});return this._convertMany(e,t)}_addDefaultConversion(){let e=this.formats.find(e=>e.name===`xy`)||this.formats.at(0);e&&this.conversions.add(new C({format:e}))}_cleanUpView(e){e&&(this._locationGraphic&&e.graphics.remove(this._locationGraphic),this.removeHandles(N.view),this.removeHandles(N.cursor))}_clearConversions(e){e.forEach(e=>{e.position={location:null,coordinate:null}})}async _convertMany(e,t){return Promise.all(e.map(e=>F(e,t)))}_handleConversionChange(e){for(let t of e.added){let{format:e}=t;e&&(e.viewModel=this,this.currentLocation&&(this._set(`waitingForConversions`,!0),this.convert(e,this.currentLocation).then(e=>{t.position=e,this._set(`waitingForConversions`,!1)})))}this._saveWidgetState()}_handleFormatChange(e){e.added.forEach(e=>{this.addHandles(u(()=>e.currentPattern,this._saveWidgetState),e.name??`unnamed-format`),e.viewModel=this}),e.removed.forEach(e=>{e.viewModel=null;let t=this.conversions.filter(t=>t.format===e);this.conversions.removeMany(t),e.name&&this.removeHandles(e.name)}),this.conversions.length===0&&this._addDefaultConversion()}_loadWidgetState(){try{let e=JSON.parse(this.storage.getItem(M));e&&this._setWidgetState(e)}catch(e){l.getLogger(this).error(new s(`coordinate-conversion:invalid-session-storage-json`,`Could not read from storage.`,{error:e}))}}_startCaptureMode(){this.removeHandles(N.view),this.view&&(this.currentLocation&&this.setLocation(this.currentLocation),this.removeHandles(N.cursor),this.addHandles(this.view.acquireCursor(`crosshair`,`high`),N.cursor),this.addHandles(this.view.on(`click`,this._onClick),N.view))}_startIdleMode(){this.removeHandles(N.view),this.removeHandles(N.cursor),this.view&&this.currentLocation&&this.setLocation(this.currentLocation)}_startLiveMode(){this._pointerCount=0,this.removeHandles(N.view),this.view&&(this.removeHandles(N.cursor),this._locationGraphic&&this.view.graphics.remove(this._locationGraphic),this.addHandles([this.view.on(`pointer-down`,this._onPointerDown),this.view.on(`pointer-up`,this._onPointerUp),this.view.on(`pointer-move`,this._onPointerMove)],N.view))}_handleViewChange(e,t){if(t&&t!==e&&this._cleanUpView(t),e){let{mode:e}=this;e===`capture`?this._startCaptureMode():e===`live`?this._startLiveMode():e===`idle`&&this._startIdleMode(),t&&this._filterFormatsAndConversions()}}_onClick(e){if(e.button===0){let t=(this.view?.toMap(e,{exclude:[],excludeLabels:!0}))?.normalize();this.setLocation(t),this.currentLocation=t}}_onPointerDown(e){let{pointerType:t}=e;if(this._pointerCount++,(t===`touch`||t===`pen`)&&this._pointerCount===1){let t=this.view?.toMap(e,{exclude:[],excludeLabels:!0});this.currentLocation=t?.normalize()}}_onPointerMove(e){let{pointerType:t}=e;if(t===`mouse`||this._pointerCount===1){let t=this.view?.toMap(e,{exclude:[],excludeLabels:!0});this.currentLocation=t?.normalize()}}_onPointerUp(){this._pointerCount--}_setWidgetState(e){try{this.verticalUnit=e.verticalUnit,e.formats.forEach(t=>{let n=this.formats.find(e=>e.name===t.name);n&&e.locale===i()&&t.currentPattern&&(n.currentPattern=t.currentPattern),n&&t.index>=0&&this.conversions.add(new C({format:n}))})}catch(e){l.getLogger(this).warn(new s(`coordinate-conversion:session-storage-read-error`,`Could not get state from stored JSON.`,{error:e}))}}_saveWidgetState(){if(!this.storageEnabled)return;let e=this._getFormatsJson();try{this.storage.setItem(M,JSON.stringify({formats:e,locale:i(),verticalUnit:this.verticalUnit}))}catch(e){l.getLogger(this).error(new s(`coordinate-conversion:local-storage-write-error`,`Could not write to localStorage.`,{error:e}))}}async _updateConversions(){try{await this.updateConversions(this.conversions.toArray(),this.currentLocation)}catch{}}_getFormatsJson(){return this.formats.filter(e=>{let t=e.name;return t===`xy`||t===`basemap`||T(t)}).map(e=>({name:e.name,currentPattern:e.currentPattern,defaultPattern:e.defaultPattern,index:this.conversions.findIndex(t=>t.format===e)})).sort((e,t)=>e.index-t.index).toArray()}_filterFormatsAndConversions(){let{formatterAvailable:e,conversions:t,formats:n}=this;e||this.addHandles(f(()=>this.view?.spatialReference,e=>{let r=e.isWebMercator||e.isWGS84,i=n.filter(e=>{let{name:t}=e;return I(t)?!0:t===`xy`&&!r}),a=this.filteredFormats.filter(e=>e.name===`xy`&&r&&!this.formats.includes(e)),o=t.filter(e=>i.includes(e.format));n.removeMany(i),t.removeMany(o),this.filteredFormats.addMany(i.filter(e=>!this.filteredFormats.includes(e))),n.addMany(a)},{once:!0,initial:!0}),N.view)}async _waitForFormatter(){this.formatterLoading&&await p(()=>this.formatterLoading===!1)}};e([m({types:S})],P.prototype,`_userLocationSymbol`,void 0),e([m()],P.prototype,`calculateCoordinatePrecision`,void 0),e([m()],P.prototype,`conversions`,null),e([m({type:_})],P.prototype,`currentLocation`,null),e([m({type:o.ofType(E)})],P.prototype,`formats`,void 0),e([m()],P.prototype,`formatterLoading`,void 0),e([m()],P.prototype,`messages`,void 0),e([m()],P.prototype,`mode`,null),e([m()],P.prototype,`filteredFormats`,void 0),e([m({readOnly:!0})],P.prototype,`state`,null),e([m({types:S})],P.prototype,`locationSymbol`,null),e([m()],P.prototype,`removeLeadingZeros`,void 0),e([m({readOnly:!0})],P.prototype,`storage`,null),e([m()],P.prototype,`storageEnabled`,void 0),e([m()],P.prototype,`storageType`,void 0),e([m()],P.prototype,`verticalUnit`,void 0),e([m({readOnly:!0})],P.prototype,`waitingForConversions`,null),e([m()],P.prototype,`view`,void 0),P=e([h(`esri.widgets.CoordinateConversion.CoordinateConversionViewModel`)],P);async function F(e,t){try{e.position=await e.format?.convert(t)}catch{e.position=null}return e}function I(e){return j.includes(e)}const L=P;export{L as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{getAssetUrl as t}from"../../assets.js";import n from"../../Graphic.js";import{onLocaleChange as r,getLocale as i,fetchMessageBundle as a}from"../../intl.js";import o from"../../core/Collection.js";import{deprecatedModule as s}from"../../core/deprecate.js";import c from"../../core/Error.js";import{EventedAccessor as l}from"../../core/Evented.js";import u from"../../core/Logger.js";import{watch as d,initial as f,when as p,whenOnce as m}from"../../core/reactiveUtils.js";import{property as h,subclass as g}from"../../core/accessorSupport/decorators.js";import{ensureType as _}from"../../core/accessorSupport/ensureType.js";import v from"../../geometry/Point.js";import{load as y}from"../../geometry/projectionUtils.js";import b from"../../symbols/IconSymbol3DLayer.js";import x from"../../symbols/PictureMarkerSymbol.js";import S from"../../symbols/PointSymbol3D.js";import{pointSymbolTypes as C}from"../../symbols/support/typeUtils.js";import w from"./support/Conversion.js";import{isValidPoint as T,isSupportedNotation as E}from"./support/coordinateConversionUtils.js";import D from"./support/Format.js";import{generateDefaultFormats as O,setDefaultPatterns as k}from"./support/formatUtils.js";import{GoTo as A}from"../support/GoTo.js";const j=new v([0,0,500]),M=[`mgrs`,`utm`,`usng`,`dd`,`dms`,`ddm`],N=`esri__coordinateConversionWidgetState`,P={conversions:`conversions`,formats:`formats`,view:`view`,viewChange:`view-change`,cursor:`cursor`};let F=class extends A(l){constructor(e){let{suppressDeprecationWarning:t,...n}=e??{};super(n),this._conversionPromise=null,this._locationGraphic=null,this._pointerCount=0,this.calculateCoordinatePrecision=!0,this.formats=new o,this.formatterAvailable=!1,this.formatterLoading=!0,this.messages=null,this.filteredFormats=new o,this.removeLeadingZeros=!1,this.storageEnabled=!0,this.storageType=`session`,this.view=null,t||s(u.getLogger(this),`esri.widgets.CoordinateConversion.CoordinateConversionViewModel`,{version:`5.2`,replacement:`Use the Coordinate Conversion component or the @arcgis/core/geometry/coordinateConversion/CoordinateConversionModel module instead.`,see:`https://next.gha.afd.arcgis.com/javascript/latest/references/core/geometry/coordinateConversion/CoordinateConversionModel/`,warnOnce:!0}),this._saveWidgetState=this._saveWidgetState.bind(this),this._handleFormatChange=this._handleFormatChange.bind(this),this._handleConversionChange=this._handleConversionChange.bind(this),this._handleViewChange=this._handleViewChange.bind(this),this._onClick=this._onClick.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this.conversions=new o}initialize(){let e=async()=>this.messages=await a(`esri/widgets/CoordinateConversion/t9n/CoordinateConversion`);this.formats.addMany(O()),e().then(()=>{this.destroyed||(k(this.messages,this.formats),this.storageEnabled&&this._loadWidgetState(),this.formats.forEach(e=>{e.viewModel=this,this.addHandles(d(()=>e.currentPattern,this._saveWidgetState),e.name??`unnamed-format`)}),this.addHandles(this.conversions.on(`change`,this._handleConversionChange),P.conversions),this.addHandles(this.formats.on(`change`,this._handleFormatChange),P.formats),this.addHandles(d(()=>this.verticalUnit,this._saveWidgetState)),this.addHandles(r(()=>{e().then(()=>{k(this.messages,this.formats)})})),y().then(()=>{this.formatterAvailable=!0}).catch(e=>{u.getLogger(this).error(new c(`coordinate-conversion:projection-load-failed`,`Failed to load the projection module.`,{error:e})),this.formatterAvailable=!1,this._filterFormatsAndConversions()}).then(()=>this.addHandles(d(()=>this.view,this._handleViewChange,f),P.viewChange)).finally(()=>this.formatterLoading=!1),this.conversions.length===0&&this._addDefaultConversion())})}destroy(){this.removeHandles(),this._cleanUpView(this.view),this.view=null}get conversions(){return this._get(`conversions`)}set conversions(e){let t=new o;e.forEach(e=>{let n=null;if(typeof e==`string`){let t=this.formats.find(t=>t.name===e);t&&(n=new w({format:t}))}else n=_(w,e);n&&t.add(n)}),this._set(`conversions`,t)}set currentLocation(e){this._set(`currentLocation`,e),this._updateConversions()}get currentLocation(){return this._get(`currentLocation`)||null}set mode(e){switch(e){case`capture`:this.currentLocation=null,this._startCaptureMode(),this._set(`mode`,e);break;case`live`:this._startLiveMode(),this._set(`mode`,e);break;case`idle`:this.removeHandles(P.view),this.removeHandles(P.cursor),this._set(`mode`,e)}}get mode(){return this._get(`mode`)||`live`}get state(){let{messages:e,view:t}=this,n=t?.ready;return e?n?`ready`:t?`loading`:`disabled`:`disabled`}get locationSymbol(){let e=this._userLocationSymbol;if(e)return e;let n=t(`esri/images/search/search-symbol-32.png`);return this.view?.type===`3d`?new S({symbolLayers:new o([new b({occludedVisibility:{mode:`visible`},resource:{href:n},size:24})])}):new x({url:n,width:24,height:24})}set locationSymbol(e){this._userLocationSymbol=e}get storage(){return this.storageType===`session`?sessionStorage:localStorage}get waitingForConversions(){return this._conversionPromise!=null}setLocation(e){this._locationGraphic&&this.view?.graphics.remove(this._locationGraphic),e&&(this._locationGraphic=new n({geometry:e.clone(),symbol:this.locationSymbol}),this.view?.graphics.add(this._locationGraphic))}async convert(e,t){if(!T(t))throw new c(`coordinate-conversion:invalid-point`,`Invalid point cannot be converted.`,{point:t});return await this._waitForFormatter(),Promise.resolve().then(()=>e.convert(t))}async goToLocation(e){let{view:t}=this;if(!t)throw new c(`coordinate-conversion:go-to-failed`,`no view`);let n=t.type===`3d`?t.clippingArea:null,r=t.map?.basemap?.baseLayers;if(n||(r?.length??0)>0){let t=n??r?.at(0)?.fullExtent;if(t!=null&&!t.contains(e))throw new c(`coordinate-conversion:go-to-failed`,`Point outside basemap extent.`,{point:e})}return this.callGoTo({target:e})}pause(){this.currentLocation=null,this.removeHandles(P.view),this.view&&(this.removeHandles(P.cursor),this._locationGraphic&&this.view.graphics.remove(this._locationGraphic))}async previewConversion(e,t=this.currentLocation||j){return(await I(e,t)).displayCoordinate}resume(){let{mode:e}=this;e===`capture`?this._startCaptureMode():this._startLiveMode()}async reverseConvert(e,t){return await this._waitForFormatter(),t.reverseConvert(e)}async updateConversions(e,t){if(await this._waitForFormatter(),t?.type!==`point`)throw this._clearConversions(this.conversions),new c(`coordinate-conversion:invalid-input-point`,`Point is invalid, conversions cannot be updated.`,{point:t});return this._convertMany(e,t)}_addDefaultConversion(){let e=this.formats.find(e=>e.name===`xy`)||this.formats.at(0);e&&this.conversions.add(new w({format:e}))}_cleanUpView(e){e&&(this._locationGraphic&&e.graphics.remove(this._locationGraphic),this.removeHandles(P.view),this.removeHandles(P.cursor))}_clearConversions(e){e.forEach(e=>{e.position={location:null,coordinate:null}})}async _convertMany(e,t){return Promise.all(e.map(e=>I(e,t)))}_handleConversionChange(e){for(let t of e.added){let{format:e}=t;e&&(e.viewModel=this,this.currentLocation&&(this._set(`waitingForConversions`,!0),this.convert(e,this.currentLocation).then(e=>{t.position=e,this._set(`waitingForConversions`,!1)})))}this._saveWidgetState()}_handleFormatChange(e){e.added.forEach(e=>{this.addHandles(d(()=>e.currentPattern,this._saveWidgetState),e.name??`unnamed-format`),e.viewModel=this}),e.removed.forEach(e=>{e.viewModel=null;let t=this.conversions.filter(t=>t.format===e);this.conversions.removeMany(t),e.name&&this.removeHandles(e.name)}),this.conversions.length===0&&this._addDefaultConversion()}_loadWidgetState(){try{let e=JSON.parse(this.storage.getItem(N));e&&this._setWidgetState(e)}catch(e){u.getLogger(this).error(new c(`coordinate-conversion:invalid-session-storage-json`,`Could not read from storage.`,{error:e}))}}_startCaptureMode(){this.removeHandles(P.view),this.view&&(this.currentLocation&&this.setLocation(this.currentLocation),this.removeHandles(P.cursor),this.addHandles(this.view.acquireCursor(`crosshair`,`high`),P.cursor),this.addHandles(this.view.on(`click`,this._onClick),P.view))}_startIdleMode(){this.removeHandles(P.view),this.removeHandles(P.cursor),this.view&&this.currentLocation&&this.setLocation(this.currentLocation)}_startLiveMode(){this._pointerCount=0,this.removeHandles(P.view),this.view&&(this.removeHandles(P.cursor),this._locationGraphic&&this.view.graphics.remove(this._locationGraphic),this.addHandles([this.view.on(`pointer-down`,this._onPointerDown),this.view.on(`pointer-up`,this._onPointerUp),this.view.on(`pointer-move`,this._onPointerMove)],P.view))}_handleViewChange(e,t){if(t&&t!==e&&this._cleanUpView(t),e){let{mode:e}=this;e===`capture`?this._startCaptureMode():e===`live`?this._startLiveMode():e===`idle`&&this._startIdleMode(),t&&this._filterFormatsAndConversions()}}_onClick(e){if(e.button===0){let t=(this.view?.toMap(e,{exclude:[],excludeLabels:!0}))?.normalize();this.setLocation(t),this.currentLocation=t}}_onPointerDown(e){let{pointerType:t}=e;if(this._pointerCount++,(t===`touch`||t===`pen`)&&this._pointerCount===1){let t=this.view?.toMap(e,{exclude:[],excludeLabels:!0});this.currentLocation=t?.normalize()}}_onPointerMove(e){let{pointerType:t}=e;if(t===`mouse`||this._pointerCount===1){let t=this.view?.toMap(e,{exclude:[],excludeLabels:!0});this.currentLocation=t?.normalize()}}_onPointerUp(){this._pointerCount--}_setWidgetState(e){try{this.verticalUnit=e.verticalUnit,e.formats.forEach(t=>{let n=this.formats.find(e=>e.name===t.name);n&&e.locale===i()&&t.currentPattern&&(n.currentPattern=t.currentPattern),n&&t.index>=0&&this.conversions.add(new w({format:n}))})}catch(e){u.getLogger(this).warn(new c(`coordinate-conversion:session-storage-read-error`,`Could not get state from stored JSON.`,{error:e}))}}_saveWidgetState(){if(!this.storageEnabled)return;let e=this._getFormatsJson();try{this.storage.setItem(N,JSON.stringify({formats:e,locale:i(),verticalUnit:this.verticalUnit}))}catch(e){u.getLogger(this).error(new c(`coordinate-conversion:local-storage-write-error`,`Could not write to localStorage.`,{error:e}))}}async _updateConversions(){try{await this.updateConversions(this.conversions.toArray(),this.currentLocation)}catch{}}_getFormatsJson(){return this.formats.filter(e=>{let t=e.name;return t===`xy`||t===`basemap`||E(t)}).map(e=>({name:e.name,currentPattern:e.currentPattern,defaultPattern:e.defaultPattern,index:this.conversions.findIndex(t=>t.format===e)})).sort((e,t)=>e.index-t.index).toArray()}_filterFormatsAndConversions(){let{formatterAvailable:e,conversions:t,formats:n}=this;e||this.addHandles(p(()=>this.view?.spatialReference,e=>{let r=e.isWebMercator||e.isWGS84,i=n.filter(e=>{let{name:t}=e;return L(t)?!0:t===`xy`&&!r}),a=this.filteredFormats.filter(e=>e.name===`xy`&&r&&!this.formats.includes(e)),o=t.filter(e=>i.includes(e.format));n.removeMany(i),t.removeMany(o),this.filteredFormats.addMany(i.filter(e=>!this.filteredFormats.includes(e))),n.addMany(a)},{once:!0,initial:!0}),P.view)}async _waitForFormatter(){this.formatterLoading&&await m(()=>this.formatterLoading===!1)}};e([h({types:C})],F.prototype,`_userLocationSymbol`,void 0),e([h()],F.prototype,`calculateCoordinatePrecision`,void 0),e([h()],F.prototype,`conversions`,null),e([h({type:v})],F.prototype,`currentLocation`,null),e([h({type:o.ofType(D)})],F.prototype,`formats`,void 0),e([h()],F.prototype,`formatterLoading`,void 0),e([h()],F.prototype,`messages`,void 0),e([h()],F.prototype,`mode`,null),e([h()],F.prototype,`filteredFormats`,void 0),e([h({readOnly:!0})],F.prototype,`state`,null),e([h({types:C})],F.prototype,`locationSymbol`,null),e([h()],F.prototype,`removeLeadingZeros`,void 0),e([h({readOnly:!0})],F.prototype,`storage`,null),e([h()],F.prototype,`storageEnabled`,void 0),e([h()],F.prototype,`storageType`,void 0),e([h()],F.prototype,`verticalUnit`,void 0),e([h({readOnly:!0})],F.prototype,`waitingForConversions`,null),e([h()],F.prototype,`view`,void 0),F=e([g(`esri.widgets.CoordinateConversion.CoordinateConversionViewModel`)],F);async function I(e,t){try{e.position=await e.format?.convert(t)}catch{e.position=null}return e}function L(e){return M.includes(e)}const R=F;export{R as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../core/Collection.js";import{deprecateWidget as n}from"../core/deprecate.js";import r from"../core/Logger.js";import{maybeProperty as i}from"../core/maybe.js";import{property as a,cast as o,subclass as s}from"../core/accessorSupport/decorators.js";import{pointSymbolTypes as c}from"../symbols/support/typeUtils.js";import l from"./Widget.js";import u from"./CoordinateConversion/CoordinateConversionViewModel.js";import d from"./CoordinateConversion/support/Conversion.js";import f from"./CoordinateConversion/support/Format.js";import{loadCalciteComponents as p}from"./support/componentsUtils.js";import{globalCss as m}from"./support/globalCss.js";import{Heading as h}from"./support/Heading.js";import{legacyIcon as g}from"./support/legacyIcon.js";import{messageBundle as _,accessibleHandler as v,tsx as y,isRTL as b}from"./support/widget.js";import{storeNode as x}from"./support/widgetUtils.js";const S=`esri-coordinate-conversion`,C={base:S,captureMode:`${S}--capture-mode`,noBasemap:`${S}--no-basemap`,popup:`${S}__popup`,clipboardPopup:`${S}__clipboard-popup`,conversionList:`${S}__conversion-list`,conversionRow:`${S}__row`,coordDisplay:`${S}__display`,expandButton:`${S}__expand-button`,expanded:`${S}__conversions-view--expanded`,expandDown:`${S}__conversions-view--expand-down`,expandUp:`${S}__conversions-view--expand-up`,conversionsView:`${S}__conversions-view`,rowSelect:`${S}__select-row`,toolDisplay:`${S}__tools`,modeToggle:`${S}__mode-toggle`,rowButton:`${S}__row-button`,coordinateInput:`${S}__input-coordinate`,inputForm:`${S}__input-form`,inputFormGroup:`${S}__input-group`,inputSelect:`${S}__input-select`,sectionHeading:`${S}__heading`,patternInput:`${S}__pattern-input`,settings:`${S}__settings`,settingsFormGroup:`${S}__settings-group`,settingsFormGroupHorizontal:`${S}__settings-group-horizontal`,previewCoordinate:`${S}__preview-coordinate`},w={settingsButton:!0,inputButton:!0,captureButton:!0,expandButton:!0};let T=class extends l{constructor(e){super(e),this._popupMessage=null,this._popupTimeoutId=void 0,this._clipboardPopupTimeoutId=void 0,this._coordinateInput=null,this._badInput=!1,this._goToEnabled=!1,this._conversionFormat=null,this._settingsFormat=null,this._previewConversion=null,this._expanded=!1,this._clipboardPopupVisible=!1,this._popupVisible=!1,this._settingsVisible=!1,this._inputVisible=!1,this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.orientation=`auto`,this.viewModel=new u,this.visibleElements={...w},n(r.getLogger(this),`CoordinateConversion`,`arcgis-coordinate-conversion`,{version:`4.34`})}loadDependencies(){return p({button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),checkbox:()=>import(`@esri/calcite-components/dist/components/calcite-checkbox`),input:()=>import(`@esri/calcite-components/dist/components/calcite-input`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),option:()=>import(`@esri/calcite-components/dist/components/calcite-option`),select:()=>import(`@esri/calcite-components/dist/components/calcite-select`)})}get calculateCoordinatePrecision(){return this.viewModel.calculateCoordinatePrecision}set calculateCoordinatePrecision(e){this.viewModel.calculateCoordinatePrecision=e}get conversions(){return this.viewModel.conversions}set conversions(e){this.viewModel.conversions=e}get currentLocation(){return this.viewModel.currentLocation}set currentLocation(e){this.viewModel.currentLocation=e}get formats(){return this.viewModel.formats}set formats(e){this.viewModel.formats=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get icon(){return`coordinate-system`}set icon(e){this._overrideIfSome(`icon`,e)}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get mode(){return this.viewModel.mode}set mode(e){this.viewModel.mode=e}set multipleConversions(e){e===!1&&(this._expanded=!1,this.conversions.splice(1,this.conversions.length-1)),this._set(`multipleConversions`,e)}get multipleConversions(){let e=this._get(`multipleConversions`);return typeof e!=`boolean`||e}get locationSymbol(){return this.viewModel.locationSymbol}set locationSymbol(e){this.viewModel.locationSymbol=e}get removeLeadingZeros(){return this.viewModel.removeLeadingZeros}set removeLeadingZeros(e){this.viewModel.removeLeadingZeros=e}get storageEnabled(){return this.viewModel.storageEnabled}set storageEnabled(e){this.viewModel.storageEnabled=e}get storageType(){return this.viewModel.storageType}set storageType(e){this.viewModel.storageType=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...w,...e}}reverseConvert(e,t){return this.viewModel.reverseConvert(e,t)}render(){let e=this.viewModel?.state,t=e===`disabled`?y(`div`,{key:`esri-coordinate__no-basemap`},this.messages?.noBasemap):null,n=!t&&this._inputVisible?this._renderInputForm():null,r=!t&&this._settingsVisible?this._renderSettings():null,i=!t&&!n&&!r?this._renderConversionsView():null,a=this._popupVisible?this._renderPopup():null,o={[C.captureMode]:this.mode===`capture`,[m.disabled]:e===`loading`,[C.noBasemap]:e===`disabled`};return y(`div`,{class:this.classes(C.base,m.widget,o)},a,t,i,r,n)}_addConversion(e){let t=e.target,n=t.selectedOption.value,r=D(t);if(n==null||r==null)return;let i=new d({format:n});t.value=`default`,r>=0?(this.conversions.removeAt(r),this.conversions.add(i,r)):this.conversions.add(i)}_findSettingsFormat(){return this._settingsFormat||this.conversions.reduceRight((e,t)=>{let n=t.format;return n?.hasDisplayProperties?n:e},null)||this.formats.find(e=>e.hasDisplayProperties)}_hidePopup(){this._popupTimeoutId&&=(clearTimeout(this._popupTimeoutId),void 0),this._popupVisible=!1,this._popupMessage=null,this.scheduleRender()}_hideClipboardPopup(){this._clipboardPopupTimeoutId&&=(clearTimeout(this._clipboardPopupTimeoutId),void 0),this._clipboardPopupVisible=!1,this.scheduleRender()}_onConvertComplete(){this._inputVisible=!1,this._coordinateInput.value=``}_onCopy(e){let t=O(e.currentTarget)?.displayCoordinate;t!=null&&(e.clipboardData?.setData(`text/plain`,t),this._showClipboardPopup(),e.preventDefault())}_processUserInput(e){let t=i(e,`key`),n=this.viewModel;if(t===`Enter`||!t){let e=this._conversionFormat||this.conversions.at(0).format;if(!e)return;let t=this._coordinateInput.value;this._reverseConvert(t,e).then(e=>{this.mode===`capture`?n.resume():this.mode=`capture`,this.currentLocation=e,n.setLocation(e),this._onConvertComplete()}).catch(e=>{r.getLogger(this).error(e),this._showPopup(this.messages?.invalidCoordinate),this._badInput=!0})}else this._badInput&&=!1}async _reverseConvert(e,t){let n=this.viewModel,i=await t.reverseConvert(e);return this._goToEnabled&&i&&n.goToLocation(i).catch(e=>{r.getLogger(this).warn(e),this._showPopup(this.messages?.locationOffBasemap)}),i}_setInputFormat(e){let t=e.target.selectedOption.value;t!=null&&(this._conversionFormat=t)}_setPreviewConversion(){let e=this._findSettingsFormat(),t=this.viewModel;if(e){let n=this.conversions.find(t=>t.format===e);this._previewConversion=new d({format:e,position:{location:this.currentLocation,coordinate:n?.position?.coordinate}}),this._previewConversion.position?.coordinate||t.previewConversion(this._previewConversion)}}_setSettingsFormat(e){let t=e.target.selectedOption.value;t!=null&&(this._settingsFormat=t,this._setPreviewConversion())}_showClipboardPopup(){this._clipboardPopupVisible?clearTimeout(this._clipboardPopupTimeoutId):this._clipboardPopupVisible=!0,this.scheduleRender(),this._popupTimeoutId=setTimeout(()=>{this._popupTimeoutId=void 0,this._hideClipboardPopup()},750)}_showPopup(e,t=2500){this._popupMessage=e,this._popupVisible?clearTimeout(this._popupTimeoutId):this._popupVisible=!0,this.scheduleRender(),this._popupTimeoutId=setTimeout(()=>{this._popupTimeoutId=void 0,this._hidePopup()},t)}_toggleGoTo(){this._goToEnabled=!this._goToEnabled}_updateCurrentPattern(e){e.stopPropagation();let t=e.target,n=this._findSettingsFormat();n&&(n.currentPattern=t.value)}_renderConversion(e,t){let{messages:n}=this;if(!n)return y(`li`,null);let{format:r}=e,i=r?.label??``,a=`${this.id}__list-item-${t}`,o=`${i} ${n.conversionOutputSuffix}`,s=t===0,c=s||this._expanded,l=s?this._renderFirstConversion(e):this._renderTools(t,e,a),u=s&&!e.displayCoordinate?n.noLocation:e.displayCoordinate,d=y(`div`,{"aria-label":u,class:C.coordDisplay,"data-conversion":e,role:`listitem`,tabIndex:0,title:u??``},u),f=this._renderOptions(this.formats.filter(e=>e!==r));return c?y(`li`,{"aria-label":o,class:C.conversionRow,id:a,key:e,role:`group`,tabIndex:0,title:o},y(`calcite-select`,{"aria-controls":a,bind:this,class:C.rowSelect,"data-index":t,label:n.selectFormat,scale:`s`,onCalciteSelectChange:this._addConversion},y(`calcite-option`,{label:i.toUpperCase(),selected:!0},i.toUpperCase()),f),d,l):null}_renderCopyButton(e){let t=this._clipboardPopupVisible&&this._renderClipboardPopup(),{messagesCommon:n}=this;return n?y(`li`,{"aria-label":n.copy,bind:this,class:this.classes(m.widgetButton,C.rowButton),"data-conversion":e,role:`button`,tabIndex:0,title:n.copy,onclick:this._copyCoordinateOutput,oncopy:this._onCopy,onkeydown:this._copyCoordinateOutput},t,y(`span`,{"aria-hidden":`true`,class:g.duplicate})):y(`li`,null)}_renderFirstConversion(e){let t=this.id,{messages:n,messagesCommon:r,multipleConversions:i,visibleElements:a}=this;if(!r||!n)return y(`ul`,null);let o=this.mode===`live`?n.captureMode:n.liveMode,s=this._expanded?r.collapse:r.expand,c=e.displayCoordinate&&(this.mode===`capture`||this.mode===`idle`)?this._renderCopyButton(e):null,l=i&&a.expandButton&&this._renderIconButton({iconType:this._expanded?`chevron-down`:`chevron-up`,clickFunction:this._toggleExpand,classes:[C.expandButton],attributes:{"aria-controls":`${t}__${C.conversionList}`,label:s}}),u=!i&&a.captureButton&&this._renderIconButton({iconType:this.mode===`capture`?`pin-tear-f`:`pin-tear`,clickFunction:this._toggleMode,classes:[C.modeToggle],attributes:{label:o}});return y(`ul`,{class:C.toolDisplay},c,l,u)}_renderInputForm(){let e=this._conversionFormat||this.conversions.at(0).format,t=this.formats.findIndex(t=>t.name===e?.name),n=this.id,r=`${n}__${C.coordinateInput}`,i=`${n}__${C.coordinateInput}__header`,a=this._renderOptions(this.formats,!0,t),{messages:o,messagesCommon:s,headingLevel:c}=this;if(!s||!o)return y(`div`,null);let l=this._renderIconButton({iconType:b(this.container)?`arrow-right`:`arrow-left`,clickFunction:this._toggleInputVisibility,attributes:{label:s.back}});return y(`div`,{"aria-labelledby":i,class:C.inputForm,key:`esri-coordinate-conversion__input-form`,role:`search`},y(`div`,{class:C.sectionHeading},l,y(h,{class:m.heading,id:i,level:c},o.inputCoordTitle)),y(`div`,{class:C.inputFormGroup},y(`calcite-select`,{"aria-controls":r,bind:this,class:C.inputSelect,label:o.selectFormat,scale:`s`,onCalciteSelectChange:this._setInputFormat},a),y(`calcite-input`,{afterCreate:x,"aria-labelledby":i,bind:this,class:C.coordinateInput,"data-format":e,"data-node-ref":`_coordinateInput`,id:r,placeholder:o.inputCoordTitle,required:!0,scale:`s`,spellcheck:!1,status:this._badInput?`invalid`:`idle`,onkeydown:this._processUserInput})),y(`div`,{class:C.inputFormGroup},y(`calcite-label`,{layout:`inline`,scale:`s`},y(`calcite-checkbox`,{bind:this,checked:this._goToEnabled,onCalciteCheckboxChange:this._toggleGoTo}),o.goTo),y(`calcite-button`,{appearance:`outline`,bind:this,kind:`neutral`,type:`button`,width:`auto`,onclick:this._processUserInput},o.convert)))}_renderConversionsView(){let{messages:e}=this;if(!e)return y(`div`,null);let t=`${this.id}__${C.conversionList}`,n=this._renderPrimaryTools(),r=this._renderOptions(this.formats),i=this.conversions.map((e,t)=>this._renderConversion(e,t)).toArray(),a=this._expanded?y(`div`,{class:C.conversionRow},y(`calcite-select`,{"aria-controls":t,bind:this,"data-index":-1,label:e.addConversion,scale:`s`,onCalciteSelectChange:this._addConversion},y(`calcite-option`,{disabled:!0,selected:!0,value:`default`},e.addConversion),r),n):null,o={[C.expanded]:this._expanded,[C.expandUp]:this.orientation===`expand-up`,[C.expandDown]:this.orientation===`expand-down`};return y(`div`,{class:this.classes(C.conversionsView,o),key:`esri-coordinate-conversion__main-view`},y(`ul`,{"aria-expanded":this._expanded?`true`:`false`,class:C.conversionList,id:t},i),a)}_renderOptions(e,t,n){let r=this.conversions.at(0),i=r.format?.name;return e.map((e,a)=>{let o=t||!r?!1:i===e.name||this.conversions.map(e=>e.format?.name).includes(e.name);return y(`calcite-option`,{disabled:o,key:e.name??`unnamed-format`,label:e.label.toUpperCase(),selected:a===n,value:e},e.label)}).toArray()}_renderPopup(){return y(`div`,{class:C.popup,role:`alert`},this._popupMessage)}_renderClipboardPopup(){let{messages:e}=this;return e?y(`div`,{class:this.classes(C.popup,C.clipboardPopup),role:`alert`},e.copySuccessMessage):y(`div`,null)}_renderPrimaryTools(){let{messages:e,visibleElements:t}=this;if(!e)return y(`ul`,null);let n=this.mode===`live`?e.captureMode:e.liveMode,r=t.inputButton&&this._renderIconButton({iconType:`pencil`,clickFunction:this._toggleInputVisibility,attributes:{label:e.inputCoordTitle}}),i=t.captureButton&&this._renderIconButton({iconType:this.mode===`capture`?`pin-tear-f`:`pin-tear`,clickFunction:this._toggleMode,classes:[C.modeToggle],attributes:{label:n}}),a=t.settingsButton&&this._renderIconButton({iconType:`gear`,clickFunction:this._toggleSettingsVisibility,attributes:{label:e.settingsTitle}});return y(`ul`,{class:C.toolDisplay},r,i,a)}_renderSettings(){let e=this.id,t=`${e}__${C.patternInput}`,n=`${e}__${C.patternInput}__header`,r=`${e}__${C.previewCoordinate}`,i=this.formats.filter(e=>e.hasDisplayProperties),a=this._findSettingsFormat(),o=a?i.indexOf(a):-1,s=this._renderOptions(i,!0,o),c=a?.currentPattern,{messages:l,messagesCommon:u,headingLevel:d}=this;if(!u||!l)return y(`div`,null);let f=this._renderIconButton({iconType:b(this.container)?`arrow-right`:`arrow-left`,clickFunction:this._toggleSettingsVisibility,attributes:{label:u.back}}),p=this._renderIconButton({iconType:`reset`,clickFunction:this._setDefaultPattern,attributes:{label:l.defaultPattern}});return y(`div`,{"aria-labelledby":n,class:C.settings,key:C.settings},y(`div`,{class:C.sectionHeading},f,y(h,{class:m.heading,id:n,level:d},l.settingsTitle)),y(`div`,{class:C.settingsFormGroup},y(`label`,{for:t},l.changeCoordinateDisplay),y(`calcite-select`,{bind:this,label:l.selectFormat,width:`full`,onCalciteSelectChange:this._setSettingsFormat},s),y(`div`,{class:C.settingsFormGroupHorizontal},y(`calcite-input`,{"aria-controls":r,bind:this,class:C.patternInput,id:t,spellcheck:!1,type:`text`,value:c,onCalciteInputInput:this._updateCurrentPattern}),p)),y(`div`,{class:C.settingsFormGroup},y(`label`,null,u.preview,y(`div`,{class:C.previewCoordinate,id:r,tabIndex:0},this._previewConversion?.displayCoordinate))))}_renderIconButton(e){let{iconType:t,clickFunction:n,classes:r,attributes:i}=e;return y(`calcite-button`,{appearance:`transparent`,bind:this,class:this.classes(r),iconStart:t,kind:`neutral`,onclick:n,onkeydown:n,...i})}_renderTools(e,t,n){let r=t.displayCoordinate&&(this.mode===`capture`||this.mode===`idle`)?this._renderCopyButton(t):null,{messages:i}=this;if(!i)return y(`ul`,null);let a=this._renderIconButton({iconType:`x`,clickFunction:this._removeConversion,attributes:{"aria-controls":n,label:i.removeConversion,"data-index":e}});return y(`ul`,{class:C.toolDisplay,role:`listitem`},r,y(`li`,{class:this.classes(C.rowButton)},a))}_copyCoordinateOutput(e){let t=e.target;if(!(`createTextRange`in document.body)){let e=window.getSelection(),n=document.createRange();n.selectNodeContents(t),e?.removeAllRanges(),e?.addRange(n)}document.execCommand(`copy`)}_removeConversion(e){let t=D(e.currentTarget);t!=null&&this.conversions.removeAt(t)}_setDefaultPattern(e){e.stopPropagation();let t=this._findSettingsFormat();t&&(t.currentPattern=t.defaultPattern)}_toggleExpand(){this._expanded=!this._expanded}_toggleInputVisibility(){this._inputVisible=!this._inputVisible,this._popupVisible&&this._hidePopup(),this._inputVisible?this.viewModel.pause():this.viewModel.resume()}_toggleMode(){this.mode=this.mode===`live`?`capture`:`live`}_toggleSettingsVisibility(){this._settingsVisible=!this._settingsVisible,this._popupVisible&&this._hidePopup(),this._settingsVisible?(this._setPreviewConversion(),this.viewModel.pause()):this.viewModel.resume()}};e([a()],T.prototype,`calculateCoordinatePrecision`,null),e([a()],T.prototype,`conversions`,null),e([a()],T.prototype,`currentLocation`,null),e([a({type:t.ofType(f)})],T.prototype,`formats`,null),e([a()],T.prototype,`goToOverride`,null),e([a()],T.prototype,`headingLevel`,void 0),e([a()],T.prototype,`icon`,null),e([a()],T.prototype,`label`,null),e([a(),_(`esri/widgets/CoordinateConversion/t9n/CoordinateConversion`)],T.prototype,`messages`,void 0),e([a(),_(`esri/t9n/common`)],T.prototype,`messagesCommon`,void 0),e([a()],T.prototype,`mode`,null),e([a()],T.prototype,`orientation`,void 0),e([a()],T.prototype,`multipleConversions`,null),e([a({types:c})],T.prototype,`locationSymbol`,null),e([a()],T.prototype,`removeLeadingZeros`,null),e([a()],T.prototype,`storageEnabled`,null),e([a()],T.prototype,`storageType`,null),e([a()],T.prototype,`view`,null),e([a({type:u})],T.prototype,`viewModel`,void 0),e([a()],T.prototype,`visibleElements`,void 0),e([o(`visibleElements`)],T.prototype,`castVisibleElements`,null),e([v()],T.prototype,`_copyCoordinateOutput`,null),e([v()],T.prototype,`_removeConversion`,null),e([v()],T.prototype,`_setDefaultPattern`,null),e([v()],T.prototype,`_toggleExpand`,null),e([v()],T.prototype,`_toggleInputVisibility`,null),e([v()],T.prototype,`_toggleMode`,null),e([v()],T.prototype,`_toggleSettingsVisibility`,null),T=e([s(`esri.widgets.CoordinateConversion`)],T);const E=T;function D(e){return e[`data-index`]}function O(e){return e[`data-conversion`]}export{E as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../core/Collection.js";import{deprecateWidget as n}from"../core/deprecate.js";import r from"../core/Logger.js";import{maybeProperty as i}from"../core/maybe.js";import{property as a,cast as o,subclass as s}from"../core/accessorSupport/decorators.js";import{pointSymbolTypes as c}from"../symbols/support/typeUtils.js";import l from"./Widget.js";import u from"./CoordinateConversion/CoordinateConversionViewModel.js";import d from"./CoordinateConversion/support/Conversion.js";import f from"./CoordinateConversion/support/Format.js";import{loadCalciteComponents as p}from"./support/componentsUtils.js";import{globalCss as m}from"./support/globalCss.js";import{Heading as h}from"./support/Heading.js";import{legacyIcon as g}from"./support/legacyIcon.js";import{messageBundle as _,accessibleHandler as v,tsx as y,isRTL as b}from"./support/widget.js";import{storeNode as x}from"./support/widgetUtils.js";const S=`esri-coordinate-conversion`,C={base:S,captureMode:`${S}--capture-mode`,noBasemap:`${S}--no-basemap`,popup:`${S}__popup`,clipboardPopup:`${S}__clipboard-popup`,conversionList:`${S}__conversion-list`,conversionRow:`${S}__row`,coordDisplay:`${S}__display`,expandButton:`${S}__expand-button`,expanded:`${S}__conversions-view--expanded`,expandDown:`${S}__conversions-view--expand-down`,expandUp:`${S}__conversions-view--expand-up`,conversionsView:`${S}__conversions-view`,rowSelect:`${S}__select-row`,toolDisplay:`${S}__tools`,modeToggle:`${S}__mode-toggle`,rowButton:`${S}__row-button`,coordinateInput:`${S}__input-coordinate`,inputForm:`${S}__input-form`,inputFormGroup:`${S}__input-group`,inputSelect:`${S}__input-select`,sectionHeading:`${S}__heading`,patternInput:`${S}__pattern-input`,settings:`${S}__settings`,settingsFormGroup:`${S}__settings-group`,settingsFormGroupHorizontal:`${S}__settings-group-horizontal`,previewCoordinate:`${S}__preview-coordinate`},w={settingsButton:!0,inputButton:!0,captureButton:!0,expandButton:!0};let T=class extends l{constructor(e){super(e),this._popupMessage=null,this._popupTimeoutId=void 0,this._clipboardPopupTimeoutId=void 0,this._coordinateInput=null,this._badInput=!1,this._goToEnabled=!1,this._conversionFormat=null,this._settingsFormat=null,this._previewConversion=null,this._expanded=!1,this._clipboardPopupVisible=!1,this._popupVisible=!1,this._settingsVisible=!1,this._inputVisible=!1,this.headingLevel=4,this.messages=null,this.messagesCommon=null,this.orientation=`auto`,this.viewModel=new u({suppressDeprecationWarning:!0}),this.visibleElements={...w},n(r.getLogger(this),`CoordinateConversion`,`arcgis-coordinate-conversion`,{version:`4.34`})}loadDependencies(){return p({button:()=>import(`@esri/calcite-components/dist/components/calcite-button`),checkbox:()=>import(`@esri/calcite-components/dist/components/calcite-checkbox`),input:()=>import(`@esri/calcite-components/dist/components/calcite-input`),label:()=>import(`@esri/calcite-components/dist/components/calcite-label`),option:()=>import(`@esri/calcite-components/dist/components/calcite-option`),select:()=>import(`@esri/calcite-components/dist/components/calcite-select`)})}get calculateCoordinatePrecision(){return this.viewModel.calculateCoordinatePrecision}set calculateCoordinatePrecision(e){this.viewModel.calculateCoordinatePrecision=e}get conversions(){return this.viewModel.conversions}set conversions(e){this.viewModel.conversions=e}get currentLocation(){return this.viewModel.currentLocation}set currentLocation(e){this.viewModel.currentLocation=e}get formats(){return this.viewModel.formats}set formats(e){this.viewModel.formats=e}get goToOverride(){return this.viewModel.goToOverride}set goToOverride(e){this.viewModel.goToOverride=e}get icon(){return`coordinate-system`}set icon(e){this._overrideIfSome(`icon`,e)}get label(){return this.messages?.widgetLabel??``}set label(e){this._overrideIfSome(`label`,e)}get mode(){return this.viewModel.mode}set mode(e){this.viewModel.mode=e}set multipleConversions(e){e===!1&&(this._expanded=!1,this.conversions.splice(1,this.conversions.length-1)),this._set(`multipleConversions`,e)}get multipleConversions(){let e=this._get(`multipleConversions`);return typeof e!=`boolean`||e}get locationSymbol(){return this.viewModel.locationSymbol}set locationSymbol(e){this.viewModel.locationSymbol=e}get removeLeadingZeros(){return this.viewModel.removeLeadingZeros}set removeLeadingZeros(e){this.viewModel.removeLeadingZeros=e}get storageEnabled(){return this.viewModel.storageEnabled}set storageEnabled(e){this.viewModel.storageEnabled=e}get storageType(){return this.viewModel.storageType}set storageType(e){this.viewModel.storageType=e}get view(){return this.viewModel.view}set view(e){this.viewModel.view=e}castVisibleElements(e){return{...w,...e}}reverseConvert(e,t){return this.viewModel.reverseConvert(e,t)}render(){let e=this.viewModel?.state,t=e===`disabled`?y(`div`,{key:`esri-coordinate__no-basemap`},this.messages?.noBasemap):null,n=!t&&this._inputVisible?this._renderInputForm():null,r=!t&&this._settingsVisible?this._renderSettings():null,i=!t&&!n&&!r?this._renderConversionsView():null,a=this._popupVisible?this._renderPopup():null,o={[C.captureMode]:this.mode===`capture`,[m.disabled]:e===`loading`,[C.noBasemap]:e===`disabled`};return y(`div`,{class:this.classes(C.base,m.widget,o)},a,t,i,r,n)}_addConversion(e){let t=e.target,n=t.selectedOption.value,r=D(t);if(n==null||r==null)return;let i=new d({format:n});t.value=`default`,r>=0?(this.conversions.removeAt(r),this.conversions.add(i,r)):this.conversions.add(i)}_findSettingsFormat(){return this._settingsFormat||this.conversions.reduceRight((e,t)=>{let n=t.format;return n?.hasDisplayProperties?n:e},null)||this.formats.find(e=>e.hasDisplayProperties)}_hidePopup(){this._popupTimeoutId&&=(clearTimeout(this._popupTimeoutId),void 0),this._popupVisible=!1,this._popupMessage=null,this.scheduleRender()}_hideClipboardPopup(){this._clipboardPopupTimeoutId&&=(clearTimeout(this._clipboardPopupTimeoutId),void 0),this._clipboardPopupVisible=!1,this.scheduleRender()}_onConvertComplete(){this._inputVisible=!1,this._coordinateInput.value=``}_onCopy(e){let t=O(e.currentTarget)?.displayCoordinate;t!=null&&(e.clipboardData?.setData(`text/plain`,t),this._showClipboardPopup(),e.preventDefault())}_processUserInput(e){let t=i(e,`key`),n=this.viewModel;if(t===`Enter`||!t){let e=this._conversionFormat||this.conversions.at(0).format;if(!e)return;let t=this._coordinateInput.value;this._reverseConvert(t,e).then(e=>{this.mode===`capture`?n.resume():this.mode=`capture`,this.currentLocation=e,n.setLocation(e),this._onConvertComplete()}).catch(e=>{r.getLogger(this).error(e),this._showPopup(this.messages?.invalidCoordinate),this._badInput=!0})}else this._badInput&&=!1}async _reverseConvert(e,t){let n=this.viewModel,i=await t.reverseConvert(e);return this._goToEnabled&&i&&n.goToLocation(i).catch(e=>{r.getLogger(this).warn(e),this._showPopup(this.messages?.locationOffBasemap)}),i}_setInputFormat(e){let t=e.target.selectedOption.value;t!=null&&(this._conversionFormat=t)}_setPreviewConversion(){let e=this._findSettingsFormat(),t=this.viewModel;if(e){let n=this.conversions.find(t=>t.format===e);this._previewConversion=new d({format:e,position:{location:this.currentLocation,coordinate:n?.position?.coordinate}}),this._previewConversion.position?.coordinate||t.previewConversion(this._previewConversion)}}_setSettingsFormat(e){let t=e.target.selectedOption.value;t!=null&&(this._settingsFormat=t,this._setPreviewConversion())}_showClipboardPopup(){this._clipboardPopupVisible?clearTimeout(this._clipboardPopupTimeoutId):this._clipboardPopupVisible=!0,this.scheduleRender(),this._popupTimeoutId=setTimeout(()=>{this._popupTimeoutId=void 0,this._hideClipboardPopup()},750)}_showPopup(e,t=2500){this._popupMessage=e,this._popupVisible?clearTimeout(this._popupTimeoutId):this._popupVisible=!0,this.scheduleRender(),this._popupTimeoutId=setTimeout(()=>{this._popupTimeoutId=void 0,this._hidePopup()},t)}_toggleGoTo(){this._goToEnabled=!this._goToEnabled}_updateCurrentPattern(e){e.stopPropagation();let t=e.target,n=this._findSettingsFormat();n&&(n.currentPattern=t.value)}_renderConversion(e,t){let{messages:n}=this;if(!n)return y(`li`,null);let{format:r}=e,i=r?.label??``,a=`${this.id}__list-item-${t}`,o=`${i} ${n.conversionOutputSuffix}`,s=t===0,c=s||this._expanded,l=s?this._renderFirstConversion(e):this._renderTools(t,e,a),u=s&&!e.displayCoordinate?n.noLocation:e.displayCoordinate,d=y(`div`,{"aria-label":u,class:C.coordDisplay,"data-conversion":e,role:`listitem`,tabIndex:0,title:u??``},u),f=this._renderOptions(this.formats.filter(e=>e!==r));return c?y(`li`,{"aria-label":o,class:C.conversionRow,id:a,key:e,role:`group`,tabIndex:0,title:o},y(`calcite-select`,{"aria-controls":a,bind:this,class:C.rowSelect,"data-index":t,label:n.selectFormat,scale:`s`,onCalciteSelectChange:this._addConversion},y(`calcite-option`,{label:i.toUpperCase(),selected:!0},i.toUpperCase()),f),d,l):null}_renderCopyButton(e){let t=this._clipboardPopupVisible&&this._renderClipboardPopup(),{messagesCommon:n}=this;return n?y(`li`,{"aria-label":n.copy,bind:this,class:this.classes(m.widgetButton,C.rowButton),"data-conversion":e,role:`button`,tabIndex:0,title:n.copy,onclick:this._copyCoordinateOutput,oncopy:this._onCopy,onkeydown:this._copyCoordinateOutput},t,y(`span`,{"aria-hidden":`true`,class:g.duplicate})):y(`li`,null)}_renderFirstConversion(e){let t=this.id,{messages:n,messagesCommon:r,multipleConversions:i,visibleElements:a}=this;if(!r||!n)return y(`ul`,null);let o=this.mode===`live`?n.captureMode:n.liveMode,s=this._expanded?r.collapse:r.expand,c=e.displayCoordinate&&(this.mode===`capture`||this.mode===`idle`)?this._renderCopyButton(e):null,l=i&&a.expandButton&&this._renderIconButton({iconType:this._expanded?`chevron-down`:`chevron-up`,clickFunction:this._toggleExpand,classes:[C.expandButton],attributes:{"aria-controls":`${t}__${C.conversionList}`,label:s}}),u=!i&&a.captureButton&&this._renderIconButton({iconType:this.mode===`capture`?`pin-tear-f`:`pin-tear`,clickFunction:this._toggleMode,classes:[C.modeToggle],attributes:{label:o}});return y(`ul`,{class:C.toolDisplay},c,l,u)}_renderInputForm(){let e=this._conversionFormat||this.conversions.at(0).format,t=this.formats.findIndex(t=>t.name===e?.name),n=this.id,r=`${n}__${C.coordinateInput}`,i=`${n}__${C.coordinateInput}__header`,a=this._renderOptions(this.formats,!0,t),{messages:o,messagesCommon:s,headingLevel:c}=this;if(!s||!o)return y(`div`,null);let l=this._renderIconButton({iconType:b(this.container)?`arrow-right`:`arrow-left`,clickFunction:this._toggleInputVisibility,attributes:{label:s.back}});return y(`div`,{"aria-labelledby":i,class:C.inputForm,key:`esri-coordinate-conversion__input-form`,role:`search`},y(`div`,{class:C.sectionHeading},l,y(h,{class:m.heading,id:i,level:c},o.inputCoordTitle)),y(`div`,{class:C.inputFormGroup},y(`calcite-select`,{"aria-controls":r,bind:this,class:C.inputSelect,label:o.selectFormat,scale:`s`,onCalciteSelectChange:this._setInputFormat},a),y(`calcite-input`,{afterCreate:x,"aria-labelledby":i,bind:this,class:C.coordinateInput,"data-format":e,"data-node-ref":`_coordinateInput`,id:r,placeholder:o.inputCoordTitle,required:!0,scale:`s`,spellcheck:!1,status:this._badInput?`invalid`:`idle`,onkeydown:this._processUserInput})),y(`div`,{class:C.inputFormGroup},y(`calcite-label`,{layout:`inline`,scale:`s`},y(`calcite-checkbox`,{bind:this,checked:this._goToEnabled,onCalciteCheckboxChange:this._toggleGoTo}),o.goTo),y(`calcite-button`,{appearance:`outline`,bind:this,kind:`neutral`,type:`button`,width:`auto`,onclick:this._processUserInput},o.convert)))}_renderConversionsView(){let{messages:e}=this;if(!e)return y(`div`,null);let t=`${this.id}__${C.conversionList}`,n=this._renderPrimaryTools(),r=this._renderOptions(this.formats),i=this.conversions.map((e,t)=>this._renderConversion(e,t)).toArray(),a=this._expanded?y(`div`,{class:C.conversionRow},y(`calcite-select`,{"aria-controls":t,bind:this,"data-index":-1,label:e.addConversion,scale:`s`,onCalciteSelectChange:this._addConversion},y(`calcite-option`,{disabled:!0,selected:!0,value:`default`},e.addConversion),r),n):null,o={[C.expanded]:this._expanded,[C.expandUp]:this.orientation===`expand-up`,[C.expandDown]:this.orientation===`expand-down`};return y(`div`,{class:this.classes(C.conversionsView,o),key:`esri-coordinate-conversion__main-view`},y(`ul`,{"aria-expanded":this._expanded?`true`:`false`,class:C.conversionList,id:t},i),a)}_renderOptions(e,t,n){let r=this.conversions.at(0),i=r.format?.name;return e.map((e,a)=>{let o=t||!r?!1:i===e.name||this.conversions.map(e=>e.format?.name).includes(e.name);return y(`calcite-option`,{disabled:o,key:e.name??`unnamed-format`,label:e.label.toUpperCase(),selected:a===n,value:e},e.label)}).toArray()}_renderPopup(){return y(`div`,{class:C.popup,role:`alert`},this._popupMessage)}_renderClipboardPopup(){let{messages:e}=this;return e?y(`div`,{class:this.classes(C.popup,C.clipboardPopup),role:`alert`},e.copySuccessMessage):y(`div`,null)}_renderPrimaryTools(){let{messages:e,visibleElements:t}=this;if(!e)return y(`ul`,null);let n=this.mode===`live`?e.captureMode:e.liveMode,r=t.inputButton&&this._renderIconButton({iconType:`pencil`,clickFunction:this._toggleInputVisibility,attributes:{label:e.inputCoordTitle}}),i=t.captureButton&&this._renderIconButton({iconType:this.mode===`capture`?`pin-tear-f`:`pin-tear`,clickFunction:this._toggleMode,classes:[C.modeToggle],attributes:{label:n}}),a=t.settingsButton&&this._renderIconButton({iconType:`gear`,clickFunction:this._toggleSettingsVisibility,attributes:{label:e.settingsTitle}});return y(`ul`,{class:C.toolDisplay},r,i,a)}_renderSettings(){let e=this.id,t=`${e}__${C.patternInput}`,n=`${e}__${C.patternInput}__header`,r=`${e}__${C.previewCoordinate}`,i=this.formats.filter(e=>e.hasDisplayProperties),a=this._findSettingsFormat(),o=a?i.indexOf(a):-1,s=this._renderOptions(i,!0,o),c=a?.currentPattern,{messages:l,messagesCommon:u,headingLevel:d}=this;if(!u||!l)return y(`div`,null);let f=this._renderIconButton({iconType:b(this.container)?`arrow-right`:`arrow-left`,clickFunction:this._toggleSettingsVisibility,attributes:{label:u.back}}),p=this._renderIconButton({iconType:`reset`,clickFunction:this._setDefaultPattern,attributes:{label:l.defaultPattern}});return y(`div`,{"aria-labelledby":n,class:C.settings,key:C.settings},y(`div`,{class:C.sectionHeading},f,y(h,{class:m.heading,id:n,level:d},l.settingsTitle)),y(`div`,{class:C.settingsFormGroup},y(`label`,{for:t},l.changeCoordinateDisplay),y(`calcite-select`,{bind:this,label:l.selectFormat,width:`full`,onCalciteSelectChange:this._setSettingsFormat},s),y(`div`,{class:C.settingsFormGroupHorizontal},y(`calcite-input`,{"aria-controls":r,bind:this,class:C.patternInput,id:t,spellcheck:!1,type:`text`,value:c,onCalciteInputInput:this._updateCurrentPattern}),p)),y(`div`,{class:C.settingsFormGroup},y(`label`,null,u.preview,y(`div`,{class:C.previewCoordinate,id:r,tabIndex:0},this._previewConversion?.displayCoordinate))))}_renderIconButton(e){let{iconType:t,clickFunction:n,classes:r,attributes:i}=e;return y(`calcite-button`,{appearance:`transparent`,bind:this,class:this.classes(r),iconStart:t,kind:`neutral`,onclick:n,onkeydown:n,...i})}_renderTools(e,t,n){let r=t.displayCoordinate&&(this.mode===`capture`||this.mode===`idle`)?this._renderCopyButton(t):null,{messages:i}=this;if(!i)return y(`ul`,null);let a=this._renderIconButton({iconType:`x`,clickFunction:this._removeConversion,attributes:{"aria-controls":n,label:i.removeConversion,"data-index":e}});return y(`ul`,{class:C.toolDisplay,role:`listitem`},r,y(`li`,{class:this.classes(C.rowButton)},a))}_copyCoordinateOutput(e){let t=e.target;if(!(`createTextRange`in document.body)){let e=window.getSelection(),n=document.createRange();n.selectNodeContents(t),e?.removeAllRanges(),e?.addRange(n)}document.execCommand(`copy`)}_removeConversion(e){let t=D(e.currentTarget);t!=null&&this.conversions.removeAt(t)}_setDefaultPattern(e){e.stopPropagation();let t=this._findSettingsFormat();t&&(t.currentPattern=t.defaultPattern)}_toggleExpand(){this._expanded=!this._expanded}_toggleInputVisibility(){this._inputVisible=!this._inputVisible,this._popupVisible&&this._hidePopup(),this._inputVisible?this.viewModel.pause():this.viewModel.resume()}_toggleMode(){this.mode=this.mode===`live`?`capture`:`live`}_toggleSettingsVisibility(){this._settingsVisible=!this._settingsVisible,this._popupVisible&&this._hidePopup(),this._settingsVisible?(this._setPreviewConversion(),this.viewModel.pause()):this.viewModel.resume()}};e([a()],T.prototype,`calculateCoordinatePrecision`,null),e([a()],T.prototype,`conversions`,null),e([a()],T.prototype,`currentLocation`,null),e([a({type:t.ofType(f)})],T.prototype,`formats`,null),e([a()],T.prototype,`goToOverride`,null),e([a()],T.prototype,`headingLevel`,void 0),e([a()],T.prototype,`icon`,null),e([a()],T.prototype,`label`,null),e([a(),_(`esri/widgets/CoordinateConversion/t9n/CoordinateConversion`)],T.prototype,`messages`,void 0),e([a(),_(`esri/t9n/common`)],T.prototype,`messagesCommon`,void 0),e([a()],T.prototype,`mode`,null),e([a()],T.prototype,`orientation`,void 0),e([a()],T.prototype,`multipleConversions`,null),e([a({types:c})],T.prototype,`locationSymbol`,null),e([a()],T.prototype,`removeLeadingZeros`,null),e([a()],T.prototype,`storageEnabled`,null),e([a()],T.prototype,`storageType`,null),e([a()],T.prototype,`view`,null),e([a({type:u})],T.prototype,`viewModel`,void 0),e([a()],T.prototype,`visibleElements`,void 0),e([o(`visibleElements`)],T.prototype,`castVisibleElements`,null),e([v()],T.prototype,`_copyCoordinateOutput`,null),e([v()],T.prototype,`_removeConversion`,null),e([v()],T.prototype,`_setDefaultPattern`,null),e([v()],T.prototype,`_toggleExpand`,null),e([v()],T.prototype,`_toggleInputVisibility`,null),e([v()],T.prototype,`_toggleMode`,null),e([v()],T.prototype,`_toggleSettingsVisibility`,null),T=e([s(`esri.widgets.CoordinateConversion`)],T);const E=T;function D(e){return e[`data-index`]}function O(e){return e[`data-conversion`]}export{E as default};
|