|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--geography.Route
A route in a Streetmap. This is just a wrapper around a Path in the Streetmap's graph, whose vertices hold Points and whose edges hold street names. The toString() method gives nice route descriptions.
| Field Summary | |
protected static java.lang.String[] |
DIR_NAMES
Direction names for evenly spaced points around the compass. |
protected static double |
MERGE_ANGLE_TOLERANCE
Two segments of the same street need not be separately reported unless their direction changes by more than plus or minus this many degrees. |
protected graph.Path |
path
The path, or null if no path exists. |
protected static double[] |
TURN_CUTOFFS
Cutoffs for the different descriptions in TURN_NAMES. |
protected static java.lang.String[] |
TURN_NAMES
To describe a turn of d degrees, we use the first description in TURN_NAMES whose corresponding cutoff in TURN_CUTOFFS is >= d. |
protected int |
verbosity
See Route(Path,int). |
| Constructor Summary | |
Route(graph.Path path)
Turns a Path into a Route. |
|
Route(graph.Path path,
int verbosity)
Turns a Path into a Route. |
|
| Method Summary | |
protected java.lang.String |
angleString(double degrees)
Way to print angles for the user. |
protected static double |
dirChange(graph.DirectedEdge e1,
graph.DirectedEdge e2)
Change in direction of a turn from e1 onto e2. |
protected java.lang.String |
dirName(graph.DirectedEdge e)
Turns a direction into its printable name. |
protected java.lang.String |
distanceString(double meters)
Turns a distance into printable form. |
protected graph.DirectedEdge |
getEdge(int index)
Get a particular edge of the path. |
private boolean |
hasTurn(graph.DirectedEdge e1,
graph.DirectedEdge e2)
Do we have to report a turn from e1 onto e2, or are we just continuing pretty much straight on the same street? |
private boolean |
streetChange(graph.DirectedEdge e1,
graph.DirectedEdge e2)
Does the transition from e1 to e2 represent a change of street? |
protected java.lang.String |
streetName(graph.DirectedEdge e)
Given an edge, returns a printable street name for the street segment it represents. |
java.lang.String |
toString()
Describes the route as a long string of several \n-terminated lines. |
protected java.lang.String |
turnName(graph.DirectedEdge e1,
graph.DirectedEdge e2)
Turns a change in direction into its printable name: describes a turn from ss1 onto ss2. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected graph.Path path
protected int verbosity
Route(Path,int).
protected static final double MERGE_ANGLE_TOLERANCE
protected static final double[] TURN_CUTOFFS
protected static final java.lang.String[] TURN_NAMES
protected static final java.lang.String[] DIR_NAMES
| Constructor Detail |
public Route(graph.Path path)
public Route(graph.Path path,
int verbosity)
| Method Detail |
public java.lang.String toString()
hasTurn(graph.DirectedEdge, graph.DirectedEdge)) would have caused us to break
this line into multiple lines.
toString in class java.lang.Objectprotected java.lang.String streetName(graph.DirectedEdge e)
protected java.lang.String dirName(graph.DirectedEdge e)
DIR_NAMES.
protected java.lang.String turnName(graph.DirectedEdge e1,
graph.DirectedEdge e2)
TURN_NAMES.
protected java.lang.String distanceString(double meters)
protected java.lang.String angleString(double degrees)
private boolean hasTurn(graph.DirectedEdge e1,
graph.DirectedEdge e2)
An unnamed street is fair game to be the same as this one.
See documentation for MERGE_ANGLE_TOLERANCE. If
verbosity is >= 3, we report all turns.
private boolean streetChange(graph.DirectedEdge e1,
graph.DirectedEdge e2)
If either edge is unnamed, assume there's no change of street. This reduces the number of unnamed edges that are unnecessarily printed -- it is common for one segment of a long street to be missing its name.
protected graph.DirectedEdge getEdge(int index)
protected static final double dirChange(graph.DirectedEdge e1,
graph.DirectedEdge e2)
Return value is from -180 to 180 degrees. Positive values are counterclockwise.
This method is final because it doesn't make sense to override it; it's just true.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||