QGIS API Documentation  2.99.0-Master (6cb9fa8)
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
QgsGraduatedSymbolRenderer Class Reference

#include <qgsgraduatedsymbolrenderer.h>

Inheritance diagram for QgsGraduatedSymbolRenderer:
Inheritance graph
[legend]

Public Types

enum  GraduatedMethod { GraduatedColor = 0, GraduatedSize = 1 }
 
enum  Mode {
  EqualInterval, Quantile, Jenks, StdDev,
  Pretty, Custom
}
 
- Public Types inherited from QgsFeatureRenderer
enum  Capability { SymbolLevels = 1, MoreSymbolsPerFeature = 1 << 2, Filter = 1 << 3, ScaleDependent = 1 << 4 }
 Used to specify details about a renderer. More...
 

Public Member Functions

 QgsGraduatedSymbolRenderer (const QString &attrName=QString(), const QgsRangeList &ranges=QgsRangeList())
 
virtual ~QgsGraduatedSymbolRenderer ()
 
void addBreak (double breakValue, bool updateSymbols=true)
 Add a breakpoint by splitting existing classes so that the specified value becomes a break between two classes. More...
 
void addClass (QgsSymbol *symbol)
 
void addClass (const QgsRendererRange &range)
 
void addClass (double lower, double upper)
 
void calculateLabelPrecision (bool updateRanges=true)
 Reset the label decimal places to a numberbased on the minimum class interval. More...
 
virtual QgsFeatureRenderer::Capabilities capabilities () override
 Returns details about internals of this renderer. More...
 
virtual void checkLegendSymbolItem (const QString &key, bool state=true) override
 item in symbology was checked More...
 
QString classAttribute () const
 
virtual QgsGraduatedSymbolRendererclone () const override
 Create a deep copy of this renderer. More...
 
QgsDataDefinedSizeLegenddataDefinedSizeLegend () const
 Returns configuration of appearance of legend when using data-defined size for marker symbols. More...
 
void deleteAllClasses ()
 
void deleteClass (int idx)
 
virtual QString dump () const override
 Returns debug information about this renderer. More...
 
GraduatedMethod graduatedMethod () const
 return the method used for graduation (either size or color) More...
 
const QgsRendererRangeLabelFormatlabelFormat () const
 Return the label format used to generate default classification labels. More...
 
virtual QString legendClassificationAttribute () const override
 If supported by the renderer, return classification attribute for the use in legend. More...
 
virtual QSet< QString > legendKeysForFeature (QgsFeature &feature, QgsRenderContext &context) override
 Return legend keys matching a specified feature. More...
 
virtual bool legendSymbolItemChecked (const QString &key) override
 items of symbology items in legend is checked More...
 
QgsLegendSymbolList legendSymbolItems () const override
 Returns a list of symbology items for the legend. More...
 
virtual bool legendSymbolItemsCheckable () const override
 items of symbology items in legend should be checkable More...
 
double maxSymbolSize () const
 return the max symbol size when graduated by size More...
 
double minSymbolSize () const
 return the min symbol size when graduated by size More...
 
Mode mode () const
 
void moveClass (int from, int to)
 Moves the category at index position from to index position to. More...
 
virtual QgsSymboloriginalSymbolForFeature (QgsFeature &feature, QgsRenderContext &context) override
 Return symbol for feature. More...
 
const QgsRangeListranges () const
 
bool rangesHaveGaps () const
 Tests whether classes assigned to the renderer have gaps between the ranges. More...
 
bool rangesOverlap () const
 Tests whether classes assigned to the renderer have ranges which overlap. More...
 
virtual QDomElement save (QDomDocument &doc, const QgsReadWriteContext &context) override
 store renderer info to XML element More...
 
void setClassAttribute (const QString &attr)
 
void setDataDefinedSizeLegend (QgsDataDefinedSizeLegend *settings)
 Configures appearance of legend when renderer is configured to use data-defined size for marker symbols. More...
 
void setGraduatedMethod (GraduatedMethod method)
 set the method used for graduation (either size or color) More...
 
void setLabelFormat (const QgsRendererRangeLabelFormat &labelFormat, bool updateRanges=false)
 Set the label format used to generate default classification labels. More...
 
virtual void setLegendSymbolItem (const QString &key, QgsSymbol *symbol) override
 Sets the symbol to be used for a legend symbol item. More...
 
void setMode (Mode mode)
 
void setSourceColorRamp (QgsColorRamp *ramp)
 Sets the source color ramp. More...
 
void setSourceSymbol (QgsSymbol *sym)
 Sets the source symbol for the renderer, which is the base symbol used for the each classes' symbol before applying the classes' color. More...
 
void setSymbolSizes (double minSize, double maxSize)
 set varying symbol size for classes More...
 
