GPS layer modes

When using a GPSLayer, three modes can be set on the layer which define how the map will behave when location updates are received: OFF, AUTOPAN, and NAVIGATION.

OFF

In this mode, the GPS Layer does not pan or zoom automatically. GPS points may be plotted off-screen and in this case the user must pan the map with the mouse to see them. The map has North at the top of the screen but the mode does not enforce this: the user can rotate the map as desired using a rotation control.

AUTOPAN

This is the default mode for the GPSLayer. In this mode, the GPSLayer always keeps the latest point on screen. The map will pan automatically if the latest GPS point is outside of an envelope taking up a certain percentage of the dimensions of the map. In this case, the new extent will be centered at this latest GPS point. Set the boundary of this envelope using gpsLayer.setAutoFocusBoundary(int i), where i is between 0 and 100. For example setting the auto-focus boundary to 0 means the map pans only when the latest point is outside the visible map; setting the boundary to 99 means the map will recenter on every location update. The default auto-focus boundary is set to 20.

gpsLayer.setMode(Mode.AUTOPAN);
gpsLayer.setAutoFocusBoundary(40);

NAVIGATION

This mode is most useful for in-vehicle navigation. In this mode the GPS symbol for the current location is fixed at a certain position on the map, thus will appear stationary while the map pans and rotates around it. The rotation angle of the map will be equal to the current course of the tracked device, such that the symbol will always be pointing to the top of the map. The location on the map of the GPS symbol will always be somewhere along an invisible vertical line dividing the map into equals halves, and the location of the point along this line can be controlled using the setPointHeightFactor(float factor) method. For example setting this factor to 0.0 will show the GPS symbol centered along the bottom edge of the map; setting this to 1.0 will show the symbol centered along the top edge of the map. The default value is 0.5, showing the symbol at the center of the map.

gpsLayer.setMode(Mode.NAVIGATION);
gpsLayer.setNavigationPointHeightFactor(0.3);
2/7/2013