MCPcopy Create free account
hub / github.com/DOI-USGS/ISIS3 / compare

Method compare

isis/src/control/objs/ControlNetDiff/ControlNetDiff.cpp:90–143  ·  view source on GitHub ↗

* Compare two Control Networks given their file names, and return their * differences. * * @param net1Name Name of the first Control Network * @param net2Name Name of the second Control Network * @return Pvl The collection of all differences */

Source from the content-addressed store, hash-verified

88 * @return Pvl The collection of all differences
89 */
90 Pvl ControlNetDiff::compare(FileName &net1Name, FileName &net2Name) {
91 Pvl results;
92 PvlObject report("Differences");
93
94 diff("Filename", net1Name.name(), net2Name.name(), report);
95
96 ControlNetVersioner cnv1(net1Name);
97 ControlNetVersioner cnv2(net2Name);
98
99 BigInt net1NumPts = cnv1.numPoints();
100 BigInt net2NumPts = cnv2.numPoints();
101 diff("Points", toString(net1NumPts), toString(net2NumPts), report);
102
103 diff("NetworkId", cnv1.netId(), cnv2.netId(), report);
104 diff("TargetName", cnv1.targetName(), cnv2.targetName(), report);
105
106 Pvl net1Pvl = cnv1.toPvl();
107 Pvl net2Pvl = cnv2.toPvl();
108
109 PvlObject &net1Obj = net1Pvl.findObject("ControlNetwork");
110 PvlObject &net2Obj = net2Pvl.findObject("ControlNetwork");
111
112 QMap< QString, QMap<int, PvlObject> > pointMap;
113
114 for (int p = 0; p < net1NumPts; p++) {
115 PvlObject &point = net1Obj.object(p);
116 pointMap[point.findKeyword("PointId")[0]].insert(
117 0, point);
118 }
119
120 for (int p = 0; p < net2NumPts; p++) {
121 PvlObject &point = net2Obj.object(p);
122 pointMap[point.findKeyword("PointId")[0]].insert(
123 1, point);
124 }
125
126 QList<QString> pointNames = pointMap.keys();
127
128 for (int i = 0; i < pointNames.size(); i++) {
129 QMap<int, PvlObject> idMap = pointMap[pointNames[i]];
130 if (idMap.size() == 2) {
131 compare(idMap[0], idMap[1], report);
132 }
133 else if (idMap.contains(0)) {
134 addUniquePoint("PointId", idMap[0].findKeyword("PointId")[0], "N/A", report);
135 }
136 else if (idMap.contains(1)) {
137 addUniquePoint("PointId", "N/A", idMap[1].findKeyword("PointId")[0], report);
138 }
139 }
140
141 results.addObject(report);
142 return results;
143 }
144
145
146 /**

Callers 10

NameToDataTypeMethod · 0.45
stringToModelMethod · 0.45
stringToCSMSolveSetMethod · 0.45
stringToCSMSolveTypeMethod · 0.45
mainFunction · 0.45

Calls 15

compareGroupsFunction · 0.85
netIdMethod · 0.80
findObjectMethod · 0.80
addObjectMethod · 0.80
addKeywordMethod · 0.80
groupsMethod · 0.80
groupMethod · 0.80
keywordsMethod · 0.80
toStringFunction · 0.50
compareFunction · 0.50
toDoubleFunction · 0.50
nameMethod · 0.45

Tested by 1

mainFunction · 0.36