QGIS API Documentation 4.3.0-Master (c8cdfe19d7b)
Loading...
Searching...
No Matches
QgsVectorFieldValueSource Class Referenceabstract

Abstract source of vector (u/v) values sampled at arbitrary map positions. More...

#include <qgsvectorfieldvaluesource.h>

Public Member Functions

 QgsVectorFieldValueSource ()=default
virtual ~QgsVectorFieldValueSource ()
virtual QgsVectorFieldValueSource * clone () const =0
 Returns a copy of this source.
virtual QgsRectangle extent () const =0
 Returns the extent of the data, in map coordinates.
virtual std::unique_ptr< QgsRasterInterface > magnitudeSource (const QgsRenderContext &context, QSize size) const
 Returns a raster interface exposing the magnitude of the vector field as a single band, used to build the color ramp background image of streamlines, or nullptr if the source cannot provide one.
virtual double maximumMagnitude () const =0
 Returns the maximum magnitude over the whole data.
virtual bool nativeLayout (QgsPointXY &origin, double &spacingX, double &spacingY) const
 Returns the grid on which the data itself is sampled through origin, spacingX and spacingY, all in map coordinates, and returns false when the data is not regularly spaced.
virtual QVector< QgsPointXY > seedPoints (const QgsRectangle &extent) const
 Returns the natural seeding positions of the data within extent, in map coordinates.
virtual void setSamplingWindow (double width, double height)
 Tells the source that each value it is asked for stands for a cell of width by height map units, so that a source which cannot meaningfully interpolate can reduce the cell to the single value which represents it best.
virtual QgsVector vectorValue (const QgsPointXY &point) const =0
 Returns the vector value at point, expressed in map coordinates.

Detailed Description

Abstract source of vector (u/v) values sampled at arbitrary map positions.

This is the data abstraction used by the streamline and particle trace symbologies of QgsVectorFieldEngine, which walk the vector field rather than being handed one value at a time. Implementations exist for mesh layers (interpolating from vertices or faces) and for raster layers (sampling two bands).

Note
not available in Python bindings
Since
QGIS 4.4

Definition at line 47 of file qgsvectorfieldvaluesource.h.

Constructor & Destructor Documentation

◆ QgsVectorFieldValueSource()

QgsVectorFieldValueSource::QgsVectorFieldValueSource ( )
default

◆ ~QgsVectorFieldValueSource()

QgsVectorFieldValueSource::~QgsVectorFieldValueSource ( )
virtualdefault

Member Function Documentation

◆ clone()

virtual QgsVectorFieldValueSource * QgsVectorFieldValueSource::clone ( ) const
pure virtual

Returns a copy of this source.

◆ extent()

virtual QgsRectangle QgsVectorFieldValueSource::extent ( ) const
pure virtual

Returns the extent of the data, in map coordinates.

◆ magnitudeSource()

std::unique_ptr< QgsRasterInterface > QgsVectorFieldValueSource::magnitudeSource ( const QgsRenderContext & context,
QSize size ) const
virtual

Returns a raster interface exposing the magnitude of the vector field as a single band, used to build the color ramp background image of streamlines, or nullptr if the source cannot provide one.

context is a render context whose map to pixel is set to the field, and size is the size in pixels of the image which will be requested from the returned interface.

Definition at line 42 of file qgsvectorfieldvaluesource.cpp.

◆ maximumMagnitude()

virtual double QgsVectorFieldValueSource::maximumMagnitude ( ) const
pure virtual

Returns the maximum magnitude over the whole data.

This is used to nondimensionalize the time a trace spends in a field pixel, so it must be stable for the whole rendering, not recomputed per tile or per extent.

◆ nativeLayout()

bool QgsVectorFieldValueSource::nativeLayout ( QgsPointXY & origin,
double & spacingX,
double & spacingY ) const
virtual

Returns the grid on which the data itself is sampled through origin, spacingX and spacingY, all in map coordinates, and returns false when the data is not regularly spaced.

This is the glyph placement used when the settings do not ask for a user defined grid. The default implementation returns false, for the sources whose data has no regular spacing.

Definition at line 28 of file qgsvectorfieldvaluesource.cpp.

◆ seedPoints()

QVector< QgsPointXY > QgsVectorFieldValueSource::seedPoints ( const QgsRectangle & extent) const
virtual

Returns the natural seeding positions of the data within extent, in map coordinates.

These are the mesh vertices for a mesh source, or the pixel centers for a raster one. The default implementation returns an empty list, for sources which have no natural seeding positions.

Definition at line 22 of file qgsvectorfieldvaluesource.cpp.

◆ setSamplingWindow()

void QgsVectorFieldValueSource::setSamplingWindow ( double width,
double height )
virtual

Tells the source that each value it is asked for stands for a cell of width by height map units, so that a source which cannot meaningfully interpolate can reduce the cell to the single value which represents it best.

The default implementation does nothing, for the sources which are sampled point by point.

Definition at line 36 of file qgsvectorfieldvaluesource.cpp.

◆ vectorValue()

virtual QgsVector QgsVectorFieldValueSource::vectorValue ( const QgsPointXY & point) const
pure virtual

Returns the vector value at point, expressed in map coordinates.

Returns a vector with NaN components when no data is available at that position, which is how the callers detect that a trace has left the data.


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