Commit 53af54d2 authored by Adam Goins's avatar Adam Goins
Browse files

Refactored the signal/slots and got the monitor looking great

parent 0bdee1da
Loading
Loading
Loading
Loading
+5 −27
Original line number Diff line number Diff line
@@ -149,9 +149,7 @@ namespace Isis {
    if (IsEditLocked())
      return MeasureLocked;
    MeasureModified();
    if (parentPoint) {
      parentPoint->emitMeasureModified(this, ControlMeasure::AprioriLineModified, p_aprioriLine, aprioriLine);
    }

    p_aprioriLine = aprioriLine;
    return Success;
  }
@@ -162,9 +160,7 @@ namespace Isis {
    if (IsEditLocked())
      return MeasureLocked;
    MeasureModified();
    if (parentPoint) {
      parentPoint->emitMeasureModified(this, ControlMeasure::AprioriSampleModified, p_aprioriSample, aprioriSample);
    }

    p_aprioriSample = aprioriSample;
    return Success;
  }
@@ -252,11 +248,6 @@ namespace Isis {
    if (IsEditLocked())
      return MeasureLocked;
    MeasureModified();
    QPoint old(p_sample, p_line);
    QPoint newer(sample, line);
    if (parentPoint) {
      parentPoint->emitMeasureModified(this, ControlMeasure::CoordinatesModified, old, newer);
    }

    p_sample = sample;
    p_line = line;
@@ -302,9 +293,6 @@ namespace Isis {


  ControlMeasure::Status ControlMeasure::SetEditLock(bool editLock) {
    if (parentPoint) {
      parentPoint->emitMeasureModified(this, ControlMeasure::EditLockModified, p_editLock, editLock);
    }
    p_editLock = editLock;
    return Success;
  }
@@ -377,13 +365,12 @@ namespace Isis {
    if (IsEditLocked())
      return MeasureLocked;

    if (parentPoint) {
      parentPoint->emitMeasureModified(this, ControlMeasure::IgnoredModified, p_ignore, newIgnoreStatus);
    }

    bool oldStatus = p_ignore;
    p_ignore = newIgnoreStatus;

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

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


    return Success;
  }

@@ -425,13 +413,6 @@ namespace Isis {

    MeasureModified();

    QPoint old(p_sampleResidual, p_lineResidual);
    QPoint newer(sampResidual, lineResidual);

    if (parentPoint) {
      parentPoint->emitMeasureModified(this, ControlMeasure::ResidualModified, old, newer);
    }

    p_sampleResidual = sampResidual;
    p_lineResidual   = lineResidual;
    return Success;
@@ -453,9 +434,6 @@ namespace Isis {
      return MeasureLocked;
    MeasureModified();

    if (parentPoint) {
      parentPoint->emitMeasureModified(this, ControlMeasure::TypeModified, p_measureType, type);
    }
    p_measureType = type;
    return Success;
  }
+1 −7
Original line number Diff line number Diff line
@@ -227,13 +227,7 @@ namespace Isis {
      };

      enum ModType {
        AprioriLineModified,
        AprioriSampleModified,
        CoordinatesModified,
        EditLockModified,
        IgnoredModified,
        ResidualModified,
        TypeModified
        IgnoredModified
      };

      enum DataField {
+45 −14
Original line number Diff line number Diff line
@@ -127,7 +127,7 @@ namespace Isis {
    nullify();
  }

  void ControlNet::emitMeasureModified(ControlMeasure *measure, int type, QVariant oldValue, QVariant newValue) {
  void ControlNet::emitMeasureModified(ControlMeasure *measure, ControlMeasure::ModType type, QVariant oldValue, QVariant newValue) {
    std::cout << "Measure modified" << std::endl;
    std::cout << "Old value: " << oldValue.toString() << std::endl;
    std::cout << "New value: " << newValue.toString() << std::endl;
@@ -135,7 +135,7 @@ namespace Isis {

  }

  void ControlNet::emitPointModified(ControlPoint *point, int type, QVariant oldValue, QVariant newValue) {
  void ControlNet::emitPointModified(ControlPoint *point, ControlPoint::ModType type, QVariant oldValue, QVariant newValue) {
    std::cout << "Point modified" << std::endl;
    std::cout << point << std::endl;

@@ -355,7 +355,6 @@ namespace Isis {
    pointAdded(point);

    emit networkStructureModified();
    emit networkModified(ControlNet::PointAdded, 0, point->GetId());
  }


@@ -410,15 +409,22 @@ 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 newPoint(point);
  }


@@ -469,6 +475,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
@@ -527,15 +538,22 @@ 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);
  }



@@ -595,10 +613,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);
            }
          }
        }
      }
@@ -621,6 +645,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
@@ -633,6 +662,8 @@ namespace Isis {
    QString serial = measure->GetCubeSerialNumber();
    ASSERT(m_vertexGraph->contains(serial));

    emit measureRemoved(measure);

    // Remove connections to and from this node
    if (!measure->IsIgnored() && !measure->Parent()->IsIgnored()) {
      // Break connections
@@ -705,6 +736,7 @@ namespace Isis {
              boost::remove_edge(m_vertexMap[serial],
                                 m_vertexMap[sn],
                                 m_controlGraph);
              emit networkModified(GraphModified);
            }
          }
        }
@@ -758,9 +790,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));
@@ -769,9 +803,6 @@ namespace Isis {

    if (!wasIgnored)
      emit networkStructureModified();
      emit networkModified(ControlNet::PointDeleted, pointId, 0);


    return ControlPoint::Success;
  }

@@ -1676,7 +1707,7 @@ namespace Isis {
      i2.next().value()->parentNetwork = &other;
    }

    emit networkModified(ControlNet::Swapped, other.GetNetworkId(), this->GetNetworkId());
    emit networkModified(ControlNet::Swapped);

  }

+22 −17
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
@@ -39,6 +39,9 @@
#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;
@@ -49,8 +52,6 @@ class QString;

namespace Isis {
  class Camera;
  class ControlMeasure;
  class ControlPoint;
  class ControlCubeGraphNode;
  class Distance;
  class Progress;
@@ -240,16 +241,13 @@ namespace Isis {
      friend class ControlMeasure;
      friend class ControlPoint;

    public:

      enum ModType {
        Cleared,
        PointAdded,
        PointDeleted,
        PointModified,
        Swapped
        Swapped,
        GraphModified
      };

    public:

      QList< ControlCubeGraphNode * > GetCubeGraphNodes() {
        QList<ControlCubeGraphNode *> lst;
        return lst;} ; // TEMPORARY DELETE
@@ -344,23 +342,30 @@ namespace Isis {

    signals:
      void networkStructureModified();
      void pointModified(ControlPoint *point, int type, QVariant oldValue, QVariant newValue);
      void measureModified(ControlMeasure *measure, int type, QVariant oldValue, QVariant newValue);
      void networkModified(int type, QVariant oldValue, QVariant newValue);
      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);
      void UpdatePointReference(ControlPoint *point, QString oldId);
      void emitNetworkStructureModified();
      void emitMeasureModified(ControlMeasure *measure, int type, QVariant oldValue, QVariant newValue);
      void emitPointModified(ControlPoint *point, int 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 emitNewMeasure(ControlMeasure *measure);
      void emitMeasureRemoved(ControlMeasure *measure);
      void pointAdded(ControlPoint *point);

    private: // graphing functions
      /**
+318 −66

File changed.

Preview size limit exceeded, changes collapsed.

Loading