use of net.osmand.plus.onlinerouting.OnlineRoutingHelper in project Osmand by osmandapp.
the class MissingMapsHelper method findOnlineRoutePoints.
public List<Location> findOnlineRoutePoints() throws IOException, JSONException {
List<LatLon> points = new ArrayList<>();
List<Location> routeLocation = new ArrayList<>();
OnlineRoutingHelper onlineRoutingHelper = params.ctx.getOnlineRoutingHelper();
List<Location> location = getStartFinishIntermediatePoints();
for (Location e : location) {
points.add(new LatLon(e.getLatitude(), e.getLongitude()));
}
OnlineRoutingEngine engine = onlineRoutingHelper.startOsrmEngine(params.mode);
if (engine != null) {
OnlineRoutingResponse response = onlineRoutingHelper.calculateRouteOnline(engine, points, params.start.hasBearing() ? params.start.getBearing() : null, params.leftSide, false);
if (response != null) {
routeLocation.addAll(response.getRoute());
}
}
return removeDensePoints(routeLocation);
}
Aggregations