@arcgis/core 4.34.0-next.57 → 4.34.0-next.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Basemap.js +1 -1
- package/LICENSE.md +19 -0
- package/README.md +2 -18
- package/applications/KnowledgeStudio/reshape.d.ts +5 -0
- package/applications/KnowledgeStudio/reshape.js +5 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/03fe4164abd12abc7921.js +1 -0
- package/assets/esri/core/workers/chunks/{893e5eb5c028c4704317.js → 0427f66b56ec6601deb0.js} +1 -1
- package/assets/esri/core/workers/chunks/06b65105b15abf4d0fbf.js +1 -0
- package/assets/esri/core/workers/chunks/{02902303e5585a16ebea.js → 0b53bc76d38e85902748.js} +1 -1
- package/assets/esri/core/workers/chunks/0cb2f7172190babb4139.js +1 -0
- package/assets/esri/core/workers/chunks/0e28cb5d8d89ae29cdd0.js +1 -0
- package/assets/esri/core/workers/chunks/{1776ef96c9f4636f8838.js → 138c11b5eca621e51396.js} +1 -1
- package/assets/esri/core/workers/chunks/14c6461ffd36319e1d74.js +1 -0
- package/assets/esri/core/workers/chunks/1612d1c1d78c122dfef6.js +1 -0
- package/assets/esri/core/workers/chunks/17abab49db1813d3e192.js +1 -0
- package/assets/esri/core/workers/chunks/182383fd00008606bfaa.js +1 -0
- package/assets/esri/core/workers/chunks/18f878ec695617650a96.js +1 -0
- package/assets/esri/core/workers/chunks/{d578c3880eaf2dd62324.js → 19e5e011f929b6b940fe.js} +1 -1
- package/assets/esri/core/workers/chunks/{57c438bb0da6410df525.js → 1bf17c6548ac4cd5a166.js} +1 -1
- package/assets/esri/core/workers/chunks/1c61cf137a989bc52bb8.js +1 -0
- package/assets/esri/core/workers/chunks/{043bb97e38e3a54aa2ab.js → 1ed7a8f4a0058d3b69ef.js} +1 -1
- package/assets/esri/core/workers/chunks/{dd2b5f115d156b5b212e.js → 22ec2b0a853911692dc8.js} +1 -1
- package/assets/esri/core/workers/chunks/232c76f122b1f519e099.js +1 -0
- package/assets/esri/core/workers/chunks/{827bebb4bcdde23adc91.js → 251b7f2e295ce191eb62.js} +1 -1
- package/assets/esri/core/workers/chunks/27334cda1b877abcba1b.js +1 -0
- package/assets/esri/core/workers/chunks/{02a31483e09652a1a1a2.js → 2b7f9a57a2cfbc108673.js} +1 -1
- package/assets/esri/core/workers/chunks/{9fef330b241f958b55df.js → 2cd27b06226e30aec5da.js} +1 -1
- package/assets/esri/core/workers/chunks/{7c86af4f60cea383ed96.js → 39a1f361bb69073af765.js} +1 -1
- package/assets/esri/core/workers/chunks/3a7ac10a6614fe5745f7.js +1 -0
- package/assets/esri/core/workers/chunks/{70cf81ec5a901782d2db.js → 3e7c9a43e52ed6a1b018.js} +1 -1
- package/assets/esri/core/workers/chunks/{8257352421f453a669e9.js → 3f634580055b30dbfc8e.js} +1 -1
- package/assets/esri/core/workers/chunks/{0e8d3d38e9b1f6abf6f2.js → 3fd09a7c05583a57a317.js} +1 -1
- package/assets/esri/core/workers/chunks/{52917b753c5ceab0c1f7.js → 4050ddb580d364d9e205.js} +7 -7
- package/assets/esri/core/workers/chunks/{8c79945909069733558f.js → 4094cebc4b92c52f4e27.js} +1 -1
- package/assets/esri/core/workers/chunks/{82de1b50ae286f1e6c44.js → 451761c7bd2da530e1d0.js} +1 -1
- package/assets/esri/core/workers/chunks/{cc748d4f4adb9c584aa4.js → 45aeff2f751f124f8e53.js} +1 -1
- package/assets/esri/core/workers/chunks/462b30fc40a5f337ba10.js +1 -0
- package/assets/esri/core/workers/chunks/{d20af70b23f175fb5442.js → 48b9ba825856a0c843ff.js} +1 -1
- package/assets/esri/core/workers/chunks/497214e9e82b936fc94e.js +1 -0
- package/assets/esri/core/workers/chunks/4ac127cefa3aa5e93e78.js +1 -0
- package/assets/esri/core/workers/chunks/4b1daffa97fd90a554a0.js +1 -0
- package/assets/esri/core/workers/chunks/4d7fcec769369c576847.js +1 -0
- package/assets/esri/core/workers/chunks/4dee2f05508e90410f13.js +1 -0
- package/assets/esri/core/workers/chunks/516864fb68025acc7db6.js +1 -0
- package/assets/esri/core/workers/chunks/{d630fc3acd2552c98dc0.js → 547af4ffbeeccba9d187.js} +1 -1
- package/assets/esri/core/workers/chunks/54b43876ae6fb078eb38.js +1 -0
- package/assets/esri/core/workers/chunks/{cf699b9bb530b87be14c.js → 58422c616a824ab49218.js} +1 -1
- package/assets/esri/core/workers/chunks/589a0e244ef5f1b84ab6.js +1 -0
- package/assets/esri/core/workers/chunks/5b7e5ec6aea1f7f9b005.js +1 -0
- package/assets/esri/core/workers/chunks/{fe55833c80cf59df9c2b.js → 5cb238318a24b70d5ac3.js} +1 -1
- package/assets/esri/core/workers/chunks/{2c7e7895c4dda176220e.js → 5d4b24c864ebb68ae61e.js} +1 -1
- package/assets/esri/core/workers/chunks/{88a5e7415f8858c454f7.js → 5de7c2a80bd9c81cefe2.js} +1 -1
- package/assets/esri/core/workers/chunks/5e1afea05b624b315d9f.js +1 -0
- package/assets/esri/core/workers/chunks/5ed7e139c72cd2b3ddba.js +1 -0
- package/assets/esri/core/workers/chunks/6531f33d6710960079e9.js +1 -0
- package/assets/esri/core/workers/chunks/{a1ff4c252012d5026133.js → 65eb183b5d001dfc42c8.js} +1 -1
- package/assets/esri/core/workers/chunks/{f1b6d6ee03635d985c3e.js → 6688efc71d9d8f4d2559.js} +1 -1
- package/assets/esri/core/workers/chunks/{d5faf3ddf9a39de826be.js → 672c04d48aa51f16e9b7.js} +1 -1
- package/assets/esri/core/workers/chunks/{1cbd59918c60a1a21494.js → 700b5a536f97233bc4af.js} +1 -1
- package/assets/esri/core/workers/chunks/7597ef10d1699e7088e5.js +1 -0
- package/assets/esri/core/workers/chunks/781e424a383c71ca904d.js +1 -0
- package/assets/esri/core/workers/chunks/79933271a76a1756584f.js +1 -0
- package/assets/esri/core/workers/chunks/{17e203e4680c07bd02f1.js → 7aa7aff6d42be7c2d1d2.js} +1 -1
- package/assets/esri/core/workers/chunks/{c2f184e9f579152aa29a.js → 7b17f52019762aa21af8.js} +1 -1
- package/assets/esri/core/workers/chunks/{549e073fe276363a9896.js → 7db105f6b688b6da8106.js} +1 -1
- package/assets/esri/core/workers/chunks/{945c5a477940ebd23a4c.js → 7f0c78bcba0aed3c4eff.js} +1 -1
- package/assets/esri/core/workers/chunks/{a249e56a0be8cef33ba8.js → 81eb7785d626aa975033.js} +1 -1
- package/assets/esri/core/workers/chunks/{3eb792863a789b97ec58.js → 831a69e5a87e92830fbe.js} +1 -1
- package/assets/esri/core/workers/chunks/8374d87176486c1fc90e.js +1 -0
- package/assets/esri/core/workers/chunks/83dfaa6e3bd58d544f35.js +1 -0
- package/assets/esri/core/workers/chunks/{5691d504ffe5592bc40f.js → 897f9775f06ddbf6486f.js} +1 -1
- package/assets/esri/core/workers/chunks/8bbae8ac586e5c0819d2.js +1 -0
- package/assets/esri/core/workers/chunks/8c0e11f781607239749d.js +1 -0
- package/assets/esri/core/workers/chunks/90540fdfb0c5f68aa959.js +1 -0
- package/assets/esri/core/workers/chunks/9280edff80fd87860a5e.js +1 -0
- package/assets/esri/core/workers/chunks/{9275313e0f1f521b2658.js → 9325000c87295c473291.js} +1 -1
- package/assets/esri/core/workers/chunks/94b9948ec628187c19fc.js +1 -0
- package/assets/esri/core/workers/chunks/94f1005222bff1870ef1.js +1 -0
- package/assets/esri/core/workers/chunks/{aab349d4624b78ef429f.js → 96102a9296afd1bfe1a9.js} +1 -1
- package/assets/esri/core/workers/chunks/981275b6f008431c983a.js +1 -0
- package/assets/esri/core/workers/chunks/{4d2473e680324dc17cfa.js → 997a2a1a51039ce7e4e3.js} +1 -1
- package/assets/esri/core/workers/chunks/{07d5e0633cc2f765037f.js → 9f4e23bae621ff3ecea3.js} +1 -1
- package/assets/esri/core/workers/chunks/{4e2b125e6e3945985a54.js → 9f93513037a6e87433c4.js} +1 -1
- package/assets/esri/core/workers/chunks/a16b471c3706ee37f9b6.js +1 -0
- package/assets/esri/core/workers/chunks/{989251f5e0d6a08b1afa.js → a17ed7ce97e69466d730.js} +1 -1
- package/assets/esri/core/workers/chunks/a2150baf0661e2f28011.js +1 -0
- package/assets/esri/core/workers/chunks/a244afea77127e54dd3a.js +1 -0
- package/assets/esri/core/workers/chunks/{ab3c018c406dcd81ef9e.js → a2f4b6d8da93f106852c.js} +1 -1
- package/assets/esri/core/workers/chunks/a532614aa65fb52dee7b.js +1 -0
- package/assets/esri/core/workers/chunks/{3b51b61a7b8a1ef87c9b.js → a700f57af6856cb5313c.js} +1 -1
- package/assets/esri/core/workers/chunks/{319fe6a02ec630a827ea.js → a7ea2e3895046e566bc6.js} +1 -1
- package/assets/esri/core/workers/chunks/abe60d92e0219ee97036.js +1 -0
- package/assets/esri/core/workers/chunks/{a7530dcb08b43e37bbb2.js → ae1cb4c65d72217ae4d4.js} +1 -1
- package/assets/esri/core/workers/chunks/af5ae7c36e1178077cbc.js +1 -0
- package/assets/esri/core/workers/chunks/{7f80bbbd0897082c1af3.js → b29144ee58b43f769d9a.js} +1 -1
- package/assets/esri/core/workers/chunks/b30de4936caa654d7817.js +1 -0
- package/assets/esri/core/workers/chunks/{4193691ca076948f4f90.js → b53008c1461dd6bacc63.js} +1 -1
- package/assets/esri/core/workers/chunks/{1d234c057a6671acc59f.js → b605dfdfed8ff8eda4f3.js} +1 -1
- package/assets/esri/core/workers/chunks/{76ff7ccfe583927918f3.js → b68b54be3d67595a9446.js} +18 -18
- package/assets/esri/core/workers/chunks/b6c6f82df3b60c2f831f.js +1 -0
- package/assets/esri/core/workers/chunks/{7eda1c400658b6a99be8.js → ba0c7339fa19cc7cbde7.js} +1 -1
- package/assets/esri/core/workers/chunks/{fae6030a81cb91a91b69.js → bafd9b0f6e817252cb31.js} +1 -1
- package/assets/esri/core/workers/chunks/{c80c032c5b7a11db177a.js → bb2ab663e3e5597f2104.js} +1 -1
- package/assets/esri/core/workers/chunks/{724de82d101eb59c2834.js → bd451668c4ce9f7d7128.js} +1 -1
- package/assets/esri/core/workers/chunks/{91ede8c62a7b1e8b8023.js → be06c8a58c217a17451b.js} +1 -1
- package/assets/esri/core/workers/chunks/bf6b76027c60b4ffa507.js +1 -0
- package/assets/esri/core/workers/chunks/{08c0c016787caa169492.js → c24214666d10cb648428.js} +1 -1
- package/assets/esri/core/workers/chunks/c34a164a8ece4cb33e81.js +1 -0
- package/assets/esri/core/workers/chunks/{a3a23a56df4e5ee86bb2.js → c5fe356fc5b8b7be0d31.js} +1 -1
- package/assets/esri/core/workers/chunks/c696615cae5daefa2d98.js +1 -0
- package/assets/esri/core/workers/chunks/{e982cf44906eb26164f2.js → c75b0243e5bb84738419.js} +1 -1
- package/assets/esri/core/workers/chunks/{64fab4e1e28c06c83403.js → c779c8b98e07fa881c1d.js} +1 -1
- package/assets/esri/core/workers/chunks/{4a0257c449f31bdadf26.js → cef9ff811221a7c3812c.js} +1 -1
- package/assets/esri/core/workers/chunks/{b1982490762972ae023d.js → d0296368ae143de4d5ce.js} +1 -1
- package/assets/esri/core/workers/chunks/{3d5954478864a975e65e.js → d07d3b0e06f12aee4a8b.js} +1 -1
- package/assets/esri/core/workers/chunks/{e1472dbf0795d737d6f8.js → d2371f5034b2a32e2523.js} +1 -1
- package/assets/esri/core/workers/chunks/{2f65081bfedeab44d6cb.js → d35cadfb78ac9803069b.js} +1 -1
- package/assets/esri/core/workers/chunks/{80a69897fa3ce1eaa6e7.js → d707538b150d79050336.js} +1 -1
- package/assets/esri/core/workers/chunks/d7ce68667bb355ef8e5d.js +1 -0
- package/assets/esri/core/workers/chunks/d823277612f971a9c2f0.js +1 -0
- package/assets/esri/core/workers/chunks/d83bdc13c3cad3eee7be.js +1 -0
- package/assets/esri/core/workers/chunks/d91b80aa4f847c2e2a33.js +1 -0
- package/assets/esri/core/workers/chunks/{a96ac5c68d84122e7751.js → db7678104b18534482e3.js} +1 -1
- package/assets/esri/core/workers/chunks/dbcef57073075e9cfdfe.js +1 -0
- package/assets/esri/core/workers/chunks/{c4ceb267d4004d8da8cc.js → e0bbfbe1ed39c82f1bd4.js} +1 -1
- package/assets/esri/core/workers/chunks/e36d538915261ee0373f.js +1 -0
- package/assets/esri/core/workers/chunks/e58c5c8639aa837c84d1.js +1 -0
- package/assets/esri/core/workers/chunks/{a24762e976c1459b12de.js → e689a4849f5af3f2f641.js} +1 -1
- package/assets/esri/core/workers/chunks/e97250ae8da4bd0d6bc9.js +1 -0
- package/assets/esri/core/workers/chunks/{ef85cd0e82d59db8a26f.js → eacc7fccdc3fb670ac8f.js} +2 -2
- package/assets/esri/core/workers/chunks/{0df1f56df6d47dfbb6ea.js → eada3483116a5ea8baed.js} +1 -1
- package/assets/esri/core/workers/chunks/ed8863c3d334f438b625.js +1 -0
- package/assets/esri/core/workers/chunks/{47682247910271077333.js → ee78a38a0cacb19b2fd4.js} +1 -1
- package/assets/esri/core/workers/chunks/{f4061587ff5789fa4e1f.js → f594df2f5ce6ca41a254.js} +1 -1
- package/assets/esri/core/workers/chunks/{d7b3e81cc313fd0a33b0.js → f5c821ca2911a5103c9a.js} +1 -1
- package/assets/esri/core/workers/chunks/f636ca5c811c3a2a962f.js +1 -0
- package/assets/esri/core/workers/chunks/{a3ee76b7e46d3fba7cf7.js → f6d91256c4e5f8a0d5c0.js} +1 -1
- package/assets/esri/core/workers/chunks/f711aeba1a2c184ddb43.js +1 -0
- package/assets/esri/core/workers/chunks/f718f630a8b81496c646.js +1 -0
- package/assets/esri/core/workers/chunks/{cac060a187f3a27a19ba.js → fa0f94318173db2034de.js} +1 -1
- package/assets/esri/core/workers/chunks/fdae43a97537093e4b97.js +1 -0
- package/assets/esri/core/workers/chunks/{b6a201e86f9caef45ff0.js → ff2614d96ca5228e9685.js} +1 -1
- package/assets/esri/themes/base/widgets/_Editor.scss +5 -3
- package/assets/esri/themes/base/widgets/_SelectionToolbar.scss +6 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar.json +1 -1
- package/assets/esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar_en.json +1 -1
- package/chunks/BloomComposition.glsl.js +36 -18
- package/chunks/ColorMaterial.glsl.js +1 -1
- package/chunks/ComponentShader.glsl.js +3 -3
- package/chunks/CompositeGeographicTransformation.js +1 -1
- package/chunks/CutFillDepth.glsl.js +15 -0
- package/chunks/CutFillReduction.glsl.js +12 -0
- package/chunks/CutFillTargetDepth.glsl.js +6 -0
- package/chunks/DefaultMaterial.glsl.js +2 -2
- package/chunks/GeodeticDistanceCalculator-Ce-woMPw.js +1 -1
- package/chunks/GeographicTransformation.js +1 -1
- package/chunks/HUDMaterial.glsl.js +4 -4
- package/chunks/ImageMaterial.glsl.js +2 -2
- package/chunks/MultiPathImpl.js +1 -1
- package/chunks/NativeLine.glsl.js +1 -1
- package/chunks/OperatorGeodesicBuffer.js +1 -1
- package/chunks/OperatorGeodeticArea.js +1 -1
- package/chunks/OperatorGeodeticDensifyByLength.js +1 -1
- package/chunks/OperatorGeodeticLength.js +1 -1
- package/chunks/OperatorProximityGeodesic.js +1 -1
- package/chunks/OperatorShapePreservingLength.js +1 -1
- package/chunks/OperatorShapePreservingProject.js +1 -1
- package/chunks/Path.glsl.js +7 -7
- package/chunks/Pattern.glsl.js +1 -1
- package/chunks/Point2D.js +1 -1
- package/chunks/ProjectionTransformation.js +1 -1
- package/chunks/RealisticTree.glsl.js +2 -2
- package/chunks/RibbonLine.glsl.js +2 -2
- package/chunks/ShadedColorMaterial.glsl.js +1 -1
- package/chunks/SimpleAtmosphere.glsl.js +1 -1
- package/chunks/SpatialReference.js +1 -1
- package/chunks/Terrain.glsl.js +4 -4
- package/chunks/UnitFactory.js +1 -1
- package/chunks/WaterSurface.glsl.js +3 -3
- package/chunks/offsetOperator.js +1 -1
- package/chunks/sphere.js +1 -1
- package/chunks/vec42.js +1 -1
- package/config.js +1 -1
- package/copyright.txt +2 -20
- package/core/Clonable.js +1 -1
- package/core/accessorSupport/layerContainerType.js +1 -1
- package/core/libs/gl-matrix-2/math/quat.js +1 -1
- package/core/libs/gl-matrix-2/math/vec4.js +1 -1
- package/core/quantityFormatUtils.js +1 -1
- package/core/unitFormatUtils.js +1 -1
- package/editing/geometry/coordUtils.js +5 -0
- package/editing/geometry/lineUtils.js +5 -0
- package/editing/sharedTemplates/executor/builders/equallySpaced.js +1 -1
- package/editing/sharedTemplates/executor/builders/pointAtIntersectionVerticesOfLine.js +1 -1
- package/editing/sharedTemplates/executor/builders/support/builderUtils.js +1 -1
- package/editing/sharedTemplates/executor/builders/support/offsetUtils.js +1 -1
- package/editing/sharedTemplates/executor/builders/support/shapeUtils.js +1 -1
- package/effects/FocusArea.js +1 -1
- package/geometry/coordinateFormatter.js +1 -1
- package/geometry/operators/gx/operatorAlphaShape.js +1 -1
- package/geometry/operators/gx/operatorIntegrate.js +1 -1
- package/geometry/operators/gx/operatorOffset.js +1 -1
- package/geometry/operators/gx/operatorPolygonSlicer.js +1 -1
- package/geometry/operators/offsetOperator.js +1 -1
- package/geometry/operators/support/apiConverter.js +1 -1
- package/geometry/operators/support/initNoPeFactory.js +1 -1
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/geometry/support/sphere.js +1 -1
- package/graphic/KnowledgeGraphGraphicOrigin.js +1 -1
- package/graphic/LinkChartGraphicOrigin.js +5 -0
- package/graphic/isLinkChartGraphicOrigin.js +5 -0
- package/interfaces.d.ts +131 -12
- package/kernel.js +1 -1
- package/layers/FeatureLayer.js +1 -1
- package/layers/GroundLayer.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/IntegratedMeshLayer.js +1 -1
- package/layers/ParquetLayer.js +1 -1
- package/layers/PointCloudLayer.js +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
- package/layers/catalog/catalogUtils.js +1 -1
- package/layers/graphics/hydratedFeatures.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
- package/layers/knowledgeGraph/nodeMovementUtils.js +5 -0
- package/layers/mixins/ImageryTileMixin.js +1 -1
- package/layers/mixins/operationalLayers.js +1 -1
- package/layers/support/RasterStorageInfo.js +1 -1
- package/layers/support/SceneFilter.js +1 -1
- package/layers/support/Sublayer.js +1 -1
- package/layers/support/layersCreator.js +1 -1
- package/layers/support/rasterDatasets/BaseRaster.js +1 -1
- package/layers/support/rasterFunctions/BandArithmeticFunction.js +1 -1
- package/layers/support/rasterFunctions/BaseRasterFunction.js +1 -1
- package/layers/support/rasterFunctions/ExtractBandFunction.js +1 -1
- package/layers/support/rasterFunctions/NDVIFunction.js +1 -1
- package/package.json +2 -2
- package/portal/schemas/definitions.js +1 -1
- package/renderers/support/RasterSymbolizer.js +1 -1
- package/support/basemapUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/Stage.js +1 -1
- package/views/2d/engine/webgl/Profiler.js +1 -1
- package/views/2d/layers/imagery/BaseImageryTileSubView2D.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/3d/camera/constraintUtils/distance.js +1 -1
- package/views/3d/camera/constraintUtils/tilt.js +1 -1
- package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
- package/views/3d/layers/CSVLayerView3D.js +1 -1
- package/views/3d/layers/FeatureLayerView3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/GeoJSONLayerView3D.js +1 -1
- package/views/3d/layers/GraphicsLayerView3D.js +1 -1
- package/views/3d/layers/GraphicsView3D.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/layers/OGCFeatureLayerView3D.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/StreamLayerView3D.js +1 -1
- package/views/3d/layers/WFSLayerView3D.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/ElevationContext.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/GraphicsProcessor.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/graphics/QueryEngine.js +1 -1
- package/views/3d/layers/graphics/StreamController.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
- package/views/3d/layers/graphics/pointUtils.js +1 -1
- package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
- package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
- package/views/3d/layers/support/FlowTileTree3DDebugger.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
- package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/support/CombinedElevationProvider.js +1 -1
- package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/terrain/OverlayRenderTargets.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/SphericalPatch.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +2 -2
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/FBOCacheFormats.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/ShaderOutputConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/ObjectAndLayerIdColor.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +4 -4
- package/views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js +2 -0
- package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlightOverlay.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +2 -4
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
- package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomComposition.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/bloom/BloomCompositionTechniqueConfiguration.js +5 -0
- package/views/3d/webgl-engine/effects/bloom/BloomRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
- package/views/3d/webgl-engine/effects/geometry/ObjectAndLayerIDRenderNode.js +1 -1
- package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillDepth.js +5 -0
- package/views/3d/webgl-engine/lib/DefaultVertexBufferLayouts.js +1 -1
- package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
- package/views/3d/webgl-engine/lib/Material.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/Octree.js +1 -1
- package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/InstanceOctree.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/octreeUtils.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
- package/views/3d/webgl-engine/shaders/CutFillDepth.glsl.js +5 -0
- package/views/3d/webgl-engine/shaders/CutFillDepthTechnique.js +5 -0
- package/views/3d/webgl-engine/shaders/CutFillReduction.glsl.js +5 -0
- package/views/3d/webgl-engine/shaders/CutFillReductionTechnique.js +5 -0
- package/views/3d/webgl-engine/shaders/CutFillTargetDepth.glsl.js +5 -0
- package/views/3d/webgl-engine/shaders/CutFillTargetDepthTechnique.js +5 -0
- package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js +1 -1
- package/views/3d/webgl.js +1 -1
- package/views/LinkChartView.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/support/GraphicMover.js +1 -1
- package/views/draw/support/HighlightHelper.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/drawUtils.js +1 -1
- package/views/interactive/Tooltip.js +1 -1
- package/views/interactive/editGeometry/EditGeometry.js +1 -1
- package/views/interactive/sketch/SketchLabelOptions.js +1 -1
- package/views/interactive/sketch/SketchOptions.js +1 -1
- package/views/interactive/sketch/SketchTooltipOptions.js +1 -1
- package/views/interactive/sketch/SketchTooltipVisibleElements.js +1 -1
- package/views/interactive/sketch/SketchValueOptions.js +1 -1
- package/views/interactive/sketch/Units.js +1 -1
- package/views/interactive/sketch/constraints.js +1 -1
- package/views/interactive/snapping/featureSources/FeatureCollectionSnappingSource.js +1 -1
- package/views/interactive/snapping/featureSources/FeatureServiceSnappingSource.js +1 -1
- package/views/interactive/snapping/featureSources/GraphicsSnappingSource.js +1 -1
- package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
- package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
- package/views/interactive/tooltip/fields/fields.js +1 -1
- package/views/interactive/tooltip/fields/parsingAndFormattingUtils.js +1 -1
- package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
- package/views/support/angularMeasurementUtils.js +1 -1
- package/webdoc/support/writeUtils.js +1 -1
- package/webscene/spec-certification/api.js +1 -1
- package/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.js +1 -1
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/support/splitFeatureUtils.js +5 -0
- package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/support/FeatureStore.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/MeasurementAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/services/ImageMeasurementService.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
- package/widgets/support/SelectionToolbar/VisibleElements.js +1 -1
- package/widgets/support/SelectionToolbar.js +1 -1
- package/widgets/support/Selector2D/SelectionOperation.js +1 -1
- package/EULA.pdf +0 -0
- package/assets/esri/core/workers/chunks/0390f3aa624e3f380ce2.js +0 -1
- package/assets/esri/core/workers/chunks/0569698a3e4eaf2bac8e.js +0 -1
- package/assets/esri/core/workers/chunks/06d2251d6f6b3e44800a.js +0 -1
- package/assets/esri/core/workers/chunks/07eea90733834313e9fa.js +0 -1
- package/assets/esri/core/workers/chunks/08393d9cc2ed846dd5b4.js +0 -1
- package/assets/esri/core/workers/chunks/094c741fa8139c3f40cf.js +0 -1
- package/assets/esri/core/workers/chunks/0f51e51db83f303ce5a6.js +0 -1
- package/assets/esri/core/workers/chunks/171ce8c64f322cd5d6d1.js +0 -1
- package/assets/esri/core/workers/chunks/184d3c88ac2fc1d7e2c3.js +0 -1
- package/assets/esri/core/workers/chunks/1ae15163af8875148fb8.js +0 -1
- package/assets/esri/core/workers/chunks/1eee7cf11df01a52c1bf.js +0 -1
- package/assets/esri/core/workers/chunks/27197b0a2ffb2b6104ea.js +0 -1
- package/assets/esri/core/workers/chunks/2c0241a5958aef9cda61.js +0 -1
- package/assets/esri/core/workers/chunks/2ded2446700f89155ccd.js +0 -1
- package/assets/esri/core/workers/chunks/3264d58aeef8cf074b86.js +0 -1
- package/assets/esri/core/workers/chunks/3445ffd752262673fb13.js +0 -1
- package/assets/esri/core/workers/chunks/38f09e36e174792646bd.js +0 -1
- package/assets/esri/core/workers/chunks/3c57b2e13628b5c1f6de.js +0 -1
- package/assets/esri/core/workers/chunks/4162c633efefc63c5506.js +0 -1
- package/assets/esri/core/workers/chunks/435169b455fd2846799b.js +0 -1
- package/assets/esri/core/workers/chunks/44dc7ec52c4abb700783.js +0 -1
- package/assets/esri/core/workers/chunks/4558f2e3e77831758fdc.js +0 -1
- package/assets/esri/core/workers/chunks/4fc267552939583a81a0.js +0 -1
- package/assets/esri/core/workers/chunks/527557b603400189d49a.js +0 -1
- package/assets/esri/core/workers/chunks/53873f26a2c24cd75e4a.js +0 -1
- package/assets/esri/core/workers/chunks/554c789f4e875d7e6fd5.js +0 -1
- package/assets/esri/core/workers/chunks/561a2078458bc0339f83.js +0 -1
- package/assets/esri/core/workers/chunks/5f28470304b57e24d94c.js +0 -1
- package/assets/esri/core/workers/chunks/61a294f9411bf884f2ab.js +0 -1
- package/assets/esri/core/workers/chunks/6acffacbb4a03af52e3b.js +0 -1
- package/assets/esri/core/workers/chunks/719450ccd455f503d81a.js +0 -1
- package/assets/esri/core/workers/chunks/71cac356874b36f9a383.js +0 -1
- package/assets/esri/core/workers/chunks/7388e8c905d93dea1c05.js +0 -1
- package/assets/esri/core/workers/chunks/749c7159e0902388e828.js +0 -1
- package/assets/esri/core/workers/chunks/7714228825fb44d506df.js +0 -1
- package/assets/esri/core/workers/chunks/77ee4afaa4a1c7047940.js +0 -1
- package/assets/esri/core/workers/chunks/790e97ddbe318bc75415.js +0 -1
- package/assets/esri/core/workers/chunks/8762928d10c3821738ad.js +0 -1
- package/assets/esri/core/workers/chunks/8ead467a5af0d9bba804.js +0 -1
- package/assets/esri/core/workers/chunks/91e04d03b0013bcaad82.js +0 -1
- package/assets/esri/core/workers/chunks/92b60d4fb09711919601.js +0 -1
- package/assets/esri/core/workers/chunks/9940e59033a8a1eff2a9.js +0 -1
- package/assets/esri/core/workers/chunks/998c38974372720b1c52.js +0 -1
- package/assets/esri/core/workers/chunks/9b10e70f28873cff44f5.js +0 -1
- package/assets/esri/core/workers/chunks/9b5e04d87116ce2b68b2.js +0 -1
- package/assets/esri/core/workers/chunks/9d920f3488d59e7f276c.js +0 -1
- package/assets/esri/core/workers/chunks/a999f804fc2f00b2e7ae.js +0 -1
- package/assets/esri/core/workers/chunks/acf13a64df2991a4cb6b.js +0 -1
- package/assets/esri/core/workers/chunks/b457b7dd907f06278bee.js +0 -1
- package/assets/esri/core/workers/chunks/b5640f9623a9c9ded92a.js +0 -1
- package/assets/esri/core/workers/chunks/b8158c681456d4cf2395.js +0 -1
- package/assets/esri/core/workers/chunks/bbdbb618a18542f7a4a2.js +0 -1
- package/assets/esri/core/workers/chunks/bead38898c3f4d4d3569.js +0 -1
- package/assets/esri/core/workers/chunks/c51e2a048df152abd901.js +0 -1
- package/assets/esri/core/workers/chunks/c86e339e45900c54c9f5.js +0 -1
- package/assets/esri/core/workers/chunks/ca7c9756802214e41c56.js +0 -1
- package/assets/esri/core/workers/chunks/cb8f2ce22274990b359c.js +0 -1
- package/assets/esri/core/workers/chunks/d6ab4d55f1023ee6ec6a.js +0 -1
- package/assets/esri/core/workers/chunks/db2b8d8cf7131554cf7e.js +0 -1
- package/assets/esri/core/workers/chunks/e7ccf067bea8f4766424.js +0 -1
- package/assets/esri/core/workers/chunks/f1c50f37a81c672263a1.js +0 -1
- package/assets/esri/core/workers/chunks/ff323db554c9e09749e8.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{equals as a,isSome as i}from"../../core/arrayUtils.js";import{createTask as r}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import{deprecatedProperty as o}from"../../core/deprecate.js";import n from"../../core/Error.js";import{EventedMixin as c}from"../../core/Evented.js";import{makeHandle as l}from"../../core/handleUtils.js";import{equalsShallow as h}from"../../core/lang.js";import u from"../../core/Logger.js";import{clamp as m}from"../../core/mathUtils.js";import{abortMaybe as d,destroyMaybe as p}from"../../core/maybe.js";import{EsriPromise as g}from"../../core/Promise.js";import{isAbortError as y,throwIfAborted as v,waitTick as f}from"../../core/promiseUtils.js";import w from"../../core/ReactiveMap.js";import{whenOnce as F,on as _,watch as b,syncAndInitial as M,initial as I}from"../../core/reactiveUtils.js";import{sqlAnd as P}from"../../core/sql.js";import{getMetersPerUnitForSR as V}from"../../core/unitUtils.js";import{property as S}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as k}from"../../core/accessorSupport/decorators/subclass.js";import{isSerializable as A}from"../../core/support/jsonUtils.js";import{UpdatingHandles as C}from"../../core/support/UpdatingHandles.js";import G from"../../geometry/Extent.js";import{union as L}from"../../geometry/geometryEngineAsync.js";import R from"../../geometry/Multipoint.js";import O from"../../geometry/Point.js";import T from"../../geometry/Polygon.js";import j from"../../geometry/Polyline.js";import{projectWithZConversion as H}from"../../geometry/projectionUtils.js";import B from"../../geometry/SpatialReference.js";import{isClockwise as x}from"../../geometry/support/coordsUtils.js";import{normalizeMapX as E}from"../../geometry/support/normalizeUtils.js";import{geographicToWebMercator as z}from"../../geometry/support/webMercatorUtils.js";import D from"../../layers/GraphicsLayer.js";import U from"../../layers/MediaLayer.js";import{searchImages as N,getSortedLayerFeatures as W}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as q}from"../../layers/orientedImagery/core/bestImageUtils.js";import{createCoveragePolygon as $,computePolygonForInspection as J,resizePolygon as Z,checkIfPolygonContainsSelectedPoint as K}from"../../layers/orientedImagery/core/coverageUtils.js";import{isElevationSource as Q}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{convertGeographicToWebMercator as X}from"../../layers/orientedImagery/core/utils.js";import{imageToWorld as Y,imageToWorldPanoramic as ee}from"../../layers/orientedImagery/transformations/imageToWorld.js";import te from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as ae}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{or as ie,getInitialAngle as re,convertPixelToHeadingPitch as se,convertHeadingPitchToSphereVertex as oe,getImageToWorldProperties as ne,getUpdateElevationProps as ce,isElevationSampler as le,getImageToWorldPanoramicProperties as he,pointToArray as ue,transformGraphicCoordinatesToPixel as me,getWorldToImageProperties as de}from"../../layers/orientedImagery/transformations/utils.js";import{worldToImage as pe,worldToImagePanoramic as ge}from"../../layers/orientedImagery/transformations/worldToImage.js";import ye from"../../layers/support/ExtentAndRotationGeoreference.js";import{getFloorFilterClause as ve}from"../../layers/support/floorFilterUtils.js";import fe from"../../layers/support/VideoElement.js";import we from"../../views/MapView.js";import Fe from"../../views/draw/Draw.js";import{scale as _e}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as be}from"../../views/input/InputManager.js";import Me from"../PanoramicViewer.js";import{defaultAngleThresholdInDegrees as Ie,videoExtent as Pe,invalidCameraHeading as Ve,sectorsInOrder as Se,sampleExtent as ke,sectorsRadii as Ae}from"./constants.js";import{configureSketchTool as Ce,extractFieldsFromDataCaptureLayer as Ge,isValidDataCaptureLayer as Le,constructGraphicFromImageGeometry as Re}from"./dataCaptureUtils.js";import{isFeatureAttachment as Oe,getImageSourceFromAttachment as Te}from"./galleryUtils.js";import{getModeCorrectedPoint as je,calculateCorrectedPixel as He,getUnitRateFromSpatialReference as Be,calculateHeightFromTemporaryDistance as xe,computeTriangulatedVector as Ee,computeTriangulatedPoint as ze}from"./imageMeasurementUtils.js";import{crossSymbol as De,crossSymbol3D as Ue,measurementPolygonSymbol as Ne,polylineSymbolPanoramic as We,measurementPolylineSymbol as qe,cameraOverlaySymbol3D as $e,cameraOverlaySymbol as Je,diamondSymbol as Ze,diamondSymbol3D as Ke,locationSymbol as Qe,locationSymbol3D as Xe,activeSourcePointSymbol as Ye,sourcePointSymbol as et}from"./symbols.js";import{isNoAttachmentError as tt,getContentType as at,isTifOrMrf as it,filterOILLayerView as rt,assignElevationSampleToFeatures as st,calculateDirection as ot,calculateSegment as nt,isSceneView as ct,isGraphic as lt}from"./utils.js";import{disableVideoZoomAndPan as ht}from"./videoViewerUtils.js";import ut from"./components/ImageViewer.js";import mt from"./components/NavigationNode.js";import dt from"./components/OrientedImageryVideoViewModel.js";import{NoActiveViewerError as pt,NoFeatureFoundWithObjectIdError as gt}from"./navigation/errors.js";import{queryFeatureByObjectIds as yt}from"./navigation/queries.js";import{ImageMeasurementService as vt}from"./services/ImageMeasurementService.js";import ft from"../Sketch/SketchViewModel.js";const wt={click:"view-click",imageClick:"image-click",triangularImageClick:"triangular-click",interactionHandles:"interaction-handles",hittestHandles:"hittest-handles",videoPlayerHandles:"video-handles",activeViewerCursorHandles:"active-viewer-cursor-handles",imageViewerCursorHandles:"image-viewer-cursor-handles"},Ft=new Set(["JPG","JPEG"]),_t=/\.(\w+)$/,bt=()=>new n("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first");let Mt=class extends(c(g)){constructor(e){super(e),this.additionalFeatures=new s,this.additionalCameraLocations=new s,this.additionalFootprints=new s,this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.bestFeatureAngle=0,this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null,this.cameraHeadingThreshold=Ie,this.cameraPitchThreshold=Ie,this.clickAction="hittest",this.videoViewModel=null,this.collectionId=null,this.conversionProps=null,this.coverageFrustums=new s,this.coveragePolygons=new s,this.currentBestFeature=null,this.currentBestFeatureMeasurementImage=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.featureCache=[],this.navigationNodes=new s,this.determineWorkflowForFeature=async(e,t,a)=>{const{currentBestFeature:i,selectedPoint:r,view:s}=this;if(s?.closePopup(),i&&r){this._initialCurrentCoverageUpdate=!0,this._updateGroundElevation=!0;try{await this._updatePointsAndPolygons(a),await this._loadImage(a)}catch(o){y(o)||(this.loadImageError(o),u.getLogger(this).error("#loadIImage()","error occured while loading image",o))}}},this.determineWorkflowForTriangularMeasurement=async(e,t,a)=>{if(this.view?.closePopup(),this.currentBestFeatureMeasurementImage&&this.selectedPoint)try{await this._loadMeasurementViewerImage(a)}catch(i){y(i)||(this.loadImageError(i),u.getLogger(this).error("#loadIImage()","error occured while loading image",i))}},this.disabled=!1,this.displayMessage={key:"onLoadMessage",type:"info"},this.displayNewMeasurementButton=!0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.dataCaptureLayer=null,this.features=new s,this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.heightMeasurementPixels=[],this.heightGraphic=null,this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.measurementAngle=null,this.tempDistance=null,this.imageGeometryField=null,this.imageLocationToolState=!1,this.imageMeasurementViewer=new ut,this.isAdditionalCoverageVisible=!1,this.isAdditionalPointSourcesVisible=!1,this.measurementVectors=[],this.layer=null,this.localPort=null,this.mapImageConversionToolState=!1,this.measureType=null,this.measurementGraphic=null,this.navigatorCurrentBestFeature=null,this.oiObjectIdField=null,this.overlayedCameraLocations=new s,this.overlayedMapFeatures=new w,this.pixelCoordinates=null,this.preserveAngle="none",this.pointSources=new s,this.previousFeatureAngle=0,this.selectedPoint=null,this.shouldShowSelectedImage=!1,this.sketch=null,this.sketchTriangular=null,this.sketchTriangularGraphicsLayer=null,this.draw=null,this.sketchAdapter=null,this.triangularMeasurementActive=!1,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedAreaAccuracy=0,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.triangulatedMeasurementAdapter=null,this.updateFootprint=async(e,t)=>{"default"===this.mode&&"image-loaded"!==this.state||"video"===this.mode&&!this.videoElement?.content||await(this._adapter?.updateFootprint(e,t))},this.updateFootprintPanorama=async(e,t)=>{await(this._adapter?.updateFootprintPanorama(e,t))},this.updatingTriangularMeasurementState=!1,this.videoElement=null,this.videoLayer=null,this.videoMapView=new we({map:new Map}),this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new ut,this._initialCurrentCoverageUpdate=!0,this._locationPointOnImage=null,this._measurementService=null,this._correctedLocationPointOnImage=null,this._overlays=new D({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"},title:"OrentedImageryViewerViewModel overlays layer"}),this._panoramicViewer=new Me,this._panoramicMeasurementViewer=new Me,this._referencePointOnGround=null,this._referencePointOnImage=null,this._sectorData=null,this._featureToSector=null,this._updatingHandles=new C,this._clickTask=null,this._crossSymbol=null,this.footprintExtent=null,this._featureChangedTask=null,this._openPopupTask=null,this._suitabilities=null,this._transformController=new AbortController,this._updateFootprintTask=null,this._updateGroundElevation=!1,this.addUpdatingPromise=e=>this._updatingHandles.addPromise(e),this.hideImageGeometry=e=>{},this.highlight=e=>{if(!this._overlaysView)return;this.removeHighlight();const t=this.additionalFootprints.find(({attributes:{imageID:t}})=>t===Number(e));this._highlightedFeatureHandle=t?this._overlaysView?.highlight(t):null},this.loadDataCaptureAdapter=async e=>{await this.loadSketch(e);const t=import("./adapters/sketch/DataCaptureAdapter.js"),{default:a}=await t;return v(e),this.sketchAdapter=new a({viewModel:this}),this.sketchAdapter},this.loadImageFromSource=async(e,t)=>this._updatingHandles.addPromise(this._loadImageFromSourceInternal(e,t)),this.storeImageMeasurementViewer=e=>{this.imageMeasurementViewer=e},this.storePanoramicMeasurementViewer=e=>{this._panoramicMeasurementViewer=e},this.loadImageViewer=e=>{this._imageViewer?.destroy(),this._imageViewer=e},this.loadPanoramicViewer=e=>{this._panoramicViewer?.destroy(),this._panoramicViewer=e},this.loadVideoViewer=e=>{this.videoMapView.container=e},this.showImageByObjectId=async(e,t)=>{const a=this.additionalFeatures.find(({attributes:t})=>t.objectId===e);if(a)this.currentBestFeature=a;else{const{layer:a,layerFloorFilterClause:r}=this;if(!a)return void this.setMessage("noLayerSelected","info");this.beforeLoad();const s=this._updatingHandles.addPromise(this._queryAndLoadByObjectId(a,e,r,t));try{await s,await this.selectBestFeature(e,t)}catch(i){y(i)||(u.getLogger(this).error("oriented-imagery-viewer:show-image",i),"NoFeatureFoundWithObjectIdError"===i.name?this.setMessage("noFeatureFoundWithObjectId","error","",{objectId:e}):this.setMessage("imageLoadError","error",i.message))}}},this.imageToImageTransform=async(e,t,a)=>{const{updateElevationProps:i,...r}=t,{updateElevationProps:s,...o}=a,n=await Y(e,r,i);return pe(n,o)},this.getSectorFeatureById=e=>this._suitabilities?.find(({feature:{attributes:{objectId:t}}})=>t===e),this.getFeatureSectorById=e=>this._featureToSector?.[`${e}`],this.navigate=async(e,t)=>{const{activeViewer:a}=this;if(!a)throw new pt;return await a.navigate(e,t)},this.removeHighlight=()=>this._highlightedFeatureHandle?.remove(),this.revealImageGeometry=e=>{},this.selectBestFeature=async(e,t)=>(v(t),this.currentBestFeature=this.features?.find(({attributes:t})=>`${t.objectId}`==`${e}`),F(()=>"image-loaded"===this.state,t)),this.toggleImageAttributes=()=>{d(this._openPopupTask),this._openPopupTask=r(async e=>{const{currentBestFeature:a,popupEnabled:i,layer:r,view:s}=this;if(s?.closePopup(),!(s&&a&&i&&r))return;const{attributes:o,geometry:n}=a,c=new t({geometry:n,attributes:o.toJSON(),layer:r,sourceLayer:r});v(e),await s.openPopup({features:[c],location:o.location.clone()})})},this.updateSuitabilities=(e,t=!0)=>{e.sort((e,t)=>e.suitability-t.suitability),this._suitabilities=e;const a=this._suitabilities.map(({feature:e})=>e);this._initialCurrentCoverageUpdate=!0,this._updateFeatures(a,t),this._groupFeaturesBySectors()},this._createViewClickHandle=()=>{if(this.removeHandles(wt.click),"disabled"===this.state||null==this.view)return;const e=this.mapImageConversionToolState&&"image-loaded"===this.state?this._mapImageConversionToolViewClickHandler:this._viewClickHandler;this.addHandles(this.view.on("click",e,be.WIDGET),wt.click)},this._createImageClickHandle=()=>{this.removeHandles(wt.imageClick);const{mapImageConversionToolState:e,mode:t,activeViewer:a,currentBestFeature:i,footprintExtent:s}=this,o=a?.imageSize;if(!(e&&"none"!==t&&o&&s&&i))return;const n=a.clickAction;this.clickAction="pixel-location";const c=l(()=>{this.clickAction=n});let h=null;const u=_(()=>a,"pixel-location",e=>{this.plotReferencePointOnImage(e),h?.abort(),h=r(async a=>{if(!e)return;const r=await this.getMapPoint(e,{feature:i,imageSize:o,mode:t}).then(e=>{const t=this.view?.spatialReference;return ie(!t,e.spatialReference.equals(t))?e:H(e,t)});v(a),this.plotReferencePointOnGround(r)})});this.addHandles([u,c],wt.imageClick)},this._createTriangularImageClickHandle=()=>{this.removeHandles(wt.triangularImageClick);const e=this.imageMeasurementViewer?.imageSize;this.triangularMeasurementActive&&"none"!==this.mode&&e&&this.currentBestFeature&&this.addHandles(this.imageMeasurementViewer.imageRenderer.on("double-click",this._measurementImageClickHandler),wt.triangularImageClick)},this._createTriangularImageLocationHandle=()=>{this.removeHandles(wt.triangularImageClick);const{imageLocationToolState:e,mode:t,activeTriangulatedViewer:a}=this,i=a?.imageSize;if(!e||"none"===t||!i)return;this.clickAction="pixel-location";let s=null;const o=_(()=>a,"pixel-location",e=>{1===this.measurementVectors.length&&(this.plotLocationPointOnImage(e,!0),s?.abort(),s=r(async a=>{if(!e||this.triangulatedPoint||2===this.measurementVectors?.length||!this.currentBestFeatureMeasurementImage)return;let r=await this.getMapPoint(e,{feature:this.currentBestFeatureMeasurementImage,imageSize:i,mode:t});v(a);const s=this.currentBestFeatureMeasurementImage.geometry.spatialReference;s&&!r.spatialReference.equals(s)&&(r=await H(r,s),v(a)),await this._calculateTriangulatedPointFromGroundPoint(r,{signal:a}),v(a)}))});this.addHandles(o,wt.triangularImageClick)},this._createImageLocationHandle=()=>{this.removeHandles(wt.imageClick);const{imageLocationToolState:e,mode:t,activeViewer:a,currentBestFeature:i,footprintExtent:s}=this,o=a?.imageSize;if(!(e&&"none"!==t&&o&&s&&i))return;this.clickAction="pixel-location";let n=null;const c=_(()=>a,"pixel-location",e=>{const{currentBestFeatureMeasurementImage:a,triangularMeasurementActive:s,activeTriangulatedViewer:c}=this;this.pixelCoordinates=e;const l=null!=a&&!c?.state.includes("loading");ie(!s,l)&&this.plotLocationPointOnImage(e),n?.abort(),n=r(async a=>{if(!e)return;let r=await this.getMapPoint(e,{feature:i,imageSize:o,mode:t});v(a);const n=this.view?.spatialReference;n&&!r.spatialReference.equals(n)&&(r=await H(r,n),v(a)),this.groundCoordinates=r,s&&r&&l&&await this.triangulatedLocationWorkflow(r,a);const c=await this.calculateLocationAccuracy(e,r,t,a);v(a),c&&(this.groundCoordinatesAccuracy=c)})});this.addHandles(c,wt.imageClick)},this._handleImageHitTestResponse=async e=>{const{layer:t,overlayedCameraLocations:a}=this;if(!t)return;const i=e.results.find(({graphic:e,graphic:{attributes:i}})=>a.includes(e)&&i&&!i[t.imageReferenceField]&&!i[t.imageGeometryField]);if(!i)return;const r=i.graphic.attributes[t.objectIdField];await this.showImageByObjectId(r)},this._loadImage=async e=>{const{currentBestFeature:t,layer:a,mode:i}=this;if(this.clearGraphics(),!a||!t||"none"===i||"video"===i)return;const{attributes:r}=t,{imagePath:s,imageRotation:o,cameraHeading:n,cameraRoll:c,cameraPitch:l,objectId:h,cameraOrientation:m,location:d}=r,p=(c??0)+(o??0),g=d.spatialReference.isWGS84&&4!==m?.type?z(d):new O(d);let f=s;if(Oe(s))try{f=await Te(a,h,e)}catch(w){if(y(w))return;return tt(w)?(u.getLogger(this).error(w),void this.setMessage("noAttachment","error",`${a.objectIdField}: ${h}`)):(u.getLogger(this).error(w,{[a.objectIdField]:h,layer:a}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${a.objectIdField} ${h}`))}try{await this.loadImageFromSource(f,{imageRotation:p,options:e,pitch:l,yaw:n,mode:i,cameraLocation:g}),v(e),await this.transformAndPlotSelectedLocation(e)}catch(w){y(w)||this.loadImageError(w)}},this._loadImageFromSourceInternal=async(e,t)=>{const{mode:a,imageRotation:i,options:r}=t,s="string"==typeof e,o=s?e:e.url,{pathname:n,searchParams:c}=new URL(o);let l=s?n.match(_t)?.[1]:e.datasetFormat;if(!l)try{l=await at(o,{...t.options})}catch(h){y(h)||u.getLogger(this).error("#getContentType()",h)}switch(l??="UNKNOWN FORMAT",a){case"default":this.triangularMeasurementActive?await this._setImageSource(this.imageMeasurementViewer,l,o,c,i,r):await this._setImageSource(this._imageViewer,l,o,c,i,r);break;case"panoramic":if(Ft.has(l.toUpperCase())){const{selectedPoint:e}=this,{pitch:a,yaw:i,cameraLocation:s,viewAngle:n}=t,c=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer;c.imageSource=o;let l=i??0;"number"==typeof n?l=n-l:s&&e&&(l=await re(s,e)-l),c.pitch=a??0,c.yaw=l,await c.loadImage(r)}else this.setMessage("unsupportedPanoramicImageryError","error",void 0,{datasetFormat:l});break}},this._loadMeasurementViewerImage=async e=>{const{currentBestFeatureMeasurementImage:t,layer:a,mode:i}=this;if(this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics(),!a||!t||"none"===i||"video"===i)return;const{attributes:r}=t,{imagePath:s,imageRotation:o,cameraHeading:n,cameraRoll:c,cameraPitch:l,objectId:h,cameraOrientation:m,location:d}=r,p=(c??0)+(o??0),g=d.spatialReference.isWGS84&&4!==m?.type?z(d):new O(d);let f=s;if(Oe(s))try{f=await Te(a,h,e)}catch(w){if(y(w))return;return tt(w)?(u.getLogger(this).error(w),void this.setMessage("noAttachment","error",`${a.objectIdField}: ${h}`)):(u.getLogger(this).error(w,{[a.objectIdField]:h,layer:a}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${a.objectIdField} ${h}`))}try{await this.loadImageFromSource(f,{imageRotation:p,options:e,pitch:l,yaw:n,mode:i,cameraLocation:g}),v(e)}catch(w){y(w)||this.loadImageError(w)}},this._loadViewAdapter=async e=>{const{view:t}=this;if(t)switch(t.type){case"2d":{const{default:t}=await import("./adapters/view/MapViewAdapter.js");v(e),this._adapter=new t(this);break}case"3d":{const{default:t}=await import("./adapters/view/SceneViewAdapter.js");v(e),this._adapter=new t(this);break}}else this._adapter=null},this._mapImageConversionToolViewClickHandler=e=>{e.stopPropagation(),e.preventDefault(),e.mapPoint&&this.plotMapPoint(e.mapPoint)},this._measurementImageClickHandler=e=>{e.stopPropagation(),e.preventDefault();const{sketchTriangular:t,triangularMeasurementActive:a,currentBestFeatureMeasurementImage:i,triangulatedMeasurementGraphic:r}=this;t&&a&&i&&r&&"active"!==t.state&&(t.update([r],{tool:"reshape"}),this.updatingTriangularMeasurementState=!0)},this._viewClickHandler=e=>{this._clickTask?.abort(),this._clickTask=r(async t=>{const{pointerType:a,button:i,mapPoint:r}=e;if(("mouse"!==a||0===i)&&r)return e.stopPropagation(),e.preventDefault(),this._updatingHandles.addPromise(this.loadBestImage(r,{signal:t}))})},this.plotSelectedPointOnImage=async(e,a)=>{if(await f(a),!e)return;const i=new O({...A(e)?e.toJSON():e});if("default"===this.mode)i.x-=.5,i.y=.5-i.y,i.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:i,symbol:De}),this._imageViewer.addGraphic(this._crossSymbol,0);else if("panoramic"===this.mode){const{imageSize:a}=this._panoramicViewer;if(!a)return;const[i,r]=a,{heading:s,pitch:o}=se(e,i,r),n=oe(s,o);this._crossSymbol=new t({geometry:new O(n,B.WebMercator),symbol:Ue}),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([b(()=>this.view,()=>this.load(),M),b(()=>this.view?.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},I),b(()=>this.view?.map?.allLayers?.length,e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)},I),b(()=>[this.state,this.mapImageConversionToolState,this.view],()=>{this._createViewClickHandle(),this._createImageClickHandle()},M),b(()=>[this.triangularMeasurementActive,this.currentBestFeatureMeasurementImage],()=>{this._createTriangularImageClickHandle()},M),b(()=>[this.state,this.imageLocationToolState,this.view],(e,t)=>{if(this._initializeMeasurementService(),this._createImageLocationHandle(),!this.imageLocationToolState)return this.clearPreviousGroundLocation(),void this._resetCursor();e[1]!==t?.[1]&&this._setMeasurementCursor()},M),b(()=>this.measureType,()=>{this.clearPreviousMeasurements(),this._initializeMeasurementService()},M),b(()=>this.bestFeatureAngle,(e,t)=>{this.previousFeatureAngle=t??0},M),b(()=>this.currentBestFeature,async(e,t)=>{d(this._featureChangedTask),this._featureChangedTask=r(async a=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:a}])),await this._featureChangedTask.promise},{sync:!0}),b(()=>this.currentBestFeatureMeasurementImage,(e,t)=>{d(this._featureChangedTask),t&&e!==t&&(this.measurementVectors=[],this.triangulatedPoint=null,this.sketchTriangularGraphicsLayer?.graphics.destroyAll()),this._featureChangedTask=r(async a=>{await this.determineWorkflowForTriangularMeasurement(e,t,{signal:a}),v(a),this._reorderTriangularSketchLayer()})},M),b(()=>this.triangularMeasurementActive,(e,t)=>{t&&!e&&(this.measurementVectors=[],this.currentBestFeatureMeasurementImage=null,this.triangulatedDistanceMeasurement=null,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaAccuracy=0,this.sketchTriangularGraphicsLayer?.graphics.destroyAll(),this.clearReferencePointOnImage(),this.imageMeasurementViewer.clearImage(),this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearImage(),this._panoramicMeasurementViewer.clearGraphics())}),b(()=>this.mode,e=>{switch(this.removeHandles(wt.interactionHandles),e){case"default":this.addHandles(b(()=>{const{state:e}=this;return"image-loaded"===e?this._imageViewer.imagePointsInView:null},e=>{e&&(d(this._updateFootprintTask),this._updateFootprintTask=r(async t=>{await this.updateFootprint(e,{signal:t})}))},{...M,equals:(e,t)=>a(e,t,h)}),wt.interactionHandles);break;case"video":this.addHandles(b(()=>{const{footprintExtent:e}=this;if(e)return Pe},e=>{e&&(d(this._updateFootprintTask),this._updateFootprintTask=r(async t=>{await this.updateFootprint(e,{signal:t})}))},{...M,equals:(e,t)=>a(e,t,h)}),wt.interactionHandles);break;case"panoramic":this.addHandles(b(()=>{const{currentBestFeature:e,state:t,_panoramicViewer:a}=this,{imageSize:i,vfov:r,hfov:s,pitch:o,yaw:n}=a;return e&&i&&!t.includes("loading")&&null!=r&&null!=s&&null!=o&&null!=n?[r,s,n,o]:null},e=>{if(!e||this.state.includes("loading"))return;const[t,a,i,s]=e;this.currentNode&&(this.currentNode.currentHeading=i+(this.currentNode.heading??0),this.currentNode.currentPitch=s+(this.currentNode.pitch??0)),d(this._updateFootprintTask),this._updateFootprintTask=r(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:a,yaw:i,pitch:s},{signal:e}),this._updateFootprintTask=null})},{equals:(e,t)=>a(e,t,h)}),wt.interactionHandles)}},M),b(()=>[this.brightness,this.contrast,this.sharpness],()=>{const{_imageViewer:e,brightness:t,contrast:a,mode:i,sharpness:r}=this;"default"===i&&(e.brightness=t,e.contrast=a,e.sharpness=r)},M),b(()=>this.activeViewer?.imageRenderer,()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)}),b(()=>this.activeViewer,e=>{this.removeHandles(wt.hittestHandles),e&&this.addHandles(_(()=>e,"hittest-response",this._handleImageHitTestResponse),wt.hittestHandles)})]),this.when().finally(()=>{this.notifyChange("state")})}destroy(){this.currentBestFeature=null,this._updateFootprintTask=d(this._updateFootprintTask),this._clickTask=d(this._clickTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=p(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),this.videoViewModel=p(this.videoViewModel),this._crossSymbol=p(this._crossSymbol),this._referencePointOnGround=p(this._referencePointOnGround),this._referencePointOnImage=p(this._referencePointOnImage),this._locationPointOnImage=p(this._locationPointOnImage),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy(),this._imageViewer.destroy(),this.imageMeasurementViewer.destroy(),this._panoramicViewer.destroy(),this._panoramicMeasurementViewer.destroy()}get activeLayer(){return o(u.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){o(u.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get activeViewer(){const{_imageViewer:e,_panoramicViewer:t,mode:a}=this;switch(a){case"default":return e;case"panoramic":return t;default:return null}}get 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=>0===e)??!0}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",m(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",m(e,-10,10))}get currentNode(){const{currentBestFeature:e,navigationNodes:t}=this;return t.find(t=>t.id===e?.attributes.objectId)}get featureCount(){return this.features?.length??0}get imageGalleryEnabled(){const{currentBestFeature:e}=this;if(!e)return!1;const t=e.attributes.imagePath?.trim();return it(t)||Oe(t)}get imageLoaded(){return o(u.getLogger(this),"imageLoaded",{replacement:'Use OrientedImageryViewer.state === "image-loaded"',version:"4.29",warnOnce:!0}),"image-loaded"===this.state}get invalidCameraHeading(){return this.currentBestFeature?.attributes?.cameraHeading===Ve}get imagePointsInView(){const{mode:e,_imageViewer:t}=this;return"default"===e?t.imagePointsInView:null}get layerView(){const{layer:e,view:t}=this;if(e&&t)return t.allLayerViews.find(rt(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?ve(e):null}get mode(){const e=this.currentBestFeature?.attributes;if(!e)return"none";if(e.orientedImageryType?.includes("video"))return"video";const{horizontalFieldOfView:t,isSpherical:a}=e;return 360===t||a?"panoramic":"default"}get popupEnabled(){return!0===this.layer?.popupEnabled}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){const{_sectorData:e}=this;return e?Se.map(t=>e[t]):null}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",m(e,0,1))}get sketchGraphicsLayer(){return this.sketch?.layer}get state(){const{mode:e,disabled:t,_updatingHandles:{updating:a},_featureChangedTask:i}=this;if(t)return"disabled";if(!this.isFulfilled()||a||!1===i?.finished)return"loading";if(this.isRejected())return"error";if("error"===this.displayMessage?.type)return"image-load-error";switch(e){case"default":return this._imageViewer.state;case"panoramic":return this._panoramicViewer.state;case"video":return this.videoElement?.loaded?"video-loaded":"video-not-loaded"}return"ready"}get thumbnails(){const{features:e}=this;return e?new s(e.map(({attributes:{imagePath:e,objectId:t,cameraRoll:a,imageRotation:i}})=>{const r=e?.trim();return it(r)||Oe(r)?{url:r,objectId:t,rotation:(a??0)+(i??0)}:null}).filter(i)):null}set view(e){this._set("view",e)}get _sketchGraphicsLayer(){const{mode:e}=this;switch(e){case"panoramic":return new D({elevationInfo:{mode:"absolute-height"}});case"default":return new D;default:return}}get _overlaysView(){return this.view?.layerViews.find(({layer:e})=>e===this._overlays)}beforeLoad(){this.view?.closePopup(),this.displayMessage=null,this.clearPreviousGroundLocation(),this.triangularMeasurementActive=!1,this.currentBestFeatureMeasurementImage=null,this.measureType=null,this.imageLocationToolState=!1,this.features.removeAll(),this.currentBestFeature=null,this.additionalFeatures.removeAll(),this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),this._overlays?.removeAll()}async computeHeight(e,t,a=!0){return this._measurementService?.computeHeight(e,t,a)}async calculateAreaMeasurement(e,t,a){return this._measurementService?.calculateAreaMeasurement(e,t,a)}async calculateDistanceMeasurement(e,t,a){return this._measurementService?.calculateDistanceMeasurement(e,t,a)}async calculateAccuracy(e,t,a){return this._measurementService?.calculateAccuracy(e,t,a)}async calculateLocationAccuracy(e,t,a="default",i){return this._measurementService?.calculateLocationAccuracy(e,t,a,i)}async calculateAccuracyPanoramic(e,t,a){return this._measurementService?.calculateAccuracyPanoramic(e,t,a)}async calculateHeightMeasurementInfo(e,t,a){return this._measurementService?.calculateHeightMeasurementInfo(e,t,a)}async calculateTriangulatedMeasurements(e){return this._measurementService?.calculateTriangulatedMeasurements(e)}clearPreviousMeasurements(){this.clearMeasurementGraphics(),this.resetMeasurementData(),this.stopMeasurement()}clearPreviousGroundLocation(){this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.pixelCoordinates=null,this.clearLocationPointOnImage()}clearMeasurementGraphics(){this.measurementGraphic&&(this.activeViewer?.removeGraphic(this.measurementGraphic),this.measurementGraphic=null),this.heightGraphic&&(this.activeViewer?.removeGraphic(this.heightGraphic),this.heightGraphic=null),this.triangularMeasurementActive&&this.sketchTriangularGraphicsLayer?.graphics.destroyAll()}digitizeCancel(){return this.sketch?.cancel()}digitizeCanRedo(){return this.sketch?.canRedo()??!1}digitizeCanUndo(){return this.sketch?.canUndo()??!1}digitizeComplete(){return this.sketch?.complete()}async digitizeCreate(e,t){const{sketch:a,dataCaptureLayer:i}=this;if(!a)throw bt();Ce(i,e,a),await a.create(e,{...t,defaultZ:0})}digitizeDelete(){if(!this.sketch)throw bt();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw bt();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw bt();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw bt();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw bt();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw bt();return this.sketch.update(e,t)}async displayHeightResults(){const{currentBestFeature:e,activeViewer:t,heightMeasurementPixels:a,mode:i}=this,r=t?.imageSize,s=e?.attributes;if(!s||!r)return;const o=await this.computeHeight(a,i);o?.value&&o?.accuracy&&(this.heightMeasurementResult=o.value,this.heightMeasurementAccuracy=o.accuracy)}filterByFootprints(e,t,a=!1){const i=[],r=[],s=[];return e.forEach(e=>{const{layer:{coveragePercent:o},attributes:n}=e;let c;const{polygon:l,frustum:h}=$(n);if(c=l.clone(),n.isInspection&&(c=J(n)),o&&(c=Z(c,o)),a||!t||K(c,t)){s.push(e);const{geometry:t,objectId:a,cameraHeight:o,cameraHeading:c}=n,u=t.clone();u.z=o,u.imageID=a,this.pointSources.push(u),c!==Ve&&(i.push(l),h&&r.push(h))}}),{features:s,polygons:i,frustums:r}}getMeasurementProperties(e=this.currentBestFeature,t=this.activeViewer){if(!e||!t?.imageSize)return;const{elevationSample:a,attributes:i}=e,{elevationSource:r,cameraHeight:s}=i,o=ne(i,t.imageSize[0],t.imageSize[1]);let n=o.cameraLocation;return(n.spatialReference.isGeographic?H(n,B.WebMercator):Promise.resolve(n)).then(e=>(n=e,ce(n.spatialReference,n.z??0,s,{elevationSample:a,elevationSource:r,extent:this.footprintExtent}))).then(t=>("elevationSample"in t&&le(t.elevationSample)&&(e.elevationSample=t.elevationSample),{...o,cameraLocation:n,updateElevationProps:t}))}getMeasurementPropertiesPanoramic(){const{currentBestFeature:e,activeViewer:t}=this;if(!e||!t?.imageSize)return;const{elevationSample:a,attributes:i}=e,{elevationSource:r,cameraHeight:s}=i,o=he(i,t.imageSize[0],t.imageSize[1]);let n=o.cameraLocation;return(n.spatialReference.isGeographic?H(n,B.WebMercator):Promise.resolve(n)).then(e=>(n=e,ce(n.spatialReference,n.z??0,s,{elevationSample:a,elevationSource:r,extent:this.footprintExtent}))).then(t=>("elevationSample"in t&&le(t.elevationSample)&&(e.elevationSample=t.elevationSample),{...o,cameraLocation:n,updateElevationProps:t}))}async deleteDataCaptureFeatures(e){const{dataCaptureLayer:t}=this;if(!t)throw new n("orientedimagery","Data capture layer is not available");return t.queryFeatures({objectIds:e}).then(({features:e})=>t.applyEdits({deleteFeatures:e}))}handleSectorClick(e){if(isNaN(e))return;const t=this._sectorData?.[Se[e]],a=t?.at(0);a&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(a):this._updateCurrentBestFeature(a))}handleFeatureClick(e){const{sector:t,featureIndexInSector:a}=e;if(isNaN(a))return;const i=this._sectorData?.[t],r=i?.at(a);r&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(r):this._updateCurrentBestFeature(r))}handleDrawCursorUpdateEvents(e){const{measurementAngle:t,tempDistance:a,heightMeasurementPixels:i,mode:r,activeViewer:s,currentBestFeature:o}=this,n=s?.imageSize;if(!e.vertices||!n||!o)return;const c=je(e.vertices.at(-1),r,n);if(i.length<1||!c||!a||!t||"none"===r)return;const l=He(i[0],c,t);if(!l?.length)return;this.heightMeasurementPixels.push(l),"panoramic"===r?this.createPolylineGraphicPano():this.createPolylineGraphic();const h=Be(o.attributes.location.spatialReference),u=xe(this.heightMeasurementPixels,a,h);u&&(this.heightMeasurementResult=u)}async handleDrawVertexAddEvents(e,t){const{currentBestFeature:a,activeViewer:i,heightMeasurementPixels:r,mode:s}=this;if(!a||!i||!e.vertices?.length||"none"===s)return;const o=i?.imageSize;if(!r.length&&o){const a=je(e.vertices.at(-1),s,o);this.heightMeasurementPixels.push(a);const i=await this.calculateHeightMeasurementInfo(a,s,t);if(!i?.measurementAngle||!i?.tempDistance)return;this.measurementAngle=i.measurementAngle,this.tempDistance=i.tempDistance}}load(e){return this.addResolvingPromise(this._loadViewAdapter(e).catch(e=>{if(!y(e))throw e})),this}async loadBestImage(e,t){return this.selectedPoint=X(e),this.beforeLoad(),this._fetchFeaturesWithController(e,t)}loadImageError(e){u.getLogger(this).error("oriented-imagery-viewer:load-image",e),this.setMessage("imageLoadError","error",e.message)}async loadSketch(e){if(!this.sketch){const t=import("../Sketch/SketchViewModel.js"),{default:a}=await t;v(e),this.sketch=new a({layer:this._sketchGraphicsLayer,view:this.activeViewer?.imageRenderer,updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{edgeOperation:"none",shapeOperation:"none",vertexOperation:void 0},enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"transform"}})}return this.sketch}async loadMeasurementAdapter(e){if(!this.sketchAdapter){const t=import("./adapters/sketch/MeasurementAdapter.js"),{default:a}=await t;if(v(e),this.sketchAdapter=new a({viewModel:this}),!this.sketchAdapter.viewModel.isResolved())return}return this.sketchAdapter}async loadTriangulatedMeasurementAdapter(e){if(!this.triangulatedMeasurementAdapter){const t=import("./adapters/sketch/TriangulatedMeasurementAdapter.js"),{default:a}=await t;if(v(e),this.triangulatedMeasurementAdapter=new a({viewModel:this}),!this.triangulatedMeasurementAdapter.viewModel.isResolved())return}return this.triangulatedMeasurementAdapter}async processFeatureResponse(e,t,a){const{features:i}=e;if(this._clearFeatureGeometries(),!this._checkFeatures(i))return;const{features:r,polygons:s,frustums:o}=this.filterByFootprints(i,t,a?.skipFilter);if(!this._checkFeatures(r))return;this.coveragePolygons.addMany(s),this.coverageFrustums.addMany(o);const n=await this.processElevationSample(s,r,a);v(a),await this._updateElevationOfSelectedPointAndLocations(r,t,n),v(a),st(r,n);const c=this._processSuitableFeatures(r,t);this.updateSuitabilities(c,a?.loadBestImage)}async startMeasurement(e,t){this.sketch||await this.loadSketch(t),await this.loadMeasurementAdapter(t);const{sketch:a,sketchAdapter:i,activeViewer:r,mode:s}=this;if(!a||!i||!r||"none"===s)return;if(this.displayNewMeasurementButton=!1,"panoramic"===s&&(a.defaultCreateOptions.defaultZ=0),await a.create(e),"panoramic"===s){const{drawOperation:e}=a.view.activeTool;e.constraintsEnabled=!1,e._set("elevationDrawSurface",null)}const o=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;o&&this.sketch&&(this.sketch.polygonSymbol=Ne(o),this.sketch.polylineSymbol="panoramic"===s?We:qe(o,2.5))}startHeightMeasurement(){this.heightMeasurementPixels=[],this.displayNewMeasurementButton=!1,this.draw??=new Fe({view:this.activeViewer?.imageRenderer});this.draw.create("polyline").on(["cursor-update","vertex-add","draw-complete"],e=>this.handleDrawEvents(e))}createPolylineGraphic(){const e=[this.heightMeasurementPixels[0],this.heightMeasurementPixels.at(-1)],a=this.activeViewer?.imageRenderer.spatialReference;if(this.heightGraphic)this.heightGraphic.geometry=new j({paths:[e],spatialReference:a});else{const i=new j({paths:[e],spatialReference:a}),r=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;this.heightGraphic=new t({geometry:i,symbol:qe(r,2.5)}),this.activeViewer?.addGraphic(this.heightGraphic)}}createPolylineGraphicPano(){const e=this.activeViewer?.imageRenderer.spatialReference,a=this.activeViewer?.imageSize;if(!a)return;const i={x:this.heightMeasurementPixels[0][0],y:this.heightMeasurementPixels[0][1]},r={x:this.heightMeasurementPixels.at(-1)[0],y:this.heightMeasurementPixels.at(-1)[1]},{heading:s,pitch:o}=se(i,a[0],a[1]),{heading:n,pitch:c}=se(r,a[0],a[1]),l=[[...oe(s,o)],[...oe(n,c)]];if(this.heightGraphic)this.heightGraphic.geometry=new j({paths:[l],spatialReference:e});else{const a=new j({paths:[l],spatialReference:e});this.heightGraphic=new t({geometry:a,symbol:We}),this._panoramicViewer.addGraphic(this.heightGraphic,0)}}async editOverlayedGraphics(e){this.sketchTriangularGraphicsLayer||this._initializeSketchTriangularGraphicsLayer(),this.sketchTriangularGraphicsLayer?.destroyed&&this._handleDestroyedTriangularSketchLayer(),this.sketchTriangularGraphicsLayer.add(e),this.sketchTriangular||(this._initializeSketchTriangular(),await this.loadTriangulatedMeasurementAdapter()),this.updateOverlayedGeometry(e)}updateOverlayedGeometry(e){this.sketchTriangular?.update([e],{tool:"reshape"})}async processMeasurementVectors(e){this.triangularMeasurementActive&&this.currentBestFeature&&(this.measurementVectors?.length<2&&await this.updateMeasurementVectorsArray(e),2===this.measurementVectors.length&&await this.calculateTriangulatedMeasurements(e))}async updateMeasurementVectorsArray(e){const t=this.measurementVectors.length?this.currentBestFeatureMeasurementImage:this.currentBestFeature;if(t){const a=await this.computeMeasurementVector(e,t);a&&this.measurementVectors.push(a)}}async computeMeasurementVector(e,t){const{activeViewer:a,mode:i}=this,r=a?.imageSize;if(!e||!t||!r)return;const s=e.map(e=>[e[0]-.5,-.5-e[1]]),o=this.view?.spatialReference,n=[];for(let c=0;c<s.length;c++){const e={x:s[c][0],y:s[c][1]};let a=await this.getMapPoint(e,{feature:t,imageSize:r,mode:i});o&&!a.spatialReference.equals(o)&&(a=await H(a,o)),n.push(a)}return Ee(n,t)}async handleDrawEvents(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()}}initializeMeasurement(e){switch(this.clearMeasurementGraphics(),this.resetMeasurementData(),e){case"distance":this.startMeasurement("polyline");break;case"area":this.startMeasurement("polygon");break;case"height":this.startHeightMeasurement()}}async overlayCameraLocations(e){const{activeViewer:a,currentBestFeature:i,overlayedCameraLocations:r,layer:s,mode:o,state:n,layerFloorFilterClause:c}=this,l=a?.imageSize;if(!l||!i||!s||"none"===o||n.includes("loading"))return;const{polygon:h}=$(i.attributes);if(a.removeManyGraphics(r.toArray()),r.removeAll(),e){const{features:e}=await s.queryFeatures({where:P(`${s.objectIdField} <> ${i.attributes.objectId}`,P(s.definitionExpression,c)),geometry:h,returnGeometry:!0,outFields:[s.objectIdField]}),n=await Promise.all(e.map(async e=>{const{attributes:a,geometry:r}=e,s=await this.getPixels(r,{feature:i,imageSize:l,mode:o}),n="panoramic"===o?$e():Je();return new t({attributes:a,symbol:n,geometry:s})}));r.addMany(n),a.addManyGraphics(r.toArray())}}overlayGraphicsOnImage(e,t){this.removeOverlayedGraphicsOnImage(e),this.overlayedMapFeatures.set(e,t),this.activeViewer?.addManyGraphics(t.toArray())}async overlayMapFeatures(e,a=!1){const{activeViewer:r,currentBestFeature:o,mode:n,state:c,layer:l}=this,h=r?.imageSize;if(!h||!o||"none"===n||"video"===n||c.includes("loading")||!l)return;const{polygon:m}=$(o.attributes);try{const{imageGeometryField:t,oiObjectIdField:a}=Ge(e,l.imageGeometryField,l.imageReferenceField);this.imageGeometryField=t.name,this.oiObjectIdField=a.name}catch(g){u.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features",g)}const{features:d}=await e.queryFeatures({geometry:m,returnGeometry:!0,outFields:["*"]}),p=new s((await Promise.all(d.map(async i=>{const r=i.symbol?.clone()??e.renderer?.getSymbol(i)?.clone(),{attributes:s,geometry:c}=i,l=c,{imageGeometryField:m,oiObjectIdField:d}=this;if(m&&d&&Le(e,m,d)&&`${s[d]}`==`${o.attributes.objectId}`)try{return Re(s,m,e,a,h,n,r)}catch(g){u.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features","couldn't create graphic from attributes, geometry will be used",{error:g,feature:i,layer:e,imageGeometryField:this.imageGeometryField,imageReferenceField:this.oiObjectIdField})}switch(l?.type){case"point":{const i=await this.getPixels(l,{feature:o,imageSize:h,mode:n});return new t({attributes:s,layer:e,symbol:r,geometry:i,visible:e.visible&&a})}case"polygon":{const{rings:i,spatialReference:c}=l,u=i.map(e=>e.map(([e,t,a])=>new O({x:e,y:t,z:a,spatialReference:c}))),m=await Promise.all(u.map(async e=>this.getPixels(e,{feature:o,imageSize:h,mode:n}).then(e=>e.map(ue))));return new t({attributes:s,layer:e,symbol:r,geometry:new T({rings:m,spatialReference:B.WebMercator}),visible:e.visible&&a})}case"polyline":{const{paths:i,spatialReference:c}=l,u=i.map(e=>e.map(([e,t,a])=>new O({x:e,y:t,z:a,spatialReference:c}))),m=await Promise.all(u.map(async e=>this.getPixels(e,{feature:o,imageSize:h,mode:n}).then(e=>e.map(ue))));return new t({attributes:s,layer:e,symbol:r,geometry:new j({paths:m,spatialReference:B.WebMercator}),visible:e.visible&&a})}case"multipoint":{const{points:i,spatialReference:c}=l,u=i.map(([e,t,a])=>new O({x:e,y:t,z:a,spatialReference:c})),m=await this.getPixels(u,{feature:o,imageSize:h,mode:n}).then(e=>e.map(ue));return new t({attributes:s,layer:e,symbol:r,geometry:new R({points:m,spatialReference:B.WebMercator}),visible:e.visible&&a})}}return null}))).filter(i));this.overlayGraphicsOnImage(`${e.id}`,p)}async getPixels(e,t){const{imageSize:a,mode:i,feature:r}=t,s=(await this.worldToImage(Array.isArray(e)?e:[e],r)).map(e=>{if("default"===i)return new O({x:e.x-.5,y:.5-e.y,spatialReference:B.WebMercator});const[t,r]=a,{heading:s,pitch:o}=se(e,t,r),n=oe(s,o);return new O(n,B.WebMercator)});return Array.isArray(e)?s:s[0]}async getMapPoint(e,t){const{feature:a,mode:i,imageSize:r}=t,{elevationSample:s,attributes:o}=a,{elevationSource:n,location:c,cameraHeight:l}=o;let h=c.clone();h.spatialReference.isGeographic&&(h=await H(h,B.WebMercator));const u=await ce(c.spatialReference,c.z??0,l,{elevationSample:s,elevationSource:n,extent:this.footprintExtent});let m;if("elevationSample"in u&&le(u.elevationSample)&&(a.elevationSample=u.elevationSample),"default"===i){const t=ne(o,r[0],r[1]);m=await Y(Array.isArray(e)?e:[e],{...t,cameraLocation:h},u)}else{const t=he(o,r[0],r[1]);m=await ee(Array.isArray(e)?e:[e],{...t,cameraLocation:h},u)}return Array.isArray(e)?m:m[0]}getActiveSectors(){return Se.filter(e=>this._sectorData?.[e]?.length)}async plotMapPoint(e){return this.plotReferencePoint(e),this.transformAndPlotReferencePointOnImage({feature:this.currentBestFeature,selectedLocation:e,options:{signal:this._transformController?.signal}})}plotReferencePointOnGround(e){this._referencePointOnGround&&(this._overlays?.remove(this._referencePointOnGround),this._referencePointOnGround.destroy()),null!=e&&(this._referencePointOnGround=new t({geometry:new O({...e.toJSON()}),symbol:Ze}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit("plot-ground-point",{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){if("image-loaded"===this.state)switch(this.clearReferencePointOnImage(),this.mode){case"default":{const a=A(e)?e.toJSON():e;a.x-=.5,a.y=.5-a.y,this._referencePointOnImage=new t({geometry:new O({spatialReference:this._imageViewer.imageRenderer.spatialReference,...a}),symbol:Ze}),this._imageViewer.addGraphic(this._referencePointOnImage,0);break}case"panoramic":{const{imageSize:a}=this._panoramicViewer;if(!a)return;const[i,r]=a,{heading:s,pitch:o}=se(e,i,r),n=oe(s,o);this._referencePointOnImage=new t({geometry:new O(n,B.WebMercator),symbol:Ke}),this._panoramicViewer.addGraphic(this._referencePointOnImage,0);break}}}plotLocationPointOnImage(e,t=!1){if("image-loaded"===this.state)switch(this.clearLocationPointOnImage(t),this.mode){case"default":this._plotLocationPointOnDefaultImage(e,t);break;case"panoramic":this._plotLocationPointOnPanoramicImage(e,t)}}removeAllOverlayMapFeatures(){this.overlayedMapFeatures.forEach(e=>{this._imageViewer.removeManyGraphics(e.toArray())}),this.overlayedMapFeatures.clear()}removeOverlayedGraphicsOnImage(e){const t=this.overlayedMapFeatures.get(e);t?.length&&(this.activeViewer?.removeManyGraphics(t.toArray()),this.overlayedMapFeatures.delete(e))}resetImage(){switch(this.setMessage("onLoadMessage","info"),this.mode){case"default":this._imageViewer.clearImage(),this._imageViewer.clearGraphics();break;case"panoramic":this._panoramicViewer.clearGraphics()}this._clickTask=d(this._clickTask)}resetVideo(){this.setMessage("onLoadMessage","info"),this.videoViewModel?.resetVideoHandler(),this._overlays?.removeAll(),this.videoViewModel=null,this.featureCache=[],this.currentBestFeature=null}resetMeasurementData(){this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.heightMeasurementPixels=[],this.measurementVectors=[],this.heightMeasurementResult=0,this.tempDistance=null,this.measurementAngle=null,this.heightMeasurementAccuracy=0,this.heightGraphic=null,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedMeasurementGraphic=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaAccuracy=0}async saveDrawing(){const{dataCaptureLayer:e,sketchAdapter:t}=this;if(!e||"data-capture"!==t?.type)return;const{pendingGraphics:a,savedGraphics:i}=t,r=a.get(e.id),s=r?.toArray();if(!r||!s?.length)return;const{addFeatureResults:o}=await this.saveDataCaptureFeatures(s),n=o.reduce((t,{objectId:a,globalId:i,error:r},o)=>{const n=s[o],{attributes:c}=n;return r?t.error.push(n):(a&&(c[e.objectIdField]=a),i&&e.globalIdField&&(c[e.globalIdField]=i),t.success.push(n)),t},{success:[],error:[]});i.addMany(n.success),r.removeAll(),r.addMany(n.error)}async saveDataCaptureFeatures(e){const{activeViewer:t,currentBestFeature:a,dataCaptureLayer:r,mode:s}=this,o=t?.imageSize;if(!o||!a||"none"===s||"video"===s)throw new n("orientedimagery","Image size, current best feature and mode are required to save data capture features");if(!r)throw new n("orientedimagery","Data capture layer is not available");const c=await Promise.all(e.map(async e=>{const t=e.clone(),{geometry:i}=t;if(!i)return;const n=i.type,c=r.hasZ,l=r.geometryType,h=n!==l,u=h?await import("./transformers.js"):null,m=u?.default[l],d=h?m?.(i):i;if(d)switch(d.type){case"point":return t.geometry=await this.getMapPoint(me(s,d,o),{feature:a,imageSize:o,mode:s}),c||(delete t.geometry.z,t.geometry.hasZ=!1),t.geometry.hasM=!1,t;case"polygon":{const e=await Promise.all(d.rings.map(async e=>this.getMapPoint(e.map(([e,t,a])=>me(s,{x:e,y:t,z:a},o)),{feature:a,imageSize:o,mode:s})));return t.geometry=new T({spatialReference:e[0][0].spatialReference,hasZ:c,hasM:!1,rings:e.map(e=>e.map(ue))}),t}case"polyline":{const e=await Promise.all(d.paths.map(async e=>this.getMapPoint(e.map(([e,t,a])=>me(s,{x:e,y:t,z:a},o)),{feature:a,imageSize:o,mode:s})));return t.geometry=new j({spatialReference:e[0][0].spatialReference,hasZ:c,hasM:!1,paths:e.map(e=>e.map(ue))}),t}}})),l=c.filter(i);return r.applyEdits({addFeatures:l}).then(e=>{const{addFeatureResults:t}=e;let a=0;const i=c.map(e=>{const i=t[a++];return e?i:{error:new n("orientedimagery","Error in saving data capture features"),objectId:null,globalId:null}});return{...e,addFeatureResults:i}})}async searchBestImage(e,t){try{const a=await N(e,t);a&&await this.processFeatureResponse(a,e.point,t)}catch(a){y(a)||(this.setMessage("imageLoadError","error",a.message),u.getLogger(this).error("error occurred while finding best image",a))}}selectTriangularMeasurementFeature(e){this.currentBestFeatureMeasurementImage=this.features?.find(({attributes:t})=>t.objectId===Number(e))}setAdditionalCameraLocationsVisibility(e){this.additionalCameraLocations.forEach(t=>{t.visible=e})}setAdditionalCoverageVisibility(e){this.additionalFootprints.forEach(t=>{t.visible=e})}setCurrentCoverageVisibility(e){this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.visible=e),this.currentBestFeatureLocation&&(this.currentBestFeatureLocation.visible=e)}setMapImageConversionToolState(e){this.mapImageConversionToolState=e}setCurrentPanoramaView(e,t){this._panoramicViewer?.set({yaw:e,pitch:t})}async startDataCapture(e,t){const a=this.activeViewer?.imageRenderer,{oiObjectIdField:i,currentBestFeature:r}=this;if(!a||!r||!i)return;const{attributes:{objectId:o}}=r,n=this.overlayedMapFeatures.get(e.id)?.toArray()??[],c=[],l=[];for(const s of n)`${s.getAttribute(i)}`==`${o}`?c.push(s):l.push(s);this.overlayGraphicsOnImage(e.id,new s(l)),this.collectionId=e.id;const h=await this.loadSketch(t),u=await this.loadDataCaptureAdapter(t);v(t),h.layer.addMany(c),h.layer.blendMode="source-atop",u.savedGraphics.addMany(c);a.ui.find("zoom").visible=!1,a.map.layers.add(this.sketchGraphicsLayer)}async stopDataCapture(e=!1){this.sketch?.cancel(),this.sketchGraphicsLayer?.removeAll(),this.sketchAdapter=p(this.sketchAdapter),this.sketch=p(this.sketch),this.collectionId=null;const{dataCaptureLayer:t}=this,a=this.activeViewer?.imageRenderer;if(!a||a.destroyed)return;a.map.layers.remove(this.sketchGraphicsLayer),e&&t&&await this.overlayMapFeatures(t,!0);const i=a.ui.find("zoom");i&&(i.visible=!0)}stopMeasurement(){this.heightMeasurementPixels=[],this.draw?.reset(),this.sketch?.cancel()}toggleAllOverlayMapFeatures(e){this.overlayedMapFeatures.forEach(t=>{this._toggleVisiblity(t,e)})}toggleOverlayMapFeatures(e,t,a){const i=this.overlayedMapFeatures.get(e);i&&a&&this._toggleVisiblity(i,t)}toggleSelection(e){const{sketch:t}=this;t&&(t.updateOnGraphicClick=e,t.cancel())}async transformAndPlotReferencePointOnImage(e){const{feature:t,selectedLocation:a,options:i}=e;let r=!1,s=!1;const o=this.bestFeatureFootprint?.geometry;switch(o?.type){case"polygon":{const e=a.spatialReference.equals(o.spatialReference)?a:await H(a,o.spatialReference);r=o.contains(e);break}case"mesh":{const e=a.spatialReference.equals(o.spatialReference)?a:await H(a,o.spatialReference);s=o.extent.contains(e);break}}if(!r&&!s)return void this.clearReferencePointOnImage();const n=await this.worldToImage(a,t,i);if(n)return v(i),this.plotReferencePointOnImage(n),{x:n.x,y:n.y};this.clearReferencePointOnImage()}async triangulatedLocationWorkflow(e,t){if(this.currentBestFeature&&e){const{currentBestFeature:a}=this;this.triangulatedPoint&&(this.measurementVectors=[],this.triangulatedPoint=null,this.clearLocationPointOnImage(!0));const i=Ee(e,a);if(!i)return;this.measurementVectors.push(i),await this.plotReferenceLocationPoint(e,t),v(t),this._createTriangularImageLocationHandle()}}async _calculateTriangulatedPointFromGroundPoint(e,t){if(this.currentBestFeatureMeasurementImage&&e){const{currentBestFeatureMeasurementImage:a}=this,i=Ee(e,a);i&&this.measurementVectors.push(i);const r=await ze(this.measurementVectors);v(t),this.triangulatedPoint=r??this.triangulatedPoint}}async _fetchFeatures(e,t){if(!this.view)return;const a=this.layer;if(a){const i={include:a},r=this.view.toScreen(e);if(!r)return;const s=await this.view.hitTest(r,i);return this._processHitTestResults(a,s,t)}}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(a){if(y(a))return;this.setMessage("imageLoadError","error"),u.getLogger(this).error("error occurred while fetching features",a)}}_groupFeaturesBySectors(){const{_suitabilities:e,additionalFeatures:t,features:a,invalidCameraHeading:i}=this,r=a.at(0);if(!e||!t||!r||!a||i)return void(this._sectorData=null);this._sectorData={};const o={};this._featureToSector=o;for(const h of Se)this._sectorData[h]=new s;const n=e.map((e,t)=>({...e,featureIndex:t}));n.sort((e,t)=>e.trueSuitability-t.trueSuitability);const c=n.map(({distance:e})=>e),l=Math.max(...c);n.forEach(e=>{const{distance:t,angle:i,featureIndex:s}=e,n=t/l*Ae[2],c=nt(t,l),h=ot(i);if(!this._sectorData)return;const u=Ae[3]+n*Math.sin(i*Math.PI/180),m=Ae[3]+n*Math.cos(i*Math.PI/180);let d;const p=a.at(s),g=p===r,{cameraPitch:y}=p.attributes,v=y<5;if(g&&v)d=-90;else{const e=u-Ae[3],t=m-Ae[3],a=t/Math.sqrt(e**2+t**2);let i=180*Math.acos(a)/Math.PI;(e<0&&t<0||e<0&&t>0)&&(i*=-1),d=i}const f=""===c?h:`${c}_${h}`;g&&(d===this.bestFeatureAngle?this.previousFeatureAngle=d:this.bestFeatureAngle=d,this.navigatorCurrentBestFeature=v?null:{x:u,y:m,direction:h}),o[`${p.attributes.objectId}`]=f;const w=this._sectorData[f];w.add({angle:i,featureIndex:s,x:u,y:m,objectID:p.attributes.objectId,sector:f,featureIndexInSector:w.length})})}_handleDestroyedTriangularSketchLayer(){this.sketchTriangularGraphicsLayer&&(this.imageMeasurementViewer.imageRenderer.map.layers.remove(this.sketchTriangularGraphicsLayer),this.sketchTriangularGraphicsLayer=new D,this.imageMeasurementViewer.imageRenderer.map.layers.add(this.sketchTriangularGraphicsLayer),this.sketchTriangular&&(this.sketchTriangular.layer=this.sketchTriangularGraphicsLayer,this.sketchTriangular.view=this.imageMeasurementViewer.imageRenderer))}_initializeMeasurementService(){this._measurementService||(this._measurementService=new vt(this))}_initializeSketchTriangular(){this.sketchTriangular=new ft({view:this.imageMeasurementViewer.imageRenderer,layer:this.sketchTriangularGraphicsLayer,updateOnGraphicClick:!1,defaultUpdateOptions:{toggleToolOnClick:!1}})}_initializeSketchTriangularGraphicsLayer(){this.sketchTriangularGraphicsLayer=new D,this.imageMeasurementViewer.imageRenderer.map.layers.add(this.sketchTriangularGraphicsLayer)}_initializeVideo(){if(this.videoElement||!this.currentBestFeature)return;this.removeHandles(wt.videoPlayerHandles),this.videoElement=new fe({video:this.currentBestFeature.attributes.imagePath,georeference:new ye({extent:new G(ke)}),autoplay:!1}),this.videoElement.content?.loop&&(this.videoElement.content.loop=!1);const e=new U({source:this.videoElement,title:this.layer?.title,copyright:this.layer?.copyright});this.videoLayer=e,e&&this.videoMapView.map.layers.add(e),this.addHandles(ht(this.videoMapView),wt.videoPlayerHandles),this.videoViewModel=new dt({oiViewModel:this})}_plotLocationPointOnDefaultImage(e,a=!1){const i=A(e)?e.toJSON():e;i.x-=.5,i.y=.5-i.y,a?(this._correctedLocationPointOnImage=new t({geometry:new O({spatialReference:B.WebMercator,...i}),symbol:Qe}),this.imageMeasurementViewer.addGraphic(this._correctedLocationPointOnImage,0)):(this._locationPointOnImage=new t({geometry:new O({spatialReference:B.WebMercator,...i}),symbol:Qe}),this._imageViewer.addGraphic(this._locationPointOnImage,0))}_plotLocationPointOnPanoramicImage(e,a=!1){const i=a?this._panoramicMeasurementViewer:this._panoramicViewer,{imageSize:r}=i;if(!r)return;const[s,o]=r,{heading:n,pitch:c}=se(e,s,o),l=oe(n,c),h=new t({geometry:new O(l,B.WebMercator),symbol:Xe});a?this._correctedLocationPointOnImage=h:this._locationPointOnImage=h,i.addGraphic(h,0)}_clearFeatureGeometries(){this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll()}_checkFeatures(e){return!!e?.length||(this.setMessage("noImageError","error"),this.currentBestFeature=null,!1)}async _getElevationSampleFromGround(e,t,a){if(!e[0])return;const i=await L(e);if(this._updateFootprintWithFeatures(t,i),this.view?.supportsGround)try{return await this.view.map.ground.createElevationSampler(this.footprintExtent,a)}catch(r){y(r)||u.getLogger(this).error(r)}}async processElevationSample(e,t,a){const{elevationSource:i}=t[0].attributes,r=await this._getElevationSampleFromGround(e,t,a);return r||(i&&this.footprintExtent&&Q(i)?await ae({extent:this.footprintExtent,lod:i.lod,url:i.url,rasterFunction:i.rasterFunction}):void 0)}_processSuitableFeatures(e,t){return q({features:e,selectedPoint:t,camera:ct(this.view)?this.view.camera:null,currentImage:this.currentBestFeature})}async _processHitTestResults(e,t,a){const{screenPoint:i,results:[r]}=t,s="graphic"===r?.type&&this.shouldShowSelectedImage,o=r?.mapPoint??this.view?.toMap(i);if(!o)return;o.x=E(o.x,o.spatialReference);const{layerFloorFilterClause:n}=this,c=e.spatialReference.equals(o.spatialReference)?o:await H(o,e.spatialReference),l=c.spatialReference.isGeographic?z(c):c,h=P("1=1",P(e.definitionExpression,n)),u=l.spatialReference.isGeographic?1:V(l.spatialReference),m={layerInstanceOrURL:e,point:l,queryParams:{where:h,maximumDistance:e.maximumDistance?e.maximumDistance/u:void 0,objectIds:s?[r.graphic.getAttribute(e.objectIdField)]:void 0}};await this.searchBestImage(m,a)}async _queryAndLoadByObjectId(e,t,a,i){this.displayMessage=null;const{response:r}=await yt(e,t,a,i);if(v(i),!r?.features?.length)throw new gt(t);const s=X($(r.features[0].attributes).polygon.centroid),o=V(s.spatialReference);this.selectedPoint=s;const n={layerInstanceOrURL:e,point:s,queryParams:{where:P(P("1=1",P(e.definitionExpression,a)),`${e.objectIdField} <> ${t}`),maximumDistance:e.maximumDistance?e.maximumDistance/o:void 0}},c=await N(n,i);v(i);const{features:l}=c;return l.push(r.features[0]),await this.processFeatureResponse(c,s,{...i,loadBestImage:!1})}_reorderTriangularSketchLayer(){const e=this.imageMeasurementViewer.imageRenderer.map.layers?.length;this.sketchTriangularGraphicsLayer&&e&&this.imageMeasurementViewer.imageRenderer.map.layers.reorder(this.sketchTriangularGraphicsLayer,e-1)}_resetCursor(){const{activeViewer:e,imageMeasurementViewer:t}=this;e&&this.removeHandles(wt.activeViewerCursorHandles),t&&this.removeHandles(wt.imageViewerCursorHandles)}async _setImageSource(e,t,a,i,r,s){e.imageSource={datasetFormat:t.toUpperCase(),url:a.split("?")[0]},e.customParameters=Object.fromEntries(i),e.imageRotation=r??0,await e.loadImage(s)}_setMeasurementCursor(){const{activeViewer:e,imageMeasurementViewer:t,triangularMeasurementActive:a}=this;e&&this.addHandles(e.imageRenderer.acquireCursor("crosshair","high"),wt.activeViewerCursorHandles),t&&a&&this.addHandles(t.imageRenderer.acquireCursor("crosshair","high"),wt.activeViewerCursorHandles)}_toggleVisiblity(e,t){e.forEach(e=>{e.visible=t})}async _updateElevationOfSelectedPointAndLocations(e,t,a,i){const r=le(a),{location:s,cameraHeight:o}=e[0].attributes,n=await ce(s.spatialReference,s.z,o,{elevationSample:r?a:void 0,elevationSource:r?void 0:e[0].attributes.elevationSource,extent:this.footprintExtent},i);v(i);const[c,...l]=await te([t,...e.map(e=>e.attributes.geometry.clone())],n);v(i),t.elevation=c.z,e.forEach((e,t)=>{e.attributes.elevation=l[t].z})}_updateFeatures(e,t=!0){if(!e.length)return this.currentBestFeature=null,void this.additionalFeatures.removeAll();this.features.removeAll(),this.features.addMany(e),this.navigationNodes.removeAll(),this.navigationNodes.addMany(e.map(e=>{const{geometry:t,attributes:a}=e,{isSpherical:i,cameraHeading:r,cameraPitch:s}=a;return new mt({geometry:t,attributes:a,currentHeading:i?0:r,currentPitch:i?0:s})})),e.length>1?this.additionalFeatures.addMany(e.slice(1)):this.additionalFeatures.removeAll(),this._updateGroundElevation=!0,t&&(this.currentBestFeature=e[0]),"video"===this.mode&&(this._initializeVideo(),this.videoElement?.loaded&&this.videoViewModel?.playVideoFromSelectedLocation(e[0]))}_updateFootprintWithFeatures(e,t){const a=[];for(const{attributes:{geometry:i}}of e)t.contains(i)||a.push([i.x,i.y]);a.sort((e,t)=>+x([e,t])),t.addRing(a),this.footprintExtent=_e(t.extent,2,2)}async _updatePointsAndPolygons(e){const{pointSources:a,currentBestFeature:i,currentCoverageVisible:r,isAdditionalPointSourcesVisible:s,mode:o,layer:n}=this;if(i&&(this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.destroy(),this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null),!this.invalidCameraHeading)){await(this._adapter?.createFootprints(e)),v(e);for(const e of a)e.imageID===i.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:e.imageID},geometry:e.clone(),symbol:Ye,visible:r}):this.additionalCameraLocations.push(new t({attributes:{imageID:e.imageID},geometry:e.clone(),symbol:et,visible:s}));if("video"===o&&n&&!this.featureCache.length){const e=await W(n,i.geometry.spatialReference);e.features?.length&&(this.featureCache=e.features)}}}_updateCurrentBestFeature(e){if(!e)return;if(this.currentBestFeature=this.features?.at(e.featureIndex),"video"===this.mode)return void(this.currentBestFeature&&this.videoViewModel?.playVideoFromSelectedLocation(this.currentBestFeature));const t=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;let a;if(t)a=-90;else{const t=e.x-Ae[3],i=e.y-Ae[3],r=i/Math.sqrt(t**2+i**2);let s=180*Math.acos(r)/Math.PI;(t<0&&i<0||t<0&&i>0)&&(s*=-1),a=s}a===this.bestFeatureAngle?this.previousFeatureAngle=a:this.bestFeatureAngle=a,this.navigatorCurrentBestFeature=t?null:{x:e.x,y:e.y,direction:e.sector.includes("_")?e.sector.split("_")[1]:e.sector}}_updateImageMeasurementBestFeature(e){e&&(this.currentBestFeatureMeasurementImage=this.features?.at(e.featureIndex))}clearGraphics(){this._imageViewer.clearGraphics(),this._panoramicViewer.clearGraphics(),this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics()}clearReferencePointOnImage(){this._referencePointOnImage&&(this._imageViewer.removeGraphic(this._referencePointOnImage),this._panoramicViewer.removeGraphic(this._referencePointOnImage),this._referencePointOnImage=p(this._referencePointOnImage))}clearLocationPointOnImage(e=!1){this._locationPointOnImage&&!e&&(this._imageViewer.removeGraphic(this._locationPointOnImage),this._panoramicViewer.removeGraphic(this._locationPointOnImage),this._locationPointOnImage=p(this._locationPointOnImage)),this._correctedLocationPointOnImage&&(this.imageMeasurementViewer.removeGraphic(this._correctedLocationPointOnImage),this._panoramicMeasurementViewer.removeGraphic(this._correctedLocationPointOnImage),this._correctedLocationPointOnImage=p(this._correctedLocationPointOnImage))}plotReferencePoint(e){"mapPoint"in e?this.plotReferencePointOnGround(e.mapPoint):this.plotReferencePointOnGround(e)}async plotReferenceLocationPoint(e,t){if(this.currentBestFeatureMeasurementImage){const a=await this.worldToImage(e,this.currentBestFeatureMeasurementImage,{signal:t});v(t),a&&this.plotLocationPointOnImage(a,!0)}}setMessage(e,t,a,i){this.displayMessage={key:e,type:t,data:a,map:i}}async transformAndPlotSelectedLocation(e){const{currentBestFeature:t,invalidCameraHeading:a,selectedPoint:i,activeViewer:r}=this;if(this._crossSymbol&&(this._panoramicViewer.removeGraphic(this._crossSymbol),this._imageViewer.removeGraphic(this._crossSymbol),this._crossSymbol=p(this._crossSymbol)),!i||!t||"image-loaded"!==r?.state||a)return;let s;try{s=await this.worldToImage(i,t,e),v(e),await this.plotSelectedPointOnImage(s,e)}catch(o){y(o)||u.getLogger(this).error("failed to transform map point to pixel, cross symbol will not be plotted on image",{error:o,selectedPoint:i,feature:t})}}async worldToImage(e,t,a){const{footprintExtent:i}=this,{imageSize:r}=this.activeViewer;if("none"===this.mode||!t||!r||!i)return;const{attributes:{location:s,elevationSource:o,cameraHeading:n,cameraHeight:c},elevationSample:l}=t;let h=s.clone();const u=await ce(s.spatialReference,s.z??0,c,{elevationSample:l,elevationSource:o});t.elevationSample=u.elevationSample;const m=Array.isArray(e)?e:[e];let d,p=await Promise.all(m.map(e=>new Promise(t=>{if(!e.hasZ)return t(te(e,u));t(e)})));if(s.spatialReference.isGeographic&&(h=await H(h,B.WebMercator,a)),p=await Promise.all(p.map(async e=>h.spatialReference.equals(e.spatialReference)?e:await H(e,h.spatialReference,a))),v(a),"panoramic"===this.mode)d=ge(p,{imageHeight:r[1],imageWidth:r[0],cameraHeading:n,cameraLocation:h});else{const e=de(t.attributes,r[0],r[1]);d=pe(p,{...e,cameraLocation:h})}return Array.isArray(e)?d:d[0]}updateCurrentCoveragePolygon(e){const{additionalFootprints:a,additionalCameraLocations:i,currentBestFeature:r,currentBestFeatureLocation:s,currentCoverageVisible:o,selectedPoint:n,view:c,_adapter:l,mode:h}=this,{attributes:{objectId:u},elevationSample:m}=r;if(this._initialCurrentCoverageUpdate){if(this._overlays?.removeAll(),this._initialCurrentCoverageUpdate=!1,this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=o,this.bestFeatureCurrentFootprint=e),c){const e=[...a,...i,s].filter(lt);c.supportsGround&&m&&l?.updateGroundElevation&&(this._updateGroundElevation&&l.updateGroundElevation(e,m),"panoramic"===h&&l.updateGroundElevation([this.bestFeatureCurrentFootprint],m)),this._updateGroundElevation=!1,n&&(e.splice(-2,0,this.bestFeatureCurrentFootprint),e.push(new t({geometry:n.clone(),symbol:De.clone(),attributes:{imageID:u}}))),this._overlays.graphics.addMany(e)}}else if(c){if(this.invalidCameraHeading)return;this.bestFeatureCurrentFootprint&&(this._overlays?.remove(this.bestFeatureCurrentFootprint),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint));const t=this.bestFeatureCurrentFootprint&&this._overlays?this._overlays.graphics.indexOf(this.bestFeatureCurrentFootprint):-1;e&&(this.bestFeatureCurrentFootprint=e,c?.supportsGround&&m&&l?.updateGroundElevation&&"panoramic"===h&&l.updateGroundElevation([e],m),e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}};e([S()],Mt.prototype,"activeLayer",null),e([S({readOnly:!0})],Mt.prototype,"activeViewer",null),e([S()],Mt.prototype,"activeTriangulatedViewer",null),e([S()],Mt.prototype,"accuracyParametersMissing",null),e([S()],Mt.prototype,"additionalFeatures",void 0),e([S({type:s.ofType(t)})],Mt.prototype,"additionalCameraLocations",void 0),e([S({type:s.ofType(t)})],Mt.prototype,"additionalFootprints",void 0),e([S()],Mt.prototype,"areaMeasurementResult",void 0),e([S()],Mt.prototype,"areaMeasurementAccuracy",void 0),e([S()],Mt.prototype,"bestFeatureAngle",void 0),e([S()],Mt.prototype,"bestFeatureCurrentFootprint",void 0),e([S({type:t})],Mt.prototype,"bestFeatureFootprint",void 0),e([S({type:Number})],Mt.prototype,"brightness",null),e([S()],Mt.prototype,"cameraHeadingThreshold",void 0),e([S()],Mt.prototype,"cameraPitchThreshold",void 0),e([S()],Mt.prototype,"clickAction",void 0),e([S()],Mt.prototype,"videoViewModel",void 0),e([S()],Mt.prototype,"collectionId",void 0),e([S({type:Number})],Mt.prototype,"contrast",null),e([S()],Mt.prototype,"conversionProps",void 0),e([S()],Mt.prototype,"coverageFrustums",void 0),e([S()],Mt.prototype,"coveragePolygons",void 0),e([S()],Mt.prototype,"currentBestFeature",void 0),e([S()],Mt.prototype,"currentBestFeatureMeasurementImage",void 0),e([S()],Mt.prototype,"currentBestFeatureLocation",void 0),e([S()],Mt.prototype,"currentCoverageVisible",void 0),e([S()],Mt.prototype,"currentNode",null),e([S()],Mt.prototype,"featureCache",void 0),e([S()],Mt.prototype,"navigationNodes",void 0),e([S({json:{write:!1}})],Mt.prototype,"determineWorkflowForFeature",void 0),e([S({json:{write:!1}})],Mt.prototype,"determineWorkflowForTriangularMeasurement",void 0),e([S()],Mt.prototype,"disabled",void 0),e([S()],Mt.prototype,"displayMessage",void 0),e([S()],Mt.prototype,"displayNewMeasurementButton",void 0),e([S()],Mt.prototype,"distanceMeasurementResult",void 0),e([S()],Mt.prototype,"distanceAccuracyArray",void 0),e([S()],Mt.prototype,"dataCaptureLayer",void 0),e([S({readOnly:!0})],Mt.prototype,"featureCount",null),e([S()],Mt.prototype,"features",void 0),e([S()],Mt.prototype,"groundCoordinates",void 0),e([S()],Mt.prototype,"groundCoordinatesAccuracy",void 0),e([S()],Mt.prototype,"heightMeasurementPixels",void 0),e([S()],Mt.prototype,"heightGraphic",void 0),e([S()],Mt.prototype,"heightMeasurementResult",void 0),e([S()],Mt.prototype,"heightMeasurementAccuracy",void 0),e([S()],Mt.prototype,"measurementAngle",void 0),e([S()],Mt.prototype,"tempDistance",void 0),e([S({readOnly:!0})],Mt.prototype,"imageGalleryEnabled",null),e([S()],Mt.prototype,"imageGeometryField",void 0),e([S({readOnly:!0})],Mt.prototype,"imageLoaded",null),e([S()],Mt.prototype,"imageLocationToolState",void 0),e([S({readOnly:!0})],Mt.prototype,"invalidCameraHeading",null),e([S()],Mt.prototype,"imagePointsInView",null),e([S()],Mt.prototype,"imageMeasurementViewer",void 0),e([S()],Mt.prototype,"isAdditionalCoverageVisible",void 0),e([S()],Mt.prototype,"isAdditionalPointSourcesVisible",void 0),e([S()],Mt.prototype,"measurementVectors",void 0),e([S()],Mt.prototype,"layer",void 0),e([S()],Mt.prototype,"layerView",null),e([S({readOnly:!0})],Mt.prototype,"layerFloorFilterClause",null),e([S({type:Number})],Mt.prototype,"localPort",void 0),e([S()],Mt.prototype,"mapImageConversionToolState",void 0),e([S()],Mt.prototype,"measureType",void 0),e([S()],Mt.prototype,"measurementGraphic",void 0),e([S({readOnly:!0,value:"none"})],Mt.prototype,"mode",null),e([S()],Mt.prototype,"navigationMode",void 0),e([S()],Mt.prototype,"navigatorCurrentBestFeature",void 0),e([S()],Mt.prototype,"oiObjectIdField",void 0),e([S({type:s.ofType(t)})],Mt.prototype,"overlayedCameraLocations",void 0),e([S()],Mt.prototype,"overlayedMapFeatures",void 0),e([S()],Mt.prototype,"pixelCoordinates",void 0),e([S()],Mt.prototype,"preserveAngle",void 0),e([S()],Mt.prototype,"pointSources",void 0),e([S({readOnly:!0})],Mt.prototype,"popupEnabled",null),e([S()],Mt.prototype,"previousFeatureAngle",void 0),e([S()],Mt.prototype,"referencePoint",null),e([S({readOnly:!0})],Mt.prototype,"sectorData",null),e([S()],Mt.prototype,"selectedPoint",void 0),e([S({type:Number})],Mt.prototype,"sharpness",null),e([S()],Mt.prototype,"shouldShowSelectedImage",void 0),e([S()],Mt.prototype,"sketch",void 0),e([S()],Mt.prototype,"sketchTriangular",void 0),e([S()],Mt.prototype,"sketchTriangularGraphicsLayer",void 0),e([S()],Mt.prototype,"draw",void 0),e([S()],Mt.prototype,"sketchAdapter",void 0),e([S({readOnly:!0})],Mt.prototype,"sketchGraphicsLayer",null),e([S({readOnly:!0})],Mt.prototype,"state",null),e([S({readOnly:!0})],Mt.prototype,"thumbnails",null),e([S()],Mt.prototype,"triangularMeasurementActive",void 0),e([S()],Mt.prototype,"triangulatedDistanceMeasurement",void 0),e([S()],Mt.prototype,"triangulatedDistanceAccuracy",void 0),e([S()],Mt.prototype,"triangulatedAreaMeasurement",void 0),e([S()],Mt.prototype,"triangulatedAreaAccuracy",void 0),e([S()],Mt.prototype,"triangulatedMeasurementGraphic",void 0),e([S()],Mt.prototype,"triangulatedPoint",void 0),e([S()],Mt.prototype,"triangulatedMeasurementAdapter",void 0),e([S()],Mt.prototype,"updateFootprint",void 0),e([S()],Mt.prototype,"updateFootprintPanorama",void 0),e([S()],Mt.prototype,"updatingTriangularMeasurementState",void 0),e([S({value:null})],Mt.prototype,"view",null),e([S()],Mt.prototype,"videoElement",void 0),e([S()],Mt.prototype,"videoLayer",void 0),e([S()],Mt.prototype,"videoMapView",void 0),e([S()],Mt.prototype,"_adapter",void 0),e([S()],Mt.prototype,"_sketchGraphicsLayer",null),e([S()],Mt.prototype,"_highlightedFeatureHandle",void 0),e([S()],Mt.prototype,"_imageViewer",void 0),e([S()],Mt.prototype,"_initialCurrentCoverageUpdate",void 0),e([S()],Mt.prototype,"_locationPointOnImage",void 0),e([S()],Mt.prototype,"_measurementService",void 0),e([S()],Mt.prototype,"_correctedLocationPointOnImage",void 0),e([S()],Mt.prototype,"_overlays",void 0),e([S({readOnly:!0})],Mt.prototype,"_overlaysView",null),e([S()],Mt.prototype,"_panoramicViewer",void 0),e([S()],Mt.prototype,"_panoramicMeasurementViewer",void 0),e([S()],Mt.prototype,"_referencePointOnGround",void 0),e([S()],Mt.prototype,"_referencePointOnImage",void 0),e([S()],Mt.prototype,"_sectorData",void 0),e([S()],Mt.prototype,"_featureToSector",void 0),e([S({readOnly:!0})],Mt.prototype,"_updatingHandles",void 0),e([S()],Mt.prototype,"footprintExtent",void 0),e([S()],Mt.prototype,"_featureChangedTask",void 0),Mt=e([k("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],Mt);const It=Mt;export{It as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{equals as a,isSome as i}from"../../core/arrayUtils.js";import{createTask as r}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import{deprecatedProperty as o}from"../../core/deprecate.js";import n from"../../core/Error.js";import{EventedMixin as c}from"../../core/Evented.js";import{makeHandle as l}from"../../core/handleUtils.js";import{equalsShallow as h}from"../../core/lang.js";import u from"../../core/Logger.js";import{clamp as d}from"../../core/mathUtils.js";import{abortMaybe as m,destroyMaybe as p}from"../../core/maybe.js";import{EsriPromise as g}from"../../core/Promise.js";import{isAbortError as y,throwIfAborted as v,waitTick as f}from"../../core/promiseUtils.js";import w from"../../core/ReactiveMap.js";import{whenOnce as F,on as _,watch as b,syncAndInitial as M,initial as I}from"../../core/reactiveUtils.js";import{sqlAnd as P}from"../../core/sql.js";import{getMetersPerUnitForSR as V}from"../../core/unitUtils.js";import{property as S}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import{subclass as k}from"../../core/accessorSupport/decorators/subclass.js";import{isSerializable as A}from"../../core/support/jsonUtils.js";import{UpdatingHandles as C}from"../../core/support/UpdatingHandles.js";import G from"../../geometry/Extent.js";import{union as L}from"../../geometry/geometryEngineAsync.js";import R from"../../geometry/Multipoint.js";import T from"../../geometry/Point.js";import O from"../../geometry/Polygon.js";import j from"../../geometry/Polyline.js";import{projectWithZConversion as H}from"../../geometry/projectionUtils.js";import B from"../../geometry/SpatialReference.js";import{isClockwise as x}from"../../geometry/support/coordsUtils.js";import{normalizeMapX as E}from"../../geometry/support/normalizeUtils.js";import{geographicToWebMercator as z}from"../../geometry/support/webMercatorUtils.js";import D from"../../layers/GraphicsLayer.js";import U from"../../layers/MediaLayer.js";import{searchImages as N,getSortedLayerFeatures as W}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as q}from"../../layers/orientedImagery/core/bestImageUtils.js";import{createCoveragePolygon as $,computePolygonForInspection as J,resizePolygon as Z,checkIfPolygonContainsSelectedPoint as K}from"../../layers/orientedImagery/core/coverageUtils.js";import{isElevationSource as Q}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{convertGeographicToWebMercator as X}from"../../layers/orientedImagery/core/utils.js";import{imageToWorld as Y,imageToWorldPanoramic as ee}from"../../layers/orientedImagery/transformations/imageToWorld.js";import te from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as ae}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{or as ie,getInitialAngle as re,convertPixelToHeadingPitch as se,convertHeadingPitchToSphereVertex as oe,getImageToWorldProperties as ne,getUpdateElevationProps as ce,isElevationSampler as le,getImageToWorldPanoramicProperties as he,pointToArray as ue,transformGraphicCoordinatesToPixel as de,getWorldToImageProperties as me}from"../../layers/orientedImagery/transformations/utils.js";import{worldToImage as pe,worldToImagePanoramic as ge}from"../../layers/orientedImagery/transformations/worldToImage.js";import ye from"../../layers/support/ExtentAndRotationGeoreference.js";import{getFloorFilterClause as ve}from"../../layers/support/floorFilterUtils.js";import fe from"../../layers/support/VideoElement.js";import we from"../../views/MapView.js";import Fe from"../../views/draw/Draw.js";import{scale as _e}from"../../views/draw/support/drawUtils.js";import{ViewEventPriorities as be}from"../../views/input/InputManager.js";import Me from"../PanoramicViewer.js";import{defaultAngleThresholdInDegrees as Ie,videoExtent as Pe,invalidCameraHeading as Ve,sectorsInOrder as Se,sampleExtent as ke,sectorsRadii as Ae}from"./constants.js";import{configureSketchTool as Ce,extractFieldsFromDataCaptureLayer as Ge,isValidDataCaptureLayer as Le,constructGraphicFromImageGeometry as Re}from"./dataCaptureUtils.js";import{isFeatureAttachment as Te,getImageSourceFromAttachment as Oe}from"./galleryUtils.js";import{getModeCorrectedPoint as je,calculateCorrectedPixel as He,getUnitRateFromSpatialReference as Be,calculateHeightFromTemporaryDistance as xe,computeTriangulatedVector as Ee,computeTriangulatedPoint as ze}from"./imageMeasurementUtils.js";import{crossSymbol as De,crossSymbol3D as Ue,measurementPolygonSymbol as Ne,polylineSymbolPanoramic as We,measurementPolylineSymbol as qe,cameraOverlaySymbol3D as $e,cameraOverlaySymbol as Je,diamondSymbol as Ze,diamondSymbol3D as Ke,locationSymbol as Qe,locationSymbol3D as Xe,activeSourcePointSymbol as Ye,sourcePointSymbol as et}from"./symbols.js";import{isNoAttachmentError as tt,getContentType as at,isTifOrMrf as it,filterOILLayerView as rt,assignElevationSampleToFeatures as st,calculateDirection as ot,calculateSegment as nt,isSceneView as ct,isGraphic as lt}from"./utils.js";import{disableVideoZoomAndPan as ht}from"./videoViewerUtils.js";import ut from"./components/ImageViewer.js";import dt from"./components/NavigationNode.js";import mt from"./components/OrientedImageryVideoViewModel.js";import{NoActiveViewerError as pt,NoFeatureFoundWithObjectIdError as gt}from"./navigation/errors.js";import{queryFeatureByObjectIds as yt}from"./navigation/queries.js";import{ImageMeasurementService as vt}from"./services/ImageMeasurementService.js";import ft from"../Sketch/SketchViewModel.js";const wt={click:"view-click",imageClick:"image-click",triangularImageClick:"triangular-click",interactionHandles:"interaction-handles",hittestHandles:"hittest-handles",videoPlayerHandles:"video-handles",activeViewerCursorHandles:"active-viewer-cursor-handles",imageViewerCursorHandles:"image-viewer-cursor-handles"},Ft=new Set(["JPG","JPEG"]),_t=/\.(\w+)$/,bt=()=>new n("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first");let Mt=class extends(c(g)){constructor(e){super(e),this.additionalFeatures=new s,this.additionalCameraLocations=new s,this.additionalFootprints=new s,this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.bestFeatureAngle=0,this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null,this.cameraHeadingThreshold=Ie,this.cameraPitchThreshold=Ie,this.clickAction="hittest",this.videoViewModel=null,this.collectionId=null,this.conversionProps=null,this.coverageFrustums=new s,this.coveragePolygons=new s,this.currentBestFeature=null,this.currentBestFeatureMeasurementImage=null,this.currentBestFeatureLocation=null,this.currentCoverageVisible=!0,this.featureCache=[],this.navigationNodes=new s,this.determineWorkflowForFeature=async(e,t,a)=>{const{currentBestFeature:i,selectedPoint:r,view:s}=this;if(s?.closePopup(),i&&r){this._initialCurrentCoverageUpdate=!0,this._updateGroundElevation=!0;try{await this._updatePointsAndPolygons(a),await this._loadImage(a)}catch(o){y(o)||(this.loadImageError(o),u.getLogger(this).error("#loadIImage()","error occured while loading image",o))}}},this.determineWorkflowForTriangularMeasurement=async(e,t,a)=>{if(this.view?.closePopup(),this.currentBestFeatureMeasurementImage&&this.selectedPoint)try{await this._loadMeasurementViewerImage(a)}catch(i){y(i)||(this.loadImageError(i),u.getLogger(this).error("#loadIImage()","error occured while loading image",i))}},this.disabled=!1,this.displayMessage={key:"onLoadMessage",type:"info"},this.displayNewMeasurementButton=!0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.dataCaptureLayer=null,this.features=new s,this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.heightMeasurementPixels=[],this.heightGraphic=null,this.heightMeasurementResult=0,this.heightMeasurementAccuracy=0,this.measurementAngle=null,this.tempDistance=null,this.imageGeometryField=null,this.imageLocationToolState=!1,this.imageMeasurementViewer=new ut,this.isAdditionalCoverageVisible=!1,this.isAdditionalPointSourcesVisible=!1,this.measurementVectors=[],this.layer=null,this.localPort=null,this.mapImageConversionToolState=!1,this.measureType=null,this.measurementGraphic=null,this.navigatorCurrentBestFeature=null,this.oiObjectIdField=null,this.overlayedCameraLocations=new s,this.overlayedMapFeatures=new w,this.pixelCoordinates=null,this.preserveAngle="none",this.pointSources=new s,this.previousFeatureAngle=0,this.selectedPoint=null,this.shouldShowSelectedImage=!1,this.sketch=null,this.sketchTriangular=null,this.sketchTriangularGraphicsLayer=null,this.draw=null,this.sketchAdapter=null,this.triangularMeasurementActive=!1,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedAreaAccuracy=0,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.triangulatedMeasurementAdapter=null,this.updateFootprint=async(e,t)=>{"default"===this.mode&&"image-loaded"!==this.state||"video"===this.mode&&!this.videoElement?.content||await(this._adapter?.updateFootprint(e,t))},this.updateFootprintPanorama=async(e,t)=>{await(this._adapter?.updateFootprintPanorama(e,t))},this.updatingTriangularMeasurementState=!1,this.videoElement=null,this.videoLayer=null,this.videoMapView=new we({map:new Map}),this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new ut,this._initialCurrentCoverageUpdate=!0,this._locationPointOnImage=null,this._measurementService=null,this._correctedLocationPointOnImage=null,this._overlays=new D({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"},title:"OrentedImageryViewerViewModel overlays layer"}),this._panoramicViewer=new Me,this._panoramicMeasurementViewer=new Me,this._referencePointOnGround=null,this._referencePointOnImage=null,this._sectorData=null,this._featureToSector=null,this._updatingHandles=new C,this._clickTask=null,this._crossSymbol=null,this.footprintExtent=null,this._featureChangedTask=null,this._openPopupTask=null,this._suitabilities=null,this._transformController=new AbortController,this._updateFootprintTask=null,this._updateGroundElevation=!1,this.addUpdatingPromise=e=>this._updatingHandles.addPromise(e),this.hideImageGeometry=e=>{},this.highlight=e=>{if(!this._overlaysView)return;this.removeHighlight();const t=this.additionalFootprints.find(({attributes:{imageID:t}})=>t===Number(e));this._highlightedFeatureHandle=t?this._overlaysView?.highlight(t):null},this.loadDataCaptureAdapter=async e=>{await this.loadSketch(e);const t=import("./adapters/sketch/DataCaptureAdapter.js"),{default:a}=await t;return v(e),this.sketchAdapter=new a({viewModel:this}),this.sketchAdapter},this.loadImageFromSource=async(e,t)=>this._updatingHandles.addPromise(this._loadImageFromSourceInternal(e,t)),this.storeImageMeasurementViewer=e=>{this.imageMeasurementViewer=e},this.storePanoramicMeasurementViewer=e=>{this._panoramicMeasurementViewer=e},this.loadImageViewer=e=>{this._imageViewer?.destroy(),this._imageViewer=e},this.loadPanoramicViewer=e=>{this._panoramicViewer?.destroy(),this._panoramicViewer=e},this.loadVideoViewer=e=>{this.videoMapView.container=e},this.showImageByObjectId=async(e,t)=>{const a=this.additionalFeatures.find(({attributes:t})=>t.objectId===e);if(a)this.currentBestFeature=a;else{const{layer:a,layerFloorFilterClause:r}=this;if(!a)return void this.setMessage("noLayerSelected","info");this.beforeLoad();const s=this._updatingHandles.addPromise(this._queryAndLoadByObjectId(a,e,r,t));try{await s,await this.selectBestFeature(e,t)}catch(i){y(i)||(u.getLogger(this).error("oriented-imagery-viewer:show-image",i),"NoFeatureFoundWithObjectIdError"===i.name?this.setMessage("noFeatureFoundWithObjectId","error","",{objectId:e}):this.setMessage("imageLoadError","error",i.message))}}},this.imageToImageTransform=async(e,t,a)=>{const{updateElevationProps:i,...r}=t,{updateElevationProps:s,...o}=a,n=await Y(e,r,i);return pe(n,o)},this.imageToImageTransformPanoramic=async(e,t,a)=>{const{updateElevationProps:i,...r}=t,{updateElevationProps:s,...o}=a,n=await ee(e,r,i);return ge(n,o)},this.getSectorFeatureById=e=>this._suitabilities?.find(({feature:{attributes:{objectId:t}}})=>t===e),this.getFeatureSectorById=e=>this._featureToSector?.[`${e}`],this.navigate=async(e,t)=>{const{activeViewer:a}=this;if(!a)throw new pt;return await a.navigate(e,t)},this.removeHighlight=()=>this._highlightedFeatureHandle?.remove(),this.revealImageGeometry=e=>{},this.selectBestFeature=async(e,t)=>(v(t),this.currentBestFeature=this.features?.find(({attributes:t})=>`${t.objectId}`==`${e}`),F(()=>"image-loaded"===this.state,t)),this.toggleImageAttributes=()=>{m(this._openPopupTask),this._openPopupTask=r(async e=>{const{currentBestFeature:a,popupEnabled:i,layer:r,view:s}=this;if(s?.closePopup(),!(s&&a&&i&&r))return;const{attributes:o,geometry:n}=a,c=new t({geometry:n,attributes:o.toJSON(),layer:r,sourceLayer:r});v(e),await s.openPopup({features:[c],location:o.location.clone()})})},this.updateSuitabilities=(e,t=!0)=>{e.sort((e,t)=>e.suitability-t.suitability),this._suitabilities=e;const a=this._suitabilities.map(({feature:e})=>e);this._initialCurrentCoverageUpdate=!0,this._updateFeatures(a,t),this._groupFeaturesBySectors()},this._createViewClickHandle=()=>{if(this.removeHandles(wt.click),"disabled"===this.state||null==this.view)return;const e=this.mapImageConversionToolState&&"image-loaded"===this.state?this._mapImageConversionToolViewClickHandler:this._viewClickHandler;this.addHandles(this.view.on("click",e,be.WIDGET),wt.click)},this._createImageClickHandle=()=>{this.removeHandles(wt.imageClick);const{mapImageConversionToolState:e,mode:t,activeViewer:a,currentBestFeature:i,footprintExtent:s}=this,o=a?.imageSize;if(!(e&&"none"!==t&&o&&s&&i))return;const n=a.clickAction;this.clickAction="pixel-location";const c=l(()=>{this.clickAction=n});let h=null;const u=_(()=>a,"pixel-location",e=>{this.plotReferencePointOnImage(e),h?.abort(),h=r(async a=>{if(!e)return;const r=await this.getMapPoint(e,{feature:i,imageSize:o,mode:t}).then(e=>{const t=this.view?.spatialReference;return ie(!t,e.spatialReference.equals(t))?e:H(e,t)});v(a),this.plotReferencePointOnGround(r)})});this.addHandles([u,c],wt.imageClick)},this._createTriangularImageClickHandle=()=>{this.removeHandles(wt.triangularImageClick);const e=this.imageMeasurementViewer?.imageSize;this.triangularMeasurementActive&&"none"!==this.mode&&e&&this.currentBestFeature&&this.addHandles(this.imageMeasurementViewer.imageRenderer.on("double-click",this._measurementImageClickHandler),wt.triangularImageClick)},this._createTriangularImageLocationHandle=()=>{this.removeHandles(wt.triangularImageClick);const{imageLocationToolState:e,mode:t,activeTriangulatedViewer:a}=this,i=a?.imageSize;if(!e||"none"===t||!i)return;this.clickAction="pixel-location";let s=null;const o=_(()=>a,"pixel-location",e=>{1===this.measurementVectors.length&&(this.plotLocationPointOnImage(e,!0),s?.abort(),s=r(async a=>{if(!e||this.triangulatedPoint||2===this.measurementVectors?.length||!this.currentBestFeatureMeasurementImage)return;let r=await this.getMapPoint(e,{feature:this.currentBestFeatureMeasurementImage,imageSize:i,mode:t});v(a);const s=this.currentBestFeatureMeasurementImage.geometry.spatialReference;s&&!r.spatialReference.equals(s)&&(r=await H(r,s),v(a)),await this._calculateTriangulatedPointFromGroundPoint(r,{signal:a}),v(a)}))});this.addHandles(o,wt.triangularImageClick)},this._createImageLocationHandle=()=>{this.removeHandles(wt.imageClick);const{imageLocationToolState:e,mode:t,activeViewer:a,currentBestFeature:i,footprintExtent:s}=this,o=a?.imageSize;if(!(e&&"none"!==t&&o&&s&&i))return;this.clickAction="pixel-location";let n=null;const c=_(()=>a,"pixel-location",e=>{const{currentBestFeatureMeasurementImage:a,triangularMeasurementActive:s,activeTriangulatedViewer:c}=this;this.pixelCoordinates=e;const l=null!=a&&!c?.state.includes("loading");ie(!s,l)&&this.plotLocationPointOnImage(e),n?.abort(),n=r(async a=>{if(!e)return;let r=await this.getMapPoint(e,{feature:i,imageSize:o,mode:t});v(a);const n=this.view?.spatialReference;n&&!r.spatialReference.equals(n)&&(r=await H(r,n),v(a)),this.groundCoordinates=r,s&&r&&l&&await this.triangulatedLocationWorkflow(r,a);const c=await this.calculateLocationAccuracy(e,r,t,a);v(a),c&&(this.groundCoordinatesAccuracy=c)})});this.addHandles(c,wt.imageClick)},this._handleImageHitTestResponse=async e=>{const{layer:t,overlayedCameraLocations:a}=this;if(!t)return;const i=e.results.find(({graphic:e,graphic:{attributes:i}})=>a.includes(e)&&i&&!i[t.imageReferenceField]&&!i[t.imageGeometryField]);if(!i)return;const r=i.graphic.attributes[t.objectIdField];await this.showImageByObjectId(r)},this._loadImage=async e=>{const{currentBestFeature:t,layer:a,mode:i}=this;if(this.clearGraphics(),!a||!t||"none"===i||"video"===i)return;const{attributes:r}=t,{imagePath:s,imageRotation:o,cameraHeading:n,cameraRoll:c,cameraPitch:l,objectId:h,cameraOrientation:d,location:m}=r,p=(c??0)+(o??0),g=m.spatialReference.isWGS84&&4!==d?.type?z(m):new T(m);let f=s;if(Te(s))try{f=await Oe(a,h,e)}catch(w){if(y(w))return;return tt(w)?(u.getLogger(this).error(w),void this.setMessage("noAttachment","error",`${a.objectIdField}: ${h}`)):(u.getLogger(this).error(w,{[a.objectIdField]:h,layer:a}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${a.objectIdField} ${h}`))}try{await this.loadImageFromSource(f,{imageRotation:p,options:e,pitch:l,yaw:n,mode:i,cameraLocation:g}),v(e),await this.transformAndPlotSelectedLocation(e)}catch(w){y(w)||this.loadImageError(w)}},this._loadImageFromSourceInternal=async(e,t)=>{const{mode:a,imageRotation:i,options:r}=t,s="string"==typeof e,o=s?e:e.url,{pathname:n,searchParams:c}=new URL(o);let l=s?n.match(_t)?.[1]:e.datasetFormat;if(!l)try{l=await at(o,{...t.options})}catch(h){y(h)||u.getLogger(this).error("#getContentType()",h)}switch(l??="UNKNOWN FORMAT",a){case"default":this.triangularMeasurementActive?await this._setImageSource(this.imageMeasurementViewer,l,o,c,i,r):await this._setImageSource(this._imageViewer,l,o,c,i,r);break;case"panoramic":if(Ft.has(l.toUpperCase())){const{selectedPoint:e}=this,{pitch:a,yaw:i,cameraLocation:s,viewAngle:n}=t,c=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer;c.imageSource=o;let l=i??0;"number"==typeof n?l=n-l:s&&e&&(l=await re(s,e)-l),c.pitch=a??0,c.yaw=l,await c.loadImage(r)}else this.setMessage("unsupportedPanoramicImageryError","error",void 0,{datasetFormat:l});break}},this._loadMeasurementViewerImage=async e=>{const{currentBestFeatureMeasurementImage:t,layer:a,mode:i}=this;if(this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics(),!a||!t||"none"===i||"video"===i)return;const{attributes:r}=t,{imagePath:s,imageRotation:o,cameraHeading:n,cameraRoll:c,cameraPitch:l,objectId:h,cameraOrientation:d,location:m}=r,p=(c??0)+(o??0),g=m.spatialReference.isWGS84&&4!==d?.type?z(m):new T(m);let f=s;if(Te(s))try{f=await Oe(a,h,e)}catch(w){if(y(w))return;return tt(w)?(u.getLogger(this).error(w),void this.setMessage("noAttachment","error",`${a.objectIdField}: ${h}`)):(u.getLogger(this).error(w,{[a.objectIdField]:h,layer:a}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${a.objectIdField} ${h}`))}try{await this.loadImageFromSource(f,{imageRotation:p,options:e,pitch:l,yaw:n,mode:i,cameraLocation:g}),v(e)}catch(w){y(w)||this.loadImageError(w)}},this._loadViewAdapter=async e=>{const{view:t}=this;if(t)switch(t.type){case"2d":{const{default:t}=await import("./adapters/view/MapViewAdapter.js");v(e),this._adapter=new t(this);break}case"3d":{const{default:t}=await import("./adapters/view/SceneViewAdapter.js");v(e),this._adapter=new t(this);break}}else this._adapter=null},this._mapImageConversionToolViewClickHandler=e=>{e.stopPropagation(),e.preventDefault(),e.mapPoint&&this.plotMapPoint(e.mapPoint)},this._measurementImageClickHandler=e=>{e.stopPropagation(),e.preventDefault();const{sketchTriangular:t,triangularMeasurementActive:a,currentBestFeatureMeasurementImage:i,triangulatedMeasurementGraphic:r}=this;t&&a&&i&&r&&"active"!==t.state&&(t.update([r],{tool:"reshape"}),this.updatingTriangularMeasurementState=!0)},this._viewClickHandler=e=>{this._clickTask?.abort(),this._clickTask=r(async t=>{const{pointerType:a,button:i,mapPoint:r}=e;if(("mouse"!==a||0===i)&&r)return e.stopPropagation(),e.preventDefault(),this._updatingHandles.addPromise(this.loadBestImage(r,{signal:t}))})},this.plotSelectedPointOnImage=async(e,a)=>{if(await f(a),!e)return;const i=new T({...A(e)?e.toJSON():e});if("default"===this.mode)i.x-=.5,i.y=.5-i.y,i.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:i,symbol:De}),this._imageViewer.addGraphic(this._crossSymbol,0);else if("panoramic"===this.mode){const{imageSize:a}=this._panoramicViewer;if(!a)return;const[i,r]=a,{heading:s,pitch:o}=se(e,i,r),n=oe(s,o);this._crossSymbol=new t({geometry:new T(n,B.WebMercator),symbol:Ue}),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([b(()=>this.view,()=>this.load(),M),b(()=>this.view?.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},I),b(()=>this.view?.map?.allLayers?.length,e=>{e&&this.view?.map?.layers.reorder(this._overlays,e-1)},I),b(()=>[this.state,this.mapImageConversionToolState,this.view],()=>{this._createViewClickHandle(),this._createImageClickHandle()},M),b(()=>[this.triangularMeasurementActive,this.currentBestFeatureMeasurementImage],()=>{this._createTriangularImageClickHandle()},M),b(()=>[this.state,this.imageLocationToolState,this.view],(e,t)=>{if(this._initializeMeasurementService(),this._createImageLocationHandle(),!this.imageLocationToolState)return this.clearPreviousGroundLocation(),void this._resetCursor();e[1]!==t?.[1]&&this._setMeasurementCursor()},M),b(()=>this.measureType,()=>{this.clearPreviousMeasurements(),this._initializeMeasurementService()},M),b(()=>this.bestFeatureAngle,(e,t)=>{this.previousFeatureAngle=t??0},M),b(()=>this.currentBestFeature,async(e,t)=>{m(this._featureChangedTask),this._featureChangedTask=r(async a=>this.determineWorkflowForFeature.apply(this,[e,t,{signal:a}])),await this._featureChangedTask.promise},{sync:!0}),b(()=>this.currentBestFeatureMeasurementImage,(e,t)=>{m(this._featureChangedTask),t&&e!==t&&(this.measurementVectors=[],this.triangulatedPoint=null,this.sketchTriangularGraphicsLayer?.graphics.destroyAll()),this._featureChangedTask=r(async a=>{await this.determineWorkflowForTriangularMeasurement(e,t,{signal:a}),v(a),this._reorderTriangularSketchLayer()})},M),b(()=>this.triangularMeasurementActive,(e,t)=>{t&&!e&&(this.measurementVectors=[],this.currentBestFeatureMeasurementImage=null,this.triangulatedDistanceMeasurement=null,this.triangulatedMeasurementGraphic=null,this.triangulatedPoint=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaAccuracy=0,this.sketchTriangularGraphicsLayer?.graphics.destroyAll(),this.clearReferencePointOnImage(),this.imageMeasurementViewer.clearImage(),this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearImage(),this._panoramicMeasurementViewer.clearGraphics())}),b(()=>this.mode,e=>{switch(this.removeHandles(wt.interactionHandles),e){case"default":this.addHandles(b(()=>{const{state:e}=this;return"image-loaded"===e?this._imageViewer.imagePointsInView:null},e=>{e&&(m(this._updateFootprintTask),this._updateFootprintTask=r(async t=>{await this.updateFootprint(e,{signal:t})}))},{...M,equals:(e,t)=>a(e,t,h)}),wt.interactionHandles);break;case"video":this.addHandles(b(()=>{const{footprintExtent:e}=this;if(e)return Pe},e=>{e&&(m(this._updateFootprintTask),this._updateFootprintTask=r(async t=>{await this.updateFootprint(e,{signal:t})}))},{...M,equals:(e,t)=>a(e,t,h)}),wt.interactionHandles);break;case"panoramic":this.addHandles(b(()=>{const{currentBestFeature:e,state:t,_panoramicViewer:a}=this,{imageSize:i,vfov:r,hfov:s,pitch:o,yaw:n}=a;return e&&i&&!t.includes("loading")&&null!=r&&null!=s&&null!=o&&null!=n?[r,s,n,o]:null},e=>{if(!e||this.state.includes("loading"))return;const[t,a,i,s]=e;this.currentNode&&(this.currentNode.currentHeading=i+(this.currentNode.heading??0),this.currentNode.currentPitch=s+(this.currentNode.pitch??0)),m(this._updateFootprintTask),this._updateFootprintTask=r(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:a,yaw:i,pitch:s},{signal:e}),this._updateFootprintTask=null})},{equals:(e,t)=>a(e,t,h)}),wt.interactionHandles)}},M),b(()=>[this.brightness,this.contrast,this.sharpness],()=>{const{_imageViewer:e,brightness:t,contrast:a,mode:i,sharpness:r}=this;"default"===i&&(e.brightness=t,e.contrast=a,e.sharpness=r)},M),b(()=>this.activeViewer?.imageRenderer,()=>{this.sketch&&(this.sketch.view=this.activeViewer?.imageRenderer)}),b(()=>this.activeViewer,e=>{this.removeHandles(wt.hittestHandles),e&&this.addHandles(_(()=>e,"hittest-response",this._handleImageHitTestResponse),wt.hittestHandles)})]),this.when().finally(()=>{this.notifyChange("state")})}destroy(){this.currentBestFeature=null,this._updateFootprintTask=m(this._updateFootprintTask),this._clickTask=m(this._clickTask),this.coverageFrustums.destroy(),this.coveragePolygons.destroy(),this.pointSources.destroy(),this.additionalFootprints.destroy(),this.additionalCameraLocations.destroy(),this.bestFeatureFootprint=p(this.bestFeatureFootprint),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),this.videoViewModel=p(this.videoViewModel),this._crossSymbol=p(this._crossSymbol),this._referencePointOnGround=p(this._referencePointOnGround),this._referencePointOnImage=p(this._referencePointOnImage),this._locationPointOnImage=p(this._locationPointOnImage),this._overlays&&this.view?.map?.remove(this._overlays),this._overlays.destroy(),this._imageViewer.destroy(),this.imageMeasurementViewer.destroy(),this._panoramicViewer.destroy(),this._panoramicMeasurementViewer.destroy()}get activeLayer(){return o(u.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer}set activeLayer(e){o(u.getLogger(this),"activeLayer",{replacement:"layer"}),this.layer=e}get activeViewer(){const{_imageViewer:e,_panoramicViewer:t,mode:a}=this;switch(a){case"default":return e;case"panoramic":return t;default:return null}}get 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=>0===e)??!0}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",d(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",d(e,-10,10))}get currentNode(){const{currentBestFeature:e,navigationNodes:t}=this;return t.find(t=>t.id===e?.attributes.objectId)}get featureCount(){return this.features?.length??0}get imageGalleryEnabled(){const{currentBestFeature:e}=this;if(!e)return!1;const t=e.attributes.imagePath?.trim();return it(t)||Te(t)}get imageLoaded(){return o(u.getLogger(this),"imageLoaded",{replacement:'Use OrientedImageryViewer.state === "image-loaded"',version:"4.29",warnOnce:!0}),"image-loaded"===this.state}get invalidCameraHeading(){return this.currentBestFeature?.attributes?.cameraHeading===Ve}get imagePointsInView(){const{mode:e,_imageViewer:t}=this;return"default"===e?t.imagePointsInView:null}get layerView(){const{layer:e,view:t}=this;if(e&&t)return t.allLayerViews.find(rt(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?ve(e):null}get mode(){const e=this.currentBestFeature?.attributes;if(!e)return"none";if(e.orientedImageryType?.includes("video"))return"video";const{horizontalFieldOfView:t,isSpherical:a}=e;return 360===t||a?"panoramic":"default"}get popupEnabled(){return!0===this.layer?.popupEnabled}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){const{_sectorData:e}=this;return e?Se.map(t=>e[t]):null}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",d(e,0,1))}get sketchGraphicsLayer(){return this.sketch?.layer}get state(){const{mode:e,disabled:t,_updatingHandles:{updating:a},_featureChangedTask:i}=this;if(t)return"disabled";if(!this.isFulfilled()||a||!1===i?.finished)return"loading";if(this.isRejected())return"error";if("error"===this.displayMessage?.type)return"image-load-error";switch(e){case"default":return this._imageViewer.state;case"panoramic":return this._panoramicViewer.state;case"video":return this.videoElement?.loaded?"video-loaded":"video-not-loaded"}return"ready"}get thumbnails(){const{features:e}=this;return e?new s(e.map(({attributes:{imagePath:e,objectId:t,cameraRoll:a,imageRotation:i}})=>{const r=e?.trim();return it(r)||Te(r)?{url:r,objectId:t,rotation:(a??0)+(i??0)}:null}).filter(i)):null}set view(e){this._set("view",e)}get _sketchGraphicsLayer(){const{mode:e}=this;switch(e){case"panoramic":return new D({elevationInfo:{mode:"absolute-height"}});case"default":return new D;default:return}}get _overlaysView(){return this.view?.layerViews.find(({layer:e})=>e===this._overlays)}beforeLoad(){this.view?.closePopup(),this.displayMessage=null,this.clearPreviousGroundLocation(),this.triangularMeasurementActive=!1,this.currentBestFeatureMeasurementImage=null,this.measureType=null,this.imageLocationToolState=!1,this.features.removeAll(),this.currentBestFeature=null,this.additionalFeatures.removeAll(),this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),this._overlays?.removeAll()}async computeHeight(e,t,a=!0){return this._measurementService?.computeHeight(e,t,a)}async calculateAreaMeasurement(e,t,a){return this._measurementService?.calculateAreaMeasurement(e,t,a)}async calculateDistanceMeasurement(e,t,a){return this._measurementService?.calculateDistanceMeasurement(e,t,a)}async calculateAccuracy(e,t,a){return this._measurementService?.calculateAccuracy(e,t,a)}async calculateLocationAccuracy(e,t,a="default",i){return this._measurementService?.calculateLocationAccuracy(e,t,a,i)}async calculateAccuracyPanoramic(e,t,a){return this._measurementService?.calculateAccuracyPanoramic(e,t,a)}async calculateHeightMeasurementInfo(e,t,a){return this._measurementService?.calculateHeightMeasurementInfo(e,t,a)}async calculateTriangulatedMeasurements(e){await(this._measurementService?.calculateTriangulatedMeasurements(e))}clearPreviousMeasurements(){this.clearMeasurementGraphics(),this.resetMeasurementData(),this.stopMeasurement()}clearPreviousGroundLocation(){this.groundCoordinates=null,this.groundCoordinatesAccuracy=null,this.pixelCoordinates=null,this.clearLocationPointOnImage()}clearMeasurementGraphics(){this.measurementGraphic&&(this.activeViewer?.removeGraphic(this.measurementGraphic),this.measurementGraphic=null),this.heightGraphic&&(this.activeViewer?.removeGraphic(this.heightGraphic),this.heightGraphic=null),this.triangularMeasurementActive&&this.sketchTriangularGraphicsLayer?.graphics.destroyAll()}digitizeCancel(){return this.sketch?.cancel()}digitizeCanRedo(){return this.sketch?.canRedo()??!1}digitizeCanUndo(){return this.sketch?.canUndo()??!1}digitizeComplete(){return this.sketch?.complete()}async digitizeCreate(e,t){const{sketch:a,dataCaptureLayer:i}=this;if(!a)throw bt();Ce(i,e,a),await a.create(e,{...t,defaultZ:0})}digitizeDelete(){if(!this.sketch)throw bt();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw bt();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw bt();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw bt();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw bt();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw bt();return this.sketch.update(e,t)}async displayHeightResults(){const{currentBestFeature:e,activeViewer:t,heightMeasurementPixels:a,mode:i}=this,r=t?.imageSize,s=e?.attributes;if(!s||!r)return;const o=await this.computeHeight(a,i);o?.value&&o?.accuracy&&(this.heightMeasurementResult=o.value,this.heightMeasurementAccuracy=o.accuracy)}filterByFootprints(e,t,a=!1){const i=[],r=[],s=[];return e.forEach(e=>{const{layer:{coveragePercent:o},attributes:n}=e;let c;const{polygon:l,frustum:h}=$(n);if(c=l.clone(),n.isInspection&&(c=J(n)),o&&(c=Z(c,o)),a||!t||K(c,t)){s.push(e);const{geometry:t,objectId:a,cameraHeight:o,cameraHeading:c}=n,u=t.clone();u.z=o,u.imageID=a,this.pointSources.push(u),c!==Ve&&(i.push(l),h&&r.push(h))}}),{features:s,polygons:i,frustums:r}}getMeasurementProperties(e=this.currentBestFeature,t=this.activeViewer){if(!e||!t?.imageSize)return;const{elevationSample:a,attributes:i}=e,{elevationSource:r,cameraHeight:s}=i,o=ne(i,t.imageSize[0],t.imageSize[1]);let n=o.cameraLocation;return(n.spatialReference.isGeographic?H(n,B.WebMercator):Promise.resolve(n)).then(e=>(n=e,ce(n.spatialReference,n.z??0,s,{elevationSample:a,elevationSource:r,extent:this.footprintExtent}))).then(t=>("elevationSample"in t&&le(t.elevationSample)&&(e.elevationSample=t.elevationSample),{...o,cameraLocation:n,updateElevationProps:t}))}getMeasurementPropertiesPanoramic(e=this.currentBestFeature,t=this.activeViewer){if(!e||!t?.imageSize)return;const{elevationSample:a,attributes:i}=e,{elevationSource:r,cameraHeight:s}=i,o=he(i,t.imageSize[0],t.imageSize[1]);let n=o.cameraLocation;return(n.spatialReference.isGeographic?H(n,B.WebMercator):Promise.resolve(n)).then(e=>(n=e,ce(n.spatialReference,n.z??0,s,{elevationSample:a,elevationSource:r,extent:this.footprintExtent}))).then(t=>("elevationSample"in t&&le(t.elevationSample)&&(e.elevationSample=t.elevationSample),{...o,cameraLocation:n,updateElevationProps:t}))}async deleteDataCaptureFeatures(e){const{dataCaptureLayer:t}=this;if(!t)throw new n("orientedimagery","Data capture layer is not available");return t.queryFeatures({objectIds:e}).then(({features:e})=>t.applyEdits({deleteFeatures:e}))}handleSectorClick(e){if(isNaN(e))return;const t=this._sectorData?.[Se[e]],a=t?.at(0);a&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(a):this._updateCurrentBestFeature(a))}handleFeatureClick(e){const{sector:t,featureIndexInSector:a}=e;if(isNaN(a))return;const i=this._sectorData?.[t],r=i?.at(a);r&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(r):this._updateCurrentBestFeature(r))}handleDrawCursorUpdateEvents(e){const{measurementAngle:t,tempDistance:a,heightMeasurementPixels:i,mode:r,activeViewer:s,currentBestFeature:o}=this,n=s?.imageSize;if(!e.vertices||!n||!o)return;const c=je(e.vertices.at(-1),r,n);if(i.length<1||!c||!a||!t||"none"===r)return;const l=He(i[0],c,t);if(!l?.length)return;this.heightMeasurementPixels.push(l),"panoramic"===r?this.createPolylineGraphicPano():this.createPolylineGraphic();const h=Be(o.attributes.location.spatialReference),u=xe(this.heightMeasurementPixels,a,h);u&&(this.heightMeasurementResult=u)}async handleDrawVertexAddEvents(e,t){const{currentBestFeature:a,activeViewer:i,heightMeasurementPixels:r,mode:s}=this;if(!a||!i||!e.vertices?.length||"none"===s)return;const o=i?.imageSize;if(!r.length&&o){const a=je(e.vertices.at(-1),s,o);this.heightMeasurementPixels.push(a);const i=await this.calculateHeightMeasurementInfo(a,s,t);if(!i?.measurementAngle||!i?.tempDistance)return;this.measurementAngle=i.measurementAngle,this.tempDistance=i.tempDistance}}load(e){return this.addResolvingPromise(this._loadViewAdapter(e).catch(e=>{if(!y(e))throw e})),this}async loadBestImage(e,t){return this.selectedPoint=X(e),this.beforeLoad(),this._fetchFeaturesWithController(e,t)}loadImageError(e){u.getLogger(this).error("oriented-imagery-viewer:load-image",e),this.setMessage("imageLoadError","error",e.message)}async loadSketch(e){if(!this.sketch){const t=import("../Sketch/SketchViewModel.js"),{default:a}=await t;v(e),this.sketch=new a({layer:this._sketchGraphicsLayer,view:this.activeViewer?.imageRenderer,updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{edgeOperation:"none",shapeOperation:"none",vertexOperation:void 0},enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"transform"}})}return this.sketch}async loadMeasurementAdapter(e){if(!this.sketchAdapter){const t=import("./adapters/sketch/MeasurementAdapter.js"),{default:a}=await t;if(v(e),this.sketchAdapter=new a({viewModel:this}),!this.sketchAdapter.viewModel.isResolved())return}return this.sketchAdapter}async loadTriangulatedMeasurementAdapter(e){if(!this.triangulatedMeasurementAdapter){const t=import("./adapters/sketch/TriangulatedMeasurementAdapter.js"),{default:a}=await t;if(v(e),this.triangulatedMeasurementAdapter=new a({viewModel:this}),!this.triangulatedMeasurementAdapter.viewModel.isResolved())return}return this.triangulatedMeasurementAdapter}async processFeatureResponse(e,t,a){const{features:i}=e;if(this._clearFeatureGeometries(),!this._checkFeatures(i))return;const{features:r,polygons:s,frustums:o}=this.filterByFootprints(i,t,a?.skipFilter);if(!this._checkFeatures(r))return;this.coveragePolygons.addMany(s),this.coverageFrustums.addMany(o);const n=await this.processElevationSample(s,r,a);v(a),await this._updateElevationOfSelectedPointAndLocations(r,t,n),v(a),st(r,n);const c=this._processSuitableFeatures(r,t);this.updateSuitabilities(c,a?.loadBestImage)}async startMeasurement(e,t){this.sketch||await this.loadSketch(t),await this.loadMeasurementAdapter(t);const{sketch:a,sketchAdapter:i,activeViewer:r,mode:s}=this;if(!a||!i||!r||"none"===s)return;if(this.displayNewMeasurementButton=!1,"panoramic"===s&&(a.defaultCreateOptions.defaultZ=0),await a.create(e),"panoramic"===s){const{drawOperation:e}=a.view.activeTool;e.constraintsEnabled=!1,e._set("elevationDrawSurface",null)}const o=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;o&&this.sketch&&(this.sketch.polygonSymbol=Ne(o),this.sketch.polylineSymbol="panoramic"===s?We:qe(o,2.5))}startHeightMeasurement(){this.heightMeasurementPixels=[],this.displayNewMeasurementButton=!1,this.draw??=new Fe({view:this.activeViewer?.imageRenderer});this.draw.create("polyline").on(["cursor-update","vertex-add","draw-complete"],e=>this.handleDrawEvents(e))}createPolylineGraphic(){const e=[this.heightMeasurementPixels[0],this.heightMeasurementPixels.at(-1)],a=this.activeViewer?.imageRenderer.spatialReference;if(this.heightGraphic)this.heightGraphic.geometry=new j({paths:[e],spatialReference:a});else{const i=new j({paths:[e],spatialReference:a}),r=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;this.heightGraphic=new t({geometry:i,symbol:qe(r,2.5)}),this.activeViewer?.addGraphic(this.heightGraphic)}}createPolylineGraphicPano(){const e=this.activeViewer?.imageRenderer.spatialReference,a=this.activeViewer?.imageSize;if(!a)return;const i={x:this.heightMeasurementPixels[0][0],y:this.heightMeasurementPixels[0][1]},r={x:this.heightMeasurementPixels.at(-1)[0],y:this.heightMeasurementPixels.at(-1)[1]},{heading:s,pitch:o}=se(i,a[0],a[1]),{heading:n,pitch:c}=se(r,a[0],a[1]),l=[[...oe(s,o)],[...oe(n,c)]];if(this.heightGraphic)this.heightGraphic.geometry=new j({paths:[l],spatialReference:e});else{const a=new j({paths:[l],spatialReference:e});this.heightGraphic=new t({geometry:a,symbol:We}),this._panoramicViewer.addGraphic(this.heightGraphic,0)}}async editOverlayedGraphics(e){this.sketchTriangularGraphicsLayer||this._initializeSketchTriangularGraphicsLayer(),this.sketchTriangularGraphicsLayer?.destroyed&&this._handleDestroyedTriangularSketchLayer(),this.sketchTriangularGraphicsLayer.add(e),this.sketchTriangular||(this._initializeSketchTriangular(),await this.loadTriangulatedMeasurementAdapter()),this.updateOverlayedGeometry(e)}updateOverlayedGeometry(e){this.sketchTriangular?.update([e],{tool:"reshape"})}async processMeasurementVectors(e){this.triangularMeasurementActive&&this.currentBestFeature&&(this.measurementVectors?.length<2&&await this.updateMeasurementVectorsArray(e),2===this.measurementVectors.length&&await this.calculateTriangulatedMeasurements(e))}async updateMeasurementVectorsArray(e){const t=this.measurementVectors.length?this.currentBestFeatureMeasurementImage:this.currentBestFeature;if(t){const a=await this.computeMeasurementVector(e,t);a&&this.measurementVectors.push(a)}}async computeMeasurementVector(e,t){const{activeViewer:a,mode:i}=this,r=a?.imageSize;if(!e||!t||!r)return;const s=e.map(e=>[e[0]-.5,-.5-e[1]]),o=this.view?.spatialReference,n=[];for(let c=0;c<s.length;c++){const e={x:s[c][0],y:s[c][1]};let a=await this.getMapPoint(e,{feature:t,imageSize:r,mode:i});o&&!a.spatialReference.equals(o)&&(a=await H(a,o)),n.push(a)}return Ee(n,t)}async handleDrawEvents(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()}}initializeMeasurement(e){switch(this.clearMeasurementGraphics(),this.resetMeasurementData(),e){case"distance":this.startMeasurement("polyline");break;case"area":this.startMeasurement("polygon");break;case"height":this.startHeightMeasurement()}}async overlayCameraLocations(e){const{activeViewer:a,currentBestFeature:i,overlayedCameraLocations:r,layer:s,mode:o,state:n,layerFloorFilterClause:c}=this,l=a?.imageSize;if(!l||!i||!s||"none"===o||n.includes("loading"))return;const{polygon:h}=$(i.attributes);if(a.removeManyGraphics(r.toArray()),r.removeAll(),e){const{features:e}=await s.queryFeatures({where:P(`${s.objectIdField} <> ${i.attributes.objectId}`,P(s.definitionExpression,c)),geometry:h,returnGeometry:!0,outFields:[s.objectIdField]}),n=await Promise.all(e.map(async e=>{const{attributes:a,geometry:r}=e,s=await this.getPixels(r,{feature:i,imageSize:l,mode:o}),n="panoramic"===o?$e():Je();return new t({attributes:a,symbol:n,geometry:s})}));r.addMany(n),a.addManyGraphics(r.toArray())}}overlayGraphicsOnImage(e,t){this.removeOverlayedGraphicsOnImage(e),this.overlayedMapFeatures.set(e,t),this.activeViewer?.addManyGraphics(t.toArray())}async overlayMapFeatures(e,a=!1){const{activeViewer:r,currentBestFeature:o,mode:n,state:c,layer:l}=this,h=r?.imageSize;if(!h||!o||"none"===n||"video"===n||c.includes("loading")||!l)return;const{polygon:d}=$(o.attributes);try{const{imageGeometryField:t,oiObjectIdField:a}=Ge(e,l.imageGeometryField,l.imageReferenceField);this.imageGeometryField=t.name,this.oiObjectIdField=a.name}catch(g){u.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features",g)}const{features:m}=await e.queryFeatures({geometry:d,returnGeometry:!0,outFields:["*"]}),p=new s((await Promise.all(m.map(async i=>{const r=i.symbol?.clone()??e.renderer?.getSymbol(i)?.clone(),{attributes:s,geometry:c}=i,l=c,{imageGeometryField:d,oiObjectIdField:m}=this;if(d&&m&&Le(e,d,m)&&`${s[m]}`==`${o.attributes.objectId}`)try{return Re(s,d,e,a,h,n,r)}catch(g){u.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features","couldn't create graphic from attributes, geometry will be used",{error:g,feature:i,layer:e,imageGeometryField:this.imageGeometryField,imageReferenceField:this.oiObjectIdField})}switch(l?.type){case"point":{const i=await this.getPixels(l,{feature:o,imageSize:h,mode:n});return new t({attributes:s,layer:e,symbol:r,geometry:i,visible:e.visible&&a})}case"polygon":{const{rings:i,spatialReference:c}=l,u=i.map(e=>e.map(([e,t,a])=>new T({x:e,y:t,z:a,spatialReference:c}))),d=await Promise.all(u.map(async e=>this.getPixels(e,{feature:o,imageSize:h,mode:n}).then(e=>e.map(ue))));return new t({attributes:s,layer:e,symbol:r,geometry:new O({rings:d,spatialReference:B.WebMercator}),visible:e.visible&&a})}case"polyline":{const{paths:i,spatialReference:c}=l,u=i.map(e=>e.map(([e,t,a])=>new T({x:e,y:t,z:a,spatialReference:c}))),d=await Promise.all(u.map(async e=>this.getPixels(e,{feature:o,imageSize:h,mode:n}).then(e=>e.map(ue))));return new t({attributes:s,layer:e,symbol:r,geometry:new j({paths:d,spatialReference:B.WebMercator}),visible:e.visible&&a})}case"multipoint":{const{points:i,spatialReference:c}=l,u=i.map(([e,t,a])=>new T({x:e,y:t,z:a,spatialReference:c})),d=await this.getPixels(u,{feature:o,imageSize:h,mode:n}).then(e=>e.map(ue));return new t({attributes:s,layer:e,symbol:r,geometry:new R({points:d,spatialReference:B.WebMercator}),visible:e.visible&&a})}}return null}))).filter(i));this.overlayGraphicsOnImage(`${e.id}`,p)}async getPixels(e,t){const{imageSize:a,mode:i,feature:r}=t,s=(await this.worldToImage(Array.isArray(e)?e:[e],r)).map(e=>{if("default"===i)return new T({x:e.x-.5,y:.5-e.y,spatialReference:B.WebMercator});const[t,r]=a,{heading:s,pitch:o}=se(e,t,r),n=oe(s,o);return new T(n,B.WebMercator)});return Array.isArray(e)?s:s[0]}async getMapPoint(e,t){const{feature:a,mode:i,imageSize:r}=t,{elevationSample:s,attributes:o}=a,{elevationSource:n,location:c,cameraHeight:l}=o;let h=c.clone();h.spatialReference.isGeographic&&(h=await H(h,B.WebMercator));const u=await ce(c.spatialReference,c.z??0,l,{elevationSample:s,elevationSource:n,extent:this.footprintExtent});let d;if("elevationSample"in u&&le(u.elevationSample)&&(a.elevationSample=u.elevationSample),"default"===i){const t=ne(o,r[0],r[1]);d=await Y(Array.isArray(e)?e:[e],{...t,cameraLocation:h},u)}else{const t=he(o,r[0],r[1]);d=await ee(Array.isArray(e)?e:[e],{...t,cameraLocation:h},u)}return Array.isArray(e)?d:d[0]}getActiveSectors(){return Se.filter(e=>this._sectorData?.[e]?.length)}async plotMapPoint(e){return this.plotReferencePoint(e),this.transformAndPlotReferencePointOnImage({feature:this.currentBestFeature,selectedLocation:e,options:{signal:this._transformController?.signal}})}plotReferencePointOnGround(e){this._referencePointOnGround&&(this._overlays?.remove(this._referencePointOnGround),this._referencePointOnGround.destroy()),null!=e&&(this._referencePointOnGround=new t({geometry:new T({...e.toJSON()}),symbol:Ze}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit("plot-ground-point",{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){if("image-loaded"===this.state)switch(this.clearReferencePointOnImage(),this.mode){case"default":{const a=A(e)?e.toJSON():e;a.x-=.5,a.y=.5-a.y,this._referencePointOnImage=new t({geometry:new T({spatialReference:this._imageViewer.imageRenderer.spatialReference,...a}),symbol:Ze}),this._imageViewer.addGraphic(this._referencePointOnImage,0);break}case"panoramic":{const{imageSize:a}=this._panoramicViewer;if(!a)return;const[i,r]=a,{heading:s,pitch:o}=se(e,i,r),n=oe(s,o);this._referencePointOnImage=new t({geometry:new T(n,B.WebMercator),symbol:Ke}),this._panoramicViewer.addGraphic(this._referencePointOnImage,0);break}}}plotLocationPointOnImage(e,t=!1){if("image-loaded"===this.state)switch(this.clearLocationPointOnImage(t),this.mode){case"default":this._plotLocationPointOnDefaultImage(e,t);break;case"panoramic":this._plotLocationPointOnPanoramicImage(e,t)}}removeAllOverlayMapFeatures(){this.overlayedMapFeatures.forEach(e=>{this._imageViewer.removeManyGraphics(e.toArray())}),this.overlayedMapFeatures.clear()}removeOverlayedGraphicsOnImage(e){const t=this.overlayedMapFeatures.get(e);t?.length&&(this.activeViewer?.removeManyGraphics(t.toArray()),this.overlayedMapFeatures.delete(e))}resetImage(){switch(this.setMessage("onLoadMessage","info"),this.mode){case"default":this._imageViewer.clearImage(),this._imageViewer.clearGraphics();break;case"panoramic":this._panoramicViewer.clearGraphics()}this._clickTask=m(this._clickTask)}resetVideo(){this.setMessage("onLoadMessage","info"),this.videoViewModel?.resetVideoHandler(),this._overlays?.removeAll(),this.videoViewModel=null,this.featureCache=[],this.currentBestFeature=null}resetMeasurementData(){this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.heightMeasurementPixels=[],this.measurementVectors=[],this.heightMeasurementResult=0,this.tempDistance=null,this.measurementAngle=null,this.heightMeasurementAccuracy=0,this.heightGraphic=null,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedMeasurementGraphic=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaAccuracy=0}async saveDrawing(){const{dataCaptureLayer:e,sketchAdapter:t}=this;if(!e||"data-capture"!==t?.type)return;const{pendingGraphics:a,savedGraphics:i}=t,r=a.get(e.id),s=r?.toArray();if(!r||!s?.length)return;const{addFeatureResults:o}=await this.saveDataCaptureFeatures(s),n=o.reduce((t,{objectId:a,globalId:i,error:r},o)=>{const n=s[o],{attributes:c}=n;return r?t.error.push(n):(a&&(c[e.objectIdField]=a),i&&e.globalIdField&&(c[e.globalIdField]=i),t.success.push(n)),t},{success:[],error:[]});i.addMany(n.success),r.removeAll(),r.addMany(n.error)}async saveDataCaptureFeatures(e){const{activeViewer:t,currentBestFeature:a,dataCaptureLayer:r,mode:s}=this,o=t?.imageSize;if(!o||!a||"none"===s||"video"===s)throw new n("orientedimagery","Image size, current best feature and mode are required to save data capture features");if(!r)throw new n("orientedimagery","Data capture layer is not available");const c=await Promise.all(e.map(async e=>{const t=e.clone(),{geometry:i}=t;if(!i)return;const n=i.type,c=r.hasZ,l=r.geometryType,h=n!==l,u=h?await import("./transformers.js"):null,d=u?.default[l],m=h?d?.(i):i;if(m)switch(m.type){case"point":return t.geometry=await this.getMapPoint(de(s,m,o),{feature:a,imageSize:o,mode:s}),c||(delete t.geometry.z,t.geometry.hasZ=!1),t.geometry.hasM=!1,t;case"polygon":{const e=await Promise.all(m.rings.map(async e=>this.getMapPoint(e.map(([e,t,a])=>de(s,{x:e,y:t,z:a},o)),{feature:a,imageSize:o,mode:s})));return t.geometry=new O({spatialReference:e[0][0].spatialReference,hasZ:c,hasM:!1,rings:e.map(e=>e.map(ue))}),t}case"polyline":{const e=await Promise.all(m.paths.map(async e=>this.getMapPoint(e.map(([e,t,a])=>de(s,{x:e,y:t,z:a},o)),{feature:a,imageSize:o,mode:s})));return t.geometry=new j({spatialReference:e[0][0].spatialReference,hasZ:c,hasM:!1,paths:e.map(e=>e.map(ue))}),t}}})),l=c.filter(i);return r.applyEdits({addFeatures:l}).then(e=>{const{addFeatureResults:t}=e;let a=0;const i=c.map(e=>{const i=t[a++];return e?i:{error:new n("orientedimagery","Error in saving data capture features"),objectId:null,globalId:null}});return{...e,addFeatureResults:i}})}async searchBestImage(e,t){try{const a=await N(e,t);a&&await this.processFeatureResponse(a,e.point,t)}catch(a){y(a)||(this.setMessage("imageLoadError","error",a.message),u.getLogger(this).error("error occurred while finding best image",a))}}selectTriangularMeasurementFeature(e){this.currentBestFeatureMeasurementImage=this.features?.find(({attributes:t})=>t.objectId===Number(e))}setAdditionalCameraLocationsVisibility(e){this.additionalCameraLocations.forEach(t=>{t.visible=e})}setAdditionalCoverageVisibility(e){this.additionalFootprints.forEach(t=>{t.visible=e})}setCurrentCoverageVisibility(e){this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.visible=e),this.currentBestFeatureLocation&&(this.currentBestFeatureLocation.visible=e)}setMapImageConversionToolState(e){this.mapImageConversionToolState=e}setCurrentPanoramaView(e,t){this._panoramicViewer?.set({yaw:e,pitch:t})}async startDataCapture(e,t){const a=this.activeViewer?.imageRenderer,{oiObjectIdField:i,currentBestFeature:r}=this;if(!a||!r||!i)return;const{attributes:{objectId:o}}=r,n=this.overlayedMapFeatures.get(e.id)?.toArray()??[],c=[],l=[];for(const s of n)`${s.getAttribute(i)}`==`${o}`?c.push(s):l.push(s);this.overlayGraphicsOnImage(e.id,new s(l)),this.collectionId=e.id;const h=await this.loadSketch(t),u=await this.loadDataCaptureAdapter(t);v(t),h.layer.addMany(c),h.layer.blendMode="source-atop",u.savedGraphics.addMany(c);a.ui.find("zoom").visible=!1,a.map.layers.add(this.sketchGraphicsLayer)}async stopDataCapture(e=!1){this.sketch?.cancel(),this.sketchGraphicsLayer?.removeAll(),this.sketchAdapter=p(this.sketchAdapter),this.sketch=p(this.sketch),this.collectionId=null;const{dataCaptureLayer:t}=this,a=this.activeViewer?.imageRenderer;if(!a||a.destroyed)return;a.map.layers.remove(this.sketchGraphicsLayer),e&&t&&await this.overlayMapFeatures(t,!0);const i=a.ui.find("zoom");i&&(i.visible=!0)}stopMeasurement(){this.heightMeasurementPixels=[],this.draw?.reset(),this.sketch?.cancel()}toggleAllOverlayMapFeatures(e){this.overlayedMapFeatures.forEach(t=>{this._toggleVisiblity(t,e)})}toggleOverlayMapFeatures(e,t,a){const i=this.overlayedMapFeatures.get(e);i&&a&&this._toggleVisiblity(i,t)}toggleSelection(e){const{sketch:t}=this;t&&(t.updateOnGraphicClick=e,t.cancel())}async transformAndPlotReferencePointOnImage(e){const{feature:t,selectedLocation:a,options:i}=e;let r=!1,s=!1;const o=this.bestFeatureFootprint?.geometry;switch(o?.type){case"polygon":{const e=a.spatialReference.equals(o.spatialReference)?a:await H(a,o.spatialReference);r=o.contains(e);break}case"mesh":{const e=a.spatialReference.equals(o.spatialReference)?a:await H(a,o.spatialReference);s=o.extent.contains(e);break}}if(!r&&!s)return void this.clearReferencePointOnImage();const n=await this.worldToImage(a,t,i);if(n)return v(i),this.plotReferencePointOnImage(n),{x:n.x,y:n.y};this.clearReferencePointOnImage()}async triangulatedLocationWorkflow(e,t){if(this.currentBestFeature&&e){const{currentBestFeature:a}=this;this.triangulatedPoint&&(this.measurementVectors=[],this.triangulatedPoint=null,this.clearLocationPointOnImage(!0));const i=Ee(e,a);if(!i)return;this.measurementVectors.push(i),await this.plotReferenceLocationPoint(e,t),v(t),this._createTriangularImageLocationHandle()}}async _calculateTriangulatedPointFromGroundPoint(e,t){if(this.currentBestFeatureMeasurementImage&&e){const{currentBestFeatureMeasurementImage:a}=this,i=Ee(e,a);i&&this.measurementVectors.push(i);const r=await ze(this.measurementVectors);v(t),this.triangulatedPoint=r??this.triangulatedPoint}}async _fetchFeatures(e,t){if(!this.view)return;const a=this.layer;if(a){const i={include:a},r=this.view.toScreen(e);if(!r)return;const s=await this.view.hitTest(r,i);return this._processHitTestResults(a,s,t)}}async _fetchFeaturesWithController(e,t){try{await this._fetchFeatures(e,t)}catch(a){if(y(a))return;this.setMessage("imageLoadError","error"),u.getLogger(this).error("error occurred while fetching features",a)}}_groupFeaturesBySectors(){const{_suitabilities:e,additionalFeatures:t,features:a,invalidCameraHeading:i}=this,r=a.at(0);if(!e||!t||!r||!a||i)return void(this._sectorData=null);this._sectorData={};const o={};this._featureToSector=o;for(const h of Se)this._sectorData[h]=new s;const n=e.map((e,t)=>({...e,featureIndex:t}));n.sort((e,t)=>e.trueSuitability-t.trueSuitability);const c=n.map(({distance:e})=>e),l=Math.max(...c);n.forEach(e=>{const{distance:t,angle:i,featureIndex:s}=e,n=t/l*Ae[2],c=nt(t,l),h=ot(i);if(!this._sectorData)return;const u=Ae[3]+n*Math.sin(i*Math.PI/180),d=Ae[3]+n*Math.cos(i*Math.PI/180);let m;const p=a.at(s),g=p===r,{cameraPitch:y}=p.attributes,v=y<5;if(g&&v)m=-90;else{const e=u-Ae[3],t=d-Ae[3],a=t/Math.sqrt(e**2+t**2);let i=180*Math.acos(a)/Math.PI;(e<0&&t<0||e<0&&t>0)&&(i*=-1),m=i}const f=""===c?h:`${c}_${h}`;g&&(m===this.bestFeatureAngle?this.previousFeatureAngle=m:this.bestFeatureAngle=m,this.navigatorCurrentBestFeature=v?null:{x:u,y:d,direction:h}),o[`${p.attributes.objectId}`]=f;const w=this._sectorData[f];w.add({angle:i,featureIndex:s,x:u,y:d,objectID:p.attributes.objectId,sector:f,featureIndexInSector:w.length})})}_handleDestroyedTriangularSketchLayer(){this.sketchTriangularGraphicsLayer&&this.activeTriangulatedViewer&&(this.activeTriangulatedViewer.imageRenderer.map.layers.remove(this.sketchTriangularGraphicsLayer),this.sketchTriangularGraphicsLayer=new D,this.activeTriangulatedViewer.imageRenderer.map.layers.add(this.sketchTriangularGraphicsLayer),this.sketchTriangular&&(this.sketchTriangular.layer=this.sketchTriangularGraphicsLayer,this.sketchTriangular.view=this.activeTriangulatedViewer.imageRenderer))}_initializeMeasurementService(){this._measurementService||(this._measurementService=new vt(this))}_initializeSketchTriangular(){this.activeTriangulatedViewer&&(this.sketchTriangular=new ft({view:this.activeTriangulatedViewer.imageRenderer,layer:this.sketchTriangularGraphicsLayer,updateOnGraphicClick:!1,defaultUpdateOptions:{toggleToolOnClick:!1}}))}_initializeSketchTriangularGraphicsLayer(){this.activeTriangulatedViewer&&(this.sketchTriangularGraphicsLayer=new D,this.activeTriangulatedViewer.imageRenderer.map.layers.add(this.sketchTriangularGraphicsLayer))}_initializeVideo(){if(this.videoElement||!this.currentBestFeature)return;this.removeHandles(wt.videoPlayerHandles),this.videoElement=new fe({video:this.currentBestFeature.attributes.imagePath,georeference:new ye({extent:new G(ke)}),autoplay:!1}),this.videoElement.content?.loop&&(this.videoElement.content.loop=!1);const e=new U({source:this.videoElement,title:this.layer?.title,copyright:this.layer?.copyright});this.videoLayer=e,e&&this.videoMapView.map.layers.add(e),this.addHandles(ht(this.videoMapView),wt.videoPlayerHandles),this.videoViewModel=new mt({oiViewModel:this})}_plotLocationPointOnDefaultImage(e,a=!1){const i=A(e)?e.toJSON():e;i.x-=.5,i.y=.5-i.y,a?(this._correctedLocationPointOnImage=new t({geometry:new T({spatialReference:B.WebMercator,...i}),symbol:Qe}),this.imageMeasurementViewer.addGraphic(this._correctedLocationPointOnImage,0)):(this._locationPointOnImage=new t({geometry:new T({spatialReference:B.WebMercator,...i}),symbol:Qe}),this._imageViewer.addGraphic(this._locationPointOnImage,0))}_plotLocationPointOnPanoramicImage(e,a=!1){const i=a?this._panoramicMeasurementViewer:this._panoramicViewer,{imageSize:r}=i;if(!r)return;const[s,o]=r,{heading:n,pitch:c}=se(e,s,o),l=oe(n,c),h=new t({geometry:new T(l,B.WebMercator),symbol:Xe});a?this._correctedLocationPointOnImage=h:this._locationPointOnImage=h,i.addGraphic(h,0)}_clearFeatureGeometries(){this.coveragePolygons.removeAll(),this.coverageFrustums.removeAll(),this.pointSources.removeAll()}_checkFeatures(e){return!!e?.length||(this.setMessage("noImageError","error"),this.currentBestFeature=null,!1)}async _getElevationSampleFromGround(e,t,a){if(!e[0])return;const i=await L(e);if(this._updateFootprintWithFeatures(t,i),this.view?.supportsGround)try{return await this.view.map.ground.createElevationSampler(this.footprintExtent,a)}catch(r){y(r)||u.getLogger(this).error(r)}}async processElevationSample(e,t,a){const{elevationSource:i}=t[0].attributes,r=await this._getElevationSampleFromGround(e,t,a);return r||(i&&this.footprintExtent&&Q(i)?await ae({extent:this.footprintExtent,lod:i.lod,url:i.url,rasterFunction:i.rasterFunction}):void 0)}_processSuitableFeatures(e,t){return q({features:e,selectedPoint:t,camera:ct(this.view)?this.view.camera:null,currentImage:this.currentBestFeature})}async _processHitTestResults(e,t,a){const{screenPoint:i,results:[r]}=t,s="graphic"===r?.type&&this.shouldShowSelectedImage,o=r?.mapPoint??this.view?.toMap(i);if(!o)return;o.x=E(o.x,o.spatialReference);const{layerFloorFilterClause:n}=this,c=e.spatialReference.equals(o.spatialReference)?o:await H(o,e.spatialReference),l=c.spatialReference.isGeographic?z(c):c,h=P("1=1",P(e.definitionExpression,n)),u=l.spatialReference.isGeographic?1:V(l.spatialReference),d={layerInstanceOrURL:e,point:l,queryParams:{where:h,maximumDistance:e.maximumDistance?e.maximumDistance/u:void 0,objectIds:s?[r.graphic.getAttribute(e.objectIdField)]:void 0}};await this.searchBestImage(d,a)}async _queryAndLoadByObjectId(e,t,a,i){this.displayMessage=null;const{response:r}=await yt(e,t,a,i);if(v(i),!r?.features?.length)throw new gt(t);const s=X($(r.features[0].attributes).polygon.centroid),o=V(s.spatialReference);this.selectedPoint=s;const n={layerInstanceOrURL:e,point:s,queryParams:{where:P(P("1=1",P(e.definitionExpression,a)),`${e.objectIdField} <> ${t}`),maximumDistance:e.maximumDistance?e.maximumDistance/o:void 0}},c=await N(n,i);v(i);const{features:l}=c;return l.push(r.features[0]),await this.processFeatureResponse(c,s,{...i,loadBestImage:!1})}_reorderTriangularSketchLayer(){const e=this.imageMeasurementViewer.imageRenderer.map.layers?.length;this.sketchTriangularGraphicsLayer&&e&&this.imageMeasurementViewer.imageRenderer.map.layers.reorder(this.sketchTriangularGraphicsLayer,e-1)}_resetCursor(){const{activeViewer:e,imageMeasurementViewer:t}=this;e&&this.removeHandles(wt.activeViewerCursorHandles),t&&this.removeHandles(wt.imageViewerCursorHandles)}async _setImageSource(e,t,a,i,r,s){e.imageSource={datasetFormat:t.toUpperCase(),url:a.split("?")[0]},e.customParameters=Object.fromEntries(i),e.imageRotation=r??0,await e.loadImage(s)}_setMeasurementCursor(){const{activeViewer:e,imageMeasurementViewer:t,triangularMeasurementActive:a}=this;e&&this.addHandles(e.imageRenderer.acquireCursor("crosshair","high"),wt.activeViewerCursorHandles),t&&a&&this.addHandles(t.imageRenderer.acquireCursor("crosshair","high"),wt.activeViewerCursorHandles)}_toggleVisiblity(e,t){e.forEach(e=>{e.visible=t})}async _updateElevationOfSelectedPointAndLocations(e,t,a,i){const r=le(a),{location:s,cameraHeight:o}=e[0].attributes,n=await ce(s.spatialReference,s.z,o,{elevationSample:r?a:void 0,elevationSource:r?void 0:e[0].attributes.elevationSource,extent:this.footprintExtent},i);v(i);const[c,...l]=await te([t,...e.map(e=>e.attributes.geometry.clone())],n);v(i),t.elevation=c.z,e.forEach((e,t)=>{e.attributes.elevation=l[t].z})}_updateFeatures(e,t=!0){if(!e.length)return this.currentBestFeature=null,void this.additionalFeatures.removeAll();this.features.removeAll(),this.features.addMany(e),this.navigationNodes.removeAll(),this.navigationNodes.addMany(e.map(e=>{const{geometry:t,attributes:a}=e,{isSpherical:i,cameraHeading:r,cameraPitch:s}=a;return new dt({geometry:t,attributes:a,currentHeading:i?0:r,currentPitch:i?0:s})})),e.length>1?this.additionalFeatures.addMany(e.slice(1)):this.additionalFeatures.removeAll(),this._updateGroundElevation=!0,t&&(this.currentBestFeature=e[0]),"video"===this.mode&&(this._initializeVideo(),this.videoElement?.loaded&&this.videoViewModel?.playVideoFromSelectedLocation(e[0]))}_updateFootprintWithFeatures(e,t){const a=[];for(const{attributes:{geometry:i}}of e)t.contains(i)||a.push([i.x,i.y]);a.sort((e,t)=>+x([e,t])),t.addRing(a),this.footprintExtent=_e(t.extent,2,2)}async _updatePointsAndPolygons(e){const{pointSources:a,currentBestFeature:i,currentCoverageVisible:r,isAdditionalPointSourcesVisible:s,mode:o,layer:n}=this;if(i&&(this.additionalFootprints.removeAll(),this.additionalCameraLocations.removeAll(),this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.destroy(),this.bestFeatureCurrentFootprint=null,this.bestFeatureFootprint=null),!this.invalidCameraHeading)){await(this._adapter?.createFootprints(e)),v(e);for(const e of a)e.imageID===i.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:e.imageID},geometry:e.clone(),symbol:Ye,visible:r}):this.additionalCameraLocations.push(new t({attributes:{imageID:e.imageID},geometry:e.clone(),symbol:et,visible:s}));if("video"===o&&n&&!this.featureCache.length){const e=await W(n,i.geometry.spatialReference);e.features?.length&&(this.featureCache=e.features)}}}_updateCurrentBestFeature(e){if(!e)return;if(this.currentBestFeature=this.features?.at(e.featureIndex),"video"===this.mode)return void(this.currentBestFeature&&this.videoViewModel?.playVideoFromSelectedLocation(this.currentBestFeature));const t=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;let a;if(t)a=-90;else{const t=e.x-Ae[3],i=e.y-Ae[3],r=i/Math.sqrt(t**2+i**2);let s=180*Math.acos(r)/Math.PI;(t<0&&i<0||t<0&&i>0)&&(s*=-1),a=s}a===this.bestFeatureAngle?this.previousFeatureAngle=a:this.bestFeatureAngle=a,this.navigatorCurrentBestFeature=t?null:{x:e.x,y:e.y,direction:e.sector.includes("_")?e.sector.split("_")[1]:e.sector}}_updateImageMeasurementBestFeature(e){e&&(this.currentBestFeatureMeasurementImage=this.features?.at(e.featureIndex))}clearGraphics(){this._imageViewer.clearGraphics(),this._panoramicViewer.clearGraphics(),this.imageMeasurementViewer.clearGraphics(),this._panoramicMeasurementViewer.clearGraphics()}clearReferencePointOnImage(){this._referencePointOnImage&&(this._imageViewer.removeGraphic(this._referencePointOnImage),this._panoramicViewer.removeGraphic(this._referencePointOnImage),this._referencePointOnImage=p(this._referencePointOnImage))}clearLocationPointOnImage(e=!1){this._locationPointOnImage&&!e&&(this._imageViewer.removeGraphic(this._locationPointOnImage),this._panoramicViewer.removeGraphic(this._locationPointOnImage),this._locationPointOnImage=p(this._locationPointOnImage)),this._correctedLocationPointOnImage&&(this.imageMeasurementViewer.removeGraphic(this._correctedLocationPointOnImage),this._panoramicMeasurementViewer.removeGraphic(this._correctedLocationPointOnImage),this._correctedLocationPointOnImage=p(this._correctedLocationPointOnImage))}plotReferencePoint(e){"mapPoint"in e?this.plotReferencePointOnGround(e.mapPoint):this.plotReferencePointOnGround(e)}async plotReferenceLocationPoint(e,t){if(this.currentBestFeatureMeasurementImage){const a=await this.worldToImage(e,this.currentBestFeatureMeasurementImage,{signal:t});v(t),a&&this.plotLocationPointOnImage(a,!0)}}setMessage(e,t,a,i){this.displayMessage={key:e,type:t,data:a,map:i}}async transformAndPlotSelectedLocation(e){const{currentBestFeature:t,invalidCameraHeading:a,selectedPoint:i,activeViewer:r}=this;if(this._crossSymbol&&(this._panoramicViewer.removeGraphic(this._crossSymbol),this._imageViewer.removeGraphic(this._crossSymbol),this._crossSymbol=p(this._crossSymbol)),!i||!t||"image-loaded"!==r?.state||a)return;let s;try{s=await this.worldToImage(i,t,e),v(e),await this.plotSelectedPointOnImage(s,e)}catch(o){y(o)||u.getLogger(this).error("failed to transform map point to pixel, cross symbol will not be plotted on image",{error:o,selectedPoint:i,feature:t})}}async worldToImage(e,t,a){const{footprintExtent:i}=this,{imageSize:r}=this.activeViewer;if("none"===this.mode||!t||!r||!i)return;const{attributes:{location:s,elevationSource:o,cameraHeading:n,cameraHeight:c},elevationSample:l}=t;let h=s.clone();const u=await ce(s.spatialReference,s.z??0,c,{elevationSample:l,elevationSource:o});t.elevationSample=u.elevationSample;const d=Array.isArray(e)?e:[e];let m,p=await Promise.all(d.map(e=>new Promise(t=>{if(!e.hasZ)return t(te(e,u));t(e)})));if(s.spatialReference.isGeographic&&(h=await H(h,B.WebMercator,a)),p=await Promise.all(p.map(async e=>h.spatialReference.equals(e.spatialReference)?e:await H(e,h.spatialReference,a))),v(a),"panoramic"===this.mode)m=ge(p,{imageHeight:r[1],imageWidth:r[0],cameraHeading:n,cameraLocation:h});else{const e=me(t.attributes,r[0],r[1]);m=pe(p,{...e,cameraLocation:h})}return Array.isArray(e)?m:m[0]}updateCurrentCoveragePolygon(e){const{additionalFootprints:a,additionalCameraLocations:i,currentBestFeature:r,currentBestFeatureLocation:s,currentCoverageVisible:o,selectedPoint:n,view:c,_adapter:l,mode:h}=this,{attributes:{objectId:u},elevationSample:d}=r;if(this._initialCurrentCoverageUpdate){if(this._overlays?.removeAll(),this._initialCurrentCoverageUpdate=!1,this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint),e&&!this.invalidCameraHeading&&(e.visible=o,this.bestFeatureCurrentFootprint=e),c){const e=[...a,...i,s].filter(lt);c.supportsGround&&d&&l?.updateGroundElevation&&(this._updateGroundElevation&&l.updateGroundElevation(e,d),"panoramic"===h&&l.updateGroundElevation([this.bestFeatureCurrentFootprint],d)),this._updateGroundElevation=!1,n&&(e.splice(-2,0,this.bestFeatureCurrentFootprint),e.push(new t({geometry:n.clone(),symbol:De.clone(),attributes:{imageID:u}}))),this._overlays.graphics.addMany(e)}}else if(c){if(this.invalidCameraHeading)return;this.bestFeatureCurrentFootprint&&(this._overlays?.remove(this.bestFeatureCurrentFootprint),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint));const t=this.bestFeatureCurrentFootprint&&this._overlays?this._overlays.graphics.indexOf(this.bestFeatureCurrentFootprint):-1;e&&(this.bestFeatureCurrentFootprint=e,c?.supportsGround&&d&&l?.updateGroundElevation&&"panoramic"===h&&l.updateGroundElevation([e],d),e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}};e([S()],Mt.prototype,"activeLayer",null),e([S({readOnly:!0})],Mt.prototype,"activeViewer",null),e([S()],Mt.prototype,"activeTriangulatedViewer",null),e([S()],Mt.prototype,"accuracyParametersMissing",null),e([S()],Mt.prototype,"additionalFeatures",void 0),e([S({type:s.ofType(t)})],Mt.prototype,"additionalCameraLocations",void 0),e([S({type:s.ofType(t)})],Mt.prototype,"additionalFootprints",void 0),e([S()],Mt.prototype,"areaMeasurementResult",void 0),e([S()],Mt.prototype,"areaMeasurementAccuracy",void 0),e([S()],Mt.prototype,"bestFeatureAngle",void 0),e([S()],Mt.prototype,"bestFeatureCurrentFootprint",void 0),e([S({type:t})],Mt.prototype,"bestFeatureFootprint",void 0),e([S({type:Number})],Mt.prototype,"brightness",null),e([S()],Mt.prototype,"cameraHeadingThreshold",void 0),e([S()],Mt.prototype,"cameraPitchThreshold",void 0),e([S()],Mt.prototype,"clickAction",void 0),e([S()],Mt.prototype,"videoViewModel",void 0),e([S()],Mt.prototype,"collectionId",void 0),e([S({type:Number})],Mt.prototype,"contrast",null),e([S()],Mt.prototype,"conversionProps",void 0),e([S()],Mt.prototype,"coverageFrustums",void 0),e([S()],Mt.prototype,"coveragePolygons",void 0),e([S()],Mt.prototype,"currentBestFeature",void 0),e([S()],Mt.prototype,"currentBestFeatureMeasurementImage",void 0),e([S()],Mt.prototype,"currentBestFeatureLocation",void 0),e([S()],Mt.prototype,"currentCoverageVisible",void 0),e([S()],Mt.prototype,"currentNode",null),e([S()],Mt.prototype,"featureCache",void 0),e([S()],Mt.prototype,"navigationNodes",void 0),e([S({json:{write:!1}})],Mt.prototype,"determineWorkflowForFeature",void 0),e([S({json:{write:!1}})],Mt.prototype,"determineWorkflowForTriangularMeasurement",void 0),e([S()],Mt.prototype,"disabled",void 0),e([S()],Mt.prototype,"displayMessage",void 0),e([S()],Mt.prototype,"displayNewMeasurementButton",void 0),e([S()],Mt.prototype,"distanceMeasurementResult",void 0),e([S()],Mt.prototype,"distanceAccuracyArray",void 0),e([S()],Mt.prototype,"dataCaptureLayer",void 0),e([S({readOnly:!0})],Mt.prototype,"featureCount",null),e([S()],Mt.prototype,"features",void 0),e([S()],Mt.prototype,"groundCoordinates",void 0),e([S()],Mt.prototype,"groundCoordinatesAccuracy",void 0),e([S()],Mt.prototype,"heightMeasurementPixels",void 0),e([S()],Mt.prototype,"heightGraphic",void 0),e([S()],Mt.prototype,"heightMeasurementResult",void 0),e([S()],Mt.prototype,"heightMeasurementAccuracy",void 0),e([S()],Mt.prototype,"measurementAngle",void 0),e([S()],Mt.prototype,"tempDistance",void 0),e([S({readOnly:!0})],Mt.prototype,"imageGalleryEnabled",null),e([S()],Mt.prototype,"imageGeometryField",void 0),e([S({readOnly:!0})],Mt.prototype,"imageLoaded",null),e([S()],Mt.prototype,"imageLocationToolState",void 0),e([S({readOnly:!0})],Mt.prototype,"invalidCameraHeading",null),e([S()],Mt.prototype,"imagePointsInView",null),e([S()],Mt.prototype,"imageMeasurementViewer",void 0),e([S()],Mt.prototype,"isAdditionalCoverageVisible",void 0),e([S()],Mt.prototype,"isAdditionalPointSourcesVisible",void 0),e([S()],Mt.prototype,"measurementVectors",void 0),e([S()],Mt.prototype,"layer",void 0),e([S()],Mt.prototype,"layerView",null),e([S({readOnly:!0})],Mt.prototype,"layerFloorFilterClause",null),e([S({type:Number})],Mt.prototype,"localPort",void 0),e([S()],Mt.prototype,"mapImageConversionToolState",void 0),e([S()],Mt.prototype,"measureType",void 0),e([S()],Mt.prototype,"measurementGraphic",void 0),e([S({readOnly:!0,value:"none"})],Mt.prototype,"mode",null),e([S()],Mt.prototype,"navigationMode",void 0),e([S()],Mt.prototype,"navigatorCurrentBestFeature",void 0),e([S()],Mt.prototype,"oiObjectIdField",void 0),e([S({type:s.ofType(t)})],Mt.prototype,"overlayedCameraLocations",void 0),e([S()],Mt.prototype,"overlayedMapFeatures",void 0),e([S()],Mt.prototype,"pixelCoordinates",void 0),e([S()],Mt.prototype,"preserveAngle",void 0),e([S()],Mt.prototype,"pointSources",void 0),e([S({readOnly:!0})],Mt.prototype,"popupEnabled",null),e([S()],Mt.prototype,"previousFeatureAngle",void 0),e([S()],Mt.prototype,"referencePoint",null),e([S({readOnly:!0})],Mt.prototype,"sectorData",null),e([S()],Mt.prototype,"selectedPoint",void 0),e([S({type:Number})],Mt.prototype,"sharpness",null),e([S()],Mt.prototype,"shouldShowSelectedImage",void 0),e([S()],Mt.prototype,"sketch",void 0),e([S()],Mt.prototype,"sketchTriangular",void 0),e([S()],Mt.prototype,"sketchTriangularGraphicsLayer",void 0),e([S()],Mt.prototype,"draw",void 0),e([S()],Mt.prototype,"sketchAdapter",void 0),e([S({readOnly:!0})],Mt.prototype,"sketchGraphicsLayer",null),e([S({readOnly:!0})],Mt.prototype,"state",null),e([S({readOnly:!0})],Mt.prototype,"thumbnails",null),e([S()],Mt.prototype,"triangularMeasurementActive",void 0),e([S()],Mt.prototype,"triangulatedDistanceMeasurement",void 0),e([S()],Mt.prototype,"triangulatedDistanceAccuracy",void 0),e([S()],Mt.prototype,"triangulatedAreaMeasurement",void 0),e([S()],Mt.prototype,"triangulatedAreaAccuracy",void 0),e([S()],Mt.prototype,"triangulatedMeasurementGraphic",void 0),e([S()],Mt.prototype,"triangulatedPoint",void 0),e([S()],Mt.prototype,"triangulatedMeasurementAdapter",void 0),e([S()],Mt.prototype,"updateFootprint",void 0),e([S()],Mt.prototype,"updateFootprintPanorama",void 0),e([S()],Mt.prototype,"updatingTriangularMeasurementState",void 0),e([S({value:null})],Mt.prototype,"view",null),e([S()],Mt.prototype,"videoElement",void 0),e([S()],Mt.prototype,"videoLayer",void 0),e([S()],Mt.prototype,"videoMapView",void 0),e([S()],Mt.prototype,"_adapter",void 0),e([S()],Mt.prototype,"_sketchGraphicsLayer",null),e([S()],Mt.prototype,"_highlightedFeatureHandle",void 0),e([S()],Mt.prototype,"_imageViewer",void 0),e([S()],Mt.prototype,"_initialCurrentCoverageUpdate",void 0),e([S()],Mt.prototype,"_locationPointOnImage",void 0),e([S()],Mt.prototype,"_measurementService",void 0),e([S()],Mt.prototype,"_correctedLocationPointOnImage",void 0),e([S()],Mt.prototype,"_overlays",void 0),e([S({readOnly:!0})],Mt.prototype,"_overlaysView",null),e([S()],Mt.prototype,"_panoramicViewer",void 0),e([S()],Mt.prototype,"_panoramicMeasurementViewer",void 0),e([S()],Mt.prototype,"_referencePointOnGround",void 0),e([S()],Mt.prototype,"_referencePointOnImage",void 0),e([S()],Mt.prototype,"_sectorData",void 0),e([S()],Mt.prototype,"_featureToSector",void 0),e([S({readOnly:!0})],Mt.prototype,"_updatingHandles",void 0),e([S()],Mt.prototype,"footprintExtent",void 0),e([S()],Mt.prototype,"_featureChangedTask",void 0),Mt=e([k("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],Mt);const It=Mt;export{It as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import{createTask as a}from"../../../../core/asyncUtils.js";import{EsriPromise as i}from"../../../../core/Promise.js";import{throwIfAborted as s}from"../../../../core/promiseUtils.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import n from"../../../../geometry/Polygon.js";import c from"../../../../geometry/Polyline.js";import{load as l}from"../../../../geometry/projectionUtils.js";import m from"../../../../geometry/SpatialReference.js";import{convertSphereVertexToPixelLocation as h}from"../../../../layers/orientedImagery/transformations/utils.js";import{formatPixels as
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import{createTask as a}from"../../../../core/asyncUtils.js";import{EsriPromise as i}from"../../../../core/Promise.js";import{throwIfAborted as s}from"../../../../core/promiseUtils.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import n from"../../../../geometry/Polygon.js";import c from"../../../../geometry/Polyline.js";import{load as l}from"../../../../geometry/projectionUtils.js";import m from"../../../../geometry/SpatialReference.js";import{convertSphereVertexToPixelLocation as h,convertPixelToHeadingPitch as u,convertHeadingPitchToSphereVertex as d}from"../../../../layers/orientedImagery/transformations/utils.js";import{getModeCorrectedPoint as p,formatPixels as y}from"../../imageMeasurementUtils.js";import{SketchHandlerMixin as M}from"../../mixins/SketchHandlerMixin.js";let w=[],g=[],v=0,f=class extends(M(i)){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(l())}async handleCreate(e){const t=e.toolEventInfo;switch(e.tool){case"polyline":await this.handlePolylineEvents(e,t);break;case"polygon":await this.handlePolygonEvents(e,t)}}handleDelete(e){this.resetDistanceMeasurements(),this.resetAreaMeasurements()}handleDestroy(){this.resetDistanceMeasurements(),this.resetAreaMeasurements()}cursorUpdatePolylineHandler(e){const{mode:t,activeViewer:a}=this.viewModel;if("none"===t||!a?.imageSize)return;if("default"===t)this.measurementArray.push(e.coordinates);else{const t={x:e.coordinates[0],y:e.coordinates[1],z:e.coordinates[2]},i=h(t,a.imageSize[0],a.imageSize[1]);this.measurementArray.push([i.x,i.y])}const i=g.reduce((e,t)=>e+t,0)+this.pixelMeasurement;this.viewModel.distanceMeasurementResult=i}async cursorUpdatePolygonHandler(e){const{mode:t,activeViewer:a}=this.viewModel;if("none"===t||!a?.imageSize)return;const i=e.coordinates;if(w=[...this.polygonVertices],"default"===t)w.push(i);else{const e={x:i[0],y:i[1],z:i[2]},t=h(e,a?.imageSize[0],a?.imageSize[1]);w.push([t.x,t.y])}if(w.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return;const s=w[0];w=w.filter((e,t)=>0===t||t===w.length-1||JSON.stringify(e)!==JSON.stringify(s));const r=await this._getAreaFromTask(w);r?.area&&r?.perimeter&&(v=r.area)}async handlePolylineEvents(e,t){const a=!this.viewModel.accuracyParametersMissing;if("cancel"===e.state)return this.resetDistanceMeasurements(),this.viewModel.distanceMeasurementResult=0,this.viewModel.distanceAccuracyArray=[],void(this.viewModel.displayNewMeasurementButton=!0);if("complete"===e.state&&e.graphic){if(this.viewModel.activeViewer?.addGraphic(e.graphic),this.viewModel.triangularMeasurementActive){const t=e.graphic.geometry;await this.viewModel.processMeasurementVectors(t.paths[0]),await this._overlayFirstMeasurement(e.graphic,e.tool)}return this.viewModel.measurementGraphic=e.graphic,void this.resetDistanceMeasurements()}switch(t?.type){case"cursor-update":this.cursorUpdatePolylineHandler(t);break;case"vertex-add":if(this.measurementArray.length&&a){const e=await this._getAccuracyFromTask();e&&this.viewModel.distanceAccuracyArray.push(e)}this.vertexUpdatePolylineHandler()}const i=await this._getDistanceFromTask();this.pixelMeasurement=i??this.pixelMeasurement}async handlePolygonEvents(e,t){const a=!this.viewModel.accuracyParametersMissing;if("cancel"===e.state)return this.resetAreaMeasurements(),this.viewModel.areaMeasurementResult=0,this.viewModel.areaMeasurementAccuracy=0,void(this.viewModel.displayNewMeasurementButton=!0);if("complete"===e.state&&e.graphic){if(this.viewModel.activeViewer?.addGraphic(e.graphic),a){const e=await this._getAreaAccuracyFromTask(this.polygonVertices);this.viewModel.areaMeasurementAccuracy=e&&e>this.viewModel.areaMeasurementAccuracy?e:this.viewModel.areaMeasurementAccuracy}if(this.viewModel.triangularMeasurementActive){const t=e.graphic.geometry;await this.viewModel.processMeasurementVectors(t.rings[0]),await this._overlayFirstMeasurement(e.graphic,e.tool)}return this.viewModel.measurementGraphic=e.graphic,void this.resetAreaMeasurements()}switch(t?.type){case"vertex-add":await this.vertexAddPolygonHandler(t);break;case"cursor-update":await this.cursorUpdatePolygonHandler(t)}this.viewModel.areaMeasurementResult=v>0?v:this.pixelAreaMeasurement}async vertexAddPolygonHandler(e){const{mode:t,activeViewer:a}=this.viewModel,i=e.added,s=i[i.length-1];if(!Array.isArray(s)||"none"===t||!a?.imageSize)return;if("default"===t)this.polygonVertices.push(s);else{const e={x:s[0],y:s[1],z:s[2]},t=h(e,a?.imageSize[0],a?.imageSize[1]);this.polygonVertices.push([t.x,t.y])}if(this.polygonVertices.length<3||!this.viewModel.currentBestFeature||!this.viewModel.activeViewer?.imageSize)return;const r=this.polygonVertices[0];this.polygonVertices=this.polygonVertices.filter((e,t)=>0===t||t===this.polygonVertices.length-1||JSON.stringify(e)!==JSON.stringify(r));const o=await this._getAreaFromTask(this.polygonVertices);if(!o?.area||!o?.perimeter)return;const{area:n}=o;this.pixelAreaMeasurement=n}vertexUpdatePolylineHandler(){this.measurementArray=this.measurementArray.slice(-1);const e=g.reduce((e,t)=>e+t,0)+this.pixelMeasurement;this.viewModel.distanceMeasurementResult=e,this.pixelMeasurement>0&&g.push(this.pixelMeasurement)}resetDistanceMeasurements(){this.measurementArray=[],this.pixelMeasurement=0,g=[]}resetAreaMeasurements(){this.polygonVertices=[],this.pixelAreaMeasurement=0,v=0}async _overlayFirstMeasurement(e,t){switch(t){case"polyline":await this._overlayFirstDistanceMeasurement(e);break;case"polygon":await this._overlayFirstAreaGeometry(e)}}async _overlayFirstDistanceMeasurement(e){const{mode:a,activeTriangulatedViewer:i}=this.viewModel,s=e.geometry?.clone(),r=e.symbol?.clone(),o=i?.imageSize,n=[...s.paths[0]],l="default"===a;if("none"===a||"video"===a||!o)return;const h=l?n:n.map(e=>p(e,"panoramic",o)),u=y(h,!0),d=l?await this.viewModel.getMeasurementProperties():await this.viewModel.getMeasurementPropertiesPanoramic(),M=l?await this.viewModel.getMeasurementProperties(this.viewModel.currentBestFeatureMeasurementImage,this.viewModel.imageMeasurementViewer):await this.viewModel.getMeasurementPropertiesPanoramic(this.viewModel.currentBestFeatureMeasurementImage,this.viewModel.activeTriangulatedViewer);if(u?.length&&d&&M){const e=l?await this.viewModel.imageToImageTransform(u,d,M):await this.viewModel.imageToImageTransformPanoramic(u,d,M),a=e.map(e=>[e.x-.5,-.5-e.y]),i=e.map(({x:e,y:t})=>({x:e-.5,y:-.5-t})).slice(0,2).map(e=>_(e,o)),s=new c({paths:l?[a]:[i],spatialReference:m.WebMercator}),n=new t({geometry:s,symbol:r});await this.viewModel.editOverlayedGraphics(n)}}async _overlayFirstAreaGeometry(e){const a=e.geometry?.clone(),i=e.symbol?.clone(),s=[...a.rings[0]],r=y(s,!0),o=await this.viewModel.getMeasurementProperties(),c=await this.viewModel.getMeasurementProperties(this.viewModel.currentBestFeatureMeasurementImage,this.viewModel.imageMeasurementViewer);if(r?.length&&o&&c){const e=(await this.viewModel.imageToImageTransform(r,o,c)).map(e=>[e.x-.5,-.5-e.y]),a=new n({rings:[e],spatialReference:m.WebMercator}),s=new t({geometry:a,symbol:i});await this.viewModel.editOverlayedGraphics(s)}}async _getAreaFromTask(e){const{mode:t}=this.viewModel;return this._calculationTask?.abort(),this._calculationTask=a(async a=>{this._areaCalculation=null;const i=await this.viewModel.calculateAreaMeasurement(e,t,a);s(a),this._areaCalculation=i}),await this._calculationTask.promise,this._areaCalculation}async _getDistanceFromTask(){const{mode:e}=this.viewModel;return this._calculationTask?.abort(),this._calculationTask=a(async t=>{this._distanceCalculation=0;const a=await this.viewModel.calculateDistanceMeasurement(this.measurementArray,e,t);s(t),this._distanceCalculation=a}),await this._calculationTask.promise,this._distanceCalculation}async _getAccuracyFromTask(){const{mode:e}=this.viewModel;return"none"===e?null:(this._calculationTask?.abort(),this._calculationTask=a(async t=>{this._distanceCalculation=0;const a="default"===e?await this.viewModel.calculateAccuracy(this.measurementArray,"distance",t):await this.viewModel.calculateAccuracyPanoramic(this.measurementArray,"distance",t);s(t),this._distanceCalculation=a}),await this._calculationTask.promise,this._distanceCalculation)}async _getAreaAccuracyFromTask(e){const{mode:t}=this.viewModel;return"none"===t?null:(this._calculationTask?.abort(),this._calculationTask=a(async a=>{this._distanceCalculation=0;const i="default"===t?await this.viewModel.calculateAccuracy(e,"area",a):await this.viewModel.calculateAccuracyPanoramic(e,"area",a);s(a),this._distanceCalculation=i}),await this._calculationTask.promise,this._distanceCalculation)}};e([r()],f.prototype,"type",void 0),e([r()],f.prototype,"measurementArray",void 0),e([r()],f.prototype,"pixelMeasurement",void 0),e([r()],f.prototype,"pixelAreaMeasurement",void 0),e([r()],f.prototype,"polygonVertices",void 0),f=e([o("esri.widgets.OrientedImageryViewer.adapters.sketch.MeasurementAdapter")],f);const A=f,_=(e,t)=>{const{heading:a,pitch:i}=u(e,t[0],t[1]);return d(a,i)};export{A as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{throwIfAborted as e}from"../../../core/promiseUtils.js";import{distance as t}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{projectWithZConversion as a}from"../../../geometry/projectionUtils.js";import{imageToWorld as r,imageToWorldPanoramic as i}from"../../../layers/orientedImagery/transformations/imageToWorld.js";import{getImageToWorldProperties as n}from"../../../layers/orientedImagery/transformations/utils.js";import{formatPixels as
|
|
5
|
+
import{throwIfAborted as e}from"../../../core/promiseUtils.js";import{distance as t}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{projectWithZConversion as a}from"../../../geometry/projectionUtils.js";import{imageToWorld as r,imageToWorldPanoramic as i}from"../../../layers/orientedImagery/transformations/imageToWorld.js";import{getImageToWorldProperties as n,convertSphereVertexToPixelLocation as s}from"../../../layers/orientedImagery/transformations/utils.js";import{formatPixels as l,heightMeasurementPanoramic as c,heightMeasurement2D as u,calculateHeightAccuracyPanoramic as o,calculateHeightAccuracy as m,pixelAreaMeasurement2D as w,pixelAreaMeasurementPanoramic as d,pixelDistanceMeasurement2D as h,pixelDistanceMeasurementPanoramic as M,generateCombinations as g,getRootOfSumOfSquaredErrors as p,generateCombinationsPanoramic as v,calculateLocationAccuracyFromDeviations as f,calculateReferenceImagePointPanoramic as y,calculateAnglePano as _,calculateTempImagePoint as P,calculateAngle as A,computeTriangulatedAreaMeasurement as z,computeTriangulatedDistanceMeasurement as b}from"../imageMeasurementUtils.js";class x{constructor(e){this._viewModel=e}async computeHeight(e,t,a=!0){const{currentBestFeature:r,activeViewer:i,layer:s,footprintExtent:w}=this._viewModel,d=i?.imageSize,h=r?.attributes,M=s?.orientationAccuracy;if(!h||!d||!e||e.length<2||!M)return;const g="panoramic"===t?await this._viewModel.getMeasurementPropertiesPanoramic():n(h,d[0],d[1]),p=e.at(0),v=e.at(-1);if(!(g&&p&&v&&M&&w))return;const f=[v,p],y=l(f,!1),_="panoramic"===t?await c(f,g,M,r,!0,!1):await u(f,g,M,!0,a);if(!_)return;const P="panoramic"===t?await o(M,y,g,_,r,!0):await m(M,y,g,_,!0);return P?{value:_,accuracy:P}:{value:_}}async calculateAreaMeasurement(t,a,r){if(t.length<3||!this._viewModel.currentBestFeature||!this._viewModel.activeViewer?.imageSize||"none"===this._viewModel.mode)return null;const i="default"===a?await this._viewModel.getMeasurementProperties():await this._viewModel.getMeasurementPropertiesPanoramic();return e(r),i?"default"===a?await w(t,i,!0):await d(t,i,!0,r):null}async calculateDistanceMeasurement(t,a,r){const{currentBestFeature:i,activeViewer:n}=this._viewModel;if(t.length<2||!i||!n?.imageSize||"none"===a)return null;const s="default"===a?await this._viewModel.getMeasurementProperties():await this._viewModel.getMeasurementPropertiesPanoramic();return e(r),s?"default"===a?await h([t.at(0),t.at(-1)],s,!0):await M([t.at(0),t.at(-1)],s,!0):null}async calculateAccuracy(t,a,r){const{layer:i,currentBestFeature:n,activeViewer:s,currentBestFeatureMeasurementImage:l,triangularMeasurementActive:c,imageMeasurementViewer:u}=this._viewModel,o=i?.orientationAccuracy,m=o?.every(e=>0===e)||!o?.length;if("area"===a&&t.length<3||"distance"===a&&t.length<2||!n||!s?.imageSize||m)return null;let d=null;if(c&&l&&u?d=await this._viewModel.getMeasurementProperties(l,u):(d=await this._viewModel.getMeasurementProperties(),e(r)),!d)return null;const M="area"===a?await w(t,d,!0):await h([t.at(0),t.at(-1)],d,!0);e(r);const{updateElevationProps:v,...f}=d,y=g(f,o);if(!y?.length)return null;const _=y.map(e=>({...e,updateElevationProps:v})).map(async i=>{const n="area"===a?await w(t,i,!0):await h([t.at(0),t.at(-1)],i,!0);if(e(r),n&&M){if("area"===a){const e="number"!=typeof n?n.area:null;return e?Math.abs(e-M.area):null}return Math.abs(n-M)}return null}),P=await Promise.all(_);e(r);const A=P.filter(e=>null!==e);return 0===A.length?null:p(A)}async calculateLocationAccuracy(t,n,s="default",l){const{layer:c,currentBestFeature:u}=this._viewModel,o=c?.orientationAccuracy,m=this._viewModel.view?.spatialReference,w=o?.every(e=>0===e)||!o?.length;if(!u||w)return null;const d="default"===s?await this._viewModel.getMeasurementProperties():await this._viewModel.getMeasurementPropertiesPanoramic();if(e(l),!d)return null;const{updateElevationProps:h,...M}=d,p="default"===s?g(M,o):v(M,o);if(!p?.length)return null;const y=p.map(e=>({...e,updateElevationProps:h})).map(async c=>{const{updateElevationProps:u,...o}=c;let w="default"===s?await r(t,o,u):await i(t,o,u);return e(l),m&&!w.spatialReference.equals(m)&&(w=await a(w,m),e(l)),w&&n?[Math.abs(w.x-n.x),Math.abs(w.y-n.y),w.z&&n.z?Math.abs(w.z-n.z):0]:null}),_=await Promise.all(y);if(e(l),!_?.length)return null;const P=_.map(e=>[e?.[0]??0,e?.[1]??0,e?.[2]??0]),[A,z,b]=f(P);return{x:A,y:z,z:b}}async calculateAccuracyPanoramic(t,a,r){const{layer:i,currentBestFeature:n,activeViewer:s,mode:l}=this._viewModel,c=i?.orientationAccuracy,u=c?.every(e=>0===e)||!c?.length;if("area"===a&&t.length<3||"distance"===a&&t.length<2||!n||!s?.imageSize||u||"panoramic"!==l)return null;const o=await this._viewModel.getMeasurementPropertiesPanoramic();if(e(r),!o)return null;const m="area"===a?await d(t,o,!0):await M([t.at(0),t.at(-1)],o,!0);e(r);const{updateElevationProps:w,...h}=o,g=v(h,c);if(!g?.length)return null;const f=g.map(e=>({...e,updateElevationProps:w})).map(async i=>{const n="area"===a?await d(t,i,!0):await M([t.at(0),t.at(-1)],i,!0);if(e(r),n&&m){if("area"===a){const e="number"!=typeof n?n.area:null;return e?Math.abs(e-m.area):null}return Math.abs(n-m)}return null}),y=await Promise.all(f);e(r);const _=y.filter(e=>null!==e);return 0===_.length?null:p(_)}async calculateHeightMeasurementInfo(e,a,r){const{currentBestFeature:i,activeViewer:s}=this._viewModel,c=s?.imageSize;if(!i||!s||!c?.length||"none"===a)return;const{attributes:u}=i,[o]=l([e],"panoramic"!==a),m="panoramic"===a?await this._viewModel.getMeasurementPropertiesPanoramic():n(u,c[0],c[1]);if("panoramic"===a){if(!m)return;const e=await y(o,m,i,r);if(!e)return;e?.heading>180&&(e.heading-=360);const a=_(o,e),n=t([o.x,o.y],[e.x,e.y]);if(!a||!n)return;return{measurementAngle:a,tempDistance:n}}const w=await P(o,m,r);if(!w)return;const d=A(o,w),h=t([o.x,o.y],[w.x,w.y]);return d&&h?{measurementAngle:d,tempDistance:h}:void 0}async calculateTriangulatedMeasurements(e){if(this._viewModel.activeTriangulatedViewer?.imageSize)switch(this._viewModel.measureType){case"distance":{this._viewModel.triangulatedDistanceMeasurement=await b(this._viewModel.measurementVectors);const[t,a]=this._viewModel.activeTriangulatedViewer.imageSize,r=e.map(([e,r,i])=>s({x:e,y:r,z:i},t,a)).map(({x:e,y:t})=>[e,t]),i="default"===this._viewModel.mode?await this.calculateAccuracy(e,"distance"):await this.calculateAccuracyPanoramic(r,"distance");if(i&&this._viewModel.triangulatedDistanceMeasurement?.distance){const e=Math.atan(i/this._viewModel.triangulatedDistanceMeasurement.distance);this._viewModel.triangulatedDistanceAccuracy={distanceAccuracy:i,angleAccuracy:e}}break}case"area":if(this._viewModel.currentBestFeatureMeasurementImage?.geometry.spatialReference){const t=await z(this._viewModel.measurementVectors,this._viewModel.currentBestFeatureMeasurementImage.geometry.spatialReference);this._viewModel.triangulatedAreaMeasurement=t,this._viewModel.triangulatedAreaAccuracy=await this.calculateAccuracy(e,"area")??this._viewModel.triangulatedAreaAccuracy}}}}export{x as ImageMeasurementService};
|