QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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
6  email : [email protected]
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 
24  : QgsClassificationMethod( SymmetricModeAvailable )
25 {
26 
27 }
28 
30 {
31  return QObject::tr( "Pretty Breaks" );
32 }
33 
35 {
36  return QStringLiteral( "Pretty" );
37 }
38 
39 QList<double> QgsClassificationPrettyBreaks::calculateBreaks( double &minimum, double &maximum, const QList<double> &values, int nclasses )
40 {
41  Q_UNUSED( values );
42  QList<double> breaks = QgsSymbolLayerUtils::prettyBreaks( minimum, maximum, nclasses );
43 
44  if ( symmetricModeEnabled() )
46 
47  return breaks;
48 }
49 
51 {
53  copyBase( c );
54  return c;
55 }
56 
58 {
59  return QgsApplication::getThemeIcon( "classification_methods/mClassificationPrettyBreak.svg" );
60 }
QgsClassificationMethod
QgsClassificationMethod is an abstract class for implementations of classification methods.
Definition: qgsclassificationmethod.h:88
QgsClassificationPrettyBreaks
QgsClassificationPrettyBreaks is an implementation of QgsClassificationMethod for pretty breaks.
Definition: qgsclassificationprettybreaks.h:28
QgsClassificationMethod::symmetryAstride
bool symmetryAstride() const
Returns if the symmetric mode is astride if true, it will remove the symmetry point break so that the...
Definition: qgsclassificationmethod.h:205
QgsClassificationPrettyBreaks::QgsClassificationPrettyBreaks
QgsClassificationPrettyBreaks()
Definition: qgsclassificationprettybreaks.cpp:23
qgssymbollayerutils.h
QgsClassificationPrettyBreaks::id
QString id() const override
The id of the method as saved in the project, must be unique in registry.
Definition: qgsclassificationprettybreaks.cpp:34
qgsclassificationprettybreaks.h
qgsapplication.h
QgsClassificationMethod::symmetryPoint
double symmetryPoint() const
Returns the symmetry point for symmetric mode.
Definition: qgsclassificationmethod.h:199
QgsClassificationMethod::symmetricModeEnabled
bool symmetricModeEnabled() const
Returns if the symmetric mode is enabled.
Definition: qgsclassificationmethod.h:194
QgsClassificationPrettyBreaks::name
QString name() const override
The readable and translate name of the method.
Definition: qgsclassificationprettybreaks.cpp:29
QgsSymbolLayerUtils::prettyBreaks
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...
Definition: qgssymbollayerutils.cpp:4580
QgsClassificationMethod::copyBase
void copyBase(QgsClassificationMethod *c) const
Copy the parameters (shall be used in clone implementation)
Definition: qgsclassificationmethod.cpp:52
QgsClassificationPrettyBreaks::clone
QgsClassificationMethod * clone() const override
Returns a clone of the method.
Definition: qgsclassificationprettybreaks.cpp:50
QgsClassificationPrettyBreaks::icon
QIcon icon() const override
The icon of the method.
Definition: qgsclassificationprettybreaks.cpp:57
QgsClassificationMethod::makeBreaksSymmetric
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...
Definition: qgsclassificationmethod.cpp:301
c
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
Definition: porting_processing.dox:1
QgsApplication::getThemeIcon
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
Definition: qgsapplication.cpp:693