26 #include <QDataStream>
27 #include <QHBoxLayout>
30 #include <QMdiSubWindow>
32 #include <QModelIndex>
34 #include <QSizePolicy>
37 #include <QVBoxLayout>
38 #include <QWidgetAction>
39 #include <QXmlStreamWriter>
43 #include "BlinkTool.h"
48 #include "FeatureNomenclatureTool.h"
53 #include "HistogramTool.h"
55 #include "ImageList.h"
58 #include "MatchTool.h"
60 #include "MeasureTool.h"
66 #include "RubberBandTool.h"
67 #include "ScatterPlotTool.h"
69 #include "SpatialPlotTool.h"
70 #include "SpecialPixelTool.h"
71 #include "SpectralPlotTool.h"
73 #include "StereoTool.h"
75 #include "SunShadowTool.h"
76 #include "TrackTool.h"
79 #include "ViewportMdiSubWindow.h"
81 #include "WindowTool.h"
82 #include "XmlStackedHandlerReader.h"
94 SIGNAL( currentChanged(
const QModelIndex &,
const QModelIndex &) ),
103 m_workspace->mdiArea()->setActivationOrder(QMdiArea::StackingOrder);
105 connect(m_workspace, SIGNAL( cubeViewportActivated(
MdiCubeViewport *) ),
112 QVBoxLayout *layout =
new QVBoxLayout;
136 layout->addWidget(m_workspace);
141 Tool *defaultActiveTool = NULL;
151 defaultActiveTool = ipceTool;
152 tools->append(defaultActiveTool);
159 connect(ipceTool, SIGNAL(modifyControlPoint(
ControlPoint *)),
162 connect(ipceTool, SIGNAL(deleteControlPoint(
ControlPoint *)),
165 connect(ipceTool, SIGNAL(createControlPoint(
double,
double,
Cube *,
bool)),
166 this, SIGNAL(createControlPoint(
double,
double,
Cube *,
bool)));
170 connect(
this, SIGNAL(controlPointAdded(QString)), ipceTool, SLOT(refresh()));
173 tools->append(
new PanTool(
this));
192 QStatusBar *statusBar =
new QStatusBar(
this);
193 layout->addWidget(statusBar);
214 for (
int i = 0; i < tools->count(); i++) {
215 Tool *tool = (*tools)[i];
218 tool->
addTo(m_workspace);
224 QString menuName = tool->
menuName();
226 if (menuName ==
"&File") {
229 else if (menuName ==
"&View") {
232 else if (menuName ==
"&Options") {
235 else if (menuName ==
"&Window") {
238 else if (menuName ==
"&Help") {
255 QSizePolicy policy = sizePolicy();
256 policy.setHorizontalPolicy(QSizePolicy::Expanding);
257 policy.setVerticalPolicy(QSizePolicy::Expanding);
258 setSizePolicy(policy);
297 return QSize(800, 600);
439 if ( !isVisible() ) {
454 QItemSelectionModel::SelectCurrent);
466 connect(viewport, SIGNAL( destroyed(
QObject *) ),
534 return viewport->
cube();
566 xmlReader->pushContentHandler(
new XmlHandler(
this, project));
570 void CubeDnView::save(QXmlStreamWriter &stream,
Project *,
FileName)
const {
571 stream.writeStartElement(
"cubeDnView");
576 stream.writeStartElement(
"image");
577 stream.writeAttribute(
"id", item->
image()->
id());
580 stream.writeStartElement(
"shape");
581 stream.writeAttribute(
"id", item->
shape()->
id());
583 stream.writeEndElement();
585 stream.writeEndElement();
596 CubeDnView::XmlHandler::~XmlHandler() {
600 bool CubeDnView::XmlHandler::startElement(
const QString &namespaceURI,
601 const QString &localName,
const QString &qName,
const QXmlAttributes &atts) {
602 bool result = XmlStackedHandler::startElement(namespaceURI, localName, qName, atts);
607 QString
id = atts.value(
"id");
610 if (localName ==
"image") {
611 Image *image = m_project->image(
id);
617 else if (localName ==
"shape") {
618 Shape *shape = m_project->shape(
id);
632 bool CubeDnView::XmlHandler::endElement(
const QString &namespaceURI,
633 const QString &localName,
const QString &qName) {
634 bool result = XmlStackedHandler::endElement(namespaceURI, localName, qName);
Cube display widget for certain Isis MDI applications.
void setWorkspaceActiveCube(Image *image)
Raises the subwindow corresponding with an image to the top.
CubeDnView * m_cubeDnView
The view we are working with.
virtual void addItem(ProjectItem *item)
Adds an item to the view.
virtual QList< QAction * > activeToolBarActions()
Returns a list of actions for the active tool bar.
void onItemAdded(ProjectItem *item)
Slot to connect to the itemAdded signal from a ProjectItemModel.
The main project for cnetsuite.
Workspace * m_workspace
The workspace.
QString id() const
Get a unique, identifying string associated with this image.
File name manipulation and expansion.
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.
QVector< MdiCubeViewport * > * cubeViewportList()
Repopulates the list of MdiCubeViewports and returns a pointer to this list.
void onCubeViewportActivated(MdiCubeViewport *)
Slot to connect to the cubeViewportActivated signal from the Workspace.
QToolBar * m_activeToolBar
A tool bar for storing actions.
QList< QAction * > m_toolPadActions
The tool pad 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.
virtual QList< QAction * > viewMenuActions()
Returns a list of actions appropriate for a view menu.
QMap< Cube *, ProjectItem * > m_cubeItemMap
Maps cubes to their items.
bool isImage() const
Returns true if an Image is stored in the data of the item.
Shape * shape() const
Returns the Shape stored in the data of the item.
Control * activeControl()
Return the Active Control (control network)
Cube * workspaceActiveCube()
Returns the cube of the active viewport in the Workspace, or a null pointer if no viewports are activ...
Project * project() const
Gets the Project for this directory.
QMenu * m_optionsMenu
Options menu for storing actions.
AbstractProjectItemView is a base class for views of a ProjectItemModel in Qt's model-view framework...
Provides access to data stored in a Project through Qt's model-view framework.
ProjectItem * addItem(ProjectItem *sourceItem)
Adds an item and its children to the proxy model.
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...
virtual QList< QAction * > permToolBarActions()
Returns a list of actions for the permanent tool bar.
QMenu * m_windowMenu
Window menu for storing actions.
QMenu * m_viewMenu
View menu for storing actions.
virtual ProjectItemModel * internalModel()
Returns the internal model of the view.
CubeDnView(Directory *directory, QWidget *parent=0)
Constructs the view, initializing the tools.
Cube * cube() const
Return the cube associated with viewport.
Image * image() const
Returns the Image stored in the data of the item.
Allows access to items in a ProjectItemModel through a proxy model.
QItemSelectionModel * selectionModel()
Returns the internal selection model.
QWidgetAction * m_activeToolBarAction
Widget of the active tool.
Cube * cube()
Get the Cube * associated with this display property.
virtual QList< QAction * > projectMenuActions()
Returns a list of actions appropriate for a project menu.
Project * m_project
The current project.
QMenu * m_helpMenu
Help menu for storing actions.
This represents a cube in a project-based GUI interface.
QString id() const
Get a unique, identifying string associated with this shape.
ToolPad * m_toolPad
A tool bar for storing actions.
This is an actual viewport window in qview/qnet/etc.
QSize sizeHint() const
Returns the suggested size.
virtual QList< QAction * > toolPadActions()
Returns a list of actions for the tool pad.
ControlNet * controlNet()
Open and return a pointer to the ControlNet for this Control.
virtual QList< QAction * > settingsMenuActions()
Returns a list of actions appropriate for a settings menu.
ProjectItemModel * sourceModel()
Returns the source model.
void onCubeViewportAdded(MdiCubeViewport *viewport)
Slot to connect to the viewportAdded signal from a Workspace.
bool isShapeList() const
Returns true if an ShapeList is stored in the data of the item.
QMenu * m_fileMenu
File menu for storing actions.
void addItem(ProjectItem *item)
Adds an item to the view.
This represents a shape in a project-based GUI interface.
View that displays cubes in a QView-like way.
QToolBar * m_permToolBar
A tool bar for storing actions.
void addCubeViewport(QString cube)
Add a cubeViewport to the workspace, open the cube.
Represents an item of a ProjectItemModel in Qt's model-view framework.
virtual QList< QAction * > fileMenuActions()
Returns a list of actions appropriate for a file menu.
Cube * cube()
Get the Cube pointer associated with this display property.
virtual QList< QAction * > editMenuActions()
Returns a list of actions appropriate for an edit menu.
void onCurrentChanged(const QModelIndex ¤t)
Slot to connect to the currentChanged() signal from a selection model.
QList< QAction * > m_permToolBarActions
The permanent tool bar actions.
virtual QList< QAction * > helpMenuActions()
Returns a list of actions appropriate for a help menu.
his enables stack-based XML parsing of XML files.
IO Handler for Isis Cubes.