示例#1
0
        private ICollection <AstroEvent> FindLunarEclipses(AstroEventsContext context)
        {
            List <AstroEvent> events = new List <AstroEvent>();

            int ln = LunarEphem.Lunation(context.From, LunationSystem.Meeus);

            do
            {
                LunarEclipse eclipse = LunarEclipses.NearestEclipse(ln, next: true);
                double       jd      = eclipse.JulianDayMaximum;
                if (jd <= context.To)
                {
                    double jdMax           = jd;
                    string type            = Text.Get($"LunarEclipse.Type.{eclipse.EclipseType}");
                    string phase           = Formatters.Phase.Format(eclipse.Magnitude);
                    var    elements        = GetLunarEclipseElements(jdMax);
                    var    local           = LunarEclipses.LocalCircumstances(eclipse, elements, context.GeoLocation);
                    string localVisibility = GetLocalVisibilityString(eclipse, local);
                    events.Add(new AstroEvent(jdMax, Text.Get("LunarEclipse.Event", ("type", type), ("phase", phase), ("localVisibility", localVisibility)), moon));
                    ln = eclipse.MeeusLunationNumber + 1;
                }
                else
                {
                    break;
                }
            }while (true);
            return(events);
        }
示例#2
0
 /// <inheritdoc/>
 public ICollection <LunarEclipseLocalCircumstances> FindLocalCircumstancesForCities(LunarEclipse e, PolynomialLunarEclipseElements be, ICollection <CrdsGeographical> cities, CancellationToken?cancelToken = null, IProgress <double> progress = null)
 {
     return(cities
            .Distinct()
            .Select(c => LunarEclipses.LocalCircumstances(e, be, c))
            .ToArray());
 }