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

ZoomFollowSettings

An interface that allows you to control the zoom settings of the map during steering.

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

When there are no maneuvers ahead and behind, or on low value roads (non-main streets of settlements, highways, intercity or federal highways) the scale value is chosen based on the SpeedRangeToZoom values, which are stored in the speed_range_to_zoom_sequence sequence.The speed_range_to_zoom_sequence should contain speed intervals sorted by ascending min_speed values, conditions must be met: max_speedi > min_speedi+1

max_speedi < = min_speedi+2

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

The map scale is selected from the speed_range_to_zoom_sequence sequence according to the algorithm:

  • At the start of tracking, an element of the sequence with index == 0 is selected.
  • During the movement, a check is made to see if current speed value out of range speeds specified in the sequence element with index index, if the speed is out of range, then there is a search for a neighboring interval in which the speed value falls and its index is remembered.
  • There is a check whether we are passing a maneuver, it is considered that we are passing a maneuver if there is a maneuver along the way movement and the distance to the maneuver does not exceed the specified in SpeedRangeToZoom, or we passed the maneuver, but did not moved away from it at a distance greater than that specified in SpeedRangeToZoom. If we pass a maneuver, then the scale corresponding to the element of the sequence with index == 0 is selected; otherwise, the scale corresponding to the index element is selected.
  • When approaching the maneuver at the current speed, the scale will gradually increase.The increase time depends on the speed and distance to the maneuver. Increasing the speed increases the animation time, decreasing the speed reduces it. The increase in the zoom level ends at a certain distance before the maneuver.

    After passing through the maneuver, the zoom level gradually decreases.

    Properties

    A sequence of speed intervals and their corresponding scales. Used to automatically change the scale in the navigator depending on the speed.

    The duration of the smooth change in the zoom level in the guidance mode when changing speed when there are no maneuvers ahead / behind at a sufficiently close distance, or on roads of low value.

    The duration of the smooth increase in the zoom level when approaching a maneuver.

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

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

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

    The 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 will be ignored.

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