GRASS Programmer's Manual
6.4.1(2011)
|
00001 00017 #include <grass/vedit.h> 00018 00028 int Vedit_flip_lines(struct Map_info *Map, struct ilist *List) 00029 { 00030 struct line_cats *Cats; 00031 struct line_pnts *Points; 00032 int i, line, type; 00033 int nlines_flipped; 00034 00035 nlines_flipped = 0; 00036 00037 Points = Vect_new_line_struct(); 00038 Cats = Vect_new_cats_struct(); 00039 00040 for (i = 0; i < List->n_values; i++) { 00041 line = List->value[i]; 00042 00043 if (!Vect_line_alive(Map, line)) 00044 continue; 00045 00046 type = Vect_read_line(Map, Points, Cats, line); 00047 00048 if (!(type & GV_LINES)) 00049 continue; 00050 00051 Vect_line_reverse(Points); 00052 00053 if (Vect_rewrite_line(Map, line, type, Points, Cats) < 0) { 00054 return -1; 00055 } 00056 00057 G_debug(3, "Vedit_flip_lines(): line=%d", line); 00058 00059 nlines_flipped++; 00060 } 00061 00062 /* destroy structures */ 00063 Vect_destroy_line_struct(Points); 00064 Vect_destroy_cats_struct(Cats); 00065 00066 return nlines_flipped; 00067 }