Ejemplo n.º 1
0
 public LocusGrid()
 {
     groundGridCol = Color.FromArgb(200, 200, 200);
     groundcCol    = Color.FromArgb(240, 240, 240);
     yBaseGridCol  = Color.FromArgb(200, 200, 200);
     yBaseCol      = Color.FromArgb(250, 250, 250);
     strCol        = Color.FromArgb(128, 128, 128);
     stdFont       = new Font("SansSelif", 12);
     smallFont     = new Font("SansSelif", 10);
     grid          = new VsObject();
 }
Ejemplo n.º 2
0
 private void EditProject(VsObject obj)
 {
     try
     {
         Process.Start("notepad.exe", obj.Path);
     }
     catch (Exception e)
     {
         ExceptionBox.Show("Error", e);
     }
 }
Ejemplo n.º 3
0
 private void OpenProjectDirectory(VsObject obj)
 {
     try
     {
         var directory = Path.GetDirectoryName(obj.Path);
         if (directory != null)
         {
             Process.Start(directory);
         }
     }
     catch (Exception e)
     {
         ExceptionBox.Show("Error", e);
     }
 }
Ejemplo n.º 4
0
        public Locus(AirPlane ap, Recorder rec, Material mate, Material mate2)
        {
            plane       = new VsObject();
            locus       = new VsObject();
            groundLocus = new VsObject();
            ybaseLocus  = new VsObject();
            MakePlane(ap, mate, mate2);
            MakeLocus(rec, ap);
            groundLocus = MakeXZLocus(rec, 0.0D, Color.Black);
            double y_base = LocusGrid.Y_base(locusBBox);

            if (y_base > 0.0D)
            {
                ybaseLocus = MakeXZLocus(rec, y_base, Color.Gray);
                ybaseLocus.Add(MakeWall(rec, y_base, Color.Gray));
            }
        }
Ejemplo n.º 5
0
        private async Task SetProjectReferenceFilterAsync(VsObject project)
        {
            ClearFilter();

            var selectedProjectReference = project is VsProject?
                                           UsedProjectReferences.FirstOrDefault(p => p.IsSameProject((VsProject)project)) :
                                               UsedProjectReferences.FirstOrDefault(p => p.IsSameProject((VsProjectReference)project));

            if (selectedProjectReference != null)
            {
                Filter.ProjectReferenceFilter          = selectedProjectReference;
                Filter.IsProjectReferenceFilterEnabled = true;
            }
            else
            {
                await Messenger.Default.SendAsync(new TextMessage("The project is not referenced in any project. ", "Project not referenced"));
            }
        }
Ejemplo n.º 6
0
        public VsObject MakeXZLocus(Recorder rec, double y, Color col)
        {
            VsObject xzLocus = new VsObject();
            Vector3D v1      = new Vector3D();
            Vector3D v2      = new Vector3D();

            int n = rec.N_record();

            for (int i = 0; i < n; i++)
            {
                RecordData dat = rec.GetData(i);
                if (i > 0)
                {
                    v1.SetVec(dat.wpos);
                    v2.SetVec(rec.GetData(i - 1).wpos);
                    v1.y = (v2.y = y);
                    xzLocus.Add(new VsSegment(v1, v2, col));
                }
            }
            return(xzLocus);
        }
Ejemplo n.º 7
0
        public VsObject MakeWall(Recorder rec, double y, Color col)
        {
            VsObject wall = new VsObject();

            int n = rec.N_record();

            if (n > 0)
            {
                wall.Add(Suisen(rec.GetData(0), y, col));
                wall.Add(Suisen(rec.GetData(n - 1), y, col));
            }
            int step = n / 10;

            if (step > 0)
            {
                for (int i = step; i < n; i += step)
                {
                    RecordData dat = rec.GetData(i);
                    wall.Add(Suisen(dat, y, col));
                }
            }
            return(wall);
        }
Ejemplo n.º 8
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);
        }
        public VsObject MakeEarth(Vector3D pos)
        {
            VsObject ret = new VsObject();

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

            double r = 6370000.0D;

            double x = pos.x;
            double y = pos.y;
            double z = pos.z;

            double h = Math.Abs(y);
            double scale;

            if (h != 0.0D)
            {
                scale = 2.0D * h * r / Math.Sqrt(h * h + 2.0D * h * r);
            }
            else
            {
                scale = 1.0D;
            }
            smat.SetSMat(scale, scale, scale);
            mtemp.SetTMat(x, 0.0D, z);
            ret.Add(earth.Transform(smat).Transform(mtemp));

            if (y > 2300.0D)
            {
                scale = 10000.0D;
                double tx = x - (x / scale - Math.Floor(x / scale)) * scale;
                double tz = z - (z / scale - Math.Floor(z / scale)) * scale;
                mtemp.SetTMat(tx, 0.0D, tz);
                ret.Add(glid10km.Transform(mtemp));
            }
            scale = 1000.0D;
            double tx_0 = x - (x / scale - Math.Floor(x / scale)) * scale;
            double tz_1 = z - (z / scale - Math.Floor(z / scale)) * scale;

            mtemp.SetTMat(tx_0, 0.0D, tz_1);
            ret.Add(glid1km.Transform(mtemp));

            if (y < 2700.0D)
            {
                scale = 100.0D;
                tx_0  = x - (x / scale - Math.Floor(x / scale)) * scale;
                tz_1  = z - (z / scale - Math.Floor(z / scale)) * scale;
                mtemp.SetTMat(tx_0, 0.0D, tz_1);
                ret.Add(glid100m.Transform(mtemp));
            }
            if (y < 270.0D)
            {
                scale = 10.0D;
                tx_0  = x - (x / scale - Math.Floor(x / scale)) * scale;
                tz_1  = z - (z / scale - Math.Floor(z / scale)) * scale;
                mtemp.SetTMat(tx_0, 0.0D, tz_1);
                ret.Add(glid10m.Transform(mtemp));
            }

            ret.Add(runway);
            if (y < 270.0D)
            {
                ret.Add(glid_runway);
            }

            return(ret);
        }
        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);
        }