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);
}
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;
}
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();
}
Aggregations