jfreerails.client.view
Class NearestStationFinder
java.lang.Object
jfreerails.client.view.NearestStationFinder
public class NearestStationFinder
- extends java.lang.Object
Provides methods that find the nearest station in a given direction, used by
the select station popup window.
- Author:
- Luke
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NOT_FOUND
public static final int NOT_FOUND
- See Also:
- Constant Field Values
world
private final ReadOnlyWorld world
principal
private final FreerailsPrincipal principal
MAX_DISTANCE_TO_SELECT_SQUARED
private final int MAX_DISTANCE_TO_SELECT_SQUARED
- See Also:
- Constant Field Values
NearestStationFinder
public NearestStationFinder(ReadOnlyWorld w,
FreerailsPrincipal player)
findNearestStation
public int findNearestStation(int x,
int y)
findNearestStationInDirection
public int findNearestStationInDirection(int startStation,
Step direction)
isInRightDirection
private boolean isInRightDirection(Step direction,
int deltaX,
int deltaY)
- Returns true if the angle between direction and the vector (deltaX,
deltaY) is less than 45 degrees.