36 return QObject::tr(
"Logarithmic scale" );
41 return QStringLiteral(
"Logarithmic" );
49 QList<double> QgsClassificationLogarithmic::calculateBreaks(
double minimum,
double maximum,
const QList<double> &values,
int nclasses )
54 int lmin = std::floor( std::log10( minimum ) );
55 int lmax = std::ceil( std::log10( maximum ) );
58 nclasses = std::min( lmax - lmin + 1, nclasses );
64 for (
int i = 0; i < breaks.count(); i++ )
65 breaks[i] = std::pow( 10, breaks.at( i ) );
70 QString QgsClassificationLogarithmic::valueToLabel(
double value )
const 72 QString label = QString( QStringLiteral(
"10^%1" ) ).arg( std::log10( value ) );
79 const QString upperLabel = valueToLabel( upperValue );
88 lowerLabel = valueToLabel( lowerValue );
92 return labelFormat().arg( lowerLabel ).arg( upperLabel );
QString formatNumber(double value) const
Format the number according to label properties.
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.
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon.
The class is not at a bound.
QgsClassificationLogarithmic()
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
The class is at the upper bound.
QString labelForRange(double lowerValue, double upperValue, ClassPosition position) const override
Returns the label for a range.
The class is at the lower bound.
void copyBase(QgsClassificationMethod *c) const
Copy the parameters (shall be used in clone implementation)
QString labelFormat() const
Returns the format of the label for the classes.
QgsClassificationMethod * clone() const override
Returns a clone of the method.
static QList< double > prettyBreaks(double minimum, double maximum, int classes)
Computes a sequence of about 'classes' equally spaced round values which cover the range of values fr...
QString name() const override
The readable and translate name of the method.
ClassPosition
Defines the class position.
QgsClassificationMethod is an abstract class for implementations of classification methods...
Implementation of a logarithmic scale method.