working fix for #2670 and fix for GRASS 6.2 support (as found on debian lenny)

git-svn-id: http://svn.osgeo.org/qgis/trunk@13489 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
jef 2010-05-15 08:21:42 +00:00
parent 2b753a2ec6
commit 2db0c1906f
5 changed files with 38 additions and 22 deletions

View File

@ -6,6 +6,7 @@ import PyQt4.pyqtconfig
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 = ""

View File

@ -34,6 +34,7 @@ ELSE(EXISTS PYQT4_VERSION)
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 @@ ELSE(EXISTS PYQT4_VERSION)
ENDIF(PYQT4_FOUND)
ENDIF(EXISTS PYQT4_VERSION)

View File

@ -35,9 +35,9 @@ IF(MSVC)
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)

View File

@ -108,7 +108,12 @@ int main( int argc, char **argv )
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 @@ int main( int argc, char **argv )
rast_opt->answer, row );
}
val = cell[col];
ptr = &(cell[col]);
ptr = &( cell[col] );
}
else
{
@ -130,7 +135,7 @@ int main( int argc, char **argv )
rast_opt->answer, row );
}
val = dcell[col];
ptr = &(dcell[col]);
ptr = &( dcell[col] );
}
if ( G_is_null_value( ptr, rast_type ) )
{

View File

@ -40,6 +40,13 @@ extern "C"
#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 @@ void QgsGrass::setLocation( QString gisdbase, QString location )
// 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 @@ void QgsGrass::setMapset( QString gisdbase, QString location, QString mapset )
// 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 @@ QString GRASS_EXPORT QgsGrass::openMapset( QString gisdbase, QString location, Q
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 @@ QString QgsGrass::closeMapset( )
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 = "";