QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
Classes | 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:
QwtPlotSeriesItem QwtSeriesStore< QwtVectorFieldSample > QwtPlotItem QwtAbstractSeriesStore QwtAbstractSeriesStore

Classes

class  PrivateData
 

Public Types

enum  IndicatorOrigin { OriginHead , OriginTail , OriginCenter }
 Indicator origin. More...
 
enum  PaintAttribute { FilterVectors = 0x01 }
 Paint attributes. More...
 
enum  MagnitudeMode { MagnitudeAsColor = 0x01 , MagnitudeAsLength = 0x02 }
 Magnitude mode. More...
 
- 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_PlotArrowMarker , Rtti_PlotBoxChart ,
  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...
 

Public Member Functions

 QwtPlotVectorField (const QString &title=QString())
 
 QwtPlotVectorField (const QwtText &title)
 Constructor.
 
void setPaintAttribute (PaintAttribute, bool on=true)
 Specify an attribute how to draw the curve.
 
bool testPaintAttribute (PaintAttribute) const
 Test a paint attribute.
 
void setMagnitudeMode (MagnitudeMode, bool on=true)
 Specify a mode how to represent the magnitude of an arrow/symbol.
 
bool testMagnitudeMode (MagnitudeMode) const
 Test a magnitude mode.
 
void setSymbol (QwtVectorFieldSymbol *)
 Set a new arrow symbol.
 
const QwtVectorFieldSymbolsymbol () const
 Get the arrow symbol.
 
void setPen (const QPen &)
 Assign a pen.
 
QPen pen () const
 Get the pen used to draw the lines.
 
void setBrush (const QBrush &)
 Assign a brush.
 
QBrush brush () const
 Get the brush used to fill the symbol.
 
void setRasterSize (const QSizeF &)
 Set the raster size used for filtering samples.
 
QSizeF rasterSize () const
 Get the raster size used for filtering samples.
 
void setIndicatorOrigin (IndicatorOrigin)
 Set the origin for the symbols/arrows.
 
IndicatorOrigin indicatorOrigin () const
 Get the origin for the symbols/arrows.
 
void setSamples (const QVector< QwtVectorFieldSample > &)
 Initialize data with an array of samples.
 
void setSamples (QwtVectorFieldData *)
 Assign a series of samples.
 
void setColorMap (QwtColorMap *)
 Change the color map.
 
const QwtColorMapcolorMap () const
 Get the color map used for mapping intensity values to colors.
 
void setMagnitudeRange (const QwtInterval &)
 Set the magnitude range for color map lookups.
 
QwtInterval magnitudeRange () const
 Get the magnitude range for color map lookups.
 
void setMinArrowLength (double)
 Set a minimum for the arrow length of non zero vectors.
 
double minArrowLength () const
 Get the minimum for the arrow length of non zero vectors.
 
void setMaxArrowLength (double)
 Set a maximum for the arrow length.
 
double maxArrowLength () const
 Get the maximum for the arrow length.
 
virtual double arrowLength (double magnitude) const
 Calculate the arrow length for a given magnitude.
 
virtual QRectF boundingRect () const override
 Get the bounding rectangle.
 
