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

@ -1,7 +1,11 @@
package btools.mapcreator;
import java.io.BufferedInputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.EOFException;
import java.io.File;
import java.io.FileInputStream;
import btools.util.DenseLongMap;
import btools.util.TinyDenseLongMap;
@ -25,6 +29,7 @@ public class WayCutter5 extends MapCreatorBase
public RelationMerger relMerger;
public NodeFilter nodeFilter;
public NodeCutter nodeCutter;
public RestrictionCutter5 restrictionCutter5;
public static void main(String[] args) throws Exception
{
@ -65,7 +70,34 @@ public class WayCutter5 extends MapCreatorBase
{
nodeCutter.nodeFileStart( null );
}
new NodeIterator( this, false ).processFile( nodefile );
new NodeIterator( this, nodeCutter != null ).processFile( nodefile );
if ( restrictionCutter5 != null )
{
String resfilename = name.substring( 0, name.length()-3 ) + "rtl";
File resfile = new File( "restrictions", resfilename );
if ( resfile.exists() )
{
// read restrictions for nodes in nodesMap
DataInputStream di = new DataInputStream( new BufferedInputStream ( new FileInputStream( resfile ) ) );
int ntr = 0;
try
{
for(;;)
{
RestrictionData res = new RestrictionData( di );
restrictionCutter5.nextRestriction( res );
ntr++;
}
}
catch( EOFException eof )
{
di.close();
}
System.out.println( "read " + ntr + " turn-restrictions" );
}
}
return true;
}
@ -144,6 +176,11 @@ public class WayCutter5 extends MapCreatorBase
}
}
public int getTileIndexForNid( long nid )
{
return tileIndexMap.getInt( nid );
}
private int getTileIndex( int ilon, int ilat )
{
int lonoff = (ilon / 45000000 ) * 45;