Commit 9befe0fc authored by Jesse Mapel's avatar Jesse Mapel
Browse files

Removed Directories CubeViewportViewWorkOrder class as it has been replace by...

Removed Directories CubeViewportViewWorkOrder class as it has been replace by CubeDnViewWorkOrder. Fixes #3953

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce@6775 41f8697f-d340-4b68-9986-7bafba869bb8
parent de7e22f4
Loading
Loading
Loading
Loading
+0 −182
Original line number Diff line number Diff line
/**
 * @file
 * $Revision: 1.19 $
 * $Date: 2010/03/22 19:44:53 $
 *
 *   Unless noted otherwise, the portions of Isis written by the USGS are
 *   public domain. See individual third-party library and package descriptions
 *   for intellectual property information, user agreements, and related
 *   information.
 *
 *   Although Isis has been used by the USGS, no warranty, expressed or
 *   implied, is made by the USGS as to the accuracy and functioning of such
 *   software and related material nor shall the fact of distribution
 *   constitute any such warranty, and no responsibility is assumed by the
 *   USGS in connection therewith.
 *
 *   For additional information, launch
 *   $ISISROOT/doc//documents/Disclaimers/Disclaimers.html
 *   in a browser or see the Privacy & Disclaimers page on the Isis website,
 *   http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on
 *   http://www.usgs.gov/privacy.html.
 */
#include "CubeViewportViewWorkOrder.h"

#include <QtDebug>

#include <QFileDialog>
#include <QInputDialog>
#include <QMessageBox>

#include "Directory.h"
#include "MdiCubeViewport.h"
#include "Project.h"
#include "Workspace.h"

namespace Isis {

  CubeViewportViewWorkOrder::CubeViewportViewWorkOrder(Project *project) :
      WorkOrder(project) {
    QAction::setText(tr("View Raw &Cubes..."));
  }


  CubeViewportViewWorkOrder::CubeViewportViewWorkOrder(const CubeViewportViewWorkOrder &other) :
      WorkOrder(other) {
  }


  CubeViewportViewWorkOrder::~CubeViewportViewWorkOrder() {
  }


  CubeViewportViewWorkOrder *CubeViewportViewWorkOrder::clone() const {
    return new CubeViewportViewWorkOrder(*this);
  }


  bool CubeViewportViewWorkOrder::isExecutable(ImageList *images) {
    return (images->count() > 0 && images->count() < 50);
  }


  bool CubeViewportViewWorkOrder::execute() {
    bool success = WorkOrder::execute();
    /*
    int maxRecommendedViewports = 10;
    if (success && imageList()->count() > maxRecommendedViewports) {
      QMessageBox::StandardButton selectedOpt = QMessageBox::warning(NULL,
          tr("Potentially Slow Operation"),
          tr("You are asking to open %L1 images' DN data at once in a qview-like view. Working "
             "with more than %L2 cubes in this way is not recommended. Are you sure you want to "
             "view these %L1 cubes?").arg(imageList()->count()).arg(maxRecommendedViewports),
           QMessageBox::Yes | QMessageBox::No, QMessageBox::No);

      if (selectedOpt == QMessageBox::No) {
        success = false;
      }
    }

    if (success) {
      QStringList viewOptions;

      QList<Workspace *> existingViews = project()->directory()->cubeDnViews();
      int viewToUse = -1;

      if (existingViews.count()) {
        for (int i = 0; i < existingViews.count(); i++) {
          viewOptions.append(existingViews[i]->windowTitle());
        }
      }

      viewOptions.append(tr("New Cube DN View"));

      if (viewOptions.count() > 1) {
        QString selected = QInputDialog::getItem(NULL, tr("View to see cubes in"),
            tr("Which view would you like your\nimage's DN data to be put into?"),
            viewOptions, viewOptions.count() - 1, false, &success);

        viewToUse = viewOptions.indexOf(selected);
      }
      else {
        viewToUse = viewOptions.count() - 1;
      }

      bool newView = false;
      if (viewToUse == viewOptions.count() - 1) {
        newView = true;
        if (!imageList()->name().isEmpty()) {
          QUndoCommand::setText(tr("View image DN data of list [%1] in new cube DN view")
              .arg(imageList()->name()));
        }
        else {
          QUndoCommand::setText(tr("View [%1] image DN data in new cube DN view")
              .arg(imageList()->count()));
        }
      }
      else if (viewToUse != -1) {
        if (!imageList()->name().isEmpty()) {
          QUndoCommand::setText(tr("View image DN data of list [%1] in cube DN view [%2]")
              .arg(imageList()->name()).arg(existingViews[viewToUse]->windowTitle()));
        }
        else {
          QUndoCommand::setText(tr("View [%1] image DN data in cube DN view [%2]")
              .arg(imageList()->count()).arg(existingViews[viewToUse]->windowTitle()));
        }
      }

      QStringList internalData;
      internalData.append(QString::number(viewToUse));
      internalData.append(newView? "new view" : "existing view");
      setInternalData(internalData);
    }
    */
    return success;
  }


