Isis 3 Programmer Reference
MosaicSceneWidget.h
1 #ifndef MosaicSceneWidget_H
2 #define MosaicSceneWidget_H
3 
4 #include <QWidget>
5 
6 #include "ImageList.h"
7 #include "Pvl.h"
8 
9 template <typename A> class QList;
10 
11 class QGraphicsPolygonItem;
12 class QGraphicsRectItem;
13 class QGraphicsScene;
14 class QGraphicsSceneContextMenuEvent;
15 class QMenu;
16 class QProgressBar;
17 class QRubberBand;
18 class QStatusBar;
19 class QToolBar;
20 class QToolButton;
21 
22 namespace 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 
162  MosaicGraphicsView *getView() const {
163  return m_graphicsView;
164  }
165 
166  QGraphicsScene *getScene() const {
167  return m_graphicsScene;
168  }
169 
170  Projection *getProjection() const {
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 
186  MosaicSceneItem *cubeToMosaic(Image *);
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 
199  QProgressBar *getProgress();
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;
207  QStringList cubeFileNames();
208  Directory *directory() const;
209 
210  ImageList images();
212 
213  QList<QAction *> getExportActions();
214  QList<QAction *> getViewActions();
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>
241  return QList<QAction *>();
242  }
243 
244  bool isControlNetToolActive();
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:
253  void mouseEnter();
254  void mouseMove(QPointF);
255  void mouseLeave();
256  void mouseDoubleClick(QPointF);
257  void mouseButtonPress(QPointF, Qt::MouseButton s);
258  void mouseButtonRelease(QPointF, Qt::MouseButton s);
259  void mouseWheel(QPointF, int delta);
260  void projectionChanged(Projection *);
261  void rubberBandComplete(QRectF r, Qt::MouseButton s);
262  void visibleRectChanged(QRectF);
263 
264  void cubesChanged();
265 
266  void queueSelectionChanged();
267 
268  void modifyControlPoint(ControlPoint *controlPoint);
269  void deleteControlPoint(ControlPoint *controlPoint);
270  void createControlPoint(double latitude, double longitude);
271 
272  void controlPointSelected(ControlPoint *);
273 
274  void cnetModified();
275  void controlPointChanged(QString pointId);
276  void controlPointDeleted();
277 
278  void mosCubeClosed(Image *);
279 
280  public slots:
281  void addImages(ImageList);
282  void removeImages(ImageList);
283  void refit();
284  void setCubesSelectable(bool);
285  void setProjection(Projection *);
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 
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 
319 
320  PvlGroup createInitialProjection(Image *cube);
321 
322  MosaicSceneItem *cubeToMosaic(DisplayProperties *props);
323 
324  static bool zOrderGreaterThan(MosaicSceneItem *first,
325  MosaicSceneItem *second);
326 
327  private:
333  class XmlHandler : public XmlStackedHandler {
334  public:
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;
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 
Isis::MosaicSceneWidget::setProjection
void setProjection(Projection *)
This method takes ownership of proj.
Definition: MosaicSceneWidget.cpp:290
QWidget
QProgressBar
Isis::MosaicSceneWidget::m_graphicsView
MosaicGraphicsView * m_graphicsView
The graphics view.
Definition: MosaicSceneWidget.h:365
Isis::PvlObject
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:61
Isis::MosaicSceneWidget::XmlHandler
Definition: MosaicSceneWidget.h:333
Isis::MosaicSceneWidget::moveToBottom
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:1789
Isis::Directory
Definition: Directory.h:271
QList
This is free and unencumbered software released into the public domain.
Definition: BoxcarCachingAlgorithm.h:13
Isis::ProgressBar
Definition: ProgressBar.h:15
Isis::MosaicSceneWidget::configProjectionParameters
void configProjectionParameters()
This happens when the user clicks on the map action (the button that is named after the current proje...
Definition: MosaicSceneWidget.cpp:1515
Isis::FileName
File name manipulation and expansion.
Definition: FileName.h:100
Isis::MosaicSceneWidget::contextMenuEvent
bool contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
This is called by MosaicGraphicsScene::contextMenuEvent.
Definition: MosaicSceneWidget.cpp:442
Isis::MosaicSceneWidget::refit
void refit()
This method refits t:he items in the graphics view.
Definition: MosaicSceneWidget.cpp:1485
QMenu
Isis::MosaicSceneWidget::MosaicSceneWidget
MosaicSceneWidget(QStatusBar *status, bool showTools, bool internalizeToolBarsAndProgress, Directory *directory, QWidget *parent=0)
Create a scene widget.
Definition: MosaicSceneWidget.cpp:66
Isis::MosaicSceneWidget::moveZ
double moveZ(MosaicSceneItem *sceneItem, double newZ, bool newZValueMightExist=true)
This method moves the given scene item to the given Z value.
Definition: MosaicSceneWidget.cpp:1955
Isis::MosaicSceneWidget
This widget encompasses the entire mosaic scene.
Definition: MosaicSceneWidget.h:153
Isis::DisplayProperties
Definition: DisplayProperties.h:34
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::MosaicSceneWidget::moveToTop
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:1887
Isis::MosaicSceneWidget::getNextItem
MosaicSceneItem * getNextItem(MosaicSceneItem *item, bool up)
Implemented because we want invisible items too.
Definition: MosaicSceneWidget.cpp:2074
Isis::MosaicSceneWidget::m_graphicsScene
QGraphicsScene * m_graphicsScene
The graphics scene that makes up this widget.
Definition: MosaicSceneWidget.h:364
Isis::MosaicSceneWidget::exportView
void exportView()
Saves the scene as a png, jpg, or tif file.
Definition: MosaicSceneWidget.cpp:1427
QToolBar
QStringList
Isis::XmlStackedHandlerReader
Manage a stack of content handlers for reading XML files.
Definition: XmlStackedHandlerReader.h:30
Isis::Project
The main project for ipce.
Definition: Project.h:289
Isis::ImageList
Internalizes a list of images and allows for operations on the entire list.
Definition: ImageList.h:55
Isis::ControlPoint
A single control point.
Definition: ControlPoint.h:354
QHash< QString, double >
Isis::PvlGroup
Contains multiple PvlContainers.
Definition: PvlGroup.h:41
Isis::MosaicSceneWidget::supportedActions
QList< QAction * > supportedActions(ImageList *)
Get a list of actions this scene can perform given "images".
Definition: MosaicSceneWidget.cpp:812
QGraphicsScene
Isis::MosaicSceneWidget::reprojectItems
void reprojectItems()
Reprojects all the items in the view.
Definition: MosaicSceneWidget.cpp:1680
Isis::Image
This represents a cube in a project-based GUI interface.
Definition: Image.h:107
Isis::MosaicSceneWidget::fromPvl
void fromPvl(const PvlObject &)
Call this method after loading any cubes when loading a project.
Definition: MosaicSceneWidget.cpp:581
Isis::MosaicSceneWidget::selectedImages
ImageList selectedImages()
Returns a list of all the cubes selected in the scene.
Definition: MosaicSceneWidget.cpp:742
Isis::ToolPad
Definition: ToolPad.h:14
Isis::MosaicSceneItem
A single cube in the mosaic scene.
Definition: MosaicSceneItem.h:47
Isis::MosaicGraphicsView
A graphics view that resizes in a more friendly way.
Definition: MosaicGraphicsView.h:19
Isis::XmlStackedHandler
XML Handler that parses XMLs in a stack-oriented way.
Definition: XmlStackedHandler.h:118
QMap
This is free and unencumbered software released into the public domain.
Definition: CubeIoHandler.h:22
QObject
Isis::MosaicSceneWidget::m_projection
Projection * m_projection
The current projection type.
Definition: MosaicSceneWidget.h:366
Isis::Projection
Base class for Map Projections.
Definition: Projection.h:155
Isis::MosaicSceneWidget::supportedActions
QList< QAction * > supportedActions(DataType)
Return an empty list of actions for unknown data types.
Definition: MosaicSceneWidget.h:240
QAction
QGraphicsRectItem
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16