public RouteDestination(string name, RoutePattern pattern) { Name = name; Pattern = pattern; }
/// <summary> /// This converts the XML nodes corresponding to a Corvallis Bus Route Destination into Platform objects. /// </summary> private static IEnumerable<RouteDestination> ParseDestinations(IEnumerable<XElement> destinationsXml) => destinationsXml.Select(destinationXml => { string fullName = destinationXml.FirstAttribute.Value; // Only one pattern exists per platform. var patternXml = destinationXml.Elements().SingleOrDefault(); // The "mif" is the big string that's really a space-separated CSV // of the Lat/Longs the route travels. // // No idea why it's called "mif", but whatever. string mif = patternXml.Elements().Skip(1).First().Value; // This gets us to the tag where we can get actual platform data var platformsXml = patternXml.Elements().Skip(2); var platforms = ParsePlatformsForRoutes(platformsXml); var mifAndPlatform = new RoutePattern(mif, platforms); return new RouteDestination(fullName, mifAndPlatform); });