forceSecondaryData flag

This commit is contained in:
Arndt Brenschede 2014-11-17 19:14:44 +01:00
parent 1ee41026c1
commit 3860b12cd9
3 changed files with 11 additions and 2 deletions

View file

@ -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);

View file

@ -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 )

View file

@ -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<String,PhysicalFile> 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() )
{