stopTime.setShapeDistTraveled(pindex.distanceAlongShape);
}
distanceTraveledSet = true;
} catch (StopIsTooFarFromShapeException ex) {
StopTimeEntry stopTime = ex.getStopTime();
TripEntry trip = stopTime.getTrip();
StopEntry stop = stopTime.getStop();
AgencyAndId shapeId = trip.getShapeId();
CoordinatePoint point = ex.getPoint();
PointAndIndex pindex = ex.getPointAndIndex();
_log.warn("Stop is too far from shape: trip=" + trip.getId() + " stop="
+ stop.getId() + " stopLat=" + stop.getStopLat() + " stopLon="
+ stop.getStopLon() + " shapeId=" + shapeId + " shapePoint="
+ point + " index=" + pindex.index + " distance="
+ pindex.distanceFromTarget);
} catch (DistanceAlongShapeException ex) {
_invalidStopToShapeMappingExceptionCount++;
}
}
if (!distanceTraveledSet) {
// Make do without
double d = 0;
StopTimeEntryImpl prev = null;
for (StopTimeEntryImpl stopTime : stopTimes) {
if (prev != null) {
CoordinatePoint from = prev.getStop().getStopLocation();
CoordinatePoint to = stopTime.getStop().getStopLocation();
d += SphericalGeometryLibrary.distance(from, to);
}
stopTime.setShapeDistTraveled(d);
prev = stopTime;
}
}
}