Classes and Data Structures
RasterAPIHandler
This class provides static
methods that allow processing requests from the web browser for map images. These images will be rastered into one large image to be displayed to the user.
This class does not have any instance variables.
Point
Represents a point on the map.
Instance Variables
x
- the x-axis (or equivalent) coordinate of a point.y
- the y-axis (or equivalent) coordinate of a point.
AugmentedStreetMapGraph
An augmented graph that is more powerful than a standard StreetMapGraph.
Specifically, it supports the following additional operations such as finding a node in the graph whose associated (lon, lat)
coordinates are closest to some given coordinates.
Instance Variables
HashMap<Point, Node> nodePointMap
- a map keeping track what graphNode
is associated with a certainPoint
on the map.WeirdPointSet pointSet
- a set of all the points associated with the reachableNode
s in this graph.
Algorithms
AugmentedStreetMapGraph
closest
The closest
method takes in map coordinates, (lon, lat)
, and returns the id
of the graph Node
, whose associated
map Point
, is closest to the given coordinates. We pass the given coordinates into our pointSet
’s nearest
method to get the nearest Point
. We then use the nodePoint
map to find the graph Node
associated with the returned Point
.
Persistence
Note: This section was not required for Project 2, but is necessary for Project 3.