Exemplo n.º 1
0
        private void DrawSpeedAndG(double speed_kt, double mach, double gLoad)
        {
            var txtBlkGM = new BorderTextLabel();

            txtBlkGM.Stroke = Brushes.White;

            if (G_LoadEnabled)
            {
                txtBlkGM.Text = "G  " + gLoad.ToString("+0.0;-0.0;0.0") + "\n";
            }

            if (MachEnabled)
            {
                txtBlkGM.Text = txtBlkGM.Text + "M  " + mach.ToString("0.00");
            }

            txtBlkGM.Foreground = Brushes.White;
            txtBlkGM.FontSize   = 20;
            Canvas.SetTop(txtBlkGM, -50);
            Canvas.SetLeft(txtBlkGM, -50);
            Canvas_LeftHUD.Children.Add(txtBlkGM);

            if (SpeedKtEnabled)
            {
                var txtBlkSpd = new BorderTextLabel();
                txtBlkSpd.Stroke     = Brushes.White;
                txtBlkSpd.Text       = "SPEED\nkt    " + speed_kt.ToString("0");
                txtBlkSpd.Foreground = Brushes.White;
                txtBlkSpd.FontSize   = 16;
                Canvas.SetTop(txtBlkSpd, -200);
                Canvas.SetLeft(txtBlkSpd, -50);
                Canvas_LeftHUD.Children.Add(txtBlkSpd);
            }
        }
Exemplo n.º 2
0
        private void DrawClimbRate(double climbRate)
        {
            var txtBlk = new BorderTextLabel();

            txtBlk.Stroke     = Brushes.White;
            txtBlk.Text       = "VERT\n" + climbRate.ToString("+0.0;-0.0;0.0") + " ft/min";
            txtBlk.Foreground = Brushes.White;
            txtBlk.FontSize   = 20;
            Canvas.SetTop(txtBlk, -25);
            Canvas_RightHUD.Children.Add(txtBlk);

            Line zeroLn = new Line();

            zeroLn.X1              = -10;
            zeroLn.X2              = -40;
            zeroLn.Y1              = 0;
            zeroLn.Y2              = 00;
            zeroLn.Stroke          = Brushes.White;
            zeroLn.StrokeThickness = 1;
            Canvas_RightHUD.Children.Add(zeroLn);

            double maxHUD_Height = Grid_RightHUD.ActualHeight * 0.7;

            double magHeight = Math.Abs(climbRate);

            if (magHeight > MaxClimbRateArrowMag)
            {
                magHeight = MaxClimbRateArrowMag;
            }

            Rectangle climbMagnitude = new Rectangle();

            climbMagnitude.Fill   = Brushes.White;
            climbMagnitude.Width  = 12;
            climbMagnitude.Height = maxHUD_Height * (magHeight / (2 * MaxClimbRateArrowMag));
            Canvas.SetLeft(climbMagnitude, -31);

            Polygon triangle = CreateTriangle(-9, 0, 9, 0, 0, 12);

            Canvas.SetLeft(triangle, -25);

            if (climbRate > 0)
            {
                Canvas.SetTop(climbMagnitude, -climbMagnitude.Height);
                Canvas.SetTop(triangle, -climbMagnitude.Height);
                triangle.RenderTransform = new RotateTransform(180);
            }
            else
            {
                Canvas.SetTop(triangle, climbMagnitude.Height);
            }

            if (Math.Abs(climbRate) > 1.0)
            {
                // don't draw flickering arrow if bouncing around near 0
                Canvas_RightHUD.Children.Add(triangle);
            }
            Canvas_RightHUD.Children.Add(climbMagnitude);
        }
Exemplo n.º 3
0
        private void DrawAlphaBeta(double alpha, double beta)
        {
            var txtBlkSpd = new BorderTextLabel();

            txtBlkSpd.Stroke = Brushes.White;
            txtBlkSpd.Text   = "\u03B1    " + alpha.ToString("+0.0;-0.0;0.0") +
                               "\n\u03B2    " + beta.ToString("+0.0;-0.0;0.0");
            txtBlkSpd.Foreground = Brushes.White;
            txtBlkSpd.FontSize   = 16;
            Canvas.SetTop(txtBlkSpd, 200);
            Canvas.SetLeft(txtBlkSpd, -50);
            Canvas_LeftHUD.Children.Add(txtBlkSpd);
        }
