Skip to content
Permalink
Browse files

Applied #2963 (fix crash with quantiles) from Jeremy Palmer. Thanks!

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14398 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder
wonder committed Oct 18, 2010
1 parent f43b3f2 commit b40799d6ec8167d9058e764d6ea6054a47f8a910
Showing with 11 additions and 8 deletions.
  1. +11 −8 src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp
@@ -322,16 +322,19 @@ static QList<double> _calcQuantileBreaks( QList<double> values, int classes )
QList<double> breaks;

int n = values.count();
double q, a, aa, r, Xq;
for ( int i = 0; i < ( classes - 1 ); i++ )
{
q = ( i + 1 ) / ( double ) classes;
a = q * n;
aa = ( int )( q * n );
double Xq = n > 0 ? values[0] : 0.0;

r = a - aa;
Xq = ( 1 - r ) * values[aa] + r * values[aa+1];
for ( int i = 1; i < classes; i++ )
{
if( n > 1 )
{
double q = i / ( double ) classes;
double a = q * (n-1);
int aa = ( int )( a );

double r = a - aa;
Xq = ( 1 - r ) * values[aa] + r * values[aa+1];
}
breaks.append( Xq );
}

0 comments on commit b40799d

Please sign in to comment.
You can’t perform that action at this time.