GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-d6dec75dd4
|
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. More... | |
int | Vect_cidx_get_field_number (struct Map_info *Map, int index) |
Get layer number for given index. More... | |
int | Vect_cidx_get_field_index (struct Map_info *Map, int field) |
Get layer index for given layer number. More... | |
int | Vect_cidx_get_num_unique_cats_by_index (struct Map_info *Map, int index) |
Get number of unique categories for given layer index. More... | |
int | Vect_cidx_get_num_cats_by_index (struct Map_info *Map, int index) |
Get number of categories for given layer index. More... | |
int | Vect_cidx_get_num_types_by_index (struct Map_info *Map, int field_index) |
Get number of feature types for given layer index. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
int | Vect_cidx_dump (struct Map_info *Map, FILE *out) |
Write (dump) category index in text form to file. More... | |
int | Vect_cidx_save (struct Map_info *Map) |
Save category index to binary file (cidx) More... | |
int | Vect_cidx_open (struct Map_info *Map, int head_only) |
Read category index from cidx file if exists. More... | |
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.
int Vect_cidx_dump | ( | struct Map_info * | Map, |
FILE * | out | ||
) |
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::field, and G_debug().
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.
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.
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.
int Vect_cidx_get_field_index | ( | struct Map_info * | Map, |
int | field | ||
) |
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().
int Vect_cidx_get_field_number | ( | struct Map_info * | Map, |
int | index | ||
) |
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.
int Vect_cidx_get_num_cats_by_index | ( | struct Map_info * | Map, |
int | index | ||
) |
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.
int Vect_cidx_get_num_fields | ( | struct Map_info * | Map | ) |
Get number of layers in category index.
Map | pointer to Map_info structure |
Definition at line 81 of file Vlib/cindex.c.
int Vect_cidx_get_num_types_by_index | ( | struct Map_info * | Map, |
int | field_index | ||
) |
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.
int Vect_cidx_get_num_unique_cats_by_index | ( | struct Map_info * | Map, |
int | index | ||
) |
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.
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.
Map | pointer to Map_info structure |
field | layer number |
type | feature type |
Definition at line 223 of file Vlib/cindex.c.
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.
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.
int Vect_cidx_open | ( | struct Map_info * | Map, |
int | head_only | ||
) |
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 522 of file Vlib/cindex.c.
References _, dig_file_init(), dig_read_cidx(), gvfile::file, G_debug(), G_fopen_old(), G_warning(), GPATH_MAX, GV_CIDX_ELEMENT, Map_info::mapset, Map_info::name, NULL, Map_info::plus, Vect__get_element_path(), Vect__get_path(), and Vect_get_full_name().