/*! Render the symbol to series of points \param painter Qt painter \param points Positions of the symbols \param numPoints Number of points */ void QwtSymbol::renderSymbols( QPainter *painter, const QPointF *points, int numPoints ) const { switch ( d_data->style ) { case QwtSymbol::Ellipse: { qwtDrawEllipseSymbols( painter, points, numPoints, *this ); break; } case QwtSymbol::Rect: { qwtDrawRectSymbols( painter, points, numPoints, *this ); break; } case QwtSymbol::Diamond: { qwtDrawDiamondSymbols( painter, points, numPoints, *this ); break; } case QwtSymbol::Cross: { qwtDrawLineSymbols( painter, Qt::Horizontal | Qt::Vertical, points, numPoints, *this ); break; } case QwtSymbol::XCross: { qwtDrawXCrossSymbols( painter, points, numPoints, *this ); break; } case QwtSymbol::Triangle: case QwtSymbol::UTriangle: { qwtDrawTriangleSymbols( painter, QwtTriangle::Up, points, numPoints, *this ); break; } case QwtSymbol::DTriangle: { qwtDrawTriangleSymbols( painter, QwtTriangle::Down, points, numPoints, *this ); break; } case QwtSymbol::RTriangle: { qwtDrawTriangleSymbols( painter, QwtTriangle::Right, points, numPoints, *this ); break; } case QwtSymbol::LTriangle: { qwtDrawTriangleSymbols( painter, QwtTriangle::Left, points, numPoints, *this ); break; } case QwtSymbol::HLine: { qwtDrawLineSymbols( painter, Qt::Horizontal, points, numPoints, *this ); break; } case QwtSymbol::VLine: { qwtDrawLineSymbols( painter, Qt::Vertical, points, numPoints, *this ); break; } case QwtSymbol::Star1: { qwtDrawStar1Symbols( painter, points, numPoints, *this ); break; } case QwtSymbol::Star2: { qwtDrawStar2Symbols( painter, points, numPoints, *this ); break; } case QwtSymbol::Hexagon: { qwtDrawHexagonSymbols( painter, points, numPoints, *this ); break; } case QwtSymbol::Path: { if ( d_data->path.graphic.isNull() ) { d_data->path.graphic = qwtPathGraphic( d_data->path.path, d_data->pen, d_data->brush ); } qwtDrawGraphicSymbols( painter, points, numPoints, d_data->path.graphic, *this ); break; } case QwtSymbol::Pixmap: { qwtDrawPixmapSymbols( painter, points, numPoints, *this ); break; } case QwtSymbol::Graphic: { qwtDrawGraphicSymbols( painter, points, numPoints, d_data->graphic.graphic, *this ); break; } case QwtSymbol::SvgDocument: { #ifndef QWT_NO_SVG qwtDrawSvgSymbols( painter, points, numPoints, d_data->svg.renderer, *this ); #endif break; } default:; } }
/*! Draw an array of symbols Painting several symbols is more effective than drawing symbols one by one, as a couple of layout calculations and setting of pen/brush can be done once for the complete array. \param painter Painter \param points Array of points \param numPoints Number of points */ void QwtSymbol::drawSymbols( QPainter *painter, const QPointF *points, int numPoints ) const { if ( numPoints <= 0 ) return; painter->save(); switch ( d_data->style ) { case QwtSymbol::Ellipse: { qwtDrawEllipseSymbols( painter, points, numPoints, *this ); break; } case QwtSymbol::Rect: { qwtDrawRectSymbols( painter, points, numPoints, *this ); break; } case QwtSymbol::Diamond: { qwtDrawDiamondSymbols( painter, points, numPoints, *this ); break; } case QwtSymbol::Cross: { qwtDrawLineSymbols( painter, Qt::Horizontal | Qt::Vertical, points, numPoints, *this ); break; } case QwtSymbol::XCross: { qwtDrawXCrossSymbols( painter, points, numPoints, *this ); break; } case QwtSymbol::Triangle: case QwtSymbol::UTriangle: { qwtDrawTriangleSymbols( painter, QwtTriangle::Up, points, numPoints, *this ); break; } case QwtSymbol::DTriangle: { qwtDrawTriangleSymbols( painter, QwtTriangle::Down, points, numPoints, *this ); break; } case QwtSymbol::RTriangle: { qwtDrawTriangleSymbols( painter, QwtTriangle::Right, points, numPoints, *this ); break; } case QwtSymbol::LTriangle: { qwtDrawTriangleSymbols( painter, QwtTriangle::Left, points, numPoints, *this ); break; } case QwtSymbol::HLine: { qwtDrawLineSymbols( painter, Qt::Horizontal, points, numPoints, *this ); break; } case QwtSymbol::VLine: { qwtDrawLineSymbols( painter, Qt::Vertical, points, numPoints, *this ); break; } case QwtSymbol::Star1: { qwtDrawStar1Symbols( painter, points, numPoints, *this ); break; } case QwtSymbol::Star2: { qwtDrawStar2Symbols( painter, points, numPoints, *this ); break; } case QwtSymbol::Hexagon: { qwtDrawHexagonSymbols( painter, points, numPoints, *this ); break; } default: ; } painter->restore(); }