ddt  0.1
ddtGraphicsViewDraw.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 ddtGraphicsViewDraw.hpp
8 // @brief DDT Widgets. Helper class for the graphics display of the DDT Image
9 // Widget.
10 //
11 // Helper class for the Graphics View of the Image Widget.
12 //
13 // @author Christoph Bortlisz, CGI
14 // @since 2021/08/04
16 
17 #ifndef DATAVISUALISATION_WIDGETSDIALOGS_SRC_INCLUDE_DDT_WIDGETS_DDTGRAPHICSVIEWDRAW_HPP_
18 #define DATAVISUALISATION_WIDGETSDIALOGS_SRC_INCLUDE_DDT_WIDGETS_DDTGRAPHICSVIEWDRAW_HPP_
19 
20 #include <QtWidgets>
21 
29 
34  public:
39  DdtGraphicsViewDraw() = default;
40 
47  void DrawMeasurements(QPainter& painter, const QPointF start,
48  const QPointF end) const;
49 
53  void CreateRefLine(DdtGraphicalElementRefLine*& ref_line_element,
54  QGraphicsScene* const scene, const QPointF start,
55  const QPointF end) const;
56 
66  void DrawRefLine(DdtGraphicalElementRefLine*& ref_line_element,
67  QGraphicsScene* const scene, QPainter& painter,
68  const QPointF start, const QPointF end) const;
69 
74  QGraphicsScene* const scene, const double x1,
75  const double y1, const double x2,
76  const double y2) const;
77 
88  QGraphicsScene* const scene, QPainter& painter,
89  const QPointF start, const QPointF end) const;
90 
103  QGraphicsScene* const scene, QPainter& painter, const QPointF start,
104  const QPointF end, const QString draw_mode,
105  const DdtGraphicalElementProperties& overlay_properties,
106  const QString overlay_image_file) const;
107 
114  void SetConvertPixelToDegrees(const double convPixelDegrees);
115 
116  private:
120  double convert_pixel_to_degrees = 0.0;
121 
122  void DrawMeasurementLines(QPainter& painter, const QLineF& line,
123  const QLineF& line2, const QLineF& linex,
124  const QLineF& liney) const;
125  void DrawMeasurementText(QPainter& painter, const QRectF& measurement_rect,
126  const QRectF& textx_rect, const QRectF& texty_rect,
127  const QString measurement_text,
128  const QString x_offset_text,
129  const QString y_offset_text) const;
130  QString GetTextForMeasurementLine(const qreal length,
131  const bool draw_distance_in_degrees) const;
132  double GetPixelDistance(const QPointF start, const QPointF end,
133  double* const xoffset, double* const yoffset) const;
134  void GetMovementCorrectionValues(const QPainter& painter,
135  const bool draw_distance_in_degrees,
136  qreal* const movehorizontal,
137  qreal* const movevertical,
138  qreal* const rect_width,
139  qreal* const rect_height) const;
140  QRectF GetMeasurementRectangle(const QPainter& painter, const QLineF& line,
141  const QLineF& linex, const QLineF& liney,
142  const qreal movehorizontal,
143  const qreal movevertical,
144  const qreal rect_width,
145  const qreal rect_height) const;
146  QRectF GetLineXRectangle(const QPainter& painter, const QLineF& linex,
147  const QLineF& liney, const qreal movehorizontal,
148  const qreal movevertical, const qreal rect_width,
149  const qreal rect_height) const;
150  QRectF GetLineYRectangle(const QPainter& painter, const QLineF& linex,
151  const QLineF& liney, const qreal movehorizontal,
152  const qreal movevertical, const qreal rect_width,
153  const qreal rect_height) const;
154 
163  QString DegreesToString(double deg) const;
164 
178  QString ConstructDegreesString(const qreal length) const;
179 };
180 
181 #endif /* DATAVISUALISATION_WIDGETSDIALOGS_SRC_INCLUDE_DDT_WIDGETS_DDTGRAPHICSVIEWDRAW_HPP_ \
182  */
DdtGraphicsViewDraw::CreateRefLine
void CreateRefLine(DdtGraphicalElementRefLine *&ref_line_element, QGraphicsScene *const scene, const QPointF start, const QPointF end) const
Definition: ddtGraphicsViewDraw.cpp:127
DdtGraphicalElementStatRectangle
Definition: ddtGraphicalElementStatRectangle.hpp:25
ddtGraphicalElementStatRectangle.hpp
DdtGraphicalElementRefLine
Definition: ddtGraphicalElementRefLine.hpp:25
DdtGraphicsViewDraw::DrawMeasurements
void DrawMeasurements(QPainter &painter, const QPointF start, const QPointF end) const
Definition: ddtGraphicsViewDraw.cpp:182
DdtGraphicsViewDraw
Definition: ddtGraphicsViewDraw.hpp:33
ddtGraphicalElementProperties.hpp
DdtGraphicsViewDraw::SetConvertPixelToDegrees
void SetConvertPixelToDegrees(const double convPixelDegrees)
Definition: ddtGraphicsViewDraw.cpp:28
ddtGraphicalElementSlit.hpp
ddtGraphicsTextItem.hpp
DdtGraphicsViewDraw::DdtGraphicsViewDraw
DdtGraphicsViewDraw()=default
ddtOverlayRendering.hpp
ddtGraphicalElementImage.hpp
DdtGraphicsViewDraw::CreateStatisticRect
void CreateStatisticRect(DdtGraphicalElementStatRectangle *&statistic_rect, QGraphicsScene *const scene, const double x1, const double y1, const double x2, const double y2) const
Definition: ddtGraphicsViewDraw.cpp:109
ddtGraphicalElementRefLine.hpp
DdtGraphicsViewDraw::DrawRefLine
void DrawRefLine(DdtGraphicalElementRefLine *&ref_line_element, QGraphicsScene *const scene, QPainter &painter, const QPointF start, const QPointF end) const
Definition: ddtGraphicsViewDraw.cpp:168
DdtGraphicalElementProperties
Definition: ddtGraphicalElementProperties.hpp:27
DdtGraphicsViewDraw::DrawGraphicalElement
void DrawGraphicalElement(QGraphicsScene *const scene, QPainter &painter, const QPointF start, const QPointF end, const QString draw_mode, const DdtGraphicalElementProperties &overlay_properties, const QString overlay_image_file) const
Definition: ddtGraphicsViewDraw.cpp:34
DdtGraphicsViewDraw::DrawStatisticRectangle
void DrawStatisticRectangle(DdtGraphicalElementStatRectangle *&statistic_rect, QGraphicsScene *const scene, QPainter &painter, const QPointF start, const QPointF end) const
Definition: ddtGraphicsViewDraw.cpp:148