[GRASS-SVN] r64825 - grass/trunk/vector/v.category
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Mar 10 01:02:31 PDT 2015
Author: mmetz
Date: 2015-03-10 01:02:31 -0700 (Tue, 10 Mar 2015)
New Revision: 64825
Modified:
grass/trunk/vector/v.category/main.c
Log:
v.category: fix r56286, #2618
Modified: grass/trunk/vector/v.category/main.c
===================================================================
--- grass/trunk/vector/v.category/main.c 2015-03-09 19:31:48 UTC (rev 64824)
+++ grass/trunk/vector/v.category/main.c 2015-03-10 08:02:31 UTC (rev 64825)
@@ -55,7 +55,7 @@
{
struct Map_info In, Out;
static struct line_pnts *Points;
- struct line_cats *Cats, *TCats;
+ struct line_cats *Cats;
struct field_info *Fi;
struct cat_list *Clist;
int i, j, ret, option, otype, type, with_z, step, id;
@@ -382,11 +382,8 @@
break;
case (O_TRANS):
- TCats = Vect_new_cats_struct();
-
/* Lines */
while ((type = Vect_read_next_line(&In, Points, Cats)) > 0) {
- Vect_reset_cats(TCats);
id++;
if (type & otype && (!Clist ||
(Clist &&
@@ -397,25 +394,18 @@
for (i = 0; i < n; i++) {
if (Cats->field[i] == fields[0]) {
scat = Cats->cat[i];
- Vect_cat_set(TCats, 1, scat);
- }
- }
- if (scat > -1) {
- n = TCats->n_cats;
- for (i = 0; i < n; i++) {
- scat = TCats->cat[i];
- for (i = 1; i < nfields; i++) {
- if (Vect_cat_set(Cats, fields[i], scat) > 0) {
- G_debug(4, "Copy cat %i of field %i to into field %i", scat, fields[0], fields[i]);
+ for (j = 1; j < nfields; j++) {
+ if (Vect_cat_set(Cats, fields[j], scat) > 0) {
+ G_debug(4, "Copy cat %i of field %i to field %i", scat, fields[0], fields[j]);
}
}
}
- nmodified++;
}
+ if (scat != -1)
+ nmodified++;
}
Vect_write_line(&Out, type, Points, Cats);
}
- Vect_destroy_cats_struct(TCats);
break;
case (O_DEL):
More information about the grass-commit
mailing list