Search in sources :

Example 1 with RouteResultPreparation

use of net.osmand.router.RouteResultPreparation in project OsmAnd-tools by osmandapp.

the class OsmAndMapsService method approximate.

private List<RouteSegmentResult> approximate(RoutingContext ctx, RoutePlannerFrontEnd router, Map<String, Object> props, List<LatLon> polyline) throws IOException, InterruptedException {
    GpxRouteApproximation gctx = new GpxRouteApproximation(ctx);
    List<GpxPoint> gpxPoints = router.generateGpxPoints(gctx, new LocationsHolder(polyline));
    GpxRouteApproximation r = router.searchGpxRoute(gctx, gpxPoints, null);
    List<RouteSegmentResult> route = new ArrayList<RouteSegmentResult>();
    for (GpxPoint pnt : r.finalPoints) {
        route.addAll(pnt.routeToTarget);
    }
    if (router.useNativeApproximation) {
        RouteResultPreparation preparation = new RouteResultPreparation();
        // preparation.prepareTurnResults(gctx.ctx, route);
        preparation.addTurnInfoDescriptions(route);
    }
    putResultProps(ctx, route, props);
    return route;
}
Also used : LocationsHolder(net.osmand.LocationsHolder) ArrayList(java.util.ArrayList) GpxRouteApproximation(net.osmand.router.RoutePlannerFrontEnd.GpxRouteApproximation) RouteResultPreparation(net.osmand.router.RouteResultPreparation) RouteSegmentResult(net.osmand.router.RouteSegmentResult) GpxPoint(net.osmand.router.RoutePlannerFrontEnd.GpxPoint)

Aggregations

ArrayList (java.util.ArrayList)1 LocationsHolder (net.osmand.LocationsHolder)1 GpxPoint (net.osmand.router.RoutePlannerFrontEnd.GpxPoint)1 GpxRouteApproximation (net.osmand.router.RoutePlannerFrontEnd.GpxRouteApproximation)1 RouteResultPreparation (net.osmand.router.RouteResultPreparation)1 RouteSegmentResult (net.osmand.router.RouteSegmentResult)1