Loading isis/src/control/objs/BundleSolutionInfo/unitTest.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -129,7 +129,7 @@ int main(int argc, char *argv[]) { bundleControlPointVector.append(fixedBundleControlPoint); bundleControlPointVector.append(fixedBundleControlPoint); Camera *camera = NULL; Camera *camera = NULL; BundleImage bundleImage(camera, BundleImage bundleImage(camera, "TestImageSerialNumber", "Ignored", "TestImageFileName"); "TestImageFileName"); BundleObservationVector observationVector; BundleObservationVector observationVector; QObject *parent = NULL; QObject *parent = NULL; Loading isis/src/control/objs/ControlMeasure/ControlMeasure.cpp +20 −21 Original line number Original line Diff line number Diff line Loading @@ -24,7 +24,6 @@ #include <QList> #include <QList> #include <QStringList> #include <QStringList> #include <QPoint> #include "Application.h" #include "Application.h" #include "Camera.h" #include "Camera.h" Loading Loading @@ -1038,31 +1037,31 @@ namespace Isis { p_dateTime = new QString; p_dateTime = new QString; p_loggedData = new QVector<ControlMeasureLogData>(); p_loggedData = new QVector<ControlMeasureLogData>(); *p_serialNumber = *other.p_serialNumber; bool oldLock = p_editLock; *p_chooserName = *other.p_chooserName; p_editLock = false; *p_dateTime = *other.p_dateTime; p_sample = other.p_sample; p_line = other.p_line; *p_loggedData = *other.p_loggedData; *p_loggedData = *other.p_loggedData; p_measureType = other.p_measureType; SetCubeSerialNumber(*other.p_serialNumber); SetChooserName(*other.p_chooserName); SetDateTime(*other.p_dateTime); SetType(other.p_measureType); // Call SetIgnored to update the ControlGraphNode. However, SetIgnored // Call SetIgnored to update the ControlGraphNode. However, SetIgnored // will return if EditLock is true, so set to false temporarily. // will return if EditLock is true, so set to false temporarily. p_editLock = false; SetIgnored(other.p_ignore); SetIgnored(other.p_ignore); p_editLock = other.p_editLock; SetDiameter(other.p_diameter); p_sample = other.p_sample; SetAprioriSample(other.p_aprioriSample); p_line = other.p_line; SetAprioriLine(other.p_aprioriLine); p_diameter = other.p_diameter; SetSampleSigma(other.p_sampleSigma); p_aprioriSample = other.p_aprioriSample; SetLineSigma(other.p_lineSigma); p_aprioriLine = other.p_aprioriLine; SetResidual(other.p_sampleResidual, other.p_lineResidual); p_sampleSigma = other.p_sampleSigma; SetCamera(other.p_camera); p_lineSigma = other.p_lineSigma; SetFocalPlaneMeasured(other.p_focalPlaneMeasuredX, other.p_focalPlaneMeasuredY); p_sampleResidual = other.p_sampleResidual; SetFocalPlaneComputed(other.p_focalPlaneComputedX, other.p_focalPlaneComputedY); p_lineResidual = other.p_lineResidual; p_editLock = oldLock; p_camera = other.p_camera; SetEditLock(other.p_editLock); p_focalPlaneMeasuredX = other.p_focalPlaneMeasuredX; p_focalPlaneMeasuredY = other.p_focalPlaneMeasuredY; p_focalPlaneComputedX = other.p_focalPlaneComputedX; p_focalPlaneComputedY = other.p_focalPlaneComputedY; return *this; return *this; } } Loading isis/src/control/objs/ControlMeasure/ControlMeasure.h +12 −0 Original line number Original line Diff line number Diff line Loading @@ -183,6 +183,8 @@ namespace Isis { * to allow for communication between the ControlNetVitals class * to allow for communication between the ControlNetVitals class * and changes made to the Control Network that it is observing. * and changes made to the Control Network that it is observing. * Fixes #5435. * Fixes #5435. * @history 2018-06-29 Adam Goins - Modified operator= to use setters when setting values * so that the proper signals/slots are called. Fixes #5435. */ */ class ControlMeasure : public QObject { class ControlMeasure : public QObject { Loading Loading @@ -231,6 +233,16 @@ namespace Isis { MeasureLocked MeasureLocked }; }; /** * @brief Control Measure Modification Types * * This enum is designed to represent the different types of modifications that can be * made to a ControlMeasure. * * IgnoredModified means that the Control Measure had it's IGNORED flag changed. * */ enum ModType { enum ModType { IgnoredModified IgnoredModified }; }; Loading isis/src/control/objs/ControlNet/ControlNet.cpp +104 −109 Original line number Original line Diff line number Diff line Loading @@ -129,10 +129,29 @@ namespace Isis { } } /** * This method is a wrapper to emit the measureModified() signal and is called whenever a change * is made to a Control Measure. * * @param measure The ControlMeasure* that was modified. * @param type The ControlMeasure::ModType indicating which modification occured. * @param oldValue The oldValue before the change. * @param newValue The new value that the change incorporated. */ void ControlNet::emitMeasureModified(ControlMeasure *measure, ControlMeasure::ModType type, QVariant oldValue, QVariant newValue) { void ControlNet::emitMeasureModified(ControlMeasure *measure, ControlMeasure::ModType type, QVariant oldValue, QVariant newValue) { emit measureModified(measure, type, oldValue, newValue); emit measureModified(measure, type, oldValue, newValue); } } /** * This method is a wrapper to emit the pointModified() signal and is called whenever a change * is made to a Control Point. * * @param point The ControlPoint* that was modified. * @param type The ControlPoint::ModType indicating which modification occured. * @param oldValue The oldValue before the change. * @param newValue The new value that the change incorporated. */ void ControlNet::emitPointModified(ControlPoint *point, ControlPoint::ModType type, QVariant oldValue, QVariant newValue) { void ControlNet::emitPointModified(ControlPoint *point, ControlPoint::ModType type, QVariant oldValue, QVariant newValue) { emit pointModified(point, type, oldValue, newValue); emit pointModified(point, type, oldValue, newValue); } } Loading Loading @@ -382,6 +401,7 @@ namespace Isis { newImage.serial = sn; newImage.serial = sn; ImageVertex newVertex = boost::add_vertex(newImage, m_controlGraph); ImageVertex newVertex = boost::add_vertex(newImage, m_controlGraph); m_vertexMap.insert(sn, newVertex); m_vertexMap.insert(sn, newVertex); emit networkModified(GraphModified); } } } } Loading @@ -399,25 +419,71 @@ namespace Isis { ControlMeasure *cm = measures[j]; ControlMeasure *cm = measures[j]; if (!cm->IsIgnored()) { if (!cm->IsIgnored()) { QString sn = cm->GetCubeSerialNumber(); QString sn = cm->GetCubeSerialNumber(); addEdge(serial, sn); } } } } emit newPoint(point); } /** * In the ControlNet graph: adds an edge between the verticies associated with the two serial * numbers provided. Or, if the edge already exists, increments the strength of the edge. * * @param sourceSerial The first serial to be connected by the edge * @param targetSerial The second serial number to be connected by the edge * * @return bool true if a new edge was added, false otherwise. */ bool ControlNet::addEdge(QString sourceSerial, QString targetSerial) { // If the edge doesn't already exist, this adds and returns the edge. // 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 // If the edge already exists, this just returns it. (The use of a set // forces the edges to be unique.) // forces the edges to be unique.) ImageConnection connection; ImageConnection connection; bool edgeAdded; bool edgeAdded; boost::tie(connection, edgeAdded) = boost::add_edge(m_vertexMap[serial], m_vertexMap[sn], boost::tie(connection, edgeAdded) = boost::add_edge(m_vertexMap[sourceSerial], m_vertexMap[targetSerial], m_controlGraph); m_controlGraph); m_controlGraph[connection].strength++; m_controlGraph[connection].strength++; if (edgeAdded) { if (edgeAdded) { emit networkModified(GraphModified); emit networkModified(GraphModified); } } return edgeAdded; } } /** * In the ControlNet graph, decrements the strength on the edge between the two serial numbers. * This is called when the ControlMeasures that connect these images are deleted or ignored. * If it is the last measure connecting two verticies (serial numbers) the edge is removed. * * @param sourceSerial The first serial number defining the end of the edge to have its strength * decremented or be removed. * @param targetSerial The second serial number defining the other end of the edge to have its * strength decremented or be removed. * @return bool true if the edge is removed, otherwise false */ bool ControlNet::removeEdge(QString sourceSerial, QString targetSerial) { ImageConnection connection; bool edgeExists; boost::tie(connection, edgeExists) = boost::edge(m_vertexMap[sourceSerial], m_vertexMap[targetSerial], m_controlGraph); if (edgeExists) { m_controlGraph[connection].strength--; if (m_controlGraph[connection].strength <= 0) { boost::remove_edge(m_vertexMap[sourceSerial], m_vertexMap[targetSerial], m_controlGraph); emit networkModified(GraphModified); return true; } } } } } return false; emit newPoint(point); } } Loading Loading @@ -537,6 +603,7 @@ namespace Isis { newImage.serial = serial; newImage.serial = serial; ImageVertex newVertex = boost::add_vertex(newImage, m_controlGraph); ImageVertex newVertex = boost::add_vertex(newImage, m_controlGraph); m_vertexMap.insert(serial, newVertex); m_vertexMap.insert(serial, newVertex); emit networkModified(GraphModified); } } m_controlGraph[m_vertexMap[serial]].measures[measure->Parent()] = measure; m_controlGraph[m_vertexMap[serial]].measures[measure->Parent()] = measure; Loading @@ -551,19 +618,7 @@ namespace Isis { if (QString::compare(sn, serial) != 0) { if (QString::compare(sn, serial) != 0) { // If the edge doesn't already exist, this adds and returns the edge. addEdge(serial, sn); // If the edge already exists, this just returns it. (The use of a set // forces the edges to be unique.) ImageConnection connection; bool edgeAdded; boost::tie(connection, edgeAdded) = boost::add_edge(m_vertexMap[serial], m_vertexMap[sn], m_controlGraph); m_controlGraph[connection].strength++; if (edgeAdded) { emit networkModified(GraphModified); } } } } } } } Loading Loading @@ -605,20 +660,7 @@ namespace Isis { msg += targetSerial + "]"; msg += targetSerial + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); throw IException(IException::Programmer, msg, _FILEINFO_); } } addEdge(sourceSerial, targetSerial); // 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; bool edgeAdded; boost::tie(connection, edgeAdded) = boost::add_edge(m_vertexMap[sourceSerial], m_vertexMap[targetSerial], m_controlGraph); m_controlGraph[connection].strength++; if (edgeAdded) { emit networkModified(GraphModified); } } } } } } } Loading Loading @@ -678,19 +720,7 @@ namespace Isis { QString sn = cm->GetCubeSerialNumber(); QString sn = cm->GetCubeSerialNumber(); if (QString::compare(sn, serial) != 0) { if (QString::compare(sn, serial) != 0) { // If the edge doesn't already exist, this adds and returns the edge. addEdge(serial, sn); // If the edge already exists, this just returns it. (The use of a set // forces the edges to be unique.) ImageConnection connection; bool edgeAdded; boost::tie(connection, edgeAdded) = boost::add_edge(m_vertexMap[serial], m_vertexMap[sn], m_controlGraph); m_controlGraph[connection].strength++; if (edgeAdded) { emit networkModified(GraphModified); } } } } } } } Loading @@ -715,8 +745,7 @@ namespace Isis { /** /** * Updates the node for this measure's serial number to * Updates the node for this measure's serial number to * reflect the deletion. If this is the only measure left in the containing * reflect the deletion. * node, then the node is deleted as well. * * * @param measure The measure removed from the network. * @param measure The measure removed from the network. */ */ Loading @@ -738,14 +767,6 @@ namespace Isis { // for the old graph. // for the old graph. m_controlGraph[m_vertexMap[serial]].measures.remove(measure->Parent()); m_controlGraph[m_vertexMap[serial]].measures.remove(measure->Parent()); // We decided in a meeting that we do not want to delete the node when all measures are removed. // If this caused the node to be empty, then delete the node. // if (m_controlGraph[m_vertexMap[serial]].measures.size() <= 0) { // boost::clear_vertex(m_vertexMap[serial], m_controlGraph); // boost::remove_vertex(m_vertexMap[serial], m_controlGraph); // m_vertexMap.remove(serial); // } } } Loading Loading @@ -782,25 +803,13 @@ namespace Isis { msg += targetSerial + "]"; msg += targetSerial + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); throw IException(IException::Programmer, msg, _FILEINFO_); } } removeEdge(sourceSerial, targetSerial); 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); emit networkModified(GraphModified); } } } } } } } } /** /** * Updates the edges in the ControlNet graph to reflect the ignored * Updates the edges in the ControlNet graph to reflect the ignored * measure. If this was the last measure connecting one node to another, * measure. If this was the last measure connecting one node to another, Loading Loading @@ -836,30 +845,16 @@ namespace Isis { QString sn = adjacentMeasure->GetCubeSerialNumber(); QString sn = adjacentMeasure->GetCubeSerialNumber(); if (!adjacentMeasure->IsIgnored() && m_vertexMap.contains(sn)) { if (!adjacentMeasure->IsIgnored() && m_vertexMap.contains(sn)) { if (QString::compare(serial, sn) !=0) { if (QString::compare(serial, sn) !=0) { removeEdge(serial, sn); // We need to check if the edge still exists. // boost doesn't add separate edges for A -> B and B -> A like the old graph. // result.first is the ImageConnection, if found // result.second is true if the edge exists; otherwise false. std::pair<ImageConnection, bool> result = boost::edge(m_vertexMap[serial], m_vertexMap[sn], m_controlGraph); if (result.second) { ImageConnection connection = result.first; m_controlGraph[connection].strength--; if (m_controlGraph[connection].strength <= 0) { boost::remove_edge(m_vertexMap[serial], m_vertexMap[sn], m_controlGraph); emit networkModified(GraphModified); } } } } } } } } } } /** * This method is a wrapper to emit the networkStructureModified() signal. */ void ControlNet::emitNetworkStructureModified() { void ControlNet::emitNetworkStructureModified() { emit networkStructureModified(); emit networkStructureModified(); } } Loading Loading @@ -905,7 +900,7 @@ namespace Isis { // notify CubeSerialNumbers of the loss of this point // notify CubeSerialNumbers of the loss of this point foreach(ControlMeasure * measure, point->getMeasures()) { foreach(ControlMeasure * measure, point->getMeasures()) { measureDeleted(measure); point->Delete(measure); } } emit pointDeleted(point); emit pointDeleted(point); Loading Loading @@ -959,7 +954,6 @@ namespace Isis { * @returns A list of cube islands as serial numbers * @returns A list of cube islands as serial numbers */ */ QList< QList< QString > > ControlNet::GetSerialConnections() const { QList< QList< QString > > ControlNet::GetSerialConnections() const { QList< QList< QString > > islandStrings; VertexIndexMap indexMap; VertexIndexMap indexMap; VertexIndexMapAdaptor indexMapAdaptor(indexMap); VertexIndexMapAdaptor indexMapAdaptor(indexMap); Loading @@ -972,23 +966,20 @@ namespace Isis { VertexIndexMap componentMap; VertexIndexMap componentMap; VertexIndexMapAdaptor componentAdaptor(componentMap); VertexIndexMapAdaptor componentAdaptor(componentMap); boost::connected_components(m_controlGraph, componentAdaptor, int numComponents = boost::connected_components(m_controlGraph, componentAdaptor, boost::vertex_index_map(indexMapAdaptor)); boost::vertex_index_map(indexMapAdaptor)); QList< QList< QString > > islandStrings; for (int i = 0; i < numComponents; i++) { QList<QString> tempList; islandStrings.append(tempList); } std::map<ImageVertex, size_t>::iterator it = componentMap.begin(); std::map<ImageVertex, size_t>::iterator it = componentMap.begin(); while(it != componentMap.end()) while(it != componentMap.end()) { { QString serial = m_controlGraph[it->first].serial; QString serial = m_controlGraph[it->first].serial; int group = (int) it->second; int group = (int) it->second; if (group > islandStrings.size() - 1) { QList<QString> tempList; tempList.append(serial); islandStrings.append(tempList); } else { islandStrings[group].append(serial); islandStrings[group].append(serial); } ++it; ++it; } } return islandStrings; return islandStrings; Loading Loading @@ -1395,8 +1386,12 @@ namespace Isis { * returning a count of only valid measures (Ignore=False). * returning a count of only valid measures (Ignore=False). */ */ int ControlNet::GetNumberOfValidMeasuresInImage(const QString &serialNumber) { int ControlNet::GetNumberOfValidMeasuresInImage(const QString &serialNumber) { // If SetImage was called, use the map that has been populated with valid measures if (p_cameraList.size() > 0) { return p_cameraValidMeasuresMap[serialNumber]; return p_cameraValidMeasuresMap[serialNumber]; } } return GetValidMeasuresInCube(serialNumber).size(); } /** /** Loading isis/src/control/objs/ControlNet/ControlNet.h +39 −9 Original line number Original line Diff line number Diff line Loading @@ -224,10 +224,10 @@ namespace Isis { * image. Previously, this had to be done throug the graph. * image. Previously, this had to be done throug the graph. * @history 2018-01-26 Kristin Berry - Added pointAdded() function to eliminate redundant measure * @history 2018-01-26 Kristin Berry - Added pointAdded() function to eliminate redundant measure * adds to the control network. * adds to the control network. * @history 2018-01-26 Kristin Berry - Removed unused methods and associated code: * @history 2018-06-10 Kristin Berry - Removed unused methods and associated code: * MinimumSpanningTree(), GetNodeConnections(), RandomBFS(), Shuffle(), * MinimumSpanningTree(), GetNodeConnections(), RandomBFS(), Shuffle(), * CalcBWAndCE(), CubeGraphToString(), getGraphNode(). References #5434 * CalcBWAndCE(), CubeGraphToString(), getGraphNode(). References #5434 * @history 2018-01-26 Kristin Berry - Updated to use the boost graph library instead of our * @history 2018-06-10 Kristin Berry - Updated to use the boost graph library instead of our * custom graph structure ControlCubeGraphNode. * custom graph structure ControlCubeGraphNode. * @history 2018-04-05 Adam Goins - Added a check to the versionedReader targetRadii * @history 2018-04-05 Adam Goins - Added a check to the versionedReader targetRadii * group to set radii values to those ingested from the versioner * group to set radii values to those ingested from the versioner Loading @@ -245,10 +245,18 @@ namespace Isis { * These signals exist for the purpose of communication between the * These signals exist for the purpose of communication between the * ControlNetVitals class, and the network that it is observing. * ControlNetVitals class, and the network that it is observing. * Fixes #5435. * Fixes #5435. * @history 2018-06-25 Kristin Berry - Updated GetNumberOfValidMeasuresInImage() to use * GetValidMeasuresInCube() if SetImage has not yet been called to populate * the p_cameraValidMeasuresMap. * @history 2018-06-25 Jesse Mapel - Fixed the incorrect signal being called when adding and * @history 2018-06-25 Jesse Mapel - Fixed the incorrect signal being called when adding and * removing measures. References #5435. * removing measures. References #5435. * @history 2018-06-29 Kristin Berry - Added addEdge() and removeEdge() functions to make * code cleaner. * @history 2018-06-25 Jesse Mapel - Fixed ignoring measures with ignored adjacent measures * @history 2018-06-25 Jesse Mapel - Fixed ignoring measures with ignored adjacent measures * incorrectly modifying the edge between the two image vertices. * incorrectly modifying the edge between the two image vertices. * @history 2018-07-06 Jesse Mapel - Modified addEdge and removeEdge to always emit a graph * modified signal if an edge is added or removed. Added graph * modified signal when a vertex is added. */ */ class ControlNet : public QObject { class ControlNet : public QObject { Q_OBJECT Q_OBJECT Loading @@ -258,6 +266,15 @@ namespace Isis { public: public: /** * @brief Control Point Modification Types * * This enum is designed to represent the different types of modifications that can be * made to a ControlNet. * * Swapped means the network was swapped with another network (ControlNet::Swap(ControlNet &other)). * GraphModified means that a vertice or edge was added/removed from the graph.. */ enum ModType { enum ModType { Swapped, Swapped, GraphModified GraphModified Loading Loading @@ -378,6 +395,8 @@ namespace Isis { void emitMeasureModified(ControlMeasure *measure, ControlMeasure::ModType type, QVariant oldValue, QVariant newValue); void emitMeasureModified(ControlMeasure *measure, ControlMeasure::ModType type, QVariant oldValue, QVariant newValue); void emitPointModified(ControlPoint *point, ControlPoint::ModType type, QVariant oldValue, QVariant newValue); void emitPointModified(ControlPoint *point, ControlPoint::ModType type, QVariant oldValue, QVariant newValue); void pointAdded(ControlPoint *point); void pointAdded(ControlPoint *point); bool addEdge(QString sourceSerial, QString targetSerial); bool removeEdge(QString sourceSerial, QString targetSerial); private: // graphing functions private: // graphing functions /** /** Loading Loading @@ -408,31 +427,42 @@ namespace Isis { //! hash ControlPoints by ControlPoint Id //! hash ControlPoints by ControlPoint Id QHash< QString, ControlPoint * > * points; QHash< QString, ControlPoint * > * points; // structs and typedefs for the boost graph //! Used to define the verticies of the graph struct Image { struct Image { QString serial; QString serial; //! The serial number associated with the image //! The measures on the image, hashed by pointers to their parent ControlPoints QHash< ControlPoint *, ControlMeasure * > measures; QHash< ControlPoint *, ControlMeasure * > measures; }; }; //! Used to define the edges of the graph. struct Connection { struct Connection { int strength; int strength; Connection() : strength(0) {} Connection() : strength(0) {} }; }; //! Defines the graph type as an undirected graph that uses Images for verticies, //! and Connections for edges. It is defined as an adjacency list with the edge list //! represented by a set, the and vertex list represented by a list. typedef boost::adjacency_list<boost::setS, typedef boost::adjacency_list<boost::setS, boost::listS, boost::listS, boost::undirectedS, boost::undirectedS, Image, Image, Connection> Network; Connection> Network; typedef Network::vertex_descriptor ImageVertex; typedef Network::edge_descriptor ImageConnection; typedef Network::vertex_descriptor ImageVertex; //! Reprents the verticies of the graph typedef Network::edge_descriptor ImageConnection; //! Represents the edges of the graph //! A map between an ImageVertex and its index typedef std::map<ImageVertex, size_t> VertexIndexMap; typedef std::map<ImageVertex, size_t> VertexIndexMap; //! Converts VertexIndexMap into the appropriate form to be used by boost typedef boost::associative_property_map<VertexIndexMap> VertexIndexMapAdaptor; typedef boost::associative_property_map<VertexIndexMap> VertexIndexMapAdaptor; typedef Network::out_edge_iterator ConnectionIterator; //! Iterates over adjacent verticies typedef boost::graph_traits<Network>::adjacency_iterator AdjacencyIterator; typedef boost::graph_traits<Network>::adjacency_iterator AdjacencyIterator; QHash<QString, ImageVertex> m_vertexMap; //!< The SN -> vertex hash for the boost graph QHash<QString, ImageVertex> m_vertexMap; //! The serial number -> vertex hash used by the graph Network m_controlGraph; //!< The boost graph Network m_controlGraph; //! The ControlNet graph QStringList *pointIds; QStringList *pointIds; QMutex *m_mutex; QMutex *m_mutex; Loading Loading
isis/src/control/objs/BundleSolutionInfo/unitTest.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -129,7 +129,7 @@ int main(int argc, char *argv[]) { bundleControlPointVector.append(fixedBundleControlPoint); bundleControlPointVector.append(fixedBundleControlPoint); Camera *camera = NULL; Camera *camera = NULL; BundleImage bundleImage(camera, BundleImage bundleImage(camera, "TestImageSerialNumber", "Ignored", "TestImageFileName"); "TestImageFileName"); BundleObservationVector observationVector; BundleObservationVector observationVector; QObject *parent = NULL; QObject *parent = NULL; Loading
isis/src/control/objs/ControlMeasure/ControlMeasure.cpp +20 −21 Original line number Original line Diff line number Diff line Loading @@ -24,7 +24,6 @@ #include <QList> #include <QList> #include <QStringList> #include <QStringList> #include <QPoint> #include "Application.h" #include "Application.h" #include "Camera.h" #include "Camera.h" Loading Loading @@ -1038,31 +1037,31 @@ namespace Isis { p_dateTime = new QString; p_dateTime = new QString; p_loggedData = new QVector<ControlMeasureLogData>(); p_loggedData = new QVector<ControlMeasureLogData>(); *p_serialNumber = *other.p_serialNumber; bool oldLock = p_editLock; *p_chooserName = *other.p_chooserName; p_editLock = false; *p_dateTime = *other.p_dateTime; p_sample = other.p_sample; p_line = other.p_line; *p_loggedData = *other.p_loggedData; *p_loggedData = *other.p_loggedData; p_measureType = other.p_measureType; SetCubeSerialNumber(*other.p_serialNumber); SetChooserName(*other.p_chooserName); SetDateTime(*other.p_dateTime); SetType(other.p_measureType); // Call SetIgnored to update the ControlGraphNode. However, SetIgnored // Call SetIgnored to update the ControlGraphNode. However, SetIgnored // will return if EditLock is true, so set to false temporarily. // will return if EditLock is true, so set to false temporarily. p_editLock = false; SetIgnored(other.p_ignore); SetIgnored(other.p_ignore); p_editLock = other.p_editLock; SetDiameter(other.p_diameter); p_sample = other.p_sample; SetAprioriSample(other.p_aprioriSample); p_line = other.p_line; SetAprioriLine(other.p_aprioriLine); p_diameter = other.p_diameter; SetSampleSigma(other.p_sampleSigma); p_aprioriSample = other.p_aprioriSample; SetLineSigma(other.p_lineSigma); p_aprioriLine = other.p_aprioriLine; SetResidual(other.p_sampleResidual, other.p_lineResidual); p_sampleSigma = other.p_sampleSigma; SetCamera(other.p_camera); p_lineSigma = other.p_lineSigma; SetFocalPlaneMeasured(other.p_focalPlaneMeasuredX, other.p_focalPlaneMeasuredY); p_sampleResidual = other.p_sampleResidual; SetFocalPlaneComputed(other.p_focalPlaneComputedX, other.p_focalPlaneComputedY); p_lineResidual = other.p_lineResidual; p_editLock = oldLock; p_camera = other.p_camera; SetEditLock(other.p_editLock); p_focalPlaneMeasuredX = other.p_focalPlaneMeasuredX; p_focalPlaneMeasuredY = other.p_focalPlaneMeasuredY; p_focalPlaneComputedX = other.p_focalPlaneComputedX; p_focalPlaneComputedY = other.p_focalPlaneComputedY; return *this; return *this; } } Loading
isis/src/control/objs/ControlMeasure/ControlMeasure.h +12 −0 Original line number Original line Diff line number Diff line Loading @@ -183,6 +183,8 @@ namespace Isis { * to allow for communication between the ControlNetVitals class * to allow for communication between the ControlNetVitals class * and changes made to the Control Network that it is observing. * and changes made to the Control Network that it is observing. * Fixes #5435. * Fixes #5435. * @history 2018-06-29 Adam Goins - Modified operator= to use setters when setting values * so that the proper signals/slots are called. Fixes #5435. */ */ class ControlMeasure : public QObject { class ControlMeasure : public QObject { Loading Loading @@ -231,6 +233,16 @@ namespace Isis { MeasureLocked MeasureLocked }; }; /** * @brief Control Measure Modification Types * * This enum is designed to represent the different types of modifications that can be * made to a ControlMeasure. * * IgnoredModified means that the Control Measure had it's IGNORED flag changed. * */ enum ModType { enum ModType { IgnoredModified IgnoredModified }; }; Loading
isis/src/control/objs/ControlNet/ControlNet.cpp +104 −109 Original line number Original line Diff line number Diff line Loading @@ -129,10 +129,29 @@ namespace Isis { } } /** * This method is a wrapper to emit the measureModified() signal and is called whenever a change * is made to a Control Measure. * * @param measure The ControlMeasure* that was modified. * @param type The ControlMeasure::ModType indicating which modification occured. * @param oldValue The oldValue before the change. * @param newValue The new value that the change incorporated. */ void ControlNet::emitMeasureModified(ControlMeasure *measure, ControlMeasure::ModType type, QVariant oldValue, QVariant newValue) { void ControlNet::emitMeasureModified(ControlMeasure *measure, ControlMeasure::ModType type, QVariant oldValue, QVariant newValue) { emit measureModified(measure, type, oldValue, newValue); emit measureModified(measure, type, oldValue, newValue); } } /** * This method is a wrapper to emit the pointModified() signal and is called whenever a change * is made to a Control Point. * * @param point The ControlPoint* that was modified. * @param type The ControlPoint::ModType indicating which modification occured. * @param oldValue The oldValue before the change. * @param newValue The new value that the change incorporated. */ void ControlNet::emitPointModified(ControlPoint *point, ControlPoint::ModType type, QVariant oldValue, QVariant newValue) { void ControlNet::emitPointModified(ControlPoint *point, ControlPoint::ModType type, QVariant oldValue, QVariant newValue) { emit pointModified(point, type, oldValue, newValue); emit pointModified(point, type, oldValue, newValue); } } Loading Loading @@ -382,6 +401,7 @@ namespace Isis { newImage.serial = sn; newImage.serial = sn; ImageVertex newVertex = boost::add_vertex(newImage, m_controlGraph); ImageVertex newVertex = boost::add_vertex(newImage, m_controlGraph); m_vertexMap.insert(sn, newVertex); m_vertexMap.insert(sn, newVertex); emit networkModified(GraphModified); } } } } Loading @@ -399,25 +419,71 @@ namespace Isis { ControlMeasure *cm = measures[j]; ControlMeasure *cm = measures[j]; if (!cm->IsIgnored()) { if (!cm->IsIgnored()) { QString sn = cm->GetCubeSerialNumber(); QString sn = cm->GetCubeSerialNumber(); addEdge(serial, sn); } } } } emit newPoint(point); } /** * In the ControlNet graph: adds an edge between the verticies associated with the two serial * numbers provided. Or, if the edge already exists, increments the strength of the edge. * * @param sourceSerial The first serial to be connected by the edge * @param targetSerial The second serial number to be connected by the edge * * @return bool true if a new edge was added, false otherwise. */ bool ControlNet::addEdge(QString sourceSerial, QString targetSerial) { // If the edge doesn't already exist, this adds and returns the edge. // 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 // If the edge already exists, this just returns it. (The use of a set // forces the edges to be unique.) // forces the edges to be unique.) ImageConnection connection; ImageConnection connection; bool edgeAdded; bool edgeAdded; boost::tie(connection, edgeAdded) = boost::add_edge(m_vertexMap[serial], m_vertexMap[sn], boost::tie(connection, edgeAdded) = boost::add_edge(m_vertexMap[sourceSerial], m_vertexMap[targetSerial], m_controlGraph); m_controlGraph); m_controlGraph[connection].strength++; m_controlGraph[connection].strength++; if (edgeAdded) { if (edgeAdded) { emit networkModified(GraphModified); emit networkModified(GraphModified); } } return edgeAdded; } } /** * In the ControlNet graph, decrements the strength on the edge between the two serial numbers. * This is called when the ControlMeasures that connect these images are deleted or ignored. * If it is the last measure connecting two verticies (serial numbers) the edge is removed. * * @param sourceSerial The first serial number defining the end of the edge to have its strength * decremented or be removed. * @param targetSerial The second serial number defining the other end of the edge to have its * strength decremented or be removed. * @return bool true if the edge is removed, otherwise false */ bool ControlNet::removeEdge(QString sourceSerial, QString targetSerial) { ImageConnection connection; bool edgeExists; boost::tie(connection, edgeExists) = boost::edge(m_vertexMap[sourceSerial], m_vertexMap[targetSerial], m_controlGraph); if (edgeExists) { m_controlGraph[connection].strength--; if (m_controlGraph[connection].strength <= 0) { boost::remove_edge(m_vertexMap[sourceSerial], m_vertexMap[targetSerial], m_controlGraph); emit networkModified(GraphModified); return true; } } } } } return false; emit newPoint(point); } } Loading Loading @@ -537,6 +603,7 @@ namespace Isis { newImage.serial = serial; newImage.serial = serial; ImageVertex newVertex = boost::add_vertex(newImage, m_controlGraph); ImageVertex newVertex = boost::add_vertex(newImage, m_controlGraph); m_vertexMap.insert(serial, newVertex); m_vertexMap.insert(serial, newVertex); emit networkModified(GraphModified); } } m_controlGraph[m_vertexMap[serial]].measures[measure->Parent()] = measure; m_controlGraph[m_vertexMap[serial]].measures[measure->Parent()] = measure; Loading @@ -551,19 +618,7 @@ namespace Isis { if (QString::compare(sn, serial) != 0) { if (QString::compare(sn, serial) != 0) { // If the edge doesn't already exist, this adds and returns the edge. addEdge(serial, sn); // If the edge already exists, this just returns it. (The use of a set // forces the edges to be unique.) ImageConnection connection; bool edgeAdded; boost::tie(connection, edgeAdded) = boost::add_edge(m_vertexMap[serial], m_vertexMap[sn], m_controlGraph); m_controlGraph[connection].strength++; if (edgeAdded) { emit networkModified(GraphModified); } } } } } } } Loading Loading @@ -605,20 +660,7 @@ namespace Isis { msg += targetSerial + "]"; msg += targetSerial + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); throw IException(IException::Programmer, msg, _FILEINFO_); } } addEdge(sourceSerial, targetSerial); // 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; bool edgeAdded; boost::tie(connection, edgeAdded) = boost::add_edge(m_vertexMap[sourceSerial], m_vertexMap[targetSerial], m_controlGraph); m_controlGraph[connection].strength++; if (edgeAdded) { emit networkModified(GraphModified); } } } } } } } Loading Loading @@ -678,19 +720,7 @@ namespace Isis { QString sn = cm->GetCubeSerialNumber(); QString sn = cm->GetCubeSerialNumber(); if (QString::compare(sn, serial) != 0) { if (QString::compare(sn, serial) != 0) { // If the edge doesn't already exist, this adds and returns the edge. addEdge(serial, sn); // If the edge already exists, this just returns it. (The use of a set // forces the edges to be unique.) ImageConnection connection; bool edgeAdded; boost::tie(connection, edgeAdded) = boost::add_edge(m_vertexMap[serial], m_vertexMap[sn], m_controlGraph); m_controlGraph[connection].strength++; if (edgeAdded) { emit networkModified(GraphModified); } } } } } } } Loading @@ -715,8 +745,7 @@ namespace Isis { /** /** * Updates the node for this measure's serial number to * Updates the node for this measure's serial number to * reflect the deletion. If this is the only measure left in the containing * reflect the deletion. * node, then the node is deleted as well. * * * @param measure The measure removed from the network. * @param measure The measure removed from the network. */ */ Loading @@ -738,14 +767,6 @@ namespace Isis { // for the old graph. // for the old graph. m_controlGraph[m_vertexMap[serial]].measures.remove(measure->Parent()); m_controlGraph[m_vertexMap[serial]].measures.remove(measure->Parent()); // We decided in a meeting that we do not want to delete the node when all measures are removed. // If this caused the node to be empty, then delete the node. // if (m_controlGraph[m_vertexMap[serial]].measures.size() <= 0) { // boost::clear_vertex(m_vertexMap[serial], m_controlGraph); // boost::remove_vertex(m_vertexMap[serial], m_controlGraph); // m_vertexMap.remove(serial); // } } } Loading Loading @@ -782,25 +803,13 @@ namespace Isis { msg += targetSerial + "]"; msg += targetSerial + "]"; throw IException(IException::Programmer, msg, _FILEINFO_); throw IException(IException::Programmer, msg, _FILEINFO_); } } removeEdge(sourceSerial, targetSerial); 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); emit networkModified(GraphModified); } } } } } } } } /** /** * Updates the edges in the ControlNet graph to reflect the ignored * Updates the edges in the ControlNet graph to reflect the ignored * measure. If this was the last measure connecting one node to another, * measure. If this was the last measure connecting one node to another, Loading Loading @@ -836,30 +845,16 @@ namespace Isis { QString sn = adjacentMeasure->GetCubeSerialNumber(); QString sn = adjacentMeasure->GetCubeSerialNumber(); if (!adjacentMeasure->IsIgnored() && m_vertexMap.contains(sn)) { if (!adjacentMeasure->IsIgnored() && m_vertexMap.contains(sn)) { if (QString::compare(serial, sn) !=0) { if (QString::compare(serial, sn) !=0) { removeEdge(serial, sn); // We need to check if the edge still exists. // boost doesn't add separate edges for A -> B and B -> A like the old graph. // result.first is the ImageConnection, if found // result.second is true if the edge exists; otherwise false. std::pair<ImageConnection, bool> result = boost::edge(m_vertexMap[serial], m_vertexMap[sn], m_controlGraph); if (result.second) { ImageConnection connection = result.first; m_controlGraph[connection].strength--; if (m_controlGraph[connection].strength <= 0) { boost::remove_edge(m_vertexMap[serial], m_vertexMap[sn], m_controlGraph); emit networkModified(GraphModified); } } } } } } } } } } /** * This method is a wrapper to emit the networkStructureModified() signal. */ void ControlNet::emitNetworkStructureModified() { void ControlNet::emitNetworkStructureModified() { emit networkStructureModified(); emit networkStructureModified(); } } Loading Loading @@ -905,7 +900,7 @@ namespace Isis { // notify CubeSerialNumbers of the loss of this point // notify CubeSerialNumbers of the loss of this point foreach(ControlMeasure * measure, point->getMeasures()) { foreach(ControlMeasure * measure, point->getMeasures()) { measureDeleted(measure); point->Delete(measure); } } emit pointDeleted(point); emit pointDeleted(point); Loading Loading @@ -959,7 +954,6 @@ namespace Isis { * @returns A list of cube islands as serial numbers * @returns A list of cube islands as serial numbers */ */ QList< QList< QString > > ControlNet::GetSerialConnections() const { QList< QList< QString > > ControlNet::GetSerialConnections() const { QList< QList< QString > > islandStrings; VertexIndexMap indexMap; VertexIndexMap indexMap; VertexIndexMapAdaptor indexMapAdaptor(indexMap); VertexIndexMapAdaptor indexMapAdaptor(indexMap); Loading @@ -972,23 +966,20 @@ namespace Isis { VertexIndexMap componentMap; VertexIndexMap componentMap; VertexIndexMapAdaptor componentAdaptor(componentMap); VertexIndexMapAdaptor componentAdaptor(componentMap); boost::connected_components(m_controlGraph, componentAdaptor, int numComponents = boost::connected_components(m_controlGraph, componentAdaptor, boost::vertex_index_map(indexMapAdaptor)); boost::vertex_index_map(indexMapAdaptor)); QList< QList< QString > > islandStrings; for (int i = 0; i < numComponents; i++) { QList<QString> tempList; islandStrings.append(tempList); } std::map<ImageVertex, size_t>::iterator it = componentMap.begin(); std::map<ImageVertex, size_t>::iterator it = componentMap.begin(); while(it != componentMap.end()) while(it != componentMap.end()) { { QString serial = m_controlGraph[it->first].serial; QString serial = m_controlGraph[it->first].serial; int group = (int) it->second; int group = (int) it->second; if (group > islandStrings.size() - 1) { QList<QString> tempList; tempList.append(serial); islandStrings.append(tempList); } else { islandStrings[group].append(serial); islandStrings[group].append(serial); } ++it; ++it; } } return islandStrings; return islandStrings; Loading Loading @@ -1395,8 +1386,12 @@ namespace Isis { * returning a count of only valid measures (Ignore=False). * returning a count of only valid measures (Ignore=False). */ */ int ControlNet::GetNumberOfValidMeasuresInImage(const QString &serialNumber) { int ControlNet::GetNumberOfValidMeasuresInImage(const QString &serialNumber) { // If SetImage was called, use the map that has been populated with valid measures if (p_cameraList.size() > 0) { return p_cameraValidMeasuresMap[serialNumber]; return p_cameraValidMeasuresMap[serialNumber]; } } return GetValidMeasuresInCube(serialNumber).size(); } /** /** Loading
isis/src/control/objs/ControlNet/ControlNet.h +39 −9 Original line number Original line Diff line number Diff line Loading @@ -224,10 +224,10 @@ namespace Isis { * image. Previously, this had to be done throug the graph. * image. Previously, this had to be done throug the graph. * @history 2018-01-26 Kristin Berry - Added pointAdded() function to eliminate redundant measure * @history 2018-01-26 Kristin Berry - Added pointAdded() function to eliminate redundant measure * adds to the control network. * adds to the control network. * @history 2018-01-26 Kristin Berry - Removed unused methods and associated code: * @history 2018-06-10 Kristin Berry - Removed unused methods and associated code: * MinimumSpanningTree(), GetNodeConnections(), RandomBFS(), Shuffle(), * MinimumSpanningTree(), GetNodeConnections(), RandomBFS(), Shuffle(), * CalcBWAndCE(), CubeGraphToString(), getGraphNode(). References #5434 * CalcBWAndCE(), CubeGraphToString(), getGraphNode(). References #5434 * @history 2018-01-26 Kristin Berry - Updated to use the boost graph library instead of our * @history 2018-06-10 Kristin Berry - Updated to use the boost graph library instead of our * custom graph structure ControlCubeGraphNode. * custom graph structure ControlCubeGraphNode. * @history 2018-04-05 Adam Goins - Added a check to the versionedReader targetRadii * @history 2018-04-05 Adam Goins - Added a check to the versionedReader targetRadii * group to set radii values to those ingested from the versioner * group to set radii values to those ingested from the versioner Loading @@ -245,10 +245,18 @@ namespace Isis { * These signals exist for the purpose of communication between the * These signals exist for the purpose of communication between the * ControlNetVitals class, and the network that it is observing. * ControlNetVitals class, and the network that it is observing. * Fixes #5435. * Fixes #5435. * @history 2018-06-25 Kristin Berry - Updated GetNumberOfValidMeasuresInImage() to use * GetValidMeasuresInCube() if SetImage has not yet been called to populate * the p_cameraValidMeasuresMap. * @history 2018-06-25 Jesse Mapel - Fixed the incorrect signal being called when adding and * @history 2018-06-25 Jesse Mapel - Fixed the incorrect signal being called when adding and * removing measures. References #5435. * removing measures. References #5435. * @history 2018-06-29 Kristin Berry - Added addEdge() and removeEdge() functions to make * code cleaner. * @history 2018-06-25 Jesse Mapel - Fixed ignoring measures with ignored adjacent measures * @history 2018-06-25 Jesse Mapel - Fixed ignoring measures with ignored adjacent measures * incorrectly modifying the edge between the two image vertices. * incorrectly modifying the edge between the two image vertices. * @history 2018-07-06 Jesse Mapel - Modified addEdge and removeEdge to always emit a graph * modified signal if an edge is added or removed. Added graph * modified signal when a vertex is added. */ */ class ControlNet : public QObject { class ControlNet : public QObject { Q_OBJECT Q_OBJECT Loading @@ -258,6 +266,15 @@ namespace Isis { public: public: /** * @brief Control Point Modification Types * * This enum is designed to represent the different types of modifications that can be * made to a ControlNet. * * Swapped means the network was swapped with another network (ControlNet::Swap(ControlNet &other)). * GraphModified means that a vertice or edge was added/removed from the graph.. */ enum ModType { enum ModType { Swapped, Swapped, GraphModified GraphModified Loading Loading @@ -378,6 +395,8 @@ namespace Isis { void emitMeasureModified(ControlMeasure *measure, ControlMeasure::ModType type, QVariant oldValue, QVariant newValue); void emitMeasureModified(ControlMeasure *measure, ControlMeasure::ModType type, QVariant oldValue, QVariant newValue); void emitPointModified(ControlPoint *point, ControlPoint::ModType type, QVariant oldValue, QVariant newValue); void emitPointModified(ControlPoint *point, ControlPoint::ModType type, QVariant oldValue, QVariant newValue); void pointAdded(ControlPoint *point); void pointAdded(ControlPoint *point); bool addEdge(QString sourceSerial, QString targetSerial); bool removeEdge(QString sourceSerial, QString targetSerial); private: // graphing functions private: // graphing functions /** /** Loading Loading @@ -408,31 +427,42 @@ namespace Isis { //! hash ControlPoints by ControlPoint Id //! hash ControlPoints by ControlPoint Id QHash< QString, ControlPoint * > * points; QHash< QString, ControlPoint * > * points; // structs and typedefs for the boost graph //! Used to define the verticies of the graph struct Image { struct Image { QString serial; QString serial; //! The serial number associated with the image //! The measures on the image, hashed by pointers to their parent ControlPoints QHash< ControlPoint *, ControlMeasure * > measures; QHash< ControlPoint *, ControlMeasure * > measures; }; }; //! Used to define the edges of the graph. struct Connection { struct Connection { int strength; int strength; Connection() : strength(0) {} Connection() : strength(0) {} }; }; //! Defines the graph type as an undirected graph that uses Images for verticies, //! and Connections for edges. It is defined as an adjacency list with the edge list //! represented by a set, the and vertex list represented by a list. typedef boost::adjacency_list<boost::setS, typedef boost::adjacency_list<boost::setS, boost::listS, boost::listS, boost::undirectedS, boost::undirectedS, Image, Image, Connection> Network; Connection> Network; typedef Network::vertex_descriptor ImageVertex; typedef Network::edge_descriptor ImageConnection; typedef Network::vertex_descriptor ImageVertex; //! Reprents the verticies of the graph typedef Network::edge_descriptor ImageConnection; //! Represents the edges of the graph //! A map between an ImageVertex and its index typedef std::map<ImageVertex, size_t> VertexIndexMap; typedef std::map<ImageVertex, size_t> VertexIndexMap; //! Converts VertexIndexMap into the appropriate form to be used by boost typedef boost::associative_property_map<VertexIndexMap> VertexIndexMapAdaptor; typedef boost::associative_property_map<VertexIndexMap> VertexIndexMapAdaptor; typedef Network::out_edge_iterator ConnectionIterator; //! Iterates over adjacent verticies typedef boost::graph_traits<Network>::adjacency_iterator AdjacencyIterator; typedef boost::graph_traits<Network>::adjacency_iterator AdjacencyIterator; QHash<QString, ImageVertex> m_vertexMap; //!< The SN -> vertex hash for the boost graph QHash<QString, ImageVertex> m_vertexMap; //! The serial number -> vertex hash used by the graph Network m_controlGraph; //!< The boost graph Network m_controlGraph; //! The ControlNet graph QStringList *pointIds; QStringList *pointIds; QMutex *m_mutex; QMutex *m_mutex; Loading