Browse Source

negative distances only for areas

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@51573 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 13 năm trước cách đây
mục cha
commit
d8c6020351
1 tập tin đã thay đổi với 13 bổ sung2 xóa
  1. 13 2
      vector/v.buffer/main.c

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

@@ -6,10 +6,11 @@
  * AUTHOR(S):    Radim Blazek
  * AUTHOR(S):    Radim Blazek
  *               Upgraded by Rosen Matev (Google Summer of Code 2008)
  *               Upgraded by Rosen Matev (Google Summer of Code 2008)
  *               OGR support by Martin Landa <landa.martin gmail.com> (2009)
  *               OGR support by Martin Landa <landa.martin gmail.com> (2009)
+ *               rewrite and GEOS added by Markus Metz
  *               
  *               
  * PURPOSE:      Vector buffer
  * 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
  *               This program is free software under the GNU General
  *               Public License (>=v2). Read the file COPYING that
  *               Public License (>=v2). Read the file COPYING that
@@ -346,7 +347,7 @@ int main(int argc, char *argv[])
 	else
 	else
 	    dalpha = 0;
 	    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);
 	G_verbose_message(_("The tolerance in map units = %g"), unit_tolerance);
     }
     }
 
 
@@ -445,6 +446,12 @@ int main(int argc, char *argv[])
 	int ltype;
 	int ltype;
 
 
 	G_message(_("Buffering lines..."));
 	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);
 	nlines = Vect_get_num_lines(&In);
 	for (line = 1; line <= nlines; line++) {
 	for (line = 1; line <= nlines; line++) {
@@ -481,6 +488,10 @@ int main(int argc, char *argv[])
 		    continue;
 		    continue;
 
 
 		da = size_val * scale;
 		da = size_val * scale;
+		if (da < 0) {
+		    G_warning(_("Negative distances are only supported for areas"));
+		    da = fabs(da);
+		}
 		db = da;
 		db = da;
 		dalpha = 0;
 		dalpha = 0;
 		unit_tolerance = tolerance * MIN(da, db);
 		unit_tolerance = tolerance * MIN(da, db);