public class RoadFinder extends java.lang.Object implements RoadServices, ProjectionListener, RoadLayer
Modifier and Type | Class and Description |
---|---|
protected class |
RoadFinder.BlueLine
a blue line to indicate the found route
|
static class |
RoadFinder.Intersections |
protected class |
RoadFinder.RedPoint
a red point for displaying when we can't find a route between two points
|
static class |
RoadFinder.RoadClasses |
protected class |
RoadFinder.YellowLine
a yellow line for display routes between intersections
|
protected class |
RoadFinder.YellowPoint
a yellow point for displaying intersections
|
Modifier and Type | Field and Description |
---|---|
protected RoadClass |
defaultRoadClass |
protected java.util.Map |
graphicToRoad |
protected float |
halo
how far (in lat-lon space) from lat,lon point to look in quad tree for
nearest road *
|
protected QuadTree |
interQuadTree |
protected RoadFinder.Intersections |
intersections |
protected LayerView |
layer |
protected java.util.Vector |
removedRoads |
protected RoadFinder.RoadClasses |
roadClasses |
protected com.bbn.openmap.tools.roads.RoadFinder.RoadVector |
roads |
Constructor and Description |
---|
RoadFinder(LayerView layer,
boolean drawIntersections,
boolean drawResults) |
Modifier and Type | Method and Description |
---|---|
protected void |
checkIntegrity()
Check the integrity of our data structures.
|
protected LatLonPoint |
createLatLonPoint(int x,
int y) |
protected java.awt.Point |
createPoint(java.awt.Point pt)
Allows subclasses to redefine points returned
|
Road |
createRoad(Intersection from)
called from Intersection Implemented for RoadLayer interface
|
protected Road |
createRoad(int id,
java.lang.String name,
Intersection from,
Intersection to,
RoadClass cl_ss) |
protected RoadObject |
createRoadFromPoints(int id,
int[] xpoints,
int[] ypoints,
int nPoints)
Makes a road object given the points on the shape that are within the
visible box
|
protected Segment |
createSegment(java.util.List newPoints)
Allows subclasses to redefine segments
|
protected void |
deleteIntersection(Intersection intersection) |
void |
deleteRoad(Road road) |
java.util.List |
displayPathOnRoad(java.awt.Point start,
java.awt.Point end,
Route route,
java.util.List segments)
Displays a Route between two points on the map.
|
protected Intersection |
findClosestIntersection(int x,
int y)
Look in intersection Quad Tree for closest intersection to point x,y
|
protected Intersection |
findClosestIntersection(LatLonPoint latLon)
Look in intersection Quad Tree for closest intersection to point at
specified latitude and longitude.
|
protected Intersection |
findIntersection(int x,
int y) |
protected Intersection |
findIntersection(LatLonPoint loc) |
protected Intersection |
findIntersection(LatLonPoint loc,
java.lang.String name) |
RoadClass |
findRoadClass(java.lang.Object className) |
int |
findUnusedRoadID() |
protected void |
getData()
Take the shape data on the layer and use it to populate our roads and
intersections.
|
Route |
getPathOnRoad(LatLonPoint start,
LatLonPoint end)
Returns best Route between two points specified by latitude and longitude.
|
java.util.List |
getPathOnRoad(java.awt.Point start,
java.awt.Point end,
java.util.List segments)
Finds closest intersection to start and end find path from start
intersection to end intersection
|
protected Segment |
getPathSegment(Projection proj,
Road road,
boolean reverse)
Converts a road into a path segment - reverse parameter guarantees the
ordering of the points is consistent across multiple path segments in the
whole route.
|
Projection |
getProjection() |
protected void |
getRoads()
Take the shape data on the layer and use it to populate our roads and
intersections.
|
Route |
getRouteBetweenPoints(java.awt.Point start,
java.awt.Point end)
Returns best Route between two points
This method works on latitude/longitude coordinates.
|
protected void |
initRoadClasses() |
protected java.awt.Point |
interp(double x1,
double y1,
double x2,
double y2,
int width,
int height)
find a point between x1,y1 and x2, y2 that is within the visible map
|
boolean |
isEditing()
BOZO remove me
|
void |
joinRoads(Intersection intersection)
Join two roads into one.
|
protected void |
makeRoad(java.awt.Shape shape,
OMGeometry graphic,
int num,
int[] xPoints,
int[] yPoints,
int segment)
Makes a road object given the points on the shape that are within the
visible box
Stores it in a quadTree
|
protected java.lang.String |
mergeRoadNames(java.lang.String name0,
java.lang.String name1) |
protected void |
populatePointsAndSegments(Route bestRoute,
java.util.List newPoints,
java.util.List segments)
Iterates over route, populating points and segments lists.
|
void |
projectionChanged(ProjectionEvent e)
Implemented for ProtectionListener
|
Intersection |
splitRoad(Road road,
RoadPoint rp)
Split a road into two roads at one of its corners.
|
protected RoadFinder.RoadClasses roadClasses
protected RoadClass defaultRoadClass
protected LayerView layer
protected RoadFinder.Intersections intersections
protected com.bbn.openmap.tools.roads.RoadFinder.RoadVector roads
protected java.util.Vector removedRoads
protected float halo
protected QuadTree interQuadTree
protected java.util.Map graphicToRoad
public RoadFinder(LayerView layer, boolean drawIntersections, boolean drawResults)
protected void initRoadClasses()
public void projectionChanged(ProjectionEvent e)
projectionChanged
in interface ProjectionListener
e
- ProjectionEventprotected void getData() throws java.lang.Exception
java.lang.Exception
protected void getRoads() throws java.lang.Exception
java.lang.Exception
protected java.awt.Point interp(double x1, double y1, double x2, double y2, int width, int height)
width
- of visible mapheight
- of visible mapprotected void makeRoad(java.awt.Shape shape, OMGeometry graphic, int num, int[] xPoints, int[] yPoints, int segment)
protected RoadObject createRoadFromPoints(int id, int[] xpoints, int[] ypoints, int nPoints)
nPoints
- in the xpoints and ypoints arraysprotected LatLonPoint createLatLonPoint(int x, int y)
protected Intersection findIntersection(LatLonPoint loc, java.lang.String name)
protected Intersection findIntersection(int x, int y)
protected Intersection findIntersection(LatLonPoint loc)
protected void deleteIntersection(Intersection intersection)
public Road createRoad(Intersection from)
createRoad
in interface RoadLayer
protected Road createRoad(int id, java.lang.String name, Intersection from, Intersection to, RoadClass cl_ss)
public void deleteRoad(Road road)
public Intersection splitRoad(Road road, RoadPoint rp)
public void joinRoads(Intersection intersection)
protected java.lang.String mergeRoadNames(java.lang.String name0, java.lang.String name1)
public RoadClass findRoadClass(java.lang.Object className)
public int findUnusedRoadID()
public java.util.List displayPathOnRoad(java.awt.Point start, java.awt.Point end, Route route, java.util.List segments)
displayPathOnRoad
in interface RoadServices
start
- start from start point on mapend
- to end point on maproute
- the Route to travel from start to endsegments
- as side effect, populated with PathSegments between
returned WayPointspublic java.util.List getPathOnRoad(java.awt.Point start, java.awt.Point end, java.util.List segments)
This method works on screen coordinates.
getPathOnRoad
in interface RoadServices
start
- from start point on mapend
- to end point on mapsegments
- as side effect, populated with PathSegments between
returned WayPointspublic Route getPathOnRoad(LatLonPoint start, LatLonPoint end)
This method works on latitude/longitude coordinates.
getPathOnRoad
in interface RoadServices
start
- - Start point in latitude/longitude coordinates.end
- - End point in latitude/longitude coordinates.public Route getRouteBetweenPoints(java.awt.Point start, java.awt.Point end)
protected Intersection findClosestIntersection(int x, int y)
protected Intersection findClosestIntersection(LatLonPoint latLon)
protected void populatePointsAndSegments(Route bestRoute, java.util.List newPoints, java.util.List segments)
bestRoute
- route to iterate over.newPoints
- populated with points on the route.segments
- populated with Segments.protected Segment getPathSegment(Projection proj, Road road, boolean reverse)
protected Segment createSegment(java.util.List newPoints)
protected java.awt.Point createPoint(java.awt.Point pt)
public Projection getProjection()
getProjection
in interface RoadLayer
protected void checkIntegrity()
Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details