update lib part one
This commit is contained in:
parent
eba0b18689
commit
54a7ad6b9d
6 changed files with 41 additions and 4 deletions
|
@ -13,6 +13,7 @@ public class OsmNodeNamed extends OsmNode {
|
||||||
public double radius; // radius of nogopoint (in meters)
|
public double radius; // radius of nogopoint (in meters)
|
||||||
public double nogoWeight; // weight for nogopoint
|
public double nogoWeight; // weight for nogopoint
|
||||||
public boolean isNogo = false;
|
public boolean isNogo = false;
|
||||||
|
public boolean direct = false; // mark direct routing
|
||||||
|
|
||||||
public OsmNodeNamed() {
|
public OsmNodeNamed() {
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ public final class MatchedWaypoint {
|
||||||
public OsmNode waypoint;
|
public OsmNode waypoint;
|
||||||
public String name; // waypoint name used in error messages
|
public String name; // waypoint name used in error messages
|
||||||
public double radius; // distance in meter between waypoint and crosspoint
|
public double radius; // distance in meter between waypoint and crosspoint
|
||||||
|
public boolean direct; // from this point go direct to next = beeline routing
|
||||||
|
|
||||||
public boolean hasUpdate;
|
public boolean hasUpdate;
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,9 @@ interface IBRouterService {
|
||||||
// "remoteProfile"--> (String), net-content of a profile. If remoteProfile != null, v+fast are ignored
|
// "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 |)
|
// "lonlats" = lon,lat|... (unlimited list of lon,lat waypoints separated by |)
|
||||||
|
// variantes: lon,lat,d|... (from this point to the next do a direct line)
|
||||||
|
// lon,lat,name|... (route point has a name and should not be ignored)
|
||||||
|
// "straight" = idx1,idx2,.. (optional, minimum one value, index of a direct routing point in the waypoint list)
|
||||||
// "nogos" = lon,lat,radius|... (optional, radius in meters)
|
// "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 |)
|
// "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 |)
|
// "polygons" = lon,lat,lon,lat,...,weight|... (unlimited list of lon,lat and weight (optional), lists separated by |)
|
||||||
|
@ -28,9 +31,9 @@ interface IBRouterService {
|
||||||
// "exportWaypoints" = 1 to export them (optional, default is no export)
|
// "exportWaypoints" = 1 to export them (optional, default is no export)
|
||||||
// "pois" = lon,lat,name|... (optional)
|
// "pois" = lon,lat,name|... (optional)
|
||||||
// "extraParams" = Bundle key=value list for a profile setup (like "profile:")
|
// "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
|
// "timode" = turnInstructionMode [0=none, 1=auto-choose, 2=locus-style, 3=osmand-style, 4=comment-style, 5=gpsies-style, 6=orux-style, 7=locus-new-style, 8=cruiser-stylem, 9=brouter-intern] default 0
|
||||||
// "heading" = angle (optional to give a route a start direction)
|
// "heading" = angle (optional to give a route a start direction)
|
||||||
// "direction" = (deprecated) angle
|
// "direction" = angle (optional, used on recalculation, only used by Locus)
|
||||||
|
|
||||||
// return null if all ok and no path given, the track if ok and path given, an error message if it was wrong
|
// 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
|
// the resultas string when 'pathToFileResult' is null, this should be default when Android Q or later
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class BRouterWorker {
|
||||||
if ("osmand".equalsIgnoreCase(tiFormat)) {
|
if ("osmand".equalsIgnoreCase(tiFormat)) {
|
||||||
rc.turnInstructionMode = 3;
|
rc.turnInstructionMode = 3;
|
||||||
} else if ("locus".equalsIgnoreCase(tiFormat)) {
|
} else if ("locus".equalsIgnoreCase(tiFormat)) {
|
||||||
rc.turnInstructionMode = 2;
|
rc.turnInstructionMode = 7;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (params.containsKey("timode")) {
|
if (params.containsKey("timode")) {
|
||||||
|
@ -112,7 +112,19 @@ public class BRouterWorker {
|
||||||
String key = tk2.nextToken();
|
String key = tk2.nextToken();
|
||||||
if (tk2.hasMoreTokens()) {
|
if (tk2.hasMoreTokens()) {
|
||||||
String value = tk2.nextToken();
|
String value = tk2.nextToken();
|
||||||
rc.keyValues.put(key, value);
|
if (key.equals("straight")) {
|
||||||
|
try {
|
||||||
|
String[] sa = value.split(",");
|
||||||
|
for ( int i = 0; i<sa.length;i++) {
|
||||||
|
int v = Integer.valueOf(sa[i]);
|
||||||
|
if (waypoints.size() > v) waypoints.get(v).direct = true;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.err.println("error " + e.getStackTrace()[0].getLineNumber() + " " + e.getStackTrace()[0] + "\n" +e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rc.keyValues.put(key, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -226,6 +238,13 @@ public class BRouterWorker {
|
||||||
if (lonLat.length < 2)
|
if (lonLat.length < 2)
|
||||||
throw new IllegalArgumentException("we need two lat/lon points at least!");
|
throw new IllegalArgumentException("we need two lat/lon points at least!");
|
||||||
wplist.add(readPosition(lonLat[0], lonLat[1], "via" + i));
|
wplist.add(readPosition(lonLat[0], lonLat[1], "via" + i));
|
||||||
|
if (lonLat.length > 2) {
|
||||||
|
if (lonLat[2].equals("d")) {
|
||||||
|
wplist.get(wplist.size()-1).direct = true;
|
||||||
|
} else {
|
||||||
|
wplist.get(wplist.size()-1).name = lonLat[2];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wplist.get(0).name = "from";
|
wplist.get(0).name = "from";
|
||||||
|
|
|
@ -218,6 +218,12 @@ public class RouteServer extends Thread implements Comparable<RouteServer> {
|
||||||
rc.keyValues = new HashMap<String, String>();
|
rc.keyValues = new HashMap<String, String>();
|
||||||
}
|
}
|
||||||
rc.keyValues.put(e.getKey().substring(8), e.getValue());
|
rc.keyValues.put(e.getKey().substring(8), e.getValue());
|
||||||
|
} else if (e.getKey().equals("straight")) {
|
||||||
|
String[] sa = e.getValue().split(",");
|
||||||
|
for (int i = 0; i<sa.length;i++) {
|
||||||
|
int v = Integer.valueOf(sa[i]);
|
||||||
|
if (wplist.size() > v) wplist.get(v).direct = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cr = new RoutingEngine(null, null, serviceContext.segmentDir, wplist, rc);
|
cr = new RoutingEngine(null, null, serviceContext.segmentDir, wplist, rc);
|
||||||
|
|
|
@ -95,6 +95,13 @@ public class ServerHandler extends RequestHandler {
|
||||||
if (lonLat.length < 2)
|
if (lonLat.length < 2)
|
||||||
throw new IllegalArgumentException("we need two lat/lon points at least!");
|
throw new IllegalArgumentException("we need two lat/lon points at least!");
|
||||||
wplist.add(readPosition(lonLat[0], lonLat[1], "via" + i));
|
wplist.add(readPosition(lonLat[0], lonLat[1], "via" + i));
|
||||||
|
if (lonLat.length > 2) {
|
||||||
|
if (lonLat[2].equals("d")) {
|
||||||
|
wplist.get(wplist.size()-1).direct = true;
|
||||||
|
} else {
|
||||||
|
wplist.get(wplist.size()-1).name = lonLat[2];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wplist.get(0).name = "from";
|
wplist.get(0).name = "from";
|
||||||
|
|
Loading…
Reference in a new issue