Merge branch 'master' of https://github.com/abrensch/brouter
This commit is contained in:
commit
c3cc1fe8f9
12 changed files with 123 additions and 38 deletions
|
@ -27,9 +27,5 @@
|
||||||
<artifactId>brouter-expressions</artifactId>
|
<artifactId>brouter-expressions</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>junit</groupId>
|
|
||||||
<artifactId>junit</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -59,6 +59,7 @@ public final class RoutingContext implements DistanceChecker
|
||||||
public double changetime;
|
public double changetime;
|
||||||
public double buffertime;
|
public double buffertime;
|
||||||
public double waittimeadjustment;
|
public double waittimeadjustment;
|
||||||
|
public double starttimeoffset;
|
||||||
|
|
||||||
public void readGlobalConfig( BExpressionContext expctxGlobal )
|
public void readGlobalConfig( BExpressionContext expctxGlobal )
|
||||||
{
|
{
|
||||||
|
@ -81,6 +82,7 @@ public final class RoutingContext implements DistanceChecker
|
||||||
changetime = expctxGlobal.getVariableValue( "changetime", 180.f );
|
changetime = expctxGlobal.getVariableValue( "changetime", 180.f );
|
||||||
buffertime = expctxGlobal.getVariableValue( "buffertime", 120.f );
|
buffertime = expctxGlobal.getVariableValue( "buffertime", 120.f );
|
||||||
waittimeadjustment = expctxGlobal.getVariableValue( "waittimeadjustment", 0.9f );
|
waittimeadjustment = expctxGlobal.getVariableValue( "waittimeadjustment", 0.9f );
|
||||||
|
starttimeoffset = expctxGlobal.getVariableValue( "starttimeoffset", 0.f );
|
||||||
}
|
}
|
||||||
|
|
||||||
public RoutingMessageHandler messageHandler = new RoutingMessageHandler();
|
public RoutingMessageHandler messageHandler = new RoutingMessageHandler();
|
||||||
|
|
|
@ -133,12 +133,14 @@ public class RoutingEngine extends Thread
|
||||||
|
|
||||||
startTime = System.currentTimeMillis();
|
startTime = System.currentTimeMillis();
|
||||||
this.maxRunningTime = maxRunningTime;
|
this.maxRunningTime = maxRunningTime;
|
||||||
OsmTrack sum = null;
|
int nsections = waypoints.size() - 1;
|
||||||
|
OsmTrack[] refTracks = new OsmTrack[nsections]; // used ways for alternatives
|
||||||
|
OsmTrack[] lastTracks = new OsmTrack[nsections];
|
||||||
OsmTrack track = null;
|
OsmTrack track = null;
|
||||||
ArrayList<String> messageList = new ArrayList<String>();
|
ArrayList<String> messageList = new ArrayList<String>();
|
||||||
for( int i=0; !terminated; i++ )
|
for( int i=0; !terminated; i++ )
|
||||||
{
|
{
|
||||||
track = findTrack( sum );
|
track = findTrack( refTracks, lastTracks );
|
||||||
track.message = "track-length = " + track.distance + " filtered ascend = " + track.ascend
|
track.message = "track-length = " + track.distance + " filtered ascend = " + track.ascend
|
||||||
+ " plain-ascend = " + track.plainAscend + " cost=" + track.cost;
|
+ " plain-ascend = " + track.plainAscend + " cost=" + track.cost;
|
||||||
track.name = "brouter_" + routingContext.getProfileName() + "_" + i;
|
track.name = "brouter_" + routingContext.getProfileName() + "_" + i;
|
||||||
|
@ -152,8 +154,6 @@ public class RoutingEngine extends Thread
|
||||||
oldTrack.readGpx(filename);
|
oldTrack.readGpx(filename);
|
||||||
if ( track.equalsTrack( oldTrack ) )
|
if ( track.equalsTrack( oldTrack ) )
|
||||||
{
|
{
|
||||||
if ( sum == null ) sum = new OsmTrack();
|
|
||||||
sum.addNodes( track );
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
track.writeGpx( filename );
|
track.writeGpx( filename );
|
||||||
|
@ -179,8 +179,6 @@ public class RoutingEngine extends Thread
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( sum == null ) sum = new OsmTrack();
|
|
||||||
sum.addNodes( track );
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -240,14 +238,14 @@ public class RoutingEngine extends Thread
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private OsmTrack findTrack( OsmTrack refTrack )
|
private OsmTrack findTrack( OsmTrack[] refTracks, OsmTrack[] lastTracks )
|
||||||
{
|
{
|
||||||
OsmTrack totaltrack = new OsmTrack();
|
OsmTrack totaltrack = new OsmTrack();
|
||||||
MatchedWaypoint[] wayointIds = new MatchedWaypoint[waypoints.size()];
|
MatchedWaypoint[] wayointIds = new MatchedWaypoint[waypoints.size()];
|
||||||
|
|
||||||
// check for a track for that target
|
// check for a track for that target
|
||||||
OsmTrack nearbyTrack = null;
|
OsmTrack nearbyTrack = null;
|
||||||
if ( refTrack == null )
|
if ( refTracks[waypoints.size()-2] == null )
|
||||||
{
|
{
|
||||||
nearbyTrack = OsmTrack.readBinary( routingContext.rawTrackPath, waypoints.get( waypoints.size()-1), routingContext.getNogoChecksums() );
|
nearbyTrack = OsmTrack.readBinary( routingContext.rawTrackPath, waypoints.get( waypoints.size()-1), routingContext.getNogoChecksums() );
|
||||||
if ( nearbyTrack != null )
|
if ( nearbyTrack != null )
|
||||||
|
@ -267,9 +265,16 @@ public class RoutingEngine extends Thread
|
||||||
|
|
||||||
for( int i=0; i<waypoints.size() -1; i++ )
|
for( int i=0; i<waypoints.size() -1; i++ )
|
||||||
{
|
{
|
||||||
OsmTrack seg = searchTrack( wayointIds[i], wayointIds[i+1], i == waypoints.size()-2 ? nearbyTrack : null, refTrack );
|
if ( lastTracks[i] != null )
|
||||||
|
{
|
||||||
|
if ( refTracks[i] == null ) refTracks[i] = new OsmTrack();
|
||||||
|
refTracks[i].addNodes( lastTracks[i] );
|
||||||
|
}
|
||||||
|
|
||||||
|
OsmTrack seg = searchTrack( wayointIds[i], wayointIds[i+1], i == waypoints.size()-2 ? nearbyTrack : null, refTracks[i] );
|
||||||
if ( seg == null ) return null;
|
if ( seg == null ) return null;
|
||||||
totaltrack.appendTrack( seg );
|
totaltrack.appendTrack( seg );
|
||||||
|
lastTracks[i] = seg;
|
||||||
}
|
}
|
||||||
return totaltrack;
|
return totaltrack;
|
||||||
}
|
}
|
||||||
|
@ -293,9 +298,13 @@ public class RoutingEngine extends Thread
|
||||||
return mwp;
|
return mwp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( minRingWith == 1 && nodesCache.first_file_access_failed )
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException( "datafile " + nodesCache.first_file_access_name + " not found" );
|
||||||
|
}
|
||||||
if ( minRingWith++ == 5 )
|
if ( minRingWith++ == 5 )
|
||||||
{
|
{
|
||||||
throw new IllegalArgumentException( wp.name + "-position not mapped" );
|
throw new IllegalArgumentException( wp.name + "-position not mapped in existing datafile" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -33,6 +33,8 @@ public final class NodesCache
|
||||||
public DistanceChecker distanceChecker;
|
public DistanceChecker distanceChecker;
|
||||||
|
|
||||||
public boolean oom_carsubset_hint = false;
|
public boolean oom_carsubset_hint = false;
|
||||||
|
public boolean first_file_access_failed = false;
|
||||||
|
public String first_file_access_name;
|
||||||
|
|
||||||
private long cacheSum = 0;
|
private long cacheSum = 0;
|
||||||
private boolean garbageCollectionEnabled = false;
|
private boolean garbageCollectionEnabled = false;
|
||||||
|
@ -48,6 +50,9 @@ public final class NodesCache
|
||||||
this.carMode = carMode;
|
this.carMode = carMode;
|
||||||
this.forceSecondaryData = forceSecondaryData;
|
this.forceSecondaryData = forceSecondaryData;
|
||||||
|
|
||||||
|
first_file_access_failed = false;
|
||||||
|
first_file_access_name = null;
|
||||||
|
|
||||||
if ( !this.segmentDir.isDirectory() ) throw new RuntimeException( "segment directory " + segmentDir + " does not exist" );
|
if ( !this.segmentDir.isDirectory() ) throw new RuntimeException( "segment directory " + segmentDir + " does not exist" );
|
||||||
|
|
||||||
if ( oldCache != null )
|
if ( oldCache != null )
|
||||||
|
@ -249,6 +254,13 @@ public final class NodesCache
|
||||||
OsmFile osmf = new OsmFile( ra, tileIndex, iobuffer );
|
OsmFile osmf = new OsmFile( ra, tileIndex, iobuffer );
|
||||||
osmf.lonDegree = lonDegree;
|
osmf.lonDegree = lonDegree;
|
||||||
osmf.latDegree = latDegree;
|
osmf.latDegree = latDegree;
|
||||||
|
|
||||||
|
if ( first_file_access_name == null )
|
||||||
|
{
|
||||||
|
first_file_access_name = currentFileName;
|
||||||
|
first_file_access_failed = osmf.filename == null;
|
||||||
|
}
|
||||||
|
|
||||||
return osmf;
|
return osmf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,6 +102,8 @@ public abstract class CoordinateReader
|
||||||
{
|
{
|
||||||
CoordinateReader cor = null;
|
CoordinateReader cor = null;
|
||||||
ArrayList<CoordinateReader> rl = new ArrayList<CoordinateReader>();
|
ArrayList<CoordinateReader> rl = new ArrayList<CoordinateReader>();
|
||||||
|
|
||||||
|
AppLogger.log( "adding standard maptool-base: " + basedir );
|
||||||
rl.add( new CoordinateReaderOsmAnd(basedir) );
|
rl.add( new CoordinateReaderOsmAnd(basedir) );
|
||||||
rl.add( new CoordinateReaderLocus(basedir) );
|
rl.add( new CoordinateReaderLocus(basedir) );
|
||||||
rl.add( new CoordinateReaderOrux(basedir) );
|
rl.add( new CoordinateReaderOrux(basedir) );
|
||||||
|
@ -113,6 +115,7 @@ public abstract class CoordinateReader
|
||||||
String base2 = standardbase.getAbsolutePath();
|
String base2 = standardbase.getAbsolutePath();
|
||||||
if ( !base2.equals( basedir ) )
|
if ( !base2.equals( basedir ) )
|
||||||
{
|
{
|
||||||
|
AppLogger.log( "adding internal sd maptool-base: " + base2 );
|
||||||
rl.add( new CoordinateReaderOsmAnd(base2) );
|
rl.add( new CoordinateReaderOsmAnd(base2) );
|
||||||
rl.add( new CoordinateReaderLocus(base2) );
|
rl.add( new CoordinateReaderLocus(base2) );
|
||||||
rl.add( new CoordinateReaderOrux(base2) );
|
rl.add( new CoordinateReaderOrux(base2) );
|
||||||
|
@ -125,7 +128,7 @@ public abstract class CoordinateReader
|
||||||
{
|
{
|
||||||
String base3 = additional.getAbsolutePath();
|
String base3 = additional.getAbsolutePath();
|
||||||
|
|
||||||
AppLogger.log( "additional maptool-base from storage-config: " + base3 );
|
AppLogger.log( "adding maptool-base from storage-config: " + base3 );
|
||||||
|
|
||||||
rl.add( new CoordinateReaderOsmAnd(base3) );
|
rl.add( new CoordinateReaderOsmAnd(base3) );
|
||||||
rl.add( new CoordinateReaderLocus(base3) );
|
rl.add( new CoordinateReaderLocus(base3) );
|
||||||
|
@ -135,6 +138,11 @@ public abstract class CoordinateReader
|
||||||
long tmax = 0;
|
long tmax = 0;
|
||||||
for( CoordinateReader r : rl )
|
for( CoordinateReader r : rl )
|
||||||
{
|
{
|
||||||
|
if ( AppLogger.isLogging() )
|
||||||
|
{
|
||||||
|
AppLogger.log( "reading timestamp at systime " + new Date() );
|
||||||
|
}
|
||||||
|
|
||||||
long t = r.getTimeStamp();
|
long t = r.getTimeStamp();
|
||||||
|
|
||||||
if ( t != 0 )
|
if ( t != 0 )
|
||||||
|
|
|
@ -54,6 +54,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class RouterTest
|
||||||
|
|
||||||
msg = calcRoute( 8.720897, 50.002515, 16.723658, 49.997510, "notrack" );
|
msg = calcRoute( 8.720897, 50.002515, 16.723658, 49.997510, "notrack" );
|
||||||
|
|
||||||
Assert.assertTrue( msg, msg != null && msg.indexOf( "not mapped" ) >= 0 );
|
Assert.assertTrue( msg, msg != null && msg.indexOf( "not found" ) >= 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
private String calcRoute( double flon, double flat, double tlon, double tlat, String trackname ) throws Exception
|
private String calcRoute( double flon, double flat, double tlon, double tlat, String trackname ) throws Exception
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -167,16 +167,21 @@ public class SortedHeap<V>
|
||||||
// now merge the contents of arrays 0...idx-1 into idx
|
// now merge the contents of arrays 0...idx-1 into idx
|
||||||
while ( cnt > 0 )
|
while ( cnt > 0 )
|
||||||
{
|
{
|
||||||
int maxId = 0;
|
int i=0;
|
||||||
int maxIdx = -1;
|
while( pa[i] == lp[i] )
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
int maxId = al[i][pa[i]-1];
|
||||||
|
int maxIdx = i;
|
||||||
|
|
||||||
for ( int i=0; i<=idx; i++ )
|
for ( i++; i<=idx; i++ )
|
||||||
{
|
{
|
||||||
int p = pa[i];
|
int p = pa[i];
|
||||||
if ( p > lp[i] )
|
if ( p > lp[i] )
|
||||||
{
|
{
|
||||||
int currentId = al[i][p-1];
|
int currentId = al[i][p-1];
|
||||||
if ( maxIdx < 0 || currentId > maxId )
|
if ( currentId > maxId )
|
||||||
{
|
{
|
||||||
maxIdx = i;
|
maxIdx = i;
|
||||||
maxId = currentId;
|
maxId = currentId;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
---lookupversion:10
|
---lookupversion:10
|
||||||
---minorversion:3
|
---minorversion:4
|
||||||
---readvarlength
|
---readvarlength
|
||||||
|
|
||||||
---context:way
|
---context:way
|
||||||
|
@ -418,8 +418,21 @@ trail_visibility;0000023482 bad
|
||||||
trail_visibility;0000005853 horrible
|
trail_visibility;0000005853 horrible
|
||||||
trail_visibility;0000002222 no
|
trail_visibility;0000002222 no
|
||||||
|
|
||||||
brouter_placeholder_dummy_07;0000000001 dummy
|
class:bicycle:mtb;0000002079 1 +1
|
||||||
brouter_placeholder_dummy_08;0000000001 dummy
|
class:bicycle:mtb;0000001191 0
|
||||||
|
class:bicycle:mtb;0000001089 2 +2
|
||||||
|
class:bicycle:mtb;0000000703 -1
|
||||||
|
class:bicycle:mtb;0000000234 -2
|
||||||
|
class:bicycle:mtb;0000000140 3 +3
|
||||||
|
class:bicycle:mtb;0000000068 -3
|
||||||
|
|
||||||
|
class:bicycle;0000002842 1 +1
|
||||||
|
class:bicycle;0000000595 -1
|
||||||
|
class:bicycle;0000000533 2 +2
|
||||||
|
class:bicycle;0000000516 -2
|
||||||
|
class:bicycle;0000000245 -3
|
||||||
|
class:bicycle;0000000170 0
|
||||||
|
class:bicycle;0000000108 3 +3
|
||||||
|
|
||||||
route_bicycle_icn;0000088753 yes
|
route_bicycle_icn;0000088753 yes
|
||||||
route_bicycle_icn;0000000001 proposed
|
route_bicycle_icn;0000000001 proposed
|
||||||
|
@ -451,6 +464,40 @@ route_mtb_rcn;0000013321 yes
|
||||||
route_mtb_mtb;0000006853 yes
|
route_mtb_mtb;0000006853 yes
|
||||||
route_bicycle_mtb;0000002240 yes
|
route_bicycle_mtb;0000002240 yes
|
||||||
|
|
||||||
|
brouter_route_placeholder_dummy_01;0000000001 dummy
|
||||||
|
brouter_route_placeholder_dummy_02;0000000001 dummy
|
||||||
|
brouter_route_placeholder_dummy_03;0000000001 dummy
|
||||||
|
brouter_route_placeholder_dummy_04;0000000001 dummy
|
||||||
|
brouter_route_placeholder_dummy_05;0000000001 dummy
|
||||||
|
brouter_route_placeholder_dummy_06;0000000001 dummy
|
||||||
|
brouter_route_placeholder_dummy_07;0000000001 dummy
|
||||||
|
brouter_route_placeholder_dummy_08;0000000001 dummy
|
||||||
|
brouter_route_placeholder_dummy_09;0000000001 dummy
|
||||||
|
brouter_route_placeholder_dummy_10;0000000001 dummy
|
||||||
|
brouter_route_placeholder_dummy_11;0000000001 dummy
|
||||||
|
brouter_route_placeholder_dummy_12;0000000001 dummy
|
||||||
|
brouter_route_placeholder_dummy_13;0000000001 dummy
|
||||||
|
brouter_route_placeholder_dummy_14;0000000001 dummy
|
||||||
|
brouter_route_placeholder_dummy_15;0000000001 dummy
|
||||||
|
brouter_route_placeholder_dummy_16;0000000001 dummy
|
||||||
|
brouter_route_placeholder_dummy_17;0000000001 dummy
|
||||||
|
brouter_route_placeholder_dummy_18;0000000001 dummy
|
||||||
|
brouter_route_placeholder_dummy_19;0000000001 dummy
|
||||||
|
brouter_route_placeholder_dummy_20;0000000001 dummy
|
||||||
|
brouter_route_placeholder_dummy_21;0000000001 dummy
|
||||||
|
|
||||||
|
ramp:bicycle;0000001305 yes both permissive right left
|
||||||
|
ramp:bicycle;0000000385 no
|
||||||
|
|
||||||
|
ramp:stroller;0000001099 yes
|
||||||
|
ramp:stroller;0000000326 no
|
||||||
|
|
||||||
|
ramp:wheelchair;0000000610 yes
|
||||||
|
ramp:wheelchair;0000000439 no
|
||||||
|
|
||||||
|
ramp:luggage;0000000162 no
|
||||||
|
ramp:luggage;0000000054 yes automatic manual
|
||||||
|
|
||||||
---context:node
|
---context:node
|
||||||
|
|
||||||
highway;0001314954 bus_stop
|
highway;0001314954 bus_stop
|
||||||
|
@ -691,3 +738,6 @@ traffic_calming;0000004686 chicane
|
||||||
traffic_calming;0000004032 rumble_strip
|
traffic_calming;0000004032 rumble_strip
|
||||||
traffic_calming;0000000847 speed_bump
|
traffic_calming;0000000847 speed_bump
|
||||||
traffic_calming;0000000186 dip
|
traffic_calming;0000000186 dip
|
||||||
|
|
||||||
|
ford;0000037927 yes
|
||||||
|
ford;0000000310 stepping_stones
|
||||||
|
|
Loading…
Reference in a new issue