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

Implementation of NVG images for the F/A-18C hornet and AutoBind for Gauges #863

Merged
merged 6 commits into from
Feb 28, 2025
Merged
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
347 changes: 345 additions & 2 deletions Aircraft FA-18C Plugin/Aircraft FA-18C Plugin.csproj

Large diffs are not rendered by default.

52 changes: 48 additions & 4 deletions Aircraft FA-18C Plugin/Gauges/ADI/ADI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,17 @@
namespace GadrocsWorkshop.Helios.Gauges.FA18C.ADI
{
using GadrocsWorkshop.Helios.ComponentModel;
using NLog.Targets;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.IO;
using System.Windows;
using System.Windows.Media;

[HeliosControl("Helios.FA18C.ADI", "ADI", "F/A-18C Gauges", typeof(GaugeRenderer),HeliosControlFlags.NotShownInUI)]
public class ADI : BaseGauge
public class ADI : AltImageGauge
{
private HeliosValue _pitch;
private HeliosValue _roll;
Expand Down Expand Up @@ -51,8 +56,11 @@ public class ADI : BaseGauge
private CalibrationPointCollectionDouble _bankBarCalibration;

public ADI()
: base("ADI", new Size(350, 350))
: base("ADI", new Size(350, 350), "Alt")
{
SupportedInterfaces = new[] { typeof(Interfaces.DCS.FA18C.FA18CInterface) };
CreateInputBindings();

Point center = new Point(177d, 163d);

_pitchCalibration = new CalibrationPointCollectionDouble(-360d, -1066d, 360d, 1066d);
Expand Down Expand Up @@ -94,7 +102,6 @@ public ADI()
Components.Add(_offFlagImage);

Components.Add(new GaugeImage("{FA-18C}/Gauges/ADI/adi_outer_ring.xaml", new Rect(10d, 9d, 336d, 336d)));

Components.Add(new GaugeImage("{FA-18C}/Gauges/ADI/adi_bezel.png", new Rect(0d, 0d, 350d, 350d)));

_slipBall = new HeliosValue(this, new BindingValue(0d), "", "Slip Ball Offset", "Side slip indicator offset from the center of the tube.", "(-1 to 1) -1 full left and 1 is full right.", BindingValueUnits.Numeric);
Expand Down Expand Up @@ -131,8 +138,40 @@ public ADI()

}

void CreateInputBindings()
{
AddDefaultInputBinding(
childName: "",
interfaceTriggerName: "Cockpit Lights.MODE Switch.changed",
deviceActionName: "set.Enable Alternate Image Set",
deviceTriggerName: "",
triggerBindingValue: new BindingValue("return TriggerValue<3"),
triggerBindingSource: BindingValueSources.LuaScript
);

Dictionary<string, string> bindings = new Dictionary<string, string>
{
{ "SAI.Pitch.changed", "set.Pitch" },
{ "SAI.Bank.changed", "set.Bank" },
{ "SAI.Warning Flag.changed", "set.Off Flag" },
{ "SAI.Rate of Turn.changed", "set.Turn Indicator Offset" },
{ "SAI.Slip Ball.changed", "set.Slip Ball Offset" },
{ "SAI.Pitch Adjustment.changed", "set.Pitch adjustment offset" },
{ "SAI.Bank Steering Bar.changed", "set.Bank steering bar offset" },
{ "SAI.Pitch Steering Bar.changed", "set.Pitch steering bar offset" }
};

foreach (string t in bindings.Keys)
{
AddDefaultInputBinding(
childName: "",
interfaceTriggerName: t,
deviceActionName: bindings[t]
) ;
}
}

void SlipBall_Execute(object action, HeliosActionEventArgs e)
void SlipBall_Execute(object action, HeliosActionEventArgs e)
{
_slipBall.SetValue(e.Value, e.BypassCascadingTriggers);
_slipBallNeedle.HorizontalOffset = _slipBallCalibration.Interpolate(e.Value.DoubleValue);
Expand Down Expand Up @@ -177,5 +216,10 @@ void BankSteering_Execute(object action, HeliosActionEventArgs e)
_bankSteering.SetValue(e.Value, e.BypassCascadingTriggers);
_bankSteeringNeedle.HorizontalOffset = _bankBarCalibration.Interpolate(e.Value.DoubleValue);
}

protected override void OnProfileChanged(HeliosProfile oldProfile)
{
base.OnProfileChanged(oldProfile);
}
}
}
14 changes: 14 additions & 0 deletions Aircraft FA-18C Plugin/Gauges/ADI/Alt/adi_arrow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<Canvas Width="17.410" Height="110" Name="ADI_Bank_Arrow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Canvas>

