[GRASS-SVN] r51573 - grass/trunk/vector/v.buffer

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Apr 29 13:07:24 EDT 2012


Author: mmetz
Date: 2012-04-29 10:07:24 -0700 (Sun, 29 Apr 2012)
New Revision: 51573

Modified:
   grass/trunk/vector/v.buffer/main.c
Log:
negative distances only for areas

Modified: grass/trunk/vector/v.buffer/main.c
===================================================================
--- grass/trunk/vector/v.buffer/main.c	2012-04-29 16:22:19 UTC (rev 51572)
+++ grass/trunk/vector/v.buffer/main.c	2012-04-29 17:07:24 UTC (rev 51573)
@@ -6,10 +6,11 @@
  * AUTHOR(S):    Radim Blazek
  *               Upgraded by Rosen Matev (Google Summer of Code 2008)
  *               OGR support by Martin Landa <landa.martin gmail.com> (2009)
+ *               rewrite and GEOS added by Markus Metz
  *               
  * PURPOSE:      Vector buffer
  *               
- * COPYRIGHT:    (C) 2001-2009 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2001-2012 by the GRASS Development Team
  *
  *               This program is free software under the GNU General
  *               Public License (>=v2). Read the file COPYING that
@@ -346,7 +347,7 @@
 	else
 	    dalpha = 0;
 
-	unit_tolerance = tolerance * MIN(da, db);
+	unit_tolerance = fabs(tolerance * MIN(da, db));
 	G_verbose_message(_("The tolerance in map units = %g"), unit_tolerance);
     }
 
@@ -445,6 +446,12 @@
 	int ltype;
 
 	G_message(_("Buffering lines..."));
+	
+	if (da < 0 || db < 0) {
+	    G_warning(_("Negative distances are only supported for areas"));
+	    da = fabs(da);
+	    db = fabs(db);
+	}
 
 	nlines = Vect_get_num_lines(&In);
 	for (line = 1; line <= nlines; line++) {
@@ -481,6 +488,10 @@
 		    continue;
 
 		da = size_val * scale;
+		if (da < 0) {
+		    G_warning(_("Negative distances are only supported for areas"));
+		    da = fabs(da);
+		}
 		db = da;
 		dalpha = 0;
 		unit_tolerance = tolerance * MIN(da, db);



More information about the grass-commit mailing list