public double horaBala(Body.Name b) { this.verifyGraha(b); if (h.calculateHora() == b) { return(60.0); } return(0.0); }
private void ComputeEntry(double ut, double[] geopos) { int year = 0, month = 0, day = 0; double sunset = 0, hour = 0; sweph.obtainLock(h); h.populateSunrisetCacheHelper(ut - 0.5, ref sunrise, ref sunset, ref ut_sr); sweph.releaseLock(h); sweph.swe_revjul(ut_sr, ref year, ref month, ref day, ref hour); Moment moment_sr = new Moment(year, month, day, hour); Moment moment_ut = new Moment(ut, h); HoraInfo infoCurr = new HoraInfo(moment_ut, h.info.lat, h.info.lon, h.info.tz); Horoscope hCurr = new Horoscope(infoCurr, h.options); ListViewItem li = null; PanchangaLocalMoments local = new PanchangaLocalMoments(); local.sunrise = hCurr.sunrise; local.sunset = sunset; local.sunrise_ut = ut_sr; sweph.swe_revjul(ut, ref year, ref month, ref day, ref hour); local.wday = (Basics.Weekday)sweph.swe_day_of_week(ut); local.kalas_ut = hCurr.getKalaCuspsUt(); if (this.opts.CalcSpecialKalas) { Body.Name bStart = Basics.weekdayRuler(hCurr.wday); if (hCurr.options.KalaType == HoroscopeOptions.EHoraType.Lmt) { bStart = Basics.weekdayRuler(hCurr.lmt_wday); } local.rahu_kala_index = this.rahu_kalas[(int)bStart]; local.gulika_kala_index = this.gulika_kalas[(int)bStart]; local.yama_kala_index = this.yama_kalas[(int)bStart]; } if (opts.CalcLagnaCusps) { li = new ListViewItem(); sweph.obtainLock(h); BodyPosition bp_lagna_sr = Basics.CalculateSingleBodyPosition(ut_sr, sweph.BodyNameToSweph(Body.Name.Lagna), Body.Name.Lagna, BodyType.Name.Lagna, h); DivisionPosition dp_lagna_sr = bp_lagna_sr.toDivisionPosition(new Division(Basics.DivisionType.Rasi)); local.lagna_zh = dp_lagna_sr.zodiac_house.value; Longitude bp_lagna_base = new Longitude(bp_lagna_sr.longitude.toZodiacHouseBase()); double ut_transit = ut_sr; for (int i = 1; i <= 12; i++) { Retrogression r = new Retrogression(h, Body.Name.Lagna); ut_transit = r.GetLagnaTransitForward(ut_transit, bp_lagna_base.add(i * 30.0)); PanchangaMomentInfo pmi = new PanchangaMomentInfo( ut_transit, (int)bp_lagna_sr.longitude.toZodiacHouse().add(i + 1).value); local.lagnas_ut.Add(pmi); } sweph.releaseLock(h); } if (opts.CalcTithiCusps) { Transit t = new Transit(h); sweph.obtainLock(h); Tithi tithi_start = t.LongitudeOfTithi(ut_sr).toTithi(); Tithi tithi_end = t.LongitudeOfTithi(ut_sr + 1.0).toTithi(); Tithi tithi_curr = tithi_start.add(1); local.tithi_index_start = globals.tithis_ut.Count - 1; local.tithi_index_end = globals.tithis_ut.Count - 1; while (tithi_start.value != tithi_end.value && tithi_curr.value != tithi_end.value) { tithi_curr = tithi_curr.add(2); double dLonToFind = ((double)(int)tithi_curr.value - 1) * (360.0 / 30.0); double ut_found = t.LinearSearchBinary(ut_sr, ut_sr + 1.0, new Longitude(dLonToFind), new ReturnLon(t.LongitudeOfTithiDir)); globals.tithis_ut.Add(new PanchangaMomentInfo(ut_found, (int)tithi_curr.value)); local.tithi_index_end++; } sweph.releaseLock(h); } if (opts.CalcKaranaCusps) { Transit t = new Transit(h); sweph.obtainLock(h); Karana karana_start = t.LongitudeOfTithi(ut_sr).toKarana(); Karana karana_end = t.LongitudeOfTithi(ut_sr + 1.0).toKarana(); Karana karana_curr = karana_start.add(1); local.karana_index_start = globals.karanas_ut.Count - 1; local.karana_index_end = globals.karanas_ut.Count - 1; while (karana_start.value != karana_end.value && karana_curr.value != karana_end.value) { karana_curr = karana_curr.add(2); double dLonToFind = ((double)(int)karana_curr.value - 1) * (360.0 / 60.0); double ut_found = t.LinearSearchBinary(ut_sr, ut_sr + 1.0, new Longitude(dLonToFind), new ReturnLon(t.LongitudeOfTithiDir)); globals.karanas_ut.Add(new PanchangaMomentInfo(ut_found, (int)karana_curr.value)); local.karana_index_end++; } sweph.releaseLock(h); } if (opts.CalcSMYogaCusps) { Transit t = new Transit(h); sweph.obtainLock(h); SunMoonYoga sm_start = t.LongitudeOfSunMoonYoga(ut_sr).toSunMoonYoga(); SunMoonYoga sm_end = t.LongitudeOfSunMoonYoga(ut_sr + 1.0).toSunMoonYoga(); SunMoonYoga sm_curr = sm_start.add(1); local.smyoga_index_start = globals.smyogas_ut.Count - 1; local.smyoga_index_end = globals.smyogas_ut.Count - 1; while (sm_start.value != sm_end.value && sm_curr.value != sm_end.value) { sm_curr = sm_curr.add(2); double dLonToFind = ((double)(int)sm_curr.value - 1) * (360.0 / 27); double ut_found = t.LinearSearchBinary(ut_sr, ut_sr + 1.0, new Longitude(dLonToFind), new ReturnLon(t.LongitudeOfSunMoonYogaDir)); globals.smyogas_ut.Add(new PanchangaMomentInfo(ut_found, (int)sm_curr.value)); local.smyoga_index_end++; } sweph.releaseLock(h); } if (opts.CalcNakCusps) { bool bDiscard = true; Transit t = new Transit(h, Body.Name.Moon); sweph.obtainLock(h); Nakshatra nak_start = t.GenericLongitude(ut_sr, ref bDiscard).toNakshatra(); Nakshatra nak_end = t.GenericLongitude(ut_sr + 1.0, ref bDiscard).toNakshatra(); local.nakshatra_index_start = globals.nakshatras_ut.Count - 1; local.nakshatra_index_end = globals.nakshatras_ut.Count - 1; Nakshatra nak_curr = nak_start.add(1); while (nak_start.value != nak_end.value && nak_curr.value != nak_end.value) { nak_curr = nak_curr.add(2); double dLonToFind = ((double)((int)nak_curr.value - 1)) * (360.0 / 27.0); double ut_found = t.LinearSearchBinary(ut_sr, ut_sr + 1.0, new Longitude(dLonToFind), new ReturnLon(t.GenericLongitude)); globals.nakshatras_ut.Add(new PanchangaMomentInfo(ut_found, (int)nak_curr.value)); Console.WriteLine("Found nakshatra {0}", nak_curr.value); local.nakshatra_index_end++; } sweph.releaseLock(h); } if (opts.CalcHoraCusps) { local.horas_ut = hCurr.getHoraCuspsUt(); hCurr.calculateHora(ut_sr + 1.0 / 24.0, ref local.hora_base); } if (opts.CalcKalaCusps) { hCurr.calculateKala(ref local.kala_base); } this.locals.Add(local); this.DisplayEntry(local); }
private void PrintCoverPage(PrintPageEventArgs e) { g = e.Graphics; left = e.MarginBounds.Left; top = e.MarginBounds.Top; width = e.MarginBounds.Width; DivisionalChart dc_rasi = new DivisionalChart(h); dc_rasi.PrintMode = true; DivisionalChart dc_nav = new DivisionalChart(h); dc_nav.options.Varga = new Division(Basics.DivisionType.Navamsa); dc_nav.PrintMode = true; dc_nav.SetOptions(dc_nav.options); // Rasi & Navamsa charts g.TranslateTransform(left, top); dc_rasi.DrawChart(g, width / 2, width / 2); g.ResetTransform(); g.TranslateTransform(left + (width / 2), top); dc_nav.DrawChart(g, width / 2, width / 2); top += (width / 2) + pad_height; // Birth Details this.PrintString(string.Format("{0} {1}. {2}. {3}, {4}.", h.wday, h.info.tob, h.info.tz, h.info.lat, h.info.lon)); // Tithi Longitude ltithi = h.getPosition(Body.Name.Moon).longitude.sub(h.getPosition(Body.Name.Sun).longitude); double offset = (360.0 / 30.0) - ltithi.toTithiOffset(); Tithi ti = ltithi.toTithi(); this.PrintString(String.Format("Tithi: {0} {1:N}% left", ti.value, offset / 12.0 * 100)); // Nakshatra Longitude lmoon = h.getPosition(Body.Name.Moon).longitude; Nakshatra nmoon = lmoon.toNakshatra(); offset = (360.0 / 27.0) - lmoon.toNakshatraOffset(); int pada = lmoon.toNakshatraPada(); this.PrintString(String.Format("Nakshatra: {0} {1} {2:N}% left", nmoon.value, pada, offset / (360.0 / 27.0) * 100)); // Yoga, Hora Longitude smLon = h.getPosition(Body.Name.Sun).longitude.add(h.getPosition(Body.Name.Moon).longitude); SunMoonYoga smYoga = smLon.toSunMoonYoga(); Body.Name bHora = h.calculateHora(); this.PrintString(string.Format("{0} Yoga, {1} Hora", smYoga.value, bHora)); top += pad_height; // Calculation Details foreach (BodyPosition bp in h.positionList) { switch (bp.type) { case BodyType.Name.Graha: case BodyType.Name.Lagna: case BodyType.Name.SpecialLagna: case BodyType.Name.Upagraha: this.PrintBody(bp); break; } } top = e.MarginBounds.Top + (width / 2) + pad_height + f.Height; left = e.MarginBounds.Left + (width / 2); // Vimsottari Dasa VimsottariDasa vd = new VimsottariDasa(h); vd.options.SeedBody = VimsottariDasa.UserOptions.StartBodyType.Moon; this.PrintVimDasa(vd); }