Merge pull request #2494 from HattinkT/brouter_intermediates_support

Add support for intermediates in brouter navigation service
This commit is contained in:
vshcherb 2016-04-27 01:06:39 +02:00
commit 14c25b052f

View file

@ -1178,9 +1178,23 @@ public class RouteProvider {
protected RouteCalculationResult findBROUTERRoute(RouteCalculationParams params) throws MalformedURLException, protected RouteCalculationResult findBROUTERRoute(RouteCalculationParams params) throws MalformedURLException,
IOException, ParserConfigurationException, FactoryConfigurationError, SAXException { IOException, ParserConfigurationException, FactoryConfigurationError, SAXException {
double[] lats = new double[] { params.start.getLatitude(), params.end.getLatitude() }; int numpoints = 2 + (params.intermediates != null ? params.intermediates.size() : 0);
double[] lons = new double[] { params.start.getLongitude(), params.end.getLongitude() }; double[] lats = new double[numpoints];
double[] lons = new double[numpoints];
int index = 0;
String mode; String mode;
lats[index] = params.start.getLatitude();
lons[index] = params.start.getLongitude();
index++;
if(params.intermediates != null && params.intermediates.size() > 0) {
for(LatLon il : params.intermediates) {
lats[index] = il.getLatitude();
lons[index] = il.getLongitude();
index++;
}
}
lats[index] = params.end.getLatitude();
lons[index] = params.end.getLongitude();
if (ApplicationMode.PEDESTRIAN == params.mode) { if (ApplicationMode.PEDESTRIAN == params.mode) {
mode = "foot"; //$NON-NLS-1$ mode = "foot"; //$NON-NLS-1$
} else if (ApplicationMode.BICYCLE == params.mode) { } else if (ApplicationMode.BICYCLE == params.mode) {