QGIS API Documentation
3.0.2-Girona (307d082)
|
A ramp shader will color a raster pixel based on a list of values ranges in a ramp. More...
#include <qgscolorrampshader.h>
Classes | |
struct | ColorRampItem |
Public Types | |
enum | ClassificationMode { Continuous = 1, EqualInterval = 2, Quantile = 3 } |
Classification modes used to create the color ramp shader. More... | |
enum | Type { Interpolated, Discrete, Exact } |
Supported methods for color interpolation. More... | |
Public Member Functions | |
QgsColorRampShader (double minimumValue=0.0, double maximumValue=255.0, QgsColorRamp *colorRamp=nullptr, Type type=Interpolated, ClassificationMode classificationMode=Continuous) | |
Creates a new color ramp shader. More... | |
QgsColorRampShader (const QgsColorRampShader &other) | |
Copy constructor. More... | |
ClassificationMode | classificationMode () const |
Returns the classification mode. More... | |
void | classifyColorRamp (const int classes=0, const int band=-1, const QgsRectangle &extent=QgsRectangle(), QgsRasterInterface *input=nullptr) |
Classify color ramp shader. More... | |
void | classifyColorRamp (const int band=-1, const QgsRectangle &extent=QgsRectangle(), QgsRasterInterface *input=nullptr) |
Classify color ramp shader. More... | |
bool | clip () const |
Returns whether the shader will clip values which are out of range. More... | |
QList< QgsColorRampShader::ColorRampItem > | colorRampItemList () const |
Get the custom colormap. More... | |
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... | |
QgsColorRampShader & | operator= (const QgsColorRampShader &other) |
Assignment operator. More... | |
void | setClassificationMode (ClassificationMode classificationMode) |
Sets classification mode. More... | |
void | setClip (bool clip) |
Sets whether the shader should not render values out of range. More... | |
void | setColorRampItemList (const QList< QgsColorRampShader::ColorRampItem > &list) |
Set custom colormap. More... | |
void | setColorRampType (QgsColorRampShader::Type colorRampType) |
Set the color ramp type. More... | |
void | setColorRampType (const QString &type) |
Set the color ramp type. More... | |
void | setSourceColorRamp (QgsColorRamp *colorramp) |
Set the source color ramp. More... | |
bool | shade (double value, int *returnRedValue, int *returnGreenValue, int *returnBlueValue, int *returnAlphaValue) override |
Generates and new RGB value based on one input value. More... | |
bool | shade (double redValue, double greenValue, double blueValue, double alphaValue, int *returnRedValue, int *returnGreenValue, int *returnBlueValue, int *returnAlphaValue) override |
Generates and new RGB value based on original RGB value. More... | |
QgsColorRamp * | sourceColorRamp () const |
Get the source color ramp. More... | |
Public Member Functions inherited from QgsRasterShaderFunction | |
QgsRasterShaderFunction (double minimumValue=0.0, double maximumValue=255.0) | |
virtual | ~QgsRasterShaderFunction ()=default |
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 | |
std::unique_ptr< QgsColorRamp > | mSourceColorRamp |
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... | |
A ramp shader will color a raster pixel based on a list of values ranges in a ramp.
Definition at line 39 of file qgscolorrampshader.h.
Classification modes used to create the color ramp shader.
Enumerator | |
---|---|
Continuous | Uses breaks from color palette. |
EqualInterval | Uses equal interval. |
Quantile | Uses quantile (i.e. equal pixel) count. |
Definition at line 53 of file qgscolorrampshader.h.
Supported methods for color interpolation.
Definition at line 45 of file qgscolorrampshader.h.
QgsColorRampShader::QgsColorRampShader | ( | double | minimumValue = 0.0 , |
double | maximumValue = 255.0 , |
||
QgsColorRamp * | colorRamp = nullptr , |
||
Type | type = Interpolated , |
||
ClassificationMode | classificationMode = Continuous |
||
) |
Creates a new color ramp shader.
minimumValue | minimum value for the raster shader |
maximumValue | maximum value for the raster shader |
type | interpolation type used |
classificationMode | method used to classify the color ramp shader |
colorRamp | vector color ramp used to classify the color ramp shader |
Definition at line 33 of file qgscolorrampshader.cpp.
QgsColorRampShader::QgsColorRampShader | ( | const QgsColorRampShader & | other | ) |
Copy constructor.
Definition at line 43 of file qgscolorrampshader.cpp.
|
inline |
Returns the classification mode.
Definition at line 169 of file qgscolorrampshader.h.
void QgsColorRampShader::classifyColorRamp | ( | const int | classes = 0 , |
const int | band = -1 , |
||
const QgsRectangle & | extent = QgsRectangle() , |
||
QgsRasterInterface * | input = nullptr |
||
) |
Classify color ramp shader.
classes | number of classes |
band | raster band used in classification (only used in quantile mode) |
extent | extent used in classification (only used in quantile mode) |
input | raster input used in classification (only used in quantile mode) |
Definition at line 122 of file qgscolorrampshader.cpp.
void QgsColorRampShader::classifyColorRamp | ( | const int | band = -1 , |
const QgsRectangle & | extent = QgsRectangle() , |
||
QgsRasterInterface * | input = nullptr |
||
) |
Classify color ramp shader.
band | raster band used in classification (quantile mode only) |
extent | extent used in classification (quantile mode only) |
input | raster input used in classification (quantile mode only) |
Definition at line 301 of file qgscolorrampshader.cpp.
|
inline |
Returns whether the shader will clip values which are out of range.
Definition at line 182 of file qgscolorrampshader.h.
|
inline |
Get the custom colormap.
Definition at line 105 of file qgscolorrampshader.h.
|
inline |
Get the color ramp type.
Definition at line 108 of file qgscolorrampshader.h.
QString QgsColorRampShader::colorRampTypeAsQString | ( | ) |
Get the color ramp type as a string.
Definition at line 69 of file qgscolorrampshader.cpp.
|
overridevirtual |
Get symbology items if provided by renderer.
Reimplemented from QgsRasterShaderFunction.
Definition at line 467 of file qgscolorrampshader.cpp.
QgsColorRampShader & QgsColorRampShader::operator= | ( | const QgsColorRampShader & | other | ) |
Assignment operator.
Definition at line 56 of file qgscolorrampshader.cpp.
|
inline |
Sets classification mode.
Definition at line 166 of file qgscolorrampshader.h.
|
inline |
Sets whether the shader should not render values out of range.
clip | set to true to clip values which are out of range. |
Definition at line 176 of file qgscolorrampshader.h.
void QgsColorRampShader::setColorRampItemList | ( | const QList< QgsColorRampShader::ColorRampItem > & | list | ) |
Set custom colormap.
Definition at line 83 of file qgscolorrampshader.cpp.
void QgsColorRampShader::setColorRampType | ( | QgsColorRampShader::Type | colorRampType | ) |
Set the color ramp type.
Definition at line 91 of file qgscolorrampshader.cpp.
void QgsColorRampShader::setColorRampType | ( | const QString & | type | ) |
Set the color ramp type.
Definition at line 96 of file qgscolorrampshader.cpp.
void QgsColorRampShader::setSourceColorRamp | ( | QgsColorRamp * | colorramp | ) |
Set the source color ramp.
Ownership is transferred to the renderer.
Definition at line 117 of file qgscolorrampshader.cpp.
|
overridevirtual |
Generates and new RGB value based on one input value.
Reimplemented from QgsRasterShaderFunction.
Definition at line 306 of file qgscolorrampshader.cpp.
|
overridevirtual |
Generates and new RGB value based on original RGB value.
Reimplemented from QgsRasterShaderFunction.
Definition at line 449 of file qgscolorrampshader.cpp.
QgsColorRamp * QgsColorRampShader::sourceColorRamp | ( | ) | const |
Get the source color ramp.
Definition at line 112 of file qgscolorrampshader.cpp.
|
protected |
Source color ramp.
Definition at line 187 of file qgscolorrampshader.h.