コード例 #1
0
        public EntrySignal(ExitSignal referenceSignal, string displayName)
        {
            this.displayName = displayName;
            switch (referenceSignal.signalState)
            {
            case 0: {
                //Grön blink
                break;
            }

            case 1: {
                //Vit blink
                break;
            }

            case 2: {
                //Två gröna blinkar
                break;
            }

            case 3: {
                //Två gröna blinkar
                break;
            }

            default: {
                //Grön blink
                break;
            }
            }
        }
コード例 #2
0
ファイル: Route.cs プロジェクト: TNTPata/S-osim
 //Overload for e2. 1 exit signal, 2 protected signals, (2 forbidden routes), 2 switches
 public Route(ExitSignal includedExitSignal, Signal protectedSignal1, Signal protectedSignal2, Switch includedSwitch1, Switch includedSwitch2, string displayName)
 {
     this.displayName = displayName;
     includedSignals.Add(includedExitSignal);
     protectedSignals.Add(protectedSignal1);
     protectedSignals.Add(protectedSignal2);
     curvedSwitches.Add(includedSwitch1);
     curvedSwitches.Add(includedSwitch2);
 }
コード例 #3
0
ファイル: Route.cs プロジェクト: TNTPata/S-osim
 //Overload for o1. 4 signals, 1 protected signal, 3 switches, 1 derail, 1 road signal
 public Route(EntrySignal A, EntrySignal C, ExitSignal D, ExitSignal F, EntrySignal B, Switch includedSwitch1, Switch includedSwitch2, Switch includedSwitch3, Derail includedDerail, RoadSignal includedRoadSignal, string displayName)
 {
     this.displayName = displayName;
     includedSignals.Add(A);
     includedSignals.Add(C);
     includedSignals.Add(D);
     includedSignals.Add(F);
     straightSwitches.Add(includedSwitch1);
     straightSwitches.Add(includedSwitch2);
     straightSwitches.Add(includedSwitch3);
     raisedDerails.Add(includedDerail);
     includedSignals.Add(includedRoadSignal);
 }
コード例 #4
0
ファイル: Route.cs プロジェクト: TNTPata/S-osim
 //Overload for d1/d2/d3. 1 exit signal, 1 protected signal, 1 switch, 1 derail, 1 road signal
 //Because the routes use the same objects, the specific route needs to be selected to ensure objects are locked in their correct positions
 public Route(int variant, ExitSignal includedExitSignal, Signal protectedSignal, Switch includedSwitch, Derail includedDerail, Signal includedRoadSignal, string displayName)
 {
     if (variant == 1)
     {
         this.displayName = displayName;
         includedSignals.Add(includedExitSignal);
         protectedSignals.Add(protectedSignal);
         straightSwitches.Add(includedSwitch);
         raisedDerails.Add(includedDerail);
         includedSignals.Add(includedRoadSignal);
     }
     else if (variant == 2)
     {
         this.displayName = displayName;
         includedSignals.Add(includedExitSignal);
         protectedSignals.Add(protectedSignal);
         curvedSwitches.Add(includedSwitch);
         loweredDerails.Add(includedDerail);
         includedSignals.Add(includedRoadSignal);
     }
 }
コード例 #5
0
ファイル: Route.cs プロジェクト: TNTPata/S-osim
 //Overload for F. 1 exit signal, 1 protected signal
 public Route(ExitSignal includedExitSignal, Signal protectedSignal, string displayName)
 {
     this.displayName = displayName;
     includedSignals.Add(includedExitSignal);
     protectedSignals.Add(protectedSignal);
 }
