[QGIS Commit] r11867 - trunk/qgis/src/core/composer

svn_qgis at osgeo.org svn_qgis at osgeo.org
Fri Oct 30 05:34:46 EDT 2009


Author: mhugent
Date: 2009-10-30 05:34:45 -0400 (Fri, 30 Oct 2009)
New Revision: 11867

Modified:
   trunk/qgis/src/core/composer/qgscomposermap.cpp
   trunk/qgis/src/core/composer/qgscomposermap.h
Log:
disable global composer map counter. Fixes ticket 2042

Modified: trunk/qgis/src/core/composer/qgscomposermap.cpp
===================================================================
--- trunk/qgis/src/core/composer/qgscomposermap.cpp	2009-10-30 07:20:26 UTC (rev 11866)
+++ trunk/qgis/src/core/composer/qgscomposermap.cpp	2009-10-30 09:34:45 UTC (rev 11867)
@@ -39,8 +39,6 @@
 #include <iostream>
 #include <cmath>
 
-int QgsComposerMap::mCurrentComposerId = 0;
-
 QgsComposerMap::QgsComposerMap( QgsComposition *composition, int x, int y, int width, int height )
     : QgsComposerItem( x, y, width, height, composition ), mKeepLayerSet( false ), mGridEnabled( false ), mGridStyle( Solid ), \
     mGridIntervalX( 0.0 ), mGridIntervalY( 0.0 ), mGridOffsetX( 0.0 ), mGridOffsetY( 0.0 ), mGridAnnotationPrecision( 3 ), mShowGridAnnotation( false ), \
@@ -48,8 +46,8 @@
     mRotation( 0 ), mCrossLength( 3 )
 {
   mComposition = composition;
+  mId = mComposition->composerMapItems().size();
   mMapRenderer = mComposition->mapRenderer();
-  mId = mCurrentComposerId++;
   mPreviewMode = QgsComposerMap::Rectangle;
   mCurrentRectangle = rect();
 
@@ -87,7 +85,7 @@
 
   mComposition = composition;
   mMapRenderer = mComposition->mapRenderer();
-  mId = mCurrentComposerId++;
+  mId = mComposition->composerMapItems().size();
   mPreviewMode = QgsComposerMap::Rectangle;
   mCurrentRectangle = rect();
 
@@ -560,6 +558,7 @@
   }
 
   QDomElement composerMapElem = doc.createElement( "ComposerMap" );
+  composerMapElem.setAttribute( "id", mId );
 
   //previewMode
   if ( mPreviewMode == Cache )
@@ -643,6 +642,11 @@
     return false;
   }
 
+  QString idRead = itemElem.attribute( "id", "not found" );
+  if ( idRead != "not found" )
+  {
+    mId = idRead.toInt();
+  }
   mPreviewMode = Rectangle;
 
   //previewMode

Modified: trunk/qgis/src/core/composer/qgscomposermap.h
===================================================================
--- trunk/qgis/src/core/composer/qgscomposermap.h	2009-10-30 07:20:26 UTC (rev 11866)
+++ trunk/qgis/src/core/composer/qgscomposermap.h	2009-10-30 09:34:45 UTC (rev 11867)
@@ -309,9 +309,6 @@
     /**Stored layer list (used if layer live-link mKeepLayerSet is disabled)*/
     QStringList mLayerSet;
 
-    /**For the generation of new unique ids*/
-    static int mCurrentComposerId;
-
     /**Establishes signal/slot connection for update in case of layer change*/
     void connectUpdateSlot();
 



More information about the QGIS-commit mailing list