Search in sources :

Example 1 with RoutingController

use of com.here.android.mpa.venues3d.RoutingController in project here-android-sdk-examples by heremaps.

the class Venue3dActivity method onCalculateRouteClick.

// Setup routing parameters and calculate route.
public void onCalculateRouteClick(View v) {
    if ((startLocation == null) || (endLocation == null)) {
        Toast.makeText(getApplicationContext(), "you have to set start and stop point", Toast.LENGTH_SHORT).show();
        return;
    }
    VenueRouteOptions venueRouteOptions = new VenueRouteOptions();
    RouteOptions options = venueRouteOptions.getRouteOptions();
    // Set algorithm mode (fastest, shortest).
    options.setRouteType(Type.values()[m_routingOptionType.getSelectedItemPosition()]);
    // Set transport mode (pedestrian, car, public_transport).
    options.setTransportMode(TransportMode.values()[m_routingOptionMode.getSelectedItemPosition()]);
    options.setRouteCount(1);
    venueRouteOptions.setRouteOptions(options);
    RoutingController routingController = m_mapFragment.getRoutingController();
    // This is an async function, the logic to display route is in callback
    // onCombinedRouteCompleted(CombinedRoute route)
    routingController.calculateCombinedRoute(startLocation, endLocation, venueRouteOptions);
}
Also used : RoutingController(com.here.android.mpa.venues3d.RoutingController) VenueRouteOptions(com.here.android.mpa.venues3d.VenueRouteOptions) VenueRouteOptions(com.here.android.mpa.venues3d.VenueRouteOptions) RouteOptions(com.here.android.mpa.routing.RouteOptions)

Example 2 with RoutingController

use of com.here.android.mpa.venues3d.RoutingController in project here-android-sdk-examples by heremaps.

the class Venue3dActivity method DisplayRoute.

// Display computed route on the map.
private boolean DisplayRoute(CombinedRoute route) {
    RoutingController routingController = m_mapFragment.getRoutingController();
    routingController.showRoute(route);
    return true;
}
Also used : RoutingController(com.here.android.mpa.venues3d.RoutingController)

Example 3 with RoutingController

use of com.here.android.mpa.venues3d.RoutingController in project here-android-sdk-examples by heremaps.

the class Venue3dActivity method onCombinedRouteCompleted.

@Override
public void onCombinedRouteCompleted(CombinedRoute route) {
    boolean result = false;
    RoutingController routingController = m_mapFragment.getRoutingController();
    if (route.getRouteSections().size() > 0) {
        result = DisplayRoute(route);
    }
    if (!result) {
        routingController.hideRoute();
    }
    String textResult = "Combined route result:" + (result ? "SUCCESS" : "FAIL");
    Toast.makeText(getApplicationContext(), textResult, Toast.LENGTH_SHORT).show();
}
Also used : RoutingController(com.here.android.mpa.venues3d.RoutingController)

Aggregations

RoutingController (com.here.android.mpa.venues3d.RoutingController)3 RouteOptions (com.here.android.mpa.routing.RouteOptions)1 VenueRouteOptions (com.here.android.mpa.venues3d.VenueRouteOptions)1