fix windows build by cleaning up (dynamic) linkage and some warnings

This commit is contained in:
Juergen E. Fischer 2011-05-24 11:38:32 +02:00
parent 49a1ec635c
commit 0b2317e85a
24 changed files with 304 additions and 400 deletions

View File

@ -348,27 +348,17 @@ IF(COMMAND cmake_policy)
ENDIF(COMMAND cmake_policy) ENDIF(COMMAND cmake_policy)
IF (WIN32) IF (WIN32)
# expect that classes are being imported SET(DLLIMPORT "__declspec(dllimport)")
# Note: MSVC doesn't like when the macros are quotes SET(DLLEXPORT "__declspec(dllexport)")
# and MSYS doesn't like them unqouted (bacause of braces)
IF (MSVC)
ADD_DEFINITIONS("-DCORE_EXPORT=__declspec(dllimport)")
ADD_DEFINITIONS("-DGUI_EXPORT=__declspec(dllimport)")
ADD_DEFINITIONS("-DPYTHON_EXPORT=__declspec(dllimport)")
ADD_DEFINITIONS("-DANALYSIS_EXPORT=__declspec(dllimport)")
ELSE (MSVC)
ADD_DEFINITIONS("\"-DCORE_EXPORT=__declspec(dllimport)\"")
ADD_DEFINITIONS("\"-DGUI_EXPORT=__declspec(dllimport)\"")
ADD_DEFINITIONS("\"-DPYTHON_EXPORT=__declspec(dllimport)\"")
ADD_DEFINITIONS("\"-DANALYSIS_EXPORT=__declspec(dllimport)\"")
ENDIF (MSVC)
ELSE (WIN32) ELSE (WIN32)
# other compilers don't use that MSVC construct SET(DLLIMPORT "")
ADD_DEFINITIONS(-DCORE_EXPORT=) SET(DLLEXPORT "")
ADD_DEFINITIONS(-DGUI_EXPORT=) ENDIF(WIN32)
ADD_DEFINITIONS(-DPYTHON_EXPORT=)
ADD_DEFINITIONS(-DANALYSIS_EXPORT=) ADD_DEFINITIONS("-DCORE_EXPORT=${DLLIMPORT}")
ENDIF (WIN32) ADD_DEFINITIONS("-DGUI_EXPORT=${DLLIMPORT}")
ADD_DEFINITIONS("-DPYTHON_EXPORT=${DLLIMPORT}")
ADD_DEFINITIONS("-DANALYSIS_EXPORT=${DLLIMPORT}")
############################################################# #############################################################
# user-changeable settings which can be used to customize # user-changeable settings which can be used to customize

0
src/browser/qgsbrowsermodel.cpp Executable file → Normal file
View File

2
src/core/qgscredentials.cpp Normal file → Executable file
View File

@ -25,7 +25,9 @@ QgsCredentials *QgsCredentials::smInstance = 0;
void QgsCredentials::setInstance( QgsCredentials *theInstance ) void QgsCredentials::setInstance( QgsCredentials *theInstance )
{ {
if ( smInstance ) if ( smInstance )
{
QgsDebugMsg( "already registered an instance of QgsCredentials" ); QgsDebugMsg( "already registered an instance of QgsCredentials" );
}
smInstance = theInstance; smInstance = theInstance;
} }

26
src/core/qgsdataitem.cpp Executable file → Normal file
View File

