9 #include "MeasureValidationResults.h"
16 MeasureValidationResults::MeasureValidationResults() {
21 errorMsg =
new QString();
25 MeasureValidationResults::~MeasureValidationResults() {
26 if (failures != NULL) {
30 if (errorMsg != NULL) {
37 bool MeasureValidationResults::isValid() {
38 return failures->size() == 0;
42 bool MeasureValidationResults::getValidStatus(Option opt) {
43 return !failures->contains(opt);
47 QString MeasureValidationResults::toString() {
48 return ((errorMsg->isEmpty()) ?
"succeeded" : (*errorMsg));
52 QString MeasureValidationResults::toString(QString serialNumber, QString pointID) {
53 return "Control Measure with Serial Number " + serialNumber +
54 " in Control Point " + pointID +
" " +
55 ((errorMsg->isEmpty()) ?
"succeeded" : (*errorMsg));
59 QString MeasureValidationResults::toString(QString sample, QString line,
60 QString serialNumber, QString pointID) {
61 return "Control Measure with position (" + sample +
", " + line +
62 ") of Serial Number " + serialNumber +
63 " in Control Point " + pointID +
" " +
64 ((errorMsg->isEmpty()) ?
"succeeded" : (*errorMsg));
68 void MeasureValidationResults::addFailure(Option opt,
double tolerance,
const char* compare) {
69 failures->push_back(opt);
71 QString failureReason = getFailurePrefix(opt) +
"is " + compare +
" than tolerance " +
72 QString::number(tolerance);
73 errorMsg->append(failureReason);
77 void MeasureValidationResults::addFailure(Option opt,
double computed,
double min,
double max) {
78 failures->push_back(opt);
80 QString failureReason = getFailurePrefix(opt) + QString::number(computed) +
81 " is outside range [" + QString::number(min) +
", " +
82 QString::number(max) +
"]";
83 errorMsg->append(failureReason);
87 QString MeasureValidationResults::getFailurePrefix(Option opt) {
88 QString optString =
"\n ";
91 optString +=
"Emission Angle";
94 optString +=
"Incidence Angle";
97 optString +=
"DN Value";
100 optString +=
"Resolution";
103 optString +=
"Pixels From Edge";
106 optString +=
"Meters From Edge";
109 optString +=
"Sample Residual";
112 optString +=
"Line Residual";
114 case ResidualMagnitude:
115 optString +=
"Residual Magnitude";
118 optString +=
"Sample Shift";
121 optString +=
"Line Shift";
124 optString +=
"Pixel Shift";
129 return ((errorMsg->isEmpty()) ?
"failed: " :
"") + optString;