Commit 16fd2163 authored by Kristin Berry's avatar Kristin Berry Committed by Makayla Shepherd
Browse files

Partial changes for fixing the ControlNetDiff class

parent 318ae444
Loading
Loading
Loading
Loading
+22 −16
Original line number Diff line number Diff line
@@ -90,28 +90,28 @@ namespace Isis {
  }


  //! initialize pointers and other data to NULL
  //! Initialize pointers and other data to NULL
  void ControlMeasure::InitializeToNull() {
    p_serialNumber = NULL;
    p_chooserName = NULL;
    p_dateTime = NULL;
    p_loggedData = NULL;

    p_diameter = Null;
    p_aprioriSample = Null;
    p_aprioriLine = Null;
    p_computedEphemerisTime = Null;
    p_sampleSigma = Null;
    p_lineSigma = Null;
    p_sampleResidual = Null;
    p_lineResidual = Null;
    p_diameter = NULL;
    p_aprioriSample = NULL;
    p_aprioriLine = NULL;
    p_computedEphemerisTime = NULL;
    p_sampleSigma = NULL;
    p_lineSigma = NULL;
    p_sampleResidual = NULL;
    p_lineResidual = NULL;

    p_camera = NULL;
    p_focalPlaneMeasuredX = Null;
    p_focalPlaneMeasuredY = Null;
    p_focalPlaneComputedX = Null;
    p_focalPlaneComputedY = Null;
    p_measuredEphemerisTime = Null;
    p_focalPlaneMeasuredX = NULL;
    p_focalPlaneMeasuredY = NULL;
    p_focalPlaneComputedX = NULL;
    p_focalPlaneComputedY = NULL;
    p_measuredEphemerisTime = NULL; 

    parentPoint = NULL;
    associatedCSN = NULL;
@@ -992,7 +992,13 @@ namespace Isis {

  //! Returns true if the ControlMeasure has apriorisample
  bool ControlMeasure::HasAprioriSample() const {
    return p_aprioriSample ? true : false;
    if (p_aprioriSample) {
      return true;
    }
    else {
      return false;
      //    return p_aprioriSample ? true : false;
      }
    }

  //! Returns true if the ControlMeasure has aprioriline
+26 −15
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@

#include "ControlMeasure.h"
#include "ControlNet.h"
#include "ControlNetFile.h"
#include "ControlNetVersioner.h"
#include "ControlPoint.h"
#include "FileName.h"
@@ -86,24 +85,36 @@ namespace Isis {
    Pvl results;
    PvlObject report("Differences");

    LatestControlNetFile *net1 = ControlNetVersioner::Read(net1Name.expanded());
    LatestControlNetFile *net2 = ControlNetVersioner::Read(net2Name.expanded());
    diff("Filename", net1Name.name(), net2Name.name(), report);
//    ControlNet *net1 = ControlNetVersioner::Read(net1Name.expanded());
//    ControlNet *net2 = ControlNetVersioner::Read(net2Name.expanded());

    Pvl net1Pvl(net1->toPvl());
    Pvl net2Pvl(net2->toPvl());
//    ControlNet net1(net1Name.toString());
//    ControlNet net2(net2Name.toString());

    PvlObject &net1Obj = net1Pvl.findObject("ControlNetwork");
    PvlObject &net2Obj = net2Pvl.findObject("ControlNetwork");
    diff("Filename", net1Name.name(), net2Name.name(), report);

    BigInt net1NumPts = net1Obj.objects();
    BigInt net2NumPts = net2Obj.objects();
    ControlNetVersioner cnv1(net1Name);
    ControlNetVersioner cnv2(net2Name);

    BigInt net1NumPts = cnv1.numPoints();
    BigInt net2NumPts = cnv2.numPoints();
    diff("Points", toString(net1NumPts), toString(net2NumPts), report);

    diff("NetworkId", net1Obj, net2Obj, report);
    diff("TargetName", net1Obj, net2Obj, report);
    diff("NetworkId", cnv1.netId(), cnv2.netId(), report);
    diff("TargetName", cnv1.targetName(), cnv2.targetName(), report);

    // This is all written for PVL now, so just re-do it this way rather than rewriting the whole thing.
    Pvl net1Pvl = cnv1.toPvl();
    Pvl net2Pvl = cnv2.toPvl();

    net1Pvl.write("newnet1pvl.pvl");
    net2Pvl.write("newnet2pvl.pvl");

    PvlObject &net1Obj = net1Pvl.findObject("ControlNetwork");
    PvlObject &net2Obj = net2Pvl.findObject("ControlNetwork");
    
    QMap< QString, QMap<int, PvlObject> > pointMap;
     
    for (int p = 0; p < net1NumPts; p++) {
      PvlObject &point = net1Obj.object(p);
      pointMap[point.findKeyword("PointId")[0]].insert(
@@ -117,6 +128,7 @@ namespace Isis {
    }

    QList<QString> pointNames = pointMap.keys();
 
    for (int i = 0; i < pointNames.size(); i++) {
      QMap<int, PvlObject> idMap = pointMap[pointNames[i]];
      if (idMap.size() == 2) {
@@ -130,9 +142,6 @@ namespace Isis {
      }
    }

    delete net1;
    delete net2;

    results.addObject(report);
    return results;
  }
@@ -209,6 +218,7 @@ namespace Isis {
    if (g1.hasKeyword("SerialNumber")) {
      QString sn1 = g1.findKeyword("SerialNumber")[0];
      QString sn2 = g1.findKeyword("SerialNumber")[0];
//      std::cout << "serial numbers :" << sn1 << " , " << sn2 << std::endl; 
      measureReport.addKeyword(makeKeyword("SerialNumber", sn1, sn2));
    }
    PvlContainer &groupReport = g1.hasKeyword("SerialNumber") ?
@@ -258,6 +268,7 @@ namespace Isis {
   */
  void ControlNetDiff::compare(PvlKeyword &k1, PvlKeyword &k2, PvlContainer &report) {
    QString name = k1.name();
//    std::cout << "name: " << name << std::endl; 
    if (m_tolerances->contains(name))
      diff(name, toDouble(k1[0]), toDouble(k2[0]), (*m_tolerances)[name], report);
    else
+1 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ Object = ControlNetwork
  Created      = 2010-07-10T12:50:15
  LastModified = 2010-07-10T12:50:55
  Description  = "UnitTest of ControlNetwork"
  Version = 3

  Object = ControlPoint
    PointType   = Tie
+1 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ Object = ControlNetwork
  Created      = 2010-07-10T12:50:15
  LastModified = 2010-07-10T12:50:55
  Description  = "UnitTest of ControlNetwork"
  Version      = 3

  Object = ControlPoint
    PointType               = Ground
+6 −15
Original line number Diff line number Diff line
@@ -441,14 +441,9 @@ namespace Isis {
          pvlMeasure += PvlKeyword("Ignore", "True");
        }

        if (controlMeasure.HasSample()) {
        // Sample, Line are always initialized to 0. 
        pvlMeasure += PvlKeyword("Sample", toString(controlMeasure.GetSample()));

        }

        if (controlMeasure.HasLine()) {
        pvlMeasure += PvlKeyword("Line", toString(controlMeasure.GetLine()));
        }

        if (controlMeasure.HasDiameter()) {
          pvlMeasure += PvlKeyword("Diameter", toString(controlMeasure.GetDiameter()));
@@ -1818,13 +1813,9 @@ namespace Isis {
          protoMeasure.set_ignore(controlMeasure.IsIgnored());
        }

        if (controlMeasure.HasSample()) {
        // Always set
        protoMeasure.set_sample(controlMeasure.GetSample());
        }

        if (controlMeasure.HasLine()) {
        protoMeasure.set_line(controlMeasure.GetLine());
        }

        if (controlMeasure.HasDiameter()) {
          protoMeasure.set_diameter(controlMeasure.GetDiameter());