/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{__decorate as e}from"tslib";import{substitute as t}from"../../../intl.js";import{createLength as r,createAngle as a}from"../../../core/quantity.js";import{formatLength as n,formatAngle as s}from"../../../core/quantityFormatUtils.js";import{subclass as i}from"../../../core/accessorSupport/decorators.js";import{getMetersPerUnitOfSR as c}from"../../../layers/orientedImagery/core/utils.js";import{copyToClipboard as u,getConvertedArea as o}from"../imageMeasurementUtils.js";import{ImageMeasurementMixin as g}from"./ImageMeasurementMixin.js";const m=m=>{const l=g(m);let d=class extends l{copyActiveMeasurementResults(e,t){t?this.copyTriangularMeasurementResult(e):this.copyGroundMeasurementResult(e)}copyGroundMeasurementResult(e){let r,a;switch(e){case"area":r={measurement:this.getConvertedAreaString("measurement"),accuracy:this.getConvertedAreaString("accuracy")},a="{measurement} ± {accuracy}";break;case"distance":r={measurement:this.getConvertedDistanceString("measurement"),accuracy:this.getConvertedDistanceString("accuracy")},a="{measurement} ± {accuracy}";break;case"height":r={measurement:this.getConvertedHeightString("measurement"),accuracy:this.getConvertedHeightString("accuracy")},a="{measurement} ± {accuracy}"}const n=t(a,r);u(n)}copyTriangularMeasurementResult(e){let t=null;switch(e){case"area":t=this.copyTriangularAreaMeasurements();break;case"distance":t=this.copyTriangularDistanceMeasurements()}t&&u(t)}copyTriangularAreaMeasurements(){const e={measurement:this.getConvertedTriangularAreaString("measurement"),accuracy:this.getConvertedTriangularAreaString("accuracy")};return t("{measurement} ± {accuracy}",e)}copyTriangularDistanceMeasurements(){const{oiViewModel:e}=this,{triangulatedDistanceMeasurement:r,triangulatedDistanceAccuracy:a}=e;if(!r)return;const{distance:n,horizontalDistance:s,verticalDistance:i,slope:c,aspect:u}=r,{distanceAccuracy:o=0,angleAccuracy:g=0}=a??{},m={distance:this.getConvertedTriangularDistanceMeasurementString(n),distanceAccuracy:this.getConvertedTriangularDistanceMeasurementString(o,!0),horizontal:this.getConvertedTriangularDistanceMeasurementString(s),vertical:this.getConvertedTriangularDistanceMeasurementString(i),slope:this.getConvertedTriangularDistanceAngularResultsString(c),angleAccuracy:this.getConvertedTriangularDistanceAngularResultsString(g),aspect:this.getConvertedTriangularDistanceAngularResultsString(u)};return t(" Distance : {distance} ± {distanceAccuracy} , Horizontal : {horizontal} ± {distanceAccuracy}, Vertical : {vertical} ± {distanceAccuracy}, Slope : {slope} ± {angleAccuracy}, Aspect : {aspect} ± {angleAccuracy}",m)}getConvertedTriangularDistanceMeasurementString(e,t=!1){const{measurementUnitMessages:a,pixelMeasurementUnit:s,oiViewModel:{currentBestFeature:i}}=this;if(!i)return;const u=t?e:e*c(i.attributes.location.spatialReference);return n(a,r(u,"meters"),s,3)||null}getConvertedTriangularDistanceAngularResultsString(e){return s(a(e,"degrees"),"arithmetic",3)||null}getConvertedTriangularAreaString(e){const{oiViewModel:t,measurementUnitMessages:r,pixelAreaMeasurementUnit:a,messages:n}=this,{triangulatedAreaAccuracy:s,triangulatedAreaMeasurement:i}=t;return o(e,i,s,r,a)??n.startMeasurement}};return d=e([i("esri.widgets.OrientedImageryViewer.mixins.TriangulatedImageMeasurementMixin")],d),d};export{m as TriangulatedImageMeasurementMixin};