void sortByLabel (Qt::SortOrder order=Qt::AscendingOrder)
 
void sortByValue (Qt::SortOrder order=Qt::AscendingOrder)
 
QgsColorRampsourceColorRamp ()
 Returns the source color ramp, from which each classes' color is derived. More...
 
QgsSymbolsourceSymbol ()
 Returns the renderer's source symbol, which is the base symbol used for the each classes' symbol before applying the classes' color. More...
 
virtual void startRender (QgsRenderContext &context, const QgsFields &fields) override
 Needs to be called when a new render cycle is started. More...
 
virtual void stopRender (QgsRenderContext &context) override
 Needs to be called when a render cycle has finished to clean up. More...
 
virtual QgsSymbolsymbolForFeature (QgsFeature &feature, QgsRenderContext &context) override
 To be overridden. More...
 
virtual QgsSymbolList symbols (QgsRenderContext &context) override
 Returns list of symbols used by the renderer. More...
 
virtual void toSld (QDomDocument &doc, QDomElement &element, const QgsStringMap &props=QgsStringMap()) const override
 used from subclasses to create SLD Rule elements following SLD v1.1 specs More...
 
void updateClasses (QgsVectorLayer *vlayer, Mode mode, int nclasses)
 Recalculate classes for a layer. More...
 
void updateColorRamp (QgsColorRamp *ramp=0)
 Update the color ramp used. More...
 
bool updateRangeLabel (int rangeIndex, const QString &label)
 
bool updateRangeLowerValue (int rangeIndex, double value)
 
bool updateRangeRenderState (int rangeIndex, bool render)
 
bool updateRangeSymbol (int rangeIndex, QgsSymbol *symbol)
 
bool updateRangeUpperValue (int rangeIndex, double value)
 
void updateSymbols (QgsSymbol *sym)
 Update all the symbols but leave breaks and colors. More...
 
virtual QSet< QString > usedAttributes (const QgsRenderContext &context) const override
 Return a list of attributes required by this renderer. More...
 
- Public Member Functions inherited from QgsFeatureRenderer
virtual ~QgsFeatureRenderer ()
 
virtual const QgsFeatureRendererembeddedRenderer () const
 Returns the current embedded renderer (subrenderer) for this feature renderer. More...
 
virtual QString filter (const QgsFields &fields=QgsFields())
 If a renderer does not require all the features this method may be overridden and return an expression used as where clause. More...
 
virtual bool filterNeedsGeometry () const
 Returns true if this renderer requires the geometry to apply the filter. More...
 
bool forceRasterRender () const
 Returns whether the renderer must render as a raster. More...
 
virtual void modifyRequestExtent (QgsRectangle &extent, QgsRenderContext &context)
 Allows for a renderer to modify the extent of a feature request prior to rendering. More...
 
QgsFeatureRequest::OrderBy orderBy () const
 Get the order in which features shall be processed by this renderer. More...
 
bool orderByEnabled () const
 Returns whether custom ordering will be applied before features are processed by this renderer. More...
 
virtual QgsSymbolList originalSymbolsForFeature (QgsFeature &feat, QgsRenderContext &context)
 Equivalent of originalSymbolsForFeature() call extended to support renderers that may use more symbols per feature - similar to symbolsForFeature() More...
 
QgsPaintEffectpaintEffect () const
 Returns the current paint effect for the renderer. More...
 
virtual bool renderFeature (QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false)
 Render a feature using this renderer in the given context. More...
 
virtual void setEmbeddedRenderer (QgsFeatureRenderer *subRenderer)
 Sets an embedded renderer (subrenderer) for this feature renderer. More...
 
void setForceRasterRender (bool forceRaster)
 Sets whether the renderer should be rendered to a raster destination. More...
 
void setOrderBy (const QgsFeatureRequest::OrderBy &orderBy)
 Define the order in which features shall be processed by this renderer. More...
 
void setOrderByEnabled (bool enabled)
 Sets whether custom ordering should be applied before features are processed by this renderer. More...
 
void setPaintEffect (QgsPaintEffect *effect)
 Sets the current paint effect for the renderer. More...
 
void setUsingSymbolLevels (bool usingSymbolLevels)
 
void setVertexMarkerAppearance (int type, int size)
 set type and size of editing vertex markers for subsequent rendering More...
 
virtual QgsSymbolList symbolsForFeature (QgsFeature &feat, QgsRenderContext &context)
 Returns list of symbols used for rendering the feature. More...
 
QString type () const
 
bool usingSymbolLevels () const
 
virtual bool willRenderFeature (QgsFeature &feat, QgsRenderContext &context)
 Returns whether the renderer will render a feature or not. More...
 
