Loading...
Searching...
No Matches
qwt_symbol.h
/******************************************************************************
* 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>
#include <qpen.h>
#include <qbrush.h>
class QPainter;
class QSize;
class QBrush;
class QPen;
class QColor;
class QPointF;
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:
explicit 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:
Q_DISABLE_COPY(QwtSymbol)
class PrivateData;
PrivateData* m_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
QwtGraphic
A paint device for scalable graphics.
Definition qwt_graphic.h:76
QwtSymbol
A class for drawing symbols.
Definition qwt_symbol.h:32
QwtSymbol::drawSymbol
void drawSymbol(QPainter *, const QRectF &) const
Draw the symbol into a rectangle.
Definition qwt_symbol.cpp:1434
QwtSymbol::drawSymbols
void drawSymbols(QPainter *, const QPolygonF &) const
Draw symbols at the specified points.
Definition qwt_symbol.h:251
QwtSymbol::Style
Style
Definition qwt_symbol.h:39
QwtSymbol::VLine
@ VLine
Vertical line.
Definition qwt_symbol.h:77
QwtSymbol::Ellipse
@ Ellipse
Ellipse or circle.
Definition qwt_symbol.h:44
QwtSymbol::LTriangle
@ LTriangle
Triangle pointing left.
Definition qwt_symbol.h:62
QwtSymbol::Star1
@ Star1
X combined with +.
Definition qwt_symbol.h:80
QwtSymbol::HLine
@ HLine
Horizontal line.
Definition qwt_symbol.h:74
QwtSymbol::Rect
@ Rect
Rectangle.
Definition qwt_symbol.h:47
QwtSymbol::Pixmap
@ Pixmap
Definition qwt_symbol.h:103
QwtSymbol::Triangle
@ Triangle
Triangle pointing upwards.
Definition qwt_symbol.h:53
QwtSymbol::SvgDocument
@ SvgDocument
Definition qwt_symbol.h:119
QwtSymbol::Hexagon
@ Hexagon
Hexagon.
Definition qwt_symbol.h:86
QwtSymbol::Diamond
@ Diamond
Diamond.
Definition qwt_symbol.h:50
QwtSymbol::Graphic
@ Graphic
Definition qwt_symbol.h:111
QwtSymbol::Path
@ Path
Definition qwt_symbol.h:95
QwtSymbol::XCross
@ XCross
Diagonal cross (X)
Definition qwt_symbol.h:71
QwtSymbol::Cross
@ Cross
Cross (+)
Definition qwt_symbol.h:68
QwtSymbol::UTriangle
@ UTriangle
Triangle pointing upwards.
Definition qwt_symbol.h:59
QwtSymbol::DTriangle
@ DTriangle
Triangle pointing downwards.
Definition qwt_symbol.h:56
QwtSymbol::RTriangle
@ RTriangle
Triangle pointing right.
Definition qwt_symbol.h:65
QwtSymbol::Star2
@ Star2
Six-pointed star.
Definition qwt_symbol.h:83
QwtSymbol::CachePolicy
CachePolicy
Definition qwt_symbol.h:151
QwtSymbol::NoCache
@ NoCache
Don't use a pixmap cache.
Definition qwt_symbol.h:153
QwtSymbol::Cache
@ Cache
Always use a pixmap cache.
Definition qwt_symbol.h:156