public DtNatalChartViewModel() { Definition = new DtNatalChartDefinitionViewModel(); NatalChart = new Astro.NatalChart(); }
public Task <bool> Calculate() { NatalChart = new NatalChart(); return(Task.FromResult(true)); }
/// <summary> /// Calcul un thème natal /// </summary> public NatalChart CalculateNatalChart(NatalChartDefinition definition) { if (definition == null) { throw new ArgumentNullException(); } // Préparation du résultat NatalChart result = new NatalChart { Definition = definition }; // Initialisation du provider pour le calcul EphemerisProvider.SetTopographic(definition.PositionCenter, definition.BirthPlacePosition); EphemerisProvider.HouseSystem = definition.HouseSystem; // Calcul des dates et des temps result.DateUTC = definition.BirthDate.ToDateTimeOffset().ToUniversalTime(); result.JulianDay = EphemerisProvider.ToJulianDay(definition.BirthDate); result.UniversalTime = EphemerisProvider.ToUniversalTime(result.JulianDay); result.EphemerisTime = EphemerisProvider.ToEphemerisTime(result.JulianDay); result.SideralTime = EphemerisProvider.ToSideralTime(result.JulianDay, definition.BirthPlacePosition.Longitude); // Calculs var enValues = EphemerisProvider.CalcEclipticNutation(result.EphemerisTime); result.TrueEclipticObliquity = enValues.TrueEclipticObliquity; result.MeanEclipticObliquity = enValues.MeanEclipticObliquity; result.NutationLongitude = enValues.NutationLongitude; result.NutationObliquity = enValues.NutationObliquity; // Planets foreach (var planet in definition.Planets) { if (planet == Planet.EclipticNutation) { continue; } if (planet == Planet.Earth && (definition.PositionCenter == PositionCenter.Geocentric || definition.PositionCenter == PositionCenter.Topocentric)) { continue; // Exclude Earth if geo or topo } var pi = EphemerisProvider.CalcPlanet(planet, result.EphemerisTime, result.ARMC, definition.BirthPlacePosition.Longitude, result.TrueEclipticObliquity); result.Planets.Add(pi); } ///* // //* equator position * / // if (fmt.IndexOfAny("aADdQ".ToCharArray()) >= 0) { // iflag2 = iflag | SwissEph.SEFLG_EQUATORIAL; // if (ipl == SwissEph.SE_FIXSTAR) // iflgret = sweph.swe_fixstar(star, tjd_et, iflag2, xequ, ref serr); // else // iflgret = sweph.swe_calc(tjd_et, ipl, iflag2, xequ, ref serr); // } // //* ecliptic cartesian position * / // if (fmt.IndexOfAny("XU".ToCharArray()) >= 0) { // iflag2 = iflag | SwissEph.SEFLG_XYZ; // if (ipl == SwissEph.SE_FIXSTAR) // iflgret = sweph.swe_fixstar(star, tjd_et, iflag2, xcart, ref serr); // else // iflgret = sweph.swe_calc(tjd_et, ipl, iflag2, xcart, ref serr); // } // //* equator cartesian position * / // if (fmt.IndexOfAny("xu".ToCharArray()) >= 0) { // iflag2 = iflag | SwissEph.SEFLG_XYZ | SwissEph.SEFLG_EQUATORIAL; // if (ipl == SwissEph.SE_FIXSTAR) // iflgret = sweph.swe_fixstar(star, tjd_et, iflag2, xcartq, ref serr); // else // iflgret = sweph.swe_calc(tjd_et, ipl, iflag2, xcartq, ref serr); // } // spnam = se_pname; // */ // Houses var houses = EphemerisProvider.CalcHouses(result.JulianDay, definition.BirthPlacePosition.Latitude, definition.BirthPlacePosition.Longitude, result.AscMcs); result.Houses.AddRange(houses); return(result); }