11#include <QWeakPointer>
13#include "AdvancedTrackTool.h"
17#include "CubeAttribute.h"
19#include "FeatureNomenclatureTool.h"
24#include "HistogramTool.h"
29#include "MdiCubeViewport.h"
30#include "MeasureTool.h"
32#include "RubberBandTool.h"
33#include "QnetFileTool.h"
34#include "QnetNavTool.h"
36#include "ScatterPlotTool.h"
37#include "SpatialPlotTool.h"
38#include "SpecialPixelTool.h"
39#include "SpectralPlotTool.h"
40#include "StatisticsTool.h"
41#include "StereoTool.h"
42#include "StretchTool.h"
43#include "SunShadowTool.h"
47#include "ViewportMdiSubWindow.h"
48#include "WindowTool.h"
65 m_mdi =
new QMdiArea(
this);
67 QGridLayout *layout =
new QGridLayout;
71 layout->setContentsMargins(0, 0, 0, 0);
72 layout->addWidget(
m_mdi, 0, 0);
95 QMenuBar *menuBar =
new QMenuBar;
96 layout->addWidget(menuBar, row, 0, 1, 2);
99 QHBoxLayout *permActiveToolBarLayout =
new QHBoxLayout;
102 permToolBar->setObjectName(
"permToolBar");
103 permToolBar->setIconSize(QSize(22, 22));
104 permActiveToolBarLayout->addWidget(permToolBar);
107 activeToolBar->setObjectName(
"activeToolBar");
108 activeToolBar->setIconSize(QSize(22, 22));
109 permActiveToolBarLayout->addWidget(activeToolBar);
111 layout->addLayout(permActiveToolBarLayout, row, 0, 1, 2);
114 layout->addWidget(
m_mdi, row, 0, 1, 1);
117 toolPad->setObjectName(
"toolPad");
118 toolPad->setOrientation(Qt::Vertical);
119 layout->addWidget(toolPad, row, 1, 1, 1);
122 QStatusBar *statusBar =
new QStatusBar(
this);
123 layout->addWidget(statusBar, row, 0, 1, 2);
127 Tool *defaultActiveTool = NULL;
136 defaultActiveTool =
new ZoomTool(
this);
137 m_tools->append(defaultActiveTool);
165 for (
int i = 0; i <
m_tools->count(); i++) {
166 Tool *tool = (*m_tools)[i];
172 tool->
addTo(toolPad);
175 QString menuName = tool->
menuName();
177 QMenu *subMenu = subMenus[menuName];
180 subMenus[menuName] = menuBar->addMenu(menuName);
181 subMenu = subMenus[menuName];
184 tool->
addTo(subMenu);
188 permToolBar->addSeparator();
192 permToolBar->addSeparator();
198 m_mdi->setActivationOrder(QMdiArea::ActivationHistoryOrder);
227 else if(!
m_mdi->currentSubWindow()) {
241 for(
int i = 0; i <
m_mdi->subWindowList().size(); i++) {
261 foreach (
Image *image, *images) {
270 bool confirmed =
true;
272 for (
int viewportIndex = 0; confirmed && viewportIndex < viewports.count(); viewportIndex++) {
273 confirmed = viewports[viewportIndex]->confirmClose();
286 if (viewport->
cube() == cube) {
287 result = qobject_cast<QWidget *>(viewport->parent());
341 QFileInfo cubeFileName(filename);
343 QString cubename = cubeFileName.filePath();
350 std::vector<QString> bands = inAtt.
bands();
354 cube->
open(cubename);
359 if(bands.size() == 3) {
360 IString st = IString(bands.at(0));
361 int index_red = st.ToInteger();
362 st = IString(bands.at(1));
363 int index_green = st.ToInteger();
364 st = IString(bands.at(2));
365 int index_blue = st.ToInteger();
366 cvp->viewRGB(index_red, index_green, index_blue);
370 catch (IException &e) {
372 QString message(
"Error opening cube [" + cubename +
"]...\n");
373 message +=
"Attempting to open [" + cubename +
"] as a cube list...\n";
378 catch (IException &e) {
379 message += e.toString();
380 throw IException(e, IException::User, message, _FILEINFO_);
393 QFileInfo cubeFileName(cubelist);
397 QFile file(cubeFileName.filePath());
398 file.open(QIODevice::ReadOnly);
400 QTextStream in(&file);
403 while ( !file.atEnd() ) {
404 QString line = file.readLine().replace(
"\n",
"");
405 cubesToOpen.append(line);
410 for (
int i = 0; i < cubesToOpen.size(); i++) {
415 cubename = cubesToOpen.at(i);
419 std::vector<QString> bands = inAtt.
bands();
423 cube->
open(cubename);
428 if(bands.size() == 3) {
429 IString st = IString(bands.at(0));
430 int index_red = st.ToInteger();
431 st = IString(bands.at(1));
432 int index_green = st.ToInteger();
433 st = IString(bands.at(2));
434 int index_blue = st.ToInteger();
435 cvp->viewRGB(index_red, index_green, index_blue);
438 catch (IException &e) {
439 QString message(
"Error attempting to open [" + cubename +
"] from list [" + cubelist +
"]...\n");
441 throw IException(e, IException::User, message, _FILEINFO_);
469 window->setAttribute(Qt::WA_DeleteOnClose);
471 m_mdi->addSubWindow(window);
478 catch(IException &e) {
480 IException::Programmer,
481 tr(
"Error when attempting to show cube [%1]")
492 if (
m_mdi->subWindowList().size()) {
493 QPointer<QMdiSubWindow> windowToRemove =
494 m_mdi->subWindowList().last();
496 m_mdi->removeSubWindow(windowToRemove.data());
498 delete windowToRemove.data();
IO Handler for Isis Cubes.
void open(const QString &cfile, QString access="r")
This method will try to open a file as either a cube or geotiff in either read or read/write.
void setVirtualBands(const QList< QString > &vbands)
This allows the programmer to specify a subset of bands to work with.
virtual QString fileName() const
Returns the opened cube's filename.
This represents a cube in a project-based GUI interface.
Cube * cube()
Get the Cube pointer associated with this display property.
Internalizes a list of images and allows for operations on the entire list.
Cube display widget for certain Isis MDI applications.
This is an actual viewport window in qview/qnet/etc.
MdiCubeViewport * viewport()
Grabs the viewport.
Workspace & operator=(Workspace other)
Is equal to comparsion.
virtual ~Workspace()
Deconstructor.
QMdiArea * mdiArea()
This method returns the QMdiArea.
QPointer< QMdiArea > m_mdi
The mdi area.
void cubeViewportActivated(MdiCubeViewport *)
Signal triggered when a Cube is activated in the Workspace.
void addCubeViewport(QString cubename)
Method adds the name of a cube into Workspace as a CubeViewport.
QWidget * cubeToMdiWidget(Cube *cube)
Converts a cube to an MdiWidget.
bool confirmClose()
Confirms that the user wishes toc lose the Workspace.
void cubeViewportAdded(MdiCubeViewport *)
Signal triggered when a Cube is added to the Workspace.
void addCubeViewportFromList(QString cubelist)
Method adds cubes into Workspace as a CubeViewport from a list of cubes.
void addBrowseView(QString cube)
Method is called to add a Cube from BrowseView.
ToolList * m_tools
List of all of the tools.
QVector< MdiCubeViewport * > * m_cubeViewportList
List of cube viewports.
Workspace(bool selfContained, QWidget *parent=0)
Constructor for Workspace.
void addImages(ImageList *images)
Adds a list of Images to a viewport.
QVector< MdiCubeViewport * > * cubeViewportList()
This method returns a Vector of MdiCubeViewports.
void activateViewport(QMdiSubWindow *w)
This method activates the Viewport.
This is free and unencumbered software released into the public domain.
This is free and unencumbered software released into the public domain.
This is free and unencumbered software released into the public domain.