QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
30 return QObject::tr(
"Equal Interval" );
38 QList<double> QgsClassificationEqualInterval::calculateBreaks(
double &minimum,
double &maximum,
39 const QList<double> &values,
int nclasses )
48 double step = ( maximum - minimum ) / nclasses;
50 double value = minimum;
51 breaks.reserve( nclasses );
52 for (
int i = 0; i < nclasses; i++ )
59 breaks[nclasses - 1] = maximum;
63 double distBelowSymmetricValue = std::abs( minimum -
symmetryPoint() );
64 double distAboveSymmetricValue = std::abs( maximum -
symmetryPoint() ) ;
68 if ( nclasses % 2 == 0 )
73 if ( nclasses % 2 == 1 )
76 double step = 2 * std::min( distBelowSymmetricValue, distAboveSymmetricValue ) / nclasses;
78 breaks.reserve( nclasses );
79 double value = ( distBelowSymmetricValue < distAboveSymmetricValue ) ? minimum : maximum - nclasses * step;
81 for (
int i = 0; i < nclasses; i++ )
86 breaks[nclasses - 1] = maximum;
QgsClassificationMethod is an abstract class for implementations of classification methods.
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon.
QgsClassificationEqualInterval()
bool symmetryAstride() const
Returns if the symmetric mode is astride if true, it will remove the symmetry point break so that the...
QIcon icon() const override
The icon of the method.
QgsClassificationEqualInterval is an implementation of QgsClassificationMethod for equal intervals.
double symmetryPoint() const
Returns the symmetry point for symmetric mode.
bool symmetricModeEnabled() const
Returns if the symmetric mode is enabled.
void copyBase(QgsClassificationMethod *c) const
Copy the parameters (shall be used in clone implementation)
QString name() const override
The readable and translate name of the method.
static const QString METHOD_ID
QString id() const override
The id of the method as saved in the project, must be unique in registry.
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
QgsClassificationMethod * clone() const override
Returns a clone of the method.