File failed to load: https://isis.astrogeology.usgs.gov/9.0.0/Object/assets/jax/output/NativeMML/config.js
Isis 3 Programmer Reference
MosaicMainWindow.cpp
1#include "MosaicMainWindow.h"
2
3#include <QApplication>
4#include <QDockWidget>
5#include <QHBoxLayout>
6#include <QLabel>
7#include <QMenu>
8#include <QMenuBar>
9#include <QMessageBox>
10#include <QProgressBar>
11#include <QPushButton>
12#include <QSettings>
13#include <QScrollArea>
14#include <QStatusBar>
15#include <QVBoxLayout>
16#include <QWhatsThis>
17
18#include "Camera.h"
19#include "FileDialog.h"
20#include "MosaicController.h"
21#include "ImageFileListWidget.h"
22#include "ImageTreeWidgetItem.h"
23#include "IString.h"
24#include "MosaicSceneWidget.h"
25#include "Projection.h"
26#include "ProjectionFactory.h"
27#include "TextFile.h"
28#include "ToolPad.h"
29
30
31namespace Isis {
32 MosaicMainWindow::MosaicMainWindow(QString title, QWidget *parent) :
33 MainWindow(title, parent),
34 m_settings(FileName("$HOME/.Isis/qmos/qmos.config").expanded(),
35 QSettings::NativeFormat) {
36 m_filename = "";
37 m_fileMenu = NULL;
38 m_settingsMenu = NULL;
39 m_viewMenu = NULL;
40
41 setObjectName("MosaicMainWindow");
42
43 m_controllerVisible = false;
44
45 setWindowTitle(title);
46
47 m_permToolbar = new QToolBar("Standard Tools", this);
48 m_permToolbar->setObjectName("Standard Tools");
49 m_permToolbar->setWhatsThis("This area contains options that are always "
50 "present in qmos, regardless of whether or not a project is open. "
51 "These options are also found in the File menu.");
52 addToolBar(m_permToolbar);
53
54 m_activeToolbar = new QToolBar("Active Tool", this);
55 m_activeToolbar->setObjectName("Active Tool");
56 m_activeToolbar->setWhatsThis("The currently selected tool's options will "
57 "show up here. Not all tools have options.");
58 addToolBar(m_activeToolbar);
59
60 statusBar()->showMessage("Ready");
61
62 m_toolpad = new ToolPad("Tool Pad", this);
63 m_toolpad->setObjectName("Tool Pad");
64 // default to the right hand side for qview-like behavior... we might
65 // want to do something different here
66 addToolBar(Qt::RightToolBarArea, m_toolpad);
67
68 setupMenus();
69
70 m_fileListDock = new QDockWidget("File List", this, Qt::SubWindow);
71 m_fileListDock->setObjectName("FileListDock");
72 m_fileListDock->setFeatures(QDockWidget::DockWidgetFloatable |
73 QDockWidget::DockWidgetMovable |
74 QDockWidget::DockWidgetClosable);
75 m_fileListDock->setWhatsThis("This contains the mosaic file list.");
76
77 m_mosaicPreviewDock = new QDockWidget("Mosaic World View",
78 this, Qt::SubWindow);
79 m_mosaicPreviewDock->setObjectName("MosaicPreviewDock");
80 m_mosaicPreviewDock->setFeatures(QDockWidget::DockWidgetFloatable |
81 QDockWidget::DockWidgetMovable |
82 QDockWidget::DockWidgetClosable);
83 m_mosaicPreviewDock->setWhatsThis("This contains a zoomed out view of the "
84 "mosaic.");
85
86 addDockWidget(Qt::LeftDockWidgetArea, m_fileListDock);
87 addDockWidget(Qt::LeftDockWidgetArea, m_mosaicPreviewDock);
88
89 readSettings();
90
91 setCentralWidget(new QWidget());
92 centralWidget()->setLayout(new QHBoxLayout());
93
94 m_mosaicController = NULL;
95 createController();
96 displayController();
97 installEventFilter(this);
98
99 QStringList args = QApplication::arguments();
100 args.removeFirst();
101
102 QStringList filesToOpen;
103 bool projectLoaded = false;
104
105 foreach (QString argument, args) {
106 QRegExp cubeName(".*\\.cub$", Qt::CaseInsensitive);
107 QRegExp cubeListName(".*\\.(lis|txt)$", Qt::CaseInsensitive);
108 QRegExp projectName(".*\\.mos$", Qt::CaseInsensitive);
109
110 try {
111 if (cubeName.exactMatch(argument)) {
112 filesToOpen.append(argument);
113 }
114 else if (cubeListName.exactMatch(argument)) {
115 TextFile fileList(argument);
116 QString line;
117
118 while(fileList.GetLine(line)) {
119 filesToOpen.append(line);
120 }
121 }
122 else if (projectName.exactMatch(argument)) {
123 if (!projectLoaded) {
124 loadProject(argument);
125 projectLoaded = true;
126 }
127 else {
128 QMessageBox::warning(this, "Multiple Projects Specified",
129 "qmos can only open one project at a time. The first project "
130 "specified is the one that will be used.");
131 }
132 }
133 }
134 catch (IException &e) {
135 QMessageBox::warning(this, "Problem Loading File", e.what());
136 }
137 }
138
139 m_lastOpenedFile = QFileInfo(".");
140
141 if (!filesToOpen.isEmpty())
142 openFiles(filesToOpen);
143 }
144
145
154 switch(e->type()) {
155 case QEvent::Close:
156 closeMosaic();
157
158 default:
159 return false;
160 }
161 }
162
163
173 // Create the file menu
174 m_fileMenu = menuBar()->addMenu("&File");
175
176 IString iconDir = FileName("$ISISROOT/appdata/images/icons").expanded();
177
178 QAction *open = new QAction(this);
179 open->setText("Open Cube...");
180 open->setIcon(QPixmap(QString::fromStdString(iconDir.c_str()) + "/fileopen.png"));
181 connect(open, SIGNAL(triggered()), this, SLOT(open()));
182
183 QAction *openList = new QAction(this);
184 openList->setText("Open Cube List...");
185 openList->setIcon(QPixmap(QString::fromStdString(iconDir.c_str()) + "/mActionHelpContents.png"));
186 connect(openList, SIGNAL(triggered()), this, SLOT(openList()));
187
188 QAction *saveProject = new QAction(this);
189 saveProject->setText("Save Project");
190 saveProject->setShortcut(Qt::CTRL + Qt::Key_S);
191 saveProject->setIcon(QPixmap(QString::fromStdString(iconDir.c_str()) + "/mActionFileSave.png"));
192 m_actionsRequiringOpen.append(saveProject);
193 connect(saveProject, SIGNAL(triggered()), this, SLOT(saveProject()));
194
195 QAction *saveProjectAs = new QAction(this);
196 saveProjectAs->setText("Save Project As...");
197 saveProjectAs->setIcon(QPixmap(QString::fromStdString(iconDir.c_str()) + "/mActionFileSaveAs.png"));
198 m_actionsRequiringOpen.append(saveProjectAs);
199 connect(saveProjectAs, SIGNAL(triggered()), this, SLOT(saveProjectAs()));
200
201 QAction *loadProject = new QAction(this);
202 loadProject->setText("Load Project...");
203 loadProject->setIcon(QPixmap(QString::fromStdString(iconDir.c_str()) + "/mActionExportMapServer.png"));
204 connect(loadProject, SIGNAL(triggered()), this, SLOT(loadProject()));
205
206 QAction *closeProject = new QAction(this);
207 closeProject->setText("Close Project");
208 m_actionsRequiringOpen.append(closeProject);
209 connect(closeProject, SIGNAL(triggered()), this, SLOT(closeMosaic()));
210
211 QAction *exit = new QAction(this);
212 exit->setText("Exit");
213 exit->setIcon(QIcon::fromTheme("window-close"));
214 connect(exit, SIGNAL(triggered()), this, SLOT(close()));
215
216 QAction *actionRequiringOpen = NULL;
217 foreach(actionRequiringOpen, m_actionsRequiringOpen) {
218 actionRequiringOpen->setEnabled(false);
219 }
220
221 QAction *actionRequiringClosed = NULL;
222 foreach(actionRequiringClosed, m_actionsRequiringClosed) {
223 actionRequiringClosed->setEnabled(true);
224 }
225
226 m_fileMenu->addAction(open);
227 m_fileMenu->addAction(openList);
228 m_fileMenu->addSeparator();
229 m_fileMenu->addAction(loadProject);
230 m_fileMenu->addAction(saveProject);
231 m_fileMenu->addAction(saveProjectAs);
232 m_fileMenu->addAction(closeProject);
233 m_fileMenu->addSeparator();
234 m_exportMenu = m_fileMenu->addMenu("&Export");
235 m_fileMenu->addAction(exit);
236
237 permanentToolBar()->addAction(loadProject);
238 permanentToolBar()->addAction(saveProject);
239 permanentToolBar()->addAction(saveProjectAs);
240 permanentToolBar()->addSeparator();
241 permanentToolBar()->addAction(open);
242 permanentToolBar()->addAction(openList);
243 permanentToolBar()->addSeparator();
244
245 m_viewMenu = menuBar()->addMenu("&View");
246 m_settingsMenu = menuBar()->addMenu("&Settings");
247 QMenu *helpMenu = menuBar()->addMenu("&Help");
248
249 QAction *activateWhatsThisAct = new QAction("&What's This", this);
250 activateWhatsThisAct->setShortcut(Qt::SHIFT | Qt::Key_F1);
251 activateWhatsThisAct->setIcon(
252 QPixmap(FileName("$ISISROOT/appdata/images/icons/contexthelp.png").expanded()));
253 activateWhatsThisAct->setToolTip("Activate What's This and click on parts "
254 "this program to see more information about them");
255 connect(activateWhatsThisAct, SIGNAL(triggered()),
256 this, SLOT(enterWhatsThisMode()));
257
258 QAction *showHelpAct = new QAction("qmos &Help", this);
259 showHelpAct->setIcon(QIcon::fromTheme("help-contents"));
260 connect(showHelpAct, SIGNAL(triggered()),
261 this, SLOT(showHelp()));
262
263 helpMenu->addAction(activateWhatsThisAct);
264 helpMenu->addAction(showHelpAct);
265
266 updateMenuVisibility();
267 }
268
269
276 QStringList filterList;
277 filterList.append("Isis cubes (*.cub)");
278 filterList.append("All Files (*)");
279
280 QDir directory = m_lastOpenedFile.dir();
281 QStringList selected = QFileDialog::getOpenFileNames(this, "Open Cubes",
282 directory.path(), filterList.join(";;"));
283
284 if (!selected.empty()) {
285 m_lastOpenedFile = QFileInfo(selected.last());
286 openFiles(selected);
287 }
288 }
289
290
291 void MosaicMainWindow::enterWhatsThisMode() {
292 QWhatsThis::enterWhatsThisMode();
293 }
294
295
296 void MosaicMainWindow::showHelp() {
297 QDialog *helpDialog = new QDialog(this);
298
299 QVBoxLayout *mainLayout = new QVBoxLayout;
300 helpDialog->setLayout(mainLayout);
301
302 // Let's add some text
303 QLabel *qmosTitle = new QLabel("<h1>qmos</h1>");
304// qmosTitle->setMinimumSize(QSize(800, qmosTitle->minimumSize().height()));
305 mainLayout->addWidget(qmosTitle);
306
307 QLabel *qmosSubtitle = new QLabel("A tool for visualizing image "
308 "footprints for a mosaic.");
309 mainLayout->addWidget(qmosSubtitle);
310
311 QTabWidget *tabArea = new QTabWidget;
312 mainLayout->addWidget(tabArea);
313
314 QScrollArea *overviewTab = new QScrollArea;
315
316 QWidget *overviewContainer = new QWidget;
317
318 QVBoxLayout *overviewLayout = new QVBoxLayout;
319 overviewContainer->setLayout(overviewLayout);
320
321 QLabel *purposeTitle = new QLabel("<h2>Purpose</h2>");
322 overviewLayout->addWidget(purposeTitle);
323
324 QLabel *purposeText = new QLabel("<p>qmos is designed "
325 "specifically for visualizing large amounts of images, how images "
326 "overlap, where control points lie on the images, and how jigsaw has "
327 "moved control points.");
328 purposeText->setWordWrap(true);
329 overviewLayout->addWidget(purposeText);
330
331 QLabel *shortcomingsTitle = new QLabel("<h2>Known Issues</h2>");
332 overviewLayout->addWidget(shortcomingsTitle);
333
334 QLabel *shortcomingsText = new QLabel("<p>The known shortcomings of qmos "
335 "include:<ul>"
336 "<li>All input files are read-only, you cannot edit your input "
337 "data</li>"
338 "<li>Large control networks are slow and memory intensive to load</li>"
339 "<li>Show cube DN data is extremely slow</li>"
340 "<li>Warnings are not displayed graphically</li>"
341 "<li>Zooming in too far causes you to pan off of your data</li></ul>");
342 shortcomingsText->setWordWrap(true);
343 overviewLayout->addWidget(shortcomingsText);
344
345 overviewTab->setWidget(overviewContainer);
346
347 QScrollArea *preparationsTab = new QScrollArea;
348
349 QWidget *preparationsContainer = new QWidget;
350 QVBoxLayout *preparationsLayout = new QVBoxLayout;
351 preparationsContainer->setLayout(preparationsLayout);
352
353 QLabel *preparationTitle = new QLabel("<h2>Before Using qmos</h2>");
354 preparationsLayout->addWidget(preparationTitle);
355
356 QLabel *preparationText = new QLabel("<p>qmos only supports files which "
357 "have latitude and longitude information associated with them. Global "
358 "projections are also not supported. If your files meet these "
359 "requirements, it is beneficial to run a couple of Isis programs on "
360 "your files before loading them into qmos. The programs you should run "
361 "are:<ul>"
362 "<li><i>camstats from=future_input_to_qmos.cub attach=true "
363 "sinc=... linc=...</i></li>"
364 " <br>This enables qmos to give you the emission angle, incidence "
365 "angle, phase angle, and resolution in the <b>File List</b>"
366 "<li><i>footprintinit from=future_input_to_qmos.cub "
367 "sinc=... linc=...</i></li>"
368 " <br>Running <i>footprintinit</i> beforehand will significantly speed up loading images "
369 "into qmos.<br/><br/>"
370 "The footprint is created by \"walking\" around the valid image data, and qmos reprojects "
371 "the footprint according to the loaded map file.<br/><br/>"
372 "Qmos displays the footprints, and optionally the image data and map grid to the default "
373 "IAU radius, unless the radius is specified within the loaded map file.<br/><br/>"
374 "For Level1 (raw camera space) images, when calculating the "
375 "footprint polygons, footprintinit refers to the image labels "
376 "and uses the SPICE kernels and the shape model (DEM if one "
377 "exists and is specified, otherwise, the IAU sphere or "
378 "ellipsoid is used). Refer to spiceinit for more information "
379 "on loading SPICE onto Level0 and Level1 images. This enables "
380 "qmos to use the given footprints instead of trying to "
381 "calculate its own. The 'linc' and 'sinc' parameters can have a "
382 "significant effect on your image's footprint. Also, images "
383 "without footprints cannot be opened more than one at a time. "
384 "Running footprintinit will significantly speed up loading "
385 "images into qmos.<br>"
386 "For Level2 images, do not run footprintinit. The footprint "
387 "polygon is created by 'walking' around the valid image data. "
388 "qmos 'reprojects' the footprint polygons according to the "
389 "loaded Map File.<br>"
390 "</ul>");
391 preparationText->setWordWrap(true);
392 preparationsLayout->addWidget(preparationText);
393
394 preparationsTab->setWidget(preparationsContainer);
395
396 QScrollArea *projectsTab = new QScrollArea;
397
398 QWidget *projectsContainer = new QWidget;
399 QVBoxLayout *projectsLayout = new QVBoxLayout;
400 projectsContainer->setLayout(projectsLayout);
401
402 QLabel *projectsTitle = new QLabel("<h2>Projects</h2>");
403 projectsLayout->addWidget(projectsTitle);
404
405 QLabel *projectsText = new QLabel("<p>The contents of qmos can be saved as a project file, "
406 "which allows the user to restore back to the previous state at any given time. The stored "
407 "files or qmos project files must have a \".mos\" extension.<br/><br/>"
408 "These project files store the input file location information and their qmos properties "
409 "(color, group information, and other attributes).<br/><br/>"
410 "When you initially open qmos you start with a blank project. "
411 "To load a project, you can specify the project "
412 "file's name on the command line (qmos myProject.mos) or go to "
413 "File -> Load Project after qmos is started. When "
414 "loading a project, all current data in the qmos window is lost (your cubes are closed)."
415 "These project files are relatively small files. You can "
416 "save your current project any time by going to File -> Save Project. ");
417 projectsText->setWordWrap(true);
418 projectsLayout->addWidget(projectsText);
419
420 projectsTab->setWidget(projectsContainer);
421
422 if (m_controllerVisible) {
423 tabArea->addTab(overviewTab, "&Overview");
424 tabArea->addTab(preparationsTab, "Preparing &Input Cubes");
425
426 tabArea->addTab(ImageFileListWidget::getLongHelp(m_fileListDock),
427 "File &List");
428 tabArea->addTab(MosaicSceneWidget::getLongHelp(centralWidget()),
429 "Mosaic &Scene");
430 tabArea->addTab(MosaicSceneWidget::getPreviewHelp(m_mosaicPreviewDock),
431 "Mosaic &World View");
432
433 tabArea->addTab(MosaicSceneWidget::getMapHelp(),
434 "&Map File");
435 tabArea->addTab(projectsTab, "&Project Files");
436
437 tabArea->addTab(MosaicSceneWidget::getControlNetHelp(),
438 "&Control Networks");
439 tabArea->addTab(MosaicSceneWidget::getGridHelp(),
440 "Mosaic &Grid");
441 }
442 else {
443 tabArea->addTab(overviewTab, "&Overview");
444 tabArea->addTab(preparationsTab, "Preparing &Input Cubes");
445
446 tabArea->addTab(ImageFileListWidget::getLongHelp(),
447 "File &List");
448 tabArea->addTab(MosaicSceneWidget::getLongHelp(),
449 "Mosaic &Scene");
450 tabArea->addTab(MosaicSceneWidget::getPreviewHelp(),
451 "Mosaic &World View");
452
453 tabArea->addTab(MosaicSceneWidget::getMapHelp(),
454 "&Map File");
455 tabArea->addTab(projectsTab, "&Project Files");
456
457 tabArea->addTab(MosaicSceneWidget::getControlNetHelp(),
458 "&Control Networks");
459 tabArea->addTab(MosaicSceneWidget::getGridHelp(),
460 "Mosaic &Grid");
461 }
462
463 // Now add close option
464 QWidget *buttonsArea = new QWidget;
465 mainLayout->addWidget(buttonsArea);
466
467 QHBoxLayout *buttonsLayout = new QHBoxLayout;
468 buttonsArea->setLayout(buttonsLayout);
469
470 // Flush the buttons to the right
471 buttonsLayout->addStretch();
472
473 QPushButton *closeButton = new QPushButton(QIcon::fromTheme("window-close"),
474 "&Close");
475 closeButton->setDefault(true);
476 connect(closeButton, SIGNAL(clicked()),
477 helpDialog, SLOT(close()));
478 buttonsLayout->addWidget(closeButton);
479
480 helpDialog->show();
481 }
482
483
484 void MosaicMainWindow::updateMenuVisibility() {
485 QMenuBar *rootMenu = menuBar();
486
487 QAction *rootAction = NULL;
488 foreach(rootAction, rootMenu->actions()) {
489 QMenu *rootMenu = rootAction->menu();
490
491 if (rootMenu) {
492 rootAction->setVisible(updateMenuVisibility(rootAction->menu()));
493 }
494 }
495 }
496
497
498 void MosaicMainWindow::createController() {
499 if (m_mosaicController == NULL) {
500 m_mosaicController = new MosaicController(statusBar(), m_settings);
501
502 QList<QAction *> settingsActs = m_mosaicController->getSettingsActions();
503
504 QAction *settingsAct;
505 foreach(settingsAct, settingsActs) {
506 connect(settingsAct, SIGNAL(destroyed(QObject *)),
507 this, SLOT(updateMenuVisibility()));
508
509 m_settingsMenu->addAction(settingsAct);
510 }
511
512 updateMenuVisibility();
513 }
514 }
515
516
517 void MosaicMainWindow::displayController() {
518 if (m_mosaicController && !m_controllerVisible) {
519 m_controllerVisible = true;
520 m_mosaicController->addExportActions(*m_exportMenu);
521
522 m_fileListDock->setWidget(m_mosaicController->getImageFileList());
523 m_mosaicPreviewDock->setWidget(m_mosaicController->getMosaicWorldScene());
524
525 centralWidget()->layout()->addWidget(
526 m_mosaicController->getMosaicScene());
527
528 QAction *actionRequiringOpen = NULL;
529 foreach(actionRequiringOpen, m_actionsRequiringOpen) {
530 actionRequiringOpen->setEnabled(true);
531 }
532
533 QAction *actionRequiringClosed = NULL;
534 foreach(actionRequiringClosed, m_actionsRequiringClosed) {
535 actionRequiringClosed->setEnabled(false);
536 }
537
538 m_mosaicController->getMosaicScene()->addTo(m_toolpad);
539 m_mosaicController->getMosaicScene()->addToPermanent(m_permToolbar);
540 m_mosaicController->getMosaicScene()->addTo(m_activeToolbar);
541
542 statusBar()->addWidget(m_mosaicController->getProgress());
543 statusBar()->addWidget(
544 m_mosaicController->getMosaicScene()->getProgress());
545 statusBar()->addWidget(
546 m_mosaicController->getMosaicWorldScene()->getProgress());
547 statusBar()->addWidget(
548 m_mosaicController->getImageFileList()->getProgress());
549
550 QList<QAction *> sceneViewActs =
551 m_mosaicController->getMosaicScene()->getViewActions();
552
553 foreach(QAction *viewAct, sceneViewActs) {
554 connect(viewAct, SIGNAL(destroyed(QObject *)),
555 this, SLOT(updateMenuVisibility()));
556
557 m_viewMenu->addAction(viewAct);
558 }
559
560 m_viewMenu->addSeparator();
561
562
563 QList<QAction *> fileListViewActs =
564 m_mosaicController->getImageFileList()->getViewActions();
565
566 foreach(QAction *viewAct, fileListViewActs) {
567 connect(viewAct, SIGNAL(destroyed(QObject *)),
568 this, SLOT(updateMenuVisibility()));
569
570 m_viewMenu->addAction(viewAct);
571 }
572
573 updateMenuVisibility();
574 }
575 }
576
577
578 bool MosaicMainWindow::updateMenuVisibility(QMenu *menu) {
579 bool anythingVisible = false;
580
581 if (menu) {
582 QList<QAction *> actions = menu->actions();
583
584 // Recursively search the menu for other menus to show or hide and handle
585 // every internal being invisible
586 QAction *menuAction = NULL;
587 foreach(menuAction, menu->actions()) {
588 bool thisVisible = true;
589
590 if (menuAction->menu() != NULL) {
591 thisVisible = updateMenuVisibility(menuAction->menu());
592 }
593 else {
594 thisVisible = menuAction->isVisible();
595 }
596
597 if (thisVisible)
598 anythingVisible = true;
599 }
600
601 menu->menuAction()->setVisible(anythingVisible);
602 }
603
604 return anythingVisible;
605 }
606
607
613 // Set up the list of filters that are default with this dialog.
614 QStringList filterList;
615 filterList.append("List Files (*.lis)");
616 filterList.append("Text Files (*.txt)");
617 filterList.append("All files (*)");
618
619 QDir directory = m_lastOpenedFile.dir();
620
621 QString selected = QFileDialog::getOpenFileName(this, "Open Cube List",
622 directory.path(), filterList.join(";;"));
623
624 if (selected != "") {
625 m_lastOpenedFile = QFileInfo(selected);
626 TextFile fileList((QString) selected);
627
628 QStringList filesInList;
629 QString line;
630
631 while(fileList.GetLine(line)) {
632 filesInList.append(line);
633 }
634
635 if (filesInList.empty()) {
636 IString msg = "No files were found inside the file list";
637 throw IException(IException::Unknown, msg, _FILEINFO_);
638 }
639
640 openFiles(filesInList);
641 }
642 }
643
644
651 void MosaicMainWindow::readSettings(QSize defaultSize) {
652 MainWindow::readSettings(defaultSize);
653 }
654
655
656 void MosaicMainWindow::openFiles(QStringList cubeNames) {
657 // Create a mosaic widget if we don't have one
658 if (!cubeNames.empty()) {
659 displayController();
660 }
661
662 if (m_mosaicController)
663 m_mosaicController->openImages(cubeNames);
664 }
665
666
676
677
682 if (m_mosaicController) {
683 QString fn = QFileDialog::getSaveFileName(this, "Save Project",
684 QDir::currentPath() + "/untitled.mos",
685 "Mosaic (*.mos)");
686 if (fn.isEmpty()) return;
687
688 m_mosaicController->saveProject(fn);
689 m_filename = fn;
690 }
691 }
692
693
699 if (m_filename == "") {
701 }
702 else {
703 m_mosaicController->saveProject(m_filename);
704 }
705 }
706
707
713 void MosaicMainWindow::loadProject() {
714 QString fn = QFileDialog::getOpenFileName(this, "Load Project",
715 QDir::currentPath(),
716 "Mosaic (*.mos)");
717
718 if (!fn.isEmpty()) {
719 closeMosaic();
720
721 m_lastOpenedFile = QFileInfo(fn);
722 loadProject(fn);
723 }
724 }
725
726
727 void MosaicMainWindow::loadProject(QString fn) {
728 if (!fn.isEmpty()) {
729 createController();
730 displayController();
731
732 if (m_mosaicController)
733 m_mosaicController->readProject(fn);
734
735 m_filename = fn;
736 }
737 }
738
739
740 void MosaicMainWindow::closeMosaic() {
741 if (m_mosaicController) {
742 QAction *actionRequiringOpen = NULL;
743 foreach(actionRequiringOpen, m_actionsRequiringOpen) {
744 actionRequiringOpen->setEnabled(false);
745 }
746
747 QAction *actionRequiringClosed = NULL;
748 foreach(actionRequiringClosed, m_actionsRequiringClosed) {
749 actionRequiringClosed->setEnabled(true);
750 }
751
752 m_mosaicController->saveSettings(m_settings);
753 delete m_mosaicController;
754 m_mosaicController = NULL;
755
756 m_filename = "";
757 m_controllerVisible = false;
758 }
759
760 createController();
761 displayController();
762 }
763}
File name manipulation and expansion.
Definition FileName.h:100
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
Definition FileName.cpp:196
Isis exception class.
Definition IException.h:91
@ Unknown
A type of error that cannot be classified as any of the other error types.
Definition IException.h:118
Adds specific functionality to C++ strings.
Definition IString.h:165
Base class for the Qisis main windows.
Definition MainWindow.h:24
virtual void readSettings(QSize defaultSize=QSize())
This method ensure that the settings get written even if the Main window was only hidden,...
void openList()
Opens a list of cube files instead of one at a time.
void setupMenus()
Sets up the menus on the menu bar for the qmos window.
void saveProjectAs()
Allows the user to save a project file.
void open()
Calles MosaicWidget's open method which opens a cube file and displays the footprint in the graphics ...
void readSettings(QSize defaultSize=QSize(800, 600))
This overriden method is called from the constructor so that when the Mosaicmainwindow is created,...
bool eventFilter(QObject *o, QEvent *e)
This event filter is installed in the constructor.
void saveSettings2()
This overriden method is called when the MosaicMainWindow is closed or hidden to write the size and l...
void saveProject()
Called from the file menu to save a project file.
Provides access to sequential ASCII stream I/O.
Definition TextFile.h:38
bool GetLine(QString &line, const bool skipComments=true)
Gets next line from file.
Definition TextFile.cpp:411
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