[QGIS Commit] r15020 - trunk/qgis/src/mapserver

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Jan 12 08:42:16 EST 2011


Author: mhugent
Date: 2011-01-12 05:42:16 -0800 (Wed, 12 Jan 2011)
New Revision: 15020

Modified:
   trunk/qgis/src/mapserver/qgsprojectparser.cpp
Log:
Fix for wms server print. Add composer pictures after the composer maps

Modified: trunk/qgis/src/mapserver/qgsprojectparser.cpp
===================================================================
--- trunk/qgis/src/mapserver/qgsprojectparser.cpp	2011-01-12 07:37:33 UTC (rev 15019)
+++ trunk/qgis/src/mapserver/qgsprojectparser.cpp	2011-01-12 13:42:16 UTC (rev 15020)
@@ -846,8 +846,6 @@
     return 0;
   }
 
-  QList<QDomElement> scaleBarElemList;
-
   //go through all the item elements and add them to the composition (and to the lists)
   QDomNodeList itemNodes = composerElem.childNodes();
   for ( int i = 0; i < itemNodes.size(); ++i )
@@ -874,17 +872,6 @@
       legend->readXML( currentElem, *mXMLDoc );
       composition->addItem( legend );
     }
-    else if ( elemName == "ComposerPicture" )
-    {
-      QgsComposerPicture* picture = new QgsComposerPicture( composition );
-      picture->readXML( currentElem, *mXMLDoc );
-      composition->addItem( picture );
-    }
-    else if ( elemName == "ComposerScaleBar" )
-    {
-      //scalebars need to be loaded after the composer maps
-      scaleBarElemList.push_back( currentElem );
-    }
     else if ( elemName == "ComposerShape" )
     {
       QgsComposerShape* shape = new QgsComposerShape( composition );
@@ -905,13 +892,23 @@
     }
   }
 
-  //scalebars need to be loaded after the composer maps to receive the correct size
-  QList<QDomElement>::const_iterator scaleBarIt = scaleBarElemList.constBegin();
-  for ( ; scaleBarIt != scaleBarElemList.constEnd(); ++scaleBarIt )
+  //scalebars and pictures need to be loaded after the maps to receive the correct size / rotation
+  for ( int i = 0; i < itemNodes.size(); ++i )
   {
-    QgsComposerScaleBar* bar = new QgsComposerScaleBar( composition );
-    bar->readXML( *scaleBarIt, *mXMLDoc );
-    composition->addItem( bar );
+    QDomElement currentElem = itemNodes.at( i ).toElement();
+    QString elemName = currentElem.tagName();
+    if ( elemName == "ComposerPicture" )
+    {
+      QgsComposerPicture* picture = new QgsComposerPicture( composition );
+      picture->readXML( currentElem, *mXMLDoc );
+      composition->addItem( picture );
+    }
+    else if ( elemName == "ComposerScaleBar" )
+    {
+      QgsComposerScaleBar* bar = new QgsComposerScaleBar( composition );
+      bar->readXML( currentElem, *mXMLDoc );
+      composition->addItem( bar );
+    }
   }
 
   return composition;



More information about the QGIS-commit mailing list