Esempio n. 1
0
        public DateEvents(DateTimeOffset date)
        {
            try
            {
                if (date.TimeOfDay == TimeSpan.Zero && date.Offset == TimeSpan.Zero)
                {
                    Date = date;
                }
                else
                {
                    Date = new DateTimeOffset(date.UtcDateTime.Date, TimeSpan.Zero);
                }

                MatchRules during = new MatchRules(Date, SearchMode.WithinTheDay);
                Relations = Ephemeris.RelationsWithin(during);

                Positions = new Dictionary <PlanetId, PlanetEvents>();

                for (PlanetId id = PlanetId.SE_SUN; id <= PlanetId.SE_PLUTO; id++)
                {
                    Positions.Add(id, new PlanetEvents(TheEphemeris, Date, id));
                }
                Positions.Add(PlanetId.SE_NORTHNODE, new PlanetEvents(TheEphemeris, Date, PlanetId.SE_NORTHNODE));
                Positions.Add(PlanetId.SE_CHIRON, new PlanetEvents(TheEphemeris, Date, PlanetId.SE_CHIRON));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                Console.WriteLine(ex.Message);
            }
        }
Esempio n. 2
0
        public static List <Relation> RelationsWithin(MatchRules period, PlanetId oneParty)
        {
            DateTimeOffset startDate = period.Since.UtcDateTime.Date;
            DateTimeOffset endDate   = period.Until.UtcDateTime.Date;

            List <Relation> allRelations = new List <Relation>();

            for (DateTimeOffset date = startDate; date < endDate; date += TimeSpan.FromDays(1))
            {
                allRelations.AddRange(RelationsOn(date, oneParty));
            }

            if (endDate - startDate <= TimeSpan.FromDays(1))
            {
                return(allRelations);
            }

            allRelations = Optimize(allRelations);

            return(allRelations);
        }