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;
static const QString METHOD_ID
QgsClassificationEqualInterval is an implementation of QgsClassificationMethod for equal intervals...
QgsClassificationEqualInterval()
bool symmetryAstride() const
Returns if the symmetric mode is astride if true, it will remove the symmetry point break so that the...
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon.
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
double symmetryPoint() const
Returns the symmetry point for symmetric mode.
QString name() const override
The readable and translate name of the method.
void copyBase(QgsClassificationMethod *c) const
Copy the parameters (shall be used in clone implementation)
bool symmetricModeEnabled() const
Returns if the symmetric mode is enabled.
QString id() const override
The id of the method as saved in the project, must be unique in registry.
QIcon icon() const override
The icon of the method.
QgsClassificationMethod is an abstract class for implementations of classification methods...
QgsClassificationMethod * clone() const override
Returns a clone of the method.