Search in sources :

Example 56 with Stop

use of org.onebusaway.gtfs.model.Stop in project onebusaway-gtfs-modules by OneBusAway.

the class AddOmnySubwayData method run.

@Override
public void run(TransformContext context, GtfsMutableRelationalDao dao) {
    int stop_count = 0;
    int route_count = 0;
    // Per MOTP-1770 all stops/routes are now OMNY enabled.
    for (Stop stop : dao.getAllStops()) {
        stop.setRegionalFareCardAccepted(1);
        stop_count++;
    }
    for (Route route : dao.getAllRoutes()) {
        route.setRegionalFareCardAccepted(1);
        route_count++;
    }
    _log.info("Set {} stops and {} routes to omny_enabled Y", stop_count, route_count);
}
Also used : Stop(org.onebusaway.gtfs.model.Stop) Route(org.onebusaway.gtfs.model.Route)

Example 57 with Stop

use of org.onebusaway.gtfs.model.Stop in project onebusaway-gtfs-modules by OneBusAway.

the class StopMergeStrategy method save.

@Override
protected void save(GtfsMergeContext context, IdentityBean<?> entity) {
    GtfsRelationalDao source = context.getSource();
    GtfsMutableRelationalDao target = context.getTarget();
    Stop stop = (Stop) entity;
    super.save(context, entity);
}
Also used : GtfsMutableRelationalDao(org.onebusaway.gtfs.services.GtfsMutableRelationalDao) GtfsRelationalDao(org.onebusaway.gtfs.services.GtfsRelationalDao) Stop(org.onebusaway.gtfs.model.Stop)

Example 58 with Stop

use of org.onebusaway.gtfs.model.Stop in project onebusaway-gtfs-modules by OneBusAway.

the class LatLonFieldMappingFactoryTest method testTranslateFromCSVToObject.

@Test
public void testTranslateFromCSVToObject() {
    Map<String, Object> csvValues = new HashMap<String, Object>();
    csvValues.put("stop_lat", "47.1234");
    Stop stop = new Stop();
    _fieldMapping.translateFromCSVToObject(new CsvEntityContextImpl(), csvValues, BeanWrapperFactory.wrap(stop));
    assertEquals(47.1234, stop.getLat(), 0.00001);
}
Also used : CsvEntityContextImpl(org.onebusaway.csv_entities.CsvEntityContextImpl) HashMap(java.util.HashMap) Stop(org.onebusaway.gtfs.model.Stop) Test(org.junit.Test)

Example 59 with Stop

use of org.onebusaway.gtfs.model.Stop in project onebusaway-gtfs-modules by OneBusAway.

the class LatLonFieldMappingFactoryTest method testTranslateFromObjectToCSV.

@Test
public void testTranslateFromObjectToCSV() {
    Stop stop = new Stop();
    stop.setLat(47.5678);
    Map<String, Object> csvValues = new HashMap<String, Object>();
    _fieldMapping.translateFromObjectToCSV(new CsvEntityContextImpl(), BeanWrapperFactory.wrap(stop), csvValues);
    assertEquals("47.567800", csvValues.get("stop_lat"));
}
Also used : CsvEntityContextImpl(org.onebusaway.csv_entities.CsvEntityContextImpl) Stop(org.onebusaway.gtfs.model.Stop) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 60 with Stop

use of org.onebusaway.gtfs.model.Stop in project onebusaway-gtfs-modules by OneBusAway.

the class LatLonFieldMappingFactoryTest method testTranslateFromObjectToCSV_differentLocale.

@Test
public void testTranslateFromObjectToCSV_differentLocale() {
    Locale.setDefault(Locale.FRANCE);
    _fieldMapping = buildFieldMapping();
    Stop stop = new Stop();
    stop.setLat(47.5678);
    Map<String, Object> csvValues = new HashMap<String, Object>();
    _fieldMapping.translateFromObjectToCSV(new CsvEntityContextImpl(), BeanWrapperFactory.wrap(stop), csvValues);
    assertEquals("47.567800", csvValues.get("stop_lat"));
}
Also used : CsvEntityContextImpl(org.onebusaway.csv_entities.CsvEntityContextImpl) Stop(org.onebusaway.gtfs.model.Stop) HashMap(java.util.HashMap) Test(org.junit.Test)

Aggregations

Stop (org.onebusaway.gtfs.model.Stop)160 AgencyAndId (org.onebusaway.gtfs.model.AgencyAndId)75 TransitStop (org.opentripplanner.routing.vertextype.TransitStop)49 Trip (org.onebusaway.gtfs.model.Trip)40 Test (org.junit.Test)39 ArrayList (java.util.ArrayList)33 StopTime (org.onebusaway.gtfs.model.StopTime)33 Route (org.onebusaway.gtfs.model.Route)28 TripPattern (org.opentripplanner.routing.edgetype.TripPattern)23 Agency (org.onebusaway.gtfs.model.Agency)19 Vertex (org.opentripplanner.routing.graph.Vertex)18 HashMap (java.util.HashMap)14 TripTimes (org.opentripplanner.routing.trippattern.TripTimes)13 GtfsMutableRelationalDao (org.onebusaway.gtfs.services.GtfsMutableRelationalDao)11 LineString (com.vividsolutions.jts.geom.LineString)10 List (java.util.List)10 GET (javax.ws.rs.GET)10 ShapePoint (org.onebusaway.gtfs.model.ShapePoint)10 GraphPath (org.opentripplanner.routing.spt.GraphPath)10 Coordinate (com.vividsolutions.jts.geom.Coordinate)9