Isis 3.0 Programmer Reference
Back | Home
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 
141  class MosaicSceneWidget : public QWidget {
142  Q_OBJECT
143 
144  public:
145  MosaicSceneWidget(QStatusBar *status,
146  bool showTools, bool internalizeToolBarsAndProgress,
147  Directory *directory, QWidget *parent = 0);
148  virtual ~MosaicSceneWidget();
149 
150  MosaicGraphicsView *getView() const {
151  return m_graphicsView;
152  }
153 
154  QGraphicsScene *getScene() const {
155  return m_graphicsScene;
156  }
157 
158  Projection *getProjection() const {
159  return m_projection;
160  }
161 
162  QList<MosaicSceneItem *> allMosaicSceneItems() {
163  return *m_mosaicSceneItems;
164  }
165 
166  void addTo(QMenu *menu);
167  void addTo(ToolPad *toolPad);
168  void addToPermanent(QToolBar *toolBar);
169  void addTo(QToolBar *toolBar);
170 
171  using QWidget::contextMenuEvent;
172  bool contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
173 
174  MosaicSceneItem *cubeToMosaic(Image *);
175 
176  bool cubesSelectable() const {
177  return m_cubesSelectable;
178  }
179 
180  void enableRubberBand(bool);
181  bool blockSelectionChange(bool);
182 
183  bool userHasTools() const {
184  return m_userToolControl;
185  }
186 
187  QProgressBar *getProgress();
188  PvlObject toPvl() const;
189  void fromPvl(const PvlObject &);
190  void load(XmlStackedHandlerReader *xmlReader);
191  void save(QXmlStreamWriter &stream, Project *project, FileName newProjectRoot) const;
192 
193 // QPointF currentLatLonPosition();
194  QRectF cubesBoundingRect() const;
195  QStringList cubeFileNames();
196  Directory *directory() const;
197 
198  ImageList images();
200 
201  QList<QAction *> getExportActions();
202  QList<QAction *> getViewActions();
204 
205  double moveDownOne(MosaicSceneItem *);
206  double moveDownOne(Image *);
207  QList<double> moveDownOne(ImageList *);
208 
209  double moveToBottom(MosaicSceneItem *);
210  double moveToBottom(Image *);
211  QList<double> moveToBottom(ImageList *);
212 
213  double moveUpOne(MosaicSceneItem *);
214  double moveUpOne(Image *);
215  QList<double> moveUpOne(ImageList *);
216 
217  double moveToTop(MosaicSceneItem *);
218  double moveToTop(Image *);
219  QList<double> moveToTop(ImageList *);
220 
221  double moveZ(MosaicSceneItem *sceneItem, double newZ, bool newZValueMightExist = true);
222  double moveZ(Image *image, double newZ, bool newZValueMightExist = true);
223 
227  template <typename DataType>
229  return QList<QAction *>();
230  }
231 
232  bool isControlNetToolActive();
233 
234  static QWidget *getControlNetHelp(QWidget *cnetToolContainer = NULL);
235  static QWidget *getGridHelp(QWidget *gridToolContainer = NULL);
236  static QWidget *getLongHelp(QWidget *mosaicSceneContainer = NULL);
237  static QWidget *getMapHelp(QWidget *mapContainer = NULL);
238  static QWidget *getPreviewHelp(QWidget *worldViewContainer = NULL);
239 
240  signals:
241  void mouseEnter();
242  void mouseMove(QPointF);
243  void mouseLeave();
244  void mouseDoubleClick(QPointF);
245  void mouseButtonPress(QPointF, Qt::MouseButton s);
246  void mouseButtonRelease(QPointF, Qt::MouseButton s);
247  void mouseWheel(QPointF, int delta);
248  void projectionChanged(Projection *);
249  void rubberBandComplete(QRectF r, Qt::MouseButton s);
250  void visibleRectChanged(QRectF);
251 
252  void cubesChanged();
253 
254  void queueSelectionChanged();
255 
256  void modifyControlPoint(ControlPoint *controlPoint);
257  void deleteControlPoint(ControlPoint *controlPoint);
258  void createControlPoint(double latitude, double longitude);
259 
260  void controlPointSelected(ControlPoint *);
261 
262  void controlPointChanged(QString pointId);
263  void controlPointAdded(QString pointId);
264 
265  void deleteControlPoint(QString pointId);
266  void controlPointDeleted();
267 
268  public slots:
269  void addImages(ImageList);
270  void removeImages(ImageList);
271  void refit();
272  void setCubesSelectable(bool);
273  void setProjection(Projection *);
274  void setOutlineRect(QRectF);
275 
276  private slots:
277  void exportView();
278  void saveList();
279 
280  void removeMosItem(QObject *);
281 
282  void moveDownOne();
283  void moveToBottom();
284  void moveUpOne();
285  void moveToTop();
286  void fitInView();
287 
288  void onSelectionChanged();
289  void onQueuedSelectionChanged();
290 
292  void quickConfigProjectionParameters();
293  void sendVisibleRectChanged();
294 
295  protected:
296  virtual bool eventFilter(QObject *obj, QEvent *ev);
297 
298  private:
299  void setProjection(const PvlGroup &mappingGroup, Pvl label=Pvl());
300  MosaicSceneItem *addImage(Image *image);
301  void reprojectItems();
302  double maximumZ();
303  double minimumZ();
304  void recalcSceneRect();
305 
307 
308  PvlGroup createInitialProjection(Image *cube);
309 
310  MosaicSceneItem *cubeToMosaic(DisplayProperties *props);
311 
312  static bool zOrderGreaterThan(MosaicSceneItem *first,
313  MosaicSceneItem *second);
314 
315  private:
321  class XmlHandler : public XmlStackedHandler {
322  public:
324  ~XmlHandler();
325 
326  virtual bool startElement(const QString &namespaceURI, const QString &localName,
327  const QString &qName, const QXmlAttributes &atts);
328  virtual bool characters(const QString &ch);
329  virtual bool endElement(const QString &namespaceURI, const QString &localName,
330  const QString &qName);
331 
332  private:
333  Q_DISABLE_COPY(XmlHandler);
334 
335  QString m_characterData;
336  MosaicSceneWidget *m_scene;
337 
338  int m_scrollBarXValue;
339  int m_scrollBarYValue;
340 
341  ImageList *m_imagesToAdd;
342  QList<double> m_imageZValues;
343  };
344 
345  private:
346  Directory *m_directory;
347 
348  bool m_cubesSelectable;
349  bool m_customRubberBandEnabled;
350  QRubberBand *m_customRubberBand;
351  QPoint *m_rubberBandOrigin;
355  QList<MosaicSceneItem *> *m_mosaicSceneItems;
356  QMap<DisplayProperties *, MosaicSceneItem *> m_displayPropsToMosaicSceneItemMap;
357  QGraphicsRectItem *m_outlineRect;
358 
359  QToolButton *m_mapButton;
360  QAction *m_quickMapAction;
361 
362  QList<MosaicTool *> *m_tools;
363 
364  ToolPad *m_toolpad;
365 
366  QToolBar *m_permToolbar;
367  QToolBar *m_activeToolbar;
368 
369  ProgressBar *m_progress;
370 
371  QHash<QString, double> *m_projectImageZOrders;
372 
373  bool m_blockingSelectionChanged;
374  bool m_userToolControl;
375  bool m_ownProjection;
376  bool m_queuedSelectionChanged;
377  bool m_shouldRequeueSelectionChanged;
378 
379  double m_currentMinimumFootprintZ;
380  double m_currentMaximumFootprintZ;
381 
382  PvlObject *m_projectViewTransform;
383  };
384 }
385 
386 #endif
387 
MosaicGraphicsView * m_graphicsView
The graphics view.
Internalizes a list of images and allows for operations on the entire list.
Definition: ImageList.h:44
The main project for cnetsuite.
Definition: Project.h:105
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:111
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 &quot;images&quot;.
Base class for Map Projections.
Definition: Projection.h:169
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:339
This represents a cube in a project-based GUI interface.
Definition: Image.h:91
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.
Projection * m_projection
The current projection type.
QList< QAction * > supportedActions(DataType)
Return an empty list of actions for unknown data types.
QProgressBar with customizable text.
Definition: ProgressBar.h:15
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:74
A single cube in the mosaic scene.
his enables stack-based XML parsing of XML files.

U.S. Department of the Interior | U.S. Geological Survey
ISIS | Privacy & Disclaimers | Astrogeology Research Program
To contact us, please post comments and questions on the ISIS Support Center
File Modified: 07/12/2023 23:24:05