Skip to content

Commit

Permalink
disable global composer map counter. Fixes ticket 2042
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11867 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Oct 30, 2009
1 parent b40d103 commit bf347d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 8 additions & 4 deletions src/core/composer/qgscomposermap.cpp
Expand Up @@ -39,17 +39,15 @@
#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 ), \
mGridAnnotationPosition( OutsideMapFrame ), mAnnotationFrameDistance( 1.0 ), mGridAnnotationDirection( Horizontal ), \
mRotation( 0 ), mCrossLength( 3 )
{
mComposition = composition;
mId = mComposition->composerMapItems().size();
mMapRenderer = mComposition->mapRenderer();
mId = mCurrentComposerId++;
mPreviewMode = QgsComposerMap::Rectangle;
mCurrentRectangle = rect();

Expand Down Expand Up @@ -87,7 +85,7 @@ QgsComposerMap::QgsComposerMap( QgsComposition *composition )

mComposition = composition;
mMapRenderer = mComposition->mapRenderer();
mId = mCurrentComposerId++;
mId = mComposition->composerMapItems().size();
mPreviewMode = QgsComposerMap::Rectangle;
mCurrentRectangle = rect();

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

QDomElement composerMapElem = doc.createElement( "ComposerMap" );
composerMapElem.setAttribute( "id", mId );

//previewMode
if ( mPreviewMode == Cache )
Expand Down Expand Up @@ -643,6 +642,11 @@ bool QgsComposerMap::readXML( const QDomElement& itemElem, const QDomDocument& d
return false;
}

QString idRead = itemElem.attribute( "id", "not found" );
if ( idRead != "not found" )
{
mId = idRead.toInt();
}
mPreviewMode = Rectangle;

//previewMode
Expand Down
3 changes: 0 additions & 3 deletions src/core/composer/qgscomposermap.h
Expand Up @@ -309,9 +309,6 @@ class CORE_EXPORT QgsComposerMap : /*public QWidget, private Ui::QgsComposerMapB
/**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();

Expand Down

0 comments on commit bf347d0

Please sign in to comment.