Unverified Commit 706afaf5 authored by AgoinsUSGS's avatar AgoinsUSGS Committed by GitHub
Browse files

Merge pull request #274 from USGS-Astrogeology/ipceCnetHealth

Merge ipceCnetHealth into ipce
parents 92ba0301 f9120520
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@

#include <QList>
#include <QStringList>
#include <QPoint>

#include "Application.h"
#include "Camera.h"
@@ -148,6 +149,7 @@ namespace Isis {
    if (IsEditLocked())
      return MeasureLocked;
    MeasureModified();

    p_aprioriLine = aprioriLine;
    return Success;
  }
@@ -158,6 +160,7 @@ namespace Isis {
    if (IsEditLocked())
      return MeasureLocked;
    MeasureModified();

    p_aprioriSample = aprioriSample;
    return Success;
  }
@@ -245,8 +248,10 @@ namespace Isis {
    if (IsEditLocked())
      return MeasureLocked;
    MeasureModified();

    p_sample = sample;
    p_line = line;

    SetType(type);
    return Success;
  }
@@ -360,9 +365,14 @@ namespace Isis {
    if (IsEditLocked())
      return MeasureLocked;


    bool oldStatus = p_ignore;
    p_ignore = newIgnoreStatus;

    if (Parent()) {
      Parent()->emitMeasureModified(this, IgnoredModified, oldStatus, p_ignore);
    }

    // only update if there was a change in status
    if (oldStatus != p_ignore) {
      MeasureModified();
@@ -373,6 +383,7 @@ namespace Isis {
      }
    }


    return Success;
  }

