[QGIS Commit] r15757 - trunk/qgis/src/plugins/grass

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon Apr 18 09:04:08 EDT 2011


Author: rblazek
Date: 2011-04-18 06:04:08 -0700 (Mon, 18 Apr 2011)
New Revision: 15757

Modified:
   trunk/qgis/src/plugins/grass/qgsgrassplugin.cpp
Log:
GRASS region reprojection fix

Modified: trunk/qgis/src/plugins/grass/qgsgrassplugin.cpp
===================================================================
--- trunk/qgis/src/plugins/grass/qgsgrassplugin.cpp	2011-04-18 12:24:28 UTC (rev 15756)
+++ trunk/qgis/src/plugins/grass/qgsgrassplugin.cpp	2011-04-18 13:04:08 UTC (rev 15757)
@@ -65,13 +65,6 @@
   pluginNameQString = tr( "GrassVector" );
   pluginVersionQString = tr( "0.1" );
   pluginDescriptionQString = tr( "GRASS layer" );
-  QString gisdbase = QgsGrass::getDefaultGisdbase();
-  QString location = QgsGrass::getDefaultLocation();
-  mCanvas = qGisInterface->mapCanvas();
-  mCrs = QgsGrass::crs( gisdbase, location );
-  QgsDebugMsg( "mCrs: " + mCrs.toWkt() );
-  setTransform();
-  connect( qGisInterface->mapCanvas()->mapRenderer(), SIGNAL( destinationSrsChanged() ), this, SLOT( setTransform() ) );
 }
 
 QgsGrassPlugin::~QgsGrassPlugin()
@@ -118,9 +111,8 @@
   mRegion = 0;
 
   QSettings settings;
-
   QgsGrass::init();
-
+  mCanvas = qGisInterface->mapCanvas();
   QWidget* qgis = qGisInterface->mainWindow();
 
   // Connect project
@@ -598,6 +590,15 @@
 
   QgsGrass::setLocation( gisdbase, location );
 
+  // TODO: check better if we have to init + maybe the location can change -> mCrs must be reloaded
+  if ( !mCrs.isValid() )
+  {
+    mCrs = QgsGrass::crs( gisdbase, location );
+    QgsDebugMsg( "mCrs: " + mCrs.toWkt() );
+    setTransform();
+    connect( mCanvas->mapRenderer(), SIGNAL( destinationSrsChanged() ), this, SLOT( setTransform() ) );
+  }
+
   struct Cell_head window;
   char *err = G__get_window( &window, ( char * ) "", ( char * ) "WIND", mapset.toLatin1().data() );
 



More information about the QGIS-commit mailing list