34 , visibleName( theVisibleName )
35 , rendererCreateFunction( rendererFunction )
36 , widgetCreateFunction( widgetFunction )
73 mEntries.insert( entry.
name, entry );
74 mSortedEntries.append( entry.
name );
79 if ( !mEntries.contains( rendererName ) )
83 mEntries[rendererName].widgetCreateFunction = func;
99 return mSortedEntries;
107 for ( ; it != mEntries.
constEnd(); ++it )
116 if ( !provider || provider->
bandCount() < 1 )
123 switch ( theDrawingStyle )
131 int colorArraySize = 0;
133 for ( ; colorIt != colorEntries.
constEnd(); ++colorIt )
135 if ( colorIt->value > colorArraySize )
137 colorArraySize = ( int )( colorIt->value );
145 for ( ; colorIt != colorEntries.
constEnd(); ++colorIt )
147 int idx = ( int )( colorIt->value );
148 colorArray[idx] = colorIt->color;
149 if ( !colorIt->label.isEmpty() )
151 if ( labels.
size() <= idx ) labels.
resize( idx + 1 );
152 labels[idx] = colorIt->label;
182 minMaxValuesForBand( bandNo, provider, minValue, maxValue );
191 int redBand = s.
value(
"/Raster/defaultRedBand", 1 ).
toInt();
192 if ( redBand < 0 || redBand > provider->
bandCount() )
196 int greenBand = s.
value(
"/Raster/defaultGreenBand", 2 ).
toInt();
197 if ( greenBand < 0 || greenBand > provider->
bandCount() )
201 int blueBand = s.
value(
"/Raster/defaultBlueBand", 3 ).
toInt();
202 if ( blueBand < 0 || blueBand > provider->
bandCount() )
221 if ( bandCount == 1 )
226 else if ( bandCount == 3 )
235 bool QgsRasterRendererRegistry::minMaxValuesForBand(
int band,
QgsRasterDataProvider* provider,
double& minValue,
double& maxValue )
const 246 if ( s.
value(
"/Raster/useStandardDeviation",
false ).
toBool() )
250 double stdDevFactor = s.
value(
"/Raster/defaultStandardDeviation", 2.0 ).
toDouble();
251 double diff = stdDevFactor * stats.
stdDev;
252 minValue = stats.
mean - diff;
253 maxValue = stats.
mean + diff;
virtual int bandCount() const =0
Get number of bands.
Interface for all raster shaders.
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
Renderer for paletted raster images.
void push_back(const T &value)
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.
QgsRasterRendererWidgetCreateFunc widgetCreateFunction
static QIcon getThemeIcon(const QString &theName)
Helper to get a theme icon.
QgsRasterRendererRegistry()
QgsRasterRenderer *(* QgsRasterRendererCreateFunc)(const QDomElement &, QgsRasterInterface *input)
double maximumValue
The maximum cell value in the raster band.
void setTransparentThreeValuePixelList(const QList< TransparentThreeValuePixel > &theNewList)
Mutator for transparentThreeValuePixelList.
Registry for raster renderers.
QString tr(const char *sourceText, const char *disambiguation, int n)
Raster renderer pipe for single band color.
bool rendererData(const QString &rendererName, QgsRasterRendererRegistryEntry &data) const
virtual QgsRasterBandStats bandStatistics(int theBandNo, int theStats=QgsRasterBandStats::All, const QgsRectangle &theExtent=QgsRectangle(), int theSampleSize=0)
Get band statistics.
double stdDev
The standard deviation of the cell values.
The RasterBandStats struct is a container for statistics about a single raster band.
static QgsRasterRendererRegistry * instance()
double mean
The mean cell value for the band.
const_iterator constEnd() const
int toInt(bool *ok) const
QgsRasterRendererRegistryEntry()
void insert(const QgsRasterRendererRegistryEntry &entry)
Raster renderer pipe for single band pseudocolor.
Raster renderer pipe for single band gray.
QgsRasterRenderer * defaultRendererForDrawingStyle(QgsRaster::DrawingStyle theDrawingStyle, QgsRasterDataProvider *provider) const
Creates a default renderer for a raster drawing style (considering user options such as default contr...
QgsRasterRendererWidget *(* QgsRasterRendererWidgetCreateFunc)(QgsRasterLayer *, const QgsRectangle &extent)
const T value(const Key &key) const
iterator find(const Key &key)
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
QStringList renderersList() const
Registry for raster renderer entries.
virtual QGis::DataType dataType(int bandNo) const override=0
Returns data type for the band specified by number.
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
QVariant value(const QString &key, const QVariant &defaultValue) const
const_iterator constBegin() const
void setTransparentSingleValuePixelList(const QList< TransparentSingleValuePixel > &theNewList)
Mutator for transparentSingleValuePixelList.
DataType
Raster data types.
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...
double toDouble(bool *ok) const
Defines the list of pixel values to be considered as transparent or semi transparent when rendering r...
QList< QgsRasterRendererRegistryEntry > entries() const
const_iterator constEnd() const
const_iterator constBegin() const
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
Factory method to create a new renderer.
void setRasterTransparency(QgsRasterTransparency *t)
void insertWidgetFunction(const QString &rendererName, QgsRasterRendererWidgetCreateFunc func)
Raster renderer pipe that applies colors to a raster.
QgsRasterRendererCreateFunc rendererCreateFunction
Base class for raster data providers.