20 ControlPointV0002::ControlPointV0002(
23 : m_pointData(pointData), m_logData(logData) {
34 : m_pointData(new ControlNetFileProtoV0001_PBControlPoint),
35 m_logData(new ControlNetLogDataProtoV0001_Point) {
38 copy(pointObject,
"PointId",
39 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_id);
40 copy(pointObject,
"ChooserName",
41 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_choosername);
42 copy(pointObject,
"DateTime",
43 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_datetime);
44 copy(pointObject,
"AprioriXYZSourceFile",
45 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_apriorisurfpointsourcefile);
46 copy(pointObject,
"AprioriRadiusSourceFile",
47 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_aprioriradiussourcefile);
48 copy(pointObject,
"JigsawRejected",
49 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_jigsawrejected);
50 copy(pointObject,
"EditLock",
51 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_editlock);
52 copy(pointObject,
"Ignore",
53 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_ignore);
54 copy(pointObject,
"AprioriX",
55 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_apriorix);
56 copy(pointObject,
"AprioriY",
57 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_aprioriy);
58 copy(pointObject,
"AprioriZ",
59 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_aprioriz);
60 copy(pointObject,
"AdjustedX",
61 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_adjustedx);
62 copy(pointObject,
"AdjustedY",
63 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_adjustedy);
64 copy(pointObject,
"AdjustedZ",
65 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_adjustedz);
66 copy(pointObject,
"LatitudeConstrained",
67 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_latitudeconstrained);
68 copy(pointObject,
"LongitudeConstrained",
69 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_longitudeconstrained);
70 copy(pointObject,
"RadiusConstrained",
71 m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_radiusconstrained);
75 if (pointObject[
"PointType"][0] ==
"Ground") {
76 m_pointData->set_type(ControlNetFileProtoV0001_PBControlPoint::Ground);
78 else if (pointObject[
"PointType"][0] ==
"Tie") {
79 m_pointData->set_type(ControlNetFileProtoV0001_PBControlPoint::Tie);
82 QString msg =
"Invalid ControlPoint type [" + pointObject[
"PointType"][0] +
"].";
86 if (pointObject.
hasKeyword(
"AprioriXYZSource")) {
87 QString source = pointObject[
"AprioriXYZSource"][0];
89 if (source ==
"None") {
90 m_pointData->set_apriorisurfpointsource(ControlNetFileProtoV0001_PBControlPoint::None);
92 else if (source ==
"User") {
93 m_pointData->set_apriorisurfpointsource(ControlNetFileProtoV0001_PBControlPoint::User);
95 else if (source ==
"AverageOfMeasures") {
97 ControlNetFileProtoV0001_PBControlPoint::AverageOfMeasures);
99 else if (source ==
"Reference") {
101 ControlNetFileProtoV0001_PBControlPoint::Reference);
103 else if (source ==
"Basemap") {
104 m_pointData->set_apriorisurfpointsource(ControlNetFileProtoV0001_PBControlPoint::Basemap);
106 else if (source ==
"BundleSolution") {
108 ControlNetFileProtoV0001_PBControlPoint::BundleSolution);
111 QString msg =
"Invalid AprioriXYZSource [" + source +
"]";
116 if (pointObject.
hasKeyword(
"AprioriRadiusSource")) {
117 QString source = pointObject[
"AprioriRadiusSource"][0];
119 if (source ==
"None") {
120 m_pointData->set_aprioriradiussource(ControlNetFileProtoV0001_PBControlPoint::None);
122 else if (source ==
"User") {
123 m_pointData->set_aprioriradiussource(ControlNetFileProtoV0001_PBControlPoint::User);
125 else if (source ==
"AverageOfMeasures") {
127 ControlNetFileProtoV0001_PBControlPoint::AverageOfMeasures);
129 else if (source ==
"Ellipsoid") {
130 m_pointData->set_aprioriradiussource(ControlNetFileProtoV0001_PBControlPoint::Ellipsoid);
132 else if (source ==
"DEM") {
133 m_pointData->set_aprioriradiussource(ControlNetFileProtoV0001_PBControlPoint::DEM);
135 else if (source ==
"BundleSolution") {
137 ControlNetFileProtoV0001_PBControlPoint::BundleSolution);
140 QString msg =
"Invalid AprioriRadiusSource, [" + source +
"]";
146 if (pointObject.
hasKeyword(
"AprioriCovarianceMatrix")) {
147 PvlKeyword &matrix = pointObject[
"AprioriCovarianceMatrix"];
157 if (pointObject.
hasKeyword(
"AdjustedCovarianceMatrix")) {
158 PvlKeyword &matrix = pointObject[
"AdjustedCovarianceMatrix"];
169 for (
int groupIndex = 0; groupIndex < pointObject.
groups(); groupIndex ++) {
171 ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure measure;
174 copy(group,
"SerialNumber",
175 measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_serialnumber);
176 copy(group,
"ChooserName",
177 measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_choosername);
178 copy(group,
"DateTime",
179 measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_datetime);
180 copy(group,
"Diameter",
181 measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_diameter);
182 copy(group,
"EditLock",
183 measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_editlock);
184 copy(group,
"Ignore",
185 measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_ignore);
186 copy(group,
"JigsawRejected",
187 measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_jigsawrejected);
188 copy(group,
"AprioriSample",
189 measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_apriorisample);
190 copy(group,
"AprioriLine",
191 measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_aprioriline);
192 copy(group,
"SampleSigma",
193 measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_samplesigma);
194 copy(group,
"LineSigma",
195 measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_linesigma);
200 double value =
toDouble(group[
"Sample"][0]);
201 measure.mutable_measurement()->set_sample(value);
205 double value =
toDouble(group[
"Line"][0]);
206 measure.mutable_measurement()->set_line(value);
210 double value =
toDouble(group[
"SampleResidual"][0]);
211 measure.mutable_measurement()->set_sampleresidual(value);
215 double value =
toDouble(group[
"LineResidual"][0]);
216 measure.mutable_measurement()->set_lineresidual(value);
220 if (group[
"Reference"][0].toLower() ==
"true") {
226 QString type = group[
"MeasureType"][0].toLower();
227 if (type ==
"candidate") {
228 measure.set_type(ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::Candidate);
230 else if (type ==
"manual") {
231 measure.set_type(ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::Manual);
233 else if (type ==
"registeredpixel") {
235 ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::RegisteredPixel);
237 else if (type ==
"registeredsubpixel") {
239 ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::RegisteredSubPixel);
243 "Unknown measure type [" + type +
"]",
250 for (
int cmKeyIndex = 0; cmKeyIndex < group.
keywords(); cmKeyIndex ++) {
251 if (group[cmKeyIndex][0] ==
"" 252 || group[cmKeyIndex].name() ==
"ZScore" 253 || group[cmKeyIndex].
name() ==
"ErrorMagnitude") {
259 ControlNetLogDataProtoV0001_Point_Measure measureLogData;
261 for (
int keyIndex = 0; keyIndex < group.
keywords(); keyIndex++) {
263 QString name = dataKeyword.
name();
267 if (name ==
"Obsolete_Eccentricity") {
270 else if (name ==
"GoodnessOfFit") {
273 else if (name ==
"MinimumPixelZScore") {
276 else if (name ==
"MaximumPixelZScore") {
279 else if (name ==
"PixelShift") {
282 else if (name ==
"WholePixelCorrelation") {
285 else if (name ==
"SubPixelCorrelation") {
288 else if (name ==
"Obsolete_AverageResidual") {
292 QString msg =
"Invalid control measure log data name [" + name +
"]";
300 QString msg =
"Invalid control measure log data value [" + dataKeyword[0] +
"]";
304 ControlNetLogDataProtoV0001_Point_Measure_DataEntry logEntry;
305 logEntry.set_datatype(dataType);
306 logEntry.set_datavalue(value);
307 *measureLogData.add_loggedmeasuredata() = logEntry;
312 *
m_logData->add_measures() = measureLogData;
316 QString msg =
"There is missing required information in the control " 317 "points or measures";
334 : m_pointData(oldPoint.pointData()), m_logData(oldPoint.logData()) {
378 void (ControlNetFileProtoV0001_PBControlPoint::*setter)(
bool)) {
384 QString value = container[keyName][0];
386 value = value.toLower();
388 if (value ==
"true" || value ==
"yes") {
389 (point.data()->*setter)(
true);
411 void (ControlNetFileProtoV0001_PBControlPoint::*setter)(
double)) {
417 double value =
toDouble(container[keyName][0]);
419 (point.data()->*setter)(value);
440 void (ControlNetFileProtoV0001_PBControlPoint::*setter)(
const std::string&)) {
446 QString value = container[keyName][0];
448 (point.data()->*setter)(value.toLatin1().data());
468 ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure &measure,
469 void (ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::*setter)(
bool)) {
475 QString value = container[keyName][0];
477 value = value.toLower();
479 if (value ==
"true" || value ==
"yes") {
480 (measure.*setter)(
true);
501 ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure &measure,
502 void (ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::*setter)(
double)) {
508 double value =
toDouble(container[keyName][0]);
510 (measure.*setter)(value);
530 ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure &measure,
531 void (ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::*setter)
532 (
const std::string &)) {
538 QString value = container[keyName][0];
540 (measure.*setter)(value.toLatin1().data());
int keywords() const
Returns the number of keywords contained in the PvlContainer.
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Contains more than one keyword-value pair.
void copy(PvlContainer &container, QString keyName, QSharedPointer< ControlNetFileProtoV0001_PBControlPoint > point, void(ControlNetFileProtoV0001_PBControlPoint::*setter)(bool))
This convenience method takes a boolean value from a PvlKeyword and copies it into a version 1 protob...
Namespace for the standard library.
double toDouble(const QString &string)
Global function to convert from a string to a double.
This error is for when a programmer made an API call that was illegal.
A type of error that occurred when performing an actual I/O operation.
bool hasKeyword(const QString &kname, FindOptions opts) const
See if a keyword is in the current PvlObject, or deeper inside other PvlObjects and Pvlgroups within ...
QString name() const
Returns the container name.
QSharedPointer< ControlNetFileProtoV0001_PBControlPoint > pointData()
Access the protobuf control point data.
QSharedPointer< ControlNetLogDataProtoV0001_Point > logData()
Access the protobuf log data for the control measures in the point.
Contains multiple PvlContainers.
#define _FILEINFO_
Macro for the filename and line number.
A type of error that could only have occurred due to a mistake on the user's part (e...
A single keyword-value pair.
ControlPointV0002()
Default constructor.
A container for the information stored in a version 1 ControlPoint.
QSharedPointer< ControlNetFileProtoV0001_PBControlPoint > m_pointData
protobuf container that holds information used to create a control point.
PvlGroup & group(const int index)
Return the group at the specified index.
QSharedPointer< ControlNetLogDataProtoV0001_Point > m_logData
Protobuf container that holds log data for the control measures in the point.
QString name() const
Returns the keyword name.
Namespace for ISIS/Bullet specific routines.
int groups() const
Returns the number of groups contained.
Contains Pvl Groups and Pvl Objects.
void deleteKeyword(const QString &name)
Remove a specified keyword.