Beispiel #1
0
        /// <summary>
        /// Calculates all celestial data. Coordinates will notify as changes occur
        /// </summary>
        /// <param name="lat">Decimal format latitude</param>
        /// <param name="longi">Decimal format longitude</param>
        /// <param name="date">Geographic DateTime</param>
        /// <param name="el">EagerLoading Info for Auto-Calculations</param>
        internal void CalculateCelestialTime(double lat, double longi, DateTime date, EagerLoad el)
        {
            date = new DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, DateTimeKind.Utc);


            SunCalc.CalculateSunTime(lat, longi, date, this, el);


            if (el.Extensions.Lunar_Cycle)
            {
                MoonCalc.GetMoonTimes(date, lat, longi, this);
                MoonCalc.GetMoonDistance(date, this);


                perigee = MoonCalc.GetPerigeeEvents(date);
                apogee  = MoonCalc.GetApogeeEvents(date);
            }
            MoonCalc.GetMoonIllumination(date, this, lat, longi, el);

            if (el.Extensions.Zodiac)
            {
                SunCalc.CalculateZodiacSign(date, this);
                MoonCalc.GetMoonSign(date, this);
            }

            Calculate_Celestial_IsUp_Booleans(date, this);
        }
Beispiel #2
0
        /// <summary>
        /// Calculate sun data based on lat/long and date
        /// </summary>
        /// <param name="lat">Decimal format latitude</param>
        /// <param name="longi">Decimal format longitude</param>
        /// <param name="date">Geographic DateTime</param>
        /// <returns>Partially populated Celestial Object</returns>
        public static Celestial CalculateSunData(double lat, double longi, DateTime date)
        {
            Celestial c = new Celestial(false);

            SunCalc.CalculateSunTime(lat, longi, date, c);

            return(c);
        }
Beispiel #3
0
        /// <summary>
        /// Calculate celestial data based on lat/long and date
        /// </summary>
        /// <param name="lat">Decimal format latitude</param>
        /// <param name="longi">Decimal format longitude</param>
        /// <param name="date">Geographic DateTime</param>
        /// <returns>Fully populated Celestial object</returns>
        public static Celestial CalculateCelestialTimes(double lat, double longi, DateTime date)
        {
            Celestial c = new Celestial(false);

            SunCalc.CalculateSunTime(lat, longi, date, c);
            MoonCalc.GetMoonTimes(date, lat, longi, c);
            MoonCalc.GetMoonIllumination(date, c);
            return(c);
        }
        /// <summary>
        /// Calculates all celestial data. Coordinates will notify as changes occur
        /// </summary>
        /// <param name="lat">Decimal format latitude</param>
        /// <param name="longi">Decimal format longitude</param>
        /// <param name="date">Geographic DateTime</param>
        /// <param name="el">EagerLoading Info for Auto-Calculations</param>
        /// <param name="offset">UTC offset in hours</param>
        internal void CalculateCelestialTime(double lat, double longi, DateTime date, EagerLoad el, double offset)
        {
            if (offset < -12 || offset > 12)
            {
                throw new ArgumentOutOfRangeException("Time offsets cannot be greater than 12 or less than -12.");
            }

            date = new DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, DateTimeKind.Utc);

            if (el.Extensions.Solar_Cycle || el.Extensions.Solar_Eclipse)
            {
                SunCalc.CalculateSunTime(lat, longi, date, this, el, offset);
            }
            if (el.Extensions.Lunar_Cycle)
            {
                MoonCalc.GetMoonTimes(date, lat, longi, this, offset);
                MoonCalc.GetMoonDistance(date, this, offset);


                perigee = MoonCalc.GetPerigeeEvents(date);
                apogee  = MoonCalc.GetApogeeEvents(date);

                //Shift perigee / apogee is working outside UTC
                if (offset != 0)
                {
                    perigee.ConvertTo_Local_Time(offset);
                    apogee.ConvertTo_Local_Time(offset);
                }
            }

            if (el.Extensions.Lunar_Cycle || el.Extensions.Zodiac || el.Extensions.Lunar_Eclipse)
            {
                MoonCalc.GetMoonIllumination(date, this, lat, longi, el, offset);
            }

            if (el.Extensions.Zodiac)
            {
                SunCalc.CalculateZodiacSign(date, this);
                MoonCalc.GetMoonSign(date, this);
            }

            if (el.Extensions.Lunar_Cycle || el.Extensions.Solar_Cycle)
            {
                Calculate_Celestial_IsUp_Booleans(date, this);
            }

            //Shift eclipses if eagerloaded and offset is not 0
            if (el.Extensions.Lunar_Eclipse && offset != 0)
            {
                lunarEclipse.ConvertTo_LocalTime(offset);
            }
            if (el.Extensions.Solar_Eclipse && offset != 0)
            {
                solarEclipse.ConvertTo_LocalTime(offset);
            }
        }
