Loading isis/src/control/objs/ControlNet/ControlNet.cpp +99 −1 Original line number Diff line number Diff line Loading @@ -420,8 +420,10 @@ namespace Isis { QList<ControlPoint *> imagePoints = m_controlGraph[m_vertexMap[imageSerial]].measures.keys(); QStringList pointIds; foreach(ControlPoint *point, imagePoints) { if (!point->IsIgnored()) { pointIds.append(point->GetId()); } } pointIds.sort(); imagePointIds.insert(imageSerial, pointIds); } Loading Loading @@ -535,6 +537,51 @@ namespace Isis { } /** * Update the ControlNet's internal structure when a ControlPoint is un-ignored. * * @param point A pointer to the un-ignored point. */ void ControlNet::pointUnIgnored(ControlPoint *point) { if (!point) { IString msg = "NULL point passed to " "ControlNet::pointUnIgnored!"; throw IException(IException::Programmer, msg, _FILEINFO_); } QList< ControlMeasure * > validMeasures = point->getMeasures(true); for (int i = 0; i < validMeasures.size(); i++) { ControlMeasure *sourceMeasure = validMeasures[i]; QString sourceSerial = sourceMeasure->GetCubeSerialNumber(); if (!ValidateSerialNumber(sourceSerial)) { QString msg = "Node does not exist for ["; msg += sourceSerial + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } for(int j = i+1; j < validMeasures.size(); j++) { ControlMeasure *targetMeasure = validMeasures[j]; QString targetSerial = targetMeasure->GetCubeSerialNumber(); if (!ValidateSerialNumber(targetSerial)) { QString msg = "Node does not exist for ["; msg += targetSerial + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } // If the edge doesn't already exist, this adds and returns the edge. // If the edge already exists, this just returns it. (The use of a set // forces the edges to be unique.) ImageConnection connection = boost::add_edge(m_vertexMap[sourceSerial], m_vertexMap[targetSerial], m_controlGraph).first; m_controlGraph[connection].strength++; } } } /** * Updates the connections for the ControlNet graph associated with the Loading Loading @@ -652,6 +699,57 @@ namespace Isis { } /** * Update the ControlNet's internal structure when a ControlPoint is ignored. * * @param point A pointer to the ignored point. */ void ControlNet::pointIgnored(ControlPoint *point) { if (!point) { IString msg = "NULL point passed to " "ControlNet::pointIgnored!"; throw IException(IException::Programmer, msg, _FILEINFO_); } QList< ControlMeasure * > validMeasures = point->getMeasures(true); for (int i = 0; i < validMeasures.size(); i++) { ControlMeasure *sourceMeasure = validMeasures[i]; QString sourceSerial = sourceMeasure->GetCubeSerialNumber(); if (!ValidateSerialNumber(sourceSerial)) { QString msg = "Node does not exist for ["; msg += sourceSerial + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } for(int j = i+1; j < validMeasures.size(); j++) { ControlMeasure *targetMeasure = validMeasures[j]; QString targetSerial = targetMeasure->GetCubeSerialNumber(); if (!ValidateSerialNumber(targetSerial)) { QString msg = "Node does not exist for ["; msg += targetSerial + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } std::pair<ImageConnection, bool> result = boost::edge(m_vertexMap[sourceSerial], m_vertexMap[targetSerial], m_controlGraph); if (result.second) { ImageConnection connection = result.first; m_controlGraph[connection].strength--; if (m_controlGraph[connection].strength <= 0) { boost::remove_edge(m_vertexMap[sourceSerial], m_vertexMap[targetSerial], m_controlGraph); } } } } } /** * Updates the edges in the ControlNet graph to reflect the ignored * measure. If this was the last measure connecting one node to another, Loading isis/src/control/objs/ControlNet/ControlNet.h +5 −0 Original line number Diff line number Diff line Loading @@ -230,6 +230,9 @@ namespace Isis { * @history 2018-06-06 Jesse Mapel - Added a method to get all adjacent images to ControlNet. * Previously this functionality was only available through the * ControlCubeGraphNode class. References #5434. * @history 2018-06-06 Jesse Mapel - Added a point ignored and un-ignored methods. This will * prevent edge strengths getting incremented or decremented twice. * References #5434. */ class ControlNet : public QObject { Q_OBJECT Loading Loading @@ -338,6 +341,8 @@ namespace Isis { void measureDeleted(ControlMeasure *measure); void measureIgnored(ControlMeasure *measure); void measureUnIgnored(ControlMeasure *measure); void pointIgnored(ControlPoint *point); void pointUnIgnored(ControlPoint *point); void UpdatePointReference(ControlPoint *point, QString oldId); void emitNetworkStructureModified(); Loading isis/src/control/objs/ControlNet/ControlNet.truth +10 −2 Original line number Diff line number Diff line UnitTest for ControlNet .... ******* test cube connection graph ************ testing ignoring measures.............................. starting graph ALPHA ----[p0]---- BRAVO ALPHA ----[p0]---- BRAVO ignore a measure un-ignore a measure ALPHA ----[p0]---- BRAVO testing measure addition to point already in network... add point with only 1 measure ALPHA ----[p0]---- BRAVO add a measure ALPHA ----[p0,p1]---- BRAVO add another measure ALPHA ----[p0,p1]---- BRAVO ALPHA ----[p1]---- CHARLIE BRAVO ----[p1]---- CHARLIE testing setting point to ignored....................... ALPHA ----[p0,p1]---- BRAVO ignore p1 ALPHA ----[p0]---- BRAVO un-ignore p1 ALPHA ----[p0,p1]---- BRAVO ALPHA ----[p1]---- CHARLIE BRAVO ----[p1]---- CHARLIE Loading isis/src/control/objs/ControlNet/unitTest.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -178,9 +178,13 @@ int main() { net.AddPoint(p0); // test ignoring of measures cout << "testing ignoring measures..............................\n"; cout << "starting graph\n"; cout << net.GraphToString() << "\n"; cout << "ignore a measure\n"; p0m1->SetIgnored(true); cout << net.GraphToString() << "\n"; cout << "un-ignore a measure\n"; p0m1->SetIgnored(false); cout << net.GraphToString() << "\n"; Loading @@ -196,16 +200,21 @@ int main() { p1m1->SetCubeSerialNumber("BRAVO"); ControlMeasure *p1m2 = new ControlMeasure; p1m2->SetCubeSerialNumber("CHARLIE"); cout << "add point with only 1 measure\n"; cout << net.GraphToString() << "\n"; cout << "add a measure\n"; p1->Add(p1m1); cout << net.GraphToString() << "\n"; cout << "add another measure\n"; p1->Add(p1m2); cout << net.GraphToString() << "\n"; // test ignoring of point cout << "testing setting point to ignored.......................\n"; cout << "ignore p1\n"; p1->SetIgnored(true); cout << net.GraphToString() << "\n"; cout << "un-ignore p1\n"; p1->SetIgnored(false); cout << net.GraphToString() << "\n"; Loading isis/src/control/objs/ControlPoint/ControlPoint.cpp +5 −9 Original line number Diff line number Diff line Loading @@ -636,15 +636,11 @@ namespace Isis { if (oldStatus != ignore) { PointModified(); if (parentNetwork) { foreach(ControlMeasure * cm, measures->values()) { if (!cm->IsIgnored()) { if (ignore) { parentNetwork->measureIgnored(cm); parentNetwork->pointIgnored(this); } else { parentNetwork->measureUnIgnored(cm); } } parentNetwork->pointUnIgnored(this); } parentNetwork->emitNetworkStructureModified(); } Loading Loading
isis/src/control/objs/ControlNet/ControlNet.cpp +99 −1 Original line number Diff line number Diff line Loading @@ -420,8 +420,10 @@ namespace Isis { QList<ControlPoint *> imagePoints = m_controlGraph[m_vertexMap[imageSerial]].measures.keys(); QStringList pointIds; foreach(ControlPoint *point, imagePoints) { if (!point->IsIgnored()) { pointIds.append(point->GetId()); } } pointIds.sort(); imagePointIds.insert(imageSerial, pointIds); } Loading Loading @@ -535,6 +537,51 @@ namespace Isis { } /** * Update the ControlNet's internal structure when a ControlPoint is un-ignored. * * @param point A pointer to the un-ignored point. */ void ControlNet::pointUnIgnored(ControlPoint *point) { if (!point) { IString msg = "NULL point passed to " "ControlNet::pointUnIgnored!"; throw IException(IException::Programmer, msg, _FILEINFO_); } QList< ControlMeasure * > validMeasures = point->getMeasures(true); for (int i = 0; i < validMeasures.size(); i++) { ControlMeasure *sourceMeasure = validMeasures[i]; QString sourceSerial = sourceMeasure->GetCubeSerialNumber(); if (!ValidateSerialNumber(sourceSerial)) { QString msg = "Node does not exist for ["; msg += sourceSerial + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } for(int j = i+1; j < validMeasures.size(); j++) { ControlMeasure *targetMeasure = validMeasures[j]; QString targetSerial = targetMeasure->GetCubeSerialNumber(); if (!ValidateSerialNumber(targetSerial)) { QString msg = "Node does not exist for ["; msg += targetSerial + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } // If the edge doesn't already exist, this adds and returns the edge. // If the edge already exists, this just returns it. (The use of a set // forces the edges to be unique.) ImageConnection connection = boost::add_edge(m_vertexMap[sourceSerial], m_vertexMap[targetSerial], m_controlGraph).first; m_controlGraph[connection].strength++; } } } /** * Updates the connections for the ControlNet graph associated with the Loading Loading @@ -652,6 +699,57 @@ namespace Isis { } /** * Update the ControlNet's internal structure when a ControlPoint is ignored. * * @param point A pointer to the ignored point. */ void ControlNet::pointIgnored(ControlPoint *point) { if (!point) { IString msg = "NULL point passed to " "ControlNet::pointIgnored!"; throw IException(IException::Programmer, msg, _FILEINFO_); } QList< ControlMeasure * > validMeasures = point->getMeasures(true); for (int i = 0; i < validMeasures.size(); i++) { ControlMeasure *sourceMeasure = validMeasures[i]; QString sourceSerial = sourceMeasure->GetCubeSerialNumber(); if (!ValidateSerialNumber(sourceSerial)) { QString msg = "Node does not exist for ["; msg += sourceSerial + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } for(int j = i+1; j < validMeasures.size(); j++) { ControlMeasure *targetMeasure = validMeasures[j]; QString targetSerial = targetMeasure->GetCubeSerialNumber(); if (!ValidateSerialNumber(targetSerial)) { QString msg = "Node does not exist for ["; msg += targetSerial + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); } std::pair<ImageConnection, bool> result = boost::edge(m_vertexMap[sourceSerial], m_vertexMap[targetSerial], m_controlGraph); if (result.second) { ImageConnection connection = result.first; m_controlGraph[connection].strength--; if (m_controlGraph[connection].strength <= 0) { boost::remove_edge(m_vertexMap[sourceSerial], m_vertexMap[targetSerial], m_controlGraph); } } } } } /** * Updates the edges in the ControlNet graph to reflect the ignored * measure. If this was the last measure connecting one node to another, Loading
isis/src/control/objs/ControlNet/ControlNet.h +5 −0 Original line number Diff line number Diff line Loading @@ -230,6 +230,9 @@ namespace Isis { * @history 2018-06-06 Jesse Mapel - Added a method to get all adjacent images to ControlNet. * Previously this functionality was only available through the * ControlCubeGraphNode class. References #5434. * @history 2018-06-06 Jesse Mapel - Added a point ignored and un-ignored methods. This will * prevent edge strengths getting incremented or decremented twice. * References #5434. */ class ControlNet : public QObject { Q_OBJECT Loading Loading @@ -338,6 +341,8 @@ namespace Isis { void measureDeleted(ControlMeasure *measure); void measureIgnored(ControlMeasure *measure); void measureUnIgnored(ControlMeasure *measure); void pointIgnored(ControlPoint *point); void pointUnIgnored(ControlPoint *point); void UpdatePointReference(ControlPoint *point, QString oldId); void emitNetworkStructureModified(); Loading
isis/src/control/objs/ControlNet/ControlNet.truth +10 −2 Original line number Diff line number Diff line UnitTest for ControlNet .... ******* test cube connection graph ************ testing ignoring measures.............................. starting graph ALPHA ----[p0]---- BRAVO ALPHA ----[p0]---- BRAVO ignore a measure un-ignore a measure ALPHA ----[p0]---- BRAVO testing measure addition to point already in network... add point with only 1 measure ALPHA ----[p0]---- BRAVO add a measure ALPHA ----[p0,p1]---- BRAVO add another measure ALPHA ----[p0,p1]---- BRAVO ALPHA ----[p1]---- CHARLIE BRAVO ----[p1]---- CHARLIE testing setting point to ignored....................... ALPHA ----[p0,p1]---- BRAVO ignore p1 ALPHA ----[p0]---- BRAVO un-ignore p1 ALPHA ----[p0,p1]---- BRAVO ALPHA ----[p1]---- CHARLIE BRAVO ----[p1]---- CHARLIE Loading
isis/src/control/objs/ControlNet/unitTest.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -178,9 +178,13 @@ int main() { net.AddPoint(p0); // test ignoring of measures cout << "testing ignoring measures..............................\n"; cout << "starting graph\n"; cout << net.GraphToString() << "\n"; cout << "ignore a measure\n"; p0m1->SetIgnored(true); cout << net.GraphToString() << "\n"; cout << "un-ignore a measure\n"; p0m1->SetIgnored(false); cout << net.GraphToString() << "\n"; Loading @@ -196,16 +200,21 @@ int main() { p1m1->SetCubeSerialNumber("BRAVO"); ControlMeasure *p1m2 = new ControlMeasure; p1m2->SetCubeSerialNumber("CHARLIE"); cout << "add point with only 1 measure\n"; cout << net.GraphToString() << "\n"; cout << "add a measure\n"; p1->Add(p1m1); cout << net.GraphToString() << "\n"; cout << "add another measure\n"; p1->Add(p1m2); cout << net.GraphToString() << "\n"; // test ignoring of point cout << "testing setting point to ignored.......................\n"; cout << "ignore p1\n"; p1->SetIgnored(true); cout << net.GraphToString() << "\n"; cout << "un-ignore p1\n"; p1->SetIgnored(false); cout << net.GraphToString() << "\n"; Loading
isis/src/control/objs/ControlPoint/ControlPoint.cpp +5 −9 Original line number Diff line number Diff line Loading @@ -636,15 +636,11 @@ namespace Isis { if (oldStatus != ignore) { PointModified(); if (parentNetwork) { foreach(ControlMeasure * cm, measures->values()) { if (!cm->IsIgnored()) { if (ignore) { parentNetwork->measureIgnored(cm); parentNetwork->pointIgnored(this); } else { parentNetwork->measureUnIgnored(cm); } } parentNetwork->pointUnIgnored(this); } parentNetwork->emitNetworkStructureModified(); } Loading