| 
    QGIS API Documentation
    3.26.3-Buenos Aires (65e4edfdad)
    
   | 
 
 
 
 
Go to the documentation of this file.
   38   , visibleName( visibleName )
 
   39   , rendererCreateFunction( rendererFunction )
 
   40   , widgetCreateFunction( widgetFunction )
 
   69   mEntries.insert( entry.
name, entry );
 
   70   mSortedEntries.append( entry.
name );
 
   75   if ( !mEntries.contains( rendererName ) )
 
   79   mEntries[rendererName].widgetCreateFunction = func;
 
   84   const QHash< QString, QgsRasterRendererRegistryEntry >::const_iterator it = mEntries.find( rendererName );
 
   85   if ( it == mEntries.constEnd() )
 
   95   return mSortedEntries;
 
  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 ( drawingStyle )
 
  123       const int grayBand = 1; 
 
  133       const int grayBand = 1;
 
  145       const int bandNo = 1;
 
  149       minMaxValuesForBand( bandNo, provider, minValue, maxValue );
 
  158       int redBand = s.
value( QStringLiteral( 
"/Raster/defaultRedBand" ), 1 ).toInt();
 
  159       if ( redBand < 0 || redBand > provider->
bandCount() )
 
  163       int greenBand = s.
value( QStringLiteral( 
"/Raster/defaultGreenBand" ), 2 ).toInt();
 
  164       if ( greenBand < 0 || greenBand > provider->
bandCount() )
 
  168       int blueBand = s.
value( QStringLiteral( 
"/Raster/defaultBlueBand" ), 3 ).toInt();
 
  169       if ( blueBand < 0 || blueBand > provider->
bandCount() )
 
  187   const int bandCount = renderer->
usesBands().size();
 
  188   if ( bandCount == 1 )
 
  190     const QList<QgsRasterTransparency::TransparentSingleValuePixel> transparentSingleList;
 
  193   else if ( bandCount == 3 )
 
  195     const QList<QgsRasterTransparency::TransparentThreeValuePixel> transparentThreeValueList;
 
  202 bool QgsRasterRendererRegistry::minMaxValuesForBand( 
int band, 
QgsRasterDataProvider *provider, 
double &minValue, 
double &maxValue )
 const 
  213   if ( s.
value( QStringLiteral( 
"/Raster/useStandardDeviation" ), 
false ).toBool() )
 
  217     const double stdDevFactor = s.
value( QStringLiteral( 
"/Raster/defaultStandardDeviation" ), 2.0 ).toDouble();
 
  218     const double diff = stdDevFactor * stats.
stdDev;
 
  219     minValue = stats.
mean - diff;
 
  220     maxValue = stats.
mean + diff;
 
  
QList< QgsPalettedRasterRenderer::Class > ClassData
Map of value to class properties.
 
QgsRasterRenderer * defaultRendererForDrawingStyle(QgsRaster::DrawingStyle drawingStyle, QgsRasterDataProvider *provider) const
Creates a default renderer for a raster drawing style (considering user options such as default contr...
 
void setTransparentThreeValuePixelList(const QList< QgsRasterTransparency::TransparentThreeValuePixel > &newList)
Sets the transparent three value pixel list, replacing the whole existing list.
 
void setRasterTransparency(QgsRasterTransparency *t)
 
Qgis::DataType dataType(int bandNo) const override=0
Returns data type for the band specified by number.
 
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
 
virtual QgsRasterBandStats bandStatistics(int bandNo, int stats=QgsRasterBandStats::All, const QgsRectangle &extent=QgsRectangle(), int sampleSize=0, QgsRasterBlockFeedback *feedback=nullptr)
Returns the band statistics.
 
@ SingleBandColorDataStyle
 
The RasterBandStats struct is a container for statistics about a single raster band.
 
Registry for raster renderer entries.
 
DataType
Raster data types.
 
double mean
The mean cell value for the band. NO_DATA values are excluded.
 
DrawingStyle
This enumerator describes the different kinds of drawing we can do.
 
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
Factory method to create a new renderer.
 
Raster renderer pipe for single band gray.
 
QgsRasterRenderer *(* QgsRasterRendererCreateFunc)(const QDomElement &, QgsRasterInterface *input)
 
This class is a composition of two QSettings instances:
 
void insertWidgetFunction(const QString &rendererName, QgsRasterRendererWidgetCreateFunc func)
 
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
Creates an instance of the renderer based on definition from XML (used by renderer registry)
 
static QgsPalettedRasterRenderer::ClassData colorTableToClassData(const QList< QgsColorRampShader::ColorRampItem > &table)
Converts a raster color table to paletted renderer class data.
 
virtual QList< int > usesBands() const
Returns a list of band numbers used by the renderer.
 
Raster renderer pipe for single band color.
 
double maximumValue
The maximum cell value in the raster band.
 
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
 
Raster renderer pipe that applies colors to a raster.
 
QgsRasterRendererRegistry()
 
void setTransparentSingleValuePixelList(const QList< QgsRasterTransparency::TransparentSingleValuePixel > &newList)
Sets the transparent single value pixel list, replacing the whole existing list.
 
QList< QgsRasterRendererRegistryEntry > entries() const
 
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
 
QgsRasterRendererRegistryEntry()=default
Constructor for QgsRasterRendererRegistryEntry.
 
virtual QList< QgsColorRampShader::ColorRampItem > colorTable(int bandNo) const
 
Renderer for multiband images with the color components.
 
void insert(const QgsRasterRendererRegistryEntry &entry)
 
Renderer for paletted raster images.
 
Defines the list of pixel values to be considered as transparent or semi transparent when rendering r...
 
Manipulates raster or point cloud pixel values so that they enhanceContrast or clip into a specified ...
 
QgsRasterRendererWidget *(* QgsRasterRendererWidgetCreateFunc)(QgsRasterLayer *, const QgsRectangle &extent)
 
double minimumValue
The minimum cell value in the raster band.
 
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
 
bool rendererData(const QString &rendererName, QgsRasterRendererRegistryEntry &data) const
 
double stdDev
The standard deviation of the cell values.
 
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
 
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
 
Raster renderer pipe for single band pseudocolor.
 
virtual int bandCount() const =0
Gets number of bands.
 
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
 
Interface for all raster shaders.
 
@ MultiBandSingleBandGray
 
Base class for raster data providers.
 
QStringList renderersList() const