Skip to content
Permalink
Browse files
Fixed map overview handling
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6971 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed May 31, 2007
1 parent 22f5769 commit 6d09a3c6dfb7369a227fa83bff44cd72e8312b62
Showing with 18 additions and 11 deletions.
  1. +1 −1 python/gui/qgsmapoverviewcanvas.sip
  2. +12 −3 src/gui/qgsmapcanvas.cpp
  3. +3 −6 src/gui/qgsmapoverviewcanvas.cpp
  4. +2 −1 src/gui/qgsmapoverviewcanvas.h
@@ -26,7 +26,7 @@ class QgsMapOverviewCanvas : QWidget

void enableAntiAliasing(bool flag);

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

public slots:

@@ -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)
@@ -404,8 +409,7 @@ void QgsMapCanvas::updateFullExtent()
mMapRender->updateFullExtent();
if (mMapOverview)
{
mMapOverview->updateFullExtent();
mMapOverview->reflectChangedExtent();
mMapOverview->updateFullExtent(fullExtent());
updateOverview();
}
refresh();
@@ -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();
@@ -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;
}
@@ -246,7 +243,6 @@ void QgsMapOverviewCanvas::refresh()
painter.setRenderHint(QPainter::Antialiasing);

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

painter.end();
@@ -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)
@@ -30,6 +30,7 @@
class QgsMapCanvas;
class QgsMapRender;
class QgsPanningWidget; // defined in .cpp
class QgsRect;

class GUI_EXPORT QgsMapOverviewCanvas : public QWidget
{
@@ -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:

0 comments on commit 6d09a3c

Please sign in to comment.