Commit 348f3688 authored by Adam Goins's avatar Adam Goins Committed by Makayla Shepherd
Browse files

Added checks to omit ChooserName and DateTime if they're empty or "Null".

Also modified the adjusted covariance matrix to only display if there's
valid values in it.
parent 24c83377
Loading
Loading
Loading
Loading
+45 −22
Original line number Diff line number Diff line
@@ -243,15 +243,13 @@ namespace Isis {
        pvlPoint += PvlKeyword("PointId", controlPoint->GetId());
      }
      if ( controlPoint->HasChooserName()
           && controlPoint->GetChooserName() != "Null" ) {
           && QString::compare(controlPoint->GetChooserName(), "Null", Qt::CaseInsensitive) != 0 ) {
        pvlPoint += PvlKeyword("ChooserName", controlPoint->GetChooserName());
      }
      if ( controlPoint->HasDateTime() ) {
      if ( controlPoint->HasDateTime()
           && QString::compare(controlPoint->GetDateTime(), "Null", Qt::CaseInsensitive) != 0 ) {
        pvlPoint += PvlKeyword("DateTime", controlPoint->GetDateTime());
      }
      else {
        pvlPoint += PvlKeyword("DateTime", "");
      }
      if ( controlPoint->IsEditLocked() ) {
        pvlPoint += PvlKeyword("EditLock", "True");
      }
@@ -370,7 +368,7 @@ namespace Isis {
               || aprioriCovarianceMatrix(0, 2) != 0.0
               || aprioriCovarianceMatrix(1, 1) != 0.0
               || aprioriCovarianceMatrix(1, 2) != 0.0
               || aprioriCovarianceMatrix(2, 2) ) {
               || aprioriCovarianceMatrix(2, 2) != 0.0 ) {

                 pvlPoint += matrix;
            }
@@ -411,7 +409,9 @@ namespace Isis {
        pvlPoint += adjustedZ;

        symmetric_matrix<double, upper> adjustedCovarianceMatrix = adjustedSurfacePoint.GetRectangularMatrix();

        if ( adjustedCovarianceMatrix.size1() > 0 ) {

          PvlKeyword matrix("AdjustedCovarianceMatrix");
          matrix += toString(adjustedCovarianceMatrix(0, 0));
          matrix += toString(adjustedCovarianceMatrix(0, 1));
@@ -420,12 +420,16 @@ namespace Isis {
          matrix += toString(adjustedCovarianceMatrix(1, 2));
          matrix += toString(adjustedCovarianceMatrix(2, 2));

          if ( pvlRadii.hasKeyword("EquatorialRadius")
               && pvlRadii.hasKeyword("PolarRadius") ) {
            adjustedSurfacePoint.SetRadii(
                  Distance(pvlRadii["EquatorialRadius"],Distance::Meters),
          if ( pvlRadii.hasKeyword("EquatorialRadius") && pvlRadii.hasKeyword("PolarRadius") ) {

            adjustedSurfacePoint.SetRadii( Distance(pvlRadii["EquatorialRadius"], Distance::Meters),
                                           Distance(pvlRadii["EquatorialRadius"], Distance::Meters),
                                           Distance(pvlRadii["PolarRadius"], Distance::Meters) );

            if ( adjustedSurfacePoint.GetLatSigmaDistance().meters() != Isis::Null
                 && adjustedSurfacePoint.GetLonSigmaDistance().meters() != Isis::Null
                 && adjustedSurfacePoint.GetLocalRadiusSigma().meters() != Isis::Null ) {

            QString sigmas = "AdjustedLatitudeSigma = "
                             + toString(adjustedSurfacePoint.GetLatSigmaDistance().meters())
                             + " <meters>  AdjustedLongitudeSigma = "
@@ -433,11 +437,22 @@ namespace Isis {
                             + " <meters>  AdjustedRadiusSigma = "
                             + toString(adjustedSurfacePoint.GetLocalRadiusSigma().meters())
                             + " <meters>";

            matrix.addComment(sigmas);
            }
          }
          // If the covariance matrix has a value, add it to the PVL point.
          if ( adjustedCovarianceMatrix(0, 0) != 0.0
               || adjustedCovarianceMatrix(0, 1) != 0.0
               || adjustedCovarianceMatrix(0, 2) != 0.0
               || adjustedCovarianceMatrix(1, 1) != 0.0
               || adjustedCovarianceMatrix(1, 2) != 0.0
               || adjustedCovarianceMatrix(2, 2) != 0.0 ) {

                 pvlPoint += matrix;
          }
        }
      }

      for (int j = 0; j < controlPoint->GetNumMeasures(); j++) {
        PvlGroup pvlMeasure("ControlMeasure");
@@ -460,10 +475,12 @@ namespace Isis {
            break;
        }

        if ( controlMeasure.HasChooserName() ) {
        if ( controlMeasure.HasChooserName()
             && QString::compare(controlMeasure.GetChooserName(), "Null", Qt::CaseInsensitive) != 0 ) {
          pvlMeasure += PvlKeyword("ChooserName", controlMeasure.GetChooserName());
        }
        if ( controlMeasure.HasDateTime() ) {
        if ( controlMeasure.HasDateTime()
             && QString::compare(controlMeasure.GetDateTime(), "Null", Qt::CaseInsensitive) != 0 ) {
          pvlMeasure += PvlKeyword("DateTime", controlMeasure.GetDateTime());
        }
        if ( controlMeasure.IsEditLocked() ) {
@@ -506,12 +523,14 @@ namespace Isis {
                                   "pixels");
        }

        if ( controlMeasure.GetSampleResidual() != Isis::Null ) {
        if ( controlMeasure.GetSampleResidual() != Isis::Null
             && controlMeasure.GetSampleResidual() != 0. ) {
          pvlMeasure += PvlKeyword("SampleResidual", toString(controlMeasure.GetSampleResidual()),
                                   "pixels");
        }

        if ( controlMeasure.GetLineResidual() != Isis::Null ) {
        if ( controlMeasure.GetLineResidual() != Isis::Null
             && controlMeasure.GetLineResidual() != 0. ) {
          pvlMeasure += PvlKeyword("LineResidual", toString(controlMeasure.GetLineResidual()),
                                   "pixels");
        }
@@ -1345,6 +1364,7 @@ namespace Isis {
      SurfacePoint aprioriSurfacePoint(Displacement(protoPoint.apriorix(), Displacement::Meters),
                                       Displacement(protoPoint.aprioriy(), Displacement::Meters),
                                       Displacement(protoPoint.aprioriz(), Displacement::Meters));

      if ( protoPoint.aprioricovar_size() > 0 ) {
        symmetric_matrix<double, upper> aprioriCovarianceMatrix;
        aprioriCovarianceMatrix.resize(3);
@@ -1670,10 +1690,11 @@ namespace Isis {
      }

      if ( controlPoint->HasChooserName()
           && controlPoint->GetChooserName() != "Null" ) {
           && QString::compare(controlPoint->GetChooserName(), "Null", Qt::CaseInsensitive) != 0 ) {
        protoPoint.set_choosername(controlPoint->GetChooserName().toLatin1().data());
      }
      if ( controlPoint->HasDateTime() ) {
      if ( controlPoint->HasDateTime()
           && QString::compare(controlPoint->GetDateTime(), "Null", Qt::CaseInsensitive) != 0 ) {
        protoPoint.set_datetime(controlPoint->GetDateTime().toLatin1().data());
      }
      if ( controlPoint->IsEditLocked() ) {
@@ -1856,11 +1877,13 @@ namespace Isis {
                break;
        }

        if ( controlMeasure.HasChooserName() ) {
        if ( controlMeasure.HasChooserName()
             && QString::compare(controlMeasure.GetChooserName(), "Null", Qt::CaseInsensitive) != 0 ) {
          protoMeasure.set_choosername(controlMeasure.GetChooserName().toLatin1().data());
        }

        if ( controlMeasure.HasDateTime() ) {
        if ( controlMeasure.HasDateTime()
             && QString::compare(controlMeasure.GetDateTime(), "Null", Qt::CaseInsensitive) != 0 ) {
          protoMeasure.set_datetime(controlMeasure.GetDateTime().toLatin1().data());
        }