Exemplo n.º 1
0
 public ETCSDefaultWindow(DriverMachineInterface dmi, CabViewControl control) : base(dmi, dmi.Width, dmi.Height)
 {
     if (dmi.CurrentDMIMode == DMIMode.GaugeOnly)
     {
         var dig = control as CVCDigital;
         CircularSpeedGauge = new CircularSpeedGauge(
             (int)dig.MaxValue,
             dig.Units != CABViewControlUnits.MILES_PER_HOUR,
             dig.Units != CABViewControlUnits.NONE,
             dig.MaxValue == 240 || dig.MaxValue == 260,
             (int)dig.MinValue,
             DMI);
         AddToLayout(CircularSpeedGauge, new Point(0, 0));
         return;
     }
     if (dmi.CurrentDMIMode != DMIMode.PlanningArea)
     {
         var param    = (control as CVCScreen).CustomParameters;
         int maxSpeed = 400;
         if (param.ContainsKey("maxspeed"))
         {
             int.TryParse(param["maxspeed"], out maxSpeed);
         }
         int maxVisibleSpeed = maxSpeed;
         if (param.ContainsKey("maxvisiblespeed"))
         {
             int.TryParse(param["maxvisiblespeed"], out maxVisibleSpeed);
         }
         CircularSpeedGauge = new CircularSpeedGauge(
             maxSpeed,
             control.Units != CABViewControlUnits.MILES_PER_HOUR,
             param.ContainsKey("displayunits") && param["displayunits"] == "1",
             maxSpeed == 240 || maxSpeed == 260,
             maxVisibleSpeed,
             dmi
             );
         TTIandLSSMArea           = new TTIandLSSMArea(dmi);
         TargetDistance           = new TargetDistance(dmi);
         MessageArea              = new MessageArea(dmi);
         CircularSpeedGauge.Layer = -1;
         TargetDistance.Layer     = -1;
         TTIandLSSMArea.Layer     = -1;
         MessageArea.Layer        = -1;
         AddToLayout(CircularSpeedGauge, new Point(54, DMI.IsSoftLayout ? 0 : 15));
         AddToLayout(TTIandLSSMArea, new Point(0, DMI.IsSoftLayout ? 0 : 15));
         AddToLayout(TargetDistance, new Point(0, 54 + (DMI.IsSoftLayout ? 0 : 15)));
         AddToLayout(MessageArea, new Point(54, DMI.IsSoftLayout ? 350 : 365));
         AddToLayout(MessageArea.ButtonScrollUp, new Point(54 + 234, DMI.IsSoftLayout ? 350 : 365));
         AddToLayout(MessageArea.ButtonScrollDown, new Point(54 + 234, MessageArea.Height / 2 + (DMI.IsSoftLayout ? 350 : 365)));
     }
     if (dmi.CurrentDMIMode != DMIMode.SpeedArea)
     {
         // Calculate start position of the planning area when a two-screen display is used
         // Real width of the left area in ETCS specs is 306 px, however in order to have
         // both screens with the same size I assumed both have 334 px
         // To be checked
         int startPos = dmi.CurrentDMIMode == DMIMode.FullSize ? 334 : (334 - 306) / 2;
         PlanningWindow = new PlanningWindow(dmi);
         MenuBar        = new MenuBar(dmi);
         AddToLayout(PlanningWindow, new Point(startPos, DMI.IsSoftLayout ? 0 : 15));
         AddToLayout(PlanningWindow.ButtonScaleDown, new Point(startPos, DMI.IsSoftLayout ? 0 : 15));
         AddToLayout(PlanningWindow.ButtonScaleUp, new Point(startPos, 285 + (DMI.IsSoftLayout ? 0 : 15)));
         foreach (int i in Enumerable.Range(0, MenuBar.Buttons.Count))
         {
             AddToLayout(MenuBar.Buttons[i], new Point(580, 15 + 50 * i));
         }
     }
 }
Exemplo n.º 2
0
 public ETCSDefaultWindow(DriverMachineInterface dmi, CabViewControl control) : base(dmi, 640, 480)
 {
     if (control is CVCDigital)
     {
         var dig = control as CVCDigital;
         CircularSpeedGauge = new CircularSpeedGauge(
             (int)dig.MaxValue,
             dig.Units != CABViewControlUnits.MILES_PER_HOUR,
             dig.Units != CABViewControlUnits.NONE,
             dig.MaxValue == 240 || dig.MaxValue == 260,
             (int)dig.MinValue,
             DMI);
     }
     else
     {
         var param    = (control as CVCScreen).CustomParameters;
         int maxSpeed = 400;
         if (param.ContainsKey("maxspeed"))
         {
             int.TryParse(param["maxspeed"], out maxSpeed);
         }
         int maxVisibleSpeed = maxSpeed;
         if (param.ContainsKey("maxvisiblespeed"))
         {
             int.TryParse(param["maxvisiblespeed"], out maxVisibleSpeed);
         }
         CircularSpeedGauge = new CircularSpeedGauge(
             maxSpeed,
             control.Units != CABViewControlUnits.MILES_PER_HOUR,
             param.ContainsKey("displayunits") && param["displayunits"] == "1",
             maxSpeed == 240 || maxSpeed == 260,
             maxVisibleSpeed,
             dmi
             );
     }
     if (DMI.GaugeOnly)
     {
         AddToLayout(CircularSpeedGauge, new Point(0, 0));
         return;
     }
     PlanningWindow           = new PlanningWindow(dmi);
     TTIandLSSMArea           = new TTIandLSSMArea(dmi);
     TargetDistance           = new TargetDistance(dmi);
     MessageArea              = new MessageArea(dmi);
     MenuBar                  = new MenuBar(dmi);
     CircularSpeedGauge.Layer = -1;
     TargetDistance.Layer     = -1;
     TTIandLSSMArea.Layer     = -1;
     MessageArea.Layer        = -1;
     AddToLayout(CircularSpeedGauge, new Point(54, DMI.IsSoftLayout ? 0 : 15));
     AddToLayout(PlanningWindow, new Point(334, DMI.IsSoftLayout ? 0 : 15));
     AddToLayout(PlanningWindow.ButtonScaleDown, new Point(334, DMI.IsSoftLayout ? 0 : 15));
     AddToLayout(PlanningWindow.ButtonScaleUp, new Point(334, 285 + (DMI.IsSoftLayout ? 0 : 15)));
     AddToLayout(TTIandLSSMArea, new Point(0, DMI.IsSoftLayout ? 0 : 15));
     AddToLayout(TargetDistance, new Point(0, 54 + (DMI.IsSoftLayout ? 0 : 15)));
     AddToLayout(MessageArea, new Point(54, DMI.IsSoftLayout ? 350 : 365));
     AddToLayout(MessageArea.ButtonScrollUp, new Point(54 + 234, DMI.IsSoftLayout ? 350 : 365));
     AddToLayout(MessageArea.ButtonScrollDown, new Point(54 + 234, MessageArea.Height / 2 + (DMI.IsSoftLayout ? 350 : 365)));
     foreach (int i in Enumerable.Range(0, MenuBar.Buttons.Count))
     {
         AddToLayout(MenuBar.Buttons[i], new Point(580, 15 + 50 * i));
     }
 }