level_two.c

Go to the documentation of this file.
00001 
00017 #include <stdlib.h>
00018 #include <grass/gis.h>
00019 #include <grass/Vect.h>
00020 #include <grass/glocale.h>
00021 
00029 int Vect_get_num_nodes(struct Map_info *map)
00030 {
00031     return (map->plus.n_nodes);
00032 }
00033 
00042 int Vect_get_num_primitives(struct Map_info *map, int type)
00043 {
00044     int num = 0;
00045 
00046     if (type & GV_POINT)
00047         num += map->plus.n_plines;
00048     if (type & GV_LINE)
00049         num += map->plus.n_llines;
00050     if (type & GV_BOUNDARY)
00051         num += map->plus.n_blines;
00052     if (type & GV_CENTROID)
00053         num += map->plus.n_clines;
00054     if (type & GV_FACE)
00055         num += map->plus.n_flines;
00056     if (type & GV_KERNEL)
00057         num += map->plus.n_klines;
00058 
00059     return num;
00060 }
00061 
00069 int Vect_get_num_lines(struct Map_info *map)
00070 {
00071     return (map->plus.n_lines);
00072 }
00073 
00081 int Vect_get_num_areas(struct Map_info *map)
00082 {
00083     return (map->plus.n_areas);
00084 }
00085 
00093 int Vect_get_num_faces(struct Map_info *map)
00094 {
00095     return (map->plus.n_flines);
00096 }
00097 
00105 int Vect_get_num_islands(struct Map_info *map)
00106 {
00107     return (map->plus.n_isles);
00108 }
00109 
00117 int Vect_get_num_dblinks(struct Map_info *map)
00118 {
00119     return (map->dblnk->n_fields);
00120 }
00121 
00129 int Vect_get_num_updated_lines(struct Map_info *map)
00130 {
00131     return (map->plus.n_uplines);
00132 }
00133 
00142 int Vect_get_updated_line(struct Map_info *map, int idx)
00143 {
00144     return (map->plus.uplines[idx]);
00145 }
00146 
00154 int Vect_get_num_updated_nodes(struct Map_info *map)
00155 {
00156     return (map->plus.n_upnodes);
00157 }
00158 
00167 int Vect_get_updated_node(struct Map_info *map, int idx)
00168 {
00169     return (map->plus.upnodes[idx]);
00170 }
00171 
00181 int
00182 Vect_get_node_coor(struct Map_info *map, int num, double *x, double *y,
00183                    double *z)
00184 {
00185     P_NODE *Node;
00186 
00187     Node = map->plus.Node[num];
00188     *x = Node->x;
00189     *y = Node->y;
00190 
00191     if (z != NULL)
00192         *z = Node->z;
00193 
00194     return (0);
00195 }
00196 
00206 int Vect_get_line_nodes(struct Map_info *Map, int line, int *n1, int *n2)
00207 {
00208 
00209     if (Map->level < 2)
00210         G_fatal_error(_("Vector map <%s> is not open on level >= 2"),
00211                       Vect_get_full_name(Map));
00212 
00213     if (n1 != NULL)
00214         *n1 = Map->plus.Line[line]->N1;
00215 
00216     if (n2 != NULL)
00217         *n2 = Map->plus.Line[line]->N2;
00218 
00219     return 1;
00220 }
00221 
00231 int Vect_get_line_areas(struct Map_info *Map, int line, int *left, int *right)
00232 {
00233 
00234     if (Map->level < 2)
00235         G_fatal_error(_("Vector map <%s> is not open on level >= 2"),
00236                       Vect_get_full_name(Map));
00237 
00238     if (left != NULL)
00239         *left = Map->plus.Line[line]->left;
00240 
00241     if (right != NULL)
00242         *right = Map->plus.Line[line]->right;
00243 
00244     return 1;
00245 }
00246 
00255 int Vect_get_node_n_lines(struct Map_info *Map, int node)
00256 {
00257 
00258     if (Map->level < 2)
00259         G_fatal_error(_("Vector map <%s> is not open on level >= 2"),
00260                       Vect_get_full_name(Map));
00261 
00262     return (Map->plus.Node[node]->n_lines);
00263 
00264 }
00265 
00275 int Vect_get_node_line(struct Map_info *Map, int node, int line)
00276 {
00277     if (Map->level < 2)
00278         G_fatal_error(_("Vector map <%s> is not open on level >= 2"),
00279                       Vect_get_full_name(Map));
00280 
00281     return (Map->plus.Node[node]->lines[line]);
00282 }
00283 
00293 float Vect_get_node_line_angle(struct Map_info *Map, int node, int line)
00294 {
00295     if (Map->level < 2)
00296         G_fatal_error(_("Vector map <%s> is not open on level >= 2"),
00297                       Vect_get_full_name(Map));
00298 
00299     return (Map->plus.Node[node]->angles[line]);
00300 }
00301 
00312 int Vect_get_centroid_area(struct Map_info *Map, int centroid)
00313 {
00314     if (Map->level < 2)
00315         G_fatal_error(_("Vector map <%s> is not open on level >= 2"),
00316                       Vect_get_full_name(Map));
00317 
00318     return (Map->plus.Line[centroid]->left);
00319 }
Generated on Tue Apr 6 13:28:10 2010 for GRASS Programmer's Manual by  doxygen 1.6.3