示例#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();
        }
示例#2
0
        private void YogaEndTime(double[] cusps, AstroPlanet curSun, double orgSunLong, double orgMoonLong, Mod mod360)
        {
            double    yogaEnd     = Math.Truncate(mod360.add(orgMoonLong, orgSunLong) / AstroConsts.YogaLength) * AstroConsts.YogaLength + AstroConsts.YogaLength;
            AstroYoga tempYoga    = new AstroYoga(new AstroYoga(EnumYoga.Shula).ofDeg(curSun.Longitude, cusps[0]));
            AstroYoga currentYoga = new AstroYoga(new AstroYoga(EnumYoga.Shula).ofDeg(orgSunLong, orgMoonLong));

            if (currentYoga.Current != tempYoga.Current)
            {
                double totalSpeed  = curSun.SpeedInLongitude + cusps[3];
                double yogaTimeDif = ((mod360.add(cusps[0], curSun.Longitude) - yogaEnd) / ((totalSpeed == 0) ? 1 : totalSpeed)) * 1440 * -1;
                if (YogaEndDateTime == null)
                {
                    YogaEndDateTime = TimeData.JulianToDateTime(tjd_ut, LocationData.TimeZone).AddMinutes(yogaTimeDif);
                }
            }
        }