Traffic simulation patch
This commit is contained in:
parent
a35eea8878
commit
91c809e05c
22 changed files with 1595 additions and 83 deletions
|
|
@ -1,5 +1,8 @@
|
|||
package btools.server;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -7,6 +10,7 @@ import java.util.List;
|
|||
import btools.router.OsmNodeNamed;
|
||||
import btools.router.RoutingContext;
|
||||
import btools.router.RoutingEngine;
|
||||
import btools.router.SearchBoundary;
|
||||
|
||||
public class BRouter
|
||||
{
|
||||
|
|
@ -84,7 +88,7 @@ public class BRouter
|
|||
}
|
||||
System.exit(0);
|
||||
}
|
||||
System.out.println("BRouter 1.0 / 01062014 / abrensch");
|
||||
System.out.println("BRouter 1.2 / 04042015 / abrensch");
|
||||
if ( args.length < 6 )
|
||||
{
|
||||
System.out.println("Find routes in an OSM map");
|
||||
|
|
@ -93,9 +97,37 @@ public class BRouter
|
|||
}
|
||||
List<OsmNodeNamed> wplist = new ArrayList<OsmNodeNamed>();
|
||||
wplist.add( readPosition( args, 1, "from" ) );
|
||||
wplist.add( readPosition( args, 3, "to" ) );
|
||||
RoutingEngine re = new RoutingEngine( "mytrack", "mylog", args[0], wplist, readRoutingContext(args) );
|
||||
re.doRun( 0 );
|
||||
RoutingEngine re = null;
|
||||
if ( "seed".equals( args[3] ) )
|
||||
{
|
||||
int searchRadius = Integer.parseInt( args[4] ); // if = 0 search a 5x5 square
|
||||
|
||||
String filename = SearchBoundary.getFileName( wplist.get(0) );
|
||||
DataOutputStream dos = new DataOutputStream( new BufferedOutputStream( new FileOutputStream( "traffic/" + filename ) ) );
|
||||
|
||||
for( int direction = 0; direction < 8; direction++ )
|
||||
{
|
||||
RoutingContext rc = readRoutingContext(args);
|
||||
SearchBoundary boundary = new SearchBoundary( wplist.get(0), searchRadius, direction/2 );
|
||||
rc.trafficOutputStream = dos;
|
||||
rc.inverseDirection = (direction & 1 ) != 0;
|
||||
re = new RoutingEngine( "mytrack", "mylog", args[0], wplist, rc );
|
||||
re.boundary = boundary;
|
||||
re.airDistanceCostFactor = rc.trafficDirectionFactor;
|
||||
re.doSearch();
|
||||
if ( re.getErrorMessage() != null )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
dos.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
wplist.add( readPosition( args, 3, "to" ) );
|
||||
re = new RoutingEngine( "mytrack", "mylog", args[0], wplist, readRoutingContext(args) );
|
||||
re.doRun( 0 );
|
||||
}
|
||||
if ( re.getErrorMessage() != null )
|
||||
{
|
||||
System.out.println( re.getErrorMessage() );
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import java.util.List;
|
|||
import java.util.StringTokenizer;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import btools.memrouter.TwinRoutingEngine;
|
||||
import btools.router.OsmNodeNamed;
|
||||
import btools.router.OsmTrack;
|
||||
import btools.router.RoutingContext;
|
||||
|
|
@ -101,7 +102,7 @@ public class RouteServer extends Thread
|
|||
RoutingContext rc = handler.readRoutingContext();
|
||||
List<OsmNodeNamed> wplist = handler.readWayPointList();
|
||||
|
||||
cr = new RoutingEngine( null, null, serviceContext.segmentDir, wplist, rc );
|
||||
cr = new TwinRoutingEngine( null, null, serviceContext.segmentDir, wplist, rc );
|
||||
cr.quite = true;
|
||||
cr.doRun( maxRunningTime );
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue