close_nat.c

Go to the documentation of this file.
00001 /****************************************************************************
00002 *
00003 * MODULE:       Vector library 
00004 *               
00005 * AUTHOR(S):    Original author CERL, probably Dave Gerdes or Mike Higgins.
00006 *               Update to GRASS 5.7 Radim Blazek and David D. Gray.
00007 *
00008 * PURPOSE:      Higher level functions for reading/writing/manipulating vectors.
00009 *
00010 * COPYRIGHT:    (C) 2001 by the GRASS Development Team
00011 *
00012 *               This program is free software under the GNU General Public
00013 *               License (>=v2). Read the file COPYING that comes with GRASS
00014 *               for details.
00015 *
00016 *****************************************************************************/
00017 #include <grass/Vect.h>
00018 #include <stdlib.h>
00019 
00020 /* 
00021 ** return 0 on success
00022 **        non-zero on error
00023 */
00024 int 
00025 V1_close_nat (struct Map_info *Map)
00026 {
00027   struct Coor_info CInfo;
00028     
00029   G_debug (1, "V1_close_nat(): name = %s mapset= %s", Map->name, Map->mapset);
00030   if (!VECT_OPEN (Map))
00031     return 1;
00032 
00033   if (Map->mode == GV_MODE_WRITE || Map->mode == GV_MODE_RW) {
00034     Vect_coor_info ( Map, &CInfo);
00035     Map->head.size = CInfo.size;
00036     dig__write_head (Map);
00037 
00038     Vect__write_head (Map);
00039     Vect_write_dblinks ( Map );
00040   }
00041 
00042   /* close coor file */
00043   fclose (Map->dig_fp.file);
00044   dig_file_free ( &(Map->dig_fp) );
00045 
00046   return 0;
00047 }
00048 

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