@arcgis/core 6.0.0-next.1 → 6.0.0-next.11
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/analysis/AreaMeasurementAnalysis.d.ts +11 -1
- package/analysis/DimensionSimpleStyle.js +1 -1
- package/analysis/DirectLineMeasurementAnalysis.d.ts +11 -1
- package/analysis/DistanceMeasurementAnalysis.d.ts +8 -0
- package/arcade/featureSetUtils.js +1 -1
- package/arcade/functions/knowledgegraph.js +1 -1
- package/arcade/geometry/unitConversion.js +1 -1
- package/arcgisGlobal.d.ts +5 -5
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/01803f76bc0d9f2cd566.js +1 -0
- package/assets/esri/core/workers/chunks/{f09c9d9a554c33a753b4.js → 02253bdffbd580af22d8.js} +1 -1
- package/assets/esri/core/workers/chunks/{5078b66ba31b770b689f.js → 037a8cc19debbaaa4e10.js} +1 -1
- package/assets/esri/core/workers/chunks/{1ede8666d804c553803e.js → 0b6941781e35ce0f7274.js} +1 -1
- package/assets/esri/core/workers/chunks/0ccab50877b24f862d6e.js +1 -0
- package/assets/esri/core/workers/chunks/{ff3a53c3f00335552317.js → 0dc66b03ff55d0ea5a09.js} +1 -1
- package/assets/esri/core/workers/chunks/0f725cf79ce00e790a7d.js +1 -0
- package/assets/esri/core/workers/chunks/{a0d459bdb91ee892d4b6.js → 116293b1ee788a89ce1e.js} +1 -1
- package/assets/esri/core/workers/chunks/12a7997a40c77f5c9160.js +1 -0
- package/assets/esri/core/workers/chunks/{a7325ebb7edf3273bb34.js → 12b84262dedc6b393136.js} +1 -1
- package/assets/esri/core/workers/chunks/1b077c92345ffb5916c2.js +1 -0
- package/assets/esri/core/workers/chunks/{6dd0b79fa3a629ab4f27.js → 1bca39e0e651426bdbb5.js} +1 -1
- package/assets/esri/core/workers/chunks/1c0c5cb13c2590aae906.js +1 -0
- package/assets/esri/core/workers/chunks/{8959a825f5e1ce6f38ac.js → 1c65ab9ed611c322ce27.js} +1 -1
- package/assets/esri/core/workers/chunks/1e0d2715d603f48a7e0b.js +1 -0
- package/assets/esri/core/workers/chunks/261fea092ee7d27608a0.js +1 -0
- package/assets/esri/core/workers/chunks/2686fe5b62dd0be699c0.js +1 -0
- package/assets/esri/core/workers/chunks/2a97268000c6d03ef720.js +1 -0
- package/assets/esri/core/workers/chunks/{83589144eeeb08f45557.js → 2aeb5cc32284dd3e4d22.js} +1 -1
- package/assets/esri/core/workers/chunks/2d9a1f23ec6ce90723ac.js +1 -0
- package/assets/esri/core/workers/chunks/2e096537a3a5555a4a93.js +1 -0
- package/assets/esri/core/workers/chunks/{7a05b18f655c1167ce0a.js → 2ef5237e4c876d6a4ee0.js} +1 -1
- package/assets/esri/core/workers/chunks/37d6a264a3f1d8072aa0.js +1 -0
- package/assets/esri/core/workers/chunks/3b3e519f15ed52c83f0c.js +1 -0
- package/assets/esri/core/workers/chunks/3c0ed15b544df6fb0903.js +1 -0
- package/assets/esri/core/workers/chunks/{b612de42ee86c0d95247.js → 3d9d7d3a40b51eb7ee3d.js} +1 -1
- package/assets/esri/core/workers/chunks/3df5500a85345577480a.js +1 -0
- package/assets/esri/core/workers/chunks/3f7d583b676b23b3fadb.js +1 -0
- package/assets/esri/core/workers/chunks/3ffda5bf0b91700dc308.js +1 -0
- package/assets/esri/core/workers/chunks/40a584cb952e94326e9e.js +1 -0
- package/assets/esri/core/workers/chunks/{1317ecdfd0cfa683a493.js → 42323093827adffe56d3.js} +1 -1
- package/assets/esri/core/workers/chunks/{1ba0dfbe0958cdbd7c9f.js → 42fd2a7b22b03dacc6a7.js} +1 -1
- package/assets/esri/core/workers/chunks/444e5f214abce3d607cd.js +1 -0
- package/assets/esri/core/workers/chunks/{d201fbf3ceff946d2bd6.js → 44d5508042cacdfcac47.js} +1 -1
- package/assets/esri/core/workers/chunks/4503b20ca6a80fb63d72.js +1 -0
- package/assets/esri/core/workers/chunks/45367aa8e5c5d574de94.js +1 -0
- package/assets/esri/core/workers/chunks/45800373650fbc8262e6.js +1 -0
- package/assets/esri/core/workers/chunks/{6a7ab1ef9a37e87db5ae.js → 46a7da93a63663878583.js} +1 -1
- package/assets/esri/core/workers/chunks/46b4fb6a7fe4877b0efc.js +1120 -0
- package/assets/esri/core/workers/chunks/47d074136a7f8e551a9a.js +1 -0
- package/assets/esri/core/workers/chunks/4911ce62421a6c3320b0.js +1 -0
- package/assets/esri/core/workers/chunks/4a1e23e021bac37a88ab.js +1 -0
- package/assets/esri/core/workers/chunks/4a6b92ecbb1f1c55cc43.js +1 -0
- package/assets/esri/core/workers/chunks/4debf2d9c3465250ef7a.js +1 -0
- package/assets/esri/core/workers/chunks/4e544de61f07ca660236.js +1 -0
- package/assets/esri/core/workers/chunks/4e8e322b469657ac22e2.js +1 -0
- package/assets/esri/core/workers/chunks/505227797bcf2a1d908d.js +1 -0
- package/assets/esri/core/workers/chunks/{67ac6b326bf80fc3d33d.js → 53be85d04cd2da4f391d.js} +1 -1
- package/assets/esri/core/workers/chunks/54778dec1598818d93cb.js +1 -0
- package/assets/esri/core/workers/chunks/54b18559280a7d2a8d93.js +1 -0
- package/assets/esri/core/workers/chunks/557671c897ca5563be6c.js +1 -0
- package/assets/esri/core/workers/chunks/567a65f4203f6e81f4b4.js +1 -0
- package/assets/esri/core/workers/chunks/5c7780f804d789cb37f5.js +1 -0
- package/assets/esri/core/workers/chunks/606ea251075fe81a1206.js +1 -0
- package/assets/esri/core/workers/chunks/{ceb680688fe7e570a774.js → 608be1172a908e92b9f1.js} +1 -1
- package/assets/esri/core/workers/chunks/{e521bb9ee2030245c3ce.js → 612104dff305ff062dfa.js} +2 -2
- package/assets/esri/core/workers/chunks/6299be5e7e26bf3c6859.js +1 -0
- package/assets/esri/core/workers/chunks/{3ac9dcbb0571a2580236.js → 62c8c9ad09e0166207fd.js} +1 -1
- package/assets/esri/core/workers/chunks/6400446b7615b97c3521.js +1 -0
- package/assets/esri/core/workers/chunks/6431480ba0fa8c8d487f.js +1 -0
- package/assets/esri/core/workers/chunks/6588725275c75fae0d9c.js +1 -0
- package/assets/esri/core/workers/chunks/665e31c494d2af505acc.js +1 -0
- package/assets/esri/core/workers/chunks/{9232f57623e1fa3ccabc.js → 67e4b5651fd7ff7d8cf0.js} +1 -1
- package/assets/esri/core/workers/chunks/68be3fb88ca61f82fb90.js +1 -0
- package/assets/esri/core/workers/chunks/6c9266120d46e8c69dbf.js +1 -0
- package/assets/esri/core/workers/chunks/6c9acd9e4e201dc380e9.js +1 -0
- package/assets/esri/core/workers/chunks/6ebe73f69ae822053b70.js +1 -0
- package/assets/esri/core/workers/chunks/709e019885822b1f6f3e.js +1 -0
- package/assets/esri/core/workers/chunks/70cc2d79653d66e85b58.js +1 -0
- package/assets/esri/core/workers/chunks/7449568eb2305bf2d650.js +1 -0
- package/assets/esri/core/workers/chunks/745a153d0cd34faa124e.js +1 -0
- package/assets/esri/core/workers/chunks/7572c2bc5062e66f6330.js +1 -0
- package/assets/esri/core/workers/chunks/76196c414e48834f7b92.js +1 -0
- package/assets/esri/core/workers/chunks/78472a57c2ba146fec65.js +1 -0
- package/assets/esri/core/workers/chunks/7ef182e24cad50815b4e.js +1 -0
- package/assets/esri/core/workers/chunks/7f0f9dddc44b1f1600f0.js +1 -0
- package/assets/esri/core/workers/chunks/814751e705c05099f864.js +1 -0
- package/assets/esri/core/workers/chunks/8293600f94553afc8c38.js +1 -0
- package/assets/esri/core/workers/chunks/8487727f1197cf7dbf50.js +1 -0
- package/assets/esri/core/workers/chunks/88e54449261ef94e390d.js +1 -0
- package/assets/esri/core/workers/chunks/8b0d5551978ab0aac0d1.js +1 -0
- package/assets/esri/core/workers/chunks/8d0c2de92770a1567536.js +1 -0
- package/assets/esri/core/workers/chunks/900181f68449d8f82eeb.js +1 -0
- package/assets/esri/core/workers/chunks/917f53833b853898facc.js +1 -0
- package/assets/esri/core/workers/chunks/939942b00ba380e2957e.js +1 -0
- package/assets/esri/core/workers/chunks/943a0f140813ee4ab04a.js +1 -0
- package/assets/esri/core/workers/chunks/9ce91a909eccc4dfe388.js +1 -0
- package/assets/esri/core/workers/chunks/{c76c42c74eedd43263d3.js → 9dd1fc56eb1ea6eb705e.js} +1 -1
- package/assets/esri/core/workers/chunks/{86a051e9fe71aa356108.js → 9e3e442a9874ed23a043.js} +1 -1
- package/assets/esri/core/workers/chunks/{aa1054834738aef48bda.js → a0356702f2d3f787aeac.js} +1 -1
- package/assets/esri/core/workers/chunks/a40b6d8b5c73e06e14d4.js +1 -0
- package/assets/esri/core/workers/chunks/{1ba1f705b6ce5c8ea702.js → a655ebdb4bf0660615a2.js} +1 -1
- package/assets/esri/core/workers/chunks/a8286febe371dc186aaa.js +1 -0
- package/assets/esri/core/workers/chunks/aaba33611753c6aada68.js +1 -0
- package/assets/esri/core/workers/chunks/aba42885c5d6b2b5fe7f.js +1 -0
- package/assets/esri/core/workers/chunks/ad76f7ab2f3e6d5a5b3c.js +1 -0
- package/assets/esri/core/workers/chunks/ae40eac1eadd1a537bf4.js +1 -0
- package/assets/esri/core/workers/chunks/aeaaff7a4b1a99540f52.js +1 -0
- package/assets/esri/core/workers/chunks/af349c7bc8ef41a0e1bd.js +1 -0
- package/assets/esri/core/workers/chunks/af75747b06d79446a855.js +1 -0
- package/assets/esri/core/workers/chunks/b564ec4e03478f5659db.js +1 -0
- package/assets/esri/core/workers/chunks/b5fdcc80d5973b6e26d1.js +1 -0
- package/assets/esri/core/workers/chunks/bbf993dba74850bbf9d7.js +1 -0
- package/assets/esri/core/workers/chunks/bc0f54a2c15502b630ec.js +1 -0
- package/assets/esri/core/workers/chunks/{9ab25ee06041f907b9a2.js → c2c1f51a4668055c2838.js} +1 -1
- package/assets/esri/core/workers/chunks/c337fc0e6dc69c233e6d.js +1 -0
- package/assets/esri/core/workers/chunks/{a7985d20fa6e8d4878e7.js → d0f5bee9db1ad51ae687.js} +1 -1
- package/assets/esri/core/workers/chunks/d6ad4390df576198e45b.js +1 -0
- package/assets/esri/core/workers/chunks/d90a3bfd45b5ed4092e0.js +1 -0
- package/assets/esri/core/workers/chunks/dba280c370df13196711.js +1 -0
- package/assets/esri/core/workers/chunks/ddf0671976648f621269.js +1 -0
- package/assets/esri/core/workers/chunks/{c18189710d6198516175.js → de5ecb567bd69c613e9d.js} +1 -1
- package/assets/esri/core/workers/chunks/e10b57aefcc89671116e.js +1 -0
- package/assets/esri/core/workers/chunks/{534186fc921a0ccf58dc.js → e1f5d00878f27e1d413e.js} +1 -1
- package/assets/esri/core/workers/chunks/e65dfa19f030ec298437.js +1 -0
- package/assets/esri/core/workers/chunks/e932951598499befabf5.js +1 -0
- package/assets/esri/core/workers/chunks/{e1ba915dae7747932c0f.js → eb04e1717a1002cda3ab.js} +1 -1
- package/assets/esri/core/workers/chunks/f122c18af10e56f9ec2b.js +1 -0
- package/assets/esri/core/workers/chunks/f1df76f098a3cc924832.js +1 -0
- package/assets/esri/core/workers/chunks/f1f90adae13b04898008.js +1 -0
- package/assets/esri/core/workers/chunks/f46d9a19f79d4a4bd354.js +1 -0
- package/assets/esri/core/workers/chunks/f4f9d08b2df856e3b694.js +1 -0
- package/assets/esri/core/workers/chunks/{711cfb84659cb4437679.js → f528ac5c648ca6a98582.js} +1 -1
- package/assets/esri/core/workers/chunks/f92364afaefbac7e8f77.js +1 -0
- package/assets/esri/core/workers/chunks/fb444954be74c1962ced.js +1 -0
- package/assets/esri/core/workers/chunks/fc44227c1756f65b95df.js +1 -0
- package/assets/esri/core/workers/chunks/{72019baeba520edb6bb0.js → fc44d45598a7476bc606.js} +1 -1
- package/assets/esri/core/workers/chunks/fecaf0bc28aeea4d15db.js +1 -0
- package/assets/esri/libs/librust-parquet/pkg/parquet_bg.wasm +0 -0
- package/assets/esri/themes/base/_mixins.scss +2 -2
- package/assets/esri/themes/base/widgets/_Attribution.scss +1 -1
- package/assets/esri/themes/base/widgets/_BasemapLayerList.scss +2 -2
- package/assets/esri/themes/base/widgets/_BatchAttributeForm.scss +5 -5
- package/assets/esri/themes/base/widgets/_Bookmarks.scss +1 -1
- package/assets/esri/themes/base/widgets/_BuildingLevelPicker.scss +2 -2
- package/assets/esri/themes/base/widgets/_BuildingPhasePicker.scss +5 -5
- package/assets/esri/themes/base/widgets/_CatalogLayerList.scss +1 -1
- package/assets/esri/themes/base/widgets/_Compass.scss +0 -2
- package/assets/esri/themes/base/widgets/_DirectionalPad.scss +4 -10
- package/assets/esri/themes/base/widgets/_Directions.scss +40 -40
- package/assets/esri/themes/base/widgets/_Editor.scss +7 -7
- package/assets/esri/themes/base/widgets/_Expand.scss +1 -1
- package/assets/esri/themes/base/widgets/_Feature.scss +1 -1
- package/assets/esri/themes/base/widgets/_FeatureForm.scss +6 -6
- package/assets/esri/themes/base/widgets/_FeatureFormUtilityNetworkAssociationLayers.scss +1 -1
- package/assets/esri/themes/base/widgets/_FeatureFormUtilityNetworkAssociationList.scss +1 -1
- package/assets/esri/themes/base/widgets/_FeatureFormUtilityNetworkAssociationSettings.scss +4 -4
- package/assets/esri/themes/base/widgets/_FeatureTable.scss +27 -27
- package/assets/esri/themes/base/widgets/_FeatureTemplates.scss +1 -1
- package/assets/esri/themes/base/widgets/_Features.scss +6 -6
- package/assets/esri/themes/base/widgets/_FilterBuilder.scss +1 -1
- package/assets/esri/themes/base/widgets/_FilterCondition.scss +1 -1
- package/assets/esri/themes/base/widgets/_Grid.scss +18 -18
- package/assets/esri/themes/base/widgets/_GridControls.scss +11 -11
- package/assets/esri/themes/base/widgets/_LayerList.scss +1 -1
- package/assets/esri/themes/base/widgets/_Legend.scss +5 -5
- package/assets/esri/themes/base/widgets/_NavigationToggle.scss +4 -1
- package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +23 -28
- package/assets/esri/themes/base/widgets/_ResponsiveToolbar.scss +0 -2
- package/assets/esri/themes/base/widgets/_SearchResultRenderer.scss +1 -1
- package/assets/esri/themes/base/widgets/_SelectionList.scss +15 -15
- package/assets/esri/themes/base/widgets/_SelectionToolbar.scss +3 -5
- package/assets/esri/themes/base/widgets/_ShadowCast.scss +11 -11
- package/assets/esri/themes/base/widgets/_Sketch.scss +1 -1
- package/assets/esri/themes/base/widgets/_Slice.scss +3 -3
- package/assets/esri/themes/base/widgets/_SnappingControls.scss +1 -1
- package/assets/esri/themes/base/widgets/_TimeSlider.scss +5 -5
- package/assets/esri/themes/base/widgets/_TimeZoneLabel.scss +5 -4
- package/assets/esri/themes/base/widgets/_Tooltip.scss +14 -17
- package/assets/esri/themes/base/widgets/_UtilityNetworkAssociations.scss +2 -2
- package/assets/esri/themes/base/widgets/_UtilityNetworkTrace.scss +1 -1
- package/assets/esri/themes/base/widgets/_UtilityNetworkValidateTopology.scss +2 -2
- package/assets/esri/themes/base/widgets/_ValuePicker.scss +2 -2
- package/assets/esri/themes/base/widgets/_VideoPlayer.scss +5 -5
- package/assets/esri/themes/base/widgets/_Widget.scss +5 -1
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/BatchAttributeForm/t9n/messages.en.json +1 -1
- package/{basemaps/BasemapCollection.d.ts → basemapGallery/BasemapGalleryModel.d.ts} +8 -8
- package/{basemaps/BasemapCollection.js → basemapGallery/BasemapGalleryModel.js} +1 -1
- package/{basemaps → basemapGallery}/BasemapsSource.d.ts +1 -1
- package/{basemaps → basemapGallery}/BasemapsSource.js +1 -1
- package/{basemaps → basemapGallery}/LocalBasemapsSource.d.ts +2 -2
- package/{basemaps → basemapGallery}/LocalBasemapsSource.js +1 -1
- package/{basemaps → basemapGallery}/PortalBasemapsSource.d.ts +2 -2
- package/{basemaps → basemapGallery}/PortalBasemapsSource.js +1 -1
- package/{basemaps → basemapGallery}/support/BasemapItem.d.ts +2 -2
- package/{basemaps → basemapGallery}/support/BasemapItem.js +1 -1
- package/{basemaps → basemapGallery}/types.d.ts +2 -2
- package/chunks/AtmosphereCompositing.glsl.js +1 -1
- package/chunks/ChapmanAtmosphere.glsl.js +3 -3
- package/chunks/CloudsComposition.glsl.js +1 -1
- package/chunks/Component.glsl.js +41 -41
- package/chunks/DefaultMaterial.glsl.js +2 -2
- package/chunks/EdgeShader.glsl.js +9 -9
- package/chunks/Fog.glsl.js +5 -5
- package/chunks/GaussianSplat.glsl.js +2 -2
- package/chunks/GlobalIllumination.glsl.js +13 -11
- package/chunks/GlobalIlluminationBlur.glsl.js +3 -5
- package/chunks/GlobalIlluminationUpscale.glsl.js +1 -1
- package/chunks/HUDMaterial.glsl.js +13 -13
- package/chunks/Haze.glsl.js +6 -6
- package/chunks/HazeCompositing.glsl.js +1 -1
- package/chunks/LaserlinePath.glsl.js +6 -6
- package/chunks/LineCallout.glsl.js +1 -1
- package/chunks/LineMarker.glsl.js +5 -5
- package/chunks/NavigationDepth.glsl.js +2 -2
- package/chunks/Path.glsl.js +1 -1
- package/chunks/Pattern.glsl.js +26 -26
- package/chunks/Precipitation.glsl.js +7 -7
- package/chunks/RealisticTree.glsl.js +2 -2
- package/chunks/RibbonLine.glsl.js +80 -73
- package/chunks/ShadowCastAccumulate.glsl.js +1 -1
- package/chunks/ShadowHighlight.glsl.js +5 -5
- package/chunks/ShadowHighlightBuffer.glsl.js +1 -1
- package/chunks/SimpleAtmosphere.glsl.js +4 -4
- package/chunks/Terrain.glsl.js +29 -32
- package/chunks/Viewshed.glsl.js +2 -2
- package/chunks/Water.glsl.js +2 -2
- package/config.js +1 -1
- package/core/Loadable.js +1 -1
- package/core/arrayUtils.js +1 -1
- package/core/colorUtils.js +1 -1
- package/core/has.js +1 -1
- package/core/screenUtils.js +1 -1
- package/core/units.js +1 -1
- package/core/workers/workerFactory.js +1 -1
- package/form/elements/inputs/DynamicChoiceInput.d.ts +35 -5
- package/geometry/HeightModelInfo.js +1 -1
- package/geometry/operators/proximityOperator.js +1 -1
- package/geometry/projectionUtils.js +1 -1
- package/geometry/support/meshUtils.d.ts +1 -1
- package/geometry/support/scaleUtils.js +1 -1
- package/geometry/support/wkt.js +2 -0
- package/kernel.js +1 -1
- package/layers/BaseDynamicLayer.d.ts +1 -0
- package/layers/BaseElevationLayer.d.ts +2 -0
- package/layers/BaseTileLayer.d.ts +12 -9
- package/layers/CSVLayer.d.ts +0 -15
- package/layers/FeatureLayer.d.ts +2 -15
- package/layers/GeoJSONLayer.d.ts +0 -52
- package/layers/GeoRSSLayer.d.ts +0 -44
- package/layers/GeospatialPDFLayer.d.ts +2 -5
- package/layers/GeospatialPDFLayer.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/OrientedImageryLayer.js +1 -1
- package/layers/ParquetLayer.d.ts +100 -12
- package/layers/ParquetLayer.js +1 -1
- package/layers/SketchLayer.d.ts +0 -1
- package/layers/VectorTileLayer.d.ts +2 -12
- package/layers/geospatialPDF/renderExtentUtils.js +1 -1
- package/layers/graphics/data/FeatureStore.js +1 -1
- package/layers/graphics/data/QueryEngineResult.js +1 -1
- package/layers/graphics/data/geometryUtils.js +1 -1
- package/layers/graphics/data/projectionSupport.js +1 -1
- package/layers/graphics/sources/FeatureLayerSource.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/graphics/transferFeatures.js +1 -1
- package/layers/knowledgeGraph/layerUtils.js +1 -1
- package/layers/knowledgeGraph/nodeMovementUtils.js +1 -1
- package/layers/mixins/PortalLayer.js +1 -1
- package/layers/mixins/RefreshableLayer.d.ts +1 -3
- package/layers/mixins/ScaleRangeLayer.js +1 -1
- package/layers/mixins/SublayersOwner.js +1 -1
- package/layers/orientedImagery/core/ExposurePoint.js +1 -1
- package/layers/orientedImagery/core/utils.js +1 -1
- package/layers/raster/datasets/GeospatialPDFRaster.js +1 -1
- package/layers/raster/datasets/TIFFRaster.js +1 -1
- package/layers/raster/datasets/byteStreamUtils.js +1 -1
- package/layers/raster/formats/tiffParser.js +1 -1
- package/layers/support/ParquetPortalItemData.d.ts +2 -0
- package/layers/support/ParquetPortalItemData.js +1 -1
- package/layers/support/PortalItemData.d.ts +21 -0
- package/layers/support/PortalItemData.js +1 -1
- package/layers/support/Sublayer.js +1 -1
- package/layers/support/SubtypeSublayer.js +1 -1
- package/layers/support/layersLoader.js +1 -1
- package/layers/support/parquetUtils.d.ts +1 -1
- package/layers/support/types.d.ts +1 -1
- package/package.json +3 -3
- package/popup/FeaturesModel.d.ts +27 -6
- package/popup/FeaturesModel.js +1 -1
- package/portal/support/layersLoader.js +1 -1
- package/portal/support/portalLayers.js +1 -1
- package/renderers/VectorFieldRenderer.d.ts +4 -4
- package/rest/print.d.ts +49 -3
- package/rest/print.js +1 -1
- package/rest/query/operations/pbfFlatFeatureSet.js +1 -1
- package/rest/support/printTaskUtils.js +1 -1
- package/smartMapping/renderers/color.js +1 -1
- package/smartMapping/renderers/dotDensity.js +1 -1
- package/smartMapping/renderers/heatmap.js +1 -1
- package/smartMapping/renderers/pieChart.js +1 -1
- package/smartMapping/renderers/support/spikeUtils.js +3 -3
- package/smartMapping/renderers/type.js +1 -1
- package/smartMapping/statistics/heatmapStatistics.js +1 -1
- package/smartMapping/statistics/histogram.js +1 -1
- package/smartMapping/statistics/summaryStatistics.js +1 -1
- package/smartMapping/statistics/summaryStatisticsForAttributes.js +1 -1
- package/smartMapping/statistics/uniqueValues.js +1 -1
- package/smartMapping/support/adapters/support/layerUtils.js +1 -1
- package/smartMapping/types.d.ts +3 -1
- package/symbols/LineSymbol3DLayer.js +1 -1
- package/symbols/callouts/LineCallout3D.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/cim/CIMSymbolHelper.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/edges/Edges3D.js +1 -1
- package/symbols/support/Symbol3DIconOutline.js +1 -1
- package/symbols/support/Symbol3DOutline.js +1 -1
- package/symbols/support/Symbol3DTextBorder.js +1 -1
- package/symbols/support/defaults3D.js +1 -1
- package/views/2d/analysis/AreaMeasurement/AreaMeasurementTool.js +1 -1
- package/views/2d/analysis/AreaMeasurementAnalysisView2D.d.ts +6 -4
- package/views/2d/analysis/AreaMeasurementAnalysisView2D.js +1 -1
- package/views/2d/analysis/DistanceMeasurement/DistanceMeasurementTool.js +1 -1
- package/views/2d/analysis/DistanceMeasurementAnalysisView2D.d.ts +6 -4
- package/views/2d/analysis/DistanceMeasurementAnalysisView2D.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/TexturedLineShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/shaders/hittestUtils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
- package/views/2d/interactive/snapping/featureSources/featureServiceSource/FeatureServiceTiles2D.js +1 -1
- package/views/2d/layers/FeatureLikeLayerView2D.js +1 -1
- package/views/2d/layers/LayerView2D.js +1 -1
- package/views/2d/layers/features/FeatureContainer.js +1 -1
- package/views/2d/layers/features/FeatureSourceEventLog.js +1 -1
- package/views/2d/layers/features/layerAdapters/ParquetLayerAdapter.js +1 -1
- package/views/2d/layers/features/processor/tracks/TrackAdapter.js +1 -1
- package/views/2d/layers/features/sources/FeatureSource.js +1 -1
- package/views/2d/layers/features/sources/FeatureSourceQueryInfo.js +1 -1
- package/views/2d/layers/features/sources/strategies/AFeatureTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/FeatureDrillDownTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/sources/strategies/ParquetTileLoadStrategy.js +1 -1
- package/views/2d/layers/features/support/FeatureMetadata.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderIndirect.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderJSON.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
- package/views/2d/layers/features/support/FeatureSetReaderPBFHeader.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightEditTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightInteractionVisuals.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightItemManipulatedObject3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightPlacementController.js +1 -1
- package/views/3d/analysis/LineOfSight/lineOfSightPlacementUtils.js +1 -1
- package/views/3d/analysis/ShadowCast/ShadowCastTooltip.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedPlacementPointPlugin.js +1 -1
- package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
- package/views/3d/analysis/Viewshed/types.d.ts +3 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.d.ts +3 -0
- package/views/3d/analysis/VolumeMeasurementAnalysisView3D.d.ts +2 -1
- package/views/3d/environment/Environment.d.ts +2 -2
- package/views/3d/environment/Environment.js +1 -1
- package/views/3d/environment/EnvironmentView.js +2 -0
- package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
- package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
- package/views/3d/interactive/editingTools/originGeometryVisualElementUtils.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
- package/views/3d/layers/BuildingSceneLayerView3D.js +1 -1
- package/views/3d/layers/DynamicLayerView3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerViewBase3D.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/layers/GraphicsLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/layers/MediaLayerView3D.js +1 -1
- package/views/3d/layers/PointCloudLayerView3D.js +1 -1
- package/views/3d/layers/RouteLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/3d/layers/TiledLayerView3D.js +1 -1
- package/views/3d/layers/VoxelLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/ElevationAligners.js +1 -1
- package/views/3d/layers/graphics/Graphics3DBufferGraphicLayer.js +2 -0
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DDrapedBufferGraphicLayer.js +2 -0
- package/views/3d/layers/graphics/Graphics3DDrapedGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DDrapedGraphicLayerBase.js +2 -0
- package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DScaleVisibility.js +1 -1
- package/views/3d/layers/graphics/Graphics3DStageObjectGraphicLayer.js +2 -0
- package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
- package/views/3d/layers/graphics/LabelInfo.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/graphics/elevationAlignmentUtils.js +1 -1
- package/views/3d/layers/graphics/pointUtils.js +1 -1
- package/views/3d/layers/support/FeatureMemory.js +1 -1
- package/views/3d/layers/support/FeatureTile.js +1 -1
- package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
- package/views/3d/layers/support/SampledGeometryMaxDistanceRatio.js +1 -1
- package/views/3d/layers/support/featureTileQuery3D.js +1 -1
- package/views/3d/support/PBFDecoder.js +1 -1
- package/views/3d/support/elevationUpdateUtils.js +1 -1
- package/views/3d/support/popupHitTest.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/Component.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/Laserline.glsl.js +5 -5
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +13 -13
- package/views/3d/webgl-engine/core/shaderLibrary/bindUniforms.js +2 -0
- package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/lastFrameUniforms.js +2 -0
- package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +7 -7
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +31 -29
- package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +26 -12
- package/views/3d/webgl-engine/core/shaderLibrary/shading/MainLighting.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/shading/MarkerSizing.glsl.js +14 -14
- package/views/3d/webgl-engine/core/shaderLibrary/shading/NormalUtils.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadGlobalIllumination.glsl.js +16 -11
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js +5 -5
- package/views/3d/webgl-engine/core/shaderLibrary/shading/WaterColor.glsl.js +8 -8
- package/views/3d/webgl-engine/core/shaderLibrary/shading/evaluateSceneLightingFragment.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/lightingUniforms.js +2 -0
- package/views/3d/webgl-engine/core/shaderLibrary/shading/pbrGlobals.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/readShadow.glsl.js +6 -6
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/cameraUniforms.js +1 -1
- package/views/3d/webgl-engine/effects/WeatherFader.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/ChapmanApproximation.glsl.js +3 -3
- package/views/3d/webgl-engine/effects/atmosphere/ChapmanAtmosphere.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/ChapmanRaymarching.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/atmosphere/SimpleAtmosphere.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/CloudsComposition.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/clouds/CloudsComposition.js +1 -1
- package/views/3d/webgl-engine/effects/fog/Fog.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationColorQuantization.glsl.js +2 -2
- package/views/3d/webgl-engine/effects/glow/applyEmissiveGlow.glsl.js +5 -5
- package/views/3d/webgl-engine/effects/haze/Haze.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/haze/HazeCompositing.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/ShadowHighlightBuffer.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserlinePath.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/raymarching/DistanceFalloff.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastAccumulate.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/BufferGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/BufferObject3D.js +1 -1
- package/views/3d/webgl-engine/lib/EmissionComposite.js +1 -1
- package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/affectsGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/bufferGeometryUtils.js +2 -0
- package/views/3d/webgl-engine/lib/edgeRendering/AdjustProjectedPosition.glsl.js +5 -5
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeShader.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeUtil.glsl.js +11 -11
- package/views/3d/webgl-engine/materials/Path.glsl.js +1 -1
- package/views/3d/webgl-engine/materials/Water.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/AtmosphereCompositing.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplat.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/LineCallout.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Pattern.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/SphereDepthInterpolate.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Viewshed.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/lineUniforms.js +2 -0
- package/views/DOMContainer.d.ts +28 -9
- package/views/DOMContainer.js +1 -1
- package/views/PopupView.d.ts +6 -0
- package/views/SceneView.d.ts +4 -10
- package/views/SceneView.js +1 -1
- package/views/VideoView.d.ts +27 -9
- package/views/View.d.ts +20 -19
- package/views/View.js +1 -1
- package/views/View2D.d.ts +13 -13
- package/views/draw/Draw.d.ts +1 -1
- package/views/draw/support/InteractiveHandle.js +1 -1
- package/views/draw/support/PluginContext.js +1 -1
- package/views/draw/support/managers/TooltipManager.js +1 -1
- package/views/interactive/options/SnappingOptions.d.ts +29 -12
- package/views/interactive/options/TooltipOptions.d.ts +9 -1
- package/views/interactive/options/ValueOptions.d.ts +9 -2
- package/views/interactive/options/ViewOptions.d.ts +82 -6
- package/views/interactive/snapping/FeatureSnappingSourceInfo.js +1 -1
- package/views/interactive/snapping/SnappingManagerPool.js +1 -1
- package/views/interactive/snapping/SnappingOptions.d.ts +1 -1
- package/views/interactive/snapping/SnappingVisualizer.js +1 -1
- package/views/interactive/support/Units.d.ts +1 -0
- package/views/interactive/tooltip/components/DrawHeaderActions.js +1 -1
- package/views/interactive/tooltip/components/ElevationModeSelect.js +1 -1
- package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
- package/views/interactive/tooltip/infos/DynamicTooltipInfo.js +1 -1
- package/views/layers/FeatureLikeLayerView.d.ts +2 -2
- package/views/layers/GraphicsLayerView.d.ts +1 -0
- package/views/layers/ImageryLayerView.d.ts +1 -0
- package/views/layers/LayerView.js +1 -1
- package/views/layers/LineOfSightLayerView.d.ts +3 -4
- package/views/layers/ParquetLayerView.d.ts +15 -0
- package/views/layers/ParquetLayerView.js +1 -1
- package/views/layers/ViewshedLayerView.d.ts +5 -6
- package/views/support/layerViewUtils.js +1 -1
- package/views/support/projectionUtils.js +1 -1
- package/views/types.d.ts +3 -1
- package/webdoc/support/saveUtils.js +1 -1
- package/webdoc/support/unsupportedErrors.js +1 -1
- package/widgets/BasemapGallery/BasemapGalleryViewModel.d.ts +2 -2
- package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
- package/widgets/BasemapGallery/support/BasemapGalleryItem.d.ts +3 -3
- package/widgets/BasemapGallery/support/LocalBasemapsSource.d.ts +2 -2
- package/widgets/BasemapGallery/support/PortalBasemapsSource.d.ts +2 -2
- package/widgets/BasemapGallery/types.d.ts +3 -3
- package/widgets/BasemapLayerList.js +1 -1
- package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
- package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
- package/widgets/BatchAttributeForm/expressions/expressionUtils.js +1 -1
- package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +6 -0
- package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/DynamicChoiceController.js +1 -1
- package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/DirectionalPad.js +1 -1
- package/widgets/Editor/EditorViewModel.d.ts +13 -8
- package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Editor.d.ts +19 -9
- package/widgets/Expand.js +1 -1
- package/widgets/FeatureForm.d.ts +2 -2
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable/FieldColumn.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/Features/FeaturesDrillIn.js +1 -1
- package/widgets/Features.js +1 -1
- package/widgets/Legend.d.ts +1 -0
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/draw/HeightMeasurementAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/TriangulatedMeasurementAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageLocationViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/components/SequentialNavigationUI.js +1 -1
- package/widgets/OrientedImageryViewer/components/SketchTools.js +1 -1
- package/widgets/OrientedImageryViewer/services/ImageMeasurementService.js +1 -1
- package/widgets/OrientedImageryViewer/types.d.ts +20 -0
- package/widgets/OrientedImageryViewer.d.ts +9 -1
- package/widgets/PanoramicVideoViewer.js +1 -1
- package/widgets/Print/PrintViewModel.d.ts +3 -2
- package/widgets/Print/PrintViewModel.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/ScaleRangeSlider.js +1 -1
- package/widgets/Search/SearchResultRenderer.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/widgets/Sketch/SketchViewModel.d.ts +14 -9
- package/widgets/Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js +1 -1
- package/widgets/Sketch.d.ts +10 -10
- package/widgets/Track/TrackViewModel.d.ts +1 -1
- package/widgets/UtilityNetworkAssociations.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeature.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceFeaturesDrillIn.js +1 -1
- package/widgets/UtilityNetworkTrace/types.d.ts +2 -2
- package/widgets/UtilityNetworkTrace.js +1 -1
- package/widgets/UtilityNetworkValidateTopology.js +1 -1
- package/widgets/ValuePicker.js +1 -1
- package/widgets/VideoPlayer/components/PlayerActionsGroup.js +1 -1
- package/widgets/VideoPlayer/components/PlayerControlsGroup.js +1 -1
- package/widgets/support/GridControls.js +1 -1
- package/widgets/support/PluginSettingsControls.js +1 -1
- package/widgets/support/SelectionList/FeatureItem.d.ts +9 -2
- package/widgets/support/SelectionToolbar.js +1 -1
- package/widgets/support/SnappingControls.d.ts +1 -1
- package/widgets/support/SnappingControls.js +1 -1
- package/widgets/support/componentsUtils.js +1 -1
- package/arcade/geometry/wkt.js +0 -2
- package/assets/esri/core/workers/chunks/00a600c71ceebe7bfeee.js +0 -1
- package/assets/esri/core/workers/chunks/00d24415bdeb0adae3df.js +0 -1
- package/assets/esri/core/workers/chunks/0193df3f9fb23633da87.js +0 -1
- package/assets/esri/core/workers/chunks/01b00fbf6a6a22d573ee.js +0 -1
- package/assets/esri/core/workers/chunks/02d4f91652a79d2b637e.js +0 -1
- package/assets/esri/core/workers/chunks/050c4b212f2b5691db34.js +0 -1
- package/assets/esri/core/workers/chunks/05963f57cbe5a5249496.js +0 -1
- package/assets/esri/core/workers/chunks/05d865b2736f452ad2aa.js +0 -1
- package/assets/esri/core/workers/chunks/06e7400f5ebe0719b81c.js +0 -1
- package/assets/esri/core/workers/chunks/07aa6d36f1006b6ab7ff.js +0 -1
- package/assets/esri/core/workers/chunks/084222c00d263a534952.js +0 -1
- package/assets/esri/core/workers/chunks/0b36abcbf03037b4073d.js +0 -1
- package/assets/esri/core/workers/chunks/107b025dc5b09465a78f.js +0 -1
- package/assets/esri/core/workers/chunks/1b551ef3d84d9c1e93f9.js +0 -1
- package/assets/esri/core/workers/chunks/1ef39aef6b33c530cbe4.js +0 -1
- package/assets/esri/core/workers/chunks/1f3148cebee1961249a4.js +0 -1
- package/assets/esri/core/workers/chunks/1f43e06dcfe56229bb0f.js +0 -1
- package/assets/esri/core/workers/chunks/2164fcaced72b0fda31f.js +0 -1
- package/assets/esri/core/workers/chunks/25b0885d3bc190b28c04.js +0 -1
- package/assets/esri/core/workers/chunks/25d6c674b1c4829f040f.js +0 -1
- package/assets/esri/core/workers/chunks/260dcb79dfd0f981949f.js +0 -1
- package/assets/esri/core/workers/chunks/2a570ce6b99dac6ee996.js +0 -1
- package/assets/esri/core/workers/chunks/2e6a2f4d686b71249c0e.js +0 -1
- package/assets/esri/core/workers/chunks/2f9033890c465acff698.js +0 -1
- package/assets/esri/core/workers/chunks/303676d1b10676c9cab4.js +0 -1
- package/assets/esri/core/workers/chunks/303fde8f3459dde16555.js +0 -1
- package/assets/esri/core/workers/chunks/32d08b571bbd996d4e6d.js +0 -1
- package/assets/esri/core/workers/chunks/33956f12505e72e60293.js +0 -1
- package/assets/esri/core/workers/chunks/350540770781b281c39a.js +0 -1
- package/assets/esri/core/workers/chunks/37a636f61cfe89c6bfd1.js +0 -1
- package/assets/esri/core/workers/chunks/380cc538c1ab453870fa.js +0 -1
- package/assets/esri/core/workers/chunks/3880d2c7fb14955d7f93.js +0 -1
- package/assets/esri/core/workers/chunks/3b017b718ea2d4ed498f.js +0 -1
- package/assets/esri/core/workers/chunks/40fb1910f780e78c128c.js +0 -1
- package/assets/esri/core/workers/chunks/4310c8d2b40ae69c3681.js +0 -1
- package/assets/esri/core/workers/chunks/43fc42405167a5537039.js +0 -1
- package/assets/esri/core/workers/chunks/4848f195eb93cc93dd15.js +0 -1
- package/assets/esri/core/workers/chunks/4cddd217383b9333f32e.js +0 -1
- package/assets/esri/core/workers/chunks/4d82db661365daa513a6.js +0 -1
- package/assets/esri/core/workers/chunks/4fa59f8ed3b7b6239548.js +0 -1
- package/assets/esri/core/workers/chunks/57970d43cdcc5cf57a30.js +0 -1
- package/assets/esri/core/workers/chunks/5e184fd47e76eb976fa9.js +0 -1
- package/assets/esri/core/workers/chunks/5ea8809b6519c05ad9f6.js +0 -1
- package/assets/esri/core/workers/chunks/5f3ab77a79c408423fde.js +0 -1
- package/assets/esri/core/workers/chunks/5fd099ca1024707387b2.js +0 -1
- package/assets/esri/core/workers/chunks/604344e45c0f27497188.js +0 -1
- package/assets/esri/core/workers/chunks/61ad8306ab79aca79505.js +0 -1
- package/assets/esri/core/workers/chunks/633a9051580c5302d2f7.js +0 -1
- package/assets/esri/core/workers/chunks/6469c0d18d3663e7da4b.js +0 -1
- package/assets/esri/core/workers/chunks/65654e481cce9ae40e54.js +0 -1
- package/assets/esri/core/workers/chunks/669e39c3437d7273f0c7.js +0 -1
- package/assets/esri/core/workers/chunks/68e24fa3f564c2a5c9fd.js +0 -1
- package/assets/esri/core/workers/chunks/6aebf7cfd294e88bf926.js +0 -1
- package/assets/esri/core/workers/chunks/71f739bb3f7350704af6.js +0 -1
- package/assets/esri/core/workers/chunks/750a9f3cdb96b966274a.js +0 -1
- package/assets/esri/core/workers/chunks/776565dd9741ba2ba151.js +0 -1
- package/assets/esri/core/workers/chunks/798a63653f82c0e842c5.js +0 -1
- package/assets/esri/core/workers/chunks/841f67baf6a1634ada48.js +0 -1
- package/assets/esri/core/workers/chunks/84fcbf7a1d04f01685d1.js +0 -1
- package/assets/esri/core/workers/chunks/897fc8e78a0d54a5ff5a.js +0 -1
- package/assets/esri/core/workers/chunks/8af92bcc075e03e3e902.js +0 -1742
- package/assets/esri/core/workers/chunks/8e511079918e2fd9261f.js +0 -1
- package/assets/esri/core/workers/chunks/8e7a33cc1f83063043f2.js +0 -1
- package/assets/esri/core/workers/chunks/8fcfd515ee1b18c902e5.js +0 -1
- package/assets/esri/core/workers/chunks/9001e9a1e81bce175ddd.js +0 -1
- package/assets/esri/core/workers/chunks/9432feca48ca3e5849bd.js +0 -1
- package/assets/esri/core/workers/chunks/956a40f40bde416efe93.js +0 -1
- package/assets/esri/core/workers/chunks/95b82cbbe355266c65d7.js +0 -1
- package/assets/esri/core/workers/chunks/9673a9efec86040b8c13.js +0 -1
- package/assets/esri/core/workers/chunks/97dbbedea9fe03bd1306.js +0 -1
- package/assets/esri/core/workers/chunks/985b3f18cee87c3fe022.js +0 -1
- package/assets/esri/core/workers/chunks/9a7fc93cc693fd12b5d8.js +0 -1
- package/assets/esri/core/workers/chunks/9c0fd8baa00ee9733ba4.js +0 -1
- package/assets/esri/core/workers/chunks/a010d2e4e34eb7bc1fec.js +0 -1
- package/assets/esri/core/workers/chunks/a20526996d01386ec3b7.js +0 -1
- package/assets/esri/core/workers/chunks/a23272a7a47a95f6ddea.js +0 -1
- package/assets/esri/core/workers/chunks/a7edf7541569fef77cb3.js +0 -1
- package/assets/esri/core/workers/chunks/aa5b42e44d2959fdacd3.js +0 -1
- package/assets/esri/core/workers/chunks/ae2181805d8ba130babc.js +0 -1
- package/assets/esri/core/workers/chunks/b05a41a60e30935644be.js +0 -1
- package/assets/esri/core/workers/chunks/b0cfec11c758eed8095f.js +0 -1
- package/assets/esri/core/workers/chunks/bff767ec5bb4c0d6b324.js +0 -1
- package/assets/esri/core/workers/chunks/c906f984b2b6e7578c06.js +0 -1
- package/assets/esri/core/workers/chunks/ca7fb75e2c62e7d37122.js +0 -1
- package/assets/esri/core/workers/chunks/cbdebdfa5f2cded29d0d.js +0 -1
- package/assets/esri/core/workers/chunks/cbe6c0f32608cb504695.js +0 -1
- package/assets/esri/core/workers/chunks/cfae60b9d2f2939e9c16.js +0 -1
- package/assets/esri/core/workers/chunks/d270cc9807161033686e.js +0 -1
- package/assets/esri/core/workers/chunks/d56780290e0218d3e9de.js +0 -1
- package/assets/esri/core/workers/chunks/d6d5a9e73ee43d6066d3.js +0 -1
- package/assets/esri/core/workers/chunks/d89fe41c71c9621c41ae.js +0 -1
- package/assets/esri/core/workers/chunks/da18d96b35af20e73b3b.js +0 -1
- package/assets/esri/core/workers/chunks/de02a6a1f4810f99e9bb.js +0 -1
- package/assets/esri/core/workers/chunks/df0481bcc1613ee4b7af.js +0 -1
- package/assets/esri/core/workers/chunks/e22d45aeef293a5ffb78.js +0 -1
- package/assets/esri/core/workers/chunks/e5943f3a4bbc12c06c4d.js +0 -1
- package/assets/esri/core/workers/chunks/e7c60bd85abbd36cdc64.js +0 -1
- package/assets/esri/core/workers/chunks/ec9a2425b4a498054a19.js +0 -1
- package/assets/esri/core/workers/chunks/edf3be87a997f4f05b96.js +0 -1
- package/assets/esri/core/workers/chunks/f05de08e194a3f9b96f2.js +0 -1
- package/assets/esri/core/workers/chunks/f0a68d2900d24f56afa0.js +0 -1
- package/assets/esri/core/workers/chunks/f0aaa646b17ffdbdcefa.js +0 -1
- package/assets/esri/core/workers/chunks/f0c0c02730fe0d948fc1.js +0 -1
- package/assets/esri/core/workers/chunks/fd0254c6fc6c03ec11ba.js +0 -1
- package/assets/esri/core/workers/chunks/ffb3728e6ac428f62af1.js +0 -1
- package/views/3d/environment/EnvironmentManager.js +0 -2
- /package/{basemaps → basemapGallery}/support/basemapCompatibilityUtils.js +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{equals as n,isSome as r}from"../../core/arrayUtils.js";import{createTask as i}from"../../core/asyncUtils.js";import a from"../../core/Collection.js";import{deprecatedProperty as o}from"../../core/deprecate.js";import s from"../../core/Error.js";import{EventedMixin as c}from"../../core/Evented.js";import{makeHandle as l}from"../../core/handleUtils.js";import{equalsShallow as u}from"../../core/lang.js";import d from"../../core/Logger.js";import{clamp as f,deg2rad as p}from"../../core/mathUtils.js";import{destroyMaybe as m,abortMaybe as h}from"../../core/maybe.js";import{EsriPromise as g}from"../../core/Promise.js";import{isAbortError as _,throwIfAborted as v,waitTick as y}from"../../core/promiseUtils.js";import ee from"../../core/ReactiveMap.js";import{whenOnce as b,on as te,watch as x,syncAndInitial as S,initial as C,when as ne}from"../../core/reactiveUtils.js";import{sqlAnd as w}from"../../core/sql.js";import{getMetersPerUnitForSR as T}from"../../core/units.js";import{property as E,subclass as re}from"../../core/accessorSupport/decorators.js";import{isSerializable as ie}from"../../core/support/jsonUtils.js";import{UpdatingHandles as ae}from"../../core/support/UpdatingHandles.js";import oe from"../../geometry/Extent.js";import D from"../../geometry/Point.js";import{projectAsync as O}from"../../geometry/projectionUtils.js";import se from"../../geometry/SpatialReference.js";import{polygonCentroidPoint as ce}from"../../geometry/support/centroid.js";import{isClockwise as le}from"../../geometry/support/coordsUtils.js";import{normalizeMapX as k}from"../../geometry/support/normalizeUtils.js";import{geographicToWebMercator as A}from"../../geometry/support/webMercatorUtils.js";import j from"../../layers/GraphicsLayer.js";import ue from"../../layers/MediaLayer.js";import{searchImages as M}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as de}from"../../layers/orientedImagery/core/bestImageUtils.js";import{computePolygonForInspection as fe,resizePolygon as pe,checkIfFrustumContainsSelectedPoint as me,checkIfPolygonContainsSelectedPoint as he}from"../../layers/orientedImagery/core/coverageUtils.js";import{isElevationSource as ge}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{convertGeographicToWebMercator as N}from"../../layers/orientedImagery/core/utils.js";import _e from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as ve}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{or as ye,getInitialAngle as P,convertPixelLocationToSphereVertex as be,getUpdateElevationProps as F,adjustHorizonAngles as xe,convertOrientationToPixelLocation as Se,getImageToWorldProperties as I}from"../../layers/orientedImagery/transformations/utils.js";import Ce from"../../layers/support/ExtentAndRotationGeoreference.js";import{getFloorFilterClause as we}from"../../layers/support/floorFilterUtils.js";import Te from"../../layers/support/VideoElement.js";import Ee from"../../views/MapView.js";import De from"../../views/draw/Draw.js";import{scale as Oe}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as ke}from"../../views/input/InputManager.js";import Ae from"../PanoramicVideoViewer.js";import L from"../PanoramicViewer.js";import{defaultAngleThresholdInDegrees as R,videoMapViewConstraint as je,fixedImageSize as z,clockwiseDirections as Me,videoFitScaleTolerance as Ne,videoExtent as B,invalidCameraHeading as V,sectorsInOrder as H,sampleExtent as Pe,sectorsRadii as U}from"./constants.js";import{createFeatureCoverage as W}from"./featureCoverage.js";import{isFeatureAttachment as G}from"./galleryUtils.js";import{getPanoramicImageProperties as K}from"./panoramicImageProperties.js";import{crossSymbol as q,crossSymbol3D as Fe,measurementPolygonSymbol as Ie,polylineSymbolPanoramic as Le,measurementPolylineSymbol as Re,cameraOverlaySymbol3D as ze,cameraOverlaySymbol as Be,diamondSymbol as J,diamondSymbol3D as Ve,activeSourcePointSymbol as He,sourcePointSymbol as Ue}from"./symbols.js";import{registryKeys as Y}from"./types.js";import{isNoAttachmentError as We,extractHorizonAnglesFromMedia as X,isDepthImage as Ge,isTifOrMrf as Ke,filterOILLayerView as qe,assignElevationSampleToFeatures as Je,filterByZ as Ye,createPanoramicMedia as Xe,createNonPanoramicMedia as Ze,isSceneView as Qe,isGraphic as $e,calculateSegment as et,calculateDirection as tt}from"./utils.js";import{disableVideoZoomAndPan as nt,getUpdatedConstraints as rt,getUpdatedExtentPoints as it,normalizeVideoSource as at,isSelectedPointWithinVideoFootprint as ot,isVideoPixelWithinFrame as st}from"./videoViewerUtils.js";import ct from"./components/ImageViewer.js";import lt from"./components/NavigationNode.js";import ut from"./components/OrientedImageryVideoViewModel.js";import{NoFeatureFoundWithObjectIdError as dt}from"./navigation/errors.js";import{queryFeatureByObjectIds as ft}from"./navigation/queries.js";import{ImageMeasurementService as pt}from"./services/ImageMeasurementService.js";import mt from"./services/SuperimposeService.js";import{configureSketchTool as ht,extractFieldsFromDataCaptureLayer as gt,constructGraphicFromImageGeometry as _t}from"./support/dataCaptureUtils.js";import{removeZFromGeometry as vt,imageSpaceToPoint as Z,pointToImageSpace as yt}from"./support/geometryUtils.js";import{restorePanoramicNavigationViewState as bt,restoreDefaultNavigationViewState as xt}from"./support/navigationViewStateUtils.js";import St from"./support/resolveMediaProps.js";import{isValidDataCaptureLayer as Ct}from"./support/typeUtils.js";import wt from"./support/VideoFeatureCache.js";const Q=()=>new s(`orientedimageryviewer:sketch-not-initialized`,`Sketch property is not initialized, call loadSketch first`);let $=class extends c(g){constructor(e){super(e),this.additionalFeatures=new a,this.additionalCameraLocations=new a,this.additionalFootprints=new a,this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.bestFeatureAngle=0,this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null,this.cameraHeadingThreshold=R,this.cameraPitchThreshold=R,this.clickAction=`hittest`,this.correctedLocationPointOnImage=null,this.videoViewModel=null,this.collectionId=null,this.coverageFrustums=new a,this.coveragePolygons=new a,this.currentBestFeature=null,this.currentBestFeatureMeasurementImage=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.depthImage=null,this.featureCache=[],this.videoFeatureIndex=[],this.navigationNodes=new a,this.determineWorkflowForFeature=async(e,t,n)=>{let{currentBestFeature:r,selectedPoint:i}=this;if(this.emit(`popup-close`),r&&i){this.displayMessage=null,this._initialCurrentCoverageUpdate=!0;try{await this._updatePointsAndPolygons(n),await this._loadDepthImage(n),await this._loadCurrentFeatureMedia(r,n)}catch(e){_(e)||(this.loadImageError(e),d.getLogger(this).error(`#loadIImage()`,`error occured while loading image`,e))}}},this.determineWorkflowForTriangularMeasurement=async(e,t,n)=>{if(this.emit(`popup-close`),this.currentBestFeatureMeasurementImage&&this.selectedPoint)try{await this._loadMeasurementViewerImage(n)}catch(e){_(e)||(this.loadImageError(e),d.getLogger(this).error(`#loadIImage()`,`error occured while loading image`,e))}},this.disabled=!1,this.displayMessage={key:`onLoadMessage`,type:`info`},this.displayNewMeasurementButton=!0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.dataCaptureLayer=null,this.features=new a,this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.groundCoordinatesAccuracyLoading=!1,this.heightGraphic=null,this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.imageGeometryField=null,this.imageLocationToolState=!1,this.initialVideoMapViewExtent=null,this.imageMeasurementViewer=new ct,this.isAdditionalCoverageVisible=!1,this.isAdditionalPointSourcesVisible=!1,this.layer=null,this.localPort=null,this.locationPointOnImage=null,this.mapImageConversionToolState=!1,this.measureType=null,this.measurementGraphic=null,this.navigatorCurrentBestFeature=null,this.oiObjectIdField=null,this.overlayedCameraLocations=new a,this.overlayedMapFeatures=new ee,this.pixelCoordinates=null,this.preserveAngle=`none`,this.pointSources=new a,this.preloadMedia=!1,this.preloadMediaSize=5,this.previousFeatureAngle=0,this.selectedPoint=null,this.shouldShowSelectedImage=!1,this.superimposeViewEnabled=!1,this.defaultSuperimposeCameraLockEnabled=!0,this.sketch=null,this.sketchTriangular=null,this.sketchTriangularGraphicsLayer=null,this.draw=null,this.drawAdapter=null,this.polylineDrawAction=null,this.scheduledFrameId=null,this.superimposeScheduledFrameId=null,this.superimposeDebounceTimeoutId=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,n)=>{(this.mode!=="default"||this.state===`image-loaded`)&&await this._adapter?.updateFootprint(e,t,n)},this.updateVideoFootprint=async e=>{this.mode.includes(`video`)&&this.videoElement?.content&&await this._adapter?.updateVideoFootprint(e)},this.updateFootprintPanorama=async(e,t)=>{await this._adapter?.updateFootprintPanorama(e,t)},this.updatingTriangularMeasurementState=!1,this.videoElement=null,this.videoLayer=null,this.videoMapView=new Ee({map:new Map,attributionVisible:!1,constraints:je}),this.verticalFilterEnabled=!1,this.frustumSearchEnabled=!1,this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new ct,this._initialCurrentCoverageUpdate=!0,this._locationViewModel=null,this._measurementService=null,this._mediaPrefetcher=null,this._navigationManager=null,this._overlays=new j({listMode:`hide`,internal:!0,elevationInfo:{mode:`absolute-height`},title:`OrentedImageryViewerViewModel overlays layer`}),this._superimposePreviousCurrentCoverageVisible=null,this._superimposeService=new mt({getMapPoint:(e,t)=>this.getMapPoint(e,t),getPanoramicTransformationState:()=>{let{imageToWorldProperties:e,mode:t,updateElevationProps:n}=this._transformationService;return t!==`panoramic`||!e?null:{imageToWorldProperties:e,updateElevationProps:n}},pointToPixel:(e,t)=>this._transformationService.pointToPixel(e,t),overlays:this._overlays,getPointAtDistance:(e,t,n)=>this._transformationService.pixelToPointAtDistance(e,t,n)}),this._panoramicVideoViewer=new Ae,this._panoramicViewer=new L,this._panoramicMeasurementViewer=new L,this._referencePointOnGround=null,this._referencePointOnImage=null,this._referenceTransformationService=null,this._sectorData=null,this._transformationService=null,this._featureToSector=null,this._updatingHandles=new ae,this._clickTask=null,this._crossSymbol=null,this.footprintExtent=null,this._featureChangedTask=null,this._mediaPrefetchTask=null,this._navigationViewStateTask=null,this._pendingPanoramicNavigationViewState=null,this._restoreSuperimposeMediaTask=null,this._superimposeScheduleController=null,this._suitabilities=null,this._pendingDefaultNavigationViewState=null,this._transformController=new AbortController,this._updateFootprintTask=null,this._videoFeatureCache=new wt,this.addUpdatingPromise=e=>this._updatingHandles.addPromise(e),this.filterCapturedFeatures=e=>{let t=this.currentBestFeature?.attributes.objectId,n=this.layer?.imageReferenceField;t&&e&&n&&this.overlayedMapFeatures.get(e)?.forEach(e=>{let r=e.attributes??{},i=Object.keys(r).find(e=>e.toLowerCase()===n.toLowerCase());(i?r[i]:null)!==t&&(e.visible=!e.visible)})},this.hideImageGeometry=e=>{},this.highlight=e=>{if(!this._overlaysView)return;this.removeHighlight();let 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);let{default:t}=await import(`./adapters/sketch/DataCaptureAdapter.js`);return v(e),this.sketchAdapter=new t({viewModel:this}),this.sketchAdapter},this.loadImageFromFeature=(e,t,n)=>this._updatingHandles.addPromise(this._loadImageFromFeature(e,t,n)),this.storeImageMeasurementViewer=e=>{this.imageMeasurementViewer=e},this.storePanoramicMeasurementViewer=e=>{this._panoramicMeasurementViewer=e},this.loadImageViewer=e=>{this._imageViewer?.destroy(),this._imageViewer=e},this.loadPanoramicViewer=e=>{this._panoramicViewer?.destroy(),this._panoramicViewer=e},this.loadPanoramicVideoViewer=e=>{this._panoramicVideoViewer?.destroy(),this._panoramicVideoViewer=e},this.loadVideoViewer=e=>{this.videoMapView.container=e},this.showImageByObjectId=async(e,t)=>{let n=this.additionalFeatures.find(({attributes:t})=>t.objectId===e);if(n)this.currentBestFeature=n;else{let{layer:n,layerFloorFilterClause:r,layerTimeExtent:i}=this;if(!n){this.setMessage(`noLayerSelected`,`info`);return}this.beforeLoad();let a=this._updatingHandles.addPromise(this._queryAndLoadByObjectId(n,e,r,i,t));try{await a,await this.selectBestFeature(e,t)}catch(t){_(t)||(d.getLogger(this).error(`oriented-imagery-viewer:show-image`,t),t.name===`NoFeatureFoundWithObjectIdError`?this.setMessage(`noFeatureFoundWithObjectId`,`error`,``,{objectId:e}):this.setMessage(`imageLoadError`,`error`,t.message))}}},this.getSectorFeatureById=e=>this._suitabilities?.find(({feature:{attributes:{objectId:t}}})=>t===e),this.getFeatureSectorById=e=>this._featureToSector?.[`${e}`],this.navigate=async(e,t)=>{let{mode:n}=this;if(n!=="default"&&n!==`panoramic`)throw new s(`NavigationError`,`Navigation is only supported in 'default' and 'panoramic' modes.`);if(this._pendingDefaultNavigationViewState=null,this._pendingPanoramicNavigationViewState=null,this._navigationManager==null||!(e=>n==="default"&&e.declaredClass.endsWith(`NavigationManager`)||n===`panoramic`&&e.declaredClass.endsWith(`NavigationManagerPanoramic`))(this._navigationManager)){m(this._navigationManager);let e=n==="default"?import(`./navigation/NavigationManager.js`):import(`./navigation/NavigationManagerPanoramic.js`);this._navigationManager=new(await e).default({viewModel:this})}return this._navigationManager.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}`),b(()=>{switch(this.mode){case`video`:return this.state===`video-loaded`;case`panoramic-video`:return this.panoramicVideoLoaded;default:return this.state===`image-loaded`}},t)),this.toggleImageAttributes=()=>{let{currentBestFeature:e,popupEnabled:n,layer:r,view:i}=this;if(this.emit(`popup-close`),!i||!e||!n||!r)return;let{attributes:a,geometry:o}=e,s=new t({geometry:o,attributes:a.toJSON(),origin:r.graphicOrigin,sourceLayer:r});this.emit(`popup-open`,{features:[s],location:a.location.clone()})},this.updateSuitabilities=(e,t=!0)=>{e.sort((e,t)=>e.suitability-t.suitability),this._suitabilities=e;let n=this._suitabilities.map(({feature:e})=>e);this._initialCurrentCoverageUpdate=!0,this._updateFeatures(n,t),this._groupFeaturesBySectors()},this._computeOverlayImageSize=()=>{let{mode:e}=this;return e===`video`?z:e===`panoramic-video`?this._panoramicVideoViewer.imageSize:this.activeViewer?.imageSize},this._geometryToOverlayImageGeometry=async(e,t,n)=>{let{mode:r,videoViewModel:i,_panoramicVideoViewer:a}=this;if(r===`video`)return await i?.geometryToOverlayGeometry(e,t)??null;if(r===`panoramic-video`){let i={feature:t,mode:r,imageSize:n,footprintExtent:this.footprintExtent};return await this._transformationService.geometryToImageGeometryForFeature(e,i,a.horizonAngles)}return await this._transformationService.geometryToImageGeometry(e)},this._createViewClickHandle=()=>{if(this.removeHandles(Y.click),this.disabled||this.view==null)return;let e=this.mapImageConversionToolState&&(this.state===`image-loaded`||this.state===`video-loaded`&&this.mode===`video`&&this.videoViewModel?.videoPaused||this.panoramicVideoLoaded&&this.mode===`panoramic-video`&&this.panoramicVideoPaused)?this._mapImageConversionToolViewClickHandler:this._viewClickHandler;this.addHandles(this.view.on(`click`,e,ke.DEFAULT),Y.click)},this._createImageClickHandle=()=>{this.removeHandles(Y.imageClick),this.videoViewModel?.syncMapImageConversionHandle();let{mapImageConversionToolState:e,mode:t,footprintExtent:n,panoramicVideoLoaded:r}=this,a=t===`panoramic-video`?this._panoramicVideoViewer:this.activeViewer,o=a?.imageSize;if(!e||t===`none`||t===`video`||!o||!n)return;let s=t===`panoramic-video`,c=this._getActiveFeatureForCurrentMode(),u=!s||r&&this.panoramicVideoPaused;if(!c||!u)return;let d=a.clickAction;this.clickAction=`pixel-location`;let f=l(()=>{this.clickAction=d}),p=null,m=te(()=>a,`pixel-location`,e=>{this.plotReferencePointOnImage(e),p?.abort(),p=i(async r=>{if(!e)return;let i=this._getActiveFeatureForCurrentMode();if(!i)return;let a={feature:i,mode:t,imageSize:o,footprintExtent:n},c=s?await this.getMapPointForFeature(e,a,{signal:r}):await this._transformationService.pixelToMapPoint(e),l=this.view?.spatialReference;c&&!ye(!l,c.spatialReference.equals(l))&&(c=await O(c,l,{signal:r})),v(r),this.plotReferencePointOnGround(c)})});this.addHandles([m,f],Y.imageClick)},this._createTriangularImageClickHandle=()=>{this.removeHandles(Y.triangularImageClick),this.triangularMeasurementActive&&this.mode!==`none`&&this.currentBestFeature&&this.currentBestFeatureMeasurementImage&&this.activeTriangulatedViewer&&this.addHandles(this.activeTriangulatedViewer.imageRenderer.on(`double-click`,this._measurementImageClickHandler),Y.triangularImageClick)},this._enablePan=()=>{this.removeHandles(Y.videoPanHandles)},this._disablePan=()=>{this.removeHandles(Y.videoPanHandles),this.addHandles(nt(this.videoMapView),Y.videoPanHandles)},this._handleImageHitTestResponse=async e=>{let{layer:t,overlayedCameraLocations:n}=this;if(!t)return;let r=e.results.find(({graphic:e,graphic:{attributes:r}})=>n.includes(e)&&r&&!r[t.imageReferenceField]&&!r[t.imageGeometryField]);if(!r)return;let i=r.graphic.attributes[t.objectIdField];await this.showImageByObjectId(i)},this._loadCurrentFeatureMedia=async(e,t)=>{this.mode===`video`?await this._loadFlatVideo(e,t):this.mode===`panoramic-video`?await this._loadVideo(t):await this._loadImage(t)},this._loadFlatVideo=async(e,t)=>{this._initializeVideo(),this.videoViewModel?.playVideoFromSelectedLocation(e);let n=e.attributes.objectId;this._waitForFlatVideoAndPlotSelectedLocation(e,n,t)},this._waitForFlatVideoAndPlotSelectedLocation=async(e,t,n)=>{try{if(await b(()=>this.videoElement?.loaded===!0,n),`${this.currentBestFeature?.attributes.objectId}`!=`${t}`)return;await this.transformAndPlotSelectedLocation(n)}catch(t){_(t)||d.getLogger(this).error(`failed to plot selected point on video`,{error:t,selectedPoint:this.selectedPoint,feature:e})}},this._loadDepthImage=async e=>{let{currentBestFeature:t,layer:n,depthImageNotSupported:r}=this;if(this.depthImage?.destroy(),this.depthImage=null,!n||!t||r)return;let{depthImage:i}=t.attributes;if(!i)return;let a=(await import(`./services/DepthImageService.js`)).default;v(e),this.depthImage=new a({url:i});try{await this.depthImage.load(e)}catch(e){_(e)||(d.getLogger(this).error(`error occurred while loading depth image`,e),this.depthImage?.destroy(),this.depthImage=null)}},this._loadImage=async e=>{let{currentBestFeature:t,layer:n,mode:r}=this,i=this._pendingDefaultNavigationViewState;if(this._pendingDefaultNavigationViewState=null,this.clearGraphics(),n&&t&&r!==`none`&&r!==`video`&&r!==`panoramic-video`)try{if(await this.loadImageFromFeature(n,t,e),v(e),i)try{await this._restoreNavigationViewState(i,e)}catch(e){if(_(e))throw e;d.getLogger(this).warn(`oriented-imagery-viewer:failed-to-restore-navigation-view-state`,e)}await this.transformAndPlotSelectedLocation(e)}catch(e){_(e)||this.loadImageError(e)}},this._loadVideo=async e=>{let{currentBestFeature:t,mode:n,selectedPoint:r}=this,i=t?.attributes.imagePath;if(!t||n!==`panoramic-video`||!i)return;let{attributes:a}=t,{cameraPitch:o,cameraOrientation:s,location:c}=a,l=c.spatialReference.isWGS84&&s?.type!==4?A(c):new D(c);try{this._panoramicVideoViewer.viewModel.video&&(this._panoramicVideoViewer.viewModel.video.pause(),this._panoramicVideoViewer.viewModel.videoPaused=!0),this._panoramicVideoViewer.videoSource=i;let t=0;l&&r&&(t=await P(l,r)-t),this._panoramicVideoViewer.pitch=o??0,this._panoramicVideoViewer.yaw=t,await this._panoramicVideoViewer.loadVideo(e),v(e)}catch(e){_(e)||this.loadImageError(e)}},this._loadImageFromFeature=async(e,t,n)=>{let{mode:r}=this;if(r!=="default"&&r!==`panoramic`)return;let i;try{i=await St(t.attributes,e,n),v(n)}catch(n){if(_(n))return;if(We(n)){d.getLogger(this).error(n),this.setMessage(`noAttachment`,`error`,`${e.objectIdField}: ${t.attributes.objectId}`);return}d.getLogger(this).error(n,{[e.objectIdField]:t.attributes.objectId,layer:e}),this.setMessage(`imageLoadError`,`error`,`query-attachments-failed:${e.objectIdField} ${t.attributes.objectId}`);return}if(!i)return;let{mediaUrl:a,datasetFormat:o,rotation:s,searchParams:c,location:l,cameraHeading:u,matrix:f,cameraPitch:p,getDataSetFormatError:m}=i,h=`${t.attributes.objectId}`;try{let i=this._mediaPrefetcher?.getCachedMedia(h);if(!i){let n=this.navigationNodes.find(e=>e.id===t.attributes.objectId);if(n){try{await this._mediaPrefetcher?.startPrefetchForNode(n,e)}catch{}i=this._mediaPrefetcher?.getCachedMedia(h)}}if(i){if(r===`panoramic`){let e=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer,r=0;l&&this.selectedPoint&&(r=await P(l,this.selectedPoint)-r),await e.loadMedia(i,n),this.selectedPoint?e.set({yaw:r,pitch:p}):`viewAngle`in t.attributes&&Number.isFinite(t.attributes.viewAngle)&&e.set({yaw:t.attributes.viewAngle,pitch:p}),this.triangularMeasurementActive?await this.initializeReferenceTransformationService(n):await this.initializeTransformationService(n);return}await this._setImageSource(this.triangularMeasurementActive?this.imageMeasurementViewer:this._imageViewer,i,n),this.triangularMeasurementActive?await this.initializeReferenceTransformationService(n):await this.initializeTransformationService(n);return}}catch{}m&&d.getLogger(this).warn(`error occurred while getting dataset format`,m),r===`panoramic`?await this.loadPanoramicMediaSource({lookAt:{yaw:this.selectedPoint?await P(l,this.selectedPoint):`viewAngle`in t.attributes&&Number.isFinite(t.attributes.viewAngle)?t.attributes.viewAngle:0,pitch:p},extension:o?.toUpperCase(),url:a,cameraHeading:u,matrix:f},n):await this.loadMediaSource({datasetFormat:o?.toUpperCase(),url:a,customParameters:c,rotation:s},n),this.triangularMeasurementActive?await this.initializeReferenceTransformationService(n):await this.initializeTransformationService(n)},this._loadMeasurementViewerImage=async e=>{let{currentBestFeatureMeasurementImage:t,layer:n,mode:r}=this;if(this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics(),n&&t&&r!==`none`&&r!==`video`&&r!==`panoramic-video`)try{await this.loadImageFromFeature(n,t,e),v(e)}catch(e){_(e)||this.loadImageError(e)}},this._loadMediaPrefetcher=async e=>{if(!this._mediaPrefetcher){let{default:t}=await import(`./support/MediaPrefetcher.js`);v(e),this._mediaPrefetcher=new t({maxEntries:this.preloadMediaSize*Me.length})}return this._mediaPrefetcher},this._loadViewAdapter=async e=>{let{view:t}=this;if(this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),!t)this._adapter=null;else switch(t.type){case`2d`:{let{default:t}=await import(`./adapters/view/MapViewAdapter.js`);v(e),this._adapter=new t(this);break}case`3d`:{let{default:t}=await import(`./adapters/view/SceneViewAdapter.js`);v(e),this._adapter=new t(this);break}}},this._mapImageConversionToolViewClickHandler=e=>{if(e.stopPropagation(),e.preventDefault(),e.mapPoint){let t=e.mapPoint;t.x=k(t.x,t.spatialReference),this.plotMapPoint(e.mapPoint)}},this._measurementImageClickHandler=e=>{e.stopPropagation(),e.preventDefault();let{sketchTriangular:t,triangularMeasurementActive:n,currentBestFeatureMeasurementImage:r,triangulatedMeasurementGraphic:i}=this;t&&n&&r&&i&&t.state!==`active`&&(t.update([i],{tool:`reshape`}),this.updatingTriangularMeasurementState=!0)},this._updateInteraction=()=>{let e=this.videoMapView.extent;if(!e)return;let{minScale:t}=this.videoMapView.constraints,n=this.videoMapView.scale<t-Ne,r=rt(e);n&&r?(this._enablePan(),this.videoMapView.constraints.geometry=r):n?(this._disablePan(),this.videoMapView.constraints.geometry=null):(this.initialVideoMapViewExtent&&!this.videoMapView.extent.equals(this.initialVideoMapViewExtent)&&(this.videoMapView.extent=this.initialVideoMapViewExtent),this._disablePan(),this.videoMapView.constraints.geometry=null)},this._viewClickHandler=e=>{this._clickTask?.abort(),this._clickTask=i(async t=>{let{pointerType:n,button:r,mapPoint:i}=e;if(n===`mouse`&&r!==0||!i)return;e.stopPropagation(),e.preventDefault();let{view:a,layer:o}=this;if(a){if(!o)this.setMessage(`noLayerSelected`,`info`);else{if(this.shouldShowSelectedImage){let n=a.hitTest(e,{include:[o]});this._updatingHandles.addPromise(n);let r=await n;return v(t),await this._processHitTestResults(o,r,{signal:t})}return this._updatingHandles.addPromise(this.loadBestImage(i,{signal:t}))}}})},this.plotSelectedPointOnImage=async(e,n)=>{if(await y(n),!e)return;let r=new D({...ie(e)?e.toJSON():e});if(this.mode==="default")r.x-=.5,r.y=.5-r.y,r.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:r,symbol:q}),this._imageViewer.addGraphic(this._crossSymbol,0);else if(this.mode===`video`)this._crossSymbol=this.videoViewModel?.plotSelectedPointOnVideo(r)??null;else if(this.mode===`panoramic`){let{imageSize:n,media:r}=this._panoramicViewer;if(!n||!r)return;let i=X(r),a=be(e,...n,i);this._crossSymbol=new t({geometry:new D(a,se.WebMercator),symbol:Fe}),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([x(()=>this.view,()=>this.load(),S),x(()=>this.view?.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},C),x(()=>this.view?.map?.allLayers?.length,e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)},C),x(()=>[this.state,this.panoramicVideoLoaded,this.mapImageConversionToolState,this.view,this.disabled,this.panoramicVideoPaused,this.videoViewModel?.videoPaused],(e,t)=>{let n=e[2];t?.[2]&&!n&&(this.plotReferencePointOnGround(null),this.clearReferencePointOnImage()),this._createViewClickHandle(),this._createImageClickHandle()},S),x(()=>[this.triangularMeasurementActive,this.currentBestFeatureMeasurementImage],()=>{this._createTriangularImageClickHandle()},S),x(()=>[this.state,this.imageLocationToolState,this.view],()=>{this._initializeMeasurementService(),this._initializeLocationViewModel()},S),x(()=>this.measureType,()=>{this.clearPreviousMeasurements(),this._initializeMeasurementService()},S),x(()=>this.bestFeatureAngle,(e,t)=>{this.previousFeatureAngle=t??0},S),x(()=>[this.superimposeViewEnabled,this.defaultSuperimposeCameraLockEnabled,this.superimposeViewSupported,this.currentBestFeature,this.mode,this.state,this.view?.type],()=>{this._shouldDisableUnsupportedSuperimposeView()?this.superimposeViewEnabled=!1:this._hasActiveSuperimposeCameraContext()?this._updateSuperimposedImage():this._resetInactiveSuperimposeState()},S),x(()=>this._getSuperimposeCameraWatchState(),()=>this._handleSuperimposeCameraChange(),S),x(()=>this.currentBestFeature,async(e,t)=>{h(this._featureChangedTask),this._featureChangedTask=i(async n=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:n}])),await this._featureChangedTask.promise},{sync:!0}),x(()=>[this.currentNode,this.preloadMedia,this.navigationMode],()=>{this._mediaPrefetchTask?.abort(),this._mediaPrefetchTask=i(async e=>{this.preloadMedia&&this.navigationMode!=null?(this._mediaPrefetcher??=await this._loadMediaPrefetcher({signal:e}),v(e),this.navigationMode===`directional`?this._mediaPrefetcher.enqueueDirectionalPrefetch(this.layer,this.currentNode,this.preloadMediaSize):this._mediaPrefetcher.enqueueSequentialPrefetch(this.layer,this.currentNode,this.preloadMediaSize)):this._mediaPrefetcher?.clear()})},S),x(()=>this.currentBestFeatureMeasurementImage,(e,t)=>{h(this._featureChangedTask),t&&e!==t&&(this.triangulatedPoint=null,this.sketchTriangularGraphicsLayer?.graphics.destroyAll(),this._measurementService?.resetMeasurementVectors()),this._featureChangedTask=i(async n=>{await this.determineWorkflowForTriangularMeasurement(e,t,{signal:n}),v(n),this._reorderTriangularSketchLayer()})},S),x(()=>this.triangularMeasurementActive,(e,t)=>{t&&!e&&(this._measurementService?.resetMeasurementVectors(),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(),this._panoramicMeasurementViewer.clearImage(),this._panoramicMeasurementViewer.clearGraphics())}),x(()=>this.mode,e=>{switch(this.removeHandles(Y.interactionHandles),e){case`default`:this.addHandles(x(()=>{let{state:e}=this;return e===`image-loaded`?this._imageViewer.imagePointsInView:null},e=>{e&&(h(this._updateFootprintTask),this._updateFootprintTask=i(async t=>{await this.updateFootprint(e,void 0,{signal:t})}))},{...S,equals:(e,t)=>n(e,t,u)}),Y.interactionHandles);break;case`video`:this.addHandles(x(()=>{let{footprintExtent:e,videoElement:t,bestFeatureFootprint:n}=this;if(e&&t?.loaded&&n)return{videoExtent:B,bestFeatureFootprint:n}},e=>{e?.videoExtent&&e?.bestFeatureFootprint&&(h(this._updateFootprintTask),this._updateFootprintTask=i(async t=>{let n={points:e.videoExtent,feature:void 0,scale:void 0,options:{signal:t}};await this.updateVideoFootprint(n)}))},{...S,equals:(e,t)=>n(e?.videoExtent,t?.videoExtent,u)&&e?.bestFeatureFootprint===t?.bestFeatureFootprint}),Y.interactionHandles);break;case`panoramic`:this.addHandles(x(()=>{let{currentBestFeature:e,state:t,_panoramicViewer:n}=this,{imageSize:r,vfov:i,hfov:a,pitch:o,yaw:s}=n;return!e||!r||t.includes(`loading`)||i==null||a==null||o==null||s==null?null:[i,a,s,o]},e=>{if(!e||this.state.includes(`loading`))return;let[t,n,r,a]=e;this.currentNode&&(this.currentNode.currentHeading=r,this.currentNode.currentPitch=a),h(this._updateFootprintTask),this._updateFootprintTask=i(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:n,yaw:r,pitch:a},{signal:e}),this._updateFootprintTask=null})},{equals:(e,t)=>n(e,t,u)}),Y.interactionHandles);break;case`panoramic-video`:this.addHandles(x(()=>{let{currentBestFeature:e,state:t,_panoramicVideoViewer:n}=this,{imageSize:r,vfov:i,hfov:a,pitch:o,yaw:s,viewModel:c}=n,l=c.closestFeature??e;return!l||!r||t.includes(`loading`)||i==null||a==null||o==null||s==null?null:[i,a,s,o,l]},e=>{if(!e)return;let[t,n,r,a,o]=e;h(this._updateFootprintTask),this._updateFootprintTask=i(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:n,yaw:r,pitch:a,feature:o,horizonAngles:this._panoramicVideoViewer.horizonAngles},{signal:e}),v(e),this._updateFootprintTask=null})},{equals:(e,t)=>n(e,t,u)}),Y.interactionHandles)}},S),x(()=>[this.brightness,this.contrast,this.sharpness],()=>{let{_imageViewer:e,brightness:t,contrast:n,mode:r,sharpness:i}=this;r==="default"&&(e.brightness=t,e.contrast=n,e.sharpness=i)},S),x(()=>this.activeViewer?.imageRenderer,()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)}),x(()=>this.activeViewer,e=>{this.removeHandles(Y.hittestHandles),e&&this.addHandles(te(()=>e,`hittest-response`,this._handleImageHitTestResponse),Y.hittestHandles)}),x(()=>this.videoMapView.extent,async()=>{this._scheduleVideoInteractionUpdate();let e=this.videoViewModel?.closestFeature;e&&(h(this._updateFootprintTask),this._updateFootprintTask=i(async t=>{let n={points:this.videoExtentPoints,feature:e,options:{signal:t}};await this.updateVideoFootprint(n)}))}),x(()=>[this.videoMapView.interacting,this.videoMapView.navigating,this.videoMapView.scale],()=>{this._scheduleVideoInteractionUpdate()},{initial:!0}),ne(()=>this.videoMapView.extent!=null,()=>{this.initialVideoMapViewExtent=this.videoMapView.extent},{once:!0})]),this.when().finally(()=>{this.notifyChange(`state`)})}destroy(){this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),this._abortSuperimposeSchedule(),this.currentBestFeature=null,this._updateFootprintTask=h(this._updateFootprintTask),this._clickTask=h(this._clickTask),this._navigationViewStateTask=h(this._navigationViewStateTask),this._restoreSuperimposeMediaTask=h(this._restoreSuperimposeMediaTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=m(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint),this.videoViewModel=m(this.videoViewModel),this._locationViewModel=m(this._locationViewModel),this.clearSelectedPointOnViewer(),this._referencePointOnGround=m(this._referencePointOnGround),this.clearReferencePointOnImage(),this._superimposeService.destroy(),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy(),this._imageViewer.destroy(),this.imageMeasurementViewer.destroy(),this._panoramicViewer.destroy(),this._panoramicMeasurementViewer.destroy(),this._mediaPrefetcher?.destroy(),this._videoFeatureCache.destroy()}get activeLayer(){return o(d.getLogger(this),`activeLayer`,{replacement:`layer`}),this.layer}set activeLayer(e){o(d.getLogger(this),`activeLayer`,{replacement:`layer`}),this.layer=e}get activeViewer(){let{_imageViewer:e,_panoramicViewer:t,mode:n}=this;switch(n){case`default`:return e;case`panoramic`:return t;default:return null}}get activeTriangulatedViewer(){switch(this.mode){case`default`:return this.imageMeasurementViewer;case`panoramic`:return this._panoramicMeasurementViewer;default:return null}}get accuracyParametersMissing(){return this.layer?.orientationAccuracy?.every(e=>e===0)??!0}get brightness(){return this._get(`brightness`)??0}set brightness(e){this._set(`brightness`,f(e,-10,10))}get contrast(){return this._get(`contrast`)??0}set contrast(e){this._set(`contrast`,f(e,-10,10))}get currentNode(){let{currentBestFeature:e,navigationNodes:t}=this;return t.find(t=>t.id===e?.attributes.objectId)}get depthImageNotSupported(){if(this.currentBestFeature?.attributes.depthImage)return!Ge(this.currentBestFeature.attributes.depthImage)}get featureCount(){return this.features?.length??0}get hasPendingPanoramicNavigationViewState(){return this._pendingPanoramicNavigationViewState!=null}get imageGalleryEnabled(){let{currentBestFeature:e}=this;if(!e)return!1;let t=e.attributes.imagePath?.trim();return Ke(t)||G(t)}get imageLoaded(){return o(d.getLogger(this),`imageLoaded`,{replacement:`Use OrientedImageryViewer.state === "image-loaded"`,version:`4.29`,warnOnce:!0}),this.state===`image-loaded`}get invalidCameraHeading(){return this.currentBestFeature?.attributes?.cameraHeading===V}get imagePointsInView(){let{mode:e,_imageViewer:t}=this;return e==="default"?t.imagePointsInView:null}get layerView(){let{layer:e,view:t}=this;if(e&&t)return t.allLayerViews.find(qe(e))}get layerFloorFilterClause(){let{layerView:e}=this;return e?we(e):null}get layerTimeExtent(){return this.layerView?.timeExtent??null}get mode(){let e=this.currentBestFeature?.attributes;if(!e)return`none`;let t=e.orientedImageryType;if(t?.includes(`video`))return t.includes(`360`)?`panoramic-video`:`video`;let{horizontalFieldOfView:n,isSpherical:r}=e;return n===360||r?`panoramic`:`default`}get panoramicVideoLoaded(){let{mode:e,_panoramicVideoViewer:t}=this,{videoLoaded:n}=t.viewModel;return e===`panoramic-video`&&n===!0}get overlayGraphicsEnabled(){let{mode:e,state:t,panoramicVideoLoaded:n,videoViewModel:r,panoramicVideoPaused:i}=this;return t===`image-loaded`||e===`video`&&t===`video-loaded`&&r?.videoPaused===!0||e===`panoramic-video`&&n&&i}get panoramicVideoPaused(){return!!this._panoramicVideoViewer.viewModel.videoPaused}get popupEnabled(){return this.layer?.popupEnabled===!0}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){let{_sectorData:e}=this;return e?H.map(t=>e[t]):null}get sharpness(){return this._get(`sharpness`)??0}set sharpness(e){this._set(`sharpness`,f(e,0,1))}get superimposeViewSupported(){return this.mode==="default"||this.mode===`panoramic`}get sketchGraphicsLayer(){let{sketch:e}=this;return e?.layer?.type===`graphics`?e.layer:void 0}get state(){let{mode:e,_updatingHandles:{updating:t},_featureChangedTask:n,_navigationManager:r}=this;if(!this.isFulfilled()||t||n?.finished===!1||r?.navigating)return`loading`;if(this.isRejected())return`error`;if(this.displayMessage?.type===`error`)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`;case`panoramic-video`:return this.panoramicVideoLoaded?`video-loaded`:`video-not-loaded`}return`ready`}get thumbnails(){let{features:e}=this;return e?new a(e.map(({attributes:{imagePath:e,objectId:t,cameraRoll:n,imageRotation:r}})=>{let i=e?.trim();return Ke(i)||G(i)?{url:i,objectId:t,rotation:(n??0)+(r??0)}:null}).filter(r)):null}get videoExtentPoints(){let e=it(this.videoMapView.extent);return e.length?e:B}set view(e){this._set(`view`,e)}get _defaultGraphicsLayer(){let e={blendMode:`source-atop`};switch(this.mode){case`panoramic`:return new j({...e,elevationInfo:{mode:`absolute-height`}});case`default`:return new j({...e});default:return}}get _overlaysView(){return this.view?.layerViews.find(({layer:e})=>e===this._overlays)}updatePanoramicSuperimposeRadiusOffset(e){this._superimposeService.updatePanoramicRadiusOffset(e)}setDefaultSuperimposeZOffsetPercentage(e){this._superimposeService.setDefaultZOffsetPercentage(e)}setFrustumSearchEnabled(e){this.frustumSearchEnabled=e}setPanoramicSuperimposeRadiusPercentage(e){this._superimposeService.setPanoramicRadiusPercentage(e)}updateDefaultSuperimposeCameraLock(e){this.defaultSuperimposeCameraLockEnabled=e,this.superimposeViewEnabled&&this.mode==="default"&&(e?this._adapter?.enableDefaultSuperimposeNavigation?.():this._adapter?.disableDefaultSuperimposeNavigation?.())}beforeLoad(e=!0){this.emit(`popup-close`),e&&(this.displayMessage=null),this._pendingDefaultNavigationViewState=null,this._pendingPanoramicNavigationViewState=null,this._abortSuperimposeSchedule(),this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),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=m(this.bestFeatureCurrentFootprint),this._restoreSuperimposeMediaTask=h(this._restoreSuperimposeMediaTask),this._superimposeService.clear(),this._overlays?.removeAll()}async calculateLocationAccuracy(e){return this._measurementService?.calculateLocationAccuracy(e)}clearLocationPointOnImage(e=!1){this.locationPointOnImage&&!e&&(this._imageViewer.removeGraphic(this.locationPointOnImage),this._panoramicViewer.removeGraphic(this.locationPointOnImage),this.locationPointOnImage=m(this.locationPointOnImage)),this.correctedLocationPointOnImage&&=(this.imageMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),this._panoramicMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),m(this.correctedLocationPointOnImage))}clearPreviousMeasurements(){this.clearMeasurementGraphics(),this.resetMeasurementData(),this.stopMeasurement()}clearPreviousGroundLocation(){this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.groundCoordinatesAccuracyLoading=!1,this.pixelCoordinates=null,this.clearLocationPointOnImage()}clearMeasurementGraphics(){this.measurementGraphic&&=(this.activeViewer?.removeGraphic(this.measurementGraphic),null),this.heightGraphic&&=(this.activeViewer?.removeGraphic(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){let{sketch:n,dataCaptureLayer:r}=this;if(!n)throw Q();ht(r,e,n),await n.create(e,{...t,defaultZ:0})}digitizeDelete(){if(!this.sketch)throw Q();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw Q();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw Q();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw Q();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw Q();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw Q();return this.sketch.update(e,t)}filterByFootprints(e,t,n){let r=n?.filterByFrustum??!1,i=n?.skipFilter??!1,a=[],o=[],s=[];return e.forEach(e=>{let{attributes:n}=e,c=e.layer?.coveragePercent,l,{polygon:u,frustum:d}=W(n);l=u.clone(),n.isInspection&&(l=fe(n)),c&&(l=pe(l,c));let{cameraHeading:f,objectId:p}=n;if(this._matchesSelectedPointFilter({skipFilter:i,selectedPoint:t,filterByFrustum:r,cameraHeading:f,attributes:n,polygon:l})){s.push(e);let t=n.location.clone();t.imageID=p,this.pointSources.push(t),f!==V&&(a.push(u),d&&o.push(d))}}),{features:s,polygons:a,frustums:o}}async deleteDataCaptureFeatures(e){let{dataCaptureLayer:t}=this;if(!t)throw new s(`orientedimageryviewer:missing-featurelayer`,`Data capture layer is not available`);return t.queryFeatures({objectIds:e,outFields:[t.objectIdField]}).then(({features:e})=>t.applyEdits({deleteFeatures:e}))}handleSectorClick(e){if(isNaN(e))return;let t=(this._sectorData?.[H[e]])?.at(0);t&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(t):this._scheduleCurrentBestFeatureUpdate(t))}handleFeatureClick(e){let{sector:t,featureIndexInSector:n}=e;if(isNaN(n))return;let r=(this._sectorData?.[t])?.at(n);r&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(r):this._scheduleCurrentBestFeatureUpdate(r))}load(e){return this.addResolvingPromise(this._loadViewAdapter(e).catch(e=>{if(!_(e))throw e})),this}async loadBestImage(e,t){return this.selectedPoint=N(e),this.beforeLoad(),this._fetchFeaturesWithController(e,t)}async loadHeightMeasurementAdapter(e){if(!this.drawAdapter){let{default:t}=await import(`./adapters/draw/HeightMeasurementAdapter.js`);if(v(e),this.drawAdapter=new t({viewModel:this,measurementService:this._measurementService}),!this.drawAdapter.viewModel.isResolved())return}return this.drawAdapter}loadImageError(e){d.getLogger(this).error(`oriented-imagery-viewer:load-image`,e),this.setMessage(`imageLoadError`,`error`,e.message)}async loadSketch(e){if(!this.sketch){let{default:t}=await import(`../Sketch/SketchViewModel.js`);v(e),this.sketch=new t({layer:this._defaultGraphicsLayer,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){let{default:t}=await import(`./adapters/sketch/MeasurementAdapter.js`);if(v(e),this.sketchAdapter=new t({viewModel:this,measurementService:this._measurementService}),!this.sketchAdapter.viewModel.isResolved())return}return this.sketchAdapter}async processFeatureResponse(e,t,n){let{features:r}=e,i=this.layer?.verticalSearchRange,a=this._shouldUseVerticalFilter(),o=this._shouldUseFrustumSearch();if(this._clearFeatureGeometries(),!this._checkFeatures(r))return;let{features:s,polygons:c}=o?this.filterByFootprints(r,t,{filterByFrustum:!0}):this.filterByFootprints(r,t,{skipFilter:n?.skipFilter});if(!this._checkFeatures(s))return;let l=await this.processElevationSample(c,s,n);v(n),await this._updateElevationOfSelectedPointAndLocations(s,t,l),v(n),s.forEach(({attributes:e})=>{if(e.cameraHeading!==V){let{polygon:t,frustum:n}=W(e);this.coveragePolygons.add(t),n&&this.coverageFrustums.add(n)}}),Je(s,l);let u=s;if(a&&t&&i!=null&&(u=Ye(s,t,i),!u.length)){this.setMessage(`noImageAtElevation`,`info`);return}let d=this._processSuitableFeatures(u,t);this.updateSuitabilities(d,n?.loadBestImage)}async processFeatureElevation(e,t,n){if(!t)return;let{features:r,polygons:i}=this.filterByFootprints(e,t,{skipFilter:!0});if(!r?.length)return;let a=await this.processElevationSample(i,r,n);return v(n),a}async startMeasurement(e,t){this.sketch||await this.loadSketch(t),await this.loadMeasurementAdapter(t);let{sketch:n,sketchAdapter:r,activeViewer:i,mode:a}=this;if(!n||!r||!i||a===`none`)return;if(this.displayNewMeasurementButton=!1,a===`panoramic`&&(n.defaultCreateOptions.defaultZ=0),await n.create(e),a===`panoramic`){let{drawOperation:e}=n.view.activeTool;e.constraintsEnabled=!1,e._set(`elevationDrawSurface`,null)}let o=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;o&&this.sketch&&(this.sketch.polygonSymbol=Ie(o),this.sketch.polylineSymbol=a===`panoramic`?Le:Re(o,2.5))}async startHeightMeasurement(){this.displayNewMeasurementButton=!1,this.draw??=new De({view:this.activeViewer?.imageRenderer}),this.polylineDrawAction=this.draw.create(`polyline`),await this.loadHeightMeasurementAdapter()}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){let{activeViewer:n,overlayedCameraLocations:i,layer:a,mode:o,layerFloorFilterClause:s,layerTimeExtent:c,videoViewModel:l,_panoramicVideoViewer:u}=this,d=o===`video`,f=o===`panoramic-video`,p=this._getActiveFeatureForCurrentMode(),m=this._computeOverlayImageSize();if(!m||!p||!a||o===`none`||!this.overlayGraphicsEnabled)return;let{polygon:h}=W(p.attributes);if(d?l?.removeOverlayGraphics(i.toArray()):f?u.removeManyGraphics(i.toArray()):n?.removeManyGraphics(i.toArray()),i.removeAll(),e){let{features:e}=await a.queryFeatures({where:w(`${a.objectIdField} <> ${p.attributes.objectId}`,w(a.definitionExpression,s)),geometry:h,returnGeometry:!0,outFields:[a.objectIdField],timeExtent:c}),g=await Promise.all(e.map(async e=>{let{attributes:n,geometry:r}=e;if(r?.type!==`point`)return null;let i=await this._geometryToOverlayImageGeometry(r,p,m);if(!i)return null;let a=o===`panoramic`||o===`panoramic-video`?ze():Be();return new t({attributes:n,symbol:a,geometry:i})}));i.addMany(g.filter(r)),d?l?.addOverlayGraphics(i.toArray()):f?u.addManyGraphics(i.toArray()):n?.addManyGraphics(i.toArray())}}overlayGraphicsOnImage(e,t){this.removeOverlayedGraphicsOnImage(e),this.overlayedMapFeatures.set(e,t),this.mode===`video`?this.videoViewModel?.addOverlayGraphics(t.toArray()):this.mode===`panoramic-video`?this._panoramicVideoViewer.addManyGraphics(t.toArray()):this.activeViewer?.addManyGraphics(t.toArray())}async overlayMapFeatures(e,n=!1){let{activeViewer:i,mode:o,layer:s,videoViewModel:c,_panoramicVideoViewer:l}=this,u=o===`video`,f=o===`panoramic-video`,p=this._getActiveFeatureForCurrentMode(),m=this._computeOverlayImageSize();if(!m||!p||o===`none`||!this.overlayGraphicsEnabled||!s)return;let{polygon:h}=W(p.attributes);try{let{imageGeometryField:t,oiObjectIdField:n}=gt(e,s.imageGeometryField,s.imageReferenceField);this.imageGeometryField=t.name,this.oiObjectIdField=n.name}catch(e){d.getLogger(this).warn(`oriented-imagery-viewer:overlay-map-features`,e)}let{features:g}=await e.queryFeatures({geometry:h,returnGeometry:!0,outFields:[`*`]}),_=await Promise.all(g.map(async r=>{let a=r.symbol?.clone()??e.renderer?.getSymbol(r)?.clone(),{attributes:s,geometry:h}=r,{imageGeometryField:g,oiObjectIdField:_}=this;if(g&&_&&Ct(e,g,_)&&`${s[_]}`==`${p.attributes.objectId}`)try{let r=f?l.horizonAngles:X(i?.media),d=_t(s,g,e,n,m,u?`default`:o,a,r);if(!u)return d;let p=d.geometry;if(!p)return null;let h=c?.imageGeometryToOverlayGeometry(p);return h?new t({attributes:s,layer:e,symbol:d.symbol,geometry:h,visible:d.visible}):null}catch(t){d.getLogger(this).warn(`oriented-imagery-viewer:overlay-map-features`,`couldn't create graphic from attributes, geometry will be used`,{error:t,feature:r,layer:e,imageGeometryField:this.imageGeometryField,imageReferenceField:this.oiObjectIdField})}if(!h)return null;let v={feature:p,imageSize:m,footprintExtent:this.footprintExtent},y=await this._geometryToOverlayImageGeometry(h,v.feature,v.imageSize);return y?new t({attributes:s,layer:e,symbol:a,geometry:y,visible:e.visible&&n}):null})),v=new a(_.filter(r));(o!==`video`&&o!==`panoramic-video`||this.overlayGraphicsEnabled)&&this.overlayGraphicsOnImage(`${e.id}`,v)}getDepthAt(e){let{activeViewer:t,currentBestFeature:n,mode:r,state:i,depthImage:a}=this,o=t?.imageSize;if(!o||!n||r===`none`||i.includes(`loading`))return d.getLogger(this).warnOnce(`oriented-imagery-viewer:get-depth-at`,`Load an image to use depth`),null;if(!a?.loaded)return d.getLogger(this).error(`oriented-imagery-viewer:get-depth-at`,`Depth image is not loaded`),this.emit(`depth-image-service:not-loaded`),null;let s=(Array.isArray(e)?e:[e]).map(e=>a.depthAt(e,{width:o[0],height:o[1]})??null);return Array.isArray(e)?s:s[0]}getActiveSectors(){return H.filter(e=>this._sectorData?.[e]?.length)}async getPixelLocationForFeature(e,t,n){return(await this._transformationService.pointToPixelForFeature([e],t,n))[0]}async getPixelLocationsForFeature(e,t,n){return await this._transformationService.pointToPixelForFeature(e,t,n)}async _getMapPointInViewSpatialReference(e,t){let n=await this.getMapPoint(e,t),r=this.view?.spatialReference;return await O(n,r,t)}async plotMapPoint(e){this.plotReferencePoint(e);let t=this._getActiveFeatureForCurrentMode();if(t)return this.transformAndPlotReferencePointOnImage({feature:t,selectedLocation:e,options:{signal:this._transformController?.signal}})}plotReferencePointOnGround(e){this._referencePointOnGround&&(this._overlays?.remove(this._referencePointOnGround),this._referencePointOnGround.destroy()),e!=null&&(this._referencePointOnGround=new t({geometry:new D({...e.toJSON()}),symbol:J}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit(`plot-ground-point`,{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){switch(this.mode){case`video`:this._plotReferencePointOnVideo(e);return;case`panoramic-video`:this._plotReferencePointOnPanoramicVideo(e);return;case`default`:this._plotReferencePointOnDefaultImage(e);return;case`panoramic`:this._plotReferencePointOnPanoramicImage(e);return}}removeAllOverlayMapFeatures(){let{mode:e}=this;this.overlayedMapFeatures.forEach(t=>{let n=t.toArray();switch(e){case`video`:this.videoViewModel?.removeOverlayGraphics(n);break;case`panoramic-video`:this._panoramicVideoViewer.removeManyGraphics(n);break;default:this.activeViewer?.removeManyGraphics(n)}}),this.overlayedMapFeatures.clear()}removeOverlayedGraphicsOnImage(e){let t=this.overlayedMapFeatures.get(e),{mode:n}=this;if(!t?.length)return;let r=t.toArray();switch(n){case`video`:this.videoViewModel?.removeOverlayGraphics(r);break;case`panoramic-video`:this._panoramicVideoViewer.removeManyGraphics(r);break;default:this.activeViewer?.removeManyGraphics(r)}this.overlayedMapFeatures.delete(e)}reset(){let{mode:e}=this;e==="default"||e===`panoramic`?this.resetImage():e===`video`?this.resetVideo():e===`panoramic-video`&&this.resetVideoPanoramic(),this.beforeLoad(!1)}resetImage(){switch(this.setMessage(`onLoadMessage`,`info`),this.mode){case`default`:this._imageViewer.clearImage(),this._imageViewer.clearGraphics();break;case`panoramic`:this._panoramicViewer.clearImage(),this._panoramicViewer.clearGraphics()}this._clickTask=h(this._clickTask)}resetVideo(){this.setMessage(`onLoadMessage`,`info`),this.videoViewModel?.resetVideoHandler(),this._overlays?.removeAll(),this.videoViewModel=null,this._videoFeatureCache.reset(),this._syncVideoFeatureCacheState(),this.currentBestFeature=null}resetVideoPanoramic(){this.setMessage(`onLoadMessage`,`info`),this._overlays?.removeAll(),this._panoramicVideoViewer.reset(),this.currentBestFeature=null}resetMeasurementData(){this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.heightGraphic=null,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedMeasurementGraphic=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaAccuracy=0,this._measurementService?.resetMeasurementVectors()}async saveDrawing(){let{dataCaptureLayer:e,sketchAdapter:t}=this;if(!e||t?.type!==`data-capture`)return;let{pendingGraphics:n,savedGraphics:r}=t,i=n.get(e.id),a=i?.toArray();if(!i||!a?.length)return;let{addFeatureResults:o}=await this.saveDataCaptureFeatures(a),s=o.reduce((t,{objectId:n,globalId:r,error:i},o)=>{let s=a[o],{attributes:c}=s;return i?t.error.push(s):(n&&(c[e.objectIdField]=n),r&&e.globalIdField&&(c[e.globalIdField]=r),t.success.push(s)),t},{success:[],error:[]});r.addMany(s.success),i.removeAll(),i.addMany(s.error)}async saveDataCaptureFeatures(e,t){let{activeViewer:n,currentBestFeature:i,dataCaptureLayer:a,mode:o}=this;if(!n?.imageSize||!i||o===`none`||o===`video`||o===`panoramic-video`)throw new s(`orientedimageryviewer:missing-input`,`Image size, current best feature and mode are required to save data capture features`);if(!a)throw new s(`orientedimageryviewer:missing-featurelayer`,`Data capture layer is not available`);let c=await Promise.all(e.map(async e=>{let n=e.clone(),{geometry:r}=n;if(!r)return;let i=r.type,o=a.hasZ,s=a.geometryType,c=i!==s,l=(c?await import(`./transformers.js`):null)?.default[s],u=c?l?.(r):r;if(u&&(n.geometry=await this._transformationService.imageGeometryToMapGeometry(u,t),n.geometry))return o||vt(n.geometry),n})),l=c.filter(r);return a.applyEdits({addFeatures:l}).then(e=>{let{addFeatureResults:t}=e,n=0,r=c.map(e=>{let r=t[n++];return e?r:{error:new s(`orientedimageryviewer:save-unsucccessful`,`Error in saving data capture features`),objectId:null,globalId:null}});return{...e,addFeatureResults:r}})}async searchBestImage(e,t){try{let n=await M(e,t);n&&await this.processFeatureResponse(n,e.point,t)}catch(e){_(e)||(this.setMessage(`imageLoadError`,`error`,e.message),d.getLogger(this).error(`error occurred while finding best image`,e))}}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 restorePendingPanoramicNavigationViewState(e){let t=this._pendingPanoramicNavigationViewState;this._pendingPanoramicNavigationViewState=null,this.mode===`panoramic`&&await this._restoreNavigationViewState(t,e)}async startDataCapture(e,t){let n=this.activeViewer?.imageRenderer,{oiObjectIdField:r,currentBestFeature:i}=this;if(!n||!i||!r)return;let{attributes:{objectId:o}}=i,s=this.overlayedMapFeatures.get(e.id)?.toArray()??[],c=[],l=[];for(let e of s)`${e.getAttribute(r)}`==`${o}`?c.push(e):l.push(e);this.overlayGraphicsOnImage(e.id,new a(l)),this.collectionId=e.id;let u=await this.loadSketch(t),d=await this.loadDataCaptureAdapter(t);v(t),u.addGraphics(c),d.savedGraphics.addMany(c);let f=n.ui.find(`zoom`);f.visible=!1,n.map.layers.add(this.sketchGraphicsLayer)}async stopDataCapture(e=!1){this.sketch?.cancel(),this.sketchGraphicsLayer?.removeAll(),this.sketchAdapter=m(this.sketchAdapter),this.sketch=m(this.sketch),this.collectionId=null;let{dataCaptureLayer:t}=this,n=this.activeViewer?.imageRenderer;if(!n||n.destroyed)return;n.map.layers.remove(this.sketchGraphicsLayer),e&&t&&await this.overlayMapFeatures(t,!0);let r=n.ui.find(`zoom`);r&&(r.visible=!0)}stopMeasurement(){this.draw?.reset(),this.sketch?.cancel()}async toggleAllOverlayMapFeatures(e){!e&&this.dataCaptureLayer&&(await this.stopDataCapture(!0),this.dataCaptureLayer=null),this.overlayedMapFeatures.forEach(t=>{this._toggleVisiblity(t,e)})}toggleOverlayMapFeatures(e,t,n){let r=this.overlayedMapFeatures.get(e);r&&n&&this._toggleVisiblity(r,t)}toggleSelection(e){let{sketch:t}=this;t&&(t.updateOnGraphicClick=e,t.cancel())}async transformAndPlotReferencePointOnImage(e){let{feature:t,selectedLocation:n,options:r}=e,i=!1,a=!1,o=this.mode===`video`?this.bestFeatureCurrentFootprint?.geometry:this.bestFeatureFootprint?.geometry;switch(o?.type){case`polygon`:{let e=n.spatialReference.equals(o.spatialReference)?n:await O(n,o.spatialReference);i=o.contains(e);break}case`mesh`:{let e=n.spatialReference.equals(o.spatialReference)?n:await O(n,o.spatialReference);a=o.extent.contains(e);break}}if(!i&&!a){this.clearReferencePointOnImage();return}let s=this.mode===`video`||this.mode===`panoramic-video`?await this.getPixelLocationForFeature(n,{feature:t,mode:this.mode,imageSize:z,footprintExtent:this.footprintExtent},r):await this._transformationService.pointToPixel(n,r);if(!s)this.clearReferencePointOnImage();else return v(r),this.plotReferencePointOnImage(s),{x:s.x,y:s.y}}async updateFeatureCache(e){await this._videoFeatureCache.updateIndex(e),this._syncVideoFeatureCacheState()}cacheHydratedVideoFeature(e){this._videoFeatureCache.cacheHydratedFeature(e),this._syncVideoFeatureCacheState()}getCachedVideoFeatureByOffset(e,t){return this._videoFeatureCache.getCachedFeatureByOffset(e,t)}async getVideoFeatureByOffset(e,t,n){let{layer:r}=this;if(!r)return null;let i=await this._videoFeatureCache.getFeatureByOffset({layer:r,layerFloorFilterClause:this.layerFloorFilterClause,layerTimeExtent:this.layerTimeExtent},e,t,n);return this._syncVideoFeatureCacheState(),i}_shouldUseVerticalFilter(){return!!(this.layer?.verticalSearchRange&&this.layer.hasZ&&this.verticalFilterEnabled)}_shouldUseFrustumSearch(){return!!(this.layer?.hasZ&&this.frustumSearchEnabled&&this.view?.type===`3d`)}_syncVideoFeatureCacheState(){this.featureCache=this._videoFeatureCache.featureCache,this.videoFeatureIndex=this._videoFeatureCache.videoFeatureIndex}_matchesSelectedPointFilter({skipFilter:e,selectedPoint:t,filterByFrustum:n,cameraHeading:r,attributes:i,polygon:a}){return e||!t||(n?r!==V&&me(i,t):he(a,t))}_plotReferencePointOnVideo(e){this.state===`video-loaded`&&this.videoViewModel?.videoPaused&&(this.clearReferencePointOnImage(),this.videoViewModel.plotReferencePointOnVideo(e))}_plotReferencePointOnPanoramicVideo(e){let n=this._panoramicVideoViewer,{imageSize:r,media:i}=n.viewModel;if(!this.panoramicVideoLoaded||!this.panoramicVideoPaused||!r)return;this.clearReferencePointOnImage();let a=X(i),o=Z(e,`panoramic`,r,a);this._referencePointOnImage=new t({geometry:o,symbol:Ve.clone()}),n.addGraphic(this._referencePointOnImage,0)}_getActiveFeatureForCurrentMode(){switch(this.mode){case`video`:return this.videoViewModel?.closestFeature??this.currentBestFeature;case`panoramic-video`:return this._panoramicVideoViewer.viewModel.closestFeature??this.currentBestFeature;default:return this.currentBestFeature}}_plotReferencePointOnDefaultImage(e){let n=this._imageViewer,{imageSize:r}=n;if(this.state!==`image-loaded`||!r)return;this.clearReferencePointOnImage();let i=Z(e,`default`,r);this._referencePointOnImage=new t({geometry:i,symbol:J.clone()}),n.addGraphic(this._referencePointOnImage,0)}_plotReferencePointOnPanoramicImage(e){let n=this._panoramicViewer,{imageSize:r,media:i}=n;if(this.state!==`image-loaded`||!r)return;this.clearReferencePointOnImage();let a=X(i),o=Z(e,`panoramic`,r,a);this._referencePointOnImage=new t({geometry:o,symbol:Ve.clone()}),n.addGraphic(this._referencePointOnImage,0)}async _fetchFeatures(e,t){let{layer:n,layerFloorFilterClause:r,layerTimeExtent:i,view:a}=this;if(!a)return;if(!n){this.setMessage(`noLayerSelected`,`info`);return}e.x=k(e.x,e.spatialReference);let o=n.spatialReference.equals(e.spatialReference)?e:await O(e,n.spatialReference),s=o.spatialReference.isGeographic?A(o):o,c=w(`1=1`,w(n.definitionExpression,r)),l=s.spatialReference.isGeographic?1:T(s.spatialReference),u={layerInstanceOrURL:n,point:s,queryParams:{where:c,maximumDistance:n.maximumDistance?n.maximumDistance/l:void 0,timeExtent:i}};return await this.searchBestImage(u,t)}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(e){if(_(e))return;this.setMessage(`imageLoadError`,`error`),d.getLogger(this).error(`error occurred while fetching features`,e)}}_groupFeaturesBySectors(){let{_suitabilities:e,additionalFeatures:t,features:n,invalidCameraHeading:r}=this,i=n.at(0);if(!e||!t||!i||!n||r){this._sectorData=null;return}this._sectorData={};let o={};this._featureToSector=o;for(let e of H)this._sectorData[e]=new a;let s=e.map((e,t)=>({...e,featureIndex:t}));s.sort((e,t)=>e.trueSuitability-t.trueSuitability);let c=s.map(({distance:e})=>e),l=Math.max(...c);s.forEach(e=>{let{distance:t,angle:r,featureIndex:a}=e,s=t/l*U[2],c=et(t,l),u=tt(r);if(!this._sectorData)return;let d=U[3]+s*Math.sin(r*Math.PI/180),f=U[3]+s*Math.cos(r*Math.PI/180),p,m=n.at(a),h=m===i,{cameraPitch:g}=m.attributes,_=g<5;if(h&&_)p=-90;else{let e=d-U[3],t=f-U[3],n=t/Math.sqrt(e**2+t**2),r=Math.acos(n)*180/Math.PI;(e<0&&t<0||e<0&&t>0)&&(r*=-1),p=r}let v=c===``?u:`${c}_${u}`;h&&(p===this.bestFeatureAngle?this.previousFeatureAngle=p:this.bestFeatureAngle=p,this.navigatorCurrentBestFeature=_?null:{x:d,y:f,direction:u}),o[`${m.attributes.objectId}`]=v;let y=this._sectorData[v];y.add({angle:r,featureIndex:a,x:d,y:f,objectID:m.attributes.objectId,sector:v,featureIndexInSector:y.length})})}async _initializeLocationViewModel(e){if(!this._locationViewModel){let{default:t}=await import(`./components/ImageLocationViewModel.js`);v(e),this._locationViewModel=new t({oiViewModel:this,referenceTransformationService:this._referenceTransformationService})}}_initializeMeasurementService(){this._measurementService||=new pt({transformationService:this._transformationService,referenceTransformationService:this._referenceTransformationService})}_initializeVideo(){if(!this.currentBestFeature)return;let e=at(this.currentBestFeature.attributes.imagePath),t=at(this.videoElement?.video);if(e&&t===e&&this.videoViewModel)return;this.videoLayer&&=(this.videoMapView.map.layers.remove(this.videoLayer),this.videoLayer.destroy(),null),this.videoViewModel=m(this.videoViewModel),this.removeHandles(Y.videoPlayerHandles),this.videoElement=new Te({video:e??this.currentBestFeature.attributes.imagePath,georeference:new Ce({extent:new oe(Pe)}),autoplay:!1}),this.videoElement.content?.loop&&(this.videoElement.content.loop=!1);let n=new ue({source:this.videoElement,title:this.layer?.title,copyright:this.layer?.copyright});this.videoLayer=n,n&&this.videoMapView.map.layers.add(n),this.videoViewModel=new ut({oiViewModel:this})}async getMapPoint(e,t){let n=await this._transformationService.pixelToMapPoint(Array.isArray(e)?e:[e],t);return Array.isArray(e)?n:n[0]}async getMapPointForFeature(e,t,n){let r=await this._transformationService.pixelToMapPointForFeature(Array.isArray(e)?e:[e],t,n);return Array.isArray(e)?r:r[0]}async loadPanoramicMediaSource(e,t){let{lookAt:n,...r}=e,i=Xe(r);try{await i.load(t)}catch(e){if(_(e))return;if(e.name===`unsupported-format`){this.setMessage(`unsupportedPanoramicImageryError`,`error`,void 0,{datasetFormat:i?.extension??`UNKNOWN FORMAT`});return}}let a=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer;await a.loadMedia(i,t),n&&a.set(n)}async loadMediaSource(e,t){let n=Ze(e);await this._setImageSource(this.triangularMeasurementActive?this.imageMeasurementViewer:this._imageViewer,n,t)}_clearFeatureGeometries(){this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll()}_checkFeatures(e){return e?.length?!0:(this.emit(`no-image-found`),this.setMessage(`noImageError`,`error`),this.videoElement?.content?.pause(),this.currentBestFeature=null,!1)}async _getElevationSampleFromGround(e,t,n){if(!e[0])return;let{unionExecuteMany:r}=await import(`../../geometry/operators/unionOperator.js`),i=r(e);if(this._updateFootprintWithFeatures(t,i),this.view?.type===`3d`)try{return await this.view.map.ground.createElevationSampler(this.footprintExtent,n)}catch(e){if(_(e))throw e;d.getLogger(this).error(e);return}}async processElevationSample(e,t,n){let{elevationSource:r}=t[0].attributes,i=await this._getElevationSampleFromGround(e,t,n);if(this.view?.type===`3d`||i)return i;if(r&&this.footprintExtent&&ge(r))return await ve({extent:this.footprintExtent,lod:r.lod,url:r.url,rasterFunction:r.rasterFunction})}_processSuitableFeatures(e,t){return de({features:e,selectedPoint:t,camera:Qe(this.view)?this.view.camera:null,currentImage:this.currentBestFeature})}async _processHitTestResults(e,t,n){let{results:[r]}=t;if(r?.type!==`graphic`){this.beforeLoad(!1),this.emit(`no-image-found`),this.setMessage(`noImageError`,`error`);return}let i=r.graphic.getAttribute(e.objectIdField);return await this.showImageByObjectId(i,n)}async _queryAndLoadByObjectId(e,t,n,r,i){this.displayMessage=null;let{response:a}=await ft(e,t,n,r,i);if(v(i),!a?.features?.length)throw new dt(t);let{attributes:o}=a.features[0],s,c;if(o.orientedImageryType?.includes(`360`)){s=N(o.geometry);let{cameraHeading:e,farDistance:t,nearDistance:n}=o,r=[Math.sin(p(e)),Math.cos(p(e))],i=(t+n)/2;c=T(s.spatialReference),s.x+=i*r[0]/c,s.y+=i*r[1]/c,s.z=void 0}else{let e=await this.processFeatureElevation(a.features,o.geometry.clone(),i);v(i),await this._updateElevationOfSelectedPointAndLocations(a.features,o.geometry.clone(),e??void 0,i),v(i);let t=W(o).polygon,n=D.fromJSON(ce(t));s=N(n),c=T(s.spatialReference)}this.selectedPoint=s;let l={layerInstanceOrURL:e,point:s,queryParams:{where:w(w(`1=1`,w(e.definitionExpression,n)),`${e.objectIdField} <> ${t}`),maximumDistance:e.maximumDistance?e.maximumDistance/c:void 0,timeExtent:r}},u=await M(l,i);v(i);let{features:d}=u;return d.push(a.features[0]),await this.processFeatureResponse(u,s,{...i,loadBestImage:!1})}_reorderTriangularSketchLayer(){let e=this.imageMeasurementViewer.imageRenderer.map.layers?.length;this.sketchTriangularGraphicsLayer&&e&&this.imageMeasurementViewer.imageRenderer.map.layers.reorder(this.sketchTriangularGraphicsLayer,e-1)}async _setImageSource(e,t,n){e.media=t,await e.loadMedia(t,n)}async _restoreNavigationViewState(e,t){let n=e?.center?await this._transformationService.pointToPixel(e.center,t):null;if(v(t),this.mode===`panoramic`){let t=X(this._panoramicViewer.media);if(!t)return;bt({viewState:e,panoramicViewer:this._panoramicViewer,horizonAngles:t,imageCenter:n})}xt({viewState:e,imageViewer:this._imageViewer,imageCenter:n})}_toggleVisiblity(e,t){e.forEach(e=>{e.visible=t})}async _updateElevationOfSelectedPointAndLocations(e,t,n,r){let{cameraHeight:i}=e[0].attributes,a=e[0].attributes.location,o=await F(a.spatialReference,a.z,i,{elevationSample:n,elevationSource:this.view?.type===`3d`||n?void 0:e[0].attributes.elevationSource,extent:this.footprintExtent},r);v(r);let[s,...c]=await _e([t,...e.map(e=>e.attributes.geometry.clone())],o);v(r),t.elevation=s.z,e.forEach((e,t)=>{e.attributes.elevation=c[t].z;let n=this.pointSources.find(t=>t.imageID===e.attributes.objectId);n&&(n.z=e.attributes.location.z)})}_updateFeatures(e,t=!0){e.length?(this.features.removeAll(),this.features.addMany(e),this.navigationNodes.removeAll(),this.navigationNodes.addMany(e.map(e=>{let{geometry:t,attributes:n}=e,{isSpherical:r,cameraHeading:i,cameraPitch:a}=n;return new lt({geometry:t,attributes:n,currentHeading:r?0:i,currentPitch:r?0:a})})),e.length>1?this.additionalFeatures.addMany(e.slice(1)):this.additionalFeatures.removeAll(),t&&(this.currentBestFeature=e[0])):(this.currentBestFeature=null,this.additionalFeatures.removeAll())}_updateFootprintWithFeatures(e,t){let n=[];for(let{attributes:{geometry:r}}of e)t.contains(r)||n.push([r.x,r.y]);n.sort((e,t)=>+le([e,t])),t.addRing(n),this.footprintExtent=Oe(t.extent,2,2)}_scheduleVideoInteractionUpdate(){this.scheduledFrameId||=requestAnimationFrame(()=>{this.scheduledFrameId=null,this._updateInteraction()})}async _updatePointsAndPolygons(e){let{pointSources:n,currentBestFeature:r,currentCoverageVisible:i,isAdditionalPointSourcesVisible:a,mode:o,layer:s}=this;if(r&&(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(let o of n){let n=this.view&&!this.view.spatialReference?.equals(o.spatialReference)?await O(o.clone(),this.view?.spatialReference,e):o.clone();o.imageID===r.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:o.imageID},geometry:n,symbol:He,visible:i}):this.additionalCameraLocations.push(new t({attributes:{imageID:o.imageID},geometry:n,symbol:Ue,visible:a}))}(o===`video`||o===`panoramic-video`)&&(await this.initializeTransformationService(e),s&&!this.videoFeatureIndex.length&&await this.updateFeatureCache(s),this.cacheHydratedVideoFeature(r))}}_scheduleCurrentBestFeatureUpdate(e){h(this._navigationViewStateTask);let t=i(async t=>{await this._updateCurrentBestFeature(e,{signal:t})});this._navigationViewStateTask=t,t.promise.catch(e=>{if(!_(e))throw e}).finally(()=>{this._navigationViewStateTask===t&&(this._navigationViewStateTask=null)})}async _updateCurrentBestFeature(e,t){if(!e)return;if(await this._capturePendingNavigationViewState(t),v(t),this.currentBestFeature=this.features?.at(e.featureIndex),this.mode===`video`){this.currentBestFeature&&this.videoViewModel?.playVideoFromSelectedLocation(this.currentBestFeature);return}if(this.mode===`panoramic-video`){this.currentBestFeature&&this._panoramicVideoViewer.viewModel.playPanoramicVideoFromSelectedLocation(this.currentBestFeature);return}let n=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5,r;if(n)r=-90;else{let t=e.x-U[3],n=e.y-U[3],i=n/Math.sqrt(t**2+n**2),a=Math.acos(i)*180/Math.PI;(t<0&&n<0||t<0&&n>0)&&(a*=-1),r=a}r===this.bestFeatureAngle?this.previousFeatureAngle=r:this.bestFeatureAngle=r,this.navigatorCurrentBestFeature=n?null:{x:e.x,y:e.y,direction:e.sector.includes(`_`)?e.sector.split(`_`)[1]:e.sector},this.mode===`panoramic`&&(await b(()=>this.state===`image-loaded`,t),v(t),await this.restorePendingPanoramicNavigationViewState(t))}async _capturePendingNavigationViewState(e){this.mode==="default"?await this._capturePendingDefaultNavigationViewState(e):this.mode===`panoramic`&&await this._capturePendingPanoramicNavigationViewState(e)}async _capturePendingDefaultNavigationViewState(e){try{let{imageSize:t,imageRenderer:n}=this._imageViewer,r=n.center;if(this.state!==`image-loaded`||!t[0]||!t[1]||!r){this._pendingDefaultNavigationViewState=null;return}let i=yt(r,`default`,t),a=await this._getMapPointInViewSpatialReference(i,e);v(e),this._pendingDefaultNavigationViewState={center:a,scale:n.scale}}catch(e){this._handlePendingNavigationViewStateCaptureError(e)}}async _capturePendingPanoramicNavigationViewState(e){let t=X(this._panoramicViewer.media);if(t)try{let{fov:n,imageSize:r,pitch:i,yaw:a}=this._panoramicViewer;if(this.state!==`image-loaded`||!r||!n){this._pendingPanoramicNavigationViewState=null;return}let[o,s]=xe(a,i,t),c=Se(o,s,r[0],r[1]),l=await this._getMapPointInViewSpatialReference(c,e);v(e),this._pendingPanoramicNavigationViewState={center:l,fov:n}}catch(e){this._handlePendingNavigationViewStateCaptureError(e)}}_handlePendingNavigationViewStateCaptureError(e){if(_(e))throw e;d.getLogger(this).warn(`oriented-imagery-viewer:failed-to-capture-navigation-view-state`,e)}_updateImageMeasurementBestFeature(e){e&&(this.currentBestFeatureMeasurementImage=this.features?.at(e.featureIndex))}clearGraphics(){this._imageViewer.clearGraphics(),this._panoramicViewer.clearGraphics(),this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics()}clearReferencePointOnImage(){this._referencePointOnImage&&=(this._imageViewer.removeGraphic(this._referencePointOnImage),this._panoramicViewer.removeGraphic(this._referencePointOnImage),this._panoramicVideoViewer.removeGraphic(this._referencePointOnImage),m(this._referencePointOnImage)),this.videoViewModel?.clearReferencePointOnVideo()}async initializeReferenceTransformationService(e){let{currentBestFeatureMeasurementImage:t,activeTriangulatedViewer:n,mode:r}=this;if(!t||!n||!n.imageSize||r!==`panoramic`&&r!=="default")return;let{imageSize:i}=n,{attributes:a,elevationSample:o}=t,{cameraHeight:s,elevationSource:c}=a,l=a.location;l.spatialReference.isGeographic&&(l=N(l));let u={...r==="default"?I(a,i[0],i[1]):K(a,i[0],i[1]),cameraLocation:l},d=await F(l.spatialReference,l.z??0,s,{elevationSample:o,elevationSource:this.view?.type===`3d`?void 0:c,extent:this.footprintExtent},e),f=(await import(`./services/TransformationService.js`)).default,p={imageToWorldProperties:u,updateElevationProps:d,mode:r,imageSize:i,depthImageService:this.depthImage};this._referenceTransformationService=new f(p),this._locationViewModel&&(this._locationViewModel.referenceTransformationService=this._referenceTransformationService),this._measurementService&&(this._measurementService.referenceTransformationService=this._referenceTransformationService)}async initializeTransformationService(e){let{currentBestFeature:t,activeViewer:n,mode:r}=this,i=r===`video`||r===`panoramic-video`?z:n?.imageSize;if(!t||!i||r===`none`)return;let{attributes:a,elevationSample:o}=t,{cameraHeight:s,elevationSource:c}=a,l=a.location;l.spatialReference.isGeographic&&(l=N(l));let u=r==="default"||r===`video`?`default`:`panoramic`,d={...u==="default"?I(a,i[0],i[1]):K(a,i[0],i[1]),cameraLocation:l},f=await F(l.spatialReference,l.z??0,s,{elevationSample:o,elevationSource:this.view?.type===`3d`?void 0:c,extent:this.footprintExtent},e),p=(await import(`./services/TransformationService.js`)).default,m={imageToWorldProperties:d,updateElevationProps:f,mode:u,imageSize:i,depthImageService:this.depthImage};this._transformationService=new p(m),this._measurementService&&(this._measurementService.transformationService=this._transformationService)}plotReferencePoint(e){`mapPoint`in e?this.plotReferencePointOnGround(e.mapPoint):this.plotReferencePointOnGround(e)}clearSelectedPointOnViewer(){this._crossSymbol?this.mode===`video`?(this.videoViewModel?.clearSelectedPointOnVideo(),this._crossSymbol=null):(this._panoramicViewer.removeGraphic(this._crossSymbol),this._imageViewer.removeGraphic(this._crossSymbol),this.videoMapView.graphics.remove(this._crossSymbol),this._crossSymbol=m(this._crossSymbol)):this.videoViewModel?.clearSelectedPointOnVideo()}setMessage(e,t,n,r){this.displayMessage={key:e,type:t,data:n,map:r}}async transformAndPlotSelectedLocation(e){let{invalidCameraHeading:t,selectedPoint:n,activeViewer:r,videoElement:i}=this,a=this.mode===`video`?this.videoViewModel?.closestFeature??this.currentBestFeature:this.currentBestFeature;this.clearSelectedPointOnViewer();let o=this.mode===`video`?i?.loaded===!0&&this.videoViewModel?.videoPaused===!0:r?.state===`image-loaded`;if(!n||!a||!o||t||this.mode===`video`&&!await ot(n,this.bestFeatureCurrentFootprint?.geometry,e))return;let s;try{if(s=this.mode===`video`?await this.getPixelLocationForFeature(n,{feature:a,mode:this.mode,imageSize:z,footprintExtent:this.footprintExtent},e):await this._transformationService.pointToPixel(n,{signal:e?.signal}),this.mode===`video`&&!st(s))return;v(e),await this.plotSelectedPointOnImage(s,e)}catch(e){_(e)||d.getLogger(this).error(`failed to transform map point to pixel, cross symbol will not be plotted on image`,{error:e,selectedPoint:n,feature:a})}}updateCurrentCoveragePolygon(e){let{additionalFootprints:n,additionalCameraLocations:r,currentBestFeature:i,currentBestFeatureLocation:a,currentCoverageVisible:o,selectedPoint:s,view:c}=this;if(!i)return;let{attributes:{objectId:l}}=i;if(this._initialCurrentCoverageUpdate){if(this._overlays?.removeAll(),this._initialCurrentCoverageUpdate=!1,this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=o,this.bestFeatureCurrentFootprint=e),c){let e=[...n,...r,a].filter($e);s&&(this.bestFeatureCurrentFootprint&&e.splice(-2,0,this.bestFeatureCurrentFootprint),e.push(new t({geometry:s.clone(),symbol:q.clone(),attributes:{imageID:l}}))),this._overlays.graphics.addMany(e)}}else if(c){if(this.invalidCameraHeading){this._superimposeService.clear();return}this.bestFeatureCurrentFootprint&&=(this._overlays?.remove(this.bestFeatureCurrentFootprint),m(this.bestFeatureCurrentFootprint));let t=this.bestFeatureCurrentFootprint&&this._overlays?this._overlays.graphics.indexOf(this.bestFeatureCurrentFootprint):-1;e&&(this.bestFeatureCurrentFootprint=e,e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}_updateSuperimposedImage(){if(!this._hasActiveSuperimposeCameraContext())return;let e=this.mode===`panoramic`?this._panoramicViewer:null,{currentBestFeature:t,defaultSuperimposeCameraLockEnabled:n,layer:r,mode:i,view:a,state:o,superimposeViewEnabled:s,superimposeViewSupported:c,activeViewer:l,depthImage:u}=this,d=this.coverageFrustums.find(({imageID:e})=>e===t?.attributes.objectId);this._superimposeService.update({activeImageSize:l?.imageSize||void 0,adapter:this._adapter,currentBestFeature:t,currentBestFeatureFrustum:d,defaultSuperimposeCameraLockEnabled:n,depthImageLoaded:u?.loaded??!1,layer:r,mode:i,panoramicCamera:e?.camera,state:o,superimposeViewEnabled:s&&c,view:a}),this.setMessage(`superimposeImageDescription`,`info`),this._superimposePreviousCurrentCoverageVisible??=this.currentCoverageVisible,this.currentCoverageVisible=!1}_getSuperimposeCameraWatchState(){let e=(this.view?.type===`3d`?this.view:null)?.camera;return[this.superimposeViewEnabled,this.superimposeViewSupported,this.mode,this.state,this.view?.type,this.view?.interacting,this.view?.navigating,e?.heading,e?.tilt,e?.fov,e?.position.x,e?.position.y,e?.position.z]}_handleSuperimposeCameraChange(){let e=this.view,t=e?.type===`3d`?e:null;this._hasActiveSuperimposeCameraContext()?this.mode===`panoramic`?this._schedulePanoramicSuperimposeUpdate():!t||t.interacting||t.navigating?this._abortSuperimposeSchedule():this._scheduleDefaultSuperimposeUpdate():this._abortSuperimposeSchedule()}_shouldDisableUnsupportedSuperimposeView(){return this.superimposeViewEnabled&&this.mode===`panoramic`&&!this.superimposeViewSupported}_hasActiveSuperimposeCameraContext(){return(this.mode==="default"||this.mode===`panoramic`)&&this.superimposeViewEnabled&&this.superimposeViewSupported&&this.state===`image-loaded`&&this.view?.type===`3d`&&!!this.view.camera}_abortSuperimposeSchedule(){this._superimposeScheduleController?.abort(),this._superimposeScheduleController=null,this._clearSuperimposeDebounceTimeout(),this._clearSuperimposeScheduledFrame()}_resetInactiveSuperimposeState(){let e=this._superimposePreviousCurrentCoverageVisible!=null;this._abortSuperimposeSchedule(),this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),this._superimposeService.clear(),this._restoreCurrentCoverageVisibilityAfterSuperimpose(),this._restoreDefaultMessageAfterSuperimpose(),e&&this._restoreViewerMediaAfterSuperimpose()}_restoreCurrentCoverageVisibilityAfterSuperimpose(){this._superimposePreviousCurrentCoverageVisible!=null&&(this.currentCoverageVisible=this._superimposePreviousCurrentCoverageVisible,this._superimposePreviousCurrentCoverageVisible=null)}_restoreViewerMediaAfterSuperimpose(){let{currentBestFeature:e,mode:t}=this;if(!e||t!=="default"&&t!==`panoramic`)return;this._restoreSuperimposeMediaTask?.abort();let n=i(async t=>{await this._loadCurrentFeatureMedia(e,{signal:t})});this._restoreSuperimposeMediaTask=n,n.promise.finally(()=>{this._restoreSuperimposeMediaTask===n&&(this._restoreSuperimposeMediaTask=null)})}_restoreDefaultMessageAfterSuperimpose(){this.displayMessage?.key===`superimposeImageDescription`&&(this.currentBestFeature&&(this.mode==="default"||this.mode===`panoramic`)?this.displayMessage=null:this.setMessage(`onLoadMessage`,`info`))}_clearSuperimposeDebounceTimeout(){this.superimposeDebounceTimeoutId!=null&&(clearTimeout(this.superimposeDebounceTimeoutId),this.superimposeDebounceTimeoutId=null)}_clearSuperimposeScheduledFrame(){this.superimposeScheduledFrameId!=null&&(cancelAnimationFrame(this.superimposeScheduledFrameId),this.superimposeScheduledFrameId=null)}_schedulePanoramicSuperimposeUpdate(){this._abortSuperimposeSchedule(),this.superimposeDebounceTimeoutId=window.setTimeout(()=>{this.superimposeDebounceTimeoutId=null,this._hasActiveSuperimposeCameraContext()&&this.mode===`panoramic`&&this._updateSuperimposedImage()},150)}_scheduleDefaultSuperimposeUpdate(){let e=this.view;if(!(e?.type===`3d`&&e)||this.superimposeScheduledFrameId)return;this._superimposeScheduleController?.abort();let t=new AbortController,{signal:n}=t,r=()=>{this._clearSuperimposeDebounceTimeout(),this._clearSuperimposeScheduledFrame(),this._superimposeScheduleController===t&&(this._superimposeScheduleController=null),n.removeEventListener(`abort`,r)};this._superimposeScheduleController=t,n.addEventListener(`abort`,r),this.superimposeScheduledFrameId=requestAnimationFrame(()=>{if(n.removeEventListener(`abort`,r),this.superimposeScheduledFrameId=null,this._superimposeScheduleController===t&&(this._superimposeScheduleController=null),n.aborted)return;let e=this.view,i=e?.type===`3d`?e:null;this._hasActiveSuperimposeCameraContext()&&i!=null&&!i.interacting&&!i.navigating&&this._updateSuperimposedImage()})}};e([E()],$.prototype,`activeLayer`,null),e([E({readOnly:!0})],$.prototype,`activeViewer`,null),e([E()],$.prototype,`activeTriangulatedViewer`,null),e([E()],$.prototype,`accuracyParametersMissing`,null),e([E()],$.prototype,`additionalFeatures`,void 0),e([E({type:a.ofType(t)})],$.prototype,`additionalCameraLocations`,void 0),e([E({type:a.ofType(t)})],$.prototype,`additionalFootprints`,void 0),e([E()],$.prototype,`areaMeasurementResult`,void 0),e([E()],$.prototype,`areaMeasurementAccuracy`,void 0),e([E()],$.prototype,`bestFeatureAngle`,void 0),e([E()],$.prototype,`bestFeatureCurrentFootprint`,void 0),e([E({type:t})],$.prototype,`bestFeatureFootprint`,void 0),e([E({type:Number})],$.prototype,`brightness`,null),e([E()],$.prototype,`cameraHeadingThreshold`,void 0),e([E()],$.prototype,`cameraPitchThreshold`,void 0),e([E()],$.prototype,`clickAction`,void 0),e([E()],$.prototype,`correctedLocationPointOnImage`,void 0),e([E()],$.prototype,`videoViewModel`,void 0),e([E()],$.prototype,`collectionId`,void 0),e([E({type:Number})],$.prototype,`contrast`,null),e([E()],$.prototype,`coverageFrustums`,void 0),e([E()],$.prototype,`coveragePolygons`,void 0),e([E()],$.prototype,`currentBestFeature`,void 0),e([E()],$.prototype,`currentBestFeatureMeasurementImage`,void 0),e([E()],$.prototype,`currentBestFeatureLocation`,void 0),e([E()],$.prototype,`currentCoverageVisible`,void 0),e([E()],$.prototype,`currentNode`,null),e([E()],$.prototype,`depthImage`,void 0),e([E()],$.prototype,`depthImageNotSupported`,null),e([E()],$.prototype,`featureCache`,void 0),e([E()],$.prototype,`videoFeatureIndex`,void 0),e([E()],$.prototype,`navigationNodes`,void 0),e([E({json:{write:!1}})],$.prototype,`determineWorkflowForFeature`,void 0),e([E({json:{write:!1}})],$.prototype,`determineWorkflowForTriangularMeasurement`,void 0),e([E()],$.prototype,`disabled`,void 0),e([E()],$.prototype,`displayMessage`,void 0),e([E()],$.prototype,`displayNewMeasurementButton`,void 0),e([E()],$.prototype,`distanceMeasurementResult`,void 0),e([E()],$.prototype,`distanceAccuracyArray`,void 0),e([E()],$.prototype,`dataCaptureLayer`,void 0),e([E({readOnly:!0})],$.prototype,`featureCount`,null),e([E()],$.prototype,`features`,void 0),e([E()],$.prototype,`groundCoordinates`,void 0),e([E()],$.prototype,`groundCoordinatesAccuracy`,void 0),e([E()],$.prototype,`groundCoordinatesAccuracyLoading`,void 0),e([E()],$.prototype,`hasPendingPanoramicNavigationViewState`,null),e([E()],$.prototype,`heightGraphic`,void 0),e([E()],$.prototype,`heightMeasurementResult`,void 0),e([E()],$.prototype,`heightMeasurementAccuracy`,void 0),e([E({readOnly:!0})],$.prototype,`imageGalleryEnabled`,null),e([E()],$.prototype,`imageGeometryField`,void 0),e([E({readOnly:!0})],$.prototype,`imageLoaded`,null),e([E()],$.prototype,`imageLocationToolState`,void 0),e([E()],$.prototype,`initialVideoMapViewExtent`,void 0),e([E({readOnly:!0})],$.prototype,`invalidCameraHeading`,null),e([E()],$.prototype,`imagePointsInView`,null),e([E()],$.prototype,`imageMeasurementViewer`,void 0),e([E()],$.prototype,`isAdditionalCoverageVisible`,void 0),e([E()],$.prototype,`isAdditionalPointSourcesVisible`,void 0),e([E()],$.prototype,`layer`,void 0),e([E()],$.prototype,`layerView`,null),e([E({readOnly:!0})],$.prototype,`layerFloorFilterClause`,null),e([E({readOnly:!0})],$.prototype,`layerTimeExtent`,null),e([E({type:Number})],$.prototype,`localPort`,void 0),e([E()],$.prototype,`locationPointOnImage`,void 0),e([E()],$.prototype,`mapImageConversionToolState`,void 0),e([E()],$.prototype,`measureType`,void 0),e([E()],$.prototype,`measurementGraphic`,void 0),e([E({readOnly:!0,value:`none`})],$.prototype,`mode`,null),e([E()],$.prototype,`navigationMode`,void 0),e([E()],$.prototype,`navigatorCurrentBestFeature`,void 0),e([E()],$.prototype,`oiObjectIdField`,void 0),e([E({type:a.ofType(t)})],$.prototype,`overlayedCameraLocations`,void 0),e([E()],$.prototype,`overlayedMapFeatures`,void 0),e([E()],$.prototype,`panoramicVideoLoaded`,null),e([E()],$.prototype,`panoramicVideoPaused`,null),e([E()],$.prototype,`pixelCoordinates`,void 0),e([E()],$.prototype,`preserveAngle`,void 0),e([E()],$.prototype,`pointSources`,void 0),e([E({readOnly:!0})],$.prototype,`popupEnabled`,null),e([E()],$.prototype,`preloadMedia`,void 0),e([E()],$.prototype,`preloadMediaSize`,void 0),e([E()],$.prototype,`previousFeatureAngle`,void 0),e([E()],$.prototype,`referencePoint`,null),e([E({readOnly:!0})],$.prototype,`sectorData`,null),e([E()],$.prototype,`selectedPoint`,void 0),e([E({type:Number})],$.prototype,`sharpness`,null),e([E()],$.prototype,`shouldShowSelectedImage`,void 0),e([E()],$.prototype,`superimposeViewEnabled`,void 0),e([E()],$.prototype,`defaultSuperimposeCameraLockEnabled`,void 0),e([E()],$.prototype,`superimposeViewSupported`,null),e([E()],$.prototype,`sketch`,void 0),e([E()],$.prototype,`sketchTriangular`,void 0),e([E()],$.prototype,`sketchTriangularGraphicsLayer`,void 0),e([E()],$.prototype,`draw`,void 0),e([E()],$.prototype,`drawAdapter`,void 0),e([E()],$.prototype,`polylineDrawAction`,void 0),e([E()],$.prototype,`scheduledFrameId`,void 0),e([E()],$.prototype,`superimposeScheduledFrameId`,void 0),e([E()],$.prototype,`superimposeDebounceTimeoutId`,void 0),e([E()],$.prototype,`sketchAdapter`,void 0),e([E({readOnly:!0})],$.prototype,`sketchGraphicsLayer`,null),e([E({readOnly:!0})],$.prototype,`state`,null),e([E({readOnly:!0})],$.prototype,`thumbnails`,null),e([E()],$.prototype,`videoExtentPoints`,null),e([E()],$.prototype,`triangularMeasurementActive`,void 0),e([E()],$.prototype,`triangulatedDistanceMeasurement`,void 0),e([E()],$.prototype,`triangulatedDistanceAccuracy`,void 0),e([E()],$.prototype,`triangulatedAreaMeasurement`,void 0),e([E()],$.prototype,`triangulatedAreaAccuracy`,void 0),e([E()],$.prototype,`triangulatedMeasurementGraphic`,void 0),e([E()],$.prototype,`triangulatedPoint`,void 0),e([E()],$.prototype,`triangulatedMeasurementAdapter`,void 0),e([E()],$.prototype,`updateFootprint`,void 0),e([E()],$.prototype,`updateVideoFootprint`,void 0),e([E()],$.prototype,`updateFootprintPanorama`,void 0),e([E()],$.prototype,`updatingTriangularMeasurementState`,void 0),e([E({value:null})],$.prototype,`view`,null),e([E()],$.prototype,`videoElement`,void 0),e([E()],$.prototype,`videoLayer`,void 0),e([E()],$.prototype,`videoMapView`,void 0),e([E()],$.prototype,`verticalFilterEnabled`,void 0),e([E()],$.prototype,`frustumSearchEnabled`,void 0),e([E()],$.prototype,`_adapter`,void 0),e([E()],$.prototype,`_defaultGraphicsLayer`,null),e([E()],$.prototype,`_highlightedFeatureHandle`,void 0),e([E()],$.prototype,`_imageViewer`,void 0),e([E()],$.prototype,`_initialCurrentCoverageUpdate`,void 0),e([E()],$.prototype,`_locationViewModel`,void 0),e([E()],$.prototype,`_measurementService`,void 0),e([E()],$.prototype,`_mediaPrefetcher`,void 0),e([E()],$.prototype,`_navigationManager`,void 0),e([E()],$.prototype,`_overlays`,void 0),e([E()],$.prototype,`_superimposePreviousCurrentCoverageVisible`,void 0),e([E()],$.prototype,`_superimposeService`,void 0),e([E({readOnly:!0})],$.prototype,`_overlaysView`,null),e([E()],$.prototype,`_panoramicVideoViewer`,void 0),e([E()],$.prototype,`_panoramicViewer`,void 0),e([E()],$.prototype,`_panoramicMeasurementViewer`,void 0),e([E()],$.prototype,`_referencePointOnGround`,void 0),e([E()],$.prototype,`_referencePointOnImage`,void 0),e([E()],$.prototype,`_referenceTransformationService`,void 0),e([E()],$.prototype,`_sectorData`,void 0),e([E()],$.prototype,`_transformationService`,void 0),e([E()],$.prototype,`_featureToSector`,void 0),e([E({readOnly:!0})],$.prototype,`_updatingHandles`,void 0),e([E()],$.prototype,`footprintExtent`,void 0),e([E()],$.prototype,`_featureChangedTask`,void 0),$=e([re(`esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel`)],$);const Tt=$;export{Tt as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{equals as n,isSome as r}from"../../core/arrayUtils.js";import{createTask as i}from"../../core/asyncUtils.js";import a from"../../core/Collection.js";import{deprecatedProperty as o}from"../../core/deprecate.js";import s from"../../core/Error.js";import{EventedMixin as c}from"../../core/Evented.js";import{makeHandle as l}from"../../core/handleUtils.js";import{equalsShallow as u}from"../../core/lang.js";import d from"../../core/Logger.js";import{clamp as f,deg2rad as p}from"../../core/mathUtils.js";import{destroyMaybe as m,abortMaybe as h}from"../../core/maybe.js";import{EsriPromise as g}from"../../core/Promise.js";import{isAbortError as _,throwIfAborted as v,waitTick as y}from"../../core/promiseUtils.js";import ee from"../../core/ReactiveMap.js";import{whenOnce as b,on as x,watch as S,syncAndInitial as C,initial as te,when as ne}from"../../core/reactiveUtils.js";import{sqlAnd as w}from"../../core/sql.js";import{getMetersPerUnitForSR as T}from"../../core/units.js";import{property as E,subclass as re}from"../../core/accessorSupport/decorators.js";import{isSerializable as ie}from"../../core/support/jsonUtils.js";import{UpdatingHandles as ae}from"../../core/support/UpdatingHandles.js";import oe from"../../geometry/Extent.js";import D from"../../geometry/Point.js";import{projectAsync as O}from"../../geometry/projectionUtils.js";import se from"../../geometry/SpatialReference.js";import{polygonCentroidPoint as ce}from"../../geometry/support/centroid.js";import{isClockwise as le}from"../../geometry/support/coordsUtils.js";import{normalizeMapX as ue}from"../../geometry/support/normalizeUtils.js";import{geographicToWebMercator as de}from"../../geometry/support/webMercatorUtils.js";import k from"../../layers/GraphicsLayer.js";import fe from"../../layers/MediaLayer.js";import{searchImages as A}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as pe}from"../../layers/orientedImagery/core/bestImageUtils.js";import{computePolygonForInspection as me,resizePolygon as he,checkIfFrustumContainsSelectedPoint as ge,checkIfPolygonContainsSelectedPoint as _e}from"../../layers/orientedImagery/core/coverageUtils.js";import{isElevationSource as ve}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{convertGeographicToWebMercator as j}from"../../layers/orientedImagery/core/utils.js";import ye from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as be}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{or as xe,getInitialAngle as M,convertPixelLocationToSphereVertex as Se,getUpdateElevationProps as N,adjustHorizonAngles as Ce,convertOrientationToPixelLocation as we,getImageToWorldProperties as P}from"../../layers/orientedImagery/transformations/utils.js";import Te from"../../layers/support/ExtentAndRotationGeoreference.js";import{getFloorFilterClause as Ee}from"../../layers/support/floorFilterUtils.js";import De from"../../layers/support/VideoElement.js";import Oe from"../../views/MapView.js";import ke from"../../views/draw/Draw.js";import{scale as Ae}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as je}from"../../views/input/InputManager.js";import Me from"../PanoramicVideoViewer.js";import F from"../PanoramicViewer.js";import{defaultAngleThresholdInDegrees as I,videoMapViewConstraint as Ne,fixedImageSize as L,clockwiseDirections as Pe,videoFitScaleTolerance as Fe,videoExtent as Ie,invalidCameraHeading as R,sectorsInOrder as z,sampleExtent as Le,sectorsRadii as B}from"./constants.js";import{createFeatureCoverage as V}from"./featureCoverage.js";import{isFeatureAttachment as H}from"./galleryUtils.js";import{getPanoramicImageProperties as U}from"./panoramicImageProperties.js";import{crossSymbol as W,crossSymbol3D as Re,measurementPolygonSymbol as ze,polylineSymbolPanoramic as Be,measurementPolylineSymbol as Ve,cameraOverlaySymbol3D as He,cameraOverlaySymbol as Ue,diamondSymbol as G,diamondSymbol3D as K,activeSourcePointSymbol as We,sourcePointSymbol as Ge}from"./symbols.js";import{registryKeys as q}from"./types.js";import{isNoAttachmentError as Ke,extractHorizonAnglesFromMedia as J,isDepthImage as qe,isTifOrMrf as Y,filterOILLayerView as Je,assignElevationSampleToFeatures as Ye,filterByZ as Xe,createPanoramicMedia as Ze,createNonPanoramicMedia as Qe,isSceneView as $e,isGraphic as et,calculateSegment as tt,calculateDirection as nt}from"./utils.js";import{disableVideoZoomAndPan as rt,getUpdatedConstraints as it,getUpdatedExtentPoints as at,normalizeVideoSource as X,isSelectedPointWithinVideoFootprint as ot,isVideoPixelWithinFrame as st}from"./videoViewerUtils.js";import ct from"./components/ImageViewer.js";import lt from"./components/NavigationNode.js";import ut from"./components/OrientedImageryVideoViewModel.js";import{NoFeatureFoundWithObjectIdError as dt}from"./navigation/errors.js";import{queryFeatureByObjectIds as ft}from"./navigation/queries.js";import{ImageMeasurementService as pt}from"./services/ImageMeasurementService.js";import mt from"./services/SuperimposeService.js";import{configureSketchTool as ht,extractFieldsFromDataCaptureLayer as gt,constructGraphicFromImageGeometry as _t}from"./support/dataCaptureUtils.js";import{removeZFromGeometry as vt,imageSpaceToPoint as Z,pointToImageSpace as yt}from"./support/geometryUtils.js";import{restorePanoramicNavigationViewState as bt,restoreDefaultNavigationViewState as xt}from"./support/navigationViewStateUtils.js";import St from"./support/resolveMediaProps.js";import{isValidDataCaptureLayer as Ct}from"./support/typeUtils.js";import wt from"./support/VideoFeatureCache.js";const Q=()=>new s(`orientedimageryviewer:sketch-not-initialized`,`Sketch property is not initialized, call loadSketch first`);let $=class extends c(g){constructor(e){super(e),this.additionalFeatures=new a,this.additionalCameraLocations=new a,this.additionalFootprints=new a,this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.bestFeatureAngle=0,this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null,this.cameraHeadingThreshold=I,this.cameraPitchThreshold=I,this.clickAction=`hittest`,this.correctedLocationPointOnImage=null,this.videoViewModel=null,this.collectionId=null,this.coverageFrustums=new a,this.coveragePolygons=new a,this.currentBestFeature=null,this.currentBestFeatureMeasurementImage=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.depthImage=null,this.featureCache=[],this.videoFeatureIndex=[],this.navigationNodes=new a,this.determineWorkflowForFeature=async(e,t,n)=>{let{currentBestFeature:r,selectedPoint:i}=this;if(this.emit(`popup-close`),r&&i){this.displayMessage=null,this._initialCurrentCoverageUpdate=!0;try{await this._updatePointsAndPolygons(n),await this._loadDepthImage(n),await this._loadCurrentFeatureMedia(r,n)}catch(e){_(e)||(this.loadImageError(e),d.getLogger(this).error(`#loadIImage()`,`error occured while loading image`,e))}}},this.determineWorkflowForTriangularMeasurement=async(e,t,n)=>{if(this.emit(`popup-close`),this.currentBestFeatureMeasurementImage&&this.selectedPoint)try{await this._loadMeasurementViewerImage(n)}catch(e){_(e)||(this.loadImageError(e),d.getLogger(this).error(`#loadIImage()`,`error occured while loading image`,e))}},this.disabled=!1,this.displayMessage={key:`onLoadMessage`,type:`info`},this.displayNewMeasurementButton=!0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.dataCaptureLayer=null,this.features=new a,this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.groundCoordinatesAccuracyLoading=!1,this.heightGraphic=null,this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.imageGeometryField=null,this.imageLocationToolState=!1,this.initialVideoMapViewExtent=null,this.imageMeasurementViewer=new ct,this.isAdditionalCoverageVisible=!1,this.isAdditionalPointSourcesVisible=!1,this.layer=null,this.localPort=null,this.locationPointOnImage=null,this.mapImageConversionToolState=!1,this.measureType=null,this.measurementGraphic=null,this.navigatorCurrentBestFeature=null,this.oiObjectIdField=null,this.overlayedCameraLocations=new a,this.overlayedMapFeatures=new ee,this.pixelCoordinates=null,this.preserveAngle=`none`,this.pointSources=new a,this.preloadMedia=!1,this.preloadMediaSize=5,this.previousFeatureAngle=0,this.selectedPoint=null,this.shouldShowSelectedImage=!1,this.superimposeViewEnabled=!1,this.defaultSuperimposeCameraLockEnabled=!0,this.sketch=null,this.sketchTriangular=null,this.sketchTriangularGraphicsLayer=null,this.draw=null,this.drawAdapter=null,this.polylineDrawAction=null,this.scheduledFrameId=null,this.superimposeScheduledFrameId=null,this.superimposeDebounceTimeoutId=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,n)=>{(this.mode!=="default"||this.state===`image-loaded`)&&await this._adapter?.updateFootprint(e,t,n)},this.updateVideoFootprint=async e=>{this.mode.includes(`video`)&&this.videoElement?.content&&await this._adapter?.updateVideoFootprint(e)},this.updateFootprintPanorama=async(e,t)=>{await this._adapter?.updateFootprintPanorama(e,t)},this.updatingTriangularMeasurementState=!1,this.videoElement=null,this.videoLayer=null,this.videoMapView=new Oe({map:new Map,attributionVisible:!1,constraints:Ne}),this.verticalFilterEnabled=!1,this.frustumSearchEnabled=!1,this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new ct,this._initialCurrentCoverageUpdate=!0,this._locationViewModel=null,this._measurementService=null,this._mediaPrefetcher=null,this._navigationManager=null,this._overlays=new k({listMode:`hide`,internal:!0,elevationInfo:{mode:`absolute-height`},title:`OrentedImageryViewerViewModel overlays layer`}),this._superimposePreviousCurrentCoverageVisible=null,this._superimposeService=new mt({getMapPoint:(e,t)=>this.getMapPoint(e,t),getPanoramicTransformationState:()=>{let{imageToWorldProperties:e,mode:t,updateElevationProps:n}=this._transformationService;return t!==`panoramic`||!e?null:{imageToWorldProperties:e,updateElevationProps:n}},pointToPixel:(e,t)=>this._transformationService.pointToPixel(e,t),overlays:this._overlays,getPointAtDistance:(e,t,n)=>this._transformationService.pixelToPointAtDistance(e,t,n)}),this._panoramicVideoViewer=new Me,this._panoramicViewer=new F,this._panoramicMeasurementViewer=new F,this._referencePointOnGround=null,this._referencePointOnImage=null,this._referenceTransformationService=null,this._sectorData=null,this._transformationService=null,this._featureToSector=null,this._updatingHandles=new ae,this._clickTask=null,this._crossSymbol=null,this.footprintExtent=null,this._featureChangedTask=null,this._mediaPrefetchTask=null,this._navigationViewStateTask=null,this._pendingPanoramicNavigationViewState=null,this._restoreSuperimposeMediaTask=null,this._superimposeScheduleController=null,this._suitabilities=null,this._pendingDefaultNavigationViewState=null,this._transformController=new AbortController,this._updateFootprintTask=null,this._videoFeatureCache=new wt,this.addUpdatingPromise=e=>this._updatingHandles.addPromise(e),this.filterCapturedFeatures=e=>{let t=this.currentBestFeature?.attributes.objectId,n=this.layer?.imageReferenceField;t&&e&&n&&this.overlayedMapFeatures.get(e)?.forEach(e=>{let r=e.attributes??{},i=Object.keys(r).find(e=>e.toLowerCase()===n.toLowerCase());(i?r[i]:null)!==t&&(e.visible=!e.visible)})},this.hideImageGeometry=e=>{},this.highlight=e=>{if(!this._overlaysView)return;this.removeHighlight();let 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);let{default:t}=await import(`./adapters/sketch/DataCaptureAdapter.js`);return v(e),this.sketchAdapter=new t({viewModel:this}),this.sketchAdapter},this.loadImageFromFeature=(e,t,n)=>this._updatingHandles.addPromise(this._loadImageFromFeature(e,t,n)),this.storeImageMeasurementViewer=e=>{this.imageMeasurementViewer=e},this.storePanoramicMeasurementViewer=e=>{this._panoramicMeasurementViewer=e},this.loadImageViewer=e=>{this._imageViewer?.destroy(),this._imageViewer=e},this.loadPanoramicViewer=e=>{this._panoramicViewer?.destroy(),this._panoramicViewer=e},this.loadPanoramicVideoViewer=e=>{this._panoramicVideoViewer?.destroy(),this._panoramicVideoViewer=e},this.loadVideoViewer=e=>{this.videoMapView.container=e},this.showImageByObjectId=async(e,t)=>{let n=this.additionalFeatures.find(({attributes:t})=>t.objectId===e);if(n&&t?.selectedPoint==null)this.currentBestFeature=n;else{let{layer:n,layerFloorFilterClause:r,layerTimeExtent:i}=this;if(!n){this.setMessage(`noLayerSelected`,`info`);return}this.beforeLoad();let a=this._updatingHandles.addPromise(this._queryAndLoadByObjectId(n,e,r,i,t));try{await a,await this.selectBestFeature(e,t)}catch(t){_(t)||(d.getLogger(this).error(`oriented-imagery-viewer:show-image`,t),t.name===`NoFeatureFoundWithObjectIdError`?this.setMessage(`noFeatureFoundWithObjectId`,`error`,``,{objectId:e}):this.setMessage(`imageLoadError`,`error`,t.message))}}},this.getSectorFeatureById=e=>this._suitabilities?.find(({feature:{attributes:{objectId:t}}})=>t===e),this.getFeatureSectorById=e=>this._featureToSector?.[`${e}`],this.navigate=async(e,t)=>{let{mode:n}=this;if(n!=="default"&&n!==`panoramic`)throw new s(`NavigationError`,`Navigation is only supported in 'default' and 'panoramic' modes.`);if(this._pendingDefaultNavigationViewState=null,this._pendingPanoramicNavigationViewState=null,this._navigationManager==null||!(e=>n==="default"&&e.declaredClass.endsWith(`NavigationManager`)||n===`panoramic`&&e.declaredClass.endsWith(`NavigationManagerPanoramic`))(this._navigationManager)){m(this._navigationManager);let e=n==="default"?import(`./navigation/NavigationManager.js`):import(`./navigation/NavigationManagerPanoramic.js`);this._navigationManager=new(await e).default({viewModel:this})}return this._navigationManager.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}`),b(()=>{switch(this.mode){case`video`:return this.state===`video-loaded`;case`panoramic-video`:return this.panoramicVideoLoaded;default:return this.state===`image-loaded`}},t)),this.toggleImageAttributes=()=>{let{currentBestFeature:e,popupEnabled:n,layer:r,view:i}=this;if(this.emit(`popup-close`),!i||!e||!n||!r)return;let{attributes:a,geometry:o}=e,s=new t({geometry:o,attributes:a.toJSON(),origin:r.graphicOrigin,sourceLayer:r});this.emit(`popup-open`,{features:[s],location:a.location.clone()})},this.updateSuitabilities=(e,t=!0)=>{e.sort((e,t)=>e.suitability-t.suitability),this._suitabilities=e;let n=this._suitabilities.map(({feature:e})=>e);this._initialCurrentCoverageUpdate=!0,this._updateFeatures(n,t),this._groupFeaturesBySectors()},this._computeOverlayImageSize=()=>{let{mode:e}=this;return e===`video`?L:e===`panoramic-video`?this._panoramicVideoViewer.imageSize:this.activeViewer?.imageSize},this._geometryToOverlayImageGeometry=async(e,t,n)=>{let{mode:r,videoViewModel:i,_panoramicVideoViewer:a}=this;if(r===`video`)return await i?.geometryToOverlayGeometry(e,t)??null;if(r===`panoramic-video`){let i={feature:t,mode:r,imageSize:n,footprintExtent:this.footprintExtent};return await this._transformationService.geometryToImageGeometryForFeature(e,i,a.horizonAngles)}return await this._transformationService.geometryToImageGeometry(e)},this._createViewClickHandle=()=>{if(this.removeHandles(q.click),this.disabled||this.view==null)return;let e=this.mapImageConversionToolState&&(this.state===`image-loaded`||this.state===`video-loaded`&&this.mode===`video`&&this.videoViewModel?.videoPaused||this.panoramicVideoLoaded&&this.mode===`panoramic-video`&&this.panoramicVideoPaused)?this._mapImageConversionToolViewClickHandler:this._viewClickHandler;this.addHandles(this.view.on(`click`,e,je.DEFAULT),q.click)},this._createImageClickHandle=()=>{this.removeHandles(q.imageClick),this.videoViewModel?.syncMapImageConversionHandle();let{mapImageConversionToolState:e,mode:t,footprintExtent:n,panoramicVideoLoaded:r}=this,a=t===`panoramic-video`?this._panoramicVideoViewer:this.activeViewer,o=a?.imageSize;if(!e||t===`none`||t===`video`||!o||!n)return;let s=t===`panoramic-video`,c=this._getActiveFeatureForCurrentMode(),u=!s||r&&this.panoramicVideoPaused;if(!c||!u)return;let d=a.clickAction;this.clickAction=`pixel-location`;let f=l(()=>{this.clickAction=d}),p=null,m=x(()=>a,`pixel-location`,e=>{this.plotReferencePointOnImage(e),p?.abort(),p=i(async r=>{if(!e)return;let i=this._getActiveFeatureForCurrentMode();if(!i)return;let a={feature:i,mode:t,imageSize:o,footprintExtent:n},c=s?await this.getMapPointForFeature(e,a,{signal:r}):await this._transformationService.pixelToMapPoint(e),l=this.view?.spatialReference;c&&!xe(!l,c.spatialReference.equals(l))&&(c=await O(c,l,{signal:r})),v(r),this.plotReferencePointOnGround(c)})});this.addHandles([m,f],q.imageClick)},this._createTriangularImageClickHandle=()=>{this.removeHandles(q.triangularImageClick),this.triangularMeasurementActive&&this.mode!==`none`&&this.currentBestFeature&&this.currentBestFeatureMeasurementImage&&this.activeTriangulatedViewer&&this.addHandles(this.activeTriangulatedViewer.imageRenderer.on(`double-click`,this._measurementImageClickHandler),q.triangularImageClick)},this._enablePan=()=>{this.removeHandles(q.videoPanHandles)},this._disablePan=()=>{this.removeHandles(q.videoPanHandles),this.addHandles(rt(this.videoMapView),q.videoPanHandles)},this._handleImageHitTestResponse=async e=>{let{layer:t,overlayedCameraLocations:n}=this;if(!t)return;let r=e.results.find(({graphic:e,graphic:{attributes:r}})=>n.includes(e)&&r&&!r[t.imageReferenceField]&&!r[t.imageGeometryField]);if(!r)return;let i=r.graphic.attributes[t.objectIdField];await this.showImageByObjectId(i)},this._loadCurrentFeatureMedia=async(e,t)=>{this.mode===`video`?await this._loadFlatVideo(e,t):this.mode===`panoramic-video`?await this._loadVideo(t):await this._loadImage(t)},this._loadFlatVideo=async(e,t)=>{this._initializeVideo(),this.videoViewModel?.playVideoFromSelectedLocation(e);let n=e.attributes.objectId;this._waitForFlatVideoAndPlotSelectedLocation(e,n,t)},this._waitForFlatVideoAndPlotSelectedLocation=async(e,t,n)=>{try{if(await b(()=>this.videoElement?.loaded===!0,n),`${this.currentBestFeature?.attributes.objectId}`!=`${t}`)return;await this.transformAndPlotSelectedLocation(n)}catch(t){_(t)||d.getLogger(this).error(`failed to plot selected point on video`,{error:t,selectedPoint:this.selectedPoint,feature:e})}},this._loadDepthImage=async e=>{let{currentBestFeature:t,layer:n,depthImageNotSupported:r}=this;if(this.depthImage?.destroy(),this.depthImage=null,!n||!t||r)return;let{depthImage:i}=t.attributes;if(!i)return;let a=(await import(`./services/DepthImageService.js`)).default;v(e),this.depthImage=new a({url:i});try{await this.depthImage.load(e)}catch(e){_(e)||(d.getLogger(this).error(`error occurred while loading depth image`,e),this.depthImage?.destroy(),this.depthImage=null)}},this._loadImage=async e=>{let{currentBestFeature:t,layer:n,mode:r}=this,i=this._pendingDefaultNavigationViewState;if(this._pendingDefaultNavigationViewState=null,this.clearGraphics(),n&&t&&r!==`none`&&r!==`video`&&r!==`panoramic-video`)try{if(await this.loadImageFromFeature(n,t,e),v(e),i)try{await this._restoreNavigationViewState(i,e)}catch(e){if(_(e))throw e;d.getLogger(this).warn(`oriented-imagery-viewer:failed-to-restore-navigation-view-state`,e)}await this.transformAndPlotSelectedLocation(e)}catch(e){_(e)||this.loadImageError(e)}},this._loadVideo=async e=>{let{currentBestFeature:t,mode:n,selectedPoint:r}=this,i=t?.attributes.imagePath;if(!t||n!==`panoramic-video`||!i)return;let{attributes:a}=t,{cameraPitch:o,cameraOrientation:s,location:c}=a,l=c.spatialReference.isWGS84&&s?.type!==4?de(c):new D(c);try{this._panoramicVideoViewer.viewModel.video&&(this._panoramicVideoViewer.viewModel.video.pause(),this._panoramicVideoViewer.viewModel.videoPaused=!0),this._panoramicVideoViewer.videoSource=i;let t=0;l&&r&&(t=await M(l,r)-t),this._panoramicVideoViewer.pitch=o??0,this._panoramicVideoViewer.yaw=t,await this._panoramicVideoViewer.loadVideo(e),v(e)}catch(e){_(e)||this.loadImageError(e)}},this._loadImageFromFeature=async(e,t,n)=>{let{mode:r}=this;if(r!=="default"&&r!==`panoramic`)return;let i;try{i=await St(t.attributes,e,n),v(n)}catch(n){if(_(n))return;if(Ke(n)){d.getLogger(this).error(n),this.setMessage(`noAttachment`,`error`,`${e.objectIdField}: ${t.attributes.objectId}`);return}d.getLogger(this).error(n,{[e.objectIdField]:t.attributes.objectId,layer:e}),this.setMessage(`imageLoadError`,`error`,`query-attachments-failed:${e.objectIdField} ${t.attributes.objectId}`);return}if(!i)return;let{mediaUrl:a,datasetFormat:o,rotation:s,searchParams:c,location:l,cameraHeading:u,matrix:f,cameraPitch:p,getDataSetFormatError:m}=i,h=`${t.attributes.objectId}`;try{let i=this._mediaPrefetcher?.getCachedMedia(h);if(!i){let n=this.navigationNodes.find(e=>e.id===t.attributes.objectId);if(n){try{await this._mediaPrefetcher?.startPrefetchForNode(n,e)}catch{}i=this._mediaPrefetcher?.getCachedMedia(h)}}if(i){if(r===`panoramic`){let e=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer,r=0;l&&this.selectedPoint&&(r=await M(l,this.selectedPoint)-r),await e.loadMedia(i,n),this.selectedPoint?e.set({yaw:r,pitch:p}):`viewAngle`in t.attributes&&Number.isFinite(t.attributes.viewAngle)&&e.set({yaw:t.attributes.viewAngle,pitch:p}),this.triangularMeasurementActive?await this.initializeReferenceTransformationService(n):await this.initializeTransformationService(n);return}await this._setImageSource(this.triangularMeasurementActive?this.imageMeasurementViewer:this._imageViewer,i,n),this.triangularMeasurementActive?await this.initializeReferenceTransformationService(n):await this.initializeTransformationService(n);return}}catch{}m&&d.getLogger(this).warn(`error occurred while getting dataset format`,m),r===`panoramic`?await this.loadPanoramicMediaSource({lookAt:{yaw:this.selectedPoint?await M(l,this.selectedPoint):`viewAngle`in t.attributes&&Number.isFinite(t.attributes.viewAngle)?t.attributes.viewAngle:0,pitch:p},extension:o?.toUpperCase(),url:a,cameraHeading:u,matrix:f},n):await this.loadMediaSource({datasetFormat:o?.toUpperCase(),url:a,customParameters:c,rotation:s},n),this.triangularMeasurementActive?await this.initializeReferenceTransformationService(n):await this.initializeTransformationService(n)},this._loadMeasurementViewerImage=async e=>{let{currentBestFeatureMeasurementImage:t,layer:n,mode:r}=this;if(this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics(),n&&t&&r!==`none`&&r!==`video`&&r!==`panoramic-video`)try{await this.loadImageFromFeature(n,t,e),v(e)}catch(e){_(e)||this.loadImageError(e)}},this._loadMediaPrefetcher=async e=>{if(!this._mediaPrefetcher){let{default:t}=await import(`./support/MediaPrefetcher.js`);v(e),this._mediaPrefetcher=new t({maxEntries:this.preloadMediaSize*Pe.length})}return this._mediaPrefetcher},this._loadViewAdapter=async e=>{let{view:t}=this;if(this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),!t)this._adapter=null;else switch(t.type){case`2d`:{let{default:t}=await import(`./adapters/view/MapViewAdapter.js`);v(e),this._adapter=new t(this);break}case`3d`:{let{default:t}=await import(`./adapters/view/SceneViewAdapter.js`);v(e),this._adapter=new t(this);break}}},this._mapImageConversionToolViewClickHandler=e=>{if(e.stopPropagation(),e.preventDefault(),e.mapPoint){let t=e.mapPoint;t.x=ue(t.x,t.spatialReference),this.plotMapPoint(e.mapPoint)}},this._measurementImageClickHandler=e=>{e.stopPropagation(),e.preventDefault();let{sketchTriangular:t,triangularMeasurementActive:n,currentBestFeatureMeasurementImage:r,triangulatedMeasurementGraphic:i}=this;t&&n&&r&&i&&t.state!==`active`&&(t.update([i],{tool:`reshape`}),this.updatingTriangularMeasurementState=!0)},this._updateInteraction=()=>{let e=this.videoMapView.extent;if(!e)return;let{minScale:t}=this.videoMapView.constraints,n=this.videoMapView.scale<t-Fe,r=it(e);n&&r?(this._enablePan(),this.videoMapView.constraints.geometry=r):n?(this._disablePan(),this.videoMapView.constraints.geometry=null):(this.initialVideoMapViewExtent&&!this.videoMapView.extent.equals(this.initialVideoMapViewExtent)&&(this.videoMapView.extent=this.initialVideoMapViewExtent),this._disablePan(),this.videoMapView.constraints.geometry=null)},this._viewClickHandler=e=>{this._clickTask?.abort(),this._clickTask=i(async t=>{let{pointerType:n,button:r,mapPoint:i}=e;if(n===`mouse`&&r!==0||!i)return;e.stopPropagation(),e.preventDefault();let{view:a,layer:o}=this;if(a){if(!o)this.setMessage(`noLayerSelected`,`info`);else{if(this.shouldShowSelectedImage){let n=a.hitTest(e,{include:[o]});this._updatingHandles.addPromise(n);let r=await n;return v(t),await this._processHitTestResults(o,r,{signal:t})}return this._updatingHandles.addPromise(this.loadBestImage(i,{signal:t}))}}})},this.plotSelectedPointOnImage=async(e,n)=>{if(await y(n),!e)return;let r=new D({...ie(e)?e.toJSON():e});if(this.mode==="default")r.x-=.5,r.y=.5-r.y,r.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:r,symbol:W}),this._imageViewer.addGraphic(this._crossSymbol,0);else if(this.mode===`video`)this._crossSymbol=this.videoViewModel?.plotSelectedPointOnVideo(r)??null;else if(this.mode===`panoramic`){let{imageSize:n,media:r}=this._panoramicViewer;if(!n||!r)return;let i=J(r),a=Se(e,...n,i);this._crossSymbol=new t({geometry:new D(a,se.WebMercator),symbol:Re}),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([S(()=>this.view,()=>this.load(),C),S(()=>this.view?.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},te),S(()=>this.view?.map?.allLayers?.length,e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)},te),S(()=>[this.state,this.panoramicVideoLoaded,this.mapImageConversionToolState,this.view,this.disabled,this.panoramicVideoPaused,this.videoViewModel?.videoPaused],(e,t)=>{let n=e[2];t?.[2]&&!n&&(this.plotReferencePointOnGround(null),this.clearReferencePointOnImage()),this._createViewClickHandle(),this._createImageClickHandle()},C),S(()=>[this.triangularMeasurementActive,this.currentBestFeatureMeasurementImage],()=>{this._createTriangularImageClickHandle()},C),S(()=>[this.state,this.imageLocationToolState,this.view],()=>{this._initializeMeasurementService(),this._initializeLocationViewModel()},C),S(()=>this.measureType,()=>{this.clearPreviousMeasurements(),this._initializeMeasurementService()},C),S(()=>this.bestFeatureAngle,(e,t)=>{this.previousFeatureAngle=t??0},C),S(()=>[this.superimposeViewEnabled,this.defaultSuperimposeCameraLockEnabled,this.superimposeViewSupported,this.currentBestFeature,this.mode,this.state,this.view?.type],()=>{this._shouldDisableUnsupportedSuperimposeView()?this.superimposeViewEnabled=!1:this._hasActiveSuperimposeCameraContext()?this._updateSuperimposedImage():this._resetInactiveSuperimposeState()},C),S(()=>this._getSuperimposeCameraWatchState(),()=>this._handleSuperimposeCameraChange(),C),S(()=>this.currentBestFeature,async(e,t)=>{h(this._featureChangedTask),this._featureChangedTask=i(async n=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:n}])),await this._featureChangedTask.promise},{sync:!0}),S(()=>[this.currentNode,this.preloadMedia,this.navigationMode],()=>{this._mediaPrefetchTask?.abort(),this._mediaPrefetchTask=i(async e=>{this.preloadMedia&&this.navigationMode!=null?(this._mediaPrefetcher??=await this._loadMediaPrefetcher({signal:e}),v(e),this.navigationMode===`directional`?this._mediaPrefetcher.enqueueDirectionalPrefetch(this.layer,this.currentNode,this.preloadMediaSize):this._mediaPrefetcher.enqueueSequentialPrefetch(this.layer,this.currentNode,this.preloadMediaSize)):this._mediaPrefetcher?.clear()})},C),S(()=>this.currentBestFeatureMeasurementImage,(e,t)=>{h(this._featureChangedTask),t&&e!==t&&(this.triangulatedPoint=null,this.sketchTriangularGraphicsLayer?.graphics.destroyAll(),this._measurementService?.resetMeasurementVectors()),this._featureChangedTask=i(async n=>{await this.determineWorkflowForTriangularMeasurement(e,t,{signal:n}),v(n),this._reorderTriangularSketchLayer()})},C),S(()=>this.triangularMeasurementActive,(e,t)=>{t&&!e&&(this._measurementService?.resetMeasurementVectors(),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(),this._panoramicMeasurementViewer.clearImage(),this._panoramicMeasurementViewer.clearGraphics())}),S(()=>this.mode,e=>{switch(this.removeHandles(q.interactionHandles),e){case`default`:this.addHandles(S(()=>{let{state:e}=this;return e===`image-loaded`?this._imageViewer.imagePointsInView:null},e=>{e&&(h(this._updateFootprintTask),this._updateFootprintTask=i(async t=>{await this.updateFootprint(e,void 0,{signal:t})}))},{...C,equals:(e,t)=>n(e,t,u)}),q.interactionHandles);break;case`video`:this.addHandles(S(()=>{let{footprintExtent:e,videoElement:t,bestFeatureFootprint:n}=this;if(e&&t?.loaded&&n)return{videoExtent:Ie,bestFeatureFootprint:n}},e=>{e?.videoExtent&&e?.bestFeatureFootprint&&(h(this._updateFootprintTask),this._updateFootprintTask=i(async t=>{let n={points:e.videoExtent,feature:void 0,scale:void 0,options:{signal:t}};await this.updateVideoFootprint(n)}))},{...C,equals:(e,t)=>n(e?.videoExtent,t?.videoExtent,u)&&e?.bestFeatureFootprint===t?.bestFeatureFootprint}),q.interactionHandles);break;case`panoramic`:this.addHandles(S(()=>{let{currentBestFeature:e,state:t,_panoramicViewer:n}=this,{imageSize:r,vfov:i,hfov:a,pitch:o,yaw:s}=n;return!e||!r||t.includes(`loading`)||i==null||a==null||o==null||s==null?null:[i,a,s,o]},e=>{if(!e||this.state.includes(`loading`))return;let[t,n,r,a]=e;this.currentNode&&(this.currentNode.currentHeading=r,this.currentNode.currentPitch=a),h(this._updateFootprintTask),this._updateFootprintTask=i(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:n,yaw:r,pitch:a},{signal:e}),this._updateFootprintTask=null})},{equals:(e,t)=>n(e,t,u)}),q.interactionHandles);break;case`panoramic-video`:this.addHandles(S(()=>{let{currentBestFeature:e,state:t,_panoramicVideoViewer:n}=this,{imageSize:r,vfov:i,hfov:a,pitch:o,yaw:s,viewModel:c}=n,l=c.closestFeature??e;return!l||!r||t.includes(`loading`)||i==null||a==null||o==null||s==null?null:[i,a,s,o,l]},e=>{if(!e)return;let[t,n,r,a,o]=e;h(this._updateFootprintTask),this._updateFootprintTask=i(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:n,yaw:r,pitch:a,feature:o,horizonAngles:this._panoramicVideoViewer.horizonAngles},{signal:e}),v(e),this._updateFootprintTask=null})},{equals:(e,t)=>n(e,t,u)}),q.interactionHandles)}},C),S(()=>[this.brightness,this.contrast,this.sharpness],()=>{let{_imageViewer:e,brightness:t,contrast:n,mode:r,sharpness:i}=this;r==="default"&&(e.brightness=t,e.contrast=n,e.sharpness=i)},C),S(()=>this.activeViewer?.imageRenderer,()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)}),S(()=>this.activeViewer,e=>{this.removeHandles(q.hittestHandles),e&&this.addHandles(x(()=>e,`hittest-response`,this._handleImageHitTestResponse),q.hittestHandles)}),S(()=>this.videoMapView.extent,async()=>{this._scheduleVideoInteractionUpdate();let e=this.videoViewModel?.closestFeature;e&&(h(this._updateFootprintTask),this._updateFootprintTask=i(async t=>{let n={points:this.videoExtentPoints,feature:e,options:{signal:t}};await this.updateVideoFootprint(n)}))}),S(()=>[this.videoMapView.interacting,this.videoMapView.navigating,this.videoMapView.scale],()=>{this._scheduleVideoInteractionUpdate()},{initial:!0}),ne(()=>this.videoMapView.extent!=null,()=>{this.initialVideoMapViewExtent=this.videoMapView.extent},{once:!0})]),this.when().finally(()=>{this.notifyChange(`state`)})}destroy(){this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),this._abortSuperimposeSchedule(),this.currentBestFeature=null,this._updateFootprintTask=h(this._updateFootprintTask),this._clickTask=h(this._clickTask),this._navigationViewStateTask=h(this._navigationViewStateTask),this._restoreSuperimposeMediaTask=h(this._restoreSuperimposeMediaTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=m(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint),this.videoViewModel=m(this.videoViewModel),this._locationViewModel=m(this._locationViewModel),this.clearSelectedPointOnViewer(),this._referencePointOnGround=m(this._referencePointOnGround),this.clearReferencePointOnImage(),this._superimposeService.destroy(),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy(),this._imageViewer.destroy(),this.imageMeasurementViewer.destroy(),this._panoramicViewer.destroy(),this._panoramicMeasurementViewer.destroy(),this._mediaPrefetcher?.destroy(),this._videoFeatureCache.destroy()}get activeLayer(){return o(d.getLogger(this),`activeLayer`,{replacement:`layer`}),this.layer}set activeLayer(e){o(d.getLogger(this),`activeLayer`,{replacement:`layer`}),this.layer=e}get activeViewer(){let{_imageViewer:e,_panoramicViewer:t,mode:n}=this;switch(n){case`default`:return e;case`panoramic`:return t;default:return null}}get activeTriangulatedViewer(){switch(this.mode){case`default`:return this.imageMeasurementViewer;case`panoramic`:return this._panoramicMeasurementViewer;default:return null}}get accuracyParametersMissing(){let e=this.currentBestFeature?.attributes.orientationAccuracy;return!e||e.every(e=>e===0)}get brightness(){return this._get(`brightness`)??0}set brightness(e){this._set(`brightness`,f(e,-10,10))}get contrast(){return this._get(`contrast`)??0}set contrast(e){this._set(`contrast`,f(e,-10,10))}get currentNode(){let{currentBestFeature:e,navigationNodes:t}=this;return t.find(t=>t.id===e?.attributes.objectId)}get depthImageNotSupported(){if(this.currentBestFeature?.attributes.depthImage)return!qe(this.currentBestFeature.attributes.depthImage)}get featureCount(){return this.features?.length??0}get hasPendingPanoramicNavigationViewState(){return this._pendingPanoramicNavigationViewState!=null}get imageGalleryEnabled(){let{currentBestFeature:e}=this;if(!e)return!1;let t=e.attributes.imagePath?.trim();return Y(t)||H(t)}get imageLoaded(){return o(d.getLogger(this),`imageLoaded`,{replacement:`Use OrientedImageryViewer.state === "image-loaded"`,version:`4.29`,warnOnce:!0}),this.state===`image-loaded`}get invalidCameraHeading(){return this.currentBestFeature?.attributes?.cameraHeading===R}get imagePointsInView(){let{mode:e,_imageViewer:t}=this;return e==="default"?t.imagePointsInView:null}get layerView(){let{layer:e,view:t}=this;if(e&&t)return t.allLayerViews.find(Je(e))}get layerFloorFilterClause(){let{layerView:e}=this;return e?Ee(e):null}get layerTimeExtent(){return this.layerView?.timeExtent??null}get mode(){let e=this.currentBestFeature?.attributes;if(!e)return`none`;let t=e.orientedImageryType;if(t?.includes(`video`))return t.includes(`360`)?`panoramic-video`:`video`;let{horizontalFieldOfView:n,isSpherical:r}=e;return n===360||r?`panoramic`:`default`}get panoramicVideoLoaded(){let{mode:e,_panoramicVideoViewer:t}=this,{videoLoaded:n}=t.viewModel;return e===`panoramic-video`&&n===!0}get overlayGraphicsEnabled(){let{mode:e,state:t,panoramicVideoLoaded:n,videoViewModel:r,panoramicVideoPaused:i}=this;return t===`image-loaded`||e===`video`&&t===`video-loaded`&&r?.videoPaused===!0||e===`panoramic-video`&&n&&i}get panoramicVideoPaused(){return!!this._panoramicVideoViewer.viewModel.videoPaused}get popupEnabled(){return this.layer?.popupEnabled===!0}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){let{_sectorData:e}=this;return e?z.map(t=>e[t]):null}get sharpness(){return this._get(`sharpness`)??0}set sharpness(e){this._set(`sharpness`,f(e,0,1))}get superimposeViewSupported(){return this.mode==="default"||this.mode===`panoramic`}get sketchGraphicsLayer(){let{sketch:e}=this;return e?.layer?.type===`graphics`?e.layer:void 0}get state(){let{mode:e,_updatingHandles:{updating:t},_featureChangedTask:n,_navigationManager:r}=this;if(!this.isFulfilled()||t||n?.finished===!1||r?.navigating)return`loading`;if(this.isRejected())return`error`;if(this.displayMessage?.type===`error`)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`;case`panoramic-video`:return this.panoramicVideoLoaded?`video-loaded`:`video-not-loaded`}return`ready`}get thumbnails(){let{features:e}=this;return e?new a(e.map(({attributes:{imagePath:e,objectId:t,cameraRoll:n,imageRotation:r}})=>{let i=e?.trim();return Y(i)||H(i)?{url:i,objectId:t,rotation:(n??0)+(r??0)}:null}).filter(r)):null}get videoExtentPoints(){let e=at(this.videoMapView.extent);return e.length?e:Ie}set view(e){this._set(`view`,e)}get _defaultGraphicsLayer(){let e={blendMode:`source-atop`};switch(this.mode){case`panoramic`:return new k({...e,elevationInfo:{mode:`absolute-height`}});case`default`:return new k({...e});default:return}}get _overlaysView(){return this.view?.layerViews.find(({layer:e})=>e===this._overlays)}updatePanoramicSuperimposeRadiusOffset(e){this._superimposeService.updatePanoramicRadiusOffset(e)}setDefaultSuperimposeZOffsetPercentage(e){this._superimposeService.setDefaultZOffsetPercentage(e)}setFrustumSearchEnabled(e){this.frustumSearchEnabled=e}setPanoramicSuperimposeRadiusPercentage(e){this._superimposeService.setPanoramicRadiusPercentage(e)}updateDefaultSuperimposeCameraLock(e){this.defaultSuperimposeCameraLockEnabled=e,this.superimposeViewEnabled&&this.mode==="default"&&(e?this._adapter?.enableDefaultSuperimposeNavigation?.():this._adapter?.disableDefaultSuperimposeNavigation?.())}beforeLoad(e=!0){this.emit(`popup-close`),e&&(this.displayMessage=null),this._pendingDefaultNavigationViewState=null,this._pendingPanoramicNavigationViewState=null,this._abortSuperimposeSchedule(),this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),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=m(this.bestFeatureCurrentFootprint),this._restoreSuperimposeMediaTask=h(this._restoreSuperimposeMediaTask),this._superimposeService.clear(),this._overlays?.removeAll()}async calculateLocationAccuracy(e){return this._measurementService?.calculateLocationAccuracy(e)}clearLocationPointOnImage(e=!1){this.locationPointOnImage&&!e&&(this._imageViewer.removeGraphic(this.locationPointOnImage),this._panoramicViewer.removeGraphic(this.locationPointOnImage),this.locationPointOnImage=m(this.locationPointOnImage)),this.correctedLocationPointOnImage&&=(this.imageMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),this._panoramicMeasurementViewer.removeGraphic(this.correctedLocationPointOnImage),m(this.correctedLocationPointOnImage))}clearPreviousMeasurements(){this.clearMeasurementGraphics(),this.resetMeasurementData(),this.stopMeasurement()}clearPreviousGroundLocation(){this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.groundCoordinatesAccuracyLoading=!1,this.pixelCoordinates=null,this.clearLocationPointOnImage()}clearMeasurementGraphics(){this.measurementGraphic&&=(this.activeViewer?.removeGraphic(this.measurementGraphic),null),this.heightGraphic&&=(this.activeViewer?.removeGraphic(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){let{sketch:n,dataCaptureLayer:r}=this;if(!n)throw Q();ht(r,e,n),await n.create(e,{...t,defaultZ:0})}digitizeDelete(){if(!this.sketch)throw Q();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw Q();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw Q();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw Q();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw Q();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw Q();return this.sketch.update(e,t)}filterByFootprints(e,t,n){let r=n?.filterByFrustum??!1,i=n?.skipFilter??!1,a=[],o=[],s=[];return e.forEach(e=>{let{attributes:n}=e,c=e.layer?.coveragePercent,l,{polygon:u,frustum:d}=V(n);l=u.clone(),n.isInspection&&(l=me(n)),c&&(l=he(l,c));let{cameraHeading:f,objectId:p}=n;if(this._matchesSelectedPointFilter({skipFilter:i,selectedPoint:t,filterByFrustum:r,cameraHeading:f,attributes:n,polygon:l})){s.push(e);let t=n.location.clone();t.imageID=p,this.pointSources.push(t),f!==R&&(a.push(u),d&&o.push(d))}}),{features:s,polygons:a,frustums:o}}async deleteDataCaptureFeatures(e){let{dataCaptureLayer:t}=this;if(!t)throw new s(`orientedimageryviewer:missing-featurelayer`,`Data capture layer is not available`);return t.queryFeatures({objectIds:e,outFields:[t.objectIdField]}).then(({features:e})=>t.applyEdits({deleteFeatures:e}))}handleSectorClick(e){if(isNaN(e))return;let t=(this._sectorData?.[z[e]])?.at(0);t&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(t):this._scheduleCurrentBestFeatureUpdate(t))}handleFeatureClick(e){let{sector:t,featureIndexInSector:n}=e;if(isNaN(n))return;let r=(this._sectorData?.[t])?.at(n);r&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(r):this._scheduleCurrentBestFeatureUpdate(r))}load(e){return this.addResolvingPromise(this._loadViewAdapter(e).catch(e=>{if(!_(e))throw e})),this}async loadBestImage(e,t){return this.selectedPoint=j(e),this.beforeLoad(),this._fetchFeaturesWithController(e,t)}async loadHeightMeasurementAdapter(e){if(!this.drawAdapter){let{default:t}=await import(`./adapters/draw/HeightMeasurementAdapter.js`);if(v(e),this.drawAdapter=new t({viewModel:this,measurementService:this._measurementService}),!this.drawAdapter.viewModel.isResolved())return}return this.drawAdapter}loadImageError(e){d.getLogger(this).error(`oriented-imagery-viewer:load-image`,e),this.setMessage(`imageLoadError`,`error`,e.message)}async loadSketch(e){if(!this.sketch){let{default:t}=await import(`../Sketch/SketchViewModel.js`);v(e),this.sketch=new t({layer:this._defaultGraphicsLayer,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){let{default:t}=await import(`./adapters/sketch/MeasurementAdapter.js`);if(v(e),this.sketchAdapter=new t({viewModel:this,measurementService:this._measurementService}),!this.sketchAdapter.viewModel.isResolved())return}return this.sketchAdapter}async processFeatureResponse(e,t,n){let{features:r}=e,i=this.layer?.verticalSearchRange,a=this._shouldUseVerticalFilter(),o=this._shouldUseFrustumSearch();if(this._clearFeatureGeometries(),!this._checkFeatures(r))return;let s=r[0].attributes.location.spatialReference.equals(t.spatialReference)?t:await O(t,r[0].attributes.location.spatialReference),{features:c,polygons:l}=o?this.filterByFootprints(r,s,{filterByFrustum:!0}):this.filterByFootprints(r,s,{skipFilter:n?.skipFilter});if(!this._checkFeatures(c))return;let u=await this.processElevationSample(l,c,n);v(n),await this._updateElevationOfSelectedPointAndLocations(c,t,u),v(n),c.forEach(({attributes:e})=>{if(e.cameraHeading!==R){let{polygon:t,frustum:n}=V(e);this.coveragePolygons.add(t),n&&this.coverageFrustums.add(n)}}),Ye(c,u);let d=c;if(a&&t&&i!=null&&(d=Xe(c,t,i),!d.length)){this.setMessage(`noImageAtElevation`,`info`);return}let f=this._processSuitableFeatures(d,t);this.updateSuitabilities(f,n?.loadBestImage)}async processFeatureElevation(e,t,n){if(!t)return;let{features:r,polygons:i}=this.filterByFootprints(e,t,{skipFilter:!0});if(!r?.length)return;let a=await this.processElevationSample(i,r,n);return v(n),a}async startMeasurement(e,t){this.sketch||await this.loadSketch(t),await this.loadMeasurementAdapter(t);let{sketch:n,sketchAdapter:r,activeViewer:i,mode:a}=this;if(!n||!r||!i||a===`none`)return;if(this.displayNewMeasurementButton=!1,a===`panoramic`&&(n.defaultCreateOptions.defaultZ=0),await n.create(e),a===`panoramic`){let{drawOperation:e}=n.view.activeTool;e.constraintsEnabled=!1,e._set(`elevationDrawSurface`,null)}let o=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;o&&this.sketch&&(this.sketch.polygonSymbol=ze(o),this.sketch.polylineSymbol=a===`panoramic`?Be:Ve(o,2.5))}async startHeightMeasurement(){this.displayNewMeasurementButton=!1,this.draw??=new ke({view:this.activeViewer?.imageRenderer}),this.polylineDrawAction=this.draw.create(`polyline`),await this.loadHeightMeasurementAdapter()}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){let{activeViewer:n,overlayedCameraLocations:i,layer:a,mode:o,layerFloorFilterClause:s,layerTimeExtent:c,videoViewModel:l,_panoramicVideoViewer:u}=this,d=o===`video`,f=o===`panoramic-video`,p=this._getActiveFeatureForCurrentMode(),m=this._computeOverlayImageSize();if(!m||!p||!a||o===`none`||!this.overlayGraphicsEnabled)return;let{polygon:h}=V(p.attributes);if(d?l?.removeOverlayGraphics(i.toArray()):f?u.removeManyGraphics(i.toArray()):n?.removeManyGraphics(i.toArray()),i.removeAll(),e){let{features:e}=await a.queryFeatures({where:w(`${a.objectIdField} <> ${p.attributes.objectId}`,w(a.definitionExpression,s)),geometry:h,returnGeometry:!0,outFields:[a.objectIdField],timeExtent:c}),g=await Promise.all(e.map(async e=>{let{attributes:n,geometry:r}=e;if(r?.type!==`point`)return null;let i=await this._geometryToOverlayImageGeometry(r,p,m);if(!i)return null;let a=o===`panoramic`||o===`panoramic-video`?He():Ue();return new t({attributes:n,symbol:a,geometry:i})}));i.addMany(g.filter(r)),d?l?.addOverlayGraphics(i.toArray()):f?u.addManyGraphics(i.toArray()):n?.addManyGraphics(i.toArray())}}overlayGraphicsOnImage(e,t){this.removeOverlayedGraphicsOnImage(e),this.overlayedMapFeatures.set(e,t),this.mode===`video`?this.videoViewModel?.addOverlayGraphics(t.toArray()):this.mode===`panoramic-video`?this._panoramicVideoViewer.addManyGraphics(t.toArray()):this.activeViewer?.addManyGraphics(t.toArray())}async overlayMapFeatures(e,n=!1){let{activeViewer:i,mode:o,layer:s,videoViewModel:c,_panoramicVideoViewer:l}=this,u=o===`video`,f=o===`panoramic-video`,p=this._getActiveFeatureForCurrentMode(),m=this._computeOverlayImageSize();if(!m||!p||o===`none`||!this.overlayGraphicsEnabled||!s)return;let{polygon:h}=V(p.attributes);try{let{imageGeometryField:t,oiObjectIdField:n}=gt(e,s.imageGeometryField,s.imageReferenceField);this.imageGeometryField=t.name,this.oiObjectIdField=n.name}catch(e){d.getLogger(this).warn(`oriented-imagery-viewer:overlay-map-features`,e)}let{features:g}=await e.queryFeatures({geometry:h,returnGeometry:!0,outFields:[`*`]}),_=await Promise.all(g.map(async r=>{let a=r.symbol?.clone()??e.renderer?.getSymbol(r)?.clone(),{attributes:s,geometry:h}=r,{imageGeometryField:g,oiObjectIdField:_}=this;if(g&&_&&Ct(e,g,_)&&`${s[_]}`==`${p.attributes.objectId}`)try{let r=f?l.horizonAngles:J(i?.media),d=_t(s,g,e,n,m,u?`default`:o,a,r);if(!u)return d;let p=d.geometry;if(!p)return null;let h=c?.imageGeometryToOverlayGeometry(p);return h?new t({attributes:s,layer:e,symbol:d.symbol,geometry:h,visible:d.visible}):null}catch(t){d.getLogger(this).warn(`oriented-imagery-viewer:overlay-map-features`,`couldn't create graphic from attributes, geometry will be used`,{error:t,feature:r,layer:e,imageGeometryField:this.imageGeometryField,imageReferenceField:this.oiObjectIdField})}if(!h)return null;let v={feature:p,imageSize:m,footprintExtent:this.footprintExtent},y=await this._geometryToOverlayImageGeometry(h,v.feature,v.imageSize);return y?new t({attributes:s,layer:e,symbol:a,geometry:y,visible:e.visible&&n}):null})),v=new a(_.filter(r));(o!==`video`&&o!==`panoramic-video`||this.overlayGraphicsEnabled)&&this.overlayGraphicsOnImage(`${e.id}`,v)}getDepthAt(e){let{activeViewer:t,currentBestFeature:n,mode:r,state:i,depthImage:a}=this,o=t?.imageSize;if(!o||!n||r===`none`||i.includes(`loading`))return d.getLogger(this).warnOnce(`oriented-imagery-viewer:get-depth-at`,`Load an image to use depth`),null;if(!a?.loaded)return d.getLogger(this).error(`oriented-imagery-viewer:get-depth-at`,`Depth image is not loaded`),this.emit(`depth-image-service:not-loaded`),null;let s=(Array.isArray(e)?e:[e]).map(e=>a.depthAt(e,{width:o[0],height:o[1]})??null);return Array.isArray(e)?s:s[0]}getActiveSectors(){return z.filter(e=>this._sectorData?.[e]?.length)}async getPixelLocationForFeature(e,t,n){return(await this._transformationService.pointToPixelForFeature([e],t,n))[0]}async getPixelLocationsForFeature(e,t,n){return await this._transformationService.pointToPixelForFeature(e,t,n)}async _getMapPointInViewSpatialReference(e,t){let n=await this.getMapPoint(e,t),r=this.view?.spatialReference;return await O(n,r,t)}async plotMapPoint(e){this.plotReferencePoint(e);let t=this._getActiveFeatureForCurrentMode();if(t)return this.transformAndPlotReferencePointOnImage({feature:t,selectedLocation:e,options:{signal:this._transformController?.signal}})}plotReferencePointOnGround(e){this._referencePointOnGround&&(this._overlays?.remove(this._referencePointOnGround),this._referencePointOnGround.destroy()),e!=null&&(this._referencePointOnGround=new t({geometry:new D({...e.toJSON()}),symbol:G}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit(`plot-ground-point`,{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){switch(this.mode){case`video`:this._plotReferencePointOnVideo(e);return;case`panoramic-video`:this._plotReferencePointOnPanoramicVideo(e);return;case`default`:this._plotReferencePointOnDefaultImage(e);return;case`panoramic`:this._plotReferencePointOnPanoramicImage(e);return}}removeAllOverlayMapFeatures(){let{mode:e}=this;this.overlayedMapFeatures.forEach(t=>{let n=t.toArray();switch(e){case`video`:this.videoViewModel?.removeOverlayGraphics(n);break;case`panoramic-video`:this._panoramicVideoViewer.removeManyGraphics(n);break;default:this.activeViewer?.removeManyGraphics(n)}}),this.overlayedMapFeatures.clear()}removeOverlayedGraphicsOnImage(e){let t=this.overlayedMapFeatures.get(e),{mode:n}=this;if(!t?.length)return;let r=t.toArray();switch(n){case`video`:this.videoViewModel?.removeOverlayGraphics(r);break;case`panoramic-video`:this._panoramicVideoViewer.removeManyGraphics(r);break;default:this.activeViewer?.removeManyGraphics(r)}this.overlayedMapFeatures.delete(e)}reset(){let{mode:e}=this;e==="default"||e===`panoramic`?this.resetImage():e===`video`?this.resetVideo():e===`panoramic-video`&&this.resetVideoPanoramic(),this.beforeLoad(!1)}resetImage(){switch(this.setMessage(`onLoadMessage`,`info`),this.mode){case`default`:this._imageViewer.clearImage(),this._imageViewer.clearGraphics();break;case`panoramic`:this._panoramicViewer.clearImage(),this._panoramicViewer.clearGraphics()}this._clickTask=h(this._clickTask)}resetVideo(){this.setMessage(`onLoadMessage`,`info`),this.videoViewModel?.resetVideoHandler(),this._overlays?.removeAll(),this.videoViewModel=null,this._videoFeatureCache.reset(),this._syncVideoFeatureCacheState(),this.currentBestFeature=null}resetVideoPanoramic(){this.setMessage(`onLoadMessage`,`info`),this._overlays?.removeAll(),this._panoramicVideoViewer.reset(),this.currentBestFeature=null}resetMeasurementData(){this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.heightGraphic=null,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedMeasurementGraphic=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaAccuracy=0,this._measurementService?.resetMeasurementVectors()}async saveDrawing(){let{dataCaptureLayer:e,sketchAdapter:t}=this;if(!e||t?.type!==`data-capture`)return;let{pendingGraphics:n,savedGraphics:r}=t,i=n.get(e.id),a=i?.toArray();if(!i||!a?.length)return;let{addFeatureResults:o}=await this.saveDataCaptureFeatures(a),s=o.reduce((t,{objectId:n,globalId:r,error:i},o)=>{let s=a[o],{attributes:c}=s;return i?t.error.push(s):(n&&(c[e.objectIdField]=n),r&&e.globalIdField&&(c[e.globalIdField]=r),t.success.push(s)),t},{success:[],error:[]});r.addMany(s.success),i.removeAll(),i.addMany(s.error)}async saveDataCaptureFeatures(e,t){let{activeViewer:n,currentBestFeature:i,dataCaptureLayer:a,mode:o}=this;if(!n?.imageSize||!i||o===`none`||o===`video`||o===`panoramic-video`)throw new s(`orientedimageryviewer:missing-input`,`Image size, current best feature and mode are required to save data capture features`);if(!a)throw new s(`orientedimageryviewer:missing-featurelayer`,`Data capture layer is not available`);let c=await Promise.all(e.map(async e=>{let n=e.clone(),{geometry:r}=n;if(!r)return;let i=r.type,o=a.hasZ,s=a.geometryType,c=i!==s,l=(c?await import(`./transformers.js`):null)?.default[s],u=c?l?.(r):r;if(u&&(n.geometry=await this._transformationService.imageGeometryToMapGeometry(u,t),n.geometry))return o||vt(n.geometry),n})),l=c.filter(r);return a.applyEdits({addFeatures:l}).then(e=>{let{addFeatureResults:t}=e,n=0,r=c.map(e=>{let r=t[n++];return e?r:{error:new s(`orientedimageryviewer:save-unsucccessful`,`Error in saving data capture features`),objectId:null,globalId:null}});return{...e,addFeatureResults:r}})}async searchBestImage(e,t){try{let n=await A(e,t);n&&await this.processFeatureResponse(n,e.point,t)}catch(e){_(e)||(this.setMessage(`imageLoadError`,`error`,e.message),d.getLogger(this).error(`error occurred while finding best image`,e))}}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 restorePendingPanoramicNavigationViewState(e){let t=this._pendingPanoramicNavigationViewState;this._pendingPanoramicNavigationViewState=null,this.mode===`panoramic`&&await this._restoreNavigationViewState(t,e)}async startDataCapture(e,t){let n=this.activeViewer?.imageRenderer,{oiObjectIdField:r,currentBestFeature:i}=this;if(!n||!i||!r)return;let{attributes:{objectId:o}}=i,s=this.overlayedMapFeatures.get(e.id)?.toArray()??[],c=[],l=[];for(let e of s)`${e.getAttribute(r)}`==`${o}`?c.push(e):l.push(e);this.overlayGraphicsOnImage(e.id,new a(l)),this.collectionId=e.id;let u=await this.loadSketch(t),d=await this.loadDataCaptureAdapter(t);v(t),u.addGraphics(c),d.savedGraphics.addMany(c);let f=n.ui.find(`zoom`);f.visible=!1,n.map.layers.add(this.sketchGraphicsLayer)}async stopDataCapture(e=!1){this.sketch?.cancel(),this.sketchGraphicsLayer?.removeAll(),this.sketchAdapter=m(this.sketchAdapter),this.sketch=m(this.sketch),this.collectionId=null;let{dataCaptureLayer:t}=this,n=this.activeViewer?.imageRenderer;if(!n||n.destroyed)return;n.map.layers.remove(this.sketchGraphicsLayer),e&&t&&await this.overlayMapFeatures(t,!0);let r=n.ui.find(`zoom`);r&&(r.visible=!0)}stopMeasurement(){this.draw?.reset(),this.sketch?.cancel()}async toggleAllOverlayMapFeatures(e){!e&&this.dataCaptureLayer&&(await this.stopDataCapture(!0),this.dataCaptureLayer=null),this.overlayedMapFeatures.forEach(t=>{this._toggleVisiblity(t,e)})}toggleOverlayMapFeatures(e,t,n){let r=this.overlayedMapFeatures.get(e);r&&n&&this._toggleVisiblity(r,t)}toggleSelection(e){let{sketch:t}=this;t&&(t.updateOnGraphicClick=e,t.cancel())}async transformAndPlotReferencePointOnImage(e){let{feature:t,selectedLocation:n,options:r}=e,i=!1,a=!1,o=this.mode===`video`?this.bestFeatureCurrentFootprint?.geometry:this.bestFeatureFootprint?.geometry;switch(o?.type){case`polygon`:{let e=n.spatialReference.equals(o.spatialReference)?n:await O(n,o.spatialReference);i=o.contains(e);break}case`mesh`:{let e=n.spatialReference.equals(o.spatialReference)?n:await O(n,o.spatialReference);a=o.extent.contains(e);break}}if(!i&&!a){this.clearReferencePointOnImage();return}let s=this.mode===`video`||this.mode===`panoramic-video`?await this.getPixelLocationForFeature(n,{feature:t,mode:this.mode,imageSize:L,footprintExtent:this.footprintExtent},r):await this._transformationService.pointToPixel(n,r);if(!s)this.clearReferencePointOnImage();else return v(r),this.plotReferencePointOnImage(s),{x:s.x,y:s.y}}async updateFeatureCache(e){await this._videoFeatureCache.updateIndex(e),this._syncVideoFeatureCacheState()}cacheHydratedVideoFeature(e){this._videoFeatureCache.cacheHydratedFeature(e),this._syncVideoFeatureCacheState()}getCachedVideoFeatureByOffset(e,t){return this._videoFeatureCache.getCachedFeatureByOffset(e,t)}async getVideoFeatureByOffset(e,t,n){let{layer:r}=this;if(!r)return null;let i=await this._videoFeatureCache.getFeatureByOffset({layer:r,layerFloorFilterClause:this.layerFloorFilterClause,layerTimeExtent:this.layerTimeExtent},e,t,n);return this._syncVideoFeatureCacheState(),i}_shouldUseVerticalFilter(){return!!(this.layer?.verticalSearchRange&&this.layer.hasZ&&this.verticalFilterEnabled)}_shouldUseFrustumSearch(){return!!(this.layer?.hasZ&&this.frustumSearchEnabled&&this.view?.type===`3d`)}_syncVideoFeatureCacheState(){this.featureCache=this._videoFeatureCache.featureCache,this.videoFeatureIndex=this._videoFeatureCache.videoFeatureIndex}_matchesSelectedPointFilter({skipFilter:e,selectedPoint:t,filterByFrustum:n,cameraHeading:r,attributes:i,polygon:a}){return e||!t||(n?r!==R&&ge(i,t):_e(a,t))}_plotReferencePointOnVideo(e){this.state===`video-loaded`&&this.videoViewModel?.videoPaused&&(this.clearReferencePointOnImage(),this.videoViewModel.plotReferencePointOnVideo(e))}_plotReferencePointOnPanoramicVideo(e){let n=this._panoramicVideoViewer,{imageSize:r,media:i}=n.viewModel;if(!this.panoramicVideoLoaded||!this.panoramicVideoPaused||!r)return;this.clearReferencePointOnImage();let a=J(i),o=Z(e,`panoramic`,r,a);this._referencePointOnImage=new t({geometry:o,symbol:K.clone()}),n.addGraphic(this._referencePointOnImage,0)}_getActiveFeatureForCurrentMode(){switch(this.mode){case`video`:return this.videoViewModel?.closestFeature??this.currentBestFeature;case`panoramic-video`:return this._panoramicVideoViewer.viewModel.closestFeature??this.currentBestFeature;default:return this.currentBestFeature}}_plotReferencePointOnDefaultImage(e){let n=this._imageViewer,{imageSize:r}=n;if(this.state!==`image-loaded`||!r)return;this.clearReferencePointOnImage();let i=Z(e,`default`,r);this._referencePointOnImage=new t({geometry:i,symbol:G.clone()}),n.addGraphic(this._referencePointOnImage,0)}_plotReferencePointOnPanoramicImage(e){let n=this._panoramicViewer,{imageSize:r,media:i}=n;if(this.state!==`image-loaded`||!r)return;this.clearReferencePointOnImage();let a=J(i),o=Z(e,`panoramic`,r,a);this._referencePointOnImage=new t({geometry:o,symbol:K.clone()}),n.addGraphic(this._referencePointOnImage,0)}async _fetchFeatures(e,t){let{layer:n,layerFloorFilterClause:r,layerTimeExtent:i,view:a}=this;if(!a)return;if(!n){this.setMessage(`noLayerSelected`,`info`);return}e.x=ue(e.x,e.spatialReference);let o=n.spatialReference.equals(e.spatialReference)?e:await O(e,n.spatialReference),s=o.spatialReference.isGeographic?de(o):o,c=w(`1=1`,w(n.definitionExpression,r)),l=s.spatialReference.isGeographic?1:T(s.spatialReference),u={layerInstanceOrURL:n,point:s,queryParams:{where:c,maximumDistance:n.maximumDistance?n.maximumDistance/l:void 0,timeExtent:i}};return await this.searchBestImage(u,t)}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(e){if(_(e))return;this.setMessage(`imageLoadError`,`error`),d.getLogger(this).error(`error occurred while fetching features`,e)}}_groupFeaturesBySectors(){let{_suitabilities:e,additionalFeatures:t,features:n,invalidCameraHeading:r}=this,i=n.at(0);if(!e||!t||!i||!n||r){this._sectorData=null;return}this._sectorData={};let o={};this._featureToSector=o;for(let e of z)this._sectorData[e]=new a;let s=e.map((e,t)=>({...e,featureIndex:t}));s.sort((e,t)=>e.trueSuitability-t.trueSuitability);let c=s.map(({distance:e})=>e),l=Math.max(...c);s.forEach(e=>{let{distance:t,angle:r,featureIndex:a}=e,s=t/l*B[2],c=tt(t,l),u=nt(r);if(!this._sectorData)return;let d=B[3]+s*Math.sin(r*Math.PI/180),f=B[3]+s*Math.cos(r*Math.PI/180),p,m=n.at(a),h=m===i,{cameraPitch:g}=m.attributes,_=g<5;if(h&&_)p=-90;else{let e=d-B[3],t=f-B[3],n=t/Math.sqrt(e**2+t**2),r=Math.acos(n)*180/Math.PI;(e<0&&t<0||e<0&&t>0)&&(r*=-1),p=r}let v=c===``?u:`${c}_${u}`;h&&(p===this.bestFeatureAngle?this.previousFeatureAngle=p:this.bestFeatureAngle=p,this.navigatorCurrentBestFeature=_?null:{x:d,y:f,direction:u}),o[`${m.attributes.objectId}`]=v;let y=this._sectorData[v];y.add({angle:r,featureIndex:a,x:d,y:f,objectID:m.attributes.objectId,sector:v,featureIndexInSector:y.length})})}async _initializeLocationViewModel(e){if(!this._locationViewModel){let{default:t}=await import(`./components/ImageLocationViewModel.js`);v(e),this._locationViewModel=new t({oiViewModel:this,referenceTransformationService:this._referenceTransformationService})}}_initializeMeasurementService(){this._measurementService||=new pt({transformationService:this._transformationService,referenceTransformationService:this._referenceTransformationService})}_initializeVideo(){if(!this.currentBestFeature)return;let e=X(this.currentBestFeature.attributes.imagePath),t=X(this.videoElement?.video);if(e&&t===e&&this.videoViewModel)return;this.videoLayer&&=(this.videoMapView.map.layers.remove(this.videoLayer),this.videoLayer.destroy(),null),this.videoViewModel=m(this.videoViewModel),this.removeHandles(q.videoPlayerHandles),this.videoElement=new De({video:e??this.currentBestFeature.attributes.imagePath,georeference:new Te({extent:new oe(Le)}),autoplay:!1}),this.videoElement.content?.loop&&(this.videoElement.content.loop=!1);let n=new fe({source:this.videoElement,title:this.layer?.title,copyright:this.layer?.copyright});this.videoLayer=n,n&&this.videoMapView.map.layers.add(n),this.videoViewModel=new ut({oiViewModel:this})}async getMapPoint(e,t){let n=await this._transformationService.pixelToMapPoint(Array.isArray(e)?e:[e],t);return Array.isArray(e)?n:n[0]}async getMapPointForFeature(e,t,n){let r=await this._transformationService.pixelToMapPointForFeature(Array.isArray(e)?e:[e],t,n);return Array.isArray(e)?r:r[0]}async loadPanoramicMediaSource(e,t){let{lookAt:n,...r}=e,i=Ze(r);try{await i.load(t)}catch(e){if(_(e))return;if(e.name===`unsupported-format`){this.setMessage(`unsupportedPanoramicImageryError`,`error`,void 0,{datasetFormat:i?.extension??`UNKNOWN FORMAT`});return}}let a=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer;await a.loadMedia(i,t),n&&a.set(n)}async loadMediaSource(e,t){let n=Qe(e);await this._setImageSource(this.triangularMeasurementActive?this.imageMeasurementViewer:this._imageViewer,n,t)}_clearFeatureGeometries(){this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll()}_checkFeatures(e){return e?.length?!0:(this.emit(`no-image-found`),this.setMessage(`noImageError`,`error`),this.videoElement?.content?.pause(),this.currentBestFeature=null,!1)}async _getElevationSampleFromGround(e,t,n){if(!e[0])return;let{unionExecuteMany:r}=await import(`../../geometry/operators/unionOperator.js`),i=r(e);if(this._updateFootprintWithFeatures(t,i),this.view?.type===`3d`)try{return await this.view.map.ground.createElevationSampler(this.footprintExtent,n)}catch(e){if(_(e))throw e;d.getLogger(this).error(e);return}}async processElevationSample(e,t,n){let{elevationSource:r}=t[0].attributes,i=await this._getElevationSampleFromGround(e,t,n);if(this.view?.type===`3d`||i)return i;if(r&&this.footprintExtent&&ve(r))return await be({extent:this.footprintExtent,lod:r.lod,url:r.url,rasterFunction:r.rasterFunction})}_processSuitableFeatures(e,t){return pe({features:e,selectedPoint:t,camera:$e(this.view)?this.view.camera:null,currentImage:this.currentBestFeature})}async _processHitTestResults(e,t,n){let{results:[r]}=t;if(r?.type!==`graphic`){this.beforeLoad(!1),this.emit(`no-image-found`),this.setMessage(`noImageError`,`error`);return}let i=r.graphic.getAttribute(e.objectIdField);return await this.showImageByObjectId(i,n)}async _queryAndLoadByObjectId(e,t,n,r,i){this.displayMessage=null;let{response:a}=await ft(e,t,n,r,i);if(v(i),!a?.features?.length)throw new dt(t);let{attributes:o}=a.features[0],s,c;if(s=i?.selectedPoint?j(i.selectedPoint):void 0,!s){if(o.orientedImageryType?.includes(`360`)){s=j(o.geometry);let{cameraHeading:e,farDistance:t,nearDistance:n}=o,r=[Math.sin(p(e)),Math.cos(p(e))],i=(t+n)/2;c=T(s.spatialReference),s.x+=i*r[0]/c,s.y+=i*r[1]/c,s.z=void 0}else{let e=await this.processFeatureElevation(a.features,o.geometry.clone(),i);v(i),await this._updateElevationOfSelectedPointAndLocations(a.features,o.geometry.clone(),e??void 0,i),v(i);let t=V(o).polygon,n=D.fromJSON(ce(t));s=j(n),c=T(s.spatialReference)}}this.selectedPoint=s,c=T(s.spatialReference);let l={layerInstanceOrURL:e,point:s,queryParams:{where:w(w(`1=1`,w(e.definitionExpression,n)),`${e.objectIdField} <> ${t}`),maximumDistance:e.maximumDistance?e.maximumDistance/c:void 0,timeExtent:r}},u=await A(l,i);v(i);let{features:d}=u;return d.push(a.features[0]),await this.processFeatureResponse(u,s,{...i,loadBestImage:!1})}_reorderTriangularSketchLayer(){let e=this.imageMeasurementViewer.imageRenderer.map.layers?.length;this.sketchTriangularGraphicsLayer&&e&&this.imageMeasurementViewer.imageRenderer.map.layers.reorder(this.sketchTriangularGraphicsLayer,e-1)}async _setImageSource(e,t,n){e.media=t,await e.loadMedia(t,n)}async _restoreNavigationViewState(e,t){let n=e?.center?await this._transformationService.pointToPixel(e.center,t):null;if(v(t),this.mode===`panoramic`){let t=J(this._panoramicViewer.media);if(!t)return;bt({viewState:e,panoramicViewer:this._panoramicViewer,horizonAngles:t,imageCenter:n})}xt({viewState:e,imageViewer:this._imageViewer,imageCenter:n})}_toggleVisiblity(e,t){e.forEach(e=>{e.visible=t})}async _updateElevationOfSelectedPointAndLocations(e,t,n,r){let{cameraHeight:i}=e[0].attributes,a=e[0].attributes.location,o=await N(a.spatialReference,a.z,i,{elevationSample:n,elevationSource:this.view?.type===`3d`||n?void 0:e[0].attributes.elevationSource,extent:this.footprintExtent},r);v(r);let[s,...c]=await ye([t,...e.map(e=>e.attributes.geometry.clone())],o);v(r),t.elevation=s.z,e.forEach((e,t)=>{e.attributes.elevation=c[t].z;let n=this.pointSources.find(t=>t.imageID===e.attributes.objectId);n&&(n.z=e.attributes.location.z)})}_updateFeatures(e,t=!0){e.length?(this.features.removeAll(),this.features.addMany(e),this.navigationNodes.removeAll(),this.navigationNodes.addMany(e.map(e=>{let{geometry:t,attributes:n}=e,{isSpherical:r,cameraHeading:i,cameraPitch:a}=n;return new lt({geometry:t,attributes:n,currentHeading:r?0:i,currentPitch:r?0:a})})),e.length>1?this.additionalFeatures.addMany(e.slice(1)):this.additionalFeatures.removeAll(),t&&(this.currentBestFeature=e[0])):(this.currentBestFeature=null,this.additionalFeatures.removeAll())}_updateFootprintWithFeatures(e,t){let n=[];for(let{attributes:{geometry:r}}of e)t.contains(r)||n.push([r.x,r.y]);n.sort((e,t)=>+le([e,t])),t.addRing(n),this.footprintExtent=Ae(t.extent,2,2)}_scheduleVideoInteractionUpdate(){this.scheduledFrameId||=requestAnimationFrame(()=>{this.scheduledFrameId=null,this._updateInteraction()})}async _updatePointsAndPolygons(e){let{pointSources:n,currentBestFeature:r,currentCoverageVisible:i,isAdditionalPointSourcesVisible:a,mode:o,layer:s}=this;if(r&&(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(let o of n){let n=this.view&&!this.view.spatialReference?.equals(o.spatialReference)?await O(o.clone(),this.view?.spatialReference,e):o.clone();o.imageID===r.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:o.imageID},geometry:n,symbol:We,visible:i}):this.additionalCameraLocations.push(new t({attributes:{imageID:o.imageID},geometry:n,symbol:Ge,visible:a}))}(o===`video`||o===`panoramic-video`)&&(await this.initializeTransformationService(e),s&&!this.videoFeatureIndex.length&&await this.updateFeatureCache(s),this.cacheHydratedVideoFeature(r))}}_scheduleCurrentBestFeatureUpdate(e){h(this._navigationViewStateTask);let t=i(async t=>{await this._updateCurrentBestFeature(e,{signal:t})});this._navigationViewStateTask=t,t.promise.catch(e=>{if(!_(e))throw e}).finally(()=>{this._navigationViewStateTask===t&&(this._navigationViewStateTask=null)})}async _updateCurrentBestFeature(e,t){if(!e)return;if(await this._capturePendingNavigationViewState(t),v(t),this.currentBestFeature=this.features?.at(e.featureIndex),this.mode===`video`){this.currentBestFeature&&this.videoViewModel?.playVideoFromSelectedLocation(this.currentBestFeature);return}if(this.mode===`panoramic-video`){this.currentBestFeature&&this._panoramicVideoViewer.viewModel.playPanoramicVideoFromSelectedLocation(this.currentBestFeature);return}let n=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5,r;if(n)r=-90;else{let t=e.x-B[3],n=e.y-B[3],i=n/Math.sqrt(t**2+n**2),a=Math.acos(i)*180/Math.PI;(t<0&&n<0||t<0&&n>0)&&(a*=-1),r=a}r===this.bestFeatureAngle?this.previousFeatureAngle=r:this.bestFeatureAngle=r,this.navigatorCurrentBestFeature=n?null:{x:e.x,y:e.y,direction:e.sector.includes(`_`)?e.sector.split(`_`)[1]:e.sector},this.mode===`panoramic`&&(await b(()=>this.state===`image-loaded`,t),v(t),await this.restorePendingPanoramicNavigationViewState(t))}async _capturePendingNavigationViewState(e){this.mode==="default"?await this._capturePendingDefaultNavigationViewState(e):this.mode===`panoramic`&&await this._capturePendingPanoramicNavigationViewState(e)}async _capturePendingDefaultNavigationViewState(e){try{let{imageSize:t,imageRenderer:n}=this._imageViewer,r=n.center;if(this.state!==`image-loaded`||!t[0]||!t[1]||!r){this._pendingDefaultNavigationViewState=null;return}let i=yt(r,`default`,t),a=await this._getMapPointInViewSpatialReference(i,e);v(e),this._pendingDefaultNavigationViewState={center:a,scale:n.scale}}catch(e){this._handlePendingNavigationViewStateCaptureError(e)}}async _capturePendingPanoramicNavigationViewState(e){let t=J(this._panoramicViewer.media);if(t)try{let{fov:n,imageSize:r,pitch:i,yaw:a}=this._panoramicViewer;if(this.state!==`image-loaded`||!r||!n){this._pendingPanoramicNavigationViewState=null;return}let[o,s]=Ce(a,i,t),c=we(o,s,r[0],r[1]),l=await this._getMapPointInViewSpatialReference(c,e);v(e),this._pendingPanoramicNavigationViewState={center:l,fov:n}}catch(e){this._handlePendingNavigationViewStateCaptureError(e)}}_handlePendingNavigationViewStateCaptureError(e){if(_(e))throw e;d.getLogger(this).warn(`oriented-imagery-viewer:failed-to-capture-navigation-view-state`,e)}_updateImageMeasurementBestFeature(e){e&&(this.currentBestFeatureMeasurementImage=this.features?.at(e.featureIndex))}clearGraphics(){this._imageViewer.clearGraphics(),this._panoramicViewer.clearGraphics(),this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics()}clearReferencePointOnImage(){this._referencePointOnImage&&=(this._imageViewer.removeGraphic(this._referencePointOnImage),this._panoramicViewer.removeGraphic(this._referencePointOnImage),this._panoramicVideoViewer.removeGraphic(this._referencePointOnImage),m(this._referencePointOnImage)),this.videoViewModel?.clearReferencePointOnVideo()}async initializeReferenceTransformationService(e){let{currentBestFeatureMeasurementImage:t,activeTriangulatedViewer:n,mode:r}=this;if(!t||!n||!n.imageSize||r!==`panoramic`&&r!=="default")return;let{imageSize:i}=n,{attributes:a,elevationSample:o}=t,{cameraHeight:s,elevationSource:c}=a,l=a.location;l.spatialReference.isGeographic&&(l=j(l));let u={...r==="default"?P(a,i[0],i[1]):U(a,i[0],i[1]),cameraLocation:l},d=await N(l.spatialReference,l.z??0,s,{elevationSample:o,elevationSource:this.view?.type===`3d`?void 0:c,extent:this.footprintExtent},e),f=(await import(`./services/TransformationService.js`)).default,p={imageToWorldProperties:u,updateElevationProps:d,mode:r,imageSize:i,depthImageService:this.depthImage};this._referenceTransformationService=new f(p),this._locationViewModel&&(this._locationViewModel.referenceTransformationService=this._referenceTransformationService),this._measurementService&&(this._measurementService.referenceTransformationService=this._referenceTransformationService)}async initializeTransformationService(e){let{currentBestFeature:t,activeViewer:n,mode:r}=this,i=r===`video`||r===`panoramic-video`?L:n?.imageSize;if(!t||!i||r===`none`)return;let{attributes:a,elevationSample:o}=t,{cameraHeight:s,elevationSource:c}=a,l=a.location;l.spatialReference.isGeographic&&(l=j(l));let u=r==="default"||r===`video`?`default`:`panoramic`,d={...u==="default"?P(a,i[0],i[1]):U(a,i[0],i[1]),cameraLocation:l},f=await N(l.spatialReference,l.z??0,s,{elevationSample:o,elevationSource:this.view?.type===`3d`?void 0:c,extent:this.footprintExtent},e),p=(await import(`./services/TransformationService.js`)).default,m={imageToWorldProperties:d,updateElevationProps:f,mode:u,imageSize:i,depthImageService:this.depthImage};this._transformationService=new p(m),this._measurementService&&(this._measurementService.transformationService=this._transformationService)}plotReferencePoint(e){`mapPoint`in e?this.plotReferencePointOnGround(e.mapPoint):this.plotReferencePointOnGround(e)}clearSelectedPointOnViewer(){this._crossSymbol?this.mode===`video`?(this.videoViewModel?.clearSelectedPointOnVideo(),this._crossSymbol=null):(this._panoramicViewer.removeGraphic(this._crossSymbol),this._imageViewer.removeGraphic(this._crossSymbol),this.videoMapView.graphics.remove(this._crossSymbol),this._crossSymbol=m(this._crossSymbol)):this.videoViewModel?.clearSelectedPointOnVideo()}setMessage(e,t,n,r){this.displayMessage={key:e,type:t,data:n,map:r}}async transformAndPlotSelectedLocation(e){let{invalidCameraHeading:t,selectedPoint:n,activeViewer:r,videoElement:i}=this,a=this.mode===`video`?this.videoViewModel?.closestFeature??this.currentBestFeature:this.currentBestFeature;this.clearSelectedPointOnViewer();let o=this.mode===`video`?i?.loaded===!0&&this.videoViewModel?.videoPaused===!0:r?.state===`image-loaded`;if(!n||!a||!o||t||this.mode===`video`&&!await ot(n,this.bestFeatureCurrentFootprint?.geometry,e))return;let s;try{if(s=this.mode===`video`?await this.getPixelLocationForFeature(n,{feature:a,mode:this.mode,imageSize:L,footprintExtent:this.footprintExtent},e):await this._transformationService.pointToPixel(n,{signal:e?.signal}),this.mode===`video`&&!st(s))return;v(e),await this.plotSelectedPointOnImage(s,e)}catch(e){_(e)||d.getLogger(this).error(`failed to transform map point to pixel, cross symbol will not be plotted on image`,{error:e,selectedPoint:n,feature:a})}}updateCurrentCoveragePolygon(e){let{additionalFootprints:n,additionalCameraLocations:r,currentBestFeature:i,currentBestFeatureLocation:a,currentCoverageVisible:o,selectedPoint:s,view:c}=this;if(!i)return;let{attributes:{objectId:l}}=i;if(this._initialCurrentCoverageUpdate){if(this._overlays?.removeAll(),this._initialCurrentCoverageUpdate=!1,this.bestFeatureCurrentFootprint=m(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=o,this.bestFeatureCurrentFootprint=e),c){let e=[...n,...r,a].filter(et);s&&(this.bestFeatureCurrentFootprint&&e.splice(-2,0,this.bestFeatureCurrentFootprint),e.push(new t({geometry:s.clone(),symbol:W.clone(),attributes:{imageID:l}}))),this._overlays.graphics.addMany(e)}}else if(c){if(this.invalidCameraHeading){this._superimposeService.clear();return}this.bestFeatureCurrentFootprint&&=(this._overlays?.remove(this.bestFeatureCurrentFootprint),m(this.bestFeatureCurrentFootprint));let t=this.bestFeatureCurrentFootprint&&this._overlays?this._overlays.graphics.indexOf(this.bestFeatureCurrentFootprint):-1;e&&(this.bestFeatureCurrentFootprint=e,e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}_updateSuperimposedImage(){if(!this._hasActiveSuperimposeCameraContext())return;let e=this.mode===`panoramic`?this._panoramicViewer:null,{currentBestFeature:t,defaultSuperimposeCameraLockEnabled:n,layer:r,mode:i,view:a,state:o,superimposeViewEnabled:s,superimposeViewSupported:c,activeViewer:l,depthImage:u}=this,d=this.coverageFrustums.find(({imageID:e})=>e===t?.attributes.objectId);this._superimposeService.update({activeImageSize:l?.imageSize||void 0,adapter:this._adapter,currentBestFeature:t,currentBestFeatureFrustum:d,defaultSuperimposeCameraLockEnabled:n,depthImageLoaded:u?.loaded??!1,layer:r,mode:i,panoramicCamera:e?.camera,state:o,superimposeViewEnabled:s&&c,view:a}),this.setMessage(`superimposeImageDescription`,`info`),this._superimposePreviousCurrentCoverageVisible??=this.currentCoverageVisible,this.currentCoverageVisible=!1}_getSuperimposeCameraWatchState(){let e=(this.view?.type===`3d`?this.view:null)?.camera;return[this.superimposeViewEnabled,this.superimposeViewSupported,this.mode,this.state,this.view?.type,this.view?.interacting,this.view?.navigating,e?.heading,e?.tilt,e?.fov,e?.position.x,e?.position.y,e?.position.z]}_handleSuperimposeCameraChange(){let e=this.view,t=e?.type===`3d`?e:null;this._hasActiveSuperimposeCameraContext()?this.mode===`panoramic`?this._schedulePanoramicSuperimposeUpdate():!t||t.interacting||t.navigating?this._abortSuperimposeSchedule():this._scheduleDefaultSuperimposeUpdate():this._abortSuperimposeSchedule()}_shouldDisableUnsupportedSuperimposeView(){return this.superimposeViewEnabled&&this.mode===`panoramic`&&!this.superimposeViewSupported}_hasActiveSuperimposeCameraContext(){return(this.mode==="default"||this.mode===`panoramic`)&&this.superimposeViewEnabled&&this.superimposeViewSupported&&this.state===`image-loaded`&&this.view?.type===`3d`&&!!this.view.camera}_abortSuperimposeSchedule(){this._superimposeScheduleController?.abort(),this._superimposeScheduleController=null,this._clearSuperimposeDebounceTimeout(),this._clearSuperimposeScheduledFrame()}_resetInactiveSuperimposeState(){let e=this._superimposePreviousCurrentCoverageVisible!=null;this._abortSuperimposeSchedule(),this._adapter?.disableDefaultSuperimposeNavigation?.(),this._adapter?.disablePanoramicSuperimposeNavigation?.(),this._superimposeService.clear(),this._restoreCurrentCoverageVisibilityAfterSuperimpose(),this._restoreDefaultMessageAfterSuperimpose(),e&&this._restoreViewerMediaAfterSuperimpose()}_restoreCurrentCoverageVisibilityAfterSuperimpose(){this._superimposePreviousCurrentCoverageVisible!=null&&(this.currentCoverageVisible=this._superimposePreviousCurrentCoverageVisible,this._superimposePreviousCurrentCoverageVisible=null)}_restoreViewerMediaAfterSuperimpose(){let{currentBestFeature:e,mode:t}=this;if(!e||t!=="default"&&t!==`panoramic`)return;this._restoreSuperimposeMediaTask?.abort();let n=i(async t=>{await this._loadCurrentFeatureMedia(e,{signal:t})});this._restoreSuperimposeMediaTask=n,n.promise.finally(()=>{this._restoreSuperimposeMediaTask===n&&(this._restoreSuperimposeMediaTask=null)})}_restoreDefaultMessageAfterSuperimpose(){this.displayMessage?.key===`superimposeImageDescription`&&(this.currentBestFeature&&(this.mode==="default"||this.mode===`panoramic`)?this.displayMessage=null:this.setMessage(`onLoadMessage`,`info`))}_clearSuperimposeDebounceTimeout(){this.superimposeDebounceTimeoutId!=null&&(clearTimeout(this.superimposeDebounceTimeoutId),this.superimposeDebounceTimeoutId=null)}_clearSuperimposeScheduledFrame(){this.superimposeScheduledFrameId!=null&&(cancelAnimationFrame(this.superimposeScheduledFrameId),this.superimposeScheduledFrameId=null)}_schedulePanoramicSuperimposeUpdate(){this._abortSuperimposeSchedule(),this.superimposeDebounceTimeoutId=window.setTimeout(()=>{this.superimposeDebounceTimeoutId=null,this._hasActiveSuperimposeCameraContext()&&this.mode===`panoramic`&&this._updateSuperimposedImage()},150)}_scheduleDefaultSuperimposeUpdate(){let e=this.view;if(!(e?.type===`3d`&&e)||this.superimposeScheduledFrameId)return;this._superimposeScheduleController?.abort();let t=new AbortController,{signal:n}=t,r=()=>{this._clearSuperimposeDebounceTimeout(),this._clearSuperimposeScheduledFrame(),this._superimposeScheduleController===t&&(this._superimposeScheduleController=null),n.removeEventListener(`abort`,r)};this._superimposeScheduleController=t,n.addEventListener(`abort`,r),this.superimposeScheduledFrameId=requestAnimationFrame(()=>{if(n.removeEventListener(`abort`,r),this.superimposeScheduledFrameId=null,this._superimposeScheduleController===t&&(this._superimposeScheduleController=null),n.aborted)return;let e=this.view,i=e?.type===`3d`?e:null;this._hasActiveSuperimposeCameraContext()&&i!=null&&!i.interacting&&!i.navigating&&this._updateSuperimposedImage()})}};e([E()],$.prototype,`activeLayer`,null),e([E({readOnly:!0})],$.prototype,`activeViewer`,null),e([E()],$.prototype,`activeTriangulatedViewer`,null),e([E()],$.prototype,`accuracyParametersMissing`,null),e([E()],$.prototype,`additionalFeatures`,void 0),e([E({type:a.ofType(t)})],$.prototype,`additionalCameraLocations`,void 0),e([E({type:a.ofType(t)})],$.prototype,`additionalFootprints`,void 0),e([E()],$.prototype,`areaMeasurementResult`,void 0),e([E()],$.prototype,`areaMeasurementAccuracy`,void 0),e([E()],$.prototype,`bestFeatureAngle`,void 0),e([E()],$.prototype,`bestFeatureCurrentFootprint`,void 0),e([E({type:t})],$.prototype,`bestFeatureFootprint`,void 0),e([E({type:Number})],$.prototype,`brightness`,null),e([E()],$.prototype,`cameraHeadingThreshold`,void 0),e([E()],$.prototype,`cameraPitchThreshold`,void 0),e([E()],$.prototype,`clickAction`,void 0),e([E()],$.prototype,`correctedLocationPointOnImage`,void 0),e([E()],$.prototype,`videoViewModel`,void 0),e([E()],$.prototype,`collectionId`,void 0),e([E({type:Number})],$.prototype,`contrast`,null),e([E()],$.prototype,`coverageFrustums`,void 0),e([E()],$.prototype,`coveragePolygons`,void 0),e([E()],$.prototype,`currentBestFeature`,void 0),e([E()],$.prototype,`currentBestFeatureMeasurementImage`,void 0),e([E()],$.prototype,`currentBestFeatureLocation`,void 0),e([E()],$.prototype,`currentCoverageVisible`,void 0),e([E()],$.prototype,`currentNode`,null),e([E()],$.prototype,`depthImage`,void 0),e([E()],$.prototype,`depthImageNotSupported`,null),e([E()],$.prototype,`featureCache`,void 0),e([E()],$.prototype,`videoFeatureIndex`,void 0),e([E()],$.prototype,`navigationNodes`,void 0),e([E({json:{write:!1}})],$.prototype,`determineWorkflowForFeature`,void 0),e([E({json:{write:!1}})],$.prototype,`determineWorkflowForTriangularMeasurement`,void 0),e([E()],$.prototype,`disabled`,void 0),e([E()],$.prototype,`displayMessage`,void 0),e([E()],$.prototype,`displayNewMeasurementButton`,void 0),e([E()],$.prototype,`distanceMeasurementResult`,void 0),e([E()],$.prototype,`distanceAccuracyArray`,void 0),e([E()],$.prototype,`dataCaptureLayer`,void 0),e([E({readOnly:!0})],$.prototype,`featureCount`,null),e([E()],$.prototype,`features`,void 0),e([E()],$.prototype,`groundCoordinates`,void 0),e([E()],$.prototype,`groundCoordinatesAccuracy`,void 0),e([E()],$.prototype,`groundCoordinatesAccuracyLoading`,void 0),e([E()],$.prototype,`hasPendingPanoramicNavigationViewState`,null),e([E()],$.prototype,`heightGraphic`,void 0),e([E()],$.prototype,`heightMeasurementResult`,void 0),e([E()],$.prototype,`heightMeasurementAccuracy`,void 0),e([E({readOnly:!0})],$.prototype,`imageGalleryEnabled`,null),e([E()],$.prototype,`imageGeometryField`,void 0),e([E({readOnly:!0})],$.prototype,`imageLoaded`,null),e([E()],$.prototype,`imageLocationToolState`,void 0),e([E()],$.prototype,`initialVideoMapViewExtent`,void 0),e([E({readOnly:!0})],$.prototype,`invalidCameraHeading`,null),e([E()],$.prototype,`imagePointsInView`,null),e([E()],$.prototype,`imageMeasurementViewer`,void 0),e([E()],$.prototype,`isAdditionalCoverageVisible`,void 0),e([E()],$.prototype,`isAdditionalPointSourcesVisible`,void 0),e([E()],$.prototype,`layer`,void 0),e([E()],$.prototype,`layerView`,null),e([E({readOnly:!0})],$.prototype,`layerFloorFilterClause`,null),e([E({readOnly:!0})],$.prototype,`layerTimeExtent`,null),e([E({type:Number})],$.prototype,`localPort`,void 0),e([E()],$.prototype,`locationPointOnImage`,void 0),e([E()],$.prototype,`mapImageConversionToolState`,void 0),e([E()],$.prototype,`measureType`,void 0),e([E()],$.prototype,`measurementGraphic`,void 0),e([E({readOnly:!0,value:`none`})],$.prototype,`mode`,null),e([E()],$.prototype,`navigationMode`,void 0),e([E()],$.prototype,`navigatorCurrentBestFeature`,void 0),e([E()],$.prototype,`oiObjectIdField`,void 0),e([E({type:a.ofType(t)})],$.prototype,`overlayedCameraLocations`,void 0),e([E()],$.prototype,`overlayedMapFeatures`,void 0),e([E()],$.prototype,`panoramicVideoLoaded`,null),e([E()],$.prototype,`panoramicVideoPaused`,null),e([E()],$.prototype,`pixelCoordinates`,void 0),e([E()],$.prototype,`preserveAngle`,void 0),e([E()],$.prototype,`pointSources`,void 0),e([E({readOnly:!0})],$.prototype,`popupEnabled`,null),e([E()],$.prototype,`preloadMedia`,void 0),e([E()],$.prototype,`preloadMediaSize`,void 0),e([E()],$.prototype,`previousFeatureAngle`,void 0),e([E()],$.prototype,`referencePoint`,null),e([E({readOnly:!0})],$.prototype,`sectorData`,null),e([E()],$.prototype,`selectedPoint`,void 0),e([E({type:Number})],$.prototype,`sharpness`,null),e([E()],$.prototype,`shouldShowSelectedImage`,void 0),e([E()],$.prototype,`superimposeViewEnabled`,void 0),e([E()],$.prototype,`defaultSuperimposeCameraLockEnabled`,void 0),e([E()],$.prototype,`superimposeViewSupported`,null),e([E()],$.prototype,`sketch`,void 0),e([E()],$.prototype,`sketchTriangular`,void 0),e([E()],$.prototype,`sketchTriangularGraphicsLayer`,void 0),e([E()],$.prototype,`draw`,void 0),e([E()],$.prototype,`drawAdapter`,void 0),e([E()],$.prototype,`polylineDrawAction`,void 0),e([E()],$.prototype,`scheduledFrameId`,void 0),e([E()],$.prototype,`superimposeScheduledFrameId`,void 0),e([E()],$.prototype,`superimposeDebounceTimeoutId`,void 0),e([E()],$.prototype,`sketchAdapter`,void 0),e([E({readOnly:!0})],$.prototype,`sketchGraphicsLayer`,null),e([E({readOnly:!0})],$.prototype,`state`,null),e([E({readOnly:!0})],$.prototype,`thumbnails`,null),e([E()],$.prototype,`videoExtentPoints`,null),e([E()],$.prototype,`triangularMeasurementActive`,void 0),e([E()],$.prototype,`triangulatedDistanceMeasurement`,void 0),e([E()],$.prototype,`triangulatedDistanceAccuracy`,void 0),e([E()],$.prototype,`triangulatedAreaMeasurement`,void 0),e([E()],$.prototype,`triangulatedAreaAccuracy`,void 0),e([E()],$.prototype,`triangulatedMeasurementGraphic`,void 0),e([E()],$.prototype,`triangulatedPoint`,void 0),e([E()],$.prototype,`triangulatedMeasurementAdapter`,void 0),e([E()],$.prototype,`updateFootprint`,void 0),e([E()],$.prototype,`updateVideoFootprint`,void 0),e([E()],$.prototype,`updateFootprintPanorama`,void 0),e([E()],$.prototype,`updatingTriangularMeasurementState`,void 0),e([E({value:null})],$.prototype,`view`,null),e([E()],$.prototype,`videoElement`,void 0),e([E()],$.prototype,`videoLayer`,void 0),e([E()],$.prototype,`videoMapView`,void 0),e([E()],$.prototype,`verticalFilterEnabled`,void 0),e([E()],$.prototype,`frustumSearchEnabled`,void 0),e([E()],$.prototype,`_adapter`,void 0),e([E()],$.prototype,`_defaultGraphicsLayer`,null),e([E()],$.prototype,`_highlightedFeatureHandle`,void 0),e([E()],$.prototype,`_imageViewer`,void 0),e([E()],$.prototype,`_initialCurrentCoverageUpdate`,void 0),e([E()],$.prototype,`_locationViewModel`,void 0),e([E()],$.prototype,`_measurementService`,void 0),e([E()],$.prototype,`_mediaPrefetcher`,void 0),e([E()],$.prototype,`_navigationManager`,void 0),e([E()],$.prototype,`_overlays`,void 0),e([E()],$.prototype,`_superimposePreviousCurrentCoverageVisible`,void 0),e([E()],$.prototype,`_superimposeService`,void 0),e([E({readOnly:!0})],$.prototype,`_overlaysView`,null),e([E()],$.prototype,`_panoramicVideoViewer`,void 0),e([E()],$.prototype,`_panoramicViewer`,void 0),e([E()],$.prototype,`_panoramicMeasurementViewer`,void 0),e([E()],$.prototype,`_referencePointOnGround`,void 0),e([E()],$.prototype,`_referencePointOnImage`,void 0),e([E()],$.prototype,`_referenceTransformationService`,void 0),e([E()],$.prototype,`_sectorData`,void 0),e([E()],$.prototype,`_transformationService`,void 0),e([E()],$.prototype,`_featureToSector`,void 0),e([E({readOnly:!0})],$.prototype,`_updatingHandles`,void 0),e([E()],$.prototype,`footprintExtent`,void 0),e([E()],$.prototype,`_featureChangedTask`,void 0),$=e([re(`esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel`)],$);const Tt=$;export{Tt as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import{EsriPromise as n}from"../../../../core/Promise.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{distance as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import o from"../../../../geometry/Polyline.js";import{getImageToWorldProperties as s,convertPixelLocationToSphereVertex as c}from"../../../../layers/orientedImagery/transformations/utils.js";import{formatPixels as l,getMeasurementPropertiesPanoramic as u,calculateReferenceImagePointPanoramic as d,calculateAnglePano as f,calculateTempImagePoint as p,calculateAngle as m,heightMeasurementPanoramic as h,heightMeasurement2D as g,getModeCorrectedPoint as _,calculateCorrectedPixel as v,getUnitRateFromSpatialReference as y,calculateHeightFromTemporaryDistance as b}from"../../imageMeasurementUtils.js";import{measurementPolylineSymbol as x,polylineSymbolPanoramic as S}from"../../symbols.js";import{DrawHandlerMixin as C}from"../../mixins/DrawHandlerMixin.js";let w=class extends C(n){constructor(e){super(e),this.heightMeasurementPixels=[],this.measurementAngle=null,this.tempDistance=null}async calculateHeightMeasurementInfo(e,t,n){let{currentBestFeature:r,activeViewer:i}=this.viewModel,o=i?.imageSize;if(!r||!i||!o?.length||t===`none`)return;let{attributes:c}=r,[h]=l([e],t!==`panoramic`),g=t===`panoramic`?await u(r,i?.imageSize,this.viewModel.footprintExtent):s(c,o[0],o[1]);if(t===`panoramic`){if(!g)return;let e=await d(h,g,r,n);if(!e)return;e?.heading>180&&(e.heading-=360);let t=f(h,e),i=a([h.x,h.y],[e.x,e.y]);return!t||!i?void 0:{measurementAngle:t,tempDistance:i}}let _=await p(h,g,n);if(!_)return;let v=m(h,_),y=a([h.x,h.y],[_.x,_.y]);if(v&&y)return{measurementAngle:v,tempDistance:y}}async computeHeight(e,t,n=!0){let{currentBestFeature:r,activeViewer:i,
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import{EsriPromise as n}from"../../../../core/Promise.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{distance as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import o from"../../../../geometry/Polyline.js";import{getImageToWorldProperties as s,convertPixelLocationToSphereVertex as c}from"../../../../layers/orientedImagery/transformations/utils.js";import{formatPixels as l,getMeasurementPropertiesPanoramic as u,calculateReferenceImagePointPanoramic as d,calculateAnglePano as f,calculateTempImagePoint as p,calculateAngle as m,heightMeasurementPanoramic as h,heightMeasurement2D as g,getModeCorrectedPoint as _,calculateCorrectedPixel as v,getUnitRateFromSpatialReference as y,calculateHeightFromTemporaryDistance as b}from"../../imageMeasurementUtils.js";import{measurementPolylineSymbol as x,polylineSymbolPanoramic as S}from"../../symbols.js";import{DrawHandlerMixin as C}from"../../mixins/DrawHandlerMixin.js";let w=class extends C(n){constructor(e){super(e),this.heightMeasurementPixels=[],this.measurementAngle=null,this.tempDistance=null}async calculateHeightMeasurementInfo(e,t,n){let{currentBestFeature:r,activeViewer:i}=this.viewModel,o=i?.imageSize;if(!r||!i||!o?.length||t===`none`)return;let{attributes:c}=r,[h]=l([e],t!==`panoramic`),g=t===`panoramic`?await u(r,i?.imageSize,this.viewModel.footprintExtent):s(c,o[0],o[1]);if(t===`panoramic`){if(!g)return;let e=await d(h,g,r,n);if(!e)return;e?.heading>180&&(e.heading-=360);let t=f(h,e),i=a([h.x,h.y],[e.x,e.y]);return!t||!i?void 0:{measurementAngle:t,tempDistance:i}}let _=await p(h,g,n);if(!_)return;let v=m(h,_),y=a([h.x,h.y],[_.x,_.y]);if(v&&y)return{measurementAngle:v,tempDistance:y}}async computeHeight(e,t,n=!0){let{currentBestFeature:r,activeViewer:i,footprintExtent:a}=this.viewModel,o=i?.imageSize,c=r?.attributes,d=c?.orientationAccuracy;if(!c||!o||!e||e.length<2||!d)return;let f=t===`panoramic`?await u(r,i?.imageSize,a):s(c,o[0],o[1]),p=e.at(0),m=e.at(-1);if(!f||!p||!m||!d||!a)return;let _=[p,m],v=l(_,!1),y=t===`panoramic`?await h(_,f,d,r,!0,!1):await g(_,f,d,!0,n);if(!y)return;let b=await this.measurementService?.calculateHeightAccuracy({accuracyParameters:d,pixelObj:v,properties:f,height:y,currentBestFeature:r,mode:t});return b?{value:y,accuracy:b}:{value:y}}createPolylineGraphic(){let e=[this.heightMeasurementPixels[0],this.heightMeasurementPixels.at(-1)],n=this.viewModel.activeViewer?.imageRenderer.spatialReference;if(this.viewModel.heightGraphic)this.viewModel.heightGraphic.geometry=new o({paths:[e],spatialReference:n});else{let r=new o({paths:[e],spatialReference:n}),i=this.viewModel.activeViewer?.imageRenderer.effectiveTheme.accentColor;this.viewModel.heightGraphic=new t({geometry:r,symbol:x(i,2.5)}),this.viewModel.activeViewer?.addGraphic(this.viewModel.heightGraphic)}}createPolylineGraphicPano(){let e=this.viewModel.activeViewer?.imageRenderer.spatialReference,n=this.viewModel.activeViewer?.imageSize;if(!n)return;let r={x:this.heightMeasurementPixels[0][0],y:this.heightMeasurementPixels[0][1]},i={x:this.heightMeasurementPixels.at(-1)[0],y:this.heightMeasurementPixels.at(-1)[1]},a=c(r,n[0],n[1]),s=c(i,n[0],n[1]),l=[[...a],[...s]];if(this.viewModel.heightGraphic)this.viewModel.heightGraphic.geometry=new o({paths:[l],spatialReference:e});else{let n=new o({paths:[l],spatialReference:e});this.viewModel.heightGraphic=new t({geometry:n,symbol:S}),this.viewModel.activeViewer?.addGraphic(this.viewModel.heightGraphic,0)}}async displayHeightResults(){let{currentBestFeature:e,activeViewer:t,mode:n}=this.viewModel,r=this.heightMeasurementPixels,i=t?.imageSize;if(!e?.attributes||!i)return;let a=await this.computeHeight(r,n);a?.value&&a?.accuracy&&(this.viewModel.heightMeasurementResult=a.value,this.viewModel.heightMeasurementAccuracy=a.accuracy)}async handleCreate(e,t){if(this.draw)switch(e.type){case`cursor-update`:this.handleDrawCursorUpdateEvents(e);break;case`vertex-add`:await this.handleDrawVertexAddEvents(e,t);break;case`draw-complete`:await this.displayHeightResults(),this.resetPixels()}}resetPixels(){this.heightMeasurementPixels=[],this.measurementAngle=null,this.tempDistance=null}handleDrawCursorUpdateEvents(e){let{mode:t,activeViewer:n,currentBestFeature:r}=this.viewModel,{tempDistance:i,measurementAngle:a}=this,o=this.heightMeasurementPixels,s=n?.imageSize;if(!e.vertices||!s||!r)return;let c=_(e.vertices.at(-1),t,s);if(o.length<1||!c||!i||!a||t===`none`)return;let l=v(o[0],c,a);if(!l?.length)return;this.heightMeasurementPixels.push(l),t===`panoramic`?this.createPolylineGraphicPano():this.createPolylineGraphic();let u=y(r.attributes.location.spatialReference),d=b(this.heightMeasurementPixels,i,u);d&&(this.viewModel.heightMeasurementResult=d)}async handleDrawVertexAddEvents(e,t){let{currentBestFeature:n,activeViewer:r,mode:i}=this.viewModel,a=this.heightMeasurementPixels;if(!n||!r||!e.vertices?.length||i===`none`)return;let o=r?.imageSize;if(!a.length&&o){let n=_(e.vertices.at(-1),i,o);this.heightMeasurementPixels.push(n);let r=await this.calculateHeightMeasurementInfo(n,i,t);if(!r?.measurementAngle||!r?.tempDistance)return;this.measurementAngle=r.measurementAngle,this.tempDistance=r.tempDistance}}};e([r()],w.prototype,`heightMeasurementPixels`,void 0),e([r()],w.prototype,`measurementAngle`,void 0),e([r()],w.prototype,`tempDistance`,void 0),w=e([i(`esri.widgets.OrientedImageryViewer.adapters.draw.HeightMeasurementAdapter`)],w);const T=w;export{T as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import{createTask as n}from"../../../../core/asyncUtils.js";import{EsriPromise as r}from"../../../../core/Promise.js";import{isAbortError as i,throwIfAborted as a}from"../../../../core/promiseUtils.js";import{property as o,subclass as s}from"../../../../core/accessorSupport/decorators.js";import c from"../../../../geometry/Polygon.js";import l from"../../../../geometry/Polyline.js";import{load as u}from"../../../../geometry/projectionUtils.js";import d from"../../../../geometry/SpatialReference.js";import f from"../../../../layers/GraphicsLayer.js";import{convertSphereVertexToPixelLocation as p,convertPixelToHeadingPitch as m,convertHeadingPitchToSphereVertex as h}from"../../../../layers/orientedImagery/transformations/utils.js";import{getMeasurementProperties as g,getMeasurementPropertiesPanoramic as _,pixelAreaMeasurement2D as v,pixelAreaMeasurementPanoramic as y,pixelDistanceMeasurement2D as b,pixelDistanceMeasurementPanoramic as x,getPixelLocationFromSphereVertices as S,formatPixels as C,imageToImageTransform as w,imageToImageTransformPanoramic as T}from"../../imageMeasurementUtils.js";import{extractHorizonAnglesFromMedia as E}from"../../utils.js";import{SketchHandlerMixin as D}from"../../mixins/SketchHandlerMixin.js";import O from"../../../Sketch/SketchViewModel.js";let k=[],A=[],j=0,M=class extends D(r){constructor(e){super(e),this.type=`measurement`,this.measurementArray=[],this.pixelMeasurement=0,this.pixelAreaMeasurement=0,this.polygonVertices=[],this._calculationTask=null,this._distanceCalculation=0,this._areaCalculation=null}initialize(){this.addResolvingPromise(u())}async handleCreate(e){try{let t=e.toolEventInfo;switch(e.tool){case`polyline`:await this.handlePolylineEvents(e,t);break;case`polygon`:await this.handlePolygonEvents(e,t)}}catch(e){if(!i(e))throw e}}handleDelete(e){this.resetDistanceMeasurements(),this.resetAreaMeasurements()}handleDestroy(){this.resetDistanceMeasurements(),this.resetAreaMeasurements()}async calculateAreaMeasurement(e,t,n){if(e.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize||this.viewModel.mode===`none`)return null;let r=t==="default"?await g(this.viewModel.currentBestFeature,this.viewModel.activeViewer?.imageSize,this.viewModel.footprintExtent):await _(this.viewModel.currentBestFeature,this.viewModel.activeViewer?.imageSize,this.viewModel.footprintExtent);return a(n),r?t==="default"?await v(e,r,!0):await y(e,r,!0,n):null}async calculateDistanceMeasurement(e,t,n){let{currentBestFeature:r,activeViewer:i}=this.viewModel;if(e.length<2||!r||!i?.imageSize||t===`none`)return null;let o=t==="default"?await g(r,i?.imageSize,this.viewModel.footprintExtent):await _(r,i?.imageSize,this.viewModel.footprintExtent);return a(n),o?t==="default"?await b([e.at(0),e.at(-1)],o,!0):await x([e.at(0),e.at(-1)],o,!0):null}cursorUpdatePolylineHandler(e){let{mode:t,activeViewer:n}=this.viewModel;if(t===`none`||!n?.imageSize)return;if(t==="default")this.measurementArray.push(e.coordinates);else{let t={x:e.coordinates[0],y:e.coordinates[1],z:e.coordinates[2]},r=p(t,n.imageSize[0],n.imageSize[1]);this.measurementArray.push([r.x,r.y])}let r=A.reduce((e,t)=>e+t,0)+this.pixelMeasurement;this.viewModel.distanceMeasurementResult=r}async cursorUpdatePolygonHandler(e){let{mode:t,activeViewer:n}=this.viewModel;if(t===`none`||!n?.imageSize)return;let r=e.coordinates;if(k=[...this.polygonVertices],t==="default")k.push(r);else{let e={x:r[0],y:r[1],z:r[2]},t=p(e,n?.imageSize[0],n?.imageSize[1]);k.push([t.x,t.y])}if(k.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return;let i=k[0];k=k.filter((e,t)=>t===0||t===k.length-1||JSON.stringify(e)!==JSON.stringify(i));let a=await this._getAreaFromTask(k);a?.area&&a?.perimeter&&(j=a.area)}async handlePolylineEvents(e,t){let{currentBestFeature:n,activeViewer:r,mode:i,view:a}=this.viewModel,o=!this.viewModel.accuracyParametersMissing;if(e.state===`cancel`){this.resetDistanceMeasurements(),this.viewModel.distanceMeasurementResult=0,this.viewModel.distanceAccuracyArray=[];return}if(e.state===`complete`&&e.graphic){if(this.viewModel.activeViewer?.addGraphic(e.graphic),this.viewModel.triangularMeasurementActive&&n){let t={pixels:e.graphic.geometry.paths[0],activeFeature:n,activeViewer:r,mode:i,spatialReference:a?.spatialReference};await this.measurementService?.updateMeasurementVectorsArray(t),await this._overlayFirstMeasurement(e.graphic,e.tool)}this.viewModel.measurementGraphic=e.graphic,this.resetDistanceMeasurements();return}switch(t?.type){case`cursor-update`:this.cursorUpdatePolylineHandler(t);break;case`vertex-add`:if(this.measurementArray.length&&o){let e=await this._getAccuracyFromTask();e&&this.viewModel.distanceAccuracyArray.push(e)}this.vertexUpdatePolylineHandler()}let s=await this._getDistanceFromTask();this.pixelMeasurement=s??this.pixelMeasurement}async handlePolygonEvents(e,t){let{currentBestFeature:n,activeViewer:r,mode:i,view:a,accuracyParametersMissing:o}=this.viewModel;if(e.state===`cancel`)this.resetAreaMeasurements(),this.viewModel.areaMeasurementResult=0,this.viewModel.areaMeasurementAccuracy=0;else if(e.state===`complete`&&e.graphic){if(this.viewModel.activeViewer?.addGraphic(e.graphic),!o&&!this.viewModel.triangularMeasurementActive){let e=await this._getAreaAccuracyFromTask(this.polygonVertices);this.viewModel.areaMeasurementAccuracy=e||this.viewModel.areaMeasurementAccuracy}if(this.viewModel.triangularMeasurementActive&&n){let t={pixels:e.graphic.geometry.rings[0],activeFeature:n,activeViewer:r,mode:i,spatialReference:a?.spatialReference};await this.measurementService?.updateMeasurementVectorsArray(t),await this._overlayFirstMeasurement(e.graphic,e.tool)}this.viewModel.measurementGraphic=e.graphic,this.resetAreaMeasurements()}else{switch(t?.type){case`vertex-add`:await this.vertexAddPolygonHandler(t);break;case`cursor-update`:await this.cursorUpdatePolygonHandler(t)}this.viewModel.areaMeasurementResult=j>0?j:this.pixelAreaMeasurement}}async vertexAddPolygonHandler(e){let{mode:t,activeViewer:n}=this.viewModel,r=e.added,i=r[r.length-1];if(!Array.isArray(i)||t===`none`||!n?.imageSize)return;if(t==="default")this.polygonVertices.push(i);else{let e={x:i[0],y:i[1],z:i[2]},t=p(e,n?.imageSize[0],n?.imageSize[1]);this.polygonVertices.push([t.x,t.y])}if(this.polygonVertices.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return;let a=this.polygonVertices[0];this.polygonVertices=this.polygonVertices.filter((e,t)=>t===0||t===this.polygonVertices.length-1||JSON.stringify(e)!==JSON.stringify(a));let o=await this._getAreaFromTask(this.polygonVertices);if(!o?.area||!o?.perimeter)return;let{area:s}=o;this.pixelAreaMeasurement=s}vertexUpdatePolylineHandler(){this.measurementArray=this.measurementArray.slice(-1);let e=A.reduce((e,t)=>e+t,0)+this.pixelMeasurement;this.viewModel.distanceMeasurementResult=e,this.pixelMeasurement>0&&A.push(this.pixelMeasurement)}resetDistanceMeasurements(){this.measurementArray=[],this.pixelMeasurement=0,A=[]}resetAreaMeasurements(){this.polygonVertices=[],this.pixelAreaMeasurement=0,j=0}async _editOverlayedGraphics(e){this.viewModel.sketchTriangularGraphicsLayer||this._initializeSketchTriangularGraphicsLayer(),this.viewModel.sketchTriangularGraphicsLayer?.destroyed&&this._handleDestroyedTriangularSketchLayer(),this.viewModel.sketchTriangularGraphicsLayer.add(e),this.viewModel.sketchTriangular||(this._initializeSketchTriangular(),await this._loadTriangulatedMeasurementAdapter()),this._updateOverlayedGeometry(e)}_handleDestroyedTriangularSketchLayer(){this.viewModel.sketchTriangularGraphicsLayer&&this.viewModel.activeTriangulatedViewer&&(this.viewModel.activeTriangulatedViewer.imageRenderer.map.layers.remove(this.viewModel.sketchTriangularGraphicsLayer),this.viewModel.sketchTriangularGraphicsLayer=new f,this.viewModel.activeTriangulatedViewer.imageRenderer.map.layers.add(this.viewModel.sketchTriangularGraphicsLayer),this.viewModel.sketchTriangular&&(this.viewModel.sketchTriangular.layer=this.viewModel.sketchTriangularGraphicsLayer,this.viewModel.sketchTriangular.view=this.viewModel.activeTriangulatedViewer.imageRenderer))}_initializeSketchTriangular(){if(!this.viewModel.activeTriangulatedViewer)return;let e=this.viewModel.mode===`panoramic`;this.viewModel.sketchTriangular=new O({view:this.viewModel.activeTriangulatedViewer.imageRenderer,layer:this.viewModel.sketchTriangularGraphicsLayer,updateOnGraphicClick:!0,defaultUpdateOptions:{toggleToolOnClick:!1,enableZ:!e}}),e&&(this.viewModel.sketchTriangular.defaultUpdateOptions.reshapeOptions={edgeOperation:`offset`,shapeOperation:`move-xy`,vertexOperation:`move-xy`})}_initializeSketchTriangularGraphicsLayer(){this.viewModel.activeTriangulatedViewer&&(this.viewModel.sketchTriangularGraphicsLayer=new f,this.viewModel.activeTriangulatedViewer.imageRenderer.map.layers.add(this.viewModel.sketchTriangularGraphicsLayer))}async _overlayFirstMeasurement(e,t){switch(t){case`polyline`:await this._overlayFirstDistanceMeasurement(e);break;case`polygon`:await this._overlayFirstAreaGeometry(e)}}async _overlayFirstDistanceMeasurement(e){let{mode:n,activeTriangulatedViewer:r,currentBestFeature:i,activeViewer:a,footprintExtent:o,currentBestFeatureMeasurementImage:s}=this.viewModel,c=e.geometry?.clone(),u=e.symbol?.clone(),f=r?.imageSize,p=[...c.paths[0]],m=E(r?.media),h=n==="default";if(n===`none`||n===`video`||!f||!i||!a?.imageSize||!s)return;let v=h?p:S(p,f,m),y=h?C(v,!0):v,b=h?await g(i,a?.imageSize,o):await _(i,a?.imageSize,o),x=h?await g(s,this.viewModel.imageMeasurementViewer?.imageSize,o):await _(s,this.viewModel.activeTriangulatedViewer?.imageSize,o);if(y?.length&&b&&x){let e=h?await w(y,b,x):await T(y,b,x),n=e.map(e=>[e.x-.5,-.5-e.y]),r=e.slice(0,2).map(e=>P(e,f,m)),i=new l({paths:h?[n]:[r],spatialReference:d.WebMercator}),a=new t({geometry:i,symbol:u});await this._editOverlayedGraphics(a)}}async _overlayFirstAreaGeometry(e){let{mode:n,activeTriangulatedViewer:r,currentBestFeature:i,currentBestFeatureMeasurementImage:a,activeViewer:o,footprintExtent:s}=this.viewModel,l=e.geometry?.clone(),u=e.symbol?.clone(),f=r?.imageSize,p=E(r?.media),m=[...l.rings[0]],h=n==="default";if(n===`none`||n===`video`||!f||!i||!o?.imageSize||!a)return;let v=h?m:S(m,f,p),y=h?C(v,!0):v,b=h?await g(i,o?.imageSize,s):await _(i,o?.imageSize,s),x=h?await g(a,this.viewModel.imageMeasurementViewer?.imageSize,s):await _(a,this.viewModel.activeTriangulatedViewer?.imageSize,s);if(y?.length&&b&&x){let e=h?await w(y,b,x):await T(y,b,x),n=e.map(e=>[e.x-.5,-.5-e.y]),r=e.slice(0,h?2:e.length).map(e=>P(e,f,p)),i=new c({rings:h?[n]:[r],spatialReference:d.WebMercator}),a=new t({geometry:i,symbol:u});await this._editOverlayedGraphics(a)}}async _loadTriangulatedMeasurementAdapter(e){if(!this.viewModel.triangulatedMeasurementAdapter){let{default:t}=await import(`./TriangulatedMeasurementAdapter.js`);if(a(e),this.viewModel.triangulatedMeasurementAdapter=new t({viewModel:this.viewModel,measurementService:this.measurementService}),!this.viewModel.triangulatedMeasurementAdapter.viewModel.isResolved())return}return this.viewModel.triangulatedMeasurementAdapter}async _getAreaFromTask(e){let{mode:t}=this.viewModel;return this._calculationTask?.abort(),this._calculationTask=n(async n=>{this._areaCalculation=null;let r=await this.calculateAreaMeasurement(e,t,n);a(n),this._areaCalculation=r}),await this._calculationTask.promise,this._areaCalculation}async _getDistanceFromTask(){let{mode:e}=this.viewModel;return this._calculationTask?.abort(),this._calculationTask=n(async t=>{this._distanceCalculation=0;let n=await this.calculateDistanceMeasurement(this.measurementArray,e,t);a(t),this._distanceCalculation=n}),await this._calculationTask.promise,this._distanceCalculation}async _getAccuracyFromTask(){let{mode:e,currentBestFeature:t,currentBestFeatureMeasurementImage:r,activeViewer:i,activeTriangulatedViewer:o,layer:s,footprintExtent:c}=this.viewModel,l=i?.imageSize;return e===`none`||!l?null:(this._calculationTask?.abort(),this._calculationTask=n(async n=>{this._distanceCalculation=0;let u={measurementArray:this.measurementArray,measurementType:`distance`,currentBestFeature:t,currentBestFeatureMeasurementImage:r,activeViewer:i,imageSize:l,layer:s,triangularMeasurementActive:!1,footprintExtent:c,signal:n},d={measurementArray:this.measurementArray,measurementType:`distance`,secondaryViewer:!1,currentBestFeature:t,currentBestFeatureMeasurementImage:r,activeViewer:i,activeTriangulatedViewer:o,layer:s,footprintExtent:c,signal:n},f=e==="default"?await this.measurementService?.calculateAccuracy(u):await this.measurementService?.calculateAccuracyPanoramic(d);a(n),this._distanceCalculation=f}),await this._calculationTask.promise,this._distanceCalculation)}async _getAreaAccuracyFromTask(e){let{mode:t,currentBestFeature:r,currentBestFeatureMeasurementImage:i,activeViewer:o,activeTriangulatedViewer:s,layer:c,footprintExtent:l}=this.viewModel,u=o?.imageSize;return t===`none`||!u?null:(this._calculationTask?.abort(),this._calculationTask=n(async n=>{this._distanceCalculation=0;let d={measurementArray:e,measurementType:`area`,currentBestFeature:r,currentBestFeatureMeasurementImage:i,activeViewer:o,imageSize:u,layer:c,triangularMeasurementActive:!1,footprintExtent:l,signal:n},f={measurementArray:e,measurementType:`area`,secondaryViewer:!1,currentBestFeature:r,currentBestFeatureMeasurementImage:i,activeViewer:o,activeTriangulatedViewer:s,layer:c,footprintExtent:l,signal:n},p=t==="default"?await this.measurementService?.calculateAccuracy(d):await this.measurementService?.calculateAccuracyPanoramic(f);a(n),this._distanceCalculation=p}),await this._calculationTask.promise,this._distanceCalculation)}_updateOverlayedGeometry(e){this.viewModel.sketchTriangular?.update([e],{tool:`reshape`}).catch(()=>{})}};e([o()],M.prototype,`type`,void 0),e([o()],M.prototype,`measurementArray`,void 0),e([o()],M.prototype,`pixelMeasurement`,void 0),e([o()],M.prototype,`pixelAreaMeasurement`,void 0),e([o()],M.prototype,`polygonVertices`,void 0),M=e([s(`esri.widgets.OrientedImageryViewer.adapters.sketch.MeasurementAdapter`)],M);const N=M,P=(e,t,n)=>{let{heading:r,pitch:i}=m(e,t[0],t[1]);return h(r,i,n)};export{N as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import{createTask as n}from"../../../../core/asyncUtils.js";import{EsriPromise as r}from"../../../../core/Promise.js";import{isAbortError as i,throwIfAborted as a}from"../../../../core/promiseUtils.js";import{property as o,subclass as s}from"../../../../core/accessorSupport/decorators.js";import c from"../../../../geometry/Polygon.js";import l from"../../../../geometry/Polyline.js";import{load as u}from"../../../../geometry/projectionUtils.js";import d from"../../../../geometry/SpatialReference.js";import f from"../../../../layers/GraphicsLayer.js";import{convertSphereVertexToPixelLocation as p,convertPixelToHeadingPitch as m,convertHeadingPitchToSphereVertex as h}from"../../../../layers/orientedImagery/transformations/utils.js";import{getMeasurementProperties as g,getMeasurementPropertiesPanoramic as _,pixelAreaMeasurement2D as v,pixelAreaMeasurementPanoramic as y,pixelDistanceMeasurement2D as b,pixelDistanceMeasurementPanoramic as x,getPixelLocationFromSphereVertices as S,formatPixels as C,imageToImageTransform as w,imageToImageTransformPanoramic as T}from"../../imageMeasurementUtils.js";import{extractHorizonAnglesFromMedia as E}from"../../utils.js";import{SketchHandlerMixin as D}from"../../mixins/SketchHandlerMixin.js";import O from"../../../Sketch/SketchViewModel.js";let k=[],A=[],j=0,M=class extends D(r){constructor(e){super(e),this.type=`measurement`,this.measurementArray=[],this.pixelMeasurement=0,this.pixelAreaMeasurement=0,this.polygonVertices=[],this._calculationTask=null,this._distanceCalculation=0,this._areaCalculation=null}initialize(){this.addResolvingPromise(u())}async handleCreate(e){try{let t=e.toolEventInfo;switch(e.tool){case`polyline`:await this.handlePolylineEvents(e,t);break;case`polygon`:await this.handlePolygonEvents(e,t)}}catch(e){if(!i(e))throw e}}handleDelete(e){this.resetDistanceMeasurements(),this.resetAreaMeasurements()}handleDestroy(){this.resetDistanceMeasurements(),this.resetAreaMeasurements()}async calculateAreaMeasurement(e,t,n){if(e.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize||this.viewModel.mode===`none`)return null;let r=t==="default"?await g(this.viewModel.currentBestFeature,this.viewModel.activeViewer?.imageSize,this.viewModel.footprintExtent):await _(this.viewModel.currentBestFeature,this.viewModel.activeViewer?.imageSize,this.viewModel.footprintExtent);return a(n),r?t==="default"?await v(e,r,!0):await y(e,r,!0,n):null}async calculateDistanceMeasurement(e,t,n){let{currentBestFeature:r,activeViewer:i}=this.viewModel;if(e.length<2||!r||!i?.imageSize||t===`none`)return null;let o=t==="default"?await g(r,i?.imageSize,this.viewModel.footprintExtent):await _(r,i?.imageSize,this.viewModel.footprintExtent);return a(n),o?t==="default"?await b([e.at(0),e.at(-1)],o,!0):await x([e.at(0),e.at(-1)],o,!0):null}cursorUpdatePolylineHandler(e){let{mode:t,activeViewer:n}=this.viewModel;if(t===`none`||!n?.imageSize)return;if(t==="default")this.measurementArray.push(e.coordinates);else{let t={x:e.coordinates[0],y:e.coordinates[1],z:e.coordinates[2]},r=p(t,n.imageSize[0],n.imageSize[1]);this.measurementArray.push([r.x,r.y])}let r=A.reduce((e,t)=>e+t,0)+this.pixelMeasurement;this.viewModel.distanceMeasurementResult=r}async cursorUpdatePolygonHandler(e){let{mode:t,activeViewer:n}=this.viewModel;if(t===`none`||!n?.imageSize)return;let r=e.coordinates;if(k=[...this.polygonVertices],t==="default")k.push(r);else{let e={x:r[0],y:r[1],z:r[2]},t=p(e,n?.imageSize[0],n?.imageSize[1]);k.push([t.x,t.y])}if(k.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return;let i=k[0];k=k.filter((e,t)=>t===0||t===k.length-1||JSON.stringify(e)!==JSON.stringify(i));let a=await this._getAreaFromTask(k);a?.area&&a?.perimeter&&(j=a.area)}async handlePolylineEvents(e,t){let{currentBestFeature:n,activeViewer:r,mode:i,view:a}=this.viewModel,o=!this.viewModel.accuracyParametersMissing;if(e.state===`cancel`){this.resetDistanceMeasurements(),this.viewModel.distanceMeasurementResult=0,this.viewModel.distanceAccuracyArray=[];return}if(e.state===`complete`&&e.graphic){if(this.viewModel.activeViewer?.addGraphic(e.graphic),this.viewModel.triangularMeasurementActive&&n){let t={pixels:e.graphic.geometry.paths[0],activeFeature:n,activeViewer:r,mode:i,spatialReference:a?.spatialReference};await this.measurementService?.updateMeasurementVectorsArray(t),await this._overlayFirstMeasurement(e.graphic,e.tool)}this.viewModel.measurementGraphic=e.graphic,this.resetDistanceMeasurements();return}switch(t?.type){case`cursor-update`:this.cursorUpdatePolylineHandler(t);break;case`vertex-add`:if(this.measurementArray.length&&o){let e=await this._getAccuracyFromTask();e&&this.viewModel.distanceAccuracyArray.push(e)}this.vertexUpdatePolylineHandler()}let s=await this._getDistanceFromTask();this.pixelMeasurement=s??this.pixelMeasurement}async handlePolygonEvents(e,t){let{currentBestFeature:n,activeViewer:r,mode:i,view:a,accuracyParametersMissing:o}=this.viewModel;if(e.state===`cancel`)this.resetAreaMeasurements(),this.viewModel.areaMeasurementResult=0,this.viewModel.areaMeasurementAccuracy=0;else if(e.state===`complete`&&e.graphic){if(this.viewModel.activeViewer?.addGraphic(e.graphic),!o&&!this.viewModel.triangularMeasurementActive){let e=await this._getAreaAccuracyFromTask(this.polygonVertices);this.viewModel.areaMeasurementAccuracy=e||this.viewModel.areaMeasurementAccuracy}if(this.viewModel.triangularMeasurementActive&&n){let t={pixels:e.graphic.geometry.rings[0],activeFeature:n,activeViewer:r,mode:i,spatialReference:a?.spatialReference};await this.measurementService?.updateMeasurementVectorsArray(t),await this._overlayFirstMeasurement(e.graphic,e.tool)}this.viewModel.measurementGraphic=e.graphic,this.resetAreaMeasurements()}else{switch(t?.type){case`vertex-add`:await this.vertexAddPolygonHandler(t);break;case`cursor-update`:await this.cursorUpdatePolygonHandler(t)}this.viewModel.areaMeasurementResult=j>0?j:this.pixelAreaMeasurement}}async vertexAddPolygonHandler(e){let{mode:t,activeViewer:n}=this.viewModel,r=e.added,i=r[r.length-1];if(!Array.isArray(i)||t===`none`||!n?.imageSize)return;if(t==="default")this.polygonVertices.push(i);else{let e={x:i[0],y:i[1],z:i[2]},t=p(e,n?.imageSize[0],n?.imageSize[1]);this.polygonVertices.push([t.x,t.y])}if(this.polygonVertices.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return;let a=this.polygonVertices[0];this.polygonVertices=this.polygonVertices.filter((e,t)=>t===0||t===this.polygonVertices.length-1||JSON.stringify(e)!==JSON.stringify(a));let o=await this._getAreaFromTask(this.polygonVertices);if(!o?.area||!o?.perimeter)return;let{area:s}=o;this.pixelAreaMeasurement=s}vertexUpdatePolylineHandler(){this.measurementArray=this.measurementArray.slice(-1);let e=A.reduce((e,t)=>e+t,0)+this.pixelMeasurement;this.viewModel.distanceMeasurementResult=e,this.pixelMeasurement>0&&A.push(this.pixelMeasurement)}resetDistanceMeasurements(){this.measurementArray=[],this.pixelMeasurement=0,A=[]}resetAreaMeasurements(){this.polygonVertices=[],this.pixelAreaMeasurement=0,j=0}async _editOverlayedGraphics(e){this.viewModel.sketchTriangularGraphicsLayer||this._initializeSketchTriangularGraphicsLayer(),this.viewModel.sketchTriangularGraphicsLayer?.destroyed&&this._handleDestroyedTriangularSketchLayer(),this.viewModel.sketchTriangularGraphicsLayer.add(e),this.viewModel.sketchTriangular||(this._initializeSketchTriangular(),await this._loadTriangulatedMeasurementAdapter()),this._updateOverlayedGeometry(e)}_handleDestroyedTriangularSketchLayer(){this.viewModel.sketchTriangularGraphicsLayer&&this.viewModel.activeTriangulatedViewer&&(this.viewModel.activeTriangulatedViewer.imageRenderer.map.layers.remove(this.viewModel.sketchTriangularGraphicsLayer),this.viewModel.sketchTriangularGraphicsLayer=new f,this.viewModel.activeTriangulatedViewer.imageRenderer.map.layers.add(this.viewModel.sketchTriangularGraphicsLayer),this.viewModel.sketchTriangular&&(this.viewModel.sketchTriangular.layer=this.viewModel.sketchTriangularGraphicsLayer,this.viewModel.sketchTriangular.view=this.viewModel.activeTriangulatedViewer.imageRenderer))}_initializeSketchTriangular(){if(!this.viewModel.activeTriangulatedViewer)return;let e=this.viewModel.mode===`panoramic`;this.viewModel.sketchTriangular=new O({view:this.viewModel.activeTriangulatedViewer.imageRenderer,layer:this.viewModel.sketchTriangularGraphicsLayer,updateOnGraphicClick:!0,defaultUpdateOptions:{toggleToolOnClick:!1,enableZ:!e}}),e&&(this.viewModel.sketchTriangular.defaultUpdateOptions.reshapeOptions={edgeOperation:`offset`,shapeOperation:`move-xy`,vertexOperation:`move-xy`})}_initializeSketchTriangularGraphicsLayer(){this.viewModel.activeTriangulatedViewer&&(this.viewModel.sketchTriangularGraphicsLayer=new f,this.viewModel.activeTriangulatedViewer.imageRenderer.map.layers.add(this.viewModel.sketchTriangularGraphicsLayer))}async _overlayFirstMeasurement(e,t){switch(t){case`polyline`:await this._overlayFirstDistanceMeasurement(e);break;case`polygon`:await this._overlayFirstAreaGeometry(e)}}async _overlayFirstDistanceMeasurement(e){let{mode:n,activeTriangulatedViewer:r,currentBestFeature:i,activeViewer:a,footprintExtent:o,currentBestFeatureMeasurementImage:s}=this.viewModel,c=e.geometry?.clone(),u=e.symbol?.clone(),f=r?.imageSize,p=[...c.paths[0]],m=E(r?.media),h=n==="default";if(n===`none`||n===`video`||!f||!i||!a?.imageSize||!s)return;let v=h?p:S(p,f,m),y=h?C(v,!0):v,b=h?await g(i,a?.imageSize,o):await _(i,a?.imageSize,o),x=h?await g(s,this.viewModel.imageMeasurementViewer?.imageSize,o):await _(s,this.viewModel.activeTriangulatedViewer?.imageSize,o);if(y?.length&&b&&x){let e=h?await w(y,b,x):await T(y,b,x),n=e.map(e=>[e.x-.5,-.5-e.y]),r=e.slice(0,2).map(e=>P(e,f,m)),i=new l({paths:h?[n]:[r],spatialReference:d.WebMercator}),a=new t({geometry:i,symbol:u});await this._editOverlayedGraphics(a)}}async _overlayFirstAreaGeometry(e){let{mode:n,activeTriangulatedViewer:r,currentBestFeature:i,currentBestFeatureMeasurementImage:a,activeViewer:o,footprintExtent:s}=this.viewModel,l=e.geometry?.clone(),u=e.symbol?.clone(),f=r?.imageSize,p=E(r?.media),m=[...l.rings[0]],h=n==="default";if(n===`none`||n===`video`||!f||!i||!o?.imageSize||!a)return;let v=h?m:S(m,f,p),y=h?C(v,!0):v,b=h?await g(i,o?.imageSize,s):await _(i,o?.imageSize,s),x=h?await g(a,this.viewModel.imageMeasurementViewer?.imageSize,s):await _(a,this.viewModel.activeTriangulatedViewer?.imageSize,s);if(y?.length&&b&&x){let e=h?await w(y,b,x):await T(y,b,x),n=e.map(e=>[e.x-.5,-.5-e.y]),r=e.slice(0,h?2:e.length).map(e=>P(e,f,p)),i=new c({rings:h?[n]:[r],spatialReference:d.WebMercator}),a=new t({geometry:i,symbol:u});await this._editOverlayedGraphics(a)}}async _loadTriangulatedMeasurementAdapter(e){if(!this.viewModel.triangulatedMeasurementAdapter){let{default:t}=await import(`./TriangulatedMeasurementAdapter.js`);if(a(e),this.viewModel.triangulatedMeasurementAdapter=new t({viewModel:this.viewModel,measurementService:this.measurementService}),!this.viewModel.triangulatedMeasurementAdapter.viewModel.isResolved())return}return this.viewModel.triangulatedMeasurementAdapter}async _getAreaFromTask(e){let{mode:t}=this.viewModel;return this._calculationTask?.abort(),this._calculationTask=n(async n=>{this._areaCalculation=null;let r=await this.calculateAreaMeasurement(e,t,n);a(n),this._areaCalculation=r}),await this._calculationTask.promise,this._areaCalculation}async _getDistanceFromTask(){let{mode:e}=this.viewModel;return this._calculationTask?.abort(),this._calculationTask=n(async t=>{this._distanceCalculation=0;let n=await this.calculateDistanceMeasurement(this.measurementArray,e,t);a(t),this._distanceCalculation=n}),await this._calculationTask.promise,this._distanceCalculation}async _getAccuracyFromTask(){let{mode:e,currentBestFeature:t,currentBestFeatureMeasurementImage:r,activeViewer:i,activeTriangulatedViewer:o,footprintExtent:s}=this.viewModel,c=i?.imageSize;return e===`none`||!c?null:(this._calculationTask?.abort(),this._calculationTask=n(async n=>{this._distanceCalculation=0;let l={measurementArray:this.measurementArray,measurementType:`distance`,currentBestFeature:t,currentBestFeatureMeasurementImage:r,activeViewer:i,imageSize:c,triangularMeasurementActive:!1,footprintExtent:s,signal:n},u={measurementArray:this.measurementArray,measurementType:`distance`,secondaryViewer:!1,currentBestFeature:t,currentBestFeatureMeasurementImage:r,activeViewer:i,activeTriangulatedViewer:o,footprintExtent:s,signal:n},d=e==="default"?await this.measurementService?.calculateAccuracy(l):await this.measurementService?.calculateAccuracyPanoramic(u);a(n),this._distanceCalculation=d}),await this._calculationTask.promise,this._distanceCalculation)}async _getAreaAccuracyFromTask(e){let{mode:t,currentBestFeature:r,currentBestFeatureMeasurementImage:i,activeViewer:o,activeTriangulatedViewer:s,footprintExtent:c}=this.viewModel,l=o?.imageSize;return t===`none`||!l?null:(this._calculationTask?.abort(),this._calculationTask=n(async n=>{this._distanceCalculation=0;let u={measurementArray:e,measurementType:`area`,currentBestFeature:r,currentBestFeatureMeasurementImage:i,activeViewer:o,imageSize:l,triangularMeasurementActive:!1,footprintExtent:c,signal:n},d={measurementArray:e,measurementType:`area`,secondaryViewer:!1,currentBestFeature:r,currentBestFeatureMeasurementImage:i,activeViewer:o,activeTriangulatedViewer:s,footprintExtent:c,signal:n},f=t==="default"?await this.measurementService?.calculateAccuracy(u):await this.measurementService?.calculateAccuracyPanoramic(d);a(n),this._distanceCalculation=f}),await this._calculationTask.promise,this._distanceCalculation)}_updateOverlayedGeometry(e){this.viewModel.sketchTriangular?.update([e],{tool:`reshape`}).catch(()=>{})}};e([o()],M.prototype,`type`,void 0),e([o()],M.prototype,`measurementArray`,void 0),e([o()],M.prototype,`pixelMeasurement`,void 0),e([o()],M.prototype,`pixelAreaMeasurement`,void 0),e([o()],M.prototype,`polygonVertices`,void 0),M=e([s(`esri.widgets.OrientedImageryViewer.adapters.sketch.MeasurementAdapter`)],M);const N=M,P=(e,t,n)=>{let{heading:r,pitch:i}=m(e,t[0],t[1]);return h(r,i,n)};export{N as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{EsriPromise as t}from"../../../../core/Promise.js";import{throwIfAborted as n}from"../../../../core/promiseUtils.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{projectAsync as a}from"../../../../geometry/projectionUtils.js";import{convertSphereVertexToPixelLocation as o}from"../../../../layers/orientedImagery/transformations/utils.js";import{getModeCorrectedPoints as s,computeTriangulatedVector as c,computeTriangulatedAreaMeasurement as l,computeTriangulatedDistanceMeasurement as u}from"../../imageMeasurementUtils.js";import{extractHorizonAnglesFromMedia as d}from"../../utils.js";import{TriangulatedSketchHandlerMixin as f}from"../../mixins/TriangulatedSketchHandlerMixin.js";let p=[],m=class extends f(t){constructor(e){super(e),this.type=`measurement`}async handleUpdate(e){let{measureType:t,updatingTriangularMeasurementState:n,currentBestFeature:r,currentBestFeatureMeasurementImage:i,activeTriangulatedViewer:a,activeViewer:o,
|
|
2
|
+
import{__decorate as e}from"tslib";import{EsriPromise as t}from"../../../../core/Promise.js";import{throwIfAborted as n}from"../../../../core/promiseUtils.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{projectAsync as a}from"../../../../geometry/projectionUtils.js";import{convertSphereVertexToPixelLocation as o}from"../../../../layers/orientedImagery/transformations/utils.js";import{getModeCorrectedPoints as s,computeTriangulatedVector as c,computeTriangulatedAreaMeasurement as l,computeTriangulatedDistanceMeasurement as u}from"../../imageMeasurementUtils.js";import{extractHorizonAnglesFromMedia as d}from"../../utils.js";import{TriangulatedSketchHandlerMixin as f}from"../../mixins/TriangulatedSketchHandlerMixin.js";let p=[],m=class extends f(t){constructor(e){super(e),this.type=`measurement`}async handleUpdate(e){let{measureType:t,updatingTriangularMeasurementState:n,currentBestFeature:r,currentBestFeatureMeasurementImage:i,activeTriangulatedViewer:a,activeViewer:o,imageMeasurementViewer:s,mode:c,footprintExtent:l,view:u}=this.viewModel;if(i&&r&&t&&(this._preventLeftMouseDrag(),t===`distance`?p=e.graphics[0].geometry.paths[0]:t===`area`&&(p=e.graphics[0].geometry.rings[0]),e.state===`complete`)){if(this.viewModel.triangulatedMeasurementGraphic=e.graphics.at(-1),n)await this._updateTriangularMeasurements(p);else{let e={pixels:p,activeFeature:i,activeViewer:a,mode:c,spatialReference:u?.spatialReference};await this.measurementService?.updateMeasurementVectorsArray(e);let n={pixels:p,measureType:t,currentBestFeature:r,currentBestFeatureMeasurementImage:i,activeViewer:o,activeTriangulatedViewer:a,mode:c,imageSize:s?.imageSize,footprintExtent:l},d=await this.measurementService?.calculateTriangulatedMeasurements(n);d&&(t===`distance`?(this.viewModel.triangulatedDistanceMeasurement=d.distance,this.viewModel.triangulatedDistanceAccuracy=d.accuracy):t===`area`&&(this.viewModel.triangulatedAreaMeasurement=d.area,this.viewModel.triangulatedAreaAccuracy=d.accuracy??this.viewModel.triangulatedAreaAccuracy))}}}async _computeMeasurementVector(e,t){let{activeViewer:n,activeTriangulatedViewer:r,mode:i,view:o}=this.viewModel,l=n?.imageSize,u=d(r?.media);if(!e||!t||!l)return;let f=s(e,i,l,u),p=o?.spatialReference,m=[];for(let e=0;e<f.length;e++){let t={x:f[e][0],y:f[e][1]},n=await this.measurementService?.referenceTransformationService?.pixelToMapPoint(t);if(!n)return;p&&!n.spatialReference.equals(p)&&(n=await a(n,p)),m.push(n)}return c(m,t)}async _updateTriangularMeasurements(e,t){let{measureType:r,mode:i,activeTriangulatedViewer:a,activeViewer:s,footprintExtent:c,triangularMeasurementActive:d,currentBestFeature:f,currentBestFeatureMeasurementImage:p,updatingTriangularMeasurementState:m}=this.viewModel,h=a?.imageSize;if(!d||!p||!m||!a?.imageSize||this.measurementService?.measurementVectors?.length!==2||!h)return;let[g,_]=a.imageSize;this.measurementService.measurementVectors.splice(-1);let v=await this._computeMeasurementVector(e,p);if(n(t),v&&this.measurementService.measurementVectors.push(v),this.measurementService.measurementVectors.length===2){switch(r){case`distance`:{this.viewModel.triangulatedDistanceMeasurement=await u(this.measurementService.measurementVectors),n(t);let r=e.map(([e,t,n])=>{let{x:r,y:i}=o({x:e,y:t,z:n},g,_);return[r,i]}),l={measurementArray:e,measurementType:`distance`,currentBestFeature:f,currentBestFeatureMeasurementImage:p,activeViewer:s,imageSize:h,triangularMeasurementActive:!0,footprintExtent:c,options:t},d={measurementArray:r,measurementType:`distance`,secondaryViewer:!0,currentBestFeature:f,currentBestFeatureMeasurementImage:p,activeViewer:s,activeTriangulatedViewer:a,footprintExtent:c,options:t},m=i==="default"?await this.measurementService.calculateAccuracy(l):await this.measurementService.calculateAccuracyPanoramic(d);if(n(t),m&&this.viewModel.triangulatedDistanceMeasurement?.distance){let e=Math.atan(m/this.viewModel.triangulatedDistanceMeasurement.distance);this.viewModel.triangulatedDistanceAccuracy={distanceAccuracy:m,angleAccuracy:e}}break}case`area`:if(p?.geometry.spatialReference){let e=await l(this.measurementService.measurementVectors,p.geometry.spatialReference);n(t),this.viewModel.triangulatedAreaMeasurement=e}}this.viewModel.updatingTriangularMeasurementState=!1,this.viewModel.mode===`panoramic`&&this.viewModel.activeTriangulatedViewer.viewModel.restoreNavigationHandles()}}_preventLeftMouseDrag(){let{mode:e,activeTriangulatedViewer:t}=this.viewModel;if(e!==`panoramic`||!t)return;let n=null;t.imageRenderer.on(`pointer-down`,e=>{n=e.button}),t.imageRenderer.on(`drag`,e=>{n===0&&e.stopPropagation()})}};e([r()],m.prototype,`type`,void 0),m=e([i(`esri.widgets.OrientedImageryViewer.adapters.sketch.TriangulatedMeasurementAdapter`)],m);const h=m;export{h as default};
|