mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-16 00:03:12 -04:00
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:
parent
2b753a2ec6
commit
2db0c1906f
@ -6,6 +6,7 @@ import PyQt4.pyqtconfig
|
|||||||
|
|
||||||
pyqtcfg = PyQt4.pyqtconfig.Configuration()
|
pyqtcfg = PyQt4.pyqtconfig.Configuration()
|
||||||
print("pyqt_version:%06.0x" % pyqtcfg.pyqt_version)
|
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)
|
print("pyqt_version_str:%s" % pyqtcfg.pyqt_version_str)
|
||||||
|
|
||||||
pyqt_version_tag = ""
|
pyqt_version_tag = ""
|
||||||
|
@ -34,6 +34,7 @@ ELSE(EXISTS PYQT4_VERSION)
|
|||||||
STRING(REGEX REPLACE "^pyqt_version:([^\n]+).*$" "\\1" PYQT4_VERSION ${pyqt_config})
|
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_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_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_dir:([^\n]+).*$" "\\1" PYQT4_SIP_DIR ${pyqt_config})
|
||||||
STRING(REGEX REPLACE ".*\npyqt_sip_flags:([^\n]+).*$" "\\1" PYQT4_SIP_FLAGS ${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(PYQT4_FOUND)
|
||||||
|
|
||||||
ENDIF(EXISTS PYQT4_VERSION)
|
ENDIF(EXISTS PYQT4_VERSION)
|
||||||
|
|
||||||
|
|
||||||
|
@ -35,9 +35,9 @@ IF(MSVC)
|
|||||||
ADD_DEFINITIONS(-DNOMINMAX)
|
ADD_DEFINITIONS(-DNOMINMAX)
|
||||||
ENDIF(MSVC)
|
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)
|
SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} PROXY_FACTORY)
|
||||||
ENDIF(PYQT4_VERSION_TAG LESS 263680)
|
ENDIF(PYQT4_VERSION_NUM LESS 263680)
|
||||||
|
|
||||||
# core module
|
# core module
|
||||||
FILE(GLOB sip_files_core core/*.sip)
|
FILE(GLOB sip_files_core core/*.sip)
|
||||||
|
@ -108,7 +108,12 @@ int main( int argc, char **argv )
|
|||||||
void *ptr;
|
void *ptr;
|
||||||
double val;
|
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 );
|
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();
|
cell = G_allocate_c_raster_buf();
|
||||||
dcell = G_allocate_d_raster_buf();
|
dcell = G_allocate_d_raster_buf();
|
||||||
|
|
||||||
@ -120,7 +125,7 @@ int main( int argc, char **argv )
|
|||||||
rast_opt->answer, row );
|
rast_opt->answer, row );
|
||||||
}
|
}
|
||||||
val = cell[col];
|
val = cell[col];
|
||||||
ptr = &(cell[col]);
|
ptr = &( cell[col] );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -130,7 +135,7 @@ int main( int argc, char **argv )
|
|||||||
rast_opt->answer, row );
|
rast_opt->answer, row );
|
||||||
}
|
}
|
||||||
val = dcell[col];
|
val = dcell[col];
|
||||||
ptr = &(dcell[col]);
|
ptr = &( dcell[col] );
|
||||||
}
|
}
|
||||||
if ( G_is_null_value( ptr, rast_type ) )
|
if ( G_is_null_value( ptr, rast_type ) )
|
||||||
{
|
{
|
||||||
|
@ -40,6 +40,13 @@ extern "C"
|
|||||||
#include <grass/version.h>
|
#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)
|
#if defined(WIN32)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
QString GRASS_EXPORT QgsGrass::shortPath( const QString &path )
|
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)
|
// Set principal GRASS variables (in memory)
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
G__setenv(( char * ) "GISDBASE", shortPath( gisdbase ).toLocal8Bit().data() );
|
G__setenv( "GISDBASE", shortPath( gisdbase ).toLocal8Bit().data() );
|
||||||
#else
|
#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':
|
// gives error 'LOCATION ... not available':
|
||||||
G__setenv(( char * ) "GISDBASE", gisdbase.toUtf8().constData() );
|
G__setenv( "GISDBASE", gisdbase.toUtf8().constData() );
|
||||||
#endif
|
#endif
|
||||||
G__setenv(( char * ) "LOCATION_NAME", location.toUtf8().constData() );
|
G__setenv( "LOCATION_NAME", location.toUtf8().constData() );
|
||||||
G__setenv(( char * ) "MAPSET", ( char * ) "PERMANENT" ); // PERMANENT must always exist
|
G__setenv( "MAPSET", "PERMANENT" ); // PERMANENT must always exist
|
||||||
|
|
||||||
// Add all available mapsets to search path
|
// Add all available mapsets to search path
|
||||||
char **ms = G_available_mapsets();
|
char **ms = G_available_mapsets();
|
||||||
@ -354,12 +361,12 @@ void QgsGrass::setMapset( QString gisdbase, QString location, QString mapset )
|
|||||||
|
|
||||||
// Set principal GRASS variables (in memory)
|
// Set principal GRASS variables (in memory)
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
G__setenv(( char * ) "GISDBASE", shortPath( gisdbase ).toUtf8().data() );
|
G__setenv( "GISDBASE", shortPath( gisdbase ).toUtf8().data() );
|
||||||
#else
|
#else
|
||||||
G__setenv(( char * ) "GISDBASE", gisdbase.toUtf8().data() );
|
G__setenv( "GISDBASE", gisdbase.toUtf8().data() );
|
||||||
#endif
|
#endif
|
||||||
G__setenv(( char * ) "LOCATION_NAME", location.toUtf8().data() );
|
G__setenv( "LOCATION_NAME", location.toUtf8().data() );
|
||||||
G__setenv(( char * ) "MAPSET", mapset.toUtf8().data() );
|
G__setenv( "MAPSET", mapset.toUtf8().data() );
|
||||||
|
|
||||||
// Add all available mapsets to search path
|
// Add all available mapsets to search path
|
||||||
char **ms = G_available_mapsets();
|
char **ms = G_available_mapsets();
|
||||||
@ -560,14 +567,14 @@ QString GRASS_EXPORT QgsGrass::openMapset( QString gisdbase, QString location, Q
|
|||||||
putEnv( "GISRC", mGisrc );
|
putEnv( "GISRC", mGisrc );
|
||||||
|
|
||||||
// Reinitialize GRASS
|
// Reinitialize GRASS
|
||||||
G__setenv(( char * ) "GISRC", mGisrc.toUtf8().data() );
|
G__setenv( "GISRC", mGisrc.toUtf8().data() );
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
G__setenv(( char * ) "GISDBASE", shortPath( gisdbase ).toLocal8Bit().data() );
|
G__setenv( "GISDBASE", shortPath( gisdbase ).toLocal8Bit().data() );
|
||||||
#else
|
#else
|
||||||
G__setenv(( char * ) "GISDBASE", gisdbase.toUtf8().data() );
|
G__setenv( "GISDBASE", gisdbase.toUtf8().data() );
|
||||||
#endif
|
#endif
|
||||||
G__setenv(( char * ) "LOCATION_NAME", location.toLocal8Bit().data() );
|
G__setenv( "LOCATION_NAME", location.toLocal8Bit().data() );
|
||||||
G__setenv(( char * ) "MAPSET", mapset.toLocal8Bit().data() );
|
G__setenv( "MAPSET", mapset.toLocal8Bit().data() );
|
||||||
defaultGisdbase = gisdbase;
|
defaultGisdbase = gisdbase;
|
||||||
defaultLocation = location;
|
defaultLocation = location;
|
||||||
defaultMapset = mapset;
|
defaultMapset = mapset;
|
||||||
@ -602,15 +609,15 @@ QString QgsGrass::closeMapset( )
|
|||||||
putenv(( char * ) "GISRC" );
|
putenv(( char * ) "GISRC" );
|
||||||
|
|
||||||
// Reinitialize GRASS
|
// Reinitialize GRASS
|
||||||
G__setenv(( char * ) "GISRC", ( char * ) "" );
|
G__setenv( "GISRC", ( char * ) "" );
|
||||||
|
|
||||||
// Temporarily commented because of
|
// Temporarily commented because of
|
||||||
// http://trac.osgeo.org/qgis/ticket/1900
|
// http://trac.osgeo.org/qgis/ticket/1900
|
||||||
// http://trac.osgeo.org/gdal/ticket/3313
|
// http://trac.osgeo.org/gdal/ticket/3313
|
||||||
// it can be uncommented once GDAL with patch gets deployed (probably GDAL 1.8)
|
// it can be uncommented once GDAL with patch gets deployed (probably GDAL 1.8)
|
||||||
//G__setenv(( char * ) "GISDBASE", ( char * ) "" );
|
//G__setenv( "GISDBASE", ( char * ) "" );
|
||||||
//G__setenv(( char * ) "LOCATION_NAME", ( char * ) "" );
|
//G__setenv( "LOCATION_NAME", ( char * ) "" );
|
||||||
//G__setenv(( char * ) "MAPSET", ( char * ) "" );
|
//G__setenv( "MAPSET", ( char * ) "" );
|
||||||
|
|
||||||
defaultGisdbase = "";
|
defaultGisdbase = "";
|
||||||
defaultLocation = "";
|
defaultLocation = "";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user