diff --git a/brouter-core/src/main/java/btools/router/RoutingContext.java b/brouter-core/src/main/java/btools/router/RoutingContext.java index a4cc657..1000e1c 100644 --- a/brouter-core/src/main/java/btools/router/RoutingContext.java +++ b/brouter-core/src/main/java/btools/router/RoutingContext.java @@ -45,6 +45,7 @@ public final class RoutingContext implements DistanceChecker public int uphillcostdiv; public int uphillcutoff; public boolean carMode; + public boolean forceSecondaryData; public double pass1coefficient; public double pass2coefficient; public int elevationpenaltybuffer; @@ -60,6 +61,7 @@ public final class RoutingContext implements DistanceChecker if ( downhillcostdiv != 0 ) downhillcostdiv = 1000000/downhillcostdiv; if ( uphillcostdiv != 0 ) uphillcostdiv = 1000000/uphillcostdiv; carMode = 0.f != expctxGlobal.getVariableValue( "validForCars", 0.f ); + forceSecondaryData = 0.f != expctxGlobal.getVariableValue( "forceSecondaryData", 0.f ); pass1coefficient = expctxGlobal.getVariableValue( "pass1coefficient", 1.5f ); pass2coefficient = expctxGlobal.getVariableValue( "pass2coefficient", 0.f ); elevationpenaltybuffer = (int)(expctxGlobal.getVariableValue( "elevationpenaltybuffer", 5.f )*1000000); diff --git a/brouter-core/src/main/java/btools/router/RoutingEngine.java b/brouter-core/src/main/java/btools/router/RoutingEngine.java index 3bbe50a..a9cee59 100644 --- a/brouter-core/src/main/java/btools/router/RoutingEngine.java +++ b/brouter-core/src/main/java/btools/router/RoutingEngine.java @@ -470,7 +470,7 @@ public class RoutingEngine extends Thread { nodesMap = new OsmNodesMap(); BExpressionContext ctx = routingContext.expctxWay; - nodesCache = new NodesCache(segmentDir, nodesMap, ctx.meta.lookupVersion, ctx.meta.lookupMinorVersion, ctx.meta.readVarLength, routingContext.carMode, nodesCache ); + nodesCache = new NodesCache(segmentDir, nodesMap, ctx.meta.lookupVersion, ctx.meta.lookupMinorVersion, ctx.meta.readVarLength, routingContext.carMode, routingContext.forceSecondaryData, nodesCache ); } private OsmNode getStartNode( long startId ) diff --git a/brouter-mapaccess/src/main/java/btools/mapaccess/NodesCache.java b/brouter-mapaccess/src/main/java/btools/mapaccess/NodesCache.java index 2b8d40f..4393a67 100644 --- a/brouter-mapaccess/src/main/java/btools/mapaccess/NodesCache.java +++ b/brouter-mapaccess/src/main/java/btools/mapaccess/NodesCache.java @@ -21,6 +21,7 @@ public final class NodesCache private int lookupMinorVersion; private boolean readVarLength; private boolean carMode; + private boolean forceSecondaryData; private String currentFileName; private HashMap fileCache; @@ -37,7 +38,7 @@ public final class NodesCache private boolean garbageCollectionEnabled = false; - public NodesCache( String segmentDir, OsmNodesMap nodesMap, int lookupVersion, int minorVersion, boolean varLen, boolean carMode, NodesCache oldCache ) + public NodesCache( String segmentDir, OsmNodesMap nodesMap, int lookupVersion, int minorVersion, boolean varLen, boolean carMode, boolean forceSecondaryData, NodesCache oldCache ) { this.segmentDir = new File( segmentDir ); this.nodesMap = nodesMap; @@ -45,6 +46,7 @@ public final class NodesCache this.lookupMinorVersion = minorVersion; this.readVarLength = varLen; this.carMode = carMode; + this.forceSecondaryData = forceSecondaryData; if ( !this.segmentDir.isDirectory() ) throw new RuntimeException( "segment directory " + segmentDir + " does not exist" ); @@ -77,6 +79,11 @@ public final class NodesCache private File getFileFromSegmentDir( String filename ) { + if ( forceSecondaryData ) + { + return new File( secondarySegmentsDir, filename ); + } + File f = new File( segmentDir, filename ); if ( secondarySegmentsDir != null && !f.exists() ) {