Skip to content

Commit

Permalink
Avoid redundant calculation in QgsMapToPixelSimplifier
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed May 30, 2019
1 parent 3d9386b commit fcacd00
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/core/qgsmaptopixelgeometrysimplifier.cpp
Expand Up @@ -162,8 +162,6 @@ std::unique_ptr< QgsAbstractGeometry > QgsMapToPixelSimplifier::simplifyGeometry
}

double x = 0.0, y = 0.0, lastX = 0.0, lastY = 0.0;
QgsRectangle r;
r.setMinimal();

if ( numPoints <= ( isaLinearRing ? 4 : 2 ) )
isGeneralizable = false;
Expand Down Expand Up @@ -225,8 +223,6 @@ std::unique_ptr< QgsAbstractGeometry > QgsMapToPixelSimplifier::simplifyGeometry
lastX = x;
lastY = y;
}

r.combineExtentWith( x, y );
}
break;
}
Expand Down Expand Up @@ -300,8 +296,6 @@ std::unique_ptr< QgsAbstractGeometry > QgsMapToPixelSimplifier::simplifyGeometry

hasLongSegments |= isLongSegment;
}

r.combineExtentWith( x, y );
}
}
}
Expand All @@ -317,7 +311,7 @@ std::unique_ptr< QgsAbstractGeometry > QgsMapToPixelSimplifier::simplifyGeometry
{
// approximate the geometry's shape by its bounding box
// (rect for linear ring / one segment for line string)
return generalizeWkbGeometryByBoundingBox( wkbType, geometry, r, isaLinearRing );
return generalizeWkbGeometryByBoundingBox( wkbType, geometry, envelope, isaLinearRing );
}
else
{
Expand Down

0 comments on commit fcacd00

Please sign in to comment.