Search in sources :

Example 1 with VenueRouteOptions

use of com.here.android.mpa.venues3d.VenueRouteOptions 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 VenueRouteOptions

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

the class BasicVenueActivity method onCalculateRouteClick.

// Setup routing parameters and calculate route.
public void onCalculateRouteClick(View v) {
    if (mLastReceivedPosition != null && mSelectedVenue != null && mSelectedSpace != null) {
        VenueRouteOptions venueRouteOptions = new VenueRouteOptions();
        RouteOptions options = venueRouteOptions.getRouteOptions();
        // Set algorithm mode shortest and transport mode pedestrian in this case
        options.setRouteType(RouteOptions.Type.SHORTEST);
        options.setTransportMode(RouteOptions.TransportMode.PEDESTRIAN);
        options.setRouteCount(1);
        venueRouteOptions.setRouteOptions(options);
        VenueController selectedVenueController = mVenueMapFragment.getVenueController(mSelectedVenue);
        if (selectedVenueController != null && mRoutingController != null) {
            Toast.makeText(BasicVenueActivity.this, "Calculating route...", Toast.LENGTH_SHORT).show();
            // Determine start location either from the venue as
            // LevelLocation, or from outside as OutdoorLocation
            BaseLocation startLocation;
            if ((mLastReceivedPosition.getPositionSource() == GeoPosition.SOURCE_INDOOR)) {
                Level startLevel = selectedVenueController.getSelectedLevel();
                for (final Level level : selectedVenueController.getVenue().getLevels()) {
                    if (level.getFloorNumber() == mLastReceivedPosition.getFloorId()) {
                        startLevel = level;
                        break;
                    }
                }
                startLocation = new LevelLocation(startLevel, mLastReceivedPosition.getCoordinate(), selectedVenueController);
            } else {
                startLocation = new OutdoorLocation(mLastReceivedPosition.getCoordinate());
            }
            // End location is in this case always the selected space
            BaseLocation endLocation = new SpaceLocation(mSelectedSpace, selectedVenueController);
            // This is an async function, the logic to display route is in callback
            // onCombinedRouteCompleted(CombinedRoute route)
            mRoutingController.calculateCombinedRoute(startLocation, endLocation, venueRouteOptions);
        }
    } else {
        Toast.makeText(BasicVenueActivity.this, "Unable to calculate route", Toast.LENGTH_SHORT).show();
    }
}
Also used : LevelLocation(com.here.android.mpa.venues3d.LevelLocation) SpaceLocation(com.here.android.mpa.venues3d.SpaceLocation) VenueController(com.here.android.mpa.venues3d.VenueController) VenueRouteOptions(com.here.android.mpa.venues3d.VenueRouteOptions) Level(com.here.android.mpa.venues3d.Level) OutdoorLocation(com.here.android.mpa.venues3d.OutdoorLocation) VenueRouteOptions(com.here.android.mpa.venues3d.VenueRouteOptions) RouteOptions(com.here.android.mpa.routing.RouteOptions) BaseLocation(com.here.android.mpa.venues3d.BaseLocation)

Aggregations

RouteOptions (com.here.android.mpa.routing.RouteOptions)2 VenueRouteOptions (com.here.android.mpa.venues3d.VenueRouteOptions)2 BaseLocation (com.here.android.mpa.venues3d.BaseLocation)1 Level (com.here.android.mpa.venues3d.Level)1 LevelLocation (com.here.android.mpa.venues3d.LevelLocation)1 OutdoorLocation (com.here.android.mpa.venues3d.OutdoorLocation)1 RoutingController (com.here.android.mpa.venues3d.RoutingController)1 SpaceLocation (com.here.android.mpa.venues3d.SpaceLocation)1 VenueController (com.here.android.mpa.venues3d.VenueController)1