avoid roads for BRouter

Some versions of BRouter can't read the favorites with nogo circles for BRouter anymore.  With this commit the avoid roads points are send as nogo circles with 10 meter radius.
This commit is contained in:
vodie 2019-07-07 03:14:20 +02:00 committed by GitHub
parent 4e651f8164
commit fc27df4fb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -60,6 +60,7 @@ import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
@ -1145,6 +1146,22 @@ public class RouteProvider {
}
lats[index] = params.end.getLatitude();
lons[index] = params.end.getLongitude();
Set<LatLon> impassableRoads = params.ctx.getAvoidSpecificRoads().getImpassableRoads().keySet();
double[] nogoLats = new double[impassableRoads.size()];
double[] nogoLons = new double[impassableRoads.size()];
double[] nogoRadi = new double[impassableRoads.size()];
if(impassableRoads.size() != 0) {
int nogoindex = 0;
for (LatLon nogos : impassableRoads) {
nogoLats[nogoindex] = nogos.getLatitude();
nogoLons[nogoindex] = nogos.getLongitude();
nogoRadi[nogoindex] = 10;
nogoindex++;
}
}
if (params.mode.isDerivedRoutingFrom(ApplicationMode.PEDESTRIAN)) {
mode = "foot"; //$NON-NLS-1$
} else if (params.mode.isDerivedRoutingFrom(ApplicationMode.BICYCLE)) {
@ -1155,6 +1172,9 @@ public class RouteProvider {
Bundle bpars = new Bundle();
bpars.putDoubleArray("lats", lats);
bpars.putDoubleArray("lons", lons);
bpars.putDoubleArray("nogoLats", nogoLats);
bpars.putDoubleArray("nogoLons", nogoLons);
bpars.putDoubleArray("nogoRadi", nogoRadi);
bpars.putString("fast", params.fast ? "1" : "0");
bpars.putString("v", mode);
bpars.putString("trackFormat", "gpx");