Isis Developer Reference
ImportShapesWorkOrder.h
Go to the documentation of this file.
1 #ifndef ImportShapesWorkOrder_H
2 #define ImportShapesWorkOrder_H
3 
23 #include "WorkOrder.h"
24 
25 #include <functional>
26 
27 #include <QDir>
28 #include <QMutex>
29 
30 #include "IException.h"
31 
32 class QString;
33 
34 namespace Isis {
35  class Cube;
36  class FileName;
37  class ShapeList;
38 
67  Q_OBJECT
68  public:
72 
73  virtual ImportShapesWorkOrder *clone() const;
74 
75  virtual bool isExecutable(ProjectItem *item);
76  bool setupExecution();
77 
78  void execute();
79  void postExecution();
80  void undoExecution();
81  void postUndoExecution();
82 
83  private:
84  ImportShapesWorkOrder &operator=(const ImportShapesWorkOrder &rhs);
85 
95  class OriginalFileToProjectCubeFunctor :
96  public std::unary_function<const FileName &, Cube *> {
97  public:
98  OriginalFileToProjectCubeFunctor(QThread *guiThread,
99  QDir destinationFolder, bool copyDnData);
100  OriginalFileToProjectCubeFunctor(const OriginalFileToProjectCubeFunctor &other);
101  ~OriginalFileToProjectCubeFunctor();
102 
103  Cube *operator()(const FileName &original);
104 
105  IException errors() const;
106 
107  private:
109  OriginalFileToProjectCubeFunctor &operator=(const OriginalFileToProjectCubeFunctor &rhs);
110 
111  QDir m_destinationFolder;
112  bool m_copyDnData;
113  QThread *m_guiThread;
114 
115  QMutex m_errorsLock;
116  QSharedPointer<IException> m_errors;
117  QSharedPointer<int> m_numErrors;
118  };
119 
120  private:
121  void importConfirmedShapes(QStringList confirmedShapes, bool copyDnData);
122 
123  private:
124  ShapeList *m_newShapes;
125  ShapeList *m_list;
126  QString m_warning;
127  };
128 }
129 #endif // ImportShapesWorkOrder_H
SaveProjectWorkOrder.h
Isis::ImportShapesWorkOrder::undoExecution
void undoExecution()
delete the imported shapes from the disk.
Definition: ImportShapesWorkOrder.cpp:191
Isis::Project::shapes
static QStringList shapes(QStringList)
Isis::ImportShapesWorkOrder::ImportShapesWorkOrder
ImportShapesWorkOrder(Project *project)
Creates a work order to import a shape model.
Definition: ImportShapesWorkOrder.cpp:45
ProjectItem.h
FileName.h
Isis::Shape::setId
void setId(QString id)
Override the automatically generated ID with the given ID.
Definition: Shape.cpp:402
Cube.h
Isis::Shape::displayProperties
ShapeDisplayProperties * displayProperties()
Get the display (GUI) properties (information) associated with this shape.
Definition: Shape.cpp:355
Isis::WorkOrder::setupExecution
virtual bool setupExecution()
This sets up the state for the work order.
Definition: WorkOrder.cpp:1261
Isis::WorkOrder
Provide Undo/redo abilities, serialization, and history for an operation.
Definition: WorkOrder.h:311
Project.h
Isis::Directory::model
ProjectItemModel * model()
Gets the ProjectItemModel for this directory.
Definition: Directory.cpp:1091
Isis::FileName::name
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
Definition: FileName.cpp:162
Isis::ImportShapesWorkOrder::postExecution
void postExecution()
Add the imported shapes into the project.
Definition: ImportShapesWorkOrder.cpp:231
Isis::FileName
File name manipulation and expansion.
Definition: FileName.h:100
Isis::IException::Unknown
@ Unknown
A type of error that cannot be classified as any of the other error types.
Definition: IException.h:118
Isis::WorkOrder::setInternalData
void setInternalData(QStringList data)
Sets the internal data for this WorkOrder.
Definition: WorkOrder.cpp:1318
Isis::Shape::closeCube
void closeCube()
Cleans up the Cube *.
Definition: Shape.cpp:342
Isis::Cube::copy
Cube * copy(FileName newFile, const CubeAttributeOutput &newFileAttributes)
Copies the cube to the new fileName.
Definition: Cube.cpp:276
Isis::TextFile
Provides access to sequential ASCII stream I/O.
Definition: TextFile.h:38
Isis::TextFile::GetLine
bool GetLine(QString &line, const bool skipComments=true)
Gets next line from file.
Definition: TextFile.cpp:411
Isis::CubeAttributeOutput
Manipulate and parse attributes of output cube filenames.
Definition: CubeAttribute.h:473
Isis::Project::undoStack
QUndoStack * undoStack()
Returns the Projects stack of QUndoCommands.
Definition: Project.cpp:1694
QSharedPointer
Definition: JigsawWorkOrder.h:28
Isis::WorkOrder::m_isSynchronous
bool m_isSynchronous
This is defaulted to true.
Definition: WorkOrder.h:530
QStringList
Isis::ImportShapesWorkOrder::isExecutable
virtual bool isExecutable(ProjectItem *item)
This method returns true if the user clicked on a project tree node with the text "Shapes".
Definition: ImportShapesWorkOrder.cpp:102
Isis::IException::what
const char * what() const
Returns a string representation of this exception in its current state.
Definition: IException.cpp:375
Isis::ShapeList::deleteFromDisk
void deleteFromDisk(Project *project)
Delete all of the contained Shapes from disk.
Definition: ShapeList.cpp:578
Isis::Project
The main project for ipce.
Definition: Project.h:289
Isis::IException::append
void append(const IException &exceptionSource)
Appends the given exception (and its list of previous exceptions) to this exception's causational exc...
Definition: IException.cpp:409
Isis::Project::directory
Directory * directory() const
Returns the directory associated with this Project.
Definition: Project.cpp:1229
Isis::Project::waitForShapeReaderFinished
void waitForShapeReaderFinished()
Locks program if another spot in code is still running and called this function.
Definition: Project.cpp:1740
WorkOrder.h
ImportShapesWorkOrder.h
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Isis::Shape::id
QString id() const
Get a unique, identifying string associated with this shape.
Definition: Shape.cpp:459
Isis::FileName::expanded
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
Definition: FileName.cpp:196
Isis::WorkOrder::m_isUndoable
bool m_isUndoable
Set the workorder to be undoable/redoable This is defaulted to true - his will allow the workorder to...
Definition: WorkOrder.h:523
_FILEINFO_
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:24
Isis::ImportShapesWorkOrder::postUndoExecution
void postUndoExecution()
delete the imported shapes from the project.
Definition: ImportShapesWorkOrder.cpp:206
TextFile.h
Isis::ImportShapesWorkOrder
Add shape model cubes to a project.
Definition: ImportShapesWorkOrder.h:66
Isis::Shape
This represents a shape in a project-based GUI interface.
Definition: Shape.h:68
Isis::Project::warn
void warn(QString text, Data relevantData)
Definition: Project.cpp:2643
Isis::WorkOrder::project
Project * project() const
Returns the Project this WorkOrder is attached to.
Definition: WorkOrder.cpp:1300
ProjectItemModel.h
Isis::ShapeList
Internalizes a list of shapes and allows for operations on the entire list.
Definition: ShapeList.h:33
Isis::Cube
IO Handler for Isis Cubes.
Definition: Cube.h:167
Isis::Project::addShapeFolder
QDir addShapeFolder(QString prefix)
Create and return the name of a folder for placing shape models.
Definition: Project.cpp:1060
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::ProjectItemModel::findItemData
ProjectItem * findItemData(const QVariant &data, int role=Qt::UserRole+1)
Returns the first item found that contains the given data in the given role or a null pointer if no i...
Definition: ProjectItemModel.cpp:290
Isis::Project::addShapes
void addShapes(QStringList shapeFiles)
Read the given shape model cube file names as Images and add them to the project.
Definition: Project.cpp:1089
Isis::WorkOrder::setProgressRange
void setProgressRange(int, int)
Sets the progress range of the WorkOrder.
Definition: WorkOrder.cpp:1358
Isis::ImportShapesWorkOrder::~ImportShapesWorkOrder
~ImportShapesWorkOrder()
Destructor.
Definition: ImportShapesWorkOrder.cpp:74
Isis::FileName::extension
QString extension() const
Returns the last extension of the file name.
Definition: FileName.cpp:178
IException.h
QThread
Isis::ImportShapesWorkOrder::setupExecution
bool setupExecution()
Prompt the user for shape files to import and whether to copy DN data in to project.
Definition: ImportShapesWorkOrder.cpp:126
Isis::WorkOrder::setProgressValue
void setProgressValue(int)
Sets the current progress value for the WorkOrder.
Definition: WorkOrder.cpp:1368
Isis::ImportShapesWorkOrder::execute
void execute()
Creates a project shape folder and copies the shape cubes into it.
Definition: ImportShapesWorkOrder.cpp:219
Isis::WorkOrder::internalData
QStringList internalData() const
Gets the internal data for this WorkOrder.
Definition: WorkOrder.cpp:1377
Isis::ShapeList::append
void append(Shape *const &value)
Appends an shape to the shape list.
Definition: ShapeList.cpp:133
Isis::WorkOrder::setModifiesDiskState
void setModifiesDiskState(bool changesProjectOnDisk)
Definition: WorkOrder.cpp:1674
Isis::FileName::original
QString original() const
Returns the full file name including the file path.
Definition: FileName.cpp:212
Isis::ImportShapesWorkOrder::clone
virtual ImportShapesWorkOrder * clone() const
This method clones the current ImportShapesWorkOrder and returns it.
Definition: ImportShapesWorkOrder.cpp:88
Isis::Project::setClean
void setClean(bool value)
Function to change the clean state of the project.
Definition: Project.cpp:1595
Isis::ProjectItemModel::removeItem
virtual void removeItem(ProjectItem *item)
Removes an item and its children from the model.
Definition: ProjectItemModel.cpp:315
Isis::Cube::relocateDnData
void relocateDnData(FileName dnDataFile)
Relocates the DN data for a cube to an external cube label file.
Definition: Cube.cpp:1366
CubeAttribute.h
Isis::FileName::path
QString path() const
Returns the path of the file name.
Definition: FileName.cpp:103
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::Cube::reopen
void reopen(QString access="r")
This method will reopen an isis sube for reading or reading/writing.
Definition: Cube.cpp:774
Isis::ProjectItem
Represents an item of a ProjectItemModel in Qt's model-view framework.
Definition: ProjectItem.h:134