  bool CubeViewportViewWorkOrder::dependsOn(WorkOrder *other) const {
    // depend on types of ourselves.
    return dynamic_cast<CubeViewportViewWorkOrder *>(other);
  }


  void CubeViewportViewWorkOrder::syncRedo() {
    /*
    int viewToUse = internalData().first().toInt();

    Workspace *cubeDnViewToUse = NULL;
    if (viewToUse == project()->directory()->cubeDnViews().count()) {
      cubeDnViewToUse = project()->directory()->addCubeDnView();
    }
    else {
      cubeDnViewToUse = project()->directory()->cubeDnViews()[viewToUse];
    }

    cubeDnViewToUse->addImages(imageList());
    */
  }


  void CubeViewportViewWorkOrder::syncUndo() {
    /*
    int viewToUse = internalData().first().toInt();

    if (internalData()[1] == "new view") {
      delete project()->directory()->cubeDnViews().last();
    }
    else {
      Workspace *cubeDnView = project()->directory()->cubeDnViews()[viewToUse];

      QListIterator<Image *> it(*imageList());
      while (it.hasNext()) {
        Image *imageToRemoveFromView = it.next();

        if (cubeDnView->imageToMdiWidget(imageToRemoveFromView))
          cubeDnView->imageToMdiWidget(imageToRemoveFromView)->close();
      }
    }
    */
  }
}
+0 −58
Original line number Diff line number Diff line
#ifndef CubeViewportViewWorkOrder_H
#define CubeViewportViewWorkOrder_H
/**
 * @file
 * $Revision: 1.19 $
 * $Date: 2010/03/22 19:44:53 $
 *
 *   Unless noted otherwise, the portions of Isis written by the USGS are
 *   public domain. See individual third-party library and package descriptions
 *   for intellectual property information, user agreements, and related
 *   information.
 *
 *   Although Isis has been used by the USGS, no warranty, expressed or
 *   implied, is made by the USGS as to the accuracy and functioning of such
 *   software and related material nor shall the fact of distribution
 *   constitute any such warranty, and no responsibility is assumed by the
 *   USGS in connection therewith.
 *
 *   For additional information, launch
 *   $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.
 */
#include "WorkOrder.h"

namespace Isis {

  /**
   * This work order is designed to bring up a qview-like view for a small number of cubes.
   *
   * @author 2012-09-19 Steven Lambright
   *
   * @internal
   */
  class CubeViewportViewWorkOrder : public WorkOrder {
      Q_OBJECT
    public:
      CubeViewportViewWorkOrder(Project *project);
      CubeViewportViewWorkOrder(const CubeViewportViewWorkOrder &other);
      ~CubeViewportViewWorkOrder();

      virtual CubeViewportViewWorkOrder *clone() const;

      virtual bool isExecutable(ImageList *images);
      bool execute();

    protected:
      bool dependsOn(WorkOrder *other) const;
      void syncRedo();
      void syncUndo();

    private:
      CubeViewportViewWorkOrder &operator=(const CubeViewportViewWorkOrder &rhs);
  };
}
#endif
+0 −2
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@
#include "ControlPointEditWidget.h"
#include "CubeDnView.h"
#include "CubeDnViewWorkOrder.h"
#include "CubeViewportViewWorkOrder.h"
#include "ExportControlNetWorkOrder.h"
#include "ExportImagesWorkOrder.h"
#include "FileName.h"
@@ -125,7 +124,6 @@ namespace Isis {

    try {
      createWorkOrder<CnetEditorViewWorkOrder>();
      //createWorkOrder<CubeViewportViewWorkOrder>();
      createWorkOrder<CubeDnViewWorkOrder>();
      createWorkOrder<Footprint2DViewWorkOrder>();
      createWorkOrder<MatrixViewWorkOrder>();