<Canvas>

<!-- ADI Inner Ring/Innermost Ring and Pointer/Inside Ring and Pointer -->
<Path StrokeThickness="1.0" Stroke="#ff000000" StrokeMiterLimit="1.0" Fill="#ff00ff00" Data="F1 M 12.705,12.923 L 8.705,1.511 L 4.705,12.923 L 0.705,24.334 L 8.705,24.334 L 16.705,24.334 L 12.705,12.923 Z"/>

</Canvas>

</Canvas>
</Canvas>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 53 additions & 0 deletions Aircraft FA-18C Plugin/Gauges/ADI/Alt/adi_bank_pointer.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Name="svg2" Width="11" Height="221">
<Canvas.Resources>
<LinearGradientBrush xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Key="linearGradient4269" MappingMode="RelativeToBoundingBox" StartPoint="0,0" EndPoint="1,1">
<LinearGradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#FF646464" Offset="0"/>
<GradientStop Color="#FF141414" Offset="1"/>
</GradientStopCollection>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Key="linearGradient3897" MappingMode="RelativeToBoundingBox" StartPoint="0,0" EndPoint="1,1">
<LinearGradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#00505050" Offset="0"/>
<GradientStop Color="#00505050" Offset="0.81944442"/>
<GradientStop Color="#9F505050" Offset="1"/>
</GradientStopCollection>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
<RadialGradientBrush xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Key="radialGradient3903" MappingMode="Absolute" Center="174,159.5" GradientOrigin="174,159.5" RadiusX="111.4995" RadiusY="111.4995">
<RadialGradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#00505050" Offset="0"/>
<GradientStop Color="#00505050" Offset="0.81944442"/>
<GradientStop Color="#9F505050" Offset="1"/>
</GradientStopCollection>
</RadialGradientBrush.GradientStops>
</RadialGradientBrush>
<RadialGradientBrush xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Key="radialGradient4275" MappingMode="Absolute" Center="175,312" GradientOrigin="175,312" RadiusX="5" RadiusY="5">
<RadialGradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#FF646464" Offset="0"/>
<GradientStop Color="#FF141414" Offset="1"/>
</GradientStopCollection>
</RadialGradientBrush.GradientStops>
</RadialGradientBrush>
</Canvas.Resources>
<Canvas Name="layer11">
<Canvas>
<Canvas.RenderTransform>
<TransformGroup>
<!--g-->
<TranslateTransform X="-168.70109" Y="-52.952662"/>
</TransformGroup>
</Canvas.RenderTransform>
<Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path3969" Fill="#ff00ff00" Stroke="#FF000000" StrokeThickness="1" StrokeMiterLimit="4" Data="m 178.1998 295.57946 -12.3996 0 L 172 284.84109 z">
<!--path-->
<Path.RenderTransform>
<MatrixTransform Matrix="0.76492719,0,0,-1.3338676,42.443609,653.78412"/>
</Path.RenderTransform>
</Path>
<Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path4152" Fill="#ff00ff00" Stroke="#FF000000" StrokeThickness="1" StrokeMiterLimit="4" Data="m 178.1998 295.57946 -12.3996 0 L 172 284.84109 z"><!--path--><Path.RenderTransform><MatrixTransform Matrix="0.76492719,0,0,1.3338676,42.443609,-326.42004"/></Path.RenderTransform></Path></Canvas></Canvas></Canvas>
10 changes: 10 additions & 0 deletions Aircraft FA-18C Plugin/Gauges/ADI/Alt/adi_bank_steering_bar.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Name="svg2" Width="24" Height="239"><Canvas.Resources><LinearGradientBrush xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Key="linearGradient4269" MappingMode="RelativeToBoundingBox" StartPoint="0,0" EndPoint="1,1"><LinearGradientBrush.GradientStops><GradientStopCollection><GradientStop Color="#FF646464" Offset="0"/><GradientStop Color="#FF141414" Offset="1"/></GradientStopCollection></LinearGradientBrush.GradientStops></LinearGradientBrush><LinearGradientBrush xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Key="linearGradient3897" MappingMode="RelativeToBoundingBox" StartPoint="0,0" EndPoint="1,1"><LinearGradientBrush.GradientStops><GradientStopCollection><GradientStop Color="#00505050" Offset="0"/><GradientStop Color="#00505050" Offset="0.81944442"/><GradientStop Color="#9F505050" Offset="1"/></GradientStopCollection></LinearGradientBrush.GradientStops></LinearGradientBrush><RadialGradientBrush xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Key="radialGradient3903" MappingMode="Absolute" Center="174,159.5" GradientOrigin="174,159.5" RadiusX="111.4995" RadiusY="111.4995"><RadialGradientBrush.GradientStops><GradientStopCollection><GradientStop Color="#00505050" Offset="0"/><GradientStop Color="#00505050" Offset="0.81944442"/><GradientStop Color="#9F505050" Offset="1"/></GradientStopCollection></RadialGradientBrush.GradientStops></RadialGradientBrush><RadialGradientBrush xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Key="radialGradient4275" MappingMode="Absolute" Center="175,312" GradientOrigin="175,312" RadiusX="5" RadiusY="5"><RadialGradientBrush.GradientStops><GradientStopCollection><GradientStop Color="#FF646464" Offset="0"/><GradientStop Color="#FF141414" Offset="1"/></GradientStopCollection></RadialGradientBrush.GradientStops></RadialGradientBrush></Canvas.Resources><Canvas Name="layer5"><Canvas><Canvas.RenderTransform><TransformGroup><!--g--><TranslateTransform X="-152.61324" Y="1.0887292"/></TransformGroup></Canvas.RenderTransform>
<Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="rect3933" Fill="#FF141414" Stroke="#FF141414" StrokeThickness="0" StrokeMiterLimit="4" Data="m 152.78125 33.0625 0.007 31.531021 c 0.007 1.874771 -0.28384 3.738953 0.99275 5.312729 0.89122 1.1621 3.03725 1.375415 3.13415 1.327015 l 4.67835 0.18861 6.6875 -0.125 0.49241 0.02321 c 0 0 1.52132 -0.139099 1.93593 0.490847 0.7806 0.794564 0.76988 1.481694 0.76988 1.481694 l 0.0674 1.769876 -0.14062 14.84375 5.1875 0 -0.006 -16.563072 c 0.0386 -1.984487 -0.0805 -3.796754 -1.17057 -5.186928 -0.89122 -1.162104 -3.12565 -1.552231 -5.13102 -1.614179 l -8.44286 -0.276446 -1.28504 -0.0027 c 0 0 -1.03518 0.148251 -1.91383 -0.459597 -0.91318 -0.595687 -0.80113 -1.579235 -0.80113 -1.579235 l 0.0156 -1.599112 -0.0156 -29.5625 z"/></Canvas></Canvas>
<Rectangle xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Canvas.Left="24" Canvas.Top="90" Width="148" Height="5" Name="rect3876" Fill="#FFFFD50B" Stroke="#FF141414" StrokeThickness="1" StrokeMiterLimit="4">
<!--rect-->
<Rectangle.RenderTransform>
<MatrixTransform Matrix="0,1,-1,0,0,0" />
</Rectangle.RenderTransform>
</Rectangle>
</Canvas>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions Aircraft FA-18C Plugin/Gauges/ADI/Alt/adi_course_flag.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Name="svg2" Width="44" Height="26"><Canvas.Resources><LinearGradientBrush xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Key="linearGradient4269" MappingMode="RelativeToBoundingBox" StartPoint="0,0" EndPoint="1,1"><LinearGradientBrush.GradientStops><GradientStopCollection><GradientStop Color="#FF646464" Offset="0"/><GradientStop Color="#FF141414" Offset="1"/></GradientStopCollection></LinearGradientBrush.GradientStops></LinearGradientBrush><LinearGradientBrush xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Key="linearGradient3897" MappingMode="RelativeToBoundingBox" StartPoint="0,0" EndPoint="1,1"><LinearGradientBrush.GradientStops><GradientStopCollection><GradientStop Color="#00505050" Offset="0"/><GradientStop Color="#00505050" Offset="0.81944442"/><GradientStop Color="#9F505050" Offset="1"/></GradientStopCollection></LinearGradientBrush.GradientStops></LinearGradientBrush><RadialGradientBrush xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Key="radialGradient3903" MappingMode="Absolute" Center="174,159.5" GradientOrigin="174,159.5" RadiusX="111.4995" RadiusY="111.4995"><RadialGradientBrush.GradientStops><GradientStopCollection><GradientStop Color="#00505050" Offset="0"/><GradientStop Color="#00505050" Offset="0.81944442"/><GradientStop Color="#9F505050" Offset="1"/></GradientStopCollection></RadialGradientBrush.GradientStops></RadialGradientBrush><RadialGradientBrush xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Key="radialGradient4275" MappingMode="Absolute" Center="175,312" GradientOrigin="175,312" RadiusX="5" RadiusY="5"><RadialGradientBrush.GradientStops><GradientStopCollection><GradientStop Color="#FF646464" Offset="0"/><GradientStop Color="#FF141414" Offset="1"/></GradientStopCollection></RadialGradientBrush.GradientStops></RadialGradientBrush></Canvas.Resources><Canvas Name="layer10"><Canvas><Canvas.RenderTransform><TransformGroup><!--g--><TranslateTransform X="-151" Y="-38.5"/></TransformGroup></Canvas.RenderTransform><Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="rect4183" Fill="#FFFF490F" Stroke="#FF000000" StrokeThickness="1" StrokeMiterLimit="4" Data="m 151.5 39 43 9 0 15.5 -43 -9 z"/></Canvas></Canvas></Canvas>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions Aircraft FA-18C Plugin/Gauges/ADI/Alt/adi_gs_flag.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Name="svg2" Width="21" Height="43"><Canvas.Resources><LinearGradientBrush xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Key="linearGradient4269" MappingMode="RelativeToBoundingBox" StartPoint="0,0" EndPoint="1,1"><LinearGradientBrush.GradientStops><GradientStopCollection><GradientStop Color="#FF646464" Offset="0"/><GradientStop Color="#FF141414" Offset="1"/></GradientStopCollection></LinearGradientBrush.GradientStops></LinearGradientBrush><LinearGradientBrush xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Key="linearGradient3897" MappingMode="RelativeToBoundingBox" StartPoint="0,0" EndPoint="1,1"><LinearGradientBrush.GradientStops><GradientStopCollection><GradientStop Color="#00505050" Offset="0"/><GradientStop Color="#00505050" Offset="0.81944442"/><GradientStop Color="#9F505050" Offset="1"/></GradientStopCollection></LinearGradientBrush.GradientStops></LinearGradientBrush><RadialGradientBrush xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Key="radialGradient3903" MappingMode="Absolute" Center="174,159.5" GradientOrigin="174,159.5" RadiusX="111.4995" RadiusY="111.4995"><RadialGradientBrush.GradientStops><GradientStopCollection><GradientStop Color="#00505050" Offset="0"/><GradientStop Color="#00505050" Offset="0.81944442"/><GradientStop Color="#9F505050" Offset="1"/></GradientStopCollection></RadialGradientBrush.GradientStops></RadialGradientBrush><RadialGradientBrush xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Key="radialGradient4275" MappingMode="Absolute" Center="175,312" GradientOrigin="175,312" RadiusX="5" RadiusY="5"><RadialGradientBrush.GradientStops><GradientStopCollection><GradientStop Color="#FF646464" Offset="0"/><GradientStop Color="#FF141414" Offset="1"/></GradientStopCollection></RadialGradientBrush.GradientStops></RadialGradientBrush></Canvas.Resources><Canvas Name="layer9"><Canvas><Canvas.RenderTransform><TransformGroup><!--g--><TranslateTransform X="-42.5" Y="-142"/></TransformGroup></Canvas.RenderTransform><Rectangle xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Canvas.Left="43" Canvas.Top="143" Width="20" Height="42" Name="rect4165" Fill="#FFFF490F" Stroke="#FF000000" StrokeThickness="1" StrokeMiterLimit="4"/></Canvas></Canvas></Canvas>
47 changes: 47 additions & 0 deletions Aircraft FA-18C Plugin/Gauges/ADI/Alt/adi_gs_indicator.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Name="svg2" Width="14" Height="12">
<Canvas.Resources>
<LinearGradientBrush xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Key="linearGradient4269" MappingMode="RelativeToBoundingBox" StartPoint="0,0" EndPoint="1,1">
<LinearGradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#FF646464" Offset="0"/>
<GradientStop Color="#FF141414" Offset="1"/>
</GradientStopCollection>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Key="linearGradient3897" MappingMode="RelativeToBoundingBox" StartPoint="0,0" EndPoint="1,1">
<LinearGradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#00505050" Offset="0"/>
<GradientStop Color="#00505050" Offset="0.81944442"/>
<GradientStop Color="#9F505050" Offset="1"/>
</GradientStopCollection>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
<RadialGradientBrush xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Key="radialGradient3903" MappingMode="Absolute" Center="174,159.5" GradientOrigin="174,159.5" RadiusX="111.4995" RadiusY="111.4995">
<RadialGradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#00505050" Offset="0"/>
<GradientStop Color="#00505050" Offset="0.81944442"/>
<GradientStop Color="#9F505050" Offset="1"/>
</GradientStopCollection>
</RadialGradientBrush.GradientStops>
</RadialGradientBrush>
<RadialGradientBrush xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Key="radialGradient4275" MappingMode="Absolute" Center="175,312" GradientOrigin="175,312" RadiusX="5" RadiusY="5">
<RadialGradientBrush.GradientStops>
<GradientStopCollection>
<GradientStop Color="#FF646464" Offset="0"/>
<GradientStop Color="#FF141414" Offset="1"/>
</GradientStopCollection>
</RadialGradientBrush.GradientStops>
</RadialGradientBrush>
</Canvas.Resources>
<Canvas Name="g3997">
<Canvas>
<Canvas.RenderTransform>
<TransformGroup>
<!--g-->
<TranslateTransform X="-39.937742" Y="-156.51788"/>
</TransformGroup>
</Canvas.RenderTransform>
<Path xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="path4001" Fill="#ff00ff00" Stroke="#FF141414" StrokeThickness="1" StrokeMiterLimit="4" Data="m 64.937742 174.5 12.093387 -6.98212 0 13.96424 z"><!--path--><Path.RenderTransform><MatrixTransform Matrix="1.0870816,0,0,0.82477469,-30.181439,18.826816"/></Path.RenderTransform></Path></Canvas></Canvas></Canvas>
Loading