Skip to content
Permalink
Browse files

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
wonder committed Jul 6, 2009
1 parent 3067cd3 commit a38068eeecab1ea0175b69c4c6ff760bf1ff736f
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/app/qgsmaptoolsimplify.cpp
@@ -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 );

}
@@ -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;
@@ -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;

0 comments on commit a38068e

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