using System; using System.Collections.Generic; using System.Text; namespace AtomicCityBusScheduler { public class TransportSystem { public string name; public List cLocation; public List cRoute; public TransportSystem() { cLocation = new List(); } public AtomicCityBusScheduler.Location aLocationAt(string locationName) { return cLocation.Find(delegate(AtomicCityBusScheduler.Location obj) { return obj.name == locationName; }); } public Location aLocationNearest(Subgurim.Controles.GLatLng latlon) { double minDistanceSQ = 10^100; Location bestLocation = null; foreach (Location l in cLocation) { double distanceSQ = Math.Pow((latlon.lat - l.latitude), 2) + Math.Pow((latlon.lng - l.longitude), 2); if (distanceSQ < minDistanceSQ) { minDistanceSQ = distanceSQ; bestLocation = l; } } return bestLocation; } } }