From 11fe52e71548ec4fe9419c85fd99bda2121068e4 Mon Sep 17 00:00:00 2001 From: Julius Friedman Date: Wed, 11 Mar 2020 09:56:36 -0400 Subject: [PATCH] Fixed bug in other test case by using `ManyToMany` instead of `CalculateManyToMany` --- src/Itinero/Router.cs | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/Itinero/Router.cs b/src/Itinero/Router.cs index dd937ad3..0788a9ec 100644 --- a/src/Itinero/Router.cs +++ b/src/Itinero/Router.cs @@ -1320,13 +1320,24 @@ public override Result TryCalculateWeight(IProfileInstance profileIns } weights = algorithm.Weights; } - //else if (contracted.HasNodeBasedGraph && - // contracted.NodeBasedIsEdgedBased) - //{ // use vertex-based graph for edge-based routing. - // weights = Itinero.Algorithms.Contracted.Dual.RouterExtensions.CalculateManyToMany(contracted, - // _db, profileInstance.Profile, - // weightHandler, sources, targets, maxSearch, cancellationToken).Value; - //} + else if (contracted.HasNodeBasedGraph && + contracted.NodeBasedIsEdgedBased) + { // use vertex-based graph for edge-based routing. + //weights = Itinero.Algorithms.Contracted.Dual.RouterExtensions.CalculateManyToMany(contracted, + // _db, profileInstance.Profile, + // weightHandler, sources, targets, maxSearch, cancellationToken).Value; + + var algorithm = new Itinero.Algorithms.Default.ManyToMany(_db, weightHandler, sources, targets, maxSearch); + algorithm.Run(cancellationToken); + if (!algorithm.HasSucceeded) + { + return new Result(algorithm.ErrorMessage, (message) => + { + return new RouteNotFoundException(message); + }); + } + weights = algorithm.Weights; + } else { // use node-based routing. var algorithm = new Itinero.Algorithms.Contracted.ManyToManyWeightsBidirectionalDykstra(_db, profileInstance.Profile, weightHandler,