Skip to content

Commit

Permalink
auto updating of categorized rendrer symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
Arunmozhi committed Oct 7, 2012
1 parent 70b7c3b commit c10920b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp
Expand Up @@ -596,3 +596,15 @@ void QgsCategorizedSymbolRendererV2::setSourceColorRamp( QgsVectorColorRampV2* r
delete mSourceColorRamp;
mSourceColorRamp = ramp;
}

void QgsCategorizedSymbolRendererV2::updateSymbols( QgsSymbolV2 * sym )
{
int i = 0;
foreach( QgsRendererCategoryV2 cat, mCategories )
{
QgsSymbolV2* symbol = sym->clone();
symbol->setColor( cat.symbol()->color() );
updateCategorySymbol( i, symbol );
++i;
}
}
2 changes: 2 additions & 0 deletions src/core/symbology-ng/qgscategorizedsymbolrendererv2.h
Expand Up @@ -84,6 +84,8 @@ class CORE_EXPORT QgsCategorizedSymbolRendererV2 : public QgsFeatureRendererV2
virtual int capabilities() { return SymbolLevels | RotationField; }

virtual QgsSymbolV2List symbols();
//! @note added in 2.0
void updateSymbols( QgsSymbolV2 * sym );

const QgsCategoryList& categories() { return mCategories; }

Expand Down
3 changes: 3 additions & 0 deletions src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.cpp
Expand Up @@ -164,6 +164,9 @@ void QgsCategorizedSymbolRendererV2Widget::changeCategorizedSymbol()

mCategorizedSymbol = newSymbol;
updateCategorizedSymbolIcon();

mRenderer->updateSymbols( mCategorizedSymbol );
populateCategories();
}

void QgsCategorizedSymbolRendererV2Widget::updateCategorizedSymbolIcon()
Expand Down

0 comments on commit c10920b

Please sign in to comment.