[QGIS Commit] r11028 - trunk/qgis/src/app
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Mon Jul 6 06:01:20 EDT 2009
Author: wonder
Date: 2009-07-06 06:01:20 -0400 (Mon, 06 Jul 2009)
New Revision: 11028
Modified:
trunk/qgis/src/app/qgsmaptoolsimplify.cpp
Log:
Fix crash in simplify tool, from Richard Kostecky
Modified: trunk/qgis/src/app/qgsmaptoolsimplify.cpp
===================================================================
--- trunk/qgis/src/app/qgsmaptoolsimplify.cpp 2009-07-05 11:39:47 UTC (rev 11027)
+++ trunk/qgis/src/app/qgsmaptoolsimplify.cpp 2009-07-06 10:01:20 UTC (rev 11028)
@@ -52,7 +52,7 @@
// 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 @@
{
return FALSE;
}
+
QVector<QgsPoint> resultPoints = simplifyPoints( polygon->asPolygon()[0], tolerance );
//resultPoints.push_back(resultPoints[0]);
QVector<QgsPolyline> poly;
@@ -366,6 +367,9 @@
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;
More information about the QGIS-commit
mailing list