Skip to content

Commit

Permalink
endless circle line: set await departure true and transport mode
Browse files Browse the repository at this point in the history
  • Loading branch information
vsp-gleich committed Oct 15, 2024
1 parent afc50ff commit 9270a9d
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ private void createLoopingTransitRoute(Id<TransitLine> transitLineId, Id<Transit
routeToCopy.getStops().getLast().getStopFacility(),
routeToCopy.getStops().getFirst().getArrivalOffset(),
routeToCopy.getStops().getFirst().getDepartureOffset());
firstRouteStop.setAwaitDepartureTime(true);
transitRouteStops.add(firstRouteStop);

loopingNetworkRouteLinks.add(firstRouteStop.getStopFacility().getLinkId());
Expand All @@ -131,20 +132,24 @@ private void createLoopingTransitRoute(Id<TransitLine> transitLineId, Id<Transit

// skip first and last stop and add merged stop instead to avoid stopping twice at loopStartTransitStopId
for (TransitRouteStop stop : routeToCopy.getStops().subList(1, routeToCopy.getStops().size() - 1)) {
transitRouteStops.add(factory.createTransitRouteStop(stop.getStopFacility(),
TransitRouteStop transitRouteStop = factory.createTransitRouteStop(stop.getStopFacility(),
stop.getArrivalOffset().seconds() + loopingsDone * loopingTravelTime,
stop.getDepartureOffset().seconds() + loopingsDone * loopingTravelTime));
stop.getDepartureOffset().seconds() + loopingsDone * loopingTravelTime);
transitRouteStop.setAwaitDepartureTime(true);
transitRouteStops.add(transitRouteStop);
}
// add last stop of this looping which is first stop of next looping
TransitRouteStop lastRouteStop = factory.createTransitRouteStop(
routeToCopy.getStops().getLast().getStopFacility(),
routeToCopy.getStops().getLast().getArrivalOffset().seconds() + loopingsDone * loopingTravelTime,
routeToCopy.getStops().getFirst().getDepartureOffset().seconds() + (loopingsDone + 1) * loopingTravelTime);
lastRouteStop.setAwaitDepartureTime(true);
transitRouteStops.add(lastRouteStop);
}
// at least for S41 and S42 last link in network route ends at same node as first link -> continuous
NetworkRoute networkRoute = RouteUtils.createNetworkRoute(loopingNetworkRouteLinks);
TransitRoute loopingRoute = factory.createTransitRoute(loopingTransitRouteId, networkRoute, transitRouteStops, "multiple loopings in one route");
loopingRoute.setTransportMode(routeToCopy.getTransportMode());

int departureIdCounter = 0;
for (double departureTime = firstDepartureTime; departureTime < firstDepartureTime + loopingTravelTime; departureTime = departureTime + headway) {
Expand Down

0 comments on commit 9270a9d

Please sign in to comment.