Exemplo n.º 4
0
        private void DrawCompass(double yawDeg)
        {
            double wl = Grid_Compass.ActualWidth;

            double horzPixelsPerDeg = wl / YAW_COMPASS_DEG_TO_DISP;

            double startYaw     = yawDeg - (YAW_COMPASS_DEG_TO_DISP / 2.0);
            int    roundedStart = (int)Math.Ceiling(startYaw);

            // this is the x co-ord of the left-most tick to be displayed displayed
            double tickOffset = (roundedStart - startYaw) * horzPixelsPerDeg;

            for (int i = 0; i < YAW_COMPASS_DEG_TO_DISP; i++)
            {
                if (0 == ((i + roundedStart) % 2))
                {
                    Line tl = new Line();
                    tl.X1 = tickOffset + (i * horzPixelsPerDeg);
                    tl.X2 = tl.X1;

                    if (0 == ((i + roundedStart) % 10))
                    {
                        tl.Y1 = 21;
                        var ticktext = new BorderTextLabel();
                        ticktext.FontFamily = new FontFamily("Courier New");
                        ticktext.Stroke     = Brushes.White;
                        ticktext.FontSize   = 14;
                        int txt = (i + roundedStart);
                        if (txt < 0)
                        {
                            txt += 360;
                        }
                        txt                /= 10;
                        ticktext.Text       = txt.ToString("D2");
                        ticktext.Foreground = Brushes.White;
                        Canvas.SetTop(ticktext, 2);
                        Canvas.SetLeft(ticktext, tl.X1 - 10);
                        Canvas_Compass.Children.Add(ticktext);
                    }
                    else
                    {
                        tl.Y1 = 25;
                    }
                    tl.Y2              = 30;
                    tl.Stroke          = Brushes.White;
                    tl.StrokeThickness = 1;
                    Canvas_Compass.Children.Add(tl);
                }
            }
        }
Exemplo n.º 5
0
        private void DrawSpeedAndG(double speed_ms, double mach, double gLoad)
        {
            var txtBlkGM = new BorderTextLabel();

            txtBlkGM.Stroke = Brushes.White;
            txtBlkGM.Text   = "G  " + gLoad.ToString("+0.0;-0.0;0.0") + "\n" +
                              "M  " + mach.ToString("0.00");
            txtBlkGM.Foreground = Brushes.White;
            txtBlkGM.FontSize   = 10;
            Canvas.SetTop(txtBlkGM, -50);
            Canvas.SetLeft(txtBlkGM, -25);
            //Canvas_LeftHUD.Children.Add(txtBlkGM);

            var txtBlkSpd = new BorderTextLabel();

            txtBlkSpd.Stroke     = Brushes.White;
            txtBlkSpd.Text       = "Speed\n" + speed_ms.ToString("0.0") + "  m/s";
            txtBlkSpd.Foreground = Brushes.White;
            txtBlkSpd.FontSize   = 10;
            Canvas.SetTop(txtBlkSpd, -125);
            Canvas.SetLeft(txtBlkSpd, -25);
            Canvas_LeftHUD.Children.Add(txtBlkSpd);
        }
