Пример #1
0
        public PlanetsCalc(ISettings settings)
        {
            this.settings = settings;

            for (int i = 0; i < planets.Length; i++)
            {
                planets[i] = new Planet(i + 1);
            }

            for (int i = 0; i < MarsMoons.Count; i++)
            {
                marsMoons[i] = new MarsMoon(i + 1);
            }

            for (int i = 0; i < JupiterMoons.Count; i++)
            {
                jupiterMoons[i] = new JupiterMoon(i + 1);
            }

            for (int i = 0; i < SaturnMoons.Count; i++)
            {
                saturnMoons[i] = new SaturnMoon(i + 1);
            }

            for (int i = 0; i < UranusMoons.Count; i++)
            {
                uranusMoons[i] = new UranusMoon(i + 1);
            }

            for (int i = 0; i < NeptuneMoons.Count; i++)
            {
                neptuneMoons[i] = new NeptuneMoon(i + 1);
            }

            var orbits = new OrbitalElementsManager(settings).Load();

            foreach (var orbit in orbits)
            {
                genericMoons.Add(new GenericMoon()
                {
                    Data = orbit
                });
            }

            planets[Planet.JUPITER - 1].Flattening = 0.064874f;
            planets[Planet.SATURN - 1].Flattening  = 0.097962f;
        }
Пример #2
0
        private void RenderJupiterShadow(IMapContext map, JupiterMoon moon)
        {
            Planet jupiter = planetsCalc.Planets.ElementAt(Planet.JUPITER - 1);

            float rotation = map.GetRotationTowardsNorth(jupiter.Equatorial) + 360 - (float)jupiter.Appearance.P;

            float diam      = map.GetDiskSize(jupiter.Semidiameter);
            float diamEquat = diam;
            float diamPolar = (1 - jupiter.Flattening) * diam;

            // Jupiter radius, in pixels
            float sd = diam / 2;

            // Center of eclipsed moon
            PointF pMoon = map.Project(moon.Horizontal);

            // elipsed moon size, in pixels
            float szB = map.GetDiskSize(moon.Semidiameter);

            // Center of shadow
            PointF p = new PointF(-(float)moon.RectangularS.X * sd, (float)moon.RectangularS.Y * sd);

            map.Graphics.TranslateTransform(pMoon.X, pMoon.Y);
            map.Graphics.RotateTransform(rotation);

            var gpM = new GraphicsPath();
            var gpU = new GraphicsPath();

            gpU.AddEllipse(p.X - diamEquat / 2 - 1, p.Y - diamPolar / 2 - 1, diamEquat + 2, diamPolar + 2);
            gpM.AddEllipse(-szB / 2 - 0.5f, -szB / 2 - 0.5f, szB + 1, szB + 1);

            var regionU = new Region(gpU);

            regionU.Intersect(gpM);

            if (!regionU.IsEmpty(map.Graphics))
            {
                map.Graphics.FillRegion(new SolidBrush(clrJupiterShadow), regionU);
            }

            map.Graphics.ResetTransform();
            if (!regionU.IsEmpty(map.Graphics))
            {
                map.DrawObjectCaption(fontShadowLabel, brushShadowLabel, Text.Get("EclipsedByJupiter"), pMoon, szB);
            }
        }
Пример #3
0
        public PlanetsCalc(ISettings settings)
        {
            this.settings = settings;

            for (int i = 0; i < planets.Length; i++)
            {
                planets[i] = new Planet(i + 1);
            }

            for (int i = 0; i < JupiterMoons.Count; i++)
            {
                jupiterMoons[i] = new JupiterMoon(i + 1);
            }

            planets[Planet.JUPITER - 1].Flattening = 0.064874f;
            planets[Planet.SATURN - 1].Flattening  = 0.097962f;
        }