virtual void drawSeries (QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const override
 Draw a subset of the points.
 
virtual int rtti () const override
 Get the runtime type information.
 
virtual QwtGraphic legendIcon (int index, const QSizeF &) const override
 Get the icon representing the vector fields on the legend.
 
void setMagnitudeScaleFactor (double factor)
 Set the magnitude scale factor.
 
double magnitudeScaleFactor () const
 Get the scale factor used to calculate the arrow length from the magnitude.
 
- Public Member Functions inherited from QwtPlotSeriesItem
 QwtPlotSeriesItem (const QString &title=QString())
 
 QwtPlotSeriesItem (const QwtText &title)
 Constructor.
 
void setOrientation (Qt::Orientation)
 Set the orientation of the item.
 
Qt::Orientation orientation () const
 Get the orientation of the plot item.
 
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 scale divisions.
 
- Public Member Functions inherited from QwtPlotItem
 QwtPlotItem ()
 Default constructor.
 
 QwtPlotItem (const QString &title)
 Constructor with title as QString.
 
 QwtPlotItem (const QwtText &title)
 Constructor with title as QwtText.
 
virtual ~QwtPlotItem ()
 Destructor.
 
virtual void attach (QwtPlot *plot)
 Attach the item to a plot.
 
void detach ()
 Detach the item from the plot.
 
QwtPlotplot () const
 Get the plot the item is attached to.
 
void setTitle (const QString &title)
 Set the title using a QString.
 
void setTitle (const QwtText &title)
 Set the title using a QwtText.
 
const QwtTexttitle () const
 Get the title.
 
void setItemAttribute (ItemAttribute, bool on=true)
 Set an item attribute.
 
bool testItemAttribute (ItemAttribute) const
 Test an item attribute.
 
void setItemInterest (ItemInterest, bool on=true)
 Set an item interest.
 
bool testItemInterest (ItemInterest) const
 Test an item interest.
 
void setRenderHint (RenderHint, bool on=true)
 Set a render hint.
 
bool testRenderHint (RenderHint) const
 Test a render hint.
 
void setRenderThreadCount (uint numThreads)
 Set the number of render threads.
 
uint renderThreadCount () const
 Get the number of render threads.
 
void setLegendIconSize (const QSize &)
 Set the legend icon size.
 
QSize legendIconSize () const
 Get the legend icon size.
 
double z () const
 Get the z-value.
 
void setZ (double z)
 Set the z-value.
 
void show ()
 Show the item.
 
void hide ()
 Hide the item.
 
virtual void setVisible (bool)
 Set the visibility.
 
bool isVisible () const
 Check if the item is visible.
 
void setAxes (QwtAxisId xAxis, QwtAxisId yAxis)
 Set both axes.
 
void setXAxis (QwtAxisId)
 Set the x-axis.
 
QwtAxisId xAxis () const
 Get the x-axis.
 
void setYAxis (QwtAxisId)
 Set the y-axis.
 
QwtAxisId yAxis () const
 Get the y-axis.
 
virtual void itemChanged ()
 Notify the plot that the item has changed.
 
virtual void legendChanged ()
 Notify the item that the legend has changed.
 
virtual void getCanvasMarginHint (const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, double &left, double &top, double &right, double &bottom) const
 Get margin hints for the canvas.
 
virtual void updateLegend (const QwtPlotItem *, const QList< QwtLegendData > &)
 Update the item with changes of the legend.
 
QRectF scaleRect (const QwtScaleMap &, const QwtScaleMap &) const
 Calculate the scale rectangle.
 
QRectF paintRect (const QwtScaleMap &, const QwtScaleMap &) const
 Calculate the paint rectangle.
 
virtual QList< QwtLegendDatalegendData () const
 Return legend data.
 
- Public Member Functions inherited from QwtSeriesStore< QwtVectorFieldSample >
void setData (QwtSeriesData< QwtVectorFieldSample > *series)
 
QwtSeriesData< QwtVectorFieldSample > * data ()
 
const QwtSeriesData< QwtVectorFieldSample > * data () const
 
QwtVectorFieldSample sample (size_t index) const
 
virtual size_t dataSize () const override
 
virtual QRectF dataRect () const override
 
virtual void setRectOfInterest (const QRectF &rect) override
 Set a the "rectangle of interest" for the stored series.
 
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
 Draw symbols.
 
virtual void drawSymbol (QPainter *, double x, double y, double vx, double vy) const
 Draw a arrow/symbols at a specific position.
 
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
 Create a default icon.
 

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

Member Enumeration Documentation

◆ IndicatorOrigin

Indicator origin.

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.

◆ MagnitudeMode

Magnitude mode.

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()

◆ PaintAttribute

Paint attributes.

Attributes to modify the rendering

See also
setPaintAttribute(), testPaintAttribute()
Enumerator
FilterVectors 

FilterVectors calculates an average sample from all samples that lie in the same cell of a grid that is determined by setting the rasterSize().

See also
setRasterSize()

Constructor & Destructor Documentation

◆ QwtPlotVectorField()

QwtPlotVectorField::QwtPlotVectorField ( const QwtText title)
explicit

Constructor.

Parameters
[in]titleTitle of the curve

Constructor

Parameters
[in]titleTitle of the curve

Destructor

Member Function Documentation

◆ arrowLength()

double QwtPlotVectorField::arrowLength ( double  magnitude) const
virtual

Calculate the arrow length for a given magnitude.

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
[in]magnitudeMagnitude
Returns
Length of arrow to be drawn in dependence of vector magnitude.
Note
Has no effect when QwtPlotVectorField::MagnitudeAsLength is not enabled
See also
magnitudeScaleFactor, minArrowLength(), maxArrowLength()

◆ boundingRect()

QRectF QwtPlotVectorField::boundingRect ( ) const
overridevirtual

Get the bounding rectangle.

Returns
Bounding rectangle of all samples

Reimplemented from QwtPlotSeriesItem.

◆ brush()

QBrush QwtPlotVectorField::brush ( ) const

Get the brush used to fill the symbol.

Returns
Brush used for filling
See also
setBrush(), pen()

◆ colorMap()

const QwtColorMap * QwtPlotVectorField::colorMap ( ) const

Get the color map used for mapping intensity values to colors.

Returns
Color Map
See also
setColorMap()

◆ dataChanged()

void QwtPlotVectorField::dataChanged ( )
overrideprotectedvirtual

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

Reimplemented from QwtPlotSeriesItem.

◆ drawSeries()

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

Draw a subset of the points.

Parameters
[in]painterPainter
[in]xMapMaps x-values into pixel coordinates.
[in]yMapMaps y-values into pixel coordinates.
[in]canvasRectContents rectangle of the canvas
[in]fromIndex of the first sample to be painted
[in]toIndex of the last sample to be painted. If to < 0 the series will be painted to its last sample.

Implements QwtPlotSeriesItem.

◆ drawSymbol()

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

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()

◆ drawSymbols()

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

Draw symbols.

Parameters
painterPainter
xMapx map
yMapy map
canvasRectContents rectangle of the canvas
fromIndex of the first sample to be painted
toIndex of the last sample to be painted
See also
setSymbol(), drawSymbol(), drawSeries()

◆ indicatorOrigin()

QwtPlotVectorField::IndicatorOrigin QwtPlotVectorField::indicatorOrigin ( ) const

Get the origin for the symbols/arrows.

Returns
Origin position
See also
setIndicatorOrigin()

◆ legendIcon()

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

Get the icon representing the vector fields on the legend.

Parameters
[in]indexIndex of the legend entry ( ignored as there is only one )
[in]sizeIcon size
Returns
Legend icon
See also
QwtPlotItem::setLegendIconSize(), QwtPlotItem::legendData()

Reimplemented from QwtPlotItem.

◆ magnitudeRange()

QwtInterval QwtPlotVectorField::magnitudeRange ( ) const

Get the magnitude range for color map lookups.

Returns
Magnitude range
See also
setMagnitudeRange(), colorMap()

◆ magnitudeScaleFactor()

double QwtPlotVectorField::magnitudeScaleFactor ( ) const

Get the 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
Scale factor
Note
Has no effect when QwtPlotVectorField::MagnitudeAsLength is not enabled
See also
setMagnitudeScaleFactor()

◆ maxArrowLength()

double QwtPlotVectorField::maxArrowLength ( ) const

Get the maximum for the arrow length.

Returns
Maximum for the arrow length in pixels
Note
Has no effect when QwtPlotVectorField::MagnitudeAsLength is not enabled
See also
setMinArrowLength(), maxArrowLength(), arrowLength()

◆ minArrowLength()

double QwtPlotVectorField::minArrowLength ( ) const

Get the minimum for the arrow length of non zero vectors.

Returns
Minimum for the arrow length in pixels
Note
Has no effect when QwtPlotVectorField::MagnitudeAsLength is not enabled
See also
setMinArrowLength(), maxArrowLength(), arrowLength()

◆ pen()

QPen QwtPlotVectorField::pen ( ) const

Get the pen used to draw the lines.

Returns
Pen used for drawing
See also
setPen(), brush()

◆ rasterSize()

QSizeF QwtPlotVectorField::rasterSize ( ) const

Get the raster size used for filtering samples.

Returns
Raster size
See also
setRasterSize(), QwtPlotVectorField::FilterVectors

◆ rtti()

int QwtPlotVectorField::rtti ( ) const
overridevirtual

Get the runtime type information.

Returns
QwtPlotItem::Rtti_PlotVectorField

Reimplemented from QwtPlotItem.

◆ setBrush()

void QwtPlotVectorField::setBrush ( const QBrush &  brush)

Assign a brush.

Parameters
[in]brushNew brush
Note
The brush is ignored in MagnitudeAsColor mode
See also
brush(), pen()

◆ 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
[in]colorMapColor Map
See also
colorMap(), magnitudeRange()

◆ setIndicatorOrigin()

void QwtPlotVectorField::setIndicatorOrigin ( IndicatorOrigin  origin)

Set the origin for the symbols/arrows.

Parameters
[in]originOrigin position
See also
indicatorOrigin()

◆ setMagnitudeMode()

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

Specify a mode how to represent the magnitude of an arrow/symbol.

Parameters
[in]modeMode
[in]onOn/Off
See also
testMagnitudeMode()

◆ setMagnitudeRange()

void QwtPlotVectorField::setMagnitudeRange ( const QwtInterval magnitudeRange)

Set the magnitude range for color map lookups.

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.

Parameters
[in]magnitudeRangeMagnitude range
See also
magnitudeRange(), colorMap()

◆ setMagnitudeScaleFactor()

void QwtPlotVectorField::setMagnitudeScaleFactor ( double  factor)

Set the magnitude scale factor.

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

Parameters
[in]factorScale factor
Note
Has no effect when QwtPlotVectorField::MagnitudeAsLength is not enabled
See also
magnitudeScaleFactor(), arrowLength()

◆ setMaxArrowLength()

void QwtPlotVectorField::setMaxArrowLength ( double  length)

Set a maximum for the arrow length.

Parameters
[in]lengthMaximum for the arrow length in pixels
Note
Has no effect when QwtPlotVectorField::MagnitudeAsLength is not enabled
See also
maxArrowLength(), setMinArrowLength(), arrowLength()

◆ setMinArrowLength()

void QwtPlotVectorField::setMinArrowLength ( double  length)

Set a minimum for the arrow length of non zero vectors.

Parameters
[in]lengthMinimum for the arrow length in pixels
Note
Has no effect when QwtPlotVectorField::MagnitudeAsLength is not enabled
See also
minArrowLength(), setMaxArrowLength(), arrowLength()

◆ setPaintAttribute()

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

Specify an attribute how to draw the curve.

Parameters
[in]attributePaint attribute
[in]onOn/Off
See also
testPaintAttribute()

◆ setPen()

void QwtPlotVectorField::setPen ( const QPen &  pen)

Assign a pen.

Parameters
[in]penNew pen
Note
The pen is ignored in MagnitudeAsColor mode
See also
pen(), brush()

◆ setRasterSize()

void QwtPlotVectorField::setRasterSize ( const QSizeF &  size)

Set the raster size used for filtering samples.

Parameters
[in]sizeRaster size
See also
rasterSize(), QwtPlotVectorField::FilterVectors

◆ setSamples() [1/2]

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

Initialize data with an array of samples.

Parameters
[in]samplesVector of points

◆ 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
[in]dataData
Warning
The item takes ownership of the data object, deleting it when its not used anymore.

◆ setSymbol()

void QwtPlotVectorField::setSymbol ( QwtVectorFieldSymbol symbol)

Set a new arrow symbol.

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

Parameters
[in]symbolArrow symbol
Note
Ownership is transferred to QwtPlotVectorField.
See also
symbol(), drawSymbol()

◆ symbol()

const QwtVectorFieldSymbol * QwtPlotVectorField::symbol ( ) const

Get the arrow symbol.

Returns
Arrow symbol
See also
setSymbol(), drawSymbol()

◆ testMagnitudeMode()

bool QwtPlotVectorField::testMagnitudeMode ( MagnitudeMode  mode) const

Test a magnitude mode.

Returns
True when mode is enabled
See also
MagnitudeMode, setMagnitudeMode()

◆ testPaintAttribute()

bool QwtPlotVectorField::testPaintAttribute ( PaintAttribute  attribute) const

Test a paint attribute.

Returns
True when attribute is enabled
See also
PaintAttribute, setPaintAttribute()

The documentation for this class was generated from the following files: