Skip to content
Permalink
Browse files

Applied part of #2832 (show rules in legend).

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14404 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder
wonder committed Oct 18, 2010
1 parent 80b5759 commit b1c0053dd0f0612b586bf666007e132412e19e73
@@ -448,6 +448,9 @@ class QgsRuleBasedRendererV2 : QgsFeatureRendererV2
//! store renderer info to XML element
virtual QDomElement save( QDomDocument& doc );

//! return a list of symbology items for the legend
virtual QgsLegendSymbologyList legendSymbologyItems( QSize iconSize );

/////

//! return the total number of rules
@@ -244,6 +244,28 @@ QDomElement QgsRuleBasedRendererV2::save( QDomDocument& doc )
}


QgsLegendSymbologyList QgsRuleBasedRendererV2::legendSymbologyItems( QSize iconSize )
{
QgsLegendSymbologyList lst;
for ( QList<Rule>::iterator it = mRules.begin(); it != mRules.end(); ++it )
{
QPixmap pix = QgsSymbolLayerV2Utils::symbolPreviewPixmap( it->symbol(), iconSize );
lst << qMakePair( it->filterExpression(), pix );
}
return lst;
}

QgsLegendSymbolList QgsRuleBasedRendererV2::legendSymbolItems()
{
QgsLegendSymbolList lst;
for ( QList<Rule>::iterator it = mRules.begin(); it != mRules.end(); ++it )
{
lst << qMakePair( it->filterExpression(), it->symbol() );
}
return lst;
}


QgsFeatureRendererV2* QgsRuleBasedRendererV2::create( QDomElement& element )
{
// load symbols
@@ -102,6 +102,13 @@ class CORE_EXPORT QgsRuleBasedRendererV2 : public QgsFeatureRendererV2
//! store renderer info to XML element
virtual QDomElement save( QDomDocument& doc );

//! return a list of symbology items for the legend
virtual QgsLegendSymbologyList legendSymbologyItems( QSize iconSize );

//! return a list of item text / symbol
//! @note: this method was added in version 1.5
virtual QgsLegendSymbolList legendSymbolItems();

/////

//! return the total number of rules

0 comments on commit b1c0053

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