From cab8c4f8108ad239ef0affa2a3fb6054993bc743 Mon Sep 17 00:00:00 2001 From: dakcarto Date: Tue, 10 Apr 2012 13:51:55 -0600 Subject: [PATCH 01/11] Fix for source or build directory paths that contain spaces. --- mac/cmake/0qgis.cmake.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mac/cmake/0qgis.cmake.in b/mac/cmake/0qgis.cmake.in index c7717507b863..855d357bf500 100644 --- a/mac/cmake/0qgis.cmake.in +++ b/mac/cmake/0qgis.cmake.in @@ -6,8 +6,8 @@ # kill boolean warnings CMAKE_POLICY (SET CMP0012 NEW) -INCLUDE (@CMAKE_BINARY_DIR@/mac/0vars.cmake) -INCLUDE (@CMAKE_SOURCE_DIR@/cmake/MacBundleMacros.cmake) +INCLUDE ("@CMAKE_BINARY_DIR@/mac/0vars.cmake") +INCLUDE ("@CMAKE_SOURCE_DIR@/cmake/MacBundleMacros.cmake") # assume all install_names start with CMAKE_INSTALL_NAME_DIR # so we don't have to extract it from binaries From b0abc52017864fc78a54704c76c4ab137e13a772 Mon Sep 17 00:00:00 2001 From: dakcarto Date: Tue, 10 Apr 2012 13:52:25 -0600 Subject: [PATCH 02/11] Fix for source or build directory paths that contain spaces. --- mac/cmake/1osg.cmake.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mac/cmake/1osg.cmake.in b/mac/cmake/1osg.cmake.in index 0790fad37f06..30d74e276fef 100644 --- a/mac/cmake/1osg.cmake.in +++ b/mac/cmake/1osg.cmake.in @@ -8,8 +8,8 @@ CMAKE_POLICY (SET CMP0012 NEW) IF (@OSGEARTH_FOUND@) -INCLUDE (@CMAKE_BINARY_DIR@/mac/0vars.cmake) -INCLUDE (@CMAKE_SOURCE_DIR@/cmake/MacBundleMacros.cmake) +INCLUDE ("@CMAKE_BINARY_DIR@/mac/0vars.cmake") +INCLUDE ("@CMAKE_SOURCE_DIR@/cmake/MacBundleMacros.cmake") SET (OSG_PLUGINS_PATH "@OSG_PLUGINS_PATH@") From 1a6d760928d4b514d86d4fc028e5c9716d3dd5c5 Mon Sep 17 00:00:00 2001 From: dakcarto Date: Tue, 10 Apr 2012 13:52:57 -0600 Subject: [PATCH 03/11] Fix for source or build directory paths that contain spaces. --- mac/cmake/1qt.cmake.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mac/cmake/1qt.cmake.in b/mac/cmake/1qt.cmake.in index 7ac27319dfe8..5b28e1f77c7a 100644 --- a/mac/cmake/1qt.cmake.in +++ b/mac/cmake/1qt.cmake.in @@ -6,8 +6,8 @@ # kill boolean warnings CMAKE_POLICY (SET CMP0012 NEW) -INCLUDE (@CMAKE_BINARY_DIR@/mac/0vars.cmake) -INCLUDE (@CMAKE_SOURCE_DIR@/cmake/MacBundleMacros.cmake) +INCLUDE ("@CMAKE_BINARY_DIR@/mac/0vars.cmake") +INCLUDE ("@CMAKE_SOURCE_DIR@/cmake/MacBundleMacros.cmake") # Qt framework version is major version SET (QT_FWVER @QT_VERSION_MAJOR@) From 7094da945dfbd4ed7c5c8e7e7297f7732e41f0b3 Mon Sep 17 00:00:00 2001 From: dakcarto Date: Tue, 10 Apr 2012 13:53:22 -0600 Subject: [PATCH 04/11] Fix for source or build directory paths that contain spaces. --- mac/cmake/2lib.cmake.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mac/cmake/2lib.cmake.in b/mac/cmake/2lib.cmake.in index 7aad7e016333..79ceaf95c693 100644 --- a/mac/cmake/2lib.cmake.in +++ b/mac/cmake/2lib.cmake.in @@ -10,8 +10,8 @@ # kill boolean warnings CMAKE_POLICY (SET CMP0012 NEW) -INCLUDE (@CMAKE_BINARY_DIR@/mac/0vars.cmake) -INCLUDE (@CMAKE_SOURCE_DIR@/cmake/MacBundleMacros.cmake) +INCLUDE ("@CMAKE_BINARY_DIR@/mac/0vars.cmake") +INCLUDE ("@CMAKE_SOURCE_DIR@/cmake/MacBundleMacros.cmake") # Postgres From 27fe00467aedb1c8d1885c2af9e46630775dc518 Mon Sep 17 00:00:00 2001 From: dakcarto Date: Tue, 10 Apr 2012 13:53:45 -0600 Subject: [PATCH 05/11] Fix for source or build directory paths that contain spaces. --- mac/cmake/3fw.cmake.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mac/cmake/3fw.cmake.in b/mac/cmake/3fw.cmake.in index 98b1f2cbb0cb..bf91c46d9cf1 100644 --- a/mac/cmake/3fw.cmake.in +++ b/mac/cmake/3fw.cmake.in @@ -8,8 +8,8 @@ MESSAGE (STATUS "Bundling other frameworks is not functional yet, skipping...") # kill boolean warnings CMAKE_POLICY (SET CMP0012 NEW) -INCLUDE (@CMAKE_BINARY_DIR@/mac/0vars.cmake) -INCLUDE (@CMAKE_SOURCE_DIR@/cmake/MacBundleMacros.cmake) +INCLUDE ("@CMAKE_BINARY_DIR@/mac/0vars.cmake") +INCLUDE ("@CMAKE_SOURCE_DIR@/cmake/MacBundleMacros.cmake") # From b8953c95b655ca0f36f682757f61b1bf8ed19b47 Mon Sep 17 00:00:00 2001 From: Marco Bernasocchi Date: Fri, 13 Apr 2012 14:53:21 +0200 Subject: [PATCH 06/11] remove qsplashscreen on android --- src/app/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app/main.cpp b/src/app/main.cpp index 5e8ff2307113..37e4c8d07263 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -241,6 +241,11 @@ int main( int argc, char *argv[] ) int mySnapshotHeight = 600; bool myHideSplash = false; +#if defined(ANDROID) + QgsDebugMsg( QString( "Android: Splash hidden" ) ); + myHideSplash = true; +#endif + bool myRestorePlugins = true; bool myCustomization = true; From 93f7d9ae70e6bba015aebce62f104735e4c27164 Mon Sep 17 00:00:00 2001 From: Jaka Kranjc Date: Fri, 13 Apr 2012 16:53:20 +0200 Subject: [PATCH 07/11] fixed two SIP warnings about deprecated syntax --- python/analysis/analysis.sip | 2 +- python/core/core.sip | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python/analysis/analysis.sip b/python/analysis/analysis.sip index eb4b42016d9d..5707c22ac468 100644 --- a/python/analysis/analysis.sip +++ b/python/analysis/analysis.sip @@ -1,4 +1,4 @@ -%Module qgis.analysis 0 +%Module(name=qgis.analysis, version=0) %Import QtCore/QtCoremod.sip %Import QtGui/QtGuimod.sip diff --git a/python/core/core.sip b/python/core/core.sip index 4ef76583a141..48834ff5f901 100644 --- a/python/core/core.sip +++ b/python/core/core.sip @@ -1,4 +1,4 @@ -%Module qgis.core 0 +%Module(name=qgis.core, version=0) %Import QtCore/QtCoremod.sip %Import QtGui/QtGuimod.sip From 7f295723fd9dcba5e42e690d63bf2d4b8cf84d66 Mon Sep 17 00:00:00 2001 From: Marco Hugentobler Date: Fri, 13 Apr 2012 17:15:20 +0200 Subject: [PATCH 08/11] SCALE parameter for GetLegendGraphic --- src/mapserver/qgswmsserver.cpp | 34 +++++++++++++++++++++++++++++----- src/mapserver/qgswmsserver.h | 5 +++-- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/mapserver/qgswmsserver.cpp b/src/mapserver/qgswmsserver.cpp index 5c552975971f..ec731a16018d 100644 --- a/src/mapserver/qgswmsserver.cpp +++ b/src/mapserver/qgswmsserver.cpp @@ -297,8 +297,26 @@ QImage* QgsWMSServer::getLegendGraphics() return 0; } + //scale + double scaleDenominator = -1; + QMap::const_iterator scaleIt = mParameterMap.find( "SCALE" ); + if ( scaleIt != mParameterMap.constEnd() ) + { + bool conversionSuccess; + double scaleValue = scaleIt.value().toDouble( &conversionSuccess ); + if ( conversionSuccess ) + { + scaleDenominator = scaleValue; + } + } + QgsCoordinateReferenceSystem dummyCRS; - QStringList layerIds = layerSet( layersList, stylesList, dummyCRS ); + QStringList layerIds = layerSet( layersList, stylesList, dummyCRS, scaleDenominator ); + if ( layerIds.size() < 1 ) + { + return 0; + } + QgsLegendModel legendModel; legendModel.setLayerSet( layerIds ); @@ -1394,7 +1412,7 @@ int QgsWMSServer::featureInfoFromRasterLayer( QgsRasterLayer* layer, QStringList QgsWMSServer::layerSet( const QStringList &layersList, const QStringList &stylesList, - const QgsCoordinateReferenceSystem &destCRS ) const + const QgsCoordinateReferenceSystem &destCRS, double scaleDenominator ) const { Q_UNUSED( destCRS ); QStringList layerKeys; @@ -1430,9 +1448,15 @@ QStringList QgsWMSServer::layerSet( const QStringList &layersList, QgsDebugMsg( QString( "Checking layer: %1" ).arg( theMapLayer->name() ) ); if ( theMapLayer ) { - layerKeys.push_front( theMapLayer->id() ); - QgsMapLayerRegistry::instance()->addMapLayers( - QList() << theMapLayer, false ); + //test if layer is visible in requested scale + bool useScaleConstraint = ( scaleDenominator > 0 && theMapLayer->hasScaleBasedVisibility() ); + if ( !useScaleConstraint || + ( theMapLayer->minimumScale() <= scaleDenominator && theMapLayer->maximumScale() >= scaleDenominator ) ) + { + layerKeys.push_front( theMapLayer->id() ); + QgsMapLayerRegistry::instance()->addMapLayers( + QList() << theMapLayer, false ); + } } else { diff --git a/src/mapserver/qgswmsserver.h b/src/mapserver/qgswmsserver.h index a87cd2f2bcb7..6942ca1cef11 100644 --- a/src/mapserver/qgswmsserver.h +++ b/src/mapserver/qgswmsserver.h @@ -119,8 +119,9 @@ class QgsWMSServer /**Appends feature info xml for the layer to the layer element of the dom document*/ int featureInfoFromRasterLayer( QgsRasterLayer* layer, const QgsPoint* infoPoint, QDomDocument& infoDocument, QDomElement& layerElement, QString version ) const; - /**Creates a layer set and returns a stringlist with layer ids that can be passed to a QgsMapRenderer. Usually used in conjunction with readLayersAndStyles*/ - QStringList layerSet( const QStringList& layersList, const QStringList& stylesList, const QgsCoordinateReferenceSystem& destCRS ) const; + /**Creates a layer set and returns a stringlist with layer ids that can be passed to a QgsMapRenderer. Usually used in conjunction with readLayersAndStyles + @param scaleDenominator Filter out layer if scale based visibility does not match (or use -1 if no scale restriction)*/ + QStringList layerSet( const QStringList& layersList, const QStringList& stylesList, const QgsCoordinateReferenceSystem& destCRS, double scaleDenominator = -1 ) const; //helper functions for GetLegendGraphics /**Draws layer item and subitems From 15f14856b11c2c64e1577125fd9ca9d3b760c947 Mon Sep 17 00:00:00 2001 From: Jaka Kranjc Date: Fri, 13 Apr 2012 17:21:21 +0200 Subject: [PATCH 09/11] addVectorLayers: return early if no layers were succesfully added fixes an abort later on if all the layer loadings failed for some reason, like missing the shx file for a shapefile. --- src/app/qgisapp.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp index 710603715f7d..ee43f59fc76b 100644 --- a/src/app/qgisapp.cpp +++ b/src/app/qgisapp.cpp @@ -2286,12 +2286,16 @@ bool QgisApp::addVectorLayers( QStringList const & theLayerQStringList, const QS // since the layer is bad, stomp on it delete layer; - - // XXX should we return false here, or just grind through - // XXX the remaining arguments? } } + + // make sure at least one layer was succesfully added + if ( myList.count() == 0 ) + { + return false; + } + // Register this layer with the layers registry QgsMapLayerRegistry::instance()->addMapLayers( myList ); From 751222bc4e922fa3bd4cfb6c8926c13d99466348 Mon Sep 17 00:00:00 2001 From: Marco Bernasocchi Date: Fri, 13 Apr 2012 17:31:25 +0200 Subject: [PATCH 10/11] remove the touch button if HAVE_TOUCH=0 --- src/app/qgisapp.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp index 710603715f7d..aa110d081325 100644 --- a/src/app/qgisapp.cpp +++ b/src/app/qgisapp.cpp @@ -645,6 +645,9 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent, #ifdef HAVE_TOUCH //add reacting to long click in android grabGesture( Qt::TapAndHoldGesture ); +#else + //remove mActionTouch button + delete mActionTouch; #endif // update windows @@ -2785,6 +2788,7 @@ void QgisApp::fileNew( bool thePromptToSaveFlag ) // set the initial map tool mMapCanvas->setMapTool( mMapTools.mPan ); mNonEditMapTool = mMapTools.mPan; // signals are not yet setup to catch this + #ifdef HAVE_TOUCH mMapCanvas->setMapTool( mMapTools.mTouch ); mNonEditMapTool = mMapTools.mTouch; // signals are not yet setup to catch this From 5310b5bed0d3db4b3747ebd7616b241a10be58d0 Mon Sep 17 00:00:00 2001 From: Marco Bernasocchi Date: Fri, 13 Apr 2012 17:40:11 +0200 Subject: [PATCH 11/11] added null pointer protection --- src/app/qgisapp.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp index aa110d081325..a999970e1481 100644 --- a/src/app/qgisapp.cpp +++ b/src/app/qgisapp.cpp @@ -648,6 +648,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent, #else //remove mActionTouch button delete mActionTouch; + mActionTouch=0; #endif // update windows