Ejemplo n.º 1
0
        public CalculationBase(AstroPlace locationData, bool IsWithDetails)
        {
            NakathEndDateTime = null;
            ThithiEndDateTime = null;
            KarnaEndDateTime  = null;
            YogaEndDateTime   = null;
            swissEph.swe_set_topo(locationData.Longitude, locationData.Latitude, 0.0);

            DateTime dateTime = locationData.BirthDateTime;

            LocationData    = locationData;
            CurrentDateTime = dateTime;
            Year            = dateTime.Year;
            Month           = dateTime.Month;
            Day             = dateTime.Day;
            Hour            = dateTime.Hour;
            Minute          = dateTime.Minute;
            Second          = dateTime.Second;
            List <AstroPlanet> pList = (IsWithDetails)? CalculatePlanetPositionWithDetailsOptmized():CalculatePlanetPosition();

            Sun     = pList.Find(x => x.Current == EnumPlanet.Sun);
            Moon    = pList.Find(x => x.Current == EnumPlanet.Moon);
            Mars    = pList.Find(x => x.Current == EnumPlanet.Mars);
            Mercury = pList.Find(x => x.Current == EnumPlanet.Mercury);
            Jupiter = pList.Find(x => x.Current == EnumPlanet.Jupiter);
            Venus   = pList.Find(x => x.Current == EnumPlanet.Venus);
            Saturn  = pList.Find(x => x.Current == EnumPlanet.Saturn);
            Uranus  = pList.Find(x => x.Current == EnumPlanet.Uranus);
            Neptune = pList.Find(x => x.Current == EnumPlanet.Neptune);
            Pluto   = pList.Find(x => x.Current == EnumPlanet.Pluto);
            Rahu    = pList.Find(x => x.Current == EnumPlanet.Rahu);
            Kethu   = pList.Find(x => x.Current == EnumPlanet.Kethu);

            Nakath         = new AstroNakath(this.Moon.Longitude);
            Nakath.EndTime = NakathEndDateTime;
            WeekDay        = new AstroWeekDay((EnumWeekDay)((int)dateTime.DayOfWeek + 1));
            Thithi         = new AstroThithi(new AstroThithi(EnumThithi.Amavasya).ofDeg(this.Sun.Longitude, this.Moon.Longitude));
            Thithi.EndTime = ThithiEndDateTime;
            Yoga           = new AstroYoga(new AstroYoga(EnumYoga.Shula).ofDeg(this.Sun.Longitude, this.Moon.Longitude));
            Yoga.EndTime   = YogaEndDateTime;
            Karna          = new AstroKarna(new AstroKarna(EnumKarana.Balava).ofDeg(this.Sun.Longitude, this.Moon.Longitude));
            Karna.EndTime  = KarnaEndDateTime;

            Horoscope = CalculateHoroscope(pList);
            Horoscope.ExtraDetails = new BirthRasiExtra(Horoscope);
            Horoscope.ExtraDetails.ThithiNumber = Thithi.Current;
            Horoscope.ExtraDetails.IsPura       = (Thithi.ThithiPaksha == EnumPaksha.Krishna);
            Horoscope.Nakath = Nakath;

            Init();
        }
Ejemplo n.º 2
0
        private void NakathEndTime(double[] cusps, double orgMoonLong)
        {
            double      nakathEnd  = Math.Truncate(orgMoonLong / AstroConsts.NakLength) * AstroConsts.NakLength + AstroConsts.NakLength;
            AstroNakath tempNak    = new AstroNakath(cusps[0]);
            AstroNakath currentNak = new AstroNakath(orgMoonLong);

            if (currentNak.Current != tempNak.Current)
            {
                double nakTimeDif = ((cusps[0] - nakathEnd) / ((cusps[3] == 0) ? 1 : cusps[3])) * 1440 * -1;
                if (NakathEndDateTime == null)
                {
                    NakathEndDateTime = TimeData.JulianToDateTime(tjd_ut, LocationData.TimeZone).AddMinutes(nakTimeDif);
                }
            }
        }