Commit bcaf553 wonder
committed
1 parent d76cab5 commit bcaf553 Copy full SHA for bcaf553
File tree 4 files changed +18
-11
lines changed
4 files changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ class QgsMapOverviewCanvas : QWidget
26
26
27
27
void enableAntiAliasing(bool flag);
28
28
29
- void updateFullExtent();
29
+ void updateFullExtent(const QgsRect& rect );
30
30
31
31
public slots:
32
32
Original file line number Diff line number Diff line change @@ -263,12 +263,17 @@ void QgsMapCanvas::setLayerSet(QList<QgsMapCanvasLayer>& layers)
263
263
264
264
if (mMapOverview )
265
265
{
266
+ mMapOverview ->updateFullExtent (fullExtent ());
267
+
266
268
QStringList& layerSetOvOld = mMapOverview ->layerSet ();
267
269
if (layerSetOvOld != layerSetOverview)
268
270
{
269
271
mMapOverview ->setLayerSet (layerSetOverview);
270
- updateOverview ();
271
272
}
273
+
274
+ // refresh overview maplayers even if layer set is the same
275
+ // because full extent might have changed
276
+ updateOverview ();
272
277
}
273
278
274
279
if (layerSetChanged)
@@ -404,8 +409,7 @@ void QgsMapCanvas::updateFullExtent()
404
409
mMapRender ->updateFullExtent ();
405
410
if (mMapOverview )
406
411
{
407
- mMapOverview ->updateFullExtent ();
408
- mMapOverview ->reflectChangedExtent ();
412
+ mMapOverview ->updateFullExtent (fullExtent ());
409
413
updateOverview ();
410
414
}
411
415
refresh ();
@@ -414,6 +418,11 @@ void QgsMapCanvas::updateFullExtent()
414
418
415
419
void QgsMapCanvas::setExtent (QgsRect const & r)
416
420
{
421
+ if (r.isEmpty ())
422
+ {
423
+ QgsDebugMsg (" Setting empty extent!" );
424
+ }
425
+
417
426
QgsRect current = extent ();
418
427
mMapRender ->setExtent (r);
419
428
emit extentsChanged ();
Original file line number Diff line number Diff line change @@ -95,9 +95,6 @@ void QgsMapOverviewCanvas::reflectChangedExtent()
95
95
// show only when valid extent is set
96
96
if (extent.isEmpty ())
97
97
{
98
- #ifdef QGISDEBUG
99
- std::cout << " panning: empty extent" << std::endl;
100
- #endif
101
98
mPanningWidget ->hide ();
102
99
return ;
103
100
}
@@ -246,7 +243,6 @@ void QgsMapOverviewCanvas::refresh()
246
243
painter.setRenderHint (QPainter::Antialiasing);
247
244
248
245
// render image
249
- mMapRender ->setExtent (mMapCanvas ->fullExtent ());
250
246
mMapRender ->render (&painter);
251
247
252
248
painter.end ();
@@ -274,9 +270,10 @@ void QgsMapOverviewCanvas::setLayerSet(const QStringList& layerSet)
274
270
mMapRender ->setLayerSet (layerSet);
275
271
}
276
272
277
- void QgsMapOverviewCanvas::updateFullExtent ()
273
+ void QgsMapOverviewCanvas::updateFullExtent (const QgsRect& rect )
278
274
{
279
- mMapRender ->updateFullExtent ();
275
+ mMapRender ->setExtent (rect);
276
+ reflectChangedExtent ();
280
277
}
281
278
282
279
void QgsMapOverviewCanvas::projectionsEnabled (bool flag)
Original file line number Diff line number Diff line change 30
30
class QgsMapCanvas ;
31
31
class QgsMapRender ;
32
32
class QgsPanningWidget ; // defined in .cpp
33
+ class QgsRect ;
33
34
34
35
class GUI_EXPORT QgsMapOverviewCanvas : public QWidget
35
36
{
@@ -56,7 +57,7 @@ class GUI_EXPORT QgsMapOverviewCanvas : public QWidget
56
57
57
58
void enableAntiAliasing (bool flag) { mAntiAliasing = flag; }
58
59
59
- void updateFullExtent ();
60
+ void updateFullExtent (const QgsRect& rect );
60
61
61
62
public slots:
62
63
You can’t perform that action at this time.
0 commit comments