source: ntrip/trunk/GnssCenter/qwt/qwt_symbol.h@ 7417

Last change on this file since 7417 was 4839, checked in by mervart, 12 years ago
File size: 3.2 KB
Line 
1/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *****************************************************************************/
9
10#ifndef QWT_SYMBOL_H
11#define QWT_SYMBOL_H
12
13#include "qwt_global.h"
14#include <QPolygonF>
15
16class QPainter;
17class QRect;
18class QSize;
19class QBrush;
20class QPen;
21class QColor;
22class QPointF;
23
24//! A class for drawing symbols
25class QWT_EXPORT QwtSymbol
26{
27public:
28 /*!
29 Symbol Style
30 \sa setStyle(), style()
31 */
32 enum Style
33 {
34 //! No Style. The symbol cannot be drawn.
35 NoSymbol = -1,
36
37 //! Ellipse or circle
38 Ellipse,
39
40 //! Rectangle
41 Rect,
42
43 //! Diamond
44 Diamond,
45
46 //! Triangle pointing upwards
47 Triangle,
48
49 //! Triangle pointing downwards
50 DTriangle,
51
52 //! Triangle pointing upwards
53 UTriangle,
54
55 //! Triangle pointing left
56 LTriangle,
57
58 //! Triangle pointing right
59 RTriangle,
60
61 //! Cross (+)
62 Cross,
63
64 //! Diagonal cross (X)
65 XCross,
66
67 //! Horizontal line
68 HLine,
69
70 //! Vertical line
71 VLine,
72
73 //! X combined with +
74 Star1,
75
76 //! Six-pointed star
77 Star2,
78
79 //! Hexagon
80 Hexagon,
81
82 /*!
83 Styles >= QwtSymbol::UserSymbol are reserved for derived
84 classes of QwtSymbol that overload drawSymbols() with
85 additional application specific symbol types.
86 */
87 UserStyle = 1000
88 };
89
90public:
91 QwtSymbol( Style = NoSymbol );
92 QwtSymbol( Style, const QBrush &, const QPen &, const QSize & );
93 QwtSymbol( const QwtSymbol & );
94 virtual ~QwtSymbol();
95
96 QwtSymbol &operator=( const QwtSymbol & );
97 bool operator==( const QwtSymbol & ) const;
98 bool operator!=( const QwtSymbol & ) const;
99
100 void setSize( const QSize & );
101 void setSize( int width, int height = -1 );
102 const QSize& size() const;
103
104 virtual void setColor( const QColor & );
105
106 void setBrush( const QBrush& b );
107 const QBrush& brush() const;
108
109 void setPen( const QPen & );
110 const QPen& pen() const;
111
112 void setStyle( Style );
113 Style style() const;
114
115 void drawSymbol( QPainter *, const QPointF & ) const;
116 void drawSymbols( QPainter *, const QPolygonF & ) const;
117
118 virtual QSize boundingSize() const;
119
120protected:
121 virtual void drawSymbols( QPainter *,
122 const QPointF *, int numPoints ) const;
123
124private:
125 class PrivateData;
126 PrivateData *d_data;
127};
128
129/*!
130 \brief Draw the symbol at a specified position
131
132 \param painter Painter
133 \param pos Position of the symbol in screen coordinates
134*/
135inline void QwtSymbol::drawSymbol(
136 QPainter *painter, const QPointF &pos ) const
137{
138 drawSymbols( painter, &pos, 1 );
139}
140
141/*!
142 \brief Draw symbols at the specified points
143
144 \param painter Painter
145 \param points Positions of the symbols in screen coordinates
146*/
147
148inline void QwtSymbol::drawSymbols(
149 QPainter *painter, const QPolygonF &points ) const
150{
151 drawSymbols( painter, points.data(), points.size() );
152}
153
154#endif
Note: See TracBrowser for help on using the repository browser.