Engauge Digitizer 2
Loading...
Searching...
No Matches
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
15class CurveStyle;
18class PointStyle;
19class QColor;
20class QGraphicsScene;
21class QPolygonF;
22class QTextStream;
23class QVariant;
24
40{
41public:
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
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
96private:
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
Container for LineStyle and PointStyle for one Curve.
Definition CurveStyle.h:19
Base class for adding identifiers to graphics items that represent Points.
This class add event handling to QGraphicsEllipseItem.
This class add event handling to QGraphicsPolygonItem.
Graphics item for drawing a circular or polygonal Point.
QPointF pos() const
Proxy method for QGraphicsItem::pos.
void setWanted()
Mark point as wanted. Marking as unwanted is done by the reset function.
void setData(int key, const QVariant &data)
Proxy method for QGraphicsItem::setData.
void setPointStyle(const PointStyle &pointStyle)
Update the point style.
void updateCurveStyle(const CurveStyle &curveStyle)
Update point and line styles that comprise the curve style.
void reset()
Mark point as unwanted, and unbind any bound lines.
bool wanted() const
Identify point as wanted//unwanted.
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(...
void setToolTip(const QString &toolTip)
Proxy method for QGraphicsItem::setToolTip.
~GraphicsPoint()
Destructor. This remove the graphics item from the scene.
void setPos(const QPointF pos)
Update the position.
QVariant data(int key) const
Proxy method for QGraphicsItem::data.
Details for a specific Point.
Definition PointStyle.h:21