ddt  0.1
ddtPanningWidget.hpp
Go to the documentation of this file.
1 // @copyright
2 // (c) Copyright ESO 2020
3 // All Rights Reserved
4 // ESO (eso.org) is an Intergovernmental Organization, and therefore special
5 // legal conditions apply.
6 //
7 // @file ddtPanningWidget.hpp
8 // @brief DDT Widgets. Class for the DDT Panning Widget.
9 //
10 // Class for the Panning Widget. The widget is used to display a thumbnail image
11 // of the image displayed in the connected Image Widget and allow to move a pan
12 // rectangle to select the current view.
13 //
14 // @author Carsten Mannel, CGI
15 // @since 2020/02/05
16 //
17 
18 #ifndef DDT_DATAVISUALISATION_DDTWIDGETS_PANNINGWIDGET_HPP
19 #define DDT_DATAVISUALISATION_DDTWIDGETS_PANNINGWIDGET_HPP
20 
21 #include <QtUiPlugin/QDesignerExportWidget>
22 
24 
29 class QDESIGNER_WIDGET_EXPORT DdtPanningWidget : public DdtWidget {
30  Q_OBJECT
31  Q_PROPERTY(bool ShowAxes READ get_show_axes WRITE set_show_axes)
32 
33  public:
38  explicit DdtPanningWidget(QWidget* parent = nullptr);
39 
44 
50  void set_show_axes(const bool show);
51 
56  bool get_show_axes() const;
57 
62  void set_rotation_deg(const float rotation);
63 
69  float get_rotation_deg() const;
70 
71  protected:
75  bool show_axes;
76 
84  int show_status = 1;
85 
89  float rotation_deg;
90 
94  float zoom_factor;
95 
100 
106 
111 
116 
121 
126  int origin_x;
127 
132  int origin_y;
133 
137  QRubberBand* rubberband;
138 
145  bool eventFilter(QObject* obj, QEvent* event);
146 
147  private:
148  void CreateWidget();
149 
150  void OnMouseMoveEvent(QMouseEvent* m);
151  void OnMousePressEvent(QMouseEvent* m);
152  void OnMouseReleaseEvent(QMouseEvent* m);
153 
154  void UpdateSelectionRectangle(const bool externally_triggered = false);
155  void ValidateSelectionRectangle();
156 
157  int PanWindowWidth() const;
158  int PanWindowHeight() const;
159 
160  void DrawImage();
161 
162  QTransform image_transform;
163 
164  int start_drag_x;
165  int start_drag_y;
166 
167  const int SHOW_NONE = 0;
168  const int SHOW_COMPASS_AND_XY = 1;
169  const int SHOW_COMPASS_ONLY = 2;
170  const int SHOW_XY_ONLY = 3;
171  const int SHOW_MAX = 4;
172 
173  signals:
181  void UpdatePosition(double scroll_fraction_x, double scroll_fraction_y);
182 
183  public slots:
184  // Image Widget interface
192  void SetImage(const QImage* const image, const QTransform& transform,
193  const bool show, const double rotation);
194 
203  void ImageWidgetViewChanged(const QRectF& visible_image_rect,
204  const int current_image_width,
205  const int current_image_height);
206 };
207 
208 #endif // DDT_DATAVISUALISATION_DDTWIDGETS_PANNINGWIDGET_HPP
DdtPanningWidget
Definition: ddtPanningWidget.hpp:29
DdtPanningWidget::preview_image_label
QLabel * preview_image_label
Definition: ddtPanningWidget.hpp:105
DdtPanningWidget::rotation_deg
float rotation_deg
Definition: ddtPanningWidget.hpp:89
DdtPanningWidget::show_axes
bool show_axes
Definition: ddtPanningWidget.hpp:75
DdtPanningWidget::origin_x
int origin_x
Definition: ddtPanningWidget.hpp:126
DdtPanningWidget::selection_rectangle
QRect selection_rectangle
Definition: ddtPanningWidget.hpp:115
DdtWidget
The DdtWidget class Use as wrapper class for new widgets.
Definition: ddtWidget.hpp:23
DdtPanningWidget::zoom_factor
float zoom_factor
Definition: ddtPanningWidget.hpp:94
DdtPanningWidget::origin_y
int origin_y
Definition: ddtPanningWidget.hpp:132
DdtPanningWidget::preview_image
QImage preview_image
Definition: ddtPanningWidget.hpp:110
DdtPanningWidget::~DdtPanningWidget
~DdtPanningWidget()
DdtPanningWidget::mouse_drag_active
bool mouse_drag_active
Definition: ddtPanningWidget.hpp:99
DdtPanningWidget::rubberband
QRubberBand * rubberband
Definition: ddtPanningWidget.hpp:137
DdtPanningWidget::max_selection_rectangle
QRect max_selection_rectangle
Definition: ddtPanningWidget.hpp:120
DdtPanningWidget::UpdatePosition
void UpdatePosition(double scroll_fraction_x, double scroll_fraction_y)
ddtWidget.hpp