[QGIS Commit] r13489 - in trunk/qgis: cmake python src/providers/grass

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat May 15 04:21:44 EDT 2010


Author: jef
Date: 2010-05-15 04:21:42 -0400 (Sat, 15 May 2010)
New Revision: 13489

Modified:
   trunk/qgis/cmake/FindPyQt.py
   trunk/qgis/cmake/FindPyQt4.cmake
   trunk/qgis/python/CMakeLists.txt
   trunk/qgis/src/providers/grass/qgis.g.info.c
   trunk/qgis/src/providers/grass/qgsgrass.cpp
Log:
working fix for #2670 and fix for GRASS 6.2 support (as found on debian lenny)

Modified: trunk/qgis/cmake/FindPyQt.py
===================================================================
--- trunk/qgis/cmake/FindPyQt.py	2010-05-15 07:28:28 UTC (rev 13488)
+++ trunk/qgis/cmake/FindPyQt.py	2010-05-15 08:21:42 UTC (rev 13489)
@@ -6,6 +6,7 @@
 
 pyqtcfg = PyQt4.pyqtconfig.Configuration()
 print("pyqt_version:%06.0x" % pyqtcfg.pyqt_version)
+print("pyqt_version_num:%d" % pyqtcfg.pyqt_version)
 print("pyqt_version_str:%s" % pyqtcfg.pyqt_version_str)
 
 pyqt_version_tag = ""

Modified: trunk/qgis/cmake/FindPyQt4.cmake
===================================================================
--- trunk/qgis/cmake/FindPyQt4.cmake	2010-05-15 07:28:28 UTC (rev 13488)
+++ trunk/qgis/cmake/FindPyQt4.cmake	2010-05-15 08:21:42 UTC (rev 13489)
@@ -34,6 +34,7 @@
     STRING(REGEX REPLACE "^pyqt_version:([^\n]+).*$" "\\1" PYQT4_VERSION ${pyqt_config})
     STRING(REGEX REPLACE ".*\npyqt_version_str:([^\n]+).*$" "\\1" PYQT4_VERSION_STR ${pyqt_config})
     STRING(REGEX REPLACE ".*\npyqt_version_tag:([^\n]+).*$" "\\1" PYQT4_VERSION_TAG ${pyqt_config})
+    STRING(REGEX REPLACE ".*\npyqt_version_num:([^\n]+).*$" "\\1" PYQT4_VERSION_NUM ${pyqt_config})
     STRING(REGEX REPLACE ".*\npyqt_sip_dir:([^\n]+).*$" "\\1" PYQT4_SIP_DIR ${pyqt_config})
     STRING(REGEX REPLACE ".*\npyqt_sip_flags:([^\n]+).*$" "\\1" PYQT4_SIP_FLAGS ${pyqt_config})
 
@@ -51,3 +52,5 @@
   ENDIF(PYQT4_FOUND)
 
 ENDIF(EXISTS PYQT4_VERSION)
+
+

Modified: trunk/qgis/python/CMakeLists.txt
===================================================================
--- trunk/qgis/python/CMakeLists.txt	2010-05-15 07:28:28 UTC (rev 13488)
+++ trunk/qgis/python/CMakeLists.txt	2010-05-15 08:21:42 UTC (rev 13489)
@@ -35,9 +35,9 @@
   ADD_DEFINITIONS(-DNOMINMAX)
 ENDIF(MSVC)
 
-IF(PYQT4_VERSION_TAG LESS 263680)	# 0x040600
+IF(PYQT4_VERSION_NUM LESS 263680)	# 0x040600
   SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} PROXY_FACTORY)
