[GRASS-SVN] r52096 - grass/trunk/lib/vector/neta

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jun 16 02:56:41 PDT 2012


Author: mmetz
Date: 2012-06-16 02:56:40 -0700 (Sat, 16 Jun 2012)
New Revision: 52096

Modified:
   grass/trunk/lib/vector/neta/utils.c
Log:
netalib bugfix

Modified: grass/trunk/lib/vector/neta/utils.c
===================================================================
--- grass/trunk/lib/vector/neta/utils.c	2012-06-16 09:56:12 UTC (rev 52095)
+++ grass/trunk/lib/vector/neta/utils.c	2012-06-16 09:56:40 UTC (rev 52096)
@@ -239,7 +239,7 @@
     }
     else if (cat) {
 	if (layer < 1)
-	    G_fatal_error(_("'%s' must be > 0 for '%s'"), "layer", GV_KEY_COLUMN);
+	    G_fatal_error(_("'%s' must be > 0 for '%s'"), "layer", "categories");
 	*varray = Vect_new_varray(Vect_get_num_lines(In));
 	if (Vect_set_varray_from_cat_string
 	    (In, layer, cat, mask_type, 1, *varray) == -1) {
@@ -248,7 +248,29 @@
 	}
 	return 1;
     }
-    else {
+    else { /* all features of given layer */
+	int i, n, cat;
+	int ltype;			/* line type */
+	struct line_cats *Cats;
+
+	if (layer < 1)
+	    G_fatal_error(_("'%s' must be > 0 for '%s'"), "layer", "categories");
+
+	n = Vect_get_num_lines(In);
+	*varray = Vect_new_varray(n);
+	Cats = Vect_new_cats_struct();
+
+	for (i = 1; i <= n; i++) {
+	    ltype = Vect_read_line(In, NULL, Cats, i);
+
+	    if (!(ltype & mask_type))
+		continue;	/* is not specified type */
+
+	    if (Vect_cat_get(Cats, layer, &cat))
+		(*varray)->c[i] = 1;
+	}
+	Vect_destroy_cats_struct(Cats);
+
 	return 2;
     }
 



More information about the grass-commit mailing list