HERE Android SDK Developer's Guide

Venue Zoom

Certain 3D venues may have fine details that are not visible even at the maximum map zoom level. The HERE SDK offers a way to activate a venue-focused extended zoom mode to show a venue in a closer view. These fine details are not available for all venues.

Figure 1. A venue at the max zoom level
Figure 2. A venue with Venue Zoom enabled

To enable this extended Venue Zoom feature, call VenueService.enableVenueZoom(true) at any time.


// Get an instance of VenueService:
VenueService service = m_mapFragment.getVenueService();

// To enable Venue Zoom:
service.enableVenueZoom(true);

//...

// To disable Venue Zoom:
service.enableVenueZoom(false);

After enabling Venue Zoom, you can use one of the following ways to activate the feature. If the application input is based on gestures, the most convenient way is to register an instance of VenueGestureListener, which implements OnGestureListener to receive gesture events. When the map is zoomed using gestures to the maximum level and Venue Zoom is enabled, 3D venues are automatically shown in an enlarged mode. Note that VenueGestureListener only handles pinch zoom events and activates Venue Zoom in a supported area. In all other situations it returns false for the gesture events, and thus has effectively no impact on gesture handling.

The example code below shows how the gesture handler can be used with Venue Zoom:


private VenueGestureListener m_gestureListener = null;

// to be done in onCreate/onResume:
if ( myExtendedZoomLevel == false ) {
  // Max map zoom level is depending on display metrics
  DisplayMetrics metrics = getResources().getDisplayMetrics();
  m_gestureListener = new VenueGestureListener(m_mapFragment, m_zoomLevelText, metrics.densityDpi);
  m_mapFragment.getMapGesture().addOnGestureListener(m_gestureListener);
  service.enableVenueZoom(true);
} else  if (m_gestureListener != null) {
  m_mapFragment.getMapGesture().removeOnGestureListener(m_gestureListener);
  m_gestureListener = null;
  service.enableVenueZoom(false);
}
Note: You can also use VenueMapFragment.VenueZoomListener to determine whether the Venue Zoom feature was successfully activated.

Another way to activate Venue Zoom is to use the useVenueZoom(true) method of VenueController to immediately and activate Venue Zoom in a supported area.


// Get VenueController:
venueController = m_mapFragment.getVenueController(venue);

// To activate Venue Zoom (only works in a supported Venue)
venueController.useVenueZoom(true);

// To return to a normal zoom level
venueController.useVenueZoom(false);

While venue zoom is activated, only 3D Venues are shown, and the base map becomes hidden. If venue zoom is activated while a venue route is being displayed, only the indoor portions of the routes are shown. You can use VenueZoomListener to determine whether the feature was successfully activated.

Once activated, the visible map becomes two zoom levels larger than they would appear without Venue Zoom. For example, if Venue Zoom is activated at map zoom level 18, the venues are shown as if the map is at zoom level 20. Note that this behavior only occurs when the map is at zoom level 18 or higher.

Scaling Custom Map Objects

For custom polygon-based map objects, the HERE SDK offers scaling methods to scale them to be used with Venue Zoom. Each point of the polygon need to be scaled to be used in Venue Zoom using VenueController.getScaledGeoCoordinate(GeoCoordinate). If the reverse operation is desired, where the starting point is a scaled polygon or geolocation, the getNormalGeoCoordinate(GeoCoordinate) method returns geocoordinates for a non-scaled geolocation.

Note: While both MapGeoModel and MapLocalModel can be scaled by these scaling methods, it is recommended to use MapGeoModel, since only the anchor point location can be scaled in a MapLocalModel.

In most cases it makes most sense to create two map objects, one for used in normal zoom mode and one used in Venue Zoom mode. Use Map.addMapObject(MapObject) and Map.removeMapObject(MapObject) to swap between objects when changing between normal and Venue Zoom mode.

Enlarged 3D Models and Venue Zoom

Venue Zoom displays enlarged venue models that are automatically generated. Model generation happens in the following situations:

  • Venue Zoom is enabled and a venue is downloaded from the backend.
  • Venue Zoom is enabled and a venue is opened, and there is no enlarged model generated yet.

Note that if a venue is opened in 3D mode and then Venue Zoom is enabled, Venue Zoom would not successfully activate if the enlarged venue model has not been generated. In this case, the Venue Zoom can be used after the venue is closed and then opened again. If an enlarged model has already been generated earlier, then Venue Zoom can be used immediately after it has been enabled.