public static double distanse(busLine bL, BusLineStation source, BusLineStation target) { int index1 = bL.myStations.IndexOf(source); int index2 = bL.myStations.IndexOf(target); ////צריך לתקן ע"י שסוכמים את כל המרחקים return(Math.Sqrt((bL.myStations[index2].bS.Latitude - bL.myStations[index1].bS.Latitude) * (bL.myStations[index2].bS.Latitude - bL.myStations[index1].bS.Latitude) + ((bL.myStations[index2].bS.Longitude - bL.myStations[index1].bS.Longitude) * (bL.myStations[index2].bS.Longitude - bL.myStations[index1].bS.Longitude)))); }
public static busLine route(busLine bL, BusLineStation source, BusLineStation target) { int index1 = bL.myStations.IndexOf(source); int index2 = bL.myStations.IndexOf(target); busLine newBus = new busLine(0, source, target); for (int i = index1; i < index2; ++i) { newBus.myStations.Add(bL.myStations[i]); } return(newBus); }
public busLine Compare(object obj, BusLineStation source, BusLineStation target) { busLine other = (busLine)obj; if (this.Time(source, target) > other.Time(source, target)) { return(other); } else if (this.Time(source, target) <= other.Time(source, target)) { return(this); } throw new NotImplementedException(); }