update.c

Go to the documentation of this file.
00001 /***************************************************************************
00002 *
00003 * MODULE:       Vector library 
00004 *               
00005 * AUTHOR(S):    Radim Blazek
00006 *
00007 * PURPOSE:      Lower level functions for reading/writing/manipulating vectors.
00008 *
00009 * COPYRIGHT:    (C) 2001 by the GRASS Development Team
00010 *
00011 *               This program is free software under the GNU General Public
00012 *               License (>=v2). Read the file COPYING that comes with GRASS
00013 *               for details.
00014 *
00015 *****************************************************************************/
00016 #include <stdlib.h>
00017 #include <grass/gis.h>
00018 #include <grass/Vect.h>
00019 
00020 void
00021 dig_line_reset_updated ( struct Plus_head *Plus )
00022 {
00023     Plus->n_uplines = 0;
00024 }
00025 
00026 void
00027 dig_line_add_updated ( struct Plus_head *Plus, int line )
00028 {
00029     int i;
00030 
00031     G_debug (3, "dig_line_add_updated(): line = %d", line);
00032 
00033     /* Check if already in list */
00034     for ( i = 0; i < Plus->n_uplines; i++ )
00035         if ( Plus->uplines[i] == line ) return;
00036     
00037     /* Alloc space if needed */
00038     if ( Plus->n_uplines == Plus->alloc_uplines ) {
00039          Plus->alloc_uplines += 1000;
00040          Plus->uplines = (int *) G_realloc ( Plus->uplines, Plus->alloc_uplines * sizeof(int) );
00041     }
00042 
00043     Plus->uplines[Plus->n_uplines] = line;
00044     Plus->n_uplines++;
00045 }
00046 
00047 void 
00048 dig_node_reset_updated ( struct Plus_head *Plus )
00049 {
00050     Plus->n_upnodes = 0;
00051 }
00052 
00053 void
00054 dig_node_add_updated ( struct Plus_head *Plus, int node )
00055 {
00056     int i;
00057 
00058     G_debug (3, "dig_node_add_updated(): node = %d", node);
00059 
00060     /* Check if already in list */
00061     for ( i = 0; i < Plus->n_upnodes; i++ )
00062         if ( Plus->upnodes[i] == node ) return;
00063     
00064     /* Alloc space if needed */
00065     if ( Plus->n_upnodes == Plus->alloc_upnodes ) {
00066          Plus->alloc_upnodes += 1000;
00067          Plus->upnodes = (int *) G_realloc ( Plus->upnodes, Plus->alloc_upnodes * sizeof(int) );
00068     }
00069 
00070     Plus->upnodes[Plus->n_upnodes] = node;
00071     Plus->n_upnodes++;
00072 }
00073 

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