[GRASS-SVN] r52841 - grass/branches/develbranch_6/vector/v.build.polylines

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Aug 22 13:38:08 PDT 2012


Author: mmetz
Date: 2012-08-22 13:38:07 -0700 (Wed, 22 Aug 2012)
New Revision: 52841

Modified:
   grass/branches/develbranch_6/vector/v.build.polylines/description.html
   grass/branches/develbranch_6/vector/v.build.polylines/main.c
Log:
v.build.polylines: code cosmetics, manual

Modified: grass/branches/develbranch_6/vector/v.build.polylines/description.html
===================================================================
--- grass/branches/develbranch_6/vector/v.build.polylines/description.html	2012-08-22 20:13:46 UTC (rev 52840)
+++ grass/branches/develbranch_6/vector/v.build.polylines/description.html	2012-08-22 20:38:07 UTC (rev 52841)
@@ -35,13 +35,13 @@
 
 <h2>NOTES</h2>
 
-<em>v.build.polylines</em> combines only lines oif the same type to
+<em>v.build.polylines</em> combines only lines if the same type to
 a new polyline, i.e. lines and boundaries are kept separate.
 
 <p>
 Category number(s) are assigned to a polyline based on <b>cats</b> parameter.
 
-</ul>
+<ul>
   <li><b>cats=no</b> - No category number is assigned to a
   polyline. Also attributes tables linked to the input vector map are
   not copied to the output vector map.</li>
@@ -82,7 +82,7 @@
 Mark Lake, Institute of Archaeology, University College London.<br> 
 Major rewrite by Radim Blazek, October 2002<br>
 Category mode added by Martin Landa, FBK-irst, Trento, Italy, October 2007<br>
-Support for different line types by Markus Metz
+Support for categories, attributes, and different line types by Markus Metz
 
 <p>
 <i>Last changed: $Date$</i>

Modified: grass/branches/develbranch_6/vector/v.build.polylines/main.c
===================================================================
--- grass/branches/develbranch_6/vector/v.build.polylines/main.c	2012-08-22 20:13:46 UTC (rev 52840)
+++ grass/branches/develbranch_6/vector/v.build.polylines/main.c	2012-08-22 20:38:07 UTC (rev 52841)
@@ -6,9 +6,9 @@
  *               Major rewrite by Radim Blazek, October 2002
  *               Glynn Clements <glynn gclements.plus.com>, Markus Neteler <neteler itc.it>
  *               Martin Landa <landa.martin gmail.com> (cats)
- *               Markus Metz (geometry type management)
+ *               Markus Metz (geometry type management, cats, attributes)
  * PURPOSE:      
- * COPYRIGHT:    (C) 2002-2011 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2002-2012 by the GRASS Development Team
  *
  *               This program is free software under the GNU General Public
  *               License (>=v2). Read the file COPYING that comes with GRASS
@@ -98,7 +98,7 @@
     int points_in_polyline;
     int start_line;
     int nlines;
-    int write_cats;
+    int write_cats, copy_tables;
 
     char *mapset;
     int type, ltype;
@@ -183,6 +183,8 @@
     polyline = 0;
     nlines = 0;
 
+    copy_tables = (write_cats != NO_CATS);
+
     for (line = 1; line <= Vect_get_num_lines(&map); line++) {
 	Vect_reset_cats(Cats);
 	ltype = Vect_read_line(&map, NULL, NULL, line);
@@ -193,6 +195,8 @@
 	    /* copy points to output as they are, with cats */
 	    Vect_read_line(&map, points, Cats, line);
 	    Vect_write_line(&Out, ltype, points, Cats);
+	    if (Cats->n_cats > 0)
+		copy_tables = 1;
 	    continue;
 	}
 
@@ -224,7 +228,7 @@
 	      polyline, Vect_get_name(&Out), Vect_get_mapset(&Out));
 
     /* Copy (all linked) tables if needed */
-    if (write_cats != NO_CATS) {
+    if (copy_tables) {
         if (Vect_copy_tables(&map, &Out, 0))
             G_warning(_("Failed to copy attribute table to output map"));
     }



More information about the grass-commit mailing list