Skip to content
Permalink
Browse files
Merge pull request #338 from simon04/too_many_classes
Abort classification upon high number of classes
  • Loading branch information
mach0 committed Nov 25, 2012
2 parents a0c8b5c + 755707d commit 9f71d9f2982791c33f86b0e80c140cd0ab78530c
Showing with 13 additions and 0 deletions.
  1. +13 −0 src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.cpp
@@ -596,6 +596,19 @@ void QgsCategorizedSymbolRendererV2Widget::addCategories()
QList<QVariant> unique_vals;
mLayer->uniqueValues( idx, unique_vals );

// ask to abort if too many classes
if ( unique_vals.size() >= 1000 )
{
int res = QMessageBox::warning( 0, tr( "High number of classes!" ),
tr( "Classification would yield %1 entries which might not be expected. Continue?" ).arg( unique_vals.size() ),
QMessageBox::Ok | QMessageBox::Cancel,
QMessageBox::Cancel );
if ( res == QMessageBox::Cancel )
{
return;
}
}

//DlgAddCategories dlg(mStyle, createDefaultSymbol(), unique_vals, this);
//if (!dlg.exec())
// return;

0 comments on commit 9f71d9f

Please sign in to comment.