// Split each edge independently. If a only one splitter vertex is used, routing may take
// shortcuts thought the splitter vertex to avoid turn penalties.
IntersectionVertex e1midpoint = new IntersectionVertex(linker.graph, "split 1 at " + label, midCoord.x, midCoord.y, name);
// We are replacing two edges with four edges
// Note: Always enable elevation. This should not be a big waste of memory.
StreetWithElevationEdge forward1 = new StreetWithElevationEdge(e1v1, e1midpoint, forward1Geom, name, lengthIn,
e1.getPermission(), e1.isBack());
StreetWithElevationEdge forward2 = new StreetWithElevationEdge(e1midpoint, e1v2, forward2Geom, name, lengthOut,
e1.getPermission(), e1.isBack());
if (e1 instanceof AreaEdge) {
((AreaEdge) e1).getArea().addVertex(e1midpoint, linker.graph);
}
addEdges(forward1, forward2);
StreetWithElevationEdge backward1 = null;
StreetWithElevationEdge backward2 = null;
IntersectionVertex e2midpoint = null;
if (e2 != null) {
e2midpoint = new IntersectionVertex(linker.graph, "split 2 at " + label, midCoord.x, midCoord.y, name);
backward1 = new StreetWithElevationEdge(e2v1, e2midpoint, backGeometryPair.first,
name, lengthOut, e2.getPermission(), e2.isBack());
backward2 = new StreetWithElevationEdge(e2midpoint, e2v2, backGeometryPair.second,
name, lengthIn, e2.getPermission(), e2.isBack());
if (e2 instanceof AreaEdge) {
((AreaEdge) e2).getArea().addVertex(e2midpoint, linker.graph);
}
backward1.setBicycleSafetyFactor(e2.getBicycleSafetyFactor());
backward2.setBicycleSafetyFactor(e2.getBicycleSafetyFactor());
backward1.setElevationProfile(ElevationUtils.getPartialElevationProfile(
e2.getElevationProfile(), 0, lengthOut), false);
backward2.setElevationProfile(ElevationUtils.getPartialElevationProfile(
e2.getElevationProfile(), lengthIn, totalGeomLength), false);
backward1.setHasBogusName(e2.hasBogusName());
backward2.setHasBogusName(e2.hasBogusName());
backward1.setStairs(e2.isStairs());
backward2.setStairs(e2.isStairs());
backward1.setWheelchairAccessible(e2.isWheelchairAccessible());
backward2.setWheelchairAccessible(e2.isWheelchairAccessible());
addEdges(backward1, backward2);
}
forward1.setBicycleSafetyFactor(e1.getBicycleSafetyFactor());
forward2.setBicycleSafetyFactor(e1.getBicycleSafetyFactor());