Isis 3 Programmer Reference
FileTool.h
1 #ifndef FileTool_h
2 #define FileTool_h
3 
4 #include "Tool.h"
5 
6 #include <QDir>
7 #include <QPointer>
8 #include <QStringList>
9 
10 class QAction;
11 
12 namespace Isis {
13  class Brick;
14  class Buffer;
15  class Cube;
16  class CubeAttributeOutput;
17  class MdiCubeViewport;
18  class SaveAsDialog;
19 
59  class FileTool : public Tool {
60  Q_OBJECT
61 
62  public:
63  FileTool(QWidget *parent);
64  void addTo(QMenu *menu);
65  void addTo(Workspace *ws);
66  void addToPermanent(QToolBar *perm);
68  QPointer<QAction> openAction() {
69  return p_open;
70  };
72  QPointer<QAction> saveAction() {
73  return p_saveAs;
74  };
76  QDir p_dir;
78 
79 
81  QString menuName() const {
82  return "&File";
83  }
84 
85  signals:
86  void fileSelected(QString);
87 
92  void saveChanges(CubeViewport *vp);
98  void discardChanges(CubeViewport *vp);
99 
100  public slots:
101  virtual void open();
102  virtual void browse();
103  void print();
104  virtual void save();
105  virtual void saveAs();
106  virtual void saveInfo();
107  virtual void exportView();
108  virtual void exportToList();
109  virtual bool closeAll();
110  virtual void exit();
111  void enableSave(bool enable);
112  void discard();
113  void saveAsCubeByOption(QString);
114 
115  protected:
117  void updateTool();
118 
119  private:
120  static void copy(Buffer &in, Buffer &out);
121  QPointer<QAction> p_open;
122  QPointer<QAction> p_browse;
123  QPointer<QAction> p_print;
124  QPointer<QAction> p_save;
125  QPointer<QAction> p_saveAs;
126  QPointer<QAction> p_saveInfo;
127  QPointer<QAction> p_exportView;
128  QPointer<QAction> p_exportToList;
129  QPointer<QAction> p_closeAll;
130  QPointer<QAction> p_exit;
131  QPointer<QWidget> p_parent;
132  QString p_lastDir;
133  QPointer<Workspace> p_workSpace;
134  QPointer<MdiCubeViewport> p_lastViewport;
135  QPointer<SaveAsDialog> p_saveAsDialog;
136 
143  void saveAsFullImage(Cube *icube, Cube *ocube);
144 
155  void copyCubeDetails(const QString & psFileName, Cube *icube,
156  Cube *ocube, int piNumSamples, int piNumLines, int piNumBands);
157 
163  void saveAs_AsIs(Cube *icube, const QString & psOutFile);
164 
172  void saveAs_FullResolution(Cube *pInCube, Cube *pOutCube,
173  int pNumSamples, int pNumLines);
174 
180  void saveAsEnlargedCube(Cube *icube, const QString & psOutFile);
181 
187  void saveAsReducedCube (Cube *icube, const QString & psOutFile);
188  };
189 };
190 
191 #endif
virtual void exportToList()
FileTool::exportToList.
Definition: FileTool.cpp:854
QPointer< QAction > p_browse
Action to browse and open files.
Definition: FileTool.h:122
Buffer for reading and writing cube data.
Definition: Buffer.h:69
void saveChanges(CubeViewport *vp)
This signal is called when changes should be saved.
QPointer< QAction > p_exportView
Action to export the view as a picture.
Definition: FileTool.h:127
QPointer< QAction > saveAction()
Definition: FileTool.h:72
void fileSelected(QString)
This signal is called when a file is selected.
void discard()
This slot emits a signal to discard all changes to the current viewport.
Definition: FileTool.cpp:793
virtual void open()
This method allows the user to navigate and open a cube with a file dialog.
Definition: FileTool.cpp:215
QDir p_dir
Directory.
Definition: FileTool.h:76
QStringList p_fileList
File list.
Definition: FileTool.h:77
QStringList p_filterList
Filter List.
Definition: FileTool.h:74
QPointer< QAction > openAction()
Definition: FileTool.h:68
void discardChanges(CubeViewport *vp)
This signal is called when changes should be discarded.
static void copy(Buffer &in, Buffer &out)
This method copies from the input buffer to the output buffer.
Definition: FileTool.cpp:783
virtual void saveInfo()
Saves the whatsthis info of the cubeviewport.
Definition: FileTool.cpp:749
QPointer< QAction > p_open
Action to open a file.
Definition: FileTool.h:121
void saveAsFullImage(Cube *icube, Cube *ocube)
Saves the cube as a full image.
Definition: FileTool.cpp:663
void enableSave(bool enable)
This slot enables or disables save and save as.
Definition: FileTool.cpp:985
virtual bool closeAll()
Try to close all open cubes and save/discard if necessary.
Definition: FileTool.cpp:945
void addTo(QMenu *menu)
Adds the file tool&#39;s actions to the menu.
Definition: FileTool.cpp:169
void print()
This method allows the user to print the current viewport.
Definition: FileTool.cpp:909
virtual void save()
This method saves any changes made to the current cube, these changes are finalized! There is no undo...
Definition: FileTool.cpp:258
void addToPermanent(QToolBar *perm)
Adds the file tool&#39;s actions to the permanent toolbar.
Definition: FileTool.cpp:203
void saveAsEnlargedCube(Cube *icube, const QString &psOutFile)
Save image AsIs Enlarged into output.
Definition: FileTool.cpp:410
Widget to display Isis cubes for qt apps.
Definition: CubeViewport.h:132
QString menuName() const
Definition: FileTool.h:81
virtual void browse()
This method allows the user to navigate and browse cubes with a file dialog .
Definition: FileTool.cpp:236
QPointer< QAction > p_exit
Action to exit qview.
Definition: FileTool.h:130
virtual void saveAs()
SaveAs Action - Displays the FileDialog with the filterlist (*.cub) to select the output cube...
Definition: FileTool.cpp:284
virtual void exportView()
This method allows the user to export the current view as an image file.
Definition: FileTool.cpp:802
QPointer< QAction > p_print
Action to print the current view.
Definition: FileTool.h:123
void updateTool()
Updates the tool.
Definition: FileTool.cpp:993
void saveAs_AsIs(Cube *icube, const QString &psOutFile)
Save image AsIs (As viewed in the viewport window) into output file.
Definition: FileTool.cpp:525
void saveAsCubeByOption(QString)
Save as Isis Cube (FullImage, AsIs, FullRes)
Definition: FileTool.cpp:317
QPointer< QAction > p_save
Action to save the current cube.
Definition: FileTool.h:124
void saveAs_FullResolution(Cube *pInCube, Cube *pOutCube, int pNumSamples, int pNumLines)
Save image Full Resolution (image viewed in the viewport window) into output.
Definition: FileTool.cpp:701
FileTool(QWidget *parent)
Constructs a FileTool object.
Definition: FileTool.cpp:46
void copyCubeDetails(const QString &psFileName, Cube *icube, Cube *ocube, int piNumSamples, int piNumLines, int piNumBands)
Copy input cube details into output file given its dimensions.
Definition: FileTool.cpp:552
virtual void exit()
Exit the program, this slot called when the exit is chosen from the File menu.
Definition: FileTool.cpp:973
QPointer< QWidget > p_parent
The parent widget of this object.
Definition: FileTool.h:131
QPointer< Workspace > p_workSpace
The workspace being used.
Definition: FileTool.h:133
void saveAsReducedCube(Cube *icube, const QString &psOutFile)
For AsIs option, save the reduced input image visible in the viewport window using the Reduce functio...
Definition: FileTool.cpp:460
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
Base class for the Qisis tools.
Definition: Tool.h:81
QPointer< QAction > p_saveAs
Action save the current cube as a user specified file.
Definition: FileTool.h:125
QPointer< QAction > p_closeAll
Action to close all windows.
Definition: FileTool.h:129
QPointer< SaveAsDialog > p_saveAsDialog
SaveAs Dialog with different save options.
Definition: FileTool.h:135
QPointer< QAction > p_exportToList
Action to export active cubes to a cube list.
Definition: FileTool.h:128
QPointer< MdiCubeViewport > p_lastViewport
The last cubeviewport that was used.
Definition: FileTool.h:134
QPointer< QAction > p_saveInfo
Action to save the current cube&#39;s Whatsthis info.
Definition: FileTool.h:126
IO Handler for Isis Cubes.
Definition: Cube.h:170
QString p_lastDir
The last directory opened.
Definition: FileTool.h:132