Engauge Digitizer  2
 All Classes Files Functions Variables Enumerations Enumerator Friends Pages
GraphicsPoint.h
1 /******************************************************************************************************
2  * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3  * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4  * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5  ******************************************************************************************************/
6 
7 #ifndef GRAPHICS_POINT_H
8 #define GRAPHICS_POINT_H
9 
10 #include "GraphicsPointAbstractBase.h"
11 #include "GraphicsPoint.h"
12 #include <QColor>
13 #include <QPointF>
14 
15 class CurveStyle;
18 class PointStyle;
19 class QColor;
20 class QGraphicsScene;
21 class QPolygonF;
22 class QTextStream;
23 class QVariant;
24 
40 {
41 public:
43  GraphicsPoint(QGraphicsScene &scene,
44  const QString &identifier,
45  const QPointF &posScreen,
46  const QColor &color,
47  unsigned int radius,
48  double lineWidth);
49 
51  GraphicsPoint(QGraphicsScene &scene,
52  const QString &identifier,
53  const QPointF &posScreen,
54  const QColor &color,
55  const QPolygonF &polygon,
56  double lineWidth);
57 
59  ~GraphicsPoint ();
60 
62  QVariant data (int key) const;
63 
65  QPointF pos () const;
66 
68  void printStream (QString indentation,
69  QTextStream &str,
70  double ordinalKey) const;
71 
73  void reset();
74 
76  void setData (int key, const QVariant &data);
77 
79  void setPointStyle (const PointStyle &pointStyle);
80 
82  void setPos (const QPointF pos);
83 
85  void setToolTip (const QString &toolTip);
86 
88  void setWanted ();
89 
91  void updateCurveStyle (const CurveStyle &curveStyle);
92 
94  bool wanted () const;
95 
96 private:
97  GraphicsPoint();
98 
99  void createPointEllipse (unsigned int radius); // Attributes shared by circle and polygon points are passed through member variables
100  void createPointPolygon (const QPolygonF &polygon); // Attributes shared by circle and polygon points are passed through member variables
101 
102  QGraphicsScene &m_scene;
103 
104  // Ellipse graphics items. Unused if point is polygonal.
105  GraphicsPointEllipse *m_graphicsItemEllipse;
106  GraphicsPointEllipse *m_shadowZeroWidthEllipse; // Shadow item overlays the superclass instance to ensure visibility
107 
108  // Polygon graphics items. Unused if point is elliptical.
109  GraphicsPointPolygon *m_graphicsItemPolygon;
110  GraphicsPointPolygon *m_shadowZeroWidthPolygon; // Shadow item overlays the superclass instance to ensure visibility
111 
112  // Shared attributes
113  const QString m_identifier;
114  const QPointF m_posScreen;
115  const QColor m_color;
116  double m_lineWidth;
117 
118  // Housekeeping
119  bool m_wanted;
120 };
121 
122 #endif // GRAPHICS_POINT_H
void setWanted()
Mark point as wanted. Marking as unwanted is done by the reset function.
void printStream(QString indentation, QTextStream &str, double ordinalKey) const
Debugging method that supports print method of this class and printStream method of some other class(...
Base class for adding identifiers to graphics items that represent Points.
void setData(int key, const QVariant &data)
Proxy method for QGraphicsItem::setData.
void setPos(const QPointF pos)
Update the position.
bool wanted() const
Identify point as wanted//unwanted.
void setPointStyle(const PointStyle &pointStyle)
Update the point style.
void updateCurveStyle(const CurveStyle &curveStyle)
Update point and line styles that comprise the curve style.
This class add event handling to QGraphicsEllipseItem.
Details for a specific Point.
Definition: PointStyle.h:20
~GraphicsPoint()
Destructor. This remove the graphics item from the scene.
Container for LineStyle and PointStyle for one Curve.
Definition: CurveStyle.h:18
Graphics item for drawing a circular or polygonal Point.
Definition: GraphicsPoint.h:39
This class add event handling to QGraphicsPolygonItem.
QPointF pos() const
Proxy method for QGraphicsItem::pos.
QVariant data(int key) const
Proxy method for QGraphicsItem::data.
void setToolTip(const QString &toolTip)
Proxy method for QGraphicsItem::setToolTip.
void reset()
Mark point as unwanted, and unbind any bound lines.