Ejemplo n.º 1
0
 /// <summary>
 /// Calculates and sets new signal aspects.
 /// </summary>
 private void UpdateAspects()
 {
     if (LastIndication == ESignalIndication.Stop)
     {
         Aspects = new Aspects(EAspectsType.Red, 0);
     }
     else if (FlagBy)
     {
         Aspects = new Aspects(EAspectsType.AllLunar, 0);
     }
     else
     {
         Route route = null;
         foreach (KeyValuePair <Signal, Route> i in RoutesFrom)
         {
             bool matches = true;
             foreach (RoutePointPosition j in i.Value.PointPositions)
             {
                 matches = matches && (j.IgnoredForAspectCalculation || (j.Points.Reversed == j.Reverse));
             }
             if (matches)
             {
                 route = i.Value;
                 break;
             }
         }
         if (route == null)
         {
             Aspects = new Aspects(EAspectsType.Red, 0);
         }
         else
         {
             bool tcUnclear = false;
             foreach (RouteElement i in route.Elements)
             {
                 tcUnclear = tcUnclear || i.TrackCircuit.Occupied || i.TrackCircuit.ReversedHandPoints;
             }
             if (tcUnclear)
             {
                 Aspects = new Aspects(EAspectsType.Red, 0);
             }
             else if (route.Restricting)
             {
                 Aspects = new Aspects(EAspectsType.OneLunar, route.Divergence);
             }
             else if (route.Divergence == 0)
             {
                 Aspects = route.Exit.Aspects.NextInRear(DivergenceLookahead);
             }
             else
             {
                 Aspects = route.Exit.Aspects.NextInRearDiverging(route.Divergence, route.DivergenceDistanceStraightOnly);
             }
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Calculates and sets new signal aspects.
 /// </summary>
 private void UpdateAspects()
 {
     if ((ProtectedTrackCircuit != null) && (ProtectedTrackCircuit.Occupied || ProtectedTrackCircuit.ReversedHandPoints))
     {
         Aspects = new Aspects(EAspectsType.Red, 0);
     }
     else if (NextSignal != null)
     {
         Aspects = NextSignal.Aspects.NextInRear(DivergenceLookahead);
     }
     else
     {
         Aspects = new Aspects(EAspectsType.Red, 0);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Compares two aspect sets for inequality.
 /// </summary>
 /// <param name="other">The aspect set to compare to.</param>
 /// <returns><c>true</c> if <paramref name="other"/> is equal to this, or <c>false</c> if not.</returns>
 public bool Equals(Aspects other)
 {
     return(this == other);
 }