Browse Source

Vlib: small topology building speed up

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@36138 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 16 years ago
parent
commit
8bc73ae874
1 changed files with 17 additions and 5 deletions
  1. 17 5
      lib/vector/Vlib/select.c

+ 17 - 5
lib/vector/Vlib/select.c

@@ -93,6 +93,15 @@ Vect_select_areas_by_box(struct Map_info *Map, BOUND_BOX * Box,
 			 struct ilist *list)
 {
     int i;
+    const char *dstr;
+    int debug_level;
+
+    dstr = G__getenv("DEBUG");
+
+    if (dstr != NULL)
+	debug_level = atoi(dstr);
+    else
+	debug_level = 0;
 
     G_debug(3, "Vect_select_areas_by_box()");
     G_debug(3, "Box(N,S,E,W,T,B): %e, %e, %e, %e, %e, %e", Box->N, Box->S,
@@ -105,12 +114,15 @@ Vect_select_areas_by_box(struct Map_info *Map, BOUND_BOX * Box,
 
     dig_select_areas(&(Map->plus), Box, list);
     G_debug(3, "  %d areas selected", list->n_values);
-    for (i = 0; i < list->n_values; i++) {
-	G_debug(3, "  area = %d pointer to area structure = %lx",
-		list->value[i],
-		(unsigned long)Map->plus.Area[list->value[i]]);
-
+    /* avoid loop when not debugging */
+    if (debug_level > 2) {
+	for (i = 0; i < list->n_values; i++) {
+	    G_debug(3, "  area = %d pointer to area structure = %lx",
+		    list->value[i],
+		    (unsigned long)Map->plus.Area[list->value[i]]);
+	}
     }
+    
     return list->n_values;
 }