Go to the documentation of this file.00001
00018 #include <grass/vedit.h>
00019
00030 int Vedit_copy_lines(struct Map_info *Map, struct Map_info *FromMap,
00031 struct ilist *List)
00032 {
00033 struct line_cats *Cats;
00034 struct line_pnts *Points;
00035 int i;
00036 int type, line;
00037 int nlines_copied;
00038
00039 nlines_copied = 0;
00040 Cats = Vect_new_cats_struct();
00041 Points = Vect_new_line_struct();
00042
00043 if (!FromMap) {
00044 FromMap = Map;
00045 }
00046
00047
00048 for (i = 0; i < List->n_values; i++) {
00049 line = List->value[i];
00050
00051 if (!Vect_line_alive(FromMap, line))
00052 continue;
00053
00054 type = Vect_read_line(FromMap, Points, Cats, line);
00055
00056 G_debug(3, "Vedit_copy_lines(): type=%d, line=%d", type, line);
00057
00058
00059 if (Vect_write_line(Map, type, Points, Cats) < 0) {
00060 return -1;
00061 }
00062
00063 nlines_copied++;
00064 }
00065
00066 Vect_destroy_line_struct(Points);
00067 Vect_destroy_cats_struct(Cats);
00068
00069 return nlines_copied;
00070 }