-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathqwt_symbol.h
141 lines (106 loc) · 2.93 KB
/
qwt_symbol.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#pragma once
#include <QPolygonF>
class QPainter;
class QRect;
class QSize;
class QBrush;
class QPen;
class QColor;
class QPointF;
//! A class for drawing symbols
class QwtSymbol
{
public:
/*!
Symbol Style
\sa setStyle(), style()
*/
enum Style
{
//! No Style. The symbol cannot be drawn.
NoSymbol = -1,
//! Ellipse or circle
Ellipse,
//! Rectangle
Rect,
//! Diamond
Diamond,
//! Triangle pointing upwards
Triangle,
//! Triangle pointing downwards
DTriangle,
//! Triangle pointing upwards
UTriangle,
//! Triangle pointing left
LTriangle,
//! Triangle pointing right
RTriangle,
//! Cross (+)
Cross,
//! Diagonal cross (X)
XCross,
//! Horizontal line
HLine,
//! Vertical line
VLine,
//! X combined with +
Star1,
//! Six-pointed star
Star2,
//! Hexagon
Hexagon,
/*!
Styles >= QwtSymbol::UserSymbol are reserved for derived
classes of QwtSymbol that overload drawSymbols() with
additional application specific symbol types.
*/
UserStyle = 1000
};
public:
QwtSymbol( Style = NoSymbol );
QwtSymbol( Style, const QBrush &, const QPen &, const QSize & );
QwtSymbol( const QwtSymbol & );
virtual ~QwtSymbol();
QwtSymbol &operator=( const QwtSymbol & );
bool operator==( const QwtSymbol & ) const;
bool operator!=( const QwtSymbol & ) const;
void setSize( const QSize & );
void setSize( int width, int height = -1 );
const QSize& size() const;
virtual void setColor( const QColor & );
void setBrush( const QBrush& b );
const QBrush& brush() const;
void setPen( const QPen & );
const QPen& pen() const;
void setStyle( Style );
Style style() const;
void drawSymbol( QPainter *, const QPointF & ) const;
void drawSymbols( QPainter *, const QPolygonF & ) const;
virtual QSize boundingSize() const;
protected:
virtual void drawSymbols( QPainter *,
const QPointF *, int numPoints ) const;
private:
class PrivateData;
PrivateData *d_data;
};
/*!
\brief Draw the symbol at a specified position
\param painter Painter
\param pos Position of the symbol in screen coordinates
*/
inline void QwtSymbol::drawSymbol(
QPainter *painter, const QPointF &pos ) const
{
drawSymbols( painter, &pos, 1 );
}
/*!
\brief Draw symbols at the specified points
\param painter Painter
\param points Positions of the symbols in screen coordinates
*/
inline void QwtSymbol::drawSymbols(
QPainter *painter, const QPolygonF &points ) const
{
drawSymbols( painter, points.data(), points.size() );
}