瀏覽代碼

easier dglib cache debugging

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@43859 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz 14 年之前
父節點
當前提交
19622a9935
共有 1 個文件被更改,包括 21 次插入14 次删除
  1. 21 14
      lib/vector/Vlib/net.c

+ 21 - 14
lib/vector/Vlib/net.c

@@ -463,6 +463,7 @@ Vect_net_shortest_path(struct Map_info *Map, int from, int to,
     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 @@ Vect_net_shortest_path(struct Map_info *Map, int from, int to,
 
     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) {