open.c File Reference

#include "stdlib.h"
#include "stdio.h"
#include "string.h"
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "glocale.h"
#include "gis.h"
#include "Vect.h"

Include dependency graph for open.c:

Go to the source code of this file.

Defines

#define MAX_OPEN_LEVEL   2

Functions

void fatal_error (int ferror, char *errmsg)
int Vect_set_open_level (int level)
 Predetermine level at which a map will be opened for reading. If it can't open that level, the open will fail. The specified level must be set before any call to open. The default is to try to open the highest level possible, and keep stepping down until success.
int Vect__open_old (struct Map_info *Map, char *name, char *mapset, int update, int head_only)
 Returns Level of openness. [ 1, 2 ] or -1 for error. In case of error, the functions respect fatal error settings.
int Vect_open_old (struct Map_info *Map, char *name, char *mapset)
 Open old vector for reading.
int Vect_open_update (struct Map_info *Map, char *name, char *mapset)
 Open old vector for reading/writing.
int Vect_open_old_head (struct Map_info *Map, char *name, char *mapset)
 Reads only info about vector from headers of 'head', 'dbln', 'topo' and 'cidx' file.
int Vect_open_update_head (struct Map_info *Map, char *name, char *mapset)
 Open old vector head for updating (mostly for database link updates).
int Vect_open_new (struct Map_info *Map, char *name, int with_z)
 Open new vector for reading/writing.
int Vect_coor_info (struct Map_info *Map, struct Coor_info *Info)
 ADD.
char * Vect_maptype_info (struct Map_info *Map)
 returns maptype (native, shape, postgis)
int Vect_open_topo (struct Map_info *Map, int head_only)
int Vect_open_spatial_index (struct Map_info *Map)
 Open spatial index file.


Define Documentation

#define MAX_OPEN_LEVEL   2

Definition at line 38 of file open.c.

Referenced by Vect_set_open_level().


Function Documentation

void fatal_error ( int  ferror,
char *  errmsg 
)

Definition at line 57 of file open.c.

Referenced by Vect__open_old(), and Vect_open_new().

Vect__open_old ( struct Map_info *  Map,
char *  name,
char *  mapset,
int  update,
int  head 
)

Returns Level of openness. [ 1, 2 ] or -1 for error. In case of error, the functions respect fatal error settings.

Parameters:
Map 
name 
mapset 
update open for update
head_only Read only header info from 'head', 'dbln', 'topo' and 'cidx'. 'cidx' is not opened. The headed may be opened on level 2 only.

Definition at line 116 of file open.c.

References fatal_error(), V2_open_old_ogr(), Vect__init_head(), Vect__read_head(), Vect_cidx_open(), Vect_get_fatal_error(), Vect_get_full_name(), Vect_hist_write(), Vect_new_dblinks_struct(), Vect_open_topo(), Vect_read_dblinks(), Vect_rewind(), and Vect_set_fatal_error().

Referenced by Vect_open_old(), Vect_open_old_head(), Vect_open_update(), and Vect_open_update_head().

int Vect_coor_info ( struct Map_info *  Map,
struct Coor_info *  Info 
)

ADD.

Returns:
1 on success, 0 on error
Parameters:
Map_info structure, Coor_info structure

Definition at line 552 of file open.c.

Referenced by check_coor(), V1_close_nat(), Vect_close(), and Vect_open_topo().

char * Vect_maptype_info ( struct Map_info *  Map  ) 

returns maptype (native, shape, postgis)

Returns:
maptype string on success, error message on error
Parameters:
Map_info structure

Definition at line 588 of file open.c.

int Vect_open_new ( struct Map_info *  Map,
char *  name,
int  with_z 
)

Open new vector for reading/writing.

Returns:
level [ 1 ], -1 on error
Parameters:
Map_info structure, map name, with_z

Definition at line 470 of file open.c.

References fatal_error(), V1_open_new_nat(), Vect__init_head(), Vect_delete(), Vect_get_fatal_error(), Vect_get_full_name(), Vect_legal_filename(), Vect_new_dblinks_struct(), and Vect_set_fatal_error().

int Vect_open_old ( struct Map_info *  Map,
char *  name,
char *  mapset 
)

Open old vector for reading.

Returns:
level of openness. [ 1, 2, (3) ] or -1 for error. In case of error, the functions respect fatal error settings.
Parameters:
Map 
name 
mapset 

Definition at line 370 of file open.c.

References Vect__open_old().

Vect_open_old_head ( struct Map_info *  Map,
char *  name,
char *  mapset 
)

Reads only info about vector from headers of 'head', 'dbln', 'topo' and 'cidx' file.

Returns:
level of openness. [ 1, 2, (3) ], -1 for error. In case of error, the functions respect fatal error settings.
Parameters:
Map 
name 
mapset 

Definition at line 426 of file open.c.

References Vect__open_old().

Referenced by Vect_copy(), and Vect_delete().

int Vect_open_spatial_index ( struct Map_info *  Map  ) 

Open spatial index file.

Returns:
0 on success, -1 on error
Parameters:
Map_info structure

Definition at line 693 of file open.c.

int Vect_open_topo ( struct Map_info *  Map,
int  head_only 
)

Definition at line 617 of file open.c.

References Vect_coor_info().

Referenced by Vect__open_old().

int Vect_open_update ( struct Map_info *  Map,
char *  name,
char *  mapset 
)

Open old vector for reading/writing.

Returns:
level of openness. [ 1, 2, (3) ], -1 for error. In case of error, the functions respect fatal error settings.
Parameters:
Map 
name 
mapset 

Definition at line 390 of file open.c.

References Vect__open_old(), and Vect_build_sidx_from_topo().

int Vect_open_update_head ( struct Map_info *  Map,
char *  name,
char *  mapset 
)

Open old vector head for updating (mostly for database link updates).

Returns:
level of openness. [ 1, 2, (3) ], -1 for error. In case of error, the functions respect fatal error settings.
Parameters:
Map 
name 
mapset 

Definition at line 441 of file open.c.

References Vect__open_old().

Referenced by Vect_copy(), and Vect_rename().

int Vect_set_open_level ( int  level  ) 

Predetermine level at which a map will be opened for reading. If it can't open that level, the open will fail. The specified level must be set before any call to open. The default is to try to open the highest level possible, and keep stepping down until success.

NOTE!! This should only be used to set when you wish to force a lower level open. If you require a higher level, then just check the return to verify the level instead of forcing it. This is because future releases will have higher levels which will be downward compatible and which your programs should support by default.

Returns:
0 on success, ?? on error
Parameters:
vector level

Definition at line 90 of file open.c.

References MAX_OPEN_LEVEL.

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


Generated on Wed Aug 23 17:49:09 2006 for GRASS by  doxygen 1.4.7