virtual QDomElement writeSld (QDomDocument &doc, const QString &styleName, const QgsStringMap &props=QgsStringMap()) const
 create the SLD UserStyle element following the SLD v1.1 specs with the given name More...
 

Static Public Member Functions

static QgsGraduatedSymbolRendererconvertFromRenderer (const QgsFeatureRenderer *renderer)
 creates a QgsGraduatedSymbolRenderer from an existing renderer. More...
 
static QgsFeatureRenderercreate (QDomElement &element, const QgsReadWriteContext &context)
 create renderer from XML element More...
 
static QgsGraduatedSymbolRenderercreateRenderer (QgsVectorLayer *vlayer, const QString &attrName, int classes, Mode mode, QgsSymbol *symbol, QgsColorRamp *ramp, const QgsRendererRangeLabelFormat &legendFormat=QgsRendererRangeLabelFormat())
 Creates a new graduated renderer. More...
 
- Static Public Member Functions inherited from QgsFeatureRenderer
static QgsFeatureRendererdefaultRenderer (QgsWkbTypes::GeometryType geomType)
 return a new renderer - used by default in vector layers More...
 
static QgsFeatureRendererload (QDomElement &symbologyElem, const QgsReadWriteContext &context)
 create a renderer from XML element More...
 
static QgsFeatureRendererloadSld (const QDomNode &node, QgsWkbTypes::GeometryType geomType, QString &errorMessage)
 Create a new renderer according to the information contained in the UserStyle element of a SLD style document. More...
 

Protected Member Functions

QString legendKeyForValue (double value) const
 Returns the matching legend key for a value. More...
 
QgsSymbolsymbolForValue (double value)
 
- Protected Member Functions inherited from QgsFeatureRenderer
 QgsFeatureRenderer (const QString &type)
 
void copyRendererData (QgsFeatureRenderer *destRenderer) const
 Clones generic renderer data to another renderer. More...
 
void renderFeatureWithSymbol (QgsFeature &feature, QgsSymbol *symbol, QgsRenderContext &context, int layer, bool selected, bool drawVertexMarker)
 
void renderVertexMarker (QPointF pt, QgsRenderContext &context)
 render editing vertex marker at specified point More...
 
void renderVertexMarkerPolygon (QPolygonF &pts, QList< QPolygonF > *rings, QgsRenderContext &context)
 render editing vertex marker for a polygon More...
 
void renderVertexMarkerPolyline (QPolygonF &pts, QgsRenderContext &context)
 render editing vertex marker for a polyline More...
 

Static Protected Member Functions

static const char * graduatedMethodStr (GraduatedMethod method)
 
- Static Protected Member Functions inherited from QgsFeatureRenderer
static QPointF _getPoint (QgsRenderContext &context, const QgsPoint &point)
 Creates a point in screen coordinates from a wkb string in map coordinates. More...
 
static void convertSymbolRotation (QgsSymbol *symbol, const QString &field)
 
static void convertSymbolSizeScale (QgsSymbol *symbol, QgsSymbol::ScaleMethod method, const QString &field)
 

Protected Attributes

QString mAttrName
 
int mAttrNum
 attribute index (derived from attribute name in startRender) More...
 
bool mCounting
 
std::unique_ptr< QgsDataDefinedSizeLegendmDataDefinedSizeLegend
 
std::unique_ptr< QgsExpression > mExpression
 
GraduatedMethod mGraduatedMethod
 
QgsRendererRangeLabelFormat mLabelFormat
 
Mode mMode
 
QgsRangeList mRanges
 
std::unique_ptr< QgsColorRampmSourceColorRamp
 
std::unique_ptr< QgsSymbolmSourceSymbol
 
- Protected Attributes inherited from QgsFeatureRenderer
int mCurrentVertexMarkerSize
 The current size of editing marker. More...
 
int mCurrentVertexMarkerType
 The current type of editing marker. More...
 
bool mForceRaster
 
QgsFeatureRequest::OrderBy mOrderBy
 
bool mOrderByEnabled
 
QgsPaintEffectmPaintEffect = nullptr
 
QString mType
 
bool mUsingSymbolLevels
 

Detailed Description

Definition at line 133 of file qgsgraduatedsymbolrenderer.h.

Member Enumeration Documentation

◆ GraduatedMethod

Enumerator
GraduatedColor 
GraduatedSize 

Definition at line 310 of file qgsgraduatedsymbolrenderer.h.

◆ Mode

Enumerator
EqualInterval 
Quantile 
Jenks 
StdDev 
Pretty 
Custom 

Definition at line 200 of file qgsgraduatedsymbolrenderer.h.

Constructor & Destructor Documentation

◆ QgsGraduatedSymbolRenderer()

