Skip to content

Commit

Permalink
feat: add dataaccess routing profile configuration parameter (#1638)
Browse files Browse the repository at this point in the history
Manually merge due to broken Sonar status check
  • Loading branch information
sfendrich authored Dec 19, 2023
2 parents 4808991 + c27a0ad commit a2055a4
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public static ORSGraphHopper initGraphHopper(EngineConfig engineConfig, RoutePro

private static ORSGraphHopperConfig createGHSettings(String sourceFile, RouteProfileConfiguration config) {
ORSGraphHopperConfig ghConfig = new ORSGraphHopperConfig();
ghConfig.putObject("graph.dataaccess", "RAM_STORE");
ghConfig.putObject("graph.dataaccess", config.getGraphDataAccess());
ghConfig.putObject("datareader.file", sourceFile);
ghConfig.putObject("graph.location", config.getGraphPath());
ghConfig.putObject("graph.bytes_for_flags", config.getEncoderFlagsSize());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public class RouteProfileConfiguration {

private boolean turnCostEnabled = false;
private boolean enforceTurnCosts = false;
private String graphDataAccess = "RAM_STORE";

public RouteProfileConfiguration() {
extStorages = new HashMap<>();
Expand Down Expand Up @@ -367,4 +368,55 @@ public int getMaximumVisitedNodesPT() {
public void setMaximumVisitedNodesPT(int maximumVisitedNodesPT) {
this.maximumVisitedNodesPT = maximumVisitedNodesPT;
}

public String getGraphDataAccess() {
return graphDataAccess;
}

public void setGraphDataAccess(String graphDataAccess) {
this.graphDataAccess = graphDataAccess;
}

@Override
public String toString() {
return "RouteProfileConfiguration{" +
"name='" + name + '\'' +
", enabled=" + enabled +
", profiles='" + profiles + '\'' +
", graphPath='" + graphPath + '\'' +
", extStorages=" + extStorages +
", graphBuilders=" + graphBuilders +
", maximumDistance=" + maximumDistance +
", maximumDistanceDynamicWeights=" + maximumDistanceDynamicWeights +
", maximumDistanceAvoidAreas=" + maximumDistanceAvoidAreas +
", maximumDistanceAlternativeRoutes=" + maximumDistanceAlternativeRoutes +
", maximumDistanceRoundTripRoutes=" + maximumDistanceRoundTripRoutes +
", maximumWayPoints=" + maximumWayPoints +
", instructions=" + instructions +
", optimize=" + optimize +
", encoderFlagsSize=" + encoderFlagsSize +
", encoderOptions='" + encoderOptions + '\'' +
", gtfsFile='" + gtfsFile + '\'' +
", isochronePreparationOpts=" + isochronePreparationOpts +
", preparationOpts=" + preparationOpts +
", executionOpts=" + executionOpts +
", elevationProvider='" + elevationProvider + '\'' +
", elevationCachePath='" + elevationCachePath + '\'' +
", elevationDataAccess='" + elevationDataAccess + '\'' +
", elevationCacheClear=" + elevationCacheClear +
", elevationSmoothing=" + elevationSmoothing +
", interpolateBridgesAndTunnels=" + interpolateBridgesAndTunnels +
", maximumSnappingRadius=" + maximumSnappingRadius +
", extent=" + extent +
", hasMaximumSnappingRadius=" + hasMaximumSnappingRadius +
", locationIndexResolution=" + locationIndexResolution +
", locationIndexSearchIterations=" + locationIndexSearchIterations +
", maximumSpeedLowerBound=" + maximumSpeedLowerBound +
", trafficExpirationMin=" + trafficExpirationMin +
", maximumVisitedNodesPT=" + maximumVisitedNodesPT +
", turnCostEnabled=" + turnCostEnabled +
", enforceTurnCosts=" + enforceTurnCosts +
", graphDataAccess='" + graphDataAccess + '\'' +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.util.Map;

public class RoutingManagerConfiguration {
public static final String PARAM_GRAPH_DATA_ACCESS = "graph_data_access";
public static final String PARAM_ELEVATION_CACHE_CLEAR = "elevation_cache_clear";
public static final String PARAM_ELEVATION_DATA_ACCESS = "elevation_data_access";
public static final String PARAM_ELEVATION_SMOOTHING = "elevation_smoothing";
Expand Down Expand Up @@ -106,6 +107,9 @@ else if (defaultParams != null) {
if (profileParams != null) {
for (Map.Entry<String, Object> paramItem : profileParams.entrySet()) {
switch (paramItem.getKey()) {
case PARAM_GRAPH_DATA_ACCESS:
profile.setGraphDataAccess(StringUtility.trimQuotes(paramItem.getValue().toString()));
break;
case "preparation":
profile.setPreparationOpts(ConfigFactory.parseString(paramItem.getValue().toString()));
break;
Expand Down

0 comments on commit a2055a4

Please sign in to comment.