|
@@ -463,6 +463,7 @@ Vect_net_shortest_path(struct Map_info *Map, int from, int to,
|
|
int i, line, *pclip, cArc, nRet;
|
|
int i, line, *pclip, cArc, nRet;
|
|
dglSPReport_s *pSPReport;
|
|
dglSPReport_s *pSPReport;
|
|
dglInt32_t nDistance;
|
|
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);
|
|
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;
|
|
pclip = NULL;
|
|
if (List != 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 {
|
|
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) {
|
|
if (nRet == 0) {
|