Skip to content
Permalink
Browse files

Merge pull request #3326 from pvalsecc/perf

Add heuristic to not simplify geometries for nothing
  • Loading branch information
sbrunner committed Aug 16, 2016
2 parents cd4bc88 + 5ee97ad commit 40b70a3ddf7977e771ab7177ddce3064466132a2
@@ -547,9 +547,15 @@ bool QgsMapToPixelSimplifier::simplifyPoints( QgsWkbTypes::Type wkbType, QgsCons
if ( numPoints <= ( isaLinearRing ? 6 : 3 ) )
return false;

QgsRectangle envelope = calculateBoundingBox( singleType, QgsConstWkbPtr( sourceWkbPtr ), numPoints );
sourceWkbPtr -= sizeof( int );
const QgsRectangle envelope = calculateBoundingBox( singleType, QgsConstWkbPtr( sourceWkbPtr ), numPoints );

if ( qMax( envelope.width(), envelope.height() ) / numPoints > tolerance * 2.0 )
{
//points are in average too far appart to lead to any significant simplification
return false;
}

sourceWkbPtr -= sizeof( int );
int targetWkbSize = 5 + sizeof( int ) + numPoints * ( 2 * sizeof( double ) );
unsigned char* targetWkb = new unsigned char[ targetWkbSize ];

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 40b70a3

Please sign in to comment.
You can’t perform that action at this time.