public object Clone() { TrainBase base2 = (TrainBase)base.MemberwiseClone(); if (this.m_RoutePassed != null) { base2.m_RoutePassed = this.m_RoutePassed.Clone(); } if (this.m_TrainCourse != null) { base2.m_TrainCourse = this.m_TrainCourse.Clone(); } return(base2); }
public override bool CanTrainMoveThruSource(TrainBase t, int nSource) { int index = this.m_alTrainsPlusToMinus.IndexOf(t); if (index == -1) { Debug.Assert(false); return(false); } ConnectionSource source = (ConnectionSource)nSource; if (source == ConnectionSource.Plus) { return(index == 0); } return(index == (this.m_alTrainsPlusToMinus.Count - 1)); }
public static void GetTrainColors(Train train, out Color clrLo, out Color clrHi) { if (train.Locomotive) { clrLo = Color.FromArgb(0xff, 0xc0, 0xc0, 0xc0); clrHi = Color.FromArgb(0xff, 0x80, 0x80, 0x80); } else if (!train.TimeTableAssigned()) { AssignBlack(out clrLo, out clrHi); } else if (train.ID.IndexOf('?') >= 0) { AssignBlack(out clrLo, out clrHi); } else { TrainBase.GetDelayColor(TimeSpan.FromSeconds(train.Delay.TotalSeconds), out clrLo, out clrHi); } }
public override bool HasTrain(TrainBase t) { return this.m_alTrainsPeakToSink.Contains(t); }
public override void RemoveTrain(TrainBase t) { this.m_alTrainsPeakToSink.Remove(t); }
public override bool CanTrainMoveThruSource(TrainBase t, int nSource) { int index = this.m_alTrainsPeakToSink.IndexOf(t); if (index == -1) { Debug.Assert(false); return false; } ConnectionSource source = (ConnectionSource) nSource; if (source == ConnectionSource.Peak) { return (index == 0); } return (index == (this.m_alTrainsPeakToSink.Count - 1)); }
public abstract bool CanTrainMoveThruSource(TrainBase t, int nSource);
public override void RemoveTrain(TrainBase t) { this.m_alTrainsPlusToMinus.Remove(t); }
public virtual Point GetTrainPoint(ArrayList alTrains, TrainBase t) { int index = -1; if (alTrains.Count > 1) { index = alTrains.IndexOf(t); } Point trainPoint = this.GetTrainPoint(); PathElement element = this; Point point2 = new Point(); if (t.HeadElementArrivedSource != -1) { int[] sources = element.GetSources(); Debug.Assert(sources.Length == 2); Point connectionSourcePoint = element.GetConnectionSourcePoint(sources[0]); Point point4 = element.GetConnectionSourcePoint(sources[1]); if (sources.Length != 2) { return trainPoint; } double introduced15 = Math.Pow(connectionSourcePoint.get_X() - point4.get_X(), 2.0); double num2 = Math.Sqrt(introduced15 + Math.Pow(connectionSourcePoint.get_Y() - point4.get_Y(), 2.0)); double num3 = (num2 * t.HeadOffset) / ((element.Length == 0) ? ((double) 1) : ((double) element.Length)); double num4 = 1.0; double num5 = 0.0; if (!(connectionSourcePoint.get_Y() == point4.get_Y())) { num4 = Math.Abs((double) (point4.get_X() - connectionSourcePoint.get_X())) / num2; num5 = Math.Abs((double) (point4.get_Y() - connectionSourcePoint.get_Y())) / num2; } double num6 = num3 * num4; double num7 = num3 * num5; if (t.HeadElementArrivedSource == sources[0]) { if (connectionSourcePoint.get_X() <= point4.get_X()) { connectionSourcePoint.set_X(connectionSourcePoint.get_X() + num6); } else { connectionSourcePoint.set_X(connectionSourcePoint.get_X() - num6); } if (connectionSourcePoint.get_Y() <= point4.get_Y()) { connectionSourcePoint.set_Y(connectionSourcePoint.get_Y() + num7); } else { connectionSourcePoint.set_Y(connectionSourcePoint.get_Y() - num7); } point2 = connectionSourcePoint; } else { if (point4.get_X() <= connectionSourcePoint.get_X()) { point4.set_X(point4.get_X() + num6); } else { point4.set_X(point4.get_X() - num6); } if (point4.get_Y() <= connectionSourcePoint.get_Y()) { point4.set_Y(point4.get_Y() + num7); } else { point4.set_Y(point4.get_Y() - num7); } point2 = point4; } trainPoint = point2; if (index != -1) { if (connectionSourcePoint.get_Y() == point4.get_Y()) { trainPoint.set_Y(trainPoint.get_Y() - 6.0); trainPoint.set_Y(trainPoint.get_Y() + (13 * index)); } else { trainPoint.set_X(trainPoint.get_X() - 6.0); trainPoint.set_X(trainPoint.get_X() + (13 * index)); } } } return trainPoint; }
public virtual Point GetTrainPoint(ArrayList alTrains, TrainBase t) { int index = -1; if (alTrains.Count > 1) { index = alTrains.IndexOf(t); } Point trainPoint = this.GetTrainPoint(); PathElement element = this; Point point2 = new Point(); if (t.HeadElementArrivedSource != -1) { int[] sources = element.GetSources(); Debug.Assert(sources.Length == 2); Point connectionSourcePoint = element.GetConnectionSourcePoint(sources[0]); Point point4 = element.GetConnectionSourcePoint(sources[1]); if (sources.Length != 2) { return(trainPoint); } double introduced15 = Math.Pow(connectionSourcePoint.get_X() - point4.get_X(), 2.0); double num2 = Math.Sqrt(introduced15 + Math.Pow(connectionSourcePoint.get_Y() - point4.get_Y(), 2.0)); double num3 = (num2 * t.HeadOffset) / ((element.Length == 0) ? ((double)1) : ((double)element.Length)); double num4 = 1.0; double num5 = 0.0; if (!(connectionSourcePoint.get_Y() == point4.get_Y())) { num4 = Math.Abs((double)(point4.get_X() - connectionSourcePoint.get_X())) / num2; num5 = Math.Abs((double)(point4.get_Y() - connectionSourcePoint.get_Y())) / num2; } double num6 = num3 * num4; double num7 = num3 * num5; if (t.HeadElementArrivedSource == sources[0]) { if (connectionSourcePoint.get_X() <= point4.get_X()) { connectionSourcePoint.set_X(connectionSourcePoint.get_X() + num6); } else { connectionSourcePoint.set_X(connectionSourcePoint.get_X() - num6); } if (connectionSourcePoint.get_Y() <= point4.get_Y()) { connectionSourcePoint.set_Y(connectionSourcePoint.get_Y() + num7); } else { connectionSourcePoint.set_Y(connectionSourcePoint.get_Y() - num7); } point2 = connectionSourcePoint; } else { if (point4.get_X() <= connectionSourcePoint.get_X()) { point4.set_X(point4.get_X() + num6); } else { point4.set_X(point4.get_X() - num6); } if (point4.get_Y() <= connectionSourcePoint.get_Y()) { point4.set_Y(point4.get_Y() + num7); } else { point4.set_Y(point4.get_Y() - num7); } point2 = point4; } trainPoint = point2; if (index != -1) { if (connectionSourcePoint.get_Y() == point4.get_Y()) { trainPoint.set_Y(trainPoint.get_Y() - 6.0); trainPoint.set_Y(trainPoint.get_Y() + (13 * index)); } else { trainPoint.set_X(trainPoint.get_X() - 6.0); trainPoint.set_X(trainPoint.get_X() + (13 * index)); } } } return(trainPoint); }
public abstract bool HasTrain(TrainBase t);
public TrainPropEventArgs(TrainBase t) { this.Train = t; }
public TrainDragDropEventArgs(TrainBase s, TrainBase d) { this.Source = s; this.Destination = d; }
public override void AddTrain(TrainBase t, int nSource) { Debug.Assert(t != null); Debug.Assert(!this.m_alTrainsPlusToMinus.Contains(t)); if (!this.m_alTrainsPlusToMinus.Contains(t)) { switch (((ConnectionSource) nSource)) { case ConnectionSource.Plus: this.m_alTrainsPlusToMinus.Insert(0, t); break; case ConnectionSource.Minus: this.m_alTrainsPlusToMinus.Add(t); break; default: this.m_alTrainsPlusToMinus.Add(t); break; } foreach (TrainBase base2 in this.m_alTrainsPlusToMinus) { if ((base2 != t) && !base.m_Layout.HasTrain(base2.ID)) { } } } }
public abstract void RemoveTrain(TrainBase t);
public abstract void AddTrain(TrainBase t, int nSource);
public override bool HasTrain(TrainBase t) { return this.m_alTrainsPlusToMinus.Contains(t); }
public override bool HasTrain(TrainBase t) { return(this.m_alTrainsPlusToMinus.Contains(t)); }
public override void AddTrain(TrainBase t, int nSource) { Debug.Assert(t != null); Debug.Assert(!this.m_alTrainsPeakToSink.Contains(t)); if (!this.m_alTrainsPeakToSink.Contains(t)) { switch (((ConnectionSource) nSource)) { case ConnectionSource.Peak: this.m_alTrainsPeakToSink.Insert(0, t); break; case ConnectionSource.Plus: case ConnectionSource.Minus: this.m_alTrainsPeakToSink.Add(t); break; default: Debug.Assert(this.m_alTrainsPeakToSink.Count == 0); this.m_alTrainsPeakToSink.Add(t); break; } foreach (TrainBase base2 in this.m_alTrainsPeakToSink) { if ((base2 != t) && !base.m_Layout.HasTrain(base2.ID)) { base2.DebugTrace("PointSwitchBase.AddTrain: Train does not exist in layout!!!"); } } } }
public override bool HasTrain(TrainBase t) { return(this.m_alTrainsPeakToSink.Contains(t)); }