@arcgis/core 5.0.0-next.3 → 5.0.0-next.5
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/Map.js +1 -1
- package/analysis/ElevationProfileAnalysis.js +1 -1
- package/analysis/VolumeMeasurement/volumeMeasurementConfiguration.js +1 -1
- package/applications/KnowledgeStudio/generalSdkInternalAccess.d.ts +4 -0
- package/applications/KnowledgeStudio/generalSdkInternalAccess.js +5 -0
- package/applications/KnowledgeStudio/generalSharedKgUtils.d.ts +1 -0
- package/applications/KnowledgeStudio/generalSharedKgUtils.js +1 -1
- package/applications/KnowledgeStudio/layerInternalAccessUtils.d.ts +2 -0
- package/applications/KnowledgeStudio/layerInternalAccessUtils.js +1 -1
- package/applications/KnowledgeStudio/resourceSerializationUtils.js +1 -1
- package/assets/components/assets/sort-handle/t9n/messages.uk.json +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0366b78b0ccf4ed5f6ac.js +1 -0
- package/assets/esri/core/workers/chunks/037b2548bf85e2d7c6ac.js +1 -0
- package/assets/esri/core/workers/chunks/{c0feec6e2f0e45900ae0.js → 0686243904381ef863dc.js} +1 -1
- package/assets/esri/core/workers/chunks/06ba43843e9c4988049b.js +1 -0
- package/assets/esri/core/workers/chunks/0f100e163e1847e04155.js +1 -0
- package/assets/esri/core/workers/chunks/{388482cea4b9fdeaf06e.js → 0f30a9514571c7be9978.js} +1 -1
- package/assets/esri/core/workers/chunks/0f8847f9ae3068833fa4.js +1 -0
- package/assets/esri/core/workers/chunks/{14ace5dc4b8984212a57.js → 17d5f8dba6ebb1184506.js} +1 -1
- package/assets/esri/core/workers/chunks/{b2add7338258ca7c24dd.js → 1da74aa308ded5748ef5.js} +1 -1
- package/assets/esri/core/workers/chunks/{651b9144abb1895cc510.js → 1e848d9da1c61a27cf18.js} +1 -1
- package/assets/esri/core/workers/chunks/1eedac33c9fcd7681427.js +1 -0
- package/assets/esri/core/workers/chunks/239377336a2009caea01.js +1 -0
- package/assets/esri/core/workers/chunks/285762ff92d5388b6024.js +1 -0
- package/assets/esri/core/workers/chunks/{40b81d1c2d53cf598b8e.js → 2f03d33f4ca8a48461fc.js} +1 -1
- package/assets/esri/core/workers/chunks/{4f01be74dd26e639330f.js → 2f24017e72d41c259faa.js} +1 -1
- package/assets/esri/core/workers/chunks/3271614322ba4b44fb5a.js +1 -0
- package/assets/esri/core/workers/chunks/36b1f47d70b57d79df7b.js +1 -0
- package/assets/esri/core/workers/chunks/{3d65b8a2fbe1df050a25.js → 377a66034e7c1bad5599.js} +1 -1
- package/assets/esri/core/workers/chunks/37f2ef14399546e697e6.js +1 -0
- package/assets/esri/core/workers/chunks/{0f9bb3187306f89e3d63.js → 398f356b11fd33bd3831.js} +1 -1
- package/assets/esri/core/workers/chunks/3a457e718a901a45902e.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/4442817beb7a76c95770.js +1 -0
- package/assets/esri/core/workers/chunks/4c5a7249a311070d8f43.js +1 -0
- package/assets/esri/core/workers/chunks/551c6c89b51b99f4864b.js +1 -0
- package/assets/esri/core/workers/chunks/{9a723d739ac44b45432c.js → 557960763695abee4a83.js} +1 -1
- package/assets/esri/core/workers/chunks/655360995c1cbc78a5a3.js +1 -0
- package/assets/esri/core/workers/chunks/67d9cfe02613cb73ee37.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/6a69dafeb7c9ca8a3d84.js +1 -0
- package/assets/esri/core/workers/chunks/6c3b99209d542efa64d4.js +1 -0
- package/assets/esri/core/workers/chunks/{8215015f11221a354273.js → 6d049182bec34a22abcd.js} +1 -1
- package/assets/esri/core/workers/chunks/71762199aef5d3107da2.js +1 -0
- package/assets/esri/core/workers/chunks/72c851c400752094b162.js +1 -0
- package/assets/esri/core/workers/chunks/7558919912f7fdc4837b.js +1 -0
- package/assets/esri/core/workers/chunks/7596d005a4dc3964b140.js +1 -0
- package/assets/esri/core/workers/chunks/762fe93015b705546188.js +1 -0
- package/assets/esri/core/workers/chunks/79dbfa2b9b332ca0002f.js +1 -0
- package/assets/esri/core/workers/chunks/7a23ab84e1144f081c92.js +1 -0
- package/assets/esri/core/workers/chunks/{2a5f331c0f18d8574b4e.js → 811d4c46c75cf6a63e78.js} +1 -1
- package/assets/esri/core/workers/chunks/829bc5dbda2f51561446.js +1 -0
- package/assets/esri/core/workers/chunks/8372f142c4d7a65c7954.js +1 -0
- package/assets/esri/core/workers/chunks/8605ec4678eb4511c715.js +1 -0
- package/assets/esri/core/workers/chunks/883ffaa69b3e6eb158bf.js +1 -0
- package/assets/esri/core/workers/chunks/{3d22fe2f2c40abbc246e.js → 88d942cd25bef74fd50a.js} +1 -1
- package/assets/esri/core/workers/chunks/{0086a09441627842d34a.js → 8f3503b2fb6cd38757b9.js} +1 -1
- package/assets/esri/core/workers/chunks/9786f91455350eaae493.js +1 -0
- package/assets/esri/core/workers/chunks/98311fec6c16a1b23586.js +1 -0
- package/assets/esri/core/workers/chunks/9c5cbf8810f37b1a4718.js +1 -0
- package/assets/esri/core/workers/chunks/a091623bbfb3d771c8d8.js +1 -0
- package/assets/esri/core/workers/chunks/a137c27ce078bea44f89.js +1 -0
- package/assets/esri/core/workers/chunks/a29d7205394cb8b2a847.js +1 -0
- package/assets/esri/core/workers/chunks/a2a284d4dd5caaecbc2e.js +1 -0
- package/assets/esri/core/workers/chunks/{135e270b4f03c4270870.js → a4db5c9a90107e097df8.js} +1 -1
- package/assets/esri/core/workers/chunks/a61cb4f1ca282bf8b75d.js +1 -0
- package/assets/esri/core/workers/chunks/a6ac1ff89c40f3a4797a.js +1 -0
- package/assets/esri/core/workers/chunks/{dc31865edea480f0ebba.js → a8c4fd779e454e4075c4.js} +1 -1
- package/assets/esri/core/workers/chunks/a8f998b8ec8c56150479.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/aa6eb55e4fb57c4e8eeb.js +1 -0
- package/assets/esri/core/workers/chunks/aa78b69219d9a0ef1c54.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/af3fc2562bb6d217adf6.js +1 -0
- package/assets/esri/core/workers/chunks/{46ef545d2b3b3f4e6d32.js → b017bac40dc8328013e3.js} +2 -2
- package/assets/esri/core/workers/chunks/{46ef545d2b3b3f4e6d32.js.LICENSE.txt → b017bac40dc8328013e3.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/b59f9c3f7a149214256f.js +1 -0
- package/assets/esri/core/workers/chunks/b96eb0ea506379182d62.js +2 -0
- package/assets/esri/core/workers/chunks/{24921d31efa8d222ad2d.js.LICENSE.txt → b96eb0ea506379182d62.js.LICENSE.txt} +1 -1
- package/assets/esri/core/workers/chunks/{b5863afafd3a7d2d5c05.js → bb5484b5eeacc9ad2ceb.js} +3 -3
- package/assets/esri/core/workers/chunks/bb56717c4e36f28d4c08.js +1 -0
- package/assets/esri/core/workers/chunks/bb7976e2f883b544add6.js +1 -0
- package/assets/esri/core/workers/chunks/c0b7e86860838638537f.js +1 -0
- package/assets/esri/core/workers/chunks/c134ebbaeac514cbd657.js +1 -0
- package/assets/esri/core/workers/chunks/c2b47a7dc961863d283f.js +1 -0
- package/assets/esri/core/workers/chunks/{0eaa4dccba0d844b9da3.js → c3ddcf9148dd2640c402.js} +1 -1
- package/assets/esri/core/workers/chunks/c476643002387f60ea42.js +1 -0
- package/assets/esri/core/workers/chunks/ce16489cf7eb0d78c741.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/d048e4926e78458afa3e.js +1 -0
- package/assets/esri/core/workers/chunks/d39a10155317e6f7a21c.js +1 -0
- package/assets/esri/core/workers/chunks/d6e0528eacee7ea4c1ce.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/d886fb97bdb348a16f25.js +1 -0
- package/assets/esri/core/workers/chunks/{00aa85ae6419aad183ea.js → dc4982b0ac007bd70213.js} +1 -1
- package/assets/esri/core/workers/chunks/e1258b6a404e58878c7a.js +1 -0
- package/assets/esri/core/workers/chunks/e31192ae920e3e19b6aa.js +1 -0
- package/assets/esri/core/workers/chunks/e6a86cad44056735ed26.js +1 -0
- package/assets/esri/core/workers/chunks/e82f5437bd66779c6740.js +1 -0
- package/assets/esri/core/workers/chunks/{039ec0fbe3b4b398b8c6.js → f26dc1d83beed63b6045.js} +1 -1
- package/assets/esri/core/workers/chunks/{fa5c87889c2f0bef896b.js → f35aaa04cca676c2d3f8.js} +1 -1
- package/assets/esri/core/workers/chunks/f5b7e7f2860a825ed373.js +1 -0
- package/assets/esri/core/workers/chunks/f651c05604eab83aef5f.js.LICENSE.txt +1 -1
- package/assets/esri/core/workers/chunks/{18da83afbc324fef9fd8.js → f779034623980bf9a37c.js} +2 -2
- package/assets/esri/libs/parquet/pkg/bundle_bg.wasm +0 -0
- package/assets/esri/themes/base/widgets/_Directions.scss +17 -18
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/ComponentShader.glsl.js +72 -39
- package/chunks/OITBlend.glsl.js +3 -3
- package/chunks/bundle.js +1 -1
- package/config.js +1 -1
- package/core/QueueProcessor.js +1 -1
- package/core/has.js +1 -1
- package/core/sanitizerUtils.js +1 -1
- package/core/workers/Connection.js +1 -1
- package/core/workers/WorkerHandle.js +1 -1
- package/core/workers/utils.js +1 -1
- package/geohash/GeohashCell.js +1 -1
- package/geohash/geohashUtils.js +1 -1
- package/geometry/GeometryCursor.js +1 -1
- package/geometry/geometryCursorCollectUtils.js +1 -1
- package/geometry/libtess.js +1 -1
- package/geometry/support/jsonUtils.js +1 -1
- package/geometry/support/normalizeUtilsSync.js +1 -1
- package/geometry/support/triangulationUtils.js +1 -1
- package/interfaces.d.ts +426 -347
- package/intl/date.js +1 -1
- package/intl.d.ts +2 -0
- package/intl.js +1 -1
- package/kernel.js +1 -1
- package/layers/FeatureLayer.js +1 -1
- package/layers/graphics/OptimizedFeature.js +1 -1
- package/layers/graphics/OptimizedGeometry.js +1 -1
- package/layers/graphics/centroid.js +1 -1
- package/layers/graphics/contains.js +1 -1
- package/layers/graphics/data/AttributesBuilder.js +1 -1
- package/layers/graphics/data/FeatureStore.js +1 -1
- package/layers/graphics/data/QueryEngine.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/data/geometryUtils.js +1 -1
- package/layers/graphics/data/spatialQuerySupport.js +1 -1
- package/layers/graphics/featureConversionUtils.js +1 -1
- package/layers/graphics/sources/OGCFeatureSource.js +1 -1
- package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
- package/layers/graphics/sources/geojson/geojson.js +1 -1
- package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/graphics/sources/support/clientSideDefaults.js +1 -1
- package/layers/knowledgeGraph/layerUtils.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/mixins/ImageryTileMixin.js +1 -1
- package/layers/support/PixelBlock.js +1 -1
- package/layers/support/RasterInfo.js +1 -1
- package/layers/support/RasterJobHandler.js +1 -1
- package/layers/support/RasterSensorInfo.js +1 -1
- package/layers/support/RasterStorageInfo.js +1 -1
- package/layers/support/RasterWorker.js +1 -1
- package/layers/support/TitleCreator.js +1 -1
- package/layers/support/arcgisLayerUrl.js +1 -1
- package/layers/support/capabilities.js +1 -1
- package/layers/support/rasterDatasets/BaseRaster.js +1 -1
- package/layers/support/rasterDatasets/pixelReader.js +1 -1
- package/layers/support/rasterFieldUtils.js +1 -1
- package/layers/support/rasterFunctions/pixelUtils.js +1 -1
- package/layers/support/serviceCapabilitiesUtils.js +1 -1
- package/package.json +5 -5
- package/request.js +1 -1
- package/rest/print.js +1 -1
- package/rest/query/operations/pbfDehydratedFeatureSet.js +1 -1
- package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
- package/rest/query/operations/query.js +1 -1
- package/rest/query/operations/queryZScale.js +1 -1
- package/rest/versionManagement/getVersionInfos.js +1 -1
- package/smartMapping/statistics/histogram.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
- package/smartMapping/support/utils.js +1 -1
- package/support/elevationInfoUtils.js +1 -1
- package/support/requestImageUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/GoToManager.js +1 -1
- package/views/2d/analysis/ElevationProfile/ElevationProfileLineVisualization2D.js +1 -1
- package/views/2d/engine/vectorTiles/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/engine/webgl/Mesh2D.js +1 -1
- package/views/2d/engine/webgl/brushes/WGLBrushVTLSymbol.js +1 -1
- package/views/2d/engine/webgl/mesh/templates/templateUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/fill/AFillMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/layers/features/aggregation/GridCell.js +1 -1
- package/views/2d/layers/features/processor/AAggregateStrategy.js +1 -1
- package/views/2d/layers/features/processor/BinningStrategy.js +1 -1
- package/views/2d/layers/features/processor/FeatureUpdateStrategy.js +1 -1
- package/views/2d/layers/features/processor/TrackStrategy.js +1 -1
- package/views/2d/layers/features/schema/SourceSchema.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/features/support/FeatureFilterEvaluator.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
- package/views/2d/layers/features/support/GraphicsReader.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/3d/FocusAreasView.js +1 -1
- package/views/3d/GroundView3D.js +1 -1
- package/views/3d/analysis/ElevationProfile/ElevationProfileLineSceneComputation.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
- package/views/3d/glTF/DefaultLoadingContext.js +1 -1
- package/views/3d/layers/FeatureLayerViewBase3D.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFeatureStore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/pipeline/featureSet/PBFPointFeatureSetView.js +1 -1
- package/views/3d/layers/graphics/pipeline/featureSet/TiledFeatureStore.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SQueryFeatureAdapter.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3DContext.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/layers/support/featureTileQuery3D.js +1 -1
- package/views/3d/state/ViewStateManager.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
- package/views/3d/state/controllers/RotateController.js +1 -1
- package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
- package/views/3d/state/controllers/ZoomControllerLocal.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerGlobal.js +1 -1
- package/views/3d/state/controllers/ZoomStepControllerLocal.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/support/DisplayQualityProfile.js +1 -1
- package/views/3d/support/QualitySettings.js +1 -1
- package/views/3d/support/StreamDataLoader.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
- package/views/3d/support/flow/FlowWorker.js +1 -1
- package/views/3d/support/flow/StreamlineResources3D.js +1 -1
- package/views/3d/support/flow/constants.js +1 -1
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/support/renderInfoUtils/polygon.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/terrain/TileOverlayData.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +7 -7
- package/views/3d/webgl-engine/core/shaderModules/BooleanDrawUniform.js +5 -0
- package/views/3d/webgl-engine/core/shaderTechnique/ShaderTechniqueConstructionContext.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillDepth.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/AnimatedLine.glsl.js +4 -4
- package/views/analysis/ElevationProfile/ElevationProfileController.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileLineInputComputation.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileResult.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
- package/views/analysis/ElevationProfile/elevationProfileGenerationUtils.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/reshapeUtils.js +1 -1
- package/views/interactive/dragEventPipeline.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileStore.js +1 -1
- package/views/webgl/ShaderBuilder.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Directions/css.js +1 -1
- package/widgets/Directions.js +1 -1
- package/widgets/Editor/AddAssociationWorkflow.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/Edits.js +1 -1
- package/widgets/Editor/MergeFeaturesWorkflow.d.ts +4 -0
- package/widgets/Editor/MergeFeaturesWorkflow.js +5 -0
- package/widgets/Editor/MergeFeaturesWorkflowData.d.ts +4 -0
- package/widgets/Editor/MergeFeaturesWorkflowData.js +5 -0
- package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
- package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/UpdateFeaturesWorkflowData.js +1 -1
- package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
- package/widgets/Editor/components/UploadDetails.js +1 -1
- package/widgets/Editor/support/EditorItem.js +1 -1
- package/widgets/Editor/support/mergeFeaturesUtils.js +5 -0
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/Feature/FeatureExpression.js +1 -1
- package/widgets/Feature/FeatureFields/FeatureFieldsViewModel.js +1 -1
- package/widgets/Feature/FeatureFields.js +1 -1
- package/widgets/Feature/FeatureMedia/FeatureMediaViewModel.js +1 -1
- package/widgets/Feature/FeatureMedia.js +1 -1
- package/widgets/Feature/FeatureViewModel.js +1 -1
- package/widgets/Feature/support/featureUtils.js +1 -1
- package/widgets/Feature.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/SequentialNavigationUI.js +1 -1
- package/widgets/OrientedImageryViewer/components/SketchTools.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/support/ColorPicker.js +1 -1
- package/widgets/support/SelectionList/LayerItem.js +1 -1
- package/widgets/support/jsxWidgetSupport.js +1 -1
- package/assets/esri/core/workers/chunks/065f2bbcaeef1f13fd48.js +0 -1
- package/assets/esri/core/workers/chunks/0731e588afd1f561ec3b.js +0 -1
- package/assets/esri/core/workers/chunks/188272af9a6470ccfe31.js +0 -1
- package/assets/esri/core/workers/chunks/1a9f544f20f643161a36.js +0 -1
- package/assets/esri/core/workers/chunks/1cfcadaa98ac528fea37.js +0 -1
- package/assets/esri/core/workers/chunks/1db0bf570a04687b3130.js +0 -1
- package/assets/esri/core/workers/chunks/24921d31efa8d222ad2d.js +0 -2
- package/assets/esri/core/workers/chunks/2a900a632a1231deb713.js +0 -1
- package/assets/esri/core/workers/chunks/31c6e951b99315e8e68a.js +0 -1
- package/assets/esri/core/workers/chunks/35491fbdd287470d40a4.js +0 -1
- package/assets/esri/core/workers/chunks/36247c6f6fc2891df2cf.js +0 -1
- package/assets/esri/core/workers/chunks/3d53307efbc3f07d7bf2.js +0 -1
- package/assets/esri/core/workers/chunks/42a72e1d963e4636323b.js +0 -1
- package/assets/esri/core/workers/chunks/456161a323be7d640c61.js +0 -1
- package/assets/esri/core/workers/chunks/500d09d2191127371081.js +0 -1
- package/assets/esri/core/workers/chunks/5707713c2f27588b9194.js +0 -1
- package/assets/esri/core/workers/chunks/5713f96bade5ebb54c81.js +0 -1
- package/assets/esri/core/workers/chunks/5718cf135e105e1e026b.js +0 -1
- package/assets/esri/core/workers/chunks/5c585b338a9e9aa0e205.js +0 -1
- package/assets/esri/core/workers/chunks/5d1d909354c90cb8eb60.js +0 -1
- package/assets/esri/core/workers/chunks/5ea03f53d4d64d9e7cae.js +0 -1
- package/assets/esri/core/workers/chunks/63019a7eb5222dc5e420.js +0 -1
- package/assets/esri/core/workers/chunks/64629ddcf008349eaf41.js +0 -1
- package/assets/esri/core/workers/chunks/64ee8d2acae2d6fce608.js +0 -1
- package/assets/esri/core/workers/chunks/6fcacfcb3d83515c37c9.js +0 -1
- package/assets/esri/core/workers/chunks/72ecf49d03bb24bf0998.js +0 -1
- package/assets/esri/core/workers/chunks/7421f9575487cdc9e28e.js +0 -1
- package/assets/esri/core/workers/chunks/77a11d7d53325d108ed8.js +0 -1
- package/assets/esri/core/workers/chunks/7a05b1f6163112bc9db2.js +0 -1
- package/assets/esri/core/workers/chunks/7d9882ddfa6495f72baa.js +0 -1
- package/assets/esri/core/workers/chunks/7fffad8ff6878fa1fd56.js +0 -1
- package/assets/esri/core/workers/chunks/81bbe5251ed13c0d91cc.js +0 -1
- package/assets/esri/core/workers/chunks/8b16aa50d879b92a5375.js +0 -1
- package/assets/esri/core/workers/chunks/8bc64fc7c4b9eb8fca4d.js +0 -1
- package/assets/esri/core/workers/chunks/8bfa19c24be0e3f3fd74.js +0 -1
- package/assets/esri/core/workers/chunks/8eefa133c36a004c054c.js +0 -1
- package/assets/esri/core/workers/chunks/9834bc11586a2d8d6f35.js +0 -1
- package/assets/esri/core/workers/chunks/9c6fc4fe2c46f40d63d9.js +0 -1
- package/assets/esri/core/workers/chunks/a5f25104938ab33e7a85.js +0 -1
- package/assets/esri/core/workers/chunks/a7bd294996e6c8b8354a.js +0 -1
- package/assets/esri/core/workers/chunks/abf4f018c692c18c3320.js +0 -1
- package/assets/esri/core/workers/chunks/b1f667006cba60ef4aa7.js +0 -1
- package/assets/esri/core/workers/chunks/b2d9f4e057af26a538fb.js +0 -1
- package/assets/esri/core/workers/chunks/b62807c6fcfb70a87cd4.js +0 -1
- package/assets/esri/core/workers/chunks/b8339c1d60847a9eed3e.js +0 -1
- package/assets/esri/core/workers/chunks/c362fbbafec91c44eeb2.js +0 -1
- package/assets/esri/core/workers/chunks/c941d15190fc08523d0d.js +0 -1
- package/assets/esri/core/workers/chunks/cc70a4a915b0b2ccb2a0.js +0 -1
- package/assets/esri/core/workers/chunks/d121045cddbe55c2ecb2.js +0 -1
- package/assets/esri/core/workers/chunks/d2120a623b1bd91b9ed9.js +0 -1
- package/assets/esri/core/workers/chunks/d78c2833cdc4730a88a3.js +0 -1
- package/assets/esri/core/workers/chunks/df438b62702007267798.js +0 -1
- package/assets/esri/core/workers/chunks/f4eb090bcc3eca64306a.js +0 -1
- package/assets/esri/core/workers/chunks/f7846523adacbfe5047e.js +0 -1
- package/assets/esri/core/workers/chunks/f839b86bee15deaf84e4.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import e from"../../../Graphic.js";import{createTask as i}from"../../../core/asyncUtils.js";import s from"../../../core/Collection.js";import o from"../../../core/Error.js";import{EventedAccessor as r}from"../../../core/Evented.js";import n from"../../../core/Logger.js";import{getOrCreateMapValue as a}from"../../../core/MapUtils.js";import{destroyMaybe as h,assertIsSome as p,abortMaybe as c}from"../../../core/maybe.js";import{pausable as l,when as d,watch as m,initial as v,sync as u}from"../../../core/reactiveUtils.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import g from"../../../geometry/Point.js";import f from"../../../geometry/Polyline.js";import{fromGeometry as G,toGeometry as x}from"../../../geometry/operators/support/apiConverter.js";import{closeRingsAndFixWinding as M,geometryToCoordinates as b}from"../../../geometry/support/coordsUtils.js";import{isPoint as C}from"../../../geometry/support/typeUtils.js";import{interpolateCircle as S}from"../../../geometry/support/curves/circleUtils.js";import{deriveCircleFromCircularArc as E,toEllipticArc7 as w}from"../../../geometry/support/curves/circularArcUtils.js";import{getEndpoint as O,isCircularArc as V,isEllipticArc4 as I,isBezierCurve as k,isCoordinate as H,isEllipticArc7 as P}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as R}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{wrapAtan2 as T}from"../../../geometry/support/curves/mathUtils.js";import A from"../../../layers/GraphicsLayer.js";import{SnappingVisualizer2D as j}from"../../2d/interactive/SnappingVisualizer2D.js";import{ConnectedReshapeManager as L}from"./ConnectedReshapeManager.js";import{screenDeltaToMapDelta as U,cloneMove as F}from"./drawUtils.js";import D from"./GraphicMover.js";import z from"./HighlightHelper.js";import{addUniqueLayer as K,isConnectedReshapeSupportedLayer as N}from"./layerUtils.js";import{createTooltipInfos as q,connectTooltip as Z,updateTranslateTooltipInfo as $,updateTranslateVertexTooltipInfo as B}from"./reshapeTooltipUtils.js";import{defaultSymbols as J,createMidpointGraphics as Q,createVertexGraphics as W,createCurveControlPointGraphics as X,createCurveConstructionLineGraphics as Y,attributeKeys as tt,getMidpoint as et,controlPointKinds as it,saveUpdatedCurveOrCoordinate as st,toolIdAttribute as ot,splitCurve as rt,isSingleSegmentCircle as nt,isSingleSegmentEllipse as at}from"./reshapeUtils.js";import{ViewEventPriorities as ht}from"../../input/InputManager.js";import{createCoordinateHelper as pt}from"../../interactive/coordinateHelper.js";import{sketchKeys as ct}from"../../interactive/keybindings.js";import{EditGeometryOperations as lt}from"../../interactive/editGeometry/EditGeometryOperations.js";import dt from"../../interactive/sketch/SketchOptions.js";import{SnappingContext as mt}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as vt,enterInputModeIfAvailable as ut}from"../../interactive/tooltip/tooltipCommonUtils.js";const yt=Symbol();let _t=class extends r{constructor(t){super(t),this._updateHandlesOnExternalGeometryChange=null,this._activeOperationInfo=null,this._connectedReshapeManager=null,this._editGeometryOperations=null,this._mover=null,this._snappingContext=null,this._snappingGraphicsLayer=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this.tooltip=null,this.activeTooltipInfo=null,this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.connectedReshapeProviders=null,this.enableMidpoints=!0,this.enableCurveOnMidpoint=!0,this.enableMovement=!0,this.enableVertices=!0,this.graphic=null,this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.snappingManager=null,this.symbols=J,this.sketchOptions=new dt,this.type="reshape",this.vertexGraphics=new s,this.curveControlPointGraphics=new s,this.constructionLineGraphics=new s,this.midpointGraphics=new s,this.selectedManipulators=new s,this.view=null}initialize(){const t=this.view;this._highlightHelper=new z({view:t}),this._setup(),this._updateHandlesOnExternalGeometryChange=l(()=>this.graphic?.geometry,t=>{if(!t)return;const e=new Set(this.selectedManipulators.map(wt));this._highlightHelper.removeAll(),this._setUpHighlights(),this._setupGraphics(),this._clearSelection(),this.vertexGraphics.filter(t=>e.has(wt(t))).forEach(t=>this._addToSelection(t));const{enableMovement:i,_mover:s,graphic:o,midpointGraphics:r,vertexGraphics:n,curveControlPointGraphics:a}=this,h=n.concat(r,a).items;i&&h.push(o),s?.set("graphics",h)},u),this.tooltip=vt(()=>({view:t,options:this.sketchOptions.tooltips})),this.tooltipInfos=q(this.sketchOptions),this.addHandles([d(()=>t?.ready,()=>{const{layer:t,view:e}=this;K(e,t),this.addHandles(e.on("key-down",t=>this._keyDownHandler(t),ht.TOOL))},{once:!0,initial:!0}),m(()=>this.graphic,()=>this.refresh()),m(()=>this.layer,(t,e)=>{e&&(this._clearSelection(),this._resetGraphics(e)),this.refresh()}),m(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),m(()=>this.enableMidpoints,()=>this.refresh()),Z(this.tooltip,()=>this._tooltipsContext),m(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),v),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover?.destroy(),this._mover=null,this._connectedReshapeManager=h(this._connectedReshapeManager),this.tooltip=h(this.tooltip)}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??pt(!!this.graphic.geometry?.hasZ,!!this.graphic.geometry?.hasM,this.view.spatialReference)}get _selectedManipulator(){return 1===this.selectedManipulators.length?this.selectedManipulators.at(0):void 0}get _tooltipsContext(){const{automaticAreaMeasurementUtils:t,automaticLengthMeasurementUtils:e,sketchOptions:i,activeTooltipInfo:s,graphic:o}=this;return{sketchOptions:i,activeTooltipInfo:s,graphic:o,selectedVertex:this._selectedManipulator,automaticAreaMeasurementUtils:t,automaticLengthMeasurementUtils:e,updateGeometry:(t,e,i,s,o)=>{this._setUpGeometryHelper();const r=t===this.graphic;r?this._emitMoveStartEvent(0,0):this._emitReshapeStartEvent(t);const n=!0;if(this._syncGeometryAfterVertexMove(t,e,s,o,n),r){const{view:t}=this,s=t.toScreen(i),o=t.toScreen(e),r=(o?.x??0)-(s?.x??0),n=(o?.y??0)-(s?.y??0);this._emitMoveEvent(r,n),this._emitMoveStopEvent(r,n)}else this._emitReshapeEvent(t),this._emitReshapeStopEvent(t);this._editGeometryOperations=h(this._editGeometryOperations)}}}get state(){const t=this.view.ready,e=!(!this.graphic||!this.layer);return t&&e?"active":t?"ready":"disabled"}isUIGraphic(t){return t===this.graphic||this._isMidpoint(t)||this._isCurveControlPoint(t)||this._isVertex(t)||this._isConstructionLine(t)}refresh(){this._reset(),this._setup()}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){const{selectedManipulators:t}=this;t.length&&this._removeVertices(t)}_setup(){const{graphic:t,layer:e}=this;if(!e||null==t?.geometry)return;const i=t.geometry;"mesh"!==i.type&&"extent"!==i.type?("polygon"===i.type&&M(i),this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._setupConnectedReshapeManager()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic,this.highlightName)}_setUpGeometryHelper(){const t=this.graphic.geometry;null!=t&&"mesh"!==t.type&&"extent"!==t.type?this._editGeometryOperations??=lt.fromGeometry(t,2,{allowCurves:!0}):this._logGeometryTypeError()}_saveSnappingContextForHandle(t,e){this._snappingGraphicsLayer=new A({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer);const i=this._editGeometryOperations;p(i),this._snappingContext=new mt({editGeometryOperations:i,elevationInfo:{mode:"on-the-ground",offset:0},pointer:e.viewEvent?.pointerType||"mouse",excludeFeature:this.graphic,feature:this.graphic,visualizer:new j(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(t)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._mover?.destroy(),this._mover=null,this.removeHandles(yt)}_resetSnappingStateVars(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),null!=this._snappingGraphicsLayer&&(this.view?.map&&this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy()),this._editGeometryOperations=h(this._editGeometryOperations),this._snappingTask=c(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(t){this._removeMidpointGraphics(t),this._removeVertexGraphics(t),this._removeCurveGraphics(t),this._updateTooltip()}_removeMidpointGraphics(t=this.layer){const{midpointGraphics:e}=this;t?.removeMany(e.items),e.drain(h)}_removeVertexGraphics(t=this.layer){const{vertexGraphics:e}=this;t?.removeMany(e.items),e.drain(h)}_removeCurveGraphics(t=this.layer){const{curveControlPointGraphics:e,constructionLineGraphics:i}=this;t?.removeMany(e.items),t?.removeMany(i.items),e.drain(h),i.drain(h)}_setupGraphics(){const t=this.graphic.geometry;if(null!=t&&("polyline"===t.type||"polygon"===t.type||"multipoint"===t.type)){const e=gt(t);this.enableMidpoints&&"multipoint"!==t.type&&this._setUpMidpointGraphics(e),this.enableVertices&&(this._setUpVertexGraphics(e),this._setupCurveGraphics(e))}}_setUpMidpointGraphics(t){this._removeMidpointGraphics();const e=Q(t,this.symbols,this._coordinateHelper,"polygon"===this.graphic.geometry?.type);this.midpointGraphics.addMany(e),this.layer.addMany(e)}_setUpVertexGraphics(t){this._removeVertexGraphics();const e=W(t,this.symbols,this._coordinateHelper);this.vertexGraphics.addMany(e),this._storeRelatedVertexIndices(),this.layer.addMany(e)}_setupCurveGraphics(t){this._removeCurveGraphics();const e=X(t,this.symbols,this._coordinateHelper),i=Y(t,this.symbols,this._coordinateHelper);this.curveControlPointGraphics.addMany(e),this.constructionLineGraphics.addMany(i),this.layer.addMany(e),this.layer.addMany(i)}_updateSymbolsForTheme(){const t=this.view.effectiveTheme.accentColor;this.symbols={vertices:{...this.symbols.vertices,default:this.symbols.vertices.default.clone().set("color",t),hover:this.symbols.vertices.hover?.clone().set("color",t)},controlPoints:{...this.symbols.controlPoints,default:this.symbols.controlPoints.default.clone().set("outline.color",t),hover:this.symbols.controlPoints.hover?.clone().set("outline.color",t)},midpoints:{...this.symbols.midpoints},constructionLines:this.symbols.constructionLines.clone().set("color",t)};for(const e of this.vertexGraphics)this._isSelected(e)?e.symbol=this.symbols.vertices.selected:this._hoverGraphic===e?e.symbol=this.symbols.vertices.hover:e.symbol=this.symbols.vertices.default;for(const e of this.curveControlPointGraphics)this._isSelected(e)?e.symbol=this.symbols.controlPoints.selected:this._hoverGraphic===e?e.symbol=this.symbols.controlPoints.hover:e.symbol=this.symbols.controlPoints.default;for(const e of this.constructionLineGraphics)e.symbol=this.symbols.constructionLines}_storeRelatedVertexIndices(){const t=this.vertexGraphics.items;if(!t)return;const e=t.map(({geometry:t})=>({x:t.x,y:t.y}));for(let i=0;i<e.length;i++){const s=[];for(let t=0;t<e.length;t++){if(i===t)continue;const o=e[i],r=e[t];o.x===r.x&&o.y===r.y&&s.push(t)}t[i].attributes[tt.relatedGraphicIndices]=s}}_setupMover(){const{enableMovement:t,graphic:e,midpointGraphics:i,vertexGraphics:s,view:o}=this,r=s.concat(i,this.curveControlPointGraphics).items;t&&"multipoint"!==e.geometry?.type&&r.push(e),this._mover=new D({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:r,view:o,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_setupConnectedReshapeManager(){const{connectedReshapeProviders:t}=this;null!=t&&0!==t.length&&(this._connectedReshapeManager=new L({providerFactories:t,view:this.view}))}_onGraphicClickCallback(t){t.viewEvent.stopPropagation();const e=t.graphic,i=this._isCurveControlPoint(e);if(e===this.graphic)this.clearSelection(),this.emit("graphic-click",t),this.callbacks.onGraphicClick?.(t);else if(this._isMidpoint(e)){if(2===t.viewEvent.button)return;const i=this.graphic.clone(),s=this._handleMidpointClickOrStartMove(t);this.refresh(),s.length&&this._emitVertexAddEvent([e],i,s)}else if(this._isVertex(e)||i){if(t.viewEvent.stopPropagation(),2===t.viewEvent.button)return void(i||this._removeVertices(e));t.viewEvent.native.shiftKey||this._clearSelection(),this.selectedManipulators.includes(e)?this._removeFromSelection(e,!0):this._addToSelection(e)}}_setUpOperation(t){const{graphic:e,dx:i,dy:s}=t,o=e===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(e,t),this._activeOperationInfo={target:this.graphic,mover:e,operationType:o?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(t){const{dx:e,dy:i,graphic:s}=t,o=this._connectedReshapeManager,r=o?Vt(this.graphic):null;if(s===this.graphic){const{geometry:n}=s;return this._setUpOperation(t),this._emitMoveStartEvent(e,i),r&&o?.startFeatureMove([r]),void(null!=n&&"point"===n.type&&this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(e,i)}))}const{selectedManipulators:n}=this;if(!n.includes(s)){if(this._clearSelection(),this._isMidpoint(s)){const e=this.graphic.clone(),i=this._handleMidpointClickOrStartMove(t);i.length&&(this._emitVertexAddEvent([s],e,i),this._refreshGraphicIndicesAttributes(i[0]))}this._addToSelection(s)}if(this._setUpOperation(t),r){const t=n.filter(t=>this._isVertex(t));o?.startVertexMove(r,It(t))}this._emitReshapeStartEvent(s),this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(s,t.viewEvent),this._emitReshapeEvent(s)})}_onGraphicMoveCallback(t){const e=this._activeOperationInfo;if(!e)return;const{dx:i,dy:s,graphic:o}=t;e.totalDx+=i,e.totalDy+=s;const{operationType:r}=e,{geometry:n}=o;if(null!=n)if("move"!==r)this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(o,t.viewEvent),this._emitReshapeEvent(o)});else if("point"===n.type)this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)});else if("polyline"===n.type||"polygon"===n.type){const e=gt(n);this._updateVertexGraphicLocations(e);const{dxMap:o,dyMap:r}=U(i,s,this.view);this._connectedReshapeManager?.translate(o,r,0),this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)}}_onGraphicMoveStopCallback(t){const e=this._activeOperationInfo;if(!e)return;const{dx:i,dy:s,graphic:o}=t,{operationType:r}=e;e.totalDx+=i,e.totalDy+=s,this._onHandleMove(o,i,s,t,()=>"move"===r?this._emitMoveStopEvent():this._emitReshapeStopEvent(o)),this._isMidpoint(o)||o.getAttribute(tt.curveFromStraightEdgeFlag)?this.refresh():(this._updateTooltip(this._isVertex(o)?o:null),this._resetSnappingStateVars(),this._connectedReshapeManager?.finish(),this._activeOperationInfo=null)}_updateVertexGraphicLocations(t){const{_coordinateHelper:e}=this;for(const i of this.vertexGraphics){const{pathIndex:s,pointIndex:o}=i.attributes;i.geometry=e.arrayToPoint(O(t[s][o]))}this._updateMidpointGraphicLocations(t),this._updateCurveGraphicLocations(t)}_updateMidpointGraphicLocations(t){const{_coordinateHelper:e}=this;for(const i of this.midpointGraphics){const{pathIndex:s,pointIndexStart:o,pointIndexEnd:r}=i.attributes,n=t[s];i.geometry=et(n[o],n[r],e)}}_updateCurveGraphicLocations(t){const{spatialReference:e}=this._coordinateHelper,i=new Map;for(const s of this.selectedManipulators){const[t,e]=Et(s);null!=t&&null!=e&&s.getAttribute(tt.controlPointKind)&&a(i,t,()=>new Set)?.add(e)}for(const s of this.curveControlPointGraphics){const[e,o]=Et(s);if(i.get(e)?.has(o))continue;const r=t[e][o];if(V(r)||I(r)){const i=O(t[e][o-1]),n=V(r)?E(i,r):R(i,r),[a,h]=S(n,.25);s.geometry=new g({x:a,y:h,spatialReference:this._coordinateHelper.spatialReference})}else if(k(r)){const t=s.getAttribute(tt.controlPointKind),[e,i]=t===it.bezier.cp1?r.b[1]:r.b[2];s.geometry=new g({x:e,y:i,spatialReference:this._coordinateHelper.spatialReference})}}for(const s of this.constructionLineGraphics){const i=s.getAttribute(tt.controlPointKind),[o,r]=Et(s),n=t[o],a=O(n[r-1]),h=O(n[r]),p=t[o][r];i===it.bezier.line1?s.geometry=new f({paths:[[[a[0],a[1]],[...p.b[1]]]],spatialReference:e}):s.geometry=new f({paths:[[[h[0],h[1]],[...p.b[2]]]],spatialReference:e})}}_refreshGraphicIndicesAttributes(t){const{componentIndex:e,vertexIndex:i}=t,s=t=>{const[s,o]=Et(t);s===e&&o>=i&&t.setAttribute(tt.pointIndex,o+1)};this.vertexGraphics.forEach(s),this.curveControlPointGraphics.forEach(s),this.constructionLineGraphics.forEach(s);for(const o of this.midpointGraphics){if(o.getAttribute(tt.pathIndex)!==e)continue;const t=o.getAttribute(tt.pointIndexStart);t>=i&&(o.setAttribute(tt.pointIndexStart,t+1),o.setAttribute(tt.pointIndexEnd,o.getAttribute(tt.pointIndexEnd)+1))}}_getVertexFromEditGeometry(t){const[e,i]=Et(t);return p(this._editGeometryOperations),this._editGeometryOperations.data.parts[e].vertices[i]}_onHandleMove(t,e,s,o,r){c(this._snappingTask);const n=this._snappingContext;if(!n)return;const a=t.geometry,h="graphic-move-stop"===o.type;if(a&&C(a))if(null!=this.snappingManager&&this.selectedManipulators.length<2&&!h){const o=this.snappingManager;this._stagedVertex=o.update({point:a,context:n}),this._syncGeometryAfterVertexMove(t,new g(this._stagedVertex),e,s,h),r(),this._snappingTask=i(async i=>{const p=await o.snap({point:a,context:n,signal:i});p.valid&&(this._stagedVertex=p.apply(),this._syncGeometryAfterVertexMove(t,new g(this._stagedVertex),e,s,h),r())})}else{const i=null!=this._stagedVertex?new g(this._stagedVertex):a;this._syncGeometryAfterVertexMove(t,i,e,s,h),r()}}_syncGeometryAfterVertexMove(t,e,i,s,o=!1){const r=this._editGeometryOperations?.data.geometry;if(!r)return;const{_coordinateHelper:n}=this,a=n.pointToVector(e),h=this._getVertexFromEditGeometry(t);if(h){const t=n.getZ(a),e=a[0]-h.pos[0],i=a[1]-h.pos[1],s=null!=t?t-h.pos[2]:0;"point"!==r.type&&"mesh"!==r.type||this._editGeometryOperations?.moveVertices([h],e,i,s),this._connectedReshapeManager?.translate(e,i,s)}if("point"===r.type)t.geometry=e;else if("mesh"===r.type)t.geometry=r.centerAt(e);else{if(t!==this.graphic){const o=n.spatialReference,[a,h]=Et(t);let p=ft(r);const c=n.pointToArray(e);this._updateGeometryFromGraphic(t,p,a,h,c,o,"polygon"===r.type),this._isVertex(t)||this._isCurveControlPoint(t)?(p=this._moveRelatedCoordinates(p,t,c),p=this._moveSelectedHandleCoordinates(p,t,i,s,"polygon"===r.type),this._updateMidpointGraphicLocations(p),this._updateCurveGraphicLocations(p)):this._isMidpoint(t)&&this._updateCurveGraphicLocations(p),st(r,p)}this._updateGraphicGeometry(r.clone()),this._editGeometryOperations=lt.fromGeometry(r,2,{allowCurves:!0}),o&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(t),e):t.geometry=e)}}_moveRelatedCoordinates(t,e,i){const{relatedGraphicIndices:s}=e.attributes,o=this._coordinateHelper.spatialReference;if(!s?.length)return t;for(const r of s){const s=this.vertexGraphics.at(r),[n,a]=Et(s);St(t,n,a,i,o),s.geometry=e.geometry}return t}_moveSelectedHandleCoordinates(t,e,i,s,o){const r=this._coordinateHelper.spatialReference;for(const n of this.selectedManipulators)if(n!==e){const[e,a]=Et(n),h=n.getAttribute(tt.relatedGraphicIndices),p=F(n.geometry,i,s,this.view),c=b(p);if(n.geometry=p,this._updateGeometryFromGraphic(n,t,e,a,c,r,o),h?.length)for(const i of h){const e=this.vertexGraphics.at(i),[s,o]=Et(e);St(t,s,o,c,r),e.geometry=p}}return t}_updateGeometryFromGraphic(t,e,i,s,o,r,n){const a=e[i].length-1;this._isCurveControlPoint(t)?xt(e,i,s,[o[0],o[1]],t.getAttribute(tt.controlPointKind)):(St(e,i,s,o,r),n&&(0===s?St(e,i,a,o,r):s===a&&(e[i][0]=o)))}_onGraphicPointerOverCallback(t){const e=t.graphic;this._hoverGraphic=e;const i=this._isVertex(e);i&&!this._isSelected(e)?e.symbol=this.symbols.vertices.hover:this._isCurveControlPoint(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.controlPoints.hover),this._updateTooltip(i?e:null),this._updateHoverCursor(e)}_onGraphicPointerOutCallback(t){const e=t.graphic;this._hoverGraphic=null,this._isVertex(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.vertices.default),this._isCurveControlPoint(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.controlPoints.default),this.removeHandles(yt),this._updateTooltip()}_handleMidpointClickOrStartMove(t){const{graphic:e}=t,i=this.graphic.geometry;if(null==i||"polygon"!==i.type&&"polyline"!==i.type)return[];const s=i.clone(),o=[],{[tt.pathIndex]:r,[tt.pointIndexStart]:n,[tt.pointIndexEnd]:a}=e.attributes,h=b(e.geometry),p=0===a?n+1:a;e.attributes={[tt.tool]:ot,[tt.pathIndex]:r,[tt.pointIndex]:p,[tt.relatedGraphicIndices]:[]};const c=ft(s),l=c[r][a];if(H(l)){if(this.enableCurveOnMidpoint&&t.viewEvent.native.shiftKey){const t=O(c[r][p]);c[r].splice(p,1,{c:[t,[h[0],h[1]]]}),e.setAttribute(tt.controlPointKind,it.circle.interior),e.setAttribute(tt.curveFromStraightEdgeFlag,!0),this.midpointGraphics.remove(e),this.curveControlPointGraphics.push(e),st(s,c)}else c[r].splice(p,0,h),o.push({coordinates:c[r][p],componentIndex:r,vertexIndex:p})}else{const t=O(c[r][n]),e=rt(t,l,.5,this._coordinateHelper);c[r].splice(a,1,...e),o.push({coordinates:O(c[r][p]),componentIndex:r,vertexIndex:p})}return this._updateGraphicGeometry(s),o}_addToSelection(t){const e=Ot(t);for(const i of e)i.symbol=this.symbols.vertices.selected,this.selectedManipulators.add(i),this._updateTooltip(i);this._emitSelectEvent(e)}_removeFromSelection(t,e){if(this._isVertex(t)){const{vertices:i}=this.symbols;t.symbol=e?i.hover:i.default}else if(this._isCurveControlPoint(t)){const{controlPoints:i}=this.symbols;t.symbol=e?i.hover:i.default}this.selectedManipulators.remove(t),this._emitDeselectEvent([t]),this._updateTooltip()}_clearSelection(){const t=this.selectedManipulators.toArray(),{controlPoints:e,vertices:i}=this.symbols;if(t.length>0){for(const s of t)this._isVertex(s)?s.symbol=i.default:this._isCurveControlPoint(s)&&(s.symbol=e.default);this.selectedManipulators.removeAll(),this._emitDeselectEvent(t),this._updateTooltip()}}_keyDownHandler(t){null==this._activeOperationInfo&&ut(t,this.tooltip)||ct.delete.includes(t.key)&&!t.repeat&&this.selectedManipulators.length&&this._removeVertices(this.selectedManipulators)}_removeVertices(t){const e=this.graphic.geometry,i=this.vertexGraphics.length;if(null==e||"polygon"!==e.type&&"polyline"!==e.type&&"multipoint"!==e.type)return;if("polygon"===e.type&&i<4||"multipoint"===e.type&&i<2||"polyline"===e.type&&i<3)return;const s=this.graphic.clone(),o=e.clone();let r=ft(o);const n=[],a=Ot(t);for(const h of a){if(this._isCurveControlPoint(h))continue;const{x:t,y:e}=h.geometry;for(let i=0;i<r.length;i++){const s=r[i];for(let o=0;o<s.length;o++){const[a,h]=O(s[o]);if(t===a&&e===h){n.push({coordinates:O(r[i][o]),componentIndex:i,vertexIndex:o}),r[i].splice(Number(o),1);const t=r[i][o];t&&!H(t)&&(r[i][o]=O(t))}}}}if("polygon"===o.type)r=r.filter(t=>{if(t.length<2)return!1;const[e,i]=O(t[0]),[s,o]=O(t[t.length-1]);return(2!==t.length||e!==s||i!==o)&&(e===s&&i===o||t.push(t[0]),!0)});else if("polyline"===o.type)for(const h of r)1===h.length&&r.splice(r.indexOf(h),1);st(o,r),this._updateGraphicGeometry(o),this.refresh(),this._emitVertexRemoveEvent(a,s,n)}_isVertex(t){return this.vertexGraphics.includes(t)}_isCurveControlPoint(t){return this.curveControlPointGraphics.includes(t)}_isConstructionLine(t){return this.constructionLineGraphics.includes(t)}_isSelected(t){return(this._isVertex(t)||this.curveControlPointGraphics.includes(t))&&this.selectedManipulators.includes(t)}_isMidpoint(t){return this.midpointGraphics.includes(t)}_updateHoverCursor(t){const e=this._isMidpoint(t)?"copy":"move";this.addHandles(this.view.acquireCursor(e,"high"),yt)}_updateTooltip(t,e){let i=null;const{graphic:s,view:o,tooltipInfos:r}=this,n=s?.geometry;"point"===n?.type?i=r.movePoint:this._selectedManipulator?i=r.selectedVertex:t===this.graphic?(i=r.translateGraphic,$(i,o,this._tooltipsContext,e)):t&&this.selectedManipulators.length>1&&(i=r.translateVertices,B(i,o,n,this._tooltipsContext,e)),this.activeTooltipInfo=i}_updateGraphicGeometry(t){this._updateHandlesOnExternalGeometryChange?.pause(),this.graphic.geometry=t,this._updateHandlesOnExternalGeometryChange?.resume()}_emitMoveStartEvent(t,e){const i={type:"move-start",mover:this.graphic,dx:t,dy:e};this.emit("move-start",i),this.callbacks.onMoveStart?.(i)}_emitMoveEvent(t,e){const i={type:"move",mover:this.graphic,dx:t,dy:e};this.emit("move",i),this.callbacks.onMove?.(i)}_emitMoveStopEvent(t,e){if(null==t||null==e){const i=this._activeOperationInfo;if(!i)return;t=i.totalDx,e=i.totalDy}const i={type:"move-stop",mover:this.graphic,dx:t,dy:e};this.emit("move-stop",i),this.callbacks.onMoveStop?.(i)}_emitReshapeStartEvent(t){const e={type:"reshape-start",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape-start",e),this.callbacks.onReshapeStart?.(e)}_emitReshapeEvent(t){const e={type:"reshape",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape",e),this.callbacks.onReshape?.(e)}_emitReshapeStopEvent(t){const e={type:"reshape-stop",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape-stop",e),this.callbacks.onReshapeStop?.(e)}_emitSelectEvent(t){const e={type:"vertex-select",added:t};this.emit("select",e),this.callbacks.onVertexSelect?.(e)}_emitDeselectEvent(t){const e={type:"vertex-deselect",removed:t};this.emit("deselect",e),this.callbacks.onVertexDeselect?.(e)}_emitVertexAddEvent(t,e,i){const s={type:"vertex-add",added:t,graphic:this.graphic,oldGraphic:e,vertices:i};this.emit("vertex-add",s),this.callbacks.onVertexAdd?.(s)}_emitVertexRemoveEvent(t,e,i){const s={type:"vertex-remove",removed:t,graphic:this.graphic,oldGraphic:e,vertices:i};this.emit("vertex-remove",s),this.callbacks.onVertexRemove?.(s)}_logGeometryTypeError(){n.getLogger(this).error(new o("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};function gt(t){const e=ft(t.clone());if("polygon"===t.type)for(const i of e){const t=i[i.length-1];if(!H(t))continue;const e=i[0];e[0]===t[0]&&e[1]===t[1]&&i.length>2&&i.pop()}return e}function ft(t){return"polygon"===t.type?t.curveRings?.slice()??t.rings.slice():"polyline"===t.type?t.curvePaths?.slice()??t.paths.slice():t.points.map(t=>[t])}function Gt(t,e,i,s){const o=t[e][i];if(V(o))o.c[1]=s;else if(I(o)){const o=O(t[e][i]);t[e][i]={c:[o,s]}}}function xt(t,e,i,s,o){switch(o){case it.circle.interior:Gt(t,e,i,s);break;case it.bezier.cp1:t[e][i].b[1]=s;break;case it.bezier.cp2:t[e][i].b[2]=s}}function Mt(t,e){return t<1e-8*e}function bt(t,{cx:e,cy:i,isInvalid:s,thetaStart:o,thetaEnd:r},n,a){const[h,p]=t,[c,l]=n,d=c-h,m=l-p;e-=h,i-=p;const v=a?o>r:o<r,[u,y]=s?[e,i]:v?[-i,e]:[i,-e],[_,g]=[d,m],[f,G]=[u,y],x=_*G-g*f,M=(d**2+m**2)/2;if(Mt(Math.abs(x),M))return[(h+c)/2,(p+l)/2];const[b,C]=[G/x*M,-f/x*M],S=b**2+C**2,[E,w]=[d/2-b,m/2-C];if(Mt(E**2+w**2,S)){const[t,e]=v?[-C,b]:[C,-b];return[t+b+h,e+C+p]}const O=Math.sqrt((b**2+C**2)/(E**2+w**2))*Math.sign(d*u+m*y);return[E*O+b+h,w*O+C+p]}function Ct(t,e,i){const s=G(new f({curvePaths:[[t,e]],spatialReference:i})),{curvePaths:o}=x(s,i),r=o[0][1];return P(r)?r:w(t,r)}function St(t,e,i,s,o){const r=t[e][i],n=t[e].at(i+1);if(nt(t,e)){const i=t[e][1];return t[e][0]=[...s],void(t[e][1]={a:[[...s],[...i.a[1]],0,0]})}if(at(t,e)){const i=t[e][1],[o,r]=i.a[1],[n,a]=s,h=Math.hypot(n-o,a-r),[p,c]=[n-o,a-r],l=T(c,p);return t[e][0]=[...s],void(t[e][1]={a:[[...s],[...i.a[1]],0,0,l,h,i.a[6]]})}const a=O(r);if(H(r))r.splice(0,r.length,...s);else if(k(r))r.b[0].splice(0,r.b[0].length,...s);else if(V(r)||I(r)){const o=O(t[e][i-1]),n=V(r)?E(o,r):R(o,r);t[e].splice(i,1,{c:[[...s],bt(o,n,s,!0)]})}else if(P(r)){r.a[0].splice(0,r.a[0].length,...s);const n=O(t[e][i-1]);r.a=Ct(n,r,o).a}if(n&&!H(n)&&!k(r))if(V(n)||I(n)){const o=O(n),r=V(n)?E(a,n):R(a,n);t[e].splice(i+1,1,{c:[o,bt(o,r,s,!1)]})}else if(P(n)){const t=O(r);n.a=Ct(t,n,o).a}}function Et({attributes:t}){return[t?.[tt.pathIndex]||0,t?.[tt.pointIndex]||0]}function wt({attributes:t}){return`${t?.[tt.pathIndex]}-${t?.[tt.pointIndex]}`}function Ot(t){return t instanceof e?[t]:[...t]}function Vt(t){const e=t.sourceLayer??t.layer;return N(e)?{graphic:t,layer:e}:null}function It(t){return t.toArray().map(({attributes:t})=>({pathIndex:t[tt.pathIndex],vertexIndex:t[tt.pointIndex]}))}t([y()],_t.prototype,"_activeOperationInfo",void 0),t([y()],_t.prototype,"_connectedReshapeManager",void 0),t([y()],_t.prototype,"_coordinateHelper",null),t([y()],_t.prototype,"_editGeometryOperations",void 0),t([y()],_t.prototype,"tooltip",void 0),t([y()],_t.prototype,"tooltipInfos",void 0),t([y()],_t.prototype,"activeTooltipInfo",void 0),t([y({constructOnly:!0})],_t.prototype,"automaticAreaMeasurementUtils",void 0),t([y({constructOnly:!0})],_t.prototype,"automaticLengthMeasurementUtils",void 0),t([y()],_t.prototype,"_selectedManipulator",null),t([y()],_t.prototype,"_tooltipsContext",null),t([y()],_t.prototype,"callbacks",void 0),t([y()],_t.prototype,"connectedReshapeProviders",void 0),t([y()],_t.prototype,"enableMidpoints",void 0),t([y()],_t.prototype,"enableCurveOnMidpoint",void 0),t([y()],_t.prototype,"enableMovement",void 0),t([y()],_t.prototype,"enableVertices",void 0),t([y()],_t.prototype,"graphic",void 0),t([y()],_t.prototype,"highlightName",void 0),t([y()],_t.prototype,"highlightsEnabled",void 0),t([y()],_t.prototype,"layer",void 0),t([y()],_t.prototype,"snappingManager",void 0),t([y({readOnly:!0})],_t.prototype,"state",null),t([y()],_t.prototype,"symbols",void 0),t([y({type:dt})],_t.prototype,"sketchOptions",void 0),t([y({readOnly:!0})],_t.prototype,"type",void 0),t([y({readOnly:!0})],_t.prototype,"vertexGraphics",void 0),t([y({readOnly:!0})],_t.prototype,"curveControlPointGraphics",void 0),t([y({readOnly:!0})],_t.prototype,"constructionLineGraphics",void 0),t([y({readOnly:!0})],_t.prototype,"midpointGraphics",void 0),t([y({readOnly:!0})],_t.prototype,"selectedManipulators",void 0),t([y()],_t.prototype,"view",void 0),_t=t([_("esri.views.draw.support.Reshape")],_t);const kt=_t;export{kt as default};
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../../../Graphic.js";import{createTask as i}from"../../../core/asyncUtils.js";import s from"../../../core/Collection.js";import o from"../../../core/Error.js";import{EventedAccessor as r}from"../../../core/Evented.js";import n from"../../../core/Logger.js";import{getOrCreateMapValue as a}from"../../../core/MapUtils.js";import{destroyMaybe as h,assertIsSome as p,abortMaybe as c}from"../../../core/maybe.js";import{pausable as l,when as d,watch as m,initial as v,sync as u}from"../../../core/reactiveUtils.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import g from"../../../geometry/Point.js";import f from"../../../geometry/Polyline.js";import{fromGeometry as G,toGeometry as x}from"../../../geometry/operators/support/apiConverter.js";import{closeRingsAndFixWinding as M,geometryToCoordinates as b}from"../../../geometry/support/coordsUtils.js";import{isPoint as C}from"../../../geometry/support/typeUtils.js";import{interpolateCircle as S}from"../../../geometry/support/curves/circleUtils.js";import{deriveCircleFromCircularArc as E,toEllipticArc7 as w}from"../../../geometry/support/curves/circularArcUtils.js";import{getEndpoint as O,isCircularArc as V,isEllipticArc4 as I,isBezierCurve as P,isCoordinate as k,isEllipticArc7 as H}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as R}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{wrapAtan2 as T}from"../../../geometry/support/curves/mathUtils.js";import A from"../../../layers/GraphicsLayer.js";import{SnappingVisualizer2D as j}from"../../2d/interactive/SnappingVisualizer2D.js";import{ConnectedReshapeManager as L}from"./ConnectedReshapeManager.js";import{screenDeltaToMapDelta as U,cloneMove as F}from"./drawUtils.js";import D from"./GraphicMover.js";import z from"./HighlightHelper.js";import{addUniqueLayer as K,isConnectedReshapeSupportedLayer as N}from"./layerUtils.js";import{createTooltipInfos as q,connectTooltip as Z,updateTranslateTooltipInfo as $,updateTranslateVertexTooltipInfo as B}from"./reshapeTooltipUtils.js";import{defaultSymbols as J,createMidpointGraphics as Q,createVertexGraphics as W,createCurveControlPointGraphics as X,createCurveConstructionLineGraphics as Y,attributeKeys as tt,getMidpoint as et,controlPointKinds as it,saveUpdatedCurveOrCoordinate as st,toolIdAttribute as ot,splitCurve as rt,isSingleSegmentCircle as nt,isSingleSegmentEllipse as at}from"./reshapeUtils.js";import{ViewEventPriorities as ht}from"../../input/InputManager.js";import{createCoordinateHelper as pt}from"../../interactive/coordinateHelper.js";import{sketchKeys as ct}from"../../interactive/keybindings.js";import{EditGeometryOperations as lt}from"../../interactive/editGeometry/EditGeometryOperations.js";import dt from"../../interactive/sketch/SketchOptions.js";import{SnappingContext as mt}from"../../interactive/snapping/SnappingContext.js";import{makeTooltip as vt,enterInputModeIfAvailable as ut}from"../../interactive/tooltip/tooltipCommonUtils.js";const yt=Symbol();let _t=class extends r{constructor(t){super(t),this._updateHandlesOnExternalGeometryChange=null,this._activeOperationInfo=null,this._connectedReshapeManager=null,this._editGeometryOperations=null,this._mover=null,this._snappingContext=null,this._snappingGraphicsLayer=null,this._hoverGraphic=null,this._snappingTask=null,this._stagedVertex=null,this.tooltip=null,this.activeTooltipInfo=null,this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.connectedReshapeProviders=null,this.enableMidpoints=!0,this.enableCurveOnMidpoint=!0,this.enableMovement=!0,this.enableVertices=!0,this.graphic=null,this.highlightName=null,this.highlightsEnabled=!0,this.layer=null,this.snappingManager=null,this.symbols=J,this.sketchOptions=new dt,this.type="reshape",this.vertexGraphics=new s,this.curveControlPointGraphics=new s,this.constructionLineGraphics=new s,this.midpointGraphics=new s,this.selectedManipulators=new s,this.view=null}initialize(){const t=this.view;this._highlightHelper=new z({view:t}),this._setup(),this._updateHandlesOnExternalGeometryChange=l(()=>this.graphic?.geometry,t=>{if(!t)return;const e=new Set(this.selectedManipulators.map(wt));this._highlightHelper.removeAll(),this._setUpHighlights(),this._setupGraphics(),this._clearSelection(),this.vertexGraphics.filter(t=>e.has(wt(t))).forEach(t=>this._addToSelection(t));const{enableMovement:i,_mover:s,graphic:o,midpointGraphics:r,vertexGraphics:n,curveControlPointGraphics:a}=this,h=n.concat(r,a).items;i&&h.push(o),s?.set("graphics",h)},u),this.tooltip=vt(()=>({view:t,options:this.sketchOptions.tooltips})),this.tooltipInfos=q(this.sketchOptions),this.addHandles([d(()=>t?.ready,()=>{const{layer:t,view:e}=this;K(e,t),this.addHandles(e.on("key-down",t=>this._keyDownHandler(t),ht.TOOL))},{once:!0,initial:!0}),m(()=>this.graphic,()=>this.refresh()),m(()=>this.layer,(t,e)=>{e&&(this._clearSelection(),this._resetGraphics(e)),this.refresh()}),m(()=>[this.highlightsEnabled,this.highlightName],()=>{this._highlightHelper?.removeAll(),this._setUpHighlights()}),m(()=>this.enableMidpoints,()=>this.refresh()),Z(this.tooltip,()=>this._tooltipsContext),m(()=>this.view.effectiveTheme.accentColor,()=>this._updateSymbolsForTheme(),v),this._updateHandlesOnExternalGeometryChange]),this._updateTooltip()}destroy(){this._reset(),this._mover?.destroy(),this._mover=null,this._connectedReshapeManager=h(this._connectedReshapeManager),this.tooltip=h(this.tooltip)}get _coordinateHelper(){return this._editGeometryOperations?.data.coordinateHelper??pt(!!this.graphic.geometry?.hasZ,!!this.graphic.geometry?.hasM,this.view.spatialReference)}get _selectedManipulator(){return 1===this.selectedManipulators.length?this.selectedManipulators.at(0):void 0}get _tooltipsContext(){const{automaticAreaMeasurementUtils:t,automaticLengthMeasurementUtils:e,sketchOptions:i,activeTooltipInfo:s,graphic:o}=this;return{sketchOptions:i,activeTooltipInfo:s,graphic:o,selectedVertex:this._selectedManipulator,automaticAreaMeasurementUtils:t,automaticLengthMeasurementUtils:e,updateGeometry:(t,e,i,s,o)=>{this._setUpGeometryHelper();const r=t===this.graphic;r?this._emitMoveStartEvent(0,0):this._emitReshapeStartEvent(t);const n=!0;if(this._syncGeometryAfterVertexMove(t,e,s,o,n),r){const{view:t}=this,s=t.toScreen(i),o=t.toScreen(e),r=(o?.x??0)-(s?.x??0),n=(o?.y??0)-(s?.y??0);this._emitMoveEvent(r,n),this._emitMoveStopEvent(r,n)}else this._emitReshapeEvent(t),this._emitReshapeStopEvent(t);this._editGeometryOperations=h(this._editGeometryOperations)}}}get state(){const t=this.view.ready,e=!(!this.graphic||!this.layer);return t&&e?"active":t?"ready":"disabled"}isUIGraphic(t){return t===this.graphic||this._isMidpoint(t)||this._isCurveControlPoint(t)||this._isVertex(t)||this._isConstructionLine(t)}refresh(){this._reset(),this._setup()}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){const{selectedManipulators:t}=this;t.length&&this._removeVertices(t)}_setup(){const{graphic:t,layer:e}=this;if(!e||null==t?.geometry)return;const i=t.geometry;"mesh"!==i.type&&"extent"!==i.type?("polygon"===i.type&&M(i),this._setUpHighlights(),this._setupGraphics(),this._setupMover(),this._setupConnectedReshapeManager()):this._logGeometryTypeError()}_setUpHighlights(){this.highlightsEnabled&&this.graphic&&this._highlightHelper?.add(this.graphic,this.highlightName)}_setUpGeometryHelper(){const t=this.graphic.geometry;null!=t&&"mesh"!==t.type&&"extent"!==t.type?this._editGeometryOperations??=lt.fromGeometry(t,2,{allowCurves:!0}):this._logGeometryTypeError()}_saveSnappingContextForHandle(t,e){this._snappingGraphicsLayer=new A({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer);const i=this._editGeometryOperations;p(i),this._snappingContext=new mt({editGeometryOperations:i,elevationInfo:{mode:"on-the-ground",offset:0},pointer:e.viewEvent?.pointerType||"mouse",excludeFeature:this.graphic,feature:this.graphic,visualizer:new j(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(t)})}_reset(){this._clearSelection(),this._highlightHelper?.removeAll(),this._updateTooltip(),this._resetGraphics(),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._mover?.destroy(),this._mover=null,this.removeHandles(yt)}_resetSnappingStateVars(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),null!=this._snappingGraphicsLayer&&(this.view?.map&&this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy()),this._editGeometryOperations=h(this._editGeometryOperations),this._snappingTask=c(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(t){this._removeMidpointGraphics(t),this._removeVertexGraphics(t),this._removeCurveGraphics(t),this._updateTooltip()}_removeMidpointGraphics(t=this.layer){const{midpointGraphics:e}=this;t?.removeMany(e.items),e.drain(h)}_removeVertexGraphics(t=this.layer){const{vertexGraphics:e}=this;t?.removeMany(e.items),e.drain(h)}_removeCurveGraphics(t=this.layer){const{curveControlPointGraphics:e,constructionLineGraphics:i}=this;t?.removeMany(e.items),t?.removeMany(i.items),e.drain(h),i.drain(h)}_setupGraphics(){const t=this.graphic.geometry;if(null!=t&&("polyline"===t.type||"polygon"===t.type||"multipoint"===t.type)){const e=gt(t);this.enableMidpoints&&"multipoint"!==t.type&&this._setUpMidpointGraphics(e),this.enableVertices&&(this._setUpVertexGraphics(e),this._setupCurveGraphics(e))}}_setUpMidpointGraphics(t){this._removeMidpointGraphics();const e=Q(t,this.symbols,this._coordinateHelper,"polygon"===this.graphic.geometry?.type);this.midpointGraphics.addMany(e),this.layer.addMany(e)}_setUpVertexGraphics(t){this._removeVertexGraphics();const e=W(t,this.symbols,this._coordinateHelper);this.vertexGraphics.addMany(e),this._storeRelatedVertexIndices(),this.layer.addMany(e)}_setupCurveGraphics(t){this._removeCurveGraphics();const e=X(t,this.symbols,this._coordinateHelper),i=Y(t,this.symbols,this._coordinateHelper);this.curveControlPointGraphics.addMany(e),this.constructionLineGraphics.addMany(i),this.layer.addMany(i),this.layer.addMany(e)}_updateSymbolsForTheme(){const t=this.view.effectiveTheme.accentColor;this.symbols={vertices:{...this.symbols.vertices,default:this.symbols.vertices.default.clone().set("color",t),hover:this.symbols.vertices.hover?.clone().set("color",t)},controlPoints:{...this.symbols.controlPoints,default:this.symbols.controlPoints.default.clone().set("color",t),hover:this.symbols.controlPoints.hover?.clone().set("color",t)},midpoints:{...this.symbols.midpoints},constructionLines:this.symbols.constructionLines.clone().set("color",t)};for(const e of this.vertexGraphics)this._isSelected(e)?e.symbol=this.symbols.vertices.selected:this._hoverGraphic===e?e.symbol=this.symbols.vertices.hover:e.symbol=this.symbols.vertices.default;for(const e of this.curveControlPointGraphics)this._isSelected(e)?e.symbol=this.symbols.controlPoints.selected:this._hoverGraphic===e?e.symbol=this.symbols.controlPoints.hover:e.symbol=this.symbols.controlPoints.default;for(const e of this.constructionLineGraphics)e.symbol=this.symbols.constructionLines}_storeRelatedVertexIndices(){const t=this.vertexGraphics.items;if(!t)return;const e=t.map(({geometry:t})=>({x:t.x,y:t.y}));for(let i=0;i<e.length;i++){const s=[];for(let t=0;t<e.length;t++){if(i===t)continue;const o=e[i],r=e[t];o.x===r.x&&o.y===r.y&&s.push(t)}t[i].attributes[tt.relatedGraphicIndices]=s}}_setupMover(){const{enableMovement:t,graphic:e,midpointGraphics:i,vertexGraphics:s,view:o}=this,r=s.concat(i,this.curveControlPointGraphics).items;t&&"multipoint"!==e.geometry?.type&&r.push(e),this._mover=new D({enableMoveAllGraphics:!1,highlightsEnabled:!1,indicatorsEnabled:!1,graphics:r,view:o,callbacks:{onGraphicClick:t=>this._onGraphicClickCallback(t),onGraphicMoveStart:t=>this._onGraphicMoveStartCallback(t),onGraphicMove:t=>this._onGraphicMoveCallback(t),onGraphicMoveStop:t=>this._onGraphicMoveStopCallback(t),onGraphicPointerOver:t=>this._onGraphicPointerOverCallback(t),onGraphicPointerOut:t=>this._onGraphicPointerOutCallback(t)}})}_setupConnectedReshapeManager(){const{connectedReshapeProviders:t}=this;null!=t&&0!==t.length&&(this._connectedReshapeManager=new L({providerFactories:t,view:this.view}))}_onGraphicClickCallback(t){t.viewEvent.stopPropagation();const e=t.graphic,i=this._isCurveControlPoint(e);if(e===this.graphic)this.clearSelection(),this.emit("graphic-click",t),this.callbacks.onGraphicClick?.(t);else if(this._isMidpoint(e)){if(2===t.viewEvent.button)return;const i=this.graphic.clone(),s=this._handleMidpointClickOrStartMove(t);this.refresh(),s.length&&this._emitVertexAddEvent([e],i,s)}else if(this._isVertex(e)||i){if(t.viewEvent.stopPropagation(),2===t.viewEvent.button)return void(i||this._removeVertices(e));t.viewEvent.native.shiftKey||this._clearSelection(),this.selectedManipulators.includes(e)?this._removeFromSelection(e,!0):this._addToSelection(e)}}_setUpOperation(t){const{graphic:e,dx:i,dy:s}=t,o=e===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(e,t),this._activeOperationInfo={target:this.graphic,mover:e,operationType:o?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(t){const{dx:e,dy:i,graphic:s}=t,o=this._connectedReshapeManager,r=o?Vt(this.graphic):null;if(s===this.graphic){const{geometry:n}=s;return this._setUpOperation(t),this._emitMoveStartEvent(e,i),r&&o?.startFeatureMove([r]),void(null!=n&&"point"===n.type&&this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(e,i)}))}const{selectedManipulators:n}=this;if(!n.includes(s)){if(this._clearSelection(),this._isMidpoint(s)){const e=this.graphic.clone(),i=this._handleMidpointClickOrStartMove(t);i.length&&(this._emitVertexAddEvent([s],e,i),this._refreshGraphicIndicesAttributes(i[0]))}this._addToSelection(s)}if(this._setUpOperation(t),r){const t=n.filter(t=>this._isVertex(t));o?.startVertexMove(r,It(t))}this._emitReshapeStartEvent(s),this._onHandleMove(s,e,i,t,()=>{this._updateTooltip(s,t.viewEvent),this._emitReshapeEvent(s)})}_onGraphicMoveCallback(t){const e=this._activeOperationInfo;if(!e)return;const{dx:i,dy:s,graphic:o}=t;e.totalDx+=i,e.totalDy+=s;const{operationType:r}=e,{geometry:n}=o;if(null!=n)if("move"!==r)this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(o,t.viewEvent),this._emitReshapeEvent(o)});else if("point"===n.type)this._onHandleMove(o,i,s,t,()=>{this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)});else if("polyline"===n.type||"polygon"===n.type){const e=gt(n);this._updateVertexGraphicLocations(e);const{dxMap:o,dyMap:r}=U(i,s,this.view);this._connectedReshapeManager?.translate(o,r,0),this._updateTooltip(this.graphic,t.viewEvent),this._emitMoveEvent(i,s)}}_onGraphicMoveStopCallback(t){const e=this._activeOperationInfo;if(!e)return;const{dx:i,dy:s,graphic:o}=t,{operationType:r}=e;e.totalDx+=i,e.totalDy+=s,this._onHandleMove(o,i,s,t,()=>"move"===r?this._emitMoveStopEvent():this._emitReshapeStopEvent(o)),this._isMidpoint(o)||o.getAttribute(tt.curveFromStraightEdgeFlag)?this.refresh():(this._updateTooltip(this._isVertex(o)?o:null),this._resetSnappingStateVars(),this._connectedReshapeManager?.finish(),this._activeOperationInfo=null)}_updateVertexGraphicLocations(t){const{_coordinateHelper:e}=this;for(const i of this.vertexGraphics){const{pathIndex:s,pointIndex:o}=i.attributes;i.geometry=e.arrayToPoint(O(t[s][o]))}this._updateMidpointGraphicLocations(t),this._updateCurveGraphicLocations(t)}_updateMidpointGraphicLocations(t){const{_coordinateHelper:e}=this;for(const i of this.midpointGraphics){const{pathIndex:s,pointIndexStart:o,pointIndexEnd:r}=i.attributes,n=t[s];i.geometry=et(n[o],n[r],e)}}_updateCurveGraphicLocations(t){const{spatialReference:e}=this._coordinateHelper,i=new Map;for(const s of this.selectedManipulators){const[t,e]=Et(s);null!=t&&null!=e&&s.getAttribute(tt.controlPointKind)&&a(i,t,()=>new Set)?.add(e)}for(const s of this.curveControlPointGraphics){const[e,o]=Et(s);if(i.get(e)?.has(o))continue;const r=t[e][o];if(V(r)||I(r)){const i=O(t[e][o-1]),n=V(r)?E(i,r):R(i,r),[a,h]=S(n,.25);s.geometry=new g({x:a,y:h,spatialReference:this._coordinateHelper.spatialReference})}else if(P(r)){const t=s.getAttribute(tt.controlPointKind),[e,i]=t===it.bezier.cp1?r.b[1]:r.b[2];s.geometry=new g({x:e,y:i,spatialReference:this._coordinateHelper.spatialReference})}}for(const s of this.constructionLineGraphics){const i=s.getAttribute(tt.controlPointKind),[o,r]=Et(s),n=t[o],a=O(n[r-1]),h=O(n[r]),p=t[o][r];i===it.bezier.line1?s.geometry=new f({paths:[[[a[0],a[1]],[...p.b[1]]]],spatialReference:e}):s.geometry=new f({paths:[[[h[0],h[1]],[...p.b[2]]]],spatialReference:e})}}_refreshGraphicIndicesAttributes(t){const{componentIndex:e,vertexIndex:i}=t,s=t=>{const[s,o]=Et(t);s===e&&o>=i&&t.setAttribute(tt.pointIndex,o+1)};this.vertexGraphics.forEach(s),this.curveControlPointGraphics.forEach(s),this.constructionLineGraphics.forEach(s);for(const o of this.midpointGraphics){if(o.getAttribute(tt.pathIndex)!==e)continue;const t=o.getAttribute(tt.pointIndexStart);t>=i&&(o.setAttribute(tt.pointIndexStart,t+1),o.setAttribute(tt.pointIndexEnd,o.getAttribute(tt.pointIndexEnd)+1))}}_getVertexFromEditGeometry(t){const[e,i]=Et(t);return p(this._editGeometryOperations),this._editGeometryOperations.data.parts[e].vertices[i]}_onHandleMove(t,e,s,o,r){c(this._snappingTask);const n=this._snappingContext;if(!n)return;const a=t.geometry,h="graphic-move-stop"===o.type;if(a&&C(a))if(null!=this.snappingManager&&this.selectedManipulators.length<2&&!h){const o=this.snappingManager;this._stagedVertex=o.update({point:a,context:n}),this._syncGeometryAfterVertexMove(t,new g(this._stagedVertex),e,s,h),r(),this._snappingTask=i(async i=>{const p=await o.snap({point:a,context:n,signal:i});p.valid&&(this._stagedVertex=p.apply(),this._syncGeometryAfterVertexMove(t,new g(this._stagedVertex),e,s,h),r())})}else{const i=null!=this._stagedVertex?new g(this._stagedVertex):a;this._syncGeometryAfterVertexMove(t,i,e,s,h),r()}}_syncGeometryAfterVertexMove(t,e,i,s,o=!1){const r=this._editGeometryOperations?.data.geometry;if(!r)return;const{_coordinateHelper:n}=this,a=n.pointToVector(e),h=this._getVertexFromEditGeometry(t);if(h){const t=n.getZ(a),e=a[0]-h.pos[0],i=a[1]-h.pos[1],s=null!=t?t-h.pos[2]:0;"point"!==r.type&&"mesh"!==r.type||this._editGeometryOperations?.moveVertices([h],e,i,s),this._connectedReshapeManager?.translate(e,i,s)}if("point"===r.type)t.geometry=e;else if("mesh"===r.type)t.geometry=r.centerAt(e);else{if(t!==this.graphic){const o=n.spatialReference,[a,h]=Et(t);let p=ft(r);const c=n.pointToArray(e);this._updateGeometryFromGraphic(t,p,a,h,c,o,"polygon"===r.type),this._isVertex(t)||this._isCurveControlPoint(t)?(p=this._moveRelatedCoordinates(p,t,c),p=this._moveSelectedHandleCoordinates(p,t,i,s,"polygon"===r.type),this._updateMidpointGraphicLocations(p),this._updateCurveGraphicLocations(p)):this._isMidpoint(t)&&this._updateCurveGraphicLocations(p),st(r,p)}this._updateGraphicGeometry(r.clone()),this._editGeometryOperations=lt.fromGeometry(r,2,{allowCurves:!0}),o&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(t),e):t.geometry=e)}}_moveRelatedCoordinates(t,e,i){const{relatedGraphicIndices:s}=e.attributes,o=this._coordinateHelper.spatialReference;if(!s?.length)return t;for(const r of s){const s=this.vertexGraphics.at(r),[n,a]=Et(s);St(t,n,a,i,o),s.geometry=e.geometry}return t}_moveSelectedHandleCoordinates(t,e,i,s,o){const r=this._coordinateHelper.spatialReference;for(const n of this.selectedManipulators)if(n!==e){const[e,a]=Et(n),h=n.getAttribute(tt.relatedGraphicIndices),p=F(n.geometry,i,s,this.view),c=b(p);if(n.geometry=p,this._updateGeometryFromGraphic(n,t,e,a,c,r,o),h?.length)for(const i of h){const e=this.vertexGraphics.at(i),[s,o]=Et(e);St(t,s,o,c,r),e.geometry=p}}return t}_updateGeometryFromGraphic(t,e,i,s,o,r,n){const a=e[i].length-1;this._isCurveControlPoint(t)?xt(e,i,s,[o[0],o[1]],t.getAttribute(tt.controlPointKind)):(St(e,i,s,o,r),n&&(0===s?St(e,i,a,o,r):s===a&&(e[i][0]=o)))}_onGraphicPointerOverCallback(t){const e=t.graphic;this._hoverGraphic=e;const i=this._isVertex(e);i&&!this._isSelected(e)?e.symbol=this.symbols.vertices.hover:this._isCurveControlPoint(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.controlPoints.hover),this._updateTooltip(i?e:null),this._updateHoverCursor(e)}_onGraphicPointerOutCallback(t){const e=t.graphic;this._hoverGraphic=null,this._isVertex(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.vertices.default),this._isCurveControlPoint(e)&&!this._isSelected(e)&&(e.symbol=this.symbols.controlPoints.default),this.removeHandles(yt),this._updateTooltip()}_handleMidpointClickOrStartMove(t){const{graphic:e}=t,i=this.graphic.geometry;if(null==i||"polygon"!==i.type&&"polyline"!==i.type)return[];const s=i.clone(),o=[],{[tt.pathIndex]:r,[tt.pointIndexStart]:n,[tt.pointIndexEnd]:a}=e.attributes,h=b(e.geometry),p=0===a?n+1:a;e.attributes={[tt.tool]:ot,[tt.pathIndex]:r,[tt.pointIndex]:p,[tt.relatedGraphicIndices]:[]};const c=ft(s),l=c[r][a];if(k(l)){if(this.enableCurveOnMidpoint&&t.viewEvent.native.shiftKey){const t=O(c[r][p]);c[r].splice(p,1,{c:[t,[h[0],h[1]]]}),e.setAttribute(tt.controlPointKind,it.circle.interior),e.setAttribute(tt.curveFromStraightEdgeFlag,!0),this.midpointGraphics.remove(e),this.curveControlPointGraphics.push(e),st(s,c)}else c[r].splice(p,0,h),o.push({coordinates:c[r][p],componentIndex:r,vertexIndex:p})}else{const t=O(c[r][n]),e=rt(t,l,.5,this._coordinateHelper);c[r].splice(a,1,...e),o.push({coordinates:O(c[r][p]),componentIndex:r,vertexIndex:p})}return this._updateGraphicGeometry(s),o}_addToSelection(t){const e=Ot(t);for(const i of e)this._isCurveControlPoint(i)?i.symbol=this.symbols.controlPoints.selected:i.symbol=this.symbols.vertices.selected,this.selectedManipulators.add(i),this._updateTooltip(i);this._emitSelectEvent(e)}_removeFromSelection(t,e){if(this._isVertex(t)){const{vertices:i}=this.symbols;t.symbol=e?i.hover:i.default}else if(this._isCurveControlPoint(t)){const{controlPoints:i}=this.symbols;t.symbol=e?i.hover:i.default}this.selectedManipulators.remove(t),this._emitDeselectEvent([t]),this._updateTooltip()}_clearSelection(){const t=this.selectedManipulators.toArray(),{controlPoints:e,vertices:i}=this.symbols;if(t.length>0){for(const s of t)this._isVertex(s)?s.symbol=i.default:this._isCurveControlPoint(s)&&(s.symbol=e.default);this.selectedManipulators.removeAll(),this._emitDeselectEvent(t),this._updateTooltip()}}_keyDownHandler(t){null==this._activeOperationInfo&&ut(t,this.tooltip)||ct.delete.includes(t.key)&&!t.repeat&&this.selectedManipulators.length&&this._removeVertices(this.selectedManipulators)}_removeVertices(t){const e=this.graphic.geometry,i=this.vertexGraphics.length;if(null==e||"polygon"!==e.type&&"polyline"!==e.type&&"multipoint"!==e.type)return;if("polygon"===e.type&&i<4||"multipoint"===e.type&&i<2||"polyline"===e.type&&i<3)return;const s=this.graphic.clone(),o=e.clone();let r=ft(o);const n=[],a=Ot(t);for(const h of a){if(this._isCurveControlPoint(h))continue;const{x:t,y:e}=h.geometry;for(let i=0;i<r.length;i++){const s=r[i];for(let o=0;o<s.length;o++){const[a,h]=O(s[o]);if(t===a&&e===h){n.push({coordinates:O(r[i][o]),componentIndex:i,vertexIndex:o}),r[i].splice(Number(o),1);const t=r[i][o];t&&!k(t)&&(r[i][o]=O(t))}}}}if("polygon"===o.type)r=r.filter(t=>{if(t.length<2)return!1;const[e,i]=O(t[0]),[s,o]=O(t[t.length-1]);return(2!==t.length||e!==s||i!==o)&&(e===s&&i===o||t.push(t[0]),!0)});else if("polyline"===o.type)for(const h of r)1===h.length&&r.splice(r.indexOf(h),1);st(o,r),this._updateGraphicGeometry(o),this.refresh(),this._emitVertexRemoveEvent(a,s,n)}_isVertex(t){return this.vertexGraphics.includes(t)}_isCurveControlPoint(t){return this.curveControlPointGraphics.includes(t)}_isConstructionLine(t){return this.constructionLineGraphics.includes(t)}_isSelected(t){return(this._isVertex(t)||this.curveControlPointGraphics.includes(t))&&this.selectedManipulators.includes(t)}_isMidpoint(t){return this.midpointGraphics.includes(t)}_updateHoverCursor(t){const e=this._isMidpoint(t)?"copy":"move";this.addHandles(this.view.acquireCursor(e,"high"),yt)}_updateTooltip(t,e){let i=null;const{graphic:s,view:o,tooltipInfos:r}=this,n=s?.geometry;"point"===n?.type?i=r.movePoint:this._selectedManipulator?i=r.selectedVertex:t===this.graphic?(i=r.translateGraphic,$(i,o,this._tooltipsContext,e)):t&&this.selectedManipulators.length>1&&(i=r.translateVertices,B(i,o,n,this._tooltipsContext,e)),this.activeTooltipInfo=i}_updateGraphicGeometry(t){this._updateHandlesOnExternalGeometryChange?.pause(),this.graphic.geometry=t,this._updateHandlesOnExternalGeometryChange?.resume()}_emitMoveStartEvent(t,e){const i={type:"move-start",mover:this.graphic,dx:t,dy:e};this.emit("move-start",i),this.callbacks.onMoveStart?.(i)}_emitMoveEvent(t,e){const i={type:"move",mover:this.graphic,dx:t,dy:e};this.emit("move",i),this.callbacks.onMove?.(i)}_emitMoveStopEvent(t,e){if(null==t||null==e){const i=this._activeOperationInfo;if(!i)return;t=i.totalDx,e=i.totalDy}const i={type:"move-stop",mover:this.graphic,dx:t,dy:e};this.emit("move-stop",i),this.callbacks.onMoveStop?.(i)}_emitReshapeStartEvent(t){const e={type:"reshape-start",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape-start",e),this.callbacks.onReshapeStart?.(e)}_emitReshapeEvent(t){const e={type:"reshape",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape",e),this.callbacks.onReshape?.(e)}_emitReshapeStopEvent(t){const e={type:"reshape-stop",graphic:this.graphic,mover:t,selected:this.selectedManipulators.toArray()};this.emit("reshape-stop",e),this.callbacks.onReshapeStop?.(e)}_emitSelectEvent(t){const e={type:"vertex-select",added:t};this.emit("select",e),this.callbacks.onVertexSelect?.(e)}_emitDeselectEvent(t){const e={type:"vertex-deselect",removed:t};this.emit("deselect",e),this.callbacks.onVertexDeselect?.(e)}_emitVertexAddEvent(t,e,i){const s={type:"vertex-add",added:t,graphic:this.graphic,oldGraphic:e,vertices:i};this.emit("vertex-add",s),this.callbacks.onVertexAdd?.(s)}_emitVertexRemoveEvent(t,e,i){const s={type:"vertex-remove",removed:t,graphic:this.graphic,oldGraphic:e,vertices:i};this.emit("vertex-remove",s),this.callbacks.onVertexRemove?.(s)}_logGeometryTypeError(){n.getLogger(this).error(new o("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};function gt(t){const e=ft(t.clone());if("polygon"===t.type)for(const i of e){const t=i[i.length-1];if(!k(t))continue;const e=i[0];e[0]===t[0]&&e[1]===t[1]&&i.length>2&&i.pop()}return e}function ft(t){return"polygon"===t.type?t.curveRings?.slice()??t.rings.slice():"polyline"===t.type?t.curvePaths?.slice()??t.paths.slice():t.points.map(t=>[t])}function Gt(t,e,i,s){const o=t[e][i];if(V(o))o.c[1]=s;else if(I(o)){const o=O(t[e][i]);t[e][i]={c:[o,s]}}}function xt(t,e,i,s,o){switch(o){case it.circle.interior:Gt(t,e,i,s);break;case it.bezier.cp1:t[e][i].b[1]=s;break;case it.bezier.cp2:t[e][i].b[2]=s}}function Mt(t,e){return t<1e-8*e}function bt(t,{cx:e,cy:i,isInvalid:s,thetaStart:o,thetaEnd:r},n,a){const[h,p]=t,[c,l]=n,d=c-h,m=l-p;e-=h,i-=p;const v=a?o>r:o<r,[u,y]=s?[e,i]:v?[-i,e]:[i,-e],[_,g]=[d,m],[f,G]=[u,y],x=_*G-g*f,M=(d**2+m**2)/2;if(Mt(Math.abs(x),M))return[(h+c)/2,(p+l)/2];const[b,C]=[G/x*M,-f/x*M],S=b**2+C**2,[E,w]=[d/2-b,m/2-C];if(Mt(E**2+w**2,S)){const[t,e]=v?[-C,b]:[C,-b];return[t+b+h,e+C+p]}const O=Math.sqrt((b**2+C**2)/(E**2+w**2))*Math.sign(d*u+m*y);return[E*O+b+h,w*O+C+p]}function Ct(t,e,i){const s=G(new f({curvePaths:[[t,e]],spatialReference:i})),{curvePaths:o}=x(s,i),r=o[0][1];return H(r)?r:w(t,r)}function St(t,e,i,s,o){const r=t[e][i],n=t[e].at(i+1);if(nt(t,e)){const i=t[e][1];return t[e][0]=[...s],void(t[e][1]={a:[[...s],[...i.a[1]],0,0]})}if(at(t,e)){const i=t[e][1],[o,r]=i.a[1],[n,a]=s,h=Math.hypot(n-o,a-r),[p,c]=[n-o,a-r],l=T(c,p);return t[e][0]=[...s],void(t[e][1]={a:[[...s],[...i.a[1]],0,0,l,h,i.a[6]]})}const a=O(r);if(k(r))r.splice(0,r.length,...s);else if(P(r))r.b[0].splice(0,r.b[0].length,...s);else if(V(r)||I(r)){const o=O(t[e][i-1]),n=V(r)?E(o,r):R(o,r);t[e].splice(i,1,{c:[[...s],bt(o,n,s,!0)]})}else if(H(r)){r.a[0].splice(0,r.a[0].length,...s);const n=O(t[e][i-1]);r.a=Ct(n,r,o).a}if(n&&!k(n)&&!P(r))if(V(n)||I(n)){const o=O(n),r=V(n)?E(a,n):R(a,n);t[e].splice(i+1,1,{c:[o,bt(o,r,s,!1)]})}else if(H(n)){const t=O(r);n.a=Ct(t,n,o).a}}function Et({attributes:t}){return[t?.[tt.pathIndex]||0,t?.[tt.pointIndex]||0]}function wt({attributes:t}){return`${t?.[tt.pathIndex]}-${t?.[tt.pointIndex]}`}function Ot(t){return t instanceof e?[t]:[...t]}function Vt(t){const e=t.sourceLayer??t.layer;return N(e)?{graphic:t,layer:e}:null}function It(t){return t.toArray().map(({attributes:t})=>({pathIndex:t[tt.pathIndex],vertexIndex:t[tt.pointIndex]}))}t([y()],_t.prototype,"_activeOperationInfo",void 0),t([y()],_t.prototype,"_connectedReshapeManager",void 0),t([y()],_t.prototype,"_coordinateHelper",null),t([y()],_t.prototype,"_editGeometryOperations",void 0),t([y()],_t.prototype,"tooltip",void 0),t([y()],_t.prototype,"tooltipInfos",void 0),t([y()],_t.prototype,"activeTooltipInfo",void 0),t([y({constructOnly:!0})],_t.prototype,"automaticAreaMeasurementUtils",void 0),t([y({constructOnly:!0})],_t.prototype,"automaticLengthMeasurementUtils",void 0),t([y()],_t.prototype,"_selectedManipulator",null),t([y()],_t.prototype,"_tooltipsContext",null),t([y()],_t.prototype,"callbacks",void 0),t([y()],_t.prototype,"connectedReshapeProviders",void 0),t([y()],_t.prototype,"enableMidpoints",void 0),t([y()],_t.prototype,"enableCurveOnMidpoint",void 0),t([y()],_t.prototype,"enableMovement",void 0),t([y()],_t.prototype,"enableVertices",void 0),t([y()],_t.prototype,"graphic",void 0),t([y()],_t.prototype,"highlightName",void 0),t([y()],_t.prototype,"highlightsEnabled",void 0),t([y()],_t.prototype,"layer",void 0),t([y()],_t.prototype,"snappingManager",void 0),t([y({readOnly:!0})],_t.prototype,"state",null),t([y()],_t.prototype,"symbols",void 0),t([y({type:dt})],_t.prototype,"sketchOptions",void 0),t([y({readOnly:!0})],_t.prototype,"type",void 0),t([y({readOnly:!0})],_t.prototype,"vertexGraphics",void 0),t([y({readOnly:!0})],_t.prototype,"curveControlPointGraphics",void 0),t([y({readOnly:!0})],_t.prototype,"constructionLineGraphics",void 0),t([y({readOnly:!0})],_t.prototype,"midpointGraphics",void 0),t([y({readOnly:!0})],_t.prototype,"selectedManipulators",void 0),t([y()],_t.prototype,"view",void 0),_t=t([_("esri.views.draw.support.Reshape")],_t);const Pt=_t;export{Pt 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/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../Graphic.js";import{equals as t}from"../../../core/arrayUtils.js";import o from"../../../geometry/Point.js";import r from"../../../geometry/Polyline.js";import{getMidpoint as
|
|
5
|
+
import e from"../../../Graphic.js";import{equals as t}from"../../../core/arrayUtils.js";import o from"../../../geometry/Point.js";import r from"../../../geometry/Polyline.js";import{getMidpoint as n}from"../../../geometry/support/coordsUtils.js";import{isMultipoint as i,isPolygon as s,isPolyline as l}from"../../../geometry/support/typeUtils.js";import{interpolateBezierCurve as c,splitBezierCurve as a}from"../../../geometry/support/curves/bezierCurveUtils.js";import{interpolateCircle as p}from"../../../geometry/support/curves/circleUtils.js";import{deriveCircleFromCircularArc as u,splitCircularArc as m}from"../../../geometry/support/curves/circularArcUtils.js";import{getEndpoint as d,isCoordinate as f,isBezierCurve as h,isEllipticArc4 as y,isCircularArc as v,isEllipticArc as g,isEllipticArc7 as x}from"../../../geometry/support/curves/curveUtils.js";import{deriveCircleFromEllipticArc4 as b,splitEllipticArc4 as w}from"../../../geometry/support/curves/ellipticArc4Utils.js";import{deriveEllipse as z,interpolateEllipse as I,splitEllipticArc7 as j}from"../../../geometry/support/curves/ellipticArc7Utils.js";import P from"../../../symbols/SimpleLineSymbol.js";import S from"../../../symbols/SimpleMarkerSymbol.js";import{settings as C}from"./settings.js";const R={pathIndex:"pathIndex",pointIndex:"pointIndex",pointIndexStart:"pointIndexStart",pointIndexEnd:"pointIndexEnd",controlPointKind:"kind",relatedGraphicIndices:"relatedGraphicIndices",curveFromStraightEdgeFlag:"curveFromStraightEdgeFlag",tool:"esriSketchTool"},U={bezier:{cp1:"bezier-cp-1",cp2:"bezier-cp-2",line1:"bezier-line-1",line2:"bezier-line-2"},circle:{interior:"circle-interior"}},k="box",E=C.reshapeGraphics,T={vertices:{default:new S({style:"circle",size:E.vertex.size,color:E.vertex.color,outline:{color:E.vertex.outlineColor,width:1}}),hover:new S({style:"circle",size:E.vertex.hoverSize,color:E.vertex.hoverColor,outline:{color:E.vertex.hoverOutlineColor,width:1}}),selected:new S({style:"circle",size:E.selected.size,color:E.selected.color,outline:{color:E.selected.outlineColor,width:1}})},controlPoints:{default:new S({style:"diamond",size:E.vertex.size,color:E.vertex.color,outline:{color:E.vertex.outlineColor,width:1}}),hover:new S({style:"diamond",size:E.vertex.hoverSize,color:E.vertex.hoverColor,outline:{color:E.vertex.hoverOutlineColor,width:1}}),selected:new S({style:"diamond",size:E.selected.size,color:E.selected.color,outline:{color:E.selected.outlineColor,width:1}})},midpoints:{default:new S({style:"circle",size:E.midpoint.size,color:E.midpoint.color,outline:{color:E.midpoint.outlineColor,width:1}}),hover:new S({style:"circle",size:E.midpoint.size,color:E.midpoint.color,outline:{color:E.midpoint.outlineColor,width:1}})},constructionLines:new P({style:"solid",width:1,color:E.vertex.color})};function K(t,o,r){const n=[];return t?.forEach((t,i)=>{t.forEach((t,s)=>{n.push(new e({geometry:r.arrayToPoint(d(t)),symbol:o?.vertices?.default,attributes:{[R.tool]:k,[R.pathIndex]:i,[R.pointIndex]:s}}))})}),n}function F(t,o,r){const n=[];for(let i=0;i<t.length;i++){const s=t[i];if(!Z(t,i))for(let t=1;t<s.length;t++){const l=s[t];if(f(l))continue;const c=d(s[t-1]),a={[R.tool]:k,[R.pathIndex]:i,[R.pointIndex]:t};if(h(l)){const t=l.b.slice(1);n.push(...t.map((t,n)=>new e({geometry:r.arrayToPoint(t),symbol:o?.controlPoints?.default,attributes:{...a,[R.controlPointKind]:0===n?U.bezier.cp1:U.bezier.cp2}})))}const m=v(l),g=y(l);if(m||g){const t=m?u(c,l):b(c,l),i=p(t,.25);n.push(new e({geometry:r.arrayToPoint(i),symbol:o?.controlPoints?.default,attributes:{...a,[R.controlPointKind]:U.circle.interior}}))}}}return n}function G(t,o,n){const i=[],{spatialReference:s}=n;for(let l=0;l<t.length;l++){const n=t[l];for(let t=1;t<n.length;t++){const c=n[t];if(!h(c))continue;const[a,p,u]=c.b,m=d(n[t-1]),f={[R.tool]:k,[R.pathIndex]:l,[R.pointIndex]:t};i.push(new e({geometry:new r({paths:[[[m[0],m[1]],p]],spatialReference:s}),symbol:o?.constructionLines,attributes:{...f,[R.controlPointKind]:U.bezier.line1}}),new e({geometry:new r({paths:[[[a[0],a[1]],u]],spatialReference:s}),symbol:o?.constructionLines,attributes:{...f,[R.controlPointKind]:U.bezier.line2}}))}}return i}function L(t,o,r,n){const i=[];for(let s=0;s<t.length;s++){const l=t[s],c=O(t,s);for(let t=0;t<l.length;t++){const a=(t+1)%l.length;if((!n||c)&&0===a)continue;const p=M(l[t],l[a],r);i.push(new e({geometry:p,symbol:o.midpoints.default,attributes:{[R.tool]:k,[R.pathIndex]:s,[R.pointIndexStart]:t,[R.pointIndexEnd]:a}}))}}return i}function M(e,t,r){const i=d(e),s=d(t),{spatialReference:l}=r,a=r.arrayToVector(i),m=r.arrayToVector(s),g=r.toXYZ(a),x=r.toXYZ(m),[w,j,P]=n(g,x),S=r.hasM()?0:void 0;if(f(t))return new o({x:w,y:j,z:P,m:S,spatialReference:l});if(h(t)){const[e,r]=c(i,t,.5);return new o({x:e,y:r,z:P,m:S,spatialReference:l})}if(v(t)){const e=u(i,t),[r,n]=p(e,.5);return new o({x:r,y:n,z:P,m:S,spatialReference:l})}if(y(t)){const e=b(i,t),[r,n]=p(e,.5);return new o({x:r,y:n,z:P,m:S,spatialReference:l})}const C=z(i,t),[R,U]=I(C,.5);return new o({x:R,y:U,z:P,m:S,spatialReference:l})}function Z(e,o){const r=e.at(o);return 2===r?.length&&t(d(r[1]),d(r[0]))&&y(r[1])}function A(e,o){const r=e.at(o);return 2===r?.length&&t(d(r[1]),d(r[0]))&&x(r[1])}function O(e,o){const r=e.at(o);return 2===r?.length&&t(d(r[1]),d(r[0]))&&g(r[1])}function V(e,t){if(i(e))return void(e.points=t.flat());const o=t.some(e=>e.some(e=>!f(e)));s(e)?o?(e.curveRings=t,e.rings=[]):(e.rings=t,e.curveRings=void 0):l(e)&&(o?(e.curvePaths=t,e.paths=[]):(e.curvePaths=void 0,e.paths=t))}function X(e,t,o,r){const n=d(t);let i=[];switch(!0){case h(t):i=a(e,t,o);break;case v(t):{const r=u(e,t);i=m(r,t,o);break}case y(t):{const r=b(e,t);i=w(r,t,o);break}default:{const r=z(e,t);i=j(r,t,o);break}}if(i.length<2)return i;if(r.hasZ()){const t=e.at(2)??0,r=n.at(2)??0,s=t+(r-t)*o;d(i[0])[2]=s,d(i[1])[2]=r}if(r.hasM()){const e=r.hasZ()?3:2;d(i[0])[e]=0,d(i[1])[e]=n.at(-1)??0}return i}export{R as attributeKeys,U as controlPointKinds,G as createCurveConstructionLineGraphics,F as createCurveControlPointGraphics,L as createMidpointGraphics,K as createVertexGraphics,T as defaultSymbols,M as getMidpoint,Z as isSingleSegmentCircle,A as isSingleSegmentEllipse,O as isSingleSegmentPolygon,V as saveUpdatedCurveOrCoordinate,X as splitCurve,k as toolIdAttribute};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as t}from"../../core/arrayUtils.js";import"../../core/has.js";import{clone as n}from"../../core/lang.js";import{clamp as e}from"../../core/mathUtils.js";import{createScreenPoint as r}from"../../core/screenUtils.js";import{project as
|
|
5
|
+
import{isSome as t}from"../../core/arrayUtils.js";import"../../core/has.js";import{clone as n}from"../../core/lang.js";import{clamp as e}from"../../core/mathUtils.js";import{createScreenPoint as r}from"../../core/screenUtils.js";import{project as a}from"../../geometry/projectionUtils.js";import{isMeshWithRelativeVertexSpace as o}from"../../geometry/support/meshVertexSpaceUtils.js";import{clonePoint as l,hydratedSpatialReference as c}from"../../layers/graphics/hydratedFeatures.js";import{getZForElevationMode as s}from"../../support/elevationInfoUtils.js";import{EditGeometryOperations as u}from"./editGeometry/EditGeometryOperations.js";function i(t,n){let e=null,r=null;return a=>{if("cancel"===a.action)return void(null!=r&&(r.execute({action:"cancel"}),e=null,r=null));const o={action:a.action,screenStart:a.start,screenEnd:a.screenPoint};"start"===a.action&&null==e&&(e=new D,r=new D,n(t,e,r,a.pointerType,o)),null!=e&&e.execute(o),"end"===a.action&&null!=e&&(e=null,r=null)}}function p(t,n){return t.events.on("drag",i(t,n))}function m(t,n){const e=[t.x,t.y,t.z??0],r=n,a=[Math.cos(r),Math.sin(r)],o=Math.sqrt(a[0]*a[0]+a[1]*a[1]);if(0===o)return null;a[0]/=o,a[1]/=o;const l=t=>{const n=(t.x-e[0])*a[0]+(t.y-e[1])*a[1];t.x=e[0]+n*a[0],t.y=e[1]+n*a[1]};return t=>(l(t.mapStart),l(t.mapEnd),{...t,axis:a})}function f(t){let n=null;const e=j();return r=>{if("start"===r.action&&(n=y(t,r.mapStart.spatialReference)),null==n)return null;const a=e(r);if(!a)return null;const{translationX:o,translationY:l,translationZ:c}=a;return n.move(o,l,c,r.action),a}}function d(t,n){return null==t?null:t.spatialReference.equals(n)?t.clone():a(t,n)}function y(t,n){const e=t.operations;if(!e)return null;const r=e.data.geometry,l=c(n);if(r.spatialReference.equals(l))return x(t,e,()=>{});if("mesh"!==r.type){const n=d(r,l);if(null==n)return null;const o=r.spatialReference,c=u.fromGeometry(n,e.viewingMode);return x(t,c,()=>{const t=c.data.geometry,n=a(t,o);e.trySetGeometry(n)})}if(o(r)){const n=d(r.origin,l);if(!n)return null;const o=r.spatialReference,c=u.fromGeometry(n,e.viewingMode);return x(t,e,()=>{const t=a(c.data.geometry,o),n=t.x-r.origin.x,l=t.y-r.origin.y,s=(t.z??0)-(r.origin.z??0);e.move(n,l,s)})}return null}function x(t,n,e){let r=0,a=0,o=0;return{move:(l,c,s,u)=>{"start"===u&&(r=0,a=0,o=0);const i=l-r,p=c-a,m=s-o;n.move(i,p,m),r+=i,a+=p,o+=m,e(),"end"===u&&t.endInteraction?.()}}}function E(t,n=null,e){let r=null;const o=null==n||t.spatialReference?.equals(n)?t=>t:t=>null!=t?a(t,n):t,l={exclude:[],...e};return n=>{if("start"===n.action&&(r=o(t.toMap(n.screenStart,l))),null==r)return null;const e=o(t.toMap(n.screenEnd,l));return null!=e?{...n,mapStart:r,mapEnd:e}:null}}function S(n){const e=n.map(t=>f(t)).filter(t),r=j();return t=>{const n=r(t);return e.forEach(n=>n(t)),n}}function h(t,e){const r=new Map;for(const a of e)r.set(a,n(t[a]));return n=>(r.forEach((n,e)=>{t[e]=n}),n)}function g(t){const n=t.operations?.createResetState();return t=>(n?.remove(),t)}function v(t){const n=t.map(t=>g(t)).filter(t=>null!=t);return t=>(n.forEach(n=>n(t)),t)}function z(){let t=0,n=0,e=0;return r=>{"start"===r.action&&(t=r.mapStart.x,n=r.mapStart.y,e=r.mapStart.z??0);const a=r.mapEnd.x-t,o=r.mapEnd.y-n,l=(r.mapEnd.z??0)-e;return t=r.mapEnd.x,n=r.mapEnd.y,e=r.mapEnd.z,{...r,mapDeltaX:a,mapDeltaY:o,mapDeltaZ:l,mapDeltaSpatialReference:r.mapStart.spatialReference}}}function j(){let t=0,n=0,e=0;return r=>{"start"===r.action&&(t=r.mapStart.x,n=r.mapStart.y,e=r.mapStart.z??0);const a=r.mapEnd.x-t,o=r.mapEnd.y-n,l=(r.mapEnd.z??0)-e;return{...r,translationX:a,translationY:o,translationZ:l}}}function M(){let t=0,n=0;return e=>{"start"===e.action&&(t=e.screenStart.x,n=e.screenStart.y);const r=e.screenEnd.x-t,a=e.screenEnd.y-n;return t=e.screenEnd.x,n=e.screenEnd.y,{...e,screenDeltaX:r,screenDeltaY:a}}}function R(t,n){let a=null,o=0,l=0;return c=>{if("start"===c.action&&(a=t.toScreen?.(n),null!=a&&(a.x<0||a.x>t.width||a.y<0||a.y>t.height?a=null:(o=c.screenStart.x-a.x,l=c.screenStart.y-a.y))),null==a)return null;const s=e(c.screenEnd.x-o,0,t.width),u=e(c.screenEnd.y-l,0,t.height),i=r(s,u);return c.screenStart=a,c.screenEnd=i,c}}const w=()=>{};class D{constructor(){this.execute=w}next(t,n=new D){return null!=t&&(this.execute=e=>{const r=t(e);null!=r&&n.execute(r)}),n}}function U(t,n,e=[]){if("2d"===t.type)return t=>t;let r=null;return a=>{"start"===a.action&&(r=t.toMap(a.screenStart,{exclude:e}),null!=r&&(r.z=s(r,t,n)));const o=t.toMap(a.screenEnd,{exclude:e});null!=o&&(o.z=s(o,t,n));const l=null!=r&&null!=o?{sceneStart:r,sceneEnd:o}:null;return{...a,scenePoints:l}}}function G(t,n,e){const r=n.elevationProvider.getElevation(t.x,t.y,t.z??0,t.spatialReference,"scene")??0,a=l(t);return a.z=r,a.hasZ=!0,a.z=s(a,n,e),a}function q(t,n){if("2d"===t.type)return t=>t;let e=null;return r=>{"start"===r.action&&(e=G(r.mapStart,t,n));const a=G(r.mapEnd,t,n),o=null!=e&&null!=a?{sceneStart:e,sceneEnd:a}:null;return{...r,scenePoints:o}}}export{D as EventPipeline,z as addMapDelta,j as addMapTranslation,M as addScreenDelta,m as constrainToMapAxis,i as createDragEventPipelineCallback,p as createManipulatorDragEventPipeline,R as dragAtLocation,f as dragManipulatedObject,S as dragManipulatedObjectMany,g as resetManipulatedObject,v as resetManipulatedObjectMany,h as resetProperties,U as sceneSnappingAtLocation,q as sceneSnappingAtProjectedLocation,E as screenToMap};
|
package/views/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTileStore.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/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import"../../../../../core/has.js";import{intersection as s,isSubsetOf as i}from"../../../../../core/SetUtils.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as n,intersects as l,fromExtent as
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import"../../../../../core/has.js";import{intersection as s,isSubsetOf as i}from"../../../../../core/SetUtils.js";import{property as r}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as o}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as n,intersects as l,fromExtent as c,area as u}from"../../../../../geometry/support/aaBoundingRect.js";import{getBoundsOptimizedGeometry as h}from"../../../../../layers/graphics/featureConversionUtils.js";import{BoundsStore as a}from"../../../../../layers/graphics/data/BoundsStore.js";import{TileKey as d}from"../../../../../layers/support/TileKey.js";import{executeQueryForCount as f}from"../../../../../rest/query/operations/query.js";import{FeatureServiceTileCache as _}from"./FeatureServiceTileCache.js";let m=class extends t{setPriorityOrderByKey(e){this._tiles.setPriorityOrderByKey(e)}get _memoryLimitExceeded(){return this.featureStore.usedMemory>=this.maximumByteSize}constructor(e){super(e),this.tileInfo=null,this.extent=null,this.maximumByteSize=10485760,this._tileBounds=new a,this._tiles=new _,this._refCounts=new Map,this._tileFeatureCounts=new Map,this._tmpBoundingRect=n()}add(e,t){for(const s of t)this._referenceFeature(s.objectId);const i=this.featureStore.upsertMany(t),r=i.map(e=>new Set(Object.keys(e.attributes))).reduce((e,t)=>s(e,t),new Set(Object.keys(i[0]?.attributes??[]))),o=this._memoryLimitExceeded;this._addTileStorage(e,new Set(i.map(e=>e.objectId)),r),o&&this._applyCacheMemoryLimits()}_applyCacheMemoryLimits(){if(!this._memoryLimitExceeded)return;const{_tiles:e,featureStore:t,maximumByteSize:s}=this;e.someFromLowestToHighestPriority(e=>!this._memoryLimitExceeded||t.usedMemory-this._estimateRemoveTileMemoryReduction(e)<s||(this._removeTileStorage(e),!1))}_estimateRemoveTileMemoryReduction(e){let t=0;for(const s of e.objectIds){if(1===this._refCounts.get(s)){const e=this.featureStore.getFeature(s);e&&(t+=this.featureStore.estimateFeatureUsedMemory?.(e)??0)}}return t}getAttributesForTile(e){return e?this._tiles.get(e)?.attributeKeys:null}destroy(){this.clear(),this._tileFeatureCounts.clear()}clear(){this.featureStore.clear(),this._tileBounds.clear(),this._tiles.clear(),this._refCounts.clear()}refresh(){this.clear(),this._tileFeatureCounts.clear()}processEdits(e,t,s){return this._processEditsDelete(e.deletedFeatures.concat(e.updatedFeatures)),this._processEditsRefetch(e.addedFeatures.concat(e.updatedFeatures),t,s)}_addTileStorage(e,t,s){const i=e.id;this._tiles.set(i,new y(e,t,s)),this._tileBounds.set(i,e.extent),this._tileFeatureCounts.set(i,t.size)}_remove({id:e}){const t=this._tiles.get(e);t&&this._removeTileStorage(t)}_removeTileStorage(e){const t=[];for(const i of e.objectIds)1===this._unreferenceFeature(i)&&t.push(i);this.featureStore.removeManyById(t);const s=e.key.id;this._tiles.delete(s),this._tileBounds.delete(s)}_processEditsDelete(e){this.featureStore.removeManyById(e);for(const t of this._tiles.values()){for(const s of e)t.objectIds.delete(s);this._tileFeatureCounts.set(t.key.id,t.objectIds.size)}for(const t of e)this._refCounts.delete(t)}async _processEditsRefetch(e,t,s){if(!e.length)return;const{features:i}=await t(e,s);for(const r of i){const e=h(this._tmpBoundingRect,r.geometry);null!=e&&this._tileBounds.forEachInBounds(e,e=>{const t=this._tiles.get(e);this.featureStore.add(r);const s=r.objectId;t.objectIds.has(s)||(t.objectIds.add(s),this._referenceFeature(s),this._tileFeatureCounts.set(t.key.id,t.objectIds.size))})}}process(e,t=()=>!0,s){if(null==this.tileInfo||!e.extent||null!=this.extent&&!l(c(this.extent,this._tmpBoundingRect),e.extent))return new v(e);if(this._memoryLimitExceeded&&!this._tiles.hasLowerPriority(e.id??""))return new v(e);const r=this.getAttributesForTile(e.id);if(i(s,r))return new v(e);const o=this._createTileTree(e,this.tileInfo);return this._simplify(o,t,null,0,1),this._collectMissingTiles(e,o,this.tileInfo,s)}get debugInfo(){return Array.from(this._tiles.values()).map(({key:e})=>({key:e.toJSON(),featureCount:this._tileFeatureCounts.get(e.id)||0}))}getFeatureCount(e){return this._tileFeatureCounts.get(e.id)??0}async fetchCount(e,t,s,i){const r=this._tileFeatureCounts.get(e.id);if(null!=r)return r;const o=await f(t,s,i);return this._tileFeatureCounts.set(e.id,o.data.count),o.data.count}_createTileTree(e,t){const s=new g(e.level,e.row,e.col);return t.updateTileInfo(s,1),this._tileBounds.forEachInBounds(e.extent,i=>{const r=this._tiles.get(i)?.key;r&&p(e,r)&&this._populateChildren(s,r,t,this._tileFeatureCounts.get(r.id)||0)}),s}_populateChildren(e,t,s,i){const r=t.level-e.level-1;if(r<0)return void(e.isLeaf=!0);const o=t.row>>r,n=t.col>>r,l=e.row<<1,c=n-(e.col<<1)+(o-l<<1),u=e.children[c];if(null!=u)this._populateChildren(u,t,s,i);else{const r=new g(e.level+1,o,n);s.updateTileInfo(r,1),e.children[c]=r,this._populateChildren(r,t,s,i)}}_simplify(e,t,s,i,r){const o=r*r;if(e.isLeaf)return t(this.getFeatureCount(e),r)?0:(this._remove(e),null!=s&&(s.children[i]=null),o);const n=r/2,l=n*n;let c=0;for(let u=0;u<e.children.length;u++){const s=e.children[u];c+=null!=s?this._simplify(s,t,e,u,n):l}return 0===c?this._mergeChildren(e):1-c/o<S&&(this._purge(e),null!=s&&(s.children[i]=null),c=o),c}_mergeChildren(e){const t=new Set;let i;this._forEachLeaf(e,e=>{const r=this._tiles.get(e.id);if(r){i=i?s(i,r.attributeKeys):new Set(r.attributeKeys);for(const e of r.objectIds)t.has(e)||(t.add(e),this._referenceFeature(e));this._remove(e)}}),this._addTileStorage(e,t,i??new Set),e.isLeaf=!0,e.children[0]=e.children[1]=e.children[2]=e.children[3]=null,this._tileFeatureCounts.set(e.id,t.size)}_forEachLeaf(e,t){for(const s of e.children)null!=s&&(s.isLeaf?t(s):this._forEachLeaf(s,t))}_purge(e){if(null!=e)if(e.isLeaf)this._remove(e);else for(let t=0;t<e.children.length;t++){const s=e.children[t];this._purge(s),e.children[t]=null}}_collectMissingTiles(e,t,s,i){const r=new C(s,e,this.extent);return this._collectMissingTilesRecurse(t,r,1,i),r.info}_collectMissingTilesRecurse(e,t,s,r){const o=this.getAttributesForTile(e.id),n=o&&!i(r,o);if(n&&t.addMissing(e.level,e.row,e.col,s),e.isLeaf)return;if(!e.hasChildren)return void(n||t.addMissing(e.level,e.row,e.col,s));const l=s/2;for(let i=0;i<e.children.length;i++){const s=e.children[i];null==s?t.addMissing(e.level+1,(e.row<<1)+((2&i)>>1),(e.col<<1)+(1&i),l):this._collectMissingTilesRecurse(s,t,l,r)}}_referenceFeature(e){const t=(this._refCounts.get(e)||0)+1;return this._refCounts.set(e,t),1===t?0:2}_unreferenceFeature(e){const t=(this._refCounts.get(e)||0)-1;return 0===t?(this._refCounts.delete(e),1):(t>0&&this._refCounts.set(e,t),2)}get test(){}};function p(e,t){if(!e||!t)return!1;if(e.level===t.level)return e.row===t.row&&e.col===t.col;const s=e.level<t.level,i=s?e:t,r=s?t:e,o=1<<r.level-i.level;return Math.floor(r.row/o)===i.row&&Math.floor(r.col/o)===i.col}e([r({constructOnly:!0})],m.prototype,"featureStore",void 0),e([r()],m.prototype,"tileInfo",void 0),e([r()],m.prototype,"extent",void 0),e([r()],m.prototype,"maximumByteSize",void 0),m=e([o("esri.views.interactive.snapping.featureSources.featureServiceSource.FeatureServiceTileStore")],m);class y{constructor(e,t,s){this.key=e,this.objectIds=t,this.attributeKeys=s}}class g extends d{constructor(){super(...arguments),this.isLeaf=!1,this.children=[null,null,null,null]}get hasChildren(){return!this.isLeaf&&(null!=this.children[0]||null!=this.children[1]||null!=this.children[2]||null!=this.children[3])}}class v{constructor(e,t=[]){this.missingTiles=t,this.fullArea=0,this.coveredArea=0,this.fullArea=u(e.extent),this.coveredArea=this.fullArea}prepend(e){this.missingTiles=e.missingTiles.concat(this.missingTiles),this.coveredArea+=e.coveredArea,this.fullArea+=e.fullArea}}class C{constructor(e,t,s){this._tileInfo=e,this._extent=null,this.info=new v(t),null!=s&&(this._extent=c(s))}addMissing(e,t,s,i){const r=new d(e,t,s);this._tileInfo.updateTileInfo(r,1)&&(null==this._extent||l(this._extent,r.extent))&&(this.info.missingTiles.push({data:r,resolution:i}),this.info.coveredArea-=u(r.extent))}}const S=.18751;export{m as FeatureServiceTileStore,v as ProcessResult};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../core/Error.js";import"../../core/has.js";import t from"../../core/Logger.js";const r=()=>t.getLogger("esri.views.3d.webgl-engine.core.shaderModules.shaderBuilder");class n{constructor(){this._includedModules=new Map}include(e,t){this._includedModules.has(e)?this._includedModules.get(e):(this._includedModules.set(e,t),e(this.builder,t))}}class s extends n{constructor(){super(...arguments),this.vertex=new u,this.fragment=new u,this.attributes=new c,this.varyings=new h,this.
|
|
5
|
+
import e from"../../core/Error.js";import"../../core/has.js";import t from"../../core/Logger.js";const r=()=>t.getLogger("esri.views.3d.webgl-engine.core.shaderModules.shaderBuilder");class n{constructor(){this._includedModules=new Map}include(e,t){this._includedModules.has(e)?this._includedModules.get(e):(this._includedModules.set(e,t),e(this.builder,t))}}class s extends n{constructor(){super(...arguments),this.vertex=new u,this.fragment=new u,this.attributes=new c,this.varyings=new h,this.outputs=new m}get fragmentUniforms(){return this.fragment.uniforms.entries}get attributeNames(){return this.attributes.names}get builder(){return this}generate(e,t=!1){const r=this.attributes.generateSource(e),n=this.varyings.generateSource(e),s="vertex"===e?this.vertex:this.fragment,i=s.uniforms.generateSource(),a=s.code.generateSource(),o=s.main.generateSource(t),u="vertex"===e?d:_,c=s.constants.generateSource(),h=this.outputs.generateSource(e);return`#version 300 es\n${u}\n${c.join("\n")}\n${i.join("\n")}\n${r.join("\n")}\n${n.join("\n")}\n${h.join("\n")}\n${a.join("\n")}\n${o.join("\n")}`}generateBind(e){const t=new Map;this.vertex.uniforms.entries.forEach(e=>{const r=e.bind[0];r&&t.set(e.name,r)}),this.fragment.uniforms.entries.forEach(e=>{const r=e.bind[0];r&&t.set(e.name,r)});const r=Array.from(t.values()),n=r.length;return t=>{for(let s=0;s<n;++s)r[s](e,t)}}generateBindPass(e){const t=new Map;this.vertex.uniforms.entries.forEach(e=>{const r=e.bind[1];r&&t.set(e.name,r)}),this.fragment.uniforms.entries.forEach(e=>{const r=e.bind[1];r&&t.set(e.name,r)});const r=Array.from(t.values()),n=r.length;return(t,s)=>{for(let i=0;i<n;++i)r[i](e,t,s)}}generateBindDraw(e){const t=new Map;this.vertex.uniforms.entries.forEach(e=>{const r=e.bind[2];r&&t.set(e.name,r)}),this.fragment.uniforms.entries.forEach(e=>{const r=e.bind[2];r&&t.set(e.name,r)});const r=Array.from(t.values()),n=r.length;return(t,s,i)=>{for(let a=0;a<n;++a)r[a](e,i,t,s)}}}class i{constructor(e){this._stage=e,this._entries=new Map}add(...e){for(const t of e)this._add(t);return this._stage}get(e){return this._entries.get(e)}_add(t){if(null!=t){if(this._entries.has(t.name)&&!this._entries.get(t.name).equals(t))throw new e("shaderbuilder:duplicate-uniform",`Duplicate uniform name ${t.name} for different uniform type`);this._entries.set(t.name,t)}else r().error(`Trying to add null Uniform from ${(new Error).stack}.`)}generateSource(){return Array.from(this._entries.values()).map(({name:e,arraySize:t,type:r})=>null!=t?`uniform ${r} ${e}[${t}];`:`uniform ${r} ${e};`)}get entries(){return Array.from(this._entries.values())}}class a{constructor(e){this._stage=e,this._bodies=new Array}add(e){return this._bodies.push(e),this._stage}generateSource(t){if(this._bodies.length>0)return[`void main() {\n ${this._bodies.join("\n")||""} \n}`];if(t)throw new e("shaderbuilder:missing-main","Shader does not contain main function body.");return[]}}class o{constructor(e){this._stage=e,this._entries=new Array}add(e){return this._entries.push(e),this._stage}generateSource(){return this._entries}}class u extends n{constructor(){super(...arguments),this.uniforms=new i(this),this.main=new a(this),this.code=new o(this),this.constants=new l(this)}get builder(){return this}}class c{constructor(){this._entries=new Array}add(e,t){this._entries.push([e,t])}generateSource(e){return"fragment"===e?[]:this._entries.map(e=>`in ${e[1]} ${e[0]};`)}get names(){return this._entries.map(([e])=>e)}}class h{constructor(){this._entries=new Map}add(e,t,n){this._entries.has(e)?r().warn(`Ignoring duplicate varying ${t} ${e}`):this._entries.set(e,{type:t,invariant:n?.invariant??!1})}generateSource(e){const t=new Array;return this._entries.forEach((r,n)=>t.push((r.invariant&&"vertex"===e?"invariant ":"")+("int"===r.type?"flat ":"")+("vertex"===e?"out":"in")+` ${r.type} ${n};`)),t}}class m{constructor(){this._entries=new Map}add(e,t,n=0){const s=this._entries.get(n);s?.name!==e||s?.type!==t?this._entries.set(n,{name:e,type:t}):r().warn(`Fragment shader output location ${n} occupied`)}static{this.DEFAULT_TYPE="vec4"}static{this.DEFAULT_NAME="fragColor"}generateSource(e){if("vertex"===e)return[];0===this._entries.size&&this._entries.set(0,{name:m.DEFAULT_NAME,type:m.DEFAULT_TYPE});const t=new Array;return this._entries.forEach((e,r)=>t.push(`layout(location = ${r}) out ${e.type} ${e.name};`)),t}}class l{constructor(e){this._stage=e,this._entries=new Set}add(e,t,r){let n="ERROR_CONSTRUCTOR_STRING";switch(t){case"float":n=l._numberToFloatStr(r);break;case"int":n=l._numberToIntStr(r);break;case"bool":n=r.toString();break;case"vec2":n=`vec2(${l._numberToFloatStr(r[0])}, ${l._numberToFloatStr(r[1])})`;break;case"vec3":n=`vec3(${l._numberToFloatStr(r[0])}, ${l._numberToFloatStr(r[1])}, ${l._numberToFloatStr(r[2])})`;break;case"vec4":n=`vec4(${l._numberToFloatStr(r[0])}, ${l._numberToFloatStr(r[1])}, ${l._numberToFloatStr(r[2])}, ${l._numberToFloatStr(r[3])})`;break;case"ivec2":n=`ivec2(${l._numberToIntStr(r[0])}, ${l._numberToIntStr(r[1])})`;break;case"ivec3":n=`ivec3(${l._numberToIntStr(r[0])}, ${l._numberToIntStr(r[1])}, ${l._numberToIntStr(r[2])})`;break;case"ivec4":n=`ivec4(${l._numberToIntStr(r[0])}, ${l._numberToIntStr(r[1])}, ${l._numberToIntStr(r[2])}, ${l._numberToIntStr(r[3])})`;break;case"uvec2":n=`uvec2(${l._numberToIntStr(r[0])}, ${l._numberToIntStr(r[1])})`;break;case"uvec3":n=`uvec3(${l._numberToIntStr(r[0])}, ${l._numberToIntStr(r[1])}, ${l._numberToIntStr(r[2])})`;break;case"uvec4":n=`uvec4(${l._numberToIntStr(r[0])}, ${l._numberToIntStr(r[1])}, ${l._numberToIntStr(r[2])}, ${l._numberToIntStr(r[3])})`;break;case"mat2":case"mat3":case"mat4":n=`${t}(${Array.prototype.map.call(r,e=>l._numberToFloatStr(e)).join(", ")})`}return this._entries.add(`const ${t} ${e} = ${n};`),this._stage}static _numberToIntStr(e){return e.toFixed(0)}static _numberToFloatStr(e){return Number.isInteger(e)?e.toFixed(1):e.toString()}generateSource(){return Array.from(this._entries)}}const _="#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n precision highp int;\n precision highp sampler2D;\n precision highp usampler2D;\n precision highp sampler2DArray;\n precision highp sampler2DShadow;\n#else\n precision mediump float;\n precision mediump int;\n precision mediump sampler2D;\n precision mediump usampler2D;\n precision mediump sampler2DArray;\n precision mediump sampler2DShadow;\n#endif",d="precision highp float;\n precision highp sampler2D;\n precision highp usampler2D;\n precision highp sampler2DArray;\n precision highp sampler2DShadow;\n\n\n invariant gl_Position;\n ";export{o as Code,n as Includes,a as Main,s as ShaderBuilder,u as Stage,i as Uniforms};
|
package/views/webgl/Texture.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/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../core/Error.js";import has from"../../core/has.js";import e from"../../core/Logger.js";import{abortMaybe as i}from"../../core/maybe.js";import{hasValue as r}from"../../core/object.js";import{throwIfAborted as s,isAbortError as o}from"../../core/promiseUtils.js";import{checkWebGLError as a}from"./checkWebGLError.js";import{ResourceType as n,CompressedTextureFormat as p}from"./enums.js";import{estimateMemory as l}from"./TextureDescriptor.js";import{isCompressedData as m,deriveInternalFormat as h,isTexImageSource as d,is3DTarget as c,validateTexture as _,isCompressedFormat as u,getDimensions as g,calcMipmapLevels as x,isSizedPixelFormat as T,isSizedDepthFormat as M,isSizedDepthStencilFormat as b}from"./textureUtils.js";import{ValidatedTextureDescriptor as f}from"./ValidatedTextureDescriptor.js";const w=null,D=!!has("esri-tests-disable-gpu-memory-measurements"),E=()=>e.getLogger("esri/views/webgl/Texture");let A=class e{static{this.TEXTURE_UNIT_FOR_UPDATES=0}static{this.compressionWorkerHandle=null}constructor(e,i=null,r=null){if(this.type=1,this._glName=null,this._samplingModeDirty=!1,this._wrapModeDirty=!1,this._shadowFilterDirty=!1,this._wasImmutablyAllocated=!1,"context"in e)this._descriptor=e,r=i;else{const r=f.validate(e,i);if(!r)throw new t("texture:invalid-descriptor","Texture descriptor invalid");this._descriptor=r}34067===this._descriptor.target?this._setDataCubeMap(r):this.setData(r)}get glName(){return this._glName}get descriptor(){return this._descriptor}get usedMemory(){return D?0:l(this._descriptor)}get isDirty(){return this._samplingModeDirty||this._wrapModeDirty||this._shadowFilterDirty}get hasWebGLTextureObject(){return!!this._glName}dispose(){this.abortCompression(),this.hasWebGLTextureObject&&this._descriptor.context?.gl&&(this._descriptor.context.instanceCounter.decrement(n.Texture,this),this._descriptor.context.unbindTexture(this),this._descriptor.context.gl.deleteTexture(this._glName),this._glName=null,this._descriptor=null)}release(){this.dispose()}[Symbol.dispose](){this.dispose()}resize(e,i){const r=this._descriptor;if(r.width!==e||r.height!==i){if(this._wasImmutablyAllocated)throw new t("texture:immutable-resize","Immutable textures can't be resized!");r.width=e,r.height=i,34067===this._descriptor.target?this._setDataCubeMap(null):this.setData(null)}}enableCompression(t){this._descriptor.compress=t}disableCompression(){this._descriptor.compress=void 0}setData(t){this.abortCompression(),!m(t)&&this._descriptor.internalFormat&&r(p,this._descriptor.internalFormat)&&(this._descriptor.internalFormat=void 0),this._setData(t),!m(t)&&this._descriptor.compress&&this._compressOnWorker(t)}updateData(i,r,s,o,a,n,p=0){n||E().error("An attempt to use uninitialized data!"),this.hasWebGLTextureObject||E().error("An attempt to update uninitialized texture!");const l=this._descriptor;l.internalFormat=h(l);const{context:c,pixelFormat:_,dataType:u,target:g,isImmutable:x}=l;if(x&&!this._wasImmutablyAllocated)throw new t("texture:uninitialized","Cannot update immutable texture before allocation!");const T=c.bindTexture(this,e.TEXTURE_UNIT_FOR_UPDATES,!0);(r<0||s<0||r+o>l.width||s+a>l.height)&&E().error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();const{gl:M}=c;p&&(o&&a||E().warn("Must pass width and height if `UNPACK_SKIP_ROWS` is used"),M.pixelStorei(M.UNPACK_SKIP_ROWS,p)),d(n)?M.texSubImage2D(g,i,r,s,o,a,_,u,n):m(n)?M.compressedTexSubImage2D(g,i,r,s,o,a,l.internalFormat,n.levels[i]):M.texSubImage2D(g,i,r,s,o,a,_,u,n),p&&M.pixelStorei(M.UNPACK_SKIP_ROWS,0),c.bindTexture(T,e.TEXTURE_UNIT_FOR_UPDATES)}updateData3D(i,r,s,o,a,n,p,l){l||E().error("An attempt to use uninitialized data!"),this.hasWebGLTextureObject||E().error("An attempt to update an uninitialized texture!");const d=this._descriptor;d.internalFormat=h(d);const{context:_,pixelFormat:u,dataType:g,isImmutable:x,target:T}=d;if(x&&!this._wasImmutablyAllocated)throw new t("texture:uninitialized","Cannot update immutable texture before allocation!");c(T)||E().warn("Attempting to set 3D texture data on a non-3D texture");const M=_.bindTexture(this,e.TEXTURE_UNIT_FOR_UPDATES);_.setActiveTexture(e.TEXTURE_UNIT_FOR_UPDATES),(r<0||s<0||o<0||r+a>d.width||s+n>d.height||o+p>d.depth)&&E().error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();const{gl:b}=_;if(m(l))l=l.levels[i],b.compressedTexSubImage3D(T,i,r,s,o,a,n,p,d.internalFormat,l);else{const t=l;b.texSubImage3D(T,i,r,s,o,a,n,p,u,g,t)}_.bindTexture(M,e.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){const i=this._descriptor;if(0===i.width||0===i.height)return;if(!i.hasMipmap){if(this._wasImmutablyAllocated)throw new t("texture:immutable-change","Cannot add mipmaps to immutable texture after allocation");i.hasMipmap=!0,this._samplingModeDirty=!0,_(i)}9729===i.samplingMode?(this._samplingModeDirty=!0,i.samplingMode=9985):9728===i.samplingMode&&(this._samplingModeDirty=!0,i.samplingMode=9984);const r=this._descriptor.context.bindTexture(this,e.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(e.TEXTURE_UNIT_FOR_UPDATES),this._descriptor.context.gl.generateMipmap(i.target),this._descriptor.context.bindTexture(r,e.TEXTURE_UNIT_FOR_UPDATES)}clearMipmap(){const e=this._descriptor;if(e.hasMipmap){if(this._wasImmutablyAllocated)throw new t("texture:immutable-change","Cannot delete mipmaps to immutable texture after allocation");e.hasMipmap=!1,this._samplingModeDirty=!0,_(e)}9985===e.samplingMode?(this._samplingModeDirty=!0,e.samplingMode=9729):9984===e.samplingMode&&(this._samplingModeDirty=!0,e.samplingMode=9728)}setSamplingMode(t){t!==this._descriptor.samplingMode&&(this._descriptor.samplingMode=t,this._samplingModeDirty=!0)}setWrapMode(t){t!==this._descriptor.wrapMode&&(this._descriptor.wrapMode=t,_(this._descriptor),this._wrapModeDirty=!0)}setShadowFiltering(t){t!==this._descriptor.linearFilterDepth&&(this._descriptor.linearFilterDepth=this._descriptor.compareEnabled=t,this.setSamplingMode(t?9729:9728),_(this._descriptor),this._shadowFilterDirty=!0)}applyChanges(){this._samplingModeDirty&&(this._applySamplingMode(),this._samplingModeDirty=!1),this._wrapModeDirty&&(this._applyWrapMode(),this._wrapModeDirty=!1),this._shadowFilterDirty&&(this._applyShadowMode(),this._shadowFilterDirty=!1)}abortCompression(){this._compressionAbortController=i(this._compressionAbortController)}_setData(i,r){const s=this._descriptor,o=s.context?.gl;if(!o)return;a(o),this.hasWebGLTextureObject||(this._glName=o.createTexture(),s.context.instanceCounter.increment(n.Texture,this)),_(s);const p=s.context.bindTexture(this,e.TEXTURE_UNIT_FOR_UPDATES);s.context.setActiveTexture(e.TEXTURE_UNIT_FOR_UPDATES),this._configurePixelStorage(),a(o);const l=r??s.target,g=c(l);if(d(i))this._setDataFromTexImageSource(i,l);else{const{width:e,height:r,depth:n}=s;if(null==e||null==r)throw new t("texture:missing-size","Width and height must be specified!");if(g&&null==n)throw new t("texture:missing-depth","Depth must be specified!");if(s.internalFormat=h(s),s.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(l,s.internalFormat,s.hasMipmap,e,r,n),m(i)){if(!u(s.internalFormat))throw new t("texture:format-mismatch","Attempting to use compressed data with an uncompressed format!");this._setDataFromCompressedSource(i,s.internalFormat,l)}else this._texImage(l,0,s.internalFormat,e,r,n,i),a(o),s.hasMipmap&&this.generateMipmap()}this._applySamplingMode(),this._applyWrapMode(),this._applyAnisotropicFilteringParameters(),this._applyShadowMode(),a(o),s.context.bindTexture(p,e.TEXTURE_UNIT_FOR_UPDATES)}_setDataCubeMap(t=null){for(let e=34069;e<=34074;e++)this._setData(t,e)}_configurePixelStorage(){const t=this._descriptor.context.gl,{unpackAlignment:e,flipped:i,preMultiplyAlpha:r}=this._descriptor;t.pixelStorei(t.UNPACK_ALIGNMENT,e),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,i?1:0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r?1:0)}_setDataFromTexImageSource(t,e){const{gl:i}=this._descriptor.context,r=this._descriptor;r.internalFormat=h(r);const s=c(e),{width:o,height:n,depth:p}=g(t);r.width&&r.height,r.width||(r.width=o),r.height||(r.height=n),s&&r.depth,s&&(r.depth=p),r.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(e,r.internalFormat,r.hasMipmap,o,n,p),this._texImage(e,0,r.internalFormat,o,n,p,t),a(i),r.hasMipmap&&(this.generateMipmap(),a(i))}_setDataFromCompressedSource(t,e,i){const r=this._descriptor,{width:s,height:o,depth:a}=r,n=t.levels,p=x(i,s,o,a),l=Math.min(p,n.length)-1;this._descriptor.context.gl.texParameteri(r.target,33085,l),this._forEachMipmapLevel((t,r,s,o)=>{const a=n[Math.min(t,n.length-1)];this._compressedTexImage(i,t,e,r,s,o,a)},l)}_texStorage(e,i,r,s,o,a){const{gl:n}=this._descriptor.context;if(!T(i)&&!M(i)&&!b(i))throw new t("texture:missing-format","Immutable textures must have a sized internal format");if(!this._descriptor.isImmutable)return;const p=r?x(e,s,o,a):1;if(c(e)){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");n.texStorage3D(e,p,i,s,o,a)}else n.texStorage2D(e,p,i,s,o);this._wasImmutablyAllocated=!0}_texImage(e,i,r,s,o,a,n){const p=this._descriptor.context.gl,l=c(e),{isImmutable:m,pixelFormat:h,dataType:d}=this._descriptor;if(m){if(null!=n){const r=n;if(l){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");p.texSubImage3D(e,i,0,0,0,s,o,a,h,d,r)}else p.texSubImage2D(e,i,0,0,s,o,h,d,r)}}else{const m=n;if(l){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");p.texImage3D(e,i,r,s,o,a,0,h,d,m)}else p.texImage2D(e,i,r,s,o,0,h,d,m)}}_compressedTexImage(e,i,r,s,o,a,n){const p=this._descriptor.context.gl,l=c(e);if(this._descriptor.isImmutable){if(null!=n)if(l){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");p.compressedTexSubImage3D(e,i,0,0,0,s,o,a,r,n)}else p.compressedTexSubImage2D(e,i,0,0,s,o,r,n)}else if(l){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");p.compressedTexImage3D(e,i,r,s,o,a,0,n)}else p.compressedTexImage2D(e,i,r,s,o,0,n)}async _compressOnWorker(t){const{width:i,height:r,context:a,flipped:n,preMultiplyAlpha:p,hasMipmap:l}=this._descriptor,m=this._descriptor.compress?.compressionTracker,h=this._descriptor.compress?.compressionCallback,{compressedTextureETC:d,compressedTextureS3TC:c}=a.capabilities;if(!e.compressionWorkerHandle?.isCompressible(t,this._descriptor)||!d&&!c)return;this.abortCompression();const _=new AbortController;this._compressionAbortController=_,m?.increment();try{let o;t instanceof Uint8Array?o=t.buffer:(o=await createImageBitmap(t,{imageOrientation:n?"flipY":"none"}),s(_));const a={data:o,width:i,height:r,needsFlip:t instanceof Uint8Array&&this.descriptor.flipped,components:6408===this._descriptor.pixelFormat?4:3,preMultiplyAlpha:p,hasMipmap:l,hasETC:!!d,hasS3TC:!!c},m=await e.compressionWorkerHandle.invoke(a,_.signal,"low");if(s(_),m.compressedTexture&&this.hasWebGLTextureObject){const t=this.usedMemory;this._descriptor.internalFormat=m.internalFormat,this._setData(m.compressedTexture),h?.(t-this.usedMemory)}}catch(u){o(u)||E().error("Texture compression failed!")}finally{m?.decrement(),this._compressionAbortController?.signal.aborted&&(this._compressionAbortController=null)}}_forEachMipmapLevel(e,i=1/0){let{width:r,height:s,depth:o,hasMipmap:a,target:n}=this._descriptor;const p=32879===n;if(null==r||null==s||p&&null==o)throw new t("texture:missing-size","Missing texture dimensions for mipmap calculation");for(let t=0;e(t,r,s,o),a&&(1!==r||1!==s||p&&1!==o)&&!(t>=i);++t)r=Math.max(1,r>>1),s=Math.max(1,s>>1),p&&(o=Math.max(1,o>>1))}_applySamplingMode(){const t=this._descriptor,e=t.context?.gl;let i=t.samplingMode,r=t.samplingMode;9985===i||9987===i?(i=9729,t.hasMipmap||(r=9729)):9984!==i&&9986!==i||(i=9728,t.hasMipmap||(r=9728)),e.texParameteri(t.target,e.TEXTURE_MAG_FILTER,i),e.texParameteri(t.target,e.TEXTURE_MIN_FILTER,r)}_applyWrapMode(){const t=this._descriptor,e=t.context?.gl;"number"==typeof t.wrapMode?(e.texParameteri(t.target,e.TEXTURE_WRAP_S,t.wrapMode),e.texParameteri(t.target,e.TEXTURE_WRAP_T,t.wrapMode)):(e.texParameteri(t.target,e.TEXTURE_WRAP_S,t.wrapMode.s),e.texParameteri(t.target,e.TEXTURE_WRAP_T,t.wrapMode.t))}_applyShadowMode(){const t=this._descriptor,e=t.context?.gl,i=t.compareEnabled?e.COMPARE_REF_TO_TEXTURE:e.NONE;e.texParameteri(t.target,e.TEXTURE_COMPARE_MODE,i),t.compareEnabled&&e.texParameteri(t.target,e.TEXTURE_COMPARE_FUNC,e.GREATER),a(e)}_applyAnisotropicFilteringParameters(){const t=this._descriptor,e=t.context.capabilities.textureFilterAnisotropic;if(!e)return;t.context.gl.texParameterf(t.target,e.TEXTURE_MAX_ANISOTROPY,t.maxAnisotropy??1)}};export{A as Texture,w as tracer};
|
|
5
|
+
import t from"../../core/Error.js";import has from"../../core/has.js";import e from"../../core/Logger.js";import{abortMaybe as i}from"../../core/maybe.js";import{hasValue as r}from"../../core/object.js";import{throwIfAborted as s,isAbortError as o}from"../../core/promiseUtils.js";import{checkWebGLError as a}from"./checkWebGLError.js";import{ResourceType as n,CompressedTextureFormat as p}from"./enums.js";import{estimateMemory as l}from"./TextureDescriptor.js";import{isCompressedData as m,deriveInternalFormat as h,isTexImageSource as d,is3DTarget as c,validateTexture as _,isCompressedFormat as u,getDimensions as g,calcMipmapLevels as x,isSizedPixelFormat as T,isSizedDepthFormat as M,isSizedDepthStencilFormat as b}from"./textureUtils.js";import{ValidatedTextureDescriptor as f}from"./ValidatedTextureDescriptor.js";const w=null,D=!!has("esri-tests-disable-gpu-memory-measurements"),E=()=>e.getLogger("esri/views/webgl/Texture");let A=class e{static{this.TEXTURE_UNIT_FOR_UPDATES=0}static{this.compressionWorkerHandle=null}constructor(e,i=null,r=null){if(this.type=1,this._glName=null,this._samplingModeDirty=!1,this._wrapModeDirty=!1,this._shadowFilterDirty=!1,this._wasImmutablyAllocated=!1,"context"in e)this._descriptor=e,r=i;else{const r=f.validate(e,i);if(!r)throw new t("texture:invalid-descriptor","Texture descriptor invalid");this._descriptor=r}34067===this._descriptor.target?this._setDataCubeMap(r):this.setData(r)}get glName(){return this._glName}get descriptor(){return this._descriptor}get usedMemory(){return D?0:l(this._descriptor)}get isDirty(){return this._samplingModeDirty||this._wrapModeDirty||this._shadowFilterDirty}get hasWebGLTextureObject(){return!!this._glName}dispose(){this.abortCompression(),this.hasWebGLTextureObject&&this._descriptor.context?.gl&&(this._descriptor.context.instanceCounter.decrement(n.Texture,this),this._descriptor.context.unbindTexture(this),this._descriptor.context.gl.deleteTexture(this._glName),this._glName=null,this._descriptor=null)}release(){this.dispose()}[Symbol.dispose](){this.dispose()}resize(e,i){const r=this._descriptor;if(r.width!==e||r.height!==i){if(this._wasImmutablyAllocated)throw new t("texture:immutable-resize","Immutable textures can't be resized!");r.width=e,r.height=i,34067===this._descriptor.target?this._setDataCubeMap(null):this.setData(null)}}enableCompression(t){this._descriptor.compress=t}disableCompression(){this._descriptor.compress=void 0}setData(t){this.abortCompression(),!m(t)&&this._descriptor.internalFormat&&r(p,this._descriptor.internalFormat)&&(this._descriptor.internalFormat=void 0),this._setData(t),!m(t)&&this._descriptor.compress&&this._compressOnWorker(t)}updateData(i,r,s,o,a,n,p=0){n||E().error("An attempt to use uninitialized data!"),this.hasWebGLTextureObject||E().error("An attempt to update uninitialized texture!");const l=this._descriptor;l.internalFormat=h(l);const{context:c,pixelFormat:_,dataType:u,target:g,isImmutable:x}=l;if(x&&!this._wasImmutablyAllocated)throw new t("texture:uninitialized","Cannot update immutable texture before allocation!");const T=c.bindTexture(this,e.TEXTURE_UNIT_FOR_UPDATES,!0);(r<0||s<0||r+o>l.width||s+a>l.height)&&E().error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();const{gl:M}=c;p&&(o&&a||E().warn("Must pass width and height if `UNPACK_SKIP_ROWS` is used"),M.pixelStorei(M.UNPACK_SKIP_ROWS,p)),d(n)?M.texSubImage2D(g,i,r,s,o,a,_,u,n):m(n)?M.compressedTexSubImage2D(g,i,r,s,o,a,l.internalFormat,n.levels[i]):M.texSubImage2D(g,i,r,s,o,a,_,u,n),p&&M.pixelStorei(M.UNPACK_SKIP_ROWS,0),c.bindTexture(T,e.TEXTURE_UNIT_FOR_UPDATES)}updateData3D(i,r,s,o,a,n,p,l){l||E().error("An attempt to use uninitialized data!"),this.hasWebGLTextureObject||E().error("An attempt to update an uninitialized texture!");const d=this._descriptor;d.internalFormat=h(d);const{context:_,pixelFormat:u,dataType:g,isImmutable:x,target:T}=d;if(x&&!this._wasImmutablyAllocated)throw new t("texture:uninitialized","Cannot update immutable texture before allocation!");c(T)||E().warn("Attempting to set 3D texture data on a non-3D texture");const M=_.bindTexture(this,e.TEXTURE_UNIT_FOR_UPDATES);_.setActiveTexture(e.TEXTURE_UNIT_FOR_UPDATES),(r<0||s<0||o<0||r+a>d.width||s+n>d.height||o+p>d.depth)&&E().error("An attempt to update out of bounds of the texture!"),this._configurePixelStorage();const{gl:b}=_;if(m(l))l=l.levels[i],b.compressedTexSubImage3D(T,i,r,s,o,a,n,p,d.internalFormat,l);else{const t=l;b.texSubImage3D(T,i,r,s,o,a,n,p,u,g,t)}_.bindTexture(M,e.TEXTURE_UNIT_FOR_UPDATES)}generateMipmap(){const i=this._descriptor;if(0===i.width||0===i.height)return;if(!i.hasMipmap){if(this._wasImmutablyAllocated)throw new t("texture:immutable-change","Cannot add mipmaps to immutable texture after allocation");i.hasMipmap=!0,this._samplingModeDirty=!0,_(i)}9729===i.samplingMode?(this._samplingModeDirty=!0,i.samplingMode=9985):9728===i.samplingMode&&(this._samplingModeDirty=!0,i.samplingMode=9984);const r=this._descriptor.context.bindTexture(this,e.TEXTURE_UNIT_FOR_UPDATES);this._descriptor.context.setActiveTexture(e.TEXTURE_UNIT_FOR_UPDATES),this._descriptor.context.gl.generateMipmap(i.target),this._descriptor.context.bindTexture(r,e.TEXTURE_UNIT_FOR_UPDATES)}clearMipmap(){const e=this._descriptor;if(e.hasMipmap){if(this._wasImmutablyAllocated)throw new t("texture:immutable-change","Cannot delete mipmaps to immutable texture after allocation");e.hasMipmap=!1,this._samplingModeDirty=!0,_(e)}9985===e.samplingMode?(this._samplingModeDirty=!0,e.samplingMode=9729):9984===e.samplingMode&&(this._samplingModeDirty=!0,e.samplingMode=9728)}setSamplingMode(t){t!==this._descriptor.samplingMode&&(this._descriptor.samplingMode=t,this._samplingModeDirty=!0)}setWrapMode(t){t!==this._descriptor.wrapMode&&(this._descriptor.wrapMode=t,_(this._descriptor),this._wrapModeDirty=!0)}setShadowFiltering(t){t!==this._descriptor.linearFilterDepth&&(this._descriptor.linearFilterDepth=this._descriptor.compareEnabled=t,this.setSamplingMode(t?9729:9728),_(this._descriptor),this._shadowFilterDirty=!0)}applyChanges(){this._samplingModeDirty&&(this._applySamplingMode(),this._samplingModeDirty=!1),this._wrapModeDirty&&(this._applyWrapMode(),this._wrapModeDirty=!1),this._shadowFilterDirty&&(this._applyShadowMode(),this._shadowFilterDirty=!1)}abortCompression(){this._compressionAbortController=i(this._compressionAbortController)}_setData(i,r){const s=this._descriptor,o=s.context?.gl;if(!o)return;a(o),this.hasWebGLTextureObject||(this._glName=o.createTexture(),s.context.instanceCounter.increment(n.Texture,this)),_(s);const p=s.context.bindTexture(this,e.TEXTURE_UNIT_FOR_UPDATES);s.context.setActiveTexture(e.TEXTURE_UNIT_FOR_UPDATES),this._configurePixelStorage(),a(o);const l=r??s.target,g=c(l);if(d(i))this._setDataFromTexImageSource(i,l);else{const{width:e,height:r,depth:n}=s;if(null==e||null==r)throw new t("texture:missing-size","Width and height must be specified!");if(g&&null==n)throw new t("texture:missing-depth","Depth must be specified!");if(s.internalFormat=h(s),s.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(l,s.internalFormat,s.hasMipmap,e,r,n),m(i)){if(!u(s.internalFormat))throw new t("texture:format-mismatch","Attempting to use compressed data with an uncompressed format!");this._setDataFromCompressedSource(i,s.internalFormat,l)}else this._texImage(l,0,s.internalFormat,e,r,n,i),a(o),s.hasMipmap&&this.generateMipmap()}this._applySamplingMode(),this._applyWrapMode(),this._applyAnisotropicFilteringParameters(),this._applyShadowMode(),a(o),s.context.bindTexture(p,e.TEXTURE_UNIT_FOR_UPDATES)}_setDataCubeMap(t=null){for(let e=34069;e<=34074;e++)this._setData(t,e)}_configurePixelStorage(){const t=this._descriptor.context.gl,{unpackAlignment:e,flipped:i,preMultiplyAlpha:r}=this._descriptor;t.pixelStorei(t.UNPACK_ALIGNMENT,e),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,i?1:0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r?1:0)}_setDataFromTexImageSource(t,e){const{gl:i}=this._descriptor.context,r=this._descriptor;r.internalFormat=h(r);const s=c(e),{width:o,height:n,depth:p}=g(t);r.width&&r.height,r.width||(r.width=o),r.height||(r.height=n),s&&r.depth,s&&(r.depth=p),r.isImmutable&&!this._wasImmutablyAllocated&&this._texStorage(e,r.internalFormat,r.hasMipmap,o,n,p),this._texImage(e,0,r.internalFormat,o,n,p,t),a(i),r.hasMipmap&&(this.generateMipmap(),a(i))}_setDataFromCompressedSource(t,e,i){const r=this._descriptor,{width:s,height:o,depth:a}=r,n=t.levels,p=x(i,s,o,a),l=Math.min(p,n.length)-1;this._descriptor.context.gl.texParameteri(r.target,33085,l),this._forEachMipmapLevel((t,r,s,o)=>{const a=n[Math.min(t,n.length-1)];this._compressedTexImage(i,t,e,r,s,o,a)},l)}_texStorage(e,i,r,s,o,a){const{gl:n}=this._descriptor.context;if(!T(i)&&!M(i)&&!b(i))throw new t("texture:missing-format","Immutable textures must have a sized internal format");if(!this._descriptor.isImmutable)return;const p=r?x(e,s,o,a):1;if(c(e)){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");n.texStorage3D(e,p,i,s,o,a)}else n.texStorage2D(e,p,i,s,o);this._wasImmutablyAllocated=!0}_texImage(e,i,r,s,o,a,n){const p=this._descriptor.context.gl,l=c(e),{isImmutable:m,pixelFormat:h,dataType:d}=this._descriptor;if(m){if(null!=n){const r=n;if(l){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");p.texSubImage3D(e,i,0,0,0,s,o,a,h,d,r)}else p.texSubImage2D(e,i,0,0,s,o,h,d,r)}}else{const m=n;if(l){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");p.texImage3D(e,i,r,s,o,a,0,h,d,m)}else p.texImage2D(e,i,r,s,o,0,h,d,m)}}_compressedTexImage(e,i,r,s,o,a,n){const p=this._descriptor.context.gl,l=c(e);if(this._descriptor.isImmutable){if(null!=n)if(l){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");p.compressedTexSubImage3D(e,i,0,0,0,s,o,a,r,n)}else p.compressedTexSubImage2D(e,i,0,0,s,o,r,n)}else if(l){if(null==a)throw new t("texture:missing-depth","Missing depth dimension for 3D texture upload");p.compressedTexImage3D(e,i,r,s,o,a,0,n)}else p.compressedTexImage2D(e,i,r,s,o,0,n)}async _compressOnWorker(t){const{width:i,height:r,context:a,flipped:n,preMultiplyAlpha:p,hasMipmap:l}=this._descriptor,m=this._descriptor.compress?.compressionTracker,h=this._descriptor.compress?.compressionCallback,{compressedTextureETC:d,compressedTextureS3TC:c}=a.capabilities;if(!e.compressionWorkerHandle?.isCompressible(t,this._descriptor)||!d&&!c)return;this.abortCompression();const _=new AbortController;this._compressionAbortController=_,m?.increment();try{let o;t instanceof Uint8Array?o=t.buffer:(o=await createImageBitmap(t,{imageOrientation:n?"flipY":"none"}),s(_));const a={data:o,width:i,height:r,needsFlip:t instanceof Uint8Array&&this.descriptor.flipped,components:6408===this._descriptor.pixelFormat?4:3,preMultiplyAlpha:p,hasMipmap:l,hasETC:!!d,hasS3TC:!!c},m=await e.compressionWorkerHandle.invoke(a,_.signal,1);if(s(_),m.compressedTexture&&this.hasWebGLTextureObject){const t=this.usedMemory;this._descriptor.internalFormat=m.internalFormat,this._setData(m.compressedTexture),h?.(t-this.usedMemory)}}catch(u){o(u)||E().error("Texture compression failed!")}finally{m?.decrement(),this._compressionAbortController?.signal.aborted&&(this._compressionAbortController=null)}}_forEachMipmapLevel(e,i=1/0){let{width:r,height:s,depth:o,hasMipmap:a,target:n}=this._descriptor;const p=32879===n;if(null==r||null==s||p&&null==o)throw new t("texture:missing-size","Missing texture dimensions for mipmap calculation");for(let t=0;e(t,r,s,o),a&&(1!==r||1!==s||p&&1!==o)&&!(t>=i);++t)r=Math.max(1,r>>1),s=Math.max(1,s>>1),p&&(o=Math.max(1,o>>1))}_applySamplingMode(){const t=this._descriptor,e=t.context?.gl;let i=t.samplingMode,r=t.samplingMode;9985===i||9987===i?(i=9729,t.hasMipmap||(r=9729)):9984!==i&&9986!==i||(i=9728,t.hasMipmap||(r=9728)),e.texParameteri(t.target,e.TEXTURE_MAG_FILTER,i),e.texParameteri(t.target,e.TEXTURE_MIN_FILTER,r)}_applyWrapMode(){const t=this._descriptor,e=t.context?.gl;"number"==typeof t.wrapMode?(e.texParameteri(t.target,e.TEXTURE_WRAP_S,t.wrapMode),e.texParameteri(t.target,e.TEXTURE_WRAP_T,t.wrapMode)):(e.texParameteri(t.target,e.TEXTURE_WRAP_S,t.wrapMode.s),e.texParameteri(t.target,e.TEXTURE_WRAP_T,t.wrapMode.t))}_applyShadowMode(){const t=this._descriptor,e=t.context?.gl,i=t.compareEnabled?e.COMPARE_REF_TO_TEXTURE:e.NONE;e.texParameteri(t.target,e.TEXTURE_COMPARE_MODE,i),t.compareEnabled&&e.texParameteri(t.target,e.TEXTURE_COMPARE_FUNC,e.GREATER),a(e)}_applyAnisotropicFilteringParameters(){const t=this._descriptor,e=t.context.capabilities.textureFilterAnisotropic;if(!e)return;t.context.gl.texParameterf(t.target,e.TEXTURE_MAX_ANISOTROPY,t.maxAnisotropy??1)}};export{A as Texture,w as tracer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{createTask as t}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import r from"../../core/Error.js";import{EventedAccessor as i}from"../../core/Evented.js";import a from"../../core/Logger.js";import{abortMaybe as o}from"../../core/maybe.js";import{throwIfAborted as n}from"../../core/promiseUtils.js";import p from"../../core/ReactiveMap.js";import{on as l,watch as u,sync as h,whenOnce as m}from"../../core/reactiveUtils.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as f}from"../../core/support/UpdatingHandles.js";import y from"../../geometry/SpatialReference.js";import{system as v}from"../../time/constants.js";import{createReactiveGraphic as g}from"./batchAttributeFormUtils.js";import{ArcadeExecutorProvider as F}from"./expressions/ArcadeExecutorProvider.js";import{ExpressionsManager as _}from"./expressions/ExpressionsManager.js";import{ExpressionsModel as x}from"./expressions/ExpressionsModel.js";import w from"./inputs/BatchFormInputs.js";import{createBatchFormInputsFromBatchFormTemplate as b}from"./inputs/support/createBatchFormInputs.js";import{isGroupInput as I,isFieldInput as M}from"./inputs/support/inputUtils.js";import A from"./templates/BatchFormTemplate.js";import{getLayerContingentValuesMetaData as E}from"./templates/support/contingentValuesUtils.js";import{createBatchFormTemplate as k}from"./templates/support/createBatchFormTemplate.js";let T=class extends i{constructor(e){super(e),this.activeFeatureIndex=-1,this.disabled=!1,this.editType="NA",this.features=new s,this._hasAsyncArcadeExpressions=!1,this.maximumFeatureCountWithComplexForms=50,this.maximumFeatureCount=2e3,this.map=null,this.readOnly=!1,this.spatialReference=null,this.submitHasBeenAttempted=!1,this.timeZone=null,this.userHasChangedValues=!1,this._arcadeExecutorProvider=new F,this._activeFormInputsByElementId=new Map,this._emptyForm=new w({inputs:[]}),this._emptyFormTemplate=new A({elements:[]}),this._featureFormMap=new Map,this._prepareTask=null,this._reactiveGraphicLookup=new p,this._updatingHandles=new f,this._layerTemplateMap=new p,this._layerContingentValuesMap=new p,this._workingFeatures=new s,this._expressionsManager=new _({arcadeContext:{editType:"NA",spatialReference:null,map:null,timeZone:v}}),this.sharedForm=this._emptyForm,this.sharedFormTemplate=this._emptyFormTemplate}initialize(){this.addHandles([l(()=>this.features,"after-changes",()=>this._prepare(),{sync:!0}),u(()=>[this.features,this.map,this.timeZone,this.editType],()=>this._prepare(),h),u(()=>this.activeForm,()=>this._activeFormInputsByElementId.clear(),h)]),this._prepare()}destroy(){this._prepareTask=o(this._prepareTask),this._workingFeatures.destroyAll(),this._expressionsManager&&this._expressionsManager.abort(),this._reactiveGraphicLookup=new p,this._emptyForm.destroy(),this._emptyFormTemplate.destroy()}get _effectiveTimeZone(){return this.timeZone??"system"}get activeFeature(){const e=this.activeFeatureIndex;return e<0?null:this.features.at(e)}get activeForm(){if("batch"===this.mode)return this.sharedForm;const e=this._workingFeatures.at(this.activeFeatureIndex);if(!e)return this._emptyForm;const t=this._featureFormMap.get(e);if(t)return t;const s=this._makeBatchFormInputsForFeature(e);return s!==this._emptyForm&&this._featureFormMap.set(e,s),s}get calculating(){return this._expressionsManager.calculating}get expressionEvaluationFailed(){return this._expressionsManager.expressionEvaluationFailed}get hasNonActiveInvalidFeatures(){if("batch"===this.mode)return!1;const{activeFeature:e}=this;return this.invalidFeatures.some(t=>t!==e)}get hasAsyncArcadeExpressions(){return this._hasAsyncArcadeExpressions}get hasTooManyFeatures(){return this._workingFeatures.length>this.maximumFeatureCount}get hasTooManyComplexFeatures(){return this._workingFeatures.length>this.maximumFeatureCountWithComplexForms&&this.hasAsyncArcadeExpressions}get invalidFeatures(){return this.sharedForm.invalidFeatures}get hasVisibleInputs(){return this.visibleInputs.length>0}get hasLayersWithContingentValues(){for(const e of this.layers){const t=this._layerContingentValuesMap.get(e);if(t&&t.size>0)return!0}return!1}get visibleInputs(){return this.activeForm.inputs.filter(e=>e.visible)}get noVisibleElementsReason(){if(this.hasVisibleInputs)return null;if(0===this.activeForm.inputs.length)return"noElements";const e=new Set;for(const t of this.activeForm.inputs)switch(t.visibilityCode){case"hidden:not-in-all-layers":case"hidden:no-domain-in-common":e.add("noElementsInCommon");break;case"hidden:field-definition":case"hidden:group-visibility-expression:all-features":case"hidden:visibility-expression:all-features":e.add("allElementsHidden");break;case"hidden:group-visibility-expression:some-features":case"hidden:visibility-expression:some-features":return"elementsHiddenInSome"}return e.has("allElementsHidden")?"allElementsHidden":"noElementsInCommon"}get status(){const e=this._prepareTask;return null==e?"not-loaded":e.finished?null!=e.error?"failed":"loaded":"loading"}get submittable(){return this.valid,!0}get updating(){return this._updatingHandles.updating||this.calculating}get valid(){return this.sharedForm.valid}get layers(){const e=new Set;return this.features.forEach(t=>{const s=t.sourceLayer??t.layer;e.add(s)}),Array.from(e)}get mode(){return this.activeFeatureIndex>-1?"single":"batch"}submit(){this.submitHasBeenAttempted=!0,this.emit("submit",{name:"submit",results:this._makeSubmitResults(),valid:this.valid})}findFieldInput(e){if(null==e)return;const t=this._activeFormInputsByElementId;if(t.has(e))return t.get(e);const s=this.activeForm.allFieldInputs.find(t=>t.template.elementId===e);return void 0!==s?(t.set(e,s),s):void 0}getFirstVisibleInvalidFieldInput(){if(this.hasVisibleInputs&&!this.activeForm.valid)for(const e of this.visibleInputs){if(I(e)){const t=e.inputs.find(e=>!e.valid);if(t)return{input:t,groupInput:e}}if(M(e)&&!e.valid)return{input:e}}}getFieldInputValue(e){return this.findFieldInput(e)?.value}getValues(e){const t=this._reactiveGraphicLookup.get(e);if(!t)throw new r("feature-not-found","The given feature is not present in the BatchAttributeForm");return{...t.attributes}}notifyGeometriesChanged(e){const t=[];for(const s of e){const e=this._reactiveGraphicLookup.get(s);e&&(t.push(e),e.geometry=s.geometry)}this._expressionsManager.runGeometryDependentExpressions(t)}async setFieldInputValue(e,t){const s=new Set(this.invalidFeatures);await e.setValueFromUser(t),this.userHasChangedValues=!0,this._trackValidityChange(s),this.emit("value-change",{features:e.features.toArray().map(e=>e.source),fieldName:e.fieldName,name:"value-change",value:t})}async setValue(e,t){const s=this.findFieldInput(e);if(null==s)throw new r("no-FieldInput-found",`Cannot set the value of FieldInput with ID: ${e} because none was found in the active form`);await this.setFieldInputValue(s,t)}userChangesHaveMadeFeatureInvalid(e){return!!this._reactiveGraphicLookup.get(e)?.userChangesHaveMadeInvalid}async _trackValidityChange(e){await m(()=>!1===this.calculating);const t=this.invalidFeatures;for(const s of t)!1===e.has(s)&&this._reactiveGraphicLookup.has(s)&&(this._reactiveGraphicLookup.get(s).userChangesHaveMadeInvalid=!0)}validate(){return!1}_makeBatchFormInputsForFeature(e){const t=this._layerTemplateMap.get(e.layer);return t?b(t,new s([e]),this._expressionsManager):this._emptyForm}_makeSubmitResults(){const e=new Map;for(const[t,s]of this._reactiveGraphicLookup)e.set(t,{feature:t,values:{...s.attributes},invalidFields:[]});for(const t of this.sharedForm.allFieldInputs)for(const s of t.invalidFeatures)e.get(s)?.invalidFields.push(t.fieldName);return Array.from(e.values())}_prepare(){this._hasAsyncArcadeExpressions=!1,this._prepareTask=o(this._prepareTask),this._updateWorkingFeatures(),o(this._expressionsManager),this.userHasChangedValues=!1,this._expressionsManager=new _({arcadeContext:{editType:this.editType,spatialReference:this.spatialReference??y.WebMercator,map:this.map,timeZone:this._effectiveTimeZone}});const{layers:e}=this;if(0===e.length)return;const s=t(async t=>{try{n(t);const s=new Map;for(const t of e){const e=await E(t);if(e){const s=e.fieldGroups.flatMap(e=>e.fields);this._layerContingentValuesMap.set(t,new Set(s))}else this._layerContingentValuesMap.set(t,new Set);const r=await k(t,{arcadeExecutorProvider:this._arcadeExecutorProvider,formTimeZone:this._effectiveTimeZone});this._layerTemplateMap.set(t,r);const i=r.getExpressionExecutorsForLayer(t);if(this._expressionsManager.layerExpressionsModelMap.set(t,new x({preserveFieldValuesWhenHidden:r.preserveFieldValuesWhenHidden,executorMap:i})),!this._hasAsyncArcadeExpressions)for(const t of i.keys()){const e=i.get(t);if(this._hasAsyncArcadeExpressions=!0===(e.editableExpression?.isAsync||e.requiredExpression?.isAsync||e.valueExpression?.isAsync||e.visibilityExpression?.isAsync),this._hasAsyncArcadeExpressions)break}for(const t of r.elements){const{elementId:e}=t;s.has(e)?s.get(e).foldIn(t):s.set(e,t.clone())}}if(this.hasTooManyComplexFeatures)throw new r("too-many-features-with-complex-forms","There are too many features to load into the form with the configured complexity");if(this.hasTooManyFeatures)throw new r("too-many-features","There are too many features to load into the form.");const i=new A({elements:Array.from(s.values())});this.sharedFormTemplate=i,this.sharedForm=b(i,this._workingFeatures,this._expressionsManager),await this._expressionsManager.runAllExpressions(this._workingFeatures.toArray())}catch(s){throw a.getLogger(this).error("Failed preparing form",s),s}});this._updatingHandles.addPromise(s.promise),this._prepareTask=s}_updateWorkingFeatures(){this._workingFeatures.destroyAll();const{features:e}=this;if(this._reactiveGraphicLookup=new p,0!==e.length){this._workingFeatures.addMany(e.map(g));for(const e of this._workingFeatures)this._reactiveGraphicLookup.set(e.source,e)}}};e([d()],T.prototype,"_effectiveTimeZone",null),e([d({readOnly:!0})],T.prototype,"activeFeature",null),e([d()],T.prototype,"activeFeatureIndex",void 0),e([d({readOnly:!0})],T.prototype,"activeForm",null),e([d()],T.prototype,"disabled",void 0),e([d()],T.prototype,"calculating",null),e([d()],T.prototype,"editType",void 0),e([d()],T.prototype,"features",void 0),e([d()],T.prototype,"expressionEvaluationFailed",null),e([d()],T.prototype,"hasNonActiveInvalidFeatures",null),e([d()],T.prototype,"hasAsyncArcadeExpressions",null),e([d()],T.prototype,"_hasAsyncArcadeExpressions",void 0),e([d()],T.prototype,"invalidFeatures",null),e([d()],T.prototype,"hasVisibleInputs",null),e([d()],T.prototype,"hasLayersWithContingentValues",null),e([d()],T.prototype,"maximumFeatureCountWithComplexForms",void 0),e([d()],T.prototype,"maximumFeatureCount",void 0),e([d()],T.prototype,"visibleInputs",null),e([d()],T.prototype,"map",void 0),e([d()],T.prototype,"noVisibleElementsReason",null),e([d()],T.prototype,"readOnly",void 0),e([d()],T.prototype,"spatialReference",void 0),e([d()],T.prototype,"submitHasBeenAttempted",void 0),e([d()],T.prototype,"timeZone",void 0),e([d()],T.prototype,"updating",null),e([d()],T.prototype,"valid",null),e([d()],T.prototype,"layers",null),e([d()],T.prototype,"mode",null),e([d()],T.prototype,"sharedForm",void 0),e([d()],T.prototype,"sharedFormTemplate",void 0),e([d()],T.prototype,"userHasChangedValues",void 0),e([d()],T.prototype,"_arcadeExecutorProvider",void 0),e([d()],T.prototype,"_prepareTask",void 0),e([d()],T.prototype,"_reactiveGraphicLookup",void 0),e([d()],T.prototype,"_layerTemplateMap",void 0),e([d()],T.prototype,"_layerContingentValuesMap",void 0),e([d()],T.prototype,"_workingFeatures",void 0),e([d()],T.prototype,"_expressionsManager",void 0),T=e([c("esri.widgets.BatchAttributeForm.BatchAttributeFormViewModel")],T);const C=T;export{C as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import{createTask as t}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import r from"../../core/Error.js";import{EventedAccessor as i}from"../../core/Evented.js";import a from"../../core/Logger.js";import{abortMaybe as o}from"../../core/maybe.js";import{throwIfAborted as n}from"../../core/promiseUtils.js";import p from"../../core/ReactiveMap.js";import{on as l,watch as u,sync as h,whenOnce as m}from"../../core/reactiveUtils.js";import{property as d}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as f}from"../../core/support/UpdatingHandles.js";import y from"../../geometry/SpatialReference.js";import{system as v}from"../../time/constants.js";import{createReactiveGraphic as g}from"./batchAttributeFormUtils.js";import{ArcadeExecutorProvider as F}from"./expressions/ArcadeExecutorProvider.js";import{ExpressionsManager as _}from"./expressions/ExpressionsManager.js";import{ExpressionsModel as x}from"./expressions/ExpressionsModel.js";import w from"./inputs/BatchFormInputs.js";import{createBatchFormInputsFromBatchFormTemplate as b}from"./inputs/support/createBatchFormInputs.js";import{isGroupInput as I,isFieldInput as M}from"./inputs/support/inputUtils.js";import A from"./templates/BatchFormTemplate.js";import{getLayerContingentValuesMetaData as E}from"./templates/support/contingentValuesUtils.js";import{createBatchFormTemplate as k}from"./templates/support/createBatchFormTemplate.js";let T=class extends i{constructor(e){super(e),this.activeFeatureIndex=-1,this.disabled=!1,this.editType="NA",this.features=new s,this._hasAsyncArcadeExpressions=!1,this.maximumFeatureCount=2e3,this.maximumFeatureCountWithComplexForms=50,this.map=null,this.readOnly=!1,this.spatialReference=null,this.submitHasBeenAttempted=!1,this.timeZone=null,this.userHasChangedValues=!1,this._arcadeExecutorProvider=new F,this._activeFormInputsByElementId=new Map,this._emptyForm=new w({inputs:[]}),this._emptyFormTemplate=new A({elements:[]}),this._featureFormMap=new Map,this._prepareTask=null,this._reactiveGraphicLookup=new p,this._updatingHandles=new f,this._layerTemplateMap=new p,this._layerContingentValuesMap=new p,this._workingFeatures=new s,this._expressionsManager=new _({arcadeContext:{editType:"NA",spatialReference:null,map:null,timeZone:v}}),this.sharedForm=this._emptyForm,this.sharedFormTemplate=this._emptyFormTemplate}initialize(){this.addHandles([l(()=>this.features,"after-changes",()=>this._prepare(),{sync:!0}),u(()=>[this.features,this.map,this.timeZone,this.editType],()=>this._prepare(),h),u(()=>this.activeForm,()=>this._activeFormInputsByElementId.clear(),h)]),this._prepare()}destroy(){this._prepareTask=o(this._prepareTask),this._workingFeatures.destroyAll(),this._expressionsManager&&this._expressionsManager.abort(),this._reactiveGraphicLookup=new p,this._emptyForm.destroy(),this._emptyFormTemplate.destroy()}get _effectiveTimeZone(){return this.timeZone??"system"}get activeFeature(){const e=this.activeFeatureIndex;return e<0?null:this.features.at(e)}get activeForm(){if("batch"===this.mode)return this.sharedForm;const e=this._workingFeatures.at(this.activeFeatureIndex);if(!e)return this._emptyForm;const t=this._featureFormMap.get(e);if(t)return t;const s=this._makeBatchFormInputsForFeature(e);return s!==this._emptyForm&&this._featureFormMap.set(e,s),s}get calculating(){return this._expressionsManager.calculating}get expressionEvaluationFailed(){return this._expressionsManager.expressionEvaluationFailed}get hasNonActiveInvalidFeatures(){if("batch"===this.mode)return!1;const{activeFeature:e}=this;return this.invalidFeatures.some(t=>t!==e)}get hasAsyncArcadeExpressions(){return this._hasAsyncArcadeExpressions}get hasTooManyFeatures(){return this._workingFeatures.length>this.maximumFeatureCount}get hasTooManyComplexFeatures(){return this._workingFeatures.length>this.maximumFeatureCountWithComplexForms&&this.hasAsyncArcadeExpressions}get invalidFeatures(){return this.sharedForm.invalidFeatures}get hasVisibleInputs(){return this.visibleInputs.length>0}get hasLayersWithContingentValues(){for(const e of this.layers){const t=this._layerContingentValuesMap.get(e);if(t&&t.size>0)return!0}return!1}get visibleInputs(){return this.activeForm.inputs.filter(e=>e.visible)}get noVisibleElementsReason(){if(this.hasVisibleInputs)return null;if(0===this.activeForm.inputs.length)return"noElements";const e=new Set;for(const t of this.activeForm.inputs)switch(t.visibilityCode){case"hidden:not-in-all-layers":case"hidden:no-domain-in-common":e.add("noElementsInCommon");break;case"hidden:field-definition":case"hidden:group-visibility-expression:all-features":case"hidden:visibility-expression:all-features":e.add("allElementsHidden");break;case"hidden:group-visibility-expression:some-features":case"hidden:visibility-expression:some-features":return"elementsHiddenInSome"}return e.has("allElementsHidden")?"allElementsHidden":"noElementsInCommon"}get status(){const e=this._prepareTask;return null==e?"not-loaded":e.finished?null!=e.error?"failed":"loaded":"loading"}get submittable(){return this.valid,!0}get updating(){return this._updatingHandles.updating||this.calculating}get valid(){return this.sharedForm.valid}get layers(){const e=new Set;return this.features.forEach(t=>{const s=t.sourceLayer??t.layer;e.add(s)}),Array.from(e)}get mode(){return this.activeFeatureIndex>-1?"single":"batch"}submit(){this.submitHasBeenAttempted=!0,this.emit("submit",{name:"submit",results:this._makeSubmitResults(),valid:this.valid})}findFieldInput(e){if(null==e)return;const t=this._activeFormInputsByElementId;if(t.has(e))return t.get(e);const s=this.activeForm.allFieldInputs.find(t=>t.template.elementId===e);return void 0!==s?(t.set(e,s),s):void 0}getFirstVisibleInvalidFieldInput(){if(this.hasVisibleInputs&&!this.activeForm.valid)for(const e of this.visibleInputs){if(I(e)){const t=e.inputs.find(e=>!e.valid);if(t)return{input:t,groupInput:e}}if(M(e)&&!e.valid)return{input:e}}}getFieldInputValue(e){return this.findFieldInput(e)?.value}getValues(e){const t=this._reactiveGraphicLookup.get(e);if(!t)throw new r("feature-not-found","The given feature is not present in the BatchAttributeForm");return{...t.attributes}}notifyGeometriesChanged(e){const t=[];for(const s of e){const e=this._reactiveGraphicLookup.get(s);e&&(t.push(e),e.geometry=s.geometry)}this._expressionsManager.runGeometryDependentExpressions(t)}async setFieldInputValue(e,t){const s=new Set(this.invalidFeatures);await e.setValueFromUser(t),this.userHasChangedValues=!0,this._trackValidityChange(s),this.emit("value-change",{features:e.features.toArray().map(e=>e.source),fieldName:e.fieldName,name:"value-change",value:t})}async setValue(e,t){const s=this.findFieldInput(e);if(null==s)throw new r("no-FieldInput-found",`Cannot set the value of FieldInput with ID: ${e} because none was found in the active form`);await this.setFieldInputValue(s,t)}userChangesHaveMadeFeatureInvalid(e){return!!this._reactiveGraphicLookup.get(e)?.userChangesHaveMadeInvalid}async _trackValidityChange(e){await m(()=>!1===this.calculating);const t=this.invalidFeatures;for(const s of t)!1===e.has(s)&&this._reactiveGraphicLookup.has(s)&&(this._reactiveGraphicLookup.get(s).userChangesHaveMadeInvalid=!0)}validate(){return!1}_makeBatchFormInputsForFeature(e){const t=this._layerTemplateMap.get(e.layer);return t?b(t,new s([e]),this._expressionsManager):this._emptyForm}_makeSubmitResults(){const e=new Map;for(const[t,s]of this._reactiveGraphicLookup)e.set(t,{feature:t,values:{...s.attributes},invalidFields:[]});for(const t of this.sharedForm.allFieldInputs)for(const s of t.invalidFeatures)e.get(s)?.invalidFields.push(t.fieldName);return Array.from(e.values())}_prepare(){this._hasAsyncArcadeExpressions=!1,this._prepareTask=o(this._prepareTask),this._updateWorkingFeatures(),o(this._expressionsManager),this.userHasChangedValues=!1,this._expressionsManager=new _({arcadeContext:{editType:this.editType,spatialReference:this.spatialReference??y.WebMercator,map:this.map,timeZone:this._effectiveTimeZone}});const{layers:e}=this;if(0===e.length)return;const s=t(async t=>{try{n(t);const s=new Map;for(const t of e){const e=await E(t);if(e){const s=e.fieldGroups.flatMap(e=>e.fields);this._layerContingentValuesMap.set(t,new Set(s))}else this._layerContingentValuesMap.set(t,new Set);const r=await k(t,{arcadeExecutorProvider:this._arcadeExecutorProvider,formTimeZone:this._effectiveTimeZone});this._layerTemplateMap.set(t,r);const i=r.getExpressionExecutorsForLayer(t);if(this._expressionsManager.layerExpressionsModelMap.set(t,new x({preserveFieldValuesWhenHidden:r.preserveFieldValuesWhenHidden,executorMap:i})),!this._hasAsyncArcadeExpressions)for(const t of i.keys()){const e=i.get(t);if(this._hasAsyncArcadeExpressions=!0===(e.editableExpression?.isAsync||e.requiredExpression?.isAsync||e.valueExpression?.isAsync||e.visibilityExpression?.isAsync),this._hasAsyncArcadeExpressions)break}for(const t of r.elements){const{elementId:e}=t;s.has(e)?s.get(e).foldIn(t):s.set(e,t.clone())}}if(this.hasTooManyComplexFeatures)throw new r("too-many-features-with-complex-forms","There are too many features to load into the form with the configured complexity");if(this.hasTooManyFeatures)throw new r("too-many-features","There are too many features to load into the form.");const i=new A({elements:Array.from(s.values())});this.sharedFormTemplate=i,this.sharedForm=b(i,this._workingFeatures,this._expressionsManager),await this._expressionsManager.runAllExpressions(this._workingFeatures.toArray())}catch(s){throw a.getLogger(this).error("Failed preparing form",s),s}});this._updatingHandles.addPromise(s.promise),this._prepareTask=s}_updateWorkingFeatures(){this._workingFeatures.destroyAll();const{features:e}=this;if(this._reactiveGraphicLookup=new p,0!==e.length){this._workingFeatures.addMany(e.map(g));for(const e of this._workingFeatures)this._reactiveGraphicLookup.set(e.source,e)}}};e([d()],T.prototype,"_effectiveTimeZone",null),e([d({readOnly:!0})],T.prototype,"activeFeature",null),e([d()],T.prototype,"activeFeatureIndex",void 0),e([d({readOnly:!0})],T.prototype,"activeForm",null),e([d()],T.prototype,"disabled",void 0),e([d()],T.prototype,"calculating",null),e([d()],T.prototype,"editType",void 0),e([d()],T.prototype,"features",void 0),e([d()],T.prototype,"expressionEvaluationFailed",null),e([d()],T.prototype,"hasNonActiveInvalidFeatures",null),e([d()],T.prototype,"hasAsyncArcadeExpressions",null),e([d()],T.prototype,"_hasAsyncArcadeExpressions",void 0),e([d()],T.prototype,"invalidFeatures",null),e([d()],T.prototype,"hasVisibleInputs",null),e([d()],T.prototype,"hasLayersWithContingentValues",null),e([d()],T.prototype,"maximumFeatureCount",void 0),e([d()],T.prototype,"maximumFeatureCountWithComplexForms",void 0),e([d()],T.prototype,"visibleInputs",null),e([d()],T.prototype,"map",void 0),e([d()],T.prototype,"noVisibleElementsReason",null),e([d()],T.prototype,"readOnly",void 0),e([d()],T.prototype,"spatialReference",void 0),e([d()],T.prototype,"submitHasBeenAttempted",void 0),e([d()],T.prototype,"timeZone",void 0),e([d()],T.prototype,"updating",null),e([d()],T.prototype,"valid",null),e([d()],T.prototype,"layers",null),e([d()],T.prototype,"mode",null),e([d()],T.prototype,"sharedForm",void 0),e([d()],T.prototype,"sharedFormTemplate",void 0),e([d()],T.prototype,"userHasChangedValues",void 0),e([d()],T.prototype,"_arcadeExecutorProvider",void 0),e([d()],T.prototype,"_prepareTask",void 0),e([d()],T.prototype,"_reactiveGraphicLookup",void 0),e([d()],T.prototype,"_layerTemplateMap",void 0),e([d()],T.prototype,"_layerContingentValuesMap",void 0),e([d()],T.prototype,"_workingFeatures",void 0),e([d()],T.prototype,"_expressionsManager",void 0),T=e([c("esri.widgets.BatchAttributeForm.BatchAttributeFormViewModel")],T);const C=T;export{C as default};
|