10#include "ControlMeasure.h"
15#include "Application.h"
17#include "ControlMeasureLogData.h"
18#include "ControlNet.h"
19#include "ControlPoint.h"
22#include "SpecialPixel.h"
32 p_serialNumber =
new QString;
34 p_dateTime =
new QString;
35 p_loggedData =
new QVector<ControlMeasureLogData>();
53 p_serialNumber =
new QString(*other.p_serialNumber);
55 p_dateTime =
new QString(*other.p_dateTime);
57 p_loggedData =
new QVector<ControlMeasureLogData>(*other.p_loggedData);
59 p_measureType = other.p_measureType;
62 p_ignore = other.p_ignore;
65 p_diameter = other.p_diameter;
72 p_camera = other.p_camera;
82 p_serialNumber = NULL;
90 p_computedEphemerisTime =
Null;
97 p_focalPlaneMeasuredX =
Null;
98 p_focalPlaneMeasuredY =
Null;
99 p_focalPlaneComputedX =
Null;
100 p_focalPlaneComputedY =
Null;
101 p_measuredEphemerisTime =
Null;
111 if (p_serialNumber) {
112 delete p_serialNumber;
113 p_serialNumber = NULL;
134 ControlMeasure::Status ControlMeasure::SetAprioriLine(
double aprioriLine) {
136 return MeasureLocked;
144 ControlMeasure::Status ControlMeasure::SetAprioriSample(
145 double aprioriSample) {
147 return MeasureLocked;
189 return MeasureLocked;
190 *p_serialNumber = newSerialNumber;
198 return MeasureLocked;
207 return MeasureLocked;
235 return MeasureLocked;
249 return MeasureLocked;
258 return MeasureLocked;
259 *p_dateTime = datetime;
274 return MeasureLocked;
276 p_diameter = diameter;
281 ControlMeasure::Status ControlMeasure::SetEditLock(
bool editLock) {
301 p_focalPlaneMeasuredX = x;
302 p_focalPlaneMeasuredY = y;
321 p_focalPlaneComputedX = x;
322 p_focalPlaneComputedY = y;
350 ControlMeasure::Status ControlMeasure::SetIgnored(
bool newIgnoreStatus) {
352 return MeasureLocked;
355 bool oldStatus = p_ignore;
356 p_ignore = newIgnoreStatus;
363 if (oldStatus != p_ignore) {
367 p_ignore ? cnet->measureIgnored(
this) : cnet->measureUnIgnored(
this);
368 cnet->emitNetworkStructureModified();
377 ControlMeasure::Status ControlMeasure::SetLineSigma(
double lineSigma) {
379 return MeasureLocked;
400 double lineResidual) {
410 ControlMeasure::Status ControlMeasure::SetSampleSigma(
double sampleSigma) {
412 return MeasureLocked;
422 return MeasureLocked;
425 p_measureType = type;
437 QString msg =
"Cannot set log data with invalid information stored in "
438 "the ControlMeasureLogData";
445 p_loggedData->append(data);
456 for (
int i = p_loggedData->size()-1; i >= 0; i--) {
459 if (logDataEntry.GetDataType() == dataType)
460 p_loggedData->remove(i);
470 for (
int i = 0; i < p_loggedData->size(); i++) {
473 if (logDataEntry.GetDataType() == dataType)
474 return logDataEntry.GetValue();
487 for (
int i = 0; i < p_loggedData->size(); i++) {
490 if (logDataEntry.GetDataType() == dataType)
505 bool updated =
false;
507 for (
int i = 0; i < p_loggedData->size(); i++) {
510 if (logDataEntry.GetDataType() == newLogData.GetDataType()) {
511 (*p_loggedData)[i] = newLogData;
517 QString msg =
"Unable to update the log data for ["
518 + newLogData.DataTypeToName(newLogData.GetDataType()) +
"] because this"
519 " control measure does not have log data for this value. Please use "
520 "SetLogData instead";
526 double ControlMeasure::GetAprioriLine()
const {
531 double ControlMeasure::GetAprioriSample()
const {
558 return *p_serialNumber;
564 if (*p_dateTime !=
"") {
574 return !p_dateTime->isEmpty();
610 double ControlMeasure::GetFocalPlaneComputedX()
const {
611 return p_focalPlaneComputedX;
615 double ControlMeasure::GetFocalPlaneComputedY()
const {
616 return p_focalPlaneComputedY;
620 double ControlMeasure::GetFocalPlaneMeasuredX()
const {
621 return p_focalPlaneMeasuredX;
625 double ControlMeasure::GetFocalPlaneMeasuredY()
const {
626 return p_focalPlaneMeasuredY;
630 bool ControlMeasure::IsIgnored()
const {
635 bool ControlMeasure::IsRejected()
const {
640 bool ControlMeasure::IsMeasured()
const {
645 bool ControlMeasure::IsRegistered()
const {
650 bool ControlMeasure::IsStatisticallyRelevant(DataField field)
const {
651 bool relevant =
false;
652 bool validField =
false;
658 case CubeSerialNumber:
661 case FocalPlaneMeasured:
662 case FocalPlaneComputed:
681 QString msg =
"Cannot test IsStatisticallyRelevant on Measure Data ["
682 + QString(field) +
"]";
690 double ControlMeasure::GetLine()
const {
695 double ControlMeasure::GetLineResidual()
const {
700 double ControlMeasure::GetLineSigma()
const {
723 double ControlMeasure::GetSample()
const {
728 double ControlMeasure::GetSampleResidual()
const {
733 double ControlMeasure::GetSampleSigma()
const {
739 return p_measureType;
743 QString ControlMeasure::GetPointId()
const {
745 QString msg =
"Measure has no containing point";
753 double ControlMeasure::GetSampleShift()
const {
759 double ControlMeasure::GetLineShift()
const {
765 double ControlMeasure::GetPixelShift()
const {
766 double sampleShift = GetSampleShift();
767 double lineShift = GetLineShift();
768 return (sampleShift !=
Null && lineShift !=
Null) ?
769 sqrt(pow(GetSampleShift(), 2) + pow(GetLineShift(), 2)) :
Null;
773 ControlMeasureLogData ControlMeasure::GetLogData(
long dataType)
const {
778 while (foundIndex < p_loggedData->size()) {
779 const ControlMeasureLogData &logData = p_loggedData->at(foundIndex);
780 if (logData.GetDataType() == typedDataType) {
787 return ControlMeasureLogData(typedDataType);
797 QVector<ControlMeasureLogData> logs;
799 logs = *p_loggedData;
807 if (data ==
"SampleResidual") {
810 else if (data ==
"LineResidual") {
813 else if (data ==
"Type") {
814 return p_measureType;
816 else if (data ==
"IsMeasured") {
819 else if (data ==
"IsRegistered") {
820 return IsRegistered();
822 else if (data ==
"Ignore") {
826 QString msg = data +
" passed to GetMeasureData but is invalid";
836 names.push_back(
"SampleResidual");
837 names.push_back(
"LineResidual");
838 names.push_back(
"Type");
839 names.push_back(
"IsMeasured");
840 names.push_back(
"IsRegistered");
841 names.push_back(
"Ignore");
855 QList< QStringList > data;
870 qsl <<
"CubeSerialNumber" << *p_serialNumber;
874 qsl <<
"DateTime" << *p_dateTime;
878 qsl <<
"Line" << QString::number(
p_line);
886 qsl <<
"LineSigma" << QString::number(
p_lineSigma);
890 qsl <<
"Sample" << QString::number(
p_sample);
921 QString err =
"String [" + str +
"] can not be converted to a MeasureType";
925 if (str ==
"candidate")
927 else if (str ==
"manual")
929 else if (str ==
"registeredpixel")
931 else if (str ==
"registeredsubpixel")
956 sPrintable =
"Candidate";
960 sPrintable =
"Manual";
964 sPrintable =
"RegisteredPixel";
968 sPrintable =
"RegisteredSubPixel";
972 if (sPrintable ==
"") {
973 QString msg =
"Measure type [" +
toString(type) +
"] cannot be converted "
1005 if (p_serialNumber) {
1006 delete p_serialNumber;
1007 p_serialNumber = NULL;
1018 delete p_loggedData;
1019 p_loggedData = NULL;
1022 p_serialNumber =
new QString;
1024 p_dateTime =
new QString;
1025 p_loggedData =
new QVector<ControlMeasureLogData>();
1032 *p_loggedData = *other.p_loggedData;
1040 SetIgnored(other.p_ignore);
1042 SetAprioriSample(other.p_aprioriSample);
1043 SetAprioriLine(other.p_aprioriLine);
1044 SetSampleSigma(other.p_sampleSigma);
1045 SetLineSigma(other.p_lineSigma);
1046 SetResidual(other.p_sampleResidual, other.p_lineResidual);
1051 SetEditLock(other.p_editLock);
1067 return !(*
this == pMeasure);
1088 return pMeasure.p_measureType == p_measureType &&
1089 *pMeasure.p_serialNumber == *p_serialNumber &&
1091 *pMeasure.p_dateTime == *p_dateTime &&
1093 pMeasure.p_ignore == p_ignore &&
1096 pMeasure.p_line ==
p_line &&
1097 pMeasure.p_diameter == p_diameter &&
1100 pMeasure.p_computedEphemerisTime == p_computedEphemerisTime &&
1105 pMeasure.p_focalPlaneMeasuredX == p_focalPlaneMeasuredX &&
1106 pMeasure.p_focalPlaneMeasuredY == p_focalPlaneMeasuredY &&
1107 pMeasure.p_focalPlaneComputedX == p_focalPlaneComputedX &&
1108 pMeasure.p_focalPlaneComputedY == p_focalPlaneComputedY &&
1109 pMeasure.p_measuredEphemerisTime == p_measuredEphemerisTime;
1112 void ControlMeasure::MeasureModified() {
static QString DateTime(time_t *curtime=0)
Returns the date and time as a QString.
static QString Name()
Returns the name of the application.
bool IsEditLocked() const
Return value for p_editLock or implicit lock on reference measure.
Status SetCubeSerialNumber(QString newSerialNumber)
Set cube serial number.
QString GetDateTime() const
Return the date/time the coordinate was last changed.
double p_sampleResidual
Jigsaw information - Solution error - replaces p_sampleError.
static QString MeasureTypeToString(MeasureType type)
Return the String Control Measure type.
bool operator!=(const Isis::ControlMeasure &pMeasure) const
Compare 2 Control Measures for inequality.
double p_aprioriLine
measure by autoseed. Pointreg/Interest always use this location to start it's search....
bool HasLogData(long dataType) const
Test if we have a valid log data value of the specified type.
QList< QStringList > PrintableClassData() const
Data accessor method, provides access to string representations of all variable values and names.
Status SetCoordinate(double sample, double line)
Set the coordinate of the measurement.
double p_sample
Current sample/line measurement.
static MeasureType StringToMeasureType(QString str)
void DeleteLogData(long dataType)
This deletes log data of the specified type.
QString GetChooserName() const
Return the chooser name.
QString GetCubeSerialNumber() const
Return the serial number of the cube containing the coordinate.
QString * p_chooserName
list the program used and the definition file or include the user name for qnet
Status SetFocalPlaneComputed(double x, double y)
Set the computed focal plane x/y for the apriori lat/lon.
double GetMeasureData(QString) const
One Getter to rule them all.
void InitializeToNull()
initialize pointers and other data to NULL
MeasureType
Control network measurement types.
@ Manual
Hand Measured (e.g., qnet)
@ Candidate
(e.g., autoseed, interest) AKA predicted, unmeasured, unverified
@ RegisteredSubPixel
Registered to sub-pixel (e.g., pointreg)
@ RegisteredPixel
Registered to whole pixel (e.g.,pointreg)
double p_line
Jigsaw uses this measure.
double p_sampleSigma
Uncertainty/sigma in pixels of the measurement (current sample/line)
bool operator==(const Isis::ControlMeasure &pMeasure) const
Check for Control Measures equality.
double p_lineSigma
Not sure how we determine this for automated or manual picking.
Status SetFocalPlaneMeasured(double x, double y)
Set the focal plane x/y for the measured line/sample.
Status SetType(MeasureType type)
Set how the coordinate was obtained.
Status SetDiameter(double diameter)
Set the crater diameter at the coordinate.
void SetLogData(ControlMeasureLogData)
This adds or updates the log data information associated with data's type.
bool HasDateTime() const
Returns true if the datetime is not empty.
QVariant GetLogValue(long dataType) const
Get the value of the log data with the specified type as a variant.
const ControlMeasure & operator=(const ControlMeasure &other)
Assignment operator.
double p_lineResidual
Jigsaw information - Solution error - replaces p_lineError.
void UpdateLogData(ControlMeasureLogData)
This updates existing log data information associated with data's type.
Status SetDateTime()
Date Time - Creation Time.
ControlPoint * parentPoint
Pointer to parent ControlPoint, may be null.
Status SetResidual(double sampResidual, double lineResidual)
Set the BundleAdjust Residual of the coordinate.
QString GetMeasureTypeString() const
Obtain a string representation of the MeasureType.
~ControlMeasure()
Free the memory allocated by a control.
Status SetCamera(Isis::Camera *camera)
Set pointer to camera associated with a measure.
double p_aprioriSample
The first identified location of the.
Status SetRejected(bool rejected)
Set "jigsaw" rejected flag for a measure.
static QVector< QString > GetMeasureDataNames()
Returns a list of all valid options to pass to GetMeasureData.
bool HasChooserName() const
Returns true if the choosername is not empty.
double GetDiameter() const
Return the diameter of the crater in pixels (0 implies no crater)
Status SetChooserName()
Set chooser name to a user who last changed the coordinate.
bool p_jigsawRejected
Status of measure for last bundle adjust iteration.
ControlMeasure()
Create a new control measure and initialize it to nulls and zeros.
bool p_editLock
If true do not edit anything in measure.
double GetResidualMagnitude() const
Return Residual magnitude.
QVector< ControlMeasureLogData > GetLogDataEntries() const
Return all of the log data for the measure.
Statistical and similar ControlMeasure associated information.
NumericLogDataType GetDataType() const
Get the data type associated with this log data.
NumericLogDataType
Please do not change existing values in this list except the size - it will break backwards compadibi...
bool IsValid() const
This tests if the log data is complete and valid.
const ControlMeasure * GetRefMeasure() const
Get the reference control measure.
QString GetId() const
Return the Id of the control point.
void emitMeasureModified(ControlMeasure *measure, ControlMeasure::ModType modType, QVariant oldValue, QVariant newValue)
This method is a wrapper to emit the measureModified() signal in the parent network is called wheneve...
File name manipulation and expansion.
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
@ Programmer
This error is for when a programmer made an API call that was illegal.
This is free and unencumbered software released into the public domain.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
const double Null
Value for an Isis Null pixel.
bool IsSpecial(const double d)
Returns if the input pixel is special.
Namespace for the standard library.