15#ifndef QGSGRADUATEDSYMBOLRENDERER_H
16#define QGSGRADUATEDSYMBOLRENDERER_H
51 QString
dump()
const override;
53 Q_DECL_DEPRECATED
void toSld( QDomDocument &doc, QDomElement &element,
const QVariantMap &props = QVariantMap() )
const override SIP_DEPRECATED;
79 bool updateRangeLabel(
int rangeIndex,
const QString &label );
80 bool updateRangeUpperValue(
int rangeIndex,
double value );
81 bool updateRangeLowerValue(
int rangeIndex,
double value );
82 bool updateRangeRenderState(
int rangeIndex,
bool render );
97 void addClass(
double lower,
double upper )
SIP_PYNAME( addClassLowerUpper );
106 void addBreak(
double breakValue,
bool updateSymbols =
true );
108 void deleteClass(
int idx );
109 void deleteAllClasses();
112 void moveClass(
int from,
int to );
118 bool rangesOverlap()
const;
124 bool rangesHaveGaps()
const;
126 void sortByValue( Qt::SortOrder order = Qt::AscendingOrder );
127 void sortByLabel( Qt::SortOrder order = Qt::AscendingOrder );
177 Q_DECL_DEPRECATED
void setUseSymmetricMode(
bool useSymmetricMode )
SIP_DEPRECATED;
191 Q_DECL_DEPRECATED
void setSymmetryPoint(
double symmetryPoint )
SIP_DEPRECATED;
217 Q_DECL_DEPRECATED
static void makeBreaksSymmetric( QList<double> &breaks
SIP_INOUT,
double symmetryPoint,
bool astride )
SIP_DEPRECATED;
229 Q_DECL_DEPRECATED
static QList<double> calcEqualIntervalBreaks(
double minimum,
double maximum,
int classes,
bool useSymmetricMode,
double symmetryPoint,
bool astride )
SIP_DEPRECATED;
241 Q_DECL_DEPRECATED
void updateClasses(
QgsVectorLayer *vlayer, Mode mode,
int nclasses,
bool useSymmetricMode =
false,
double symmetryPoint = 0.0,
bool astride =
false )
SIP_DEPRECATED;
294 const QString &attrName,
302 const QStringList &listForCboPrettyBreaks = QStringList(),
439 void updateRangeLabels();
Provides global constants and enumerations for use throughout the application.
QFlags< FeatureRendererFlag > FeatureRendererFlags
Flags controlling behavior of vector feature renderers.
GraduatedMethod
Methods for modifying symbols by range in a graduated symbol renderer.
@ Color
Alter color of symbols.
An abstract class for implementations of classification methods.
Abstract base class for color ramps.
Object that keeps configuration of appearance of marker symbol's data-defined size in legend.
Handles parsing and evaluation of expressions (formerly called "search strings").
Abstract base class for all 2D vector feature renderers.
virtual bool legendSymbolItemsCheckable() const
Returns true if symbology items in legend are checkable.
virtual bool legendSymbolItemChecked(const QString &key)
Returns true if the legend symbology item with the specified key is checked.
virtual void setLegendSymbolItem(const QString &key, QgsSymbol *symbol)
Sets the symbol to be used for a legend symbol item.
QgsFeatureRenderer(const QString &type)
virtual QgsSymbolList symbols(QgsRenderContext &context) const
Returns list of symbols used by the renderer.
virtual Qgis::FeatureRendererFlags flags() const
Returns flags associated with the renderer.
virtual void stopRender(QgsRenderContext &context)
Must be called when a render cycle has finished, to allow the renderer to clean up.
QFlags< Capability > Capabilities
virtual QString dump() const
Returns debug information about this renderer.
virtual QSet< QString > usedAttributes(const QgsRenderContext &context) const =0
Returns a list of attributes required by this renderer.
virtual QgsSymbol * symbolForFeature(const QgsFeature &feature, QgsRenderContext &context) const =0
To be overridden.
virtual void checkLegendSymbolItem(const QString &key, bool state=true)
Sets whether the legend symbology item with the specified ley should be checked.
@ SymbolLevels
Rendering with symbol levels (i.e. implements symbols(), symbolForFeature()).
@ Filter
Features may be filtered, i.e. some features may not be rendered (categorized, rule based ....
virtual bool filterNeedsGeometry() const
Returns true if this renderer requires the geometry to apply the filter.
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.1 specs.
virtual bool accept(QgsStyleEntityVisitorInterface *visitor) const
Accepts the specified symbology visitor, causing it to visit all symbols associated with the renderer...
virtual QgsSymbol * originalSymbolForFeature(const QgsFeature &feature, QgsRenderContext &context) const
Returns symbol for feature.
virtual void startRender(QgsRenderContext &context, const QgsFields &fields)
Must be called when a new render cycle is started.
virtual QgsFeatureRenderer * clone() const =0
Create a deep copy of this renderer.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Container of fields for a vector layer.
A vector feature renderer which uses numeric attributes to classify features into different ranges.
QgsLegendSymbolList legendSymbolItems() const override
Returns a list of symbology items for the legend.
friend class TestQgsGraduatedSymbolRenderer
QgsSymbol * sourceSymbol()
Returns the renderer's source symbol, which is the base symbol used for the each classes' symbol befo...
QString legendClassificationAttribute() const override
If supported by the renderer, return classification attribute for the use in legend.
QDomElement save(QDomDocument &doc, const QgsReadWriteContext &context) override
Stores renderer properties to an XML element.
void updateSymbols(QgsSymbol *sym)
Update all the symbols but leave breaks and colors.
QgsColorRamp * sourceColorRamp()
Returns the source color ramp, from which each classes' color is derived.
std::unique_ptr< QgsDataDefinedSizeLegend > mDataDefinedSizeLegend
double maxSymbolSize() const
Returns the max symbol size when graduated by size.
Q_DECL_DEPRECATED bool useSymmetricMode() const
Returns if we want to classify symmetric around a given value.
std::unique_ptr< QgsSymbol > mSourceSymbol
void setGraduatedMethod(Qgis::GraduatedMethod method)
Set the method used for graduation (either size or color).
static QgsFeatureRenderer * create(QDomElement &element, const QgsReadWriteContext &context)
create renderer from XML element
QSet< QString > legendKeysForFeature(const QgsFeature &feature, QgsRenderContext &context) const override
Returns legend keys matching a specified feature.
std::shared_ptr< QgsClassificationMethod > mClassificationMethod
Q_DECL_DEPRECATED bool astride() const
Returns if we want to have a central class astride the pivot value.
QgsFeatureRenderer::Capabilities capabilities() override
Returns details about internals of this renderer.
Q_DECL_DEPRECATED void setLabelFormat(const QgsRendererRangeLabelFormat &labelFormat, bool updateRanges=false)
Set the label format used to generate default classification labels.
QString classAttribute() const
Returns the attribute name (or expression) used for the classification.
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 displaye...
QString legendKeyForValue(double value) const
Returns the matching legend key for a value.
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 b...
std::unique_ptr< QgsColorRamp > mSourceColorRamp
void updateColorRamp(QgsColorRamp *ramp=nullptr)
Update the color ramp used.
Q_DECL_DEPRECATED Mode mode() const
QgsGraduatedSymbolRenderer(const QString &attrName=QString(), const QgsRangeList &ranges=QgsRangeList())
Qgis::GraduatedMethod mGraduatedMethod
double minSymbolSize() const
Returns the min symbol size when graduated by size.
Qgis::GraduatedMethod graduatedMethod() const
Returns the method used for graduation (either size or color).
int mAttrNum
attribute index (derived from attribute name in startRender)
void setClassAttribute(const QString &attr)
Sets the attribute name (or expression) used for the classification.
std::unique_ptr< QgsExpression > mExpression
static QString graduatedMethodStr(Qgis::GraduatedMethod method)
void setSymbolSizes(double minSize, double maxSize)
set varying symbol size for classes
void calculateLabelPrecision(bool updateRanges=true)
Reset the label decimal places to a numberbased on the minimum class interval.
const QgsRangeList & ranges() const
Returns a list of all ranges used in the classification.
Q_DECL_DEPRECATED QgsRendererRangeLabelFormat labelFormat() const
Returns the label format used to generate default classification labels.
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.
Q_DECL_DEPRECATED double symmetryPoint() const
Returns the pivot value for symmetric classification.
QgsSymbol * symbolForValue(double value) const
Gets the symbol which is used to represent value.
A container for the context for various read/write operations on objects.
Contains information about the context of a rendering operation.
Represents a value range for a QgsGraduatedSymbolRenderer.
Holds SLD export options and other information related to SLD export of a QGIS layer style.
An interface for classes which can visit style entity (e.g.
Abstract base class for all rendered symbols.
Represents a vector layer which manages a vector based dataset.
QList< QgsLegendSymbolItem > QgsLegendSymbolList
QList< QgsSymbol * > QgsSymbolList
QList< QgsRendererRange > QgsRangeList