Qwt User's Guide 6.3.0

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | List of all members
QwtPlotVectorField Class Reference

A plot item, that represents a vector field. More...

`#include <qwt_plot_vectorfield.h>`

Inheritance diagram for QwtPlotVectorField:

## Public Types

enum | IndicatorOrigin { OriginHead , OriginTail , OriginCenter }
enum | PaintAttribute { FilterVectors = 0x01 }
enum | MagnitudeMode { MagnitudeAsColor = 0x01 , MagnitudeAsLength = 0x02 }
typedef QFlags< PaintAttribute > | PaintAttributes
typedef QFlags< MagnitudeMode > | MagnitudeModes
Public Types inherited from QwtPlotItem
enum | RttiValues { Rtti_PlotItem = 0 , Rtti_PlotGrid , Rtti_PlotScale , Rtti_PlotLegend , Rtti_PlotMarker , Rtti_PlotCurve , Rtti_PlotSpectroCurve , Rtti_PlotIntervalCurve , Rtti_PlotHistogram , Rtti_PlotSpectrogram , Rtti_PlotGraphic , Rtti_PlotTradingCurve , Rtti_PlotBarChart , Rtti_PlotMultiBarChart , Rtti_PlotShape , Rtti_PlotTextLabel ,
Rtti_PlotZone , Rtti_PlotVectorField , Rtti_PlotUserItem = 1000
}
| Runtime type information. More...
enum | ItemAttribute { Legend = 0x01 , AutoScale = 0x02 , Margins = 0x04 }
| Plot Item Attributes. More...
enum | ItemInterest { ScaleInterest = 0x01 , LegendInterest = 0x02 }
| Plot Item Interests. More...
enum | RenderHint { RenderAntialiased = 0x1 }
| Render hints. More...
typedef QFlags< ItemAttribute > | ItemAttributes
typedef QFlags< ItemInterest > | ItemInterests
typedef QFlags< RenderHint > | RenderHints

## Public Member Functions

