Skip to content
Permalink
Browse files

add transform context to the map overview

  • Loading branch information
nirvn committed Feb 1, 2018
1 parent 247ea02 commit 1ac6792678e463334802dafd584af3d9241ac817
Showing with 27 additions and 18 deletions.
  1. +11 −8 python/gui/qgsmapoverviewcanvas.sip.in
  2. +7 −0 src/gui/qgsmapoverviewcanvas.cpp
  3. +9 −10 src/gui/qgsmapoverviewcanvas.h
@@ -48,7 +48,15 @@ Returns list of layers visible in the overview

void updateFullExtent();

public slots:
protected slots:
void mapRenderingFinished();

void layerRepaintRequested( bool deferred = false );
%Docstring
Triggered when a layer in the overview requests a repaint.
%End

protected:

void drawExtentRect();
%Docstring
@@ -60,16 +68,11 @@ used for overview canvas to reflect changed extent in main map canvas
Should be called when the canvas destination CRS is changed
%End

protected slots:
void mapRenderingFinished();

void layerRepaintRequested( bool deferred = false );
void transformContextChanged();
%Docstring
Triggered when a layer in the overview requests a repaint.
Called when the canvas transform context is changed
%End

protected:

virtual void paintEvent( QPaintEvent *pe );

%Docstring
@@ -40,10 +40,12 @@ QgsMapOverviewCanvas::QgsMapOverviewCanvas( QWidget *parent, QgsMapCanvas *mapCa
setObjectName( QStringLiteral( "theOverviewCanvas" ) );
mPanningWidget = new QgsPanningWidget( this );

mSettings.setTransformContext( mMapCanvas->mapSettings().transformContext() );
mSettings.setFlag( QgsMapSettings::DrawLabeling, false );

connect( mMapCanvas, &QgsMapCanvas::extentsChanged, this, &QgsMapOverviewCanvas::drawExtentRect );
connect( mMapCanvas, &QgsMapCanvas::destinationCrsChanged, this, &QgsMapOverviewCanvas::destinationCrsChanged );
connect( mMapCanvas, &QgsMapCanvas::transformContextChanged, this, &QgsMapOverviewCanvas::transformContextChanged );
}

void QgsMapOverviewCanvas::resizeEvent( QResizeEvent *e )
@@ -262,6 +264,11 @@ void QgsMapOverviewCanvas::destinationCrsChanged()
mSettings.setDestinationCrs( mMapCanvas->mapSettings().destinationCrs() );
}

void QgsMapOverviewCanvas::transformContextChanged()
{
mSettings.setTransformContext( mMapCanvas->mapSettings().transformContext() );
}

QList<QgsMapLayer *> QgsMapOverviewCanvas::layers() const
{
return mSettings.layers();
@@ -61,16 +61,6 @@ class GUI_EXPORT QgsMapOverviewCanvas : public QWidget

void updateFullExtent();

public slots:

// ### QGIS 3: make protected
//! used for overview canvas to reflect changed extent in main map canvas
void drawExtentRect();

// ### QGIS 3: make protected
//! Should be called when the canvas destination CRS is changed
void destinationCrsChanged();

protected slots:
void mapRenderingFinished();

@@ -81,6 +71,15 @@ class GUI_EXPORT QgsMapOverviewCanvas : public QWidget

protected:

//! used for overview canvas to reflect changed extent in main map canvas
void drawExtentRect();

//! Should be called when the canvas destination CRS is changed
void destinationCrsChanged();

//! Called when the canvas transform context is changed
void transformContextChanged();

//! Overridden paint event
void paintEvent( QPaintEvent *pe ) override;

0 comments on commit 1ac6792

Please sign in to comment.
You can’t perform that action at this time.