29 name( theName ), visibleName( theVisibleName ), rendererCreateFunction( rendererFunction ),
30 widgetCreateFunction( widgetFunction )
75 if ( !
mEntries.contains( rendererName ) )
79 mEntries[rendererName].widgetCreateFunction = func;
84 QHash< QString, QgsRasterRendererRegistryEntry >::const_iterator it =
mEntries.find( rendererName );
100 QList< QgsRasterRendererRegistryEntry > result;
102 QHash< QString, QgsRasterRendererRegistryEntry >::const_iterator it =
mEntries.constBegin();
103 for ( ; it !=
mEntries.constEnd(); ++it )
105 result.push_back( it.value() );
112 if ( !provider || provider->
bandCount() < 1 )
119 switch ( theDrawingStyle )
124 QList<QgsColorRampShader::ColorRampItem> colorEntries = provider->
colorTable( grayBand );
127 int colorArraySize = 0;
128 QList<QgsColorRampShader::ColorRampItem>::const_iterator colorIt = colorEntries.constBegin();
129 for ( ; colorIt != colorEntries.constEnd(); ++colorIt )
131 if ( colorIt->value > colorArraySize )
133 colorArraySize = ( int )( colorIt->value );
138 QColor* colorArray =
new QColor[ colorArraySize ];
139 colorIt = colorEntries.constBegin();
140 for ( ; colorIt != colorEntries.constEnd(); ++colorIt )
142 colorArray[( int )( colorIt->value )] = colorIt->color;
179 int redBand = s.value(
"/Raster/defaultRedBand", 1 ).toInt();
180 if ( redBand < 0 || redBand > provider->
bandCount() )
184 int greenBand = s.value(
"/Raster/defaultGreenBand", 2 ).toInt();
185 if ( greenBand < 0 || greenBand > provider->
bandCount() )
189 int blueBand = s.value(
"/Raster/defaultBlueBand", 3 ).toInt();
190 if ( blueBand < 0 || blueBand > provider->
bandCount() )
208 int bandCount = renderer->
usesBands().size();
209 if ( bandCount == 1 )
211 QList<QgsRasterTransparency::TransparentSingleValuePixel> transparentSingleList;
214 else if ( bandCount == 3 )
216 QList<QgsRasterTransparency::TransparentThreeValuePixel> transparentThreeValueList;
234 if ( s.value(
"/Raster/useStandardDeviation",
false ).toBool() )
238 double stdDevFactor = s.value(
"/Raster/defaultStandardDeviation", 2.0 ).toDouble();
239 double diff = stdDevFactor * stats.
stdDev;
240 minValue = stats.
mean - diff;
241 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
DrawingStyle
This enumerator describes the different kinds of drawing we can do.
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
QgsRasterRendererRegistry()
void setTransparentSingleValuePixelList(QList< QgsRasterTransparency::TransparentSingleValuePixel >)
Mutator for transparentSingleValuePixelList.
double maximumValue
The maximum cell value in the raster band.
Registry for raster renderers.
QgsRasterRendererWidget *(* QgsRasterRendererWidgetCreateFunc)(QgsRasterLayer *, const QgsRectangle &extent)
QHash< QString, QgsRasterRendererRegistryEntry > mEntries
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.
QgsRasterRendererRegistryEntry()
void insert(QgsRasterRendererRegistryEntry entry)
Raster renderer pipe for single band pseudocolor.
virtual QGis::DataType dataType(int bandNo) const =0
Returns data type for the band specified by number.
static QgsRasterRendererRegistry * mInstance
~QgsRasterRendererRegistry()
Raster renderer pipe for single band gray.
QgsRasterRenderer * defaultRendererForDrawingStyle(const QgsRaster::DrawingStyle &theDrawingStyle, QgsRasterDataProvider *provider) const
Creates a default renderer for a raster drawing style (considering user options such as default contr...
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
QStringList mSortedEntries
Registry for raster renderer entries.
QgsRasterRenderer *(* QgsRasterRendererCreateFunc)(const QDomElement &, QgsRasterInterface *input)
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
DataType
Raster data types.
void setTransparentThreeValuePixelList(QList< QgsRasterTransparency::TransparentThreeValuePixel >)
Mutator for transparentThreeValuePixelList.
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...
bool minMaxValuesForBand(int band, QgsRasterDataProvider *provider, double &minValue, double &maxValue) 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.
Base class for raster data providers.
QStringList renderersList() const