Example #1
0
        /// <summary>
        /// In place time slip
        /// </summary>
        /// <param name="c">Coordinate</param>
        /// <param name="offset">hour offset</param>
        private void Local_Convert(Coordinate c, double offset)
        {
            //Find new lunar set rise times
            if (MoonSet.HasValue)
            {
                moonSet = moonSet.Value.AddHours(offset);
            }
            if (MoonRise.HasValue)
            {
                moonRise = moonRise.Value.AddHours(offset);
            }
            //Perigee
            Perigee.ConvertTo_Local_Time(offset);
            //Apogee
            Apogee.ConvertTo_Local_Time(offset);
            //Eclipse
            LunarEclipse.ConvertTo_LocalTime(offset);

            ////Solar
            if (sunSet.HasValue)
            {
                sunSet = sunSet.Value.AddHours(offset);
            }
            if (SunRise.HasValue)
            {
                sunRise = SunRise.Value.AddHours(offset);
            }
            AdditionalSolarTimes.Convert_To_Local_Time(offset);

            //Eclipse
            SolarEclipse.ConvertTo_LocalTime(offset);
            SunCalc.CalculateZodiacSign(c.GeoDate.AddHours(offset), this);
            MoonCalc.GetMoonSign(c.GeoDate.AddHours(offset), this);
        }
Example #2
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);
        }
Example #3
0
        /// <summary>
        /// Calculate moon 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 CalculateMoonData(double lat, double longi, DateTime date)
        {
            Celestial c = new Celestial(false);

            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);
            }
        }
Example #5
0
        /// <summary>
        /// Calculate moon 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 CalculateMoonData(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);

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

            return(c);
        }
Example #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);
        }
Example #7
0
        public static Celestial CalculateMoonData(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);

            MoonCalc.GetMoonTimes(date, lat, longi, c, 0);
            MoonCalc.GetMoonDistance(date, c);
            MoonCalc.GetMoonSign(date, c);
            MoonCalc.GetMoonIllumination(date, c, lat, longi, new EagerLoad(), 0);

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

            return(c);
        }
Example #8
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);
            SunCalc.CalculateAdditionSolarTimes(date, longi, lat, c);

            return(c);
        }
Example #9
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);
        }
Example #10
0
        /// <summary>
        /// In place time slip
        /// </summary>
        /// <param name="c">Coordinate</param>
        /// <param name="offset">hour offset</param>
        /// <param name="el">Celestial EagerLoad Option</param>
        private void Local_Convert(Coordinate c, double offset, Celestial_EagerLoad el)
        {
            //Find new lunar set rise times
            if (el == Celestial_EagerLoad.All || el == Celestial_EagerLoad.Lunar)
            {
                if (MoonSet.HasValue)
                {
                    moonSet = moonSet.Value.AddHours(offset);
                }
                if (MoonRise.HasValue)
                {
                    moonRise = moonRise.Value.AddHours(offset);
                }

                Perigee.ConvertTo_Local_Time(offset);
                Apogee.ConvertTo_Local_Time(offset);
                LunarEclipse.ConvertTo_LocalTime(offset);
                MoonCalc.GetMoonSign(c.GeoDate.AddHours(offset), this);
            }

            ////Solar
            if (el == Celestial_EagerLoad.All || el == Celestial_EagerLoad.Solar)
            {
                if (sunSet.HasValue)
                {
                    sunSet = sunSet.Value.AddHours(offset);
                }
                if (SunRise.HasValue)
                {
                    sunRise = SunRise.Value.AddHours(offset);
                }
                AdditionalSolarTimes.Convert_To_Local_Time(offset);

                //Eclipse
                SolarEclipse.ConvertTo_LocalTime(offset);
                SunCalc.CalculateZodiacSign(c.GeoDate.AddHours(offset), this);
            }
        }
Example #11
0
 /// <summary>
 /// Returns Perigee object containing last and next perigees based on the specified UTC date.
 /// </summary>
 /// <param name="d">DateTime</param>
 /// <returns>Perigee</returns>
 /// <example>
 /// The following example gets the last and next lunar perigees from the specified date
 /// and display's their DateTime and Distance.
 /// <code>
 /// Perigee perigee = Celestial.GetPerigees(new DateTime(2019, 3, 1));
 ///
 /// Console.WriteLine(perigee.LastPerigee.Date + " " + perigee.LastPerigee.Distance.Kilometers); //2/19/2019 9:06:55 AM 356762.812526435
 /// Console.WriteLine(perigee.NextPerigee.Date + " " + perigee.NextPerigee.Distance.Kilometers); //3/19/2019 7:48:22 PM 359378.005775414
 /// </code>
 /// </example>
 public static Perigee GetPerigees(DateTime d)
 {
     return(MoonCalc.GetPerigeeEvents(d));
 }
Example #12
0
 /// <summary>
 /// Returns Apogee object containing last and next apogees based on the specified UTC date.
 /// </summary>
 /// <param name="d">DateTime</param>
 /// <returns>Apogee</returns>
 /// <example>
 /// The following example gets the last and next lunar apogees from the specified date
 /// and display's their DateTime and Distance.
 /// <code>
 /// Apogee apogee = Celestial.GetApogees(new DateTime(2019,3,1));
 ///
 /// Console.WriteLine(apogee.LastApogee.Date + " " + apogee.LastApogee.Distance.Kilometers); //2/5/2019 9:27:28 AM 406551.526207563
 /// Console.WriteLine(apogee.NextApogee.Date + " " + apogee.NextApogee.Distance.Kilometers); //3/4/2019 11:26:35 AM 406387.933655865
 /// </code>
 /// </example>
 public static Apogee GetApogees(DateTime d)
 {
     return(MoonCalc.GetApogeeEvents(d));
 }
Example #13
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);
 }