@arcgis/core 4.24.0-next.20220508 → 4.24.0-next.20220511
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/AggregateGraphic.js +1 -1
- package/analysis/Analysis.js +1 -1
- package/analysis/DimensioningAnalysis.js +1 -1
- package/analysis/LengthDimension.d.ts +4 -0
- package/analysis/LengthDimension.js +5 -0
- package/analysis/dimensionUtils.js +5 -0
- package/arcade/Dictionary.js +1 -1
- package/arcade/Feature.js +1 -1
- package/arcade/arcade.js +1 -1
- package/arcade/arcadeAsyncRuntime.js +1 -1
- package/arcade/arcadeCompiler.js +1 -1
- package/arcade/credentials.js +1 -1
- package/arcade/featureSetCollection.js +1 -1
- package/arcade/featureSetUtils.js +1 -1
- package/arcade/featureset/actions/Adapted.js +1 -1
- package/arcade/featureset/actions/AttributeFilter.js +1 -1
- package/arcade/featureset/actions/GroupBy.js +1 -1
- package/arcade/featureset/actions/OrderBy.js +1 -1
- package/arcade/featureset/actions/SpatialFilter.js +1 -1
- package/arcade/featureset/actions/Top.js +1 -1
- package/arcade/featureset/sources/Empty.js +1 -1
- package/arcade/featureset/sources/FeatureLayerDynamic.js +1 -1
- package/arcade/featureset/sources/FeatureLayerMemory.js +1 -1
- package/arcade/featureset/sources/FeatureLayerRelated.js +1 -1
- package/arcade/featureset/support/FeatureSet.js +1 -1
- package/arcade/featureset/support/FeatureSetIterator.js +1 -1
- package/arcade/featureset/support/shared.js +1 -1
- package/arcade/featureset/support/stats.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/arcade/functions/featuresetgeom.js +1 -1
- package/arcade/functions/featuresetstats.js +1 -1
- package/arcade/functions/featuresetstring.js +1 -1
- package/arcade/functions/geomasync.js +1 -1
- package/arcade/languageUtils.js +1 -1
- package/arcade/request.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0564f1cfa3d17ff1aad3.js +1 -0
- package/assets/esri/core/workers/chunks/0806d5d706a864542bfb.js +1 -0
- package/assets/esri/core/workers/chunks/0a6977144ea1abf96fbf.js +1 -0
- package/assets/esri/core/workers/chunks/13387f56acbc3291561a.js +1 -0
- package/assets/esri/core/workers/chunks/16c4e0a32d50d4db984d.js +1 -0
- package/assets/esri/core/workers/chunks/{076d1b1101b59af0d389.js → 1c010202b4c7e1d15f23.js} +1 -1
- package/assets/esri/core/workers/chunks/26827ec144676e6385f8.js +1 -0
- package/assets/esri/core/workers/chunks/287c484fd40eee643f3a.js +1 -0
- package/assets/esri/core/workers/chunks/5210f0b42dba27945226.js +1 -0
- package/assets/esri/core/workers/chunks/{db6c5b3b4efe8d804f9c.js → 52478ee2d2a1354b6900.js} +1 -1
- package/assets/esri/core/workers/chunks/5759af97f96f24c40105.js +1 -0
- package/assets/esri/core/workers/chunks/{b85218d44c6094b7e5e6.js → 6d7e2a23a0a5dd9ded1d.js} +1 -1
- package/assets/esri/core/workers/chunks/70b6356357e7640c4e8b.js +1 -0
- package/assets/esri/core/workers/chunks/7574316b3af61c389e8f.js +1 -0
- package/assets/esri/core/workers/chunks/7bc828fbdd54c0b28aac.js +1 -0
- package/assets/esri/core/workers/chunks/7e5c22b5a32ac74b1b6e.js +1 -0
- package/assets/esri/core/workers/chunks/8102bb78fe96e6197e4e.js +1 -0
- package/assets/esri/core/workers/chunks/88384e7cafbfd2348598.js +1 -0
- package/assets/esri/core/workers/chunks/9d7533aaeac3b8d145c4.js +1 -0
- package/assets/esri/core/workers/chunks/{1eecae5227318f491263.js → 9f4d892abf55e8625bc9.js} +3 -3
- package/assets/esri/core/workers/chunks/{98607a0da63626cc4614.js → a054a52712a118c6d505.js} +1 -1
- package/assets/esri/core/workers/chunks/{69a20e4d9e28c3e599fc.js → a3bb600bfcb0282622f1.js} +1 -1
- package/assets/esri/core/workers/chunks/aa49841b14c6e6df2a07.js +1 -0
- package/assets/esri/core/workers/chunks/b089058b64db3912478f.js +1 -0
- package/assets/esri/core/workers/chunks/b28539c5a6bedb71b038.js +1 -0
- package/assets/esri/core/workers/chunks/b4f171db73355c6f766e.js +1 -0
- package/assets/esri/core/workers/chunks/b7572b0921b23aef8b9d.js +1 -0
- package/assets/esri/core/workers/chunks/b758f3c419edc2306784.js +1 -0
- package/assets/esri/core/workers/chunks/c3e7290fb128d4fefd44.js +1 -0
- package/assets/esri/core/workers/chunks/c51c9b5da855f84b9a48.js +1 -0
- package/assets/esri/core/workers/chunks/c66ac36da6392b6bf331.js +1 -0
- package/assets/esri/core/workers/chunks/d16b328d32a6ddc2fdb9.js +1 -0
- package/assets/esri/core/workers/chunks/d94c5f36d52cf71f0bb9.js +1 -0
- package/assets/esri/core/workers/chunks/db937849b2c1af87b481.js +1 -0
- package/assets/esri/core/workers/chunks/{66cd99e91dad60c5274c.js → dc3ed59f450283d97a19.js} +1 -1
- package/assets/esri/core/workers/chunks/dcd0653191cd4a1ccaae.js +2 -0
- package/assets/esri/core/workers/chunks/{31df729c17470245288c.js.LICENSE.txt → dcd0653191cd4a1ccaae.js.LICENSE.txt} +2 -2
- package/assets/esri/core/workers/chunks/e4fdd1eaf987977d0a51.js +1 -0
- package/assets/esri/core/workers/chunks/e51f0e71f2a55af604d3.js +1 -0
- package/assets/esri/core/workers/chunks/eb3855d3753d6b8334bd.js +1 -0
- package/assets/esri/core/workers/chunks/{7c290763920f52a1f504.js → eeed138930a4a805691d.js} +1 -1
- package/assets/esri/core/workers/chunks/f435dc615fdc8917f6ca.js +1 -0
- package/assets/esri/core/workers/chunks/{d5c5b9f7f5401f36a3a5.js → f7f3dde4c8f9c687cc1e.js} +1 -1
- package/assets/esri/core/workers/chunks/fc6beaf9466ea3898549.js +1 -0
- package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
- package/assets/esri/themes/base/widgets/_Tooltip.scss +1 -0
- package/assets/esri/themes/base/widgets/_Weather.scss +1 -2
- 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/BlendLayers.glsl.js +6 -6
- package/chunks/arcade.js +1 -1
- package/chunks/array.js +1 -1
- package/chunks/languageUtils.js +1 -1
- package/config.js +1 -1
- package/core/sql/StandardizedFunctions.js +1 -1
- package/geohash/GeohashTree.js +1 -1
- package/geometry/support/contains.js +1 -1
- package/geometry/support/heightModelInfoUtils.js +1 -1
- package/geometry/support/intersects.js +1 -1
- package/geometry/support/intersectsBase.js +1 -1
- package/geometry/support/normalizeUtilsCommon.js +1 -1
- package/geometry/support/spatialReferenceUtils.js +1 -1
- package/interfaces.d.ts +685 -37
- package/layers/MediaLayer.d.ts +4 -0
- package/layers/MediaLayer.js +5 -0
- package/layers/VoxelLayer.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +5 -0
- package/layers/graphics/OptimizedGeometry.js +1 -1
- package/layers/graphics/data/BoundsStore.js +1 -1
- package/layers/support/CornersGeoreference.d.ts +4 -0
- package/layers/support/CornersGeoreference.js +5 -0
- package/layers/support/ExtentAndRotationGeoreference.d.ts +4 -0
- package/layers/support/ExtentAndRotationGeoreference.js +5 -0
- package/layers/support/FeatureReduction.js +1 -1
- package/layers/support/FeatureReductionBinning.js +5 -0
- package/layers/support/GeoreferenceBase.js +5 -0
- package/layers/support/ImageElement.d.ts +4 -0
- package/layers/support/ImageElement.js +5 -0
- package/layers/support/LocalMediaElementSource.d.ts +4 -0
- package/layers/support/LocalMediaElementSource.js +5 -0
- package/layers/support/MediaElementBase.d.ts +4 -0
- package/layers/support/MediaElementBase.js +5 -0
- package/layers/support/RouteStopSymbols.d.ts +4 -0
- package/layers/support/RouteSymbols.d.ts +4 -0
- package/layers/support/VoxelFormat.d.ts +4 -0
- package/layers/support/VoxelStyle.d.ts +4 -0
- package/layers/support/VoxelVariable.d.ts +4 -0
- package/layers/support/VoxelVolume.d.ts +4 -0
- package/layers/support/VoxelVolumeStyle.d.ts +4 -0
- package/layers/support/arcgisLayerUrl.js +1 -1
- package/layers/support/featureReductionUtils.js +1 -1
- package/layers/support/fieldUtils.js +1 -1
- package/layers/support/rasterFormats/Lerc.js +1 -1
- package/package.json +3 -3
- package/request.js +1 -1
- package/support/requestUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/Font.js +1 -1
- package/symbols/support/textUtils.js +1 -1
- package/views/2d/engine/brushes.js +1 -1
- package/views/2d/engine/webgl/FeatureTile.js +1 -1
- package/views/2d/engine/webgl/Overlay.js +5 -0
- package/views/2d/engine/webgl/OverlayContainer.js +5 -0
- package/views/2d/engine/webgl/brushes/BrushOverlay.js +5 -0
- package/views/2d/engine/webgl/collisions/CollisionEngine.js +1 -1
- package/views/2d/engine/webgl/shaders/OverlayPrograms.js +5 -0
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layerViewModuleImportUtils.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/ImageryTileLayerView2D.js +1 -1
- package/views/2d/layers/MapImageLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +5 -0
- package/views/2d/layers/StreamLayerView2D.js +1 -1
- package/views/2d/layers/WMTSLayerView2D.js +1 -1
- package/views/2d/layers/features/FeatureStore2D.js +1 -1
- package/views/2d/layers/features/Pipeline.js +1 -1
- package/views/2d/layers/features/Store2D.js +1 -1
- package/views/2d/layers/features/controllers/FeatureController2D.js +1 -1
- package/views/2d/layers/features/processors/SymbolProcessor.js +1 -1
- package/views/2d/layers/features/schemaUtils.js +1 -1
- package/views/2d/layers/features/sources/GeoEventSource.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/BinStore.js +5 -0
- package/views/2d/layers/features/support/ClusterStore.js +1 -1
- package/views/2d/layers/features/tileRenderers/support/WGLFeatureView.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/2d/layers/support/clusterUtils.js +1 -1
- package/views/2d/magnifier/MagnifierView2D.js +1 -1
- package/views/2d/navigation/actions/Pinch.js +1 -1
- package/views/2d/viewpointUtils.js +1 -1
- package/views/3d/analysis/AnalysisView3D.js +1 -1
- package/views/3d/analysis/Dimensioning/DimensioningTool.js +5 -0
- package/views/3d/analysis/Dimensioning/DimensioningVisualization.js +1 -1
- package/views/3d/analysis/Dimensioning/LengthDimensionSubTool.js +5 -0
- package/views/3d/analysis/Dimensioning/{LinearDimensionVisualization.js → LengthDimensionVisualization.js} +1 -1
- package/views/3d/analysis/Dimensioning/settings.js +5 -0
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/interactive/SegmentLabels3D.js +5 -0
- package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
- package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshapeGraphic/GraphicReshapeTool.js +1 -1
- package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.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/areaMeasurement3D/AreaMeasurement3DView.js +1 -1
- package/views/3d/interactive/visualElements/LabelVisualElement.js +1 -1
- package/views/3d/layerViewModuleImportUtils.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +5 -0
- package/views/3d/layers/VoxelLayerView3D.js +1 -1
- package/views/3d/layers/i3s/IDBCache.js +1 -1
- package/views/3d/state/controllers/RotateController.js +1 -1
- package/views/3d/state/controllers/local/PinchAndPanController.js +1 -1
- package/views/3d/state/controllers/local/ZoomController.js +1 -1
- package/views/3d/state/controllers/local/ZoomStepController.js +1 -1
- package/views/3d/support/ResourceController.js +1 -1
- package/views/3d/support/sunUtils.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/TileCompositor.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/core/shaderLibrary/util/BlendLayers.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/materials/WaterGLMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
- package/views/DOMContainer.js +1 -1
- package/views/GroundView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/ToolViewManager.js +1 -1
- package/views/View.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/interactive/GraphicManipulator.js +1 -1
- package/views/interactive/InteractiveToolBase.js +1 -1
- package/views/interactive/SegmentLabels.js +5 -0
- package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
- package/views/interactive/snapping/LineSnapper.js +1 -1
- package/views/interactive/snapping/ParallelLineSnapper.js +1 -1
- package/views/interactive/snapping/RightAngleSnapper.js +1 -1
- package/views/interactive/snapping/RightAngleTriangleSnapper.js +1 -1
- package/views/interactive/snapping/SnappingAlgorithm.js +1 -1
- package/views/interactive/snapping/SnappingManager.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceSnappingSourceWorker.js +1 -1
- package/views/interactive/snapping/snappingUtils.js +1 -1
- package/views/interactive/support/viewUtils.js +5 -0
- package/views/interactive/tooltip/DrawPointTooltipInfo.js +5 -0
- package/views/interactive/tooltip/DrawPolygonTooltipInfo.js +5 -0
- package/views/interactive/tooltip/DrawPolylineTooltipInfo.js +5 -0
- package/views/interactive/tooltip/Tooltip.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
- package/views/interactive/tooltip/support/measurements.js +5 -0
- package/views/layers/FeatureLayerView.js +1 -1
- package/views/layers/GroupLayerView.js +1 -1
- package/views/overlay/TextOverlayItem.js +1 -1
- package/views/support/Scheduler.js +1 -1
- package/views/support/screenUtils.js +1 -1
- package/webscene/Slide.js +1 -1
- package/widgets/Attribution/AttributionViewModel.js +1 -1
- package/widgets/Bookmarks.js +1 -1
- package/widgets/CoordinateConversion/CoordinateConversionViewModel.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/UpdateWorkflow.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/ElevationProfile/support/chartUtils.js +1 -1
- package/widgets/ElevationProfile.js +1 -1
- package/widgets/Feature/FeatureAttachments.js +1 -1
- package/widgets/Feature/FeatureContent/FeatureContentViewModel.js +1 -1
- package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
- package/widgets/Feature/FeatureExpression.js +1 -1
- package/widgets/Feature/FeatureFields.js +1 -1
- package/widgets/Feature/FeatureViewModel.js +1 -1
- package/widgets/Feature.js +1 -1
- package/widgets/FeatureForm/InputFieldGroup.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable/FieldColumn.js +1 -1
- package/widgets/FeatureTable/Grid/Column.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +11 -11
- package/widgets/FeatureTable/Grid/support/ButtonMenu.js +1 -1
- package/widgets/FeatureTemplates/FeatureTemplatesViewModel.js +1 -1
- package/widgets/FeatureTemplates/TemplateItem.js +1 -1
- package/widgets/FeatureTemplates.js +1 -1
- package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
- package/widgets/FloorFilter.js +1 -1
- package/widgets/HistogramRangeSlider.js +1 -1
- package/widgets/LayerList/LayerListViewModel.js +1 -1
- package/widgets/LayerList/ListItem.js +1 -1
- package/widgets/LayerList/ListItemPanel.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/Legend/LegendViewModel.js +1 -1
- package/widgets/Legend/styles/Card.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/widgets/Legend.js +1 -1
- package/widgets/LineOfSight/LineOfSightViewModel.js +1 -1
- package/widgets/Measurement.js +1 -1
- package/widgets/NavigationToggle/NavigationToggleViewModel.js +1 -1
- package/widgets/Popup/PopupViewModel.js +1 -1
- package/widgets/Popup.js +1 -1
- package/widgets/Print/FileLink.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/ScaleBar.js +1 -1
- package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
- package/widgets/ScaleRangeSlider.js +1 -1
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/Search.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/TableList/ListItem.js +1 -1
- package/widgets/Weather/LabeledSlider.js +1 -1
- package/widgets/Weather/VisibleElements.js +5 -0
- package/widgets/Weather/css.js +1 -1
- package/widgets/Weather.js +1 -1
- package/widgets/support/AnalysisViewModel.js +1 -1
- package/widgets/support/InteractiveAnalysisViewModel.js +1 -1
- package/analysis/LinearDimension.d.ts +0 -4
- package/analysis/LinearDimension.js +0 -5
- package/assets/esri/core/workers/chunks/0018053ac16a09feba70.js +0 -1
- package/assets/esri/core/workers/chunks/042938ca73f0b9e5a7e2.js +0 -1
- package/assets/esri/core/workers/chunks/048645611caa28dca7cd.js +0 -1
- package/assets/esri/core/workers/chunks/0b72d123386dc4ec7538.js +0 -1
- package/assets/esri/core/workers/chunks/13b04d5bf348ab5054c2.js +0 -1
- package/assets/esri/core/workers/chunks/215007e7c44811d90777.js +0 -1
- package/assets/esri/core/workers/chunks/31df729c17470245288c.js +0 -2
- package/assets/esri/core/workers/chunks/36272141b3c33cb19026.js +0 -1
- package/assets/esri/core/workers/chunks/36c8e8de9c3f67d32572.js +0 -1
- package/assets/esri/core/workers/chunks/37c428489c59df4b597b.js +0 -1
- package/assets/esri/core/workers/chunks/493169fd978fd543ef3b.js +0 -1
- package/assets/esri/core/workers/chunks/4f378ad6f4299183df85.js +0 -1
- package/assets/esri/core/workers/chunks/58e4c6ce1580427e7b55.js +0 -1
- package/assets/esri/core/workers/chunks/6c5441da675a8af35be2.js +0 -1
- package/assets/esri/core/workers/chunks/6ea16f6a0df946de480b.js +0 -1
- package/assets/esri/core/workers/chunks/7dfd70f4fa1096e56641.js +0 -1
- package/assets/esri/core/workers/chunks/88193e61072d7bf957f5.js +0 -1
- package/assets/esri/core/workers/chunks/8ccbde593c86c872e525.js +0 -1
- package/assets/esri/core/workers/chunks/9c6be39f1f21ab8b1c2d.js +0 -1
- package/assets/esri/core/workers/chunks/a73795cce722ba15b3da.js +0 -1
- package/assets/esri/core/workers/chunks/a8ed1a938dc164b401d9.js +0 -1
- package/assets/esri/core/workers/chunks/a9a73bc4875a5aeaf1b9.js +0 -1
- package/assets/esri/core/workers/chunks/adcc5bce6c0971c1b592.js +0 -1
- package/assets/esri/core/workers/chunks/afddfe620e6539991e6b.js +0 -1
- package/assets/esri/core/workers/chunks/b340c9bdabdb37995c8f.js +0 -1
- package/assets/esri/core/workers/chunks/b4c23630d6c85f7b59c0.js +0 -1
- package/assets/esri/core/workers/chunks/c180c40838246985479d.js +0 -1
- package/assets/esri/core/workers/chunks/caed2365bd296fcc8a75.js +0 -1
- package/assets/esri/core/workers/chunks/d85b5b73a151c6fbb658.js +0 -1
- package/assets/esri/core/workers/chunks/da6261673c3e1537b6a6.js +0 -1
- package/assets/esri/core/workers/chunks/dafe120243db6648a4ab.js +0 -1
- package/assets/esri/core/workers/chunks/ec6d138e8183e193f977.js +0 -1
- package/assets/esri/core/workers/chunks/ed4519ac9533a4d340f1.js +0 -1
- package/assets/esri/core/workers/chunks/f206300eef4560611728.js +0 -1
- package/assets/esri/core/workers/chunks/f55cbaf5a1d6ee6ac171.js +0 -1
- package/layers/GeoreferencedImageLayer.d.ts +0 -4
- package/layers/GeoreferencedImageLayer.js +0 -5
- package/layers/VoxelWasmManager.js +0 -5
- package/layers/VoxelWasmPerScene.js +0 -5
- package/views/3d/interactive/measurementTools/support/viewUtils.js +0 -5
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.24/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 a from"../core/Collection.js";import s from"../core/CollectionFlattener.js";import o from"../core/Error.js";import n from"../core/Evented.js";import{HandleOwnerMixin as l}from"../core/HandleOwner.js";import{makeHandle as p}from"../core/handleUtils.js";import d from"../core/Loadable.js";import h from"../core/Logger.js";import{isSome as y,destroyMaybe as c,abortMaybe as u}from"../core/maybe.js";import{EsriPromiseMixin as m}from"../core/Promise.js";import{createTask as f,after as g}from"../core/promiseUtils.js";import{whenOnce as w,watch as v,when as M}from"../core/reactiveUtils.js";import{aliasOf as V}from"../core/accessorSupport/decorators/aliasOf.js";import"../core/arrayUtils.js";import"../core/has.js";import"../core/accessorSupport/ensureType.js";import{property as R}from"../core/accessorSupport/decorators/property.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 O from"../geometry/SpatialReference.js";import{equals as L}from"../geometry/support/spatialReferenceUtils.js";import{AnalysesCollection as E}from"../support/AnalysesCollection.js";import{GraphicsCollection as b}from"../support/GraphicsCollection.js";import{BasemapView as C}from"./BasemapView.js";import x from"./LayerViewManager.js";import I from"./Magnifier.js";import q from"./ToolViewManager.js";import D from"./input/Input.js";import{ViewEvents as T}from"./input/ViewEvents.js";import k from"./navigation/Navigation.js";import{DefaultsFromMap as z}from"./support/DefaultsFromMap.js";var P;const U=h.getLogger("esri.views.View");let W=P=class extends(l(n.EventedMixin(m(r)))){constructor(e){super(e),this._userSpatialReference=null,this._cursor=null,this.allLayerViews=new s({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 a,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 D,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 T(this),this.persistableViewModels=new a,this._isValid=!1,this._readyCycleForced=!1,this.handles.add(this.watch("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.layerViewManager?.clear(),this.toolViewManager?.detach(),y(this.analysisViewManager)&&this.analysisViewManager.detach(),this._teardown()):e&&!this.ready&&(y(this.analysisViewManager)&&this.analysisViewManager.attach(),this._startup(),this.toolViewManager.attach())}),!0))}initialize(){this.addResolvingPromise(this.validate().then((()=>(this._isValid=!0,w((()=>this.ready)))))),this.basemapView=new C({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 q({view:this}),this._setupSpatialReferenceLogger(),this.handles.add([v((()=>this.initialExtentRequired),(e=>this.defaultsFromMap.required={...this.defaultsFromMap.required,extent:e}),{sync:!0,initial:!0}),v((()=>this.ready),(e=>{this.defaultsFromMap&&(this.defaultsFromMap.suspended=e,this.defaultsFromMap.userSpatialReference=e?this.spatialReference:this._userSpatialReference)}),{sync:!0}),v((()=>this._userSpatialReference),(e=>{this.defaultsFromMap&&(this.defaultsFromMap.userSpatialReference=e)}),{sync:!0,initial:!0})])}_setupSpatialReferenceLogger(){let e=null;this.handles.add([v((()=>this.defaultsFromMap?.ready),(t=>{const i=this.map?.allLayers.length>0;if(t&&!this.spatialReference&&i){if(y(e))return;const t=p((()=>e=u(e)));e=f((async t=>{try{await g(this.spatialReferenceWarningDelay,null,t)}catch{return}finally{e=null}U.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),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 U.error("#toMap()","Not implemented on this instance of View"),null}get _defaultsFromMapSettings(){return{}}get defaultsFromMap(){return new z({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||d.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&&(U.warn("#map","The provided map is already destroyed",{map:e}),e=null),d.isLoadable(e)&&e.load().catch((()=>{})),this.initialized&&(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=!L(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 y(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 o("importLayerView() not implemented")}hasLayerViewModule(e){return!1}async validate(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{constraints:null}}_validateSpatialReference(e){return y(this.getSpatialReferenceSupport({spatialReference:e}))}when(e,t){return this.isResolved()&&!this.ready&&U.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 a,e([R()],W.prototype,"_userSpatialReference",void 0),e([V("toolViewManager.activeTool")],W.prototype,"activeTool",void 0),e([R({readOnly:!0})],W.prototype,"allLayerViews",void 0),e([R()],W.prototype,"groundView",void 0),e([R()],W.prototype,"animation",void 0),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",void 0),e([R(S(b,"graphics"))],W.prototype,"graphics",void 0),e([R(S(E,"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",void 0),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:a,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:O})],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([V("toolViewManager.tools")],W.prototype,"tools",void 0),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:k,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 A=W;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 a from"../core/Collection.js";import s from"../core/CollectionFlattener.js";import o from"../core/Error.js";import n from"../core/Evented.js";import{HandleOwnerMixin as l}from"../core/HandleOwner.js";import{makeHandle as p}from"../core/handleUtils.js";import d from"../core/Loadable.js";import h from"../core/Logger.js";import{destroyMaybe as y,isSome as c,abortMaybe as u}from"../core/maybe.js";import{EsriPromiseMixin as m}from"../core/Promise.js";import{createTask as f,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 O from"../geometry/HeightModelInfo.js";import L from"../geometry/SpatialReference.js";import{equals as E}from"../geometry/support/spatialReferenceUtils.js";import{AnalysesCollection as b}from"../support/AnalysesCollection.js";import{GraphicsCollection as C}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 k}from"./input/ViewEvents.js";import z from"./navigation/Navigation.js";import{DefaultsFromMap as P}from"./support/DefaultsFromMap.js";var U;const W=h.getLogger("esri.views.View");let A=U=class extends(l(n.EventedMixin(m(r)))){constructor(e){super(e),this._userSpatialReference=null,this._cursor=null,this.allLayerViews=new s({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 C,this.analyses=new b,this.navigating=!1,this.typeSpecificPreconditionsReady=!0,this.layerViews=new a,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 z,this.layerViewManager=null,this.analysisViewManager=null,this.isHeightModelInfoRequired=!1,this.width=null,this.height=null,this.resizing=!1,this.suspended=!1,this.viewEvents=new k(this),this.persistableViewModels=new a,this._isValid=!1,this._readyCycleForced=!1,this.handles.add(w((()=>this.preconditionsReady),(e=>{e?(this._currentSpatialReference=this.spatialReference,U.views.add(this)):(this._currentSpatialReference=null,U.views.remove(this)),this.notifyChange("spatialReference"),!e&&this.ready?(this.layerViewManager?.clear(),this.toolViewManager?.detach(),c(this.analysisViewManager)&&this.analysisViewManager.detach(),this._teardown()):e&&!this.ready&&(c(this.analysisViewManager)&&this.analysisViewManager.attach(),this._startup(),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(c(e))return;const t=p((()=>e=u(e)));e=f((async t=>{try{await g(this.spatialReferenceWarningDelay,null,t)}catch{return}finally{e=null}W.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=y(this.graphics),this.analyses=y(this.analyses),this.handles.remove("defaultsFromMap"),this.defaultsFromMap.destroy(),this._set("defaultsFromMap",null),this.toolViewManager=y(this.toolViewManager),this.layerViewManager=y(this.layerViewManager),this.basemapView=y(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 W.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||d.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&&(W.warn("#map","The provided map is already destroyed",{map:e}),e=null),d.isLoadable(e)&&e.load().catch((()=>{})),this.initialized&&(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=!E(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 c(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 o("importLayerView() not implemented")}hasLayerViewModule(e){return!1}async validate(){}invalidate(){this._isValid=!1}getSpatialReferenceSupport(){return{constraints:null}}_validateSpatialReference(e){return c(this.getSpatialReferenceSupport({spatialReference:e}))}when(e,t){return this.isResolved()&&!this.ready&&W.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}};A.views=new a,e([_()],A.prototype,"_userSpatialReference",void 0),e([R("toolViewManager.activeTool")],A.prototype,"activeTool",void 0),e([_({readOnly:!0})],A.prototype,"allLayerViews",void 0),e([_()],A.prototype,"groundView",void 0),e([_()],A.prototype,"animation",void 0),e([_()],A.prototype,"basemapView",void 0),e([_({readOnly:!0})],A.prototype,"_defaultsFromMapSettings",null),e([_()],A.prototype,"defaultsFromMap",null),e([_()],A.prototype,"fatalError",void 0),e([_({type:F})],A.prototype,"extent",void 0),e([_(j(C,"graphics"))],A.prototype,"graphics",void 0),e([_(j(b,"analyses"))],A.prototype,"analyses",void 0),e([_({readOnly:!0,type:O})],A.prototype,"heightModelInfo",null),e([_({readOnly:!0})],A.prototype,"interacting",null),e([_({readOnly:!0})],A.prototype,"navigating",void 0),e([_({readOnly:!0,dependsOn:["fatalError","_isValid","_readyCycleForced","map","map.loaded?","width","height","spatialReference","_currentSpatialReference","defaultsFromMap.ready","typeSpecificPreconditionsReady"]})],A.prototype,"preconditionsReady",null),e([_({readOnly:!0})],A.prototype,"typeSpecificPreconditionsReady",void 0),e([_({type:a,readOnly:!0})],A.prototype,"layerViews",void 0),e([_({type:q})],A.prototype,"magnifier",void 0),e([_({value:null,type:t})],A.prototype,"map",null),e([_()],A.prototype,"padding",void 0),e([_({readOnly:!0})],A.prototype,"ready",void 0),e([_({type:L})],A.prototype,"spatialReference",null),e([_()],A.prototype,"spatialReferenceWarningDelay",void 0),e([_()],A.prototype,"stationary",null),e([_({readOnly:!0})],A.prototype,"supportsGround",void 0),e([_({type:i})],A.prototype,"timeExtent",void 0),e([R("toolViewManager.tools")],A.prototype,"tools",void 0),e([_()],A.prototype,"toolViewManager",void 0),e([_({readOnly:!0})],A.prototype,"type",void 0),e([_({type:Number})],A.prototype,"scale",void 0),e([_({readOnly:!0})],A.prototype,"updating",void 0),e([_({readOnly:!0})],A.prototype,"initialExtentRequired",void 0),e([_({readOnly:!0})],A.prototype,"initialExtent",null),e([_()],A.prototype,"cursor",null),e([_({readOnly:!0})],A.prototype,"input",void 0),e([_({type:z,nonNullable:!0})],A.prototype,"navigation",void 0),e([_()],A.prototype,"layerViewManager",void 0),e([_()],A.prototype,"analysisViewManager",void 0),e([_()],A.prototype,"width",void 0),e([_()],A.prototype,"height",void 0),e([_({readOnly:!0})],A.prototype,"resizing",void 0),e([_({value:null,readOnly:!0})],A.prototype,"size",null),e([_({readOnly:!0})],A.prototype,"suspended",void 0),e([_({readOnly:!0})],A.prototype,"viewEvents",void 0),e([_({readOnly:!0})],A.prototype,"persistableViewModels",void 0),e([_()],A.prototype,"_isValid",void 0),e([_()],A.prototype,"_readyCycleForced",void 0),e([_()],A.prototype,"_currentSpatialReference",void 0),A=U=e([S("esri.views.View")],A);const G=A;export{G 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.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Evented.js";import{HandleOwner as i}from"../../core/HandleOwner.js";import{clone as r}from"../../core/lang.js";import{isNone as n,destroyMaybe as o,removeMaybe as s,isSome as a,abortMaybe as p}from"../../core/maybe.js";import{debounce as h,ignoreAbortErrors as c}from"../../core/promiseUtils.js";import{createScreenPoint as d}from"../../core/screenUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as g}from"../../core/accessorSupport/decorators/subclass.js";import{pointEquals as m}from"../../layers/graphics/dehydratedFeatureComparison.js";import{ViewingMode as u}from"../ViewingMode.js";import{defaultDrawingMode as _}from"./DrawingMode.js";import{DrawManipulator as y}from"./DrawManipulator.js";import{createCoordinateHelper as v}from"../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as x}from"../interactive/dragEventPipeline.js";import{EditGeometry as f,Component as V}from"../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as S}from"../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as T}from"../interactive/snapping/SnappingContext.js";import{SnappingPipeline as b}from"../interactive/snapping/SnappingDragPipelineStep.js";import{TaskPriority as M,ImmediateTask as w}from"../support/Scheduler.js";let C=class extends(t.EventedMixin(i)){constructor(e){super(e),this._createOperationCompleted=!1,this._pointerDownStates=new Set,this._snappingPipeline=new b,this._snappingAbortController=null,this._stagedVertex=null,this.snapToSceneEnabled=null,this._snap=h((async({snappingManager:e,mapPoint:t,context:i},r)=>{const n=await this._frameTask.schedule((()=>e.snap(t,i,r)),r);n.valid&&await this._frameTask.schedule((()=>{this.stagedVertex=n.apply(),t!==this._snapMapPoint&&(this.stagedVertex=e.update(this._snapMapPoint,i))}),r)})),n(e.elevationInfo)&&(this.elevationInfo={mode:e.hasZ?"absolute-height":"on-the-ground",offset:0})}initialize(){const{geometryType:e,view:t}=this,i="3d"===t.type?t?.resourceController?.scheduler:null;this._frameTask=i?i.registerTask(M.SNAPPING):w;const{spatialReference:r}=t,n="viewingMode"in t.state?t.state.viewingMode:u.Local,o="segment"===e||"multipoint"===e?"polyline":e;this.coordinateHelper=v(this.hasZ,this.hasM,r),this._editGeometryOperations=new S(new f(o,this.coordinateHelper,n)),this._activeComponent=new V(r,n),this._editGeometryOperations.data.components.push(this._activeComponent),this.handles.add(this._editGeometryOperations.on(["vertex-add","vertex-update","vertex-remove"],(e=>{const t=e.vertices.map((e=>({componentIndex:0,vertexIndex:e.index,coordinates:this.coordinateHelper.vectorToArray(e.pos)}))),i=t.map((e=>e.coordinates));switch(e.type){case"vertex-add":this.emit(e.type,{...e,added:i,vertices:t});break;case"vertex-update":this.emit(e.type,{...e,updated:i,vertices:t});break;case"vertex-remove":this.emit(e.type,{...e,removed:i,vertices:t})}}))),this._manipulator=new y({grabbableForEvent:e=>"click"!==this.drawingMode||"touch"===e.pointerType&&this._snappingEnabled&&1===this._pointerDownStates.size}),this.manipulators.add(this._manipulator),this._manipulator.grabbable="point"!==e,this.handles.add([this._createManipulatorDragPipeline(this._manipulator),this._manipulator.events.on("immediate-click",(e=>this._onImmediateClick(e))),this._manipulator.events.on("immediate-double-click",(e=>this._onImmediateDoubleClick(e)))])}destroy(){this._editGeometryOperations=o(this._editGeometryOperations),this._frameTask=s(this._frameTask)}get _snappingEnabled(){return a(this.snappingManager)&&this.snappingManager.options.effectiveEnabled}get canRedo(){return this._editGeometryOperations.canRedo}get canUndo(){return this._editGeometryOperations.canUndo}get committedVertices(){return this._activeComponent.vertices.map((e=>this.coordinateHelper.vectorToArray(e.pos)))}set drawingMode(e){this._set("drawingMode",e??_)}get hasStagedVertex(){return a(this._stagedVertex)}get interactive(){return this._manipulator.interactive}set interactive(e){this._manipulator.interactive=e}get isCompleted(){return this._createOperationCompleted}get numCommittedVertices(){return this._activeComponent.vertices.length}get numVertices(){return a(this._stagedVertex)?this._activeComponent.vertices.length+1:this._activeComponent.vertices.length}get stagedVertex(){return this._stagedVertex}set stagedVertex(e){if(n(e))this.discardStagedVertex();else{if(n(this._stagedVertex))this._stagedVertex=r(e);else{if(m(this._stagedVertex,e))return;this._stagedVertex.x=e.x,this._stagedVertex.y=e.y,this._stagedVertex.z=e.z,this._stagedVertex.m=e.m,this._stagedVertex.hasZ=e.hasZ,this._stagedVertex.hasM=e.hasM,this._stagedVertex.spatialReference=e.spatialReference}this.emit("cursor-update",{updated:null,vertices:[{componentIndex:0,vertexIndex:this._activeComponent.vertices.length,coordinates:this.coordinateHelper.pointToArray(e)}],operation:"apply",type:"vertex-update"})}}get updating(){return this.updatingHandles.updating}get vertices(){const e=this.committedVertices;return a(this._stagedVertex)&&e.push(this.coordinateHelper.pointToArray(this._stagedVertex)),e}cancel(){this.complete({aborted:!0})}commitStagedVertex(){if(this._snappingAbortController=p(this._snappingAbortController),a(this._stagedVertex)){const e=this._stagedVertex;this._stagedVertex=null,this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(e))}}complete(e){const t=e&&e.aborted||!1;this._snappingAbortController=p(this._snappingAbortController),a(this.snappingManager)&&this.snappingManager.doneSnapping(),"segment"===this.geometryType||"point"===this.geometryType?this.commitStagedVertex():this.discardStagedVertex();const i="multipoint"===this.geometryType&&0===this.numVertices||"polyline"===this.geometryType&&this.numVertices<2||"polygon"===this.geometryType&&this.numVertices<3;this._createOperationCompleted=!i,(this.isCompleted||t)&&this.emit("complete",{vertices:this.vertices.map(((e,t)=>({componentIndex:0,vertexIndex:t,coordinates:e}))),aborted:t,type:"complete"})}discardStagedVertex(){this._stagedVertex=null}onInputEvent(e){switch(e.type){case"pointer-down":this._pointerDownStates.add(e.pointerId);break;case"pointer-up":this._pointerDownStates.delete(e.pointerId)}switch(e.type){case"pointer-move":return this._onPointerMove(e);case"hold":return this._onHold(e)}}redo(){this._editGeometryOperations.redo()}undo(){a(this.snappingManager)&&this.snappingManager.doneSnapping(),this._editGeometryOperations.undo()}_closeOnClickVertexIndex(e){const t=this._activeComponent;if("polygon"===this.geometryType&&t.vertices.length>2){if(this._vertexWithinPointerDistance(t.vertices[0].pos,e))return 0;if(this._vertexWithinPointerDistance(t.vertices[t.vertices.length-1].pos,e))return t.vertices.length-1}return null}_createManipulatorDragPipeline(e){switch(this.drawingMode){case"click":return this._createManipulatorDragPipelineClick(e);case"freehand":return this._createManipulatorDragPipelineFreehand(e);case"hybrid":return this._createManipulatorDragPipelineHybrid(e)}}_createManipulatorDragPipelineClick(e){return x(e,((e,t,i,r)=>{const n="touch"===r&&this._snappingEnabled;!this.isCompleted&&n&&(t.next(this._screenToMapDragEventStep()).next((e=>("start"===e.action&&(this.stagedVertex=e.mapStart,("segment"===this.geometryType||n&&0===this.numVertices)&&this.commitStagedVertex()),e))).next(this._snappingPipeline.createSnapDragEventPipelineStep({predicate:()=>n,cancel:i,snappingManager:this.snappingManager,snappingContext:new T({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:r,visualizer:this.snappingVisualizer}),updatingHandles:this.updatingHandles}),this._snappingPipeline.next).next((e=>(n&&(this.stagedVertex=e.mapEnd,"end"===e.action&&this.commitStagedVertex()),e))).next((e=>("end"===e.action&&("segment"!==this.geometryType&&"point"!==this.geometryType||this.complete()),e))),i.next((()=>{n&&a(this.snappingManager)&&this.snappingManager.doneSnapping()})))}))}_createManipulatorDragPipelineFreehand(e){return x(e,((e,t)=>{this.isCompleted||t.next(this._screenToMapDragEventStep()).next((e=>("start"===e.action&&(n(this.stagedVertex)&&(this.stagedVertex=e.mapStart),"segment"===this.geometryType&&this.commitStagedVertex()),e))).next((e=>{switch(e.action){case"start":case"update":this.stagedVertex=e.mapEnd,"polygon"!==this.geometryType&&"polyline"!==this.geometryType||this.commitStagedVertex();break;case"end":this.complete()}return e}))}))}_createManipulatorDragPipelineHybrid(e){return x(e,((e,t)=>{this.isCompleted||t.next(this._screenToMapDragEventStep()).next((e=>("start"===e.action&&(n(this.stagedVertex)&&(this.stagedVertex=e.mapStart),this.commitStagedVertex()),e))).next((e=>{switch(e.action){case"start":case"update":this.stagedVertex=e.mapEnd,"polygon"!==this.geometryType&&"polyline"!==this.geometryType||this.commitStagedVertex();break;case"end":"segment"!==this.geometryType&&"point"!==this.geometryType||this.complete()}return e}))}))}_getDrawSurface(){if(n(this.elevationDrawSurface))return this.drawSurface;if(!this.coordinateHelper.hasZ)return this.elevationDrawSurface.defaultZ=null,this.elevationDrawSurface;let e=this.defaultZ,t=!1;a(this.elevationInfo)&&"absolute-height"===this.elevationInfo.mode&&(t=!0),a(this.snapToSceneEnabled)&&(t=this.snapToSceneEnabled),a(this.elevationInfo)&&"on-the-ground"===this.elevationInfo.mode&&(t=!1);const i=this._activeComponent.vertices.length;return("segment"===this.geometryType||"polygon"===this.geometryType)&&i>0&&(e=this.coordinateHelper.getZ(this._activeComponent.vertices[0].pos),t=!1),t?this.drawSurface:(this.elevationDrawSurface.defaultZ=e,this.elevationDrawSurface)}_mapToScreen(e){return this._getDrawSurface().mapToScreen(e)}_onHold(e){this._snappingAbortController=p(this._snappingAbortController),"click"===this.drawingMode&&"touch"===e.pointerType&&this._snappingEnabled&&(this.stagedVertex=e.mapPoint),e.stopPropagation()}_onImmediateClick(e){if("mouse"===e.pointerType&&2===e.button||this._manipulator.dragging)return;const t=this._activeComponent,i=this._closeOnClickVertexIndex(e.screenPoint);if(a(i))return e.stopPropagation(),void this.complete();const r=this._screenToMap(e.screenPoint);if(a(r))switch(this.drawingMode){case"freehand":"point"===this.geometryType&&(this.hasStagedVertex?this.commitStagedVertex():this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(r)),this.complete());break;case"click":case"hybrid":this._snappingAbortController=p(this._snappingAbortController),this.hasStagedVertex?this.commitStagedVertex():this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(r)),("point"===this.geometryType||"segment"===this.geometryType&&2===t.vertices.length||"segment"===this.geometryType&&"hybrid"===this.drawingMode&&1===t.vertices.length)&&this.complete()}e.stopPropagation()}_onImmediateDoubleClick(e){this._manipulator.dragging||"point"===this.geometryType||(this.complete(),e.stopPropagation())}_onPointerMove(e){if(this._manipulator.dragging||this._pointerDownStates.has(e.pointerId)||this._manipulator.grabbing||!this._manipulator.interactive)return void(this._snappingAbortController=p(this._snappingAbortController));e.stopPropagation();const t=d(e.x,e.y),i=this._closeOnClickVertexIndex(t);if(a(i))return this._closeOnVertex(i),void(this._snappingAbortController=p(this._snappingAbortController));const r=this._screenToMap(t);if(this._manipulator.cursor=a(r)?"crosshair":null,n(r))return void(this._snappingAbortController=p(this._snappingAbortController));if(n(this.snappingManager))return this.stagedVertex=r,void(this._snappingAbortController=p(this._snappingAbortController));const o=this.snappingManager,s=new T({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:e.pointerType,visualizer:this.snappingVisualizer});this.stagedVertex=o.update(r,s),this._snapMapPoint=r,n(this._snappingAbortController)&&(this._snappingAbortController=new AbortController),this.updatingHandles.addPromise(c(this._snap({snappingManager:o,mapPoint:r,context:s},this._snappingAbortController.signal)))}_closeOnVertex(e){this.discardStagedVertex();const t={componentIndex:0,vertexIndex:e,coordinates:this.coordinateHelper.vectorToArray(this._activeComponent.vertices[e].pos)};this.emit("cursor-update",{updated:null,vertices:[t],operation:"apply",type:"vertex-update"})}_screenToMap(e){return this._getDrawSurface().screenToMap(e)}_screenToMapDragEventStep(){let e=null;return t=>{if("start"===t.action&&(e=this._screenToMap(t.screenStart)),n(e))return null;const i=this._screenToMap(t.screenEnd);return a(i)?{...t,mapStart:e,mapEnd:i}:null}}_vertexWithinPointerDistance(e,t){const i=25,r=this._mapToScreen(this.coordinateHelper.vectorToDehydratedPoint(e));return!!a(r)&&O(r,t,i)}};function O(e,t,i){const r=e.x-t.x,n=e.y-t.y;return r*r+n*n<=i}e([l()],C.prototype,"defaultZ",void 0),e([l({value:_})],C.prototype,"drawingMode",null),e([l({constructOnly:!0})],C.prototype,"elevationDrawSurface",void 0),e([l({constructOnly:!0})],C.prototype,"elevationInfo",void 0),e([l({constructOnly:!0})],C.prototype,"geometryType",void 0),e([l({constructOnly:!0})],C.prototype,"hasM",void 0),e([l({constructOnly:!0})],C.prototype,"hasZ",void 0),e([l({constructOnly:!0})],C.prototype,"manipulators",void 0),e([l({constructOnly:!0})],C.prototype,"drawSurface",void 0),e([l({constructOnly:!0})],C.prototype,"snappingManager",void 0),e([l({constructOnly:!0})],C.prototype,"snappingVisualizer",void 0),e([l()],C.prototype,"snapToSceneEnabled",void 0),e([l({readOnly:!0})],C.prototype,"updating",null),e([l({constructOnly:!0})],C.prototype,"view",void 0),C=e([g("esri.views.draw.DrawOperation")],C);export{C as DrawOperation};
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Evented.js";import{HandleOwner as i}from"../../core/HandleOwner.js";import{clone as o}from"../../core/lang.js";import{isNone as n,isSome as r,destroyMaybe as s,removeMaybe as a,abortMaybe as p,unwrap as l,unwrapOr as h,applySome as c}from"../../core/maybe.js";import{debounce as d,ignoreAbortErrors as g}from"../../core/promiseUtils.js";import{createLength as m,createArea as u}from"../../core/quantityUtils.js";import{watch as _,syncAndInitial as y,initial as v}from"../../core/reactiveUtils.js";import{createScreenPoint as x}from"../../core/screenUtils.js";import{property as f}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as T}from"../../core/accessorSupport/decorators/subclass.js";import{pointEquals as V}from"../../layers/graphics/dehydratedFeatureComparison.js";import{ViewingMode as w}from"../ViewingMode.js";import{defaultDrawingMode as b}from"./DrawingMode.js";import{DrawManipulator as S}from"./DrawManipulator.js";import{createCoordinateHelper as C}from"../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as M}from"../interactive/dragEventPipeline.js";import{EditGeometry as D,Component as O}from"../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as I}from"../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as P}from"../interactive/snapping/SnappingContext.js";import{SnappingPipeline as k}from"../interactive/snapping/SnappingDragPipelineStep.js";import{DrawPointTooltipInfo as A}from"../interactive/tooltip/DrawPointTooltipInfo.js";import{DrawPolygonTooltipInfo as E}from"../interactive/tooltip/DrawPolygonTooltipInfo.js";import{DrawPolylineTooltipInfo as j}from"../interactive/tooltip/DrawPolylineTooltipInfo.js";import{Tooltip as G}from"../interactive/tooltip/Tooltip.js";import{TooltipOptions as H}from"../interactive/tooltip/TooltipOptions.js";import{computeAreaWithStagedVertex as L,computeLengthWithStagedVertex as Z}from"../interactive/tooltip/support/measurements.js";import{TaskPriority as z,ImmediateTask as U}from"../support/Scheduler.js";let R=class extends(e.EventedMixin(i)){constructor(t){super(t),this._createOperationCompleted=!1,this._pointerDownStates=new Set,this._snappingPipeline=new k,this._snappingAbortController=null,this._tooltip=null,this._tooltipContext={calculateElevation:null,calculateTotalLength:null,calculateArea:null},this._stagedVertex=null,this.snapToSceneEnabled=null,this.tooltipOptions=new H,this._snap=d((async({snappingManager:t,mapPoint:e,context:i},o)=>{const n=await this._frameTask.schedule((()=>t.snap(e,i,o)),o);n.valid&&await this._frameTask.schedule((()=>{this.stagedVertex=n.apply(),e!==this._snapMapPoint&&(this.stagedVertex=t.update(this._snapMapPoint,i))}),o)})),n(t.elevationInfo)&&(this.elevationInfo={mode:t.hasZ?"absolute-height":"on-the-ground",offset:0})}initialize(){const{geometryType:t,view:e}=this,i="3d"===e.type?e?.resourceController?.scheduler:null;this._frameTask=i?i.registerTask(z.SNAPPING):U;const{spatialReference:o}=e,n="viewingMode"in e.state?e.state.viewingMode:w.Local,a="segment"===t||"multipoint"===t?"polyline":t;this.coordinateHelper=C(this.hasZ,this.hasM,o),this._editGeometryOperations=new I(new D(a,this.coordinateHelper,n)),this._activeComponent=new O(o,n),this._editGeometryOperations.data.components.push(this._activeComponent);const p=this.segmentLabels;r(p)&&(p.context={view:e,editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo},this.handles.add([_((()=>!0===c(this.tooltipOptions,(t=>t.show))),(t=>{p.visible=t}),y),this.on("cursor-update",(()=>{const t=this._activeComponent.getLastVertex(),e=this._stagedVertex;p.stagedEdge=r(t)&&r(e)?[t.pos,this.coordinateHelper.pointToVector(e)]:null}))])),this.handles.add(this._editGeometryOperations.on(["vertex-add","vertex-update","vertex-remove"],(t=>{const e=t.vertices.map((t=>({componentIndex:0,vertexIndex:t.index,coordinates:this.coordinateHelper.vectorToArray(t.pos)}))),i=e.map((t=>t.coordinates));switch(t.type){case"vertex-add":this.emit(t.type,{...t,added:i,vertices:e});break;case"vertex-update":this.emit(t.type,{...t,updated:i,vertices:e});break;case"vertex-remove":this.emit(t.type,{...t,removed:i,vertices:e})}}))),this._manipulator=new S({grabbableForEvent:t=>"click"!==this.drawingMode||"touch"===t.pointerType&&this._snappingEnabled&&1===this._pointerDownStates.size}),this.manipulators.add(this._manipulator),this._manipulator.grabbable="point"!==t,this.handles.add([this._createManipulatorDragPipeline(this._manipulator),this._manipulator.events.on("immediate-click",(t=>this._onImmediateClick(t))),this._manipulator.events.on("immediate-double-click",(t=>this._onImmediateDoubleClick(t))),_((()=>this.tooltipOptions.show),(t=>{this._tooltip=t?new G({view:e,info:this._getTooltipInfo()}):s(this._tooltip)}),v)])}destroy(){s(this.segmentLabels),this._editGeometryOperations=s(this._editGeometryOperations),this._frameTask=a(this._frameTask),this._tooltip=s(this._tooltip)}get _snappingEnabled(){return r(this.snappingManager)&&this.snappingManager.options.effectiveEnabled}get canRedo(){return this._editGeometryOperations.canRedo}get canUndo(){return this._editGeometryOperations.canUndo}get committedVertices(){return this._activeComponent.vertices.map((t=>this.coordinateHelper.vectorToArray(t.pos)))}set drawingMode(t){this._set("drawingMode",t??b)}get hasStagedVertex(){return r(this._stagedVertex)}get interactive(){return this._manipulator.interactive}set interactive(t){this._manipulator.interactive=t}get isCompleted(){return this._createOperationCompleted}get numCommittedVertices(){return this._activeComponent.vertices.length}get numVertices(){return r(this._stagedVertex)?this._activeComponent.vertices.length+1:this._activeComponent.vertices.length}get stagedVertex(){return this._stagedVertex}set stagedVertex(t){if(n(t))this.discardStagedVertex();else{if(n(this._stagedVertex))this._stagedVertex=o(t);else{if(V(this._stagedVertex,t))return;this._stagedVertex.x=t.x,this._stagedVertex.y=t.y,this._stagedVertex.z=t.z,this._stagedVertex.m=t.m,this._stagedVertex.hasZ=t.hasZ,this._stagedVertex.hasM=t.hasM,this._stagedVertex.spatialReference=t.spatialReference}this.emit("cursor-update",{updated:null,vertices:[{componentIndex:0,vertexIndex:this._activeComponent.vertices.length,coordinates:this.coordinateHelper.pointToArray(t)}],operation:"apply",type:"vertex-update"})}}get updating(){return this.updatingHandles.updating}get vertices(){const t=this.committedVertices;return r(this._stagedVertex)&&t.push(this.coordinateHelper.pointToArray(this._stagedVertex)),t}cancel(){this.complete({aborted:!0})}commitStagedVertex(){if(this._snappingAbortController=p(this._snappingAbortController),r(this._stagedVertex)){const t=this._stagedVertex;this._stagedVertex=null,this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(t))}}complete(t){const e=t&&t.aborted||!1;this._snappingAbortController=p(this._snappingAbortController),r(this.snappingManager)&&this.snappingManager.doneSnapping(),"segment"===this.geometryType||"point"===this.geometryType?this.commitStagedVertex():this.discardStagedVertex();const i="multipoint"===this.geometryType&&0===this.numVertices||"polyline"===this.geometryType&&this.numVertices<2||"polygon"===this.geometryType&&this.numVertices<3;this._createOperationCompleted=!i,(this.isCompleted||e)&&this.emit("complete",{vertices:this.vertices.map(((t,e)=>({componentIndex:0,vertexIndex:e,coordinates:t}))),aborted:e,type:"complete"})}discardStagedVertex(){this._stagedVertex=null}onInputEvent(t){switch(t.type){case"pointer-down":this._pointerDownStates.add(t.pointerId);break;case"pointer-up":this._pointerDownStates.delete(t.pointerId)}switch(t.type){case"pointer-move":return this._onPointerMove(t);case"hold":return this._onHold(t)}}redo(){this._editGeometryOperations.redo()}undo(){r(this.snappingManager)&&this.snappingManager.doneSnapping(),this._editGeometryOperations.undo()}_closeOnClickVertexIndex(t){const e=this._activeComponent;if("polygon"===this.geometryType&&e.vertices.length>2){if(this._vertexWithinPointerDistance(e.vertices[0].pos,t))return 0;if(this._vertexWithinPointerDistance(e.vertices[e.vertices.length-1].pos,t))return e.vertices.length-1}return null}_createManipulatorDragPipeline(t){switch(l(this.drawingMode)){case"click":return this._createManipulatorDragPipelineClick(t);case"freehand":return this._createManipulatorDragPipelineFreehand(t);case"hybrid":return this._createManipulatorDragPipelineHybrid(t)}}_createManipulatorDragPipelineClick(t){return M(t,((t,e,i,o)=>{const n="touch"===o&&this._snappingEnabled;!this.isCompleted&&n&&(e.next(this._screenToMapDragEventStep()).next((t=>("start"===t.action&&(this.stagedVertex=t.mapStart,("segment"===this.geometryType||n&&0===this.numVertices)&&this.commitStagedVertex()),t))).next(this._snappingPipeline.createSnapDragEventPipelineStep({predicate:()=>n,cancel:i,snappingManager:this.snappingManager,snappingContext:new P({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:o,visualizer:this.snappingVisualizer}),updatingHandles:this.updatingHandles}),this._snappingPipeline.next).next((t=>(n&&(this.stagedVertex=t.mapEnd,"end"===t.action&&this.commitStagedVertex()),t))).next((t=>("end"===t.action&&("segment"!==this.geometryType&&"point"!==this.geometryType||this.complete()),t))),i.next((()=>{n&&r(this.snappingManager)&&this.snappingManager.doneSnapping()})))}))}_createManipulatorDragPipelineFreehand(t){return M(t,((t,e)=>{this.isCompleted||e.next(this._screenToMapDragEventStep()).next((t=>("start"===t.action&&(n(this.stagedVertex)&&(this.stagedVertex=t.mapStart),"segment"===this.geometryType&&this.commitStagedVertex()),t))).next((t=>{switch(t.action){case"start":case"update":this.stagedVertex=t.mapEnd,"polygon"!==this.geometryType&&"polyline"!==this.geometryType||this.commitStagedVertex();break;case"end":this.complete()}return t}))}))}_createManipulatorDragPipelineHybrid(t){return M(t,((t,e)=>{this.isCompleted||e.next(this._screenToMapDragEventStep()).next((t=>("start"===t.action&&(n(this.stagedVertex)&&(this.stagedVertex=t.mapStart),this.commitStagedVertex()),t))).next((t=>{switch(t.action){case"start":case"update":this.stagedVertex=t.mapEnd,"polygon"!==this.geometryType&&"polyline"!==this.geometryType||this.commitStagedVertex();break;case"end":"segment"!==this.geometryType&&"point"!==this.geometryType||this.complete()}return t}))}))}_getDrawSurface(){if(n(this.elevationDrawSurface))return this.drawSurface;if(!this.coordinateHelper.hasZ)return this.elevationDrawSurface.defaultZ=null,this.elevationDrawSurface;let t=this.defaultZ,e=!1;r(this.elevationInfo)&&"absolute-height"===this.elevationInfo.mode&&(e=!0),r(this.snapToSceneEnabled)&&(e=this.snapToSceneEnabled),r(this.elevationInfo)&&"on-the-ground"===this.elevationInfo.mode&&(e=!1);const i=this._activeComponent.vertices.length;return("segment"===this.geometryType||"polygon"===this.geometryType)&&i>0&&(t=this.coordinateHelper.getZ(this._activeComponent.vertices[0].pos),e=!1),e?this.drawSurface:(this.elevationDrawSurface.defaultZ=t,this.elevationDrawSurface)}_mapToScreen(t){return this._getDrawSurface().mapToScreen(t)}_onHold(t){this._snappingAbortController=p(this._snappingAbortController),"click"===this.drawingMode&&"touch"===t.pointerType&&this._snappingEnabled&&(this.stagedVertex=t.mapPoint),t.stopPropagation()}_onImmediateClick(t){if("mouse"===t.pointerType&&2===t.button||this._manipulator.dragging)return;const e=this._activeComponent,i=this._closeOnClickVertexIndex(t.screenPoint);if(r(i))return t.stopPropagation(),void this.complete();const o=this._screenToMap(t.screenPoint);if(r(o))switch(this.drawingMode){case"freehand":"point"===this.geometryType&&(this.hasStagedVertex?this.commitStagedVertex():this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(o)),this.complete());break;case"click":case"hybrid":this._snappingAbortController=p(this._snappingAbortController),this.hasStagedVertex?this.commitStagedVertex():this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(o)),("point"===this.geometryType||"segment"===this.geometryType&&2===e.vertices.length||"segment"===this.geometryType&&"hybrid"===this.drawingMode&&1===e.vertices.length)&&this.complete()}t.stopPropagation()}_onImmediateDoubleClick(t){this._manipulator.dragging||"point"===this.geometryType||(this.complete(),t.stopPropagation())}_onPointerMove(t){if(this._manipulator.dragging||this._pointerDownStates.has(t.pointerId)||this._manipulator.grabbing||!this._manipulator.interactive)return void(this._snappingAbortController=p(this._snappingAbortController));t.stopPropagation();const e=x(t.x,t.y);r(this._tooltip)&&(this._tooltip.screenPoint=e,this._updateTooltipInfo());const i=this._closeOnClickVertexIndex(e);if(r(i))return this._closeOnVertex(i),void(this._snappingAbortController=p(this._snappingAbortController));const o=this._screenToMap(e);if(this._manipulator.cursor=r(o)?"crosshair":null,n(o))return void(this._snappingAbortController=p(this._snappingAbortController));if(n(this.snappingManager))return this.stagedVertex=o,void(this._snappingAbortController=p(this._snappingAbortController));const s=this.snappingManager,a=new P({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:t.pointerType,visualizer:this.snappingVisualizer});this.stagedVertex=s.update(o,a),this._snapMapPoint=o,n(this._snappingAbortController)&&(this._snappingAbortController=new AbortController),this.updatingHandles.addPromise(g(this._snap({snappingManager:s,mapPoint:o,context:a},this._snappingAbortController.signal)))}_closeOnVertex(t){this.discardStagedVertex();const e={componentIndex:0,vertexIndex:t,coordinates:this.coordinateHelper.vectorToArray(this._activeComponent.vertices[t].pos)};this.emit("cursor-update",{updated:null,vertices:[e],operation:"apply",type:"vertex-update"})}_screenToMap(t){return this._getDrawSurface().screenToMap(t)}_screenToMapDragEventStep(){let t=null;return e=>{if("start"===e.action&&(t=this._screenToMap(e.screenStart)),n(t))return null;const i=this._screenToMap(e.screenEnd);return r(i)?{...e,mapStart:t,mapEnd:i}:null}}_vertexWithinPointerDistance(t,e){const i=25,o=this._mapToScreen(this.coordinateHelper.vectorToDehydratedPoint(t));return!!r(o)&&F(o,e,i)}_getTooltipInfo(){this._tooltipContext.calculateElevation=t=>m(r(t)&&t.hasZ?t.z:this.defaultZ,"meters");const{stagedVertex:t}=this,e=this._elevationTooltipDetail(t);switch(this.geometryType){case"point":return new A({elevation:e});case"polyline":return this._tooltipContext.calculateTotalLength=t=>Z(this._editGeometryOperations.data.geometry)(t),new j({elevation:e,totalLength:this._totalLengthTooltipDetail(t)});case"polygon":return this._tooltipContext.calculateArea=t=>L(this._editGeometryOperations.data.geometry)(t),new E({elevation:e,area:this._areaTooltipDetail(t)});default:return null}}_elevationTooltipDetail(t){return{title:"Elevation",mode:this.elevationInfo.mode,...l(this._tooltipContext.calculateElevation)(t)}}_totalLengthTooltipDetail(t){return{title:"Total Length",...h(l(this._tooltipContext.calculateTotalLength)(t),m(0,"meters"))}}_areaTooltipDetail(t){return{title:"Area",...h(l(this._tooltipContext.calculateArea)(t),u(0,"square-meters"))}}_updateTooltipInfo(){const t=this._tooltip;if(n(t))return;const{stagedVertex:e}=this,i=this._elevationTooltipDetail(e);switch(this.geometryType){case"point":t.info.elevation=i;break;case"polyline":{const o=t.info;o.elevation=i,o.totalLength=this._totalLengthTooltipDetail(e);break}case"polygon":{const o=t.info;o.elevation=i,o.area=this._areaTooltipDetail(e);break}}}};function F(t,e,i){const o=t.x-e.x,n=t.y-e.y;return o*o+n*n<=i}t([f()],R.prototype,"defaultZ",void 0),t([f({value:b})],R.prototype,"drawingMode",null),t([f({constructOnly:!0})],R.prototype,"elevationDrawSurface",void 0),t([f({constructOnly:!0})],R.prototype,"elevationInfo",void 0),t([f({constructOnly:!0})],R.prototype,"geometryType",void 0),t([f({constructOnly:!0})],R.prototype,"hasM",void 0),t([f({constructOnly:!0})],R.prototype,"hasZ",void 0),t([f({constructOnly:!0})],R.prototype,"manipulators",void 0),t([f({constructOnly:!0})],R.prototype,"drawSurface",void 0),t([f({constructOnly:!0})],R.prototype,"segmentLabels",void 0),t([f({constructOnly:!0})],R.prototype,"snappingManager",void 0),t([f({constructOnly:!0})],R.prototype,"snappingVisualizer",void 0),t([f()],R.prototype,"snapToSceneEnabled",void 0),t([f({constructOnly:!0})],R.prototype,"tooltipOptions",void 0),t([f()],R.prototype,"updating",null),t([f({constructOnly:!0})],R.prototype,"view",void 0),R=t([T("esri.views.draw.DrawOperation")],R);export{R as DrawOperation};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../Graphic.js";import i from"../../../core/Collection.js";import s from"../../../core/Error.js";import r from"../../../core/Evented.js";import o from"../../../core/Handles.js";import n from"../../../core/Logger.js";import{destroyMaybe as h,isNone as a,isSome as c,abortMaybe as p,get as l}from"../../../core/maybe.js";import{createTask as d}from"../../../core/promiseUtils.js";import{whenOnce as m,pausable as v}from"../../../core/watchUtils.js";import{property as y}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{geometryToCoordinates as g,getMidpoint as u}from"../../../geometry/support/coordsUtils.js";import x from"../../../layers/GraphicsLayer.js";import f from"../../../symbols/SimpleMarkerSymbol.js";import{ViewingMode as G}from"../../ViewingMode.js";import{SnappingVisualizer2D as b}from"../../2d/interactive/SnappingVisualizer2D.js";import{cloneMove as V}from"./drawUtils.js";import M from"./GraphicMover.js";import w from"./HighlightHelper.js";import{addUniqueLayer as S}from"./layerUtils.js";import{settings as k}from"./settings.js";import{ViewEventPriorities as E}from"../../input/InputManager.js";import{SKETCH_KEYS as I}from"../../interactive/keybindings.js";import{EditGeometryOperations as O}from"../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as C}from"../../interactive/snapping/SnappingContext.js";import R from"../../../geometry/Polyline.js";import j from"../../../geometry/Point.js";class H{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-start"}}class A{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape"}}class U{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-stop"}}class T{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move-start"}}class D{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move"}}class F{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move-stop"}}class z{constructor(e){this.added=e,this.type="vertex-select"}}class L{constructor(e){this.removed=e,this.type="vertex-deselect"}}class P{constructor(e,t,i,s){this.added=e,this.graphic=t,this.oldGraphic=i,this.vertices=s,this.type="vertex-add"}}class K{constructor(e,t,i,s){this.removed=e,this.graphic=t,this.oldGraphic=i,this.vertices=s,this.type="vertex-remove"}}const N=k.reshapeGraphics,q={vertices:{default:new f({style:"circle",size:N.vertex.size,color:N.vertex.color,outline:{color:N.vertex.outlineColor,width:1}}),hover:new f({style:"circle",size:N.vertex.hoverSize,color:N.vertex.hoverColor,outline:{color:N.vertex.hoverOutlineColor,width:1}}),selected:new f({style:"circle",size:N.selected.size,color:N.selected.color,outline:{color:N.selected.outlineColor,width:1}})},midpoints:{default:new f({style:"circle",size:N.midpoint.size,color:N.midpoint.color,outline:{color:N.midpoint.outlineColor,width:1}}),hover:new f({style:"circle",size:N.midpoint.size,color:N.midpoint.color,outline:{color:N.midpoint.outlineColor,width:1}})}},B="esri.views.draw.support.Reshape",J=n.getLogger(B);let Q=class extends r.EventedAccessor{constructor(e){super(e),this._activeOperationInfo=null,this._editGeometryOperations=null,this._handles=new o,this._graphicAttributes={esriSketchTool:"box"},this._mover=null,this._snappingTask=null,this._stagedVertex=null,this._viewHandles=new o,this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.enableMidpoints=!0,this.enableMovement=!0,this.enableVertices=!0,this.graphic=null,this.layer=null,this.midpointGraphics=new i,this.midpointSymbol=new f({style:"circle",size:6,color:[200,200,200],outline:{color:[100,100,100],width:1}}),this.selectedVertices=[],this.snappingManager=null,this.type="reshape",this.vertexGraphics=new i,this.view=null}initialize(){this._highlightHelper=new w({view:this.view}),this._setup(),this._handles.add([m(this,"view.ready",(()=>{const{layer:e,view:t}=this;S(t,e),this._viewHandles.add([t.on("key-down",(e=>this._keyDownHandler(e)),E.TOOL)])})),v(this,"graphic",(()=>this.refresh())),v(this,"layer",((e,t)=>{t&&(this._clearSelection(),this._resetGraphics(t)),this.refresh()})),v(this,"enableMidpoints",(()=>{this.refresh()}))])}destroy(){this._reset(),this._mover?.destroy(),this._mover=null,this._handles=h(this._handles),this._viewHandles=h(this._viewHandles)}set highlightsEnabled(e){this._highlightHelper?.removeAll(),this._set("highlightsEnabled",e),this._setUpHighlights()}get state(){const e=!!this.get("view.ready"),t=!(!this.get("graphic")||!this.get("layer"));return e&&t?"active":e?"ready":"disabled"}set symbols(e){const{midpoints:t=q.midpoints,vertices:i=q.vertices}=e||{};this._set("symbols",{midpoints:t,vertices:i})}isUIGraphic(e){const t=[];return this.graphic&&t.push(this.graphic),t.concat(this.vertexGraphics.items,this.midpointGraphics.items),t.length&&t.includes(e)}refresh(){this._reset(),this._setup()}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_setup(){const{graphic:e,layer:t}=this;if(!t||!e||a(e.geometry))return;const i=e.geometry;"mesh"!==i.type&&"extent"!==i.type?(this._setUpHighlights(),this._setupGraphics(),this._setupMover()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper.add(this.graphic)}_setUpGeometryHelper(){const e=this.graphic.geometry;if(a(e)||"mesh"===e.type||"extent"===e.type)return void this._logGeometryTypeError();const t="multipoint"===e.type?new R({paths:e.points,spatialReference:e.spatialReference}):e;this._editGeometryOperations=O.fromGeometry(t,G.Local)}_saveSnappingContextForHandle(e,t){this._snappingGraphicsLayer=new x({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer),this._snappingContext=new C({editGeometryOperations:this._editGeometryOperations,elevationInfo:{mode:"on-the-ground",offset:0},pointer:t.viewEvent?.pointerType||"mouse",excludeFeature:this.graphic,visualizer:new b(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(e)})}_reset(){this._clearSelection(),this._highlightHelper.removeAll(),this._resetGraphics(),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._mover&&this._mover.destroy(),this._mover=null,this.view.cursor="default"}_resetSnappingStateVars(){c(this.snappingManager)&&this.snappingManager.doneSnapping(),c(this._snappingGraphicsLayer)&&(this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy()),this._editGeometryOperations=h(this._editGeometryOperations),this._snappingTask=p(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(e){this._removeMidpointGraphics(e),this._removeVertexGraphics(e),this._set("selectedVertices",[])}_removeMidpointGraphics(e){const t=e||this.layer;t&&t.removeMany(this.midpointGraphics.items),this.midpointGraphics.items.forEach((e=>e.destroy())),this.midpointGraphics.removeAll()}_removeVertexGraphics(e){const t=e||this.layer;t&&t.removeMany(this.vertexGraphics.items),this.vertexGraphics.items.forEach((e=>e.destroy())),this.vertexGraphics.removeAll()}_getCoordinatesForUI(e){const t=g(e.clone());if("polygon"===e.type)for(const i of t){const e=i[i.length-1];i[0][0]===e[0]&&i[0][1]===e[1]&&i.length>2&&i.pop()}return t}_setupGraphics(){const e=this.graphic.geometry;if(c(e)&&("polyline"===e.type||"polygon"===e.type)){const t=this._getCoordinatesForUI(e);this.enableMidpoints&&this._setUpMidpointGraphics(t),this.enableVertices&&this._setUpVertexGraphics(t)}}_setUpMidpointGraphics(e){this._removeMidpointGraphics();const t=this._createMidpointGraphics(e);this.midpointGraphics.addMany(t),this.layer.addMany(t)}_setUpVertexGraphics(e){this._removeVertexGraphics();const t=this._createVertexGraphics(e);this.vertexGraphics.addMany(t),this._storeRelatedVertexIndices(),this.layer.addMany(t)}_createVertexGraphics(e){const{_graphicAttributes:i,symbols:s,view:{spatialReference:r}}=this,o=[];return e?.forEach(((e,n)=>{e.forEach(((e,h)=>{const[a,c]=e;o.push(new t({geometry:new j({x:a,y:c,spatialReference:r}),symbol:s?.vertices?.default,attributes:{...i,pathIndex:n,pointIndex:h}}))}))})),o}_createMidpointGraphics(e){const{_graphicAttributes:i,symbols:s,view:{spatialReference:r}}=this,o=[];return e?.forEach(((e,n)=>{e.forEach(((h,a)=>{const[c,p]=h,d=e[a+1]?a+1:0;if("polygon"===l(this.graphic.geometry,"type")||0!==d){const[h,l]=e[d],[m,v]=u([c,p],[h,l]);o.push(new t({geometry:new j({x:m,y:v,spatialReference:r}),symbol:s.midpoints.default,attributes:{...i,pathIndex:n,pointIndexStart:a,pointIndexEnd:d}}))}}))})),o}_storeRelatedVertexIndices(){const e=this.vertexGraphics.items;if(!e)return;const t=e.map((({geometry:e})=>({x:e.x,y:e.y})));for(let i=0;i<t.length;i++){const s=[];for(let e=0;e<t.length;e++){if(i===e)continue;const r=t[i],o=t[e];r.x===o.x&&r.y===o.y&&s.push(e)}e[i].attributes.relatedGraphicIndices=s}}_setupMover(){const{enableMovement:e,graphic:t,midpointGraphics:i,vertexGraphics:s,view:r}=this,o=s.concat(i).items;e&&o.push(t),this._mover=new M({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:o,view:r,callbacks:{onGraphicClick:e=>this._onGraphicClickCallback(e),onGraphicMoveStart:e=>this._onGraphicMoveStartCallback(e),onGraphicMove:e=>this._onGraphicMoveCallback(e),onGraphicMoveStop:e=>this._onGraphicMoveStopCallback(e),onGraphicPointerOver:e=>this._onGraphicPointerOverCallback(e),onGraphicPointerOut:e=>this._onGraphicPointerOutCallback(e)}})}_onGraphicClickCallback(e){e.viewEvent.stopPropagation();const t=e.graphic;if(t===this.graphic)this.clearSelection(),this.emit("graphic-click",e),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(e);else if(this._isMidpoint(t)){if(2===e.viewEvent.button)return;const i=this.graphic.clone(),s=this._createVertexFromMidpoint(t);this.refresh(),this._emitVertexAddEvent([t],i,s)}else if(this._isVertex(t))if(e.viewEvent.stopPropagation(),2===e.viewEvent.button)this._removeVertices(t);else{e.viewEvent.native.shiftKey||this._clearSelection(),this.selectedVertices.includes(t)?this._removeFromSelection(t,!0):this._addToSelection(t)}}_setUpOperation(e){const{graphic:t,dx:i,dy:s}=e,r=t===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(t,e),this._activeOperationInfo={target:this.graphic,mover:t,operationType:r?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(e){const t=e.graphic,{dx:i,dy:s}=e;if(t===this.graphic)return this._clearSelection(),this._resetGraphics(),this._setUpOperation(e),this._emitMoveStartEvent(i,s),void("point"===this._editGeometryOperations.data.type&&this._onHandleMove(t,i,s,e,(()=>this._emitMoveEvent(i,s))));if(!this.selectedVertices.includes(t)){if(this._clearSelection(),this._isMidpoint(t)){const e=this.graphic.clone(),i=this._createVertexFromMidpoint(t);this._emitVertexAddEvent([t],e,i)}this._addToSelection(t)}this._setUpOperation(e),this._emitReshapeStartEvent(t),this._onHandleMove(t,i,s,e,(()=>this._emitReshapeEvent(t)))}_onGraphicMoveCallback(e){const{graphic:t,dx:i,dy:s}=e;this._activeOperationInfo.totalDx+=i,this._activeOperationInfo.totalDy+=s;const{operationType:r}=this._activeOperationInfo;"move"===r?"point"===this._editGeometryOperations.data.type?this._onHandleMove(t,i,s,e,(()=>this._emitMoveEvent(i,s))):this._emitMoveEvent(i,s):this._onHandleMove(t,i,s,e,(()=>this._emitReshapeEvent(t)))}_onGraphicMoveStopCallback(e){const{graphic:t,dx:i,dy:s}=e;this._activeOperationInfo.totalDx+=i,this._activeOperationInfo.totalDy+=s,t===this.graphic?(this._emitMoveStopEvent(),this.refresh()):(this._onHandleMove(t,i,s,e,(()=>this._emitReshapeStopEvent(t))),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._isMidpoint(t)&&this.refresh())}_updateMidpointGraphicLocations(e){for(const t of this.midpointGraphics){const{pathIndex:i,pointIndexStart:s,pointIndexEnd:r}=t.attributes,[o,n]=e[i][s],[h,a]=e[i][r],[c,p]=u([o,n],[h,a]);t.geometry=new j({x:c,y:p,spatialReference:this.view.spatialReference})}}_getIndicesForVertexGraphic({attributes:e}){return[e?.pathIndex||0,e?.pointIndex||0]}_getVertexFromEditGeometry(e){const[t,i]=this._getIndicesForVertexGraphic(e);return this._editGeometryOperations.data.components[t].vertices[i]}_onHandleMove(e,t,i,s,r){if(p(this._snappingTask),!this._snappingContext)return;const o=e.geometry,n="graphic-move-stop"===s.type;if(c(this.snappingManager)&&this.selectedVertices.length<2&&!n){const s=this.snappingManager;this._stagedVertex=s.update(o,this._snappingContext),this._syncGeometryAfterVertexMove(e,new j(this._stagedVertex),t,i,n),r(),this._snappingTask=d((async h=>{const a=await s.snap(o,this._snappingContext,h);a.valid&&(this._stagedVertex=a.apply(),this._syncGeometryAfterVertexMove(e,new j(this._stagedVertex),t,i,n),r())}))}else{const s=c(this._stagedVertex)?new j(this._stagedVertex):o;this._syncGeometryAfterVertexMove(e,s,t,i,n),r()}}async _syncGeometryAfterVertexMove(e,t,i,s,r=!1){const o=this._editGeometryOperations.data.geometry;if("point"===o.type)e.geometry=t;else{const{x:n,y:h}=t,[a,c]=this._getIndicesForVertexGraphic(e);let p=g(o);const l=p[a].length-1;p[a][c]=[n,h],"polygon"===o.type&&(0===c?p[a][l]=[n,h]:c===l&&(p[a][0]=[n,h])),this._isVertex(e)&&(p=this._moveRelatedCoordinates(p,e,n,h),p=this._moveSelectedHandleCoordinates(p,e,i,s,"polygon"===o.type),this._updateMidpointGraphicLocations(p)),this.graphic.geometry=o.clone();const d=this._getVertexFromEditGeometry(e),m=n-d.pos[0],v=h-d.pos[1];this._editGeometryOperations.moveVertices([d],m,v,0),r&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(e),t):e.geometry=t)}}_moveRelatedCoordinates(e,t,i,s){const{relatedGraphicIndices:r}=t.attributes;for(const o of r){const r=this.vertexGraphics.getItemAt(o),{pathIndex:n,pointIndex:h}=r.attributes;e[n][h]=[i,s],r.geometry=t.geometry}return e}_moveSelectedHandleCoordinates(e,t,i,s,r){for(const o of this.selectedVertices)if(o!==t){const{pathIndex:t,pointIndex:n,relatedGraphicIndices:h}=o.attributes,a=V(o.geometry,i,s,this.view),c=e[t].length-1;e[t][n]=[a.x,a.y],o.geometry=a,r&&(0===n?e[t][c]=[a.x,a.y]:n===c&&(e[t][0]=[a.x,a.y]));for(const i of h){const t=this.vertexGraphics.getItemAt(i),{pathIndex:s,pointIndex:r}=t.attributes;e[s][r]=[a.x,a.y],t.geometry=a}}return e}_onGraphicPointerOverCallback(e){const t=e.graphic;this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.hover),this._updateHoverCursor(t)}_onGraphicPointerOutCallback(e){const t=e.graphic;this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.default),this.view.cursor="default"}_createVertexFromMidpoint(e){const{_graphicAttributes:t,graphic:i}=this,s=i.geometry;if(a(s)||"polygon"!==s.type&&"polyline"!==s.type)return[];const r=s.clone(),o=[],{pathIndex:n,pointIndexStart:h,pointIndexEnd:c}=e.attributes,{x:p,y:l}=e.geometry,d=0===c?h+1:c,m=g(r);return m[n].splice(d,0,[p,l]),e.attributes={...t,pathIndex:n,pointIndex:d,relatedGraphicIndices:[]},o.push({coordinates:m[n][d],componentIndex:n,vertexIndex:d}),this.graphic.geometry=r,o}_addToSelection(e){e instanceof t&&(e=[e]);for(const t of e)t.symbol=this.symbols.vertices.selected;this._set("selectedVertices",this.selectedVertices.concat(e)),this._emitSelectEvent(e)}_removeFromSelection(e,i){const{vertices:s}=this.symbols,r=i?s.hover:s.default;e instanceof t&&(e=[e]);for(const t of e)this.selectedVertices.splice(this.selectedVertices.indexOf(t),1),this._set("selectedVertices",this.selectedVertices),t.set("symbol",r);this._emitDeselectEvent(e)}_clearSelection(){if(this.selectedVertices.length){const e=this.selectedVertices;for(const t of this.selectedVertices)t.set("symbol",this.symbols.vertices.default);this._set("selectedVertices",[]),this._emitDeselectEvent(e)}}_keyDownHandler(e){I.delete.includes(e.key)&&!e.repeat&&this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_removeVertices(e){const i=this.graphic.geometry;if(a(i)||"polygon"!==i.type&&"polyline"!==i.type)return;if("polygon"===i.type&&this.vertexGraphics.length<4||this.vertexGraphics.length<3)return;e instanceof t&&(e=[e]);const s=this.graphic.clone(),r=i.clone();let o=g(r);const n=[];e instanceof t&&(e=[e]);for(const t of e){const{x:e,y:i}=t.geometry;for(let t=0;t<o.length;t++){const s=o[t];for(let r=0;r<s.length;r++){const[h,a]=s[r];e===h&&i===a&&(n.push({coordinates:o[t][r],componentIndex:t,vertexIndex:r}),o[t].splice(Number(r),1))}}}if("polygon"===r.type)o=o.filter((e=>{if(e.length<2)return!1;const[t,i]=e[0],[s,r]=e[e.length-1];return(2!==e.length||t!==s||i!==r)&&(t===s&&i===r||e.push(e[0]),!0)})),r.rings=o;else{for(const e of o)1===e.length&&o.splice(o.indexOf(e),1);r.paths=o}this.graphic.geometry=r,this.refresh(),this._emitVertexRemoveEvent(e,s,n)}_isVertex(e){return this.vertexGraphics.includes(e)}_isSelected(e){return this._isVertex(e)&&this.selectedVertices.includes(e)}_isMidpoint(e){return this.midpointGraphics.includes(e)}_updateHoverCursor(e){this.view.cursor=this._isMidpoint(e)?"copy":"move"}_emitMoveStartEvent(e,t){const i=new T(this.graphic,e,t);this.emit("move-start",i),this.callbacks.onMoveStart&&this.callbacks.onMoveStart(i)}_emitMoveEvent(e,t){const i=new D(this.graphic,e,t);this.emit("move",i),this.callbacks.onMove&&this.callbacks.onMove(i)}_emitMoveStopEvent(){const{totalDx:e,totalDy:t}=this._activeOperationInfo,i=new F(this.graphic,e,t);this.emit("move-stop",i),this.callbacks.onMoveStop&&this.callbacks.onMoveStop(i)}_emitReshapeStartEvent(e){const t=new H(this.graphic,e,this.selectedVertices);this.emit("reshape-start",t),this.callbacks.onReshapeStart&&this.callbacks.onReshapeStart(t)}_emitReshapeEvent(e){const t=new A(this.graphic,e,this.selectedVertices);this.emit("reshape",t),this.callbacks.onReshape&&this.callbacks.onReshape(t)}_emitReshapeStopEvent(e){const t=new U(this.graphic,e,this.selectedVertices);this.emit("reshape-stop",t),this.callbacks.onReshapeStop&&this.callbacks.onReshapeStop(t)}_emitSelectEvent(e){const t=new z(e);this.emit("select",t),this.callbacks.onVertexSelect&&this.callbacks.onVertexSelect(t)}_emitDeselectEvent(e){const t=new L(e);this.emit("deselect",t),this.callbacks.onVertexDeselect&&this.callbacks.onVertexDeselect(t)}_emitVertexAddEvent(e,t,i){const s=new P(e,this.graphic,t,i);this.emit("vertex-add",s),this.callbacks.onVertexAdd&&this.callbacks.onVertexAdd(s)}_emitVertexRemoveEvent(e,t,i){const s=new K(e,this.graphic,t,i);this.emit("vertex-remove",s),this.callbacks.onVertexRemove&&this.callbacks.onVertexRemove(s)}_logGeometryTypeError(){J.error(new s("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};e([y()],Q.prototype,"callbacks",void 0),e([y()],Q.prototype,"enableMidpoints",void 0),e([y()],Q.prototype,"enableMovement",void 0),e([y()],Q.prototype,"enableVertices",void 0),e([y()],Q.prototype,"graphic",void 0),e([y({value:!0})],Q.prototype,"highlightsEnabled",null),e([y()],Q.prototype,"layer",void 0),e([y({readOnly:!0})],Q.prototype,"midpointGraphics",void 0),e([y()],Q.prototype,"midpointSymbol",void 0),e([y({readOnly:!0})],Q.prototype,"selectedVertices",void 0),e([y()],Q.prototype,"snappingManager",void 0),e([y({readOnly:!0})],Q.prototype,"state",null),e([y({value:q})],Q.prototype,"symbols",null),e([y({readOnly:!0})],Q.prototype,"type",void 0),e([y({readOnly:!0})],Q.prototype,"vertexGraphics",void 0),e([y()],Q.prototype,"view",void 0),Q=e([_(B)],Q);const W=Q;export{W as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../Graphic.js";import i from"../../../core/Collection.js";import s from"../../../core/Error.js";import r from"../../../core/Evented.js";import o from"../../../core/Handles.js";import n from"../../../core/Logger.js";import{destroyMaybe as h,isNone as a,isSome as c,abortMaybe as p,get as l}from"../../../core/maybe.js";import{createTask as d}from"../../../core/promiseUtils.js";import{when as m,pausable as v}from"../../../core/reactiveUtils.js";import{property as y}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{geometryToCoordinates as g,getMidpoint as u}from"../../../geometry/support/coordsUtils.js";import x from"../../../layers/GraphicsLayer.js";import f from"../../../symbols/SimpleMarkerSymbol.js";import{ViewingMode as G}from"../../ViewingMode.js";import{SnappingVisualizer2D as b}from"../../2d/interactive/SnappingVisualizer2D.js";import{cloneMove as V}from"./drawUtils.js";import M from"./GraphicMover.js";import w from"./HighlightHelper.js";import{addUniqueLayer as S}from"./layerUtils.js";import{settings as k}from"./settings.js";import{ViewEventPriorities as E}from"../../input/InputManager.js";import{SKETCH_KEYS as I}from"../../interactive/keybindings.js";import{EditGeometryOperations as O}from"../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as C}from"../../interactive/snapping/SnappingContext.js";import R from"../../../geometry/Polyline.js";import j from"../../../geometry/Point.js";class H{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-start"}}class A{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape"}}class U{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-stop"}}class T{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move-start"}}class D{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move"}}class F{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move-stop"}}class z{constructor(e){this.added=e,this.type="vertex-select"}}class L{constructor(e){this.removed=e,this.type="vertex-deselect"}}class P{constructor(e,t,i,s){this.added=e,this.graphic=t,this.oldGraphic=i,this.vertices=s,this.type="vertex-add"}}class K{constructor(e,t,i,s){this.removed=e,this.graphic=t,this.oldGraphic=i,this.vertices=s,this.type="vertex-remove"}}const N=k.reshapeGraphics,q={vertices:{default:new f({style:"circle",size:N.vertex.size,color:N.vertex.color,outline:{color:N.vertex.outlineColor,width:1}}),hover:new f({style:"circle",size:N.vertex.hoverSize,color:N.vertex.hoverColor,outline:{color:N.vertex.hoverOutlineColor,width:1}}),selected:new f({style:"circle",size:N.selected.size,color:N.selected.color,outline:{color:N.selected.outlineColor,width:1}})},midpoints:{default:new f({style:"circle",size:N.midpoint.size,color:N.midpoint.color,outline:{color:N.midpoint.outlineColor,width:1}}),hover:new f({style:"circle",size:N.midpoint.size,color:N.midpoint.color,outline:{color:N.midpoint.outlineColor,width:1}})}},B="esri.views.draw.support.Reshape",J=n.getLogger(B);let Q=class extends r.EventedAccessor{constructor(e){super(e),this._activeOperationInfo=null,this._editGeometryOperations=null,this._handles=new o,this._graphicAttributes={esriSketchTool:"box"},this._mover=null,this._snappingTask=null,this._stagedVertex=null,this._viewHandles=new o,this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.enableMidpoints=!0,this.enableMovement=!0,this.enableVertices=!0,this.graphic=null,this.layer=null,this.midpointGraphics=new i,this.midpointSymbol=new f({style:"circle",size:6,color:[200,200,200],outline:{color:[100,100,100],width:1}}),this.selectedVertices=[],this.snappingManager=null,this.type="reshape",this.vertexGraphics=new i,this.view=null}initialize(){this._highlightHelper=new w({view:this.view}),this._setup(),this._handles.add([m((()=>this.view?.ready),(()=>{const{layer:e,view:t}=this;S(t,e),this._viewHandles.add(t.on("key-down",(e=>this._keyDownHandler(e)),E.TOOL))}),{once:!0,initial:!0}),v((()=>this.graphic),(()=>this.refresh())),v((()=>this.layer),((e,t)=>{t&&(this._clearSelection(),this._resetGraphics(t)),this.refresh()})),v((()=>this.enableMidpoints),(()=>this.refresh()))])}destroy(){this._reset(),this._mover?.destroy(),this._mover=null,this._handles=h(this._handles),this._viewHandles=h(this._viewHandles)}set highlightsEnabled(e){this._highlightHelper?.removeAll(),this._set("highlightsEnabled",e),this._setUpHighlights()}get state(){const e=!!this.get("view.ready"),t=!(!this.get("graphic")||!this.get("layer"));return e&&t?"active":e?"ready":"disabled"}set symbols(e){const{midpoints:t=q.midpoints,vertices:i=q.vertices}=e||{};this._set("symbols",{midpoints:t,vertices:i})}isUIGraphic(e){const t=[];return this.graphic&&t.push(this.graphic),t.concat(this.vertexGraphics.items,this.midpointGraphics.items),t.length&&t.includes(e)}refresh(){this._reset(),this._setup()}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_setup(){const{graphic:e,layer:t}=this;if(!t||!e||a(e.geometry))return;const i=e.geometry;"mesh"!==i.type&&"extent"!==i.type?(this._setUpHighlights(),this._setupGraphics(),this._setupMover()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper.add(this.graphic)}_setUpGeometryHelper(){const e=this.graphic.geometry;if(a(e)||"mesh"===e.type||"extent"===e.type)return void this._logGeometryTypeError();const t="multipoint"===e.type?new R({paths:e.points,spatialReference:e.spatialReference}):e;this._editGeometryOperations=O.fromGeometry(t,G.Local)}_saveSnappingContextForHandle(e,t){this._snappingGraphicsLayer=new x({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer),this._snappingContext=new C({editGeometryOperations:this._editGeometryOperations,elevationInfo:{mode:"on-the-ground",offset:0},pointer:t.viewEvent?.pointerType||"mouse",excludeFeature:this.graphic,visualizer:new b(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(e)})}_reset(){this._clearSelection(),this._highlightHelper.removeAll(),this._resetGraphics(),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._mover&&this._mover.destroy(),this._mover=null,this.view.cursor="default"}_resetSnappingStateVars(){c(this.snappingManager)&&this.snappingManager.doneSnapping(),c(this._snappingGraphicsLayer)&&(this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy()),this._editGeometryOperations=h(this._editGeometryOperations),this._snappingTask=p(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(e){this._removeMidpointGraphics(e),this._removeVertexGraphics(e),this._set("selectedVertices",[])}_removeMidpointGraphics(e){const t=e||this.layer;t&&t.removeMany(this.midpointGraphics.items),this.midpointGraphics.items.forEach((e=>e.destroy())),this.midpointGraphics.removeAll()}_removeVertexGraphics(e){const t=e||this.layer;t&&t.removeMany(this.vertexGraphics.items),this.vertexGraphics.items.forEach((e=>e.destroy())),this.vertexGraphics.removeAll()}_getCoordinatesForUI(e){const t=g(e.clone());if("polygon"===e.type)for(const i of t){const e=i[i.length-1];i[0][0]===e[0]&&i[0][1]===e[1]&&i.length>2&&i.pop()}return t}_setupGraphics(){const e=this.graphic.geometry;if(c(e)&&("polyline"===e.type||"polygon"===e.type)){const t=this._getCoordinatesForUI(e);this.enableMidpoints&&this._setUpMidpointGraphics(t),this.enableVertices&&this._setUpVertexGraphics(t)}}_setUpMidpointGraphics(e){this._removeMidpointGraphics();const t=this._createMidpointGraphics(e);this.midpointGraphics.addMany(t),this.layer.addMany(t)}_setUpVertexGraphics(e){this._removeVertexGraphics();const t=this._createVertexGraphics(e);this.vertexGraphics.addMany(t),this._storeRelatedVertexIndices(),this.layer.addMany(t)}_createVertexGraphics(e){const{_graphicAttributes:i,symbols:s,view:{spatialReference:r}}=this,o=[];return e?.forEach(((e,n)=>{e.forEach(((e,h)=>{const[a,c]=e;o.push(new t({geometry:new j({x:a,y:c,spatialReference:r}),symbol:s?.vertices?.default,attributes:{...i,pathIndex:n,pointIndex:h}}))}))})),o}_createMidpointGraphics(e){const{_graphicAttributes:i,symbols:s,view:{spatialReference:r}}=this,o=[];return e?.forEach(((e,n)=>{e.forEach(((h,a)=>{const[c,p]=h,d=e[a+1]?a+1:0;if("polygon"===l(this.graphic.geometry,"type")||0!==d){const[h,l]=e[d],[m,v]=u([c,p],[h,l]);o.push(new t({geometry:new j({x:m,y:v,spatialReference:r}),symbol:s.midpoints.default,attributes:{...i,pathIndex:n,pointIndexStart:a,pointIndexEnd:d}}))}}))})),o}_storeRelatedVertexIndices(){const e=this.vertexGraphics.items;if(!e)return;const t=e.map((({geometry:e})=>({x:e.x,y:e.y})));for(let i=0;i<t.length;i++){const s=[];for(let e=0;e<t.length;e++){if(i===e)continue;const r=t[i],o=t[e];r.x===o.x&&r.y===o.y&&s.push(e)}e[i].attributes.relatedGraphicIndices=s}}_setupMover(){const{enableMovement:e,graphic:t,midpointGraphics:i,vertexGraphics:s,view:r}=this,o=s.concat(i).items;e&&o.push(t),this._mover=new M({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:o,view:r,callbacks:{onGraphicClick:e=>this._onGraphicClickCallback(e),onGraphicMoveStart:e=>this._onGraphicMoveStartCallback(e),onGraphicMove:e=>this._onGraphicMoveCallback(e),onGraphicMoveStop:e=>this._onGraphicMoveStopCallback(e),onGraphicPointerOver:e=>this._onGraphicPointerOverCallback(e),onGraphicPointerOut:e=>this._onGraphicPointerOutCallback(e)}})}_onGraphicClickCallback(e){e.viewEvent.stopPropagation();const t=e.graphic;if(t===this.graphic)this.clearSelection(),this.emit("graphic-click",e),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(e);else if(this._isMidpoint(t)){if(2===e.viewEvent.button)return;const i=this.graphic.clone(),s=this._createVertexFromMidpoint(t);this.refresh(),this._emitVertexAddEvent([t],i,s)}else if(this._isVertex(t))if(e.viewEvent.stopPropagation(),2===e.viewEvent.button)this._removeVertices(t);else{e.viewEvent.native.shiftKey||this._clearSelection(),this.selectedVertices.includes(t)?this._removeFromSelection(t,!0):this._addToSelection(t)}}_setUpOperation(e){const{graphic:t,dx:i,dy:s}=e,r=t===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(t,e),this._activeOperationInfo={target:this.graphic,mover:t,operationType:r?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(e){const t=e.graphic,{dx:i,dy:s}=e;if(t===this.graphic)return this._clearSelection(),this._resetGraphics(),this._setUpOperation(e),this._emitMoveStartEvent(i,s),void("point"===this._editGeometryOperations.data.type&&this._onHandleMove(t,i,s,e,(()=>this._emitMoveEvent(i,s))));if(!this.selectedVertices.includes(t)){if(this._clearSelection(),this._isMidpoint(t)){const e=this.graphic.clone(),i=this._createVertexFromMidpoint(t);this._emitVertexAddEvent([t],e,i)}this._addToSelection(t)}this._setUpOperation(e),this._emitReshapeStartEvent(t),this._onHandleMove(t,i,s,e,(()=>this._emitReshapeEvent(t)))}_onGraphicMoveCallback(e){const{graphic:t,dx:i,dy:s}=e;this._activeOperationInfo.totalDx+=i,this._activeOperationInfo.totalDy+=s;const{operationType:r}=this._activeOperationInfo;"move"===r?"point"===this._editGeometryOperations.data.type?this._onHandleMove(t,i,s,e,(()=>this._emitMoveEvent(i,s))):this._emitMoveEvent(i,s):this._onHandleMove(t,i,s,e,(()=>this._emitReshapeEvent(t)))}_onGraphicMoveStopCallback(e){const{graphic:t,dx:i,dy:s}=e;this._activeOperationInfo.totalDx+=i,this._activeOperationInfo.totalDy+=s,t===this.graphic?(this._emitMoveStopEvent(),this.refresh()):(this._onHandleMove(t,i,s,e,(()=>this._emitReshapeStopEvent(t))),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._isMidpoint(t)&&this.refresh())}_updateMidpointGraphicLocations(e){for(const t of this.midpointGraphics){const{pathIndex:i,pointIndexStart:s,pointIndexEnd:r}=t.attributes,[o,n]=e[i][s],[h,a]=e[i][r],[c,p]=u([o,n],[h,a]);t.geometry=new j({x:c,y:p,spatialReference:this.view.spatialReference})}}_getIndicesForVertexGraphic({attributes:e}){return[e?.pathIndex||0,e?.pointIndex||0]}_getVertexFromEditGeometry(e){const[t,i]=this._getIndicesForVertexGraphic(e);return this._editGeometryOperations.data.components[t].vertices[i]}_onHandleMove(e,t,i,s,r){if(p(this._snappingTask),!this._snappingContext)return;const o=e.geometry,n="graphic-move-stop"===s.type;if(c(this.snappingManager)&&this.selectedVertices.length<2&&!n){const s=this.snappingManager;this._stagedVertex=s.update(o,this._snappingContext),this._syncGeometryAfterVertexMove(e,new j(this._stagedVertex),t,i,n),r(),this._snappingTask=d((async h=>{const a=await s.snap(o,this._snappingContext,h);a.valid&&(this._stagedVertex=a.apply(),this._syncGeometryAfterVertexMove(e,new j(this._stagedVertex),t,i,n),r())}))}else{const s=c(this._stagedVertex)?new j(this._stagedVertex):o;this._syncGeometryAfterVertexMove(e,s,t,i,n),r()}}async _syncGeometryAfterVertexMove(e,t,i,s,r=!1){const o=this._editGeometryOperations.data.geometry;if("point"===o.type)e.geometry=t;else{const{x:n,y:h}=t,[a,c]=this._getIndicesForVertexGraphic(e);let p=g(o);const l=p[a].length-1;p[a][c]=[n,h],"polygon"===o.type&&(0===c?p[a][l]=[n,h]:c===l&&(p[a][0]=[n,h])),this._isVertex(e)&&(p=this._moveRelatedCoordinates(p,e,n,h),p=this._moveSelectedHandleCoordinates(p,e,i,s,"polygon"===o.type),this._updateMidpointGraphicLocations(p)),this.graphic.geometry=o.clone();const d=this._getVertexFromEditGeometry(e),m=n-d.pos[0],v=h-d.pos[1];this._editGeometryOperations.moveVertices([d],m,v,0),r&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(e),t):e.geometry=t)}}_moveRelatedCoordinates(e,t,i,s){const{relatedGraphicIndices:r}=t.attributes;for(const o of r){const r=this.vertexGraphics.getItemAt(o),{pathIndex:n,pointIndex:h}=r.attributes;e[n][h]=[i,s],r.geometry=t.geometry}return e}_moveSelectedHandleCoordinates(e,t,i,s,r){for(const o of this.selectedVertices)if(o!==t){const{pathIndex:t,pointIndex:n,relatedGraphicIndices:h}=o.attributes,a=V(o.geometry,i,s,this.view),c=e[t].length-1;e[t][n]=[a.x,a.y],o.geometry=a,r&&(0===n?e[t][c]=[a.x,a.y]:n===c&&(e[t][0]=[a.x,a.y]));for(const i of h){const t=this.vertexGraphics.getItemAt(i),{pathIndex:s,pointIndex:r}=t.attributes;e[s][r]=[a.x,a.y],t.geometry=a}}return e}_onGraphicPointerOverCallback(e){const t=e.graphic;this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.hover),this._updateHoverCursor(t)}_onGraphicPointerOutCallback(e){const t=e.graphic;this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.default),this.view.cursor="default"}_createVertexFromMidpoint(e){const{_graphicAttributes:t,graphic:i}=this,s=i.geometry;if(a(s)||"polygon"!==s.type&&"polyline"!==s.type)return[];const r=s.clone(),o=[],{pathIndex:n,pointIndexStart:h,pointIndexEnd:c}=e.attributes,{x:p,y:l}=e.geometry,d=0===c?h+1:c,m=g(r);return m[n].splice(d,0,[p,l]),e.attributes={...t,pathIndex:n,pointIndex:d,relatedGraphicIndices:[]},o.push({coordinates:m[n][d],componentIndex:n,vertexIndex:d}),this.graphic.geometry=r,o}_addToSelection(e){e instanceof t&&(e=[e]);for(const t of e)t.symbol=this.symbols.vertices.selected;this._set("selectedVertices",this.selectedVertices.concat(e)),this._emitSelectEvent(e)}_removeFromSelection(e,i){const{vertices:s}=this.symbols,r=i?s.hover:s.default;e instanceof t&&(e=[e]);for(const t of e)this.selectedVertices.splice(this.selectedVertices.indexOf(t),1),this._set("selectedVertices",this.selectedVertices),t.set("symbol",r);this._emitDeselectEvent(e)}_clearSelection(){if(this.selectedVertices.length){const e=this.selectedVertices;for(const t of this.selectedVertices)t.set("symbol",this.symbols.vertices.default);this._set("selectedVertices",[]),this._emitDeselectEvent(e)}}_keyDownHandler(e){I.delete.includes(e.key)&&!e.repeat&&this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_removeVertices(e){const i=this.graphic.geometry;if(a(i)||"polygon"!==i.type&&"polyline"!==i.type)return;if("polygon"===i.type&&this.vertexGraphics.length<4||this.vertexGraphics.length<3)return;e instanceof t&&(e=[e]);const s=this.graphic.clone(),r=i.clone();let o=g(r);const n=[];e instanceof t&&(e=[e]);for(const t of e){const{x:e,y:i}=t.geometry;for(let t=0;t<o.length;t++){const s=o[t];for(let r=0;r<s.length;r++){const[h,a]=s[r];e===h&&i===a&&(n.push({coordinates:o[t][r],componentIndex:t,vertexIndex:r}),o[t].splice(Number(r),1))}}}if("polygon"===r.type)o=o.filter((e=>{if(e.length<2)return!1;const[t,i]=e[0],[s,r]=e[e.length-1];return(2!==e.length||t!==s||i!==r)&&(t===s&&i===r||e.push(e[0]),!0)})),r.rings=o;else{for(const e of o)1===e.length&&o.splice(o.indexOf(e),1);r.paths=o}this.graphic.geometry=r,this.refresh(),this._emitVertexRemoveEvent(e,s,n)}_isVertex(e){return this.vertexGraphics.includes(e)}_isSelected(e){return this._isVertex(e)&&this.selectedVertices.includes(e)}_isMidpoint(e){return this.midpointGraphics.includes(e)}_updateHoverCursor(e){this.view.cursor=this._isMidpoint(e)?"copy":"move"}_emitMoveStartEvent(e,t){const i=new T(this.graphic,e,t);this.emit("move-start",i),this.callbacks.onMoveStart&&this.callbacks.onMoveStart(i)}_emitMoveEvent(e,t){const i=new D(this.graphic,e,t);this.emit("move",i),this.callbacks.onMove&&this.callbacks.onMove(i)}_emitMoveStopEvent(){const{totalDx:e,totalDy:t}=this._activeOperationInfo,i=new F(this.graphic,e,t);this.emit("move-stop",i),this.callbacks.onMoveStop&&this.callbacks.onMoveStop(i)}_emitReshapeStartEvent(e){const t=new H(this.graphic,e,this.selectedVertices);this.emit("reshape-start",t),this.callbacks.onReshapeStart&&this.callbacks.onReshapeStart(t)}_emitReshapeEvent(e){const t=new A(this.graphic,e,this.selectedVertices);this.emit("reshape",t),this.callbacks.onReshape&&this.callbacks.onReshape(t)}_emitReshapeStopEvent(e){const t=new U(this.graphic,e,this.selectedVertices);this.emit("reshape-stop",t),this.callbacks.onReshapeStop&&this.callbacks.onReshapeStop(t)}_emitSelectEvent(e){const t=new z(e);this.emit("select",t),this.callbacks.onVertexSelect&&this.callbacks.onVertexSelect(t)}_emitDeselectEvent(e){const t=new L(e);this.emit("deselect",t),this.callbacks.onVertexDeselect&&this.callbacks.onVertexDeselect(t)}_emitVertexAddEvent(e,t,i){const s=new P(e,this.graphic,t,i);this.emit("vertex-add",s),this.callbacks.onVertexAdd&&this.callbacks.onVertexAdd(s)}_emitVertexRemoveEvent(e,t,i){const s=new K(e,this.graphic,t,i);this.emit("vertex-remove",s),this.callbacks.onVertexRemove&&this.callbacks.onVertexRemove(s)}_logGeometryTypeError(){J.error(new s("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};e([y()],Q.prototype,"callbacks",void 0),e([y()],Q.prototype,"enableMidpoints",void 0),e([y()],Q.prototype,"enableMovement",void 0),e([y()],Q.prototype,"enableVertices",void 0),e([y()],Q.prototype,"graphic",void 0),e([y({value:!0})],Q.prototype,"highlightsEnabled",null),e([y()],Q.prototype,"layer",void 0),e([y({readOnly:!0})],Q.prototype,"midpointGraphics",void 0),e([y()],Q.prototype,"midpointSymbol",void 0),e([y({readOnly:!0})],Q.prototype,"selectedVertices",void 0),e([y()],Q.prototype,"snappingManager",void 0),e([y({readOnly:!0})],Q.prototype,"state",null),e([y({value:q})],Q.prototype,"symbols",null),e([y({readOnly:!0})],Q.prototype,"type",void 0),e([y({readOnly:!0})],Q.prototype,"vertexGraphics",void 0),e([y()],Q.prototype,"view",void 0),Q=e([_(B)],Q);const W=Q;export{W 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.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import i from"../../core/Evented.js";import{isNone as o,isSome as s}from"../../core/maybe.js";import{
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import i from"../../core/Evented.js";import{isNone as o,isSome as s}from"../../core/maybe.js";import{watch as r,sync as l}from"../../core/reactiveUtils.js";import{pt2px as a,screenPointObjectToArray as n,createScreenPointArray as c}from"../../core/screenUtils.js";import{property as h}from"../../core/accessorSupport/decorators/property.js";import"../../core/arrayUtils.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import{s as m}from"../../chunks/vec2.js";import{i as u}from"../../chunks/vec3.js";import{c as y}from"../../chunks/vec3f64.js";import{canProjectWithoutEngine as g,project as d,projectPointToVector as b}from"../../geometry/projection.js";import{getGraphicEffectiveElevationMode as f}from"../../support/elevationInfoUtils.js";import{getDefaultSymbol2D as _}from"../../symbols/support/defaults.js";import v from"../../symbols/support/ElevationInfo.js";import{intersectsDrapedGeometry as S}from"../support/drapedUtils.js";let C=class extends t{constructor(e){super(e),this.layer=null,this.interactive=!0,this.selectable=!1,this.grabbable=!0,this.dragging=!1,this.cursor=null,this.events=new i.EventEmitter,this._circleCollisionCache=null,this._graphicSymbolChangedHandle=null,this._originalSymbol=null}set graphic(e){this._circleCollisionCache=null,this._originalSymbol=e.symbol,this._set("graphic",e),this.attachSymbolChanged()}get elevationInfo(){const e="elevationInfo"in this.graphic.layer&&this.graphic.layer.elevationInfo,t=f(this.graphic),i=e?e.offset:0;return new v({mode:t,offset:i})}set focusedSymbol(e){e!==this._get("focusedSymbol")&&(this._set("focusedSymbol",e),this._updateGraphicSymbol(),this._circleCollisionCache=null)}grabbableForEvent(){return!0}set grabbing(e){e!==this._get("grabbing")&&(this._set("grabbing",e),this._updateGraphicSymbol())}set hovering(e){e!==this._get("hovering")&&(this._set("hovering",e),this._updateGraphicSymbol())}set selected(e){e!==this._get("selected")&&(this._set("selected",e),this._updateGraphicSymbol(),this.events.emit("select-changed",{action:e?"select":"deselect"}))}get _focused(){return this._get("hovering")||this._get("grabbing")}destroy(){this.detachSymbolChanged(),this._resetGraphicSymbol(),this._set("view",null)}intersectionDistance(e){const t=this.graphic;if(!1===t.visible)return null;const i=t.geometry;if(o(i))return null;const r=this._get("focusedSymbol"),l=s(r)?r:t.symbol;return"2d"===this.view.type?this._intersectDistance2D(this.view,e,i,l):this._intersectDistance3D(this.view,e,t)}attach(){this.attachSymbolChanged(),s(this.layer)&&this.layer.add(this.graphic)}detach(){this.detachSymbolChanged(),this._resetGraphicSymbol(),s(this.layer)&&this.layer.remove(this.graphic)}attachSymbolChanged(){this.detachSymbolChanged(),this._graphicSymbolChangedHandle=r((()=>this.graphic?.symbol),(e=>{s(e)&&e!==this.focusedSymbol&&e!==this._originalSymbol&&(this._originalSymbol=e,this._focused&&s(this.focusedSymbol)&&(this.graphic.symbol=this.focusedSymbol))}),l)}detachSymbolChanged(){s(this._graphicSymbolChangedHandle)&&(this._graphicSymbolChangedHandle.remove(),this._graphicSymbolChangedHandle=null)}_updateGraphicSymbol(){this.graphic.symbol=this._focused&&s(this.focusedSymbol)?this.focusedSymbol:this._originalSymbol}_resetGraphicSymbol(){this.graphic.symbol=this._originalSymbol}_intersectDistance2D(e,t,i,r){if(r=r||_(i),o(r))return null;const l=1;let c=this._circleCollisionCache;if("point"!==i.type||"simple-marker"!==r.type)return S(t,i,e)?l:null;if(o(c)||!c.originalPoint.equals(i)){const t=i,o=e.spatialReference;if(g(t.spatialReference,o)){const e=d(t,o);c={originalPoint:t.clone(),mapPoint:e,radiusPx:a(r.size)},this._circleCollisionCache=c}}if(s(c)){const i=n(t,D),o=e.toScreen(c.mapPoint),s=c.radiusPx,h=o.x+a(r.xoffset),p=o.y-a(r.yoffset);return m(i,[h,p])<s*s?l:null}return null}_intersectDistance3D(e,t,i){const o=e.toMap(t,{include:[i]});return o&&b(o,j,e.renderSpatialReference)?u(j,e.state.camera.eye):null}};e([h({constructOnly:!0,nonNullable:!0})],C.prototype,"graphic",null),e([h({readOnly:!0})],C.prototype,"elevationInfo",null),e([h({constructOnly:!0,nonNullable:!0})],C.prototype,"view",void 0),e([h({value:null})],C.prototype,"focusedSymbol",null),e([h({constructOnly:!0})],C.prototype,"layer",void 0),e([h()],C.prototype,"interactive",void 0),e([h()],C.prototype,"selectable",void 0),e([h()],C.prototype,"grabbable",void 0),e([h({value:!1})],C.prototype,"grabbing",null),e([h()],C.prototype,"dragging",void 0),e([h()],C.prototype,"hovering",null),e([h({value:!1})],C.prototype,"selected",null),e([h()],C.prototype,"cursor",void 0),C=e([p("esri.views.interactive.GraphicManipulator")],C);const j=y(),D=c();export{C as GraphicManipulator};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import i from"../../core/Logger.js";import{isNone as
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import i from"../../core/Logger.js";import{isNone as o}from"../../core/maybe.js";import{createResolver as s}from"../../core/promiseUtils.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 a}from"../../core/accessorSupport/decorators/subclass.js";import{isDOMContainer as n}from"../DOMContainer.js";import{EditableFlag as l}from"./interfaces.js";import{ManipulatorCollection as h}from"./ManipulatorCollection.js";const p=i.getLogger("esri.views.interactive.InteractiveToolBase");let c=class extends e{constructor(t){super(t),this.created=!1,this.manipulators=new h,this.updating=!1,this.preferManipulatorCursor=!1,this.automaticManipulatorSelection=!0,this._editableFlags=new Map([[l.MANAGER,!0],[l.USER,!0]]),this._creationFinishedResolver=s()}get active(){return null!=this.view&&this.view.activeTool===this}set visible(t){this._get("visible")!==t&&(this._set("visible",t),this._syncVisible())}get editable(){return this.getEditableFlag(l.USER)}set editable(t){this.setEditableFlag(l.USER,t)}get cursor(){return null}destroy(){this.manipulators.destroy(),this._set("view",null)}onAdd(){this._syncVisible()}activate(){o(this.view)?p.error("Can't activate tool if view is not defined."):(n(this.view)&&this.view.focus(),this.onActivate())}deactivate(){this.onDeactivate()}handleInputEvent(t){this.onInputEvent(t)}handleInputEventAfter(t){this.onInputEventAfter(t)}setEditableFlag(t,e){this._editableFlags.set(t,e),this.manipulators.isToolEditable=this.internallyEditable,this._updateManipulatorAttachment(),t===l.USER&&this.notifyChange("editable"),this.onEditableChange()}getEditableFlag(t){return this._editableFlags.get(t)}whenCreated(){return this._creationFinishedResolver.promise}onActivate(){}onDeactivate(){}onShow(){}onHide(){}onEditableChange(){}onInputEvent(t){}onInputEventAfter(t){}get internallyEditable(){return this.getEditableFlag(l.USER)&&this.getEditableFlag(l.MANAGER)}finishToolCreation(){this.created||this._creationFinishedResolver.resolve(this),this._set("created",!0)}_syncVisible(){if(this.constructed)if(this.visible)this._show();else if(this._hide(),this.active)return void(this.view.activeTool=null)}_show(){this._updateManipulatorAttachment(),this.onShow()}_hide(){this._updateManipulatorAttachment(),this.onHide()}_updateManipulatorAttachment(){this.visible?this.manipulators.attach():this.manipulators.detach()}};t([r({constructOnly:!0})],c.prototype,"view",void 0),t([r({readOnly:!0})],c.prototype,"active",null),t([r({value:!0})],c.prototype,"visible",null),t([r({value:!0})],c.prototype,"editable",null),t([r({readOnly:!0})],c.prototype,"created",void 0),t([r({readOnly:!0})],c.prototype,"manipulators",void 0),t([r({readOnly:!0})],c.prototype,"updating",void 0),t([r()],c.prototype,"cursor",null),t([r({readOnly:!0})],c.prototype,"preferManipulatorCursor",void 0),t([r({readOnly:!0})],c.prototype,"automaticManipulatorSelection",void 0),c=t([a("esri.views.interactive.InteractiveToolBase")],c);export{c as InteractiveToolBase};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Accessor.js";import{makeHandle as s}from"../../core/handleUtils.js";import{equalsShallow as o}from"../../core/lang.js";import{isSome as i,isNone as r,applySome as a}from"../../core/maybe.js";import{createTask as n,throwIfAborted as l}from"../../core/promiseUtils.js";import{formatLength as d}from"../../core/quantityFormatUtils.js";import{createLength as p}from"../../core/quantityUtils.js";import{watch as c,on as h}from"../../core/reactiveUtils.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as b}from"../../core/accessorSupport/decorators/subclass.js";import{fetchMessageBundle as _}from"../../intl/messages.js";let u=class extends e{constructor(t){super(t),this.context=null,this.stagedEdge=null,this.visible=!0,this._messagesUnits=null,this._labels=[],this._nextLabelIndex=0}initialize(){const t=n((async t=>{this._messagesUnits=await _("esri/core/t9n/Units"),l(t),this._update()})),e=()=>a(this.context,(t=>t.editGeometryOperations));this.own([c((()=>{const t=this.context;return{context:t,stationary:i(t)&&t.view.stationary,visible:this.visible,stagedEdge:this.stagedEdge}}),(({stationary:t})=>{t&&this._update()}),{sync:!0,equals:o}),...["vertex-add","vertex-update","vertex-remove"].map((t=>h(e,t,(()=>this._update())))),s((()=>t.abort()))])}destroy(){this._nextLabelIndex=0;const t=this._labels;for(;t.length;)t.pop().destroy()}get updating(){return r(this._messagesUnits)}_update(){this._nextLabelIndex=0;const t=this.context;if(i(t)){for(const e of t.editGeometryOperations.data.components)for(const s of e.edges)this._addLabel(t,s.leftVertex.pos,s.rightVertex.pos);a(this.stagedEdge,(e=>this._addLabel(t,e[0],e[1])))}this._destroyUnusedLabels()}_addLabel(t,e,s){const o=this._getOrCreateLabel(t);if(this.screenDistanceSquared(t,e,s)<g)return void(o.visible=!1);const r=x(t.editGeometryOperations.data.coordinateHelper,e,s);o.text=i(this._messagesUnits)?d(this._messagesUnits,r,"metric"):"",o.visible=this.visible,this.positionLabel(t,o,e,s)}_getOrCreateLabel(t){if(this._labels.length>this._nextLabelIndex)return this._labels[this._nextLabelIndex++];const e=this.createLabel(t);return this._labels.push(e),this._nextLabelIndex=this._labels.length,e}_destroyUnusedLabels(){const t=this._labels;for(;t.length>this._nextLabelIndex;)t.pop().destroy()}};function x(t,e,s){const o=t.vectorToPoint(e),i=t.vectorToPoint(s);return p(o.distance(i),"meters")}t([m()],u.prototype,"context",void 0),t([m()],u.prototype,"stagedEdge",void 0),t([m()],u.prototype,"visible",void 0),t([m()],u.prototype,"updating",null),t([m()],u.prototype,"_messagesUnits",void 0),t([m()],u.prototype,"_labels",void 0),t([m()],u.prototype,"_nextLabelIndex",void 0),u=t([b("esri.views.interactive")],u);const g=1600;export{u as SegmentLabels};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import{HandleOwner as t}from"../../../core/HandleOwner.js";import r from"../../../core/Handles.js";import{someMap as i}from"../../../core/MapUtils.js";import{isSome as o,unwrap as n,isNone as
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import{HandleOwner as t}from"../../../core/HandleOwner.js";import r from"../../../core/Handles.js";import{someMap as i}from"../../../core/MapUtils.js";import{isSome as o,unwrap as n,isNone as s}from"../../../core/maybe.js";import{eachAlwaysValues as a,throwIfAborted as c}from"../../../core/promiseUtils.js";import{sync as u,watch as l,syncAndInitial as p}from"../../../core/reactiveUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{c as g}from"../../../chunks/vec3f64.js";import{SnappingTypes as f}from"../../../layers/graphics/data/QueryEngineResult.js";import{RayConstraint as y}from"./SnappingConstraint.js";import{sortCandidatesInPlace as S}from"./snappingUtils.js";import{EdgeSnappingCandidate as m}from"./candidates/EdgeSnappingCandidate.js";import{FeatureSnappingCandidate as v}from"./candidates/FeatureSnappingCandidate.js";import{RightAngleSnappingCandidate as w,OtherVertexType as _}from"./candidates/RightAngleSnappingCandidate.js";import{anyMapPointToRender as j,anyMapPointToScreenPoint as x}from"../support/viewUtils.js";let C=class extends t{constructor(e){super(e),this.sourceModules={featureService:{module:null,loader:null},featureCollection:{module:null,loader:null},graphics:{module:null,loader:null}}}get updating(){return i(this.snappingSources,(({snappingSource:e})=>e.updating))||this.updatingHandles.updating}get snappingSources(){const e=this._get("snappingSources")||new Map,t=new Map;if(this.options?.featureSources)for(const r of this.options.featureSources.items){const i=r.layer.uid,n=e.get(i);if(n){e.delete(i),t.set(i,n);continue}if(!r.layer.loaded){this.updatingHandles.addPromise(r.layer.load());continue}const s=this._createSourceInfo(r);o(s)&&t.set(i,s)}for(const[,r]of e)r.destroy();return t}initialize(){this.updatingHandles.add((()=>this.snappingSources),(()=>this.notifyChange("updating")),u),o(this.view)&&this.handles.add([this.view.on("layerview-create",(e=>this._updateLayerView(e.layer,e.layerView))),this.view.on("layerview-destroy",(e=>this._updateLayerView(e.layer,null)))])}_updateLayerView(e,t){for(const[,r]of this.snappingSources)r.snappingSource.layerSource.layer===e&&(r.layerView=t)}destroy(){this._set("options",null);for(const[,e]of this.snappingSources)e.destroy()}async fetchCandidates(e,t,r){if(!this.options.effectiveFeatureEnabled)return[];const i=[],n=this._computeScreeenSizeDistanceParameters(e,t),s={distance:n,point:e,coordinateHelper:t.coordinateHelper,types:this.types,filter:null};for(const[,{snappingSource:a,layerView:c}]of this.snappingSources)!a.layerSource.enabled||o(c)&&c.suspended||i.push(a.fetchCandidates(s,r).then((e=>e.filter((e=>!this._candidateIsExcluded(a,e,t.excludeFeature))))));const u=(await a(i)).flat();return this._addRightAngleCandidates(u,e,n,t),c(r),S(e,u),u}_addRightAngleCandidates(e,t,r,i){const s=o(i.vertexHandle)?i.vertexHandle.rightEdge?.rightVertex?.pos:o(i.editGeometryOperations)&&"polygon"===i.editGeometryOperations.data.type?n(i.editGeometryOperations.data.components[0]?.getFirstVertex())?.pos:null,a=o(i.vertexHandle)?i.vertexHandle.leftEdge?.leftVertex?.pos:o(i.editGeometryOperations)?n(i.editGeometryOperations.data.components[0]?.getLastVertex())?.pos:null,c=e.length;for(let o=0;o<c;o++)this._addRightAngleCandidate(e[o],a,t,r,i,e),this._addRightAngleCandidate(e[o],s,t,r,i,e)}_addRightAngleCandidate(e,t,r,i,o,n){if(s(t)||!(e instanceof m))return;const a=e.constraint.closestTo(t),c=(a[0]-r[0])/i.x,u=(a[1]-r[1])/i.y;if(c*c+u*u<=1){const r=o.coordinateHelper;n.push(new w({coordinateHelper:r,targetPoint:a,otherVertex:t,otherVertexType:_.NEXT,previousVertex:e.constraint.start,constraint:new y(r,t,a),objectId:e.objectId,elevationInfo:e.elevationInfo}))}}_computeScreeenSizeDistanceParameters(e,t){const r=this.options.distance*("touch"===t.pointer?this.options.touchSensitivityMultiplier:1);if(s(this.view))return{x:r,y:r,pixelSize:r};if("2d"===this.view.type){const e=r*this.view.resolution;return{x:e,y:e,pixelSize:e}}return this._computeScreeenSizeDistanceParameters3D(e,r,this.view,t)}_computeScreeenSizeDistanceParameters3D(e,t,r,i){const{coordinateHelper:o,elevationInfo:n}=i,s=r.state.camera.computeScreenPixelSizeAt(j(e,o,n,r,M)),a=s*r.renderCoordsHelper.unitInMeters/r.mapCoordsHelper.unitInMeters,c=t*a;return{x:c/this._computeScreenMagnitudeOfMapOffset(e,a,0,r,i),y:c/this._computeScreenMagnitudeOfMapOffset(e,0,a,r,i),pixelSize:s}}_computeScreenMagnitudeOfMapOffset(e,t,r,i,{coordinateHelper:o,elevationInfo:n}){const s=o.clone(e);s[0]+=t,s[1]+=r;const a=x(e,o,n,i),c=x(s,o,n,i),u=c.x-a.x,l=c.y-a.y;return Math.sqrt(u*u+l*l)}get types(){return f.EDGE|f.VERTEX}_candidateIsExcluded(e,t,r){if(s(r))return!1;const i=this._getCandidateObjectId(t);if(s(i))return!1;const o=e.layerSource.layer;return"graphics"===o.type?r.uid===i:r.sourceLayer===o&&(!(!r.attributes||!("objectIdField"in o))&&r.attributes[o.objectIdField]===i)}_getCandidateObjectId(e){return e instanceof v?e.objectId:null}_createSourceInfo(e){const t=this._createFeatureSnappingSourceType(e);if(s(t))return null;if("loading"in t)return this.updatingHandles.addPromise(t.loading.then((()=>{this.destroyed||this.notifyChange("snappingSources")}))),null;const r=o(this.view)?this.view.allLayerViews.find((t=>t.layer===e.layer)):null;return new H(t.source,r)}_createFeatureSnappingSourceType(e){switch(e.layer.type){case"feature":case"geojson":case"csv":case"subtype-group":case"wfs":return this._createFeatureSnappingSourceFeatureLayer(e);case"graphics":return this._createFeatureSnappingSourceGraphicsLayer(e)}return null}_createFeatureSnappingSourceFeatureLayer(e){switch(e.layer.source.type){case"feature-layer":{const t=this._getSourceModule("featureService");return o(t.module)?{source:new t.module.FeatureServiceSnappingSource({spatialReference:this.spatialReference,view:this.view,layerSource:e})}:{loading:t.loader}}case"memory":case"csv":case"geojson":case"wfs":{if("mesh"===e.layer.geometryType)return null;const t=this._getSourceModule("featureCollection");return o(t.module)?{source:new t.module.FeatureCollectionSnappingSource({layerSource:e})}:{loading:t.loader}}}return null}_createFeatureSnappingSourceGraphicsLayer(e){const t=this._getSourceModule("graphics");return o(t.module)?{source:new t.module.GraphicsSnappingSource({spatialReference:this.spatialReference,view:this.view,layerSource:e})}:{loading:t.loader}}_getSourceModule(e){const t=this.sourceModules[e];if(s(t.loader)){const r=this._loadSourceModule(e).then((e=>{t.module=e}));return t.loader=r,{module:t.module,loader:r}}return{module:t.module,loader:t.loader}}_loadSourceModule(e){switch(e){case"featureService":return this.updatingHandles.addPromise(import("./featureSources/FeatureServiceSnappingSource.js"));case"featureCollection":return this.updatingHandles.addPromise(import("./featureSources/FeatureCollectionSnappingSource.js"));case"graphics":return this.updatingHandles.addPromise(import("./featureSources/GraphicsSnappingSource.js"))}return null}};e([d({constructOnly:!0})],C.prototype,"spatialReference",void 0),e([d({constructOnly:!0})],C.prototype,"view",void 0),e([d()],C.prototype,"options",void 0),e([d({readOnly:!0})],C.prototype,"updating",null),e([d({readOnly:!0})],C.prototype,"snappingSources",null),C=e([h("esri.views.interactive.snapping.FeatureSnappingEngine")],C);class H{constructor(e,t){this.snappingSource=e,this.layerView=t,this.handles=new r;const i=this.snappingSource.layerSource.layer;if("refresh"in i){const t=i;this.handles.add(t.on("refresh",(()=>e.refresh())))}this.handles.add([l((()=>e.updating),(t=>e.layerSource.updating=t),p),l((()=>e.availability),(t=>e.layerSource.availability=t),p)])}destroy(){this.snappingSource.destroy(),this.handles.destroy()}}const M=g();export{C as FeatureSnappingEngine};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{unwrap as e}from"../../../core/maybe.js";import{a as t}from"../../../chunks/vec2f64.js";import{SnappingAlgorithm as o}from"./SnappingAlgorithm.js";import{
|
|
5
|
+
import{unwrap as e}from"../../../core/maybe.js";import{a as t}from"../../../chunks/vec2f64.js";import{SnappingAlgorithm as o}from"./SnappingAlgorithm.js";import{squareDistance as r}from"./snappingUtils.js";import{LineSnappingCandidate as s}from"./candidates/LineSnappingCandidate.js";import{anyMapPointToScreenPoint as i}from"../support/viewUtils.js";import{projectPointToLine as n}from"../../support/geometry2dUtils.js";class d extends o{snapNewVertex(e,t){const o=t.editGeometryOperations.data.components[0],r=o.edges.length,s=[];if(r<1)return s;const n=t.coordinateHelper,d=i(e,n,t.elevationInfo,this.view),p=o.edges[r-1];let a=p;do{this.edgeExceedsShortLineThreshold(a,t)&&this._processCandidateProposal(a.leftVertex.pos,a.rightVertex.pos,e,d,t,s),a=a.leftVertex.leftEdge}while(a&&a!==p);return s}snapExistingVertex(t,o){const r=[],s=e(o.vertexHandle),n=s.component;if(n.edges.length<2)return r;const d=o.coordinateHelper,p=i(t,d,o.elevationInfo,this.view),a=s.leftEdge,h=s.rightEdge;a&&h&&this.edgeExceedsShortLineThreshold(a,o)&&this.edgeExceedsShortLineThreshold(h,o)&&this._processCandidateProposal(a.leftVertex.pos,h.rightVertex.pos,t,p,o,r);const l=n.edges[0];let g=l;do{g!==s.leftEdge&&g!==s.rightEdge&&this.edgeExceedsShortLineThreshold(g,o)&&this._processCandidateProposal(g.leftVertex.pos,g.rightVertex.pos,t,p,o,r),g=g.rightVertex.rightEdge}while(g&&g!==l);return r}_processCandidateProposal(e,o,d,p,a,h){const l=n(t(),d,e,o),{coordinateHelper:g,elevationInfo:c,pointer:f}=a,m=g.fromXYZ(l,g.getZ(d,0));r(p,i(m,g,c,this.view))<this.squaredProximityTreshold(f)&&h.push(new s({coordinateHelper:g,lineStart:e,lineEnd:o,targetPoint:m,elevationInfo:c}))}}export{d as LineSnapper};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{unwrap as e}from"../../../core/maybe.js";import{s as t}from"../../../chunks/vec2.js";import{a as r}from"../../../chunks/vec2f64.js";import{defaults as o}from"./Settings.js";import{SnappingAlgorithm as i}from"./SnappingAlgorithm.js";import{
|
|
5
|
+
import{unwrap as e}from"../../../core/maybe.js";import{s as t}from"../../../chunks/vec2.js";import{a as r}from"../../../chunks/vec2f64.js";import{defaults as o}from"./Settings.js";import{SnappingAlgorithm as i}from"./SnappingAlgorithm.js";import{squareDistance as s}from"./snappingUtils.js";import{ParallelLineSnappingCandidate as n}from"./candidates/ParallelLineSnappingCandidate.js";import{anyMapPointToScreenPoint as l}from"../support/viewUtils.js";import{projectPointToLine as a}from"../../support/geometry2dUtils.js";class c extends i{constructor(){super(...arguments),this._tmpProjection=r()}snapNewVertex(e,t){const r=t.editGeometryOperations.data.components[0],o=r.edges.length,i=r.vertices.length,s=[];if(o<2)return s;const n=l(e,t.coordinateHelper,t.elevationInfo,this.view),a=r.vertices[i-1],c=r.vertices[0],h=r.edges[o-1];let p=h;do{this.edgeExceedsShortLineThreshold(p,t)&&(this._checkEdgeForParalleLines(p,a.pos,e,n,t,s),this._checkEdgeForParalleLines(p,c.pos,e,n,t,s)),p=p.leftVertex.leftEdge}while(p&&p!==h);return s}snapExistingVertex(t,r){const o=[],i=e(r.vertexHandle),s=i.component;if(s.edges.length<3)return o;const n=l(t,r.coordinateHelper,r.elevationInfo,this.view),a=i.leftEdge,c=i.rightEdge,h=s.vertices[0],p=s.vertices.length,d=s.vertices[p-1],g=s.edges[0];let m=g;do{m!==a&&m!==c&&this.edgeExceedsShortLineThreshold(m,r)&&(a&&this._checkEdgeForParalleLines(m,a.leftVertex.pos,t,n,r,o),c&&this._checkEdgeForParalleLines(m,c.rightVertex.pos,t,n,r,o),i===h?this._checkEdgeForParalleLines(m,d.pos,t,n,r,o):i===d&&this._checkEdgeForParalleLines(m,h.pos,t,n,r,o)),m=m.rightVertex.rightEdge}while(m&&m!==g);return o}_checkEdgeForParalleLines(e,r,i,c,h,p){const d=e.leftVertex.pos,g=e.rightVertex.pos;if(a(this._tmpProjection,r,d,g),t(this._tmpProjection,r)<o.parallelLineThreshold)return;a(this._tmpProjection,i,d,g,r);const{coordinateHelper:m,elevationInfo:f,pointer:v}=h,P=m.fromXYZ(this._tmpProjection,m.getZ(i,0));if(s(c,l(P,m,f,this.view))<this.squaredProximityTreshold(v)){if(this._parallelToPreviousCandidate(e,p))return;p.push(new n({coordinateHelper:m,referenceLine:e,lineStart:r,targetPoint:P,elevationInfo:f}))}}_parallelToPreviousCandidate(e,r){const i=e.leftVertex.pos,s=e.rightVertex.pos;for(const n of r)if(a(this._tmpProjection,s,n.constraint.start,n.constraint.end,i),t(this._tmpProjection,s)<o.parallelLineThreshold)return n.addReferenceLine(e),!0;return!1}}export{c as ParallelLineSnapper};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{unwrap as e}from"../../../core/maybe.js";import{g as t,h as r,u as i,v as o}from"../../../chunks/vec2.js";import{a as s,f as n}from"../../../chunks/vec2f64.js";import{SnappingAlgorithm as p}from"./SnappingAlgorithm.js";import{RayConstraint as g}from"./SnappingConstraint.js";import{
|
|
5
|
+
import{unwrap as e}from"../../../core/maybe.js";import{g as t,h as r,u as i,v as o}from"../../../chunks/vec2.js";import{a as s,f as n}from"../../../chunks/vec2f64.js";import{SnappingAlgorithm as p}from"./SnappingAlgorithm.js";import{RayConstraint as g}from"./SnappingConstraint.js";import{squareDistance as h}from"./snappingUtils.js";import{RightAngleSnappingCandidate as a,OtherVertexType as d}from"./candidates/RightAngleSnappingCandidate.js";import{anyMapPointToScreenPoint as c}from"../support/viewUtils.js";class f extends p{constructor(){super(...arguments),this._tmp=s()}snapNewVertex(e,t){const r=t.editGeometryOperations.data.components[0],i=r.vertices.length,o=[];if(i<2)return o;const s=c(e,t.coordinateHelper,t.elevationInfo,this.view),n=r.vertices[i-1];this._checkForSnappingCandidate(o,n.leftEdge,n.pos,e,n.leftEdge.leftVertex.pos,n.pos,t,e,s);const p=r.vertices[0];return this._checkForSnappingCandidate(o,p.rightEdge,p.pos,e,p.rightEdge.rightVertex.pos,p.pos,t,e,s),o}snapExistingVertex(t,r){const i=[],o=e(r.vertexHandle),s=o.component,n=s.vertices.length;if(n<3)return i;const p=c(t,r.coordinateHelper,r.elevationInfo,this.view),g=o.leftEdge,h=o.rightEdge,a=s.vertices[0],d=s.vertices[n-1];if(!g)return this._checkForSnappingCandidate(i,a.rightEdge.rightVertex.rightEdge,a.rightEdge.rightVertex.pos,t,a.rightEdge.rightVertex.rightEdge.rightVertex.pos,a.rightEdge.rightVertex.pos,r,t,p),i;if(!h)return this._checkForSnappingCandidate(i,d.leftEdge.leftVertex.leftEdge,d.leftEdge.leftVertex.pos,t,d.leftEdge.leftVertex.leftEdge.leftVertex.pos,d.leftEdge.leftVertex.pos,r,t,p),i;if(g&&g.leftVertex.leftEdge){const e=g.leftVertex.leftEdge;this._checkForSnappingCandidate(i,e,g.leftVertex.pos,t,e.leftVertex.pos,g.leftVertex.pos,r,t,p)}if(h&&h.rightVertex.rightEdge){const e=h.rightVertex.rightEdge;this._checkForSnappingCandidate(i,e,h.rightVertex.pos,t,e.rightVertex.pos,h.rightVertex.pos,r,t,p)}return i}_checkForSnappingCandidate(e,p,f,l,x,V,m,E,v){if(!this.edgeExceedsShortLineThreshold(p,m))return;t(this._tmp,p.rightVertex.pos,p.leftVertex.pos);const u=n(this._tmp[1],-this._tmp[0]),_=r(u,t(this._tmp,l,f))/i(u),{coordinateHelper:S,elevationInfo:C,pointer:k}=m,j=S.fromXYZ(o(s(),V,u,_),S.getZ(E,0));h(v,c(j,S,C,this.view))<this.squaredProximityTreshold(k)&&e.push(new a({coordinateHelper:S,targetPoint:j,constraint:new g(S,V,o(S.createVector(),V,u,Math.sign(_))),previousVertex:x,otherVertex:V,otherVertexType:d.CENTER,elevationInfo:C}))}}export{f as RightAngleSnapper};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{unwrap as e}from"../../../core/maybe.js";import{l as t,j as o}from"../../../chunks/vec2.js";import{a as r}from"../../../chunks/vec2f64.js";import{SnappingAlgorithm as s}from"./SnappingAlgorithm.js";import{
|
|
5
|
+
import{unwrap as e}from"../../../core/maybe.js";import{l as t,j as o}from"../../../chunks/vec2.js";import{a as r}from"../../../chunks/vec2f64.js";import{SnappingAlgorithm as s}from"./SnappingAlgorithm.js";import{squareDistance as i}from"./snappingUtils.js";import{RightAngleTriangleSnappingCandidate as n}from"./candidates/RightAngleTriangleSnappingCandidate.js";import{anyMapPointToScreenPoint as p}from"../support/viewUtils.js";import{projectPointToCircle as a}from"../../support/geometry2dUtils.js";class d extends s{snapNewVertex(e,t){const o=t.editGeometryOperations.data.components[0],r=[],s=o.vertices.length;if("polygon"!==t.editGeometryOperations.data.type||s<2)return r;const i=o.vertices[0],n=o.vertices[s-1];return this._processCandidateProposal(i.pos,n.pos,e,t,r),r}snapExistingVertex(t,o){const r=[],s=e(o.vertexHandle),i=s.component;return i.edges.length<2?r:"polyline"!==o.editGeometryOperations.data.type||0!==s.index&&s.index!==i.vertices.length-1?(this._processCandidateProposal(s.leftEdge.leftVertex.pos,s.rightEdge.rightVertex.pos,t,o,r),r):r}_processCandidateProposal(e,s,d,l,m){if(!this.exceedsShortLineThreshold(e,s,l))return;const c=t(r(),e,s,.5),g=.5*o(e,s),h=a(r(),d,c,g),{coordinateHelper:f,elevationInfo:v,pointer:x}=l,u=f.fromXYZ(h,f.getZ(d,0)),y=p(d,f,v,this.view);i(y,p(u,f,v,this.view))<this.squaredProximityTreshold(x)&&m.push(new n({coordinateHelper:f,targetPoint:u,point1:e,point2:s,elevationInfo:v}))}}export{d as RightAngleTriangleSnapper};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as e}from"../../../core/maybe.js";import{defaults as t}from"./Settings.js";import{squareDistance as r
|
|
5
|
+
import{isSome as e}from"../../../core/maybe.js";import{defaults as t}from"./Settings.js";import{squareDistance as r}from"./snappingUtils.js";import{anyMapPointToScreenPoint as s}from"../support/viewUtils.js";class i{constructor(e,r){this.view=e,this.options=r,this.squaredShortLineThreshold=t.shortLineThreshold*t.shortLineThreshold}snap(t,r){return e(r.vertexHandle)?"vertex"!==r.vertexHandle.type?[]:this.snapExistingVertex(t,r):this.snapNewVertex(t,r)}edgeExceedsShortLineThreshold(e,t){return this.exceedsShortLineThreshold(e.leftVertex.pos,e.rightVertex.pos,t)}exceedsShortLineThreshold(e,t,{elevationInfo:i,editGeometryOperations:o}){const h=o.data.coordinateHelper;return 0===this.squaredShortLineThreshold||r(s(t,h,i,this.view),s(e,h,i,this.view))>this.squaredShortLineThreshold}squaredProximityTreshold(e){return"touch"===e?this.squaredTouchProximityThreshold:this.squaredMouseProximityTreshold}get squaredMouseProximityTreshold(){return this.options.distance*this.options.distance}get squaredTouchProximityThreshold(){const{distance:e,touchSensitivityMultiplier:t}=this.options,r=e*t;return r*r}}export{i as SnappingAlgorithm};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Evented.js";import{HandleOwner as i}from"../../../core/HandleOwner.js";import{isSome as n}from"../../../core/maybe.js";import{isAborted as s}from"../../../core/promiseUtils.js";import{watch as o,sync as r,syncAndInitial as a}from"../../../core/reactiveUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{s as h}from"../../../chunks/vec2.js";import p from"../../../geometry/SpatialReference.js";import{FeatureSnappingEngine as l}from"./FeatureSnappingEngine.js";import{SelfSnappingEngine as u}from"./SelfSnappingEngine.js";import f from"./SnappingOptions.js";import{squareDistance as v,
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Evented.js";import{HandleOwner as i}from"../../../core/HandleOwner.js";import{isSome as n}from"../../../core/maybe.js";import{isAborted as s}from"../../../core/promiseUtils.js";import{watch as o,sync as r,syncAndInitial as a}from"../../../core/reactiveUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as c}from"../../../core/accessorSupport/decorators/subclass.js";import{s as h}from"../../../chunks/vec2.js";import p from"../../../geometry/SpatialReference.js";import{FeatureSnappingEngine as l}from"./FeatureSnappingEngine.js";import{SelfSnappingEngine as u}from"./SelfSnappingEngine.js";import f from"./SnappingOptions.js";import{squareDistance as v,sortCandidatesInPlace as m}from"./snappingUtils.js";import{IntersectionSnappingCandidate as g}from"./candidates/IntersectionSnappingCandidate.js";import{anyMapPointToScreenPoint as _}from"../support/viewUtils.js";let y=class extends(e.EventedMixin(i)){constructor(t){super(t),this.options=new f,this.engines=[],this._currentMainCandidate=null,this._currentOtherActiveCandidates=[]}initialize(){this.handles.add([o((()=>{const{effectiveFeatureEnabled:t,effectiveSelfEnabled:e,touchSensitivityMultiplier:i,distance:n}=this.options;return{effectiveFeatureEnabled:t,effectiveSelfEnabled:e,touchSensitivityMultiplier:i,distance:n}}),(()=>{this.doneSnapping(),this.emit("changed")}),r),o((()=>this.options),(t=>{for(const e of this.engines)e.options=t}),r),o((()=>({ready:this.view.ready,spatialReference:this.view.spatialReference})),(({ready:t,spatialReference:e})=>this._onViewChange(t,e)),a)])}destroy(){this._destroyEngines()}get updating(){return this.engines.some((t=>t.updating))}_onViewChange(t,e){this._destroyEngines(),t&&(this.engines=[new u({view:this.view,options:this.options}),new l({view:this.view,spatialReference:e??p.WGS84,options:this.options})])}_destroyEngines(){for(const t of this.engines)t.destroy();this.engines.length=0}get squaredMouseProximityTreshold(){return this.options.distance*this.options.distance}get squaredTouchProximityThreshold(){const{distance:t,touchSensitivityMultiplier:e}=this.options,i=t*e;return i*i}async snap(t,e,i){const o=e.coordinateHelper.pointToVector(t),r=await this._fetchCandidates(o,e,i);return{get valid(){return!s(i)},apply:()=>{const{snappedPoint:t,hints:i}=this._processCandidates(o,r,e);return this._removeVisualization(),n(e.visualizer)&&this.handles.add(e.visualizer.draw(i,{coordinateHelper:e.coordinateHelper,elevationInfo:e.elevationInfo,view:this.view}),C),t}}}update(t,e){this._removeVisualization();let i=t;const s=[];if(n(this._currentMainCandidate)){const n=e.coordinateHelper,o=n.pointToVector(t),r=this._currentMainCandidate.constraint.closestTo(o);if(v(_(o,n,e.elevationInfo,this.view),_(r,n,e.elevationInfo,this.view))<this._squaredPointProximityThreshold(e.pointer)){i=n.vectorToDehydratedPoint(r),this._currentMainCandidate.targetPoint=r,s.push(...this._currentMainCandidate.hints);for(const t of this._currentOtherActiveCandidates)t.targetPoint=r,s.push(...t.hints)}else this._currentMainCandidate=null,this._currentOtherActiveCandidates=[]}return n(e.visualizer)&&this.handles.add(e.visualizer.draw(s,{coordinateHelper:e.coordinateHelper,elevationInfo:e.elevationInfo,view:this.view}),C),i}doneSnapping(){this._removeVisualization(),this._currentMainCandidate=null,this._currentOtherActiveCandidates=[]}_removeVisualization(){this.handles.remove(C)}async _fetchCandidates(t,e,i){return(await Promise.all(this.engines.map((n=>n.fetchCandidates(t,e,i))))).flat()}_processCandidates(t,e,i){if(e.length<1)return this.doneSnapping(),{snappedPoint:i.coordinateHelper.vectorToDehydratedPoint(t),hints:[]};m(t,e);const s=this._currentMainCandidate;if(n(s)){const n=this._findOldConstraintInNewCandidates(s,e);if(n>=0){if(!(e[n]instanceof g))return this._intersectWithOtherCandidates(n,e,t,i);if(h(t,s.targetPoint)<this._squaredPointProximityThreshold(i.pointer))return this._updateSnappingCandidate(s,e,i)}}return this._intersectWithOtherCandidates(0,e,t,i)}_findOldConstraintInNewCandidates(t,e){return t instanceof g?this._findOldCandidateIndex(e,t.first)>=0&&this._findOldCandidateIndex(e,t.second)>=0?0:-1:this._findOldCandidateIndex(e,t)}_intersectWithOtherCandidates(t,e,i,n){const s=e[t],o=[],r=n.coordinateHelper;for(let a=0;a<e.length;++a){if(a===t)continue;const d=e[a];for(const t of s.constraint.intersect(d.constraint)){const e=r.fromXYZ(t.intersection,s.targetPoint[2]);o.push([new g(r,e,s,d,d.elevationInfo),v(_(i,n.coordinateHelper,n.elevationInfo,this.view),_(e,n.coordinateHelper,n.elevationInfo,this.view))])}}return o.length>0&&(o.sort(((t,e)=>t[1]-e[1])),o[0][1]<this._squaredPointProximityThreshold(n.pointer))?this._updateSnappingCandidate(o[0][0],e,n):this._updateSnappingCandidate(s,e,n)}_updateSnappingCandidate(t,e,i){this.doneSnapping(),this._currentMainCandidate=t;const n=this._currentMainCandidate.targetPoint,s=[];s.push(...t.hints);for(const o of e){if(t instanceof g){if(o.constraint.objectEqual(t.first.constraint)||o.constraint.objectEqual(t.second.constraint))continue}else if(o.constraint.objectEqual(t.constraint))continue;o.constraint.check(n)&&(o.targetPoint=n,this._currentOtherActiveCandidates.push(o),s.push(...o.hints))}return{snappedPoint:i.coordinateHelper.vectorToDehydratedPoint(n),hints:s}}_squaredPointProximityThreshold(t){return"touch"===t?this.squaredTouchProximityThreshold:this.squaredMouseProximityTreshold}_findOldCandidateIndex(t,e){let i=-1;for(let n=0;n<t.length;++n)if(e.constraint.objectEqual(t[n].constraint)){i=n;break}return i}get test(){return{visualizationsActive:this.handles.has(C),engines:this.engines}}};t([d({constructOnly:!0})],y.prototype,"view",void 0),t([d()],y.prototype,"options",void 0),t([d({readOnly:!0})],y.prototype,"updating",null),t([d()],y.prototype,"engines",void 0),t([d()],y.prototype,"squaredMouseProximityTreshold",null),t([d()],y.prototype,"squaredTouchProximityThreshold",null),y=t([c("esri.views.interactive.snapping.SnappingManager")],y);const C="visualization-handle";export{y as SnappingManager};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Evented.js";import i from"../../../../../core/Handles.js";import{isSome as r}from"../../../../../core/maybe.js";import{createDeferred as s,throwIfAborted as a}from"../../../../../core/promiseUtils.js";import{whenOnce as
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Evented.js";import i from"../../../../../core/Handles.js";import{isSome as r}from"../../../../../core/maybe.js";import{createDeferred as s,throwIfAborted as a}from"../../../../../core/promiseUtils.js";import{watch as n,whenOnce as o,sync as p}from"../../../../../core/reactiveUtils.js";import{property as u}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as l}from"../../../../../core/accessorSupport/decorators/subclass.js";import{WatchUpdatingTracking as c}from"../../../../../core/support/WatchUpdatingTracking.js";import d from"../../../../../geometry/SpatialReference.js";import h from"../../../../../layers/graphics/data/FeatureStore.js";import{QueryEngine as f}from"../../../../../layers/graphics/data/QueryEngine.js";import m from"../../../../../layers/support/TileInfo.js";import g from"../../../../../layers/support/TimeInfo.js";import y from"../../../../../rest/support/Query.js";import{FeatureServiceTiledFetcher as S}from"./FeatureServiceTiledFetcher.js";import{FeatureServiceTileStore as F}from"./FeatureServiceTileStore.js";let I=class extends t.EventedAccessor{constructor(){super(...arguments),this.isInitializing=!0,this.whenSetup=s(),this.handles=new i,this.updatingHandles=new c,this.pendingApplyEdits=new Map}get updating(){return this.featureFetcher.updating||this.isInitializing||this.updatingHandles.updating}destroy(){this.featureFetcher.destroy(),this.queryEngine.destroy(),this.featureStore.clear(),this.handles.destroy()}async setup(e){const{geometryType:t,objectIdField:i,timeInfo:r,fields:s}=e.serviceInfo;return this.featureStore=new h({...e.serviceInfo,hasZ:!1,hasM:!1}),this.queryEngine=new f({spatialReference:e.spatialReference,featureStore:this.featureStore,geometryType:t,fields:s,hasZ:!1,hasM:!1,objectIdField:i,timeInfo:r?g.fromJSON(r):null}),this.featureFetcher=new S({store:new F({featureStore:this.featureStore}),url:e.serviceInfo.url,objectIdField:e.serviceInfo.objectIdField,globalIdField:e.serviceInfo.globalIdField,capabilities:e.serviceInfo.capabilities,spatialReference:d.fromJSON(e.spatialReference),sourceSpatialReference:d.fromJSON(e.serviceInfo.spatialReference)}),this.handles.add([n((()=>this.featureFetcher.availability),(e=>this.emit("notify-availability",{availability:e})),p),n((()=>this.updating),(()=>this._notifyUpdating()))]),this.whenSetup.resolve(),this.isInitializing=!1,this.configure(e.configuration)}async configure(e){return await this.updatingHandles.addPromise(this.whenSetup.promise),this._updateFeatureFetcherConfiguration(e),{result:{}}}async fetchCandidates(e,t){await this.whenSetup.promise,a(t);return{result:await this.queryEngine.executeQueryForSnapping({point:e.point,distance:e.distance,types:e.types,query:r(e.filter)?e.filter:{where:"1=1"}},r(t)?t.signal:null)}}async updateTiles(e,t){return await this.updatingHandles.addPromise(this.whenSetup.promise),a(t),this.featureFetcher.tileSize=e.tileSize,this.featureFetcher.tilesOfInterest=e.tiles,this.featureFetcher.tileInfo=r(e.tileInfo)?m.fromJSON(e.tileInfo):null,{result:{}}}async refresh(e,t){return await this.updatingHandles.addPromise(this.whenSetup.promise),a(t),this.featureFetcher.refresh(),{result:{}}}async whenNotUpdating(e,t){return await this.updatingHandles.addPromise(this.whenSetup.promise),a(t),await o((()=>!this.updating),t),a(t),{result:{}}}async getDebugInfo(e,t){return a(t),{result:this.featureFetcher.debugInfo}}async beginApplyEdits(e,t){this.updatingHandles.addPromise(this.whenSetup.promise),a(t);const i=s();return this.pendingApplyEdits.set(e.id,i),this.featureFetcher.applyEdits(i.promise),this.updatingHandles.addPromise(i.promise),{result:{}}}async endApplyEdits(e,t){const i=this.pendingApplyEdits.get(e.id);return i&&i.resolve(e.edits),a(t),{result:{}}}_updateFeatureFetcherConfiguration(e){this.featureFetcher.filter=r(e.filter)?y.fromJSON(e.filter):null,this.featureFetcher.customParameters=e.customParameters}_notifyUpdating(){this.emit("notify-updating",{updating:this.updating})}};function w(){return new I}e([u({readOnly:!0})],I.prototype,"updating",null),e([u()],I.prototype,"isInitializing",void 0),I=e([l("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceSnappingSourceWorker")],I);export{I as FeatureServiceSnappingSourceWorker,w 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.24/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{s as t}from"../../../chunks/vec2.js";function E(t,E){const n=t.x-E.x,r=t.y-E.y;return n*n+r*r}function n(t,E){const n=t.length===E.length&&t[0]===E[0]&&t[1]===E[1];switch(t.length){case 2:return n;case 3:return n&&t[2]===E[2];case 4:return n&&t[3]===E[3]}return!1}function r(E,n){n.sort(((n,r)=>t(n.targetPoint,E)-t(r.targetPoint,E)))}var e;!function(t){t[t.TARGET=0]="TARGET",t[t.REFERENCE=1]="REFERENCE",t[t.REFERENCE_EXTENSION=2]="REFERENCE_EXTENSION"}(e||(e={}));export{e as LineSegmentHintType,n as objectEqual,r as sortCandidatesInPlace,E as squareDistance};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{createScreenPoint as e,createRenderScreenPointArray3 as r,createScreenPointArray as o}from"../../../core/screenUtils.js";import{g as t,i as n,s as c}from"../../../chunks/vec2.js";import{c as s}from"../../../chunks/vec3f64.js";import a from"../../../geometry/Point.js";import{getConvertedElevationFromVector as i}from"../../../support/elevationInfoUtils.js";function p(e,r,o,c){o.projectToRenderScreen(e,h),o.projectToRenderScreen(r,C),t(c,C,h),n(c,c)}function f(e,r,o){return Math.sqrt(l(e,r,o))}function l(e,r,o){const{camera:t}=o.state;return t.projectToScreen(e,S),t.projectToScreen(r,T),c(S,T)}function d(e,r,o,t,n=s()){const c=r.toXYZ(e);return c[2]=i(t,c,r.spatialReference,o)||0,t.renderCoordsHelper.toRenderCoords(c,r.spatialReference,n),n}function u(r,o,t,n){return"2d"===n.type?n.toScreen(o.vectorToPoint(r,R)):(d(r,o,t,n,j),n.state.camera.projectToScreen(j,S),e(S[0],S[1]))}function m(e,r,o,t,n,c,s){const a=o.toXYZ(e),p=o.toXYZ(r);if("absolute-height"!==t.mode){const e=i(n,a,o.spatialReference,t),r=i(n,p,o.spatialReference,t),c=(null==e?r:null==r?e:Math.min(e,r))||0;a[2]=c,p[2]=c}n.renderCoordsHelper.toRenderCoords(a,o.spatialReference,c),n.renderCoordsHelper.toRenderCoords(p,o.spatialReference,s)}const R=new a,j=s(),h=r(),C=r(),S=o(),T=o();export{d as anyMapPointToRender,u as anyMapPointToScreenPoint,m as anyMapPointsToRenderWithEqualRelativeZ,p as renderScreenSpaceTangent,f as screenDistance,l as screenDistanceSquared};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as o}from"../../../chunks/tslib.es6.js";import r from"../../../core/Accessor.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import{subclass as s}from"../../../core/accessorSupport/decorators/subclass.js";let e=class extends r{constructor(o){super(o),this.type="draw-point"}};o([t()],e.prototype,"type",void 0),o([t()],e.prototype,"elevation",void 0),e=o([s("esri.views.interactive.tooltip.DrawPointTooltipInfo")],e);export{e as DrawPointTooltipInfo};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as o}from"../../../chunks/tslib.es6.js";import r from"../../../core/Accessor.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.js";let s=class extends r{constructor(o){super(o),this.type="draw-polygon"}};o([t()],s.prototype,"type",void 0),o([t()],s.prototype,"elevation",void 0),o([t()],s.prototype,"area",void 0),s=o([e("esri.views.interactive.tooltip.DrawPolygonTooltipInfo")],s);export{s as DrawPolygonTooltipInfo};
|