@arcgis/core 4.25.0-next.20220718 → 4.25.0-next.20220721
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/Camera.js +1 -1
- package/analysis/DimensioningAnalysis.js +1 -1
- package/analysis/LineOfSightAnalysis.js +1 -1
- package/analysis/SliceAnalysis.js +1 -1
- package/arcade/featureset/support/RecentlyUsedCache.js +1 -1
- package/arcade/functions/featuresetgeom.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/1751de504354d98ac3fd.js +1 -0
- package/assets/esri/core/workers/chunks/1f4f1896880bfa6801c5.js +1 -0
- package/assets/esri/core/workers/chunks/290cd411d0d18b1d0efd.js +1 -0
- package/assets/esri/core/workers/chunks/{ab3bd5fecdb97f2d690e.js → 3b5be512567d9c1c6fe6.js} +1 -1
- package/assets/esri/core/workers/chunks/{c3236a7058e64ea3b939.js → 3c9da9b88777700879aa.js} +1 -1
- package/assets/esri/core/workers/chunks/{f96e8724ae3458f5e262.js → 4a7aa1b9de61eb013647.js} +1 -1
- package/assets/esri/core/workers/chunks/4cb64ccb5fba126f9a66.js +1 -0
- package/assets/esri/core/workers/chunks/{68f19e58aae01791944e.js → 579ba109718bc2554008.js} +1 -1
- package/assets/esri/core/workers/chunks/59845b02b07a8ed7ce81.js +1 -0
- package/assets/esri/core/workers/chunks/{c705f907ce60a646d9aa.js → 652d36523efbe5c9ebb2.js} +1 -1
- package/assets/esri/core/workers/chunks/888d8e4471c9a2cd5009.js +1 -0
- package/assets/esri/core/workers/chunks/9493a8e5d6001b6bf275.js +1 -0
- package/assets/esri/core/workers/chunks/9d824cdfbcdf3cb3246f.js +1 -0
- package/assets/esri/core/workers/chunks/bf348f6f52701fa6016e.js +987 -0
- package/assets/esri/core/workers/chunks/d02881954c0cc0d39dfb.js +1 -0
- package/assets/esri/core/workers/chunks/{1ecbf642debc2207b762.js → da54483123f377e9b3e1.js} +1 -1
- package/assets/esri/core/workers/chunks/{61b71b8e028eda10ccab.js → e4ad2cf5d6bded02e392.js} +1 -1
- package/assets/esri/core/workers/chunks/{3bfab05ae07ac18a75fe.js → f298a70f3b6f27675d53.js} +1 -1
- package/assets/esri/core/workers/chunks/{d499cce61c1c5c367380.js → f40290cfad3fe6fb4ef9.js} +1 -1
- package/assets/esri/layers/support/rasterFormats/lerc-wasm.wasm +0 -0
- package/assets/esri/themes/base/widgets/_Tooltip.scss +1 -1
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/ComponentShader.glsl.js +39 -33
- package/chunks/Laserlines.glsl.js +4 -4
- package/chunks/Precipitation.glsl.js +2 -2
- package/chunks/RibbonLine.glsl.js +46 -44
- package/chunks/Stars.glsl.js +2 -2
- package/chunks/Terrain.glsl.js +25 -17
- package/chunks/boundedPlane.js +1 -1
- package/chunks/lerc-wasm.js +1 -1
- package/chunks/mat2d.js +1 -1
- package/chunks/quatf32.js +1 -1
- package/core/BidiEngine.js +1 -1
- package/core/accessorSupport/watch.js +1 -1
- package/core/libs/gl-matrix-2/factories/quatf32.js +1 -1
- package/core/libs/gl-matrix-2/math/mat2d.js +1 -1
- package/core/perspectiveUtils.js +1 -1
- package/core/promiseUtils.js +1 -1
- package/core/reactiveUtils.js +1 -1
- package/core/unitUtils.js +1 -1
- package/geometry/projection.js +1 -1
- package/geometry/projectionEllipsoid.js +1 -1
- package/geometry/support/MeshTexture.js +1 -1
- package/geometry/support/axisAngleDegrees.js +1 -1
- package/geometry/support/coordinateSystem.js +1 -1
- package/geometry/support/geodesicUtils.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/index.js +1 -1
- package/geometry/support/meshUtils/loadExternal.js +1 -1
- package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
- package/geometry/support/scaleUtils.js +1 -1
- package/geometry/support/spatialReferenceUtils.js +1 -1
- package/identity/IdentityManagerBase.js +1 -1
- package/identity/IdentityModal.js +1 -1
- package/interfaces.d.ts +3 -33
- package/layers/FeatureLayer.js +1 -1
- package/layers/effects/parser.js +1 -1
- package/layers/graphics/hydratedFeatures.js +1 -1
- package/layers/graphics/sources/support/sourceUtils.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/ogc/wfsUtils.js +1 -1
- package/layers/support/ContingentValue.js +1 -1
- package/layers/support/ElevationQuery.js +1 -1
- package/layers/support/PixelBlock.js +1 -1
- package/layers/support/kmlUtils.js +1 -1
- package/layers/support/rasterDatasets/CloudRaster.js +1 -1
- package/layers/support/rasterDatasets/EphemeralBlockCache.js +1 -1
- package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
- package/layers/support/rasterDatasets/multipartParser.js +1 -1
- package/layers/support/rasterFormats/ImageCanvasDecoder.js +1 -1
- package/layers/support/rasterFormats/JpgPlus.js +1 -1
- package/layers/support/rasterFormats/Lerc.js +1 -1
- package/layers/support/rasterFormats/RasterCodec.js +1 -1
- package/layers/support/rasterFormats/Raw.js +1 -1
- package/layers/support/rasterFormats/TiffTags.js +1 -1
- package/layers/support/rasterFunctions/vectorFieldUtils.js +1 -1
- package/layers/support/vectorTileLayerLoader.js +1 -1
- package/layers/support/wmtsUtils.js +1 -1
- package/package.json +1 -1
- package/renderers/RasterShadedReliefRenderer.js +1 -1
- package/renderers/RasterStretchRenderer.js +1 -1
- package/renderers/UniqueValueRenderer.js +1 -1
- package/renderers/support/AuthoringInfo.js +1 -1
- package/renderers/support/RasterSymbolizer.js +1 -1
- package/rest/query/operations/query.js +1 -1
- package/rest/query/operations/queryTopFeatures.js +1 -1
- package/rest/support/DirectionsFeatureSet.js +1 -1
- package/rest/support/ImageHistogramParameters.js +1 -1
- package/rest/support/ImageSampleParameters.js +1 -1
- package/smartMapping/labels/clusters.js +1 -1
- package/smartMapping/renderers/relationship.js +1 -1
- package/smartMapping/support/adapters/support/utils.js +1 -1
- package/support/basemapUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/LabelSymbol3D.js +1 -1
- package/symbols/PointSymbol3D.js +1 -1
- package/symbols/cim/CIMCursor.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/cim/CIMSymbolRasterizer.js +1 -1
- package/symbols/support/previewSymbol3D.js +1 -1
- package/symbols/support/webStyleSymbolUtils.js +1 -1
- package/views/2d/ViewState.js +1 -1
- package/views/2d/engine/vectorTiles/Feature.js +1 -1
- package/views/2d/engine/vectorTiles/style/StyleRepository.js +1 -1
- package/views/2d/engine/webgl/SDFConverter.js +1 -1
- package/views/2d/engine/webgl/TurboLine.js +1 -1
- package/views/2d/engine/webgl/brushes/BrushClip.js +1 -1
- package/views/2d/engine/webgl/brushes/BrushOverlay.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLGeometryBrushLabel.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLGeometryBrushLine.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLGeometryBrushText.js +1 -1
- package/views/2d/engine/webgl/collisions/MetricReader.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/DisplayRecordReader.js +1 -1
- package/views/2d/engine/webgl/cpuMapped/FreeList.js +1 -1
- package/views/2d/engine/webgl/mesh/heuristics.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLDynamicFillTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLDynamicLineTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLDynamicMarkerTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLDynamicTextTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLFillTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLLineTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/WGLMarkerTemplate.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/input/MapViewInputManager.js +1 -1
- package/views/2d/layers/features/createSymbolSchema.js +1 -1
- package/views/2d/viewpointUtils.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRayIntersector.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightVisualization.js +1 -1
- package/views/3d/analysis/LineOfSightAnalysisView3D.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/camera/constraintUtils/distance.js +1 -1
- package/views/3d/environment/ChapmanAtmosphereTechniqueConfiguration.js +1 -1
- package/views/3d/environment/CloudsComposition.js +1 -1
- package/views/3d/environment/FogTechnique.js +1 -1
- package/views/3d/glTF/internal/Resource.js +1 -1
- package/views/3d/input/SceneInputManager.js +1 -1
- package/views/3d/interactive/editingTools/dragEventPipeline3D.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshapeGraphic/edgeOffsetUtils.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/GraphicScaleRotateTransform.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/GraphicTransformTool.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/ScaleRotateObjectSymbol3DAdapter.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DTool.js +1 -1
- package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
- package/views/3d/layers/GraphicsLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/lineUtils.js +1 -1
- package/views/3d/layers/i3s/I3SGeometryUtil.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/IDBCache.js +1 -1
- package/views/3d/layers/i3s/IDBMockCache.js +1 -1
- package/views/3d/layers/i3s/PointRenderer.js +1 -1
- package/views/3d/layers/support/featureTileQuery3D.js +1 -1
- package/views/3d/state/ViewState.js +1 -1
- package/views/3d/support/cameraUtils.js +1 -1
- package/views/3d/support/orientedBoundingBox.js +1 -1
- package/views/3d/support/viewpointUtils.js +1 -1
- package/views/3d/terrain/Overlay.js +1 -1
- package/views/3d/terrain/OverlayRenderTarget.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/TilingSchemeLogic.js +1 -1
- package/views/3d/terrain/interfaces.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
- package/views/3d/webgl-engine/collections/Component/DepthRange.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
- package/views/3d/webgl-engine/collections/Component/RenderGeometry.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js +9 -0
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +18 -17
- package/views/3d/webgl-engine/lib/DefaultVertexAttributeLocations.js +1 -1
- package/views/3d/webgl-engine/lib/Geometry.js +1 -1
- package/views/3d/webgl-engine/lib/Intersector.js +1 -1
- package/views/3d/webgl-engine/lib/ObjectAndLayerIdRenderHelper.js +5 -0
- package/views/3d/webgl-engine/lib/Octree.js +1 -1
- package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextureTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
- package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/InstanceData.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/RenderInstanceData.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/parts/ScreenshotManager.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/LaserlinePathTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
- package/views/DOMContainer.js +1 -1
- package/views/MapView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/View.js +1 -1
- package/views/analysis/analysisViewUtils.js +1 -1
- package/views/animation/pointToPoint/apex/planning.js +1 -1
- package/views/draw/PolygonDrawAction.js +1 -1
- package/views/draw/PolylineDrawAction.js +1 -1
- package/views/draw/support/createUtils.js +1 -1
- package/views/draw/support/surfaceCoordinateSystems.js +1 -1
- package/views/input/InputManager.js +1 -1
- package/views/input/handlers/LatestPointer.js +1 -1
- package/views/input/handlers/MultiTouch.js +5 -0
- package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
- package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileCache.js +1 -1
- package/views/interactive/tooltip/Tooltip.js +1 -1
- package/views/interactive/tooltip/support/measurements.js +1 -1
- package/views/layers/GroupLayerView.js +1 -1
- package/views/navigation/FilteredFiniteDifference.js +1 -1
- package/views/navigation/MomentumEstimator.js +1 -1
- package/views/navigation/PanPlanarMomentumEstimator.js +1 -1
- package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
- package/views/navigation/RotationMomentumEstimator.js +1 -1
- package/views/support/GroundViewElevationSampler.js +1 -1
- package/views/support/euclideanAreaMeasurementUtils.js +1 -1
- package/views/support/euclideanLengthMeasurementUtils.js +1 -1
- package/views/support/screenshotUtils.js +1 -1
- package/views/webgl/BufferObject.js +1 -1
- package/views/webgl/FramebufferObject.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/capabilities/Capabilities.js +1 -1
- package/views/webgl/capabilities.js +1 -1
- package/views/webgl/renderState.js +1 -1
- package/webscene/spec-certification/api.js +1 -1
- package/widgets/CoordinateConversion/support/formatUtils.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileController.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileLineInput.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileLineView.js +1 -1
- package/widgets/ElevationProfile/support/chartUtils.js +1 -1
- package/widgets/ElevationProfile/support/geometryUtils.js +1 -1
- package/widgets/Expand.js +1 -1
- package/widgets/Legend/support/sizeRampUtils.js +1 -1
- package/widgets/LineOfSight/LineOfSightViewModel.js +1 -1
- package/widgets/Popup/PopupViewModel.js +1 -1
- package/widgets/Popup/actionUtils.js +1 -1
- package/widgets/ScaleRangeSlider.js +1 -1
- package/widgets/Slider/SliderViewModel.js +1 -1
- package/widgets/Widget.js +1 -1
- package/assets/esri/core/workers/chunks/04ea469cb081e181ca82.js +0 -1
- package/assets/esri/core/workers/chunks/16c2626ca47132700519.js +0 -1
- package/assets/esri/core/workers/chunks/1e4e5d147263e98536bc.js +0 -1
- package/assets/esri/core/workers/chunks/35083def3c658d1ae9ff.js +0 -1
- package/assets/esri/core/workers/chunks/40032d2bf404a46b8f80.js +0 -1
- package/assets/esri/core/workers/chunks/613e82a3e13442685ac4.js +0 -1
- package/assets/esri/core/workers/chunks/64b4f1dbf61439cde801.js +0 -1
- package/assets/esri/core/workers/chunks/abd68b7ba3be4696611c.js +0 -1
- package/assets/esri/core/workers/chunks/b8a062c0c9c626acf61e.js +0 -982
- package/assets/esri/core/workers/chunks/e08686088be0aaca1a99.js +0 -1
package/views/SceneView.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Camera.js";import"../geometry.js";import i from"../Graphic.js";import r from"../Viewpoint.js";import s from"../core/Collection.js";import{byId as a}from"../core/domUtils.js";import n from"../core/Error.js";import{on as o}from"../core/events.js";import{handlesGroup as l,makeHandle as p}from"../core/handleUtils.js";import has from"../core/has.js";import{isIterable as h}from"../core/iteratorUtils.js";import d from"../core/Logger.js";import{destroyMaybe as c,isNone as u,isSome as g,unwrapOr as m}from"../core/maybe.js";import{ObservableChangesType as f}from"../core/ObservableChangesType.js";import{throwIfAborted as y}from"../core/promiseUtils.js";import{on as w,watch as v,initial as _,syncAndInitial as b,whenOnce as S,sync as M}from"../core/reactiveUtils.js";import{setFrameDuration as R}from"../core/scheduling.js";import{screenPointObjectToArray as C,createScreenPoint as V,createScreenPointArray as T}from"../core/screenUtils.js";import{initialize as x}from"../core/workers/workers.js";import{property as O}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import{cast as E}from"../core/accessorSupport/decorators/cast.js";import{subclass as j}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as P}from"../core/accessorSupport/ensureType.js";import{c as L}from"../chunks/vec3f64.js";import{owningCollectionProperty as I}from"../core/support/OwningCollection.js";import G from"../geometry/HeightModelInfo.js";import{canProjectWithoutEngine as H,project as U,projectPointToVector as A,projectVectorToVector as D,projectBoundingRect as W}from"../geometry/projection.js";import{create as F,toExtent as k}from"../geometry/support/aaBoundingRect.js";import{B as q,c as z}from"../chunks/boundedPlane.js";import{renderSRFromViewSR as B}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as N}from"../geometry/support/scaleUtils.js";import{isImageryTileLayer as Q,isTiledLayer as $,isVoxelLayer as X}from"../layers/support/layerUtils.js";import{AnalysesCollection as Y}from"../support/AnalysesCollection.js";import{BreakpointsOwner as Z}from"./BreakpointsOwner.js";import{DOMContainer as J}from"./DOMContainer.js";import K from"./GroundView.js";import{PopupView as ee}from"./PopupView.js";import te from"./View.js";import ie from"./ViewAnimation.js";import{ViewingMode as re,stringFromViewingMode as se,viewingModeFromString as ae}from"./ViewingMode.js";import{layerView3DImporter as ne}from"./3d/layerViewModuleImportUtils.js";import oe from"./3d/analysis/AnalysisViewManager3D.js";import{Constraints as le}from"./3d/constraints/Constraints.js";import pe from"./3d/environment/SceneViewEnvironment.js";import{SceneViewEnvironmentManager as he}from"./3d/environment/SceneViewEnvironmentManager.js";import de from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as ce}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as ue}from"./3d/layers/graphics/Labeler.js";import{ObjectResourceCache as ge}from"./3d/layers/graphics/ObjectResourceCache.js";import{FeatureTileTree3D as me}from"./3d/layers/support/FeatureTileTree3D.js";import fe from"./3d/state/ViewState.js";import ye from"./3d/state/ViewStateManager.js";import{SceneIntersectionHelper as we}from"./3d/state/helpers/SceneIntersectionHelper.js";import{CombinedElevationProvider as ve}from"./3d/support/CombinedElevationProvider.js";import _e from"./3d/support/debugFlags.js";import be from"./3d/support/DisplayQualityProfile.js";import{getElevationAtPoint as Se}from"./3d/support/ElevationProvider.js";import Me from"./3d/support/HighlightOptions.js";import{MapCoordsHelper as Re}from"./3d/support/MapCoordsHelper.js";import{PropertiesPool as Ce}from"./3d/support/PropertiesPool.js";import Ve from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as Te}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as xe}from"./3d/support/ResourceController.js";import Oe from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as Ee}from"./3d/support/SharedSymbolResources.js";import{PointsOfInterest as je}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import Pe from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Le,getTiledLayerInfo as Ie,checkIfTileInfoSupportedForView as Ge}from"./3d/terrain/terrainUtils.js";import{Stage as He}from"./3d/webgl-engine/Stage.js";import{newIntersector as Ue,DEFAULT_TOLERANCE as Ae}from"./3d/webgl-engine/lib/Intersector.js";import{StoreResults as De,IntersectorType as We}from"./3d/webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as Fe}from"./3d/webgl-engine/lib/intersectorUtils.js";import{toHit as ke,toOwner as qe}from"./3d/webgl-engine/lib/intersectorUtilsConversions.js";import{TERRAIN_ID as ze}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{hitTestSelectSimilarDistance as Be}from"./support/hitTestSelectUtils.js";import{occludeesSupported as Ne}from"./support/layerViewUtils.js";import{encode as Qe,encodeData as $e,toRenderSettings as Xe,screenshotSuperSampleSettings as Ye}from"./support/screenshotUtils.js";import{isSupportedScreenPointEvent as Ze,createScreenPointFromSupportedEvent as Je}from"./support/screenUtils.js";import{isSpatialReferenceSupported as Ke}from"./support/spatialReferenceSupport.js";import{check as et}from"./support/WebGLRequirements.js";import tt from"./ui/3d/DefaultUI3D.js";import it from"../webscene/Environment.js";import rt from"../geometry/Extent.js";import st from"../geometry/SpatialReference.js";import at from"../geometry/Point.js";let nt=class extends(Z(J(ee(te)))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._defaults={},this._externallySet={environment:!1},this._createGraphicsViewController=null,this._resolveWhenReady=[],this._propertiesPool=new Ce({slicePlane:q},this),this._resourceController=xe(this),this._defaultToMapOptions={include:new Set},this._defaultHitTestOptions={exclude:new Set},this.deconflictor=new ce({view:this}),this.labeler=new ue({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new Y,this.basemapTerrain=null,this.elevationProvider=null,this.camera=null,this.canvas=null,this.center=null,this.constraints=new le,this.environmentManager=new he,this.extent=null,this.floors=new s,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new oe({view:this}),this.groundView=null,this.navigating=!1,this.map=null,this.screenSizePerspectiveEnabled=!0,this.state=new fe,this.scale=null,this.spatialReference=null,this.alphaCompositingEnabled=!1,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new tt,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this.viewpoint=null,this.zoom=null,this.highlightOptions=new Me,this.voxelWasm=null,this.voxelWasmPromise=null,x(),e&&e.environment||(this._defaults.environment=new pe,this.environment=this._defaults.environment);const t=(e=null)=>{g(e)&&e.type===f.MOVE||(this._updatingChanged(),this.map&&this.map.allLayers.forEach((async e=>{try{await e.when()}catch{}this._updatingChanged()})))};this.handles.add([w((()=>this.map?.allLayers),"after-changes",(e=>t(e)),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",(e=>this._updateUpdatingMonitors(e))),v((()=>this.map),(e=>{e&&"load"in e&&e.load&&e.load().catch((()=>{}))}))]),this.inputManager=new de({view:this}),this.stateManager=new ye({view:this})}initialize(){this.groundView=new K({view:this}),this._updateUpdatingMonitors();const e=()=>this._updateDefaultToMapOptions();this.handles.add(w((()=>this.map?.allLayers),"after-changes",e,{onListenerAdd:e,onListenerRemove:e})),this.updatingHandles.add((()=>this.qualitySettings.memoryLimit),(e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)}),_),this.updatingHandles.add((()=>this.qualitySettings.additionalCacheMemory),(e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)}),_),this.updatingHandles.add((()=>this.qualitySettings.frameRate),(e=>R(e>0?1e3/Math.ceil(e):0)),_),this.updatingHandles.add((()=>this.map?.ground),e,b),this.updatingHandles.add((()=>this.map?.ground?.opacity),(()=>this._updateDefaultHitTestOptions()),b),this.handles.add(v((()=>this.spatialReference),(()=>this.notifyChange("clippingArea")),M))}destroy(){this.destroyed||(this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._exitSurface(),this._disposeGraphicsView(),this.sharedSymbolResources=c(this.sharedSymbolResources),this.labeler.destroy(),this._set("labeler",null),this.deconflictor.destroy(),this._set("deconflictor",null),this._resourceController=c(this._resourceController),this.stateManager.destroy(),this._set("stateManager",null),this.inputManager.destroy(),this._set("inputManager",null),this._propertiesPool.destroy(),this.handles.remove("updatingMonitors"),this.environmentManager.destroy(),this._set("environmentManager",null),this.groundView=c(this.groundView))}get renderSpatialReference(){return this.renderCoordsHelper&&this.renderCoordsHelper.spatialReference}get basemapSpatialReference(){return this.basemapTerrain?.spatialReference}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get clippingArea(){if("global"===this.viewingMode)return null;let e=this._userClippingArea||this.get("map.clippingArea");return!(!!this._userClippingArea||this.get("map.clippingEnabled"))||u(e)?(this._clippingArea=null,null):e instanceof rt?this.spatialReference&&(e=pt(e,this.spatialReference),u(e))?(d.getLogger(this.declaredClass).error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(e=e.clone(),u(e.intersection(this._groundAndLayersExtent))&&(e.xmin=e.xmax,e.ymin=e.ymax),e.zmin=void 0,e.zmax=void 0,e.equals(this._clippingArea)||(this._clippingArea=e),this._clippingArea):(d.getLogger(this.declaredClass).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&g(e)?d.getLogger(this.declaredClass).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===re.Global)return null;const e=this.renderSpatialReference,t=this.dataExtent;return u(t)||u(e)||t.spatialReference.equals(e)?t:pt(t,e)}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||st.WGS84,i=pt(this.clippingArea,t);g(i)&&(e=g(e)?e.intersection(i):i);const r=this._get("dataExtent");return g(e)&&e.equals(r)?r:e}get _groundAndLayersExtent(){const e=this.spatialReference||st.WGS84;let t;const i=i=>{const r=pt(i,e);u(r)||(g(t)?t.union(r):t=r.clone())},r=this.basemapTerrain;if(r?.spatialReference){const e=r.groundExtent;i(new rt({xmin:e[0],ymin:e[1],zmin:0,xmax:e[2],ymax:e[3],zmax:0,spatialReference:r.spatialReference}))}if(this.map){const e=e=>{!g(e.fullExtent)||"graphics"===e.type&&e.internal||i(e.fullExtent)};this.map.allLayers.forEach((t=>e(t)))}if(u(t))return null;t.hasZ?(t.zmin=Math.min(0,t.zmin),t.zmax=Math.max(0,t.zmax)):(t.zmin=0,t.zmax=0);const s=this._get("_groundAndLayersExtent");return t.equals(s)?s:t}set environment(e){e!==this._defaults.environment&&(this._externallySet.environment=!0),this._set("environment",e)}castEnvironment(e){return e?e instanceof pe?e:e instanceof it?null!=this.environment?this.environment.cloneWithWebsceneEnvironment(e):pe.fromWebsceneEnvironment(e):P(pe,e):new pe}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get _defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||g(this.activeTool)}get stationary(){return!this.animation&&!this.resizing&&(u(this.state)||this.state.stationary)}set qualityProfile(e){be.isValidProfile(e)&&(be.apply(e,this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||be.getDefaultProfile()}set slicePlane(e){if(g(this._stage)&&this._stage.renderView.setRenderParameters({slicePlane:e}),u(e))return void this._set("slicePlane",null);const t=this._propertiesPool.get("slicePlane");z(e,t),this._set("slicePlane",t)}get typeSpecificPreconditionsReady(){return!!this.viewingMode}get resolution(){return null!=this.spatialReference?N(this.scale,this.spatialReference):0}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return null!=e?G.deriveUnitFromSR(e,this.spatialReference):null}get updating(){if(this.destroyed)return!1;let e=0,t=this.layerViewManager.updating,i=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach((r=>{if(r.isFulfilled()){if(r.updating){if(t=!0,r.suspended||Le(r))return;++i,e+=r.updatingProgress}}else++i}));for(const r of[this.graphicsView,this.basemapView,this._resourceController,this._stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager])if(g(r)&&r.updating){const t=.1;i+=t,e+=.5*t}for(const r of[this.deconflictor,this.labeler,this.basemapTerrain])g(r)&&r.updating&&(++i,e+=r.updatingProgress);if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||this._createGraphicsViewController||this.inputManager?.hasPendingInputs||this.map?.allLayers?.some((e=>!e.isFulfilled()))),t?(this._numUpdating=Math.max(i,this._numUpdating),e+=this._numUpdating-i):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=t?0:1,this._get("updatingProgress")!==e){const i=performance.now();if(e<1){const t=Math.min((i-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set("updatingProgress",e),this._lastUpdateTime=t&&e<1?i:0}return t}get viewingMode(){const e=this._predeterminedViewingMode;if(g(e))return se(e);const t=this.spatialReference;return t?g(this.defaultsFromMap?.viewingMode)&&t.equals(this.defaultsFromMap.spatialReference)?se(this.defaultsFromMap.viewingMode):Ke(t,re.Global)?"global":"local":"global"}set viewingMode(e){this.ready?d.getLogger(this.declaredClass).error("#viewingMode","viewingMode cannot be set once view is ready"):e?this._override("viewingMode",e):void 0===e&&this._clearOverride("viewingMode")}get resourceController(){return this._resourceController}get performanceInfo(){return new Oe(this)}forceAnimationTime(e){this._stage.renderView.forcedAnimationTime=this.basemapTerrain.overlayManager.forcedAnimationTime=e}on(e,t,i,r){const s=this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return d.getLogger(this.declaredClass).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=t?this.externalToInternalIntersectOptions(t):this._defaultToMapOptions,r=g(i.graphics)&&(g(i.graphics.include)||g(i.graphics.exclude)),s=Ze(e)?Je(this,e):e,a=C(s);i.enableDraped=i.include&&!i.include.has(ze)||i.exclude&&i.exclude.has(ze);const n=this.sceneIntersectionHelper,o=Ue(this.state.viewingMode);if(o.options.selectionMode=!0,o.options.store=r?De.ALL:De.MIN,n.intersectIntersectorScreen(a,o,i),r){for(const e of o.results.all){const t=ke(e,this);if(u(t))return this._intersectResultToMapPoint(e);if("graphic"!==t.type||this._testGraphicUidFilter(i.graphics,t.graphic))return this._intersectResultToMapPoint(e)}return null}return this._intersectResultToMapPoint(o.results.min)}toScreen(e){if(!this.ready)return d.getLogger(this.declaredClass).error("#toScreen()","Scene view cannot be used before it is ready"),null;const t=m(null==e.z&&Se(this.elevationProvider,e),0);return A(e,dt,this.renderSpatialReference,t),this.state.camera.projectToScreen(dt,ct),V(ct[0],ct[1])}pixelSizeAt(e){return this.ready?e?(A(e,dt,this.renderSpatialReference),this.state.camera.computeScreenPixelSizeAt(dt)):0:(d.getLogger(this.declaredClass).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null)}overlayPixelSizeInMapUnits(e){const t=this.basemapTerrain.overlayManager;return t?t.overlayPixelSizeInMapUnits(e):1}hitTest(e,t){if(!this.ready)return d.getLogger(this.declaredClass).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=Ze(e)?Je(this,e):e,r=T(i.x,i.y),s=t?this.externalToInternalIntersectOptions(t):this._defaultHitTestOptions;s.requiresGroundFeedback=!0,s.enableDraped=!0;const a=Ue(this.state.viewingMode);a.options.selectionMode=!0,a.options.store=De.ALL,this.sceneIntersectionHelper.intersectIntersectorScreen(r,a,s);const n=this._intersectResultsToHits(a.results.all,s.graphics),o=a.results.ground,l=qe(o,this),p=g(l)&&"type"in l&&"integrated-mesh"===l.type?l:null,h={screenPoint:i,results:n,ground:{mapPoint:this._intersectResultToMapPoint(o),distance:Fe(o)?o.distanceInRenderSpace:0,layer:p}};return _e.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(h.intersector=a),Promise.resolve(h)}async popupHitTest(e){const{results:t,ground:i}=await Be(this,e);let r=null;return!(0===t.length||Math.abs(m(t[0].distance,0)-i.distance)<1e-5)||i.layer&&"integrated-mesh"===i.layer.type||(r=i.mapPoint),{results:t,screenPoint:e,mapPoint:r}}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async whenAnalysisView(e){if(u(e.parent))throw new n("view:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e});if("line-of-sight"===e.parent.type){return(await this.whenLayerView(e.parent)).whenAnalysisView()}return this.analysisViewManager.whenAnalysisView(e)}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const t=this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return Qe(i,t,this._pixelFormat())}async _takeScreenshot(e){const t=this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return $e(i,this._pixelFormat())}_completeSettings(e){const t=Xe(e,this);return t.pixelRatio/=this.state.pixelRatio,Ye(t,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this._stage.renderView.getAlpha()}}get test(){return{takeScreenshot:e=>this._takeScreenshot(e)}}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return ne.importLayerView(e)}hasLayerViewModule(e){return ne.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map?.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}async validate(){let e=et(this.type);if(has("safari")&&has("safari")<9&&(e=new n("sceneview:browser-not-supported","This browser is not supported by SceneView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:has("safari")})),g(e))throw d.getLogger(this.declaredClass).warn("#validate()",e.message),e}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):(this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties?.viewingMode:null)??null;return g(e)?ae(e):null}getSpatialReferenceSupport({spatialReference:e,layer:t}){const i=this._predeterminedViewingMode;if(g(i))return this._validateSpatialReferenceForViewingMode(e,t,i)?{constraints:this._makeSpatialReferenceConstraints(e,t,i)}:null;const r=this._validateSpatialReferenceForViewingMode(e,t,re.Local),s=this._validateSpatialReferenceForViewingMode(e,t,re.Global);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,re.Local)}:{constraints:this._makeSpatialReferenceConstraints(e,t,re.Global)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!Ke(e,i)&&(!!u(t)||(!!Q(t)||(!$(t)||!u(Ie(t,e,i)))&&(!X(t)||i!==re.Global)))}_makeSpatialReferenceConstraints(e,t,i){if(u(t))return[{spatialReference:e,viewingMode:i}];const r=e.isWebMercator,s=e.isWGS84;if(Q(t)&&(r||s)){return!s||i===re.Local||null===Ge(t.tileInfo,t.fullExtent,e,re.Global)?[{spatialReference:e,viewingMode:i},{spatialReference:st.WebMercator,viewingMode:i}]:[{spatialReference:r?st.WGS84:st.WebMercator,viewingMode:i}]}return $(t)||X(t)||!r&&!s?$(t)&&r&&i!==re.Global?[{spatialReference:e,viewingMode:i},{spatialReference:st.WGS84,viewingMode:re.Local}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?st.WGS84:st.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=g(this.getSpatialReferenceSupport({spatialReference:e})),i=this._predeterminedViewingMode;return t||(g(i)?d.getLogger(this.declaredClass).warnOnce(`Spatial reference defined on view not supported in ${se(i)} viewing mode.`):e.isGeographic&&d.getLogger(this.declaredClass).warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}computeMapPointFromVec3d(e,t){let i=this.spatialReference||st.WGS84;return D(e,this.renderSpatialReference,e,i)||(i=st.WGS84,D(e,this.renderSpatialReference,e,i)),t?(t.x=e[0],t.y=e[1],t.z=e[2],t.spatialReference=i):t=new at(e,i),t}trackGraphicState(e){if(!e.graphic)return d.getLogger(this.declaredClass).error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const t=this.getViewForGraphic(e.graphic);let i=null,r=!1;const s=t=>{!r&&g(t)&&"processor"in t&&"graphics-3d"===t.processor?.type&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return g(t)?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),{remove:()=>{r=!0,g(i)&&(i.remove(),i=null)}}}highlight(e){if(Array.isArray(e))return l(e.map((e=>this.highlight(e))));if(s.isCollection(e))return l(e.toArray().map((e=>this.highlight(e))));const t=this.getViewForGraphic(e);return t&&"highlight"in t?t.highlight(e):p()}maskOccludee(e){if(!e)return d.getLogger(this.declaredClass).error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const t=this.getViewForGraphic(e);let i=null,r=!1;const s=t=>{!r&&g(t)&&Ne(t)&&(i=t.maskOccludee(e))};return g(t)?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),{remove:()=>{r=!0,g(i)&&(i.remove(),i=null)}}}getViewForGraphic(e){return e.layer===this.graphics?this.graphicsView:e.layer?this.allLayerViews.find((t=>t.layer===e.layer)):null}graphicChanged(e){g(this.graphicsView)&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){if(e.layer===this)return await S((()=>this.graphicsView)),this.graphicsView;if(!e.layer||!this.map)throw new n("no-view-for-graphic");return t&&t.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise(((t,i)=>{const r=this.map.allLayers.on("change",(s=>{s.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,i))}))})):this.whenLayerView(e.layer)}externalToInternalIntersectOptions(e){const t=this._externalToInternalRenderItems(e.include,ht.INCLUDE),i=this._externalToInternalRenderItems(e.exclude,ht.EXCLUDE);return{include:t.layerUids,exclude:i.layerUids,graphics:{include:t.graphicUids,exclude:i.graphicUids}}}_intersectResultToMapPoint(e,t){return e.getIntersectionPoint(dt)?(t=this.computeMapPointFromVec3d(dt,t),e.intersector===We.TERRAIN&&this.basemapTerrain&&(t.z=m(Se(this.basemapTerrain,t),0)),t):null}_intersectResultsToHits(e,t){const i=new Array;let r=null;for(let s=0;s<e.length;s++){const a=e[s],n=qe(a,this);if(g(n)&&(n===this.map.ground||"type"in n&&"integrated-mesh"===n.type))break;const o=ke(a,this);if(u(o))continue;if("graphic"===o.type){if(u(r)&&s!==e.length-1&&(r=new Set),g(r)){const e=this._getGraphicFilterUid(o.graphic);if(r.has(e))continue;r.add(e)}if(!this._testGraphicUidFilter(t,o.graphic))continue}const l=this._intersectResultToMapPoint(a),p=a.distanceInRenderSpace;i.push({...o,mapPoint:l,distance:p})}return i}_getGraphicFilterUid(e){if(e.sourceLayer&&"objectIdField"in e.sourceLayer){const t=e.attributes[e.sourceLayer.objectIdField];if(t)return`o-${e.sourceLayer.id}-${t}`}return`u-${e.uid}`}_testGraphicUidFilter(e,t){const i=this._getGraphicFilterUid(t);return u(e)||(u(e.include)||e.include.has(i))&&(u(e.exclude)||!e.exclude.has(i))}_externalToInternalRenderItems(e,t,r={layerUids:null,graphicUids:null}){if(!e)return r;if(e instanceof i)lt(r,this._getGraphicFilterUid(e)),t===ht.INCLUDE&&(g(this.graphicsView)&&e.layer===this?ot(r,this.graphicsView.processor.layer.id):e.layer&&ot(r,e.layer.uid));else if(h(e))for(const i of e)i===this.graphics&&g(this.graphicsView)?ot(r,this.graphicsView.processor.layer.id):i===this.map.ground?ot(r,ze):this._externalToInternalRenderItems(i,t,r);else"uid"in e&&ot(r,e.uid);return r}_initBasemapTerrain(){this._set("basemapTerrain",new Pe({view:this})),this._set("elevationProvider",new ve({view:this})),this.elevationProvider.register("ground",this.basemapTerrain)}_exitBasemapTerrain(){this.basemapTerrain&&(this.elevationProvider.unregister(this.basemapTerrain),this.elevationProvider.destroy(),this._set("elevationProvider",null),this.basemapTerrain.destroy(),this._set("basemapTerrain",null))}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new je({view:this})),this._set("featureTiles",new me({renderCoordsHelper:this.renderCoordsHelper,cameraOnSurface:this.pointsOfInterest.contentCameraOnSurface,focus:this.pointsOfInterest.focus,tilingSchemeOwner:this.basemapTerrain,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}));const e=()=>{const e=this.basemapTerrain?.extent;if(this.clippingArea||e)if(e&&this.basemapTerrain.spatialReference){const e=g(this.basemapTerrain.extent)&&g(this.basemapTerrain.spatialReference)?U(k(this.basemapTerrain.extent,this.basemapTerrain.spatialReference),this.spatialReference):null;g(this.clippingArea)?this.featureTiles.filterExtent=this.clippingArea.intersection(e):this.featureTiles.filterExtent=e}else this.featureTiles.filterExtent=this.clippingArea;else this.featureTiles.filterExtent=null};this.handles.add([this.updatingHandles.add((()=>_e.FEATURE_TILE_TREE_SHOW_TILES),(e=>{e&&this.featureTiles&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then((({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&_e.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))})):e||!this._featureTreeDebugger||_e.FEATURE_TILE_TREE_SHOW_TILES||(this._featureTreeDebugger.destroy(),this._featureTreeDebugger=null)}),b),this.updatingHandles.add((()=>this.clippingArea),e,b),this.updatingHandles.add((()=>this.basemapTerrain.extent),e,b)],"feature-tiles"),this.stateManager.init()}_exitGlobe(){this.state&&(this.stateManager.deinit(),this.handles.remove("render-coords-helper"),this.handles.remove("feature-tiles"),this.featureTiles.destroy(),this._set("featureTiles",null),this.pointsOfInterest.destroy(),this._set("pointsOfInterest",null),this._exitBasemapTerrain(),this.state.exit(),this._exitCoordinateSystem())}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference;this.mapCoordsHelper&&this.mapCoordsHelper.spatialReference.equals(e)||this._set("mapCoordsHelper",new Re(this.map,e));const t=this.state.isGlobal,i=B(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",Te.create(this.state.viewingMode,i)),t||this.handles.add(v((()=>this.basemapTerrain?.extent),(e=>{const t=this.renderCoordsHelper.spatialReference;e&&(0!==e[0]||0!==e[1]||0!==e[2]||0!==e[3])&&W(e,this.basemapTerrain.spatialReference,ut,t)&&(this.renderCoordsHelper.extent=ut)}),M),"render-coords-helper"),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(Ae/this.renderCoordsHelper.unitInMeters))}else this._set("mapCoordsHelper",null),this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.mapCoordsHelper&&(this.handles.remove("render-coords-helper"),this._set("renderCoordsHelper",null),this._set("mapCoordsHelper",null))}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){g(e)&&e.type===f.MOVE||(this.handles.remove("updatingMonitors"),this.allLayerViews.forEach((e=>{e.destroyed||(this.handles.add(v((()=>[e.updating,e.updatingProgress]),(()=>this._updatingChanged()),M),"updatingMonitors"),e.when((()=>this._updatingChanged()),(()=>this._updatingChanged())))})),this._updatingChanged())}_renderScreenshotOverlay(e,t){if(!this.overlay||!this.overlay.hasVisibleItems)return t;const i=e.getContext("2d");return i.putImageData(t,0,0),this.overlay.renderCanvas(e),i.getImageData(0,0,t.width,t.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{renderOverlay:(e,t)=>this._renderScreenshotOverlay(e,t)}},t=new we(this.state.viewingMode,(e=>this._stage.layers.forAll(e)),this);this._set("sceneIntersectionHelper",t);const i=a(this.surface),{resourceController:r,state:s,renderSpatialReference:l}=this;this._stage=new He({options:e,container:i,resourceController:r,state:s,sceneIntersectionHelper:t,renderSR:l}),this._stage.renderView.setRenderParameters({slicePlane:this.slicePlane}),this._lostWebGLContextHandle=o(this._stage.renderView.canvas,"webglcontextlost",(()=>this.fatalError=new n("webgl-context-lost"))),this.handles.add([this.updatingHandles.add((()=>this.qualitySettings.antialiasingEnabled),(()=>this._stage.renderView.setRenderParameters({antialiasingEnabled:this.qualitySettings.antialiasingEnabled})),_),this.updatingHandles.add((()=>this.qualitySettings.highQualityTransparency),(()=>this._stage.renderView.setRenderParameters({highQualityTransparency:this.qualitySettings.highQualityTransparency})),_),v((()=>this.magnifier),(e=>this._stage.renderView.magnifier=e),b)],"stage");const p=()=>{this._stage.renderView.setRenderParameters({defaultHighlightOptions:Me.toEngineOptions(this.highlightOptions)})};this.handles.add(this.updatingHandles.add((()=>[this.highlightOptions.color,this.highlightOptions.haloColor,this.highlightOptions.haloOpacity,this.highlightOptions.fillOpacity,this.highlightOptions.shadowOpacity,this.highlightOptions.shadowColor,this.highlightOptions.shadowDifference]),p),"stage"),p(),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(Ae/this.renderCoordsHelper.unitInMeters),this._set("canvas",this._stage.renderView.canvas)}_exitStage(){this._set("sceneIntersectionHelper",null),this._stage.destroy(),this._stage=null,this._lostWebGLContextHandle.remove(),this._lostWebGLContextHandle=null,this.handles.remove("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this.state.init(e,this.spatialReference),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new Ee({view:this,viewingMode:e,resourceController:this._resourceController,pointsOfInterest:this.pointsOfInterest,viewState:this.state,objectResourceCache:new ge})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitGlobe(),this._exitStage())}_createGraphicsViewIfNeeded(){if(this.graphicsView||this._createGraphicsViewController)return;if(0===this.graphics.length)return;this.handles.remove("graphics-view"),this._createGraphicsViewController=new AbortController;const e=()=>{this._createGraphicsViewController=null,this._updatingChanged()};this._createGraphicsViewAsync(this._createGraphicsViewController.signal).then(e,e),this._updatingChanged()}async _createGraphicsViewAsync(e){const t=(await import("./3d/layers/GraphicsView3D.js")).default;y(e),await S((()=>this.basemapTerrain?.ready),e),this._set("graphicsView",new t({view:this}))}_disposeGraphicsView(){this._createGraphicsViewController&&(this._createGraphicsViewController.abort(),this._createGraphicsViewController=null),this.handles.remove("graphics-view"),g(this.graphicsView)&&(this.handles.remove(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_startup(){const e=ae(this.viewingMode);if(e===re.Global&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.handles.add(w((()=>this.graphics),"after-changes",(()=>this._createGraphicsViewIfNeeded())),"graphics-view"),this._createGraphicsViewIfNeeded(),!this._externallySet.environment){const e=this.get("map.initialViewProperties.environment");e&&(this.environment=e)}this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();const t=this._resolveWhenReady;this._resolveWhenReady=[],t.forEach((e=>e(this)))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this.labeler.dispose(),this._disposeGraphicsView(),this.handles.remove("graphics-view"),this._exitSurface(),this._set("ready",!1)}_updateDefaultToMapOptions(){if(this._defaultToMapOptions.include.clear(),this.map){this.map.ground&&this._defaultToMapOptions.include.add(ze);for(const e of this.map.allLayers.items)"integrated-mesh"===e.type&&this._defaultToMapOptions.include.add(e.uid)}}_updateDefaultHitTestOptions(){if(this._defaultHitTestOptions.exclude.clear(),this.map){this.map.ground&&this.map.ground.opacity<1&&this._defaultHitTestOptions.exclude.add(ze);for(const e of this.map.allLayers.items)"integrated-mesh"===e.type&&e.opacity<1&&this._defaultToMapOptions.exclude.add(e.uid)}}addVoxelLayerViewToWasm(e){return u(this.voxelWasm)?(u(this.voxelWasmPromise)&&(this.voxelWasmPromise=import("../layers/VoxelWasmPerSceneView.js").then((e=>(this.voxelWasm=new e.default(this),this.voxelWasm)))),this.voxelWasmPromise.then((t=>t.addVoxelLayer(e)))):this.voxelWasm.addVoxelLayer(e)}removeVoxelLayerViewFromWasm(e){if(g(this.voxelWasm)){this.voxelWasm.removeVoxelLayer(e)<1&&(this.voxelWasm=null,this.voxelWasmPromise=null)}}};function ot(e,t){e.layerUids||(e.layerUids=new Set),e.layerUids.add(t)}function lt(e,t){e.graphicUids||(e.graphicUids=new Set),e.graphicUids.add(t)}function pt(e,t){return g(e)&&H(e.spatialReference,t)?U(e,t):null}var ht;nt.type="3d",e([O()],nt.prototype,"_userClippingArea",void 0),e([O()],nt.prototype,"_resourceController",void 0),e([O()],nt.prototype,"_stage",void 0),e([O({readOnly:!0})],nt.prototype,"deconflictor",void 0),e([O({readOnly:!0})],nt.prototype,"labeler",void 0),e([O(I(Y,"analyses"))],nt.prototype,"analyses",void 0),e([O({type:ie,readOnly:!0,aliasOf:"state.animation"})],nt.prototype,"animation",void 0),e([O({readOnly:!0})],nt.prototype,"basemapTerrain",void 0),e([O({readOnly:!0})],nt.prototype,"elevationProvider",void 0),e([O({type:t,aliasOf:"stateManager.camera"})],nt.prototype,"camera",void 0),e([O({type:t,aliasOf:"stateManager.contentCamera"})],nt.prototype,"contentCamera",void 0),e([O({readOnly:!0})],nt.prototype,"canvas",void 0),e([O({type:at,aliasOf:"stateManager.center"})],nt.prototype,"center",void 0),e([O({type:rt})],nt.prototype,"clippingArea",null),e([O({type:le})],nt.prototype,"constraints",void 0),e([O({type:rt,readOnly:!0})],nt.prototype,"renderDataExtent",null),e([O({type:rt,readOnly:!0})],nt.prototype,"dataExtent",null),e([O({type:rt,readOnly:!0})],nt.prototype,"_groundAndLayersExtent",null),e([O({value:null,type:pe})],nt.prototype,"environment",null),e([E("environment")],nt.prototype,"castEnvironment",null),e([O({readOnly:!0})],nt.prototype,"environmentManager",void 0),e([O({type:rt,aliasOf:"stateManager.extent"})],nt.prototype,"extent",void 0),e([O()],nt.prototype,"floors",void 0),e([O({readOnly:!0,aliasOf:"stateManager.screenCenter"})],nt.prototype,"screenCenter",void 0),e([O({aliasOf:"stateManager.frustum"})],nt.prototype,"frustum",void 0),e([O({type:Number,readOnly:!0})],nt.prototype,"fullOpacity",void 0),e([O({readOnly:!0})],nt.prototype,"graphicsView",void 0),e([O({readOnly:!0})],nt.prototype,"analysisViewManager",void 0),e([O()],nt.prototype,"groundView",void 0),e([O({type:Boolean})],nt.prototype,"initialExtentRequired",null),e([O()],nt.prototype,"_defaultsFromMapSettings",null),e([O({type:Boolean,readOnly:!0})],nt.prototype,"interacting",null),e([O()],nt.prototype,"stationary",null),e([O({aliasOf:"state.navigating"})],nt.prototype,"navigating",void 0),e([O()],nt.prototype,"map",void 0),e([O({readOnly:!0})],nt.prototype,"mapCoordsHelper",void 0),e([O({aliasOf:"stateManager.padding"})],nt.prototype,"padding",void 0),e([O({type:je,readOnly:!0})],nt.prototype,"pointsOfInterest",void 0),e([O({type:me,readOnly:!0})],nt.prototype,"featureTiles",void 0),e([O()],nt.prototype,"_featureTreeDebugger",void 0),e([O({type:Boolean})],nt.prototype,"screenSizePerspectiveEnabled",void 0),e([O({constructOnly:!0})],nt.prototype,"deactivatedWebGLExtensions",void 0),e([O({constructOnly:!0})],nt.prototype,"debugWebGLExtensions",void 0),e([O({constructOnly:!0})],nt.prototype,"renderCanvas",void 0),e([O({constructOnly:!0})],nt.prototype,"state",void 0),e([O({readOnly:!0})],nt.prototype,"inputManager",void 0),e([O({readOnly:!0})],nt.prototype,"stateManager",void 0),e([O({type:["low","medium","high"]})],nt.prototype,"qualityProfile",null),e([O({type:Ve,get(){let e=this._get("qualitySettings");return e||(e=new Ve,be.apply(this.qualityProfile,e)),e}})],nt.prototype,"qualitySettings",void 0),e([O()],nt.prototype,"slicePlane",null),e([O({readOnly:!0})],nt.prototype,"typeSpecificPreconditionsReady",null),e([O({readOnly:!0})],nt.prototype,"renderCoordsHelper",void 0),e([O({readOnly:!0})],nt.prototype,"sceneIntersectionHelper",void 0),e([O({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],nt.prototype,"resolution",null),e([O({type:Number,aliasOf:"stateManager.scale"})],nt.prototype,"scale",void 0),e([O()],nt.prototype,"heightModelInfo",null),e([O()],nt.prototype,"spatialReference",void 0),e([O({type:Boolean,constructOnly:!0})],nt.prototype,"alphaCompositingEnabled",void 0),e([O({constructOnly:!0})],nt.prototype,"preserveDrawingBufferEnabled",void 0),e([O({type:Boolean})],nt.prototype,"supersampleScreenshotsEnabled",void 0),e([O({readOnly:!0})],nt.prototype,"type",void 0),e([O({type:tt})],nt.prototype,"ui",void 0),e([O({type:Boolean,readOnly:!0,dependsOn:["graphicsView.updating","basemapView.updating","basemapTerrain.updating","layerViewManager.updating","layerViewManager.updatingRemaining","_resourceController.updating","_stage.updating","featureTiles.updating","pointsOfInterest.updating","environmentManager.updating","overlay.updating","updatingHandles.updating","featureTreeDebugger.updating","labeler.updating","deconflictor.updating","ready","stationary","inputManager.hasPendingInputs","toolViewManager.updating","analysisViewManager.updating"]})],nt.prototype,"updating",null),e([O({type:Number,readOnly:!0,dependsOn:["updating"]})],nt.prototype,"updatingProgress",void 0),e([O({type:["global","local"]})],nt.prototype,"viewingMode",null),e([O({type:r,aliasOf:"stateManager.viewpoint"})],nt.prototype,"viewpoint",void 0),e([O({type:Number,aliasOf:"stateManager.zoom"})],nt.prototype,"zoom",void 0),e([O({type:Me})],nt.prototype,"highlightOptions",void 0),nt=e([j("esri.views.SceneView")],nt),function(e){e[e.INCLUDE=0]="INCLUDE",e[e.EXCLUDE=1]="EXCLUDE"}(ht||(ht={}));const dt=L(),ct=T(),ut=F(),gt=nt;export{gt as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Camera.js";import"../geometry.js";import i from"../Graphic.js";import r from"../Viewpoint.js";import s from"../core/Collection.js";import{byId as n}from"../core/domUtils.js";import a from"../core/Error.js";import{on as o}from"../core/events.js";import{handlesGroup as l,makeHandle as p}from"../core/handleUtils.js";import has from"../core/has.js";import{isIterable as h}from"../core/iteratorUtils.js";import d from"../core/Logger.js";import{destroyMaybe as c,isNone as u,isSome as g,unwrapOr as m}from"../core/maybe.js";import{ObservableChangesType as f}from"../core/ObservableChangesType.js";import{throwIfAborted as y}from"../core/promiseUtils.js";import{on as w,watch as v,initial as _,syncAndInitial as b,whenOnce as M,sync as S}from"../core/reactiveUtils.js";import{setFrameDuration as C}from"../core/scheduling.js";import{screenPointObjectToArray as R,createScreenPoint as V,createScreenPointArray as T}from"../core/screenUtils.js";import{initialize as x}from"../core/workers/workers.js";import{property as O}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import{cast as j}from"../core/accessorSupport/decorators/cast.js";import{subclass as E}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as L}from"../core/accessorSupport/ensureType.js";import{c as I}from"../chunks/vec3f64.js";import{owningCollectionProperty as P}from"../core/support/OwningCollection.js";import G from"../geometry/HeightModelInfo.js";import{projectPointToVector as A,projectVectorToVector as H,canProjectWithoutEngine as U,project as D,projectBoundingRect as W}from"../geometry/projection.js";import{create as F,toExtent as k}from"../geometry/support/aaBoundingRect.js";import{B as q,c as z}from"../chunks/boundedPlane.js";import{renderSRFromViewSR as N}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as B}from"../geometry/support/scaleUtils.js";import{isImageryTileLayer as Q,isTiledLayer as $,isVoxelLayer as X}from"../layers/support/layerUtils.js";import{AnalysesCollection as Y}from"../support/AnalysesCollection.js";import{BreakpointsOwner as Z}from"./BreakpointsOwner.js";import{DOMContainer as J}from"./DOMContainer.js";import K from"./GroundView.js";import{PopupView as ee}from"./PopupView.js";import te from"./View.js";import ie from"./ViewAnimation.js";import{ViewingMode as re,stringFromViewingMode as se,viewingModeFromString as ne}from"./ViewingMode.js";import{layerView3DImporter as ae}from"./3d/layerViewModuleImportUtils.js";import oe from"./3d/analysis/AnalysisViewManager3D.js";import{Constraints as le}from"./3d/constraints/Constraints.js";import pe from"./3d/environment/SceneViewEnvironment.js";import{SceneViewEnvironmentManager as he}from"./3d/environment/SceneViewEnvironmentManager.js";import de from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as ce}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as ue}from"./3d/layers/graphics/Labeler.js";import{ObjectResourceCache as ge}from"./3d/layers/graphics/ObjectResourceCache.js";import{FeatureTileTree3D as me}from"./3d/layers/support/FeatureTileTree3D.js";import fe from"./3d/state/ViewState.js";import ye from"./3d/state/ViewStateManager.js";import{SceneIntersectionHelper as we}from"./3d/state/helpers/SceneIntersectionHelper.js";import{CombinedElevationProvider as ve}from"./3d/support/CombinedElevationProvider.js";import _e from"./3d/support/debugFlags.js";import be from"./3d/support/DisplayQualityProfile.js";import{getElevationAtPoint as Me}from"./3d/support/ElevationProvider.js";import Se from"./3d/support/HighlightOptions.js";import{MapCoordsHelper as Ce}from"./3d/support/MapCoordsHelper.js";import{PropertiesPool as Re}from"./3d/support/PropertiesPool.js";import Ve from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as Te}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as xe}from"./3d/support/ResourceController.js";import Oe from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as je}from"./3d/support/SharedSymbolResources.js";import{PointsOfInterest as Ee}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import Le from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as Ie,getTiledLayerInfo as Pe,checkIfTileInfoSupportedForView as Ge}from"./3d/terrain/terrainUtils.js";import{Stage as Ae}from"./3d/webgl-engine/Stage.js";import{newIntersector as He,DEFAULT_TOLERANCE as Ue}from"./3d/webgl-engine/lib/Intersector.js";import{StoreResults as De,IntersectorType as We}from"./3d/webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as Fe}from"./3d/webgl-engine/lib/intersectorUtils.js";import{toHit as ke,toOwner as qe}from"./3d/webgl-engine/lib/intersectorUtilsConversions.js";import{TERRAIN_ID as ze}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{hitTestSelectSimilarDistance as Ne}from"./support/hitTestSelectUtils.js";import{occludeesSupported as Be}from"./support/layerViewUtils.js";import{encode as Qe,encodeData as $e,toRenderSettings as Xe,screenshotSuperSampleSettings as Ye}from"./support/screenshotUtils.js";import{isSupportedScreenPointEvent as Ze,createScreenPointFromSupportedEvent as Je}from"./support/screenUtils.js";import{isSpatialReferenceSupported as Ke}from"./support/spatialReferenceSupport.js";import{check as et}from"./support/WebGLRequirements.js";import tt from"./ui/3d/DefaultUI3D.js";import it from"../webscene/Environment.js";import rt from"../geometry/Extent.js";import st from"../geometry/SpatialReference.js";import nt from"../geometry/Point.js";let at=class extends(Z(J(ee(te)))){constructor(e){super(e),this._userClippingArea=null,this._clippingArea=null,this._initialDefaultSpatialReference=null,this._defaults={},this._externallySet={environment:!1},this._createGraphicsViewController=null,this._resolveWhenReady=[],this._propertiesPool=new Re({slicePlane:q},this),this._resourceController=xe(this),this._defaultToMapOptions={include:new Set},this._defaultHitTestOptions={exclude:new Set},this.deconflictor=new ce({view:this}),this.labeler=new ue({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.analyses=new Y,this.basemapTerrain=null,this.elevationProvider=null,this.canvas=null,this.constraints=new le,this.environmentManager=new he,this.floors=new s,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new oe({view:this}),this.groundView=null,this.map=null,this.screenSizePerspectiveEnabled=!0,this.state=new fe,this.spatialReference=null,this.alphaCompositingEnabled=!1,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new tt,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this.highlightOptions=new Se,this.voxelWasm=null,this.voxelWasmPromise=null,x(),e&&e.environment||(this._defaults.environment=new pe,this.environment=this._defaults.environment);const t=(e=null)=>{g(e)&&e.type===f.MOVE||(this._updatingChanged(),this.map&&this.map.allLayers.forEach((async e=>{try{await e.when()}catch{}this._updatingChanged()})))};this.handles.add([w((()=>this.map?.allLayers),"after-changes",(e=>t(e)),{onListenerAdd:()=>t(),onListenerRemove:()=>t(),sync:!0}),this.allLayerViews.on("after-changes",(e=>this._updateUpdatingMonitors(e))),v((()=>this.map),(e=>{e&&"load"in e&&e.load&&e.load().catch((()=>{}))}))]),this.inputManager=new de({view:this}),this.stateManager=new ye({view:this})}initialize(){this.groundView=new K({view:this}),this._updateUpdatingMonitors();const e=()=>this._updateDefaultToMapOptions();this.handles.add(w((()=>this.map?.allLayers),"after-changes",e,{onListenerAdd:e,onListenerRemove:e})),this.updatingHandles.add((()=>this.qualitySettings.memoryLimit),(e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)}),_),this.updatingHandles.add((()=>this.qualitySettings.additionalCacheMemory),(e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)}),_),this.updatingHandles.add((()=>this.qualitySettings.frameRate),(e=>C(e>0?1e3/Math.ceil(e):0)),_),this.updatingHandles.add((()=>this.map?.ground),e,b),this.updatingHandles.add((()=>this.map?.ground?.opacity),(()=>this._updateDefaultHitTestOptions()),b),this.handles.add(v((()=>this.spatialReference),(()=>this.notifyChange("clippingArea")),S))}destroy(){this.destroyed||(this.invalidate(),this.activeTool=null,this.layerViewManager.clear(),this._exitSurface(),this._disposeGraphicsView(),this.sharedSymbolResources=c(this.sharedSymbolResources),this.labeler.destroy(),this._set("labeler",null),this.deconflictor.destroy(),this._set("deconflictor",null),this._resourceController=c(this._resourceController),this.stateManager.destroy(),this._set("stateManager",null),this.inputManager.destroy(),this._set("inputManager",null),this._propertiesPool.destroy(),this.handles.remove("updatingMonitors"),this.environmentManager.destroy(),this._set("environmentManager",null),this.groundView=c(this.groundView))}get renderSpatialReference(){return this.renderCoordsHelper&&this.renderCoordsHelper.spatialReference}get basemapSpatialReference(){return this.basemapTerrain?.spatialReference}get animation(){return this.state?.animation}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 center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=e)}get clippingArea(){if("global"===this.viewingMode)return null;let e=this._userClippingArea||this.get("map.clippingArea");return!(!!this._userClippingArea||this.get("map.clippingEnabled"))||u(e)?(this._clippingArea=null,null):e instanceof rt?this.spatialReference&&(e=pt(e,this.spatialReference),u(e))?(d.getLogger(this.declaredClass).error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(e=e.clone(),u(e.intersection(this._groundAndLayersExtent))&&(e.xmin=e.xmax,e.ymin=e.ymax),e.zmin=void 0,e.zmax=void 0,e.equals(this._clippingArea)||(this._clippingArea=e),this._clippingArea):(d.getLogger(this.declaredClass).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&g(e)?d.getLogger(this.declaredClass).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===re.Global)return null;const e=this.renderSpatialReference,t=this.dataExtent;return u(t)||u(e)||t.spatialReference.equals(e)?t:pt(t,e)}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||st.WGS84,i=pt(this.clippingArea,t);g(i)&&(e=g(e)?e.intersection(i):i);const r=this._get("dataExtent");return g(e)&&e.equals(r)?r:e}get _groundAndLayersExtent(){const e=this.spatialReference||st.WGS84;let t;const i=i=>{const r=pt(i,e);u(r)||(g(t)?t.union(r):t=r.clone())},r=this.basemapTerrain;if(r?.spatialReference){const e=r.groundExtent;i(new rt({xmin:e[0],ymin:e[1],zmin:0,xmax:e[2],ymax:e[3],zmax:0,spatialReference:r.spatialReference}))}if(this.map){const e=e=>{!g(e.fullExtent)||"graphics"===e.type&&e.internal||i(e.fullExtent)};this.map.allLayers.forEach((t=>e(t)))}if(u(t))return null;t.hasZ?(t.zmin=Math.min(0,t.zmin),t.zmax=Math.max(0,t.zmax)):(t.zmin=0,t.zmax=0);const s=this._get("_groundAndLayersExtent");return t.equals(s)?s:t}set environment(e){e!==this._defaults.environment&&(this._externallySet.environment=!0),this._set("environment",e)}castEnvironment(e){return e?e instanceof pe?e:e instanceof it?null!=this.environment?this.environment.cloneWithWebsceneEnvironment(e):pe.fromWebsceneEnvironment(e):L(pe,e):new pe}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 initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get _defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||g(this.activeTool)}get stationary(){return!this.animation&&!this.resizing&&(u(this.state)||this.state.stationary)}get navigating(){return this.state?.navigating??!1}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}set qualityProfile(e){be.isValidProfile(e)&&(be.apply(e,this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||be.getDefaultProfile()}set slicePlane(e){if(g(this._stage)&&this._stage.renderView.setRenderParameters({slicePlane:e}),u(e))return void this._set("slicePlane",null);const t=this._propertiesPool.get("slicePlane");z(e,t),this._set("slicePlane",t)}get typeSpecificPreconditionsReady(){return!!this.viewingMode}get resolution(){return null!=this.spatialReference?B(this.scale,this.spatialReference):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return null!=e?G.deriveUnitFromSR(e,this.spatialReference):null}get updating(){if(this.destroyed)return!1;let e=0,t=this.layerViewManager.updating,i=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach((r=>{if(r.isFulfilled()){if(r.updating){if(t=!0,r.suspended||Ie(r))return;++i,e+=r.updatingProgress}}else++i}));for(const r of[this.graphicsView,this.basemapView,this._resourceController,this._stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager])if(g(r)&&r.updating){const t=.1;i+=t,e+=.5*t}for(const r of[this.deconflictor,this.labeler,this.basemapTerrain])g(r)&&r.updating&&(++i,e+=r.updatingProgress);if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||this._createGraphicsViewController||this.inputManager?.hasPendingInputs||this.map?.allLayers?.some((e=>!e.isFulfilled()))),t?(this._numUpdating=Math.max(i,this._numUpdating),e+=this._numUpdating-i):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=t?0:1,this._get("updatingProgress")!==e){const i=performance.now();if(e<1){const t=Math.min((i-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set("updatingProgress",e),this._lastUpdateTime=t&&e<1?i:0}return t}get viewingMode(){const e=this._predeterminedViewingMode;if(g(e))return se(e);const t=this.spatialReference;return t?g(this.defaultsFromMap?.viewingMode)&&t.equals(this.defaultsFromMap.spatialReference)?se(this.defaultsFromMap.viewingMode):Ke(t,re.Global)?"global":"local":"global"}set viewingMode(e){this.ready?d.getLogger(this.declaredClass).error("#viewingMode","viewingMode cannot be set once view is ready"):e?this._override("viewingMode",e):void 0===e&&this._clearOverride("viewingMode")}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get zoom(){return this.stateManager?.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get resourceController(){return this._resourceController}get performanceInfo(){return new Oe(this)}forceAnimationTime(e){this._stage.renderView.forcedAnimationTime=this.basemapTerrain.overlayManager.forcedAnimationTime=e}on(e,t,i,r){const s=this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return d.getLogger(this.declaredClass).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=t?this.externalToInternalIntersectOptions(t):this._defaultToMapOptions,r=g(i.graphics)&&(g(i.graphics.include)||g(i.graphics.exclude)),s=Ze(e)?Je(this,e):e,n=R(s);i.enableDraped=i.include&&!i.include.has(ze)||i.exclude&&i.exclude.has(ze);const a=this.sceneIntersectionHelper,o=He(this.state.viewingMode);if(o.options.selectionMode=!0,o.options.store=r?De.ALL:De.MIN,a.intersectIntersectorScreen(n,o,i),r){for(const e of o.results.all){const t=ke(e,this);if(u(t))return this._intersectResultToMapPoint(e);if("graphic"!==t.type||this._testGraphicUidFilter(i.graphics,t.graphic))return this._intersectResultToMapPoint(e)}return null}return this._intersectResultToMapPoint(o.results.min)}toScreen(e){if(!this.ready)return d.getLogger(this.declaredClass).error("#toScreen()","Scene view cannot be used before it is ready"),null;const t=m(null==e.z&&Me(this.elevationProvider,e),0);return A(e,dt,this.renderSpatialReference,t),this.state.camera.projectToScreen(dt,ct),V(ct[0],ct[1])}pixelSizeAt(e){return this.ready?e?(A(e,dt,this.renderSpatialReference),this.state.camera.computeScreenPixelSizeAt(dt)):0:(d.getLogger(this.declaredClass).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null)}overlayPixelSizeInMapUnits(e){const t=this.basemapTerrain.overlayManager;return t?t.overlayPixelSizeInMapUnits(e):1}hitTest(e,t){if(!this.ready)return d.getLogger(this.declaredClass).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=Ze(e)?Je(this,e):e,r=T(i.x,i.y),s=t?this.externalToInternalIntersectOptions(t):this._defaultHitTestOptions;s.requiresGroundFeedback=!0,s.enableDraped=!0;const n=He(this.state.viewingMode);n.options.selectionMode=!0,n.options.store=De.ALL,this.sceneIntersectionHelper.intersectIntersectorScreen(r,n,s);const a=this._intersectResultsToHits(n.results.all,s.graphics),o=n.results.ground,l=qe(o,this),p=g(l)&&"type"in l&&"integrated-mesh"===l.type?l:null,h={screenPoint:i,results:a,ground:{mapPoint:this._intersectResultToMapPoint(o),distance:Fe(o)?o.distanceInRenderSpace:0,layer:p}};return _e.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(h.intersector=n),Promise.resolve(h)}async popupHitTest(e){const{results:t,ground:i}=await Ne(this,e);let r=null;return!(0===t.length||Math.abs(m(t[0].distance,0)-i.distance)<1e-5)||i.layer&&"integrated-mesh"===i.layer.type||(r=i.mapPoint),{results:t,screenPoint:e,mapPoint:r}}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async whenAnalysisView(e){if(u(e.parent))throw new a("view:no-analysisview-for-analysis","The analysis has not been added to view.analyses",{analysis:e});if("line-of-sight"===e.parent.type){return(await this.whenLayerView(e.parent)).whenAnalysisView()}return this.analysisViewManager.whenAnalysisView(e)}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const t=this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return Qe(i,t,this._pixelFormat())}async _takeScreenshot(e){const t=this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshot(t);return $e(i,this._pixelFormat())}_completeSettings(e){const t=Xe(e,this);return t.pixelRatio/=this.state.pixelRatio,Ye(t,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this._stage.renderView.getAlpha()}}get test(){return{takeScreenshot:e=>this._takeScreenshot(e)}}async takeScreenshotWithObjectAndLayerId(e){if(!has("enable-feature:objectAndLayerId-rendering"))throw new Error("has enable-feature:objectAndLayerId-rendering must be true");const t=this._completeSettings(e);await this.whenReady();const i=await this._stage.renderView.takeScreenshotWithOID(t),r=Qe(i[0],t,this._pixelFormat()),s=this._completeSettings(e);s.format="png";return[r,Qe(i[1],s,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){if(!has("enable-feature:objectAndLayerId-rendering"))throw new Error("has enable-feature:objectAndLayerId-rendering must be true");return this._stage.renderView._objectAndLayerIdRenderHelper.getColorToObjectAndLayerIdMapping()}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}importLayerView(e){return ae.importLayerView(e)}hasLayerViewModule(e){return ae.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map?.initialViewProperties?.spatialReference||this.defaultsFromMap?.spatialReference||this.defaultsFromMap?.ready&&this._initialDefaultSpatialReference||null}async validate(){let e=et(this.type);if(has("safari")&&has("safari")<9&&(e=new a("sceneview:browser-not-supported","This browser is not supported by SceneView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:has("safari")})),g(e))throw d.getLogger(this.declaredClass).warn("#validate()",e.message),e}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):(this.map&&"initialViewProperties"in this.map?this.map.initialViewProperties?.viewingMode:null)??null;return g(e)?ne(e):null}getSpatialReferenceSupport({spatialReference:e,layer:t}){const i=this._predeterminedViewingMode;if(g(i))return this._validateSpatialReferenceForViewingMode(e,t,i)?{constraints:this._makeSpatialReferenceConstraints(e,t,i)}:null;const r=this._validateSpatialReferenceForViewingMode(e,t,re.Local),s=this._validateSpatialReferenceForViewingMode(e,t,re.Global);return r||s?r&&s?{constraints:this._makeSpatialReferenceConstraints(e,t,null)}:r?{constraints:this._makeSpatialReferenceConstraints(e,t,re.Local)}:{constraints:this._makeSpatialReferenceConstraints(e,t,re.Global)}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!Ke(e,i)&&(!!u(t)||(!!Q(t)||(!$(t)||!u(Pe(t,e,i)))&&(!X(t)||i!==re.Global)))}_makeSpatialReferenceConstraints(e,t,i){if(u(t))return[{spatialReference:e,viewingMode:i}];const r=e.isWebMercator,s=e.isWGS84;if(Q(t)&&(r||s)){return!s||i===re.Local||null===Ge(t.tileInfo,t.fullExtent,e,re.Global)?[{spatialReference:e,viewingMode:i},{spatialReference:st.WebMercator,viewingMode:i}]:[{spatialReference:r?st.WGS84:st.WebMercator,viewingMode:i}]}return $(t)||X(t)||!r&&!s?$(t)&&r&&i!==re.Global?[{spatialReference:e,viewingMode:i},{spatialReference:st.WGS84,viewingMode:re.Local}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:r?st.WGS84:st.WebMercator,viewingMode:i}]}_validateSpatialReference(e){const t=g(this.getSpatialReferenceSupport({spatialReference:e})),i=this._predeterminedViewingMode;return t||(g(i)?d.getLogger(this.declaredClass).warnOnce(`Spatial reference defined on view not supported in ${se(i)} viewing mode.`):e.isGeographic&&d.getLogger(this.declaredClass).warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise((e=>{this.ready?e(this):this._resolveWhenReady.push(e)}))}computeMapPointFromVec3d(e,t){let i=this.spatialReference||st.WGS84;return H(e,this.renderSpatialReference,e,i)||(i=st.WGS84,H(e,this.renderSpatialReference,e,i)),t?(t.x=e[0],t.y=e[1],t.z=e[2],t.spatialReference=i):t=new nt(e,i),t}trackGraphicState(e){if(!e.graphic)return d.getLogger(this.declaredClass).error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const t=this.getViewForGraphic(e.graphic);let i=null,r=!1;const s=t=>{!r&&g(t)&&"processor"in t&&"graphics-3d"===t.processor?.type&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return g(t)?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),{remove:()=>{r=!0,g(i)&&(i.remove(),i=null)}}}highlight(e){if(Array.isArray(e))return l(e.map((e=>this.highlight(e))));if(s.isCollection(e))return l(e.toArray().map((e=>this.highlight(e))));const t=this.getViewForGraphic(e);return t&&"highlight"in t?t.highlight(e):p()}maskOccludee(e){if(!e)return d.getLogger(this.declaredClass).error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const t=this.getViewForGraphic(e);let i=null,r=!1;const s=t=>{!r&&g(t)&&Be(t)&&(i=t.maskOccludee(e))};return g(t)?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then((e=>s(e)),(()=>{})).catch((()=>{})),{remove:()=>{r=!0,g(i)&&(i.remove(),i=null)}}}getViewForGraphic(e){return e.layer===this.graphics?this.graphicsView:e.layer?this.allLayerViews.find((t=>t.layer===e.layer)):null}graphicChanged(e){g(this.graphicsView)&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){if(e.layer===this)return await M((()=>this.graphicsView)),this.graphicsView;if(!e.layer||!this.map)throw new a("no-view-for-graphic");return t&&t.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise(((t,i)=>{const r=this.map.allLayers.on("change",(s=>{s.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,i))}))})):this.whenLayerView(e.layer)}externalToInternalIntersectOptions(e){const t=this._externalToInternalRenderItems(e.include,ht.INCLUDE),i=this._externalToInternalRenderItems(e.exclude,ht.EXCLUDE);return{include:t.layerUids,exclude:i.layerUids,graphics:{include:t.graphicUids,exclude:i.graphicUids}}}_intersectResultToMapPoint(e,t){return e.getIntersectionPoint(dt)?(t=this.computeMapPointFromVec3d(dt,t),e.intersector===We.TERRAIN&&this.basemapTerrain&&(t.z=m(Me(this.basemapTerrain,t),0)),t):null}_intersectResultsToHits(e,t){const i=new Array;let r=null;for(let s=0;s<e.length;s++){const n=e[s],a=qe(n,this);if(g(a)&&(a===this.map.ground||"type"in a&&"integrated-mesh"===a.type))break;const o=ke(n,this);if(u(o))continue;if("graphic"===o.type){if(u(r)&&s!==e.length-1&&(r=new Set),g(r)){const e=this._getGraphicFilterUid(o.graphic);if(r.has(e))continue;r.add(e)}if(!this._testGraphicUidFilter(t,o.graphic))continue}const l=this._intersectResultToMapPoint(n),p=n.distanceInRenderSpace;i.push({...o,mapPoint:l,distance:p})}return i}_getGraphicFilterUid(e){if(e.sourceLayer&&"objectIdField"in e.sourceLayer){const t=e.attributes[e.sourceLayer.objectIdField];if(t)return`o-${e.sourceLayer.id}-${t}`}return`u-${e.uid}`}_testGraphicUidFilter(e,t){const i=this._getGraphicFilterUid(t);return u(e)||(u(e.include)||e.include.has(i))&&(u(e.exclude)||!e.exclude.has(i))}_externalToInternalRenderItems(e,t,r={layerUids:null,graphicUids:null}){if(!e)return r;if(e instanceof i)lt(r,this._getGraphicFilterUid(e)),t===ht.INCLUDE&&(g(this.graphicsView)&&e.layer===this?ot(r,this.graphicsView.processor.layer.id):e.layer&&ot(r,e.layer.uid));else if(h(e))for(const i of e)i===this.graphics&&g(this.graphicsView)?ot(r,this.graphicsView.processor.layer.id):i===this.map.ground?ot(r,ze):this._externalToInternalRenderItems(i,t,r);else"uid"in e&&ot(r,e.uid);return r}_initBasemapTerrain(){this._set("basemapTerrain",new Le({view:this})),this._set("elevationProvider",new ve({view:this})),this.elevationProvider.register("ground",this.basemapTerrain)}_exitBasemapTerrain(){this.basemapTerrain&&(this.elevationProvider.unregister(this.basemapTerrain),this.elevationProvider.destroy(),this._set("elevationProvider",null),this.basemapTerrain.destroy(),this._set("basemapTerrain",null))}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new Ee({view:this})),this._set("featureTiles",new me({renderCoordsHelper:this.renderCoordsHelper,cameraOnSurface:this.pointsOfInterest.contentCameraOnSurface,focus:this.pointsOfInterest.focus,tilingSchemeOwner:this.basemapTerrain,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}));const e=()=>{const e=this.basemapTerrain?.extent;if(this.clippingArea||e)if(e&&this.basemapTerrain.spatialReference){const e=g(this.basemapTerrain.extent)&&g(this.basemapTerrain.spatialReference)?D(k(this.basemapTerrain.extent,this.basemapTerrain.spatialReference),this.spatialReference):null;g(this.clippingArea)?this.featureTiles.filterExtent=this.clippingArea.intersection(e):this.featureTiles.filterExtent=e}else this.featureTiles.filterExtent=this.clippingArea;else this.featureTiles.filterExtent=null};this.handles.add([this.updatingHandles.add((()=>_e.FEATURE_TILE_TREE_SHOW_TILES),(e=>{e&&this.featureTiles&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then((({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&_e.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))})):e||!this._featureTreeDebugger||_e.FEATURE_TILE_TREE_SHOW_TILES||(this._featureTreeDebugger.destroy(),this._featureTreeDebugger=null)}),b),this.updatingHandles.add((()=>this.clippingArea),e,b),this.updatingHandles.add((()=>this.basemapTerrain.extent),e,b)],"feature-tiles"),this.stateManager.init()}_exitGlobe(){this.state&&(this.stateManager.deinit(),this.handles.remove("render-coords-helper"),this.handles.remove("feature-tiles"),this.featureTiles.destroy(),this._set("featureTiles",null),this.pointsOfInterest.destroy(),this._set("pointsOfInterest",null),this._exitBasemapTerrain(),this.state.exit(),this._exitCoordinateSystem())}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference;this.mapCoordsHelper&&this.mapCoordsHelper.spatialReference.equals(e)||this._set("mapCoordsHelper",new Ce(this.map,e));const t=this.state.isGlobal,i=N(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",Te.create(this.state.viewingMode,i)),t||this.handles.add(v((()=>this.basemapTerrain?.extent),(e=>{const t=this.renderCoordsHelper.spatialReference;e&&(0!==e[0]||0!==e[1]||0!==e[2]||0!==e[3])&&W(e,this.basemapTerrain.spatialReference,ut,t)&&(this.renderCoordsHelper.extent=ut)}),S),"render-coords-helper"),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(Ue/this.renderCoordsHelper.unitInMeters))}else this._set("mapCoordsHelper",null),this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.mapCoordsHelper&&(this.handles.remove("render-coords-helper"),this._set("renderCoordsHelper",null),this._set("mapCoordsHelper",null))}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){g(e)&&e.type===f.MOVE||(this.handles.remove("updatingMonitors"),this.allLayerViews.forEach((e=>{e.destroyed||(this.handles.add(v((()=>[e.updating,e.updatingProgress]),(()=>this._updatingChanged()),S),"updatingMonitors"),e.when((()=>this._updatingChanged()),(()=>this._updatingChanged())))})),this._updatingChanged())}_renderScreenshotOverlay(e,t){if(!this.overlay||!this.overlay.hasVisibleItems)return t;const i=e.getContext("2d");return i.putImageData(t,0,0),this.overlay.renderCanvas(e),i.getImageData(0,0,t.width,t.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{renderOverlay:(e,t)=>this._renderScreenshotOverlay(e,t)}},t=new we(this.state.viewingMode,(e=>this._stage.layers.forAll(e)),this);this._set("sceneIntersectionHelper",t);const i=n(this.surface),{resourceController:r,state:s,renderSpatialReference:l}=this;this._stage=new Ae({options:e,container:i,resourceController:r,state:s,sceneIntersectionHelper:t,renderSR:l}),this._stage.renderView.setRenderParameters({slicePlane:this.slicePlane}),this._lostWebGLContextHandle=o(this._stage.renderView.canvas,"webglcontextlost",(()=>this.fatalError=new a("webgl-context-lost"))),this.handles.add([this.updatingHandles.add((()=>this.qualitySettings.antialiasingEnabled),(()=>this._stage.renderView.setRenderParameters({antialiasingEnabled:this.qualitySettings.antialiasingEnabled})),_),this.updatingHandles.add((()=>this.qualitySettings.highQualityTransparency),(()=>this._stage.renderView.setRenderParameters({highQualityTransparency:this.qualitySettings.highQualityTransparency})),_),v((()=>this.magnifier),(e=>this._stage.renderView.magnifier=e),b)],"stage");const p=()=>{this._stage.renderView.setRenderParameters({defaultHighlightOptions:Se.toEngineOptions(this.highlightOptions)})};this.handles.add(this.updatingHandles.add((()=>[this.highlightOptions.color,this.highlightOptions.haloColor,this.highlightOptions.haloOpacity,this.highlightOptions.fillOpacity,this.highlightOptions.shadowOpacity,this.highlightOptions.shadowColor,this.highlightOptions.shadowDifference]),p),"stage"),p(),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(Ue/this.renderCoordsHelper.unitInMeters),this._set("canvas",this._stage.renderView.canvas)}_exitStage(){this._set("sceneIntersectionHelper",null),this._stage.destroy(),this._stage=null,this._lostWebGLContextHandle.remove(),this._lostWebGLContextHandle=null,this.handles.remove("stage"),this._set("canvas",null)}_initSurface(e){this._exitSurface(),this.state.init(e,this.spatialReference),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new je({view:this,viewingMode:e,resourceController:this._resourceController,pointsOfInterest:this.pointsOfInterest,viewState:this.state,objectResourceCache:new ge})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitGlobe(),this._exitStage())}_createGraphicsViewIfNeeded(){if(this.graphicsView||this._createGraphicsViewController)return;if(0===this.graphics.length)return;this.handles.remove("graphics-view"),this._createGraphicsViewController=new AbortController;const e=()=>{this._createGraphicsViewController=null,this._updatingChanged()};this._createGraphicsViewAsync(this._createGraphicsViewController.signal).then(e,e),this._updatingChanged()}async _createGraphicsViewAsync(e){const t=(await import("./3d/layers/GraphicsView3D.js")).default;y(e),await M((()=>this.basemapTerrain?.ready),e),this._set("graphicsView",new t({view:this}))}_disposeGraphicsView(){this._createGraphicsViewController&&(this._createGraphicsViewController.abort(),this._createGraphicsViewController=null),this.handles.remove("graphics-view"),g(this.graphicsView)&&(this.handles.remove(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_startup(){const e=ne(this.viewingMode);if(e===re.Global&&(this._clippingArea=null),this._initSurface(e),this._set("ready",!0),this.handles.add(w((()=>this.graphics),"after-changes",(()=>this._createGraphicsViewIfNeeded())),"graphics-view"),this._createGraphicsViewIfNeeded(),!this._externallySet.environment){const e=this.get("map.initialViewProperties.environment");e&&(this.environment=e)}this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();const t=this._resolveWhenReady;this._resolveWhenReady=[],t.forEach((e=>e(this)))}_teardown(){this._initialDefaultSpatialReference=null,this.inputManager.disconnect(),this.environmentManager.disconnectView(),this.labeler.dispose(),this._disposeGraphicsView(),this.handles.remove("graphics-view"),this._exitSurface(),this._set("ready",!1)}_updateDefaultToMapOptions(){if(this._defaultToMapOptions.include.clear(),this.map){this.map.ground&&this._defaultToMapOptions.include.add(ze);for(const e of this.map.allLayers.items)"integrated-mesh"===e.type&&this._defaultToMapOptions.include.add(e.uid)}}_updateDefaultHitTestOptions(){if(this._defaultHitTestOptions.exclude.clear(),this.map){this.map.ground&&this.map.ground.opacity<1&&this._defaultHitTestOptions.exclude.add(ze);for(const e of this.map.allLayers.items)"integrated-mesh"===e.type&&e.opacity<1&&this._defaultToMapOptions.exclude.add(e.uid)}}addVoxelLayerViewToWasm(e){return u(this.voxelWasm)?(u(this.voxelWasmPromise)&&(this.voxelWasmPromise=import("../layers/VoxelWasmPerSceneView.js").then((e=>(this.voxelWasm=new e.default(this),this.voxelWasm)))),this.voxelWasmPromise.then((t=>t.addVoxelLayer(e)))):this.voxelWasm.addVoxelLayer(e)}removeVoxelLayerViewFromWasm(e){if(g(this.voxelWasm)){this.voxelWasm.removeVoxelLayer(e)<1&&(this.voxelWasm=null,this.voxelWasmPromise=null)}}};function ot(e,t){e.layerUids||(e.layerUids=new Set),e.layerUids.add(t)}function lt(e,t){e.graphicUids||(e.graphicUids=new Set),e.graphicUids.add(t)}function pt(e,t){return g(e)&&U(e.spatialReference,t)?D(e,t):null}var ht;at.type="3d",e([O()],at.prototype,"_userClippingArea",void 0),e([O()],at.prototype,"_resourceController",void 0),e([O()],at.prototype,"_stage",void 0),e([O({readOnly:!0})],at.prototype,"deconflictor",void 0),e([O({readOnly:!0})],at.prototype,"labeler",void 0),e([O(P(Y,"analyses"))],at.prototype,"analyses",void 0),e([O({type:ie,readOnly:!0})],at.prototype,"animation",null),e([O({readOnly:!0})],at.prototype,"basemapTerrain",void 0),e([O({readOnly:!0})],at.prototype,"elevationProvider",void 0),e([O()],at.prototype,"camera",null),e([O({type:t})],at.prototype,"contentCamera",null),e([O({readOnly:!0})],at.prototype,"canvas",void 0),e([O({type:nt})],at.prototype,"center",null),e([O({type:rt})],at.prototype,"clippingArea",null),e([O({type:le})],at.prototype,"constraints",void 0),e([O({type:rt,readOnly:!0})],at.prototype,"renderDataExtent",null),e([O({type:rt,readOnly:!0})],at.prototype,"dataExtent",null),e([O({type:rt,readOnly:!0})],at.prototype,"_groundAndLayersExtent",null),e([O({value:null,type:pe})],at.prototype,"environment",null),e([j("environment")],at.prototype,"castEnvironment",null),e([O({readOnly:!0})],at.prototype,"environmentManager",void 0),e([O({type:rt})],at.prototype,"extent",null),e([O()],at.prototype,"floors",void 0),e([O()],at.prototype,"screenCenter",null),e([O()],at.prototype,"frustum",null),e([O({type:Number,readOnly:!0})],at.prototype,"fullOpacity",void 0),e([O({readOnly:!0})],at.prototype,"graphicsView",void 0),e([O({readOnly:!0})],at.prototype,"analysisViewManager",void 0),e([O()],at.prototype,"groundView",void 0),e([O({type:Boolean})],at.prototype,"initialExtentRequired",null),e([O()],at.prototype,"_defaultsFromMapSettings",null),e([O()],at.prototype,"interacting",null),e([O()],at.prototype,"stationary",null),e([O()],at.prototype,"navigating",null),e([O()],at.prototype,"map",void 0),e([O({readOnly:!0})],at.prototype,"mapCoordsHelper",void 0),e([O()],at.prototype,"padding",null),e([O({type:Ee,readOnly:!0})],at.prototype,"pointsOfInterest",void 0),e([O({type:me,readOnly:!0})],at.prototype,"featureTiles",void 0),e([O()],at.prototype,"_featureTreeDebugger",void 0),e([O({type:Boolean})],at.prototype,"screenSizePerspectiveEnabled",void 0),e([O({constructOnly:!0})],at.prototype,"deactivatedWebGLExtensions",void 0),e([O({constructOnly:!0})],at.prototype,"debugWebGLExtensions",void 0),e([O({constructOnly:!0})],at.prototype,"renderCanvas",void 0),e([O({constructOnly:!0})],at.prototype,"state",void 0),e([O({readOnly:!0})],at.prototype,"inputManager",void 0),e([O({readOnly:!0})],at.prototype,"stateManager",void 0),e([O({type:["low","medium","high"]})],at.prototype,"qualityProfile",null),e([O({type:Ve,get(){let e=this._get("qualitySettings");return e||(e=new Ve,be.apply(this.qualityProfile,e)),e}})],at.prototype,"qualitySettings",void 0),e([O()],at.prototype,"slicePlane",null),e([O({readOnly:!0})],at.prototype,"typeSpecificPreconditionsReady",null),e([O({readOnly:!0})],at.prototype,"renderCoordsHelper",void 0),e([O({readOnly:!0})],at.prototype,"sceneIntersectionHelper",void 0),e([O({type:Number,dependsOn:["scale","spatialReference"],readOnly:!0})],at.prototype,"resolution",null),e([O({type:Number})],at.prototype,"scale",null),e([O()],at.prototype,"heightModelInfo",null),e([O()],at.prototype,"spatialReference",void 0),e([O({type:Boolean,constructOnly:!0})],at.prototype,"alphaCompositingEnabled",void 0),e([O({constructOnly:!0})],at.prototype,"preserveDrawingBufferEnabled",void 0),e([O({type:Boolean})],at.prototype,"supersampleScreenshotsEnabled",void 0),e([O({readOnly:!0})],at.prototype,"type",void 0),e([O({type:tt})],at.prototype,"ui",void 0),e([O({type:Boolean,readOnly:!0,dependsOn:["graphicsView.updating","basemapView.updating","basemapTerrain.updating","layerViewManager.updating","layerViewManager.updatingRemaining","_resourceController.updating","_stage.updating","featureTiles.updating","pointsOfInterest.updating","environmentManager.updating","overlay.updating","updatingHandles.updating","featureTreeDebugger.updating","labeler.updating","deconflictor.updating","ready","stationary","inputManager.hasPendingInputs","toolViewManager.updating","analysisViewManager.updating"]})],at.prototype,"updating",null),e([O({type:Number,readOnly:!0,dependsOn:["updating"]})],at.prototype,"updatingProgress",void 0),e([O({type:["global","local"]})],at.prototype,"viewingMode",null),e([O({type:r})],at.prototype,"viewpoint",null),e([O({type:Number})],at.prototype,"zoom",null),e([O({type:Se})],at.prototype,"highlightOptions",void 0),at=e([E("esri.views.SceneView")],at),function(e){e[e.INCLUDE=0]="INCLUDE",e[e.EXCLUDE=1]="EXCLUDE"}(ht||(ht={}));const dt=I(),ct=T(),ut=F(),gt=at;export{gt as default};
|
package/views/View.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Map.js";import i from"../TimeExtent.js";import r from"../core/Accessor.js";import{createTask as a}from"../core/asyncUtils.js";import s from"../core/Collection.js";import o from"../core/CollectionFlattener.js";import n from"../core/Error.js";import l from"../core/Evented.js";import{HandleOwnerMixin as p}from"../core/HandleOwner.js";import{makeHandle as d}from"../core/handleUtils.js";import h from"../core/Loadable.js";import y from"../core/Logger.js";import{destroyMaybe as c,isSome as u,abortMaybe as m}from"../core/maybe.js";import{EsriPromiseMixin as f}from"../core/Promise.js";import{after as g}from"../core/promiseUtils.js";import{watch as w,whenOnce as v,when as M,sync as V}from"../core/reactiveUtils.js";import{aliasOf as R}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as _}from"../core/accessorSupport/decorators/property.js";import{subclass as S}from"../core/accessorSupport/decorators/subclass.js";import{owningCollectionProperty as j}from"../core/support/OwningCollection.js";import F from"../geometry/Extent.js";import L from"../geometry/HeightModelInfo.js";import O from"../geometry/SpatialReference.js";import{equals as C}from"../geometry/support/spatialReferenceUtils.js";import{AnalysesCollection as E}from"../support/AnalysesCollection.js";import{GraphicsCollection as b}from"../support/GraphicsCollection.js";import{BasemapView as x}from"./BasemapView.js";import I from"./LayerViewManager.js";import q from"./Magnifier.js";import D from"./ToolViewManager.js";import T from"./input/Input.js";import{ViewEvents as U}from"./input/ViewEvents.js";import k from"./navigation/Navigation.js";import{DefaultsFromMap as P}from"./support/DefaultsFromMap.js";var W;let z=W=class extends(p(l.EventedMixin(f(r)))){constructor(e){super(e),this._userSpatialReference=null,this._cursor=null,this.allLayerViews=new o({getCollections:()=>[this.basemapView?.baseLayerViews,this.groundView?.layerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:e=>e.layerViews}),this.groundView=null,this.animation=null,this.basemapView=null,this.fatalError=null,this.extent=null,this.graphics=new b,this.analyses=new E,this.navigating=!1,this.typeSpecificPreconditionsReady=!0,this.layerViews=new s,this.magnifier=new q,this.padding={left:0,top:0,right:0,bottom:0},this.ready=!1,this.spatialReferenceWarningDelay=1e3,this.supportsGround=!0,this.timeExtent=null,this.type=null,this.scale=null,this.updating=!1,this.initialExtentRequired=!0,this.input=new T,this.navigation=new k,this.layerViewManager=null,this.analysisViewManager=null,this.isHeightModelInfoRequired=!1,this.width=null,this.height=null,this.resizing=!1,this.suspended=!1,this.viewEvents=new U(this),this.persistableViewModels=new s,this._isValid=!1,this._readyCycleForced=!1,this.handles.add(w((()=>this.preconditionsReady),(e=>{e?(this._currentSpatialReference=this.spatialReference,W.views.add(this)):(this._currentSpatialReference=null,W.views.remove(this)),this.notifyChange("spatialReference"),!e&&this.ready?(this.layerViewManager?.clear(),this.toolViewManager?.detach(),u(this.analysisViewManager)&&this.analysisViewManager.detach(),this._teardown()):e&&!this.ready&&(this._startup(),u(this.analysisViewManager)&&this.analysisViewManager.attach(),this.toolViewManager.attach())}),V))}initialize(){this.addResolvingPromise(this.validate().then((()=>(this._isValid=!0,v((()=>this.ready)))))),this.basemapView=new x({view:this}),this.layerViewManager=new I({view:this,layerViewImporter:{importLayerView:e=>this.importLayerView(e),hasLayerViewModule:e=>this.hasLayerViewModule(e)},supportsGround:this.supportsGround}),this.toolViewManager=new D({view:this}),this._setupSpatialReferenceLogger(),this.handles.add([w((()=>this.initialExtentRequired),(e=>this.defaultsFromMap.required={...this.defaultsFromMap.required,extent:e}),{sync:!0,initial:!0}),w((()=>this.ready),(e=>{this.defaultsFromMap&&(this.defaultsFromMap.suspended=e,this.defaultsFromMap.userSpatialReference=e?this.spatialReference:this._userSpatialReference)}),{sync:!0}),w((()=>this._userSpatialReference),(e=>{this.defaultsFromMap&&(this.defaultsFromMap.userSpatialReference=e)}),{sync:!0,initial:!0})])}_setupSpatialReferenceLogger(){let e=null;this.handles.add([w((()=>this.defaultsFromMap?.ready),(t=>{const i=this.map?.allLayers.length>0;if(t&&!this.spatialReference&&i){if(u(e))return;const t=d((()=>e=m(e)));e=a((async t=>{try{await g(this.spatialReferenceWarningDelay,null,t)}catch{return}finally{e=null}y.getLogger(this.declaredClass).warn("#spatialReference","no spatial reference could be derived from the currently added map layers")})),this.handles.add(t,"spatial-reference-logger-task")}else this.handles.remove("spatial-reference-logger-task")}),{sync:!0})])}destroy(){if(this.destroyed)return;this.viewEvents.destroy(),this.allLayerViews.destroy(),this.navigation&&(this.navigation.destroy(),this._set("navigation",null)),this.graphics=c(this.graphics),this.analyses=c(this.analyses),this.handles.remove("defaultsFromMap"),this.defaultsFromMap.destroy(),this._set("defaultsFromMap",null),c(this.analysisViewManager),this.toolViewManager=c(this.toolViewManager),this.layerViewManager=c(this.layerViewManager),this.basemapView=c(this.basemapView),this.invalidate(),this._emitter.clear(),this.handles.removeAll();const e=this.map;this.map=null,e?.destroy()}_startup(){this._set("ready",!0)}_teardown(){this._set("ready",!1)}whenReady(){return Promise.resolve(this)}toMap(){return y.getLogger(this.declaredClass).error("#toMap()","Not implemented on this instance of View"),null}get _defaultsFromMapSettings(){return{}}get defaultsFromMap(){return new P({required:{tileInfo:!1,heightModelInfo:!1,extent:!1},map:()=>this.map,getSpatialReferenceSupport:e=>this.getSpatialReferenceSupport(e),...this._defaultsFromMapSettings})}get heightModelInfo(){return this.getDefaultHeightModelInfo()}get interacting(){return this.navigating}get preconditionsReady(){return!(this.fatalError||!this._isValid||this._readyCycleForced||!this.map||h.isLoadable(this.map)&&!this.map.loaded||0===this.width||0===this.height||!this.spatialReference||!this._validateSpatialReference(this.spatialReference)||!this._currentSpatialReference&&!this.defaultsFromMap?.ready||!this.typeSpecificPreconditionsReady)}set map(e){e!==this._get("map")&&(e?.destroyed&&(y.getLogger(this.declaredClass).warn("#map","The provided map is already destroyed",{map:e}),e=null),h.isLoadable(e)&&e.load().catch((()=>{})),this.constructed&&(this.forceReadyCycle(),this._currentSpatialReference=null),this._set("map",e))}get spatialReference(){let e=this._userSpatialReference||this._currentSpatialReference||this.getDefaultSpatialReference()||null;return e&&this.defaultsFromMap?.required?.heightModelInfo&&(e=e.clone(),e.vcsWkid=this.defaultsFromMap.vcsWkid,e.latestVcsWkid=this.defaultsFromMap.latestVcsWkid),e}set spatialReference(e){const t=!C(e,this._get("spatialReference"));this._set("_userSpatialReference",e),t&&(this._set("spatialReference",e),this._spatialReferenceChanged(e))}_spatialReferenceChanged(e){}get stationary(){return!this.animation&&!this.navigating&&!this.resizing}get initialExtent(){return this.defaultsFromMap?.extent}get cursor(){const e=this.toolViewManager?this.toolViewManager.cursor:null;return u(e)?e:this._cursor||"default"}set cursor(e){this._cursor=e,this.notifyChange("cursor")}get size(){return[this.width,this.height]}whenLayerView(e){return this.layerViewManager.whenLayerView(e)}getDefaultSpatialReference(){return this.defaultsFromMap?.spatialReference}getDefaultHeightModelInfo(){return(this.map&&"heightModelInfo"in this.map?this.map.heightModelInfo:void 0)??this.defaultsFromMap?.heightModelInfo??null}importLayerView(e){throw new n("importLayerView() not implemented")}hasLayerViewModule(e){return!1}async validate(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{constraints:null}}_validateSpatialReference(e){return u(this.getSpatialReferenceSupport({spatialReference:e}))}when(e,t){return this.isResolved()&&!this.ready&&y.getLogger(this.declaredClass).warn("#when()","Calling view.when() while the view is no longer ready but was already resolved once will resolve immediately. Use reactiveUtils.whenOnce(() => view.ready).then(...) instead."),super.when(e,t)}forceReadyCycle(){this.ready&&(M((()=>!1===this.preconditionsReady),(()=>this._readyCycleForced=!1),{once:!0}),this._readyCycleForced=!0)}addAndActivateTool(e){this.toolViewManager.tools.add(e),this.activeTool=e}tryFatalErrorRecovery(){this.fatalError=null}};z.views=new s,e([_()],z.prototype,"_userSpatialReference",void 0),e([R("toolViewManager.activeTool")],z.prototype,"activeTool",void 0),e([_({readOnly:!0})],z.prototype,"allLayerViews",void 0),e([_()],z.prototype,"groundView",void 0),e([_()],z.prototype,"animation",void 0),e([_()],z.prototype,"basemapView",void 0),e([_({readOnly:!0})],z.prototype,"_defaultsFromMapSettings",null),e([_()],z.prototype,"defaultsFromMap",null),e([_()],z.prototype,"fatalError",void 0),e([_({type:F})],z.prototype,"extent",void 0),e([_(j(b,"graphics"))],z.prototype,"graphics",void 0),e([_(j(E,"analyses"))],z.prototype,"analyses",void 0),e([_({readOnly:!0,type:L})],z.prototype,"heightModelInfo",null),e([_({readOnly:!0})],z.prototype,"interacting",null),e([_({readOnly:!0})],z.prototype,"navigating",void 0),e([_({readOnly:!0,dependsOn:["fatalError","_isValid","_readyCycleForced","map","map.loaded?","width","height","spatialReference","_currentSpatialReference","defaultsFromMap.ready","typeSpecificPreconditionsReady"]})],z.prototype,"preconditionsReady",null),e([_({readOnly:!0})],z.prototype,"typeSpecificPreconditionsReady",void 0),e([_({type:s,readOnly:!0})],z.prototype,"layerViews",void 0),e([_({type:q})],z.prototype,"magnifier",void 0),e([_({value:null,type:t})],z.prototype,"map",null),e([_()],z.prototype,"padding",void 0),e([_({readOnly:!0})],z.prototype,"ready",void 0),e([_({type:O})],z.prototype,"spatialReference",null),e([_()],z.prototype,"spatialReferenceWarningDelay",void 0),e([_()],z.prototype,"stationary",null),e([_({readOnly:!0})],z.prototype,"supportsGround",void 0),e([_({type:i})],z.prototype,"timeExtent",void 0),e([R("toolViewManager.tools")],z.prototype,"tools",void 0),e([_()],z.prototype,"toolViewManager",void 0),e([_({readOnly:!0})],z.prototype,"type",void 0),e([_({type:Number})],z.prototype,"scale",void 0),e([_({readOnly:!0})],z.prototype,"updating",void 0),e([_({readOnly:!0})],z.prototype,"initialExtentRequired",void 0),e([_({readOnly:!0})],z.prototype,"initialExtent",null),e([_()],z.prototype,"cursor",null),e([_({readOnly:!0})],z.prototype,"input",void 0),e([_({type:k,nonNullable:!0})],z.prototype,"navigation",void 0),e([_()],z.prototype,"layerViewManager",void 0),e([_()],z.prototype,"analysisViewManager",void 0),e([_()],z.prototype,"width",void 0),e([_()],z.prototype,"height",void 0),e([_({readOnly:!0})],z.prototype,"resizing",void 0),e([_({value:null,readOnly:!0})],z.prototype,"size",null),e([_({readOnly:!0})],z.prototype,"suspended",void 0),e([_({readOnly:!0})],z.prototype,"viewEvents",void 0),e([_({readOnly:!0})],z.prototype,"persistableViewModels",void 0),e([_()],z.prototype,"_isValid",void 0),e([_()],z.prototype,"_readyCycleForced",void 0),e([_()],z.prototype,"_currentSpatialReference",void 0),z=W=e([S("esri.views.View")],z);const A=z;export{A as default};
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Map.js";import i from"../TimeExtent.js";import r from"../core/Accessor.js";import{createTask as a}from"../core/asyncUtils.js";import s from"../core/Collection.js";import o from"../core/CollectionFlattener.js";import n from"../core/Error.js";import l from"../core/Evented.js";import{HandleOwnerMixin as p}from"../core/HandleOwner.js";import{makeHandle as d}from"../core/handleUtils.js";import h from"../core/Loadable.js";import y from"../core/Logger.js";import{destroyMaybe as c,isSome as u,abortMaybe as m}from"../core/maybe.js";import{EsriPromiseMixin as f}from"../core/Promise.js";import{after as g}from"../core/promiseUtils.js";import{watch as w,whenOnce as v,when as M,sync as V}from"../core/reactiveUtils.js";import{property as R}from"../core/accessorSupport/decorators/property.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{subclass as _}from"../core/accessorSupport/decorators/subclass.js";import{owningCollectionProperty as S}from"../core/support/OwningCollection.js";import j from"../geometry/Extent.js";import F from"../geometry/HeightModelInfo.js";import L from"../geometry/SpatialReference.js";import{equals as C}from"../geometry/support/spatialReferenceUtils.js";import{AnalysesCollection as O}from"../support/AnalysesCollection.js";import{GraphicsCollection as E}from"../support/GraphicsCollection.js";import{BasemapView as b}from"./BasemapView.js";import x from"./LayerViewManager.js";import I from"./Magnifier.js";import T from"./ToolViewManager.js";import q from"./input/Input.js";import{ViewEvents as D}from"./input/ViewEvents.js";import U from"./navigation/Navigation.js";import{DefaultsFromMap as k}from"./support/DefaultsFromMap.js";var P;let W=P=class extends(p(l.EventedMixin(f(r)))){constructor(e){super(e),this._userSpatialReference=null,this._cursor=null,this.allLayerViews=new o({getCollections:()=>[this.basemapView?.baseLayerViews,this.groundView?.layerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:e=>e.layerViews}),this.groundView=null,this.basemapView=null,this.fatalError=null,this.graphics=new E,this.analyses=new O,this.typeSpecificPreconditionsReady=!0,this.layerViews=new s,this.magnifier=new I,this.padding={left:0,top:0,right:0,bottom:0},this.ready=!1,this.spatialReferenceWarningDelay=1e3,this.supportsGround=!0,this.timeExtent=null,this.type=null,this.scale=null,this.updating=!1,this.initialExtentRequired=!0,this.input=new q,this.navigation=new U,this.layerViewManager=null,this.analysisViewManager=null,this.isHeightModelInfoRequired=!1,this.width=null,this.height=null,this.resizing=!1,this.suspended=!1,this.viewEvents=new D(this),this.persistableViewModels=new s,this._isValid=!1,this._readyCycleForced=!1,this.handles.add(w((()=>this.preconditionsReady),(e=>{e?(this._currentSpatialReference=this.spatialReference,P.views.add(this)):(this._currentSpatialReference=null,P.views.remove(this)),this.notifyChange("spatialReference"),!e&&this.ready?(this.toolViewManager?.detach(),u(this.analysisViewManager)&&this.analysisViewManager.detach(),this.layerViewManager?.clear(),this._teardown()):e&&!this.ready&&(this._startup(),u(this.analysisViewManager)&&this.analysisViewManager.attach(),this.toolViewManager.attach())}),V))}initialize(){this.addResolvingPromise(this.validate().then((()=>(this._isValid=!0,v((()=>this.ready)))))),this.basemapView=new b({view:this}),this.layerViewManager=new x({view:this,layerViewImporter:{importLayerView:e=>this.importLayerView(e),hasLayerViewModule:e=>this.hasLayerViewModule(e)},supportsGround:this.supportsGround}),this.toolViewManager=new T({view:this}),this._setupSpatialReferenceLogger(),this.handles.add([w((()=>this.initialExtentRequired),(e=>this.defaultsFromMap.required={...this.defaultsFromMap.required,extent:e}),{sync:!0,initial:!0}),w((()=>this.ready),(e=>{this.defaultsFromMap&&(this.defaultsFromMap.suspended=e,this.defaultsFromMap.userSpatialReference=e?this.spatialReference:this._userSpatialReference)}),{sync:!0}),w((()=>this._userSpatialReference),(e=>{this.defaultsFromMap&&(this.defaultsFromMap.userSpatialReference=e)}),{sync:!0,initial:!0})])}_setupSpatialReferenceLogger(){let e=null;this.handles.add([w((()=>this.defaultsFromMap?.ready),(t=>{const i=this.map?.allLayers.length>0;if(t&&!this.spatialReference&&i){if(u(e))return;const t=d((()=>e=m(e)));e=a((async t=>{try{await g(this.spatialReferenceWarningDelay,null,t)}catch{return}finally{e=null}y.getLogger(this.declaredClass).warn("#spatialReference","no spatial reference could be derived from the currently added map layers")})),this.handles.add(t,"spatial-reference-logger-task")}else this.handles.remove("spatial-reference-logger-task")}),{sync:!0})])}destroy(){if(this.destroyed)return;this.viewEvents.destroy(),this.allLayerViews.destroy(),this.navigation&&(this.navigation.destroy(),this._set("navigation",null)),this.graphics=c(this.graphics),this.analyses=c(this.analyses),this.handles.remove("defaultsFromMap"),this.defaultsFromMap.destroy(),this._set("defaultsFromMap",null),c(this.analysisViewManager),this.toolViewManager=c(this.toolViewManager),this.layerViewManager=c(this.layerViewManager),this.basemapView=c(this.basemapView),this.invalidate(),this._emitter.clear(),this.handles.removeAll();const e=this.map;this.map=null,e?.destroy()}_startup(){this._set("ready",!0)}_teardown(){this._set("ready",!1)}whenReady(){return Promise.resolve(this)}toMap(){return y.getLogger(this.declaredClass).error("#toMap()","Not implemented on this instance of View"),null}get activeTool(){return this.toolViewManager?.activeTool}set activeTool(e){this.toolViewManager&&(this.toolViewManager.activeTool=e)}get animation(){return this._get("animation")}set animation(e){this._set("animation",e)}get _defaultsFromMapSettings(){return{}}get defaultsFromMap(){return new k({required:{tileInfo:!1,heightModelInfo:!1,extent:!1},map:()=>this.map,getSpatialReferenceSupport:e=>this.getSpatialReferenceSupport(e),...this._defaultsFromMapSettings})}get extent(){return this._get("extent")}set extent(e){this._set("extent",e)}get heightModelInfo(){return this.getDefaultHeightModelInfo()}get interacting(){return this.navigating}get navigating(){return!1}get preconditionsReady(){return!(this.fatalError||!this._isValid||this._readyCycleForced||!this.map||h.isLoadable(this.map)&&!this.map.loaded||0===this.width||0===this.height||!this.spatialReference||!this._validateSpatialReference(this.spatialReference)||!this._currentSpatialReference&&!this.defaultsFromMap?.ready||!this.typeSpecificPreconditionsReady)}set map(e){e!==this._get("map")&&(e?.destroyed&&(y.getLogger(this.declaredClass).warn("#map","The provided map is already destroyed",{map:e}),e=null),h.isLoadable(e)&&e.load().catch((()=>{})),this.constructed&&(this.forceReadyCycle(),this._currentSpatialReference=null),this._set("map",e))}get spatialReference(){let e=this._userSpatialReference||this._currentSpatialReference||this.getDefaultSpatialReference()||null;return e&&this.defaultsFromMap?.required?.heightModelInfo&&(e=e.clone(),e.vcsWkid=this.defaultsFromMap.vcsWkid,e.latestVcsWkid=this.defaultsFromMap.latestVcsWkid),e}set spatialReference(e){const t=!C(e,this._get("spatialReference"));this._set("_userSpatialReference",e),t&&(this._set("spatialReference",e),this._spatialReferenceChanged(e))}_spatialReferenceChanged(e){}get stationary(){return!this.animation&&!this.navigating&&!this.resizing}get tools(){return this.toolViewManager?.tools}get initialExtent(){return this.defaultsFromMap?.extent}get cursor(){const e=this.toolViewManager?this.toolViewManager.cursor:null;return u(e)?e:this._cursor||"default"}set cursor(e){this._cursor=e,this.notifyChange("cursor")}get size(){return[this.width,this.height]}whenLayerView(e){return this.layerViewManager.whenLayerView(e)}getDefaultSpatialReference(){return this.defaultsFromMap?.spatialReference}getDefaultHeightModelInfo(){return(this.map&&"heightModelInfo"in this.map?this.map.heightModelInfo:void 0)??this.defaultsFromMap?.heightModelInfo??null}importLayerView(e){throw new n("importLayerView() not implemented")}hasLayerViewModule(e){return!1}async validate(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{constraints:null}}_validateSpatialReference(e){return u(this.getSpatialReferenceSupport({spatialReference:e}))}when(e,t){return this.isResolved()&&!this.ready&&y.getLogger(this.declaredClass).warn("#when()","Calling view.when() while the view is no longer ready but was already resolved once will resolve immediately. Use reactiveUtils.whenOnce(() => view.ready).then(...) instead."),super.when(e,t)}forceReadyCycle(){this.ready&&(M((()=>!1===this.preconditionsReady),(()=>this._readyCycleForced=!1),{once:!0}),this._readyCycleForced=!0)}addAndActivateTool(e){this.toolViewManager.tools.add(e),this.activeTool=e}tryFatalErrorRecovery(){this.fatalError=null}};W.views=new s,e([R()],W.prototype,"_userSpatialReference",void 0),e([R()],W.prototype,"activeTool",null),e([R({readOnly:!0})],W.prototype,"allLayerViews",void 0),e([R()],W.prototype,"groundView",void 0),e([R()],W.prototype,"animation",null),e([R()],W.prototype,"basemapView",void 0),e([R({readOnly:!0})],W.prototype,"_defaultsFromMapSettings",null),e([R()],W.prototype,"defaultsFromMap",null),e([R()],W.prototype,"fatalError",void 0),e([R({type:j})],W.prototype,"extent",null),e([R(S(E,"graphics"))],W.prototype,"graphics",void 0),e([R(S(O,"analyses"))],W.prototype,"analyses",void 0),e([R({readOnly:!0,type:F})],W.prototype,"heightModelInfo",null),e([R({readOnly:!0})],W.prototype,"interacting",null),e([R({readOnly:!0})],W.prototype,"navigating",null),e([R({readOnly:!0,dependsOn:["fatalError","_isValid","_readyCycleForced","map","map.loaded?","width","height","spatialReference","_currentSpatialReference","defaultsFromMap.ready","typeSpecificPreconditionsReady"]})],W.prototype,"preconditionsReady",null),e([R({readOnly:!0})],W.prototype,"typeSpecificPreconditionsReady",void 0),e([R({type:s,readOnly:!0})],W.prototype,"layerViews",void 0),e([R({type:I})],W.prototype,"magnifier",void 0),e([R({value:null,type:t})],W.prototype,"map",null),e([R()],W.prototype,"padding",void 0),e([R({readOnly:!0})],W.prototype,"ready",void 0),e([R({type:L})],W.prototype,"spatialReference",null),e([R()],W.prototype,"spatialReferenceWarningDelay",void 0),e([R()],W.prototype,"stationary",null),e([R({readOnly:!0})],W.prototype,"supportsGround",void 0),e([R({type:i})],W.prototype,"timeExtent",void 0),e([R()],W.prototype,"tools",null),e([R()],W.prototype,"toolViewManager",void 0),e([R({readOnly:!0})],W.prototype,"type",void 0),e([R({type:Number})],W.prototype,"scale",void 0),e([R({readOnly:!0})],W.prototype,"updating",void 0),e([R({readOnly:!0})],W.prototype,"initialExtentRequired",void 0),e([R({readOnly:!0})],W.prototype,"initialExtent",null),e([R()],W.prototype,"cursor",null),e([R({readOnly:!0})],W.prototype,"input",void 0),e([R({type:U,nonNullable:!0})],W.prototype,"navigation",void 0),e([R()],W.prototype,"layerViewManager",void 0),e([R()],W.prototype,"analysisViewManager",void 0),e([R()],W.prototype,"width",void 0),e([R()],W.prototype,"height",void 0),e([R({readOnly:!0})],W.prototype,"resizing",void 0),e([R({value:null,readOnly:!0})],W.prototype,"size",null),e([R({readOnly:!0})],W.prototype,"suspended",void 0),e([R({readOnly:!0})],W.prototype,"viewEvents",void 0),e([R({readOnly:!0})],W.prototype,"persistableViewModels",void 0),e([R()],W.prototype,"_isValid",void 0),e([R()],W.prototype,"_readyCycleForced",void 0),e([R()],W.prototype,"_currentSpatialReference",void 0),W=P=e([_("esri.views.View")],W);const z=W;export{z as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{createTask as o}from"../../core/asyncUtils.js";import{removeMaybe as t,isNone as i}from"../../core/maybe.js";import{onAbort as e}from"../../core/promiseUtils.js";import{
|
|
5
|
+
import{createTask as o}from"../../core/asyncUtils.js";import{removeMaybe as t,isNone as i}from"../../core/maybe.js";import{onAbort as e}from"../../core/promiseUtils.js";import{whenOnce as n,watch as r,syncAndInitial as s}from"../../core/reactiveUtils.js";function a(i,r,s){const a=m(i,r);i.view.activeTool=a;let c=e(s,(()=>l(i,r)));return o((async o=>{await n((()=>!a.active),o),c=t(c),l(i,r)}),s)}function c(o,t){return r((()=>o.interactive),(()=>l(o,t)),s)}function l(o,t){o.interactive?m(o,t):v(o)}function m(o,t){v(o);const{view:i,analysis:e}=o,n=new t({view:i,analysis:e,analysisViewData:o});return o.tool=n,i.tools.add(n),n}function v(o){const{view:t,tool:e}=o;i(e)||(t.tools.remove(e),o.tool=null)}export{a as activateTemporaryAnalysisViewTool,c as connectAnalysisViewToTool,v as removeAnalysisViewTool};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{tBaseLine as o,tPanion as e,dtPanion as n,ddtPanion as a,tAscensionZoomOnly as t,tAscensionZoomPan as c,dtAscensionZoomOnly as s,dtAscensionZoomPan as m,ddtAscensionZoomOnly as r,ddtAscensionZoomPan as i,tDescensionZoomOnly as u,tDescensionZoomPan as l,dtDescensionZoomOnly as d,dtDescensionZoomPan as x,ddtDescensionZoomOnly as p,ddtDescensionZoomPan as F}from"./functions.js";function f(f,Z){let P=D(f,Z);const b={ascensionFactor:null!=Z.ascensionFactor?Z.ascensionFactor:.5,descensionFactor:null!=Z.descensionFactor?Z.descensionFactor:.5},g=0===b.ascensionFactor,h=0===b.descensionFactor,M=g?t:c,k=g?s:m,N=g?r:i,j=h?u:l,w=h?d:x,z=h?p:F,A=o=>M(f,o,b)+e(f,o,b)+j(f,o,b),I=o=>k(f,o,b)+n(f,o,b)+w(f,o,b),q=o=>N(f,o,b)+a(f,o,b)+z(f,o,b);let v=A(P);const y=o(f);let B;const C=Z.maximumIterations||20,E=null!=Z.maximumDistance?Z.maximumDistance:1/0;for(B=0;B<C;B++){const o=1e-6,e=(I(P)+o)/q(P);if(isNaN(e)||P>=E&&e<0){if(!isFinite(E))return null;P=E,v=A(P);break}if(P-=e,P<f.compared.sourceZoom||P<f.compared.targetZoom)return null;const n=A(P);if(Math.abs(n-v)/v<=.005)break;v=n}return v>y*(1-.3)||P<f.compared.sourceZoom||P<f.compared.targetZoom?null:P}function D(o,e){const n=Math.max(o.compared.sourceZoom,o.compared.targetZoom),a=o.source.zoomAtPixelsPerPan(o.desiredPixelFlow/o.compared.pan)/2;return a<n?null!=e.maximumDistance?n+(e.maximumDistance-n)/2:1.5*n:e.maximumDistance?Math.min(e.maximumDistance,a):a}export{f as optimalDistance};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import{isSome as t,destroyMaybe as i}from"../../core/maybe.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import r from"./DrawAction.js";import{
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import{isSome as t,destroyMaybe as i}from"../../core/maybe.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import r from"./DrawAction.js";import{defaultDrawingMode as n,drawingModes as a}from"./DrawingMode.js";import{DrawTool as d}from"./DrawTool.js";import{VertexRemoveEvent as h,VertexAddEvent as p,CursorUpdateEvent as l,DrawCompleteEvent as _}from"./input/DrawEvents.js";import{ViewEventPriorities as c}from"../input/InputManager.js";import{SKETCH_KEYS as v}from"../interactive/keybindings.js";import{createScreenPointFromEvent as m}from"../support/screenUtils.js";import u from"../../geometry/Point.js";let w=class extends r{constructor(e){super(e),this._panEnabled=!1,this._popVertexOnPointerMove=!1,this._addVertexOnPointerUp=!1,this.mode=n}initialize(){"2d"===this.view.type?(this._addViewHandles(),this._addUndoRedoHandles()):this._addDrawTool()}destroy(){"2d"===this.view.type?(this._removeViewHandles(),this._removeUndoRedoHandles()):this._removeDrawTool(),this.emit("destroy")}get _dragEnabled(){return"freehand"===this.mode||"hybrid"===this.mode}get _clickEnabled(){return"click"===this.mode||"hybrid"===this.mode}undo(){super.undo(),this.notifyChange("vertices")}redo(){super.redo(),this.notifyChange("vertices")}complete(){"2d"===this.view.type?this._completeDrawing():this._drawTool.completeCreateOperation()}_getGeometryZValue(){return this.hasZ&&this.vertices.length>0?this.vertices[0][2]:this.defaultZ}_addViewHandles(){this._removeViewHandles(),this._handles.add([this.view.on("click",(e=>{e.stopPropagation()}),c.TOOL),this.view.on("pointer-down",(e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._activePointerId=e.pointerId,this._addVertexOnPointerUp=!0,this._cursorScreenPoint=m(e),"touch"===e.pointerType&&this._updateCursor(e.native))}),c.TOOL),this.view.on("pointer-move",(e=>{this._abortSnapping(),this._popVertexOnPointerMove&&(this.undo(),this._popVertexOnPointerMove=!1),this._cursorScreenPoint=m(e),"touch"!==e.pointerType&&this._updateCursor(e.native)}),c.TOOL),this.view.on("pointer-drag",(e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._cursorScreenPoint=m(e),this._dragEnabled&&!this._panEnabled?this._vertexAddHandler(e):this._addVertexOnPointerUp=!1)}),c.TOOL),this.view.on("pointer-up",(e=>{if(this._shouldHandlePointerEvent(e))if(this._abortSnapping(),this._activePointerId=null,this._addVertexOnPointerUp){if(!this._clickEnabled)return 1===this.vertices.length&&this.vertices.pop(),void this._drawCompleteHandler(e);this._vertexAddHandler(e)}else{const t="touch"===e.pointerType;this._updateCursor(e.native,t)}}),c.TOOL),this.view.on("drag",(e=>{this._dragEnabled&&t(this._activePointerId)&&!this._panEnabled&&e.stopPropagation()}),c.TOOL),this.view.on("drag",["Shift"],(e=>{e.stopPropagation()}),c.TOOL),this.view.on("double-click",(e=>{e.stopPropagation(),this._drawCompleteHandler(e)}),c.TOOL),this.view.on("double-click",["Control"],(e=>{e.stopPropagation(),this._drawCompleteHandler(e)}),c.TOOL),this.view.on("key-down",(e=>{const{key:t,repeat:i}=e;t===v.vertexAdd&&!i&&this._cursorScreenPoint?(e.stopPropagation(),this._abortSnapping(),this._vertexAddHandler(e)):t!==v.complete||i?t!==v.undo||this.interactiveUndoDisabled||i?t!==v.redo||this.interactiveUndoDisabled||i?t!==v.pan||i||(e.stopPropagation(),this._panEnabled=!0):(e.stopPropagation(),this.redo()):(e.stopPropagation(),this.undo()):(e.stopPropagation(),this._drawCompleteHandler(e))}),c.TOOL),this.view.on("key-up",(e=>{e.key===v.pan&&(e.stopPropagation(),this._panEnabled=!1)}),c.TOOL)],this._viewHandlesKey)}_addUndoRedoHandles(){this._removeUndoRedoHandles(),this._handles.add([this._editGeometryOperations.on("vertex-remove",(e=>{if(this.notifyChange("vertices"),"undo"===e.operation){const i=this._nativeEventHistory.undoStack.pop();this._nativeEventHistory.redoStack.push(i);const o=[...this._committedVertices];t(this._stagedVertex)&&o.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("undo",new h(this.view,i,e.vertices[0].index,o))}})),this._editGeometryOperations.on("vertex-add",(e=>{if(this.notifyChange("vertices"),"apply"===e.operation){const e=this._nativeEventHistory.undoStack[this._nativeEventHistory.undoStack.length],t=this._committedVertices.length-1,i=new p(this.view,e,t,this.vertices);this.emit("vertex-add",i),i.defaultPrevented&&(this._popVertexOnPointerMove=!0)}else if("redo"===e.operation){const i=this._nativeEventHistory.redoStack.pop();this._nativeEventHistory.undoStack.push(i);const o=[...this._committedVertices];t(this._stagedVertex)&&o.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("redo",new p(this.view,i,e.vertices[0].index,o))}}))],this._undoRedoHandlesKey)}_removeViewHandles(){this._handles.remove(this._viewHandlesKey)}_removeUndoRedoHandles(){this._handles.remove(this._undoRedoHandlesKey)}_addDrawTool(){this._drawTool=new d({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:"polygon",mode:this.mode}),this.view.addAndActivateTool(this._drawTool),this._drawTool.on("vertex-add",(e=>{1===e.vertices.length&&this.emit("vertex-add",new p(this.view,null,e.vertices[0].vertexIndex,this._drawTool.getVertexCoords()))})),this._drawTool.on("cursor-update",(e=>{1===e.vertices.length&&this.emit("cursor-update",new l(this.view,null,e.vertices[0].vertexIndex,this._drawTool.getVertexCoords()))})),this._drawTool.on("complete",(e=>{this.emit("draw-complete",new _(null,this._drawTool.getVertexCoords())),this._removeDrawTool()}))}_removeDrawTool(){this._handles.remove(this._drawToolHandlesKey),this.view.tools.remove(this._drawTool),this._drawTool=i(this._drawTool)}_addVertex(e,t){const i=this._coordinateHelper.arrayToVector(e);if(this._isDuplicateOfLastVertex(i))return;this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertex(i);const o=t||new Event("placeholder");this._nativeEventHistory.undoStack.push(o)}_updateCursor(e,i=!1){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const o=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);t(o)&&!i&&this._pushCursorVertex(o.vertex,(()=>this.emit("cursor-update",new l(this.view,e,this._activeComponent.vertices.length,this.vertices,t(this._stagedVertex)?new u(this._stagedVertex):null))))}_completeDrawing(e){if(this._activePointerId=null,this._popCursorVertex(),this._committedVertices.length<3)return;this._abortSnapping(),t(this._snappingManager)&&this._snappingManager.doneSnapping();const i=new _(e,this.vertices);this.emit("draw-complete",i),i.defaultPrevented||this._removeViewHandles()}};e([o()],w.prototype,"_dragEnabled",null),e([o()],w.prototype,"_clickEnabled",null),e([o({type:a})],w.prototype,"mode",void 0),w=e([s("esri.views.draw.PolygonDrawAction")],w);export{w as PolygonDrawAction};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import{isSome as t,destroyMaybe as i}from"../../core/maybe.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import r from"./DrawAction.js";import{
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import"../../geometry.js";import{isSome as t,destroyMaybe as i}from"../../core/maybe.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import r from"./DrawAction.js";import{defaultDrawingMode as n,drawingModes as a}from"./DrawingMode.js";import{DrawTool as d}from"./DrawTool.js";import{VertexRemoveEvent as h,VertexAddEvent as p,CursorUpdateEvent as l,DrawCompleteEvent as _}from"./input/DrawEvents.js";import{ViewEventPriorities as c}from"../input/InputManager.js";import{SKETCH_KEYS as v}from"../interactive/keybindings.js";import{createScreenPointFromEvent as m}from"../support/screenUtils.js";import u from"../../geometry/Point.js";let w=class extends r{constructor(e){super(e),this._panEnabled=!1,this._popVertexOnPointerMove=!1,this._addVertexOnPointerUp=!1,this.mode=n}initialize(){"2d"===this.view.type?(this._addViewHandles(),this._addUndoRedoHandles()):this._addDrawTool()}destroy(){"2d"===this.view.type?(this._removeViewHandles(),this._removeUndoRedoHandles()):this._removeDrawTool(),this.emit("destroy")}get _clickEnabled(){return"click"===this.mode||"hybrid"===this.mode}get _dragEnabled(){return"freehand"===this.mode||"hybrid"===this.mode}undo(){super.undo(),this.notifyChange("vertices")}redo(){super.redo(),this.notifyChange("vertices")}complete(){"2d"===this.view.type?this._completeDrawing():this._drawTool.completeCreateOperation()}_addViewHandles(){this._removeViewHandles(),this._handles.add([this.view.on("click",(e=>{e.stopPropagation()}),c.TOOL),this.view.on("pointer-down",(e=>{this._shouldHandlePointerEvent(e)&&!this._panEnabled&&(this._abortSnapping(),this._activePointerId=e.pointerId,this._addVertexOnPointerUp=!0,this._cursorScreenPoint=m(e),"touch"===e.pointerType&&this._updateCursor(e.native))}),c.TOOL),this.view.on("pointer-move",(e=>{this._popVertexOnPointerMove&&(this.undo(),this._popVertexOnPointerMove=!1),this._abortSnapping(),this._cursorScreenPoint=m(e),"touch"!==e.pointerType&&this._updateCursor(e.native)}),c.TOOL),this.view.on("pointer-drag",(e=>{this._shouldHandlePointerEvent(e)&&(this._abortSnapping(),this._cursorScreenPoint=m(e),this._dragEnabled&&!this._panEnabled?this._vertexAddHandler(e):this._addVertexOnPointerUp=!1)}),c.TOOL),this.view.on("pointer-up",(e=>{if(this._shouldHandlePointerEvent(e))if(this._abortSnapping(),this._activePointerId=null,this._addVertexOnPointerUp){if(!this._clickEnabled)return 1===this.vertices.length&&this.vertices.pop(),void this._drawCompleteHandler(e);this._vertexAddHandler(e)}else{const t="touch"===e.pointerType;this._updateCursor(e.native,t)}}),c.TOOL),this.view.on("drag",(e=>{this._dragEnabled&&t(this._activePointerId)&&!this._panEnabled&&e.stopPropagation()}),c.TOOL),this.view.on("drag",["Shift"],(e=>{e.stopPropagation()}),c.TOOL),this.view.on("double-click",(e=>{e.stopPropagation(),this._drawCompleteHandler(e)}),c.TOOL),this.view.on("double-click",["Control"],(e=>{e.stopPropagation(),this._drawCompleteHandler(e)}),c.TOOL),this.view.on("key-down",(e=>{const{key:t,repeat:i}=e;t===v.vertexAdd&&!i&&this._cursorScreenPoint?(e.stopPropagation(),this._abortSnapping(),this._vertexAddHandler(e)):t!==v.complete||i?t!==v.undo||this.interactiveUndoDisabled||i?t!==v.redo||this.interactiveUndoDisabled||i?t!==v.pan||i||(e.stopPropagation(),this._panEnabled=!0):(e.stopPropagation(),this.redo()):(e.stopPropagation(),this.undo()):(e.stopPropagation(),this._drawCompleteHandler(e))}),c.TOOL),this.view.on("key-up",(e=>{e.key===v.pan&&(e.stopPropagation(),this._panEnabled=!1)}),c.TOOL)],this._viewHandlesKey)}_addUndoRedoHandles(){this._removeUndoRedoHandles(),this._handles.add([this._editGeometryOperations.on("vertex-remove",(e=>{if(this.notifyChange("vertices"),"undo"===e.operation){const i=this._nativeEventHistory.undoStack.pop();this._nativeEventHistory.redoStack.push(i);const o=[...this._committedVertices];t(this._stagedVertex)&&o.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("undo",new h(this.view,i,e.vertices[0].index,o))}})),this._editGeometryOperations.on("vertex-add",(e=>{if(this.notifyChange("vertices"),"apply"===e.operation){const e=this._nativeEventHistory.undoStack[this._nativeEventHistory.undoStack.length],t=this._committedVertices.length-1,i=new p(this.view,e,t,this.vertices);this.emit("vertex-add",i),i.defaultPrevented&&(this._popVertexOnPointerMove=!0)}else if("redo"===e.operation){const i=this._nativeEventHistory.redoStack.pop();this._nativeEventHistory.undoStack.push(i);const o=[...this._committedVertices];t(this._stagedVertex)&&o.push(this._coordinateHelper.pointToArray(this._stagedVertex)),this.emit("redo",new p(this.view,i,e.vertices[0].index,o))}}))],this._undoRedoHandlesKey)}_removeViewHandles(){this._handles.remove(this._viewHandlesKey)}_removeUndoRedoHandles(){this._handles.remove(this._undoRedoHandlesKey)}_addDrawTool(){this._drawTool=new d({view:this.view,elevationInfo:this.elevationInfo,hasZ:this.hasZ,geometryType:"polyline",mode:this.mode}),this.view.addAndActivateTool(this._drawTool),this._handles.add([this._drawTool.on("vertex-add",(e=>{1===e.vertices.length&&this.emit("vertex-add",new p(this.view,null,e.vertices[0].vertexIndex,this._drawTool.getVertexCoords()))})),this._drawTool.on("cursor-update",(e=>{1===e.vertices.length&&this.emit("cursor-update",new l(this.view,null,e.vertices[0].vertexIndex,this._drawTool.getVertexCoords()))})),this._drawTool.on("complete",(e=>{this.emit("draw-complete",new _(null,this._drawTool.getVertexCoords())),this._removeDrawTool()}))],this._drawToolHandlesKey)}_removeDrawTool(){this._handles.remove(this._drawToolHandlesKey),this.view.tools.remove(this._drawTool),this._drawTool=i(this._drawTool)}_addVertex(e,t){const i=this._coordinateHelper.arrayToVector(e);if(this._isDuplicateOfLastVertex(i))return;this._lastVertexUnsnapped=this._stagedVertexUnsnapped,this._popCursorVertex(),this._editGeometryOperations.appendVertex(i);const o=t||new Event("placeholder");this._nativeEventHistory.undoStack.push(o)}_updateCursor(e,i=!1){if(this._popCursorVertex(),!this._cursorScreenPoint)return;const o=this.getCoordsAndPointFromScreenPoint(this._cursorScreenPoint);t(o)&&!i&&this._pushCursorVertex(o.vertex,(()=>this.emit("cursor-update",new l(this.view,e,this._activeComponent.vertices.length,this.vertices,t(this._stagedVertex)?new u(this._stagedVertex):null))))}_completeDrawing(e){if(this._activePointerId=null,this._popCursorVertex(),this._committedVertices.length<2)return;this._abortSnapping(),t(this._snappingManager)&&this._snappingManager.doneSnapping();const i=new _(e,this.vertices);this.emit("draw-complete",i),i.defaultPrevented||this._removeViewHandles()}};e([o()],w.prototype,"_clickEnabled",null),e([o()],w.prototype,"_dragEnabled",null),e([o({type:a})],w.prototype,"mode",void 0),w=e([s("esri.views.draw.PolylineDrawAction")],w);export{w as PolylineDrawAction};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../geometry.js";import{equals as t}from"../../../core/arrayUtils.js";import{clone as e}from"../../../core/lang.js";import{isSome as o,filterNones as n,isNone as r}from"../../../core/maybe.js";import{getMetersPerUnitForSR as a}from"../../../core/unitUtils.js";import{h as s}from"../../../chunks/vec3.js";import{c as l}from"../../../chunks/vec3f64.js";import i from"../../../geometry/Circle.js";import{simplify as c,distance as p}from"../../../geometry/geometryEngine.js";import{unnormalizeGeometryOnDatelineCrossing as y,isClockwise as m,unnormalizeVerticesOnDatelineCrossing as u}from"../../../geometry/support/coordsUtils.js";import{isValid as x}from"../../../geometry/support/spatialReferenceUtils.js";import{makeSurfacePoint as f}from"./surfaceCoordinateSystems.js";import h from"../../../geometry/
|
|
5
|
+
import"../../../geometry.js";import{equals as t}from"../../../core/arrayUtils.js";import{clone as e}from"../../../core/lang.js";import{isSome as o,filterNones as n,isNone as r}from"../../../core/maybe.js";import{getMetersPerUnitForSR as a}from"../../../core/unitUtils.js";import{h as s}from"../../../chunks/vec3.js";import{c as l}from"../../../chunks/vec3f64.js";import i from"../../../geometry/Circle.js";import{simplify as c,distance as p}from"../../../geometry/geometryEngine.js";import{unnormalizeGeometryOnDatelineCrossing as y,isClockwise as m,unnormalizeVerticesOnDatelineCrossing as u}from"../../../geometry/support/coordsUtils.js";import{isValid as x}from"../../../geometry/support/spatialReferenceUtils.js";import{makeSurfacePoint as f}from"./surfaceCoordinateSystems.js";import h from"../../../geometry/Point.js";import M from"../../../geometry/Multipoint.js";import g from"../../../geometry/Polyline.js";import d from"../../../geometry/Polygon.js";const R="DrawAction-snapping-graphics-layer";function j(t,e,n=null){return o(n)?[t,e,n]:[t,e]}function T(t,e){const o=new h({x:t[0],y:t[1],spatialReference:e});return t.length>2&&(o.z=t[2]),o}function b(t,e){return new M({points:t,spatialReference:e})}function U(t,e,o){const n=new g({paths:t,spatialReference:e});return o&&y(n),n}function P(o,n,r,a=!0){const s=e(o);s.forEach((e=>{const o=e[0],n=e[e.length-1];t(o,n)&&1!==e.length||e.push(e[0])}));let l=new d({rings:s,spatialReference:n});return l.rings.forEach((t=>{m(t,!1,!1)||t.reverse()})),r&&y(l),a&&l.isSelfIntersecting&&x(n)&&(l=c(l)),l}function w(t,e,o){const r=e.mapToLocalMultiple(t),a=[],s={x:r[0].x,y:r[0].y},l={x:r[1].x,y:r[1].y},i=Math.round(l.x-s.x),c=Math.round(l.y-s.y),p=Math.max(Math.abs(i),Math.abs(c));if(o){const t={x:s.x+p,y:s.y+p},e={x:s.x-p,y:s.y-p};a.push(f(t.x,e.y),f(e.x,e.y),f(e.x,t.y),f(t.x,t.y))}else{const t={x:i>0?s.x+p:s.x-p,y:c>0?s.y+p:s.y-p};a.push(f(s.x,s.y),f(t.x,s.y),f(t.x,t.y),f(s.x,t.y))}return I(P([n(a.map((t=>e.localToMap(t))))],e.spatialReference,e.doUnnormalization,!0),a,e)}function z(t,e,o){let r=e.mapToLocalMultiple(t);if(1===r.length){const t=48,e=r[0];r=[f(e.x-t,e.y+t),f(e.x+t,e.y-t),f(e.x+t,e.y-t),f(e.x-t,e.y+t)]}const a=[],s={x:r[0].x,y:r[0].y},l={x:r[1].x,y:r[1].y};if(o){const t=Math.round(l.x-s.x),e=Math.round(l.y-s.y);a.push(f(s.x-t,s.y-e),f(l.x,s.y-e),f(l.x,l.y),f(s.x-t,l.y))}else a.push(f(s.x,s.y),f(l.x,s.y),f(l.x,l.y),f(s.x,l.y));return I(P([n(a.map((t=>e.localToMap(t))))],e.spatialReference,e.doUnnormalization,!0),a,e)}function I(t,e,n){const r=L(e[3],e[2],n),a=L(e[1],e[2],n),s=L(e[0],e[1],n),l=L(e[0],e[3],n);return{geometry:t,midpoints:o(r)&&o(a)&&o(s)&&o(l)?{top:r,right:a,bottom:s,left:l}:null}}function L(t,e,n){E[0]=t.x,E[1]=t.y,E[2]=0,k[0]=e.x,k[1]=e.y,k[2]=0,s(E,E,k,.5),v.x=E[0],v.y=k[1],v.z=k[2];const r=n.localToMap(v);return o(r)?T(r,n.spatialReference):null}const v=f(0,0,0),E=l(),k=l();function C(t,e,o,n){const s=e.mapToLocalMultiple(t);let l=null,c=null;if(o)l=s[0],c=s[1];else{const t=s[0],e=s[1],o=Math.round(e.x-t.x),n=Math.round(e.y-t.y),r=Math.max(Math.abs(o),Math.abs(n));l=f(o>0?t.x+r/2:t.x-r/2,n>0?t.y+r/2:t.y-r/2),c=f(Math.abs(o)>Math.abs(n)?l.x-r/2:l.x,Math.abs(o)>Math.abs(n)?l.y:l.y-r/2)}const y=e.localToMap(l),m=e.localToMap(c);if(r(y)||r(m))return null;e.doUnnormalization&&u([[y,m]],e.spatialReference);const h=T(y,e.spatialReference),M=T(m,e.spatialReference),g=a(e.spatialReference);let d=0;if(x(e.spatialReference))d=g*p(h,M,null);else{const t=l.x-c.x,e=l.y-c.y;d=g*Math.sqrt(t*t+e*e)*(n||1)}const R=new i({center:h,radius:d,radiusUnit:"meters",spatialReference:e.spatialReference});return{geometry:P(R.rings,R.spatialReference,!1),center:h,edge:M}}function S(t,e,r){const a=e.mapToLocalMultiple(t),s=a[0],l=a[1],i=Math.round(l.x-s.x),c=Math.round(l.y-s.y),p=f(r?s.x:s.x+i/2,r?s.y:s.y+c/2),y=r?i:i/2,m=r?c:c/2,u=60,x=[],h=2*Math.PI/u;function M(t){const e=Math.cos(t),o=Math.sin(t);return f(y*e+p.x,m*o+p.y)}for(let o=0;o<u;o++)x.push(M(o*h));x.push(x[0]);const{spatialReference:g,doUnnormalization:d}=e,R=P([n(x.map((t=>e.localToMap(t))))],g,d,!1),j=e.localToMap(M(Math.PI/2)),b=e.localToMap(M(0)),U=e.localToMap(M(-Math.PI/2)),w=e.localToMap(M(Math.PI));return{geometry:R,midpoints:o(j)&&o(b)&&o(U)&&o(w)?{top:T(j,g),right:T(b,g),bottom:T(U,g),left:T(w,g)}:null}}export{R as SNAPPING_GRAPHICS_LAYER_ID,C as createCircle,S as createEllipse,b as createMultipoint,T as createPoint,P as createPolygon,U as createPolyline,z as createRectangle,w as createSquare,j as makeMapPoint};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../geometry.js";import{isSome as t,filterNones as r}from"../../../core/maybe.js";import{
|
|
5
|
+
import"../../../geometry.js";import{isSome as t,filterNones as r}from"../../../core/maybe.js";import{c as e}from"../../../chunks/mat2d.js";import{c as s,a}from"../../../chunks/mat2df64.js";import{r as o,i}from"../../../chunks/quat.js";import{a as n}from"../../../chunks/quatf64.js";import{g as l,e as h,b as m,n as c,f,q as p}from"../../../chunks/vec3.js";import{c as d}from"../../../chunks/vec3f64.js";import{Axis as u}from"../../../geometry/support/Axis.js";import w from"../../../geometry/Point.js";function g(r,e,s=null){return t(s)?[r,e,s]:[r,e]}function R(r,e,s=null){return t(s)?{x:r,y:e,z:s}:{x:r,y:e}}class W{constructor(t){this.spatialReference=t}mapToLocalMultiple(t){return r(t.map((t=>this.mapToLocal(t))))}get doUnnormalization(){return!1}}class v extends W{constructor(t,r,o=null){super(r),this._defaultZ=o,this.transform=s(),this.transformInv=s(),this.transform=a(t),e(this.transformInv,this.transform)}makeMapPoint(t,r){return g(t,r,this._defaultZ)}mapToLocal(t){return R(this.transform[0]*t[0]+this.transform[2]*t[1]+this.transform[4],this.transform[1]*t[0]+this.transform[3]*t[1]+this.transform[5])}localToMap(t){return g(this.transformInv[0]*t.x+this.transformInv[2]*t.y+this.transformInv[4],this.transformInv[1]*t.x+this.transformInv[3]*t.y+this.transformInv[5],this._defaultZ)}}class F extends W{constructor(t,r){super(t.spatialReference),this.view=t,this.defaultZ=null,this.pWS=d(),this.tangentFrameUpWS=d(),this.tangentFrameRightWS=d(),this.tangentFrameForwardWS=d(),this.localFrameRightWS=d(),this.localFrameUpWS=d(),this.worldToLocalTransform=n(),this.localToWorldTransform=n(),this.scale=1,this.scale=t.resolution,this.referenceMapPoint=r,this.defaultZ=r.hasZ?r.z:null;const e=t.state.camera.viewRight;this.view.renderCoordsHelper.toRenderCoords(this.referenceMapPoint,this.pWS),this.view.renderCoordsHelper.worldBasisAtPosition(this.pWS,u.X,this.tangentFrameRightWS),this.view.renderCoordsHelper.worldBasisAtPosition(this.pWS,u.Y,this.tangentFrameUpWS),this.view.renderCoordsHelper.worldBasisAtPosition(this.pWS,u.Z,this.tangentFrameForwardWS);const s=d();l(s,this.tangentFrameForwardWS,h(e,this.tangentFrameForwardWS)),m(this.localFrameRightWS,e,s),c(this.localFrameRightWS,this.localFrameRightWS),f(this.localFrameUpWS,this.tangentFrameForwardWS,this.localFrameRightWS),o(this.worldToLocalTransform,this.localFrameRightWS,this.tangentFrameRightWS),i(this.localToWorldTransform,this.worldToLocalTransform)}get doUnnormalization(){return"global"===this.view.viewingMode}makeMapPoint(t,r){return g(t,r,this.defaultZ)}mapToLocal(r){const e=d();this.view.renderCoordsHelper.toRenderCoords(new w({x:r[0],y:r[1],spatialReference:this.spatialReference}),e),p(e,e,this.worldToLocalTransform);const s=this.view.renderCoordsHelper.fromRenderCoords(e,this.view.spatialReference);return t(s)?R(s.x/this.scale,s.y/this.scale):null}localToMap(r){const e=d();this.view.renderCoordsHelper.toRenderCoords(new w({x:r.x*this.scale,y:r.y*this.scale,spatialReference:this.spatialReference}),e),p(e,e,this.localToWorldTransform);const s=this.view.renderCoordsHelper.fromRenderCoords(e,this.view.spatialReference);return t(s)?g(s.x,s.y,this.defaultZ):null}}function S(t,r){if("2d"===t.type)return new v(t.state.transform,t.spatialReference,r.length>2?r[2]:null);if("3d"===t.type){const e=r.length>2?new w({x:r[0],y:r[1],z:r[2],spatialReference:t.spatialReference}):new w({x:r[0],y:r[1],spatialReference:t.spatialReference});return new F(t,e)}return null}export{v as AffineCoordinateSystem,F as SceneViewCoordinateSystem,W as SurfaceCoordinateSystem,S as createViewAlignedCoordinateSystem,g as makeMapPoint,R as makeSurfacePoint};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import r from"../../core/Logger.js";import{isNone as i}from"../../core/maybe.js";import n from"../../core/Queue.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{PropertiesPool as a}from"../3d/support/PropertiesPool.js";import{primaryKey as p,isSystemModifier as h}from"./keys.js";import{LatestPointer as l}from"./handlers/LatestPointer.js";let d=class extends t{constructor(e){super(e),this._pointerCaptures=new Map,this._nameToGroup={},this._handlers=[],this._currentPropagation=null,this._updateDependenciesAfterPropagation=!1,this._sourceEvents=new Set,this._keyModifiers=new Set,this._activeKeyModifiers=new Set,this._stoppedPropagationEventIds=new Set,this.primaryKey=p,this.latestPointerType="mouse",this._propertiesPool=new a({latestPointerLocation:g},this),this.latestPointerLocation=null,this.test={timestamp:void 0,hasCurrentPropagation:()=>!!this._currentPropagation}}initialize(){this.eventSource.onEventReceived=this._onEventReceived.bind(this),this._installRecognizers()}destroy(){const e=Object.keys(this._nameToGroup);for(const t of e)this.uninstallHandlers(t);this.eventSource.destroy(),this._currentPropagation=null,this._propertiesPool.destroy()}get hasPendingInputs(){return this._handlers.some((e=>e.handler.hasPendingInputs))}installHandlers(e,t,i=_.INTERNAL){if(this._nameToGroup[e])return void r.getLogger(this.declaredClass).error("There is already an InputHandler group registered under the name `"+e+"`");if(0===t.length)return void r.getLogger(this.declaredClass).error("Can't register a group of zero handlers");const n={name:e,handlers:t.map((e=>({handler:e,active:!0,removed:!1,priorityIndex:0,groupPriority:i,eventCallback:null,uninstallCallback:null})))};this._nameToGroup[e]=n;for(let r=n.handlers.length-1;r>=0;r--){const e=n.handlers[r];this._handlers.push(e),e.handler.onInstall({updateDependencies:()=>{this.updateDependencies()},emit:(t,r,i,n,s)=>{this._emitInputEvent(e.priorityIndex+1,t,r,i,s,n)},setPointerCapture:(t,r)=>{this._setPointerCapture(n,e,t,r)},setEventCallback:t=>{e.eventCallback=t},setUninstallCallback:t=>{e.uninstallCallback=t},refreshHasPendingInputs:()=>{this.notifyChange("hasPendingInputs")}})}this.updateDependencies()}uninstallHandlers(e){const t=this._nameToGroup[e];t?(t.handlers.forEach((e=>{e.removed=!0,e.uninstallCallback()})),delete this._nameToGroup[e],this._currentPropagation?this._currentPropagation.needsHandlerGarbageCollect=!0:this._garbageCollectRemovedHandlers()):r.getLogger(this.declaredClass).error("There is no InputHandler group registered under the name `"+e+"`")}hasHandlers(e){return void 0!==this._nameToGroup[e]}updateDependencies(){if(this._currentPropagation)return void(this._updateDependenciesAfterPropagation=!0);this._updateDependenciesAfterPropagation=!1;const e=new Set,t=new Set;this._handlersPriority=[];for(let r=this._handlers.length-1;r>=0;r--){const e=this._handlers[r];e.priorityIndex=r,this._handlersPriority.push(e)}this._handlersPriority=this._sortHandlersPriority(this._handlersPriority);for(let r=this._handlersPriority.length-1;r>=0;r--){const i=this._handlersPriority[r];i.priorityIndex=r;let n=i.handler.hasSideEffects;if(!n)for(const t of i.handler.outgoingEventTypes)if(e.has(t)){n=!0;break}if(n)for(const r of i.handler.incomingEventMatches){e.add(r.eventType);for(const e of r.keyModifiers)h(e)||t.add(e)}i.active=n}this._sourceEvents=e,this._keyModifiers=t,this._pointerCaptures.size>0&&this._sourceEvents.add("pointer-capture-lost"),this._keyModifiers.size>0&&(this._sourceEvents.add("key-down"),this._sourceEvents.add("key-up")),this.eventSource&&(this.eventSource.activeEvents=this._sourceEvents)}_setLatestPointer(e,t,r){this._get("latestPointerType")!==e&&this._set("latestPointerType",e);const n=this._get("latestPointerLocation");if(i(n)||n.x!==t||n.y!==r){const e=this._propertiesPool.get("latestPointerLocation");e.x=t,e.y=r,this._set("latestPointerLocation",e)}}_onEventReceived(e,t){if("pointer-capture-lost"===e){const e=t;this._pointerCaptures.delete(e.native.pointerId)}this._updateKeyModifiers(e,t);const r=null!=this.test.timestamp?this.test.timestamp:t.native?t.native.timestamp:void 0,i=t.native?t.native.cancelable:void 0;this._emitInputEventFromSource(e,t,r,i)}_updateKeyModifiers(e,t){if(!t)return;let r=!1;const i=()=>{if(!r){const e=new Set;this._activeKeyModifiers.forEach((t=>{e.add(t)})),this._activeKeyModifiers=e,r=!0}},n=(e,t)=>{t&&!this._activeKeyModifiers.has(e)?(i(),this._activeKeyModifiers.add(e)):!t&&this._activeKeyModifiers.has(e)&&(i(),this._activeKeyModifiers.delete(e))};if("key-down"===e||"key-up"===e){const r=t.key;this._keyModifiers.has(r)&&n(r,"key-down"===e)}const s=t.native;n("Alt",!(!s||!s.altKey)),n("Ctrl",!(!s||!s.ctrlKey)),n("Shift",!(!s||!s.shiftKey)),n("Meta",!(!s||!s.metaKey)),n("Primary",this._activeKeyModifiers.has(this.primaryKey))}_installRecognizers(){this._latestPointerHandler=new l(((e,t,r)=>this._setLatestPointer(e,t,r))),this.installHandlers("input-manager-logic",[this._latestPointerHandler],_.ALWAYS),this.recognizers.length>0&&this.installHandlers("default",this.recognizers,_.INTERNAL)}_setPointerCapture(e,t,r,i){const n=e.name+"-"+t.priorityIndex,s=this._pointerCaptures.get(r.pointerId)||new Set;this._pointerCaptures.set(r.pointerId,s),i?(s.add(n),1===s.size&&this.eventSource&&this.eventSource.setPointerCapture(r,!0)):s.has(n)&&(s.delete(n),0===s.size&&(this._pointerCaptures.delete(r.pointerId),this.eventSource&&this.eventSource.setPointerCapture(r,!1)))}_garbageCollectRemovedHandlers(){this._handlers=this._handlers.filter((e=>!e.removed)),this.updateDependencies()}_emitInputEventFromSource(e,t,r,i){this._emitInputEvent(0,e,t,r,i)}_emitInputEvent(e,t,r,i,n,s){const o=void 0!==i?i:this._currentPropagation?this._currentPropagation.timestamp:performance.now(),a=void 0!==n&&n,p={event:new c(t,r,o,s||this._activeKeyModifiers,a),priorityIndex:e};this._currentPropagation?this._currentPropagation.events.push(p):this._doNewPropagation(p)}_doNewPropagation(e){this._currentPropagation={events:new n,currentHandler:null,needsHandlerGarbageCollect:!1,timestamp:e.event.timestamp},this._currentPropagation.events.push(e),this._continuePropagation()}_continuePropagation(){const e=this._currentPropagation;if(e){for(;this._currentPropagation.events.length>0;){const{event:t,priorityIndex:r}=this._currentPropagation.events.pop(),i=t.data&&t.data.eventId;if(!(null!=i&&this._stoppedPropagationEventIds.has(i)))for(e.currentHandler=this._handlersPriority[r];e.currentHandler;){if(e.currentHandler.removed)e.needsHandlerGarbageCollect=!0;else{if(e.currentHandler.active&&!t.shouldStopPropagation()&&e.currentHandler.eventCallback(t),t.shouldStopPropagation()){null!=i&&this._stoppedPropagationEventIds.add(i);break}if(t.shouldPausePropagation((()=>this._continuePropagation())))return void this._pausePropagation({event:t,priorityIndex:e.currentHandler.priorityIndex+1})}e.currentHandler=this._handlersPriority[e.currentHandler.priorityIndex+1]}}e.needsHandlerGarbageCollect&&this._garbageCollectRemovedHandlers(),this.hasPendingInputs||this._stoppedPropagationEventIds.clear(),this._currentPropagation=null,this._updateDependenciesAfterPropagation&&this.updateDependencies()}}_pausePropagation(e){const t=new n;for(t.push(e);this._currentPropagation.events.length;)t.push(this._currentPropagation.events.pop());this._currentPropagation.events=t,this._currentPropagation.currentHandler=null}_compareHandlerPriority(e,t){if(e.handler.hasSideEffects!==t.handler.hasSideEffects)return e.handler.hasSideEffects?1:-1;if(e.groupPriority!==t.groupPriority)return e.groupPriority>t.groupPriority?-1:1;for(const r of e.handler.incomingEventMatches)for(const e of t.handler.incomingEventMatches){if(r.eventType!==e.eventType)continue;const t=r.keyModifiers.filter((t=>e.keyModifiers.includes(t)));if(t.length===r.keyModifiers.length!==(t.length===e.keyModifiers.length))return r.keyModifiers.length>e.keyModifiers.length?-1:1}return e.priorityIndex>t.priorityIndex?-1:1}_sortHandlersPriority(e){const t=[];for(const r of e){let e=0;for(;e<t.length&&this._compareHandlerPriority(r,t[e])>=0;)e++;t.splice(e,0,r)}return t}get debug(){const e=e=>{const t=this._setPointerCapture;this._setPointerCapture=()=>{},e(),this._setPointerCapture=t};return{injectEvent:(t,r)=>{e((()=>{this._onEventReceived(t,r)}))},disablePointerCapture:e}}};e([s({readOnly:!0})],d.prototype,"hasPendingInputs",null),e([s({constructOnly:!0})],d.prototype,"eventSource",void 0),e([s({constructOnly:!0})],d.prototype,"recognizers",void 0),e([s({readOnly:!0})],d.prototype,"latestPointerType",void 0),e([s({readOnly:!0})],d.prototype,"latestPointerLocation",void 0),d=e([o("esri.views.input.InputManager")],d);class c{constructor(e,t,r,i,n){this.type=e,this.data=t,this.timestamp=r,this.modifiers=i,this.cancelable=n,this._propagationState=u.NONE,this._resumeCallback=null}stopPropagation(){this._propagationState|=u.STOPPED}shouldStopPropagation(){return 0!=(this._propagationState&u.STOPPED)}async(e){this._propagationState|=u.PAUSED;const t=(e,t)=>{this._propagationState&=~u.PAUSED;const r=this._resumeCallback;if(this._resumeCallback=null,r&&r(),t)throw e;return e};return("function"==typeof e?e():e).then((e=>t(e,!1)),(e=>t(e,!0)))}shouldPausePropagation(e){return!!(this._propagationState&u.PAUSED)&&(this._resumeCallback=e,!0)}preventDefault(){this.data.native.preventDefault()}}var u;!function(e){e[e.NONE=0]="NONE",e[e.STOPPED=1]="STOPPED",e[e.PAUSED=2]="PAUSED"}(u||(u={}));const _={ALWAYS:1,DEFAULT:0,TOOL:-1,WIDGET:-2,INTERNAL:-3};class g{}export{d as InputManager,_ as ViewEventPriorities};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import r from"../../core/Logger.js";import{isNone as i}from"../../core/maybe.js";import n from"../../core/Queue.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{PropertiesPool as a}from"../3d/support/PropertiesPool.js";import{primaryKey as l,isSystemModifier as h}from"./keys.js";import{LatestPointer as p}from"./handlers/LatestPointer.js";import{MultiTouch as d}from"./handlers/MultiTouch.js";let c=class extends t{constructor(e){super(e),this._pointerCaptures=new Map,this._nameToGroup={},this._handlers=[],this._currentPropagation=null,this._updateDependenciesAfterPropagation=!1,this._sourceEvents=new Set,this._keyModifiers=new Set,this._activeKeyModifiers=new Set,this._stoppedPropagationEventIds=new Set,this.primaryKey=l,this._latestPointerType="mouse",this._propertiesPool=new a({latestPointerLocation:P},this),this.latestPointerLocation=null,this.test={timestamp:void 0,hasCurrentPropagation:()=>!!this._currentPropagation}}initialize(){this.eventSource.onEventReceived=this._onEventReceived.bind(this),this._installRecognizers()}destroy(){const e=Object.keys(this._nameToGroup);for(const t of e)this.uninstallHandlers(t);this.eventSource.destroy(),this._currentPropagation=null,this._propertiesPool.destroy()}get hasPendingInputs(){return this._handlers.some((e=>e.handler.hasPendingInputs))}get latestPointerType(){return this._latestPointerType}get multiTouchActive(){return this._multiTouchHandler.multiTouchActive}installHandlers(e,t,i=g.INTERNAL){if(this._nameToGroup[e])return void r.getLogger(this.declaredClass).error("There is already an InputHandler group registered under the name `"+e+"`");if(0===t.length)return void r.getLogger(this.declaredClass).error("Can't register a group of zero handlers");const n={name:e,handlers:t.map((e=>({handler:e,active:!0,removed:!1,priorityIndex:0,groupPriority:i,eventCallback:null,uninstallCallback:null})))};this._nameToGroup[e]=n;for(let r=n.handlers.length-1;r>=0;r--){const e=n.handlers[r];this._handlers.push(e),e.handler.onInstall({updateDependencies:()=>{this.updateDependencies()},emit:(t,r,i,n,s)=>{this._emitInputEvent(e.priorityIndex+1,t,r,i,s,n)},setPointerCapture:(t,r)=>{this._setPointerCapture(n,e,t,r)},setEventCallback:t=>{e.eventCallback=t},setUninstallCallback:t=>{e.uninstallCallback=t},refreshHasPendingInputs:()=>{this.notifyChange("hasPendingInputs")}})}this.updateDependencies()}uninstallHandlers(e){const t=this._nameToGroup[e];t?(t.handlers.forEach((e=>{e.removed=!0,e.uninstallCallback()})),delete this._nameToGroup[e],this._currentPropagation?this._currentPropagation.needsHandlerGarbageCollect=!0:this._garbageCollectRemovedHandlers()):r.getLogger(this.declaredClass).error("There is no InputHandler group registered under the name `"+e+"`")}hasHandlers(e){return void 0!==this._nameToGroup[e]}updateDependencies(){if(this._currentPropagation)return void(this._updateDependenciesAfterPropagation=!0);this._updateDependenciesAfterPropagation=!1;const e=new Set,t=new Set;this._handlersPriority=[];for(let r=this._handlers.length-1;r>=0;r--){const e=this._handlers[r];e.priorityIndex=r,this._handlersPriority.push(e)}this._handlersPriority=this._sortHandlersPriority(this._handlersPriority);for(let r=this._handlersPriority.length-1;r>=0;r--){const i=this._handlersPriority[r];i.priorityIndex=r;let n=i.handler.hasSideEffects;if(!n)for(const t of i.handler.outgoingEventTypes)if(e.has(t)){n=!0;break}if(n)for(const r of i.handler.incomingEventMatches){e.add(r.eventType);for(const e of r.keyModifiers)h(e)||t.add(e)}i.active=n}this._sourceEvents=e,this._keyModifiers=t,this._pointerCaptures.size>0&&this._sourceEvents.add("pointer-capture-lost"),this._keyModifiers.size>0&&(this._sourceEvents.add("key-down"),this._sourceEvents.add("key-up")),this.eventSource&&(this.eventSource.activeEvents=this._sourceEvents)}_setLatestPointer(e,t,r){this._latestPointerType=e;const n=this._get("latestPointerLocation");if(i(n)||n.x!==t||n.y!==r){const e=this._propertiesPool.get("latestPointerLocation");e.x=t,e.y=r,this._set("latestPointerLocation",e)}}_onEventReceived(e,t){if("pointer-capture-lost"===e){const e=t;this._pointerCaptures.delete(e.native.pointerId)}this._updateKeyModifiers(e,t);const r=null!=this.test.timestamp?this.test.timestamp:t.native?t.native.timestamp:void 0,i=t.native?t.native.cancelable:void 0;this._emitInputEventFromSource(e,t,r,i)}_updateKeyModifiers(e,t){if(!t)return;let r=!1;const i=()=>{if(!r){const e=new Set;this._activeKeyModifiers.forEach((t=>{e.add(t)})),this._activeKeyModifiers=e,r=!0}},n=(e,t)=>{t&&!this._activeKeyModifiers.has(e)?(i(),this._activeKeyModifiers.add(e)):!t&&this._activeKeyModifiers.has(e)&&(i(),this._activeKeyModifiers.delete(e))};if("key-down"===e||"key-up"===e){const r=t.key;this._keyModifiers.has(r)&&n(r,"key-down"===e)}const s=t.native;n("Alt",!(!s||!s.altKey)),n("Ctrl",!(!s||!s.ctrlKey)),n("Shift",!(!s||!s.shiftKey)),n("Meta",!(!s||!s.metaKey)),n("Primary",this._activeKeyModifiers.has(this.primaryKey))}_installRecognizers(){this._latestPointerHandler=new p(((e,t,r)=>this._setLatestPointer(e,t,r))),this._multiTouchHandler=new d,this.installHandlers("input-manager-logic",[this._latestPointerHandler,this._multiTouchHandler],g.ALWAYS),this.recognizers.length>0&&this.installHandlers("default",this.recognizers,g.INTERNAL)}_setPointerCapture(e,t,r,i){const n=e.name+"-"+t.priorityIndex,s=this._pointerCaptures.get(r.pointerId)||new Set;this._pointerCaptures.set(r.pointerId,s),i?(s.add(n),1===s.size&&this.eventSource&&this.eventSource.setPointerCapture(r,!0)):s.has(n)&&(s.delete(n),0===s.size&&(this._pointerCaptures.delete(r.pointerId),this.eventSource&&this.eventSource.setPointerCapture(r,!1)))}_garbageCollectRemovedHandlers(){this._handlers=this._handlers.filter((e=>!e.removed)),this.updateDependencies()}_emitInputEventFromSource(e,t,r,i){this._emitInputEvent(0,e,t,r,i)}_emitInputEvent(e,t,r,i,n,s){const o=void 0!==i?i:this._currentPropagation?this._currentPropagation.timestamp:performance.now(),a=void 0!==n&&n,l={event:new u(t,r,o,s||this._activeKeyModifiers,a),priorityIndex:e};this._currentPropagation?this._currentPropagation.events.push(l):this._doNewPropagation(l)}_doNewPropagation(e){this._currentPropagation={events:new n,currentHandler:null,needsHandlerGarbageCollect:!1,timestamp:e.event.timestamp},this._currentPropagation.events.push(e),this._continuePropagation()}_continuePropagation(){const e=this._currentPropagation;if(e){for(;this._currentPropagation.events.length>0;){const{event:t,priorityIndex:r}=this._currentPropagation.events.pop(),i=t.data&&t.data.eventId;if(!(null!=i&&this._stoppedPropagationEventIds.has(i)))for(e.currentHandler=this._handlersPriority[r];e.currentHandler;){if(e.currentHandler.removed)e.needsHandlerGarbageCollect=!0;else{if(e.currentHandler.active&&!t.shouldStopPropagation()&&e.currentHandler.eventCallback(t),t.shouldStopPropagation()){null!=i&&this._stoppedPropagationEventIds.add(i);break}if(t.shouldPausePropagation((()=>this._continuePropagation())))return void this._pausePropagation({event:t,priorityIndex:e.currentHandler.priorityIndex+1})}e.currentHandler=this._handlersPriority[e.currentHandler.priorityIndex+1]}}e.needsHandlerGarbageCollect&&this._garbageCollectRemovedHandlers(),this.hasPendingInputs||this._stoppedPropagationEventIds.clear(),this._currentPropagation=null,this._updateDependenciesAfterPropagation&&this.updateDependencies()}}_pausePropagation(e){const t=new n;for(t.push(e);this._currentPropagation.events.length;)t.push(this._currentPropagation.events.pop());this._currentPropagation.events=t,this._currentPropagation.currentHandler=null}_compareHandlerPriority(e,t){if(e.handler.hasSideEffects!==t.handler.hasSideEffects)return e.handler.hasSideEffects?1:-1;if(e.groupPriority!==t.groupPriority)return e.groupPriority>t.groupPriority?-1:1;for(const r of e.handler.incomingEventMatches)for(const e of t.handler.incomingEventMatches){if(r.eventType!==e.eventType)continue;const t=r.keyModifiers.filter((t=>e.keyModifiers.includes(t)));if(t.length===r.keyModifiers.length!==(t.length===e.keyModifiers.length))return r.keyModifiers.length>e.keyModifiers.length?-1:1}return e.priorityIndex>t.priorityIndex?-1:1}_sortHandlersPriority(e){const t=[];for(const r of e){let e=0;for(;e<t.length&&this._compareHandlerPriority(r,t[e])>=0;)e++;t.splice(e,0,r)}return t}get debug(){const e=e=>{const t=this._setPointerCapture;this._setPointerCapture=()=>{},e(),this._setPointerCapture=t};return{injectEvent:(t,r)=>{e((()=>{this._onEventReceived(t,r)}))},disablePointerCapture:e}}};e([s({readOnly:!0})],c.prototype,"hasPendingInputs",null),e([s({constructOnly:!0})],c.prototype,"eventSource",void 0),e([s({constructOnly:!0})],c.prototype,"recognizers",void 0),e([s()],c.prototype,"_latestPointerType",void 0),e([s()],c.prototype,"latestPointerType",null),e([s()],c.prototype,"multiTouchActive",null),e([s({readOnly:!0})],c.prototype,"latestPointerLocation",void 0),c=e([o("esri.views.input.InputManager")],c);class u{constructor(e,t,r,i,n){this.type=e,this.data=t,this.timestamp=r,this.modifiers=i,this.cancelable=n,this._propagationState=_.NONE,this._resumeCallback=null}stopPropagation(){this._propagationState|=_.STOPPED}shouldStopPropagation(){return 0!=(this._propagationState&_.STOPPED)}async(e){this._propagationState|=_.PAUSED;const t=(e,t)=>{this._propagationState&=~_.PAUSED;const r=this._resumeCallback;if(this._resumeCallback=null,r&&r(),t)throw e;return e};return("function"==typeof e?e():e).then((e=>t(e,!1)),(e=>t(e,!0)))}shouldPausePropagation(e){return!!(this._propagationState&_.PAUSED)&&(this._resumeCallback=e,!0)}preventDefault(){this.data.native.preventDefault()}}var _;!function(e){e[e.NONE=0]="NONE",e[e.STOPPED=1]="STOPPED",e[e.PAUSED=2]="PAUSED"}(_||(_={}));const g={ALWAYS:1,DEFAULT:0,TOOL:-1,WIDGET:-2,INTERNAL:-3};class P{}export{c as InputManager,g as ViewEventPriorities};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{InputHandler as t}from"../InputHandler.js";class s extends t{constructor(t){super(!0),this._onChange=t,this._value="mouse",this._x=null,this._y=null,this.registerIncoming("pointer-move",(t=>{const s="touch"===t.
|
|
5
|
+
import{InputHandler as t}from"../InputHandler.js";class s extends t{constructor(t){super(!0),this._onChange=t,this._value="mouse",this._x=null,this._y=null,this.registerIncoming("pointer-move",(t=>{this._update(t.data)}))}_update(t){const s="touch"===t.native.pointerType?"touch":"mouse",{x:e,y:i}=t;s===this._value&&this._x===e&&this._y===i||(this._value=s,this._x=e,this._y=i,this._onChange(s,e,i))}}export{s as LatestPointer};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{ObservableValue as t}from"../../../core/accessorSupport/tracking/ObservableValue.js";import{InputHandler as e}from"../InputHandler.js";class i extends e{constructor(){super(!0),this._activeTouchPointerIds=new Set,this._multiTouchActive=new t(!1),this._onPointerAdd=({data:t})=>{"touch"===t.pointerType&&(this._activeTouchPointerIds.add(t.native.pointerId),this._update())},this._onPointerRemove=({data:t})=>{"touch"===t.pointerType&&(this._activeTouchPointerIds.delete(t.native.pointerId),this._update())},this.registerIncoming("pointer-down",this._onPointerAdd),this.registerIncoming("pointer-up",this._onPointerRemove),this.registerIncoming("pointer-capture-lost",this._onPointerRemove),this.registerIncoming("pointer-cancel",this._onPointerRemove)}get multiTouchActive(){return this._multiTouchActive.get()}_update(){this._multiTouchActive.set(this._activeTouchPointerIds.size>1)}}export{i as MultiTouch};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{deg2rad as t}from"../../../../core/mathUtils.js";import{isSome as i,isNone as e}from"../../../../core/maybe.js";import{a as s,f as n,h as r}from"../../../../chunks/vec2.js";import{a as h}from"../../../../chunks/vec2f64.js";import{r as a,e as o,o as _,f as c,n as l,a as p,g,z as d,c as f}from"../../../../chunks/vec3.js";import{c as m,f as u}from"../../../../chunks/vec3f64.js";import{create as D,fromPositionAndNormal as E,signedDistance as x,copy as b,
|
|
5
|
+
import{deg2rad as t}from"../../../../core/mathUtils.js";import{isSome as i,isNone as e}from"../../../../core/maybe.js";import{a as s,f as n,h as r}from"../../../../chunks/vec2.js";import{a as h}from"../../../../chunks/vec2f64.js";import{r as a,e as o,o as _,f as c,n as l,a as p,g,z as d,c as f}from"../../../../chunks/vec3.js";import{c as m,f as u}from"../../../../chunks/vec3f64.js";import{create as D,fromPositionAndNormal as E,signedDistance as x,copy as b,normal as I,intersectLine as V}from"../../../../geometry/support/plane.js";import{angle as M,projectPointSignedLength as N}from"../../../../geometry/support/vector.js";import{intersectLineAndRay as y,LineType as P}from"../../../support/geometry2dUtils.js";class X{constructor(t,i,e,s=0,n=Z.IMMEDIATE){this._helper=t,this._planeType=i,this._edge=e,this.distance=s,this._plane=D(),this._offsetPlane=D(),this._minDistance=-1/0,this._maxDistance=1/0,n===Z.IMMEDIATE&&this._initialize()}get plane(){return this._plane}get requiresSplitEdgeLeft(){return!this._left.isOriginalDirection}get requiresSplitEdgeRight(){return!this._right.isOriginalDirection}get edgeDirection(){return this._edgeDirection}_initialize(){this._initializeNeighbors(),this._initializePlane(),this._initializeDistanceConstraints()}_initializeNeighbors(){const t=this._toXYZ(this._edge.leftVertex.pos),i=this._toXYZ(this._edge.leftVertex.leftEdge?.leftVertex?.pos),e=this._toXYZ(this._edge.rightVertex.pos),s=this._toXYZ(this._edge.rightVertex.rightEdge?.rightVertex?.pos);this._edgeDirection=a(m(),t,e),this._left=this._computeNeighbor(t,i,this._edgeDirection),this._right=this._computeNeighbor(e,s,this._edgeDirection)}_toXYZ(t){return i(t)?this._helper.toXYZ(t):null}_computeNeighbor(t,i,s){if(e(i))return{start:t,end:i,direction:u(-s[1],s[0],0),isOriginalDirection:!0};const n=a(m(),t,i),r=!this._passesBisectingAngleThreshold(n,s);return{start:t,end:i,direction:r?this._bisectVectorsPerpendicular(s,n):n,isOriginalDirection:!r}}_passesBisectingAngleThreshold(t,i){const e=Math.abs(M(i,t));return e>=Y&&e<=Math.PI-Y}_bisectVectorsPerpendicular(t,i){const e=o(t,i)<0?t:_(m(),t),s=Math.abs(o(e,i));if(!(s<.001||s>.999))return this._bisectDirection(e,i);const n=c(m(),e,[0,0,1]);return l(n,n)}_bisectDirection(t,i){const e=p(m(),t,i);return l(e,e)}_initializePlane(){const t=this._computeNormalDirection(this._left),i=this._computeNormalDirection(this._right);o(t,i)<0&&_(i,i),E(this._left.start,this._bisectDirection(t,i),this._plane)}_computeNormalDirection(t){const i=c(m(),t.direction,this._edgeDirection);l(i,i);const e=c(m(),this._edgeDirection,i);return this._planeType===T.XY&&(e[2]=0),l(e,e)}_initializeDistanceConstraints(){i(this._left.end)&&!this.requiresSplitEdgeLeft&&this._updateDistanceConstraint(x(this._plane,this._left.end)),i(this._right.end)&&!this.requiresSplitEdgeRight&&this._updateDistanceConstraint(x(this._plane,this._right.end)),this._updateIntersectDistanceConstraint(this._plane)}_updateDistanceConstraint(t){t<=0&&(this._minDistance=Math.max(this._minDistance,t)),t>=0&&(this._maxDistance=Math.min(this._maxDistance,t))}_updateIntersectDistanceConstraint(t){const i=I(t),e=this._edgeDirection,a=p(m(),this._left.start,this._left.direction),o=p(m(),this._right.start,this._right.direction),_=this._pointInBasis2D(h(),i,e,this._left.start),c=this._pointInBasis2D(h(),i,e,a),l=this._pointInBasis2D(h(),i,e,this._right.start),d=this._pointInBasis2D(h(),i,e,o),[f]=y({start:c,end:_,type:P.LINE},{start:d,end:l,type:P.LINE});if(!f)return;const u=s(h(),_,c);n(u,u);const D=s(h(),f,c),E=r(u,D),b=p(m(),a,g(m(),this._left.direction,-E)),V=x(t,b);this._updateDistanceConstraint(V)}_pointInBasis2D(t,i,e,s){return t[0]=N(i,s),t[1]=N(e,s),t}_offset(t,e){Number.isFinite(this._minDistance)&&(e=Math.max(this._minDistance,e)),Number.isFinite(this._maxDistance)&&(e=Math.min(this._maxDistance,e)),b(this._offsetPlane,this._plane),this._offsetPlane[3]-=e;const s=(t,e,s)=>i(e)&&V(this._offsetPlane,t,p(m(),t,e),s),n=m();(t===this._edge.leftVertex?s(this._left.start,this._left.direction,n):s(this._right.start,this._right.direction,n))&&this._helper.copy(this._helper.fromXYZ(n,void 0,this._helper.getM(t.pos)),t.pos)}signedDistanceToPoint(t){return x(this.plane,this._helper.toXYZ(this._helper.pointToVector(t)))}apply(t){this._offset(t,this.distance)}undo(t){this._offset(t,0)}canAccumulate(t){return t instanceof X&&this._edge.leftVertex.index===t._edge.leftVertex.index&&this._edge.rightVertex.index===t._edge.rightVertex.index&&this._edge.component===t._edge.component&&this._maybeEqualsVec3(this._left.direction,t._left.direction)&&this._maybeEqualsVec3(this._right.direction,t._right.direction)&&d(I(this._plane),I(t._plane))}accumulate(t,i){const e=this._plane[3]-i._plane[3]+i.distance;this._offset(t,e)}accumulateParams(t){const i=t.distance-t._plane[3];this.distance=i+this._plane[3]}clone(){const t=new X(this._helper,this._planeType,this._edge,this.distance,Z.DEFERRED);return b(t._plane,this._plane),b(t._offsetPlane,this._offsetPlane),t._maxDistance=this._maxDistance,t._minDistance=this._minDistance,t._left=this._cloneNeighbor(this._left),t._right=this._cloneNeighbor(this._right),t._edgeDirection=f(m(),this._edgeDirection),t}_maybeEqualsVec3(t,s){return e(t)&&e(s)||i(t)&&i(s)&&d(t,s)}_cloneNeighbor({start:t,end:e,direction:s,isOriginalDirection:n}){return{start:f(m(),t),end:i(e)?f(m(),e):null,direction:f(m(),s),isOriginalDirection:n}}}const Y=t(15);var T,Z;!function(t){t[t.XYZ=0]="XYZ",t[t.XY=1]="XY"}(T||(T={})),function(t){t[t.IMMEDIATE=0]="IMMEDIATE",t[t.DEFERRED=1]="DEFERRED"}(Z||(Z={}));export{X as OffsetEdgeVertex,T as PlaneType};
|