array.c File Reference

#include <stdlib.h>
#include <grass/gis.h>
#include <grass/dbmi.h>
#include <grass/Vect.h>

Include dependency graph for array.c:

Go to the source code of this file.

Functions

VARRAY * Vect_new_varray (int size)
 Create new VARRAY and allocate space for given number of items. Space allocated is 'size + 1' so that lines are accessed by line id. Array values are set to 0. Returns : pointer to new VARRAY NULL if failed.
int Vect_set_varray_from_cat_string (struct Map_info *Map, int field, char *cstring, int type, int value, VARRAY *varray)
 Set values in 'varray' to 'value' if category of object of given type is in 'cstring' (string representing category list like: '1,3,5-7'). 'type' may be either: GV_AREA or: GV_POINT | GV_LINE | GV_BOUNDARY | GV_CENTROID.
int Vect_set_varray_from_cat_list (struct Map_info *Map, int field, struct cat_list *clist, int type, int value, VARRAY *varray)
 Set values in 'varray' to 'value' if category of object of given type is in 'clist' (category list). 'type' may be either: GV_AREA or: GV_POINT | GV_LINE | GV_BOUNDARY | GV_CENTROID.
int Vect_set_varray_from_db (struct Map_info *Map, int field, char *where, int type, int value, VARRAY *varray)
 Set values in 'varray' to 'value' if category of object of given type is in categories selected from DB based on where statement (given without where). 'type' may be either: GV_AREA or: GV_POINT | GV_LINE | GV_BOUNDARY | GV_CENTROID.


Function Documentation

VARRAY * Vect_new_varray ( int  size  ) 

Create new VARRAY and allocate space for given number of items. Space allocated is 'size + 1' so that lines are accessed by line id. Array values are set to 0. Returns : pointer to new VARRAY NULL if failed.

Definition at line 37 of file array.c.

int Vect_set_varray_from_cat_list ( struct Map_info *  Map,
int  field,
struct cat_list *  clist,
int  type,
int  value,
VARRAY *  varray 
)

Set values in 'varray' to 'value' if category of object of given type is in 'clist' (category list). 'type' may be either: GV_AREA or: GV_POINT | GV_LINE | GV_BOUNDARY | GV_CENTROID.

Array is not reset to zero before, but old values (if any > 0) are overwritten.

Return: number of items set -1 on error

Definition at line 107 of file array.c.

References Vect_cat_get(), Vect_cat_in_cat_list(), Vect_destroy_cats_struct(), Vect_get_area_centroid(), Vect_get_num_areas(), Vect_get_num_lines(), Vect_new_cats_struct(), and Vect_read_line().

Referenced by Vect_set_varray_from_cat_string().

int Vect_set_varray_from_cat_string ( struct Map_info *  Map,
int  field,
char *  cstring,
int  type,
int  value,
VARRAY *  varray 
)

Set values in 'varray' to 'value' if category of object of given type is in 'cstring' (string representing category list like: '1,3,5-7'). 'type' may be either: GV_AREA or: GV_POINT | GV_LINE | GV_BOUNDARY | GV_CENTROID.

Array is not reset to zero before, but old values (if any > 0) are overwritten.

Return: number of items set -1 on error

Definition at line 70 of file array.c.

References Vect_destroy_cat_list(), Vect_new_cat_list(), Vect_set_varray_from_cat_list(), and Vect_str_to_cat_list().

int Vect_set_varray_from_db ( struct Map_info *  Map,
int  field,
char *  where,
int  type,
int  value,
VARRAY *  varray 
)

Set values in 'varray' to 'value' if category of object of given type is in categories selected from DB based on where statement (given without where). 'type' may be either: GV_AREA or: GV_POINT | GV_LINE | GV_BOUNDARY | GV_CENTROID.

Array is not reset to zero before, but old values (if any > 0) are overwritten.

Return: number of items set -1 on error

Definition at line 210 of file array.c.

References Vect_destroy_cats_struct(), Vect_get_area_centroid(), Vect_get_field(), Vect_get_num_areas(), Vect_get_num_lines(), Vect_new_cats_struct(), and Vect_read_line().


Generated on Sun Apr 6 17:32:45 2008 for GRASS by  doxygen 1.5.5