Commit 853526b2 authored by Tracie Sucharski's avatar Tracie Sucharski
Browse files

Created new WorkOrder, BundleObservationViewWorkOrder. Fixes #4840.

parent 165f09a5
Loading
Loading
Loading
Loading
+0 −39
Original line number Diff line number Diff line
@@ -1451,45 +1451,6 @@ namespace Isis {
    stream.writeEndElement(); //end bundleSolutionInfo
  }

#if 0
  /**
   * Saves the BundleSolutionInfo to the project
   *
   * @param stream The stream to which the BundleSolutionInfo will be saved
   * @param project The project to which this BundleSolutionInfo will be saved
   */
  void BundleSolutionInfo::save(QXmlStreamWriter &stream, const Project *project) const {

    stream.writeStartElement("bundleSolutionInfo");
    // save ID, cnet file name, and run time to stream
    stream.writeStartElement("generalAttributes");
    stream.writeTextElement("id", m_id->toString());
    stream.writeTextElement("runTime", runTime());
    stream.writeTextElement("fileName", m_controlNetworkFileName->expanded());
    stream.writeTextElement("imagesCSV", m_csvSavedImagesFilename);
    stream.writeTextElement("pointsCSV", m_csvSavedPointsFilename);
    stream.writeTextElement("residualsCSV", m_csvSavedResidualsFilename);
    stream.writeEndElement(); // end general attributes

    // save settings to stream
    m_settings->save(stream, project);

    // save statistics to stream
    m_statisticsResults->save(stream, project);

    // save image lists to stream
    if ( m_images && !m_images->isEmpty() ) {
      stream.writeStartElement("imageLists");

      for (int i = 0; i < m_images->count(); i++) {
        m_images->at(i)->save(stream, project, "");
      }

      stream.writeEndElement();
    }
    stream.writeEndElement(); //end bundleSolutionInfo
  }
#endif

  /**
   * Create an XML Handler (reader) that can populate the BundleSolutionInfo class data. See
+0 −1
Original line number Diff line number Diff line
@@ -139,7 +139,6 @@ namespace Isis {
      bool outputResiduals();

      void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const;
//    void save(QXmlStreamWriter &stream, const Project *project) const;

    public slots:
      void updateFileName(Project *);
+121 −0
Original line number Diff line number Diff line
/**
 * @file
 *
 *   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 "BundleObservationViewWorkOrder.h"

#include <QtDebug>

#include "Directory.h"
#include "BundleObservationView.h"
#include "Project.h"

namespace Isis {
  
  /** 
   * Creates a work order to view BundleObservation. This WorkOrder is not undoable and runs 
   * synchronously. 
   * 
   * @param Project *project Pointer to the project this work order belongs to.
   */
  BundleObservationViewWorkOrder::BundleObservationViewWorkOrder(Project *project) :
      WorkOrder(project) {
    m_isUndoable = false;
    QAction::setText(tr("View &Bundle Observation..."));
    QUndoCommand::setText(tr("View &Bundle Observation..."));
  }


  /**
   * @brief Copy constructor, creates a copy of the other BundleObservationViewWorkOrder.
   *
   * @param BundleObservationViewWorkOrder &other The other work order to copy state from.
   */
  BundleObservationViewWorkOrder::BundleObservationViewWorkOrder(const BundleObservationViewWorkOrder &other) :
      WorkOrder(other) {
    m_isUndoable = other.m_isUndoable;
  }


  /**
   * @brief Destructor to clean up any memory that this work order allocates. 
   */
   BundleObservationViewWorkOrder::~BundleObservationViewWorkOrder() {
  }


  /**
   * @brief This method clones the current BundleObservationViewWorkOrder and returns it.
   * 
   * @return @b BundleObservationViewWorkOrder that was cloned
   */
  BundleObservationViewWorkOrder *BundleObservationViewWorkOrder::clone() const {

    return new BundleObservationViewWorkOrder(*this);
  }
  

  /**
   * @brief 
   *              False if none of the images has a footprint. This is used by
   *              Directory::supportedActions(DataType data) to determine what actions are appended
   *              to context menus.
   * 
   * @param images ImageList of images
   * 
   * @return @b bool True if one of the images in ImagesList images isFootprintable
   */
  bool BundleObservationViewWorkOrder::isExecutable(BundleObservation *bundleObservation) {
    bool result = false;
   
    if (bundleObservation) {
      result = true;
    }
    return result;
  }


  /**
   * @brief Setup this WorkOrder for execution.
   * 
   * @return @b bool True if WorkOrder::execute() returns true and BundleObservationView can be 
   *                 displayed, otherwise return False. 
   */
  bool BundleObservationViewWorkOrder::setupExecution() {
    bool success = WorkOrder::setupExecution();

    return success;
  }


  /**
   * @brief This adds a new BundleObservationView to the project. 
   *  
   * @todo  When BundleObservation is serialized, get the BundleObservation and pass 
   *        into Directory::addBundleObservationView. 
   *  
   */
  void BundleObservationViewWorkOrder::execute() {

    //ProjectItem * selectedItem = project()->directory()->model()->selectedItems();

    project()->directory()->addBundleObservationView(NULL);
  }

}
+59 −0
Original line number Diff line number Diff line
#ifndef BundleObservationViewWorkOrder_H
#define BundleObservationViewWorkOrder_H
/**
 * @file
 *
 *   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 {
  class Project;
  class BundleObservation;
  /**
   *
   * This is a child of the WorkOrder class which is used for anything that performs an action in a
   * Project.  This WorkOrder adds a BundleObservationView to the project.  This runs synchronously 
   * and is not undoable.
   *
   * @todo Some thought should probably be given to whether we actually want view WorkOrders to be 
   * saved in the history.
   *
   * @author 2017-05-04 Tracie Sucharski
   *
   * @internal
   */
  class BundleObservationViewWorkOrder : public WorkOrder {
      Q_OBJECT
    public:
      BundleObservationViewWorkOrder(Project *project);
      BundleObservationViewWorkOrder(const BundleObservationViewWorkOrder &other);
      ~BundleObservationViewWorkOrder();

      virtual BundleObservationViewWorkOrder *clone() const;

      virtual bool isExecutable(BundleObservation * bundleObservation);
      virtual bool setupExecution();
      virtual void execute();

    private:
      BundleObservationViewWorkOrder &operator=(const BundleObservationViewWorkOrder &rhs);
  };
}
#endif
+34 −1
Original line number Diff line number Diff line
@@ -36,7 +36,9 @@

