26 #include <QStringList> 43 ControlMeasure::ControlMeasure() {
45 p_serialNumber =
new QString;
46 p_chooserName =
new QString;
47 p_dateTime =
new QString;
50 p_measureType = Candidate;
52 p_jigsawRejected =
false;
66 p_serialNumber =
new QString(*other.p_serialNumber);
68 p_dateTime =
new QString(*other.p_dateTime);
72 p_measureType = other.p_measureType;
75 p_ignore = other.p_ignore;
78 p_diameter = other.p_diameter;
85 p_camera = other.p_camera;
90 void ControlMeasure::InitializeToNull() {
95 p_serialNumber = NULL;
101 p_aprioriSample =
Null;
102 p_aprioriLine =
Null;
103 p_computedEphemerisTime =
Null;
104 p_sampleSigma =
Null;
106 p_sampleResidual =
Null;
107 p_lineResidual =
Null;
110 p_focalPlaneMeasuredX =
Null;
111 p_focalPlaneMeasuredY =
Null;
112 p_focalPlaneComputedX =
Null;
113 p_focalPlaneComputedY =
Null;
114 p_measuredEphemerisTime =
Null;
123 ControlMeasure::~ControlMeasure() {
124 if (p_serialNumber) {
125 delete p_serialNumber;
126 p_serialNumber = NULL;
130 delete p_chooserName;
131 p_chooserName = NULL;
147 ControlMeasure::Status ControlMeasure::SetAprioriLine(
double aprioriLine) {
149 return MeasureLocked;
152 p_aprioriLine = aprioriLine;
157 ControlMeasure::Status ControlMeasure::SetAprioriSample(
158 double aprioriSample) {
160 return MeasureLocked;
163 p_aprioriSample = aprioriSample;
182 ControlMeasure::Status ControlMeasure::SetCamera(
Isis::Camera *camera) {
200 ControlMeasure::Status ControlMeasure::SetCubeSerialNumber(QString newSerialNumber) {
202 return MeasureLocked;
203 *p_serialNumber = newSerialNumber;
209 ControlMeasure::Status ControlMeasure::SetChooserName() {
211 return MeasureLocked;
218 ControlMeasure::Status ControlMeasure::SetChooserName(QString name) {
220 return MeasureLocked;
221 *p_chooserName = name;
232 ControlMeasure::Status ControlMeasure::SetCoordinate(
double sample,
234 return SetCoordinate(sample, line, GetType());
245 ControlMeasure::Status ControlMeasure::SetCoordinate(
double sample,
248 return MeasureLocked;
260 ControlMeasure::Status ControlMeasure::SetDateTime() {
262 return MeasureLocked;
263 *p_dateTime = Application::DateTime();
269 ControlMeasure::Status ControlMeasure::SetDateTime(QString datetime) {
271 return MeasureLocked;
272 *p_dateTime = datetime;
285 ControlMeasure::Status ControlMeasure::SetDiameter(
double diameter) {
287 return MeasureLocked;
289 p_diameter = diameter;
294 ControlMeasure::Status ControlMeasure::SetEditLock(
bool editLock) {
295 p_editLock = editLock;
312 ControlMeasure::Status ControlMeasure::SetFocalPlaneMeasured(
double x,
314 p_focalPlaneMeasuredX = x;
315 p_focalPlaneMeasuredY = y;
332 ControlMeasure::Status ControlMeasure::SetFocalPlaneComputed(
double x,
334 p_focalPlaneComputedX = x;
335 p_focalPlaneComputedY = y;
356 ControlMeasure::Status ControlMeasure::SetRejected(
bool reject) {
358 p_jigsawRejected = reject;
363 ControlMeasure::Status ControlMeasure::SetIgnored(
bool newIgnoreStatus) {
365 return MeasureLocked;
368 bool oldStatus = p_ignore;
369 p_ignore = newIgnoreStatus;
372 Parent()->emitMeasureModified(
this, IgnoredModified, oldStatus, p_ignore);
376 if (oldStatus != p_ignore) {
378 if (parentPoint && !parentPoint->IsIgnored() && parentPoint->Parent()) {
379 ControlNet * cnet = parentPoint->Parent();
380 p_ignore ? cnet->measureIgnored(
this) : cnet->measureUnIgnored(
this);
381 cnet->emitNetworkStructureModified();
390 ControlMeasure::Status ControlMeasure::SetLineSigma(
double lineSigma) {
392 return MeasureLocked;
394 p_lineSigma = lineSigma;
412 ControlMeasure::Status ControlMeasure::SetResidual(
double sampResidual,
413 double lineResidual) {
417 p_sampleResidual = sampResidual;
418 p_lineResidual = lineResidual;
423 ControlMeasure::Status ControlMeasure::SetSampleSigma(
double sampleSigma) {
425 return MeasureLocked;
427 p_sampleSigma = sampleSigma;
433 ControlMeasure::Status ControlMeasure::SetType(
MeasureType type) {
435 return MeasureLocked;
438 p_measureType = type;
450 QString msg =
"Cannot set log data with invalid information stored in " 451 "the ControlMeasureLogData";
458 p_loggedData->append(data);
468 void ControlMeasure::DeleteLogData(
long dataType) {
469 for (
int i = p_loggedData->size()-1; i >= 0; i--) {
473 p_loggedData->remove(i);
482 QVariant ControlMeasure::GetLogValue(
long dataType)
const {
483 for (
int i = 0; i < p_loggedData->size(); i++) {
499 bool ControlMeasure::HasLogData(
long dataType)
const {
500 for (
int i = 0; i < p_loggedData->size(); i++) {
518 bool updated =
false;
520 for (
int i = 0; i < p_loggedData->size(); i++) {
524 (*p_loggedData)[i] = newLogData;
530 QString msg =
"Unable to update the log data for [" 532 " control measure does not have log data for this value. Please use " 533 "SetLogData instead";
539 double ControlMeasure::GetAprioriLine()
const {
540 return p_aprioriLine;
544 double ControlMeasure::GetAprioriSample()
const {
545 return p_aprioriSample;
555 QString ControlMeasure::GetChooserName()
const {
556 if (*p_chooserName !=
"") {
557 return *p_chooserName;
565 bool ControlMeasure::HasChooserName()
const {
566 return !p_chooserName->isEmpty();
570 QString ControlMeasure::GetCubeSerialNumber()
const {
571 return *p_serialNumber;
576 QString ControlMeasure::GetDateTime()
const {
577 if (*p_dateTime !=
"") {
581 return Application::DateTime();
586 bool ControlMeasure::HasDateTime()
const {
587 return !p_dateTime->isEmpty();
593 double ControlMeasure::GetDiameter()
const {
614 bool ControlMeasure::IsEditLocked()
const {
616 if (parentPoint != NULL && parentPoint->IsEditLocked() &&
617 this == parentPoint->GetRefMeasure())
623 double ControlMeasure::GetFocalPlaneComputedX()
const {
624 return p_focalPlaneComputedX;
628 double ControlMeasure::GetFocalPlaneComputedY()
const {
629 return p_focalPlaneComputedY;
633 double ControlMeasure::GetFocalPlaneMeasuredX()
const {
634 return p_focalPlaneMeasuredX;
638 double ControlMeasure::GetFocalPlaneMeasuredY()
const {
639 return p_focalPlaneMeasuredY;
643 bool ControlMeasure::IsIgnored()
const {
648 bool ControlMeasure::IsRejected()
const {
649 return p_jigsawRejected;
653 bool ControlMeasure::IsMeasured()
const {
654 return p_measureType != Candidate;
658 bool ControlMeasure::IsRegistered()
const {
659 return (p_measureType == RegisteredPixel ||
660 p_measureType == RegisteredSubPixel);
663 bool ControlMeasure::IsStatisticallyRelevant(DataField field)
const {
664 bool relevant =
false;
665 bool validField =
false;
671 case CubeSerialNumber:
674 case FocalPlaneMeasured:
675 case FocalPlaneComputed:
694 QString msg =
"Cannot test IsStatisticallyRelevant on Measure Data [" 695 + QString(field) +
"]";
696 throw IException(IException::Programmer, msg,
_FILEINFO_);
703 double ControlMeasure::GetLine()
const {
708 double ControlMeasure::GetLineResidual()
const {
709 return p_lineResidual;
713 double ControlMeasure::GetLineSigma()
const {
725 double ControlMeasure::GetResidualMagnitude()
const {
729 double dist = (p_lineResidual * p_lineResidual) +
730 (p_sampleResidual * p_sampleResidual);
736 double ControlMeasure::GetSample()
const {
741 double ControlMeasure::GetSampleResidual()
const {
742 return p_sampleResidual;
746 double ControlMeasure::GetSampleSigma()
const {
747 return p_sampleSigma;
751 ControlMeasure::MeasureType ControlMeasure::GetType()
const {
752 return p_measureType;
756 QString ControlMeasure::GetPointId()
const {
757 if (parentPoint == NULL) {
758 QString msg =
"Measure has no containing point";
759 throw IException(IException::User, msg,
_FILEINFO_);
762 return parentPoint->GetId();
766 double ControlMeasure::GetSampleShift()
const {
767 return (p_sample !=
Null && p_aprioriSample !=
Null) ?
768 p_sample - p_aprioriSample :
Null;
772 double ControlMeasure::GetLineShift()
const {
773 return (p_line !=
Null && p_aprioriLine !=
Null) ?
774 p_line - p_aprioriLine :
Null;
778 double ControlMeasure::GetPixelShift()
const {
779 double sampleShift = GetSampleShift();
780 double lineShift = GetLineShift();
781 return (sampleShift !=
Null && lineShift !=
Null) ?
782 sqrt(pow(GetSampleShift(), 2) + pow(GetLineShift(), 2)) :
Null;
786 ControlMeasureLogData ControlMeasure::GetLogData(
long dataType)
const {
788 ControlMeasureLogData::NumericLogDataType typedDataType =
789 (ControlMeasureLogData::NumericLogDataType)dataType;
791 while (foundIndex < p_loggedData->size()) {
792 const ControlMeasureLogData &logData = p_loggedData->at(foundIndex);
793 if (logData.GetDataType() == typedDataType) {
800 return ControlMeasureLogData(typedDataType);
812 logs = *p_loggedData;
819 double ControlMeasure::GetMeasureData(QString data)
const {
820 if (data ==
"SampleResidual") {
821 return p_sampleResidual;
823 else if (data ==
"LineResidual") {
824 return p_lineResidual;
826 else if (data ==
"Type") {
827 return p_measureType;
829 else if (data ==
"IsMeasured") {
832 else if (data ==
"IsRegistered") {
833 return IsRegistered();
835 else if (data ==
"Ignore") {
839 QString msg = data +
" passed to GetMeasureData but is invalid";
849 names.push_back(
"SampleResidual");
850 names.push_back(
"LineResidual");
851 names.push_back(
"Type");
852 names.push_back(
"IsMeasured");
853 names.push_back(
"IsRegistered");
854 names.push_back(
"Ignore");
871 qsl <<
"AprioriLine" << QString::number(p_aprioriLine);
875 qsl <<
"AprioriSample" << QString::number(p_aprioriSample);
879 qsl <<
"ChooserName" << *p_chooserName;
883 qsl <<
"CubeSerialNumber" << *p_serialNumber;
887 qsl <<
"DateTime" << *p_dateTime;
891 qsl <<
"Line" << QString::number(p_line);
895 qsl <<
"LineResidual" << QString::number(p_lineResidual);
899 qsl <<
"LineSigma" << QString::number(p_lineSigma);
903 qsl <<
"Sample" << QString::number(p_sample);
907 qsl <<
"SampleResidual" << QString::number(p_sampleResidual);
911 qsl <<
"SampleSigma" << QString::number(p_sampleSigma);
915 qsl <<
"ResidualMagnitude" << QString::number(GetResidualMagnitude());
919 qsl <<
"MeasureType" << GetMeasureTypeString();
934 QString err =
"String [" + str +
"] can not be converted to a MeasureType";
938 if (str ==
"candidate")
939 measureType = ControlMeasure::Candidate;
940 else if (str ==
"manual")
941 measureType = ControlMeasure::Manual;
942 else if (str ==
"registeredpixel")
943 measureType = ControlMeasure::RegisteredPixel;
944 else if (str ==
"registeredsubpixel")
945 measureType = ControlMeasure::RegisteredSubPixel;
968 case ControlMeasure::Candidate:
969 sPrintable =
"Candidate";
972 case ControlMeasure::Manual:
973 sPrintable =
"Manual";
976 case ControlMeasure::RegisteredPixel:
977 sPrintable =
"RegisteredPixel";
980 case ControlMeasure::RegisteredSubPixel:
981 sPrintable =
"RegisteredSubPixel";
985 if (sPrintable ==
"") {
986 QString msg =
"Measure type [" +
toString(type) +
"] cannot be converted " 1000 QString ControlMeasure::GetMeasureTypeString()
const {
1001 return MeasureTypeToString(p_measureType);
1018 if (p_serialNumber) {
1019 delete p_serialNumber;
1020 p_serialNumber = NULL;
1022 if (p_chooserName) {
1023 delete p_chooserName;
1024 p_chooserName = NULL;
1031 delete p_loggedData;
1032 p_loggedData = NULL;
1035 p_serialNumber =
new QString;
1036 p_chooserName =
new QString;
1037 p_dateTime =
new QString;
1040 bool oldLock = p_editLock;
1045 *p_loggedData = *other.p_loggedData;
1047 SetCubeSerialNumber(*other.p_serialNumber);
1049 SetDateTime(*other.p_dateTime);
1050 SetType(other.p_measureType);
1053 SetIgnored(other.p_ignore);
1054 SetDiameter(other.p_diameter);
1060 SetCamera(other.p_camera);
1061 SetFocalPlaneMeasured(other.p_focalPlaneMeasuredX, other.p_focalPlaneMeasuredY);
1062 SetFocalPlaneComputed(other.p_focalPlaneComputedX, other.p_focalPlaneComputedY);
1063 p_editLock = oldLock;
1080 return !(*
this == pMeasure);
1101 return pMeasure.p_measureType == p_measureType &&
1102 *pMeasure.p_serialNumber == *p_serialNumber &&
1104 *pMeasure.p_dateTime == *p_dateTime &&
1106 pMeasure.p_ignore == p_ignore &&
1109 pMeasure.
p_line == p_line &&
1110 pMeasure.p_diameter == p_diameter &&
1113 pMeasure.p_computedEphemerisTime == p_computedEphemerisTime &&
1118 pMeasure.p_focalPlaneMeasuredX == p_focalPlaneMeasuredX &&
1119 pMeasure.p_focalPlaneMeasuredY == p_focalPlaneMeasuredY &&
1120 pMeasure.p_focalPlaneComputedX == p_focalPlaneComputedX &&
1121 pMeasure.p_focalPlaneComputedY == p_focalPlaneComputedY &&
1122 pMeasure.p_measuredEphemerisTime == p_measuredEphemerisTime;
1125 void ControlMeasure::MeasureModified() {
1127 *p_chooserName =
"";
double p_aprioriSample
The first identified location of the.
double p_lineResidual
Jigsaw information - Solution error - replaces p_lineError.
const double Null
Value for an Isis Null pixel.
NumericLogDataType GetDataType() const
Get the data type associated with this log data.
bool p_jigsawRejected
Status of measure for last bundle adjust iteration.
File name manipulation and expansion.
double p_sample
Current sample/line measurement.
Statistical and similar ControlMeasure associated information.
Namespace for the standard library.
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
QString * p_chooserName
list the program used and the definition file or include the user name for qnet
QVariant GetValue() const
Get the data type associated with this log data.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
bool p_editLock
If true do not edit anything in measure.
double p_sampleSigma
Uncertainty/sigma in pixels of the measurement (current sample/line)
double p_lineSigma
Not sure how we determine this for automated or manual picking.
bool IsValid() const
This tests if the log data is complete and valid.
double p_line
Jigsaw uses this measure.
#define _FILEINFO_
Macro for the filename and line number.
double p_aprioriLine
measure by autoseed. Pointreg/Interest always use this location to start it's search. Could be moved by interest program or user.
bool IsSpecial(const double d)
Returns if the input pixel is special.
QString DataTypeToName(NumericLogDataType type) const
This converts the log data type to a string and is used internally for convertions to and from Pvl...
MeasureType
Control network measurement types.
double p_sampleResidual
Jigsaw information - Solution error - replaces p_sampleError.
Namespace for ISIS/Bullet specific routines.