21#ifndef QGSCOLORRAMPSHADER_H
22#define QGSCOLORRAMPSHADER_H
66 if ( mColorRampItemList.count() != other.mColorRampItemList.count() ||
67 mClassificationMode != other.mClassificationMode ||
68 mColorRampType != other.mColorRampType )
72 for (
int i = 0; i < mColorRampItemList.count(); ++i )
74 if ( mColorRampItemList.at( i ) != other.mColorRampItemList.at( i ) )
return false;
81 return !( *
this == other );
93 ColorRampItem(
double val,
const QColor &col,
const QString &lbl = QString() )
110 ( std::isnan(
value ) != std::isnan( other.
value ) );
119 QList<QgsColorRampShader::ColorRampItem>
colorRampItemList()
const {
return mColorRampItemList.toList(); }
129 QString colorRampTypeAsQString()
const;
136 void setColorRampItemList(
const QList<QgsColorRampShader::ColorRampItem> &list );
149 bool isEmpty()
const;
170 void setColorRampType( const QString &type );
189 bool shade(
double value,
int *returnRedValue
SIP_OUT,
int *returnGreenValue
SIP_OUT,
int *returnBlueValue
SIP_OUT,
int *returnAlphaValue
SIP_OUT ) const override;
190 bool shade(
double redValue,
double greenValue,
191 double blueValue,
double alphaValue,
193 int *returnBlueValue
SIP_OUT,
int *returnAlphaValue
SIP_OUT ) const override;
194 void legendSymbologyItems( QList< QPair< QString, QColor > > &symbolItems
SIP_OUT ) const override;
233 bool clip()
const {
return mClip; }
267 QVector<QgsColorRampShader::ColorRampItem> mColorRampItemList;
276 mutable std::vector<int> mLUT;
277 mutable double mLUTOffset = 0.0;
278 mutable double mLUTFactor = 1.0;
279 mutable bool mLUTInitialized =
false;
284 std::unique_ptr< QgsColorRampLegendNodeSettings > mLegendSettings;
Provides global constants and enumerations 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.
~QgsColorRampShader() override
Qgis::ShaderClassificationMethod classificationMode() const
Returns the classification mode.
Qgis::ShaderInterpolationMethod colorRampType() const
Returns the color ramp interpolation method.
bool operator!=(const QgsColorRampShader &other) const
void setClassificationMode(Qgis::ShaderClassificationMethod classificationMode)
Sets the classification mode.
QList< QgsColorRampShader::ColorRampItem > colorRampItemList() const
Returns the custom color map.
bool operator==(const QgsColorRampShader &other) const
QgsColorRampShader & operator=(const QgsColorRampShader &other)
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.
QgsColorRampShader(double minimumValue=0.0, double maximumValue=255.0, QgsColorRamp *colorRamp=nullptr, Qgis::ShaderInterpolationMethod type=Qgis::ShaderInterpolationMethod::Linear, Qgis::ShaderClassificationMethod classificationMode=Qgis::ShaderClassificationMethod::Continuous)
Creates a new color ramp shader.
std::unique_ptr< QgsColorRamp > mSourceColorRamp
Source color ramp.
Abstract base class for color ramps.
Base class for processing filters like renderers, reprojector, resampler etc.
QgsRasterShaderFunction(double minimumValue=0.0, double maximumValue=255.0)
double maximumValue() const
Returns the minimum value for the raster shader.
double minimumValue() const
Returns the maximum value for the raster shader.
A container for the context for various read/write operations on 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