Skip to content

Commit

Permalink
Merge pull request #48 from #47-graphs
Browse files Browse the repository at this point in the history
Agent#47 graphs
  • Loading branch information
sushiat authored and markus-korbel committed Jan 22, 2022
2 parents 2af6460 + 07dba12 commit 54b6ab4
Show file tree
Hide file tree
Showing 7 changed files with 311 additions and 7 deletions.
7 changes: 4 additions & 3 deletions OpenSky.AgentMSFS/OpenSky.AgentMSFS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@
</Compile>
<Compile Include="Views\Models\FlightTrackingViewModel.cs" />
<Compile Include="Views\Models\FlightTrackingViewModel.FuelTanks.cs" />
<Compile Include="Views\Models\FlightTrackingViewModel.Graphs.cs" />
<Compile Include="Views\Models\FlightTrackingViewModel.Map.cs" />
<Compile Include="Views\Models\FlightTrackingViewModel.PayloadStations.cs" />
<Compile Include="Views\Models\LandingReportViewModel.cs" />
Expand Down Expand Up @@ -451,13 +452,13 @@
<Version>0.1.4</Version>
</PackageReference>
<PackageReference Include="Syncfusion.SfChart.WPF">
<Version>19.4.0.42</Version>
<Version>19.4.0.43</Version>
</PackageReference>
<PackageReference Include="Syncfusion.SfProgressBar.WPF">
<Version>19.4.0.42</Version>
<Version>19.4.0.43</Version>
</PackageReference>
<PackageReference Include="Syncfusion.Themes.MaterialDark.WPF">
<Version>19.4.0.42</Version>
<Version>19.4.0.43</Version>
</PackageReference>
<PackageReference Include="TomsToolbox.Wpf">
<Version>2.7.4</Version>
Expand Down
30 changes: 29 additions & 1 deletion OpenSky.AgentMSFS/OpenSkyStyles.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
xmlns:dgx="urn:tom-englert.de/DataGridExtensions"
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
xmlns:toms="urn:TomsToolbox"
xmlns:componentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase">
xmlns:componentModel="clr-namespace:System.ComponentModel;assembly=WindowsBase"
xmlns:syncfusion="http://schemas.syncfusion.com/wpf">

<!-- OPENSKY COLOR STYLE DEFINITIONS -->
<Color x:Key="OpenSkyTeal">#05826c</Color>
Expand All @@ -31,6 +32,33 @@
<Color x:Key="OpenSkySimBriefText">White</Color>
<SolidColorBrush x:Key="OpenSkySimBriefTextBrush" Color="{StaticResource OpenSkySimBriefText}" />

<syncfusion:ChartColorModel x:Key="OpenSkyTealChartColors">
<syncfusion:ChartColorModel.CustomBrushes>
<SolidColorBrush Color="#0aa88c" />
<SolidColorBrush Color="#05826c" />
<SolidColorBrush Color="#047762" />
<SolidColorBrush Color="#046957" />
<SolidColorBrush Color="#045849" />
<SolidColorBrush Color="#034c3f" />
<SolidColorBrush Color="#023b31" />
<SolidColorBrush Color="#012c25" />
<SolidColorBrush Color="#011d18" />
</syncfusion:ChartColorModel.CustomBrushes>
</syncfusion:ChartColorModel>

<syncfusion:ChartColorModel x:Key="DarkChartColors">
<syncfusion:ChartColorModel.CustomBrushes>
<SolidColorBrush Color="#05826c" />
<SolidColorBrush Color="DarkGreen" />
<SolidColorBrush Color="DarkSlateBlue" />
<SolidColorBrush Color="DarkRed" />
<SolidColorBrush Color="DodgerBlue" />
<SolidColorBrush Color="DarkOrange" />
<SolidColorBrush Color="DarkCyan" />
<SolidColorBrush Color="DarkMagenta" />
</syncfusion:ChartColorModel.CustomBrushes>
</syncfusion:ChartColorModel>

<!-- ReSharper disable once Xaml.StaticResourceNotResolved -->
<Style TargetType="controls:ScrollingListBox" BasedOn="{StaticResource DefaultListBoxStyle}" />

Expand Down
4 changes: 2 additions & 2 deletions OpenSky.AgentMSFS/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
[assembly: AssemblyVersion("0.3.6")]
[assembly: AssemblyFileVersion("0.3.6")]
[assembly: AssemblyVersion("0.3.7")]
[assembly: AssemblyFileVersion("0.3.7")]

