use of org.opentripplanner.graph_builder.issues.BogusShapeGeometryCaught in project OpenTripPlanner by opentripplanner.
the class GeometryAndBlockProcessor method createStraightLineHopeGeometries.
private LineString[] createStraightLineHopeGeometries(List<StopTime> stopTimes, FeedScopedId shapeId) {
LineString[] geoms = new LineString[stopTimes.size() - 1];
StopTime st0;
for (int i = 0; i < stopTimes.size() - 1; ++i) {
st0 = stopTimes.get(i);
StopTime st1 = stopTimes.get(i + 1);
LineString geometry = createSimpleGeometry(st0.getStop(), st1.getStop());
geoms[i] = geometry;
// this warning is not strictly correct, but will do
issueStore.add(new BogusShapeGeometryCaught(shapeId, st0, st1));
}
return geoms;
}
use of org.opentripplanner.graph_builder.issues.BogusShapeGeometryCaught in project OpenTripPlanner by opentripplanner.
the class GeometryAndBlockProcessor method getSegmentGeometry.
private LineString getSegmentGeometry(FeedScopedId shapeId, LocationIndexedLine locationIndexedLine, LinearLocation startIndex, LinearLocation endIndex, double startDistance, double endDistance, StopTime st0, StopTime st1) {
ShapeSegmentKey key = new ShapeSegmentKey(shapeId, startDistance, endDistance);
LineString geometry = geometriesByShapeSegmentKey.get(key);
if (geometry == null) {
geometry = (LineString) locationIndexedLine.extractLine(startIndex, endIndex);
// Pack the resulting line string
CoordinateSequence sequence = new PackedCoordinateSequence.Double(geometry.getCoordinates(), 2);
geometry = geometryFactory.createLineString(sequence);
if (!isValid(geometry, st0.getStop(), st1.getStop())) {
issueStore.add(new BogusShapeGeometryCaught(shapeId, st0, st1));
// fall back to trivial geometry
geometry = createSimpleGeometry(st0.getStop(), st1.getStop());
}
geometriesByShapeSegmentKey.put(key, geometry);
}
return geometry;
}
Aggregations