pre-process speed: restrictions file split

This commit is contained in:
Arndt Brenschede 2019-09-28 12:56:36 +02:00
parent 4be0e456b2
commit ab621d2b2e
7 changed files with 186 additions and 25 deletions

View file

@ -146,34 +146,38 @@ public class WayLinker extends MapCreatorBase
FrozenLongMap<OsmNodeP> nodesMapFrozen = new FrozenLongMap<OsmNodeP>( nodesMap );
nodesMap = nodesMapFrozen;
File restrictionFile = fileFromTemplate( wayfile, new File( nodeTilesIn.getParentFile(), "restrictions55" ), "rt5" );
// read restrictions for nodes in nodesMap
DataInputStream di = new DataInputStream( new BufferedInputStream ( new FileInputStream( restrictionsFileIn ) ) );
int ntr = 0;
try
if ( restrictionFile.exists() )
{
for(;;)
DataInputStream di = new DataInputStream( new BufferedInputStream ( new FileInputStream( restrictionFile ) ) );
int ntr = 0;
try
{
RestrictionData res = new RestrictionData( di );
OsmNodeP n = nodesMap.get( res.viaNid );
if ( n != null )
for(;;)
{
if ( ! ( n instanceof OsmNodePT ) )
RestrictionData res = new RestrictionData( di );
OsmNodeP n = nodesMap.get( res.viaNid );
if ( n != null )
{
n = new OsmNodePT( n );
nodesMap.put( res.viaNid, n );
if ( ! ( n instanceof OsmNodePT ) )
{
n = new OsmNodePT( n );
nodesMap.put( res.viaNid, n );
}
OsmNodePT nt = (OsmNodePT) n;
res.next = nt.firstRestriction;
nt.firstRestriction = res;
ntr++;
}
OsmNodePT nt = (OsmNodePT) n;
res.next = nt.firstRestriction;
nt.firstRestriction = res;
ntr++;
}
}
catch( EOFException eof )
{
di.close();
}
System.out.println( "read " + ntr + " turn-restrictions" );
}
catch( EOFException eof )
{
di.close();
}
System.out.println( "read " + ntr + " turn-restrictions" );
nodesList = nodesMapFrozen.getValueList();
}