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