Isis 3 Programmer Reference
Directory.h
Go to the documentation of this file.
1 #ifndef Directory_H
2 #define Directory_H
3 
26 #include <QMainWindow>
27 #include <QMultiMap>
28 #include <QObject>
29 #include <QPointer>
30 #include <QString>
31 #include <QtDebug>
32 
33 
34 #include "GuiCameraList.h"
35 #include "ImageList.h"
36 #include "MosaicSceneWidget.h"
37 #include "TargetBodyList.h"
38 #include "TemplateList.h"
39 #include "WorkOrder.h"
40 
41 class QAction;
42 class QDockWidget;
43 class QMainWindow;
44 class QMenuBar;
45 class QProgressBar;
46 class QSplitter;
47 class QTabWidget;
48 
49 namespace Isis {
50  class AbstractProjectItemView;
51  class BundleObservation;
52  class BundleObservationView;
53  class ChipViewportsWidget;
54  class CnetEditorView;
55  class CnetEditorWidget;
56  class Control;
57  class ControlNet;
58  class ControlPointEditView;
59  class ControlHealthMonitorView;
60  class CubeDnView;
61  class FileItem;
62  class Footprint2DView;
63  class HistoryTreeWidget;
64  class ImageFileListWidget;
65  class JigsawRunWidget;
66  class MatrixSceneWidget;
67  class MosaicSceneWidget;
68  class Project;
69  class ProjectItem;
70  class ProjectItemModel;
71  class ProjectItemTreeView;
72  class SensorInfoWidget;
73  class TargetBody;
74  class TargetInfoWidget;
75  class TemplateEditorWidget;
76  class WarningTreeWidget;
77  class WorkOrder;
78  class Workspace;
79 
285  class Directory : public QObject {
286  Q_OBJECT
287  public:
288  explicit Directory(QObject *parent = 0);
289  ~Directory();
290 
291  void clean();
292  void setHistoryContainer(QDockWidget *historyContainer);
293  void setWarningContainer(QDockWidget *warningContainer);
294  void setRecentProjectsList(QStringList recentProjects);
296 
297  // When adding a new view if the possibility exists for more than 1 of the view make sure
298  // to use a QUuid for the objectName so that save/restoreState will work for the view. Also,
299  // make sure the objectName is serialized to the project. For more info, see ::addCubeDnView,
300  // ::XmlHandler::startElement and CubeDnView::save.
302  ControlHealthMonitorView *addControlHealthMonitorView();
303  CnetEditorView *addCnetEditorView(Control *control, QString objectName = "");
304  CubeDnView *addCubeDnView(QString objectName = "");
305  Footprint2DView *addFootprint2DView(QString objectName = "");
306  JigsawRunWidget *addJigsawRunWidget();
311  ImageFileListWidget *addImageFileListView(QString objectName = "");
312  ControlPointEditView *addControlPointEditView();
313 
314 
316 
318 
319  Project *project() const;
320 
327 
331 
332  QList<BundleObservationView *> bundleObservationViews();
342  ControlHealthMonitorView *controlHealthMonitorView();
344  JigsawRunWidget *jigsawRunWidget();
345 // ChipViewportsWidget *controlPointChipViewports();
346 
347  bool controlUsedInCnetEditorWidget(Control *control);
348 
349  // Return the control point Id currently in the ControlPointEditWidget, if it exists
350  QString editPointId();
351 
352 
358  template <typename DataType>
360  QList<QAction *> results;
361 
362 // QList< QPair< QString, QList<QAction *> > > actionPairings;
363 
364  //foreach (MosaicSceneWidget *footprint2DView, m_footprint2DViewWidgets) {
365 // actionPairings.append(
366  // qMakePair(footprint2DView->windowTitle(), footprint2DView->supportedActions(data)));
367 // }
368 
369 // results.append(restructureActions(actionPairings));
370 
371 // if (!results.isEmpty()) {
372 // results.append(NULL);
373 // }
374 // qDebug()<<"Directory.h::supportedActions #workorders = "<<m_workOrders.size();
375  foreach (WorkOrder *workOrder, m_workOrders) {
376  if (workOrder->isExecutable(data)) {
377  WorkOrder *clone = workOrder->clone();
378  clone->setData(data);
379  results.append(clone);
380  }
381  }
382 
383  return results;
384  }
385 
386  void showWarning(QString text);
387 
388 
394  template <typename Data>
395  void showWarning(QString text, Data data) {
396  //m_warningTreeWidget->showWarning(text, data);
397  }
398 
400 
401  QAction *redoAction();
402  QAction *undoAction();
403 
404  void load(XmlStackedHandlerReader *xmlReader);
405  void save(QXmlStreamWriter &stream, FileName newProjectRoot) const;
406 
407  signals:
408  void directoryCleaned();
409  void newWarning();
410  void newDockAvailable(QMainWindow *newWidget);
411  void newWidgetAvailable(QWidget *newWidget);
412 
413  void closeView(QWidget *widget);
414 
415  void cnetModified();
416  void activeControlModified();
417 
418  void redrawMeasures();
419 
420  void cleanProject(bool);
421 
422  public slots:
433  void cleanupJigsawRunWidget(QObject *);
434  //void imagesAddedToProject(ImageList *images);
436 
437  // Slots in response to mouse clicks on CubeDnView (ControlNetTool) and
438  // Footprint2DView (MosaicControlNetTool)
439  void modifyControlPoint(ControlPoint *controlPoint, QString serialNumber = "");
440  void deleteControlPoint(ControlPoint *controlPoint);
441  void createControlPoint(double latitude, double longitude, Cube *cube = 0,
442  bool isGroundSource = false);
443 
444 
446  void updateRecentProjects();
447 
448  private slots:
449  void initiateRenameProjectWorkOrder(QString projectName);
450  void newActiveControl(bool newControl);
452 
453  private:
459  class XmlHandler : public XmlStackedHandler {
460  public:
461  XmlHandler(Directory *directory);
462  ~XmlHandler();
463 
464  virtual bool startElement(const QString &namespaceURI, const QString &localName,
465  const QString &qName, const QXmlAttributes &atts);
466 
467  private:
468  Q_DISABLE_COPY(XmlHandler);
469 
471  };
472 
473  private:
474  Directory(const Directory &other);
475  Directory &operator=(const Directory &rhs);
476 
485  template <typename WorkOrderType>
486  WorkOrderType *createWorkOrder() {
487  WorkOrderType *newWorkOrder = new WorkOrderType(m_project);
488  m_workOrders.append(newWorkOrder);
489  return newWorkOrder;
490  }
491 
492 
494  static bool actionTextLessThan(QAction *lhs, QAction *rhs);
495 
496  void initializeActions();
497 
498  QPointer<ProjectItemModel> m_projectItemModel;
499 
500 
501  QPointer<HistoryTreeWidget> m_historyTreeWidget;
502  QPointer<Project> m_project;
503  QPointer<WarningTreeWidget> m_warningTreeWidget;
504  QPointer<JigsawRunWidget> m_jigsawRunWidget;
505 
506 
508  QList< QPointer<BundleObservationView> > m_bundleObservationViews;
513 
514  QPointer<ControlHealthMonitorView> m_controlHealthMonitorView;
515  QPointer <ControlPointEditView> m_controlPointEditViewWidget;
516  //QPointer <ChipViewportsWidget> m_chipViewports;
521 
523 
525 
526  // We only need to store the work orders that go into menus uniquely... all work orders
527  // (including these) should be stored in m_workOrders
528  QPointer<WorkOrder> m_exportControlNetWorkOrder;
529  QPointer<WorkOrder> m_exportImagesWorkOrder;
530  QPointer<WorkOrder> m_importControlNetWorkOrder;
531  QPointer<WorkOrder> m_importImagesWorkOrder;
532  QPointer<WorkOrder> m_importShapesWorkOrder;
533  QPointer<WorkOrder> m_openProjectWorkOrder;
534  QPointer<WorkOrder> m_saveProjectWorkOrder;
535  QPointer<WorkOrder> m_saveProjectAsWorkOrder;
536  QPointer<WorkOrder> m_openRecentProjectWorkOrder;
537  QPointer<WorkOrder> m_closeProjectWorkOrder;
538  QPointer<WorkOrder> m_importMapTemplateWorkOrder;
540 
541  QPointer<WorkOrder> m_runJigsawWorkOrder;
542  QPointer<WorkOrder> m_renameProjectWorkOrder;
543 
550 
554 
555  QMultiMap<Control*, CnetEditorView *> m_controlMap;
556 
557  QString m_editPointId;
558 
559  bool m_recentProjectsLoaded;
560  };
561 }
562 
563 #endif // Directory_H
This represents an ISIS control net in a project-based GUI interface.
Definition: Control.h:79
~XmlHandler()
The Destructor for Directory::XmlHandler.
Definition: Directory.cpp:1600
QList< QAction * > editMenuActions()
Get the list of actions that the Directory can provide for the edit menu.
Definition: Directory.cpp:238
QList< CnetEditorView * > cnetEditorViews()
Returns a list of all the control network views for this directory.
Definition: Directory.cpp:1334
QList< MatrixSceneWidget * > matrixViews()
Accessor for the list of MatrixSceneWidgets currently available.
Definition: Directory.cpp:1364
QList< QAction * > projectMenuActions()
Get the list of actions that the Directory can provide for the project menu.
Definition: Directory.cpp:229
QList< QAction * > toolPadActions()
Get the list of actions that the Directory can provide for the Tool Pad.
Definition: Directory.cpp:292
void cleanupMatrixViewWidgets(QObject *)
Removes pointers to deleted MatrixSceneWidget objects.
Definition: Directory.cpp:1248
QPointer< WorkOrder > m_saveProjectWorkOrder
The Save Project WorkOrder.
Definition: Directory.h:534
Ipce view containing the CnetEditorWidget.
void modifyControlPoint(ControlPoint *controlPoint, QString serialNumber="")
Slot that is connected from a left mouse button operation on views.
Definition: Directory.cpp:1850
Widget for displaying information about a sensor.
QList< QAction * > activeToolBarActions()
Get the list of actions that the Directory can provide for the active Tool Bar.
Definition: Directory.cpp:283
The main project for ipce.
Definition: Project.h:289
QList< QPointer< SensorInfoWidget > > m_sensorInfoWidgets
List of SensorInfoWidgets.
Definition: Directory.h:518
QList< QAction * > supportedActions(DataType data)
Returns a list of supported actions for a WorkOrder.
Definition: Directory.h:359
ImageFileListWidget * addImageFileListView(QString objectName="")
Add an imageFileList widget to the window.
Definition: Directory.cpp:1040
File name manipulation and expansion.
Definition: FileName.h:116
void save(QXmlStreamWriter &stream, FileName newProjectRoot) const
Save the directory to an XML file.
Definition: Directory.cpp:1537
QList< ImageFileListWidget * > imageFileListViews()
Accessor for the list of ImageFileListWidgets currently available.
Definition: Directory.cpp:1439
QList< TemplateEditorWidget * > templateEditorViews()
Accessor for the list of TemplateEditorWidgets currently available.
Definition: Directory.cpp:1409
QStringList recentProjectsList()
Public accessor for the list of recent projects.
Definition: Directory.cpp:607
void createControlPoint(double latitude, double longitude, Cube *cube=0, bool isGroundSource=false)
Slot that is connected from a right mouse button operation on views.
Definition: Directory.cpp:1903
~Directory()
The Destructor.
Definition: Directory.cpp:205
void cleanupTemplateEditorWidgets(QObject *)
Removes pointers to deleted TemplateEditorWidget objects.
Definition: Directory.cpp:1290
View for displaying footprints of images in a QMos like way.
void cleanupTargetInfoWidgets(QObject *)
Removes pointers to deleted TargetInfoWidget objects.
Definition: Directory.cpp:1276
void cleanupFootprint2DViewWidgets(QObject *)
Removes pointers to deleted Footprint2DView objects.
Definition: Directory.cpp:1219
QMultiMap< Control *, CnetEditorView * > m_controlMap
Map to hold every view with an open Control.
Definition: Directory.h:555
QPointer< WorkOrder > m_importControlNetWorkOrder
The import ControlNetwork WorkOrder.
Definition: Directory.h:530
void cleanupFileListWidgets(QObject *)
Removes pointers to deleted ImageFileListWidget objects.
Definition: Directory.cpp:1205
TargetInfoWidget * addTargetInfoView(TargetBodyQsp target)
Add target body data view widget to the window.
Definition: Directory.cpp:959
void cleanupSensorInfoWidgets(QObject *)
Removes pointers to deleted SensorInfoWidget objects.
Definition: Directory.cpp:1262
QList< QAction * > m_settingsMenuActions
List of menu settings actions.
Definition: Directory.h:548
MatrixSceneWidget * addMatrixView()
Add the matrix view widget to the window.
Definition: Directory.cpp:938
QList< QAction * > m_helpMenuActions
List of help menu actions.
Definition: Directory.h:549
Widget for displaying information about a target.
void showWarning(QString text)
Displays a Warning.
Definition: Directory.cpp:1495
void cleanupCubeDnViewWidgets(QObject *)
Removes pointers to deleted CubeDnView objects.
Definition: Directory.cpp:1191
Directory * m_directory
Pointer to a Directory which is set by the XmlHandler class.
Definition: Directory.h:470
static bool actionTextLessThan(QAction *lhs, QAction *rhs)
This is for determining the ordering of the descriptive text of for the actions.
Definition: Directory.cpp:1807
bool controlUsedInCnetEditorWidget(Control *control)
Return true if control is not currently being viewed in a CnetEditorWidget
Definition: Directory.cpp:1175
QPointer< WorkOrder > m_runJigsawWorkOrder
The Run Jigsaw WorkOrder.
Definition: Directory.h:541
QList< QAction * > viewMenuActions()
Get the list of actions that the Directory can provide for the view menu.
Definition: Directory.cpp:247
void clean()
Cleans directory of everything to do with the current project.
Definition: Directory.cpp:303
void cleanupControlPointEditViewWidget(QObject *)
Delete the ControlPointEditWidget and set it&#39;s pointer to NULL.
Definition: Directory.cpp:1233
QList< QPointer< CubeDnView > > m_cubeDnViewWidgets
List of CubeDnCiew obs.
Definition: Directory.h:510
QString m_editPointId
Current control point that is in the ControlPointEditWidget.
Definition: Directory.h:557
QPointer< ProjectItemModel > m_projectItemModel
Pointer to the ProjectItemModel.
Definition: Directory.h:498
This widget encompasses the entire matrixDisplay scene.
ControlPointEditView * controlPointEditView()
Gets the ControlPointEditWidget associated with the Directory.
Definition: Directory.cpp:1453
void setRecentProjectsList(QStringList recentProjects)
Add recent projects to the recent projects list.
Definition: Directory.cpp:549
QList< TargetInfoWidget * > targetInfoViews()
Accessor for the list of TargetInfoWidgets currently available.
Definition: Directory.cpp:1394
QString editPointId()
Return the current control point id loaded in the ControlPointEditWidget.
Definition: Directory.cpp:1923
View for displaying BundleObservation CSV files.
QPointer< WorkOrder > m_importRegistrationTemplateWorkOrder
The Import Registration Template WorkOrder.
Definition: Directory.h:539
View for editing a single ControlPoint.
QList< QAction * > m_projectMenuActions
List of project menu actions.
Definition: Directory.h:545
QList< QAction * > permToolBarActions()
Get the list of actions that the Directory can provide for the permanent Tool Bar.
Definition: Directory.cpp:274
Provides access to data stored in a Project through Qt&#39;s model-view framework.
QAction * undoAction()
Creates an Action to undo the last action.
Definition: Directory.cpp:1514
QPointer< WorkOrder > m_openProjectWorkOrder
The Open Project WorkOrder.
Definition: Directory.h:533
QList< QAction * > m_fileMenuActions
List of file menu actions.
Definition: Directory.h:544
void load(XmlStackedHandlerReader *xmlReader)
Loads the Directory from an XML file.
Definition: Directory.cpp:1523
QList< Footprint2DView * > footprint2DViews()
Accessor for the list of Footprint2DViews currently available.
Definition: Directory.cpp:1424
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
The XML reader invokes this method at the start of every element in the XML document.
Definition: Directory.cpp:1619
virtual bool isExecutable(Context)
Re-implement this method if your work order utilizes controls for data in order to operate...
Definition: WorkOrder.cpp:196
QList< QAction * > settingsMenuActions()
Get the list of actions that the Directory can provide for the settings menu.
Definition: Directory.cpp:256
void updateRecentProjects()
Loads and displays a list of recently opened projects in the file menu.
Definition: Directory.cpp:332
QPointer< WorkOrder > m_importShapesWorkOrder
The import shapes WorkOrder.
Definition: Directory.h:532
static QList< QAction * > restructureActions(QList< QPair< QString, QList< QAction *> > >)
Reformat actionPairings to be user friendly for use in menus.
Definition: Directory.cpp:1707
QList< QAction * > fileMenuActions()
Get the list of actions that the Directory can provide for the file menu.
Definition: Directory.cpp:220
Directory(QObject *parent=0)
The Constructor.
Definition: Directory.cpp:119
ProjectItemModel * model()
Gets the ProjectItemModel for this directory.
Definition: Directory.cpp:1105
Provide Undo/redo abilities, serialization, and history for an operation.
Definition: WorkOrder.h:322
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
void initiateRenameProjectWorkOrder(QString projectName)
Slot which is connected to the model&#39;s signal, projectNameEdited, which is emitted when the user doub...
Definition: Directory.cpp:1092
ProjectItemTreeView * addProjectItemTreeView()
Adds a ProjectItemTreeView to the window.
Definition: Directory.cpp:1067
QList< QAction * > m_editMenuActions
List of edit menu actions.
Definition: Directory.h:546
QList< SensorInfoWidget * > sensorInfoViews()
Accessor for the list of SensorInfoWidgets currently available.
Definition: Directory.cpp:1379
QList< QPointer< Footprint2DView > > m_footprint2DViewWidgets
List of Footprint2DView objs.
Definition: Directory.h:512
QAction * redoAction()
Creates an Action to redo the last action.
Definition: Directory.cpp:1505
void cleanupBundleObservationViews(QObject *)
Removes pointers to deleted BundleObservationView objects.
Definition: Directory.cpp:1122
Footprint2DView * addFootprint2DView(QString objectName="")
Add the qmos view widget to the window.
Definition: Directory.cpp:771
QList< QProgressBar * > progressBars()
Gets the ControlNetEditor associated with this the Directory.
Definition: Directory.cpp:1485
BundleObservationView * addBundleObservationView(FileItemQsp fileItem)
Add the BundleObservationView to the window.
Definition: Directory.cpp:616
WorkOrderType * createWorkOrder()
Create a work order, append it to m_workOrders, and return it.
Definition: Directory.h:486
QPointer< WorkOrder > m_saveProjectAsWorkOrder
The Save Project As WorkOrder.
Definition: Directory.h:535
A ProjectItemTreeView displays items from a ProjectItemProxyModel in a tree structure.
XML Handler that parses XMLs in a stack-oriented way.
void setWarningContainer(QDockWidget *warningContainer)
Set up the warning info in the warning dockable widget.
Definition: Directory.cpp:537
Widget for displaying information about a target.
QList< CubeDnView * > cubeDnViews()
Accessor for the list of CubeDnViews currently available.
Definition: Directory.cpp:1349
A single control point.
Definition: ControlPoint.h:369
void setHistoryContainer(QDockWidget *historyContainer)
Set up the history info in the history dockable widget.
Definition: Directory.cpp:525
virtual void setData(Context)
Sets the context data for this WorkOrder.
Definition: WorkOrder.cpp:262
void cleanupCnetEditorViewWidgets(QObject *)
Removes pointers to deleted Control Health Monitor objects.
Definition: Directory.cpp:1149
QPointer< WorkOrder > m_openRecentProjectWorkOrder
The Open Recent Project WorkOrder.
Definition: Directory.h:536
QPointer< Project > m_project
Pointer to the Project.
Definition: Directory.h:502
QList< QAction * > m_toolPadActions
List of ToolPad actions.
Definition: Directory.h:553
XmlHandler(Directory *directory)
This function sets the Directory pointer for the Directory::XmlHandler class.
Definition: Directory.cpp:1592
QWidget * warningWidget()
Returns a pointer to the warning widget.
Definition: Directory.cpp:1114
QPointer< WorkOrder > m_importMapTemplateWorkOrder
The Import Map Template WorkOrder.
Definition: Directory.h:538
QPointer< HistoryTreeWidget > m_historyTreeWidget
Pointer to the HistoryTreeWidget.
Definition: Directory.h:501
QList< QAction * > m_permToolBarActions
List of perm ToolBar actions.
Definition: Directory.h:551
void newActiveControl(bool newControl)
This slot is connected from the signal activeControlSet(bool) emitted from Project.
Definition: Directory.cpp:581
QPointer< WorkOrder > m_renameProjectWorkOrder
The Rename Project WorkOrder.
Definition: Directory.h:542
A colored, grouped cube list.
QList< QAction * > m_viewMenuActions
List of view menu actions.
Definition: Directory.h:547
View that displays cubes in a QView-like way.
Definition: CubeDnView.h:111
QPointer< WarningTreeWidget > m_warningTreeWidget
Pointer to the WarningTreeWidget.
Definition: Directory.h:503
void updateControlNetEditConnections()
Updates the SIGNAL/SLOT connections for the cotrol net editor.
Definition: Directory.cpp:1816
SensorInfoWidget * addSensorInfoView(GuiCameraQsp camera)
Add sensor data view widget to the window.
Definition: Directory.cpp:1018
QList< QAction * > helpMenuActions()
Get the list of actions that the Directory can provide for the help menu.
Definition: Directory.cpp:265
QList< QPointer< MatrixSceneWidget > > m_matrixViewWidgets
List of MatrixSceneWidgets.
Definition: Directory.h:517
QPointer< WorkOrder > m_exportImagesWorkOrder
The export images WorkOrder.
Definition: Directory.h:529
QPointer< JigsawRunWidget > m_jigsawRunWidget
Pointer to the JigsawRunWidget.
Definition: Directory.h:504
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
Project * project() const
Gets the Project for this directory.
Definition: Directory.cpp:1325
QPointer< WorkOrder > m_exportControlNetWorkOrder
The export ControlNetwork WorkOrder.
Definition: Directory.h:528
QList< QPointer< TargetInfoWidget > > m_targetInfoWidgets
List of TargetInfoWidgets.
Definition: Directory.h:519
QPointer< WorkOrder > m_importImagesWorkOrder
The import images WorkOrder.
Definition: Directory.h:531
QList< QPointer< CnetEditorView > > m_cnetEditorViewWidgets
List of CnetEditorViews.
Definition: Directory.h:509
QList< QAction * > m_activeToolBarActions
List of active ToolBar actions.
Definition: Directory.h:552
void reloadActiveControlInCnetEditorView()
This slot was created specifically for the CnetEditorWidgets when user chooses a new active control a...
Definition: Directory.cpp:563
void showWarning(QString text, Data data)
Shows warning text for a Widget.
Definition: Directory.h:395
View for the Control Net Health Monitor.
CnetEditorView * addCnetEditorView(Control *control, QString objectName="")
Add the widget for the cnet editor view to the window.
Definition: Directory.cpp:670
This dialog allows the user to select the bundle adjust parameters, run the bundle, and view the results.
QList< QPointer< TemplateEditorWidget > > m_templateEditorWidgets
List of TemplateEditorWidgets.
Definition: Directory.h:520
QStringList m_recentProjects
List of the names of recent projects.
Definition: Directory.h:524
QList< QPointer< WorkOrder > > m_workOrders
List of WorkOrders.
Definition: Directory.h:522
Manage a stack of content handlers for reading XML files.
QList< QPointer< ImageFileListWidget > > m_fileListWidgets
List of ImageFileListWidgets.
Definition: Directory.h:511
void initializeActions()
Initializes the actions that the Directory can provide to a main window.
Definition: Directory.cpp:422
QPointer< WorkOrder > m_closeProjectWorkOrder
The Close Project WorkOrder.
Definition: Directory.h:537
TemplateEditorWidget * addTemplateEditorView(Template *currentTemplate)
Add template editor view widget to the window.
Definition: Directory.cpp:980
IO Handler for Isis Cubes.
Definition: Cube.h:170
CubeDnView * addCubeDnView(QString objectName="")
Add the qview workspace to the window.
Definition: Directory.cpp:720
void deleteControlPoint(ControlPoint *controlPoint)
Slot that is connected from a middle mouse button operation on views.
Definition: Directory.cpp:1872