21#ifndef QGSCOLORRAMPSHADER_H
22#define QGSCOLORRAMPSHADER_H
87 if ( mColorRampItemList.count() != other.mColorRampItemList.count() ||
88 mClassificationMode != other.mClassificationMode ||
89 mColorRampType != other.mColorRampType )
93 for (
int i = 0; i < mColorRampItemList.count(); ++i )
95 if ( mColorRampItemList.at( i ) != other.mColorRampItemList.at( i ) )
return false;
109 ColorRampItem(
double val,
const QColor &col,
const QString &lbl = QString() )
124 return ( color != other.
color ) ||
125 ( !std::isnan( value ) && !std::isnan( other.
value ) && value != other.
value ) ||
126 ( std::isnan( value ) != std::isnan( other.
value ) );
131 QList<QgsColorRampShader::ColorRampItem>
colorRampItemList()
const {
return mColorRampItemList.toList(); }
137 QString colorRampTypeAsQString()
const;
140 void setColorRampItemList(
const QList<QgsColorRampShader::ColorRampItem> &list );
149 bool isEmpty()
const;
172 void setColorRampType( const QString &type );
192 bool shade(
double value,
int *returnRedValue
SIP_OUT,
int *returnGreenValue
SIP_OUT,
int *returnBlueValue
SIP_OUT,
int *returnAlphaValue
SIP_OUT ) const override;
195 bool shade(
double redValue,
double greenValue,
196 double blueValue,
double alphaValue,
198 int *returnBlueValue
SIP_OUT,
int *returnAlphaValue
SIP_OUT ) const override;
200 void legendSymbologyItems( QList< QPair< QString, QColor > > &symbolItems
SIP_OUT ) const override;
215 void setClassificationMode(
ClassificationMode classificationMode ) { mClassificationMode = classificationMode; }
231 bool clip()
const {
return mClip; }
265 QVector<QgsColorRampShader::ColorRampItem> mColorRampItemList;
274 mutable std::vector<int> mLUT;
275 mutable double mLUTOffset = 0.0;
276 mutable double mLUTFactor = 1.0;
277 mutable bool mLUTInitialized =
false;
282 std::unique_ptr< QgsColorRampLegendNodeSettings > mLegendSettings;
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
ClassificationMode classificationMode() const
Returns the classification mode.
Type colorRampType() const
Returns the color ramp type.
QList< QgsColorRampShader::ColorRampItem > colorRampItemList() const
Returns the custom colormap.
bool operator==(const QgsColorRampShader &other) const
ClassificationMode
Classification modes used to create the color ramp shader.
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.
Type
Supported methods for color interpolation.
@ Interpolated
Interpolates the color between two class breaks linearly.
@ Discrete
Assigns the color of the higher class for every pixel between two class breaks.
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
ColorRampItem()=default
default constructor