[qgis] 01/07: Add patch from upstream release_2.2 branch: 0001-9655-fix-invalid-simplified-geometries.patch

Bas Couwenberg sebastic at xs4all.nl
Fri Mar 14 01:05:21 UTC 2014


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

sebastic-guest pushed a commit to branch master
in repository qgis.

commit c046654a84fda1c1295246b827c9e3b712b32e02
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Thu Mar 13 21:36:10 2014 +0100

    Add patch from upstream release_2.2 branch: 0001-9655-fix-invalid-simplified-geometries.patch
---
 ...01-9655-fix-invalid-simplified-geometries.patch | 59 ++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/debian/patches/0001-9655-fix-invalid-simplified-geometries.patch b/debian/patches/0001-9655-fix-invalid-simplified-geometries.patch
new file mode 100644
index 0000000..f1d8b3c
--- /dev/null
+++ b/debian/patches/0001-9655-fix-invalid-simplified-geometries.patch
@@ -0,0 +1,59 @@
+From 1f21273accba005fa651b3bff027929e9fcacabb Mon Sep 17 00:00:00 2001
+From: ahuarte47 <ahuarte47 at yahoo.es>
+Date: Thu, 27 Feb 2014 00:18:00 +0100
+Subject: #9655: fix invalid simplified geometries
+Origin: https://github.com/qgis/QGIS/commit/1f21273accba005fa651b3bff027929e9fcacabb
+Bug: http://hub.qgis.org/issues/9655
+
+---
+ src/core/qgsmaptopixelgeometrysimplifier.cpp |   21 +++++++++++++++++++++
+ 1 file changed, 21 insertions(+)
+
+--- a/src/core/qgsmaptopixelgeometrysimplifier.cpp
++++ b/src/core/qgsmaptopixelgeometrysimplifier.cpp
+@@ -147,6 +147,11 @@ bool QgsMapToPixelSimplifier::simplifyWk
+   bool hasZValue = QGis::wkbDimensions( wkbType ) == 3;
+   bool result = false;
+ 
++  // Save initial WKB settings to use when the simplification creates invalid geometries
++  unsigned char* sourcePrevWkb = sourceWkb;
++  unsigned char* targetPrevWkb = targetWkb;
++  size_t targetWkbPrevSize = targetWkbSize;
++
+   // Can replace the geometry by its BBOX ?
+   if (( simplifyFlags & QgsMapToPixelSimplifier::SimplifyEnvelope ) && ( envelope.xMaximum() - envelope.xMinimum() ) < map2pixelTol && ( envelope.yMaximum() - envelope.yMinimum() ) < map2pixelTol )
+   {
+@@ -181,6 +186,11 @@ bool QgsMapToPixelSimplifier::simplifyWk
+   {
+     double x, y, lastX = 0, lastY = 0;
+ 
++    double xmin =  std::numeric_limits<double>::max();
++    double ymin =  std::numeric_limits<double>::max();
++    double xmax = -std::numeric_limits<double>::max();
++    double ymax = -std::numeric_limits<double>::max();
++
+     int sizeOfDoubleX = sizeof( double );
+     int sizeOfDoubleY = QGis::wkbDimensions( wkbType ) == 3 /*hasZValue*/ ? 2 * sizeof( double ) : sizeof( double );
+ 
+@@ -209,10 +219,21 @@ bool QgsMapToPixelSimplifier::simplifyWk
+         memcpy( ptr, &y, sizeof( double ) ); lastY = y; ptr++;
+         numTargetPoints++;
+       }
++      if ( xmin > x ) xmin = x;
++      if ( ymin > y ) ymin = y;
++      if ( xmax < x ) xmax = x;
++      if ( ymax < y ) ymax = y;
+     }
+     targetWkb = wkb2 + 4;
+ 
+     // Fix the topology of the geometry
++    if ( numTargetPoints <= ( isaLinearRing ? 2 : 1 ) )
++    {
++      sourceWkb = sourcePrevWkb;
++      targetWkb = targetPrevWkb;
++      targetWkbSize = targetWkbPrevSize;
++      return generalizeWkbGeometry( wkbType, sourceWkb, sourceWkbSize, targetWkb, targetWkbSize, QgsRectangle( xmin, ymin, xmax, ymax ), writeHeader );
++    }
+     if ( isaLinearRing )
+     {
+       memcpy( &x, targetWkb + 0, sizeof( double ) );

-- 
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