map.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <dirent.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <grass/glocale.h>
#include <grass/gis.h>
#include <grass/Vect.h>
#include <grass/dbmi.h>

Include dependency graph for map.c:

Go to the source code of this file.

Functions

int Vect_copy_map_lines (struct Map_info *In, struct Map_info *Out)
 copy all alive elements of opened vector map to another opened vector map
int copy_file (const char *src, const char *dst)
int Vect_copy (char *in, char *mapset, char *out, FILE *msgout)
 copy a map including attribute tables Old vector is deleted
int Vect_rename (char *in, char *out, FILE *msgout)
 rename a map, attribute tables are created in the same database where input tables were stored. The original format (native/OGR) is used. Old map ('out') is deleted!!!
int Vect_delete (char *map)
 delete a map including attribute tables
int Vect_copy_tables (struct Map_info *In, struct Map_info *Out, int field)
 Copy map tables. All if field = 0, or table defined by given field if field > 0.
int Vect_copy_table (struct Map_info *In, struct Map_info *Out, int field_in, int field_out, char *field_name, int type)
 Copy map table.
int Vect_copy_table_by_cats (struct Map_info *In, struct Map_info *Out, int field_in, int field_out, char *field_name, int type, int *cats, int ncats)
 Copy map table.
void Vect_set_release_support (struct Map_info *Map)
 Set spatial index to be realease when vector is closed, by default, the memory occupied by spatial index is not released.
void Vect_set_category_index_update (struct Map_info *Map)
 By default, category index is not updated if vector is changed, this function sets category index update. WARNING: currently only category for elements is updated not for areas.


Function Documentation

int copy_file ( const char *  src,
const char *  dst 
)

Definition at line 92 of file map.c.

Referenced by Vect_copy().

int Vect_copy ( char *  in,
char *  mapset,
char *  out,
FILE *  msgout 
)

copy a map including attribute tables Old vector is deleted

Returns:
-1 error, 0 success
Parameters:
in input vector
out output vector
msgout output file for messages or NULL

Definition at line 135 of file map.c.

References copy_file(), Vect_close(), Vect_default_field_info(), Vect_delete(), Vect_get_dblink(), Vect_get_num_dblinks(), Vect_legal_filename(), Vect_map_add_dblink(), Vect_open_old_head(), Vect_open_update_head(), Vect_set_open_level(), and Vect_subst_var().

int Vect_copy_map_lines ( struct Map_info *  In,
struct Map_info *  Out 
)

copy all alive elements of opened vector map to another opened vector map

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

Definition at line 37 of file map.c.

References Vect_destroy_cats_struct(), Vect_destroy_line_struct(), Vect_get_num_lines(), Vect_level(), Vect_new_cats_struct(), Vect_new_line_struct(), Vect_read_line(), Vect_read_next_line(), Vect_rewind(), and Vect_write_line().

int Vect_copy_table ( struct Map_info *  In,
struct Map_info *  Out,
int  field_in,
int  field_out,
char *  field_name,
int  type 
)

Copy map table.

Returns:
0 on success, -1 on error
Parameters:
In 
Out 
field_in 
field_out 
field_name 
type 

Definition at line 562 of file map.c.

References Vect_copy_table_by_cats().

int Vect_copy_table_by_cats ( struct Map_info *  In,
struct Map_info *  Out,
int  field_in,
int  field_out,
char *  field_name,
int  type,
int *  cats,
int  ncats 
)

Copy map table.

Returns:
0 on success, -1 on error
Parameters:
In 
Out 
field_in 
field_out 
field_name 
type 
cats pointer to array of cats or NULL
ncats number of cats in 'cats'

Definition at line 583 of file map.c.

References Vect_default_field_info(), Vect_get_field(), Vect_map_add_dblink(), and Vect_subst_var().

Referenced by Vect_copy_table().

int Vect_copy_tables ( struct Map_info *  In,
struct Map_info *  Out,
int  field 
)

Copy map tables. All if field = 0, or table defined by given field if field > 0.

Returns:
0 on success, -1 on error
Parameters:
in Map_info structure, out Map_info structure, field number

Definition at line 498 of file map.c.

References Vect_default_field_info(), Vect_get_dblink(), Vect_get_num_dblinks(), Vect_map_add_dblink(), and Vect_subst_var().

int Vect_delete ( char *  map  ) 

delete a map including attribute tables

Returns:
-1 error, 0 success
Parameters:
map name

Definition at line 372 of file map.c.

References Vect_close(), Vect_get_dblink(), Vect_get_num_dblinks(), Vect_open_old_head(), and Vect_set_open_level().

Referenced by Vect_copy(), Vect_open_new(), and Vect_rename().

int Vect_rename ( char *  in,
char *  out,
FILE *  msgout 
)

rename a map, attribute tables are created in the same database where input tables were stored. The original format (native/OGR) is used. Old map ('out') is deleted!!!

Returns:
-1 error, 0 success
Parameters:
in input vector
out output vector
msgout output file for messages or NULL

Definition at line 257 of file map.c.

References Vect_close(), Vect_default_field_info(), Vect_delete(), Vect_get_dblink(), Vect_get_field(), Vect_get_num_dblinks(), Vect_legal_filename(), Vect_map_add_dblink(), Vect_map_del_dblink(), Vect_open_update_head(), Vect_set_open_level(), and Vect_subst_var().

void Vect_set_category_index_update ( struct Map_info *  Map  ) 

By default, category index is not updated if vector is changed, this function sets category index update. WARNING: currently only category for elements is updated not for areas.

Parameters:
Map pointer to map

Definition at line 645 of file map.c.

void Vect_set_release_support ( struct Map_info *  Map  ) 

Set spatial index to be realease when vector is closed, by default, the memory occupied by spatial index is not released.

Parameters:
Map pointer to map

Definition at line 632 of file map.c.


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