cleanup and bugfixes
This commit is contained in:
parent
e217f12e71
commit
ead7f2ac6d
7 changed files with 58 additions and 67 deletions
|
|
@ -729,7 +729,7 @@ public final class OsmTrack
|
|||
return e.message;
|
||||
}
|
||||
e = e.origin;
|
||||
if ( cnt++ == 10000 )
|
||||
if ( cnt++ == 1000000 )
|
||||
{
|
||||
throw new IllegalArgumentException( "ups?" );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,30 +68,33 @@ public class RoutingEngine extends Thread
|
|||
this.infoLogEnabled = outfileBase != null;
|
||||
this.routingContext = rc;
|
||||
|
||||
File baseFolder = new File( routingContext.localFunction ).getParentFile().getParentFile();
|
||||
try
|
||||
File baseFolder = new File( routingContext.localFunction ).getParentFile();
|
||||
baseFolder = baseFolder == null ? null : baseFolder.getParentFile();
|
||||
if ( baseFolder != null )
|
||||
{
|
||||
File debugLog = new File( baseFolder, "debug.txt" );
|
||||
if ( debugLog.exists() )
|
||||
try
|
||||
{
|
||||
infoLogWriter = new FileWriter( debugLog, true );
|
||||
logInfo( "********** start request at " );
|
||||
logInfo( "********** " + new Date() );
|
||||
File debugLog = new File( baseFolder, "debug.txt" );
|
||||
if ( debugLog.exists() )
|
||||
{
|
||||
infoLogWriter = new FileWriter( debugLog, true );
|
||||
logInfo( "********** start request at " );
|
||||
logInfo( "********** " + new Date() );
|
||||
}
|
||||
}
|
||||
catch( IOException ioe )
|
||||
{
|
||||
throw new RuntimeException( "cannot open debug-log:" + ioe );
|
||||
}
|
||||
|
||||
File stackLog = new File( baseFolder, "stacks.txt" );
|
||||
if ( stackLog.exists() )
|
||||
{
|
||||
stackSampler = new StackSampler( stackLog, 1000 );
|
||||
stackSampler.start();
|
||||
logInfo( "********** started stacksampling" );
|
||||
}
|
||||
}
|
||||
catch( IOException ioe )
|
||||
{
|
||||
throw new RuntimeException( "cannot open debug-log:" + ioe );
|
||||
}
|
||||
|
||||
File stackLog = new File( baseFolder, "stacks.txt" );
|
||||
if ( stackLog.exists() )
|
||||
{
|
||||
stackSampler = new StackSampler( stackLog, 1000 );
|
||||
stackSampler.start();
|
||||
logInfo( "********** started stacksampling" );
|
||||
}
|
||||
|
||||
boolean cachedProfile = ProfileCache.parseProfile( rc );
|
||||
if ( hasInfo() )
|
||||
{
|
||||
|
|
@ -406,6 +409,18 @@ public class RoutingEngine extends Thread
|
|||
{
|
||||
preloadPosition( mwp.waypoint );
|
||||
}
|
||||
|
||||
if ( nodesCache.first_file_access_failed )
|
||||
{
|
||||
throw new IllegalArgumentException( "datafile " + nodesCache.first_file_access_name + " not found" );
|
||||
}
|
||||
for( MatchedWaypoint mwp : unmatchedWaypoints )
|
||||
{
|
||||
if ( mwp.crosspoint == null )
|
||||
{
|
||||
throw new IllegalArgumentException( mwp.waypoint.name + "-position not mapped in existing datafile" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void preloadPosition( OsmNode n )
|
||||
|
|
@ -558,7 +573,7 @@ public class RoutingEngine extends Thread
|
|||
logInfo( "NodesCache status before reset=" + nodesCache.formatStatus() );
|
||||
}
|
||||
nodesMap = new OsmNodesMap();
|
||||
nodesCache = new NodesCache(segmentDir, nodesMap, routingContext.expctxWay, routingContext.carMode, routingContext.forceSecondaryData, nodesCache );
|
||||
nodesCache = new NodesCache(segmentDir, nodesMap, routingContext.expctxWay, routingContext.forceSecondaryData, nodesCache );
|
||||
}
|
||||
|
||||
private OsmNode getStartNode( long startId )
|
||||
|
|
@ -991,16 +1006,6 @@ public class RoutingEngine extends Thread
|
|||
}
|
||||
}
|
||||
|
||||
private void preloadPosition( OsmNode n, int minRingWidth, int minCount )
|
||||
{
|
||||
int c = 0;
|
||||
int ring = 0;
|
||||
while( ring <= minRingWidth || ( c < minCount && ring <= 5 ) )
|
||||
{
|
||||
c += preloadRing( n, ring++ );
|
||||
}
|
||||
}
|
||||
|
||||
private int preloadRing( OsmNode n, int ring )
|
||||
{
|
||||
int d = 12500;
|
||||
|
|
|
|||
|
|
@ -44,15 +44,6 @@ public final class RoutingHelper
|
|||
{
|
||||
if ( fileName.endsWith( ".rd5" ) ) return true;
|
||||
}
|
||||
File carSubset = new File( dir, "carsubset" );
|
||||
if ( carSubset.isDirectory() )
|
||||
{
|
||||
fileNames = carSubset.list();
|
||||
for( String fileName : fileNames )
|
||||
{
|
||||
if ( fileName.endsWith( ".cd5" ) ) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue