Showing with 9 additions and 0 deletions.
  1. +9 −0 src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp
9 changes: 9 additions & 0 deletions src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,15 @@ void QgsGraduatedSymbolRendererV2Widget::classifyGraduated()
else // default should be quantile for now
mode = QgsGraduatedSymbolRendererV2::Quantile;


// Jenks is n^2 complexity, warn for big dataset (more than 50k records)
// and give the user the chance to cancel
if ( QgsGraduatedSymbolRendererV2::Jenks == mode
&& mLayer->featureCount() > 50000 )
{
if ( QMessageBox::Cancel == QMessageBox::question( this, tr( "Warning" ), tr( "Natural break classification (Jenks) is O(n2) complexity, your classification may take a long time.\nPress cancel to abort breaks calculation or OK to continue." ), QMessageBox::Cancel, QMessageBox::Ok ) ) return;
}

// create and set new renderer
QApplication::setOverrideCursor( Qt::WaitCursor );
QgsGraduatedSymbolRendererV2* r = QgsGraduatedSymbolRendererV2::createRenderer(
Expand Down