コード例 #1
0
        public VsObject MakeGrid(BoundingBox bbox, double dist, double viewAngle)
        {
            double range_base = bbox.XSize();

            if (range_base < bbox.ZSize())
            {
                range_base = bbox.ZSize();
            }
            double k = dist / (bbox.DiagonalSize() / 2D / System.Math.Tan(MathTool.DegToRad(viewAngle) / 2D));

            range_base *= k;
            grid_scale  = Kizami(range_base);
            if (grid_scale < 50D)
            {
                grid_scale = 50D;
            }
            xs = Start(bbox.GetMinX() - 10D, grid_scale);
            xe = End(bbox.GetMaxX() + 10D, grid_scale);
            zs = Start(bbox.GetMinZ() - 10D, grid_scale);
            ze = End(bbox.GetMaxZ() + 10D, grid_scale);
            ys = Y_base(bbox);
            Vector3D  v1        = new Vector3D(xs, 0.0D, zs);
            Vector3D  v2        = new Vector3D(xe, 0.0D, zs);
            Vector3D  v3        = new Vector3D(xe, 0.0D, ze);
            Vector3D  v4        = new Vector3D(xs, 0.0D, ze);
            Vector3D  v5        = new Vector3D(xs, ys, zs);
            Vector3D  v6        = new Vector3D(xe, ys, zs);
            Vector3D  v7        = new Vector3D(xe, ys, ze);
            Vector3D  v8        = new Vector3D(xs, ys, ze);
            VsPolygon groundPol = new VsPolygon();

            groundPol.col = groundcCol;
            groundPol.pol.AddVertex(v1);
            groundPol.pol.AddVertex(v2);
            groundPol.pol.AddVertex(v3);
            groundPol.pol.AddVertex(v4);
            grid = new VsObject();
            grid.Add(groundPol);
            grid.Add(Jp.Maker1.Vsys3.Tools.BasicObject.XzGlid(0.0D, xs, zs, xe, ze, grid_scale, grid_scale, groundGridCol));
            if (ys > 0.0D)
            {
                grid.Add(new VsSegment(v1, v5, yBaseGridCol));
                grid.Add(new VsSegment(v2, v6, yBaseGridCol));
                grid.Add(new VsSegment(v3, v7, yBaseGridCol));
                grid.Add(new VsSegment(v4, v8, yBaseGridCol));
                VsPolygon basePol = new VsPolygon();
                basePol.col = yBaseCol;
                basePol.pol.AddVertex(v5);
                basePol.pol.AddVertex(v6);
                basePol.pol.AddVertex(v7);
                basePol.pol.AddVertex(v8);
                grid.Add(basePol);
                grid.Add(Jp.Maker1.Vsys3.Tools.BasicObject.XzGlid(ys, xs, zs, xe, ze, grid_scale,
                                                                  grid_scale, yBaseGridCol));
            }
            grid.Add(new VsString(DispFormat.DoubleFormat(ys, 0) + "m", v5, Color.Gray, smallFont));
            grid.Add(new VsString(DispFormat.DoubleFormat(ys, 0) + "m", v6, Color.Gray, smallFont));
            grid.Add(new VsString(DispFormat.DoubleFormat(ys, 0) + "m", v7, Color.Gray, smallFont));
            grid.Add(new VsString(DispFormat.DoubleFormat(ys, 0) + "m", v8, Color.Gray, smallFont));
            grid.Add(new VsString("NORTH", v7.Add(v8).SclProd(0.5D), Color.Gray, smallFont));
            grid.Add(new VsString("SOUTH", v5.Add(v6).SclProd(0.5D), Color.Gray, smallFont));
            grid.Add(new VsString("WEST", v8.Add(v5).SclProd(0.5D), Color.Gray, smallFont));
            grid.Add(new VsString("EAST", v7.Add(v6).SclProd(0.5D), Color.Gray, smallFont));
            return(grid);
        }
