Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix crash in simplify tool, from Richard Kostecky
git-svn-id: http://svn.osgeo.org/qgis/trunk@11028 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Jul 6, 2009
1 parent 3067cd3 commit a38068e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/app/qgsmaptoolsimplify.cpp
Expand Up @@ -52,7 +52,7 @@ void QgsSimplifyDialog::setRange( int minValue, int maxValue )
// let's have 20 page steps
horizontalSlider->setPageStep(( maxValue - minValue ) / 20 );

horizontalSlider->setMinimum( minValue - 1 );// -1 for count with minimum tolerance end caused by double imprecision
horizontalSlider->setMinimum( (minValue - 1 < 0 ? 0: minValue - 1 ) );// -1 for count with minimum tolerance end caused by double imprecision
horizontalSlider->setMaximum( maxValue );

}
Expand Down Expand Up @@ -355,6 +355,7 @@ bool QgsSimplifyFeature::simplifyPolygon( QgsFeature& polygonFeature, double to
{
return FALSE;
}

QVector<QgsPoint> resultPoints = simplifyPoints( polygon->asPolygon()[0], tolerance );
//resultPoints.push_back(resultPoints[0]);
QVector<QgsPolyline> poly;
Expand All @@ -366,6 +367,9 @@ bool QgsSimplifyFeature::simplifyPolygon( QgsFeature& polygonFeature, double to

QVector<QgsPoint> QgsSimplifyFeature::simplifyPoints( const QVector<QgsPoint>& pts, double tolerance )
{
//just safety precaution
if (tolerance < 0)
return pts;
// Douglas-Peucker simplification algorithm

int anchor = 0;
Expand Down

0 comments on commit a38068e

Please sign in to comment.