|
@@ -116,9 +116,13 @@ Vect_snap_lines_list(struct Map_info *Map, struct ilist *List_lines,
|
|
|
nvertices = 0;
|
|
|
XPnts = NULL;
|
|
|
|
|
|
+ G_verbose_message(_("Snap vertices Pass 1: select points"));
|
|
|
+
|
|
|
for (line_idx = 0; line_idx < List_lines->n_values; line_idx++) {
|
|
|
int v;
|
|
|
|
|
|
+ G_percent(line_idx, List_lines->n_values, 2);
|
|
|
+
|
|
|
line = List_lines->value[line_idx];
|
|
|
|
|
|
G_debug(3, "line = %d", line);
|
|
@@ -160,14 +164,20 @@ Vect_snap_lines_list(struct Map_info *Map, struct ilist *List_lines,
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ G_percent(line_idx, List_lines->n_values, 2); /* finish it */
|
|
|
+
|
|
|
npoints = point - 1;
|
|
|
|
|
|
/* Go through all registered points and if not yet marked mark it as anchor and assign this anchor
|
|
|
* to all not yet marked points in threshold */
|
|
|
+ G_verbose_message(_("Snap vertices Pass 2: assign points to snap to"));
|
|
|
+
|
|
|
nanchors = ntosnap = 0;
|
|
|
for (point = 1; point <= npoints; point++) {
|
|
|
int i;
|
|
|
|
|
|
+ G_percent(point, npoints, 2);
|
|
|
+
|
|
|
G_debug(3, " point = %d", point);
|
|
|
|
|
|
if (XPnts[point].anchor >= 0)
|
|
@@ -213,10 +223,14 @@ Vect_snap_lines_list(struct Map_info *Map, struct ilist *List_lines,
|
|
|
|
|
|
nsnapped = ncreated = 0;
|
|
|
|
|
|
+ G_verbose_message(_("Snap vertices Pass 3: snap to assigned points"));
|
|
|
+
|
|
|
for (line_idx = 0; line_idx < List_lines->n_values; line_idx++) {
|
|
|
int v, spoint, anchor;
|
|
|
int changed = 0;
|
|
|
|
|
|
+ G_percent(line_idx, List_lines->n_values, 2);
|
|
|
+
|
|
|
line = List_lines->value[line_idx];
|
|
|
|
|
|
G_debug(3, "line = %d", line);
|
|
@@ -380,6 +394,8 @@ Vect_snap_lines_list(struct Map_info *Map, struct ilist *List_lines,
|
|
|
}
|
|
|
} /* for each line */
|
|
|
|
|
|
+ G_percent(line_idx, List_lines->n_values, 2); /* finish it */
|
|
|
+
|
|
|
Vect_destroy_line_struct(Points);
|
|
|
Vect_destroy_line_struct(NPoints);
|
|
|
Vect_destroy_cats_struct(Cats);
|
|
@@ -387,6 +403,9 @@ Vect_snap_lines_list(struct Map_info *Map, struct ilist *List_lines,
|
|
|
G_free(Index);
|
|
|
G_free(New);
|
|
|
RTreeDestroyNode(RTree);
|
|
|
+
|
|
|
+ G_verbose_message(_("Snapped vertices: %d"), nsnapped);
|
|
|
+ G_verbose_message(_("New vertices: %d"), ncreated);
|
|
|
}
|
|
|
|
|
|
/* for qsort */
|