GRASS Programmer's Manual
6.5.svn(2014)-r66266
|
Vector library - array structure. More...
#include <stdlib.h>
#include <grass/gis.h>
#include <grass/dbmi.h>
#include <grass/Vect.h>
#include <grass/glocale.h>
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. More... | |
int | Vect_set_varray_from_cat_string (struct Map_info *Map, int field, const char *cstring, int type, int value, VARRAY *varray) |
Set values in 'varray' to 'value'. More... | |
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'. More... | |
int | Vect_set_varray_from_db (struct Map_info *Map, int field, const char *where, int type, int value, VARRAY *varray) |
Set values in 'varray' to 'value'. More... | |
Vector library - array structure.
Higher level functions for reading/writing/manipulating vectors.
(C) 2001-2008 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.
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.
size | size of array |
Definition at line 44 of file array.c.
References G_free(), int, NULL, and tools::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, | ||
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. Array must be initialised by Vect_new_varray(size) call.
Map | vector map | |
field | layer number | |
clist | list of categories | |
type | feature type | |
value | value to set up | |
[in,out] | varray | varray structure to modify |
Definition at line 132 of file array.c.
References cat, G_debug(), G_warning(), main::GV_LINES, n, NULL, value, 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, | ||
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. Array must be initialised by Vect_new_varray(size) call.
Map | vector map | |
field | layer number | |
cstring | pointer to string with categories | |
type | feature type | |
value | value to set up | |
[in,out] | varray | varray structure to modify |
Definition at line 85 of file array.c.
References 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, | ||
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. Array must be initialised by Vect_new_varray(size) call.
Map | vector map | |
field | layer number | |
where | where statement | |
type | feature type | |
value | value to set up | |
[in,out] | varray | varray structure to modify |
Definition at line 251 of file array.c.
References cat, db_close_database_shutdown_driver(), db_select_int(), db_start_driver_open_database(), driver, G_debug(), G_free(), G_warning(), main::GV_LINES, n, NULL, value, 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().
Referenced by NetA_initialise_varray().