org.onebusaway.transit_data_federation.impl.shapes
Class ShapePointsLibrary
java.lang.Object
org.onebusaway.transit_data_federation.impl.shapes.ShapePointsLibrary
public class ShapePointsLibrary
- extends Object
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ShapePointsLibrary
public ShapePointsLibrary()
ShapePointsLibrary
public ShapePointsLibrary(double localMinimumThreshold)
setLocalMinimumThreshold
public void setLocalMinimumThreshold(double localMinimumThreshold)
- When searching for the closest point along a block's shape, there may be
multiple local minimums as a block potentially loops back on itself. This
threshold (in meters) determines how close a local minimum should be if it
is to be considered.
getProjectedShapePoints
public List<XYPoint> getProjectedShapePoints(ShapePoints shapePoints,
UTMProjection projection)
computePotentialAssignments
public List<PointAndIndex> computePotentialAssignments(List<XYPoint> projectedShapePoints,
double[] shapePointDistance,
XYPoint targetPoint,
int fromIndex,
int toIndex)
- Here is the idea:
Given a shape as an array of XY Points, a range over those points, and a
target point, find the closest location(s) along the shape for the target
point.
The trick is that there may be multiple good assignments, especially for a
shape that loops back on itself. In this case, we look for assignments
within our
_localMinimumThreshold
distance. There will typically
be ranges of assignments that apply and we take the local min within each
range. We then return each of these local mins as a potential assignment.
There is an additional wrinkle when the section of the shape that loops
back occurs where all the shape points are within
_localMinimumThreshold
of the target point. In this case, we no
longer consider the local min for the section, but the individual local
mins within the section. That is to say, if we find a local min and then
the shape moves away and comes back, we'll consider the second local min as
a new potential assignment.
If no assignments are found within the _localMinimumThreshold
distance, we just return the global min.
- Parameters:
projectedShapePoints
- shapePointDistance
- targetPoint
- fromIndex
- toIndex
-
- Returns:
Copyright © 2012 OneBusAway. All Rights Reserved.