-ENDIF(PYQT4_VERSION_TAG LESS 263680)
+ENDIF(PYQT4_VERSION_NUM LESS 263680)
 
 # core module
 FILE(GLOB sip_files_core core/*.sip)

Modified: trunk/qgis/src/providers/grass/qgis.g.info.c
===================================================================
--- trunk/qgis/src/providers/grass/qgis.g.info.c	2010-05-15 07:28:28 UTC (rev 13488)
+++ trunk/qgis/src/providers/grass/qgis.g.info.c	2010-05-15 08:21:42 UTC (rev 13489)
@@ -108,7 +108,12 @@
         void *ptr;
         double val;
 
+#if defined(GRASS_VERSION_MAJOR) && defined(GRASS_VERSION_MINOR) && \
+    ( ( GRASS_VERSION_MAJOR == 6 && GRASS_VERSION_MINOR > 2 ) || GRASS_VERSION_MAJOR > 6 )
         rast_type = G_get_raster_map_type( fd );
+#else
+        rast_type = G_raster_map_type( rast_opt->answer, "" );
+#endif
         cell = G_allocate_c_raster_buf();
         dcell = G_allocate_d_raster_buf();
 
@@ -120,7 +125,7 @@
                           rast_opt->answer, row );
           }
           val = cell[col];
-          ptr = &(cell[col]);
+          ptr = &( cell[col] );
         }
         else
         {
@@ -130,7 +135,7 @@
                           rast_opt->answer, row );
           }
           val = dcell[col];
-          ptr = &(dcell[col]);
+          ptr = &( dcell[col] );
         }
         if ( G_is_null_value( ptr, rast_type ) )
         {

Modified: trunk/qgis/src/providers/grass/qgsgrass.cpp
===================================================================
--- trunk/qgis/src/providers/grass/qgsgrass.cpp	2010-05-15 07:28:28 UTC (rev 13488)
+++ trunk/qgis/src/providers/grass/qgsgrass.cpp	2010-05-15 08:21:42 UTC (rev 13489)
@@ -40,6 +40,13 @@
 #include <grass/version.h>
 }
 
+#if !defined(GRASS_VERSION_MAJOR) || \
+    !defined(GRASS_VERSION_MINOR) || \
+    GRASS_VERSION_MAJOR<6 || \
+    (GRASS_VERSION_MAJOR == 6 && GRASS_VERSION_MINOR <= 2)
+#define G__setenv(name,value) G__setenv( ( char * ) (name), (char *) (value) )
+#endif
+
 #if defined(WIN32)
 #include <windows.h>
 QString GRASS_EXPORT QgsGrass::shortPath( const QString &path )
@@ -333,14 +340,14 @@
 
   // Set principal GRASS variables (in memory)
 #if defined(WIN32)
-  G__setenv(( char * ) "GISDBASE", shortPath( gisdbase ).toLocal8Bit().data() );
+  G__setenv( "GISDBASE", shortPath( gisdbase ).toLocal8Bit().data() );
 #else
-  // This does not work for GISBAS with non ascii chars on Windows XP,
+  // This does not work for GISBASE with non ascii chars on Windows XP,
   // gives error 'LOCATION ... not available':
-  G__setenv(( char * ) "GISDBASE", gisdbase.toUtf8().constData() );
+  G__setenv( "GISDBASE", gisdbase.toUtf8().constData() );
 #endif
-  G__setenv(( char * ) "LOCATION_NAME", location.toUtf8().constData() );
-  G__setenv(( char * ) "MAPSET", ( char * ) "PERMANENT" ); // PERMANENT must always exist
+  G__setenv( "LOCATION_NAME", location.toUtf8().constData() );
+  G__setenv( "MAPSET", "PERMANENT" ); // PERMANENT must always exist
 
   // Add all available mapsets to search path
   char **ms = G_available_mapsets();
@@ -354,12 +361,12 @@
 
   // Set principal GRASS variables (in memory)
 #if defined(WIN32)
-  G__setenv(( char * ) "GISDBASE", shortPath( gisdbase ).toUtf8().data() );
+  G__setenv( "GISDBASE", shortPath( gisdbase ).toUtf8().data() );
 #else
-  G__setenv(( char * ) "GISDBASE", gisdbase.toUtf8().data() );
+  G__setenv( "GISDBASE", gisdbase.toUtf8().data() );
 #endif
-  G__setenv(( char * ) "LOCATION_NAME", location.toUtf8().data() );
-  G__setenv(( char * ) "MAPSET", mapset.toUtf8().data() );
+  G__setenv( "LOCATION_NAME", location.toUtf8().data() );
+  G__setenv( "MAPSET", mapset.toUtf8().data() );
 
   // Add all available mapsets to search path
   char **ms = G_available_mapsets();
@@ -560,14 +567,14 @@
   putEnv( "GISRC", mGisrc );
 
   // Reinitialize GRASS
-  G__setenv(( char * ) "GISRC", mGisrc.toUtf8().data() );
+  G__setenv( "GISRC", mGisrc.toUtf8().data() );
 #if defined(WIN32)
-  G__setenv(( char * ) "GISDBASE", shortPath( gisdbase ).toLocal8Bit().data() );
+  G__setenv( "GISDBASE", shortPath( gisdbase ).toLocal8Bit().data() );
 #else
-  G__setenv(( char * ) "GISDBASE", gisdbase.toUtf8().data() );
+  G__setenv( "GISDBASE", gisdbase.toUtf8().data() );
 #endif
-  G__setenv(( char * ) "LOCATION_NAME", location.toLocal8Bit().data() );
-  G__setenv(( char * ) "MAPSET", mapset.toLocal8Bit().data() );
+  G__setenv( "LOCATION_NAME", location.toLocal8Bit().data() );
+  G__setenv( "MAPSET", mapset.toLocal8Bit().data() );
   defaultGisdbase = gisdbase;
   defaultLocation = location;
   defaultMapset = mapset;
@@ -602,15 +609,15 @@
     putenv(( char * ) "GISRC" );
 
     // Reinitialize GRASS
-    G__setenv(( char * ) "GISRC", ( char * ) "" );
+    G__setenv( "GISRC", ( char * ) "" );
 
     // Temporarily commented because of
     //   http://trac.osgeo.org/qgis/ticket/1900
     //   http://trac.osgeo.org/gdal/ticket/3313
     // it can be uncommented once GDAL with patch gets deployed (probably GDAL 1.8)
-    //G__setenv(( char * ) "GISDBASE", ( char * ) "" );
-    //G__setenv(( char * ) "LOCATION_NAME", ( char * ) "" );
-    //G__setenv(( char * ) "MAPSET", ( char * ) "" );
+    //G__setenv( "GISDBASE", ( char * ) "" );
+    //G__setenv( "LOCATION_NAME", ( char * ) "" );
+    //G__setenv( "MAPSET", ( char * ) "" );
 
     defaultGisdbase = "";
     defaultLocation = "";



More information about the QGIS-commit mailing list