QgsGraduatedSymbolRenderer::QgsGraduatedSymbolRenderer ( const QString &  attrName = QString(),
const QgsRangeList ranges = QgsRangeList() 
)

Definition at line 290 of file qgsgraduatedsymbolrenderer.cpp.

◆ ~QgsGraduatedSymbolRenderer()

QgsGraduatedSymbolRenderer::~QgsGraduatedSymbolRenderer ( )
virtual

Definition at line 311 of file qgsgraduatedsymbolrenderer.cpp.

Member Function Documentation

◆ addBreak()

void QgsGraduatedSymbolRenderer::addBreak ( double  breakValue,
bool  updateSymbols = true 
)

Add a breakpoint by splitting existing classes so that the specified value becomes a break between two classes.

Parameters
breakValueposition to insert break
updateSymbolsset to true to reapply ramp colors to the new symbol ranges
Since
QGIS 2.9

Definition at line 1391 of file qgsgraduatedsymbolrenderer.cpp.

◆ addClass() [1/3]

void QgsGraduatedSymbolRenderer::addClass ( QgsSymbol symbol)

Definition at line 1377 of file qgsgraduatedsymbolrenderer.cpp.

◆ addClass() [2/3]

void QgsGraduatedSymbolRenderer::addClass ( const QgsRendererRange range)
Note
available in Python bindings as addClassRange

Definition at line 1430 of file qgsgraduatedsymbolrenderer.cpp.

◆ addClass() [3/3]

void QgsGraduatedSymbolRenderer::addClass ( double  lower,
double  upper 
)
Note
available in Python bindings as addClassLowerUpper

Definition at line 1384 of file qgsgraduatedsymbolrenderer.cpp.

◆ calculateLabelPrecision()

void QgsGraduatedSymbolRenderer::calculateLabelPrecision ( bool  updateRanges = true)

Reset the label decimal places to a numberbased on the minimum class interval.

Parameters
updateRangesif true then ranges currently using the default label will be updated
Since
QGIS 2.6

Definition at line 1458 of file qgsgraduatedsymbolrenderer.cpp.

◆ capabilities()

virtual QgsFeatureRenderer::Capabilities QgsGraduatedSymbolRenderer::capabilities ( )
inlineoverridevirtual

Returns details about internals of this renderer.

E.g. if you only want to deal with visible features:

if not renderer.capabilities().testFlag(QgsFeatureRenderer.Filter) or renderer.willRenderFeature(feature, context):
deal_with_my_feature()
else:
skip_the_curren_feature()

Reimplemented from QgsFeatureRenderer.

Definition at line 149 of file qgsgraduatedsymbolrenderer.h.

◆ checkLegendSymbolItem()

void QgsGraduatedSymbolRenderer::checkLegendSymbolItem ( const QString &  key,
bool  state = true 
)
overridevirtual

item in symbology was checked

Since
QGIS 2.5

Reimplemented from QgsFeatureRenderer.

Definition at line 1359 of file qgsgraduatedsymbolrenderer.cpp.

◆ classAttribute()

QString QgsGraduatedSymbolRenderer::classAttribute ( ) const
inline

Definition at line 152 of file qgsgraduatedsymbolrenderer.h.

◆ clone()

QgsGraduatedSymbolRenderer * QgsGraduatedSymbolRenderer::clone ( ) const
overridevirtual

Create a deep copy of this renderer.

Should be implemented by all subclasses and generate a proper subclass.

Returns
A copy of this renderer

Implements QgsFeatureRenderer.

Definition at line 496 of file qgsgraduatedsymbolrenderer.cpp.

◆ convertFromRenderer()

QgsGraduatedSymbolRenderer * QgsGraduatedSymbolRenderer::convertFromRenderer ( const QgsFeatureRenderer renderer)
static

creates a QgsGraduatedSymbolRenderer from an existing renderer.

Since
QGIS 2.6
Returns
a new renderer if the conversion was possible, otherwise 0.

Definition at line 1588 of file qgsgraduatedsymbolrenderer.cpp.

◆ create()

QgsFeatureRenderer * QgsGraduatedSymbolRenderer::create ( QDomElement &  element,
const QgsReadWriteContext context 
)
static

create renderer from XML element

Definition at line 920 of file qgsgraduatedsymbolrenderer.cpp.

◆ createRenderer()

QgsGraduatedSymbolRenderer * QgsGraduatedSymbolRenderer::createRenderer ( QgsVectorLayer vlayer,
const QString &  attrName,
int  classes,
Mode  mode,
QgsSymbol symbol,
QgsColorRamp ramp,
const QgsRendererRangeLabelFormat legendFormat = QgsRendererRangeLabelFormat() 
)
static

Creates a new graduated renderer.