コード例 #6
0
ファイル: Interlocking.cs プロジェクト: TNTPata/S-osim
        //Constructor
        public Interlocking()
        {
            #region objectInit
            //Init 6 switches and 2 derails
            switch1 = new Switch("Växel 1");
            switch2 = new Switch("Växel 2");
            switch3 = new Switch("Växel 3");
            switch4 = new Switch("Växel 4");
            switch5 = new Switch("Växel 5");
            switch8 = new Switch("Växel 8");

            derail1 = new Derail("Spårspärr I");
            derail2 = new Derail("Spårspärr II");

            //Init 2 exit signals
            D = new ExitSignal("D");
            F = new ExitSignal("F");

            //Init 3 entry signals
            A = new EntrySignal(D, "A");
            B = new EntrySignal("B");
            C = new EntrySignal(F, "C");

            //Init distant signal
            AFsi = new DistSignal(A, "AFsi");

            //Init road signal
            V1 = new RoadSignal("V1");

            //Init road distant signal(s. There are actually two, but since they display the same aspect at all times, it is counted as one for simplicity)
            V1Fsi = new DistroadSignal(V1, "V1Fsi");

            //Init road crossing
            crossing_V1 = new Crossing(V1, "Sundbyvägen");
            #endregion
            #region routeInit
            //Init arrival routes
            route_a1 = new Route(A, F, switch1, switch8, "a1");
            route_a2 = new Route(2, A, B, F, switch1, switch3, switch8, "a2");
            route_a3 = new Route(3, A, B, F, switch1, switch3, switch8, "a3");
            route_b1 = new Route(1, B, switch1, switch3, switch8, "b1");
            route_b2 = new Route(2, B, switch1, switch3, switch8, "b2");
            route_c1 = new Route(C, D, switch2, derail2, V1, "c1");
            route_c2 = new Route(2, C, D, switch2, switch4, derail2, V1, "c2");
            route_c3 = new Route(3, C, D, switch2, switch4, derail2, V1, "c3");

            //Init departure routes
            route_d1   = new Route(1, D, C, switch2, derail2, V1, "d1");
            route_d2_3 = new Route(2, D, C, switch2, derail2, V1, "d2/3");
            route_e1   = new Route(B, switch1, switch8, "e1");
            route_e2   = new Route(F, A, B, switch1, switch8, "e2");
            route_F    = new Route(F, A, "F");

            //Init unmonitored route
            route_o1 = new Route(A, C, D, F, B, switch1, switch2, switch8, derail2, V1, "o1");
            #endregion

            #region Fill "saving" lists with objects
            //Fill "saving" lists with objects
            allSignals.Add(A);
            allSignals.Add(B);
            allSignals.Add(C);
            allSignals.Add(D);
            allSignals.Add(F);
            allSignals.Add(AFsi);
            allSignals.Add(V1);
            allSignals.Add(V1Fsi);

            allSwitches.Add(switch1);
            allSwitches.Add(switch2);
            allSwitches.Add(switch3);
            allSwitches.Add(switch4);
            allSwitches.Add(switch5);
            allSwitches.Add(switch8);

            allDerails.Add(derail1);
            allDerails.Add(derail2);

            allRoutes.Add(route_a1);
            allRoutes.Add(route_a2);
            allRoutes.Add(route_a3);
            allRoutes.Add(route_b1);
            allRoutes.Add(route_b2);
            allRoutes.Add(route_b2);
            allRoutes.Add(route_c1);
            allRoutes.Add(route_c2);
            allRoutes.Add(route_c3);

            allRoutes.Add(route_d1);
            allRoutes.Add(route_d2_3);
            allRoutes.Add(route_e1);
            allRoutes.Add(route_e2);
            allRoutes.Add(route_F);
            allRoutes.Add(route_o1);
            #endregion

            #region Set forbidden routes
            //Add forbidden routes for some routes.
            route_a1.forbiddenRoutes.Add(route_c1);
            route_a1.forbiddenRoutes.Add(route_F);
            route_a2.forbiddenRoutes.Add(route_c2);
            route_a2.forbiddenRoutes.Add(route_F);
            route_a3.forbiddenRoutes.Add(route_c3);
            route_a3.forbiddenRoutes.Add(route_F);

            route_b1.forbiddenRoutes.Add(route_c2);
            route_b1.forbiddenRoutes.Add(route_e1);
            route_b1.forbiddenRoutes.Add(route_e2);
            route_b2.forbiddenRoutes.Add(route_c3);
            route_b2.forbiddenRoutes.Add(route_e1);
            route_b2.forbiddenRoutes.Add(route_e2);

            route_c1.forbiddenRoutes.Add(route_a1);
            route_c2.forbiddenRoutes.Add(route_a2);
            route_c2.forbiddenRoutes.Add(route_b1);
            route_c3.forbiddenRoutes.Add(route_a3);
            route_c3.forbiddenRoutes.Add(route_b2);

            route_e2.forbiddenRoutes.Add(route_a2);
            route_e2.forbiddenRoutes.Add(route_a3);
            Debug.WriteLine("[PRG/INFO] Constructed interlocking.");
            #endregion
        }