Exemplo n.º 6
0
        private void DrawHeading(double yawDeg)
        {
            yawDeg = yawDeg % 360;

            if (yawDeg < 0)
            {
                yawDeg += 360;
            }

            int yawInt = (int)yawDeg;

            if (360 == yawInt)
            {
                yawInt = 0;
            }

            double left = (Grid_Compass.ActualWidth / 2) - 30;

            string hdgStr = "HDG ";

            if (yawInt < 100)
            {
                hdgStr += " ";
            }
            if (yawInt < 10)
            {
                hdgStr += " ";
            }

            var heading = new BorderTextLabel();

            heading.FontFamily = new FontFamily("Courier New");
            heading.Stroke     = Brushes.White;
            heading.FontSize   = 12;

            heading.Text       = hdgStr + ((int)yawDeg).ToString();
            heading.Foreground = Brushes.White;

            Border border = new Border();

            border.Child = heading;

            border.BorderThickness = new Thickness(1);
            border.BorderBrush     = new SolidColorBrush(Colors.White);
            Canvas.SetTop(border, 44);
            Canvas.SetLeft(border, left);
            Canvas_Compass.Children.Add(border);

            Line leftLn = new Line();

            leftLn.X1              = (Grid_Compass.ActualWidth / 2) - 15;
            leftLn.X2              = (Grid_Compass.ActualWidth / 2);
            leftLn.Y1              = 44;
            leftLn.Y2              = 30;
            leftLn.Stroke          = Brushes.White;
            leftLn.StrokeThickness = 1;
            Canvas_Compass.Children.Add(leftLn);

            Line rightLn = new Line();

            rightLn.X1              = (Grid_Compass.ActualWidth / 2) + 15;
            rightLn.X2              = (Grid_Compass.ActualWidth / 2);
            rightLn.Y1              = 44;
            rightLn.Y2              = 30;
            rightLn.Stroke          = Brushes.White;
            rightLn.StrokeThickness = 1;
            Canvas_Compass.Children.Add(rightLn);
        }
Exemplo n.º 7
0
        private void DrawMajorPitchTick(double offset, double val, bool dispTxt)
        {
            Line lnL = new Line();

            lnL.X1              = 0;
            lnL.X2              = 40;
            lnL.Y1              = 0;
            lnL.Y2              = 0;
            lnL.Stroke          = Brushes.White;
            lnL.StrokeThickness = 2;
            Canvas.SetLeft(lnL, -80);
            Canvas.SetTop(lnL, -offset);
            Canvas_PitchIndicator.Children.Add(lnL);

            Line lnR = new Line();

            lnR.X1              = 0;
            lnR.X2              = 40;
            lnR.Y1              = 0;
            lnR.Y2              = 0;
            lnR.Stroke          = Brushes.White;
            lnR.StrokeThickness = 2;
            Canvas.SetLeft(lnR, 40);
            Canvas.SetTop(lnR, -offset);
            Canvas_PitchIndicator.Children.Add(lnR);

            if (val != 0)
            {
                Line left = new Line();
                left.X1              = 0;
                left.X2              = 0;
                left.Y1              = 0;
                left.Y2              = 7;
                left.Stroke          = Brushes.White;
                left.StrokeThickness = 2;
                Canvas.SetLeft(left, -80);
                Canvas.SetTop(left, -offset);

                Line right = new Line();
                right.X1              = 0;
                right.X2              = 0;
                right.Y1              = 0;
                right.Y2              = 7;
                right.Stroke          = Brushes.White;
                right.StrokeThickness = 2;
                Canvas.SetRight(right, -80);
                Canvas.SetTop(right, -offset);

                if (val < 0)
                {
                    left.Y2  = -left.Y2;
                    right.Y2 = -right.Y2;
                }
                Canvas_PitchIndicator.Children.Add(left);
                Canvas_PitchIndicator.Children.Add(right);
            }

            if (true == dispTxt)
            {
                var txtBlkL = new BorderTextLabel();
                txtBlkL.Stroke = Brushes.DimGray;
                txtBlkL.HorizontalContentAlignment = HorizontalAlignment.Left;
                txtBlkL.Text       = val.ToString("##0");
                txtBlkL.Foreground = Brushes.White;
                txtBlkL.FontSize   = 16;
                txtBlkL.FontWeight = FontWeights.Bold;
                Canvas.SetTop(txtBlkL, -offset - 13);
                Canvas.SetLeft(txtBlkL, -120);
                Canvas_PitchIndicator.Children.Add(txtBlkL);

                var txtBlkR = new BorderTextLabel();
                txtBlkR.Stroke = Brushes.DimGray;
                txtBlkR.HorizontalContentAlignment = HorizontalAlignment.Right;
                txtBlkR.Text       = val.ToString("##0");
                txtBlkR.Foreground = Brushes.White;
                txtBlkR.FontSize   = 16;
                txtBlkR.FontWeight = FontWeights.Bold;
                Canvas.SetTop(txtBlkR, -offset - 13);
                Canvas.SetRight(txtBlkR, -120);
                Canvas_PitchIndicator.Children.Add(txtBlkR);
            }
        }