Skip to content

Commit

Permalink
Make sure to refresh canvas when layer's CRS is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Sep 11, 2014
1 parent 302c604 commit ed11c57
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6975,30 +6975,30 @@ void QgisApp::setLayerCRS()

QgsCoordinateReferenceSystem crs( mySelector.selectedCrsId(), QgsCoordinateReferenceSystem::InternalCrsId );

// Turn off rendering to improve speed.
mMapCanvas->freeze();

foreach ( QgsLayerTreeNode* node, mLayerTreeView->selectedNodes() )
{
if ( QgsLayerTree::isGroup( node ) )
{
foreach ( QgsLayerTreeLayer* child, QgsLayerTree::toGroup( node )->findLayers() )
{
if ( child->layer() )
{
child->layer()->setCrs( crs );
child->layer()->clearCacheImage();
}
}
}
else if ( QgsLayerTree::isLayer( node ) )
{
QgsLayerTreeLayer* nodeLayer = QgsLayerTree::toLayer( node );
if ( nodeLayer->layer() )
{
nodeLayer->layer()->setCrs( crs );
nodeLayer->layer()->clearCacheImage();
}
}
}

// Turn on rendering (if it was on previously)
mMapCanvas->freeze( false );

mMapCanvas->refresh();
}

Expand Down Expand Up @@ -7109,7 +7109,10 @@ void QgisApp::legendGroupSetCRS()
foreach ( QgsLayerTreeLayer* nodeLayer, currentGroup->findLayers() )
{
if ( nodeLayer->layer() )
{
nodeLayer->layer()->setCrs( crs );
nodeLayer->layer()->clearCacheImage();
}
}
}

Expand Down

0 comments on commit ed11c57

Please sign in to comment.