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 =
nullptr;
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;
357 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsClassificationMethod::MethodProperties )
359 #endif // QGSCLASSIFICATIONMETHOD_H