QWT 7.0.1
Loading...
Searching...
No Matches
qwt_symbol.h
1/******************************************************************************
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 * Modified by ChenZongYan in 2024 <czy.t@163.com>
10 * Summary of major modifications (see ChangeLog.md for full history):
11 * 1. CMake build system & C++11 throughout.
12 * 2. Core panner/ zoomer refactored:
13 * - QwtPanner → QwtCachePanner (pixmap-cache version)
14 * - New real-time QwtPlotPanner derived from QwtPicker.
15 * 3. Zoomer supports multi-axis.
16 * 4. Parasite-plot framework:
17 * - QwtFigure, QwtPlotParasiteLayout, QwtPlotTransparentCanvas,
18 * - QwtPlotScaleEventDispatcher, built-in pan/zoom on axis.
19 * 5. New picker: QwtPlotSeriesDataPicker (works with date axis).
20 * 6. Raster & color-map extensions:
21 * - QwtGridRasterData (2-D table + interpolation)
22 * - QwtLinearColorMap::stopColors(), stopPos() API rename.
23 * 7. Bar-chart: expose pen/brush control.
24 * 8. Amalgamated build: single QwtPlot.h / QwtPlot.cpp pair in src-amalgamate.
25 *****************************************************************************/
26
27#ifndef QWT_SYMBOL_H
28#define QWT_SYMBOL_H
29
30#include "qwt_global.h"
31
32#include <qpolygon.h>
33#include <qpen.h>
34#include <qbrush.h>
35
36class QPainter;
37class QSize;
38class QBrush;
39class QPen;
40class QColor;
41class QPointF;
42class QPainterPath;
43class QPixmap;
44class QByteArray;
45class QwtGraphic;
46
48class QWT_EXPORT QwtSymbol
49{
50 public:
55 enum Style
56 {
58 NoSymbol = -1,
59
62
65
68
71
74
77
80
83
86
89
92
95
98
101
104
113
121
129
137
143 UserStyle = 1000
144 };
145
168 {
171
174
181 AutoCache
182 };
183
184 public:
185 explicit QwtSymbol( Style = NoSymbol );
186 QwtSymbol( Style, const QBrush&, const QPen&, const QSize& );
187 QwtSymbol( const QPainterPath&, const QBrush&, const QPen& );
188
189 virtual ~QwtSymbol();
190
191 void setCachePolicy( CachePolicy );
192 CachePolicy cachePolicy() const;
193
194 void setSize( const QSize& );
195 void setSize( int width, int height = -1 );
196 const QSize& size() const;
197
198 void setPinPoint( const QPointF& pos, bool enable = true );
199 QPointF pinPoint() const;
200
201 void setPinPointEnabled( bool );
202 bool isPinPointEnabled() const;
203
204 virtual void setColor( const QColor& );
205
206 void setBrush( const QBrush& );
207 const QBrush& brush() const;
208
209 void setPen( const QColor&, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
210 void setPen( const QPen& );
211 const QPen& pen() const;
212
213 void setStyle( Style );
214 Style style() const;
215
216 void setPath( const QPainterPath& );
217 const QPainterPath& path() const;
218
219 void setPixmap( const QPixmap& );
220 const QPixmap& pixmap() const;
221
222 void setGraphic( const QwtGraphic& );
223 const QwtGraphic& graphic() const;
224
225#ifndef QWT_NO_SVG
226 void setSvgDocument( const QByteArray& );
227#endif
228
229 void drawSymbol( QPainter*, const QRectF& ) const;
230 void drawSymbol( QPainter*, const QPointF& ) const;
231 void drawSymbols( QPainter*, const QPolygonF& ) const;
232 void drawSymbols( QPainter*,
233 const QPointF*, int numPoints ) const;
234
235 virtual QRect boundingRect() const;
236 void invalidateCache();
237
238 protected:
239 virtual void renderSymbols( QPainter*,
240 const QPointF*, int numPoints ) const;
241
242 private:
243 Q_DISABLE_COPY(QwtSymbol)
244
245 class PrivateData;
246 PrivateData* m_data;
247};
248
256 QPainter* painter, const QPointF& pos ) const
257{
258 drawSymbols( painter, &pos, 1 );
259}
260
269 QPainter* painter, const QPolygonF& points ) const
270{
271 drawSymbols( painter, points.data(), points.size() );
272}
273
274#endif
A paint device for scalable graphics.
Definition qwt_graphic.h:93
A class for drawing symbols.
Definition qwt_symbol.h:49
void drawSymbol(QPainter *, const QRectF &) const
Draw the symbol into a rectangle.
Definition qwt_symbol.cpp:1451
void drawSymbols(QPainter *, const QPolygonF &) const
Draw symbols at the specified points.
Definition qwt_symbol.h:268
Style
Symbol Style.
Definition qwt_symbol.h:56
@ VLine
Vertical line.
Definition qwt_symbol.h:94
@ Ellipse
Ellipse or circle.
Definition qwt_symbol.h:61
@ LTriangle
Triangle pointing left.
Definition qwt_symbol.h:79
@ Star1
X combined with +.
Definition qwt_symbol.h:97
@ HLine
Horizontal line.
Definition qwt_symbol.h:91
@ Rect
Rectangle.
Definition qwt_symbol.h:64
@ Pixmap
The symbol is represented by a pixmap.
Definition qwt_symbol.h:120
@ Triangle
Triangle pointing upwards.
Definition qwt_symbol.h:70
@ SvgDocument
The symbol is represented by a SVG graphic.
Definition qwt_symbol.h:136
@ Hexagon
Hexagon.
Definition qwt_symbol.h:103
@ Diamond
Diamond.
Definition qwt_symbol.h:67
@ Graphic
The symbol is represented by a graphic.
Definition qwt_symbol.h:128
@ Path
The symbol is represented by a painter path, where the origin ( 0, 0 ) of the path coordinate system ...
Definition qwt_symbol.h:112
@ XCross
Diagonal cross (X)
Definition qwt_symbol.h:88
@ Cross
Cross (+)
Definition qwt_symbol.h:85
@ UTriangle
Triangle pointing upwards.
Definition qwt_symbol.h:76
@ DTriangle
Triangle pointing downwards.
Definition qwt_symbol.h:73
@ RTriangle
Triangle pointing right.
Definition qwt_symbol.h:82
@ Star2
Six-pointed star.
Definition qwt_symbol.h:100
CachePolicy
Depending on the render engine and the complexity of the symbol shape it might be faster to render th...
Definition qwt_symbol.h:168
@ NoCache
Don't use a pixmap cache.
Definition qwt_symbol.h:170
@ Cache
Always use a pixmap cache.
Definition qwt_symbol.h:173