Isis 3 Programmer Reference
ControlPointV0001.cpp
1 #include "ControlPointV0001.h"
2 
3 #include <QString>
4 
6 #include "Distance.h"
7 #include "IException.h"
8 #include "Latitude.h"
9 #include "Longitude.h"
10 #include "NaifStatus.h"
11 #include "Pvl.h"
12 #include "PvlContainer.h"
13 #include "SpecialPixel.h"
14 #include "SurfacePoint.h"
15 #include "Target.h"
16 
17 using namespace std;
18 
19 namespace Isis {
20 
27  ControlPointV0001::ControlPointV0001(
30  : m_pointData(pointData), m_logData(logData) {
31 
32  }
33 
34 
41  ControlPointV0001::ControlPointV0001(PvlObject &pointObject, const QString targetName)
42  : m_pointData(new ControlNetFileProtoV0001_PBControlPoint),
43  m_logData(new ControlNetLogDataProtoV0001_Point) {
44  // Clean up the Pvl control point
45  // Anything that doesn't have a value is removed
46  for (int cpKeyIndex = 0; cpKeyIndex < pointObject.keywords(); cpKeyIndex ++) {
47  if (pointObject[cpKeyIndex][0] == "") {
48  pointObject.deleteKeyword(cpKeyIndex);
49  }
50  }
51 
52  // Copy over POD values
53  copy(pointObject, "PointId",
54  m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_id);
55  copy(pointObject, "ChooserName",
56  m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_choosername);
57  copy(pointObject, "DateTime",
58  m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_datetime);
59  copy(pointObject, "AprioriXYZSourceFile",
60  m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_apriorisurfpointsourcefile);
61  copy(pointObject, "AprioriLatLonSourceFile",
62  m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_apriorisurfpointsourcefile);
63  copy(pointObject, "AprioriRadiusSourceFile",
64  m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_aprioriradiussourcefile);
65  copy(pointObject, "JigsawRejected",
66  m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_jigsawrejected);
67  copy(pointObject, "EditLock",
68  m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_editlock);
69  copy(pointObject, "Ignore",
70  m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_ignore);
71  copy(pointObject, "LatitudeConstrained",
72  m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_latitudeconstrained);
73  copy(pointObject, "LongitudeConstrained",
74  m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_longitudeconstrained);
75  copy(pointObject, "RadiusConstrained",
76  m_pointData, &ControlNetFileProtoV0001_PBControlPoint::set_radiusconstrained);
77  // Copy over the adjusted surface point
78  if ( pointObject.hasKeyword("Latitude")
79  && pointObject.hasKeyword("Longitude")
80  && pointObject.hasKeyword("Radius") ) {
81  SurfacePoint adjustedPoint(
82  Latitude(toDouble(pointObject["Latitude"][0]), Angle::Degrees),
83  Longitude(toDouble(pointObject["Longitude"][0]), Angle::Degrees),
84  Distance(toDouble(pointObject["Radius"][0]), Distance::Meters));
85 
86  m_pointData->set_adjustedx( adjustedPoint.GetX().meters() );
87  m_pointData->set_adjustedy( adjustedPoint.GetY().meters() );
88  m_pointData->set_adjustedz( adjustedPoint.GetZ().meters() );
89  }
90  else if ( pointObject.hasKeyword("X")
91  && pointObject.hasKeyword("Y")
92  && pointObject.hasKeyword("Z") ) {
93  m_pointData->set_adjustedx( toDouble(pointObject["X"][0]) );
94  m_pointData->set_adjustedy( toDouble(pointObject["Y"][0]) );
95  m_pointData->set_adjustedz( toDouble(pointObject["Z"][0]) );
96  }
97 
98  // copy over the apriori surface point
99  if ( pointObject.hasKeyword("AprioriLatitude")
100  && pointObject.hasKeyword("AprioriLongitude")
101  && pointObject.hasKeyword("AprioriRadius") ) {
102  SurfacePoint aprioriPoint(
103  Latitude(toDouble(pointObject["AprioriLatitude"][0]), Angle::Degrees),
104  Longitude(toDouble(pointObject["AprioriLongitude"][0]), Angle::Degrees),
105  Distance(toDouble(pointObject["AprioriRadius"][0]), Distance::Meters));
106 
107  m_pointData->set_apriorix( aprioriPoint.GetX().meters() );
108  m_pointData->set_aprioriy( aprioriPoint.GetY().meters() );
109  m_pointData->set_aprioriz( aprioriPoint.GetZ().meters() );
110  }
111  else if ( pointObject.hasKeyword("AprioriX")
112  && pointObject.hasKeyword("AprioriY")
113  && pointObject.hasKeyword("AprioriZ") ) {
114  m_pointData->set_apriorix( toDouble(pointObject["AprioriX"][0]) );
115  m_pointData->set_aprioriy( toDouble(pointObject["AprioriY"][0]) );
116  m_pointData->set_aprioriz( toDouble(pointObject["AprioriZ"][0]) );
117  }
118  // If the apriori values are missing, copy them from the adjusted.
119  else if ( m_pointData->has_adjustedx()
120  && m_pointData->has_adjustedy()
121  && m_pointData->has_adjustedz() ) {
122  m_pointData->set_apriorix( m_pointData->adjustedx() );
123  m_pointData->set_aprioriy( m_pointData->adjustedy() );
124  m_pointData->set_aprioriz( m_pointData->adjustedz() );
125  }
126 
127  // Ground points were previously flagged by the Held keyword being true.
128  if ( (pointObject.hasKeyword("Held") && pointObject["Held"][0] == "True")
129  || (pointObject["PointType"][0] == "Ground") ) {
130  m_pointData->set_type(ControlNetFileProtoV0001_PBControlPoint::Ground);
131  }
132  else if (pointObject["PointType"][0] == "Tie") {
133  m_pointData->set_type(ControlNetFileProtoV0001_PBControlPoint::Tie);
134  }
135  else {
136  QString msg = "Invalid ControlPoint type [" + pointObject["PointType"][0] + "].";
138  }
139 
140  if (pointObject.hasKeyword("AprioriXYZSource")) {
141  QString source = pointObject["AprioriXYZSource"][0];
142 
143  if (source == "None") {
144  m_pointData->set_apriorisurfpointsource(ControlNetFileProtoV0001_PBControlPoint::None);
145  }
146  else if (source == "User") {
147  m_pointData->set_apriorisurfpointsource(ControlNetFileProtoV0001_PBControlPoint::User);
148  }
149  else if (source == "AverageOfMeasures") {
150  m_pointData->set_apriorisurfpointsource(
151  ControlNetFileProtoV0001_PBControlPoint::AverageOfMeasures);
152  }
153  else if (source == "Reference") {
154  m_pointData->set_apriorisurfpointsource(
155  ControlNetFileProtoV0001_PBControlPoint::Reference);
156  }
157  else if (source == "Basemap") {
158  m_pointData->set_apriorisurfpointsource(ControlNetFileProtoV0001_PBControlPoint::Basemap);
159  }
160  else if (source == "BundleSolution") {
161  m_pointData->set_apriorisurfpointsource(
162  ControlNetFileProtoV0001_PBControlPoint::BundleSolution);
163  }
164  else {
165  QString msg = "Invalid AprioriXYZSource [" + source + "]";
167  }
168  }
169 
170  if (pointObject.hasKeyword("AprioriLatLonSource")) {
171  QString source = pointObject["AprioriLatLonSource"][0];
172 
173  if (source == "None") {
174  m_pointData->set_apriorisurfpointsource(ControlNetFileProtoV0001_PBControlPoint::None);
175  }
176  else if (source == "User") {
177  m_pointData->set_apriorisurfpointsource(ControlNetFileProtoV0001_PBControlPoint::User);
178  }
179  else if (source == "AverageOfMeasures") {
180  m_pointData->set_apriorisurfpointsource(
181  ControlNetFileProtoV0001_PBControlPoint::AverageOfMeasures);
182  }
183  else if (source == "Reference") {
184  m_pointData->set_apriorisurfpointsource(
185  ControlNetFileProtoV0001_PBControlPoint::Reference);
186  }
187  else if (source == "Basemap") {
188  m_pointData->set_apriorisurfpointsource(ControlNetFileProtoV0001_PBControlPoint::Basemap);
189  }
190  else if (source == "BundleSolution") {
191  m_pointData->set_apriorisurfpointsource(
192  ControlNetFileProtoV0001_PBControlPoint::BundleSolution);
193  }
194  else {
195  QString msg = "Invalid AprioriLatLonSource [" + source + "]";
197  }
198  }
199 
200  if (pointObject.hasKeyword("AprioriRadiusSource")) {
201  QString source = pointObject["AprioriRadiusSource"][0];
202 
203  if (source == "None") {
204  m_pointData->set_aprioriradiussource(ControlNetFileProtoV0001_PBControlPoint::None);
205  }
206  else if (source == "User") {
207  m_pointData->set_aprioriradiussource(ControlNetFileProtoV0001_PBControlPoint::User);
208  }
209  else if (source == "AverageOfMeasures") {
210  m_pointData->set_aprioriradiussource(
211  ControlNetFileProtoV0001_PBControlPoint::AverageOfMeasures);
212  }
213  else if (source == "Ellipsoid") {
214  m_pointData->set_aprioriradiussource(ControlNetFileProtoV0001_PBControlPoint::Ellipsoid);
215  }
216  else if (source == "DEM") {
217  m_pointData->set_aprioriradiussource(ControlNetFileProtoV0001_PBControlPoint::DEM);
218  }
219  else if (source == "BundleSolution") {
220  m_pointData->set_aprioriradiussource(
221  ControlNetFileProtoV0001_PBControlPoint::BundleSolution);
222  }
223  else {
224  QString msg = "Invalid AprioriRadiusSource, [" + source + "]";
226  }
227  }
228 
229  // Copy the covariance matrices
230  // Sometimes they are not stored in version 1 Pvls so we compute them from the
231  // surface point sigmas using the local radius to convert to/from angular units.
232 
233  // Add the Apriori Covariance Matrix
234  if ( pointObject.hasKeyword("AprioriCovarianceMatrix") ) {
235  PvlKeyword &matrix = pointObject["AprioriCovarianceMatrix"];
236 
237  m_pointData->add_aprioricovar(toDouble(matrix[0]));
238  m_pointData->add_aprioricovar(toDouble(matrix[1]));
239  m_pointData->add_aprioricovar(toDouble(matrix[2]));
240  m_pointData->add_aprioricovar(toDouble(matrix[3]));
241  m_pointData->add_aprioricovar(toDouble(matrix[4]));
242  m_pointData->add_aprioricovar(toDouble(matrix[5]));
243 
244  m_pointData->set_latitudeconstrained(true);
245  m_pointData->set_longitudeconstrained(true);
246  m_pointData->set_radiusconstrained(true);
247  }
248  else if ( pointObject.hasKeyword("AprioriSigmaLatitude")
249  || pointObject.hasKeyword("AprioriSigmaLongitude")
250  || pointObject.hasKeyword("AprioriSigmaRadius") ) {
251  // There may be missing or negative apriori sigmas so default to 10,000
252  double sigmaLat = 10000.0;
253  double sigmaLon = 10000.0;
254  double sigmaRad = 10000.0;
255 
256  if ( pointObject.hasKeyword("AprioriSigmaLatitude") ) {
257  if (toDouble(pointObject["AprioriSigmaLatitude"][0]) > 0
258  && toDouble(pointObject["AprioriSigmaLatitude"][0]) < sigmaLat) {
259  sigmaLat = toDouble(pointObject["AprioriSigmaLatitude"][0]);
260  }
261  m_pointData->set_latitudeconstrained(true);
262  }
263 
264  if ( pointObject.hasKeyword("AprioriSigmaLongitude") ) {
265  if (toDouble(pointObject["AprioriSigmaLongitude"][0]) > 0
266  && toDouble(pointObject["AprioriSigmaLongitude"][0]) < sigmaLon) {
267  sigmaLon = toDouble(pointObject["AprioriSigmaLongitude"][0]);
268  }
269  m_pointData->set_longitudeconstrained(true);
270  }
271 
272  if ( pointObject.hasKeyword("AprioriSigmaRadius") ) {
273  if (toDouble(pointObject["AprioriSigmaRadius"][0]) > 0
274  && toDouble(pointObject["AprioriSigmaRadius"][0]) < sigmaRad) {
275  sigmaRad = toDouble(pointObject["AprioriSigmaRadius"][0]);
276  }
277  m_pointData->set_radiusconstrained(true);
278  }
279 
280  SurfacePoint aprioriPoint;
281  aprioriPoint.SetRectangular( Displacement(m_pointData->apriorix(), Displacement::Meters),
284  aprioriPoint.SetSphericalSigmasDistance( Distance(sigmaLat, Distance::Meters),
285  Distance(sigmaLon, Distance::Meters),
286  Distance(sigmaRad, Distance::Meters) );
287  m_pointData->add_aprioricovar( aprioriPoint.GetRectangularMatrix()(0, 0) );
288  m_pointData->add_aprioricovar( aprioriPoint.GetRectangularMatrix()(0, 1) );
289  m_pointData->add_aprioricovar( aprioriPoint.GetRectangularMatrix()(0, 2) );
290  m_pointData->add_aprioricovar( aprioriPoint.GetRectangularMatrix()(1, 1) );
291  m_pointData->add_aprioricovar( aprioriPoint.GetRectangularMatrix()(1, 2) );
292  m_pointData->add_aprioricovar( aprioriPoint.GetRectangularMatrix()(2, 2) );
293  }
294 
295  // Add the Adjusted (Apost) Covariance Matrix
296  if ( pointObject.hasKeyword("ApostCovarianceMatrix") ) {
297  PvlKeyword &matrix = pointObject["ApostCovarianceMatrix"];
298 
299  m_pointData->add_adjustedcovar(toDouble(matrix[0]));
300  m_pointData->add_adjustedcovar(toDouble(matrix[1]));
301  m_pointData->add_adjustedcovar(toDouble(matrix[2]));
302  m_pointData->add_adjustedcovar(toDouble(matrix[3]));
303  m_pointData->add_adjustedcovar(toDouble(matrix[4]));
304  m_pointData->add_adjustedcovar(toDouble(matrix[5]));
305 
306  m_pointData->set_latitudeconstrained(true);
307  m_pointData->set_longitudeconstrained(true);
308  m_pointData->set_radiusconstrained(true);
309  }
310  else if ( pointObject.hasKeyword("AdjustedSigmaLatitude")
311  || pointObject.hasKeyword("AdjustedSigmaLongitude")
312  || pointObject.hasKeyword("AdjustedSigmaRadius") ) {
313  // There may be missing or negative adjusted sigmas so default to 10,000
314  double sigmaLat = 10000.0;
315  double sigmaLon = 10000.0;
316  double sigmaRad = 10000.0;
317 
318  if ( pointObject.hasKeyword("AdjustedSigmaLatitude") ) {
319  if (toDouble(pointObject["AdjustedSigmaLatitude"][0]) > 0
320  && toDouble(pointObject["AdjustedSigmaLatitude"][0]) < sigmaLat) {
321  sigmaLat = toDouble(pointObject["AdjustedSigmaLatitude"][0]);
322  }
323  }
324 
325  if ( pointObject.hasKeyword("AdjustedSigmaLongitude") ) {
326  if (toDouble(pointObject["AdjustedSigmaLongitude"][0]) > 0
327  && toDouble(pointObject["AdjustedSigmaLongitude"][0]) < sigmaLon) {
328  sigmaLon = toDouble(pointObject["AdjustedSigmaLongitude"][0]);
329  }
330  }
331 
332  if ( pointObject.hasKeyword("AdjustedSigmaRadius") ) {
333  if (toDouble(pointObject["AdjustedSigmaRadius"][0]) > 0
334  && toDouble(pointObject["AdjustedSigmaRadius"][0]) < sigmaRad) {
335  sigmaRad = toDouble(pointObject["AdjustedSigmaRadius"][0]);
336  }
337  }
338 
339  SurfacePoint adjustedPoint;
340  adjustedPoint.SetRectangular( Displacement(m_pointData->adjustedx(), Displacement::Meters),
343  adjustedPoint.SetSphericalSigmasDistance( Distance(sigmaLat, Distance::Meters),
344  Distance(sigmaLon, Distance::Meters),
345  Distance(sigmaRad, Distance::Meters) );
346  m_pointData->add_adjustedcovar( adjustedPoint.GetRectangularMatrix()(0, 0) );
347  m_pointData->add_adjustedcovar( adjustedPoint.GetRectangularMatrix()(0, 1) );
348  m_pointData->add_adjustedcovar( adjustedPoint.GetRectangularMatrix()(0, 2) );
349  m_pointData->add_adjustedcovar( adjustedPoint.GetRectangularMatrix()(1, 1) );
350  m_pointData->add_adjustedcovar( adjustedPoint.GetRectangularMatrix()(1, 2) );
351  m_pointData->add_adjustedcovar( adjustedPoint.GetRectangularMatrix()(2, 2) );
352  }
353 
354  // Process Measures
355  for (int groupIndex = 0; groupIndex < pointObject.groups(); groupIndex ++) {
356  PvlGroup &group = pointObject.group(groupIndex);
357  ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure measure;
358 
359  // Copy strings, booleans, and doubles
360  copy(group, "SerialNumber",
361  measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_serialnumber);
362  copy(group, "ChooserName",
363  measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_choosername);
364  copy(group, "DateTime",
365  measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_datetime);
366  copy(group, "Diameter",
367  measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_diameter);
368  copy(group, "EditLock",
369  measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_editlock);
370  copy(group, "Ignore",
371  measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_ignore);
372  copy(group, "JigsawRejected",
373  measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_jigsawrejected);
374  copy(group, "AprioriSample",
375  measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_apriorisample);
376  copy(group, "AprioriLine",
377  measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_aprioriline);
378  copy(group, "SampleSigma",
379  measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_samplesigma);
380  copy(group, "LineSigma",
381  measure, &ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::set_linesigma);
382 
383  // The sample, line, sample residual, and line residual are nested in another structure
384  // inside the measure, so they cannot be copied with the conenience methods.
385  if (group.hasKeyword("Sample")) {
386  // The sample may not be a numeric value
387  // in this case set it to 0 and ignore the measure
388  double value;
389  try {
390  value = toDouble(group["Sample"][0]);
391  }
392  catch (...) {
393  value = 0;
394  measure.set_ignore(true);
395  }
396  measure.mutable_measurement()->set_sample(value);
397  group.deleteKeyword("Sample");
398  }
399  if (group.hasKeyword("Line")) {
400  // The line may not be a numeric value
401  // in this case set it to 0 and ignore the measure
402  double value;
403  try {
404  value = toDouble(group["Line"][0]);
405  }
406  catch (...) {
407  value = 0;
408  measure.set_ignore(true);
409  }
410  measure.mutable_measurement()->set_line(value);
411  group.deleteKeyword("Line");
412  }
413 
414  // Some old networks use ErrorSample and ErrorLine,
415  // others use SampleResidual and LineResidual so check for both
416  if (group.hasKeyword("ErrorSample")) {
417  double value = toDouble(group["ErrorSample"][0]);
418  measure.mutable_measurement()->set_sampleresidual(value);
419  group.deleteKeyword("ErrorSample");
420  }
421  if (group.hasKeyword("ErrorLine")) {
422  double value = toDouble(group["ErrorLine"][0]);
423  measure.mutable_measurement()->set_lineresidual(value);
424  group.deleteKeyword("ErrorLine");
425  }
426 
427  if (group.hasKeyword("SampleResidual")) {
428  double value = toDouble(group["SampleResidual"][0]);
429  measure.mutable_measurement()->set_sampleresidual(value);
430  group.deleteKeyword("SampleResidual");
431  }
432 
433  if (group.hasKeyword("LineResidual")) {
434  double value = toDouble(group["LineResidual"][0]);
435  measure.mutable_measurement()->set_lineresidual(value);
436  group.deleteKeyword("LineResidual");
437  }
438 
439  if (group.hasKeyword("Reference")) {
440  if (group["Reference"][0].toLower() == "true") {
441  m_pointData->set_referenceindex(groupIndex);
442  }
443  group.deleteKeyword("Reference");
444  }
445 
446  // Copy the measure type
447  if (group.hasKeyword("MeasureType")) {
448  QString type = group["MeasureType"][0].toLower();
449  if (type == "estimated"
450  || type == "unmeasured"
451  || type == "candidate") {
452  measure.set_type(ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::Candidate);
453  }
454  else if (type == "manual") {
455  measure.set_type(ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::Manual);
456  }
457  else if (type == "automatic"
458  || type == "validatedmanual"
459  || type == "automaticpixel") {
460  measure.set_type(ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::RegisteredPixel);
461  }
462  else if (type == "validatedautomatic"
463  || type == "automaticsubpixel") {
464  measure.set_type(ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::RegisteredSubPixel);
465  }
466  else {
468  "Unknown measure type [" + type + "]",
469  _FILEINFO_);
470  }
471  group.deleteKeyword("MeasureType");
472  }
473 
474  // Clean up the remaining keywords
475  for (int cmKeyIndex = 0; cmKeyIndex < group.keywords(); cmKeyIndex++) {
476  if (group[cmKeyIndex][0] == ""
477  || group[cmKeyIndex].name() == "ZScore"
478  || group[cmKeyIndex].name() == "ErrorMagnitude") {
479  group.deleteKeyword(cmKeyIndex);
480  cmKeyIndex--;
481  }
482  }
483 
484  // Create the log data for the measure
485  ControlNetLogDataProtoV0001_Point_Measure measureLogData;
486 
487  for (int keyIndex = 0; keyIndex < group.keywords(); keyIndex++) {
488  PvlKeyword dataKeyword = group[keyIndex];
489  QString name = dataKeyword.name();
490  int dataType = 0;
491  double value = 0.0;
492 
493  if (name == "Obsolete_Eccentricity") {
494  dataType = 1;
495  }
496  else if (name == "GoodnessOfFit") {
497  dataType = 2;
498  }
499  else if (name == "MinimumPixelZScore") {
500  dataType = 3;
501  }
502  else if (name == "MaximumPixelZScore") {
503  dataType = 4;
504  }
505  else if (name == "PixelShift") {
506  dataType = 5;
507  }
508  else if (name == "WholePixelCorrelation") {
509  dataType = 6;
510  }
511  else if (name == "SubPixelCorrelation") {
512  dataType = 7;
513  }
514  else if (name == "Obsolete_AverageResidual") {
515  dataType = 8;
516  }
517  else {
518  QString msg = "Invalid control measure log data name [" + name + "]";
520  }
521 
522  try {
523  value = toDouble(dataKeyword[0]);
524  }
525  catch (IException &e) {
526  QString msg = "Invalid control measure log data value [" + dataKeyword[0] + "]";
527  throw IException(e, IException::Io, msg, _FILEINFO_);
528  }
529 
530  ControlNetLogDataProtoV0001_Point_Measure_DataEntry logEntry;
531  logEntry.set_datatype(dataType);
532  logEntry.set_datavalue(value);
533  *measureLogData.add_loggedmeasuredata() = logEntry;
534  }
535 
536  // Store the measure and its log data
537  *m_pointData->add_measures() = measure;
538  *m_logData->add_measures() = measureLogData;
539  }
540 
541  if (!m_pointData->IsInitialized()) {
542  QString msg = "There is missing required information in the control "
543  "points or measures";
544  throw IException(IException::Io, msg, _FILEINFO_);
545  }
546 
547  }
548 
549 
557  return m_pointData;
558  }
559 
560 
568  return m_logData;
569  }
570 
571 
587  QString keyName,
589  void (ControlNetFileProtoV0001_PBControlPoint::*setter)(bool)) {
590 
591  if (!container.hasKeyword(keyName)) {
592  return;
593  }
594 
595  QString value = container[keyName][0];
596  container.deleteKeyword(keyName);
597  value = value.toLower();
598 
599  if (value == "true" || value == "yes") {
600  (point.data()->*setter)(true);
601  }
602  }
603 
604 
620  QString keyName,
622  void (ControlNetFileProtoV0001_PBControlPoint::*setter)(double)) {
623 
624  if (!container.hasKeyword(keyName)) {
625  return;
626  }
627 
628  double value = toDouble(container[keyName][0]);
629  container.deleteKeyword(keyName);
630  (point.data()->*setter)(value);
631  }
632 
633 
649  QString keyName,
651  void (ControlNetFileProtoV0001_PBControlPoint::*setter)(const std::string&)) {
652 
653  if (!container.hasKeyword(keyName)) {
654  return;
655  }
656 
657  QString value = container[keyName][0];
658  container.deleteKeyword(keyName);
659  (point.data()->*setter)(value.toLatin1().data());
660  }
661 
662 
678  QString keyName,
679  ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure &measure,
680  void (ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::*setter)(bool)) {
681 
682  if (!container.hasKeyword(keyName)) {
683  return;
684  }
685 
686  QString value = container[keyName][0];
687  container.deleteKeyword(keyName);
688  value = value.toLower();
689 
690  if (value == "true" || value == "yes") {
691  (measure.*setter)(true);
692  }
693  }
694 
695 
711  QString keyName,
712  ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure &measure,
713  void (ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::*setter)(double)) {
714 
715  if (!container.hasKeyword(keyName)) {
716  return;
717  }
718 
719  double value = Isis::Null;
720  if ( container.hasKeyword(keyName) ) {
721  value = toDouble(container[keyName][0]);
722  container.deleteKeyword(keyName);
723 
724  }
725 
726  (measure.*setter)(value);
727  }
728 
729 
745  QString keyName,
746  ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure &measure,
747  void (ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure::*setter)
748  (const std::string &)) {
749 
750  if (!container.hasKeyword(keyName)) {
751  return;
752  }
753 
754 
755  QString value = container[keyName][0];
756  container.deleteKeyword(keyName);
757  (measure.*setter)(value.toLatin1().data());
758  }
759 }
This class defines a body-fixed surface point.
Definition: SurfacePoint.h:148
int keywords() const
Returns the number of keywords contained in the PvlContainer.
Definition: PvlContainer.h:100
QSharedPointer< ControlNetLogDataProtoV0001_Point > m_logData
Protobuf container that holds log data for the control measures in the point.
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.
const double Null
Value for an Isis Null pixel.
Definition: SpecialPixel.h:110
QSharedPointer< ControlNetLogDataProtoV0001_Point > logData()
Access the protobuf log data for the control measures in the point.
Contains more than one keyword-value pair.
Definition: PvlContainer.h:63
QSharedPointer< ControlNetFileProtoV0001_PBControlPoint > pointData()
Access the protobuf control point data.
double meters() const
Get the displacement in meters.
Namespace for the standard library.
This class is designed to encapsulate the concept of a Latitude.
Definition: Latitude.h:63
ControlPointV0001()
Default constructor.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
double toDouble(const QString &string)
Global function to convert from a string to a double.
Definition: IString.cpp:164
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:162
A type of error that occurred when performing an actual I/O operation.
Definition: IException.h:171
The distance is being specified in meters.
Definition: Displacement.h:52
Distance measurement, usually in meters.
Definition: Distance.h:47
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 ...
Definition: PvlObject.cpp:207
QString name() const
Returns the container name.
Definition: PvlContainer.h:77
This class is designed to encapsulate the concept of a Longitude.
Definition: Longitude.h:52
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
Definition: Angle.h:73
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:40
A type of error that could only have occurred due to a mistake on the user&#39;s part (e...
Definition: IException.h:142
A single keyword-value pair.
Definition: PvlKeyword.h:98
QSharedPointer< ControlNetFileProtoV0001_PBControlPoint > m_pointData
Protobuf container that holds information used to create a control point.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
PvlGroup & group(const int index)
Return the group at the specified index.
Definition: PvlObject.cpp:423
Displacement is a signed length, usually in meters.
Definition: Displacement.h:43
QString name() const
Returns the keyword name.
Definition: PvlKeyword.h:114
Isis exception class.
Definition: IException.h:107
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
void SetSphericalSigmasDistance(const Distance &latSigma, const Distance &lonSigma, const Distance &radiusSigma)
Set the spherical sigmas (in Distance units) into the spherical variance/covariance matrix...
The distance is being specified in meters.
Definition: Distance.h:56
int groups() const
Returns the number of groups contained.
Definition: PvlObject.h:87
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:74
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...
void SetRectangular(const Displacement &x, const Displacement &y, const Displacement &z, const Distance &xSigma=Distance(), const Distance &ySigma=Distance(), const Distance &zSigma=Distance())
Set surface point in rectangular body-fixed coordinates wtih optional sigmas.
void deleteKeyword(const QString &name)
Remove a specified keyword.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.