20 #define REMOVE_DANGLE 0 21 #define CHTYPE_DANGLE 1 22 #define SELECT_DANGLE 2 24 static void dangles(
struct Map_info *,
int,
int,
double,
125 static void dangles(
struct Map_info *Map,
int type,
int option,
126 double maxlength,
struct Map_info *Err,
127 struct ilist *List_dangle)
131 int i, line, ltype, next_line = 0, nnodelines;
132 int nnodes, node, node1, node2, next_node;
133 int lcount, tmp_next_line = 0;
140 next_line = tmp_next_line = 0;
154 lmsg =
_(
"Selected");
165 G_debug(2,
"nnodes = %d", nnodes);
167 for (node = 1; node <= nnodes; node++) {
176 for (i = 0; i < nnodelines; i++) {
178 G_debug(3,
" node line %d = %d", i, line);
190 G_debug(3,
" node %d is dangle -> follow the line %d", node,
193 while (next_line != 0) {
198 next_node = next_line > 0 ? node2 : node1;
200 G_debug(3,
" next_node = %d", next_node);
205 for (i = 0; i < nnodelines; i++) {
207 G_debug(3,
" node line %d = %d", i, line);
211 if (ltype & type && abs(line) != abs(next_line)) {
213 tmp_next_line = line;
217 next_line = tmp_next_line;
225 for (i = 0; i < List->
n_values; i++) {
231 if (maxlength < 0 || length < maxlength) {
232 G_debug(3,
" delete the chain (length=%g)", length);
234 for (i = 0; i < List->
n_values; i++) {
plus_t Vect_get_num_nodes(const struct Map_info *)
Get number of nodes in vector map.
int Vect_reset_list(struct ilist *)
Reset ilist structure.
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 n_values
Number of values in the list.
double Vect_line_length(const struct line_pnts *)
Calculate line length, 3D-length in case of 3D vector line.
void Vect_remove_dangles(struct Map_info *Map, int type, double maxlength, struct Map_info *Err)
Remove dangles from vector map.
int Vect_get_node_n_lines(const struct Map_info *, int)
Get number of lines for node.
void Vect_select_dangles(struct Map_info *Map, int type, double maxlength, struct ilist *List)
Select dangles from vector map.
Feature geometry info - coordinates.
void Vect_chtype_dangles(struct Map_info *Map, double maxlength, struct Map_info *Err)
Change boundary dangles to lines.
int Vect_get_node_line(const struct Map_info *, int, int)
Get line id for node line index.
struct line_pnts * Vect_new_line_struct(void)
Creates and initializes a line_pnts structure.
off_t Vect_write_line(struct Map_info *, int, const struct line_pnts *, const struct line_cats *)
Writes a new feature.
int Vect_get_line_nodes(const struct Map_info *, int, int *, int *)
Get line nodes.
void G_percent(long, long, int)
Print percent complete messages.
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)
struct line_cats * Vect_new_cats_struct(void)
Creates and initializes line_cats structure.
int Vect_list_append(struct ilist *, int)
Append new item to the end of list if not yet present.
int Vect_node_alive(const struct Map_info *, int)
Check if node is alive or dead (topological level required)
int * value
Array of values.
void void G_verbose_message(const char *,...) __attribute__((format(printf
int Vect_read_line(const struct Map_info *, struct line_pnts *, struct line_cats *, int)
Read vector feature (topological level required)
int G_debug(int, const char *,...) __attribute__((format(printf