USGS

Isis 3.0 Object Programmers' Reference

Home

ControlMeasure.cpp
Go to the documentation of this file.
1 
23 #include "ControlMeasure.h"
24 
25 #include <QList>
26 #include <QStringList>
27 
28 #include "Application.h"
29 #include "Camera.h"
30 #include "ControlMeasureLogData.h"
31 #include "ControlNet.h"
32 #include "ControlPoint.h"
33 #include "ControlCubeGraphNode.h"
34 #include "IString.h"
35 #include "iTime.h"
36 #include "ControlNetFileV0002.pb.h"
37 #include "SpecialPixel.h"
38 
39 using namespace std;
40 
41 namespace Isis {
45  ControlMeasure::ControlMeasure() {
46  InitializeToNull();
47  p_serialNumber = new QString;
48  p_chooserName = new QString;
49  p_dateTime = new QString;
50  p_loggedData = new QVector<ControlMeasureLogData>();
51 
52  p_measureType = Candidate;
53  p_editLock = false;
54  p_jigsawRejected = false;
55  p_ignore = false;
56 
57  p_sample = 0.0;
58  p_line = 0.0;
59  }
60 
61 
68  ControlMeasure::ControlMeasure(
69  const ControlPointFileEntryV0002_Measure &protoBuf) {
70  InitializeToNull();
71 
72  p_serialNumber = new QString(protoBuf.serialnumber().c_str());
73  p_chooserName = new QString(protoBuf.choosername().c_str());
74  p_dateTime = new QString(protoBuf.datetime().c_str());
75  p_loggedData = new QVector<ControlMeasureLogData>();
76 
77  switch (protoBuf.type()) {
78  case ControlPointFileEntryV0002_Measure::Candidate:
79  p_measureType = ControlMeasure::Candidate;
80  break;
81  case ControlPointFileEntryV0002_Measure::Manual:
82  p_measureType = ControlMeasure::Manual;
83  break;
84  case ControlPointFileEntryV0002_Measure::RegisteredPixel:
85  p_measureType = ControlMeasure::RegisteredPixel;
86  break;
87  case ControlPointFileEntryV0002_Measure::RegisteredSubPixel:
88  p_measureType = ControlMeasure::RegisteredSubPixel;
89  break;
90  }
91 
92  p_editLock = protoBuf.editlock();
93  p_jigsawRejected = protoBuf.jigsawrejected();
94  p_ignore = protoBuf.ignore();
95  p_sample = protoBuf.sample();
96  p_line = protoBuf.line();
97 // ground = protoBuf.???
98 
99  if (protoBuf.has_diameter())
100  p_diameter = protoBuf.diameter();
101 
102  if (protoBuf.has_apriorisample())
103  p_aprioriSample = protoBuf.apriorisample();
104 
105  if (protoBuf.has_aprioriline())
106  p_aprioriLine = protoBuf.aprioriline();
107 
108  if (protoBuf.has_samplesigma())
109  p_sampleSigma = protoBuf.samplesigma();
110 
111  if (protoBuf.has_linesigma())
112  p_lineSigma = protoBuf.linesigma();
113 
114  if (protoBuf.has_sampleresidual())
115  p_sampleResidual = protoBuf.sampleresidual();
116 
117  if (protoBuf.has_lineresidual())
118  p_lineResidual = protoBuf.lineresidual();
119 
120  for (int dataEntry = 0;
121  dataEntry < protoBuf.log_size();
122  dataEntry ++) {
123  ControlMeasureLogData logEntry(protoBuf.log(dataEntry));
124  p_loggedData->push_back(logEntry);
125  }
126  }
127 
128 
134  ControlMeasure::ControlMeasure(const ControlMeasure &other) {
135  InitializeToNull();
136 
137  p_serialNumber = new QString(*other.p_serialNumber);
138  p_chooserName = new QString(*other.p_chooserName);
139  p_dateTime = new QString(*other.p_dateTime);
140 
141  p_loggedData = new QVector<ControlMeasureLogData>(*other.p_loggedData);
142 
143  p_measureType = other.p_measureType;
144  p_editLock = other.p_editLock;
145  p_jigsawRejected = other.p_jigsawRejected;
146  p_ignore = other.p_ignore;
147  p_sample = other.p_sample;
148  p_line = other.p_line;
149  p_diameter = other.p_diameter;
150  p_aprioriSample = other.p_aprioriSample;
151  p_aprioriLine = other.p_aprioriLine;
152  p_sampleSigma = other.p_sampleSigma;
153  p_lineSigma = other.p_lineSigma;
154  p_sampleResidual = other.p_sampleResidual;
155  p_lineResidual = other.p_lineResidual;
156  p_camera = other.p_camera;
157  associatedCSN = other.associatedCSN;
158  }
159 
160 
162  void ControlMeasure::InitializeToNull() {
163  p_serialNumber = NULL;
164  p_chooserName = NULL;
165  p_dateTime = NULL;
166  p_loggedData = NULL;
167 
168  p_diameter = Null;
169  p_aprioriSample = Null;
170  p_aprioriLine = Null;
171  p_computedEphemerisTime = Null;
172  p_sampleSigma = Null;
173  p_lineSigma = Null;
174  p_sampleResidual = Null;
175  p_lineResidual = Null;
176 
177  p_camera = NULL;
178  p_focalPlaneMeasuredX = Null;
179  p_focalPlaneMeasuredY = Null;
180  p_focalPlaneComputedX = Null;
181  p_focalPlaneComputedY = Null;
182  p_measuredEphemerisTime = Null;
183 
184  parentPoint = NULL;
185  associatedCSN = NULL;
186  }
187 
188 
192  ControlMeasure::~ControlMeasure() {
193  if (p_serialNumber) {
194  delete p_serialNumber;
195  p_serialNumber = NULL;
196  }
197 
198  if (p_chooserName) {
199  delete p_chooserName;
200  p_chooserName = NULL;
201  }
202 
203  if (p_dateTime) {
204  delete p_dateTime;
205  p_dateTime = NULL;
206  }
207 
208  if (p_loggedData) {
209  delete p_loggedData;
210  p_loggedData = NULL;
211  }
212 
213  associatedCSN = NULL;
214  }
215 
216 
217  ControlMeasure::Status ControlMeasure::SetAprioriLine(double aprioriLine) {
218  if (IsEditLocked())
219  return MeasureLocked;
220  MeasureModified();
221  p_aprioriLine = aprioriLine;
222  return Success;
223  }
224 
225 
226  ControlMeasure::Status ControlMeasure::SetAprioriSample(
227  double aprioriSample) {
228  if (IsEditLocked())
229  return MeasureLocked;
230  MeasureModified();
231  p_aprioriSample = aprioriSample;
232  return Success;
233  }
234 
235 
250  ControlMeasure::Status ControlMeasure::SetCamera(Isis::Camera *camera) {
251  p_camera = camera;
252  return Success;
253  }
254 
255 
268  ControlMeasure::Status ControlMeasure::SetCubeSerialNumber(QString newSerialNumber) {
269  if (IsEditLocked())
270  return MeasureLocked;
271  *p_serialNumber = newSerialNumber;
272  return Success;
273  }
274 
275 
277  ControlMeasure::Status ControlMeasure::SetChooserName() {
278  if (IsEditLocked())
279  return MeasureLocked;
280  *p_chooserName = "";
281  return Success;
282  }
283 
284 
286  ControlMeasure::Status ControlMeasure::SetChooserName(QString name) {
287  if (IsEditLocked())
288  return MeasureLocked;
289  *p_chooserName = name;
290  return Success;
291  }
292 
293 
300  ControlMeasure::Status ControlMeasure::SetCoordinate(double sample,
301  double line) {
302  return SetCoordinate(sample, line, GetType());
303  }
304 
305 
313  ControlMeasure::Status ControlMeasure::SetCoordinate(double sample,
314  double line, MeasureType type) {
315  if (IsEditLocked())
316  return MeasureLocked;
317  MeasureModified();
318  p_sample = sample;
319  p_line = line;
320  SetType(type);
321  return Success;
322  }
323 
324 
326  ControlMeasure::Status ControlMeasure::SetDateTime() {
327  if (IsEditLocked())
328  return MeasureLocked;
329  *p_dateTime = Application::DateTime();
330  return Success;
331  }
332 
333 
335  ControlMeasure::Status ControlMeasure::SetDateTime(QString datetime) {
336  if (IsEditLocked())
337  return MeasureLocked;
338  *p_dateTime = datetime;
339  return Success;
340  }
341 
342 
351  ControlMeasure::Status ControlMeasure::SetDiameter(double diameter) {
352  if (IsEditLocked())
353  return MeasureLocked;
354  MeasureModified();
355  p_diameter = diameter;
356  return Success;
357  }
358 
359 
360  ControlMeasure::Status ControlMeasure::SetEditLock(bool editLock) {
361  p_editLock = editLock;
362  return Success;
363  }
364 
365 
378  ControlMeasure::Status ControlMeasure::SetFocalPlaneMeasured(double x,
379  double y) {
380  p_focalPlaneMeasuredX = x;
381  p_focalPlaneMeasuredY = y;
382  return Success;
383  }
384 
385 
398  ControlMeasure::Status ControlMeasure::SetFocalPlaneComputed(double x,
399  double y) {
400  p_focalPlaneComputedX = x;
401  p_focalPlaneComputedY = y;
402  return Success;
403  }
404 
405 
406 
407 
422  ControlMeasure::Status ControlMeasure::SetRejected(bool reject) {
423  MeasureModified();
424  p_jigsawRejected = reject;
425  return Success;
426  }
427 
428 
429  ControlMeasure::Status ControlMeasure::SetIgnored(bool newIgnoreStatus) {
430  if (IsEditLocked())
431  return MeasureLocked;
432 
433  bool oldStatus = p_ignore;
434  p_ignore = newIgnoreStatus;
435 
436  // only update if there was a change in status
437  if (oldStatus != p_ignore) {
438  MeasureModified();
439  if (parentPoint && !parentPoint->IsIgnored() && parentPoint->Parent()) {
440  ControlNet * cnet = parentPoint->Parent();
441  p_ignore ? cnet->measureIgnored(this) : cnet->measureUnIgnored(this);
442  cnet->emitNetworkStructureModified();
443  }
444  }
445 
446  return Success;
447  }
448 
449 
450  ControlMeasure::Status ControlMeasure::SetLineSigma(double lineSigma) {
451  if (IsEditLocked())
452  return MeasureLocked;
453  MeasureModified();
454  p_lineSigma = lineSigma;
455  return Success;
456  }
457 
458 
472  ControlMeasure::Status ControlMeasure::SetResidual(double sampResidual,
473  double lineResidual) {
474  MeasureModified();
475  p_sampleResidual = sampResidual;
476  p_lineResidual = lineResidual;
477  return Success;
478  }
479 
480 
481  ControlMeasure::Status ControlMeasure::SetSampleSigma(double sampleSigma) {
482  if (IsEditLocked())
483  return MeasureLocked;
484  MeasureModified();
485  p_sampleSigma = sampleSigma;
486  return Success;
487  }
488 
489 
491  ControlMeasure::Status ControlMeasure::SetType(MeasureType type) {
492  if (IsEditLocked())
493  return MeasureLocked;
494  MeasureModified();
495  p_measureType = type;
496  return Success;
497  }
498 
499 
505  void ControlMeasure::SetLogData(ControlMeasureLogData data) {
506  if (!data.IsValid()) {
507  IString msg = "Cannot set log data with invalid information stored in "
508  "the ControlMeasureLogData";
509  throw IException(IException::Programmer, msg, _FILEINFO_);
510  }
511 
512  if (HasLogData(data.GetDataType()))
513  UpdateLogData(data);
514  else
515  p_loggedData->append(data);
516  }
517 
518 
525  void ControlMeasure::DeleteLogData(long dataType) {
526  for (int i = p_loggedData->size()-1; i >= 0; i--) {
527  ControlMeasureLogData logDataEntry = p_loggedData->at(i);
528 
529  if (logDataEntry.GetDataType() == dataType)
530  p_loggedData->remove(i);
531  }
532  }
533 
534 
539  QVariant ControlMeasure::GetLogValue(long dataType) const {
540  for (int i = 0; i < p_loggedData->size(); i++) {
541  const ControlMeasureLogData &logDataEntry = p_loggedData->at(i);
542 
543  if (logDataEntry.GetDataType() == dataType)
544  return logDataEntry.GetValue();
545  }
546 
547  return QVariant();
548  }
549 
550 
556  bool ControlMeasure::HasLogData(long dataType) const {
557  for (int i = 0; i < p_loggedData->size(); i++) {
558  const ControlMeasureLogData &logDataEntry = p_loggedData->at(i);
559 
560  if (logDataEntry.GetDataType() == dataType)
561  return true;
562  }
563 
564  return false;
565  }
566 
567 
574  void ControlMeasure::UpdateLogData(ControlMeasureLogData newLogData) {
575  bool updated = false;
576 
577  for (int i = 0; i < p_loggedData->size(); i++) {
578  ControlMeasureLogData logDataEntry = p_loggedData->at(i);
579 
580  if (logDataEntry.GetDataType() == newLogData.GetDataType()) {
581  (*p_loggedData)[i] = newLogData;
582  updated = true;
583  }
584  }
585 
586  if (!updated) {
587  IString msg = "Unable to update the log data for [" +
588  newLogData.DataTypeToName(newLogData.GetDataType()) + "] because this"
589  " control measure does not have log data for this value. Please use "
590  "SetLogData instead";
591  throw IException(IException::Programmer, msg, _FILEINFO_);
592  }
593  }
594 
595 
596  double ControlMeasure::GetAprioriLine() const {
597  return p_aprioriLine;
598  }
599 
600 
601  double ControlMeasure::GetAprioriSample() const {
602  return p_aprioriSample;
603  }
604 
605 
606  Isis::Camera *ControlMeasure::Camera() const {
607  return p_camera;
608  }
609 
610 
612  QString ControlMeasure::GetChooserName() const {
613  if (*p_chooserName != "") {
614  return *p_chooserName;
615  }
616  else {
617  return FileName(Application::Name()).name();
618  }
619  }
620 
621 
623  QString ControlMeasure::GetCubeSerialNumber() const {
624  return *p_serialNumber;
625  }
626 
627 
629  QString ControlMeasure::GetDateTime() const {
630  if (*p_dateTime != "") {
631  return *p_dateTime;
632  }
633  else {
634  return Application::DateTime();
635  }
636  }
637 
638 
640  double ControlMeasure::GetDiameter() const {
641  return p_diameter;
642  }
643 
644 
661  bool ControlMeasure::IsEditLocked() const {
662  // Check to see if this measure is the reference measure of the parent
663  if (parentPoint != NULL && parentPoint->IsEditLocked() &&
664  this == parentPoint->GetRefMeasure())
665  return true;
666  return p_editLock;
667  }
668 
669 
670  double ControlMeasure::GetFocalPlaneComputedX() const {
671  return p_focalPlaneComputedX;
672  }
673 
674 
675  double ControlMeasure::GetFocalPlaneComputedY() const {
676  return p_focalPlaneComputedY;
677  }
678 
679 
680  double ControlMeasure::GetFocalPlaneMeasuredX() const {
681  return p_focalPlaneMeasuredX;
682  }
683 
684 
685  double ControlMeasure::GetFocalPlaneMeasuredY() const {
686  return p_focalPlaneMeasuredY;
687  }
688 
689 
690  bool ControlMeasure::IsIgnored() const {
691  return p_ignore;
692  }
693 
694 
695  bool ControlMeasure::IsRejected() const {
696  return p_jigsawRejected;
697  }
698 
699 
700  bool ControlMeasure::IsMeasured() const {
701  return p_measureType != Candidate;
702  }
703 
704 
705  bool ControlMeasure::IsRegistered() const {
706  return (p_measureType == RegisteredPixel ||
707  p_measureType == RegisteredSubPixel);
708  }
709 
710  bool ControlMeasure::IsStatisticallyRelevant(DataField field) const {
711  bool relevant = false;
712  bool validField = false;
713 
714  switch (field) {
715  case AprioriLine:
716  case AprioriSample:
717  case ChooserName:
718  case CubeSerialNumber:
719  case Coordinate:
720  case Diameter:
721  case FocalPlaneMeasured:
722  case FocalPlaneComputed:
723  case SampleResidual:
724  case LineResidual:
725  case SampleSigma:
726  case LineSigma:
727  relevant = true;
728  validField = true;
729  break;
730 
731  case DateTime:
732  case EditLock:
733  case Ignore:
734  case Rejected:
735  case Type:
736  validField = true;
737  break;
738  }
739 
740  if (!validField) {
741  IString msg = "Cannot test IsStatisticallyRelevant on Measure Data ["
742  + IString(field) + "]";
743  throw IException(IException::Programmer, msg, _FILEINFO_);
744  }
745 
746  return relevant;
747  }
748 
749 
750  double ControlMeasure::GetLine() const {
751  return p_line;
752  }
753 
754 
755  double ControlMeasure::GetLineResidual() const {
756  return p_lineResidual;
757  }
758 
759 
760  double ControlMeasure::GetLineSigma() const {
761  return p_lineSigma;
762  }
763 
764 
766  double ControlMeasure::GetResidualMagnitude() const {
767  if(IsSpecial(p_lineResidual) || IsSpecial(p_sampleResidual))
768  return Null;
769 
770  double dist = (p_lineResidual * p_lineResidual) +
771  (p_sampleResidual * p_sampleResidual);
772 
773  return sqrt(dist);
774  }
775 
776 
777  double ControlMeasure::GetSample() const {
778  return p_sample;
779  }
780 
781 
782  double ControlMeasure::GetSampleResidual() const {
783  return p_sampleResidual;
784  }
785 
786 
787  double ControlMeasure::GetSampleSigma() const {
788  return p_sampleSigma;
789  }
790 
791 
792  ControlMeasure::MeasureType ControlMeasure::GetType() const {
793  return p_measureType;
794  }
795 
796 
797  QString ControlMeasure::GetPointId() const {
798  if (parentPoint == NULL) {
799  IString msg = "Measure has no containing point";
800  throw IException(IException::User, msg, _FILEINFO_);
801  }
802 
803  return parentPoint->GetId();
804  }
805 
806 
807  double ControlMeasure::GetSampleShift() const {
808  return (p_sample != Null && p_aprioriSample != Null) ?
809  p_sample - p_aprioriSample : Null;
810  }
811 
812 
813  double ControlMeasure::GetLineShift() const {
814  return (p_line != Null && p_aprioriLine != Null) ?
815  p_line - p_aprioriLine : Null;
816  }
817 
818 
819  double ControlMeasure::GetPixelShift() const {
820  double sampleShift = GetSampleShift();
821  double lineShift = GetLineShift();
822  return (sampleShift != Null && lineShift != Null) ?
823  sqrt(pow(GetSampleShift(), 2) + pow(GetLineShift(), 2)) : Null;
824  }
825 
826 
827  ControlMeasureLogData ControlMeasure::GetLogData(long dataType) const {
828  int foundIndex = 0;
829  ControlMeasureLogData::NumericLogDataType typedDataType =
830  (ControlMeasureLogData::NumericLogDataType)dataType;
831 
832  while (foundIndex < p_loggedData->size()) {
833  const ControlMeasureLogData &logData = p_loggedData->at(foundIndex);
834  if (logData.GetDataType() == typedDataType) {
835  return logData;
836  }
837 
838  foundIndex ++;
839  }
840 
841  return ControlMeasureLogData(typedDataType);
842  }
843 
844 
846  double ControlMeasure::GetMeasureData(QString data) const {
847  if (data == "SampleResidual")
848  return p_sampleResidual;
849  else if (data == "LineResidual")
850  return p_lineResidual;
851  else if (data == "Type")
852  return p_measureType;
853  else if (data == "IsMeasured")
854  return IsMeasured();
855  else if (data == "IsRegistered")
856  return IsRegistered();
857  else if (data == "Ignore")
858  return p_ignore;
859  else {
860  IString msg = data + " passed to GetMeasureData but is invalid";
861  throw IException(IException::Programmer, msg, _FILEINFO_);
862  }
863  }
864 
865 
867  QVector< QString > ControlMeasure::GetMeasureDataNames() {
868  QVector< QString > names;
869 
870  names.push_back("SampleResidual");
871  names.push_back("LineResidual");
872  names.push_back("Type");
873  names.push_back("IsMeasured");
874  names.push_back("IsRegistered");
875  names.push_back("Ignore");
876 
877  return names;
878  }
879 
888  QList< QStringList > ControlMeasure::PrintableClassData() const {
890  QStringList qsl;
891 
892  qsl << "AprioriLine" << QString::number(p_aprioriLine);
893  data.append(qsl);
894  qsl.clear();
895 
896  qsl << "AprioriSample" << QString::number(p_aprioriSample);
897  data.append(qsl);
898  qsl.clear();
899 
900  qsl << "ChooserName" << *p_chooserName;
901  data.append(qsl);
902  qsl.clear();
903 
904  qsl << "CubeSerialNumber" << *p_serialNumber;
905  data.append(qsl);
906  qsl.clear();
907 
908  qsl << "DateTime" << *p_dateTime;
909  data.append(qsl);
910  qsl.clear();
911 
912  qsl << "Line" << QString::number(p_line);
913  data.append(qsl);
914  qsl.clear();
915 
916  qsl << "LineResidual" << QString::number(p_lineResidual);
917  data.append(qsl);
918  qsl.clear();
919 
920  qsl << "LineSigma" << QString::number(p_lineSigma);
921  data.append(qsl);
922  qsl.clear();
923 
924  qsl << "Sample" << QString::number(p_sample);
925  data.append(qsl);
926  qsl.clear();
927 
928  qsl << "SampleResidual" << QString::number(p_sampleResidual);
929  data.append(qsl);
930  qsl.clear();
931 
932  qsl << "SampleSigma" << QString::number(p_sampleSigma);
933  data.append(qsl);
934  qsl.clear();
935 
936  qsl << "ResidualMagnitude" << QString::number(GetResidualMagnitude());
937  data.append(qsl);
938  qsl.clear();
939 
940  qsl << "MeasureType" << GetMeasureTypeString();
941  data.append(qsl);
942  qsl.clear();
943 
944  return data;
945  }
946 
947 
953  ControlMeasure::MeasureType ControlMeasure::StringToMeasureType(QString str) {
954 
955  IString err = "String [";
956  err += IString(str) + "] can not be converted to a MeasureType";
957 
958  str = str.toLower();
959  MeasureType measureType;
960  if (str == "candidate")
961  measureType = ControlMeasure::Candidate;
962  else if (str == "manual")
963  measureType = ControlMeasure::Manual;
964  else if (str == "registeredpixel")
965  measureType = ControlMeasure::RegisteredPixel;
966  else if (str == "registeredsubpixel")
967  measureType = ControlMeasure::RegisteredSubPixel;
968  else
969  throw IException(IException::Programmer, err, _FILEINFO_);
970 
971  return measureType;
972  }
973 
974 
986  QString ControlMeasure::MeasureTypeToString(MeasureType type) {
987  QString sPrintable;
988 
989  switch (type) {
990  case ControlMeasure::Candidate:
991  sPrintable = "Candidate";
992  break;
993 
994  case ControlMeasure::Manual:
995  sPrintable = "Manual";
996  break;
997 
998  case ControlMeasure::RegisteredPixel:
999  sPrintable = "RegisteredPixel";
1000  break;
1001 
1002  case ControlMeasure::RegisteredSubPixel:
1003  sPrintable = "RegisteredSubPixel";
1004  break;
1005  }
1006 
1007  if (sPrintable == "") {
1008  QString msg = "Measure type [" + toString(type) + "] cannot be converted "
1009  "to a string";
1010  throw IException(IException::Programmer, msg, _FILEINFO_);
1011  }
1012 
1013  return sPrintable;
1014  }
1015 
1021  QString ControlMeasure::GetMeasureTypeString() const {
1022  return MeasureTypeToString(p_measureType);
1023  }
1024 
1025 
1035  const ControlMeasure &ControlMeasure::operator=(const ControlMeasure &other) {
1036  if (this == &other)
1037  return *this;
1038 
1039  if (p_serialNumber) {
1040  delete p_serialNumber;
1041  p_serialNumber = NULL;
1042  }
1043  if (p_chooserName) {
1044  delete p_chooserName;
1045  p_chooserName = NULL;
1046  }
1047  if (p_dateTime) {
1048  delete p_dateTime;
1049  p_dateTime = NULL;
1050  }
1051  if (p_loggedData) {
1052  delete p_loggedData;
1053  p_loggedData = NULL;
1054  }
1055 
1056  p_serialNumber = new QString;
1057  p_chooserName = new QString;
1058  p_dateTime = new QString;
1059  p_loggedData = new QVector<ControlMeasureLogData>();
1060 
1061  *p_serialNumber = *other.p_serialNumber;
1062  *p_chooserName = *other.p_chooserName;
1063  *p_dateTime = *other.p_dateTime;
1064  *p_loggedData = *other.p_loggedData;
1065 
1066  p_measureType = other.p_measureType;
1067  // Call SetIgnored to update the ControlGraphNode. However, SetIgnored
1068  // will return if EditLock is true, so set to false temporarily.
1069  p_editLock = false;
1070  SetIgnored(other.p_ignore);
1071  p_editLock = other.p_editLock;
1072  p_sample = other.p_sample;
1073  p_line = other.p_line;
1074  p_diameter = other.p_diameter;
1075  p_aprioriSample = other.p_aprioriSample;
1076  p_aprioriLine = other.p_aprioriLine;
1077  p_sampleSigma = other.p_sampleSigma;
1078  p_lineSigma = other.p_lineSigma;
1079  p_sampleResidual = other.p_sampleResidual;
1080  p_lineResidual = other.p_lineResidual;
1081  p_camera = other.p_camera;
1082  p_focalPlaneMeasuredX = other.p_focalPlaneMeasuredX;
1083  p_focalPlaneMeasuredY = other.p_focalPlaneMeasuredY;
1084  p_focalPlaneComputedX = other.p_focalPlaneComputedX;
1085  p_focalPlaneComputedY = other.p_focalPlaneComputedY;
1086  associatedCSN = other.associatedCSN;
1087 
1088  return *this;
1089  }
1090 
1091 
1101  bool ControlMeasure::operator!=(const Isis::ControlMeasure &pMeasure) const {
1102  return !(*this == pMeasure);
1103  }
1104 
1105 
1122  bool ControlMeasure::operator==(const Isis::ControlMeasure &pMeasure) const {
1123  return pMeasure.p_measureType == p_measureType &&
1124  *pMeasure.p_serialNumber == *p_serialNumber &&
1125  *pMeasure.p_chooserName == *p_chooserName &&
1126  *pMeasure.p_dateTime == *p_dateTime &&
1127  pMeasure.p_editLock == p_editLock &&
1128  pMeasure.p_ignore == p_ignore &&
1129  pMeasure.p_jigsawRejected == p_jigsawRejected &&
1130  pMeasure.p_sample == p_sample &&
1131  pMeasure.p_line == p_line &&
1132  pMeasure.p_diameter == p_diameter &&
1133  pMeasure.p_aprioriSample == p_aprioriSample &&
1134  pMeasure.p_aprioriLine == p_aprioriLine &&
1135  pMeasure.p_computedEphemerisTime == p_computedEphemerisTime &&
1136  pMeasure.p_sampleSigma == p_sampleSigma &&
1137  pMeasure.p_lineSigma == p_lineSigma &&
1138  pMeasure.p_sampleResidual == p_sampleResidual &&
1139  pMeasure.p_lineResidual == p_lineResidual &&
1140  pMeasure.p_focalPlaneMeasuredX == p_focalPlaneMeasuredX &&
1141  pMeasure.p_focalPlaneMeasuredY == p_focalPlaneMeasuredY &&
1142  pMeasure.p_focalPlaneComputedX == p_focalPlaneComputedX &&
1143  pMeasure.p_focalPlaneComputedY == p_focalPlaneComputedY &&
1144  pMeasure.p_measuredEphemerisTime == p_measuredEphemerisTime;
1145  }
1146 
1147 
1148  ControlPointFileEntryV0002_Measure ControlMeasure::ToProtocolBuffer() const {
1149  ControlPointFileEntryV0002_Measure protoBufMeasure;
1150 
1151  protoBufMeasure.set_serialnumber(GetCubeSerialNumber().toAscii().data());
1152  switch (GetType()) {
1153  case ControlMeasure::Candidate:
1154  protoBufMeasure.set_type(ControlPointFileEntryV0002_Measure::Candidate);
1155  break;
1156  case ControlMeasure::Manual:
1157  protoBufMeasure.set_type(ControlPointFileEntryV0002_Measure::Manual);
1158  break;
1159  case ControlMeasure::RegisteredPixel:
1160  protoBufMeasure.set_type(ControlPointFileEntryV0002_Measure::RegisteredPixel);
1161  break;
1162  case ControlMeasure::RegisteredSubPixel:
1163  protoBufMeasure.set_type(ControlPointFileEntryV0002_Measure::RegisteredSubPixel);
1164  break;
1165  }
1166 
1167  if (GetChooserName() != "") {
1168  protoBufMeasure.set_choosername(GetChooserName().toAscii().data());
1169  }
1170  if (GetDateTime() != "") {
1171  protoBufMeasure.set_datetime(GetDateTime().toAscii().data());
1172  }
1173  if (IsEditLocked())
1174  protoBufMeasure.set_editlock(true);
1175 
1176  if (IsIgnored())
1177  protoBufMeasure.set_ignore(true);
1178 
1179  if (IsRejected())
1180  protoBufMeasure.set_jigsawrejected(true);
1181 
1182  if (GetSample() != 0.)
1183  protoBufMeasure.set_sample(GetSample());
1184 
1185  if(GetLine() != 0.)
1186  protoBufMeasure.set_line(GetLine());
1187 
1188  if (GetSampleResidual() != Isis::Null)
1189  protoBufMeasure.set_sampleresidual(GetSampleResidual());
1190 
1191  if (GetLineResidual() != Isis::Null)
1192  protoBufMeasure.set_lineresidual(GetLineResidual());
1193 
1194  if (GetDiameter() != Isis::Null)
1195  protoBufMeasure.set_diameter(GetDiameter());
1196 
1197  if (GetAprioriSample() != Isis::Null)
1198  protoBufMeasure.set_apriorisample(GetAprioriSample());
1199 
1200  if (GetAprioriLine() != Isis::Null)
1201  protoBufMeasure.set_aprioriline(GetAprioriLine());
1202 
1203  if (GetSampleSigma() != Isis::Null)
1204  protoBufMeasure.set_samplesigma(GetSampleSigma());
1205 
1206  if (GetLineSigma() != Isis::Null)
1207  protoBufMeasure.set_linesigma(GetLineSigma());
1208 
1209  ControlMeasureLogData logEntry;
1210  foreach(logEntry, *p_loggedData) {
1211  *protoBufMeasure.add_log() = logEntry.ToProtocolBuffer();
1212  }
1213 
1214  return protoBufMeasure;
1215  }
1216 
1217 
1218  void ControlMeasure::MeasureModified() {
1219  *p_dateTime = "";
1220  *p_chooserName = "";
1221  }
1222 }