private void setConnectedStopFacilitiesToIsBlocking() { Set<TransitStopFacility> facilitiesToExchange = new HashSet<>(); for (TransitStopFacility oldFacility : this.schedule.getFacilities().values()) { if (this.network .getLinks() .get(oldFacility.getLinkId()) .getAllowedModes() .contains(TransportMode.car)) { TransitStopFacility newFacility = this.scheduleFactory.createTransitStopFacility( oldFacility.getId(), oldFacility.getCoord(), true); newFacility.setName(oldFacility.getName()); newFacility.setLinkId(oldFacility.getLinkId()); newFacility.setStopPostAreaId(oldFacility.getStopPostAreaId()); facilitiesToExchange.add(newFacility); } } for (TransitStopFacility facility : facilitiesToExchange) { TransitStopFacility facilityToRemove = this.schedule.getFacilities().get(facility.getId()); this.schedule.removeStopFacility(facilityToRemove); this.schedule.addStopFacility(facility); } }
private LeastCostPathCalculator.Path getShortestPath(Node startNode, TransitRouteStop toStop) { LeastCostPathCalculator.Path shortestPath = null; for (Id<TransitStopFacility> toStopFacilityId : linkedStopFacilitiesTree.get(toStop.getStopFacility().getId())) { TransitStopFacility facility = this.schedule.getFacilities().get(toStopFacilityId); Id<Link> linkId = facility.getLinkId(); Link link = this.network.getLinks().get(linkId); Node endNode = link.getFromNode(); LeastCostPathCalculator.Path tempShortestPath = this.router.calcLeastCostPath(startNode, endNode, "", ""); if (tempShortestPath != null && (shortestPath == null || (tempShortestPath.travelCost < shortestPath.travelCost))) { shortestPath = tempShortestPath; toStop.setStopFacility(this.schedule.getFacilities().get(toStopFacilityId)); } } return shortestPath; }