mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
Merge pull request #1509 from ahuarte47/Issue_10767
Fix bug #10767: Simplified rendering causing boxes to appear instead
This commit is contained in:
commit
eaacb125c4
@ -222,6 +222,9 @@ bool QgsMapToPixelSimplifier::simplifyWkbGeometry(
|
||||
double* ptr = ( double* )targetWkb;
|
||||
map2pixelTol *= map2pixelTol; //-> Use mappixelTol for 'LengthSquare' calculations.
|
||||
|
||||
bool isaUngenerizableSegment;
|
||||
bool hasUngenerizableSegments = false; //-> To avoid replace the simplified geometry by its BBOX when there are 'long' segments.
|
||||
|
||||
// Check whether the LinearRing is really closed.
|
||||
if ( isaLinearRing )
|
||||
{
|
||||
@ -246,14 +249,21 @@ bool QgsMapToPixelSimplifier::simplifyWkbGeometry(
|
||||
memcpy( &x, sourceWkb, sizeof( double ) ); sourceWkb += sizeOfDoubleX;
|
||||
memcpy( &y, sourceWkb, sizeof( double ) ); sourceWkb += sizeOfDoubleY;
|
||||
|
||||
isaUngenerizableSegment = false;
|
||||
|
||||
if ( i == 0 ||
|
||||
!isGeneralizable ||
|
||||
calculateLengthSquared2D( x, y, lastX, lastY ) > map2pixelTol ||
|
||||
( isaUngenerizableSegment = ( calculateLengthSquared2D( x, y, lastX, lastY ) > map2pixelTol ) ) ||
|
||||
( !isaLinearRing && ( i == 1 || i >= numPoints - 2 ) ) )
|
||||
{
|
||||
memcpy( ptr, &x, sizeof( double ) ); lastX = x; ptr++;
|
||||
memcpy( ptr, &y, sizeof( double ) ); lastY = y; ptr++;
|
||||
numTargetPoints++;
|
||||
|
||||
if ( isaUngenerizableSegment && !hasUngenerizableSegments )
|
||||
{
|
||||
hasUngenerizableSegments = true;
|
||||
}
|
||||
}
|
||||
|
||||
r.combineExtentWith( x, y );
|
||||
@ -261,7 +271,7 @@ bool QgsMapToPixelSimplifier::simplifyWkbGeometry(
|
||||
targetWkb = wkb2 + 4;
|
||||
|
||||
// Fix the topology of the geometry
|
||||
if ( numTargetPoints <= ( isaLinearRing ? 2 : 1 ) )
|
||||
if ( numTargetPoints <= ( isaLinearRing ? 2 : 1 ) && !hasUngenerizableSegments )
|
||||
{
|
||||
unsigned char* targetTempWkb = targetWkb;
|
||||
int targetWkbTempSize = targetWkbSize;
|
||||
|
Loading…
x
Reference in New Issue
Block a user