qwt_plot_vectorfield.cpp
/******************************************************************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#include "qwt_plot_vectorfield.h"
#include "qwt_vectorfield_symbol.h"
#include "qwt_scale_map.h"
#include "qwt_color_map.h"
#include "qwt_painter.h"
#include "qwt_text.h"
#include "qwt_graphic.h"
#include "qwt_math.h"
#include <qpainter.h>
#include <qpainterpath.h>
#include <qdebug.h>
#include <cstdlib>
#include <limits>
#define DEBUG_RENDER 0
#if DEBUG_RENDER
#include <qelapsedtimer.h>
#endif
static inline double qwtVector2Radians( double vx, double vy )
{
if ( vx == 0.0 )
return ( vy >= 0 ) ? M_PI_2 : 3 * M_PI_2;
return std::atan2( vy, vx );
}
static inline double qwtVector2Magnitude( double vx, double vy )
{
return sqrt( vx * vx + vy * vy );
}
static QwtInterval qwtMagnitudeRange(
const QwtSeriesData< QwtVectorFieldSample >* series )
{
if ( series->size() == 0 )
return QwtInterval( 0, 1 );
const QwtVectorFieldSample s0 = series->sample( 0 );
double min = s0.vx * s0.vx + s0.vy * s0.vy;
double max = min;
for ( uint i = 1; i < series->size(); i++ )
{
const QwtVectorFieldSample s = series->sample( i );
const double l = s.vx * s.vx + s.vy * s.vy;
if ( l < min )
min = l;
if ( l > max )
max = l;
}
min = std::sqrt( min );
max = std::sqrt( max );
if ( max == min )
max += 1.0;
return QwtInterval( min, max );
}
static inline QTransform qwtSymbolTransformation(
const QTransform& oldTransform, double x, double y,
double vx, double vy, double magnitude )
{
QTransform transform = oldTransform;
if ( !transform.isIdentity() )
{
transform.translate( x, y );
const double radians = qwtVector2Radians( vx, vy );
transform.rotateRadians( radians );
}
else
{
/*
When starting with no transformation ( f.e on screen )
the matrix can be found without having to use
trigonometric functions
*/
qreal sin, cos;
if ( magnitude == 0.0 )
{
// something
sin = 1.0;
cos = 0.0;
}
else
{
sin = vy / magnitude;
cos = vx / magnitude;
}
transform.setMatrix( cos, sin, 0.0, -sin, cos, 0.0, x, y, 1.0 );
}
return transform;
}
namespace
{
class FilterMatrix
{
public:
class Entry
{
public:
inline void addSample( double sx, double sy,
double svx, double svy )
{
x += sx;
y += sy;
vx += svx;
vy += svy;
count++;
}
quint32 count;
// screen positions -> float is good enough
float x;
float y;
float vx;
float vy;
};
FilterMatrix( const QRectF& dataRect,
const QRectF& canvasRect, const QSizeF& cellSize )
{
m_dx = cellSize.width();
m_dy = cellSize.height();
m_x0 = dataRect.x();
if ( m_x0 < canvasRect.x() )
m_x0 += int( ( canvasRect.x() - m_x0 ) / m_dx ) * m_dx;
m_y0 = dataRect.y();
if ( m_y0 < canvasRect.y() )
m_y0 += int( ( canvasRect.y() - m_y0 ) / m_dy ) * m_dy;
m_numColumns = canvasRect.width() / m_dx + 1;
m_numRows = canvasRect.height() / m_dy + 1;
#if 1
/*
limit column and row count to a maximum of 1000000,
so that memory usage is not an issue
*/
if ( m_numColumns > 1000 )
{
m_dx = canvasRect.width() / 1000;
m_numColumns = canvasRect.width() / m_dx + 1;
}
if ( m_numRows > 1000 )
{
m_dy = canvasRect.height() / 1000;
m_numRows = canvasRect.height() / m_dx + 1;
}
#endif
m_x1 = m_x0 + m_numColumns * m_dx;
m_y1 = m_y0 + m_numRows * m_dy;
m_entries = ( Entry* )::calloc( m_numRows * m_numColumns, sizeof( Entry ) );
if ( m_entries == NULL )
{
qWarning() << "QwtPlotVectorField: raster for filtering too fine - running out of memory";
}
}
~FilterMatrix()
{
if ( m_entries )
std::free( m_entries );
}
inline int numColumns() const
{
return m_numColumns;
}
inline int numRows() const
{
return m_numRows;
}
inline void addSample( double x, double y,
double u, double v )
{
if ( x >= m_x0 && x < m_x1
&& y >= m_y0 && y < m_y1 )
{
Entry& entry = m_entries[ indexOf( x, y ) ];
entry.addSample( x, y, u, v );
}
}
const FilterMatrix::Entry* entries() const
{
return m_entries;
}
private:
inline int indexOf( qreal x, qreal y ) const
{
const int col = ( x - m_x0 ) / m_dx;
const int row = ( y - m_y0 ) / m_dy;
return row * m_numColumns + col;
}
qreal m_x0, m_x1, m_y0, m_y1, m_dx, m_dy;
int m_numColumns;
int m_numRows;
Entry* m_entries;
};
}
class QwtPlotVectorField::PrivateData
{
public:
PrivateData()
: pen( Qt::black )
, brush( Qt::black )
, indicatorOrigin( QwtPlotVectorField::OriginHead )
, magnitudeScaleFactor( 1.0 )
, rasterSize( 20, 20 )
, minArrowLength( 0.0 )
, maxArrowLength( std::numeric_limits< short >::max() )
, magnitudeModes( MagnitudeAsLength )
{
colorMap = NULL;
symbol = new QwtVectorFieldThinArrow();
}
~PrivateData()
{
delete colorMap;
delete symbol;
}
QPen pen;
QBrush brush;
IndicatorOrigin indicatorOrigin;
QwtVectorFieldSymbol* symbol;
QwtColorMap* colorMap;
/*
Stores the range of magnitudes to be used for the color map.
If invalid (min=max or negative values), the range is determined
from the data samples themselves.
*/
QwtInterval magnitudeRange;
QwtInterval boundingMagnitudeRange;
qreal magnitudeScaleFactor;
QSizeF rasterSize;
double minArrowLength;
double maxArrowLength;
PaintAttributes paintAttributes;
MagnitudeModes magnitudeModes;
};
QwtPlotVectorField::QwtPlotVectorField( const QwtText& title )
: QwtPlotSeriesItem( title )
{
init();
}
QwtPlotVectorField::QwtPlotVectorField( const QString& title )
: QwtPlotSeriesItem( QwtText( title ) )
{
init();
}
QwtPlotVectorField::~QwtPlotVectorField()
{
delete m_data;
}
void QwtPlotVectorField::init()
{
setItemAttribute( QwtPlotItem::Legend );
setItemAttribute( QwtPlotItem::AutoScale );
m_data = new PrivateData;
setData( new QwtVectorFieldData() );
setZ( 20.0 );
}
void QwtPlotVectorField::setPen( const QPen& pen )
{
if ( m_data->pen != pen )
{
m_data->pen = pen;
itemChanged();
legendChanged();
}
}
QPen QwtPlotVectorField::pen() const
{
return m_data->pen;
}
void QwtPlotVectorField::setBrush( const QBrush& brush )
{
if ( m_data->brush != brush )
{
m_data->brush = brush;
itemChanged();
legendChanged();
}
}
QBrush QwtPlotVectorField::brush() const
{
return m_data->brush;
}
void QwtPlotVectorField::setIndicatorOrigin( IndicatorOrigin origin )
{
m_data->indicatorOrigin = origin;
if ( m_data->indicatorOrigin != origin )
{
m_data->indicatorOrigin = origin;
itemChanged();
}
}
QwtPlotVectorField::IndicatorOrigin QwtPlotVectorField::indicatorOrigin() const
{
return m_data->indicatorOrigin;
}
void QwtPlotVectorField::setMagnitudeScaleFactor( double factor )
{
if ( factor != m_data->magnitudeScaleFactor )
{
m_data->magnitudeScaleFactor = factor;
itemChanged();
}
}
double QwtPlotVectorField::magnitudeScaleFactor() const
{
return m_data->magnitudeScaleFactor;
}
void QwtPlotVectorField::setRasterSize( const QSizeF& size )
{
if ( size != m_data->rasterSize )
{
m_data->rasterSize = size;
itemChanged();
}
}
QSizeF QwtPlotVectorField::rasterSize() const
{
return m_data->rasterSize;
}
void QwtPlotVectorField::setPaintAttribute(
PaintAttribute attribute, bool on )
{
PaintAttributes attributes = m_data->paintAttributes;
if ( on )
attributes |= attribute;
else
attributes &= ~attribute;
if ( m_data->paintAttributes != attributes )
{
m_data->paintAttributes = attributes;
itemChanged();
}
}
bool QwtPlotVectorField::testPaintAttribute(
PaintAttribute attribute ) const
{
return ( m_data->paintAttributes & attribute );
}
int QwtPlotVectorField::rtti() const
{
return QwtPlotItem::Rtti_PlotVectorField;
}
void QwtPlotVectorField::setSymbol( QwtVectorFieldSymbol* symbol )
{
if ( m_data->symbol == symbol )
return;
delete m_data->symbol;
m_data->symbol = symbol;
itemChanged();
legendChanged();
}
const QwtVectorFieldSymbol* QwtPlotVectorField::symbol() const
{
return m_data->symbol;
}
void QwtPlotVectorField::setSamples( const QVector< QwtVectorFieldSample >& samples )
{
setData( new QwtVectorFieldData( samples ) );
}
void QwtPlotVectorField::setSamples( QwtVectorFieldData* data )
{
setData( data );
}
void QwtPlotVectorField::setColorMap( QwtColorMap* colorMap )
{
if ( colorMap == NULL )
return;
if ( colorMap != m_data->colorMap )
{
delete m_data->colorMap;
m_data->colorMap = colorMap;
}
legendChanged();
itemChanged();
}
const QwtColorMap* QwtPlotVectorField::colorMap() const
{
return m_data->colorMap;
}
void QwtPlotVectorField::setMagnitudeMode( MagnitudeMode mode, bool on )
{
if ( on == testMagnitudeMode( mode ) )
return;
if ( on )
m_data->magnitudeModes |= mode;
else
m_data->magnitudeModes &= ~mode;
itemChanged();
}
bool QwtPlotVectorField::testMagnitudeMode( MagnitudeMode mode ) const
{
return m_data->magnitudeModes & mode;
}
void QwtPlotVectorField::setMagnitudeRange( const QwtInterval& magnitudeRange )
{
if ( m_data->magnitudeRange != magnitudeRange )
{
m_data->magnitudeRange = magnitudeRange;
itemChanged();
}
}
QwtInterval QwtPlotVectorField::magnitudeRange() const
{
return m_data->magnitudeRange;
}
void QwtPlotVectorField::setMinArrowLength( double length )
{
length = qMax( length, 0.0 );
if ( m_data->minArrowLength != length )
{
m_data->minArrowLength = length;
itemChanged();
}
}
double QwtPlotVectorField::minArrowLength() const
{
return m_data->minArrowLength;
}
void QwtPlotVectorField::setMaxArrowLength( double length )
{
length = qMax( length, 0.0 );
if ( m_data->maxArrowLength != length )
{
m_data->maxArrowLength = length;
itemChanged();
}
}
double QwtPlotVectorField::maxArrowLength() const
{
return m_data->maxArrowLength;
}
double QwtPlotVectorField::arrowLength( double magnitude ) const
{
#if 0
/*
Normalize magnitude with respect to value range. Then, magnitudeScaleFactor
is the number of pixels to draw for a vector of length equal to
magnitudeRange.maxValue(). The relative scaling ensures that change of data
samples of very different magnitudes will always lead to a reasonable
display on screen.
*/
const QwtVectorFieldData* vectorData = dynamic_cast< const QwtVectorFieldData* >( data() );
if ( m_data->magnitudeRange.maxValue() > 0 )
magnitude /= m_data->magnitudeRange.maxValue();
#endif
double length = magnitude * m_data->magnitudeScaleFactor;
if ( length > 0.0 )
length = qBound( m_data->minArrowLength, length, m_data->maxArrowLength );
return length;
}
QRectF QwtPlotVectorField::boundingRect() const
{
#if 0
/*
The bounding rectangle of the samples comes from the origins
only, but as we know the scaling factor for the magnitude
( qwtVector2Magnitude ) here, we could try to include it ?
*/
#endif
return QwtPlotSeriesItem::boundingRect();
}
QwtGraphic QwtPlotVectorField::legendIcon(
int index, const QSizeF& size ) const
{
Q_UNUSED( index );
QwtGraphic icon;
icon.setDefaultSize( size );
if ( size.isEmpty() )
return icon;
QPainter painter( &icon );
painter.setRenderHint( QPainter::Antialiasing,
testRenderHint( QwtPlotItem::RenderAntialiased ) );
painter.translate( -size.width(), -0.5 * size.height() );
painter.setPen( m_data->pen );
painter.setBrush( m_data->brush );
m_data->symbol->setLength( size.width() - 2 );
m_data->symbol->paint( &painter );
return icon;
}
void QwtPlotVectorField::drawSeries( QPainter* painter,
const QwtScaleMap& xMap, const QwtScaleMap& yMap,
const QRectF& canvasRect, int from, int to ) const
{
if ( !painter || dataSize() <= 0 )
return;
if ( to < 0 )
to = dataSize() - 1;
if ( from < 0 )
from = 0;
if ( from > to )
return;
#if DEBUG_RENDER
QElapsedTimer timer;
timer.start();
#endif
drawSymbols( painter, xMap, yMap, canvasRect, from, to );
#if DEBUG_RENDER
qDebug() << timer.elapsed();
#endif
}
void QwtPlotVectorField::drawSymbols( QPainter* painter,
const QwtScaleMap& xMap, const QwtScaleMap& yMap,
const QRectF& canvasRect, int from, int to ) const
{
const bool doAlign = QwtPainter::roundingAlignment( painter );
const bool doClip = false;
const bool isInvertingX = xMap.isInverting();
const bool isInvertingY = yMap.isInverting();
const QwtSeriesData< QwtVectorFieldSample >* series = data();
if ( m_data->magnitudeModes & MagnitudeAsColor )
{
// user input error, can't draw without color map
// TODO: Discuss! Without colormap, silently fall back to uniform colors?
if ( m_data->colorMap == NULL)
return;
}
else
{
painter->setPen( m_data->pen );
painter->setBrush( m_data->brush );
}
if ( ( m_data->paintAttributes & FilterVectors ) && !m_data->rasterSize.isEmpty() )
{
const QRectF dataRect = QwtScaleMap::transform(
xMap, yMap, boundingRect() );
// TODO: Discuss. How to handle raster size when switching from screen to print size!
// DPI-aware adjustment of rastersize? Or make "rastersize in screen coordinate"
// or "rastersize in plotcoordinetes" a user option?
#if 1
// define filter matrix based on screen/print coordinates
FilterMatrix matrix( dataRect, canvasRect, m_data->rasterSize );
#else
// define filter matrix based on real coordinates
// get scale factor from real coordinates to screen coordinates
double xScale = 1;
if (xMap.sDist() != 0)
xScale = xMap.pDist() / xMap.sDist();
double yScale = 1;
if (yMap.sDist() != 0)
yScale = yMap.pDist() / yMap.sDist();
QSizeF canvasRasterSize(xScale * m_data->rasterSize.width(), yScale * m_data->rasterSize.height() );
FilterMatrix matrix( dataRect, canvasRect, canvasRasterSize );
#endif
for ( int i = from; i <= to; i++ )
{
const QwtVectorFieldSample sample = series->sample( i );
if ( !sample.isNull() )
{
matrix.addSample( xMap.transform( sample.x ),
yMap.transform( sample.y ), sample.vx, sample.vy );
}
}
const int numEntries = matrix.numRows() * matrix.numColumns();
const FilterMatrix::Entry* entries = matrix.entries();
for ( int i = 0; i < numEntries; i++ )
{
const FilterMatrix::Entry& entry = entries[i];
if ( entry.count == 0 )
continue;
double xi = entry.x / entry.count;
double yi = entry.y / entry.count;
if ( doAlign )
{
xi = qRound( xi );
yi = qRound( yi );
}
const double vx = entry.vx / entry.count;
const double vy = entry.vy / entry.count;
drawSymbol( painter, xi, yi,
isInvertingX ? -vx : vx, isInvertingY ? -vy : vy );
}
}
else
{
for ( int i = from; i <= to; i++ )
{
const QwtVectorFieldSample sample = series->sample( i );
// arrows with zero length are never drawn
if ( sample.isNull() )
continue;
double xi = xMap.transform( sample.x );
double yi = yMap.transform( sample.y );
if ( doAlign )
{
xi = qRound( xi );
yi = qRound( yi );
}
if ( doClip )
{
if ( !canvasRect.contains( xi, yi ) )
continue;
}
drawSymbol( painter, xi, yi,
isInvertingX ? -sample.vx : sample.vx,
isInvertingY ? -sample.vy : sample.vy );
}
}
}
void QwtPlotVectorField::drawSymbol( QPainter* painter,
double x, double y, double vx, double vy ) const
{
const double magnitude = qwtVector2Magnitude( vx, vy );
const QTransform oldTransform = painter->transform();
QTransform transform = qwtSymbolTransformation( oldTransform,
x, y, vx, vy, magnitude );
QwtVectorFieldSymbol* symbol = m_data->symbol;
double length = 0.0;
if ( m_data->magnitudeModes & MagnitudeAsLength )
{
length = arrowLength( magnitude );
}
symbol->setLength( length );
if( m_data->indicatorOrigin == OriginTail )
{
const qreal dx = symbol->length();
transform.translate( dx, 0.0 );
}
else if ( m_data->indicatorOrigin == OriginCenter )
{
const qreal dx = symbol->length();
transform.translate( 0.5 * dx, 0.0 );
}
if ( m_data->magnitudeModes & MagnitudeAsColor )
{
// Determine color for arrow if colored by magnitude.
QwtInterval range = m_data->magnitudeRange;
if ( !range.isValid() )
{
if ( !m_data->boundingMagnitudeRange.isValid() )
m_data->boundingMagnitudeRange = qwtMagnitudeRange( data() );
range = m_data->boundingMagnitudeRange;
}
const QColor c = m_data->colorMap->rgb( range, magnitude );
#if 1
painter->setBrush( c );
painter->setPen( c );
#endif
}
painter->setWorldTransform( transform, false );
symbol->paint( painter );
painter->setWorldTransform( oldTransform, false );
}
void QwtPlotVectorField::dataChanged()
{
m_data->boundingMagnitudeRange.invalidate();
QwtPlotSeriesItem::dataChanged();
}
QVector
Definition: qwt_clipper.h:23
QwtColorMap
QwtColorMap is used to map values into colors.
Definition: qwt_color_map.h:38
QwtGraphic
A paint device for scalable graphics.
Definition: qwt_graphic.h:76
QwtGraphic::setDefaultSize
void setDefaultSize(const QSizeF &)
Set a default size.
Definition: qwt_graphic.cpp:553
QwtInterval
A class representing an interval.
Definition: qwt_interval.h:23
QwtInterval::isValid
bool isValid() const
Definition: qwt_interval.h:210
QwtPainter::roundingAlignment
static bool roundingAlignment()
Definition: qwt_painter.h:183
QwtPlotItem::legendChanged
virtual void legendChanged()
Definition: qwt_plot_item.cpp:491
QwtPlotItem::setZ
void setZ(double z)
Set the z value.
Definition: qwt_plot_item.cpp:165
QwtPlotItem::setItemAttribute
void setItemAttribute(ItemAttribute, bool on=true)
Definition: qwt_plot_item.cpp:228
QwtPlotItem::Rtti_PlotVectorField
@ Rtti_PlotVectorField
For QwtPlotVectorField.
Definition: qwt_plot_item.h:129
QwtPlotItem::RenderAntialiased
@ RenderAntialiased
Enable antialiasing.
Definition: qwt_plot_item.h:206
QwtPlotItem::testRenderHint
bool testRenderHint(RenderHint) const
Definition: qwt_plot_item.cpp:332
QwtPlotItem::itemChanged
virtual void itemChanged()
Definition: qwt_plot_item.cpp:481
QwtPlotItem::Legend
@ Legend
The item is represented on the legend.
Definition: qwt_plot_item.h:150
QwtPlotItem::AutoScale
@ AutoScale
Definition: qwt_plot_item.h:157
QwtPlotSeriesItem
Base class for plot items representing a series of samples.
Definition: qwt_plot_seriesitem.h:26
QwtPlotSeriesItem::dataChanged
virtual void dataChanged() override
dataChanged() indicates, that the series has been changed.
Definition: qwt_plot_seriesitem.cpp:112
QwtPlotSeriesItem::boundingRect
virtual QRectF boundingRect() const override
Definition: qwt_plot_seriesitem.cpp:97
QwtPlotVectorField
A plot item, that represents a vector field.
Definition: qwt_plot_vectorfield.h:33
QwtPlotVectorField::brush
QBrush brush() const
Definition: qwt_plot_vectorfield.cpp:379
QwtPlotVectorField::legendIcon
virtual QwtGraphic legendIcon(int index, const QSizeF &) const override
Definition: qwt_plot_vectorfield.cpp:770
QwtPlotVectorField::IndicatorOrigin
IndicatorOrigin
Definition: qwt_plot_vectorfield.h:40
QwtPlotVectorField::OriginCenter
@ OriginCenter
The arrow is centered at the sample position.
Definition: qwt_plot_vectorfield.h:48
QwtPlotVectorField::OriginHead
@ OriginHead
symbol points to the sample position
Definition: qwt_plot_vectorfield.h:42
QwtPlotVectorField::OriginTail
@ OriginTail
The arrow starts at the sample position.
Definition: qwt_plot_vectorfield.h:45
QwtPlotVectorField::rtti
virtual int rtti() const override
Definition: qwt_plot_vectorfield.cpp:503
QwtPlotVectorField::colorMap
const QwtColorMap * colorMap() const
Definition: qwt_plot_vectorfield.cpp:590
QwtPlotVectorField::magnitudeScaleFactor
double magnitudeScaleFactor() const
Definition: qwt_plot_vectorfield.cpp:440
QwtPlotVectorField::pen
QPen pen() const
Definition: qwt_plot_vectorfield.cpp:351
QwtPlotVectorField::setSamples
void setSamples(const QVector< QwtVectorFieldSample > &)
Definition: qwt_plot_vectorfield.cpp:541
QwtPlotVectorField::setRasterSize
void setRasterSize(const QSizeF &)
Definition: qwt_plot_vectorfield.cpp:450
QwtPlotVectorField::drawSeries
virtual void drawSeries(QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const override
Definition: qwt_plot_vectorfield.cpp:807
QwtPlotVectorField::setBrush
void setBrush(const QBrush &)
Assign a brush.
Definition: qwt_plot_vectorfield.cpp:364
QwtPlotVectorField::setMinArrowLength
void setMinArrowLength(double)
Definition: qwt_plot_vectorfield.cpp:658
QwtPlotVectorField::setSymbol
void setSymbol(QwtVectorFieldSymbol *)
Definition: qwt_plot_vectorfield.cpp:516
QwtPlotVectorField::testPaintAttribute
bool testPaintAttribute(PaintAttribute) const
Definition: qwt_plot_vectorfield.cpp:496
QwtPlotVectorField::drawSymbol
virtual void drawSymbol(QPainter *, double x, double y, double vx, double vy) const
Definition: qwt_plot_vectorfield.cpp:975
QwtPlotVectorField::boundingRect
virtual QRectF boundingRect() const override
Definition: qwt_plot_vectorfield.cpp:749
QwtPlotVectorField::testMagnitudeMode
bool testMagnitudeMode(MagnitudeMode) const
Definition: qwt_plot_vectorfield.cpp:619
QwtPlotVectorField::setMagnitudeScaleFactor
void setMagnitudeScaleFactor(double factor)
Set the magnitudeScaleFactor.
Definition: qwt_plot_vectorfield.cpp:417
QwtPlotVectorField::symbol
const QwtVectorFieldSymbol * symbol() const
Definition: qwt_plot_vectorfield.cpp:532
QwtPlotVectorField::setMaxArrowLength
void setMaxArrowLength(double)
Definition: qwt_plot_vectorfield.cpp:688
QwtPlotVectorField::drawSymbols
virtual void drawSymbols(QPainter *, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect, int from, int to) const
Definition: qwt_plot_vectorfield.cpp:847
QwtPlotVectorField::setColorMap
void setColorMap(QwtColorMap *)
Definition: qwt_plot_vectorfield.cpp:571
QwtPlotVectorField::MagnitudeMode
MagnitudeMode
Definition: qwt_plot_vectorfield.h:76
QwtPlotVectorField::MagnitudeAsLength
@ MagnitudeAsLength
Definition: qwt_plot_vectorfield.h:87
QwtPlotVectorField::MagnitudeAsColor
@ MagnitudeAsColor
Definition: qwt_plot_vectorfield.h:81
QwtPlotVectorField::PaintAttribute
PaintAttribute
Definition: qwt_plot_vectorfield.h:56
QwtPlotVectorField::QwtPlotVectorField
QwtPlotVectorField(const QString &title=QString())
Definition: qwt_plot_vectorfield.cpp:302
QwtPlotVectorField::setMagnitudeRange
void setMagnitudeRange(const QwtInterval &)
Definition: qwt_plot_vectorfield.cpp:632
QwtPlotVectorField::setPen
void setPen(const QPen &)
Definition: qwt_plot_vectorfield.cpp:336
QwtPlotVectorField::MagnitudeModes
QFlags< MagnitudeMode > MagnitudeModes
Definition: qwt_plot_vectorfield.h:90
QwtPlotVectorField::rasterSize
QSizeF rasterSize() const
Definition: qwt_plot_vectorfield.cpp:463
QwtPlotVectorField::~QwtPlotVectorField
virtual ~QwtPlotVectorField()
Destructor.
Definition: qwt_plot_vectorfield.cpp:309
QwtPlotVectorField::PaintAttributes
QFlags< PaintAttribute > PaintAttributes
Definition: qwt_plot_vectorfield.h:67
QwtPlotVectorField::setPaintAttribute
void setPaintAttribute(PaintAttribute, bool on=true)
Definition: qwt_plot_vectorfield.cpp:475
QwtPlotVectorField::maxArrowLength
double maxArrowLength() const
Definition: qwt_plot_vectorfield.cpp:705
QwtPlotVectorField::dataChanged
virtual void dataChanged() override
dataChanged() indicates, that the series has been changed.
Definition: qwt_plot_vectorfield.cpp:1034
QwtPlotVectorField::magnitudeRange
QwtInterval magnitudeRange() const
Definition: qwt_plot_vectorfield.cpp:645
QwtPlotVectorField::setIndicatorOrigin
void setIndicatorOrigin(IndicatorOrigin)
Definition: qwt_plot_vectorfield.cpp:390
QwtPlotVectorField::arrowLength
virtual double arrowLength(double magnitude) const
Definition: qwt_plot_vectorfield.cpp:726
QwtPlotVectorField::indicatorOrigin
IndicatorOrigin indicatorOrigin() const
Definition: qwt_plot_vectorfield.cpp:401
QwtPlotVectorField::minArrowLength
double minArrowLength() const
Definition: qwt_plot_vectorfield.cpp:675
QwtPlotVectorField::setMagnitudeMode
void setMagnitudeMode(MagnitudeMode, bool on=true)
Definition: qwt_plot_vectorfield.cpp:602
QwtScaleMap
A scale map.
Definition: qwt_scale_map.h:27
QwtScaleMap::isInverting
bool isInverting() const
Definition: qwt_scale_map.h:164
QwtScaleMap::pDist
double pDist() const
Definition: qwt_scale_map.h:115
QwtScaleMap::transform
double transform(double s) const
Definition: qwt_scale_map.h:137
QwtScaleMap::sDist
double sDist() const
Definition: qwt_scale_map.h:123
QwtSeriesData
Abstract interface for iterating over samples.
Definition: qwt_series_data.h:50
QwtSeriesData::size
virtual size_t size() const =0
QwtSeriesData::sample
virtual T sample(size_t i) const =0
QwtSeriesStore< QwtVectorFieldSample >::sample
QwtVectorFieldSample sample(int index) const
Definition: qwt_series_store.h:158
QwtSeriesStore< QwtVectorFieldSample >::dataSize
virtual size_t dataSize() const override
Definition: qwt_series_store.h:175
QwtSeriesStore< QwtVectorFieldSample >::data
QwtSeriesData< QwtVectorFieldSample > * data()
Definition: qwt_series_store.h:146
QwtSeriesStore< QwtVectorFieldSample >::setData
void setData(QwtSeriesData< QwtVectorFieldSample > *series)
Definition: qwt_series_store.h:164
QwtSeriesStore< QwtVectorFieldSample >::dataRect
virtual QRectF dataRect() const override
Definition: qwt_series_store.h:184
QwtText
A class representing a text.
Definition: qwt_text.h:52
QwtVectorFieldData
Interface for iterating over an array of vector field samples.
Definition: qwt_series_data.h:250
QwtVectorFieldSample
Sample used in vector fields.
Definition: qwt_samples.h:244
QwtVectorFieldSample::y
double y
y coordinate of the position
Definition: qwt_samples.h:260
QwtVectorFieldSample::isNull
bool isNull() const
Definition: qwt_samples.h:309
QwtVectorFieldSample::vx
double vx
x coordinate of the vector
Definition: qwt_samples.h:263
QwtVectorFieldSample::x
double x
x coordinate of the position
Definition: qwt_samples.h:257
QwtVectorFieldSample::vy
double vy
y coordinate of the vector
Definition: qwt_samples.h:266
QwtVectorFieldSymbol
Definition: qwt_vectorfield_symbol.h:33
QwtVectorFieldSymbol::length
virtual qreal length() const =0
QwtVectorFieldSymbol::paint
virtual void paint(QPainter *) const =0
Draw the symbol/arrow.
QwtVectorFieldSymbol::setLength
virtual void setLength(qreal length)=0
QwtVectorFieldThinArrow
Definition: qwt_vectorfield_symbol.h:82