Commit b43dcf32 authored by Makayla Shepherd's avatar Makayla Shepherd
Browse files

Added the ability to import control networks, images, and shapes by right...

Added the ability to import control networks, images, and shapes by right clicking on the Project Tree. Fixes #4968.

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/branches/ipce@7858 41f8697f-d340-4b68-9986-7bafba869bb8
parent 6b69f1d1
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
@@ -39,6 +39,11 @@

namespace Isis {

  /**
   * Creates a work order to import a control network.
   * 
   * @param *project Pointer to the project this work order belongs to
   */
  ImportControlNetWorkOrder::ImportControlNetWorkOrder(Project *project) :
      WorkOrder(project) {

@@ -56,6 +61,11 @@ namespace Isis {
  }


  /**
   * Creates a copy of the other ImportControlNetWorkOrder
   * 
   * @param &other ImportControlNetsWorkOrder to copy the state from
   */
  ImportControlNetWorkOrder::ImportControlNetWorkOrder(const ImportControlNetWorkOrder &other) :
      WorkOrder(other) {

@@ -66,17 +76,40 @@ namespace Isis {
  }


  /**
   * Destructor
   */
  ImportControlNetWorkOrder::~ImportControlNetWorkOrder() {
    delete m_watcher;
    m_watcher = NULL;
  }


  /**
   * This method clones the current ImportControlNetWorkOrder and returns it.
   * 
   * @return ImportControlNetWorkOrder Clone
   */
  ImportControlNetWorkOrder *ImportControlNetWorkOrder::clone() const {
    return new ImportControlNetWorkOrder(*this);
  }
  
  
  /**
   * This method returns true if the user clicked on a project tree node with the text 
   * "Control Networks". 
   * This is used by Directory::supportedActions(DataType data) to determine what actions are 
   * appended to context menus.
   * 
   * @param item The ProjectItem that was clicked
   * 
   * @return bool True if the user clicked on a project tree node named "Control Network"
   */
  bool ImportControlNetWorkOrder::isExecutable(ProjectItem *item) {
    return (item->text() == "Control Networks");
  }


  /**
   * @brief Sets up the work order for execution.
   *
+3 −0
Original line number Diff line number Diff line
@@ -49,6 +49,8 @@ namespace Isis {
   *                           WorkOrder redesign. Fixes #4716.
   *   @history 2017-05-01 Ian Humphrey - Updated undoExecution() so when undone, the imported
   *                           cnet(s) are removed from the project tree. Fixes #4597. 
   *   @history 2017-07-13 Makayla Shepherd - Added isExecutable(ProjectItem) to allow for importing
   *                           in the context menu. Fixes #4968.
   */
  class ImportControlNetWorkOrder : public WorkOrder {
      Q_OBJECT
@@ -59,6 +61,7 @@ namespace Isis {

      virtual ImportControlNetWorkOrder *clone() const;
      
      virtual bool isExecutable(ProjectItem *item);
      bool setupExecution();
      void execute();

+14 −0
Original line number Diff line number Diff line
@@ -89,6 +89,20 @@ namespace Isis {
  }

  
  /**
   * This method returns true if the user clicked on a project tree node with the text "Images". 
   * This is used by Directory::supportedActions(DataType data) to determine what actions are 
   * appended to context menus.
   * 
   * @param item The ProjectItem that was clicked
   * 
   * @return bool True if the user clicked on a project tree node named "Shapes"
   */
  bool ImportImagesWorkOrder::isExecutable(ProjectItem *item) {
    return (item->text() == "Images");
  }
  

  /**
   * @brief Sets up this work order before being executed.
   *
+3 −0
Original line number Diff line number Diff line
@@ -71,6 +71,8 @@ namespace Isis {
   *                           Fixes #4956
   *   @history 2017-07-14 Cole Neubauer - Added ability successfully import after failing to import
   *                           a set or list of images Fixes #5015
   *   @history 2017-07-17 Makayla Shepherd - Added isExecutable(ProjectItem) to allow for importing
   *                           in the context menu. Fixes #4968.
   */
  class ImportImagesWorkOrder : public WorkOrder {
      Q_OBJECT
@@ -81,6 +83,7 @@ namespace Isis {

      virtual ImportImagesWorkOrder *clone() const;

      virtual bool isExecutable(ProjectItem *item);
      virtual bool setupExecution();

      virtual void execute();
+33 −0
Original line number Diff line number Diff line
@@ -36,6 +36,11 @@

namespace Isis {

  /**
   * Creates a work order to import a shape model.
   * 
   * @param *project Pointer to the project this work order belongs to
   */
  ImportShapesWorkOrder::ImportShapesWorkOrder(Project *project) :
      WorkOrder(project) {
    // This workorder is synchronous and undoable.
@@ -49,22 +54,50 @@ namespace Isis {
  }


  /**
   * Creates a copy of the other ImportShapesWorkOrder
   * 
   * @param &other ImportShapesWorkOrder to copy the state from
   */
  ImportShapesWorkOrder::ImportShapesWorkOrder(const ImportShapesWorkOrder &other) :
      WorkOrder(other) {
    m_newShapes = NULL;
  }


  /**
   * Destructor
   */
  ImportShapesWorkOrder::~ImportShapesWorkOrder() {
    delete m_newShapes;
    m_newShapes = NULL;
  }


  /**
   * This method clones the current ImportShapesWorkOrder and returns it.
   * 
   * @return ImportShapesWorkOrder Clone
   */
  ImportShapesWorkOrder *ImportShapesWorkOrder::clone() const {
    return new ImportShapesWorkOrder(*this);
  }
  
  
  /**
   * This method returns true if the user clicked on a project tree node with the text "Shapes". 
   * This is used by Directory::supportedActions(DataType data) to determine what actions are 
   * appended to context menus.
   * 
   * @param item The ProjectItem that was clicked
   * 
   * @return bool True if the user clicked on a project tree node named "Shapes"
   */
  bool ImportShapesWorkOrder::isExecutable(ProjectItem *item) {
    return (item->text() == "Shapes");
  }
  

  /**
   * @brief Prompt the user for shape files to import and whether to copy DN data in to project.
   *
Loading