Exemplo n.º 1
0
 public PlanetSystem GetEarth()
 {
     try
     {
         //var Earth = generator.CreatePlanet(new Tuple<double, double>(152.1, 0), 12756, 5.97, 152.1, 147.1, 29.8, 365.2, new Tuple<double, double>(101, 101));
         //List<Moon> moons = new List<Moon>() { generator.CreateMoon(new Tuple<double, double>(150, 0), 3475, 0.73, 0.406, 0.363, 1.0, Earth.Coordinates) };
         //Earth.Name = "Earth";
         //return generator.CreatePlanetSystem(Earth, moons);
         var Earth = new Planet();
         Earth.Name          = "Earth";
         Earth.Coordinates   = new Tuple <double, double>(152.1, 0);
         Earth.Diametr       = 12756;
         Earth.Mass          = 5.97;
         Earth.ELlipseParamA = 152.1;
         Earth.ELlipseParamB = 147.1;
         Earth.Speed         = 29.8;
         Earth.OrbitalPeriod = 365.2;
         Earth.EllipseCenter = new Tuple <double, double>(101, 101);
         var Moon = new Moon();
         Moon.CreateMoon();
         return(generator.CreatePlanetSystem(Earth, new List <Moon> {
             Moon
         }));
     }
     catch (Exception e)
     {
         throw new System.Exception($"Class {this.GetType().Name}, method {System.Reflection.MethodBase.GetCurrentMethod().Name}" + e.Message);
     }
 }
Exemplo n.º 2
0
        private void Button1_Click(object sender, EventArgs e)
        {
            _planet             = new Planet();
            _planet.Name        = textBox1.Text;
            _planet.Coordinates = new Tuple <double, double>(Convert.ToDouble(textBox3.Text.Split('-')[0]),
                                                             Convert.ToDouble(textBox3.Text.Split('-')[1]));
            _planet.Mass          = Convert.ToDouble(textBox4.Text);
            _planet.Diametr       = Convert.ToDouble(textBox5.Text);
            _planet.ELlipseParamA = Convert.ToDouble(textBox6.Text);
            _planet.ELlipseParamB = Convert.ToDouble(textBox7.Text);
            _planet.OrbitalPeriod = Convert.ToDouble(textBox8.Text);
            _planet.Speed         = Convert.ToDouble(textBox9.Text);


            if (IsMoon.Checked == true)
            {
                _moon             = new Moon();
                _moon.Coordinates = new Tuple <double, double>(Convert.ToDouble(textBox15.Text.Split('-')[0]),
                                                               Convert.ToDouble(textBox15.Text.Split('-')[1]));
                _moon.Mass     = Convert.ToDouble(textBox14.Text);
                _moon.Diametr  = Convert.ToDouble(textBox13.Text);
                _moon.EllipseA = Convert.ToDouble(textBox12.Text);
                _moon.EllipseB = Convert.ToDouble(textBox11.Text);
                _moon.Speed    = Convert.ToDouble(textBox2.Text);

                _planetSys = new PlanetSystem(_planet, new List <Moon>()
                {
                    _moon
                });
            }
            else
            {
                _planetSys = new PlanetSystem(_planet);
            }
            _solarSystem.Planets.Add(_planetSys);
            Application.Exit();
        }