Exemple #1
0
    private static List <OCAPITrip> makeTrips(XElement trip)
    {
        List <OCAPITrip> trips = new List <OCAPITrip>();
        String           destination, startTime, busType, tmpGPS, tmpLat, tmpLon;
        int    adjustTime;
        bool   last;
        double adjustAge, gpsSpeed, lat, lon;

        foreach (XElement tr in trip.Elements())
        {
            destination = tr.Element("TripDestination").Value;
            startTime   = tr.Element("TripStartTime").Value;
            adjustTime  = int.Parse(tr.Element("AdjustedScheduleTime").Value);
            adjustAge   = double.Parse(tr.Element("AdjustmentAge").Value);
            last        = tr.Element("LastTripOfSchedule").Value == "true";
            busType     = tr.Element("BusType").Value;
            tmpGPS      = tr.Element("GPSSpeed").Value;
            tmpLat      = tr.Element("Latitude").Value;
            tmpLon      = tr.Element("Longitude").Value;

            gpsSpeed = tmpGPS == "" ? 0 : double.Parse(tmpGPS);
            lat      = tmpLat == "" ? 0 : double.Parse(tmpLat);
            lon      = tmpLon == "" ? 0 : double.Parse(tmpLon);

            trips.Add(OCAPITrip.newOCAPITrip(destination, startTime, adjustTime, adjustAge, busType, gpsSpeed, lat, lon, last));
        }

        return(trips);
    }
Exemple #2
0
 public static OCAPITrip newOCAPITrip(String destination, String startTime, int adjustTime, double adjustAge, String busType, double gpsSpeed = 0, double latitude = 0, double longitude = 0, bool lastTrip = false)
 {
     OCAPITrip trip = new OCAPITrip();
     trip.Destination = destination;
     trip.StartTime = startTime;
     trip.AdjustTime = adjustTime;
     trip.LastTrip = lastTrip;
     trip.BusType = busType;
     trip.GPSSpeed = gpsSpeed;
     trip.Latitude = latitude;
     trip.Longitude = longitude;
     trip.AdjustAge = adjustAge;
     return trip;
 }
Exemple #3
0
    public static OCAPITrip newOCAPITrip(String destination, String startTime, int adjustTime, double adjustAge, String busType, double gpsSpeed = 0, double latitude = 0, double longitude = 0, bool lastTrip = false)
    {
        OCAPITrip trip = new OCAPITrip();

        trip.Destination = destination;
        trip.StartTime   = startTime;
        trip.AdjustTime  = adjustTime;
        trip.LastTrip    = lastTrip;
        trip.BusType     = busType;
        trip.GPSSpeed    = gpsSpeed;
        trip.Latitude    = latitude;
        trip.Longitude   = longitude;
        trip.AdjustAge   = adjustAge;
        return(trip);
    }