Parameters
vlayervector layer
attrNameattribute to classify
classesnumber of classes
modeclassification mode
symbolbase symbol
rampcolor ramp for classes
legendFormat
Returns
new QgsGraduatedSymbolRenderer object

Definition at line 786 of file qgsgraduatedsymbolrenderer.cpp.

◆ dataDefinedSizeLegend()

QgsDataDefinedSizeLegend * QgsGraduatedSymbolRenderer::dataDefinedSizeLegend ( ) const

Returns configuration of appearance of legend when using data-defined size for marker symbols.

Will return null if the functionality is disabled.

Since
QGIS 3.0

Definition at line 1633 of file qgsgraduatedsymbolrenderer.cpp.

◆ deleteAllClasses()

void QgsGraduatedSymbolRenderer::deleteAllClasses ( )

Definition at line 1440 of file qgsgraduatedsymbolrenderer.cpp.

◆ deleteClass()

void QgsGraduatedSymbolRenderer::deleteClass ( int  idx)

Definition at line 1435 of file qgsgraduatedsymbolrenderer.cpp.

◆ dump()

QString QgsGraduatedSymbolRenderer::dump ( ) const
overridevirtual

Returns debug information about this renderer.

Reimplemented from QgsFeatureRenderer.

Definition at line 488 of file qgsgraduatedsymbolrenderer.cpp.

◆ graduatedMethod()

GraduatedMethod QgsGraduatedSymbolRenderer::graduatedMethod ( ) const
inline

return the method used for graduation (either size or color)

Since
QGIS 2.10

Definition at line 318 of file qgsgraduatedsymbolrenderer.h.

◆ graduatedMethodStr()

const char * QgsGraduatedSymbolRenderer::graduatedMethodStr ( GraduatedMethod  method)
staticprotected
Note
not available in Python bindings

Definition at line 1638 of file qgsgraduatedsymbolrenderer.cpp.

◆ labelFormat()

const QgsRendererRangeLabelFormat& QgsGraduatedSymbolRenderer::labelFormat ( ) const
inline

Return the label format used to generate default classification labels.

Since
QGIS 2.6

Definition at line 221 of file qgsgraduatedsymbolrenderer.h.

◆ legendClassificationAttribute()

virtual QString QgsGraduatedSymbolRenderer::legendClassificationAttribute ( ) const
inlineoverridevirtual

If supported by the renderer, return classification attribute for the use in legend.

Since
QGIS 2.6

Reimplemented from QgsFeatureRenderer.

Definition at line 328 of file qgsgraduatedsymbolrenderer.h.

◆ legendKeyForValue()

QString QgsGraduatedSymbolRenderer::legendKeyForValue ( double  value) const
protected

Returns the matching legend key for a value.

Definition at line 332 of file qgsgraduatedsymbolrenderer.cpp.

◆ legendKeysForFeature()

QSet< QString > QgsGraduatedSymbolRenderer::legendKeysForFeature ( QgsFeature feature,
QgsRenderContext context 
)
overridevirtual

Return legend keys matching a specified feature.

Since
QGIS 2.14

Reimplemented from QgsFeatureRenderer.

Definition at line 1206 of file qgsgraduatedsymbolrenderer.cpp.

◆ legendSymbolItemChecked()

bool QgsGraduatedSymbolRenderer::legendSymbolItemChecked ( const QString &  key)
overridevirtual

items of symbology items in legend is checked

Since
QGIS 2.5

Reimplemented from QgsFeatureRenderer.

Definition at line 1349 of file qgsgraduatedsymbolrenderer.cpp.

◆ legendSymbolItems()

QgsLegendSymbolList QgsGraduatedSymbolRenderer::legendSymbolItems ( ) const
overridevirtual

Returns a list of symbology items for the legend.

Since
QGIS 2.6

Reimplemented from QgsFeatureRenderer.

Definition at line 1166 of file qgsgraduatedsymbolrenderer.cpp.

◆ legendSymbolItemsCheckable()

bool QgsGraduatedSymbolRenderer::legendSymbolItemsCheckable ( ) const
overridevirtual

items of symbology items in legend should be checkable

Since
QGIS 2.5

Reimplemented from QgsFeatureRenderer.

Definition at line 1344 of file qgsgraduatedsymbolrenderer.cpp.

◆ maxSymbolSize()

double QgsGraduatedSymbolRenderer::maxSymbolSize ( ) const

return the max symbol size when graduated by size

Since
QGIS 2.10

Definition at line 1259 of file qgsgraduatedsymbolrenderer.cpp.

◆ minSymbolSize()

double QgsGraduatedSymbolRenderer::minSymbolSize ( ) const

return the min symbol size when graduated by size

Since
QGIS 2.10

Definition at line 1244 of file qgsgraduatedsymbolrenderer.cpp.

◆ mode()

