From 0b2317e85a7eef72d2fc7fc0c2e084cde38f7f3b Mon Sep 17 00:00:00 2001 From: "Juergen E. Fischer" Date: Tue, 24 May 2011 11:38:32 +0200 Subject: [PATCH] fix windows build by cleaning up (dynamic) linkage and some warnings --- CMakeLists.txt | 30 ++---- src/browser/qgsbrowsermodel.cpp | 0 src/core/qgscredentials.cpp | 2 + src/core/qgsdataitem.cpp | 26 +++-- src/core/qgsdataitem.h | 0 src/core/qgspallabeling.cpp | 11 +- src/core/qgssearchstring.cpp | 1 - src/core/qgsvectorlayer.cpp | 9 ++ src/plugins/grass/CMakeLists.txt | 6 +- src/plugins/grass/qgsgrassplugin.cpp | 1 + src/plugins/grass/qgsgrassplugin.h | 8 +- src/plugins/grass/qgsgrassselect.cpp | 4 +- src/providers/grass/CMakeLists.txt | 84 ++++++--------- src/providers/grass/provider.cpp | 70 ------------ src/providers/grass/qgsgrass.cpp | 92 ++++++++-------- src/providers/grass/qgsgrass.h | 116 ++++++++++---------- src/providers/grass/qgsgrassprovider.cpp | 130 ++++++++++++++++------- src/providers/grass/qgsgrassprovider.h | 32 +++--- src/providers/ogr/qgsogrprovider.cpp | 2 +- src/providers/osm/osmprovider.cpp | 6 ++ src/providers/sqlanywhere/CMakeLists.txt | 18 +--- tests/src/analysis/CMakeLists.txt | 20 ---- tests/src/core/CMakeLists.txt | 18 ---- tests/src/gui/CMakeLists.txt | 18 ---- 24 files changed, 304 insertions(+), 400 deletions(-) mode change 100755 => 100644 src/browser/qgsbrowsermodel.cpp mode change 100644 => 100755 src/core/qgscredentials.cpp mode change 100755 => 100644 src/core/qgsdataitem.cpp mode change 100755 => 100644 src/core/qgsdataitem.h mode change 100644 => 100755 src/core/qgspallabeling.cpp mode change 100644 => 100755 src/plugins/grass/qgsgrassplugin.cpp mode change 100755 => 100644 src/providers/grass/CMakeLists.txt delete mode 100644 src/providers/grass/provider.cpp mode change 100644 => 100755 src/providers/grass/qgsgrass.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index eed2b54f9e8..4a73038a5a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -348,27 +348,17 @@ IF(COMMAND cmake_policy) ENDIF(COMMAND cmake_policy) 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("-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) + SET(DLLIMPORT "__declspec(dllimport)") + SET(DLLEXPORT "__declspec(dllexport)") ELSE (WIN32) - # other compilers don't use that MSVC construct - ADD_DEFINITIONS(-DCORE_EXPORT=) - ADD_DEFINITIONS(-DGUI_EXPORT=) - ADD_DEFINITIONS(-DPYTHON_EXPORT=) - ADD_DEFINITIONS(-DANALYSIS_EXPORT=) -ENDIF (WIN32) + SET(DLLIMPORT "") + SET(DLLEXPORT "") +ENDIF(WIN32) + +ADD_DEFINITIONS("-DCORE_EXPORT=${DLLIMPORT}") +ADD_DEFINITIONS("-DGUI_EXPORT=${DLLIMPORT}") +ADD_DEFINITIONS("-DPYTHON_EXPORT=${DLLIMPORT}") +ADD_DEFINITIONS("-DANALYSIS_EXPORT=${DLLIMPORT}") ############################################################# # user-changeable settings which can be used to customize diff --git a/src/browser/qgsbrowsermodel.cpp b/src/browser/qgsbrowsermodel.cpp old mode 100755 new mode 100644 diff --git a/src/core/qgscredentials.cpp b/src/core/qgscredentials.cpp old mode 100644 new mode 100755 index ceaea633eee..57f60259068 --- a/src/core/qgscredentials.cpp +++ b/src/core/qgscredentials.cpp @@ -25,7 +25,9 @@ QgsCredentials *QgsCredentials::smInstance = 0; void QgsCredentials::setInstance( QgsCredentials *theInstance ) { if ( smInstance ) + { QgsDebugMsg( "already registered an instance of QgsCredentials" ); + } smInstance = theInstance; } diff --git a/src/core/qgsdataitem.cpp b/src/core/qgsdataitem.cpp old mode 100755 new mode 100644 index ced6c049c27..4ee75f7d436 --- a/src/core/qgsdataitem.cpp +++ b/src/core/qgsdataitem.cpp @@ -16,8 +16,6 @@ ***************************************************************************/ /* $Id$ */ -#include - #include #include #include @@ -258,12 +256,12 @@ void QgsDataItem::refresh() bool QgsDataItem::equal( const QgsDataItem *other ) { - if ( typeid ( this ) == typeid ( other ) && - mPath == other->path() ) - { - return true; - } - return false; + if ( metaObject()->className() == other->metaObject()->className() && + mPath == other->path() ) + { + return true; + } + return false; } // --------------------------------------------------------------------- @@ -349,7 +347,7 @@ QgsDirectoryItem::QgsDirectoryItem( QgsDataItem* parent, QString name, QString p QgsDebugMsg( library->fileName() + " has NoDataCapabilities" ); continue; } - QgsDebugMsg( QString ( "%1 dataCapabilities : %2").arg(library->fileName()).arg(dataCapabilities() ) ); + QgsDebugMsg( QString( "%1 dataCapabilities : %2" ).arg( library->fileName() ).arg( dataCapabilities() ) ); mLibraries.append( library ); } else @@ -380,11 +378,11 @@ QVector QgsDirectoryItem::createChildren( ) 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 ) { QString path = dir.absoluteFilePath( name ); - QFileInfo fileInfo ( path ); + QFileInfo fileInfo( path ); foreach( QLibrary *library, mLibraries ) { // we could/should create separate list of providers for each purpose @@ -398,10 +396,10 @@ QVector QgsDirectoryItem::createChildren( ) int capabilities = dataCapabilities(); - if ( !( (fileInfo.isFile() && (capabilities & QgsDataProvider::File)) || - (fileInfo.isDir() && (capabilities & QgsDataProvider::Dir))) ) + if ( !(( fileInfo.isFile() && ( capabilities & QgsDataProvider::File ) ) || + ( fileInfo.isDir() && ( capabilities & QgsDataProvider::Dir ) ) ) ) { - continue; + continue; } dataItem_t * dataItem = ( dataItem_t * ) cast_to_fptr( library->resolve( "dataItem" ) ); diff --git a/src/core/qgsdataitem.h b/src/core/qgsdataitem.h old mode 100755 new mode 100644 diff --git a/src/core/qgspallabeling.cpp b/src/core/qgspallabeling.cpp old mode 100644 new mode 100755 index cab7cf79e75..13f1cfb4df6 --- a/src/core/qgspallabeling.cpp +++ b/src/core/qgspallabeling.cpp @@ -576,9 +576,10 @@ void QgsPalLayerSettings::registerFeature( QgsFeature& f, const QgsRenderContext xPos, yPos, dataDefinedPosition, angle, dataDefinedRotation ) ) 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; } @@ -869,9 +870,10 @@ void QgsPalLabeling::registerDiagramFeature( QgsVectorLayer* layer, QgsFeature& 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; } @@ -961,6 +963,7 @@ void QgsPalLabeling::drawLabeling( QgsRenderContext& context ) } catch ( std::exception& e ) { + Q_UNUSED( e ); QgsDebugMsg( "PAL EXCEPTION :-( " + QString::fromLatin1( e.what() ) ); //mActiveLayers.clear(); // clean up return; diff --git a/src/core/qgssearchstring.cpp b/src/core/qgssearchstring.cpp index 473c423b133..33923870748 100644 --- a/src/core/qgssearchstring.cpp +++ b/src/core/qgssearchstring.cpp @@ -24,7 +24,6 @@ //! global function from parser.y that interfaces parser extern QgsSearchTreeNode* parseSearchString( const QString& str, QString& parserErrorMsg ); - QgsSearchString::QgsSearchString() { mTree = NULL; diff --git a/src/core/qgsvectorlayer.cpp b/src/core/qgsvectorlayer.cpp index b3025ca54a6..7abbbbdfa02 100644 --- a/src/core/qgsvectorlayer.cpp +++ b/src/core/qgsvectorlayer.cpp @@ -778,6 +778,7 @@ void QgsVectorLayer::drawRendererV2( QgsRenderContext& rendererContext, bool lab } 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" ) .arg( fet.typeName() ).arg( cse.what() ) ); } @@ -920,6 +921,7 @@ void QgsVectorLayer::drawRendererV2Levels( QgsRenderContext& rendererContext, bo } 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" ) .arg( fet.typeName() ).arg( cse.what() ) ); } @@ -1106,6 +1108,7 @@ bool QgsVectorLayer::draw( QgsRenderContext& rendererContext ) } catch ( QgsCsException &cse ) { + Q_UNUSED( cse ); QgsDebugMsg( QString( "Failed to transform a point while drawing a feature of type '%1'. Rendering stopped. %2" ) .arg( fet.typeName() ).arg( cse.what() ) ); return false; @@ -1446,7 +1449,9 @@ void QgsVectorLayer::updateExtents() mLayerExtent.setMinimal(); if ( !mDataProvider ) + { QgsDebugMsg( "invoked with null mDataProvider" ); + } if ( mDeletedFeatureIds.isEmpty() && mChangedGeometries.isEmpty() ) { @@ -1739,7 +1744,9 @@ bool QgsVectorLayer::nextFeature( QgsFeature &f ) } if ( !found ) + { QgsDebugMsg( QString( "No attributes for the added feature %1 found" ).arg( f.id() ) ); + } } else { @@ -1841,7 +1848,9 @@ bool QgsVectorLayer::featureAtId( int featureId, QgsFeature& f, bool fetchGeomet } if ( !found ) + { QgsDebugMsg( QString( "No attributes for the added feature %1 found" ).arg( f.id() ) ); + } } else { diff --git a/src/plugins/grass/CMakeLists.txt b/src/plugins/grass/CMakeLists.txt index 2a0bf50fc2f..f5d654ad96c 100644 --- a/src/plugins/grass/CMakeLists.txt +++ b/src/plugins/grass/CMakeLists.txt @@ -15,11 +15,12 @@ SUBDIRS(modules-common ${GRASS_MODULES_DIR} scripts themes) ADD_DEFINITIONS(-DGRASS_BASE=\\\"${GRASS_PREFIX}\\\") ADD_DEFINITIONS(-DHAVE_OPENPTY=${HAVE_OPENPTY}) +ADD_DEFINITIONS("-DGRASS_EXPORT=${DLLIMPORT} -DGRASS_LIB_EXPORT=${DLLIMPORT}") IF (WIN32) - ADD_DEFINITIONS(-DHAVE_GETPT "-DGRASS_EXPORT=__declspec(dllimport)") + ADD_DEFINITIONS(-DHAVE_GETPT) ELSE (WIN32) - ADD_DEFINITIONS(-DHAVE_POSIX_OPENPT -DGRASS_EXPORT=) + ADD_DEFINITIONS(-DHAVE_POSIX_OPENPT) ENDIF (WIN32) ######################################################## @@ -151,6 +152,7 @@ INCLUDE_DIRECTORIES( TARGET_LINK_LIBRARIES(grassplugin qgisgrass qgis_gui + grassprovider ${OPENPTY_LIBRARY} ) diff --git a/src/plugins/grass/qgsgrassplugin.cpp b/src/plugins/grass/qgsgrassplugin.cpp old mode 100644 new mode 100755 index 22bb96e7503..01f0e2b3cbc --- a/src/plugins/grass/qgsgrassplugin.cpp +++ b/src/plugins/grass/qgsgrassplugin.cpp @@ -256,6 +256,7 @@ void QgsGrassPlugin::mapsetChanged() } catch ( QgsGrass::Exception &e ) { + Q_UNUSED( e ); QgsDebugMsg( "Cannot read GRASS CRS : " + QString( e.what() ) ); mCrs = QgsCoordinateReferenceSystem(); } diff --git a/src/plugins/grass/qgsgrassplugin.h b/src/plugins/grass/qgsgrassplugin.h index 255897db829..623845dc8fd 100644 --- a/src/plugins/grass/qgsgrassplugin.h +++ b/src/plugins/grass/qgsgrassplugin.h @@ -41,9 +41,11 @@ class QToolBar; * \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 * QGIS when it attempts to instantiate the plugin. @@ -68,7 +70,7 @@ class QgsGrassPlugin: public QObject, public QgisPlugin */ virtual int type(); //! Destructor - virtual ~ QgsGrassPlugin(); + virtual ~QgsGrassPlugin(); //! Get Region Pen QPen & regionPen( void ); diff --git a/src/plugins/grass/qgsgrassselect.cpp b/src/plugins/grass/qgsgrassselect.cpp index 3372097e7c6..bb93984d7d4 100644 --- a/src/plugins/grass/qgsgrassselect.cpp +++ b/src/plugins/grass/qgsgrassselect.cpp @@ -337,8 +337,8 @@ void QgsGrassSelect::setLayers() return; QStringList layers = QgsGrass::vectorLayers( egisdbase->text(), - elocation->currentText(), emapset->currentText(), - emap->currentText().toUtf8() ); + elocation->currentText(), emapset->currentText(), + emap->currentText().toUtf8() ); int idx = 0; int sel = -1; diff --git a/src/providers/grass/CMakeLists.txt b/src/providers/grass/CMakeLists.txt old mode 100755 new mode 100644 index e9e34c191a9..1088331d3bd --- a/src/providers/grass/CMakeLists.txt +++ b/src/providers/grass/CMakeLists.txt @@ -1,22 +1,9 @@ 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 -INCLUDE_DIRECTORIES ( +INCLUDE_DIRECTORIES( ../../core ../../core/raster ${GRASS_INCLUDE_DIR} @@ -25,18 +12,15 @@ INCLUDE_DIRECTORIES ( ${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}) - -IF (WIN32) - SET_TARGET_PROPERTIES(qgisgrass PROPERTIES COMPILE_FLAGS "\"-DGRASS_EXPORT=__declspec(dllexport)\"" ) -ELSE (WIN32) - SET_TARGET_PROPERTIES(qgisgrass PROPERTIES COMPILE_FLAGS "-DGRASS_EXPORT=" ) -ENDIF (WIN32) - -TARGET_LINK_LIBRARIES (qgisgrass +ADD_LIBRARY(qgisgrass SHARED qgsgrass.cpp) +SET_TARGET_PROPERTIES(qgisgrass PROPERTIES + VERSION ${COMPLETE_VERSION} SOVERSION ${COMPLETE_VERSION} + COMPILE_FLAGS "\"-DGRASS_LIB_EXPORT=${DLLEXPORT}\" \"-DGRASS_EXPORT=${DLLIMPORT}\"" ) +TARGET_LINK_LIBRARIES(qgisgrass qgis_core ${GRASS_LIBRARY_gis} ${GRASS_LIBRARY_vect} @@ -49,43 +33,41 @@ IF (APPLE) SET_TARGET_PROPERTIES(qgisgrass PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE ) ENDIF (APPLE) -ADD_LIBRARY (grassprovider MODULE ${GRASS_PROVIDER_SRCS} ${GRASS_MOC_SRCS}) +# +# GRASS vector provider +# -IF (WIN32) - SET_TARGET_PROPERTIES(grassprovider PROPERTIES COMPILE_FLAGS "\"-DGRASS_EXPORT=__declspec(dllexport)\"" ) -ELSE (WIN32) - SET_TARGET_PROPERTIES(grassprovider PROPERTIES COMPILE_FLAGS "-DGRASS_EXPORT=" ) -ENDIF (WIN32) +QT4_WRAP_CPP(GRASS_PROVIDER_MOC_SRCS qgsgrassprovider.h) +ADD_LIBRARY(grassprovider SHARED qgsgrassprovider.cpp ${GRASS_PROVIDER_MOC_SRCS}) +SET_TARGET_PROPERTIES(grassprovider PROPERTIES COMPILE_FLAGS "\"-DGRASS_EXPORT=${DLLEXPORT}\" \"-DGRASS_LIB_EXPORT=${DLLIMPORT}\"" ) +TARGET_LINK_LIBRARIES(grassprovider qgisgrass) -TARGET_LINK_LIBRARIES (grassprovider - qgisgrass -) +# +# grass raster provider +# -QT4_WRAP_CPP(GRASS_MOC_RASTERSRCS qgsgrassrasterprovider.h) -ADD_LIBRARY (grassrasterprovider MODULE ${GRASS_RASTER_PROVIDER_SRCS} ${GRASS_MOC_RASTERSRCS}) +QT4_WRAP_CPP(GRASS_RASTERPROVIDER_MOC_SRCS qgsgrassrasterprovider.h) +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)\"" ) -ELSE (WIN32) - SET_TARGET_PROPERTIES(grassrasterprovider PROPERTIES COMPILE_FLAGS "-DGRASS_EXPORT=" ) -ENDIF (WIN32) +# +# grass raster display module +# -TARGET_LINK_LIBRARIES (grassrasterprovider - qgisgrass - qgis_core -) - -ADD_EXECUTABLE(qgis.d.rast ${QGIS_D_RAST_SRCS}) - -TARGET_LINK_LIBRARIES (qgis.d.rast +ADD_EXECUTABLE(qgis.d.rast qgis.d.rast.c) +TARGET_LINK_LIBRARIES(qgis.d.rast ${GRASS_LIBRARY_gis} ${GRASS_LIBRARY_datetime} ${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_datetime} ${GRASS_LIBRARY_gproj} diff --git a/src/providers/grass/provider.cpp b/src/providers/grass/provider.cpp deleted file mode 100644 index 32c30ecb6bb..00000000000 --- a/src/providers/grass/provider.cpp +++ /dev/null @@ -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 -#include -#include - -#include -#include - -#include "qgis.h" -#include "qgsdataprovider.h" -#include "qgsfeature.h" -#include "qgsfield.h" -#include "qgsrectangle.h" - -extern "C" -{ -#include -#include -#include -} - -#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; -} diff --git a/src/providers/grass/qgsgrass.cpp b/src/providers/grass/qgsgrass.cpp old mode 100644 new mode 100755 index 252a70284bf..96cb00c6a6a --- a/src/providers/grass/qgsgrass.cpp +++ b/src/providers/grass/qgsgrass.cpp @@ -52,7 +52,7 @@ extern "C" #if defined(WIN32) #include -QString GRASS_EXPORT QgsGrass::shortPath( const QString &path ) +QString GRASS_LIB_EXPORT QgsGrass::shortPath( const QString &path ) { TCHAR 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 -void GRASS_EXPORT QgsGrass::init( void ) +void GRASS_LIB_EXPORT QgsGrass::init( void ) { // Warning!!! // G_set_error_routine() once called from plugin @@ -420,22 +420,22 @@ int QgsGrass::error_routine( const char *msg, int fatal ) return 1; } -void GRASS_EXPORT QgsGrass::resetError( void ) +void GRASS_LIB_EXPORT QgsGrass::resetError( void ) { lastError = OK; } -int GRASS_EXPORT QgsGrass::error( void ) +int GRASS_LIB_EXPORT QgsGrass::error( void ) { return lastError; } -QString GRASS_EXPORT QgsGrass::errorMessage( void ) +QString GRASS_LIB_EXPORT QgsGrass::errorMessage( void ) { 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( "location = %1" ).arg( location.toUtf8().constData() ) ); @@ -659,7 +659,7 @@ QString QgsGrass::closeMapset( ) return NULL; } -QStringList GRASS_EXPORT QgsGrass::locations( QString gisbase ) +QStringList GRASS_LIB_EXPORT QgsGrass::locations( QString gisbase ) { QgsDebugMsg( QString( "gisbase = %1" ).arg( gisbase ) ); @@ -682,7 +682,7 @@ QStringList GRASS_EXPORT QgsGrass::locations( QString gisbase ) 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 ) ); @@ -692,7 +692,7 @@ QStringList GRASS_EXPORT QgsGrass::mapsets( QString gisbase, QString locationNam 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 ) ); @@ -714,7 +714,7 @@ QStringList GRASS_EXPORT QgsGrass::mapsets( QString locationPath ) return list; } -QStringList GRASS_EXPORT QgsGrass::vectors( QString gisbase, QString locationName, +QStringList GRASS_LIB_EXPORT QgsGrass::vectors( QString gisbase, QString locationName, QString mapsetName ) { QgsDebugMsg( "entered." ); @@ -751,7 +751,7 @@ QStringList GRASS_EXPORT QgsGrass::vectors( QString gisbase, QString locationNam 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 ) ); @@ -775,7 +775,7 @@ QStringList GRASS_EXPORT QgsGrass::vectors( QString mapsetPath ) } return list; } -QStringList GRASS_EXPORT QgsGrass::vectorLayers( QString gisdbase, +QStringList GRASS_LIB_EXPORT QgsGrass::vectorLayers( QString gisdbase, QString location, QString mapset, QString mapName ) { QStringList list; @@ -869,7 +869,7 @@ QStringList GRASS_EXPORT QgsGrass::vectorLayers( QString gisdbase, return list; } -QStringList GRASS_EXPORT QgsGrass::rasters( QString gisbase, QString locationName, +QStringList GRASS_LIB_EXPORT QgsGrass::rasters( QString gisbase, QString locationName, QString mapsetName ) { QgsDebugMsg( "entered." ); @@ -907,7 +907,7 @@ QStringList GRASS_EXPORT QgsGrass::rasters( QString gisbase, QString locationNam 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 ) ); @@ -926,7 +926,7 @@ QStringList GRASS_EXPORT QgsGrass::rasters( QString mapsetPath ) 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 ) { if ( gisbase.isEmpty() || locationName.isEmpty() || mapsetName.isEmpty() ) @@ -936,7 +936,7 @@ QStringList GRASS_EXPORT QgsGrass::elements( QString gisbase, QString locationNa 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 ) ); @@ -955,7 +955,7 @@ QStringList GRASS_EXPORT QgsGrass::elements( QString mapsetPath, QString element return list; } -QString GRASS_EXPORT QgsGrass::regionString( struct Cell_head *window ) +QString GRASS_LIB_EXPORT QgsGrass::regionString( struct Cell_head *window ) { QString reg; int fmt; @@ -992,9 +992,9 @@ QString GRASS_EXPORT QgsGrass::regionString( struct Cell_head *window ) return reg; } -bool GRASS_EXPORT QgsGrass::region( QString gisbase, - QString location, QString mapset, - struct Cell_head *window ) +bool GRASS_LIB_EXPORT QgsGrass::region( QString gisbase, + QString location, QString mapset, + struct Cell_head *window ) { QgsGrass::setLocation( gisbase, location ); @@ -1005,7 +1005,7 @@ bool GRASS_EXPORT QgsGrass::region( QString gisbase, return true; } -bool GRASS_EXPORT QgsGrass::writeRegion( QString gisbase, +bool GRASS_LIB_EXPORT QgsGrass::writeRegion( QString gisbase, QString location, QString mapset, struct Cell_head *window ) { @@ -1023,7 +1023,7 @@ bool GRASS_EXPORT QgsGrass::writeRegion( QString gisbase, 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 ) { target->north = source->north; @@ -1034,7 +1034,7 @@ void GRASS_EXPORT QgsGrass::copyRegionExtent( struct Cell_head *source, 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 ) { 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; } -void GRASS_EXPORT QgsGrass::extendRegion( struct Cell_head *source, +void GRASS_LIB_EXPORT QgsGrass::extendRegion( struct Cell_head *source, struct Cell_head *target ) { if ( source->north > target->north ) @@ -1066,9 +1066,9 @@ void GRASS_EXPORT QgsGrass::extendRegion( struct Cell_head *source, target->bottom = source->bottom; } -bool GRASS_EXPORT QgsGrass::mapRegion( int type, QString gisbase, - QString location, QString mapset, QString map, - struct Cell_head *window ) +bool GRASS_LIB_EXPORT QgsGrass::mapRegion( int type, QString gisbase, + QString location, QString mapset, QString map, + struct Cell_head *window ) { QgsDebugMsg( "entered." ); QgsDebugMsg( QString( "map = %1" ).arg( map ) ); @@ -1143,7 +1143,7 @@ bool GRASS_EXPORT QgsGrass::mapRegion( int type, QString gisbase, 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 ) { 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; } -QByteArray GRASS_EXPORT QgsGrass::runModule( QString gisdbase, QString location, +QByteArray GRASS_LIB_EXPORT QgsGrass::runModule( QString gisdbase, QString location, QString module, QStringList arguments ) { 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; } -QString GRASS_EXPORT QgsGrass::getInfo( QString info, QString gisdbase, QString location, - QString mapset, QString map, MapType type, double x, double y ) +QString GRASS_LIB_EXPORT QgsGrass::getInfo( QString info, QString gisdbase, QString location, + QString mapset, QString map, MapType type, double x, double y ) { 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 ); } -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 ) ); QgsCoordinateReferenceSystem crs = QgsCoordinateReferenceSystem(); @@ -1264,7 +1264,7 @@ QgsCoordinateReferenceSystem GRASS_EXPORT QgsGrass::crs( QString gisdbase, QStri return crs; } -QgsCoordinateReferenceSystem GRASS_EXPORT QgsGrass::crsDirect( QString gisdbase, QString location ) +QgsCoordinateReferenceSystem GRASS_LIB_EXPORT QgsGrass::crsDirect( QString gisdbase, QString location ) { QString Wkt; @@ -1305,7 +1305,7 @@ QgsCoordinateReferenceSystem GRASS_EXPORT QgsGrass::crsDirect( QString gisdbase, 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 ) ); @@ -1327,7 +1327,7 @@ QgsRectangle GRASS_EXPORT QgsGrass::extent( QString gisdbase, QString location, 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 ) ); @@ -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 ) ); } -QHash GRASS_EXPORT QgsGrass::info( QString gisdbase, QString location, QString mapset, QString map, MapType type ) +QHash 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 ) ); QHash inf; @@ -1383,7 +1383,7 @@ QHash GRASS_EXPORT QgsGrass::info( QString gisdbase, QString l return inf; } -QList GRASS_EXPORT QgsGrass::colors( QString gisdbase, QString location, QString mapset, QString map ) +QList GRASS_LIB_EXPORT QgsGrass::colors( QString gisdbase, QString location, QString mapset, QString map ) { QgsDebugMsg( QString( "gisdbase = %1 location = %2" ).arg( gisdbase ).arg( location ) ); QList ct; @@ -1413,7 +1413,7 @@ QList GRASS_EXPORT QgsGrass::colors( QString gisdbase, QString return ct; } -QMap GRASS_EXPORT QgsGrass::query( QString gisdbase, QString location, QString mapset, QString map, MapType type, double x, double y ) +QMap 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 ) ); @@ -1440,7 +1440,7 @@ QMap 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 // The following lines workaround this change -int GRASS_EXPORT QgsGrass::versionMajor() +int GRASS_LIB_EXPORT QgsGrass::versionMajor() { #ifdef GRASS_VERSION_MAJOR return GRASS_VERSION_MAJOR; @@ -1449,7 +1449,7 @@ int GRASS_EXPORT QgsGrass::versionMajor() #endif } -int GRASS_EXPORT QgsGrass::versionMinor() +int GRASS_LIB_EXPORT QgsGrass::versionMinor() { #ifdef GRASS_VERSION_MINOR return GRASS_VERSION_MINOR; @@ -1458,7 +1458,7 @@ int GRASS_EXPORT QgsGrass::versionMinor() #endif } -int GRASS_EXPORT QgsGrass::versionRelease() +int GRASS_LIB_EXPORT QgsGrass::versionRelease() { #ifdef GRASS_VERSION_RELEASE #define QUOTE(x) #x @@ -1467,12 +1467,12 @@ int GRASS_EXPORT QgsGrass::versionRelease() return QString( GRASS_VERSION_RELEASE ).toInt(); #endif } -QString GRASS_EXPORT QgsGrass::versionString() +QString GRASS_LIB_EXPORT QgsGrass::versionString() { return QString( GRASS_VERSION_STRING ); } -bool GRASS_EXPORT QgsGrass::isMapset( QString path ) +bool GRASS_LIB_EXPORT QgsGrass::isMapset( QString path ) { #if 0 /* 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; } -QString GRASS_EXPORT QgsGrass::lockFilePath() +QString GRASS_LIB_EXPORT QgsGrass::lockFilePath() { return mMapsetLock; } -QString GRASS_EXPORT QgsGrass::gisrcFilePath() +QString GRASS_LIB_EXPORT QgsGrass::gisrcFilePath() { if ( mGisrc.isEmpty() ) { @@ -1514,7 +1514,7 @@ QString GRASS_EXPORT QgsGrass::gisrcFilePath() 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; /* _Correct_ putenv() implementation is not making copy! */ diff --git a/src/providers/grass/qgsgrass.h b/src/providers/grass/qgsgrass.h index ad34bd293bc..4e6af10f3b9 100644 --- a/src/providers/grass/qgsgrass.h +++ b/src/providers/grass/qgsgrass.h @@ -65,23 +65,23 @@ class QgsGrass * 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. * 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 - 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 - 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 - static GRASS_EXPORT QString getDefaultMapset( void ); + static GRASS_LIB_EXPORT QString getDefaultMapset( void ); //! Init or reset GRASS library /*! \param gisdbase full path to GRASS GISDBASE. \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. @@ -89,7 +89,7 @@ class QgsGrass \param mapset current mupset. Note that some variables depend on mapset and 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() enum GERROR { OK, /*!< OK. No error. */ @@ -100,139 +100,139 @@ class QgsGrass enum MapType { None, Raster, Vector, Region }; //! 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. - static GRASS_EXPORT int error( void ); + static GRASS_LIB_EXPORT int error( void ); //! Get last error message - static GRASS_EXPORT QString errorMessage( void ); + static GRASS_LIB_EXPORT QString errorMessage( void ); /** \brief Open existing GRASS mapset * \return NULL string or error message */ - static GRASS_EXPORT QString openMapset( QString gisdbase, - QString location, QString mapset ); + static GRASS_LIB_EXPORT QString openMapset( QString gisdbase, + QString location, QString mapset ); /** \brief Close mapset if it was opened from QGIS. * Delete GISRC, lock and temporary directory * \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 - static GRASS_EXPORT bool isValidGrassBaseDir( QString const gisBase ); + static GRASS_LIB_EXPORT bool isValidGrassBaseDir( QString const 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 - static GRASS_EXPORT QStringList mapsets( QString gisbase, QString locationName ); - static GRASS_EXPORT QStringList mapsets( QString locationPath ); + static GRASS_LIB_EXPORT QStringList mapsets( QString gisbase, QString locationName ); + static GRASS_LIB_EXPORT QStringList mapsets( QString locationPath ); //! 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 ); - 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 ); - static GRASS_EXPORT QStringList rasters( QString mapsetPath ); + static GRASS_LIB_EXPORT QStringList rasters( QString mapsetPath ); //! 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 - static GRASS_EXPORT QStringList elements( QString gisbase, QString locationName, + static GRASS_LIB_EXPORT QStringList elements( QString gisbase, QString locationName, 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 - static GRASS_EXPORT bool mapRegion( int type, QString gisbase, - QString location, QString mapset, QString map, - struct Cell_head *window ); + static GRASS_LIB_EXPORT bool mapRegion( int type, QString gisbase, + QString location, QString mapset, QString map, + struct Cell_head *window ); // ! 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 - static GRASS_EXPORT bool region( QString gisbase, QString location, QString mapset, - struct Cell_head *window ); + static GRASS_LIB_EXPORT bool region( QString gisbase, QString location, QString mapset, + struct Cell_head *window ); // ! Write current mapset region - static GRASS_EXPORT bool writeRegion( QString gisbase, QString location, QString mapset, - struct Cell_head *window ); + static GRASS_LIB_EXPORT bool writeRegion( QString gisbase, QString location, QString mapset, + struct Cell_head *window ); // ! 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 ); // ! 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 ); // ! Extend region in target to source - static GRASS_EXPORT void extendRegion( struct Cell_head *source, - struct Cell_head *target ); + static GRASS_LIB_EXPORT void extendRegion( struct Cell_head *source, + struct Cell_head *target ); - static GRASS_EXPORT void init( void ); + static GRASS_LIB_EXPORT void init( void ); // ! 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 - static GRASS_EXPORT QString lockFilePath(); + static GRASS_LIB_EXPORT QString lockFilePath(); // ! Get current gisrc path - static GRASS_EXPORT QString gisrcFilePath(); + static GRASS_LIB_EXPORT QString gisrcFilePath(); // ! 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 - 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 - static GRASS_EXPORT QString getInfo( QString info, QString gisdbase, - QString location, QString mapset = "", QString map = "", MapType type = None, double x = 0.0, double y = 0.0 ); + 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 ); // ! 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 - static GRASS_EXPORT QgsCoordinateReferenceSystem crsDirect( QString gisdbase, QString location ); + static GRASS_LIB_EXPORT QgsCoordinateReferenceSystem crsDirect( QString gisdbase, QString location ); // ! 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 ); // ! Get raster map size - static GRASS_EXPORT void size( QString gisdbase, QString location, - QString mapset, QString map, int *cols, int *rows ); + static GRASS_LIB_EXPORT void size( QString gisdbase, QString location, + QString mapset, QString map, int *cols, int *rows ); // ! Get raster info - static GRASS_EXPORT QHash info( QString gisdbase, QString location, + static GRASS_LIB_EXPORT QHash info( QString gisdbase, QString location, QString mapset, QString map, MapType type ); // ! List of Color - static GRASS_EXPORT QList colors( QString gisdbase, QString location, + static GRASS_LIB_EXPORT QList colors( QString gisdbase, QString location, QString mapset, QString map ); // ! Get map value / feautre info - static GRASS_EXPORT QMap query( QString gisdbase, QString location, + static GRASS_LIB_EXPORT QMap query( QString gisdbase, QString location, QString mapset, QString map, MapType type, double x, double y ); //! Library version - static GRASS_EXPORT int versionMajor(); - static GRASS_EXPORT int versionMinor(); - static GRASS_EXPORT int versionRelease(); - static GRASS_EXPORT QString versionString(); + static GRASS_LIB_EXPORT int versionMajor(); + static GRASS_LIB_EXPORT int versionMinor(); + static GRASS_LIB_EXPORT int versionRelease(); + static GRASS_LIB_EXPORT QString versionString(); // 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) - static GRASS_EXPORT QString shortPath( const QString &path ); + static GRASS_LIB_EXPORT QString shortPath( const QString &path ); #endif private: diff --git a/src/providers/grass/qgsgrassprovider.cpp b/src/providers/grass/qgsgrassprovider.cpp index 1add895e966..4c2ea38d11b 100644 --- a/src/providers/grass/qgsgrassprovider.cpp +++ b/src/providers/grass/qgsgrassprovider.cpp @@ -15,6 +15,23 @@ ***************************************************************************/ /* $Id$ */ +#include +#include +#include + +#include +#include + +#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 "qgsgrass.h" @@ -23,8 +40,6 @@ #include "qgsfield.h" #include "qgslogger.h" -#include - #include #include #include @@ -2394,16 +2409,16 @@ QString QgsGrassProvider::description() const } // QgsGrassProvider::description() -QgsGrassLocationItem::QgsGrassLocationItem ( QgsDataItem* parent, QString path ) - : QgsDataCollectionItem ( parent, "", path ) +QgsGrassLocationItem::QgsGrassLocationItem( QgsDataItem* parent, QString path ) + : QgsDataCollectionItem( parent, "", path ) { - QFileInfo fi ( path ); - mName =fi.baseName(); - mIcon = QIcon ( getThemePixmap ( "grass_location.png" ) ); + QFileInfo fi( path ); + mName = fi.baseName(); + mIcon = QIcon( getThemePixmap( "grass_location.png" ) ); } -QgsGrassLocationItem::~QgsGrassLocationItem () {} +QgsGrassLocationItem::~QgsGrassLocationItem() {} -bool QgsGrassLocationItem::isLocation ( QString path ) +bool QgsGrassLocationItem::isLocation( QString path ) { //QgsDebugMsg( "path = " + path ); return QFile::exists( path + QDir::separator() + "PERMANENT" + QDir::separator() + "DEFAULT_WIND" ); @@ -2414,49 +2429,49 @@ QVectorQgsGrassLocationItem::createChildren() QVector mapsets; 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 ) { QString path = dir.absoluteFilePath( name ); - if ( QgsGrassMapsetItem::isMapset ( path ) ) + if ( QgsGrassMapsetItem::isMapset( path ) ) { - QgsGrassMapsetItem * mapset = new QgsGrassMapsetItem ( this, path ); - mapsets.append ( mapset ); + QgsGrassMapsetItem * mapset = new QgsGrassMapsetItem( this, path ); + mapsets.append( mapset ); } } return mapsets; } -QgsGrassMapsetItem::QgsGrassMapsetItem ( QgsDataItem* parent, QString path ) - : QgsDataCollectionItem ( parent, "", path ) +QgsGrassMapsetItem::QgsGrassMapsetItem( QgsDataItem* parent, QString path ) + : QgsDataCollectionItem( parent, "", path ) { - QDir dir( path ); + QDir dir( path ); mName = dir.dirName(); dir.cdUp(); mLocation = dir.dirName(); dir.cdUp(); 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" ); } QVector QgsGrassMapsetItem::createChildren() { - QVector items; - + QVector items; + QStringList vectorNames = QgsGrass::vectors( mPath ); - + foreach( QString name, vectorNames ) - { + { QStringList layerNames = QgsGrass::vectorLayers( mGisdbase , mLocation, mName, name ); QString path = mPath + QDir::separator() + "vector" + QDir::separator() + name; @@ -2466,10 +2481,10 @@ QVector QgsGrassMapsetItem::createChildren() map = new QgsDataCollectionItem( this, name ); 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; - QString typeName = layerName.split("_")[1]; - QString baseLayerName = layerName.split("_")[0]; + QString typeName = layerName.split( "_" )[1]; + QString baseLayerName = layerName.split( "_" )[0]; if ( typeName == "point" ) layerType = QgsLayerItem::Point; @@ -2478,30 +2493,29 @@ QVector QgsGrassMapsetItem::createChildren() else if ( typeName == "polygon" ) layerType = QgsLayerItem::Polygon; - if ( layerNames.size() == 1 ) + if ( layerNames.size() == 1 ) { - - QgsLayerItem *layer = new QgsLayerItem ( this, name + " " + baseLayerName, path, uri, layerType, "grass" ); - items.append( layer ); + QgsLayerItem *layer = new QgsLayerItem( this, name + " " + baseLayerName, path, uri, layerType, "grass" ); + items.append( layer ); } else { - QgsLayerItem *layer = new QgsLayerItem ( map, baseLayerName, path, uri, layerType, "grass" ); - map->addChild( layer ); + QgsLayerItem *layer = new QgsLayerItem( map, baseLayerName, path, uri, layerType, "grass" ); + map->addChild( layer ); } } if ( layerNames.size() != 1 ) items.append( map ); } - + QStringList rasterNames = QgsGrass::rasters( mPath ); - + foreach( QString name, rasterNames ) { 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 ); } @@ -2509,16 +2523,50 @@ QVector QgsGrassMapsetItem::createChildren() return items; } -QGISEXTERN int dataCapabilities () { +QGISEXTERN int dataCapabilities() +{ 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 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; +} diff --git a/src/providers/grass/qgsgrassprovider.h b/src/providers/grass/qgsgrassprovider.h index 55d2e828465..6331c2e3590 100644 --- a/src/providers/grass/qgsgrassprovider.h +++ b/src/providers/grass/qgsgrassprovider.h @@ -689,25 +689,25 @@ class GRASS_EXPORT QgsGrassProvider : public QgsVectorDataProvider class QgsGrassLocationItem : public QgsDataCollectionItem { - public: - QgsGrassLocationItem (QgsDataItem* parent, QString path ); - ~QgsGrassLocationItem(); - - static bool isLocation ( QString path ); - QVector createChildren(); + public: + QgsGrassLocationItem( QgsDataItem* parent, QString path ); + ~QgsGrassLocationItem(); + + static bool isLocation( QString path ); + QVector createChildren(); }; -class QgsGrassMapsetItem : public QgsDataCollectionItem +class QgsGrassMapsetItem : public QgsDataCollectionItem { - public: - QgsGrassMapsetItem (QgsDataItem* parent, QString path ); - ~QgsGrassMapsetItem(); - - static bool isMapset ( QString path ); - QVector createChildren(); - - QString mLocation; - QString mGisdbase; + public: + QgsGrassMapsetItem( QgsDataItem* parent, QString path ); + ~QgsGrassMapsetItem(); + + static bool isMapset( QString path ); + QVector createChildren(); + + QString mLocation; + QString mGisdbase; }; diff --git a/src/providers/ogr/qgsogrprovider.cpp b/src/providers/ogr/qgsogrprovider.cpp index b9f64d75e56..591c85425c8 100644 --- a/src/providers/ogr/qgsogrprovider.cpp +++ b/src/providers/ogr/qgsogrprovider.cpp @@ -521,7 +521,7 @@ bool QgsOgrProvider::nextFeature( QgsFeature& feature ) setRelevantFields( mFetchGeom, mAttributesToFetch ); - while ( ( fet = OGR_L_GetNextFeature( ogrLayer ) ) ) + while (( fet = OGR_L_GetNextFeature( ogrLayer ) ) ) { // skip features without geometry if ( !mFetchFeaturesWithoutGeom && !OGR_F_GetGeometryRef( fet ) ) diff --git a/src/providers/osm/osmprovider.cpp b/src/providers/osm/osmprovider.cpp index b0a21eb35bc..2ad5f93ef33 100644 --- a/src/providers/osm/osmprovider.cpp +++ b/src/providers/osm/osmprovider.cpp @@ -541,11 +541,17 @@ bool QgsOSMDataProvider::nextFeature( QgsFeature& feature ) default: if ( mFeatureType == PointType ) + { QgsDebugMsg( "Getting next feature of type failed." ); + } else if ( mFeatureType == LineType ) + { QgsDebugMsg( "Getting next feature of type failed." ); + } else if ( mFeatureType == PolygonType ) + { QgsDebugMsg( "Getting next feature of type failed." ); + } feature.setValid( false ); return false; } diff --git a/src/providers/sqlanywhere/CMakeLists.txt b/src/providers/sqlanywhere/CMakeLists.txt index f5c7f616d07..9faea8f29a3 100644 --- a/src/providers/sqlanywhere/CMakeLists.txt +++ b/src/providers/sqlanywhere/CMakeLists.txt @@ -3,22 +3,10 @@ SUBDIRS( sqlanyconnection ) -SET (SA_SRCS - qgssqlanywhereprovider.cpp -) -SET (SA_MOC_HDRS - qgssqlanywhereprovider.h -) +SET (SA_SRCS qgssqlanywhereprovider.cpp) +SET (SA_MOC_HDRS qgssqlanywhereprovider.h) -IF (WIN32) - 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) +ADD_DEFINITIONS("-DSACONN_EXPORT=${DLLEXPORT}") ######################################################## # Build diff --git a/tests/src/analysis/CMakeLists.txt b/tests/src/analysis/CMakeLists.txt index c30e72996a8..2e13a36d6d8 100644 --- a/tests/src/analysis/CMakeLists.txt +++ b/tests/src/analysis/CMakeLists.txt @@ -18,26 +18,6 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ############################################################# # 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 # data under tests/testdata in the qgis source tree. # the TEST_DATA_DIR variable is set in the top level CMakeLists.txt diff --git a/tests/src/core/CMakeLists.txt b/tests/src/core/CMakeLists.txt index 426c2dfac71..0c7ebde5928 100644 --- a/tests/src/core/CMakeLists.txt +++ b/tests/src/core/CMakeLists.txt @@ -21,24 +21,6 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ############################################################# # 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 # data under tests/testdata in the qgis source tree. # the TEST_DATA_DIR variable is set in the top level CMakeLists.txt diff --git a/tests/src/gui/CMakeLists.txt b/tests/src/gui/CMakeLists.txt index 18fd5c7a247..2c0b3f58677 100644 --- a/tests/src/gui/CMakeLists.txt +++ b/tests/src/gui/CMakeLists.txt @@ -20,24 +20,6 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ############################################################# # 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 # data under tests/testdata in the qgis source tree. # the TEST_DATA_DIR variable is set in the top level CMakeLists.txt