QGIS API Documentation 4.3.0-Master (dfb0041329c)
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 QVector< QgsPointXY > seedPoints (const QgsRectangle &extent) const
 Returns the natural seeding positions of the data within extent, in map coordinates.
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 28 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.

◆ 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.

◆ 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: