QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
Loading...
Searching...
No Matches
qgssinglebandpseudocolorrenderer.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgssinglebandpseudocolorrenderer.cpp
3 ------------------------------------
4 begin : January 2012
5 copyright : (C) 2012 by Marco Hugentobler
6 email : marco at sourcepole dot ch
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
19
20#include "qgscolorramp.h"
22#include "qgscolorrampshader.h"
23#include "qgsrastershader.h"
25#include "qgssldexportcontext.h"
27
28#include <QDomDocument>
29#include <QDomElement>
30#include <QImage>
31#include <QString>
32
33using namespace Qt::StringLiterals;
34
36 : QgsRasterRenderer( input, u"singlebandpseudocolor"_s )
37 , mShader( shader )
38 , mBand( band )
39 , mClassificationMin( std::numeric_limits<double>::quiet_NaN() )
40 , mClassificationMax( std::numeric_limits<double>::quiet_NaN() )
41{}
42
44{
45 setInputBand( bandNo );
46}
47
49{
50 return mBand;
51}
52
54{
55 if ( !mInput )
56 {
57 mBand = band;
58 return true;
59 }
60 else if ( band > 0 && band <= mInput->bandCount() )
61 {
62 mBand = band;
63 return true;
64 }
65 return false;
66}
67
69{
70 mClassificationMin = min;
71 if ( auto *lShader = shader() )
72 {
73 QgsColorRampShader *colorRampShader = dynamic_cast<QgsColorRampShader *>( lShader->rasterShaderFunction() );
74 if ( colorRampShader )
75 {
76 colorRampShader->setMinimumValue( min );
77 }
78 }
79}
80
82{
83 mClassificationMax = max;
84 if ( auto *lShader = shader() )
85 {
86 QgsColorRampShader *colorRampShader = dynamic_cast<QgsColorRampShader *>( lShader->rasterShaderFunction() );
87 if ( colorRampShader )
88 {
89 colorRampShader->setMaximumValue( max );
90 }
91 }
92}
93
95{
96 QgsRasterShader *shader = nullptr;
97
98 if ( mShader )
99 {
100 shader = new QgsRasterShader( mShader->minimumValue(), mShader->maximumValue() );
101
102 // Shader function
103 const QgsColorRampShader *origColorRampShader = dynamic_cast<const QgsColorRampShader *>( mShader->rasterShaderFunction() );
104
105 if ( origColorRampShader )
106 {
107 QgsColorRampShader *colorRampShader = new QgsColorRampShader( *origColorRampShader );
108 shader->setRasterShaderFunction( colorRampShader );
109 }
110 }
112 renderer->copyCommonProperties( this );
113
114 return renderer;
115}
116
121
126
128 QgsColorRamp *colorRamp, Qgis::ShaderInterpolationMethod colorRampType, Qgis::ShaderClassificationMethod classificationMode, int classes, bool clip, const QgsRectangle &extent
129)
130{
131 if ( mBand == -1 || classificationMin() >= classificationMax() )
132 {
133 return;
134 }
135
136 QgsColorRampShader *colorRampShader = new QgsColorRampShader( classificationMin(), classificationMax(), colorRamp, colorRampType, classificationMode );
137 colorRampShader->classifyColorRamp( classes, mBand, extent, input() );
138 colorRampShader->setClip( clip );
139
140 QgsRasterShader *rasterShader = new QgsRasterShader();
141 rasterShader->setRasterShaderFunction( colorRampShader );
142 setShader( rasterShader );
143}
144
146{
147 if ( elem.isNull() )
148 {
149 return nullptr;
150 }
151
152 const int band = elem.attribute( u"band"_s, u"-1"_s ).toInt();
153 QgsRasterShader *shader = nullptr;
154 const QDomElement rasterShaderElem = elem.firstChildElement( u"rastershader"_s );
155 if ( !rasterShaderElem.isNull() )
156 {
157 shader = new QgsRasterShader();
158 shader->readXml( rasterShaderElem );
159 }
160
162 r->readXml( elem );
163
164 // TODO: add _readXML in superclass?
165 r->setClassificationMin( elem.attribute( u"classificationMin"_s, u"NaN"_s ).toDouble() );
166 r->setClassificationMax( elem.attribute( u"classificationMax"_s, u"NaN"_s ).toDouble() );
167
168 // Backward compatibility with serialization of QGIS 2.X era
169 const QString minMaxOrigin = elem.attribute( u"classificationMinMaxOrigin"_s );
170 if ( !minMaxOrigin.isEmpty() )
171 {
172 if ( minMaxOrigin.contains( "MinMax"_L1 ) )
173 {
175 }
176 else if ( minMaxOrigin.contains( "CumulativeCut"_L1 ) )
177 {
179 }
180 else if ( minMaxOrigin.contains( "StdDev"_L1 ) )
181 {
183 }
184 else
185 {
187 }
188
189 if ( minMaxOrigin.contains( "FullExtent"_L1 ) )
190 {
192 }
193 else if ( minMaxOrigin.contains( "SubExtent"_L1 ) )
194 {
196 }
197 else
198 {
200 }
201
202 if ( minMaxOrigin.contains( "Estimated"_L1 ) )
203 {
205 }
206 else // if ( minMaxOrigin.contains( "Exact"_L1 ) )
207 {
209 }
210 }
211
212 return r;
213}
214
216{
217 Q_UNUSED( bandNo )
218
219 auto outputBlock = std::make_unique<QgsRasterBlock>();
220 if ( !mInput || !mShader || !mShader->rasterShaderFunction() )
221 {
222 return outputBlock.release();
223 }
224
225
226 const std::shared_ptr< QgsRasterBlock > inputBlock( mInput->block( mBand, extent, width, height, feedback ) );
227 if ( !inputBlock || inputBlock->isEmpty() )
228 {
229 QgsDebugError( u"No raster data!"_s );
230 return outputBlock.release();
231 }
232
233 //rendering is faster without considering user-defined transparency
234 const bool hasTransparency = usesTransparency();
235
236 std::shared_ptr< QgsRasterBlock > alphaBlock;
237 if ( mAlphaBand > 0 && mAlphaBand != mBand )
238 {
239 alphaBlock.reset( mInput->block( mAlphaBand, extent, width, height, feedback ) );
240 if ( !alphaBlock || alphaBlock->isEmpty() )
241 {
242 return outputBlock.release();
243 }
244 }
245 else if ( mAlphaBand == mBand )
246 {
247 alphaBlock = inputBlock;
248 }
249
250 if ( !outputBlock->reset( Qgis::DataType::ARGB32_Premultiplied, width, height ) )
251 {
252 return outputBlock.release();
253 }
254
255 const QRgb myDefaultColor = renderColorForNodataPixel();
256 QRgb *outputBlockData = outputBlock->colorData();
257 const QgsRasterShaderFunction *fcn = mShader->rasterShaderFunction();
258
259 const qgssize count = ( qgssize ) width * height;
260 bool isNoData = false;
261 for ( qgssize i = 0; i < count; i++ )
262 {
263 const double val = inputBlock->valueAndNoData( i, isNoData );
264 if ( isNoData )
265 {
266 outputBlockData[i] = myDefaultColor;
267 continue;
268 }
269
270 int red, green, blue, alpha;
271 if ( !fcn->shade( val, &red, &green, &blue, &alpha ) )
272 {
273 outputBlockData[i] = myDefaultColor;
274 continue;
275 }
276
277 if ( alpha < 255 )
278 {
279 // Working with premultiplied colors, so multiply values by alpha
280 red *= ( alpha / 255.0 );
281 blue *= ( alpha / 255.0 );
282 green *= ( alpha / 255.0 );
283 }
284
285 if ( !hasTransparency )
286 {
287 outputBlockData[i] = qRgba( red, green, blue, alpha );
288 }
289 else
290 {
291 //opacity
292 double currentOpacity = mOpacity;
294 {
295 currentOpacity *= mRasterTransparency->opacityForValue( val );
296 }
297 if ( mAlphaBand > 0 )
298 {
299 const double alpha = alphaBlock->value( i );
300 if ( alpha == 0 )
301 {
302 outputBlock->setColor( i, myDefaultColor );
303 continue;
304 }
305 else
306 {
307 currentOpacity *= alpha / 255.0;
308 }
309 }
310
311 outputBlockData[i] = qRgba( currentOpacity * red, currentOpacity * green, currentOpacity * blue, currentOpacity * alpha );
312 }
313 }
314
315 return outputBlock.release();
316}
317
318void QgsSingleBandPseudoColorRenderer::writeXml( QDomDocument &doc, QDomElement &parentElem ) const
319{
320 if ( parentElem.isNull() )
321 {
322 return;
323 }
324
325 QDomElement rasterRendererElem = doc.createElement( u"rasterrenderer"_s );
326 _writeXml( doc, rasterRendererElem );
327 rasterRendererElem.setAttribute( u"band"_s, mBand );
328 if ( mShader )
329 {
330 mShader->writeXml( doc, rasterRendererElem ); //todo: include color ramp items directly in this renderer
331 }
332 rasterRendererElem.setAttribute( u"classificationMin"_s, QgsRasterBlock::printValue( mClassificationMin ) );
333 rasterRendererElem.setAttribute( u"classificationMax"_s, QgsRasterBlock::printValue( mClassificationMax ) );
334
335 parentElem.appendChild( rasterRendererElem );
336}
337
338QList< QPair< QString, QColor > > QgsSingleBandPseudoColorRenderer::legendSymbologyItems() const
339{
340 QList< QPair< QString, QColor > > symbolItems;
341 if ( mShader )
342 {
343 QgsRasterShaderFunction *shaderFunction = mShader->rasterShaderFunction();
344 if ( shaderFunction )
345 {
346 shaderFunction->legendSymbologyItems( symbolItems );
347 }
348 }
349 return symbolItems;
350}
351
353{
354 QList<int> bandList;
355 if ( mBand != -1 )
356 {
357 bandList << mBand;
358 }
359 return bandList;
360}
361
362void QgsSingleBandPseudoColorRenderer::toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props ) const
363{
364 QgsSldExportContext context;
365 context.setExtraProperties( props );
366 toSld( doc, element, context );
367}
368
369bool QgsSingleBandPseudoColorRenderer::toSld( QDomDocument &doc, QDomElement &element, QgsSldExportContext &context ) const
370{
371 // create base structure
372 QgsRasterRenderer::toSld( doc, element, context );
373
374 // look for RasterSymbolizer tag
375 const QDomNodeList elements = element.elementsByTagName( u"sld:RasterSymbolizer"_s );
376 if ( elements.size() == 0 )
377 return false;
378
379 // there SHOULD be only one
380 QDomElement rasterSymbolizerElem = elements.at( 0 ).toElement();
381
382 // add Channel Selection tags
383 QDomElement channelSelectionElem = doc.createElement( u"sld:ChannelSelection"_s );
384 rasterSymbolizerElem.appendChild( channelSelectionElem );
385
386 // for the mapped band
387 QDomElement channelElem = doc.createElement( u"sld:GrayChannel"_s );
388 channelSelectionElem.appendChild( channelElem );
389
390 // set band
391 QDomElement sourceChannelNameElem = doc.createElement( u"sld:SourceChannelName"_s );
392 sourceChannelNameElem.appendChild( doc.createTextNode( QString::number( mBand ) ) );
393 channelElem.appendChild( sourceChannelNameElem );
394
395 // add ColorMap tag
396 QDomElement colorMapElem = doc.createElement( u"sld:ColorMap"_s );
397
398 // set type of ColorMap ramp [ramp, intervals, values]
399 // basing on interpolation algorithm of the raster shader
400 QString rampType = u"ramp"_s;
401 const QgsColorRampShader *rampShader = dynamic_cast<const QgsColorRampShader *>( mShader->rasterShaderFunction() );
402 if ( !rampShader )
403 return false;
404
405 switch ( rampShader->colorRampType() )
406 {
408 rampType = u"values"_s;
409 break;
411 rampType = u"intervals"_s;
412 break;
414 rampType = u"ramp"_s;
415 break;
416 }
417
418 colorMapElem.setAttribute( u"type"_s, rampType );
419 if ( rampShader->colorRampItemList().size() >= 255 )
420 colorMapElem.setAttribute( u"extended"_s, u"true"_s );
421 rasterSymbolizerElem.appendChild( colorMapElem );
422
423 // for each color set a ColorMapEntry tag nested into "sld:ColorMap" tag
424 // e.g. <ColorMapEntry color="#EEBE2F" quantity="-300" label="label" opacity="0"/>
425 const QList<QgsColorRampShader::ColorRampItem> classes = rampShader->colorRampItemList();
426 QList<QgsColorRampShader::ColorRampItem>::const_iterator classDataIt = classes.constBegin();
427 for ( ; classDataIt != classes.constEnd(); ++classDataIt )
428 {
429 QDomElement colorMapEntryElem = doc.createElement( u"sld:ColorMapEntry"_s );
430 colorMapElem.appendChild( colorMapEntryElem );
431
432 // set colorMapEntryElem attributes
433 colorMapEntryElem.setAttribute( u"color"_s, classDataIt->color.name() );
434 colorMapEntryElem.setAttribute( u"quantity"_s, classDataIt->value );
435 colorMapEntryElem.setAttribute( u"label"_s, classDataIt->label );
436 if ( classDataIt->color.alphaF() != 1.0 )
437 {
438 colorMapEntryElem.setAttribute( u"opacity"_s, QString::number( classDataIt->color.alphaF() ) );
439 }
440 }
441 return true;
442}
443
445{
446 if ( const QgsColorRampShader *shader = dynamic_cast< const QgsColorRampShader * >( mShader->rasterShaderFunction() ) )
447 {
448 QgsStyleColorRampEntity entity( shader->sourceColorRamp() );
449 if ( !visitor->visit( QgsStyleEntityVisitorInterface::StyleLeaf( &entity ) ) )
450 return false;
451 }
452
453 return true;
454}
455
456QList<QgsLayerTreeModelLegendNode *> QgsSingleBandPseudoColorRenderer::createLegendNodes( QgsLayerTreeLayer *nodeLayer )
457{
458 if ( !mShader )
459 return QList<QgsLayerTreeModelLegendNode *>();
460
461 const QgsColorRampShader *rampShader = dynamic_cast<const QgsColorRampShader *>( mShader->rasterShaderFunction() );
462 if ( !rampShader )
463 return QList<QgsLayerTreeModelLegendNode *>();
464
465 QList<QgsLayerTreeModelLegendNode *> res;
466
467 const QString name = displayBandName( mBand );
468 if ( !name.isEmpty() )
469 {
470 res << new QgsSimpleLegendNode( nodeLayer, name );
471 }
472
473 switch ( rampShader->colorRampType() )
474 {
476 // for interpolated shaders we use a ramp legend node unless the settings flag
477 // to use the continuous legend is not set, in that case we fall through
478 if ( !rampShader->legendSettings() || rampShader->legendSettings()->useContinuousLegend() )
479 {
480 if ( !rampShader->colorRampItemList().isEmpty() )
481 {
482 res << new QgsColorRampLegendNode(
483 nodeLayer, rampShader->createColorRamp(), rampShader->legendSettings() ? *rampShader->legendSettings() : QgsColorRampLegendNodeSettings(), rampShader->minimumValue(), rampShader->maximumValue()
484 );
485 }
486 break;
487 }
488 [[fallthrough]];
491 {
492 // for all others we use itemised lists
493 const QList< QPair< QString, QColor > > items = legendSymbologyItems();
494 res.reserve( items.size() );
495 for ( const QPair< QString, QColor > &item : items )
496 {
497 res << new QgsRasterSymbolLegendNode( nodeLayer, item.second, item.first );
498 }
499 break;
500 }
501 }
502 return res;
503}
504
509
510bool QgsSingleBandPseudoColorRenderer::refresh( const QgsRectangle &extent, const QList<double> &min, const QList<double> &max, bool force )
511{
512 if ( !needsRefresh( extent ) && !force )
513 {
514 return false;
515 }
516
517 bool refreshed = false;
518 if ( min.size() >= 1 && max.size() >= 1 )
519 {
521
522 // Do not overwrite min/max with NaN if they were already set,
523 // for example when the style was already loaded from a raster attribute table
524 // in that case we need to respect the style from the attribute table and do
525 // not perform any reclassification.
526 bool refreshed = false;
527
528 if ( !std::isnan( min[0] ) )
529 {
530 setClassificationMin( min[0] );
531 refreshed = true;
532 }
533
534 if ( !std::isnan( max[0] ) )
535 {
536 setClassificationMax( max[0] );
537 refreshed = true;
538 }
539
540 QgsColorRampShader *rampShader = dynamic_cast<QgsColorRampShader *>( mShader->rasterShaderFunction() );
541 if ( rampShader && refreshed )
542 {
543 rampShader->classifyColorRamp( mBand, extent, input() );
544 }
545 }
546
547 return refreshed;
548}
QFlags< RasterRendererFlag > RasterRendererFlags
Flags which control behavior of raster renderers.
Definition qgis.h:1591
@ CumulativeCut
Range is [ min + cumulativeCutLower() * (max - min), min + cumulativeCutUpper() * (max - min) ].
Definition qgis.h:1627
@ StdDev
Range is [ mean - stdDevFactor() * stddev, mean + stdDevFactor() * stddev ].
Definition qgis.h:1626
@ MinimumMaximum
Real min-max values.
Definition qgis.h:1625
@ NotSet
User defined.
Definition qgis.h:1624
ShaderInterpolationMethod
Color ramp shader interpolation methods.
Definition qgis.h:1503
@ Exact
Assigns the color of the exact matching value in the color ramp item list.
Definition qgis.h:1506
@ Linear
Interpolates the color between two class breaks linearly.
Definition qgis.h:1504
@ Discrete
Assigns the color of the higher class for every pixel between two class breaks.
Definition qgis.h:1505
@ InternalLayerOpacityHandling
The renderer internally handles the raster layer's opacity, so the default layer level opacity handli...
Definition qgis.h:1581
@ Exact
Exact statistics.
Definition qgis.h:1655
@ Estimated
Approximated statistics.
Definition qgis.h:1656
ShaderClassificationMethod
Color ramp shader classification methods.
Definition qgis.h:1518
@ ARGB32_Premultiplied
Color, alpha, red, green, blue, 4 bytes the same as QImage::Format_ARGB32_Premultiplied.
Definition qgis.h:408
@ WholeRaster
Whole raster is used to compute statistics.
Definition qgis.h:1640
@ FixedCanvas
Current extent of the canvas (at the time of computation) is used to compute statistics.
Definition qgis.h:1641
Settings for a color ramp legend node.
bool useContinuousLegend() const
Returns true if a continuous gradient legend will be used.
A legend node which renders a color ramp.
A ramp shader will color a raster pixel based on a list of values ranges in a ramp.
Qgis::ShaderInterpolationMethod colorRampType() const
Returns the color ramp interpolation method.
const QgsColorRampLegendNodeSettings * legendSettings() const
Returns the color ramp shader legend settings.
QList< QgsColorRampShader::ColorRampItem > colorRampItemList() const
Returns the custom color map.
void setClip(bool clip)
Sets whether the shader should not render values out of range.
QgsColorRamp * createColorRamp() const
Creates a gradient color ramp from shader settings.
void classifyColorRamp(int classes=0, int band=-1, const QgsRectangle &extent=QgsRectangle(), QgsRasterInterface *input=nullptr)
Classify color ramp shader.
Abstract base class for color ramps.
Layer tree node points to a map layer.
Feedback object tailored for raster block reading.
Raster data container.
static QString printValue(double value, bool localized=false)
Print double value with all necessary significant digits.
QgsRasterInterface(QgsRasterInterface *input=nullptr)
QString displayBandName(int bandNumber) const
Generates a friendly, descriptive name for the specified bandNumber.
QgsRasterInterface * mInput
virtual QgsRectangle extent() const
Gets the extent of the interface.
virtual QgsRasterInterface * input() const
Current input.
void setLimits(Qgis::RasterRangeLimit limits)
Sets the limits.
void setExtent(Qgis::RasterRangeExtent extent)
Sets the extent.
void setStatAccuracy(Qgis::RasterRangeAccuracy accuracy)
Sets the statistics accuracy.
QgsRasterRenderer(QgsRasterInterface *input=nullptr, const QString &type=QString())
Constructor for QgsRasterRenderer.
double mOpacity
Global alpha value (0-1).
int mAlphaBand
Read alpha value from band.
QgsRectangle mLastRectangleUsedByRefreshContrastEnhancementIfNeeded
To save computations and possible infinite cycle of notifications.
QRgb renderColorForNodataPixel() const
Returns the color for the renderer to use to represent nodata pixels.
std::unique_ptr< QgsRasterTransparency > mRasterTransparency
Raster transparency per color or value. Overwrites global alpha value.
const QgsRasterMinMaxOrigin & minMaxOrigin() const
Returns const reference to origin of min/max values.
void _writeXml(QDomDocument &doc, QDomElement &rasterRendererElem) const
Write upper class info into rasterrenderer element (called by writeXml method of subclasses).
int bandCount() const override
Gets number of bands.
QgsRasterMinMaxOrigin mMinMaxOrigin
Origin of min/max values.
bool usesTransparency() const
void copyCommonProperties(const QgsRasterRenderer *other, bool copyMinMaxOrigin=true)
Copies common properties like opacity / transparency data from other renderer.
bool needsRefresh(const QgsRectangle &extent) const
Checks if the renderer needs to be refreshed according to extent.
virtual Q_DECL_DEPRECATED void toSld(QDomDocument &doc, QDomElement &element, const QVariantMap &props=QVariantMap()) const
Used from subclasses to create SLD Rule elements following SLD v1.0 specs.
void readXml(const QDomElement &rendererElem) override
Sets base class members from xml. Usually called from create() methods of subclasses.
The raster shade function applies a shader to a pixel at render time - typically used to render grays...
virtual void legendSymbologyItems(QList< QPair< QString, QColor > > &symbolItems) const
Returns legend symbology items if provided by renderer.
double maximumValue() const
Returns the minimum value for the raster shader.
virtual bool shade(double value, int *returnRedValue, int *returnGreenValue, int *returnBlueValue, int *returnAlpha) const
Generates an new RGBA value based on one input value.
virtual void setMaximumValue(double value)
Sets the maximum value for the raster shader.
virtual void setMinimumValue(double value)
Sets the minimum value for the raster shader.
double minimumValue() const
Returns the maximum value for the raster shader.
Interface for all raster shaders.
void setRasterShaderFunction(QgsRasterShaderFunction *function)
A public method that allows the user to set their own shader function.
Implementation of legend node interface for displaying raster legend entries.
A rectangle specified with double values.
Implementation of legend node interface for displaying arbitrary labels with icons.
QgsSingleBandPseudoColorRenderer * clone() const override
Clone itself, create deep copy.
QList< QPair< QString, QColor > > legendSymbologyItems() const override
Returns symbology items if provided by renderer.
void writeXml(QDomDocument &doc, QDomElement &parentElem) const override
Write base class members to xml.
Q_DECL_DEPRECATED void setBand(int bandNo)
Sets the band used by the renderer.
void setShader(QgsRasterShader *shader)
Takes ownership of the shader.
QList< QgsLayerTreeModelLegendNode * > createLegendNodes(QgsLayerTreeLayer *nodeLayer) override
Creates a set of legend nodes representing the renderer.
QgsRasterShader * shader()
Returns the raster shader.
QList< int > usesBands() const override
Returns a list of band numbers used by the renderer.
bool refresh(const QgsRectangle &extent, const QList< double > &min, const QList< double > &max, bool forceRefresh=false) override
Refreshes the renderer according to the min and max values associated with the extent.
bool setInputBand(int band) override
Attempts to set the input band for the renderer.
QgsRasterBlock * block(int bandNo, const QgsRectangle &extent, int width, int height, QgsRasterBlockFeedback *feedback=nullptr) override
Read block of data using given extent and size.
Qgis::RasterRendererFlags flags() const override
Returns flags which dictate renderer behavior.
QgsSingleBandPseudoColorRenderer(QgsRasterInterface *input, int band=-1, QgsRasterShader *shader=nullptr)
Note: takes ownership of QgsRasterShader.
int inputBand() const override
Returns the input band for the renderer, or -1 if no input band is available.
static QgsRasterRenderer * create(const QDomElement &elem, QgsRasterInterface *input)
void createShader(QgsColorRamp *colorRamp=nullptr, Qgis::ShaderInterpolationMethod colorRampType=Qgis::ShaderInterpolationMethod::Linear, Qgis::ShaderClassificationMethod classificationMode=Qgis::ShaderClassificationMethod::Continuous, int classes=0, bool clip=false, const QgsRectangle &extent=QgsRectangle())
Creates a color ramp shader.
bool accept(QgsStyleEntityVisitorInterface *visitor) const override
Accepts the specified symbology visitor, causing it to visit all symbols associated with the renderer...
bool canCreateRasterAttributeTable() const override
Returns true if the renderer is suitable for attribute table creation.
Q_DECL_DEPRECATED int band() const
Returns the band used by the renderer.
Q_DECL_DEPRECATED void toSld(QDomDocument &doc, QDomElement &element, const QVariantMap &props=QVariantMap()) const override
Used from subclasses to create SLD Rule elements following SLD v1.0 specs.
Holds SLD export options and other information related to SLD export of a QGIS layer style.
void setExtraProperties(const QVariantMap &properties)
Sets the open ended set of properties that can drive/inform the SLD encoding.
A color ramp entity for QgsStyle databases.
Definition qgsstyle.h:1422
An interface for classes which can visit style entity (e.g.
virtual bool visit(const QgsStyleEntityVisitorInterface::StyleLeaf &entity)
Called when the visitor will visit a style entity.
unsigned long long qgssize
Qgssize is used instead of size_t, because size_t is stdlib type, unknown by SIP, and it would be har...
Definition qgis.h:7485
#define QgsDebugError(str)
Definition qgslogger.h:59
Contains information relating to the style entity currently being visited.