GRASS Programmer's Manual
6.4.3(2013)-r
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Macros
Pages
vector/vedit/copy.c
Go to the documentation of this file.
1
15
#include <grass/vedit.h>
16
27
int
Vedit_copy_lines
(
struct
Map_info *
Map
,
struct
Map_info *FromMap,
28
struct
ilist *List)
29
{
30
struct
line_cats *Cats;
31
struct
line_pnts *Points;
32
int
i;
33
int
type
, line;
34
int
nlines_copied;
35
36
nlines_copied = 0;
37
Cats =
Vect_new_cats_struct
();
38
Points =
Vect_new_line_struct
();
39
40
if
(!FromMap) {
41
FromMap =
Map
;
42
}
43
44
/* for each line, make a copy */
45
for
(i = 0; i < List->n_values; i++) {
46
line = List->value[i];
47
48
if
(!
Vect_line_alive
(FromMap, line))
49
continue
;
50
51
type =
Vect_read_line
(FromMap, Points, Cats, line);
52
53
G_debug
(3,
"Vedit_copy_lines(): type=%d, line=%d"
, type, line);
54
55
/* copy */
56
if
(
Vect_write_line
(Map, type, Points, Cats) < 0) {
57
return
-1;
58
}
59
60
nlines_copied++;
61
}
62
63
Vect_destroy_line_struct
(Points);
64
Vect_destroy_cats_struct
(Cats);
65
66
return
nlines_copied;
67
}
lib
vector
vedit
copy.c
Generated on Thu Sep 26 2013 09:47:59 for GRASS Programmer's Manual by
1.8.4