14#include <QKeySequence>
17#include <QMdiSubWindow>
26#include <QWidgetAction>
27#include <QXmlStreamWriter>
29#include "AdvancedTrackTool.h"
33#include "CubeAttribute.h"
36#include "FeatureNomenclatureTool.h"
40#include "HistogramTool.h"
43#include "ControlNetTool.h"
46#include "MdiCubeViewport.h"
47#include "MeasureTool.h"
50#include "ProjectItem.h"
51#include "ProjectItemModel.h"
52#include "ProjectItemProxyModel.h"
53#include "RubberBandTool.h"
54#include "ScatterPlotTool.h"
56#include "SpatialPlotTool.h"
57#include "SpecialPixelTool.h"
58#include "SpectralPlotTool.h"
59#include "StatisticsTool.h"
60#include "StereoTool.h"
61#include "StretchTool.h"
62#include "SunShadowTool.h"
67#include "ViewportMdiSubWindow.h"
69#include "WindowTool.h"
70#include "XmlStackedHandlerReader.h"
73#include "ProjectItemViewMenu.h"
84 SIGNAL( currentChanged(
const QModelIndex &,
const QModelIndex &) ),
100 createActions(directory);
110 void CubeDnView::createActions(
Directory *directory) {
124 addToolBar(Qt::RightToolBarArea,
m_toolPad);
135 tools->append(controlNetTool);
142 connect(controlNetTool, SIGNAL(modifyControlPoint(
ControlPoint *, QString)),
143 this, SIGNAL(modifyControlPoint(
ControlPoint *, QString)));
145 connect(controlNetTool, SIGNAL(deleteControlPoint(
ControlPoint *)),
148 connect(controlNetTool, SIGNAL(createControlPoint(
double,
double,
Cube *,
bool)),
149 this, SIGNAL(createControlPoint(
double,
double,
Cube *,
bool)));
153 connect(
this, SIGNAL(controlPointAdded(QString)), controlNetTool, SLOT(paintAllViewports()));
157 connect(
this, SIGNAL(redrawMeasures()), controlNetTool, SLOT(paintAllViewports()));
161 tools->append(zoomTool);
162 tools->append(
new PanTool(
this));
179 tools->append(
new TrackTool(statusBar()));
196 for (
int i = 0; i < tools->count(); i++) {
197 Tool *tool = (*tools)[i];
205 if (!tool->menuName().isEmpty()) {
206 QString menuName = tool->menuName();
208 if (menuName ==
"&View") {
211 else if (menuName ==
"&Options") {
214 else if (menuName ==
"&Window") {
225 foreach (
QAction *action, findChildren<QAction *>()) {
228 if (action->toolTip() ==
"Save") {
229 action->setShortcut(QKeySequence());
234 if (QString(action->metaObject()->className()) ==
"QWidgetAction") {
244 if (QString(child->metaObject()->className()).contains(
"ComboBox") ||
245 QString(child->metaObject()->className()).contains(
"Widget")) {
254 zoomTool->activate(
true);
271 foreach (QToolButton *button, findChildren<QToolButton *>()) {
272 if (button->menu() && button->menu()->isVisible()) {
284 foreach (
QAction *action, actions()) {
285 action->setDisabled(
true);
288 widget->setDisabled(
true);
298 foreach (
QAction *action, actions()) {
302 action->setEnabled(
true);
305 widget->setEnabled(
true);
319 if (action->objectName() ==
"ControlNetTool") {
320 action->setEnabled(value);
323 cnetTool->loadNetwork();
407 if ( !isVisible() ) {
421 internalModel()->selectionModel()->setCurrentIndex(item->index(),
422 QItemSelectionModel::SelectCurrent);
434 connect(viewport, SIGNAL( destroyed(
QObject *) ),
497 ViewportMdiSubWindow *subWindow = qobject_cast<ViewportMdiSubWindow *>( mdiArea->currentSubWindow() );
502 return viewport->
cube();
520 QMdiSubWindow *subWindow = qobject_cast<QMdiSubWindow *>( mdiWidget->parent() );
534 xmlReader->pushContentHandler(
new XmlHandler(
this, project));
538 void CubeDnView::save(QXmlStreamWriter &stream,
Project *,
FileName)
const {
539 stream.writeStartElement(
"cubeDnView");
540 stream.writeAttribute(
"objectName", objectName());
545 stream.writeStartElement(
"image");
546 stream.writeAttribute(
"id", item->
image()->
id());
549 stream.writeStartElement(
"shape");
550 stream.writeAttribute(
"id", item->
shape()->
id());
552 stream.writeEndElement();
554 stream.writeEndElement();
565 CubeDnView::XmlHandler::~XmlHandler() {
569 bool CubeDnView::XmlHandler::startElement(
const QString &namespaceURI,
570 const QString &localName,
const QString &qName,
const QXmlAttributes &atts) {
571 bool result = XmlStackedHandler::startElement(namespaceURI, localName, qName, atts);
576 QString
id = atts.value(
"id");
579 if (localName ==
"image") {
580 Image *image = m_project->image(
id);
586 else if (localName ==
"shape") {
587 Shape *shape = m_project->shape(
id);
593 proxy->addItem(item);
601 bool CubeDnView::XmlHandler::endElement(
const QString &namespaceURI,
602 const QString &localName,
const QString &qName) {
603 bool result = XmlStackedHandler::endElement(namespaceURI, localName, qName);
AbstractProjectItemView is a base class for views of a ProjectItemModel in Qt's model-view framework.
virtual void addItem(ProjectItem *item)
Adds an item to the view.
virtual ProjectItemModel * internalModel()
Returns the internal model of the view.
ControlNet * controlNet()
Open and return a pointer to the ControlNet for this Control.
CubeDnView * m_cubeDnView
The view we are working with.
Project * m_project
The current project.
View that displays cubes in a QView-like way.
void onCubeViewportActivated(MdiCubeViewport *)
Slot to connect to the cubeViewportActivated signal from the Workspace.
void disableActions()
Disables toolbars and toolpad actions/widgets.
ProjectItemViewMenu * m_windowMenu
Window menu for storing actions.
ProjectItemViewMenu * m_viewMenu
View menu for storing actions.
void leaveEvent(QEvent *event)
Disables actions when the cursor leaves the view.
QMap< Cube *, ProjectItem * > m_cubeItemMap
Maps cubes to their items.
void onCurrentChanged(const QModelIndex ¤t)
Slot to connect to the currentChanged() signal from a selection model.
QToolBar * m_permToolBar
A tool bar for storing actions.
ProjectItemViewMenu * m_optionsMenu
Options menu for storing actions.
void addItem(ProjectItem *item)
Adds an item to the view.
Directory * m_directory
The directory.
Cube * workspaceActiveCube()
Returns the cube of the active viewport in the Workspace, or a null pointer if no viewports are activ...
ToolPad * m_toolPad
A tool bar for storing actions.
void enableActions()
Enables toolbars and toolpad actions/widgets.
void onItemAdded(ProjectItem *item)
Slot to connect to the itemAdded signal from a ProjectItemModel.
Workspace * m_workspace
The workspace.
QList< QWidget * > m_childWidgets
Child widgets of the active toolbar.
CubeDnView(Directory *directory, QWidget *parent=0)
Constructs the view, initializing the tools.
QToolBar * m_activeToolBar
A tool bar for storing actions.
void onCubeViewportDeleted(QObject *obj)
Slot to connect to the destroyed signal from a viewport.
void onCubeViewportAdded(MdiCubeViewport *viewport)
Slot to connect to the viewportAdded signal from a Workspace.
void setWorkspaceActiveCube(Image *image)
Raises the subwindow corresponding with an image to the top.
QAction * m_separatorAction
A separator action that is reused.
void enableControlNetTool(bool value)
A slot function that is called when directory emits a signal that an active control network is set.
IO Handler for Isis Cubes.
Project * project() const
Gets the Project for this directory.
File name manipulation and expansion.
This represents a cube in a project-based GUI interface.
Cube * cube()
Get the Cube pointer associated with this display property.
QString id() const
Get a unique, identifying string associated with this image.
Cube display widget for certain Isis MDI applications.
The main project for ipce.
Control * activeControl()
Return the Active Control (control network)
Represents an item of a ProjectItemModel in Qt's model-view framework.
bool isShape() const
Returns true if an Shape is stored in the data of the item.
ProjectItem * findItemData(const QVariant &value, int role=Qt::UserRole+1)
Finds and returns the first item in the model that contains the data in the role.
bool isShapeList() const
Returns true if an ShapeList is stored in the data of the item.
Shape * shape() const
Returns the Shape stored in the data of the item.
bool isImageList() const
Returns true if an ImageList is stored in the data of the item.
Image * image() const
Returns the Image stored in the data of the item.
bool isImage() const
Returns true if an Image is stored in the data of the item.
Provides access to data stored in a Project through Qt's model-view framework.
Allows access to items in a ProjectItemModel through a proxy model.
This represents a shape in a project-based GUI interface.
QString id() const
Get a unique, identifying string associated with this shape.
Cube * cube()
Get the Cube * associated with this display property.
This is an actual viewport window in qview/qnet/etc.
QMdiArea * mdiArea()
This method returns the QMdiArea.
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.
QVector< MdiCubeViewport * > * cubeViewportList()
This method returns a Vector of MdiCubeViewports.
Manage a stack of content handlers for reading XML files.
This is free and unencumbered software released into the public domain.