[GRASS-SVN] r43859 - grass/trunk/lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Oct 11 09:20:23 EDT 2010


Author: mmetz
Date: 2010-10-11 06:20:22 -0700 (Mon, 11 Oct 2010)
New Revision: 43859

Modified:
   grass/trunk/lib/vector/Vlib/net.c
Log:
easier dglib cache debugging

Modified: grass/trunk/lib/vector/Vlib/net.c
===================================================================
--- grass/trunk/lib/vector/Vlib/net.c	2010-10-11 13:19:39 UTC (rev 43858)
+++ grass/trunk/lib/vector/Vlib/net.c	2010-10-11 13:20:22 UTC (rev 43859)
@@ -463,6 +463,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);
 
@@ -483,22 +484,28 @@
 
     pclip = NULL;
     if (List != NULL) {
-	nRet =
-	    dglShortestPath(&(Map->graph), &pSPReport, (dglInt32_t) from,
-			    (dglInt32_t) to, clipper, pclip, &(Map->spCache));
-	/* comment out above and uncomment below 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 above and uncomment below 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