Isis Developer Reference
MosaicSceneWidget.h
Go to the documentation of this file.
1#ifndef MosaicSceneWidget_H
2#define MosaicSceneWidget_H
3
4#include <QWidget>
5
6#include "ImageList.h"
7#include "Pvl.h"
8
9template <typename A> class QList;
10
11class QGraphicsPolygonItem;
13class QGraphicsScene;
14class QGraphicsSceneContextMenuEvent;
15class QMenu;
16class QProgressBar;
17class QRubberBand;
18class QStatusBar;
19class QToolBar;
20class QToolButton;
21
22namespace Isis {
23 class ControlPoint;
24 class Directory;
25 class Image;
26 class MosaicGraphicsView;
27 class MosaicSceneItem;
28 class MosaicTool;
29 class ProgressBar;
30 class Projection;
31 class PvlGroup;
32 class PvlObject;
33 class ToolPad;
34
153 class MosaicSceneWidget : public QWidget {
154 Q_OBJECT
155
156 public:
157 MosaicSceneWidget(QStatusBar *status,
158 bool showTools, bool internalizeToolBarsAndProgress,
159 Directory *directory, QWidget *parent = 0);
160 virtual ~MosaicSceneWidget();
161
163 return m_graphicsView;
164 }
165
167 return m_graphicsScene;
168 }
169
171 return m_projection;
172 }
173
174 QList<MosaicSceneItem *> allMosaicSceneItems() {
175 return *m_mosaicSceneItems;
176 }
177
178 void addTo(QMenu *menu);
179 void addTo(ToolPad *toolPad);
180 void addToPermanent(QToolBar *toolBar);
181 void addTo(QToolBar *toolBar);
182
183 using QWidget::contextMenuEvent;
184 bool contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
185
187
188 bool cubesSelectable() const {
189 return m_cubesSelectable;
190 }
191
192 void enableRubberBand(bool);
193 bool blockSelectionChange(bool);
194
195 bool userHasTools() const {
196 return m_userToolControl;
197 }
198
200 PvlObject toPvl() const;
201 void fromPvl(const PvlObject &);
202 void load(XmlStackedHandlerReader *xmlReader);
203 void save(QXmlStreamWriter &stream, Project *project, FileName newProjectRoot) const;
204
205// QPointF currentLatLonPosition();
206 QRectF cubesBoundingRect() const;
208 Directory *directory() const;
209
212
213 QList<QAction *> getExportActions();
214 QList<QAction *> getViewActions();
215 QList<QAction *> supportedActions(ImageList *);
216
217 double moveDownOne(MosaicSceneItem *);
218 double moveDownOne(Image *);
219 QList<double> moveDownOne(ImageList *);
220
221 double moveToBottom(MosaicSceneItem *);
222 double moveToBottom(Image *);
223 QList<double> moveToBottom(ImageList *);
224
225 double moveUpOne(MosaicSceneItem *);
226 double moveUpOne(Image *);
227 QList<double> moveUpOne(ImageList *);
228
229 double moveToTop(MosaicSceneItem *);
230 double moveToTop(Image *);
231 QList<double> moveToTop(ImageList *);
232
233 double moveZ(MosaicSceneItem *sceneItem, double newZ, bool newZValueMightExist = true);
234 double moveZ(Image *image, double newZ, bool newZValueMightExist = true);
235
239 template <typename DataType>
240 QList<QAction *> supportedActions(DataType) {
241 return QList<QAction *>();
242 }
243
245
246 static QWidget *getControlNetHelp(QWidget *cnetToolContainer = NULL);
247 static QWidget *getGridHelp(QWidget *gridToolContainer = NULL);
248 static QWidget *getLongHelp(QWidget *mosaicSceneContainer = NULL);
249 static QWidget *getMapHelp(QWidget *mapContainer = NULL);
250 static QWidget *getPreviewHelp(QWidget *worldViewContainer = NULL);
251
252 signals:
254 void mouseMove(QPointF);
256 void mouseDoubleClick(QPointF);
257 void mouseButtonPress(QPointF, Qt::MouseButton s);
258 void mouseButtonRelease(QPointF, Qt::MouseButton s);
259 void mouseWheel(QPointF, int delta);
261 void rubberBandComplete(QRectF r, Qt::MouseButton s);
262 void visibleRectChanged(QRectF);
263
265
267
268 void modifyControlPoint(ControlPoint *controlPoint);
269 void deleteControlPoint(ControlPoint *controlPoint);
270 void createControlPoint(double latitude, double longitude);
271
273
275 void controlPointChanged(QString pointId);
277
279
280 public slots:
281 void addImages(ImageList);
283 void refit();
284 void setCubesSelectable(bool);
286 void setOutlineRect(QRectF);
287
288 private slots:
289 void exportView();
290 void saveList();
291
292 void removeMosItem(QObject *);
293
294 void moveDownOne();
295 void moveToBottom();
296 void moveUpOne();
297 void moveToTop();
298 void fitInView();
299
300 void onSelectionChanged();
301 void onQueuedSelectionChanged();
302
303 void configProjectionParameters();
304 void quickConfigProjectionParameters();
305 void sendVisibleRectChanged();
306
307 protected:
308 virtual bool eventFilter(QObject *obj, QEvent *ev);
309
310 private:
311 void setProjection(const PvlGroup &mappingGroup, Pvl label=Pvl());
312 MosaicSceneItem *addImage(Image *image);
313 void reprojectItems();
314 double maximumZ();
315 double minimumZ();
316 void recalcSceneRect();
317
318 MosaicSceneItem *getNextItem(MosaicSceneItem *item, bool up);
319
320 PvlGroup createInitialProjection(Image *cube);
321
323
324 static bool zOrderGreaterThan(MosaicSceneItem *first,
325 MosaicSceneItem *second);
326
327 private:
333 class XmlHandler : public XmlStackedHandler {
334 public:
335 XmlHandler(MosaicSceneWidget *scene);
336 ~XmlHandler();
337
338 virtual bool startElement(const QString &namespaceURI, const QString &localName,
339 const QString &qName, const QXmlAttributes &atts);
340 virtual bool characters(const QString &ch);
341 virtual bool endElement(const QString &namespaceURI, const QString &localName,
342 const QString &qName);
343
344 private:
345 Q_DISABLE_COPY(XmlHandler);
346
347 QString m_characterData;
348 MosaicSceneWidget *m_scene;
349
350 int m_scrollBarXValue;
351 int m_scrollBarYValue;
352
353 ImageList *m_imagesToAdd;
354 QList<double> m_imageZValues;
355 };
356
357 private:
358 Directory *m_directory;
359
360 bool m_cubesSelectable;
361 bool m_customRubberBandEnabled;
362 QRubberBand *m_customRubberBand;
363 QPoint *m_rubberBandOrigin;
364 QGraphicsScene *m_graphicsScene;
365 MosaicGraphicsView *m_graphicsView;
366 Projection *m_projection;
367 QList<MosaicSceneItem *> *m_mosaicSceneItems;
368 QMap<DisplayProperties *, MosaicSceneItem *> m_displayPropsToMosaicSceneItemMap;
369 QGraphicsRectItem *m_outlineRect;
370
371 QToolButton *m_mapButton;
372 QAction *m_quickMapAction;
373
374 QList<MosaicTool *> *m_tools;
375
376 ToolPad *m_toolpad;
377
378 QToolBar *m_permToolbar;
379 QToolBar *m_activeToolbar;
380
381 ProgressBar *m_progress;
382
383 QHash<QString, double> *m_projectImageZOrders;
384
385 bool m_blockingSelectionChanged;
386 bool m_userToolControl;
387 bool m_ownProjection;
388 bool m_queuedSelectionChanged;
389 bool m_shouldRequeueSelectionChanged;
390
391 double m_currentMinimumFootprintZ;
392 double m_currentMaximumFootprintZ;
393
394 PvlObject *m_projectViewTransform;
395 };
396}
397
398#endif
399
A single control point.
Definition ControlPoint.h:356
Definition Directory.h:271
Definition DisplayProperties.h:34
File name manipulation and expansion.
Definition FileName.h:100
This represents a cube in a project-based GUI interface.
Definition Image.h:107
Internalizes a list of images and allows for operations on the entire list.
Definition ImageList.h:55
A graphics view that resizes in a more friendly way.
Definition MosaicGraphicsView.h:19
A single cube in the mosaic scene.
Definition MosaicSceneItem.h:47
This widget encompasses the entire mosaic scene.
Definition MosaicSceneWidget.h:153
void load(XmlStackedHandlerReader *xmlReader)
Definition MosaicSceneWidget.cpp:620
static QWidget * getMapHelp(QWidget *mapContainer=NULL)
Definition MosaicSceneWidget.cpp:1078
Directory * directory() const
Definition MosaicSceneWidget.cpp:717
bool blockSelectionChange(bool)
Definition MosaicSceneWidget.cpp:509
QList< QAction * > supportedActions(ImageList *)
Get a list of actions this scene can perform given "images".
Definition MosaicSceneWidget.cpp:810
void addImages(ImageList)
Definition MosaicSceneWidget.cpp:1354
void mouseWheel(QPointF, int delta)
bool contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
This is called by MosaicGraphicsScene::contextMenuEvent.
Definition MosaicSceneWidget.cpp:440
void modifyControlPoint(ControlPoint *controlPoint)
ImageList images()
Definition MosaicSceneWidget.cpp:722
static QWidget * getLongHelp(QWidget *mosaicSceneContainer=NULL)
Definition MosaicSceneWidget.cpp:1028
QList< QAction * > supportedActions(DataType)
Return an empty list of actions for unknown data types.
Definition MosaicSceneWidget.h:240
void visibleRectChanged(QRectF)
QProgressBar * getProgress()
Definition MosaicSceneWidget.cpp:518
void rubberBandComplete(QRectF r, Qt::MouseButton s)
void mosCubeClosed(Image *)
double moveToBottom(MosaicSceneItem *)
This doesn't compress the Z values - the original Z values of this scene item is guaranteed to be emp...
Definition MosaicSceneWidget.cpp:1787
void controlPointChanged(QString pointId)
QList< MosaicSceneItem * > allMosaicSceneItems()
Definition MosaicSceneWidget.h:174
void mouseDoubleClick(QPointF)
MosaicGraphicsView * getView() const
Definition MosaicSceneWidget.h:162
void setCubesSelectable(bool)
Definition MosaicSceneWidget.cpp:1497
void addToPermanent(QToolBar *toolBar)
Definition MosaicSceneWidget.cpp:377
void projectionChanged(Projection *)
QGraphicsScene * getScene() const
Definition MosaicSceneWidget.h:166
void refit()
This method refits t:he items in the graphics view.
Definition MosaicSceneWidget.cpp:1483
void addTo(QMenu *menu)
Definition MosaicSceneWidget.cpp:419
void enableRubberBand(bool)
Definition MosaicSceneWidget.cpp:494
MosaicSceneWidget(QStatusBar *status, bool showTools, bool internalizeToolBarsAndProgress, Directory *directory, QWidget *parent=0)
Create a scene widget.
Definition MosaicSceneWidget.cpp:64
QStringList cubeFileNames()
Definition MosaicSceneWidget.cpp:704
void deleteControlPoint(ControlPoint *controlPoint)
ImageList selectedImages()
Returns a list of all the cubes selected in the scene.
Definition MosaicSceneWidget.cpp:740
void mouseButtonPress(QPointF, Qt::MouseButton s)
QRectF cubesBoundingRect() const
Definition MosaicSceneWidget.cpp:676
void controlPointSelected(ControlPoint *)
PvlObject toPvl() const
Definition MosaicSceneWidget.cpp:523
double moveUpOne(MosaicSceneItem *)
Definition MosaicSceneWidget.cpp:1839
QList< QAction * > getExportActions()
Definition MosaicSceneWidget.cpp:777
void removeImages(ImageList)
Definition MosaicSceneWidget.cpp:1406
bool cubesSelectable() const
Definition MosaicSceneWidget.h:188
void fromPvl(const PvlObject &)
Call this method after loading any cubes when loading a project.
Definition MosaicSceneWidget.cpp:579
void mouseButtonRelease(QPointF, Qt::MouseButton s)
double moveToTop(MosaicSceneItem *)
This doesn't compress the Z values - the original Z values of this scene item is guaranteed to be emp...
Definition MosaicSceneWidget.cpp:1885
static QWidget * getControlNetHelp(QWidget *cnetToolContainer=NULL)
Definition MosaicSceneWidget.cpp:862
bool isControlNetToolActive()
Definition MosaicSceneWidget.cpp:850
virtual ~MosaicSceneWidget()
Definition MosaicSceneWidget.cpp:244
static QWidget * getGridHelp(QWidget *gridToolContainer=NULL)
Definition MosaicSceneWidget.cpp:936
double moveZ(MosaicSceneItem *sceneItem, double newZ, bool newZValueMightExist=true)
This method moves the given scene item to the given Z value.
Definition MosaicSceneWidget.cpp:1953
virtual bool eventFilter(QObject *obj, QEvent *ev)
Definition MosaicSceneWidget.cpp:1537
void mouseMove(QPointF)
double moveDownOne(MosaicSceneItem *)
Definition MosaicSceneWidget.cpp:1742
void setProjection(Projection *)
This method takes ownership of proj.
Definition MosaicSceneWidget.cpp:288
void setOutlineRect(QRectF)
Definition MosaicSceneWidget.cpp:313
void save(QXmlStreamWriter &stream, Project *project, FileName newProjectRoot) const
Definition MosaicSceneWidget.cpp:625
bool userHasTools() const
Definition MosaicSceneWidget.h:195
void createControlPoint(double latitude, double longitude)
static QWidget * getPreviewHelp(QWidget *worldViewContainer=NULL)
Definition MosaicSceneWidget.cpp:1234
Projection * getProjection() const
Definition MosaicSceneWidget.h:170
MosaicSceneItem * cubeToMosaic(Image *)
Definition MosaicSceneWidget.cpp:499
QList< QAction * > getViewActions()
Definition MosaicSceneWidget.cpp:795
Definition ProgressBar.h:15
The main project for ipce.
Definition Project.h:289
Base class for Map Projections.
Definition Projection.h:155
Contains multiple PvlContainers.
Definition PvlGroup.h:41
Container for cube-like labels.
Definition Pvl.h:119
Contains Pvl Groups and Pvl Objects.
Definition PvlObject.h:61
Definition ToolPad.h:14
XML Handler that parses XMLs in a stack-oriented way.
Definition XmlStackedHandler.h:118
Manage a stack of content handlers for reading XML files.
Definition XmlStackedHandlerReader.h:30
This is free and unencumbered software released into the public domain.
Definition BoxcarCachingAlgorithm.h:13
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16