21#ifndef QGSCOLORRAMPSHADER_H
22#define QGSCOLORRAMPSHADER_H
65 if ( mColorRampItemList.count() != other.mColorRampItemList.count() ||
66 mClassificationMode != other.mClassificationMode ||
67 mColorRampType != other.mColorRampType )
71 for (
int i = 0; i < mColorRampItemList.count(); ++i )
73 if ( mColorRampItemList.at( i ) != other.mColorRampItemList.at( i ) )
return false;
87 ColorRampItem(
double val,
const QColor &col,
const QString &lbl = QString() )
102 return ( color != other.
color ) ||
103 ( !std::isnan( value ) && !std::isnan( other.
value ) && value != other.
value ) ||
104 ( std::isnan( value ) != std::isnan( other.
value ) );
113 QList<QgsColorRampShader::ColorRampItem>
colorRampItemList()
const {
return mColorRampItemList.toList(); }
123 QString colorRampTypeAsQString()
const;
130 void setColorRampItemList(
const QList<QgsColorRampShader::ColorRampItem> &list );
143 bool isEmpty()
const;
164 void setColorRampType( const QString &type );
183 bool shade(
double value,
int *returnRedValue
SIP_OUT,
int *returnGreenValue
SIP_OUT,
int *returnBlueValue
SIP_OUT,
int *returnAlphaValue
SIP_OUT ) const override;
184 bool shade(
double redValue,
double greenValue,
185 double blueValue,
double alphaValue,
187 int *returnBlueValue
SIP_OUT,
int *returnAlphaValue
SIP_OUT ) const override;
188 void legendSymbologyItems( QList< QPair< QString, QColor > > &symbolItems
SIP_OUT ) const override;
207 void setClassificationMode(
Qgis::ShaderClassificationMethod classificationMode ) { mClassificationMode = classificationMode; }
227 bool clip()
const {
return mClip; }
261 QVector<QgsColorRampShader::ColorRampItem> mColorRampItemList;
270 mutable std::vector<int> mLUT;
271 mutable double mLUTOffset = 0.0;
272 mutable double mLUTFactor = 1.0;
273 mutable bool mLUTInitialized =
false;
278 std::unique_ptr< QgsColorRampLegendNodeSettings > mLegendSettings;
The Qgis class provides global constants for use throughout the application.
ShaderInterpolationMethod
Color ramp shader interpolation methods.
@ Linear
Interpolates the color between two class breaks linearly.
ShaderClassificationMethod
Color ramp shader classification methods.
@ Continuous
Uses breaks from color palette.
Settings for a color ramp legend node.
A ramp shader will color a raster pixel based on a list of values ranges in a ramp.
~QgsColorRampShader() override
Qgis::ShaderClassificationMethod classificationMode() const
Returns the classification mode.
Qgis::ShaderInterpolationMethod colorRampType() const
Returns the color ramp interpolation method.
QList< QgsColorRampShader::ColorRampItem > colorRampItemList() const
Returns the custom color map.
bool operator==(const QgsColorRampShader &other) const
void setClip(bool clip)
Sets whether the shader should not render values out of range.
bool clip() const
Returns whether the shader will clip values which are out of range.
std::unique_ptr< QgsColorRamp > mSourceColorRamp
Source color ramp.
Abstract base class for color ramps.
Base class for processing filters like renderers, reprojector, resampler etc.
The raster shade function applies a shader to a pixel at render time - typically used to render grays...
The class is used as a container of context for various read/write operations on other objects.
A rectangle specified with double values.
ColorRampItem(double val, const QColor &col, const QString &lbl=QString())
convenience constructor
bool operator!=(const QgsColorRampShader::ColorRampItem &other) const
bool operator<(const QgsColorRampShader::ColorRampItem &other) const