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 
MosaicGraphicsView * m_graphicsView
The graphics view.
Internalizes a list of images and allows for operations on the entire list.
Definition: ImageList.h:55
The main project for ipce.
Definition: Project.h:289
A graphics view that resizes in a more friendly way.
void setProjection(Projection *)
This method takes ownership of proj.
File name manipulation and expansion.
Definition: FileName.h:116
double moveToBottom(MosaicSceneItem *)
This doesn&#39;t compress the Z values - the original Z values of this scene item is guaranteed to be emp...
This widget encompasses the entire mosaic scene.
MosaicSceneWidget(QStatusBar *status, bool showTools, bool internalizeToolBarsAndProgress, Directory *directory, QWidget *parent=0)
Create a scene widget.
double moveToTop(MosaicSceneItem *)
This doesn&#39;t compress the Z values - the original Z values of this scene item is guaranteed to be emp...
MosaicSceneItem * getNextItem(MosaicSceneItem *item, bool up)
Implemented because we want invisible items too.
bool contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
This is called by MosaicGraphicsScene::contextMenuEvent.
void refit()
This method refits t:he items in the graphics view.
double moveZ(MosaicSceneItem *sceneItem, double newZ, bool newZValueMightExist=true)
This method moves the given scene item to the given Z value.
QGraphicsScene * m_graphicsScene
The graphics scene that makes up this widget.
void configProjectionParameters()
This happens when the user clicks on the map action (the button that is named after the current proje...
void exportView()
Saves the scene as a png, jpg, or tif file.
QList< QAction * > supportedActions(ImageList *)
Get a list of actions this scene can perform given "images".
Base class for Map Projections.
Definition: Projection.h:171
Contains multiple PvlContainers.
Definition: PvlGroup.h:57
ImageList selectedImages()
Returns a list of all the cubes selected in the scene.
XML Handler that parses XMLs in a stack-oriented way.
A single control point.
Definition: ControlPoint.h:369
This represents a cube in a project-based GUI interface.
Definition: Image.h:107
void fromPvl(const PvlObject &)
Call this method after loading any cubes when loading a project.
Container for cube-like labels.
Definition: Pvl.h:135
void reprojectItems()
Reprojects all the items in the view.
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
Projection * m_projection
The current projection type.
QList< QAction * > supportedActions(DataType)
Return an empty list of actions for unknown data types.
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:74
A single cube in the mosaic scene.
Manage a stack of content handlers for reading XML files.