Commit 318ae444 authored by Jeannie Backer's avatar Jeannie Backer Committed by Makayla Shepherd
Browse files

First changes for cnet truth data fixes.

parent be7d8487
Loading
Loading
Loading
Loading
+7 −9
Original line number Diff line number Diff line
#include "ControlNetVersioner.h"

#include <string>

#include <QString>
#include <QTime>

@@ -20,13 +18,13 @@ void TestNetwork(const QString &filename, bool printNetwork = true, bool pvlInpu
int main(int argc, char *argv[]) {
  Preference::Preferences(true);
  cerr << "Test ControlNetVersioner" << endl;
  TestNetwork("./reallyOldNetwork.net"); // No target
  TestNetwork("./reallyOldNetwork2.net"); // Really odd keywords with target
  TestNetwork("./oldNetwork.net"); // Another set of odd keywords
  TestNetwork("./oldNetwork2.net"); // Binary V1
  TestNetwork("./badNetwork.net"); // Corrupted (based off of oldNetwork2.net)
  TestNetwork("./semilarge.net", false);
  TestNetwork("./smallPvlTest.pvl", true, true); // network with rejected jigsaw points
  TestNetwork("$control/unitTest_ControlNetVersioner_reallyOldNetwork.net"); // No target
  TestNetwork("$control/unitTest_ControlNetVersioner_reallyOldNetwork2.net"); // Really odd keywords with target
  TestNetwork("$control/unitTest_ControlNetVersioner_oldNetwork.net"); // Another set of odd keywords
  TestNetwork("$control/unitTest_ControlNetVersioner_oldNetwork2.net"); // Binary V1
  TestNetwork("$control/unitTest_ControlNetVersioner_badNetwork.net"); // Corrupted (based off of oldNetwork2.net)
  TestNetwork("$control/unitTest_ControlNetVersioner_semilarge.net", false);
  TestNetwork("$control/unitTest_ControlNetVersioner_smallPvlTest.pvl", true, true); // network with rejected jigsaw points
}

void TestNetwork(const QString &filename, bool printNetwork, bool pvlInput) {
+11 −94
Original line number Diff line number Diff line
@@ -234,7 +234,7 @@ namespace Isis {
    }

    if (!measures->size()) {
      ASSERT(referenceMeasure == NULL);
      ASSERT(!HasRefMeasure());
      referenceMeasure = measure;
    }
    else if (referenceMeasure->IsIgnored() && !measure->IsIgnored() &&
@@ -428,7 +428,7 @@ namespace Isis {
   * @returns const reference measure for this point
   */
  const ControlMeasure *ControlPoint::GetRefMeasure() const {
    if (referenceMeasure == NULL) {
    if (!HasRefMeasure()) {
      QString msg = "Control point [" + GetId() + "] has no reference measure!";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }
@@ -441,7 +441,7 @@ namespace Isis {
   * Get the measure that is the reference directly.
   */
  ControlMeasure *ControlPoint::GetRefMeasure() {
    if (referenceMeasure == NULL) {
    if (!HasRefMeasure()) {
      QString msg = "Control point [" + GetId() + "] has no reference measure!";
      throw IException(IException::Programmer, msg, _FILEINFO_);
    }
@@ -1208,36 +1208,6 @@ namespace Isis {
  }


  /**
   * Gets the adjusted x coordinate.
   *
   * @return Displacement The adjusted x coordinate.
   */
  Displacement ControlPoint::GetAdjustedX() const {
    return adjustedSurfacePoint.GetX();
  }


  /**
   * Gets the adjusted y coordinate.
   *
   * @return Displacement The adjusted y coordinate.
   */
  Displacement ControlPoint::GetAdjustedY() const {
    return adjustedSurfacePoint.GetY();
  }


  /**
   * Gets the adjusted z coordinate.
   *
   * @return Displacement The adjusted z coordinate.
   */
  Displacement ControlPoint::GetAdjustedZ() const {
    return adjustedSurfacePoint.GetZ();
  }


  /**
   * Returns the adjusted surface point if it exists, otherwise returns
   * the a priori surface point.
@@ -1520,65 +1490,12 @@ namespace Isis {
    return aprioriSurfacePoint;
  }

  /**
   * Gets the apriori x coordinate.
   *
   * @return Displacement The apriori x coordinate.
   */
  Displacement ControlPoint::GetAprioriX() const {
    return aprioriSurfacePoint.GetX();
  }


  /**
   * Gets the apriori y coordinate.
   *
   * @return Displacement The apriori y coordinate.
   */
  Displacement ControlPoint::GetAprioriY() const {
    return aprioriSurfacePoint.GetY();
  }


  /**
   * Gets the apriori z coordinate.
   *
   * @return Displacement The apriori z coordinate.
   */
  Displacement ControlPoint::GetAprioriZ() const {
    return aprioriSurfacePoint.GetZ();
  }


   ControlPoint::RadiusSource::Source ControlPoint::GetAprioriRadiusSource()
       const {
     return aprioriRadiusSource;
   }
 
  bool ControlPoint::HasAprioriCoordinates() {
    if (aprioriSurfacePoint.GetX().isValid() &&
        aprioriSurfacePoint.GetY().isValid() &&
        aprioriSurfacePoint.GetZ().isValid())
      return true;

    return false;
  }


  /**
   * Checks to see if the ControlPoint has an adjusted SurfacePoint.
   *
   * @return bool True if the control point has adjusted x, y, and z coordinates.
   */
  bool ControlPoint::HasAdjustedCoordinates() {
    if (adjustedSurfacePoint.GetX().isValid() &&
        adjustedSurfacePoint.GetY().isValid() &&
        adjustedSurfacePoint.GetZ().isValid()) {
      return true;
    }

    return false;
  }


  bool ControlPoint::IsConstrained() {
@@ -1697,7 +1614,7 @@ namespace Isis {
   * @returns The cube serial number of the reference measure
   */
  QString ControlPoint::GetReferenceSN() const {
    if (referenceMeasure == NULL) {
    if (!HasRefMeasure()) {
      QString msg = "There is no reference measure set in the ControlPoint [" +
          GetId() + "]";
      throw IException(IException::Programmer, msg, _FILEINFO_);
+1 −14
Original line number Diff line number Diff line
@@ -337,10 +337,7 @@ namespace Isis {
   *                           constructor (Merged by Kristin Berry. Fixes #2392)
   *   @history 2017-12-18 Kristin Berry - Added convenience methods:
   *                            HasAprioriSurfacePointSourceFile(), HasAprioriRadiusSourceFile(),
   *                            GetAprioriX(), GetAprioriY(), GetAprioriZ(),
   *                            HasAdjustedCoordinates(), GetAdjustedX(), GetAdjustedY(),
   *                            GetAdjustedZ(), HasRefMeasure().
   *   @history 2017-12-19 Kristin Berry - Added IsJigsawRejected().
   *                            HasRefMeasure().
   *   @history 2017-12-21 Adam Goins - Removed redundant code following ControlNetVersioner
   *                           refactor.
   */
@@ -495,9 +492,6 @@ namespace Isis {
      Status ComputeResiduals_Millimeters();

      SurfacePoint GetAdjustedSurfacePoint() const;
      Displacement GetAdjustedX() const;
      Displacement GetAdjustedY() const;
      Displacement GetAdjustedZ() const;

      SurfacePoint GetBestSurfacePoint() const;
      QString GetChooserName() const;
@@ -509,10 +503,6 @@ namespace Isis {
      bool IsValid() const;
      bool IsInvalid() const;
      bool IsFixed() const;
      bool IsJigsawRejected() const;

      bool HasAprioriCoordinates();
      bool HasAdjustedCoordinates();

      bool IsConstrained();
      bool IsLatitudeConstrained();
@@ -533,9 +523,6 @@ namespace Isis {
      static SurfacePointSource::Source StringToSurfacePointSource(QString str);
      QString GetSurfacePointSourceString() const;
      SurfacePoint GetAprioriSurfacePoint() const;
      Displacement GetAprioriX() const;
      Displacement GetAprioriY() const;
      Displacement GetAprioriZ() const;

      RadiusSource::Source GetAprioriRadiusSource() const;
      bool HasAprioriRadiusSourceFile() const;
+5 −5
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@ Object = ControlNetwork
  Created      = Yesterday
  LastModified = Yesterday
  Description  = Null
  Version      = 3
  Version      = 5

  Object = ControlPoint
    PointType                = Fixed
@@ -78,7 +78,7 @@ Object = ControlNetwork
  Created      = Yesterday
  LastModified = Yesterday
  Description  = Null
  Version      = 3
  Version      = 5

  Object = ControlPoint
    PointType                = Fixed
@@ -167,7 +167,7 @@ Object = ControlNetwork
  Created      = Yesterday
  LastModified = Yesterday
  Description  = Null
  Version      = 3
  Version      = 5

  Object = ControlPoint
    PointType                = Fixed
@@ -253,7 +253,7 @@ Object = ControlNetwork
  Created      = Yesterday
  LastModified = Yesterday
  Description  = Null
  Version      = 3
  Version      = 5

  Object = ControlPoint
    PointType                = Fixed
@@ -338,7 +338,7 @@ Object = ControlNetwork
  Created      = Yesterday
  LastModified = Yesterday
  Description  = Null
  Version      = 3
  Version      = 5

  Object = ControlPoint
    PointType                = Fixed
+9 −5
Original line number Diff line number Diff line
@@ -97,11 +97,13 @@ int main() {
  if (cp.GetRefMeasure() != cm2) {
    cp.SetEditLock(false);
    cp.SetRefMeasure(cm2);
    if (cp.GetRefMeasure() == cm2)
    if (cp.GetRefMeasure() == cm2) {
      cout << "ok!\n";
    else
    }
    else {
      cout << "Failed!\n";
    }
  }
  else {
    cout << "Failed!\n";
  }
@@ -242,15 +244,17 @@ int main() {
  getMeasuresTestPoint.Add(alpha);
  getMeasuresTestPoint.Add(beta);
  QList< ControlMeasure * > measures = getMeasuresTestPoint.getMeasures();
  foreach (ControlMeasure * measure, measures)
  foreach (ControlMeasure * measure, measures) {
    cout << measure->GetCubeSerialNumber() << "\n";
  }
  beta->SetIgnored(true);
  measures = getMeasuresTestPoint.getMeasures(true);
  foreach (ControlMeasure * measure, measures)
  foreach (ControlMeasure * measure, measures) {
    cout << measure->GetCubeSerialNumber() << "\n";
  }


  cout << "Testing various accessor methods... " << endl;
  cout << endl << "Testing various accessor methods... " << endl;

  if (cp.HasAprioriSurfacePointSourceFile()) {
    cout << "AprioriSurfacePointSourceFile: " << cp.GetAprioriSurfacePointSourceFile() << endl;
Loading