Commit 5de0093b authored by Tracie Sucharski's avatar Tracie Sucharski
Browse files

PROG: Call the appropriate work order for setting the active imageList and...

PROG: Call the appropriate work order for setting the active imageList and Control instead of duplicating code.
parent 2117e04f
Loading
Loading
Loading
Loading
+32 −19
Original line number Diff line number Diff line
@@ -66,6 +66,8 @@
#include "ProjectItem.h"
#include "ProjectItemModel.h"
#include "SerialNumberList.h"
#include "SetActiveControlWorkOrder.h"
#include "SetActiveImageListWorkOrder.h"
#include "Shape.h"
#include "ShapeList.h"
#include "ShapeReader.h"
@@ -1740,6 +1742,7 @@ namespace Isis {
   *
   * Returns the active control (control network) for views which need to operate on
   * the same control, ie. Footprint2dView, CubeDnView, ControlPointEditView.
   * IMPORTANT:  Returns NULL if no active Control. 
   *
   * @internal
   *   @history 2016-06-23 Tracie Sucharski - Original version.
@@ -1753,8 +1756,12 @@ namespace Isis {

    if (!m_activeControl && m_controls->count() == 1) {
      if (m_controls->at(0)->count() == 1 && m_images->count() > 1) {
        QString controlName = m_controls->at(0)->at(0)->displayProperties()->displayName();
        setActiveControl(controlName);
        SetActiveControlWorkOrder *workOrder = new SetActiveControlWorkOrder(this);
        addToProject(workOrder);


//      QString controlName = m_controls->at(0)->at(0)->displayProperties()->displayName();
//      setActiveControl(controlName);
      }
    }
    return m_activeControl;
@@ -1824,6 +1831,7 @@ namespace Isis {
   *
   * Returns the active ImageList for views which need to operate on the
   * same list of images, ie. Footprint2dView, CubeDnView, ControlPointEditView. 
   * IMPORTANT:  Returns NULL if no active ImageList can be set. 
   *
   * @internal
   *   @history 2016-06-23 Tracie Sucharski - Original version.
@@ -1833,8 +1841,13 @@ namespace Isis {
  ImageList *Project::activeImageList() {

    if (!m_activeImageList && m_images->count() == 1) {
      QString imageList = m_images->at(0)->name();
      setActiveImageList(imageList);
        SetActiveImageListWorkOrder *workOrder = new SetActiveImageListWorkOrder(this);
        addToProject(workOrder);



//        QString imageList = m_images->at(0)->name();
//        setActiveImageList(imageList);
    }
    return m_activeImageList;
  }
+4 −0
Original line number Diff line number Diff line
@@ -225,6 +225,10 @@ namespace Isis {
   *                           a temporary project to ensure all project files are pointing to the
   *                           correct directory. Note that this is NOT ideal, particularly it the
   *                           project has many files.
   *   @history 2018-03-14 Tracie Sucharski - Call the appropriate workorder from the methods
   *                           activeControl and activeImageList when returning a default value.
   *                           This ensures that all the proper error checking is handled and
   *                           prevents duplicate code.
   */
  class Project : public QObject {
    Q_OBJECT