Skip to content

Commit 66b69c5

Browse files
committed
feat: enable RPHAST on an edge-based CH graph
1 parent 294bbc2 commit 66b69c5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

ors-engine/src/main/java/org/heigit/ors/matrix/MatrixRequest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,25 +201,25 @@ public MatrixResult computeMatrix(RoutingProfile routingProfile) throws Exceptio
201201
String encoderName = RoutingProfileType.getEncoderName(getProfileType());
202202
FlagEncoder flagEncoder = gh.getEncodingManager().getEncoder(encoderName);
203203
PMap hintsMap = new PMap();
204+
boolean hasTurnCosts = Boolean.TRUE.equals(routingProfile.getProfileProperties().getBuild().getEncoderOptions().getTurnCosts());
204205
ProfileTools.setWeightingMethod(hintsMap, getWeightingMethodOrDefault(), getProfileType(), false);
205206
ProfileTools.setWeighting(hintsMap, getWeightingMethodOrDefault(), getProfileType(), false);
206-
String chProfileName = ProfileTools.makeProfileName(encoderName, hintsMap.getString("weighting", ""), false);
207-
String coreProfileName = ProfileTools.makeProfileName(encoderName, hintsMap.getString("weighting", ""), true);
207+
String profileName = ProfileTools.makeProfileName(encoderName, hintsMap.getString("weighting", ""), hasTurnCosts);
208208

209209
//TODO Refactoring : probably remove MatrixAlgorithmFactory alltogether as the checks for algorithm choice have to be performed here again. Or combine in a single check nicely
210210
try {
211211
// RPHAST
212-
if (!getFlexibleMode() && gh.getCHPreparationHandler().isEnabled() && routingProfile.hasCHProfile(chProfileName)) {
213-
return computeRPHASTMatrix(gh, flagEncoder, chProfileName);
212+
if (!getFlexibleMode() && gh.getCHPreparationHandler().isEnabled() && routingProfile.hasCHProfile(profileName)) {
213+
return computeRPHASTMatrix(gh, flagEncoder, profileName);
214214
}
215215
// Core
216-
else if (getSearchParameters().getDynamicSpeeds() && routingProfile.getGraphhopper().isCoreAvailable(coreProfileName)) {
217-
return computeCoreMatrix(gh, flagEncoder, hintsMap, coreProfileName, routingProfile);
216+
else if (getSearchParameters().getDynamicSpeeds() && routingProfile.getGraphhopper().isCoreAvailable(profileName)) {
217+
return computeCoreMatrix(gh, flagEncoder, hintsMap, profileName, routingProfile);
218218
}
219219
// Dijkstra
220220
else {
221221
// use CHProfileName (w/o turn costs) since Dijkstra is node-based so turn restrictions are not used.
222-
return computeDijkstraMatrix(gh, flagEncoder, hintsMap, chProfileName);
222+
return computeDijkstraMatrix(gh, flagEncoder, hintsMap, profileName.replace("_with_turn_costs", ""));
223223
}
224224
} catch (PointNotFoundException e) {
225225
throw e;

0 commit comments

Comments
 (0)