[GRASS-SVN] r60468 - grass/trunk/vector/v.segment
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat May 24 22:29:36 PDT 2014
Author: hcho
Date: 2014-05-24 22:29:36 -0700 (Sat, 24 May 2014)
New Revision: 60468
Modified:
grass/trunk/vector/v.segment/main.c
Log:
v.segment: Work with features with multiple cats
Modified: grass/trunk/vector/v.segment/main.c
===================================================================
--- grass/trunk/vector/v.segment/main.c 2014-05-25 04:06:02 UTC (rev 60467)
+++ grass/trunk/vector/v.segment/main.c 2014-05-25 05:29:36 UTC (rev 60468)
@@ -373,22 +373,29 @@
/* Find line by cat, returns 0 if not found */
int find_line(struct Map_info *Map, int lfield, int lcat)
{
- int i, nlines, type, cat;
+ int i, nlines, type;
struct line_cats *Cats;
+ struct ilist *cats;
G_debug(2, "find_line(): llayer = %d lcat = %d", lfield, lcat);
Cats = Vect_new_cats_struct();
+ cats = Vect_new_list();
nlines = Vect_get_num_lines(Map);
for (i = 1; i <= nlines; i++) {
type = Vect_read_line(Map, NULL, Cats, i);
if (!(type & GV_LINE))
continue;
- Vect_cat_get(Cats, lfield, &cat);
- if (cat == lcat)
+
+ Vect_field_cat_get(Cats, lfield, cats);
+ if (Vect_val_in_list(cats, lcat)) {
+ Vect_destroy_list(cats);
return i;
+ }
}
+ Vect_destroy_list(cats);
+
return 0;
}
More information about the grass-commit
mailing list