29 name( theName ), visibleName( theVisibleName ), rendererCreateFunction( rendererFunction ),
30 widgetCreateFunction( widgetFunction )
70 if ( !mEntries.
contains( rendererName ) )
74 mEntries[rendererName].widgetCreateFunction = func;
90 return mSortedEntries;
98 for ( ; it != mEntries.
constEnd(); ++it )
107 if ( !provider || provider->
bandCount() < 1 )
114 switch ( theDrawingStyle )
122 int colorArraySize = 0;
124 for ( ; colorIt != colorEntries.
constEnd(); ++colorIt )
126 if ( colorIt->value > colorArraySize )
128 colorArraySize = ( int )( colorIt->value );
136 for ( ; colorIt != colorEntries.
constEnd(); ++colorIt )
138 int idx = ( int )( colorIt->value );
139 colorArray[idx] = colorIt->color;
140 if ( !colorIt->label.isEmpty() )
142 if ( labels.
size() <= idx ) labels.
resize( idx + 1 );
143 labels[idx] = colorIt->label;
173 minMaxValuesForBand( bandNo, provider, minValue, maxValue );
182 int redBand = s.
value(
"/Raster/defaultRedBand", 1 ).
toInt();
183 if ( redBand < 0 || redBand > provider->
bandCount() )
187 int greenBand = s.
value(
"/Raster/defaultGreenBand", 2 ).
toInt();
188 if ( greenBand < 0 || greenBand > provider->
bandCount() )
192 int blueBand = s.
value(
"/Raster/defaultBlueBand", 3 ).
toInt();
193 if ( blueBand < 0 || blueBand > provider->
bandCount() )
212 if ( bandCount == 1 )
217 else if ( bandCount == 3 )
226 bool QgsRasterRendererRegistry::minMaxValuesForBand(
int band,
QgsRasterDataProvider* provider,
double& minValue,
double& maxValue )
const
237 if ( s.
value(
"/Raster/useStandardDeviation",
false ).
toBool() )
241 double stdDevFactor = s.
value(
"/Raster/defaultStandardDeviation", 2.0 ).
toDouble();
242 double diff = stdDevFactor * stats.
stdDev;
243 minValue = stats.
mean - diff;
244 maxValue = stats.
mean + diff;
virtual int bandCount() const =0
Get number of bands.
Interface for all raster shaders.
iterator insert(const Key &key, const T &value)
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)
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)
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.
void append(const T &value)
const_iterator constEnd() const
int toInt(bool *ok) const
QgsRasterRendererRegistryEntry()
void insert(QgsRasterRendererRegistryEntry entry)
Raster renderer pipe for single band pseudocolor.
~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...
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.
QgsRasterRenderer *(* QgsRasterRendererCreateFunc)(const QDomElement &, QgsRasterInterface *input)
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
QVariant value(const QString &key, const QVariant &defaultValue) const
const_iterator constBegin() const
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...
double toDouble(bool *ok) const
bool contains(const Key &key) 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.
Base class for raster data providers.
QStringList renderersList() const