public string GetSignalCode(SignalCodes code) { switch (code) { case SignalCodes.StartingSignal: return(SignalMorseCodes[0]); case SignalCodes.InvitationToTransmit: return(SignalMorseCodes[1]); case SignalCodes.Understood: return(SignalMorseCodes[2]); case SignalCodes.Error: return(SignalMorseCodes[3]); case SignalCodes.Wait: return(SignalMorseCodes[4]); case SignalCodes.EndOfWork: return(SignalMorseCodes[5]); default: return(string.Empty); } }
/// <summary> /// Add the information about a signal for the current time step /// </summary> /// <param name="LinkID">ID of the link under signal control</param> /// <param name="LeftTurnCode">Signal code for left turns: red, yellow, protected green, green, none</param> /// <param name="LeftDiagonalTurnCode">Signal code for left diagonal turns: red, yellow, protected green, green, none</param> /// <param name="ThroughCode">Signal code for through movements: red, yellow, protected green, green, none</param> /// <param name="RightDiagonalTurnCode">Signal code for right diagonal turns: red, yellow, protected green, green, none</param> /// <param name="RightTurnCode">Signal code for right turns: red, yellow, protected green, green, none</param> public void AddSignal(uint LinkID, SignalCodes LeftTurnCode, SignalCodes LeftDiagonalTurnCode, SignalCodes ThroughCode, SignalCodes RightDiagonalTurnCode, SignalCodes RightTurnCode) { if (Finished) { return; } if (signals == null) { signals = new Signals(); } signal MySignal = new signal(); signals.signals.Add(MySignal); MySignal.LinkID = LinkID; MySignal.LeftTurnCode = (ushort)LeftTurnCode; MySignal.LeftDiagonalTurnCode = (ushort)LeftDiagonalTurnCode; MySignal.ThroughCode = (ushort)ThroughCode; MySignal.RightDiagonalTurnCode = (ushort)RightDiagonalTurnCode; MySignal.RightTurnCode = (ushort)RightTurnCode; }