27 return QObject::tr(
"Equal Count (Quantile)" );
32 return QStringLiteral(
"Quantile" );
37 std::unique_ptr<QgsClassificationQuantile >
c = std::make_unique< QgsClassificationQuantile >();
48QList<double> QgsClassificationQuantile::calculateBreaks(
double &minimum,
double &maximum,
49 const QList<double> &values,
int nclasses, QString &error )
64 QList<double> _values = values;
65 std::sort( _values.begin(), _values.end() );
70 if ( _values.isEmpty() )
71 return QList<double>();
73 const int n = _values.count();
74 double Xq = n > 0 ? _values[0] : 0.0;
76 breaks.reserve( nclasses );
77 for (
int i = 1; i < nclasses; i++ )
81 const double q = i /
static_cast< double >( nclasses );
82 const double a = q * ( n - 1 );
83 const int aa =
static_cast< int >( a );
85 const double r = a - aa;
86 Xq = ( 1 - r ) * _values[aa] + r * _values[aa + 1];
91 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)
std::unique_ptr< 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