Skip to content

Commit

Permalink
Merge pull request #3326 from pvalsecc/perf
Browse files Browse the repository at this point in the history
Add heuristic to not simplify geometries for nothing
  • Loading branch information
sbrunner committed Aug 16, 2016
2 parents cd4bc88 + 5ee97ad commit 40b70a3
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/core/qgsmaptopixelgeometrysimplifier.cpp
Expand Up @@ -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 ];

Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 40b70a3

Please sign in to comment.