11 #include "ControlNetFile.h"
67 if (diffFile.
hasGroup(
"Tolerances")) {
69 for (
int i = 0; i < tolerances.
keywords(); i++)
74 if (diffFile.
hasGroup(
"IgnoreKeys")) {
76 for (
int i = 0; i < ignoreKeys.
keywords(); i++)
96 diff(
"Filename", net1Name.name(), net2Name.name(), report);
99 Pvl net2Pvl(net2->toPvl());
104 BigInt net1NumPts = net1Obj.objects();
105 BigInt net2NumPts = net2Obj.
objects();
108 diff(
"NetworkId", net1Obj, net2Obj, report);
109 diff(
"TargetName", net1Obj, net2Obj, report);
112 for (
int p = 0; p < net1NumPts; p++) {
118 for (
int p = 0; p < net2NumPts; p++) {
125 for (
int i = 0; i < pointNames.size(); i++) {
127 if (idMap.size() == 2) {
128 compare(idMap[0], idMap[1], report);
130 else if (idMap.contains(0)) {
131 addUniquePoint(
"PointId", idMap[0].findKeyword(
"PointId")[0],
"N/A", report);
133 else if (idMap.contains(1)) {
134 addUniquePoint(
"PointId",
"N/A", idMap[1].findKeyword(
"PointId")[0], report);
162 int p1Measures = point1Pvl.
groups();
163 int p2Measures = point2Pvl.
groups();
169 for (
int m = 0; m < p1Measures; m++) {
171 measureMap[measure.
findKeyword(
"SerialNumber")[0]].insert(
175 for (
int m = 0; m < p2Measures; m++) {
177 measureMap[measure.
findKeyword(
"SerialNumber")[0]].insert(
182 for (
int i = 0; i < measureNames.size(); i++) {
184 if (idMap.size() == 2) {
187 else if (idMap.contains(0)) {
188 addUniqueMeasure(
"SerialNumber", idMap[0].findKeyword(
"SerialNumber")[0],
"N/A", pointReport);
190 else if (idMap.contains(1)) {
191 addUniqueMeasure(
"SerialNumber",
"N/A", idMap[1].findKeyword(
"SerialNumber")[0], pointReport);
223 for (
int k = 0; k < g1.
keywords(); k++)
224 keywordMap[g1[k].name()].insert(0, g1[k]);
225 for (
int k = 0; k < g2.
keywords(); k++)
226 keywordMap[g2[k].name()].insert(1, g2[k]);
229 for (
int i = 0; i < keywordNames.size(); i++) {
231 if (idMap.size() == 2) {
232 compare(idMap[0], idMap[1], groupReport);
234 else if (idMap.contains(0)) {
235 QString name = idMap[0].name();
237 diff(name, idMap[0][0],
"N/A", groupReport);
239 else if (idMap.contains(1)) {
240 QString name = idMap[1].name();
242 diff(name,
"N/A", idMap[1][0], groupReport);
265 QString name = k1.
name();
269 diff(name, k1[0], k2[0], report);
284 QString v1 = o1[name][0];
285 QString v2 = o2[name][0];
286 diff(name, v1, v2, report);
359 if (fabs(v1 - v2) > tol) {
PvlObject & object(const int index)
Return the object at the specified index.
void addUniqueMeasure(QString label, QString v1, QString v2, PvlObject &parent)
Add a new keyword for the given measure to the parent object.
void diff(QString name, PvlObject &o1, PvlObject &o2, PvlContainer &report)
Add a new difference keyword to the given report if the PvlObjects have different values for the keyw...
void compareGroups(PvlContainer &g1, PvlContainer &g2, PvlObject &report)
Compare two collections, or groupings, of PvlKeywords.
void init()
Initialize the persistent structures used to maintain the state of this instance: its ignore keys and...
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Contains more than one keyword-value pair.
File name manipulation and expansion.
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
virtual Pvl toPvl() const
Converts binary control net version 2 to pvl version 3.
int keywords() const
Returns the number of keywords contained in the PvlContainer.
void addGroup(const Isis::PvlGroup &group)
Add a group to the object.
QMap< QString, double > * m_tolerances
The map of tolerances going from keyword name to tolerance value.
static LatestControlNetFile * Read(const FileName &file)
Read the control network from disk.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
void addKeyword(const PvlKeyword &keyword, const InsertMode mode=Append)
Add a keyword to the container.
double toDouble(const QString &string)
Global function to convert from a string to a double.
void addObject(const PvlObject &object)
Add a PvlObject.
ControlNetDiff()
Create a ControlNetDiff without any tolerances.
PvlKeyword & findKeyword(const QString &kname, FindOptions opts)
Finds a keyword in the current PvlObject, or deeper inside other PvlObjects and Pvlgroups within this...
Contains multiple PvlContainers.
QString name() const
Returns the keyword name.
int objects() const
Returns the number of objects.
A single keyword-value pair.
PvlKeyword makeKeyword(QString name, QString v1, QString v2)
Create a new keyword with the given label name and the given values.
Container for cube-like labels.
PvlKeyword & findKeyword(const QString &name)
Find a keyword with a specified name.
int groups() const
Returns the number of groups contained.
PvlGroup & group(const int index)
Return the group at the specified index.
void addUniquePoint(QString label, QString v1, QString v2, PvlObject &parent)
Add a new keyword for the given point to the parent object.
virtual ~ControlNetDiff()
Destroy the ControlNetDiff.
Handle Binary Control Network Files version 2.
Pvl compare(FileName &net1Name, FileName &net2Name)
Compare two Control Networks given their file names, and return their differences.
bool hasGroup(const QString &name) const
Returns a boolean value based on whether the object has the specified group or not.
Contains Pvl Groups and Pvl Objects.
QSet< QString > * m_ignoreKeys
The set of keywords to ignore by name.
void addTolerances(Pvl &diffFile)
Add the given ignore keys and tolerances to the persisent collections of such values.
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
QString name() const
Returns the container name.
void addValue(QString value, QString unit="")
Adds a value with units.