QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
qgsclassificationprettybreaks.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsclassificationprettybreaks.h
3 ---------------------
4 begin : September 2019
5 copyright : (C) 2019 by Denis Rouzaud
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#include <QObject>
17
19#include "qgssymbollayerutils.h"
20#include "qgsapplication.h"
21
22
28
30{
31 return QObject::tr( "Pretty Breaks" );
32}
33
35{
36 return QStringLiteral( "Pretty" );
37}
38
39QList<double> QgsClassificationPrettyBreaks::calculateBreaks( double &minimum, double &maximum, const QList<double> &values, int nclasses, QString &error )
40{
41 Q_UNUSED( values );
42 Q_UNUSED( error );
43 QList<double> breaks = QgsSymbolLayerUtils::prettyBreaks( minimum, maximum, nclasses );
44
47
48 return breaks;
49}
50
51std::unique_ptr<QgsClassificationMethod> QgsClassificationPrettyBreaks::clone() const
52{
53 std::unique_ptr< QgsClassificationPrettyBreaks > c = std::make_unique< QgsClassificationPrettyBreaks >();
54 copyBase( c.get() );
55 return c;
56}
57
59{
60 return QgsApplication::getThemeIcon( "classification_methods/mClassificationPrettyBreak.svg" );
61}
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.
double symmetryPoint() const
Returns the symmetry point for symmetric mode.
bool symmetricModeEnabled() const
Returns if the symmetric mode is enabled.
static void makeBreaksSymmetric(QList< double > &breaks, double symmetryPoint, bool astride)
Remove the breaks that are above the existing opposite sign classes to keep colors symmetrically bala...
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)
QString name() const override
The readable and translate name of the method.
std::unique_ptr< QgsClassificationMethod > clone() const override
Returns a clone of the method.
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 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...
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