tRoute.setTravelTime(leg.getTravelTime()); tRoute.setDistance(RouteUtils.calcDistance(tRoute, transitSchedule, network)); Activity act = PopulationUtils.createActivityFromCoordAndLinkId(PtConstants.TRANSIT_ACTIVITY_TYPE, this.transitSchedule.getFacilities().get(tRoute.getAccessStopId()).getCoord(), tRoute.getStartLinkId()); act.setMaximumDuration(0.0); trip.add(act);
public void testLinks() { Link link1 = new FakeLink(Id.create(1, Link.class)); Link link2 = new FakeLink(Id.create(2, Link.class)); Link link3 = new FakeLink(Id.create(3, Link.class)); Link link4 = new FakeLink(Id.create(4, Link.class)); ExperimentalTransitRoute route = new ExperimentalTransitRoute(link1.getId(), link2.getId()); assertEquals(link1.getId(), route.getStartLinkId()); assertEquals(link2.getId(), route.getEndLinkId()); route.setStartLinkId(link3.getId()); route.setEndLinkId(link4.getId()); assertEquals(link3.getId(), route.getStartLinkId()); assertEquals(link4.getId(), route.getEndLinkId()); }
public void testInitializationLinks() { Link link1 = new FakeLink(Id.create(1, Link.class)); Link link2 = new FakeLink(Id.create(2, Link.class)); ExperimentalTransitRoute route = new ExperimentalTransitRoute(link1.getId(), link2.getId()); assertEquals(link1.getId(), route.getStartLinkId()); assertEquals(link2.getId(), route.getEndLinkId()); assertNull(route.getAccessStopId()); assertNull(route.getLineId()); assertNull(route.getEgressStopId()); }
public void testInitializationStops() { TransitScheduleFactory builder = new TransitScheduleFactoryImpl(); TransitStopFacility stop1 = builder.createTransitStopFacility(Id.create(1, TransitStopFacility.class), new Coord(5, 11), false); TransitStopFacility stop2 = builder.createTransitStopFacility(Id.create(2, TransitStopFacility.class), new Coord(18, 7), false); Link link1 = new FakeLink(Id.create(3, Link.class)); Link link2 = new FakeLink(Id.create(4, Link.class)); stop1.setLinkId(link1.getId()); stop2.setLinkId(link2.getId()); TransitLine line = builder.createTransitLine(Id.create(5, TransitLine.class)); TransitRoute tRoute = builder.createTransitRoute(Id.create(6, TransitRoute.class), null, Collections.<TransitRouteStop>emptyList(), "bus"); ExperimentalTransitRoute route = new ExperimentalTransitRoute(stop1, line, tRoute, stop2); assertEquals(stop1.getId(), route.getAccessStopId()); assertEquals(line.getId(), route.getLineId()); assertEquals(tRoute.getId(), route.getRouteId()); assertEquals(stop2.getId(), route.getEgressStopId()); assertEquals(link1.getId(), route.getStartLinkId()); assertEquals(link2.getId(), route.getEndLinkId()); }