Skip to content

Commit bf347d0

Browse files
author
mhugent
committed
disable global composer map counter. Fixes ticket 2042
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11867 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent b40d103 commit bf347d0

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/core/composer/qgscomposermap.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,15 @@
3939
#include <iostream>
4040
#include <cmath>
4141

42-
int QgsComposerMap::mCurrentComposerId = 0;
43-
4442
QgsComposerMap::QgsComposerMap( QgsComposition *composition, int x, int y, int width, int height )
4543
: QgsComposerItem( x, y, width, height, composition ), mKeepLayerSet( false ), mGridEnabled( false ), mGridStyle( Solid ), \
4644
mGridIntervalX( 0.0 ), mGridIntervalY( 0.0 ), mGridOffsetX( 0.0 ), mGridOffsetY( 0.0 ), mGridAnnotationPrecision( 3 ), mShowGridAnnotation( false ), \
4745
mGridAnnotationPosition( OutsideMapFrame ), mAnnotationFrameDistance( 1.0 ), mGridAnnotationDirection( Horizontal ), \
4846
mRotation( 0 ), mCrossLength( 3 )
4947
{
5048
mComposition = composition;
49+
mId = mComposition->composerMapItems().size();
5150
mMapRenderer = mComposition->mapRenderer();
52-
mId = mCurrentComposerId++;
5351
mPreviewMode = QgsComposerMap::Rectangle;
5452
mCurrentRectangle = rect();
5553

@@ -87,7 +85,7 @@ QgsComposerMap::QgsComposerMap( QgsComposition *composition )
8785

8886
mComposition = composition;
8987
mMapRenderer = mComposition->mapRenderer();
90-
mId = mCurrentComposerId++;
88+
mId = mComposition->composerMapItems().size();
9189
mPreviewMode = QgsComposerMap::Rectangle;
9290
mCurrentRectangle = rect();
9391

@@ -560,6 +558,7 @@ bool QgsComposerMap::writeXML( QDomElement& elem, QDomDocument & doc ) const
560558
}
561559

562560
QDomElement composerMapElem = doc.createElement( "ComposerMap" );
561+
composerMapElem.setAttribute( "id", mId );
563562

564563
//previewMode
565564
if ( mPreviewMode == Cache )
@@ -643,6 +642,11 @@ bool QgsComposerMap::readXML( const QDomElement& itemElem, const QDomDocument& d
643642
return false;
644643
}
645644

645+
QString idRead = itemElem.attribute( "id", "not found" );
646+
if ( idRead != "not found" )
647+
{
648+
mId = idRead.toInt();
649+
}
646650
mPreviewMode = Rectangle;
647651

648652
//previewMode

src/core/composer/qgscomposermap.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,6 @@ class CORE_EXPORT QgsComposerMap : /*public QWidget, private Ui::QgsComposerMapB
309309
/**Stored layer list (used if layer live-link mKeepLayerSet is disabled)*/
310310
QStringList mLayerSet;
311311

312-
/**For the generation of new unique ids*/
313-
static int mCurrentComposerId;
314-
315312
/**Establishes signal/slot connection for update in case of layer change*/
316313
void connectUpdateSlot();
317314

0 commit comments

Comments
 (0)