Skip to content

Commit 5e6341f

Browse files
author
mhugent
committedJan 12, 2011
Fix for wms server print. Add composer pictures after the composer maps
git-svn-id: http://svn.osgeo.org/qgis/trunk@15020 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 70a7af5 commit 5e6341f

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed
 

‎src/mapserver/qgsprojectparser.cpp

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -846,8 +846,6 @@ QgsComposition* QgsProjectParser::initComposition( const QString& composerTempla
846846
return 0;
847847
}
848848

849-
QList<QDomElement> scaleBarElemList;
850-
851849
//go through all the item elements and add them to the composition (and to the lists)
852850
QDomNodeList itemNodes = composerElem.childNodes();
853851
for ( int i = 0; i < itemNodes.size(); ++i )
@@ -874,17 +872,6 @@ QgsComposition* QgsProjectParser::initComposition( const QString& composerTempla
874872
legend->readXML( currentElem, *mXMLDoc );
875873
composition->addItem( legend );
876874
}
877-
else if ( elemName == "ComposerPicture" )
878-
{
879-
QgsComposerPicture* picture = new QgsComposerPicture( composition );
880-
picture->readXML( currentElem, *mXMLDoc );
881-
composition->addItem( picture );
882-
}
883-
else if ( elemName == "ComposerScaleBar" )
884-
{
885-
//scalebars need to be loaded after the composer maps
886-
scaleBarElemList.push_back( currentElem );
887-
}
888875
else if ( elemName == "ComposerShape" )
889876
{
890877
QgsComposerShape* shape = new QgsComposerShape( composition );
@@ -905,13 +892,23 @@ QgsComposition* QgsProjectParser::initComposition( const QString& composerTempla
905892
}
906893
}
907894

908-
//scalebars need to be loaded after the composer maps to receive the correct size
909-
QList<QDomElement>::const_iterator scaleBarIt = scaleBarElemList.constBegin();
910-
for ( ; scaleBarIt != scaleBarElemList.constEnd(); ++scaleBarIt )
895+
//scalebars and pictures need to be loaded after the maps to receive the correct size / rotation
896+
for ( int i = 0; i < itemNodes.size(); ++i )
911897
{
912-
QgsComposerScaleBar* bar = new QgsComposerScaleBar( composition );
913-
bar->readXML( *scaleBarIt, *mXMLDoc );
914-
composition->addItem( bar );
898+
QDomElement currentElem = itemNodes.at( i ).toElement();
899+
QString elemName = currentElem.tagName();
900+
if ( elemName == "ComposerPicture" )
901+
{
902+
QgsComposerPicture* picture = new QgsComposerPicture( composition );
903+
picture->readXML( currentElem, *mXMLDoc );
904+
composition->addItem( picture );
905+
}
906+
else if ( elemName == "ComposerScaleBar" )
907+
{
908+
QgsComposerScaleBar* bar = new QgsComposerScaleBar( composition );
909+
bar->readXML( currentElem, *mXMLDoc );
910+
composition->addItem( bar );
911+
}
915912
}
916913

917914
return composition;

0 commit comments

Comments
 (0)
Please sign in to comment.