//TODO: Removed because of bugs. I think this is not urgent, as this feature is probably not used by anyone. Also re-enable in XAML. //private void ResetRoute(object sender, EventArgs e) //{ // staStart = null; // staEnd = null; // Path = new List<Station>(); // lineRenderer.ClearHighlightedPath(); // closeButton.Enabled = false; // lineRenderer.FixedStatusString = "Startstation auswählen"; // if (train != null) // { // // Wechsel in den Neu Setzen-Modus // lineRenderer.StationClicked -= ChangeRoute; // lineRenderer.StationClicked += SetRoute; // } //} private void CloseButton_Click(object sender, EventArgs e) { if (Path.Distinct().Count() < Path.Count) { MessageBox.Show("Der Laufweg enthält eine Station mehr als einmal. Dies ist aktuell nicht möglich. Ggf. fehlt ein weiterer Wegpunkt!", "FPLedit"); return; } if (train != null) { var ardps = train.GetArrDeps(); foreach (var ardp in ardps) // Alle alten Stationen entfernen { train.RemoveArrDep(ardp.Key); } train.AddAllArrDeps(Path); foreach (var ardp in ardps) { if (!Path.Contains(ardp.Key)) { continue; } train.GetArrDep(ardp.Key).ApplyCopy(ardp.Value); } train.RemoveOrphanedTimes(); } Close(DialogResult.Ok); }
public void FillTrain(Train orig, Train target, int offsetMin) { var path = orig.GetPath(); if (orig._parent.Type == TimetableType.Network) { target.AddAllArrDeps(path); } InternalCopyArrDeps(orig, target, offsetMin); }
/// <summary> /// Use <see cref="NextTrains"/> to wire up transitions. /// This form will NOT wire up transitions itself! /// </summary> /// <param name="tt"></param> /// <param name="direction"></param> /// <param name="path"></param> public TrainEditForm(Timetable tt, TrainDirection direction, List <Station> path = null) : this(tt) { Train = new Train(direction, tt); if (path != null) { Train.AddAllArrDeps(path); } if (tt.Type == TimetableType.Linear) { Train.AddLinearArrDeps(); } InitializeTrain(); }
public Train CopyTrain(Train orig, int offsetMin, string name, bool copyAll) { var t = new Train(orig.Direction, orig._parent) { TName = name, Comment = orig.Comment, Days = orig.Days, Last = orig.Last, Locomotive = orig.Locomotive, Mbr = orig.Mbr, }; if (copyAll) { foreach (var attr in orig.Attributes) { if (t.GetAttribute <string>(attr.Key) == null) { t.SetAttribute(attr.Key, attr.Value); } } } var path = orig.GetPath(); if (orig._parent.Type == TimetableType.Network) { t.AddAllArrDeps(path); } else { foreach (var sta in orig._parent.Stations) { t.AddArrDep(sta, Timetable.LINEAR_ROUTE_ID); } } InternalCopyArrDeps(orig, t, offsetMin); return(t); }