示例#1
0
        public static RailDirection RailDirectionUnderSignals(SignalDirection18 signalDirection)
        {
            switch (signalDirection)
            {
                case SignalDirection18.HorizontalBoth:
                    return RailDirection.Horizontal;
                case SignalDirection18.HorizontalLeft:
                    return RailDirection.Horizontal;
                case SignalDirection18.HorizontalRight:
                    return RailDirection.Horizontal;

                case SignalDirection18.VerticalBoth:
                    return RailDirection.Vertical;
                case SignalDirection18.VerticalDown:
                    return RailDirection.Vertical;
                case SignalDirection18.VerticalUp:
                    return RailDirection.Vertical;

                case SignalDirection18.UpLeftBoth:
                    return RailDirection.UpLeft;
                case SignalDirection18.UpLeftLeft:
                    return RailDirection.UpLeft;
                case SignalDirection18.UpLeftUp:
                    return RailDirection.UpLeft;

                case SignalDirection18.UpRightBoth:
                    return RailDirection.UpRight;
                case SignalDirection18.UpRightRight:
                    return RailDirection.UpRight;
                case SignalDirection18.UpRightUp:
                    return RailDirection.UpRight;

                case SignalDirection18.DownLeftBoth:
                    return RailDirection.DownLeft;
                case SignalDirection18.DownLeftDown:
                    return RailDirection.DownLeft;
                case SignalDirection18.DownLeftLeft:
                    return RailDirection.DownLeft;

                case SignalDirection18.DownRightBoth:
                    return RailDirection.DownRight;
                case SignalDirection18.DownRightDown:
                    return RailDirection.DownRight;
                case SignalDirection18.DownRightRight:
                    return RailDirection.DownRight;
                default:
                    throw new ArgumentOutOfRangeException("signalDirection");
            }
        }
示例#2
0
 public static bool IsDisjoint(SignalDirection18 a, SignalDirection18 b)
 {
     return AreTwoDisjointRailTracks((ToRailDirectionFlags(RailDirectionUnderSignals(a))
         | ToRailDirectionFlags(RailDirectionUnderSignals(b)))
         );
 }