Fix crash in simplify tool, from Richard Kostecky

git-svn-id: http://svn.osgeo.org/qgis/trunk@11028 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
wonder 2009-07-06 10:01:20 +00:00
parent 3067cd38c5
commit a38068eeec

View File

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