Skip to content

Commit

Permalink
fix #6978
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jul 15, 2013
1 parent d0c3f4f commit 33cbb6c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/mapserver/qgis_map_serv.cpp
Expand Up @@ -602,7 +602,9 @@ int main( int argc, char * argv[] )
delete theServer;
continue;
}
else if ( request.compare( "GetLegendGraphic", Qt::CaseInsensitive ) == 0 || request.compare( "GetLegendGraphics", Qt::CaseInsensitive ) == 0 ) // GetLegendGraphics for compatibility with earlier QGIS versions
else if ( request.compare( "GetLegendGraphic", Qt::CaseInsensitive ) == 0 ||
request.compare( "GetLegendGraphics", Qt::CaseInsensitive ) == 0 )
// GetLegendGraphics for compatibility with earlier QGIS versions
{
QImage* result = 0;
try
Expand All @@ -611,6 +613,7 @@ int main( int argc, char * argv[] )
}
catch ( QgsMapServiceException& ex )
{
QgsDebugMsg( "Caught exception during GetLegendGraphic request" );
theRequestHandler->sendServiceException( ex );
}

Expand All @@ -619,6 +622,7 @@ int main( int argc, char * argv[] )
QgsDebugMsg( "Sending GetLegendGraphic response" );
//sending is the same for GetMap and GetLegendGraphic
theRequestHandler->sendGetMapResponse( serviceString, result );
QgsDebugMsg( "Response sent" );
}
else
{
Expand All @@ -629,7 +633,6 @@ int main( int argc, char * argv[] )
delete theRequestHandler;
delete theServer;
continue;

}
else if ( request.compare( "GetPrint", Qt::CaseInsensitive ) == 0 )
{
Expand Down
5 changes: 3 additions & 2 deletions src/mapserver/qgswmsserver.cpp
Expand Up @@ -380,17 +380,18 @@ QImage* QgsWMSServer::getLegendGraphics()
boxSpace, layerSpace, layerTitleSpace, symbolSpace, iconLabelSpace, symbolWidth, symbolHeight, fontOversamplingFactor,
theImage->dotsPerMeterX() * 0.0254 );
}
currentY += layerSpace;
}
currentY += boxSpace;

//create second image with the right dimensions
QImage* paintImage = createImage( maxTextWidth + maxSymbolWidth, currentY );
QImage* paintImage = createImage( maxTextWidth + maxSymbolWidth, ceil( currentY ) );

//go through the items a second time for painting
QPainter p( paintImage );
p.setRenderHint( QPainter::Antialiasing, true );
currentY = boxSpace;

currentY = boxSpace;
for ( int i = 0; i < numLayerItems; ++i )
{
QgsComposerLayerItem* layerItem = dynamic_cast<QgsComposerLayerItem*>( rootItem->child( i ) );
Expand Down

0 comments on commit 33cbb6c

Please sign in to comment.