27 return QObject::tr(
"Equal Count (Quantile)" );
32 return QStringLiteral(
"Quantile" );
48 QList<double> QgsClassificationQuantile::calculateBreaks(
double &minimum,
double &maximum,
49 const QList<double> &values,
int nclasses )
63 QList<double> _values = values;
64 std::sort( _values.begin(), _values.end() );
69 if ( _values.isEmpty() )
70 return QList<double>();
72 int n = _values.count();
73 double Xq = n > 0 ? _values[0] : 0.0;
75 breaks.reserve( nclasses );
76 for (
int i = 1; i < nclasses; i++ )
80 double q = i /
static_cast< double >( nclasses );
81 double a = q * ( n - 1 );
82 int aa =
static_cast< int >( a );
85 Xq = ( 1 - r ) * _values[aa] + r * _values[aa + 1];
90 breaks.append( _values[ n - 1 ] );
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
QgsClassificationMethod is an abstract class for implementations of classification methods.
void copyBase(QgsClassificationMethod *c) const
Copy the parameters (shall be used in clone implementation)
QgsClassificationQuantile is an implementation of QgsClassificationMethod based on quantiles.
QgsClassificationMethod * clone() const override
Returns a clone of the method.
QgsClassificationQuantile()
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.
QString name() const override
The readable and translate name of the method.
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