@ -16,8 +16,6 @@
***************************************************************************/ ***************************************************************************/
/* $Id$ */ /* $Id$ */
#include <typeinfo>
#include <QApplication> #include <QApplication>
#include <QDateTime> #include <QDateTime>
#include <QDir> #include <QDir>
@ -258,12 +256,12 @@ void QgsDataItem::refresh()
bool QgsDataItem::equal( const QgsDataItem *other ) bool QgsDataItem::equal( const QgsDataItem *other )
{ {
if ( typeid ( this ) == typeid ( other ) && if ( metaObject()->className() == other->metaObject()->className() &&
mPath == other->path() ) mPath == other->path() )
{ {
return true; return true;
} }
return false; return false;
} }
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
@ -349,7 +347,7 @@ QgsDirectoryItem::QgsDirectoryItem( QgsDataItem* parent, QString name, QString p
QgsDebugMsg( library->fileName() + " has NoDataCapabilities" ); QgsDebugMsg( library->fileName() + " has NoDataCapabilities" );
continue; continue;
} }
QgsDebugMsg( QString ( "%1 dataCapabilities : %2").arg(library->fileName()).arg(dataCapabilities() ) ); QgsDebugMsg( QString( "%1 dataCapabilities : %2" ).arg( library->fileName() ).arg( dataCapabilities() ) );
mLibraries.append( library ); mLibraries.append( library );
} }
else else
@ -380,11 +378,11 @@ QVector<QgsDataItem*> QgsDirectoryItem::createChildren( )
children.append( item ); children.append( item );
} }
QStringList fileEntries = dir.entryList( QDir::Dirs|QDir::NoDotAndDotDot|QDir::Files, QDir::Name ); QStringList fileEntries = dir.entryList( QDir::Dirs | QDir::NoDotAndDotDot | QDir::Files, QDir::Name );
foreach( QString name, fileEntries ) foreach( QString name, fileEntries )
{ {
QString path = dir.absoluteFilePath( name ); QString path = dir.absoluteFilePath( name );
QFileInfo fileInfo ( path ); QFileInfo fileInfo( path );
foreach( QLibrary *library, mLibraries ) foreach( QLibrary *library, mLibraries )
{ {
// we could/should create separate list of providers for each purpose // we could/should create separate list of providers for each purpose
@ -398,10 +396,10 @@ QVector<QgsDataItem*> QgsDirectoryItem::createChildren( )
int capabilities = dataCapabilities(); int capabilities = dataCapabilities();
if ( !( (fileInfo.isFile() && (capabilities & QgsDataProvider::File)) || if ( !(( fileInfo.isFile() && ( capabilities & QgsDataProvider::File ) ) ||
(fileInfo.isDir() && (capabilities & QgsDataProvider::Dir))) ) ( fileInfo.isDir() && ( capabilities & QgsDataProvider::Dir ) ) ) )
{ {
continue; continue;
} }
dataItem_t * dataItem = ( dataItem_t * ) cast_to_fptr( library->resolve( "dataItem" ) ); dataItem_t * dataItem = ( dataItem_t * ) cast_to_fptr( library->resolve( "dataItem" ) );

0
src/core/qgsdataitem.h Executable file → Normal file
View File

11
src/core/qgspallabeling.cpp Normal file → Executable file
View File

@ -576,9 +576,10 @@ void QgsPalLayerSettings::registerFeature( QgsFeature& f, const QgsRenderContext
xPos, yPos, dataDefinedPosition, angle, dataDefinedRotation ) ) xPos, yPos, dataDefinedPosition, angle, dataDefinedRotation ) )
return; return;
} }
catch ( std::exception* e ) catch ( std::exception &e )
{ {
QgsDebugMsg( QString( "Ignoring feature %1 due PAL exception: " ).arg( f.id() ) + QString::fromLatin1( e->what() ) ); Q_UNUSED( e );
QgsDebugMsg( QString( "Ignoring feature %1 due PAL exception: " ).arg( f.id() ) + QString::fromLatin1( e.what() ) );
return; return;
} }
@ -869,9 +870,10 @@ void QgsPalLabeling::registerDiagramFeature( QgsVectorLayer* layer, QgsFeature&
return; return;
} }
} }
catch ( std::exception* e ) catch ( std::exception &e )
{ {
QgsDebugMsg( QString( "Ignoring feature %1 due PAL exception: " ).arg( feat.id() ) + QString::fromLatin1( e->what() ) ); Q_UNUSED( e );
QgsDebugMsg( QString( "Ignoring feature %1 due PAL exception: " ).arg( feat.id() ) + QString::fromLatin1( e.what() ) );
return; return;
} }
@ -961,6 +963,7 @@ void QgsPalLabeling::drawLabeling( QgsRenderContext& context )
} }
catch ( std::exception& e ) catch ( std::exception& e )
{ {
Q_UNUSED( e );
QgsDebugMsg( "PAL EXCEPTION :-( " + QString::fromLatin1( e.what() ) ); QgsDebugMsg( "PAL EXCEPTION :-( " + QString::fromLatin1( e.what() ) );
//mActiveLayers.clear(); // clean up //mActiveLayers.clear(); // clean up
return; return;

View File

@ -24,7 +24,6 @@
//! global function from parser.y that interfaces parser //! global function from parser.y that interfaces parser
extern QgsSearchTreeNode* parseSearchString( const QString& str, QString& parserErrorMsg ); extern QgsSearchTreeNode* parseSearchString( const QString& str, QString& parserErrorMsg );
QgsSearchString::QgsSearchString() QgsSearchString::QgsSearchString()
{ {
mTree = NULL; mTree = NULL;

View File

@ -778,6 +778,7 @@ void QgsVectorLayer::drawRendererV2( QgsRenderContext& rendererContext, bool lab
} }
catch ( const QgsCsException &cse ) catch ( const QgsCsException &cse )
{ {
Q_UNUSED( cse );
QgsDebugMsg( QString( "Failed to transform a point while drawing a feature of type '%1'. Ignoring this feature. %2" ) QgsDebugMsg( QString( "Failed to transform a point while drawing a feature of type '%1'. Ignoring this feature. %2" )
.arg( fet.typeName() ).arg( cse.what() ) ); .arg( fet.typeName() ).arg( cse.what() ) );
} }
@ -920,6 +921,7 @@ void QgsVectorLayer::drawRendererV2Levels( QgsRenderContext& rendererContext, bo
} }
catch ( const QgsCsException &cse ) catch ( const QgsCsException &cse )
{ {
Q_UNUSED( cse );
QgsDebugMsg( QString( "Failed to transform a point while drawing a feature of type '%1'. Ignoring this feature. %2" ) QgsDebugMsg( QString( "Failed to transform a point while drawing a feature of type '%1'. Ignoring this feature. %2" )
.arg( fet.typeName() ).arg( cse.what() ) ); .arg( fet.typeName() ).arg( cse.what() ) );
} }
@ -1106,6 +1108,7 @@ bool QgsVectorLayer::draw( QgsRenderContext& rendererContext )
} }
catch ( QgsCsException &cse ) catch ( QgsCsException &cse )
{ {
Q_UNUSED( cse );
QgsDebugMsg( QString( "Failed to transform a point while drawing a feature of type '%1'. Rendering stopped. %2" ) QgsDebugMsg( QString( "Failed to transform a point while drawing a feature of type '%1'. Rendering stopped. %2" )
.arg( fet.typeName() ).arg( cse.what() ) ); .arg( fet.typeName() ).arg( cse.what() ) );
return false; return false;
@ -1446,7 +1449,9 @@ void QgsVectorLayer::updateExtents()
mLayerExtent.setMinimal(); mLayerExtent.setMinimal();
if ( !mDataProvider ) if ( !mDataProvider )
{
QgsDebugMsg( "invoked with null mDataProvider" ); QgsDebugMsg( "invoked with null mDataProvider" );
}
if ( mDeletedFeatureIds.isEmpty() && mChangedGeometries.isEmpty() ) if ( mDeletedFeatureIds.isEmpty() && mChangedGeometries.isEmpty() )
{ {
@ -1739,7 +1744,9 @@ bool QgsVectorLayer::nextFeature( QgsFeature &f )
} }
if ( !found ) if ( !found )
{
QgsDebugMsg( QString( "No attributes for the added feature %1 found" ).arg( f.id() ) ); QgsDebugMsg( QString( "No attributes for the added feature %1 found" ).arg( f.id() ) );
}
} }
else else
{ {
@ -1841,7 +1848,9 @@ bool QgsVectorLayer::featureAtId( int featureId, QgsFeature& f, bool fetchGeomet
} }
if ( !found ) if ( !found )
{
QgsDebugMsg( QString( "No attributes for the added feature %1 found" ).arg( f.id() ) ); QgsDebugMsg( QString( "No attributes for the added feature %1 found" ).arg( f.id() ) );
}
} }
else else
{ {

View File

@ -15,11 +15,12 @@ SUBDIRS(modules-common ${GRASS_MODULES_DIR} scripts themes)
ADD_DEFINITIONS(-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\") ADD_DEFINITIONS(-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\")
ADD_DEFINITIONS(-DHAVE_OPENPTY=${HAVE_OPENPTY}) ADD_DEFINITIONS(-DHAVE_OPENPTY=${HAVE_OPENPTY})
ADD_DEFINITIONS("-DGRASS_EXPORT=${DLLIMPORT} -DGRASS_LIB_EXPORT=${DLLIMPORT}")
IF (WIN32) IF (WIN32)
ADD_DEFINITIONS(-DHAVE_GETPT "-DGRASS_EXPORT=__declspec(dllimport)") ADD_DEFINITIONS(-DHAVE_GETPT)
ELSE (WIN32) ELSE (WIN32)
ADD_DEFINITIONS(-DHAVE_POSIX_OPENPT -DGRASS_EXPORT=) ADD_DEFINITIONS(-DHAVE_POSIX_OPENPT)
ENDIF (WIN32) ENDIF (WIN32)
######################################################## ########################################################
@ -151,6 +152,7 @@ INCLUDE_DIRECTORIES(
TARGET_LINK_LIBRARIES(grassplugin TARGET_LINK_LIBRARIES(grassplugin
qgisgrass qgisgrass
qgis_gui qgis_gui
grassprovider
${OPENPTY_LIBRARY} ${OPENPTY_LIBRARY}
) )

1
src/plugins/grass/qgsgrassplugin.cpp Normal file → Executable file
View File

@ -256,6 +256,7 @@ void QgsGrassPlugin::mapsetChanged()
} }
catch ( QgsGrass::Exception &e ) catch ( QgsGrass::Exception &e )
{ {
Q_UNUSED( e );
QgsDebugMsg( "Cannot read GRASS CRS : " + QString( e.what() ) ); QgsDebugMsg( "Cannot read GRASS CRS : " + QString( e.what() ) );
mCrs = QgsCoordinateReferenceSystem(); mCrs = QgsCoordinateReferenceSystem();
} }

View File

@ -41,9 +41,11 @@ class QToolBar;
* \brief OpenModeller plugin for QGIS * \brief OpenModeller plugin for QGIS
* *
*/ */
class QgsGrassPlugin: public QObject, public QgisPlugin class QgsGrassPlugin : public QObject, public QgisPlugin
{ {
Q_OBJECT public: Q_OBJECT
public:
/** /**
* Constructor for a plugin. The QgisInterface pointer is passed by * Constructor for a plugin. The QgisInterface pointer is passed by
* QGIS when it attempts to instantiate the plugin. * QGIS when it attempts to instantiate the plugin.
@ -68,7 +70,7 @@ class QgsGrassPlugin: public QObject, public QgisPlugin
*/ */
virtual int type(); virtual int type();
//! Destructor //! Destructor
virtual ~ QgsGrassPlugin(); virtual ~QgsGrassPlugin();
//! Get Region Pen //! Get Region Pen
QPen & regionPen( void ); QPen & regionPen( void );

View File

@ -337,8 +337,8 @@ void QgsGrassSelect::setLayers()
return; return;
QStringList layers = QgsGrass::vectorLayers( egisdbase->text(), QStringList layers = QgsGrass::vectorLayers( egisdbase->text(),
elocation->currentText(), emapset->currentText(), elocation->currentText(), emapset->currentText(),
emap->currentText().toUtf8() ); emap->currentText().toUtf8() );
int idx = 0; int idx = 0;
int sel = -1; int sel = -1;

84
src/providers/grass/CMakeLists.txt Executable file → Normal file
View File

@ -1,22 +1,9 @@
ADD_DEFINITIONS(-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\") ADD_DEFINITIONS(-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\")
########################################################
# Files
SET(GRASS_PROVIDER_SRCS provider.cpp qgsgrassprovider.cpp )
SET(GRASS_RASTER_PROVIDER_SRCS qgsgrassrasterprovider.cpp)
SET(GRASS_LIB_SRCS qgsgrass.cpp)
SET(QGIS_D_RAST_SRCS qgis.d.rast.c)
SET(QGIS_G_INFO_SRCS qgis.g.info.c)
######################################################## ########################################################
# Build # Build
INCLUDE_DIRECTORIES ( INCLUDE_DIRECTORIES(
../../core ../../core
../../core/raster ../../core/raster
${GRASS_INCLUDE_DIR} ${GRASS_INCLUDE_DIR}
@ -25,18 +12,15 @@ INCLUDE_DIRECTORIES (
${GEOS_INCLUDE_DIR} ${GEOS_INCLUDE_DIR}
) )
QT4_WRAP_CPP(GRASS_MOC_SRCS qgsgrassprovider.h) #
ADD_LIBRARY (qgisgrass SHARED ${GRASS_LIB_SRCS} ${GRASS_MOC_SRCS}) # GRASS library
#
SET_TARGET_PROPERTIES(qgisgrass PROPERTIES VERSION ${COMPLETE_VERSION} SOVERSION ${COMPLETE_VERSION}) ADD_LIBRARY(qgisgrass SHARED qgsgrass.cpp)
SET_TARGET_PROPERTIES(qgisgrass PROPERTIES
IF (WIN32) VERSION ${COMPLETE_VERSION} SOVERSION ${COMPLETE_VERSION}
SET_TARGET_PROPERTIES(qgisgrass PROPERTIES COMPILE_FLAGS "\"-DGRASS_EXPORT=__declspec(dllexport)\"" ) COMPILE_FLAGS "\"-DGRASS_LIB_EXPORT=${DLLEXPORT}\" \"-DGRASS_EXPORT=${DLLIMPORT}\"" )
ELSE (WIN32) TARGET_LINK_LIBRARIES(qgisgrass
SET_TARGET_PROPERTIES(qgisgrass PROPERTIES COMPILE_FLAGS "-DGRASS_EXPORT=" )
ENDIF (WIN32)
TARGET_LINK_LIBRARIES (qgisgrass
qgis_core qgis_core
${GRASS_LIBRARY_gis} ${GRASS_LIBRARY_gis}
${GRASS_LIBRARY_vect} ${GRASS_LIBRARY_vect}
@ -49,43 +33,41 @@ IF (APPLE)
SET_TARGET_PROPERTIES(qgisgrass PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE ) SET_TARGET_PROPERTIES(qgisgrass PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE )
ENDIF (APPLE) ENDIF (APPLE)
ADD_LIBRARY (grassprovider MODULE ${GRASS_PROVIDER_SRCS} ${GRASS_MOC_SRCS}) #
# GRASS vector provider
#
IF (WIN32) QT4_WRAP_CPP(GRASS_PROVIDER_MOC_SRCS qgsgrassprovider.h)
SET_TARGET_PROPERTIES(grassprovider PROPERTIES COMPILE_FLAGS "\"-DGRASS_EXPORT=__declspec(dllexport)\"" ) ADD_LIBRARY(grassprovider SHARED qgsgrassprovider.cpp ${GRASS_PROVIDER_MOC_SRCS})
ELSE (WIN32) SET_TARGET_PROPERTIES(grassprovider PROPERTIES COMPILE_FLAGS "\"-DGRASS_EXPORT=${DLLEXPORT}\" \"-DGRASS_LIB_EXPORT=${DLLIMPORT}\"" )
SET_TARGET_PROPERTIES(grassprovider PROPERTIES COMPILE_FLAGS "-DGRASS_EXPORT=" ) TARGET_LINK_LIBRARIES(grassprovider qgisgrass)
ENDIF (WIN32)
TARGET_LINK_LIBRARIES (grassprovider #
qgisgrass # grass raster provider
) #
QT4_WRAP_CPP(GRASS_MOC_RASTERSRCS qgsgrassrasterprovider.h) QT4_WRAP_CPP(GRASS_RASTERPROVIDER_MOC_SRCS qgsgrassrasterprovider.h)
ADD_LIBRARY (grassrasterprovider MODULE ${GRASS_RASTER_PROVIDER_SRCS} ${GRASS_MOC_RASTERSRCS}) ADD_LIBRARY(grassrasterprovider MODULE qgsgrassrasterprovider.cpp ${GRASS_RASTERPROVIDER_MOC_SRCS})
SET_TARGET_PROPERTIES(grassrasterprovider PROPERTIES COMPILE_FLAGS "\"-DGRASS_EXPORT=${DLLEXPORT}\" \"-DGRASS_LIB_EXPORT=${DLLIMPORT}\"" )
TARGET_LINK_LIBRARIES(grassrasterprovider qgisgrass qgis_core)
IF (WIN32) #
SET_TARGET_PROPERTIES(grassrasterprovider PROPERTIES COMPILE_FLAGS "\"-DGRASS_EXPORT=__declspec(dllexport)\"" ) # grass raster display module
ELSE (WIN32) #
SET_TARGET_PROPERTIES(grassrasterprovider PROPERTIES COMPILE_FLAGS "-DGRASS_EXPORT=" )
ENDIF (WIN32)
TARGET_LINK_LIBRARIES (grassrasterprovider ADD_EXECUTABLE(qgis.d.rast qgis.d.rast.c)
qgisgrass TARGET_LINK_LIBRARIES(qgis.d.rast
qgis_core
)
ADD_EXECUTABLE(qgis.d.rast ${QGIS_D_RAST_SRCS})
TARGET_LINK_LIBRARIES (qgis.d.rast
${GRASS_LIBRARY_gis} ${GRASS_LIBRARY_gis}
${GRASS_LIBRARY_datetime} ${GRASS_LIBRARY_datetime}
${GDAL_LIBRARY} ${GDAL_LIBRARY}
) )
ADD_EXECUTABLE(qgis.g.info ${QGIS_G_INFO_SRCS}) #
# grass info module
#
TARGET_LINK_LIBRARIES (qgis.g.info ADD_EXECUTABLE(qgis.g.info qgis.g.info.c)
TARGET_LINK_LIBRARIES(qgis.g.info
${GRASS_LIBRARY_gis} ${GRASS_LIBRARY_gis}
${GRASS_LIBRARY_datetime} ${GRASS_LIBRARY_datetime}
${GRASS_LIBRARY_gproj} ${GRASS_LIBRARY_gproj}

View File

@ -1,70 +0,0 @@
/***************************************************************************
qgsgrassprovider.cpp - Data provider for GRASS format
-------------------
begin : March, 2004
copyright : (C) 2004 by Gary E.Sherman, Radim Blazek
email : sherman@mrcc.com, blazek@itc.it
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include <string.h>
#include <vector>
#include <cfloat>
#include <QString>
#include <QDateTime>
#include "qgis.h"
#include "qgsdataprovider.h"
#include "qgsfeature.h"
#include "qgsfield.h"
#include "qgsrectangle.h"
extern "C"
{
#include <grass/gis.h>
#include <grass/dbmi.h>
#include <grass/Vect.h>
}
#include "qgsgrass.h"
#include "qgsgrassprovider.h"
/**
* Class factory to return a pointer to a newly created
* QgsGrassProvider object
*/
QGISEXTERN QgsGrassProvider * classFactory( const QString *uri )
{
return new QgsGrassProvider( *uri );
}
/** Required key function (used to map the plugin to a data store type)
*/
QGISEXTERN QString providerKey()
{
return QString( "grass" );
}
/**
* Required description function
*/
QGISEXTERN QString description()
{
return QString( "GRASS data provider" );
}
/**
* Required isProvider function. Used to determine if this shared library
* is a data provider plugin
*/
QGISEXTERN bool isProvider()
{
return true;
}

92
src/providers/grass/qgsgrass.cpp Normal file → Executable file
View File

@ -52,7 +52,7 @@ extern "C"
#if defined(WIN32) #if defined(WIN32)
#include <windows.h> #include <windows.h>
QString GRASS_EXPORT QgsGrass::shortPath( const QString &path ) QString GRASS_LIB_EXPORT QgsGrass::shortPath( const QString &path )
{ {
TCHAR buf[MAX_PATH]; TCHAR buf[MAX_PATH];
int len = GetShortPathName( path.toUtf8().constData(), buf, MAX_PATH ); int len = GetShortPathName( path.toUtf8().constData(), buf, MAX_PATH );
@ -71,7 +71,7 @@ QString GRASS_EXPORT QgsGrass::shortPath( const QString &path )
} }
#endif #endif
void GRASS_EXPORT QgsGrass::init( void ) void GRASS_LIB_EXPORT QgsGrass::init( void )
{ {
// Warning!!! // Warning!!!
// G_set_error_routine() once called from plugin // G_set_error_routine() once called from plugin
@ -420,22 +420,22 @@ int QgsGrass::error_routine( const char *msg, int fatal )
return 1; return 1;
} }
void GRASS_EXPORT QgsGrass::resetError( void ) void GRASS_LIB_EXPORT QgsGrass::resetError( void )
{ {
lastError = OK; lastError = OK;
} }
int GRASS_EXPORT QgsGrass::error( void ) int GRASS_LIB_EXPORT QgsGrass::error( void )
{ {
return lastError; return lastError;
} }
QString GRASS_EXPORT QgsGrass::errorMessage( void ) QString GRASS_LIB_EXPORT QgsGrass::errorMessage( void )
{ {
return error_message; return error_message;
} }
QString GRASS_EXPORT QgsGrass::openMapset( QString gisdbase, QString location, QString mapset ) QString GRASS_LIB_EXPORT QgsGrass::openMapset( QString gisdbase, QString location, QString mapset )
{ {
QgsDebugMsg( QString( "gisdbase = %1" ).arg( gisdbase.toUtf8().constData() ) ); QgsDebugMsg( QString( "gisdbase = %1" ).arg( gisdbase.toUtf8().constData() ) );
QgsDebugMsg( QString( "location = %1" ).arg( location.toUtf8().constData() ) ); QgsDebugMsg( QString( "location = %1" ).arg( location.toUtf8().constData() ) );
@ -659,7 +659,7 @@ QString QgsGrass::closeMapset( )
return NULL; return NULL;
} }
QStringList GRASS_EXPORT QgsGrass::locations( QString gisbase ) QStringList GRASS_LIB_EXPORT QgsGrass::locations( QString gisbase )
{ {
QgsDebugMsg( QString( "gisbase = %1" ).arg( gisbase ) ); QgsDebugMsg( QString( "gisbase = %1" ).arg( gisbase ) );
@ -682,7 +682,7 @@ QStringList GRASS_EXPORT QgsGrass::locations( QString gisbase )
return list; return list;
} }
QStringList GRASS_EXPORT QgsGrass::mapsets( QString gisbase, QString locationName ) QStringList GRASS_LIB_EXPORT QgsGrass::mapsets( QString gisbase, QString locationName )
{ {
QgsDebugMsg( QString( "gisbase = %1 locationName = %2" ).arg( gisbase ).arg( locationName ) ); QgsDebugMsg( QString( "gisbase = %1 locationName = %2" ).arg( gisbase ).arg( locationName ) );
@ -692,7 +692,7 @@ QStringList GRASS_EXPORT QgsGrass::mapsets( QString gisbase, QString locationNam
return QgsGrass::mapsets( gisbase + "/" + locationName ); return QgsGrass::mapsets( gisbase + "/" + locationName );
} }
QStringList GRASS_EXPORT QgsGrass::mapsets( QString locationPath ) QStringList GRASS_LIB_EXPORT QgsGrass::mapsets( QString locationPath )
{ {
QgsDebugMsg( QString( "locationPath = %1" ).arg( locationPath ) ); QgsDebugMsg( QString( "locationPath = %1" ).arg( locationPath ) );
@ -714,7 +714,7 @@ QStringList GRASS_EXPORT QgsGrass::mapsets( QString locationPath )
return list; return list;
} }
QStringList GRASS_EXPORT QgsGrass::vectors( QString gisbase, QString locationName, QStringList GRASS_LIB_EXPORT QgsGrass::vectors( QString gisbase, QString locationName,
QString mapsetName ) QString mapsetName )
{ {
QgsDebugMsg( "entered." ); QgsDebugMsg( "entered." );
@ -751,7 +751,7 @@ QStringList GRASS_EXPORT QgsGrass::vectors( QString gisbase, QString locationNam
return QgsGrass::vectors( gisbase + "/" + locationName + "/" + mapsetName ); return QgsGrass::vectors( gisbase + "/" + locationName + "/" + mapsetName );
} }
QStringList GRASS_EXPORT QgsGrass::vectors( QString mapsetPath ) QStringList GRASS_LIB_EXPORT QgsGrass::vectors( QString mapsetPath )
{ {
QgsDebugMsg( QString( "mapsetPath = %1" ).arg( mapsetPath ) ); QgsDebugMsg( QString( "mapsetPath = %1" ).arg( mapsetPath ) );
@ -775,7 +775,7 @@ QStringList GRASS_EXPORT QgsGrass::vectors( QString mapsetPath )
} }
return list; return list;
} }
QStringList GRASS_EXPORT QgsGrass::vectorLayers( QString gisdbase, QStringList GRASS_LIB_EXPORT QgsGrass::vectorLayers( QString gisdbase,
QString location, QString mapset, QString mapName ) QString location, QString mapset, QString mapName )
{ {
QStringList list; QStringList list;
@ -869,7 +869,7 @@ QStringList GRASS_EXPORT QgsGrass::vectorLayers( QString gisdbase,
return list; return list;
} }
QStringList GRASS_EXPORT QgsGrass::rasters( QString gisbase, QString locationName, QStringList GRASS_LIB_EXPORT QgsGrass::rasters( QString gisbase, QString locationName,
QString mapsetName ) QString mapsetName )
{ {
QgsDebugMsg( "entered." ); QgsDebugMsg( "entered." );
@ -907,7 +907,7 @@ QStringList GRASS_EXPORT QgsGrass::rasters( QString gisbase, QString locationNam
return QgsGrass::rasters( gisbase + "/" + locationName + "/" + mapsetName ); return QgsGrass::rasters( gisbase + "/" + locationName + "/" + mapsetName );
} }
QStringList GRASS_EXPORT QgsGrass::rasters( QString mapsetPath ) QStringList GRASS_LIB_EXPORT QgsGrass::rasters( QString mapsetPath )
{ {
QgsDebugMsg( QString( "mapsetPath = %1" ).arg( mapsetPath ) ); QgsDebugMsg( QString( "mapsetPath = %1" ).arg( mapsetPath ) );
@ -926,7 +926,7 @@ QStringList GRASS_EXPORT QgsGrass::rasters( QString mapsetPath )
return list; return list;
} }
QStringList GRASS_EXPORT QgsGrass::elements( QString gisbase, QString locationName, QStringList GRASS_LIB_EXPORT QgsGrass::elements( QString gisbase, QString locationName,
QString mapsetName, QString element ) QString mapsetName, QString element )
{ {
if ( gisbase.isEmpty() || locationName.isEmpty() || mapsetName.isEmpty() ) if ( gisbase.isEmpty() || locationName.isEmpty() || mapsetName.isEmpty() )
@ -936,7 +936,7 @@ QStringList GRASS_EXPORT QgsGrass::elements( QString gisbase, QString locationNa
element ); element );
} }
QStringList GRASS_EXPORT QgsGrass::elements( QString mapsetPath, QString element ) QStringList GRASS_LIB_EXPORT QgsGrass::elements( QString mapsetPath, QString element )
{ {
QgsDebugMsg( QString( "mapsetPath = %1" ).arg( mapsetPath ) ); QgsDebugMsg( QString( "mapsetPath = %1" ).arg( mapsetPath ) );
@ -955,7 +955,7 @@ QStringList GRASS_EXPORT QgsGrass::elements( QString mapsetPath, QString element
return list; return list;
} }
QString GRASS_EXPORT QgsGrass::regionString( struct Cell_head *window ) QString GRASS_LIB_EXPORT QgsGrass::regionString( struct Cell_head *window )
{ {
QString reg; QString reg;
int fmt; int fmt;
@ -992,9 +992,9 @@ QString GRASS_EXPORT QgsGrass::regionString( struct Cell_head *window )
return reg; return reg;
} }
bool GRASS_EXPORT QgsGrass::region( QString gisbase, bool GRASS_LIB_EXPORT QgsGrass::region( QString gisbase,
QString location, QString mapset, QString location, QString mapset,
struct Cell_head *window ) struct Cell_head *window )
{ {
QgsGrass::setLocation( gisbase, location ); QgsGrass::setLocation( gisbase, location );
@ -1005,7 +1005,7 @@ bool GRASS_EXPORT QgsGrass::region( QString gisbase,
return true; return true;
} }
bool GRASS_EXPORT QgsGrass::writeRegion( QString gisbase, bool GRASS_LIB_EXPORT QgsGrass::writeRegion( QString gisbase,
QString location, QString mapset, QString location, QString mapset,
struct Cell_head *window ) struct Cell_head *window )
{ {
@ -1023,7 +1023,7 @@ bool GRASS_EXPORT QgsGrass::writeRegion( QString gisbase,
return true; return true;
} }
void GRASS_EXPORT QgsGrass::copyRegionExtent( struct Cell_head *source, void GRASS_LIB_EXPORT QgsGrass::copyRegionExtent( struct Cell_head *source,
struct Cell_head *target ) struct Cell_head *target )
{ {
target->north = source->north; target->north = source->north;
@ -1034,7 +1034,7 @@ void GRASS_EXPORT QgsGrass::copyRegionExtent( struct Cell_head *source,
target->bottom = source->bottom; target->bottom = source->bottom;
} }
void GRASS_EXPORT QgsGrass::copyRegionResolution( struct Cell_head *source, void GRASS_LIB_EXPORT QgsGrass::copyRegionResolution( struct Cell_head *source,
struct Cell_head *target ) struct Cell_head *target )
{ {
target->ns_res = source->ns_res; target->ns_res = source->ns_res;
@ -1044,7 +1044,7 @@ void GRASS_EXPORT QgsGrass::copyRegionResolution( struct Cell_head *source,
target->ew_res3 = source->ew_res3; target->ew_res3 = source->ew_res3;
} }
void GRASS_EXPORT QgsGrass::extendRegion( struct Cell_head *source, void GRASS_LIB_EXPORT QgsGrass::extendRegion( struct Cell_head *source,
struct Cell_head *target ) struct Cell_head *target )
{ {
if ( source->north > target->north ) if ( source->north > target->north )
@ -1066,9 +1066,9 @@ void GRASS_EXPORT QgsGrass::extendRegion( struct Cell_head *source,
target->bottom = source->bottom; target->bottom = source->bottom;
} }
bool GRASS_EXPORT QgsGrass::mapRegion( int type, QString gisbase, bool GRASS_LIB_EXPORT QgsGrass::mapRegion( int type, QString gisbase,
QString location, QString mapset, QString map, QString location, QString mapset, QString map,
struct Cell_head *window ) struct Cell_head *window )
{ {
QgsDebugMsg( "entered." ); QgsDebugMsg( "entered." );
QgsDebugMsg( QString( "map = %1" ).arg( map ) ); QgsDebugMsg( QString( "map = %1" ).arg( map ) );
@ -1143,7 +1143,7 @@ bool GRASS_EXPORT QgsGrass::mapRegion( int type, QString gisbase,
return true; return true;
} }
QProcess GRASS_EXPORT *QgsGrass::startModule( QString gisdbase, QString location, QProcess GRASS_LIB_EXPORT *QgsGrass::startModule( QString gisdbase, QString location,
QString module, QStringList arguments, QTemporaryFile &gisrcFile ) QString module, QStringList arguments, QTemporaryFile &gisrcFile )
{ {
QgsDebugMsg( QString( "gisdbase = %1 location = %2" ).arg( gisdbase ).arg( location ) ); QgsDebugMsg( QString( "gisdbase = %1 location = %2" ).arg( gisdbase ).arg( location ) );
@ -1183,7 +1183,7 @@ QProcess GRASS_EXPORT *QgsGrass::startModule( QString gisdbase, QString location
return process; return process;
} }
QByteArray GRASS_EXPORT QgsGrass::runModule( QString gisdbase, QString location, QByteArray GRASS_LIB_EXPORT QgsGrass::runModule( QString gisdbase, QString location,
QString module, QStringList arguments ) QString module, QStringList arguments )
{ {
QgsDebugMsg( QString( "gisdbase = %1 location = %2" ).arg( gisdbase ).arg( location ) ); QgsDebugMsg( QString( "gisdbase = %1 location = %2" ).arg( gisdbase ).arg( location ) );
@ -1207,8 +1207,8 @@ QByteArray GRASS_EXPORT QgsGrass::runModule( QString gisdbase, QString location,
return data; return data;
} }
QString GRASS_EXPORT QgsGrass::getInfo( QString info, QString gisdbase, QString location, QString GRASS_LIB_EXPORT QgsGrass::getInfo( QString info, QString gisdbase, QString location,
QString mapset, QString map, MapType type, double x, double y ) QString mapset, QString map, MapType type, double x, double y )
{ {
QgsDebugMsg( QString( "gisdbase = %1 location = %2" ).arg( gisdbase ).arg( location ) ); QgsDebugMsg( QString( "gisdbase = %1 location = %2" ).arg( gisdbase ).arg( location ) );
@ -1244,7 +1244,7 @@ QString GRASS_EXPORT QgsGrass::getInfo( QString info, QString gisdbase, QString
return QString( data ); return QString( data );
} }
QgsCoordinateReferenceSystem GRASS_EXPORT QgsGrass::crs( QString gisdbase, QString location ) QgsCoordinateReferenceSystem GRASS_LIB_EXPORT QgsGrass::crs( QString gisdbase, QString location )
{ {
QgsDebugMsg( QString( "gisdbase = %1 location = %2" ).arg( gisdbase ).arg( location ) ); QgsDebugMsg( QString( "gisdbase = %1 location = %2" ).arg( gisdbase ).arg( location ) );
QgsCoordinateReferenceSystem crs = QgsCoordinateReferenceSystem(); QgsCoordinateReferenceSystem crs = QgsCoordinateReferenceSystem();
@ -1264,7 +1264,7 @@ QgsCoordinateReferenceSystem GRASS_EXPORT QgsGrass::crs( QString gisdbase, QStri
return crs; return crs;
} }
QgsCoordinateReferenceSystem GRASS_EXPORT QgsGrass::crsDirect( QString gisdbase, QString location ) QgsCoordinateReferenceSystem GRASS_LIB_EXPORT QgsGrass::crsDirect( QString gisdbase, QString location )
{ {
QString Wkt; QString Wkt;
@ -1305,7 +1305,7 @@ QgsCoordinateReferenceSystem GRASS_EXPORT QgsGrass::crsDirect( QString gisdbase,
return srs; return srs;
} }
QgsRectangle GRASS_EXPORT QgsGrass::extent( QString gisdbase, QString location, QString mapset, QString map, MapType type ) QgsRectangle GRASS_LIB_EXPORT QgsGrass::extent( QString gisdbase, QString location, QString mapset, QString map, MapType type )
{ {
QgsDebugMsg( QString( "gisdbase = %1 location = %2" ).arg( gisdbase ).arg( location ) ); QgsDebugMsg( QString( "gisdbase = %1 location = %2" ).arg( gisdbase ).arg( location ) );
@ -1327,7 +1327,7 @@ QgsRectangle GRASS_EXPORT QgsGrass::extent( QString gisdbase, QString location,
return QgsRectangle( 0, 0, 0, 0 ); return QgsRectangle( 0, 0, 0, 0 );
} }
void GRASS_EXPORT QgsGrass::size( QString gisdbase, QString location, QString mapset, QString map, int *cols, int *rows ) void GRASS_LIB_EXPORT QgsGrass::size( QString gisdbase, QString location, QString mapset, QString map, int *cols, int *rows )
{ {
QgsDebugMsg( QString( "gisdbase = %1 location = %2" ).arg( gisdbase ).arg( location ) ); QgsDebugMsg( QString( "gisdbase = %1 location = %2" ).arg( gisdbase ).arg( location ) );
@ -1353,7 +1353,7 @@ void GRASS_EXPORT QgsGrass::size( QString gisdbase, QString location, QString ma
QgsDebugMsg( QString( "raster size = %1 %2" ).arg( *cols ).arg( *rows ) ); QgsDebugMsg( QString( "raster size = %1 %2" ).arg( *cols ).arg( *rows ) );
} }
QHash<QString, QString> GRASS_EXPORT QgsGrass::info( QString gisdbase, QString location, QString mapset, QString map, MapType type ) QHash<QString, QString> GRASS_LIB_EXPORT QgsGrass::info( QString gisdbase, QString location, QString mapset, QString map, MapType type )
{ {
QgsDebugMsg( QString( "gisdbase = %1 location = %2" ).arg( gisdbase ).arg( location ) ); QgsDebugMsg( QString( "gisdbase = %1 location = %2" ).arg( gisdbase ).arg( location ) );
QHash<QString, QString> inf; QHash<QString, QString> inf;
@ -1383,7 +1383,7 @@ QHash<QString, QString> GRASS_EXPORT QgsGrass::info( QString gisdbase, QString l
return inf; return inf;
} }
QList<QgsGrass::Color> GRASS_EXPORT QgsGrass::colors( QString gisdbase, QString location, QString mapset, QString map ) QList<QgsGrass::Color> GRASS_LIB_EXPORT QgsGrass::colors( QString gisdbase, QString location, QString mapset, QString map )
{ {
QgsDebugMsg( QString( "gisdbase = %1 location = %2" ).arg( gisdbase ).arg( location ) ); QgsDebugMsg( QString( "gisdbase = %1 location = %2" ).arg( gisdbase ).arg( location ) );
QList<QgsGrass::Color> ct; QList<QgsGrass::Color> ct;
@ -1413,7 +1413,7 @@ QList<QgsGrass::Color> GRASS_EXPORT QgsGrass::colors( QString gisdbase, QString
return ct; return ct;
} }
QMap<QString, QString> GRASS_EXPORT QgsGrass::query( QString gisdbase, QString location, QString mapset, QString map, MapType type, double x, double y ) QMap<QString, QString> GRASS_LIB_EXPORT QgsGrass::query( QString gisdbase, QString location, QString mapset, QString map, MapType type, double x, double y )
{ {
QgsDebugMsg( QString( "gisdbase = %1 location = %2" ).arg( gisdbase ).arg( location ) ); QgsDebugMsg( QString( "gisdbase = %1 location = %2" ).arg( gisdbase ).arg( location ) );
@ -1440,7 +1440,7 @@ QMap<QString, QString> GRASS_EXPORT QgsGrass::query( QString gisdbase, QString l
// http://freegis.org/cgi-bin/viewcvs.cgi/grass6/include/version.h.in.diff?r1=1.4&r2=1.5 // http://freegis.org/cgi-bin/viewcvs.cgi/grass6/include/version.h.in.diff?r1=1.4&r2=1.5
// The following lines workaround this change // The following lines workaround this change
int GRASS_EXPORT QgsGrass::versionMajor() int GRASS_LIB_EXPORT QgsGrass::versionMajor()
{ {
#ifdef GRASS_VERSION_MAJOR #ifdef GRASS_VERSION_MAJOR
return GRASS_VERSION_MAJOR; return GRASS_VERSION_MAJOR;
@ -1449,7 +1449,7 @@ int GRASS_EXPORT QgsGrass::versionMajor()
#endif #endif
} }
int GRASS_EXPORT QgsGrass::versionMinor() int GRASS_LIB_EXPORT QgsGrass::versionMinor()
{ {
#ifdef GRASS_VERSION_MINOR #ifdef GRASS_VERSION_MINOR
return GRASS_VERSION_MINOR; return GRASS_VERSION_MINOR;
@ -1458,7 +1458,7 @@ int GRASS_EXPORT QgsGrass::versionMinor()
#endif #endif
} }
int GRASS_EXPORT QgsGrass::versionRelease() int GRASS_LIB_EXPORT QgsGrass::versionRelease()
{ {
#ifdef GRASS_VERSION_RELEASE #ifdef GRASS_VERSION_RELEASE
#define QUOTE(x) #x #define QUOTE(x) #x
@ -1467,12 +1467,12 @@ int GRASS_EXPORT QgsGrass::versionRelease()
return QString( GRASS_VERSION_RELEASE ).toInt(); return QString( GRASS_VERSION_RELEASE ).toInt();
#endif #endif
} }
QString GRASS_EXPORT QgsGrass::versionString() QString GRASS_LIB_EXPORT QgsGrass::versionString()
{ {
return QString( GRASS_VERSION_STRING ); return QString( GRASS_VERSION_STRING );
} }
bool GRASS_EXPORT QgsGrass::isMapset( QString path ) bool GRASS_LIB_EXPORT QgsGrass::isMapset( QString path )
{ {
#if 0 #if 0
/* TODO: G_is_mapset() was added to GRASS 6.1 06-05-24, /* TODO: G_is_mapset() was added to GRASS 6.1 06-05-24,
@ -1496,12 +1496,12 @@ bool GRASS_EXPORT QgsGrass::isMapset( QString path )
return false; return false;
} }
QString GRASS_EXPORT QgsGrass::lockFilePath() QString GRASS_LIB_EXPORT QgsGrass::lockFilePath()
{ {
return mMapsetLock; return mMapsetLock;
} }
QString GRASS_EXPORT QgsGrass::gisrcFilePath() QString GRASS_LIB_EXPORT QgsGrass::gisrcFilePath()
{ {
if ( mGisrc.isEmpty() ) if ( mGisrc.isEmpty() )
{ {
@ -1514,7 +1514,7 @@ QString GRASS_EXPORT QgsGrass::gisrcFilePath()
return mGisrc; return mGisrc;
} }
void GRASS_EXPORT QgsGrass::putEnv( QString name, QString value ) void GRASS_LIB_EXPORT QgsGrass::putEnv( QString name, QString value )
{ {
QString env = name + "=" + value; QString env = name + "=" + value;
/* _Correct_ putenv() implementation is not making copy! */ /* _Correct_ putenv() implementation is not making copy! */

View File

@ -65,23 +65,23 @@ class QgsGrass
* Active mode means that GISRC is set up and GISRC file is available, * Active mode means that GISRC is set up and GISRC file is available,
* in that case default GISDBASE, LOCATION and MAPSET may be read by GetDefaul*() functions. * in that case default GISDBASE, LOCATION and MAPSET may be read by GetDefaul*() functions.
* Passive mode means, that GISRC is not available. */ * Passive mode means, that GISRC is not available. */
static GRASS_EXPORT bool activeMode( void ); static GRASS_LIB_EXPORT bool activeMode( void );
//! Get default GISDBASE, returns GISDBASE name or empty string if not in active mode //! Get default GISDBASE, returns GISDBASE name or empty string if not in active mode
static GRASS_EXPORT QString getDefaultGisdbase( void ); static GRASS_LIB_EXPORT QString getDefaultGisdbase( void );
//! Get default LOCATION_NAME, returns LOCATION_NAME name or empty string if not in active mode //! Get default LOCATION_NAME, returns LOCATION_NAME name or empty string if not in active mode
static GRASS_EXPORT QString getDefaultLocation( void ); static GRASS_LIB_EXPORT QString getDefaultLocation( void );
//! Get default MAPSET, returns MAPSET name or empty string if not in active mode //! Get default MAPSET, returns MAPSET name or empty string if not in active mode
static GRASS_EXPORT QString getDefaultMapset( void ); static GRASS_LIB_EXPORT QString getDefaultMapset( void );
//! Init or reset GRASS library //! Init or reset GRASS library
/*! /*!
\param gisdbase full path to GRASS GISDBASE. \param gisdbase full path to GRASS GISDBASE.
\param location location name (not path!). \param location location name (not path!).
*/ */
static GRASS_EXPORT void setLocation( QString gisdbase, QString location ); static GRASS_LIB_EXPORT void setLocation( QString gisdbase, QString location );
/*! /*!
\param gisdbase full path to GRASS GISDBASE. \param gisdbase full path to GRASS GISDBASE.
@ -89,7 +89,7 @@ class QgsGrass
\param mapset current mupset. Note that some variables depend on mapset and \param mapset current mupset. Note that some variables depend on mapset and
may influence behaviour of some functions (e.g. search path etc.) may influence behaviour of some functions (e.g. search path etc.)
*/ */
static GRASS_EXPORT void setMapset( QString gisdbase, QString location, QString mapset ); static GRASS_LIB_EXPORT void setMapset( QString gisdbase, QString location, QString mapset );
//! Error codes returned by error() //! Error codes returned by error()
enum GERROR { OK, /*!< OK. No error. */ enum GERROR { OK, /*!< OK. No error. */
@ -100,139 +100,139 @@ class QgsGrass
enum MapType { None, Raster, Vector, Region }; enum MapType { None, Raster, Vector, Region };
//! Reset error code (to OK). Call this before a piece of code where an error is expected //! Reset error code (to OK). Call this before a piece of code where an error is expected
static GRASS_EXPORT void resetError( void ); // reset error status static GRASS_LIB_EXPORT void resetError( void ); // reset error status
//! Check if any error occured in lately called functions. Returns value from ERROR. //! Check if any error occured in lately called functions. Returns value from ERROR.
static GRASS_EXPORT int error( void ); static GRASS_LIB_EXPORT int error( void );
//! Get last error message //! Get last error message
static GRASS_EXPORT QString errorMessage( void ); static GRASS_LIB_EXPORT QString errorMessage( void );
/** \brief Open existing GRASS mapset /** \brief Open existing GRASS mapset
* \return NULL string or error message * \return NULL string or error message
*/ */
static GRASS_EXPORT QString openMapset( QString gisdbase, static GRASS_LIB_EXPORT QString openMapset( QString gisdbase,
QString location, QString mapset ); QString location, QString mapset );
/** \brief Close mapset if it was opened from QGIS. /** \brief Close mapset if it was opened from QGIS.
* Delete GISRC, lock and temporary directory * Delete GISRC, lock and temporary directory
* \return NULL string or error message * \return NULL string or error message
*/ */
static GRASS_EXPORT QString closeMapset(); static GRASS_LIB_EXPORT QString closeMapset();
//! Check if given directory contains a GRASS installation //! Check if given directory contains a GRASS installation
static GRASS_EXPORT bool isValidGrassBaseDir( QString const gisBase ); static GRASS_LIB_EXPORT bool isValidGrassBaseDir( QString const gisBase );
//! Returns list of locations in given gisbase //! Returns list of locations in given gisbase
static QStringList GRASS_EXPORT locations( QString gisbase ); static QStringList GRASS_LIB_EXPORT locations( QString gisbase );
//! Returns list of mapsets in location //! Returns list of mapsets in location
static GRASS_EXPORT QStringList mapsets( QString gisbase, QString locationName ); static GRASS_LIB_EXPORT QStringList mapsets( QString gisbase, QString locationName );
static GRASS_EXPORT QStringList mapsets( QString locationPath ); static GRASS_LIB_EXPORT QStringList mapsets( QString locationPath );
//! List of vectors and rasters //! List of vectors and rasters
static GRASS_EXPORT QStringList vectors( QString gisbase, QString locationName, static GRASS_LIB_EXPORT QStringList vectors( QString gisbase, QString locationName,
QString mapsetName ); QString mapsetName );
static GRASS_EXPORT QStringList vectors( QString mapsetPath ); static GRASS_LIB_EXPORT QStringList vectors( QString mapsetPath );
static GRASS_EXPORT QStringList rasters( QString gisbase, QString locationName, static GRASS_LIB_EXPORT QStringList rasters( QString gisbase, QString locationName,
QString mapsetName ); QString mapsetName );
static GRASS_EXPORT QStringList rasters( QString mapsetPath ); static GRASS_LIB_EXPORT QStringList rasters( QString mapsetPath );
//! Get list of vector layers //! Get list of vector layers
static QStringList vectorLayers( QString, QString, QString, QString ); static GRASS_LIB_EXPORT QStringList vectorLayers( QString, QString, QString, QString );
//! List of elements //! List of elements
static GRASS_EXPORT QStringList elements( QString gisbase, QString locationName, static GRASS_LIB_EXPORT QStringList elements( QString gisbase, QString locationName,
QString mapsetName, QString element ); QString mapsetName, QString element );
static GRASS_EXPORT QStringList elements( QString mapsetPath, QString element ); static GRASS_LIB_EXPORT QStringList elements( QString mapsetPath, QString element );
// ! Get map region // ! Get map region
static GRASS_EXPORT bool mapRegion( int type, QString gisbase, static GRASS_LIB_EXPORT bool mapRegion( int type, QString gisbase,
QString location, QString mapset, QString map, QString location, QString mapset, QString map,
struct Cell_head *window ); struct Cell_head *window );
// ! String representation of region // ! String representation of region
static GRASS_EXPORT QString regionString( struct Cell_head *window ); static GRASS_LIB_EXPORT QString regionString( struct Cell_head *window );
// ! Read current mapset region // ! Read current mapset region
static GRASS_EXPORT bool region( QString gisbase, QString location, QString mapset, static GRASS_LIB_EXPORT bool region( QString gisbase, QString location, QString mapset,
struct Cell_head *window ); struct Cell_head *window );
// ! Write current mapset region // ! Write current mapset region
static GRASS_EXPORT bool writeRegion( QString gisbase, QString location, QString mapset, static GRASS_LIB_EXPORT bool writeRegion( QString gisbase, QString location, QString mapset,
struct Cell_head *window ); struct Cell_head *window );
// ! Set (copy) region extent, resolution is not changed // ! Set (copy) region extent, resolution is not changed
static GRASS_EXPORT void copyRegionExtent( struct Cell_head *source, static GRASS_LIB_EXPORT void copyRegionExtent( struct Cell_head *source,
struct Cell_head *target ); struct Cell_head *target );
// ! Set (copy) region resolution, extent is not changed // ! Set (copy) region resolution, extent is not changed
static GRASS_EXPORT void copyRegionResolution( struct Cell_head *source, static GRASS_LIB_EXPORT void copyRegionResolution( struct Cell_head *source,
struct Cell_head *target ); struct Cell_head *target );
// ! Extend region in target to source // ! Extend region in target to source
static GRASS_EXPORT void extendRegion( struct Cell_head *source, static GRASS_LIB_EXPORT void extendRegion( struct Cell_head *source,
struct Cell_head *target ); struct Cell_head *target );
static GRASS_EXPORT void init( void ); static GRASS_LIB_EXPORT void init( void );
// ! test if the directory is mapset // ! test if the directory is mapset
static GRASS_EXPORT bool isMapset( QString path ); static GRASS_LIB_EXPORT bool isMapset( QString path );
// ! Get the lock file // ! Get the lock file
static GRASS_EXPORT QString lockFilePath(); static GRASS_LIB_EXPORT QString lockFilePath();
// ! Get current gisrc path // ! Get current gisrc path
static GRASS_EXPORT QString gisrcFilePath(); static GRASS_LIB_EXPORT QString gisrcFilePath();
// ! Start a GRASS module in any gisdbase/location // ! Start a GRASS module in any gisdbase/location
static GRASS_EXPORT QProcess *startModule( QString gisdbase, QString location, QString module, QStringList arguments, QTemporaryFile &gisrcFile ); static GRASS_LIB_EXPORT QProcess *startModule( QString gisdbase, QString location, QString module, QStringList arguments, QTemporaryFile &gisrcFile );
// ! Run a GRASS module in any gisdbase/location // ! Run a GRASS module in any gisdbase/location
static GRASS_EXPORT QByteArray runModule( QString gisdbase, QString location, QString module, QStringList arguments ); static GRASS_LIB_EXPORT QByteArray runModule( QString gisdbase, QString location, QString module, QStringList arguments );
// ! Get info string from qgis.g.info module // ! Get info string from qgis.g.info module
static GRASS_EXPORT QString getInfo( QString info, QString gisdbase, static GRASS_LIB_EXPORT QString getInfo( QString info, QString gisdbase,
QString location, QString mapset = "", QString map = "", MapType type = None, double x = 0.0, double y = 0.0 ); QString location, QString mapset = "", QString map = "", MapType type = None, double x = 0.0, double y = 0.0 );
// ! Get location projection // ! Get location projection
static GRASS_EXPORT QgsCoordinateReferenceSystem crs( QString gisdbase, QString location ); static GRASS_LIB_EXPORT QgsCoordinateReferenceSystem crs( QString gisdbase, QString location );
// ! Get location projection calling directly GRASS library // ! Get location projection calling directly GRASS library
static GRASS_EXPORT QgsCoordinateReferenceSystem crsDirect( QString gisdbase, QString location ); static GRASS_LIB_EXPORT QgsCoordinateReferenceSystem crsDirect( QString gisdbase, QString location );
// ! Get map extent // ! Get map extent
static GRASS_EXPORT QgsRectangle extent( QString gisdbase, QString location, static GRASS_LIB_EXPORT QgsRectangle extent( QString gisdbase, QString location,
QString mapset, QString map, MapType type = None ); QString mapset, QString map, MapType type = None );
// ! Get raster map size // ! Get raster map size
static GRASS_EXPORT void size( QString gisdbase, QString location, static GRASS_LIB_EXPORT void size( QString gisdbase, QString location,
QString mapset, QString map, int *cols, int *rows ); QString mapset, QString map, int *cols, int *rows );
// ! Get raster info // ! Get raster info
static GRASS_EXPORT QHash<QString, QString> info( QString gisdbase, QString location, static GRASS_LIB_EXPORT QHash<QString, QString> info( QString gisdbase, QString location,
QString mapset, QString map, MapType type ); QString mapset, QString map, MapType type );
// ! List of Color // ! List of Color
static GRASS_EXPORT QList<QgsGrass::Color> colors( QString gisdbase, QString location, static GRASS_LIB_EXPORT QList<QgsGrass::Color> colors( QString gisdbase, QString location,
QString mapset, QString map ); QString mapset, QString map );
// ! Get map value / feautre info // ! Get map value / feautre info
static GRASS_EXPORT QMap<QString, QString> query( QString gisdbase, QString location, static GRASS_LIB_EXPORT QMap<QString, QString> query( QString gisdbase, QString location,
QString mapset, QString map, MapType type, double x, double y ); QString mapset, QString map, MapType type, double x, double y );
//! Library version //! Library version
static GRASS_EXPORT int versionMajor(); static GRASS_LIB_EXPORT int versionMajor();
static GRASS_EXPORT int versionMinor(); static GRASS_LIB_EXPORT int versionMinor();
static GRASS_EXPORT int versionRelease(); static GRASS_LIB_EXPORT int versionRelease();
static GRASS_EXPORT QString versionString(); static GRASS_LIB_EXPORT QString versionString();
// set environment variable // set environment variable
static GRASS_EXPORT void putEnv( QString name, QString value ); static GRASS_LIB_EXPORT void putEnv( QString name, QString value );
#if defined(WIN32) #if defined(WIN32)
static GRASS_EXPORT QString shortPath( const QString &path ); static GRASS_LIB_EXPORT QString shortPath( const QString &path );
#endif #endif
private: private:

View File

@ -15,6 +15,23 @@
***************************************************************************/ ***************************************************************************/
/* $Id$ */ /* $Id$ */
#include <cstring>
#include <vector>
#include <cfloat>
#include <QString>
#include <QDateTime>
#include "qgis.h"
#include "qgsdataprovider.h"
#include "qgsfeature.h"
#include "qgsfield.h"
#include "qgsrectangle.h"
#include "qgsgrass.h"
#include "qgsgrassprovider.h"
#include "qgsgrassprovider.h" #include "qgsgrassprovider.h"
#include "qgsgrass.h" #include "qgsgrass.h"
@ -23,8 +40,6 @@
#include "qgsfield.h" #include "qgsfield.h"
#include "qgslogger.h" #include "qgslogger.h"
#include <cfloat>
#include <QByteArray> #include <QByteArray>
#include <QDir> #include <QDir>
#include <QFile> #include <QFile>
@ -2394,16 +2409,16 @@ QString QgsGrassProvider::description() const
} // QgsGrassProvider::description() } // QgsGrassProvider::description()
QgsGrassLocationItem::QgsGrassLocationItem ( QgsDataItem* parent, QString path ) QgsGrassLocationItem::QgsGrassLocationItem( QgsDataItem* parent, QString path )
: QgsDataCollectionItem ( parent, "", path ) : QgsDataCollectionItem( parent, "", path )
{ {
QFileInfo fi ( path ); QFileInfo fi( path );
mName =fi.baseName(); mName = fi.baseName();
mIcon = QIcon ( getThemePixmap ( "grass_location.png" ) ); mIcon = QIcon( getThemePixmap( "grass_location.png" ) );
} }
QgsGrassLocationItem::~QgsGrassLocationItem () {} QgsGrassLocationItem::~QgsGrassLocationItem() {}
bool QgsGrassLocationItem::isLocation ( QString path ) bool QgsGrassLocationItem::isLocation( QString path )
{ {
//QgsDebugMsg( "path = " + path ); //QgsDebugMsg( "path = " + path );
return QFile::exists( path + QDir::separator() + "PERMANENT" + QDir::separator() + "DEFAULT_WIND" ); return QFile::exists( path + QDir::separator() + "PERMANENT" + QDir::separator() + "DEFAULT_WIND" );
@ -2414,49 +2429,49 @@ QVector<QgsDataItem*>QgsGrassLocationItem::createChildren()
QVector<QgsDataItem*> mapsets; QVector<QgsDataItem*> mapsets;
QDir dir( mPath ); QDir dir( mPath );
QStringList entries = dir.entryList( QDir::Dirs|QDir::NoDotAndDotDot, QDir::Name ); QStringList entries = dir.entryList( QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name );
foreach( QString name, entries ) foreach( QString name, entries )
{ {
QString path = dir.absoluteFilePath( name ); QString path = dir.absoluteFilePath( name );
if ( QgsGrassMapsetItem::isMapset ( path ) ) if ( QgsGrassMapsetItem::isMapset( path ) )
{ {
QgsGrassMapsetItem * mapset = new QgsGrassMapsetItem ( this, path ); QgsGrassMapsetItem * mapset = new QgsGrassMapsetItem( this, path );
mapsets.append ( mapset ); mapsets.append( mapset );
} }
} }
return mapsets; return mapsets;
} }
QgsGrassMapsetItem::QgsGrassMapsetItem ( QgsDataItem* parent, QString path ) QgsGrassMapsetItem::QgsGrassMapsetItem( QgsDataItem* parent, QString path )
: QgsDataCollectionItem ( parent, "", path ) : QgsDataCollectionItem( parent, "", path )
{ {
QDir dir( path ); QDir dir( path );
mName = dir.dirName(); mName = dir.dirName();
dir.cdUp(); dir.cdUp();
mLocation = dir.dirName(); mLocation = dir.dirName();
dir.cdUp(); dir.cdUp();
mGisdbase = dir.path(); mGisdbase = dir.path();
mIcon = QIcon ( getThemePixmap ( "grass_mapset.png" ) ); mIcon = QIcon( getThemePixmap( "grass_mapset.png" ) );
} }
QgsGrassMapsetItem::~QgsGrassMapsetItem () {} QgsGrassMapsetItem::~QgsGrassMapsetItem() {}
bool QgsGrassMapsetItem::isMapset ( QString path ) bool QgsGrassMapsetItem::isMapset( QString path )
{ {
return QFile::exists( path + QDir::separator() + "WIND" ); return QFile::exists( path + QDir::separator() + "WIND" );
} }
QVector<QgsDataItem*> QgsGrassMapsetItem::createChildren() QVector<QgsDataItem*> QgsGrassMapsetItem::createChildren()
{ {
QVector<QgsDataItem*> items; QVector<QgsDataItem*> items;
QStringList vectorNames = QgsGrass::vectors( mPath ); QStringList vectorNames = QgsGrass::vectors( mPath );
foreach( QString name, vectorNames ) foreach( QString name, vectorNames )
{ {
QStringList layerNames = QgsGrass::vectorLayers( mGisdbase , mLocation, mName, name ); QStringList layerNames = QgsGrass::vectorLayers( mGisdbase , mLocation, mName, name );
QString path = mPath + QDir::separator() + "vector" + QDir::separator() + name; QString path = mPath + QDir::separator() + "vector" + QDir::separator() + name;
@ -2466,10 +2481,10 @@ QVector<QgsDataItem*> QgsGrassMapsetItem::createChildren()
map = new QgsDataCollectionItem( this, name ); map = new QgsDataCollectionItem( this, name );
foreach( QString layerName, layerNames ) foreach( QString layerName, layerNames )
{ {
QString uri = mPath + QDir::separator() + name + QDir::separator() +layerName; QString uri = mPath + QDir::separator() + name + QDir::separator() + layerName;
QgsLayerItem::LayerType layerType = QgsLayerItem::Vector; QgsLayerItem::LayerType layerType = QgsLayerItem::Vector;
QString typeName = layerName.split("_")[1]; QString typeName = layerName.split( "_" )[1];
QString baseLayerName = layerName.split("_")[0]; QString baseLayerName = layerName.split( "_" )[0];
if ( typeName == "point" ) if ( typeName == "point" )
layerType = QgsLayerItem::Point; layerType = QgsLayerItem::Point;
@ -2478,30 +2493,29 @@ QVector<QgsDataItem*> QgsGrassMapsetItem::createChildren()
else if ( typeName == "polygon" ) else if ( typeName == "polygon" )
layerType = QgsLayerItem::Polygon; layerType = QgsLayerItem::Polygon;
if ( layerNames.size() == 1 ) if ( layerNames.size() == 1 )
{ {
QgsLayerItem *layer = new QgsLayerItem( this, name + " " + baseLayerName, path, uri, layerType, "grass" );
QgsLayerItem *layer = new QgsLayerItem ( this, name + " " + baseLayerName, path, uri, layerType, "grass" ); items.append( layer );
items.append( layer );
} }
else else
{ {
QgsLayerItem *layer = new QgsLayerItem ( map, baseLayerName, path, uri, layerType, "grass" ); QgsLayerItem *layer = new QgsLayerItem( map, baseLayerName, path, uri, layerType, "grass" );
map->addChild( layer ); map->addChild( layer );
} }
} }
if ( layerNames.size() != 1 ) if ( layerNames.size() != 1 )
items.append( map ); items.append( map );
} }
QStringList rasterNames = QgsGrass::rasters( mPath ); QStringList rasterNames = QgsGrass::rasters( mPath );
foreach( QString name, rasterNames ) foreach( QString name, rasterNames )
{ {
QString uri = mPath + QDir::separator() + "cellhd" + QDir::separator() + name; QString uri = mPath + QDir::separator() + "cellhd" + QDir::separator() + name;
QgsDebugMsg ( "uri = " + uri ); QgsDebugMsg( "uri = " + uri );
QgsLayerItem *layer = new QgsLayerItem ( this, name, uri, uri, QgsLayerItem::Raster, "grassraster" ); QgsLayerItem *layer = new QgsLayerItem( this, name, uri, uri, QgsLayerItem::Raster, "grassraster" );
items.append( layer ); items.append( layer );
} }
@ -2509,16 +2523,50 @@ QVector<QgsDataItem*> QgsGrassMapsetItem::createChildren()
return items; return items;
} }
QGISEXTERN int dataCapabilities () { QGISEXTERN int dataCapabilities()
{
return QgsDataProvider::Dir; return QgsDataProvider::Dir;
} }
QGISEXTERN QgsDataItem * dataItem ( QString thePath, QgsDataItem* parentItem ) QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )
{ {
if ( QgsGrassLocationItem::isLocation ( thePath ) ) if ( QgsGrassLocationItem::isLocation( thePath ) )
{ {
QgsGrassLocationItem * location = new QgsGrassLocationItem ( parentItem, thePath ); QgsGrassLocationItem * location = new QgsGrassLocationItem( parentItem, thePath );
return location; return location;
} }
return 0; return 0;
} }
/**
* Class factory to return a pointer to a newly created
* QgsGrassProvider object
*/
QGISEXTERN QgsGrassProvider * classFactory( const QString *uri )
{
return new QgsGrassProvider( *uri );
}
/** Required key function (used to map the plugin to a data store type)
*/
QGISEXTERN QString providerKey()
{
return QString( "grass" );
}
/**
* Required description function
*/
QGISEXTERN QString description()
{
return QString( "GRASS data provider" );
}
/**
* Required isProvider function. Used to determine if this shared library
* is a data provider plugin
*/
QGISEXTERN bool isProvider()
{
return true;
}

View File

@ -689,25 +689,25 @@ class GRASS_EXPORT QgsGrassProvider : public QgsVectorDataProvider
class QgsGrassLocationItem : public QgsDataCollectionItem class QgsGrassLocationItem : public QgsDataCollectionItem
{ {
public: public:
QgsGrassLocationItem (QgsDataItem* parent, QString path ); QgsGrassLocationItem( QgsDataItem* parent, QString path );
~QgsGrassLocationItem(); ~QgsGrassLocationItem();
static bool isLocation ( QString path ); static bool isLocation( QString path );
QVector<QgsDataItem*> createChildren(); QVector<QgsDataItem*> createChildren();
}; };
class QgsGrassMapsetItem : public QgsDataCollectionItem class QgsGrassMapsetItem : public QgsDataCollectionItem
{ {
public: public:
QgsGrassMapsetItem (QgsDataItem* parent, QString path ); QgsGrassMapsetItem( QgsDataItem* parent, QString path );
~QgsGrassMapsetItem(); ~QgsGrassMapsetItem();
static bool isMapset ( QString path ); static bool isMapset( QString path );
QVector<QgsDataItem*> createChildren(); QVector<QgsDataItem*> createChildren();
QString mLocation; QString mLocation;
QString mGisdbase; QString mGisdbase;
}; };

View File

@ -521,7 +521,7 @@ bool QgsOgrProvider::nextFeature( QgsFeature& feature )
setRelevantFields( mFetchGeom, mAttributesToFetch ); setRelevantFields( mFetchGeom, mAttributesToFetch );
while ( ( fet = OGR_L_GetNextFeature( ogrLayer ) ) ) while (( fet = OGR_L_GetNextFeature( ogrLayer ) ) )
{ {
// skip features without geometry // skip features without geometry
if ( !mFetchFeaturesWithoutGeom && !OGR_F_GetGeometryRef( fet ) ) if ( !mFetchFeaturesWithoutGeom && !OGR_F_GetGeometryRef( fet ) )

View File

@ -541,11 +541,17 @@ bool QgsOSMDataProvider::nextFeature( QgsFeature& feature )
default: default:
if ( mFeatureType == PointType ) if ( mFeatureType == PointType )
{
QgsDebugMsg( "Getting next feature of type <point> failed." ); QgsDebugMsg( "Getting next feature of type <point> failed." );
}
else if ( mFeatureType == LineType ) else if ( mFeatureType == LineType )
{
QgsDebugMsg( "Getting next feature of type <line> failed." ); QgsDebugMsg( "Getting next feature of type <line> failed." );
}
else if ( mFeatureType == PolygonType ) else if ( mFeatureType == PolygonType )
{
QgsDebugMsg( "Getting next feature of type <polygon> failed." ); QgsDebugMsg( "Getting next feature of type <polygon> failed." );
}
feature.setValid( false ); feature.setValid( false );
return false; return false;
} }

View File

@ -3,22 +3,10 @@
SUBDIRS( sqlanyconnection ) SUBDIRS( sqlanyconnection )
SET (SA_SRCS SET (SA_SRCS qgssqlanywhereprovider.cpp)
qgssqlanywhereprovider.cpp SET (SA_MOC_HDRS qgssqlanywhereprovider.h)
)
SET (SA_MOC_HDRS
qgssqlanywhereprovider.h
)
IF (WIN32) ADD_DEFINITIONS("-DSACONN_EXPORT=${DLLEXPORT}")
IF (MSVC)
ADD_DEFINITIONS("-DSACONN_EXPORT=__declspec(dllexport)")
ELSE (MSVC)
ADD_DEFINITIONS("-USACONN_EXPORT \"-DSACONN_EXPORT=__declspec(dllexport)\"")
ENDIF (MSVC)
ELSE (WIN32)
ADD_DEFINITIONS(-DSACONN_EXPORT=)
ENDIF (WIN32)
######################################################## ########################################################
# Build # Build

View File

@ -18,26 +18,6 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}
############################################################# #############################################################
# Compiler defines # Compiler defines
# expect that classes are being IMPORTED for the tests
IF (WIN32)
# expect that classes are being imported
# Note: MSVC doesn't like when the macros are quotes
# and MSYS doesn't like them unqouted (bacause of braces)
IF (MSVC)
ADD_DEFINITIONS("-DCORE_EXPORT=__declspec(dllimport)")
ADD_DEFINITIONS("-DANALYzer_EXPORT=__declspec(dllimport)")
#ADD_DEFINITIONS("-DPLUGIN_EXPORT=__declspec(dllimport)")
#next needed for qgis gui includes
ADD_DEFINITIONS("-DGUI_EXPORT=__declspec(dllexport)")
ELSE (MSVC)
ADD_DEFINITIONS("-UCORE_EXPORT \"-DCORE_EXPORT=__declspec(dllimport)\"")
ADD_DEFINITIONS("-UANALYzer_EXPORT \"-DCORE_EXPORT=__declspec(dllimport)\"")
#ADD_DEFINITIONS("\"-DPLUGIN_EXPORT=__declspec(dllimport)\"")
#next needed for qgis gui includes
ADD_DEFINITIONS("-UGUI_EXPORT \"-DGUI_EXPORT=__declspec(dllexport)\"")
ENDIF (MSVC)
ENDIF (WIN32)
# This define is used for tests that need to locate the test # This define is used for tests that need to locate the test
# data under tests/testdata in the qgis source tree. # data under tests/testdata in the qgis source tree.
# the TEST_DATA_DIR variable is set in the top level CMakeLists.txt # the TEST_DATA_DIR variable is set in the top level CMakeLists.txt

View File

@ -21,24 +21,6 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}
############################################################# #############################################################
# Compiler defines # Compiler defines
# expect that classes are being IMPORTED for the tests
IF (WIN32)
# expect that classes are being imported
# Note: MSVC doesn't like when the macros are quotes
# and MSYS doesn't like them unqouted (bacause of braces)
IF (MSVC)
ADD_DEFINITIONS("-DCORE_EXPORT=__declspec(dllimport)")
#ADD_DEFINITIONS("-DPLUGIN_EXPORT=__declspec(dllimport)")
#next needed for qgis gui includes
ADD_DEFINITIONS("-DGUI_EXPORT=__declspec(dllexport)")
ELSE (MSVC)
ADD_DEFINITIONS("-UCORE_EXPORT \"-DCORE_EXPORT=__declspec(dllimport)\"")
#ADD_DEFINITIONS("\"-DPLUGIN_EXPORT=__declspec(dllimport)\"")
#next needed for qgis gui includes
ADD_DEFINITIONS("-UGUI_EXPORT \"-DGUI_EXPORT=__declspec(dllexport)\"")
ENDIF (MSVC)
ENDIF (WIN32)
# This define is used for tests that need to locate the test # This define is used for tests that need to locate the test
# data under tests/testdata in the qgis source tree. # data under tests/testdata in the qgis source tree.
# the TEST_DATA_DIR variable is set in the top level CMakeLists.txt # the TEST_DATA_DIR variable is set in the top level CMakeLists.txt

View File

@ -20,24 +20,6 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}
############################################################# #############################################################
# Compiler defines # Compiler defines
# expect that classes are being IMPORTED for the tests
IF (WIN32)
# expect that classes are being imported
# Note: MSVC doesn't like when the macros are quotes
# and MSYS doesn't like them unqouted (bacause of braces)
IF (MSVC)
ADD_DEFINITIONS("-DCORE_EXPORT=__declspec(dllimport)")
#ADD_DEFINITIONS("-DPLUGIN_EXPORT=__declspec(dllimport)")
#next needed for qgis gui includes
ADD_DEFINITIONS("-DGUI_EXPORT=__declspec(dllimport)")
ELSE (MSVC)
ADD_DEFINITIONS("-UCORE_EXPORT \"-DCORE_EXPORT=__declspec(dllimport)\"")
#ADD_DEFINITIONS("\"-DPLUGIN_EXPORT=__declspec(dllimport)\"")
#next needed for qgis gui includes
ADD_DEFINITIONS("-UGUI_EXPORT \"-DGUI_EXPORT=__declspec(dllimport)\"")
ENDIF (MSVC)
ENDIF (WIN32)
# This define is used for tests that need to locate the test # This define is used for tests that need to locate the test
# data under tests/testdata in the qgis source tree. # data under tests/testdata in the qgis source tree.
# the TEST_DATA_DIR variable is set in the top level CMakeLists.txt # the TEST_DATA_DIR variable is set in the top level CMakeLists.txt