Mode QgsGraduatedSymbolRenderer::mode ( ) const
inline

Definition at line 210 of file qgsgraduatedsymbolrenderer.h.

◆ moveClass()

void QgsGraduatedSymbolRenderer::moveClass ( int  from,
int  to 
)

Moves the category at index position from to index position to.

Definition at line 1487 of file qgsgraduatedsymbolrenderer.cpp.

◆ originalSymbolForFeature()

QgsSymbol * QgsGraduatedSymbolRenderer::originalSymbolForFeature ( QgsFeature feature,
QgsRenderContext context 
)
overridevirtual

Return symbol for feature.

The difference compared to symbolForFeature() is that it returns original symbol which can be used as an identifier for renderer's rule - the former may return a temporary replacement of a symbol for use in rendering.

Since
QGIS 2.12

Reimplemented from QgsFeatureRenderer.

Definition at line 371 of file qgsgraduatedsymbolrenderer.cpp.

◆ ranges()

const QgsRangeList& QgsGraduatedSymbolRenderer::ranges ( ) const
inline

Definition at line 155 of file qgsgraduatedsymbolrenderer.h.

◆ rangesHaveGaps()

bool QgsGraduatedSymbolRenderer::rangesHaveGaps ( ) const

Tests whether classes assigned to the renderer have gaps between the ranges.

Returns
true if ranges have gaps
Since
QGIS 2.10

Definition at line 1544 of file qgsgraduatedsymbolrenderer.cpp.

◆ rangesOverlap()

bool QgsGraduatedSymbolRenderer::rangesOverlap ( ) const

Tests whether classes assigned to the renderer have ranges which overlap.

Returns
true if ranges overlap
Since
QGIS 2.10

Definition at line 1516 of file qgsgraduatedsymbolrenderer.cpp.

◆ save()

QDomElement QgsGraduatedSymbolRenderer::save ( QDomDocument &  doc,
const QgsReadWriteContext context 
)
overridevirtual

store renderer info to XML element

Reimplemented from QgsFeatureRenderer.

Definition at line 1053 of file qgsgraduatedsymbolrenderer.cpp.

◆ setClassAttribute()

void QgsGraduatedSymbolRenderer::setClassAttribute ( const QString &  attr)
inline

Definition at line 153 of file qgsgraduatedsymbolrenderer.h.

◆ setDataDefinedSizeLegend()

void QgsGraduatedSymbolRenderer::setDataDefinedSizeLegend ( QgsDataDefinedSizeLegend settings)

Configures appearance of legend when renderer is configured to use data-defined size for marker symbols.

This allows to configure for what values (symbol sizes) should be shown in the legend, whether to display different symbol sizes collapsed in one legend node or separated across multiple legend nodes etc.

When renderer does not use data-defined size or does not use marker symbols, these settings will be ignored. Takes ownership of the passed settings objects. Null pointer is a valid input that disables data-defined size legend.

Since
QGIS 3.0

Definition at line 1628 of file qgsgraduatedsymbolrenderer.cpp.

◆ setGraduatedMethod()

void QgsGraduatedSymbolRenderer::setGraduatedMethod ( GraduatedMethod  method)
inline

set the method used for graduation (either size or color)

Since
QGIS 2.10

Definition at line 322 of file qgsgraduatedsymbolrenderer.h.

◆ setLabelFormat()

void QgsGraduatedSymbolRenderer::setLabelFormat ( const QgsRendererRangeLabelFormat labelFormat,
bool  updateRanges = false 
)

Set the label format used to generate default classification labels.

Parameters
labelFormatThe string appended to classification labels
updateRangesIf true then ranges ending with the old unit string are updated to the new.
Since
QGIS 2.6

Definition at line 1445 of file qgsgraduatedsymbolrenderer.cpp.

◆ setLegendSymbolItem()

void QgsGraduatedSymbolRenderer::setLegendSymbolItem ( const QString &  key,
QgsSymbol symbol 
)
overridevirtual

Sets the symbol to be used for a legend symbol item.

Parameters
keyrule key for legend symbol
symbolnew symbol for legend item. Ownership is transferred to renderer.
Since
QGIS 2.14

Reimplemented from QgsFeatureRenderer.

Definition at line 1367 of file qgsgraduatedsymbolrenderer.cpp.

◆ setMode()

void QgsGraduatedSymbolRenderer::setMode ( Mode  mode)
inline

Definition at line 211 of file qgsgraduatedsymbolrenderer.h.

◆ setSourceColorRamp()

void QgsGraduatedSymbolRenderer::setSourceColorRamp ( QgsColorRamp ramp)

Sets the source color ramp.

Parameters
rampcolor ramp. Ownership is transferred to the renderer

