@@ -265,45 +265,48 @@ void QgsMapCanvas::setLayerSet( QList<QgsMapCanvasLayer> &layers )
265
265
bool layerSetChanged = layerSetOld != layerSet;
266
266
267
267
// update only if needed
268
- if ( !layerSetChanged )
269
- return ;
270
-
271
- QgsDebugMsg ( " Layer changed to: " + layerSet.join ( " , " ) );
272
-
273
- for ( i = 0 ; i < layerCount (); i++ )
268
+ if ( layerSetChanged )
274
269
{
275
- // Add check if vector layer when disconnecting from selectionChanged slot
276
- // Ticket #811 - racicot
277
- QgsMapLayer *currentLayer = layer ( i );
278
- disconnect ( currentLayer, SIGNAL ( repaintRequested () ), this , SLOT ( refresh () ) );
279
- disconnect ( currentLayer, SIGNAL ( screenUpdateRequested () ), this , SLOT ( updateMap () ) );
280
- QgsVectorLayer *isVectLyr = qobject_cast<QgsVectorLayer *>( currentLayer );
281
- if ( isVectLyr )
270
+ QgsDebugMsg ( " Layers changed to: " + layerSet.join ( " , " ) );
271
+
272
+ for ( i = 0 ; i < layerCount (); i++ )
282
273
{
283
- disconnect ( currentLayer, SIGNAL ( selectionChanged () ), this , SLOT ( selectionChangedSlot () ) );
274
+ // Add check if vector layer when disconnecting from selectionChanged slot
275
+ // Ticket #811 - racicot
276
+ QgsMapLayer *currentLayer = layer ( i );
277
+ disconnect ( currentLayer, SIGNAL ( repaintRequested () ), this , SLOT ( refresh () ) );
278
+ disconnect ( currentLayer, SIGNAL ( screenUpdateRequested () ), this , SLOT ( updateMap () ) );
279
+ QgsVectorLayer *isVectLyr = qobject_cast<QgsVectorLayer *>( currentLayer );
280
+ if ( isVectLyr )
281
+ {
282
+ disconnect ( currentLayer, SIGNAL ( selectionChanged () ), this , SLOT ( selectionChangedSlot () ) );
283
+ }
284
284
}
285
- }
286
285
287
- mMapRenderer ->setLayerSet ( layerSet );
286
+ mMapRenderer ->setLayerSet ( layerSet );
288
287
289
- for ( i = 0 ; i < layerCount (); i++ )
290
- {
291
- // Add check if vector layer when connecting to selectionChanged slot
292
- // Ticket #811 - racicot
293
- QgsMapLayer *currentLayer = layer ( i );
294
- connect ( currentLayer, SIGNAL ( repaintRequested () ), this , SLOT ( refresh () ) );
295
- connect ( currentLayer, SIGNAL ( screenUpdateRequested () ), this , SLOT ( updateMap () ) );
296
- QgsVectorLayer *isVectLyr = qobject_cast<QgsVectorLayer *>( currentLayer );
297
- if ( isVectLyr )
288
+ for ( i = 0 ; i < layerCount (); i++ )
298
289
{
299
- connect ( currentLayer, SIGNAL ( selectionChanged () ), this , SLOT ( selectionChangedSlot () ) );
290
+ // Add check if vector layer when connecting to selectionChanged slot
291
+ // Ticket #811 - racicot
292
+ QgsMapLayer *currentLayer = layer ( i );
293
+ connect ( currentLayer, SIGNAL ( repaintRequested () ), this , SLOT ( refresh () ) );
294
+ connect ( currentLayer, SIGNAL ( screenUpdateRequested () ), this , SLOT ( updateMap () ) );
295
+ QgsVectorLayer *isVectLyr = qobject_cast<QgsVectorLayer *>( currentLayer );
296
+ if ( isVectLyr )
297
+ {
298
+ connect ( currentLayer, SIGNAL ( selectionChanged () ), this , SLOT ( selectionChangedSlot () ) );
299
+ }
300
300
}
301
+
302
+ QgsDebugMsg ( " Layers have changed, refreshing" );
303
+ emit layersChanged ();
304
+
305
+ refresh ();
301
306
}
302
307
303
308
if ( mMapOverview )
304
309
{
305
- mMapOverview ->updateFullExtent ( fullExtent () );
306
-
307
310
QStringList& layerSetOvOld = mMapOverview ->layerSet ();
308
311
if ( layerSetOvOld != layerSetOverview )
309
312
{
@@ -314,12 +317,6 @@ void QgsMapCanvas::setLayerSet( QList<QgsMapCanvasLayer> &layers )
314
317
// because full extent might have changed
315
318
updateOverview ();
316
319
}
317
-
318
- QgsDebugMsg ( " Layers have changed, refreshing" );
319
- emit layersChanged ();
320
-
321
- refresh ();
322
-
323
320
} // setLayerSet
324
321
325
322
void QgsMapCanvas::enableOverviewMode ( QgsMapOverviewCanvas* overview )
@@ -514,11 +511,6 @@ void QgsMapCanvas::updateFullExtent()
514
511
QgsDebugMsg ( " updating full extent" );
515
512
516
513
mMapRenderer ->updateFullExtent ();
517
- if ( mMapOverview )
518
- {
519
- mMapOverview ->updateFullExtent ( fullExtent () );
520
- updateOverview ();
521
- }
522
514
refresh ();
523
515
}
524
516
0 commit comments