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

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Mar 12 01:47:35 PDT 2018


Author: mlennert
Date: 2018-03-12 01:47:35 -0700 (Mon, 12 Mar 2018)
New Revision: 72353

Added:
   grass/trunk/vector/v.buffer/v_buffer_point_s.png
Modified:
   grass/trunk/vector/v.buffer/main.c
   grass/trunk/vector/v.buffer/v.buffer.html
Log:
v.buffer: use squared buffers around points when -s flag is set


Modified: grass/trunk/vector/v.buffer/main.c
===================================================================
--- grass/trunk/vector/v.buffer/main.c	2018-03-11 21:57:29 UTC (rev 72352)
+++ grass/trunk/vector/v.buffer/main.c	2018-03-12 08:47:35 UTC (rev 72353)
@@ -669,9 +669,18 @@
 	    
 	    Vect_line_prune(Points);
 	    if (ltype & GV_POINTS || Points->n_points == 1) {
-		Vect_point_buffer2(Points->x[0], Points->y[0], da, db, dalpha,
-				   !(straight_flag->answer), unit_tolerance,
-				   &(arr_bc_pts.oPoints));
+		if (straight_flag->answer) {
+			arr_bc_pts.oPoints = Vect_new_line_struct();
+		        Vect_append_point(arr_bc_pts.oPoints, Points->x[0] + da, Points->y[0] + da, 0);
+		        Vect_append_point(arr_bc_pts.oPoints, Points->x[0] + da, Points->y[0] - da, 0);
+		        Vect_append_point(arr_bc_pts.oPoints, Points->x[0] - da, Points->y[0] - da, 0);
+		        Vect_append_point(arr_bc_pts.oPoints, Points->x[0] - da, Points->y[0] + da, 0);
+  		        Vect_append_point(arr_bc_pts.oPoints, arr_bc_pts.oPoints->x[0], arr_bc_pts.oPoints->y[0], arr_bc_pts.oPoints->z[0]);
+		} else {
+			Vect_point_buffer2(Points->x[0], Points->y[0], da, db, dalpha,
+					   !(straight_flag->answer), unit_tolerance,
+					   &(arr_bc_pts.oPoints));
+		}
 
 		Vect_write_line(&Out, GV_BOUNDARY, arr_bc_pts.oPoints, BCats);
 		line_id = Vect_write_line(&Buf, GV_BOUNDARY, arr_bc_pts.oPoints, CCats);

Modified: grass/trunk/vector/v.buffer/v.buffer.html
===================================================================
--- grass/trunk/vector/v.buffer/v.buffer.html	2018-03-11 21:57:29 UTC (rev 72352)
+++ grass/trunk/vector/v.buffer/v.buffer.html	2018-03-12 08:47:35 UTC (rev 72353)
@@ -65,6 +65,13 @@
   <img src="v_buffer_line_c.png">
 </center>
 
+Using <b>-s</b> with a point vector map as input data, square buffers are 
+created instead of round buffers.
+
+<center>
+  <img src="v_buffer_point_s.png">
+</center>
+
 <!-- Only support by GRASS buffer 
 Flag <b>-s</b> also influences corners around polygons (see red color
 on the figure below):

Added: grass/trunk/vector/v.buffer/v_buffer_point_s.png
===================================================================
(Binary files differ)

Index: grass/trunk/vector/v.buffer/v_buffer_point_s.png
===================================================================
--- grass/trunk/vector/v.buffer/v_buffer_point_s.png	2018-03-11 21:57:29 UTC (rev 72352)
+++ grass/trunk/vector/v.buffer/v_buffer_point_s.png	2018-03-12 08:47:35 UTC (rev 72353)

Property changes on: grass/trunk/vector/v.buffer/v_buffer_point_s.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/png
\ No newline at end of property


More information about the grass-commit mailing list