Isis 3 Programmer Reference
Directory.cpp
1
7/* SPDX-License-Identifier: CC0-1.0 */
8
9#include "Directory.h"
10
11
12#include <QAction>
13#include <QApplication>
14#include <QDockWidget>
15#include <QGridLayout>
16#include <QMainWindow>
17#include <QMenu>
18#include <QMenuBar>
19#include <QMessageBox>
20#include <QRegExp>
21#include <QSettings>
22#include <QSizePolicy>
23#include <QSplitter>
24#include <QStringList>
25#include <QtDebug>
26#include <QVariant>
27#include <QXmlStreamWriter>
28
29
30#include "BundleObservation.h"
31#include "BundleObservationView.h"
32#include "BundleObservationViewWorkOrder.h"
33#include "ChipViewportsWidget.h"
34#include "CloseProjectWorkOrder.h"
35#include "CnetEditorView.h"
36#include "CnetEditorViewWorkOrder.h"
37#include "ControlHealthMonitorView.h"
38#include "ControlHealthMonitorWorkOrder.h"
39#include "CnetEditorWidget.h"
40#include "Control.h"
41#include "ControlDisplayProperties.h"
42#include "ControlList.h"
43#include "ControlNet.h"
44#include "ControlNetTool.h"
45#include "ControlPointEditView.h"
46#include "ControlPointEditWidget.h"
47#include "CubeDnView.h"
48#include "CubeDnViewWorkOrder.h"
49#include "ExportControlNetWorkOrder.h"
50#include "ExportImagesWorkOrder.h"
51#include "FileItem.h"
52#include "FileName.h"
53#include "Footprint2DView.h"
55#include "HistoryTreeWidget.h"
56#include "IException.h"
57#include "IString.h"
59#include "ImageFileListWidget.h"
65#include "JigsawRunWidget.h"
66#include "JigsawWorkOrder.h"
67#include "MatrixSceneWidget.h"
68#include "MatrixViewWorkOrder.h"
69#include "MosaicControlNetTool.h"
70#include "MosaicSceneWidget.h"
72#include "Project.h"
73#include "ProjectItem.h"
74#include "ProjectItemModel.h"
75#include "ProjectItemTreeView.h"
81#include "SensorInfoWidget.h"
84#include "TableView.h"
85#include "TableViewContent.h"
86#include "TargetInfoWidget.h"
88#include "TemplateEditorWidget.h"
90#include "ToolPad.h"
91#include "WarningTreeWidget.h"
92#include "WorkOrder.h"
93#include "Workspace.h"
94#include "XmlStackedHandler.h"
95#include "XmlStackedHandlerReader.h"
96
97namespace Isis {
98
106
107 try {
108 m_project = new Project(*this);
109 }
110 catch (IException &e) {
112 "Could not create directory because Project could not be created.",
113 _FILEINFO_);
114 }
115
116 //connect( m_project, SIGNAL(imagesAdded(ImageList *) ),
117 //this, SLOT(imagesAddedToProject(ImageList *) ) );
118
119 //connect( m_project, SIGNAL(targetsAdded(TargetBodyList *) ),
120 //this, SLOT(targetsAddedToProject(TargetBodyList *) ) );
121
122 //connect( m_project, SIGNAL(guiCamerasAdded(GuiCameraList *) ),
123 //this, SLOT(guiCamerasAddedToProject(GuiCameraList *) ) );
124
125 connect( m_project, SIGNAL(projectLoaded(Project *) ),
126 this, SLOT(updateRecentProjects(Project *) ) );
127
128 // Send cnetModified() to project, so that we can set the project's clean state.
129 // In the slot cnetModified(), it checks if the active was modified and then emits
130 // activeControlModified(). This signal is connected below to this activeControlModified(),
131 // which connects to views that use the active cnet to redraw themselves.
132 // Ultimately, cnetModified() allows us to save changes made to any cnet, and
133 // activeControlModified() allows other views to be redrawn.
134 connect(this, SIGNAL(cnetModified()), m_project, SLOT(cnetModified()));
135 connect(project(), SIGNAL(activeControlModified()), this, SIGNAL(activeControlModified()));
136
137 connect(m_project, SIGNAL(activeControlSet(bool)), this, SLOT(newActiveControl(bool)));
138 connect(m_project, SIGNAL(discardActiveControlEdits()),
140
142 m_projectItemModel->addProject(m_project);
143 connect(m_projectItemModel, SIGNAL(cleanProject(bool)), this, SIGNAL(cleanProject(bool)));
144
145 try {
146
147 // Context menu actions
148 createWorkOrder<SetActiveImageListWorkOrder>();
149 createWorkOrder<SetActiveControlWorkOrder>();
150 createWorkOrder<CnetEditorViewWorkOrder>();
151 createWorkOrder<CubeDnViewWorkOrder>();
152 createWorkOrder<Footprint2DViewWorkOrder>();
153 createWorkOrder<MatrixViewWorkOrder>();
154 createWorkOrder<SensorGetInfoWorkOrder>();
155 //createWorkOrder<RemoveImagesWorkOrder>();
156 createWorkOrder<TargetGetInfoWorkOrder>();
157 createWorkOrder<BundleObservationViewWorkOrder>();
158 createWorkOrder<TemplateEditViewWorkOrder>();
159 createWorkOrder<ControlHealthMonitorWorkOrder>();
160
161 // Main menu actions
162 m_exportControlNetWorkOrder = createWorkOrder<ExportControlNetWorkOrder>();
163 m_exportImagesWorkOrder = createWorkOrder<ExportImagesWorkOrder>();
164 m_importControlNetWorkOrder = createWorkOrder<ImportControlNetWorkOrder>();
165 m_importImagesWorkOrder = createWorkOrder<ImportImagesWorkOrder>();
166 m_importShapesWorkOrder = createWorkOrder<ImportShapesWorkOrder>();
167 m_importMapTemplateWorkOrder = createWorkOrder<ImportMapTemplateWorkOrder>();
168 m_importRegistrationTemplateWorkOrder = createWorkOrder<ImportRegistrationTemplateWorkOrder>();
169 m_openProjectWorkOrder = createWorkOrder<OpenProjectWorkOrder>();
170 m_saveProjectWorkOrder = createWorkOrder<SaveProjectWorkOrder>();
171 m_saveProjectAsWorkOrder = createWorkOrder<SaveProjectAsWorkOrder>();
172 m_runJigsawWorkOrder = createWorkOrder<JigsawWorkOrder>();
173 m_closeProjectWorkOrder = createWorkOrder<CloseProjectWorkOrder>();
174 m_renameProjectWorkOrder = createWorkOrder<RenameProjectWorkOrder>();
175 m_recentProjectsLoaded = false;
176 }
177 catch (IException &e) {
179 "Could not create directory because work orders are corrupt.",
180 _FILEINFO_);
181 }
182
184 m_editPointId = "";
185 }
186
187
192
193 m_workOrders.clear();
194
195 if (m_project) {
196 m_project ->deleteLater();
197 m_project = NULL;
198 }
199 }
200
201
206 QList<QAction *> Directory::fileMenuActions() {
207 return m_fileMenuActions;
208 }
209
210
215 QList<QAction *> Directory::projectMenuActions() {
217 }
218
219
224 QList<QAction *> Directory::editMenuActions() {
225 return m_editMenuActions;
226 }
227
228
233 QList<QAction *> Directory::viewMenuActions() {
234 return m_viewMenuActions;
235 }
236
237
244 }
245
246
251 QList<QAction *> Directory::helpMenuActions() {
252 return m_helpMenuActions;
253 }
254
255
260 QList<QAction *> Directory::permToolBarActions() {
262 }
263
264
271 }
272
273
278 QList<QAction *> Directory::toolPadActions() {
279 return m_toolPadActions;
280 }
281
282
290 emit directoryCleaned();
291
292 m_historyTreeWidget->clear();
293 m_warningTreeWidget->clear();
294 m_bundleObservationViews.clear();
296 m_cubeDnViewWidgets.clear();
297 m_fileListWidgets.clear();
299 m_controlPointEditViewWidget.clear();
300 m_matrixViewWidgets.clear();
301 m_sensorInfoWidgets.clear();
302 m_targetInfoWidgets.clear();
304 m_jigsawRunWidget.clear();
305
306 m_projectItemModel->clean();
307 }
308
309
319
320 if (m_recentProjectsLoaded) {
321 QMenu *recentProjectsMenu = new QMenu("&Recent Projects");
322
323 foreach (QAction *action, m_fileMenuActions) {
324
325 QString actionText(action->text());
326 if (actionText == "&Recent Projects") {
327 // Grab the pointer to the actual ""&Recent Projects" menu in IPCE
328 recentProjectsMenu = qobject_cast<QMenu*>(action->parentWidget());
329 break;
330 }
331 }
332
333 QString projName = m_recentProjects.at(0).split("/").last();
334
335 QAction *openRecentProjectAction = m_openProjectWorkOrder->clone();
336 openRecentProjectAction->setText(projName);
337 openRecentProjectAction->setToolTip(m_recentProjects.at(0));
338
339 if (recentProjectsMenu->isEmpty())
340 {
341 recentProjectsMenu->addAction(openRecentProjectAction);
342 return;
343 }
344
345 QAction *firstAction = recentProjectsMenu->actions().at(0);
346
347 // If the opened project is already the most recent project, return.
348 if (firstAction->text() == projName) {
349 return;
350 }
351
352 // If the action we're placing at the first index already exists,
353 // Then point to that action.
354 foreach (QAction *action, recentProjectsMenu->actions()) {
355 if (action->text() == projName) {
356 openRecentProjectAction = action;
357 break;
358 }
359 }
360
361 recentProjectsMenu->insertAction(firstAction, openRecentProjectAction);
362 if (recentProjectsMenu->actions().length() > Project::maxRecentProjects()) {
363 recentProjectsMenu->removeAction(recentProjectsMenu->actions().last());
364 }
365 }
366 else {
367
368 QMenu *fileMenu = new QMenu();
369 QMenu *recentProjectsMenu = fileMenu->addMenu("&Recent Projects");
370 int nRecentProjects = m_recentProjects.size();
371
372 for (int i = 0; i < nRecentProjects; i++) {
373 FileName projectFileName = m_recentProjects.at(i);
374
375 if (!projectFileName.fileExists() )
376 continue;
377
378 QAction *openRecentProjectAction = m_openProjectWorkOrder->clone();
379
380 if ( !( (OpenProjectWorkOrder*)openRecentProjectAction )
381 ->isExecutable(m_recentProjects.at(i),true ) )
382 continue;
383
384
385 QString projName = m_recentProjects.at(i).split("/").last();
386 openRecentProjectAction->setText(m_recentProjects.at(i).split("/").last() );
387 openRecentProjectAction->setToolTip(m_recentProjects.at(i));
388 recentProjectsMenu->addAction(openRecentProjectAction);
389 }
390 fileMenu->addSeparator();
391 m_fileMenuActions.append( fileMenu->actions() );
392 m_recentProjectsLoaded = true;
393 }
394 }
395
396
409 // Menus are created temporarily to convinently organize the actions.
410 QMenu *fileMenu = new QMenu();
411
412 //fileMenu->addAction(m_importControlNetWorkOrder->clone());
413 //fileMenu->addAction(m_importImagesWorkOrder->clone());
414
415 QAction *openProjectAction = m_openProjectWorkOrder->clone();
416 openProjectAction->setIcon(QIcon(FileName(
417 "$ISISROOT/appdata/images/icons/archive-insert-directory.png").expanded()));
418 fileMenu->addAction(openProjectAction);
419 m_permToolBarActions.append(openProjectAction);
420
421
422 QAction *saveAction = m_saveProjectWorkOrder->clone();
423 saveAction->setShortcut(Qt::Key_S | Qt::CTRL);
424 saveAction->setIcon( QIcon(FileName("$ISISROOT/appdata/images/icons/document-save.png")
425 .expanded()));
426 saveAction->setDisabled(true);
427 connect( project()->undoStack(), SIGNAL( cleanChanged(bool) ),
428 saveAction, SLOT( setDisabled(bool) ) );
429 fileMenu->addAction(saveAction);
430 m_permToolBarActions.append(saveAction);
431
432 QAction *saveAsAction = m_saveProjectAsWorkOrder->clone();
433 saveAsAction->setIcon(QIcon(FileName("$ISISROOT/appdata/images/icons/document-save-as.png")
434 .expanded()));
435 fileMenu->addAction(saveAsAction);
436 m_permToolBarActions.append(saveAsAction);
437
438 fileMenu->addSeparator();
439
440 QMenu *importMenu = fileMenu->addMenu("&Import");
441 importMenu->addAction(m_importControlNetWorkOrder->clone() );
442 importMenu->addAction(m_importImagesWorkOrder->clone() );
443 importMenu->addAction(m_importShapesWorkOrder->clone() );
444
445 QMenu *importTemplateMenu = importMenu->addMenu("&Import Templates");
446 importTemplateMenu->addAction(m_importMapTemplateWorkOrder->clone() );
447 importTemplateMenu->addAction(m_importRegistrationTemplateWorkOrder->clone() );
448
449 QMenu *exportMenu = fileMenu->addMenu("&Export");
450
451 // Temporarily grab the export control network clone so we can listen for the
452 // signals that tell us when we can export a cnet. We cannot export a cnet unless at least
453 // one has been imported to the project.
454 WorkOrder *clone = m_exportControlNetWorkOrder->clone();
455 clone->setEnabled(false);
456 connect(m_project, SIGNAL(controlListAdded(ControlList *)),
457 clone, SLOT(enableWorkOrder()));
458 // TODO this is not setup yet
459 // connect(m_project, &Project::allControlsRemoved,
460 // clone, &WorkOrder::disableWorkOrder);
461 exportMenu->addAction(clone);
462
463 // Similarly for export images, disable the work order until we have images in the project.
464 clone = m_exportImagesWorkOrder->clone();
465 clone->setEnabled(false);
466 connect(m_project, SIGNAL(imagesAdded(ImageList *)),
467 clone, SLOT(enableWorkOrder()));
468 exportMenu->addAction(clone);
469
470 fileMenu->addSeparator();
471 fileMenu->addAction(m_closeProjectWorkOrder->clone() );
472 m_fileMenuActions.append( fileMenu->actions() );
473
475
476 // For JigsawWorkOrder, disable the work order utnil we have both an active control and image
477 // list. Setup a tool tip so user can see why the work order is disabled by default.
478 // NOTE: Trying to set a what's this on the clone doesn't seem to work for disabled actions,
479 // even though Qt's documentation says it should work on disabled actions.
480 clone = m_runJigsawWorkOrder->clone();
481 if (project()->controls().count() && project()->images().count()) {
482 clone->setEnabled(true);
483 }
484 else {
485 clone->setEnabled(false);
486 }
487
488 // Listen for when both images and control net have been added to the project.
489 connect(m_project, SIGNAL(controlsAndImagesAvailable()),
490 clone, SLOT(enableWorkOrder()));
491 // Listen for when both an active control and active image list have been set.
492 // When this happens, we can enable the JigsawWorkOrder.
493// connect(m_project, &Project::activeControlAndImageListSet,
494// clone, &WorkOrder::enableWorkOrder);
495
496 m_projectMenuActions.append(clone);
497
498// m_projectMenuActions.append( projectMenu->actions() );
499
500 m_editMenuActions = QList<QAction *>();
501 m_viewMenuActions = QList<QAction *>();
502 m_settingsMenuActions = QList<QAction *>();
503 m_helpMenuActions = QList<QAction *>();
504 }
505
506
512 if (!m_historyTreeWidget) {
514 }
515 historyContainer->setWidget(m_historyTreeWidget);
516 }
517
518
524 if (!m_warningTreeWidget) {
526 }
527 warningContainer->setWidget(m_warningTreeWidget);
528 }
529
530
536
537 m_recentProjects.append(recentProjects);
538 }
539
540
550
551 foreach(CnetEditorView *cnetEditorView, m_cnetEditorViewWidgets) {
552 if (cnetEditorView->control() == project()->activeControl()) {
553 emit closeView(cnetEditorView);
554 addCnetEditorView(project()->activeControl());
555 }
556 }
557 }
558
559
567 void Directory::newActiveControl(bool newControl) {
568
569 if (newControl && m_controlPointEditViewWidget) {
570 emit closeView(m_controlPointEditViewWidget);
571 delete m_controlPointEditViewWidget;
572 }
573
574 // If the new active control is the same as what is showing in the cnetEditorWidget, allow
575 // editing of control points from the widget, otherwise turnoff from context menu
576 foreach(CnetEditorView *cnetEditorView, m_cnetEditorViewWidgets) {
577 if (cnetEditorView->control() == project()->activeControl()) {
578 cnetEditorView->cnetEditorWidget()->pointTableView()->content()->setActiveControlNet(true);
579 cnetEditorView->cnetEditorWidget()->measureTableView()->content()->setActiveControlNet(true);
580 }
581 else {
582 cnetEditorView->cnetEditorWidget()->pointTableView()->content()->setActiveControlNet(false);
583 cnetEditorView->cnetEditorWidget()->measureTableView()->content()->setActiveControlNet(false);
584 }
585 }
586 }
587
588
596
597
603 BundleObservationView *result = new BundleObservationView(fileItem);
604
605 connect( result, SIGNAL( destroyed(QObject *) ),
606 this, SLOT( cleanupBundleObservationViews(QObject *) ) );
607
608 connect(result, SIGNAL(windowChangeEvent(bool)),
609 m_project, SLOT(setClean(bool)));
610
611 m_bundleObservationViews.append(result);
612
613 QString str = fileItem->fileName();
614 FileName fileName = fileItem->fileName();
615
616 // strip out bundle results name from fileName
617 QString path = fileName.originalPath();
618 int pos = path.lastIndexOf("/");
619 QString bundleResultsName = "";
620 if (pos != -1) {
621 bundleResultsName = path.remove(0,pos+1);
622 }
623
624 if (str.contains("bundleout")) {
625 result->setWindowTitle( tr("Summary (%1)").
626 arg( bundleResultsName ) );
627 result->setObjectName( result->windowTitle() );
628 }
629 if (str.contains("residuals")) {
630 result->setWindowTitle( tr("Measure Residuals (%1)").
631 arg( bundleResultsName ) );
632 result->setObjectName( result->windowTitle() );
633 }
634 else if (str.contains("points")) {
635 result->setWindowTitle( tr("Control Points (%1)").
636 arg( bundleResultsName ) );
637 result->setObjectName( result->windowTitle() );
638 }
639 else if (str.contains("images")) {
640 result->setWindowTitle( tr("Images (%1)").
641 arg( bundleResultsName ) );
642 result->setObjectName( result->windowTitle() );
643 }
644
645 emit newWidgetAvailable(result);
646
647 return result;
648 }
649
650
656 CnetEditorView *Directory::addCnetEditorView(Control *control, QString objectName) {
657
658 QString title = tr("Cnet Editor View %1").arg( control->displayProperties()->displayName() );
659 FileName configFile("$HOME/.Isis/" + QApplication::applicationName() + "/" + title + ".config");
660
661 CnetEditorView *result = new CnetEditorView(this, control, configFile);
662
663 if (project()->activeControl() && (control == project()->activeControl())) {
666 }
667
668 // connect destroyed signal to cleanupCnetEditorViewWidgets slot
669 connect(result, SIGNAL( destroyed(QObject *) ),
670 this, SLOT( cleanupCnetEditorViewWidgets(QObject *) ) );
671
672 connect(result, SIGNAL(windowChangeEvent(bool)),
673 m_project, SLOT(setClean(bool)));
674
675 // Connections for control point editing between views
676 connect(result->cnetEditorWidget(), SIGNAL(editControlPoint(ControlPoint *, QString)),
677 this, SLOT(modifyControlPoint(ControlPoint *, QString)));
678
679 // If a cnet is modified, we have to set the clean state in project and redraw measures.
680 connect(result->cnetEditorWidget(), SIGNAL(cnetModified()), this, SIGNAL(cnetModified()));
681 connect(this, SIGNAL(cnetModified()), result->cnetEditorWidget(), SLOT(rebuildModels()));
682
683 m_cnetEditorViewWidgets.append(result);
684 m_controlMap.insertMulti(control, result);
685
686 result->setWindowTitle(title);
687 if (objectName != "") {
688 result->setObjectName(objectName);
689 }
690 else {
691 // If no objectName, create unique identifier
692 QString newObjectName = QUuid::createUuid().toString().remove(QRegExp("[{}]"));
693 result->setObjectName(newObjectName);
694 }
695
696 emit newWidgetAvailable(result);
697
698 return result;
699 }
700
701
707 CubeDnView *result = new CubeDnView(this, qobject_cast<QMainWindow *>(parent()));
709 m_cubeDnViewWidgets.append(result);
710 connect( result, SIGNAL( destroyed(QObject *) ),
711 this, SLOT( cleanupCubeDnViewWidgets(QObject *) ) );
712
713 connect(result, SIGNAL(windowChangeEvent(bool)),
714 m_project, SLOT(setClean(bool)));
715
716 result->setWindowTitle( tr("Cube DN View %1").arg(m_cubeDnViewWidgets.count() ) );
717 // Unique objectNames are needed for the save/restoreState
718 if (objectName != "") {
719 result->setObjectName(objectName);
720 }
721 else {
722 // If no objectName, create unique identifier
723 QString newObjectName = QUuid::createUuid().toString().remove(QRegExp("[{}]"));
724 result->setObjectName(newObjectName);
725 }
726
727 emit newWidgetAvailable(result);
728
729 // Connections between mouse button events from view and control point editing
730 connect(result, SIGNAL(modifyControlPoint(ControlPoint *, QString)),
731 this, SLOT(modifyControlPoint(ControlPoint *, QString)));
732
733 connect(result, SIGNAL(deleteControlPoint(ControlPoint *)),
734 this, SLOT(deleteControlPoint(ControlPoint *)));
735
736 connect(result, SIGNAL(createControlPoint(double, double, Cube *, bool)),
737 this, SLOT(createControlPoint(double, double, Cube *, bool)));
738
739 // This signal is connected to the CubeDnView signal which connects to the slot,
740 // ControlNetTool::paintAllViewports(). ControlNetTool always redraws all control points, so
741 // both signals go to the same slot.
742 connect(this, SIGNAL(redrawMeasures()), result, SIGNAL(redrawMeasures()));
743
744 // If the active cnet is modified, redraw the measures
745 connect(this, SIGNAL(activeControlModified()), result, SIGNAL(redrawMeasures()));
746
747 connect (project(), SIGNAL(activeControlSet(bool)),
748 result, SLOT(enableControlNetTool(bool)));
749
750 return result;
751 }
752
758 Footprint2DView *result = new Footprint2DView(this);
759
760 // Set source model on Proxy
762 m_footprint2DViewWidgets.append(result);
763 result->setWindowTitle( tr("Footprint View %1").arg( m_footprint2DViewWidgets.count() ) );
764 // Unique objectNames are needed for the save/restoreState
765 if (objectName != "") {
766 result->setObjectName(objectName);
767 }
768 else {
769 // If no objectName, create unique identifier
770 QString newObjectName = QUuid::createUuid().toString().remove(QRegExp("[{}]"));
771 result->setObjectName(newObjectName);
772 }
773
774 connect(result, SIGNAL(destroyed(QObject *)),
776
777 connect(result, SIGNAL(windowChangeEvent(bool)),
778 m_project, SLOT(setClean(bool)));
779
780 emit newWidgetAvailable(result);
781
782 // Connections between mouse button events from footprint2DView and control point editing
783 connect(result, SIGNAL(modifyControlPoint(ControlPoint *)),
784 this, SLOT(modifyControlPoint(ControlPoint *)));
785
786 connect(result, SIGNAL(deleteControlPoint(ControlPoint *)),
787 this, SLOT(deleteControlPoint(ControlPoint *)));
788
789 connect(result, SIGNAL(createControlPoint(double, double)),
790 this, SLOT(createControlPoint(double, double)));
791
792 // The ControlPointEditWidget is only object that emits cnetModified when ControlPoint is
793 // deleted or saved. This requires the footprint view ControlNetGraphicsItems to be re-built
794 // when the active cnet is modified.
795 connect(this, SIGNAL(activeControlModified()), result->mosaicSceneWidget(), SIGNAL(cnetModified()));
796
797 // This signal is connected to the MosaicGraphicsScene::update(), which eventually calls
798 // ControlNetGraphicsItem::paint(), then ControlPointGraphicsItem::paint(). This should only
799 // be used if ControlNet has not changed. Used to update the current edit point in the view
800 // to be drawn with different color/shape.
801 connect(this, SIGNAL(redrawMeasures()), result, SIGNAL(redrawMeasures()));
802
803 connect (project(), SIGNAL(activeControlSet(bool)),
804 result, SLOT(enableControlNetTool(bool)));
805
806 return result;
807 }
808
809 ControlHealthMonitorView *Directory::controlHealthMonitorView() {
810 return m_controlHealthMonitorView;
811 }
812
813
814 ControlHealthMonitorView *Directory::addControlHealthMonitorView() {
815
816 if (!controlHealthMonitorView()) {
817
818 Control *activeControl = project()->activeControl();
819 if (activeControl == NULL) {
820 QString message = "No active control network chosen. Choose active control network on "
821 "project tree.\n";
822 QMessageBox::critical(qobject_cast<QWidget *>(parent()), "Error", message);
823 return NULL;
824 }
825
827 result->setWindowTitle(tr("Control NetHealth Monitor"));
828 result->setObjectName(result->windowTitle());
829
830 m_controlHealthMonitorView = result;
831 emit newWidgetAvailable(result);
832 }
833 return controlHealthMonitorView();
834 }
835
836
837 ControlPointEditView *Directory::addControlPointEditView() {
838
839 if (!controlPointEditView()) {
840 // TODO Need parent for controlPointWidget
841 ControlPointEditView *result = new ControlPointEditView(this);
842 result->setWindowTitle(tr("Control Point Editor"));
843 result->setObjectName(result->windowTitle());
844
845 Control *activeControl = project()->activeControl();
846 if (activeControl == NULL) {
847 // Error and return to Select Tool
848 QString message = "No active control network chosen. Choose active control network on "
849 "project tree.\n";
850 QMessageBox::critical(qobject_cast<QWidget *>(parent()), "Error", message);
851 return NULL;
852 }
853 result->controlPointEditWidget()->setControl(activeControl);
854
855 if (!project()->activeImageList() || !project()->activeImageList()->serialNumberList()) {
856 QString message = "No active image list chosen. Choose an active image list on the project "
857 "tree.\n";
858 QMessageBox::critical(qobject_cast<QWidget *>(parent()), "Error", message);
859 return NULL;
860 }
862 project()->activeImageList()->serialNumberList());
863
864 m_controlPointEditViewWidget = result;
865
866 connect(result, SIGNAL(destroyed(QObject *)),
868 emit newWidgetAvailable(result);
869
870// 2017-06-09 Ken commented out for Data Workshop demo
871// m_chipViewports = new ChipViewportsWidget(result);
872// connect(m_chipViewports, SIGNAL(destroyed(QObject *)), this, SLOT(cleanupchipViewportWidges()));
873// m_chipViewports->setWindowTitle(tr("ChipViewport View"));
874// m_chipViewports->setObjectName(m_chipViewports->windowTitle());
875// m_chipViewports->setSerialNumberList(project()->activeImageList()->serialNumberList());
876// m_chipViewports->setControlNet(activeControl->controlNet(), activeControl->fileName());
877// emit newWidgetAvailable(m_chipViewports);
878// 2017-06-09 Ken commented out for Data Workshop demo
879
880
881 // Create connections between signals from control point edit view and equivalent directory
882 // signals that can then be connected to other views that display control nets.
883 // If the active was modified, this will be signaled in project's cnetModified() and
884 // connected to other views to redraw themselves.
885 connect(result->controlPointEditWidget(), SIGNAL(cnetModified()),
886 this, SIGNAL(cnetModified()));
887
888 connect (project(), SIGNAL(activeControlSet(bool)),
889 result->controlPointEditWidget(), SLOT(setControlFromActive()));
890
891 connect(result, SIGNAL(windowChangeEvent(bool)),
892 m_project, SLOT(setClean(bool)));
893
894 // Recolors the save net button in controlPointEditView to black after the cnets are saved.
895 connect(m_project, SIGNAL(cnetSaved(bool)),
896 result->controlPointEditWidget(), SLOT(colorizeSaveNetButton(bool)));
897 }
898
899 return controlPointEditView();
900 }
901
902
903
904
905#if 0
906 ChipViewportsWidget *Directory::addControlPointChipView() {
907
908 ChipViewportsWidget *result = new ChipViewportsWidget(this);
909 connect(result, SIGNAL(destroyed(QObject *)), this, SLOT(cleanupchipViewportWidges()));
910 m_controlPointChipViews.append(result);
911 result->setWindowTitle(tr("ChipViewport View %1").arg(m_controlPointChipViews.count()));
912 result->setObjectName(result->windowTitle());
913 emit newWidgetAvailable(result);
914
915 return result;
916 }
917#endif
918
919
925 MatrixSceneWidget *result = new MatrixSceneWidget(NULL, true, true, this);
926
927 connect( result, SIGNAL( destroyed(QObject *) ),
928 this, SLOT( cleanupMatrixViewWidgets(QObject *) ) );
929
930 m_matrixViewWidgets.append(result);
931
932 result->setWindowTitle( tr("Matrix View %1").arg( m_matrixViewWidgets.count() ) );
933 result->setObjectName( result->windowTitle() );
934
935 emit newWidgetAvailable(result);
936
937 return result;
938 }
939
940
946 TargetInfoWidget *result = new TargetInfoWidget(target.data(), this);
947
948 connect( result, SIGNAL( destroyed(QObject *) ),
949 this, SLOT( cleanupTargetInfoWidgets(QObject *) ) );
950
951 m_targetInfoWidgets.append(result);
952
953 result->setWindowTitle( tr("%1").arg(target->displayProperties()->displayName() ) );
954 result->setObjectName( result->windowTitle() );
955
956 emit newWidgetAvailable(result);
957
958 return result;
959 }
960
961
967 TemplateEditorWidget *result = new TemplateEditorWidget(currentTemplate, this);
968
969 connect( result, SIGNAL( destroyed(QObject *) ),
970 this, SLOT( cleanupTemplateEditorWidgets(QObject *) ) );
971
972 m_templateEditorWidgets.append(result);
973
974 result->setWindowTitle( tr("%1").arg( FileName(currentTemplate->fileName()).name() ) );
975 result->setObjectName( result->windowTitle() );
976
977 emit newWidgetAvailable(result);
978
979 return result;
980 }
981
982 JigsawRunWidget *Directory::addJigsawRunWidget() {
983 if (jigsawRunWidget()) {
984 return m_jigsawRunWidget;
985 }
987
988 connect( result, SIGNAL( destroyed(QObject *) ),
989 this, SLOT( cleanupJigsawRunWidget(QObject *) ) );
990 m_jigsawRunWidget = result;
991
992 result->setAttribute(Qt::WA_DeleteOnClose);
993 result->show();
994
995 emit newWidgetAvailable(result);
996 return result;
997 }
998
999
1005 SensorInfoWidget *result = new SensorInfoWidget(camera.data(), this);
1006
1007 connect( result, SIGNAL( destroyed(QObject *) ),
1008 this, SLOT( cleanupSensorInfoWidgets(QObject *) ) );
1009
1010 m_sensorInfoWidgets.append(result);
1011
1012 result->setWindowTitle( tr("%1").arg(camera->displayProperties()->displayName() ) );
1013 result->setObjectName( result->windowTitle() );
1014
1015 emit newWidgetAvailable(result);
1016
1017 return result;
1018 }
1019
1020
1027 ImageFileListWidget *result = new ImageFileListWidget(this);
1028
1029 connect( result, SIGNAL( destroyed(QObject *) ),
1030 this, SLOT( cleanupFileListWidgets(QObject *) ) );
1031
1032 m_fileListWidgets.append(result);
1033
1034 result->setWindowTitle( tr("File List %1").arg( m_fileListWidgets.count() ) );
1035 // Unique objectNames are needed for the save/restoreState
1036 if (objectName != "") {
1037 result->setObjectName(objectName);
1038 }
1039 else {
1040 // If no objectName, create unique identifier
1041 QString newObjectName = QUuid::createUuid().toString().remove(QRegExp("[{}]"));
1042 result->setObjectName(newObjectName);
1043 }
1044
1045 return result;
1046 }
1047
1048
1056 result->setWindowTitle( tr("Project"));
1057 result->setObjectName( result->windowTitle() );
1058
1059 // The model emits this signal when the user double-clicks on the project name, the parent
1060 // node located on the ProjectTreeView.
1061 connect(m_projectItemModel, SIGNAL(projectNameEdited(QString)),
1062 this, SLOT(initiateRenameProjectWorkOrder(QString)));
1063
1064 connect(result, SIGNAL(windowChangeEvent(bool)),
1065 m_project, SLOT(setClean(bool)));
1066
1067 return result;
1068 }
1069
1070
1079
1080 // Create the WorkOrder and add it to the Project. The Project will then execute the
1081 // WorkOrder.
1082 RenameProjectWorkOrder *workOrder = new RenameProjectWorkOrder(projectName, project());
1083 project()->addToProject(workOrder);
1084 }
1085
1086
1094
1095
1103
1104
1109
1110 BundleObservationView *bundleObservationView = static_cast<BundleObservationView *>(obj);
1111 if (!bundleObservationView) {
1112 return;
1113 }
1114 m_bundleObservationViews.removeAll(bundleObservationView);
1115 m_project->setClean(false);
1116 }
1117
1118 // /**
1119 // * @brief Removes pointers to deleted Control Health Monitor objects.
1120 // */
1121 // void Directory::cleanupControlHealthMonitorView(QObject *obj) {
1122 //
1123 // ControlHealthMonitorView *healthMonitorView = static_cast<ControlHealthMonitorView *>(obj);
1124 // if (!healthMonitorView) {
1125 // return;
1126 // }
1127 //
1128 // m_project->setClean(false);
1129 // }
1130
1131
1136
1137 CnetEditorView *cnetEditorView = static_cast<CnetEditorView *>(obj);
1138 if (!cnetEditorView) {
1139 return;
1140 }
1141
1142 Control *control = m_controlMap.key(cnetEditorView);
1143 m_controlMap.remove(control, cnetEditorView);
1144
1145 if ( m_controlMap.count(control) == 0 && project()->activeControl() != control) {
1146 control->closeControlNet();
1147 }
1148
1149 m_cnetEditorViewWidgets.removeAll(cnetEditorView);
1150 m_project->setClean(false);
1151 }
1152
1153
1162
1163 bool result;
1164 if ( m_controlMap.count(control) == 0) {
1165 result = false;
1166 }
1167 else {
1168 result = true;
1169 }
1170 return result;
1171 }
1172
1173
1178
1179 CubeDnView *cubeDnView = static_cast<CubeDnView *>(obj);
1180 if (!cubeDnView) {
1181 return;
1182 }
1183 m_cubeDnViewWidgets.removeAll(cubeDnView);
1184 m_project->setClean(false);
1185 }
1186
1187
1192
1193 ImageFileListWidget *imageFileListWidget = static_cast<ImageFileListWidget *>(obj);
1194 if (!imageFileListWidget) {
1195 return;
1196 }
1197 m_fileListWidgets.removeAll(imageFileListWidget);
1198 m_project->setClean(false);
1199 }
1200
1201
1206
1207 Footprint2DView *footprintView = static_cast<Footprint2DView *>(obj);
1208 if (!footprintView) {
1209 return;
1210 }
1211 m_footprint2DViewWidgets.removeAll(footprintView);
1212 m_project->setClean(false);
1213 }
1214
1215
1220
1222 if (!controlPointEditView) {
1223 return;
1224 }
1225 m_controlPointEditViewWidget = NULL;
1226 m_project->setClean(false);
1227
1228 }
1229
1230
1235
1236 MatrixSceneWidget *matrixWidget = static_cast<MatrixSceneWidget *>(obj);
1237 if (!matrixWidget) {
1238 return;
1239 }
1240 m_matrixViewWidgets.removeAll(matrixWidget);
1241 m_project->setClean(false);
1242 }
1243
1244
1249
1250 SensorInfoWidget *sensorInfoWidget = static_cast<SensorInfoWidget *>(obj);
1251 if (!sensorInfoWidget) {
1252 return;
1253 }
1254 m_sensorInfoWidgets.removeAll(sensorInfoWidget);
1255 m_project->setClean(false);
1256 }
1257
1258
1263
1264 TargetInfoWidget *targetInfoWidget = static_cast<TargetInfoWidget *>(obj);
1265 if (!targetInfoWidget) {
1266 return;
1267 }
1268 m_targetInfoWidgets.removeAll(targetInfoWidget);
1269 m_project->setClean(false);
1270 }
1271
1272
1277
1278 TemplateEditorWidget *templateEditorWidget = static_cast<TemplateEditorWidget *>(obj);
1279 if (!templateEditorWidget) {
1280 return;
1281 }
1282
1283 m_templateEditorWidgets.removeAll(templateEditorWidget);
1284 m_project->setClean(false);
1285 }
1286
1287
1288 void Directory::cleanupJigsawRunWidget(QObject *obj) {
1289 JigsawRunWidget *jigsawRunWidget = static_cast<JigsawRunWidget *>(obj);
1290 if (!jigsawRunWidget) {
1291 return;
1292 }
1293 m_jigsawRunWidget = NULL;
1294 }
1295
1296
1303 m_recentProjects.insert( 0, project->projectRoot() );
1304 }
1305
1306
1312 return m_project;
1313 }
1314
1315
1320 QList<CnetEditorView *> Directory::cnetEditorViews() {
1321 QList<CnetEditorView *> results;
1322
1323 foreach (CnetEditorView *widget, m_cnetEditorViewWidgets) {
1324 results.append(widget);
1325 }
1326
1327 return results;
1328 }
1329
1330
1335 QList<CubeDnView *> Directory::cubeDnViews() {
1336 QList<CubeDnView *> results;
1337
1338 foreach (CubeDnView *widget, m_cubeDnViewWidgets) {
1339 results.append(widget);
1340 }
1341
1342 return results;
1343 }
1344
1345
1350 QList<MatrixSceneWidget *> Directory::matrixViews() {
1351 QList<MatrixSceneWidget *> results;
1352
1353 foreach (MatrixSceneWidget *widget, m_matrixViewWidgets) {
1354 results.append(widget);
1355 }
1356
1357 return results;
1358 }
1359
1360
1365 QList<SensorInfoWidget *> Directory::sensorInfoViews() {
1366 QList<SensorInfoWidget *> results;
1367
1368 foreach (SensorInfoWidget *widget, m_sensorInfoWidgets) {
1369 results.append(widget);
1370 }
1371
1372 return results;
1373 }
1374
1375
1380 QList<TargetInfoWidget *> Directory::targetInfoViews() {
1381 QList<TargetInfoWidget *> results;
1382
1383 foreach (TargetInfoWidget *widget, m_targetInfoWidgets) {
1384 results.append(widget);
1385 }
1386
1387 return results;
1388 }
1389
1390
1395 QList<TemplateEditorWidget *> Directory::templateEditorViews() {
1396 QList<TemplateEditorWidget *> results;
1397
1399 results.append(widget);
1400 }
1401
1402 return results;
1403 }
1404
1405
1410 QList<Footprint2DView *> Directory::footprint2DViews() {
1411 QList<Footprint2DView *> results;
1412
1413 foreach (Footprint2DView *view, m_footprint2DViewWidgets) {
1414 results.append(view);
1415 }
1416
1417 return results;
1418 }
1419
1420
1425 QList<ImageFileListWidget *> Directory::imageFileListViews() {
1426 QList<ImageFileListWidget *> results;
1427
1428 foreach (ImageFileListWidget *widget, m_fileListWidgets) {
1429 results.append(widget);
1430 }
1431
1432 return results;
1433 }
1434
1440
1441 return m_controlPointEditViewWidget;
1442 }
1443
1444
1445 JigsawRunWidget *Directory::jigsawRunWidget() {
1446
1447 return m_jigsawRunWidget;
1448 }
1449
1450
1451/*
1452 ChipViewportsWidget *Directory::controlPointChipViewports() {
1453
1454 return m_chipViewports;
1455 }
1456*/
1457
1462//ControlNetEditor *Directory::controlNetEditor() {
1463// return m_cnetEditor;
1464//}
1465
1466
1471 QList<QProgressBar *> Directory::progressBars() {
1472 QList<QProgressBar *> result;
1473 return result;
1474 }
1475
1476
1481 void Directory::showWarning(QString text) {
1482 m_warningTreeWidget->showWarning(text);
1483 emit newWarning();
1484 }
1485
1486
1492 return project()->undoStack()->createRedoAction(this);
1493 }
1494
1495
1501 return project()->undoStack()->createUndoAction(this);
1502 }
1503
1504
1510 xmlReader->pushContentHandler( new XmlHandler(this) );
1511 }
1512
1513
1523 void Directory::save(QXmlStreamWriter &stream, FileName newProjectRoot) const {
1524 stream.writeStartElement("directory");
1525
1526 if ( !m_fileListWidgets.isEmpty() ) {
1527 stream.writeStartElement("fileListWidgets");
1528
1529 foreach (ImageFileListWidget *fileListWidget, m_fileListWidgets) {
1530 fileListWidget->save(stream, project(), newProjectRoot);
1531 }
1532
1533 stream.writeEndElement();
1534 }
1535
1536 // Save footprints
1537 if ( !m_footprint2DViewWidgets.isEmpty() ) {
1538 stream.writeStartElement("footprintViews");
1539
1540 foreach (Footprint2DView *footprint2DViewWidget, m_footprint2DViewWidgets) {
1541 footprint2DViewWidget->save(stream, project(), newProjectRoot);
1542 }
1543
1544 stream.writeEndElement();
1545 }
1546
1547 // Save cubeDnViews
1548 if ( !m_cubeDnViewWidgets.isEmpty() ) {
1549 stream.writeStartElement("cubeDnViews");
1550
1551 foreach (CubeDnView *cubeDnView, m_cubeDnViewWidgets) {
1552 cubeDnView->save(stream, project(), newProjectRoot);
1553 }
1554
1555 stream.writeEndElement();
1556 }
1557
1558 // Save cnetEditorViews
1559 if ( !m_cnetEditorViewWidgets.isEmpty() ) {
1560 stream.writeStartElement("cnetEditorViews");
1561
1562 foreach (CnetEditorView *cnetEditorWidget, m_cnetEditorViewWidgets) {
1563 cnetEditorWidget->save(stream, project(), newProjectRoot);
1564 }
1565
1566 stream.writeEndElement();
1567 }
1568
1569
1570 stream.writeEndElement();
1571 }
1572
1573
1579 m_directory = directory;
1580 }
1581
1582
1588
1589
1605 bool Directory::XmlHandler::startElement(const QString &namespaceURI, const QString &localName,
1606 const QString &qName, const QXmlAttributes &atts) {
1607 bool result = XmlStackedHandler::startElement(namespaceURI, localName, qName, atts);
1608 if (result) {
1609 QString viewObjectName;
1610 if (localName == "footprint2DView") {
1611 viewObjectName = atts.value("objectName");
1612 m_directory->addFootprint2DView(viewObjectName)->load(reader());
1613 }
1614 else if (localName == "imageFileList") {
1615 viewObjectName = atts.value("objectName");
1616 m_directory->addImageFileListView(viewObjectName)->load(reader());
1617 }
1618 else if (localName == "cubeDnView") {
1619 viewObjectName = atts.value("objectName");
1620 m_directory->addCubeDnView(viewObjectName)->load(reader(), m_directory->project());
1621 }
1622 else if (localName == "cnetEditorView") {
1623 viewObjectName = atts.value("objectName");
1624 QString id = atts.value("id");
1625 m_directory->addCnetEditorView(m_directory->project()->control(id), viewObjectName);
1626 }
1627 }
1628
1629 return result;
1630 }
1631
1632
1694 QList< QPair< QString, QList<QAction *> > > actionPairings) {
1695 QList<QAction *> results;
1696
1697 QStringList sortedActionTexts;
1698
1699 // This is a map from the Action Text to the actions and their widget titles
1700 QMap< QString, QList< QPair<QString, QAction *> > > restructuredData;
1701
1702 QPair< QString, QList<QAction *> > singleWidgetPairing;
1703 foreach (singleWidgetPairing, actionPairings) {
1704 QString widgetTitle = singleWidgetPairing.first;
1705 QList<QAction *> widgetActions = singleWidgetPairing.second;
1706
1707 foreach (QAction *widgetAction, widgetActions) {
1708 if (widgetAction) {
1709 QString actionText = widgetAction->text();
1710
1711 restructuredData[actionText].append( qMakePair(widgetTitle, widgetAction) );
1712
1713 if ( !sortedActionTexts.contains(actionText) ) {
1714 sortedActionTexts.append(actionText);
1715 }
1716 }
1717 else {
1718 // Add separator
1719 if ( !sortedActionTexts.isEmpty() && !sortedActionTexts.last().isEmpty() ) {
1720 sortedActionTexts.append("");
1721 }
1722 }
1723 }
1724 }
1725
1726 if ( sortedActionTexts.count() && sortedActionTexts.last().isEmpty() ) {
1727 sortedActionTexts.removeLast();
1728 }
1729
1730 foreach (QString actionText, sortedActionTexts) {
1731 if ( actionText.isEmpty() ) {
1732 results.append(NULL);
1733 }
1734 else {
1735 // We know this list isn't empty because we always appended to the value when we
1736 // accessed a particular key.
1737 QList< QPair<QString, QAction *> > actions = restructuredData[actionText];
1738
1739 if (actions.count() == 1) {
1740 QAction *finalAct = actions.first().second;
1741 QString widgetTitle = actions.first().first;
1742
1743 finalAct->setText( tr("%1 on %2").arg(actionText).arg(widgetTitle) );
1744 results.append(finalAct);
1745 }
1746 else {
1747 QAction *menuAct = new QAction(actionText, NULL);
1748
1749 QMenu *menu = new QMenu;
1750 menuAct->setMenu(menu);
1751
1752 QList<QAction *> actionsInsideMenu;
1753
1754 QPair<QString, QAction *> widgetTitleAndAction;
1755 foreach (widgetTitleAndAction, actions) {
1756 QString widgetTitle = widgetTitleAndAction.first;
1757 QAction *action = widgetTitleAndAction.second;
1758
1759 action->setText(widgetTitle);
1760 actionsInsideMenu.append(action);
1761 }
1762
1763 qSort(actionsInsideMenu.begin(), actionsInsideMenu.end(), &actionTextLessThan);
1764
1765 QAction *allAct = new QAction(tr("All"), NULL);
1766
1767 foreach (QAction *actionInMenu, actionsInsideMenu) {
1768 connect( allAct, SIGNAL( triggered() ),
1769 actionInMenu, SIGNAL( triggered() ) );
1770 menu->addAction(actionInMenu);
1771 }
1772
1773 menu->addSeparator();
1774 menu->addAction(allAct);
1775
1776 results.append(menuAct);
1777 }
1778 }
1779 }
1780
1781 return results;
1782 }
1783
1784
1794 return lhs->text().localeAwareCompare( rhs->text() ) < 0;
1795
1796 }
1797
1798
1803#if 0
1804 if (m_controlPointEditView && m_footprint2DViewWidgets.size() == 1) {
1805 connect(m_footprint2DViewWidgets.at(0), SIGNAL(controlPointSelected(ControlPoint *)),
1806 m_controlPointEdit, SLOT(loadControlPoint(ControlPoint *)));
1807 connect(m_cnetEditor, SIGNAL(controlPointCreated(ControlPoint *)),
1808 m_controlPointEditWidget, SLOT(setEditPoint(ControlPoint *)));
1809
1810 // MosaicControlTool->MosaicSceneWidget->ControlNetEditor
1811 connect( m_footprint2DViewWidgets.at(0), SIGNAL( deleteControlPoint(QString) ),
1812 m_cnetEditor, SLOT( deleteControlPoint(QString) ) );
1813 // ControlNetEditor->MosaicSceneWidget->MosaicControlTool
1814 connect( m_cnetEditor, SIGNAL( controlPointDeleted() ),
1815 m_footprint2DViewWidgets.at(0), SIGNAL( controlPointDeleted() ) );
1816
1817
1818 // TODO Figure out which footprint view has the "active" cnet.
1819 //qDebug() << "\t\tMos items: " << m_footprint2DViewWidgets.at(0);
1820 connect(m_controlPointEditWidget, SIGNAL(controlPointChanged(QString)),
1821 m_footprint2DViewWidgets.at(0), SIGNAL(controlPointChanged(QString)));
1822 }
1823#endif
1824 }
1825
1826
1836 void Directory::modifyControlPoint(ControlPoint *controlPoint, QString serialNumber) {
1837
1838 if (controlPoint) {
1839 if (!controlPointEditView()) {
1840 if (!addControlPointEditView()) {
1841 return;
1842 }
1843 }
1844 m_editPointId = controlPoint->GetId();
1845 emit redrawMeasures();
1846
1847 controlPointEditView()->controlPointEditWidget()->setEditPoint(controlPoint, serialNumber);
1848 }
1849 }
1850
1851
1859
1860 if (controlPoint) {
1861 if (!controlPointEditView()) {
1862 if (!addControlPointEditView()) {
1863 return;
1864 }
1865 }
1866 m_editPointId = controlPoint->GetId();
1867
1868 // Update views with point to be deleted shown as current edit point
1869 emit redrawMeasures();
1870
1872 }
1873 }
1874
1875
1889 void Directory::createControlPoint(double latitude, double longitude, Cube *cube,
1890 bool isGroundSource) {
1891
1892 if (!controlPointEditView()) {
1893 if (!addControlPointEditView()) {
1894 return;
1895 }
1896 }
1898 latitude, longitude, cube, isGroundSource);
1899
1901 }
1902
1903
1910 return m_editPointId;
1911 }
1912}
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.
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.
virtual void setModel(ProjectItemModel *model)
Sets the model used by the view.
View for displaying BundleObservation CSV files.
Scrolled widget for display ChipViewports.
Ipce view containing the CnetEditorWidget.
CnetEditorWidget * cnetEditorWidget()
Returns the cnetEditorWidget.
void save(QXmlStreamWriter &stream, Project *project, FileName newProjectRoot) const
This method saves the Controls object ids to the stream.
TableView * pointTableView()
Returns the point table view.
TableView * measureTableView()
Returns the measure table view.
View for the Control Net Health Monitor.
This represents an ISIS control net in a project-based GUI interface.
Definition Control.h:66
ControlDisplayProperties * displayProperties()
Access a pointer to the display properties for the control network.
Definition Control.cpp:252
void closeControlNet()
Cleans up the ControlNet pointer.
Definition Control.cpp:214
Maintains a list of Controls so that control nets can easily be copied from one Project to another,...
Definition ControlList.h:44
View for editing a single ControlPoint.
ControlPointEditWidget * controlPointEditWidget()
Returns the ControlPointEditWidget.
void deletePoint(ControlPoint *controlPoint)
Gives user options for deleting a control point from the control network.
void setEditPoint(ControlPoint *controlPoint, QString serialNumber="")
Slot called by Directory to set the control point for editing.
void setControl(Control *control)
New control network being edited.
void setSerialNumberList(SerialNumberList *snList)
Set the serial number list.
void createControlPoint(double latitude, double longitude, Cube *cube=0, bool isGroundSource=false)
Create a new control point at the given latitude, longitude.
A single control point.
QString GetId() const
Return the Id of the control point.
View that displays cubes in a QView-like way.
Definition CubeDnView.h:97
IO Handler for Isis Cubes.
Definition Cube.h:168
Directory * m_directory
Pointer to a Directory which is set by the XmlHandler class.
Definition Directory.h:456
~XmlHandler()
The Destructor for Directory::XmlHandler.
XmlHandler(Directory *directory)
This function sets the Directory pointer for the Directory::XmlHandler class.
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.
QString m_editPointId
Current control point that is in the ControlPointEditWidget.
Definition Directory.h:543
void load(XmlStackedHandlerReader *xmlReader)
Loads the Directory from an XML file.
ProjectItemTreeView * addProjectItemTreeView()
Adds a ProjectItemTreeView to the window.
QPointer< WorkOrder > m_importMapTemplateWorkOrder
The Import Map Template WorkOrder.
Definition Directory.h:524
void cleanupControlPointEditViewWidget(QObject *)
Delete the ControlPointEditWidget and set it's pointer to NULL.
QList< TemplateEditorWidget * > templateEditorViews()
Accessor for the list of TemplateEditorWidgets currently available.
QPointer< WorkOrder > m_importShapesWorkOrder
The import shapes WorkOrder.
Definition Directory.h:518
QPointer< WorkOrder > m_exportImagesWorkOrder
The export images WorkOrder.
Definition Directory.h:515
void reloadActiveControlInCnetEditorView()
@description This slot was created specifically for the CnetEditorWidgets when user chooses a new act...
QList< SensorInfoWidget * > sensorInfoViews()
Accessor for the list of SensorInfoWidgets currently available.
void updateRecentProjects()
Loads and displays a list of recently opened projects in the file menu.
void cleanupFootprint2DViewWidgets(QObject *)
Removes pointers to deleted Footprint2DView objects.
void cleanupCnetEditorViewWidgets(QObject *)
Removes pointers to deleted CnetEditorWidget objects.
QList< QAction * > settingsMenuActions()
Get the list of actions that the Directory can provide for the settings menu.
QList< QPointer< CubeDnView > > m_cubeDnViewWidgets
List of CubeDnCiew obs.
Definition Directory.h:496
void setWarningContainer(QDockWidget *warningContainer)
Set up the warning info in the warning dockable widget.
QList< QAction * > m_settingsMenuActions
List of menu settings actions.
Definition Directory.h:534
void initiateRenameProjectWorkOrder(QString projectName)
Slot which is connected to the model's signal, projectNameEdited, which is emitted when the user doub...
QList< QAction * > m_fileMenuActions
List of file menu actions.
Definition Directory.h:530
void cleanupBundleObservationViews(QObject *)
Removes pointers to deleted BundleObservationView objects.
QList< Footprint2DView * > footprint2DViews()
Accessor for the list of Footprint2DViews currently available.
QList< QAction * > m_toolPadActions
List of ToolPad actions.
Definition Directory.h:539
MatrixSceneWidget * addMatrixView()
Add the matrix view widget to the window.
void updateControlNetEditConnections()
Updates the SIGNAL/SLOT connections for the cotrol net editor.
TemplateEditorWidget * addTemplateEditorView(Template *currentTemplate)
Add template editor view widget to the window.
QList< QAction * > fileMenuActions()
Get the list of actions that the Directory can provide for the file menu.
Directory(QObject *parent=0)
The Constructor.
void deleteControlPoint(ControlPoint *controlPoint)
Slot that is connected from a middle mouse button operation on views.
QAction * redoAction()
Creates an Action to redo the last action.
QList< QAction * > editMenuActions()
Get the list of actions that the Directory can provide for the edit menu.
void save(QXmlStreamWriter &stream, FileName newProjectRoot) const
Save the directory to an XML file.
BundleObservationView * addBundleObservationView(FileItemQsp fileItem)
Add the BundleObservationView to the window.
~Directory()
The Destructor.
void cleanupTemplateEditorWidgets(QObject *)
Removes pointers to deleted TemplateEditorWidget objects.
QList< ImageFileListWidget * > imageFileListViews()
Accessor for the list of ImageFileListWidgets currently available.
QList< QAction * > activeToolBarActions()
Get the list of actions that the Directory can provide for the active Tool Bar.
QPointer< WorkOrder > m_saveProjectWorkOrder
The Save Project WorkOrder.
Definition Directory.h:520
void modifyControlPoint(ControlPoint *controlPoint, QString serialNumber="")
Slot that is connected from a left mouse button operation on views.
QList< QAction * > m_projectMenuActions
List of project menu actions.
Definition Directory.h:531
QPointer< WorkOrder > m_importRegistrationTemplateWorkOrder
The Import Registration Template WorkOrder.
Definition Directory.h:525
QList< QAction * > m_editMenuActions
List of edit menu actions.
Definition Directory.h:532
QPointer< HistoryTreeWidget > m_historyTreeWidget
Pointer to the HistoryTreeWidget.
Definition Directory.h:487
QList< QPointer< TemplateEditorWidget > > m_templateEditorWidgets
List of TemplateEditorWidgets.
Definition Directory.h:506
QPointer< WorkOrder > m_importControlNetWorkOrder
The import ControlNetwork WorkOrder.
Definition Directory.h:516
void cleanupTargetInfoWidgets(QObject *)
Removes pointers to deleted TargetInfoWidget objects.
QList< QPointer< MatrixSceneWidget > > m_matrixViewWidgets
List of MatrixSceneWidgets.
Definition Directory.h:503
void initializeActions()
Initializes the actions that the Directory can provide to a main window.
QList< CnetEditorView * > cnetEditorViews()
Returns a list of all the control network views for this directory.
QPointer< WorkOrder > m_closeProjectWorkOrder
The Close Project WorkOrder.
Definition Directory.h:523
QPointer< ProjectItemModel > m_projectItemModel
Pointer to the ProjectItemModel.
Definition Directory.h:484
QList< QAction * > toolPadActions()
Get the list of actions that the Directory can provide for the Tool Pad.
void newActiveControl(bool newControl)
@description This slot is connected from the signal activeControlSet(bool) emitted from Project.
void cleanupMatrixViewWidgets(QObject *)
Removes pointers to deleted MatrixSceneWidget objects.
CubeDnView * addCubeDnView(QString objectName="")
Add the qview workspace to the window.
QPointer< WorkOrder > m_importImagesWorkOrder
The import images WorkOrder.
Definition Directory.h:517
QList< QAction * > permToolBarActions()
Get the list of actions that the Directory can provide for the permanent Tool Bar.
void clean()
Cleans directory of everything to do with the current project.
QList< QAction * > m_viewMenuActions
List of view menu actions.
Definition Directory.h:533
QStringList recentProjectsList()
Public accessor for the list of recent projects.
void setRecentProjectsList(QStringList recentProjects)
Add recent projects to the recent projects list.
ImageFileListWidget * addImageFileListView(QString objectName="")
Add an imageFileList widget to the window.
QList< CubeDnView * > cubeDnViews()
Accessor for the list of CubeDnViews currently available.
QPointer< JigsawRunWidget > m_jigsawRunWidget
Pointer to the JigsawRunWidget.
Definition Directory.h:490
TargetInfoWidget * addTargetInfoView(TargetBodyQsp target)
Add target body data view widget to the window.
void setHistoryContainer(QDockWidget *historyContainer)
Set up the history info in the history dockable widget.
QList< QAction * > m_activeToolBarActions
List of active ToolBar actions.
Definition Directory.h:538
QList< QPointer< ImageFileListWidget > > m_fileListWidgets
List of ImageFileListWidgets.
Definition Directory.h:497
QString editPointId()
Return the current control point id loaded in the ControlPointEditWidget.
QList< QAction * > m_permToolBarActions
List of perm ToolBar actions.
Definition Directory.h:537
static QList< QAction * > restructureActions(QList< QPair< QString, QList< QAction * > > >)
Reformat actionPairings to be user friendly for use in menus.
void showWarning(QString text)
Displays a Warning.
QList< TargetInfoWidget * > targetInfoViews()
Accessor for the list of TargetInfoWidgets currently available.
QAction * undoAction()
Creates an Action to undo the last action.
static bool actionTextLessThan(QAction *lhs, QAction *rhs)
This is for determining the ordering of the descriptive text of for the actions.
QList< QAction * > m_helpMenuActions
List of help menu actions.
Definition Directory.h:535
Project * project() const
Gets the Project for this directory.
QPointer< WorkOrder > m_saveProjectAsWorkOrder
The Save Project As WorkOrder.
Definition Directory.h:521
QList< QProgressBar * > progressBars()
Gets the ControlNetEditor associated with this the Directory.
void createControlPoint(double latitude, double longitude, Cube *cube=0, bool isGroundSource=false)
Slot that is connected from a right mouse button operation on views.
QList< QAction * > viewMenuActions()
Get the list of actions that the Directory can provide for the view menu.
void cleanupCubeDnViewWidgets(QObject *)
Removes pointers to deleted CubeDnView objects.
QList< QPointer< CnetEditorView > > m_cnetEditorViewWidgets
List of CnetEditorViews.
Definition Directory.h:495
QWidget * warningWidget()
Returns a pointer to the warning widget.
QMultiMap< Control *, CnetEditorView * > m_controlMap
Map to hold every view with an open Control.
Definition Directory.h:541
SensorInfoWidget * addSensorInfoView(GuiCameraQsp camera)
Add sensor data view widget to the window.
void cleanupFileListWidgets(QObject *)
Removes pointers to deleted ImageFileListWidget objects.
QStringList m_recentProjects
List of the names of recent projects.
Definition Directory.h:510
QPointer< WorkOrder > m_exportControlNetWorkOrder
The export ControlNetwork WorkOrder.
Definition Directory.h:514
void cleanupSensorInfoWidgets(QObject *)
Removes pointers to deleted SensorInfoWidget objects.
ProjectItemModel * model()
Gets the ProjectItemModel for this directory.
QPointer< WarningTreeWidget > m_warningTreeWidget
Pointer to the WarningTreeWidget.
Definition Directory.h:489
QList< QPointer< TargetInfoWidget > > m_targetInfoWidgets
List of TargetInfoWidgets.
Definition Directory.h:505
Footprint2DView * addFootprint2DView(QString objectName="")
Add the qmos view widget to the window.
QPointer< WorkOrder > m_runJigsawWorkOrder
The Run Jigsaw WorkOrder.
Definition Directory.h:527
QList< QPointer< SensorInfoWidget > > m_sensorInfoWidgets
List of SensorInfoWidgets.
Definition Directory.h:504
QPointer< Project > m_project
Pointer to the Project.
Definition Directory.h:488
QList< MatrixSceneWidget * > matrixViews()
Accessor for the list of MatrixSceneWidgets currently available.
QList< QAction * > projectMenuActions()
Get the list of actions that the Directory can provide for the project menu.
CnetEditorView * addCnetEditorView(Control *control, QString objectName="")
Add the widget for the cnet editor view to the window.
ControlPointEditView * controlPointEditView()
Gets the ControlPointEditWidget associated with the Directory.
QList< QPointer< Footprint2DView > > m_footprint2DViewWidgets
List of Footprint2DView objs.
Definition Directory.h:498
bool controlUsedInCnetEditorWidget(Control *control)
@description Return true if control is not currently being viewed in a CnetEditorWidget
QList< QPointer< WorkOrder > > m_workOrders
List of WorkOrders.
Definition Directory.h:508
QPointer< WorkOrder > m_openProjectWorkOrder
The Open Project WorkOrder.
Definition Directory.h:519
QList< QAction * > helpMenuActions()
Get the list of actions that the Directory can provide for the help menu.
QPointer< WorkOrder > m_renameProjectWorkOrder
The Rename Project WorkOrder.
Definition Directory.h:528
QString displayName() const
Returns the display name.
File name manipulation and expansion.
Definition FileName.h:100
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
Definition FileName.cpp:162
QString originalPath() const
Returns the path of the original file name.
Definition FileName.cpp:84
View for displaying footprints of images in a QMos like way.
MosaicSceneWidget * mosaicSceneWidget()
Accessor for the MosaicSceneWidget.
History Widget for ipce.
Isis exception class.
Definition IException.h:91
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition IException.h:146
A colored, grouped cube list.
void save(QXmlStreamWriter &stream, Project *project, FileName newProjectRoot) const
This method saves the FootprintColumns in the project and the settings associated with every column.
Internalizes a list of images and allows for operations on the entire list.
Definition ImageList.h:55
This dialog allows the user to select the bundle adjust parameters, run the bundle,...
This widget encompasses the entire matrixDisplay scene.
This opens a project that's saved on disk.
The main project for ipce.
Definition Project.h:289
QUndoStack * undoStack()
Returns the Projects stack of QUndoCommands.
Definition Project.cpp:1693
void addToProject(WorkOrder *)
This executes the WorkOrder and stores it in the project.
Definition Project.cpp:2597
QString projectRoot() const
Get the top-level folder of the project.
Definition Project.cpp:1665
Control * activeControl()
Return the Active Control (control network)
Definition Project.cpp:1902
static int maxRecentProjects()
Return max number of recent projects to be displayed.
Definition Project.h:396
Provides access to data stored in a Project through Qt's model-view framework.
A ProjectItemTreeView displays items from a ProjectItemProxyModel in a tree structure.
Change the project's GUI name.
Widget for displaying information about a sensor.
void setActiveControlNet(bool activeNet)
Sets if there is an active control net.
TableViewContent * content()
Returns the content of the table.
Widget for displaying information about a target.
Widget for displaying information about a target.
Warning Widget for ipce.
Provide Undo/redo abilities, serialization, and history for an operation.
Definition WorkOrder.h:311
Manage a stack of content handlers for reading XML files.
This is free and unencumbered software released into the public domain.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
This is free and unencumbered software released into the public domain.