QGIS API Documentation 4.3.0-Master (52aa6503bed)
Loading...
Searching...
No Matches
qgsrastervectorfieldrenderer.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsrastervectorfieldrenderer.h
3 ------------------------------
4 begin : September 2026
5 copyright : (C) 2026 by Stefanos Natsis
6 email : uclaros at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSRASTERVECTORFIELDRENDERER_H
19#define QGSRASTERVECTORFIELDRENDERER_H
20
21#include <limits>
22
23#include "qgis_core.h"
24#include "qgis_sip.h"
25#include "qgsrasterrenderer.h"
27
39{
40 public:
44
49
51 Qgis::RasterRendererFlags flags() const override;
52
54 static std::unique_ptr<QgsRasterRenderer> create( const QDomElement &elem, QgsRasterInterface *input );
55
56 void writeXml( QDomDocument &doc, QDomElement &parentElem ) const override;
57
58 QgsRasterBlock *block( int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override SIP_FACTORY;
59
60 QList<int> usesBands() const override;
61 QList<QPair<QString, QColor>> legendSymbologyItems() const override;
62
68 Qgis::RasterVectorFieldSourceMode sourceMode() const { return mSourceMode; }
69
75 void setSourceMode( Qgis::RasterVectorFieldSourceMode mode ) { mSourceMode = mode; }
76
83 int directionBand() const { return mDirectionBand; }
84
92 bool setDirectionBand( int band );
93
99 Qgis::RasterDirectionEncoding directionEncoding() const { return mDirectionEncoding; }
100
106 void setDirectionEncoding( Qgis::RasterDirectionEncoding encoding ) { mDirectionEncoding = encoding; }
107
113 int xBand() const { return mXBand; }
114
122 bool setXBand( int band );
123
129 int yBand() const { return mYBand; }
130
138 bool setYBand( int band );
139
145 QgsVectorFieldSettings settings() const { return mSettings; }
146
152 void setSettings( const QgsVectorFieldSettings &settings ) { mSettings = settings; }
153
161 double minimumMagnitude() const { return mMinimumMagnitude; }
162
168 void setMinimumMagnitude( double magnitude ) { mMinimumMagnitude = magnitude; }
169
177 double maximumMagnitude() const { return mMaximumMagnitude; }
178
184 void setMaximumMagnitude( double magnitude ) { mMaximumMagnitude = magnitude; }
185
186 private:
187#ifdef SIP_RUN
190#endif
191
192 bool shouldAcceptBand( int band ) const;
193
195 int mXBand = 1;
196 int mYBand = 2;
197 int mDirectionBand = 1;
199 QgsVectorFieldSettings mSettings;
200 double mMinimumMagnitude = std::numeric_limits<double>::quiet_NaN();
201 double mMaximumMagnitude = std::numeric_limits<double>::quiet_NaN();
202};
203
204#endif // QGSRASTERVECTORFIELDRENDERER_H
Provides global constants and enumerations for use throughout the application.
Definition qgis.h:62
RasterVectorFieldSourceMode
Defines how a raster vector field renderer reads the vectors from the raster bands.
Definition qgis.h:7262
@ CartesianComponents
Two bands holding the x and y components of the vectors.
Definition qgis.h:7263
RasterDirectionEncoding
Schemes used to encode a compass direction as an integer raster value.
Definition qgis.h:7276
@ Esri
Esri: 1=E, 2=SE, 4=S, 8=SW, 16=W, 32=NW, 64=N, 128=NE.
Definition qgis.h:7277
Feedback object tailored for raster block reading.
Raster data container.
QgsRasterInterface(QgsRasterInterface *input=nullptr)
virtual QgsRectangle extent() const
Gets the extent of the interface.
virtual QgsRasterInterface * input() const
Current input.
QgsRasterRenderer(QgsRasterInterface *input=nullptr, const QString &type=QString())
Constructor for QgsRasterRenderer.
const QgsRasterRenderer & operator=(const QgsRasterRenderer &)=delete
QgsRasterRenderer cannot be copied. Use clone() instead.
QgsRasterRenderer * clone() const override=0
Clone itself, create deep copy.
Raster renderer which draws a vector field stored in raster bands.
void setMaximumMagnitude(double magnitude)
Sets the magnitude the symbology treats as the largest one of the raster.
void setSettings(const QgsVectorFieldSettings &settings)
Sets the settings used to render the vector field.
void setMinimumMagnitude(double magnitude)
Sets the magnitude the symbology treats as the smallest one of the raster.
QgsRasterBlock * block(int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback=nullptr) override
Read block of data using given extent and size.
Qgis::RasterRendererFlags flags() const override
Returns flags which dictate renderer behavior.
QgsRasterVectorFieldRenderer(const QgsRasterVectorFieldRenderer &)=delete
QgsRasterVectorFieldRenderer cannot be copied. Use clone() instead.
QgsRasterVectorFieldRenderer(QgsRasterInterface *input)
Creates a vector field renderer.
void setDirectionEncoding(Qgis::RasterDirectionEncoding encoding)
Sets the scheme the directionBand() is coded with.
QList< int > usesBands() const override
Returns a list of band numbers used by the renderer.
QList< QPair< QString, QColor > > legendSymbologyItems() const override
Returns symbology items if provided by renderer.
double maximumMagnitude() const
Returns the magnitude the symbology treats as the largest one of the raster.
int directionBand() const
Returns the band which holds the coded compass directions, used when the sourceMode() is Qgis::Raster...
int xBand() const
Returns the band which holds the x component of the vectors.
~QgsRasterVectorFieldRenderer() override
void writeXml(QDomDocument &doc, QDomElement &parentElem) const override
Write base class members to xml.
static std::unique_ptr< QgsRasterRenderer > create(const QDomElement &elem, QgsRasterInterface *input)
Creates an instance of the renderer based on definition from XML (used by renderer registry).
const QgsRasterVectorFieldRenderer & operator=(const QgsRasterVectorFieldRenderer &)=delete
QgsRasterVectorFieldRenderer cannot be copied. Use clone() instead.
void setSourceMode(Qgis::RasterVectorFieldSourceMode mode)
Sets the way the vectors are stored in the raster bands.
double minimumMagnitude() const
Returns the magnitude the symbology treats as the smallest one of the raster.
QgsVectorFieldSettings settings() const
Returns the settings used to render the vector field.
Qgis::RasterDirectionEncoding directionEncoding() const
Returns the scheme the directionBand() is coded with.
int yBand() const
Returns the band which holds the y component of the vectors.
Qgis::RasterVectorFieldSourceMode sourceMode() const
Returns the way the vectors are stored in the raster bands.
A rectangle specified with double values.
Represents a renderer settings for vector datasets.
#define SIP_FACTORY
Definition qgis_sip.h:83