Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
show classification attribute above the classes in legend
git-svn-id: http://svn.osgeo.org/qgis/trunk@12587 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Dec 22, 2009
1 parent 69bb75f commit 457b180
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions src/app/legend/qgslegendlayer.cpp
Expand Up @@ -216,6 +216,26 @@ void QgsLegendLayer::vectorLayerSymbology( const QgsVectorLayer* layer, double w
const QgsRenderer* renderer = layer->renderer();
const QList<QgsSymbol*> sym = renderer->symbols();

//create an item for each classification field (only one for most renderers)
QSettings settings;
if ( settings.value( "/qgis/showLegendClassifiers", false ).toBool() )
{
if ( renderer->needsAttributes() )
{
QgsAttributeList classfieldlist = renderer->classificationAttributes();
const QgsFieldMap& fields = layer->pendingFields();
for ( QgsAttributeList::iterator it = classfieldlist.begin(); it != classfieldlist.end(); ++it )
{
QString classfieldname = layer->attributeAlias( *it );
if ( classfieldname.isEmpty() )
{
classfieldname = fields[*it].name();
}
itemList.append( qMakePair( classfieldname, QPixmap() ) );
}
}
}

for ( QList<QgsSymbol*>::const_iterator it = sym.begin(); it != sym.end(); ++it )
{
QImage img;
Expand Down Expand Up @@ -255,27 +275,6 @@ void QgsLegendLayer::vectorLayerSymbology( const QgsVectorLayer* layer, double w
itemList.append( qMakePair( values, pix ) );
}


//create an item for each classification field (only one for most renderers)
QSettings settings;
if ( settings.value( "/qgis/showLegendClassifiers", false ).toBool() )
{
if ( renderer->needsAttributes() )
{
QgsAttributeList classfieldlist = renderer->classificationAttributes();
const QgsFieldMap& fields = layer->pendingFields();
for ( QgsAttributeList::iterator it = classfieldlist.begin(); it != classfieldlist.end(); ++it )
{
QString classfieldname = layer->attributeAlias( *it );
if ( classfieldname.isEmpty() )
{
classfieldname = fields[*it].name();
}
itemList.append( qMakePair( classfieldname, QPixmap() ) );
}
}
}

changeSymbologySettings( layer, itemList );
}

Expand Down

0 comments on commit 457b180

Please sign in to comment.