// This allows us to detect debug mode in XAML
#if DEBUG
Expand Down
45 changes: 45 additions & 0 deletions OpenSky.AgentMSFS/SimConnect/SimConnect.SaveLoadXML.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
namespace OpenSky.AgentMSFS.SimConnect
{
using System;
using System.Device.Location;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Windows;
using System.Windows.Media;
using System.Xml.Linq;

using Microsoft.Maps.MapControl.WPF;
Expand Down Expand Up @@ -106,6 +108,49 @@ private void RestoreSaveFile(string saveFile)
lock (this.trackingEventMarkers)
{
this.trackingEventMarkers.Clear();

// Add airport markers, we don't save them
if (this.Flight != null)
{
var alternateMarker = new TrackingEventMarker(new GeoCoordinate(this.Flight.Alternate.Latitude, this.Flight.Alternate.Longitude), this.Flight.Alternate.Icao, OpenSkyColors.OpenSkyWarningOrange, Colors.Black);
this.trackingEventMarkers.Add(alternateMarker);
this.TrackingEventMarkerAdded?.Invoke(this, alternateMarker);
var originMarker = new TrackingEventMarker(new GeoCoordinate(this.Flight.Origin.Latitude, this.Flight.Origin.Longitude), this.Flight.Origin.Icao, OpenSkyColors.OpenSkyTeal, Colors.White);
this.trackingEventMarkers.Add(originMarker);
this.TrackingEventMarkerAdded?.Invoke(this, originMarker);
var destinationMarker = new TrackingEventMarker(new GeoCoordinate(this.Flight.Destination.Latitude, this.Flight.Destination.Longitude), this.Flight.Destination.Icao, OpenSkyColors.OpenSkyTeal, Colors.White);
this.trackingEventMarkers.Add(destinationMarker);
this.TrackingEventMarkerAdded?.Invoke(this, destinationMarker);

var alternateDetailMarker = new TrackingEventMarker(this.Flight.Alternate, OpenSkyColors.OpenSkyWarningOrange, Colors.Black);
this.trackingEventMarkers.Add(alternateDetailMarker);
this.TrackingEventMarkerAdded?.Invoke(this, alternateDetailMarker);
var originDetailMarker = new TrackingEventMarker(this.Flight.Origin, OpenSkyColors.OpenSkyTeal, Colors.White);
this.trackingEventMarkers.Add(originDetailMarker);
this.TrackingEventMarkerAdded?.Invoke(this, originDetailMarker);
var destinationDetailMarker = new TrackingEventMarker(this.Flight.Destination, OpenSkyColors.OpenSkyTeal, Colors.White);
this.trackingEventMarkers.Add(destinationDetailMarker);
this.TrackingEventMarkerAdded?.Invoke(this, destinationDetailMarker);

foreach (var runway in this.Flight.Alternate.Runways)
{
var runwayMarker = new TrackingEventMarker(runway);
this.trackingEventMarkers.Add(runwayMarker);
this.TrackingEventMarkerAdded?.Invoke(this, runwayMarker);
}
foreach (var runway in this.Flight.Origin.Runways)
{
var runwayMarker = new TrackingEventMarker(runway);
this.trackingEventMarkers.Add(runwayMarker);
this.TrackingEventMarkerAdded?.Invoke(this, runwayMarker);
}
foreach (var runway in this.Flight.Destination.Runways)
{
var runwayMarker = new TrackingEventMarker(runway);
this.trackingEventMarkers.Add(runwayMarker);
}
}

foreach (var marker in log.TrackingEventMarkers)
{
this.trackingEventMarkers.Add(new TrackingEventMarker(marker));
Expand Down
60 changes: 59 additions & 1 deletion OpenSky.AgentMSFS/Views/FlightTracking.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
xmlns:viewModels="clr-namespace:OpenSky.AgentMSFS.Views.Models"
xmlns:converters="clr-namespace:OpenSky.AgentMSFS.Converters"
xmlns:models="clr-namespace:OpenSky.AgentMSFS.Models"
xmlns:sf="http://schemas.syncfusion.com/wpf"
mc:Ignorable="d" LoadingText="{Binding LoadingText}"
Title="Flight Tracking" Height="1000" Width="1300" Loaded="FlightTrackingLoaded" Unloaded="FlightTrackingOnUnloaded" FontSize="14" HorizontalScrollBar="False" VerticalScrollBar="False">
<Window.DataContext>
Expand Down Expand Up @@ -559,7 +560,64 @@
<GroupBox.Header>
<TextBlock FontSize="15" FontWeight="DemiBold">Graphs</TextBlock>
</GroupBox.Header>
<TextBlock>Coming soon™</TextBlock>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Grid.Row="0" Margin="0,0,0,10" HorizontalAlignment="Center">
<StackPanel.RenderTransform>
<ScaleTransform ScaleX="0.8" ScaleY="0.8" />
</StackPanel.RenderTransform>
<CheckBox IsChecked="{Binding ChartAltitudeChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="0" MinWidth="0">
<Border CornerRadius="3" Background="#05826c">
<TextBlock Margin="5,1" Foreground="Black">Altitude</TextBlock>
</Border>
</CheckBox>
<CheckBox IsChecked="{Binding ChartGroundSpeedChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="10,0,0,0" MinWidth="0">
<Border CornerRadius="3" Background="DarkMagenta">
<TextBlock Margin="5,1">Ground Speed</TextBlock>
</Border>
</CheckBox>
<CheckBox IsChecked="{Binding ChartFuelChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="10,0,0,0" MinWidth="0">
<Border CornerRadius="3" Background="DarkOrange">
<TextBlock Margin="5,1" Foreground="Black">Fuel</TextBlock>
</Border>
</CheckBox>
<CheckBox IsChecked="{Binding ChartSimRateChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="10,0,0,0" MinWidth="0">
<Border CornerRadius="3" Background="DarkRed">
<TextBlock Margin="5,1">SimRate</TextBlock>
</Border>
</CheckBox>
</StackPanel>
<sf:SfChart Grid.Row="1" Padding="0" Height="200">
<sf:SfChart.PrimaryAxis>
<sf:DateTimeAxis Visibility="Collapsed" ShowGridLines="False" />
</sf:SfChart.PrimaryAxis>
<sf:SfChart.SecondaryAxis>
<sf:NumericalAxis Name="Altitude" Header="Altitude [Feet]" ShowGridLines="False" Visibility="{Binding AltitudeAxisAndSeriesVisibility}" />
</sf:SfChart.SecondaryAxis>
<sf:SfChart.Series>
<sf:FastLineSeries ItemsSource="{Binding SimConnect.AircraftTrailLocations}" XBindingPath="Position.Timestamp" YBindingPath="Position.Altitude" EnableAnimation="True" Visibility="{Binding AltitudeAxisAndSeriesVisibility}" StrokeThickness="3" Interior="#05826c" Label="Altitude" />
<sf:FastLineSeries ItemsSource="{Binding SimConnect.AircraftTrailLocations}" XBindingPath="Position.Timestamp" YBindingPath="Position.Groundspeed" EnableAnimation="True" Visibility="{Binding GroundSpeedAxisAndSeriesVisibility}" StrokeThickness="3" Interior="DarkMagenta" Label="Groundspeed">
<sf:FastLineSeries.YAxis>
<sf:NumericalAxis Visibility="{Binding GroundSpeedAxisAndSeriesVisibility}" ShowGridLines="False" Header="Speed [Knots]" />
</sf:FastLineSeries.YAxis>
</sf:FastLineSeries>
<sf:FastLineSeries ItemsSource="{Binding SimConnect.AircraftTrailLocations}" XBindingPath="Position.Timestamp" YBindingPath="Position.FuelOnBoard" EnableAnimation="True" Visibility="{Binding FuelAxisAndSeriesVisibility}" StrokeThickness="3" Interior="DarkOrange" Label="Fuel">
<sf:FastLineSeries.YAxis>
<sf:NumericalAxis OpposedPosition="True" ShowGridLines="False" Header="Fuel [Gallons]" Visibility="{Binding FuelAxisAndSeriesVisibility}" Minimum="0" />
</sf:FastLineSeries.YAxis>
</sf:FastLineSeries>
<sf:FastLineSeries ItemsSource="{Binding SimConnect.AircraftTrailLocations}" XBindingPath="Position.Timestamp" YBindingPath="Position.SimulationRate" EnableAnimation="True" Visibility="{Binding SimRateAxisAndSeriesVisibility}" StrokeThickness="3" Interior="DarkRed" Label="SimRate">
<sf:FastLineSeries.YAxis>
<sf:NumericalAxis OpposedPosition="True" ShowGridLines="False" Header="SimRate" Interval="1" Visibility="{Binding SimRateAxisAndSeriesVisibility}" />
</sf:FastLineSeries.YAxis>
</sf:FastLineSeries>

</sf:SfChart.Series>
</sf:SfChart>
</Grid>
</GroupBox>
</Grid>
<GroupBox Grid.Column="2" Grid.Row="0" Grid.RowSpan="8" Margin="5,3">
Expand Down
Loading

0 comments on commit 54b6ab4

Please sign in to comment.