Isis 3 Programmer Reference
Directory.cpp
Go to the documentation of this file.
1 
23 #include "Directory.h"
24 
25 
26 #include <QAction>
27 #include <QApplication>
28 #include <QDockWidget>
29 #include <QGridLayout>
30 #include <QMainWindow>
31 #include <QMenu>
32 #include <QMenuBar>
33 #include <QMessageBox>
34 #include <QRegExp>
35 #include <QSettings>
36 #include <QSizePolicy>
37 #include <QSplitter>
38 #include <QStringList>
39 #include <QtDebug>
40 #include <QVariant>
41 #include <QXmlStreamWriter>
42 
43 
44 #include "BundleObservation.h"
45 #include "BundleObservationView.h"
47 #include "ChipViewportsWidget.h"
48 #include "CloseProjectWorkOrder.h"
49 #include "CnetEditorView.h"
53 #include "CnetEditorWidget.h"
54 #include "Control.h"
56 #include "ControlList.h"
57 #include "ControlNet.h"
58 #include "ControlNetTool.h"
59 #include "ControlPointEditView.h"
60 #include "ControlPointEditWidget.h"
61 #include "CubeDnView.h"
62 #include "CubeDnViewWorkOrder.h"
63 #include "ExportControlNetWorkOrder.h"
64 #include "ExportImagesWorkOrder.h"
65 #include "FileItem.h"
66 #include "FileName.h"
67 #include "Footprint2DView.h"
69 #include "HistoryTreeWidget.h"
70 #include "IException.h"
71 #include "IString.h"
73 #include "ImageFileListWidget.h"
75 #include "ImportImagesWorkOrder.h"
76 #include "ImportShapesWorkOrder.h"
79 #include "JigsawRunWidget.h"
80 #include "JigsawWorkOrder.h"
81 #include "MatrixSceneWidget.h"
82 #include "MatrixViewWorkOrder.h"
83 #include "MosaicControlNetTool.h"
84 #include "MosaicSceneWidget.h"
85 #include "OpenProjectWorkOrder.h"
86 #include "Project.h"
87 #include "ProjectItem.h"
88 #include "ProjectItemModel.h"
89 #include "ProjectItemTreeView.h"
90 #include "RemoveImagesWorkOrder.h"
91 #include "RenameProjectWorkOrder.h"
92 #include "SaveProjectWorkOrder.h"
93 #include "SaveProjectAsWorkOrder.h"
94 #include "SensorGetInfoWorkOrder.h"
95 #include "SensorInfoWidget.h"
98 #include "TableView.h"
99 #include "TableViewContent.h"
100 #include "TargetInfoWidget.h"
101 #include "TargetGetInfoWorkOrder.h"
102 #include "TemplateEditorWidget.h"
104 #include "ToolPad.h"
105 #include "WarningTreeWidget.h"
106 #include "WorkOrder.h"
107 #include "Workspace.h"
108 #include "XmlStackedHandler.h"
109 #include "XmlStackedHandlerReader.h"
110 
111 namespace Isis {
112 
119  Directory::Directory(QObject *parent) : QObject(parent) {
120 
121  try {
122  m_project = new Project(*this);
123  }
124  catch (IException &e) {
126  "Could not create directory because Project could not be created.",
127  _FILEINFO_);
128  }
129 
130  //connect( m_project, SIGNAL(imagesAdded(ImageList *) ),
131  //this, SLOT(imagesAddedToProject(ImageList *) ) );
132 
133  //connect( m_project, SIGNAL(targetsAdded(TargetBodyList *) ),
134  //this, SLOT(targetsAddedToProject(TargetBodyList *) ) );
135 
136  //connect( m_project, SIGNAL(guiCamerasAdded(GuiCameraList *) ),
137  //this, SLOT(guiCamerasAddedToProject(GuiCameraList *) ) );
138 
139  connect( m_project, SIGNAL(projectLoaded(Project *) ),
140  this, SLOT(updateRecentProjects(Project *) ) );
141 
142  // Send cnetModified() to project, so that we can set the project's clean state.
143  // In the slot cnetModified(), it checks if the active was modified and then emits
144  // activeControlModified(). This signal is connected below to this activeControlModified(),
145  // which connects to views that use the active cnet to redraw themselves.
146  // Ultimately, cnetModified() allows us to save changes made to any cnet, and
147  // activeControlModified() allows other views to be redrawn.
148  connect(this, SIGNAL(cnetModified()), m_project, SLOT(cnetModified()));
149  connect(project(), SIGNAL(activeControlModified()), this, SIGNAL(activeControlModified()));
150 
151  connect(m_project, SIGNAL(activeControlSet(bool)), this, SLOT(newActiveControl(bool)));
152  connect(m_project, SIGNAL(discardActiveControlEdits()),
154 
156  m_projectItemModel->addProject(m_project);
157  connect(m_projectItemModel, SIGNAL(cleanProject(bool)), this, SIGNAL(cleanProject(bool)));
158 
159  try {
160 
161  // Context menu actions
162  createWorkOrder<SetActiveImageListWorkOrder>();
163  createWorkOrder<SetActiveControlWorkOrder>();
164  createWorkOrder<CnetEditorViewWorkOrder>();
165  createWorkOrder<CubeDnViewWorkOrder>();
166  createWorkOrder<Footprint2DViewWorkOrder>();
167  createWorkOrder<MatrixViewWorkOrder>();
168  createWorkOrder<SensorGetInfoWorkOrder>();
169  //createWorkOrder<RemoveImagesWorkOrder>();
170  createWorkOrder<TargetGetInfoWorkOrder>();
171  createWorkOrder<BundleObservationViewWorkOrder>();
172  createWorkOrder<TemplateEditViewWorkOrder>();
173  createWorkOrder<ControlHealthMonitorWorkOrder>();
174 
175  // Main menu actions
176  m_exportControlNetWorkOrder = createWorkOrder<ExportControlNetWorkOrder>();
177  m_exportImagesWorkOrder = createWorkOrder<ExportImagesWorkOrder>();
178  m_importControlNetWorkOrder = createWorkOrder<ImportControlNetWorkOrder>();
179  m_importImagesWorkOrder = createWorkOrder<ImportImagesWorkOrder>();
180  m_importShapesWorkOrder = createWorkOrder<ImportShapesWorkOrder>();
181  m_importMapTemplateWorkOrder = createWorkOrder<ImportMapTemplateWorkOrder>();
182  m_importRegistrationTemplateWorkOrder = createWorkOrder<ImportRegistrationTemplateWorkOrder>();
183  m_openProjectWorkOrder = createWorkOrder<OpenProjectWorkOrder>();
184  m_saveProjectWorkOrder = createWorkOrder<SaveProjectWorkOrder>();
185  m_saveProjectAsWorkOrder = createWorkOrder<SaveProjectAsWorkOrder>();
186  m_runJigsawWorkOrder = createWorkOrder<JigsawWorkOrder>();
187  m_closeProjectWorkOrder = createWorkOrder<CloseProjectWorkOrder>();
188  m_renameProjectWorkOrder = createWorkOrder<RenameProjectWorkOrder>();
189  m_recentProjectsLoaded = false;
190  }
191  catch (IException &e) {
193  "Could not create directory because work orders are corrupt.",
194  _FILEINFO_);
195  }
196 
198  m_editPointId = "";
199  }
200 
201 
206 
207  m_workOrders.clear();
208 
209  if (m_project) {
210  m_project ->deleteLater();
211  m_project = NULL;
212  }
213  }
214 
215 
221  return m_fileMenuActions;
222  }
223 
224 
230  return m_projectMenuActions;
231  }
232 
233 
239  return m_editMenuActions;
240  }
241 
242 
248  return m_viewMenuActions;
249  }
250 
251 
257  return m_settingsMenuActions;
258  }
259 
260 
266  return m_helpMenuActions;
267  }
268 
269 
275  return m_permToolBarActions;
276  }
277 
278 
284  return m_activeToolBarActions;
285  }
286 
287 
293  return m_toolPadActions;
294  }
295 
296 
304  emit directoryCleaned();
305 
306  m_historyTreeWidget->clear();
307  m_warningTreeWidget->clear();
308  m_bundleObservationViews.clear();
309  m_cnetEditorViewWidgets.clear();
310  m_cubeDnViewWidgets.clear();
311  m_fileListWidgets.clear();
312  m_footprint2DViewWidgets.clear();
313  m_controlPointEditViewWidget.clear();
314  m_matrixViewWidgets.clear();
315  m_sensorInfoWidgets.clear();
316  m_targetInfoWidgets.clear();
317  m_templateEditorWidgets.clear();
318  m_jigsawRunWidget.clear();
319 
320  m_projectItemModel->clean();
321  }
322 
323 
333 
334  if (m_recentProjectsLoaded) {
335  QMenu *recentProjectsMenu = new QMenu("&Recent Projects");
336 
337  foreach (QAction *action, m_fileMenuActions) {
338 
339  QString actionText(action->text());
340  if (actionText == "&Recent Projects") {
341  // Grab the pointer to the actual ""&Recent Projects" menu in IPCE
342  recentProjectsMenu = qobject_cast<QMenu*>(action->parentWidget());
343  break;
344  }
345  }
346 
347  QString projName = m_recentProjects.at(0).split("/").last();
348 
349  QAction *openRecentProjectAction = m_openProjectWorkOrder->clone();
350  openRecentProjectAction->setText(projName);
351  openRecentProjectAction->setToolTip(m_recentProjects.at(0));
352 
353  if (recentProjectsMenu->isEmpty())
354  {
355  recentProjectsMenu->addAction(openRecentProjectAction);
356  return;
357  }
358 
359  QAction *firstAction = recentProjectsMenu->actions().at(0);
360 
361  // If the opened project is already the most recent project, return.
362  if (firstAction->text() == projName) {
363  return;
364  }
365 
366  // If the action we're placing at the first index already exists,
367  // Then point to that action.
368  foreach (QAction *action, recentProjectsMenu->actions()) {
369  if (action->text() == projName) {
370  openRecentProjectAction = action;
371  break;
372  }
373  }
374 
375  recentProjectsMenu->insertAction(firstAction, openRecentProjectAction);
376  if (recentProjectsMenu->actions().length() > Project::maxRecentProjects()) {
377  recentProjectsMenu->removeAction(recentProjectsMenu->actions().last());
378  }
379  }
380  else {
381 
382  QMenu *fileMenu = new QMenu();
383  QMenu *recentProjectsMenu = fileMenu->addMenu("&Recent Projects");
384  int nRecentProjects = m_recentProjects.size();
385 
386  for (int i = 0; i < nRecentProjects; i++) {
387  FileName projectFileName = m_recentProjects.at(i);
388 
389  if (!projectFileName.fileExists() )
390  continue;
391 
392  QAction *openRecentProjectAction = m_openProjectWorkOrder->clone();
393 
394  if ( !( (OpenProjectWorkOrder*)openRecentProjectAction )
395  ->isExecutable(m_recentProjects.at(i),true ) )
396  continue;
397 
398 
399  QString projName = m_recentProjects.at(i).split("/").last();
400  openRecentProjectAction->setText(m_recentProjects.at(i).split("/").last() );
401  openRecentProjectAction->setToolTip(m_recentProjects.at(i));
402  recentProjectsMenu->addAction(openRecentProjectAction);
403  }
404  fileMenu->addSeparator();
405  m_fileMenuActions.append( fileMenu->actions() );
406  m_recentProjectsLoaded = true;
407  }
408  }
409 
410 
423  // Menus are created temporarily to convinently organize the actions.
424  QMenu *fileMenu = new QMenu();
425 
426  //fileMenu->addAction(m_importControlNetWorkOrder->clone());
427  //fileMenu->addAction(m_importImagesWorkOrder->clone());
428 
429  QAction *openProjectAction = m_openProjectWorkOrder->clone();
430  openProjectAction->setIcon(QIcon(FileName(
431  "$base/icons/archive-insert-directory.png").expanded()));
432  fileMenu->addAction(openProjectAction);
433  m_permToolBarActions.append(openProjectAction);
434 
435 
436  QAction *saveAction = m_saveProjectWorkOrder->clone();
437  saveAction->setShortcut(Qt::Key_S | Qt::CTRL);
438  saveAction->setIcon( QIcon(FileName("$base/icons/document-save.png")
439  .expanded()));
440  saveAction->setDisabled(true);
441  connect( project()->undoStack(), SIGNAL( cleanChanged(bool) ),
442  saveAction, SLOT( setDisabled(bool) ) );
443  fileMenu->addAction(saveAction);
444  m_permToolBarActions.append(saveAction);
445 
446  QAction *saveAsAction = m_saveProjectAsWorkOrder->clone();
447  saveAsAction->setIcon(QIcon(FileName("$base/icons/document-save-as.png")
448  .expanded()));
449  fileMenu->addAction(saveAsAction);
450  m_permToolBarActions.append(saveAsAction);
451 
452  fileMenu->addSeparator();
453 
454  QMenu *importMenu = fileMenu->addMenu("&Import");
455  importMenu->addAction(m_importControlNetWorkOrder->clone() );
456  importMenu->addAction(m_importImagesWorkOrder->clone() );
457  importMenu->addAction(m_importShapesWorkOrder->clone() );
458 
459  QMenu *importTemplateMenu = importMenu->addMenu("&Import Templates");
460  importTemplateMenu->addAction(m_importMapTemplateWorkOrder->clone() );
461  importTemplateMenu->addAction(m_importRegistrationTemplateWorkOrder->clone() );
462 
463  QMenu *exportMenu = fileMenu->addMenu("&Export");
464 
465  // Temporarily grab the export control network clone so we can listen for the
466  // signals that tell us when we can export a cnet. We cannot export a cnet unless at least
467  // one has been imported to the project.
468  WorkOrder *clone = m_exportControlNetWorkOrder->clone();
469  clone->setEnabled(false);
470  connect(m_project, SIGNAL(controlListAdded(ControlList *)),
471  clone, SLOT(enableWorkOrder()));
472  // TODO this is not setup yet
473  // connect(m_project, &Project::allControlsRemoved,
474  // clone, &WorkOrder::disableWorkOrder);
475  exportMenu->addAction(clone);
476 
477  // Similarly for export images, disable the work order until we have images in the project.
478  clone = m_exportImagesWorkOrder->clone();
479  clone->setEnabled(false);
480  connect(m_project, SIGNAL(imagesAdded(ImageList *)),
481  clone, SLOT(enableWorkOrder()));
482  exportMenu->addAction(clone);
483 
484  fileMenu->addSeparator();
485  fileMenu->addAction(m_closeProjectWorkOrder->clone() );
486  m_fileMenuActions.append( fileMenu->actions() );
487 
489 
490  // For JigsawWorkOrder, disable the work order utnil we have both an active control and image
491  // list. Setup a tool tip so user can see why the work order is disabled by default.
492  // NOTE: Trying to set a what's this on the clone doesn't seem to work for disabled actions,
493  // even though Qt's documentation says it should work on disabled actions.
494  clone = m_runJigsawWorkOrder->clone();
495  if (project()->controls().count() && project()->images().count()) {
496  clone->setEnabled(true);
497  }
498  else {
499  clone->setEnabled(false);
500  }
501 
502  // Listen for when both images and control net have been added to the project.
503  connect(m_project, SIGNAL(controlsAndImagesAvailable()),
504  clone, SLOT(enableWorkOrder()));
505  // Listen for when both an active control and active image list have been set.
506  // When this happens, we can enable the JigsawWorkOrder.
507 // connect(m_project, &Project::activeControlAndImageListSet,
508 // clone, &WorkOrder::enableWorkOrder);
509 
510  m_projectMenuActions.append(clone);
511 
512 // m_projectMenuActions.append( projectMenu->actions() );
513 
518  }
519 
520 
525  void Directory::setHistoryContainer(QDockWidget *historyContainer) {
526  if (!m_historyTreeWidget) {
528  }
529  historyContainer->setWidget(m_historyTreeWidget);
530  }
531 
532 
537  void Directory::setWarningContainer(QDockWidget *warningContainer) {
538  if (!m_warningTreeWidget) {
540  }
541  warningContainer->setWidget(m_warningTreeWidget);
542  }
543 
544 
550 
551  m_recentProjects.append(recentProjects);
552  }
553 
554 
564 
565  foreach(CnetEditorView *cnetEditorView, m_cnetEditorViewWidgets) {
566  if (cnetEditorView->control() == project()->activeControl()) {
567  emit closeView(cnetEditorView);
568  addCnetEditorView(project()->activeControl());
569  }
570  }
571  }
572 
573 
581  void Directory::newActiveControl(bool newControl) {
582 
583  if (newControl && m_controlPointEditViewWidget) {
584  emit closeView(m_controlPointEditViewWidget);
585  delete m_controlPointEditViewWidget;
586  }
587 
588  // If the new active control is the same as what is showing in the cnetEditorWidget, allow
589  // editing of control points from the widget, otherwise turnoff from context menu
590  foreach(CnetEditorView *cnetEditorView, m_cnetEditorViewWidgets) {
591  if (cnetEditorView->control() == project()->activeControl()) {
592  cnetEditorView->cnetEditorWidget()->pointTableView()->content()->setActiveControlNet(true);
593  cnetEditorView->cnetEditorWidget()->measureTableView()->content()->setActiveControlNet(true);
594  }
595  else {
596  cnetEditorView->cnetEditorWidget()->pointTableView()->content()->setActiveControlNet(false);
597  cnetEditorView->cnetEditorWidget()->measureTableView()->content()->setActiveControlNet(false);
598  }
599  }
600  }
601 
602 
608  return m_recentProjects;
609  }
610 
611 
617  BundleObservationView *result = new BundleObservationView(fileItem);
618 
619  connect( result, SIGNAL( destroyed(QObject *) ),
620  this, SLOT( cleanupBundleObservationViews(QObject *) ) );
621 
622  connect(result, SIGNAL(windowChangeEvent(bool)),
623  m_project, SLOT(setClean(bool)));
624 
625  m_bundleObservationViews.append(result);
626 
627  QString str = fileItem->fileName();
628  FileName fileName = fileItem->fileName();
629 
630  // strip out bundle results name from fileName
631  QString path = fileName.originalPath();
632  int pos = path.lastIndexOf("/");
633  QString bundleResultsName = "";
634  if (pos != -1) {
635  bundleResultsName = path.remove(0,pos+1);
636  }
637 
638  if (str.contains("bundleout")) {
639  result->setWindowTitle( tr("Summary (%1)").
640  arg( bundleResultsName ) );
641  result->setObjectName( result->windowTitle() );
642  }
643  if (str.contains("residuals")) {
644  result->setWindowTitle( tr("Measure Residuals (%1)").
645  arg( bundleResultsName ) );
646  result->setObjectName( result->windowTitle() );
647  }
648  else if (str.contains("points")) {
649  result->setWindowTitle( tr("Control Points (%1)").
650  arg( bundleResultsName ) );
651  result->setObjectName( result->windowTitle() );
652  }
653  else if (str.contains("images")) {
654  result->setWindowTitle( tr("Images (%1)").
655  arg( bundleResultsName ) );
656  result->setObjectName( result->windowTitle() );
657  }
658 
659  emit newWidgetAvailable(result);
660 
661  return result;
662  }
663 
664 
670  CnetEditorView *Directory::addCnetEditorView(Control *control, QString objectName) {
671 
672  QString title = tr("Cnet Editor View %1").arg( control->displayProperties()->displayName() );
673  FileName configFile("$HOME/.Isis/" + QApplication::applicationName() + "/" + title + ".config");
674 
675  CnetEditorView *result = new CnetEditorView(this, control, configFile);
676 
677  if (project()->activeControl() && (control == project()->activeControl())) {
680  }
681 
682  // connect destroyed signal to cleanupCnetEditorViewWidgets slot
683  connect(result, SIGNAL( destroyed(QObject *) ),
684  this, SLOT( cleanupCnetEditorViewWidgets(QObject *) ) );
685 
686  connect(result, SIGNAL(windowChangeEvent(bool)),
687  m_project, SLOT(setClean(bool)));
688 
689  // Connections for control point editing between views
690  connect(result->cnetEditorWidget(), SIGNAL(editControlPoint(ControlPoint *, QString)),
691  this, SLOT(modifyControlPoint(ControlPoint *, QString)));
692 
693  // If a cnet is modified, we have to set the clean state in project and redraw measures.
694  connect(result->cnetEditorWidget(), SIGNAL(cnetModified()), this, SIGNAL(cnetModified()));
695  connect(this, SIGNAL(cnetModified()), result->cnetEditorWidget(), SLOT(rebuildModels()));
696 
697  m_cnetEditorViewWidgets.append(result);
698  m_controlMap.insertMulti(control, result);
699 
700  result->setWindowTitle(title);
701  if (objectName != "") {
702  result->setObjectName(objectName);
703  }
704  else {
705  // If no objectName, create unique identifier
706  QString newObjectName = QUuid::createUuid().toString().remove(QRegExp("[{}]"));
707  result->setObjectName(newObjectName);
708  }
709 
710  emit newWidgetAvailable(result);
711 
712  return result;
713  }
714 
715 
720  CubeDnView *Directory::addCubeDnView(QString objectName) {
721  CubeDnView *result = new CubeDnView(this, qobject_cast<QMainWindow *>(parent()));
722  result->setModel(m_projectItemModel);
723  m_cubeDnViewWidgets.append(result);
724  connect( result, SIGNAL( destroyed(QObject *) ),
725  this, SLOT( cleanupCubeDnViewWidgets(QObject *) ) );
726 
727  connect(result, SIGNAL(windowChangeEvent(bool)),
728  m_project, SLOT(setClean(bool)));
729 
730  result->setWindowTitle( tr("Cube DN View %1").arg(m_cubeDnViewWidgets.count() ) );
731  // Unique objectNames are needed for the save/restoreState
732  if (objectName != "") {
733  result->setObjectName(objectName);
734  }
735  else {
736  // If no objectName, create unique identifier
737  QString newObjectName = QUuid::createUuid().toString().remove(QRegExp("[{}]"));
738  result->setObjectName(newObjectName);
739  }
740 
741  emit newWidgetAvailable(result);
742 
743  // Connections between mouse button events from view and control point editing
744  connect(result, SIGNAL(modifyControlPoint(ControlPoint *, QString)),
745  this, SLOT(modifyControlPoint(ControlPoint *, QString)));
746 
747  connect(result, SIGNAL(deleteControlPoint(ControlPoint *)),
748  this, SLOT(deleteControlPoint(ControlPoint *)));
749 
750  connect(result, SIGNAL(createControlPoint(double, double, Cube *, bool)),
751  this, SLOT(createControlPoint(double, double, Cube *, bool)));
752 
753  // This signal is connected to the CubeDnView signal which connects to the slot,
754  // ControlNetTool::paintAllViewports(). ControlNetTool always redraws all control points, so
755  // both signals go to the same slot.
756  connect(this, SIGNAL(redrawMeasures()), result, SIGNAL(redrawMeasures()));
757 
758  // If the active cnet is modified, redraw the measures
759  connect(this, SIGNAL(activeControlModified()), result, SIGNAL(redrawMeasures()));
760 
761  connect (project(), SIGNAL(activeControlSet(bool)),
762  result, SLOT(enableControlNetTool(bool)));
763 
764  return result;
765  }
766 
772  Footprint2DView *result = new Footprint2DView(this);
773 
774  // Set source model on Proxy
775  result->setModel(m_projectItemModel);
776  m_footprint2DViewWidgets.append(result);
777  result->setWindowTitle( tr("Footprint View %1").arg( m_footprint2DViewWidgets.count() ) );
778  // Unique objectNames are needed for the save/restoreState
779  if (objectName != "") {
780  result->setObjectName(objectName);
781  }
782  else {
783  // If no objectName, create unique identifier
784  QString newObjectName = QUuid::createUuid().toString().remove(QRegExp("[{}]"));
785  result->setObjectName(newObjectName);
786  }
787 
788  connect(result, SIGNAL(destroyed(QObject *)),
789  this, SLOT(cleanupFootprint2DViewWidgets(QObject *)));
790 
791  connect(result, SIGNAL(windowChangeEvent(bool)),
792  m_project, SLOT(setClean(bool)));
793 
794  emit newWidgetAvailable(result);
795 
796  // Connections between mouse button events from footprint2DView and control point editing
797  connect(result, SIGNAL(modifyControlPoint(ControlPoint *)),
798  this, SLOT(modifyControlPoint(ControlPoint *)));
799 
800  connect(result, SIGNAL(deleteControlPoint(ControlPoint *)),
801  this, SLOT(deleteControlPoint(ControlPoint *)));
802 
803  connect(result, SIGNAL(createControlPoint(double, double)),
804  this, SLOT(createControlPoint(double, double)));
805 
806  // The ControlPointEditWidget is only object that emits cnetModified when ControlPoint is
807  // deleted or saved. This requires the footprint view ControlNetGraphicsItems to be re-built
808  // when the active cnet is modified.
809  connect(this, SIGNAL(activeControlModified()), result->mosaicSceneWidget(), SIGNAL(cnetModified()));
810 
811  // This signal is connected to the MosaicGraphicsScene::update(), which eventually calls
812  // ControlNetGraphicsItem::paint(), then ControlPointGraphicsItem::paint(). This should only
813  // be used if ControlNet has not changed. Used to update the current edit point in the view
814  // to be drawn with different color/shape.
815  connect(this, SIGNAL(redrawMeasures()), result, SIGNAL(redrawMeasures()));
816 
817  connect (project(), SIGNAL(activeControlSet(bool)),
818  result, SLOT(enableControlNetTool(bool)));
819 
820  return result;
821  }
822 
823  ControlHealthMonitorView *Directory::controlHealthMonitorView() {
824  return m_controlHealthMonitorView;
825  }
826 
827 
828  ControlHealthMonitorView *Directory::addControlHealthMonitorView() {
829 
830  if (!controlHealthMonitorView()) {
831 
832  Control *activeControl = project()->activeControl();
833  if (activeControl == NULL) {
834  QString message = "No active control network chosen. Choose active control network on "
835  "project tree.\n";
836  QMessageBox::critical(qobject_cast<QWidget *>(parent()), "Error", message);
837  return NULL;
838  }
839 
841  result->setWindowTitle(tr("Control NetHealth Monitor"));
842  result->setObjectName(result->windowTitle());
843 
844  m_controlHealthMonitorView = result;
845  emit newWidgetAvailable(result);
846  }
847  return controlHealthMonitorView();
848  }
849 
850 
851  ControlPointEditView *Directory::addControlPointEditView() {
852 
853  if (!controlPointEditView()) {
854  // TODO Need parent for controlPointWidget
855  ControlPointEditView *result = new ControlPointEditView(this);
856  result->setWindowTitle(tr("Control Point Editor"));
857  result->setObjectName(result->windowTitle());
858 
859  Control *activeControl = project()->activeControl();
860  if (activeControl == NULL) {
861  // Error and return to Select Tool
862  QString message = "No active control network chosen. Choose active control network on "
863  "project tree.\n";
864  QMessageBox::critical(qobject_cast<QWidget *>(parent()), "Error", message);
865  return NULL;
866  }
867  result->controlPointEditWidget()->setControl(activeControl);
868 
869  if (!project()->activeImageList() || !project()->activeImageList()->serialNumberList()) {
870  QString message = "No active image list chosen. Choose an active image list on the project "
871  "tree.\n";
872  QMessageBox::critical(qobject_cast<QWidget *>(parent()), "Error", message);
873  return NULL;
874  }
876  project()->activeImageList()->serialNumberList());
877 
878  m_controlPointEditViewWidget = result;
879 
880  connect(result, SIGNAL(destroyed(QObject *)),
882  emit newWidgetAvailable(result);
883 
884 // 2017-06-09 Ken commented out for Data Workshop demo
885 // m_chipViewports = new ChipViewportsWidget(result);
886 // connect(m_chipViewports, SIGNAL(destroyed(QObject *)), this, SLOT(cleanupchipViewportWidges()));
887 // m_chipViewports->setWindowTitle(tr("ChipViewport View"));
888 // m_chipViewports->setObjectName(m_chipViewports->windowTitle());
889 // m_chipViewports->setSerialNumberList(project()->activeImageList()->serialNumberList());
890 // m_chipViewports->setControlNet(activeControl->controlNet(), activeControl->fileName());
891 // emit newWidgetAvailable(m_chipViewports);
892 // 2017-06-09 Ken commented out for Data Workshop demo
893 
894 
895  // Create connections between signals from control point edit view and equivalent directory
896  // signals that can then be connected to other views that display control nets.
897  // If the active was modified, this will be signaled in project's cnetModified() and
898  // connected to other views to redraw themselves.
899  connect(result->controlPointEditWidget(), SIGNAL(cnetModified()),
900  this, SIGNAL(cnetModified()));
901 
902  connect (project(), SIGNAL(activeControlSet(bool)),
903  result->controlPointEditWidget(), SLOT(setControlFromActive()));
904 
905  connect(result, SIGNAL(windowChangeEvent(bool)),
906  m_project, SLOT(setClean(bool)));
907 
908  // Recolors the save net button in controlPointEditView to black after the cnets are saved.
909  connect(m_project, SIGNAL(cnetSaved(bool)),
910  result->controlPointEditWidget(), SLOT(colorizeSaveNetButton(bool)));
911  }
912 
913  return controlPointEditView();
914  }
915 
916 
917 
918 
919 #if 0
920  ChipViewportsWidget *Directory::addControlPointChipView() {
921 
922  ChipViewportsWidget *result = new ChipViewportsWidget(this);
923  connect(result, SIGNAL(destroyed(QObject *)), this, SLOT(cleanupchipViewportWidges()));
924  m_controlPointChipViews.append(result);
925  result->setWindowTitle(tr("ChipViewport View %1").arg(m_controlPointChipViews.count()));
926  result->setObjectName(result->windowTitle());
927  emit newWidgetAvailable(result);
928 
929  return result;
930  }
931 #endif
932 
933 
939  MatrixSceneWidget *result = new MatrixSceneWidget(NULL, true, true, this);
940 
941  connect( result, SIGNAL( destroyed(QObject *) ),
942  this, SLOT( cleanupMatrixViewWidgets(QObject *) ) );
943 
944  m_matrixViewWidgets.append(result);
945 
946  result->setWindowTitle( tr("Matrix View %1").arg( m_matrixViewWidgets.count() ) );
947  result->setObjectName( result->windowTitle() );
948 
949  emit newWidgetAvailable(result);
950 
951  return result;
952  }
953 
954 
960  TargetInfoWidget *result = new TargetInfoWidget(target.data(), this);
961 
962  connect( result, SIGNAL( destroyed(QObject *) ),
963  this, SLOT( cleanupTargetInfoWidgets(QObject *) ) );
964 
965  m_targetInfoWidgets.append(result);
966 
967  result->setWindowTitle( tr("%1").arg(target->displayProperties()->displayName() ) );
968  result->setObjectName( result->windowTitle() );
969 
970  emit newWidgetAvailable(result);
971 
972  return result;
973  }
974 
975 
981  TemplateEditorWidget *result = new TemplateEditorWidget(currentTemplate, this);
982 
983  connect( result, SIGNAL( destroyed(QObject *) ),
984  this, SLOT( cleanupTemplateEditorWidgets(QObject *) ) );
985 
986  m_templateEditorWidgets.append(result);
987 
988  result->setWindowTitle( tr("%1").arg( FileName(currentTemplate->fileName()).name() ) );
989  result->setObjectName( result->windowTitle() );
990 
991  emit newWidgetAvailable(result);
992 
993  return result;
994  }
995 
996  JigsawRunWidget *Directory::addJigsawRunWidget() {
997  if (jigsawRunWidget()) {
998  return m_jigsawRunWidget;
999  }
1000  JigsawRunWidget *result = new JigsawRunWidget(m_project);
1001 
1002  connect( result, SIGNAL( destroyed(QObject *) ),
1003  this, SLOT( cleanupJigsawRunWidget(QObject *) ) );
1004  m_jigsawRunWidget = result;
1005 
1006  result->setAttribute(Qt::WA_DeleteOnClose);
1007  result->show();
1008 
1009  emit newWidgetAvailable(result);
1010  return result;
1011  }
1012 
1013 
1019  SensorInfoWidget *result = new SensorInfoWidget(camera.data(), this);
1020 
1021  connect( result, SIGNAL( destroyed(QObject *) ),
1022  this, SLOT( cleanupSensorInfoWidgets(QObject *) ) );
1023 
1024  m_sensorInfoWidgets.append(result);
1025 
1026  result->setWindowTitle( tr("%1").arg(camera->displayProperties()->displayName() ) );
1027  result->setObjectName( result->windowTitle() );
1028 
1029  emit newWidgetAvailable(result);
1030 
1031  return result;
1032  }
1033 
1034 
1041  ImageFileListWidget *result = new ImageFileListWidget(this);
1042 
1043  connect( result, SIGNAL( destroyed(QObject *) ),
1044  this, SLOT( cleanupFileListWidgets(QObject *) ) );
1045 
1046  m_fileListWidgets.append(result);
1047 
1048  result->setWindowTitle( tr("File List %1").arg( m_fileListWidgets.count() ) );
1049  // Unique objectNames are needed for the save/restoreState
1050  if (objectName != "") {
1051  result->setObjectName(objectName);
1052  }
1053  else {
1054  // If no objectName, create unique identifier
1055  QString newObjectName = QUuid::createUuid().toString().remove(QRegExp("[{}]"));
1056  result->setObjectName(newObjectName);
1057  }
1058 
1059  return result;
1060  }
1061 
1062 
1068  ProjectItemTreeView *result = new ProjectItemTreeView();
1069  result->setModel(m_projectItemModel);
1070  result->setWindowTitle( tr("Project"));
1071  result->setObjectName( result->windowTitle() );
1072 
1073  // The model emits this signal when the user double-clicks on the project name, the parent
1074  // node located on the ProjectTreeView.
1075  connect(m_projectItemModel, SIGNAL(projectNameEdited(QString)),
1076  this, SLOT(initiateRenameProjectWorkOrder(QString)));
1077 
1078  connect(result, SIGNAL(windowChangeEvent(bool)),
1079  m_project, SLOT(setClean(bool)));
1080 
1081  return result;
1082  }
1083 
1084 
1092  void Directory::initiateRenameProjectWorkOrder(QString projectName) {
1093 
1094  // Create the WorkOrder and add it to the Project. The Project will then execute the
1095  // WorkOrder.
1096  RenameProjectWorkOrder *workOrder = new RenameProjectWorkOrder(projectName, project());
1097  project()->addToProject(workOrder);
1098  }
1099 
1100 
1106  return m_projectItemModel;
1107  }
1108 
1109 
1115  return m_warningTreeWidget;
1116  }
1117 
1118 
1123 
1124  BundleObservationView *bundleObservationView = static_cast<BundleObservationView *>(obj);
1125  if (!bundleObservationView) {
1126  return;
1127  }
1128  m_bundleObservationViews.removeAll(bundleObservationView);
1129  m_project->setClean(false);
1130  }
1131 
1132  // /**
1133  // * @brief Removes pointers to deleted Control Health Monitor objects.
1134  // */
1135  // void Directory::cleanupControlHealthMonitorView(QObject *obj) {
1136  //
1137  // ControlHealthMonitorView *healthMonitorView = static_cast<ControlHealthMonitorView *>(obj);
1138  // if (!healthMonitorView) {
1139  // return;
1140  // }
1141  //
1142  // m_project->setClean(false);
1143  // }
1144 
1145 
1150 
1151  CnetEditorView *cnetEditorView = static_cast<CnetEditorView *>(obj);
1152  if (!cnetEditorView) {
1153  return;
1154  }
1155 
1156  Control *control = m_controlMap.key(cnetEditorView);
1157  m_controlMap.remove(control, cnetEditorView);
1158 
1159  if ( m_controlMap.count(control) == 0 && project()->activeControl() != control) {
1160  control->closeControlNet();
1161  }
1162 
1163  m_cnetEditorViewWidgets.removeAll(cnetEditorView);
1164  m_project->setClean(false);
1165  }
1166 
1167 
1176 
1177  bool result;
1178  if ( m_controlMap.count(control) == 0) {
1179  result = false;
1180  }
1181  else {
1182  result = true;
1183  }
1184  return result;
1185  }
1186 
1187 
1192 
1193  CubeDnView *cubeDnView = static_cast<CubeDnView *>(obj);
1194  if (!cubeDnView) {
1195  return;
1196  }
1197  m_cubeDnViewWidgets.removeAll(cubeDnView);
1198  m_project->setClean(false);
1199  }
1200 
1201 
1206 
1207  ImageFileListWidget *imageFileListWidget = static_cast<ImageFileListWidget *>(obj);
1208  if (!imageFileListWidget) {
1209  return;
1210  }
1211  m_fileListWidgets.removeAll(imageFileListWidget);
1212  m_project->setClean(false);
1213  }
1214 
1215 
1220 
1221  Footprint2DView *footprintView = static_cast<Footprint2DView *>(obj);
1222  if (!footprintView) {
1223  return;
1224  }
1225  m_footprint2DViewWidgets.removeAll(footprintView);
1226  m_project->setClean(false);
1227  }
1228 
1229 
1234 
1236  if (!controlPointEditView) {
1237  return;
1238  }
1239  m_controlPointEditViewWidget = NULL;
1240  m_project->setClean(false);
1241 
1242  }
1243 
1244 
1249 
1250  MatrixSceneWidget *matrixWidget = static_cast<MatrixSceneWidget *>(obj);
1251  if (!matrixWidget) {
1252  return;
1253  }
1254  m_matrixViewWidgets.removeAll(matrixWidget);
1255  m_project->setClean(false);
1256  }
1257 
1258 
1263 
1264  SensorInfoWidget *sensorInfoWidget = static_cast<SensorInfoWidget *>(obj);
1265  if (!sensorInfoWidget) {
1266  return;
1267  }
1268  m_sensorInfoWidgets.removeAll(sensorInfoWidget);
1269  m_project->setClean(false);
1270  }
1271 
1272 
1277 
1278  TargetInfoWidget *targetInfoWidget = static_cast<TargetInfoWidget *>(obj);
1279  if (!targetInfoWidget) {
1280  return;
1281  }
1282  m_targetInfoWidgets.removeAll(targetInfoWidget);
1283  m_project->setClean(false);
1284  }
1285 
1286 
1291 
1292  TemplateEditorWidget *templateEditorWidget = static_cast<TemplateEditorWidget *>(obj);
1293  if (!templateEditorWidget) {
1294  return;
1295  }
1296 
1297  m_templateEditorWidgets.removeAll(templateEditorWidget);
1298  m_project->setClean(false);
1299  }
1300 
1301 
1302  void Directory::cleanupJigsawRunWidget(QObject *obj) {
1303  JigsawRunWidget *jigsawRunWidget = static_cast<JigsawRunWidget *>(obj);
1304  if (!jigsawRunWidget) {
1305  return;
1306  }
1307  m_jigsawRunWidget = NULL;
1308  }
1309 
1310 
1317  m_recentProjects.insert( 0, project->projectRoot() );
1318  }
1319 
1320 
1326  return m_project;
1327  }
1328 
1329 
1335  QList<CnetEditorView *> results;
1336 
1337  foreach (CnetEditorView *widget, m_cnetEditorViewWidgets) {
1338  results.append(widget);
1339  }
1340 
1341  return results;
1342  }
1343 
1344 
1350  QList<CubeDnView *> results;
1351 
1352  foreach (CubeDnView *widget, m_cubeDnViewWidgets) {
1353  results.append(widget);
1354  }
1355 
1356  return results;
1357  }
1358 
1359 
1366 
1367  foreach (MatrixSceneWidget *widget, m_matrixViewWidgets) {
1368  results.append(widget);
1369  }
1370 
1371  return results;
1372  }
1373 
1374 
1380  QList<SensorInfoWidget *> results;
1381 
1382  foreach (SensorInfoWidget *widget, m_sensorInfoWidgets) {
1383  results.append(widget);
1384  }
1385 
1386  return results;
1387  }
1388 
1389 
1395  QList<TargetInfoWidget *> results;
1396 
1397  foreach (TargetInfoWidget *widget, m_targetInfoWidgets) {
1398  results.append(widget);
1399  }
1400 
1401  return results;
1402  }
1403 
1404 
1411 
1412  foreach (TemplateEditorWidget *widget, m_templateEditorWidgets) {
1413  results.append(widget);
1414  }
1415 
1416  return results;
1417  }
1418 
1419 
1425  QList<Footprint2DView *> results;
1426 
1427  foreach (Footprint2DView *view, m_footprint2DViewWidgets) {
1428  results.append(view);
1429  }
1430 
1431  return results;
1432  }
1433 
1434 
1441 
1442  foreach (ImageFileListWidget *widget, m_fileListWidgets) {
1443  results.append(widget);
1444  }
1445 
1446  return results;
1447  }
1448 
1454 
1455  return m_controlPointEditViewWidget;
1456  }
1457 
1458 
1459  JigsawRunWidget *Directory::jigsawRunWidget() {
1460 
1461  return m_jigsawRunWidget;
1462  }
1463 
1464 
1465 /*
1466  ChipViewportsWidget *Directory::controlPointChipViewports() {
1467 
1468  return m_chipViewports;
1469  }
1470 */
1471 
1476 //ControlNetEditor *Directory::controlNetEditor() {
1477 // return m_cnetEditor;
1478 //}
1479 
1480 
1486  QList<QProgressBar *> result;
1487  return result;
1488  }
1489 
1490 
1495  void Directory::showWarning(QString text) {
1496  m_warningTreeWidget->showWarning(text);
1497  emit newWarning();
1498  }
1499 
1500 
1506  return project()->undoStack()->createRedoAction(this);
1507  }
1508 
1509 
1515  return project()->undoStack()->createUndoAction(this);
1516  }
1517 
1518 
1524  xmlReader->pushContentHandler( new XmlHandler(this) );
1525  }
1526 
1527 
1537  void Directory::save(QXmlStreamWriter &stream, FileName newProjectRoot) const {
1538  stream.writeStartElement("directory");
1539 
1540  if ( !m_fileListWidgets.isEmpty() ) {
1541  stream.writeStartElement("fileListWidgets");
1542 
1543  foreach (ImageFileListWidget *fileListWidget, m_fileListWidgets) {
1544  fileListWidget->save(stream, project(), newProjectRoot);
1545  }
1546 
1547  stream.writeEndElement();
1548  }
1549 
1550  // Save footprints
1551  if ( !m_footprint2DViewWidgets.isEmpty() ) {
1552  stream.writeStartElement("footprintViews");
1553 
1554  foreach (Footprint2DView *footprint2DViewWidget, m_footprint2DViewWidgets) {
1555  footprint2DViewWidget->save(stream, project(), newProjectRoot);
1556  }
1557 
1558  stream.writeEndElement();
1559  }
1560 
1561  // Save cubeDnViews
1562  if ( !m_cubeDnViewWidgets.isEmpty() ) {
1563  stream.writeStartElement("cubeDnViews");
1564 
1565  foreach (CubeDnView *cubeDnView, m_cubeDnViewWidgets) {
1566  cubeDnView->save(stream, project(), newProjectRoot);
1567  }
1568 
1569  stream.writeEndElement();
1570  }
1571 
1572  // Save cnetEditorViews
1573  if ( !m_cnetEditorViewWidgets.isEmpty() ) {
1574  stream.writeStartElement("cnetEditorViews");
1575 
1576  foreach (CnetEditorView *cnetEditorWidget, m_cnetEditorViewWidgets) {
1577  cnetEditorWidget->save(stream, project(), newProjectRoot);
1578  }
1579 
1580  stream.writeEndElement();
1581  }
1582 
1583 
1584  stream.writeEndElement();
1585  }
1586 
1587 
1593  m_directory = directory;
1594  }
1595 
1596 
1601  }
1602 
1603 
1619  bool Directory::XmlHandler::startElement(const QString &namespaceURI, const QString &localName,
1620  const QString &qName, const QXmlAttributes &atts) {
1621  bool result = XmlStackedHandler::startElement(namespaceURI, localName, qName, atts);
1622  if (result) {
1623  QString viewObjectName;
1624  if (localName == "footprint2DView") {
1625  viewObjectName = atts.value("objectName");
1626  m_directory->addFootprint2DView(viewObjectName)->load(reader());
1627  }
1628  else if (localName == "imageFileList") {
1629  viewObjectName = atts.value("objectName");
1630  m_directory->addImageFileListView(viewObjectName)->load(reader());
1631  }
1632  else if (localName == "cubeDnView") {
1633  viewObjectName = atts.value("objectName");
1634  m_directory->addCubeDnView(viewObjectName)->load(reader(), m_directory->project());
1635  }
1636  else if (localName == "cnetEditorView") {
1637  viewObjectName = atts.value("objectName");
1638  QString id = atts.value("id");
1639  m_directory->addCnetEditorView(m_directory->project()->control(id), viewObjectName);
1640  }
1641  }
1642 
1643  return result;
1644  }
1645 
1646 
1708  QList< QPair< QString, QList<QAction *> > > actionPairings) {
1709  QList<QAction *> results;
1710 
1711  QStringList sortedActionTexts;
1712 
1713  // This is a map from the Action Text to the actions and their widget titles
1715 
1716  QPair< QString, QList<QAction *> > singleWidgetPairing;
1717  foreach (singleWidgetPairing, actionPairings) {
1718  QString widgetTitle = singleWidgetPairing.first;
1719  QList<QAction *> widgetActions = singleWidgetPairing.second;
1720 
1721  foreach (QAction *widgetAction, widgetActions) {
1722  if (widgetAction) {
1723  QString actionText = widgetAction->text();
1724 
1725  restructuredData[actionText].append( qMakePair(widgetTitle, widgetAction) );
1726 
1727  if ( !sortedActionTexts.contains(actionText) ) {
1728  sortedActionTexts.append(actionText);
1729  }
1730  }
1731  else {
1732  // Add separator
1733  if ( !sortedActionTexts.isEmpty() && !sortedActionTexts.last().isEmpty() ) {
1734  sortedActionTexts.append("");
1735  }
1736  }
1737  }
1738  }
1739 
1740  if ( sortedActionTexts.count() && sortedActionTexts.last().isEmpty() ) {
1741  sortedActionTexts.removeLast();
1742  }
1743 
1744  foreach (QString actionText, sortedActionTexts) {
1745  if ( actionText.isEmpty() ) {
1746  results.append(NULL);
1747  }
1748  else {
1749  // We know this list isn't empty because we always appended to the value when we
1750  // accessed a particular key.
1751  QList< QPair<QString, QAction *> > actions = restructuredData[actionText];
1752 
1753  if (actions.count() == 1) {
1754  QAction *finalAct = actions.first().second;
1755  QString widgetTitle = actions.first().first;
1756 
1757  finalAct->setText( tr("%1 on %2").arg(actionText).arg(widgetTitle) );
1758  results.append(finalAct);
1759  }
1760  else {
1761  QAction *menuAct = new QAction(actionText, NULL);
1762 
1763  QMenu *menu = new QMenu;
1764  menuAct->setMenu(menu);
1765 
1766  QList<QAction *> actionsInsideMenu;
1767 
1768  QPair<QString, QAction *> widgetTitleAndAction;
1769  foreach (widgetTitleAndAction, actions) {
1770  QString widgetTitle = widgetTitleAndAction.first;
1771  QAction *action = widgetTitleAndAction.second;
1772 
1773  action->setText(widgetTitle);
1774  actionsInsideMenu.append(action);
1775  }
1776 
1777  qSort(actionsInsideMenu.begin(), actionsInsideMenu.end(), &actionTextLessThan);
1778 
1779  QAction *allAct = new QAction(tr("All"), NULL);
1780 
1781  foreach (QAction *actionInMenu, actionsInsideMenu) {
1782  connect( allAct, SIGNAL( triggered() ),
1783  actionInMenu, SIGNAL( triggered() ) );
1784  menu->addAction(actionInMenu);
1785  }
1786 
1787  menu->addSeparator();
1788  menu->addAction(allAct);
1789 
1790  results.append(menuAct);
1791  }
1792  }
1793  }
1794 
1795  return results;
1796  }
1797 
1798 
1808  return lhs->text().localeAwareCompare( rhs->text() ) < 0;
1809 
1810  }
1811 
1812 
1817 #if 0
1818  if (m_controlPointEditView && m_footprint2DViewWidgets.size() == 1) {
1819  connect(m_footprint2DViewWidgets.at(0), SIGNAL(controlPointSelected(ControlPoint *)),
1820  m_controlPointEdit, SLOT(loadControlPoint(ControlPoint *)));
1821  connect(m_cnetEditor, SIGNAL(controlPointCreated(ControlPoint *)),
1822  m_controlPointEditWidget, SLOT(setEditPoint(ControlPoint *)));
1823 
1824  // MosaicControlTool->MosaicSceneWidget->ControlNetEditor
1825  connect( m_footprint2DViewWidgets.at(0), SIGNAL( deleteControlPoint(QString) ),
1826  m_cnetEditor, SLOT( deleteControlPoint(QString) ) );
1827  // ControlNetEditor->MosaicSceneWidget->MosaicControlTool
1828  connect( m_cnetEditor, SIGNAL( controlPointDeleted() ),
1829  m_footprint2DViewWidgets.at(0), SIGNAL( controlPointDeleted() ) );
1830 
1831 
1832  // TODO Figure out which footprint view has the "active" cnet.
1833  //qDebug() << "\t\tMos items: " << m_footprint2DViewWidgets.at(0);
1834  connect(m_controlPointEditWidget, SIGNAL(controlPointChanged(QString)),
1835  m_footprint2DViewWidgets.at(0), SIGNAL(controlPointChanged(QString)));
1836  }
1837 #endif
1838  }
1839 
1840 
1850  void Directory::modifyControlPoint(ControlPoint *controlPoint, QString serialNumber) {
1851 
1852  if (controlPoint) {
1853  if (!controlPointEditView()) {
1854  if (!addControlPointEditView()) {
1855  return;
1856  }
1857  }
1858  m_editPointId = controlPoint->GetId();
1859  emit redrawMeasures();
1860 
1861  controlPointEditView()->controlPointEditWidget()->setEditPoint(controlPoint, serialNumber);
1862  }
1863  }
1864 
1865 
1873 
1874  if (controlPoint) {
1875  if (!controlPointEditView()) {
1876  if (!addControlPointEditView()) {
1877  return;
1878  }
1879  }
1880  m_editPointId = controlPoint->GetId();
1881 
1882  // Update views with point to be deleted shown as current edit point
1883  emit redrawMeasures();
1884 
1886  }
1887  }
1888 
1889 
1903  void Directory::createControlPoint(double latitude, double longitude, Cube *cube,
1904  bool isGroundSource) {
1905 
1906  if (!controlPointEditView()) {
1907  if (!addControlPointEditView()) {
1908  return;
1909  }
1910  }
1912  latitude, longitude, cube, isGroundSource);
1913 
1915  }
1916 
1917 
1924  return m_editPointId;
1925  }
1926 }
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
$Date$ $Revision$
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.
Internalizes a list of images and allows for operations on the entire list.
Definition: ImageList.h:55
QList< QAction * > activeToolBarActions()
Get the list of actions that the Directory can provide for the active Tool Bar.
Definition: Directory.cpp:283
ControlPointEditWidget * controlPointEditWidget()
Returns the ControlPointEditWidget.
The main project for ipce.
Definition: Project.h:289
QList< QPointer< SensorInfoWidget > > m_sensorInfoWidgets
List of SensorInfoWidgets.
Definition: Directory.h:518
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
$Date$ $Revision$
TableViewContent * content()
Returns the content of the table.
Definition: TableView.cpp:191
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.
static int maxRecentProjects()
Return max number of recent projects to be displayed.
Definition: Project.h:396
void cleanupTargetInfoWidgets(QObject *)
Removes pointers to deleted TargetInfoWidget objects.
Definition: Directory.cpp:1276
virtual void setModel(ProjectItemModel *model)
Sets the model used by the view.
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
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Maintains a list of Controls so that control nets can easily be copied from one Project to another...
Definition: ControlList.h:36
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
QString fileName() const
Get the file name that this Template represents.
Definition: Template.cpp:50
$Date$ $Revision$
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
$Date$ $Revision$
QString displayName() const
Returns the display name.
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
QUndoStack * undoStack()
Returns the Projects stack of QUndoCommands.
Definition: Project.cpp:1694
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
History Widget for ipce.
This widget encompasses the entire matrixDisplay scene.
ControlPointEditView * controlPointEditView()
Gets the ControlPointEditWidget associated with the Directory.
Definition: Directory.cpp:1453
QString originalPath() const
Returns the path of the original file name.
Definition: FileName.cpp:100
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:162
void setRecentProjectsList(QStringList recentProjects)
Add recent projects to the recent projects list.
Definition: Directory.cpp:549
Control * activeControl()
Return the Active Control (control network)
Definition: Project.cpp:1903
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
void save(QXmlStreamWriter &stream, Project *project, FileName newProjectRoot) const
This method saves the FootprintColumns in the project and the settings associated with every column...
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.
void deletePoint(ControlPoint *controlPoint)
Gives user options for deleting a control point from the control network.
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 closeControlNet()
Cleans up the ControlNet pointer.
Definition: Control.cpp:206
void load(XmlStackedHandlerReader *xmlReader)
Loads the Directory from an XML file.
Definition: Directory.cpp:1523
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
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
void createControlPoint(double latitude, double longitude, Cube *cube=0, bool isGroundSource=false)
Create a new control point at the given latitude, longitude.
CnetEditorWidget * cnetEditorWidget()
Returns the cnetEditorWidget.
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
TableView * pointTableView()
Returns the point table view.
Warning Widget for ipce.
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
void addToProject(WorkOrder *)
This executes the WorkOrder and stores it in the project.
Definition: Project.cpp:2598
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
QString GetId() const
Return the Id of the control point.
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
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
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
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:40
void setActiveControlNet(bool activeNet)
Sets if there is an active control net.
Change the project&#39;s GUI name.
QPointer< WorkOrder > m_saveProjectAsWorkOrder
The Save Project As WorkOrder.
Definition: Directory.h:535
virtual void pushContentHandler(XmlStackedHandler *newHandler)
Push a contentHandler and maybe continue parsing...
A ProjectItemTreeView displays items from a ProjectItemProxyModel in a tree structure.
void setWarningContainer(QDockWidget *warningContainer)
Set up the warning info in the warning dockable widget.
Definition: Directory.cpp:537
void setControl(Control *control)
New control network being edited.
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
QString projectRoot() const
Get the top-level folder of the project.
Definition: Project.cpp:1666
void setSerialNumberList(SerialNumberList *snList)
Set the serial number list.
void cleanupCnetEditorViewWidgets(QObject *)
Removes pointers to deleted Control Health Monitor objects.
Definition: Directory.cpp:1149
QPointer< Project > m_project
Pointer to the Project.
Definition: Directory.h:502
QList< QAction * > m_toolPadActions
List of ToolPad actions.
Definition: Directory.h:553
This opens a project that&#39;s saved on disk.
XmlHandler(Directory *directory)
This function sets the Directory pointer for the Directory::XmlHandler class.
Definition: Directory.cpp:1592
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
$Date$ $Revision$
QWidget * warningWidget()
Returns a pointer to the warning widget.
Definition: Directory.cpp:1114
ControlDisplayProperties * displayProperties()
Access a pointer to the display properties for the control network.
Definition: Control.cpp:244
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
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
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
void save(QXmlStreamWriter &stream, Project *project, FileName newProjectRoot) const
This method saves the Controls object ids to the stream.
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
Control * control()
Returns the Control displayed in the CnetEditorWidget
MosaicSceneWidget * mosaicSceneWidget()
Accessor for the MosaicSceneWidget.
Isis exception class.
Definition: IException.h:107
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
Scrolled widget for display ChipViewports.
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.
void setEditPoint(ControlPoint *controlPoint, QString serialNumber="")
Slot called by Directory to set the control point for editing.
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
bool fileExists() const
Returns true if the file exists; false otherwise.
Definition: FileName.cpp:465
$Date$ $Revision$
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
QList< QPointer< ImageFileListWidget > > m_fileListWidgets
List of ImageFileListWidgets.
Definition: Directory.h:511
$Date$ $Revision$
void initializeActions()
Initializes the actions that the Directory can provide to a main window.
Definition: Directory.cpp:422
void save(QXmlStreamWriter &stream, Project *project, FileName newProjectRoot) const
Save the footprint view widgets (ImageFileListWidget and MosaicSceneWidget to an XML file...
TableView * measureTableView()
Returns the measure table view.
QPointer< WorkOrder > m_closeProjectWorkOrder
The Close Project WorkOrder.
Definition: Directory.h:537
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
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