29 name( theName ), visibleName( theVisibleName ), rendererCreateFunction( rendererFunction ),
30 widgetCreateFunction( widgetFunction )
60 mEntries.insert( entry.
name, entry );
61 mSortedEntries.append( entry.
name );
66 if ( !mEntries.contains( rendererName ) )
70 mEntries[rendererName].widgetCreateFunction = func;
86 return mSortedEntries;
94 for ( ; it != mEntries.
constEnd(); ++it )
103 if ( !provider || provider->
bandCount() < 1 )
110 switch ( theDrawingStyle )
118 int colorArraySize = 0;
120 for ( ; colorIt != colorEntries.
constEnd(); ++colorIt )
122 if ( colorIt->value > colorArraySize )
124 colorArraySize = ( int )( colorIt->value );
132 for ( ; colorIt != colorEntries.
constEnd(); ++colorIt )
134 int idx = ( int )( colorIt->value );
135 colorArray[idx] = colorIt->color;
136 if ( !colorIt->label.isEmpty() )
138 if ( labels.
size() <= idx ) labels.
resize( idx + 1 );
139 labels[idx] = colorIt->label;
169 minMaxValuesForBand( bandNo, provider, minValue, maxValue );
178 int redBand = s.
value(
"/Raster/defaultRedBand", 1 ).
toInt();
179 if ( redBand < 0 || redBand > provider->
bandCount() )
183 int greenBand = s.
value(
"/Raster/defaultGreenBand", 2 ).
toInt();
184 if ( greenBand < 0 || greenBand > provider->
bandCount() )
188 int blueBand = s.
value(
"/Raster/defaultBlueBand", 3 ).
toInt();
189 if ( blueBand < 0 || blueBand > provider->
bandCount() )
208 if ( bandCount == 1 )
213 else if ( bandCount == 3 )
222 bool QgsRasterRendererRegistry::minMaxValuesForBand(
int band,
QgsRasterDataProvider* provider,
double& minValue,
double& maxValue )
const 233 if ( s.
value(
"/Raster/useStandardDeviation",
false ).
toBool() )
237 double stdDevFactor = s.
value(
"/Raster/defaultStandardDeviation", 2.0 ).
toDouble();
238 double diff = stdDevFactor * stats.
stdDev;
239 minValue = stats.
mean - diff;
240 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)
virtual QList< int > usesBands() const
Returns a list of band numbers used by the renderer.
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
Renderer for paletted raster images.
bool rendererData(const QString &rendererName, QgsRasterRendererRegistryEntry &data) const
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)
QgsRasterRendererWidgetCreateFunc widgetCreateFunction
QgsRasterRendererRegistry()
QgsRasterRenderer *(* QgsRasterRendererCreateFunc)(const QDomElement &, QgsRasterInterface *input)
QgsRasterRenderer * defaultRendererForDrawingStyle(QgsRaster::DrawingStyle theDrawingStyle, QgsRasterDataProvider *provider) const
Creates a default renderer for a raster drawing style (considering user options such as default contr...
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.
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.
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)
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...
const_iterator constEnd() const
const_iterator constBegin() const
QList< QgsRasterRendererRegistryEntry > entries() const
virtual QList< QgsColorRampShader::ColorRampItem > colorTable(int bandNo) const
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.
QStringList renderersList() const