Esempio n. 1
0
 public Characteristics(Galaxy gal, SolarSystem solar)
 {
     try
     {
         _solarSys = solar;
         _galaxy   = gal;
         InitializeComponent();
         //Printting Sun
         textBox1.Text = _solarSys.Name;
         textBox3.Text = "Milky Way";
         textBox2.Text = _solarSys.SunProp.Name;
         textBox4.Text = _solarSys.SunProp.Color;
         textBox5.Text = Convert.ToString(_solarSys.SunProp.Mass);
         textBox6.Text = Convert.ToString(_solarSys.SunProp.Tempertura);
         textBox7.Text = Convert.ToString(_solarSys.SunProp.Luminiosity);
         comboBox1.Items.Add("Sort by name");
         comboBox1.Items.Add("Sort by distanse from Sun");
         comboBox1.Items.Add("Sort by amount of moons");
     }
     catch (Exception e)
     {
         throw new System.Exception($"Class {this.GetType().Name}, method {System.Reflection.MethodBase.GetCurrentMethod().Name}" + e.Message);
     }
 }
Esempio n. 2
0
 public Tuple <double, double> ChangeCoordinatesOfPlanetSystemByOneDay(PlanetSystem planetSystem, SolarSystem solarSystem)
 {
     try
     {
         var oneDaydistancechanges = planetSystem.Speed * 60 * 60 * 24 / 1000000;
         var oneDayDegreeChanges   = 180 / planetSystem.OrbitalPeriod;
         var angle        = Math.PI * oneDayDegreeChanges / 180.0;
         var first_coord  = (planetSystem.ELlipseParamA * Math.Cos(planetSystem.Angle += angle));
         var second_coord = (planetSystem.ELlipseParamB * Math.Sin(planetSystem.Angle += angle));
         planetSystem.Coordinates = new Tuple <double, double>(first_coord, second_coord);
         return(planetSystem.Coordinates);
     }
     catch (Exception e)
     {
         throw new System.Exception($"Class {this.GetType().Name}, method {System.Reflection.MethodBase.GetCurrentMethod().Name}" + e.Message);
     }
 }