Definition at line 1236 of file qgsgraduatedsymbolrenderer.cpp.

◆ setSourceSymbol()

void QgsGraduatedSymbolRenderer::setSourceSymbol ( QgsSymbol sym)

Sets the source symbol for the renderer, which is the base symbol used for the each classes' symbol before applying the classes' color.

Parameters
symsource symbol, ownership is transferred to the renderer
See also
sourceSymbol()
setSourceColorRamp()

Definition at line 1226 of file qgsgraduatedsymbolrenderer.cpp.

◆ setSymbolSizes()

void QgsGraduatedSymbolRenderer::setSymbolSizes ( double  minSize,
double  maxSize 
)

set varying symbol size for classes

Note
the classes must already be set so that symbols exist
Since
QGIS 2.10

Definition at line 1274 of file qgsgraduatedsymbolrenderer.cpp.

◆ sortByLabel()

void QgsGraduatedSymbolRenderer::sortByLabel ( Qt::SortOrder  order = Qt::AscendingOrder)

Definition at line 1576 of file qgsgraduatedsymbolrenderer.cpp.

◆ sortByValue()

void QgsGraduatedSymbolRenderer::sortByValue ( Qt::SortOrder  order = Qt::AscendingOrder)

Definition at line 1504 of file qgsgraduatedsymbolrenderer.cpp.

◆ sourceColorRamp()

QgsColorRamp * QgsGraduatedSymbolRenderer::sourceColorRamp ( )

Returns the source color ramp, from which each classes' color is derived.

See also
setSourceColorRamp()
sourceSymbol()

Definition at line 1231 of file qgsgraduatedsymbolrenderer.cpp.

◆ sourceSymbol()

QgsSymbol * QgsGraduatedSymbolRenderer::sourceSymbol ( )

Returns the renderer's source symbol, which is the base symbol used for the each classes' symbol before applying the classes' color.

See also
setSourceSymbol()
sourceColorRamp()

Definition at line 1222 of file qgsgraduatedsymbolrenderer.cpp.

◆ startRender()

void QgsGraduatedSymbolRenderer::startRender ( QgsRenderContext context,
const QgsFields fields 
)
overridevirtual

Needs to be called when a new render cycle is started.

Parameters
contextAdditional information passed to the renderer about the job which will be rendered
fieldsThe fields available for rendering
Returns
Information passed back from the renderer that can e.g. be used to reduce the amount of requested features

Implements QgsFeatureRenderer.

Definition at line 383 of file qgsgraduatedsymbolrenderer.cpp.

◆ stopRender()

void QgsGraduatedSymbolRenderer::stopRender ( QgsRenderContext context)
overridevirtual

Needs to be called when a render cycle has finished to clean up.

Implements QgsFeatureRenderer.

Definition at line 405 of file qgsgraduatedsymbolrenderer.cpp.

◆ symbolForFeature()

QgsSymbol * QgsGraduatedSymbolRenderer::symbolForFeature ( QgsFeature feature,
QgsRenderContext context 
)
overridevirtual

To be overridden.

Must be called between startRender() and stopRender() calls.

Parameters
featurefeature
contextrender context
Returns
returns pointer to symbol or 0 if symbol was not found
Since
QGIS 2.12

Implements QgsFeatureRenderer.

Definition at line 350 of file qgsgraduatedsymbolrenderer.cpp.

◆ symbolForValue()

QgsSymbol * QgsGraduatedSymbolRenderer::symbolForValue ( double  value)
protected

Definition at line 316 of file qgsgraduatedsymbolrenderer.cpp.

◆ symbols()

QgsSymbolList QgsGraduatedSymbolRenderer::symbols ( QgsRenderContext context)
overridevirtual

Returns list of symbols used by the renderer.

Parameters
contextrender context
Since
QGIS 2.12

Reimplemented from QgsFeatureRenderer.

Definition at line 529 of file qgsgraduatedsymbolrenderer.cpp.

◆ toSld()

void QgsGraduatedSymbolRenderer::toSld ( QDomDocument &  doc,
QDomElement &  element,
const QgsStringMap props = QgsStringMap() 
) const
overridevirtual

used from subclasses to create SLD Rule elements following SLD v1.1 specs

Reimplemented from QgsFeatureRenderer.

Definition at line 514 of file qgsgraduatedsymbolrenderer.cpp.

◆ updateClasses()

void QgsGraduatedSymbolRenderer::updateClasses ( QgsVectorLayer vlayer,
Mode  mode,
int  nclasses 
)

Recalculate classes for a layer.

Parameters
vlayerThe layer being rendered (from which data values are calculated)
modeThe calculation mode
nclassesThe number of classes to calculate (approximate for some modes)
Since
QGIS 2.6

Definition at line 806 of file qgsgraduatedsymbolrenderer.cpp.

