// CONSTRUCTEUR public MoonAndPlanet(CorpsSystemeSolaire a_planet, PlanetSelection a_Selection, double a_phase = -100, double a_magnitude = -100) { Planet = a_planet; Selection = a_Selection; Phase = a_phase; Magnitude = a_magnitude; }
// Methode permettant de calculer les corps célestes public void Compute() { //PositionTemps positionTemps = new PositionTemps(App.ObservationPointsViewModel.LieuObservationSelectionne.LieuObservation, DateTime.Now.AddHours(1 + ComputeHourChange(DateTime.Now)), 1, ComputeHourChange(DateTime.Now)); PositionTemps positionTemps = new PositionTemps(App.ObservationPointsViewModel.LieuObservationSelectionne.LieuObservation, DateTime.Now, 1, ComputeHourChange(DateTime.Now)); for (int i = 0; i < App.PlanetSelectionViewModel.SelectedPlanets.Count; i++) { CorpsSystemeSolaire c = null; double phase = -100; double magnitude = -100; switch (App.PlanetSelectionViewModel.SelectedPlanets[i].Name) { case "La Lune": c = new Lune(); ((Lune)c).CalculerIteratif(positionTemps); phase = ((Lune)c).Phase; break; case "Mercure": c = new Planete(App.PlanetSelectionViewModel.SelectedPlanets[i].Name, TypeCorpsCeleste.MERCURE); ((Planete)c).CalculerIteratif(positionTemps); phase = ((Planete)c).Phase; magnitude = c.AltitudeTopocentrique.Decimale < 0 ? ((Planete)c).Magnitude : ((Planete)c).Magnitude + ((Planete)c).DeltaMagnitude; break; case "Venus": c = new Planete(App.PlanetSelectionViewModel.SelectedPlanets[i].Name, TypeCorpsCeleste.VENUS); ((Planete)c).CalculerIteratif(positionTemps); phase = ((Planete)c).Phase; magnitude = c.AltitudeTopocentrique.Decimale < 0 ? ((Planete)c).Magnitude : ((Planete)c).Magnitude + ((Planete)c).DeltaMagnitude; break; case "Mars": c = new Planete(App.PlanetSelectionViewModel.SelectedPlanets[i].Name, TypeCorpsCeleste.MARS); ((Planete)c).CalculerIteratif(positionTemps); magnitude = c.AltitudeTopocentrique.Decimale < 0 ? ((Planete)c).Magnitude : ((Planete)c).Magnitude + ((Planete)c).DeltaMagnitude; break; case "Jupiter": c = new Planete(App.PlanetSelectionViewModel.SelectedPlanets[i].Name, TypeCorpsCeleste.JUPITER); ((Planete)c).CalculerIteratif(positionTemps); magnitude = c.AltitudeTopocentrique.Decimale < 0 ? ((Planete)c).Magnitude : ((Planete)c).Magnitude + ((Planete)c).DeltaMagnitude; break; case "Saturne": c = new Planete(App.PlanetSelectionViewModel.SelectedPlanets[i].Name, TypeCorpsCeleste.SATURNE); ((Planete)c).CalculerIteratif(positionTemps); magnitude = c.AltitudeTopocentrique.Decimale < 0 ? ((Planete)c).Magnitude : ((Planete)c).Magnitude + ((Planete)c).DeltaMagnitude; break; case "Uranus": c = new Planete(App.PlanetSelectionViewModel.SelectedPlanets[i].Name, TypeCorpsCeleste.URANUS); ((Planete)c).CalculerIteratif(positionTemps); magnitude = c.AltitudeTopocentrique.Decimale < 0 ? ((Planete)c).Magnitude : ((Planete)c).Magnitude + ((Planete)c).DeltaMagnitude; break; case "Neptune": c = new Planete(App.PlanetSelectionViewModel.SelectedPlanets[i].Name, TypeCorpsCeleste.NEPTUNE); ((Planete)c).CalculerIteratif(positionTemps); magnitude = c.AltitudeTopocentrique.Decimale < 0 ? ((Planete)c).Magnitude : ((Planete)c).Magnitude + ((Planete)c).DeltaMagnitude; break; } MoonAndPlanet moonAndPlanet = new MoonAndPlanet(c, App.PlanetSelectionViewModel.SelectedPlanets[i], phase, magnitude); if (App.PlanetSelectionViewModel.SelectedPlanets[i].IsSelected) { MoonAndPlanetsList.Add(moonAndPlanet); } } }