|
GRASS 8 Programmer's Manual 8.6.0dev(2026)-f6f2c534ea
|
Vector library - category index management. More...
#include <stdlib.h>#include <string.h>#include <sys/types.h>#include <sys/stat.h>#include <unistd.h>#include <grass/vector.h>#include <grass/glocale.h>#include "local_proto.h"
Go to the source code of this file.
Macros | |
| #define | SEP |
Functions | |
| int | Vect_cidx_get_num_fields (struct Map_info *Map) |
| Get number of layers in category index. | |
| int | Vect_cidx_get_field_number (struct Map_info *Map, int index) |
| Get layer number for given index. | |
| int | Vect_cidx_get_field_index (struct Map_info *Map, int field) |
| Get layer index for given layer number. | |
| int | Vect_cidx_get_num_unique_cats_by_index (struct Map_info *Map, int index) |
| Get number of unique categories for given layer index. | |
| int | Vect_cidx_get_num_cats_by_index (struct Map_info *Map, int index) |
| Get number of categories for given layer index. | |
| int | Vect_cidx_get_num_types_by_index (struct Map_info *Map, int field_index) |
| Get number of feature types for given layer index. | |
| int | Vect_cidx_get_type_count_by_index (struct Map_info *Map, int field_index, int type_index, int *type, int *count) |
| Get count of feature types for given field and type index. | |
| int | Vect_cidx_get_type_count (struct Map_info *Map, int field, int type) |
| Get count of features of certain type by layer and type. | |
| int | Vect_cidx_get_cat_by_index (struct Map_info *Map, int field_index, int cat_index, int *cat, int *type, int *id) |
| Get category, feature type and id for given layer and category index. | |
| int | Vect_cidx_get_unique_cats_by_index (struct Map_info *Map, int field_index, struct ilist *list) |
| Get list of unique categories for given layer index. | |
| int | Vect_cidx_find_next (struct Map_info *Map, int field_index, int cat, int type_mask, int start_index, int *type, int *id) |
| Find next line/area id for given category, start_index and type_mask. | |
| void | Vect_cidx_find_all (struct Map_info *Map, int layer, int type_mask, int cat, struct ilist *lines) |
| Find all line/area id's for given category. | |
| int | Vect_cidx_dump (struct Map_info *Map, FILE *out) |
| Write (dump) category index in text form to file. | |
| int | Vect_cidx_save (struct Map_info *Map) |
| Save category index to binary file (cidx) | |
| int | Vect_cidx_open (struct Map_info *Map, int head_only) |
| Read category index from cidx file if exists. | |
Vector library - category index management.
Higher level functions for reading/writing/manipulating vectors.
(C) 2001-2013 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 Vlib/cindex.c.
| #define SEP |
Definition at line 27 of file Vlib/cindex.c.
Write (dump) category index in text form to file.
| Map | pointer to Map_info structure | |
| [out] | out | output file |
Definition at line 420 of file Vlib/cindex.c.
References Cat_index::cat, count, Cat_index::field, G_debug(), SEP, Cat_index::type, Vect_cidx_get_cat_by_index(), Vect_cidx_get_field_number(), Vect_cidx_get_num_cats_by_index(), Vect_cidx_get_num_fields(), Vect_cidx_get_num_types_by_index(), Vect_cidx_get_num_unique_cats_by_index(), and Vect_cidx_get_type_count_by_index().
| void Vect_cidx_find_all | ( | struct Map_info * | Map, |
| int | layer, | ||
| int | type_mask, | ||
| int | cat, | ||
| struct ilist * | lines | ||
| ) |
Find all line/area id's for given category.
| Map | pointer to Map_info structure | |
| layer | layer number | |
| type_mask | feature type of objects to search for | |
| cat | category number | |
| [out] | lines | array of ids of found lines/points |
Definition at line 373 of file Vlib/cindex.c.
References _, Cat_index::cat, G_fatal_error(), GV_AREA, Cat_index::n_cats, Cat_index::type, Vect_cidx_find_next(), Vect_cidx_get_field_index(), Vect_list_append(), and Vect_reset_list().
| int Vect_cidx_find_next | ( | struct Map_info * | Map, |
| int | field_index, | ||
| int | cat, | ||
| int | type_mask, | ||
| int | start_index, | ||
| int * | type, | ||
| int * | id | ||
| ) |
Find next line/area id for given category, start_index and type_mask.
| Map | pointer to Map_info structure | |
| field_index | layer index | |
| cat | category number | |
| type_mask | requested feature type | |
| start_index | start search at this index (0 - whole category index) | |
| [out] | type | returned type |
| [out] | id | returned line/area id |
Definition at line 327 of file Vlib/cindex.c.
References Cat_index::cat, G_debug(), Cat_index::n_cats, and Cat_index::type.
Referenced by Vect_cidx_find_all(), and Vect_net_ttb_build_graph().
| int Vect_cidx_get_cat_by_index | ( | struct Map_info * | Map, |
| int | field_index, | ||
| int | cat_index, | ||
| int * | cat, | ||
| int * | type, | ||
| int * | id | ||
| ) |
Get category, feature type and id for given layer and category index.
| Map | pointer to Map_info structure | |
| field_index | layer index | |
| cat_index | category index | |
| [out] | cat | category number |
| [out] | type | feature type |
| [out] | id | feature id |
Definition at line 262 of file Vlib/cindex.c.
References _, and G_fatal_error().
Referenced by Vect_cidx_dump().
Get layer index for given layer number.
| Map | pointer to Map_info structure |
| field | layer number |
Definition at line 115 of file Vlib/cindex.c.
References G_debug().
Referenced by Vect_cidx_find_all(), Vect_cidx_get_type_count(), and Vect_net_ttb_build_graph().
Get layer number for given index.
G_fatal_error() is called when index not found.
| Map | pointer to Map_info structure |
| index | layer index: from 0 to Vect_cidx_get_num_fields() - 1 |
Definition at line 98 of file Vlib/cindex.c.
Referenced by Vect_cidx_dump().
Get number of categories for given layer index.
| Map | pointer to Map_info structure |
| index | layer index |
Definition at line 161 of file Vlib/cindex.c.
Referenced by Vect_cidx_dump().
Get number of layers in category index.
| Map | pointer to Map_info structure |
Definition at line 81 of file Vlib/cindex.c.
Referenced by Vect_cidx_dump().
Get number of feature types for given layer index.
G_fatal_error() is called when index not found.
| Map | pointer to Map_info structure |
| field_index | layer index |
Definition at line 180 of file Vlib/cindex.c.
Referenced by Vect_cidx_dump().
Get number of unique categories for given layer index.
G_fatal_error() is called when index not found.
| Map | pointer to Map_info structure |
| index | layer index (starts at 0) |
Definition at line 144 of file Vlib/cindex.c.
Referenced by Vect_cidx_dump().
Get count of features of certain type by layer and type.
| Map | pointer to Map_info structure |
| field | layer number |
| type | feature type |
Definition at line 223 of file Vlib/cindex.c.
References count, G_debug(), and Vect_cidx_get_field_index().
| int Vect_cidx_get_type_count_by_index | ( | struct Map_info * | Map, |
| int | field_index, | ||
| int | type_index, | ||
| int * | type, | ||
| int * | count | ||
| ) |
Get count of feature types for given field and type index.
| Map | pointer to Map_info structure | |
| field_index | layer index | |
| type_index | type index | |
| [out] | type | feature type (GV_POINT, ...) |
| [out] | count | number of features or NULL |
Definition at line 200 of file Vlib/cindex.c.
References count.
Referenced by Vect_cidx_dump().
| int Vect_cidx_get_unique_cats_by_index | ( | struct Map_info * | Map, |
| int | field_index, | ||
| struct ilist * | list | ||
| ) |
Get list of unique categories for given layer index.
| Map | pointer to Map_info structure | |
| field_index | layer index | |
| [out] | list | output list of cats |
Definition at line 288 of file Vlib/cindex.c.
References dig_cidx_sort(), Vect_list_append(), and Vect_reset_list().
Read category index from cidx file if exists.
| Map | pointer to Map_info structure |
| head_only | read only header of the file |
Definition at line 523 of file Vlib/cindex.c.
References _, access, dig_file_init(), dig_read_cidx(), F_OK, gvfile::file, G_debug(), G_fopen_old(), G_free(), G_warning(), GPATH_MAX, GV_CIDX_ELEMENT, AMI_STREAM< T >::name(), NULL, Vect__get_element_path(), Vect__get_path(), and Vect_get_full_name().
Referenced by Vect__open_old().
Save category index to binary file (cidx)
| Map | pointer to Map_info structure |
Definition at line 478 of file Vlib/cindex.c.
References _, Plus_head::cidx_port, dig__byte_order_out(), dig_file_init(), dig_init_portable(), dig_write_cidx(), gvfile::file, G_debug(), G_fopen_new(), G_warning(), GPATH_MAX, GV_CIDX_ELEMENT, NULL, Vect__get_path(), and Vect_get_name().
Referenced by Vect_close().