|
Isis 3 Programmer Reference
|
9 #include "CubeDnView.h"
13 #include <QHBoxLayout>
14 #include <QKeySequence>
17 #include <QMdiSubWindow>
20 #include <QModelIndex>
24 #include <QToolButton>
25 #include <QVBoxLayout>
26 #include <QWidgetAction>
27 #include <QXmlStreamWriter>
29 #include "AdvancedTrackTool.h"
31 #include "BlinkTool.h"
33 #include "CubeAttribute.h"
34 #include "Directory.h"
36 #include "FeatureNomenclatureTool.h"
40 #include "HistogramTool.h"
42 #include "ImageList.h"
43 #include "ControlNetTool.h"
45 #include "MatchTool.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"
63 #include "TrackTool.h"
67 #include "ViewportMdiSubWindow.h"
68 #include "Workspace.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];
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")) {
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() ) {
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() );
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);
601 bool CubeDnView::XmlHandler::endElement(
const QString &namespaceURI,
602 const QString &localName,
const QString &qName) {
603 bool result = XmlStackedHandler::endElement(namespaceURI, localName, qName);
Provides access to data stored in a Project through Qt's model-view framework.
Cube display widget for certain Isis MDI applications.
Cube * workspaceActiveCube()
Returns the cube of the active viewport in the Workspace, or a null pointer if no viewports are activ...
View that displays cubes in a QView-like way.
AbstractProjectItemView is a base class for views of a ProjectItemModel in Qt's model-view framework.
Image * image() const
Returns the Image stored in the data of the item.
File name manipulation and expansion.
void enableActions()
Enables toolbars and toolpad actions/widgets.
virtual void pushContentHandler(XmlStackedHandler *newHandler)
Push a contentHandler and maybe continue parsing...
Allows access to items in a ProjectItemModel through a proxy model.
Shape * shape() const
Returns the Shape stored in the data of the item.
ProjectItemModel * sourceModel()
Returns the source model.
void onCurrentChanged(const QModelIndex ¤t)
Slot to connect to the currentChanged() signal from a selection model.
CubeDnView(Directory *directory, QWidget *parent=0)
Constructs the view, initializing the tools.
QItemSelectionModel * selectionModel()
Returns the internal selection model.
void addCubeViewport(QString cubename)
Method adds the name of a cube into Workspace as a CubeViewport.
ToolPad * m_toolPad
A tool bar for storing actions.
ProjectItemViewMenu * m_windowMenu
Window menu for storing actions.
Control * activeControl()
Return the Active Control (control network)
Project * project() const
Gets the Project for this directory.
Cube * cube()
Get the Cube * associated with this display property.
ProjectItem * itemFromIndex(const QModelIndex &index)
Returns the ProjectItem corresponding to a given QModelIndex.
bool isShape() const
Returns true if an Shape is stored in the data of the item.
Manage a stack of content handlers for reading XML files.
QWidget * cubeToMdiWidget(Cube *cube)
Converts a cube to an MdiWidget.
void onCubeViewportActivated(MdiCubeViewport *)
Slot to connect to the cubeViewportActivated signal from the Workspace.
virtual void addItem(ProjectItem *item)
Adds an item to the view.
The main project for ipce.
void onCubeViewportAdded(MdiCubeViewport *viewport)
Slot to connect to the viewportAdded signal from a Workspace.
QToolBar * m_permToolBar
A tool bar for storing actions.
void onCubeViewportDeleted(QObject *obj)
Slot to connect to the destroyed signal from a viewport.
QAction * m_separatorAction
A separator action that is reused.
bool isImageList() const
Returns true if an ImageList is stored in the data of the item.
QString id() const
Get a unique, identifying string associated with this shape.
QToolBar * m_activeToolBar
A tool bar for storing actions.
ControlNet * controlNet()
Open and return a pointer to the ControlNet for this Control.
void leaveEvent(QEvent *event)
Disables actions when the cursor leaves the view.
QMdiArea * mdiArea()
This method returns the QMdiArea.
bool isShapeList() const
Returns true if an ShapeList is stored in the data of the item.
bool isImage() const
Returns true if an Image is stored in the data of the item.
virtual ProjectItemModel * internalModel()
Returns the internal model of the view.
This is an actual viewport window in qview/qnet/etc.
ProjectItemViewMenu * m_optionsMenu
Options menu for storing actions.
Cube * cube()
Get the Cube pointer associated with this display property.
void disableActions()
Disables toolbars and toolpad actions/widgets.
This represents a shape in a project-based GUI interface.
Directory * m_directory
The directory.
IO Handler for Isis Cubes.
void setWorkspaceActiveCube(Image *image)
Raises the subwindow corresponding with an image to the top.
This represents a cube in a project-based GUI interface.
ProjectItem * findItemData(const QVariant &data, int role=Qt::UserRole+1)
Returns the first item found that contains the given data in the given role or a null pointer if no i...
void onItemAdded(ProjectItem *item)
Slot to connect to the itemAdded signal from a ProjectItemModel.
MdiCubeViewport * viewport()
Grabs the viewport.
ProjectItemViewMenu * m_viewMenu
View menu for storing actions.
ProjectItem * addItem(ProjectItem *sourceItem)
Adds an item and its children to the proxy model.
QString id() const
Get a unique, identifying string associated with this image.
QVector< MdiCubeViewport * > * cubeViewportList()
This method returns a Vector of MdiCubeViewports.
Workspace * m_workspace
The workspace.
This is free and unencumbered software released into the public domain.
CubeDnView * m_cubeDnView
The view we are working with.
void enableControlNetTool(bool value)
A slot function that is called when directory emits a signal that an active control network is set.
QMap< Cube *, ProjectItem * > m_cubeItemMap
Maps cubes to their items.
Project * m_project
The current project.
This is free and unencumbered software released into the public domain.
QList< QWidget * > m_childWidgets
Child widgets of the active toolbar.
Represents an item of a ProjectItemModel in Qt's model-view framework.
void addItem(ProjectItem *item)
Adds an item to the view.