[qgis] 01/12: New upstream version 2.14.21+dfsg

Bas Couwenberg sebastic at debian.org
Sat Dec 9 01:53:27 UTC 2017


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch experimental
in repository qgis.

commit 677e09a1b00890581c57032d23875af964ff28df
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Fri Dec 8 22:40:56 2017 +0100

    New upstream version 2.14.21+dfsg
---
 CMakeLists.txt              |  2 +-
 ChangeLog                   | 12 +++++++
 debian/changelog            | 10 ++++--
 src/server/qgswmsserver.cpp | 85 +++++++++++++++++++++++++++++++++------------
 4 files changed, 83 insertions(+), 26 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 791fa33..7e136f0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
 SET(CPACK_PACKAGE_VERSION_MAJOR "2")
 SET(CPACK_PACKAGE_VERSION_MINOR "14")
-SET(CPACK_PACKAGE_VERSION_PATCH "20")
+SET(CPACK_PACKAGE_VERSION_PATCH "21")
 SET(COMPLETE_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
 SET(RELEASE_NAME "Essen")
 IF (POLICY CMP0048) # in CMake 3.0.0+
diff --git a/ChangeLog b/ChangeLog
index 0e87783..7dbcfac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+rldhont <rldhont at gmail.com>	2017-11-06
+
+    [Server] GetFeatureInfo: enhance raster data values displayed
+
+rldhont <rldhont at gmail.com>	2017-11-03
+
+    [BUGFIX][Server] GetFeaturInfo: do not identify raster data if point not contains
+
+Juergen E. Fischer <jef at norbit.de>	2017-10-27
+
+    Release of 2.14.20
+
 Juergen E. Fischer <jef at norbit.de>	2017-08-22
 
     bring back sip workaround, but only for the affected versions (followup 7e4345a9d)
diff --git a/debian/changelog b/debian/changelog
index 836db5b..63a9f40 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,14 @@
-qgis (2.14.20) UNRELEASED; urgency=medium
+qgis (2.14.21) UNRELEASED; urgency=medium
+
+  * Release of 2.14.21
+
+ -- Jürgen E. Fischer <jef at norbit.de>  Fri, 08 Dec 2017 14:00:15 +0100
+
+qgis (2.14.20) unstable; urgency=medium
 
   * Release of 2.14.20
 
- -- Jürgen E. Fischer <jef at norbit.de>  Fri, 27 Oct 2017 14:00:19 +0200
+ -- Jürgen E. Fischer <jef at norbit.de>  Fri, 08 Dec 2017 14:00:15 +0100
 
 qgis (2.14.19) unstable; urgency=medium
 
diff --git a/src/server/qgswmsserver.cpp b/src/server/qgswmsserver.cpp
index f0ba8df..6698d92 100644
--- a/src/server/qgswmsserver.cpp
+++ b/src/server/qgswmsserver.cpp
@@ -1825,26 +1825,26 @@ int QgsWMSServer::getFeatureInfo( QDomDocument& result, const QString& version )
       }
       else //raster layer
       {
+        QgsRasterLayer* rasterLayer = qobject_cast<QgsRasterLayer*>( currentLayer );
+        if ( !rasterLayer )
+        {
+          continue;
+        }
+        if ( !infoPoint.data() )
+        {
+          continue;
+        }
+        QgsPoint layerInfoPoint = mMapRenderer->mapToLayerCoordinates( currentLayer, *( infoPoint.data() ) );
+        if ( !rasterLayer->extent().contains( layerInfoPoint ) )
+        {
+          continue;
+        }
         if ( infoFormat.startsWith( "application/vnd.ogc.gml" ) )
         {
           layerElement = result.createElement( "gml:featureMember"/*wfs:FeatureMember*/ );
           getFeatureInfoElement.appendChild( layerElement );
         }
-
-        QgsRasterLayer* rasterLayer = qobject_cast<QgsRasterLayer*>( currentLayer );
-        if ( rasterLayer )
-        {
-          if ( !infoPoint.data() )
-          {
-            continue;
-          }
-          QgsPoint layerInfoPoint = mMapRenderer->mapToLayerCoordinates( currentLayer, *( infoPoint.data() ) );
-          if ( featureInfoFromRasterLayer( rasterLayer, &layerInfoPoint, result, layerElement, version, infoFormat ) != 0 )
-          {
-            continue;
-          }
-        }
-        else
+        if ( featureInfoFromRasterLayer( rasterLayer, &layerInfoPoint, result, layerElement, version, infoFormat ) != 0 )
         {
           continue;
         }
@@ -2551,17 +2551,36 @@ int QgsWMSServer::featureInfoFromRasterLayer( QgsRasterLayer* layer,
   if ( !identifyResult.isValid() )
     return 1;
 
-  QMap<int, QVariant> attributes = identifyResult.results();
+  QMap<int, QVariant> values = identifyResult.results();
   if ( infoFormat == "application/vnd.ogc.gml" )
   {
     QgsFeature feature;
     QgsFields fields;
-    feature.initAttributes( attributes.count() );
+    feature.initAttributes( values.count() );
     int index = 0;
-    for ( QMap<int, QVariant>::const_iterator it = attributes.constBegin(); it != attributes.constEnd(); ++it )
+    Q_FOREACH ( int bandNo, values.keys() )
     {
-      fields.append( QgsField( layer->bandName( it.key() ), QVariant::Double ) );
-      feature.setAttribute( index++, QString::number( it.value().toDouble() ) );
+      if ( values.value( bandNo ).isNull() )
+      {
+        fields.append( QgsField( layer->bandName( bandNo ), QVariant::String ) );
+        feature.setAttribute( index++, "no data" );
+      }
+      else
+      {
+        QVariant value( values.value( bandNo ) );
+        fields.append( QgsField( layer->bandName( bandNo ), QVariant::Double ) );
+        // The cast is legit. Quoting QT doc :
+        // "Although this function is declared as returning QVariant::Type,
+        // the return value should be interpreted as QMetaType::Type"
+        if ( static_cast<QMetaType::Type>( value.type() ) == QMetaType::Float )
+        {
+          feature.setAttribute( index++, QString::number( value.toFloat() ) );
+        }
+        else
+        {
+          feature.setAttribute( index++, QString::number( value.toDouble() ) );
+        }
+      }
     }
     feature.setFields( fields );
 
@@ -2578,11 +2597,31 @@ int QgsWMSServer::featureInfoFromRasterLayer( QgsRasterLayer* layer,
   }
   else
   {
-    for ( QMap<int, QVariant>::const_iterator it = attributes.constBegin(); it != attributes.constEnd(); ++it )
+    Q_FOREACH ( int bandNo, values.keys() )
     {
+      QString valueString;
+      if ( values.value( bandNo ).isNull() )
+      {
+        valueString = "no data";
+      }
+      else
+      {
+        QVariant value( values.value( bandNo ) );
+        // The cast is legit. Quoting QT doc :
+        // "Although this function is declared as returning QVariant::Type,
+        // the return value should be interpreted as QMetaType::Type"
+        if ( static_cast<QMetaType::Type>( value.type() ) == QMetaType::Float )
+        {
+          valueString = QgsRasterBlock::printValue( value.toFloat() );
+        }
+        else
+        {
+          valueString = QgsRasterBlock::printValue( value.toDouble() );
+        }
+      }
       QDomElement attributeElement = infoDocument.createElement( "Attribute" );
-      attributeElement.setAttribute( "name", layer->bandName( it.key() ) );
-      attributeElement.setAttribute( "value", QString::number( it.value().toDouble() ) );
+      attributeElement.setAttribute( "name", layer->bandName( bandNo ) );
+      attributeElement.setAttribute( "value", valueString );
       layerElement.appendChild( attributeElement );
     }
   }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/qgis.git



More information about the Pkg-grass-devel mailing list