Skip to content
Permalink
Browse files
Safer generation of ids for composer map
git-svn-id: http://svn.osgeo.org/qgis/trunk@15040 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jan 14, 2011
1 parent e0bf276 commit 2651a2d02ab842fe290929d3db57cea93a5d7c65
Showing with 14 additions and 1 deletion.
  1. +14 −1 src/core/composer/qgscomposermap.cpp
@@ -47,7 +47,20 @@ QgsComposerMap::QgsComposerMap( QgsComposition *composition, int x, int y, int w
mCrossLength( 3 ), mMapCanvas( 0 ), mDrawCanvasItems( true )
{
mComposition = composition;
mId = mComposition->composerMapItems().size();

//mId = mComposition->composerMapItems().size();
int maxId = -1;
QList<const QgsComposerMap*> mapList = mComposition->composerMapItems();
QList<const QgsComposerMap*>::const_iterator mapIt = mapList.constBegin();
for ( ; mapIt != mapList.constEnd(); ++mapIt )
{
if (( *mapIt )->id() > maxId )
{
maxId = ( *mapIt )->id();
}
}
mId = maxId + 1;

mMapRenderer = mComposition->mapRenderer();
mPreviewMode = QgsComposerMap::Rectangle;
mCurrentRectangle = rect();

0 comments on commit 2651a2d

Please sign in to comment.