ru.dgis.sdk.navigation.ZoomFollowSettings | Android SDK | 2GIS Documentation


Interface that allows you to manage map scaling settings during navigation.

During navigation, the scale depends on the speed of movement, the presence of maneuvers ahead and behind on the route, and the type of road.

If there are no maneuvers ahead and behind, or on roads with low value (minor streets in settlements, highways, intercity or federal highways), the scale value is selected based on the values SpeedRangeToStyleZoom, which are stored in the speed_range_to_style_zoom_sequence. The sequence speed_range_to_style_zoom_sequence must contain speed intervals sorted in ascending order of min_speed values, and the conditions below must be met: max_speedi > min_speedi+1

max_speedi < = min_speedi+2

max_speedi < max_speedi+1. That is, speed intervals should touch or even intersect, but the speed value should not fall into more than two intervals. However, the minimum speed value is not considered to fall within the interval, i.e. the same speed value may be the maximum speed for one interval, the minimum speed for another, and be inside the interval for a third interval. An exception is the first speed interval, which must contain min_speed == 0.

The map scale is selected from the speed_range_to_style_zoom_sequence using the algorithm:

  • At the start of the navigation, the sequence element with index == 0 is selected.
  • During movement, a check is made to see if the current speed value has gone beyond the speed interval indicated in the sequence element with index. If the speed is beyond the interval, then a neighboring interval is searched that includes the speed value, and its index is remembered.
  • A check is made to see if we are approaching a maneuver. It is considered that we are approaching a maneuver if there is a maneuver in the direction of movement and the distance to the maneuver does not exceed the value specified in SpeedRangeToStyleZoom, or we have passed the maneuver but have not moved away from it by a distance greater than specified in SpeedRangeToStyleZoom. If we are approaching a maneuver, the scale corresponding to the element with index == 0 is selected, otherwise the scale corresponding to the element index is selected.
  • When approaching a maneuver at the current speed, the scale will increase smoothly. The duration of the increase depends on the speed and distance to the maneuver. When the speed is increased, the animation time increases, and when the speed is decreased, it decreases. The increase in zoom level is completed at some distance from the maneuver.

    After passing the maneuver, the zoom level smoothly decreases.


    Sequence of speed intervals and their corresponding scales. Used for automatic map scaling in the navigator based on speed.

    Duration of smooth zoom in the navigation mode as speed changes when there are no maneuvers ahead/behind at a sufficiently close distance, or on roads with low value.

    Duration of smooth zoom increase when approaching a maneuver. Used only if the speed is lower than get_min_speed_to_consider_in_zoom_in_before_maneuver_animation.

    Duration of smooth decrease of the zoom level after completing the maneuver.

    Minimum movement speed in m/s at which the duration of the smooth zoom level change is calculated taking into account not only the proximity to the maneuver, but also the current speed. Must be at least 0.1 m/s, values less than are ignored.

    Acceleration factor for the zoom increase animation when approaching a maneuver. Must be at least 1, values ​​less than this are ignored.

    Distance to the maneuver at which the zoom-in animation must be completed so that the zoom does not change during the maneuver. For example, if there is 300 m before the maneuver, then the zoom-in animation must be completed 50 m before start of the maneuver. Must be at least 1 m, values less than are ignored.

    Minimum animation time. Used to prevent abrupt changes in the zoom level during animation. Must be at least 200, values below are ignored.