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:
parent
4e651f8164
commit
fc27df4fb3
1 changed files with 20 additions and 0 deletions
|
@ -60,6 +60,7 @@ import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.xml.parsers.FactoryConfigurationError;
|
import javax.xml.parsers.FactoryConfigurationError;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
@ -1145,6 +1146,22 @@ public class RouteProvider {
|
||||||
}
|
}
|
||||||
lats[index] = params.end.getLatitude();
|
lats[index] = params.end.getLatitude();
|
||||||
lons[index] = params.end.getLongitude();
|
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)) {
|
if (params.mode.isDerivedRoutingFrom(ApplicationMode.PEDESTRIAN)) {
|
||||||
mode = "foot"; //$NON-NLS-1$
|
mode = "foot"; //$NON-NLS-1$
|
||||||
} else if (params.mode.isDerivedRoutingFrom(ApplicationMode.BICYCLE)) {
|
} else if (params.mode.isDerivedRoutingFrom(ApplicationMode.BICYCLE)) {
|
||||||
|
@ -1155,6 +1172,9 @@ public class RouteProvider {
|
||||||
Bundle bpars = new Bundle();
|
Bundle bpars = new Bundle();
|
||||||
bpars.putDoubleArray("lats", lats);
|
bpars.putDoubleArray("lats", lats);
|
||||||
bpars.putDoubleArray("lons", lons);
|
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("fast", params.fast ? "1" : "0");
|
||||||
bpars.putString("v", mode);
|
bpars.putString("v", mode);
|
||||||
bpars.putString("trackFormat", "gpx");
|
bpars.putString("trackFormat", "gpx");
|
||||||
|
|
Loading…
Reference in a new issue