30 return QObject::tr(
"Equal Interval" );
38 QList<double> QgsClassificationEqualInterval::calculateBreaks(
double &minimum,
double &maximum,
39 const QList<double> &values,
int nclasses )
48 const 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 const double distBelowSymmetricValue = std::abs( minimum -
symmetryPoint() );
64 const double distAboveSymmetricValue = std::abs( maximum -
symmetryPoint() ) ;
68 if ( nclasses % 2 == 0 )
73 if ( nclasses % 2 == 1 )
76 const 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 QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
QgsClassificationEqualInterval is an implementation of QgsClassificationMethod for equal intervals.
QgsClassificationMethod * clone() const override
Returns a clone of the method.
QString name() const override
The readable and translate name of the method.
QString id() const override
The id of the method as saved in the project, must be unique in registry.
static const QString METHOD_ID
QgsClassificationEqualInterval()
QIcon icon() const override
The icon of the method.
QgsClassificationMethod is an abstract class for implementations of classification methods.
double symmetryPoint() const
Returns the symmetry point for symmetric mode.
bool symmetricModeEnabled() const
Returns if the symmetric mode is enabled.
bool symmetryAstride() const
Returns if the symmetric mode is astride if true, it will remove the symmetry point break so that the...
void copyBase(QgsClassificationMethod *c) const
Copy the parameters (shall be used in clone implementation)
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