◆ updateColorRamp()

void QgsGraduatedSymbolRenderer::updateColorRamp ( QgsColorRamp ramp = 0)

Update the color ramp used.

Also updates all symbols colors. Doesn't alter current breaks.

Parameters
rampcolor ramp. Ownership is transferred to the renderer

Definition at line 1290 of file qgsgraduatedsymbolrenderer.cpp.

◆ updateRangeLabel()

bool QgsGraduatedSymbolRenderer::updateRangeLabel ( int  rangeIndex,
const QString &  label 
)

Definition at line 450 of file qgsgraduatedsymbolrenderer.cpp.

◆ updateRangeLowerValue()

bool QgsGraduatedSymbolRenderer::updateRangeLowerValue ( int  rangeIndex,
double  value 
)

Definition at line 469 of file qgsgraduatedsymbolrenderer.cpp.

◆ updateRangeRenderState()

bool QgsGraduatedSymbolRenderer::updateRangeRenderState ( int  rangeIndex,
bool  render 
)
Since
QGIS 2.5

Definition at line 480 of file qgsgraduatedsymbolrenderer.cpp.

◆ updateRangeSymbol()

bool QgsGraduatedSymbolRenderer::updateRangeSymbol ( int  rangeIndex,
QgsSymbol symbol 
)

Definition at line 442 of file qgsgraduatedsymbolrenderer.cpp.

◆ updateRangeUpperValue()

bool QgsGraduatedSymbolRenderer::updateRangeUpperValue ( int  rangeIndex,
double  value 
)

Definition at line 458 of file qgsgraduatedsymbolrenderer.cpp.

◆ updateSymbols()

void QgsGraduatedSymbolRenderer::updateSymbols ( QgsSymbol sym)

Update all the symbols but leave breaks and colors.

This method also sets the source symbol for the renderer.

Parameters
symsource symbol to use for classes. Ownership is not transferred.
See also
setSourceSymbol()

Definition at line 1316 of file qgsgraduatedsymbolrenderer.cpp.

◆ usedAttributes()

QSet< QString > QgsGraduatedSymbolRenderer::usedAttributes ( const QgsRenderContext context) const
overridevirtual

Return a list of attributes required by this renderer.

Attributes not listed in here may not have been requested from the provider at rendering time.

Returns
A set of attributes

Implements QgsFeatureRenderer.

Definition at line 416 of file qgsgraduatedsymbolrenderer.cpp.

Member Data Documentation

◆ mAttrName

QString QgsGraduatedSymbolRenderer::mAttrName
protected

Definition at line 355 of file qgsgraduatedsymbolrenderer.h.

◆ mAttrNum

int QgsGraduatedSymbolRenderer::mAttrNum
protected

attribute index (derived from attribute name in startRender)

Definition at line 365 of file qgsgraduatedsymbolrenderer.h.

◆ mCounting

bool QgsGraduatedSymbolRenderer::mCounting
protected

Definition at line 366 of file qgsgraduatedsymbolrenderer.h.

◆ mDataDefinedSizeLegend

std::unique_ptr<QgsDataDefinedSizeLegend> QgsGraduatedSymbolRenderer::mDataDefinedSizeLegend
protected

Definition at line 368 of file qgsgraduatedsymbolrenderer.h.

◆ mExpression

std::unique_ptr<QgsExpression> QgsGraduatedSymbolRenderer::mExpression
protected

Definition at line 362 of file qgsgraduatedsymbolrenderer.h.

◆ mGraduatedMethod

GraduatedMethod QgsGraduatedSymbolRenderer::mGraduatedMethod
protected

Definition at line 363 of file qgsgraduatedsymbolrenderer.h.

◆ mLabelFormat

QgsRendererRangeLabelFormat QgsGraduatedSymbolRenderer::mLabelFormat
protected

Definition at line 360 of file qgsgraduatedsymbolrenderer.h.

◆ mMode

Mode QgsGraduatedSymbolRenderer::mMode
protected

Definition at line 357 of file qgsgraduatedsymbolrenderer.h.

◆ mRanges

QgsRangeList QgsGraduatedSymbolRenderer::mRanges
protected

Definition at line 356 of file qgsgraduatedsymbolrenderer.h.

◆ mSourceColorRamp

std::unique_ptr<QgsColorRamp> QgsGraduatedSymbolRenderer::mSourceColorRamp
protected

Definition at line 359 of file qgsgraduatedsymbolrenderer.h.

◆ mSourceSymbol

std::unique_ptr<QgsSymbol> QgsGraduatedSymbolRenderer::mSourceSymbol
protected

Definition at line 358 of file qgsgraduatedsymbolrenderer.h.


The documentation for this class was generated from the following files: