public double ojaYugmaHelper(Body.Name b, ZodiacHouse zh) { if (this.getsOjaBala(b)) { if (zh.isOdd()) { return(15.0); } else { return(0.0); } } else { if (zh.isOdd()) { return(0.0); } else { return(15.0); } } }
public double NonLinearSearch(double ut, Body.Name b, Longitude lon_to_find, ReturnLon func) { bool rDir_start = false; bool rDir_end = false; bool bDayFound = false; ut -= 1.0; do { ut += 1.0; Longitude l_start = func(ut, ref rDir_start); Longitude l_end = func(ut + 1.0, ref rDir_end); if (this.CircularLonLessThan(l_start, lon_to_find) && this.CircularLonLessThan(lon_to_find, l_end)) { bDayFound = true; } } while (bDayFound == false); if (rDir_start == false && rDir_end == false) { LinearSearchBinary(ut, ut + 1.0, lon_to_find, new ReturnLon(this.LongitudeOfSun)); } return(ut); }
public void kalaHelper(ref Body.Name yearLord, ref Body.Name monthLord) { double ut_arghana = sweph.swe_julday(1827, 5, 2, -h.info.tz.toDouble() + 12.0 / 24.0); double ut_noon = h.baseUT - h.info.tob.time / 24.0 + 12.0 / 24.0; double diff = ut_noon - ut_arghana; if (diff >= 0) { double quo = Math.Floor(diff / 360.0); diff -= quo * 360.0; } else { double pdiff = -diff; double quo = Math.Ceiling(pdiff / 360.0); diff += quo * 360.0; } double diff_year = diff; while (diff > 30.0) { diff -= 30.0; } double diff_month = diff; while (diff > 7) { diff -= 7.0; } yearLord = Basics.weekdayRuler((Basics.Weekday)sweph.swe_day_of_week(ut_noon - diff_year)); monthLord = Basics.weekdayRuler((Basics.Weekday)sweph.swe_day_of_week(ut_noon - diff_month)); }
public double drekkanaBala(Body.Name b) { this.verifyGraha(b); int part = h.getPosition(b).partOfZodiacHouse(3); if (part == 1 && (b == Body.Name.Sun || b == Body.Name.Jupiter || b == Body.Name.Mars)) { return(15.0); } if (part == 2 && (b == Body.Name.Saturn || b == Body.Name.Mercury)) { return(15.0); } if (part == 3 && (b == Body.Name.Moon || b == Body.Name.Venus)) { return(15.0); } return(0); }
private void DrawChakra(Graphics g) { Body.Name[] bodies = new Body.Name[] { Body.Name.Sun, Body.Name.Moon, Body.Name.Mars, Body.Name.Mercury, Body.Name.Jupiter, Body.Name.Venus, Body.Name.Saturn, Body.Name.Rahu, Body.Name.Ketu }; g.Clear(MhoraGlobalOptions.Instance.ChakraBackgroundColor); this.ResetChakra(g, 0.0); g.DrawEllipse(pn_grey, -150, -150, 300, 300); g.DrawEllipse(pn_grey, -140, -140, 280, 280); for (int i = 0; i < 9; i++) { this.ResetChakra(g, i * (360.0 / 9.0)); g.DrawLine(pn_grey, 0, 0, 150, 0); } for (int i = 0; i < 9; i++) { this.ResetChakra(g, i * (360.0 / 9.0) + (360.0 / (9.0 * 2.0))); g.TranslateTransform(135, 0); g.RotateTransform((float)90.0); SizeF sz = g.MeasureString(Body.toString(bodies[i]), f); g.DrawString(Body.toString(bodies[i]), f, b_black, -sz.Width / 2, 0); } if (h.isDayBirth()) { } }
public double pakshaBala(Body.Name b) { this.verifyGraha(b); Longitude mlon = h.getPosition(Body.Name.Moon).longitude; Longitude slon = h.getPosition(Body.Name.Sun).longitude; double diff = mlon.sub(slon).value; if (diff > 180) { diff = 360.0 - diff; } double shubha = diff / 3.0; double paapa = 60.0 - shubha; switch (b) { case Body.Name.Sun: case Body.Name.Mars: case Body.Name.Saturn: return(paapa); case Body.Name.Moon: return(shubha * 2.0); default: case Body.Name.Mercury: case Body.Name.Jupiter: case Body.Name.Venus: return(shubha); } }
public Color getBinduColor(Body.Name b) { switch (b) { case Body.Name.Lagna: return(this.mcBodyLagna); case Body.Name.Sun: return(this.mcBodySun); case Body.Name.Moon: return(this.mcBodyMoon); case Body.Name.Mars: return(this.mcBodyMars); case Body.Name.Mercury: return(this.mcBodyMercury); case Body.Name.Jupiter: return(this.mcBodyJupiter); case Body.Name.Venus: return(this.mcBodyVenus); case Body.Name.Saturn: return(this.mcBodySaturn); case Body.Name.Rahu: return(this.mcBodyRahu); case Body.Name.Ketu: return(this.mcBodyKetu); default: return(this.mcBodyOther); } }
public Retrogression(Horoscope _h, Body.Name _b) { //Debug.Assert((int)_b >= (int)Body.Name.Moon && // (int)_b <= (int)Body.Name.Saturn, // string.Format("Retrogression::Retrogression. Invalid Body {0}", _b)); h = _h; b = _b; }
public double horaBala(Body.Name b) { this.verifyGraha(b); if (h.calculateHora() == b) { return(60.0); } return(0.0); }
public double varaBala(Body.Name b) { this.verifyGraha(b); if (Basics.weekdayRuler(h.wday) == b) { return(45.0); } return(0.0); }
public double masaBala(Body.Name b) { this.verifyGraha(b); Body.Name yearLord = Body.Name.Sun, monthLord = Body.Name.Sun; this.kalaHelper(ref yearLord, ref monthLord); if (monthLord == b) { return(30.0); } return(0.0); }
public bool getsOjaBala(Body.Name b) { switch (b) { case Body.Name.Moon: case Body.Name.Venus: return(false); default: return(true); } }
private double DirectSpeed(Body.Name b) { switch (b) { case Body.Name.Sun: return(365.2425); case Body.Name.Moon: return(28.0); case Body.Name.Lagna: return(1.0); } return(0.0); }
public double ojaYugmaRasyAmsaBala(Body.Name b) { this.verifyGraha(b); BodyPosition bp = h.getPosition(b); ZodiacHouse zh_rasi = bp.toDivisionPosition(new Division(Basics.DivisionType.Rasi)).zodiac_house; ZodiacHouse zh_amsa = bp.toDivisionPosition(new Division(Basics.DivisionType.Navamsa)).zodiac_house; double s = 0; s += this.ojaYugmaHelper(b, zh_rasi); s += this.ojaYugmaHelper(b, zh_amsa); return(s); }
public double ucchaBala(Body.Name b) { this.verifyGraha(b); Longitude debLon = Body.debilitationDegree(b); Longitude posLon = h.getPosition(b).longitude; double diff = posLon.sub(debLon).value; if (diff > 180) { diff = 360 - diff; } return((diff / 180.0) * 60.0); }
public int[] getPav(Body.Name m) { int[] ret = new int[12] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; foreach (Body.Name inner in getBodies()) { foreach (ZodiacHouse.Name zh in this.getBindus(m, inner)) { ret[((int)zh) - 1]++; } } return(ret); }
public double kendraBala(Body.Name b) { this.verifyGraha(b); ZodiacHouse zh_b = h.getPosition(b).toDivisionPosition(new Division(Basics.DivisionType.Rasi)).zodiac_house; ZodiacHouse zh_l = h.getPosition(Body.Name.Lagna).toDivisionPosition(new Division(Basics.DivisionType.Rasi)).zodiac_house; int diff = zh_l.numHousesBetween(zh_b); switch (diff % 3) { case 1: return(60); case 2: return(30.0); case 0: default: return(15.0); } }
public double tribhaagaBala(Body.Name b) { Body.Name ret = Body.Name.Jupiter; this.verifyGraha(b); if (h.isDayBirth()) { double length = (h.sunset - h.sunrise) / 3; double offset = h.info.tob.time - h.sunrise; int part = (int)(Math.Floor(offset / length)); switch (part) { case 0: ret = Body.Name.Mercury; break; case 1: ret = Body.Name.Sun; break; case 2: ret = Body.Name.Saturn; break; } } else { double length = (h.next_sunrise + 24.0 - h.sunset) / 3; double offset = h.info.tob.time - h.sunset; if (offset < 0) { offset += 24; } int part = (int)(Math.Floor(offset / length)); switch (part) { case 0: ret = Body.Name.Moon; break; case 1: ret = Body.Name.Venus; break; case 2: ret = Body.Name.Mars; break; } } if (b == Body.Name.Jupiter || b == ret) { return(60); } return(0); }
private void Compute() { this.mList.BeginUpdate(); this.mList.Clear(); this.mList.BackColor = Color.AliceBlue; this.mList.Columns.Add("Body", -1, System.Windows.Forms.HorizontalAlignment.Left); this.mList.Columns.Add("Winner", -1, System.Windows.Forms.HorizontalAlignment.Left); int winner = 0; Body.Name b1 = (Body.Name) this.cbGraha1.SelectedIndex; Body.Name b2 = (Body.Name) this.cbGraha2.SelectedIndex; bool bSimpleLord = false; ArrayList al = this.GetRules(ref bSimpleLord); for (int i = 0; i < al.Count; i++) { ArrayList rule = new ArrayList(); rule.Add(al[i]); FindStronger fs = new FindStronger(h, options.Division, rule); Body.Name bw = fs.StrongerGraha(b1, b2, bSimpleLord, ref winner); ListViewItem li = new ListViewItem(); li.Text = string.Format("{0}", EnumDescConverter.GetEnumDescription((System.Enum)al[i])); if (winner == 0) { li.SubItems.Add(Body.toString(bw)); } this.mList.Items.Add(li); } this.mList.Columns[0].Width = -1; this.mList.Columns[1].Width = -2; this.mList.EndUpdate(); }
public double digBala(Body.Name b) { this.verifyGraha(b); int[] powerlessHouse = new int[] { 4, 10, 4, 7, 7, 10, 1 }; Longitude lagLon = h.getPosition(Body.Name.Lagna).longitude; Longitude debLon = new Longitude(lagLon.toZodiacHouseBase()); debLon = debLon.add(powerlessHouse[(int)b] * 30.0 + 15.0); Longitude posLon = h.getPosition(b).longitude; Console.WriteLine("digBala {0} {1} {2}", b, posLon.value, debLon.value); double diff = posLon.sub(debLon).value; if (diff > 180) { diff = 360 - diff; } return((diff / 180.0) * 60.0); }
public double naisargikaBala(Body.Name b) { this.verifyGraha(b); switch (b) { case Body.Name.Sun: return(60); case Body.Name.Moon: return(51.43); case Body.Name.Mars: return(17.14); case Body.Name.Mercury: return(25.70); case Body.Name.Jupiter: return(34.28); case Body.Name.Venus: return(42.85); case Body.Name.Saturn: return(8.57); } return(0); }
public ZodiacHouse.Name[] getBindus(Body.Name m, Body.Name n) { int[][][] allBindus = new int[8][][]; allBindus [0] = BindusSun(); allBindus [1] = BindusMoon(); allBindus [2] = BindusMars(); allBindus [3] = BindusMercury(); allBindus [4] = BindusJupiter(); allBindus [5] = BindusVenus(); allBindus [6] = BindusSaturn(); allBindus [7] = BindusLagna(); ArrayList al = new ArrayList(); ZodiacHouse zh = h.getPosition(n).toDivisionPosition(this.dtype).zodiac_house; foreach (int i in allBindus[BodyToInt(m)][BodyToInt(n)]) { al.Add(zh.add(i).value); } return((ZodiacHouse.Name[])al.ToArray(typeof(ZodiacHouse.Name))); }
public double TransitSearchDirect(Body.Name SearchBody, Moment StartDate, bool Forward, Longitude TransitPoint, Longitude FoundLon, ref bool bForward) { bool bDiscard = true; sweph.obtainLock(h); Transit t = new Transit(h, SearchBody); double ut_base = StartDate.toUniversalTime() - h.info.TimeZone.toDouble() / 24.0; Longitude lon_curr = t.GenericLongitude(ut_base, ref bDiscard); sweph.releaseLock(h); double diff = 0; diff = TransitPoint.sub(lon_curr).value; if (false == Forward) { diff -= 360.0; } double ut_diff_approx = diff / 360.0 * this.DirectSpeed(SearchBody); sweph.obtainLock(h); double found_ut = 0; if (SearchBody == Body.Name.Lagna) { found_ut = t.LinearSearchBinary(ut_base + ut_diff_approx - 3.0 / 24.0, ut_base + ut_diff_approx + 3.0 / 24.0, TransitPoint, new ReturnLon(t.GenericLongitude)); } else { found_ut = t.LinearSearch(ut_base + ut_diff_approx, TransitPoint, new ReturnLon(t.GenericLongitude)); } FoundLon.value = t.GenericLongitude(found_ut, ref bForward).value; bForward = true; sweph.releaseLock(h); return(found_ut); }
public int BodyNameToSweph(Body.Name b) { switch (b) { case Body.Name.Sun: return(sweph.SE_SUN); case Body.Name.Moon: return(sweph.SE_MOON); case Body.Name.Mars: return(sweph.SE_MARS); case Body.Name.Mercury: return(sweph.SE_MERCURY); case Body.Name.Jupiter: return(sweph.SE_JUPITER); case Body.Name.Venus: return(sweph.SE_VENUS); case Body.Name.Saturn: return(sweph.SE_SATURN); default: throw new Exception(); } }
public double TransitSearch(Body.Name SearchBody, Moment StartDate, bool Forward, Longitude TransitPoint, Longitude FoundLon, ref bool bForward) { if (SearchBody == Body.Name.Sun || SearchBody == Body.Name.Moon) { return(TransitSearchDirect(SearchBody, StartDate, Forward, TransitPoint, FoundLon, ref bForward)); } if (((int)SearchBody <= (int)Body.Name.Moon || (int)SearchBody > (int)Body.Name.Saturn) && SearchBody != Body.Name.Lagna) { return(StartDate.toUniversalTime()); } sweph.obtainLock(h); Retrogression r = new Retrogression(h, SearchBody); double julday_ut = StartDate.toUniversalTime() - h.info.tz.toDouble() / 24.0; double found_ut = julday_ut; if (Forward) { found_ut = r.GetTransitForward(julday_ut, TransitPoint); } else { found_ut = r.GetTransitBackward(julday_ut, TransitPoint); } FoundLon.value = r.GetLon(found_ut, ref bForward).value; sweph.releaseLock(h); return(found_ut); }
public double nathonnathaBala(Body.Name b) { this.verifyGraha(b); if (b == Body.Name.Mercury) { return(60); } double lmt_midnight = h.lmt_offset * 24.0; double lmt_noon = 12.0 + h.lmt_offset * 24.0; double diff = 0; if (h.info.tob.time > lmt_noon) { diff = lmt_midnight - h.info.tob.time; } else { diff = h.info.tob.time - lmt_midnight; } while (diff < 0) { diff += 12.0; } diff = diff / 12.0 * 60.0; if (b == Body.Name.Moon || b == Body.Name.Mars || b == Body.Name.Saturn) { diff = 60 - diff; } return(diff); }
public int BodyToInt(Body.Name b) { switch (b) { case Body.Name.Sun: return(0); case Body.Name.Moon: return(1); case Body.Name.Mars: return(2); case Body.Name.Mercury: return(3); case Body.Name.Jupiter: return(4); case Body.Name.Venus: return(5); case Body.Name.Saturn: return(6); case Body.Name.Lagna: return(7); default: Trace.Assert(false, "Ashtakavarga:BodyToInt"); return(0); } }
public void DrawChakra(Graphics g) { //this.DrawInnerChakra(g); if (false == this.PrintMode) { g.Clear(MhoraGlobalOptions.Instance.ChakraBackgroundColor); } this.ResetChakra(g, 0.0); g.DrawEllipse(pn_grey, -40, -40, 80, 80); g.DrawEllipse(pn_grey, -125, -125, 250, 250); g.DrawEllipse(pn_grey, -105, -105, 210, 210); g.DrawEllipse(pn_grey, -115, -115, 230, 230); Body.Name[] bodies = new Body.Name[10] { Body.Name.Lagna, Body.Name.Sun, Body.Name.Moon, Body.Name.Mars, Body.Name.Mercury, Body.Name.Jupiter, Body.Name.Venus, Body.Name.Saturn, Body.Name.Rahu, Body.Name.Ketu }; for (int i = 0; i < 12; i++) { ResetChakra(g, i * 30); g.DrawLine(pn_lgrey, 40, 0, 125, 0); } for (int i = 0; i < 12; i++) { ResetChakra(g, i * 30 + 15); ZodiacHouse.Name z = (ZodiacHouse.Name)(i + 1); SizeF sz = g.MeasureString(z.ToString(), f); g.DrawString(z.ToString(), f, Brushes.Gray, 40 - sz.Width, 0); } for (int i = 0; i < 27; i++) { ResetChakra(g, (i + 1) * (360.0 / 27.0)); //+((360.0/27.0)/2.0)); g.TranslateTransform(105, 0); g.RotateTransform((float)90.0); SizeF sz = g.MeasureString(nak_s[i], f); g.DrawString(nak_s[i], f, Brushes.Gray, (float)(360.0 / 27.0) - (sz.Width / 2), sz.Height / 2); } for (int i = 0; i < 27 * 4; i++) { ResetChakra(g, i * (360.0 / (27.0 * 4.0))); Pen p = pn_lgrey; if (i % 12 == 0) { p = pn_black; } g.DrawLine(p, 115, 0, 125, 0); p = pn_lgrey; if (i % 4 == 0) { p = pn_black; } g.DrawLine(p, 105, 0, 115, 0); } double dist_sat = h.getPosition(Body.Name.Saturn).distance; foreach (Body.Name b in bodies) { Pen pn_b = new Pen(MhoraGlobalOptions.Instance.getBinduColor(b)); Brush br_b = new SolidBrush(MhoraGlobalOptions.Instance.getBinduColor(b)); BodyPosition bp = h.getPosition(b); ResetChakra(g, bp.longitude.value); int chWidth = 2; g.DrawEllipse(pn_black, 110 - (chWidth), 0, 1, 1); g.FillEllipse(br_b, 120 - chWidth, -chWidth, chWidth * 2, chWidth * 2); g.DrawEllipse(pn_grey, 120 - chWidth, -chWidth, chWidth * 2, chWidth * 2); SizeF sz = g.MeasureString(b.ToString(), f); g.DrawString(b.ToString(), f, Brushes.Black, 125, -sz.Height / 2); // current position with distance int dist = (int)(bp.distance / dist_sat * (105 - 40 - chWidth * 2)); g.FillEllipse(br_b, 40 + dist - chWidth, -chWidth, chWidth * 2, chWidth * 2); g.DrawEllipse(pn_grey, 40 + dist - chWidth, -chWidth, chWidth * 2, chWidth * 2); // speed double dspSize = (bp.speed_longitude / 360.0) * 12000.0; if (bp.speed_longitude < 0) { dspSize *= 2.0; } int spSize = (int)dspSize; if (spSize > 40) { spSize = 40; } if (bp.speed_longitude > 0) { g.DrawLine(pn_lgrey, 40 + dist, -chWidth, 40 + dist, -spSize); } else { g.DrawLine(pn_lgrey, 40 + dist, chWidth, 40 + dist, -spSize); } } }
void Repopulate() { string[] weekdays = new string[] { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" }; mList.Items.Clear(); ListViewItem li; li = new ListViewItem("Date of Birth"); li.SubItems.Add(h.info.tob.ToString()); mList.Items.Add(li); li = new ListViewItem("Time Zone"); li.SubItems.Add(h.info.tz.ToString()); mList.Items.Add(li); li = new ListViewItem("Latitude"); li.SubItems.Add(h.info.lat.ToString()); mList.Items.Add(li); li = new ListViewItem("Longitude"); li.SubItems.Add(h.info.lon.ToString()); mList.Items.Add(li); li = new ListViewItem("Altitude"); li.SubItems.Add(h.info.alt.ToString()); mList.Items.Add(li); { HMSInfo hms_srise = new HMSInfo(h.sunrise); li = new ListViewItem("Sunrise"); string fmt = String.Format("{0:00}:{1:00}:{2:00}", hms_srise.degree, hms_srise.minute, hms_srise.second); li.SubItems.Add(fmt); mList.Items.Add(li); } { HMSInfo hms_sset = new HMSInfo(h.sunset); li = new ListViewItem("Sunset"); string fmt = String.Format("{0:00}:{1:00}:{2:00}", hms_sset.degree, hms_sset.minute, hms_sset.second); li.SubItems.Add(fmt); mList.Items.Add(li); } { li = new ListViewItem("Weekday"); string fmt = String.Format("{0}", h.wday); li.SubItems.Add(fmt); mList.Items.Add(li); } { 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(); Body.Name tiLord = ti.getLord(); li = new ListViewItem("Tithi"); string fmt = String.Format("{0} ({1}) {2:N}% left", ti.ToString(), tiLord, offset / 12.0 * 100); li.SubItems.Add(fmt); mList.Items.Add(li); } { Longitude lmoon = h.getPosition(Body.Name.Moon).longitude; Nakshatra nmoon = lmoon.toNakshatra(); Body.Name nmoonLord = VimsottariDasa.LordOfNakshatra(nmoon); double offset = (360.0 / 27.0) - lmoon.toNakshatraOffset(); int pada = lmoon.toNakshatraPada(); string fmt = String.Format("{0} {1} ({2}) {3:N}% left", nmoon.value, pada, nmoonLord, offset / (360.0 / 27.0) * 100); li = new ListViewItem("Nakshatra"); li.SubItems.Add(fmt); mList.Items.Add(li); } { li = new ListViewItem("Karana"); Longitude lkarana = h.getPosition(Body.Name.Moon).longitude.sub(h.getPosition(Body.Name.Sun).longitude); double koffset = (360.0 / 60.0) - lkarana.toKaranaOffset(); Karana k = lkarana.toKarana(); Body.Name kLord = k.getLord(); string fmt = string.Format("{0} ({1}) {2:N}% left", k.value, kLord, koffset / 6.0 * 100); li.SubItems.Add(fmt); mList.Items.Add(li); } { li = new ListViewItem("Yoga"); Longitude smLon = h.getPosition(Body.Name.Sun).longitude.add(h.getPosition(Body.Name.Moon).longitude); double offset = (360.0 / 27.0) - smLon.toSunMoonYogaOffset(); SunMoonYoga smYoga = smLon.toSunMoonYoga(); Body.Name smLord = smYoga.getLord(); string fmt = string.Format("{0} ({1}) {2:N}% left", smYoga, smLord, offset / (360.0 / 27.0) * 100); li.SubItems.Add(fmt); mList.Items.Add(li); } { li = new ListViewItem("Hora"); Body.Name b = h.calculateHora(); string fmt = String.Format("{0}", b); li.SubItems.Add(fmt); mList.Items.Add(li); } { li = new ListViewItem("Kala"); Body.Name b = h.calculateKala(); string fmt = String.Format("{0}", b); li.SubItems.Add(fmt); mList.Items.Add(li); } { li = new ListViewItem("Muhurta"); int mIndex = (int)(Math.Floor((h.hoursAfterSunrise() / h.lengthOfDay()) * 30.0) + 1); Basics.Muhurta m = (Basics.Muhurta)mIndex; string fmt = String.Format("{0} ({1})", m, Basics.NakLordOfMuhurta(m)); li.SubItems.Add(fmt); mList.Items.Add(li); } { double ghatisSr = h.hoursAfterSunrise() * 2.5; double ghatisSs = h.hoursAfterSunRiseSet() * 2.5; li = new ListViewItem("Ghatis"); string fmt = String.Format("{0:0.0000} / {1:0.0000}", ghatisSr, ghatisSs); li.SubItems.Add(fmt); mList.Items.Add(li); } { int vgOff = (int)Math.Ceiling(h.hoursAfterSunRiseSet() * 150.0); vgOff = vgOff % 9; if (vgOff == 0) { vgOff = 9; } Body.Name b = (Body.Name)((int)Body.Name.Sun + vgOff - 1); li = new ListViewItem("Vighatika Graha"); string fmt = String.Format("{0}", b); li.SubItems.Add(fmt); mList.Items.Add(li); } { li = new ListViewItem("LMT Offset"); double e = h.lmt_offset; double orig_e = e; e = e < 0 ? -e : e; e *= 24.0; int hour = (int)Math.Floor(e); e = (e - Math.Floor(e)) * 60.0; int min = (int)Math.Floor(e); e = (e - Math.Floor(e)) * 60.0; string prefix = ""; if (orig_e < 0) { prefix = "-"; } string fmt = String.Format("{0}{1:00}:{2:00}:{3:00.00}", prefix, hour, min, e); string fmt2 = String.Format(" ({0:00.00} minutes)", h.lmt_offset * 24.0 * 60.0); li.SubItems.Add(fmt + fmt2); mList.Items.Add(li); } { sweph.obtainLock(h); li = new ListViewItem("Ayanamsa"); double aya = sweph.swe_get_ayanamsa_ut(h.baseUT); int aya_hour = (int)Math.Floor(aya); aya = (aya - Math.Floor(aya)) * 60.0; int aya_min = (int)Math.Floor(aya); aya = (aya - Math.Floor(aya)) * 60.0; string fmt = String.Format("{0:00}-{1:00}-{2:00.00}", aya_hour, aya_min, aya); li.SubItems.Add(fmt); mList.Items.Add(li); sweph.releaseLock(h); } { li = new ListViewItem("Universal Time"); li.SubItems.Add(h.baseUT.ToString()); mList.Items.Add(li); } this.ColorAndFontRows(mList); }
public void Repopulate() { Body.Name[] grahas = new Body.Name[] { Body.Name.Sun, Body.Name.Moon, Body.Name.Mars, Body.Name.Mercury, Body.Name.Jupiter, Body.Name.Venus, Body.Name.Saturn }; this.mList.Clear(); ShadBalas sb = new ShadBalas(h); this.mList.Columns.Add("Bala", 120, System.Windows.Forms.HorizontalAlignment.Left); foreach (Body.Name b in grahas) { this.mList.Columns.Add(b.ToString(), 70, System.Windows.Forms.HorizontalAlignment.Left); } { ListViewItem li = new ListViewItem("Sthana"); foreach (Body.Name b in grahas) { li.SubItems.Add("-"); } mList.Items.Add(li); } { ListViewItem li = new ListViewItem("-> Uccha"); foreach (Body.Name b in grahas) { li.SubItems.Add(fmtBala(sb.ucchaBala(b))); } mList.Items.Add(li); } { ListViewItem li = new ListViewItem("-> Oja-Yugma"); foreach (Body.Name b in grahas) { li.SubItems.Add(fmtBala(sb.ojaYugmaRasyAmsaBala(b))); } mList.Items.Add(li); } { ListViewItem li = new ListViewItem("-> Kendra"); foreach (Body.Name b in grahas) { li.SubItems.Add(fmtBala(sb.kendraBala(b))); } mList.Items.Add(li); } { ListViewItem li = new ListViewItem("-> Drekkana"); foreach (Body.Name b in grahas) { li.SubItems.Add(fmtBala(sb.drekkanaBala(b))); } mList.Items.Add(li); } { ListViewItem li = new ListViewItem("Dik"); foreach (Body.Name b in grahas) { li.SubItems.Add(fmtBala(sb.digBala(b))); } mList.Items.Add(li); } { ListViewItem li = new ListViewItem("Kaala"); foreach (Body.Name b in grahas) { li.SubItems.Add("-"); } mList.Items.Add(li); } { ListViewItem li = new ListViewItem("-> Nathonnatha"); foreach (Body.Name b in grahas) { li.SubItems.Add(fmtBala(sb.nathonnathaBala(b))); } mList.Items.Add(li); } { ListViewItem li = new ListViewItem("-> Paksha"); foreach (Body.Name b in grahas) { li.SubItems.Add(fmtBala(sb.pakshaBala(b))); } mList.Items.Add(li); } { ListViewItem li = new ListViewItem("-> Tribhaaga"); foreach (Body.Name b in grahas) { li.SubItems.Add(fmtBala(sb.tribhaagaBala(b))); } mList.Items.Add(li); } { ListViewItem li = new ListViewItem("-> Abda"); foreach (Body.Name b in grahas) { li.SubItems.Add(fmtBala(sb.abdaBala(b))); } mList.Items.Add(li); } { ListViewItem li = new ListViewItem("-> Masa"); foreach (Body.Name b in grahas) { li.SubItems.Add(fmtBala(sb.masaBala(b))); } mList.Items.Add(li); } { ListViewItem li = new ListViewItem("-> Vara"); foreach (Body.Name b in grahas) { li.SubItems.Add(fmtBala(sb.varaBala(b))); } mList.Items.Add(li); } { ListViewItem li = new ListViewItem("-> Hora"); foreach (Body.Name b in grahas) { li.SubItems.Add(fmtBala(sb.horaBala(b))); } mList.Items.Add(li); } { ListViewItem li = new ListViewItem("Naisargika"); foreach (Body.Name b in grahas) { li.SubItems.Add(fmtBala(sb.naisargikaBala(b))); } mList.Items.Add(li); } this.ColorAndFontRows(mList); }