ddt  1.0.0
ddtGraphicalElementLine.hpp
Go to the documentation of this file.
1 
19 #ifndef DDT_DATAVISUALISATION_DDTGRAPHCIS_GE_LINE_HPP
20 #define DDT_DATAVISUALISATION_DDTGRAPHCIS_GE_LINE_HPP
21 
22 #include <algorithm>
23 
24 #include "ddtGraphicalElement.hpp"
25 
30  public:
41  explicit DdtGraphicalElementLine(
43  const double x1_coord, const double y1_coord, const double x2_coord,
44  const double y2_coord, const QString obj_name = "",
45  const QString elem_name = "");
46 
51 
55  virtual void DrawElement(QPainter* painter) override;
56 
61  QRectF boundingRect() const override;
62 
67  int type() const override;
68 
69  protected:
73  double x1;
74 
78  double y1;
79 
83  double x2;
84 
88  double y2;
89 
90  private:
91  void hoverEnterEvent(QGraphicsSceneHoverEvent* const event) override;
92  void hoverLeaveEvent(QGraphicsSceneHoverEvent* const event) override;
93 
94  bool sceneEventFilter(QGraphicsItem* const watched,
95  QEvent* const event) override;
96 
97  void Initialize();
98  void SetCornerPositions() const;
99  void AdjustSize(const double x, const double y);
100 
101  double width;
102  double height;
103 
104  CornerGrabber* corners[2];
105 };
106 
107 #endif // DDT_DATAVISUALISATION_DDTGRAPHCIS_GE_LINE_HPP
108 
Definition: ddtCornergrabber.hpp:42
Definition: ddtGraphicalElementLine.hpp:29
QRectF boundingRect() const override
Definition: ddtGraphicalElementLine.cpp:49
double y1
Definition: ddtGraphicalElementLine.hpp:78
double y2
Definition: ddtGraphicalElementLine.hpp:88
double x2
Definition: ddtGraphicalElementLine.hpp:83
DdtGraphicalElementLine(DdtGraphicalElementProperties const &element_properties, const double x1_coord, const double y1_coord, const double x2_coord, const double y2_coord, const QString obj_name="", const QString elem_name="")
Definition: ddtGraphicalElementLine.cpp:21
virtual void DrawElement(QPainter *painter) override
Definition: ddtGraphicalElementLine.cpp:63
int type() const override
Definition: ddtGraphicalElementLine.cpp:55
virtual ~DdtGraphicalElementLine()
double x1
Definition: ddtGraphicalElementLine.hpp:73
Definition: ddtGraphicalElementProperties.hpp:29
Definition: ddtGraphicalElement.hpp:89
DdtGraphicalElementProperties element_properties
Definition: ddtGraphicalElement.hpp:257
DDT Graphics. Base Class for the DDT Graphical Elements. Elements can be lines, ovals,...