Isis 3 Programmer Reference
ControlPointV0003.cpp
1 #include "ControlPointV0003.h"
2 
3 #include <QString>
4 
6 #include "ControlPointFileEntryV0002.pb.h"
7 #include "ControlPointV0002.h"
8 #include "IException.h"
9 #include "PvlObject.h"
10 #include "PvlContainer.h"
11 
12 using namespace std;
13 
14 namespace Isis {
15 
21  ControlPointV0003::ControlPointV0003(QSharedPointer<ControlPointFileEntryV0002> pointData)
22  : m_pointData(pointData) {
23 
24  }
25 
26 
33  : m_pointData(new ControlPointFileEntryV0002) {
34 
35  // Copy over strings, doubles, and bools
36  copy(pointObject, "PointId",
37  m_pointData, &ControlPointFileEntryV0002::set_id);
38  copy(pointObject, "ChooserName",
39  m_pointData, &ControlPointFileEntryV0002::set_choosername);
40  copy(pointObject, "DateTime",
41  m_pointData, &ControlPointFileEntryV0002::set_datetime);
42  copy(pointObject, "AprioriXYZSourceFile",
43  m_pointData, &ControlPointFileEntryV0002::set_apriorisurfpointsourcefile);
44  copy(pointObject, "AprioriRadiusSourceFile",
45  m_pointData, &ControlPointFileEntryV0002::set_aprioriradiussourcefile);
46  copy(pointObject, "JigsawRejected",
47  m_pointData, &ControlPointFileEntryV0002::set_jigsawrejected);
48  copy(pointObject, "EditLock",
49  m_pointData, &ControlPointFileEntryV0002::set_editlock);
50  copy(pointObject, "Ignore",
51  m_pointData, &ControlPointFileEntryV0002::set_ignore);
52  copy(pointObject, "AprioriX",
53  m_pointData, &ControlPointFileEntryV0002::set_apriorix);
54  copy(pointObject, "AprioriY",
55  m_pointData, &ControlPointFileEntryV0002::set_aprioriy);
56  copy(pointObject, "AprioriZ",
57  m_pointData, &ControlPointFileEntryV0002::set_aprioriz);
58  copy(pointObject, "AdjustedX",
59  m_pointData, &ControlPointFileEntryV0002::set_adjustedx);
60  copy(pointObject, "AdjustedY",
61  m_pointData, &ControlPointFileEntryV0002::set_adjustedy);
62  copy(pointObject, "AdjustedZ",
63  m_pointData, &ControlPointFileEntryV0002::set_adjustedz);
64  copy(pointObject, "LatitudeConstrained",
65  m_pointData, &ControlPointFileEntryV0002::set_latitudeconstrained);
66  copy(pointObject, "LongitudeConstrained",
67  m_pointData, &ControlPointFileEntryV0002::set_longitudeconstrained);
68  copy(pointObject, "RadiusConstrained",
69  m_pointData, &ControlPointFileEntryV0002::set_radiusconstrained);
70 
71  // Copy enumerated values
72 
73  // The control point type names were changed between version 3 and version 4.
74  // In version 3, the types are ground, tie, and constrained
75  // In version 4, these were changed to fixed, free, and constrained respectively.
76  // The protobuf file version was not changed, fixed and free were simply added to the
77  // enumeration and the old names were flagged as obsolete.
78  if (pointObject["PointType"][0] == "Fixed"
79  || pointObject["PointType"][0] == "Ground") {
80  m_pointData->set_type(ControlPointFileEntryV0002::Fixed);
81  }
82  else if (pointObject["PointType"][0] == "Constrained") {
83  m_pointData->set_type(ControlPointFileEntryV0002::Constrained);
84  }
85  else if (pointObject["PointType"][0] == "Free"
86  || pointObject["PointType"][0] == "Tie") {
87  m_pointData->set_type(ControlPointFileEntryV0002::Free);
88  }
89  else {
90  QString msg = "Invalid ControlPoint type [" + pointObject["PointType"][0] + "].";
92  }
93 
94  if (pointObject.hasKeyword("AprioriXYZSource")) {
95  QString source = pointObject["AprioriXYZSource"][0];
96 
97  if (source == "None") {
98  m_pointData->set_apriorisurfpointsource(ControlPointFileEntryV0002::None);
99  }
100  else if (source == "User") {
101  m_pointData->set_apriorisurfpointsource(ControlPointFileEntryV0002::User);
102  }
103  else if (source == "AverageOfMeasures") {
104  m_pointData->set_apriorisurfpointsource(ControlPointFileEntryV0002::AverageOfMeasures);
105  }
106  else if (source == "Reference") {
107  m_pointData->set_apriorisurfpointsource(ControlPointFileEntryV0002::Reference);
108  }
109  else if (source == "Basemap") {
110  m_pointData->set_apriorisurfpointsource(ControlPointFileEntryV0002::Basemap);
111  }
112  else if (source == "BundleSolution") {
113  m_pointData->set_apriorisurfpointsource(ControlPointFileEntryV0002::BundleSolution);
114  }
115  else {
116  QString msg = "Invalid AprioriXYZSource [" + source + "]";
118  }
119  }
120 
121  if (pointObject.hasKeyword("AprioriRadiusSource")) {
122  QString source = pointObject["AprioriRadiusSource"][0];
123 
124  if (source == "None") {
125  m_pointData->set_aprioriradiussource(ControlPointFileEntryV0002::None);
126  }
127  else if (source == "User") {
128  m_pointData->set_aprioriradiussource(ControlPointFileEntryV0002::User);
129  }
130  else if (source == "AverageOfMeasures") {
131  m_pointData->set_aprioriradiussource(ControlPointFileEntryV0002::AverageOfMeasures);
132  }
133  else if (source == "Ellipsoid") {
134  m_pointData->set_aprioriradiussource(ControlPointFileEntryV0002::Ellipsoid);
135  }
136  else if (source == "DEM") {
137  m_pointData->set_aprioriradiussource(ControlPointFileEntryV0002::DEM);
138  }
139  else if (source == "BundleSolution") {
140  m_pointData->set_aprioriradiussource(ControlPointFileEntryV0002::BundleSolution);
141  }
142  else {
143  QString msg = "Invalid AprioriRadiusSource, [" + source + "]";
145  }
146  }
147 
148  // Copy array values
149  if (pointObject.hasKeyword("AprioriCovarianceMatrix")) {
150  PvlKeyword &matrix = pointObject["AprioriCovarianceMatrix"];
151 
152  m_pointData->add_aprioricovar(toDouble(matrix[0]));
153  m_pointData->add_aprioricovar(toDouble(matrix[1]));
154  m_pointData->add_aprioricovar(toDouble(matrix[2]));
155  m_pointData->add_aprioricovar(toDouble(matrix[3]));
156  m_pointData->add_aprioricovar(toDouble(matrix[4]));
157  m_pointData->add_aprioricovar(toDouble(matrix[5]));
158  }
159 
160  if (pointObject.hasKeyword("AdjustedCovarianceMatrix")) {
161  PvlKeyword &matrix = pointObject["AdjustedCovarianceMatrix"];
162 
163  m_pointData->add_adjustedcovar(toDouble(matrix[0]));
164  m_pointData->add_adjustedcovar(toDouble(matrix[1]));
165  m_pointData->add_adjustedcovar(toDouble(matrix[2]));
166  m_pointData->add_adjustedcovar(toDouble(matrix[3]));
167  m_pointData->add_adjustedcovar(toDouble(matrix[4]));
168  m_pointData->add_adjustedcovar(toDouble(matrix[5]));
169  }
170 
171  // Process Measures
172  for (int groupIndex = 0; groupIndex < pointObject.groups(); groupIndex ++) {
173  PvlGroup &group = pointObject.group(groupIndex);
174  ControlPointFileEntryV0002_Measure measure;
175 
176  // Copy strings, booleans, and doubles
177  copy(group, "SerialNumber",
178  measure, &ControlPointFileEntryV0002_Measure::set_serialnumber);
179  copy(group, "ChooserName",
180  measure, &ControlPointFileEntryV0002_Measure::set_choosername);
181  copy(group, "Sample",
182  measure, &ControlPointFileEntryV0002_Measure::set_sample);
183  copy(group, "Line",
184  measure, &ControlPointFileEntryV0002_Measure::set_line);
185  copy(group, "SampleResidual",
186  measure, &ControlPointFileEntryV0002_Measure::set_sampleresidual);
187  copy(group, "LineResidual",
188  measure, &ControlPointFileEntryV0002_Measure::set_lineresidual);
189  copy(group, "DateTime",
190  measure, &ControlPointFileEntryV0002_Measure::set_datetime);
191  copy(group, "Diameter",
192  measure, &ControlPointFileEntryV0002_Measure::set_diameter);
193  copy(group, "EditLock",
194  measure, &ControlPointFileEntryV0002_Measure::set_editlock);
195  copy(group, "Ignore",
196  measure, &ControlPointFileEntryV0002_Measure::set_ignore);
197  copy(group, "JigsawRejected",
198  measure, &ControlPointFileEntryV0002_Measure::set_jigsawrejected);
199  copy(group, "AprioriSample",
200  measure, &ControlPointFileEntryV0002_Measure::set_apriorisample);
201  copy(group, "AprioriLine",
202  measure, &ControlPointFileEntryV0002_Measure::set_aprioriline);
203  copy(group, "SampleSigma",
204  measure, &ControlPointFileEntryV0002_Measure::set_samplesigma);
205  copy(group, "LineSigma",
206  measure, &ControlPointFileEntryV0002_Measure::set_linesigma);
207 
208  if (group.hasKeyword("Reference")) {
209  if (group["Reference"][0].toLower() == "true") {
210  m_pointData->set_referenceindex(groupIndex);
211  }
212  group.deleteKeyword("Reference");
213  }
214 
215  QString type = group["MeasureType"][0].toLower();
216  if (type == "candidate") {
217  measure.set_type(ControlPointFileEntryV0002_Measure::Candidate);
218  }
219  else if (type == "manual") {
220  measure.set_type(ControlPointFileEntryV0002_Measure::Manual);
221  }
222  else if (type == "registeredpixel") {
223  measure.set_type(ControlPointFileEntryV0002_Measure::RegisteredPixel);
224  }
225  else if (type == "registeredsubpixel") {
226  measure.set_type(ControlPointFileEntryV0002_Measure::RegisteredSubPixel);
227  }
228  else {
230  "Unknown measure type [" + type + "]",
231  _FILEINFO_);
232  }
233  group.deleteKeyword("MeasureType");
234 
235  for (int key = 0; key < group.keywords(); key++) {
236  ControlMeasureLogData interpreter(group[key]);
237  if (!interpreter.IsValid()) {
238  QString msg = "Unhandled or duplicate keywords in control measure ["
239  + group[key].name() + "]";
241  }
242  else {
243  ControlPointFileEntryV0002_Measure_MeasureLogData protoBufDataEntry;
244 
245  protoBufDataEntry.set_doubledatatype(interpreter.GetDataType());
246  protoBufDataEntry.set_doubledatavalue(interpreter.GetNumericalValue());
247 
248  *measure.add_log() = protoBufDataEntry;
249  }
250  }
251 
252  *m_pointData->add_measures() = measure;
253  }
254 
255  if (!m_pointData->IsInitialized()) {
256  QString msg = "There is missing required information in the control "
257  "points or measures";
258  throw IException(IException::Io, msg, _FILEINFO_);
259  }
260  }
261 
262 
269  : m_pointData(new ControlPointFileEntryV0002) {
271  if (!oldPointData) {
272  QString msg = "Version 2 control point is missing point data.";
274  }
276  if (!oldLogData) {
277  QString msg = "Version 2 control point is missing measure log data.";
279  }
280 
281  // Copy over POD values
282  if ( oldPointData->has_id() ) {
283  m_pointData->set_id( oldPointData->id() );
284  }
285  if ( oldPointData->has_choosername() ) {
286  m_pointData->set_choosername( oldPointData->choosername() );
287  }
288  if ( oldPointData->has_datetime() ) {
289  m_pointData->set_datetime( oldPointData->datetime() );
290  }
291  if ( oldPointData->has_apriorisurfpointsourcefile() ) {
292  m_pointData->set_apriorisurfpointsourcefile( oldPointData->apriorisurfpointsourcefile() );
293  }
294  if ( oldPointData->has_aprioriradiussourcefile() ) {
295  m_pointData->set_aprioriradiussourcefile( oldPointData->aprioriradiussourcefile() );
296  }
297  if ( oldPointData->has_jigsawrejected() ) {
298  m_pointData->set_jigsawrejected( oldPointData->jigsawrejected() );
299  }
300  if ( oldPointData->has_editlock() ) {
301  m_pointData->set_editlock( oldPointData->editlock() );
302  }
303  if ( oldPointData->has_ignore() ) {
304  m_pointData->set_ignore( oldPointData->ignore() );
305  }
306  if ( oldPointData->has_apriorix() ) {
307  m_pointData->set_apriorix( oldPointData->apriorix() );
308  }
309  if ( oldPointData->has_aprioriy() ) {
310  m_pointData->set_aprioriy( oldPointData->aprioriy() );
311  }
312  if ( oldPointData->has_aprioriz() ) {
313  m_pointData->set_aprioriz( oldPointData->aprioriz() );
314  }
315  if ( oldPointData->has_adjustedx() ) {
316  m_pointData->set_adjustedx( oldPointData->adjustedx() );
317  }
318  if ( oldPointData->has_adjustedy() ) {
319  m_pointData->set_adjustedy( oldPointData->adjustedy() );
320  }
321  if ( oldPointData->has_adjustedz() ) {
322  m_pointData->set_adjustedz( oldPointData->adjustedz() );
323  }
324  if ( oldPointData->has_latitudeconstrained() ) {
325  m_pointData->set_latitudeconstrained( oldPointData->latitudeconstrained() );
326  }
327  if ( oldPointData->has_longitudeconstrained() ) {
328  m_pointData->set_longitudeconstrained( oldPointData->longitudeconstrained() );
329  }
330  if ( oldPointData->has_radiusconstrained() ) {
331  m_pointData->set_radiusconstrained( oldPointData->radiusconstrained() );
332  }
333  if ( oldPointData->has_referenceindex() ) {
334  m_pointData->set_referenceindex( oldPointData->referenceindex() );
335  }
336 
337  // Copy over enumerated values
338 
339  // The only point types in V0002 are ground and tie.
340  // So, convert ground and tie to their V0003 values, fixed and free respectively.
341  // Later check if the point is constrained.
342  if ( oldPointData->has_type() ) {
343  ControlNetFileProtoV0001_PBControlPoint_PointType pointType = oldPointData->type();
344  if (pointType == ControlNetFileProtoV0001_PBControlPoint::Ground) {
345  m_pointData->set_type(ControlPointFileEntryV0002::Fixed);
346  }
347  else if (pointType == ControlNetFileProtoV0001_PBControlPoint::Tie) {
348  m_pointData->set_type(ControlPointFileEntryV0002::Free);
349  }
350  else {
351  QString msg = "Invalid ControlPoint type.";
353  }
354  }
355 
356  if ( oldPointData->has_apriorisurfpointsource() ) {
357  ControlNetFileProtoV0001_PBControlPoint_AprioriSource surfacePointSource;
358  surfacePointSource = oldPointData->apriorisurfpointsource();
359  if (surfacePointSource == ControlNetFileProtoV0001_PBControlPoint::None) {
360  m_pointData->set_apriorisurfpointsource(ControlPointFileEntryV0002::None);
361  }
362  else if (surfacePointSource == ControlNetFileProtoV0001_PBControlPoint::User) {
363  m_pointData->set_apriorisurfpointsource(ControlPointFileEntryV0002::User);
364  }
365  else if (surfacePointSource == ControlNetFileProtoV0001_PBControlPoint::AverageOfMeasures) {
366  m_pointData->set_apriorisurfpointsource(ControlPointFileEntryV0002::AverageOfMeasures);
367  }
368  else if (surfacePointSource == ControlNetFileProtoV0001_PBControlPoint::Reference) {
369  m_pointData->set_apriorisurfpointsource(ControlPointFileEntryV0002::Reference);
370  }
371  else if (surfacePointSource == ControlNetFileProtoV0001_PBControlPoint::Basemap) {
372  m_pointData->set_apriorisurfpointsource(ControlPointFileEntryV0002::Basemap);
373  }
374  else if (surfacePointSource == ControlNetFileProtoV0001_PBControlPoint::BundleSolution) {
375  m_pointData->set_apriorisurfpointsource(ControlPointFileEntryV0002::BundleSolution);
376  }
377  else {
378  QString msg = "Invalid ControlPoint apriori surface point source.";
380  }
381  }
382 
383  if ( oldPointData->has_aprioriradiussource() ) {
384  ControlNetFileProtoV0001_PBControlPoint_AprioriSource radiusSource;
385  radiusSource = oldPointData->aprioriradiussource();
386  if (radiusSource == ControlNetFileProtoV0001_PBControlPoint::None) {
387  m_pointData->set_aprioriradiussource(ControlPointFileEntryV0002::None);
388  }
389  else if (radiusSource == ControlNetFileProtoV0001_PBControlPoint::User) {
390  m_pointData->set_aprioriradiussource(ControlPointFileEntryV0002::User);
391  }
392  else if (radiusSource == ControlNetFileProtoV0001_PBControlPoint::AverageOfMeasures) {
393  m_pointData->set_aprioriradiussource(ControlPointFileEntryV0002::AverageOfMeasures);
394  }
395  else if (radiusSource == ControlNetFileProtoV0001_PBControlPoint::Ellipsoid) {
396  m_pointData->set_aprioriradiussource(ControlPointFileEntryV0002::Ellipsoid);
397  }
398  else if (radiusSource == ControlNetFileProtoV0001_PBControlPoint::DEM) {
399  m_pointData->set_aprioriradiussource(ControlPointFileEntryV0002::DEM);
400  }
401  else if (radiusSource == ControlNetFileProtoV0001_PBControlPoint::BundleSolution) {
402  m_pointData->set_aprioriradiussource(ControlPointFileEntryV0002::BundleSolution);
403  }
404  else {
405  QString msg = "Invalid AprioriRadiusSource.";
407  }
408  }
409 
410  // Copy the array values
411 
412  // If there is a covariance matrix, then the point is constrained
413  if (oldPointData->aprioricovar_size() > 0) {
414  m_pointData->set_type(ControlPointFileEntryV0002::Constrained);
415  m_pointData->add_aprioricovar( oldPointData->aprioricovar(0) );
416  m_pointData->add_aprioricovar( oldPointData->aprioricovar(1) );
417  m_pointData->add_aprioricovar( oldPointData->aprioricovar(2) );
418  m_pointData->add_aprioricovar( oldPointData->aprioricovar(3) );
419  m_pointData->add_aprioricovar( oldPointData->aprioricovar(4) );
420  m_pointData->add_aprioricovar( oldPointData->aprioricovar(5) );
421  }
422 
423  if (oldPointData->adjustedcovar_size() > 0) {
424  m_pointData->add_adjustedcovar( oldPointData->adjustedcovar(0) );
425  m_pointData->add_adjustedcovar( oldPointData->adjustedcovar(1) );
426  m_pointData->add_adjustedcovar( oldPointData->adjustedcovar(2) );
427  m_pointData->add_adjustedcovar( oldPointData->adjustedcovar(3) );
428  m_pointData->add_adjustedcovar( oldPointData->adjustedcovar(4) );
429  m_pointData->add_adjustedcovar( oldPointData->adjustedcovar(5) );
430  }
431 
432  // Copy the measures
433  for (int i = 0; i < oldPointData->measures_size(); i++) {
434  ControlPointFileEntryV0002_Measure *newMeasure = m_pointData->add_measures();
435  ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure oldMeasure;
436  oldMeasure = oldPointData->measures(i);
437 
438  // Copy over POD values
439  if ( oldMeasure.has_serialnumber() ) {
440  newMeasure->set_serialnumber( oldMeasure.serialnumber() );
441  }
442  if ( oldMeasure.has_choosername() ) {
443  newMeasure->set_choosername( oldMeasure.choosername() );
444  }
445  if ( oldMeasure.has_datetime() ) {
446  newMeasure->set_datetime( oldMeasure.datetime() );
447  }
448  if ( oldMeasure.has_diameter() ) {
449  newMeasure->set_diameter( oldMeasure.diameter() );
450  }
451  if ( oldMeasure.has_editlock() ) {
452  newMeasure->set_editlock( oldMeasure.editlock() );
453  }
454  if ( oldMeasure.has_ignore() ) {
455  newMeasure->set_ignore( oldMeasure.ignore() );
456  }
457  if ( oldMeasure.has_jigsawrejected() ) {
458  newMeasure->set_jigsawrejected( oldMeasure.jigsawrejected() );
459  }
460  if ( oldMeasure.has_apriorisample() ) {
461  newMeasure->set_apriorisample( oldMeasure.apriorisample() );
462  }
463  if ( oldMeasure.has_aprioriline() ) {
464  newMeasure->set_aprioriline( oldMeasure.aprioriline() );
465  }
466  if ( oldMeasure.has_samplesigma() ) {
467  newMeasure->set_samplesigma( oldMeasure.samplesigma() );
468  }
469  if ( oldMeasure.has_linesigma() ) {
470  newMeasure->set_linesigma( oldMeasure.linesigma() );
471  }
472  // In the version 1 protobuf format, the sample, line, sample residual, and line residual
473  // values are stored in a nested message so we have to copy them differently.
474  if ( oldMeasure.has_measurement() ) {
475  ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure_PBMeasure oldMeasurement;
476  oldMeasurement = oldMeasure.measurement();
477  if ( oldMeasurement.has_sample() ) {
478  newMeasure->set_sample( oldMeasurement.sample() );
479  }
480  if ( oldMeasurement.has_line() ) {
481  newMeasure->set_line( oldMeasurement.line() );
482  }
483  if ( oldMeasurement.has_sampleresidual() ) {
484  newMeasure->set_sampleresidual( oldMeasurement.sampleresidual() );
485  }
486  if ( oldMeasurement.has_lineresidual() ) {
487  newMeasure->set_lineresidual( oldMeasurement.lineresidual() );
488  }
489  }
490 
491  // Copy over the enumerated values
492  if ( oldMeasure.has_type() ) {
493  ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure_MeasureType oldType;
494  oldType = oldMeasure.type();
495  if (oldType == ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure_MeasureType_Candidate) {
496  newMeasure->set_type(ControlPointFileEntryV0002_Measure_MeasureType_Candidate);
497  }
498  else if (oldType == ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure_MeasureType_Manual) {
499  newMeasure->set_type(ControlPointFileEntryV0002_Measure_MeasureType_Manual);
500  }
501  else if (oldType == ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure_MeasureType_RegisteredPixel) {
502  newMeasure->set_type(ControlPointFileEntryV0002_Measure_MeasureType_RegisteredPixel);
503  }
504  else if (oldType == ControlNetFileProtoV0001_PBControlPoint_PBControlMeasure_MeasureType_RegisteredSubPixel) {
505  newMeasure->set_type(ControlPointFileEntryV0002_Measure_MeasureType_RegisteredSubPixel);
506  }
507  else {
508  QString msg = "Invalid measure type";
510  }
511 
512  // Copy over any log data
513  ControlNetLogDataProtoV0001_Point_Measure measureLogData = oldLogData->measures(i);
514  for (int j = 0; j < measureLogData.loggedmeasuredata_size(); j++) {
515 
516  ControlNetLogDataProtoV0001_Point_Measure_DataEntry oldData =
517  measureLogData.loggedmeasuredata(j);
518 
519  ControlPointFileEntryV0002_Measure_MeasureLogData newData;
520 
521  newData.set_doubledatatype( oldData.datatype() );
522  newData.set_doubledatavalue( oldData.datavalue() );
523 
524  *newMeasure->add_log() = newData;
525  }
526 
527  // Check that all the required fields in the measure are filled
528  if ( !newMeasure->IsInitialized() ) {
529  QString msg = "Measure file entry at index [" + toString(i)
530  + "] is missing required fields.";
532  }
533  }
534  }
535 
536  // Check that all of the required fields in the point are filled
537  if ( !m_pointData->IsInitialized() ) {
538  QString msg = "Control point file entry is missing required fields.";
540  }
541  }
542 
543 
553  const ControlPointFileEntryV0002 &ControlPointV0003::pointData() {
554  if (!m_pointData) {
555  m_pointData.reset(new ControlPointFileEntryV0002);
556  }
557 
558  return *m_pointData;
559  }
560 
561 
577  QString keyName,
579  void (ControlPointFileEntryV0002::*setter)(bool)) {
580 
581  if (!container.hasKeyword(keyName)) {
582  return;
583  }
584 
585  QString value = container[keyName][0];
586  container.deleteKeyword(keyName);
587  value = value.toLower();
588 
589  if (value == "true" || value == "yes") {
590  (point.data()->*setter)(true);
591  }
592  }
593 
594 
610  QString keyName,
612  void (ControlPointFileEntryV0002::*setter)(double)) {
613 
614  if (!container.hasKeyword(keyName)) {
615  return;
616  }
617 
618  double value = toDouble(container[keyName][0]);
619  container.deleteKeyword(keyName);
620  (point.data()->*setter)(value);
621  }
622 
623 
639  QString keyName,
641  void (ControlPointFileEntryV0002::*setter)(const std::string&)) {
642 
643  if (!container.hasKeyword(keyName)) {
644  return;
645  }
646 
647  QString value = container[keyName][0];
648  container.deleteKeyword(keyName);
649  (point.data()->*setter)(value.toLatin1().data());
650  }
651 
652 
668  QString keyName,
669  ControlPointFileEntryV0002_Measure &measure,
670  void (ControlPointFileEntryV0002_Measure::*setter)(bool)) {
671 
672  if (!container.hasKeyword(keyName)) {
673  return;
674  }
675 
676  QString value = container[keyName][0];
677  container.deleteKeyword(keyName);
678  value = value.toLower();
679 
680  if (value == "true" || value == "yes") {
681  (measure.*setter)(true);
682  }
683  }
684 
685 
701  QString keyName,
702  ControlPointFileEntryV0002_Measure &measure,
703  void (ControlPointFileEntryV0002_Measure::*setter)(double)) {
704 
705  if (!container.hasKeyword(keyName)) {
706  return;
707  }
708 
709  double value = toDouble(container[keyName][0]);
710  container.deleteKeyword(keyName);
711  (measure.*setter)(value);
712  }
713 
714 
730  QString keyName,
731  ControlPointFileEntryV0002_Measure &measure,
732  void (ControlPointFileEntryV0002_Measure::*setter)
733  (const std::string &)) {
734 
735  if (!container.hasKeyword(keyName)) {
736  return;
737  }
738 
739  QString value = container[keyName][0];
740  container.deleteKeyword(keyName);
741  (measure.*setter)(value.toLatin1().data());
742  }
743 }
int keywords() const
Returns the number of keywords contained in the PvlContainer.
Definition: PvlContainer.h:100
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.
void copy(PvlContainer &container, QString keyName, QSharedPointer< ControlPointFileEntryV0002 > point, void(ControlPointFileEntryV0002::*setter)(bool))
This convenience method takes a boolean value from a PvlKeyword and copies it into a version 2 protob...
NumericLogDataType GetDataType() const
Get the data type associated with this log data.
Contains more than one keyword-value pair.
Definition: PvlContainer.h:63
Statistical and similar ControlMeasure associated information.
Namespace for the standard library.
QSharedPointer< ControlPointFileEntryV0002 > m_pointData
protobuf container that holds information used to create a control point.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:226
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
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
bool IsValid() const
This tests if the log data is complete and valid.
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.
Definition: PvlGroup.h:57
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:40
ControlPointV0003()
Default constructor.
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
PvlGroup & group(const int index)
Return the group at the specified index.
Definition: PvlObject.cpp:423
Isis exception class.
Definition: IException.h:107
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
int groups() const
Returns the number of groups contained.
Definition: PvlObject.h:87
double GetNumericalValue() const
Get the value associated with this log data.
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:74
A container for the information stored in a version 2 ControlPoint.
const ControlPointFileEntryV0002 & pointData()
Access the protobuf control point data.
void deleteKeyword(const QString &name)
Remove a specified keyword.