public void OnRecalculate(Object o) { Division dtype = new Division(Basics.DivisionType.Rasi); BodyPosition l1 = h.getPosition(Body.Name.Lagna); BodyPosition l2 = h2.getPosition(Body.Name.Lagna); BodyPosition m1 = h.getPosition(Body.Name.Moon); BodyPosition m2 = h2.getPosition(Body.Name.Moon); ZodiacHouse z1 = m1.toDivisionPosition(dtype).zodiac_house; ZodiacHouse z2 = m2.toDivisionPosition(dtype).zodiac_house; Nakshatra n1 = m1.longitude.toNakshatra(); Nakshatra n2 = m2.longitude.toNakshatra(); this.lView.Items.Clear(); { ListViewItem li = new ListViewItem("Nakshatra Yoni"); li.SubItems.Add(KutaNakshatraYoni.getType(n1).ToString() + " (" + KutaNakshatraYoni.getSex(n1).ToString() + ")"); li.SubItems.Add(KutaNakshatraYoni.getType(n2).ToString() + " (" + KutaNakshatraYoni.getSex(n2).ToString() + ")"); lView.Items.Add(li); } { ListViewItem li = new ListViewItem("Rasi Yoni"); li.SubItems.Add(KutaRasiYoni.getType(z1).ToString()); li.SubItems.Add(KutaRasiYoni.getType(z2).ToString()); lView.Items.Add(li); } { ListViewItem li = new ListViewItem("Varna"); li.SubItems.Add(KutaVarna.getType(n1).ToString()); li.SubItems.Add(KutaVarna.getType(n2).ToString()); li.SubItems.Add(KutaVarna.getScore(n1, n2).ToString() + "/" + KutaVarna.getMaxScore().ToString()); lView.Items.Add(li); } { ListViewItem li = new ListViewItem("Gana (Chandra)"); li.SubItems.Add(KutaGana.getType(n1).ToString()); li.SubItems.Add(KutaGana.getType(n2).ToString()); li.SubItems.Add(KutaGana.getScore(n1, n2).ToString() + "/" + KutaGana.getMaxScore().ToString()); lView.Items.Add(li); } { ListViewItem li = new ListViewItem("Gana (Lagna)"); li.SubItems.Add(KutaGana.getType(l1.longitude.toNakshatra()).ToString()); li.SubItems.Add(KutaGana.getType(l2.longitude.toNakshatra()).ToString()); li.SubItems.Add(KutaGana.getScore(l1.longitude.toNakshatra(), l2.longitude.toNakshatra()).ToString() + "/" + KutaGana.getMaxScore().ToString()); lView.Items.Add(li); } { ListViewItem li = new ListViewItem("Vedha"); li.SubItems.Add(KutaVedha.getType(n1).ToString()); li.SubItems.Add(KutaVedha.getType(n2).ToString()); li.SubItems.Add(KutaVedha.getScore(n1, n2).ToString() + "/" + KutaVedha.getMaxScore().ToString()); lView.Items.Add(li); } { ListViewItem li = new ListViewItem("Rajju"); li.SubItems.Add(KutaRajju.getType(n1).ToString()); li.SubItems.Add(KutaRajju.getType(n2).ToString()); li.SubItems.Add(KutaRajju.getScore(n1, n2).ToString() + "/" + KutaRajju.getMaxScore().ToString()); lView.Items.Add(li); } { ListViewItem li = new ListViewItem("Nadi"); li.SubItems.Add(KutaNadi.getType(n1).ToString()); li.SubItems.Add(KutaNadi.getType(n2).ToString()); li.SubItems.Add(KutaNadi.getScore(n1, n2).ToString() + "/" + KutaNadi.getMaxScore().ToString()); lView.Items.Add(li); } { ListViewItem li = new ListViewItem("Gotra (TD:Abhi)"); li.SubItems.Add(KutaGotra.getType(n1).ToString()); li.SubItems.Add(KutaGotra.getType(n2).ToString()); li.SubItems.Add(KutaGotra.getScore(n1, n2).ToString() + "/" + KutaGotra.getMaxScore().ToString()); lView.Items.Add(li); } { ListViewItem li = new ListViewItem("Vihanga"); li.SubItems.Add(KutaVihanga.getType(n1).ToString()); li.SubItems.Add(KutaVihanga.getType(n2).ToString()); li.SubItems.Add(KutaVihanga.getDominator(n1, n2).ToString()); lView.Items.Add(li); } { ListViewItem li = new ListViewItem("Bhuta (Nakshatra)"); li.SubItems.Add(KutaBhutaNakshatra.getType(n1).ToString()); li.SubItems.Add(KutaBhutaNakshatra.getType(n2).ToString()); li.SubItems.Add(KutaBhutaNakshatra.getScore(n1, n2).ToString() + "/" + KutaBhutaNakshatra.getMaxScore().ToString()); lView.Items.Add(li); } { ListViewItem li = new ListViewItem("Ghataka (Moon)"); ZodiacHouse ja = h.getPosition(Body.Name.Moon).toDivisionPosition(dtype).zodiac_house; ZodiacHouse ch = h2.getPosition(Body.Name.Moon).toDivisionPosition(dtype).zodiac_house; bool isGhataka = GhatakaMoon.checkGhataka(ja, ch); li.SubItems.Add(ja.ToString()); li.SubItems.Add(ch.ToString()); li.SubItems.Add(getGhatakaString(isGhataka)); lView.Items.Add(li); } { ListViewItem li = new ListViewItem("Ghataka (Tithi)"); ZodiacHouse ja = h.getPosition(Body.Name.Moon).toDivisionPosition(dtype).zodiac_house; Longitude ltithi = h2.getPosition(Body.Name.Moon).longitude.sub(h2.getPosition(Body.Name.Sun).longitude); Tithi t = ltithi.toTithi(); bool isGhataka = GhatakaTithi.checkTithi(ja, t); li.SubItems.Add(ja.ToString()); li.SubItems.Add(t.ToString()); li.SubItems.Add(getGhatakaString(isGhataka)); lView.Items.Add(li); } { ListViewItem li = new ListViewItem("Ghataka (Day)"); ZodiacHouse ja = h.getPosition(Body.Name.Moon).toDivisionPosition(dtype).zodiac_house; Basics.Weekday wd = h2.wday; bool isGhataka = GhatakaDay.checkDay(ja, wd); li.SubItems.Add(ja.ToString()); li.SubItems.Add(wd.ToString()); li.SubItems.Add(getGhatakaString(isGhataka)); lView.Items.Add(li); } { ListViewItem li = new ListViewItem("Ghataka (Star)"); ZodiacHouse ja = h.getPosition(Body.Name.Moon).toDivisionPosition(dtype).zodiac_house; Nakshatra na = h2.getPosition(Body.Name.Moon).longitude.toNakshatra(); bool isGhataka = GhatakaStar.checkStar(ja, na); li.SubItems.Add(ja.ToString()); li.SubItems.Add(na.ToString()); li.SubItems.Add(getGhatakaString(isGhataka)); lView.Items.Add(li); } { ListViewItem li = new ListViewItem("Ghataka Lagna(S)"); ZodiacHouse ja = h.getPosition(Body.Name.Moon).toDivisionPosition(dtype).zodiac_house; ZodiacHouse sa = h2.getPosition(Body.Name.Lagna).toDivisionPosition(dtype).zodiac_house; bool isGhataka = GhatakaLagnaSame.checkLagna(ja, sa); li.SubItems.Add(ja.ToString()); li.SubItems.Add(sa.ToString()); li.SubItems.Add(getGhatakaString(isGhataka)); lView.Items.Add(li); } { ListViewItem li = new ListViewItem("Ghataka Lagna(O)"); ZodiacHouse ja = h.getPosition(Body.Name.Moon).toDivisionPosition(dtype).zodiac_house; ZodiacHouse op = h2.getPosition(Body.Name.Lagna).toDivisionPosition(dtype).zodiac_house; bool isGhataka = GhatakaLagnaOpp.checkLagna(ja, op); li.SubItems.Add(ja.ToString()); li.SubItems.Add(op.ToString()); li.SubItems.Add(getGhatakaString(isGhataka)); lView.Items.Add(li); } this.ColorAndFontRows(this.lView); }
private void PrintFirstPage(PrintPageEventArgs e) { e.HasMorePages = true; Graphics g = e.Graphics; g.ResetTransform(); g.TranslateTransform(margin_offset, header_offset); PrintTitle(g, 0, this.wday_offset + this.wday_width, "Date/Day"); PrintTitle(g, this.sunrise_offset, this.sunset_offset + this.sunset_width, "Sunrise/set"); PrintTitle(g, this.nak_name_offset, this.nak_time_offset + this.nak_time_width, "Nakshatra"); PrintTitle(g, this.tithi_name_offset, this.tithi_time_offset + this.tithi_time_width, "Tithi"); PrintTitle(g, this.karana_name_1_offset, this.karana_time_2_offset + this.karana_time_width, "Karana"); PrintTitle(g, this.sm_name_offset, this.sm_time_offset + this.sm_time_width, "SM-Yoga"); g.TranslateTransform(0, (float)(f.Height * 1.5)); int iStart = local_index; int i = local_index; while (i < locals.Count) { int numLines = 1; PanchangaLocalMoments local = (PanchangaLocalMoments)locals[i]; Moment m_sunrise = new Moment(local.sunrise_ut, h); Moment m_sunset = new Moment(0, 0, 0, local.sunset); g.DrawString(m_sunrise.ToShortDateString(), f, b, day_offset, 0); g.DrawString(Basics.weekdayToShortString(local.wday), f, b, wday_offset, 0); if (opts.ShowSunriset) { g.DrawString(m_sunrise.ToTimeString(), f, b, sunrise_offset, 0); g.DrawString(m_sunset.ToTimeString(), f, b, sunset_offset, 0); } int numTithis = local.tithi_index_end - local.tithi_index_start; int numNaks = local.nakshatra_index_end - local.nakshatra_index_start; int numSMYogas = local.smyoga_index_end - local.smyoga_index_start; int numKaranas = local.karana_index_end - local.karana_index_start; if (opts.CalcTithiCusps) { numLines = Math.Max(numLines, numTithis); for (int j = 0; j < numTithis; j++) { PanchangaMomentInfo pmi = (PanchangaMomentInfo)globals.tithis_ut[local.tithi_index_start + 1 + j]; Tithi t = new Tithi((Tithi.Name)pmi.info); Moment mTithi = new Moment(pmi.ut, h); g.DrawString(t.ToUnqualifiedString(), f, b, tithi_name_offset, j * f.Height); g.DrawString(this.utTimeToString(pmi.ut, local.sunrise_ut, local.sunrise), f, b, tithi_time_offset, j * f.Height); } } if (opts.CalcKaranaCusps) { numLines = Math.Max(numLines, (int)Math.Ceiling(numKaranas / 2.0)); for (int j = 0; j < numKaranas; j++) { PanchangaMomentInfo pmi = (PanchangaMomentInfo)globals.karanas_ut[local.karana_index_start + 1 + j]; Karana k = new Karana((Karana.Name)pmi.info); Moment mKarana = new Moment(pmi.ut, h); int jRow = (int)Math.Floor((decimal)j / 2); int name_offset = karana_name_1_offset; int time_offset = karana_time_1_offset; if (j % 2 == 1) { name_offset = karana_name_2_offset; time_offset = karana_time_2_offset; } g.DrawString(k.value.ToString(), f, b, name_offset, jRow * f.Height); g.DrawString(this.utTimeToString(pmi.ut, local.sunrise_ut, local.sunrise), f, b, time_offset, jRow * f.Height); } } if (opts.CalcNakCusps) { numLines = Math.Max(numLines, numNaks); for (int j = 0; j < numNaks; j++) { PanchangaMomentInfo pmi = (PanchangaMomentInfo)globals.nakshatras_ut[local.nakshatra_index_start + 1 + j]; Nakshatra n = new Nakshatra((Nakshatra.Name)pmi.info); Moment mNak = new Moment(pmi.ut, h); g.DrawString(n.ToString(), f, b, nak_name_offset, j * f.Height); g.DrawString(this.utTimeToString(pmi.ut, local.sunrise_ut, local.sunrise), f, b, nak_time_offset, j * f.Height); } } if (opts.CalcSMYogaCusps) { numLines = Math.Max(numLines, numSMYogas); for (int j = 0; j < numSMYogas; j++) { PanchangaMomentInfo pmi = (PanchangaMomentInfo)globals.smyogas_ut[local.smyoga_index_start + 1 + j]; SunMoonYoga sm = new SunMoonYoga((SunMoonYoga.Name)pmi.info); Moment mSMYoga = new Moment(pmi.ut, h); g.DrawString(sm.value.ToString(), f, b, sm_name_offset, j * f.Height); g.DrawString(this.utTimeToString(pmi.ut, local.sunrise_ut, local.sunrise), f, b, sm_time_offset, j * f.Height); } } #if DND string s_rahu_kala = string.Format("{0} - {1}", this.utTimeToString(local.kalas_ut[local.rahu_kala_index], local.sunrise_ut, local.sunrise), this.utTimeToString(local.kalas_ut[local.rahu_kala_index + 1], local.sunrise_ut, local.sunrise)); g.DrawString(s_rahu_kala, f, b, rahu_kala_offset, 0); #endif g.TranslateTransform(0, f.Height * numLines); local_index = ++i; if (g.Transform.OffsetY > e.PageBounds.Height - this.header_offset - divisional_chart_size) { goto first_done; } } this.bPrintPanchanga = false; this.local_index = 0; first_done: float offsetY = g.Transform.OffsetY; float offsetX = margin_offset + sm_time_offset + sm_time_width; Moment mCurr = new Moment(((PanchangaLocalMoments)locals[iStart]).sunrise_ut, h); HoraInfo hiCurr = new HoraInfo(mCurr, h.info.lat, h.info.lon, h.info.tz); Horoscope hCurr = new Horoscope(hiCurr, h.options); DivisionalChart dc = new DivisionalChart(hCurr); dc.PrintMode = true; dc.options.ViewStyle = DivisionalChart.UserOptions.EViewStyle.Panchanga; dc.SetOptions(dc.options); dc.DrawChart(g, divisional_chart_size, divisional_chart_size); g.ResetTransform(); // horizontal top & bottom g.DrawLine(p, margin_offset - 5, header_offset - 5, margin_offset + sm_time_offset + sm_time_width + 5, header_offset - 5); g.DrawLine(p, margin_offset - 5, header_offset - 5 + f.Height * (float)1.5, margin_offset + sm_time_offset + sm_time_width + 5, header_offset - 5 + f.Height * (float)1.5); g.DrawLine(p, margin_offset - 5, offsetY + 5, offsetX + 5, offsetY + 5); // vertical left and right g.DrawLine(p, margin_offset - 5, header_offset - 5, margin_offset - 5, offsetY + 5); g.DrawLine(p, offsetX + 5, header_offset - 5, offsetX + 5, offsetY + 5); g.DrawLine(p, margin_offset + sunset_offset + sunset_width - 2, header_offset - 5, margin_offset + sunset_offset + sunset_width - 2, offsetY + 5); g.DrawLine(p, margin_offset + tithi_time_offset + tithi_time_width - 2, header_offset - 5, margin_offset + tithi_time_offset + tithi_time_width - 2, offsetY + 5); g.DrawLine(p, margin_offset + nak_time_offset + nak_time_width - 2, header_offset - 5, margin_offset + nak_time_offset + nak_time_width - 2, offsetY + 5); g.DrawLine(p, margin_offset + karana_time_2_offset + karana_time_width - 2, header_offset - 5, margin_offset + karana_time_2_offset + karana_time_width - 2, offsetY + 5); }