Commit ddbdb5d8 authored by Jesse Mapel's avatar Jesse Mapel
Browse files

First Pass at changing ControlCubeGraph node usage to serial numbers in...

First Pass at changing ControlCubeGraph node usage to serial numbers in cneteditorwidget tree models.
parent f2ab92c7
Loading
Loading
Loading
Loading
+0 −17
Original line number Diff line number Diff line
@@ -322,23 +322,6 @@ void IsisMain() {
    if (net.GetSerialConnections().size() > numInitialIslands) islandFlag = false; //test failed
    else islandFlag = true; //test passed

    //Check to see if the network has split
      //this simplifies to making sure that all cubes observing the ControlPoint that had some or
      //all of it's measures ignored are still connected
    /* //Travis Addair informed me that this method only checks 1 step conections
    // thus it was effectively only enforcing that the last tie between pairs
    // of images not be ingorned
    QList<ControlMeasure *> ptMeas = suspectMeasures[i]->Parent()->getMeasures();
    const ControlCubeGraphNode *node0 = net.getGraphNode(ptMeas[0]->GetCubeSerialNumber());
    islandFlag = true;  //assuming the best, and then verify
    for (int j=1; j<ptMeas.size(); j++) {
      //check each subsequent node for conection to the first
      if ( !node0->isConnected(net.getGraphNode(ptMeas[j]->GetCubeSerialNumber()))) {
        islandFlag = false; //test failed
        break;
      }
    }*/

    //again we will temporarily be setting the measure back to unignored
      //this will change when the expected ControlNet::isCriticalMeasure(...) method is written
    for (int j=0;j<measGroup.size();j++) {
+14 −25
Original line number Diff line number Diff line
@@ -7,32 +7,22 @@
#include <QString>
#include <QVariant>

#include "ControlCubeGraphNode.h"
#include "ControlNet.h"


namespace Isis {
  AbstractImageItem::AbstractImageItem(ControlCubeGraphNode *cubeGraphNode,
  AbstractImageItem::AbstractImageItem(QString imageSerial,
      int avgCharWidth, AbstractTreeItem *parent)
    : AbstractTreeItem(parent) {
    ASSERT(cubeGraphNode);
    m_ccgn = cubeGraphNode;
    : AbstractTreeItem(parent), m_imageSerial(imageSerial) {
    calcDataWidth(avgCharWidth);

    connect(m_ccgn, SIGNAL(destroyed(QObject *)), this, SLOT(sourceDeleted()));
  }


  AbstractImageItem::~AbstractImageItem() {
    m_ccgn = NULL;
  }
  AbstractImageItem::~AbstractImageItem() { }


  QVariant AbstractImageItem::getData() const {
    if (m_ccgn)
      return QVariant((QString)m_ccgn->getSerialNumber());
    else
      return QVariant();
    return QVariant(m_imageSerial);
  }


@@ -51,28 +41,27 @@ namespace Isis {
  }


  void AbstractImageItem::deleteSource() {
    // Shouldn't be deleting ControlCubeGraphNode's!
    ASSERT(0);
  }
  void AbstractImageItem::deleteSource() { }


  AbstractTreeItem::InternalPointerType AbstractImageItem::getPointerType() const {
    return AbstractTreeItem::CubeGraphNode;
    return AbstractTreeItem::ImageSerial;
  }


  void *AbstractImageItem::getPointer() const {
    return m_ccgn;
    return &m_imageSerial;
  }


  bool AbstractImageItem::hasNode(ControlCubeGraphNode *node) const {
    return m_ccgn == node || AbstractTreeItem::hasNode(node);
  bool AbstractImageItem::hasImage(QString imageSerial) const {
    return m_imageSerial == imageSerial || AbstractTreeItem::hasImage(imageSerial);
  }


  void AbstractImageItem::sourceDeleted() {
    m_ccgn = NULL;
  }
  /**
   * This method is required to be implemented by the parent AbstractTreeItem class,
   * but for this it's a NOP.
   */
  void AbstractImageItem::sourceDeleted() { }
}
+5 −4
Original line number Diff line number Diff line
@@ -10,7 +10,6 @@ class QVariant;


namespace Isis {
  class ControlCubeGraphNode;

  /**
   * @brief Base class for an image item in the tree
@@ -23,10 +22,12 @@ namespace Isis {
   * @internal
   *   @history 2012-09-28 Kimberly Oyama - Changed member variables to be prefixed with "m_".
   *   @history 2017-07-25 Summer Stapleton - Removed the CnetViz namespace. Fixes #5054.
   *   @history 2018-06-01 Jesse Mapel - Changed ControlCubeGraphNode to image serial number.
   *                           References #5434.
   */
  class AbstractImageItem : public virtual AbstractTreeItem {
    public:
      AbstractImageItem(ControlCubeGraphNode *cubeGraphNode,
      AbstractImageItem(QString imageSerial,
          int avgCharWidth, AbstractTreeItem *parent = 0);
      virtual ~AbstractImageItem();

@@ -37,7 +38,7 @@ namespace Isis {
      void deleteSource();
      InternalPointerType getPointerType() const;
      void *getPointer() const;
      bool hasNode(ControlCubeGraphNode *) const;
      bool hasImage(QString imageSerial) const;


    protected:
@@ -49,7 +50,7 @@ namespace Isis {


    private:
      ControlCubeGraphNode *m_ccgn;
      QString m_imageSerial;
  };
}

+4 −4
Original line number Diff line number Diff line
@@ -95,11 +95,12 @@ namespace Isis {
  }


  bool AbstractTreeItem::hasNode(ControlCubeGraphNode *cube) const {
  bool AbstractTreeItem::hasImage(QString imageSerial) const {
    bool found = false;

    for (int i = 0; !found && i < childCount(); i++)
      found = childAt(i)->hasNode(cube);
    for (int i = 0; !found && i < childCount(); i++) {
      found = childAt(i)->hasImage(imageSerial);
    }

    return found;
  }
@@ -222,4 +223,3 @@ namespace Isis {
    return d;
  }
}
+4 −3
Original line number Diff line number Diff line
@@ -10,7 +10,6 @@ class QVariant;


namespace Isis {
  class ControlCubeGraphNode;
  class ControlPoint;
  class ControlMeasure;

@@ -26,6 +25,8 @@ namespace Isis {
   * @internal
   *   @history 2012-09-28 Kimberly Oyama - Changed member variables to be prefixed with "m_".
   *   @history 2017-07-25 Summer Stapleton - Removed the CnetViz namespace. Fixes #5054.
   *   @history 2018-06-01 Jesse Mapel - Changed ControlCubeGraphNode usages to
   *                           image serial number. References #5434.
   */
  class AbstractTreeItem : public QObject {

@@ -36,7 +37,7 @@ namespace Isis {
        None,
        Point,
        Measure,
        CubeGraphNode,
        ImageSerial,
      };


@@ -78,7 +79,7 @@ namespace Isis {
      virtual QString getFormattedData(QString columnTitle) const;

      virtual bool hasMeasure(ControlMeasure *) const;
      virtual bool hasNode(ControlCubeGraphNode *) const;
      virtual bool hasImage(QString imageSerial) const;
      virtual bool hasPoint(ControlPoint *) const;

      virtual AbstractTreeItem *getNextVisiblePeer() const;
Loading