Isis 3 Programmer Reference
ControlNetVersioner.cpp
1 
7 /* SPDX-License-Identifier: CC0-1.0 */
8 
9 #include "ControlNetVersioner.h"
10 
11 #include <boost/numeric/ublas/symmetric.hpp>
12 #include <boost/numeric/ublas/io.hpp>
13 
14 #include <QDebug>
15 #include <QString>
16 
17 #include "ControlNetFileHeaderV0002.pb.h"
18 #include "ControlNetFileHeaderV0005.pb.h"
19 #include "ControlNetLogDataProtoV0001.pb.h"
20 #include "ControlPointFileEntryV0002.pb.h"
21 
22 #include "ControlMeasure.h"
23 #include "ControlNet.h"
24 #include "ControlMeasureLogData.h"
25 #include "Distance.h"
26 #include "EndianSwapper.h"
27 #include "FileName.h"
28 #include "IException.h"
29 #include "Latitude.h"
30 #include "LinearAlgebra.h"
31 #include "Longitude.h"
32 #include "NaifStatus.h"
33 #include "Progress.h"
34 #include "Pvl.h"
35 #include "PvlGroup.h"
36 #include "PvlKeyword.h"
37 #include "PvlObject.h"
38 #include "SpecialPixel.h"
39 #include "SurfacePoint.h"
40 #include "Target.h"
41 
42 
43 #include <google/protobuf/io/zero_copy_stream_impl.h>
44 #include <google/protobuf/io/zero_copy_stream.h>
45 #include <google/protobuf/io/coded_stream.h>
46 
47 using boost::numeric::ublas::symmetric_matrix;
48 using boost::numeric::ublas::upper;
49 using namespace google::protobuf::io;
50 using namespace std;
51 
52 namespace Isis {
53 
61  ControlNetVersioner::ControlNetVersioner(ControlNet *net)
62  : m_ownsPoints(false) {
63  // Populate the internal list of points.
64  m_points.append( net->GetPoints() );
65 
66  ControlNetHeaderV0001 header;
67 
68  header.networkID = net->GetNetworkId();
69  header.targetName = net->GetTarget();
70  header.created = net->CreatedDate();
71  header.lastModified = net->GetLastModified();
72  header.description = net->Description();
73  header.userName = net->GetUserName();
74  createHeader(header);
75  }
76 
77 
89  : m_ownsPoints(true) {
90  read(netFile, progress);
91  }
92 
93 
99  if ( m_ownsPoints ) {
100  while ( !m_points.isEmpty() ) {
101  ControlPoint *unusedPoint = m_points.takeFirst();
102  delete unusedPoint;
103  unusedPoint = NULL;
104  }
105  }
106  }
107 
108 
114  QString ControlNetVersioner::netId() const {
115  return m_header.networkID;
116  }
117 
118 
125  return m_header.targetName;
126  }
127 
128 
135  return m_header.created;
136  }
137 
138 
145  return m_header.lastModified;
146  }
147 
148 
155  return m_header.description;
156  }
157 
158 
165  return m_header.userName;
166  }
167 
168 
175  return m_points.size();
176  }
177 
178 
188  ControlPoint *point = NULL;
189  if ( !m_points.isEmpty() ) {
190  point = m_points.takeFirst();
191  }
192 
193  return point;
194  }
195 
196 
203  Pvl pvl;
204  pvl.addObject(PvlObject("ControlNetwork"));
205  PvlObject &network = pvl.findObject("ControlNetwork");
206 
207  network += PvlKeyword("NetworkId", m_header.networkID);
208  network += PvlKeyword("TargetName", m_header.targetName);
209  network += PvlKeyword("UserName", m_header.userName);
210  network += PvlKeyword("Created", m_header.created);
211  network += PvlKeyword("LastModified", m_header.lastModified);
212  network += PvlKeyword("Description", m_header.description);
213 
214  // This is the Pvl version we're converting to
215  network += PvlKeyword("Version", "5");
216 
217  foreach (ControlPoint *controlPoint, m_points) {
218  PvlObject pvlPoint("ControlPoint");
219 
220  if ( controlPoint->GetType() == ControlPoint::Fixed ) {
221  pvlPoint += PvlKeyword("PointType", "Fixed");
222  }
223 
224  else if ( controlPoint->GetType() == ControlPoint::Constrained ) {
225  pvlPoint += PvlKeyword("PointType", "Constrained");
226  }
227 
228  else {
229  pvlPoint += PvlKeyword("PointType", "Free");
230  }
231 
232  if ( controlPoint->GetId().isEmpty() ) {
233  QString msg = "Unable to write control net to PVL file. "
234  "Invalid control point has no point ID value.";
235  throw IException(IException::Unknown, msg, _FILEINFO_);
236  }
237  else {
238  pvlPoint += PvlKeyword("PointId", controlPoint->GetId());
239  }
240  if ( QString::compare(controlPoint->GetChooserName(), "Null", Qt::CaseInsensitive) != 0 ) {
241  pvlPoint += PvlKeyword("ChooserName", controlPoint->GetChooserName());
242  }
243  if ( QString::compare(controlPoint->GetDateTime(), "Null", Qt::CaseInsensitive) != 0 ) {
244  pvlPoint += PvlKeyword("DateTime", controlPoint->GetDateTime());
245  }
246  if ( controlPoint->IsEditLocked() ) {
247  pvlPoint += PvlKeyword("EditLock", "True");
248  }
249  if ( controlPoint->IsIgnored() ) {
250  pvlPoint += PvlKeyword("Ignore", "True");
251  }
252 
253  switch ( controlPoint->GetAprioriSurfacePointSource() ) {
254  case ControlPoint::SurfacePointSource::None:
255  break;
256  case ControlPoint::SurfacePointSource::User:
257  pvlPoint += PvlKeyword("AprioriXYZSource", "User");
258  break;
259  case ControlPoint::SurfacePointSource::AverageOfMeasures:
260  pvlPoint += PvlKeyword("AprioriXYZSource", "AverageOfMeasures");
261  break;
262  case ControlPoint::SurfacePointSource::Reference:
263  pvlPoint += PvlKeyword("AprioriXYZSource", "Reference");
264  break;
265  case ControlPoint::SurfacePointSource::Basemap:
266  pvlPoint += PvlKeyword("AprioriXYZSource", "Basemap");
267  break;
268  case ControlPoint::SurfacePointSource::BundleSolution:
269  pvlPoint += PvlKeyword("AprioriXYZSource", "BundleSolution");
270  break;
271  }
272 
273  if ( controlPoint->HasAprioriSurfacePointSourceFile() ) {
274  pvlPoint += PvlKeyword("AprioriXYZSourceFile",
275  controlPoint->GetAprioriSurfacePointSourceFile());
276  }
277 
278  switch ( controlPoint->GetAprioriRadiusSource() ) {
279  case ControlPoint::RadiusSource::None:
280  break;
281  case ControlPoint::RadiusSource::User:
282  pvlPoint += PvlKeyword("AprioriRadiusSource", "User");
283  break;
284  case ControlPoint::RadiusSource::AverageOfMeasures:
285  pvlPoint += PvlKeyword("AprioriRadiusSource", "AverageOfMeasures");
286  break;
287  case ControlPoint::RadiusSource::BundleSolution:
288  pvlPoint += PvlKeyword("AprioriRadiusSource", "BundleSolution");
289  break;
290  case ControlPoint::RadiusSource::Ellipsoid:
291  pvlPoint += PvlKeyword("AprioriRadiusSource", "Ellipsoid");
292  break;
293  case ControlPoint::RadiusSource::DEM:
294  pvlPoint += PvlKeyword("AprioriRadiusSource", "DEM");
295  break;
296  }
297 
298  if ( controlPoint->HasAprioriRadiusSourceFile() ) {
299  pvlPoint += PvlKeyword("AprioriRadiusSourceFile",
300  controlPoint->GetAprioriRadiusSourceFile());
301  }
302 
303  // add surface point x/y/z, convert to lat,lon,radius and output as comment
304  SurfacePoint aprioriSurfacePoint = controlPoint->GetAprioriSurfacePoint();
305  if ( aprioriSurfacePoint.Valid() ) {
306  PvlKeyword aprioriX("AprioriX", toString(aprioriSurfacePoint.GetX().meters()), "meters");
307  PvlKeyword aprioriY("AprioriY", toString(aprioriSurfacePoint.GetY().meters()), "meters");
308  PvlKeyword aprioriZ("AprioriZ", toString(aprioriSurfacePoint.GetZ().meters()), "meters");
309 
310  aprioriX.addComment("AprioriLatitude = "
311  + toString(aprioriSurfacePoint.GetLatitude().degrees())
312  + " <degrees>");
313  aprioriY.addComment("AprioriLongitude = "
314  + toString(aprioriSurfacePoint.GetLongitude().degrees())
315  + " <degrees>");
316 
317  aprioriZ.addComment("AprioriRadius = "
318  + toString(aprioriSurfacePoint.GetLocalRadius().meters())
319  + " <meters>");
320 
321  pvlPoint += aprioriX;
322  pvlPoint += aprioriY;
323  pvlPoint += aprioriZ;
324 
325  symmetric_matrix<double, upper> aprioriCovarianceMatrix =
326  aprioriSurfacePoint.GetRectangularMatrix();
327 
328  if ( aprioriCovarianceMatrix.size1() > 0 ) {
329 
330  // Matrix units are meters squared
331  PvlKeyword matrix("AprioriCovarianceMatrix");
332  matrix += toString(aprioriCovarianceMatrix(0, 0));
333  matrix += toString(aprioriCovarianceMatrix(0, 1));
334  matrix += toString(aprioriCovarianceMatrix(0, 2));
335  matrix += toString(aprioriCovarianceMatrix(1, 1));
336  matrix += toString(aprioriCovarianceMatrix(1, 2));
337  matrix += toString(aprioriCovarianceMatrix(2, 2));
338 
339  // *** TODO *** What do we do in the case of bundled in rectangular coordinates?
340  // For now we do nothing.
341  if ( aprioriSurfacePoint.GetLatSigmaDistance().meters() != Isis::Null
342  && aprioriSurfacePoint.GetLonSigmaDistance().meters() != Isis::Null
343  && aprioriSurfacePoint.GetLocalRadiusSigma().meters() != Isis::Null ) {
344 
345  QString sigmas = "AprioriLatitudeSigma = "
346  + toString(aprioriSurfacePoint.GetLatSigmaDistance().meters())
347  + " <meters> AprioriLongitudeSigma = "
348  + toString(aprioriSurfacePoint.GetLonSigmaDistance().meters())
349  + " <meters> AprioriRadiusSigma = "
350  + toString(aprioriSurfacePoint.GetLocalRadiusSigma().meters())
351  + " <meters>";
352  matrix.addComment(sigmas);
353  }
354 
355  // If the covariance matrix has a value, add it to the PVL point.
356  if ( aprioriCovarianceMatrix(0, 0) != 0.0
357  || aprioriCovarianceMatrix(0, 1) != 0.0
358  || aprioriCovarianceMatrix(0, 2) != 0.0
359  || aprioriCovarianceMatrix(1, 1) != 0.0
360  || aprioriCovarianceMatrix(1, 2) != 0.0
361  || aprioriCovarianceMatrix(2, 2) != 0.0 ) {
362 
363  pvlPoint += matrix;
364  }
365  }
366  }
367 
368  // Deal with the generalization here. *** TODO ***
369  // Once we have a coordinate type in the header, we should specify the correct coordinate
370  if ( controlPoint->IsCoord1Constrained() ) {
371  pvlPoint += PvlKeyword("LatitudeConstrained", "True");
372  }
373 
374  if ( controlPoint->IsCoord2Constrained() ) {
375  pvlPoint += PvlKeyword("LongitudeConstrained", "True");
376  }
377 
378  if ( controlPoint->IsCoord2Constrained() ) {
379  pvlPoint += PvlKeyword("RadiusConstrained", "True");
380  }
381 
382  // adj surface point, convert to lat,lon,radius and output as comment
383  SurfacePoint adjustedSurfacePoint = controlPoint->GetAdjustedSurfacePoint();
384  if ( adjustedSurfacePoint.Valid() ) {
385  PvlKeyword adjustedX("AdjustedX",
386  toString(adjustedSurfacePoint.GetX().meters()), "meters");
387  PvlKeyword adjustedY("AdjustedY",
388  toString(adjustedSurfacePoint.GetY().meters()), "meters");
389  PvlKeyword adjustedZ("AdjustedZ",
390  toString(adjustedSurfacePoint.GetZ().meters()), "meters");
391 
392  adjustedX.addComment("AdjustedLatitude = "
393  + toString(adjustedSurfacePoint.GetLatitude().degrees())
394  + " <degrees>");
395  adjustedY.addComment("AdjustedLongitude = "
396  + toString(adjustedSurfacePoint.GetLongitude().degrees())
397  + " <degrees>");
398  adjustedZ.addComment("AdjustedRadius = "
399  + toString(adjustedSurfacePoint.GetLocalRadius().meters())
400  + " <meters>");
401 
402  pvlPoint += adjustedX;
403  pvlPoint += adjustedY;
404  pvlPoint += adjustedZ;
405 
406  symmetric_matrix<double, upper> adjustedCovarianceMatrix =
407  adjustedSurfacePoint.GetRectangularMatrix();
408 
409  if ( adjustedCovarianceMatrix.size1() > 0 ) {
410 
411  PvlKeyword matrix("AdjustedCovarianceMatrix");
412  matrix += toString(adjustedCovarianceMatrix(0, 0));
413  matrix += toString(adjustedCovarianceMatrix(0, 1));
414  matrix += toString(adjustedCovarianceMatrix(0, 2));
415  matrix += toString(adjustedCovarianceMatrix(1, 1));
416  matrix += toString(adjustedCovarianceMatrix(1, 2));
417  matrix += toString(adjustedCovarianceMatrix(2, 2));
418 
419  if ( adjustedSurfacePoint.GetLatSigmaDistance().meters() != Isis::Null
420  && adjustedSurfacePoint.GetLonSigmaDistance().meters() != Isis::Null
421  && adjustedSurfacePoint.GetLocalRadiusSigma().meters() != Isis::Null ) {
422 
423  QString sigmas = "AdjustedLatitudeSigma = "
424  + toString(adjustedSurfacePoint.GetLatSigmaDistance().meters())
425  + " <meters> AdjustedLongitudeSigma = "
426  + toString(adjustedSurfacePoint.GetLonSigmaDistance().meters())
427  + " <meters> AdjustedRadiusSigma = "
428  + toString(adjustedSurfacePoint.GetLocalRadiusSigma().meters())
429  + " <meters>";
430 
431  matrix.addComment(sigmas);
432  }
433  // If the covariance matrix has a value, add it to the PVL point.
434  if ( adjustedCovarianceMatrix(0, 0) != 0.0
435  || adjustedCovarianceMatrix(0, 1) != 0.0
436  || adjustedCovarianceMatrix(0, 2) != 0.0
437  || adjustedCovarianceMatrix(1, 1) != 0.0
438  || adjustedCovarianceMatrix(1, 2) != 0.0
439  || adjustedCovarianceMatrix(2, 2) != 0.0 ) {
440 
441  pvlPoint += matrix;
442  }
443  }
444  }
445 
446  for (int j = 0; j < controlPoint->GetNumMeasures(); j++) {
447  PvlGroup pvlMeasure("ControlMeasure");
448  const ControlMeasure &controlMeasure = *controlPoint->GetMeasure(j);
449  pvlMeasure += PvlKeyword("SerialNumber", controlMeasure.GetCubeSerialNumber());
450 
451  switch ( controlMeasure.GetType() ) {
453  pvlMeasure += PvlKeyword("MeasureType", "Candidate");
454  break;
456  pvlMeasure += PvlKeyword("MeasureType", "Manual");
457  break;
459  pvlMeasure += PvlKeyword("MeasureType", "RegisteredPixel");
460  break;
462  pvlMeasure += PvlKeyword("MeasureType", "RegisteredSubPixel");
463  break;
464  }
465 
466  if (QString::compare(controlMeasure.GetChooserName(), "Null", Qt::CaseInsensitive) != 0) {
467  pvlMeasure += PvlKeyword("ChooserName", controlMeasure.GetChooserName());
468  }
469  if (QString::compare(controlMeasure.GetDateTime(), "Null", Qt::CaseInsensitive) != 0) {
470  pvlMeasure += PvlKeyword("DateTime", controlMeasure.GetDateTime());
471  }
472  if ( controlMeasure.IsEditLocked() ) {
473  pvlMeasure += PvlKeyword("EditLock", "True");
474  }
475 
476  if ( controlMeasure.IsIgnored() ) {
477  pvlMeasure += PvlKeyword("Ignore", "True");
478  }
479 
480  if ( controlMeasure.GetSample() != Isis::Null) {
481  pvlMeasure += PvlKeyword("Sample", toString(controlMeasure.GetSample()));
482 
483  }
484 
485  if ( controlMeasure.GetLine() != Isis::Null ) {
486  pvlMeasure += PvlKeyword("Line", toString(controlMeasure.GetLine()));
487  }
488 
489  if ( controlMeasure.GetDiameter() != Isis::Null
490  && controlMeasure.GetDiameter() != 0. ) {
491  pvlMeasure += PvlKeyword("Diameter", toString(controlMeasure.GetDiameter()));
492  }
493 
494  if ( controlMeasure.GetAprioriSample() != Isis::Null ) {
495  pvlMeasure += PvlKeyword("AprioriSample", toString(controlMeasure.GetAprioriSample()));
496  }
497 
498  if ( controlMeasure.GetAprioriLine() != Isis::Null ) {
499  pvlMeasure += PvlKeyword("AprioriLine", toString(controlMeasure.GetAprioriLine()));
500  }
501 
502  if ( controlMeasure.GetSampleSigma() != Isis::Null ) {
503  pvlMeasure += PvlKeyword("SampleSigma", toString(controlMeasure.GetSampleSigma()),
504  "pixels");
505  }
506 
507  if ( controlMeasure.GetLineSigma() != Isis::Null ) {
508  pvlMeasure += PvlKeyword("LineSigma", toString(controlMeasure.GetLineSigma()),
509  "pixels");
510  }
511 
512  if ( controlMeasure.GetSampleResidual() != Isis::Null ) {
513  pvlMeasure += PvlKeyword("SampleResidual",
514  toString(controlMeasure.GetSampleResidual()),
515  "pixels");
516  }
517 
518  if ( controlMeasure.GetLineResidual() != Isis::Null ) {
519  pvlMeasure += PvlKeyword("LineResidual", toString(controlMeasure.GetLineResidual()),
520  "pixels");
521  }
522 
523  if ( controlMeasure.IsRejected() ) {
524  pvlMeasure += PvlKeyword("JigsawRejected", toString(controlMeasure.IsRejected()));
525  }
526 
527  foreach (ControlMeasureLogData log, controlMeasure.GetLogDataEntries()) {
528  pvlMeasure += log.ToKeyword();
529  }
530 
531  if ( controlPoint->HasRefMeasure()
532  && controlPoint->IndexOfRefMeasure() == j
533  && controlPoint->IsReferenceExplicit() ) {
534  pvlMeasure += PvlKeyword("Reference", "True");
535  }
536  pvlPoint.addGroup(pvlMeasure);
537  }
538  network.addObject(pvlPoint);
539  }
540  return pvl;
541  }
542 
543 
551  void ControlNetVersioner::read(const FileName netFile, Progress *progress) {
552  try {
553 
554  const Pvl &network(netFile.expanded());
555 
556  if ( network.hasObject("ProtoBuffer") ) {
557  readProtobuf(network, netFile, progress);
558  }
559  else if ( network.hasObject("ControlNetwork") ) {
560  readPvl(network, progress);
561  }
562  else {
563  QString msg = "Could not determine the control network file type";
564  throw IException(IException::Io, msg, _FILEINFO_);
565  }
566  }
567  catch (IException &e) {
568  QString msg = "Reading the control network [" + netFile.name()
569  + "] failed";
570  throw IException(e, IException::Io, msg, _FILEINFO_);
571  }
572  }
573 
574 
582  void ControlNetVersioner::readPvl(const Pvl &network, Progress *progress) {
583  const PvlObject &controlNetwork = network.findObject("ControlNetwork");
584 
585  int version = 1;
586 
587  if ( controlNetwork.hasKeyword("Version") ) {
588  version = toInt(controlNetwork["Version"][0]);
589  }
590 
591  switch ( version ) {
592  case 1:
593  readPvlV0001(controlNetwork, progress);
594  break;
595  case 2:
596  readPvlV0002(controlNetwork, progress);
597  break;
598  case 3:
599  readPvlV0003(controlNetwork, progress);
600  break;
601  case 4:
602  readPvlV0004(controlNetwork, progress);
603  break;
604  case 5:
605  readPvlV0005(controlNetwork, progress);
606  break;
607  default:
608  QString msg = "The Pvl file version [" + toString(version)
609  + "] is not supported";
610  throw IException(IException::Unknown, msg, _FILEINFO_);
611  }
612  }
613 
614 
621  void ControlNetVersioner::readPvlV0001(const PvlObject &network, Progress *progress) {
622  // initialize the header
623  ControlNetHeaderV0001 header;
624 
625  try {
626  header.networkID = network.findKeyword("NetworkId")[0];
627  header.targetName = network.findKeyword("TargetName")[0];
628  header.created = network.findKeyword("Created")[0];
629  header.lastModified = network.findKeyword("LastModified")[0];
630  header.description = network.findKeyword("Description")[0];
631  header.userName = network.findKeyword("UserName")[0];
632  createHeader(header);
633  }
634  catch (IException &e) {
635  QString msg = "Missing required header information.";
636  throw IException(e, IException::Io, msg, _FILEINFO_);
637  }
638 
639  if (progress) {
640  progress->SetText("Reading Control Points...");
641  progress->SetMaximumSteps(network.objects());
642  progress->CheckStatus();
643  }
644 
645  // initialize the control points
646  for (int objectIndex = 0; objectIndex < network.objects(); objectIndex ++) {
647  try {
648 
649  PvlObject pointObject = network.object(objectIndex);
650  ControlPointV0001 point(pointObject, m_header.targetName);
651 
652  m_points.append( createPoint(point) );
653 
654  if (progress) {
655  progress->CheckStatus();
656  }
657 
658  }
659  catch (IException &e) {
660  QString msg = "Failed to initialize control point at index ["
661  + toString(objectIndex) + "].";
662  throw IException(e, IException::Io, msg, _FILEINFO_);
663  }
664  }
665  }
666 
667 
674  void ControlNetVersioner::readPvlV0002(const PvlObject &network, Progress *progress) {
675  // initialize the header
676  try {
677  ControlNetHeaderV0002 header;
678  header.networkID = network.findKeyword("NetworkId")[0];
679  header.targetName = network.findKeyword("TargetName")[0];
680  header.created = network.findKeyword("Created")[0];
681  header.lastModified = network.findKeyword("LastModified")[0];
682  header.description = network.findKeyword("Description")[0];
683  header.userName = network.findKeyword("UserName")[0];
684  createHeader(header);
685  }
686  catch (IException &e) {
687  QString msg = "Missing required header information.";
688  throw IException(e, IException::Io, msg, _FILEINFO_);
689  }
690 
691  if (progress) {
692  progress->SetText("Reading Control Points...");
693  progress->SetMaximumSteps(network.objects());
694  progress->CheckStatus();
695  }
696 
697  // initialize the control points
698  for (int objectIndex = 0; objectIndex < network.objects(); objectIndex ++) {
699  try {
700  PvlObject pointObject = network.object(objectIndex);
701  ControlPointV0002 point(pointObject);
702 
703  m_points.append( createPoint(point) );
704 
705  if (progress) {
706  progress->CheckStatus();
707  }
708 
709  }
710  catch (IException &e) {
711  QString msg = "Failed to initialize control point at index ["
712  + toString(objectIndex) + "].";
713  throw IException(e, IException::Io, msg, _FILEINFO_);
714  }
715  }
716  }
717 
718 
725  void ControlNetVersioner::readPvlV0003(const PvlObject &network, Progress *progress) {
726  // initialize the header
727  try {
728  ControlNetHeaderV0003 header;
729  header.networkID = network.findKeyword("NetworkId")[0];
730  header.targetName = network.findKeyword("TargetName")[0];
731  header.created = network.findKeyword("Created")[0];
732  header.lastModified = network.findKeyword("LastModified")[0];
733  header.description = network.findKeyword("Description")[0];
734  header.userName = network.findKeyword("UserName")[0];
735  createHeader(header);
736  }
737  catch (IException &e) {
738  QString msg = "Missing required header information.";
739  throw IException(e, IException::Io, msg, _FILEINFO_);
740  }
741 
742  if (progress) {
743  progress->SetText("Reading Control Points...");
744  progress->SetMaximumSteps(network.objects());
745  progress->CheckStatus();
746  }
747 
748  // initialize the control points
749  for (int objectIndex = 0; objectIndex < network.objects(); objectIndex ++) {
750  try {
751  PvlObject pointObject = network.object(objectIndex);
752  ControlPointV0003 point(pointObject);
753  m_points.append( createPoint(point) );
754 
755  if (progress) {
756  progress->CheckStatus();
757  }
758 
759  }
760  catch (IException &e) {
761  QString msg = "Failed to initialize control point at index ["
762  + toString(objectIndex) + "].";
763  throw IException(e, IException::Io, msg, _FILEINFO_);
764  }
765  }
766  }
767 
768 
775  void ControlNetVersioner::readPvlV0004(const PvlObject &network, Progress *progress) {
776  // initialize the header
777  try {
778  ControlNetHeaderV0004 header;
779  header.networkID = network.findKeyword("NetworkId")[0];
780  header.targetName = network.findKeyword("TargetName")[0];
781  header.created = network.findKeyword("Created")[0];
782  header.lastModified = network.findKeyword("LastModified")[0];
783  header.description = network.findKeyword("Description")[0];
784  header.userName = network.findKeyword("UserName")[0];
785  createHeader(header);
786  }
787  catch (IException &e) {
788  QString msg = "Missing required header information.";
789  throw IException(e, IException::Io, msg, _FILEINFO_);
790  }
791 
792  if (progress) {
793  progress->SetText("Reading Control Points...");
794  progress->SetMaximumSteps(network.objects());
795  progress->CheckStatus();
796  }
797 
798  // initialize the control points
799  for (int objectIndex = 0; objectIndex < network.objects(); objectIndex ++) {
800  try {
801  PvlObject pointObject = network.object(objectIndex);
802  ControlPointV0004 point(pointObject);
803  m_points.append( createPoint(point) );
804 
805  if (progress) {
806  progress->CheckStatus();
807  }
808  }
809  catch (IException &e) {
810  QString msg = "Failed to initialize control point at index ["
811  + toString(objectIndex) + "].";
812  throw IException(e, IException::Io, msg, _FILEINFO_);
813  }
814  }
815  }
816 
817 
824  void ControlNetVersioner::readPvlV0005(const PvlObject &network, Progress *progress) {
825  // initialize the header
826  try {
827  ControlNetHeaderV0005 header;
828  header.networkID = network.findKeyword("NetworkId")[0];
829  header.targetName = network.findKeyword("TargetName")[0];
830  header.created = network.findKeyword("Created")[0];
831  header.lastModified = network.findKeyword("LastModified")[0];
832  header.description = network.findKeyword("Description")[0];
833  header.userName = network.findKeyword("UserName")[0];
834  createHeader(header);
835  }
836  catch (IException &e) {
837  QString msg = "Missing required header information.";
838  throw IException(e, IException::Io, msg, _FILEINFO_);
839  }
840 
841  if (progress) {
842  progress->SetText("Reading Control Points...");
843  progress->SetMaximumSteps(network.objects());
844  progress->CheckStatus();
845  }
846 
847  // initialize the control points
848  for (int objectIndex = 0; objectIndex < network.objects(); objectIndex ++) {
849  try {
850  PvlObject pointObject = network.object(objectIndex);
851  ControlPointV0005 point(pointObject);
852  m_points.append( createPoint(point) );
853 
854  if (progress) {
855  progress->CheckStatus();
856  }
857  }
858  catch (IException &e) {
859  QString msg = "Failed to initialize control point at index ["
860  + toString(objectIndex) + "].";
861  throw IException(e, IException::Io, msg, _FILEINFO_);
862  }
863  }
864  }
865 
866 
876  const FileName netFile,
877  Progress *progress) {
878  int version = 1;
879 
880  const PvlObject &protoBuf = header.findObject("ProtoBuffer");
881  const PvlGroup &netInfo = protoBuf.findGroup("ControlNetworkInfo");
882 
883  if ( netInfo.hasKeyword("Version") ) {
884  version = toInt(netInfo["Version"][0]);
885  }
886  switch ( version ) {
887  case 1:
888  readProtobufV0001(header, netFile, progress);
889  break;
890  case 2:
891  readProtobufV0002(header, netFile, progress);
892  break;
893  case 5:
894  readProtobufV0005(header, netFile, progress);
895  break;
896  default:
897  QString msg = "The Protobuf file version [" + toString(version)
898  + "] is not supported";
899  throw IException(IException::Io, msg, _FILEINFO_);
900  }
901  }
902 
903 
913  const FileName netFile,
914  Progress *progress) {
915  const PvlObject &protoBufferInfo = header.findObject("ProtoBuffer");
916  const PvlObject &protoBufferCore = protoBufferInfo.findObject("Core");
917 
918  BigInt coreStartPos = protoBufferCore["StartByte"];
919  BigInt coreLength = protoBufferCore["Bytes"];
920 
921  fstream input(netFile.expanded().toLatin1().data(), ios::in | ios::binary);
922  if ( !input.is_open() ) {
923  QString msg = "Failed to open protobuf file [" + netFile.name() + "].";
924  throw IException(IException::Programmer, msg, _FILEINFO_);
925  }
926 
927  input.seekg(coreStartPos, ios::beg);
928  IstreamInputStream inStream(&input);
929  CodedInputStream codedInStream(&inStream);
930  codedInStream.PushLimit(coreLength);
931  // max 512MB, warn at 400MB
932  codedInStream.SetTotalBytesLimit(1024 * 1024 * 512, 1024 * 1024 * 400);
933 
934  // Now stream the rest of the input into the google protocol buffer.
935  ControlNetFileProtoV0001 protoNet;
936  try {
937  if ( !protoNet.ParseFromCodedStream(&codedInStream) ) {
938  QString msg = "Failed to read input PB file [" + netFile.name() + "].";
939  throw IException(IException::Programmer, msg, _FILEINFO_);
940  }
941  }
942  catch (IException &e) {
943  QString msg = "Cannot parse binary protobuf file";
944  throw IException(e, IException::User, msg, _FILEINFO_);
945  }
946  catch (...) {
947  QString msg = "Cannot parse binary PB file";
948  throw IException(IException::User, msg, _FILEINFO_);
949  }
950 
951  const PvlObject &logDataInfo = protoBufferInfo.findObject("LogData");
952  BigInt logStartPos = logDataInfo["StartByte"];
953  BigInt logLength = logDataInfo["Bytes"];
954 
955  input.clear();
956  input.seekg(logStartPos, ios::beg);
957  IstreamInputStream logInStream(&input);
958  CodedInputStream codedLogInStream(&logInStream);
959  codedLogInStream.PushLimit(logLength);
960  // max 512MB, warn at 400MB
961  codedLogInStream.SetTotalBytesLimit(1024 * 1024 * 512, 1024 * 1024 * 400);
962 
963  // Now stream the rest of the input into the google protocol buffer.
964  ControlNetLogDataProtoV0001 protoLogData;
965  try {
966  if ( !protoLogData.ParseFromCodedStream(&codedLogInStream) ) {
967  QString msg = "Failed to read log data in protobuf file [" + netFile.name() + "].";
968  throw IException(IException::Programmer, msg, _FILEINFO_);
969  }
970  }
971  catch (...) {
972  QString msg = "Cannot parse binary protobuf file's log data";
973  throw IException(IException::User, msg, _FILEINFO_);
974  }
975 
976  // Create the header
977  try {
978  ControlNetHeaderV0002 header;
979  header.networkID = protoNet.networkid().c_str();
980  if ( protoNet.has_targetname() ) {
981  header.targetName = protoNet.targetname().c_str();
982  }
983  else {
984  header.targetName = "";
985  }
986  header.created = protoNet.created().c_str();
987  header.lastModified = protoNet.lastmodified().c_str();
988  header.description = protoNet.description().c_str();
989  header.userName = protoNet.username().c_str();
990  createHeader(header);
991  }
992  catch (IException &e) {
993  QString msg = "Failed to parse the header from the protobuf control network file.";
994  throw IException(e, IException::User, msg, _FILEINFO_);
995  }
996 
997  if (progress) {
998  progress->SetText("Reading Control Points...");
999  progress->SetMaximumSteps( protoNet.points_size() );
1000  progress->CheckStatus();
1001  }
1002 
1003  // Create the control points
1004  for (int i = 0; i < protoNet.points_size(); i++) {
1005  try {
1007  protoPoint(new ControlNetFileProtoV0001_PBControlPoint(protoNet.points(i)));
1009  protoPointLogData(new ControlNetLogDataProtoV0001_Point(protoLogData.points(i)));
1010  ControlPointV0002 point(protoPoint, protoPointLogData);
1011  m_points.append( createPoint(point) );
1012 
1013  if (progress) {
1014  progress->CheckStatus();
1015  }
1016 
1017  }
1018  catch (IException &e) {
1019  QString msg = "Failed to convert version 1 protobuf control point at index ["
1020  + toString(i) + "] into a ControlPoint.";
1021  throw IException(e, IException::User, msg, _FILEINFO_);
1022  }
1023  }
1024  }
1025 
1026 
1036  const FileName netFile,
1037  Progress *progress) {
1038  // read the header protobuf object
1039  const PvlObject &protoBufferInfo = header.findObject("ProtoBuffer");
1040  const PvlObject &protoBufferCore = protoBufferInfo.findObject("Core");
1041 
1042  BigInt headerStartPos = protoBufferCore["HeaderStartByte"];
1043  BigInt headerLength = protoBufferCore["HeaderBytes"];
1044 
1045  fstream input(netFile.expanded().toLatin1().data(), ios::in | ios::binary);
1046  if ( !input.is_open() ) {
1047  QString msg = "Failed to open control network file" + netFile.name();
1048  throw IException(IException::Programmer, msg, _FILEINFO_);
1049  }
1050 
1051  input.seekg(headerStartPos, ios::beg);
1052  streampos filePos = input.tellg();
1053 
1054  ControlNetFileHeaderV0002 protoHeader;
1055  try {
1056  IstreamInputStream headerInStream(&input);
1057  CodedInputStream headerCodedInStream(&headerInStream);
1058  // max 512MB, warn at 400MB
1059  headerCodedInStream.SetTotalBytesLimit(1024 * 1024 * 512,
1060  1024 * 1024 * 400);
1061  CodedInputStream::Limit oldLimit = headerCodedInStream.PushLimit(headerLength);
1062  if ( !protoHeader.ParseFromCodedStream(&headerCodedInStream) ) {
1063  QString msg = "Failed to parse protobuf header from input control net file ["
1064  + netFile.name() + "]";
1065  throw IException(IException::Io, msg, _FILEINFO_);
1066  }
1067  headerCodedInStream.PopLimit(oldLimit);
1068  filePos += headerLength;
1069  }
1070  catch (...) {
1071  QString msg = "An error occured while reading the protobuf control network header.";
1072  throw IException(IException::Io, msg, _FILEINFO_);
1073  }
1074 
1075  // initialize the header from the protobuf header
1076  try {
1077  ControlNetHeaderV0004 header;
1078  header.networkID = protoHeader.networkid().c_str();
1079  if ( protoHeader.has_targetname() ) {
1080  header.targetName = protoHeader.targetname().c_str();
1081  }
1082  else {
1083  header.targetName = "";
1084  }
1085  header.created = protoHeader.created().c_str();
1086  header.lastModified = protoHeader.lastmodified().c_str();
1087  header.description = protoHeader.description().c_str();
1088  header.userName = protoHeader.username().c_str();
1089  createHeader(header);
1090  }
1091  catch (IException &e) {
1092  QString msg = "Missing required header information.";
1093  throw IException(e, IException::Io, msg, _FILEINFO_);
1094  }
1095 
1096  // read each protobuf control point and then initialize it
1097  // For some reason, reading the header causes the input stream to fail so reopen the file
1098  input.close();
1099  input.open(netFile.expanded().toLatin1().data(), ios::in | ios::binary);
1100  input.seekg(filePos, ios::beg);
1101  IstreamInputStream pointInStream(&input);
1102  int numPoints = protoHeader.pointmessagesizes_size();
1103 
1104  if (progress) {
1105  progress->SetText("Reading Control Points...");
1106  progress->SetMaximumSteps(numPoints);
1107  progress->CheckStatus();
1108  }
1109 
1110  for (int pointIndex = 0; pointIndex < numPoints; pointIndex ++) {
1111  QSharedPointer<ControlPointFileEntryV0002> newPoint(new ControlPointFileEntryV0002);
1112 
1113  try {
1114  CodedInputStream pointCodedInStream(&pointInStream);
1115  pointCodedInStream.SetTotalBytesLimit(1024 * 1024 * 512,
1116  1024 * 1024 * 400);
1117  int pointSize = protoHeader.pointmessagesizes(pointIndex);
1118  CodedInputStream::Limit oldPointLimit = pointCodedInStream.PushLimit(pointSize);
1119  newPoint->ParseFromCodedStream(&pointCodedInStream);
1120  pointCodedInStream.PopLimit(oldPointLimit);
1121  }
1122  catch (...) {
1123  QString msg = "Failed to read protobuf version 2 control point at index ["
1124  + toString(pointIndex) + "].";
1125  throw IException(IException::Io, msg, _FILEINFO_);
1126  }
1127 
1128  try {
1129  ControlPointV0004 point(newPoint);
1130  m_points.append( createPoint(point) );
1131 
1132  if (progress) {
1133  progress->CheckStatus();
1134  }
1135 
1136  }
1137  catch (IException &e) {
1138  QString msg = "Failed to convert protobuf version 2 control point at index ["
1139  + toString(pointIndex) + "] into a ControlPoint.";
1140  throw IException(e, IException::Io, msg, _FILEINFO_);
1141  }
1142  }
1143  }
1144 
1145 
1155  const FileName netFile,
1156  Progress *progress) {
1157 
1158  // read the header protobuf object
1159  const PvlObject &protoBufferInfo = header.findObject("ProtoBuffer");
1160  const PvlObject &protoBufferCore = protoBufferInfo.findObject("Core");
1161 
1162  BigInt headerStartPos = protoBufferCore["HeaderStartByte"];
1163  BigInt headerLength = protoBufferCore["HeaderBytes"];
1164  BigInt pointsLength = protoBufferCore["PointsBytes"];
1165 
1166  fstream input(netFile.expanded().toLatin1().data(), ios::in | ios::binary);
1167  if ( !input.is_open() ) {
1168  QString msg = "Failed to open control network file" + netFile.name();
1169  throw IException(IException::Programmer, msg, _FILEINFO_);
1170  }
1171 
1172  input.seekg(headerStartPos, ios::beg);
1173 
1174  streampos filePos = input.tellg();
1175 
1176  ControlNetFileHeaderV0005 protoHeader;
1177  try {
1178 
1179  IstreamInputStream headerInStream(&input);
1180  CodedInputStream headerCodedInStream(&headerInStream);
1181 
1182  // max 512MB, warn at 400MB
1183  headerCodedInStream.SetTotalBytesLimit(1024 * 1024 * 512,
1184  1024 * 1024 * 400);
1185 
1186  CodedInputStream::Limit oldLimit = headerCodedInStream.PushLimit(headerLength);
1187 
1188  if ( !protoHeader.ParseFromCodedStream(&headerCodedInStream) ) {
1189  QString msg = "Failed to parse protobuf header from input control net file ["
1190  + netFile.name() + "]";
1191  throw IException(IException::Io, msg, _FILEINFO_);
1192  }
1193 
1194  headerCodedInStream.PopLimit(oldLimit);
1195 
1196  filePos += headerLength;
1197  }
1198  catch (...) {
1199  QString msg = "An error occured while reading the protobuf control network header.";
1200  throw IException(IException::Io, msg, _FILEINFO_);
1201  }
1202  // initialize the header from the protobuf header
1203  try {
1204  ControlNetHeaderV0005 header;
1205  header.networkID = protoHeader.networkid().c_str();
1206  if ( protoHeader.has_targetname() ) {
1207  header.targetName = protoHeader.targetname().c_str();
1208  }
1209  else {
1210  header.targetName = "";
1211  }
1212  header.created = protoHeader.created().c_str();
1213  header.lastModified = protoHeader.lastmodified().c_str();
1214  header.description = protoHeader.description().c_str();
1215  header.userName = protoHeader.username().c_str();
1216  createHeader(header);
1217  }
1218  catch (IException &e) {
1219  QString msg = "Missing required header information.";
1220  throw IException(e, IException::Io, msg, _FILEINFO_);
1221  }
1222 
1223  // read each protobuf control point and then initialize it
1224  // For some reason, reading the header causes the input stream to fail so reopen the file
1225  input.close();
1226  input.open(netFile.expanded().toLatin1().data(), ios::in | ios::binary);
1227  input.seekg(filePos, ios::beg);
1228 
1229  IstreamInputStream pointInStream(&input);
1230 
1231  BigInt numberOfPoints = 0;
1232 
1233  if ( protoBufferInfo.hasGroup("ControlNetworkInfo") ) {
1234  const PvlGroup &networkInfo = protoBufferInfo.findGroup("ControlNetworkInfo");
1235 
1236  if ( networkInfo.hasKeyword("NumberOfPoints") ) {
1237  try {
1238  numberOfPoints = networkInfo["NumberOfPoints"];
1239  }
1240  catch (...) {
1241  numberOfPoints = 0;
1242  }
1243  }
1244  }
1245 
1246  if (progress && numberOfPoints != 0) {
1247  progress->SetText("Reading Control Points...");
1248  progress->SetMaximumSteps(numberOfPoints);
1249  progress->CheckStatus();
1250  }
1251 
1252  Isis::EndianSwapper lsb("LSB");
1253  int pointIndex = -1;
1254  while (pointInStream.ByteCount() < pointsLength) {
1255  pointIndex += 1;
1256  QSharedPointer<ControlPointFileEntryV0002> newPoint(new ControlPointFileEntryV0002);
1257 
1258  try {
1259 
1260  CodedInputStream pointCodedInStream(&pointInStream);
1261  pointCodedInStream.SetTotalBytesLimit(1024 * 1024 * 512,
1262  1024 * 1024 * 400);
1263 
1264  uint32_t size;
1265  pointCodedInStream.ReadRaw(reinterpret_cast<char *>(&size), sizeof(size));
1266 
1267  size = lsb.Uint32_t(&size);
1268 
1269  CodedInputStream::Limit oldPointLimit = pointCodedInStream.PushLimit(size);
1270  newPoint->ParseFromCodedStream(&pointCodedInStream);
1271  pointCodedInStream.PopLimit(oldPointLimit);
1272  }
1273  catch (...) {
1274  QString msg = "Failed to read protobuf version 2 control point at index ["
1275  + toString(pointIndex) + "].";
1276  throw IException(IException::Io, msg, _FILEINFO_);
1277  }
1278 
1279  try {
1280  ControlPointV0005 point(newPoint);
1281  m_points.append( createPoint(point) );
1282 
1283  if (progress && numberOfPoints != 0) {
1284  progress->CheckStatus();
1285  }
1286 
1287  }
1288  catch (IException &e) {
1289  QString msg = "Failed to convert protobuf version 2 control point at index ["
1290  + toString(pointIndex) + "] into a ControlPoint.";
1291  throw IException(e, IException::Io, msg, _FILEINFO_);
1292  }
1293  }
1294  }
1295 
1296 
1309  ControlPointV0002 newPoint(point);
1310  return createPoint(newPoint);
1311  }
1312 
1313 
1326 
1327  ControlPointV0003 newPoint(point);
1328  return createPoint(newPoint);
1329 
1330  }
1331 
1332 
1345 
1346  ControlPointFileEntryV0002 protoPoint = point.pointData();
1347  ControlPoint *controlPoint = new ControlPoint;
1348 
1349  // ID is required, no need for if-statement here
1350  controlPoint->SetId(QString(protoPoint.id().c_str()));
1351 
1352  if ( protoPoint.has_choosername() ) {
1353  controlPoint->SetChooserName(protoPoint.choosername().c_str());
1354  }
1355 
1356  // point type is required, no need for if statement here
1357  ControlPoint::PointType pointType;
1358  switch ( protoPoint.type() ) {
1359  case ControlPointFileEntryV0002_PointType_obsolete_Tie:
1360  case ControlPointFileEntryV0002_PointType_Free:
1361  pointType = ControlPoint::Free;
1362  break;
1363  case ControlPointFileEntryV0002_PointType_Constrained:
1364  pointType = ControlPoint::Constrained;
1365  break;
1366  case ControlPointFileEntryV0002_PointType_obsolete_Ground:
1367  case ControlPointFileEntryV0002_PointType_Fixed:
1368  pointType = ControlPoint::Fixed;
1369  break;
1370  default:
1371  QString msg = "Unable to create ControlPoint [" + toString(protoPoint.id().c_str())
1372  + "] from file. Type enumeration [" + toString((int)(protoPoint.type()))
1373  + "] is invalid.";
1374  throw IException(IException::Programmer, msg, _FILEINFO_);
1375  break;
1376  }
1377  controlPoint->SetType(pointType);
1378 
1379  if ( protoPoint.has_ignore() ) {
1380  controlPoint->SetIgnored(protoPoint.ignore());
1381  }
1382  if ( protoPoint.has_jigsawrejected() ) {
1383  controlPoint->SetRejected(protoPoint.jigsawrejected());
1384  }
1385 
1386  // setting apriori radius information
1387  if ( protoPoint.has_aprioriradiussource() ) {
1388 
1389  switch ( protoPoint.aprioriradiussource() ) {
1390  case ControlPointFileEntryV0002_AprioriSource_None:
1391  controlPoint->SetAprioriRadiusSource(ControlPoint::RadiusSource::None);
1392  break;
1393  case ControlPointFileEntryV0002_AprioriSource_User:
1394  controlPoint->SetAprioriRadiusSource(ControlPoint::RadiusSource::User);
1395  break;
1396  case ControlPointFileEntryV0002_AprioriSource_AverageOfMeasures:
1397  controlPoint->SetAprioriRadiusSource(ControlPoint::RadiusSource::AverageOfMeasures);
1398  break;
1399  case ControlPointFileEntryV0002_AprioriSource_Ellipsoid:
1400  controlPoint->SetAprioriRadiusSource(ControlPoint::RadiusSource::Ellipsoid);
1401  break;
1402  case ControlPointFileEntryV0002_AprioriSource_DEM:
1403  controlPoint->SetAprioriRadiusSource(ControlPoint::RadiusSource::DEM);
1404  break;
1405  case ControlPointFileEntryV0002_AprioriSource_BundleSolution:
1406  controlPoint->SetAprioriRadiusSource(ControlPoint::RadiusSource::BundleSolution);
1407  break;
1408 
1409  default:
1410  QString msg = "Unknown control point apriori radius source.";
1411  throw IException(IException::User, msg, _FILEINFO_);
1412  break;
1413  }
1414  }
1415 
1416  if ( protoPoint.has_aprioriradiussourcefile() ) {
1417  controlPoint->SetAprioriRadiusSourceFile(protoPoint.aprioriradiussourcefile().c_str());
1418  }
1419 
1420  // setting apriori surf pt information
1421  if ( protoPoint.has_apriorisurfpointsource() ) {
1422  switch ( protoPoint.apriorisurfpointsource() ) {
1423  case ControlPointFileEntryV0002_AprioriSource_None:
1424  controlPoint->SetAprioriSurfacePointSource(ControlPoint::SurfacePointSource::None);
1425  break;
1426 
1427  case ControlPointFileEntryV0002_AprioriSource_User:
1428  controlPoint->SetAprioriSurfacePointSource(ControlPoint::SurfacePointSource::User);
1429  break;
1430 
1431  case ControlPointFileEntryV0002_AprioriSource_AverageOfMeasures:
1432  controlPoint->SetAprioriSurfacePointSource(
1433  ControlPoint::SurfacePointSource::AverageOfMeasures);
1434  break;
1435 
1436  case ControlPointFileEntryV0002_AprioriSource_Reference:
1437  controlPoint->SetAprioriSurfacePointSource(ControlPoint::SurfacePointSource::Reference);
1438  break;
1439 
1440  case ControlPointFileEntryV0002_AprioriSource_Basemap:
1441  controlPoint->SetAprioriSurfacePointSource(ControlPoint::SurfacePointSource::Basemap);
1442  break;
1443 
1444  case ControlPointFileEntryV0002_AprioriSource_BundleSolution:
1445  controlPoint->SetAprioriSurfacePointSource(
1446  ControlPoint::SurfacePointSource::BundleSolution);
1447  break;
1448 
1449  default:
1450  QString msg = "Unknown control point aprioir surface point source.";
1451  throw IException(IException::User, msg, _FILEINFO_);
1452  break;
1453  }
1454  }
1455 
1456  if ( protoPoint.has_apriorisurfpointsourcefile() ) {
1457  controlPoint->SetAprioriSurfacePointSourceFile(
1458  protoPoint.apriorisurfpointsourcefile().c_str());
1459  }
1460 
1461  if ( protoPoint.has_apriorix()
1462  && protoPoint.has_aprioriy()
1463  && protoPoint.has_aprioriz() ) {
1464 
1465  SurfacePoint aprioriSurfacePoint(Displacement(protoPoint.apriorix(), Displacement::Meters),
1466  Displacement(protoPoint.aprioriy(), Displacement::Meters),
1467  Displacement(protoPoint.aprioriz(), Displacement::Meters));
1468 
1469  if ( protoPoint.aprioricovar_size() > 0 ) {
1470  symmetric_matrix<double, upper> aprioriCovarianceMatrix;
1471  aprioriCovarianceMatrix.resize(3);
1472  aprioriCovarianceMatrix.clear();
1473  aprioriCovarianceMatrix(0, 0) = protoPoint.aprioricovar(0);
1474  aprioriCovarianceMatrix(0, 1) = protoPoint.aprioricovar(1);
1475  aprioriCovarianceMatrix(0, 2) = protoPoint.aprioricovar(2);
1476  aprioriCovarianceMatrix(1, 1) = protoPoint.aprioricovar(3);
1477  aprioriCovarianceMatrix(1, 2) = protoPoint.aprioricovar(4);
1478  aprioriCovarianceMatrix(2, 2) = protoPoint.aprioricovar(5);
1479  aprioriSurfacePoint.SetRectangularMatrix(aprioriCovarianceMatrix);
1480  // note: setting lat/lon/rad constrained happens when we call SetAprioriSurfacePoint()
1481  }
1482 
1483  controlPoint->SetAprioriSurfacePoint(aprioriSurfacePoint);
1484  }
1485 
1486  // setting adj surf pt information
1487  if ( protoPoint.has_adjustedx()
1488  && protoPoint.has_adjustedy()
1489  && protoPoint.has_adjustedz() ) {
1490 
1491  SurfacePoint adjustedSurfacePoint(Displacement(protoPoint.adjustedx(),Displacement::Meters),
1492  Displacement(protoPoint.adjustedy(),Displacement::Meters),
1493  Displacement(protoPoint.adjustedz(),Displacement::Meters));
1494 
1495  if ( protoPoint.adjustedcovar_size() > 0 ) {
1496  symmetric_matrix<double, upper> adjustedCovarianceMatrix;
1497  adjustedCovarianceMatrix.resize(3);
1498  adjustedCovarianceMatrix.clear();
1499  adjustedCovarianceMatrix(0, 0) = protoPoint.adjustedcovar(0);
1500  adjustedCovarianceMatrix(0, 1) = protoPoint.adjustedcovar(1);
1501  adjustedCovarianceMatrix(0, 2) = protoPoint.adjustedcovar(2);
1502  adjustedCovarianceMatrix(1, 1) = protoPoint.adjustedcovar(3);
1503  adjustedCovarianceMatrix(1, 2) = protoPoint.adjustedcovar(4);
1504  adjustedCovarianceMatrix(2, 2) = protoPoint.adjustedcovar(5);
1505  adjustedSurfacePoint.SetRectangularMatrix(adjustedCovarianceMatrix);
1506  }
1507 
1508  controlPoint->SetAdjustedSurfacePoint(adjustedSurfacePoint);
1509  }
1510 
1511  SurfacePoint aprioriSurfacePoint = controlPoint->GetAprioriSurfacePoint();
1512  SurfacePoint adjustedSurfacePoint = controlPoint->GetAdjustedSurfacePoint();
1513  controlPoint->SetAdjustedSurfacePoint(adjustedSurfacePoint);
1514  controlPoint->SetAprioriSurfacePoint(aprioriSurfacePoint);
1515 
1516  // adding measure information
1517  for (int m = 0 ; m < protoPoint.measures_size(); m++) {
1518  controlPoint->Add( createMeasure( protoPoint.measures(m) ) );
1519  }
1520 
1521  if ( protoPoint.has_referenceindex() ) {
1522  controlPoint->SetRefMeasure(protoPoint.referenceindex());
1523  }
1524 
1525  // Set DateTime after calling all setters that clear DateTime value
1526  if ( protoPoint.has_datetime() ) {
1527  controlPoint->SetDateTime(protoPoint.datetime().c_str());
1528  }
1529  // Set edit lock last
1530  if ( protoPoint.has_editlock() ) {
1531  controlPoint->SetEditLock(protoPoint.editlock());
1532  }
1533 
1534  return controlPoint;
1535 
1536  }
1537 
1538 
1548  const ControlPointFileEntryV0002_Measure &measure) {
1549 
1550  ControlMeasure *newMeasure = new ControlMeasure;
1551 
1552  // serial number is required, no need for if-statement
1553  newMeasure->SetCubeSerialNumber(QString(measure.serialnumber().c_str()));
1554 
1555  // measure type is required, no need for if-statement
1556  ControlMeasure::MeasureType measureType;
1557  switch ( measure.type() ) {
1558  case ControlPointFileEntryV0002_Measure::Candidate:
1559  measureType = ControlMeasure::Candidate;
1560  break;
1561  case ControlPointFileEntryV0002_Measure::Manual:
1562  measureType = ControlMeasure::Manual;
1563  break;
1564  case ControlPointFileEntryV0002_Measure::RegisteredPixel:
1565  measureType = ControlMeasure::RegisteredPixel;
1566  break;
1567  case ControlPointFileEntryV0002_Measure::RegisteredSubPixel:
1568  measureType = ControlMeasure::RegisteredSubPixel;
1569  break;
1570  default:
1571  QString msg = "Unknown control measure type.";
1572  throw IException(IException::User, msg, _FILEINFO_);
1573  break;
1574  }
1575  newMeasure->SetType(measureType);
1576 
1577  if ( measure.has_jigsawrejected() ) {
1578  newMeasure->SetRejected(measure.jigsawrejected());
1579  }
1580  if ( measure.has_ignore() ) {
1581  newMeasure->SetIgnored(measure.ignore());
1582  }
1583  if ( measure.has_line() ) {
1584  newMeasure->SetCoordinate(measure.sample(), measure.line());
1585  }
1586  if ( measure.has_diameter() ) {
1587  newMeasure->SetDiameter(measure.diameter());
1588  }
1589  if ( measure.has_apriorisample() ) {
1590  newMeasure->SetAprioriSample(measure.apriorisample());
1591  }
1592  if ( measure.has_aprioriline() ) {
1593  newMeasure->SetAprioriLine(measure.aprioriline());
1594  }
1595  if ( measure.has_samplesigma() ) {
1596  newMeasure->SetSampleSigma(measure.samplesigma());
1597  }
1598  if ( measure.has_linesigma() ) {
1599  newMeasure->SetLineSigma(measure.linesigma());
1600  }
1601  if ( measure.has_sampleresidual()
1602  && measure.has_lineresidual() ) {
1603  newMeasure->SetResidual(measure.sampleresidual(), measure.lineresidual());
1604  }
1605 
1606  for (int i = 0; i < measure.log_size(); i++) {
1607 
1608  const ControlPointFileEntryV0002_Measure_MeasureLogData &protoLog = measure.log(i);
1609  ControlMeasureLogData logEntry;
1610  if ( protoLog.has_doubledatatype() ) {
1611  logEntry.SetDataType((ControlMeasureLogData::NumericLogDataType)protoLog.doubledatatype());
1612  }
1613  if ( protoLog.has_doubledatavalue() ) {
1614  logEntry.SetNumericalValue( protoLog.doubledatavalue() );
1615  }
1616  newMeasure->SetLogData(logEntry);
1617  }
1618 
1619  if ( measure.has_choosername() ) {
1620  newMeasure->SetChooserName(QString(measure.choosername().c_str()));
1621  }
1622 
1623  if ( measure.has_datetime() ) {
1624  newMeasure->SetDateTime(QString(measure.datetime().c_str()));
1625  }
1626 
1627  // It is VERY important that the edit lock flag is set last because it prevents
1628  // all of the other mutators from working if true.
1629  if ( measure.has_editlock() ) {
1630  newMeasure->SetEditLock(measure.editlock());
1631  }
1632  return newMeasure;
1633  }
1634 
1635 
1645  m_header = header;
1646 
1647  if ( m_header.targetName.startsWith("MRO/") ) {
1648  m_header.targetName = "Mars";
1649  }
1650  }
1651 
1652 
1660  try {
1661 
1662  const int labelBytes = 65536;
1663  fstream output(netFile.expanded().toLatin1().data(), ios::out | ios::trunc | ios::binary);
1664  char *blankLabel = new char[labelBytes];
1665  memset(blankLabel, 0, labelBytes);
1666  output.write(blankLabel, labelBytes);
1667  delete [] blankLabel;
1668 
1669  int numMeasures = 0;
1670  int numPoints = m_points.size();
1671  foreach (ControlPoint *point, m_points) {
1672  numMeasures += point->GetNumMeasures();
1673  }
1674 
1675  streampos startCoreHeaderPos = output.tellp();
1676 
1677  writeHeader(&output);
1678 
1679  BigInt pointByteTotal = 0;
1680  while ( !m_points.isEmpty() ) {
1681  pointByteTotal += writeFirstPoint(&output);
1682  }
1683 
1684  // Insert header at the beginning of the file once writing is done.
1685  ControlNetFileHeaderV0005 protobufHeader;
1686 
1687  protobufHeader.set_networkid(m_header.networkID.toLatin1().data());
1688  protobufHeader.set_targetname(m_header.targetName.toLatin1().data());
1689  protobufHeader.set_created(m_header.created.toLatin1().data());
1690  protobufHeader.set_lastmodified(m_header.lastModified.toLatin1().data());
1691  protobufHeader.set_description(m_header.description.toLatin1().data());
1692  protobufHeader.set_username(m_header.userName.toLatin1().data());
1693 
1694  streampos coreHeaderSize = protobufHeader.ByteSize();
1695 
1696  Pvl p;
1697 
1698  PvlObject protoObj("ProtoBuffer");
1699 
1700  PvlObject protoCore("Core");
1701  protoCore.addKeyword(PvlKeyword("HeaderStartByte",
1702  toString((BigInt) startCoreHeaderPos)));
1703  protoCore.addKeyword(PvlKeyword("HeaderBytes", toString((BigInt) coreHeaderSize)));
1704 
1705  BigInt pointsStartByte = (BigInt) (startCoreHeaderPos + coreHeaderSize);
1706 
1707  protoCore.addKeyword(PvlKeyword("PointsStartByte", toString(pointsStartByte)));
1708 
1709  protoCore.addKeyword(PvlKeyword("PointsBytes",
1710  toString(pointByteTotal)));
1711  protoObj.addObject(protoCore);
1712 
1713  PvlGroup netInfo("ControlNetworkInfo");
1714  netInfo.addComment("This group is for informational purposes only");
1715  netInfo += PvlKeyword("NetworkId", protobufHeader.networkid().c_str());
1716  netInfo += PvlKeyword("TargetName", protobufHeader.targetname().c_str());
1717  netInfo += PvlKeyword("UserName", protobufHeader.username().c_str());
1718  netInfo += PvlKeyword("Created", protobufHeader.created().c_str());
1719  netInfo += PvlKeyword("LastModified", protobufHeader.lastmodified().c_str());
1720  netInfo += PvlKeyword("Description", protobufHeader.description().c_str());
1721  netInfo += PvlKeyword("NumberOfPoints", toString(numPoints));
1722  netInfo += PvlKeyword("NumberOfMeasures", toString(numMeasures));
1723  netInfo += PvlKeyword("Version", "5");
1724  protoObj.addGroup(netInfo);
1725 
1726  p.addObject(protoObj);
1727 
1728  output.seekp(0, ios::beg);
1729  output << p;
1730  output << '\n';
1731  output.close();
1732 
1733  }
1734  catch (...) {
1735  QString msg = "Can't write control net file";
1736  throw IException(IException::Io, msg, _FILEINFO_);
1737  }
1738  }
1739 
1745  void ControlNetVersioner::writeHeader(fstream *output) {
1746 
1747  // Create the protobuf header using our struct
1748  ControlNetFileHeaderV0005 protobufHeader;
1749 
1750  protobufHeader.set_networkid(m_header.networkID.toLatin1().data());
1751  protobufHeader.set_targetname(m_header.targetName.toLatin1().data());
1752  protobufHeader.set_created(m_header.created.toLatin1().data());
1753  protobufHeader.set_lastmodified(m_header.lastModified.toLatin1().data());
1754  protobufHeader.set_description(m_header.description.toLatin1().data());
1755  protobufHeader.set_username(m_header.userName.toLatin1().data());
1756 
1757  // Write out the header
1758  if ( !protobufHeader.SerializeToOstream(output) ) {
1759  QString msg = "Failed to write output control network file.";
1760  throw IException(IException::Io, msg, _FILEINFO_);
1761  }
1762  }
1763 
1764 
1775 
1776  BigInt startPos = output->tellp();
1777 
1778  ControlPointFileEntryV0002 protoPoint;
1779  ControlPoint *controlPoint = m_points.takeFirst();
1780 
1781  if ( controlPoint->GetId().isEmpty() ) {
1782  QString msg = "Unbable to write first point of control net. "
1783  "Invalid control point has no point ID value.";
1784  throw IException(IException::Unknown, msg, _FILEINFO_);
1785  }
1786  else {
1787  protoPoint.set_id(controlPoint->GetId().toLatin1().data());
1788  }
1789 
1790  if ( QString::compare(controlPoint->GetChooserName(), "Null", Qt::CaseInsensitive) != 0 ) {
1791  protoPoint.set_choosername(controlPoint->GetChooserName().toLatin1().data());
1792  }
1793  if ( QString::compare(controlPoint->GetDateTime(), "Null", Qt::CaseInsensitive) != 0 ) {
1794  protoPoint.set_datetime(controlPoint->GetDateTime().toLatin1().data());
1795  }
1796  if ( controlPoint->IsEditLocked() ) {
1797  protoPoint.set_editlock(true);
1798  }
1799 
1800  ControlPointFileEntryV0002_PointType pointType;
1801  switch ( controlPoint->GetType() ) {
1802  case ControlPoint::Free:
1803  pointType = ControlPointFileEntryV0002_PointType_Free;
1804  break;
1806  pointType = ControlPointFileEntryV0002_PointType_Constrained;
1807  break;
1808  case ControlPoint::Fixed:
1809  pointType = ControlPointFileEntryV0002_PointType_Fixed;
1810  break;
1811  default:
1812  pointType = ControlPointFileEntryV0002_PointType_Free;
1813  break;
1814  }
1815  protoPoint.set_type(pointType);
1816 
1817  if ( controlPoint->IsIgnored() ) {
1818  protoPoint.set_ignore(true);
1819  }
1820 
1821  if ( controlPoint->IsRejected() ) {
1822  protoPoint.set_jigsawrejected(true);
1823  }
1824 
1825  if ( controlPoint->HasRefMeasure() && controlPoint->IsReferenceExplicit() ) {
1826  protoPoint.set_referenceindex(controlPoint->IndexOfRefMeasure());
1827  }
1828 
1829  if ( controlPoint->HasAprioriSurfacePointSourceFile() ) {
1830  protoPoint.set_apriorisurfpointsourcefile(
1831  controlPoint->GetAprioriSurfacePointSourceFile().toLatin1().data());
1832  }
1833 
1834  // Apriori Surf Point Source ENUM settting
1835  switch ( controlPoint->GetAprioriSurfacePointSource() ) {
1836  case ControlPoint::SurfacePointSource::None:
1837  protoPoint.set_apriorisurfpointsource(ControlPointFileEntryV0002_AprioriSource_None);
1838  break;
1839  case ControlPoint::SurfacePointSource::User:
1840  protoPoint.set_apriorisurfpointsource(ControlPointFileEntryV0002_AprioriSource_User);
1841  break;
1842  case ControlPoint::SurfacePointSource::AverageOfMeasures:
1843  protoPoint.set_apriorisurfpointsource(
1844  ControlPointFileEntryV0002_AprioriSource_AverageOfMeasures);
1845  break;
1846  case ControlPoint::SurfacePointSource::Reference:
1847  protoPoint.set_apriorisurfpointsource(
1848  ControlPointFileEntryV0002_AprioriSource_Reference);
1849  break;
1850  case ControlPoint::SurfacePointSource::Basemap:
1851  protoPoint.set_apriorisurfpointsource(ControlPointFileEntryV0002_AprioriSource_Basemap);
1852  break;
1853  case ControlPoint::SurfacePointSource::BundleSolution:
1854  protoPoint.set_apriorisurfpointsource(
1855  ControlPointFileEntryV0002_AprioriSource_BundleSolution);
1856  break;
1857  default:
1858  protoPoint.set_apriorisurfpointsource(ControlPointFileEntryV0002_AprioriSource_None);
1859  break;
1860  }
1861 
1862  // Apriori Radius Point Source ENUM setting
1863  switch ( controlPoint->GetAprioriRadiusSource() ) {
1864  case ControlPoint::RadiusSource::None:
1865  protoPoint.set_aprioriradiussource(ControlPointFileEntryV0002_AprioriSource_None);
1866  break;
1867  case ControlPoint::RadiusSource::User:
1868  protoPoint.set_aprioriradiussource(ControlPointFileEntryV0002_AprioriSource_User);
1869  break;
1870  case ControlPoint::RadiusSource::AverageOfMeasures:
1871  protoPoint.set_aprioriradiussource(
1872  ControlPointFileEntryV0002_AprioriSource_AverageOfMeasures);
1873  break;
1874  case ControlPoint::RadiusSource::BundleSolution:
1875  protoPoint.set_aprioriradiussource(
1876  ControlPointFileEntryV0002_AprioriSource_BundleSolution);
1877  break;
1878  case ControlPoint::RadiusSource::Ellipsoid:
1879  protoPoint.set_aprioriradiussource(ControlPointFileEntryV0002_AprioriSource_Ellipsoid);
1880  break;
1881  case ControlPoint::RadiusSource::DEM:
1882  protoPoint.set_aprioriradiussource(ControlPointFileEntryV0002_AprioriSource_DEM);
1883  break;
1884  default:
1885  protoPoint.set_aprioriradiussource(ControlPointFileEntryV0002_AprioriSource_None);
1886  break;
1887  }
1888 
1889  if ( controlPoint->HasAprioriRadiusSourceFile() ) {
1890  protoPoint.set_aprioriradiussourcefile(
1891  controlPoint->GetAprioriRadiusSourceFile().toLatin1().data());
1892  }
1893 
1894  SurfacePoint aprioriSurfacePoint = controlPoint->GetAprioriSurfacePoint();
1895  if ( aprioriSurfacePoint.Valid() ) {
1896  protoPoint.set_apriorix(aprioriSurfacePoint.GetX().meters());
1897  protoPoint.set_aprioriy(aprioriSurfacePoint.GetY().meters());
1898  protoPoint.set_aprioriz(aprioriSurfacePoint.GetZ().meters());
1899 
1900  symmetric_matrix<double, upper> aprioriCovarianceMatrix =
1901  aprioriSurfacePoint.GetRectangularMatrix();
1902  if ( aprioriCovarianceMatrix.size1() > 0 &&
1903  aprioriSurfacePoint.GetLatSigmaDistance().meters() != Isis::Null &&
1904  aprioriSurfacePoint.GetLonSigmaDistance().meters() != Isis::Null &&
1905  aprioriSurfacePoint.GetLocalRadiusSigma().meters() != Isis::Null ) {
1906 
1907  protoPoint.add_aprioricovar(aprioriCovarianceMatrix(0, 0));
1908  protoPoint.add_aprioricovar(aprioriCovarianceMatrix(0, 1));
1909  protoPoint.add_aprioricovar(aprioriCovarianceMatrix(0, 2));
1910  protoPoint.add_aprioricovar(aprioriCovarianceMatrix(1, 1));
1911  protoPoint.add_aprioricovar(aprioriCovarianceMatrix(1, 2));
1912  protoPoint.add_aprioricovar(aprioriCovarianceMatrix(2, 2));
1913  }
1914  }
1915  // this might be redundant... determined by covariance matrix???
1916  // *** TODO *** Address the generalized coordinates and the constraint differences
1917  if ( controlPoint->IsCoord1Constrained() ) {
1918  protoPoint.set_latitudeconstrained(controlPoint->IsCoord1Constrained());
1919  }
1920  if ( controlPoint->IsCoord2Constrained() ) {
1921  protoPoint.set_longitudeconstrained(controlPoint->IsCoord2Constrained());
1922  }
1923  if ( controlPoint->IsCoord3Constrained() ) {
1924  protoPoint.set_radiusconstrained(controlPoint->IsCoord3Constrained());
1925  }
1926 
1927  SurfacePoint adjustedSurfacePoint = controlPoint->GetAdjustedSurfacePoint();
1928  if ( adjustedSurfacePoint.Valid() ) {
1929 
1930  protoPoint.set_adjustedx(adjustedSurfacePoint.GetX().meters());
1931  protoPoint.set_adjustedy(adjustedSurfacePoint.GetY().meters());
1932  protoPoint.set_adjustedz(adjustedSurfacePoint.GetZ().meters());
1933 
1934  symmetric_matrix<double, upper> adjustedCovarianceMatrix =
1935  adjustedSurfacePoint.GetRectangularMatrix();
1936  if ( adjustedCovarianceMatrix.size1() > 0 ) {
1937  protoPoint.add_adjustedcovar(adjustedCovarianceMatrix(0, 0));
1938  protoPoint.add_adjustedcovar(adjustedCovarianceMatrix(0, 1));
1939  protoPoint.add_adjustedcovar(adjustedCovarianceMatrix(0, 2));
1940  protoPoint.add_adjustedcovar(adjustedCovarianceMatrix(1, 1));
1941  protoPoint.add_adjustedcovar(adjustedCovarianceMatrix(1, 2));
1942  protoPoint.add_adjustedcovar(adjustedCovarianceMatrix(2, 2));
1943  }
1944  }
1945 
1946  // Converting Measures
1947  for (int j = 0; j < controlPoint->GetNumMeasures(); j++) {
1948 
1949  const ControlMeasure &controlMeasure = *controlPoint->GetMeasure(j);
1950 
1951  ControlPointFileEntryV0002_Measure protoMeasure;
1952 
1953  protoMeasure.set_serialnumber(controlMeasure.GetCubeSerialNumber().toLatin1().data());
1954 
1955  switch ( controlMeasure.GetType() ) {
1957  protoMeasure.set_type(ControlPointFileEntryV0002_Measure_MeasureType_Candidate);
1958  break;
1959 
1960  case (ControlMeasure::Manual):
1961  protoMeasure.set_type(ControlPointFileEntryV0002_Measure_MeasureType_Manual);
1962  break;
1963 
1965  protoMeasure.set_type(
1966  ControlPointFileEntryV0002_Measure_MeasureType_RegisteredPixel);
1967  break;
1968 
1970  protoMeasure.set_type(
1971  ControlPointFileEntryV0002_Measure_MeasureType_RegisteredSubPixel);
1972  break;
1973  }
1974 
1975  if (QString::compare(controlMeasure.GetChooserName(), "Null", Qt::CaseInsensitive) != 0) {
1976  protoMeasure.set_choosername(controlMeasure.GetChooserName().toLatin1().data());
1977  }
1978 
1979  if (QString::compare(controlMeasure.GetDateTime(), "Null", Qt::CaseInsensitive) != 0) {
1980  protoMeasure.set_datetime(controlMeasure.GetDateTime().toLatin1().data());
1981  }
1982 
1983  if ( controlMeasure.IsEditLocked() ) {
1984  protoMeasure.set_editlock(true);
1985  }
1986 
1987  if ( controlMeasure.IsIgnored() ) {
1988  protoMeasure.set_ignore(true);
1989  }
1990 
1991  if ( controlMeasure.IsRejected() ) {
1992  protoMeasure.set_jigsawrejected(true);
1993  }
1994 
1995  if ( controlMeasure.GetSample() != Isis::Null ) {
1996  protoMeasure.set_sample(controlMeasure.GetSample());
1997  }
1998 
1999  if ( controlMeasure.GetLine() != Isis::Null ) {
2000  protoMeasure.set_line(controlMeasure.GetLine());
2001  }
2002 
2003  if ( controlMeasure.GetDiameter() != Isis::Null ) {
2004  protoMeasure.set_diameter(controlMeasure.GetDiameter());
2005  }
2006 
2007  if ( controlMeasure.GetAprioriSample() != Isis::Null ) {
2008  protoMeasure.set_apriorisample(controlMeasure.GetAprioriSample());
2009  }
2010 
2011  if ( controlMeasure.GetAprioriLine() != Isis::Null ) {
2012  protoMeasure.set_aprioriline(controlMeasure.GetAprioriLine());
2013  }
2014 
2015  if ( controlMeasure.GetSampleSigma() != Isis::Null ) {
2016  protoMeasure.set_samplesigma(controlMeasure.GetSampleSigma());
2017  }
2018 
2019  if ( controlMeasure.GetLineSigma() != Isis::Null ) {
2020  protoMeasure.set_linesigma(controlMeasure.GetLineSigma());
2021  }
2022 
2023  if ( controlMeasure.GetSampleResidual() != Isis::Null ) {
2024  protoMeasure.set_sampleresidual(controlMeasure.GetSampleResidual());
2025  }
2026 
2027  if ( controlMeasure.GetLineResidual() != Isis::Null ) {
2028  protoMeasure.set_lineresidual(controlMeasure.GetLineResidual());
2029  }
2030 
2031  if ( controlMeasure.IsRejected() ) {
2032  protoMeasure.set_jigsawrejected(true);
2033  }
2034 
2035  QVector<ControlMeasureLogData> measureLogs = controlMeasure.GetLogDataEntries();
2036  for (int logEntry = 0; logEntry < measureLogs.size(); logEntry ++) {
2037 
2038  const ControlMeasureLogData &log = measureLogs[logEntry];
2039 
2040  ControlPointFileEntryV0002_Measure_MeasureLogData logData;
2041 
2042  if ( log.IsValid() ) {
2043  logData.set_doubledatatype( (int) log.GetDataType() );
2044  logData.set_doubledatavalue( log.GetNumericalValue() );
2045  }
2046 
2047  *protoMeasure.add_log() = logData;
2048  }
2049 
2050  *protoPoint.add_measures() = protoMeasure;
2051  }
2052 
2053  uint32_t byteSize = protoPoint.ByteSize();
2054 
2055  Isis::EndianSwapper lsb("LSB");
2056  byteSize = lsb.Uint32_t(&byteSize);
2057 
2058  output->write(reinterpret_cast<char *>(&byteSize), sizeof(byteSize));
2059 
2060  if ( !protoPoint.SerializeToOstream(output) ) {
2061  QString err = "Error writing to coded protobuf stream";
2062  throw IException(IException::Programmer, err, _FILEINFO_);
2063  }
2064 
2065  // Make sure that if the versioner owns the ControlPoint it is properly cleaned up.
2066  if ( m_ownsPoints ) {
2067  delete controlPoint;
2068  controlPoint = NULL;
2069  }
2070  BigInt currentPos = output->tellp();
2071  BigInt byteCount = currentPos - startPos;
2072 
2073  // return size of message
2074  return byteCount;
2075  }
2076 }
Isis::PvlObject::clear
void clear()
Remove everything from the current PvlObject.
Definition: PvlObject.h:341
Isis::ControlMeasure::RegisteredPixel
@ RegisteredPixel
Registered to whole pixel (e.g.,pointreg)
Definition: ControlMeasure.h:212
Isis::ControlNetVersioner::creationDate
QString creationDate() const
Returns the date and time that the network was created.
Definition: ControlNetVersioner.cpp:134
Isis::ControlMeasure::RegisteredSubPixel
@ RegisteredSubPixel
Registered to sub-pixel (e.g., pointreg)
Definition: ControlMeasure.h:214
Isis::PvlObject::findGroup
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:129
Isis::IException::Io
@ Io
A type of error that occurred when performing an actual I/O operation.
Definition: IException.h:155
Isis::ControlNetVersioner::m_header
ControlNetHeaderV0005 m_header
Header containing information about the whole network.
Definition: ControlNetVersioner.h:516
Isis::ControlNetVersioner::readProtobufV0002
void readProtobufV0002(const Pvl &header, const FileName netFile, Progress *progress=NULL)
Read a protobuf version 2 control network and prepare the data to be converted into a control network...
Definition: ControlNetVersioner.cpp:1035
Isis::PvlObject
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:61
Isis::ControlNetVersioner::createHeader
void createHeader(const ControlNetHeaderV0001 header)
Create the internal header from a V0001 header.
Definition: ControlNetVersioner.cpp:1644
Isis::Displacement::Meters
@ Meters
The distance is being specified in meters.
Definition: Displacement.h:40
Isis::ControlPoint::SetAprioriRadiusSourceFile
Status SetAprioriRadiusSourceFile(QString sourceFile)
This updates the filename of the DEM that the apriori radius came from.
Definition: ControlPoint.cpp:755
Isis::ControlPoint::IsCoord3Constrained
bool IsCoord3Constrained()
Return bool indicating if 3rd coordinate is Constrained or not.
Definition: ControlPoint.cpp:1651
Isis::ControlPointV0003::pointData
const ControlPointFileEntryV0002 & pointData()
Access the protobuf control point data.
Definition: ControlPointV0003.cpp:561
Isis::ControlNetVersioner::readPvlV0001
void readPvlV0001(const PvlObject &network, Progress *progress=NULL)
read a version 1 Pvl control network and convert the data into control points.
Definition: ControlNetVersioner.cpp:621
Isis::Progress::CheckStatus
void CheckStatus()
Checks and updates the status.
Definition: Progress.cpp:105
Isis::PvlKeyword
A single keyword-value pair.
Definition: PvlKeyword.h:82
Isis::ControlNetVersioner::readPvlV0005
void readPvlV0005(const PvlObject &network, Progress *progress=NULL)
read a version 5 Pvl control network and convert the data into control points.
Definition: ControlNetVersioner.cpp:824
Isis::ControlPoint::GetMeasure
const ControlMeasure * GetMeasure(QString serialNumber) const
Get a control measure based on its cube's serial number.
Definition: ControlPoint.cpp:416
Isis::ControlMeasureLogData::GetNumericalValue
double GetNumericalValue() const
Get the value associated with this log data.
Definition: ControlMeasureLogData.cpp:123
Isis::ControlPoint::SetIgnored
Status SetIgnored(bool newIgnoreStatus)
Set whether to ignore or use control point.
Definition: ControlPoint.cpp:653
Isis::ControlNet::GetUserName
QString GetUserName() const
Return the user name.
Definition: ControlNet.cpp:1513
Isis::ControlMeasure::SetCubeSerialNumber
Status SetCubeSerialNumber(QString newSerialNumber)
Set cube serial number.
Definition: ControlMeasure.cpp:187
Isis::ControlMeasure::SetLogData
void SetLogData(ControlMeasureLogData)
This adds or updates the log data information associated with data's type.
Definition: ControlMeasure.cpp:435
Isis::ControlPoint::SetChooserName
Status SetChooserName(QString name)
Set the point's chooser name.
Definition: ControlPoint.cpp:487
Isis::ControlPointV0002
A container for the information stored in a version 2 ControlPoint.
Definition: ControlPointV0002.h:154
Isis::FileName::name
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
Definition: FileName.cpp:162
Isis::EndianSwapper::Uint32_t
uint32_t Uint32_t(void *buf)
Swaps a 32bit unsigned integer.
Definition: EndianSwapper.cpp:130
Isis::SurfacePoint::GetLonSigmaDistance
Distance GetLonSigmaDistance() const
Return the longitude sigma in meters.
Definition: SurfacePoint.cpp:1763
Isis::ControlNetVersioner::readPvl
void readPvl(const Pvl &network, Progress *progress=NULL)
Read a Pvl control network and prepare the data to be converted into a control network.
Definition: ControlNetVersioner.cpp:582
Isis::ControlMeasure::MeasureType
MeasureType
Control network measurement types.
Definition: ControlMeasure.h:206
Isis::PvlContainer::addKeyword
void addKeyword(const PvlKeyword &keyword, const InsertMode mode=Append)
Add a keyword to the container.
Definition: PvlContainer.cpp:202
Isis::ControlPoint::SetEditLock
Status SetEditLock(bool editLock)
Set the EditLock state.
Definition: ControlPoint.cpp:522
Isis::FileName
File name manipulation and expansion.
Definition: FileName.h:100
Isis::Progress::SetMaximumSteps
void SetMaximumSteps(const int steps)
This sets the maximum number of steps in the process.
Definition: Progress.cpp:85
Isis::IException::Unknown
@ Unknown
A type of error that cannot be classified as any of the other error types.
Definition: IException.h:118
Isis::ControlNetVersioner::ControlNetHeaderV0001::description
QString description
The text description of the control network.
Definition: ControlNetVersioner.h:472
Isis::ControlPoint::HasAprioriRadiusSourceFile
bool HasAprioriRadiusSourceFile() const
Checks to see if the radius source file has been set.
Definition: ControlPoint.cpp:1671
Isis::ControlNet::Description
QString Description() const
Return the description of the network.
Definition: ControlNet.cpp:1254
Isis::ControlMeasureLogData::GetDataType
NumericLogDataType GetDataType() const
Get the data type associated with this log data.
Definition: ControlMeasureLogData.cpp:135
Isis::ControlNetVersioner::readProtobufV0001
void readProtobufV0001(const Pvl &header, const FileName netFile, Progress *progress=NULL)
Read a protobuf version 1 control network and prepare the data to be converted into a control network...
Definition: ControlNetVersioner.cpp:912
Isis::ControlPoint::SetAdjustedSurfacePoint
Status SetAdjustedSurfacePoint(SurfacePoint newSurfacePoint)
Set or update the surface point relating to this control point.
Definition: ControlPoint.cpp:692
Isis::SurfacePoint::GetLatSigmaDistance
Distance GetLatSigmaDistance() const
Return the latitude sigma as a Distance.
Definition: SurfacePoint.cpp:1747
Isis::ControlMeasureLogData::SetNumericalValue
void SetNumericalValue(double value)
This updates the value associated with a NumericLogDataType.
Definition: ControlMeasureLogData.cpp:100
Isis::ControlNetVersioner::takeFirstPoint
ControlPoint * takeFirstPoint()
Returns the first point stored in the versioner's internal list.
Definition: ControlNetVersioner.cpp:187
Isis::ControlMeasureLogData::NumericLogDataType
NumericLogDataType
Please do not change existing values in this list except the size - it will break backwards compadibi...
Definition: ControlMeasureLogData.h:49
Isis::ControlMeasure::SetResidual
Status SetResidual(double sampResidual, double lineResidual)
Set the BundleAdjust Residual of the coordinate.
Definition: ControlMeasure.cpp:399
Isis::PvlObject::hasGroup
bool hasGroup(const QString &name) const
Returns a boolean value based on whether the object has the specified group or not.
Definition: PvlObject.h:210
Isis::SurfacePoint::SetRectangularMatrix
void SetRectangularMatrix(const boost::numeric::ublas::symmetric_matrix< double, boost::numeric::ublas::upper > &covar, SurfacePoint::CoordUnits units=SurfacePoint::Meters)
Set rectangular covariance matrix and store in units of km**2.
Definition: SurfacePoint.cpp:376
Isis::PvlContainer::hasKeyword
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
Definition: PvlContainer.cpp:159
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::ControlPoint::PointType
PointType
These are the valid 'types' of point.
Definition: ControlPoint.h:364
Isis::ControlMeasureLogData::ToKeyword
PvlKeyword ToKeyword() const
This converts the log data to a PvlKeyword.
Definition: ControlMeasureLogData.cpp:166
Isis::PvlObject::objects
int objects() const
Returns the number of objects.
Definition: PvlObject.h:219
Isis::PvlObject::addObject
void addObject(const PvlObject &object)
Add a PvlObject.
Definition: PvlObject.h:307
Isis::SurfacePoint::GetLatitude
Latitude GetLatitude() const
Return the body-fixed latitude for the surface point.
Definition: SurfacePoint.cpp:1665
Isis::ControlPoint::HasAprioriSurfacePointSourceFile
bool HasAprioriSurfacePointSourceFile() const
Checks to see if the surface point source file has been set.
Definition: ControlPoint.cpp:1692
Isis::ControlPoint::GetId
QString GetId() const
Return the Id of the control point.
Definition: ControlPoint.cpp:1306
Isis::ControlNetVersioner::readProtobuf
void readProtobuf(const Pvl &header, const FileName netFile, Progress *progress=NULL)
Read a protobuf control network and prepare the data to be converted into a control network.
Definition: ControlNetVersioner.cpp:875
Isis::ControlNet::GetTarget
QString GetTarget() const
Return the target name.
Definition: ControlNet.cpp:1507
QSharedPointer< ControlNetFileProtoV0001_PBControlPoint >
Isis::ControlMeasure::Candidate
@ Candidate
(e.g., autoseed, interest) AKA predicted, unmeasured, unverified
Definition: ControlMeasure.h:208
Isis::ControlMeasure::GetDateTime
QString GetDateTime() const
Return the date/time the coordinate was last changed.
Definition: ControlMeasure.cpp:563
Isis::PvlObject::object
PvlObject & object(const int index)
Return the object at the specified index.
Definition: PvlObject.cpp:489
Isis::ControlMeasure::SetDateTime
Status SetDateTime()
Date Time - Creation Time.
Definition: ControlMeasure.cpp:247
Isis::ControlPoint::SetAprioriSurfacePointSourceFile
Status SetAprioriSurfacePointSourceFile(QString sourceFile)
This updates the filename of where the apriori surface point came from.
Definition: ControlPoint.cpp:839
Isis::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
Isis::ControlNetVersioner::ControlNetVersioner
ControlNetVersioner()
Default constructor. Intentially un-implemented.
Isis::ControlNetVersioner::ControlNetHeaderV0001::userName
QString userName
The name of the user or program that last modified the control network.
Definition: ControlNetVersioner.h:474
Isis::ControlMeasure::SetRejected
Status SetRejected(bool rejected)
Set "jigsaw" rejected flag for a measure.
Definition: ControlMeasure.cpp:343
Isis::ControlMeasureLogData::IsValid
bool IsValid() const
This tests if the log data is complete and valid.
Definition: ControlMeasureLogData.cpp:154
Isis::ControlNet::CreatedDate
QString CreatedDate() const
Return the Created Date.
Definition: ControlNet.cpp:1244
Isis::ControlNetVersioner::~ControlNetVersioner
~ControlNetVersioner()
Destroy a ControlNetVersioner.
Definition: ControlNetVersioner.cpp:98
Isis::Displacement
Displacement is a signed length, usually in meters.
Definition: Displacement.h:31
Isis::ControlMeasure::GetCubeSerialNumber
QString GetCubeSerialNumber() const
Return the serial number of the cube containing the coordinate.
Definition: ControlMeasure.cpp:557
Isis::ControlPoint
A single control point.
Definition: ControlPoint.h:354
Isis::ControlPoint::Fixed
@ Fixed
A Fixed point is a Control Point whose lat/lon is well established and should not be changed.
Definition: ControlPoint.h:371
Isis::ControlPoint::IsCoord2Constrained
bool IsCoord2Constrained()
Return bool indicating if 2nd coordinate is Constrained or not.
Definition: ControlPoint.cpp:1641
Isis::FileName::expanded
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
Definition: FileName.cpp:196
Isis::Displacement::meters
double meters() const
Get the displacement in meters.
Definition: Displacement.cpp:73
Isis::ControlPoint::SetRefMeasure
Status SetRefMeasure(ControlMeasure *cm)
Set the point's reference measure.
Definition: ControlPoint.cpp:570
Isis::PvlGroup
Contains multiple PvlContainers.
Definition: PvlGroup.h:41
Isis::ControlNetVersioner::writeFirstPoint
int writeFirstPoint(std::fstream *output)
This will write the first control point to a file stream.
Definition: ControlNetVersioner.cpp:1774
Isis::ControlNetVersioner::description
QString description() const
Returns the network's description.
Definition: ControlNetVersioner.cpp:154
Isis::ControlNet::GetPoints
QList< ControlPoint * > GetPoints()
Return QList of all the ControlPoints in the network.
Definition: ControlNet.cpp:1524
Isis::ControlPoint::SetAprioriSurfacePoint
Status SetAprioriSurfacePoint(SurfacePoint aprioriSP)
This updates the apriori surface point.
Definition: ControlPoint.cpp:779
Isis::ControlPoint::SetType
Status SetType(PointType newType)
Updates the control point's type.
Definition: ControlPoint.cpp:709
Isis::ControlNetVersioner::read
void read(const FileName netFile, Progress *progress=NULL)
Read a control network file and prepare the data to be converted into a control network.
Definition: ControlNetVersioner.cpp:551
Isis::toInt
int toInt(const QString &string)
Global function to convert from a string to an integer.
Definition: IString.cpp:93
Isis::ControlNetVersioner::ControlNetHeaderV0001::created
QString created
The date and time of the control network's creation.
Definition: ControlNetVersioner.h:468
Isis::ControlMeasure::Manual
@ Manual
Hand Measured (e.g., qnet)
Definition: ControlMeasure.h:210
Isis::ControlPoint::SetId
Status SetId(QString id)
Sets the Id of the control point.
Definition: ControlPoint.cpp:552
Isis::ControlPoint::Constrained
@ Constrained
A Constrained point is a Control Point whose lat/lon/radius is somewhat established and should not be...
Definition: ControlPoint.h:376
Isis::ControlNetVersioner::readPvlV0004
void readPvlV0004(const PvlObject &network, Progress *progress=NULL)
read a version 4 Pvl control network and convert the data into control points.
Definition: ControlNetVersioner.cpp:775
Isis::Progress::SetText
void SetText(const QString &text)
Changes the value of the text string reported just before 0% processed.
Definition: Progress.cpp:61
Isis::ControlNetVersioner::userName
QString userName() const
Returns the name of the last person or program to modify the network.
Definition: ControlNetVersioner.cpp:164
Isis::ControlNetVersioner::netId
QString netId() const
Returns the ID for the network.
Definition: ControlNetVersioner.cpp:114
Isis::PvlObject::hasKeyword
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:236
Isis::ControlMeasure::SetChooserName
Status SetChooserName()
Set chooser name to a user who last changed the coordinate.
Definition: ControlMeasure.cpp:196
Isis::ControlNetVersioner::readPvlV0002
void readPvlV0002(const PvlObject &network, Progress *progress=NULL)
read a version 2 Pvl control network and convert the data into control points.
Definition: ControlNetVersioner.cpp:674
Isis::PvlKeyword::addComment
void addComment(QString comment)
Add a comment to the PvlKeyword.
Definition: PvlKeyword.cpp:376
Isis::ControlPoint::SetDateTime
Status SetDateTime(QString newDateTime)
Set the point's last modified time.
Definition: ControlPoint.cpp:504
Isis::BigInt
long long int BigInt
Big int.
Definition: Constants.h:49
Isis::ControlPoint::HasRefMeasure
bool HasRefMeasure() const
Checks to see if a reference measure is set.
Definition: ControlPoint.cpp:447
Isis::ControlMeasure::IsEditLocked
bool IsEditLocked() const
Return value for p_editLock or implicit lock on reference measure.
Definition: ControlMeasure.cpp:601
Isis::PvlObject::findObject
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
Definition: PvlObject.h:274
Isis::ControlPoint::IndexOfRefMeasure
int IndexOfRefMeasure() const
Definition: ControlPoint.cpp:1817
Isis::ControlMeasure::GetDiameter
double GetDiameter() const
Return the diameter of the crater in pixels (0 implies no crater)
Definition: ControlMeasure.cpp:580
Isis::ControlMeasure::SetDiameter
Status SetDiameter(double diameter)
Set the crater diameter at the coordinate.
Definition: ControlMeasure.cpp:272
Isis::ControlNet
a control network
Definition: ControlNet.h:257
Isis::ControlNetVersioner::ControlNetHeaderV0001::lastModified
QString lastModified
The date and time of the control network's last modification.
Definition: ControlNetVersioner.h:470
Isis::ControlPointV0003
A container for the information stored in a version 3 and 4 ControlPoint.
Definition: ControlPointV0003.h:160
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::ControlNetVersioner::targetName
QString targetName() const
Returns the target for the network.
Definition: ControlNetVersioner.cpp:124
Isis::ControlNetVersioner::ControlNetHeaderV0001::networkID
QString networkID
The ID/Name of the control network.
Definition: ControlNetVersioner.h:464
Isis::ControlNetVersioner::ControlNetHeaderV0001::targetName
QString targetName
The NAIF name of the target body.
Definition: ControlNetVersioner.h:466
Isis::ControlNetVersioner::readPvlV0003
void readPvlV0003(const PvlObject &network, Progress *progress=NULL)
read a version 3 Pvl control network and convert the data into control points.
Definition: ControlNetVersioner.cpp:725
Isis::ControlNetVersioner::ControlNetHeaderV0001
Versioned container for general information about a control network.
Definition: ControlNetVersioner.h:462
Isis::Progress
Program progress reporter.
Definition: Progress.h:42
Isis::ControlNetVersioner::createMeasure
ControlMeasure * createMeasure(const ControlPointFileEntryV0002_Measure &)
Create a pointer to a ControlMeasure from a V0006 file.
Definition: ControlNetVersioner.cpp:1547
Isis::SurfacePoint::GetLongitude
Longitude GetLongitude() const
Return the body-fixed longitude for the surface point.
Definition: SurfacePoint.cpp:1685
Isis::PvlObject::hasObject
bool hasObject(const QString &name) const
Returns a boolean value based on whether the object exists in the current PvlObject or not.
Definition: PvlObject.h:323
Isis::ControlNetVersioner::numPoints
int numPoints() const
Returns the number of points that have been read in or are ready to write out.
Definition: ControlNetVersioner.cpp:174
Isis::Null
const double Null
Value for an Isis Null pixel.
Definition: SpecialPixel.h:95
Isis::PvlObject::addGroup
void addGroup(const Isis::PvlGroup &group)
Add a group to the object.
Definition: PvlObject.h:186
Isis::ControlMeasure::GetLogDataEntries
QVector< ControlMeasureLogData > GetLogDataEntries() const
Return all of the log data for the measure.
Definition: ControlMeasure.cpp:796
Isis::ControlMeasureLogData::SetDataType
void SetDataType(NumericLogDataType newDataType)
This changes the type of this log data.
Definition: ControlMeasureLogData.cpp:111
Isis::SurfacePoint::GetLocalRadius
Distance GetLocalRadius() const
Return the radius of the surface point.
Definition: SurfacePoint.cpp:1732
Isis::IException::Programmer
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:146
Isis::ControlPoint::IsCoord1Constrained
bool IsCoord1Constrained()
Return bool indicating if 1st coordinate is Constrained or not.
Definition: ControlPoint.cpp:1630
std
Namespace for the standard library.
Isis::ControlNetVersioner::readProtobufV0005
void readProtobufV0005(const Pvl &header, const FileName netFile, Progress *progress=NULL)
Read a protobuf version 5 control network and prepare the data to be converted into a control network...
Definition: ControlNetVersioner.cpp:1154
Isis::ControlNetVersioner::write
void write(FileName netFile)
This will write a control net file object to disk.
Definition: ControlNetVersioner.cpp:1659
Isis::ControlNetVersioner::writeHeader
void writeHeader(std::fstream *output)
This will read the binary protobuffer control network header to an fstream.
Definition: ControlNetVersioner.cpp:1745
Isis::ControlNetVersioner::toPvl
Pvl toPvl()
Generates a Pvl file from the currently stored control points and header.
Definition: ControlNetVersioner.cpp:202
Isis::ControlPoint::Free
@ Free
A Free point is a Control Point that identifies common measurements between two or more cubes.
Definition: ControlPoint.h:384
Isis::EndianSwapper
Byte swapper.
Definition: EndianSwapper.h:38
Isis::Distance::meters
double meters() const
Get the distance in meters.
Definition: Distance.cpp:85
Isis::Angle::degrees
double degrees() const
Get the angle in units of Degrees.
Definition: Angle.h:232
Isis::ControlNetVersioner::createPoint
ControlPoint * createPoint(ControlPointV0001 &point)
Create a pointer to a latest version ControlPoint from an object in a V0001 control net file.
Definition: ControlNetVersioner.cpp:1308
Isis::ControlPoint::GetType
PointType GetType() const
Definition: ControlPoint.cpp:1401
Isis::ControlPoint::SetRejected
Status SetRejected(bool rejected)
Set the jigsawRejected state.
Definition: ControlPoint.cpp:539
Isis::PvlObject::findKeyword
PvlKeyword & findKeyword(const QString &kname, FindOptions opts)
Finds a keyword in the current PvlObject, or deeper inside other PvlObjects and Pvlgroups within this...
Definition: PvlObject.cpp:177
Isis::ControlMeasure::SetType
Status SetType(MeasureType type)
Set how the coordinate was obtained.
Definition: ControlMeasure.cpp:420
Isis::ControlPoint::SetAprioriSurfacePointSource
Status SetAprioriSurfacePointSource(SurfacePointSource::Source source)
This updates the source of the surface point.
Definition: ControlPoint.cpp:821
Isis::ControlNetVersioner::m_ownsPoints
bool m_ownsPoints
Flag if the versioner owns the control points stored in it.
Definition: ControlNetVersioner.h:520
QVector
This is free and unencumbered software released into the public domain.
Definition: Calculator.h:18
Isis::ControlMeasure::GetChooserName
QString GetChooserName() const
Return the chooser name.
Definition: ControlMeasure.cpp:542
Isis::ControlPoint::IsReferenceExplicit
bool IsReferenceExplicit() const
Definition: ControlPoint.cpp:1755
Isis::ControlNetVersioner::lastModificationDate
QString lastModificationDate() const
Returns the date and time of the last modification to the network.
Definition: ControlNetVersioner.cpp:144
Isis::ControlMeasureLogData
Statistical and similar ControlMeasure associated information.
Definition: ControlMeasureLogData.h:37
Isis::ControlPoint::Add
void Add(ControlMeasure *measure)
Add a measurement to the control point, taking ownership of the measure in the process.
Definition: ControlPoint.cpp:223
Isis::ControlPointV0001
A container for the information stored in a version 1 ControlPoint.
Definition: ControlPointV0001.h:62
Isis::SurfacePoint
This class defines a body-fixed surface point.
Definition: SurfacePoint.h:132
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::ControlMeasure::SetCoordinate
Status SetCoordinate(double sample, double line)
Set the coordinate of the measurement.
Definition: ControlMeasure.cpp:219
Isis::ControlPoint::SetAprioriRadiusSource
Status SetAprioriRadiusSource(RadiusSource::Source source)
This updates the source of the radius of the apriori surface point.
Definition: ControlPoint.cpp:736
Isis::IException::User
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
Definition: IException.h:126
Isis::ControlNetVersioner::m_points
QList< ControlPoint * > m_points
ControlPoints that are read in from a file or ready to be written out to a file.
Definition: ControlNetVersioner.h:518
Isis::ControlNet::GetLastModified
QString GetLastModified() const
Return the last modified date.
Definition: ControlNet.cpp:1518
Isis::ControlMeasure
a control measurement
Definition: ControlMeasure.h:175