Skip to content

Commit

Permalink
Reverted back to original ControlNetDiff source and header files per …
Browse files Browse the repository at this point in the history
…reviewer suggestion. Addresses DOI-USGS#5322.
  • Loading branch information
kledmundson committed Nov 1, 2023
1 parent 46777c9 commit ed36e4f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 40 deletions.
32 changes: 8 additions & 24 deletions isis/src/control/objs/ControlNetDiff/ControlNetDiff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ find files of those names at the top level of this repository. **/
#include "ControlMeasure.h"
#include "ControlNet.h"
#include "ControlNetVersioner.h"
#include "ControlPoint.h"
#include "FileName.h"
#include "Pvl.h"
#include "PvlContainer.h"
Expand Down Expand Up @@ -48,10 +49,10 @@ namespace Isis {
*/
ControlNetDiff::~ControlNetDiff() {
delete m_tolerances;
m_tolerances = nullptr;
m_tolerances = NULL;

delete m_ignoreKeys;
m_ignoreKeys = nullptr;
m_ignoreKeys = NULL;
}


Expand Down Expand Up @@ -87,31 +88,14 @@ namespace Isis {
* @return Pvl The collection of all differences
*/
Pvl ControlNetDiff::compare(FileName &net1Name, FileName &net2Name) {

ControlNetVersioner cnv1(net1Name);
ControlNetVersioner cnv2(net2Name);

return compare(cnv1, cnv2, net1Name, net2Name);
}


/**
* Compare two Control Networks in ControNetVersioner form, and return their
* differences.
*
* @param cnv1 first Control Network
* @param cnv2 second Control Network
* @param net1Name FileName of the first Control Network
* @param net2Name FileName of the second Control Network
* @return Pvl The collection of all differences
*/
Pvl ControlNetDiff::compare(ControlNetVersioner &cnv1, ControlNetVersioner &cnv2,
FileName &net1Name, FileName &net2Name) {
Pvl results;
PvlObject report("Differences");

diff("Filename", net1Name.name(), net2Name.name(), report);

ControlNetVersioner cnv1(net1Name);
ControlNetVersioner cnv2(net2Name);

BigInt net1NumPts = cnv1.numPoints();
BigInt net2NumPts = cnv2.numPoints();
diff("Points", toString(net1NumPts), toString(net2NumPts), report);
Expand Down Expand Up @@ -429,8 +413,8 @@ namespace Isis {
* "DateTime" keyword.
*/
void ControlNetDiff::init() {
m_tolerances = nullptr;
m_ignoreKeys = nullptr;
m_tolerances = NULL;
m_ignoreKeys = NULL;

m_tolerances = new QMap<QString, double>;
m_ignoreKeys = new QSet<QString>;
Expand Down
23 changes: 7 additions & 16 deletions isis/src/control/objs/ControlNetDiff/ControlNetDiff.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,20 @@ template< typename A, typename B > class QMap;
template< typename T > class QSet;

namespace Isis {
class ControlNetVersioner;
class ControlNet;
class FileName;
class Pvl;
class PvlContainer;
class PvlKeyword;
class PvlObject;

/**
* @brief Compares two Control Networks in ControlNetVersioner form and
* reports their differences
* @brief Compares two Control Networks and reports their differences
*
* This class takes two Control Networks in ControlNetVersioner form and their
* corresponding Filenames and returns their differences as a PVL structure. It
* is generally stateless, able to compare multiple networks in succession
* without needing to reset anything. However, the tolerances that are added are
* persistent.
* This class opens two Control Networks from Filenames and returns their
* differences as a PVL structure. It is generally stateless, able to compare
* multiple networks in succession without needing to reset anything.
* However, the tolerances that are added are persistent.
*
* Differences will be reported as PvlKeywords with two to three values. The
* first value is from the first network, the second from the second network,
Expand All @@ -50,11 +48,6 @@ namespace Isis {
* @history 2012-04-26 Travis Addair - Added documentation.
* @history 2018-01-02 Kristin Berry - Modified to use ControlNetVersioner instead of
* LatestControlNetFile.
* @history 2023-10-30 Ken Edmundson - Added compare method with ControlNetVersioner
* arguments in addition to control net Filenames to support
* conversion of cnetdiff app to a callable function and
* gtests. Modified original compare method to call the new
* method above.
*
*/
class ControlNetDiff {
Expand All @@ -64,10 +57,8 @@ namespace Isis {
virtual ~ControlNetDiff();

void addTolerances(Pvl &diffFile);

Pvl compare(FileName &net1Name, FileName &net2Name);
Pvl compare(ControlNetVersioner &cnv1, ControlNetVersioner &cnv2,
FileName &net1Name, FileName &net2Name);


protected:
void compare(PvlObject &point1Pvl, PvlObject &point2Pvl, PvlObject &report);
Expand Down

0 comments on commit ed36e4f

Please sign in to comment.