sip, doc, bad keywords

This commit is contained in:
pierreloicq 2018-09-07 09:35:18 +02:00 committed by Nyall Dawson
parent 7cec3ef5d1
commit e73f74063e
3 changed files with 43 additions and 6 deletions

View File

@ -279,6 +279,30 @@ Returns if we want to have a central class astride the pivot value
Set if we want a central class astride the pivot value
.. versionadded:: 3.4
%End
static void makeBreaksSymmetric( QList<double> &breaks, double symmetryPoint, bool astride );
%Docstring
Remove the breaks that are above the existing opposite sign classes to keep colors symmetrically balanced around symmetryPoint
Does not put a break on the symmetryPoint. This is done before.
:param breaks: The breaks of an already-done classification
:param symmetryPoint: The point around which we want a symmetry
:param astride: A bool indicating if the symmetry is made astride the symmetryPoint or not ( [-1,1] vs. [-1,0][0,1] )
.. versionadded:: 3.4
%End
static QList<double> calcEqualIntervalBreaks( double minimum, double maximum, int classes, bool useSymmetricMode, double symmetryPoint, bool astride );
%Docstring
Compute the equal interval classification
:param minimum: The minimum value of the distribution
:param maximum: The maximum value of the distribution
:param classes: The number of classes desired
:param useSymmetricMode: A bool indicating if we want to have classes and hence colors ramp symmetric around a value
:param symmetryPoint: The point around which we want a symmetry
:param astride: A bool indicating if the symmetry is made astride the symmetryPoint or not ( [-1,1] vs. [-1,0][0,1] )
%End
void updateClasses( QgsVectorLayer *vlayer, Mode mode, int nclasses, bool useSymmetricMode = false, double symmetryPoint = 0.0, bool astride = false );

View File

@ -538,16 +538,17 @@ void QgsGraduatedSymbolRenderer::makeBreaksSymmetric( QList<double> &breaks, dou
if ( breaks.size() > 1 ) //to avoid crash when only 1 class
{
qSort( breaks.begin(), breaks.end() );
std::sort( breaks.begin(), breaks.end() );
// breaks contain the maximum of the distrib but not the minimum
double distBelowSymmetricValue = qAbs( breaks[0] - symmetryPoint );
double distAboveSymmetricValue = qAbs( breaks[ breaks.size() - 2 ] - symmetryPoint ) ;
double absMin = qMin( qAbs( distAboveSymmetricValue ), qAbs( distBelowSymmetricValue ) );
double distBelowSymmetricValue = std::fabs( breaks[0] - symmetryPoint );
double distAboveSymmetricValue = std::fabs( breaks[ breaks.size() - 2 ] - symmetryPoint ) ;
double absMin = std::min( distAboveSymmetricValue, distBelowSymmetricValue );
// make symmetric
for ( int i = 0; i <= breaks.size() - 2; ++i )
{
if ( qAbs( breaks.at( i ) - symmetryPoint ) >= ( absMin - qAbs( breaks[0] - breaks[1] ) / 100. ) )
// part after "absMin" is for doubles rounding issues
if ( std::fabs( breaks.at( i ) - symmetryPoint ) >= ( absMin - std::fabs( breaks[0] - breaks[1] ) / 100. ) )
{
breaks.removeAt( i );
--i;

View File

@ -272,11 +272,23 @@ class CORE_EXPORT QgsGraduatedSymbolRenderer : public QgsFeatureRenderer
/**
* Remove the breaks that are above the existing opposite sign classes to keep colors symmetrically balanced around symmetryPoint
* Does not put a break on the symmetryPoint
* Does not put a break on the symmetryPoint. This is done before.
* \param breaks The breaks of an already-done classification
* \param symmetryPoint The point around which we want a symmetry
* \param astride A bool indicating if the symmetry is made astride the symmetryPoint or not ( [-1,1] vs. [-1,0][0,1] )
* \since QGIS 3.4
*/
static void makeBreaksSymmetric( QList<double> &breaks, double symmetryPoint, bool astride );
/**
* Compute the equal interval classification
* \param minimum The minimum value of the distribution
* \param maximum The maximum value of the distribution
* \param classes The number of classes desired
* \param useSymmetricMode A bool indicating if we want to have classes and hence colors ramp symmetric around a value
* \param symmetryPoint The point around which we want a symmetry
* \param astride A bool indicating if the symmetry is made astride the symmetryPoint or not ( [-1,1] vs. [-1,0][0,1] )
*/
static QList<double> calcEqualIntervalBreaks( double minimum, double maximum, int classes, bool useSymmetricMode, double symmetryPoint, bool astride );
/**