GRASS Programmer's Manual
6.4.1(2011)
|
#include <stdlib.h>
#include <string.h>
#include <grass/gis.h>
#include <grass/Vect.h>
#include <grass/glocale.h>
Go to the source code of this file.
Functions | |
struct line_cats * | Vect__new_cats_struct () |
Creates and initializes line_cats structure (lower level fn) | |
struct line_cats * | Vect_new_cats_struct () |
Creates and initializes line_cats structure. | |
int | Vect_destroy_cats_struct (struct line_cats *p) |
Frees all memory associated with line_cats structure, including the struct itself. | |
int | Vect_cat_set (struct line_cats *Cats, int field, int cat) |
Add new field/cat to category structure if doesn't exist yet. | |
int | Vect_cat_get (struct line_cats *Cats, int field, int *cat) |
Get first found category of given field. | |
int | Vect_field_cat_get (struct line_cats *Cats, int field, struct ilist *cats) |
Get list of categories of given field. | |
int | Vect_cat_del (struct line_cats *Cats, int field) |
Delete all categories of given layer. | |
int | Vect_field_cat_del (struct line_cats *Cats, int field, int cat) |
Delete field/cat from line_cats structure. | |
int | Vect_reset_cats (struct line_cats *Cats) |
Reset category structure to make sure cats structure is clean to be re-used. | |
struct cat_list * | Vect_new_cat_list () |
Allocate memory for cat_list structure. | |
int | Vect_destroy_cat_list (struct cat_list *p) |
Frees allocated cat_list memory. | |
int | Vect_str_to_cat_list (const char *str, struct cat_list *list) |
Convert string of categories and cat ranges separated by commas to cat_list. | |
int | Vect_array_to_cat_list (int *vals, int nvals, struct cat_list *list) |
Convert ordered array of integers to cat_list structure. | |
int | Vect_cat_in_cat_list (int cat, struct cat_list *list) |
Check if category number is in list. | |
int | Vect_cat_in_array (int cat, int *array, int ncats) |
Check if category is in ordered array of integers. |
struct line_cats * Vect__new_cats_struct | ( | ) | [read] |
Creates and initializes line_cats structure (lower level fn)
This structure is used for reading and writing vector cats. The library routines handle all memory allocation.
Definition at line 58 of file Vlib/cats.c.
Referenced by Vect_new_cats_struct().
int Vect_array_to_cat_list | ( | int * | vals, |
int | nvals, | ||
struct cat_list * | list | ||
) |
Convert ordered array of integers to cat_list structure.
[in] | vals | array of integers |
[in] | nvals | number of values |
[out] | list | result cat_list structure |
Definition at line 432 of file Vlib/cats.c.
int Vect_cat_del | ( | struct line_cats * | Cats, |
int | field | ||
) |
Delete all categories of given layer.
[in] | Cats | line_cats structure |
[in] | field | layer number |
Definition at line 221 of file Vlib/cats.c.
int Vect_cat_get | ( | struct line_cats * | Cats, |
int | field, | ||
int * | cat | ||
) |
Get first found category of given field.
'cat' is set to first category found or -1 if field was not found
[in] | Cats | line_cats structure |
[in] | field | layer number |
[in] | cat | pointer to variable where cat will be written |
Definition at line 157 of file Vlib/cats.c.
Referenced by Vect_get_line_cat(), Vect_net_build_graph(), and Vect_set_varray_from_cat_list().
int Vect_cat_in_array | ( | int | cat, |
int * | array, | ||
int | ncats | ||
) |
Check if category is in ordered array of integers.
[in] | cat | category number |
[in] | array | ordered array of integers |
[in] | ncats | number of categories in array |
Definition at line 493 of file Vlib/cats.c.
int Vect_cat_in_cat_list | ( | int | cat, |
struct cat_list * | list | ||
) |
Check if category number is in list.
[in] | cat | category number |
[in] | list | cat_list structure |
Definition at line 472 of file Vlib/cats.c.
Referenced by Vect_set_varray_from_cat_list().
int Vect_cat_set | ( | struct line_cats * | Cats, |
int | field, | ||
int | cat | ||
) |
Add new field/cat to category structure if doesn't exist yet.
[in] | Cats | line_cats structure |
[in] | field | layer number |
[in] | cat | category number |
Definition at line 106 of file Vlib/cats.c.
References dig_alloc_cats().
Referenced by V1_read_next_line_ogr(), V2_read_line_ogr(), Vect_clean_small_angles_at_nodes(), Vect_merge_lines(), Vect_overlay_and(), Vect_remove_duplicates(), and Vedit_modify_cats().
int Vect_destroy_cat_list | ( | struct cat_list * | p | ) |
Frees allocated cat_list memory.
[in] | p | line_cats structure |
Definition at line 331 of file Vlib/cats.c.
Referenced by Vect_set_varray_from_cat_string().
int Vect_destroy_cats_struct | ( | struct line_cats * | p | ) |
Frees all memory associated with line_cats structure, including the struct itself.
p | line_cats structure |
Definition at line 81 of file Vlib/cats.c.
Referenced by Vect_copy_map_lines(), Vect_set_varray_from_cat_list(), Vect_set_varray_from_db(), Vect_snap_lines_list(), Vedit_add_vertex(), Vedit_bulk_labeling(), Vedit_chtype_lines(), Vedit_copy_lines(), Vedit_flip_lines(), Vedit_merge_lines(), Vedit_modify_cats(), Vedit_move_lines(), Vedit_move_vertex(), Vedit_remove_vertex(), Vedit_select_by_query(), Vedit_snap_line(), Vedit_snap_lines(), and Vedit_split_lines().
int Vect_field_cat_del | ( | struct line_cats * | Cats, |
int | field, | ||
int | cat | ||
) |
Delete field/cat from line_cats structure.
[in] | Cats | line_cats structure |
[in] | field | layer number |
[in] | cat | category to be deleted or -1 to delete all cats of given field |
Definition at line 257 of file Vlib/cats.c.
Referenced by Vedit_modify_cats().
int Vect_field_cat_get | ( | struct line_cats * | Cats, |
int | field, | ||
struct ilist * | cats | ||
) |
Get list of categories of given field.
Cats | line_cats structure | |
field | layer number | |
[out] | cats | pointer to list where cats will be written |
Definition at line 191 of file Vlib/cats.c.
References Vect_list_append(), and Vect_reset_list().
struct cat_list* Vect_new_cat_list | ( | ) | [read] |
Allocate memory for cat_list structure.
Definition at line 305 of file Vlib/cats.c.
Referenced by Vect_set_varray_from_cat_string().
struct line_cats* Vect_new_cats_struct | ( | ) | [read] |
Creates and initializes line_cats structure.
This structure is used for reading and writing vector cats. The library routines handle all memory allocation.
Definition at line 40 of file Vlib/cats.c.
References Vect__new_cats_struct().
Referenced by V1_rewrite_line_nat(), V2_delete_line_nat(), V2_restore_line_nat(), Vect_break_lines_list(), Vect_break_polygons(), Vect_build_nat(), Vect_clean_small_angles_at_nodes(), Vect_copy_map_lines(), Vect_get_area_cat(), Vect_get_line_cat(), Vect_merge_lines(), Vect_net_build_graph(), Vect_overlay_and(), Vect_remove_duplicates(), Vect_remove_small_areas(), Vect_set_varray_from_cat_list(), Vect_set_varray_from_db(), Vect_snap_lines_list(), Vedit_add_vertex(), Vedit_bulk_labeling(), Vedit_chtype_lines(), Vedit_copy_lines(), Vedit_flip_lines(), Vedit_merge_lines(), Vedit_modify_cats(), Vedit_move_lines(), Vedit_move_vertex(), Vedit_remove_vertex(), Vedit_select_by_query(), Vedit_snap_line(), Vedit_snap_lines(), and Vedit_split_lines().
int Vect_reset_cats | ( | struct line_cats * | Cats | ) |
Reset category structure to make sure cats structure is clean to be re-used.
I.e. it has no cats associated with it. Cats must have previously been created with Vect_new_cats_struct()
[out] | Cats | line_cats structure |
Definition at line 292 of file Vlib/cats.c.
Referenced by V1_read_next_line_ogr(), V2_read_line_ogr(), Vect_break_polygons(), Vect_clean_small_angles_at_nodes(), Vect_get_area_cat(), Vect_get_area_cats(), Vect_merge_lines(), and Vect_overlay_and().
int Vect_str_to_cat_list | ( | const char * | str, |
struct cat_list * | list | ||
) |
Convert string of categories and cat ranges separated by commas to cat_list.
Examples of string: 2,3,5-9,20. str - input string
[in] | str | cat list string |
[out] | list | result cat_list structure |
Definition at line 355 of file Vlib/cats.c.
Referenced by Vect_set_varray_from_cat_string().