Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[BUGFIX] Update DatumTransformInfo on layerCrsChanged
The QgsMapCanvas datumTransformInfo is not updated after a layerCrsChanged.
 This causes a bug in QGIS-Server which does not use the right srcAuthId.

To update QgsMapCanvas datumTransformInfo, the user had to change the map
 canvas CRS or to disable/enable transform.

This patch add a SLOT to the QgsMapLayer layerCrs Changed SIGNAL to update
 QgsMapCanvas datumTransformInfo.
  • Loading branch information
rldhont committed Apr 2, 2015
1 parent ba73048 commit c3321e5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/gui/qgsmapcanvas.cpp
Expand Up @@ -417,6 +417,7 @@ void QgsMapCanvas::setLayerSet( QList<QgsMapCanvasLayer> &layers )
if ( !currentLayer )
continue;
disconnect( currentLayer, SIGNAL( repaintRequested() ), this, SLOT( refresh() ) );
disconnect( currentLayer, SIGNAL( layerCrsChanged() ), this, SLOT( layerCrsChange() ) );
QgsVectorLayer *isVectLyr = qobject_cast<QgsVectorLayer *>( currentLayer );
if ( isVectLyr )
{
Expand All @@ -432,6 +433,7 @@ void QgsMapCanvas::setLayerSet( QList<QgsMapCanvasLayer> &layers )
// Ticket #811 - racicot
QgsMapLayer *currentLayer = layer( i );
connect( currentLayer, SIGNAL( repaintRequested() ), this, SLOT( refresh() ) );
connect( currentLayer, SIGNAL( layerCrsChanged() ), this, SLOT( layerCrsChange() ) );
QgsVectorLayer *isVectLyr = qobject_cast<QgsVectorLayer *>( currentLayer );
if ( isVectLyr )
{
Expand Down Expand Up @@ -1578,6 +1580,15 @@ void QgsMapCanvas::layerStateChange()

} // layerStateChange

void QgsMapCanvas::layerCrsChange()
{
// called when a layer's CRS has been changed
QObject *theSender = sender();
QgsMapLayer *layer = qobject_cast<QgsMapLayer *>( theSender );
QString destAuthId = mSettings.destinationCrs().authid();
getDatumTransformInfo( layer, layer->crs().authid(), destAuthId );

} // layerCrsChange


void QgsMapCanvas::freeze( bool frz )
Expand Down
3 changes: 3 additions & 0 deletions src/gui/qgsmapcanvas.h
Expand Up @@ -409,6 +409,9 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView

//! This slot is connected to the visibility change of one or more layers
void layerStateChange();

//! This slot is connected to the layer's CRS change
void layerCrsChange();

//! Whether to suppress rendering or not
void setRenderFlag( bool theFlag );
Expand Down

0 comments on commit c3321e5

Please sign in to comment.