@@ -100,6 +100,13 @@ void QgsComposerMap::draw( QPainter *painter, const QgsRect& extent, const QSize
100
100
return ;
101
101
}
102
102
103
+ if ( mDrawing )
104
+ {
105
+ return ;
106
+ }
107
+
108
+ mDrawing = true ;
109
+
103
110
QgsMapRenderer theMapRenderer;
104
111
theMapRenderer.setExtent ( extent );
105
112
theMapRenderer.setOutputSize ( size, dpi );
@@ -119,6 +126,8 @@ void QgsComposerMap::draw( QPainter *painter, const QgsRect& extent, const QSize
119
126
theMapRenderer.setScale ( scale () );
120
127
theMapRenderer.render ( painter );
121
128
theMapRenderer.setScale ( bk_scale );
129
+
130
+ mDrawing = false ;
122
131
}
123
132
124
133
void QgsComposerMap::cache ( void )
@@ -158,18 +167,11 @@ void QgsComposerMap::cache( void )
158
167
159
168
void QgsComposerMap::paint ( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget )
160
169
{
161
- if ( mDrawing )
162
- {
163
- return ;
164
- }
165
-
166
170
if ( !mComposition || !painter )
167
171
{
168
172
return ;
169
173
}
170
174
171
- mDrawing = true ;
172
-
173
175
QRectF thisPaintRect = QRectF ( 0 , 0 , QGraphicsRectItem::rect ().width (), QGraphicsRectItem::rect ().height () );
174
176
painter->save ();
175
177
painter->setClipRect ( thisPaintRect );
@@ -218,7 +220,6 @@ void QgsComposerMap::paint( QPainter* painter, const QStyleOptionGraphicsItem* i
218
220
painter->restore ();
219
221
220
222
mLastScaleFactorX = currentScaleFactorX;
221
- mDrawing = false ;
222
223
}
223
224
224
225
void QgsComposerMap::mapCanvasChanged ( void )
@@ -251,20 +252,23 @@ void QgsComposerMap::resize( double dx, double dy )
251
252
252
253
void QgsComposerMap::moveContent ( double dx, double dy )
253
254
{
254
- QRectF itemRect = rect ();
255
- double xRatio = dx / itemRect.width ();
256
- double yRatio = dy / itemRect.height ();
257
-
258
- double xMoveMapCoord = mExtent .width () * xRatio;
259
- double yMoveMapCoord = -( mExtent .height () * yRatio );
260
-
261
- mExtent .setXMinimum ( mExtent .xMin () + xMoveMapCoord );
262
- mExtent .setXMaximum ( mExtent .xMax () + xMoveMapCoord );
263
- mExtent .setYmin ( mExtent .yMin () + yMoveMapCoord );
264
- mExtent .setYmax ( mExtent .yMax () + yMoveMapCoord );
265
- emit extentChanged ();
266
- cache ();
267
- update ();
255
+ if (!mDrawing )
256
+ {
257
+ QRectF itemRect = rect ();
258
+ double xRatio = dx / itemRect.width ();
259
+ double yRatio = dy / itemRect.height ();
260
+
261
+ double xMoveMapCoord = mExtent .width () * xRatio;
262
+ double yMoveMapCoord = -( mExtent .height () * yRatio );
263
+
264
+ mExtent .setXMinimum ( mExtent .xMin () + xMoveMapCoord );
265
+ mExtent .setXMaximum ( mExtent .xMax () + xMoveMapCoord );
266
+ mExtent .setYmin ( mExtent .yMin () + yMoveMapCoord );
267
+ mExtent .setYmax ( mExtent .yMax () + yMoveMapCoord );
268
+ emit extentChanged ();
269
+ cache ();
270
+ update ();
271
+ }
268
272
}
269
273
270
274
void QgsComposerMap::setSceneRect ( const QRectF& rectangle )
0 commit comments