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

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jun 13 08:06:29 EDT 2011


Author: mmetz
Date: 2011-06-13 05:06:29 -0700 (Mon, 13 Jun 2011)
New Revision: 46675

Modified:
   grass/branches/releasebranch_6_4/lib/vector/Vlib/clean_nodes.c
   grass/branches/releasebranch_6_4/lib/vector/Vlib/net.c
Log:
Vlib: sync to 6.5 where possible and harmless

Modified: grass/branches/releasebranch_6_4/lib/vector/Vlib/clean_nodes.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/vector/Vlib/clean_nodes.c	2011-06-13 11:48:49 UTC (rev 46674)
+++ grass/branches/releasebranch_6_4/lib/vector/Vlib/clean_nodes.c	2011-06-13 12:06:29 UTC (rev 46675)
@@ -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/releasebranch_6_4/lib/vector/Vlib/net.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/vector/Vlib/net.c	2011-06-13 11:48:49 UTC (rev 46674)
+++ grass/branches/releasebranch_6_4/lib/vector/Vlib/net.c	2011-06-13 12:06:29 UTC (rev 46675)
@@ -466,6 +466,7 @@
     int i, line, *pclip, cArc, nRet;
     dglSPReport_s *pSPReport;
     dglInt32_t nDistance;
+    int use_cache = 1;		/* set to 0 to disable dglib cache */
 
     G_debug(3, "Vect_net_shortest_path(): from = %d, to = %d", from, to);
 
@@ -486,22 +487,28 @@
 
     pclip = NULL;
     if (List != NULL) {
-	nRet =
-	    dglShortestPath(&(Map->graph), &pSPReport, (dglInt32_t) from,
-			    (dglInt32_t) to, clipper, pclip, &(Map->spCache));
-	/* comment out belwo and uncomment above to debug dglib cache */
-	/* nRet =
-	    dglShortestPath(&(Map->graph), &pSPReport, (dglInt32_t) from,
-			    (dglInt32_t) to, clipper, pclip, NULL); */
+	if (use_cache) {
+	    nRet =
+		dglShortestPath(&(Map->graph), &pSPReport, (dglInt32_t) from,
+				(dglInt32_t) to, clipper, pclip, &(Map->spCache));
+	}
+	else {
+	    nRet =
+		dglShortestPath(&(Map->graph), &pSPReport, (dglInt32_t) from,
+				(dglInt32_t) to, clipper, pclip, NULL);
+	}
     }
     else {
-	nRet =
-	    dglShortestDistance(&(Map->graph), &nDistance, (dglInt32_t) from,
-				(dglInt32_t) to, clipper, pclip, &(Map->spCache));
-	/* comment out belwo and uncomment above to debug dglib cache */
-	/* nRet =
-	    dglShortestDistance(&(Map->graph), &nDistance, (dglInt32_t) from,
-				(dglInt32_t) to, clipper, pclip, NULL); */
+	if (use_cache) {
+	    nRet =
+		dglShortestDistance(&(Map->graph), &nDistance, (dglInt32_t) from,
+				    (dglInt32_t) to, clipper, pclip, &(Map->spCache));
+	}
+	else {
+	    nRet =
+		dglShortestDistance(&(Map->graph), &nDistance, (dglInt32_t) from,
+				    (dglInt32_t) to, clipper, pclip, NULL);
+	}
     }
 
     if (nRet == 0) {



More information about the grass-commit mailing list