Using KlvOverlay

  • Create a Wpf application

Create New project

  • Set target to x64

  • Add a reference to KlvOverlayControl and make sure you have all binary dependencies (can be found in \Bin\Resdistributables) copied to the target directory. You can set up the copy as the post build event.

Adding reference

  • Open MainWindow.xaml file and add KlvOverlayControl to the local namespace
<Window x:Class="KlvFrameOverlayApp.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:KlvFrameOverlayApp" xmlns:KlvOverlayControl="clr-namespace:KlvOverlayControl;assembly=KlvOverlayControl"
        mc:Ignorable="d"
        Title="MainWindow" Height="500" Width="720">
    <Grid>      
    </Grid>
</Window>

  • Create user interface

Add KlvOverlayControl and Image elements and set the mouse events handlers event handler

<Grid x:Name="OverlayGrid" Grid.Row="1" PreviewMouseDown="OverlayGrid_PreviewMouseDown"  >
    <KlvOverlayControl:KlvOverlayCtrl x:Name="OverlayCtrl" OverlayReady="OverlayCtrl_OverlayReady" MouseMoveEx="OverlayCtrl_MouseMoveEx" MarkerMove="OverlayCtrl_MarkerMove" Panel.ZIndex="10" OnError="OverlayCtrl_OnError" />
    <Image Name="FrameImage" Stretch="Fill"/>
</Grid>
  • In the .cs file, implement the mouse event handlers:
private void OverlayCtrl_MouseMoveEx(object sender, RoutedEventArgs e)
{
    CoordRoutedEventArgs args = (CoordRoutedEventArgs)e;
    var screenCoord = args.ScreenCoord;
    var MouseGeoCoord = args.GeoCoord;

    Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new Action(delegate
    {
        ... Print screen coord:
        $"X:{((int)screenCoord.X).ToString()} Y:{((int)screenCoord.Y).ToString()}";
        ... Print geo coord: 
        $"Lat: {MouseGeoCoord.Latitude.ToString("0.00000000")}  Lon: { MouseGeoCoord.Longitude.ToString("0.00000000")}";
    }));

}

private void OverlayCtrl_MarkerMove(object sender, RoutedEventArgs e)
{
    CoordRoutedEventArgs args = (CoordRoutedEventArgs)e;
    var MarkerGeoCoord = args.GeoCoord;

    Dispatcher.BeginInvoke(DispatcherPriority.Loaded, new Action(delegate
    {
        ... Print marker geo coord:
        $"Lat: {MarkerGeoCoord.Latitude.ToString("0.00000000")}  Lon: { MarkerGeoCoord.Longitude.ToString("0.00000000")}";
    }));    
}
  • Implement image loading:

Next, you need to implement image loading. See the test application for more details.

  • Implement metadata loading

Now, you need to load the metadata and call the UpdateTelemetry method.

OverlayCtrl.UpdateTelemetry(jCtrlPckt.ToString());

See the test application for more details.