GRASS GIS 7 Programmer's Manual
7.9.dev(2021)-e5379bbd7
|
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 "------------------------------------------------------------------------------------------\n" |
Functions | |
int | Vect_cidx_get_num_fields (const struct Map_info *Map) |
Get number of layers in category index. More... | |
int | Vect_cidx_get_field_number (const struct Map_info *Map, int index) |
Get layer number for given index. More... | |
int | Vect_cidx_get_field_index (const struct Map_info *Map, int field) |
Get layer index for given layer number. More... | |
int | Vect_cidx_get_num_unique_cats_by_index (const struct Map_info *Map, int index) |
Get number of unique categories for given layer index. More... | |
int | Vect_cidx_get_num_cats_by_index (const struct Map_info *Map, int index) |
Get number of categories for given layer index. More... | |
int | Vect_cidx_get_num_types_by_index (const 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 (const 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 (const 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 (const 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 (const 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 (const 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 (const 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 "------------------------------------------------------------------------------------------\n" |
Definition at line 27 of file Vlib/cindex.c.
int Vect_cidx_dump | ( | const 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 419 of file Vlib/cindex.c.
References Cat_index::field, and G_debug().
void Vect_cidx_find_all | ( | const 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 372 of file Vlib/cindex.c.
int Vect_cidx_find_next | ( | const 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 325 of file Vlib/cindex.c.
int Vect_cidx_get_cat_by_index | ( | const 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 261 of file Vlib/cindex.c.
int Vect_cidx_get_field_index | ( | const 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 113 of file Vlib/cindex.c.
References G_debug().
int Vect_cidx_get_field_number | ( | const 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 96 of file Vlib/cindex.c.
int Vect_cidx_get_num_cats_by_index | ( | const 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 159 of file Vlib/cindex.c.
int Vect_cidx_get_num_fields | ( | const struct Map_info * | Map | ) |
Get number of layers in category index.
Map | pointer to Map_info structure |
Definition at line 79 of file Vlib/cindex.c.
int Vect_cidx_get_num_types_by_index | ( | const 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 178 of file Vlib/cindex.c.
int Vect_cidx_get_num_unique_cats_by_index | ( | const 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 142 of file Vlib/cindex.c.
int Vect_cidx_get_type_count | ( | const 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 221 of file Vlib/cindex.c.
int Vect_cidx_get_type_count_by_index | ( | const 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 198 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 287 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 519 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().