Skip to content

Commit

Permalink
Avoid redundant calculation in QgsMapToPixelSimplifier
Browse files Browse the repository at this point in the history
(cherry picked from commit fcacd00)
  • Loading branch information
nyalldawson committed Jun 10, 2019
1 parent 1660f78 commit f37c391
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/core/qgsmaptopixelgeometrysimplifier.cpp
Original file line number Diff line number Diff line change
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 f37c391

Please sign in to comment.