[GRASS-SVN] r36888 - grass/branches/develbranch_6/vector/v.buffer2

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Apr 23 07:32:55 EDT 2009


Author: hamish
Date: 2009-04-23 07:32:55 -0400 (Thu, 23 Apr 2009)
New Revision: 36888

Modified:
   grass/branches/develbranch_6/vector/v.buffer2/description.html
   grass/branches/develbranch_6/vector/v.buffer2/main.c
Log:
retain backwards compatibility

Modified: grass/branches/develbranch_6/vector/v.buffer2/description.html
===================================================================
--- grass/branches/develbranch_6/vector/v.buffer2/description.html	2009-04-23 09:56:30 UTC (rev 36887)
+++ grass/branches/develbranch_6/vector/v.buffer2/description.html	2009-04-23 11:32:55 UTC (rev 36888)
@@ -5,30 +5,33 @@
 the number of vector segments being generated (the smaller the value, the more
 vector segments are generated).
 
+
 <h2>NOTES</h2>
 
-<!-- TRUE?? -->
+<!-- Q: True?  A: Sure. if two point buffers overlap and are merged, which
+     area's attribute is the one to use in the combined area? -->
 Attributes are not transferred due to potential buffer overlap, which
 cannot be resolved automatically.
 
+
 <h2>EXAMPLES</h2>
 
 <h3>Buffer around input lines</h3>
 
 <div class="code"><pre>
-v.buffer input=map output=buffer type=line buffer=100
+v.buffer input=map output=buffer type=line distance=100
 </pre></div>
 
 <h3>Circles around input points</h3>
 
 <div class="code"><pre>
-v.buffer input=pointsmap output=circles type=point buffer=1000 
+v.buffer input=pointsmap output=circles type=point distance=1000 
 </pre></div>
 
 <h3>Non-overlapping circles around input points with attribute transfer</h3>
 
 <div class="code"><pre>
-v.buffer input=archsites output=circles type=point buffer=200 
+v.buffer input=archsites output=circles type=point distance=200 
 # change original points to centroids: 
 v.type in=archsites out=archcentroids type=point,centroid 
 # patch circles and centroids: 
@@ -40,6 +43,7 @@
 database='$GISDBASE/$LOCATION_NAME/$MAPSET/dbf'
 </pre></div>
 
+
 <h2>SEE ALSO</h2>
 
 <em>
@@ -50,9 +54,11 @@
 <a HREF="v.db.connect.html">v.db.connect</a>
 </em>
 
+
 <h2>AUTHORS</h2>
 
 Radim Blazek<br>
-Rewritten by Rosen Matev (with support through the Google Summer of Code program 2008)
+Rewritten by Rosen Matev (with support through the
+ Google Summer of Code program 2008)
 <p>
 <i>Last changed: $Date: 2008-03-16 16:29:33 +0100 (Sun, 16 Mar 2008) $</i>

Modified: grass/branches/develbranch_6/vector/v.buffer2/main.c
===================================================================
--- grass/branches/develbranch_6/vector/v.buffer2/main.c	2009-04-23 09:56:30 UTC (rev 36887)
+++ grass/branches/develbranch_6/vector/v.buffer2/main.c	2009-04-23 11:32:55 UTC (rev 36888)
@@ -122,7 +122,7 @@
     char *mapset;
     struct GModule *module;
     struct Option *in_opt, *out_opt, *type_opt, *dista_opt, *distb_opt,
-	*angle_opt;
+	*angle_opt, *buffer_opt, *debug_opt;
     struct Flag *straight_flag, *nocaps_flag;
     struct Option *tol_opt, *bufcol_opt, *scale_opt, *field_opt;
 
@@ -203,6 +203,24 @@
 	_("Maximum distance between theoretical arc and polygon segments as multiple of buffer");
     tol_opt->guisection = _("Distance");
 
+    debug_opt = G_define_option();
+    debug_opt->key = "debug";
+    debug_opt->type = TYPE_STRING;
+    debug_opt->required = NO;
+    debug_opt->guisection = _("Unused");
+    debug_opt->description =
+	_("This does nothing. It is retained for backwards compatibility");
+
+    buffer_opt = G_define_option();
+    buffer_opt->key = "buffer";
+    buffer_opt->type = TYPE_DOUBLE;
+    buffer_opt->required = NO;
+    buffer_opt->label =
+	_("This is an alias to the distance option. "
+	  "It is retained for backwards compatibility");
+    buffer_opt->description = _("Buffer distance in map units");
+    buffer_opt->guisection = _("Unused");
+
     straight_flag = G_define_flag();
     straight_flag->key = 's';
     straight_flag->description = _("Make outside corners straight");
@@ -216,11 +234,12 @@
     if (G_parser(argc, argv))
 	exit(EXIT_FAILURE);
 
+
     type = Vect_option_to_types(type_opt);
     field = atoi(field_opt->answer);
 
-    if ((dista_opt->answer && bufcol_opt->answer) ||
-	(!(dista_opt->answer || bufcol_opt->answer)))
+    if (((dista_opt->answer || buffer_opt->answer) && bufcol_opt->answer) ||
+	(!(dista_opt->answer || buffer_opt->answer || bufcol_opt->answer)))
 	G_fatal_error(_("Select a buffer distance/minordistance/angle "
 			"or column, but not both."));
 
@@ -230,6 +249,12 @@
 		    "option or clean manually with v.clean tool=break; "
 		    "v.category step=0; v.extract -d type=area"));
 
+    if (buffer_opt->answer)
+	G_warning(_("The buffer option has been replaced by the distance "
+		    "option and will be removed in future."));
+    if (buffer_opt->answer && dista_opt->answer)
+	G_fatal_error(_("Use the distance option instead of the buffer option."));
+
     tolerance = atof(tol_opt->answer);
     if (adjust_tolerance(&tolerance))
 	G_warning(_("The tolerance was reset to %g"), tolerance);
@@ -239,8 +264,11 @@
 	G_fatal_error("Illegal scale value");
 
 
-    if (dista_opt->answer) {
-	da = atof(dista_opt->answer);
+    if (dista_opt->answer || buffer_opt->answer) {
+	if(buffer_opt->answer)
+	    da = atof(buffer_opt->answer);
+	if(dista_opt->answer)
+	    da = atof(dista_opt->answer);
 
 	if (distb_opt->answer)
 	    db = atof(distb_opt->answer);



More information about the grass-commit mailing list