Skip to content
Permalink
Browse files

use layer title instead of name in server getlegendgraphic response (f…

…ixes #11406)
  • Loading branch information
jef-n committed Oct 16, 2014
1 parent 4bf04e1 commit bb95a0f43a53602bd7ad1ea6783d251755c66019
Showing with 6 additions and 6 deletions.
  1. +0 −5 src/core/qgslegendrenderer.cpp
  2. +6 −1 src/mapserver/qgswmsserver.cpp
@@ -147,9 +147,6 @@ QSizeF QgsLegendRenderer::paintAndDetermineSize( QPainter* painter )
}





QList<QgsLegendRenderer::Atom> QgsLegendRenderer::createAtomList( QgsLayerTreeGroup* parentGroup, bool splitLayer )
{
QList<Atom> atoms;
@@ -248,7 +245,6 @@ QList<QgsLegendRenderer::Atom> QgsLegendRenderer::createAtomList( QgsLayerTreeGr
}



void QgsLegendRenderer::setColumns( QList<Atom>& atomList )
{
if ( mSettings.columnCount() == 0 ) return;
@@ -348,7 +344,6 @@ void QgsLegendRenderer::setColumns( QList<Atom>& atomList )
}



QSizeF QgsLegendRenderer::drawTitle( QPainter* painter, QPointF point, Qt::AlignmentFlag halignment, double legendWidth )
{
QSizeF size( 0, 0 );
@@ -656,7 +656,12 @@ QImage* QgsWMSServer::getLegendGraphics()

QgsLayerTreeGroup rootGroup;
foreach ( QString layerId, layerIds )
rootGroup.addLayer( QgsMapLayerRegistry::instance()->mapLayer( layerId ) );
{
QgsMapLayer *ml = QgsMapLayerRegistry::instance()->mapLayer( layerId );
QgsLayerTreeLayer *layer = rootGroup.addLayer( ml );
if( !ml->title().isEmpty() )
layer->setLayerName( ml->title() );
}
QgsLayerTreeModel legendModel( &rootGroup );

QList<QgsLayerTreeNode*> rootChildren = rootGroup.children();

0 comments on commit bb95a0f

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