Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Train forces popup v1 #3

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Source/ORTS.Common/Conversions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,13 @@ public static string FormatForce(float forceN, bool isMetric)
return String.Format(CultureInfo.CurrentCulture, kilo ? "{0:F1} {1}" : "{0:F0} {1}", force, unit);
}

public static string FormatLargeForce(float forceN, bool isMetric)
{
var force = isMetric ? forceN : N.ToLbf(forceN);
var unit = isMetric ? kN : klbf;
return String.Format(CultureInfo.CurrentCulture, "{0:F1} {1}", force * 1e-3f, unit);
}

public static string FormatTemperature(float temperatureC, bool isMetric, bool isDelta)
{
var temperature = isMetric ? temperatureC : isDelta ? C.ToDeltaF(temperatureC) : C.ToF(temperatureC);
Expand Down
1 change: 1 addition & 0 deletions Source/ORTS.Common/Input/UserCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public enum UserCommand
[GetString("Display Train Operations Window")] DisplayTrainOperationsWindow,
[GetString("Display Train Dpu Window")] DisplayTrainDpuWindow,
[GetString("Display Next Station Window")] DisplayNextStationWindow,
[GetString("Display Train Forces Window")] DisplayTrainForcesWindow,
[GetString("Display Compass Window")] DisplayCompassWindow,
[GetString("Display Train List Window")] DisplayTrainListWindow,
[GetString("Display EOT List Window")] DisplayEOTListWindow,
Expand Down
2 changes: 2 additions & 0 deletions Source/ORTS.Settings/InputSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,8 @@ static void InitializeCommands(UserCommandInput[] Commands)
Commands[(int)UserCommand.DisplayTrainOperationsWindow] = new UserCommandKeyInput(0x43);
Commands[(int)UserCommand.DisplayTrainDpuWindow] = new UserCommandKeyInput(0x43, KeyModifiers.Shift);
Commands[(int)UserCommand.DisplayEOTListWindow] = new UserCommandKeyInput(0x43, KeyModifiers.Control);
// Commands[(int)UserCommand.DisplayTrainForcesWindow] = new UserCommandKeyInput(0x57);
Commands[(int)UserCommand.DisplayTrainForcesWindow] = new UserCommandKeyInput(0x42, KeyModifiers.Alt);

Commands[(int)UserCommand.GameAutopilotMode] = new UserCommandKeyInput(0x1E, KeyModifiers.Alt);
Commands[(int)UserCommand.GameChangeCab] = new UserCommandKeyInput(0x12, KeyModifiers.Control);
Expand Down
4 changes: 4 additions & 0 deletions Source/Orts.Simulation/Simulation/RollingStocks/TrainCar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3561,6 +3561,10 @@ public LatLonDirection GetLatLonDirection()

return new LatLonDirection(latLon, directionDeg); ;
}

public int GetWagonNumAxles() { return WagonNumAxles; }

public float GetGravitationalAccelerationMpS2() { return GravitationalAccelerationMpS2; }
}

public class WheelAxle : IComparer<WheelAxle>
Expand Down
Binary file added Source/RunActivity/Content/BarGraph-bar6wide.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Source/RunActivity/Content/BarGraph-v1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Source/RunActivity/Content/BarGraph-withBG.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Source/RunActivity/Content/BarGraph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Source/RunActivity/RunActivity.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
<Link>Native\X64\OpenAL32.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\BarGraph.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\blank.bmp">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down
321 changes: 321 additions & 0 deletions Source/RunActivity/Viewer3D/Popups/TrainForcesWindow.cs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Source/RunActivity/Viewer3D/Viewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public class Viewer
public CarOperationsWindow CarOperationsWindow { get; private set; } // F9 sub-window for car operations
public TrainDpuWindow TrainDpuWindow { get; private set; } // Shift + F9 train distributed power window
public NextStationWindow NextStationWindow { get; private set; } // F10 window
public TrainForcesWindow TrainForcesWindow { get; private set; } // F11 window
public CompassWindow CompassWindow { get; private set; } // 0 window
public TracksDebugWindow TracksDebugWindow { get; private set; } // Control-Alt-F6
public SignallingDebugWindow SignallingDebugWindow { get; private set; } // Control-Alt-F11 window
Expand Down Expand Up @@ -494,6 +495,7 @@ internal void Initialize()
CarOperationsWindow = new CarOperationsWindow(WindowManager);
TrainDpuWindow = new TrainDpuWindow(WindowManager);
NextStationWindow = new NextStationWindow(WindowManager);
TrainForcesWindow = new TrainForcesWindow(WindowManager);
CompassWindow = new CompassWindow(WindowManager);
TracksDebugWindow = new TracksDebugWindow(WindowManager);
SignallingDebugWindow = new SignallingDebugWindow(WindowManager);
Expand Down Expand Up @@ -995,6 +997,7 @@ void HandleUserInput(ElapsedTime elapsedTime)
if (UserInput.IsPressed(UserCommand.DisplayTrainDpuWindow)) if (UserInput.IsDown(UserCommand.DisplayNextWindowTab)) TrainDpuWindow.Visible = !TrainDpuWindow.Visible ; else TrainDpuWindow.TabAction();
if (UserInput.IsPressed(UserCommand.DisplayNextStationWindow)) if (UserInput.IsDown(UserCommand.DisplayNextWindowTab)) NextStationWindow.TabAction(); else NextStationWindow.Visible = !NextStationWindow.Visible;
if (UserInput.IsPressed(UserCommand.DisplayCompassWindow)) if (UserInput.IsDown(UserCommand.DisplayNextWindowTab)) CompassWindow.TabAction(); else CompassWindow.Visible = !CompassWindow.Visible;
if (UserInput.IsPressed(UserCommand.DisplayTrainForcesWindow)) if (UserInput.IsDown(UserCommand.DisplayNextWindowTab)) TrainForcesWindow.TabAction(); else TrainForcesWindow.Visible = !TrainForcesWindow.Visible;
if (UserInput.IsPressed(UserCommand.DebugTracks)) if (UserInput.IsDown(UserCommand.DisplayNextWindowTab)) TracksDebugWindow.TabAction(); else TracksDebugWindow.Visible = !TracksDebugWindow.Visible;
if (UserInput.IsPressed(UserCommand.DebugSignalling)) if (UserInput.IsDown(UserCommand.DisplayNextWindowTab)) SignallingDebugWindow.TabAction(); else SignallingDebugWindow.Visible = !SignallingDebugWindow.Visible;
if (UserInput.IsPressed(UserCommand.DisplayTrainListWindow)) TrainListWindow.Visible = !TrainListWindow.Visible;
Expand Down