| QwtPlotVectorField (const QString &title=QString())
| QwtPlotVectorField (const QwtText &title)
virtual | ~QwtPlotVectorField ()
| Destructor.
void | setPaintAttribute (PaintAttribute, bool on=true)
bool | testPaintAttribute (PaintAttribute) const
void | setMagnitudeMode (MagnitudeMode, bool on=true)
bool | testMagnitudeMode (MagnitudeMode) const
void | setSymbol (QwtVectorFieldSymbol *)
const QwtVectorFieldSymbol * | symbol () const
void | setPen (const QPen &)
QPen | pen () const
void | setBrush (const QBrush &)
| Assign a brush.
QBrush | brush () const
void | setRasterSize (const QSizeF &)
QSizeF | rasterSize () const
void | setIndicatorOrigin (IndicatorOrigin)
IndicatorOrigin | indicatorOrigin () const
void | setSamples (const QVector< QwtVectorFieldSample > &)
void | setSamples (QwtVectorFieldData *)
void | setColorMap (QwtColorMap *)
const QwtColorMap * | colorMap () const
void | setMagnitudeRange (const QwtInterval &)
QwtInterval | magnitudeRange () const
void | setMinArrowLength (double)
double | minArrowLength () const
void | setMaxArrowLength (double)
double | maxArrowLength () const
virtual double | arrowLength (double magnitude) const
virtual QRectF | boundingRect () const override
virtual void | drawSeries (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const override
virtual int | rtti () const override
virtual QwtGraphic | legendIcon (int index, const QSizeF &) const override
void | setMagnitudeScaleFactor (double factor)
| Set the magnitudeScaleFactor.
double | magnitudeScaleFactor () const
Public Member Functions inherited from QwtPlotSeriesItem
| QwtPlotSeriesItem (const QString &title=QString())
| QwtPlotSeriesItem (const QwtText &title)
virtual | ~QwtPlotSeriesItem ()
| Destructor.
void | setOrientation (Qt::Orientation)
Qt::Orientation | orientation () const
virtual void | draw (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const override
| Draw the complete series.
virtual void | updateScaleDiv (const QwtScaleDiv &, const QwtScaleDiv &) override
| Update the item to changes of the axes scale division.
Public Member Functions inherited from QwtPlotItem
| QwtPlotItem ()
| QwtPlotItem (const QString &title)
| QwtPlotItem (const QwtText &title)
virtual | ~QwtPlotItem ()
| Destroy the QwtPlotItem.
void | attach (QwtPlot *plot)
| Attach the item to a plot.
void | detach ()
| This method detaches a QwtPlotItem from any QwtPlot it has been associated with.
QwtPlot * | plot () const
| Return attached plot.
void | setTitle (const QString &title)
void | setTitle (const QwtText &title)
const QwtText & | title () const
void | setItemAttribute (ItemAttribute, bool on=true)
bool | testItemAttribute (ItemAttribute) const
void | setItemInterest (ItemInterest, bool on=true)
bool | testItemInterest (ItemInterest) const
void | setRenderHint (RenderHint, bool on=true)
bool | testRenderHint (RenderHint) const
void | setRenderThreadCount (uint numThreads)
uint | renderThreadCount () const
void | setLegendIconSize (const QSize &)
QSize | legendIconSize () const
double | z () const
void | setZ (double z)
| Set the z value.
void | show ()
| Show the item.
void | hide ()
| Hide the item.
virtual void | setVisible (bool)
bool | isVisible () const
void | setAxes (QwtAxisId xAxis, QwtAxisId yAxis)
void | setXAxis (QwtAxisId)
QwtAxisId | xAxis () const
| Return xAxis.
void | setYAxis (QwtAxisId)
QwtAxisId | yAxis () const
| Return yAxis.
virtual void | itemChanged ()
virtual void | legendChanged ()
virtual void | getCanvasMarginHint (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, double &left, double &top, double &right, double &bottom) const
| Calculate a hint for the canvas margin.
virtual void | updateLegend (const QwtPlotItem *, const QList< QwtLegendData > &)
| Update the item to changes of the legend info.
QRectF | scaleRect (const QwtScaleMap &, const QwtScaleMap &) const
| Calculate the bounding scale rectangle of 2 maps.
QRectF | paintRect (const QwtScaleMap &, const QwtScaleMap &) const
| Calculate the bounding paint rectangle of 2 maps.
virtual QList< QwtLegendData > | legendData () const
| Return all information, that is needed to represent the item on the legend.
Public Member Functions inherited from QwtAbstractSeriesStore
virtual | ~QwtAbstractSeriesStore ()
| Destructor.
Public Member Functions inherited from QwtSeriesStore< QwtVectorFieldSample >
| QwtSeriesStore ()
| Constructor The store contains no series.
| ~QwtSeriesStore ()
| Destructor.
void | setData (QwtSeriesData< QwtVectorFieldSample > *series)
QwtSeriesData< QwtVectorFieldSample > * | data ()
const QwtSeriesData< QwtVectorFieldSample > * | data () const
QwtVectorFieldSample | sample (int index) const
virtual size_t | dataSize () const override
virtual QRectF | dataRect () const override
virtual void | setRectOfInterest (const QRectF &rect) override
QwtSeriesData< QwtVectorFieldSample > * | swapData (QwtSeriesData< QwtVectorFieldSample > *series)

## Protected Member Functions

virtual void | drawSymbols (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const
virtual void | drawSymbol (QPainter *, double x, double y, double vx, double vy) const
virtual void | dataChanged () override
| dataChanged() indicates, that the series has been changed.
Protected Member Functions inherited from QwtPlotItem
QwtGraphic | defaultIcon (const QBrush &, const QSizeF &) const
| Return a default icon from a brush.

## Detailed Description

A plot item, that represents a vector field.

A vector field is a representation of a points with a given magnitude and direction as arrows. While the direction affects the direction of the arrow, the magnitude might be represented as a color or by the length of the arrow.

See also
  QwtVectorFieldSymbol, QwtVectorFieldSample

Definition at line 30 of file qwt_plot_vectorfield.h.

## Member Typedef Documentation

## ◆ MagnitudeModes

typedef QFlags<MagnitudeMode > QwtPlotVectorField::MagnitudeModes

An ORed combination of MagnitudeMode values.

Definition at line 90 of file qwt_plot_vectorfield.h.

## ◆ PaintAttributes

typedef QFlags<PaintAttribute > QwtPlotVectorField::PaintAttributes

An ORed combination of PaintAttribute values.

Definition at line 67 of file qwt_plot_vectorfield.h.

## Member Enumeration Documentation

## ◆ IndicatorOrigin

enum QwtPlotVectorField::IndicatorOrigin

Depending on the origin the indicator symbol ( usually an arrow ) will be to the position of the corresponding sample.

Enumerator
OriginHead | symbol points to the sample position
OriginTail | The arrow starts at the sample position.
OriginCenter | The arrow is centered at the sample position.

Definition at line 39 of file qwt_plot_vectorfield.h.

## ◆ MagnitudeMode

enum QwtPlotVectorField::MagnitudeMode

Depending on the MagnitudeMode the magnitude component will have an impact on the attributes of the symbol/arrow.

See also
  setMagnitudeMode()

Enumerator
MagnitudeAsColor | The magnitude will be mapped to a color using a color map

See also
  magnitudeRange(), colorMap()

MagnitudeAsLength | The magnitude will have an impact on the length of the arrow/symbol

See also
  arrowLength(), magnitudeScaleFactor()

Definition at line 75 of file qwt_plot_vectorfield.h.

## ◆ PaintAttribute

enum QwtPlotVectorField::PaintAttribute

Attributes to modify the rendering

See also
  setPaintAttribute(), testPaintAttribute()

Definition at line 55 of file qwt_plot_vectorfield.h.

## Constructor & Destructor Documentation

## ◆ QwtPlotVectorField() [1/2]

QwtPlotVectorField::QwtPlotVectorField | ( | const QString & | title = QString() | ) |

explicit

Constructor

Parameters

  title | Title of the curve

Definition at line 302 of file qwt_plot_vectorfield.cpp.

## ◆ QwtPlotVectorField() [2/2]

QwtPlotVectorField::QwtPlotVectorField | ( | const QwtText & | title | ) |

explicit

Constructor

Parameters

  title | Title of the curve

Definition at line 292 of file qwt_plot_vectorfield.cpp.

## ◆ ~QwtPlotVectorField()

QwtPlotVectorField::~QwtPlotVectorField | ( |  | ) |

virtual

Destructor.

Definition at line 309 of file qwt_plot_vectorfield.cpp.

## Member Function Documentation

## ◆ arrowLength()

double QwtPlotVectorField::arrowLength | ( | double | magnitude | ) | const

virtual

Computes length of the arrow in screen coordinate units based on its magnitude.

Default implementation simply scales the vector using the magnitudeScaleFactor() If the result is not null, the length is then bounded into the interval [ minArrowLength(), maxArrowLength() ].

Re-implement this function to provide special handling for zero/non-zero magnitude arrows, or impose minimum/maximum arrow length limits.

Parameters

  magnitude | Magnitude

Returns
  Length of arrow to be drawn in dependence of vector magnitude.

See also
  magnitudeScaleFactor, minArrowLength(), maxArrowLength()

Note
  Has no effect when QwtPlotVectorField::MagnitudeAsLength is not enabled

Definition at line 726 of file qwt_plot_vectorfield.cpp.

## ◆ boundingRect()

QRectF QwtPlotVectorField::boundingRect | ( |  | ) | const

override virtual

Returns
  An invalid bounding rect: QRectF(1.0, 1.0, -2.0, -2.0)

Note
  A width or height < 0.0 is ignored by the autoscaler

Reimplemented from QwtPlotSeriesItem.

Definition at line 749 of file qwt_plot_vectorfield.cpp.

## ◆ brush()

QBrush QwtPlotVectorField::brush | ( |  | ) | const

Returns
  Brush used to fill the symbol

See also
  setBrush(), pen()

Definition at line 379 of file qwt_plot_vectorfield.cpp.

## ◆ colorMap()

const QwtColorMap * QwtPlotVectorField::colorMap | ( |  | ) | const

Returns
  Color Map used for mapping the intensity values to colors

See also
  setColorMap()

Definition at line 590 of file qwt_plot_vectorfield.cpp.

## ◆ dataChanged()

void QwtPlotVectorField::dataChanged | ( |  | ) |

override protected virtual

dataChanged() indicates, that the series has been changed.

Reimplemented from QwtPlotSeriesItem.

Definition at line 1034 of file qwt_plot_vectorfield.cpp.

## ◆ drawSeries()

void QwtPlotVectorField::drawSeries | ( | QPainter * | painter,
|  | const QwtScaleMap & | xMap,
|  | const QwtScaleMap & | yMap,
|  | const QRectF & | canvasRect,
|  | int | from,
|  | int | to ) const

override virtual

Draw a subset of the points

Parameters

  painter | Painter
  xMap | Maps x-values into pixel coordinates.
  yMap | Maps y-values into pixel coordinates.
  canvasRect | Contents rectangle of the canvas
  from | Index of the first sample to be painted
  to | Index of the last sample to be painted. If to < 0 the series will be painted to its last sample.

Implements QwtPlotSeriesItem.

Definition at line 807 of file qwt_plot_vectorfield.cpp.

## ◆ drawSymbol()

void QwtPlotVectorField::drawSymbol | ( | QPainter * | painter,
|  | double | x,
|  | double | y,
|  | double | vx,
|  | double | vy ) const

protected virtual

Draw a arrow/symbols at a specific position

x, y, are paint device coordinates, while vx, vy are from the corresponding sample.

See also
  setSymbol(), drawSeries()

Definition at line 975 of file qwt_plot_vectorfield.cpp.

## ◆ drawSymbols()

void QwtPlotVectorField::drawSymbols | ( | QPainter * | painter,
|  | const QwtScaleMap & | xMap,
|  | const QwtScaleMap & | yMap,
|  | const QRectF & | canvasRect,
|  | int | from,
|  | int | to ) const

protected virtual

Draw symbols

Parameters

  painter | Painter
  xMap | x map
  yMap | y map
  canvasRect | Contents rectangle of the canvas
  from | Index of the first sample to be painted
  to | Index of the last sample to be painted

See also
  setSymbol(), drawSymbol(), drawSeries()

Definition at line 847 of file qwt_plot_vectorfield.cpp.

## ◆ indicatorOrigin()

QwtPlotVectorField::IndicatorOrigin QwtPlotVectorField::indicatorOrigin | ( |  | ) | const

Returns
  origin for the symbols/arrows

Definition at line 401 of file qwt_plot_vectorfield.cpp.

## ◆ legendIcon()

QwtGraphic QwtPlotVectorField::legendIcon | ( | int | index,
|  | const QSizeF & | size ) const

override virtual

Returns
  Icon representing the vector fields on the legend

Parameters

  index | Index of the legend entry ( ignored as there is only one )
  size | Icon size

See also
  QwtPlotItem::setLegendIconSize(), QwtPlotItem::legendData()

Reimplemented from QwtPlotItem.

Definition at line 770 of file qwt_plot_vectorfield.cpp.

## ◆ magnitudeRange()

QwtInterval QwtPlotVectorField::magnitudeRange | ( |  | ) | const

Returns
  min/max magnitudes to be used for color map lookups

See also
  setMagnitudeRange(), colorMap()

Definition at line 645 of file qwt_plot_vectorfield.cpp.

## ◆ magnitudeScaleFactor()

double QwtPlotVectorField::magnitudeScaleFactor | ( |  | ) | const

Returns
  Scale factor used to calculate the arrow length from the magnitude

The length of the arrow in screen coordinate units is calculated by scaling the magnitude by the magnitudeScaleFactor.

Default implementation simply scales the vector using the magnitudeScaleFactor property. Re-implement this function to provide special handling for zero/non-zero magnitude arrows, or impose minimum/maximum arrow length limits.

Returns
  Length of arrow to be drawn in dependence of vector magnitude.

See also
  magnitudeScaleFactor

Note
  Has no effect when QwtPlotVectorField::MagnitudeAsLength is not enabled

Definition at line 440 of file qwt_plot_vectorfield.cpp.

## ◆ maxArrowLength()

double QwtPlotVectorField::maxArrowLength | ( |  | ) | const

Returns
  maximum for the arrow length

See also
  setMinArrowLength(), maxArrowLength(), arrowLength()

Note
  Has no effect when QwtPlotVectorField::MagnitudeAsLength is not enabled

Definition at line 705 of file qwt_plot_vectorfield.cpp.

## ◆ minArrowLength()

double QwtPlotVectorField::minArrowLength | ( |  | ) | const

Returns
  minimum for the arrow length of non zero vectors

See also
  setMinArrowLength(), maxArrowLength(), arrowLength()

Note
  Has no effect when QwtPlotVectorField::MagnitudeAsLength is not enabled

Definition at line 675 of file qwt_plot_vectorfield.cpp.

## ◆ pen()

QPen QwtPlotVectorField::pen | ( |  | ) | const

Returns
  Pen used to draw the lines

See also
  setPen(), brush()

Definition at line 351 of file qwt_plot_vectorfield.cpp.

## ◆ rasterSize()

QSizeF QwtPlotVectorField::rasterSize | ( |  | ) | const

Returns
  raster size used for filtering samples

See also
  setRasterSize(), QwtPlotVectorField::FilterVectors

Definition at line 463 of file qwt_plot_vectorfield.cpp.

## ◆ rtti()

int QwtPlotVectorField::rtti | ( |  | ) | const

override virtual

Returns
  QwtPlotItem::Rtti_PlotField

Reimplemented from QwtPlotItem.

Definition at line 503 of file qwt_plot_vectorfield.cpp.

## ◆ setBrush()

void QwtPlotVectorField::setBrush | ( | const QBrush & | brush | ) |

Assign a brush.

Parameters

  brush | New brush

See also
  brush(), pen()

Note
  the brush is ignored in MagnitudeAsColor mode

Definition at line 364 of file qwt_plot_vectorfield.cpp.

## ◆ setColorMap()

void QwtPlotVectorField::setColorMap | ( | QwtColorMap * | colorMap | ) |

Change the color map

The color map is used to map the magnitude of a sample into a color using a known range for the magnitudes.

Parameters

  colorMap | Color Map

See also
  colorMap(), magnitudeRange()

Definition at line 571 of file qwt_plot_vectorfield.cpp.

## ◆ setIndicatorOrigin()

void QwtPlotVectorField::setIndicatorOrigin | ( | IndicatorOrigin | origin | ) |

Set the origin for the symbols/arrows

Parameters

  origin | Origin

See also
  indicatorOrigin()

Definition at line 390 of file qwt_plot_vectorfield.cpp.

## ◆ setMagnitudeMode()

void QwtPlotVectorField::setMagnitudeMode | ( | MagnitudeMode | mode,
|  | bool | on = true )

Specify a mode how to represent the magnitude a n arrow/symbol

Parameters

  mode | Mode
  on | On/Off

See also
  testMagnitudeMode()

Definition at line 602 of file qwt_plot_vectorfield.cpp.

## ◆ setMagnitudeRange()

void QwtPlotVectorField::setMagnitudeRange | ( | const QwtInterval & | magnitudeRange | ) |

Sets the min/max magnitudes to be used for color map lookups.

If invalid (min=max=0 or negative values), the range is determined from the current range of magnitudes in the vector samples.

See also
  magnitudeRange(), colorMap()

Definition at line 632 of file qwt_plot_vectorfield.cpp.

## ◆ setMagnitudeScaleFactor()

void QwtPlotVectorField::setMagnitudeScaleFactor | ( | double | factor | ) |

Set the magnitudeScaleFactor.

The length of the arrow in screen coordinate units is calculated by scaling the magnitude by the magnitudeScaleFactor.

Parameters

  factor | Scale factor

See also
  magnitudeScaleFactor(), arrowLength()

Note
  Has no effect when QwtPlotVectorField::MagnitudeAsLength is not enabled

Definition at line 417 of file qwt_plot_vectorfield.cpp.

## ◆ setMaxArrowLength()

void QwtPlotVectorField::setMaxArrowLength | ( | double | length | ) |

Set a maximum for the arrow length

Parameters

  length | Maximum for the arrow length in pixels

See also
  maxArrowLength(), setMinArrowLength(), arrowLength()

Note
  Has no effect when QwtPlotVectorField::MagnitudeAsLength is not enabled

Definition at line 688 of file qwt_plot_vectorfield.cpp.

## ◆ setMinArrowLength()

void QwtPlotVectorField::setMinArrowLength | ( | double | length | ) |

Set a minimum for the arrow length of non zero vectors

Parameters

  length | Minimum for the arrow length in pixels

See also
  minArrowLength(), setMaxArrowLength(), arrowLength()

Note
  Has no effect when QwtPlotVectorField::MagnitudeAsLength is not enabled

Definition at line 658 of file qwt_plot_vectorfield.cpp.

## ◆ setPaintAttribute()

void QwtPlotVectorField::setPaintAttribute | ( | PaintAttribute | attribute,
|  | bool | on = true )

Specify an attribute how to draw the curve

Parameters

  attribute | Paint attribute
  on | On/Off

See also
  testPaintAttribute()

Definition at line 475 of file qwt_plot_vectorfield.cpp.

## ◆ setPen()

void QwtPlotVectorField::setPen | ( | const QPen & | pen | ) |

Assign a pen

Parameters

  pen | New pen

See also
  pen(), brush()

Note
  the pen is ignored in MagnitudeAsColor mode

Definition at line 336 of file qwt_plot_vectorfield.cpp.

## ◆ setRasterSize()

void QwtPlotVectorField::setRasterSize | ( | const QSizeF & | size | ) |

Set the raster size used for filtering samples

See also
  rasterSize(), QwtPlotVectorField::FilterVectors

Definition at line 450 of file qwt_plot_vectorfield.cpp.

## ◆ setSamples() [1/2]

void QwtPlotVectorField::setSamples | ( | const QVector< QwtVectorFieldSample > & | samples | ) |

Initialize data with an array of samples.

Parameters

  samples | Vector of points

Definition at line 541 of file qwt_plot_vectorfield.cpp.

## ◆ setSamples() [2/2]

void QwtPlotVectorField::setSamples | ( | QwtVectorFieldData * | data | ) |

Assign a series of samples

setSamples() is just a wrapper for setData() without any additional value - beside that it is easier to find for the developer.

Parameters

  data | Data

Warning
  The item takes ownership of the data object, deleting it when its not used anymore.

Definition at line 556 of file qwt_plot_vectorfield.cpp.

## ◆ setSymbol()

void QwtPlotVectorField::setSymbol | ( | QwtVectorFieldSymbol * | symbol | ) |

Sets a new arrow symbol (implementation of arrow drawing code).

Parameters

  symbol | Arrow symbol

See also
  symbol(), drawSymbol()

Note
  Ownership is transferred to QwtPlotVectorField.

Definition at line 516 of file qwt_plot_vectorfield.cpp.

## ◆ symbol()

const QwtVectorFieldSymbol * QwtPlotVectorField::symbol | ( |  | ) | const

Returns
  arrow symbol

See also
  setSymbol(), drawSymbol()

Definition at line 532 of file qwt_plot_vectorfield.cpp.

## ◆ testMagnitudeMode()

bool QwtPlotVectorField::testMagnitudeMode | ( | MagnitudeMode | mode | ) | const

Returns
  True, when mode is enabled

See also
  MagnitudeMode, setMagnitudeMode()

Definition at line 619 of file qwt_plot_vectorfield.cpp.

## ◆ testPaintAttribute()

bool QwtPlotVectorField::testPaintAttribute | ( | PaintAttribute | attribute | ) | const

Returns
  True, when attribute is enabled

See also
  PaintAttribute, setPaintAttribute()

Definition at line 496 of file qwt_plot_vectorfield.cpp.