From 13a41bd9f801992bc6394d27e24c7a3975494ac0 Mon Sep 17 00:00:00 2001 From: afischerdev Date: Wed, 19 Oct 2022 21:12:38 +0200 Subject: [PATCH] Enable use of direction to app (#464) * make app equal to server #314 --- .../btools/routingapp/IBRouterService.aidl | 78 ++++++++++--------- .../java/btools/routingapp/BRouterWorker.java | 5 +- 2 files changed, 44 insertions(+), 39 deletions(-) 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 d3c5d9e..97fccd0 100644 --- a/brouter-routing-app/src/main/aidl/btools/routingapp/IBRouterService.aidl +++ b/brouter-routing-app/src/main/aidl/btools/routingapp/IBRouterService.aidl @@ -1,38 +1,40 @@ -package btools.routingapp; - - -interface IBRouterService { - - - //param params--> Map of params: - // "pathToFileResult"-->String with the path to where the result must be saved, including file name and extension - // -->if null, the track is passed via the return argument, this should be default when Android Q or later - // "maxRunningTime"-->String with a number of seconds for the routing timeout, default = 60 - // "turnInstructionFormat"-->String selecting the format for turn-instructions values: osmand, locus - // "trackFormat"-->[kml|gpx|json] default = gpx - // "lats"-->double[] array of latitudes; 2 values at least. - // "lons"-->double[] array of longitudes; 2 values at least. - // "nogoLats"-->double[] array of nogo latitudes; may be null. - // "nogoLons"-->double[] array of nogo longitudes; may be null. - // "nogoRadi"-->double[] array of nogo radius in meters; may be null. - // "fast"-->[0|1] - // "v"-->[motorcar|bicycle|foot] - // "remoteProfile"--> (String), net-content of a profile. If remoteProfile != null, v+fast are ignored - // - // "lonlats" = lon,lat|... (unlimited list of lon,lat waypoints separated by |) - // "nogos" = lon,lat,radius|... (optional, radius in meters) - // "polylines" = lon,lat,lon,lat,...,weight|... (unlimited list of lon,lat and weight (optional), lists separated by |) - // "polygons" = lon,lat,lon,lat,...,weight|... (unlimited list of lon,lat and weight (optional), lists separated by |) - // "profile" = profile file name without .brf - // "alternativeidx" = [0|1|2|3] (optional, default 0) - // "exportWaypoints" = 1 to export them (optional, default is no export) - // "pois" = lon,lat,name|... (optional) - // "extraParams" = Bundle key=value list for a profile setup (like "profile:") - // "timode" = turnInstructionMode [0=none, 1=auto-choose, 2=locus-style, 3=osmand-style, 4=comment-style, 5=gpsies-style, 6=orux-style] default 0 - - // 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 - // call in a background thread, heavy task! - - String getTrackFromParams(in Bundle params); -} +package btools.routingapp; + + +interface IBRouterService { + + + //param params--> Map of params: + // "pathToFileResult"-->String with the path to where the result must be saved, including file name and extension + // -->if null, the track is passed via the return argument, this should be default when Android Q or later + // "maxRunningTime"-->String with a number of seconds for the routing timeout, default = 60 + // "turnInstructionFormat"-->String selecting the format for turn-instructions values: osmand, locus + // "trackFormat"-->[kml|gpx|json] default = gpx + // "lats"-->double[] array of latitudes; 2 values at least. + // "lons"-->double[] array of longitudes; 2 values at least. + // "nogoLats"-->double[] array of nogo latitudes; may be null. + // "nogoLons"-->double[] array of nogo longitudes; may be null. + // "nogoRadi"-->double[] array of nogo radius in meters; may be null. + // "fast"-->[0|1] + // "v"-->[motorcar|bicycle|foot] + // "remoteProfile"--> (String), net-content of a profile. If remoteProfile != null, v+fast are ignored + // + // "lonlats" = lon,lat|... (unlimited list of lon,lat waypoints separated by |) + // "nogos" = lon,lat,radius|... (optional, radius in meters) + // "polylines" = lon,lat,lon,lat,...,weight|... (unlimited list of lon,lat and weight (optional), lists separated by |) + // "polygons" = lon,lat,lon,lat,...,weight|... (unlimited list of lon,lat and weight (optional), lists separated by |) + // "profile" = profile file name without .brf + // "alternativeidx" = [0|1|2|3] (optional, default 0) + // "exportWaypoints" = 1 to export them (optional, default is no export) + // "pois" = lon,lat,name|... (optional) + // "extraParams" = Bundle key=value list for a profile setup (like "profile:") + // "timode" = turnInstructionMode [0=none, 1=auto-choose, 2=locus-style, 3=osmand-style, 4=comment-style, 5=gpsies-style, 6=orux-style] default 0 + // "heading" = angle (optional to give a route a start direction) + // "direction" = (deprecated) angle + + // 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 + // call in a background thread, heavy task! + + String getTrackFromParams(in Bundle params); +} 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 d9a725c..82bfe64 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/BRouterWorker.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/BRouterWorker.java @@ -64,10 +64,13 @@ public class BRouterWorker { rc.turnInstructionMode = params.getInt("timode"); } - if (params.containsKey("direction")) { rc.startDirection = params.getInt("direction"); } + if (params.containsKey("heading")) { + rc.startDirection = params.getInt("heading"); + rc.forceUseStartDirection = true; + } if (params.containsKey("alternativeidx")) { rc.alternativeIdx = params.getInt("alternativeidx"); }