constraint.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 <grass/Vect.h>
00019 #include <grass/gis.h>
00020 /*
00021    **  These routines can affect the read_next_line funtions
00022    **    by restricting what they return.
00023    **  They are applied on a per map basis.
00024    **
00025    **  These do not affect the lower level direct read functions.
00026  */
00027 
00028 
00036 int 
00037 Vect_set_constraint_region ( struct Map_info *Map,
00038                              double n, double s, double e, double w, double t, double b )
00039 {
00040   if (n <= s)
00041     return (-1);
00042   if (e <= w)
00043     return (-1);
00044 
00045   Map->Constraint_region_flag = 1;
00046   Map->Constraint_N = n;
00047   Map->Constraint_S = s;
00048   Map->Constraint_E = e;
00049   Map->Constraint_W = w;
00050   Map->Constraint_T = t;
00051   Map->Constraint_B = b;
00052   Map->proj = G_projection ();
00053 
00054   return (0);
00055 }                               /*  dig_init_box()  */
00056 
00064 int 
00065 Vect_get_constraint_box ( struct Map_info *Map,  BOUND_BOX *Box )
00066 {
00067     Box->N = Map->Constraint_N;
00068     Box->S = Map->Constraint_S;
00069     Box->E = Map->Constraint_E;
00070     Box->W = Map->Constraint_W;
00071     Box->T = Map->Constraint_T;
00072     Box->B = Map->Constraint_B;
00073 
00074     return 0;
00075 }
00076 /*
00077    **  Normally, All 'Alive' lines will be returned unless overridden
00078    **  by this function.   You can specified all the types you are interested
00079    **   in  (by oring their types together).  You can use this to say 
00080    **  exclude Area type lines.
00081    **
00082    **   By default all DEAD lines are ignored by the read_next_line () functions
00083    **  This too can be overridden by including their types.
00084    **
00085    **  Refer to  dig_defines for the line type Defines
00086    **
00087    **   All lines can be forced to be read by setting type = -1
00088    **
00089  */
00090 
00099 int 
00100 Vect_set_constraint_type (
00101                            struct Map_info *Map,
00102                            int type)
00103 {
00104   Map->Constraint_type = type;
00105   Map->Constraint_type_flag = 1;
00106 
00107   return 0;
00108 }
00109 
00116 int 
00117 Vect_remove_constraints (struct Map_info *Map)
00118 {
00119   Map->Constraint_region_flag = 0;
00120   Map->Constraint_type_flag = 0;
00121 
00122   return 0;
00123 }

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