init_head.c

Go to the documentation of this file.
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 <string.h>
00019 #include <grass/gis.h>
00020 #include <grass/Vect.h>
00021 
00022 /*
00023    **
00024    **  Initialize Head structure.  To make sure that we are not writing
00025    **    out garbage to a file.
00026    **
00027  */
00028 
00029 int 
00030 Vect__init_head (struct Map_info *Map)
00031 {
00032     char buf[64];
00033 
00034     Map->head.organization = NULL; 
00035     Vect_set_organization ( Map, "" );
00036     Map->head.date = NULL;
00037     Vect_set_date ( Map, "" );
00038     Map->head.your_name = NULL;
00039     sprintf (buf, "%s", G_whoami());
00040     Vect_set_person ( Map, buf );
00041     Map->head.map_name = NULL;
00042     Vect_set_map_name ( Map, "" );
00043     Map->head.source_date = NULL;
00044     sprintf (buf, "%s", G_date());
00045     Vect_set_map_date ( Map, buf );
00046     Map->head.line_3 = NULL;
00047     Vect_set_comment ( Map, "" );
00048     
00049     Vect_set_scale ( Map, 1 );
00050     Vect_set_zone ( Map, 0 );
00051     Vect_set_thresh ( Map, 0.0 );
00052 
00053     Map->plus.Spidx_built = 0;
00054     Map->plus.release_support = 0;
00055     Map->plus.update_cidx = 0;
00056 
00057     return 0;
00058 }
00059 
00066 int 
00067 Vect_copy_head_data (struct Map_info *from, struct Map_info *to)
00068 {
00069     Vect_set_organization ( to, Vect_get_organization(from) );
00070     Vect_set_date ( to, Vect_get_date(from) );
00071     Vect_set_person ( to, Vect_get_person(from) );
00072     Vect_set_map_name ( to, Vect_get_map_name(from) );
00073     Vect_set_map_date ( to, Vect_get_map_date(from) );
00074     Vect_set_comment ( to, Vect_get_comment(from) );
00075     
00076     Vect_set_scale ( to, Vect_get_scale(from) );
00077     Vect_set_zone ( to, Vect_get_zone(from) );
00078     Vect_set_thresh ( to, Vect_get_thresh(from) );
00079   
00080     return 0;
00081 }

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