QGIS API Documentation 3.41.0-Master (3440c17df1d)
|
A vector feature renderer which uses numeric attributes to classify features into different ranges. More...
#include <qgsgraduatedsymbolrenderer.h>
Public Types | |
enum | Mode { EqualInterval , Quantile , Jenks , StdDev , Pretty , Custom } |
Classification mode. More... | |
Public Types inherited from QgsFeatureRenderer | |
typedef QFlags< Capability > | Capabilities |
enum | Capability { SymbolLevels = 1 , MoreSymbolsPerFeature = 1 << 2 , Filter = 1 << 3 , ScaleDependent = 1 << 4 } |
Used to specify details about a renderer. More... | |
enum class | Property : int { HeatmapRadius , HeatmapMaximum } |
Data definable properties for renderers. More... | |
Public Member Functions | |
QgsGraduatedSymbolRenderer (const QString &attrName=QString(), const QgsRangeList &ranges=QgsRangeList()) | |
~QgsGraduatedSymbolRenderer () override | |
bool | accept (QgsStyleEntityVisitorInterface *visitor) const override |
Accepts the specified symbology visitor, causing it to visit all symbols associated with the renderer. | |
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. | |
void | addClass (const QgsRendererRange &range) |
void | addClass (double lower, double upper) |
void | addClass (QgsSymbol *symbol) |
Q_DECL_DEPRECATED bool | astride () const |
Returns if we want to have a central class astride the pivot value. | |
void | calculateLabelPrecision (bool updateRanges=true) |
Reset the label decimal places to a numberbased on the minimum class interval. | |
QgsFeatureRenderer::Capabilities | capabilities () override |
Returns details about internals of this renderer. | |
void | checkLegendSymbolItem (const QString &key, bool state=true) override |
Sets whether the legend symbology item with the specified ley should be checked. | |
QString | classAttribute () const |
Returns the attribute name (or expression) used for the classification. | |
QgsClassificationMethod * | classificationMethod () const |
Returns the classification method. | |
QgsGraduatedSymbolRenderer * | clone () const override |
Create a deep copy of this renderer. | |
QgsDataDefinedSizeLegend * | dataDefinedSizeLegend () const |
Returns configuration of appearance of legend when using data-defined size for marker symbols. | |
void | deleteAllClasses () |
void | deleteClass (int idx) |
QString | dump () const override |
Returns debug information about this renderer. | |
bool | filterNeedsGeometry () const override |
Returns true if this renderer requires the geometry to apply the filter. | |
Qgis::FeatureRendererFlags | flags () const override |
Returns flags associated with the renderer. | |
Qgis::GraduatedMethod | graduatedMethod () const |
Returns the method used for graduation (either size or color). | |
Q_DECL_DEPRECATED QgsRendererRangeLabelFormat | labelFormat () const |
Returns the label format used to generate default classification labels. | |
QString | legendClassificationAttribute () const override |
If supported by the renderer, return classification attribute for the use in legend. | |
QSet< QString > | legendKeysForFeature (const QgsFeature &feature, QgsRenderContext &context) const override |
Returns legend keys matching a specified feature. | |
QString | legendKeyToExpression (const QString &key, QgsVectorLayer *layer, bool &ok) const override |
Attempts to convert the specified legend rule key to a QGIS expression matching the features displayed using that key. | |
bool | legendSymbolItemChecked (const QString &key) override |
Returns true if the legend symbology item with the specified key is checked. | |
QgsLegendSymbolList | legendSymbolItems () const override |
Returns a list of symbology items for the legend. | |
bool | legendSymbolItemsCheckable () const override |
Returns true if symbology items in legend are checkable. | |
double | maxSymbolSize () const |
Returns the max symbol size when graduated by size. | |
double | minSymbolSize () const |
Returns the min symbol size when graduated by size. | |
Q_DECL_DEPRECATED Mode | mode () const |
void | moveClass (int from, int to) |
Moves the category at index position from to index position to. | |
QgsSymbol * | originalSymbolForFeature (const QgsFeature &feature, QgsRenderContext &context) const override |
Returns symbol for feature. | |
const QgsRendererRange * | rangeForValue (double value) const |
Returns the renderer range matching the provided value, or nullptr if no range matches the value. | |
const QgsRangeList & | ranges () const |
Returns a list of all ranges used in the classification. | |
bool | rangesHaveGaps () const |
Tests whether classes assigned to the renderer have gaps between the ranges. | |
bool | rangesOverlap () const |
Tests whether classes assigned to the renderer have ranges which overlap. | |
QDomElement | save (QDomDocument &doc, const QgsReadWriteContext &context) override |
Stores renderer properties to an XML element. | |
Q_DECL_DEPRECATED void | setAstride (bool astride) |
Set if we want a central class astride the pivot value. | |
void | setClassAttribute (const QString &attr) |
Sets the attribute name (or expression) used for the classification. | |
void | setClassificationMethod (QgsClassificationMethod *method) |
Defines the classification method This will take ownership of the method. | |
void | setDataDefinedSizeLegend (QgsDataDefinedSizeLegend *settings) |
Configures appearance of legend when renderer is configured to use data-defined size for marker symbols. | |
void | setGraduatedMethod (Qgis::GraduatedMethod method) |
Set the method used for graduation (either size or color). | |
Q_DECL_DEPRECATED void | setLabelFormat (const QgsRendererRangeLabelFormat &labelFormat, bool updateRanges=false) |
Set the label format used to generate default classification labels. | |
void | setLegendSymbolItem (const QString &key, QgsSymbol *symbol) override |
Sets the symbol to be used for a legend symbol item. | |
Q_DECL_DEPRECATED void | setMode (Mode mode) |
void | setSourceColorRamp (QgsColorRamp *ramp) |
Sets the source color ramp. | |
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. | |
void | setSymbolSizes (double minSize, double maxSize) |
set varying symbol size for classes | |
Q_DECL_DEPRECATED void | setSymmetryPoint (double symmetryPoint) |
Set the pivot point. | |
Q_DECL_DEPRECATED void | setUseSymmetricMode (bool useSymmetricMode) |
Set if we want to classify symmetric around a given value. | |
void | sortByLabel (Qt::SortOrder order=Qt::AscendingOrder) |
void | sortByValue (Qt::SortOrder order=Qt::AscendingOrder) |
QgsColorRamp * | sourceColorRamp () |
Returns the source color ramp, from which each classes' color is derived. | |
const QgsColorRamp * | sourceColorRamp () const |
Returns the source color ramp, from which each classes' color is derived. | |
QgsSymbol * | sourceSymbol () |
Returns the renderer's source symbol, which is the base symbol used for the each classes' symbol before applying the classes' color. | |
const QgsSymbol * | sourceSymbol () const |
Returns the renderer's source symbol, which is the base symbol used for the each classes' symbol before applying the classes' color. | |
void | startRender (QgsRenderContext &context, const QgsFields &fields) override |
Must be called when a new render cycle is started. | |
void | stopRender (QgsRenderContext &context) override |
Must be called when a render cycle has finished, to allow the renderer to clean up. | |
QgsSymbol * | symbolForFeature (const QgsFeature &feature, QgsRenderContext &context) const override |
To be overridden. | |
QgsSymbolList | symbols (QgsRenderContext &context) const override |
Returns list of symbols used by the renderer. | |
Q_DECL_DEPRECATED double | symmetryPoint () const |
Returns the pivot value for symmetric classification. | |
void | toSld (QDomDocument &doc, QDomElement &element, const QVariantMap &props=QVariantMap()) const override |
used from subclasses to create SLD Rule elements following SLD v1.1 specs | |
void | updateClasses (const QgsVectorLayer *vl, int nclasses, QString &error) |
Recalculate classes for a layer. | |
Q_DECL_DEPRECATED void | updateClasses (QgsVectorLayer *vlayer, Mode mode, int nclasses, bool useSymmetricMode=false, double symmetryPoint=0.0, bool astride=false) |
Recalculate classes for a layer. | |
void | updateColorRamp (QgsColorRamp *ramp=nullptr) |
Update the color ramp used. | |
bool | updateRangeLabel (int rangeIndex, const QString &label) |
void | updateRangeLabels () |
Updates the labels of the ranges. | |
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. | |
QSet< QString > | usedAttributes (const QgsRenderContext &context) const override |
Returns a list of attributes required by this renderer. | |
Q_DECL_DEPRECATED bool | useSymmetricMode () const |
Returns if we want to classify symmetric around a given value. | |
Public Member Functions inherited from QgsFeatureRenderer | |
virtual | ~QgsFeatureRenderer () |
virtual bool | canSkipRender () |
Returns true if the renderer can be entirely skipped, i.e. | |
void | copyRendererData (QgsFeatureRenderer *destRenderer) const |
Clones generic renderer data to another renderer. | |
virtual QList< QgsLayerTreeModelLegendNode * > | createLegendNodes (QgsLayerTreeLayer *nodeLayer) const |
Returns a list of legend nodes to be used for the legend for the renderer. | |
QgsPropertyCollection & | dataDefinedProperties () |
Returns a reference to the renderer's property collection, used for data defined overrides. | |
const QgsPropertyCollection & | dataDefinedProperties () const |
Returns a reference to the renderer's property collection, used for data defined overrides. | |
virtual const QgsFeatureRenderer * | embeddedRenderer () const |
Returns the current embedded renderer (subrenderer) for this feature renderer. | |
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. | |
bool | forceRasterRender () const |
Returns whether the renderer must render as a raster. | |
QSet< QString > | legendKeys () const |
Returns the set of all legend keys used by the renderer. | |
virtual void | modifyRequestExtent (QgsRectangle &extent, QgsRenderContext &context) |
Allows for a renderer to modify the extent of a feature request prior to rendering. | |
QgsFeatureRequest::OrderBy | orderBy () const |
Gets the order in which features shall be processed by this renderer. | |
bool | orderByEnabled () const |
Returns whether custom ordering will be applied before features are processed by this renderer. | |
virtual QgsSymbolList | originalSymbolsForFeature (const QgsFeature &feature, QgsRenderContext &context) const |
Equivalent of originalSymbolsForFeature() call extended to support renderers that may use more symbols per feature - similar to symbolsForFeature() | |
QgsPaintEffect * | paintEffect () const |
Returns the current paint effect for the renderer. | |
double | referenceScale () const |
Returns the symbology reference scale. | |
virtual bool | renderFeature (const QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false) |
Render a feature using this renderer in the given context. | |
void | setDataDefinedProperties (const QgsPropertyCollection &collection) |
Sets the renderer's property collection, used for data defined overrides. | |
void | setDataDefinedProperty (Property key, const QgsProperty &property) |
Sets a data defined property for the renderer. | |
virtual void | setEmbeddedRenderer (QgsFeatureRenderer *subRenderer) |
Sets an embedded renderer (subrenderer) for this feature renderer. | |
void | setForceRasterRender (bool forceRaster) |
Sets whether the renderer should be rendered to a raster destination. | |
void | setOrderBy (const QgsFeatureRequest::OrderBy &orderBy) |
Define the order in which features shall be processed by this renderer. | |
void | setOrderByEnabled (bool enabled) |
Sets whether custom ordering should be applied before features are processed by this renderer. | |
void | setPaintEffect (QgsPaintEffect *effect) |
Sets the current paint effect for the renderer. | |
void | setReferenceScale (double scale) |
Sets the symbology reference scale. | |
void | setUsingSymbolLevels (bool usingSymbolLevels) |
void | setVertexMarkerAppearance (Qgis::VertexMarkerType type, double size) |
Sets type and size of editing vertex markers for subsequent rendering. | |
virtual QgsSymbolList | symbolsForFeature (const QgsFeature &feature, QgsRenderContext &context) const |
Returns list of symbols used for rendering the feature. | |
QString | type () const |
virtual bool | usesEmbeddedSymbols () const |
Returns true if the renderer uses embedded symbols for features. | |
bool | usingSymbolLevels () const |
virtual bool | willRenderFeature (const QgsFeature &feature, QgsRenderContext &context) const |
Returns whether the renderer will render a feature or not. | |
virtual QDomElement | writeSld (QDomDocument &doc, const QString &styleName, const QVariantMap &props=QVariantMap()) const |
create the SLD UserStyle element following the SLD v1.1 specs with the given name | |
Static Public Member Functions | |
static Q_DECL_DEPRECATED QList< double > | calcEqualIntervalBreaks (double minimum, double maximum, int classes, bool useSymmetricMode, double symmetryPoint, bool astride) |
Compute the equal interval classification. | |
static QgsGraduatedSymbolRenderer * | convertFromRenderer (const QgsFeatureRenderer *renderer) |
creates a QgsGraduatedSymbolRenderer from an existing renderer. | |
static QgsFeatureRenderer * | create (QDomElement &element, const QgsReadWriteContext &context) |
create renderer from XML element | |
static Q_DECL_DEPRECATED QgsGraduatedSymbolRenderer * | createRenderer (QgsVectorLayer *vlayer, const QString &attrName, int classes, Mode mode, QgsSymbol *symbol, QgsColorRamp *ramp, const QgsRendererRangeLabelFormat &legendFormat=QgsRendererRangeLabelFormat(), bool useSymmetricMode=false, double symmetryPoint=0.0, const QStringList &listForCboPrettyBreaks=QStringList(), bool astride=false) |
Creates a new graduated renderer. | |
static Q_DECL_DEPRECATED void | makeBreaksSymmetric (QList< double > &breaks, double symmetryPoint, bool astride) |
Remove the breaks that are above the existing opposite sign classes to keep colors symmetrically balanced around symmetryPoint Does not put a break on the symmetryPoint. | |
Static Public Member Functions inherited from QgsFeatureRenderer | |
static QgsFeatureRenderer * | defaultRenderer (Qgis::GeometryType geomType) |
Returns a new renderer - used by default in vector layers. | |
static QgsFeatureRenderer * | load (QDomElement &symbologyElem, const QgsReadWriteContext &context) |
create a renderer from XML element | |
static QgsFeatureRenderer * | loadSld (const QDomNode &node, Qgis::GeometryType geomType, QString &errorMessage) |
Create a new renderer according to the information contained in the UserStyle element of a SLD style document. | |
static const QgsPropertiesDefinition & | propertyDefinitions () |
Returns the symbol property definitions. | |
Public Attributes | |
Q_NOWARN_DEPRECATED_POP | |
Q_NOWARN_DEPRECATED_PUSH | |
Protected Member Functions | |
QString | legendKeyForValue (double value) const |
Returns the matching legend key for a value. | |
QgsSymbol * | symbolForValue (double value) const |
Gets the symbol which is used to represent value. | |
Protected Member Functions inherited from QgsFeatureRenderer | |
QgsFeatureRenderer (const QString &type) | |
void | renderFeatureWithSymbol (const QgsFeature &feature, QgsSymbol *symbol, QgsRenderContext &context, int layer, bool selected, bool drawVertexMarker) |
Render the feature with the symbol using context. | |
void | renderVertexMarker (QPointF pt, QgsRenderContext &context) |
render editing vertex marker at specified point | |
void | renderVertexMarkerPolygon (QPolygonF &pts, QList< QPolygonF > *rings, QgsRenderContext &context) |
render editing vertex marker for a polygon | |
void | renderVertexMarkerPolyline (QPolygonF &pts, QgsRenderContext &context) |
render editing vertex marker for a polyline | |
void | saveRendererData (QDomDocument &doc, QDomElement &element, const QgsReadWriteContext &context) |
Saves generic renderer data into the specified element. | |
Static Protected Member Functions | |
static QString | graduatedMethodStr (Qgis::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. | |
static void | convertSymbolRotation (QgsSymbol *symbol, const QString &field) |
static void | convertSymbolSizeScale (QgsSymbol *symbol, Qgis::ScaleMethod method, const QString &field) |
Protected Attributes | |
QString | mAttrName |
int | mAttrNum = -1 |
attribute index (derived from attribute name in startRender) | |
std::shared_ptr< QgsClassificationMethod > | mClassificationMethod |
bool | mCounting = false |
std::unique_ptr< QgsDataDefinedSizeLegend > | mDataDefinedSizeLegend |
std::unique_ptr< QgsExpression > | mExpression |
Qgis::GraduatedMethod | mGraduatedMethod = Qgis::GraduatedMethod::Color |
QgsRangeList | mRanges |
std::unique_ptr< QgsColorRamp > | mSourceColorRamp |
std::unique_ptr< QgsSymbol > | mSourceSymbol |
Protected Attributes inherited from QgsFeatureRenderer | |
double | mCurrentVertexMarkerSize = 2 |
The current size of editing marker. | |
Qgis::VertexMarkerType | mCurrentVertexMarkerType = Qgis::VertexMarkerType::Cross |
The current type of editing marker. | |
bool | mForceRaster = false |
QgsFeatureRequest::OrderBy | mOrderBy |
bool | mOrderByEnabled = false |
QgsPaintEffect * | mPaintEffect = nullptr |
double | mReferenceScale = -1.0 |
QString | mType |
bool | mUsingSymbolLevels = false |
Friends | |
class | TestQgsGraduatedSymbolRenderer |
A vector feature renderer which uses numeric attributes to classify features into different ranges.
Definition at line 36 of file qgsgraduatedsymbolrenderer.h.
Classification mode.
Enumerator | |
---|---|
EqualInterval | |
Quantile | |
Jenks | |
StdDev | |
Pretty | |
Custom |
Definition at line 136 of file qgsgraduatedsymbolrenderer.h.
QgsGraduatedSymbolRenderer::QgsGraduatedSymbolRenderer | ( | const QString & | attrName = QString() , |
const QgsRangeList & | ranges = QgsRangeList() |
||
) |
Definition at line 51 of file qgsgraduatedsymbolrenderer.cpp.
|
override |
Definition at line 69 of file qgsgraduatedsymbolrenderer.cpp.
|
overridevirtual |
Accepts the specified symbology visitor, causing it to visit all symbols associated with the renderer.
Returns true
if the visitor should continue visiting other objects, or false
if visiting should be canceled.
Reimplemented from QgsFeatureRenderer.
Definition at line 365 of file qgsgraduatedsymbolrenderer.cpp.
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.
breakValue | position to insert break |
updateSymbols | set to true to reapply ramp colors to the new symbol ranges |
Definition at line 1050 of file qgsgraduatedsymbolrenderer.cpp.
void QgsGraduatedSymbolRenderer::addClass | ( | const QgsRendererRange & | range | ) |
Definition at line 1090 of file qgsgraduatedsymbolrenderer.cpp.
void QgsGraduatedSymbolRenderer::addClass | ( | double | lower, |
double | upper | ||
) |
Definition at line 1043 of file qgsgraduatedsymbolrenderer.cpp.
void QgsGraduatedSymbolRenderer::addClass | ( | QgsSymbol * | symbol | ) |
Definition at line 1036 of file qgsgraduatedsymbolrenderer.cpp.
|
inline |
Returns if we want to have a central class astride the pivot value.
Definition at line 189 of file qgsgraduatedsymbolrenderer.h.
|
static |
Compute the equal interval classification.
minimum | The minimum value of the distribution |
maximum | The maximum value of the distribution |
classes | The number of classes desired |
useSymmetricMode | A bool indicating if we want to have classes and hence colors ramp symmetric around a value |
symmetryPoint | The point around which we want a symmetry |
astride | A bool indicating if the symmetry is made astride the symmetryPoint or not ( [-1,1] vs. [-1,0][0,1] ) |
Definition at line 389 of file qgsgraduatedsymbolrenderer.cpp.
void QgsGraduatedSymbolRenderer::calculateLabelPrecision | ( | bool | updateRanges = true | ) |
Reset the label decimal places to a numberbased on the minimum class interval.
updateRanges | if true then ranges currently using the default label will be updated |
Definition at line 1132 of file qgsgraduatedsymbolrenderer.cpp.
|
inlineoverridevirtual |
Returns details about internals of this renderer.
E.g. if you only want to deal with visible features:
Reimplemented from QgsFeatureRenderer.
Definition at line 54 of file qgsgraduatedsymbolrenderer.h.
|
overridevirtual |
Sets whether the legend symbology item with the specified ley should be checked.
Reimplemented from QgsFeatureRenderer.
Definition at line 1005 of file qgsgraduatedsymbolrenderer.cpp.
|
inline |
Returns the attribute name (or expression) used for the classification.
Definition at line 63 of file qgsgraduatedsymbolrenderer.h.
QgsClassificationMethod * QgsGraduatedSymbolRenderer::classificationMethod | ( | ) | const |
Returns the classification method.
Definition at line 1263 of file qgsgraduatedsymbolrenderer.cpp.
|
overridevirtual |
Create a deep copy of this renderer.
Should be implemented by all subclasses and generate a proper subclass.
Implements QgsFeatureRenderer.
Definition at line 320 of file qgsgraduatedsymbolrenderer.cpp.
|
static |
creates a QgsGraduatedSymbolRenderer from an existing renderer.
nullptr
. Definition at line 1295 of file qgsgraduatedsymbolrenderer.cpp.
|
static |
create renderer from XML element
Definition at line 480 of file qgsgraduatedsymbolrenderer.cpp.
|
static |
Creates a new graduated renderer.
vlayer | vector layer |
attrName | attribute to classify |
classes | number of classes |
mode | classification mode |
symbol | base symbol |
ramp | color ramp for classes |
legendFormat | |
useSymmetricMode | A bool indicating if we want to have classes and hence colors ramp symmetric around a value |
symmetryPoint | The value around which the classes will be symmetric if useSymmetricMode is checked |
listForCboPrettyBreaks | The list of potential pivot values for symmetric mode with prettybreaks mode |
astride | A bool indicating if the symmetry is made astride the symmetryPoint or not ( [-1,1] vs. [-1,0][0,1] ) |
Definition at line 398 of file qgsgraduatedsymbolrenderer.cpp.
QgsDataDefinedSizeLegend * QgsGraduatedSymbolRenderer::dataDefinedSizeLegend | ( | ) | const |
Returns configuration of appearance of legend when using data-defined size for marker symbols.
Will return nullptr
if the functionality is disabled.
Definition at line 1357 of file qgsgraduatedsymbolrenderer.cpp.
void QgsGraduatedSymbolRenderer::deleteAllClasses | ( | ) |
Definition at line 1100 of file qgsgraduatedsymbolrenderer.cpp.
void QgsGraduatedSymbolRenderer::deleteClass | ( | int | idx | ) |
Definition at line 1095 of file qgsgraduatedsymbolrenderer.cpp.
|
overridevirtual |
Returns debug information about this renderer.
Reimplemented from QgsFeatureRenderer.
Definition at line 312 of file qgsgraduatedsymbolrenderer.cpp.
|
overridevirtual |
Returns true
if this renderer requires the geometry to apply the filter.
Reimplemented from QgsFeatureRenderer.
Definition at line 236 of file qgsgraduatedsymbolrenderer.cpp.
|
overridevirtual |
Returns flags associated with the renderer.
Reimplemented from QgsFeatureRenderer.
Definition at line 74 of file qgsgraduatedsymbolrenderer.cpp.
|
inline |
Returns the method used for graduation (either size or color).
Definition at line 387 of file qgsgraduatedsymbolrenderer.h.
|
staticprotected |
Definition at line 1362 of file qgsgraduatedsymbolrenderer.cpp.
Q_NOWARN_DEPRECATED_PUSH QgsRendererRangeLabelFormat QgsGraduatedSymbolRenderer::labelFormat | ( | ) | const |
Returns the label format used to generate default classification labels.
Definition at line 474 of file qgsgraduatedsymbolrenderer.cpp.
|
inlineoverridevirtual |
If supported by the renderer, return classification attribute for the use in legend.
Reimplemented from QgsFeatureRenderer.
Definition at line 400 of file qgsgraduatedsymbolrenderer.h.
|
protected |
Returns the matching legend key for a value.
Definition at line 127 of file qgsgraduatedsymbolrenderer.cpp.
|
overridevirtual |
Returns legend keys matching a specified feature.
Reimplemented from QgsFeatureRenderer.
Definition at line 808 of file qgsgraduatedsymbolrenderer.cpp.
|
overridevirtual |
Attempts to convert the specified legend rule key to a QGIS expression matching the features displayed using that key.
key | legend key |
layer | associated vector layer |
ok | will be set to true if legend key was successfully converted to a filter expression |
Reimplemented from QgsFeatureRenderer.
Definition at line 824 of file qgsgraduatedsymbolrenderer.cpp.
|
overridevirtual |
Returns true
if the legend symbology item with the specified key is checked.
Reimplemented from QgsFeatureRenderer.
Definition at line 993 of file qgsgraduatedsymbolrenderer.cpp.
|
overridevirtual |
Returns a list of symbology items for the legend.
Reimplemented from QgsFeatureRenderer.
Definition at line 768 of file qgsgraduatedsymbolrenderer.cpp.
|
overridevirtual |
Returns true
if symbology items in legend are checkable.
Reimplemented from QgsFeatureRenderer.
Definition at line 988 of file qgsgraduatedsymbolrenderer.cpp.
|
static |
Remove the breaks that are above the existing opposite sign classes to keep colors symmetrically balanced around symmetryPoint Does not put a break on the symmetryPoint.
This is done before.
breaks | The breaks of an already-done classification |
symmetryPoint | The point around which we want a symmetry |
astride | A bool indicating if the symmetry is made astride the symmetryPoint or not ( [-1,1] vs. [-1,0][0,1] ) |
Definition at line 384 of file qgsgraduatedsymbolrenderer.cpp.
double QgsGraduatedSymbolRenderer::maxSymbolSize | ( | ) | const |
Returns the max symbol size when graduated by size.
Definition at line 898 of file qgsgraduatedsymbolrenderer.cpp.
double QgsGraduatedSymbolRenderer::minSymbolSize | ( | ) | const |
Returns the min symbol size when graduated by size.
Definition at line 883 of file qgsgraduatedsymbolrenderer.cpp.
|
inline |
Definition at line 151 of file qgsgraduatedsymbolrenderer.h.
void QgsGraduatedSymbolRenderer::moveClass | ( | int | from, |
int | to | ||
) |
Moves the category at index position from to index position to.
Definition at line 1162 of file qgsgraduatedsymbolrenderer.cpp.
|
overridevirtual |
Returns 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.
Reimplemented from QgsFeatureRenderer.
Definition at line 161 of file qgsgraduatedsymbolrenderer.cpp.
const QgsRendererRange * QgsGraduatedSymbolRenderer::rangeForValue | ( | double | value | ) | const |
Returns the renderer range matching the provided value, or nullptr
if no range matches the value.
Definition at line 90 of file qgsgraduatedsymbolrenderer.cpp.
|
inline |
Returns a list of all ranges used in the classification.
Definition at line 75 of file qgsgraduatedsymbolrenderer.h.
bool QgsGraduatedSymbolRenderer::rangesHaveGaps | ( | ) | const |
Tests whether classes assigned to the renderer have gaps between the ranges.
true
if ranges have gaps Definition at line 1219 of file qgsgraduatedsymbolrenderer.cpp.
bool QgsGraduatedSymbolRenderer::rangesOverlap | ( | ) | const |
Tests whether classes assigned to the renderer have ranges which overlap.
true
if ranges overlap Definition at line 1191 of file qgsgraduatedsymbolrenderer.cpp.
|
overridevirtual |
Stores renderer properties to an XML element.
Subclasses which override this method should call saveRendererData() as part of their implementation in order to store all common base class properties in the returned DOM element.
Reimplemented from QgsFeatureRenderer.
Definition at line 646 of file qgsgraduatedsymbolrenderer.cpp.
void QgsGraduatedSymbolRenderer::setAstride | ( | bool | astride | ) |
Set if we want a central class astride the pivot value.
Definition at line 1290 of file qgsgraduatedsymbolrenderer.cpp.
|
inline |
Sets the attribute name (or expression) used for the classification.
Definition at line 70 of file qgsgraduatedsymbolrenderer.h.
void QgsGraduatedSymbolRenderer::setClassificationMethod | ( | QgsClassificationMethod * | method | ) |
Defines the classification method This will take ownership of the method.
Definition at line 1268 of file qgsgraduatedsymbolrenderer.cpp.
void QgsGraduatedSymbolRenderer::setDataDefinedSizeLegend | ( | QgsDataDefinedSizeLegend * | settings | ) |
Configures appearance of legend when renderer is configured to use data-defined size for marker symbols.
This allows configuring for which 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. nullptr
is a valid input that disables data-defined size legend.
Definition at line 1352 of file qgsgraduatedsymbolrenderer.cpp.
|
inline |
Set the method used for graduation (either size or color).
Definition at line 394 of file qgsgraduatedsymbolrenderer.h.
Q_NOWARN_DEPRECATED_PUSH void QgsGraduatedSymbolRenderer::setLabelFormat | ( | const QgsRendererRangeLabelFormat & | labelFormat, |
bool | updateRanges = false |
||
) |
Set the label format used to generate default classification labels.
labelFormat | The string appended to classification labels |
updateRanges | If true then ranges ending with the old unit string are updated to the new. |
Definition at line 1106 of file qgsgraduatedsymbolrenderer.cpp.
|
overridevirtual |
Sets the symbol to be used for a legend symbol item.
key | rule key for legend symbol |
symbol | new symbol for legend item. Ownership is transferred to renderer. |
Reimplemented from QgsFeatureRenderer.
Definition at line 1017 of file qgsgraduatedsymbolrenderer.cpp.
void QgsGraduatedSymbolRenderer::setMode | ( | QgsGraduatedSymbolRenderer::Mode | mode | ) |
Definition at line 1273 of file qgsgraduatedsymbolrenderer.cpp.
void QgsGraduatedSymbolRenderer::setSourceColorRamp | ( | QgsColorRamp * | ramp | ) |
Sets the source color ramp.
ramp | color ramp. Ownership is transferred to the renderer |
Definition at line 875 of file qgsgraduatedsymbolrenderer.cpp.
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.
sym | source symbol, ownership is transferred to the renderer |
Definition at line 860 of file qgsgraduatedsymbolrenderer.cpp.
void QgsGraduatedSymbolRenderer::setSymbolSizes | ( | double | minSize, |
double | maxSize | ||
) |
set varying symbol size for classes
Definition at line 913 of file qgsgraduatedsymbolrenderer.cpp.
void QgsGraduatedSymbolRenderer::setSymmetryPoint | ( | double | symmetryPoint | ) |
Set the pivot point.
Definition at line 1285 of file qgsgraduatedsymbolrenderer.cpp.
void QgsGraduatedSymbolRenderer::setUseSymmetricMode | ( | bool | useSymmetricMode | ) |
Set if we want to classify symmetric around a given value.
Definition at line 1280 of file qgsgraduatedsymbolrenderer.cpp.
void QgsGraduatedSymbolRenderer::sortByLabel | ( | Qt::SortOrder | order = Qt::AscendingOrder | ) |
Definition at line 1251 of file qgsgraduatedsymbolrenderer.cpp.
void QgsGraduatedSymbolRenderer::sortByValue | ( | Qt::SortOrder | order = Qt::AscendingOrder | ) |
Definition at line 1179 of file qgsgraduatedsymbolrenderer.cpp.
QgsColorRamp * QgsGraduatedSymbolRenderer::sourceColorRamp | ( | ) |
Returns the source color ramp, from which each classes' color is derived.
Definition at line 865 of file qgsgraduatedsymbolrenderer.cpp.
const QgsColorRamp * QgsGraduatedSymbolRenderer::sourceColorRamp | ( | ) | const |
Returns the source color ramp, from which each classes' color is derived.
Definition at line 870 of file qgsgraduatedsymbolrenderer.cpp.
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.
Definition at line 850 of file qgsgraduatedsymbolrenderer.cpp.
const QgsSymbol * QgsGraduatedSymbolRenderer::sourceSymbol | ( | ) | const |
Returns the renderer's source symbol, which is the base symbol used for the each classes' symbol before applying the classes' color.
Definition at line 855 of file qgsgraduatedsymbolrenderer.cpp.
|
overridevirtual |
Must be called when a new render cycle is started.
A call to startRender() must always be followed by a corresponding call to stopRender() after all features have been rendered.
context | Additional information passed to the renderer about the job which will be rendered |
fields | The fields available for rendering |
Reimplemented from QgsFeatureRenderer.
Definition at line 173 of file qgsgraduatedsymbolrenderer.cpp.
|
overridevirtual |
Must be called when a render cycle has finished, to allow the renderer to clean up.
Calls to stopRender() must always be preceded by a call to startRender().
Reimplemented from QgsFeatureRenderer.
Definition at line 197 of file qgsgraduatedsymbolrenderer.cpp.
|
overridevirtual |
To be overridden.
Must be called between startRender() and stopRender() calls.
feature | feature |
context | render context |
Implements QgsFeatureRenderer.
Definition at line 140 of file qgsgraduatedsymbolrenderer.cpp.
|
protected |
Gets the symbol which is used to represent value.
Definition at line 120 of file qgsgraduatedsymbolrenderer.cpp.
|
overridevirtual |
Returns list of symbols used by the renderer.
context | render context |
Reimplemented from QgsFeatureRenderer.
Definition at line 353 of file qgsgraduatedsymbolrenderer.cpp.
|
inline |
Returns the pivot value for symmetric classification.
Definition at line 174 of file qgsgraduatedsymbolrenderer.h.
|
overridevirtual |
used from subclasses to create SLD Rule elements following SLD v1.1 specs
Reimplemented from QgsFeatureRenderer.
Definition at line 338 of file qgsgraduatedsymbolrenderer.cpp.
void QgsGraduatedSymbolRenderer::updateClasses | ( | const QgsVectorLayer * | vl, |
int | nclasses, | ||
QString & | error | ||
) |
Recalculate classes for a layer.
vl | The layer being rendered (from which data values are calculated) |
nclasses | the number of classes |
error | Optional parameter for error reporting |
Definition at line 455 of file qgsgraduatedsymbolrenderer.cpp.
Q_NOWARN_DEPRECATED_POP void QgsGraduatedSymbolRenderer::updateClasses | ( | QgsVectorLayer * | vlayer, |
Mode | mode, | ||
int | nclasses, | ||
bool | useSymmetricMode = false , |
||
double | symmetryPoint = 0.0 , |
||
bool | astride = false |
||
) |
Recalculate classes for a layer.
vlayer | The layer being rendered (from which data values are calculated) |
mode | The calculation mode |
nclasses | The number of classes to calculate (approximate for some modes) |
useSymmetricMode | A bool indicating if we want to have classes and hence colors ramp symmetric around a value |
symmetryPoint | The value around which the classes will be symmetric if useSymmetricMode is checked |
astride | A bool indicating if the symmetry is made astride the symmetryPoint or not ( [-1,1] vs. [-1,0][0,1] ) |
Definition at line 439 of file qgsgraduatedsymbolrenderer.cpp.
void QgsGraduatedSymbolRenderer::updateColorRamp | ( | QgsColorRamp * | ramp = nullptr | ) |
Update the color ramp used.
Also updates all symbols colors. Doesn't alter current breaks.
ramp | color ramp. Ownership is transferred to the renderer |
Definition at line 929 of file qgsgraduatedsymbolrenderer.cpp.
bool QgsGraduatedSymbolRenderer::updateRangeLabel | ( | int | rangeIndex, |
const QString & | label | ||
) |
Definition at line 257 of file qgsgraduatedsymbolrenderer.cpp.
Q_NOWARN_DEPRECATED_POP void QgsGraduatedSymbolRenderer::updateRangeLabels | ( | ) |
Updates the labels of the ranges.
Definition at line 1119 of file qgsgraduatedsymbolrenderer.cpp.
bool QgsGraduatedSymbolRenderer::updateRangeLowerValue | ( | int | rangeIndex, |
double | value | ||
) |
Definition at line 284 of file qgsgraduatedsymbolrenderer.cpp.
bool QgsGraduatedSymbolRenderer::updateRangeRenderState | ( | int | rangeIndex, |
bool | render | ||
) |
Definition at line 304 of file qgsgraduatedsymbolrenderer.cpp.
bool QgsGraduatedSymbolRenderer::updateRangeSymbol | ( | int | rangeIndex, |
QgsSymbol * | symbol | ||
) |
Definition at line 249 of file qgsgraduatedsymbolrenderer.cpp.
bool QgsGraduatedSymbolRenderer::updateRangeUpperValue | ( | int | rangeIndex, |
double | value | ||
) |
Definition at line 265 of file qgsgraduatedsymbolrenderer.cpp.
void QgsGraduatedSymbolRenderer::updateSymbols | ( | QgsSymbol * | sym | ) |
Update all the symbols but leave breaks and colors.
This method also sets the source symbol for the renderer.
sym | source symbol to use for classes. Ownership is not transferred. |
Definition at line 955 of file qgsgraduatedsymbolrenderer.cpp.
|
overridevirtual |
Returns a list of attributes required by this renderer.
Attributes not listed in here may not have been requested from the provider at rendering time.
Implements QgsFeatureRenderer.
Definition at line 210 of file qgsgraduatedsymbolrenderer.cpp.
|
inline |
Returns if we want to classify symmetric around a given value.
Definition at line 160 of file qgsgraduatedsymbolrenderer.h.
|
friend |
Definition at line 490 of file qgsgraduatedsymbolrenderer.h.
|
protected |
Definition at line 440 of file qgsgraduatedsymbolrenderer.h.
|
protected |
attribute index (derived from attribute name in startRender)
Definition at line 449 of file qgsgraduatedsymbolrenderer.h.
|
protected |
Definition at line 467 of file qgsgraduatedsymbolrenderer.h.
|
protected |
Definition at line 450 of file qgsgraduatedsymbolrenderer.h.
|
protected |
Definition at line 452 of file qgsgraduatedsymbolrenderer.h.
|
protected |
Definition at line 445 of file qgsgraduatedsymbolrenderer.h.
|
protected |
Definition at line 446 of file qgsgraduatedsymbolrenderer.h.
|
protected |
Definition at line 441 of file qgsgraduatedsymbolrenderer.h.
|
protected |
Definition at line 443 of file qgsgraduatedsymbolrenderer.h.
|
protected |
Definition at line 442 of file qgsgraduatedsymbolrenderer.h.
QgsGraduatedSymbolRenderer::Q_NOWARN_DEPRECATED_POP |
Definition at line 257 of file qgsgraduatedsymbolrenderer.h.
QgsGraduatedSymbolRenderer::Q_NOWARN_DEPRECATED_PUSH |
Definition at line 241 of file qgsgraduatedsymbolrenderer.h.