Ejemplo n.º 1
0
 public static void FormatRoutes(List <Tuple <BusRoute, string[], string[]> > routes, CompactFormatWriter writer)
 {
     for (int i = 0; i < routes.Count; i++)
     {
         var route = routes[i];
         writer.WriteString(route.Item1.ID);
         writer.WriteQuotedString(route.Item1.Name);
         writer.WriteQuotedString(route.Item1.Description);
         writer.WriteString(route.Item1.Agency);
         writer.OpenParens();
         foreach (var stop in route.Item2)
         {
             writer.WriteString(stop);
             writer.NextItem();
         }
         writer.CloseParens();
         writer.OpenParens();
         foreach (var shape in route.Item3)
         {
             writer.WriteQuotedString(shape);
             writer.NextItem();
         }
         writer.CloseParens();
         writer.NextItem();
     }
 }
Ejemplo n.º 2
0
 public void Format(CompactFormatWriter formatter)
 {
     for (int i = 0; i < DaySchedules.Count; i++)
     {
         formatter.WriteInt((int)Days[i]);
         formatter.WriteInt((int)TechnicalDays[i]);
         formatter.OpenParens();
         DaySchedules[i].Format(formatter);
         formatter.CloseParens();
         formatter.NextItem();
     }
 }
Ejemplo n.º 3
0
        public void Format(CompactFormatWriter formatter)
        {
            string curRoute = "";

            foreach (var item in Data)
            {
                if (curRoute == "")
                {
                    curRoute = item.Item1;
                    formatter.WriteString(curRoute);
                    formatter.OpenParens();
                }
                else if (item.Item1 != curRoute)
                {
                    curRoute = item.Item1;
                    formatter.CloseParens();
                    formatter.NextItem();
                    formatter.WriteString(curRoute);
                    formatter.OpenParens();
                }
                formatter.WriteQuotedString(item.Item2);
                formatter.OpenParens();
                foreach (var subItem in item.Item3)
                {
                    formatter.WriteInt(subItem.Item1);
                    formatter.WriteString(subItem.Item2);
                    if (subItem.Item3 != null)
                    {
                        formatter.WriteInt(subItem.Item3.Value);
                    }
                    formatter.NextItem();
                }
                formatter.CloseParens();
                formatter.NextItem();
            }
            formatter.CloseParens();
        }
Ejemplo n.º 4
0
 public static void FormatAgencies(List <Tuple <TransitAgency, string[]> > agencies, CompactFormatWriter writer)
 {
     for (int i = 0; i < agencies.Count; i++)
     {
         var agency = agencies[i];
         writer.WriteString(agency.Item1.ID);
         writer.WriteQuotedString(agency.Item1.Name);
         writer.WriteQuotedString(agency.Item1.Url);
         writer.OpenParens();
         foreach (var route in agency.Item2)
         {
             writer.WriteString(route);
             writer.NextItem();
         }
         writer.CloseParens();
         writer.NextItem();
     }
 }
Ejemplo n.º 5
0
 public static void FormatStops(List <BusStop> stops, CompactFormatWriter writer)
 {
     for (int i = 0; i < stops.Count; i++)
     {
         var stop = stops[i];
         writer.WriteString(stop.ID);
         writer.WriteInt((int)stop.Direction);
         writer.WriteString(stop.Position.Latitude.ToString());
         writer.WriteString(stop.Position.Longitude.ToString());
         writer.WriteQuotedString(stop.Name);
         writer.WriteString(stop.Code);
         writer.WriteInt(stop.LocationType);
         writer.OpenParens();
         foreach (var route in stop.Routes)
         {
             writer.WriteString(route);
             writer.NextItem();
         }
         writer.CloseParens();
         writer.NextItem();
     }
 }
Ejemplo n.º 6
0
 public static void FormatAgencies(List<Tuple<TransitAgency, string[]>> agencies, CompactFormatWriter writer)
 {
     while (agencies.Count > 0)
     {
         var agency = agencies[0];
         writer.WriteString(agency.Item1.ID);
         writer.WriteQuotedString(agency.Item1.Name);
         writer.WriteQuotedString(agency.Item1.Url);
         writer.OpenParens();
         foreach (var route in agency.Item2)
         {
             writer.WriteString(route);
             writer.NextItem();
         }
         writer.CloseParens();
         writer.NextItem();
         agencies.RemoveAt(0);
     }
 }
Ejemplo n.º 7
0
 public static void FormatRoutes(List<Tuple<BusRoute, string[], string[]>> routes, CompactFormatWriter writer)
 {
     while (routes.Count > 0)
     {
         var route = routes[0];
         writer.WriteString(route.Item1.ID);
         writer.WriteQuotedString(route.Item1.Name);
         writer.WriteString(route.Item1.ID);
         writer.WriteString(route.Item1.Agency);
         writer.OpenParens();
         foreach (var stop in route.Item2)
         {
             writer.WriteString(stop);
             writer.NextItem();
         }
         writer.CloseParens();
         writer.OpenParens();
         foreach (var shape in route.Item3)
         {
             writer.WriteQuotedString(shape);
             writer.NextItem();
         }
         writer.CloseParens();
         writer.NextItem();
         routes.RemoveAt(0);
     }
 }
Ejemplo n.º 8
0
 public static void FormatStops(List<BusStop> stops, CompactFormatWriter writer)
 {
     for (int i = 0; i < stops.Count; i++)
     {
         var stop = stops[i];
         writer.WriteString(stop.ID);
         writer.WriteInt((int)stop.Direction);
         writer.WriteString(stop.Position.Latitude.ToString());
         writer.WriteString(stop.Position.Longitude.ToString());
         writer.WriteQuotedString(stop.Name);
         writer.WriteString(stop.Code);
         writer.WriteInt(stop.LocationType);
         writer.OpenParens();
         foreach (var route in stop.Routes)
         {
             writer.WriteString(route);
             writer.NextItem();
         }
         writer.CloseParens();
         writer.NextItem();
     }
 }
Ejemplo n.º 9
0
 public static void FormatRoutes(List<Tuple<BusRoute, string[], string[]>> routes, CompactFormatWriter writer)
 {
     for (int i = 0; i < routes.Count; i++)
     {
         var route = routes[i];
         writer.WriteString(route.Item1.ID);
         writer.WriteQuotedString(route.Item1.Name);
         writer.WriteQuotedString(route.Item1.Description);
         writer.WriteString(route.Item1.Agency);
         writer.OpenParens();
         foreach (var stop in route.Item2)
         {
             writer.WriteString(stop);
             writer.NextItem();
         }
         writer.CloseParens();
         writer.OpenParens();
         foreach (var shape in route.Item3)
         {
             writer.WriteQuotedString(shape);
             writer.NextItem();
         }
         writer.CloseParens();
         writer.NextItem();
     }
 }