Subversion Repositories Projects

Rev

Rev 2287 | Blame | Last modification | View Log | RSS feed

///============================================================================
/// 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; }
        }
    }
}