@arcgis/core 4.34.0-next.85 → 4.34.0-next.87
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/Basemap.js +1 -1
- package/Ground.js +1 -1
- package/Map.js +1 -1
- package/analysis/ElevationProfile/ElevationProfileLineGround.d.ts +4 -0
- package/analysis/ElevationProfile/{ElevationProfileGroundLine.js → ElevationProfileLineGround.js} +1 -1
- package/analysis/ElevationProfile/ElevationProfileLineInput.d.ts +4 -0
- package/analysis/ElevationProfile/{ElevationProfileInputLine.js → ElevationProfileLineInput.js} +1 -1
- package/analysis/ElevationProfile/ElevationProfileLineQuery.d.ts +4 -0
- package/analysis/ElevationProfile/{ElevationProfileQueryLine.js → ElevationProfileLineQuery.js} +1 -1
- package/analysis/ElevationProfile/ElevationProfileLineScene.d.ts +4 -0
- package/analysis/ElevationProfile/{ElevationProfileSceneLine.js → ElevationProfileLineScene.js} +1 -1
- package/analysis/ElevationProfile/elevationProfileLineTypes.js +1 -1
- package/analysis/ElevationProfileAnalysis.js +1 -1
- package/arcade/functions/measures.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0074f1836d7ff69ff6ec.js +1 -0
- package/assets/esri/core/workers/chunks/03ef19f0753d68770444.js +1 -0
- package/assets/esri/core/workers/chunks/06c389283ee5b60573f2.js +1 -0
- package/assets/esri/core/workers/chunks/09c2004126f4a5242b85.js +1 -0
- package/assets/esri/core/workers/chunks/0b679d5a1bfdbd006d6e.js +1 -0
- package/assets/esri/core/workers/chunks/0f05425954578ac796ec.js +1 -0
- package/assets/esri/core/workers/chunks/109149c378aa4c5f8526.js +1 -0
- package/assets/esri/core/workers/chunks/143503f6eb270c4683f8.js +1 -0
- package/assets/esri/core/workers/chunks/177840d5f0076c0de46b.js +316 -0
- package/assets/esri/core/workers/chunks/1c1b0cc91fe9cb3fec61.js +1 -0
- package/assets/esri/core/workers/chunks/{9eb1bfcb9b05f2a36748.js → 1f2d13466c60a6b57717.js} +1 -1
- package/assets/esri/core/workers/chunks/1fc6311d4f0d27e88737.js +1 -0
- package/assets/esri/core/workers/chunks/257fd65786feb5951b90.js +1 -0
- package/assets/esri/core/workers/chunks/{7a23b127f551bf13ef54.js → 268f5b233640a9dbbf89.js} +2 -2
- package/assets/esri/core/workers/chunks/2896ada406074f754b00.js +1 -0
- package/assets/esri/core/workers/chunks/28d30be414e59eabd963.js +1 -0
- package/assets/esri/core/workers/chunks/29471e0b3f7296dee096.js +1 -0
- package/assets/esri/core/workers/chunks/{3192b68675ff2afcb1d6.js → 2d3ae187f8aa3495d4ae.js} +1 -1
- package/assets/esri/core/workers/chunks/2dc88379ee94fabdaf52.js +1 -0
- package/assets/esri/core/workers/chunks/336b54144afec0c7d396.js +2 -0
- package/assets/esri/core/workers/chunks/366db86914a63e6d0c68.js +1 -0
- package/assets/esri/core/workers/chunks/{d66cdb9bb494da19696b.js → 47e4f66c33bb697fbe6b.js} +2 -2
- package/assets/esri/core/workers/chunks/481c2b01e2fe92249698.js +1 -0
- package/assets/esri/core/workers/chunks/4840bd93d8fe15c7aefd.js +1 -0
- package/assets/esri/core/workers/chunks/4d4db6854aff7656f6e1.js +1 -0
- package/assets/esri/core/workers/chunks/5c585b338a9e9aa0e205.js +1 -0
- package/assets/esri/core/workers/chunks/639d856cd217914dfe1f.js +1 -0
- package/assets/esri/core/workers/chunks/68f5a2d2666636c3f807.js +1 -0
- package/assets/esri/core/workers/chunks/7540b34e743a23e67729.js +1 -0
- package/assets/esri/core/workers/chunks/7be11a3ef1f49245089f.js +1 -0
- package/assets/esri/core/workers/chunks/819a8bc1f0a694017ee6.js +1 -0
- package/assets/esri/core/workers/chunks/{afb76f9d6abedef771df.js → 8380a092ffc8e92ede7a.js} +1 -1
- package/assets/esri/core/workers/chunks/8d63b42aea32ce2e5d09.js +1 -0
- package/assets/esri/core/workers/chunks/8de11aab65d91e7f1a4d.js +1 -0
- package/assets/esri/core/workers/chunks/9386a0ebff78b6303ed2.js +1 -0
- package/assets/esri/core/workers/chunks/{4d47187bc0821413492d.js → 95bae3c275f1483eb7ed.js} +1 -1
- package/assets/esri/core/workers/chunks/{f8f85207b382c1ea038c.js → 97489bf16a1d327992b2.js} +3 -3
- package/assets/esri/core/workers/chunks/a2652d10bb0bc41c9a8d.js +1 -0
- package/assets/esri/core/workers/chunks/a845c68e76382a73da5e.js +1 -0
- package/assets/esri/core/workers/chunks/{9c64b78c5c9b35b31d98.js → aa78b69219d9a0ef1c54.js} +2 -2
- package/assets/esri/core/workers/chunks/b09b34f64a6bc2b49e0a.js +1 -0
- package/assets/esri/core/workers/chunks/b0a03b6edbcf6e933431.js +1 -0
- package/assets/esri/core/workers/chunks/{1859a11df9f579b993d7.js → b2fbb44e219232e61cbd.js} +1 -1
- package/assets/esri/core/workers/chunks/b4349db7155673329432.js +1 -0
- package/assets/esri/core/workers/chunks/b8997ae5893afa0298d1.js +1 -0
- package/assets/esri/core/workers/chunks/c0ae186620b68d43b338.js +1 -0
- package/assets/esri/core/workers/chunks/{d153b29c542c37ae1636.js → c50e8d5f554cf151865c.js} +2 -2
- package/assets/esri/core/workers/chunks/c5cc0fc652432a9264cc.js +1 -0
- package/assets/esri/core/workers/chunks/c6cae8471c5d4ae40c65.js +1 -0
- package/assets/esri/core/workers/chunks/cab2a1382bdd32bb34d8.js +1 -0
- package/assets/esri/core/workers/chunks/ce937ff0dd1147ea297e.js +1 -0
- package/assets/esri/core/workers/chunks/d142a42755a78bb157ed.js +1 -0
- package/assets/esri/core/workers/chunks/{280af3640f8e93c1024e.js → d6e0528eacee7ea4c1ce.js} +2 -2
- package/assets/esri/core/workers/chunks/d9d86cf0500fa29d1d43.js +1 -0
- package/assets/esri/core/workers/chunks/db5a985ccc6b7d0ad855.js +1 -0
- package/assets/esri/core/workers/chunks/f3ee035fa7bf638c8e60.js +1 -0
- package/assets/esri/core/workers/chunks/{b15ff6c9ef2de8a49853.js → f651c05604eab83aef5f.js} +2 -2
- package/assets/esri/core/workers/chunks/{ed773dab5965e42a2879.js → f6e18668f728dfd8ba5e.js} +2 -2
- package/assets/esri/core/workers/chunks/fc5ac54aab66562c8463.js +1 -0
- package/assets/esri/core/workers/chunks/ff8e2f998169ca3a7a68.js +1 -0
- package/assets/esri/libs/dracoMeshDecoder/draco_mesh_decoder.wasm +0 -0
- package/assets/esri/libs/i3s/i3s.wasm +0 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/views/3d/analysis/VolumeMeasurement/t9n/VolumeMeasurementAnalysis.json +1 -0
- package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
- package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
- package/chunks/CloudsComposition.glsl.js +2 -2
- package/chunks/HUDMaterial.glsl.js +49 -50
- package/chunks/LineMarker.glsl.js +34 -34
- package/chunks/PointRenderer.glsl.js +4 -4
- package/chunks/ShadowHighlight.glsl.js +3 -3
- package/chunks/draco_mesh_decoder.js +1 -1
- package/config.js +1 -1
- package/core/NestedMap.js +1 -1
- package/core/iteratorUtils.js +1 -1
- package/editing/geometry/lineUtils.js +1 -1
- package/identity/IdentityManagerBase.js +1 -1
- package/interfaces.d.ts +188 -134
- package/kernel.js +1 -1
- package/layers/GaussianSplatLayer.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/IntegratedMeshLayer.js +1 -1
- package/layers/ParquetLayer.js +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/VectorTileLayer.js +1 -1
- package/layers/graphics/sources/ParquetSource.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
- package/layers/knowledgeGraph/cypherUtils.js +1 -1
- package/layers/support/FieldConfiguration.js +1 -1
- package/layers/support/fieldConfigUtils.js +1 -1
- package/layers/support/layerUtils.js +1 -1
- package/layers/support/vectorTileLayerLoader.js +1 -1
- package/package.json +5 -5
- package/portal/schemas/definitions.js +1 -1
- package/support/basemapEnsureType.js +1 -1
- package/support/revision.js +1 -1
- package/support/userTypeGuards/isBasemap.js +5 -0
- package/symbols/support/previewSymbol2D.js +1 -1
- package/views/2d/analysis/ElevationProfileAnalysisView2D.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
- package/views/2d/layers/features/Processor.js +1 -1
- package/views/2d/layers/features/layerAdapters/CatalogFootprintLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/InMemoryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/KnowledgeGraphSublayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OGCFeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/OrientedImageryLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/StreamLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/featureServiceUtils.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/FeatureSourceQueryInfo.js +1 -1
- package/views/2d/layers/features/sources/strategies/AFeatureLoadStrategy.js +5 -0
- package/views/2d/layers/features/sources/strategies/AFeatureTileLoadStrategy.js +5 -0
- package/views/2d/layers/features/sources/strategies/ALoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/FeatureDrillDownTileLoadStrategy.js +5 -0
- package/views/2d/layers/features/sources/strategies/FeaturePagedTileLoadStrategy.js +5 -0
- package/views/2d/layers/features/sources/strategies/FeatureSnapshotLoadStrategy.js +5 -0
- package/views/2d/layers/features/sources/strategies/ParquetSnapshotLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/StreamLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/FeatureSnapshotSourceChunk.js +1 -1
- package/views/2d/layers/features/sources/strategies/chunks/SourceChunkStore.js +1 -1
- package/views/2d/layers/features/sources/strategies/support/queryAdapters.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderParquet.js +1 -1
- package/views/3d/FocusAreasView.js +1 -1
- package/views/3d/GroundView3D.js +5 -0
- package/views/3d/analysis/ElevationProfile/{ElevationProfileSceneLineComputation.js → ElevationProfileLineSceneComputation.js} +1 -1
- package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementConfiguration.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
- package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
- package/views/3d/environment/CloudsComposition.glsl.js +1 -1
- package/views/3d/glTF/internal/Resource.js +1 -1
- package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
- package/views/3d/interactive/visualElements/DrapedVisualElementResources.js +1 -1
- package/views/3d/interactive/visualElements/LabelVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/layers/DrapedSubView3D.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/support/MemoryController.js +1 -1
- package/views/3d/support/engineContent/marker.js +1 -1
- package/views/3d/support/engineContent/sdfPrimitives.js +1 -1
- package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
- package/views/3d/support/popupHitTest.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +11 -11
- package/views/3d/webgl-engine/lib/BasisUtil.js +1 -1
- package/views/3d/webgl-engine/lib/Texture.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/InstancedCommandVAO.js +5 -0
- package/views/3d/webgl-engine/materials/renderers/InstancedCommandVAOs.js +5 -0
- package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/PerOriginData.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/AnimatedLine.glsl.js +14 -9
- package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarker.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/PointRenderer.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowHighlight.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/LineOffset.glsl.js +8 -8
- package/views/BasemapView.js +1 -1
- package/views/GroundView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/View.js +1 -1
- package/views/View2D.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileChart.js +1 -1
- package/views/analysis/ElevationProfile/{ElevationProfileGroundLineComputation.js → ElevationProfileLineGroundComputation.js} +1 -1
- package/views/analysis/ElevationProfile/{ElevationProfileInputLineComputation.js → ElevationProfileLineInputComputation.js} +1 -1
- package/views/analysis/ElevationProfile/{ElevationProfileQueryLineComputation.js → ElevationProfileLineQueryComputation.js} +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
- package/views/support/LayerViewManager.js +1 -1
- package/views/webgl/RenderbufferDescriptor.js +1 -1
- package/views/webgl/TextureDescriptor.js +1 -1
- package/views/webgl/Util.js +1 -1
- package/views/webgl/VertexArrayObject.js +1 -1
- package/webscene/Slide.js +1 -1
- package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/SplitFeatureWorkflow.js +1 -1
- package/widgets/Editor/UpdateFeatureWorkflow.js +1 -1
- package/widgets/Editor/Upload.js +1 -1
- package/widgets/Editor/components/Notices.js +1 -1
- package/widgets/Editor/modelUploadUtils.js +1 -1
- package/widgets/Editor/support/SketchController.js +1 -1
- package/widgets/Editor/support/splitFeatureUtils.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/ElevationProfile/ElevationProfileLineGround.d.ts +2 -2
- package/widgets/ElevationProfile/ElevationProfileLineInput.d.ts +2 -2
- package/widgets/ElevationProfile/ElevationProfileLineQuery.d.ts +2 -2
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch/adapters/layer/GraphicsLayerAdapter.js +5 -0
- package/widgets/Sketch/adapters/layer/MapNotesLayerAdapter.js +5 -0
- package/analysis/ElevationProfile/ElevationProfileGroundLine.d.ts +0 -4
- package/analysis/ElevationProfile/ElevationProfileInputLine.d.ts +0 -4
- package/analysis/ElevationProfile/ElevationProfileQueryLine.d.ts +0 -4
- package/analysis/ElevationProfile/ElevationProfileSceneLine.d.ts +0 -4
- package/assets/esri/core/workers/chunks/03e5d1a00d85e4d16bff.js +0 -1
- package/assets/esri/core/workers/chunks/0914a52fb33af5d77fab.js +0 -1
- package/assets/esri/core/workers/chunks/1d491447b13f2f2b4399.js +0 -1
- package/assets/esri/core/workers/chunks/20850b0fdb55fb17bc90.js +0 -1
- package/assets/esri/core/workers/chunks/25ea02dd7d45a90cbb3b.js +0 -1
- package/assets/esri/core/workers/chunks/264a9a916e1e972b69d7.js +0 -1
- package/assets/esri/core/workers/chunks/30c85a1a4f118cc45a25.js +0 -1
- package/assets/esri/core/workers/chunks/3ef8a7468d7e3b2f0b69.js +0 -351
- package/assets/esri/core/workers/chunks/486ea51306c619238e41.js +0 -1
- package/assets/esri/core/workers/chunks/49cb78c85de0102e5f02.js +0 -1
- package/assets/esri/core/workers/chunks/5610dfde4e636e2333a9.js +0 -1
- package/assets/esri/core/workers/chunks/5c1cdc2ec06c4c6bd0b3.js +0 -1
- package/assets/esri/core/workers/chunks/609abf071c4ea24955c2.js +0 -1
- package/assets/esri/core/workers/chunks/71c2a8e5a17803d3e949.js +0 -1
- package/assets/esri/core/workers/chunks/7402c2853f6aed8d1bc7.js +0 -1
- package/assets/esri/core/workers/chunks/7889a909394c61a9d3e0.js +0 -1
- package/assets/esri/core/workers/chunks/79a9f47dfa9ebabb5dbd.js +0 -1
- package/assets/esri/core/workers/chunks/86378d4f4d7f9a370c22.js +0 -1
- package/assets/esri/core/workers/chunks/99ac292a858bbedc6a89.js +0 -1
- package/assets/esri/core/workers/chunks/9a6fa91dd204f64d2590.js +0 -1
- package/assets/esri/core/workers/chunks/9cdeead9d444e8d95477.js +0 -1
- package/assets/esri/core/workers/chunks/aa1eb7b4d9ccda725da5.js +0 -1
- package/assets/esri/core/workers/chunks/b19d723d09f5bea9ca27.js +0 -1
- package/assets/esri/core/workers/chunks/b4a053063e6022080d31.js +0 -1
- package/assets/esri/core/workers/chunks/b4b26cc2ba3ff30e1d03.js +0 -1
- package/assets/esri/core/workers/chunks/b78ea9cc4d5f2fd3d871.js +0 -1
- package/assets/esri/core/workers/chunks/bbb585f0b484ab5eabb3.js +0 -1
- package/assets/esri/core/workers/chunks/bd4125d163f372a7e978.js +0 -1
- package/assets/esri/core/workers/chunks/c2bc70b65f5c2a2c9671.js +0 -1
- package/assets/esri/core/workers/chunks/cd1869e183001266c4c1.js +0 -2
- package/assets/esri/core/workers/chunks/d0a149050f7f1c1ada09.js +0 -1
- package/assets/esri/core/workers/chunks/d2fe403d6ab237bc89c2.js +0 -1
- package/assets/esri/core/workers/chunks/d51e8eeb1e1eb0605cc9.js +0 -1
- package/assets/esri/core/workers/chunks/da42cc4f6142846cb745.js +0 -1
- package/assets/esri/core/workers/chunks/dd84f630466a26722d57.js +0 -1
- package/assets/esri/core/workers/chunks/e080628ac6e1cf25dc72.js +0 -1
- package/assets/esri/core/workers/chunks/e17df11c98dbd869302b.js +0 -1
- package/assets/esri/core/workers/chunks/e1b3ae6426886e2fab07.js +0 -1
- package/assets/esri/core/workers/chunks/e8e0f73fb94e63e2abc3.js +0 -1
- package/assets/esri/core/workers/chunks/f45c343527709f6f91c2.js +0 -1
- package/assets/esri/core/workers/chunks/f6513ec888a7d927d948.js +0 -1
- package/assets/esri/core/workers/chunks/fcac475e4e82911b3126.js +0 -1
- package/views/2d/layers/features/sources/strategies/AFetchLoadStrategy.js +0 -5
- package/views/2d/layers/features/sources/strategies/ATileLoadStrategy.js +0 -5
- package/views/2d/layers/features/sources/strategies/DrillDownTileLoadStrategy.js +0 -5
- package/views/2d/layers/features/sources/strategies/PagedTileLoadStrategy.js +0 -5
- package/views/2d/layers/features/sources/strategies/SnapshotLoadStrategy.js +0 -5
- /package/assets/esri/core/workers/chunks/{7a23b127f551bf13ef54.js.LICENSE.txt → 268f5b233640a9dbbf89.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{cd1869e183001266c4c1.js.LICENSE.txt → 336b54144afec0c7d396.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{280af3640f8e93c1024e.js.LICENSE.txt → 47e4f66c33bb697fbe6b.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{9c64b78c5c9b35b31d98.js.LICENSE.txt → aa78b69219d9a0ef1c54.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{d153b29c542c37ae1636.js.LICENSE.txt → c50e8d5f554cf151865c.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{b15ff6c9ef2de8a49853.js.LICENSE.txt → d6e0528eacee7ea4c1ce.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{d66cdb9bb494da19696b.js.LICENSE.txt → f651c05604eab83aef5f.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{ed773dab5965e42a2879.js.LICENSE.txt → f6e18668f728dfd8ba5e.js.LICENSE.txt} +0 -0
package/views/View2D.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../Viewpoint.js";import i from"../core/Collection.js";import r from"../core/CollectionFlattener.js";import s from"../core/Error.js";import has from"../core/has.js";import a from"../core/Logger.js";import{destroyMaybe as n}from"../core/maybe.js";import{watch as o,syncAndInitial as l}from"../core/reactiveUtils.js";import{initialize as p}from"../core/workers/workers.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import{cast as g}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import{owningCollectionProperty as u}from"../core/support/OwningCollection.js";import m from"../geometry/Polygon.js";import{isLoadedOrLoadFor as y}from"../geometry/projectionUtils.js";import f from"../layers/support/TileInfo.js";import{AnalysesCollection as w}from"../support/AnalysesCollection.js";import{BreakpointsOwner as V}from"./BreakpointsOwner.js";import{DOMContainer as v}from"./DOMContainer.js";import{PopupView as M}from"./PopupView.js";import b from"./View.js";import{Viewport2DBaseMixin as _}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as j}from"./Viewport2DMixin.js";import R from"./2d/AnimationManager.js";import{layerView2DImporter as L}from"./2d/layerViewModuleImportUtils.js";import S from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{extentToScale as O}from"./2d/viewpointUtils.js";import{importAnalysisViewModule as T}from"./2d/analysis/analysisViewModuleImportUtils.js";import{ManagedCanvas as C}from"./2d/engine/ManagedCanvas.js";import k from"./2d/layers/features/support/TileStore.js";import{createOrReuseHighlightGradient as x}from"./2d/layers/support/util.js";import{clipContainsPoint as D}from"./2d/support/clippingUtils.js";import{getDefaultHighlightOptions as A,setDefaultHighlightOptions as P}from"./2d/support/highlightOptionsUtils.js";import{hitTest as E}from"./2d/support/hitTestUtils.js";import{takeRawScreenshot as z,takeScreenshot as G}from"./2d/support/screenshotUtils.js";import{Timeline as U}from"./2d/support/Timeline.js";import q from"./navigation/Navigation.js";import I from"./navigation/NavigationActionMap.js";import N from"./support/AnalysisViewManager.js";import W from"./support/HighlightOptions.js";import{check as $}from"./support/WebGLRequirements.js";import F from"./ui/DefaultUI.js";import H from"./ui/2d/DefaultUI2D.js";import{RenderingContextOptions as B}from"./webgl/RenderingContextOptions.js";import{isWebMap as Z}from"../webmap/utils.js";import J from"../webmap/background/ColorBackground.js";let K,Q,X,Y,ee,te,ie;async function re(){const[,{GraphicsView2D:e,GraphicContainer:t,LabelManager:i,MapViewNavigation:r,MagnifierView2D:s,GridView2D:a,Stage:n}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);Q=e,X=t,Y=i,ee=r,te=s,ie=a,K=n}let se=class extends(j(_(V(M(v(b)))))){get timeZone(){return super.timeZone}set timeZone(e){super.timeZone=e}constructor(e){super(e),this._magnifierView=null,this._gridView=null,this.stage=null,this._resolveWhenReady=[],this.rootLayerViews=new r({getCollections:()=>[this.basemapView?.baseLayerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.graphicsView=null,this.labelManager=null,this.navigation=new q({actionMap:new I({dragTertiary:"none"})}),this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.supersampleScreenshotsEnabled=!0,this.supportsGround=!1,this.analyses=new w,this.analysisViewManager=new N({importAnalysisViewModule:e=>T(e),view:this}),this.floors=new i,this.grid=null,this.map=null,this.timeline=new U,this.type="2d",this.view2dType=null,this.ui=new H,this.test={takeScreenshot:async e=>z(this._getScreenshotView(e),e)},this.padding={top:0,right:0,bottom:0,left:0},p()}destroy(){this.layerViewManager.clear(),this._set("preconditionsReady",!1),this.frameTask=n(this.frameTask),this.goToManager.destroy(),this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new k(this.featuresTilingScheme)}get constraintsInfo(){const e=this.defaultsFromMap?.tileInfo,t=this.spatialReference;return{lods:e?.spatialReference?.equals(t)?e.lods:null,spatialReference:t}}get initialExtentRequired(){if(!this.stateManager)return!1;const{scale:e,constraints:t,center:i,viewpoint:r,extent:s}=this;let a=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.viewpoint)&&(!s&&(t?.effectiveLODs||(a=-1),(!i||0===e&&-1===a)&&(null==r?.targetGeometry||"extent"!==r.targetGeometry.type&&!r.scale)))}get defaultsFromMapSettings(){return{required:{extent:!1,heightModelInfo:!1,tileInfo:!0},requiresExtentInSpatialReference:this.spatialReferenceLocked}}get scheduler(){return this.frameTask.scheduler}get typeSpecificPreconditionsReady(){const e=this._getDefaultViewpoint();if(!e)return!1;const t=e.targetGeometry,i=this.spatialReference;return y(t.spatialReference,i)}get background(){return Z(this.map)?this.map.initialViewProperties.background:null}set background(e){this._override("background",e)}get center(){return this.stateManager?.center??null}set center(e){this.stateManager.center=e}get constraints(){return super.constraints}set constraints(e){super.constraints=e}get highlightOptions(){return A(this)}set highlightOptions(e){P(this,e)}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get rendering(){return this.stage?.renderRequested??!1}get resizeAlign(){return super.resizeAlign}set resizeAlign(e){super.resizeAlign=e}get resolution(){return this.stateManager.resolution??0}get rotation(){return super.rotation}set rotation(e){super.rotation=e}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get spatialReference(){return super.spatialReference}set spatialReference(e){super.spatialReference=e}get spatialReferenceLocked(){return this._get("spatialReferenceLocked")}set spatialReferenceLocked(e){this.stage&&a.getLogger(this).warn("spatialReferenceLocked cannot be changed after the view has become ready"),this._set("spatialReferenceLocked",e)}get tileInfo(){return this.featuresTilingScheme?.tileInfo}get updating(){const e=!(!this.magnifier.visible||null===this.magnifier.position||!this._magnifierView?.updatingHandles.updating),t=!this.destroyed&&(!this.analysisViewManager||!this.layerViewManager||!this.labelManager||!this.graphicsView||!0===this.analysisViewManager.updating||!0===this.layerViewManager.updating||!0===this.labelManager.updating||!0===this.graphicsView.updating||this.allLayerViews.some(e=>!e.destroyed&&!("layerViews"in e)&&!0===e.updating)||e);if(has("esri-2d-log-updating")){const i=this.allLayerViews.reduce((e,t)=>({...e,[`${t.layer.id}(${t.layer.type})`]:!t.destroyed&&!("layerViews"in t)&&t.updating}),{});console.log(`Updating MapView: ${t}\n-> Null LayerViewManager: ${!this.layerViewManager}\n-> Null LabelManager: ${!this.labelManager}\n-> Null GraphicsView: ${!this.graphicsView}\n-> layerViewManager.updating: ${this.layerViewManager?.updating}\n-> labelManager.updating: ${this.labelManager?.updating}\n-> graphicsView.updating: ${this.graphicsView?.updating}\n-> allLayerViews: ${JSON.stringify(i)}\n-> updatingMagnifier: ${e}\n`)}return t}get viewpoint(){return super.viewpoint}set viewpoint(e){super.viewpoint=e}get visibleArea(){const e=this.stateManager.visibleArea;return e?new m({rings:[e.map(e=>[e[0],e[1]])],spatialReference:this.spatialReference}):e}get zoom(){return this.stateManager.zoom??-1}set zoom(e){this.stateManager.zoom=e}get navigating(){return this.mapViewNavigation?.interacting??!1}async hitTest(e,t){return E(this,e,t)}async takeScreenshot(e){return G(this._getScreenshotView(e),e)}toScreen(e,t){return this.stateManager.toScreen(e,t)}async whenAnalysisView(e){if(null==e.parent)throw new s("view:no-analysisview-for-analysis","The analysis does not exist in view.analyses",{analysis:e});return this.analysisViewManager.whenAnalysisView(e)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties.spatialReference||this.defaultsFromMap?.spatialReference||null}getDefaultTimeZone(){return Z(this.map)?this.map.initialViewProperties.timeZone:null}getDefaultTimeExtent(){return Z(this.map)?this.map.initialViewProperties.timeExtent:null}hasLayerViewModule(e){return L.hasLayerViewModule(e)}importLayerView(e){return L.importLayerView(e)}pixelSizeAt(){return this.ready?this.resolution:(a.getLogger(this).error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}async popupHitTest(e){const t=this.toMap(e),i=await this.hitTest(e),r=this.allLayerViews.toArray().filter(i=>i.clips.every(i=>D(this,i,e,t))).reverse(),s=new globalThis.Map(r.map(e=>[e.layer.uid,e])),a=[];let n=0,o=0;for(;n<i.results.length||o<r.length;){const e=i.results.at(n);if(e&&"graphic"!==e.type){++n;continue}const l=s.get((e?.layer??e?.graphic.layer)?.uid);if((!e||l)&&o<r.length&&r.at(o)!==l){const e=r.at(o);"fetchPopupFeaturesAtLocation"in e&&a.push({mapPoint:t,layerView:e}),++o}else e&&(a.push({graphic:e.graphic,layerView:l}),++n)}return{hits:a,location:t}}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}async validate(){let e=$(this.type);if(has("safari")&&has("safari")<9&&(e=new s("mapview:browser-not-supported","This browser is not supported by MapView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:has("safari")})),null!=e){a.getLogger(this).warn("#validate()",e.message);const t=document.createElement("div");t.setAttribute("style","display: flex; flex-direction: column; gap: 8px; padding: 20px; height: 100%; justify-content: center; color: black; background: white; font-family: sans-serif;");const i=document.createElement("div");i.innerHTML="Unable to display map. WebGL2 support is required.",i.setAttribute("style","font-size: 24px; font-weight: bold;");const r=document.createElement("div");r.innerHTML="Ensure that your browser and hardware meet the minimum requirements.",r.setAttribute("style","font-size: 18px;");const s=document.createElement("a");throw s.innerHTML="https://esriurl.com/systemRequirements",s.target="_blank",s.setAttribute("style","font-size: 18px;"),s.href="https://esriurl.com/systemRequirements",t.appendChild(i),t.appendChild(r),t.appendChild(s),this.surface.appendChild(t),e}}loadAsyncDependencies(){return re()}_getDefaultViewpoint(){const{constraints:e,initialExtent:i,map:r,padding:s,size:a}=this;if(!e)return null;const n=r&&"initialViewProperties"in r?r.initialViewProperties:void 0,o=this.stateManager.getUserStartupOptions(this.size),l=n?.viewpoint,p=l?.targetGeometry?.extent??i,h=p?.center,g=l?.rotation??0,d=l?.scale||p&&O(p,[a[0]-s.left-s.right,a[1]-s.top-s.bottom]),c=o.center??h,u=o.rotation??g,m=o.scale??d;return c&&m?new t({targetGeometry:c,scale:m,rotation:u}):null}_startup(){this.timeline.begin("MapView Startup");const e=this._getDefaultViewpoint();this.stateManager.startup(e,this.size,this.spatialReference,this.defaultsFromMap.extent?.center),this.graphics.owner=this;const t=new C(this.surface),i=new K(this.surface,{canvas:this.renderCanvas,contextOptions:new B(this.deactivatedWebGLExtensions,this.debugWebGLExtensions),renderingOptions:this.renderingOptions,timeline:this.timeline},t);this.stage=i,this._magnifierView=new te,this._magnifierView.magnifier=this.magnifier,this._gridView=new ie;const r=new Y({view:this});this._set("labelManager",r);const s=new R({view:this});this._set("animationManager",s);const a=new ee({view:this,animationManager:s});this._set("mapViewNavigation",a),this._setupSpatialReferenceDependentProperties(),this.addHandles([this.rootLayerViews.on("change",()=>this._updateStageChildren()),i.on("webgl-error",e=>this.fatalError=e.error),o(()=>this.stationary,e=>i.stationary=e,l),o(()=>this.background,e=>{i.backgroundColor=e?.color,this._magnifierView.backgroundColor=e?.color},l),o(()=>this.magnifier,e=>this._magnifierView.magnifier=e,l),o(()=>this.grid,e=>this._gridView.grid=e,l),o(()=>this.renderingOptions,e=>i.renderingOptions=e,l),o(()=>this.highlights.items.map(e=>({name:e.name,options:{fillColor:e.color,haloColor:e.haloColor,fillOpacity:e.fillOpacity,haloOpacity:e.haloOpacity,haloWidth:e.haloWidth,haloBlur:e.haloBlur}})),()=>{i.highlightGradient=x(i.highlightGradient,this.highlights.items)},l),o(()=>this.state.id,()=>i.state=this.state,l)],"map-view"),this._updateStageChildren();const n=this._resolveWhenReady;this._resolveWhenReady=[],n.forEach(e=>e(this)),this.timeline.end("MapView Startup"),this.frameTask.start(),this._set("ready",!0)}_teardown(){this._destroySpatialReferenceDependentProperties(),this.removeHandles("map-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animation=null,this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this.labelManager.destroy(),this._magnifierView.destroy(),this._gridView.destroy(),this.stage.destroy(),this.stage=null,this._set("graphicsView",null),this._magnifierView=null,this._gridView=null,this._set("labelManager",null),this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask.stop(),this.stationaryManager.clear(),this._set("ready",!1),this.stateManager.teardown()}_updateStageChildren(){this.stage.removeAllChildren(),this.rootLayerViews.forEach(e=>{this.stage.addChild(e.container)});const e=this.graphicsView;this.stage.addChild(e.container),this.stage.addChild(this._magnifierView),this.stage.addChild(this._gridView)}_setupSpatialReferenceDependentProperties(){const e=new S(f.create({spatialReference:this.spatialReference,size:512,numLODs:36}));this._set("featuresTilingScheme",e);const t=new Q({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new X(e)});this._set("graphicsView",t)}_destroySpatialReferenceDependentProperties(){const e=this.graphicsView;this._set("graphicsView",null),e.destroy(),this._set("featuresTilingScheme",null)}_getScreenshotView(e){const{allLayerViews:t,padding:i,size:r,stage:s}=this;return{allLayerViews:t,backgroundColor:e?.ignoreBackground?null:this.background?.color,padding:i,size:r,stage:s}}_spatialReferenceChanged(e){if(this.ready){this.frameTask.stop();for(const e of this.allLayerViews)e.processDetach();this._destroySpatialReferenceDependentProperties(),this.stateManager.changeSpatialReference(e),this.stage.state=this.state,this._setupSpatialReferenceDependentProperties();for(const e of this.allLayerViews)e.processAttach();this.frameTask.requestFrame(),this.frameTask.start(),this._updateStageChildren()}}static{this.type="2d"}};e([h({constructOnly:!0})],se.prototype,"deactivatedWebGLExtensions",void 0),e([h({constructOnly:!0})],se.prototype,"debugWebGLExtensions",void 0),e([h({readOnly:!0})],se.prototype,"featuresTilingScheme",void 0),e([h({readOnly:!0})],se.prototype,"graphicsTileStore",null),e([h()],se.prototype,"graphicsView",void 0),e([h()],se.prototype,"constraintsInfo",null),e([h()],se.prototype,"initialExtentRequired",null),e([h()],se.prototype,"labelManager",void 0),e([h({type:q,nonNullable:!0})],se.prototype,"navigation",void 0),e([h({constructOnly:!0})],se.prototype,"renderCanvas",void 0),e([h()],se.prototype,"renderingOptions",void 0),e([h({constructOnly:!0})],se.prototype,"supersampleScreenshotsEnabled",void 0),e([h({readOnly:!0})],se.prototype,"supportsGround",void 0),e([h()],se.prototype,"defaultsFromMapSettings",null),e([h({readOnly:!0})],se.prototype,"typeSpecificPreconditionsReady",null),e([h(u(w,"analyses"))],se.prototype,"analyses",void 0),e([h()],se.prototype,"analysisViewManager",void 0),e([h({type:J})],se.prototype,"background",null),e([h()],se.prototype,"center",null),e([h({type:i})],se.prototype,"floors",void 0),e([h()],se.prototype,"grid",void 0),e([h({type:W})],se.prototype,"highlightOptions",null),e([h()],se.prototype,"map",void 0),e([h()],se.prototype,"padding",null),e([h({readOnly:!0})],se.prototype,"rendering",null),e([h({readOnly:!0})],se.prototype,"resolution",null),e([h()],se.prototype,"scale",null),e([h({type:Boolean,value:!1})],se.prototype,"spatialReferenceLocked",null),e([h({readOnly:!0})],se.prototype,"tileInfo",null),e([h({type:U,readOnly:!0})],se.prototype,"timeline",void 0),e([h({readOnly:!0})],se.prototype,"type",void 0),e([h({readOnly:!0})],se.prototype,"updating",null),e([h({readOnly:!0})],se.prototype,"view2dType",void 0),e([h({readOnly:!0})],se.prototype,"visibleArea",null),e([h()],se.prototype,"zoom",null),e([h({readOnly:!0})],se.prototype,"navigating",null),e([h(),g(e=>e instanceof F?e:c(H,e))],se.prototype,"ui",void 0),se=e([d("esri.views.View2D")],se);const ae=se;export{ae as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../Viewpoint.js";import i from"../core/Collection.js";import r from"../core/CollectionFlattener.js";import s from"../core/Error.js";import has from"../core/has.js";import a from"../core/Logger.js";import{destroyMaybe as n}from"../core/maybe.js";import{watch as o,syncAndInitial as l}from"../core/reactiveUtils.js";import{initialize as p}from"../core/workers/workers.js";import{property as h}from"../core/accessorSupport/decorators/property.js";import{cast as g}from"../core/accessorSupport/decorators/cast.js";import"../core/RandomLCG.js";import{subclass as d}from"../core/accessorSupport/decorators/subclass.js";import{ensureClass as c}from"../core/accessorSupport/ensureType.js";import{owningCollectionProperty as u}from"../core/support/OwningCollection.js";import m from"../geometry/Polygon.js";import{isLoadedOrLoadFor as y}from"../geometry/projectionUtils.js";import f from"../layers/support/TileInfo.js";import{AnalysesCollection as w}from"../support/AnalysesCollection.js";import{BreakpointsOwner as V}from"./BreakpointsOwner.js";import{DOMContainer as M}from"./DOMContainer.js";import{PopupView as v}from"./PopupView.js";import b from"./View.js";import{Viewport2DBaseMixin as _}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as j}from"./Viewport2DMixin.js";import R from"./2d/AnimationManager.js";import{layerView2DImporter as L}from"./2d/layerViewModuleImportUtils.js";import S from"./2d/tiling/TileInfoView.js";import"./2d/tiling/TileKey.js";import"./2d/tiling/TileQueue.js";import"./2d/tiling/TileStrategy.js";import{extentToScale as O}from"./2d/viewpointUtils.js";import{importAnalysisViewModule as T}from"./2d/analysis/analysisViewModuleImportUtils.js";import{ManagedCanvas as C}from"./2d/engine/ManagedCanvas.js";import k from"./2d/layers/features/support/TileStore.js";import{createOrReuseHighlightGradient as x}from"./2d/layers/support/util.js";import{clipContainsPoint as D}from"./2d/support/clippingUtils.js";import{getDefaultHighlightOptions as A,setDefaultHighlightOptions as P}from"./2d/support/highlightOptionsUtils.js";import{hitTest as E}from"./2d/support/hitTestUtils.js";import{takeRawScreenshot as z,takeScreenshot as U}from"./2d/support/screenshotUtils.js";import{Timeline as G}from"./2d/support/Timeline.js";import q from"./navigation/Navigation.js";import I from"./navigation/NavigationActionMap.js";import N from"./support/AnalysisViewManager.js";import W from"./support/HighlightOptions.js";import{check as $}from"./support/WebGLRequirements.js";import F from"./ui/DefaultUI.js";import H from"./ui/2d/DefaultUI2D.js";import{RenderingContextOptions as B}from"./webgl/RenderingContextOptions.js";import{isWebMap as Z}from"../webmap/utils.js";import J from"../webmap/background/ColorBackground.js";let K,Q,X,Y,ee,te,ie;async function re(){const[,{GraphicsView2D:e,GraphicContainer:t,LabelManager:i,MapViewNavigation:r,MagnifierView2D:s,GridView2D:a,Stage:n}]=await Promise.all([import("./2d/webglDeps.js"),import("./2d/mapViewDeps.js")]);Q=e,X=t,Y=i,ee=r,te=s,ie=a,K=n}let se=class extends(j(_(V(v(M(b)))))){get timeZone(){return super.timeZone}set timeZone(e){super.timeZone=e}constructor(e){super(e),this._magnifierView=null,this._gridView=null,this.stage=null,this._resolveWhenReady=[],this.rootLayerViews=new r({getCollections:()=>[this.basemapView?.baseLayerViews,this.layerViews,this.basemapView?.referenceLayerViews],getChildrenFunction:()=>null}),this.featuresTilingScheme=null,this.graphicsView=null,this.labelManager=null,this.navigation=new q({actionMap:new I({dragTertiary:"none"})}),this.renderingOptions={samplingMode:"dynamic",edgeLabelsVisible:!0,labelsAnimationTime:125,labelCollisionsEnabled:!0},this.supersampleScreenshotsEnabled=!0,this.analyses=new w,this.analysisViewManager=new N({importAnalysisViewModule:e=>T(e),view:this}),this.floors=new i,this.grid=null,this.map=null,this.timeline=new G,this.type="2d",this.view2dType=null,this.ui=new H,this.test={takeScreenshot:async e=>z(this._getScreenshotView(e),e)},this.padding={top:0,right:0,bottom:0,left:0},p()}destroy(){this.layerViewManager.clear(),this._set("preconditionsReady",!1),this.frameTask=n(this.frameTask),this.goToManager.destroy(),this.rootLayerViews.destroy(),this.inputManager.destroy(),this._set("inputManager",null)}get graphicsTileStore(){return new k(this.featuresTilingScheme)}get constraintsInfo(){const e=this.defaultsFromMap?.tileInfo,t=this.spatialReference;return{lods:e?.spatialReference?.equals(t)?e.lods:null,spatialReference:t}}get initialExtentRequired(){if(!this.stateManager)return!1;const{scale:e,constraints:t,center:i,viewpoint:r,extent:s}=this;let a=this.zoom;return!(this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties?.viewpoint)&&(!s&&(t?.effectiveLODs||(a=-1),(!i||0===e&&-1===a)&&(null==r?.targetGeometry||"extent"!==r.targetGeometry.type&&!r.scale)))}get defaultsFromMapSettings(){return{required:{extent:!1,heightModelInfo:!1,tileInfo:!0},requiresExtentInSpatialReference:this.spatialReferenceLocked}}get scheduler(){return this.frameTask.scheduler}get typeSpecificPreconditionsReady(){const e=this._getDefaultViewpoint();if(!e)return!1;const t=e.targetGeometry,i=this.spatialReference;return y(t.spatialReference,i)}get background(){return Z(this.map)?this.map.initialViewProperties.background:null}set background(e){this._override("background",e)}get center(){return this.stateManager?.center??null}set center(e){this.stateManager.center=e}get constraints(){return super.constraints}set constraints(e){super.constraints=e}get highlightOptions(){return A(this)}set highlightOptions(e){P(this,e)}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get rendering(){return this.stage?.renderRequested??!1}get resizeAlign(){return super.resizeAlign}set resizeAlign(e){super.resizeAlign=e}get resolution(){return this.stateManager.resolution??0}get rotation(){return super.rotation}set rotation(e){super.rotation=e}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get spatialReference(){return super.spatialReference}set spatialReference(e){super.spatialReference=e}get spatialReferenceLocked(){return this._get("spatialReferenceLocked")}set spatialReferenceLocked(e){this.stage&&a.getLogger(this).warn("spatialReferenceLocked cannot be changed after the view has become ready"),this._set("spatialReferenceLocked",e)}get tileInfo(){return this.featuresTilingScheme?.tileInfo}get updating(){const e=!(!this.magnifier.visible||null===this.magnifier.position||!this._magnifierView?.updatingHandles.updating),t=!this.destroyed&&(!this.analysisViewManager||!this.layerViewManager||!this.labelManager||!this.graphicsView||!0===this.analysisViewManager.updating||!0===this.layerViewManager.updating||!0===this.labelManager.updating||!0===this.graphicsView.updating||this.allLayerViews.some(e=>!e.destroyed&&!("layerViews"in e)&&!0===e.updating)||e);if(has("esri-2d-log-updating")){const i=this.allLayerViews.reduce((e,t)=>({...e,[`${t.layer.id}(${t.layer.type})`]:!t.destroyed&&!("layerViews"in t)&&t.updating}),{});console.log(`Updating MapView: ${t}\n-> Null LayerViewManager: ${!this.layerViewManager}\n-> Null LabelManager: ${!this.labelManager}\n-> Null GraphicsView: ${!this.graphicsView}\n-> layerViewManager.updating: ${this.layerViewManager?.updating}\n-> labelManager.updating: ${this.labelManager?.updating}\n-> graphicsView.updating: ${this.graphicsView?.updating}\n-> allLayerViews: ${JSON.stringify(i)}\n-> updatingMagnifier: ${e}\n`)}return t}get viewpoint(){return super.viewpoint}set viewpoint(e){super.viewpoint=e}get visibleArea(){const e=this.stateManager.visibleArea;return e?new m({rings:[e.map(e=>[e[0],e[1]])],spatialReference:this.spatialReference}):e}get zoom(){return this.stateManager.zoom??-1}set zoom(e){this.stateManager.zoom=e}get navigating(){return this.mapViewNavigation?.interacting??!1}async hitTest(e,t){return E(this,e,t)}async takeScreenshot(e){return U(this._getScreenshotView(e),e)}toScreen(e,t){return this.stateManager.toScreen(e,t)}async whenAnalysisView(e){if(null==e.parent)throw new s("view:no-analysisview-for-analysis","The analysis does not exist in view.analyses",{analysis:e});return this.analysisViewManager.whenAnalysisView(e)}whenLayerView(e){return super.whenLayerView(e)}graphicChanged(e){if(this.graphicsView){this.graphicsView.graphicUpdateHandler(e)}}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}forceDOMReadyCycle(){this.forceReadyCycle()}getDefaultSpatialReference(){return this.map&&"initialViewProperties"in this.map&&this.map.initialViewProperties.spatialReference||this.defaultsFromMap?.spatialReference||null}getDefaultTimeZone(){return Z(this.map)?this.map.initialViewProperties.timeZone:null}getDefaultTimeExtent(){return Z(this.map)?this.map.initialViewProperties.timeExtent:null}hasLayerViewModule(e){return L.hasLayerViewModule(e)}importLayerView(e){return L.importLayerView(e)}pixelSizeAt(){return this.ready?this.resolution:(a.getLogger(this).error("#pixelSizeAt()","Map view cannot be used before it is ready"),null)}async popupHitTest(e){const t=this.toMap(e),i=await this.hitTest(e),r=this.allLayerViews.toArray().filter(i=>i.clips.every(i=>D(this,i,e,t))).reverse(),s=new globalThis.Map(r.map(e=>[e.layer.uid,e])),a=[];let n=0,o=0;for(;n<i.results.length||o<r.length;){const e=i.results.at(n);if(e&&"graphic"!==e.type){++n;continue}const l=s.get((e?.layer??e?.graphic.layer)?.uid);if((!e||l)&&o<r.length&&r.at(o)!==l){const e=r.at(o);"fetchPopupFeaturesAtLocation"in e&&a.push({mapPoint:t,layerView:e}),++o}else e&&(a.push({graphic:e.graphic,layerView:l}),++n)}return{hits:a,location:t}}requestUpdate(){this.ready&&this.frameTask.requestUpdate()}async validate(){let e=$(this.type);if(has("safari")&&has("safari")<9&&(e=new s("mapview:browser-not-supported","This browser is not supported by MapView (Safari < 9)",{type:"safari",requiredVersion:9,detectedVersion:has("safari")})),null!=e){a.getLogger(this).warn("#validate()",e.message);const t=document.createElement("div");t.setAttribute("style","display: flex; flex-direction: column; gap: 8px; padding: 20px; height: 100%; justify-content: center; color: black; background: white; font-family: sans-serif;");const i=document.createElement("div");i.innerHTML="Unable to display map. WebGL2 support is required.",i.setAttribute("style","font-size: 24px; font-weight: bold;");const r=document.createElement("div");r.innerHTML="Ensure that your browser and hardware meet the minimum requirements.",r.setAttribute("style","font-size: 18px;");const s=document.createElement("a");throw s.innerHTML="https://esriurl.com/systemRequirements",s.target="_blank",s.setAttribute("style","font-size: 18px;"),s.href="https://esriurl.com/systemRequirements",t.appendChild(i),t.appendChild(r),t.appendChild(s),this.surface.appendChild(t),e}}loadAsyncDependencies(){return re()}_getDefaultViewpoint(){const{constraints:e,initialExtent:i,map:r,padding:s,size:a}=this;if(!e)return null;const n=r&&"initialViewProperties"in r?r.initialViewProperties:void 0,o=this.stateManager.getUserStartupOptions(this.size),l=n?.viewpoint,p=l?.targetGeometry?.extent??i,h=p?.center,g=l?.rotation??0,d=l?.scale||p&&O(p,[a[0]-s.left-s.right,a[1]-s.top-s.bottom]),c=o.center??h,u=o.rotation??g,m=o.scale??d;return c&&m?new t({targetGeometry:c,scale:m,rotation:u}):null}_startup(){this.timeline.begin("MapView Startup");const e=this._getDefaultViewpoint();this.stateManager.startup(e,this.size,this.spatialReference,this.defaultsFromMap.extent?.center),this.graphics.owner=this;const t=new C(this.surface),i=new K(this.surface,{canvas:this.renderCanvas,contextOptions:new B(this.deactivatedWebGLExtensions,this.debugWebGLExtensions),renderingOptions:this.renderingOptions,timeline:this.timeline},t);this.stage=i,this._magnifierView=new te,this._magnifierView.magnifier=this.magnifier,this._gridView=new ie;const r=new Y({view:this});this._set("labelManager",r);const s=new R({view:this});this._set("animationManager",s);const a=new ee({view:this,animationManager:s});this._set("mapViewNavigation",a),this._setupSpatialReferenceDependentProperties(),this.addHandles([this.rootLayerViews.on("change",()=>this._updateStageChildren()),i.on("webgl-error",e=>this.fatalError=e.error),o(()=>this.stationary,e=>i.stationary=e,l),o(()=>this.background,e=>{i.backgroundColor=e?.color,this._magnifierView.backgroundColor=e?.color},l),o(()=>this.magnifier,e=>this._magnifierView.magnifier=e,l),o(()=>this.grid,e=>this._gridView.grid=e,l),o(()=>this.renderingOptions,e=>i.renderingOptions=e,l),o(()=>this.highlights.items.map(e=>({name:e.name,options:{fillColor:e.color,haloColor:e.haloColor,fillOpacity:e.fillOpacity,haloOpacity:e.haloOpacity,haloWidth:e.haloWidth,haloBlur:e.haloBlur}})),()=>{i.highlightGradient=x(i.highlightGradient,this.highlights.items)},l),o(()=>this.state.id,()=>i.state=this.state,l)],"map-view"),this._updateStageChildren();const n=this._resolveWhenReady;this._resolveWhenReady=[],n.forEach(e=>e(this)),this.timeline.end("MapView Startup"),this.frameTask.start(),this._set("ready",!0)}_teardown(){this._destroySpatialReferenceDependentProperties(),this.removeHandles("map-view"),this.mapViewNavigation.destroy(),this._set("mapViewNavigation",null),this.animation=null,this.animationManager.destroy(),this._set("animationManager",null),this.layerViewManager.clear(),this.labelManager.destroy(),this._magnifierView.destroy(),this._gridView.destroy(),this.stage.destroy(),this.stage=null,this._set("graphicsView",null),this._magnifierView=null,this._gridView=null,this._set("labelManager",null),this._set("mapViewNavigation",null),this.graphics.owner=null,this.frameTask.stop(),this.stationaryManager.clear(),this._set("ready",!1),this.stateManager.teardown()}_updateStageChildren(){this.stage.removeAllChildren(),this.rootLayerViews.forEach(e=>{this.stage.addChild(e.container)});const e=this.graphicsView;this.stage.addChild(e.container),this.stage.addChild(this._magnifierView),this.stage.addChild(this._gridView)}_setupSpatialReferenceDependentProperties(){const e=new S(f.create({spatialReference:this.spatialReference,size:512,numLODs:36}));this._set("featuresTilingScheme",e);const t=new Q({view:this,graphics:this.graphics,requestUpdateCallback:()=>this.requestUpdate(),container:new X(e)});this._set("graphicsView",t)}_destroySpatialReferenceDependentProperties(){const e=this.graphicsView;this._set("graphicsView",null),e.destroy(),this._set("featuresTilingScheme",null)}_getScreenshotView(e){const{allLayerViews:t,padding:i,size:r,stage:s}=this;return{allLayerViews:t,backgroundColor:e?.ignoreBackground?null:this.background?.color,padding:i,size:r,stage:s}}_spatialReferenceChanged(e){if(this.ready){this.frameTask.stop();for(const e of this.allLayerViews)e.processDetach();this._destroySpatialReferenceDependentProperties(),this.stateManager.changeSpatialReference(e),this.stage.state=this.state,this._setupSpatialReferenceDependentProperties();for(const e of this.allLayerViews)e.processAttach();this.frameTask.requestFrame(),this.frameTask.start(),this._updateStageChildren()}}static{this.type="2d"}};e([h({constructOnly:!0})],se.prototype,"deactivatedWebGLExtensions",void 0),e([h({constructOnly:!0})],se.prototype,"debugWebGLExtensions",void 0),e([h({readOnly:!0})],se.prototype,"featuresTilingScheme",void 0),e([h({readOnly:!0})],se.prototype,"graphicsTileStore",null),e([h()],se.prototype,"graphicsView",void 0),e([h()],se.prototype,"constraintsInfo",null),e([h()],se.prototype,"initialExtentRequired",null),e([h()],se.prototype,"labelManager",void 0),e([h({type:q,nonNullable:!0})],se.prototype,"navigation",void 0),e([h({constructOnly:!0})],se.prototype,"renderCanvas",void 0),e([h()],se.prototype,"renderingOptions",void 0),e([h({constructOnly:!0})],se.prototype,"supersampleScreenshotsEnabled",void 0),e([h()],se.prototype,"defaultsFromMapSettings",null),e([h({readOnly:!0})],se.prototype,"typeSpecificPreconditionsReady",null),e([h(u(w,"analyses"))],se.prototype,"analyses",void 0),e([h()],se.prototype,"analysisViewManager",void 0),e([h({type:J})],se.prototype,"background",null),e([h()],se.prototype,"center",null),e([h({type:i})],se.prototype,"floors",void 0),e([h()],se.prototype,"grid",void 0),e([h({type:W})],se.prototype,"highlightOptions",null),e([h()],se.prototype,"map",void 0),e([h()],se.prototype,"padding",null),e([h({readOnly:!0})],se.prototype,"rendering",null),e([h({readOnly:!0})],se.prototype,"resolution",null),e([h()],se.prototype,"scale",null),e([h({type:Boolean,value:!1})],se.prototype,"spatialReferenceLocked",null),e([h({readOnly:!0})],se.prototype,"tileInfo",null),e([h({type:G,readOnly:!0})],se.prototype,"timeline",void 0),e([h({readOnly:!0})],se.prototype,"type",void 0),e([h({readOnly:!0})],se.prototype,"updating",null),e([h({readOnly:!0})],se.prototype,"view2dType",void 0),e([h({readOnly:!0})],se.prototype,"visibleArea",null),e([h()],se.prototype,"zoom",null),e([h({readOnly:!0})],se.prototype,"navigating",null),e([h(),g(e=>e instanceof F?e:c(H,e))],se.prototype,"ui",void 0),se=e([d("esri.views.View2D")],se);const ae=se;export{ae as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{R as e,D as i}from"../../../chunks/ResponsiveTheme.js";import"../../../intl.js";import s from"../../../core/Accessor.js";import{createTask as o}from"../../../core/asyncUtils.js";import{makeHandle as n,handlesGroup as r}from"../../../core/handleUtils.js";import"../../../core/has.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{watch as l}from"../../../core/reactiveUtils.js";import{formatDecimal as p,unitName as c}from"../../../core/unitFormatUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{getEpsilon as u}from"../../../core/libs/gl-matrix-2/math/common.js";import{isDarkMode as m}from"../../../support/modeUtils.js";import{getConfig as f,notAvailable as g}from"./constants.js";import{getAdjustedBounds as x}from"./elevationProfileChartBoundsUtils.js";import{themeLight as _,themeDark as y}from"./elevationProfileChartTheme.js";import{binaryFindClosest as v}from"./elevationProfileGenerationUtils.js";import{isInputSketched as A}from"./elevationProfileGeometryUtils.js";import{c as T,N as b}from"../../../chunks/chartUtilsAm5.js";import{fetchMessageBundle as S}from"../../../intl/messages.js";import{X as L,a as w,V as P,A as F,b as M,L as C}from"../../../chunks/LineSeries.js";import{b as j,d as k,a as z,C as I}from"../../../chunks/Theme.js";import{T as X}from"../../../chunks/Tooltip.js";import{substitute as D}from"../../../intl/substitute.js";import{formatNumber as H}from"../../../intl/number.js";let V=class extends s{get chartVisible(){const t=this._chartData;if(null==t)return!1;if(!A(this.analysisView?.analysis))return t.refined;let e=0;for(const{samples:i}of t.lines)e+=i?.length??0;return t.refined||e<=f().largeChartSamples}get spinnerVisible(){return null!=this._chartData&&(this.analysisView?.progress??0)<1}get _chartData(){const{analysisView:t,messages:e,_unitsMessages:i,uniformScaling:s}=this,o=!!this.view?.stationary,n=this._lineData;if(n&&this._hasInput&&t&&e&&i&&o)return{lines:n,effectiveUnits:t.effectiveUnits,statistics:t.statistics,refined:1===t.progress,dynamicElevationRange:t.analysis.profiles.some(t=>"scene"===t.type),uniformScaling:s,messages:e,unitsMessages:i}}get _hasInput(){return null!=this.analysisView?.analysis.input}get _lineData(){const{analysisView:t}=this;if(!t)return;const{analysis:e,results:i}=t,{profiles:s}=e;if(i.length!==s.length)return;const o=[];for(let n=0;n<s.length;n++){const t=s.at(n),e=i.at(n);if(!e.available||!e.rawResult?.hasZ||!t.chartOptions.lineVisible)continue;const r="input"!==t.type;o.push({id:t.id,type:t.type,title:t.title,color:t.color,samples:e.samples,fillEnabled:r,strokeOffsetY:r?-1:0,strokeWidth:1.5})}return o}constructor(t){super(t),this.view=null,this.analysisView=null,this.messages=null,this.uniformScaling=!1,this._theme=_,this._data=null,this._seriesInfos=new Map,this._pointerIsOver=!1,this._rtl=!1,this._chartInfo=null,this._unitsMessages=null}initialize(){this.addHandles(o(t=>this._initializeChart(t)))}destroy(){this._chartInfo=null,this._seriesInfos.clear(),this._data=null}zoomOut(){this._chartInfo?.xAxis.zoom(0,1),this._chartInfo?.yAxis.zoom(0,1)}async _initializeChart(t){const[s,o]=await Promise.all([T(this.container),S("esri/core/t9n/Units")]);a(t);const n=$(this.container),r=m(this.container),p=r?y:_;s.setThemes(r?[e.new(s),i.new(s)]:[e.new(s)]),this._rtl=n,this._theme=p,this._unitsMessages=o;const c=s.container.children.push(L.new(s,{panX:!0,panY:!0,paddingTop:p.paddingTop,paddingBottom:p.paddingBottom,paddingLeft:n?p.paddingRight:p.paddingLeft,paddingRight:n?p.paddingLeft:p.paddingRight,maxTooltipDistance:-1}));c.zoomOutButton.set("forceHidden",!0);const d=c.xAxes.push(this._createXAxis(s)),h=c.yAxes.push(this._createYAxis(s));this._chartInfo={chart:c,xAxis:d,yAxis:h};const u=w.new(c.root,{behavior:"none",xAxis:d,yAxis:h,snapToSeriesBy:"y"});u.lineY.set("visible",!1),c.set("cursor",u),this._initializeTest(c),this.addHandles([this._setupZoomHandling(),this._setupCursorHandling(),q(s),l(()=>this._chartData,this._update.bind(this))]),this._update(this._chartData)}_initializeTest(t){}_update(t){if(!t)return;const e=this._data;this._chartInfo?.chart.get("cursor")?.set("forceHidden",!t?.refined);const i=e?.uniformScaling!==t?.uniformScaling;this._data=t,this._updateAxes(),this._updateSeries(),i&&this.zoomOut(),this._updateTooltips()}_createXAxis(t){const e=this._theme,i=P.new(t,{renderer:F.new(t,{})});i.setAll({extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:this._makeFormatter(t,"distance"),strictMinMax:!0,strictMinMaxSelection:!0}),i.axisHeader.set("forceHidden",!0);const s=i.get("renderer");s.setAll({inside:!1,minGridDistance:e.xAxisMinGridDistance}),s.labels.template.setAll({centerX:k,centerY:k,fill:j(e.axisLabelsColor),fontFamily:e.fontFamily,fontSize:e.axisLabelsFontSize,fontWeight:e.axisLabelsFontWeight,maxPosition:e.xAxisMaxLabelPosition,minPosition:e.xAxisMinLabelPosition,paddingLeft:0,paddingRight:0,paddingTop:e.xAxisLabelsSpacing});const o=i.set("tooltip",X.new(t,{paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0}));return o.get("background")?.setAll({fill:j(e.axisTooltipBackgroundColor),stroke:void 0}),o.label.setAll({fill:j(e.axisTooltipLabelColor),fontFamily:e.fontFamily,fontSize:e.axisTooltipFontSize,paddingBottom:e.axisTooltipPaddingBottom,paddingLeft:e.axisTooltipPaddingHorizontal,paddingRight:e.axisTooltipPaddingHorizontal,paddingTop:e.axisTooltipPaddingTop,direction:this._rtl?"rtl":"ltr"}),s.grid.template.setAll({strokeOpacity:1,stroke:j(e.axisGridStroke)}),i}_createYAxis(t){const e=this._theme,i=this._rtl,s=P.new(t,{renderer:M.new(t,{})});s.setAll({baseValue:f().noDataValue,extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:this._makeFormatter(t,"elevation"),strictMinMax:!0,strictMinMaxSelection:!0,tooltip:void 0}),s.axisHeader.set("visible",!1);const o=s.get("renderer");return o.setAll({minGridDistance:e.yAxisMinGridDistance,opposite:i,inside:!0}),o.labels.template.setAll({centerX:k,centerY:z,fill:j(e.axisLabelsColor),fontFamily:e.fontFamily,fontSize:e.axisLabelsFontSize,fontWeight:e.axisLabelsFontWeight,maxPosition:e.yAxisMaxLabelPosition,minPosition:e.yAxisMinLabelPosition,paddingBottom:0,paddingLeft:i?0:e.yAxisLabelSpacing,paddingRight:i?e.yAxisLabelSpacing:0,paddingTop:0,textAlign:"start"}),o.grid.template.setAll({strokeOpacity:1,stroke:j(e.axisGridStroke)}),s}_setupZoomHandling(){const t=this._chartInfo;if(!t)return n();const{xAxis:e,yAxis:i}=t,s=()=>{this.onRangeChange?.(O(e),O(i))},o=t=>[t.on("start",s),t.on("end",s)];return N([...o(e),...o(i)])}_setupCursorHandling(){const t=this._chartInfo;if(!t)return n();const{chart:e,xAxis:i,yAxis:s}=t,o=e.get("cursor"),r=e.plotContainer.events,a=t=>{this._pointerIsOver=t,this._updateTooltips()},l=()=>{a(!1),this.onCursorPositionChange?.(null,null)};return N([o?.events.on("cursormoved",()=>{if(!this._pointerIsOver)return;this._updateTooltips();let t=o?.getPrivate("positionX")??0,e=o?.getPrivate("positionY")??0;const n=this._data;if(null!=n?.statistics){const{maxDistance:o,minElevation:r,maxElevation:a}=n.statistics;let l,p;if(null!=o){1===O(i)?(l=0,p=o):(l=G(i),p=W(i)),t=B(t,l,p,0,o)}if(null!=r&&null!=a){1===O(s)?(l=r,p=a):(l=G(s),p=W(s)),e=B(e,l,p,r,a)}}this.onCursorPositionChange?.(t,e)}),r.on("pointerover",()=>a(!0)),r.on("pointerout",l),r.on("blur",l)])}_updateAxes(){const t=this._chartInfo;if(!t)return;const{chart:e,xAxis:i,yAxis:s}=t,o=this._data,{minX:n,maxX:r,minY:a,maxY:l}=x({data:o,pixelWidth:i.width(),pixelHeight:s.height()}),p=!!o?.uniformScaling,c=!!o?.refined;e.setAll({panX:!0,panY:p,pinchZoomX:c,pinchZoomY:c&&p,wheelX:"panX",wheelY:c?p?"zoomXY":"zoomX":"none"}),i.setAll({max:r,min:n,panX:!0,panY:!1,zoomX:!0,zoomY:p}),s.setAll({max:l,min:a,panX:!1,panY:p,zoomX:p,zoomY:p})}_updateSeries(){const t=this._seriesInfos,e=this._chartInfo;if(!e)return;const{chart:i,xAxis:s,yAxis:o}=e,n=this._data;if(!n||0===n.lines.length)return void i.series.clear();const r=new Map,a=new Set(i.series.values),l=n.lines.length;for(let p=0;p<l;p++){const s=n.lines[p];let o=t.get(s.id);o?(o.fill&&a.delete(o.fill),a.delete(o.line)):(o=Y(e,this._theme,this._rtl,s),o.fill&&i.series.push(o.fill),i.series.push(o.line)),r.set(o.id,o);const c=l-p-1;o.fill?.set("layer",c),o.line.set("layer",l+c),this._updateLineSeries(o,s)}this._seriesInfos=r;for(const p of a)i.series.removeValue(p);s.set("layer",l+1),o.set("layer",l+2)}_updateLineSeries(t,e){const i=j(e.color.toCss()),s=e.samples??[],o=s.length>0,{line:n,fill:r}=t;n.set("visible",o),n.set("stroke",i),r?.set("visible",o),r?.set("fill",I.lighten(i,this._theme.seriesFillLighten)),n.data.setAll(s),r?.data.setAll(s)}_updateTooltips(){const t=this._getSeriesTooltipText();t?(this._seriesInfos.forEach(e=>{const i=e.line.get("tooltip");i.set("forceHidden",!1),i.label.set("text",t)}),this._chartInfo?.xAxis.getTooltip()?.setAll({tooltipText:this._getAxisTooltipText()})):this._seriesInfos.forEach(t=>{t.line.get("tooltip")?.set("forceHidden",!0)})}_getSeriesTooltipText(){const t=this._data?.lines.map(t=>({line:t,y:this._getPointNearestToCursor(t)?.elevation})).sort(E);return t&&0!==t.length&&null!=t[0].y?t.map(({y:t,line:e})=>this._getTooltipTextForLine(e,t)).join("\n"):null}_getPointNearestToCursor(t){const e=t.samples??[];if(0===e.length)return null;const i=this._chartInfo;if(!i)return null;const{chart:s,xAxis:o}=i,n=s.get("cursor"),r=n?.getPrivate("positionX")??0,a=o.toAxisPosition(r),l=o.positionToValue(a);return v(e,l,t=>t.distance)}_getTooltipTextForLine(t,e){const i=this._data,s=this.messages,o=this._unitsMessages;if(!i||!s||!o)return"";const n=`[${t.color.toHex()}]●[/]`,r=" ",a=f().formatPrecision,l=D(s.chartTooltip,{name:Z(t,s),elevation:null!=e?p(o,e,i.effectiveUnits.elevation,a):g});return this._rtl?l+r+n:n+r+l}_getAxisTooltipText(){const t=this._data,e=this._unitsMessages;if(!t||!e)return"";const i=t.lines[0],s=i?this._getPointNearestToCursor(i):null,o=f().formatPrecision;return null!=s?p(e,s.distance,t.effectiveUnits.distance,o):"-"}_makeFormatter(t,e){const i=b.new(t,{});return i.format=(t,i,s)=>{const o=this._data,n=this._unitsMessages;if(!o||!n||"string"==typeof t)return"";return`${H(t,{maximumFractionDigits:s})} ${c(n,o.effectiveUnits[e],"abbr")}`},i}};function Y(t,e,i,s){const{id:o}=s,n=U(t,`line-${o}`),r=R(t,e,i);n.setAll({dy:s.strokeOffsetY,tooltip:r}),n.strokes.template.setAll({strokeWidth:s.strokeWidth});let a=null;return s.fillEnabled&&(a=U(t,`fill-${o}`),a.fills.template.setAll({fillOpacity:1,visible:!0})),{id:o,line:n,fill:a}}function U({chart:t,xAxis:e,yAxis:i},s){return C.new(t.root,{connect:!1,excludeFromTotal:!0,fill:void 0,id:s,stroke:void 0,valueXField:"distance",valueYField:"elevation",xAxis:e,yAxis:i})}function R({chart:t},e,i){const s=X.new(t.root,{autoTextColor:!1,forceHidden:!0,getFillFromSprite:!1,getLabelFillFromSprite:!1,pointerOrientation:"vertical",visible:!1}),o=e.seriesTooltipPaddingHorizontal,n=e.seriesTooltipPaddingVertical;return s.label.setAll({fill:j(e.seriesTooltipLabelColor),fontFamily:e.fontFamily,fontSize:e.seriesTooltipFontSize,paddingBottom:n,paddingLeft:o,paddingRight:o,paddingTop:n,textAlign:i?"end":"start",direction:"ltr"}),s.get("background")?.setAll({stroke:void 0,fill:j(e.seriesTooltipBackgroundColor)}),s.adapters.add("dy",t=>{const i=e.seriesTooltipSpacing,o=s.get("pointTo")?.y??0;return(t??0)+(s.y()>o?i:-i)}),s}function O(t){const e=Math.abs((t.get("end")??0)-(t.get("start")??0)),i=0!==e?1/e:1;return Math.abs(1-i)<u()?1:i}function B(t,e,i,s,o){return(e+t*(i-e)-s)/(o-s)}function E({y:t},{y:e}){return null==t?1:null==e?-1:e-t}function G(t){return t.positionToValue(t.get("start")??0)}function W(t){return t.positionToValue(t.get("end")??1)}function Z(t,e){const i=t.title;if(null!=i)return i;switch(t.type){case"ground":return e.profiles.ground;case"input":return e.profiles.input;case"query":return e.profiles.query;case"scene":return e.profiles.scene;default:return""}}function $(t){const e=t?.closest("[dir]");return null!==e&&e instanceof HTMLElement&&"rtl"===e.dir||"rtl"===document.dir}function N(t){return r(t.map(q))}function q(t){return n(()=>t?.dispose())}t([d()],V.prototype,"view",void 0),t([d()],V.prototype,"analysisView",void 0),t([d()],V.prototype,"container",void 0),t([d()],V.prototype,"messages",void 0),t([d()],V.prototype,"onRangeChange",void 0),t([d()],V.prototype,"onCursorPositionChange",void 0),t([d()],V.prototype,"uniformScaling",void 0),t([d()],V.prototype,"chartVisible",null),t([d()],V.prototype,"spinnerVisible",null),t([d()],V.prototype,"test",void 0),t([d()],V.prototype,"_theme",void 0),t([d()],V.prototype,"_data",void 0),t([d()],V.prototype,"_seriesInfos",void 0),t([d()],V.prototype,"_pointerIsOver",void 0),t([d()],V.prototype,"_rtl",void 0),t([d()],V.prototype,"_chartInfo",void 0),t([d()],V.prototype,"_unitsMessages",void 0),t([d()],V.prototype,"_chartData",null),t([d()],V.prototype,"_hasInput",null),t([d()],V.prototype,"_lineData",null),V=t([h("esri.views.analysis.ElevationProfile.ElevationProfileChart")],V);export{V as ElevationProfileChart};
|
|
5
|
+
import{__decorate as t}from"tslib";import{R as e,D as i}from"../../../chunks/ResponsiveTheme.js";import"../../../intl.js";import s from"../../../core/Accessor.js";import{createTask as o}from"../../../core/asyncUtils.js";import{makeHandle as n,handlesGroup as r}from"../../../core/handleUtils.js";import"../../../core/has.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{watch as l}from"../../../core/reactiveUtils.js";import{formatDecimal as p,unitName as c}from"../../../core/unitFormatUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import{getEpsilon as u}from"../../../core/libs/gl-matrix-2/math/common.js";import{isDarkMode as f}from"../../../support/modeUtils.js";import{getConfig as m,notAvailable as g}from"./constants.js";import{getAdjustedBounds as x}from"./elevationProfileChartBoundsUtils.js";import{themeLight as _,themeDark as y}from"./elevationProfileChartTheme.js";import{binaryFindClosest as v}from"./elevationProfileGenerationUtils.js";import{isInputSketched as A}from"./elevationProfileGeometryUtils.js";import{c as T,N as b}from"../../../chunks/chartUtilsAm5.js";import{fetchMessageBundle as P}from"../../../intl/messages.js";import{X as S,a as L,V as M,A as w,b as F,L as C}from"../../../chunks/LineSeries.js";import{b as j,d as k,a as I,C as z}from"../../../chunks/Theme.js";import{T as X}from"../../../chunks/Tooltip.js";import{substitute as H}from"../../../intl/substitute.js";import{formatNumber as V}from"../../../intl/number.js";let Y=class extends s{get chartVisible(){const t=this._chartData;if(null==t)return!1;if(!A(this.analysisView?.analysis))return t.refined;let e=0;for(const{samples:i}of t.lines)e+=i?.length??0;return t.refined||e<=m().largeChartSamples}get spinnerVisible(){return null!=this._chartData&&(this.analysisView?.progress??0)<1}get _updateParameters(){const{messages:t,_unitsMessages:e}=this;if(t&&e)return{data:this._chartData,messages:t,unitsMessages:e}}get _chartData(){const{analysisView:t,uniformScaling:e}=this;if(!this._hasInput||!t)return;const{analysis:i,effectiveUnits:s,progress:o,statistics:n}=t;return{lines:this._lineData,statistics:n,effectiveUnits:s,refined:1===o,uniformScaling:e,dynamicElevationRange:i.profiles.some(t=>"scene"===t.type)}}get _hasInput(){return null!=this.analysisView?.analysis.input}get _lineData(){const{analysisView:t}=this;if(!t)return[];const{analysis:e,results:i}=t,{profiles:s}=e;if(i.length!==s.length)return[];const o=[];for(let n=0;n<s.length;n++){const t=s.at(n),e=i.at(n);if(!e.available||!e.rawResult?.hasZ||!t.chartOptions.lineVisible)continue;const r="input"!==t.type;o.push({id:t.id,type:t.type,title:t.title,color:t.color,samples:e.samples,fillEnabled:r,strokeOffsetY:r?-1:0,strokeWidth:1.5})}return o}constructor(t){super(t),this.view=null,this.analysisView=null,this.messages=null,this.uniformScaling=!1,this._theme=_,this._data=null,this._seriesInfos=new Map,this._pointerIsOver=!1,this._rtl=!1,this._chartInfo=null,this._unitsMessages=null}initialize(){this.addHandles(o(t=>this._initializeChart(t)))}destroy(){this._chartInfo=null,this._seriesInfos.clear(),this._data=null}zoomOut(){this._chartInfo?.xAxis.zoom(0,1),this._chartInfo?.yAxis.zoom(0,1)}async _initializeChart(t){const[s,o]=await Promise.all([T(this.container),P("esri/core/t9n/Units")]);a(t);const n=$(this.container),r=f(this.container),p=r?y:_;s.setThemes(r?[e.new(s),i.new(s)]:[e.new(s)]),this._rtl=n,this._theme=p,this._unitsMessages=o;const c=s.container.children.push(S.new(s,{panX:!0,panY:!0,paddingTop:p.paddingTop,paddingBottom:p.paddingBottom,paddingLeft:n?p.paddingRight:p.paddingLeft,paddingRight:n?p.paddingLeft:p.paddingRight,maxTooltipDistance:-1}));c.zoomOutButton.set("forceHidden",!0);const d=c.xAxes.push(this._createXAxis(s)),h=c.yAxes.push(this._createYAxis(s));this._chartInfo={chart:c,xAxis:d,yAxis:h};const u=L.new(c.root,{behavior:"none",xAxis:d,yAxis:h,snapToSeriesBy:"y"});u.lineY.set("visible",!1),c.set("cursor",u),this._initializeTest(c),this.addHandles([this._setupZoomHandling(),this._setupCursorHandling(),q(s),l(()=>this._updateParameters,this._update.bind(this))]),this._update(this._updateParameters)}_initializeTest(t){}_update(t){if(!t||this.destroyed)return;const e=this._data,i=t.data;if(i===e&&t.messages===this.messages&&t.unitsMessages===this._unitsMessages)return;const s=e!==i,o=e?.effectiveUnits!==i?.effectiveUnits,n=e?.uniformScaling!==i?.uniformScaling;this._data=i,this._chartInfo?.chart.get("cursor")?.set("forceHidden",!i?.refined),(s||o)&&(this._updateAxes(),this._updateSeries()),n&&this.zoomOut(),this._updateTooltips()}_createXAxis(t){const e=this._theme,i=M.new(t,{renderer:w.new(t,{})});i.setAll({extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:this._makeFormatter(t,"distance"),strictMinMax:!0,strictMinMaxSelection:!0}),i.axisHeader.set("forceHidden",!0);const s=i.get("renderer");s.setAll({inside:!1,minGridDistance:e.xAxisMinGridDistance}),s.labels.template.setAll({centerX:k,centerY:k,fill:j(e.axisLabelsColor),fontFamily:e.fontFamily,fontSize:e.axisLabelsFontSize,fontWeight:e.axisLabelsFontWeight,maxPosition:e.xAxisMaxLabelPosition,minPosition:e.xAxisMinLabelPosition,paddingLeft:0,paddingRight:0,paddingTop:e.xAxisLabelsSpacing});const o=i.set("tooltip",X.new(t,{paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0}));return o.get("background")?.setAll({fill:j(e.axisTooltipBackgroundColor),stroke:void 0}),o.label.setAll({fill:j(e.axisTooltipLabelColor),fontFamily:e.fontFamily,fontSize:e.axisTooltipFontSize,paddingBottom:e.axisTooltipPaddingBottom,paddingLeft:e.axisTooltipPaddingHorizontal,paddingRight:e.axisTooltipPaddingHorizontal,paddingTop:e.axisTooltipPaddingTop,direction:this._rtl?"rtl":"ltr"}),s.grid.template.setAll({strokeOpacity:1,stroke:j(e.axisGridStroke)}),i}_createYAxis(t){const e=this._theme,i=this._rtl,s=M.new(t,{renderer:F.new(t,{})});s.setAll({baseValue:m().noDataValue,extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:this._makeFormatter(t,"elevation"),strictMinMax:!0,strictMinMaxSelection:!0,tooltip:void 0}),s.axisHeader.set("visible",!1);const o=s.get("renderer");return o.setAll({minGridDistance:e.yAxisMinGridDistance,opposite:i,inside:!0}),o.labels.template.setAll({centerX:k,centerY:I,fill:j(e.axisLabelsColor),fontFamily:e.fontFamily,fontSize:e.axisLabelsFontSize,fontWeight:e.axisLabelsFontWeight,maxPosition:e.yAxisMaxLabelPosition,minPosition:e.yAxisMinLabelPosition,paddingBottom:0,paddingLeft:i?0:e.yAxisLabelSpacing,paddingRight:i?e.yAxisLabelSpacing:0,paddingTop:0,textAlign:"start"}),o.grid.template.setAll({strokeOpacity:1,stroke:j(e.axisGridStroke)}),s}_setupZoomHandling(){const t=this._chartInfo;if(!t)return n();const{xAxis:e,yAxis:i}=t,s=()=>{this.onRangeChange?.(O(e),O(i))},o=t=>[t.on("start",s),t.on("end",s)];return N([...o(e),...o(i)])}_setupCursorHandling(){const t=this._chartInfo;if(!t)return n();const{chart:e,xAxis:i,yAxis:s}=t,o=e.get("cursor"),r=e.plotContainer.events,a=t=>{this._pointerIsOver=t,this._updateTooltips()},l=()=>{a(!1),this.onCursorPositionChange?.(null,null)};return N([o?.events.on("cursormoved",()=>{if(!this._pointerIsOver)return;this._updateTooltips();let t=o?.getPrivate("positionX")??0,e=o?.getPrivate("positionY")??0;const n=this._data;if(null!=n?.statistics){const{maxDistance:o,minElevation:r,maxElevation:a}=n.statistics;let l,p;if(null!=o){1===O(i)?(l=0,p=o):(l=G(i),p=W(i)),t=B(t,l,p,0,o)}if(null!=r&&null!=a){1===O(s)?(l=r,p=a):(l=G(s),p=W(s)),e=B(e,l,p,r,a)}}this.onCursorPositionChange?.(t,e)}),r.on("pointerover",()=>a(!0)),r.on("pointerout",l),r.on("blur",l)])}_updateAxes(){const t=this._chartInfo;if(!t)return;const{chart:e,xAxis:i,yAxis:s}=t,o=this._data,{minX:n,maxX:r,minY:a,maxY:l}=x({data:o,pixelWidth:i.width(),pixelHeight:s.height()}),p=!!o?.uniformScaling,c=!!o?.refined;e.setAll({panX:!0,panY:p,pinchZoomX:c,pinchZoomY:c&&p,wheelX:"panX",wheelY:c?p?"zoomXY":"zoomX":"none"}),i.setAll({max:r,min:n,panX:!0,panY:!1,zoomX:!0,zoomY:p}),s.setAll({max:l,min:a,panX:!1,panY:p,zoomX:p,zoomY:p})}_updateSeries(){const t=this._seriesInfos,e=this._chartInfo;if(!e)return;const{chart:i,xAxis:s,yAxis:o}=e,n=this._data;if(!n||0===n.lines.length)return this._seriesInfos.clear(),void i.series.clear();const r=new Map,a=new Set(i.series.values),l=n.lines.length;for(let p=0;p<l;p++){const s=n.lines[p];let o=t.get(s.id);o?(o.fill&&a.delete(o.fill),a.delete(o.line)):(o=D(e,this._theme,this._rtl,s),o.fill&&i.series.push(o.fill),i.series.push(o.line)),r.set(o.id,o);const c=l-p-1;o.fill?.set("layer",c),o.line.set("layer",l+c),this._updateLineSeries(o,s)}this._seriesInfos=r;for(const p of a)i.series.removeValue(p);s.set("layer",l+1),o.set("layer",l+2)}_updateLineSeries(t,e){const i=j(e.color.toCss()),s=e.samples??[],o=s.length>0,{line:n,fill:r}=t;n.set("visible",o),n.set("stroke",i),r?.set("visible",o),r?.set("fill",z.lighten(i,this._theme.seriesFillLighten)),n.data.setAll(s),r?.data.setAll(s)}_updateTooltips(){const t=this._getSeriesTooltipText();t?(this._seriesInfos.forEach(e=>{const i=e.line.get("tooltip");i.set("forceHidden",!1),i.label.set("text",t)}),this._chartInfo?.xAxis.getTooltip()?.setAll({tooltipText:this._getAxisTooltipText()})):this._seriesInfos.forEach(t=>{t.line.get("tooltip")?.set("forceHidden",!0)})}_getSeriesTooltipText(){const t=this._data?.lines.map(t=>({line:t,y:this._getPointNearestToCursor(t)?.elevation})).sort(E);return t&&0!==t.length&&null!=t[0].y?t.map(({y:t,line:e})=>this._getTooltipTextForLine(e,t)).join("\n"):null}_getPointNearestToCursor(t){const e=t.samples??[];if(0===e.length)return null;const i=this._chartInfo;if(!i)return null;const{chart:s,xAxis:o}=i,n=s.get("cursor"),r=n?.getPrivate("positionX")??0,a=o.toAxisPosition(r),l=o.positionToValue(a);return v(e,l,t=>t.distance)}_getTooltipTextForLine(t,e){const i=this._data,s=this.messages,o=this._unitsMessages;if(!i||!s||!o)return"";const n=`[${t.color.toHex()}]●[/]`,r=" ",a=m().formatPrecision,l=H(s.chartTooltip,{name:Z(t,s),elevation:null!=e?p(o,e,i.effectiveUnits.elevation,a):g});return this._rtl?l+r+n:n+r+l}_getAxisTooltipText(){const t=this._data,e=this._unitsMessages;if(!t||!e)return"";const i=t.lines[0],s=i?this._getPointNearestToCursor(i):null,o=m().formatPrecision;return null!=s?p(e,s.distance,t.effectiveUnits.distance,o):"-"}_makeFormatter(t,e){const i=b.new(t,{});return i.format=(t,i,s)=>{const o=this._data,n=this._unitsMessages;if(!o||!n||"string"==typeof t)return"";return`${V(t,{maximumFractionDigits:s})} ${c(n,o.effectiveUnits[e],"abbr")}`},i}};function D(t,e,i,s){const{id:o}=s,n=U(t,`line-${o}`),r=R(t,e,i);n.setAll({dy:s.strokeOffsetY,tooltip:r}),n.strokes.template.setAll({strokeWidth:s.strokeWidth});let a=null;return s.fillEnabled&&(a=U(t,`fill-${o}`),a.fills.template.setAll({fillOpacity:1,visible:!0})),{id:o,line:n,fill:a}}function U({chart:t,xAxis:e,yAxis:i},s){return C.new(t.root,{connect:!1,excludeFromTotal:!0,fill:void 0,id:s,stroke:void 0,valueXField:"distance",valueYField:"elevation",xAxis:e,yAxis:i})}function R({chart:t},e,i){const s=X.new(t.root,{autoTextColor:!1,forceHidden:!0,getFillFromSprite:!1,getLabelFillFromSprite:!1,pointerOrientation:"vertical",visible:!1}),o=e.seriesTooltipPaddingHorizontal,n=e.seriesTooltipPaddingVertical;return s.label.setAll({fill:j(e.seriesTooltipLabelColor),fontFamily:e.fontFamily,fontSize:e.seriesTooltipFontSize,paddingBottom:n,paddingLeft:o,paddingRight:o,paddingTop:n,textAlign:i?"end":"start",direction:"ltr"}),s.get("background")?.setAll({stroke:void 0,fill:j(e.seriesTooltipBackgroundColor)}),s.adapters.add("dy",t=>{const i=e.seriesTooltipSpacing,o=s.get("pointTo")?.y??0;return(t??0)+(s.y()>o?i:-i)}),s}function O(t){const e=Math.abs((t.get("end")??0)-(t.get("start")??0)),i=0!==e?1/e:1;return Math.abs(1-i)<u()?1:i}function B(t,e,i,s,o){return(e+t*(i-e)-s)/(o-s)}function E({y:t},{y:e}){return null==t?1:null==e?-1:e-t}function G(t){return t.positionToValue(t.get("start")??0)}function W(t){return t.positionToValue(t.get("end")??1)}function Z(t,e){const i=t.title;if(null!=i)return i;switch(t.type){case"ground":return e.profiles.ground;case"input":return e.profiles.input;case"query":return e.profiles.query;case"scene":return e.profiles.scene;default:return""}}function $(t){const e=t?.closest("[dir]");return null!==e&&e instanceof HTMLElement&&"rtl"===e.dir||"rtl"===document.dir}function N(t){return r(t.map(q))}function q(t){return n(()=>t?.dispose())}t([d()],Y.prototype,"view",void 0),t([d()],Y.prototype,"analysisView",void 0),t([d()],Y.prototype,"container",void 0),t([d()],Y.prototype,"messages",void 0),t([d()],Y.prototype,"onRangeChange",void 0),t([d()],Y.prototype,"onCursorPositionChange",void 0),t([d()],Y.prototype,"uniformScaling",void 0),t([d()],Y.prototype,"chartVisible",null),t([d()],Y.prototype,"spinnerVisible",null),t([d()],Y.prototype,"test",void 0),t([d()],Y.prototype,"_theme",void 0),t([d()],Y.prototype,"_data",void 0),t([d()],Y.prototype,"_seriesInfos",void 0),t([d()],Y.prototype,"_pointerIsOver",void 0),t([d()],Y.prototype,"_rtl",void 0),t([d()],Y.prototype,"_chartInfo",void 0),t([d()],Y.prototype,"_unitsMessages",void 0),t([d()],Y.prototype,"_updateParameters",null),t([d()],Y.prototype,"_chartData",null),t([d()],Y.prototype,"_hasInput",null),t([d()],Y.prototype,"_lineData",null),Y=t([h("esri.views.analysis.ElevationProfile.ElevationProfileChart")],Y);export{Y as ElevationProfileChart};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{memoize as o}from"../../../core/memoize.js";import{watch as r}from"../../../core/reactiveUtils.js";import{getMetersPerVerticalUnitForSR as t}from"../../../core/unitUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{ElevationProfileLineComputation as s}from"./ElevationProfileLineComputation.js";import{getGroundMinDemResolution as a}from"./elevationProfileQuerySourceUtils.js";let l=class extends s{constructor(){super(...arguments),this.type="ground",this.numSamplesForPreview=50,this.numSamplesPerChunk=1e3,this._getQueryElevationDependencies=o((e,o)=>({ground:e,groundLayers:o}))}get minDemResolution(){return a(this._ground)}get available(){return!0===this._ground?.layers.some(e=>e.visible)}initialize(){this.addHandles([r(()=>this._queryElevationDependencies,()=>this.onInvalidate(this))])}async queryElevation(e,o){const r=this._queryElevationDependencies;if(null==r)throw new Error(`${this.declaredClass}: no dependencies`);const{ground:i}=r;if(null==i)throw new Error("No ground configured in the view");const n=await i.queryElevation(e,o),s=t(e.spatialReference),a=t(i.layers.at(0).spatialReference);if(s!==a){const e=n.geometry;e.points=e.points.map(([e,r,t])=>[e,r,t===o.noDataValue?t:t*a/s])}return n}get _queryElevationDependencies(){return this._getQueryElevationDependencies(this._ground,this._ground?.layers?.toArray())}get _ground(){return this.controller.view?.map?.ground}};e([i()],l.prototype,"minDemResolution",null),e([i()],l.prototype,"available",null),e([i()],l.prototype,"_queryElevationDependencies",null),e([i()],l.prototype,"_ground",null),l=e([n("esri.views.analysis.ElevationProfile.
|
|
5
|
+
import{__decorate as e}from"tslib";import{memoize as o}from"../../../core/memoize.js";import{watch as r}from"../../../core/reactiveUtils.js";import{getMetersPerVerticalUnitForSR as t}from"../../../core/unitUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{ElevationProfileLineComputation as s}from"./ElevationProfileLineComputation.js";import{getGroundMinDemResolution as a}from"./elevationProfileQuerySourceUtils.js";let l=class extends s{constructor(){super(...arguments),this.type="ground",this.numSamplesForPreview=50,this.numSamplesPerChunk=1e3,this._getQueryElevationDependencies=o((e,o)=>({ground:e,groundLayers:o}))}get minDemResolution(){return a(this._ground)}get available(){return!0===this._ground?.layers.some(e=>e.visible)}initialize(){this.addHandles([r(()=>this._queryElevationDependencies,()=>this.onInvalidate(this))])}async queryElevation(e,o){const r=this._queryElevationDependencies;if(null==r)throw new Error(`${this.declaredClass}: no dependencies`);const{ground:i}=r;if(null==i)throw new Error("No ground configured in the view");const n=await i.queryElevation(e,o),s=t(e.spatialReference),a=t(i.layers.at(0).spatialReference);if(s!==a){const e=n.geometry;e.points=e.points.map(([e,r,t])=>[e,r,t===o.noDataValue?t:t*a/s])}return n}get _queryElevationDependencies(){return this._getQueryElevationDependencies(this._ground,this._ground?.layers?.toArray())}get _ground(){return this.controller.view?.map?.ground}};e([i()],l.prototype,"minDemResolution",null),e([i()],l.prototype,"available",null),e([i()],l.prototype,"_queryElevationDependencies",null),e([i()],l.prototype,"_ground",null),l=e([n("esri.views.analysis.ElevationProfile.ElevationProfileLineGroundComputation")],l);export{l as ElevationProfileLineGroundComputation};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{memoize as t}from"../../../core/memoize.js";import{watch as o}from"../../../core/reactiveUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{GeometryDescriptor as n}from"../../../layers/support/GeometryDescriptor.js";import{getGraphicEffectiveElevationInfo as s}from"../../../support/elevationInfoUtils.js";import{getInputGraphic as a}from"./elevationProfileGeometryUtils.js";import{ElevationProfileLineComputation as l}from"./ElevationProfileLineComputation.js";let p=class extends l{constructor(){super(...arguments),this.type="input",this.numSamplesForPreview=50,this.numSamplesPerChunk=500,this._getQueryElevationDependenciesMemoized=t((e,t,o,r,i)=>e&&o?{elevationInfo:e,visibleLayers:t,view:o,stationary:r,spatialReference:i}:null)}get available(){return!this.controller.analysisViewData.sketchGraphic?.geometry}initialize(){const e=()=>this.onInvalidate(this);this.addHandles([o(()=>this._queryElevationDependencies,e),this.controller.onElevationChange(e)])}async queryElevation(e,{noDataValue:t,signal:o}){const r=this._queryElevationDependencies;if(null==r)throw new Error(`${this.declaredClass}: no dependencies`);const{view:i,elevationInfo:s,spatialReference:a}=r;if("on-the-ground"===s.mode&&"3d"===i.type&&a){const r=await n.fromGeometry(e).project(a,o);if(!r)return{geometry:e,noDataValue:t};const s=i.elevationProvider;return r.coordinates.forEach(e=>{e.z=s.getElevation(e.x,e.y,0,a,"ground")??0}),{geometry:r.export(),noDataValue:t}}return{geometry:e,noDataValue:t}}get _queryElevationDependencies(){const{view:e}=this.controller;return this._getQueryElevationDependenciesMemoized(this._elevationInfo,this._visibleLayers,e,e.stationary,e.spatialReference)}get _elevationInfo(){const e=a(this.controller.analysis.input);return e?s(e):null}get _visibleLayers(){return
|
|
5
|
+
import{__decorate as e}from"tslib";import{memoize as t}from"../../../core/memoize.js";import{watch as o}from"../../../core/reactiveUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{GeometryDescriptor as n}from"../../../layers/support/GeometryDescriptor.js";import{getGraphicEffectiveElevationInfo as s}from"../../../support/elevationInfoUtils.js";import{getInputGraphic as a}from"./elevationProfileGeometryUtils.js";import{ElevationProfileLineComputation as l}from"./ElevationProfileLineComputation.js";let p=class extends l{constructor(){super(...arguments),this.type="input",this.numSamplesForPreview=50,this.numSamplesPerChunk=500,this._getQueryElevationDependenciesMemoized=t((e,t,o,r,i)=>e&&o?{elevationInfo:e,visibleLayers:t,view:o,stationary:r,spatialReference:i}:null)}get available(){return!this.controller.analysisViewData.sketchGraphic?.geometry}initialize(){const e=()=>this.onInvalidate(this);this.addHandles([o(()=>this._queryElevationDependencies,e),this.controller.onElevationChange(e)])}async queryElevation(e,{noDataValue:t,signal:o}){const r=this._queryElevationDependencies;if(null==r)throw new Error(`${this.declaredClass}: no dependencies`);const{view:i,elevationInfo:s,spatialReference:a}=r;if("on-the-ground"===s.mode&&"3d"===i.type&&a){const r=await n.fromGeometry(e).project(a,o);if(!r)return{geometry:e,noDataValue:t};const s=i.elevationProvider;return r.coordinates.forEach(e=>{e.z=s.getElevation(e.x,e.y,0,a,"ground")??0}),{geometry:r.export(),noDataValue:t}}return{geometry:e,noDataValue:t}}get _queryElevationDependencies(){const{view:e}=this.controller;return this._getQueryElevationDependenciesMemoized(this._elevationInfo,this._visibleLayers,e,e.stationary,e.spatialReference)}get _elevationInfo(){const e=a(this.controller.analysis.input);return e?s(e):null}get _visibleLayers(){return"3d"!==this.controller.view.type?[]:this.controller.view?.map?.allLayers?.toArray().filter(e=>("graphics"!==e.type||!e.internal)&&e.visible)??[]}};e([r()],p.prototype,"available",null),e([r()],p.prototype,"_queryElevationDependencies",null),e([r()],p.prototype,"_elevationInfo",null),e([r()],p.prototype,"_visibleLayers",null),p=e([i("esri.views.analysis.ElevationProfile.ElevationProfileLineInputComputation")],p);export{p as ElevationProfileLineInputComputation};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{watch as o,sync as r}from"../../../core/reactiveUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as t}from"../../../core/accessorSupport/decorators/subclass.js";import{ElevationProfileLineComputation as s}from"./ElevationProfileLineComputation.js";import{getQuerySourceMinDemResolution as l}from"./elevationProfileQuerySourceUtils.js";let n=class extends s{constructor(){super(...arguments),this.type="query",this.numSamplesForPreview=50,this.numSamplesPerChunk=500}get minDemResolution(){return l(this.profileLine.source)}get available(){const{source:e}=this.profileLine;return!!e&&(null==e.visible||e.visible)&&(null==e.layers||e.layers.some(e=>e.visible))}initialize(){this.addHandles(o(()=>this.profileLine.source,()=>this.onInvalidate(this),r))}queryElevation(e,o){if(!this.profileLine.source)throw new Error("No source configured for the elevation profile line");return this.profileLine.source.queryElevation(e,o)}};e([i({readOnly:!0})],n.prototype,"minDemResolution",null),e([i()],n.prototype,"available",null),n=e([t("esri.views.analysis.ElevationProfile.
|
|
5
|
+
import{__decorate as e}from"tslib";import{watch as o,sync as r}from"../../../core/reactiveUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as t}from"../../../core/accessorSupport/decorators/subclass.js";import{ElevationProfileLineComputation as s}from"./ElevationProfileLineComputation.js";import{getQuerySourceMinDemResolution as l}from"./elevationProfileQuerySourceUtils.js";let n=class extends s{constructor(){super(...arguments),this.type="query",this.numSamplesForPreview=50,this.numSamplesPerChunk=500}get minDemResolution(){return l(this.profileLine.source)}get available(){const{source:e}=this.profileLine;return!!e&&(null==e.visible||e.visible)&&(null==e.layers||e.layers.some(e=>e.visible))}initialize(){this.addHandles(o(()=>this.profileLine.source,()=>this.onInvalidate(this),r))}queryElevation(e,o){if(!this.profileLine.source)throw new Error("No source configured for the elevation profile line");return this.profileLine.source.queryElevation(e,o)}};e([i({readOnly:!0})],n.prototype,"minDemResolution",null),e([i()],n.prototype,"available",null),n=e([t("esri.views.analysis.ElevationProfile.ElevationProfileLineQueryComputation")],n);export{n as ElevationProfileLineQueryComputation};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as
|
|
5
|
+
import{__decorate as t}from"tslib";import e from"../../../Graphic.js";import i from"../../../core/Accessor.js";import{isSome as s}from"../../../core/arrayUtils.js";import{createTask as a}from"../../../core/asyncUtils.js";import"../../../core/has.js";import{makeHandle as r,handlesGroup as o}from"../../../core/handleUtils.js";import{ignoreAbortErrors as n,isAborted as p,createResolver as c,throwIfAborted as l,createAbortError as h,onAbort as d}from"../../../core/promiseUtils.js";import{watch as m,syncAndInitial as u}from"../../../core/reactiveUtils.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as f}from"../../../core/support/UpdatingHandles.js";import k from"../../../layers/GraphicsLayer.js";import g from"../../../symbols/CIMSymbol.js";import w from"../../../symbols/SimpleLineSymbol.js";import{isPolylineGraphic as v,isPolyline as b,isValidInputGraphic as G}from"./elevationProfileGeometryUtils.js";import{ViewEventPriorities as S}from"../../input/InputManager.js";import{isCancelEvent as O}from"../../interactive/interactiveToolUtils.js";import I from"../../../widgets/Sketch/SketchViewModel.js";const j=Symbol("main"),V=Symbol("interactive-operation");let M=class extends i{constructor(t){super(t),this._updatingHandles=new f,this._activeOperationInfo=null}initialize(){const{view:t}=this;this._graphicsLayer=new k({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height",offset:null}}),this._sketchViewModel=new I({layer:this._graphicsLayer,view:t,defaultCreateOptions:{mode:"click",hasZ:!0},updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{shapeOperation:"none"},enableRotation:!1,enableScaling:!1,enableMoveAllGraphics:!1,enableZ:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"reshape"},polylineSymbol:this._lineSymbol,activeLineSymbol:this._lineSymbol}),this.addHandles(m(()=>({map:t.map,internalGraphicsLayer:this._graphicsLayer,state:this.state}),({map:t,internalGraphicsLayer:e,state:i})=>{switch(D(t,e),i){case"idle":case"selected":case"reshaping-disabled":this._stopOperation(),this._ensureUpdatedSketchGraphic();break;case"reshaping":this._startReshape()}},u),j)}destroy(){this._sketchViewModel.destroy();const t=this._graphicsLayer;t&&this.view.map?.remove(t),t.destroy()}get sketchGraphic(){return this._get("sketchGraphic")}set sketchGraphic(t){t!==this._get("sketchGraphic")&&(this._set("sketchGraphic",t),U(this._graphicsLayer,t),this._updateInputFromSketchGraphic())}get state(){const{analysis:t,visible:e,interactive:i}=this.analysisViewData;if(!e)return"idle";switch(this._activeOperationInfo?.type){case"place":return this._sketchViewModel.createGraphic===this.sketchGraphic?"sketching":"awaiting-sketch";case"pick-graphic":return"picking";default:{const{input:e}=t;return e?v(e)?"selected":i?"reshaping":"reshaping-disabled":"idle"}}}get updating(){return this._sketchViewModel.updating||this._updatingHandles.updating}get _lineSymbol(){return L(this.view.type)}place(t){return this._startOperation("place",t,(e,i)=>{const s=this.analysisViewData.analysis.clone(),a=this._sketchViewModel.on("create",t=>{switch(t.state){case"complete":this._updateInputFromSketchGraphic(),this._stopOperation();break;case"cancel":this._stopOperation();break;case"active":this._updateInputFromSketchGraphic();break;case"start":this.sketchGraphic=t.graphic}});return this._ensureUpdatedSketchGraphic(),this._updatingHandles.addPromise(n(this._sketchViewModel.create("polyline"))),r(()=>(a.remove(),this._sketchViewModel.cancel(),this._updateInputFromSketchGraphic(),this.analysisViewData.analysis.valid?p(t)||s.equals(this.analysisViewData.analysis)?i():void e():(this._clearInput(),i())))})}async pickGraphic(t){return this._startOperation("pick-graphic",t,(t,e)=>{const{view:i}=this;i.closePopup();let s=null;const n=r=>{r.defer(async()=>{s?.abort(),s=a(async s=>{const{results:a}=await i.hitTest(r);l(s);const o=a.filter(t=>"graphic"===t.type).map(t=>t.graphic).find(G);o?(r.preventDefault(),r.stopPropagation(),this.sketchGraphic=null,this.analysisViewData.analysis.input=o,t(),this._stopOperation()):e()}),await s.promise})},p=t=>{O(t)&&(e(),this._stopOperation())};return i.focus(),o([i.on("immediate-click",n,S.TOOL),i.on("key-down",p,S.TOOL),i.acquireCursor("crosshair","high"),r(()=>{s?.abort(),e()})])})}_startReshape(){this._stopOperation();const t=this._sketchViewModel.on("update",t=>{this._updateInputFromSketchGraphic(),"complete"===t.state&&("reshaping"===this.state?this._startReshape():this._stopOperation())});this._replaceHandles(r(()=>{t.remove(),this._sketchViewModel.cancel()}),V);const e=this._ensureUpdatedSketchGraphic();e&&this._updatingHandles.addPromise(n(this._sketchViewModel.update(e,{tool:"reshape"})))}async _startOperation(t,e,i){const s=this._activeOperationInfo,a=c(),r={type:t,promise:a.promise};if(this._activeOperationInfo=r,s){const t=s.promise.catch(()=>{});this._stopOperation(),await t,l(e)}this.analysisViewData.interactive=!0;const o=i(()=>a.resolve({}),()=>a.reject(h()));this._replaceHandles([o,d(e,()=>this._stopOperation())],V);try{return await a.promise}finally{this._activeOperationInfo===r&&(this._activeOperationInfo=null)}}_stopOperation(){this.removeHandles(V)}_ensureUpdatedSketchGraphic(){const{input:t}=this.analysisViewData.analysis;return b(t)?(this.sketchGraphic??=new e({symbol:this._lineSymbol,geometry:t}),this.sketchGraphic.geometry=t,this.sketchGraphic):(this.sketchGraphic=null,null)}_clearInput(){this.sketchGraphic=null,this.analysisViewData.analysis.input=null}_updateInputFromSketchGraphic(){const t=this.sketchGraphic,{analysis:e}=this.analysisViewData;e.input=v(t)?t.geometry:null}_replaceHandles(t,e){this.removeHandles(e),this.addHandles((Array.isArray(t)?t:[t]).filter(s),e)}};function L(t){if("2d"===t){const t={type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",width:1.5};return new g({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{...t,effects:[{type:"CIMGeometricEffectDashes",dashTemplate:[5,4],lineDashEnding:"FullGap",controlPointEnding:"NoConstraint"}],color:[0,0,0,255]},{...t,color:[255,255,255,255]}]}}})}return new w({color:[0,0,0,0]})}function D(t,e){e&&(e.removeFromParent(),t?.add(e))}function U({graphics:t},e){e?(t.includes(e)||t.add(e),1!==t.length&&t.removeMany(t.filter(t=>t!==e))):t.removeAll()}t([y({constructOnly:!0})],M.prototype,"analysisViewData",void 0),t([y({constructOnly:!0})],M.prototype,"view",void 0),t([y()],M.prototype,"sketchGraphic",null),t([y({nonNullable:!0})],M.prototype,"state",null),t([y()],M.prototype,"updating",null),t([y()],M.prototype,"_activeOperationInfo",void 0),t([y()],M.prototype,"_lineSymbol",null),M=t([_("esri.views.analysis.ElevationProfile.ElevationProfileTool")],M);export{M as ElevationProfileTool};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import r from"../../core/Accessor.js";import
|
|
5
|
+
import{__decorate as e}from"tslib";import r from"../../core/Accessor.js";import t from"../../core/Error.js";import i from"../../core/Logger.js";import{someMap as o}from"../../core/MapUtils.js";import{createResolver as s,createAbortError as a,isAbortError as n}from"../../core/promiseUtils.js";import{on as l,watch as y,syncAndInitial as h}from"../../core/reactiveUtils.js";import{schedule as p}from"../../core/scheduling.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{get as w}from"../../core/accessorSupport/get.js";import{UpdatingHandles as f}from"../../core/support/UpdatingHandles.js";import{destroyMap as u}from"../../support/collectionUtils.js";import{LayerLayerViewInfo as m}from"./LayerLayerViewInfo.js";function g(e){return null!=e&&"object"==typeof e&&"layerViews"in e}let _=class extends r{constructor(e){super(e),this._layerLayerViewInfoMap=new Map,this._recyclingInfoMap=new Map,this._watchUpdatingTracking=new f,this.supportsGround=!0,this._preloadLayerViewModules=()=>{const e=this.view.map?.allLayers;if(e)for(const r of e)!1!==this.layerViewFilter?.(r)&&this.layerViewImporter.hasLayerViewModule(r)&&this.layerViewImporter.importLayerView(r)},this._reschedule=()=>this.destroyed?Promise.reject():(null==this._workPromise&&(this._workPromise=s(),this._workPromise.promise.catch(()=>{})),this.removeHandles("reschedule"),this.addHandles(p(this._doWork),"reschedule"),this._workPromise.promise),this._doWork=()=>{if(this.destroyed)return;const{map:e}=this.view;if(!e)return void this.clear();if(this._map!==e&&(this.clear(),this._map=e),null==this._workPromise)return void this.notifyChange("updating");this.removeHandles("reschedule"),this.removeHandles("collection-change");const r=new Set,t=[],i=this.view.ready,o=e=>{if(null!=e)for(const s of e)if(s){if(!1===this.layerViewFilter?.(s))continue;r.add(s);const e=this._layerLayerViewInfoMap.get(s);e&&i?e.start():e||this._recyclingInfoMap.has(s)||t.push(s),"layers"in s&&s.layers&&o(s.layers)}};for(const n of this._rootCollectionNames)o(w(this,n));const s=new Array,a=e=>{const r=e.tryRecycle(t);r?(this._recyclingInfoMap.set(e.layer,e),this.notifyChange("updating"),r.then(()=>{this._recyclingInfoMap.delete(e.layer),this._layerLayerViewInfoMap.set(e.layer,e),this._reschedule(),this.notifyChange("updating")}).catch(r=>{n(r)||(this._recyclingInfoMap.delete(e.layer),e.destroy(),this._reschedule(),this.notifyChange("updating"))})):s.push(e)};for(const n of this._layerLayerViewInfoMap.values())r.has(n.layer)||(this._layerLayerViewInfoMap.delete(n.layer),a(n));for(const n of this._recyclingInfoMap.values())r.has(n.layer)||(this._recyclingInfoMap.delete(n.layer),a(n));for(const n of t)this._createLayerView(n);this._refreshCollections(),s.forEach(e=>e.destroy());const l=[e?.ground?.layers,e?.basemap?.baseLayers,e?.basemap?.groundLayers,e?.basemap?.referenceLayers,e?.layers].filter(e=>!!e);r.forEach(e=>"layers"in e&&l.push(e.layers)),this.addHandles(l.map(e=>this._watchUpdatingTracking.addOnCollectionChange(()=>e,this._reschedule)),"collection-change"),this._workPromise.resolve(),this._workPromise=null},this._layersToLayerViews=new Map(e.layerviewMapping)}initialize(){this.addHandles([l(()=>this.view?.map?.allLayers,"change",this._preloadLayerViewModules,{onListenerAdd:this._preloadLayerViewModules}),y(()=>{const e=this.view,r=e?.map;return[r?.basemap,r?.ground,r?.layers,e?.ready]},()=>this._reschedule(),h)]),this._preloadLayerViewModules(),this._reschedule()}clearHandles(){this._watchUpdatingTracking.removeAll()}destroy(){this.clear(),u(this._recyclingInfoMap),u(this._layerLayerViewInfoMap),this._watchUpdatingTracking.destroy(),this._map=null,null!=this._workPromise&&(this._workPromise.reject(a()),this._workPromise=null)}get _rootCollectionNames(){return Array.from(this._layersToLayerViews.keys())}get updating(){return null!=this._workPromise||this._watchUpdatingTracking.updating||o(this._layerLayerViewInfoMap,e=>!e.done)||this._recyclingInfoMap.size>0}get updatingRemaining(){let e=0;for(const r of this._layerLayerViewInfoMap.values())r.done||++e;return e}clear(){this.destroyed||(this._clearCollections(),u(this._layerLayerViewInfoMap))}async whenLayerView(e){await this._reschedule();const r=this._layerLayerViewInfoMap.get(e)?.promise;if(!r){const r=this._recyclingInfoMap.get(e)?.promise;if(!r)throw new t("view:no-layerview-for-layer","No layerview has been found for the layer",{layer:e});return r}return r}isCreatingLayerViewsForLayer(e,r){this.commitProperty("updatingRemaining");const t=this._layerLayerViewInfoMap.get(e);if(!t?.done)return!0;const i=t.layerView;return!(!i||!r||i.parent===r)||!!(t.done&&i&&"layers"in e&&e.layers?.length)&&e.layers.some(e=>this.isCreatingLayerViewsForLayer(e,i))}_refreshCollections(){for(const[e,r]of this._layersToLayerViews)this._populateLayerViewsOwners(w(this,e),w(this,r),this.view);this.notifyChange("updating"),this.notifyChange("updatingRemaining")}_clearCollections(){for(const e of this._layersToLayerViews.values())w(this,e)?.removeAll()}_populateLayerViewsOwners(e,r,t){if(!e||!r)return void r?.removeAll();let i=0;for(const o of e){const e=this._layerLayerViewInfoMap.get(o);if(!e?.layerView)continue;const{layerView:s}=e;s.layer=o,s.parent=t,r.at(i)!==s&&r.splice(i,0,s),"layers"in o&&g(s)&&this._populateLayerViewsOwners(o.layers,s.layerViews,s),++i}i<r.length&&r.splice(i)}_createLayerView(e){e.load().catch(r=>{i.getLogger("LayerViewManager").error(`Error loading layer "${e.title}"`,r)}),this.layerViewImporter.hasLayerViewModule(e)&&this.layerViewImporter.importLayerView(e);const r=new m(e,this.view,this.layerViewImporter);r.promise?.then(()=>this._refreshCollections(),r=>{r&&(n(r)||"cancelled:layerview-create"===r.name)||i.getLogger(this).error(`Failed to create layerview for layer title:'${e.title??"no title"}', id:'${e.id??"no id"}' of type '${e.type}'.`,{layer:e,error:r}),this.destroyed||this._refreshCollections()}),this._layerLayerViewInfoMap.set(e,r),this.view.ready&&r.start(),this.notifyChange("updating"),this.notifyChange("updatingRemaining")}};e([c()],_.prototype,"_workPromise",void 0),e([c({readOnly:!0})],_.prototype,"_watchUpdatingTracking",void 0),e([c({readOnly:!0})],_.prototype,"_layersToLayerViews",void 0),e([c({constructOnly:!0})],_.prototype,"layerviewMapping",void 0),e([c({readOnly:!0})],_.prototype,"_rootCollectionNames",null),e([c({constructOnly:!0})],_.prototype,"layerViewFilter",void 0),e([c()],_.prototype,"layerViewImporter",void 0),e([c()],_.prototype,"supportsGround",void 0),e([c({readOnly:!0})],_.prototype,"updating",null),e([c({readOnly:!0})],_.prototype,"updatingRemaining",null),e([c({constructOnly:!0})],_.prototype,"view",void 0),_=e([d("esri.views.support.LayerViewManager")],_);const V=_;export{V as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{getFormatBytesPerElement as t}from"./Util.js";class i{constructor(t,i=0,h=i,r=!1,s=1){this.internalFormat=t,this.width=i,this.height=h,this.multisampled=r,this.samples=s}}function h(i){return i.width<=0||i.height<=0||null==i.internalFormat?0:i.width*i.height*t(i.internalFormat)}export{i as RenderbufferDescriptor,h as estimateMemory};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{PixelType as t}from"./enums.js";import{
|
|
5
|
+
import{PixelType as t}from"./enums.js";import{getFormatBytesPerElement as i}from"./Util.js";class h{constructor(i=0,h=i){this.width=i,this.height=h,this.type=0,this.target=3553,this.pixelFormat=6408,this.dataType=t.UNSIGNED_BYTE,this.samplingMode=9729,this.wrapMode=10497,this.maxAnisotropy=1,this.flipped=!1,this.hasMipmap=!1,this.isOpaque=!1,this.unpackAlignment=4,this.preMultiplyAlpha=!1,this.compareEnabled=!1,this.linearFilterDepth=!1,this.depth=1,this.isImmutable=!1}}function s(t){return t.width<=0||t.height<=0||t.depth<=0?0:Math.round(t.width*t.height*t.depth*(t.hasMipmap?4/3:1)*(null==t.internalFormat?4:i(t.internalFormat))*(34067===t.target?6:1))}export{h as TextureDescriptor,s as estimateMemory};
|
package/views/webgl/Util.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../core/has.js";import{webglDebugEnabled as e,getErrorMessage as s}from"./checkWebGLError.js";import{CompressedTextureFormat as c,SizedPixelFormat as a,SizedDepthStencilFormat as r,SizedDepthFormat as t}from"./enums.js";function R(c,a,r,t=0){const R=c.gl;c.bindBuffer(r);for(const
|
|
5
|
+
import"../../core/has.js";import{webglDebugEnabled as e,getErrorMessage as s}from"./checkWebGLError.js";import{CompressedTextureFormat as c,SizedPixelFormat as a,SizedDepthStencilFormat as r,SizedDepthFormat as t}from"./enums.js";function R(c,a,r,t=0){const R=c.gl;c.bindBuffer(r);for(const n of r.layout){const r=a.get(n.name);if(null==r){console.warn(`There is no location for vertex attribute '${n.name}' defined.`);continue}const _=t*n.stride;if(n.count<=4)R.vertexAttribPointer(r,n.count,n.type,n.normalized,n.stride,n.offset+_),R.enableVertexAttribArray(r),n.divisor>0&&R.vertexAttribDivisor(r,n.divisor);else if(9===n.count)for(let e=0;e<3;e++)R.vertexAttribPointer(r+e,3,n.type,n.normalized,n.stride,n.offset+12*e+_),R.enableVertexAttribArray(r+e),n.divisor>0&&R.vertexAttribDivisor(r+e,n.divisor);else if(16===n.count)for(let e=0;e<4;e++)R.vertexAttribPointer(r+e,4,n.type,n.normalized,n.stride,n.offset+16*e+_),R.enableVertexAttribArray(r+e),n.divisor>0&&R.vertexAttribDivisor(r+e,n.divisor);else console.error("Unsupported vertex attribute element count: "+n.count);if(e()){const e=s(c.gl);e&&console.error(`Unable to bind vertex attribute "${n.name}" with baseInstanceOffset ${_}:`,e,n)}}}function n(e){switch(e){case 6406:case 6409:case 6403:case 36244:case 6402:case 34041:return 1;case 6410:case 33319:case 33320:return 2;case 6407:case 36248:return 3;case 6408:case 36249:return 4}return 0}function _(e){switch(e){case 6406:case 6409:case 6403:case 36244:case a.R8:case a.R8I:case a.R8UI:case a.R8_SNORM:case 36168:return 1;case 6410:case 33319:case 33320:case a.RGBA4:case a.R16F:case a.R16I:case a.R16UI:case a.RG8:case a.RG8I:case a.RG8UI:case a.RG8_SNORM:case a.RGB565:case a.RGB5_A1:case t.DEPTH_COMPONENT16:return 2;case 6407:case 36248:case a.RGB8:case a.RGB8I:case a.RGB8UI:case a.RGB8_SNORM:case a.SRGB8:case t.DEPTH_COMPONENT24:return 3;case 6408:case 36249:case a.RGBA8:case a.R32F:case a.R11F_G11F_B10F:case a.RG16F:case a.R32I:case a.R32UI:case a.RG16I:case a.RG16UI:case a.RGBA8I:case a.RGBA8UI:case a.RGBA8_SNORM:case a.SRGB8_ALPHA8:case a.RGB9_E5:case a.RGB10_A2UI:case a.RGB10_A2:case t.DEPTH_COMPONENT32F:case r.DEPTH24_STENCIL8:return 4;case r.DEPTH32F_STENCIL8:return 5;case a.RGB16F:case a.RGB16I:case a.RGB16UI:return 6;case a.RG32F:case a.RG32I:case a.RG32UI:case a.RGBA16F:case a.RGBA16I:case a.RGBA16UI:return 8;case a.RGB32F:case a.RGB32I:case a.RGB32UI:return 12;case a.RGBA32F:case a.RGBA32I:case a.RGBA32UI:return 16;case c.COMPRESSED_RGB_S3TC_DXT1_EXT:case c.COMPRESSED_RGBA_S3TC_DXT1_EXT:return.5;case c.COMPRESSED_RGBA_S3TC_DXT3_EXT:case c.COMPRESSED_RGBA_S3TC_DXT5_EXT:return 1;case c.COMPRESSED_R11_EAC:case c.COMPRESSED_SIGNED_R11_EAC:case c.COMPRESSED_RGB8_ETC2:case c.COMPRESSED_SRGB8_ETC2:case c.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:case c.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:return.5;case c.COMPRESSED_RG11_EAC:case c.COMPRESSED_SIGNED_RG11_EAC:case c.COMPRESSED_RGBA8_ETC2_EAC:case c.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:return 1}return 0}export{R as bindVertexBufferLayout,_ as getFormatBytesPerElement,n as getFormatComponents};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{toConst as e}from"../../core/compilerUtils.js";import t from"../../core/Logger.js";import{disposeMaybe as r}from"../../core/maybe.js";import{baseTypedArrayMemory as s}from"../../core/memoryEstimations.js";import{ResourceType as i}from"./enums.js";import{bindVertexBufferLayout as n}from"./Util.js";import{fromBuffers as o}from"./VertexAttributeLocations.js";const f=()=>t.getLogger("esri.views.webgl.VertexArrayObject");let
|
|
5
|
+
import{toConst as e}from"../../core/compilerUtils.js";import t from"../../core/Logger.js";import{disposeMaybe as r}from"../../core/maybe.js";import{baseTypedArrayMemory as s}from"../../core/memoryEstimations.js";import{ResourceType as i}from"./enums.js";import{bindVertexBufferLayout as n}from"./Util.js";import{fromBuffers as o}from"./VertexAttributeLocations.js";const f=()=>t.getLogger("esri.views.webgl.VertexArrayObject");let h=class t{constructor(t,r,s,i){this._context=t,this._indexBuffer=s,this._buffers=r instanceof Map?r:new Map([["geometry",r]]),this._baseInstances=null==i?new Map:"number"==typeof i?new Map([["geometry",i]]):i,this.locations=e(o(this._buffers))}get glName(){return this._glName}get context(){return this._context}get buffers(){return e(this._buffers)}buffer(e="geometry"){return this.buffers.get(e)}get indexBuffer(){return this._indexBuffer}getByteLength(e){return this.buffer(e)?.sizeBytes??0}vertexCount(e){const t=this.buffer(e);return t?t.sizeBytes/t.layout[0].stride:0}get usedMemory(){return Array.from(this._buffers.values()).reduce((e,t)=>e+t.usedMemory,this._indexBuffer?.usedMemory??0+(this._buffers.size+(this._indexBuffer?1:0))*s)}dispose(){this._context?(this._buffers.forEach(e=>e.dispose()),this._buffers.clear(),this._indexBuffer=r(this._indexBuffer),this.disposeVAOOnly()):(this._glName||this._buffers.size>0)&&f().warn("Leaked WebGL VAO")}disposeVAOOnly(){this._context?(this._context.getBoundVAO()===this&&this._context.bindVAO(null),this._glName&&(this._context.gl.deleteVertexArray(this._glName),this._glName=null,this._context.instanceCounter.decrement(i.VertexArrayObject,this)),this._context=null):this._glName&&f().warn("Leaked WebGL VAO")}bind(e=this.locations){const t=this._context.gl;this._glName?t.bindVertexArray(this._glName):(this._context.instanceCounter.increment(i.VertexArrayObject,this),this._glName=t.createVertexArray(),t.bindVertexArray(this._glName),this._bindLayout(e))}_bindLayout(e){const{_buffers:t,_indexBuffer:r}=this;if(t||f().error("Vertex buffer dictionary is empty!"),t.forEach((t,r)=>n(this._context,e,t,this._baseInstances.get(r)??0)),null!=r){const e=this._context.gl;this._context.gl.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r.glName)}}unbind(){this._context.gl.bindVertexArray(null)}shallowCloneWithBaseInstances(e){return new t(this._context,this._buffers,this._indexBuffer,e)}};export{h as VertexArrayObject};
|
package/webscene/Slide.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../Basemap.js";import i from"../Viewpoint.js";import{result as n}from"../core/asyncUtils.js";import{ClonableMixin as r}from"../core/Clonable.js";import o from"../core/Collection.js";import{referenceSetter as s}from"../core/collectionUtils.js";import{JSONSupport as a}from"../core/JSONSupport.js";import l from"../core/Logger.js";import{moduloPositive as p}from"../core/mathUtils.js";import{destroyMaybe as m,removeMaybe as c}from"../core/maybe.js";import{onAbortOrThrow as h,createAbortError as d,isAbortError as u}from"../core/promiseUtils.js";import{whenOnce as y,when as g}from"../core/reactiveUtils.js";import{Milliseconds as b,Seconds as v}from"../core/time.js";import{property as w}from"../core/accessorSupport/decorators/property.js";import{cast as f}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as T}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as j}from"../core/accessorSupport/ensureType.js";import{s as L}from"../chunks/vec32.js";import{create as C}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import _ from"../layers/Layer.js";import{basemapEnsureType as E,clonePreservingTiledLayers as S}from"../support/basemapEnsureType.js";import{TaskPriority as k}from"../views/support/Scheduler.js";import{SlideThumbnail as A}from"../webdoc/support/SlideThumbnail.js";import{timeExtent as V}from"../webdoc/support/timeProperties.js";import U from"./SunLighting.js";import x from"./VirtualLighting.js";import F from"./support/Description.js";import I from"./support/SlideElements.js";import{SlideEnvironment as D}from"./support/SlideEnvironment.js";import R from"./support/SlideGround.js";import{SlideVisibleLayer as O}from"./support/SlideVisibleLayer.js";import P from"./support/Title.js";let q=0;const B=o.ofType(O),M=["caption","cover","none"];let G=class extends(r(a)){constructor(e){super(e),this.id=Date.now().toString(16)+"-slide-"+q++,this.title=new P,this.description=new F,this.hidden=!1,this.thumbnail=new A,this.viewpoint=null,this.basemap=null,this.ground=null,this.layout="caption",this.enabledFocusAreas=null,this.environment=new D,this.timeExtent=null,this.elements=new I,this.visibleLayers=new B}destroy(){this.visibleLayers.removeAll(),this.enabledFocusAreas=null,this.basemap=null,this.thumbnail=m(this.thumbnail),this.description=null,this.title=null,this.thumbnail=null,this.elements=null}castTitle(e){return"string"==typeof e?new P({text:e}):j(P,e)}castDescription(e){return"string"==typeof e?new F({text:e}):j(F,e)}castThumbnail(e){return"string"==typeof e?new A({url:e}):j(A,e)}castBasemap(e){return E(e)}set visibleLayers(e){this._set("visibleLayers",s(e,this._get("visibleLayers"),B))}castVisibleLayers(e){return e&&"function"==typeof e.map?e.map(e=>{if("string"==typeof e)return{id:e};if(e instanceof _){const t=H(e);return{id:e.id,sublayerIds:t}}return e.id?{id:e.id,sublayerIds:"sublayerIds"in e?e.sublayerIds:void 0}:(l.getLogger(this).warn('Invalid visible layer, expected { id }, Layer or "id"'),e)}):null}async _updateVisibleLayers(e){const t=[];await Promise.allSettled(this._getLayers(e.map).map(i=>e.whenLayerView(i).then(e=>{if(e.visible){const n=H(i);t.push(new O({id:e.layer.id,sublayerIds:n}))}})).toArray()),this.visibleLayers.removeAll(),this.visibleLayers.addMany(t)}async updateFrom(e,t){const i={format:"png",quality:80,width:120,height:75,disableDecorations:!0,...t?.screenshot};await e.when(),this.viewpoint=e.viewpoint.clone(),this.environment.lighting="virtual"===e.environment.lighting.type?x.prototype.clone.apply(e.environment.lighting):U.prototype.clone.apply(e.environment.lighting),this.environment.weather=e.environment.weather.clone(),this.enabledFocusAreas=new o(e.focusAreasView?.enabledAreas.map(({id:e})=>e)??[]),this.basemap=e.map.basemap?.clone()||null,this.ground=e.map.ground?R.fromGround(e.map.ground):null,this.timeExtent=e.timeExtent?.clone()??null,this.elements.analyses.updateFrom(e),await this._updateVisibleLayers(e);const n=await e.takeScreenshot(i);return this.thumbnail=new A({url:n.dataUrl}),this}async applyTo(e,t){null!=this._applyToController&&this._applyToController.abort();let i=new AbortController;this._applyToController=i;const r=h(t,()=>i?.abort()),o=()=>{this._applyToController===i&&(this._applyToController=null),i=null,r?.remove()};try{await y(()=>e.ready,i.signal)}catch(c){throw o(),c}if(i.signal.aborted)throw o(),d();const s=e.resourceController.scheduler.registerTask(k.SLIDE);let a=!1;const l={animate:!0,...t,signal:this._applyToController.signal},p=async()=>{await Promise.all([s.schedule(async()=>a=await this._setViewpointOfInterest(e,l)),s.schedule(()=>this._applyBasemap(e,l),l.signal),s.schedule(()=>this._loadLayersWithSublayerVisibility(e))]),await Promise.all([s.schedule(()=>this._applyLayerVisibility(e),l.signal),s.schedule(()=>this._applyFocusAreaEnabled(e.map?.focusAreas.areas)),s.schedule(()=>this._applyGround(e),l.signal),s.schedule(()=>this.elements.analyses.applyTo(e),l.signal),s.schedule(()=>this._applyViewpoint(e,l),l.signal),s.schedule(()=>e.timeExtent=this.timeExtent?.clone()??null,l.signal),s.schedule(()=>e.environment.weather=this.environment.weather.clone())])},m=await n(e.addUpdatingPromise(p()));if(a&&(e.contentCamera=null),s.remove(),o(),!1===m.ok)throw m.error;return this}async _applyBasemap(e,t){if(this.basemap){try{await this.basemap.load(t)}catch(i){if(u(i))throw i}e.map.basemap=S(this.basemap,e.map.basemap)}}_applyGround(e){this.ground&&(e.map.ground=this.ground.cloneAndApplyTo(e.map.ground))}_applyFocusAreaEnabled(e){if(e&&this.enabledFocusAreas)for(const t of e)t.enabled=this.enabledFocusAreas.includes(t.id)}_getLayers(e){const t=new o;return this._collectLayers(e,t),this._collectLayers(e.ground,t),t}_collectLayers(e,t){e.layers.forEach(e=>{e.persistenceEnabled&&(t.add(e),"layers"in e&&this._collectLayers(e,t))})}async _loadLayersWithSublayerVisibility(e){this.visibleLayers&&await Promise.allSettled(this._getLayers(e.map).items.map(e=>{const t=this.visibleLayers.find(t=>t.id===e.id)?.sublayerIds;return t?e.load():null}))}_applyLayerVisibility(e){if(!this.visibleLayers)return;this._getLayers(e.map).forEach(e=>{const t=this.visibleLayers.find(t=>t.id===e.id);e.visible=null!=t;const i=t?.sublayerIds,n=W(e);i&&n&&n.forEach(e=>e.visible=i.includes(e.id))})}async _setViewpointOfInterest(e,t){if(e.state.fixedContentCamera||!this.viewpoint||t?.ignoreViewpoint||!t?.useDestinationCamera)return!1;const{toCameraAsync:i}=await import("../views/3d/support/viewpointUtils.js"),n=await i(e,this.viewpoint);return e.contentCamera=n,null!=n}async _applyViewpoint(e,t){if(this._applyCachedCameraTrackingEnabled(e),this.viewpoint&&!t.ignoreViewpoint){const i=this.environment.lighting;if(t.animate&&"sun"===i.type&&i.date)return this._animateToLighting(e,t);t.animate&&(e.environment.applyLighting(i.clone()),await e.goTo(this.viewpoint,t)),e.viewpoint=this.viewpoint}e.environment.applyLighting(this.environment.lighting.clone())}async _animateToLighting(e,t){let i=null;"virtual"!==e.environment.lighting.type&&"virtual"!==this.environment.lighting.type&&("global"===e.viewingMode&&(i=this._animateLightingWithCamera(e,e.environment.lighting,this.environment.lighting)),e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1),e.environment.lighting.directShadowsEnabled=this.environment.lighting.directShadowsEnabled,"virtual"===this.environment.lighting.type||"virtual"===e.environment.lighting.type?(e.environment.applyLighting(this.environment.lighting.clone()),"virtual"!==e.environment.lighting.type&&(e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1)):null!=this.environment.lighting.displayUTCOffset&&(e.environment.lighting.displayUTCOffset=this.environment.lighting.displayUTCOffset);return e.goTo(this.viewpoint,t).then(()=>{this._applyCachedCameraTrackingEnabled(e),e.environment.applyLighting(this.environment.lighting.clone())}).catch(t=>{throw null==e.animation&&this._applyCachedCameraTrackingEnabled(e),t}).finally(()=>{c(i)})}_applyCachedCameraTrackingEnabled(e){null!=e.environment.cachedCameraTrackingEnabled&&(e.environment.lighting.cameraTrackingEnabled=e.environment.cachedCameraTrackingEnabled,e.environment.cachedCameraTrackingEnabled=null)}_getTime(e){return[b(e.getTime()),v(3600*e.getUTCHours()+60*e.getUTCMinutes()+e.getUTCSeconds())]}_setTime(e,t,i){return e.setTime(t),e.setUTCHours(i/3600),e.setUTCMinutes(i%3600/60),e.setUTCSeconds(i%3600%60),e}_animateLightingWithCamera(e,t,i){const n=new Date(t.date.toString()),[r,o]=this._getTime(n),[s,a]=this._getTime(i.date),l=K(o,a),p=e.renderCoordsHelper,m=C();p.toRenderCoords(e.camera.position,m);const c=C(),h=C();null!=this.viewpoint.camera&&p.toRenderCoords(this.viewpoint.camera.position,c);const d=new Date;return g(()=>e.camera,e=>{p.toRenderCoords(e.position,h);const i=L(m,h),n=L(c,h);let a=0;i+n!==0&&(a=i/(i+n));const u=r+(s-r)*a,y=Q(o,v(l*a));t.date=this._setTime(d,u,y)})}write(e,t){const i=super.write(e,t);return i?.elements&&0===Object.keys(i.elements).length&&delete i.elements,i}static createFrom(e,t){return(new this).updateFrom(e,t)}};e([w({type:String,json:{write:{isRequired:!0}}})],G.prototype,"id",void 0),e([w({type:P,json:{default:()=>new P({text:""}),write:{isRequired:!0}}})],G.prototype,"title",void 0),e([f("title")],G.prototype,"castTitle",null),e([w({type:F,json:{write:{overridePolicy:e=>({enabled:!(!e||!e.text)})}}})],G.prototype,"description",void 0),e([f("description")],G.prototype,"castDescription",null),e([w({type:Boolean,nonNullable:!0,json:{write:!0,default:!1}})],G.prototype,"hidden",void 0),e([w({type:A,json:{default:()=>new A({url:""}),write:{isRequired:!0}}})],G.prototype,"thumbnail",void 0),e([f("thumbnail")],G.prototype,"castThumbnail",null),e([w({type:i,nonNullable:!0,json:{write:{isRequired:!0}}})],G.prototype,"viewpoint",void 0),e([w({type:t,json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],G.prototype,"basemap",void 0),e([f("basemap")],G.prototype,"castBasemap",null),e([w({type:R,json:{write:!0}})],G.prototype,"ground",void 0),e([w({type:M,json:{write:!0,default:"caption"},nonNullable:!0})],G.prototype,"layout",void 0),e([w({type:B,json:{write:{isRequired:!0}}})],G.prototype,"visibleLayers",null),e([f("visibleLayers")],G.prototype,"castVisibleLayers",null),e([w({type:o.ofType(String),json:{write:!0},clonable:e=>e?new o(e.items):null})],G.prototype,"enabledFocusAreas",void 0),e([w({type:D,json:{write:!0}})],G.prototype,"environment",void 0),e([w(V)],G.prototype,"timeExtent",void 0),e([w({type:I,nonNullable:!0,json:{write:!0}})],G.prototype,"elements",void 0),G=e([T("esri.webscene.Slide")],G);const N=G;function W(e){if("building-scene"===e.type||"map-image"===e.type)return e.allSublayers.toArray()}function H(e){const t=W(e);if(t)return t.filter(e=>e.visible).map(e=>e.id)}const J=v(86400),z=v(43200);function K(e,t){let i=t-e;return i>z&&(i-=J),i<-z&&(i+=J),v(i)}function Q(e,t){return v(p(e+t,J))}export{N as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../Basemap.js";import i from"../Viewpoint.js";import{result as n}from"../core/asyncUtils.js";import{ClonableMixin as r}from"../core/Clonable.js";import o from"../core/Collection.js";import{referenceSetter as s}from"../core/collectionUtils.js";import{JSONSupport as a}from"../core/JSONSupport.js";import l from"../core/Logger.js";import{moduloPositive as p}from"../core/mathUtils.js";import{destroyMaybe as m,removeMaybe as c}from"../core/maybe.js";import{onAbortOrThrow as h,createAbortError as d,isAbortError as u}from"../core/promiseUtils.js";import{whenOnce as y,when as g}from"../core/reactiveUtils.js";import{Milliseconds as b,Seconds as v}from"../core/time.js";import{property as w}from"../core/accessorSupport/decorators/property.js";import{cast as f}from"../core/accessorSupport/decorators/cast.js";import"../core/has.js";import"../core/RandomLCG.js";import{subclass as T}from"../core/accessorSupport/decorators/subclass.js";import{ensureType as j}from"../core/accessorSupport/ensureType.js";import{s as L}from"../chunks/vec32.js";import{create as C}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import _ from"../layers/Layer.js";import{basemapEnsureType as E,clonePreservingTiledLayers as S}from"../support/basemapEnsureType.js";import{TaskPriority as k}from"../views/support/Scheduler.js";import{SlideThumbnail as A}from"../webdoc/support/SlideThumbnail.js";import{timeExtent as V}from"../webdoc/support/timeProperties.js";import U from"./SunLighting.js";import x from"./VirtualLighting.js";import F from"./support/Description.js";import I from"./support/SlideElements.js";import{SlideEnvironment as D}from"./support/SlideEnvironment.js";import R from"./support/SlideGround.js";import{SlideVisibleLayer as O}from"./support/SlideVisibleLayer.js";import P from"./support/Title.js";let q=0;const B=o.ofType(O),M=["caption","cover","none"];let G=class extends(r(a)){constructor(e){super(e),this.id=Date.now().toString(16)+"-slide-"+q++,this.title=new P,this.description=new F,this.hidden=!1,this.thumbnail=new A,this.viewpoint=null,this.basemap=null,this.ground=null,this.layout="caption",this.enabledFocusAreas=null,this.environment=new D,this.timeExtent=null,this.elements=new I,this.visibleLayers=new B}destroy(){this.visibleLayers.removeAll(),this.enabledFocusAreas=null,this.basemap=null,this.thumbnail=m(this.thumbnail),this.description=null,this.title=null,this.thumbnail=null,this.elements.destroy()}castTitle(e){return"string"==typeof e?new P({text:e}):j(P,e)}castDescription(e){return"string"==typeof e?new F({text:e}):j(F,e)}castThumbnail(e){return"string"==typeof e?new A({url:e}):j(A,e)}castBasemap(e){return E(e)}set visibleLayers(e){this._set("visibleLayers",s(e,this._get("visibleLayers"),B))}castVisibleLayers(e){return e&&"function"==typeof e.map?e.map(e=>{if("string"==typeof e)return{id:e};if(e instanceof _){const t=H(e);return{id:e.id,sublayerIds:t}}return e.id?{id:e.id,sublayerIds:"sublayerIds"in e?e.sublayerIds:void 0}:(l.getLogger(this).warn('Invalid visible layer, expected { id }, Layer or "id"'),e)}):null}async _updateVisibleLayers(e){const t=[];await Promise.allSettled(this._getLayers(e.map).map(i=>e.whenLayerView(i).then(e=>{if(e.visible){const n=H(i);t.push(new O({id:e.layer.id,sublayerIds:n}))}})).toArray()),this.visibleLayers.removeAll(),this.visibleLayers.addMany(t)}async updateFrom(e,t){const i={format:"png",quality:80,width:120,height:75,disableDecorations:!0,...t?.screenshot};await e.when(),this.viewpoint=e.viewpoint.clone(),this.environment.lighting="virtual"===e.environment.lighting.type?x.prototype.clone.apply(e.environment.lighting):U.prototype.clone.apply(e.environment.lighting),this.environment.weather=e.environment.weather.clone(),this.enabledFocusAreas=new o(e.focusAreasView?.enabledAreas.map(({id:e})=>e)??[]),this.basemap=e.map.basemap?.clone()||null,this.ground=e.map.ground?R.fromGround(e.map.ground):null,this.timeExtent=e.timeExtent?.clone()??null,this.elements.analyses.updateFrom(e),await this._updateVisibleLayers(e);const n=await e.takeScreenshot(i);return this.thumbnail=new A({url:n.dataUrl}),this}async applyTo(e,t){null!=this._applyToController&&this._applyToController.abort();let i=new AbortController;this._applyToController=i;const r=h(t,()=>i?.abort()),o=()=>{this._applyToController===i&&(this._applyToController=null),i=null,r?.remove()};try{await y(()=>e.ready,i.signal)}catch(c){throw o(),c}if(i.signal.aborted)throw o(),d();const s=e.resourceController.scheduler.registerTask(k.SLIDE);let a=!1;const l={animate:!0,...t,signal:this._applyToController.signal},p=async()=>{await Promise.all([s.schedule(async()=>a=await this._setViewpointOfInterest(e,l)),s.schedule(()=>this._applyBasemap(e,l),l.signal),s.schedule(()=>this._loadLayersWithSublayerVisibility(e))]),await Promise.all([s.schedule(()=>this._applyLayerVisibility(e),l.signal),s.schedule(()=>this._applyFocusAreaEnabled(e.map?.focusAreas.areas)),s.schedule(()=>this._applyGround(e),l.signal),s.schedule(()=>this.elements.analyses.applyTo(e),l.signal),s.schedule(()=>this._applyViewpoint(e,l),l.signal),s.schedule(()=>e.timeExtent=this.timeExtent?.clone()??null,l.signal),s.schedule(()=>e.environment.weather=this.environment.weather.clone())])},m=await n(e.addUpdatingPromise(p()));if(a&&(e.contentCamera=null),s.remove(),o(),!1===m.ok)throw m.error;return this}async _applyBasemap(e,t){if(this.basemap){try{await this.basemap.load(t)}catch(i){if(u(i))throw i}e.map.basemap=S(this.basemap,e.map.basemap)}}_applyGround(e){this.ground&&(e.map.ground=this.ground.cloneAndApplyTo(e.map.ground))}_applyFocusAreaEnabled(e){if(e&&this.enabledFocusAreas)for(const t of e)t.enabled=this.enabledFocusAreas.includes(t.id)}_getLayers(e){const t=new o;return this._collectLayers(e,t),this._collectLayers(e.ground,t),t}_collectLayers(e,t){e.layers.forEach(e=>{e.persistenceEnabled&&(t.add(e),"layers"in e&&this._collectLayers(e,t))})}async _loadLayersWithSublayerVisibility(e){this.visibleLayers&&await Promise.allSettled(this._getLayers(e.map).items.map(e=>{const t=this.visibleLayers.find(t=>t.id===e.id)?.sublayerIds;return t?e.load():null}))}_applyLayerVisibility(e){if(!this.visibleLayers)return;this._getLayers(e.map).forEach(e=>{const t=this.visibleLayers.find(t=>t.id===e.id);e.visible=null!=t;const i=t?.sublayerIds,n=W(e);i&&n&&n.forEach(e=>e.visible=i.includes(e.id))})}async _setViewpointOfInterest(e,t){if(e.state.fixedContentCamera||!this.viewpoint||t?.ignoreViewpoint||!t?.useDestinationCamera)return!1;const{toCameraAsync:i}=await import("../views/3d/support/viewpointUtils.js"),n=await i(e,this.viewpoint);return e.contentCamera=n,null!=n}async _applyViewpoint(e,t){if(this._applyCachedCameraTrackingEnabled(e),this.viewpoint&&!t.ignoreViewpoint){const i=this.environment.lighting;if(t.animate&&"sun"===i.type&&i.date)return this._animateToLighting(e,t);t.animate&&(e.environment.applyLighting(i.clone()),await e.goTo(this.viewpoint,t)),e.viewpoint=this.viewpoint}e.environment.applyLighting(this.environment.lighting.clone())}async _animateToLighting(e,t){let i=null;"virtual"!==e.environment.lighting.type&&"virtual"!==this.environment.lighting.type&&("global"===e.viewingMode&&(i=this._animateLightingWithCamera(e,e.environment.lighting,this.environment.lighting)),e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1),e.environment.lighting.directShadowsEnabled=this.environment.lighting.directShadowsEnabled,"virtual"===this.environment.lighting.type||"virtual"===e.environment.lighting.type?(e.environment.applyLighting(this.environment.lighting.clone()),"virtual"!==e.environment.lighting.type&&(e.environment.cachedCameraTrackingEnabled=e.environment.lighting.cameraTrackingEnabled,e.environment.lighting.cameraTrackingEnabled=!1)):null!=this.environment.lighting.displayUTCOffset&&(e.environment.lighting.displayUTCOffset=this.environment.lighting.displayUTCOffset);return e.goTo(this.viewpoint,t).then(()=>{this._applyCachedCameraTrackingEnabled(e),e.environment.applyLighting(this.environment.lighting.clone())}).catch(t=>{throw null==e.animation&&this._applyCachedCameraTrackingEnabled(e),t}).finally(()=>{c(i)})}_applyCachedCameraTrackingEnabled(e){null!=e.environment.cachedCameraTrackingEnabled&&(e.environment.lighting.cameraTrackingEnabled=e.environment.cachedCameraTrackingEnabled,e.environment.cachedCameraTrackingEnabled=null)}_getTime(e){return[b(e.getTime()),v(3600*e.getUTCHours()+60*e.getUTCMinutes()+e.getUTCSeconds())]}_setTime(e,t,i){return e.setTime(t),e.setUTCHours(i/3600),e.setUTCMinutes(i%3600/60),e.setUTCSeconds(i%3600%60),e}_animateLightingWithCamera(e,t,i){const n=new Date(t.date.toString()),[r,o]=this._getTime(n),[s,a]=this._getTime(i.date),l=K(o,a),p=e.renderCoordsHelper,m=C();p.toRenderCoords(e.camera.position,m);const c=C(),h=C();null!=this.viewpoint.camera&&p.toRenderCoords(this.viewpoint.camera.position,c);const d=new Date;return g(()=>e.camera,e=>{p.toRenderCoords(e.position,h);const i=L(m,h),n=L(c,h);let a=0;i+n!==0&&(a=i/(i+n));const u=r+(s-r)*a,y=Q(o,v(l*a));t.date=this._setTime(d,u,y)})}write(e,t){const i=super.write(e,t);return i?.elements&&0===Object.keys(i.elements).length&&delete i.elements,i}static createFrom(e,t){return(new this).updateFrom(e,t)}};e([w({type:String,json:{write:{isRequired:!0}}})],G.prototype,"id",void 0),e([w({type:P,json:{default:()=>new P({text:""}),write:{isRequired:!0}}})],G.prototype,"title",void 0),e([f("title")],G.prototype,"castTitle",null),e([w({type:F,json:{write:{overridePolicy:e=>({enabled:!(!e||!e.text)})}}})],G.prototype,"description",void 0),e([f("description")],G.prototype,"castDescription",null),e([w({type:Boolean,nonNullable:!0,json:{write:!0,default:!1}})],G.prototype,"hidden",void 0),e([w({type:A,json:{default:()=>new A({url:""}),write:{isRequired:!0}}})],G.prototype,"thumbnail",void 0),e([f("thumbnail")],G.prototype,"castThumbnail",null),e([w({type:i,nonNullable:!0,json:{write:{isRequired:!0}}})],G.prototype,"viewpoint",void 0),e([w({type:t,json:{read:{source:"baseMap"},write:{target:"baseMap"}}})],G.prototype,"basemap",void 0),e([f("basemap")],G.prototype,"castBasemap",null),e([w({type:R,json:{write:!0}})],G.prototype,"ground",void 0),e([w({type:M,json:{write:!0,default:"caption"},nonNullable:!0})],G.prototype,"layout",void 0),e([w({type:B,json:{write:{isRequired:!0}}})],G.prototype,"visibleLayers",null),e([f("visibleLayers")],G.prototype,"castVisibleLayers",null),e([w({type:o.ofType(String),json:{write:!0},clonable:e=>e?new o(e.items):null})],G.prototype,"enabledFocusAreas",void 0),e([w({type:D,json:{write:!0}})],G.prototype,"environment",void 0),e([w(V)],G.prototype,"timeExtent",void 0),e([w({type:I,nonNullable:!0,json:{write:!0}})],G.prototype,"elements",void 0),G=e([T("esri.webscene.Slide")],G);const N=G;function W(e){if("building-scene"===e.type||"map-image"===e.type)return e.allSublayers.toArray()}function H(e){const t=W(e);if(t)return t.filter(e=>e.visible).map(e=>e.id)}const J=v(86400),z=v(43200);function K(e,t){let i=t-e;return i>z&&(i-=J),i<-z&&(i+=J),v(i)}function Q(e,t){return v(p(e+t,J))}export{N as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import a from"../../core/Error.js";import{makeHandle as i,handlesGroup as r,abortHandle as s}from"../../core/handleUtils.js";import"../../core/has.js";import o from"../../core/Logger.js";import{removeMaybe as n,destroyMaybe as l}from"../../core/maybe.js";import{debounce as d,isPromiseLike as c}from"../../core/promiseUtils.js";import{watch as u,when as h,initial as p,whenOnce as m,syncAndInitial as f}from"../../core/reactiveUtils.js";import{generateBracedUUID as w}from"../../core/uuid.js";import{property as g}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as y}from"../../core/accessorSupport/decorators/subclass.js";import{isSharedTemplateOrMetadata as v,isSharedTemplate as F,isStandardFeatureTemplate as _}from"../../editing/templateUtils.js";import b from"../../layers/GraphicsLayer.js";import{isTable as M}from"../../layers/support/layerUtils.js";import{isNumber as I}from"../../support/guards.js";import{getDisplayedSymbol as V}from"../../symbols/support/symbolUtils.js";import{getDrawHelpMessage as S}from"../../views/draw/support/helpMessageUtils.js";import k from"../../views/draw/support/HighlightHelper.js";import A from"../../views/interactive/sketch/SketchOptions.js";import C from"../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{temporaryHighlightName as P}from"../../views/support/HighlightDefaults.js";import E from"./CreateFeaturesWorkflowData.js";import{isModelUpload as T,handleModelUpload as H}from"./modelUploadUtils.js";import U from"./Workflow.js";import{createToolFromGeometryType as j,getServiceEditsFromWorkflowData as L,getServiceInfoForLayer as x,orderEditsByRelationshipDependencies as O,getFullTemplateForCreationInfo as z,getServiceLayersById as W,startCreatingNewFeature as D,findLayerInfo as R,updateGraphicSymbolWhenRequired as N,isTerminalUpdateEventType as G,getVisualVariableAttributes as K,startUpdatingFeatureGeometry as Z,createWorkflowSteps as q,avoidFeatureTemplateSelectionWithOnlyOneItem as B,getCreationAttributes as J,setUpSketchCreateWatchers as Q,setRelationshipFields as X,prepareAttachmentsForCreateFeaturesWorkflow as Y,showProgressCursor as $,setVisualVariablesAndElevationInfoForUpdate as ee,visualVariableInteractiveUpdate as te}from"./workflowUtils.js";import ae from"../FeatureForm/FeatureFormViewModel.js";import ie from"../Sketch/SketchViewModel.js";var re;const se=Symbol(),oe=Symbol(),ne=Symbol(),le=Symbol(),de={point:["point"],multipoint:["multipoint"],polygon:["polygon","freehandPolygon","rectangle","circle"],polyline:["polyline","freehandPolyline"],mesh:[],multipatch:[]};let ce=re=class extends U{constructor(e){super(e),this.type="create-features",this.createFeatureState="create-new",this.data=void 0,this.isNested=!1,this._getDrawMeshHelpMessage=void 0,this._webStyleCache=new Map,this._featureFormHandle=null,this._visualVariableAttributes={rotation:null,size:null},this._featureFormViewModel=new ae,this._sketchViewModel=null,this._attachmentFileInfos=new Map,this._isActive=!0}initialize(){this.isNested&&(this._isActive=!1),this._initializeSketchViewModel()}destroy(){this._sketchViewModel.destroy()}get featureFormViewModel(){return this._featureFormViewModel}get hasPendingEdits(){if(this.pendingFeatures.some(e=>!!this.data.getEditsForPendingFeature(e)?.modified))return!0;const{creationInfo:e,upload:t}=this.data,a=this._sketchViewModel,{activeComponent:i}=a,r=a.createGraphic?.geometry?.type;return!("polyline"!==r&&"polygon"!==r&&"multipoint"!==r||"draw-2d"!==i?.type&&"draw-3d"!==i?.type)&&i.drawOperation.committedVertices.length>0||(!(!t||"pending"!==t.state&&"success"!==t.state)||!!e?.geometryToPlace)}get hasPreviousStep(){return this._stepIndex>0||"update-pending"===this.createFeatureState&&!!this.data.selectedPendingFeature&&!this.parent&&!T(this.data.creationInfo)}get helpMessage(){const{creationInfo:e,viewModel:t}=this.data;if("creating-features"!==this.stepId||!e)return;const a=e.layer.geometryType,i=this._sketchViewModel.createGraphic;if("mesh"===a){this._getDrawMeshHelpMessage||import("../../views/draw/support/helpMessageUtils3d.js").then(e=>{this._getDrawMeshHelpMessage=e.getDrawMeshHelpMessage});const{view:e}=t;return"3d"===e?.type?this._getDrawMeshHelpMessage?.(i,e):void 0}const r=this._sketchViewModel.activeCreateToolDrawMode,s=this._sketchViewModel.activeTool;return S("rectangle"===s?"rectangle":"circle"===s?"circle":a,i?.geometry,r)}get layer(){return this.data.creationInfo?.layer}get numPendingFeatures(){return this.pendingFeatures.length}get numPendingFeaturesExcludingHidden(){return this.pendingFeatures.filter(e=>this.data.isDisplayable(e)).length}get parent(){return this.data.parent}get parentLayer(){return this.parent?.data.editorItem.layer}get pendingFeatures(){return this.data.pendingFeatures}get keyboardCancellationEnabled(){return 0===this.numPendingFeatures}get reliesOnOwnerAdminPrivileges(){return this.data.editorItem?.capabilities.create.reliesOnOwnerAdminPrivileges??!1}get shouldShowAttachments(){return(this.data.selectedPendingFeature&&this.data.editorItem?.capabilities.create.attachments.enabled)??!1}get shouldAllowAttachmentEditing(){return this.shouldShowAttachments}get sketchViewModel(){return this._sketchViewModel}get test(){}get availableCreateTools(){const e=this.data.creationInfo?.layer.geometryType,t=this.data.viewModel.view;if(!e)return[];if(this.data.creationInfo?.maxFeatures&&this.data.creationInfo.maxFeatures<=this.numPendingFeatures)return[];if(v(this.data.fullTemplate)){const{tool:t}=j(e,this.data.fullTemplate);return[t]}return"2d"!==t?.type&&"multipoint"===e?[]:[...de[e]]}get _attachmentsActive(){const e=this.data.viewModel.attachmentsViewModel.mode,t=this.stepId;return this.shouldShowAttachments&&("add"===e||"edit"===e||"adding-attachment"===t||"editing-attachment"===t)}async enter(){this._isActive=!0,"awaiting-feature-creation-info"!==this.stepId&&await this._updatingHandles.addPromise(this._setUpCreatingFeaturesStep())}exit(){this._isActive=!1,this.removeHandles([ne])}async updatePendingFeature(e){if(e!==this.data.selectedPendingFeature)return this._sketchViewModel.cancel(),this._startUpdating({feature:e})}async start(){return await super.start(),M(this.data.creationInfo?.layer)?null:{enter:async()=>{},exit:async()=>{},viewModel:this._sketchViewModel}}async save(){const{featureFormViewModel:e}=this;if(e.pendingSubtypeChoice)return;e.submit(),this._stashValidationState();const t=this.data.selectedPendingFeature,a=this._hasValidationErrors(t)?t:this.data.pendingFeatures.find(e=>this._hasValidationErrors(e));return a?(await this._startUpdating({feature:a}),void e?.submit()):super.save()}back(e){return"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||T(this.data.creationInfo)||this._attachmentsActive||this.parent?super.back(e):this._clearSelectedFeature()}previous(e){return"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||T(this.data.creationInfo)||this._attachmentsActive?super.previous(e):this._clearSelectedFeature()}cancelFeature(e){this.data.isSharedTemplateWorkflow?o.getLogger(this).warn("Cannot cancel individual features created by shared templates."):(this.data.removePendingFeature(e),this.sketchViewModel.layer.graphics.remove(e))}static create(e){const{addAttachmentsCallback:t,applyEdits:a,applyEditsFeatureService:i,isNested:r,creationInfo:s,parent:o,snappingManager:n,startAt:l,viewModel:d}=e,c=e.sketchOptions??new A,u=s?.layer,h=u?d.findEditorItemForLayer(u):void 0,p=new re({data:new E({creationInfo:s,editorItem:h,parent:o,sketchOptions:c,snappingManager:n,viewModel:d}),isNested:r,onCommit:async e=>{const{creationInfo:r}=e;if(!r)return;p._sketchViewModel.cancel();const s=e.pendingFeatures.toArray(),{layer:o}=r,n=o.capabilities?.editing.supportsGlobalId&&"globalIdField"in o,l=p._attachmentFileInfos,{fullTemplate:c}=e,u=L(p.data),h=F(c)&&u;if(n){if(me(s),h){let t=we(u,l);const a=await x(o,d.view);a&&(t=O({edits:t,serviceInfo:a,view:d.view,findOriginalFeature:t=>e.getEditsForPendingFeature(t)?.initialFeature??t})),await i(c.featureService,t,{globalIdUsed:!0,gdbVersion:c.layer.gdbVersion??void 0})}else{const e=fe(s,l);await a(o,e,{globalIdUsed:!0})}return}const m=h?await i(c.featureService,u,{gdbVersion:c.layer.gdbVersion??void 0}):[await a(o,{addFeatures:s})];m&&l.size>0&&await Promise.all(m.map(e=>{if(e?.addFeatureResults)return t(o,pe(s,e.addFeatureResults,o,l))}))}});return p._set("steps",this._createWorkflowSteps(p,l)),p}_fadeExistingFeatures(e){if("effect"in e){const t=e.effect;return e.effect="saturate(0.6) opacity(0.8)",i(()=>e.effect=t)}const t=e.opacity;return e.opacity=.7,i(()=>e.opacity=t)}async _initializeFullTemplateAndExecutorInfo(e){const{creationInfo:t}=e,{view:a}=e.viewModel;if(!t||!a)return null;const i=await z(t,a);if(e.fullTemplate=i,i&&F(i)){const{createTemplateExecutor:r}=await import("../../editing/sharedTemplates/executor/createTemplateExecutor.js"),s={completionResults:[],executor:await r(i),serviceLayersById:await W(t.layer,a)};e.templateExecutorInfo=s}return i}async _startCreating(){this.removeHandles(oe);const{data:e}=this;if(!e.creationInfo)return;const t=this.data.creationInfo?.maxFeatures;if(t&&this.numPendingFeatures>=t)return this.sketchViewModel.cancel(),void(this.numPendingFeatures&&await this._startUpdating({feature:this.pendingFeatures.at(-1)}));this.createFeatureState="create-new",await D(this._sketchViewModel,e,this._webStyleCache)}async _clearSelectedFeature(){const e=this._featureFormViewModel.pendingSubtypeChoice;e&&(e.resolve("undo"),await e.promise),this._stashValidationState(),this.sketchViewModel.cancel(),this.data.selectedPendingFeature=null,this._featureFormHandle=n(this._featureFormHandle),this._featureFormViewModel.feature=null;const t=this.data.viewModel.attachmentsViewModel;"add"!==t.mode&&"edit"!==t.mode||await(this.data.viewModel.activeWorkflow?.previous())}_stashValidationState(){const e=this._featureFormViewModel.feature,t=e&&this.data.getEditsForPendingFeature(e);t&&(t.submittable=this._featureFormViewModel.submittable)}async _selectFeatureForUpdate({feature:e,initialFeature:t=e}){this._stashValidationState();const{data:a,pendingFeatures:i,_webStyleCache:s}=this;i.includes(e)||a.addPendingFeature(e,t),a.selectedPendingFeature=e;const{_featureFormViewModel:o,_sketchViewModel:l}=this,{creationInfo:d,viewModel:c}=a,{attachmentsViewModel:h,layerInfos:p,view:m}=c;if(!m||!d)return;n(this._featureFormHandle);const f=e.sourceLayer,w=R(p,f),g=w?.formTemplate,y=m.spatialReference;o.set({editType:"INSERT",feature:e,formTemplate:g,spatialReference:y,map:m.map}),"add"!==h.mode&&"edit"!==h.mode||await(c.activeWorkflow?.previous()),h.graphic=e,h.fileInfos.removeAll(),h.mode="view";(this._attachmentFileInfos.get(e)||[]).forEach(({file:e,form:t})=>h.addFile(e,t)),await N(e,s,"2d"===m.type?m.scale:null);const v=a.getEditsForPendingFeature(e);this._featureFormHandle=r([o.on("value-change",async({fieldName:t,value:a})=>{if(v?.updateAttributes(o.getValues()),I(a)){const e=this._visualVariableAttributes;e.size&&!e.size.isUpdatingInteractively&&t===e.size.field&&e.size.setInitialValue(a),e.rotation&&!e.rotation.isUpdatingInteractively&&t===e.rotation.field&&e.rotation.setInitialValue(a)}await N(e,s,"2d"===m.type?m.scale:null)}),l.on(["update","undo","redo"],e=>{("undo"===e.type||"redo"===e.type||"update"===e.type&&null!=e.toolEventInfo&&G(e.toolEventInfo.type))&&o.notifyFeatureGeometryChanged()}),u(()=>o.feature?.sourceLayer,t=>e.sourceLayer=t),u(()=>[o.feature,o.submittable],()=>this._stashValidationState())]),this.createFeatureState="update-pending"}async _startUpdating({feature:e,initialFeature:t=e}){await this._selectFeatureForUpdate({feature:e,initialFeature:t});const{_sketchViewModel:a,data:i}=this,{creationInfo:r,viewModel:s}=i,{view:o}=s;if(!o||!r)return;const n=e.sourceLayer??r.layer;return M(n)?void 0:(this._visualVariableAttributes=K(e),Z({graphic:e,sketchViewModel:a,sourceLayer:n,visualVariables:this._visualVariableAttributes,webStyleCache:this._webStyleCache}))}static _createWorkflowSteps(e,t="awaiting-feature-creation-info"){const{data:a}=e,i=q(["awaiting-feature-creation-info","creating-features","adding-attachment","editing-attachment"],t,{"awaiting-feature-creation-info":()=>({id:"awaiting-feature-creation-info",async setUp(){const{creationInfo:t,viewModel:i}=a,{view:r}=i;r&&(T(t)?e.addHandles(await H({view:r,data:a,next:()=>e.next(),cancel:()=>i.cancelWorkflow({warnIfNoWorkflow:!1})}),this.id):(a.parent&&t&&e.addHandles(i.restrictFeatureTemplatesViewModelToLayer(t.layer),this.id),e.addHandles(i.featureTemplatesViewModel.on("select",({item:t})=>{t&&(a.creationInfo={...a.creationInfo,layer:t.layer,template:t.template},e.next())}),this.id)))},async tearDown(){e.removeHandles(this.id)}}),"creating-features":()=>({id:"creating-features",async setUp(){e._isActive&&await e._setUpCreatingFeaturesStep()},async tearDown(t){const{viewModel:i}=a;t.canceled&&(e.removeHandles([ne,se,oe,le]),i.attachmentsViewModel.fileInfos.removeAll(),e._attachmentFileInfos.clear())}}),"adding-attachment":()=>({id:"adding-attachment",parent:"creating-features",async setUp(){},async tearDown(){const{attachmentsViewModel:t}=a.viewModel,{graphic:i,fileInfos:r}=t;e._attachmentFileInfos.set(i,r.toArray()),t.mode="view"}}),"editing-attachment":()=>({id:"editing-attachment",parent:"creating-features",async setUp(){},async tearDown(){const{attachmentsViewModel:t}=a.viewModel,{graphic:i,fileInfos:r}=t;e._attachmentFileInfos.set(i,r.toArray()),t.mode="view"}})});return B(a,i)}static _configureSketchViewModel(e){const{data:t}=e,a=e._webStyleCache,{creationInfo:s,viewModel:o}=t,{view:n}=o,l=e._sketchViewModel,c=[];if(!n)return i();if("2d"===n.type){s&&c.push(e._fadeExistingFeatures(s.layer));const t=d((e,t)=>Promise.all(e.map(e=>N(e,a,t))));c.push(u(()=>n.scale,e=>t(l.layer.graphics,e)))}const p=J(t.fullTemplate,s?.attributeOverrides),m=u(()=>l.createGraphic,i=>{i&&!e.hasHandles(oe)&&e._updatingHandles.addPromise(Q({creationAttributes:p,data:t,sketchViewModel:l,view:n,webStyleCache:a}).then(t=>e.addHandles(t,oe)))}),f=async t=>{if("cancel"!==t.state&&"complete"!==t.state||e.removeHandles(oe),"cancel"===t.state&&null!==n.activeTool&&n.activeTool!==e.sketchViewModel.activeComponent&&(await e._waitForActiveToolCleared(),await e._startCreating()),"complete"===t.state&&t.graphic){const a=await e._processEdits(t.graphic,{scale:"2d"===n.type?n.scale:null,useSourceLayer:!0,webStyleCache:e._webStyleCache});a&&(await e._waitForActiveToolCleared(),await e._startUpdating({feature:a}))}},w=async a=>{const{attachmentsViewModel:i}=o,{_featureFormViewModel:r}=e;if(a.graphics.length>1)return void await e._clearSelectedFeature();const d=a.graphics[0];if("complete"===a.state){const{submittable:t}=r;if(e.numPendingFeatures!==s?.maxFeatures&&t||r.submit(),await e._clearSelectedFeature(),"add"!==i.mode&&"edit"!==i.mode||await(o.activeWorkflow?.previous()),!a.aborted&&n.activeTool===e.sketchViewModel.activeComponent&&(await e.sketchViewModel.wait(),"ready"===e.sketchViewModel.state&&"mesh"!==e.data.creationInfo?.layer.geometryType))return e._startCreating()}else{if("start"===a.state)return d.sourceLayer??=t.creationInfo?.layer,await ee({sketchViewModel:l,graphic:d,visualVariables:e._visualVariableAttributes,webStyleCache:e._webStyleCache,sourceLayer:d.sourceLayer}),e._selectFeatureForUpdate({feature:d});if("active"===a.state){await e.updatePendingFeature(d);const t=e._visualVariableAttributes;te(n,d,a,t)&&await N(d,e._webStyleCache,"2d"===n.type?n.scale:null);const i=d.attributes,{rotation:s,size:o}=t;if(null!=s){const{field:e}=s;r.setValue(e,i[e])}if(null!=o){const{field:e}=o;r.setValue(e,i[e])}}}},g=async a=>{if(a.graphics.forEach(e=>{t.removePendingFeature(e)}),!T(t.creationInfo))return e._startCreating()},y=async()=>{if(T(t.creationInfo))try{await e.data.viewModel.back()}catch{}return e._startCreating()};c.push(m,l.on("create",t=>e._updatingHandles.addPromise(f(t))),l.on("update",t=>e._updatingHandles.addPromise(w(t))),l.on("delete",t=>e._updatingHandles.addPromise(g(t))),h(()=>!e.numPendingFeatures,()=>e._updatingHandles.addPromise(y())),i(()=>{l.cancel()}),ue(l,t),...he(t));const v=r(c);return l.addHandles(v),v}_initializeSketchViewModel(){const{data:e}=this,{view:t}=e.viewModel,a=new b({elevationInfo:e.creationInfo?.layer.elevationInfo,internal:!0,listMode:"hide",title:"createFeaturesWorkflow-internal"}),r=new ie({layer:a,creationMode:"single",sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,updateOnGraphicClick:!1,defaultUpdateOptions:{multipleSelectionEnabled:!1},view:t});this._sketchViewModel=r,t?.map.add(a),this.addHandles([i(()=>{t?.destroyed||t?.map.remove(a),a.destroy()}),u(()=>this.numPendingFeatures>0,e=>this._sketchViewModel.updateOnGraphicClick=e,p)])}_hasValidationErrors(e){return!!e&&(!this.data.isSubmittable(e)||!!this._featureFormViewModel.validateContingencyConstraints(e.attributes,{includeIncompleteViolations:!0})?.length)}async _processEdits(e,t){const{data:a,_featureFormViewModel:i}=this,{layerInfos:r,view:s}=a.viewModel;i.editType="INSERT",i.map=s?.map,i.spatialReference=s?.spatialReference;const{templateExecutorInfo:o}=a;if(!o){const t=e.clone();return t.geometry=null,await this._addAndInitializeEdits(e,t),e}const n=this.sketchViewModel.layer;n.remove(e);const{executor:l}=o,d=l(e.geometry,"completion"),u=c(d)?await d:d;o.completionResults.push(u),X(u.relationships),i.editType="INSERT",i.map=s?.map,i.spatialReference=s?.spatialReference,u.primary&&a.creationInfo?.attributeOverrides&&(u.primary.graphic.attributes={...u.primary.graphic.attributes,...a.creationInfo.attributeOverrides});for(const c of u.edits){let e=null;if(c.addFeatures)for(const a of c.addFeatures){const i=a.clone();i.geometry=null,null!=a.geometry&&(a.symbol=await V(a,t),n.add(a)),a.sourceLayer!==e?.layer&&(e=R(r,a.sourceLayer));const s=!!u.associationGraphics?.has(a);await this._addAndInitializeEdits(a,i,e,s)}}i.feature=null,await m(()=>!i.updating);return u.edits.reduce((e,t)=>e+(t.addFeatures?.length??0),0)>1?null:u.primary?.graphic}async _addAndInitializeEdits(e,t,a,i=!1){const{data:r,_featureFormViewModel:s}=this,{layerInfos:o}=r.viewModel,n=r.addPendingFeature(e,t,{isAssociation:i});a??=R(o,e.sourceLayer),s.feature=e,s.formTemplate=a?.formTemplate,await m(()=>!s.updating),n.submittable=s.submittable}async _setUpCreatingFeaturesStep(){if(this.hasHandles(ne))return;const{data:e,sketchViewModel:s}=this,{creationInfo:o,viewModel:l}=e,{attachmentsViewModel:d,view:c}=l;if(!c||!o?.layer)throw new a("missing-parameters","CreateFeaturesWorkflow requires a view and creationInfo.");const{initialFeature:h,layer:m}=o,f=[],w=[];this._featureFormHandle=n(this._featureFormHandle),this._visualVariableAttributes={rotation:null,size:null},e.editorItem=l.findEditorItemForLayer(o.layer),o.template&&(null==e.fullTemplate&&await this._initializeFullTemplateAndExecutorInfo(e),w.push(i(()=>{e.templateExecutorInfo&&(e.templateExecutorInfo.completionResults=[])}))),s.allowDeleteKey=!e.isSharedTemplateWorkflow,Y(d),f.push(u(()=>d.mode,e=>{switch(e){case"add":this.go("adding-attachment");break;case"edit":this.go("editing-attachment")}}));const g=$(c);f.push(g);const y=M(o.layer),{template:F}=o,b=!F||_(F)||v(F)&&"feature"===F.type,I=y&&b;try{if(I){const a=h??new t({attributes:J(e.fullTemplate,o.attributeOverrides),sourceLayer:m}),i=await this._processEdits(a);i&&await this._startUpdating({feature:i})}else f.push(re._configureSketchViewModel(this)),h?(T(o)&&o.geometryToPlace&&(h.attributes=J(e.fullTemplate,o.attributeOverrides)),s.layer.add(h),await this._startUpdating({feature:h})):await this._startCreating()}finally{g.remove()}const V=i(()=>{for(const t of e.pendingFeatures)s.layer.remove(t),e.removePendingFeature(t)}),S=u(()=>c?.timeZone,e=>{this._featureFormViewModel.timeZone=e,this.data.timeZone=e},p),k=i(()=>{T(o)&&l.cancelWorkflow({warnIfNoWorkflow:!1})});this._featureFormHandle&&f.push(this._featureFormHandle),this.addHandles(f,this._handleKeys.beforeCommit),this.addHandles(w,this._handleKeys.afterCommit),this.addHandles([i(()=>d.fileInfos.removeAll()),r(f),r(w),k,V,S],ne)}async _waitForActiveToolCleared(){const e=this.data.viewModel.view;if(null==e?.activeTool)return;const t=new AbortController;this.addHandles(s(t),le),await m(()=>null==e?.activeTool,t.signal),t.abort()}};function ue(e,t){let a=null;const s=()=>e.snappingOptions.featureSources,o=()=>(a=new C({layer:e.layer}),s().add(a),a),n=()=>{null!=a&&(s().remove(a),a=l(a))};return r([u(()=>{const e=t.creationInfo?.layer,a=s().find(t=>t.layer===e);return{hasFeatureLayerSource:!!a,enabled:a?.enabled??!1}},({hasFeatureLayerSource:e,enabled:t})=>{if(!e)return n();a??=o(),a.enabled=t},f),i(n)])}function he(e){const t=e.viewModel.view;if(!t)return[];const a=[];if("3d"===t.type){const r=new k({view:t});a.push(u(()=>e.selectedPendingFeature,(e,t)=>{r.remove(e),r.add(t)}),i(()=>r.destroy()))}const r=new k({view:t,highlightName:P});return a.push(u(()=>e.temporaryHighlightFeature,e=>{r.removeAll(),r.add(e)}),i(()=>r.destroy())),a}function pe(e,t,a,i){const r=[];return t.forEach((t,s)=>{if(!t.error){const o=e[s],n=i.get(o)||[];o.attributes[a.objectIdField]=t.objectId,n.forEach(({form:e})=>r.push({feature:o,attachment:e}))}}),r}function me(e){for(const t of e){const{sourceLayer:e}=t;e&&"globalIdField"in e&&null!=e.globalIdField&&(t.attributes[e.globalIdField]??=w())}}function fe(e,t){const a=[];if(!t||0===t.size)return{addFeatures:e};for(const[i,r]of t)for(const{file:e}of r)a.push({feature:i,attachment:{globalId:w(),data:e}});return a.length?{addFeatures:e,addAttachments:a}:{addFeatures:e}}function we(e,t){return e.map(e=>{const{addFeatures:a}=e;if(!a||0===a.length)return e;const i=[];for(const r of a){const e=t.get(r);if(e)for(const{file:t}of e)i.push({feature:r,attachment:{globalId:w(),data:t}})}return i.length?{...e,addAttachments:i}:e})}e([g()],ce.prototype,"createFeatureState",void 0),e([g()],ce.prototype,"data",void 0),e([g({constructOnly:!0})],ce.prototype,"isNested",void 0),e([g()],ce.prototype,"featureFormViewModel",null),e([g()],ce.prototype,"hasPendingEdits",null),e([g()],ce.prototype,"hasPreviousStep",null),e([g()],ce.prototype,"_getDrawMeshHelpMessage",void 0),e([g()],ce.prototype,"helpMessage",null),e([g()],ce.prototype,"layer",null),e([g()],ce.prototype,"parent",null),e([g()],ce.prototype,"parentLayer",null),e([g()],ce.prototype,"keyboardCancellationEnabled",null),e([g()],ce.prototype,"reliesOnOwnerAdminPrivileges",null),e([g()],ce.prototype,"shouldShowAttachments",null),e([g()],ce.prototype,"shouldAllowAttachmentEditing",null),e([g()],ce.prototype,"sketchViewModel",null),e([g()],ce.prototype,"availableCreateTools",null),e([g()],ce.prototype,"_attachmentsActive",null),ce=re=e([y("esri.widgets.Editor.CreateFeaturesWorkflow")],ce);const ge=ce;export{ge as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import a from"../../core/Error.js";import{makeHandle as i,handlesGroup as r,abortHandle as s}from"../../core/handleUtils.js";import"../../core/has.js";import o from"../../core/Logger.js";import{removeMaybe as n,destroyMaybe as l}from"../../core/maybe.js";import{debounce as d,isPromiseLike as c}from"../../core/promiseUtils.js";import{watch as u,when as h,initial as p,whenOnce as m,syncAndInitial as f}from"../../core/reactiveUtils.js";import{generateBracedUUID as w}from"../../core/uuid.js";import{property as g}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as y}from"../../core/accessorSupport/decorators/subclass.js";import{isSharedTemplateOrMetadata as v,isSharedTemplate as F,isStandardFeatureTemplate as _}from"../../editing/templateUtils.js";import b from"../../layers/GraphicsLayer.js";import{isTable as M}from"../../layers/support/layerUtils.js";import{isNumber as I}from"../../support/guards.js";import{getDisplayedSymbol as V}from"../../symbols/support/symbolUtils.js";import{getDrawHelpMessage as k}from"../../views/draw/support/helpMessageUtils.js";import S from"../../views/draw/support/HighlightHelper.js";import A from"../../views/interactive/sketch/SketchOptions.js";import C from"../../views/interactive/snapping/FeatureSnappingLayerSource.js";import{temporaryHighlightName as P}from"../../views/support/HighlightDefaults.js";import E from"./CreateFeaturesWorkflowData.js";import{isModelUpload as T,handleModelUpload as H}from"./modelUploadUtils.js";import L from"./Workflow.js";import{createToolFromGeometryType as U,getServiceEditsFromWorkflowData as j,getServiceInfoForLayer as x,orderEditsByRelationshipDependencies as O,getFullTemplateForCreationInfo as z,getServiceLayersById as W,startCreatingNewFeature as D,findLayerInfo as R,updateGraphicSymbolWhenRequired as G,isTerminalUpdateEventType as N,getVisualVariableAttributes as K,startUpdatingFeatureGeometry as Z,createWorkflowSteps as q,avoidFeatureTemplateSelectionWithOnlyOneItem as B,getCreationAttributes as J,setUpSketchCreateWatchers as Q,setRelationshipFields as X,prepareAttachmentsForCreateFeaturesWorkflow as Y,showProgressCursor as $,setVisualVariablesAndElevationInfoForUpdate as ee,visualVariableInteractiveUpdate as te}from"./workflowUtils.js";import ae from"../FeatureForm/FeatureFormViewModel.js";import ie from"../Sketch/SketchViewModel.js";var re;const se=Symbol(),oe=Symbol(),ne=Symbol(),le=Symbol(),de={point:["point"],multipoint:["multipoint"],polygon:["polygon","freehandPolygon","rectangle","circle"],polyline:["polyline","freehandPolyline"],mesh:[],multipatch:[]};let ce=re=class extends L{constructor(e){super(e),this.type="create-features",this.createFeatureState="create-new",this.data=void 0,this.isNested=!1,this._getDrawMeshHelpMessage=void 0,this._webStyleCache=new Map,this._featureFormHandle=null,this._visualVariableAttributes={rotation:null,size:null},this._featureFormViewModel=new ae,this._sketchLayer=null,this._sketchViewModel=null,this._attachmentFileInfos=new Map,this._isActive=!0}initialize(){this.isNested&&(this._isActive=!1),this._initializeSketchViewModel()}destroy(){this._sketchViewModel.destroy()}get featureFormViewModel(){return this._featureFormViewModel}get hasPendingEdits(){if(this.pendingFeatures.some(e=>!!this.data.getEditsForPendingFeature(e)?.modified))return!0;const{creationInfo:e,upload:t}=this.data,{activeComponent:a,createGraphic:i}=this._sketchViewModel,r=i?.geometry?.type;return!("polyline"!==r&&"polygon"!==r&&"multipoint"!==r||"draw-2d"!==a?.type&&"draw-3d"!==a?.type)&&a.drawOperation.committedVertices.length>0||(!(!t||"pending"!==t.state&&"success"!==t.state)||!!e?.geometryToPlace)}get hasPreviousStep(){return this._stepIndex>0||"update-pending"===this.createFeatureState&&!!this.data.selectedPendingFeature&&!this.parent&&!T(this.data.creationInfo)}get helpMessage(){const{creationInfo:e,viewModel:t}=this.data;if("creating-features"!==this.stepId||!e)return;const{_sketchViewModel:a}=this,i=e.layer.geometryType,r=a.createGraphic;if("mesh"===i){this._getDrawMeshHelpMessage||import("../../views/draw/support/helpMessageUtils3d.js").then(e=>{this._getDrawMeshHelpMessage=e.getDrawMeshHelpMessage});const{view:e}=t;return"3d"===e?.type?this._getDrawMeshHelpMessage?.(r,e):void 0}const{activeCreateToolDrawMode:s,activeTool:o}=a;return k("rectangle"===o?"rectangle":"circle"===o?"circle":i,r?.geometry,s)}get layer(){return this.data.creationInfo?.layer}get numPendingFeatures(){return this.pendingFeatures.length}get numPendingFeaturesExcludingHidden(){return this.pendingFeatures.filter(e=>this.data.isDisplayable(e)).length}get parent(){return this.data.parent}get parentLayer(){return this.parent?.data.editorItem.layer}get pendingFeatures(){return this.data.pendingFeatures}get keyboardCancellationEnabled(){return 0===this.numPendingFeatures}get reliesOnOwnerAdminPrivileges(){return this.data.editorItem?.capabilities.create.reliesOnOwnerAdminPrivileges??!1}get shouldShowAttachments(){return(this.data.selectedPendingFeature&&this.data.editorItem?.capabilities.create.attachments.enabled)??!1}get shouldAllowAttachmentEditing(){return this.shouldShowAttachments}get sketchViewModel(){return this._sketchViewModel}get test(){}get availableCreateTools(){const e=this.data.creationInfo?.layer.geometryType,t=this.data.viewModel.view;if(!e)return[];if(this.data.creationInfo?.maxFeatures&&this.data.creationInfo.maxFeatures<=this.numPendingFeatures)return[];if(v(this.data.fullTemplate)){const{tool:t}=U(e,this.data.fullTemplate);return[t]}return"2d"!==t?.type&&"multipoint"===e?[]:[...de[e]]}get _attachmentsActive(){const e=this.data.viewModel.attachmentsViewModel.mode,t=this.stepId;return this.shouldShowAttachments&&("add"===e||"edit"===e||"adding-attachment"===t||"editing-attachment"===t)}async enter(){this._isActive=!0,"awaiting-feature-creation-info"!==this.stepId&&await this._updatingHandles.addPromise(this._setUpCreatingFeaturesStep())}exit(){this._isActive=!1,this.removeHandles([ne])}async updatePendingFeature(e){if(e!==this.data.selectedPendingFeature)return this._sketchViewModel.cancel(),this._startUpdating({feature:e})}async start(){return await super.start(),M(this.data.creationInfo?.layer)?null:{enter:async()=>{},exit:async()=>{},viewModel:this._sketchViewModel}}async save(){const{featureFormViewModel:e}=this;if(e.pendingSubtypeChoice)return;e.submit(),this._stashValidationState();const t=this.data.selectedPendingFeature,a=this._hasValidationErrors(t)?t:this.data.pendingFeatures.find(e=>this._hasValidationErrors(e));return a?(await this._startUpdating({feature:a}),void e?.submit()):super.save()}back(e){return"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||T(this.data.creationInfo)||this._attachmentsActive||this.parent?super.back(e):this._clearSelectedFeature()}previous(e){return"update-pending"!==this.createFeatureState||!this.data.selectedPendingFeature||T(this.data.creationInfo)||this._attachmentsActive?super.previous(e):this._clearSelectedFeature()}cancelFeature(e){this.data.isSharedTemplateWorkflow?o.getLogger(this).warn("Cannot cancel individual features created by shared templates."):(this.data.removePendingFeature(e),this.sketchViewModel.removeGraphic(e))}static create(e){const{addAttachmentsCallback:t,applyEdits:a,applyEditsFeatureService:i,isNested:r,creationInfo:s,parent:o,snappingManager:n,startAt:l,viewModel:d}=e,c=e.sketchOptions??new A,u=s?.layer,h=u?d.findEditorItemForLayer(u):void 0,p=new re({data:new E({creationInfo:s,editorItem:h,parent:o,sketchOptions:c,snappingManager:n,viewModel:d}),isNested:r,onCommit:async e=>{const{creationInfo:r}=e;if(!r)return;p._sketchViewModel.cancel();const s=e.pendingFeatures.toArray(),{layer:o}=r,n=o.capabilities?.editing.supportsGlobalId&&"globalIdField"in o,l=p._attachmentFileInfos,{fullTemplate:c}=e,u=j(p.data),h=F(c)&&u;if(n){if(me(s),h){let t=we(u,l);const a=await x(o,d.view);a&&(t=O({edits:t,serviceInfo:a,view:d.view,findOriginalFeature:t=>e.getEditsForPendingFeature(t)?.initialFeature??t})),await i(c.featureService,t,{globalIdUsed:!0,gdbVersion:c.layer.gdbVersion??void 0})}else{const e=fe(s,l);await a(o,e,{globalIdUsed:!0})}return}const m=h?await i(c.featureService,u,{gdbVersion:c.layer.gdbVersion??void 0}):[await a(o,{addFeatures:s})];m&&l.size>0&&await Promise.all(m.map(e=>{if(e?.addFeatureResults)return t(o,pe(s,e.addFeatureResults,o,l))}))}});return p._set("steps",this._createWorkflowSteps(p,l)),p}_fadeExistingFeatures(e){if("effect"in e){const t=e.effect;return e.effect="saturate(0.6) opacity(0.8)",i(()=>e.effect=t)}const t=e.opacity;return e.opacity=.7,i(()=>e.opacity=t)}async _initializeFullTemplateAndExecutorInfo(e){const{creationInfo:t}=e,{view:a}=e.viewModel;if(!t||!a)return null;const i=await z(t,a);if(e.fullTemplate=i,i&&F(i)){const{createTemplateExecutor:r}=await import("../../editing/sharedTemplates/executor/createTemplateExecutor.js"),s={completionResults:[],executor:await r(i),serviceLayersById:await W(t.layer,a)};e.templateExecutorInfo=s}return i}async _startCreating(){this.removeHandles(oe);const{data:e}=this;if(!e.creationInfo)return;const t=this.data.creationInfo?.maxFeatures;if(t&&this.numPendingFeatures>=t)return this.sketchViewModel.cancel(),void(this.numPendingFeatures&&await this._startUpdating({feature:this.pendingFeatures.at(-1)}));this.createFeatureState="create-new",await D(this._sketchViewModel,this._sketchLayer,e,this._webStyleCache)}async _clearSelectedFeature(){const e=this._featureFormViewModel.pendingSubtypeChoice;e&&(e.resolve("undo"),await e.promise),this._stashValidationState(),this.sketchViewModel.cancel(),this.data.selectedPendingFeature=null,this._featureFormHandle=n(this._featureFormHandle),this._featureFormViewModel.feature=null;const t=this.data.viewModel.attachmentsViewModel;"add"!==t.mode&&"edit"!==t.mode||await(this.data.viewModel.activeWorkflow?.previous())}_stashValidationState(){const e=this._featureFormViewModel.feature,t=e&&this.data.getEditsForPendingFeature(e);t&&(t.submittable=this._featureFormViewModel.submittable)}async _selectFeatureForUpdate({feature:e,initialFeature:t=e}){this._stashValidationState();const{data:a,pendingFeatures:i,_webStyleCache:s}=this;i.includes(e)||a.addPendingFeature(e,t),a.selectedPendingFeature=e;const{_featureFormViewModel:o,_sketchViewModel:l}=this,{creationInfo:d,viewModel:c}=a,{attachmentsViewModel:h,layerInfos:p,view:m}=c;if(!m||!d)return;n(this._featureFormHandle);const f=e.sourceLayer,w=R(p,f),g=w?.formTemplate,y=m.spatialReference;o.set({editType:"INSERT",feature:e,formTemplate:g,spatialReference:y,map:m.map}),"add"!==h.mode&&"edit"!==h.mode||await(c.activeWorkflow?.previous()),h.graphic=e,h.fileInfos.removeAll(),h.mode="view";(this._attachmentFileInfos.get(e)||[]).forEach(({file:e,form:t})=>h.addFile(e,t)),await G(e,s,"2d"===m.type?m.scale:null);const v=a.getEditsForPendingFeature(e);this._featureFormHandle=r([o.on("value-change",async({fieldName:t,value:a})=>{if(v?.updateAttributes(o.getValues()),I(a)){const e=this._visualVariableAttributes;e.size&&!e.size.isUpdatingInteractively&&t===e.size.field&&e.size.setInitialValue(a),e.rotation&&!e.rotation.isUpdatingInteractively&&t===e.rotation.field&&e.rotation.setInitialValue(a)}await G(e,s,"2d"===m.type?m.scale:null)}),l.on(["update","undo","redo"],e=>{("undo"===e.type||"redo"===e.type||"update"===e.type&&null!=e.toolEventInfo&&N(e.toolEventInfo.type))&&o.notifyFeatureGeometryChanged()}),u(()=>o.feature?.sourceLayer,t=>e.sourceLayer=t),u(()=>[o.feature,o.submittable],()=>this._stashValidationState())]),this.createFeatureState="update-pending"}async _startUpdating({feature:e,initialFeature:t=e}){await this._selectFeatureForUpdate({feature:e,initialFeature:t});const{_sketchLayer:a,_sketchViewModel:i,data:r}=this,{creationInfo:s,viewModel:o}=r,{view:n}=o;if(!n||!s)return;const l=e.sourceLayer??s.layer;return M(l)?void 0:(this._visualVariableAttributes=K(e),Z({graphic:e,sketchLayer:a,sketchViewModel:i,sourceLayer:l,visualVariables:this._visualVariableAttributes,webStyleCache:this._webStyleCache}))}static _createWorkflowSteps(e,t="awaiting-feature-creation-info"){const{data:a}=e,i=q(["awaiting-feature-creation-info","creating-features","adding-attachment","editing-attachment"],t,{"awaiting-feature-creation-info":()=>({id:"awaiting-feature-creation-info",async setUp(){const{creationInfo:t,viewModel:i}=a,{view:r}=i;r&&(T(t)?e.addHandles(await H({view:r,data:a,next:()=>e.next(),cancel:()=>i.cancelWorkflow({warnIfNoWorkflow:!1})}),this.id):(a.parent&&t&&e.addHandles(i.restrictFeatureTemplatesViewModelToLayer(t.layer),this.id),e.addHandles(i.featureTemplatesViewModel.on("select",({item:t})=>{t&&(a.creationInfo={...a.creationInfo,layer:t.layer,template:t.template},e.next())}),this.id)))},async tearDown(){e.removeHandles(this.id)}}),"creating-features":()=>({id:"creating-features",async setUp(){e._isActive&&await e._setUpCreatingFeaturesStep()},async tearDown(t){const{viewModel:i}=a;t.canceled&&(e.removeHandles([ne,se,oe,le]),i.attachmentsViewModel.fileInfos.removeAll(),e._attachmentFileInfos.clear())}}),"adding-attachment":()=>({id:"adding-attachment",parent:"creating-features",async setUp(){},async tearDown(){const{attachmentsViewModel:t}=a.viewModel,{graphic:i,fileInfos:r}=t;e._attachmentFileInfos.set(i,r.toArray()),t.mode="view"}}),"editing-attachment":()=>({id:"editing-attachment",parent:"creating-features",async setUp(){},async tearDown(){const{attachmentsViewModel:t}=a.viewModel,{graphic:i,fileInfos:r}=t;e._attachmentFileInfos.set(i,r.toArray()),t.mode="view"}})});return B(a,i)}static _configureSketchViewModel(e){const{data:t,_sketchLayer:a,_sketchViewModel:s,_webStyleCache:o}=e,{creationInfo:n,viewModel:l}=t,{view:c}=l,p=[];if(!c)return i();if("2d"===c.type){n&&p.push(e._fadeExistingFeatures(n.layer));const t=d((e,t)=>Promise.all(e.map(e=>G(e,o,t))));p.push(u(()=>c.scale,e=>t(a.graphics,e)))}const m=J(t.fullTemplate,n?.attributeOverrides),f=u(()=>s.createGraphic,a=>{a&&!e.hasHandles(oe)&&e._updatingHandles.addPromise(Q({creationAttributes:m,data:t,sketchViewModel:s,view:c,webStyleCache:o}).then(t=>e.addHandles(t,oe)))}),w=async t=>{if("cancel"!==t.state&&"complete"!==t.state||e.removeHandles(oe),"cancel"===t.state&&null!==c.activeTool&&c.activeTool!==e.sketchViewModel.activeComponent&&(await e._waitForActiveToolCleared(),await e._startCreating()),"complete"===t.state&&t.graphic){const a=await e._processEdits(t.graphic,{scale:"2d"===c.type?c.scale:null,useSourceLayer:!0,webStyleCache:e._webStyleCache});a&&(await e._waitForActiveToolCleared(),await e._startUpdating({feature:a}))}},g=async i=>{const{attachmentsViewModel:r}=l,{_featureFormViewModel:o}=e;if(i.graphics.length>1)return void await e._clearSelectedFeature();const d=i.graphics[0];if("complete"===i.state){const{submittable:t}=o;if(e.numPendingFeatures!==n?.maxFeatures&&t||o.submit(),await e._clearSelectedFeature(),"add"!==r.mode&&"edit"!==r.mode||await(l.activeWorkflow?.previous()),!i.aborted&&c.activeTool===e.sketchViewModel.activeComponent&&(await e.sketchViewModel.wait(),"ready"===e.sketchViewModel.state&&"mesh"!==e.data.creationInfo?.layer.geometryType))return e._startCreating()}else{if("start"===i.state)return d.sourceLayer??=t.creationInfo?.layer,await ee({graphic:d,sketchLayer:a,sketchViewModel:s,visualVariables:e._visualVariableAttributes,webStyleCache:e._webStyleCache,sourceLayer:d.sourceLayer}),e._selectFeatureForUpdate({feature:d});if("active"===i.state){await e.updatePendingFeature(d);const t=e._visualVariableAttributes;te(c,d,i,t)&&await G(d,e._webStyleCache,"2d"===c.type?c.scale:null);const a=d.attributes,{rotation:r,size:s}=t;if(null!=r){const{field:e}=r;o.setValue(e,a[e])}if(null!=s){const{field:e}=s;o.setValue(e,a[e])}}}},y=async a=>{if(a.graphics.forEach(e=>{t.removePendingFeature(e)}),!T(t.creationInfo))return e._startCreating()},v=async()=>{if(T(t.creationInfo))try{await e.data.viewModel.back()}catch{}return e._startCreating()};p.push(f,s.on("create",t=>e._updatingHandles.addPromise(w(t))),s.on("update",t=>e._updatingHandles.addPromise(g(t))),s.on("delete",t=>e._updatingHandles.addPromise(y(t))),h(()=>!e.numPendingFeatures,()=>e._updatingHandles.addPromise(v())),i(()=>{s.cancel()}),ue(s,a,t),...he(t));const F=r(p);return s.addHandles(F),F}_initializeSketchViewModel(){const{data:e}=this,{view:t}=e.viewModel,a=new b({elevationInfo:e.creationInfo?.layer.elevationInfo,internal:!0,listMode:"hide",title:"createFeaturesWorkflow-internal"}),r=new ie({layer:a,creationMode:"single",sketchOptions:e.sketchOptions,snappingManager:e.snappingManager,updateOnGraphicClick:!1,defaultUpdateOptions:{multipleSelectionEnabled:!1},view:t});this._sketchLayer=a,this._sketchViewModel=r,t?.map.add(a),this.addHandles([i(()=>{t?.destroyed||t?.map.remove(a),a.destroy()}),u(()=>this.numPendingFeatures>0,e=>this._sketchViewModel.updateOnGraphicClick=e,p)])}_hasValidationErrors(e){return!!e&&(!this.data.isSubmittable(e)||!!this._featureFormViewModel.validateContingencyConstraints(e.attributes,{includeIncompleteViolations:!0})?.length)}async _processEdits(e,t){const{data:a,_featureFormViewModel:i,_sketchLayer:r}=this,{layerInfos:s,view:o}=a.viewModel;i.editType="INSERT",i.map=o?.map,i.spatialReference=o?.spatialReference;const{templateExecutorInfo:n}=a;if(!n){const t=e.clone();return t.geometry=null,await this._addAndInitializeEdits(e,t),e}r.remove(e);const{executor:l}=n,d=l(e.geometry,"completion"),u=c(d)?await d:d;n.completionResults.push(u),X(u.relationships),i.editType="INSERT",i.map=o?.map,i.spatialReference=o?.spatialReference,u.primary&&a.creationInfo?.attributeOverrides&&(u.primary.graphic.attributes={...u.primary.graphic.attributes,...a.creationInfo.attributeOverrides});for(const c of u.edits){let e=null;if(c.addFeatures)for(const a of c.addFeatures){const i=a.clone();i.geometry=null,null!=a.geometry&&(a.symbol=await V(a,t),r.add(a)),a.sourceLayer!==e?.layer&&(e=R(s,a.sourceLayer));const o=!!u.associationGraphics?.has(a);await this._addAndInitializeEdits(a,i,e,o)}}i.feature=null,await m(()=>!i.updating);return u.edits.reduce((e,t)=>e+(t.addFeatures?.length??0),0)>1?null:u.primary?.graphic}async _addAndInitializeEdits(e,t,a,i=!1){const{data:r,_featureFormViewModel:s}=this,{layerInfos:o}=r.viewModel,n=r.addPendingFeature(e,t,{isAssociation:i});a??=R(o,e.sourceLayer),s.feature=e,s.formTemplate=a?.formTemplate,await m(()=>!s.updating),n.submittable=s.submittable}async _setUpCreatingFeaturesStep(){if(this.hasHandles(ne))return;const{data:e,sketchViewModel:s}=this,{creationInfo:o,viewModel:l}=e,{attachmentsViewModel:d,view:c}=l;if(!c||!o?.layer)throw new a("missing-parameters","CreateFeaturesWorkflow requires a view and creationInfo.");const{initialFeature:h,layer:m}=o,f=[],w=[];this._featureFormHandle=n(this._featureFormHandle),this._visualVariableAttributes={rotation:null,size:null},e.editorItem=l.findEditorItemForLayer(o.layer),o.template&&(null==e.fullTemplate&&await this._initializeFullTemplateAndExecutorInfo(e),w.push(i(()=>{e.templateExecutorInfo&&(e.templateExecutorInfo.completionResults=[])}))),s.allowDeleteKey=!e.isSharedTemplateWorkflow,Y(d),f.push(u(()=>d.mode,e=>{switch(e){case"add":this.go("adding-attachment");break;case"edit":this.go("editing-attachment")}}));const g=$(c);f.push(g);const y=M(o.layer),{template:F}=o,b=!F||_(F)||v(F)&&"feature"===F.type,I=y&&b;try{if(I){const a=h??new t({attributes:J(e.fullTemplate,o.attributeOverrides),sourceLayer:m}),i=await this._processEdits(a);i&&await this._startUpdating({feature:i})}else f.push(re._configureSketchViewModel(this)),h?(T(o)&&o.geometryToPlace&&(h.attributes=J(e.fullTemplate,o.attributeOverrides)),s.addGraphic(h),await this._startUpdating({feature:h})):await this._startCreating()}finally{g.remove()}const V=i(()=>{for(const t of e.pendingFeatures)s.removeGraphic(t),e.removePendingFeature(t)}),k=u(()=>c?.timeZone,e=>{this._featureFormViewModel.timeZone=e,this.data.timeZone=e},p),S=i(()=>{T(o)&&l.cancelWorkflow({warnIfNoWorkflow:!1})});this._featureFormHandle&&f.push(this._featureFormHandle),this.addHandles(f,this._handleKeys.beforeCommit),this.addHandles(w,this._handleKeys.afterCommit),this.addHandles([i(()=>d.fileInfos.removeAll()),r(f),r(w),S,V,k],ne)}async _waitForActiveToolCleared(){const e=this.data.viewModel.view;if(null==e?.activeTool)return;const t=new AbortController;this.addHandles(s(t),le),await m(()=>null==e?.activeTool,t.signal),t.abort()}};function ue(e,t,a){let s=null;const o=()=>e.snappingOptions.featureSources,n=()=>(s=new C({layer:t}),o().add(s),s),d=()=>{null!=s&&(o().remove(s),s=l(s))};return r([u(()=>{const e=a.creationInfo?.layer,t=o().find(t=>t.layer===e);return{hasFeatureLayerSource:!!t,enabled:t?.enabled??!1}},({hasFeatureLayerSource:e,enabled:t})=>{if(!e)return d();s??=n(),s.enabled=t},f),i(d)])}function he(e){const t=e.viewModel.view;if(!t)return[];const a=[];if("3d"===t.type){const r=new S({view:t});a.push(u(()=>e.selectedPendingFeature,(e,t)=>{r.remove(e),r.add(t)}),i(()=>r.destroy()))}const r=new S({view:t,highlightName:P});return a.push(u(()=>e.temporaryHighlightFeature,e=>{r.removeAll(),r.add(e)}),i(()=>r.destroy())),a}function pe(e,t,a,i){const r=[];return t.forEach((t,s)=>{if(!t.error){const o=e[s],n=i.get(o)||[];o.attributes[a.objectIdField]=t.objectId,n.forEach(({form:e})=>r.push({feature:o,attachment:e}))}}),r}function me(e){for(const t of e){const{sourceLayer:e}=t;e&&"globalIdField"in e&&null!=e.globalIdField&&(t.attributes[e.globalIdField]??=w())}}function fe(e,t){const a=[];if(!t||0===t.size)return{addFeatures:e};for(const[i,r]of t)for(const{file:e}of r)a.push({feature:i,attachment:{globalId:w(),data:e}});return a.length?{addFeatures:e,addAttachments:a}:{addFeatures:e}}function we(e,t){return e.map(e=>{const{addFeatures:a}=e;if(!a||0===a.length)return e;const i=[];for(const r of a){const e=t.get(r);if(e)for(const{file:t}of e)i.push({feature:r,attachment:{globalId:w(),data:t}})}return i.length?{...e,addAttachments:i}:e})}e([g()],ce.prototype,"createFeatureState",void 0),e([g()],ce.prototype,"data",void 0),e([g({constructOnly:!0})],ce.prototype,"isNested",void 0),e([g()],ce.prototype,"featureFormViewModel",null),e([g()],ce.prototype,"hasPendingEdits",null),e([g()],ce.prototype,"hasPreviousStep",null),e([g()],ce.prototype,"_getDrawMeshHelpMessage",void 0),e([g()],ce.prototype,"helpMessage",null),e([g()],ce.prototype,"layer",null),e([g()],ce.prototype,"parent",null),e([g()],ce.prototype,"parentLayer",null),e([g()],ce.prototype,"keyboardCancellationEnabled",null),e([g()],ce.prototype,"reliesOnOwnerAdminPrivileges",null),e([g()],ce.prototype,"shouldShowAttachments",null),e([g()],ce.prototype,"shouldAllowAttachmentEditing",null),e([g()],ce.prototype,"sketchViewModel",null),e([g()],ce.prototype,"availableCreateTools",null),e([g()],ce.prototype,"_attachmentsActive",null),ce=re=e([y("esri.widgets.Editor.CreateFeaturesWorkflow")],ce);const ge=ce;export{ge as default};
|