#include <QtDebug>
#include <QMessageBox>

#include "BundleObservation.h"
#include "BundleObservationView.h"
#include "BundleObservationViewWorkOrder.h"
#include "ChipViewportsWidget.h"
#include "CloseProjectWorkOrder.h"
#include "CnetEditorViewWorkOrder.h"
@@ -139,6 +141,7 @@ namespace Isis {
      createWorkOrder<RemoveImagesWorkOrder>();
      createWorkOrder<TargetGetInfoWorkOrder>();
      createWorkOrder<ImageFileListViewWorkOrder>();
      createWorkOrder<BundleObservationViewWorkOrder>();

      //  Main menu actions
      m_exportControlNetWorkOrder = createWorkOrder<ExportControlNetWorkOrder>();
@@ -426,6 +429,28 @@ namespace Isis {
  }


  /**
   * @brief Add the BundleObservationView to the window.
   * @return @b (BundleObservationView *) The BundleObservationView displayed.
   */
  BundleObservationView *Directory::addBundleObservationView(BundleObservation *bundleObservation) {
    BundleObservationView *result = new BundleObservationView(NULL);

    connect( result, SIGNAL( destroyed(QObject *) ),
             this, SLOT( cleanupBundleObservationViews() ) );

    m_bundleObservationViews.append(result);

    result->setWindowTitle( tr("Bundle Observation View %1").
                            arg( m_bundleObservationViews.count() ) );
    result->setObjectName( result->windowTitle() );

    emit newWidgetAvailable(result);

    return result;
  }


  /**
   * @brief Add the widget for the cnet editor view to the window.
   * @param network Control net to edit.
@@ -828,6 +853,14 @@ namespace Isis {
  }


  /**
   * @brief Removes pointers to deleted BundleObservationView objects.
   */
  void Directory::cleanupBundleObservationViews() {
    m_bundleObservationViews.removeAll(NULL);
  }


  /**
   * @brief Removes pointers to deleted CnetEditorWidget objects.
   */
Loading