00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <grass/Vect.h>
00019
00020
00021 static int read_next_dummy () { return -1; }
00022
00023 #ifndef HAVE_OGR
00024 static int format () { G_fatal_error ("Requested format is not compiled in this version"); return 0; }
00025 #endif
00026
00027 static int (*Read_next_line_array[][3]) () =
00028 {
00029 { read_next_dummy, V1_read_next_line_nat, V2_read_next_line_nat }
00030 #ifdef HAVE_OGR
00031 ,{ read_next_dummy, V1_read_next_line_ogr, V2_read_next_line_ogr }
00032 #else
00033 ,{ read_next_dummy, format, format }
00034 #endif
00035 };
00036
00037 static int (*V2_read_line_array[]) () =
00038 {
00039 V2_read_line_nat
00040 #ifdef HAVE_OGR
00041 , V2_read_line_ogr
00042 #else
00043 , format
00044 #endif
00045 };
00046
00057 int
00058 Vect_read_next_line (
00059 struct Map_info *Map,
00060 struct line_pnts *line_p,
00061 struct line_cats *line_c)
00062 {
00063 #ifdef GDEBUG
00064 G_debug (3, "Vect_read_next_line()");
00065 #endif
00066
00067 if (!VECT_OPEN (Map))
00068 return -1;
00069
00070 return (*Read_next_line_array[Map->format][Map->level]) (Map, line_p, line_c);
00071 }
00072
00084 int
00085 Vect_read_line (
00086 struct Map_info *Map,
00087 struct line_pnts *line_p,
00088 struct line_cats *line_c,
00089 int line)
00090 {
00091
00092 G_debug (3, "Vect_read_line()");
00093
00094 if (!VECT_OPEN (Map))
00095 G_fatal_error ( "Vect_read_line(): vector is not opened" );
00096
00097 if (line < 1 || line > Map->plus.n_lines)
00098 G_fatal_error ( "Vect_read_line(): line '%d' is not reasonable (max line in map: %d)",
00099 line, Map->plus.n_lines );
00100
00101 return (*V2_read_line_array[Map->format]) (Map, line_p, line_c, line);
00102 }
00103
00110 int
00111 Vect_line_alive ( struct Map_info *Map, int line )
00112 {
00113 if ( Map->plus.Line[line] != NULL ) return 1;
00114
00115 return 0;
00116 }
00117
00124 int
00125 Vect_node_alive ( struct Map_info *Map, int node )
00126 {
00127 if ( Map->plus.Node[node] != NULL ) return 1;
00128
00129 return 0;
00130 }
00131
00138 int
00139 Vect_area_alive ( struct Map_info *Map, int area )
00140 {
00141 if ( Map->plus.Area[area] != NULL ) return 1;
00142
00143 return 0;
00144 }
00145
00152 int
00153 Vect_isle_alive ( struct Map_info *Map, int isle )
00154 {
00155 if ( Map->plus.Isle[isle] != NULL ) return 1;
00156
00157 return 0;
00158 }
00159