|
GRASS 8 Programmer's Manual 8.6.0dev(2026)-5f4f7ad06c
|
Vector library - category array. More...

Go to the source code of this file.
Functions | |
| struct varray * | Vect_new_varray (int size) |
| Create new struct varray and allocate space for given number of items. | |
| int | Vect_set_varray_from_cat_string (struct Map_info *Map, int field, const char *cstring, int type, int value, struct varray *varray) |
| Set values in 'varray' to 'value' from category string. | |
| int | Vect_set_varray_from_cat_list (struct Map_info *Map, int field, struct cat_list *clist, int type, int value, struct varray *varray) |
| Set values in 'varray' to 'value' from category list. | |
| int | Vect_set_varray_from_db (struct Map_info *Map, int field, const char *where, int type, int value, struct varray *varray) |
| Set values in 'varray' to 'value' from DB (where statement) | |
Vector library - category array.
Higher level functions for reading/writing/manipulating vectors.
(C) 2001-2009 by the GRASS Development Team
This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.
Definition in file array.c.
Create new struct 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.
| size | size of array |
Definition at line 38 of file array.c.
References varray::c, G_calloc, G_free(), G_malloc, NULL, and varray::size.
Referenced by NetA_initialise_varray().
| int Vect_set_varray_from_cat_list | ( | struct Map_info * | Map, |
| int | field, | ||
| struct cat_list * | clist, | ||
| int | type, | ||
| int | value, | ||
| struct varray * | varray | ||
| ) |
Set values in 'varray' to 'value' from category list.
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. Array must be initialised by Vect_new_varray() call.
| Map | vector map | |
| field | layer number | |
| clist | list of categories | |
| type | feature type | |
| value | value to set up | |
| [out] | varray | varray structure to modify |
Definition at line 123 of file array.c.
References _, varray::c, line_cats::cat, line_cats::field, G_debug(), G_warning(), GV_AREA, GV_LINES, GV_POINTS, NULL, varray::size, 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, | ||
| const char * | cstring, | ||
| int | type, | ||
| int | value, | ||
| struct varray * | varray | ||
| ) |
Set values in 'varray' to 'value' from category string.
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. Array must be initialised by Vect_new_varray() call.
| Map | vector map | |
| field | layer number | |
| cstring | pointer to string with categories | |
| type | feature type | |
| value | value to set up | |
| [out] | varray | varray structure to modify |
Definition at line 78 of file array.c.
References _, cat_list::field, G_debug(), G_warning(), Vect_destroy_cat_list(), Vect_new_cat_list(), Vect_set_varray_from_cat_list(), and Vect_str_to_cat_list().
Referenced by NetA_initialise_varray().
| int Vect_set_varray_from_db | ( | struct Map_info * | Map, |
| int | field, | ||
| const char * | where, | ||
| int | type, | ||
| int | value, | ||
| struct varray * | varray | ||
| ) |
Set values in 'varray' to 'value' from DB (where statement)
I 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. Array must be initialised by Vect_new_varray() call.
| Map | vector map | |
| field | layer number | |
| where | where statement | |
| type | feature type | |
| value | value to set up | |
| [out] | varray | varray structure to modify |
Definition at line 243 of file array.c.
References _, varray::c, db_close_database_shutdown_driver(), db_select_int(), db_start_driver_open_database(), field_info::driver, G_debug(), G_free(), G_warning(), GV_AREA, GV_LINES, GV_POINTS, NULL, varray::size, Vect_destroy_cats_struct(), Vect_destroy_field_info(), Vect_get_area_centroid(), Vect_get_field(), Vect_get_num_areas(), Vect_get_num_lines(), Vect_new_cats_struct(), and Vect_read_line().
Referenced by NetA_initialise_varray().