21 #include <grass/gis.h>
22 #include <grass/Vect.h>
23 #include <grass/glocale.h>
26 remove_bridges(
struct Map_info *
Map,
int chtype,
struct Map_info *Err);
46 remove_bridges(Map, 0, Err);
67 remove_bridges(Map, 1, Err);
84 remove_bridges(
struct Map_info *
Map,
int chtype,
struct Map_info *Err)
86 int i,
type, nlines, line;
87 int left, right, node1, node2, current_line, next_line;
88 int bridges_removed = 0;
89 int lines_removed = 0;
91 struct Plus_head *Plus;
92 struct line_pnts *Points;
93 struct line_cats *Cats;
94 struct ilist *CycleList;
95 struct ilist *BridgeList;
97 int dangle, other_side;
100 lmsg =
"changed lines";
102 lmsg =
"removed lines";
113 G_debug(1,
"nlines = %d", nlines);
115 for (line = 1; line <= nlines; line++) {
121 if (!(type & GV_BOUNDARY))
126 if (left != 0 || right != 0)
129 G_debug(2,
"line %d - bridge candidate", line);
133 if (abs(node1) == abs(node2))
136 current_line = -line;
153 if (abs(next_line) == abs(current_line)) {
154 G_debug(4,
" dangle -> no bridge");
158 if (abs(next_line) == line) {
161 G_debug(5,
" other side reached");
169 current_line = -next_line;
172 if (!dangle && other_side) {
173 G_debug(3,
" line %d is part of bridge chain", line);
175 for (i = 0; i < BridgeList->n_values; i++) {