Skip to content

Commit

Permalink
Fixed map overview handling
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@6971 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed May 31, 2007
1 parent d76cab5 commit bcaf553
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
2 changes: 1 addition & 1 deletion python/gui/qgsmapoverviewcanvas.sip
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class QgsMapOverviewCanvas : QWidget

void enableAntiAliasing(bool flag);

void updateFullExtent();
void updateFullExtent(const QgsRect& rect);

public slots:

Expand Down
15 changes: 12 additions & 3 deletions src/gui/qgsmapcanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,17 @@ void QgsMapCanvas::setLayerSet(QList<QgsMapCanvasLayer>& layers)

if (mMapOverview)
{
mMapOverview->updateFullExtent(fullExtent());

QStringList& layerSetOvOld = mMapOverview->layerSet();
if (layerSetOvOld != layerSetOverview)
{
mMapOverview->setLayerSet(layerSetOverview);
updateOverview();
}

// refresh overview maplayers even if layer set is the same
// because full extent might have changed
updateOverview();
}

if (layerSetChanged)
Expand Down Expand Up @@ -404,8 +409,7 @@ void QgsMapCanvas::updateFullExtent()
mMapRender->updateFullExtent();
if (mMapOverview)
{
mMapOverview->updateFullExtent();
mMapOverview->reflectChangedExtent();
mMapOverview->updateFullExtent(fullExtent());
updateOverview();
}
refresh();
Expand All @@ -414,6 +418,11 @@ void QgsMapCanvas::updateFullExtent()

void QgsMapCanvas::setExtent(QgsRect const & r)
{
if (r.isEmpty())
{
QgsDebugMsg("Setting empty extent!");
}

QgsRect current = extent();
mMapRender->setExtent(r);
emit extentsChanged();
Expand Down
9 changes: 3 additions & 6 deletions src/gui/qgsmapoverviewcanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ void QgsMapOverviewCanvas::reflectChangedExtent()
// show only when valid extent is set
if (extent.isEmpty())
{
#ifdef QGISDEBUG
std::cout << "panning: empty extent" << std::endl;
#endif
mPanningWidget->hide();
return;
}
Expand Down Expand Up @@ -246,7 +243,6 @@ void QgsMapOverviewCanvas::refresh()
painter.setRenderHint(QPainter::Antialiasing);

// render image
mMapRender->setExtent(mMapCanvas->fullExtent());
mMapRender->render(&painter);

painter.end();
Expand Down Expand Up @@ -274,9 +270,10 @@ void QgsMapOverviewCanvas::setLayerSet(const QStringList& layerSet)
mMapRender->setLayerSet(layerSet);
}

void QgsMapOverviewCanvas::updateFullExtent()
void QgsMapOverviewCanvas::updateFullExtent(const QgsRect& rect)
{
mMapRender->updateFullExtent();
mMapRender->setExtent(rect);
reflectChangedExtent();
}

void QgsMapOverviewCanvas::projectionsEnabled(bool flag)
Expand Down
3 changes: 2 additions & 1 deletion src/gui/qgsmapoverviewcanvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
class QgsMapCanvas;
class QgsMapRender;
class QgsPanningWidget; // defined in .cpp
class QgsRect;

class GUI_EXPORT QgsMapOverviewCanvas : public QWidget
{
Expand All @@ -56,7 +57,7 @@ class GUI_EXPORT QgsMapOverviewCanvas : public QWidget

void enableAntiAliasing(bool flag) { mAntiAliasing = flag; }

void updateFullExtent();
void updateFullExtent(const QgsRect& rect);

public slots:

Expand Down

0 comments on commit bcaf553

Please sign in to comment.