class MyGpsPositionListener implements GpsPositionListener {
@Override
public void positionUpdated(GpsFix pos) {
if (pos.isPosOk()) {
OsmMap mapData = frame.getMap();
Track track = mapData.getTrack(GPS_TRACK_NAME);
MapNode node = null;
if (track != null)
node = track.getLastNode();
if (node == null || pos.getDistKM(node) > 0.01) {
mapData.addToTrack(GPS_TRACK_NAME, pos);
if (gpsCombo.getSelectedIndex() == 2
|| gpsCombo.getSelectedIndex() == 3)
frame.getView().adjustToCenter(pos.getLat(),
pos.getLon());
}