Skip to content

Commit

Permalink
#9686: fix simplification of no-closed polygons
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuarte47 authored and m-kuhn committed Mar 10, 2014
1 parent fc6cd54 commit 60e1a9b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/core/qgsmaptopixelgeometrysimplifier.cpp
Expand Up @@ -207,6 +207,24 @@ bool QgsMapToPixelSimplifier::simplifyWkbGeometry( int simplifyFlags, QGis::WkbT
double* ptr = ( double* )targetWkb;
map2pixelTol *= map2pixelTol; //-> Use mappixelTol for 'LengthSquare' calculations.

// Check whether the LinearRing is really closed.

This comment has been minimized.

Copy link
@ahuarte47

ahuarte47 Mar 10, 2014

Author Contributor

Hi @m-kuhn, it is possible merge this code in current 2.2 branch ?

This comment has been minimized.

Copy link
@m-kuhn

m-kuhn Mar 11, 2014

Member

Done
c0cbfac

This comment has been minimized.

Copy link
@ahuarte47

ahuarte47 Mar 11, 2014

Author Contributor

Thank you very much @m-kuhn !

if ( isaLinearRing )
{
double x1, y1, x2, y2;

unsigned char* startWkbX = sourceWkb;
unsigned char* startWkbY = startWkbX + sizeOfDoubleX;
unsigned char* finalWkbX = sourceWkb + ( numPoints - 1 ) * ( sizeOfDoubleX + sizeOfDoubleY );
unsigned char* finalWkbY = finalWkbX + sizeOfDoubleX;

memcpy( &x1, startWkbX, sizeof( double ) );
memcpy( &y1, startWkbY, sizeof( double ) );
memcpy( &x2, finalWkbX, sizeof( double ) );
memcpy( &y2, finalWkbY, sizeof( double ) );

isaLinearRing = ( x1 == x2 ) && ( y1 == y2 );
}

// Process each vertex...
for ( int i = 0, numPoints_i = ( isaLinearRing ? numPoints - 1 : numPoints ); i < numPoints_i; ++i )
{
Expand Down

0 comments on commit 60e1a9b

Please sign in to comment.