Skip to content

Commit 61a96e8

Browse files
author
rblazek
committed
GRASS region reprojection fix
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@15757 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent aa615f0 commit 61a96e8

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/plugins/grass/qgsgrassplugin.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,6 @@ QgsGrassPlugin::QgsGrassPlugin( QgisInterface * theQgisInterFace ):
6565
pluginNameQString = tr( "GrassVector" );
6666
pluginVersionQString = tr( "0.1" );
6767
pluginDescriptionQString = tr( "GRASS layer" );
68-
QString gisdbase = QgsGrass::getDefaultGisdbase();
69-
QString location = QgsGrass::getDefaultLocation();
70-
mCanvas = qGisInterface->mapCanvas();
71-
mCrs = QgsGrass::crs( gisdbase, location );
72-
QgsDebugMsg( "mCrs: " + mCrs.toWkt() );
73-
setTransform();
74-
connect( qGisInterface->mapCanvas()->mapRenderer(), SIGNAL( destinationSrsChanged() ), this, SLOT( setTransform() ) );
7568
}
7669

7770
QgsGrassPlugin::~QgsGrassPlugin()
@@ -118,9 +111,8 @@ void QgsGrassPlugin::initGui()
118111
mRegion = 0;
119112

120113
QSettings settings;
121-
122114
QgsGrass::init();
123-
115+
mCanvas = qGisInterface->mapCanvas();
124116
QWidget* qgis = qGisInterface->mainWindow();
125117

126118
// Connect project
@@ -598,6 +590,15 @@ void QgsGrassPlugin::displayRegion()
598590

599591
QgsGrass::setLocation( gisdbase, location );
600592

593+
// TODO: check better if we have to init + maybe the location can change -> mCrs must be reloaded
594+
if ( !mCrs.isValid() )
595+
{
596+
mCrs = QgsGrass::crs( gisdbase, location );
597+
QgsDebugMsg( "mCrs: " + mCrs.toWkt() );
598+
setTransform();
599+
connect( mCanvas->mapRenderer(), SIGNAL( destinationSrsChanged() ), this, SLOT( setTransform() ) );
600+
}
601+
601602
struct Cell_head window;
602603
char *err = G__get_window( &window, ( char * ) "", ( char * ) "WIND", mapset.toLatin1().data() );
603604

0 commit comments

Comments
 (0)