Navigation Menu

Skip to content

Commit

Permalink
Fix #2862
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@13883 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Jul 4, 2010
1 parent 670acf2 commit aca9fc4
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.cpp
Expand Up @@ -279,7 +279,6 @@ void QgsCategorizedSymbolRendererV2Widget::addCategories()
QgsCategoryList cats;
_createCategories( cats, unique_vals, mCategorizedSymbol, ramp );

bool deleteExisting = false;
if ( !mOldClassificationAttribute.isEmpty() &&
attrName != mOldClassificationAttribute &&
mRenderer->categories().count() > 0 )
Expand All @@ -292,31 +291,31 @@ void QgsCategorizedSymbolRendererV2Widget::addCategories()
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel );
if ( res == QMessageBox::Cancel )
return;
if ( res == QMessageBox::Yes )
deleteExisting = true;
}

mOldClassificationAttribute = attrName;

if ( !deleteExisting )
{
QgsCategoryList prevCats = mRenderer->categories();
for ( int i = 0; i < cats.size(); ++i )
bool deleteExisting = ( res == QMessageBox::Yes );
if ( !deleteExisting )
{
bool contains = false;
QVariant value = cats.at( i ).value();
for ( int j = 0; j < prevCats.size() && !contains; ++j )
QgsCategoryList prevCats = mRenderer->categories();
for ( int i = 0; i < cats.size(); ++i )
{
if ( prevCats.at( j ).value() == value )
contains = true;
bool contains = false;
QVariant value = cats.at( i ).value();
for ( int j = 0; j < prevCats.size() && !contains; ++j )
{
if ( prevCats.at( j ).value() == value )
contains = true;
}

if ( !contains )
prevCats.append( cats.at( i ) );
}

if ( !contains )
prevCats.append( cats.at( i ) );
cats = prevCats;
}
cats = prevCats;

}

mOldClassificationAttribute = attrName;

// TODO: if not all categories are desired, delete some!
/*
if (not dlg.readAllCats.isChecked())
Expand Down

0 comments on commit aca9fc4

Please sign in to comment.