private Signal GegenSignalSuchen() { bool richtung = this.InZeichenRichtung; Gleis gl = this.AnschlussGleis; if (richtung) { if (gl.Signale[1] != null) { return(gl.Signale[1]); } } else { if (gl.Signale[0] != null) { return(gl.Signale[0]); } } Knoten kn = (richtung ? gl.StartKn : gl.EndKn); while (kn.Weichen[0] == null && kn.Weichen[1] == null) { bool stumpfGleis = true; foreach (Gleis g in kn.Gleise) { if (g != null && g != gl) { gl = g; stumpfGleis = false; break; } } if (stumpfGleis) { break; } richtung = (gl.StartKn == kn); if (richtung) { if (gl.Signale[0] != null) { return(gl.Signale[0]); } } else { if (gl.Signale[1] != null) { return(gl.Signale[1]); } } kn = (richtung ? gl.EndKn : gl.StartKn); } return(null); }
public Gleis(AnlagenElemente parent, Int32 zoom, AnzeigeTyp anzeigeTyp, Knoten startKnoten, Knoten endKnoten) : base(parent, 0, zoom, anzeigeTyp) { _graphicsPath = new GraphicsPath(); KurzBezeichnung = "Gl"; StartKn = startKnoten; EndKn = endKnoten; this.Berechnung(); }
public int GetDirection(Knoten middlePoint) { if (middlePoint == StartKn) { return(_direction); } if (middlePoint == EndKn) { return((_direction + 4) % 8); } return(-1); }
public Weiche(AnlagenElemente parent, Int32 iD, Int32 zoom, AnzeigeTyp anzeigeTyp, Knoten node, Gleis gleis1, Gleis gleis2) : base(parent, iD, zoom, anzeigeTyp) { Ausgang = new Adresse(parent); KurzBezeichnung = "We"; _gleise[0] = gleis1; _gleise[1] = gleis2; _knoten = node; Parent.WeicheElemente.Hinzufügen(this); this.stringFormat = new StringFormat(); this.stringFormat.Alignment = StringAlignment.Far; this.stringFormat.LineAlignment = StringAlignment.Far; this.farbeFillEllipse = Color.Red; this.farbeLinien = Color.Black; this.Berechnung(); }
public Gleis(AnlagenElemente parent, Int32 iD, Int32 zoom, AnzeigeTyp anzeigeTyp, Knoten startKnoten, Knoten endKnoten) : base(parent, iD, zoom, anzeigeTyp) { _graphicsPath = new GraphicsPath(); KurzBezeichnung = "Gl"; this.stringFormat = new StringFormat(); this.stringFormat.Alignment = StringAlignment.Far; this.stringFormat.LineAlignment = StringAlignment.Far; StartKn = startKnoten; EndKn = endKnoten; //this.farbeFillEllipse = Color.Red; this.farbeLinien = Color.Gray; this.Berechnung(); StartKn.AttachTrack(this); EndKn.AttachTrack(this); Parent.GleisElemente.Hinzufügen(this); }
/// <summary> /// zum Laden aus der Text-Datei /// </summary> /// <param name="parent">AnlagenElemente</param> /// <param name="zoom"></param> /// <param name="anzeigeTyp"></param> /// <param name="elem">Zeile aus der Text-Datei</param> public Weiche(AnlagenElemente parent, Int32 zoom, AnzeigeTyp anzeigeTyp, string[] elem) : base(parent, Convert.ToInt32(elem[1]), zoom, anzeigeTyp)// inArbeit { KurzBezeichnung = "We"; string[] knotString = elem[2].Split(' '); Knoten kn = parent.KnotenElemente.Element(Convert.ToInt32(knotString[0])); if (kn != null) { //this = kn.Weichen[Convert.ToInt32(knotString[1])]; } Grundstellung = Convert.ToBoolean(elem[3]); Ausgang.SpeicherString = elem[4]; Bezeichnung = elem[5]; if (elem.Length > 6) { Stecker = elem[6]; } if (elem.Length > 7) { KoppelungsString = elem[7]; } Parent.WeicheElemente.Hinzufügen(this); }