37 , visibleName( visibleName )
38 , rendererCreateFunction( rendererFunction )
39 , widgetCreateFunction( widgetFunction )
66 mEntries.insert( entry.
name, entry );
67 mSortedEntries.append( entry.
name );
72 if ( !mEntries.contains( rendererName ) )
76 mEntries[rendererName].widgetCreateFunction = func;
81 QHash< QString, QgsRasterRendererRegistryEntry >::const_iterator it = mEntries.find( rendererName );
82 if ( it == mEntries.constEnd() )
92 return mSortedEntries;
97 QList< QgsRasterRendererRegistryEntry > result;
99 QHash< QString, QgsRasterRendererRegistryEntry >::const_iterator it = mEntries.constBegin();
100 for ( ; it != mEntries.constEnd(); ++it )
102 result.push_back( it.value() );
109 if ( !provider || provider->
bandCount() < 1 )
116 switch ( drawingStyle )
146 minMaxValuesForBand( bandNo, provider, minValue, maxValue );
155 int redBand = s.
value( QStringLiteral(
"/Raster/defaultRedBand" ), 1 ).toInt();
156 if ( redBand < 0 || redBand > provider->
bandCount() )
160 int greenBand = s.
value( QStringLiteral(
"/Raster/defaultGreenBand" ), 2 ).toInt();
161 if ( greenBand < 0 || greenBand > provider->
bandCount() )
165 int blueBand = s.
value( QStringLiteral(
"/Raster/defaultBlueBand" ), 3 ).toInt();
166 if ( blueBand < 0 || blueBand > provider->
bandCount() )
184 int bandCount = renderer->
usesBands().size();
185 if ( bandCount == 1 )
187 QList<QgsRasterTransparency::TransparentSingleValuePixel> transparentSingleList;
190 else if ( bandCount == 3 )
192 QList<QgsRasterTransparency::TransparentThreeValuePixel> transparentThreeValueList;
199 bool QgsRasterRendererRegistry::minMaxValuesForBand(
int band,
QgsRasterDataProvider *provider,
double &minValue,
double &maxValue )
const 210 if ( s.
value( QStringLiteral(
"/Raster/useStandardDeviation" ),
false ).toBool() )
214 double stdDevFactor = s.
value( QStringLiteral(
"/Raster/defaultStandardDeviation" ), 2.0 ).toDouble();
215 double diff = stdDevFactor * stats.
stdDev;
216 minValue = stats.
mean - diff;
217 maxValue = stats.
mean + diff;
virtual int bandCount() const =0
Gets number of bands.
Interface for all raster shaders.
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
void setTransparentThreeValuePixelList(const QList< QgsRasterTransparency::TransparentThreeValuePixel > &newList)
Sets the transparent three value pixel list, replacing the whole existing list.
Renderer for paletted raster images.
This class is a composition of two QSettings instances:
DrawingStyle
This enumerator describes the different kinds of drawing we can do.
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
virtual QList< QgsColorRampShader::ColorRampItem > colorTable(int bandNo) const
virtual QList< int > usesBands() const
Returns a list of band numbers used by the renderer.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
QgsRasterRendererRegistry()
QgsRasterRenderer *(* QgsRasterRendererCreateFunc)(const QDomElement &, QgsRasterInterface *input)
DataType
Raster data types.
double maximumValue
The maximum cell value in the raster band.
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon.
QgsRasterRendererRegistryEntry()=default
Constructor for QgsRasterRendererRegistryEntry.
Raster renderer pipe for single band color.
bool rendererData(const QString &rendererName, QgsRasterRendererRegistryEntry &data) const
double stdDev
The standard deviation of the cell values.
The RasterBandStats struct is a container for statistics about a single raster band.
double mean
The mean cell value for the band. NO_DATA values are excluded.
QList< QgsPalettedRasterRenderer::Class > ClassData
Map of value to class properties.
void insert(const QgsRasterRendererRegistryEntry &entry)
QgsRasterRenderer * defaultRendererForDrawingStyle(QgsRaster::DrawingStyle drawingStyle, QgsRasterDataProvider *provider) const
Creates a default renderer for a raster drawing style (considering user options such as default contr...
Raster renderer pipe for single band pseudocolor.
Raster renderer pipe for single band gray.
QgsRasterRendererWidget *(* QgsRasterRendererWidgetCreateFunc)(QgsRasterLayer *, const QgsRectangle &extent)
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
QStringList renderersList() const
void setTransparentSingleValuePixelList(const QList< QgsRasterTransparency::TransparentSingleValuePixel > &newList)
Sets the transparent single value pixel list, replacing the whole existing list.
Registry for raster renderer entries.
virtual QgsRasterBandStats bandStatistics(int bandNo, int stats=QgsRasterBandStats::All, const QgsRectangle &extent=QgsRectangle(), int sampleSize=0, QgsRasterBlockFeedback *feedback=nullptr)
Returns the band statistics.
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
double minimumValue
The minimum cell value in the raster band.
Renderer for multiband images with the color components.
Manipulates raster pixel values so that they enhanceContrast or clip into a specified numerical range...
Defines the list of pixel values to be considered as transparent or semi transparent when rendering r...
QList< QgsRasterRendererRegistryEntry > entries() const
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
Factory method to create a new renderer.
void setRasterTransparency(QgsRasterTransparency *t)
static QgsPalettedRasterRenderer::ClassData colorTableToClassData(const QList< QgsColorRampShader::ColorRampItem > &table)
Converts a raster color table to paletted renderer class data.
void insertWidgetFunction(const QString &rendererName, QgsRasterRendererWidgetCreateFunc func)
Raster renderer pipe that applies colors to a raster.
Qgis::DataType dataType(int bandNo) const override=0
Returns data type for the band specified by number.
Base class for raster data providers.