QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
16 #ifndef QGSCLASSIFICATIONMETHOD_H
17 #define QGSCLASSIFICATIONMETHOD_H
22 #include "qgis_core.h"
54 , mLowerBound( lowerBound )
55 , mUpperBound( upperBound )
63 QString
label()
const {
return mLabel;}
66 SIP_PYOBJECT __repr__();
68 QString str = QStringLiteral(
"<QgsClassificationRange: '%1'>" ).arg( sipCpp->label() );
69 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
93 sipType = sipType_QgsClassificationEqualInterval;
95 sipType = sipType_QgsClassificationJenks;
97 sipType = sipType_QgsClassificationPrettyBreaks;
99 sipType = sipType_QgsClassificationQuantile;
101 sipType = sipType_QgsClassificationStandardDeviation;
113 ValuesNotRequired = 1 << 1,
114 SymmetricModeAvailable = 1 << 2,
116 Q_DECLARE_FLAGS( MethodProperties, MethodProperty )
143 virtual QString
name()
const = 0;
146 virtual QString
id()
const = 0;
149 virtual QIcon
icon()
const {
return QIcon();}
154 virtual QString labelForRange(
double lowerValue,
double upperValue, ClassPosition position = Inner )
const;
203 void setSymmetricMode(
bool enabled,
double symmetryPoint = 0,
bool symmetryAstride =
false );
213 void setLabelPrecision(
int labelPrecision );
220 static QList<double> rangesToBreaks(
const QList<QgsClassificationRange> &classes );
228 QList<QgsClassificationRange> classes(
const QgsVectorLayer *layer,
const QString &expression,
int nclasses );
235 QList<QgsClassificationRange> classes(
const QList<double> &values,
int nclasses );
244 QList<QgsClassificationRange> classes(
double minimum,
double maximum,
int nclasses );
267 static void makeBreaksSymmetric( QList<double> &breaks
SIP_INOUT,
double symmetryPoint,
bool astride );
272 QString labelForRange(
const QgsRendererRange &range, ClassPosition position = Inner )
const;
290 void setParameterValues(
const QVariantMap &values );
308 QString formatNumber(
double value )
const;
326 virtual QList<double> calculateBreaks(
double &minimum,
double &maximum,
327 const QList<double> &values,
int nclasses ) = 0;
330 virtual QString valueToLabel(
double value )
const {
return formatNumber( value );}
333 QList<QgsClassificationRange> breaksToClasses(
const QList<double> &breaks )
const;
336 MethodProperties mFlags = MethodProperties();
337 int mCodeComplexity = 1;
341 bool mSymmetricEnabled =
false;
342 double mSymmetryPoint = 0;
343 bool mSymmetryAstride =
false;
344 int mLabelPrecision = 4;
345 bool mLabelTrimTrailingZeroes =
true;
346 QString mLabelFormat;
349 double mLabelNumberScale = 1.0;
350 QString mLabelNumberSuffix;
354 QVariantMap mParameterValues;
359 #endif // QGSCLASSIFICATIONMETHOD_H
QgsClassificationMethod is an abstract class for implementations of classification methods.
QgsClassificationRange(const QString &label, double lowerBound, double upperBound)
Constructor.
The class is used as a container of context for various read/write operations on other objects.
QgsClassificationPrettryBreaks is an implementation of QgsClassificationMethod for pretty breaks.
virtual QIcon icon() const
The icon of the method.
bool symmetryAstride() const
Returns if the symmetric mode is astride if true, it will remove the symmetry point break so that the...
virtual void writeXml(QDomElement &element, const QgsReadWriteContext &context) const
Writes extra information about the method.
Base class for the definition of processing parameters.
int codeComplexity() const
Code complexity as the exponent in Big O notation.
virtual bool valuesRequired() const
Returns if the method requires values to calculate the classes If not, bounds are sufficient.
QList< const QgsProcessingParameterDefinition * > QgsProcessingParameterDefinitions
List of processing parameters.
QgsProcessingParameterDefinitions parameterDefinitions() const
Returns the list of parameters.
QgsClassificationEqualInterval is an implementation of QgsClassificationMethod for equal intervals.
QgsClassificationQuantile is an implementation of QgsClassificationMethod based on quantiles.
double symmetryPoint() const
Returns the symmetry point for symmetric mode.
virtual QgsClassificationMethod * clone() const =0
Returns a clone of the method.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
@ LowerBound
The class is at the lower bound.
int labelPrecision() const
Returns the precision for the formatting of the labels.
QString label() const
Returns the lower bound.
virtual QString id() const =0
The id of the method as saved in the project, must be unique in registry.
void setLabelFormat(const QString &format)
Defines the format of the labels for the classes, using %1 and %2 for the bounds.
static const int MIN_PRECISION
bool symmetricModeEnabled() const
Returns if the symmetric mode is enabled.
static const int MAX_PRECISION
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsField::ConfigurationFlags) CORE_EXPORT QDataStream &operator<<(QDataStream &out
Writes the field to stream out. QGIS version compatibility is not guaranteed.
bool labelTrimTrailingZeroes() const
Returns if the trailing 0 are trimmed in the label.
@ Inner
The class is not at a bound.
double upperBound() const
Returns the upper bound.
MethodProperty
Flags for the classification method.
double lowerBound() const
Returns the lower bound.
virtual void readXml(const QDomElement &element, const QgsReadWriteContext &context)
Reads extra information to apply it to the method.
QgsClassificationRange contains the information about a classification range.
QString labelFormat() const
Returns the format of the label for the classes.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
Represents a vector layer which manages a vector based data sets.
ClassPosition
Defines the class position.
void setLabelTrimTrailingZeroes(bool trimTrailingZeroes)
Defines if the trailing 0 are trimmed in the label.
QgsClassificationJenks is an implementation of QgsClassificationMethod for natural breaks based on Je...
QgsClassificationCustom is an implementation of QgsClassificationMethod based on standard deviation.
virtual QString name() const =0
The readable and translate name of the method.
QVariantMap parameterValues() const
Returns the values of the processing parameters.
bool symmetricModeAvailable() const
Returns if the method supports symmetric calculation.