コード例 #2
0
        public GraphicsGenerator(Uri codeBase, double sX0, double sY0, double sX1, double sY1)
        {
            sc                     = new Scine();
            oa                     = new OpticalAmbience();
            bgColor                = Color.FromArgb(134, 171, 225);
            earthColorRed          = 50;
            earthColorGreen        = 93;
            earthColorBlue         = 45;
            glid1mColor            = Color.FromArgb(55, 102, 48);
            glid10mColor           = Color.FromArgb(61, 113, 59);
            glid100mColor          = Color.FromArgb(67, 124, 65);
            glid1kmColor           = Color.FromArgb(61, 113, 59);
            glid10kmColor          = Color.FromArgb(55, 102, 48);
            runwayColorRed         = 151;
            runwayColorGreen       = 151;
            runwayColorBlue        = 159;
            gridRunwayColor        = Color.FromArgb(160, 160, 170);
            interfaceColorPen      = new Pen(Color.FromArgb(200, 200, 255));
            interfaceColorBrush    = new SolidBrush(Color.FromArgb(200, 200, 255));
            interfaceColorDPen     = new Pen(Color.FromArgb(180, 180, 235));
            instrumentColor        = Color.FromArgb(255, 255, 255);
            instrumentGreen        = Color.FromArgb(128, 200, 128);
            instrumentYellow       = Color.FromArgb(200, 200, 128);
            instrumentRed          = Color.FromArgb(200, 128, 128);
            informationColor       = Color.FromArgb(220, 220, 255);
            simInterfaceColor      = Color.FromArgb(230, 255, 200);
            padLockColor           = Color.FromArgb(200, 200, 255);
            stdFont                = new Font("SansSelif", 12);
            bigFont                = new Font("SansSelif", 16);
            smallFont              = new Font("SansSelif", 9);
            padFont                = new Font("SansSelif", 11);
            stick_center_x         = 300;
            stick_center_y         = 200;
            stick_x_width          = 140;
            stick_y_width          = 140;
            rudder_center_x        = 300;
            rudder_center_y        = 320;
            rudder_x_witdh         = 45;
            rudder_y_width         = 30;
            throttle_x             = 10;
            throttle_y             = 390;
            throttle_width         = 100;
            mixture_x              = 25;
            mixture_y              = 390;
            mixture_width          = 100;
            prop_pitch_x           = 40;
            prop_pitch_y           = 390;
            prop_pitch_width       = 100;
            brake_right_x          = 580;
            brake_right_y          = 390;
            brake_right_width      = 100;
            brake_left_x           = 565;
            brake_left_y           = 390;
            brake_left_width       = 100;
            instrument_object_list = new VsObjectList();
            v_true_x               = 100;
            v_true_y               = 12;
            alt_x                  = 185;
            alt_y                  = 12;
            atmo_x                 = 280;
            atmo_y                 = 12;
            gear_x                 = 130;
            gear_y                 = 325;
            gear_box_size          = 9;
            gear_box_maegine       = 12;
            flap_x                 = 450;
            flap_y                 = 395;
            flap_width             = 100;
            stallAlert_x           = 257;
            stallAlert_y           = 140;
            pause_x                = 275;
            pause_y                = 100;
            slowMoton_x            = 245;
            slowMoton_y            = 115;
            proj                   = new Projector(sX1 - sX0 + 1.0D, sY1 - sY0 + 1.0D, MathTool.DegToRad(45.0D));
            proj.SetVerticalParamer(0.0D, 0.0D, sX1 - sX0 + 1.0D, sY1 - sY0 + 1.0D, MathTool.DegToRad(45.0D));
            clip = new Clipper(sX0, sY0, sX1, sY1);

            Matrix44 mtemp = new Matrix44();
            Matrix44 smat  = new Matrix44();

            mtemp.SetRxMat(MathTool.DegToRad(90.0D));
            earth = ((VsPolygon)Jp.Maker1.Vsys3.Tools.BasicObject.RegularPolygon(32, earthColorRed, earthColorGreen, earthColorBlue).Transform(mtemp));

            glid10km = Jp.Maker1.Vsys3.Tools.BasicObject.XzGlid(0.0D, -50000.0D, -50000.0D, 50000.0D, 50000.0D, 10000.0D, 10000.0D, glid10kmColor);
            glid1km  = Jp.Maker1.Vsys3.Tools.BasicObject.XzGlid(0.0D, -10000.0D, -10000.0D, 10000.0D, 10000.0D, 1000.0D, 1000.0D, glid1kmColor);
            glid100m = Jp.Maker1.Vsys3.Tools.BasicObject.XzGlid(0.0D, -1000.0D, -1000.0D, 1000.0D, 1000.0D, 100.0D, 100.0D, glid100mColor);
            glid10m  = Jp.Maker1.Vsys3.Tools.BasicObject.XzGlid(0.0D, -200.0D, -200.0D, 200.0D, 200.0D, 10.0D, 10.0D, glid10mColor);
            glid1m   = Jp.Maker1.Vsys3.Tools.BasicObject.XzGlid(0.0D, -30.0D, -30.0D, 30.0D, 30.0D, 1.0D, 1.0D, glid1mColor);

            smat.SetSMat(60.0D, 0.0D, 1000.0D);
            runway      = ((VsPolygon)Jp.Maker1.Vsys3.Tools.BasicObject.Square(runwayColorRed, runwayColorGreen, runwayColorBlue).Transform(mtemp.MultMat(smat)));
            glid_runway = Jp.Maker1.Vsys3.Tools.BasicObject.XzGlid(0.1D, -30.0D, -500.0D, 30.0D, 500.0D, 10.0D, 10.0D, gridRunwayColor);

            FormUnitFile fmu = new FormUnitFile(instrument_object_list, codeBase, "data/instrument.fmu", "data/instrument.mdf");

            pitch_miniature_aircraft = instrument_object_list.Get("PITCH_MINIATURE_ARECRAFT");
            pitch_miniature_aircraft.SetColor(informationColor);
            roll_miniature_aircraft = instrument_object_list.Get("ROLL_MINIATURE_ARECRAFT");
            roll_miniature_aircraft.SetColor(informationColor);
            heading_miniature_aircraft = instrument_object_list.Get("HEADING_MINIATURE_ARECRAFT");
            heading_miniature_aircraft.SetColor(instrumentColor);
            velocity_vector = instrument_object_list.Get("VELOCITY_VECTOR");
            velocity_vector.SetColor(informationColor);
            artificial_horizon = instrument_object_list.Get("ARTIFICIAL_HORIZON");
            artificial_horizon.SetColor(instrumentColor);
            front_point = instrument_object_list.Get("FRONT_POINT");
            front_point.SetColor(informationColor);
        }