|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--geography.Streetmap
A street map. Supports address lookup and route planning. The map can be constructed from a .map file, or by adding StreetSegments one at a time.
| Field Summary | |
protected geography.AddressFinder |
af
An object that can look up addresses on the map. |
protected graph.KeyedDigraph |
g
A directed graph of the streets. |
protected graph.Weighter |
weighter
For finding the weights of edges in g. |
| Constructor Summary | |
Streetmap()
Constructs an empty streetmap (empty graph). |
|
Streetmap(java.lang.String filename)
Constructs a streetmap from a .map file. |
|
| Method Summary | |
geography.AddressFinder |
addressFinder()
Return an address finder for this street map. |
protected void |
addStreetSegment(geography.StreetSegment ss)
Adds a new street segment to the map. |
static double |
edgeDirection(graph.DirectedEdge e)
Given an edge of g, returns the direction of the street segment it represents, as a number in degrees from -180 to 180. |
static double |
edgeLength(graph.DirectedEdge e)
Given an edge of g, returns the length in meters of the street segment it represents. |
static void |
main(java.lang.String[] args)
A simple interaction with the user. |
geography.Intersection |
readIntersection(java.io.BufferedReader br,
java.lang.String prompt)
Get an address from the user on the input stream underlying br, and return the corresponding intersection if we can find it. |
geography.Route |
shortestRoute(geography.Intersection isctStart,
geography.Intersection isctEnd)
Returns a shortest route between two intersections. |
geography.Route |
shortestRoute(geography.Point pStart,
geography.Point pEnd)
Returns a shortest route between two points. |
geography.Route |
shortestRoute(java.lang.String addrStart,
java.lang.String addrEnd)
Given two addresses, returns a shortest route between them. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected graph.KeyedDigraph g
protected geography.AddressFinder af
protected graph.Weighter weighter
| Constructor Detail |
public Streetmap()
public Streetmap(java.lang.String filename)
throws java.io.IOException,
DataFormatException
| Method Detail |
protected void addStreetSegment(geography.StreetSegment ss)
public geography.AddressFinder addressFinder()
public geography.Route shortestRoute(geography.Point pStart,
geography.Point pEnd)
throws NoSuchVertexException
NoSuchVertexException - if the points are not
both vertices of our map graph.
public geography.Route shortestRoute(geography.Intersection isctStart,
geography.Intersection isctEnd)
throws NoSuchVertexException
NoSuchVertexException - if either intersection is
null, or is not on our map graph.
public geography.Route shortestRoute(java.lang.String addrStart,
java.lang.String addrEnd)
throws DataFormatException,
NoSuchVertexException
NoSuchVertexException - if either address cannot
be found on this street map, even approximately
(e.g., if the map is empty).
DataFormatExceptionpublic static double edgeLength(graph.DirectedEdge e)
public static double edgeDirection(graph.DirectedEdge e)
Point.directionTo(geography.Point).
public geography.Intersection readIntersection(java.io.BufferedReader br,
java.lang.String prompt)
throws java.io.IOException
java.io.IOException
public static void main(java.lang.String[] args)
throws java.io.IOException,
DataFormatException,
java.lang.ArrayIndexOutOfBoundsException
java.io.IOException
DataFormatException
java.lang.ArrayIndexOutOfBoundsException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||