[GRASS-SVN] r59226 - grass/trunk/vector/v.to.points

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Mar 10 10:26:42 PDT 2014


Author: martinl
Date: 2014-03-10 10:26:42 -0700 (Mon, 10 Mar 2014)
New Revision: 59226

Modified:
   grass/trunk/vector/v.to.points/main.c
Log:
v.to.points: print warning about skipped fearures


Modified: grass/trunk/vector/v.to.points/main.c
===================================================================
--- grass/trunk/vector/v.to.points/main.c	2014-03-10 17:03:37 UTC (rev 59225)
+++ grass/trunk/vector/v.to.points/main.c	2014-03-10 17:26:42 UTC (rev 59226)
@@ -8,7 +8,7 @@
  *               
  * PURPOSE:      Create points along lines 
  *               
- * COPYRIGHT:    (C) 2002-2010, 2013 by the GRASS Development Team
+ * COPYRIGHT:    (C) 2002-2014 by the GRASS Development Team
  *
  *               This program is free software under the GNU General
  *               Public License (>=v2).  Read the file COPYING that
@@ -190,8 +190,9 @@
     }
 
     if (type & (GV_POINTS | GV_LINES | GV_FACE)) {
-	int line, nlines;
+        int line, nlines, nskipped;
 
+        nskipped = 0;
 	nlines = Vect_get_num_lines(&In);
 	for (line = 1; line <= nlines; line++) {
 	    int ltype, cat;
@@ -202,8 +203,10 @@
 	    ltype = Vect_read_line(&In, LPoints, LCats, line);
 	    if (!(ltype & type))
 		continue;
-            if (!Vect_cat_get(LCats, field, &cat) && field != -1)
+            if (!Vect_cat_get(LCats, field, &cat) && field != -1) {
+                nskipped++;
 		continue;
+            }
 
             /* Assign CAT for layer 0 objects (i.e. boundaries) */
             if (field == -1)
@@ -218,6 +221,12 @@
 			   flag.inter->answer, dmax, driver, Fi);
 	    }
 	}
+
+        if (nskipped > 0)
+            G_warning(_("%d features without category in layer <%d> skipped. "
+                        "Note that features without category (usually boundaries) are not "
+                        "skipped when '%s=-1' is given."),
+                      nskipped, field, opt.lfield->key);
     }
 
     if (type == GV_AREA) {



More information about the grass-commit mailing list