Esempio n. 1
0
    public void Update(AirPlane ap, CockpitInterface cif, double dt)
    {
        PadlockObject pobj = pObjList.PadlockObj(ap);

        if ((cif.padLock_sw == 0) || (pobj == null))
        {
            double pitch;
            double yaw = pitch = 0.0D;
            if (cif.view_direction == 0)
            {
                if (cif.view_upper == 1)
                {
                    pitch = -1.570796326794897D;
                }
            }
            else
            {
                yaw = -(cif.view_direction - 1) / 4.0D * Math.PI;
                if (cif.view_upper == 1)
                {
                    pitch = -0.7853981633974483D;
                }
            }
            SetViewDirection(yaw, pitch);
        }
        else
        {
            SetViewDirection(pobj.RPosPilot(ap));
        }
    }
Esempio n. 2
0
    public void Init()
    {
        cif = new CockpitInterface();

        inp = new Inertia(plane.name);

        inp.SetBlock(0, new InertiaBlock("‹@‘Ì", plane.cg, plane.m0, plane.ixx_m0, plane.iyy_m0, plane.izz_m0, plane.ixy_m0, plane.iyz_m0, plane.izx_m0));

        pMotion = new PlaneMotion(inp, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
        atmos   = new Isa(pMotion.wpos.y);
    }
Esempio n. 3
0
    public void Set_pMotionLand()
    {
        Vector3D p0 = new Vector3D(landing_gear[1, 0].p0_base);

        p0.y  = 0.0D;
        p0.z -= landing_gear[1, 0].stroke0;
        Vector3D p1 = new Vector3D(landing_gear[0, 0].p0_base);

        p1.y  = 0.0D;
        p1.z -= landing_gear[0, 0].stroke0;
        Vector3D land = p1.Sub(p0).NmlVec();

        if (land.x < 0.0D)
        {
            land = land.SclProd(-1.0D);
        }

        Bearing br    = new Bearing(land.R2l());
        double  pitch = -br.pitch.GetValue();

        double h0 = p0.SclProd(-1.0D).Sub(land.SclProd(land.DotProd(p0.SclProd(-1.0D)))).Length();

        pMotion = new PlaneMotion(inp, pMotion.wpos.x, h0, pMotion.wpos.y, 0.0D, pitch, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);

        int i;

        for (i = 0; i < n_LandingGear; i++)
        {
            for (int lr = 0; lr <= 1; lr++)
            {
                if (landing_gear[i, lr].flag == 1)
                {
                    landing_gear[i, lr].delta = 1.0D;
                }
            }
        }
        flag_landing_gear = 1;

        for (i = 0; i < n_powerPlant; i++)
        {
            if (powerPlant[i].engine_type == 1)
            {
                ((ReciprocatingEngine)powerPlant[i].engine).enginePower.output = 0.0D;
            }
        }

        for (i = 0; i < n_t_flap; i++)
        {
            t_flap[i, 0].delta = 0.0D;
            t_flap[i, 1].delta = t_flap[i, 0].delta;
        }

        cif = new CockpitInterface();
    }
Esempio n. 4
0
 internal void Set_landling_gear_delta(int lr, CockpitInterface cif, double dt)
 {
     if (cif.landing_gear_counter > t_lag_move[lr])
     {
         if (cif.landing_gear_sw == -1)
         {
             delta += dt / t_move;
             if (delta > 1.0D)
             {
                 delta = 1.0D;
             }
         }
         else
         {
             delta -= dt / t_move;
             if (delta < 0.0D)
             {
                 delta = 0.0D;
             }
         }
     }
 }
        public void DrawInterfase(Graphics g, AirPlane ap)
        {
            CockpitInterface cif = ap.cif;

            //g.SetColor(interfaceColor);
            // g.SetFont(stdFont);

            double elevcent = ap.elevator[0, 0].delta_max / (ap.elevator[0, 0].delta_max - ap.elevator[0, 0].delta_min);
            int    stx      = stick_center_x;
            int    sty      = stick_center_y - stick_y_width + (int)(stick_y_width * 2.0D * elevcent + 0.5D);

            // g.SetColor(interfaceColorD);
            //g.DrawLine(stx, sty - 7, stx, sty + 7);
            //g.DrawLine(stx - 7, sty, stx + 7, sty);

            g.DrawLine(interfaceColorDPen, stx, sty - 7, stx, sty + 7);
            g.DrawLine(interfaceColorDPen, stx - 7, sty, stx + 7, sty);

            //g.SetColor(interfaceColor);
            //g.DrawRect(stick_center_x - stick_x_width, stick_center_y - stick_y_width, stick_x_width * 2, stick_y_width * 2);

            g.DrawRectangle(interfaceColorPen, stick_center_x - stick_x_width, stick_center_y - stick_y_width, stick_x_width * 2, stick_y_width * 2);

            int x = (int)(cif.stick_pos_x * stick_x_width + 0.5D) + stick_center_x;
            int y = (int)(cif.stick_pos_y * stick_y_width + 0.5D) + stick_center_y;

            g.DrawLine(interfaceColorPen, x, y, stx, sty);
            //g.FillOval(x - 3, y - 3, 6, 6);

            g.FillEllipse(interfaceColorBrush, x - 3, y - 3, 6, 6);


            if (cif.stick_mode == 0)
            {
                g.DrawString("CLICK TO ACTIVATE STICK", stdFont, interfaceColorBrush, stick_center_x - 70, stick_center_y - stick_y_width + 12);
                g.DrawEllipse(interfaceColorPen, x - 5, y - 5, 10, 10);
            }
            else
            {
                g.DrawLine(interfaceColorPen, x - 7, y, x + 7, y);
                g.DrawLine(interfaceColorPen, x, y + 7, x, y - 7);
            }

            int x0 = rudder_center_x - rudder_x_witdh;
            int x1 = rudder_center_x + rudder_x_witdh;
            int y0 = rudder_center_y + (int)(rudder_y_width * cif.rudder_pos + 0.5D);
            int y1 = rudder_center_y - (int)(rudder_y_width * cif.rudder_pos + 0.5D);

            // g.SetColor(interfaceColorD);
            //  g.DrawRect(x0 - 5, y0 - 5, 10, 10);
            // g.DrawRect(x1 - 5, y1 - 5, 10, 11);
            // g.DrawLine(x0, y0, x1, y1);

            y0 = rudder_center_y + (int)(rudder_y_width * cif.frudder_pos.output + 0.5D);
            y1 = rudder_center_y - (int)(rudder_y_width * cif.frudder_pos.output + 0.5D);
            //g.SetColor(interfaceColor);
            //g.DrawRect(x0 - 5, y0 - 5, 10, 10);
            //g.DrawRect(x1 - 5, y1 - 5, 10, 11);
            //g.DrawLine(x0, y0, x1, y1);

            x0 = throttle_x;
            y0 = throttle_y;
            double pos;

            for (pos = 0.1D; pos <= 0.9D; pos += 0.1D)
            {
                y = (int)(throttle_width * pos + 0.5D);
                //     g.DrawLine(x0, y0 - y, x0 + 2, y0 - y);
            }
            y = (int)(throttle_width * 0.5D + 0.5D);
            //    g.DrawLine(x0, y0 - y, x0 + 5, y0 - y);
            //  g.DrawString("T", x0 + 2, y0 - throttle_width - 1);
            //g.DrawRect(x0, y0 - throttle_width, 10, throttle_width);
            y = (int)(throttle_width * cif.throttle_pos + 0.5D);
            //    g.FillRect(x0 + 2, y0 - y, 7, y);
            //g.DrawString(Jp.Maker1.Util.DispFormat.DoubleFormat(cif.throttle_pos * 100.0D, 0) + "%", x0, y0 - throttle_width - 13);

            x0 = mixture_x;
            y0 = mixture_y;
            for (pos = 0.1D; pos <= 0.9D; pos += 0.1D)
            {
                y = (int)(throttle_width * pos + 0.5D);
                //g.DrawLine(x0, y0 - y, x0 + 2, y0 - y);
            }
            y = (int)(throttle_width * 0.5D + 0.5D);
            // g.DrawLine(x0, y0 - y, x0 + 5, y0 - y);
            // g.DrawString("M", x0 + 1, y0 - throttle_width - 1);
            // g.DrawRect(x0, y0 - mixture_width, 10, mixture_width);
            y = (int)(mixture_width * cif.mixture_pos + 0.5D);
            // g.FillRect(x0 + 2, y0 - y, 7, y);

            x0 = prop_pitch_x;
            y0 = prop_pitch_y;
            for (pos = 0.1D; pos <= 0.9D; pos += 0.1D)
            {
                y = (int)(throttle_width * pos + 0.5D);
                // g.DrawLine(x0, y0 - y, x0 + 2, y0 - y);
            }
            y = (int)(throttle_width * 0.5D + 0.5D);
            //   g.DrawLine(x0, y0 - y, x0 + 5, y0 - y);
            //  g.DrawString("P", x0 + 2, y0 - throttle_width - 1);
            //  g.DrawRect(x0, y0 - prop_pitch_width, 10, prop_pitch_width);
            y = (int)(prop_pitch_width * cif.prop_pitch_pos + 0.5D);
            //  g.FillRect(x0 + 2, y0 - y, 7, y);

            x0 = brake_right_x;
            y0 = brake_right_y;
            for (pos = 0.1D; pos <= 0.9D; pos += 0.1D)
            {
                y = (int)(throttle_width * pos + 0.5D);
                //g.DrawLine(x0, y0 - y, x0 + 2, y0 - y);
            }
            // g.DrawString("R", x0 + 2, y0 - throttle_width - 1);
            y = (int)(throttle_width * 0.5D + 0.5D);
            // g.DrawLine(x0, y0 - y, x0 + 5, y0 - y);
            // g.DrawRect(x0, y0 - brake_right_width, 10, brake_right_width);
            y = (int)(brake_right_width * cif.brakeRight_pos + 0.5D);
            // g.FillRect(x0 + 2, y0 - y, 7, y);

            x0 = brake_left_x;
            y0 = brake_left_y;
            for (pos = 0.1D; pos <= 0.9D; pos += 0.1D)
            {
                y = (int)(throttle_width * pos + 0.5D);
                //  g.DrawLine(x0, y0 - y, x0 + 2, y0 - y);
            }
            //g.DrawString("W.BRK", x0 - 2, y0 - throttle_width - 13);
            //  g.DrawString("L", x0 + 2, y0 - throttle_width - 1);
            y = (int)(throttle_width * 0.5D + 0.5D);
            //  g.DrawLine(x0, y0 - y, x0 + 5, y0 - y);
            //  g.DrawRect(x0, y0 - brake_left_width, 10, brake_left_width);
            y = (int)(brake_left_width * cif.brakeLeft_pos + 0.5D);
            // g.FillRect(x0 + 2, y0 - y, 7, y);
        }