Skip to content

Commit

Permalink
move to profile params
Browse files Browse the repository at this point in the history
  • Loading branch information
takb committed Oct 10, 2022
1 parent 5938659 commit 4e1ec3c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ RELEASING:

## [6.7.1] - 2022-10-05
### Added
- optional `encoder_options` parameter `force_turn_costs` ([#1220](https://github.com/GIScience/openrouteservice/pull/1220))
- optional routing profile parameter `force_turn_costs` ([#1220](https://github.com/GIScience/openrouteservice/pull/1220))

## [6.7.0] - 2022-01-04
### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public RouteProfileConfiguration(RouteProfileConfiguration rpc) {

encoderFlagsSize = rpc.encoderFlagsSize;
encoderOptions = rpc.encoderOptions;
enforceTurnCosts = hasEnforceTurnCosts(rpc.encoderOptions);
enforceTurnCosts = rpc.enforceTurnCosts;

isochronePreparationOpts = rpc.isochronePreparationOpts;
preparationOpts = rpc.preparationOpts;
Expand Down Expand Up @@ -216,15 +216,6 @@ public Double getMaximumDistanceDynamicWeights()
{
return maximumDistanceDynamicWeights;
}
private static boolean hasEnforceTurnCosts(String encoderOptions) {
for (String option : encoderOptions.split("\\|")) {
String[] keyValuePair = option.split("=");
if (keyValuePair.length > 0 && keyValuePair[0].equals("force_turn_costs")) {
return keyValuePair[1].equals("true");
}
}
return false;
}

public void setMaximumDistanceAvoidAreas(Double value)
{
Expand Down Expand Up @@ -274,7 +265,6 @@ public Integer getEncoderFlagsSize()
public void setEncoderOptions(String value)
{
encoderOptions = value;
enforceTurnCosts = hasEnforceTurnCosts(value);
}

public String getEncoderOptions()
Expand Down Expand Up @@ -417,6 +407,10 @@ public double getMaximumSpeedLowerBound(){
return maximumSpeedLowerBound;
}

public void setEnforceTurnCosts(boolean enforceTurnCosts) {
this.enforceTurnCosts = enforceTurnCosts;
}

public boolean isEnforceTurnCosts() {
return enforceTurnCosts;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ else if (defaultParams != null) {
case "traffic_expiration_min":
profile.setTrafficExpirationMin(Integer.parseInt(paramItem.getValue().toString()));
break;
case "force_turn_costs":
profile.setEnforceTurnCosts(Boolean.parseBoolean(paramItem.getValue().toString()));
break;
default:
}
}
Expand Down

0 comments on commit 4e1ec3c

Please sign in to comment.