@arcgis/core 4.34.0-next.24 → 4.34.0-next.25
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/analysis/VolumeMeasurement/CutFillOptions.d.ts +4 -0
- package/analysis/VolumeMeasurement/CutFillOptions.js +1 -1
- package/analysis/VolumeMeasurementAnalysis.js +1 -1
- package/applications/Components/imageryUtils.d.ts +4 -0
- package/applications/Components/imageryUtils.js +5 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{0867aa688fa8938906da.js → 03bef3f4b6b09b1e864b.js} +1 -1
- package/assets/esri/core/workers/chunks/06cdbccc9f325dcc303d.js +1 -0
- package/assets/esri/core/workers/chunks/07613c89255bdab6b7c6.js +1 -0
- package/assets/esri/core/workers/chunks/09618761df5c4fdd52a0.js +1 -0
- package/assets/esri/core/workers/chunks/0ae00339991f5387203e.js +1 -0
- package/assets/esri/core/workers/chunks/0b4b294f3ce74fde5620.js +1 -0
- package/assets/esri/core/workers/chunks/{146520d263b910b5bdc7.js → 0e96a3b7228f1ff8e6c5.js} +1 -1
- package/assets/esri/core/workers/chunks/109ef17dd4f9430bb686.js +1 -0
- package/assets/esri/core/workers/chunks/1597aca21334cab3b802.js +1 -0
- package/assets/esri/core/workers/chunks/196564ad230bef6b59cf.js +1 -0
- package/assets/esri/core/workers/chunks/19f8d551cbebc11db1eb.js +1 -0
- package/assets/esri/core/workers/chunks/1ceee047e3fa617b0600.js +1 -0
- package/assets/esri/core/workers/chunks/1d27701832ea139fcc20.js +1 -0
- package/assets/esri/core/workers/chunks/1f296f85becf1ca6714d.js +1 -0
- package/assets/esri/core/workers/chunks/1f8d7bd44d53c30df383.js +1 -0
- package/assets/esri/core/workers/chunks/1fabb5ec59da698c1618.js +1 -0
- package/assets/esri/core/workers/chunks/{919d2fd7ebc0c840a759.js → 219b2911668db120452b.js} +1 -1
- package/assets/esri/core/workers/chunks/29ae5723fa35aa73ff9b.js +1 -0
- package/assets/esri/core/workers/chunks/2b4b073254fe8b6a081c.js +1 -0
- package/assets/esri/core/workers/chunks/30293b88501b5d6162fc.js +1 -0
- package/assets/esri/core/workers/chunks/31533f5e8b76b307f61c.js +1 -0
- package/assets/esri/core/workers/chunks/347117e61e1c6edd074f.js +1 -0
- package/assets/esri/core/workers/chunks/3616eb2607843524483f.js +1 -0
- package/assets/esri/core/workers/chunks/36648facd56ee91afc7c.js +1 -0
- package/assets/esri/core/workers/chunks/394477e88be0c6790f02.js +1 -0
- package/assets/esri/core/workers/chunks/3b80b01551d124534a1b.js +1 -0
- package/assets/esri/core/workers/chunks/{89d91ce2f566dd3f57f7.js → 3be9ec0503a669bcfce6.js} +1 -1
- package/assets/esri/core/workers/chunks/3c9cf06ac6aa1db6c4f6.js +1 -0
- package/assets/esri/core/workers/chunks/40fc7c43feaeef8b814d.js +1 -0
- package/assets/esri/core/workers/chunks/42cddc8f8c8d73e22ee2.js +1 -0
- package/assets/esri/core/workers/chunks/437a4100a837ee16df7c.js +1 -0
- package/assets/esri/core/workers/chunks/453e536f566d80a9863b.js +1 -0
- package/assets/esri/core/workers/chunks/472c677a74d779ce62d7.js +1 -0
- package/assets/esri/core/workers/chunks/4b68b6985430c42316b7.js +1 -0
- package/assets/esri/core/workers/chunks/4ce671bc4d36387b55fa.js +1 -0
- package/assets/esri/core/workers/chunks/51cfa2f70ec222e1582b.js +1 -0
- package/assets/esri/core/workers/chunks/5284d46aecd6fe0345b8.js +1 -0
- package/assets/esri/core/workers/chunks/567385709e18ace93b1e.js +1 -0
- package/assets/esri/core/workers/chunks/5a9b27f2b343cd5b0852.js +1 -0
- package/assets/esri/core/workers/chunks/{4c2f3e43992a918e4c2d.js → 5ef3256c32c4b622bd11.js} +1 -1
- package/assets/esri/core/workers/chunks/{5ce62d9fff80d014d186.js → 60aeb7a5ccd8bc71be02.js} +1 -1
- package/assets/esri/core/workers/chunks/{55e9b02d70812f7cdac2.js → 63966066a963e9a1fb14.js} +1 -1
- package/assets/esri/core/workers/chunks/63f50ff2ae94f684d56b.js +1 -0
- package/assets/esri/core/workers/chunks/{8bf04be4052bf148777a.js → 6a1cf6b0ffdf6080b5c4.js} +1 -1
- package/assets/esri/core/workers/chunks/6deaa08e3a61a455e564.js +1 -0
- package/assets/esri/core/workers/chunks/6e9b4bfe2a1497c96100.js +1 -0
- package/assets/esri/core/workers/chunks/6efc3d120c9c2c09cb06.js +1 -0
- package/assets/esri/core/workers/chunks/7338ce95bceb2c7fab87.js +1 -0
- package/assets/esri/core/workers/chunks/{c64fa94cba71ba2794e2.js → 771012f129890f9a089c.js} +1 -1
- package/assets/esri/core/workers/chunks/{d1b363c418a67b087306.js → 780ff9314f26ae62f75f.js} +1 -1
- package/assets/esri/core/workers/chunks/820cf4337b248a0cb63c.js +1 -0
- package/assets/esri/core/workers/chunks/{fedbf639a0788417a70f.js → 86abfce1f2ac93cc4d54.js} +1 -1
- package/assets/esri/core/workers/chunks/{c94cc026c4ed330408fb.js → 8894483b91bcda845b6f.js} +1 -1
- package/assets/esri/core/workers/chunks/{f050ab9d100012b77bb9.js → 8c5b1114cc2a58305a81.js} +1 -1
- package/assets/esri/core/workers/chunks/{6ca764b4baadef5c1515.js → 92737419b66894799a34.js} +1 -1
- package/assets/esri/core/workers/chunks/9511e55e4fabb3235eac.js +1 -0
- package/assets/esri/core/workers/chunks/{909a6218db87cba2c9ba.js → 9a78cb291c966f8ddda6.js} +1 -1
- package/assets/esri/core/workers/chunks/9f8341caab3b1d02f387.js +1 -0
- package/assets/esri/core/workers/chunks/a08d018d8c137fc4ca17.js +1 -0
- package/assets/esri/core/workers/chunks/{7051bcc178eb512819f6.js → a55338add265d330124b.js} +1 -1
- package/assets/esri/core/workers/chunks/afe4fd3b1b3521712edd.js +1 -0
- package/assets/esri/core/workers/chunks/{9991bd3c7991bffd8260.js → b37f3c416cefc1a6ea2c.js} +1 -1
- package/assets/esri/core/workers/chunks/bb50b4a3af627f91d789.js +1 -0
- package/assets/esri/core/workers/chunks/{f42155b7a4e6c5e80757.js → bbc2a4976d044b990193.js} +1 -1
- package/assets/esri/core/workers/chunks/bbf2c31d217de1b8ba6e.js +1 -0
- package/assets/esri/core/workers/chunks/be3977f7fe0c46a1b493.js +1 -0
- package/assets/esri/core/workers/chunks/befba7ceeb26a38732c1.js +1 -0
- package/assets/esri/core/workers/chunks/bf3fc71881aa559fc931.js +1 -0
- package/assets/esri/core/workers/chunks/c19421707257fc93acb9.js +1 -0
- package/assets/esri/core/workers/chunks/c1fb5290e0e259b74389.js +1 -0
- package/assets/esri/core/workers/chunks/c361bf4d41a1843d4640.js +1 -0
- package/assets/esri/core/workers/chunks/c51099eab5a99c88e5de.js +1 -0
- package/assets/esri/core/workers/chunks/c56b05a8be498b6f3ee7.js +1 -0
- package/assets/esri/core/workers/chunks/c82e78590c2fabc67609.js +1 -0
- package/assets/esri/core/workers/chunks/{7d7f8f2936ddee65e3da.js → c9e580867f7ac17be329.js} +1 -1
- package/assets/esri/core/workers/chunks/{92ad9098006568358550.js → cafcb46d723d38b377a9.js} +1 -1
- package/assets/esri/core/workers/chunks/{1d75cb1747ffb7b8b050.js → cb81d448ed6bad205346.js} +1 -1
- package/assets/esri/core/workers/chunks/{0f6203ae32663b2b52db.js → d08a523b548e892e1222.js} +1 -1
- package/assets/esri/core/workers/chunks/d29ae64703a947bfb83b.js +1 -0
- package/assets/esri/core/workers/chunks/{04c17957c15234ca0321.js → d81260303a11d3fbe940.js} +1 -1
- package/assets/esri/core/workers/chunks/de1457b07f4e263f1524.js +1 -0
- package/assets/esri/core/workers/chunks/{6bf43bc3714d7b3878fa.js → e547318638c8f496c1a0.js} +1 -1
- package/assets/esri/core/workers/chunks/e8e993fb8697b8f3e0c7.js +346 -0
- package/assets/esri/core/workers/chunks/{53781ccca16e53d4a8c3.js → f291ccf9da6aa7d7ae23.js} +1 -1
- package/assets/esri/core/workers/chunks/f61a8cc7e2b198e521ba.js +1 -0
- package/assets/esri/core/workers/chunks/f9442a281cb91c64c7cd.js +1 -0
- package/assets/esri/core/workers/chunks/fb785bc38323cce6e549.js +1 -0
- package/assets/esri/core/workers/chunks/{c3213b487c11076985af.js → fbf3240b36718fa5dc76.js} +1 -1
- package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
- package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
- package/chunks/ComponentShader.glsl.js +36 -36
- package/chunks/RibbonLine.glsl.js +40 -33
- package/chunks/persistableUrlUtils.js +1 -1
- package/config.js +1 -1
- package/core/AsyncUpdate.js +1 -1
- package/core/Clonable.js +1 -1
- package/core/Evented.js +1 -1
- package/core/Identifiable.js +1 -1
- package/core/JSONSupport.js +1 -1
- package/core/Loadable.js +1 -1
- package/core/MapUtils.js +1 -1
- package/core/MemCache.js +1 -1
- package/core/MultiOriginJSONSupport.js +1 -1
- package/core/ObjectPool.js +1 -1
- package/core/Promise.js +1 -1
- package/core/ReadOnlyMultiOriginJSONSupport.js +1 -1
- package/core/quantity.d.ts +1 -0
- package/geometry/support/buffer/BufferPool.js +1 -1
- package/geometry/support/meshUtils/loadGLTFMesh.js +1 -1
- package/interfaces.d.ts +147 -12
- package/kernel.js +1 -1
- package/layers/CatalogLayer.js +1 -1
- package/layers/FeatureLayer.js +1 -1
- package/layers/GeoJSONLayer.js +1 -1
- package/layers/SubtypeGroupLayer.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphSublayerBase.js +1 -1
- package/layers/mixins/APIKeyMixin.js +1 -1
- package/layers/mixins/ArcGISCachedService.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/mixins/ArcGISMapService.js +1 -1
- package/layers/mixins/ArcGISService.js +1 -1
- package/layers/mixins/BlendLayer.js +1 -1
- package/layers/mixins/CustomParametersMixin.js +1 -1
- package/layers/mixins/DisplayFilteredLayer.js +1 -1
- package/layers/mixins/EditBusLayer.js +1 -1
- package/layers/mixins/FeatureEffectLayer.js +1 -1
- package/layers/mixins/FeatureLayerBase.js +1 -1
- package/layers/mixins/FeatureReductionLayer.js +1 -1
- package/layers/mixins/ImageryTileMixin.js +1 -1
- package/layers/mixins/OperationalLayer.js +1 -1
- package/layers/mixins/OrderedLayer.js +1 -1
- package/layers/mixins/PortalLayer.js +1 -1
- package/layers/mixins/PublishableLayer.js +1 -1
- package/layers/mixins/RasterJobHandlerMixin.js +1 -1
- package/layers/mixins/RasterPresetRendererMixin.js +1 -1
- package/layers/mixins/RefreshableLayer.js +1 -1
- package/layers/mixins/ScaleRangeLayer.js +1 -1
- package/layers/mixins/SceneService.js +1 -1
- package/layers/mixins/SublayersOwner.js +1 -1
- package/layers/mixins/TemporalLayer.js +1 -1
- package/layers/mixins/TemporalSceneLayer.js +1 -1
- package/layers/mixins/TrackableLayer.js +1 -1
- package/layers/ogc/wfsUtils.js +1 -1
- package/layers/support/RasterJobHandler.js +1 -1
- package/layers/support/RasterWorker.js +1 -1
- package/layers/support/Sublayer.js +1 -1
- package/layers/support/arcgisLayerUrl.js +1 -1
- package/layers/support/multiLayerServiceUtils.js +1 -1
- package/layers/support/rasterDatasets/pixelReader.js +5 -0
- package/layers/support/rasterFormats/pixelRangeUtils.js +1 -1
- package/layers/support/rasterFunctions/pixelUtils.js +1 -1
- package/package.json +1 -1
- package/renderers/mixins/VisualVariablesMixin.js +1 -1
- package/rest/support/CameraInfoMixin.js +1 -1
- package/rest/support/NormalizationBinParametersMixin.js +1 -1
- package/smartMapping/renderers/color.js +1 -1
- package/smartMapping/renderers/heatmap.js +1 -1
- package/smartMapping/renderers/pieChart.js +1 -1
- package/smartMapping/renderers/size.js +1 -1
- package/smartMapping/renderers/support/regenerateUtils.js +1 -1
- package/smartMapping/renderers/support/rendererUtils.js +1 -1
- package/smartMapping/renderers/type.js +1 -1
- package/smartMapping/symbology/color.js +1 -1
- package/smartMapping/symbology/support/utils.js +1 -1
- package/support/LayersMixin.js +1 -1
- package/support/TablesMixin.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/support/utils.js +1 -1
- package/views/2d/engine/ParentChildStage.js +1 -1
- package/views/2d/engine/webgl/VideoScreenRenderer.js +1 -1
- package/views/2d/engine/webgl/meshing/Mesh.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/raster/processor/MultiRasterMixin.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/videoScreenRenderer/VideoScreenTechnique.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/typed/TypedShaderProgram.js +1 -1
- package/views/2d/engine/webgl/textureUtils.js +1 -1
- package/views/2d/layers/BitmapTileLayerView2D.js +1 -1
- package/views/2d/layers/LayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/features/support/AttributeStore.js +1 -1
- package/views/2d/layers/support/DebugOverlay.js +1 -1
- package/views/3d/analysis/AnalysisView3D.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/CutFillVolumeMeasurementController.js +5 -0
- package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
- package/views/3d/glTF/DefaultLoadingContext.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
- package/views/3d/layers/BuildingSublayerView3D.js +1 -1
- package/views/3d/layers/ElevationLayerView3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/ImageryLayerView3D.js +1 -1
- package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
- package/views/3d/layers/LayerView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/StreamLayerView3D.js +1 -1
- package/views/3d/layers/TiledLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/graphics/StreamController.js +5 -0
- package/views/3d/layers/graphics/StreamGraphics3DGraphicsPipeline.js +1 -1
- package/views/3d/layers/graphics/defaultSymbolComplexity.js +1 -1
- package/views/3d/layers/graphics/wosrLoader.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SNodeLoader.js +1 -1
- package/views/3d/layers/support/DefinitionExpressionSceneLayerView.js +1 -1
- package/views/3d/layers/support/PopupSceneLayerView.js +1 -1
- package/views/3d/layers/support/TemporalSceneLayerView.js +1 -1
- package/views/3d/layers/support/fetchTile.js +1 -1
- package/views/3d/support/MemoryController.js +1 -1
- package/views/3d/support/ResourceController.js +1 -1
- package/views/3d/support/StreamDataLoader.js +1 -1
- package/views/3d/support/StreamDataRequester.js +5 -0
- package/views/3d/support/StreamTextureCollection.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/support/flow/FlowSubViewExtent3D.js +1 -1
- package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
- package/views/3d/support/flow/StreamlinesResources3D.js +1 -1
- package/views/3d/support/flow/geometryUtils.js +1 -1
- package/views/3d/support/index.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +3 -3
- package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
- package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultLayouts.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/shaders/AnimatedLine.glsl.js +17 -0
- package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
- package/views/BreakpointsOwner.js +1 -1
- package/views/DOMContainer.js +1 -1
- package/views/PopupView.js +1 -1
- package/views/VideoView.js +1 -1
- package/views/Viewport2DBaseMixin.js +1 -1
- package/views/Viewport2DMixin.js +1 -1
- package/views/draw/DrawGraphicTool.js +1 -1
- package/views/draw/DrawScreenTool.js +1 -1
- package/views/draw/DrawTool.js +1 -1
- package/views/interactive/tooltip/infos/TooltipInfoWithCoordinates.js +1 -1
- package/views/layers/CatalogDynamicGroupLayerView.js +1 -1
- package/views/layers/CatalogFootprintLayerView.js +1 -1
- package/views/layers/CatalogLayerView.js +1 -1
- package/views/layers/DimensionLayerView.js +1 -1
- package/views/layers/FeatureLayerView.js +1 -1
- package/views/layers/ImageryLayerView.js +1 -1
- package/views/layers/ImageryTileLayerView.js +1 -1
- package/views/layers/LineOfSightLayerView.js +1 -1
- package/views/layers/MapImageLayerView.js +1 -1
- package/views/layers/MediaLayerView.js +1 -1
- package/views/layers/OGCFeatureLayerView.js +1 -1
- package/views/layers/PointCloudLayerView.js +1 -1
- package/views/layers/RefreshableLayerView.js +1 -1
- package/views/layers/StreamLayerView.js +1 -1
- package/views/layers/ViewshedLayerView.js +1 -1
- package/views/layers/WMSLayerView.js +1 -1
- package/views/support/Scheduler.js +1 -1
- package/views/video/VideoOperationalDataView.js +1 -1
- package/views/webgl/BufferObject.js +1 -1
- package/views/webgl/Program.js +1 -1
- package/views/webgl/Renderbuffer.js +1 -1
- package/views/webgl/Texture.js +1 -1
- package/views/webgl/Util.js +1 -1
- package/webscene/SunLighting.js +1 -1
- package/webscene/VirtualLighting.js +1 -1
- package/widgets/BasemapGallery/support/PortalBasemapsSource.js +1 -1
- package/widgets/Directions/DirectionsSearchTool.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/UpdateFeaturesWorkflow.js +1 -1
- package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
- package/widgets/Feature/FeatureExpression/FeatureExpressionViewModel.js +1 -1
- package/widgets/Feature/support/FeatureContentMixin.js +1 -1
- package/widgets/Feature/support/arcadeFeatureUtils.js +1 -1
- package/widgets/FeatureTable/support/EditableColumnTemplateMixin.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/mixins/ImageMeasurementMixin.js +1 -1
- package/widgets/OrientedImageryViewer/mixins/SketchHandlerMixin.js +1 -1
- package/widgets/OrientedImageryViewer/mixins/TriangulatedImageMeasurementMixin.js +1 -1
- package/widgets/OrientedImageryViewer/mixins/TriangulatedSketchHandlerMixin.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer/PanoramicZoomConditions.js +1 -1
- package/widgets/PanoramicViewer.js +1 -1
- package/widgets/Sketch/support/ResponsiveToolbar/ToolbarGroupBase.js +1 -1
- package/widgets/support/GoTo.js +1 -1
- package/assets/esri/core/workers/chunks/0202c2ac73354e3970b2.js +0 -1
- package/assets/esri/core/workers/chunks/02dc6e31b1244e5bb785.js +0 -1
- package/assets/esri/core/workers/chunks/080c79d6caca3b6a2db2.js +0 -1
- package/assets/esri/core/workers/chunks/084236ca316aad980192.js +0 -1
- package/assets/esri/core/workers/chunks/0b484224a92b52c34330.js +0 -1
- package/assets/esri/core/workers/chunks/16a78f5a82f5ca163816.js +0 -1
- package/assets/esri/core/workers/chunks/1cc30073f8200b67cff6.js +0 -1
- package/assets/esri/core/workers/chunks/242b216d61940aebe8e1.js +0 -1
- package/assets/esri/core/workers/chunks/32756905bcf11699b3f7.js +0 -1
- package/assets/esri/core/workers/chunks/35d238a5a6501f89bed7.js +0 -1
- package/assets/esri/core/workers/chunks/36a2a8b6547604bad2ab.js +0 -1
- package/assets/esri/core/workers/chunks/3fcd73ba832cb53d3a07.js +0 -1
- package/assets/esri/core/workers/chunks/40c1d65039c8f1d6afa0.js +0 -1
- package/assets/esri/core/workers/chunks/49dce142ad1ea4c01d00.js +0 -1
- package/assets/esri/core/workers/chunks/4b89d5b9e35bf79b321e.js +0 -1
- package/assets/esri/core/workers/chunks/4c47d327815e281c457e.js +0 -1
- package/assets/esri/core/workers/chunks/4ea96aff38bb301dc40d.js +0 -346
- package/assets/esri/core/workers/chunks/54a49a25845897a15ab1.js +0 -1
- package/assets/esri/core/workers/chunks/576e408fb0834f3948e8.js +0 -1
- package/assets/esri/core/workers/chunks/5e805c9e9012dd39ec86.js +0 -1
- package/assets/esri/core/workers/chunks/6136bf09950adc46bc33.js +0 -1
- package/assets/esri/core/workers/chunks/666afe669866c44830bd.js +0 -1
- package/assets/esri/core/workers/chunks/6a0fbc54638f7de138c1.js +0 -1
- package/assets/esri/core/workers/chunks/843b6029d4c13115e1ac.js +0 -1
- package/assets/esri/core/workers/chunks/86d6007c45f2aa643ac8.js +0 -1
- package/assets/esri/core/workers/chunks/8ea34878a1ef24b4ded3.js +0 -1
- package/assets/esri/core/workers/chunks/8eea6251aa09725e654e.js +0 -1
- package/assets/esri/core/workers/chunks/90145d49a0cec902435c.js +0 -1
- package/assets/esri/core/workers/chunks/916691122d7fb38497d6.js +0 -1
- package/assets/esri/core/workers/chunks/9ae18a17f62d91167202.js +0 -1
- package/assets/esri/core/workers/chunks/9c510df592befb9ff892.js +0 -1
- package/assets/esri/core/workers/chunks/a273f80298417edecc07.js +0 -1
- package/assets/esri/core/workers/chunks/a2ed7a3cd518dd136ec7.js +0 -1
- package/assets/esri/core/workers/chunks/a6a7279b09d7962147ec.js +0 -1
- package/assets/esri/core/workers/chunks/aba520714efc01bead36.js +0 -1
- package/assets/esri/core/workers/chunks/acb9c166259872828646.js +0 -1
- package/assets/esri/core/workers/chunks/accff253af360c34e8a8.js +0 -1
- package/assets/esri/core/workers/chunks/ae6eed26fc932bc08356.js +0 -1
- package/assets/esri/core/workers/chunks/b32c1b60896a72e0ae90.js +0 -1
- package/assets/esri/core/workers/chunks/b4bb461955a4c2bce072.js +0 -1
- package/assets/esri/core/workers/chunks/b98279213f45a0c27600.js +0 -1
- package/assets/esri/core/workers/chunks/ba5b24beebeb703b5919.js +0 -1
- package/assets/esri/core/workers/chunks/bd7d19ba0c7d9143a455.js +0 -1
- package/assets/esri/core/workers/chunks/bffaf1f20f18c75fad4e.js +0 -1
- package/assets/esri/core/workers/chunks/c4f8da6c238eb5e91f91.js +0 -1
- package/assets/esri/core/workers/chunks/cdabea4718a7e7d34cb8.js +0 -1
- package/assets/esri/core/workers/chunks/ce7155ae63e7bb74be00.js +0 -1
- package/assets/esri/core/workers/chunks/d45383d76ba99718b6d9.js +0 -1
- package/assets/esri/core/workers/chunks/d915d0a30d9beb24bd3a.js +0 -1
- package/assets/esri/core/workers/chunks/dc6538a2d5a1e60d0209.js +0 -1
- package/assets/esri/core/workers/chunks/dca633ae3bfd4a3f9bb3.js +0 -1
- package/assets/esri/core/workers/chunks/dfa7976085f7408a366c.js +0 -1
- package/assets/esri/core/workers/chunks/e0a5b499b3ae38c21278.js +0 -1
- package/assets/esri/core/workers/chunks/e1a20ba7d6279f59adc0.js +0 -1
- package/assets/esri/core/workers/chunks/e49a135a2933306a6105.js +0 -1
- package/assets/esri/core/workers/chunks/e9a9174c4d1a0a9effb6.js +0 -1
- package/assets/esri/core/workers/chunks/edead1a123860cc74b1b.js +0 -1
- package/assets/esri/core/workers/chunks/f90573c9dc36e51cd588.js +0 -1
- package/assets/esri/core/workers/chunks/fa9658dbfb921f9c13af.js +0 -1
- package/assets/esri/core/workers/chunks/fb5e2b1ced03eef28e96.js +0 -1
- package/assets/esri/core/workers/chunks/fd8f4eabb8bbc593dd9c.js +0 -1
- package/assets/esri/core/workers/chunks/fe1902d63f610cebd947.js +0 -1
- package/layers/graphics/controllers/StreamController.js +0 -5
|
@@ -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{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{equals as a,isSome as i}from"../../core/arrayUtils.js";import{createTask as r}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import{deprecatedProperty as o}from"../../core/deprecate.js";import n from"../../core/Error.js";import l from"../../core/Evented.js";import{makeHandle as c}from"../../core/handleUtils.js";import{equalsShallow as h}from"../../core/lang.js";import u from"../../core/Logger.js";import{clamp as m}from"../../core/mathUtils.js";import{abortMaybe as d,destroyMaybe as p}from"../../core/maybe.js";import g from"../../core/Promise.js";import{isAbortError as y,throwIfAborted as v,waitTick as f}from"../../core/promiseUtils.js";import w from"../../core/ReactiveMap.js";import{whenOnce as F,on as b,watch as M,syncAndInitial as _,initial as P}from"../../core/reactiveUtils.js";import{sqlAnd as I}from"../../core/sql.js";import{getMetersPerUnitForSR as V}from"../../core/unitUtils.js";import{property as k}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as S}from"../../core/accessorSupport/decorators/subclass.js";import{distance as A}from"../../core/libs/gl-matrix-2/math/vec2.js";import{isSerializable as C}from"../../core/support/jsonUtils.js";import{UpdatingHandles as L}from"../../core/support/UpdatingHandles.js";import G from"../../geometry/Extent.js";import{union as R}from"../../geometry/geometryEngineAsync.js";import O from"../../geometry/Multipoint.js";import T from"../../geometry/Point.js";import j from"../../geometry/Polygon.js";import B from"../../geometry/Polyline.js";import{projectWithZConversion as x}from"../../geometry/projectionUtils.js";import E from"../../geometry/SpatialReference.js";import{isClockwise as H}from"../../geometry/support/coordsUtils.js";import{geographicToWebMercator as z}from"../../geometry/support/webMercatorUtils.js";import D from"../../layers/GraphicsLayer.js";import U from"../../layers/MediaLayer.js";import{searchImages as N,getSortedLayerFeatures as W}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as q}from"../../layers/orientedImagery/core/bestImageUtils.js";import{createCoveragePolygon as $,computePolygonForInspection as J,resizePolygon as Z,checkIfPolygonContainsSelectedPoint as K}from"../../layers/orientedImagery/core/coverageUtils.js";import{isElevationSource as Q}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{convertGeographicToWebMercator as X}from"../../layers/orientedImagery/core/utils.js";import{imageToWorld as Y,imageToWorldPanoramic as ee}from"../../layers/orientedImagery/transformations/imageToWorld.js";import te from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as ae}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{or as ie,getInitialAngle as re,convertPixelToHeadingPitch as se,convertHeadingPitchToSphereVertex as oe,getImageToWorldProperties as ne,getUpdateElevationProps as le,isElevationSampler as ce,getImageToWorldPanoramicProperties as he,pointToArray as ue,transformGraphicCoordinatesToPixel as me,getWorldToImageProperties as de}from"../../layers/orientedImagery/transformations/utils.js";import{worldToImage as pe,worldToImagePanoramic as ge}from"../../layers/orientedImagery/transformations/worldToImage.js";import ye from"../../layers/support/ExtentAndRotationGeoreference.js";import{getFloorFilterClause as ve}from"../../layers/support/floorFilterUtils.js";import fe from"../../layers/support/VideoElement.js";import we from"../../symbols/SimpleLineSymbol.js";import Fe from"../../views/MapView.js";import be from"../../views/draw/Draw.js";import{scale as Me}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as _e}from"../../views/input/InputManager.js";import Pe from"../PanoramicViewer.js";import{defaultAngleThresholdInDegrees as Ie,videoExtent as Ve,invalidCameraHeading as ke,sectorsInOrder as Se,sampleExtent as Ae,sectorsRadii as Ce}from"./constants.js";import{configureSketchTool as Le,extractFieldsFromDataCaptureLayer as Ge,isValidDataCaptureLayer as Re,constructGraphicFromImageGeometry as Oe}from"./dataCaptureUtils.js";import{isFeatureAttachment as Te,getImageSourceFromAttachment as je}from"./galleryUtils.js";import{formatPixels as Be,heightMeasurementPanoramic as xe,heightMeasurement2D as Ee,calculateHeightAccuracyPanoramic as He,calculateHeightAccuracy as ze,pixelAreaMeasurement2D as De,pixelAreaMeasurementPanoramic as Ue,pixelDistanceMeasurement2D as Ne,pixelDistanceMeasurementPanoramic as We,generateCombinations as qe,getRootOfSumOfSquaredErrors as $e,generateCombinationsPanoramic as Je,calculateLocationAccuracyFromDeviations as Ze,calculateReferenceImagePointPanoramic as Ke,calculateAnglePano as Qe,calculateTempImagePoint as Xe,calculateAngle as Ye,computeTriangulatedAreaMeasurement as et,computeTriangulatedDistanceMeasurement as tt,getModeCorrectedPoint as at,calculateCorrectedPixel as it,getUnitRateFromSpatialReference as rt,calculateHeightFromTemporaryDistance as st,computeTriangulatedVector as ot,computeTriangulatedPoint as nt}from"./imageMeasurementUtils.js";import{crossSymbol as lt,crossSymbol3D as ct,measurementPolygonSymbol as ht,polylineSymbolPanoramic as ut,measurementPolylineSymbol as mt,sourcePointSymbol as dt,diamondSymbol as pt,diamondSymbol3D as gt,locationSymbol as yt,locationSymbol3D as vt,activeSourcePointSymbol as ft}from"./symbols.js";import{isNoAttachmentError as wt,getContentType as Ft,isTifOrMrf as bt,filterOILLayerView as Mt,assignElevationSampleToFeatures as _t,calculateDirection as Pt,calculateSegment as It,isSceneView as Vt,isGraphic as kt}from"./utils.js";import{disableVideoZoomAndPan as St}from"./videoViewerUtils.js";import At from"./components/ImageViewer.js";import Ct from"./components/NavigationNode.js";import Lt from"./components/OrientedImageryVideoViewModel.js";import{NoActiveViewerError as Gt,NoFeatureFoundWithObjectIdError as Rt}from"./navigation/errors.js";import{queryFeatureByObjectIds as Ot}from"./navigation/queries.js";import Tt from"../Sketch/SketchViewModel.js";const jt={click:"view-click",imageClick:"image-click",triangularImageClick:"triangular-click",interactionHandles:"interaction-handles",hittestHandles:"hittest-handles",videoPlayerHandles:"video-handles"},Bt=new Set(["JPG","JPEG"]),xt=/\.(\w+)$/,Et=()=>new n("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first");let Ht=class extends(l.EventedMixin(g)){constructor(e){super(e),this.additionalFeatures=new s,this.additionalCameraLocations=new s,this.additionalFootprints=new s,this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.allLayerFeatures=[],this.bestFeatureAngle=0,this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null,this.cameraHeadingThreshold=Ie,this.cameraPitchThreshold=Ie,this.clickAction="hittest",this.videoViewModel=null,this.collectionId=null,this.conversionProps=null,this.coverageFrustums=new s,this.coveragePolygons=new s,this.currentBestFeature=null,this.currentBestFeatureMeasurementImage=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.navigationNodes=new s,this.determineWorkflowForFeature=async(e,t,a)=>{const{currentBestFeature:i,selectedPoint:r,view:s}=this;if(s?.closePopup(),i&&r){this._initialCurrentCoverageUpdate=!0,this._updateGroundElevation=!0;try{await this._updatePointsAndPolygons(a),await this._loadImage(a)}catch(o){y(o)||(this.loadImageError(o),u.getLogger(this).error("#loadIImage()","error occured while loading image",o))}}},this.determineWorkflowForTriangularMeasurement=async(e,t,a)=>{if(this.view?.closePopup(),this.currentBestFeatureMeasurementImage&&this.selectedPoint)try{await this._loadMeasurementViewerImage(a)}catch(i){y(i)||(this.loadImageError(i),u.getLogger(this).error("#loadIImage()","error occured while loading image",i))}},this.disabled=!1,this.displayMessage={key:"onLoadMessage",type:"info"},this.displayNewMeasurementButton=!0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.dataCaptureLayer=null,this.features=new s,this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.heightMeasurementPixels=[],this.heightGraphic=null,this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.measurementAngle=null,this.tempDistance=null,this.imageGeometryField=null,this.imageLocationToolState=!1,this.imageMeasurementViewer=new At,this.isAdditionalCoverageVisible=!1,this.isAdditionalPointSourcesVisible=!1,this.measurementVectors=[],this.layer=null,this.localPort=null,this.mapImageConversionToolState=!1,this.measureType=null,this.measurementGraphic=null,this.navigatorCurrentBestFeature=null,this.oiObjectIdField=null,this.overlayedCameraLocations=new s,this.overlayedMapFeatures=new w,this.pixelCoordinates=null,this.preserveAngle="none",this.pointSources=new s,this.previousFeatureAngle=0,this.selectedPoint=null,this.shouldShowSelectedImage=!1,this.sketch=null,this.sketchTriangular=null,this.sketchTriangularGraphicsLayer=null,this.draw=null,this.sketchAdapter=null,this.triangularMeasurementActive=!1,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedAreaAccuracy=0,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.triangulatedMeasurementAdapter=null,this.updateFootprint=async(e,t)=>{"default"===this.mode&&"image-loaded"!==this.state||"video"===this.mode&&!this.videoElement?.content||await(this._adapter?.updateFootprint(e,t))},this.updateFootprintPanorama=async(e,t)=>{await(this._adapter?.updateFootprintPanorama(e,t))},this.updatingTriangularMeasurementState=!1,this.videoElement=null,this.videoLayer=null,this.videoMapView=new Fe({map:new Map}),this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new At,this._initialCurrentCoverageUpdate=!0,this._locationPointOnImage=null,this._correctedLocationPointOnImage=null,this._overlays=new D({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"}}),this._panoramicViewer=new Pe,this._previousCursor=null,this._referencePointOnGround=null,this._referencePointOnImage=null,this._sectorData=null,this._featureToSector=null,this._updatingHandles=new L,this._clickTask=null,this._crossSymbol=null,this.footprintExtent=null,this._featureChangedTask=null,this._openPopupTask=null,this._suitabilities=null,this._transformController=new AbortController,this._updateFootprintTask=null,this._updateGroundElevation=!1,this.addUpdatingPromise=e=>this._updatingHandles.addPromise(e),this.hideImageGeometry=e=>{},this.highlight=e=>{if(!this._overlaysView)return;this.removeHighlight();const t=this.additionalFootprints.find(({attributes:{imageID:t}})=>t===Number(e));this._highlightedFeatureHandle=t?this._overlaysView?.highlight(t):null},this.loadDataCaptureAdapter=async e=>{await this.loadSketch(e);const t=import("./adapters/sketch/DataCaptureAdapter.js"),{default:a}=await t;return v(e),this.sketchAdapter=new a({viewModel:this}),this.sketchAdapter},this.loadImageFromSource=async(e,t)=>this._updatingHandles.addPromise(this._loadImageFromSourceInternal(e,t)),this.storeImageMeasurementViewer=e=>{this.imageMeasurementViewer=e},this.loadImageViewer=e=>{this._imageViewer?.destroy(),this._imageViewer=e},this.loadPanoramicViewer=e=>{this._panoramicViewer?.destroy(),this._panoramicViewer=e},this.loadVideoViewer=e=>{this.videoMapView.container=e},this.showImageByObjectId=async(e,t)=>{const a=this.additionalFeatures.find(({attributes:t})=>t.objectId===e);if(a)this.currentBestFeature=a;else{const{layer:a,layerFloorFilterClause:r}=this;if(!a)return void this.setMessage("noLayerSelected","info");this.beforeLoad();const s=this._updatingHandles.addPromise(this._queryAndLoadByObjectId(a,e,r,t));try{await s,await this.selectBestFeature(e,t)}catch(i){y(i)||(u.getLogger(this).error("oriented-imagery-viewer:show-image",i),"NoFeatureFoundWithObjectIdError"===i.name?this.setMessage("noFeatureFoundWithObjectId","error","",{objectId:e}):this.setMessage("imageLoadError","error",i.message))}}},this.imageToImageTransform=async(e,t,a)=>{const{updateElevationProps:i,...r}=t,{updateElevationProps:s,...o}=a,n=await Y(e,r,i);return pe(n,o)},this.getSectorFeatureById=e=>this._suitabilities?.find(({feature:{attributes:{objectId:t}}})=>t===e),this.getFeatureSectorById=e=>this._featureToSector?.[`${e}`],this.navigate=async(e,t)=>{const{activeViewer:a}=this;if(!a)throw new Gt;return await a.navigate(e,t)},this.removeHighlight=()=>this._highlightedFeatureHandle?.remove(),this.revealImageGeometry=e=>{},this.selectBestFeature=async(e,t)=>(v(t),this.currentBestFeature=this.features?.find(({attributes:t})=>`${t.objectId}`==`${e}`),F(()=>"image-loaded"===this.state,t)),this.toggleImageAttributes=()=>{d(this._openPopupTask),this._openPopupTask=r(async e=>{const{currentBestFeature:a,popupEnabled:i,layer:r,view:s}=this;if(s?.closePopup(),!(s&&a&&i&&r))return;const{attributes:o,geometry:n}=a,l=new t({geometry:n,attributes:o.toJSON(),layer:r,sourceLayer:r});v(e),await s.openPopup({features:[l],location:o.location.clone()})})},this.updateSuitabilities=(e,t=!0)=>{e.sort((e,t)=>e.suitability-t.suitability),this._suitabilities=e;const a=this._suitabilities.map(({feature:e})=>e);this._initialCurrentCoverageUpdate=!0,this._updateFeatures(a,t),this._groupFeaturesBySectors()},this._createViewClickHandle=()=>{if(this.removeHandles(jt.click),"disabled"===this.state||null==this.view)return;const e=this.mapImageConversionToolState&&"image-loaded"===this.state?this._mapImageConversionToolViewClickHandler:this._viewClickHandler;this.addHandles(this.view.on("click",e,_e.WIDGET),jt.click)},this._createImageClickHandle=()=>{this.removeHandles(jt.imageClick);const{mapImageConversionToolState:e,mode:t,activeViewer:a,currentBestFeature:i,footprintExtent:s}=this,o=a?.imageSize;if(!(e&&"none"!==t&&o&&s&&i))return;const n=a.clickAction;this.clickAction="pixel-location";const l=c(()=>{this.clickAction=n});let h=null;const u=b(()=>a,"pixel-location",e=>{this.plotReferencePointOnImage(e),h?.abort(),h=r(async a=>{if(!e)return;const r=await this.getMapPoint(e,{feature:i,imageSize:o,mode:t}).then(e=>{const t=this.view?.spatialReference;return ie(!t,e.spatialReference.equals(t))?e:x(e,t)});v(a),this.plotReferencePointOnGround(r)})});this.addHandles([u,l],jt.imageClick)},this._createTriangularImageClickHandle=()=>{this.removeHandles(jt.triangularImageClick);const e=this.imageMeasurementViewer?.imageSize;this.triangularMeasurementActive&&"none"!==this.mode&&e&&this.currentBestFeature&&this.addHandles(this.imageMeasurementViewer.imageRenderer.on("double-click",this._measurementImageClickHandler),jt.triangularImageClick)},this._createTriangularImageLocationHandle=()=>{this.removeHandles(jt.triangularImageClick);const{imageLocationToolState:e,mode:t,imageMeasurementViewer:a}=this,i=a?.imageSize;if(!e||"none"===t||!i)return;this.clickAction="pixel-location";let s=null;const o=b(()=>a,"pixel-location",e=>{1===this.measurementVectors.length&&(this.plotLocationPointOnImage(e,!0),s?.abort(),s=r(async a=>{if(!e||this.triangulatedPoint||2===this.measurementVectors?.length||!this.currentBestFeatureMeasurementImage)return;let r=await this.getMapPoint(e,{feature:this.currentBestFeatureMeasurementImage,imageSize:i,mode:t});v(a);const s=this.currentBestFeatureMeasurementImage.geometry.spatialReference;s&&!r.spatialReference.equals(s)&&(r=await x(r,s),v(a)),await this._calculateTriangulatedPointFromGroundPoint(r,{signal:a}),v(a)}))});this.addHandles(o,jt.triangularImageClick)},this._createImageLocationHandle=()=>{this.removeHandles(jt.imageClick);const{imageLocationToolState:e,mode:t,activeViewer:a,currentBestFeature:i,footprintExtent:s}=this,o=a?.imageSize;if(!(e&&"none"!==t&&o&&s&&i))return;this.clickAction="pixel-location";let n=null;const l=b(()=>a,"pixel-location",e=>{this.pixelCoordinates=e,this.plotLocationPointOnImage(e),n?.abort(),n=r(async a=>{if(!e)return;let r=await this.getMapPoint(e,{feature:i,imageSize:o,mode:t});v(a);const s=this.view?.spatialReference;s&&!r.spatialReference.equals(s)&&(r=await x(r,s),v(a)),this.groundCoordinates=r,this.triangularMeasurementActive&&r&&await this.triangulatedLocationWorkflow(r,a);const n=await this.calculateLocationAccuracy(e,r,t,a);v(a),n&&(this.groundCoordinatesAccuracy=n)})});this.addHandles(l,jt.imageClick)},this._handleImageHitTestResponse=async e=>{const{layer:t,overlayedCameraLocations:a}=this;if(!t)return;const i=e.results.find(({graphic:e,graphic:{attributes:i}})=>a.includes(e)&&i&&!i[t.imageReferenceField]&&!i[t.imageGeometryField]);if(!i)return;const r=i.graphic.attributes[t.objectIdField];await this.showImageByObjectId(r)},this._loadImage=async e=>{const{currentBestFeature:t,layer:a,mode:i}=this;if(this.clearGraphics(),!a||!t||"none"===i||"video"===i)return;const{attributes:r}=t,{imagePath:s,imageRotation:o,cameraHeading:n,cameraRoll:l,cameraPitch:c,objectId:h,cameraOrientation:m,location:d}=r,p=(l??0)+(o??0),g=d.spatialReference.isWGS84&&4!==m?.type?z(d):new T(d);let f=s;if(Te(s))try{f=await je(a,h,e)}catch(w){if(y(w))return;return wt(w)?(u.getLogger(this).error(w),void this.setMessage("noAttachment","error",`${a.objectIdField}: ${h}`)):(u.getLogger(this).error(w,{[a.objectIdField]:h,layer:a}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${a.objectIdField} ${h}`))}try{await this.loadImageFromSource(f,{imageRotation:p,options:e,pitch:c,yaw:n,mode:i,cameraLocation:g}),v(e),await this.transformAndPlotSelectedLocation(e)}catch(w){y(w)||this.loadImageError(w)}},this._loadImageFromSourceInternal=async(e,t)=>{const{mode:a,imageRotation:i,options:r}=t,s="string"==typeof e,o=s?e:e.url,{pathname:n,searchParams:l}=new URL(o);let c=s?n.match(xt)?.[1]:e.datasetFormat;if(!c)try{c=await Ft(o,{...t.options})}catch(h){y(h)||u.getLogger(this).error("#getContentType()",h)}switch(c??="UNKNOWN FORMAT",a){case"default":this.triangularMeasurementActive?await this._setImageSource(this.imageMeasurementViewer,c,o,l,i,r):await this._setImageSource(this._imageViewer,c,o,l,i,r);break;case"panoramic":if(Bt.has(c.toUpperCase())){const{selectedPoint:e}=this,{pitch:a,yaw:i,cameraLocation:s,viewAngle:n}=t;this._panoramicViewer.imageSource=o;let l=i??0;"number"==typeof n?l=n-l:s&&e&&(l=await re(s,e)-l),this._panoramicViewer.pitch=a??0,this._panoramicViewer.yaw=l,await this._panoramicViewer.loadImage(r)}else this.setMessage("unsupportedPanoramicImageryError","error",void 0,{datasetFormat:c});break}},this._loadMeasurementViewerImage=async e=>{const{currentBestFeatureMeasurementImage:t,layer:a,mode:i}=this;if(this.imageMeasurementViewer.clearGraphics(),!a||!t||"none"===i||"video"===i)return;const{attributes:r}=t,{imagePath:s,imageRotation:o,cameraHeading:n,cameraRoll:l,cameraPitch:c,objectId:h,cameraOrientation:m,location:d}=r,p=(l??0)+(o??0),g=d.spatialReference.isWGS84&&4!==m?.type?z(d):new T(d);let f=s;if(Te(s))try{f=await je(a,h,e)}catch(w){if(y(w))return;return wt(w)?(u.getLogger(this).error(w),void this.setMessage("noAttachment","error",`${a.objectIdField}: ${h}`)):(u.getLogger(this).error(w,{[a.objectIdField]:h,layer:a}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${a.objectIdField} ${h}`))}try{await this.loadImageFromSource(f,{imageRotation:p,options:e,pitch:c,yaw:n,mode:i,cameraLocation:g}),v(e)}catch(w){y(w)||this.loadImageError(w)}},this._loadViewAdapter=async e=>{const{view:t}=this;if(t)switch(t.type){case"2d":{const{default:t}=await import("./adapters/view/MapViewAdapter.js");v(e),this._adapter=new t(this);break}case"3d":{const{default:t}=await import("./adapters/view/SceneViewAdapter.js");v(e),this._adapter=new t(this);break}}else this._adapter=null},this._mapImageConversionToolViewClickHandler=e=>{e.stopPropagation(),e.preventDefault(),e.mapPoint&&this.plotMapPoint(e.mapPoint)},this._measurementImageClickHandler=e=>{e.stopPropagation(),e.preventDefault();const{sketchTriangular:t,triangularMeasurementActive:a,currentBestFeatureMeasurementImage:i,triangulatedMeasurementGraphic:r}=this;t&&a&&i&&r&&"active"!==t.state&&(t.update([r],{tool:"reshape"}),this.updatingTriangularMeasurementState=!0)},this._viewClickHandler=e=>{this._clickTask?.abort(),this._clickTask=r(async t=>{const{pointerType:a,button:i,mapPoint:r}=e;if(("mouse"!==a||0===i)&&r)return e.stopPropagation(),e.preventDefault(),this._updatingHandles.addPromise(this.loadBestImage(r,{signal:t}))})},this.plotSelectedPointOnImage=async(e,a)=>{if(await f(a),!e)return;const i=new T({...C(e)?e.toJSON():e});if("default"===this.mode)i.x-=.5,i.y=.5-i.y,i.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:i,symbol:lt}),this._imageViewer.addGraphic(this._crossSymbol,0);else if("panoramic"===this.mode){const{imageSize:a}=this._panoramicViewer;if(!a)return;const[i,r]=a,{heading:s,pitch:o}=se(e,i,r),n=oe(s,o);this._crossSymbol=new t({geometry:new T(n,E.WebMercator),symbol:ct}),this._panoramicViewer.addGraphic(this._crossSymbol,0)}},this.handleSectorClick=this.handleSectorClick.bind(this),this.searchBestImage=this.searchBestImage.bind(this),this.transformAndPlotReferencePointOnImage=this.transformAndPlotReferencePointOnImage.bind(this)}initialize(){this.addHandles([M(()=>this.view,()=>{this.load()},_),M(()=>this.view?.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},P),M(()=>this.view?.map?.allLayers?.length,e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)},P),M(()=>[this.state,this.mapImageConversionToolState,this.view],()=>{this._createViewClickHandle(),this._createImageClickHandle()},_),M(()=>[this.triangularMeasurementActive,this.currentBestFeatureMeasurementImage],()=>{this._createTriangularImageClickHandle()},_),M(()=>[this.state,this.imageLocationToolState,this.view],(e,t)=>{if(this._createImageLocationHandle(),!this.imageLocationToolState)return this.clearPreviousGroundLocation(),void this._resetCursor();e[1]!==t?.[1]&&this._setMeasurementCursor()},_),M(()=>this.measureType,()=>{this.clearPreviousMeasurements()},_),M(()=>this.bestFeatureAngle,(e,t)=>{this.previousFeatureAngle=t??0},_),M(()=>this.currentBestFeature,async(e,t)=>{d(this._featureChangedTask),this._featureChangedTask=r(async a=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:a}])),await this._featureChangedTask.promise},{sync:!0}),M(()=>this.currentBestFeatureMeasurementImage,async(e,t)=>{d(this._featureChangedTask),t&&e!==t&&(this.measurementVectors=[],this.triangulatedPoint=null,this.sketchTriangularGraphicsLayer?.graphics.destroyAll()),this._featureChangedTask=r(async a=>{await this.determineWorkflowForTriangularMeasurement(e,t,{signal:a}),v(a),this._reorderTriangularSketchLayer()})},_),M(()=>this.triangularMeasurementActive,async(e,t)=>{t&&!e&&(this.measurementVectors=[],this.currentBestFeatureMeasurementImage=null,this.triangulatedDistanceMeasurement=null,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaAccuracy=0,this.sketchTriangularGraphicsLayer?.graphics.destroyAll(),this.clearReferencePointOnImage(),this.imageMeasurementViewer.clearImage(),this.imageMeasurementViewer.clearGraphics())}),M(()=>this.mode,e=>{switch(this.removeHandles(jt.interactionHandles),e){case"default":this.addHandles(M(()=>{const{state:e}=this;return"image-loaded"===e?this._imageViewer.imagePointsInView:null},e=>{e&&(d(this._updateFootprintTask),this._updateFootprintTask=r(async t=>{await this.updateFootprint(e,{signal:t})}))},{..._,equals:(e,t)=>a(e,t,h)}),jt.interactionHandles);break;case"video":this.addHandles(M(()=>{const{footprintExtent:e}=this;if(e)return Ve},e=>{e&&(d(this._updateFootprintTask),this._updateFootprintTask=r(async t=>{await this.updateFootprint(e,{signal:t})}))},{..._,equals:(e,t)=>a(e,t,h)}),jt.interactionHandles);break;case"panoramic":this.addHandles(M(()=>{const{currentBestFeature:e,state:t}=this,{imageSize:a,vfov:i,hfov:r,pitch:s,yaw:o}=this._panoramicViewer;return e&&a&&!t.includes("loading")?[i,r,o,s]:null},e=>{if(!e||this.state.includes("loading"))return;const[t,a,i,s]=e;this.currentNode&&(this.currentNode.currentHeading=i+(this.currentNode.heading??0),this.currentNode.currentPitch=s+(this.currentNode.pitch??0)),d(this._updateFootprintTask),this._updateFootprintTask=r(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:a,yaw:i,pitch:s},{signal:e})})},{..._,equals:(e,t)=>a(e,t,h)}),jt.interactionHandles)}},_),M(()=>[this.brightness,this.contrast,this.sharpness],()=>{const{_imageViewer:e,brightness:t,contrast:a,mode:i,sharpness:r}=this;"default"===i&&(e.brightness=t,e.contrast=a,e.sharpness=r)},_),M(()=>this.activeViewer?.imageRenderer,()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)}),M(()=>this.activeViewer,e=>{this.removeHandles(jt.hittestHandles),e&&this.addHandles(b(()=>e,"hittest-response",this._handleImageHitTestResponse),jt.hittestHandles)})]),this.when().finally(()=>{this.notifyChange("state")})}destroy(){this.currentBestFeature=null,this._updateFootprintTask=d(this._updateFootprintTask),this._clickTask=d(this._clickTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=p(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),this.videoViewModel=p(this.videoViewModel),this._crossSymbol=p(this._crossSymbol),this._referencePointOnGround=p(this._referencePointOnGround),this._referencePointOnImage=p(this._referencePointOnImage),this._locationPointOnImage=p(this._locationPointOnImage),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy(),this._imageViewer.destroy(),this.imageMeasurementViewer.destroy(),this._panoramicViewer.destroy()}get activeLayer(){return o(u.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){o(u.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get activeViewer(){const{_imageViewer:e,_panoramicViewer:t,mode:a}=this;switch(a){case"default":return e;case"panoramic":return t;default:return null}}get accuracyParametersMissing(){return this.layer?.orientationAccuracy?.every(e=>0===e)??!0}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",m(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",m(e,-10,10))}get currentNode(){const{currentBestFeature:e,navigationNodes:t}=this;return t.find(t=>t.id===e?.attributes.objectId)}get featureCount(){return this.features?.length??0}get imageGalleryEnabled(){const{currentBestFeature:e}=this;if(!e)return!1;const t=e.attributes.imagePath?.trim();return bt(t)||Te(t)}get imageLoaded(){return o(u.getLogger(this),"imageLoaded",{replacement:'Use OrientedImageryViewer.state === "image-loaded"',version:"4.29",warnOnce:!0}),"image-loaded"===this.state}get invalidCameraHeading(){return this.currentBestFeature?.attributes?.cameraHeading===ke}get imagePointsInView(){const{mode:e,_imageViewer:t}=this;return"default"===e?t.imagePointsInView:null}get layerView(){const{layer:e,view:t}=this;if(e&&t)return t.allLayerViews.find(Mt(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?ve(e):null}get mode(){const e=this.currentBestFeature?.attributes;if(!e)return"none";if(e.orientedImageryType?.includes("video"))return"video";const{horizontalFieldOfView:t,isSpherical:a}=e;return 360===t||a?"panoramic":"default"}get popupEnabled(){return!0===this.layer?.popupEnabled}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){const{_sectorData:e}=this;return e?Se.map(t=>e[t]):null}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",m(e,0,1))}get sketchGraphicsLayer(){return this.sketch?.layer}get state(){const{mode:e,disabled:t,_updatingHandles:{updating:a},_featureChangedTask:i}=this;if(t)return"disabled";if(!this.isFulfilled()||a||!1===i?.finished)return"loading";if(this.isRejected())return"error";if("error"===this.displayMessage?.type)return"image-load-error";switch(e){case"default":return this._imageViewer.state;case"panoramic":return this._panoramicViewer.state;case"video":return this.videoElement?.loaded?"video-loaded":"video-not-loaded"}return"ready"}get thumbnails(){const{features:e}=this;return e?new s(e.map(({attributes:{imagePath:e,objectId:t,cameraRoll:a,imageRotation:i}})=>{const r=e?.trim();return bt(r)||Te(r)?{url:r,objectId:t,rotation:(a??0)+(i??0)}:null}).filter(i)):null}set view(e){this._set("view",e)}get _sketchGraphicsLayer(){const{mode:e}=this;switch(e){case"panoramic":return new D({elevationInfo:{mode:"absolute-height"}});case"default":return new D;default:return}}get _overlaysView(){return this.view?.layerViews.find(({layer:e})=>e===this._overlays)}beforeLoad(){this.view?.closePopup(),this.displayMessage=null,this.clearPreviousGroundLocation(),this.triangularMeasurementActive=!1,this.currentBestFeatureMeasurementImage=null,this.measureType=null,this.imageLocationToolState=!1,this.features.removeAll(),this.currentBestFeature=null,this.additionalFeatures.removeAll(),this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),this._overlays?.removeAll()}async computeHeight(e,t,a=!0){const{currentBestFeature:i,activeViewer:r,layer:s,footprintExtent:o}=this,n=r?.imageSize,l=i?.attributes,c=s?.orientationAccuracy;if(!l||!n||!e||e.length<2||!c)return;const h="panoramic"===t?await this.getMeasurementPropertiesPanoramic():ne(l,n[0],n[1]),u=e.at(0),m=e.at(-1);if(!(h&&u&&m&&c&&o))return;const d=[m,u],p=Be(d,!1),g="panoramic"===t?await xe(d,h,c,i,!0,!1):await Ee(d,h,c,!0,a);if(!g)return;const y="panoramic"===t?await He(c,p,h,g,i,!0):await ze(c,p,h,g,!0);return y?{value:g,accuracy:y}:{value:g}}async calculateAreaMeasurement(e,t,a){if(e.length<3||!this.currentBestFeature||!this.activeViewer?.imageSize||"none"===t)return null;const i="default"===t?await this.getMeasurementProperties():await this.getMeasurementPropertiesPanoramic();return v(a),i?"default"===t?await De(e,i,!0):await Ue(e,i,!0,a):null}async calculateDistanceMeasurement(e,t,a){const{currentBestFeature:i,activeViewer:r}=this;if(e.length<2||!i||!r?.imageSize||"none"===t)return null;const s="default"===t?await this.getMeasurementProperties():await this.getMeasurementPropertiesPanoramic();return v(a),s?"default"===t?await Ne([e.at(0),e.at(-1)],s,!0):await We([e.at(0),e.at(-1)],s,!0):null}async calculateAccuracy(e,t,a){const{layer:i,currentBestFeature:r,activeViewer:s}=this,o=i?.orientationAccuracy,n=o?.every(e=>0===e)||!o?.length;if("area"===t&&e.length<3||"distance"===t&&e.length<2||!r||!s?.imageSize||n)return null;let l=null;if(this.triangularMeasurementActive&&this.currentBestFeatureMeasurementImage&&this.imageMeasurementViewer?l=await this.getMeasurementProperties(this.currentBestFeatureMeasurementImage,this.imageMeasurementViewer):(l=await this.getMeasurementProperties(),v(a)),!l)return null;const c="area"===t?await De(e,l,!0):await Ne([e.at(0),e.at(-1)],l,!0);v(a);const{updateElevationProps:h,...u}=l,m=qe(u,o);if(!m?.length)return null;const d=m.map(e=>({...e,updateElevationProps:h})).map(async i=>{const r="area"===t?await De(e,i,!0):await Ne([e.at(0),e.at(-1)],i,!0);if(v(a),r&&c){if("area"===t){const e="number"!=typeof r?r.area:null;return e?Math.abs(e-c.area):null}return Math.abs(r-c)}return null}),p=await Promise.all(d);v(a);const g=p.filter(e=>null!==e);return 0===g.length?null:$e(g)}async calculateLocationAccuracy(e,t,a="default",i){const{layer:r,currentBestFeature:s}=this,o=r?.orientationAccuracy,n=this.view?.spatialReference,l=o?.every(e=>0===e)||!o?.length;if(!s||l)return null;const c="default"===a?await this.getMeasurementProperties():await this.getMeasurementPropertiesPanoramic();if(v(i),!c)return null;const{updateElevationProps:h,...u}=c,m="default"===a?qe(u,o):Je(u,o);if(!m?.length)return null;const d=m.map(e=>({...e,updateElevationProps:h})).map(async r=>{const{updateElevationProps:s,...o}=r;let l="default"===a?await Y(e,o,s):await ee(e,o,s);return v(i),n&&!l.spatialReference.equals(n)&&(l=await x(l,n),v(i)),l&&t?[Math.abs(l.x-t.x),Math.abs(l.y-t.y),l.z&&t.z?Math.abs(l.z-t.z):0]:null}),p=await Promise.all(d);if(v(i),!p?.length)return null;const g=p.map(e=>[e?.[0]??0,e?.[1]??0,e?.[2]??0]),[y,f,w]=Ze(g);return{x:y,y:f,z:w}}async calculateAccuracyPanoramic(e,t,a){const{layer:i,currentBestFeature:r,activeViewer:s,mode:o}=this,n=i?.orientationAccuracy,l=n?.every(e=>0===e)||!n?.length;if("area"===t&&e.length<3||"distance"===t&&e.length<2||!r||!s?.imageSize||l||"panoramic"!==o)return null;const c=await this.getMeasurementPropertiesPanoramic();if(v(a),!c)return null;const h="area"===t?await Ue(e,c,!0):await We([e.at(0),e.at(-1)],c,!0);v(a);const{updateElevationProps:u,...m}=c,d=Je(m,n);if(!d?.length)return null;const p=d.map(e=>({...e,updateElevationProps:u})).map(async i=>{const r="area"===t?await Ue(e,i,!0):await We([e.at(0),e.at(-1)],i,!0);if(v(a),r&&h){if("area"===t){const e="number"!=typeof r?r.area:null;return e?Math.abs(e-h.area):null}return Math.abs(r-h)}return null}),g=await Promise.all(p);v(a);const y=g.filter(e=>null!==e);return 0===y.length?null:$e(y)}async calculateHeightMeasurementInfo(e,t,a){const{currentBestFeature:i,activeViewer:r}=this,s=r?.imageSize;if(!i||!r||!s?.length||"none"===t)return;const{attributes:o}=i,[n]=Be([e],"panoramic"!==t),l="panoramic"===t?await this.getMeasurementPropertiesPanoramic():ne(o,s[0],s[1]);if("panoramic"===t){if(!l)return;const e=await Ke(n,l,i,a);if(!e)return;e?.heading>180&&(e.heading-=360);const t=Qe(n,e),r=A([n.x,n.y],[e.x,e.y]);if(!t||!r)return;return{measurementAngle:t,tempDistance:r}}const c=await Xe(n,l,a);if(!c)return;const h=Ye(n,c),u=A([n.x,n.y],[c.x,c.y]);return h&&u?{measurementAngle:h,tempDistance:u}:void 0}async calculateTriangulatedMeasurements(e){switch(this.measureType){case"distance":{this.triangulatedDistanceMeasurement=await tt(this.measurementVectors);const t=await this.calculateAccuracy(e,"distance");if(t&&this.triangulatedDistanceMeasurement?.distance){const e=Math.atan(t/this.triangulatedDistanceMeasurement.distance);this.triangulatedDistanceAccuracy={distanceAccuracy:t,angleAccuracy:e}}break}case"area":if(this.currentBestFeatureMeasurementImage?.geometry.spatialReference){const t=await et(this.measurementVectors,this.currentBestFeatureMeasurementImage.geometry.spatialReference);this.triangulatedAreaMeasurement=t,this.triangulatedAreaAccuracy=await this.calculateAccuracy(e,"area")??this.triangulatedAreaAccuracy}}}clearPreviousMeasurements(){this.clearMeasurementGraphics(),this.resetMeasurementData(),this.stopMeasurement()}clearPreviousGroundLocation(){this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.pixelCoordinates=null,this.clearLocationPointOnImage()}clearMeasurementGraphics(){this.measurementGraphic&&(this.activeViewer?.removeGraphic(this.measurementGraphic),this.measurementGraphic=null),this.heightGraphic&&(this.activeViewer?.removeGraphic(this.heightGraphic),this.heightGraphic=null),this.triangularMeasurementActive&&this.sketchTriangularGraphicsLayer?.graphics.destroyAll()}digitizeCancel(){return this.sketch?.cancel()}digitizeCanRedo(){return this.sketch?.canRedo()??!1}digitizeCanUndo(){return this.sketch?.canUndo()??!1}digitizeComplete(){return this.sketch?.complete()}async digitizeCreate(e,t){const{sketch:a,dataCaptureLayer:i}=this;if(!a)throw Et();Le(i,e,a),await a.create(e,{...t,defaultZ:0})}async digitizeDelete(){if(!this.sketch)throw Et();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw Et();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw Et();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw Et();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw Et();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw Et();return this.sketch.update(e,t)}async displayHeightResults(){const{currentBestFeature:e,activeViewer:t,heightMeasurementPixels:a,mode:i}=this,r=t?.imageSize,s=e?.attributes;if(!s||!r)return;const o=await this.computeHeight(a,i);o?.value&&o?.accuracy&&(this.heightMeasurementResult=o.value,this.heightMeasurementAccuracy=o.accuracy)}filterByFootprints(e,t,a=!1){const i=[],r=[],s=[];return e.forEach(e=>{const{layer:{coveragePercent:o},attributes:n}=e;let l;const{polygon:c,frustum:h}=$(n);if(l=c.clone(),n.isInspection&&(l=J(n)),o&&(l=Z(l,o)),a||!t||K(l,t)){s.push(e);const{geometry:t,objectId:a,cameraHeight:o,cameraHeading:l}=n,u=t.clone();u.z=o,u.imageID=a,this.pointSources.push(u),l!==ke&&(i.push(c),h&&r.push(h))}}),{features:s,polygons:i,frustums:r}}getMeasurementProperties(e=this.currentBestFeature,t=this.activeViewer){if(!e||!t?.imageSize)return;const{elevationSample:a,attributes:i}=e,{elevationSource:r,cameraHeight:s}=i,o=ne(i,t.imageSize[0],t.imageSize[1]);let n=o.cameraLocation;return(n.spatialReference.isGeographic?x(n,E.WebMercator):Promise.resolve(n)).then(e=>(n=e,le(n.spatialReference,n.z??0,s,{elevationSample:a,elevationSource:r,extent:this.footprintExtent}))).then(t=>("elevationSample"in t&&ce(t.elevationSample)&&(e.elevationSample=t.elevationSample),{...o,cameraLocation:n,updateElevationProps:t}))}getMeasurementPropertiesPanoramic(){const{currentBestFeature:e,activeViewer:t}=this;if(!e||!t?.imageSize)return;const{elevationSample:a,attributes:i}=e,{elevationSource:r,cameraHeight:s}=i,o=he(i,t.imageSize[0],t.imageSize[1]);let n=o.cameraLocation;return(n.spatialReference.isGeographic?x(n,E.WebMercator):Promise.resolve(n)).then(e=>(n=e,le(n.spatialReference,n.z??0,s,{elevationSample:a,elevationSource:r,extent:this.footprintExtent}))).then(t=>("elevationSample"in t&&ce(t.elevationSample)&&(e.elevationSample=t.elevationSample),{...o,cameraLocation:n,updateElevationProps:t}))}async deleteDataCaptureFeatures(e){const{dataCaptureLayer:t}=this;if(!t)throw new n("orientedimagery","Data capture layer is not available");return t.queryFeatures({objectIds:e}).then(({features:e})=>t.applyEdits({deleteFeatures:e}))}handleSectorClick(e){if(isNaN(e))return;const t=this._sectorData?.[Se[e]],a=t?.at(0);a&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(a):this._updateCurrentBestFeature(a))}handleFeatureClick(e){const{sector:t,featureIndexInSector:a}=e;if(isNaN(a))return;const i=this._sectorData?.[t],r=i?.at(a);r&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(r):this._updateCurrentBestFeature(r))}handleDrawCursorUpdateEvents(e){const{measurementAngle:t,tempDistance:a,heightMeasurementPixels:i,mode:r,activeViewer:s,currentBestFeature:o}=this,n=s?.imageSize;if(!e.vertices||!n||!o)return;const l=at(e.vertices.at(-1),r,n);if(i.length<1||!l||!a||!t||"none"===r)return;const c=it(i[0],l,t);if(!c?.length)return;this.heightMeasurementPixels.push(c),"panoramic"===r?this.createPolylineGraphicPano():this.createPolylineGraphic();const h=rt(o.attributes.location.spatialReference),u=st(this.heightMeasurementPixels,a,h);u&&(this.heightMeasurementResult=u)}async handleDrawVertexAddEvents(e,t){const{currentBestFeature:a,activeViewer:i,heightMeasurementPixels:r,mode:s}=this;if(!a||!i||!e.vertices?.length||"none"===s)return;const o=i?.imageSize;if(!r.length&&o){const a=at(e.vertices.at(-1),s,o);this.heightMeasurementPixels.push(a);const i=await this.calculateHeightMeasurementInfo(a,s,t);if(!i?.measurementAngle||!i?.tempDistance)return;this.measurementAngle=i.measurementAngle,this.tempDistance=i.tempDistance}}async load(e){return this.addResolvingPromise(this._loadViewAdapter(e).catch(e=>{if(!y(e))throw e})),this}async loadBestImage(e,t){return this.selectedPoint=X(e),this.beforeLoad(),this._fetchFeaturesWithController(e,t)}loadImageError(e){u.getLogger(this).error("oriented-imagery-viewer:load-image",e),this.setMessage("imageLoadError","error",e.message)}async loadSketch(e){if(!this.sketch){const t=import("../Sketch/SketchViewModel.js"),{default:a}=await t;v(e),this.sketch=new a({layer:this._sketchGraphicsLayer,view:this.activeViewer?.imageRenderer,updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{edgeOperation:"none",shapeOperation:"none",vertexOperation:void 0},enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"transform"}})}return this.sketch}async loadMeasurementAdapter(e){if(!this.sketchAdapter){const t=import("./adapters/sketch/MeasurementAdapter.js"),{default:a}=await t;if(v(e),this.sketchAdapter=new a({viewModel:this}),!this.sketchAdapter.viewModel.isResolved())return}return this.sketchAdapter}async loadTriangulatedMeasurementAdapter(e){if(!this.triangulatedMeasurementAdapter){const t=import("./adapters/sketch/TriangulatedMeasurementAdapter.js"),{default:a}=await t;if(v(e),this.triangulatedMeasurementAdapter=new a({viewModel:this}),!this.triangulatedMeasurementAdapter.viewModel.isResolved())return}return this.triangulatedMeasurementAdapter}async processFeatureResponse(e,t,a){const{features:i}=e;if(this._clearFeatureGeometries(),!this._checkFeatures(i))return;const{features:r,polygons:s,frustums:o}=this.filterByFootprints(i,t,a?.skipFilter);if(!this._checkFeatures(r))return;this.coveragePolygons.addMany(s),this.coverageFrustums.addMany(o);const n=await this.processElevationSample(s,r,a);v(a),await this._updateElevationOfSelectedPointAndLocations(r,t,n),v(a),_t(r,n);const l=this._processSuitableFeatures(r,t);this.updateSuitabilities(l,a?.loadBestImage)}async startMeasurement(e,t){this.sketch||await this.loadSketch(t),await this.loadMeasurementAdapter(t);const{sketch:a,sketchAdapter:i,activeViewer:r,mode:s}=this;if(!a||!i||!r||"none"===s)return;if(this.displayNewMeasurementButton=!1,"panoramic"===s&&(a.defaultCreateOptions.defaultZ=0),await a.create(e),"panoramic"===s){const{drawOperation:e}=a.view.activeTool;e.constraintsEnabled=!1,e._set("elevationDrawSurface",null)}const o=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;o&&this.sketch&&(this.sketch.polygonSymbol=ht(o),this.sketch.polylineSymbol="panoramic"===s?ut:mt(o,2.5))}startHeightMeasurement(){this.heightMeasurementPixels=[],this.displayNewMeasurementButton=!1,this.draw??=new be({view:this.activeViewer?.imageRenderer});this.draw.create("polyline").on(["cursor-update","vertex-add","draw-complete"],e=>this.handleDrawEvents(e))}createPolylineGraphic(){const e=[this.heightMeasurementPixels[0],this.heightMeasurementPixels.at(-1)],a=this.activeViewer?.imageRenderer.spatialReference;if(this.heightGraphic)this.heightGraphic.geometry=new B({paths:[e],spatialReference:a});else{const i=new B({paths:[e],spatialReference:a}),r=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;this.heightGraphic=new t({geometry:i,symbol:mt(r,2.5)}),this.activeViewer?.addGraphic(this.heightGraphic)}}createPolylineGraphicPano(){const e=this.activeViewer?.imageRenderer.spatialReference,a=this.activeViewer?.imageSize;if(!a)return;const i={x:this.heightMeasurementPixels[0][0],y:this.heightMeasurementPixels[0][1]},r={x:this.heightMeasurementPixels.at(-1)[0],y:this.heightMeasurementPixels.at(-1)[1]},{heading:s,pitch:o}=se(i,a[0],a[1]),{heading:n,pitch:l}=se(r,a[0],a[1]),c=[[...oe(s,o)],[...oe(n,l)]];if(this.heightGraphic)this.heightGraphic.geometry=new B({paths:[c],spatialReference:e});else{const a=new B({paths:[c],spatialReference:e});this.heightGraphic=new t({geometry:a,symbol:ut}),this._panoramicViewer.addGraphic(this.heightGraphic,0)}}async editOverlayedGraphics(e){this.sketchTriangularGraphicsLayer||this._initializeSketchTriangularGraphicsLayer(),this.sketchTriangularGraphicsLayer?.destroyed&&this._handleDestroyedTriangularSketchLayer(),this.sketchTriangularGraphicsLayer.add(e),this.sketchTriangular||(this._initializeSketchTriangular(),await this.loadTriangulatedMeasurementAdapter()),this.updateOverlayedGeometry(e)}updateOverlayedGeometry(e){this.sketchTriangular?.update([e],{tool:"reshape"})}async processMeasurementVectors(e){this.triangularMeasurementActive&&this.currentBestFeature&&(this.measurementVectors?.length<2&&await this.updateMeasurementVectorsArray(e),2===this.measurementVectors.length&&await this.calculateTriangulatedMeasurements(e))}async updateMeasurementVectorsArray(e){const t=this.measurementVectors.length?this.currentBestFeatureMeasurementImage:this.currentBestFeature;if(t){const a=await this.computeMeasurementVector(e,t);a&&this.measurementVectors.push(a)}}async computeMeasurementVector(e,t){const{activeViewer:a,mode:i}=this,r=a?.imageSize;if(!e||!t||!r)return;const s=e.map(e=>[e[0]-.5,-.5-e[1]]),o=this.view?.spatialReference,n=[];for(let l=0;l<s.length;l++){const e={x:s[l][0],y:s[l][1]};let a=await this.getMapPoint(e,{feature:t,imageSize:r,mode:i});o&&!a.spatialReference.equals(o)&&(a=await x(a,o)),n.push(a)}return ot(n,t)}async handleDrawEvents(e,t){if(this.draw)switch(e.type){case"cursor-update":this.handleDrawCursorUpdateEvents(e);break;case"vertex-add":this.handleDrawVertexAddEvents(e,t);break;case"draw-complete":await this.displayHeightResults()}}initializeMeasurement(e){switch(this.clearMeasurementGraphics(),this.resetMeasurementData(),e){case"distance":this.startMeasurement("polyline");break;case"area":this.startMeasurement("polygon");break;case"height":this.startHeightMeasurement()}}async overlayCameraLocations(e){const{activeViewer:a,currentBestFeature:i,overlayedCameraLocations:r,layer:s,mode:o,state:n,layerFloorFilterClause:l}=this,c=a?.imageSize;if(!c||!i||!s||"none"===o||n.includes("loading"))return;const{polygon:h}=$(i.attributes);if(a.removeManyGraphics(r.toArray()),r.removeAll(),e){const{features:e}=await s.queryFeatures({where:I(`${s.objectIdField} <> ${i.attributes.objectId}`,I(s.definitionExpression,l)),geometry:h,returnGeometry:!0,outFields:[s.objectIdField]}),n=await Promise.all(e.map(async e=>{const{attributes:a,geometry:r}=e,s=await this.getPixels(r,{feature:i,imageSize:c,mode:o}),n=dt.clone();return n.outline=new we({color:[0,0,0],width:1}),new t({attributes:a,symbol:n,geometry:s})}));r.addMany(n),a.addManyGraphics(r.toArray())}}overlayGraphicsOnImage(e,t){this.removeOverlayedGraphicsOnImage(e),this.overlayedMapFeatures.set(e,t),this.activeViewer?.addManyGraphics(t.toArray())}async overlayMapFeatures(e,a=!1){const{activeViewer:r,currentBestFeature:o,mode:n,state:l,layer:c}=this,h=r?.imageSize;if(!h||!o||"none"===n||"video"===n||l.includes("loading")||!c)return;const{polygon:m}=$(o.attributes);try{const{imageGeometryField:t,oiObjectIdField:a}=Ge(e,c.imageGeometryField,c.imageReferenceField);this.imageGeometryField=t.name,this.oiObjectIdField=a.name}catch(g){u.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features",g)}const{features:d}=await e.queryFeatures({geometry:m,returnGeometry:!0,outFields:["*"]}),p=new s((await Promise.all(d.map(async i=>{const r=i.symbol?.clone()??e.renderer?.getSymbol(i)?.clone(),{attributes:s,geometry:l}=i,c=l,{imageGeometryField:m,oiObjectIdField:d}=this;if(m&&d&&Re(e,m,d)&&`${s[d]}`==`${o.attributes.objectId}`)try{return Oe(s,m,e,a,h,n,r)}catch(g){u.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features","couldn't create graphic from attributes, geometry will be used",{error:g,feature:i,layer:e,imageGeometryField:this.imageGeometryField,imageReferenceField:this.oiObjectIdField})}switch(c?.type){case"point":{const i=await this.getPixels(c,{feature:o,imageSize:h,mode:n});return new t({attributes:s,layer:e,symbol:r,geometry:i,visible:e.visible&&a})}case"polygon":{const{rings:i,spatialReference:l}=c,u=i.map(e=>e.map(([e,t,a])=>new T({x:e,y:t,z:a,spatialReference:l}))),m=await Promise.all(u.map(async e=>this.getPixels(e,{feature:o,imageSize:h,mode:n}).then(e=>e.map(ue))));return new t({attributes:s,layer:e,symbol:r,geometry:new j({rings:m,spatialReference:E.WebMercator}),visible:e.visible&&a})}case"polyline":{const{paths:i,spatialReference:l}=c,u=i.map(e=>e.map(([e,t,a])=>new T({x:e,y:t,z:a,spatialReference:l}))),m=await Promise.all(u.map(async e=>this.getPixels(e,{feature:o,imageSize:h,mode:n}).then(e=>e.map(ue))));return new t({attributes:s,layer:e,symbol:r,geometry:new B({paths:m,spatialReference:E.WebMercator}),visible:e.visible&&a})}case"multipoint":{const{points:i,spatialReference:l}=c,u=i.map(([e,t,a])=>new T({x:e,y:t,z:a,spatialReference:l})),m=await this.getPixels(u,{feature:o,imageSize:h,mode:n}).then(e=>e.map(ue));return new t({attributes:s,layer:e,symbol:r,geometry:new O({points:m,spatialReference:E.WebMercator}),visible:e.visible&&a})}}return null}))).filter(i));this.overlayGraphicsOnImage(`${e.id}`,p)}async getPixels(e,t){const{imageSize:a,mode:i,feature:r}=t,s=(await this.worldToImage(Array.isArray(e)?e:[e],r)).map(e=>{if("default"===i)return new T({x:e.x-.5,y:.5-e.y,spatialReference:E.WebMercator});const[t,r]=a,{heading:s,pitch:o}=se(e,t,r),n=oe(s,o);return new T(n,E.WebMercator)});return Array.isArray(e)?s:s[0]}async getMapPoint(e,t){const{feature:a,mode:i,imageSize:r}=t,{elevationSample:s,attributes:o}=a,{elevationSource:n,location:l,cameraHeight:c}=o;let h=l.clone();h.spatialReference.isGeographic&&(h=await x(h,E.WebMercator));const u=await le(l.spatialReference,l.z??0,c,{elevationSample:s,elevationSource:n,extent:this.footprintExtent});let m;if("elevationSample"in u&&ce(u.elevationSample)&&(a.elevationSample=u.elevationSample),"default"===i){const t=ne(o,r[0],r[1]);m=await Y(Array.isArray(e)?e:[e],{...t,cameraLocation:h},u)}else{const t=he(o,r[0],r[1]);m=await ee(Array.isArray(e)?e:[e],{...t,cameraLocation:h},u)}return Array.isArray(e)?m:m[0]}getActiveSectors(){return Se.filter(e=>this._sectorData?.[e]?.length)}async plotMapPoint(e){return this.plotReferencePoint(e),this.transformAndPlotReferencePointOnImage({feature:this.currentBestFeature,selectedLocation:e,options:{signal:this._transformController?.signal}})}plotReferencePointOnGround(e){this._referencePointOnGround&&(this._overlays?.remove(this._referencePointOnGround),this._referencePointOnGround.destroy()),null!=e&&(this._referencePointOnGround=new t({geometry:new T({...e.toJSON()}),symbol:pt}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit("plot-ground-point",{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){if("image-loaded"===this.state)switch(this.clearReferencePointOnImage(),this.mode){case"default":{const a=C(e)?e.toJSON():e;a.x-=.5,a.y=.5-a.y,this._referencePointOnImage=new t({geometry:new T({spatialReference:this._imageViewer.imageRenderer.spatialReference,...a}),symbol:pt}),this._imageViewer.addGraphic(this._referencePointOnImage,0);break}case"panoramic":{const{imageSize:a}=this._panoramicViewer;if(!a)return;const[i,r]=a,{heading:s,pitch:o}=se(e,i,r),n=oe(s,o);this._referencePointOnImage=new t({geometry:new T(n,E.WebMercator),symbol:gt}),this._panoramicViewer.addGraphic(this._referencePointOnImage,0);break}}}plotLocationPointOnImage(e,t=!1){if("image-loaded"===this.state)switch(this.clearLocationPointOnImage(t),this.mode){case"default":this._plotLocationPointOnDefaultImage(e,t);break;case"panoramic":this._plotLocationPointOnPanoramicImage(e)}}removeAllOverlayMapFeatures(){this.overlayedMapFeatures.forEach(e=>{this._imageViewer.removeManyGraphics(e.toArray())}),this.overlayedMapFeatures.clear()}removeOverlayedGraphicsOnImage(e){const t=this.overlayedMapFeatures.get(e);t?.length&&(this.activeViewer?.removeManyGraphics(t.toArray()),this.overlayedMapFeatures.delete(e))}resetImage(){switch(this.setMessage("onLoadMessage","info"),this.mode){case"default":this._imageViewer.clearImage(),this._imageViewer.clearGraphics();break;case"panoramic":this._panoramicViewer.clearGraphics()}this._clickTask=d(this._clickTask)}resetVideo(){this.setMessage("onLoadMessage","info"),this.videoViewModel?.resetVideoHandler(),this._overlays?.removeAll(),this.videoViewModel=null,this.allLayerFeatures=[],this.currentBestFeature=null}resetMeasurementData(){this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.heightMeasurementPixels=[],this.measurementVectors=[],this.heightMeasurementResult=0,this.tempDistance=null,this.measurementAngle=null,this.heightMeasurementAccuracy=0,this.heightGraphic=null,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedMeasurementGraphic=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaAccuracy=0}async saveDrawing(){const{dataCaptureLayer:e,sketchAdapter:t}=this;if(!e||"data-capture"!==t?.type)return;const{pendingGraphics:a,savedGraphics:i}=t,r=a.get(e.id),s=r?.toArray();if(!r||!s?.length)return;const{addFeatureResults:o}=await this.saveDataCaptureFeatures(s),n=o.reduce((t,{objectId:a,globalId:i,error:r},o)=>{const n=s[o],{attributes:l}=n;return r?t.error.push(n):(a&&(l[e.objectIdField]=a),i&&e.globalIdField&&(l[e.globalIdField]=i),t.success.push(n)),t},{success:[],error:[]});i.addMany(n.success),r.removeAll(),r.addMany(n.error)}async saveDataCaptureFeatures(e){const{activeViewer:t,currentBestFeature:a,dataCaptureLayer:r,mode:s}=this,o=t?.imageSize;if(!o||!a||"none"===s||"video"===s)throw new n("orientedimagery","Image size, current best feature and mode are required to save data capture features");if(!r)throw new n("orientedimagery","Data capture layer is not available");const l=await Promise.all(e.map(async e=>{const t=e.clone(),{geometry:i}=t;if(!i)return;const n=i.type,l=r.hasZ,c=r.geometryType,h=n!==c,u=h?await import("./transformers.js"):null,m=u?.default[c],d=h?m?.(i):i;if(d)switch(d.type){case"point":return t.geometry=await this.getMapPoint(me(s,d,o),{feature:a,imageSize:o,mode:s}),l||(delete t.geometry.z,t.geometry.hasZ=!1),t.geometry.hasM=!1,t;case"polygon":{const e=await Promise.all(d.rings.map(async e=>this.getMapPoint(e.map(([e,t,a])=>me(s,{x:e,y:t,z:a},o)),{feature:a,imageSize:o,mode:s})));return t.geometry=new j({spatialReference:e[0][0].spatialReference,hasZ:l,hasM:!1,rings:e.map(e=>e.map(ue))}),t}case"polyline":{const e=await Promise.all(d.paths.map(async e=>this.getMapPoint(e.map(([e,t,a])=>me(s,{x:e,y:t,z:a},o)),{feature:a,imageSize:o,mode:s})));return t.geometry=new B({spatialReference:e[0][0].spatialReference,hasZ:l,hasM:!1,paths:e.map(e=>e.map(ue))}),t}}})),c=l.filter(i);return r.applyEdits({addFeatures:c}).then(e=>{const{addFeatureResults:t}=e;let a=0;const i=l.map(e=>{const i=t[a++];return e?i:{error:new n("orientedimagery","Error in saving data capture features"),objectId:null,globalId:null}});return{...e,addFeatureResults:i}})}async searchBestImage(e,t){try{const a=await N(e,t);a&&await this.processFeatureResponse(a,e.point,t)}catch(a){y(a)||(this.setMessage("imageLoadError","error",a.message),u.getLogger(this).error("error occurred while finding best image",a))}}selectTriangularMeasurementFeature(e){this.currentBestFeatureMeasurementImage=this.features?.find(({attributes:t})=>t.objectId===Number(e))}setAdditionalCameraLocationsVisibility(e){this.additionalCameraLocations.forEach(t=>{t.visible=e})}setAdditionalCoverageVisibility(e){this.additionalFootprints.forEach(t=>{t.visible=e})}setCurrentCoverageVisibility(e){this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.visible=e),this.currentBestFeatureLocation&&(this.currentBestFeatureLocation.visible=e)}setMapImageConversionToolState(e){this.mapImageConversionToolState=e}setCurrentPanoramaView(e,t){this._panoramicViewer?.set({yaw:e,pitch:t})}async startDataCapture(e,t){const a=this.activeViewer?.imageRenderer,{oiObjectIdField:i,currentBestFeature:r}=this;if(!a||!r||!i)return;const{attributes:{objectId:o}}=r,n=this.overlayedMapFeatures.get(e.id)?.toArray()??[],l=[],c=[];for(const s of n)`${s.getAttribute(i)}`==`${o}`?l.push(s):c.push(s);this.overlayGraphicsOnImage(e.id,new s(c)),this.collectionId=e.id;const h=await this.loadSketch(t),u=await this.loadDataCaptureAdapter(t);v(t),h.layer.addMany(l),h.layer.blendMode="source-atop",u.savedGraphics.addMany(l);a.ui.find("zoom").visible=!1,a.map.layers.add(this.sketchGraphicsLayer)}async stopDataCapture(e=!1){this.sketch?.cancel(),this.sketchGraphicsLayer?.removeAll(),this.sketchAdapter=p(this.sketchAdapter),this.sketch=p(this.sketch),this.collectionId=null;const{dataCaptureLayer:t}=this,a=this.activeViewer?.imageRenderer;if(!a||a.destroyed)return;a.map.layers.remove(this.sketchGraphicsLayer),e&&t&&await this.overlayMapFeatures(t,!0);const i=a.ui.find("zoom");i&&(i.visible=!0)}stopMeasurement(){this.heightMeasurementPixels=[],this.draw?.reset(),this.sketch?.cancel()}toggleAllOverlayMapFeatures(e){this.overlayedMapFeatures.forEach(t=>{this._toggleVisiblity(t,e)})}toggleOverlayMapFeatures(e,t){const a=this.overlayedMapFeatures.get(e);a&&this._toggleVisiblity(a,t)}toggleSelection(e){const{sketch:t}=this;t&&(t.updateOnGraphicClick=e,t.cancel())}async transformAndPlotReferencePointOnImage(e){const{feature:t,selectedLocation:a,options:i}=e;let r=!1,s=!1;const o=this.bestFeatureFootprint?.geometry;switch(o?.type){case"polygon":{const e=a.spatialReference.equals(o.spatialReference)?a:await x(a,o.spatialReference);r=o.contains(e);break}case"mesh":{const e=a.spatialReference.equals(o.spatialReference)?a:await x(a,o.spatialReference);s=o.extent.contains(e);break}}if(!r&&!s)return void this.clearReferencePointOnImage();const n=await this.worldToImage(a,t,i);if(n)return v(i),this.plotReferencePointOnImage(n),{x:n.x,y:n.y};this.clearReferencePointOnImage()}async triangulatedLocationWorkflow(e,t){if(this.currentBestFeature&&e){const{currentBestFeature:a}=this;this.triangulatedPoint&&(this.measurementVectors=[],this.triangulatedPoint=null,this.clearLocationPointOnImage(!0));const i=ot(e,a);if(!i)return;this.measurementVectors.push(i),await this.plotReferenceLocationPoint(e,t),v(t),this._createTriangularImageLocationHandle()}}async _calculateTriangulatedPointFromGroundPoint(e,t){if(this.currentBestFeatureMeasurementImage&&e){const{currentBestFeatureMeasurementImage:a}=this,i=ot(e,a);i&&this.measurementVectors.push(i);const r=await nt(this.measurementVectors);v(t),this.triangulatedPoint=r??this.triangulatedPoint}}async _fetchFeatures(e,t){if(!this.view)return;const a=this.layer;if(a){const i={include:a},r=this.view.toScreen(e);if(!r)return;const s=await this.view.hitTest(r,i);return this._processHitTestResults(a,s,t)}}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(a){if(y(a))return;this.setMessage("imageLoadError","error"),u.getLogger(this).error("error occurred while fetching features",a)}}_groupFeaturesBySectors(){const{_suitabilities:e,additionalFeatures:t,features:a,invalidCameraHeading:i}=this,r=a.at(0);if(!e||!t||!r||!a||i)return void(this._sectorData=null);this._sectorData={};const o={};this._featureToSector=o;for(const h of Se)this._sectorData[h]=new s;const n=e.map((e,t)=>({...e,featureIndex:t}));n.sort((e,t)=>e.trueSuitability-t.trueSuitability);const l=n.map(({distance:e})=>e),c=Math.max(...l);n.forEach(e=>{const{distance:t,angle:i,featureIndex:s}=e,n=t/c*Ce[2],l=It(t,c),h=Pt(i);if(!this._sectorData)return;const u=Ce[3]+n*Math.sin(i*Math.PI/180),m=Ce[3]+n*Math.cos(i*Math.PI/180);let d;const p=a.at(s),g=p===r,{cameraPitch:y}=p.attributes,v=y<5;if(g&&v)d=-90;else{const e=u-Ce[3],t=m-Ce[3],a=t/Math.sqrt(e**2+t**2);let i=180*Math.acos(a)/Math.PI;(e<0&&t<0||e<0&&t>0)&&(i*=-1),d=i}const f=""===l?h:`${l}_${h}`;g&&(d===this.bestFeatureAngle?this.previousFeatureAngle=d:this.bestFeatureAngle=d,this.navigatorCurrentBestFeature=v?null:{x:u,y:m,direction:h}),o[`${p.attributes.objectId}`]=f;const w=this._sectorData[f];w.add({angle:i,featureIndex:s,x:u,y:m,objectID:p.attributes.objectId,sector:f,featureIndexInSector:w.length})})}_handleDestroyedTriangularSketchLayer(){this.sketchTriangularGraphicsLayer&&(this.imageMeasurementViewer.imageRenderer.map.layers.remove(this.sketchTriangularGraphicsLayer),this.sketchTriangularGraphicsLayer=new D,this.imageMeasurementViewer.imageRenderer.map.layers.add(this.sketchTriangularGraphicsLayer),this.sketchTriangular&&(this.sketchTriangular.layer=this.sketchTriangularGraphicsLayer,this.sketchTriangular.view=this.imageMeasurementViewer.imageRenderer))}_initializeSketchTriangular(){this.sketchTriangular=new Tt({view:this.imageMeasurementViewer.imageRenderer,layer:this.sketchTriangularGraphicsLayer,updateOnGraphicClick:!1,defaultUpdateOptions:{toggleToolOnClick:!1}})}_initializeSketchTriangularGraphicsLayer(){this.sketchTriangularGraphicsLayer=new D,this.imageMeasurementViewer.imageRenderer.map.layers.add(this.sketchTriangularGraphicsLayer)}_initializeVideo(){if(this.videoElement||!this.currentBestFeature)return;this.removeHandles(jt.videoPlayerHandles),this.videoElement=new fe({video:this.currentBestFeature.attributes.imagePath,georeference:new ye({extent:new G(Ae)}),autoplay:!1}),this.videoElement.content?.loop&&(this.videoElement.content.loop=!1);const e=new U({source:this.videoElement,title:this.layer?.title,copyright:this.layer?.copyright});this.videoLayer=e,e&&this.videoMapView.map.layers.add(e),this.addHandles(St(this.videoMapView),jt.videoPlayerHandles),this.videoViewModel=new Lt({oiViewModel:this})}_plotLocationPointOnDefaultImage(e,a=!1){const i=C(e)?e.toJSON():e;i.x-=.5,i.y=.5-i.y,a?(this._correctedLocationPointOnImage=new t({geometry:new T({spatialReference:E.WebMercator,...i}),symbol:yt}),this.imageMeasurementViewer.addGraphic(this._correctedLocationPointOnImage,0)):(this._locationPointOnImage=new t({geometry:new T({spatialReference:E.WebMercator,...i}),symbol:yt}),this._imageViewer.addGraphic(this._locationPointOnImage,0))}_plotLocationPointOnPanoramicImage(e){const{imageSize:a}=this._panoramicViewer;if(!a)return;const[i,r]=a,{heading:s,pitch:o}=se(e,i,r),n=oe(s,o);this._locationPointOnImage=new t({geometry:new T(n,E.WebMercator),symbol:vt}),this._panoramicViewer.addGraphic(this._locationPointOnImage,0)}_clearFeatureGeometries(){this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll()}_checkFeatures(e){return!!e?.length||(this.setMessage("noImageError","error"),this.currentBestFeature=null,!1)}async _getElevationSampleFromGround(e,t,a){if(!e[0])return;const i=await R(e);if(this._updateFootprintWithFeatures(t,i),this.view?.supportsGround)try{return await this.view.map.ground.createElevationSampler(this.footprintExtent,a)}catch(r){y(r)||u.getLogger(this).error(r)}}async processElevationSample(e,t,a){const{elevationSource:i}=t[0].attributes,r=await this._getElevationSampleFromGround(e,t,a);return r||(i&&this.footprintExtent&&Q(i)?await ae({extent:this.footprintExtent,lod:i.lod,url:i.url,rasterFunction:i.rasterFunction}):void 0)}_processSuitableFeatures(e,t){return q({features:e,selectedPoint:t,camera:Vt(this.view)?this.view.camera:null,currentImage:this.currentBestFeature})}async _processHitTestResults(e,t,a){const{screenPoint:i,results:[r]}=t,s="graphic"===r?.type&&this.shouldShowSelectedImage,o=r?.mapPoint??this.view?.toMap(i);if(!o)return;const{layerFloorFilterClause:n}=this,l=e.spatialReference.equals(o.spatialReference)?o:await x(o,e.spatialReference),c=l.spatialReference.isGeographic?z(l):l,h=I("1=1",I(e.definitionExpression,n)),u=c.spatialReference.isGeographic?1:V(c.spatialReference),m={layerInstanceOrURL:e,point:c,queryParams:{where:h,maximumDistance:e.maximumDistance?e.maximumDistance/u:void 0,objectIds:s?[r.graphic.getAttribute(e.objectIdField)]:void 0}};await this.searchBestImage(m,a)}async _queryAndLoadByObjectId(e,t,a,i){this.displayMessage=null;const{response:r}=await Ot(e,t,a,i);if(v(i),!r?.features?.length)throw new Rt(t);const s=X($(r.features[0].attributes).polygon.centroid),o=V(s.spatialReference);this.selectedPoint=s;const n={layerInstanceOrURL:e,point:s,queryParams:{where:I(I("1=1",I(e.definitionExpression,a)),`${e.objectIdField} <> ${t}`),maximumDistance:e.maximumDistance?e.maximumDistance/o:void 0}},l=await N(n,i);v(i);const{features:c}=l;return c.push(r.features[0]),await this.processFeatureResponse(l,s,{...i,loadBestImage:!1})}_reorderTriangularSketchLayer(){const e=this.imageMeasurementViewer.imageRenderer.map.layers?.length;this.sketchTriangularGraphicsLayer&&e&&this.imageMeasurementViewer.imageRenderer.map.layers.reorder(this.sketchTriangularGraphicsLayer,e-1)}_resetCursor(){const{activeViewer:e,imageMeasurementViewer:t}=this;e&&(e.imageRenderer.cursor=this._previousCursor),t&&(t.imageRenderer.cursor=this._previousCursor)}async _setImageSource(e,t,a,i,r,s){e.imageSource={datasetFormat:t.toUpperCase(),url:a.split("?")[0]},e.customParameters=Object.fromEntries(i),e.imageRotation=r??0,await e.loadImage(s)}_setMeasurementCursor(){const{activeViewer:e,imageMeasurementViewer:t,triangularMeasurementActive:a}=this;e&&(this._previousCursor=e.imageRenderer.cursor,e.imageRenderer.cursor="crosshair"),t&&a&&(t.imageRenderer.cursor="crosshair")}_toggleVisiblity(e,t){e.forEach(e=>{e.visible=t})}async _updateElevationOfSelectedPointAndLocations(e,t,a,i){const r=ce(a),{location:s,cameraHeight:o}=e[0].attributes,n=await le(s.spatialReference,s.z,o,{elevationSample:r?a:void 0,elevationSource:r?void 0:e[0].attributes.elevationSource,extent:this.footprintExtent},i);v(i);const[l,...c]=await te([t,...e.map(e=>e.attributes.geometry.clone())],n);v(i),t.elevation=l.z,e.forEach((e,t)=>{e.attributes.elevation=c[t].z})}_updateFeatures(e,t=!0){if(!e.length)return this.currentBestFeature=null,void this.additionalFeatures.removeAll();this.features.removeAll(),this.features.addMany(e),this.navigationNodes.removeAll(),this.navigationNodes.addMany(e.map(e=>{const{geometry:t,attributes:a}=e,{isSpherical:i,cameraHeading:r,cameraPitch:s}=a;return new Ct({geometry:t,attributes:a,currentHeading:i?0:r,currentPitch:i?0:s})})),e.length>1?this.additionalFeatures.addMany(e.slice(1)):this.additionalFeatures.removeAll(),this._updateGroundElevation=!0,t&&(this.currentBestFeature=e[0]),"video"===this.mode&&(this._initializeVideo(),this.videoElement?.loaded&&this.videoViewModel?.playVideoFromSelectedLocation(e[0]))}_updateFootprintWithFeatures(e,t){const a=[];for(const{attributes:{geometry:i}}of e)t.contains(i)||a.push([i.x,i.y]);a.sort((e,t)=>+H([e,t])),t.addRing(a),this.footprintExtent=Me(t.extent,2,2)}async _updatePointsAndPolygons(e){const{pointSources:a,currentBestFeature:i,currentCoverageVisible:r,isAdditionalPointSourcesVisible:s,mode:o,layer:n}=this;if(i&&(this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.destroy(),this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null),!this.invalidCameraHeading)){await(this._adapter?.createFootprints(e)),v(e);for(const e of a)e.imageID===i.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:e.imageID},geometry:e.clone(),symbol:ft,visible:r}):this.additionalCameraLocations.push(new t({attributes:{imageID:e.imageID},geometry:e.clone(),symbol:dt,visible:s}));if("video"===o&&n&&!this.allLayerFeatures.length){const e=await W(n,i.geometry.spatialReference);e.features?.length&&(this.allLayerFeatures=e.features)}}}_updateCurrentBestFeature(e){if(!e)return;this.currentBestFeature=this.features?.at(e.featureIndex);const t=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;let a;if(t)a=-90;else{const t=e.x-Ce[3],i=e.y-Ce[3],r=i/Math.sqrt(t**2+i**2);let s=180*Math.acos(r)/Math.PI;(t<0&&i<0||t<0&&i>0)&&(s*=-1),a=s}a===this.bestFeatureAngle?this.previousFeatureAngle=a:this.bestFeatureAngle=a,this.navigatorCurrentBestFeature=t?null:{x:e.x,y:e.y,direction:e.sector.includes("_")?e.sector.split("_")[1]:e.sector}}_updateImageMeasurementBestFeature(e){e&&(this.currentBestFeatureMeasurementImage=this.features?.at(e.featureIndex))}clearGraphics(){this._imageViewer.clearGraphics(),this._panoramicViewer.clearGraphics(),this.imageMeasurementViewer.clearGraphics()}clearReferencePointOnImage(){this._referencePointOnImage&&(this._imageViewer.removeGraphic(this._referencePointOnImage),this._panoramicViewer.removeGraphic(this._referencePointOnImage),this._referencePointOnImage=p(this._referencePointOnImage))}clearLocationPointOnImage(e=!1){this._locationPointOnImage&&!e&&(this._imageViewer.removeGraphic(this._locationPointOnImage),this._panoramicViewer.removeGraphic(this._locationPointOnImage),this._locationPointOnImage=p(this._locationPointOnImage)),this._correctedLocationPointOnImage&&(this.imageMeasurementViewer.removeGraphic(this._correctedLocationPointOnImage),this._correctedLocationPointOnImage=p(this._correctedLocationPointOnImage))}plotReferencePoint(e){"mapPoint"in e?this.plotReferencePointOnGround(e.mapPoint):this.plotReferencePointOnGround(e)}async plotReferenceLocationPoint(e,t){if(this.currentBestFeatureMeasurementImage){const a=await this.worldToImage(e,this.currentBestFeatureMeasurementImage,{signal:t});v(t),a&&this.plotLocationPointOnImage(a,!0)}}setMessage(e,t,a,i){this.displayMessage={key:e,type:t,data:a,map:i}}async transformAndPlotSelectedLocation(e){const{currentBestFeature:t,invalidCameraHeading:a,selectedPoint:i,activeViewer:r}=this;if(this._crossSymbol&&(this._panoramicViewer.removeGraphic(this._crossSymbol),this._imageViewer.removeGraphic(this._crossSymbol),this._crossSymbol=p(this._crossSymbol)),!i||!t||"image-loaded"!==r?.state||a)return;let s;try{s=await this.worldToImage(i,t,e),v(e),await this.plotSelectedPointOnImage(s,e)}catch(o){y(o)||u.getLogger(this).error("failed to transform map point to pixel, cross symbol will not be plotted on image",{error:o,selectedPoint:i,feature:t})}}async worldToImage(e,t,a){const{footprintExtent:i}=this,{imageSize:r}=this.activeViewer;if("none"===this.mode||!t||!r||!i)return;const{attributes:{location:s,elevationSource:o,cameraHeading:n,cameraHeight:l},elevationSample:c}=t;let h=s.clone();const u=await le(s.spatialReference,s.z??0,l,{elevationSample:c,elevationSource:o});t.elevationSample=u.elevationSample;const m=Array.isArray(e)?e:[e];let d,p=await Promise.all(m.map(e=>new Promise(t=>{if(!e.hasZ)return t(te(e,u));t(e)})));if(s.spatialReference.isGeographic&&(h=await x(h,E.WebMercator,a)),p=await Promise.all(p.map(async e=>h.spatialReference.equals(e.spatialReference)?e:await x(e,h.spatialReference,a))),v(a),"panoramic"===this.mode)d=ge(p,{imageHeight:r[1],imageWidth:r[0],cameraHeading:n,cameraLocation:h});else{const e=de(t.attributes,r[0],r[1]);d=pe(p,{...e,cameraLocation:h})}return Array.isArray(e)?d:d[0]}updateCurrentCoveragePolygon(e){const{additionalFootprints:a,additionalCameraLocations:i,currentBestFeature:r,currentBestFeatureLocation:s,currentCoverageVisible:o,selectedPoint:n,view:l,_adapter:c,mode:h}=this,{attributes:{objectId:u},elevationSample:m}=r;if(this._initialCurrentCoverageUpdate){if(this._overlays?.removeAll(),this._initialCurrentCoverageUpdate=!1,this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=o,this.bestFeatureCurrentFootprint=e),l){const e=[...a,...i,s].filter(kt);l.supportsGround&&m&&c?.updateGroundElevation&&(this._updateGroundElevation&&c.updateGroundElevation(e,m),"panoramic"===h&&c.updateGroundElevation([this.bestFeatureCurrentFootprint],m)),this._updateGroundElevation=!1,n&&(e.splice(-2,0,this.bestFeatureCurrentFootprint),e.push(new t({geometry:n.clone(),symbol:lt.clone(),attributes:{imageID:u}}))),this._overlays.graphics.addMany(e)}}else if(l){if(this.invalidCameraHeading)return;this.bestFeatureCurrentFootprint&&(this._overlays?.remove(this.bestFeatureCurrentFootprint),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint));const t=this.bestFeatureCurrentFootprint&&this._overlays?this._overlays.graphics.indexOf(this.bestFeatureCurrentFootprint):-1;e&&(this.bestFeatureCurrentFootprint=e,l?.supportsGround&&m&&c?.updateGroundElevation&&"panoramic"===h&&c.updateGroundElevation([e],m),e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}};e([k()],Ht.prototype,"activeLayer",null),e([k({readOnly:!0})],Ht.prototype,"activeViewer",null),e([k()],Ht.prototype,"accuracyParametersMissing",null),e([k()],Ht.prototype,"additionalFeatures",void 0),e([k({type:s.ofType(t)})],Ht.prototype,"additionalCameraLocations",void 0),e([k({type:s.ofType(t)})],Ht.prototype,"additionalFootprints",void 0),e([k()],Ht.prototype,"areaMeasurementResult",void 0),e([k()],Ht.prototype,"areaMeasurementAccuracy",void 0),e([k()],Ht.prototype,"allLayerFeatures",void 0),e([k()],Ht.prototype,"bestFeatureAngle",void 0),e([k()],Ht.prototype,"bestFeatureCurrentFootprint",void 0),e([k({type:t})],Ht.prototype,"bestFeatureFootprint",void 0),e([k({type:Number})],Ht.prototype,"brightness",null),e([k()],Ht.prototype,"cameraHeadingThreshold",void 0),e([k()],Ht.prototype,"cameraPitchThreshold",void 0),e([k()],Ht.prototype,"clickAction",void 0),e([k()],Ht.prototype,"videoViewModel",void 0),e([k()],Ht.prototype,"collectionId",void 0),e([k({type:Number})],Ht.prototype,"contrast",null),e([k()],Ht.prototype,"conversionProps",void 0),e([k()],Ht.prototype,"coverageFrustums",void 0),e([k()],Ht.prototype,"coveragePolygons",void 0),e([k()],Ht.prototype,"currentBestFeature",void 0),e([k()],Ht.prototype,"currentBestFeatureMeasurementImage",void 0),e([k()],Ht.prototype,"currentBestFeatureLocation",void 0),e([k()],Ht.prototype,"currentCoverageVisible",void 0),e([k()],Ht.prototype,"currentNode",null),e([k()],Ht.prototype,"navigationNodes",void 0),e([k({json:{write:!1}})],Ht.prototype,"determineWorkflowForFeature",void 0),e([k({json:{write:!1}})],Ht.prototype,"determineWorkflowForTriangularMeasurement",void 0),e([k()],Ht.prototype,"disabled",void 0),e([k()],Ht.prototype,"displayMessage",void 0),e([k()],Ht.prototype,"displayNewMeasurementButton",void 0),e([k()],Ht.prototype,"distanceMeasurementResult",void 0),e([k()],Ht.prototype,"distanceAccuracyArray",void 0),e([k()],Ht.prototype,"dataCaptureLayer",void 0),e([k({readOnly:!0})],Ht.prototype,"featureCount",null),e([k()],Ht.prototype,"features",void 0),e([k()],Ht.prototype,"groundCoordinates",void 0),e([k()],Ht.prototype,"groundCoordinatesAccuracy",void 0),e([k()],Ht.prototype,"heightMeasurementPixels",void 0),e([k()],Ht.prototype,"heightGraphic",void 0),e([k()],Ht.prototype,"heightMeasurementResult",void 0),e([k()],Ht.prototype,"heightMeasurementAccuracy",void 0),e([k()],Ht.prototype,"measurementAngle",void 0),e([k()],Ht.prototype,"tempDistance",void 0),e([k({readOnly:!0})],Ht.prototype,"imageGalleryEnabled",null),e([k()],Ht.prototype,"imageGeometryField",void 0),e([k({readOnly:!0})],Ht.prototype,"imageLoaded",null),e([k()],Ht.prototype,"imageLocationToolState",void 0),e([k({readOnly:!0})],Ht.prototype,"invalidCameraHeading",null),e([k()],Ht.prototype,"imagePointsInView",null),e([k()],Ht.prototype,"imageMeasurementViewer",void 0),e([k()],Ht.prototype,"isAdditionalCoverageVisible",void 0),e([k()],Ht.prototype,"isAdditionalPointSourcesVisible",void 0),e([k()],Ht.prototype,"measurementVectors",void 0),e([k()],Ht.prototype,"layer",void 0),e([k()],Ht.prototype,"layerView",null),e([k({readOnly:!0})],Ht.prototype,"layerFloorFilterClause",null),e([k({type:Number})],Ht.prototype,"localPort",void 0),e([k()],Ht.prototype,"mapImageConversionToolState",void 0),e([k()],Ht.prototype,"measureType",void 0),e([k()],Ht.prototype,"measurementGraphic",void 0),e([k({readOnly:!0,value:"none"})],Ht.prototype,"mode",null),e([k()],Ht.prototype,"navigationMode",void 0),e([k()],Ht.prototype,"navigatorCurrentBestFeature",void 0),e([k()],Ht.prototype,"oiObjectIdField",void 0),e([k({type:s.ofType(t)})],Ht.prototype,"overlayedCameraLocations",void 0),e([k()],Ht.prototype,"overlayedMapFeatures",void 0),e([k()],Ht.prototype,"pixelCoordinates",void 0),e([k()],Ht.prototype,"preserveAngle",void 0),e([k()],Ht.prototype,"pointSources",void 0),e([k({readOnly:!0})],Ht.prototype,"popupEnabled",null),e([k()],Ht.prototype,"previousFeatureAngle",void 0),e([k()],Ht.prototype,"referencePoint",null),e([k({readOnly:!0})],Ht.prototype,"sectorData",null),e([k()],Ht.prototype,"selectedPoint",void 0),e([k({type:Number})],Ht.prototype,"sharpness",null),e([k()],Ht.prototype,"shouldShowSelectedImage",void 0),e([k()],Ht.prototype,"sketch",void 0),e([k()],Ht.prototype,"sketchTriangular",void 0),e([k()],Ht.prototype,"sketchTriangularGraphicsLayer",void 0),e([k()],Ht.prototype,"draw",void 0),e([k()],Ht.prototype,"sketchAdapter",void 0),e([k({readOnly:!0})],Ht.prototype,"sketchGraphicsLayer",null),e([k({readOnly:!0})],Ht.prototype,"state",null),e([k({readOnly:!0})],Ht.prototype,"thumbnails",null),e([k()],Ht.prototype,"triangularMeasurementActive",void 0),e([k()],Ht.prototype,"triangulatedDistanceMeasurement",void 0),e([k()],Ht.prototype,"triangulatedDistanceAccuracy",void 0),e([k()],Ht.prototype,"triangulatedAreaMeasurement",void 0),e([k()],Ht.prototype,"triangulatedAreaAccuracy",void 0),e([k()],Ht.prototype,"triangulatedMeasurementGraphic",void 0),e([k()],Ht.prototype,"triangulatedPoint",void 0),e([k()],Ht.prototype,"triangulatedMeasurementAdapter",void 0),e([k()],Ht.prototype,"updateFootprint",void 0),e([k()],Ht.prototype,"updateFootprintPanorama",void 0),e([k()],Ht.prototype,"updatingTriangularMeasurementState",void 0),e([k({value:null})],Ht.prototype,"view",null),e([k()],Ht.prototype,"videoElement",void 0),e([k()],Ht.prototype,"videoLayer",void 0),e([k()],Ht.prototype,"videoMapView",void 0),e([k()],Ht.prototype,"_adapter",void 0),e([k()],Ht.prototype,"_sketchGraphicsLayer",null),e([k()],Ht.prototype,"_highlightedFeatureHandle",void 0),e([k()],Ht.prototype,"_imageViewer",void 0),e([k()],Ht.prototype,"_initialCurrentCoverageUpdate",void 0),e([k()],Ht.prototype,"_locationPointOnImage",void 0),e([k()],Ht.prototype,"_correctedLocationPointOnImage",void 0),e([k()],Ht.prototype,"_overlays",void 0),e([k({readOnly:!0})],Ht.prototype,"_overlaysView",null),e([k()],Ht.prototype,"_panoramicViewer",void 0),e([k()],Ht.prototype,"_previousCursor",void 0),e([k()],Ht.prototype,"_referencePointOnGround",void 0),e([k()],Ht.prototype,"_referencePointOnImage",void 0),e([k()],Ht.prototype,"_sectorData",void 0),e([k()],Ht.prototype,"_featureToSector",void 0),e([k({readOnly:!0})],Ht.prototype,"_updatingHandles",void 0),e([k()],Ht.prototype,"footprintExtent",void 0),e([k()],Ht.prototype,"_featureChangedTask",void 0),Ht=e([S("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],Ht);const zt=Ht;export{zt as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import{equals as a,isSome as i}from"../../core/arrayUtils.js";import{createTask as r}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import{deprecatedProperty as o}from"../../core/deprecate.js";import n from"../../core/Error.js";import l from"../../core/Evented.js";import{makeHandle as c}from"../../core/handleUtils.js";import{equalsShallow as u}from"../../core/lang.js";import h from"../../core/Logger.js";import{clamp as m}from"../../core/mathUtils.js";import{abortMaybe as d,destroyMaybe as p}from"../../core/maybe.js";import g from"../../core/Promise.js";import{isAbortError as y,throwIfAborted as v,waitTick as f}from"../../core/promiseUtils.js";import w from"../../core/ReactiveMap.js";import{whenOnce as F,on as b,watch as M,syncAndInitial as _,initial as P}from"../../core/reactiveUtils.js";import{sqlAnd as I}from"../../core/sql.js";import{getMetersPerUnitForSR as V}from"../../core/unitUtils.js";import{property as k}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as S}from"../../core/accessorSupport/decorators/subclass.js";import{distance as A}from"../../core/libs/gl-matrix-2/math/vec2.js";import{isSerializable as C}from"../../core/support/jsonUtils.js";import{UpdatingHandles as L}from"../../core/support/UpdatingHandles.js";import G from"../../geometry/Extent.js";import{union as R}from"../../geometry/geometryEngineAsync.js";import O from"../../geometry/Multipoint.js";import T from"../../geometry/Point.js";import j from"../../geometry/Polygon.js";import B from"../../geometry/Polyline.js";import{projectWithZConversion as x}from"../../geometry/projectionUtils.js";import E from"../../geometry/SpatialReference.js";import{isClockwise as H}from"../../geometry/support/coordsUtils.js";import{geographicToWebMercator as z}from"../../geometry/support/webMercatorUtils.js";import D from"../../layers/GraphicsLayer.js";import U from"../../layers/MediaLayer.js";import{searchImages as N,getSortedLayerFeatures as W}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as q}from"../../layers/orientedImagery/core/bestImageUtils.js";import{createCoveragePolygon as $,computePolygonForInspection as J,resizePolygon as Z,checkIfPolygonContainsSelectedPoint as K}from"../../layers/orientedImagery/core/coverageUtils.js";import{isElevationSource as Q}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{convertGeographicToWebMercator as X}from"../../layers/orientedImagery/core/utils.js";import{imageToWorld as Y,imageToWorldPanoramic as ee}from"../../layers/orientedImagery/transformations/imageToWorld.js";import te from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as ae}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{or as ie,getInitialAngle as re,convertPixelToHeadingPitch as se,convertHeadingPitchToSphereVertex as oe,getImageToWorldProperties as ne,getUpdateElevationProps as le,isElevationSampler as ce,getImageToWorldPanoramicProperties as ue,pointToArray as he,transformGraphicCoordinatesToPixel as me,getWorldToImageProperties as de}from"../../layers/orientedImagery/transformations/utils.js";import{worldToImage as pe,worldToImagePanoramic as ge}from"../../layers/orientedImagery/transformations/worldToImage.js";import ye from"../../layers/support/ExtentAndRotationGeoreference.js";import{getFloorFilterClause as ve}from"../../layers/support/floorFilterUtils.js";import fe from"../../layers/support/VideoElement.js";import we from"../../symbols/SimpleLineSymbol.js";import Fe from"../../views/MapView.js";import be from"../../views/draw/Draw.js";import{scale as Me}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as _e}from"../../views/input/InputManager.js";import Pe from"../PanoramicViewer.js";import{defaultAngleThresholdInDegrees as Ie,videoExtent as Ve,invalidCameraHeading as ke,sectorsInOrder as Se,sampleExtent as Ae,sectorsRadii as Ce}from"./constants.js";import{configureSketchTool as Le,extractFieldsFromDataCaptureLayer as Ge,isValidDataCaptureLayer as Re,constructGraphicFromImageGeometry as Oe}from"./dataCaptureUtils.js";import{isFeatureAttachment as Te,getImageSourceFromAttachment as je}from"./galleryUtils.js";import{formatPixels as Be,heightMeasurementPanoramic as xe,heightMeasurement2D as Ee,calculateHeightAccuracyPanoramic as He,calculateHeightAccuracy as ze,pixelAreaMeasurement2D as De,pixelAreaMeasurementPanoramic as Ue,pixelDistanceMeasurement2D as Ne,pixelDistanceMeasurementPanoramic as We,generateCombinations as qe,getRootOfSumOfSquaredErrors as $e,generateCombinationsPanoramic as Je,calculateLocationAccuracyFromDeviations as Ze,calculateReferenceImagePointPanoramic as Ke,calculateAnglePano as Qe,calculateTempImagePoint as Xe,calculateAngle as Ye,computeTriangulatedAreaMeasurement as et,computeTriangulatedDistanceMeasurement as tt,getModeCorrectedPoint as at,calculateCorrectedPixel as it,getUnitRateFromSpatialReference as rt,calculateHeightFromTemporaryDistance as st,computeTriangulatedVector as ot,computeTriangulatedPoint as nt}from"./imageMeasurementUtils.js";import{crossSymbol as lt,crossSymbol3D as ct,measurementPolygonSymbol as ut,polylineSymbolPanoramic as ht,measurementPolylineSymbol as mt,sourcePointSymbol as dt,diamondSymbol as pt,diamondSymbol3D as gt,locationSymbol as yt,locationSymbol3D as vt,activeSourcePointSymbol as ft}from"./symbols.js";import{isNoAttachmentError as wt,getContentType as Ft,isTifOrMrf as bt,filterOILLayerView as Mt,assignElevationSampleToFeatures as _t,calculateDirection as Pt,calculateSegment as It,isSceneView as Vt,isGraphic as kt}from"./utils.js";import{disableVideoZoomAndPan as St}from"./videoViewerUtils.js";import At from"./components/ImageViewer.js";import Ct from"./components/NavigationNode.js";import Lt from"./components/OrientedImageryVideoViewModel.js";import{NoActiveViewerError as Gt,NoFeatureFoundWithObjectIdError as Rt}from"./navigation/errors.js";import{queryFeatureByObjectIds as Ot}from"./navigation/queries.js";import Tt from"../Sketch/SketchViewModel.js";const jt={click:"view-click",imageClick:"image-click",triangularImageClick:"triangular-click",interactionHandles:"interaction-handles",hittestHandles:"hittest-handles",videoPlayerHandles:"video-handles"},Bt=new Set(["JPG","JPEG"]),xt=/\.(\w+)$/,Et=()=>new n("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first");let Ht=class extends(l.EventedMixin(g)){constructor(e){super(e),this.additionalFeatures=new s,this.additionalCameraLocations=new s,this.additionalFootprints=new s,this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.allLayerFeatures=[],this.bestFeatureAngle=0,this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null,this.cameraHeadingThreshold=Ie,this.cameraPitchThreshold=Ie,this.clickAction="hittest",this.videoViewModel=null,this.collectionId=null,this.conversionProps=null,this.coverageFrustums=new s,this.coveragePolygons=new s,this.currentBestFeature=null,this.currentBestFeatureMeasurementImage=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.navigationNodes=new s,this.determineWorkflowForFeature=async(e,t,a)=>{const{currentBestFeature:i,selectedPoint:r,view:s}=this;if(s?.closePopup(),i&&r){this._initialCurrentCoverageUpdate=!0,this._updateGroundElevation=!0;try{await this._updatePointsAndPolygons(a),await this._loadImage(a)}catch(o){y(o)||(this.loadImageError(o),h.getLogger(this).error("#loadIImage()","error occured while loading image",o))}}},this.determineWorkflowForTriangularMeasurement=async(e,t,a)=>{if(this.view?.closePopup(),this.currentBestFeatureMeasurementImage&&this.selectedPoint)try{await this._loadMeasurementViewerImage(a)}catch(i){y(i)||(this.loadImageError(i),h.getLogger(this).error("#loadIImage()","error occured while loading image",i))}},this.disabled=!1,this.displayMessage={key:"onLoadMessage",type:"info"},this.displayNewMeasurementButton=!0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.dataCaptureLayer=null,this.features=new s,this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.heightMeasurementPixels=[],this.heightGraphic=null,this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.measurementAngle=null,this.tempDistance=null,this.imageGeometryField=null,this.imageLocationToolState=!1,this.imageMeasurementViewer=new At,this.isAdditionalCoverageVisible=!1,this.isAdditionalPointSourcesVisible=!1,this.measurementVectors=[],this.layer=null,this.localPort=null,this.mapImageConversionToolState=!1,this.measureType=null,this.measurementGraphic=null,this.navigatorCurrentBestFeature=null,this.oiObjectIdField=null,this.overlayedCameraLocations=new s,this.overlayedMapFeatures=new w,this.pixelCoordinates=null,this.preserveAngle="none",this.pointSources=new s,this.previousFeatureAngle=0,this.selectedPoint=null,this.shouldShowSelectedImage=!1,this.sketch=null,this.sketchTriangular=null,this.sketchTriangularGraphicsLayer=null,this.draw=null,this.sketchAdapter=null,this.triangularMeasurementActive=!1,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedAreaAccuracy=0,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.triangulatedMeasurementAdapter=null,this.updateFootprint=async(e,t)=>{"default"===this.mode&&"image-loaded"!==this.state||"video"===this.mode&&!this.videoElement?.content||await(this._adapter?.updateFootprint(e,t))},this.updateFootprintPanorama=async(e,t)=>{await(this._adapter?.updateFootprintPanorama(e,t))},this.updatingTriangularMeasurementState=!1,this.videoElement=null,this.videoLayer=null,this.videoMapView=new Fe({map:new Map}),this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new At,this._initialCurrentCoverageUpdate=!0,this._locationPointOnImage=null,this._correctedLocationPointOnImage=null,this._overlays=new D({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"}}),this._panoramicViewer=new Pe,this._previousCursor=null,this._referencePointOnGround=null,this._referencePointOnImage=null,this._sectorData=null,this._featureToSector=null,this._updatingHandles=new L,this._clickTask=null,this._crossSymbol=null,this.footprintExtent=null,this._featureChangedTask=null,this._openPopupTask=null,this._suitabilities=null,this._transformController=new AbortController,this._updateFootprintTask=null,this._updateGroundElevation=!1,this.addUpdatingPromise=e=>this._updatingHandles.addPromise(e),this.hideImageGeometry=e=>{},this.highlight=e=>{if(!this._overlaysView)return;this.removeHighlight();const t=this.additionalFootprints.find(({attributes:{imageID:t}})=>t===Number(e));this._highlightedFeatureHandle=t?this._overlaysView?.highlight(t):null},this.loadDataCaptureAdapter=async e=>{await this.loadSketch(e);const t=import("./adapters/sketch/DataCaptureAdapter.js"),{default:a}=await t;return v(e),this.sketchAdapter=new a({viewModel:this}),this.sketchAdapter},this.loadImageFromSource=async(e,t)=>this._updatingHandles.addPromise(this._loadImageFromSourceInternal(e,t)),this.storeImageMeasurementViewer=e=>{this.imageMeasurementViewer=e},this.loadImageViewer=e=>{this._imageViewer?.destroy(),this._imageViewer=e},this.loadPanoramicViewer=e=>{this._panoramicViewer?.destroy(),this._panoramicViewer=e},this.loadVideoViewer=e=>{this.videoMapView.container=e},this.showImageByObjectId=async(e,t)=>{const a=this.additionalFeatures.find(({attributes:t})=>t.objectId===e);if(a)this.currentBestFeature=a;else{const{layer:a,layerFloorFilterClause:r}=this;if(!a)return void this.setMessage("noLayerSelected","info");this.beforeLoad();const s=this._updatingHandles.addPromise(this._queryAndLoadByObjectId(a,e,r,t));try{await s,await this.selectBestFeature(e,t)}catch(i){y(i)||(h.getLogger(this).error("oriented-imagery-viewer:show-image",i),"NoFeatureFoundWithObjectIdError"===i.name?this.setMessage("noFeatureFoundWithObjectId","error","",{objectId:e}):this.setMessage("imageLoadError","error",i.message))}}},this.imageToImageTransform=async(e,t,a)=>{const{updateElevationProps:i,...r}=t,{updateElevationProps:s,...o}=a,n=await Y(e,r,i);return pe(n,o)},this.getSectorFeatureById=e=>this._suitabilities?.find(({feature:{attributes:{objectId:t}}})=>t===e),this.getFeatureSectorById=e=>this._featureToSector?.[`${e}`],this.navigate=async(e,t)=>{const{activeViewer:a}=this;if(!a)throw new Gt;return await a.navigate(e,t)},this.removeHighlight=()=>this._highlightedFeatureHandle?.remove(),this.revealImageGeometry=e=>{},this.selectBestFeature=async(e,t)=>(v(t),this.currentBestFeature=this.features?.find(({attributes:t})=>`${t.objectId}`==`${e}`),F(()=>"image-loaded"===this.state,t)),this.toggleImageAttributes=()=>{d(this._openPopupTask),this._openPopupTask=r(async e=>{const{currentBestFeature:a,popupEnabled:i,layer:r,view:s}=this;if(s?.closePopup(),!(s&&a&&i&&r))return;const{attributes:o,geometry:n}=a,l=new t({geometry:n,attributes:o.toJSON(),layer:r,sourceLayer:r});v(e),await s.openPopup({features:[l],location:o.location.clone()})})},this.updateSuitabilities=(e,t=!0)=>{e.sort((e,t)=>e.suitability-t.suitability),this._suitabilities=e;const a=this._suitabilities.map(({feature:e})=>e);this._initialCurrentCoverageUpdate=!0,this._updateFeatures(a,t),this._groupFeaturesBySectors()},this._createViewClickHandle=()=>{if(this.removeHandles(jt.click),"disabled"===this.state||null==this.view)return;const e=this.mapImageConversionToolState&&"image-loaded"===this.state?this._mapImageConversionToolViewClickHandler:this._viewClickHandler;this.addHandles(this.view.on("click",e,_e.WIDGET),jt.click)},this._createImageClickHandle=()=>{this.removeHandles(jt.imageClick);const{mapImageConversionToolState:e,mode:t,activeViewer:a,currentBestFeature:i,footprintExtent:s}=this,o=a?.imageSize;if(!(e&&"none"!==t&&o&&s&&i))return;const n=a.clickAction;this.clickAction="pixel-location";const l=c(()=>{this.clickAction=n});let u=null;const h=b(()=>a,"pixel-location",e=>{this.plotReferencePointOnImage(e),u?.abort(),u=r(async a=>{if(!e)return;const r=await this.getMapPoint(e,{feature:i,imageSize:o,mode:t}).then(e=>{const t=this.view?.spatialReference;return ie(!t,e.spatialReference.equals(t))?e:x(e,t)});v(a),this.plotReferencePointOnGround(r)})});this.addHandles([h,l],jt.imageClick)},this._createTriangularImageClickHandle=()=>{this.removeHandles(jt.triangularImageClick);const e=this.imageMeasurementViewer?.imageSize;this.triangularMeasurementActive&&"none"!==this.mode&&e&&this.currentBestFeature&&this.addHandles(this.imageMeasurementViewer.imageRenderer.on("double-click",this._measurementImageClickHandler),jt.triangularImageClick)},this._createTriangularImageLocationHandle=()=>{this.removeHandles(jt.triangularImageClick);const{imageLocationToolState:e,mode:t,imageMeasurementViewer:a}=this,i=a?.imageSize;if(!e||"none"===t||!i)return;this.clickAction="pixel-location";let s=null;const o=b(()=>a,"pixel-location",e=>{1===this.measurementVectors.length&&(this.plotLocationPointOnImage(e,!0),s?.abort(),s=r(async a=>{if(!e||this.triangulatedPoint||2===this.measurementVectors?.length||!this.currentBestFeatureMeasurementImage)return;let r=await this.getMapPoint(e,{feature:this.currentBestFeatureMeasurementImage,imageSize:i,mode:t});v(a);const s=this.currentBestFeatureMeasurementImage.geometry.spatialReference;s&&!r.spatialReference.equals(s)&&(r=await x(r,s),v(a)),await this._calculateTriangulatedPointFromGroundPoint(r,{signal:a}),v(a)}))});this.addHandles(o,jt.triangularImageClick)},this._createImageLocationHandle=()=>{this.removeHandles(jt.imageClick);const{imageLocationToolState:e,mode:t,activeViewer:a,currentBestFeature:i,footprintExtent:s}=this,o=a?.imageSize;if(!(e&&"none"!==t&&o&&s&&i))return;this.clickAction="pixel-location";let n=null;const l=b(()=>a,"pixel-location",e=>{this.pixelCoordinates=e,this.plotLocationPointOnImage(e),n?.abort(),n=r(async a=>{if(!e)return;let r=await this.getMapPoint(e,{feature:i,imageSize:o,mode:t});v(a);const s=this.view?.spatialReference;s&&!r.spatialReference.equals(s)&&(r=await x(r,s),v(a)),this.groundCoordinates=r,this.triangularMeasurementActive&&r&&await this.triangulatedLocationWorkflow(r,a);const n=await this.calculateLocationAccuracy(e,r,t,a);v(a),n&&(this.groundCoordinatesAccuracy=n)})});this.addHandles(l,jt.imageClick)},this._handleImageHitTestResponse=async e=>{const{layer:t,overlayedCameraLocations:a}=this;if(!t)return;const i=e.results.find(({graphic:e,graphic:{attributes:i}})=>a.includes(e)&&i&&!i[t.imageReferenceField]&&!i[t.imageGeometryField]);if(!i)return;const r=i.graphic.attributes[t.objectIdField];await this.showImageByObjectId(r)},this._loadImage=async e=>{const{currentBestFeature:t,layer:a,mode:i}=this;if(this.clearGraphics(),!a||!t||"none"===i||"video"===i)return;const{attributes:r}=t,{imagePath:s,imageRotation:o,cameraHeading:n,cameraRoll:l,cameraPitch:c,objectId:u,cameraOrientation:m,location:d}=r,p=(l??0)+(o??0),g=d.spatialReference.isWGS84&&4!==m?.type?z(d):new T(d);let f=s;if(Te(s))try{f=await je(a,u,e)}catch(w){if(y(w))return;return wt(w)?(h.getLogger(this).error(w),void this.setMessage("noAttachment","error",`${a.objectIdField}: ${u}`)):(h.getLogger(this).error(w,{[a.objectIdField]:u,layer:a}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${a.objectIdField} ${u}`))}try{await this.loadImageFromSource(f,{imageRotation:p,options:e,pitch:c,yaw:n,mode:i,cameraLocation:g}),v(e),await this.transformAndPlotSelectedLocation(e)}catch(w){y(w)||this.loadImageError(w)}},this._loadImageFromSourceInternal=async(e,t)=>{const{mode:a,imageRotation:i,options:r}=t,s="string"==typeof e,o=s?e:e.url,{pathname:n,searchParams:l}=new URL(o);let c=s?n.match(xt)?.[1]:e.datasetFormat;if(!c)try{c=await Ft(o,{...t.options})}catch(u){y(u)||h.getLogger(this).error("#getContentType()",u)}switch(c??="UNKNOWN FORMAT",a){case"default":this.triangularMeasurementActive?await this._setImageSource(this.imageMeasurementViewer,c,o,l,i,r):await this._setImageSource(this._imageViewer,c,o,l,i,r);break;case"panoramic":if(Bt.has(c.toUpperCase())){const{selectedPoint:e}=this,{pitch:a,yaw:i,cameraLocation:s,viewAngle:n}=t;this._panoramicViewer.imageSource=o;let l=i??0;"number"==typeof n?l=n-l:s&&e&&(l=await re(s,e)-l),this._panoramicViewer.pitch=a??0,this._panoramicViewer.yaw=l,await this._panoramicViewer.loadImage(r)}else this.setMessage("unsupportedPanoramicImageryError","error",void 0,{datasetFormat:c});break}},this._loadMeasurementViewerImage=async e=>{const{currentBestFeatureMeasurementImage:t,layer:a,mode:i}=this;if(this.imageMeasurementViewer.clearGraphics(),!a||!t||"none"===i||"video"===i)return;const{attributes:r}=t,{imagePath:s,imageRotation:o,cameraHeading:n,cameraRoll:l,cameraPitch:c,objectId:u,cameraOrientation:m,location:d}=r,p=(l??0)+(o??0),g=d.spatialReference.isWGS84&&4!==m?.type?z(d):new T(d);let f=s;if(Te(s))try{f=await je(a,u,e)}catch(w){if(y(w))return;return wt(w)?(h.getLogger(this).error(w),void this.setMessage("noAttachment","error",`${a.objectIdField}: ${u}`)):(h.getLogger(this).error(w,{[a.objectIdField]:u,layer:a}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${a.objectIdField} ${u}`))}try{await this.loadImageFromSource(f,{imageRotation:p,options:e,pitch:c,yaw:n,mode:i,cameraLocation:g}),v(e)}catch(w){y(w)||this.loadImageError(w)}},this._loadViewAdapter=async e=>{const{view:t}=this;if(t)switch(t.type){case"2d":{const{default:t}=await import("./adapters/view/MapViewAdapter.js");v(e),this._adapter=new t(this);break}case"3d":{const{default:t}=await import("./adapters/view/SceneViewAdapter.js");v(e),this._adapter=new t(this);break}}else this._adapter=null},this._mapImageConversionToolViewClickHandler=e=>{e.stopPropagation(),e.preventDefault(),e.mapPoint&&this.plotMapPoint(e.mapPoint)},this._measurementImageClickHandler=e=>{e.stopPropagation(),e.preventDefault();const{sketchTriangular:t,triangularMeasurementActive:a,currentBestFeatureMeasurementImage:i,triangulatedMeasurementGraphic:r}=this;t&&a&&i&&r&&"active"!==t.state&&(t.update([r],{tool:"reshape"}),this.updatingTriangularMeasurementState=!0)},this._viewClickHandler=e=>{this._clickTask?.abort(),this._clickTask=r(async t=>{const{pointerType:a,button:i,mapPoint:r}=e;if(("mouse"!==a||0===i)&&r)return e.stopPropagation(),e.preventDefault(),this._updatingHandles.addPromise(this.loadBestImage(r,{signal:t}))})},this.plotSelectedPointOnImage=async(e,a)=>{if(await f(a),!e)return;const i=new T({...C(e)?e.toJSON():e});if("default"===this.mode)i.x-=.5,i.y=.5-i.y,i.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:i,symbol:lt}),this._imageViewer.addGraphic(this._crossSymbol,0);else if("panoramic"===this.mode){const{imageSize:a}=this._panoramicViewer;if(!a)return;const[i,r]=a,{heading:s,pitch:o}=se(e,i,r),n=oe(s,o);this._crossSymbol=new t({geometry:new T(n,E.WebMercator),symbol:ct}),this._panoramicViewer.addGraphic(this._crossSymbol,0)}},this.handleSectorClick=this.handleSectorClick.bind(this),this.searchBestImage=this.searchBestImage.bind(this),this.transformAndPlotReferencePointOnImage=this.transformAndPlotReferencePointOnImage.bind(this)}initialize(){this.addHandles([M(()=>this.view,()=>{this.load()},_),M(()=>this.view?.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},P),M(()=>this.view?.map?.allLayers?.length,e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)},P),M(()=>[this.state,this.mapImageConversionToolState,this.view],()=>{this._createViewClickHandle(),this._createImageClickHandle()},_),M(()=>[this.triangularMeasurementActive,this.currentBestFeatureMeasurementImage],()=>{this._createTriangularImageClickHandle()},_),M(()=>[this.state,this.imageLocationToolState,this.view],(e,t)=>{if(this._createImageLocationHandle(),!this.imageLocationToolState)return this.clearPreviousGroundLocation(),void this._resetCursor();e[1]!==t?.[1]&&this._setMeasurementCursor()},_),M(()=>this.measureType,()=>{this.clearPreviousMeasurements()},_),M(()=>this.bestFeatureAngle,(e,t)=>{this.previousFeatureAngle=t??0},_),M(()=>this.currentBestFeature,async(e,t)=>{d(this._featureChangedTask),this._featureChangedTask=r(async a=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:a}])),await this._featureChangedTask.promise},{sync:!0}),M(()=>this.currentBestFeatureMeasurementImage,async(e,t)=>{d(this._featureChangedTask),t&&e!==t&&(this.measurementVectors=[],this.triangulatedPoint=null,this.sketchTriangularGraphicsLayer?.graphics.destroyAll()),this._featureChangedTask=r(async a=>{await this.determineWorkflowForTriangularMeasurement(e,t,{signal:a}),v(a),this._reorderTriangularSketchLayer()})},_),M(()=>this.triangularMeasurementActive,async(e,t)=>{t&&!e&&(this.measurementVectors=[],this.currentBestFeatureMeasurementImage=null,this.triangulatedDistanceMeasurement=null,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaAccuracy=0,this.sketchTriangularGraphicsLayer?.graphics.destroyAll(),this.clearReferencePointOnImage(),this.imageMeasurementViewer.clearImage(),this.imageMeasurementViewer.clearGraphics())}),M(()=>this.mode,e=>{switch(this.removeHandles(jt.interactionHandles),e){case"default":this.addHandles(M(()=>{const{state:e}=this;return"image-loaded"===e?this._imageViewer.imagePointsInView:null},e=>{e&&(d(this._updateFootprintTask),this._updateFootprintTask=r(async t=>{await this.updateFootprint(e,{signal:t})}))},{..._,equals:(e,t)=>a(e,t,u)}),jt.interactionHandles);break;case"video":this.addHandles(M(()=>{const{footprintExtent:e}=this;if(e)return Ve},e=>{e&&(d(this._updateFootprintTask),this._updateFootprintTask=r(async t=>{await this.updateFootprint(e,{signal:t})}))},{..._,equals:(e,t)=>a(e,t,u)}),jt.interactionHandles);break;case"panoramic":this.addHandles(M(()=>{const{currentBestFeature:e,state:t,_panoramicViewer:a}=this,{imageSize:i,vfov:r,hfov:s,pitch:o,yaw:n}=a;return e&&i&&!t.includes("loading")&&null!=r&&null!=s&&null!=o&&null!=n?[r,s,n,o]:null},e=>{if(!e||this.state.includes("loading"))return;const[t,a,i,s]=e;this.currentNode&&(this.currentNode.currentHeading=i+(this.currentNode.heading??0),this.currentNode.currentPitch=s+(this.currentNode.pitch??0)),d(this._updateFootprintTask),this._updateFootprintTask=r(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:a,yaw:i,pitch:s},{signal:e})})},{..._,equals:(e,t)=>a(e,t,u)}),jt.interactionHandles)}},_),M(()=>[this.brightness,this.contrast,this.sharpness],()=>{const{_imageViewer:e,brightness:t,contrast:a,mode:i,sharpness:r}=this;"default"===i&&(e.brightness=t,e.contrast=a,e.sharpness=r)},_),M(()=>this.activeViewer?.imageRenderer,()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)}),M(()=>this.activeViewer,e=>{this.removeHandles(jt.hittestHandles),e&&this.addHandles(b(()=>e,"hittest-response",this._handleImageHitTestResponse),jt.hittestHandles)})]),this.when().finally(()=>{this.notifyChange("state")})}destroy(){this.currentBestFeature=null,this._updateFootprintTask=d(this._updateFootprintTask),this._clickTask=d(this._clickTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=p(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),this.videoViewModel=p(this.videoViewModel),this._crossSymbol=p(this._crossSymbol),this._referencePointOnGround=p(this._referencePointOnGround),this._referencePointOnImage=p(this._referencePointOnImage),this._locationPointOnImage=p(this._locationPointOnImage),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy(),this._imageViewer.destroy(),this.imageMeasurementViewer.destroy(),this._panoramicViewer.destroy()}get activeLayer(){return o(h.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){o(h.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get activeViewer(){const{_imageViewer:e,_panoramicViewer:t,mode:a}=this;switch(a){case"default":return e;case"panoramic":return t;default:return null}}get accuracyParametersMissing(){return this.layer?.orientationAccuracy?.every(e=>0===e)??!0}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",m(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",m(e,-10,10))}get currentNode(){const{currentBestFeature:e,navigationNodes:t}=this;return t.find(t=>t.id===e?.attributes.objectId)}get featureCount(){return this.features?.length??0}get imageGalleryEnabled(){const{currentBestFeature:e}=this;if(!e)return!1;const t=e.attributes.imagePath?.trim();return bt(t)||Te(t)}get imageLoaded(){return o(h.getLogger(this),"imageLoaded",{replacement:'Use OrientedImageryViewer.state === "image-loaded"',version:"4.29",warnOnce:!0}),"image-loaded"===this.state}get invalidCameraHeading(){return this.currentBestFeature?.attributes?.cameraHeading===ke}get imagePointsInView(){const{mode:e,_imageViewer:t}=this;return"default"===e?t.imagePointsInView:null}get layerView(){const{layer:e,view:t}=this;if(e&&t)return t.allLayerViews.find(Mt(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?ve(e):null}get mode(){const e=this.currentBestFeature?.attributes;if(!e)return"none";if(e.orientedImageryType?.includes("video"))return"video";const{horizontalFieldOfView:t,isSpherical:a}=e;return 360===t||a?"panoramic":"default"}get popupEnabled(){return!0===this.layer?.popupEnabled}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){const{_sectorData:e}=this;return e?Se.map(t=>e[t]):null}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",m(e,0,1))}get sketchGraphicsLayer(){return this.sketch?.layer}get state(){const{mode:e,disabled:t,_updatingHandles:{updating:a},_featureChangedTask:i}=this;if(t)return"disabled";if(!this.isFulfilled()||a||!1===i?.finished)return"loading";if(this.isRejected())return"error";if("error"===this.displayMessage?.type)return"image-load-error";switch(e){case"default":return this._imageViewer.state;case"panoramic":return this._panoramicViewer.state;case"video":return this.videoElement?.loaded?"video-loaded":"video-not-loaded"}return"ready"}get thumbnails(){const{features:e}=this;return e?new s(e.map(({attributes:{imagePath:e,objectId:t,cameraRoll:a,imageRotation:i}})=>{const r=e?.trim();return bt(r)||Te(r)?{url:r,objectId:t,rotation:(a??0)+(i??0)}:null}).filter(i)):null}set view(e){this._set("view",e)}get _sketchGraphicsLayer(){const{mode:e}=this;switch(e){case"panoramic":return new D({elevationInfo:{mode:"absolute-height"}});case"default":return new D;default:return}}get _overlaysView(){return this.view?.layerViews.find(({layer:e})=>e===this._overlays)}beforeLoad(){this.view?.closePopup(),this.displayMessage=null,this.clearPreviousGroundLocation(),this.triangularMeasurementActive=!1,this.currentBestFeatureMeasurementImage=null,this.measureType=null,this.imageLocationToolState=!1,this.features.removeAll(),this.currentBestFeature=null,this.additionalFeatures.removeAll(),this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),this._overlays?.removeAll()}async computeHeight(e,t,a=!0){const{currentBestFeature:i,activeViewer:r,layer:s,footprintExtent:o}=this,n=r?.imageSize,l=i?.attributes,c=s?.orientationAccuracy;if(!l||!n||!e||e.length<2||!c)return;const u="panoramic"===t?await this.getMeasurementPropertiesPanoramic():ne(l,n[0],n[1]),h=e.at(0),m=e.at(-1);if(!(u&&h&&m&&c&&o))return;const d=[m,h],p=Be(d,!1),g="panoramic"===t?await xe(d,u,c,i,!0,!1):await Ee(d,u,c,!0,a);if(!g)return;const y="panoramic"===t?await He(c,p,u,g,i,!0):await ze(c,p,u,g,!0);return y?{value:g,accuracy:y}:{value:g}}async calculateAreaMeasurement(e,t,a){if(e.length<3||!this.currentBestFeature||!this.activeViewer?.imageSize||"none"===t)return null;const i="default"===t?await this.getMeasurementProperties():await this.getMeasurementPropertiesPanoramic();return v(a),i?"default"===t?await De(e,i,!0):await Ue(e,i,!0,a):null}async calculateDistanceMeasurement(e,t,a){const{currentBestFeature:i,activeViewer:r}=this;if(e.length<2||!i||!r?.imageSize||"none"===t)return null;const s="default"===t?await this.getMeasurementProperties():await this.getMeasurementPropertiesPanoramic();return v(a),s?"default"===t?await Ne([e.at(0),e.at(-1)],s,!0):await We([e.at(0),e.at(-1)],s,!0):null}async calculateAccuracy(e,t,a){const{layer:i,currentBestFeature:r,activeViewer:s}=this,o=i?.orientationAccuracy,n=o?.every(e=>0===e)||!o?.length;if("area"===t&&e.length<3||"distance"===t&&e.length<2||!r||!s?.imageSize||n)return null;let l=null;if(this.triangularMeasurementActive&&this.currentBestFeatureMeasurementImage&&this.imageMeasurementViewer?l=await this.getMeasurementProperties(this.currentBestFeatureMeasurementImage,this.imageMeasurementViewer):(l=await this.getMeasurementProperties(),v(a)),!l)return null;const c="area"===t?await De(e,l,!0):await Ne([e.at(0),e.at(-1)],l,!0);v(a);const{updateElevationProps:u,...h}=l,m=qe(h,o);if(!m?.length)return null;const d=m.map(e=>({...e,updateElevationProps:u})).map(async i=>{const r="area"===t?await De(e,i,!0):await Ne([e.at(0),e.at(-1)],i,!0);if(v(a),r&&c){if("area"===t){const e="number"!=typeof r?r.area:null;return e?Math.abs(e-c.area):null}return Math.abs(r-c)}return null}),p=await Promise.all(d);v(a);const g=p.filter(e=>null!==e);return 0===g.length?null:$e(g)}async calculateLocationAccuracy(e,t,a="default",i){const{layer:r,currentBestFeature:s}=this,o=r?.orientationAccuracy,n=this.view?.spatialReference,l=o?.every(e=>0===e)||!o?.length;if(!s||l)return null;const c="default"===a?await this.getMeasurementProperties():await this.getMeasurementPropertiesPanoramic();if(v(i),!c)return null;const{updateElevationProps:u,...h}=c,m="default"===a?qe(h,o):Je(h,o);if(!m?.length)return null;const d=m.map(e=>({...e,updateElevationProps:u})).map(async r=>{const{updateElevationProps:s,...o}=r;let l="default"===a?await Y(e,o,s):await ee(e,o,s);return v(i),n&&!l.spatialReference.equals(n)&&(l=await x(l,n),v(i)),l&&t?[Math.abs(l.x-t.x),Math.abs(l.y-t.y),l.z&&t.z?Math.abs(l.z-t.z):0]:null}),p=await Promise.all(d);if(v(i),!p?.length)return null;const g=p.map(e=>[e?.[0]??0,e?.[1]??0,e?.[2]??0]),[y,f,w]=Ze(g);return{x:y,y:f,z:w}}async calculateAccuracyPanoramic(e,t,a){const{layer:i,currentBestFeature:r,activeViewer:s,mode:o}=this,n=i?.orientationAccuracy,l=n?.every(e=>0===e)||!n?.length;if("area"===t&&e.length<3||"distance"===t&&e.length<2||!r||!s?.imageSize||l||"panoramic"!==o)return null;const c=await this.getMeasurementPropertiesPanoramic();if(v(a),!c)return null;const u="area"===t?await Ue(e,c,!0):await We([e.at(0),e.at(-1)],c,!0);v(a);const{updateElevationProps:h,...m}=c,d=Je(m,n);if(!d?.length)return null;const p=d.map(e=>({...e,updateElevationProps:h})).map(async i=>{const r="area"===t?await Ue(e,i,!0):await We([e.at(0),e.at(-1)],i,!0);if(v(a),r&&u){if("area"===t){const e="number"!=typeof r?r.area:null;return e?Math.abs(e-u.area):null}return Math.abs(r-u)}return null}),g=await Promise.all(p);v(a);const y=g.filter(e=>null!==e);return 0===y.length?null:$e(y)}async calculateHeightMeasurementInfo(e,t,a){const{currentBestFeature:i,activeViewer:r}=this,s=r?.imageSize;if(!i||!r||!s?.length||"none"===t)return;const{attributes:o}=i,[n]=Be([e],"panoramic"!==t),l="panoramic"===t?await this.getMeasurementPropertiesPanoramic():ne(o,s[0],s[1]);if("panoramic"===t){if(!l)return;const e=await Ke(n,l,i,a);if(!e)return;e?.heading>180&&(e.heading-=360);const t=Qe(n,e),r=A([n.x,n.y],[e.x,e.y]);if(!t||!r)return;return{measurementAngle:t,tempDistance:r}}const c=await Xe(n,l,a);if(!c)return;const u=Ye(n,c),h=A([n.x,n.y],[c.x,c.y]);return u&&h?{measurementAngle:u,tempDistance:h}:void 0}async calculateTriangulatedMeasurements(e){switch(this.measureType){case"distance":{this.triangulatedDistanceMeasurement=await tt(this.measurementVectors);const t=await this.calculateAccuracy(e,"distance");if(t&&this.triangulatedDistanceMeasurement?.distance){const e=Math.atan(t/this.triangulatedDistanceMeasurement.distance);this.triangulatedDistanceAccuracy={distanceAccuracy:t,angleAccuracy:e}}break}case"area":if(this.currentBestFeatureMeasurementImage?.geometry.spatialReference){const t=await et(this.measurementVectors,this.currentBestFeatureMeasurementImage.geometry.spatialReference);this.triangulatedAreaMeasurement=t,this.triangulatedAreaAccuracy=await this.calculateAccuracy(e,"area")??this.triangulatedAreaAccuracy}}}clearPreviousMeasurements(){this.clearMeasurementGraphics(),this.resetMeasurementData(),this.stopMeasurement()}clearPreviousGroundLocation(){this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.pixelCoordinates=null,this.clearLocationPointOnImage()}clearMeasurementGraphics(){this.measurementGraphic&&(this.activeViewer?.removeGraphic(this.measurementGraphic),this.measurementGraphic=null),this.heightGraphic&&(this.activeViewer?.removeGraphic(this.heightGraphic),this.heightGraphic=null),this.triangularMeasurementActive&&this.sketchTriangularGraphicsLayer?.graphics.destroyAll()}digitizeCancel(){return this.sketch?.cancel()}digitizeCanRedo(){return this.sketch?.canRedo()??!1}digitizeCanUndo(){return this.sketch?.canUndo()??!1}digitizeComplete(){return this.sketch?.complete()}async digitizeCreate(e,t){const{sketch:a,dataCaptureLayer:i}=this;if(!a)throw Et();Le(i,e,a),await a.create(e,{...t,defaultZ:0})}async digitizeDelete(){if(!this.sketch)throw Et();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw Et();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw Et();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw Et();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw Et();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw Et();return this.sketch.update(e,t)}async displayHeightResults(){const{currentBestFeature:e,activeViewer:t,heightMeasurementPixels:a,mode:i}=this,r=t?.imageSize,s=e?.attributes;if(!s||!r)return;const o=await this.computeHeight(a,i);o?.value&&o?.accuracy&&(this.heightMeasurementResult=o.value,this.heightMeasurementAccuracy=o.accuracy)}filterByFootprints(e,t,a=!1){const i=[],r=[],s=[];return e.forEach(e=>{const{layer:{coveragePercent:o},attributes:n}=e;let l;const{polygon:c,frustum:u}=$(n);if(l=c.clone(),n.isInspection&&(l=J(n)),o&&(l=Z(l,o)),a||!t||K(l,t)){s.push(e);const{geometry:t,objectId:a,cameraHeight:o,cameraHeading:l}=n,h=t.clone();h.z=o,h.imageID=a,this.pointSources.push(h),l!==ke&&(i.push(c),u&&r.push(u))}}),{features:s,polygons:i,frustums:r}}getMeasurementProperties(e=this.currentBestFeature,t=this.activeViewer){if(!e||!t?.imageSize)return;const{elevationSample:a,attributes:i}=e,{elevationSource:r,cameraHeight:s}=i,o=ne(i,t.imageSize[0],t.imageSize[1]);let n=o.cameraLocation;return(n.spatialReference.isGeographic?x(n,E.WebMercator):Promise.resolve(n)).then(e=>(n=e,le(n.spatialReference,n.z??0,s,{elevationSample:a,elevationSource:r,extent:this.footprintExtent}))).then(t=>("elevationSample"in t&&ce(t.elevationSample)&&(e.elevationSample=t.elevationSample),{...o,cameraLocation:n,updateElevationProps:t}))}getMeasurementPropertiesPanoramic(){const{currentBestFeature:e,activeViewer:t}=this;if(!e||!t?.imageSize)return;const{elevationSample:a,attributes:i}=e,{elevationSource:r,cameraHeight:s}=i,o=ue(i,t.imageSize[0],t.imageSize[1]);let n=o.cameraLocation;return(n.spatialReference.isGeographic?x(n,E.WebMercator):Promise.resolve(n)).then(e=>(n=e,le(n.spatialReference,n.z??0,s,{elevationSample:a,elevationSource:r,extent:this.footprintExtent}))).then(t=>("elevationSample"in t&&ce(t.elevationSample)&&(e.elevationSample=t.elevationSample),{...o,cameraLocation:n,updateElevationProps:t}))}async deleteDataCaptureFeatures(e){const{dataCaptureLayer:t}=this;if(!t)throw new n("orientedimagery","Data capture layer is not available");return t.queryFeatures({objectIds:e}).then(({features:e})=>t.applyEdits({deleteFeatures:e}))}handleSectorClick(e){if(isNaN(e))return;const t=this._sectorData?.[Se[e]],a=t?.at(0);a&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(a):this._updateCurrentBestFeature(a))}handleFeatureClick(e){const{sector:t,featureIndexInSector:a}=e;if(isNaN(a))return;const i=this._sectorData?.[t],r=i?.at(a);r&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(r):this._updateCurrentBestFeature(r))}handleDrawCursorUpdateEvents(e){const{measurementAngle:t,tempDistance:a,heightMeasurementPixels:i,mode:r,activeViewer:s,currentBestFeature:o}=this,n=s?.imageSize;if(!e.vertices||!n||!o)return;const l=at(e.vertices.at(-1),r,n);if(i.length<1||!l||!a||!t||"none"===r)return;const c=it(i[0],l,t);if(!c?.length)return;this.heightMeasurementPixels.push(c),"panoramic"===r?this.createPolylineGraphicPano():this.createPolylineGraphic();const u=rt(o.attributes.location.spatialReference),h=st(this.heightMeasurementPixels,a,u);h&&(this.heightMeasurementResult=h)}async handleDrawVertexAddEvents(e,t){const{currentBestFeature:a,activeViewer:i,heightMeasurementPixels:r,mode:s}=this;if(!a||!i||!e.vertices?.length||"none"===s)return;const o=i?.imageSize;if(!r.length&&o){const a=at(e.vertices.at(-1),s,o);this.heightMeasurementPixels.push(a);const i=await this.calculateHeightMeasurementInfo(a,s,t);if(!i?.measurementAngle||!i?.tempDistance)return;this.measurementAngle=i.measurementAngle,this.tempDistance=i.tempDistance}}async load(e){return this.addResolvingPromise(this._loadViewAdapter(e).catch(e=>{if(!y(e))throw e})),this}async loadBestImage(e,t){return this.selectedPoint=X(e),this.beforeLoad(),this._fetchFeaturesWithController(e,t)}loadImageError(e){h.getLogger(this).error("oriented-imagery-viewer:load-image",e),this.setMessage("imageLoadError","error",e.message)}async loadSketch(e){if(!this.sketch){const t=import("../Sketch/SketchViewModel.js"),{default:a}=await t;v(e),this.sketch=new a({layer:this._sketchGraphicsLayer,view:this.activeViewer?.imageRenderer,updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{edgeOperation:"none",shapeOperation:"none",vertexOperation:void 0},enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"transform"}})}return this.sketch}async loadMeasurementAdapter(e){if(!this.sketchAdapter){const t=import("./adapters/sketch/MeasurementAdapter.js"),{default:a}=await t;if(v(e),this.sketchAdapter=new a({viewModel:this}),!this.sketchAdapter.viewModel.isResolved())return}return this.sketchAdapter}async loadTriangulatedMeasurementAdapter(e){if(!this.triangulatedMeasurementAdapter){const t=import("./adapters/sketch/TriangulatedMeasurementAdapter.js"),{default:a}=await t;if(v(e),this.triangulatedMeasurementAdapter=new a({viewModel:this}),!this.triangulatedMeasurementAdapter.viewModel.isResolved())return}return this.triangulatedMeasurementAdapter}async processFeatureResponse(e,t,a){const{features:i}=e;if(this._clearFeatureGeometries(),!this._checkFeatures(i))return;const{features:r,polygons:s,frustums:o}=this.filterByFootprints(i,t,a?.skipFilter);if(!this._checkFeatures(r))return;this.coveragePolygons.addMany(s),this.coverageFrustums.addMany(o);const n=await this.processElevationSample(s,r,a);v(a),await this._updateElevationOfSelectedPointAndLocations(r,t,n),v(a),_t(r,n);const l=this._processSuitableFeatures(r,t);this.updateSuitabilities(l,a?.loadBestImage)}async startMeasurement(e,t){this.sketch||await this.loadSketch(t),await this.loadMeasurementAdapter(t);const{sketch:a,sketchAdapter:i,activeViewer:r,mode:s}=this;if(!a||!i||!r||"none"===s)return;if(this.displayNewMeasurementButton=!1,"panoramic"===s&&(a.defaultCreateOptions.defaultZ=0),await a.create(e),"panoramic"===s){const{drawOperation:e}=a.view.activeTool;e.constraintsEnabled=!1,e._set("elevationDrawSurface",null)}const o=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;o&&this.sketch&&(this.sketch.polygonSymbol=ut(o),this.sketch.polylineSymbol="panoramic"===s?ht:mt(o,2.5))}startHeightMeasurement(){this.heightMeasurementPixels=[],this.displayNewMeasurementButton=!1,this.draw??=new be({view:this.activeViewer?.imageRenderer});this.draw.create("polyline").on(["cursor-update","vertex-add","draw-complete"],e=>this.handleDrawEvents(e))}createPolylineGraphic(){const e=[this.heightMeasurementPixels[0],this.heightMeasurementPixels.at(-1)],a=this.activeViewer?.imageRenderer.spatialReference;if(this.heightGraphic)this.heightGraphic.geometry=new B({paths:[e],spatialReference:a});else{const i=new B({paths:[e],spatialReference:a}),r=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;this.heightGraphic=new t({geometry:i,symbol:mt(r,2.5)}),this.activeViewer?.addGraphic(this.heightGraphic)}}createPolylineGraphicPano(){const e=this.activeViewer?.imageRenderer.spatialReference,a=this.activeViewer?.imageSize;if(!a)return;const i={x:this.heightMeasurementPixels[0][0],y:this.heightMeasurementPixels[0][1]},r={x:this.heightMeasurementPixels.at(-1)[0],y:this.heightMeasurementPixels.at(-1)[1]},{heading:s,pitch:o}=se(i,a[0],a[1]),{heading:n,pitch:l}=se(r,a[0],a[1]),c=[[...oe(s,o)],[...oe(n,l)]];if(this.heightGraphic)this.heightGraphic.geometry=new B({paths:[c],spatialReference:e});else{const a=new B({paths:[c],spatialReference:e});this.heightGraphic=new t({geometry:a,symbol:ht}),this._panoramicViewer.addGraphic(this.heightGraphic,0)}}async editOverlayedGraphics(e){this.sketchTriangularGraphicsLayer||this._initializeSketchTriangularGraphicsLayer(),this.sketchTriangularGraphicsLayer?.destroyed&&this._handleDestroyedTriangularSketchLayer(),this.sketchTriangularGraphicsLayer.add(e),this.sketchTriangular||(this._initializeSketchTriangular(),await this.loadTriangulatedMeasurementAdapter()),this.updateOverlayedGeometry(e)}updateOverlayedGeometry(e){this.sketchTriangular?.update([e],{tool:"reshape"})}async processMeasurementVectors(e){this.triangularMeasurementActive&&this.currentBestFeature&&(this.measurementVectors?.length<2&&await this.updateMeasurementVectorsArray(e),2===this.measurementVectors.length&&await this.calculateTriangulatedMeasurements(e))}async updateMeasurementVectorsArray(e){const t=this.measurementVectors.length?this.currentBestFeatureMeasurementImage:this.currentBestFeature;if(t){const a=await this.computeMeasurementVector(e,t);a&&this.measurementVectors.push(a)}}async computeMeasurementVector(e,t){const{activeViewer:a,mode:i}=this,r=a?.imageSize;if(!e||!t||!r)return;const s=e.map(e=>[e[0]-.5,-.5-e[1]]),o=this.view?.spatialReference,n=[];for(let l=0;l<s.length;l++){const e={x:s[l][0],y:s[l][1]};let a=await this.getMapPoint(e,{feature:t,imageSize:r,mode:i});o&&!a.spatialReference.equals(o)&&(a=await x(a,o)),n.push(a)}return ot(n,t)}async handleDrawEvents(e,t){if(this.draw)switch(e.type){case"cursor-update":this.handleDrawCursorUpdateEvents(e);break;case"vertex-add":this.handleDrawVertexAddEvents(e,t);break;case"draw-complete":await this.displayHeightResults()}}initializeMeasurement(e){switch(this.clearMeasurementGraphics(),this.resetMeasurementData(),e){case"distance":this.startMeasurement("polyline");break;case"area":this.startMeasurement("polygon");break;case"height":this.startHeightMeasurement()}}async overlayCameraLocations(e){const{activeViewer:a,currentBestFeature:i,overlayedCameraLocations:r,layer:s,mode:o,state:n,layerFloorFilterClause:l}=this,c=a?.imageSize;if(!c||!i||!s||"none"===o||n.includes("loading"))return;const{polygon:u}=$(i.attributes);if(a.removeManyGraphics(r.toArray()),r.removeAll(),e){const{features:e}=await s.queryFeatures({where:I(`${s.objectIdField} <> ${i.attributes.objectId}`,I(s.definitionExpression,l)),geometry:u,returnGeometry:!0,outFields:[s.objectIdField]}),n=await Promise.all(e.map(async e=>{const{attributes:a,geometry:r}=e,s=await this.getPixels(r,{feature:i,imageSize:c,mode:o}),n=dt.clone();return n.outline=new we({color:[0,0,0],width:1}),new t({attributes:a,symbol:n,geometry:s})}));r.addMany(n),a.addManyGraphics(r.toArray())}}overlayGraphicsOnImage(e,t){this.removeOverlayedGraphicsOnImage(e),this.overlayedMapFeatures.set(e,t),this.activeViewer?.addManyGraphics(t.toArray())}async overlayMapFeatures(e,a=!1){const{activeViewer:r,currentBestFeature:o,mode:n,state:l,layer:c}=this,u=r?.imageSize;if(!u||!o||"none"===n||"video"===n||l.includes("loading")||!c)return;const{polygon:m}=$(o.attributes);try{const{imageGeometryField:t,oiObjectIdField:a}=Ge(e,c.imageGeometryField,c.imageReferenceField);this.imageGeometryField=t.name,this.oiObjectIdField=a.name}catch(g){h.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features",g)}const{features:d}=await e.queryFeatures({geometry:m,returnGeometry:!0,outFields:["*"]}),p=new s((await Promise.all(d.map(async i=>{const r=i.symbol?.clone()??e.renderer?.getSymbol(i)?.clone(),{attributes:s,geometry:l}=i,c=l,{imageGeometryField:m,oiObjectIdField:d}=this;if(m&&d&&Re(e,m,d)&&`${s[d]}`==`${o.attributes.objectId}`)try{return Oe(s,m,e,a,u,n,r)}catch(g){h.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features","couldn't create graphic from attributes, geometry will be used",{error:g,feature:i,layer:e,imageGeometryField:this.imageGeometryField,imageReferenceField:this.oiObjectIdField})}switch(c?.type){case"point":{const i=await this.getPixels(c,{feature:o,imageSize:u,mode:n});return new t({attributes:s,layer:e,symbol:r,geometry:i,visible:e.visible&&a})}case"polygon":{const{rings:i,spatialReference:l}=c,h=i.map(e=>e.map(([e,t,a])=>new T({x:e,y:t,z:a,spatialReference:l}))),m=await Promise.all(h.map(async e=>this.getPixels(e,{feature:o,imageSize:u,mode:n}).then(e=>e.map(he))));return new t({attributes:s,layer:e,symbol:r,geometry:new j({rings:m,spatialReference:E.WebMercator}),visible:e.visible&&a})}case"polyline":{const{paths:i,spatialReference:l}=c,h=i.map(e=>e.map(([e,t,a])=>new T({x:e,y:t,z:a,spatialReference:l}))),m=await Promise.all(h.map(async e=>this.getPixels(e,{feature:o,imageSize:u,mode:n}).then(e=>e.map(he))));return new t({attributes:s,layer:e,symbol:r,geometry:new B({paths:m,spatialReference:E.WebMercator}),visible:e.visible&&a})}case"multipoint":{const{points:i,spatialReference:l}=c,h=i.map(([e,t,a])=>new T({x:e,y:t,z:a,spatialReference:l})),m=await this.getPixels(h,{feature:o,imageSize:u,mode:n}).then(e=>e.map(he));return new t({attributes:s,layer:e,symbol:r,geometry:new O({points:m,spatialReference:E.WebMercator}),visible:e.visible&&a})}}return null}))).filter(i));this.overlayGraphicsOnImage(`${e.id}`,p)}async getPixels(e,t){const{imageSize:a,mode:i,feature:r}=t,s=(await this.worldToImage(Array.isArray(e)?e:[e],r)).map(e=>{if("default"===i)return new T({x:e.x-.5,y:.5-e.y,spatialReference:E.WebMercator});const[t,r]=a,{heading:s,pitch:o}=se(e,t,r),n=oe(s,o);return new T(n,E.WebMercator)});return Array.isArray(e)?s:s[0]}async getMapPoint(e,t){const{feature:a,mode:i,imageSize:r}=t,{elevationSample:s,attributes:o}=a,{elevationSource:n,location:l,cameraHeight:c}=o;let u=l.clone();u.spatialReference.isGeographic&&(u=await x(u,E.WebMercator));const h=await le(l.spatialReference,l.z??0,c,{elevationSample:s,elevationSource:n,extent:this.footprintExtent});let m;if("elevationSample"in h&&ce(h.elevationSample)&&(a.elevationSample=h.elevationSample),"default"===i){const t=ne(o,r[0],r[1]);m=await Y(Array.isArray(e)?e:[e],{...t,cameraLocation:u},h)}else{const t=ue(o,r[0],r[1]);m=await ee(Array.isArray(e)?e:[e],{...t,cameraLocation:u},h)}return Array.isArray(e)?m:m[0]}getActiveSectors(){return Se.filter(e=>this._sectorData?.[e]?.length)}async plotMapPoint(e){return this.plotReferencePoint(e),this.transformAndPlotReferencePointOnImage({feature:this.currentBestFeature,selectedLocation:e,options:{signal:this._transformController?.signal}})}plotReferencePointOnGround(e){this._referencePointOnGround&&(this._overlays?.remove(this._referencePointOnGround),this._referencePointOnGround.destroy()),null!=e&&(this._referencePointOnGround=new t({geometry:new T({...e.toJSON()}),symbol:pt}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit("plot-ground-point",{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){if("image-loaded"===this.state)switch(this.clearReferencePointOnImage(),this.mode){case"default":{const a=C(e)?e.toJSON():e;a.x-=.5,a.y=.5-a.y,this._referencePointOnImage=new t({geometry:new T({spatialReference:this._imageViewer.imageRenderer.spatialReference,...a}),symbol:pt}),this._imageViewer.addGraphic(this._referencePointOnImage,0);break}case"panoramic":{const{imageSize:a}=this._panoramicViewer;if(!a)return;const[i,r]=a,{heading:s,pitch:o}=se(e,i,r),n=oe(s,o);this._referencePointOnImage=new t({geometry:new T(n,E.WebMercator),symbol:gt}),this._panoramicViewer.addGraphic(this._referencePointOnImage,0);break}}}plotLocationPointOnImage(e,t=!1){if("image-loaded"===this.state)switch(this.clearLocationPointOnImage(t),this.mode){case"default":this._plotLocationPointOnDefaultImage(e,t);break;case"panoramic":this._plotLocationPointOnPanoramicImage(e)}}removeAllOverlayMapFeatures(){this.overlayedMapFeatures.forEach(e=>{this._imageViewer.removeManyGraphics(e.toArray())}),this.overlayedMapFeatures.clear()}removeOverlayedGraphicsOnImage(e){const t=this.overlayedMapFeatures.get(e);t?.length&&(this.activeViewer?.removeManyGraphics(t.toArray()),this.overlayedMapFeatures.delete(e))}resetImage(){switch(this.setMessage("onLoadMessage","info"),this.mode){case"default":this._imageViewer.clearImage(),this._imageViewer.clearGraphics();break;case"panoramic":this._panoramicViewer.clearGraphics()}this._clickTask=d(this._clickTask)}resetVideo(){this.setMessage("onLoadMessage","info"),this.videoViewModel?.resetVideoHandler(),this._overlays?.removeAll(),this.videoViewModel=null,this.allLayerFeatures=[],this.currentBestFeature=null}resetMeasurementData(){this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.heightMeasurementPixels=[],this.measurementVectors=[],this.heightMeasurementResult=0,this.tempDistance=null,this.measurementAngle=null,this.heightMeasurementAccuracy=0,this.heightGraphic=null,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedMeasurementGraphic=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaAccuracy=0}async saveDrawing(){const{dataCaptureLayer:e,sketchAdapter:t}=this;if(!e||"data-capture"!==t?.type)return;const{pendingGraphics:a,savedGraphics:i}=t,r=a.get(e.id),s=r?.toArray();if(!r||!s?.length)return;const{addFeatureResults:o}=await this.saveDataCaptureFeatures(s),n=o.reduce((t,{objectId:a,globalId:i,error:r},o)=>{const n=s[o],{attributes:l}=n;return r?t.error.push(n):(a&&(l[e.objectIdField]=a),i&&e.globalIdField&&(l[e.globalIdField]=i),t.success.push(n)),t},{success:[],error:[]});i.addMany(n.success),r.removeAll(),r.addMany(n.error)}async saveDataCaptureFeatures(e){const{activeViewer:t,currentBestFeature:a,dataCaptureLayer:r,mode:s}=this,o=t?.imageSize;if(!o||!a||"none"===s||"video"===s)throw new n("orientedimagery","Image size, current best feature and mode are required to save data capture features");if(!r)throw new n("orientedimagery","Data capture layer is not available");const l=await Promise.all(e.map(async e=>{const t=e.clone(),{geometry:i}=t;if(!i)return;const n=i.type,l=r.hasZ,c=r.geometryType,u=n!==c,h=u?await import("./transformers.js"):null,m=h?.default[c],d=u?m?.(i):i;if(d)switch(d.type){case"point":return t.geometry=await this.getMapPoint(me(s,d,o),{feature:a,imageSize:o,mode:s}),l||(delete t.geometry.z,t.geometry.hasZ=!1),t.geometry.hasM=!1,t;case"polygon":{const e=await Promise.all(d.rings.map(async e=>this.getMapPoint(e.map(([e,t,a])=>me(s,{x:e,y:t,z:a},o)),{feature:a,imageSize:o,mode:s})));return t.geometry=new j({spatialReference:e[0][0].spatialReference,hasZ:l,hasM:!1,rings:e.map(e=>e.map(he))}),t}case"polyline":{const e=await Promise.all(d.paths.map(async e=>this.getMapPoint(e.map(([e,t,a])=>me(s,{x:e,y:t,z:a},o)),{feature:a,imageSize:o,mode:s})));return t.geometry=new B({spatialReference:e[0][0].spatialReference,hasZ:l,hasM:!1,paths:e.map(e=>e.map(he))}),t}}})),c=l.filter(i);return r.applyEdits({addFeatures:c}).then(e=>{const{addFeatureResults:t}=e;let a=0;const i=l.map(e=>{const i=t[a++];return e?i:{error:new n("orientedimagery","Error in saving data capture features"),objectId:null,globalId:null}});return{...e,addFeatureResults:i}})}async searchBestImage(e,t){try{const a=await N(e,t);a&&await this.processFeatureResponse(a,e.point,t)}catch(a){y(a)||(this.setMessage("imageLoadError","error",a.message),h.getLogger(this).error("error occurred while finding best image",a))}}selectTriangularMeasurementFeature(e){this.currentBestFeatureMeasurementImage=this.features?.find(({attributes:t})=>t.objectId===Number(e))}setAdditionalCameraLocationsVisibility(e){this.additionalCameraLocations.forEach(t=>{t.visible=e})}setAdditionalCoverageVisibility(e){this.additionalFootprints.forEach(t=>{t.visible=e})}setCurrentCoverageVisibility(e){this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.visible=e),this.currentBestFeatureLocation&&(this.currentBestFeatureLocation.visible=e)}setMapImageConversionToolState(e){this.mapImageConversionToolState=e}setCurrentPanoramaView(e,t){this._panoramicViewer?.set({yaw:e,pitch:t})}async startDataCapture(e,t){const a=this.activeViewer?.imageRenderer,{oiObjectIdField:i,currentBestFeature:r}=this;if(!a||!r||!i)return;const{attributes:{objectId:o}}=r,n=this.overlayedMapFeatures.get(e.id)?.toArray()??[],l=[],c=[];for(const s of n)`${s.getAttribute(i)}`==`${o}`?l.push(s):c.push(s);this.overlayGraphicsOnImage(e.id,new s(c)),this.collectionId=e.id;const u=await this.loadSketch(t),h=await this.loadDataCaptureAdapter(t);v(t),u.layer.addMany(l),u.layer.blendMode="source-atop",h.savedGraphics.addMany(l);a.ui.find("zoom").visible=!1,a.map.layers.add(this.sketchGraphicsLayer)}async stopDataCapture(e=!1){this.sketch?.cancel(),this.sketchGraphicsLayer?.removeAll(),this.sketchAdapter=p(this.sketchAdapter),this.sketch=p(this.sketch),this.collectionId=null;const{dataCaptureLayer:t}=this,a=this.activeViewer?.imageRenderer;if(!a||a.destroyed)return;a.map.layers.remove(this.sketchGraphicsLayer),e&&t&&await this.overlayMapFeatures(t,!0);const i=a.ui.find("zoom");i&&(i.visible=!0)}stopMeasurement(){this.heightMeasurementPixels=[],this.draw?.reset(),this.sketch?.cancel()}toggleAllOverlayMapFeatures(e){this.overlayedMapFeatures.forEach(t=>{this._toggleVisiblity(t,e)})}toggleOverlayMapFeatures(e,t){const a=this.overlayedMapFeatures.get(e);a&&this._toggleVisiblity(a,t)}toggleSelection(e){const{sketch:t}=this;t&&(t.updateOnGraphicClick=e,t.cancel())}async transformAndPlotReferencePointOnImage(e){const{feature:t,selectedLocation:a,options:i}=e;let r=!1,s=!1;const o=this.bestFeatureFootprint?.geometry;switch(o?.type){case"polygon":{const e=a.spatialReference.equals(o.spatialReference)?a:await x(a,o.spatialReference);r=o.contains(e);break}case"mesh":{const e=a.spatialReference.equals(o.spatialReference)?a:await x(a,o.spatialReference);s=o.extent.contains(e);break}}if(!r&&!s)return void this.clearReferencePointOnImage();const n=await this.worldToImage(a,t,i);if(n)return v(i),this.plotReferencePointOnImage(n),{x:n.x,y:n.y};this.clearReferencePointOnImage()}async triangulatedLocationWorkflow(e,t){if(this.currentBestFeature&&e){const{currentBestFeature:a}=this;this.triangulatedPoint&&(this.measurementVectors=[],this.triangulatedPoint=null,this.clearLocationPointOnImage(!0));const i=ot(e,a);if(!i)return;this.measurementVectors.push(i),await this.plotReferenceLocationPoint(e,t),v(t),this._createTriangularImageLocationHandle()}}async _calculateTriangulatedPointFromGroundPoint(e,t){if(this.currentBestFeatureMeasurementImage&&e){const{currentBestFeatureMeasurementImage:a}=this,i=ot(e,a);i&&this.measurementVectors.push(i);const r=await nt(this.measurementVectors);v(t),this.triangulatedPoint=r??this.triangulatedPoint}}async _fetchFeatures(e,t){if(!this.view)return;const a=this.layer;if(a){const i={include:a},r=this.view.toScreen(e);if(!r)return;const s=await this.view.hitTest(r,i);return this._processHitTestResults(a,s,t)}}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(a){if(y(a))return;this.setMessage("imageLoadError","error"),h.getLogger(this).error("error occurred while fetching features",a)}}_groupFeaturesBySectors(){const{_suitabilities:e,additionalFeatures:t,features:a,invalidCameraHeading:i}=this,r=a.at(0);if(!e||!t||!r||!a||i)return void(this._sectorData=null);this._sectorData={};const o={};this._featureToSector=o;for(const u of Se)this._sectorData[u]=new s;const n=e.map((e,t)=>({...e,featureIndex:t}));n.sort((e,t)=>e.trueSuitability-t.trueSuitability);const l=n.map(({distance:e})=>e),c=Math.max(...l);n.forEach(e=>{const{distance:t,angle:i,featureIndex:s}=e,n=t/c*Ce[2],l=It(t,c),u=Pt(i);if(!this._sectorData)return;const h=Ce[3]+n*Math.sin(i*Math.PI/180),m=Ce[3]+n*Math.cos(i*Math.PI/180);let d;const p=a.at(s),g=p===r,{cameraPitch:y}=p.attributes,v=y<5;if(g&&v)d=-90;else{const e=h-Ce[3],t=m-Ce[3],a=t/Math.sqrt(e**2+t**2);let i=180*Math.acos(a)/Math.PI;(e<0&&t<0||e<0&&t>0)&&(i*=-1),d=i}const f=""===l?u:`${l}_${u}`;g&&(d===this.bestFeatureAngle?this.previousFeatureAngle=d:this.bestFeatureAngle=d,this.navigatorCurrentBestFeature=v?null:{x:h,y:m,direction:u}),o[`${p.attributes.objectId}`]=f;const w=this._sectorData[f];w.add({angle:i,featureIndex:s,x:h,y:m,objectID:p.attributes.objectId,sector:f,featureIndexInSector:w.length})})}_handleDestroyedTriangularSketchLayer(){this.sketchTriangularGraphicsLayer&&(this.imageMeasurementViewer.imageRenderer.map.layers.remove(this.sketchTriangularGraphicsLayer),this.sketchTriangularGraphicsLayer=new D,this.imageMeasurementViewer.imageRenderer.map.layers.add(this.sketchTriangularGraphicsLayer),this.sketchTriangular&&(this.sketchTriangular.layer=this.sketchTriangularGraphicsLayer,this.sketchTriangular.view=this.imageMeasurementViewer.imageRenderer))}_initializeSketchTriangular(){this.sketchTriangular=new Tt({view:this.imageMeasurementViewer.imageRenderer,layer:this.sketchTriangularGraphicsLayer,updateOnGraphicClick:!1,defaultUpdateOptions:{toggleToolOnClick:!1}})}_initializeSketchTriangularGraphicsLayer(){this.sketchTriangularGraphicsLayer=new D,this.imageMeasurementViewer.imageRenderer.map.layers.add(this.sketchTriangularGraphicsLayer)}_initializeVideo(){if(this.videoElement||!this.currentBestFeature)return;this.removeHandles(jt.videoPlayerHandles),this.videoElement=new fe({video:this.currentBestFeature.attributes.imagePath,georeference:new ye({extent:new G(Ae)}),autoplay:!1}),this.videoElement.content?.loop&&(this.videoElement.content.loop=!1);const e=new U({source:this.videoElement,title:this.layer?.title,copyright:this.layer?.copyright});this.videoLayer=e,e&&this.videoMapView.map.layers.add(e),this.addHandles(St(this.videoMapView),jt.videoPlayerHandles),this.videoViewModel=new Lt({oiViewModel:this})}_plotLocationPointOnDefaultImage(e,a=!1){const i=C(e)?e.toJSON():e;i.x-=.5,i.y=.5-i.y,a?(this._correctedLocationPointOnImage=new t({geometry:new T({spatialReference:E.WebMercator,...i}),symbol:yt}),this.imageMeasurementViewer.addGraphic(this._correctedLocationPointOnImage,0)):(this._locationPointOnImage=new t({geometry:new T({spatialReference:E.WebMercator,...i}),symbol:yt}),this._imageViewer.addGraphic(this._locationPointOnImage,0))}_plotLocationPointOnPanoramicImage(e){const{imageSize:a}=this._panoramicViewer;if(!a)return;const[i,r]=a,{heading:s,pitch:o}=se(e,i,r),n=oe(s,o);this._locationPointOnImage=new t({geometry:new T(n,E.WebMercator),symbol:vt}),this._panoramicViewer.addGraphic(this._locationPointOnImage,0)}_clearFeatureGeometries(){this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll()}_checkFeatures(e){return!!e?.length||(this.setMessage("noImageError","error"),this.currentBestFeature=null,!1)}async _getElevationSampleFromGround(e,t,a){if(!e[0])return;const i=await R(e);if(this._updateFootprintWithFeatures(t,i),this.view?.supportsGround)try{return await this.view.map.ground.createElevationSampler(this.footprintExtent,a)}catch(r){y(r)||h.getLogger(this).error(r)}}async processElevationSample(e,t,a){const{elevationSource:i}=t[0].attributes,r=await this._getElevationSampleFromGround(e,t,a);return r||(i&&this.footprintExtent&&Q(i)?await ae({extent:this.footprintExtent,lod:i.lod,url:i.url,rasterFunction:i.rasterFunction}):void 0)}_processSuitableFeatures(e,t){return q({features:e,selectedPoint:t,camera:Vt(this.view)?this.view.camera:null,currentImage:this.currentBestFeature})}async _processHitTestResults(e,t,a){const{screenPoint:i,results:[r]}=t,s="graphic"===r?.type&&this.shouldShowSelectedImage,o=r?.mapPoint??this.view?.toMap(i);if(!o)return;const{layerFloorFilterClause:n}=this,l=e.spatialReference.equals(o.spatialReference)?o:await x(o,e.spatialReference),c=l.spatialReference.isGeographic?z(l):l,u=I("1=1",I(e.definitionExpression,n)),h=c.spatialReference.isGeographic?1:V(c.spatialReference),m={layerInstanceOrURL:e,point:c,queryParams:{where:u,maximumDistance:e.maximumDistance?e.maximumDistance/h:void 0,objectIds:s?[r.graphic.getAttribute(e.objectIdField)]:void 0}};await this.searchBestImage(m,a)}async _queryAndLoadByObjectId(e,t,a,i){this.displayMessage=null;const{response:r}=await Ot(e,t,a,i);if(v(i),!r?.features?.length)throw new Rt(t);const s=X($(r.features[0].attributes).polygon.centroid),o=V(s.spatialReference);this.selectedPoint=s;const n={layerInstanceOrURL:e,point:s,queryParams:{where:I(I("1=1",I(e.definitionExpression,a)),`${e.objectIdField} <> ${t}`),maximumDistance:e.maximumDistance?e.maximumDistance/o:void 0}},l=await N(n,i);v(i);const{features:c}=l;return c.push(r.features[0]),await this.processFeatureResponse(l,s,{...i,loadBestImage:!1})}_reorderTriangularSketchLayer(){const e=this.imageMeasurementViewer.imageRenderer.map.layers?.length;this.sketchTriangularGraphicsLayer&&e&&this.imageMeasurementViewer.imageRenderer.map.layers.reorder(this.sketchTriangularGraphicsLayer,e-1)}_resetCursor(){const{activeViewer:e,imageMeasurementViewer:t}=this;e&&(e.imageRenderer.cursor=this._previousCursor),t&&(t.imageRenderer.cursor=this._previousCursor)}async _setImageSource(e,t,a,i,r,s){e.imageSource={datasetFormat:t.toUpperCase(),url:a.split("?")[0]},e.customParameters=Object.fromEntries(i),e.imageRotation=r??0,await e.loadImage(s)}_setMeasurementCursor(){const{activeViewer:e,imageMeasurementViewer:t,triangularMeasurementActive:a}=this;e&&(this._previousCursor=e.imageRenderer.cursor,e.imageRenderer.cursor="crosshair"),t&&a&&(t.imageRenderer.cursor="crosshair")}_toggleVisiblity(e,t){e.forEach(e=>{e.visible=t})}async _updateElevationOfSelectedPointAndLocations(e,t,a,i){const r=ce(a),{location:s,cameraHeight:o}=e[0].attributes,n=await le(s.spatialReference,s.z,o,{elevationSample:r?a:void 0,elevationSource:r?void 0:e[0].attributes.elevationSource,extent:this.footprintExtent},i);v(i);const[l,...c]=await te([t,...e.map(e=>e.attributes.geometry.clone())],n);v(i),t.elevation=l.z,e.forEach((e,t)=>{e.attributes.elevation=c[t].z})}_updateFeatures(e,t=!0){if(!e.length)return this.currentBestFeature=null,void this.additionalFeatures.removeAll();this.features.removeAll(),this.features.addMany(e),this.navigationNodes.removeAll(),this.navigationNodes.addMany(e.map(e=>{const{geometry:t,attributes:a}=e,{isSpherical:i,cameraHeading:r,cameraPitch:s}=a;return new Ct({geometry:t,attributes:a,currentHeading:i?0:r,currentPitch:i?0:s})})),e.length>1?this.additionalFeatures.addMany(e.slice(1)):this.additionalFeatures.removeAll(),this._updateGroundElevation=!0,t&&(this.currentBestFeature=e[0]),"video"===this.mode&&(this._initializeVideo(),this.videoElement?.loaded&&this.videoViewModel?.playVideoFromSelectedLocation(e[0]))}_updateFootprintWithFeatures(e,t){const a=[];for(const{attributes:{geometry:i}}of e)t.contains(i)||a.push([i.x,i.y]);a.sort((e,t)=>+H([e,t])),t.addRing(a),this.footprintExtent=Me(t.extent,2,2)}async _updatePointsAndPolygons(e){const{pointSources:a,currentBestFeature:i,currentCoverageVisible:r,isAdditionalPointSourcesVisible:s,mode:o,layer:n}=this;if(i&&(this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.destroy(),this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null),!this.invalidCameraHeading)){await(this._adapter?.createFootprints(e)),v(e);for(const e of a)e.imageID===i.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:e.imageID},geometry:e.clone(),symbol:ft,visible:r}):this.additionalCameraLocations.push(new t({attributes:{imageID:e.imageID},geometry:e.clone(),symbol:dt,visible:s}));if("video"===o&&n&&!this.allLayerFeatures.length){const e=await W(n,i.geometry.spatialReference);e.features?.length&&(this.allLayerFeatures=e.features)}}}_updateCurrentBestFeature(e){if(!e)return;this.currentBestFeature=this.features?.at(e.featureIndex);const t=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;let a;if(t)a=-90;else{const t=e.x-Ce[3],i=e.y-Ce[3],r=i/Math.sqrt(t**2+i**2);let s=180*Math.acos(r)/Math.PI;(t<0&&i<0||t<0&&i>0)&&(s*=-1),a=s}a===this.bestFeatureAngle?this.previousFeatureAngle=a:this.bestFeatureAngle=a,this.navigatorCurrentBestFeature=t?null:{x:e.x,y:e.y,direction:e.sector.includes("_")?e.sector.split("_")[1]:e.sector}}_updateImageMeasurementBestFeature(e){e&&(this.currentBestFeatureMeasurementImage=this.features?.at(e.featureIndex))}clearGraphics(){this._imageViewer.clearGraphics(),this._panoramicViewer.clearGraphics(),this.imageMeasurementViewer.clearGraphics()}clearReferencePointOnImage(){this._referencePointOnImage&&(this._imageViewer.removeGraphic(this._referencePointOnImage),this._panoramicViewer.removeGraphic(this._referencePointOnImage),this._referencePointOnImage=p(this._referencePointOnImage))}clearLocationPointOnImage(e=!1){this._locationPointOnImage&&!e&&(this._imageViewer.removeGraphic(this._locationPointOnImage),this._panoramicViewer.removeGraphic(this._locationPointOnImage),this._locationPointOnImage=p(this._locationPointOnImage)),this._correctedLocationPointOnImage&&(this.imageMeasurementViewer.removeGraphic(this._correctedLocationPointOnImage),this._correctedLocationPointOnImage=p(this._correctedLocationPointOnImage))}plotReferencePoint(e){"mapPoint"in e?this.plotReferencePointOnGround(e.mapPoint):this.plotReferencePointOnGround(e)}async plotReferenceLocationPoint(e,t){if(this.currentBestFeatureMeasurementImage){const a=await this.worldToImage(e,this.currentBestFeatureMeasurementImage,{signal:t});v(t),a&&this.plotLocationPointOnImage(a,!0)}}setMessage(e,t,a,i){this.displayMessage={key:e,type:t,data:a,map:i}}async transformAndPlotSelectedLocation(e){const{currentBestFeature:t,invalidCameraHeading:a,selectedPoint:i,activeViewer:r}=this;if(this._crossSymbol&&(this._panoramicViewer.removeGraphic(this._crossSymbol),this._imageViewer.removeGraphic(this._crossSymbol),this._crossSymbol=p(this._crossSymbol)),!i||!t||"image-loaded"!==r?.state||a)return;let s;try{s=await this.worldToImage(i,t,e),v(e),await this.plotSelectedPointOnImage(s,e)}catch(o){y(o)||h.getLogger(this).error("failed to transform map point to pixel, cross symbol will not be plotted on image",{error:o,selectedPoint:i,feature:t})}}async worldToImage(e,t,a){const{footprintExtent:i}=this,{imageSize:r}=this.activeViewer;if("none"===this.mode||!t||!r||!i)return;const{attributes:{location:s,elevationSource:o,cameraHeading:n,cameraHeight:l},elevationSample:c}=t;let u=s.clone();const h=await le(s.spatialReference,s.z??0,l,{elevationSample:c,elevationSource:o});t.elevationSample=h.elevationSample;const m=Array.isArray(e)?e:[e];let d,p=await Promise.all(m.map(e=>new Promise(t=>{if(!e.hasZ)return t(te(e,h));t(e)})));if(s.spatialReference.isGeographic&&(u=await x(u,E.WebMercator,a)),p=await Promise.all(p.map(async e=>u.spatialReference.equals(e.spatialReference)?e:await x(e,u.spatialReference,a))),v(a),"panoramic"===this.mode)d=ge(p,{imageHeight:r[1],imageWidth:r[0],cameraHeading:n,cameraLocation:u});else{const e=de(t.attributes,r[0],r[1]);d=pe(p,{...e,cameraLocation:u})}return Array.isArray(e)?d:d[0]}updateCurrentCoveragePolygon(e){const{additionalFootprints:a,additionalCameraLocations:i,currentBestFeature:r,currentBestFeatureLocation:s,currentCoverageVisible:o,selectedPoint:n,view:l,_adapter:c,mode:u}=this,{attributes:{objectId:h},elevationSample:m}=r;if(this._initialCurrentCoverageUpdate){if(this._overlays?.removeAll(),this._initialCurrentCoverageUpdate=!1,this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=o,this.bestFeatureCurrentFootprint=e),l){const e=[...a,...i,s].filter(kt);l.supportsGround&&m&&c?.updateGroundElevation&&(this._updateGroundElevation&&c.updateGroundElevation(e,m),"panoramic"===u&&c.updateGroundElevation([this.bestFeatureCurrentFootprint],m)),this._updateGroundElevation=!1,n&&(e.splice(-2,0,this.bestFeatureCurrentFootprint),e.push(new t({geometry:n.clone(),symbol:lt.clone(),attributes:{imageID:h}}))),this._overlays.graphics.addMany(e)}}else if(l){if(this.invalidCameraHeading)return;this.bestFeatureCurrentFootprint&&(this._overlays?.remove(this.bestFeatureCurrentFootprint),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint));const t=this.bestFeatureCurrentFootprint&&this._overlays?this._overlays.graphics.indexOf(this.bestFeatureCurrentFootprint):-1;e&&(this.bestFeatureCurrentFootprint=e,l?.supportsGround&&m&&c?.updateGroundElevation&&"panoramic"===u&&c.updateGroundElevation([e],m),e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}};e([k()],Ht.prototype,"activeLayer",null),e([k({readOnly:!0})],Ht.prototype,"activeViewer",null),e([k()],Ht.prototype,"accuracyParametersMissing",null),e([k()],Ht.prototype,"additionalFeatures",void 0),e([k({type:s.ofType(t)})],Ht.prototype,"additionalCameraLocations",void 0),e([k({type:s.ofType(t)})],Ht.prototype,"additionalFootprints",void 0),e([k()],Ht.prototype,"areaMeasurementResult",void 0),e([k()],Ht.prototype,"areaMeasurementAccuracy",void 0),e([k()],Ht.prototype,"allLayerFeatures",void 0),e([k()],Ht.prototype,"bestFeatureAngle",void 0),e([k()],Ht.prototype,"bestFeatureCurrentFootprint",void 0),e([k({type:t})],Ht.prototype,"bestFeatureFootprint",void 0),e([k({type:Number})],Ht.prototype,"brightness",null),e([k()],Ht.prototype,"cameraHeadingThreshold",void 0),e([k()],Ht.prototype,"cameraPitchThreshold",void 0),e([k()],Ht.prototype,"clickAction",void 0),e([k()],Ht.prototype,"videoViewModel",void 0),e([k()],Ht.prototype,"collectionId",void 0),e([k({type:Number})],Ht.prototype,"contrast",null),e([k()],Ht.prototype,"conversionProps",void 0),e([k()],Ht.prototype,"coverageFrustums",void 0),e([k()],Ht.prototype,"coveragePolygons",void 0),e([k()],Ht.prototype,"currentBestFeature",void 0),e([k()],Ht.prototype,"currentBestFeatureMeasurementImage",void 0),e([k()],Ht.prototype,"currentBestFeatureLocation",void 0),e([k()],Ht.prototype,"currentCoverageVisible",void 0),e([k()],Ht.prototype,"currentNode",null),e([k()],Ht.prototype,"navigationNodes",void 0),e([k({json:{write:!1}})],Ht.prototype,"determineWorkflowForFeature",void 0),e([k({json:{write:!1}})],Ht.prototype,"determineWorkflowForTriangularMeasurement",void 0),e([k()],Ht.prototype,"disabled",void 0),e([k()],Ht.prototype,"displayMessage",void 0),e([k()],Ht.prototype,"displayNewMeasurementButton",void 0),e([k()],Ht.prototype,"distanceMeasurementResult",void 0),e([k()],Ht.prototype,"distanceAccuracyArray",void 0),e([k()],Ht.prototype,"dataCaptureLayer",void 0),e([k({readOnly:!0})],Ht.prototype,"featureCount",null),e([k()],Ht.prototype,"features",void 0),e([k()],Ht.prototype,"groundCoordinates",void 0),e([k()],Ht.prototype,"groundCoordinatesAccuracy",void 0),e([k()],Ht.prototype,"heightMeasurementPixels",void 0),e([k()],Ht.prototype,"heightGraphic",void 0),e([k()],Ht.prototype,"heightMeasurementResult",void 0),e([k()],Ht.prototype,"heightMeasurementAccuracy",void 0),e([k()],Ht.prototype,"measurementAngle",void 0),e([k()],Ht.prototype,"tempDistance",void 0),e([k({readOnly:!0})],Ht.prototype,"imageGalleryEnabled",null),e([k()],Ht.prototype,"imageGeometryField",void 0),e([k({readOnly:!0})],Ht.prototype,"imageLoaded",null),e([k()],Ht.prototype,"imageLocationToolState",void 0),e([k({readOnly:!0})],Ht.prototype,"invalidCameraHeading",null),e([k()],Ht.prototype,"imagePointsInView",null),e([k()],Ht.prototype,"imageMeasurementViewer",void 0),e([k()],Ht.prototype,"isAdditionalCoverageVisible",void 0),e([k()],Ht.prototype,"isAdditionalPointSourcesVisible",void 0),e([k()],Ht.prototype,"measurementVectors",void 0),e([k()],Ht.prototype,"layer",void 0),e([k()],Ht.prototype,"layerView",null),e([k({readOnly:!0})],Ht.prototype,"layerFloorFilterClause",null),e([k({type:Number})],Ht.prototype,"localPort",void 0),e([k()],Ht.prototype,"mapImageConversionToolState",void 0),e([k()],Ht.prototype,"measureType",void 0),e([k()],Ht.prototype,"measurementGraphic",void 0),e([k({readOnly:!0,value:"none"})],Ht.prototype,"mode",null),e([k()],Ht.prototype,"navigationMode",void 0),e([k()],Ht.prototype,"navigatorCurrentBestFeature",void 0),e([k()],Ht.prototype,"oiObjectIdField",void 0),e([k({type:s.ofType(t)})],Ht.prototype,"overlayedCameraLocations",void 0),e([k()],Ht.prototype,"overlayedMapFeatures",void 0),e([k()],Ht.prototype,"pixelCoordinates",void 0),e([k()],Ht.prototype,"preserveAngle",void 0),e([k()],Ht.prototype,"pointSources",void 0),e([k({readOnly:!0})],Ht.prototype,"popupEnabled",null),e([k()],Ht.prototype,"previousFeatureAngle",void 0),e([k()],Ht.prototype,"referencePoint",null),e([k({readOnly:!0})],Ht.prototype,"sectorData",null),e([k()],Ht.prototype,"selectedPoint",void 0),e([k({type:Number})],Ht.prototype,"sharpness",null),e([k()],Ht.prototype,"shouldShowSelectedImage",void 0),e([k()],Ht.prototype,"sketch",void 0),e([k()],Ht.prototype,"sketchTriangular",void 0),e([k()],Ht.prototype,"sketchTriangularGraphicsLayer",void 0),e([k()],Ht.prototype,"draw",void 0),e([k()],Ht.prototype,"sketchAdapter",void 0),e([k({readOnly:!0})],Ht.prototype,"sketchGraphicsLayer",null),e([k({readOnly:!0})],Ht.prototype,"state",null),e([k({readOnly:!0})],Ht.prototype,"thumbnails",null),e([k()],Ht.prototype,"triangularMeasurementActive",void 0),e([k()],Ht.prototype,"triangulatedDistanceMeasurement",void 0),e([k()],Ht.prototype,"triangulatedDistanceAccuracy",void 0),e([k()],Ht.prototype,"triangulatedAreaMeasurement",void 0),e([k()],Ht.prototype,"triangulatedAreaAccuracy",void 0),e([k()],Ht.prototype,"triangulatedMeasurementGraphic",void 0),e([k()],Ht.prototype,"triangulatedPoint",void 0),e([k()],Ht.prototype,"triangulatedMeasurementAdapter",void 0),e([k()],Ht.prototype,"updateFootprint",void 0),e([k()],Ht.prototype,"updateFootprintPanorama",void 0),e([k()],Ht.prototype,"updatingTriangularMeasurementState",void 0),e([k({value:null})],Ht.prototype,"view",null),e([k()],Ht.prototype,"videoElement",void 0),e([k()],Ht.prototype,"videoLayer",void 0),e([k()],Ht.prototype,"videoMapView",void 0),e([k()],Ht.prototype,"_adapter",void 0),e([k()],Ht.prototype,"_sketchGraphicsLayer",null),e([k()],Ht.prototype,"_highlightedFeatureHandle",void 0),e([k()],Ht.prototype,"_imageViewer",void 0),e([k()],Ht.prototype,"_initialCurrentCoverageUpdate",void 0),e([k()],Ht.prototype,"_locationPointOnImage",void 0),e([k()],Ht.prototype,"_correctedLocationPointOnImage",void 0),e([k()],Ht.prototype,"_overlays",void 0),e([k({readOnly:!0})],Ht.prototype,"_overlaysView",null),e([k()],Ht.prototype,"_panoramicViewer",void 0),e([k()],Ht.prototype,"_previousCursor",void 0),e([k()],Ht.prototype,"_referencePointOnGround",void 0),e([k()],Ht.prototype,"_referencePointOnImage",void 0),e([k()],Ht.prototype,"_sectorData",void 0),e([k()],Ht.prototype,"_featureToSector",void 0),e([k({readOnly:!0})],Ht.prototype,"_updatingHandles",void 0),e([k()],Ht.prototype,"footprintExtent",void 0),e([k()],Ht.prototype,"_featureChangedTask",void 0),Ht=e([S("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],Ht);const zt=Ht;export{zt 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{_ as e}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{copyToClipboard as s,getConvertedArea as a,getConvertedDistance as n,getConvertedHeight as i}from"../imageMeasurementUtils.js";import{substitute as c}from"../../../intl/substitute.js";const u=u=>{
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{copyToClipboard as s,getConvertedArea as a,getConvertedDistance as n,getConvertedHeight as i}from"../imageMeasurementUtils.js";import{substitute as c}from"../../../intl/substitute.js";const u=u=>{const o=u;let m=class extends o{constructor(){super(...arguments),this.messages=null,this.pixelMeasurementUnit="meters",this.pixelAreaMeasurementUnit="square-meters"}copyMeasurementResult(e){let t,r;switch(e){case"area":t={measurement:this.getConvertedAreaString("measurement"),accuracy:this.getConvertedAreaString("accuracy")},r="{measurement} ± {accuracy}";break;case"distance":t={measurement:this.getConvertedDistanceString("measurement"),accuracy:this.getConvertedDistanceString("accuracy")},r="{measurement} ± {accuracy}";break;case"height":t={measurement:this.getConvertedHeightString("measurement"),accuracy:this.getConvertedHeightString("accuracy")},r="{measurement} ± {accuracy}"}const a=c(r,t);s(a)}getConvertedAreaString(e){const{oiViewModel:t,measurementUnitMessages:r,pixelAreaMeasurementUnit:s,messages:n}=this,{areaMeasurementResult:i,areaMeasurementAccuracy:c}=t;return a(e,i,c,r,s)??n.startMeasurement}getConvertedDistanceString(e){const{oiViewModel:t,measurementUnitMessages:r,pixelMeasurementUnit:s,messages:a}=this,{distanceAccuracyArray:i,distanceMeasurementResult:c}=t;return n(e,c,i,r,s)??a.startMeasurement}getAccuracy(e){let t,r;switch(e){case"area":return t={accuracy:this.getConvertedAreaString("accuracy")},r="± {accuracy}",c(r,t);case"distance":return t={accuracy:this.getConvertedDistanceString("accuracy")},r="± {accuracy}",c(r,t);case"height":return t={accuracy:this.getConvertedHeightString("accuracy")},r="± {accuracy}",c(r,t)}}getConvertedHeightString(e){const{oiViewModel:t,measurementUnitMessages:r,pixelMeasurementUnit:s,messages:a}=this,{heightMeasurementAccuracy:n,heightMeasurementResult:c}=t;return i(e,c,n,r,s)??a.startMeasurement}handleLengthMeasurementUnitChange(e){this.pixelMeasurementUnit=e}handleAreaMeasurementUnitChange(e){this.pixelAreaMeasurementUnit=e}};return e([t()],m.prototype,"messages",void 0),e([t()],m.prototype,"measurementUnitMessages",void 0),e([t()],m.prototype,"measurementType",void 0),e([t()],m.prototype,"pixelMeasurementUnit",void 0),e([t()],m.prototype,"pixelAreaMeasurementUnit",void 0),e([t()],m.prototype,"oiViewModel",void 0),m=e([r("esri.widgets.OrientedImageryViewer.mixins.ImageMeasurementMixin")],m),m};export{u as ImageMeasurementMixin};
|
|
@@ -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{_ as e}from"../../../chunks/tslib.es6.js";import{watch as t,syncAndInitial as o}from"../../../core/reactiveUtils.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";const r={sketchHandles:"sketch-handles"},a=a=>{
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import{watch as t,syncAndInitial as o}from"../../../core/reactiveUtils.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";const r={sketchHandles:"sketch-handles"},a=a=>{const n=a;let i=class extends n{initialize(){this.addHandles(t(()=>this.sketch,e=>{this.removeHandles(r.sketchHandles),e&&this.addHandles([e.on("create",e=>this.handleCreate(e)),e.on("update",e=>this.handleUpdate(e)),e.on("undo",e=>this.handleUndo(e)),e.on("redo",e=>this.handleRedo(e)),e.on("delete",e=>this.handleDelete(e)),e.on("destroy",()=>this.handleDestroy()),e.on("duplicate",e=>this.handleDuplicate(e)),t(()=>e.activeComponent,e=>{"draw-2d"!==e?.type&&"draw-3d"!==e?.type||(e.elevationLockOnVertexAddDisabled=!0)},o)],r.sketchHandles)},o))}get sketch(){return this.viewModel?.sketch}handleCreate(e){}handleUpdate(e){}handleUndo(e){}handleRedo(e){}handleDelete(e){}handleDestroy(){}handleDuplicate(e){}};return e([s()],i.prototype,"sketch",null),e([s()],i.prototype,"type",void 0),e([s()],i.prototype,"viewModel",void 0),i=e([d("esri.widgets.OrientedImageryViewer.mixins.SketchHandlerMixin")],i),i};export{a as SketchHandlerMixin};
|
|
@@ -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{_ as e}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import{formatLength as t,formatAngle as r}from"../../../core/quantityFormatUtils.js";import{createLength as a,createAngle as s}from"../../../core/quantityUtils.js";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{copyToClipboard as i,getConvertedArea as c}from"../imageMeasurementUtils.js";import{ImageMeasurementMixin as u}from"./ImageMeasurementMixin.js";import{substitute as o}from"../../../intl/substitute.js";const g=g=>{
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../intl.js";import{formatLength as t,formatAngle as r}from"../../../core/quantityFormatUtils.js";import{createLength as a,createAngle as s}from"../../../core/quantityUtils.js";import"../../../core/Logger.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import"../../../core/Error.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{copyToClipboard as i,getConvertedArea as c}from"../imageMeasurementUtils.js";import{ImageMeasurementMixin as u}from"./ImageMeasurementMixin.js";import{substitute as o}from"../../../intl/substitute.js";const g=g=>{const m=u(g);let l=class extends m{copyActiveMeasurementResults(e,t){t?this.copyTriangularMeasurementResult(e):this.copyGroundMeasurementResult(e)}copyGroundMeasurementResult(e){let t,r;switch(e){case"area":t={measurement:this.getConvertedAreaString("measurement"),accuracy:this.getConvertedAreaString("accuracy")},r="{measurement} ± {accuracy}";break;case"distance":t={measurement:this.getConvertedDistanceString("measurement"),accuracy:this.getConvertedDistanceString("accuracy")},r="{measurement} ± {accuracy}";break;case"height":t={measurement:this.getConvertedHeightString("measurement"),accuracy:this.getConvertedHeightString("accuracy")},r="{measurement} ± {accuracy}"}const a=o(r,t);i(a)}copyTriangularMeasurementResult(e){let t=null;switch(e){case"area":t=this.copyTriangularAreaMeasurements();break;case"distance":t=this.copyTriangularDistanceMeasurements()}t&&i(t)}copyTriangularAreaMeasurements(){const e={measurement:this.getConvertedTriangularAreaString("measurement"),accuracy:this.getConvertedTriangularAreaString("accuracy")};return o("{measurement} ± {accuracy}",e)}copyTriangularDistanceMeasurements(){const{oiViewModel:e}=this,{triangulatedDistanceMeasurement:t,triangulatedDistanceAccuracy:r}=e;if(!t)return;const{distance:a,horizontalDistance:s,verticalDistance:n,slope:i,aspect:c}=t,{distanceAccuracy:u=0,angleAccuracy:g=0}=r??{},m={distance:this.getConvertedTriangularDistanceMeasurementString(a),distanceAccuracy:this.getConvertedTriangularDistanceMeasurementString(u),horizontal:this.getConvertedTriangularDistanceMeasurementString(s),vertical:this.getConvertedTriangularDistanceMeasurementString(n),slope:this.getConvertedTriangularDistanceAngularResultsString(i),angleAccuracy:this.getConvertedTriangularDistanceAngularResultsString(g),aspect:this.getConvertedTriangularDistanceAngularResultsString(c)};return o(" Distance : {distance} ± {distanceAccuracy} , Horizontal : {horizontal} ± {distanceAccuracy}, Vertical : {vertical} ± {distanceAccuracy}, Slope : {slope} ± {angleAccuracy}, Aspect : {aspect} ± {angleAccuracy}",m)}getConvertedTriangularDistanceMeasurementString(e){const{measurementUnitMessages:r,pixelMeasurementUnit:s}=this;return t(r,a(e,"meters"),s,3)||null}getConvertedTriangularDistanceAngularResultsString(e){return r(s(e,"degrees"),"arithmetic",3)||null}getConvertedTriangularAreaString(e){const{oiViewModel:t,measurementUnitMessages:r,pixelAreaMeasurementUnit:a,messages:s}=this,{triangulatedAreaAccuracy:n,triangulatedAreaMeasurement:i}=t;return c(e,i,n,r,a)??s.startMeasurement}};return l=e([n("esri.widgets.OrientedImageryViewer.mixins.TriangulatedImageMeasurementMixin")],l),l};export{g as TriangulatedImageMeasurementMixin};
|
|
@@ -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{_ as r}from"../../../chunks/tslib.es6.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{SketchHandlerMixin as s}from"./SketchHandlerMixin.js";const t=t=>{
|
|
5
|
+
import{_ as r}from"../../../chunks/tslib.es6.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{SketchHandlerMixin as s}from"./SketchHandlerMixin.js";const t=t=>{const i=s(t);let c=class extends i{get sketch(){return this.viewModel?.sketchTriangular}};return r([e()],c.prototype,"sketch",null),c=r([o("esri.widgets.OrientedImageryViewer.mixins.TriangulatedSketchHandlerMixin")],c),c};export{t as TriangulatedSketchHandlerMixin};
|
|
@@ -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{_ as e}from"../../chunks/tslib.es6.js";import i from"../../Camera.js";import t from"../../Ground.js";import a from"../../Map.js";import o from"../../request.js";import r from"../../core/Collection.js";import s from"../../core/Error.js";import n from"../../core/Evented.js";import{JSONMap as h}from"../../core/jsonMap.js";import{rad2deg as m,deg2rad as l}from"../../core/mathUtils.js";import{destroyMaybe as d}from"../../core/maybe.js";import{isAbortError as c,waitTick as p}from"../../core/promiseUtils.js";import{watch as g,syncAndInitial as _,when as u}from"../../core/reactiveUtils.js";import{property as v}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{enumeration as y}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import w from"../../geometry/SpatialReference.js";import M from"../../layers/GraphicsLayer.js";import{convertSphereVertexToPixelLocation as V}from"../../layers/orientedImagery/transformations/utils.js";import z from"../../views/SceneView.js";import{logAndThrow as R,getMissingPropertyErrorName as C,getMissingPropertyErrorMessage as j}from"../OrientedImageryViewer/utils.js";import{defaultImageSphereCenter as P,maxPanoramicViewerHFOV as H,minPanoramicViewerHFOV as O,humanBinocularHFOV as S}from"./constants.js";import b from"./PanoramicZoomConditions.js";import I from"./PanoramicZoomViewModel.js";import{findDiagonalFOV as k,meshToGraphic as x,createImageSphere as G}from"./utils.js";const F={default:"default",navigation:"navigation",fovConstraint:"fov-constraint",clickAction:"image-click-action"};let A=class extends n.EventedAccessor{constructor(e){super(e),this._startPosition=null,this._targetPosition=null,this._graphics=new M({elevationInfo:{mode:"relative-to-ground"}}),this._imageGraphic=null,this._loadController=null,this._map=new a({ground:new t({opacity:0,navigationConstraint:null}),layers:new r([this._graphics])}),this._zoomViewModel=null,this.autoLoad=!1,this.clickAction="none",this.imageSize=null,this.imageSource=null,this.navigationManager=null,this.navigationViewModel=null,this.pitch=90,this.state="ready",this.yaw=0,this._addNavigationHandles=()=>{this.imageRenderer.basemapTerrain.suspended=!0,this.imageRenderer.constraints.tilt.max=180,this.removeHandles(F.navigation),this.addHandles([this.imageRenderer.on("mouse-wheel",this._handleWheel),this.imageRenderer.on("double-click",this._handleDoubleClick),this.imageRenderer.on("drag",this._handleDrag),this.imageRenderer.on("key-down",e=>{const i=["+","-","Shift","_","=","ArrowUp","ArrowDown","ArrowRight","ArrowLeft"],t=e.key;i.includes(t)&&e.stopPropagation()})],F.navigation)},this._addHFOVHandles=()=>{this.removeHandles(F.fovConstraint),this.addHandles(g(()=>[this.maxHFOV,this.minHFOV],()=>{this._zoomViewModel&&(this._zoomViewModel.panoramicZoomConditions=new b({view:this.imageRenderer,maxFOV:this.maxHFOV,minFOV:this.minHFOV}))},_),F.fovConstraint)},this._addZoomHandles=()=>{this._zoomViewModel=new I({view:this.imageRenderer,panoramicZoomConditions:new b({maxFOV:this.maxHFOV,minFOV:this.minHFOV})});const e=this.imageRenderer.ui.find("zoom");e&&(e.viewModel=this._zoomViewModel),this._addHFOVHandles()},this._cancelLoadWithController=()=>{this._loadController?.abort(),this._loadController=null},this._handleDoubleClick=e=>{e.stopPropagation(),e.native.ctrlKey?this._zoomOut():this._zoomIn()},this._handleDrag=e=>{e.stopPropagation();const{action:i,x:t,y:a}=e;switch(i){case"start":this._startPosition=this._targetPosition={x:t,y:a};break;case"update":this._targetPosition={x:t,y:a},this._updateCameraHeadingAndTilt()}},this._handleImageClick=e=>{if("image-loaded"===this.state&&this.imageRenderer.ready)switch(this.clickAction){case"emit":e.stopPropagation(),this.emit("click",e);break;case"hittest":e.stopPropagation(),e.defer(async()=>{const i=await this.imageRenderer.hitTest(e.screenPoint,{include:this._graphics});i.results=i.results.filter(e=>"graphic"===e.type&&e.graphic!==this._imageGraphic),this.emit("hittest-response",i)});break;case"pixel-location":{if(e.stopPropagation(),!this.imageSize||!e.mapPoint)return void this.emit("pixel-location",null);const i=V(e.mapPoint,this.imageSize[0],this.imageSize[1]);this.emit("pixel-location",{...i,spatialReference:w.WebMercator});break}}},this._handleWheel=e=>{const i=e.deltaX??e.native.deltaX;e.stopPropagation(),i>0||e.deltaY>0?this._zoomOut():this._zoomIn()},this._loadNavigationManager=async()=>{if(!this.navigationManager||this.navigationManager?.destroyed){const e=await import("../OrientedImageryViewer/navigation/NavigationManagerPanoramic.js").then(e=>e.default);this.navigationManager=new e({viewModel:this.navigationViewModel})}return this.navigationManager},this._loadWithController=()=>{this._cancelLoadWithController(),this._loadController=new AbortController,this.loadImage(this._loadController)},this._zoomIn=()=>this._zoomViewModel?.zoomIn(),this._zoomOut=()=>this._zoomViewModel?.zoomOut(),this.addGraphic=(e,i)=>"image-loaded"===this.state&&!this._graphics.graphics.includes(e)&&(this._graphics.graphics.add(e,i),!0),this.addManyGraphics=e=>{if("image-loaded"!==this.state)return!1;const i=e.filter(e=>!this._graphics.graphics.includes(e));return this._graphics.graphics.addMany(i),!0},this.clearGraphics=()=>{this._graphics.graphics.removeAll()},this.clearImage=()=>{this.imageSize=null,this._removeImageSphere()},this.navigate=async(e,i)=>{const t=this._loadNavigationManager();this.navigationViewModel?.addUpdatingPromise(t);const a=await t;return await a.navigate(e,i)},this.removeGraphic=e=>!("image-loaded"!==this.state||!this._graphics.graphics.includes(e))&&(this._graphics.remove(e),!0),this.removeManyGraphics=e=>{if("image-loaded"!==this.state)return!1;const i=e.filter(e=>this._graphics.graphics.includes(e));return this._graphics.removeMany(i),!0},this._imageRenderer=new z({map:this._map,viewingMode:"local",camera:{position:P},environment:{atmosphereEnabled:!1,starsEnabled:!1,lighting:{type:"virtual"}},popupEnabled:!1,spatialReference:w.WebMercator,ui:{components:["zoom"]}})}destroy(){this._imageRenderer.destroy()}initialize(){this.state="initialized",this.addHandles([g(()=>this.imageSource,()=>{this.imageSource&&this.autoLoad&&this._loadWithController()},_),g(()=>this.fov,()=>{this._reloadCamera()},_),g(()=>this.yaw,e=>{this.camera.heading=e,this._reloadCamera()},_),g(()=>this.pitch,e=>{this.camera.tilt=e,this._reloadCamera()},_),u(()=>this.imageRenderer.ready,()=>{this._addNavigationHandles(),this._addZoomHandles()},_),g(()=>this.clickAction,e=>{this.removeHandles(F.clickAction),"none"!==e&&this.addHandles(this.imageRenderer.on("click",this._handleImageClick))},_)],F.default)}get camera(){return this.imageRenderer.camera}set camera(e){e&&(this.imageRenderer.camera=e.clone())}get fov(){return this.camera.fov}set fov(e){Number.isFinite(e)&&this._zoomViewModel?.zoomTo(e)}get hfov(){const{fov:e}=this.camera,{size:[i,t]}=this.imageRenderer,a=i/t,o=Math.atan(a);return 2*m(Math.atan(Math.tan(l(e/2))*Math.sin(o)))}get imageRenderer(){return this._imageRenderer}get maxHFOV(){const{size:[e,i]}=this.imageRenderer;return k(H,e/i)}get minHFOV(){const{size:[e,i]}=this.imageRenderer;return k(O,e/i)}get vfov(){const{fov:e}=this.camera,{size:[i,t]}=this.imageRenderer,a=i/t,o=Math.atan(a);return 2*m(Math.atan(Math.tan(l(e/2))*Math.cos(o)))}async _loadImageInternal(e,i){let t;this.state="image-loading";try{t=(await o(e,{responseType:"image",...i})).data}catch(a){throw c(a)?this.state="image-load-aborted":this.state="image-load-error",a}return this._updateImageSphere(t,i)}_reloadCamera(){this.camera=this.camera.clone()}_removeImageSphere(){this._imageGraphic&&(this._graphics.remove(this._imageGraphic),this._imageGraphic=d(this._imageGraphic)),this.state="ready",this.imageSize=null}_updateCameraHeadingAndTilt(){if(!this._startPosition||!this._targetPosition)return;const e=this.camera.heading+(this._startPosition.x-this._targetPosition.x)/this.imageRenderer.width*this.camera.fov;this.yaw=(e+360)%360;const i=this.camera.tilt-(this._startPosition.y-this._targetPosition.y)/this.imageRenderer.height*this.imageRenderer.camera.tilt;this.pitch=Math.min(179.5,Math.max(.5,i)),this._startPosition=this._targetPosition}async _updateImageSphere(e,i){await p(i);const{size:[t,a]}=this.imageRenderer;return this._imageGraphic=x(G(e)),this._graphics.add(this._imageGraphic),this.fov=k(S,t/a),this.state="image-loaded",this.imageSize=[e.width,e.height],this._imageGraphic.geometry}async loadImage(e){return this._removeImageSphere(),this.imageSource?this._loadImageInternal(this.imageSource,e):R(this.declaredClass,new s(C("panoramic-viewer"),j("PanoramicViewerViewModel","imageSource")))}};e([v()],A.prototype,"_graphics",void 0),e([v()],A.prototype,"_imageGraphic",void 0),e([v()],A.prototype,"_imageRenderer",void 0),e([v()],A.prototype,"_loadController",void 0),e([v()],A.prototype,"_map",void 0),e([v()],A.prototype,"_zoomViewModel",void 0),e([v({type:Boolean})],A.prototype,"autoLoad",void 0),e([v({type:i})],A.prototype,"camera",null),e([y(new h({emit:"emit",hittest:"hittest",none:"none","pixel-location":"pixel-location"}))],A.prototype,"clickAction",void 0),e([v({type:Number})],A.prototype,"fov",null),e([v({readOnly:!0})],A.prototype,"hfov",null),e([v({readOnly:!0})],A.prototype,"imageRenderer",null),e([v()],A.prototype,"imageSize",void 0),e([v()],A.prototype,"imageSource",void 0),e([v({readOnly:!0})],A.prototype,"maxHFOV",null),e([v({readOnly:!0})],A.prototype,"minHFOV",null),e([v()],A.prototype,"navigationViewModel",void 0),e([v({type:Number})],A.prototype,"pitch",void 0),e([v()],A.prototype,"state",void 0),e([v({readOnly:!0})],A.prototype,"vfov",null),e([v({type:Number})],A.prototype,"yaw",void 0),A=e([f("esri.widgets.PanoramicViewer.PanoramicViewerViewModel")],A);const L=A;export{L as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import i from"../../Camera.js";import t from"../../Ground.js";import a from"../../Map.js";import o from"../../request.js";import r from"../../core/Collection.js";import s from"../../core/Error.js";import n from"../../core/Evented.js";import{JSONMap as h}from"../../core/jsonMap.js";import{rad2deg as m,deg2rad as l}from"../../core/mathUtils.js";import{destroyMaybe as d}from"../../core/maybe.js";import{isAbortError as c,waitTick as p}from"../../core/promiseUtils.js";import{watch as g,syncAndInitial as u,when as _}from"../../core/reactiveUtils.js";import{property as v}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{enumeration as y}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as f}from"../../core/accessorSupport/decorators/subclass.js";import w from"../../geometry/SpatialReference.js";import M from"../../layers/GraphicsLayer.js";import{convertSphereVertexToPixelLocation as R}from"../../layers/orientedImagery/transformations/utils.js";import V from"../../views/SceneView.js";import{logAndThrow as z,getMissingPropertyErrorName as C,getMissingPropertyErrorMessage as j}from"../OrientedImageryViewer/utils.js";import{defaultImageSphereCenter as P,maxPanoramicViewerHFOV as H,minPanoramicViewerHFOV as O,humanBinocularHFOV as S}from"./constants.js";import b from"./PanoramicZoomConditions.js";import I from"./PanoramicZoomViewModel.js";import{findDiagonalFOV as k,meshToGraphic as x,createImageSphere as G}from"./utils.js";const F={default:"default",navigation:"navigation",fovConstraint:"fov-constraint",clickAction:"image-click-action"};let A=class extends n.EventedAccessor{constructor(e){super(e),this._startPosition=null,this._targetPosition=null,this._graphics=new M({elevationInfo:{mode:"relative-to-ground"}}),this._imageGraphic=null,this._loadController=null,this._map=new a({ground:new t({opacity:0,navigationConstraint:null}),layers:new r([this._graphics])}),this._zoomViewModel=null,this.autoLoad=!1,this.clickAction="none",this.imageSize=null,this.imageSource=null,this.navigationManager=null,this.navigationViewModel=null,this.pitch=90,this.state="ready",this.yaw=0,this._addNavigationHandles=()=>{this.imageRenderer.basemapTerrain.suspended=!0,this.imageRenderer.constraints.tilt.max=180,this.removeHandles(F.navigation),this.addHandles([this.imageRenderer.on("mouse-wheel",this._handleWheel),this.imageRenderer.on("double-click",this._handleDoubleClick),this.imageRenderer.on("drag",this._handleDrag),this.imageRenderer.on("key-down",e=>{const i=["+","-","Shift","_","=","ArrowUp","ArrowDown","ArrowRight","ArrowLeft"],t=e.key;i.includes(t)&&e.stopPropagation()})],F.navigation)},this._addHFOVHandles=()=>{this.removeHandles(F.fovConstraint),this.addHandles(g(()=>[this.maxHFOV,this.minHFOV],()=>{this._zoomViewModel&&(this._zoomViewModel.panoramicZoomConditions=new b({view:this.imageRenderer,maxFOV:this.maxHFOV,minFOV:this.minHFOV}))},u),F.fovConstraint)},this._addZoomHandles=()=>{this._zoomViewModel=new I({view:this.imageRenderer,panoramicZoomConditions:new b({maxFOV:this.maxHFOV,minFOV:this.minHFOV})});const e=this.imageRenderer.ui.find("zoom");e&&(e.viewModel=this._zoomViewModel),this._addHFOVHandles()},this._cancelLoadWithController=()=>{this._loadController?.abort(),this._loadController=null},this._handleDoubleClick=e=>{e.stopPropagation(),e.native.ctrlKey?this._zoomOut():this._zoomIn()},this._handleDrag=e=>{e.stopPropagation();const{action:i,x:t,y:a}=e;switch(i){case"start":this._startPosition=this._targetPosition={x:t,y:a};break;case"update":this._targetPosition={x:t,y:a},this._updateCameraHeadingAndTilt()}},this._handleImageClick=e=>{if("image-loaded"===this.state&&this.imageRenderer.ready)switch(this.clickAction){case"emit":e.stopPropagation(),this.emit("click",e);break;case"hittest":e.stopPropagation(),e.defer(async()=>{const i=await this.imageRenderer.hitTest(e.screenPoint,{include:this._graphics});i.results=i.results.filter(e=>"graphic"===e.type&&e.graphic!==this._imageGraphic),this.emit("hittest-response",i)});break;case"pixel-location":{if(e.stopPropagation(),!this.imageSize||!e.mapPoint)return void this.emit("pixel-location",null);const i=R(e.mapPoint,this.imageSize[0],this.imageSize[1]);this.emit("pixel-location",{...i,spatialReference:w.WebMercator});break}}},this._handleWheel=e=>{const i=e.deltaX??e.native.deltaX;e.stopPropagation(),i>0||e.deltaY>0?this._zoomOut():this._zoomIn()},this._loadNavigationManager=async()=>{if(!this.navigationManager||this.navigationManager?.destroyed){const e=await import("../OrientedImageryViewer/navigation/NavigationManagerPanoramic.js").then(e=>e.default);this.navigationManager=new e({viewModel:this.navigationViewModel})}return this.navigationManager},this._loadWithController=()=>{this._cancelLoadWithController(),this._loadController=new AbortController,this.loadImage(this._loadController)},this._zoomIn=()=>this._zoomViewModel?.zoomIn(),this._zoomOut=()=>this._zoomViewModel?.zoomOut(),this.addGraphic=(e,i)=>"image-loaded"===this.state&&!this._graphics.graphics.includes(e)&&(this._graphics.graphics.add(e,i),!0),this.addManyGraphics=e=>{if("image-loaded"!==this.state)return!1;const i=e.filter(e=>!this._graphics.graphics.includes(e));return this._graphics.graphics.addMany(i),!0},this.clearGraphics=()=>{this._graphics.graphics.removeAll()},this.clearImage=()=>{this.imageSize=null,this._removeImageSphere()},this.navigate=async(e,i)=>{const t=this._loadNavigationManager();this.navigationViewModel?.addUpdatingPromise(t);const a=await t;return await a.navigate(e,i)},this.removeGraphic=e=>!("image-loaded"!==this.state||!this._graphics.graphics.includes(e))&&(this._graphics.remove(e),!0),this.removeManyGraphics=e=>{if("image-loaded"!==this.state)return!1;const i=e.filter(e=>this._graphics.graphics.includes(e));return this._graphics.removeMany(i),!0},this._imageRenderer=new V({map:this._map,viewingMode:"local",camera:{position:P},environment:{atmosphereEnabled:!1,starsEnabled:!1,lighting:{type:"virtual"}},popupEnabled:!1,spatialReference:w.WebMercator,ui:{components:["zoom"]}})}destroy(){this._imageRenderer.destroy()}initialize(){this.state="initialized",this.addHandles([g(()=>this.imageSource,()=>{this.imageSource&&this.autoLoad&&this._loadWithController()},u),g(()=>this.fov,()=>{this._reloadCamera()},u),g(()=>this.yaw,e=>{this.camera&&(this.camera.heading=e,this._reloadCamera())},u),g(()=>this.pitch,e=>{this.camera&&(this.camera.tilt=e,this._reloadCamera())},u),_(()=>this.imageRenderer.ready,()=>{this._addNavigationHandles(),this._addZoomHandles()},u),g(()=>this.clickAction,e=>{this.removeHandles(F.clickAction),"none"!==e&&this.addHandles(this.imageRenderer.on("click",this._handleImageClick))},u)],F.default)}get camera(){return this.imageRenderer.destroying||this.imageRenderer.destroyed?null:this.imageRenderer.camera}set camera(e){!e||this.imageRenderer.destroying||this.imageRenderer.destroyed||(this.imageRenderer.camera=e.clone())}get fov(){return this.camera?.fov}set fov(e){Number.isFinite(e)&&this._zoomViewModel?.zoomTo(e)}get hfov(){if(!this.camera)return null;const{fov:e}=this.camera,{size:[i,t]}=this.imageRenderer,a=i/t,o=Math.atan(a);return 2*m(Math.atan(Math.tan(l(e/2))*Math.sin(o)))}get imageRenderer(){return this._imageRenderer}get maxHFOV(){const{size:[e,i]}=this.imageRenderer;return k(H,e/i)}get minHFOV(){const{size:[e,i]}=this.imageRenderer;return k(O,e/i)}get vfov(){if(!this.camera)return null;const{fov:e}=this.camera,{size:[i,t]}=this.imageRenderer,a=i/t,o=Math.atan(a);return 2*m(Math.atan(Math.tan(l(e/2))*Math.cos(o)))}async _loadImageInternal(e,i){let t;this.state="image-loading";try{t=(await o(e,{responseType:"image",...i})).data}catch(a){throw c(a)?this.state="image-load-aborted":this.state="image-load-error",a}return this._updateImageSphere(t,i)}_reloadCamera(){this.camera=this.camera?.clone()}_removeImageSphere(){this._imageGraphic&&(this._graphics.remove(this._imageGraphic),this._imageGraphic=d(this._imageGraphic)),this.state="ready",this.imageSize=null}_updateCameraHeadingAndTilt(){if(!this._startPosition||!this._targetPosition||!this.camera)return;const e=this.camera.heading+(this._startPosition.x-this._targetPosition.x)/this.imageRenderer.width*this.camera.fov;this.yaw=(e+360)%360;const i=this.camera.tilt-(this._startPosition.y-this._targetPosition.y)/this.imageRenderer.height*this.imageRenderer.camera.tilt;this.pitch=Math.min(179.5,Math.max(.5,i)),this._startPosition=this._targetPosition}async _updateImageSphere(e,i){await p(i);const{size:[t,a]}=this.imageRenderer;return this._imageGraphic=x(G(e)),this._graphics.add(this._imageGraphic),this.fov=k(S,t/a),this.state="image-loaded",this.imageSize=[e.width,e.height],this._imageGraphic.geometry}async loadImage(e){return this._removeImageSphere(),this.imageSource?this._loadImageInternal(this.imageSource,e):z(this.declaredClass,new s(C("panoramic-viewer"),j("PanoramicViewerViewModel","imageSource")))}};e([v()],A.prototype,"_graphics",void 0),e([v()],A.prototype,"_imageGraphic",void 0),e([v()],A.prototype,"_imageRenderer",void 0),e([v()],A.prototype,"_loadController",void 0),e([v()],A.prototype,"_map",void 0),e([v()],A.prototype,"_zoomViewModel",void 0),e([v({type:Boolean})],A.prototype,"autoLoad",void 0),e([v({type:i})],A.prototype,"camera",null),e([y(new h({emit:"emit",hittest:"hittest",none:"none","pixel-location":"pixel-location"}))],A.prototype,"clickAction",void 0),e([v({type:Number})],A.prototype,"fov",null),e([v({readOnly:!0})],A.prototype,"hfov",null),e([v({readOnly:!0})],A.prototype,"imageRenderer",null),e([v()],A.prototype,"imageSize",void 0),e([v()],A.prototype,"imageSource",void 0),e([v({readOnly:!0})],A.prototype,"maxHFOV",null),e([v({readOnly:!0})],A.prototype,"minHFOV",null),e([v()],A.prototype,"navigationViewModel",void 0),e([v({type:Number})],A.prototype,"pitch",void 0),e([v()],A.prototype,"state",void 0),e([v({readOnly:!0})],A.prototype,"vfov",null),e([v({type:Number})],A.prototype,"yaw",void 0),A=e([f("esri.widgets.PanoramicViewer.PanoramicViewerViewModel")],A);const L=A;export{L 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{_ as o}from"../../chunks/tslib.es6.js";import
|
|
5
|
+
import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../core/Clonable.js";import t from"../../core/JSONSupport.js";import{property as e}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";let s=class extends(r.ClonableMixin(t)){constructor(o){super(o),this.maxFOV=0,this.minFOV=0,this.view=null,this.zoomFactor=5}get canZoomIn(){return!!this.view?.ready&&(0===this.minFOV||this.view.camera.fov>this.minFOV)}get canZoomOut(){return!!this.view?.ready&&(0===this.maxFOV||this.view.camera.fov<this.maxFOV)}};o([e({type:Boolean,readOnly:!0})],s.prototype,"canZoomIn",null),o([e({type:Boolean,readOnly:!0})],s.prototype,"canZoomOut",null),o([e({type:Number})],s.prototype,"maxFOV",void 0),o([e({type:Number})],s.prototype,"minFOV",void 0),o([e()],s.prototype,"view",void 0),o([e({type:Number})],s.prototype,"zoomFactor",void 0),s=o([i("esri.widgets.PanoramicViewer.PanoramicZoomConditions")],s);const a=s;export{a 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{_ as e}from"../chunks/tslib.es6.js";import t from"../Camera.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 o}from"../core/accessorSupport/decorators/subclass.js";import r from"./Widget.js";import a from"./OrientedImageryViewer/components/NavigationUI360.js";import{loadSequentialNavigationUIComponents as n,SequentialNavigationUI as s}from"./OrientedImageryViewer/components/SequentialNavigationUI.js";import l from"./PanoramicViewer/PanoramicViewerViewModel.js";import{loadCalciteComponents as p}from"./support/componentsUtils.js";import{globalCss as c}from"./support/globalCss.js";import"./support/widgetUtils.js";import{vmEvent as d}from"./support/decorators/vmEvent.js";import{tsx as u}from"./support/jsxFactory.js";const v="esri-panoramic-viewer";let h=class extends r{constructor(e){super(e),this.navigationEnabled=!1,this.uiStrings=null,this.viewModel=new l,this._afterContainerCreate=e=>{this.imageRenderer.container=e},this.addGraphic=(e,t)=>{this.viewModel.addGraphic(e,t)},this.addManyGraphics=e=>{this.viewModel.addManyGraphics(e)},this.clearGraphics=()=>{this.viewModel.clearGraphics()},this.clearImage=()=>{this.viewModel.clearImage()},this.loadImage=e=>this.viewModel.loadImage(e),this.navigate=async(e,t)=>await this.viewModel.navigate(e,t),this.removeGraphic=e=>{this.viewModel.removeGraphic(e)},this.removeManyGraphics=e=>{this.viewModel.removeManyGraphics(e)}}loadDependencies(){return Promise.all([p({panel:()=>import("@esri/calcite-components/dist/components/calcite-panel")}),n()])}get autoLoad(){return this.viewModel.autoLoad}set autoLoad(e){this.viewModel.autoLoad=e}get camera(){return this.viewModel.camera}set camera(e){e&&(this.viewModel.camera=e)}get clickAction(){return this.viewModel.clickAction}set clickAction(e){this.viewModel.clickAction=e}get currentNode(){return this.navigationViewModel?.currentNode}get fov(){return this.camera
|
|
5
|
+
import{_ as e}from"../chunks/tslib.es6.js";import t from"../Camera.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 o}from"../core/accessorSupport/decorators/subclass.js";import r from"./Widget.js";import a from"./OrientedImageryViewer/components/NavigationUI360.js";import{loadSequentialNavigationUIComponents as n,SequentialNavigationUI as s}from"./OrientedImageryViewer/components/SequentialNavigationUI.js";import l from"./PanoramicViewer/PanoramicViewerViewModel.js";import{loadCalciteComponents as p}from"./support/componentsUtils.js";import{globalCss as c}from"./support/globalCss.js";import"./support/widgetUtils.js";import{vmEvent as d}from"./support/decorators/vmEvent.js";import{tsx as u}from"./support/jsxFactory.js";const v="esri-panoramic-viewer";let h=class extends r{constructor(e){super(e),this.navigationEnabled=!1,this.uiStrings=null,this.viewModel=new l,this._afterContainerCreate=e=>{this.imageRenderer.container=e},this.addGraphic=(e,t)=>{this.viewModel.addGraphic(e,t)},this.addManyGraphics=e=>{this.viewModel.addManyGraphics(e)},this.clearGraphics=()=>{this.viewModel.clearGraphics()},this.clearImage=()=>{this.viewModel.clearImage()},this.loadImage=e=>this.viewModel.loadImage(e),this.navigate=async(e,t)=>await this.viewModel.navigate(e,t),this.removeGraphic=e=>{this.viewModel.removeGraphic(e)},this.removeManyGraphics=e=>{this.viewModel.removeManyGraphics(e)}}loadDependencies(){return Promise.all([p({panel:()=>import("@esri/calcite-components/dist/components/calcite-panel")}),n()])}get autoLoad(){return this.viewModel.autoLoad}set autoLoad(e){this.viewModel.autoLoad=e}get camera(){return this.viewModel.camera}set camera(e){e&&(this.viewModel.camera=e)}get clickAction(){return this.viewModel.clickAction}set clickAction(e){this.viewModel.clickAction=e}get currentNode(){return this.navigationViewModel?.currentNode}get fov(){return this.camera?.fov}set fov(e){this.viewModel.fov=e}get hfov(){return this.viewModel.hfov}get icon(){return"i360-view"}set icon(e){this._overrideIfSome("icon",e)}get imageRenderer(){return this.viewModel.imageRenderer}get imageSize(){return this.viewModel.imageSize}get imageSource(){return this.viewModel.imageSource}set imageSource(e){this.viewModel.imageSource=e}get navigationMode(){return this.navigationViewModel?.navigationMode}get navigationNodes(){return this.navigationViewModel?.navigationNodes}get navigationViewModel(){return this.viewModel.navigationViewModel}set navigationViewModel(e){this.viewModel.navigationViewModel=e}get pitch(){return this.viewModel.pitch}set pitch(e){this.viewModel.pitch=e}get state(){return this.viewModel.state}get ui(){return this.imageRenderer.ui}get vfov(){return this.viewModel.vfov}get yaw(){return this.viewModel.yaw}set yaw(e){this.viewModel.yaw=e}get _navigationUI(){return u(a,{currentNode:this.currentNode,navigate:this.navigate,nodes:this.navigationNodes})}get _sequentialNavigationUI(){return u(s,{layout:"horizontal",uiStrings:this.uiStrings,onAction:e=>{this.navigate(this.currentNode,e)}})}_renderNavigationUI(){switch(this.navigationMode){case"directional":return this._navigationUI;case"sequential":return this._sequentialNavigationUI;default:return null}}render(){return u("calcite-panel",null,u("calcite-panel",{afterCreate:this._afterContainerCreate,bind:this,class:this.classes(c.widget,v)}),this.navigationEnabled?this._renderNavigationUI():null)}static{this.vnodeSelector="calcite-panel"}};e([i({type:Boolean})],h.prototype,"autoLoad",null),e([i({type:t})],h.prototype,"camera",null),e([i()],h.prototype,"clickAction",null),e([i()],h.prototype,"currentNode",null),e([i({type:Number})],h.prototype,"fov",null),e([i({readOnly:!0,type:Number})],h.prototype,"hfov",null),e([i()],h.prototype,"icon",null),e([i({readOnly:!0})],h.prototype,"imageRenderer",null),e([i({readOnly:!0})],h.prototype,"imageSize",null),e([i()],h.prototype,"imageSource",null),e([i({type:Boolean})],h.prototype,"navigationEnabled",void 0),e([i()],h.prototype,"navigationMode",null),e([i()],h.prototype,"navigationNodes",null),e([i()],h.prototype,"navigationViewModel",null),e([i({type:Number})],h.prototype,"pitch",null),e([i({readOnly:!0})],h.prototype,"state",null),e([i()],h.prototype,"ui",null),e([i()],h.prototype,"uiStrings",void 0),e([i({readOnly:!0,type:Number})],h.prototype,"vfov",null),e([d(["click","hittest-response","pixel-location"]),i({type:l})],h.prototype,"viewModel",void 0),e([i({type:Number})],h.prototype,"yaw",null),e([i()],h.prototype,"_navigationUI",null),e([i()],h.prototype,"_sequentialNavigationUI",null),h=e([o("esri.widgets.PanoramicViewer")],h);const g=h;export{g as default};
|