瀏覽代碼

negative distances only for areas

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@51573 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 13 年之前
父節點
當前提交
d8c6020351
共有 1 個文件被更改,包括 13 次插入2 次删除
  1. 13 2
      vector/v.buffer/main.c

+ 13 - 2
vector/v.buffer/main.c

@@ -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 @@ int main(int argc, char *argv[])
 	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 main(int argc, char *argv[])
 	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 @@ int main(int argc, char *argv[])
 		    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);