[GRASS-SVN] r43712 - grass/branches/releasebranch_6_4/lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Sep 27 14:49:22 EDT 2010


Author: mmetz
Date: 2010-09-27 18:49:21 +0000 (Mon, 27 Sep 2010)
New Revision: 43712

Modified:
   grass/branches/releasebranch_6_4/lib/vector/Vlib/break_lines.c
   grass/branches/releasebranch_6_4/lib/vector/Vlib/break_polygons.c
   grass/branches/releasebranch_6_4/lib/vector/Vlib/bridges.c
   grass/branches/releasebranch_6_4/lib/vector/Vlib/build_nat.c
   grass/branches/releasebranch_6_4/lib/vector/Vlib/dangles.c
   grass/branches/releasebranch_6_4/lib/vector/Vlib/remove_areas.c
   grass/branches/releasebranch_6_4/lib/vector/Vlib/remove_duplicates.c
   grass/branches/releasebranch_6_4/lib/vector/Vlib/snap.c
Log:
vector cleaning functions: show percent progress

Modified: grass/branches/releasebranch_6_4/lib/vector/Vlib/break_lines.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/vector/Vlib/break_lines.c	2010-09-27 18:11:31 UTC (rev 43711)
+++ grass/branches/releasebranch_6_4/lib/vector/Vlib/break_lines.c	2010-09-27 18:49:21 UTC (rev 43712)
@@ -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/releasebranch_6_4/lib/vector/Vlib/break_polygons.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/vector/Vlib/break_polygons.c	2010-09-27 18:11:31 UTC (rev 43711)
+++ grass/branches/releasebranch_6_4/lib/vector/Vlib/break_polygons.c	2010-09-27 18:49:21 UTC (rev 43712)
@@ -91,6 +91,7 @@
     XPnts = NULL;
 
     for (i = 1; i <= nlines; i++) {
+	G_percent(i, nlines, 1);
 	G_debug(3, "i =  %d", i);
 	if (!Vect_line_alive(Map, i))
 	    continue;
@@ -217,6 +218,7 @@
     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/releasebranch_6_4/lib/vector/Vlib/bridges.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/vector/Vlib/bridges.c	2010-09-27 18:11:31 UTC (rev 43711)
+++ grass/branches/releasebranch_6_4/lib/vector/Vlib/bridges.c	2010-09-27 18:49:21 UTC (rev 43712)
@@ -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;
 

Modified: grass/branches/releasebranch_6_4/lib/vector/Vlib/build_nat.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/vector/Vlib/build_nat.c	2010-09-27 18:11:31 UTC (rev 43711)
+++ grass/branches/releasebranch_6_4/lib/vector/Vlib/build_nat.c	2010-09-27 18:49:21 UTC (rev 43712)
@@ -557,7 +557,7 @@
 		if (format == G_INFO_FORMAT_PLAIN)
 		    fprintf(stderr, "%d..", i);
 		else
-		    fprintf(stderr, "%7d\b\b\b\b\b\b\b", i);
+		    fprintf(stderr, "%9d\b\b\b\b\b\b\b\b\b", i);
 	    }
 	    
 	    i++;

Modified: grass/branches/releasebranch_6_4/lib/vector/Vlib/dangles.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/vector/Vlib/dangles.c	2010-09-27 18:11:31 UTC (rev 43711)
+++ grass/branches/releasebranch_6_4/lib/vector/Vlib/dangles.c	2010-09-27 18:49:21 UTC (rev 43712)
@@ -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/releasebranch_6_4/lib/vector/Vlib/remove_areas.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/vector/Vlib/remove_areas.c	2010-09-27 18:11:31 UTC (rev 43711)
+++ grass/branches/releasebranch_6_4/lib/vector/Vlib/remove_areas.c	2010-09-27 18:49:21 UTC (rev 43712)
@@ -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/releasebranch_6_4/lib/vector/Vlib/remove_duplicates.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/vector/Vlib/remove_duplicates.c	2010-09-27 18:11:31 UTC (rev 43711)
+++ grass/branches/releasebranch_6_4/lib/vector/Vlib/remove_duplicates.c	2010-09-27 18:49:21 UTC (rev 43712)
@@ -64,6 +64,7 @@
     ndupl = 0;
 
     for (i = 1; i <= nlines; i++) {
+	G_percent(i, nlines, 1);
 	if (!Vect_line_alive(Map, i))
 	    continue;
 

Modified: grass/branches/releasebranch_6_4/lib/vector/Vlib/snap.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/vector/Vlib/snap.c	2010-09-27 18:11:31 UTC (rev 43711)
+++ grass/branches/releasebranch_6_4/lib/vector/Vlib/snap.c	2010-09-27 18:49:21 UTC (rev 43712)
@@ -118,6 +118,8 @@
     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,6 +161,8 @@
 	    }
 	}
     }
+    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
@@ -167,6 +171,8 @@
     for (point = 1; point <= npoints; point++) {
 	int i;
 
+	G_percent(point, npoints, 2);
+
 	G_debug(3, "  point = %d", point);
 
 	if (XPnts[point].anchor >= 0)
@@ -216,6 +222,8 @@
 	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 +386,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);



More information about the grass-commit mailing list