[GRASS-SVN] r43399 - grass/branches/develbranch_6/lib/vector/Vlib
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Sep 3 12:38:10 EDT 2010
Author: mmetz
Date: 2010-09-03 16:38:10 +0000 (Fri, 03 Sep 2010)
New Revision: 43399
Modified:
grass/branches/develbranch_6/lib/vector/Vlib/break_lines.c
grass/branches/develbranch_6/lib/vector/Vlib/break_polygons.c
grass/branches/develbranch_6/lib/vector/Vlib/bridges.c
grass/branches/develbranch_6/lib/vector/Vlib/clean_nodes.c
grass/branches/develbranch_6/lib/vector/Vlib/dangles.c
grass/branches/develbranch_6/lib/vector/Vlib/remove_areas.c
grass/branches/develbranch_6/lib/vector/Vlib/remove_duplicates.c
grass/branches/develbranch_6/lib/vector/Vlib/snap.c
Log:
cleaning tools: show progress, report modifications
Modified: grass/branches/develbranch_6/lib/vector/Vlib/break_lines.c
===================================================================
--- grass/branches/develbranch_6/lib/vector/Vlib/break_lines.c 2010-09-03 16:22:54 UTC (rev 43398)
+++ grass/branches/develbranch_6/lib/vector/Vlib/break_lines.c 2010-09-03 16:38:10 UTC (rev 43399)
@@ -112,9 +112,8 @@
*/
nbreaks = 0;
- G_verbose_message(_("Intersections: %5d"), nbreaks);
-
for (iline = 0; iline < nlines; iline++) {
+ G_percent(iline, nlines, 1);
if (List_break) {
aline = List_break->value[iline];
}
@@ -366,6 +365,7 @@
}
G_debug(3, "nlines = %d", nlines);
} /* for each line */
+ G_percent(nlines, nlines, 1); /* finish it */
G_verbose_message(_("Intersections: %5d"), nbreaks);
Modified: grass/branches/develbranch_6/lib/vector/Vlib/break_polygons.c
===================================================================
--- grass/branches/develbranch_6/lib/vector/Vlib/break_polygons.c 2010-09-03 16:22:54 UTC (rev 43398)
+++ grass/branches/develbranch_6/lib/vector/Vlib/break_polygons.c 2010-09-03 16:38:10 UTC (rev 43399)
@@ -114,7 +114,10 @@
nallpoints = 0;
XPnts = NULL;
+ G_verbose_message(_("Break polygons Pass 1: select break points"));
+
for (i = 1; i <= nlines; i++) {
+ G_percent(i, nlines, 1);
G_debug(3, "i = %d", i);
if (!Vect_line_alive(Map, i))
continue;
@@ -235,9 +238,13 @@
/* Second loop through lines (existing when loop is started, no need to process lines written again)
* and break at points marked for break */
+
+ G_verbose_message(_("Break polygons Pass 2: break at selected points"));
+
for (i = 1; i <= nlines; i++) {
int n_orig_points;
+ G_percent(i, nlines, 1);
G_debug(3, "i = %d", i);
if (!Vect_line_alive(Map, i))
continue;
Modified: grass/branches/develbranch_6/lib/vector/Vlib/bridges.c
===================================================================
--- grass/branches/develbranch_6/lib/vector/Vlib/bridges.c 2010-09-03 16:22:54 UTC (rev 43398)
+++ grass/branches/develbranch_6/lib/vector/Vlib/bridges.c 2010-09-03 16:38:10 UTC (rev 43399)
@@ -113,6 +113,7 @@
G_debug(1, "nlines = %d", nlines);
for (line = 1; line <= nlines; line++) {
+ G_percent(line, nlines, 1);
if (!Vect_line_alive(Map, line))
continue;
@@ -189,4 +190,6 @@
bridges_removed++;
}
}
+ G_verbose_message("Removed lines: %d", lines_removed);
+ G_verbose_message("Removed bridges: %d", bridges_removed);
}
Modified: grass/branches/develbranch_6/lib/vector/Vlib/clean_nodes.c
===================================================================
--- grass/branches/develbranch_6/lib/vector/Vlib/clean_nodes.c 2010-09-03 16:22:54 UTC (rev 43398)
+++ grass/branches/develbranch_6/lib/vector/Vlib/clean_nodes.c 2010-09-03 16:38:10 UTC (rev 43399)
@@ -39,7 +39,7 @@
Vect_clean_small_angles_at_nodes(struct Map_info *Map, int otype,
struct Map_info *Err)
{
- int node;
+ int node, nnodes;
int nmodif = 0;
struct line_pnts *Points;
struct line_cats *SCats, *LCats, *OCats;
@@ -49,9 +49,11 @@
LCats = Vect_new_cats_struct();
OCats = Vect_new_cats_struct();
- for (node = 1; node <= Vect_get_num_nodes(Map); node++) {
+ nnodes = Vect_get_num_nodes(Map);
+ for (node = 1; node <= nnodes; node++) {
int i, nlines;
+ G_percent(node, nnodes, 1);
G_debug(3, "node = %d", node);
if (!Vect_node_alive(Map, node))
continue;
@@ -246,6 +248,7 @@
if (clean || !Vect_node_alive(Map, node))
break;
}
+ nnodes = Vect_get_num_nodes(Map);
}
return (nmodif);
Modified: grass/branches/develbranch_6/lib/vector/Vlib/dangles.c
===================================================================
--- grass/branches/develbranch_6/lib/vector/Vlib/dangles.c 2010-09-03 16:22:54 UTC (rev 43398)
+++ grass/branches/develbranch_6/lib/vector/Vlib/dangles.c 2010-09-03 16:38:10 UTC (rev 43399)
@@ -168,6 +168,7 @@
G_debug(2, "nnodes = %d", nnodes);
for (node = 1; node <= nnodes; node++) {
+ G_percent(node, nnodes, 1);
G_debug(3, "node = %d", node);
if (!Vect_node_alive(Map, node))
continue;
Modified: grass/branches/develbranch_6/lib/vector/Vlib/remove_areas.c
===================================================================
--- grass/branches/develbranch_6/lib/vector/Vlib/remove_areas.c 2010-09-03 16:22:54 UTC (rev 43398)
+++ grass/branches/develbranch_6/lib/vector/Vlib/remove_areas.c 2010-09-03 16:38:10 UTC (rev 43399)
@@ -39,7 +39,7 @@
Vect_remove_small_areas(struct Map_info *Map, double thresh,
struct Map_info *Err, double *removed_area)
{
- int area;
+ int area, nareas;
int nremoved = 0;
struct ilist *List;
struct ilist *AList;
@@ -52,10 +52,12 @@
Points = Vect_new_line_struct();
Cats = Vect_new_cats_struct();
- for (area = 1; area <= Vect_get_num_areas(Map); area++) {
+ nareas = Vect_get_num_areas(Map);
+ for (area = 1; area <= nareas; area++) {
int i, j, centroid, dissolve_neighbour;
double length, size;
+ G_percent(area, nareas, 1);
G_debug(3, "area = %d", area);
if (!Vect_area_alive(Map, area))
continue;
@@ -170,6 +172,7 @@
}
nremoved++;
+ nareas = Vect_get_num_areas(Map);
}
if (removed_area)
Modified: grass/branches/develbranch_6/lib/vector/Vlib/remove_duplicates.c
===================================================================
--- grass/branches/develbranch_6/lib/vector/Vlib/remove_duplicates.c 2010-09-03 16:22:54 UTC (rev 43398)
+++ grass/branches/develbranch_6/lib/vector/Vlib/remove_duplicates.c 2010-09-03 16:38:10 UTC (rev 43399)
@@ -64,6 +64,7 @@
ndupl = 0;
for (i = 1; i <= nlines; i++) {
+ G_percent(i, nlines, 1);
if (!Vect_line_alive(Map, i))
continue;
@@ -113,6 +114,7 @@
nlines = Vect_get_num_lines(Map); /* For future when lines with cats will be rewritten */
G_debug(3, "nlines = %d\n", nlines);
}
+ G_verbose_message("Removed duplicates: %d", ndupl);
}
/*!
Modified: grass/branches/develbranch_6/lib/vector/Vlib/snap.c
===================================================================
--- grass/branches/develbranch_6/lib/vector/Vlib/snap.c 2010-09-03 16:22:54 UTC (rev 43398)
+++ grass/branches/develbranch_6/lib/vector/Vlib/snap.c 2010-09-03 16:38:10 UTC (rev 43399)
@@ -115,9 +115,12 @@
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);
@@ -159,14 +162,21 @@
}
}
}
+ 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 anchor vertices"));
+
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)
@@ -212,10 +222,14 @@
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);
@@ -378,6 +392,7 @@
}
}
} /* for each line */
+ G_percent(line_idx, List_lines->n_values, 2); /* finish it */
Vect_destroy_line_struct(Points);
Vect_destroy_line_struct(NPoints);
@@ -386,6 +401,9 @@
G_free(Index);
G_free(New);
RTreeDestroyNode(RTree);
+
+ G_verbose_message(_("Snapped vertices: %d"), nsnapped);
+ G_verbose_message(_("New vertices: %d"), ncreated);
}
/* for qsort */
More information about the grass-commit
mailing list