@arcgis/core 5.0.0-next.49 → 5.0.0-next.50
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/applications/Components/baUtils.js +1 -1
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0000781c850b1b4828b3.js +1 -0
- package/assets/esri/core/workers/chunks/00f044370bf3bb6b24d7.js +1 -0
- package/assets/esri/core/workers/chunks/0136cd1a5da204b6daeb.js +1 -0
- package/assets/esri/core/workers/chunks/044a0ccd89741c1ae770.js +1 -0
- package/assets/esri/core/workers/chunks/090dad5579f0148d6486.js +1 -0
- package/assets/esri/core/workers/chunks/09bd9bd37a339802907a.js +1 -0
- package/assets/esri/core/workers/chunks/0bc01d71ed1ab8c3af3c.js +1 -0
- package/assets/esri/core/workers/chunks/0d9904ba62558686c289.js +1 -0
- package/assets/esri/core/workers/chunks/0fcb40204db8ee5571c3.js +1 -0
- package/assets/esri/core/workers/chunks/1065fd655bb7cee243fd.js +1 -0
- package/assets/esri/core/workers/chunks/11ab10668632648b2ba7.js +1 -0
- package/assets/esri/core/workers/chunks/13167bdd486b41163147.js +1 -0
- package/assets/esri/core/workers/chunks/{d8db2c51b2fb42f37b2a.js → 1363345f31f4f5051132.js} +1 -1
- package/assets/esri/core/workers/chunks/13be94357dcf5afc4fcb.js +1 -0
- package/assets/esri/core/workers/chunks/{e66bcdfd75e0113d1cec.js → 13ce8e8d45779b11ee12.js} +1 -1
- package/assets/esri/core/workers/chunks/1693f19f1c37e0a2087e.js +1 -0
- package/assets/esri/core/workers/chunks/18ab5959ebf8689f8fe8.js +1 -0
- package/assets/esri/core/workers/chunks/18c4cd160a4052b05831.js +1 -0
- package/assets/esri/core/workers/chunks/1bf4b5e5402790ccb450.js +1 -0
- package/assets/esri/core/workers/chunks/1db058f91a8e17b24db6.js +1 -0
- package/assets/esri/core/workers/chunks/1dc3ab52fcde7bff0f23.js +1 -0
- package/assets/esri/core/workers/chunks/{a7cd795042ebb8585906.js → 1f0c7ab33e466a37c7f9.js} +1 -1
- package/assets/esri/core/workers/chunks/224f01b11fdba9250b1e.js +1 -0
- package/assets/esri/core/workers/chunks/{a1a7b0e7ca488c895cb7.js → 22c115ec003351c7d8ee.js} +1 -1
- package/assets/esri/core/workers/chunks/24c35a46cf8ed11b774d.js +1 -0
- package/assets/esri/core/workers/chunks/27794d48c04a5875fd22.js +1 -0
- package/assets/esri/core/workers/chunks/294acaaebfedb05fe81e.js +1 -0
- package/assets/esri/core/workers/chunks/2a66841243975cac3e3c.js +1 -0
- package/assets/esri/core/workers/chunks/2c12848e4934e9bb2bd0.js +1 -0
- package/assets/esri/core/workers/chunks/2d61b6efa17e8c5832da.js +1 -0
- package/assets/esri/core/workers/chunks/2d6fa00273a73d44297d.js +1 -0
- package/assets/esri/core/workers/chunks/2da13c2269ab90281143.js +1 -0
- package/assets/esri/core/workers/chunks/2dfaead2ec6434513d45.js +1 -0
- package/assets/esri/core/workers/chunks/2fae37f34b28a46841e3.js +1 -0
- package/assets/esri/core/workers/chunks/{3298e96d3f2e49e338d2.js → 308fb48d080e01499a26.js} +1 -1
- package/assets/esri/core/workers/chunks/30dd4a7c93b33988a270.js +1 -0
- package/assets/esri/core/workers/chunks/355c8d0eadfff9f62dfb.js +1 -0
- package/assets/esri/core/workers/chunks/35961e71f69ae1d24b9e.js +1 -0
- package/assets/esri/core/workers/chunks/36a04be40369111a633d.js +1 -0
- package/assets/esri/core/workers/chunks/36d9208895abd1ba4ff1.js +1 -0
- package/assets/esri/core/workers/chunks/395a0773ccafd1f24c4d.js +1 -0
- package/assets/esri/core/workers/chunks/{81a60dfa600b690098f9.js → 3a612f873e29348370b2.js} +1 -1
- package/assets/esri/core/workers/chunks/3b1471f908fdecec2815.js +1 -0
- package/assets/esri/core/workers/chunks/{da1e61f355fb943085dc.js → 3c66dd52ad156711a6a2.js} +1 -1
- package/assets/esri/core/workers/chunks/3dd0db77a05263000bd8.js +1 -0
- package/assets/esri/core/workers/chunks/{08c1ea29678da27136f3.js → 44fb1184eeed0636704a.js} +1 -1
- package/assets/esri/core/workers/chunks/46d430a6983b81ba7556.js +1 -0
- package/assets/esri/core/workers/chunks/472d290f8eb1c1a85724.js +1 -0
- package/assets/esri/core/workers/chunks/47338472f5a8e004a671.js +1 -0
- package/assets/esri/core/workers/chunks/48b3906ac3ec57253d90.js +1 -0
- package/assets/esri/core/workers/chunks/{2a41283bba2361afa1fd.js → 495af366ec1defd89a72.js} +1 -1
- package/assets/esri/core/workers/chunks/49b581782f63abb6dd9f.js +1 -0
- package/assets/esri/core/workers/chunks/49df576f0215618aa651.js +1 -0
- package/assets/esri/core/workers/chunks/4abe2c56aecc9e9b8e86.js +1 -0
- package/assets/esri/core/workers/chunks/4e01e509a761a9d00b52.js +1 -0
- package/assets/esri/core/workers/chunks/{9d0f0d055ec25af037e0.js → 51093e552e31344cefa5.js} +1 -1
- package/assets/esri/core/workers/chunks/521aac8a665e98e4ca78.js +1 -0
- package/assets/esri/core/workers/chunks/54666586754949bfa584.js +1 -0
- package/assets/esri/core/workers/chunks/549f4ab9e285deaf04fb.js +1 -0
- package/assets/esri/core/workers/chunks/553ca1e55e9f1359839c.js +1 -0
- package/assets/esri/core/workers/chunks/{6f3943bebe2d5f4994f7.js → 58242447b72cc60a5040.js} +1 -1
- package/assets/esri/core/workers/chunks/58419d362f24b35003c1.js +1 -0
- package/assets/esri/core/workers/chunks/5aa354854219361f722b.js +1 -0
- package/assets/esri/core/workers/chunks/{aab93e885b6c7c6aa76e.js → 5ce524e0060053f35592.js} +19 -19
- package/assets/esri/core/workers/chunks/5d244fcf5c075afccdc6.js +1 -0
- package/assets/esri/core/workers/chunks/5e9fdd4eff7189f45932.js +1 -0
- package/assets/esri/core/workers/chunks/60954ab810dbbf36e5e1.js +1 -0
- package/assets/esri/core/workers/chunks/62ed6b45482e39d67785.js +1 -0
- package/assets/esri/core/workers/chunks/63b8193ad90b2ebe6884.js +1 -0
- package/assets/esri/core/workers/chunks/63c91421a71ae3b3599e.js +1 -0
- package/assets/esri/core/workers/chunks/63cf702cde83692126be.js +1 -0
- package/assets/esri/core/workers/chunks/687d2b761dc5b5cf0c31.js +1 -0
- package/assets/esri/core/workers/chunks/6cfcfebe9a4c491e453a.js +1 -0
- package/assets/esri/core/workers/chunks/{88aa71f02f43bb069345.js → 7033fa18b7dd7bd3e49c.js} +1 -1
- package/assets/esri/core/workers/chunks/710b29729f252f11115d.js +1 -0
- package/assets/esri/core/workers/chunks/72a520802b8accfd4512.js +1 -0
- package/assets/esri/core/workers/chunks/{72fbee59d5d909615408.js → 73892ac79b24b05e6863.js} +1 -1
- package/assets/esri/core/workers/chunks/73c3ee2697265b0f7208.js +1 -0
- package/assets/esri/core/workers/chunks/73f9cbf0f919b6adc2d5.js +1 -0
- package/assets/esri/core/workers/chunks/75e9759290f0f67b2128.js +1 -0
- package/assets/esri/core/workers/chunks/7737e69da604d2521da8.js +1 -0
- package/assets/esri/core/workers/chunks/{8e8d5422f57269d8c8d2.js → 7891825d5cdca03d2db0.js} +1 -1
- package/assets/esri/core/workers/chunks/7cd0ab01933bfb2c6e43.js +1 -0
- package/assets/esri/core/workers/chunks/81c2cc77c275a5b555c0.js +1 -0
- package/assets/esri/core/workers/chunks/82ace0195b63790b22c9.js +1 -0
- package/assets/esri/core/workers/chunks/8892bf3d2367e35de001.js +1 -0
- package/assets/esri/core/workers/chunks/8a132d91077ecf849248.js +1 -0
- package/assets/esri/core/workers/chunks/8a6e50d95539b46f629c.js +1 -0
- package/assets/esri/core/workers/chunks/8d941204425571b656ec.js +1 -0
- package/assets/esri/core/workers/chunks/914746077017fa50933f.js +1 -0
- package/assets/esri/core/workers/chunks/{004c2a1a37b99a184b13.js → 91fba3bebd78cb956941.js} +1 -1
- package/assets/esri/core/workers/chunks/92ec96aa743cabc9475d.js +1 -0
- package/assets/esri/core/workers/chunks/{5b290d18de61789417f9.js → 9361834d2c3064eb41fc.js} +1 -1
- package/assets/esri/core/workers/chunks/{44f036cc21e3a2308f69.js → 93b139be6488a1b4ba19.js} +1 -1
- package/assets/esri/core/workers/chunks/95057105f1b3bf805140.js +1 -0
- package/assets/esri/core/workers/chunks/968335b28b895e19913b.js +1 -0
- package/assets/esri/core/workers/chunks/973bf2ed34d57f299472.js +1 -0
- package/assets/esri/core/workers/chunks/9b6e2099aabf67b9f9f2.js +1 -0
- package/assets/esri/core/workers/chunks/{97b01803d0c38541aa08.js → 9c93eadbd19bef1191b4.js} +1 -1
- package/assets/esri/core/workers/chunks/a1594486177015e8a6c3.js +1 -0
- package/assets/esri/core/workers/chunks/{df458ad51be27df3d79d.js → a1f264abbd6354c333bf.js} +1 -1
- package/assets/esri/core/workers/chunks/a3407ca77b0ff62c0e75.js +1 -0
- package/assets/esri/core/workers/chunks/{8be61e13530fd0dc2fd1.js → a4f89568205d78d91cfe.js} +1 -1
- package/assets/esri/core/workers/chunks/a5e7c9517939f762c518.js +1 -0
- package/assets/esri/core/workers/chunks/a63ff3e9a9f3853d12f3.js +1 -0
- package/assets/esri/core/workers/chunks/a81a7cba815adb575c36.js +1 -0
- package/assets/esri/core/workers/chunks/{fe6fa1f2c2d54d41645e.js → a8dfd246c797f3b979f5.js} +1 -1
- package/assets/esri/core/workers/chunks/a8f7e44657083f6aa3fd.js +1 -0
- package/assets/esri/core/workers/chunks/a8fd635d1165db8616ab.js +1 -0
- package/assets/esri/core/workers/chunks/a92c1171314a68504c1b.js +1 -0
- package/assets/esri/core/workers/chunks/aa297e0931213341f51b.js +1 -0
- package/assets/esri/core/workers/chunks/aa7a1705266eec353cb6.js +1 -0
- package/assets/esri/core/workers/chunks/ab5e2f823960c33cefe4.js +1 -0
- package/assets/esri/core/workers/chunks/{f11453f24c0b728669d2.js → ac6f002cfad42e60de8f.js} +1 -1
- package/assets/esri/core/workers/chunks/b11c0e80e583f2b7c5de.js +1 -0
- package/assets/esri/core/workers/chunks/b14f9a46e583e1625a2b.js +1 -0
- package/assets/esri/core/workers/chunks/{8c271e9272e4eaf1325a.js → b1d3d2c93c189e215f67.js} +1 -1
- package/assets/esri/core/workers/chunks/b2425f6af7df6902dfc4.js +1 -0
- package/assets/esri/core/workers/chunks/b638ce18b93d3cfb9967.js +1 -0
- package/assets/esri/core/workers/chunks/b648a1e641cf5c772d67.js +1 -0
- package/assets/esri/core/workers/chunks/{1c58064ea80e6a4a4a3b.js → b907d16e82ac908bb896.js} +1 -1
- package/assets/esri/core/workers/chunks/b91c13f44f4d1bac5799.js +1 -0
- package/assets/esri/core/workers/chunks/ba7e97b1e324118b8156.js +1 -0
- package/assets/esri/core/workers/chunks/bb4aefaf9b0327dda738.js +1 -0
- package/assets/esri/core/workers/chunks/{9664d9e679abc41f6c42.js → bce81df760f5e34c01d7.js} +1 -1
- package/assets/esri/core/workers/chunks/be6a05d5375e80968877.js +1 -0
- package/assets/esri/core/workers/chunks/c02b09f16241db233103.js +1 -0
- package/assets/esri/core/workers/chunks/c09cba77ee60a3d765e2.js +1 -0
- package/assets/esri/core/workers/chunks/c0d6336c10b4081c4e32.js +1 -0
- package/assets/esri/core/workers/chunks/c27842a34e73ccb46116.js +1 -0
- package/assets/esri/core/workers/chunks/c7802c144959d60e774a.js +1 -0
- package/assets/esri/core/workers/chunks/c91201b37d1cb3875fb4.js +1 -0
- package/assets/esri/core/workers/chunks/cc4ae105e727d9211d82.js +1 -0
- package/assets/esri/core/workers/chunks/cd39a53ef74f47604977.js +1 -0
- package/assets/esri/core/workers/chunks/d22e0d733bfe821c0510.js +1 -0
- package/assets/esri/core/workers/chunks/{d7878fba02814adaf19f.js → d57577c02fb2932e8305.js} +1 -1
- package/assets/esri/core/workers/chunks/d62193323c67b379dee3.js +1 -0
- package/assets/esri/core/workers/chunks/d7a62504e00989202c45.js +1 -0
- package/assets/esri/core/workers/chunks/{adfe28c1c1619cdd3ca1.js → d8511e71c5108a0ba9eb.js} +2 -2
- package/assets/esri/core/workers/chunks/da922e861d5845ae0979.js +1 -0
- package/assets/esri/core/workers/chunks/dbe55d4731227d6e9571.js +1 -0
- package/assets/esri/core/workers/chunks/de05c59da6d67716795d.js +1 -0
- package/assets/esri/core/workers/chunks/de60421029fbcebe2950.js +1 -0
- package/assets/esri/core/workers/chunks/e00d56ae5e68267fe269.js +1 -0
- package/assets/esri/core/workers/chunks/{fecae7495e53bb05f282.js → e25be3b6b67ce6b03011.js} +1 -1
- package/assets/esri/core/workers/chunks/e2973e5626e5039209f9.js +1 -0
- package/assets/esri/core/workers/chunks/e2c7c269be93c552dc5b.js +1 -0
- package/assets/esri/core/workers/chunks/e4d593ddcbcf06010ab0.js +1 -0
- package/assets/esri/core/workers/chunks/e5ac9b048b16fef9840c.js +1 -0
- package/assets/esri/core/workers/chunks/{f7163048146ddaedfc36.js → e668ddc7332e5e560e78.js} +1 -1
- package/assets/esri/core/workers/chunks/e6bab7b739bfbb39f6cd.js +1 -0
- package/assets/esri/core/workers/chunks/{8b578ffc3a83089aa782.js → e7c08a03772f7fccd949.js} +1 -1
- package/assets/esri/core/workers/chunks/e8e4d48ab4024e17108d.js +1 -0
- package/assets/esri/core/workers/chunks/e9e0f1c355f963cbea74.js +1 -0
- package/assets/esri/core/workers/chunks/ec7e6427d99cf3148a61.js +1 -0
- package/assets/esri/core/workers/chunks/edd3cf415955309b4ca4.js +1 -0
- package/assets/esri/core/workers/chunks/ee361690b456c12c30d8.js +1 -0
- package/assets/esri/core/workers/chunks/efa95c50d1ed8e74219f.js +1 -0
- package/assets/esri/core/workers/chunks/f142c5cbdd16f1768275.js +1 -0
- package/assets/esri/core/workers/chunks/f286f13686f003c5eec5.js +1 -0
- package/assets/esri/core/workers/chunks/f379fd459a103f42d447.js +1 -0
- package/assets/esri/core/workers/chunks/{f2ba50eb29f93df885d6.js → f3d8d5fe15501220792d.js} +1 -1
- package/assets/esri/core/workers/chunks/f56906c443ce8ff68a27.js +1 -0
- package/assets/esri/core/workers/chunks/fb6670a929b7333f1764.js +1 -0
- package/assets/esri/core/workers/chunks/fbdf553253cf8f22c022.js +1 -0
- package/assets/esri/core/workers/chunks/fc10c738bae304721ab2.js +1 -0
- package/assets/esri/core/workers/chunks/ff79c2cb28db7e0a1fc4.js +1 -0
- package/assets/esri/core/workers/chunks/ffdf1cbc1e54414d0f96.js +1 -0
- package/assets/esri/themes/base/widgets/_Attribution.scss +7 -4
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/Bufferer-Dw9Qi4T1.js +1 -1
- package/chunks/Distance2DCalculator-CXhBP-8I.js +1 -1
- package/chunks/Envelope.js +1 -1
- package/chunks/GeodeticDistanceCalculator-Ce-woMPw.js +1 -1
- package/chunks/GeodeticUtils.js +1 -1
- package/chunks/Geometry.js +1 -1
- package/chunks/MultiPathImpl.js +1 -1
- package/chunks/OperatorCrosses.js +1 -1
- package/chunks/OperatorCut.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/OperatorIntersects.js +1 -1
- package/chunks/OperatorMultiPartToSinglePart.js +1 -1
- package/chunks/OperatorOverlaps.js +1 -1
- package/chunks/OperatorProject.js +1 -1
- package/chunks/OperatorProximity.js +1 -1
- package/chunks/OperatorProximityGeodesic.js +1 -1
- package/chunks/OperatorShapePreservingLength.js +1 -1
- package/chunks/OperatorShapePreservingProject.js +1 -1
- package/chunks/OperatorSimplifyOGC.js +1 -1
- package/chunks/OperatorTouches.js +1 -1
- package/chunks/OperatorWithin.js +1 -1
- package/chunks/Point2D.js +1 -1
- package/chunks/ProjectionTransformation.js +1 -1
- package/chunks/SideCalculator2D-BNwb5gvz.js +1 -1
- package/chunks/SpatialReference.js +1 -1
- package/chunks/boundedPlane.js +1 -1
- package/chunks/containsOperator.js +1 -1
- package/chunks/disjointOperator.js +1 -1
- package/chunks/equalsOperator.js +1 -1
- package/chunks/pe.js +1 -1
- package/chunks/relateOperator.js +1 -1
- package/config.js +1 -1
- package/core/units.js +1 -1
- package/core/workers/workerFactory.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/createTemplateExecutor.js +1 -1
- package/geometry/FlatGeometry.js +1 -1
- package/geometry/GeometryCursor.js +1 -1
- package/geometry/operators/containsOperator.js +1 -1
- package/geometry/operators/disjointOperator.js +1 -1
- package/geometry/operators/gx/geodeticUtils.js +1 -1
- package/geometry/operators/gx/operatorAutoComplete.js +1 -1
- package/geometry/operators/gx/operatorBuffer.js +1 -1
- package/geometry/operators/gx/operatorDifference.js +1 -1
- package/geometry/operators/gx/operatorGeodesicBuffer.js +1 -1
- package/geometry/operators/gx/operatorGeodeticArea.js +1 -1
- package/geometry/operators/gx/operatorGeodeticDensify.js +1 -1
- package/geometry/operators/gx/operatorGeodeticDistance.js +1 -1
- package/geometry/operators/gx/operatorGeodeticLength.js +1 -1
- package/geometry/operators/gx/operatorGraphicBuffer.js +1 -1
- package/geometry/operators/gx/operatorIntegrate.js +1 -1
- package/geometry/operators/gx/operatorIntersection.js +1 -1
- package/geometry/operators/gx/operatorLabelPoint.js +1 -1
- package/geometry/operators/gx/operatorLinesToPolygons.js +1 -1
- package/geometry/operators/gx/operatorPolygonOverlay.js +1 -1
- package/geometry/operators/gx/operatorProject.js +1 -1
- package/geometry/operators/gx/operatorProximityGeodesic.js +1 -1
- package/geometry/operators/gx/operatorShapePreservingProject.js +1 -1
- package/geometry/operators/gx/operatorSimplify.js +1 -1
- package/geometry/operators/gx/operatorSinglePartToMultiPart.js +1 -1
- package/geometry/operators/gx/operatorSymmetricDifference.js +1 -1
- package/geometry/operators/gx/operatorUnion.js +1 -1
- package/geometry/operators/json/containsOperator.js +1 -1
- package/geometry/operators/json/disjointOperator.js +1 -1
- package/geometry/operators/json/projectOperator.js +1 -1
- package/geometry/operators/projectOperator.js +1 -1
- package/geometry/operators/reshapeOperator.js +1 -1
- package/geometry/operators/support/geographicTransformationUtils.js +1 -1
- package/geometry/operators/support/initNoPeFactory.js +1 -1
- package/geometry/operators/support/jsonConverter.js +1 -1
- package/geometry/operators/support/projectionTransformation.js +1 -1
- package/geometry/operators/support/projectionZScaling.js +5 -0
- package/geometry/projection/projectPointToVector.js +1 -1
- package/geometry/projectionUtils.js +1 -1
- package/geometry/support/boundedPlane.js +1 -1
- package/geometry/support/jsonTypeUtils.js +5 -0
- package/geometry/support/jsonUtils.js +1 -1
- package/geometry/support/normalizeUtilsCommon.js +1 -1
- package/geometry/support/normalizeUtilsSync.js +1 -1
- package/geometry/support/quantizationUtils.js +1 -1
- package/geometry/support/zscale.js +1 -1
- package/interfaces.d.ts +84 -17
- package/kernel.js +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/layers/graphics/data/QueryEngine.js +1 -1
- package/layers/graphics/data/queryUtils.js +1 -1
- package/layers/graphics/data/spatialQuerySupport.js +1 -1
- package/layers/graphics/featureConversionUtils.js +1 -1
- package/layers/graphics/sources/geojson/GeoJSONSourceWorker.js +1 -1
- package/layers/graphics/sources/support/MemorySourceWorker.js +1 -1
- package/layers/graphics/sources/support/uploadAssets.js +1 -1
- package/layers/mixins/ArcGISMapService.js +1 -1
- package/layers/orientedImagery/core/coverageUtils.js +1 -1
- package/layers/orientedImagery/transformations/updateElevationUtils.js +1 -1
- package/layers/orientedImagery/transformations/utils.js +1 -1
- package/layers/support/ControlPointsGeoreference.js +1 -1
- package/layers/support/Sublayer.js +1 -1
- package/package.json +4 -4
- package/renderers/support/DictionaryLoader.js +1 -1
- package/renderers/support/pointCloud/PointSizeFixedSizeAlgorithm.js +1 -1
- package/renderers/support/pointCloud/PointSizeSplatAlgorithm.js +1 -1
- package/rest/geometryService/cut.js +1 -1
- package/rest/geometryService/difference.js +1 -1
- package/rest/geometryService/intersect.js +1 -1
- package/rest/geometryService/project.js +1 -1
- package/rest/geometryService/reshape.js +1 -1
- package/rest/geometryService/simplify.js +1 -1
- package/rest/geometryService/utils.js +1 -1
- package/rest/knowledgeGraph/DataModel.js +1 -1
- package/rest/operations/generalize.js +1 -1
- package/rest/operations/identify.js +1 -1
- package/rest/operations/offset.js +1 -1
- package/rest/operations/relation.js +1 -1
- package/rest/query/operations/queryAttributeBins.js +1 -1
- package/rest/query/operations/queryTopFeatures.js +1 -1
- package/rest/query/operations/queryUtils.js +1 -1
- package/rest/support/BaseImageMeasureResultValue.js +1 -1
- package/rest/support/BufferParameters.js +1 -1
- package/rest/support/DensifyParameters.js +1 -1
- package/rest/support/DistanceParameters.js +1 -1
- package/rest/support/FeatureSet.js +1 -1
- package/rest/support/IdentifyParameters.js +1 -1
- package/rest/support/ImageAreaParameters.js +1 -1
- package/rest/support/ImageDistanceParameters.js +1 -1
- package/rest/support/ImageGPSInfoParameters.js +1 -1
- package/rest/support/ImageHeightParameters.js +1 -1
- package/rest/support/ImageHistogramParameters.js +1 -1
- package/rest/support/ImageIdentifyParameters.js +1 -1
- package/rest/support/ImageMeasureResultAngleValue.js +1 -1
- package/rest/support/ImageMeasureResultAreaValue.js +1 -1
- package/rest/support/ImageMeasureResultLengthValue.js +1 -1
- package/rest/support/ImagePointParameters.js +1 -1
- package/rest/support/ImageSampleParameters.js +1 -1
- package/rest/support/ImageToMapMultirayParameters.js +1 -1
- package/rest/support/ImageToMapParameters.js +1 -1
- package/rest/support/ImageVolumeParameters.js +1 -1
- package/rest/support/MapToImageParameters.js +1 -1
- package/rest/support/MeasureFromImageParameters.js +1 -1
- package/rest/support/ProjectParameters.js +1 -1
- package/support/modeUtils.js +1 -1
- package/support/revision.js +1 -1
- package/support/tests/serviceMockDependencies.js +1 -1
- package/symbols/MarkerSymbol.js +1 -1
- package/symbols/PictureMarkerSymbol.js +1 -1
- package/symbols/SimpleFillSymbol.js +1 -1
- package/symbols/SimpleMarkerSymbol.js +1 -1
- package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
- package/symbols/cim/CIMSymbolRasterizer.js +1 -1
- package/symbols/cim/SDFHelper.js +1 -1
- package/symbols/cim/effects/EffectOffset.js +1 -1
- package/symbols/cim/effects/EffectTaperedPolygon.js +1 -1
- package/symbols/support/ObjectSymbol3DLayerResource.js +1 -1
- package/views/2d/analysis/ElevationProfile/ElevationProfileVisualization2D.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/createTestMeshData.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/interactive/editingTools/TransformTool.js +1 -1
- package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/2d/layers/features/support/GraphicsReader.js +1 -1
- package/views/2d/layers/graphics/GraphicStoreItem.js +1 -1
- package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementPathHelper.js +1 -1
- package/views/3d/analysis/ShadowCast/analysisViewRegister.js +5 -0
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/Slice/SliceController.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementTool.js +1 -1
- package/views/3d/analysis/support/projectionUtils.js +1 -1
- package/views/3d/interactive/editingTools/media/MediaElementControllerShape.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/ExtentRotate.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
- package/views/3d/layers/DynamicLayerView3D.js +1 -1
- package/views/3d/layers/FeatureLikeLayerView3D.js +1 -1
- package/views/3d/layers/GraphicsLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/RouteLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/GraphicsDeconflictor.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/support/featureReference.js +1 -1
- package/views/3d/state/ScreenSizePerspective.js +1 -1
- package/views/3d/support/ViewSlice.js +1 -1
- package/views/3d/support/cameraUtils.js +1 -1
- package/views/3d/support/viewpointUtils.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowPresets.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/glow/GlowRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/SliceHelper.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/Attribution.js +1 -1
- package/views/DOMContainer.js +1 -1
- package/views/PopupView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/VideoView.js +1 -1
- package/views/View.js +1 -1
- package/views/View2D.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileLineGroundComputation.js +1 -1
- package/views/draw/DrawAction.js +1 -1
- package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/tileUtils.js +1 -1
- package/views/layers/CatalogFootprintLayerView.js +1 -1
- package/views/layers/LayerView.js +1 -1
- package/views/support/attributionUtils.js +1 -1
- package/views/support/projectionUtils.js +1 -1
- package/widgets/Feature/FeatureUtilityNetworkAssociationList.js +1 -1
- package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/FeatureFormUtilityNetworkAssociationList.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/sketch/TriangulatedMeasurementAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/view/MapViewAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageViewer.js +1 -1
- package/widgets/OrientedImageryViewer/components/ImageViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/galleryUtils.js +1 -1
- package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
- package/widgets/OrientedImageryViewer/services/ImageMeasurementService.js +1 -1
- package/widgets/OrientedImageryViewer/support/NonPanoramicMedia.js +5 -0
- package/widgets/OrientedImageryViewer/support/NonPanoramicMediaCollection.js +5 -0
- package/widgets/OrientedImageryViewer/support/urlUtils.js +5 -0
- package/widgets/OrientedImageryViewer/utils.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer/support/PanoramicMedia.js +1 -1
- package/widgets/PanoramicViewer/utils.js +1 -1
- package/widgets/PanoramicViewer.js +1 -1
- package/widgets/Slice.js +1 -1
- package/widgets/Swipe/SwipeViewModel.js +1 -1
- package/widgets/TimeSlider.js +1 -1
- package/widgets/Track.js +1 -1
- package/widgets/UtilityNetworkAssociations.js +1 -1
- package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
- package/widgets/UtilityNetworkValidateTopology/UtilityNetworkValidateTopologyViewModel.js +1 -1
- package/widgets/Weather.js +1 -1
- package/widgets/support/GridControls.js +1 -1
- package/widgets/support/SnappingControls.js +1 -1
- package/widgets/support/UtilityNetworkAssociations/UtilityNetworkAssociationList.js +1 -1
- package/assets/esri/core/workers/chunks/00ff4ca88c9d291d82c3.js +0 -1
- package/assets/esri/core/workers/chunks/0271a2ca4e9b1e4fd284.js +0 -1
- package/assets/esri/core/workers/chunks/02a65563779b4c64b2cf.js +0 -1
- package/assets/esri/core/workers/chunks/02d1c48e874dfd985bc4.js +0 -1
- package/assets/esri/core/workers/chunks/05b7720ab6bf0874f27c.js +0 -1
- package/assets/esri/core/workers/chunks/061def9163a09c804b5c.js +0 -1
- package/assets/esri/core/workers/chunks/06221ebadab32111e2c6.js +0 -1
- package/assets/esri/core/workers/chunks/063045ac5553e91c0c4c.js +0 -1
- package/assets/esri/core/workers/chunks/06d52a570d5d44f8c86e.js +0 -1
- package/assets/esri/core/workers/chunks/0a58b57e1777a8b0ea23.js +0 -1
- package/assets/esri/core/workers/chunks/0e4d0213d568f50c231f.js +0 -1
- package/assets/esri/core/workers/chunks/103153951ba312dc5e9e.js +0 -1
- package/assets/esri/core/workers/chunks/169be08394c5e7703628.js +0 -1
- package/assets/esri/core/workers/chunks/1a6f3531ef3d671e0289.js +0 -1
- package/assets/esri/core/workers/chunks/1c816aff8613d1e4bf38.js +0 -1
- package/assets/esri/core/workers/chunks/1e2d42e9984ed3437ba2.js +0 -1
- package/assets/esri/core/workers/chunks/2008b22f76071a2dde4e.js +0 -1
- package/assets/esri/core/workers/chunks/20e4243ea563d05a5256.js +0 -1
- package/assets/esri/core/workers/chunks/2107c93d1fe87f3b8dfa.js +0 -1
- package/assets/esri/core/workers/chunks/21f37a4b8d1857369203.js +0 -1
- package/assets/esri/core/workers/chunks/229e1ed4282005aa0b83.js +0 -1
- package/assets/esri/core/workers/chunks/22b8eaa6afab0e5ffc47.js +0 -1
- package/assets/esri/core/workers/chunks/231c0b583fa97f2ca675.js +0 -1
- package/assets/esri/core/workers/chunks/233f9eb617f3d72995b5.js +0 -1
- package/assets/esri/core/workers/chunks/2463cebf904a3c46c639.js +0 -1
- package/assets/esri/core/workers/chunks/249504f7d356be80d214.js +0 -1
- package/assets/esri/core/workers/chunks/2550d2ba935cfdf30236.js +0 -1
- package/assets/esri/core/workers/chunks/273ac1066095d63d6a6f.js +0 -1
- package/assets/esri/core/workers/chunks/28db329528def851efd7.js +0 -1
- package/assets/esri/core/workers/chunks/2de32649f8b0c6404d7c.js +0 -1
- package/assets/esri/core/workers/chunks/2e2867bc66c94aba7dc7.js +0 -1
- package/assets/esri/core/workers/chunks/30c4af16e3a2acc25589.js +0 -1
- package/assets/esri/core/workers/chunks/32d32d3c3b38a215d20d.js +0 -1
- package/assets/esri/core/workers/chunks/3386d4392f465b807b94.js +0 -1
- package/assets/esri/core/workers/chunks/34613b288cf174983f8b.js +0 -1
- package/assets/esri/core/workers/chunks/35f086a2ae0585348ae6.js +0 -1
- package/assets/esri/core/workers/chunks/37ea150dec5e491f691e.js +0 -1
- package/assets/esri/core/workers/chunks/3ac8de121a07c70bae0f.js +0 -1
- package/assets/esri/core/workers/chunks/3c94db7ecdcd38eeb1b1.js +0 -1
- package/assets/esri/core/workers/chunks/3f7749f06ae54a4437d9.js +0 -1
- package/assets/esri/core/workers/chunks/40a722933af28823953b.js +0 -1
- package/assets/esri/core/workers/chunks/444026d1938c1078ca97.js +0 -1
- package/assets/esri/core/workers/chunks/44f759d723ae05bb1b19.js +0 -1
- package/assets/esri/core/workers/chunks/456684b1c1417ed0e611.js +0 -1
- package/assets/esri/core/workers/chunks/48e2737182c75005fb8f.js +0 -1
- package/assets/esri/core/workers/chunks/48f805929fe6241952f5.js +0 -1
- package/assets/esri/core/workers/chunks/4a48b8ec5f3f2fd139b5.js +0 -1
- package/assets/esri/core/workers/chunks/4b084f985bc4100e7aec.js +0 -1
- package/assets/esri/core/workers/chunks/4b1de1fcd13677b615a8.js +0 -1
- package/assets/esri/core/workers/chunks/4d933de84afb2e3b7d18.js +0 -1
- package/assets/esri/core/workers/chunks/4f0de45a0a295d66d446.js +0 -1
- package/assets/esri/core/workers/chunks/4ff771942531fb2755c4.js +0 -1
- package/assets/esri/core/workers/chunks/513a4ef960e27500f986.js +0 -1
- package/assets/esri/core/workers/chunks/56b693baa376bb990925.js +0 -1
- package/assets/esri/core/workers/chunks/57fd5e1260269002d18a.js +0 -1
- package/assets/esri/core/workers/chunks/5b73c77587772120b209.js +0 -1
- package/assets/esri/core/workers/chunks/5fe40bb0e9ab333f6854.js +0 -1
- package/assets/esri/core/workers/chunks/61373d2fa7e7638d3395.js +0 -1
- package/assets/esri/core/workers/chunks/6202922b1c2637e9aaa5.js +0 -1
- package/assets/esri/core/workers/chunks/633368ae6fbb46373328.js +0 -1
- package/assets/esri/core/workers/chunks/6d0fe4db6b94f3d2c53a.js +0 -1
- package/assets/esri/core/workers/chunks/6d702cb26cef46a76963.js +0 -1
- package/assets/esri/core/workers/chunks/6e8925412fb90f88d688.js +0 -1
- package/assets/esri/core/workers/chunks/6e8c20ff1d28ef2fe72c.js +0 -1
- package/assets/esri/core/workers/chunks/708aba69a1870ea41a61.js +0 -1
- package/assets/esri/core/workers/chunks/74b1028e95f7cfff387b.js +0 -1
- package/assets/esri/core/workers/chunks/755ce019c97f5d527772.js +0 -1
- package/assets/esri/core/workers/chunks/780f60210878a8286633.js +0 -1
- package/assets/esri/core/workers/chunks/78fccea3445fb2f9120a.js +0 -1
- package/assets/esri/core/workers/chunks/7d3c2a063598bdd015e2.js +0 -1
- package/assets/esri/core/workers/chunks/7eab0bb42f9f062522ef.js +0 -1
- package/assets/esri/core/workers/chunks/804958f3f4ff47a4eff5.js +0 -1
- package/assets/esri/core/workers/chunks/82ba4140e30f083fbc87.js +0 -1
- package/assets/esri/core/workers/chunks/833fd2bc42c5cb459084.js +0 -1
- package/assets/esri/core/workers/chunks/83c8e5a92d8d6193cb32.js +0 -1
- package/assets/esri/core/workers/chunks/83da9ee6544ee9d3c124.js +0 -1
- package/assets/esri/core/workers/chunks/870022661376442411e4.js +0 -1
- package/assets/esri/core/workers/chunks/897ce6fc9cefb1e14a64.js +0 -1
- package/assets/esri/core/workers/chunks/898ab7db220e81e921c6.js +0 -1
- package/assets/esri/core/workers/chunks/8b75861196d1ce5cba63.js +0 -1
- package/assets/esri/core/workers/chunks/8c07396e9ea3007d6404.js +0 -1
- package/assets/esri/core/workers/chunks/8e26831f71634288f834.js +0 -1
- package/assets/esri/core/workers/chunks/8ec238b5b59ef18a1713.js +0 -1
- package/assets/esri/core/workers/chunks/90b8ccee883738917a6d.js +0 -1
- package/assets/esri/core/workers/chunks/90bc9c299ae0e8b8b5e5.js +0 -1
- package/assets/esri/core/workers/chunks/9100330ed4b4437c819d.js +0 -1
- package/assets/esri/core/workers/chunks/933dce4d4ff8b90219c8.js +0 -1
- package/assets/esri/core/workers/chunks/934bc1028b287f8df4aa.js +0 -1
- package/assets/esri/core/workers/chunks/94dc8b0fa129f1e168c4.js +0 -1
- package/assets/esri/core/workers/chunks/96055de47831e59a28bf.js +0 -1
- package/assets/esri/core/workers/chunks/963ba863e0f87abfca25.js +0 -1
- package/assets/esri/core/workers/chunks/987e19af8a525e77883f.js +0 -1
- package/assets/esri/core/workers/chunks/992e9bbdf9d3787ddb0e.js +0 -1
- package/assets/esri/core/workers/chunks/9aa8d60483ad905fe13b.js +0 -1
- package/assets/esri/core/workers/chunks/9c0efd06c9000ccbd62d.js +0 -1
- package/assets/esri/core/workers/chunks/9f1d3c0b53bef07e39bf.js +0 -1
- package/assets/esri/core/workers/chunks/9fed9946241bb2a5cfa4.js +0 -1
- package/assets/esri/core/workers/chunks/a2662e98857f0abf8e82.js +0 -1
- package/assets/esri/core/workers/chunks/a59dab47a58695c639da.js +0 -1
- package/assets/esri/core/workers/chunks/a5a9b0a35849b9f2e86d.js +0 -1
- package/assets/esri/core/workers/chunks/a60006c9ccf6817fc0d2.js +0 -1
- package/assets/esri/core/workers/chunks/a627b7eb94b7fca33210.js +0 -1
- package/assets/esri/core/workers/chunks/a651dc3b8f1fc1ab34cc.js +0 -1
- package/assets/esri/core/workers/chunks/a96742e678a506c461ab.js +0 -1
- package/assets/esri/core/workers/chunks/af663e81c851bcf142f1.js +0 -1
- package/assets/esri/core/workers/chunks/af8d6e6949930d0e6c7b.js +0 -1
- package/assets/esri/core/workers/chunks/b59be95949445ff5afab.js +0 -1
- package/assets/esri/core/workers/chunks/b6dec5dfdeca54bae88d.js +0 -1
- package/assets/esri/core/workers/chunks/b88dc7d8ae105747e6a4.js +0 -1
- package/assets/esri/core/workers/chunks/b90c786dd474ea1a409c.js +0 -1
- package/assets/esri/core/workers/chunks/b92e9e5df8154a128982.js +0 -1
- package/assets/esri/core/workers/chunks/bbdfa8ffcf084cbd9938.js +0 -1
- package/assets/esri/core/workers/chunks/bff814d34b38ec80c44d.js +0 -1
- package/assets/esri/core/workers/chunks/c36d699a75b6e8fb93eb.js +0 -1
- package/assets/esri/core/workers/chunks/c50fdf723f2d4316862e.js +0 -1
- package/assets/esri/core/workers/chunks/c5e8ff4721b15ac3c6eb.js +0 -1
- package/assets/esri/core/workers/chunks/ca61077e0a598654f33f.js +0 -1
- package/assets/esri/core/workers/chunks/ca81be5bdb88ef557bf3.js +0 -1
- package/assets/esri/core/workers/chunks/ced12ad98f8f48d0dc00.js +0 -1
- package/assets/esri/core/workers/chunks/d0320ca67abca4f8b0d2.js +0 -1
- package/assets/esri/core/workers/chunks/d561624ddb9388732b25.js +0 -1
- package/assets/esri/core/workers/chunks/d5fd6d0eaf96edfab123.js +0 -1
- package/assets/esri/core/workers/chunks/d705410c369bd03b1875.js +0 -1
- package/assets/esri/core/workers/chunks/d82e17522ed946c2d809.js +0 -1
- package/assets/esri/core/workers/chunks/dc29cb16704e2e4d0a46.js +0 -1
- package/assets/esri/core/workers/chunks/dc5075b2326c79130baa.js +0 -1
- package/assets/esri/core/workers/chunks/dd105d6e0fcedee32644.js +0 -1
- package/assets/esri/core/workers/chunks/defc6b50df5018bd9e86.js +0 -1
- package/assets/esri/core/workers/chunks/e1148067ceae7d9eaaf8.js +0 -1
- package/assets/esri/core/workers/chunks/e5a6a646f27715152714.js +0 -1
- package/assets/esri/core/workers/chunks/e8c2e2fbe9cef4c8a8c6.js +0 -1
- package/assets/esri/core/workers/chunks/efc293c8bbc12156096d.js +0 -1
- package/assets/esri/core/workers/chunks/f693a4d97b2762d0e6ff.js +0 -1
- package/assets/esri/core/workers/chunks/f7f53567b0c5b35d6aea.js +0 -1
- package/assets/esri/core/workers/chunks/f92a78ce5510e0d0d0f7.js +0 -1
- package/assets/esri/core/workers/chunks/fb76b43181077c55a207.js +0 -1
- package/assets/esri/core/workers/chunks/fc61443546f21869f8ba.js +0 -1
- package/assets/esri/core/workers/chunks/fdaa10a588db394e2f65.js +0 -1
- package/chunks/UnitFactory.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/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 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 w}from"../../core/promiseUtils.js";import f 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/units.js";import{property as S,subclass as k}from"../../core/accessorSupport/decorators.js";import{isSerializable as C}from"../../core/support/jsonUtils.js";import{UpdatingHandles as A}from"../../core/support/UpdatingHandles.js";import L from"../../geometry/Extent.js";import G from"../../geometry/Multipoint.js";import R from"../../geometry/Point.js";import O from"../../geometry/Polygon.js";import T from"../../geometry/Polyline.js";import{projectWithZConversion as j}from"../../geometry/projectionUtils.js";import B from"../../geometry/SpatialReference.js";import{polygonCentroidPoint as x}from"../../geometry/support/centroid.js";import{isClockwise as H}from"../../geometry/support/coordsUtils.js";import{normalizeMapX as E}from"../../geometry/support/normalizeUtils.js";import{geographicToWebMercator as D}from"../../geometry/support/webMercatorUtils.js";import z 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{getMetersPerUnitOfSR as X,convertGeographicToWebMercator as Y}from"../../layers/orientedImagery/core/utils.js";import{imageToWorld as ee,imageToWorldPanoramic as te}from"../../layers/orientedImagery/transformations/imageToWorld.js";import ae from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as ie}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{or as re,getInitialAngle as se,convertPixelToHeadingPitch as oe,convertHeadingPitchToSphereVertex as ne,getImageToWorldProperties as ce,getUpdateElevationProps 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 we from"../../layers/support/VideoElement.js";import fe 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"../PanoramicVideoViewer.js";import Ie from"../PanoramicViewer.js";import{defaultAngleThresholdInDegrees as Pe,videoExtent as Ve,invalidCameraHeading as Se,sectorsInOrder as ke,sampleExtent as Ce,sectorsRadii as Ae}from"./constants.js";import{configureSketchTool as Le,extractFieldsFromDataCaptureLayer as Ge,isValidDataCaptureLayer as Re,constructGraphicFromImageGeometry as Oe}from"./dataCaptureUtils.js";import{isFeatureAttachment as Te,getImageSourceFromAttachment as je}from"./galleryUtils.js";import{getModeCorrectedPoint as Be,calculateCorrectedPixel as xe,getUnitRateFromSpatialReference as He,calculateHeightFromTemporaryDistance as Ee,getModeCorrectedPoints as De,computeTriangulatedVector as ze,computeTriangulatedPoint as Ue}from"./imageMeasurementUtils.js";import{crossSymbol as Ne,crossSymbol3D as We,measurementPolygonSymbol as qe,polylineSymbolPanoramic as $e,measurementPolylineSymbol as Je,cameraOverlaySymbol3D as Ze,cameraOverlaySymbol as Ke,diamondSymbol as Qe,diamondSymbol3D as Xe,locationSymbol as Ye,locationSymbol3D as et,activeSourcePointSymbol as tt,sourcePointSymbol as at}from"./symbols.js";import{isNoAttachmentError as it,getContentType as rt,isTifOrMrf as st,filterOILLayerView as ot,assignElevationSampleToFeatures as nt,calculateDirection as ct,calculateSegment as lt,isSceneView as ht,isGraphic as ut}from"./utils.js";import{disableVideoZoomAndPan as dt}from"./videoViewerUtils.js";import mt from"./components/ImageViewer.js";import pt from"./components/NavigationNode.js";import gt from"./components/OrientedImageryVideoViewModel.js";import{NoActiveViewerError as yt,NoFeatureFoundWithObjectIdError as vt}from"./navigation/errors.js";import{queryFeatureByObjectIds as wt}from"./navigation/queries.js";import{ImageMeasurementService as ft}from"./services/ImageMeasurementService.js";import Ft from"../Sketch/SketchViewModel.js";const _t={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"},bt=new Set(["JPG","JPEG","TIFF","TIF","MRF"]),Mt=new Set(["MRF","TIFF","TIF"]),It=/\.(\w+)$/,Pt=()=>new n("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first");let Vt=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=Pe,this.cameraPitchThreshold=Pe,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.depthImage=null,this.directionMode="Relative",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._loadDepthImage(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 mt,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 f,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,a)=>{"default"===this.mode&&"image-loaded"!==this.state||this.mode.includes("video")&&!this.videoElement?.content||await(this._adapter?.updateFootprint(e,t,a))},this.updateFootprintPanorama=async(e,t)=>{await(this._adapter?.updateFootprintPanorama(e,t))},this.updatingTriangularMeasurementState=!1,this.videoElement=null,this.videoLayer=null,this.videoMapView=new fe({map:new Map}),this._adapter=null,this._highlightedFeatureHandle=null,this._imageViewer=new mt,this._initialCurrentCoverageUpdate=!0,this._locationPointOnImage=null,this._measurementService=null,this._correctedLocationPointOnImage=null,this._overlays=new z({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"},title:"OrentedImageryViewerViewModel overlays layer"}),this._panoramicVideoViewer=new Me,this._panoramicViewer=new Ie,this._panoramicMeasurementViewer=new Ie,this._referencePointOnGround=null,this._referencePointOnImage=null,this._sectorData=null,this._featureToSector=null,this._updatingHandles=new A,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.filterCapturedFeatures=e=>{const t=this.currentBestFeature?.attributes.objectId,a=this.layer?.imageReferenceField;if(!t||!e||!a)return;const i=this.overlayedMapFeatures.get(e);i?.forEach(e=>{const i=e.attributes??{},r=Object.keys(i).find(e=>e.toLowerCase()===a.toLowerCase());(r?i[r]:null)!==t&&(e.visible=!e.visible)})},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.loadPanoramicVideoViewer=e=>{this._panoramicVideoViewer?.destroy(),this._panoramicVideoViewer=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 ee(e,r,i);return pe(n,o)},this.imageToImageTransformPanoramic=async(e,t,a)=>{const{updateElevationProps:i,...r}=t,{updateElevationProps:s,...o}=a,n=await te(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 yt;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(_t.click),this.disabled||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),_t.click)},this._createImageClickHandle=()=>{this.removeHandles(_t.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 re(!t,e.spatialReference.equals(t))?e:j(e,t)});v(a),this.plotReferencePointOnGround(r)})});this.addHandles([u,c],_t.imageClick)},this._createTriangularImageClickHandle=()=>{this.removeHandles(_t.triangularImageClick),this.triangularMeasurementActive&&"none"!==this.mode&&this.currentBestFeature&&this.currentBestFeatureMeasurementImage&&this.activeTriangulatedViewer&&this.addHandles(this.activeTriangulatedViewer.imageRenderer.on("double-click",this._measurementImageClickHandler),_t.triangularImageClick)},this._createTriangularImageLocationHandle=()=>{this.removeHandles(_t.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.view?.spatialReference;s&&!r.spatialReference.equals(s)&&(r=await j(r,s),v(a)),await this._calculateTriangulatedPointFromGroundPoint(r,{signal:a}),v(a)}))});this.addHandles(o,_t.triangularImageClick)},this._createImageLocationHandle=()=>{this.removeHandles(_t.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");re(!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 j(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,_t.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._loadDepthImage=async e=>{const{currentBestFeature:t,layer:a,depthImageNotSupported:i}=this;if(this.depthImage?.destroy(),this.depthImage=null,!a||!t||i)return;const{depthImage:r}=t.attributes;if(!r)return;const s=(await import("./services/DepthImageService.js")).default;v(e),this.depthImage=new s({url:r});try{await this.depthImage.load(e)}catch(o){y(o)||(u.getLogger(this).error("error occurred while loading depth image",o),this.depthImage?.destroy(),this.depthImage=null)}},this._loadImage=async e=>{const{currentBestFeature:t,layer:a,mode:i}=this;if(this.clearGraphics(),!a||!t||"none"===i||"video"===i||"panoramic-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?D(m):new R(m);let w=s;if(Te(s))try{w=await je(a,h,e)}catch(f){if(y(f))return;return it(f)?(u.getLogger(this).error(f),void this.setMessage("noAttachment","error",`${a.objectIdField}: ${h}`)):(u.getLogger(this).error(f,{[a.objectIdField]:h,layer:a}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${a.objectIdField} ${h}`))}try{await this.loadImageFromSource(w,{imageRotation:p,options:e,pitch:l,yaw:n,mode:i,cameraLocation:g}),v(e),await this.transformAndPlotSelectedLocation(e)}catch(f){y(f)||this.loadImageError(f)}},this._loadVideo=async e=>{const{currentBestFeature:t,layer:a,mode:i,selectedPoint:r}=this,s=t?.attributes.imagePath;if(!a||!t||"panoramic-video"!==i||!s)return;const{attributes:o}=t,{cameraHeading:n,cameraPitch:c,cameraOrientation:l,location:h}=o,u=h.spatialReference.isWGS84&&4!==l?.type?D(h):new R(h);try{this._panoramicVideoViewer.viewModel.video&&this._panoramicVideoViewer.viewModel.video.pause(),this._panoramicVideoViewer.videoSource=s;let t=n??0;u&&r&&(t=await se(u,r)-t),this._panoramicVideoViewer.pitch=c??0,this._panoramicVideoViewer.yaw=t,await this._panoramicVideoViewer.loadVideo(e),v(e)}catch(d){y(d)||this.loadImageError(d)}},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(It)?.[1]:e.datasetFormat;if(!l)try{l=await rt(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(bt.has(l.toUpperCase())){const{selectedPoint:e}=this,{pitch:a,yaw:i,cameraLocation:s,viewAngle:n}=t,c=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer;let h=i??0;"number"==typeof n?h=n-h:s&&e&&(h=await se(s,e)-h),c.imageSource=o,c.pitch=a??0,c.yaw=h,Mt.has(l.toUpperCase())?await c.loadImageTiled(o,r):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||"panoramic-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?D(m):new R(m);let w=s;if(Te(s))try{w=await je(a,h,e)}catch(f){if(y(f))return;return it(f)?(u.getLogger(this).error(f),void this.setMessage("noAttachment","error",`${a.objectIdField}: ${h}`)):(u.getLogger(this).error(f,{[a.objectIdField]:h,layer:a}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${a.objectIdField} ${h}`))}try{await this.loadImageFromSource(w,{imageRotation:p,options:e,pitch:l,yaw:n,mode:i,cameraLocation:g}),v(e)}catch(f){y(f)||this.loadImageError(f)}},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=>{if(e.stopPropagation(),e.preventDefault(),e.mapPoint){const t=e.mapPoint;t.x=E(t.x,t.spatialReference),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 w(a),!e)return;const i=new R({...C(e)?e.toJSON():e});if("default"===this.mode)i.x-=.5,i.y=.5-i.y,i.spatialReference=this._imageViewer.imageRenderer.spatialReference.clone(),this._crossSymbol=new t({geometry:i,symbol:Ne}),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}=oe(e,i,r),n=ne(s,o);this._crossSymbol=new t({geometry:new R(n,B.WebMercator),symbol:We}),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.disabled],()=>{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(_t.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,void 0,{signal:t})}))},{...M,equals:(e,t)=>a(e,t,h)}),_t.interactionHandles);break;case"video":this.addHandles(b(()=>{const{footprintExtent:e,videoElement:t,bestFeatureFootprint:a}=this;if(e&&t?.loaded&&a)return{videoExtent:Ve,bestFeatureFootprint:a}},e=>{e?.videoExtent&&e?.bestFeatureFootprint&&(m(this._updateFootprintTask),this._updateFootprintTask=r(async t=>{await this.updateFootprint(e.videoExtent,void 0,{signal:t})}))},{...M,equals:(e,t)=>a(e?.videoExtent,t?.videoExtent,h)&&e?.bestFeatureFootprint===t?.bestFeatureFootprint}),_t.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)}),_t.interactionHandles);break;case"panoramic-video":this.addHandles(b(()=>{const{currentBestFeature:e,state:t,_panoramicVideoViewer:a}=this,{imageSize:i,vfov:r,hfov:s,pitch:o,yaw:n,viewModel:c}=a,l=c.closestFeature??e;return l&&i&&!t.includes("loading")&&null!=r&&null!=s&&null!=o&&null!=n?[r,s,n,o,l]:null},e=>{if(!e)return;const[t,a,i,s,o]=e;m(this._updateFootprintTask),this._updateFootprintTask=r(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:a,yaw:i,pitch:s,feature:o},{signal:e}),v(e),this._updateFootprintTask=null})},{equals:(e,t)=>a(e,t,h)}),_t.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(_t.hittestHandles),e&&this.addHandles(_(()=>e,"hittest-response",this._handleImageHitTestResponse),_t.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 depthImageNotSupported(){if(this.currentBestFeature?.attributes.depthImage)return!st(this.currentBestFeature.attributes.depthImage)}get featureCount(){return this.features?.length??0}get imageGalleryEnabled(){const{currentBestFeature:e}=this;if(!e)return!1;const t=e.attributes.imagePath?.trim();return st(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===Se}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(ot(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?ve(e):null}get mode(){const e=this.currentBestFeature?.attributes;if(!e)return"none";const t=e.orientedImageryType;if(t?.includes("video"))return t.includes("360")?"panoramic-video":"video";const{horizontalFieldOfView:a,isSpherical:i}=e;return 360===a||i?"panoramic":"default"}get panoramicVideoLoaded(){const{mode:e,_panoramicVideoViewer:t}=this,{videoLoaded:a}=t.viewModel;return("panoramic-video"===e&&!0===a)??!1}get popupEnabled(){return!0===this.layer?.popupEnabled}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){const{_sectorData:e}=this;return e?ke.map(t=>e[t]):null}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",d(e,0,1))}get sketchGraphicsLayer(){const{sketch:e}=this;return"graphics"===e?.layer?.type?e.layer:void 0}get state(){const{mode:e,_updatingHandles:{updating:t},_featureChangedTask:a}=this;if(!this.isFulfilled()||t||!1===a?.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 st(r)||Te(r)?{url:r,objectId:t,rotation:(a??0)+(i??0)}:null}).filter(i)):null}set view(e){this._set("view",e)}get _defaultGraphicsLayer(){const e={blendMode:"source-atop"};switch(this.mode){case"panoramic":return new z({...e,elevationInfo:{mode:"absolute-height"}});case"default":return new z({...e});default:return}}get _overlaysView(){return this.view?.layerViews.find(({layer:e})=>e===this._overlays)}beforeLoad(e=!0){this.view?.closePopup(),e&&(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=!1,i){return this._measurementService?.calculateAccuracyPanoramic(e,t,a,i)}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 Pt();Le(i,e,a),await a.create(e,{...t,defaultZ:0})}digitizeDelete(){if(!this.sketch)throw Pt();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw Pt();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw Pt();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw Pt();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw Pt();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw Pt();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/X(t.spatialReference),u.imageID=a,this.pointSources.push(u),c!==Se&&(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=ce(i,t.imageSize[0],t.imageSize[1]);let n=o.cameraLocation;return(n.spatialReference.isGeographic?j(n,B.WebMercator):Promise.resolve(n)).then(e=>(n=e,le(n.spatialReference,n.z??0,s,{elevationSample:a,elevationSource:r,extent:this.footprintExtent}))).then(t=>("elevationSample"in t&&(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?j(n,B.WebMercator):Promise.resolve(n)).then(e=>(n=e,le(n.spatialReference,n.z??0,s,{elevationSample:a,elevationSource:r,extent:this.footprintExtent}))).then(t=>("elevationSample"in t&&(e.elevationSample=t.elevationSample),{...o,cameraLocation:n,updateElevationProps:t}))}async deleteDataCaptureFeatures(e){const{dataCaptureLayer:t}=this;if(!t)throw new n("orientedimageryviewer:missing-featurelayer","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?.[ke[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=Be(e.vertices.at(-1),r,n);if(i.length<1||!c||!a||!t||"none"===r)return;const l=xe(i[0],c,t);if(!l?.length)return;this.heightMeasurementPixels.push(l),"panoramic"===r?this.createPolylineGraphicPano():this.createPolylineGraphic();const h=He(o.attributes.location.spatialReference),u=Ee(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=Be(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=Y(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._defaultGraphicsLayer,view:this.activeViewer?.imageRenderer,updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{edgeOperation:"none",shapeOperation:"none",vertexOperation:void 0},enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"transform"}})}return this.sketch}async loadMeasurementAdapter(e){if(!this.sketchAdapter){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),nt(r,n);const c=this._processSuitableFeatures(r,t);this.updateSuitabilities(c,a?.loadBestImage)}async processFeatureElevation(e,t,a){if(!t)return;const{features:i,polygons:r}=this.filterByFootprints(e,t,!0);if(!i?.length)return;const s=await this.processElevationSample(r,i,a);return v(a),s}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=qe(o),this.sketch.polylineSymbol="panoramic"===s?$e:Je(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 T({paths:[e],spatialReference:a});else{const i=new T({paths:[e],spatialReference:a}),r=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;this.heightGraphic=new t({geometry:i,symbol:Je(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}=oe(i,a[0],a[1]),{heading:n,pitch:c}=oe(r,a[0],a[1]),l=[[...ne(s,o)],[...ne(n,c)]];if(this.heightGraphic)this.heightGraphic.geometry=new T({paths:[l],spatialReference:e});else{const a=new T({paths:[l],spatialReference:e});this.heightGraphic=new t({geometry:a,symbol:$e}),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=De(e,i,r),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 j(a,o)),n.push(a)}return ze(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?Ze():Ke();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||"panoramic-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&&Re(e,d,m)&&`${s[m]}`==`${o.attributes.objectId}`)try{return Oe(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 R({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 R({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 T({paths:d,spatialReference:B.WebMercator}),visible:e.visible&&a})}case"multipoint":{const{points:i,spatialReference:c}=l,u=i.map(([e,t,a])=>new R({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 G({points:d,spatialReference:B.WebMercator}),visible:e.visible&&a})}}return null}))).filter(i));this.overlayGraphicsOnImage(`${e.id}`,p)}getDepthAt(e){const{activeViewer:t,currentBestFeature:a,mode:i,state:r,depthImage:s}=this,o=t?.imageSize;if(!o||!a||"none"===i||r.includes("loading"))return u.getLogger(this).warnOnce("oriented-imagery-viewer:get-depth-at","Load an image to use depth"),null;if(!s?.loaded)return u.getLogger(this).error("oriented-imagery-viewer:get-depth-at","Depth image is not loaded"),this.emit("depth-image-service:not-loaded"),null;const n=(Array.isArray(e)?e:[e]).map(e=>s.depthAt(e,{width:o[0],height:o[1]})??null);return Array.isArray(e)?n:n[0]}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 R({x:e.x-.5,y:.5-e.y,spatialReference:B.WebMercator});const[t,r]=a,{heading:s,pitch:o}=oe(e,t,r),n=ne(s,o);return new R(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 j(h,B.WebMercator));const u=await le(c.spatialReference,c.z??0,l,{elevationSample:s,elevationSource:n,extent:this.footprintExtent});let d;"elevationSample"in u&&(a.elevationSample=u.elevationSample);const m=Array.isArray(e)?e:[e];if(this.depthImage?.loaded)for(const p of m){const e=this.getDepthAt(p);null!=e&&(p.depth=e)}if("default"===i){const e=ce(o,r[0],r[1]);d=await ee(m,{...e,cameraLocation:h},u)}else{const e=he(o,r[0],r[1]);d=await te(m,{...e,cameraLocation:h},u)}return Array.isArray(e)?d:d[0]}getActiveSectors(){return ke.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 R({...e.toJSON()}),symbol:Qe}),this.view?this._overlays?.add(this._referencePointOnGround):this.emit("plot-ground-point",{data:{point:this._referencePointOnGround?.geometry}}))}plotReferencePointOnImage(e){if("image-loaded"===this.state)switch(this.clearReferencePointOnImage(),this.mode){case"default":{const a=C(e)?e.toJSON():e;a.x-=.5,a.y=.5-a.y,this._referencePointOnImage=new t({geometry:new R({spatialReference:this._imageViewer.imageRenderer.spatialReference,...a}),symbol:Qe}),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}=oe(e,i,r),n=ne(s,o);this._referencePointOnImage=new t({geometry:new R(n,B.WebMercator),symbol:Xe}),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))}reset(){const{mode:e}=this;"default"===e||"panoramic"===e?this.resetImage():"video"===e?this.resetVideo():"panoramic-video"===e&&this.resetVideoPanoramic(),this.beforeLoad(!1)}resetImage(){switch(this.setMessage("onLoadMessage","info"),this.mode){case"default":this._imageViewer.clearImage(),this._imageViewer.clearGraphics();break;case"panoramic":this._panoramicViewer.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}resetVideoPanoramic(){this.setMessage("onLoadMessage","info"),this._overlays?.removeAll(),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||"panoramic-video"===s)throw new n("orientedimageryviewer:missing-input","Image size, current best feature and mode are required to save data capture features");if(!r)throw new n("orientedimageryviewer:missing-featurelayer","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 T({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("orientedimageryviewer:save-unsucccessful","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.addGraphics(c),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()}async toggleAllOverlayMapFeatures(e){!e&&this.dataCaptureLayer&&(await this.stopDataCapture(!0),this.dataCaptureLayer=null),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 j(a,o.spatialReference);r=o.contains(e);break}case"mesh":{const e=a.spatialReference.equals(o.spatialReference)?a:await j(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=ze(e,a);if(!i)return;this.measurementVectors.push(i),await this.plotReferenceLocationPoint(e,t),v(t),this._createTriangularImageLocationHandle()}}async updateFeatureCache(e,t){const a=await W(e,t);a.features?.length&&(this.featureCache=a.features)}async _calculateTriangulatedPointFromGroundPoint(e,t){if(this.currentBestFeatureMeasurementImage&&e){const{currentBestFeatureMeasurementImage:a,view:i}=this,r=ze(e,a);r&&this.measurementVectors.push(r);let s=await Ue(this.measurementVectors);v(t),s?.spatialReference&&i?.spatialReference&&!s.spatialReference.equals(i.spatialReference)&&(s=await j(s,i.spatialReference)),this.triangulatedPoint=s??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 ke)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=lt(t,l),h=ct(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 w=""===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}`]=w;const f=this._sectorData[w];f.add({angle:i,featureIndex:s,x:u,y:d,objectID:p.attributes.objectId,sector:w,featureIndexInSector:f.length})})}_handleDestroyedTriangularSketchLayer(){this.sketchTriangularGraphicsLayer&&this.activeTriangulatedViewer&&(this.activeTriangulatedViewer.imageRenderer.map.layers.remove(this.sketchTriangularGraphicsLayer),this.sketchTriangularGraphicsLayer=new z,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 ft(this))}_initializeSketchTriangular(){if(!this.activeTriangulatedViewer)return;const e="panoramic"===this.mode;this.sketchTriangular=new Ft({view:this.activeTriangulatedViewer.imageRenderer,layer:this.sketchTriangularGraphicsLayer,updateOnGraphicClick:!1,defaultUpdateOptions:{toggleToolOnClick:!1,enableZ:!e}}),e&&(this.sketchTriangular.defaultUpdateOptions.reshapeOptions={edgeOperation:"offset",shapeOperation:"move-xy",vertexOperation:"move-xy"})}_initializeSketchTriangularGraphicsLayer(){this.activeTriangulatedViewer&&(this.sketchTriangularGraphicsLayer=new z,this.activeTriangulatedViewer.imageRenderer.map.layers.add(this.sketchTriangularGraphicsLayer))}_initializeVideo(){if(this.videoElement||!this.currentBestFeature)return;this.removeHandles(_t.videoPlayerHandles),this.videoElement=new we({video:this.currentBestFeature.attributes.imagePath,georeference:new ye({extent:new L(Ce)}),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(dt(this.videoMapView),_t.videoPlayerHandles),this.videoViewModel=new gt({oiViewModel:this})}_plotLocationPointOnDefaultImage(e,a=!1){const i=C(e)?e.toJSON():e;i.x-=.5,i.y=.5-i.y,a?(this._correctedLocationPointOnImage=new t({geometry:new R({spatialReference:B.WebMercator,...i}),symbol:Ye}),this.imageMeasurementViewer.addGraphic(this._correctedLocationPointOnImage,0)):(this._locationPointOnImage=new t({geometry:new R({spatialReference:B.WebMercator,...i}),symbol:Ye}),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}=oe(e,s,o),l=ne(n,c),h=new t({geometry:new R(l,B.WebMercator),symbol:et});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.videoElement?.content?.pause(),this.currentBestFeature=null,!1)}async _getElevationSampleFromGround(e,t,a){if(!e[0])return;const i=(await import("../../geometry/operators/unionOperator.js")).executeMany(e);if(this._updateFootprintWithFeatures(t,i),"3d"===this.view?.type)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 ie({extent:this.footprintExtent,lod:i.lod,url:i.url,rasterFunction:i.rasterFunction}):void 0)}_processSuitableFeatures(e,t){return q({features:e,selectedPoint:t,camera:ht(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 j(o,e.spatialReference),l=c.spatialReference.isGeographic?D(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 wt(e,t,a,i);if(v(i),!r?.features?.length)throw new vt(t);const s=$(r.features[0].attributes).polygon,o=R.fromJSON(x(s)),n=Y(o),c=V(n.spatialReference);this.selectedPoint=n;const l={layerInstanceOrURL:e,point:n,queryParams:{where:P(P("1=1",P(e.definitionExpression,a)),`${e.objectIdField} <> ${t}`),maximumDistance:e.maximumDistance?e.maximumDistance/c:void 0}},h=await N(l,i);v(i);const{features:u}=h;return u.push(r.features[0]),await this.processFeatureResponse(h,n,{...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(_t.activeViewerCursorHandles),t&&this.removeHandles(_t.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"),_t.activeViewerCursorHandles),t&&a&&this.addHandles(t.imageRenderer.acquireCursor("crosshair","high"),_t.activeViewerCursorHandles)}_toggleVisiblity(e,t){e.forEach(e=>{e.visible=t})}async _updateElevationOfSelectedPointAndLocations(e,t,a,i){const{location:r,cameraHeight:s}=e[0].attributes,o=await le(r.spatialReference,r.z,s,{elevationSample:a,elevationSource:a?void 0:e[0].attributes.elevationSource,extent:this.footprintExtent},i);v(i);const[n,...c]=await ae([t,...e.map(e=>e.attributes.geometry.clone())],o);v(i),t.elevation=n.z,e.forEach((e,t)=>{e.attributes.elevation=c[t].z})}_updateFeatures(e,t=!0){if(!e.length)return this.currentBestFeature=null,void this.additionalFeatures.removeAll();this.features.removeAll(),this.features.addMany(e),this.navigationNodes.removeAll(),this.navigationNodes.addMany(e.map(e=>{const{geometry:t,attributes:a}=e,{isSpherical:i,cameraHeading:r,cameraPitch:s}=a;return new pt({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])),"panoramic-video"===this.mode&&this._loadVideo()}_updateFootprintWithFeatures(e,t){const a=[];for(const{attributes:{geometry:i}}of e)t.contains(i)||a.push([i.x,i.y]);a.sort((e,t)=>+H([e,t])),t.addRing(a),this.footprintExtent=_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 o of a){const a=this.view&&!this.view.spatialReference?.equals(o.spatialReference)?await j(o.clone(),this.view?.spatialReference,e):o.clone();o.imageID===i.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:o.imageID},geometry:a,symbol:tt,visible:r}):this.additionalCameraLocations.push(new t({attributes:{imageID:o.imageID},geometry:a,symbol:at,visible:s}))}"video"!==o&&"panoramic-video"!==o||!n||this.featureCache.length||await this.updateFeatureCache(n,i.geometry.spatialReference)}}_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));if("panoramic-video"===this.mode)return void(this.currentBestFeature&&this._panoramicVideoViewer.viewModel.playPanoramicVideoFromSelectedLocation(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 le(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(ae(e,u));t(e)})));if(s.spatialReference.isGeographic&&(h=await j(h,B.WebMercator,a)),p=await Promise.all(p.map(async e=>h.spatialReference.equals(e.spatialReference)?e:await j(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;if(!r)return;const{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(ut);"3d"===c?.type&&d&&l?.updateGroundElevation&&(this._updateGroundElevation&&l.updateGroundElevation(e),"panoramic"===h&&l.updateGroundElevation([this.bestFeatureCurrentFootprint])),this._updateGroundElevation=!1,n&&(e.splice(-2,0,this.bestFeatureCurrentFootprint),e.push(new t({geometry:n.clone(),symbol:Ne.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,"3d"===c?.type&&d&&l?.updateGroundElevation&&"panoramic"===h&&l.updateGroundElevation([e]),e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}};e([S()],Vt.prototype,"activeLayer",null),e([S({readOnly:!0})],Vt.prototype,"activeViewer",null),e([S()],Vt.prototype,"activeTriangulatedViewer",null),e([S()],Vt.prototype,"accuracyParametersMissing",null),e([S()],Vt.prototype,"additionalFeatures",void 0),e([S({type:s.ofType(t)})],Vt.prototype,"additionalCameraLocations",void 0),e([S({type:s.ofType(t)})],Vt.prototype,"additionalFootprints",void 0),e([S()],Vt.prototype,"areaMeasurementResult",void 0),e([S()],Vt.prototype,"areaMeasurementAccuracy",void 0),e([S()],Vt.prototype,"bestFeatureAngle",void 0),e([S()],Vt.prototype,"bestFeatureCurrentFootprint",void 0),e([S({type:t})],Vt.prototype,"bestFeatureFootprint",void 0),e([S({type:Number})],Vt.prototype,"brightness",null),e([S()],Vt.prototype,"cameraHeadingThreshold",void 0),e([S()],Vt.prototype,"cameraPitchThreshold",void 0),e([S()],Vt.prototype,"clickAction",void 0),e([S()],Vt.prototype,"videoViewModel",void 0),e([S()],Vt.prototype,"collectionId",void 0),e([S({type:Number})],Vt.prototype,"contrast",null),e([S()],Vt.prototype,"conversionProps",void 0),e([S()],Vt.prototype,"coverageFrustums",void 0),e([S()],Vt.prototype,"coveragePolygons",void 0),e([S()],Vt.prototype,"currentBestFeature",void 0),e([S()],Vt.prototype,"currentBestFeatureMeasurementImage",void 0),e([S()],Vt.prototype,"currentBestFeatureLocation",void 0),e([S()],Vt.prototype,"currentCoverageVisible",void 0),e([S()],Vt.prototype,"currentNode",null),e([S()],Vt.prototype,"depthImage",void 0),e([S()],Vt.prototype,"depthImageNotSupported",null),e([S()],Vt.prototype,"directionMode",void 0),e([S()],Vt.prototype,"featureCache",void 0),e([S()],Vt.prototype,"navigationNodes",void 0),e([S({json:{write:!1}})],Vt.prototype,"determineWorkflowForFeature",void 0),e([S({json:{write:!1}})],Vt.prototype,"determineWorkflowForTriangularMeasurement",void 0),e([S()],Vt.prototype,"disabled",void 0),e([S()],Vt.prototype,"displayMessage",void 0),e([S()],Vt.prototype,"displayNewMeasurementButton",void 0),e([S()],Vt.prototype,"distanceMeasurementResult",void 0),e([S()],Vt.prototype,"distanceAccuracyArray",void 0),e([S()],Vt.prototype,"dataCaptureLayer",void 0),e([S({readOnly:!0})],Vt.prototype,"featureCount",null),e([S()],Vt.prototype,"features",void 0),e([S()],Vt.prototype,"groundCoordinates",void 0),e([S()],Vt.prototype,"groundCoordinatesAccuracy",void 0),e([S()],Vt.prototype,"heightMeasurementPixels",void 0),e([S()],Vt.prototype,"heightGraphic",void 0),e([S()],Vt.prototype,"heightMeasurementResult",void 0),e([S()],Vt.prototype,"heightMeasurementAccuracy",void 0),e([S()],Vt.prototype,"measurementAngle",void 0),e([S()],Vt.prototype,"tempDistance",void 0),e([S({readOnly:!0})],Vt.prototype,"imageGalleryEnabled",null),e([S()],Vt.prototype,"imageGeometryField",void 0),e([S({readOnly:!0})],Vt.prototype,"imageLoaded",null),e([S()],Vt.prototype,"imageLocationToolState",void 0),e([S({readOnly:!0})],Vt.prototype,"invalidCameraHeading",null),e([S()],Vt.prototype,"imagePointsInView",null),e([S()],Vt.prototype,"imageMeasurementViewer",void 0),e([S()],Vt.prototype,"isAdditionalCoverageVisible",void 0),e([S()],Vt.prototype,"isAdditionalPointSourcesVisible",void 0),e([S()],Vt.prototype,"measurementVectors",void 0),e([S()],Vt.prototype,"layer",void 0),e([S()],Vt.prototype,"layerView",null),e([S({readOnly:!0})],Vt.prototype,"layerFloorFilterClause",null),e([S({type:Number})],Vt.prototype,"localPort",void 0),e([S()],Vt.prototype,"mapImageConversionToolState",void 0),e([S()],Vt.prototype,"measureType",void 0),e([S()],Vt.prototype,"measurementGraphic",void 0),e([S({readOnly:!0,value:"none"})],Vt.prototype,"mode",null),e([S()],Vt.prototype,"navigationMode",void 0),e([S()],Vt.prototype,"navigatorCurrentBestFeature",void 0),e([S()],Vt.prototype,"oiObjectIdField",void 0),e([S({type:s.ofType(t)})],Vt.prototype,"overlayedCameraLocations",void 0),e([S()],Vt.prototype,"overlayedMapFeatures",void 0),e([S()],Vt.prototype,"panoramicVideoLoaded",null),e([S()],Vt.prototype,"pixelCoordinates",void 0),e([S()],Vt.prototype,"preserveAngle",void 0),e([S()],Vt.prototype,"pointSources",void 0),e([S({readOnly:!0})],Vt.prototype,"popupEnabled",null),e([S()],Vt.prototype,"previousFeatureAngle",void 0),e([S()],Vt.prototype,"referencePoint",null),e([S({readOnly:!0})],Vt.prototype,"sectorData",null),e([S()],Vt.prototype,"selectedPoint",void 0),e([S({type:Number})],Vt.prototype,"sharpness",null),e([S()],Vt.prototype,"shouldShowSelectedImage",void 0),e([S()],Vt.prototype,"sketch",void 0),e([S()],Vt.prototype,"sketchTriangular",void 0),e([S()],Vt.prototype,"sketchTriangularGraphicsLayer",void 0),e([S()],Vt.prototype,"draw",void 0),e([S()],Vt.prototype,"sketchAdapter",void 0),e([S({readOnly:!0})],Vt.prototype,"sketchGraphicsLayer",null),e([S({readOnly:!0})],Vt.prototype,"state",null),e([S({readOnly:!0})],Vt.prototype,"thumbnails",null),e([S()],Vt.prototype,"triangularMeasurementActive",void 0),e([S()],Vt.prototype,"triangulatedDistanceMeasurement",void 0),e([S()],Vt.prototype,"triangulatedDistanceAccuracy",void 0),e([S()],Vt.prototype,"triangulatedAreaMeasurement",void 0),e([S()],Vt.prototype,"triangulatedAreaAccuracy",void 0),e([S()],Vt.prototype,"triangulatedMeasurementGraphic",void 0),e([S()],Vt.prototype,"triangulatedPoint",void 0),e([S()],Vt.prototype,"triangulatedMeasurementAdapter",void 0),e([S()],Vt.prototype,"updateFootprint",void 0),e([S()],Vt.prototype,"updateFootprintPanorama",void 0),e([S()],Vt.prototype,"updatingTriangularMeasurementState",void 0),e([S({value:null})],Vt.prototype,"view",null),e([S()],Vt.prototype,"videoElement",void 0),e([S()],Vt.prototype,"videoLayer",void 0),e([S()],Vt.prototype,"videoMapView",void 0),e([S()],Vt.prototype,"_adapter",void 0),e([S()],Vt.prototype,"_defaultGraphicsLayer",null),e([S()],Vt.prototype,"_highlightedFeatureHandle",void 0),e([S()],Vt.prototype,"_imageViewer",void 0),e([S()],Vt.prototype,"_initialCurrentCoverageUpdate",void 0),e([S()],Vt.prototype,"_locationPointOnImage",void 0),e([S()],Vt.prototype,"_measurementService",void 0),e([S()],Vt.prototype,"_correctedLocationPointOnImage",void 0),e([S()],Vt.prototype,"_overlays",void 0),e([S({readOnly:!0})],Vt.prototype,"_overlaysView",null),e([S()],Vt.prototype,"_panoramicVideoViewer",void 0),e([S()],Vt.prototype,"_panoramicViewer",void 0),e([S()],Vt.prototype,"_panoramicMeasurementViewer",void 0),e([S()],Vt.prototype,"_referencePointOnGround",void 0),e([S()],Vt.prototype,"_referencePointOnImage",void 0),e([S()],Vt.prototype,"_sectorData",void 0),e([S()],Vt.prototype,"_featureToSector",void 0),e([S({readOnly:!0})],Vt.prototype,"_updatingHandles",void 0),e([S()],Vt.prototype,"footprintExtent",void 0),e([S()],Vt.prototype,"_featureChangedTask",void 0),Vt=e([k("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],Vt);const St=Vt;export{St 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 l}from"../../core/Evented.js";import{makeHandle as c}from"../../core/handleUtils.js";import{equalsShallow as h}from"../../core/lang.js";import u from"../../core/Logger.js";import{clamp as 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 V}from"../../core/sql.js";import{getMetersPerUnitForSR as P}from"../../core/units.js";import{property as S,subclass as k}from"../../core/accessorSupport/decorators.js";import{isSerializable as A}from"../../core/support/jsonUtils.js";import{UpdatingHandles as C}from"../../core/support/UpdatingHandles.js";import L from"../../geometry/Extent.js";import G from"../../geometry/Multipoint.js";import O from"../../geometry/Point.js";import R from"../../geometry/Polygon.js";import T from"../../geometry/Polyline.js";import{projectAsync as j}from"../../geometry/projectionUtils.js";import x from"../../geometry/SpatialReference.js";import{polygonCentroidPoint as B}from"../../geometry/support/centroid.js";import{isClockwise as H}from"../../geometry/support/coordsUtils.js";import{normalizeMapX as E}from"../../geometry/support/normalizeUtils.js";import{geographicToWebMercator as D}from"../../geometry/support/webMercatorUtils.js";import z from"../../layers/GraphicsLayer.js";import N from"../../layers/MediaLayer.js";import{searchImages as U,getSortedLayerFeatures as W}from"../../layers/orientedImagery/queries.js";import{calculateSuitabilities as q}from"../../layers/orientedImagery/core/bestImageUtils.js";import{createCoveragePolygon as $,computePolygonForInspection as Z,resizePolygon as J,checkIfPolygonContainsSelectedPoint as K}from"../../layers/orientedImagery/core/coverageUtils.js";import{isElevationSource as Q}from"../../layers/orientedImagery/core/ElevationSourceDefinitions.js";import{getMetersPerUnitOfSR as X,convertGeographicToWebMercator as Y}from"../../layers/orientedImagery/core/utils.js";import{imageToWorld as ee,imageToWorldPanoramic as te}from"../../layers/orientedImagery/transformations/imageToWorld.js";import ae from"../../layers/orientedImagery/transformations/updateElevation.js";import{getElevationSampler as ie}from"../../layers/orientedImagery/transformations/updateElevationUtils.js";import{or as re,getInitialAngle as se,convertPixelToHeadingPitch as oe,convertHeadingPitchToSphereVertex as ne,getImageToWorldProperties as le,getUpdateElevationProps as ce,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"../PanoramicVideoViewer.js";import Ie from"../PanoramicViewer.js";import{defaultAngleThresholdInDegrees as Ve,videoExtent as Pe,invalidCameraHeading as Se,sectorsInOrder as ke,sampleExtent as Ae,sectorsRadii as Ce}from"./constants.js";import{configureSketchTool as Le,extractFieldsFromDataCaptureLayer as Ge,isValidDataCaptureLayer as Oe,constructGraphicFromImageGeometry as Re}from"./dataCaptureUtils.js";import{getImageSourceFromAttachment as Te,isFeatureAttachment as je}from"./galleryUtils.js";import{getModeCorrectedPoint as xe,calculateCorrectedPixel as Be,getUnitRateFromSpatialReference as He,calculateHeightFromTemporaryDistance as Ee,getModeCorrectedPoints as De,computeTriangulatedVector as ze,computeTriangulatedPoint as Ne}from"./imageMeasurementUtils.js";import{crossSymbol as Ue,crossSymbol3D as We,measurementPolygonSymbol as qe,polylineSymbolPanoramic as $e,measurementPolylineSymbol as Ze,cameraOverlaySymbol3D as Je,cameraOverlaySymbol as Ke,diamondSymbol as Qe,diamondSymbol3D as Xe,locationSymbol as Ye,locationSymbol3D as et,activeSourcePointSymbol as tt,sourcePointSymbol as at}from"./symbols.js";import{isNoAttachmentError as it,isTifOrMrf as rt,filterOILLayerView as st,assignElevationSampleToFeatures as ot,calculateDirection as nt,calculateSegment as lt,createPanoramicMedia as ct,createNonPanoramicMedia as ht,isSceneView as ut,isGraphic as dt}from"./utils.js";import{disableVideoZoomAndPan as mt}from"./videoViewerUtils.js";import pt from"./components/ImageViewer.js";import gt from"./components/NavigationNode.js";import yt from"./components/OrientedImageryVideoViewModel.js";import{NoActiveViewerError as vt,NoFeatureFoundWithObjectIdError as ft}from"./navigation/errors.js";import{queryFeatureByObjectIds as wt}from"./navigation/queries.js";import{ImageMeasurementService as Ft}from"./services/ImageMeasurementService.js";import{guessExtensionFromURI as _t,getDatasetFormat as bt}from"./support/urlUtils.js";import Mt from"../Sketch/SketchViewModel.js";const It={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"},Vt=()=>new n("orientedimageryviewer:sketch-not-initialized","Sketch property is not initialized, call loadSketch first");let Pt=class extends(l(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=Ve,this.cameraPitchThreshold=Ve,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.depthImage=null,this.directionMode="Relative",this.featureCache=[],this.navigationNodes=new s,this.determineWorkflowForFeature=async(e,t,a)=>{const{currentBestFeature:i,selectedPoint:r}=this;if(this.emit("popup-close"),i&&r){this._initialCurrentCoverageUpdate=!0,this._updateGroundElevation=!0;try{await this._updatePointsAndPolygons(a),await this._loadDepthImage(a),await this._loadImage(a)}catch(s){y(s)||(this.loadImageError(s),u.getLogger(this).error("#loadIImage()","error occured while loading image",s))}}},this.determineWorkflowForTriangularMeasurement=async(e,t,a)=>{if(this.emit("popup-close"),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 pt,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,a)=>{"default"===this.mode&&"image-loaded"!==this.state||this.mode.includes("video")&&!this.videoElement?.content||await(this._adapter?.updateFootprint(e,t,a))},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 pt,this._initialCurrentCoverageUpdate=!0,this._locationPointOnImage=null,this._measurementService=null,this._correctedLocationPointOnImage=null,this._overlays=new z({listMode:"hide",internal:!0,elevationInfo:{mode:"absolute-height"},title:"OrentedImageryViewerViewModel overlays layer"}),this._panoramicVideoViewer=new Me,this._panoramicViewer=new Ie,this._panoramicMeasurementViewer=new Ie,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._suitabilities=null,this._transformController=new AbortController,this._updateFootprintTask=null,this._updateGroundElevation=!1,this.addUpdatingPromise=e=>this._updatingHandles.addPromise(e),this.filterCapturedFeatures=e=>{const t=this.currentBestFeature?.attributes.objectId,a=this.layer?.imageReferenceField;if(!t||!e||!a)return;const i=this.overlayedMapFeatures.get(e);i?.forEach(e=>{const i=e.attributes??{},r=Object.keys(i).find(e=>e.toLowerCase()===a.toLowerCase());(r?i[r]:null)!==t&&(e.visible=!e.visible)})},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.loadImageFromFeature=async(e,t,a)=>this._updatingHandles.addPromise(this._loadImageFromFeature(e,t,a)),this.storeImageMeasurementViewer=e=>{this.imageMeasurementViewer=e},this.storePanoramicMeasurementViewer=e=>{this._panoramicMeasurementViewer=e},this.loadImageViewer=e=>{this._imageViewer?.destroy(),this._imageViewer=e},this.loadPanoramicViewer=e=>{this._panoramicViewer?.destroy(),this._panoramicViewer=e},this.loadPanoramicVideoViewer=e=>{this._panoramicVideoViewer?.destroy(),this._panoramicVideoViewer=e},this.loadVideoViewer=e=>{this.videoMapView.container=e},this.showImageByObjectId=async(e,t)=>{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 ee(e,r,i);return pe(n,o)},this.imageToImageTransformPanoramic=async(e,t,a)=>{const{updateElevationProps:i,...r}=t,{updateElevationProps:s,...o}=a,n=await te(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 vt;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=()=>{const{currentBestFeature:e,popupEnabled:a,layer:i,view:r}=this;if(this.emit("popup-close"),!(r&&e&&a&&i))return;const{attributes:s,geometry:o}=e,n=new t({geometry:o,attributes:s.toJSON(),layer:i,sourceLayer:i});this.emit("popup-open",{features:[n],location:s.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(It.click),this.disabled||null==this.view)return;const e=this.mapImageConversionToolState&&"image-loaded"===this.state?this._mapImageConversionToolViewClickHandler:this._viewClickHandler;this.addHandles(this.view.on("click",e,be.DEFAULT),It.click)},this._createImageClickHandle=()=>{this.removeHandles(It.imageClick);const{mapImageConversionToolState:e,mode:t,activeViewer:a,currentBestFeature:i,footprintExtent:s}=this,o=a?.imageSize;if(!(e&&"none"!==t&&o&&s&&i))return;const n=a.clickAction;this.clickAction="pixel-location";const l=c(()=>{this.clickAction=n});let h=null;const u=_(()=>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 re(!t,e.spatialReference.equals(t))?e:j(e,t)});v(a),this.plotReferencePointOnGround(r)})});this.addHandles([u,l],It.imageClick)},this._createTriangularImageClickHandle=()=>{this.removeHandles(It.triangularImageClick),this.triangularMeasurementActive&&"none"!==this.mode&&this.currentBestFeature&&this.currentBestFeatureMeasurementImage&&this.activeTriangulatedViewer&&this.addHandles(this.activeTriangulatedViewer.imageRenderer.on("double-click",this._measurementImageClickHandler),It.triangularImageClick)},this._createTriangularImageLocationHandle=()=>{this.removeHandles(It.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.view?.spatialReference;s&&!r.spatialReference.equals(s)&&(r=await j(r,s),v(a)),await this._calculateTriangulatedPointFromGroundPoint(r,{signal:a}),v(a)}))});this.addHandles(o,It.triangularImageClick)},this._createImageLocationHandle=()=>{this.removeHandles(It.imageClick);const{imageLocationToolState:e,mode:t,activeViewer:a,currentBestFeature:i,footprintExtent:s}=this,o=a?.imageSize;if(!(e&&"none"!==t&&o&&s&&i))return;this.clickAction="pixel-location";let n=null;const l=_(()=>a,"pixel-location",e=>{const{currentBestFeatureMeasurementImage:a,triangularMeasurementActive:s,activeTriangulatedViewer:l}=this;this.pixelCoordinates=e;const c=null!=a&&!l?.state.includes("loading");re(!s,c)&&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 j(r,n),v(a)),this.groundCoordinates=r,s&&r&&c&&await this.triangulatedLocationWorkflow(r,a);const l=await this.calculateLocationAccuracy(e,r,t,a);v(a),l&&(this.groundCoordinatesAccuracy=l)})});this.addHandles(l,It.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._loadDepthImage=async e=>{const{currentBestFeature:t,layer:a,depthImageNotSupported:i}=this;if(this.depthImage?.destroy(),this.depthImage=null,!a||!t||i)return;const{depthImage:r}=t.attributes;if(!r)return;const s=(await import("./services/DepthImageService.js")).default;v(e),this.depthImage=new s({url:r});try{await this.depthImage.load(e)}catch(o){y(o)||(u.getLogger(this).error("error occurred while loading depth image",o),this.depthImage?.destroy(),this.depthImage=null)}},this._loadImage=async e=>{const{currentBestFeature:t,layer:a,mode:i}=this;if(this.clearGraphics(),a&&t&&"none"!==i&&"video"!==i&&"panoramic-video"!==i)try{await this.loadImageFromFeature(a,t,e),v(e),await this.transformAndPlotSelectedLocation(e)}catch(r){y(r)||this.loadImageError(r)}},this._loadVideo=async e=>{const{currentBestFeature:t,layer:a,mode:i,selectedPoint:r}=this,s=t?.attributes.imagePath;if(!a||!t||"panoramic-video"!==i||!s)return;const{attributes:o}=t,{cameraHeading:n,cameraPitch:l,cameraOrientation:c,location:h}=o,u=h.spatialReference.isWGS84&&4!==c?.type?D(h):new O(h);try{this._panoramicVideoViewer.viewModel.video&&this._panoramicVideoViewer.viewModel.video.pause(),this._panoramicVideoViewer.videoSource=s;let t=n??0;u&&r&&(t=await se(u,r)-t),this._panoramicVideoViewer.pitch=l??0,this._panoramicVideoViewer.yaw=t,await this._panoramicVideoViewer.loadVideo(e),v(e)}catch(d){y(d)||this.loadImageError(d)}},this._loadImageFromFeature=async(e,t,a)=>{const{mode:i}=this;if("default"!==i&&"panoramic"!==i)return;const{attributes:r}=t,{imagePath:s,imageRotation:o,cameraHeading:n,cameraRoll:l,objectId:c,cameraPitch:h,matrix:d,location:m}=r,p=(l??0)+(o??0);let g=s,f=null;if(je(s))try{const{datasetFormat:t,url:i}=await Te(e,c,a);v(a),g=i,f=t}catch(F){if(y(F))return;return it(F)?(u.getLogger(this).error(F),void this.setMessage("noAttachment","error",`${e.objectIdField}: ${c}`)):(u.getLogger(this).error(F,{[e.objectIdField]:c,layer:e}),void this.setMessage("imageLoadError","error",`query-attachments-failed:${e.objectIdField} ${c}`))}f??=_t(g);try{f??=await bt(g,a),v(a)}catch(F){if(y(F))return;u.getLogger(this).error("#getDatasetFormat()",F)}f??="UNKNOWN FORMAT";const{searchParams:w}=new URL(g);"panoramic"===i?await this.loadPanoramicMediaSource({lookAt:{yaw:this.selectedPoint?await se(m,this.selectedPoint):"viewAngle"in r&&Number.isFinite(r.viewAngle)?r.viewAngle:0,pitch:h},extension:f,url:g,cameraHeading:n,matrix:d},a):await this.loadMediaSource({datasetFormat:f,url:g,customParameters:w,rotation:p},a)},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&&"panoramic-video"!==i)try{await this.loadImageFromFeature(a,t,e),v(e)}catch(r){y(r)||this.loadImageError(r)}},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=>{if(e.stopPropagation(),e.preventDefault(),e.mapPoint){const t=e.mapPoint;t.x=E(t.x,t.spatialReference),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:Ue}),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}=oe(e,i,r),n=ne(s,o);this._crossSymbol=new t({geometry:new O(n,x.WebMercator),symbol:We}),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.disabled],()=>{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(It.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,void 0,{signal:t})}))},{...M,equals:(e,t)=>a(e,t,h)}),It.interactionHandles);break;case"video":this.addHandles(b(()=>{const{footprintExtent:e,videoElement:t,bestFeatureFootprint:a}=this;if(e&&t?.loaded&&a)return{videoExtent:Pe,bestFeatureFootprint:a}},e=>{e?.videoExtent&&e?.bestFeatureFootprint&&(m(this._updateFootprintTask),this._updateFootprintTask=r(async t=>{await this.updateFootprint(e.videoExtent,void 0,{signal:t})}))},{...M,equals:(e,t)=>a(e?.videoExtent,t?.videoExtent,h)&&e?.bestFeatureFootprint===t?.bestFeatureFootprint}),It.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)}),It.interactionHandles);break;case"panoramic-video":this.addHandles(b(()=>{const{currentBestFeature:e,state:t,_panoramicVideoViewer:a}=this,{imageSize:i,vfov:r,hfov:s,pitch:o,yaw:n,viewModel:l}=a,c=l.closestFeature??e;return c&&i&&!t.includes("loading")&&null!=r&&null!=s&&null!=o&&null!=n?[r,s,n,o,c]:null},e=>{if(!e)return;const[t,a,i,s,o]=e;m(this._updateFootprintTask),this._updateFootprintTask=r(async e=>{await this.updateFootprintPanorama({verticalFieldOfView:t,horizontalFieldOfView:a,yaw:i,pitch:s,feature:o},{signal:e}),v(e),this._updateFootprintTask=null})},{equals:(e,t)=>a(e,t,h)}),It.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(It.hittestHandles),e&&this.addHandles(_(()=>e,"hittest-response",this._handleImageHitTestResponse),It.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 depthImageNotSupported(){if(this.currentBestFeature?.attributes.depthImage)return!rt(this.currentBestFeature.attributes.depthImage)}get featureCount(){return this.features?.length??0}get imageGalleryEnabled(){const{currentBestFeature:e}=this;if(!e)return!1;const t=e.attributes.imagePath?.trim();return rt(t)||je(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===Se}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(st(e))}get layerFloorFilterClause(){const{layerView:e}=this;return e?ve(e):null}get mode(){const e=this.currentBestFeature?.attributes;if(!e)return"none";const t=e.orientedImageryType;if(t?.includes("video"))return t.includes("360")?"panoramic-video":"video";const{horizontalFieldOfView:a,isSpherical:i}=e;return 360===a||i?"panoramic":"default"}get panoramicVideoLoaded(){const{mode:e,_panoramicVideoViewer:t}=this,{videoLoaded:a}=t.viewModel;return("panoramic-video"===e&&!0===a)??!1}get popupEnabled(){return!0===this.layer?.popupEnabled}get referencePoint(){return this._referencePointOnGround?.geometry}get sectorData(){const{_sectorData:e}=this;return e?ke.map(t=>e[t]):null}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",d(e,0,1))}get sketchGraphicsLayer(){const{sketch:e}=this;return"graphics"===e?.layer?.type?e.layer:void 0}get state(){const{mode:e,_updatingHandles:{updating:t},_featureChangedTask:a}=this;if(!this.isFulfilled()||t||!1===a?.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 rt(r)||je(r)?{url:r,objectId:t,rotation:(a??0)+(i??0)}:null}).filter(i)):null}set view(e){this._set("view",e)}get _defaultGraphicsLayer(){const e={blendMode:"source-atop"};switch(this.mode){case"panoramic":return new z({...e,elevationInfo:{mode:"absolute-height"}});case"default":return new z({...e});default:return}}get _overlaysView(){return this.view?.layerViews.find(({layer:e})=>e===this._overlays)}beforeLoad(e=!0){this.emit("popup-close"),e&&(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=!1,i){return this._measurementService?.calculateAccuracyPanoramic(e,t,a,i)}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 Vt();Le(i,e,a),await a.create(e,{...t,defaultZ:0})}digitizeDelete(){if(!this.sketch)throw Vt();return this.sketch.delete()}digitizeDuplicate(){if(!this.sketch)throw Vt();return this.sketch.duplicate()}digitizePlace(e,t){if(!this.sketch)throw Vt();return this.sketch.place(e,t)}digitizeRedo(){if(!this.sketch)throw Vt();return this.sketch.redo()}digitizeUndo(){if(!this.sketch)throw Vt();return this.sketch.undo()}digitizeUpdate(e,t){if(!this.sketch)throw Vt();return this.sketch.update(e,t)}async displayHeightResults(){const{currentBestFeature:e,activeViewer:t,heightMeasurementPixels:a,mode:i}=this,r=t?.imageSize,s=e?.attributes;if(!s||!r)return;const o=await this.computeHeight(a,i);o?.value&&o?.accuracy&&(this.heightMeasurementResult=o.value,this.heightMeasurementAccuracy=o.accuracy)}filterByFootprints(e,t,a=!1){const i=[],r=[],s=[];return e.forEach(e=>{const{layer:{coveragePercent:o},attributes:n}=e;let l;const{polygon:c,frustum:h}=$(n);if(l=c.clone(),n.isInspection&&(l=Z(n)),o&&(l=J(l,o)),a||!t||K(l,t)){s.push(e);const{geometry:t,objectId:a,cameraHeight:o,cameraHeading:l}=n,u=t.clone();u.z=o/X(t.spatialReference),u.imageID=a,this.pointSources.push(u),l!==Se&&(i.push(c),h&&r.push(h))}}),{features:s,polygons:i,frustums:r}}getMeasurementProperties(e=this.currentBestFeature,t=this.activeViewer){if(!e||!t?.imageSize)return;const{elevationSample:a,attributes:i}=e,{elevationSource:r,cameraHeight:s}=i,o=le(i,t.imageSize[0],t.imageSize[1]);let n=o.cameraLocation;return(n.spatialReference.isGeographic?j(n,x.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&&(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?j(n,x.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&&(e.elevationSample=t.elevationSample),{...o,cameraLocation:n,updateElevationProps:t}))}async deleteDataCaptureFeatures(e){const{dataCaptureLayer:t}=this;if(!t)throw new n("orientedimageryviewer:missing-featurelayer","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?.[ke[e]],a=t?.at(0);a&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(a):this._updateCurrentBestFeature(a))}handleFeatureClick(e){const{sector:t,featureIndexInSector:a}=e;if(isNaN(a))return;const i=this._sectorData?.[t],r=i?.at(a);r&&(this.triangularMeasurementActive&&this.currentBestFeature?this._updateImageMeasurementBestFeature(r):this._updateCurrentBestFeature(r))}handleDrawCursorUpdateEvents(e){const{measurementAngle:t,tempDistance:a,heightMeasurementPixels:i,mode:r,activeViewer:s,currentBestFeature:o}=this,n=s?.imageSize;if(!e.vertices||!n||!o)return;const l=xe(e.vertices.at(-1),r,n);if(i.length<1||!l||!a||!t||"none"===r)return;const c=Be(i[0],l,t);if(!c?.length)return;this.heightMeasurementPixels.push(c),"panoramic"===r?this.createPolylineGraphicPano():this.createPolylineGraphic();const h=He(o.attributes.location.spatialReference),u=Ee(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=xe(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=Y(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._defaultGraphicsLayer,view:this.activeViewer?.imageRenderer,updateOnGraphicClick:!1,defaultUpdateOptions:{reshapeOptions:{edgeOperation:"none",shapeOperation:"none",vertexOperation:void 0},enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,tool:"transform"}})}return this.sketch}async loadMeasurementAdapter(e){if(!this.sketchAdapter){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),ot(r,n);const l=this._processSuitableFeatures(r,t);this.updateSuitabilities(l,a?.loadBestImage)}async processFeatureElevation(e,t,a){if(!t)return;const{features:i,polygons:r}=this.filterByFootprints(e,t,!0);if(!i?.length)return;const s=await this.processElevationSample(r,i,a);return v(a),s}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=qe(o),this.sketch.polylineSymbol="panoramic"===s?$e:Ze(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 T({paths:[e],spatialReference:a});else{const i=new T({paths:[e],spatialReference:a}),r=this.activeViewer?.imageRenderer.effectiveTheme.accentColor;this.heightGraphic=new t({geometry:i,symbol:Ze(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}=oe(i,a[0],a[1]),{heading:n,pitch:l}=oe(r,a[0],a[1]),c=[[...ne(s,o)],[...ne(n,l)]];if(this.heightGraphic)this.heightGraphic.geometry=new T({paths:[c],spatialReference:e});else{const a=new T({paths:[c],spatialReference:e});this.heightGraphic=new t({geometry:a,symbol:$e}),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=De(e,i,r),o=this.view?.spatialReference,n=[];for(let l=0;l<s.length;l++){const e={x:s[l][0],y:s[l][1]};let a=await this.getMapPoint(e,{feature:t,imageSize:r,mode:i});o&&!a.spatialReference.equals(o)&&(a=await j(a,o)),n.push(a)}return ze(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:l}=this,c=a?.imageSize;if(!c||!i||!s||"none"===o||n.includes("loading"))return;const{polygon:h}=$(i.attributes);if(a.removeManyGraphics(r.toArray()),r.removeAll(),e){const{features:e}=await s.queryFeatures({where:V(`${s.objectIdField} <> ${i.attributes.objectId}`,V(s.definitionExpression,l)),geometry:h,returnGeometry:!0,outFields:[s.objectIdField]}),n=await Promise.all(e.map(async e=>{const{attributes:a,geometry:r}=e,s=await this.getPixels(r,{feature:i,imageSize:c,mode:o}),n="panoramic"===o?Je():Ke();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:l,layer:c}=this,h=r?.imageSize;if(!h||!o||"none"===n||"video"===n||"panoramic-video"===n||l.includes("loading")||!c)return;const{polygon:d}=$(o.attributes);try{const{imageGeometryField:t,oiObjectIdField:a}=Ge(e,c.imageGeometryField,c.imageReferenceField);this.imageGeometryField=t.name,this.oiObjectIdField=a.name}catch(g){u.getLogger(this).warn("oriented-imagery-viewer:overlay-map-features",g)}const{features: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:l}=i,c=l,{imageGeometryField:d,oiObjectIdField:m}=this;if(d&&m&&Oe(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(c?.type){case"point":{const i=await this.getPixels(c,{feature:o,imageSize:h,mode:n});return new t({attributes:s,layer:e,symbol:r,geometry:i,visible:e.visible&&a})}case"polygon":{const{rings:i,spatialReference:l}=c,u=i.map(e=>e.map(([e,t,a])=>new O({x:e,y:t,z:a,spatialReference:l}))),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 R({rings:d,spatialReference:x.WebMercator}),visible:e.visible&&a})}case"polyline":{const{paths:i,spatialReference:l}=c,u=i.map(e=>e.map(([e,t,a])=>new O({x:e,y:t,z:a,spatialReference:l}))),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 T({paths:d,spatialReference:x.WebMercator}),visible:e.visible&&a})}case"multipoint":{const{points:i,spatialReference:l}=c,u=i.map(([e,t,a])=>new O({x:e,y:t,z:a,spatialReference:l})),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 G({points:d,spatialReference:x.WebMercator}),visible:e.visible&&a})}}return null}))).filter(i));this.overlayGraphicsOnImage(`${e.id}`,p)}getDepthAt(e){const{activeViewer:t,currentBestFeature:a,mode:i,state:r,depthImage:s}=this,o=t?.imageSize;if(!o||!a||"none"===i||r.includes("loading"))return u.getLogger(this).warnOnce("oriented-imagery-viewer:get-depth-at","Load an image to use depth"),null;if(!s?.loaded)return u.getLogger(this).error("oriented-imagery-viewer:get-depth-at","Depth image is not loaded"),this.emit("depth-image-service:not-loaded"),null;const n=(Array.isArray(e)?e:[e]).map(e=>s.depthAt(e,{width:o[0],height:o[1]})??null);return Array.isArray(e)?n:n[0]}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:x.WebMercator});const[t,r]=a,{heading:s,pitch:o}=oe(e,t,r),n=ne(s,o);return new O(n,x.WebMercator)});return Array.isArray(e)?s:s[0]}async getMapPoint(e,t){const{feature:a,mode:i,imageSize:r}=t,{elevationSample:s,attributes:o}=a,{elevationSource:n,location:l,cameraHeight:c}=o;let h=l.clone();h.spatialReference.isGeographic&&(h=await j(h,x.WebMercator));const u=await ce(l.spatialReference,l.z??0,c,{elevationSample:s,elevationSource:n,extent:this.footprintExtent});let d;"elevationSample"in u&&(a.elevationSample=u.elevationSample);const m=Array.isArray(e)?e:[e];if(this.depthImage?.loaded)for(const p of m){const e=this.getDepthAt(p);null!=e&&(p.depth=e)}if("default"===i){const e=le(o,r[0],r[1]);d=await ee(m,{...e,cameraLocation:h},u)}else{const e=he(o,r[0],r[1]);d=await te(m,{...e,cameraLocation:h},u)}return Array.isArray(e)?d:d[0]}getActiveSectors(){return ke.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:Qe}),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:Qe}),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}=oe(e,i,r),n=ne(s,o);this._referencePointOnImage=new t({geometry:new O(n,x.WebMercator),symbol:Xe}),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))}reset(){const{mode:e}=this;"default"===e||"panoramic"===e?this.resetImage():"video"===e?this.resetVideo():"panoramic-video"===e&&this.resetVideoPanoramic(),this.beforeLoad(!1)}resetImage(){switch(this.setMessage("onLoadMessage","info"),this.mode){case"default":this._imageViewer.clearImage(),this._imageViewer.clearGraphics();break;case"panoramic":this._panoramicViewer.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}resetVideoPanoramic(){this.setMessage("onLoadMessage","info"),this._overlays?.removeAll(),this.currentBestFeature=null}resetMeasurementData(){this.areaMeasurementResult=0,this.areaMeasurementAccuracy=0,this.distanceMeasurementResult=0,this.distanceAccuracyArray=[],this.heightMeasurementPixels=[],this.measurementVectors=[],this.heightMeasurementResult=0,this.tempDistance=null,this.measurementAngle=null,this.heightMeasurementAccuracy=0,this.heightGraphic=null,this.triangulatedDistanceMeasurement=null,this.triangulatedDistanceAccuracy=null,this.triangulatedAreaMeasurement=null,this.triangulatedMeasurementGraphic=null,this.updatingTriangularMeasurementState=!1,this.triangulatedAreaAccuracy=0}async saveDrawing(){const{dataCaptureLayer:e,sketchAdapter:t}=this;if(!e||"data-capture"!==t?.type)return;const{pendingGraphics:a,savedGraphics:i}=t,r=a.get(e.id),s=r?.toArray();if(!r||!s?.length)return;const{addFeatureResults:o}=await this.saveDataCaptureFeatures(s),n=o.reduce((t,{objectId:a,globalId:i,error:r},o)=>{const n=s[o],{attributes:l}=n;return r?t.error.push(n):(a&&(l[e.objectIdField]=a),i&&e.globalIdField&&(l[e.globalIdField]=i),t.success.push(n)),t},{success:[],error:[]});i.addMany(n.success),r.removeAll(),r.addMany(n.error)}async saveDataCaptureFeatures(e){const{activeViewer:t,currentBestFeature:a,dataCaptureLayer:r,mode:s}=this,o=t?.imageSize;if(!o||!a||"none"===s||"video"===s||"panoramic-video"===s)throw new n("orientedimageryviewer:missing-input","Image size, current best feature and mode are required to save data capture features");if(!r)throw new n("orientedimageryviewer:missing-featurelayer","Data capture layer is not available");const l=await Promise.all(e.map(async e=>{const t=e.clone(),{geometry:i}=t;if(!i)return;const n=i.type,l=r.hasZ,c=r.geometryType,h=n!==c,u=h?await import("./transformers.js"):null,d=u?.default[c],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}),l||(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 R({spatialReference:e[0][0].spatialReference,hasZ:l,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 T({spatialReference:e[0][0].spatialReference,hasZ:l,hasM:!1,paths:e.map(e=>e.map(ue))}),t}}})),c=l.filter(i);return r.applyEdits({addFeatures:c}).then(e=>{const{addFeatureResults:t}=e;let a=0;const i=l.map(e=>{const i=t[a++];return e?i:{error:new n("orientedimageryviewer:save-unsucccessful","Error in saving data capture features"),objectId:null,globalId:null}});return{...e,addFeatureResults:i}})}async searchBestImage(e,t){try{const a=await U(e,t);a&&await this.processFeatureResponse(a,e.point,t)}catch(a){y(a)||(this.setMessage("imageLoadError","error",a.message),u.getLogger(this).error("error occurred while finding best image",a))}}selectTriangularMeasurementFeature(e){this.currentBestFeatureMeasurementImage=this.features?.find(({attributes:t})=>t.objectId===Number(e))}setAdditionalCameraLocationsVisibility(e){this.additionalCameraLocations.forEach(t=>{t.visible=e})}setAdditionalCoverageVisibility(e){this.additionalFootprints.forEach(t=>{t.visible=e})}setCurrentCoverageVisibility(e){this.bestFeatureCurrentFootprint&&(this.bestFeatureCurrentFootprint.visible=e),this.currentBestFeatureLocation&&(this.currentBestFeatureLocation.visible=e)}setMapImageConversionToolState(e){this.mapImageConversionToolState=e}setCurrentPanoramaView(e,t){this._panoramicViewer?.set({yaw:e,pitch:t})}async startDataCapture(e,t){const a=this.activeViewer?.imageRenderer,{oiObjectIdField:i,currentBestFeature:r}=this;if(!a||!r||!i)return;const{attributes:{objectId:o}}=r,n=this.overlayedMapFeatures.get(e.id)?.toArray()??[],l=[],c=[];for(const s of n)`${s.getAttribute(i)}`==`${o}`?l.push(s):c.push(s);this.overlayGraphicsOnImage(e.id,new s(c)),this.collectionId=e.id;const h=await this.loadSketch(t),u=await this.loadDataCaptureAdapter(t);v(t),h.addGraphics(l),u.savedGraphics.addMany(l);a.ui.find("zoom").visible=!1,a.map.layers.add(this.sketchGraphicsLayer)}async stopDataCapture(e=!1){this.sketch?.cancel(),this.sketchGraphicsLayer?.removeAll(),this.sketchAdapter=p(this.sketchAdapter),this.sketch=p(this.sketch),this.collectionId=null;const{dataCaptureLayer:t}=this,a=this.activeViewer?.imageRenderer;if(!a||a.destroyed)return;a.map.layers.remove(this.sketchGraphicsLayer),e&&t&&await this.overlayMapFeatures(t,!0);const i=a.ui.find("zoom");i&&(i.visible=!0)}stopMeasurement(){this.heightMeasurementPixels=[],this.draw?.reset(),this.sketch?.cancel()}async toggleAllOverlayMapFeatures(e){!e&&this.dataCaptureLayer&&(await this.stopDataCapture(!0),this.dataCaptureLayer=null),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 j(a,o.spatialReference);r=o.contains(e);break}case"mesh":{const e=a.spatialReference.equals(o.spatialReference)?a:await j(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=ze(e,a);if(!i)return;this.measurementVectors.push(i),await this.plotReferenceLocationPoint(e,t),v(t),this._createTriangularImageLocationHandle()}}async updateFeatureCache(e,t){const a=await W(e,t);a.features?.length&&(this.featureCache=a.features)}async _calculateTriangulatedPointFromGroundPoint(e,t){if(this.currentBestFeatureMeasurementImage&&e){const{currentBestFeatureMeasurementImage:a,view:i}=this,r=ze(e,a);r&&this.measurementVectors.push(r);let s=await Ne(this.measurementVectors);v(t),s?.spatialReference&&i?.spatialReference&&!s.spatialReference.equals(i.spatialReference)&&(s=await j(s,i.spatialReference)),this.triangulatedPoint=s??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 ke)this._sectorData[h]=new s;const n=e.map((e,t)=>({...e,featureIndex:t}));n.sort((e,t)=>e.trueSuitability-t.trueSuitability);const l=n.map(({distance:e})=>e),c=Math.max(...l);n.forEach(e=>{const{distance:t,angle:i,featureIndex:s}=e,n=t/c*Ce[2],l=lt(t,c),h=nt(i);if(!this._sectorData)return;const u=Ce[3]+n*Math.sin(i*Math.PI/180),d=Ce[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-Ce[3],t=d-Ce[3],a=t/Math.sqrt(e**2+t**2);let i=180*Math.acos(a)/Math.PI;(e<0&&t<0||e<0&&t>0)&&(i*=-1),m=i}const f=""===l?h:`${l}_${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 z,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 Ft(this))}_initializeSketchTriangular(){if(!this.activeTriangulatedViewer)return;const e="panoramic"===this.mode;this.sketchTriangular=new Mt({view:this.activeTriangulatedViewer.imageRenderer,layer:this.sketchTriangularGraphicsLayer,updateOnGraphicClick:!1,defaultUpdateOptions:{toggleToolOnClick:!1,enableZ:!e}}),e&&(this.sketchTriangular.defaultUpdateOptions.reshapeOptions={edgeOperation:"offset",shapeOperation:"move-xy",vertexOperation:"move-xy"})}_initializeSketchTriangularGraphicsLayer(){this.activeTriangulatedViewer&&(this.sketchTriangularGraphicsLayer=new z,this.activeTriangulatedViewer.imageRenderer.map.layers.add(this.sketchTriangularGraphicsLayer))}_initializeVideo(){if(this.videoElement||!this.currentBestFeature)return;this.removeHandles(It.videoPlayerHandles),this.videoElement=new fe({video:this.currentBestFeature.attributes.imagePath,georeference:new ye({extent:new L(Ae)}),autoplay:!1}),this.videoElement.content?.loop&&(this.videoElement.content.loop=!1);const e=new N({source:this.videoElement,title:this.layer?.title,copyright:this.layer?.copyright});this.videoLayer=e,e&&this.videoMapView.map.layers.add(e),this.addHandles(mt(this.videoMapView),It.videoPlayerHandles),this.videoViewModel=new yt({oiViewModel:this})}async loadPanoramicMediaSource(e,t){const{lookAt:a,...i}=e,r=ct(i);try{await r.load(t)}catch(o){if(y(o))return;"unsupported-type"===o.name&&this.setMessage("unsupportedPanoramicImageryError","error",void 0,{extension:r?.extension??"UNKNOWN FORMAT"})}const s=this.triangularMeasurementActive?this._panoramicMeasurementViewer:this._panoramicViewer;await s.loadMedia(r,t),a&&s.set(a)}async loadMediaSource(e,t){const a=ht(e);await this._setImageSource(this.triangularMeasurementActive?this.imageMeasurementViewer:this._imageViewer,a,t)}_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:x.WebMercator,...i}),symbol:Ye}),this.imageMeasurementViewer.addGraphic(this._correctedLocationPointOnImage,0)):(this._locationPointOnImage=new t({geometry:new O({spatialReference:x.WebMercator,...i}),symbol:Ye}),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:l}=oe(e,s,o),c=ne(n,l),h=new t({geometry:new O(c,x.WebMercator),symbol:et});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.videoElement?.content?.pause(),this.currentBestFeature=null,!1)}async _getElevationSampleFromGround(e,t,a){if(!e[0])return;const i=(await import("../../geometry/operators/unionOperator.js")).executeMany(e);if(this._updateFootprintWithFeatures(t,i),"3d"===this.view?.type)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 ie({extent:this.footprintExtent,lod:i.lod,url:i.url,rasterFunction:i.rasterFunction}):void 0)}_processSuitableFeatures(e,t){return q({features:e,selectedPoint:t,camera:ut(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,l=e.spatialReference.equals(o.spatialReference)?o:await j(o,e.spatialReference),c=l.spatialReference.isGeographic?D(l):l,h=V("1=1",V(e.definitionExpression,n)),u=c.spatialReference.isGeographic?1:P(c.spatialReference),d={layerInstanceOrURL:e,point:c,queryParams:{where:h,maximumDistance:e.maximumDistance?e.maximumDistance/u:void 0,objectIds:s?[r.graphic.getAttribute(e.objectIdField)]:void 0}};await this.searchBestImage(d,a)}async _queryAndLoadByObjectId(e,t,a,i){this.displayMessage=null;const{response:r}=await wt(e,t,a,i);if(v(i),!r?.features?.length)throw new ft(t);const s=$(r.features[0].attributes).polygon,o=O.fromJSON(B(s)),n=Y(o),l=P(n.spatialReference);this.selectedPoint=n;const c={layerInstanceOrURL:e,point:n,queryParams:{where:V(V("1=1",V(e.definitionExpression,a)),`${e.objectIdField} <> ${t}`),maximumDistance:e.maximumDistance?e.maximumDistance/l:void 0}},h=await U(c,i);v(i);const{features:u}=h;return u.push(r.features[0]),await this.processFeatureResponse(h,n,{...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(It.activeViewerCursorHandles),t&&this.removeHandles(It.imageViewerCursorHandles)}async _setImageSource(e,t,a){e.mediaCollection.removeAll().forEach(e=>e.destroy()),e.mediaCollection.add(t),await e.loadImage(t,a)}_setMeasurementCursor(){const{activeViewer:e,imageMeasurementViewer:t,triangularMeasurementActive:a}=this;e&&this.addHandles(e.imageRenderer.acquireCursor("crosshair","high"),It.activeViewerCursorHandles),t&&a&&this.addHandles(t.imageRenderer.acquireCursor("crosshair","high"),It.activeViewerCursorHandles)}_toggleVisiblity(e,t){e.forEach(e=>{e.visible=t})}async _updateElevationOfSelectedPointAndLocations(e,t,a,i){const{location:r,cameraHeight:s}=e[0].attributes,o=await ce(r.spatialReference,r.z,s,{elevationSample:a,elevationSource:a?void 0:e[0].attributes.elevationSource,extent:this.footprintExtent},i);v(i);const[n,...l]=await ae([t,...e.map(e=>e.attributes.geometry.clone())],o);v(i),t.elevation=n.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 gt({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])),"panoramic-video"===this.mode&&this._loadVideo()}_updateFootprintWithFeatures(e,t){const a=[];for(const{attributes:{geometry:i}}of e)t.contains(i)||a.push([i.x,i.y]);a.sort((e,t)=>+H([e,t])),t.addRing(a),this.footprintExtent=_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 o of a){const a=this.view&&!this.view.spatialReference?.equals(o.spatialReference)?await j(o.clone(),this.view?.spatialReference,e):o.clone();o.imageID===i.attributes.objectId?this.currentBestFeatureLocation=new t({attributes:{imageID:o.imageID},geometry:a,symbol:tt,visible:r}):this.additionalCameraLocations.push(new t({attributes:{imageID:o.imageID},geometry:a,symbol:at,visible:s}))}"video"!==o&&"panoramic-video"!==o||!n||this.featureCache.length||await this.updateFeatureCache(n,i.geometry.spatialReference)}}_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));if("panoramic-video"===this.mode)return void(this.currentBestFeature&&this._panoramicVideoViewer.viewModel.playPanoramicVideoFromSelectedLocation(this.currentBestFeature));const t=this.currentBestFeature?.attributes.cameraPitch&&this.currentBestFeature?.attributes.cameraPitch<5;let a;if(t)a=-90;else{const t=e.x-Ce[3],i=e.y-Ce[3],r=i/Math.sqrt(t**2+i**2);let s=180*Math.acos(r)/Math.PI;(t<0&&i<0||t<0&&i>0)&&(s*=-1),a=s}a===this.bestFeatureAngle?this.previousFeatureAngle=a:this.bestFeatureAngle=a,this.navigatorCurrentBestFeature=t?null:{x:e.x,y:e.y,direction:e.sector.includes("_")?e.sector.split("_")[1]:e.sector}}_updateImageMeasurementBestFeature(e){e&&(this.currentBestFeatureMeasurementImage=this.features?.at(e.featureIndex))}clearGraphics(){this._imageViewer.clearGraphics(),this._panoramicViewer.clearGraphics(),this.imageMeasurementViewer.clearGraphics(),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:l},elevationSample:c}=t;let h=s.clone();const u=await ce(s.spatialReference,s.z??0,l,{elevationSample:c,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(ae(e,u));t(e)})));if(s.spatialReference.isGeographic&&(h=await j(h,x.WebMercator,a)),p=await Promise.all(p.map(async e=>h.spatialReference.equals(e.spatialReference)?e:await j(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:l,_adapter:c,mode:h}=this;if(!r)return;const{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),l){const e=[...a,...i,s].filter(dt);"3d"===l?.type&&d&&c?.updateGroundElevation&&(this._updateGroundElevation&&c.updateGroundElevation(e),"panoramic"===h&&c.updateGroundElevation([this.bestFeatureCurrentFootprint])),this._updateGroundElevation=!1,n&&(e.splice(-2,0,this.bestFeatureCurrentFootprint),e.push(new t({geometry:n.clone(),symbol:Ue.clone(),attributes:{imageID:u}}))),this._overlays.graphics.addMany(e)}}else if(l){if(this.invalidCameraHeading)return;this.bestFeatureCurrentFootprint&&(this._overlays?.remove(this.bestFeatureCurrentFootprint),this.bestFeatureCurrentFootprint=p(this.bestFeatureCurrentFootprint));const t=this.bestFeatureCurrentFootprint&&this._overlays?this._overlays.graphics.indexOf(this.bestFeatureCurrentFootprint):-1;e&&(this.bestFeatureCurrentFootprint=e,"3d"===l?.type&&d&&c?.updateGroundElevation&&"panoramic"===h&&c.updateGroundElevation([e]),e.visible=this.currentCoverageVisible,this._overlays?.graphics.add(this.bestFeatureCurrentFootprint,t>=0?t:this._overlays.graphics.length-1))}}};e([S()],Pt.prototype,"activeLayer",null),e([S({readOnly:!0})],Pt.prototype,"activeViewer",null),e([S()],Pt.prototype,"activeTriangulatedViewer",null),e([S()],Pt.prototype,"accuracyParametersMissing",null),e([S()],Pt.prototype,"additionalFeatures",void 0),e([S({type:s.ofType(t)})],Pt.prototype,"additionalCameraLocations",void 0),e([S({type:s.ofType(t)})],Pt.prototype,"additionalFootprints",void 0),e([S()],Pt.prototype,"areaMeasurementResult",void 0),e([S()],Pt.prototype,"areaMeasurementAccuracy",void 0),e([S()],Pt.prototype,"bestFeatureAngle",void 0),e([S()],Pt.prototype,"bestFeatureCurrentFootprint",void 0),e([S({type:t})],Pt.prototype,"bestFeatureFootprint",void 0),e([S({type:Number})],Pt.prototype,"brightness",null),e([S()],Pt.prototype,"cameraHeadingThreshold",void 0),e([S()],Pt.prototype,"cameraPitchThreshold",void 0),e([S()],Pt.prototype,"clickAction",void 0),e([S()],Pt.prototype,"videoViewModel",void 0),e([S()],Pt.prototype,"collectionId",void 0),e([S({type:Number})],Pt.prototype,"contrast",null),e([S()],Pt.prototype,"conversionProps",void 0),e([S()],Pt.prototype,"coverageFrustums",void 0),e([S()],Pt.prototype,"coveragePolygons",void 0),e([S()],Pt.prototype,"currentBestFeature",void 0),e([S()],Pt.prototype,"currentBestFeatureMeasurementImage",void 0),e([S()],Pt.prototype,"currentBestFeatureLocation",void 0),e([S()],Pt.prototype,"currentCoverageVisible",void 0),e([S()],Pt.prototype,"currentNode",null),e([S()],Pt.prototype,"depthImage",void 0),e([S()],Pt.prototype,"depthImageNotSupported",null),e([S()],Pt.prototype,"directionMode",void 0),e([S()],Pt.prototype,"featureCache",void 0),e([S()],Pt.prototype,"navigationNodes",void 0),e([S({json:{write:!1}})],Pt.prototype,"determineWorkflowForFeature",void 0),e([S({json:{write:!1}})],Pt.prototype,"determineWorkflowForTriangularMeasurement",void 0),e([S()],Pt.prototype,"disabled",void 0),e([S()],Pt.prototype,"displayMessage",void 0),e([S()],Pt.prototype,"displayNewMeasurementButton",void 0),e([S()],Pt.prototype,"distanceMeasurementResult",void 0),e([S()],Pt.prototype,"distanceAccuracyArray",void 0),e([S()],Pt.prototype,"dataCaptureLayer",void 0),e([S({readOnly:!0})],Pt.prototype,"featureCount",null),e([S()],Pt.prototype,"features",void 0),e([S()],Pt.prototype,"groundCoordinates",void 0),e([S()],Pt.prototype,"groundCoordinatesAccuracy",void 0),e([S()],Pt.prototype,"heightMeasurementPixels",void 0),e([S()],Pt.prototype,"heightGraphic",void 0),e([S()],Pt.prototype,"heightMeasurementResult",void 0),e([S()],Pt.prototype,"heightMeasurementAccuracy",void 0),e([S()],Pt.prototype,"measurementAngle",void 0),e([S()],Pt.prototype,"tempDistance",void 0),e([S({readOnly:!0})],Pt.prototype,"imageGalleryEnabled",null),e([S()],Pt.prototype,"imageGeometryField",void 0),e([S({readOnly:!0})],Pt.prototype,"imageLoaded",null),e([S()],Pt.prototype,"imageLocationToolState",void 0),e([S({readOnly:!0})],Pt.prototype,"invalidCameraHeading",null),e([S()],Pt.prototype,"imagePointsInView",null),e([S()],Pt.prototype,"imageMeasurementViewer",void 0),e([S()],Pt.prototype,"isAdditionalCoverageVisible",void 0),e([S()],Pt.prototype,"isAdditionalPointSourcesVisible",void 0),e([S()],Pt.prototype,"measurementVectors",void 0),e([S()],Pt.prototype,"layer",void 0),e([S()],Pt.prototype,"layerView",null),e([S({readOnly:!0})],Pt.prototype,"layerFloorFilterClause",null),e([S({type:Number})],Pt.prototype,"localPort",void 0),e([S()],Pt.prototype,"mapImageConversionToolState",void 0),e([S()],Pt.prototype,"measureType",void 0),e([S()],Pt.prototype,"measurementGraphic",void 0),e([S({readOnly:!0,value:"none"})],Pt.prototype,"mode",null),e([S()],Pt.prototype,"navigationMode",void 0),e([S()],Pt.prototype,"navigatorCurrentBestFeature",void 0),e([S()],Pt.prototype,"oiObjectIdField",void 0),e([S({type:s.ofType(t)})],Pt.prototype,"overlayedCameraLocations",void 0),e([S()],Pt.prototype,"overlayedMapFeatures",void 0),e([S()],Pt.prototype,"panoramicVideoLoaded",null),e([S()],Pt.prototype,"pixelCoordinates",void 0),e([S()],Pt.prototype,"preserveAngle",void 0),e([S()],Pt.prototype,"pointSources",void 0),e([S({readOnly:!0})],Pt.prototype,"popupEnabled",null),e([S()],Pt.prototype,"previousFeatureAngle",void 0),e([S()],Pt.prototype,"referencePoint",null),e([S({readOnly:!0})],Pt.prototype,"sectorData",null),e([S()],Pt.prototype,"selectedPoint",void 0),e([S({type:Number})],Pt.prototype,"sharpness",null),e([S()],Pt.prototype,"shouldShowSelectedImage",void 0),e([S()],Pt.prototype,"sketch",void 0),e([S()],Pt.prototype,"sketchTriangular",void 0),e([S()],Pt.prototype,"sketchTriangularGraphicsLayer",void 0),e([S()],Pt.prototype,"draw",void 0),e([S()],Pt.prototype,"sketchAdapter",void 0),e([S({readOnly:!0})],Pt.prototype,"sketchGraphicsLayer",null),e([S({readOnly:!0})],Pt.prototype,"state",null),e([S({readOnly:!0})],Pt.prototype,"thumbnails",null),e([S()],Pt.prototype,"triangularMeasurementActive",void 0),e([S()],Pt.prototype,"triangulatedDistanceMeasurement",void 0),e([S()],Pt.prototype,"triangulatedDistanceAccuracy",void 0),e([S()],Pt.prototype,"triangulatedAreaMeasurement",void 0),e([S()],Pt.prototype,"triangulatedAreaAccuracy",void 0),e([S()],Pt.prototype,"triangulatedMeasurementGraphic",void 0),e([S()],Pt.prototype,"triangulatedPoint",void 0),e([S()],Pt.prototype,"triangulatedMeasurementAdapter",void 0),e([S()],Pt.prototype,"updateFootprint",void 0),e([S()],Pt.prototype,"updateFootprintPanorama",void 0),e([S()],Pt.prototype,"updatingTriangularMeasurementState",void 0),e([S({value:null})],Pt.prototype,"view",null),e([S()],Pt.prototype,"videoElement",void 0),e([S()],Pt.prototype,"videoLayer",void 0),e([S()],Pt.prototype,"videoMapView",void 0),e([S()],Pt.prototype,"_adapter",void 0),e([S()],Pt.prototype,"_defaultGraphicsLayer",null),e([S()],Pt.prototype,"_highlightedFeatureHandle",void 0),e([S()],Pt.prototype,"_imageViewer",void 0),e([S()],Pt.prototype,"_initialCurrentCoverageUpdate",void 0),e([S()],Pt.prototype,"_locationPointOnImage",void 0),e([S()],Pt.prototype,"_measurementService",void 0),e([S()],Pt.prototype,"_correctedLocationPointOnImage",void 0),e([S()],Pt.prototype,"_overlays",void 0),e([S({readOnly:!0})],Pt.prototype,"_overlaysView",null),e([S()],Pt.prototype,"_panoramicVideoViewer",void 0),e([S()],Pt.prototype,"_panoramicViewer",void 0),e([S()],Pt.prototype,"_panoramicMeasurementViewer",void 0),e([S()],Pt.prototype,"_referencePointOnGround",void 0),e([S()],Pt.prototype,"_referencePointOnImage",void 0),e([S()],Pt.prototype,"_sectorData",void 0),e([S()],Pt.prototype,"_featureToSector",void 0),e([S({readOnly:!0})],Pt.prototype,"_updatingHandles",void 0),e([S()],Pt.prototype,"footprintExtent",void 0),e([S()],Pt.prototype,"_featureChangedTask",void 0),Pt=e([k("esri.widgets.OrientedImageryViewer.OrientedImageryViewerViewModel")],Pt);const St=Pt;export{St as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{EsriPromise as t}from"../../../../core/Promise.js";import{throwIfAborted as a}from"../../../../core/promiseUtils.js";import{property as i,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{
|
|
5
|
+
import{__decorate as e}from"tslib";import{EsriPromise as t}from"../../../../core/Promise.js";import{throwIfAborted as a}from"../../../../core/promiseUtils.js";import{property as i,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{projectAsync as s}from"../../../../geometry/projectionUtils.js";import{convertSphereVertexToPixelLocation as n}from"../../../../layers/orientedImagery/transformations/utils.js";import{getModeCorrectedPoints as o,computeTriangulatedVector as c,computeTriangulatedAreaMeasurement as m,computeTriangulatedDistanceMeasurement as u}from"../../imageMeasurementUtils.js";import{TriangulatedSketchHandlerMixin as l}from"../../mixins/TriangulatedSketchHandlerMixin.js";let d=[],p=class extends(l(t)){constructor(e){super(e),this.type="measurement"}async handleUpdate(e){const{measureType:t,updatingTriangularMeasurementState:a}=this.viewModel;if(this._preventLeftMouseDrag(),"distance"===t){const t=e.graphics[0].geometry;d=t.paths[0]}else if("area"===t){const t=e.graphics[0].geometry;d=t.rings[0]}"complete"===e.state&&(this.viewModel.triangulatedMeasurementGraphic=e.graphics.at(-1),a?await this._updateTriangularMeasurements(d):await this.viewModel.processMeasurementVectors(d))}async _computeMeasurementVector(e,t){const{activeViewer:a,mode:i,view:r}=this.viewModel,n=a?.imageSize;if(!e||!t||!n)return;const m=o(e,i,n),u=r?.spatialReference,l=[];for(let o=0;o<m.length;o++){const e={x:m[o][0],y:m[o][1]};let a=await this.viewModel.getMapPoint(e,{feature:t,imageSize:n,mode:i});u&&!a.spatialReference.equals(u)&&(a=await s(a,u)),l.push(a)}return c(l,t)}async _updateTriangularMeasurements(e,t){const{measureType:i,mode:r,activeTriangulatedViewer:s,triangularMeasurementActive:o,currentBestFeatureMeasurementImage:c,updatingTriangularMeasurementState:l}=this.viewModel;if(!(o&&c&&l&&s?.imageSize&&2===this.viewModel.measurementVectors?.length))return;const[d,p]=s.imageSize;this.viewModel.measurementVectors.splice(-1);const g=await this._computeMeasurementVector(e,c);if(a(t),g&&this.viewModel.measurementVectors.push(g),2===this.viewModel.measurementVectors.length){switch(i){case"distance":{this.viewModel.triangulatedDistanceMeasurement=await u(this.viewModel.measurementVectors),a(t);const i=e.map(([e,t,a])=>{const{x:i,y:r}=n({x:e,y:t,z:a},d,p);return[i,r]}),s="default"===r?await this.viewModel.calculateAccuracy(e,"distance"):await this.viewModel.calculateAccuracyPanoramic(i,"distance",!0);if(a(t),s&&this.viewModel.triangulatedDistanceMeasurement?.distance){const e=Math.atan(s/this.viewModel.triangulatedDistanceMeasurement.distance);this.viewModel.triangulatedDistanceAccuracy={distanceAccuracy:s,angleAccuracy:e}}break}case"area":if(c?.geometry.spatialReference){const e=await m(this.viewModel.measurementVectors,c.geometry.spatialReference);a(t),this.viewModel.triangulatedAreaMeasurement=e}}if(this.viewModel.updatingTriangularMeasurementState=!1,"panoramic"===this.viewModel.mode){this.viewModel.activeTriangulatedViewer.viewModel.restoreNavigationHandles()}}}_preventLeftMouseDrag(){const{mode:e,activeTriangulatedViewer:t}=this.viewModel;if("panoramic"!==e||!t)return;let a=null;t.imageRenderer.on("pointer-down",e=>{a=e.button}),t.imageRenderer.on("drag",e=>{0===a&&e.stopPropagation()})}};e([i()],p.prototype,"type",void 0),p=e([r("esri.widgets.OrientedImageryViewer.adapters.sketch.TriangulatedMeasurementAdapter")],p);const g=p;export{g as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Graphic.js";import{isSome as t}from"../../../../core/arrayUtils.js";import i from"../../../../core/Logger.js";import{waitTick as o,throwIfAborted as r,isAbortError as a}from"../../../../core/promiseUtils.js";import s from"../../../../geometry/Polygon.js";import{
|
|
5
|
+
import e from"../../../../Graphic.js";import{isSome as t}from"../../../../core/arrayUtils.js";import i from"../../../../core/Logger.js";import{waitTick as o,throwIfAborted as r,isAbortError as a}from"../../../../core/promiseUtils.js";import s from"../../../../geometry/Polygon.js";import{projectAsync as n}from"../../../../geometry/projectionUtils.js";import{convertOrientationToPixelLocation as l}from"../../../../layers/orientedImagery/transformations/utils.js";import{fixedImageSize as c}from"../../constants.js";import{activePolygonSymbol as p,polygonSymbol as u}from"../../symbols.js";class m{constructor(m){this.viewModel=m,this.createFootprints=async t=>{await o(t);const{coveragePolygons:i,currentBestFeature:r,isAdditionalCoverageVisible:a}=this.viewModel;for(const o of i)o?.imageID===r.attributes.objectId?this.viewModel.bestFeatureFootprint=new e({attributes:{imageID:o?.imageID},geometry:o,symbol:p,visible:!1}):this.viewModel.additionalFootprints.push(new e({attributes:{imageID:o?.imageID},geometry:o,symbol:u.clone(),visible:a}))},this.updateFootprint=async(o,l,u)=>{const{activeViewer:m,mode:d,currentBestFeature:g,currentCoverageVisible:v,footprintExtent:f}=this.viewModel,w="video"===d?c:m?.imageSize,h=l??g;if(g&&w&&f&&h)try{const i=await this.viewModel.getMapPoint(o,{feature:h,mode:"default",imageSize:w});r(u);const a=i.filter(t);if(!a.length)return;const l=[a.map(({x:e,y:t})=>[e,t,1])];l[0].push(l[0][0]);const c=new s({rings:l,spatialReference:a[0].spatialReference}),m=this.viewModel.view?.spatialReference.equals(c.spatialReference)?c:await n(c,this.viewModel.view.spatialReference,u);this.viewModel.updateCurrentCoveragePolygon(new e({geometry:m,attributes:{imageID:h.attributes.objectId},symbol:p,visible:v}))}catch(y){a(y)||i.getLogger(this.viewModel).error("update-footprint",y)}else this.viewModel.updateCurrentCoveragePolygon(null)},this.updateFootprintPanorama=async(t,i)=>{const{horizontalFieldOfView:o,pitch:a,verticalFieldOfView:u,yaw:m,feature:d}=t,{activeViewer:g,currentBestFeature:v,currentCoverageVisible:f,footprintExtent:w,mode:h}=this.viewModel,y="video"===h||"panoramic-video"===h?c:g?.imageSize,b=d??v;if(!b||!y||!w)return void this.viewModel.updateCurrentCoveragePolygon(null);const{cameraPitch:M,objectId:C}=b.attributes;if(a+M-u/2>180)return void this.viewModel.updateCurrentCoveragePolygon(null);const j=[],P=u/2,F=o/2,I=a-P,R=M+I,D=M+(a+P);if(R>180)return void this.viewModel.updateCurrentCoveragePolygon(null);const V=I<0,x=[-F,P],z=[F,P],S=[F,-P],B=[-F,-P];if(R<180&&D>180){j.push(V?S:B);const e=Math.floor(o/5),t=o/e;for(let i=0;i<=e;i++)j.push([i*t-F,90-a]);j.push(V?B:S)}D<180&&(j.push(x,z),V?j.push(B,S):j.push(S,B));const U=j.map(([e,t])=>l(m+e,a+t,y[0],y[1])),q=await this.viewModel.getMapPoint(U,{feature:b,mode:"panorama",imageSize:y});r(i);const E=[q.map(({x:e,y:t})=>[e,t,1])];E[0].push(E[0][0]);const L=new s({rings:E,spatialReference:q[0].spatialReference}),O=this.viewModel.view?.spatialReference.equals(L.spatialReference)?L:await n(L,this.viewModel.view.spatialReference,i);this.viewModel.updateCurrentCoveragePolygon(new e({geometry:O,attributes:{imageID:C},symbol:p.clone(),visible:f}))}}}export{m as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Graphic.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{throwIfAborted as i,waitTick as o}from"../../../../core/promiseUtils.js";import a from"../../../../geometry/Mesh.js";import r from"../../../../geometry/Point.js";import{
|
|
5
|
+
import e from"../../../../Graphic.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{throwIfAborted as i,waitTick as o}from"../../../../core/promiseUtils.js";import a from"../../../../geometry/Mesh.js";import r from"../../../../geometry/Point.js";import{projectAsync as s}from"../../../../geometry/projectionUtils.js";import{MeshVertexAttributes as n}from"../../../../geometry/support/MeshVertexAttributes.js";import{projectVertices as l,updateFrustum as c,createCoveragePolygon as p}from"../../../../layers/orientedImagery/core/coverageUtils.js";import{getMetersPerUnitOfSR as m}from"../../../../layers/orientedImagery/core/utils.js";import{fixedImageSize as u}from"../../constants.js";import{activeFrustumSymbol as f,additionalFrustumSymbol as d}from"../../symbols.js";class v{constructor(r){this.viewModel=r,this._updateBestFeatureFootprintElevation=!1,this._updatedElevationSampler=null,this.createFootprints=async o=>{const{coverageFrustums:r,currentBestFeature:c,isAdditionalCoverageVisible:p,view:m}=this.viewModel,u=r.filter(t);for(const t of u){let r=t.clone();if(!m.spatialReference.equals(r.spatialReference)){const{components:e,spatialReference:t,origin:c,vertexAttributes:p,vertexSpace:u}=r;if("local"===u.type){const e=await s(c,m.spatialReference,o);i(o),r.centerAt(e)}else{const s=p.position,c=Float64Array.from(await l([...s],t.clone(),m.spatialReference.clone(),o));i(o),r=new a({vertexAttributes:new n({position:c}),components:e,spatialReference:m.spatialReference.clone()})}}t.imageID===c.attributes.objectId?(this._updateBestFeatureFootprintElevation=!0,this.viewModel.bestFeatureFootprint=new e({attributes:{imageID:t.imageID},geometry:r,symbol:f.clone(),visible:!1})):this.viewModel.additionalFootprints.push(new e({attributes:{imageID:t.imageID},geometry:r,symbol:d.clone(),visible:p}))}},this.updateFootprint=async(o,a,r)=>{const{bestFeatureFootprint:n,currentBestFeature:l,activeViewer:p,footprintExtent:m,view:d,mode:v}=this.viewModel,y="video"===v?u:p?.imageSize,b=a??l;if(!(l&&n?.geometry&&y&&m&&b&&d?.spatialReference))return void this.viewModel.updateCurrentCoveragePolygon(null);const{attributes:{cameraHeight:F,location:R,cameraPitch:M,horizontalFieldOfView:A,verticalFieldOfView:x,cameraRoll:E},elevationSample:S}=b;let j=null;if(a&&(this._updatedElevationSampler=l.elevationSample,j=await h(a,d.spatialReference),this._updatedElevationSampler)){const e=this._updatedElevationSampler?.extent,t=a.attributes.geometry;if(e&&!e.contains(t)){const e=this.viewModel.selectedPoint;if(!e)return;e.x=a.geometry.x,e.y=a.geometry.y;const t=await this.viewModel.processFeatureElevation([a],e);t&&(this._updatedElevationSampler=t)}const[i]=g([j],this._updatedElevationSampler,a);i&&(j=i)}S&&this._updateBestFeatureFootprintElevation&&(this.updateGroundElevation([n]),this._updateBestFeatureFootprintElevation=!1);const I=R.toArray(),V=a&&j?j:n,{vertexAttributes:{position:P},spatialReference:z}=V.geometry,C=await w(P,z,R.spatialReference),_=await this.viewModel.getMapPoint(o,{feature:b,mode:"default",imageSize:y});i(r);let D=_.filter(t);if(!D.length)return;D[0].spatialReference.equals(R.spatialReference)||(D=await Promise.all(D.map(async e=>{const t=await s(e,R.spatialReference,r);return i(r),t})));const B=await c(o.map(({x:e,y:t})=>[e,t]),D.map(e=>e.toArray()),{cameraHeight:F,cameraLocation:I,cameraPitch:M,frustumVertices:C,horizontalFieldOfView:A,imageHeight:y[1],imageWidth:y[0],inSRS:{wkid:R.spatialReference.wkid},outSRS:{wkid:d.spatialReference.wkid},verticalFieldOfView:x,cameraRoll:E??0,options:r});this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:b.attributes.objectId},geometry:B,symbol:f.clone(),visible:this.viewModel.currentCoverageVisible}))},this.updateFootprintPanorama=async(t,i)=>{await o(i);const{horizontalFieldOfView:a,pitch:r,verticalFieldOfView:n,yaw:l,feature:c}=t,m=c?.clone()??this.viewModel.currentBestFeature?.clone();if(!m)return;const{attributes:u}=m;u.orientedImageryType=null,u.cameraHeading=(l+u.cameraHeading)%360,u.cameraPitch=r,u.horizontalFieldOfView=a,u.verticalFieldOfView=n,u.cameraRoll=0;const{frustum:d}=p(u);if(!d)return void this.viewModel.updateCurrentCoveragePolygon(null);const v=this.viewModel.view?.spatialReference.equals(d.spatialReference)?d.clone():await s(d.clone(),this.viewModel.view?.spatialReference,i);this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:u.objectId},geometry:v,symbol:f.clone(),visible:this.viewModel.currentCoverageVisible}))}}updateGroundElevation(e){const{geometry:t,attributes:{elevation:i}}=this.viewModel.currentBestFeature,o=(i??0)*m(t.spatialReference);e.forEach(e=>{const{geometry:t}=e;switch(t?.type){case"mesh":{const{vertexAttributes:{position:e}}=t,i=Math.floor(e.length/3);for(let a=0;a<i;a+=1)e[3*a+2]+=o/m(t.spatialReference);break}case"point":t.z=(t.z??0)+o/m(t.spatialReference)}})}}async function w(e,t,i,o){return Float64Array.from((await Promise.all(e.reduce((e,t,i)=>{const o=Math.floor(i/3);return e[o]=e[o]??[],e[o].push(t),e},new Array).map(async e=>(await s(new r(e,t),i,o)).toArray()))).flat())}const h=async(t,o,r)=>{const{frustum:c}=p(t.attributes);let m=c.clone();if(!o.equals(m.spatialReference)){const{components:e,spatialReference:t,origin:o,vertexAttributes:c,vertexSpace:p}=m;if("local"===p.type){const e=await s(o,t,r);i(r),m.centerAt(e)}else{const o=c.position,s=Float64Array.from(await l([...o],t.clone(),t.clone(),r));i(r),m=new a({vertexAttributes:new n({position:s}),components:e,spatialReference:t.clone()})}}return new e({attributes:{imageID:c.imageID},geometry:m,symbol:f.clone(),visible:!1})},g=(e,t,i)=>{const{geometry:o}=i,a=t.queryElevation(o);for(const r of e){const{geometry:e}=r;switch(e?.type){case"mesh":{const{vertexAttributes:{position:t}}=e,i=Math.floor(t.length/3);for(let e=0;e<i;e++)t[3*e+2]+=a?.z??0;break}case"point":e.z=(e.z??0)+(a?.z??0)}}return e};export{v as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{property as t,subclass as i}from"../../../core/accessorSupport/decorators.js";import o from"../../../views/MapView.js";import r from"../../Widget.js";import a from"./ImageViewerViewModel.js";import n from"./NavigationUI.js";import{loadSequentialNavigationUIComponents as s,SequentialNavigationUI as l}from"./SequentialNavigationUI.js";import{loadCalciteComponents as d}from"../../support/componentsUtils.js";import{globalCss as
|
|
5
|
+
import{__decorate as e}from"tslib";import{property as t,subclass as i}from"../../../core/accessorSupport/decorators.js";import o from"../../../views/MapView.js";import r from"../../Widget.js";import a from"./ImageViewerViewModel.js";import n from"./NavigationUI.js";import{loadSequentialNavigationUIComponents as s,SequentialNavigationUI as l}from"./SequentialNavigationUI.js";import{loadCalciteComponents as d}from"../../support/componentsUtils.js";import{globalCss as p}from"../../support/globalCss.js";import{tsx as h,vmEvent as g}from"../../support/widget.js";const c="esri-image-viewer";let u=class extends r{constructor(){super(...arguments),this.directionMode="Relative",this.navigationEnabled=!1,this.uiStrings=null,this.viewModel=new a,this._afterContainerCreate=e=>{this.imageRenderer.container=e},this.addGraphic=(e,t)=>{this.viewModel.addGraphic(e,t)},this.addManyGraphics=e=>{this.viewModel.addManyGraphics(e)},this.clearGraphics=()=>{this.viewModel.clearGraphics()},this.clearImage=()=>{this.viewModel.clearImage()},this.loadImage=async(e,t)=>this.viewModel.loadImage(e,t),this.navigate=async(e,t)=>await this.viewModel.navigate(e,t),this.removeGraphic=e=>{this.viewModel.removeGraphic(e)},this.removeManyGraphics=e=>{this.viewModel.removeManyGraphics(e)}}loadDependencies(){return Promise.all([d({panel:()=>import("@esri/calcite-components/dist/components/calcite-panel")}),s()])}get autoLoad(){return this.viewModel.autoLoad}set autoLoad(e){this.viewModel.autoLoad=e}get brightness(){return this.viewModel.brightness}set brightness(e){this.viewModel.brightness=e}get clickAction(){return this.viewModel.clickAction}set clickAction(e){this.viewModel.clickAction=e}get contrast(){return this.viewModel.contrast}set contrast(e){this.viewModel.contrast=e}get currentNode(){return this.navigationViewModel?.currentNode}get customParameters(){return this.viewModel.customParameters}set customParameters(e){this.viewModel.customParameters=e}get error(){return this.viewModel.error}get imageSize(){const e=this.viewModel.image?.serviceRasterInfo;return e?[e.width,e.height]:[0,0]}get imagePointsInView(){return this.viewModel.imagePointsInView}get imageRenderer(){return this.viewModel.imageRenderer}get imageRotation(){return this.viewModel.imageRotation}set imageRotation(e){this.viewModel.imageRotation=e}get mediaCollection(){return this.viewModel.mediaCollection}set mediaCollection(e){this.viewModel.mediaCollection=e}get navigationNodes(){return this.navigationViewModel?.navigationNodes}get navigationMode(){return this.navigationViewModel?.navigationMode}get navigationViewModel(){return this.viewModel.navigationViewModel}set navigationViewModel(e){this.viewModel.navigationViewModel=e}get sharpness(){return this.viewModel.sharpness}set sharpness(e){this.viewModel.sharpness=e}get state(){return this.viewModel.state}get ui(){return this.imageRenderer.ui}get _navigationUI(){return h(n,{cameraHeadingThreshold:this.navigationViewModel?.cameraHeadingThreshold,cameraPitchThreshold:this.navigationViewModel?.cameraPitchThreshold,currentBestFeature:this.navigationViewModel?.currentBestFeature,currentNode:this.currentNode,directionMode:this.directionMode,navigate:this.navigate,nodes:this.navigationNodes,preserveAngle:this.navigationViewModel?.preserveAngle??"none"})}get _sequentialNavigationUI(){return h(l,{layout:"horizontal",uiStrings:this.uiStrings,onAction:e=>{this.navigate(this.currentNode,e)}})}_renderNavigationUI(){switch(this.navigationMode){case"directional":return this._navigationUI;case"sequential":return this._sequentialNavigationUI;default:return null}}render(){return h("calcite-panel",{afterCreate:this._afterContainerCreate,bind:this,class:this.classes(p.widget,c),loading:this.viewModel.updating},this.navigationEnabled?this._renderNavigationUI():null)}static{this.vnodeSelector="calcite-panel"}};e([t({type:Boolean})],u.prototype,"autoLoad",null),e([t({type:Number}),t()],u.prototype,"brightness",null),e([t()],u.prototype,"clickAction",null),e([t({type:Number})],u.prototype,"contrast",null),e([t()],u.prototype,"currentNode",null),e([t({type:Object})],u.prototype,"customParameters",null),e([t()],u.prototype,"directionMode",void 0),e([t({readOnly:!0})],u.prototype,"error",null),e([t()],u.prototype,"imageSize",null),e([t({readOnly:!0})],u.prototype,"imagePointsInView",null),e([t({readOnly:!0,type:o})],u.prototype,"imageRenderer",null),e([t()],u.prototype,"imageRotation",null),e([t()],u.prototype,"mediaCollection",null),e([t({type:Boolean})],u.prototype,"navigationEnabled",void 0),e([t()],u.prototype,"navigationNodes",null),e([t()],u.prototype,"navigationMode",null),e([t()],u.prototype,"navigationViewModel",null),e([t({type:Number})],u.prototype,"sharpness",null),e([t({readOnly:!0})],u.prototype,"state",null),e([t()],u.prototype,"ui",null),e([t()],u.prototype,"uiStrings",void 0),e([g(["click","hittest-response","pixel-location"]),t({type:a})],u.prototype,"viewModel",void 0),e([t()],u.prototype,"_navigationUI",null),e([t()],u.prototype,"_sequentialNavigationUI",null),u=e([i("esri.widgets.OrientedImageryViewer.components.ImageViewer")],u);const v=u;export{v as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../Map.js";import{rotate as i}from"../../../arcade/geometry/operators.js";import r from"../../../core/Error.js";import{EventedAccessor as a}from"../../../core/Evented.js";import s from"../../../core/Logger.js";import{clamp as o}from"../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{isAbortError as l}from"../../../core/promiseUtils.js";import{watch as m,syncAndInitial as h,initial as d}from"../../../core/reactiveUtils.js";import{property as g,subclass as p}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as c}from"../../../core/support/UpdatingHandles.js";import u from"../../../geometry/Point.js";import y from"../../../geometry/Polygon.js";import v from"../../../geometry/SpatialReference.js";import{e as f}from"../../../chunks/intersectionOperator.js";import{g as _}from"../../../chunks/proximityOperator.js";import w from"../../../layers/GraphicsLayer.js";import R from"../../../layers/ImageryTileLayer.js";import x from"../../../layers/support/RasterFunction.js";import{convolutionKernel as C}from"../../../layers/support/rasterFunctionConstants.js";import I from"../../../layers/support/TileInfo.js";import b from"../../../views/MapView.js";import{getResolutionToScaleFactor as j}from"../../../views/2d/viewpointUtils.js";import{castImageSource as M,logAndThrow as P,getMissingPropertyErrorName as V,getMissingPropertyErrorMessage as k}from"../utils.js";const H={click:"click-handle",enhancements:"enhancements-handle"};let S=class extends a{constructor(e){super(e),this._imageChanged=!1,this._panConstraint=null,this._image=null,this._loadController=null,this._overlays=new w({blendMode:"source-atop"}),this._map=new t,this.autoLoad=!1,this.clickAction="none",this.error=null,this.imageSource=null,this.imageRotation=0,this.navigationManager=null,this.navigationViewModel=null,this.state="ready",this.updatingHandles=new c,this._cancelLoadWithController=()=>{this._loadController?.abort(),this._loadController=null},this._createImageHandles=()=>{this.removeHandles(H.enhancements),this.addHandles(m(()=>[this.brightness,this.contrast,this.sharpness],([e,t,i])=>{this.image?.loaded&&(this.image.effect=`contrast(${10*(t+10)}%) brightness(${10*(e+10)}%)`,this.sharpenImage(this.image,i))},h))},this._createPanConstraint=()=>{const{image:e,imageRenderer:t}=this,r=r=>{if(!(e&&t&&r.targetGeometry&&e.serviceRasterInfo))return r;const{extent:a}=e.serviceRasterInfo,{constraints:s,rotation:o,width:n,height:l}=t,{extent:m}=i(y.fromExtent(a),o,a.center.x,a.center.y),{width:h,height:d}=m,g=r.targetGeometry.clone(),p=s.scaleToZoom(r.scale),c=1/2**p,u=n/l;let v=c*h,f=c*d;p&&(h/n>d/l?f=v/u:v=f*u);const w=m.clone();return w.xmin+=v/2,w.xmax-=v/2,w.ymin+=f/2,w.ymax-=f/2,r.targetGeometry=_(y.fromExtent(w),g).coordinate,this.state="image-loaded",r};return{constrain:r,applyPanConstraint:r}},this._createResizeHandles=e=>{e.removeHandles("resize"),e.addHandles(m(()=>{if(!this.imageRenderer.ready)return;const{extent:t}=e.serviceRasterInfo,{width:r,height:a,rotation:s}=this.imageRenderer,{extent:o}=i(y.fromExtent(t),s,t.center.x,t.center.y),{width:n,height:l}=o;return Math.max(n/r,l/a)},e=>{if(!this.imageRenderer||null==e)return;const{constraints:t,scale:i,spatialReference:r}=this.imageRenderer,a=t.minScale,s=j(r),o=.25*s,n=s*e;let l=n;const m=[];for(;l>o;)m.push(l),l/=2;m.push(l);const{lods:h}=I.create({scales:m});if(t.set({minScale:n,lods:h}),this._imageChanged)return this.imageRenderer.scale=n,void(this._imageChanged=!1);this.imageRenderer.scale=Math.abs(i-a)<=1e-6?n:i},h),"resize")},this._loadImageInternal=(e,t={})=>{this.state="image-loading",this.clearImage(),this.error=null,this._imageChanged=!0;const i="string"==typeof e,r=i?void 0:e.datasetFormat,a=i?e:e.url,{customParameters:o,options:n}=t;return this._image=new R({ioConfig:{skipExtensions:["aux.xml","jgw"],skipMapInfo:!0,datasetFormat:r},url:a,customParameters:o}),this._image.when(e=>{this._updatePanConstraint(),this._createResizeHandles(e),this._map.add(e),this.state="image-loaded"},t=>{l(t)?this.state="image-load-aborted":(this.state="image-load-error",this.error=t,s.getLogger(this).error(`error occurred while loading image ${i?e:JSON.stringify(e)}`,t),this.imageSource=null)}),this._image.load(n)},this._loadWithController=()=>{this._cancelLoadWithController(),this._loadController=new AbortController,this.loadImage(this._loadController)},this._loadNavigationManager=async()=>{if(!this.navigationManager||this.navigationManager?.destroyed){const e=await import("../navigation/NavigationManager.js").then(e=>e.default);this.navigationManager=new e({viewModel:this.navigationViewModel})}return this.navigationManager},this._updatePanConstraint=()=>{this._panConstraint&&this.imageRenderer.constraints.customConstraints.remove(this._panConstraint),this._panConstraint=this._createPanConstraint(),this.imageRenderer.constraints.customConstraints.add(this._panConstraint)},this.addGraphic=(e,t)=>{this._overlays.graphics.add(e,t)},this.addManyGraphics=e=>{this._overlays.addMany(e)},this.clearGraphics=()=>{this._overlays.graphics.removeAll()},this.clearImage=()=>{this.image&&(this._map.layers.remove(this.image),this._image=n(this._image))},this.loadImage=e=>{const{customParameters:t,imageSource:i}=this;return i?this._loadImageInternal(i,{customParameters:t,options:e}):P(this.declaredClass,new r(V("image-viewer"),k("ImageViewerViewModel","imageSource")))},this.navigate=async(e,t)=>this.updatingHandles.addPromise(this.navigateInternal(e,t)),this.navigateInternal=async(e,t)=>{const i=await this._loadNavigationManager();return await i.navigate(e,t)},this.removeGraphic=e=>{this._overlays.remove(e)},this.removeManyGraphics=e=>{this._overlays.removeMany(e)},this._imageRenderer=new b({constraints:{snapToZoom:!0,rotationEnabled:!1},map:this._map,popupEnabled:!1,spatialReference:v.WebMercator,attributionVisible:!1})}destroy(){this._imageRenderer.destroy()}initialize(){this.state="initialized",this.addHandles([m(()=>this.imageSource,e=>{e&&this.autoLoad&&this._loadWithController()},h),m(()=>this.image?.loaded,()=>{this._createImageHandles()}),m(()=>this.imageRotation,()=>{this._rotateImage()}),m(()=>this.imageRenderer.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},d),m(()=>this.imageRenderer.map.allLayers.length,e=>{e&&this.imageRenderer.map.layers.reorder(this._overlays,e-1)},h),m(()=>this.clickAction,e=>{this.removeHandles(H.click),"none"!==e&&this.addHandles(this.imageRenderer.on("click",t=>{if(this.image?.loaded&&this.imageRenderer.ready)switch(e){case"emit":t.stopPropagation(),this.emit("click",t);break;case"hittest":t.stopPropagation(),t.defer(async()=>{const e=await this.imageRenderer.hitTest(t.screenPoint,{include:this._overlays});e.results=e.results.filter(e=>"graphic"===e.type),this.emit("hittest-response",e)});break;case"pixel-location":{if(t.stopPropagation(),!this.image?.serviceRasterInfo||!t.mapPoint)return void this.emit("pixel-location",null);const{extent:e,pixelSize:i}=this.image.serviceRasterInfo,r=(t.mapPoint.x-e.xmin)*i.x,a=(e.ymax-t.mapPoint.y)*i.y,s=new u({x:r,y:a,spatialReference:e.spatialReference});this.emit("pixel-location",s);break}}}))},h)])}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",o(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",o(e,-10,10))}get currentNode(){return this.navigationViewModel?.currentNode}get image(){return this._image}get imagePointsInView(){const{extent:e,ready:t}=this.imageRenderer,r=this.imageRotation,a=this.image?.fullExtent,s=this.image?.serviceRasterInfo,o=!0===this._imageRenderer.allLayerViews.find(({layer:e})=>e===this.image)?.attached;if(!(t&&e&&a&&s&&o))return null;const n=i(y.fromExtent(e),r,e.center.x,e.center.y),l=y.fromExtent(a),m=f(n,l),{rings:h}=m;return h.flat().map(([e,t])=>({x:(e-s.extent.xmin)*s.pixelSize.x,y:(s.extent.ymax-t)*s.pixelSize.y}))}get imageSize(){const{image:e}=this;if(!e?.raster)return null;const{width:t,height:i}=e.raster.rasterInfo;return[t,i]}get imageRenderer(){return this._imageRenderer}get imageView(){return this.imageRenderer.allLayerViews.find(e=>e.layer===this.image)}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",o(e,0,1))}get updating(){return this.updatingHandles.updating}_rotateImage(){this.imageRenderer.constraints.rotationEnabled=!0,this.imageRenderer.rotation=this.imageRotation,this.imageRenderer.constraints.rotationEnabled=!1}sharpenImage(e,t){if(!t)return void(e.rasterFunction=null);const i=[0,-1*t,0,-1*t,4*t+1,-1*t,0,-1*t,0],r=new x({functionName:"Convolution",functionArguments:{type:C.userDefined,cols:3,rows:3,kernel:i,convolutionType:C.userDefined}});e.rasterFunction=r}};e([g()],S.prototype,"_image",void 0),e([g()],S.prototype,"_imageRenderer",void 0),e([g()],S.prototype,"_loadController",void 0),e([g()],S.prototype,"_overlays",void 0),e([g()],S.prototype,"_map",void 0),e([g({type:Boolean})],S.prototype,"autoLoad",void 0),e([g({type:Number})],S.prototype,"brightness",null),e([g()],S.prototype,"clickAction",void 0),e([g({type:Number})],S.prototype,"contrast",null),e([g()],S.prototype,"currentNode",null),e([g({type:Object})],S.prototype,"customParameters",void 0),e([g({type:r})],S.prototype,"error",void 0),e([g({readOnly:!0})],S.prototype,"image",null),e([g({readOnly:!0})],S.prototype,"imagePointsInView",null),e([g({readOnly:!0})],S.prototype,"imageSize",null),e([g({cast:M})],S.prototype,"imageSource",void 0),e([g({readOnly:!0})],S.prototype,"imageRenderer",null),e([g({type:Number})],S.prototype,"imageRotation",void 0),e([g()],S.prototype,"imageView",null),e([g()],S.prototype,"navigationManager",void 0),e([g()],S.prototype,"navigationViewModel",void 0),e([g({type:Number})],S.prototype,"sharpness",null),e([g()],S.prototype,"state",void 0),e([g()],S.prototype,"updatingHandles",void 0),e([g()],S.prototype,"updating",null),S=e([p("esri.widgets.OrientedImageryViewer.components.ImageViewerViewModel")],S);const E=S;export{E as default};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../Map.js";import{rotate as i}from"../../../arcade/geometry/operators.js";import r from"../../../core/Error.js";import{EventedAccessor as a}from"../../../core/Evented.js";import o from"../../../core/Logger.js";import{clamp as s}from"../../../core/mathUtils.js";import{destroyMaybe as n}from"../../../core/maybe.js";import{throwIfAborted as l,isAbortError as h}from"../../../core/promiseUtils.js";import{watch as m,syncAndInitial as d,when as g,initial as p}from"../../../core/reactiveUtils.js";import{property as c,subclass as y}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as u}from"../../../core/support/UpdatingHandles.js";import v from"../../../geometry/Point.js";import _ from"../../../geometry/Polygon.js";import f from"../../../geometry/SpatialReference.js";import{e as R}from"../../../chunks/intersectionOperator.js";import{g as w}from"../../../chunks/proximityOperator.js";import x from"../../../layers/GraphicsLayer.js";import C from"../../../layers/support/RasterFunction.js";import{convolutionKernel as b}from"../../../layers/support/rasterFunctionConstants.js";import I from"../../../layers/support/TileInfo.js";import M from"../../../views/MapView.js";import{getResolutionToScaleFactor as j}from"../../../views/2d/viewpointUtils.js";import P from"../support/NonPanoramicMediaCollection.js";const H={click:"click-handle",enhancements:"enhancements-handle"};let V=class extends a{constructor(e){super(e),this._imageChanged=!1,this._panConstraint=null,this._image=null,this._loadController=null,this._overlays=new x({blendMode:"source-atop"}),this._map=new t,this.autoLoad=!1,this.clickAction="none",this.error=null,this.imageRotation=0,this.mediaCollection=new P,this.navigationManager=null,this.navigationViewModel=null,this.state="ready",this.updatingHandles=new u,this._cancelLoadWithController=()=>{this._loadController?.abort(),this._loadController=null},this._createImageHandles=()=>{this.removeHandles(H.enhancements),this.addHandles(m(()=>[this.brightness,this.contrast,this.sharpness],([e,t,i])=>{this.image?.loaded&&(this.image.effect=`contrast(${10*(t+10)}%) brightness(${10*(e+10)}%)`,this.sharpenImage(this.image,i))},d))},this._createPanConstraint=()=>{const{image:e,imageRenderer:t}=this,r=r=>{if(!(e&&t&&r.targetGeometry&&e.serviceRasterInfo))return r;const{extent:a}=e.serviceRasterInfo,{constraints:o,rotation:s,width:n,height:l}=t,{extent:h}=i(_.fromExtent(a),s,a.center.x,a.center.y),{width:m,height:d}=h,g=r.targetGeometry.clone(),p=o.scaleToZoom(r.scale),c=1/2**p,y=n/l;let u=c*m,v=c*d;p&&(m/n>d/l?v=u/y:u=v*y);const f=h.clone();return f.xmin+=u/2,f.xmax-=u/2,f.ymin+=v/2,f.ymax-=v/2,r.targetGeometry=w(_.fromExtent(f),g).coordinate,this.state="image-loaded",r};return{constrain:r,applyPanConstraint:r}},this._createResizeHandles=e=>{e.removeHandles("resize"),e.addHandles(m(()=>{if(!this.imageRenderer.ready)return;const{extent:t}=e.serviceRasterInfo,{width:r,height:a,rotation:o}=this.imageRenderer,{extent:s}=i(_.fromExtent(t),o,t.center.x,t.center.y),{width:n,height:l}=s;return Math.max(n/r,l/a)},e=>{if(!this.imageRenderer||null==e)return;const{constraints:t,scale:i,spatialReference:r}=this.imageRenderer,a=t.minScale,o=j(r),s=.25*o,n=o*e;let l=n;const h=[];for(;l>s;)h.push(l),l/=2;h.push(l);const{lods:m}=I.create({scales:h});if(t.set({minScale:n,lods:m}),this._imageChanged)return this.imageRenderer.scale=n,void(this._imageChanged=!1);this.imageRenderer.scale=Math.abs(i-a)<=1e-6?n:i},d),"resize")},this._loadImageInternal=async(e,t)=>{this.state="image-loading",this.clearImage(),this.error=null,this._imageChanged=!0;const i="number"==typeof e?this.mediaCollection.getItemAt(e):e;if(!i)throw new Error("No media to load");try{await i.load(t),l(t),this._image=i.layer,this._updatePanConstraint(),this._createResizeHandles(this._image),this._map.add(this._image),this.imageRotation=i.rotation??0,this.state="image-loaded"}catch(r){h(r)?this.state="image-load-aborted":(this.state="image-load-error",this.error=r,o.getLogger(this).error(`error occurred while loading image ${this._image?.url}`,r),this._image=null)}return this._image},this._loadWithController=()=>{this._cancelLoadWithController(),this._loadController=new AbortController,this._loadImageInternal(0,this._loadController)},this._loadNavigationManager=async()=>{if(!this.navigationManager||this.navigationManager?.destroyed){const e=await import("../navigation/NavigationManager.js").then(e=>e.default);this.navigationManager=new e({viewModel:this.navigationViewModel})}return this.navigationManager},this._updatePanConstraint=()=>{this._panConstraint&&this.imageRenderer.constraints.customConstraints.remove(this._panConstraint),this._panConstraint=this._createPanConstraint(),this.imageRenderer.constraints.customConstraints.add(this._panConstraint)},this.addGraphic=(e,t)=>{this._overlays.graphics.add(e,t)},this.addManyGraphics=e=>{this._overlays.addMany(e)},this.clearGraphics=()=>{this._overlays.graphics.removeAll()},this.clearImage=()=>{this.image&&(this._map.layers.remove(this.image),this._image=n(this._image))},this.loadImage=(e,t)=>this._loadImageInternal(e,t),this.navigate=async(e,t)=>this.updatingHandles.addPromise(this.navigateInternal(e,t)),this.navigateInternal=async(e,t)=>{const i=await this._loadNavigationManager();return await i.navigate(e,t)},this.removeGraphic=e=>{this._overlays.remove(e)},this.removeManyGraphics=e=>{this._overlays.removeMany(e)},this._imageRenderer=new M({constraints:{snapToZoom:!0,rotationEnabled:!1},map:this._map,popupEnabled:!1,spatialReference:f.WebMercator,attributionVisible:!1})}destroy(){this._imageRenderer.destroy()}initialize(){this.state="initialized",this.addHandles([g(()=>this.mediaCollection?.length>0,()=>{this.autoLoad&&this._loadWithController()},d),m(()=>this.image?.loaded,()=>{this._createImageHandles()}),m(()=>this.imageRotation,()=>{this._rotateImage()}),m(()=>this.imageRenderer.map,(e,t)=>{t?.layers.remove(this._overlays),e?.layers.add(this._overlays)},p),m(()=>this.imageRenderer.map.allLayers.length,e=>{e&&this.imageRenderer.map.layers.reorder(this._overlays,e-1)},d),m(()=>this.clickAction,e=>{this.removeHandles(H.click),"none"!==e&&this.addHandles(this.imageRenderer.on("click",t=>{if(this.image?.loaded&&this.imageRenderer.ready)switch(e){case"emit":t.stopPropagation(),this.emit("click",t);break;case"hittest":t.stopPropagation(),t.defer(async()=>{const e=await this.imageRenderer.hitTest(t.screenPoint,{include:this._overlays});e.results=e.results.filter(e=>"graphic"===e.type),this.emit("hittest-response",e)});break;case"pixel-location":{if(t.stopPropagation(),!this.image?.serviceRasterInfo||!t.mapPoint)return void this.emit("pixel-location",null);const{extent:e,pixelSize:i}=this.image.serviceRasterInfo,r=(t.mapPoint.x-e.xmin)*i.x,a=(e.ymax-t.mapPoint.y)*i.y,o=new v({x:r,y:a,spatialReference:e.spatialReference});this.emit("pixel-location",o);break}}}))},d)])}get brightness(){return this._get("brightness")??0}set brightness(e){this._set("brightness",s(e,-10,10))}get contrast(){return this._get("contrast")??0}set contrast(e){this._set("contrast",s(e,-10,10))}get currentNode(){return this.navigationViewModel?.currentNode}get image(){return this._image}get imagePointsInView(){const{extent:e,ready:t}=this.imageRenderer,r=this.imageRotation,a=this.image?.fullExtent,o=this.image?.serviceRasterInfo,s=!0===this._imageRenderer.allLayerViews.find(({layer:e})=>e===this.image)?.attached;if(!(t&&e&&a&&o&&s))return null;const n=i(_.fromExtent(e),r,e.center.x,e.center.y),l=_.fromExtent(a),h=R(n,l),{rings:m}=h;return m.flat().map(([e,t])=>({x:(e-o.extent.xmin)*o.pixelSize.x,y:(o.extent.ymax-t)*o.pixelSize.y}))}get imageSize(){const{image:e}=this;if(!e?.raster)return null;const{width:t,height:i}=e.raster.rasterInfo;return[t,i]}get imageRenderer(){return this._imageRenderer}get imageView(){return this.imageRenderer.allLayerViews.find(e=>e.layer===this.image)}get sharpness(){return this._get("sharpness")??0}set sharpness(e){this._set("sharpness",s(e,0,1))}get updating(){return this.updatingHandles.updating}_rotateImage(){this.imageRenderer.constraints.rotationEnabled=!0,this.imageRenderer.rotation=this.imageRotation,this.imageRenderer.constraints.rotationEnabled=!1}sharpenImage(e,t){if(!t)return void(e.rasterFunction=null);const i=[0,-1*t,0,-1*t,4*t+1,-1*t,0,-1*t,0],r=new C({functionName:"Convolution",functionArguments:{type:b.userDefined,cols:3,rows:3,kernel:i,convolutionType:b.userDefined}});e.rasterFunction=r}};e([c()],V.prototype,"_image",void 0),e([c()],V.prototype,"_imageRenderer",void 0),e([c()],V.prototype,"_loadController",void 0),e([c()],V.prototype,"_overlays",void 0),e([c()],V.prototype,"_map",void 0),e([c({type:Boolean})],V.prototype,"autoLoad",void 0),e([c({type:Number})],V.prototype,"brightness",null),e([c()],V.prototype,"clickAction",void 0),e([c({type:Number})],V.prototype,"contrast",null),e([c()],V.prototype,"currentNode",null),e([c({type:Object})],V.prototype,"customParameters",void 0),e([c({type:r})],V.prototype,"error",void 0),e([c({readOnly:!0})],V.prototype,"image",null),e([c({readOnly:!0})],V.prototype,"imagePointsInView",null),e([c({readOnly:!0})],V.prototype,"imageSize",null),e([c({readOnly:!0})],V.prototype,"imageRenderer",null),e([c({type:Number})],V.prototype,"imageRotation",void 0),e([c()],V.prototype,"imageView",null),e([c({type:P})],V.prototype,"mediaCollection",void 0),e([c()],V.prototype,"navigationManager",void 0),e([c()],V.prototype,"navigationViewModel",void 0),e([c({type:Number})],V.prototype,"sharpness",null),e([c()],V.prototype,"state",void 0),e([c()],V.prototype,"updatingHandles",void 0),e([c()],V.prototype,"updating",null),V=e([y("esri.widgets.OrientedImageryViewer.components.ImageViewerViewModel")],V);const k=V;export{k as default};
|