17 const QwtScaleMap &yMap,
const QPainterPath &path,
bool doAlign )
20 shape.setFillRule( path.fillRule() );
22 for (
int i = 0;
i < path.elementCount();
i++ )
24 const QPainterPath::Element &element = path.elementAt(
i );
29 switch( element.type )
31 case QPainterPath::MoveToElement:
42 case QPainterPath::LineToElement:
53 case QPainterPath::CurveToElement:
55 const QPainterPath::Element& element1 = path.elementAt( ++
i );
56 const double x1 = xMap.
transform( element1.x );
57 const double y1 = yMap.
transform( element1.y );
59 const QPainterPath::Element& element2 = path.elementAt( ++
i );
60 const double x2 = xMap.
transform( element2.x );
61 const double y2 = yMap.
transform( element2.y );
63 shape.cubicTo( x, y, x1, y1, x2, y2 );
66 case QPainterPath::CurveToDataElement:
213 path.addRect( rect );
227 shape.addPolygon( polygon );
243 if ( shape.isEmpty() )
280 setPen( QPen( color, width, style ) );
353 tolerance = qMax( tolerance, 0.0 );
381 const QRectF &canvasRect )
const 393 xMap, yMap, canvasRect.toRect() );
397 if ( ( br.left() > cr.right() ) || ( br.right() < cr.left() )
398 || ( br.top() > cr.bottom() ) || ( br.bottom() < cr.top() ) )
411 const qreal pw = qMax( qreal( 1.0 ), painter->pen().widthF());
412 const QRectF clipRect = canvasRect.adjusted( -pw, -pw, pw, pw );
414 QPainterPath clippedPath;
415 clippedPath.setFillRule( path.fillRule() );
417 QList<QPolygonF> polygons = path.toSubpathPolygons();
418 for (
int i = 0;
i < polygons.size();
i++ )
421 clippedPath.addPolygon( polygons[i] );
432 QPainterPath fittedPath;
433 fittedPath.setFillRule( path.fillRule() );
435 const QList<QPolygonF> polygons = path.toSubpathPolygons();
436 for (
int i = 0;
i < polygons.size();
i++ )
437 fittedPath.addPolygon( fitter.
fitCurve( polygons[
i ] ) );
445 painter->drawPath( path );
458 const QSizeF &size )
const 465 if ( size.isEmpty() )
472 QPainter painter( &icon );
473 painter.setRenderHint( QPainter::Antialiasing,
476 painter.translate( -br.topLeft() );
virtual void legendChanged()
Display a scaled down version of the shape.
Display a filled rectangle.
void setLegendMode(LegendMode)
QPainterPath shape() const
bool testPaintAttribute(PaintAttribute) const
virtual QwtGraphic legendIcon(int index, const QSizeF &) const
LegendMode
Mode how to display the item on the legend.
void setPen(const QColor &, qreal width=0.0, Qt::PenStyle=Qt::SolidLine)
QwtGraphic defaultIcon(const QBrush &, const QSizeF &) const
Return a default icon from a brush.
TFSIMD_FORCE_INLINE const tfScalar & y() const
LegendMode legendMode() const
void setDefaultSize(const QSizeF &)
Set a default size.
The item is represented on the legend.
void setPaintAttribute(PaintAttribute, bool on=true)
bool testRenderHint(RenderHint) const
GraphId path[kMaxDeadlockPathLen]
virtual QRectF boundingRect() const
Bounding rectangle of the shape.
A curve fitter implementing Douglas and Peucker algorithm.
static void clipPolygonF(const QRectF &, QPolygonF &, bool closePolygon=false)
A class representing a text.
void setZ(double z)
Set the z value.
virtual QPolygonF fitCurve(const QPolygonF &) const
A paint device for scalable graphics.
TFSIMD_FORCE_INLINE const tfScalar & x() const
void setRenderTolerance(double)
Set the tolerance for the weeding optimization.
void setRect(const QRectF &)
Set a path built from a rectangle.
void setPolygon(const QPolygonF &)
Set a path built from a polygon.
double invTransform(double p) const
QFlags< PaintAttribute > PaintAttributes
Paint attributes.
virtual void itemChanged()
A plot item, which displays any graphical shape, that can be defined by a QPainterPath.
QwtPlotShapeItem(const QString &title=QString())
Constructor.
QwtPlotShapeItem::PaintAttributes paintAttributes
QwtPlotShapeItem::LegendMode legendMode
double renderTolerance() const
static QPainterPath qwtTransformPath(const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QPainterPath &path, bool doAlign)
Base class for items on the plot canvas.
void setItemAttribute(ItemAttribute, bool on=true)
double transform(double s) const
void setShape(const QPainterPath &)
Set the shape to be displayed.
void setBrush(const QBrush &)
virtual void draw(QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &rect) const
static bool roundingAlignment()
virtual ~QwtPlotShapeItem()
Destructor.
const QwtText & title() const
virtual QRectF boundingRect() const