/// <summary> /// Rozpoczecie animacji odjazdu pojazdu /// </summary> /// <param name="lane">pas z ktorego odjezdza pojazd</param> /// <param name="numberOfLanes">ile pasow jest na wlocie</param> /// <param name="direction">kierunek wybrany przez pojazd</param> public void MoveOnDeparture(Lane lane, int numberOfLanes, HorizontalRoadSign direction) { whereTo.GetPointsOnDeparture(lane, numberOfLanes, direction); timer.Tick -= Arrival_Tick; timer.Tick += Departure_Tick; timer.Start(); }
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { HorizontalRoadSign horizontalRoadSign = (HorizontalRoadSign)value; if (horizontalRoadSign == HorizontalRoadSign.None) { return(null); } else { return(horizontalRoadSign); } }
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { HorizontalRoadSign roadSign = (HorizontalRoadSign)value; if (roadSign == HorizontalRoadSign.None) { return(Visibility.Collapsed); } else { return(Visibility.Visible); } }
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { HorizontalRoadSign direction = (HorizontalRoadSign)value; if (direction == HorizontalRoadSign.Lewo) { return(new Uri("pack://application:,,,/Images/HorizontalSigns/Lewo.png", UriKind.Absolute)); } else if (direction == HorizontalRoadSign.LewoProsto) { return(new Uri("pack://application:,,,/Images/HorizontalSigns/LewoProsto.png", UriKind.Absolute)); } else if (direction == HorizontalRoadSign.Prosto) { return(new Uri("pack://application:,,,/Images/HorizontalSigns/Prosto.png", UriKind.Absolute)); } else if (direction == HorizontalRoadSign.PrawoProsto) { return(new Uri("pack://application:,,,/Images/HorizontalSigns/PrawoProsto.png", UriKind.Absolute)); } else if (direction == HorizontalRoadSign.Prawo) { return(new Uri("pack://application:,,,/Images/HorizontalSigns/Prawo.png", UriKind.Absolute)); } else if (direction == HorizontalRoadSign.LewoPrawo) { return(new Uri("pack://application:,,,/Images/HorizontalSigns/LewoPrawo.png", UriKind.Absolute)); } else if (direction == HorizontalRoadSign.LewoPrawoProsto) { return(new Uri("pack://application:,,,/Images/HorizontalSigns/LewoPrawoProsto.png", UriKind.Absolute)); } else if (direction == HorizontalRoadSign.Zawracanie) { return(new Uri("pack://application:,,,/Images/HorizontalSigns/Zawracanie.png", UriKind.Absolute)); } else if (direction == HorizontalRoadSign.ZawracanieProsto) { return(new Uri("pack://application:,,,/Images/HorizontalSigns/ZawracanieProsto.png", UriKind.Absolute)); } else { return(null); } }
/// <summary> /// rozbicie kierunkow na kierunki podstawowe /// </summary> /// <param name="source"></param> /// <returns></returns> public static List <HorizontalRoadSign> DirectionsOnLane(this HorizontalRoadSign source) { Dictionary <HorizontalRoadSign, List <HorizontalRoadSign> > directions = new Dictionary <HorizontalRoadSign, List <HorizontalRoadSign> >() { [HorizontalRoadSign.Zawracanie] = new List <HorizontalRoadSign> { HorizontalRoadSign.Lewo }, [HorizontalRoadSign.ZawracanieProsto] = new List <HorizontalRoadSign> { HorizontalRoadSign.Lewo, HorizontalRoadSign.Prosto }, [HorizontalRoadSign.Lewo] = new List <HorizontalRoadSign> { HorizontalRoadSign.Lewo }, [HorizontalRoadSign.Prawo] = new List <HorizontalRoadSign> { HorizontalRoadSign.Prawo }, [HorizontalRoadSign.Prosto] = new List <HorizontalRoadSign> { HorizontalRoadSign.Prosto }, [HorizontalRoadSign.LewoProsto] = new List <HorizontalRoadSign> { HorizontalRoadSign.Lewo, HorizontalRoadSign.Prosto }, [HorizontalRoadSign.PrawoProsto] = new List <HorizontalRoadSign> { HorizontalRoadSign.Prawo, HorizontalRoadSign.Prosto }, [HorizontalRoadSign.LewoPrawo] = new List <HorizontalRoadSign> { HorizontalRoadSign.Lewo, HorizontalRoadSign.Prawo }, [HorizontalRoadSign.LewoPrawoProsto] = new List <HorizontalRoadSign> { HorizontalRoadSign.Lewo, HorizontalRoadSign.Prawo, HorizontalRoadSign.Prosto } }; var myDirections = (from direction in directions where direction.Key == source select direction.Value).SelectMany(a => a).ToList(); return(myDirections); }
/// <summary> /// rozszerzenie, ktore aktualizuje mozliwe do wybrania kierunki na danym pasie ruchu /// </summary> /// <param name="source">kierunki, ktore sa obecnie mozliwe do wybrania na danym pasie ruchu</param> /// <param name="lanesOnRight">kierunki, ktore sa na pasie ruchu po prawej stronie od danego pasa ruchu</param> /// <param name="lanesOnLeft">kierunki, ktore sa na pasie ruchu po lewej stronie od danego pasa ruchu</param> /// <param name="currentLane">obecny kierunek na pasie, w ktorym aktualizujemy mozliwe kierunki</param> /// <returns>zwraca kierunki, ktore mozemy obecnie wybrac, po uwzglednieniu ograniczen z lewej i prawej strony</returns> public static ObservableCollection <HorizontalRoadSign> LaneUpdate(this ObservableCollection <HorizontalRoadSign> source, List <HorizontalRoadSign> lanesOnRight, List <HorizontalRoadSign> lanesOnLeft, ref HorizontalRoadSign currentLane) { List <HorizontalRoadSign> lane = null; List <HorizontalRoadSign> directionRight = InletExtension.DirectionsCanGo(lanesOnRight, mostRestrictiveDirectionOnRight, directionCanGoOnRight); List <HorizontalRoadSign> directionLeft = InletExtension.DirectionsCanGo(lanesOnLeft, mostRestrictiveDirectionOnLeft, directionCanGoOnLeft); if (!directionLeft.Any() && !directionRight.Any()) { lane = (from inlet in directionCanGoOnLeft select inlet.Key).ToList(); } else if (!directionRight.Any()) { lane = directionLeft; } else if (!directionLeft.Any()) { lane = directionRight; } else { lane = directionRight.Intersect(directionLeft).ToList(); } HorizontalRoadSign temp = currentLane; currentLane = HorizontalRoadSign.None; source.Clear(); foreach (var direction in lane) { source.Add(direction); } currentLane = temp; return(source); }
/// <summary> /// Pobranie punktow do poruszania sie pojazdow podczas odjazdu /// </summary> /// <param name="source">lista punktow do poruszania sie pojazdow</param> /// <param name="lane">pas na ktorym znajduje sie pojazd</param> /// <param name="numberOfLanes">liczba pasow</param> /// <param name="direction">wybrany kierunek</param> /// <returns></returns> public static List <Point> GetPointsOnDeparture(this List <Point> source, Lane lane, int numberOfLanes, HorizontalRoadSign direction) { string keyToGo = numberOfLanes.ToString() + lane + direction; var points = (from point in pointsToGo where point.Key == keyToGo select point.Value).ToList(); foreach (var a in points[0]) { source.Add(a); } return(source); }