#ifndef SYMBOL_H_
#define SYMBOL_H_
#include <qwt/qwt_symbol.h>
{
public:
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,
TestSymbol
};
public:
// How to write this Constructors?
CSymbol
( Style style
= NoSymbol
) : QwtSymbol(style
) {};
CSymbol
( Style style,
const QBrush &brush,
const QPen &pen,
const QSize &size
) CSymbol
( const CSymbol
&symbol
) : QwtSymbol(symbol
) {};
protected:
const QPointF *,
int numPoints
) const;
}; // SYMBOL_H_
#endif
#ifndef SYMBOL_H_
#define SYMBOL_H_
#include <qwt/qwt_symbol.h>
class CSymbol : public QwtSymbol
{
public:
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,
TestSymbol
};
public:
// How to write this Constructors?
CSymbol( Style style = NoSymbol ) : QwtSymbol(style) {};
CSymbol( Style style, const QBrush &brush, const QPen &pen, const QSize &size )
: QwtSymbol(style, brush, pen, size) {};
CSymbol( const CSymbol &symbol ) : QwtSymbol(symbol) {};
virtual ~CSymbol() {~QwtSymbol(); };
protected:
virtual void drawSymbols( QPainter *,
const QPointF *, int numPoints ) const;
}; // SYMBOL_H_
#endif
To copy to clipboard, switch view to plain text mode
void CSymbol
::drawSymbols( QPainter *painter,
const QPointF *points,
int numPoints
) const {
if ( numPoints <= 0 )
return;
painter->save();
// here is accessing QwtSymbol::d_data
switch ( d_data->style )
{
case CSymbol::Ellipse:
{
qwtDrawEllipseSymbols( painter, points, numPoints, *this );
break;
}
case CSymbol::Rect:
{
qwtDrawRectSymbols( painter, points, numPoints, *this );
break;
}
case CSymbol::Diamond:
{
qwtDrawDiamondSymbols( painter, points, numPoints, *this );
break;
}
case CSymbol::Cross:
{
qwtDrawLineSymbols( painter, Qt::Horizontal | Qt::Vertical,
points, numPoints, *this );
break;
}
case CSymbol::XCross:
{
qwtDrawXCrossSymbols( painter, points, numPoints, *this );
break;
}
case CSymbol::Triangle:
case CSymbol::UTriangle:
{
qwtDrawTriangleSymbols( painter, QwtTriangle::Up,
points, numPoints, *this );
break;
}
case CSymbol::DTriangle:
{
qwtDrawTriangleSymbols( painter, QwtTriangle::Down,
points, numPoints, *this );
break;
}
case CSymbol::RTriangle:
{
qwtDrawTriangleSymbols( painter, QwtTriangle::Right,
points, numPoints, *this );
break;
}
case CSymbol::LTriangle:
{
qwtDrawTriangleSymbols( painter, QwtTriangle::Left,
points, numPoints, *this );
break;
}
case CSymbol::HLine:
{
qwtDrawLineSymbols( painter, Qt::Horizontal,
points, numPoints, *this );
break;
}
case CSymbol::VLine:
{
qwtDrawLineSymbols( painter, Qt::Vertical,
points, numPoints, *this );
break;
}
case CSymbol::Star1:
{
qwtDrawStar1Symbols( painter, points, numPoints, *this );
break;
}
case CSymbol::Star2:
{
qwtDrawStar2Symbols( painter, points, numPoints, *this );
break;
}
case CSymbol::Hexagon:
{
qwtDrawHexagonSymbols( painter, points, numPoints, *this );
break;
}
case CSymbol::TestSymbol:
{
qwtDrawTestSymbols( painter, points, numPoints, *this );
break;
}
default:;
}
painter->restore();
}
void CSymbol::drawSymbols( QPainter *painter,
const QPointF *points, int numPoints ) const
{
if ( numPoints <= 0 )
return;
painter->save();
// here is accessing QwtSymbol::d_data
switch ( d_data->style )
{
case CSymbol::Ellipse:
{
qwtDrawEllipseSymbols( painter, points, numPoints, *this );
break;
}
case CSymbol::Rect:
{
qwtDrawRectSymbols( painter, points, numPoints, *this );
break;
}
case CSymbol::Diamond:
{
qwtDrawDiamondSymbols( painter, points, numPoints, *this );
break;
}
case CSymbol::Cross:
{
qwtDrawLineSymbols( painter, Qt::Horizontal | Qt::Vertical,
points, numPoints, *this );
break;
}
case CSymbol::XCross:
{
qwtDrawXCrossSymbols( painter, points, numPoints, *this );
break;
}
case CSymbol::Triangle:
case CSymbol::UTriangle:
{
qwtDrawTriangleSymbols( painter, QwtTriangle::Up,
points, numPoints, *this );
break;
}
case CSymbol::DTriangle:
{
qwtDrawTriangleSymbols( painter, QwtTriangle::Down,
points, numPoints, *this );
break;
}
case CSymbol::RTriangle:
{
qwtDrawTriangleSymbols( painter, QwtTriangle::Right,
points, numPoints, *this );
break;
}
case CSymbol::LTriangle:
{
qwtDrawTriangleSymbols( painter, QwtTriangle::Left,
points, numPoints, *this );
break;
}
case CSymbol::HLine:
{
qwtDrawLineSymbols( painter, Qt::Horizontal,
points, numPoints, *this );
break;
}
case CSymbol::VLine:
{
qwtDrawLineSymbols( painter, Qt::Vertical,
points, numPoints, *this );
break;
}
case CSymbol::Star1:
{
qwtDrawStar1Symbols( painter, points, numPoints, *this );
break;
}
case CSymbol::Star2:
{
qwtDrawStar2Symbols( painter, points, numPoints, *this );
break;
}
case CSymbol::Hexagon:
{
qwtDrawHexagonSymbols( painter, points, numPoints, *this );
break;
}
case CSymbol::TestSymbol:
{
qwtDrawTestSymbols( painter, points, numPoints, *this );
break;
}
default:;
}
painter->restore();
}
To copy to clipboard, switch view to plain text mode
Bookmarks