diff --git a/brouter-core/src/main/java/btools/router/RoutingEngine.java b/brouter-core/src/main/java/btools/router/RoutingEngine.java index 3ce2c46..6717c95 100644 --- a/brouter-core/src/main/java/btools/router/RoutingEngine.java +++ b/brouter-core/src/main/java/btools/router/RoutingEngine.java @@ -25,6 +25,11 @@ import btools.util.SortedHeap; import btools.util.StackSampler; public class RoutingEngine extends Thread { + + public final static int BROUTER_ENGINEMODE_ROUTING = 0; + public final static int BROUTER_ENGINEMODE_SEED = 1; + public final static int BROUTER_ENGINEMODE_OTHER = 2; + private NodesCache nodesCache; private SortedHeap openSet = new SortedHeap(); private boolean finished = false; @@ -37,6 +42,8 @@ public class RoutingEngine extends Thread { private int MAXNODES_ISLAND_CHECK = 500; private OsmNodePairSet islandNodePairs = new OsmNodePairSet(MAXNODES_ISLAND_CHECK); + private int engineMode = 0; + private int MAX_STEPS_CHECK = 10; protected OsmTrack foundTrack = new OsmTrack(); @@ -73,12 +80,20 @@ public class RoutingEngine extends Thread { public RoutingEngine(String outfileBase, String logfileBase, File segmentDir, List waypoints, RoutingContext rc) { + this(0, outfileBase, logfileBase, segmentDir, + waypoints, rc); + } + + public RoutingEngine(int engineMode, String outfileBase, String logfileBase, File segmentDir, + List waypoints, RoutingContext rc) { this.segmentDir = segmentDir; this.outfileBase = outfileBase; this.logfileBase = logfileBase; this.waypoints = waypoints; this.infoLogEnabled = outfileBase != null; this.routingContext = rc; + this.engineMode = engineMode; + File baseFolder = new File(routingContext.localFunction).getParentFile(); baseFolder = baseFolder == null ? null : baseFolder.getParentFile(); @@ -138,6 +153,16 @@ public class RoutingEngine extends Thread { } public void doRun(long maxRunningTime) { + switch (engineMode) { + case BROUTER_ENGINEMODE_ROUTING: doRouting(maxRunningTime); break; + case BROUTER_ENGINEMODE_SEED: /* do nothing, handled the old way */ break; + case BROUTER_ENGINEMODE_OTHER: /* call others */ break; + default: doRouting(maxRunningTime); break; + } + } + + + public void doRouting(long maxRunningTime) { try { startTime = System.currentTimeMillis(); long startTime0 = startTime; diff --git a/brouter-routing-app/src/main/aidl/btools/routingapp/IBRouterService.aidl b/brouter-routing-app/src/main/aidl/btools/routingapp/IBRouterService.aidl index ed1dde7..ee9c406 100644 --- a/brouter-routing-app/src/main/aidl/btools/routingapp/IBRouterService.aidl +++ b/brouter-routing-app/src/main/aidl/btools/routingapp/IBRouterService.aidl @@ -34,6 +34,7 @@ interface IBRouterService { // "timode" = turnInstructionMode [0=none, 1=auto-choose, 2=locus-style, 3=osmand-style, 4=comment-style, 5=gpsies-style, 6=orux-style, 7=locus-old-style] default 0 // "heading" = angle (optional to give a route a start direction) // "direction" = angle (optional, used like "heading" on a recalculation request by Locus as start direction) + // "engineMode" = 0 (optional, no more modes defined at the moment) // return null if all ok and no path given, the track if ok and path given, an error message if it was wrong // the resultas string when 'pathToFileResult' is null, this should be default when Android Q or later diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BRouterWorker.java b/brouter-routing-app/src/main/java/btools/routingapp/BRouterWorker.java index 4d74130..be3de7d 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/BRouterWorker.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/BRouterWorker.java @@ -141,13 +141,17 @@ public class BRouterWorker { } } + int engineMode = 0; + if (params.containsKey("engineMode")) { + engineMode = params.getInt("engineMode", 0); + } try { writeTimeoutData(rc); } catch (Exception e) { } - RoutingEngine cr = new RoutingEngine(null, null, segmentDir, waypoints, rc); + RoutingEngine cr = new RoutingEngine(engineMode, null, null, segmentDir, waypoints, rc); cr.quite = true; cr.doRun(maxRunningTime); diff --git a/brouter-server/src/main/java/btools/server/RouteServer.java b/brouter-server/src/main/java/btools/server/RouteServer.java index 60009f8..cd5cef3 100644 --- a/brouter-server/src/main/java/btools/server/RouteServer.java +++ b/brouter-server/src/main/java/btools/server/RouteServer.java @@ -191,8 +191,11 @@ public class RouteServer extends Thread implements Comparable { if (wplist.size() < 10) { SuspectManager.nearRecentWps.add(wplist); } + int engineMode = 0; for (Map.Entry e : params.entrySet()) { - if ("timode".equals(e.getKey())) { + if ("engineMode".equals(e.getKey())) { + engineMode = Integer.parseInt(e.getValue()); + } else if ("timode".equals(e.getKey())) { rc.turnInstructionMode = Integer.parseInt(e.getValue()); } else if ("heading".equals(e.getKey())) { rc.startDirection = Integer.valueOf(Integer.parseInt(e.getValue())); @@ -210,7 +213,7 @@ public class RouteServer extends Thread implements Comparable { } } } - cr = new RoutingEngine(null, null, serviceContext.segmentDir, wplist, rc); + cr = new RoutingEngine(engineMode, null, null, serviceContext.segmentDir, wplist, rc); cr.quite = true; cr.doRun(maxRunningTime); diff --git a/docs/revisions.md b/docs/revisions.md index 600cc0c..d8b5ac0 100644 --- a/docs/revisions.md +++ b/docs/revisions.md @@ -2,6 +2,18 @@ (ZIP-Archives including APK, readme + profiles) +### New last version + +Android + +- Add parameter dialog for profile + +Library + +- Add engineMode for future use +- Minor bug fixes + + ### [brouter-1.7.0.zip](../brouter_bin/brouter-1.7.0.zip) (current revision, 29.04.2023) Android