Beispiel #5
0
        /// <summary>
        /// Calculate sun data based on latitude, longitude and UTC date at the location.
        /// </summary>
        /// <param name="lat">latitude</param>
        /// <param name="longi">longitude</param>
        /// <param name="date">DateTime</param>
        /// <returns>Celestial (Partially Populated)</returns>
        /// <example>
        /// The following example demonstrates how to create a partially populated Celestial object
        /// that only calculates solar data using static functions.
        /// <code>
        /// //Get Celestial data at N 39, W 72 on 19-Mar-2019 10:10:12 UTC
        /// Celestial cel = Celestial.CalculateSunData(39, -72, new DateTime(2019, 3, 19, 10, 10, 12));
        ///
        /// Console.WriteLine(cel.SunRise); //3/19/2019 10:54:50 AM
        /// </code>
        /// </example>
        public static Celestial CalculateSunData(double lat, double longi, DateTime date)
        {
            date = new DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, DateTimeKind.Utc);

            Celestial c = new Celestial(false);

            SunCalc.CalculateSunTime(lat, longi, date, c, new EagerLoad());
            SunCalc.CalculateZodiacSign(date, c);

            return(c);
        }
Beispiel #6
0
        /// <summary>
        /// Calculates all celestial data. Coordinates will notify as changes occur
        /// </summary>
        /// <param name="lat">Decimal format latitude</param>
        /// <param name="longi">Decimal format longitude</param>
        /// <param name="date">Geographic DateTime</param>
        internal void CalculateCelestialTime(double lat, double longi, DateTime date)
        {
            date = new DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, DateTimeKind.Utc);
            SunCalc.CalculateSunTime(lat, longi, date, this);
            MoonCalc.GetMoonTimes(date, lat, longi, this);
            MoonCalc.GetMoonDistance(date, this);


            SunCalc.CalculateZodiacSign(date, this);
            MoonCalc.GetMoonSign(date, this);

            MoonCalc.GetMoonIllumination(date, this, lat, longi);

            SunCalc.CalculateAdditionSolarTimes(date, longi, lat, this);
        }
Beispiel #7
0
        /// <summary>
        /// Calculate celestial data based on lat/long and utc date
        /// </summary>
        /// <param name="lat">Decimal format latitude</param>
        /// <param name="longi">Decimal format longitude</param>
        /// <param name="date">Geographic DateTime</param>
        /// <returns>Fully populated Celestial object</returns>
        public static Celestial CalculateCelestialTimes(double lat, double longi, DateTime date)
        {
            date = new DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, DateTimeKind.Utc);

            Celestial c = new Celestial(false);

            SunCalc.CalculateSunTime(lat, longi, date, c);
            MoonCalc.GetMoonTimes(date, lat, longi, c);
            MoonCalc.GetMoonDistance(date, c);
            SunCalc.CalculateZodiacSign(date, c);
            MoonCalc.GetMoonSign(date, c);
            MoonCalc.GetMoonIllumination(date, c, lat, longi);
            SunCalc.CalculateAdditionSolarTimes(date, longi, lat, c);

            return(c);
        }
Beispiel #8
0
        /// <summary>
        /// Calculate celestial data based on lat/long and date.
        /// </summary>
        /// <param name="lat">Decimal format latitude</param>
        /// <param name="longi">Decimal format longitude</param>
        /// <param name="date">Geographic DateTime</param>
        /// <returns>Fully populated Celestial object</returns>
        public static Celestial CalculateCelestialTimes(double lat, double longi, DateTime date)
        {
            date = new DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, DateTimeKind.Utc);

            Celestial c = new Celestial(false);

            SunCalc.CalculateSunTime(lat, longi, date, c);
            MoonCalc.GetMoonTimes(date, lat, longi, c);
            MoonCalc.GetMoonDistance(date, c);
            SunCalc.CalculateZodiacSign(date, c);
            MoonCalc.GetMoonSign(date, c);
            MoonCalc.GetMoonIllumination(date, c, lat, longi);

            c.perigee = MoonCalc.GetPerigeeEvents(date);
            c.apogee  = MoonCalc.GetApogeeEvents(date);

            Calculate_Celestial_IsUp_Booleans(date, c);

            return(c);
        }
Beispiel #9
0
 /// <summary>
 /// Calculates all celestial data. Coordinates will notify as changes occur
 /// </summary>
 /// <param name="lat">Decimal format latitude</param>
 /// <param name="longi">Decimal format longitude</param>
 /// <param name="date">Geographic DateTime</param>
 public void CalculateCelestialTime(double lat, double longi, DateTime date)
 {
     SunCalc.CalculateSunTime(lat, longi, date, this);
     MoonCalc.GetMoonTimes(date, lat, longi, this);
     MoonCalc.GetMoonIllumination(date, this);
 }