Vlib/cindex.c File Reference

#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <grass/gis.h>
#include <grass/Vect.h>

Include dependency graph for Vlib/cindex.c:

Go to the source code of this file.

Defines

#define SEP   "------------------------------------------------------------------------------------------\n"

Functions

int Vect_cidx_get_num_fields (struct Map_info *Map)
 get nuber of field in category index
int Vect_cidx_get_field_number (struct Map_info *Map, int index)
 get field number for given index
int Vect_cidx_get_field_index (struct Map_info *Map, int field)
 get field index for given field number
int Vect_cidx_get_num_unique_cats_by_index (struct Map_info *Map, int index)
 get nuber of unique categories for given field index
int Vect_cidx_get_num_cats_by_index (struct Map_info *Map, int index)
 get nuber of categories for given field index
int Vect_cidx_get_num_types_by_index (struct Map_info *Map, int field_index)
 get nuber of types for given 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 type count field index 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 field 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 nuber of categories for given field and category 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
int Vect_cidx_dump (struct Map_info *Map, FILE *out)
 write category index in text form to file
int Vect_cidx_save (struct Map_info *Map)
 write category index to file
int Vect_cidx_open (struct Map_info *Map, int head_only)


Define Documentation

#define SEP   "------------------------------------------------------------------------------------------\n"

Definition at line 308 of file Vlib/cindex.c.

Referenced by Vect_cidx_dump().


Function Documentation

int Vect_cidx_dump ( struct Map_info *  Map,
FILE *  out 
)

write category index in text form to file

Returns:
1 on success, 0 on error
Parameters:
Map_info structure
out output file

Definition at line 318 of file Vlib/cindex.c.

References SEP, 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().

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

Returns:
index to array

-1 not found

Parameters:
Map 
field_index 
cat category
type_mask requested type
start_index start search at this index (0 - whole category index)
type returned type
id returned line/area id

Definition at line 252 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 nuber of categories for given field and category index

Returns:
1 OK

0 on error

Parameters:
Map 
field_index 
cat_index 
cat 
type 
id 

Definition at line 211 of file Vlib/cindex.c.

Referenced by Vect_cidx_dump().

int Vect_cidx_get_field_index ( struct Map_info *  Map,
int  field 
)

get field index for given field number

Returns:
field index or -1 if not found
Parameters:
Map_info structure
field field number

Definition at line 73 of file Vlib/cindex.c.

Referenced by Vect_cidx_get_type_count().

int Vect_cidx_get_field_number ( struct Map_info *  Map,
int  index 
)

get field number for given index

Returns:
field number
Parameters:
Map_info structure
index field index: from 0 to Vect_cidx_get_num_fields()-1

Definition at line 55 of file Vlib/cindex.c.

Referenced by Vect_cidx_dump().

int Vect_cidx_get_num_cats_by_index ( struct Map_info *  Map,
int  index 
)

get nuber of categories for given field index

Returns:
number of categories or -1 on error
Parameters:
Map_info structure
index 

Definition at line 116 of file Vlib/cindex.c.

Referenced by Vect_cidx_dump().

int Vect_cidx_get_num_fields ( struct Map_info *  Map  ) 

get nuber of field in category index

Returns:
number of fields
Parameters:
Map_info structure

Definition at line 40 of file Vlib/cindex.c.

Referenced by Vect_cidx_dump().

int Vect_cidx_get_num_types_by_index ( struct Map_info *  Map,
int  field_index 
)

get nuber of types for given field index

Returns:
number of types or -1 on error
Parameters:
Map_info structure
index 

Definition at line 133 of file Vlib/cindex.c.

Referenced by Vect_cidx_dump().

int Vect_cidx_get_num_unique_cats_by_index ( struct Map_info *  Map,
int  index 
)

get nuber of unique categories for given field index

Returns:
number of unique categories or -1 on error
Parameters:
Map_info structure
field 

Definition at line 99 of file Vlib/cindex.c.

Referenced by Vect_cidx_dump().

int Vect_cidx_get_type_count ( struct Map_info *  Map,
int  field,
int  type 
)

get count of features of certain type by field and type

Returns:
feature count, 0 if no features, no such field or no such type in cidx
Parameters:
Map_info structure
field 
type 

Definition at line 173 of file Vlib/cindex.c.

References 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 type count field index and type index

Returns:
1 OK

0 on error

Parameters:
Map_info structure
index 

Definition at line 152 of file Vlib/cindex.c.

Referenced by Vect_cidx_dump().

int Vect_cidx_open ( struct Map_info *  Map,
int  head_only 
)

Definition at line 413 of file Vlib/cindex.c.

References dig_cidx_init(), dig_file_init(), and dig_read_cidx().

Referenced by Vect__open_old().

int Vect_cidx_save ( struct Map_info *  Map  ) 

write category index to file

Returns:
0 on success

1 on error

Parameters:
Map_info structure

Definition at line 370 of file Vlib/cindex.c.

References dig__byte_order_out(), dig_file_init(), dig_init_portable(), and dig_write_cidx().

Referenced by Vect_close().


Generated on Sun Apr 6 17:32:46 2008 for GRASS by  doxygen 1.5.5