use of im.tny.segvault.subway.Lobby in project underlx by underlx.
the class StationPickerView method selectNearestStation.
public void selectNearestStation(Location location) {
float minDistance = Float.MAX_VALUE;
Station minStation = null;
if (adapter == null) {
return;
}
for (Station station : adapter.stations) {
if (station.isAlwaysClosed()) {
continue;
}
for (Lobby lobby : station.getLobbies()) {
for (Lobby.Exit exit : lobby.getExits()) {
Location exitLocation = new Location("");
exitLocation.setLatitude(exit.worldCoord[0]);
exitLocation.setLongitude(exit.worldCoord[1]);
float distance = location.distanceTo(exitLocation);
if (distance < minDistance || minStation == null) {
minDistance = distance;
minStation = station;
}
}
}
}
setSelection(minStation);
}
Aggregations