Isis 3.0 Programmer Reference
Back | Home
Project.h
Go to the documentation of this file.
1 #ifndef Project_H
2 #define Project_H
3 
25 #include <QDir>
26 #include <QObject>
27 #include <QPointer>
28 #include <QStringList>
29 #include <QUndoStack>
30 #include <QXmlDefaultHandler>
31 
32 class QMutex;
33 class QProgressBar;
34 class QXmlAttributes;
35 class QXmlStreamWriter;
36 
37 #include "ControlList.h"
38 #include "Directory.h"
39 #include "GuiCameraList.h"
40 #include "ImageList.h"
41 #include "ShapeList.h"
42 #include "TargetBody.h"
43 #include "XmlStackedHandler.h"
44 
45 namespace Isis {
46  class BundleSolutionInfo;
47  class BundleSettings;
48  class Control;
49  class ControlList;
50  class CorrelationMatrix;
51  class FileName;
52  class Shape;
53  class ImageReader;
54  class ProgressBar;
55  class ShapeReader;
56  class WorkOrder;
57 
105  class Project : public QObject {
106  Q_OBJECT
107  public:
108  Project(Directory &directory, QObject *parent = 0);
109  ~Project();
110 
112  static QStringList shapes(QStringList);
113 // static QStringList verifyCNets(QStringList);
114 
116  QDir addBundleSolutionInfoFolder(QString folder);
117  QDir addCnetFolder(QString prefix);
118  void addControl(Control *control);
119  QDir addImageFolder(QString prefix);
120  void addImages(QStringList imageFiles);
121  void addImages(ImageList newImages);
122  QDir addShapeFolder(QString prefix);
123  void addShapes(QStringList shapeFiles);
124  void addShapes(ShapeList newShapes);
125  void addBundleSolutionInfo(BundleSolutionInfo *bundleSolutionInfo);
126  void loadBundleSolutionInfo(BundleSolutionInfo *bundleSolutionInfo);
127  Control *control(QString id);
128  Directory *directory() const;
129  Image *image(QString id);
130  ImageList *imageList(QString name);
131  Shape *shape(QString id);
132  ShapeList *shapeList(QString name);
133 // CorrelationMatrix *correlationMatrix();
134  bool isTemporaryProject() const;
135  WorkOrder *lastNotUndoneWorkOrder();
136  const WorkOrder *lastNotUndoneWorkOrder() const;
137  QString name() const;
138  QMutex *mutex();
139  QString projectRoot() const;
140  void setName(QString newName);
141  QUndoStack *undoStack();
142  void waitForImageReaderFinished();
143  void waitForShapeReaderFinished();
145 
146  void setActiveControl(Control *);
150 
151  static QString cnetRoot(QString projectRoot);
152  QString cnetRoot() const;
153  QList<ControlList *> controls();
154  ControlList *controlList(QString name);
155 
156  static QString imageDataRoot(QString projectRoot);
157  QString imageDataRoot() const;
158  QList<ImageList *> images();
159 
160  static QString shapeDataRoot(QString projectRoot);
161  QString shapeDataRoot() const;
162  QList<ShapeList *> shapes();
163 
164  static QString targetBodyRoot(QString projectRoot);
165  QString targetBodyRoot() const;
166  TargetBodyList targetBodies();
167 
168  static QString resultsRoot(QString projectRoot);
169  QString resultsRoot() const;
170  static QString bundleSolutionInfoRoot(QString projectRoot);
171  QString bundleSolutionInfoRoot() const;
172  QList<BundleSolutionInfo *> bundleSolutionInfo();
173 
174  void deleteAllProjectFiles();
175  void relocateProjectRoot(QString newRoot);
176 
177  BundleSettings *bundleSettings() {return m_bundleSettings;}
178 
179  QProgressBar *progress();
180 
181  void removeImages(ImageList &imageList);
182 
183  void save();
184  void save(FileName newPath, bool verifyPathDoesntExist = true);
185 
186  void addToProject(WorkOrder *);
187 
188  template<typename Data> void warn(QString text, Data relevantData);
189 
190  void warn(QString text);
191 
192  signals:
196 // void allImagesClosed();
197 
202  void controlListAdded(ControlList *controls);
203 
208  void controlAdded(Control *control);
209 
214  void imagesAdded(ImageList *images);
215 
220  void shapesAdded(ShapeList *shapes);
221 
226  void bundleSolutionInfoAdded(BundleSolutionInfo *bundleSolutionInfo);
227 
232  void targetsAdded(TargetBodyList *targets);
233 
238  void guiCamerasAdded(GuiCameraList *targets);
239 
244  void nameChanged(QString newName);
245 
250  void projectLoaded(Project *);
251 
256  void projectRelocated(Project *);
257 
258  void workOrderStarting(WorkOrder *);
259  void workOrderFinished(WorkOrder *);
260 
261  public slots:
262  void open(QString);
263 
264  private slots:
265  void controlClosed(QObject *control);
266  void controlListDeleted(QObject *controlList);
267  void imagesReady(ImageList);
268  void addTargetsFromImportedImagesToProject(ImageList *imageList);
269  void addCamerasFromImportedImagesToProject(ImageList *imageList);
270  void imageClosed(QObject *image);
271  void imageListDeleted(QObject *imageList);
272  void bundleSolutionInfoClosed(QObject *bundleSolutionInfo);
273  void targetBodyClosed(QObject *targetBodyObj);
274  void shapesReady(ShapeList shapes);
275  void shapeClosed(QObject *shape);
276  void shapeListDeleted(QObject *shapeList);
277 
278  private:
279  Project(const Project &other);
280  Project &operator=(const Project &rhs);
281  void createFolders();
282  ControlList *createOrRetrieveControlList(QString name);
283  ImageList *createOrRetrieveImageList(QString name);
284  ShapeList *createOrRetrieveShapeList(QString name);
285 
286 
287  QString nextImageListGroupName();
288 // void removeImage(Image *image);
289 
290  void save(QXmlStreamWriter &stream, FileName newProjectRoot) const;
291  void saveHistory(QXmlStreamWriter &stream) const;
292  void saveWarnings(QXmlStreamWriter &stream) const;
293 
294  void storeWarning(QString text);
295  void storeWarning(QString text, const ImageList &relevantData);
296 
297  private:
303  class XmlHandler : public XmlStackedHandler {
304  public:
305  XmlHandler(Project *project);
306 
307  virtual bool startElement(const QString &namespaceURI, const QString &localName,
308  const QString &qName, const QXmlAttributes &atts);
309  virtual bool endElement(const QString &namespaceURI, const QString &localName,
310  const QString &qName);
311 
312  private:
313  Q_DISABLE_COPY(XmlHandler);
314 
315  Project *m_project;
316  QList<ImageList *> m_imageLists;
317  QList<ShapeList *> m_shapeLists;
318  QList<ControlList *> m_controls;
319  WorkOrder *m_workOrder;
320  };
321 
322  private:
323  QDir *m_projectRoot;
324  QDir *m_cnetRoot;
325  QDir m_currentCnetFolder;
326  QPointer<Directory> m_directory;
327  QList<ImageList *> *m_images;
328  QList<ControlList *> *m_controls;
329  QList<ShapeList *> *m_shapes;
330  TargetBodyList *m_targets;
331  GuiCameraList *m_guiCameras;
332 
333  QPointer<Control> m_activeControl;
334  QPointer<ImageList> m_activeImageList;
335 
336  QList<BundleSolutionInfo *> *m_bundleSolutionInfo;
337 
338  // TODO: kle testing - this will almost certainly be changed
339  BundleSettings *m_bundleSettings;
347 // CorrelationMatrix *m_correlationMatrix;
348 
350  QMap<QString, Image *> *m_idToImageMap;
351  QMap<QString, Shape *> *m_idToShapeMap;
352  QMap<QString, BundleSolutionInfo *> *m_idToBundleSolutionInfoMap;
353  QMap<QString, TargetBody *> *m_idToTargetBodyMap;
354  QMap<QString, GuiCamera *> *m_idToGuiCameraMap;
355 
356  QString m_name;
357  QStringList *m_warnings;
358  QList< QPointer<WorkOrder> > *m_workOrderHistory;
359 
360  QPointer<ImageReader> m_imageReader;
361  //QList<QPair<QString, Data> > m_storedWarnings;
362  bool m_isTemporaryProject;
363 
364  int m_numImagesCurrentlyReading;
365 
366  QMutex *m_mutex;
367  QMutex *m_imageReadingMutex;
368 
369  int m_numShapesCurrentlyReading;
370  QMutex *m_shapeMutex;
371  QPointer<ShapeReader> m_shapeReader;
372  QMutex *m_shapeReadingMutex;
373 
374  QUndoStack m_undoStack;
375 
376  };
377 }
378 
380 
381 #endif // Project_H
This represents an ISIS control net in a project-based GUI interface.
Definition: Control.h:57
Internalizes a list of shapes and allows for operations on the entire list.
Definition: ShapeList.h:33
QString targetBodyRoot() const
Accessor for the root directory of the target body data.
Definition: Project.cpp:1320
QDir addImageFolder(QString prefix)
Create and return the name of a folder for placing images.
Definition: Project.cpp:686
Internalizes a list of images and allows for operations on the entire list.
Definition: ImageList.h:44
void controlClosed(QObject *control)
A control is being deleted from the project.
Definition: Project.cpp:1761
The main project for cnetsuite.
Definition: Project.h:105
~Project()
Clean up the project.
Definition: Project.cpp:219
QString name() const
Get the project&#39;s GUI name.
Definition: Project.cpp:1050
File name manipulation and expansion.
Definition: FileName.h:111
QList< WorkOrder * > workOrderHistory()
Get the entire list of work orders that have executed.
Definition: Project.cpp:1149
Container class for BundleAdjustment results.
QMutex * mutex()
Return mutex used for Naif calls.
Definition: Project.cpp:1079
QString bundleSolutionInfoRoot() const
Accessor for the root directory of the results data.
Definition: Project.cpp:1370
Maintains a list of Controls so that control nets can easily be copied from one Project to another...
Definition: ControlList.h:34
void controlListDeleted(QObject *controlList)
An control list is being deleted from the project.
Definition: Project.cpp:1780
void open(QString)
Open the project at the given path.
Definition: Project.cpp:838
void saveHistory(QXmlStreamWriter &stream) const
Serialize the work orders into the given XML.
Definition: Project.cpp:518
void addControl(Control *control)
Add the given Control&#39;s to the current project.
Definition: Project.cpp:646
void controlListAdded(ControlList *controls)
apparently not used?
void targetBodyClosed(QObject *targetBodyObj)
A target body is being deleted from the project.
Definition: Project.cpp:1828
Q_DECLARE_METATYPE(Isis::Cube *)
This allows Cube *&#39;s to be stored in a QVariant.
List for holding TargetBodies.
Control * activeControl()
Return the Active Control (control network)
Definition: Project.cpp:1182
QString cnetRoot() const
Get where control networks ought to be stored inside the project.
Definition: Project.cpp:1230
void projectLoaded(Project *)
Emitted when project loaded receivers: CNetSuiteMainWindow, Directory, HistoryTreeWidget.
QString resultsRoot() const
Accessor for the root directory of the results data.
Definition: Project.cpp:1345
void createFolders()
This creates the project root, image root, and control net root directories.
Definition: Project.cpp:335
void relocateProjectRoot(QString newRoot)
This is called when the project is moved.
Definition: Project.cpp:1413
static QStringList images(QStringList)
Verify that the input fileNames are image files.
Definition: Project.cpp:561
void addBundleSolutionInfo(BundleSolutionInfo *bundleSolutionInfo)
Add the given BundleSolutionInfo to the current project.
Definition: Project.cpp:789
void saveWarnings(QXmlStreamWriter &stream) const
Serialize the warnings into the given XML.
Definition: Project.cpp:541
QString shapeDataRoot() const
Accessor for the root directory of the shape model data.
Definition: Project.cpp:1290
void addToProject(WorkOrder *)
Run the work order and stores it in the project.
Definition: Project.cpp:1546
void imageClosed(QObject *image)
An image is being deleted from the project.
Definition: Project.cpp:1730
Parent class for anything that performs an action in Project.
Definition: WorkOrder.h:104
void bundleSolutionInfoAdded(BundleSolutionInfo *bundleSolutionInfo)
Emitted when new BundleSolutionInfo available from jigsaw receivers: ProjectTreeWidget (TODO: should ...
void shapeListDeleted(QObject *shapeList)
A shape model list is being deleted from the project.
Definition: Project.cpp:1791
void shapeClosed(QObject *shape)
A shape model is being deleted from the project.
Definition: Project.cpp:1884
void deleteAllProjectFiles()
Delete all of the files, that this project stores, from disk.
Definition: Project.cpp:1378
Container class for BundleAdjustment settings.
XML Handler that parses XMLs in a stack-oriented way.
void guiCamerasAdded(GuiCameraList *targets)
Emitted when new GuiCamera objects added to project receivers: Directory.
ImageList * activeImageList()
Returns the active ImageList.
Definition: Project.cpp:1210
void controlAdded(Control *control)
Emitted when new Control added to Project receivers: ProjectTreeWidget.
This represents a cube in a project-based GUI interface.
Definition: Image.h:91
QDir addBundleSolutionInfoFolder(QString folder)
Create and return the name of a folder for placing BundleSolutionInfo.
Definition: Project.cpp:594
void projectRelocated(Project *)
Emitted when project location moved receivers: Control, BundleSolutionInfo, Image, TargetBody.
Directory * directory() const
Returns the directory associated with this Project.
Definition: Project.cpp:824
void imageListDeleted(QObject *imageList)
An image list is being deleted from the project.
Definition: Project.cpp:1750
void addShapes(QStringList shapeFiles)
Read the given shape model cube file names as Images and add them to the project. ...
Definition: Project.cpp:764
QList< QAction * > userPreferenceActions()
Get a list of configuration/settings actions related to reading images into this Project.
Definition: Project.cpp:583
void shapesAdded(ShapeList *shapes)
Emitted when new shape model images are available.
void addImages(QStringList imageFiles)
Read the given cube file names as Images and add them to the project.
Definition: Project.cpp:714
QDir addShapeFolder(QString prefix)
Create and return the name of a folder for placing shape models.
Definition: Project.cpp:736
List of GuiCameras saved as QSharedPointers.
Definition: GuiCameraList.h:35
void nameChanged(QString newName)
Emitted when project name is changed receivers: ProjectTreeWidget.
void imagesAdded(ImageList *images)
Emitted when new images are available.
void setName(QString newName)
Change the project&#39;s name (GUI only, doesn&#39;t affect location on disk).
Definition: Project.cpp:1095
This represents a shape in a project-based GUI interface.
Definition: Shape.h:70
void bundleSolutionInfoClosed(QObject *bundleSolutionInfo)
A BundleSolutionInfo object is being deleted from the project.
Definition: Project.cpp:1802
QMap< QString, Control * > * m_idToControlMap
This variable will probably go away when we add the bundle results object because it will be under: B...
Definition: Project.h:349
void targetsAdded(TargetBodyList *targets)
Emitted when new TargetBody objects added to project receivers: Directory.
QString projectRoot() const
Get the top-level folder of the project.
Definition: Project.cpp:1087
QDir addCnetFolder(QString prefix)
Create and return the name of a folder for placing control networks.
Definition: Project.cpp:614
void setActiveImageList(ImageList *)
Set the Active ImageList.
Definition: Project.cpp:1196
void setActiveControl(Control *)
Set the Active Control (control network)
Definition: Project.cpp:1168
QString imageDataRoot() const
Accessor for the root directory of the image data.
Definition: Project.cpp:1270
Project(Directory &directory, QObject *parent=0)
Create a new Project.
Definition: Project.cpp:73

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:26:43