@@ -403,6 +414,7 @@ namespace Isis {
      double lineResidual) {

    MeasureModified();

    p_sampleResidual = sampResidual;
    p_lineResidual   = lineResidual;
    return Success;
@@ -423,6 +435,7 @@ namespace Isis {
    if (IsEditLocked())
      return MeasureLocked;
    MeasureModified();

    p_measureType = type;
    return Success;
  }
+10 −1
Original line number Diff line number Diff line
@@ -177,7 +177,12 @@ namespace Isis {
   *   @history 2018-01-26 Kristin Berry - Removed code related to now-unused ControlCubeGraphNode,
   *                           as part of the switch to using the boost graph library.
   *                           References #5434
   *                           
   *   @history 2018-06-15 Adam Goins & Jesse Mapel - Added the ModType enum, as well as a series
   *                           of calls to parentNetwork()->emitPointModified() whenever a change
   *                           is made to a Control Point or any of it's measures. This is done
   *                           to allow for communication between the ControlNetVitals class
   *                           and changes made to the Control Network that it is observing.
   *                           Fixes #5435.
   */
  class ControlMeasure : public QObject {

@@ -226,6 +231,10 @@ namespace Isis {
        MeasureLocked
      };

      enum ModType {
        IgnoredModified
      };

      enum DataField {
        AprioriLine        = 1,
        AprioriSample      = 2,
+48 −6
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
#include <QSet>
#include <QStringList>
#include <QTime>
#include <QVariant>
#include <QVector>

#include <boost/numeric/ublas/symmetric.hpp>
@@ -128,6 +129,15 @@ namespace Isis {
  }


  void ControlNet::emitMeasureModified(ControlMeasure *measure, ControlMeasure::ModType type, QVariant oldValue, QVariant newValue) {
    emit measureModified(measure, type, oldValue, newValue);
  }

  void ControlNet::emitPointModified(ControlPoint *point, ControlPoint::ModType type, QVariant oldValue, QVariant newValue) {
    emit pointModified(point, type, oldValue, newValue);
  }


 /**
  *  @brief Clear the contents of this object
  *
@@ -389,6 +399,7 @@ namespace Isis {
          ControlMeasure *cm = measures[j];
          if (!cm->IsIgnored()) {
            QString sn = cm->GetCubeSerialNumber();

            // 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.)
@@ -400,6 +411,7 @@ namespace Isis {
        }
      }
    }
    emit newPoint(point);
  }


@@ -468,6 +480,11 @@ namespace Isis {
   }


   void ControlNet::emitNewMeasure(ControlMeasure *measure) {
     emit newMeasure(measure);
   }


   /**
   * Updates the ControlNet graph for the measure's serial number to
   * reflect the addition.  If there is currently no node for
@@ -526,14 +543,21 @@ namespace Isis {
            // 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[serial],
            ImageConnection connection;
            bool edgeAdded;
            boost::tie(connection, edgeAdded) = boost::add_edge(m_vertexMap[serial],
                                                       m_vertexMap[sn],
                                                       m_controlGraph).first;
                                                       m_controlGraph);
            m_controlGraph[connection].strength++;

            if (edgeAdded) {
              emit networkModified(GraphModified);
            }
          }
        }
      }
    }
    emit newMeasure(measure);
  }


@@ -639,10 +663,16 @@ namespace Isis {
            // 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[serial],
            ImageConnection connection;
            bool edgeAdded;
            boost::tie(connection, edgeAdded) = boost::add_edge(m_vertexMap[serial],
                                                       m_vertexMap[sn],
                                                       m_controlGraph).first;
                                                       m_controlGraph);
            m_controlGraph[connection].strength++;

            if (edgeAdded) {
              emit networkModified(GraphModified);
            }
          }
        }
      }
@@ -665,6 +695,11 @@ namespace Isis {
  }


  void ControlNet::emitMeasureRemoved(ControlMeasure *measure) {
    emit measureRemoved(measure);
  }


  /**
   * Updates the node for this measure's serial number to
   * reflect the deletion.  If this is the only measure left in the containing
@@ -677,6 +712,8 @@ namespace Isis {
    QString serial = measure->GetCubeSerialNumber();
    ASSERT(m_vertexMap.contains(serial));

    emit measureRemoved(measure);

    // Remove connections to and from this node
    if (!measure->IsIgnored() && !measure->Parent()->IsIgnored()) {
      // Break connections
@@ -800,6 +837,7 @@ namespace Isis {
              boost::remove_edge(m_vertexMap[serial],
                                 m_vertexMap[sn],
                                 m_controlGraph);
              emit networkModified(GraphModified);
            }
          }
        }
@@ -853,9 +891,11 @@ namespace Isis {

    // notify CubeSerialNumbers of the loss of this point
    foreach(ControlMeasure * measure, point->getMeasures()) {
      measureDeleted(measure);
      emit measureRemoved(measure);
    }

    emit pointDeleted(point);

    // delete point
    points->remove(pointId);
    pointIds->removeAt(pointIds->indexOf(pointId));
@@ -864,7 +904,6 @@ namespace Isis {

    if (!wasIgnored)
      emit networkStructureModified();

    return ControlPoint::Success;
  }

@@ -1795,6 +1834,9 @@ namespace Isis {
    while (i2.hasNext()) {
      i2.next().value()->parentNetwork = &other;
    }

    emit networkModified(ControlNet::Swapped);

  }


+34 −3
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@
 *   $ISISROOT/doc//documents/Disclaimers/Disclaimers.html
 *   in a browser or see the Privacy &amp; Disclaimers page on the Isis website,
 *   http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on
 *   http://www.usgs.gov/privacy.html.
 *   http://www.usgs.gov/privacy.html
 */

// This is needed for the QVariant macro
@@ -29,13 +29,19 @@
#include <QSharedPointer>
#include <QString>
#include <QMap>
#include <QVariant>
#include <QVector>
#include <QVariant>


// Boost includes
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/connected_components.hpp>

#include "ControlMeasure.h"
#include "ControlPoint.h"

template< typename A, typename B > class QHash;
template< typename T > class QList;
template< typename A, typename B > struct QPair;
@@ -233,6 +239,13 @@ namespace Isis {
   *   @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.
   *   @history 2018-06-15 Adam Goins & Jesse Mapel - Added the ModType enum, as well as a series
   *                           of signals that are emitted whenever a change is made to a
   *                           Control Point or any of it's measures, or to the network itself.
   *                           These signals exist for the purpose of communication between the
   *                           ControlNetVitals class, and the network that it is observing.
   *                           Fixes #5435.

   */
  class ControlNet : public QObject {
      Q_OBJECT
@@ -242,6 +255,11 @@ namespace Isis {

    public:

      enum ModType {
        Swapped,
        GraphModified
      };

      ControlNet();
      ControlNet(const ControlNet &other);
      ControlNet(const QString &filename, Progress *progress = 0);
@@ -306,6 +324,7 @@ namespace Isis {
      QList< QString > GetPointIds() const;
      std::vector<Distance> GetTargetRadii();


      void SetCreatedDate(const QString &date);
      void SetDescription(const QString &newDescription);
      void SetImages(const QString &imageListFile);
@@ -332,12 +351,20 @@ namespace Isis {

    signals:
      void networkStructureModified();
      void networkModified(ControlNet::ModType type);
      void pointModified(ControlPoint *point, ControlPoint::ModType type, QVariant oldValue, QVariant newValue);
      void measureModified(ControlMeasure *measure, ControlMeasure::ModType type, QVariant oldValue, QVariant newValue);
      void pointDeleted(ControlPoint *point);
      void newPoint(ControlPoint *);
      void newMeasure(ControlMeasure *);
      void measureRemoved(ControlMeasure *);



    private:
      void nullify();
      bool ValidateSerialNumber(QString serialNumber) const;
      void measureAdded(ControlMeasure *measure);
      void pointAdded(ControlPoint *point);
      void measureDeleted(ControlMeasure *measure);
      void measureIgnored(ControlMeasure *measure);
      void measureUnIgnored(ControlMeasure *measure);
@@ -345,7 +372,11 @@ namespace Isis {
      void pointUnIgnored(ControlPoint *point);
      void UpdatePointReference(ControlPoint *point, QString oldId);
      void emitNetworkStructureModified();

      void emitMeasureModified(ControlMeasure *measure, ControlMeasure::ModType type, QVariant oldValue, QVariant newValue);
      void emitPointModified(ControlPoint *point, ControlPoint::ModType type, QVariant oldValue, QVariant newValue);
      void emitNewMeasure(ControlMeasure *measure);
      void emitMeasureRemoved(ControlMeasure *measure);
      void pointAdded(ControlPoint *point);

    private: // graphing functions
      /**
+680 −79

File changed.

Preview size limit exceeded, changes collapsed.

Loading