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,7 +68,10 @@ public class RoutingEngine extends Thread
|
|||
this.infoLogEnabled = outfileBase != null;
|
||||
this.routingContext = rc;
|
||||
|
||||
File baseFolder = new File( routingContext.localFunction ).getParentFile().getParentFile();
|
||||
File baseFolder = new File( routingContext.localFunction ).getParentFile();
|
||||
baseFolder = baseFolder == null ? null : baseFolder.getParentFile();
|
||||
if ( baseFolder != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
File debugLog = new File( baseFolder, "debug.txt" );
|
||||
|
@ -91,7 +94,7 @@ public class RoutingEngine extends Thread
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,11 +67,5 @@ public class MapcreatorTest
|
|||
File segments = new File( tmpdir, "segments" );
|
||||
segments.mkdir();
|
||||
new WayLinker().process( unodes55, waytiles55, bordernodes, lookupFile, profileAllFile, segments, "rd5" );
|
||||
|
||||
// run WayLinker, car subset
|
||||
File carsubset = new File( segments, "carsubset" );
|
||||
carsubset.mkdir();
|
||||
File profileCarFile = new File( profileDir, "car-test.brf" );
|
||||
new WayLinker().process( unodes55, waytiles55, bordernodes, lookupFile, profileCarFile, carsubset, "cd5" );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ public final class NodesCache
|
|||
private BExpressionContextWay expCtxWay;
|
||||
private int lookupVersion;
|
||||
private int lookupMinorVersion;
|
||||
private boolean carMode;
|
||||
private boolean forceSecondaryData;
|
||||
private String currentFileName;
|
||||
|
||||
|
@ -48,15 +47,13 @@ public final class NodesCache
|
|||
return "collecting=" + garbageCollectionEnabled + " cacheSum=" + cacheSum;
|
||||
}
|
||||
|
||||
public NodesCache( String segmentDir, OsmNodesMap nodesMap, BExpressionContextWay ctxWay, boolean carMode, boolean forceSecondaryData,
|
||||
NodesCache oldCache )
|
||||
public NodesCache( String segmentDir, OsmNodesMap nodesMap, BExpressionContextWay ctxWay, boolean forceSecondaryData, NodesCache oldCache )
|
||||
{
|
||||
this.segmentDir = new File( segmentDir );
|
||||
this.nodesMap = nodesMap;
|
||||
this.expCtxWay = ctxWay;
|
||||
this.lookupVersion = ctxWay.meta.lookupVersion;
|
||||
this.lookupMinorVersion = ctxWay.meta.lookupMinorVersion;
|
||||
this.carMode = carMode;
|
||||
this.forceSecondaryData = forceSecondaryData;
|
||||
|
||||
first_file_access_failed = false;
|
||||
|
@ -238,7 +235,7 @@ public final class NodesCache
|
|||
String slat = lat < 0 ? "S" + ( -lat ) : "N" + lat;
|
||||
String filenameBase = slon + "_" + slat;
|
||||
|
||||
currentFileName = filenameBase + ".rd5/cd5";
|
||||
currentFileName = filenameBase + ".rd5";
|
||||
|
||||
PhysicalFile ra = null;
|
||||
if ( !fileCache.containsKey( filenameBase ) )
|
||||
|
@ -253,16 +250,6 @@ public final class NodesCache
|
|||
}
|
||||
}
|
||||
if ( f == null )
|
||||
{
|
||||
if ( carMode ) // look for carsubset-files only in secondary (primaries are now good for car-mode)
|
||||
{
|
||||
File carFile = new File( secondarySegmentsDir, "carsubset/" + filenameBase + ".cd5" );
|
||||
if ( carFile.exists() )
|
||||
{
|
||||
f = carFile;
|
||||
}
|
||||
}
|
||||
if ( f == null )
|
||||
{
|
||||
File secondary = new File( secondarySegmentsDir, filenameBase + ".rd5" );
|
||||
if ( secondary.exists() )
|
||||
|
@ -270,7 +257,6 @@ public final class NodesCache
|
|||
f = secondary;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( f != null )
|
||||
{
|
||||
currentFileName = f.getName();
|
||||
|
|
|
@ -332,7 +332,7 @@ public class BRouterActivity extends Activity implements OnInitListener
|
|||
{
|
||||
showWaypointDatabaseHelp();
|
||||
}
|
||||
else if ( wpCount == -1 )
|
||||
else if ( wpCount == -1 || wpCount == -3 )
|
||||
{
|
||||
finish();
|
||||
}
|
||||
|
|
|
@ -34,6 +34,8 @@ public class BRouterService extends Service
|
|||
@Override
|
||||
public String getTrackFromParams( Bundle params ) throws RemoteException
|
||||
{
|
||||
logBundle( params );
|
||||
|
||||
BRouterWorker worker = new BRouterWorker();
|
||||
|
||||
// get base dir from private file
|
||||
|
@ -227,6 +229,19 @@ public class BRouterService extends Service
|
|||
}
|
||||
}
|
||||
|
||||
private void logBundle( Bundle params )
|
||||
{
|
||||
if ( AppLogger.isLogging() )
|
||||
{
|
||||
for( String k : params.keySet() )
|
||||
{
|
||||
Object val = "remoteProfile".equals( k ) ? "<..cut..>" : params.get(k);
|
||||
String desc = "key=" + k + (val == null ? "" : " class=" + val.getClass() + " val=" + val.toString() );
|
||||
AppLogger.log( desc );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue