20 #define REMOVE_DANGLE 0
21 #define CHTYPE_DANGLE 1
22 #define SELECT_DANGLE 2
122 static void dangles(
struct Map_info *Map,
int type,
int option,
123 double maxlength,
struct Map_info *Err,
124 struct ilist *List_dangle)
128 int i, line, ltype, next_line = 0, nnodelines;
129 int nnodes, node, node1, node2, next_node;
130 int lcount, tmp_next_line = 0;
137 next_line = tmp_next_line = 0;
151 lmsg =
_(
"Selected");
162 G_debug(2,
"nnodes = %d", nnodes);
164 for (node = 1; node <= nnodes; node++) {
173 for (i = 0; i < nnodelines; i++) {
175 G_debug(3,
" node line %d = %d", i, line);
187 G_debug(3,
" node %d is dangle -> follow the line %d", node,
190 while (next_line != 0) {
196 next_node = next_line > 0 ? node2 : node1;
198 G_debug(3,
" next_node = %d", next_node);
204 for (i = 0; i < nnodelines; i++) {
206 G_debug(3,
" node line %d = %d", i, line);
210 if (ltype & type && abs(line) != abs(next_line)) {
212 tmp_next_line = line;
216 next_line = tmp_next_line;
223 for (i = 0; i < List->
n_values; i++) {
229 if (maxlength < 0 || length < maxlength) {
230 G_debug(3,
" delete the chain (length=%g)", length);
232 for (i = 0; i < List->
n_values; i++) {
void Vect_remove_dangles(struct Map_info *Map, int type, double maxlength, struct Map_info *Err)
Remove dangles from vector map.
void Vect_chtype_dangles(struct Map_info *Map, double maxlength, struct Map_info *Err)
Change boundary dangles to lines.
void Vect_select_dangles(struct Map_info *Map, int type, double maxlength, struct ilist *List)
Select dangles from vector map.
void G_percent(long, long, int)
Print percent complete messages.
void void G_verbose_message(const char *,...) __attribute__((format(printf
int G_debug(int, const char *,...) __attribute__((format(printf
off_t Vect_rewrite_line(struct Map_info *, off_t, int, const struct line_pnts *, const struct line_cats *)
Rewrites existing feature (topological level required)
int Vect_get_line_nodes(struct Map_info *, int, int *, int *)
Get line nodes.
double Vect_line_length(const struct line_pnts *)
Calculate line length, 3D-length in case of 3D vector line.
int Vect_list_append(struct ilist *, int)
Append new item to the end of list if not yet present.
int Vect_read_line(struct Map_info *, struct line_pnts *, struct line_cats *, int)
Read vector feature (topological level required)
struct ilist * Vect_new_list(void)
Creates and initializes a struct ilist.
int Vect_delete_line(struct Map_info *, off_t)
Delete existing feature (topological level required)
off_t Vect_write_line(struct Map_info *, int, const struct line_pnts *, const struct line_cats *)
Writes a new feature.
struct line_pnts * Vect_new_line_struct(void)
Creates and initializes a line_pnts structure.
int Vect_get_node_n_lines(struct Map_info *, int)
Get number of lines for node.
plus_t Vect_get_num_nodes(struct Map_info *)
Get number of nodes in vector map.
int Vect_node_alive(struct Map_info *, int)
Check if node is alive or dead (topological level required)
int Vect_get_node_line(struct Map_info *, int, int)
Get line id for node line index.
struct line_cats * Vect_new_cats_struct(void)
Creates and initializes line_cats structure.
int Vect_reset_list(struct ilist *)
Reset ilist structure.
int n_values
Number of values in the list.
int * value
Array of values.
Feature geometry info - coordinates.