Engauge Digitizer 2
Loading...
Searching...
No Matches
GraphicsPoint.h
Go to the documentation of this file.
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
11#include <QColor>
12#include <QPointF>
13#include <QRectF>
14
15extern const double DEFAULT_HIGHLIGHT_OPACITY;
16extern const double MAX_OPACITY;
17
18class CurveStyle;
19class GeometryWindow;
22class PointStyle;
23class QColor;
24class QGraphicsScene;
25class QPolygonF;
26class QTextStream;
27class QVariant;
28
44{
45public:
47 GraphicsPoint(QGraphicsScene &scene,
48 const QString &identifier,
49 const QPointF &posScreen,
50 const QColor &color,
51 unsigned int radius,
52 double lineWidth,
54
56 GraphicsPoint(QGraphicsScene &scene,
57 const QString &identifier,
58 const QPointF &posScreen,
59 const QColor &color,
60 const QPolygonF &polygon,
61 double lineWidth,
63
66
68 QRectF boundingRect () const;
69
71 QVariant data (int key) const;
72
74 double highlightOpacity () const;
75
77 QPointF pos () const;
78
82 double ordinalKey) const;
83
85 void reset();
86
88 void setData (int key, const QVariant &data);
89
92
94 void setPointStyle (const PointStyle &pointStyle);
95
97 void setPos (const QPointF pos);
98
100 void setPassive ();
101
103 void setWanted ();
104
106 void updateCurveStyle (const CurveStyle &curveStyle);
107
109 bool wanted () const;
110
111private:
113
114 void createPointEllipse (unsigned int radius); // Attributes shared by circle and polygon points are passed through member variables
115 void createPointPolygon (const QPolygonF &polygon); // Attributes shared by circle and polygon points are passed through member variables
116
117 QGraphicsScene &m_scene;
118
119 // Ellipse graphics items. Unused if point is polygonal.
120 GraphicsPointEllipse *m_graphicsItemEllipse;
121 GraphicsPointEllipse *m_shadowZeroWidthEllipse; // Shadow item overlays the superclass instance to ensure visibility
122
123 // Polygon graphics items. Unused if point is elliptical.
124 GraphicsPointPolygon *m_graphicsItemPolygon;
125 GraphicsPointPolygon *m_shadowZeroWidthPolygon; // Shadow item overlays the superclass instance to ensure visibility
126
127 // Shared attributes
128 const QString m_identifier;
129 const QPointF m_posScreen;
130 const QColor m_color;
131 double m_lineWidth;
132
133 // Housekeeping
134 bool m_wanted;
135
136 double m_highlightOpacity;
137
138 GeometryWindow *m_geometryWindow; // Can receive hover signals. Null if unused
139};
140
141#endif // GRAPHICS_POINT_H
const int INNER_RADIUS_MIN
const double MAX_OPACITY
const double DEFAULT_HIGHLIGHT_OPACITY
Container for LineStyle and PointStyle for one Curve.
Definition CurveStyle.h:19
Window that displays the geometry information, as a table, for the current curve.
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 setPassive()
Prevent automatic focus on point (=make it passive) for scale bar so drags can be made to work proper...
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(...
~GraphicsPoint()
Destructor. This remove the graphics item from the scene.
QRectF boundingRect() const
Proxy method for QGraphicsItem::boundingRect.
void setHighlightOpacity(double highlightOpacity)
Set method for highlight opacity.
double highlightOpacity() const
Get method for highlight opacity.
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