Go to the documentation of this file.
20 #include <qpainterpath.h>
23 const QwtScaleMap& yMap,
const QPainterPath& path,
bool doAlign )
26 shape.setFillRule( path.fillRule() );
28 for (
int i = 0; i < path.elementCount(); i++ )
30 const QPainterPath::Element element = path.elementAt( i );
35 switch( element.type )
37 case QPainterPath::MoveToElement:
48 case QPainterPath::LineToElement:
59 case QPainterPath::CurveToElement:
61 const QPainterPath::Element element1 = path.elementAt( ++i );
62 const double x1 = xMap.
transform( element1.x );
63 const double y1 = yMap.
transform( element1.y );
65 const QPainterPath::Element element2 = path.elementAt( ++i );
66 const double x2 = xMap.
transform( element2.x );
67 const double y2 = yMap.
transform( element2.y );
69 shape.cubicTo(
x,
y, x1, y1, x2, y2 );
72 case QPainterPath::CurveToDataElement:
219 path.addRect( rect );
233 shape.addPolygon( polygon );
249 if (
shape.isEmpty() )
359 tolerance =
qwtMaxF( tolerance, 0.0 );
387 const QRectF& canvasRect )
const
399 xMap, yMap, canvasRect.toRect() );
403 if ( ( br.left() > cr.right() ) || ( br.right() < cr.left() )
404 || ( br.top() > cr.bottom() ) || ( br.bottom() < cr.top() ) )
418 const QRectF clipRect = canvasRect.adjusted( -pw, -pw, pw, pw );
420 QPainterPath clippedPath;
421 clippedPath.setFillRule( path.fillRule() );
424 for (
int i = 0; i < polygons.size(); i++ )
427 clippedPath.addPolygon( polygons[i] );
438 QPainterPath fittedPath;
439 fittedPath.setFillRule( path.fillRule() );
442 for (
int i = 0; i < polygons.size(); i++ )
443 fittedPath.addPolygon( fitter.
fitCurve( polygons[ i ] ) );
451 painter->drawPath( path );
464 const QSizeF&
size )
const
471 if (
size.isEmpty() )
478 QPainter painter( &icon );
479 painter.setRenderHint( QPainter::Antialiasing,
482 painter.translate( -br.topLeft() );
A plot item, which displays any graphical shape, that can be defined by a QPainterPath.
double invTransform(double p) const
void setPolygon(const QPolygonF &)
Set a path built from a polygon.
@ LegendShape
Display a scaled down version of the shape.
virtual void draw(QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const QWT_OVERRIDE
void setRenderTolerance(double)
Set the tolerance for the weeding optimization.
@ LegendColor
Display a filled rectangle.
LegendMode legendMode() const
virtual void legendChanged()
A paint device for scalable graphics.
void setRect(const QRectF &)
Set a path built from a rectangle.
virtual QwtGraphic legendIcon(int index, const QSizeF &) const QWT_OVERRIDE
QwtPlotShapeItem(const QString &title=QString())
Constructor.
QPainterPath shape() const
QwtGraphic defaultIcon(const QBrush &, const QSizeF &) const
Return a default icon from a brush.
@ Legend
The item is represented on the legend.
A curve fitter implementing Douglas and Peucker algorithm.
static bool roundingAlignment()
void setShape(const QPainterPath &)
Set the shape to be displayed.
void setLegendMode(LegendMode)
virtual QRectF boundingRect() const
void setBrush(const QBrush &)
span_constexpr std::size_t size(span< T, Extent > const &spn)
QwtPlotShapeItem::PaintAttributes paintAttributes
A class representing a text.
double renderTolerance() const
QWT_CONSTEXPR float qwtMaxF(float a, float b)
void setZ(double z)
Set the z value.
virtual QRectF boundingRect() const QWT_OVERRIDE
Bounding rectangle of the shape.
@ Rtti_PlotShape
For QwtPlotShapeItem.
virtual ~QwtPlotShapeItem()
Destructor.
Base class for items on the plot canvas.
QWT_EXPORT void clipPolygonF(const QRectF &, QPolygonF &, bool closePolygon=false)
virtual QPolygonF fitCurve(const QPolygonF &) const QWT_OVERRIDE
double transform(double s) const
virtual void itemChanged()
QwtPlotShapeItem::LegendMode legendMode
void setItemAttribute(ItemAttribute, bool on=true)
LegendMode
Mode how to display the item on the legend.
static qreal effectivePenWidth(const QPen &)
virtual int rtti() const QWT_OVERRIDE
void setPaintAttribute(PaintAttribute, bool on=true)
static QPainterPath qwtTransformPath(const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QPainterPath &path, bool doAlign)
void setPen(const QColor &, qreal width=0.0, Qt::PenStyle=Qt::SolidLine)
bool testPaintAttribute(PaintAttribute) const
bool testRenderHint(RenderHint) const
@ RenderAntialiased
Enable antialiasing.
void setDefaultSize(const QSizeF &)
Set a default size.
plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:46