QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
Classes | Public Types | Public Member Functions | List of all members
QgsColorRampShader Class Reference

A ramp shader will color a raster pixel based on a list of values ranges in a ramp. More...

#include <qgscolorrampshader.h>

Inheritance diagram for QgsColorRampShader:
Inheritance graph
[legend]

Classes

struct  ColorRampItem
 

Public Types

enum  ColorRamp_TYPE { INTERPOLATED, DISCRETE, EXACT }
 Supported methods for color interpolation. More...
 

Public Member Functions

 QgsColorRampShader (double theMinimumValue=0.0, double theMaximumValue=255.0)
 
bool clip () const
 Returns whether the shader will clip values which are out of range. More...
 
QList< QgsColorRampShader::ColorRampItemcolorRampItemList () const
 Get the custom colormap. More...
 
QgsColorRampShader::ColorRamp_TYPE colorRampType () const
 Get the color ramp type. More...
 
QString colorRampTypeAsQString ()
 Get the color ramp type as a string. More...
 
void legendSymbologyItems (QList< QPair< QString, QColor > > &symbolItems) const override
 
Q_DECL_DEPRECATED int maximumColorCacheSize ()
 Get the maximum size the color cache can be. More...
 
void setClip (bool clip)
 Sets whether the shader should not render values out of range. More...
 
void setColorRampItemList (const QList< QgsColorRampShader::ColorRampItem > &theList)
 Set custom colormap. More...
 
void setColorRampType (QgsColorRampShader::ColorRamp_TYPE theColorRampType)
 Set the color ramp type. More...
 
void setColorRampType (const QString &theType)
 Set the color ramp type. More...
 
Q_DECL_DEPRECATED void setMaximumColorCacheSize (int theSize)
 Set the maximum size the color cache can be. More...
 
bool shade (double, int *, int *, int *, int *) override
 Generates and new RGB value based on one input value. More...
 
bool shade (double, double, double, double, int *, int *, int *, int *) override
 Generates and new RGB value based on original RGB value. More...
 
- Public Member Functions inherited from QgsRasterShaderFunction
 QgsRasterShaderFunction (double theMinimumValue=0.0, double theMaximumValue=255.0)
 
virtual ~QgsRasterShaderFunction ()
 
double maximumValue () const
 
double minimumMaximumRange () const
 
double minimumValue () const
 
virtual void setMaximumValue (double)
 Set the maximum value. More...
 
virtual void setMinimumValue (double)
 Return the minimum value. More...
 

Additional Inherited Members

- Protected Attributes inherited from QgsRasterShaderFunction
double mMaximumValue
 User defineable maximum value for the shading function. More...
 
double mMinimumMaximumRange
 Minimum maximum range for the shading function. More...
 
double mMinimumValue
 User defineable minimum value for the shading function. More...
 

Detailed Description

A ramp shader will color a raster pixel based on a list of values ranges in a ramp.

Definition at line 32 of file qgscolorrampshader.h.

Member Enumeration Documentation

◆ ColorRamp_TYPE

Supported methods for color interpolation.

Enumerator
INTERPOLATED 

Interpolates the color between two class breaks linearly.

DISCRETE 

Assigns the color of the higher class for every pixel between two class breaks.

EXACT 

Assigns the color of the exact matching value in the color ramp item list.

Definition at line 62 of file qgscolorrampshader.h.

Constructor & Destructor Documentation

◆ QgsColorRampShader()

QgsColorRampShader::QgsColorRampShader ( double  theMinimumValue = 0.0,
double  theMaximumValue = 255.0 
)

Definition at line 31 of file qgscolorrampshader.cpp.

Member Function Documentation

◆ clip()

bool QgsColorRampShader::clip ( ) const
inline

Returns whether the shader will clip values which are out of range.

See also
setClip()

Definition at line 114 of file qgscolorrampshader.h.

◆ colorRampItemList()

QList<QgsColorRampShader::ColorRampItem> QgsColorRampShader::colorRampItemList ( ) const
inline

Get the custom colormap.

Definition at line 70 of file qgscolorrampshader.h.

◆ colorRampType()

QgsColorRampShader::ColorRamp_TYPE QgsColorRampShader::colorRampType ( ) const
inline

Get the color ramp type.

Definition at line 73 of file qgscolorrampshader.h.

◆ colorRampTypeAsQString()

QString QgsColorRampShader::colorRampTypeAsQString ( )

Get the color ramp type as a string.

Definition at line 42 of file qgscolorrampshader.cpp.

◆ legendSymbologyItems()

void QgsColorRampShader::legendSymbologyItems ( QList< QPair< QString, QColor > > &  symbolItems) const
overridevirtual

Reimplemented from QgsRasterShaderFunction.

Definition at line 243 of file qgscolorrampshader.cpp.

◆ maximumColorCacheSize()

Q_DECL_DEPRECATED int QgsColorRampShader::maximumColorCacheSize ( )
inline

Get the maximum size the color cache can be.

Deprecated:
will be removed in QGIS 3.0.

Color cache is not used anymore.

Definition at line 81 of file qgscolorrampshader.h.

◆ setClip()

void QgsColorRampShader::setClip ( bool  clip)
inline

Sets whether the shader should not render values out of range.

Parameters
clipset to true to clip values which are out of range.
See also
clip()

Definition at line 109 of file qgscolorrampshader.h.

◆ setColorRampItemList()

void QgsColorRampShader::setColorRampItemList ( const QList< QgsColorRampShader::ColorRampItem > &  theList)

Set custom colormap.

Definition at line 56 of file qgscolorrampshader.cpp.

◆ setColorRampType() [1/2]

void QgsColorRampShader::setColorRampType ( QgsColorRampShader::ColorRamp_TYPE  theColorRampType)

Set the color ramp type.

Definition at line 64 of file qgscolorrampshader.cpp.

◆ setColorRampType() [2/2]

void QgsColorRampShader::setColorRampType ( const QString theType)

Set the color ramp type.

Definition at line 69 of file qgscolorrampshader.cpp.

◆ setMaximumColorCacheSize()

Q_DECL_DEPRECATED void QgsColorRampShader::setMaximumColorCacheSize ( int  theSize)
inline

Set the maximum size the color cache can be.

Deprecated:
will be removed in QGIS 3.0.

Color cache is not used anymore.

Definition at line 95 of file qgscolorrampshader.h.

◆ shade() [1/2]

bool QgsColorRampShader::shade ( double  theValue,
int *  theReturnRedValue,
int *  theReturnGreenValue,
int *  theReturnBlueValue,
int *  theReturnAlphaValue 
)
overridevirtual

Generates and new RGB value based on one input value.

Reimplemented from QgsRasterShaderFunction.

Definition at line 85 of file qgscolorrampshader.cpp.

◆ shade() [2/2]

bool QgsColorRampShader::shade ( double  theRedValue,
double  theGreenValue,
double  theBlueValue,
double  theAlphaValue,
int *  theReturnRedValue,
int *  theReturnGreenValue,
int *  theReturnBlueValue,
int *  theReturnAlphaValue 
)
overridevirtual

Generates and new RGB value based on original RGB value.

Reimplemented from QgsRasterShaderFunction.

Definition at line 225 of file qgscolorrampshader.cpp.


The documentation for this class was generated from the following files: