QGIS API Documentation  2.99.0-Master (37c43df)
Classes | Public Types | Public Member Functions | Protected Attributes | 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)
 
 QgsColorRampShader (const QgsColorRampShader &other)
 Copy constructor. More...
 
virtual ~QgsColorRampShader ()
 Destructor. More...
 
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
 Get symbology items if provided by renderer. More...
 
QgsColorRampShaderoperator= (const QgsColorRampShader &other)
 Assignment operator. 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...
 
void setSourceColorRamp (QgsColorRamp *colorramp)
 Set the source color ramp. 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...
 
QgsColorRampsourceColorRamp () const
 Get the source color ramp. 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...
 

Protected Attributes

QScopedPointer< QgsColorRampmSourceColorRamp
 Source color ramp. More...
 
- 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 33 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 76 of file qgscolorrampshader.h.

Constructor & Destructor Documentation

§ QgsColorRampShader() [1/2]

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

Definition at line 32 of file qgscolorrampshader.cpp.

§ ~QgsColorRampShader()

QgsColorRampShader::~QgsColorRampShader ( )
virtual

Destructor.

Definition at line 65 of file qgscolorrampshader.cpp.

§ QgsColorRampShader() [2/2]

QgsColorRampShader::QgsColorRampShader ( const QgsColorRampShader other)

Copy constructor.

Definition at line 43 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 131 of file qgscolorrampshader.h.

§ colorRampItemList()

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

Get the custom colormap.

Definition at line 84 of file qgscolorrampshader.h.

§ colorRampType()

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

Get the color ramp type.

Definition at line 87 of file qgscolorrampshader.h.

§ colorRampTypeAsQString()

QString QgsColorRampShader::colorRampTypeAsQString ( )

Get the color ramp type as a string.

Definition at line 69 of file qgscolorrampshader.cpp.

§ legendSymbologyItems()

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

Get symbology items if provided by renderer.

Reimplemented from QgsRasterShaderFunction.

Definition at line 281 of file qgscolorrampshader.cpp.

§ operator=()

QgsColorRampShader & QgsColorRampShader::operator= ( const QgsColorRampShader other)

Assignment operator.

Definition at line 54 of file qgscolorrampshader.cpp.

§ 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 126 of file qgscolorrampshader.h.

§ setColorRampItemList()

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

Set custom colormap.

Definition at line 83 of file qgscolorrampshader.cpp.

§ setColorRampType() [1/2]

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

Set the color ramp type.

Definition at line 91 of file qgscolorrampshader.cpp.

§ setColorRampType() [2/2]

void QgsColorRampShader::setColorRampType ( const QString &  theType)

Set the color ramp type.

Definition at line 96 of file qgscolorrampshader.cpp.

§ setSourceColorRamp()

void QgsColorRampShader::setSourceColorRamp ( QgsColorRamp colorramp)

Set the source color ramp.

Ownership is transferred to the renderer.

Note
added in QGIS 3.0
See also
sourceColorRamp()

Definition at line 117 of file qgscolorrampshader.cpp.

§ 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 123 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 263 of file qgscolorrampshader.cpp.

§ sourceColorRamp()

QgsColorRamp * QgsColorRampShader::sourceColorRamp ( ) const

Get the source color ramp.

Note
added in QGIS 3.0
See also
setSourceColorRamp()

Definition at line 112 of file qgscolorrampshader.cpp.

Member Data Documentation

§ mSourceColorRamp

QScopedPointer<QgsColorRamp> QgsColorRampShader::mSourceColorRamp
protected

Source color ramp.

Definition at line 136 of file qgscolorrampshader.h.


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