/MKLiveView/v1.0/Source/MKLiveView/ArtificialHorizon/ArtificialHorizon.xaml |
---|
0,0 → 1,68 |
<UserControl x:Class="MKLiveView.ArtificialHorizon.ArtificialHorizon" |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
xmlns:local="clr-namespace:MKLiveView.ArtificialHorizon" |
mc:Ignorable="d" Height="240" Width="240" |
DataContext="{Binding RelativeSource={RelativeSource Self}}"> |
<Grid> |
<Image Margin="0,0,0,0"> |
<Image.Source> |
<DrawingImage> |
<DrawingImage.Drawing> |
<DrawingGroup> |
<DrawingGroup> |
<DrawingGroup> |
<DrawingGroup.Transform> |
<TransformGroup> |
<RotateTransform x:Name="RollAngle" Angle="{Binding Roll, UpdateSourceTrigger=PropertyChanged}" CenterX="120" CenterY="120" /> |
<TranslateTransform x:Name="PitchAngle" Y="{Binding Pitch, UpdateSourceTrigger=PropertyChanged}" /> |
</TransformGroup> |
</DrawingGroup.Transform> |
<ImageDrawing ImageSource="horizon.png" Rect="0,0,240,240" /> |
</DrawingGroup> |
<DrawingGroup.ClipGeometry> |
<EllipseGeometry Center="120,120" RadiusX="60" RadiusY="60"> |
</EllipseGeometry> |
</DrawingGroup.ClipGeometry> |
</DrawingGroup> |
<DrawingGroup> |
<ImageDrawing ImageSource="Scale.png" Rect="0,0,240,240" /> |
<ImageDrawing ImageSource="Wings.png" Rect="0,0,240,240" /> |
</DrawingGroup> |
<DrawingGroup> |
<DrawingGroup> |
<ImageDrawing ImageSource="Home.png" Rect="0,0,240,240" /> |
<DrawingGroup.Transform> |
<TransformGroup> |
<RotateTransform x:Name="RotateHome" Angle="0" CenterX="120" CenterY="120" /> |
</TransformGroup> |
</DrawingGroup.Transform> |
</DrawingGroup> |
<DrawingGroup> |
<ImageDrawing ImageSource="Heading1.png" Rect="0,0,240,240" /> |
<DrawingGroup.Transform> |
<TransformGroup> |
<RotateTransform x:Name="Rotate" Angle="0" CenterX="120" CenterY="120" /> |
</TransformGroup> |
</DrawingGroup.Transform> |
</DrawingGroup> |
</DrawingGroup> |
<DrawingGroup.ClipGeometry> |
<EllipseGeometry Center="120,120" RadiusX="120" RadiusY="120"> |
</EllipseGeometry> |
</DrawingGroup.ClipGeometry> |
</DrawingGroup> |
</DrawingImage.Drawing> |
</DrawingImage> |
</Image.Source> |
</Image> |
</Grid> |
</UserControl> |
/MKLiveView/v1.0/Source/MKLiveView/ArtificialHorizon/ArtificialHorizon.xaml.cs |
---|
0,0 → 1,95 |
///============================================================================ |
/// MKLiveView |
/// Copyright © 2016 Steph |
/// |
///This file is part of MKLiveView. |
/// |
///MKLiveView is free software: you can redistribute it and/or modify |
///it under the terms of the GNU General Public License as published by |
///the Free Software Foundation, either version 3 of the License, or |
///(at your option) any later version. |
/// |
///MKLiveView is distributed in the hope that it will be useful, |
///but WITHOUT ANY WARRANTY; without even the implied warranty of |
///MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
///GNU General Public License for more details. |
/// |
///You should have received a copy of the GNU General Public License |
///along with cssRcon. If not, see <http://www.gnu.org/licenses/>. |
/// |
///============================================================================ |
///Credits: |
/// |
/// The code of the artificial horizon is an idea of 'Anders' and was discussed here: |
/// http://stackoverflow.com/questions/6161351/creating-an-advanced-hud |
/// |
///============================================================================ |
/// DISCLAIMER |
/// =========== |
/// |
/// I created this software with my best knowledge and belief. |
/// |
/// IN NO EVENT, UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, |
/// SHALL I, OR ANY PERSON BE LIABLE FOR ANY LOSS, EXPENSE OR DAMAGE, |
/// OF ANY TYPE OR NATURE ARISING OUT OF THE USE OF, |
/// OR INABILITY TO USE THIS SOFTWARE OR PROGRAM, |
/// INCLUDING, BUT NOT LIMITED TO, CLAIMS, SUITS OR CAUSES OF ACTION |
/// INVOLVING ALLEGED INFRINGEMENT OF COPYRIGHTS, |
/// PATENTS, TRADEMARKS, TRADE SECRETS, OR UNFAIR COMPETITION. |
/// |
/// This means: use it & have fun (but @ Your own risk...) |
/// =========================================================================== |
using System.Windows.Controls; |
namespace MKLiveView.ArtificialHorizon |
{ |
/// <summary> |
/// Interaktionslogik für ArtificialHorizon.xaml |
/// </summary> |
public partial class ArtificialHorizon : UserControl |
{ |
double roll = 0; |
double pitch = 0; |
public ArtificialHorizon() |
{ |
InitializeComponent(); |
} |
public double Roll |
{ |
set |
{ |
roll = -value; |
RollAngle.Angle = roll; |
} |
get |
{ |
return -roll; |
} |
} |
public double Pitch |
{ |
set |
{ |
pitch = -value * (double)60 / (double)90; |
PitchAngle.Y = pitch; |
} |
get |
{ |
return -pitch * 90 / 60; |
} |
} |
public double rotate |
{ |
set { Rotate.Angle = value; } |
get { return Rotate.Angle; } |
} |
public double rotateHome |
{ |
set { RotateHome.Angle = value; } |
get { return RotateHome.Angle; } |
} |
} |
} |
/MKLiveView/v1.0/Source/MKLiveView/ArtificialHorizon/Heading.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/MKLiveView/v1.0/Source/MKLiveView/ArtificialHorizon/Heading1.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/MKLiveView/v1.0/Source/MKLiveView/ArtificialHorizon/Home.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/MKLiveView/v1.0/Source/MKLiveView/ArtificialHorizon/Scale.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/MKLiveView/v1.0/Source/MKLiveView/ArtificialHorizon/horizon.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/MKLiveView/v1.0/Source/MKLiveView/ArtificialHorizon/wings.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |