/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
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 g}from"../imageMeasurementUtils.js";import{ImageMeasurementMixin as o}from"./ImageMeasurementMixin.js";const l=l=>{const m=o(l);let d=class extends m{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,messages:r}=this,{triangulatedDistanceMeasurement:a,triangulatedDistanceAccuracy:n}=e;if(!a)return;const{distance:s,horizontalDistance:i,verticalDistance:c,slope:u,aspect:g}=a,{distanceAccuracy:o=0,angleAccuracy:l=0}=n??{},m={distance:this.getConvertedTriangularDistanceMeasurementString(s),distanceAccuracy:this.getConvertedTriangularDistanceMeasurementString(o,!0),horizontal:this.getConvertedTriangularDistanceMeasurementString(i),vertical:this.getConvertedTriangularDistanceMeasurementString(c),slope:this.getConvertedTriangularDistanceAngularResultsString(u),angleAccuracy:this.getConvertedTriangularDistanceAngularResultsString(l),aspect:this.getConvertedTriangularDistanceAngularResultsString(g),distanceString:r.distance,horizontalString:r.horizontal,verticalString:r.vertical,slopeString:r.slope,aspectString:r.aspect};return t(" {distanceString} : {distance} ± {distanceAccuracy} , {horizontalString} : {horizontal} ± {distanceAccuracy}, {verticalString} : {vertical} ± {distanceAccuracy}, {slopeString} : {slope} ± {angleAccuracy}, {aspectString} : {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 g(e,i,s,r,a)??n.startMeasurement}};return d=e([i("esri.widgets.OrientedImageryViewer.mixins.TriangulatedImageMeasurementMixin")],d),d};export{l as TriangulatedImageMeasurementMixin};
