18#ifndef QGSRASTERVECTORFIELDVALUESOURCE_H
19#define QGSRASTERVECTORFIELDVALUESOURCE_H
53 QgsRasterVectorFieldValueSourceBase(
const QgsRectangle &blockExtent,
const QgsRectangle &dataExtent,
int columns,
int rows );
62 static constexpr int MAXIMUM_SEED_POINTS = 100'000;
69 virtual bool cellHasValue(
int row,
int column )
const = 0;
76 double mXResolution = 0;
77 double mYResolution = 0;
91class QgsRasterVectorFieldValueSource :
public QgsRasterVectorFieldValueSourceBase
101 QgsRasterVectorFieldValueSource(
102 std::shared_ptr<const QgsRasterBlock> xValues, std::shared_ptr<const QgsRasterBlock> yValues,
const QgsRectangle &blockExtent,
const QgsRectangle &dataExtent,
double maximumMagnitude
105 QgsRasterVectorFieldValueSource *clone()
const override;
106 QgsVector vectorValue(
const QgsPointXY &point )
const override;
107 double maximumMagnitude()
const override;
108 std::unique_ptr<QgsRasterInterface> magnitudeSource(
const QgsRenderContext &context, QSize size )
const override;
115 double sampledValue(
const QgsRasterBlock *block,
const QgsPointXY &point )
const;
117 bool cellHasValue(
int row,
int column )
const override;
119 std::shared_ptr<const QgsRasterBlock> mXValues;
120 std::shared_ptr<const QgsRasterBlock> mYValues;
121 double mMaximumMagnitude = 0;
138class CORE_EXPORT QgsRasterVectorFieldEncodedDirectionValueSource :
public QgsRasterVectorFieldValueSourceBase
147 QgsRasterVectorFieldEncodedDirectionValueSource( std::shared_ptr<const QgsRasterBlock> values,
Qgis::RasterDirectionEncoding encoding,
const QgsRectangle &blockExtent,
const QgsRectangle &dataExtent );
149 QgsRasterVectorFieldEncodedDirectionValueSource *clone()
const override;
150 QgsVector vectorValue(
const QgsPointXY &point )
const override;
153 double maximumMagnitude()
const override;
163 void setSamplingWindow(
double width,
double height )
override;
173 static QgsVector ordinalVector(
int ordinal );
177 int nearestOrdinal(
const QgsPointXY &point )
const;
180 int majorityOrdinal(
const QgsPointXY &point )
const;
182 bool cellHasValue(
int row,
int column )
const override;
184 std::shared_ptr<const QgsRasterBlock> mValues;
186 double mWindowWidth = 0;
187 double mWindowHeight = 0;
205 QgsRasterVectorFieldMagnitudeInterface( std::shared_ptr<const QgsRasterBlock> xValues, std::shared_ptr<const QgsRasterBlock> yValues,
const QgsRectangle &blockExtent );
207 QgsRasterInterface *
clone()
const override;
210 QgsRectangle
extent()
const override;
211 QgsRasterBlock *
block(
int bandNo,
const QgsRectangle &extent,
int width,
int height, QgsRasterBlockFeedback *feedback =
nullptr )
override;
214 std::shared_ptr<const QgsRasterBlock> mXValues;
215 std::shared_ptr<const QgsRasterBlock> mYValues;
216 QgsRectangle mBlockExtent;
DataType
Raster data types.
RasterDirectionEncoding
Schemes used to encode a compass direction as an integer raster value.
@ Esri
Esri: 1=E, 2=SE, 4=S, 8=SW, 16=W, 32=NW, 64=N, 128=NE.
Base class for processing filters like renderers, reprojector, resampler etc.
virtual QgsRasterInterface * clone() const =0
Clone itself, create deep copy.
virtual QgsRasterBlock * block(int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback=nullptr)=0
Read block of data using given extent and size.
virtual Qgis::DataType dataType(int bandNo) const =0
Returns data type for the band specified by number.
virtual int bandCount() const =0
Gets number of bands.
virtual QgsRectangle extent() const
Gets the extent of the interface.
A rectangle specified with double values.
Abstract source of vector (u/v) values sampled at arbitrary map positions.
virtual QgsRectangle extent() const =0
Returns the extent of the data, in map coordinates.
virtual QVector< QgsPointXY > seedPoints(const QgsRectangle &extent) const
Returns the natural seeding positions of the data within extent, in map coordinates.
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,...