5 #include <QProgressBar>
10 #include <QWeakPointer>
14 #include "BlinkTool.h"
18 #include "FeatureNomenclatureTool.h"
23 #include "HistogramTool.h"
25 #include "ImageList.h"
27 #include "MatchTool.h"
29 #include "MeasureTool.h"
31 #include "RubberBandTool.h"
35 #include "ScatterPlotTool.h"
36 #include "SpatialPlotTool.h"
37 #include "SpecialPixelTool.h"
38 #include "SpectralPlotTool.h"
40 #include "StereoTool.h"
42 #include "SunShadowTool.h"
43 #include "TrackTool.h"
46 #include "ViewportMdiSubWindow.h"
47 #include "WindowTool.h"
58 m_cubeViewportList = NULL;
64 m_mdi =
new QMdiArea(
this);
66 QGridLayout *layout =
new QGridLayout;
70 layout->setContentsMargins(0, 0, 0, 0);
71 layout->addWidget(m_mdi, 0, 0);
94 QMenuBar *menuBar =
new QMenuBar;
95 layout->addWidget(menuBar, row, 0, 1, 2);
98 QHBoxLayout *permActiveToolBarLayout =
new QHBoxLayout;
101 permToolBar->setObjectName(
"permToolBar");
102 permToolBar->setIconSize(QSize(22, 22));
103 permActiveToolBarLayout->addWidget(permToolBar);
106 activeToolBar->setObjectName(
"activeToolBar");
107 activeToolBar->setIconSize(QSize(22, 22));
108 permActiveToolBarLayout->addWidget(activeToolBar);
110 layout->addLayout(permActiveToolBarLayout, row, 0, 1, 2);
113 layout->addWidget(m_mdi, row, 0, 1, 1);
116 toolPad->setObjectName(
"toolPad");
117 toolPad->setOrientation(Qt::Vertical);
118 layout->addWidget(toolPad, row, 1, 1, 1);
121 QStatusBar *statusBar =
new QStatusBar(
this);
122 layout->addWidget(statusBar, row, 0, 1, 2);
126 Tool *defaultActiveTool = NULL;
132 m_tools->append(NULL);
133 m_tools->append(
new BandTool(
this));
135 defaultActiveTool =
new ZoomTool(
this);
136 m_tools->append(defaultActiveTool);
138 m_tools->append(
new PanTool(
this));
140 m_tools->append(
new FindTool(
this));
143 m_tools->append(
new EditTool(
this));
156 m_tools->append(
new HelpTool(
this));
157 m_tools->append(
new TrackTool(statusBar));
160 m_tools->append(qnetTool);
164 for (
int i = 0; i < m_tools->count(); i++) {
165 Tool *tool = (*m_tools)[i];
171 tool->
addTo(toolPad);
174 QString menuName = tool->
menuName();
176 QMenu *subMenu = subMenus[menuName];
179 subMenus[menuName] = menuBar->addMenu(menuName);
180 subMenu = subMenus[menuName];
183 tool->
addTo(subMenu);
187 permToolBar->addSeparator();
191 permToolBar->addSeparator();
197 m_mdi->setActivationOrder(QMdiArea::ActivationHistoryOrder);
207 Workspace::~Workspace() {
208 delete m_cubeViewportList;
209 m_cubeViewportList = NULL;
223 emit cubeViewportActivated((
MdiCubeViewport *) w->widget()->layout()->itemAt(0)->widget());
226 else if(!m_mdi->currentSubWindow()) {
238 m_cubeViewportList->clear();
240 for(
int i = 0; i < m_mdi->subWindowList().size(); i++) {
241 m_cubeViewportList->push_back(
242 (
MdiCubeViewport *)m_mdi->subWindowList()[i]->widget()->layout()->itemAt(0)->widget());
245 return m_cubeViewportList;
250 delete m_cubeViewportList;
251 m_cubeViewportList = NULL;
254 *m_cubeViewportList = *other.m_cubeViewportList;
259 void Workspace::addImages(ImageList *images) {
260 foreach (Image *image, *images) {
266 bool Workspace::confirmClose() {
269 bool confirmed =
true;
271 for (
int viewportIndex = 0; confirmed && viewportIndex < viewports.count(); viewportIndex++) {
272 confirmed = viewports[viewportIndex]->confirmClose();
279 QWidget *Workspace::cubeToMdiWidget(Cube *cube) {
282 for (
int i = 0; !result && i < m_cubeViewportList->count(); i++) {
283 MdiCubeViewport *viewport = (*m_cubeViewportList)[i];
285 if (viewport->cube() == cube) {
286 result = qobject_cast<
QWidget *>(viewport->parent());
294 QMdiArea *Workspace::mdiArea() {
331 std::vector<QString> bands = inAtt.
bands();
335 cube->
open(cubename);
342 if(bands.size() == 3) {
349 cvp->viewRGB(index_red, index_green, index_blue);
381 window->setAttribute(Qt::WA_DeleteOnClose);
383 m_mdi->addSubWindow(window);
387 result = window->viewport();
388 emit cubeViewportAdded(result);
393 tr(
"Error when attempting to show cube [%1]")
402 void Workspace::addBrowseView(QString cubename) {
404 if (m_mdi->subWindowList().size()) {
405 QPointer<QMdiSubWindow> windowToRemove =
406 m_mdi->subWindowList().last();
408 m_mdi->removeSubWindow(windowToRemove.data());
410 delete windowToRemove.data();
Cube display widget for certain Isis MDI applications.
Workspace(bool selfContained, QWidget *parent=0)
Workspace constructor.
QVector< MdiCubeViewport * > * cubeViewportList()
Repopulates the list of MdiCubeViewports and returns a pointer to this list.
int ToInteger() const
Returns the object string as an integer.
This error is for when a programmer made an API call that was illegal.
#define _FILEINFO_
Macro for the filename and line number.
void setVirtualBands(const QList< QString > &vbands)
This allows the programmer to specify a subset of bands to work with.
void open(const QString &cfile, QString access="r")
This method will open an isis cube for reading or reading/writing.
This is an actual viewport window in qview/qnet/etc.
void addCubeViewport(QString cube)
Add a cubeViewport to the workspace, open the cube.
QString toString() const
Returns a string representation of this exception.
Adds specific functionality to C++ strings.
QString fileName() const
Returns the opened cube's filename.
void activateViewport(QMdiSubWindow *w)
This gets called when a window is activated or the workspace loses focus.
IO Handler for Isis Cubes.