[GRASS5] v.category - adding table name

Martin Landa landa at gama.fsv.cvut.cz
Mon Mar 14 07:56:35 EST 2005


Hi,

I have written a simple patch for v.category. I hope it would
be useful for many GRASS users (?).

Original report: 

LAYER 1:
type       count        min        max
...
LAYER 2:
type       count        min        max
...

Adding _table_name_:

LAYER/TABLE 1/test_obrazy_parcel:
type       count        min        max
...
LAYER/TABLE 2/test_parcely:
type       count        min        max
...

Martin

---
Martin Landa <landa at gama.fsv.cvut.cz> * http://gama.fsv.cvut.cz/~landa *
CTU Prague, Faculty of Civil Engineering, Czech Republic
-------------- next part --------------
*** main.c.old	2005-03-13 13:47:05.000000000 +0100
--- main.c	2005-03-13 13:56:29.000000000 +0100
***************
*** 39,44 ****
--- 39,45 ----
  
  typedef struct {
      int field;
+     char *table;
      int count[FRTYPES];
      int min[FRTYPES], max[FRTYPES];
  } FREPORT;
***************
*** 49,54 ****
--- 50,56 ----
  	struct Map_info In, Out;
  	static struct line_pnts *Points;
  	struct line_cats *Cats;
+ 	struct field_info *Fi;
          int    i, j, ret, option, otype, type, with_z, step;
  	int    n_areas, centr, new_centr;
  	double x, y;
***************
*** 326,331 ****
--- 328,335 ----
                              fld = nfreps - 1;
                              freps[fld] = (FREPORT *) calloc ( 1, sizeof (FREPORT));
                              freps[fld]->field = field;
+ 			    Fi = Vect_get_field (&In, field);
+ 			    freps[fld]->table = G_store (Fi->table);
  			  }
  			
                          freps[fld]->count[rtype]++;
***************
*** 370,376 ****
  				    	freps[i]->count[FR_AREA], freps[i]->min[FR_AREA], 
  					freps[i]->max[FR_AREA]);
  		    } else {
! 			fprintf (stdout, "LAYER %d:\n", freps[i]->field);
  			fprintf (stdout, "type       count        min        max\n");
  			fprintf (stdout, "point    %7d %10d %10d\n", 
  					freps[i]->count[FR_POINT],
--- 374,380 ----
  				    	freps[i]->count[FR_AREA], freps[i]->min[FR_AREA], 
  					freps[i]->max[FR_AREA]);
  		    } else {
! 			fprintf (stdout, "LAYER/TABLE %d/%s:\n", freps[i]->field, freps[i]->table);
  			fprintf (stdout, "type       count        min        max\n");
  			fprintf (stdout, "point    %7d %10d %10d\n", 
  					freps[i]->count[FR_POINT],


More information about the grass-dev mailing list