Search in sources :

Example 1 with Venue

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

the class BasicVenueActivity method selectLevelByFloorId.

/**
 * Selecting venue level by given floorID
 * @param floorId current indoor position
 */
protected void selectLevelByFloorId(int floorId) {
    if (mVenueMapFragment != null) {
        Venue venue = mVenueMapFragment.getSelectedVenue();
        if (venue != null) {
            mVenueMapFragment.setFloorChangingAnimation(true);
            List<Level> levels = venue.getLevels();
            for (Level item : levels) {
                if (item != null) {
                    if (item.getFloorNumber() == floorId) {
                        mVenueMapFragment.getVenueController(venue).selectLevel(item);
                        break;
                    }
                }
            }
        }
    }
}
Also used : Venue(com.here.android.mpa.venues3d.Venue) Level(com.here.android.mpa.venues3d.Level)

Example 2 with Venue

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

the class BasicVenueActivity method startPositionUpdates.

/**
 * Initialization of Position Updates
 * Called after map initialization
 */
private void startPositionUpdates() {
    Log.v(TAG, "Start of Positioning Updates");
    mPositioningManager = PositioningManager.getInstance();
    if (mPositioningManager == null) {
        Log.w(TAG, "startPositionUpdates: PositioningManager is null");
        return;
    }
    mHereLocation = LocationDataSourceHERE.getInstance(mPositioningStatusListener);
    if (mHereLocation == null) {
        Log.w(TAG, "startPositionUpdates: LocationDataSourceHERE is null");
        finish();
        return;
    }
    mHereLocation.setDiagnosticsListener(new DiagnosticsListener() {

        @Override
        public void onDiagnosticEvent(Event event) {
            Log.v(TAG, "onDiagnosticEvent: %s", event.getDescription());
        }
    });
    mPositioningManager.setDataSource(mHereLocation);
    try {
        mPositioningManager.addListener(new WeakReference<PositioningManager.OnPositionChangedListener>(mActivity));
        if (mIndoorPositioning) {
            mLocationMethod = PositioningManager.LocationMethod.GPS_NETWORK_INDOOR;
            Log.v(TAG, "Location method set to GPS_NETWORK_INDOOR");
        } else {
            mLocationMethod = PositioningManager.LocationMethod.GPS_NETWORK;
            Log.v(TAG, "Location method set to GPS_NETWORK");
        }
        if (!mPositioningManager.start(mLocationMethod)) {
            Log.e(TAG, "startPositionUpdates: PositioningManager.start returned error");
        }
    } catch (Exception ex) {
        Log.w(TAG, "startPositionUpdates: Could not register for location updates: %s", Log.getStackTraceString(ex));
    }
    try {
        mRadioMapLoader = new RadioMapLoadHelper(LocationDataSourceHERE.getInstance().getRadioMapLoader(), new RadioMapLoadHelper.Listener() {

            @Override
            public void onError(@NonNull Venue venue, RadioMapLoader.Status status) {
            // Radio map loading failed with status.
            }

            @Override
            public void onProgress(@NonNull Venue venue, int progress) {
            // Radio map loading progress.
            }

            @Override
            public void onCompleted(@NonNull Venue venue, RadioMapLoader.Status status) {
                Log.i(TAG, "Radio map for venue: " + venue.getId() + ", completed with status: " + status);
            // Radio map loading completed with status.
            }
        });
        mVenueService.addVenueLoadListener(mVenueLoadListener);
    } catch (Exception ex) {
        Log.e(TAG, "startPositionUpdates: setting up radio map loader failed", ex);
        mRadioMapLoader = null;
    }
}
Also used : DiagnosticsListener(com.here.android.positioning.DiagnosticsListener) OnGestureListener(com.here.android.mpa.mapping.MapGesture.OnGestureListener) OnTransformListener(com.here.android.mpa.mapping.Map.OnTransformListener) VenueServiceListener(com.here.android.mpa.venues3d.VenueService.VenueServiceListener) VenueListener(com.here.android.mpa.venues3d.VenueMapFragment.VenueListener) StatusListener(com.here.android.positioning.StatusListener) OnPositionChangedListener(com.here.android.mpa.common.PositioningManager.OnPositionChangedListener) OnEngineInitListener(com.here.android.mpa.common.OnEngineInitListener) Venue(com.here.android.mpa.venues3d.Venue) OnPositionChangedListener(com.here.android.mpa.common.PositioningManager.OnPositionChangedListener) NonNull(androidx.annotation.NonNull) DiagnosticsListener(com.here.android.positioning.DiagnosticsListener) RadioMapLoadHelper(com.here.android.positioning.helpers.RadioMapLoadHelper)

Aggregations

Venue (com.here.android.mpa.venues3d.Venue)2 NonNull (androidx.annotation.NonNull)1 OnEngineInitListener (com.here.android.mpa.common.OnEngineInitListener)1 OnPositionChangedListener (com.here.android.mpa.common.PositioningManager.OnPositionChangedListener)1 OnTransformListener (com.here.android.mpa.mapping.Map.OnTransformListener)1 OnGestureListener (com.here.android.mpa.mapping.MapGesture.OnGestureListener)1 Level (com.here.android.mpa.venues3d.Level)1 VenueListener (com.here.android.mpa.venues3d.VenueMapFragment.VenueListener)1 VenueServiceListener (com.here.android.mpa.venues3d.VenueService.VenueServiceListener)1 DiagnosticsListener (com.here.android.positioning.DiagnosticsListener)1 StatusListener (com.here.android.positioning.StatusListener)1 RadioMapLoadHelper (com.here.android.positioning.helpers.RadioMapLoadHelper)1