Пример #1
0
        /// <summary>
        /// 30
        /// </summary>
        /// <returns></returns>
        public CheckResult MoonIsStrong()
        {
            ResultTypes result = ResultTypes.TRUE;

            if (!Input.DoCheckMoonStength)
            {
                return(new CheckResult(string.Empty, result));
            }

            int[] moonNotPos          = new int[] { 6, 8, 12 };
            EnumRelationshipTypes rel = BirthDate.Nakath.RelationshipWith(TransitDate.Moon.Nakatha);

            if (rel == EnumRelationshipTypes.Prathyaari || rel == EnumRelationshipTypes.Vada || rel == EnumRelationshipTypes.Vipath)
            {
                IsThisValidResult    = false;
                ReasonToMakeInvalid += "-Moon is not strong\r\n";
                return(new CheckResult("Moon ocupy a bad Nakath", ResultTypes.FALSE));
            }
            if (moonNotPos.Contains(TransitDate.Moon.HouseNumber))
            {
                IsThisValidResult    = false;
                ReasonToMakeInvalid += "-Moon is not strong\r\n";
                return(new CheckResult(string.Format("Moon in {0} house of the Trasit Horoscope!", TransitDate.Moon.HouseNumber), ResultTypes.FALSE));
            }
            int moonPlace = moonNotPos.FirstOrDefault(x => BirthDate.Horoscope.RasiHouseList[x - 1].CurrentInt == TransitDate.Moon.Rasi.CurrentInt);

            if (moonPlace > 0)
            {
                IsThisValidResult    = false;
                ReasonToMakeInvalid += "-Moon is not strong\r\n";
                return(new CheckResult(string.Format("Moon in {0} house from the Birth Horoscope!", moonPlace), ResultTypes.FALSE));
            }
            AstroRasi moonRasi = TransitDate.Horoscope.RasiHouseList.FirstOrDefault(x => x.CurrentInt == TransitDate.Moon.Rasi.CurrentInt);
            string    desc     = string.Empty;

            foreach (AstroPlanet planet in moonRasi.Planets)
            {
                if (!planet.DataModel.IsGood)
                {
                    desc += planet.Name + ", ";
                }
            }
            if (!string.IsNullOrEmpty(desc))
            {
                IsThisValidResult    = false;
                ReasonToMakeInvalid += "-Moon is not strong\r\n";
                return(new CheckResult(desc.TrimEnd(',', ' ') + " with Moon", ResultTypes.FALSE));
            }
            // Ignored Bad Plant having Sapthama Drusti on Moon

            return(new CheckResult(string.Empty, ResultTypes.TRUE));
        }
Пример #2
0
        public Horoscope CalculateHoroscope(List <AstroPlanet> pList)
        {
            swissEph.swe_set_ephe_path("C:\\SWEPH\\EPHE");

            DateTime dt    = new DateTime(Year, Month, Day, Hour, Minute, Second);
            TimeData tData = new TimeData(AstroPlace.GetUniversalTime(dt, LocationData.Longitude));

            tjd_ut = tData.JulianDateTime;

            double[] cusps = new double[13];
            double[] ascmc = new double[10];
            // cusps - the end point of a house
            swissEph.swe_houses_ex(tjd_ut, SwissEph.SEFLG_SIDEREAL, LocationData.Latitude, LocationData.Longitude, 'A', cusps, ascmc);
            Horoscope horoScope = new Horoscope();
            Mod       mod       = new Mod(360);

            int lagna = 0;

            // postion starts from 1
            for (int i = 1; i < cusps.Length; i++)
            {
                if ((cusps[i] > 0) && (cusps[i] < 30))
                {
                    lagna = i;
                }
            }
            if (lagna == 0)
            {
                for (int i = 1; i < cusps.Length; i++)
                {
                    if ((cusps[i] > 0) && (cusps[i] < 35))
                    {
                        lagna = i;
                    }
                }
            }

            int j = 0;

            horoScope.RasiHouseList  = new List <AstroRasi>();
            horoScope.BhavaHouseList = new List <AstroBhava>();
            IntCircle intCycle       = new IntCircle(12, lagna);
            double    lagnaAscendant = cusps[lagna];
            double    bIncrement     = 30.0;

            while (j != 12)
            {
                // The 14 is used as the adjustment required to
                // get the right lagna integer from the lagna integer
                AstroRasi rasi = new AstroRasi((EnumRasi)intCycle.ValueMinusCurrent(14));
                rasi.AscendentDegrees            = cusps[intCycle.Current];
                rasi.AscendentDegreesFromMesha   = (intCycle.Current == 1) ? 0.0 : mod.sub(cusps[1], cusps[intCycle.Current]) + cusps[intCycle.Current];
                rasi.RasiEndDegreesFromMesha     = (intCycle.Current == 1) ? 0.0 : mod.sub(cusps[1], cusps[intCycle.Current]);
                rasi.RasiEndDegreesFromHorizon   = cusps[intCycle.Current];
                rasi.RasiStartDegreesFromMesha   = (intCycle.Previous == 1) ? 360.0 : mod.sub(cusps[1], cusps[intCycle.Previous]);
                rasi.RasiStartDegreesFromHorizon = cusps[intCycle.Previous];
                rasi.RasiMidDegreesFromMesha     = (rasi.RasiStartDegreesFromMesha + rasi.RasiEndDegreesFromMesha) / 2.0;
                rasi.LengthDegrees = mod.sub(rasi.RasiEndDegreesFromMesha, rasi.RasiStartDegreesFromMesha);
                rasi.Length        = rasi.LengthDegrees;
                rasi.HouseNumber   = j + 1;
                foreach (AstroPlanet planet in pList)
                {
                    if (planet.Longitude >= rasi.RasiEndDegreesFromMesha &&
                        planet.Longitude <= rasi.RasiStartDegreesFromMesha ||
                        ((rasi.RasiStartDegreesFromMesha < rasi.RasiEndDegreesFromMesha) &&
                         (((planet.Longitude <= rasi.RasiStartDegreesFromMesha) && (planet.Longitude >= 0)) ||
                          ((planet.Longitude >= rasi.RasiEndDegreesFromMesha) && (planet.Longitude <= 360)))))
                    {
                        planet.Rasi             = rasi;
                        planet.AjustedLongitude = mod.sub(planet.Longitude, rasi.RasiEndDegreesFromMesha);
                        rasi.Planets.Add(planet);
                        horoScope.RasiPlanetList.Add(planet);
                    }
                }
                horoScope.RasiHouseList.Add(rasi);

                AstroBhava bhava = new AstroBhava();

                Bhava30DegreeStartingFromHorizon(pList, cusps, horoScope, mod, j, bIncrement, bhava);

                if (lagna == intCycle.Current)
                {
                    horoScope.LagnaRasi   = rasi;
                    horoScope.NavamsaRasi = new AstroRasi(AstroBase.GetNawamsaRasi(rasi.AscendentDegreesFromMesha));
                }
                intCycle.GoBackward();
                j++;
                bIncrement = mod.sub(bIncrement, 30.0);
                if (j == 12)
                {
                    break;
                }
            }

            return(horoScope);
        }