[qgis] 12/14: Add patch from upstream release_2.2 branch: 0001-Ensure-draw-line-only-inside-polygon-works-correctly.patch

Bas Couwenberg sebastic at xs4all.nl
Sat Mar 1 17:25:08 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 741a37dba30d58514a3befce257b89daafb2aca7
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Sat Mar 1 14:41:13 2014 +0100

    Add patch from upstream release_2.2 branch: 0001-Ensure-draw-line-only-inside-polygon-works-correctly.patch
---
 ...-line-only-inside-polygon-works-correctly.patch | 108 +++++++++++++++++++++
 1 file changed, 108 insertions(+)

diff --git a/debian/patches/0001-Ensure-draw-line-only-inside-polygon-works-correctly.patch b/debian/patches/0001-Ensure-draw-line-only-inside-polygon-works-correctly.patch
new file mode 100644
index 0000000..c2c4b49
--- /dev/null
+++ b/debian/patches/0001-Ensure-draw-line-only-inside-polygon-works-correctly.patch
@@ -0,0 +1,108 @@
+From df7f207ca87dacff50eb5f7d74980032c07b80d8 Mon Sep 17 00:00:00 2001
+From: Nyall Dawson <nyall.dawson at gmail.com>
+Date: Sat, 1 Mar 2014 21:50:58 +1100
+Subject: Ensure draw line only inside polygon works correctly with
+ multipolygon rings (fix #9624)
+Bug: http://hub.qgis.org/issues/9624
+Origin: https://github.com/qgis/QGIS/commit/df7f207ca87dacff50eb5f7d74980032c07b80d8
+
+---
+ src/core/symbology-ng/qgslinesymbollayerv2.cpp |   60 ++++++++++++++++++------
+ src/core/symbology-ng/qgslinesymbollayerv2.h   |    3 ++
+ 2 files changed, 48 insertions(+), 15 deletions(-)
+
+--- a/src/core/symbology-ng/qgslinesymbollayerv2.cpp
++++ b/src/core/symbology-ng/qgslinesymbollayerv2.cpp
+@@ -174,6 +174,51 @@ void QgsSimpleLineSymbolLayerV2::stopRen
+   Q_UNUSED( context );
+ }
+ 
++void QgsSimpleLineSymbolLayerV2::renderPolygonOutline( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context )
++{
++  QPainter* p = context.renderContext().painter();
++  if ( !p )
++  {
++    return;
++  }
++
++  if ( mDrawInsidePolygon )
++  {
++    //only drawing the line on the interior of the polygon, so set clip path for painter
++    p->save();
++    QPainterPath clipPath;
++    clipPath.addPolygon( points );
++
++    if ( rings != NULL )
++    {
++      //add polygon rings
++      QList<QPolygonF>::const_iterator it = rings->constBegin();
++      for ( ; it != rings->constEnd(); ++it )
++      {
++        QPolygonF ring = *it;
++        clipPath.addPolygon( ring );
++      }
++    }
++
++    //use intersect mode, as a clip path may already exist (eg, for composer maps)
++    p->setClipPath( clipPath, Qt::IntersectClip );
++  }
++
++  renderPolyline( points, context );
++  if ( rings )
++  {
++    foreach ( const QPolygonF& ring, *rings )
++      renderPolyline( ring, context );
++  }
++
++  if ( mDrawInsidePolygon )
++  {
++    //restore painter to reset clip path
++    p->restore();
++  }
++
++}
++
+ void QgsSimpleLineSymbolLayerV2::renderPolyline( const QPolygonF& points, QgsSymbolV2RenderContext& context )
+ {
+   QPainter* p = context.renderContext().painter();
+@@ -196,15 +241,6 @@ void QgsSimpleLineSymbolLayerV2::renderP
+     return;
+   }
+ 
+-  if ( mDrawInsidePolygon )
+-  {
+-    //only drawing the line on the interior of the polygon, so set clip path for painter
+-    p->save();
+-    QPainterPath clipPath;
+-    clipPath.addPolygon( points );
+-    p->setClipPath( clipPath, Qt::IntersectClip );
+-  }
+-
+   if ( offset == 0 )
+   {
+     p->drawPolyline( points );
+@@ -214,12 +250,6 @@ void QgsSimpleLineSymbolLayerV2::renderP
+     double scaledOffset = offset * QgsSymbolLayerV2Utils::lineWidthScaleFactor( context.renderContext(), mOffsetUnit );
+     p->drawPolyline( ::offsetLine( points, scaledOffset ) );
+   }
+-
+-  if ( mDrawInsidePolygon )
+-  {
+-    //restore painter to reset clip path
+-    p->restore();
+-  }
+ }
+ 
+ QgsStringMap QgsSimpleLineSymbolLayerV2::properties() const
+--- a/src/core/symbology-ng/qgslinesymbollayerv2.h
++++ b/src/core/symbology-ng/qgslinesymbollayerv2.h
+@@ -52,6 +52,9 @@ class CORE_EXPORT QgsSimpleLineSymbolLay
+ 
+     void renderPolyline( const QPolygonF& points, QgsSymbolV2RenderContext& context );
+ 
++    //overriden so that clip path can be set when using draw inside polygon option
++    void renderPolygonOutline( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context );
++
+     QgsStringMap properties() const;
+ 
+     QgsSymbolLayerV2* clone() const;

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