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