qwt_symbol.h
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_SYMBOL_H
#define QWT_SYMBOL_H
#include "qwt_global.h"
#include <qpolygon.h>
class QPainter;
class QRect;
class QSize;
class QBrush;
class QPen;
class QColor;
class QPointF;
class QPolygonF;
class QPainterPath;
class QPixmap;
class QByteArray;
class QwtGraphic;
class QWT_EXPORT QwtSymbol
{
public:
enum Style
{
NoSymbol = -1,
Ellipse,
Rect,
Diamond,
Triangle,
DTriangle,
UTriangle,
LTriangle,
RTriangle,
Cross,
XCross,
HLine,
VLine,
Star1,
Star2,
Hexagon,
Path,
Pixmap,
Graphic,
SvgDocument,
UserStyle = 1000
};
enum CachePolicy
{
NoCache,
Cache,
AutoCache
};
public:
QwtSymbol( Style = NoSymbol );
QwtSymbol( Style, const QBrush &, const QPen &, const QSize & );
QwtSymbol( const QPainterPath &, const QBrush &, const QPen & );
virtual ~QwtSymbol();
void setCachePolicy( CachePolicy );
CachePolicy cachePolicy() const;
void setSize( const QSize & );
void setSize( int width, int height = -1 );
const QSize &size() const;
void setPinPoint( const QPointF &pos, bool enable = true );
QPointF pinPoint() const;
void setPinPointEnabled( bool );
bool isPinPointEnabled() const;
virtual void setColor( const QColor & );
void setBrush( const QBrush & );
const QBrush &brush() const;
void setPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
void setPen( const QPen & );
const QPen &pen() const;
void setStyle( Style );
Style style() const;
void setPath( const QPainterPath & );
const QPainterPath &path() const;
void setPixmap( const QPixmap & );
const QPixmap &pixmap() const;
void setGraphic( const QwtGraphic & );
const QwtGraphic &graphic() const;
#ifndef QWT_NO_SVG
void setSvgDocument( const QByteArray & );
#endif
void drawSymbol( QPainter *, const QRectF & ) const;
void drawSymbol( QPainter *, const QPointF & ) const;
void drawSymbols( QPainter *, const QPolygonF & ) const;
void drawSymbols( QPainter *,
const QPointF *, int numPoints ) const;
virtual QRect boundingRect() const;
void invalidateCache();
protected:
virtual void renderSymbols( QPainter *,
const QPointF *, int numPoints ) const;
private:
// Disabled copy constructor and operator=
QwtSymbol( const QwtSymbol & );
QwtSymbol &operator=( const QwtSymbol & );
class PrivateData;
PrivateData *d_data;
};
inline void QwtSymbol::drawSymbol(
QPainter *painter, const QPointF &pos ) const
{
drawSymbols( painter, &pos, 1 );
}
inline void QwtSymbol::drawSymbols(
QPainter *painter, const QPolygonF &points ) const
{
drawSymbols( painter, points.data(), points.size() );
}
#endif
QwtSymbol::Path
@ Path
Definition: qwt_symbol.h:94
QwtSymbol::Hexagon
@ Hexagon
Hexagon.
Definition: qwt_symbol.h:85
QwtSymbol::LTriangle
@ LTriangle
Triangle pointing left.
Definition: qwt_symbol.h:61
QwtSymbol::HLine
@ HLine
Horizontal line.
Definition: qwt_symbol.h:73
QwtSymbol::XCross
@ XCross
Diagonal cross (X)
Definition: qwt_symbol.h:70
QwtSymbol::Rect
@ Rect
Rectangle.
Definition: qwt_symbol.h:46
QwtSymbol::VLine
@ VLine
Vertical line.
Definition: qwt_symbol.h:76
QwtSymbol::SvgDocument
@ SvgDocument
Definition: qwt_symbol.h:118
QwtSymbol::Cross
@ Cross
Cross (+)
Definition: qwt_symbol.h:67
QwtSymbol::drawSymbols
void drawSymbols(QPainter *, const QPolygonF &) const
Draw symbols at the specified points.
Definition: qwt_symbol.h:252
QwtSymbol::Triangle
@ Triangle
Triangle pointing upwards.
Definition: qwt_symbol.h:52
QwtSymbol::drawSymbol
void drawSymbol(QPainter *, const QRectF &) const
Draw the symbol into a rectangle.
Definition: qwt_symbol.cpp:1406
QwtSymbol::NoCache
@ NoCache
Don't use a pixmap cache.
Definition: qwt_symbol.h:152
QwtSymbol::Ellipse
@ Ellipse
Ellipse or circle.
Definition: qwt_symbol.h:43
QwtSymbol::CachePolicy
CachePolicy
Definition: qwt_symbol.h:150
QwtGraphic
A paint device for scalable graphics.
Definition: qwt_graphic.h:75
QwtSymbol::UTriangle
@ UTriangle
Triangle pointing upwards.
Definition: qwt_symbol.h:58
QwtSymbol::Graphic
@ Graphic
Definition: qwt_symbol.h:110
QwtSymbol::Star2
@ Star2
Six-pointed star.
Definition: qwt_symbol.h:82
QwtSymbol
A class for drawing symbols.
Definition: qwt_symbol.h:31
QwtSymbol::DTriangle
@ DTriangle
Triangle pointing downwards.
Definition: qwt_symbol.h:55
QwtSymbol::RTriangle
@ RTriangle
Triangle pointing right.
Definition: qwt_symbol.h:64
QwtSymbol::Style
Style
Definition: qwt_symbol.h:38
QwtSymbol::Cache
@ Cache
Always use a pixmap cache.
Definition: qwt_symbol.h:155
QwtSymbol::Pixmap
@ Pixmap
Definition: qwt_symbol.h:102
QwtSymbol::Diamond
@ Diamond
Diamond.
Definition: qwt_symbol.h:49
QwtSymbol::Star1
@ Star1
X combined with +.
Definition: qwt_symbol.h:79