Isis 3 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 
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 
163  return m_graphicsView;
164  }
165 
167  return m_graphicsScene;
168  }
169 
171  return m_projection;
172  }
173 
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 
210  ImageList images();
212 
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);
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 
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 
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 
MosaicGraphicsView * getView() const
Definition: MosaicSceneWidget.h:162
bool blockSelectionChange(bool)
Definition: MosaicSceneWidget.cpp:511
Projection * getProjection() const
Definition: MosaicSceneWidget.h:170
Internalizes a list of images and allows for operations on the entire list.
Definition: ImageList.h:55
PvlObject toPvl() const
Definition: MosaicSceneWidget.cpp:525
void load(XmlStackedHandlerReader *xmlReader)
Definition: MosaicSceneWidget.cpp:622
The main project for ipce.
Definition: Project.h:289
QRectF cubesBoundingRect() const
Definition: MosaicSceneWidget.cpp:678
void setCubesSelectable(bool)
Definition: MosaicSceneWidget.cpp:1501
A graphics view that resizes in a more friendly way.
Definition: MosaicGraphicsView.h:19
void createControlPoint(double latitude, double longitude)
void setProjection(Projection *)
This method takes ownership of proj.
Definition: MosaicSceneWidget.cpp:290
File name manipulation and expansion.
Definition: FileName.h:116
void controlPointChanged(QString pointId)
QList< MosaicSceneItem * > allMosaicSceneItems()
Definition: MosaicSceneWidget.h:174
static QWidget * getMapHelp(QWidget *mapContainer=NULL)
Definition: MosaicSceneWidget.cpp:1080
This widget encompasses the entire mosaic scene.
Definition: MosaicSceneWidget.h:153
MosaicSceneWidget(QStatusBar *status, bool showTools, bool internalizeToolBarsAndProgress, Directory *directory, QWidget *parent=0)
Create a scene widget.
Definition: MosaicSceneWidget.cpp:66
void mouseDoubleClick(QPointF)
void addImages(ImageList)
Definition: MosaicSceneWidget.cpp:1358
bool cubesSelectable() const
Definition: MosaicSceneWidget.h:188
void mouseWheel(QPointF, int delta)
void deleteControlPoint(ControlPoint *controlPoint)
void enableRubberBand(bool)
Definition: MosaicSceneWidget.cpp:496
bool contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
This is called by MosaicGraphicsScene::contextMenuEvent.
Definition: MosaicSceneWidget.cpp:442
void refit()
This method refits t:he items in the graphics view.
Definition: MosaicSceneWidget.cpp:1487
virtual bool eventFilter(QObject *obj, QEvent *ev)
Definition: MosaicSceneWidget.cpp:1541
double moveZ(MosaicSceneItem *sceneItem, double newZ, bool newZValueMightExist=true)
This method moves the given scene item to the given Z value.
Definition: MosaicSceneWidget.cpp:1957
void mosCubeClosed(Image *)
Directory * directory() const
Definition: MosaicSceneWidget.cpp:719
static QWidget * getGridHelp(QWidget *gridToolContainer=NULL)
Definition: MosaicSceneWidget.cpp:938
static QWidget * getLongHelp(QWidget *mosaicSceneContainer=NULL)
Definition: MosaicSceneWidget.cpp:1030
QList< QAction * > getExportActions()
Definition: MosaicSceneWidget.cpp:779
QList< QAction * > supportedActions(ImageList *)
Get a list of actions this scene can perform given "images".
Definition: MosaicSceneWidget.cpp:812
void mouseButtonRelease(QPointF, Qt::MouseButton s)
static QWidget * getPreviewHelp(QWidget *worldViewContainer=NULL)
Definition: MosaicSceneWidget.cpp:1238
Base class for Map Projections.
Definition: Projection.h:171
bool isControlNetToolActive()
Definition: MosaicSceneWidget.cpp:852
static QWidget * getControlNetHelp(QWidget *cnetToolContainer=NULL)
Definition: MosaicSceneWidget.cpp:864
void addTo(QMenu *menu)
Definition: MosaicSceneWidget.cpp:421
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
Definition: DisplayProperties.h:26
ImageList selectedImages()
Returns a list of all the cubes selected in the scene.
Definition: MosaicSceneWidget.cpp:742
MosaicSceneItem * cubeToMosaic(Image *)
Definition: MosaicSceneWidget.cpp:501
QGraphicsScene * getScene() const
Definition: MosaicSceneWidget.h:166
XML Handler that parses XMLs in a stack-oriented way.
Definition: XmlStackedHandler.h:112
void mouseButtonPress(QPointF, Qt::MouseButton s)
void controlPointSelected(ControlPoint *)
A single control point.
Definition: ControlPoint.h:369
This represents a cube in a project-based GUI interface.
Definition: Image.h:107
ImageList images()
Definition: MosaicSceneWidget.cpp:724
void setOutlineRect(QRectF)
Definition: MosaicSceneWidget.cpp:315
void fromPvl(const PvlObject &)
Call this method after loading any cubes when loading a project.
Definition: MosaicSceneWidget.cpp:581
Container for cube-like labels.
Definition: Pvl.h:135
void mouseMove(QPointF)
void addToPermanent(QToolBar *toolBar)
Definition: MosaicSceneWidget.cpp:379
void rubberBandComplete(QRectF r, Qt::MouseButton s)
QStringList cubeFileNames()
Definition: MosaicSceneWidget.cpp:706
bool userHasTools() const
Definition: MosaicSceneWidget.h:195
void projectionChanged(Projection *)
void removeImages(ImageList)
Definition: MosaicSceneWidget.cpp:1410
Definition: BoxcarCachingAlgorithm.h:29
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
virtual ~MosaicSceneWidget()
Definition: MosaicSceneWidget.cpp:246
QList< QAction * > supportedActions(DataType)
Return an empty list of actions for unknown data types.
Definition: MosaicSceneWidget.h:240
void visibleRectChanged(QRectF)
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:74
void save(QXmlStreamWriter &stream, Project *project, FileName newProjectRoot) const
Definition: MosaicSceneWidget.cpp:627
QList< QAction * > getViewActions()
Definition: MosaicSceneWidget.cpp:797
A single cube in the mosaic scene.
Definition: MosaicSceneItem.h:47
Definition: Directory.h:285
Manage a stack of content handlers for reading XML files.
Definition: XmlStackedHandlerReader.h:25
Definition: CubeIoHandler.h:38
void modifyControlPoint(ControlPoint *controlPoint)
Definition: ToolPad.h:14
QProgressBar * getProgress()
Definition: MosaicSceneWidget.cpp:520