GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
close_nat.c
Go to the documentation of this file.
1 
2 /****************************************************************************
3 *
4 * MODULE: Vector library
5 *
6 * AUTHOR(S): Original author CERL, probably Dave Gerdes or Mike Higgins.
7 * Update to GRASS 5.7 Radim Blazek and David D. Gray.
8 *
9 * PURPOSE: Higher level functions for reading/writing/manipulating vectors.
10 *
11 * COPYRIGHT: (C) 2001 by the GRASS Development Team
12 *
13 * This program is free software under the GNU General Public
14 * License (>=v2). Read the file COPYING that comes with GRASS
15 * for details.
16 *
17 *****************************************************************************/
18 #include <grass/Vect.h>
19 #include <stdlib.h>
20 
21 /*
22  ** return 0 on success
23  ** non-zero on error
24  */
25 int V1_close_nat(struct Map_info *Map)
26 {
27  struct Coor_info CInfo;
28 
29  G_debug(1, "V1_close_nat(): name = %s mapset= %s", Map->name,
30  Map->mapset);
31  if (!VECT_OPEN(Map))
32  return 1;
33 
34  if (Map->mode == GV_MODE_WRITE || Map->mode == GV_MODE_RW) {
35  Vect_coor_info(Map, &CInfo);
36  Map->head.size = CInfo.size;
37  dig__write_head(Map);
38 
39  Vect__write_head(Map);
40  Vect_write_dblinks(Map);
41  }
42 
43  /* close coor file */
44  fclose(Map->dig_fp.file);
45  dig_file_free(&(Map->dig_fp));
46 
47  return 0;
48 }
void dig_file_free(GVFILE *file)
Free GVFILE.
Definition: file.c:269
int V1_close_nat(struct Map_info *Map)
Definition: close_nat.c:25
int Vect__write_head(struct Map_info *Map)
Writes head information to text file.
int Vect_write_dblinks(struct Map_info *Map)
Write dblinks to file.
Definition: field.c:690
int Vect_coor_info(struct Map_info *Map, struct Coor_info *Info)
Update Coor_info structure.
tuple Map
Definition: render.py:1310
int G_debug(int level, const char *msg,...)
Print debugging message.
Definition: gis/debug.c:51
fclose(fd)
int dig__write_head(struct Map_info *Map)
Definition: head.c:22