[GRASS-SVN] r36136 - grass/trunk/lib/vector/diglib

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Feb 28 07:33:36 EST 2009


Author: mmetz
Date: 2009-02-28 07:33:36 -0500 (Sat, 28 Feb 2009)
New Revision: 36136

Modified:
   grass/trunk/lib/vector/diglib/plus_area.c
Log:
diglib: small topology building speed up

Modified: grass/trunk/lib/vector/diglib/plus_area.c
===================================================================
--- grass/trunk/lib/vector/diglib/plus_area.c	2009-02-28 12:02:30 UTC (rev 36135)
+++ grass/trunk/lib/vector/diglib/plus_area.c	2009-02-28 12:33:36 UTC (rev 36136)
@@ -57,7 +57,16 @@
     int n_lines;
     P_LINE *Line;
     int node;
+    const char *dstr;
+    int debug_level;
 
+    dstr = G__getenv("DEBUG");
+
+    if (dstr != NULL)
+	debug_level = atoi(dstr);
+    else
+	debug_level = 0;
+	
     G_debug(3, "dig_build_area_with_line(): first_line = %d, side = %d",
 	    first_line, side);
 
@@ -106,8 +115,11 @@
 	    /* GOT ONE!  fill area struct  and return */
 	    G_debug(3, "Got one! :");
 
-	    for (i = 0; i < n_lines; i++) {
-		G_debug(3, " area line (%d) = %d", i, array[i]);
+	    /* avoid loop when not debugging */
+	    if (debug_level > 2) {
+		for (i = 0; i < n_lines; i++) {
+		    G_debug(3, " area line (%d) = %d", i, array[i]);
+		}
 	    }
 
 	    *lines = array;
@@ -468,7 +480,16 @@
     plus_t node;
     P_NODE *Node;
     P_LINE *Line;
+    const char *dstr;
+    int debug_level;
 
+    dstr = G__getenv("DEBUG");
+
+    if (dstr != NULL)
+	debug_level = atoi(dstr);
+    else
+	debug_level = 0;
+
     G_debug(3, "dig__angle_next_line: line = %d, side = %d, type = %d",
 	    current_line, side, type);
 
@@ -482,9 +503,12 @@
 
     Node = plus->Node[node];
     G_debug(3, "  n_lines = %d", Node->n_lines);
-    for (i = 0; i < Node->n_lines; i++) {
-	G_debug(3, "  i = %d line = %d angle = %f", i, Node->lines[i],
-		Node->angles[i]);
+    /* avoid loop when not debugging */
+    if (debug_level > 2) {
+	for (i = 0; i < Node->n_lines; i++) {
+	    G_debug(3, "  i = %d line = %d angle = %f", i, Node->lines[i],
+		    Node->angles[i]);
+	}
     }
 
     /* first find index for that line */



More information about the grass-commit mailing list