24 #include <sys/types.h>
27 #include <grass/Vect.h>
28 #include <grass/glocale.h>
30 static int clo_dummy()
38 G_fatal_error(_(
"Requested format is not compiled in this version"));
43 static int (*Close_array[][2]) () = {
66 struct Coor_info CInfo;
69 "Vect_close(): name = %s, mapset = %s, format = %d, level = %d",
70 Map->name, Map->mapset, Map->format, Map->level);
73 if (strcmp(Map->mapset,
G_mapset()) == 0 && Map->support_updated &&
74 Map->plus.built == GV_BUILD_ALL) {
76 char file_path[GPATH_MAX];
80 sprintf(buf,
"%s/%s", GRASS_VECT_DIRECTORY, Map->name);
83 if (
stat(file_path, &info) == 0)
87 if (
stat(file_path, &info) == 0)
91 if (
stat(file_path, &info) == 0)
95 Map->plus.coor_size = CInfo.size;
96 Map->plus.coor_mtime = CInfo.mtime;
106 if (Map->format == GV_FORMAT_OGR)
111 if (Map->level == 2 && Map->plus.release_support) {
115 if (!Map->head_only) {
116 G_debug(1,
"free spatial index");
120 G_debug(1,
"free category index");
125 if (Map->format == GV_FORMAT_NATIVE) {
126 G_debug(1,
"close history file");
127 if (Map->hist_fp !=
NULL)
132 if (!Map->head_only) {
133 if (((*Close_array[Map->format][1]) (Map)) != 0) {
134 G_warning(_(
"Unable to close vector <%s>"),
140 G_free((
void *)Map->name);
142 G_free((
void *)Map->mapset);
145 Map->open = VECT_CLOSED_CODE;
char * G_mapset(void)
current mapset name
int V1_close_ogr(struct Map_info *Map)
sprintf(buf2,"%s", G3D_CATS_ELEMENT)
void G_free(void *buf)
Free allocated memory.
void dig_spidx_free(struct Plus_head *Plus)
Free spatial index (nodes, lines, areas, isles)
int Vect_save_topo(struct Map_info *Map)
Save topology file for vector map.
int V1_close_nat(struct Map_info *Map)
char * G__file_name(char *path, const char *element, const char *name, const char *mapset)
Builds full path names to GIS data files.
int V2_close_ogr(struct Map_info *Map)
void dig_cidx_free(struct Plus_head *Plus)
int Vect_coor_info(struct Map_info *Map, struct Coor_info *Info)
Update Coor_info structure.
void dig_free_plus(struct Plus_head *Plus)
Free Plus structure.
char buf[GNAME_MAX+sizeof(G3D_DIRECTORY)+2]
int Vect_close(struct Map_info *Map)
Close vector data file.
G_warning("category support for [%s] in mapset [%s] %s", name, mapset, type)
int G_debug(int level, const char *msg,...)
Print debugging message.
int Vect_cidx_save(struct Map_info *Map)
Save category index.
int G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.