//Overload for c2/c3. 1 entry signal, 1 protected signal, (2 forbidden routes), 2 switches, 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, EntrySignal includedEntrySignal, Signal protectedSignal, Switch includedSwitch1, Switch includedSwitch2, Derail includedDerail, RoadSignal includedRoadSignal, string displayName) { if (variant == 2) { this.displayName = displayName; includedSignals.Add(includedEntrySignal); protectedSignals.Add(protectedSignal); curvedSwitches.Add(includedSwitch1); straightSwitches.Add(includedSwitch2); loweredDerails.Add(includedDerail); includedSignals.Add(includedRoadSignal); } else if (variant == 3) { this.displayName = displayName; includedSignals.Add(includedEntrySignal); protectedSignals.Add(protectedSignal); curvedSwitches.Add(includedSwitch1); curvedSwitches.Add(includedSwitch2); loweredDerails.Add(includedDerail); includedSignals.Add(includedRoadSignal); } }
//Overload for c1. 1 entry signal, 1 protected signal, (1 forbidden route), 1 switch, 1 derail, 1 road signal public Route(EntrySignal includedEntrySignal, Signal protectedSignal, Switch includedSwitch, Derail includedDerail, RoadSignal includedRoadSignal, string displayName) { this.displayName = displayName; includedSignals.Add(includedEntrySignal); protectedSignals.Add(protectedSignal); straightSwitches.Add(includedSwitch); raisedDerails.Add(includedDerail); includedSignals.Add(includedRoadSignal); }
//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 }
//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); }
public DistroadSignal(RoadSignal referenceSignal, string displayName) { signalState = referenceSignal.signalState; this.displayName = displayName; }