30 return QObject::tr(
"Equal Interval" );
38QList<double> QgsClassificationEqualInterval::calculateBreaks(
double &minimum,
double &maximum,
39 const QList<double> &values,
int nclasses, QString &error )
49 const double step = ( maximum - minimum ) / nclasses;
51 double value = minimum;
52 breaks.reserve( nclasses );
53 for (
int i = 0; i < nclasses; i++ )
60 breaks[nclasses - 1] = maximum;
64 const double distBelowSymmetricValue = std::abs( minimum -
symmetryPoint() );
65 const double distAboveSymmetricValue = std::abs( maximum -
symmetryPoint() ) ;
69 if ( nclasses % 2 == 0 )
74 if ( nclasses % 2 == 1 )
77 const double step = 2 * std::min( distBelowSymmetricValue, distAboveSymmetricValue ) / nclasses;
79 breaks.reserve( nclasses );
80 double value = ( distBelowSymmetricValue < distAboveSymmetricValue ) ? minimum : maximum - nclasses * step;
82 for (
int i = 0; i < nclasses; i++ )
87 breaks[nclasses - 1] = maximum;
96 std::unique_ptr< QgsClassificationEqualInterval >
c = std::make_unique< QgsClassificationEqualInterval >();
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
std::unique_ptr< 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