GRASS Programmer's Manual
6.5.svn(2014)-r66266
|
#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) More... | |
struct line_cats * | Vect_new_cats_struct () |
Creates and initializes line_cats structure. More... | |
int | Vect_destroy_cats_struct (struct line_cats *p) |
Frees all memory associated with line_cats structure, including the struct itself. More... | |
int | Vect_cat_set (struct line_cats *Cats, int field, int cat) |
Add new field/cat to category structure if doesn't exist yet. More... | |
int | Vect_cat_get (struct line_cats *Cats, int field, int *cat) |
Get first found category of given field. More... | |
int | Vect_field_cat_get (struct line_cats *Cats, int field, struct ilist *cats) |
Get list of categories of given field. More... | |
int | Vect_cat_del (struct line_cats *Cats, int field) |
Delete all categories of given layer. More... | |
int | Vect_field_cat_del (struct line_cats *Cats, int field, int cat) |
Delete field/cat from line_cats structure. More... | |
int | Vect_reset_cats (struct line_cats *Cats) |
Reset category structure to make sure cats structure is clean to be re-used. More... | |
struct cat_list * | Vect_new_cat_list () |
Allocate memory for cat_list structure. More... | |
int | Vect_destroy_cat_list (struct cat_list *p) |
Frees allocated cat_list memory. More... | |
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. More... | |
int | Vect_array_to_cat_list (int *vals, int nvals, struct cat_list *list) |
Convert ordered array of integers to cat_list structure. More... | |
int | Vect_cat_in_cat_list (int cat, struct cat_list *list) |
Check if category number is in list. More... | |
int | Vect_cat_in_array (int cat, int *array, int ncats) |
Check if category is in ordered array of integers. More... | |
struct line_cats * Vect__new_cats_struct | ( | ) |
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 60 of file vector/Vlib/cats.c.
Referenced by Vect_new_cats_struct().
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 435 of file vector/Vlib/cats.c.
References G_debug(), int, and tools::range.
Delete all categories of given layer.
[in] | Cats | line_cats structure |
[in] | field | layer number |
Definition at line 223 of file vector/Vlib/cats.c.
References n.
Referenced by wxdigit.IVDigit::DeleteSelectedLines().
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 159 of file vector/Vlib/cats.c.
References n.
Referenced by G_site_get(), IL_vector_input_data_2d(), NetA_get_node_costs(), NetA_initialise_varray(), Vect_get_line_cat(), Vect_net_build_graph(), and Vect_set_varray_from_cat_list().
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 496 of file vector/Vlib/cats.c.
Check if category number is in list.
[in] | cat | category number |
[in] | list | cat_list structure |
Definition at line 475 of file vector/Vlib/cats.c.
References FALSE, max, and TRUE.
Referenced by Vect_set_varray_from_cat_list().
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 108 of file vector/Vlib/cats.c.
References cat, dig_alloc_cats(), G_fatal_error(), and n.
Referenced by wxdigit.IVDigit::CopyCats(), wxdigit.IVDigit::DeleteSelectedLines(), G_site_put(), IL_check_at_points_2d(), wxdigit.IVDigit::InitCats(), wxdigit.IVDigit::SetLineCats(), V1_read_next_line_ogr(), V2_read_line_ogr(), Vect_clean_small_angles_at_nodes(), 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 334 of file vector/Vlib/cats.c.
References G_free().
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 83 of file vector/Vlib/cats.c.
References G_free().
Referenced by wxdisplay.DisplayDriver::__del__(), wxdigit.IVDigit::__del__(), wxdigit.IVDigit::CopyCats(), wxdigit.IVDigit::DeleteSelectedLines(), NetA_get_node_costs(), NetA_initialise_varray(), Vect_copy_map_lines(), Vect_merge_lines(), Vect_set_varray_from_cat_list(), Vect_set_varray_from_db(), Vect_snap_line(), 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().
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 259 of file vector/Vlib/cats.c.
References n.
Referenced by wxdigit.IVDigit::SetLineCats(), and Vedit_modify_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 193 of file vector/Vlib/cats.c.
References n, Vect_list_append(), and Vect_reset_list().
struct cat_list* Vect_new_cat_list | ( | ) |
Allocate memory for cat_list structure.
Definition at line 308 of file vector/Vlib/cats.c.
References NULL.
Referenced by Vect_set_varray_from_cat_string().
struct line_cats* Vect_new_cats_struct | ( | ) |
Creates and initializes line_cats structure.
This structure is used for reading and writing vector cats. The library routines handle all memory allocation.
To free allocated memory call Vect_destroy_cats_struct().
Definition at line 42 of file vector/Vlib/cats.c.
References G_fatal_error(), NULL, and Vect__new_cats_struct().
Referenced by wxdigit.IVDigit::CopyCats(), wxdigit.IVDigit::DeleteSelectedLines(), G_site_get(), G_site_put(), Gp_load_sites(), IL_vector_input_data_2d(), NetA_get_node_costs(), NetA_initialise_varray(), 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_line(), 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 295 of file vector/Vlib/cats.c.
Referenced by G_site_put(), IL_check_at_points_2d(), wxdigit.IVDigit::InitCats(), 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(), 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 358 of file vector/Vlib/cats.c.
References buf, err, G_debug(), G_warning(), int, l, max, min, NULL, and dialogs::s.
Referenced by Vect_set_varray_from_cat_string().