if (shapeId == null)
return null;
ShapePoints shapePoints = _shapePointService.getShapePointsForShapeId(shapeId);
BlockStopTimeEntry fromStop = null;
BlockStopTimeEntry toStop = null;
if (builder.getFromStop() != null)
fromStop = builder.getFromStop().getBlockStopTime();
if (builder.getToStop() != null)
toStop = builder.getToStop().getBlockStopTime();
CoordinatePoint nextPoint = null;
BlockTripEntry nextBlockTrip = builder.getNextTrip();
if (nextBlockTrip != null) {
TripEntry nextTrip = nextBlockTrip.getTrip();
AgencyAndId nextShapeId = nextTrip.getShapeId();
if (nextShapeId != null) {
ShapePoints nextShapePoints = _shapePointService.getShapePointsForShapeId(nextShapeId);
nextPoint = nextShapePoints.getPointForIndex(0);
}
}
if (fromStop == null && toStop == null) {
return ShapeSupport.getFullPath(shapePoints, nextPoint);
}
if (fromStop == null && toStop != null) {
return ShapeSupport.getPartialPathToStop(shapePoints,
toStop.getStopTime());
}
if (fromStop != null && toStop == null) {
return ShapeSupport.getPartialPathFromStop(shapePoints,
fromStop.getStopTime(), nextPoint);
}
return ShapeSupport.getPartialPathBetweenStops(shapePoints,
fromStop.getStopTime(), toStop.getStopTime());
}