public Longitude LongitudeOfSunMoonYoga(double ut) { BodyPosition bp_sun = Basics.CalculateSingleBodyPosition(ut, sweph.SE_SUN, Body.Name.Sun, BodyType.Name.Graha, this.h); BodyPosition bp_moon = Basics.CalculateSingleBodyPosition(ut, sweph.SE_MOON, Body.Name.Moon, BodyType.Name.Graha, this.h); Longitude rel = bp_moon.longitude.add(bp_sun.longitude); return(rel); }
public double GetTransitForward(double ut, Longitude lonToFind) { if (this.b == Body.Name.Lagna) { return(GetLagnaTransitForward(ut, lonToFind)); } bool becomesDirect = true; double ut_curr = ut; double ut_next = ut; while (true) { ut_curr = ut_next; double ut_start = ut_curr; if (ut_curr != ut) { ut_start += this.GetStep(); } ut_next = findNextCuspForward(ut_start, ref becomesDirect); BodyPosition bp_curr = Basics.CalculateSingleBodyPosition(ut_curr, sweph.BodyNameToSweph(b), b, BodyType.Name.Other, this.h); BodyPosition bp_next = Basics.CalculateSingleBodyPosition(ut_next, sweph.BodyNameToSweph(b), b, BodyType.Name.Other, this.h); //Console.WriteLine ("{0}, {1}, {2}", becomesDirect, bp_curr.longitude, bp_next.longitude); if (false == becomesDirect && lonToFind.sub(bp_curr.longitude).value <= bp_next.longitude.sub(bp_curr.longitude).value) { //Console.WriteLine ("+ Found {0} between {1} and {2}", lonToFind, bp_curr.longitude, bp_next.longitude); break; } else if (true == becomesDirect && lonToFind.sub(bp_next.longitude).value <= bp_curr.longitude.sub(bp_next.longitude).value) { //Console.WriteLine ("- Found {0} betweeen {1} and {2}", lonToFind, bp_next.longitude, bp_curr.longitude); break; } else { //Console.WriteLine ("{3} Didn't find {0} betweeen {1} and {2}", lonToFind, bp_curr.longitude, bp_next.longitude, ut_curr); } } if (false == becomesDirect) { return(this.BinaryLonSearch(ut_curr, ut_next, lonToFind, true)); } else { return(this.BinaryLonSearch(ut_curr, ut_next, lonToFind, false)); } }
public Longitude GetLon(double ut, ref bool bForward) { if (this.b == Body.Name.Lagna) { return(new Longitude(sweph.swe_lagna(ut))); } BodyPosition bp = Basics.CalculateSingleBodyPosition(ut, sweph.BodyNameToSweph(b), b, BodyType.Name.Other, this.h); bForward = bp.speed_longitude >= 0; return(bp.longitude); }
public Longitude LongitudeOfSun(double ut, ref bool bDirRetro) { BodyPosition bp = Basics.CalculateSingleBodyPosition(ut, sweph.SE_SUN, Body.Name.Sun, BodyType.Name.Graha, this.h); if (bp.speed_longitude >= 0) { bDirRetro = false; } else { bDirRetro = true; } return(bp.longitude); }
public Longitude GetLongitude(double ut, ref bool bForwardDir) { int swephBody = BodyNameToSweph(b); BodyPosition bp = Basics.CalculateSingleBodyPosition(ut, swephBody, b, BodyType.Name.Other, h); if (bp.speed_longitude >= 0) { bForwardDir = true; } else { bForwardDir = false; } return(bp.longitude); }
public Longitude GenericLongitude(double ut, ref bool bDirRetro) { if (b == Body.Name.Lagna) { return(new Longitude(sweph.swe_lagna(ut))); } BodyPosition bp = Basics.CalculateSingleBodyPosition(ut, sweph.BodyNameToSweph(b), b, BodyType.Name.Other, this.h); if (bp.speed_longitude >= 0) { bDirRetro = false; } else { bDirRetro = true; } return(bp.longitude); }
public double FindClosestTransit(double ut, Longitude lonToFind) { BodyPosition bp = Basics.CalculateSingleBodyPosition(ut, sweph.BodyNameToSweph(b), b, BodyType.Name.Other, this.h); while (Transit.CircLonLessThan(bp.longitude, lonToFind)) { //Console.WriteLine("- {0} {1}", bp.longitude.value, lonToFind.value); ut++; bp = Basics.CalculateSingleBodyPosition(ut, sweph.BodyNameToSweph(b), b, BodyType.Name.Other, this.h); } while (Transit.CircLonLessThan(lonToFind, bp.longitude)) { //Console.WriteLine("+ {0} {1}", bp.longitude.value, lonToFind.value); ut--; bp = Basics.CalculateSingleBodyPosition(ut, sweph.BodyNameToSweph(b), b, BodyType.Name.Other, this.h); } return(ut); }
public double gotoNextRetroSolarCusp(double ut) { return(ut); #if DND Longitude cusp_start = new Longitude(0); Longitude cusp_end = new Longitude(0); BodyPosition bp_sun = Basics.CalculateSingleBodyPosition(ut, sweph.BodyNameToSweph(Body.Name.Sun), Body.Name.Sun, BodyType.Name.Other); BodyPosition bp_b = Basics.CalculateSingleBodyPosition(ut, sweph.BodyNameToSweph(b), b, BodyType.Name.Other); Longitude diff = bp_b.longitude.sub(bp_sun.longitude); if (Transit.CircLonLessThan(cusp_start, diff) && Transit.CircLonLessThan(diff, cusp_end)) { return(ut); } Longitude diffIncrease = diff.sub(cusp_start); double ret = ut + (diffIncrease.value * 360.0 / 365.2425); return(ret); #endif }
public Longitude LongitudeOfMoon(double ut) { BodyPosition bp_moon = Basics.CalculateSingleBodyPosition(ut, sweph.SE_MOON, Body.Name.Moon, BodyType.Name.Graha, this.h); return(bp_moon.longitude.add(0)); }
public double findNextCuspForward(double start_ut, ref bool becomesDirect) { double ut_step = 1.0; BodyPosition bp = Basics.CalculateSingleBodyPosition(start_ut, sweph.BodyNameToSweph(b), b, BodyType.Name.Other, this.h); // Body is currently direct if (bp.speed_longitude >= 0) { start_ut = gotoNextRetroSolarCusp(start_ut); double lower_ut = start_ut; double higher_ut = start_ut; becomesDirect = false; while (true) { lower_ut = higher_ut; higher_ut = lower_ut + ut_step; // Find speeds BodyPosition bp_l = Basics.CalculateSingleBodyPosition(lower_ut, sweph.BodyNameToSweph(b), b, BodyType.Name.Other, this.h); BodyPosition bp_h = Basics.CalculateSingleBodyPosition(higher_ut, sweph.BodyNameToSweph(b), b, BodyType.Name.Other, this.h); //Console.WriteLine ("DChecking daily {0} UT: {1} {2} Speed {3} {4}", b, lower_ut, higher_ut, bp_l.speed_longitude, bp_h.speed_longitude); // If first one is retro, we're exactly at the cusp // If higher is still direct, contine if (bp_l.speed_longitude > 0 && bp_h.speed_longitude < 0) { break; } if (bp_l.speed_longitude < 0 && bp_h.speed_longitude < 0) { return(findNextCuspForward(lower_ut, ref becomesDirect)); } } // Within one day period return(BinaryCuspSearch(lower_ut, higher_ut, true)); } // Body is current retrograde else { double lower_ut = start_ut; double higher_ut = start_ut; becomesDirect = true; while (true) { lower_ut = higher_ut; higher_ut = lower_ut + ut_step; // Find speeds BodyPosition bp_l = Basics.CalculateSingleBodyPosition(lower_ut, sweph.BodyNameToSweph(b), b, BodyType.Name.Other, this.h); BodyPosition bp_h = Basics.CalculateSingleBodyPosition(higher_ut, sweph.BodyNameToSweph(b), b, BodyType.Name.Other, this.h); //Console.WriteLine ("R Checking daily {0} UT: {1} {2} Speed {3} {4}", b, lower_ut, higher_ut, bp_l.speed_longitude, bp_h.speed_longitude); if (bp_l.speed_longitude < 0 && bp_h.speed_longitude >= 0) { break; } if (bp_l.speed_longitude > 0 && bp_h.speed_longitude > 0) { return(findNextCuspForward(lower_ut, ref becomesDirect)); } } // Within one day period return(BinaryCuspSearch(lower_ut, higher_ut, false)); } }
public Longitude GetLon(double ut) { BodyPosition bp = Basics.CalculateSingleBodyPosition(ut, sweph.BodyNameToSweph(b), b, BodyType.Name.Other, this.h); return(bp.longitude); }
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 PopulateCache() { momentCusps = new double[opts.Divisions.Length][]; zhCusps = new ZodiacHouse.Name[opts.Divisions.Length][]; for (int i = 0; i < opts.Divisions.Length; i++) { Division dtype = opts.Divisions[i]; ArrayList al = new ArrayList(); ArrayList zal = new ArrayList(); //Console.WriteLine ("Calculating cusps for {0} between {1} and {2}", // dtype, this.utToMoment(ut_lower), this.utToMoment(ut_higher)); double ut_curr = ut_lower - (1.0 / (24.0 * 60.0)); sweph.obtainLock(h); BodyPosition bp = Basics.CalculateSingleBodyPosition(ut_curr, sweph.BodyNameToSweph(mBody), mBody, BodyType.Name.Graha, h); sweph.releaseLock(h); //BodyPosition bp = (BodyPosition)h.getPosition(mBody).Clone(); //DivisionPosition dp = bp.toDivisionPosition(this.dtypeRasi); DivisionPosition dp = bp.toDivisionPosition(dtype); //Console.WriteLine ("Longitude at {0} is {1} as is in varga rasi {2}", // this.utToMoment(ut_curr), bp.longitude, dp.zodiac_house.value); //bp.longitude = new Longitude(dp.cusp_lower - 0.2); //dp = bp.toDivisionPosition(dtype); while (true) { Moment m = this.utToMoment(ut_curr); Longitude foundLon = new Longitude(0); bool bForward = true; //Console.WriteLine (" Starting search at {0}", this.utToMoment(ut_curr)); ut_curr = cs.TransitSearch(mBody, this.utToMoment(ut_curr), true, new Longitude(dp.cusp_higher), foundLon, ref bForward); bp.longitude = new Longitude(dp.cusp_higher + 0.1); dp = bp.toDivisionPosition(dtype); if (ut_curr >= ut_lower && ut_curr <= ut_higher + (1.0 / (24.0 * 60.0 * 60.0)) * 5.0) { // Console.WriteLine ("{0}: {1} at {2}", // dtype, foundLon, this.utToMoment(ut_curr)); al.Add(ut_curr); zal.Add(dp.zodiac_house.value); } else if (ut_curr > ut_higher) { // Console.WriteLine ("- {0}: {1} at {2}", // dtype, foundLon, this.utToMoment(ut_curr)); break; } ut_curr += ((1.0 / (24.0 * 60.0 * 60.0)) * 5.0); } momentCusps[i] = (double[])al.ToArray(typeof(double)); zhCusps[i] = (ZodiacHouse.Name[])zal.ToArray(typeof(ZodiacHouse.Name)); } //for (int i=0; i<opts.Divisions.Length; i++) //{ // for (int j=0; j<momentCusps[i].Length; j++) // { // Console.WriteLine ("Cusp for {0} at {1}", opts.Divisions[i], momentCusps[i][j]); // } //} }
public void SetView(BaseUserOptions.ViewType view) { MhoraControl mc = null;; switch (view) { case BaseUserOptions.ViewType.DivisionalChart: mc = new DivisionalChart(h); break; case BaseUserOptions.ViewType.Ashtakavarga: mc = new AshtakavargaControl(h); break; case BaseUserOptions.ViewType.ChakraSarvatobhadra81: mc = new Sarvatobhadra81Control(h); break; case BaseUserOptions.ViewType.NavamsaCircle: mc = new NavamsaControl(h); break; case BaseUserOptions.ViewType.VaraChakra: mc = new VaraChakra(h); break; case BaseUserOptions.ViewType.Panchanga: mc = new PanchangaControl(h); break; case BaseUserOptions.ViewType.KutaMatching: { Horoscope h2 = h; foreach (Form f in ((MhoraContainer)MhoraGlobalOptions.mainControl).MdiChildren) { if (f is MhoraChild) { MhoraChild mch = (MhoraChild)f; if (h == h2 && mch.getHoroscope() != h2) { h2 = mch.getHoroscope(); break; } } } mc = new KutaMatchingControl(h, h); } break; case BaseUserOptions.ViewType.DasaVimsottari: mc = new DasaControl(h, new VimsottariDasa(h)); break; case BaseUserOptions.ViewType.DasaYogini: mc = new DasaControl(h, new YoginiDasa(h)); break; case BaseUserOptions.ViewType.DasaShodashottari: mc = new DasaControl(h, new ShodashottariDasa(h)); break; case BaseUserOptions.ViewType.DasaAshtottari: mc = new DasaControl(h, new AshtottariDasa(h)); break; case BaseUserOptions.ViewType.DasaTithiAshtottari: mc = new DasaControl(h, new TithiAshtottariDasa(h)); break; case BaseUserOptions.ViewType.DasaKaranaChaturashitiSama: mc = new DasaControl(h, new KaranaChaturashitiSamaDasa(h)); break; case BaseUserOptions.ViewType.DasaYogaVimsottari: mc = new DasaControl(h, new YogaVimsottariDasa(h)); break; case BaseUserOptions.ViewType.DasaLagnaKendradiRasi: mc = new DasaControl(h, new LagnaKendradiRasiDasa(h)); break; case BaseUserOptions.ViewType.DasaKarakaKendradiGraha: mc = new DasaControl(h, new KarakaKendradiGrahaDasa(h)); break; case BaseUserOptions.ViewType.DasaKalachakra: mc = new DasaControl(h, new KalachakraDasa(h)); break; case BaseUserOptions.ViewType.DasaMoola: mc = new DasaControl(h, new MoolaDasa(h)); break; case BaseUserOptions.ViewType.DasaNavamsa: mc = new DasaControl(h, new NavamsaDasa(h)); break; case BaseUserOptions.ViewType.DasaMandooka: mc = new DasaControl(h, new MandookaDasa(h)); break; case BaseUserOptions.ViewType.DasaChara: mc = new DasaControl(h, new CharaDasa(h)); break; case BaseUserOptions.ViewType.DasaTrikona: mc = new DasaControl(h, new TrikonaDasa(h)); break; case BaseUserOptions.ViewType.DasaSu: mc = new DasaControl(h, new SuDasa(h)); break; case BaseUserOptions.ViewType.DasaSudarshanaChakra: mc = new DasaControl(h, new SudarshanaChakraDasa(h)); break; case BaseUserOptions.ViewType.DasaMudda: { DasaControl dc = new DasaControl(h, new VimsottariDasa(h)); dc.DasaOptions.YearType = ToDate.DateType.SolarYear; dc.DasaOptions.YearLength = 360; dc.DasaOptions.Compression = 1; dc.Reset(); mc = dc; } break; case BaseUserOptions.ViewType.DasaSudarshanaChakraCompressed: { DasaControl dc = new DasaControl(h, new SudarshanaChakraDasa(h)); dc.DasaOptions.YearType = ToDate.DateType.SolarYear; dc.DasaOptions.YearLength = 360; dc.DasaOptions.Compression = 1; dc.Reset(); mc = dc; } break; case BaseUserOptions.ViewType.DasaYogaPraveshVimsottariCompressedYoga: { DasaControl dc = new DasaControl(h, new YogaVimsottariDasa(h)); dc.compressToYogaPraveshaYearYoga(); mc = dc; } break; case BaseUserOptions.ViewType.DasaTithiPraveshAshtottariCompressedTithi: { DasaControl dc = new DasaControl(h, new TithiAshtottariDasa(h)); dc.DasaOptions.YearType = ToDate.DateType.TithiYear; ToDate td_pravesh = new ToDate(h.baseUT, ToDate.DateType.TithiPraveshYear, 360.0, 0, h); ToDate td_tithi = new ToDate(h.baseUT, ToDate.DateType.TithiYear, 360.0, 0, h); sweph.obtainLock(h); if (td_tithi.AddYears(1).toUniversalTime() + 15.0 < td_pravesh.AddYears(1).toUniversalTime()) { dc.DasaOptions.YearLength = 390; } sweph.releaseLock(h); dc.DasaOptions.Compression = 1; TithiAshtottariDasa.UserOptions tuo = (TithiAshtottariDasa.UserOptions)dc.DasaSpecificOptions; tuo.UseTithiRemainder = true; dc.DasaSpecificOptions = tuo; dc.Reset(); mc = dc; } break; case BaseUserOptions.ViewType.DasaTithiPraveshAshtottariCompressedFixed: { DasaControl dc = new DasaControl(h, new TithiAshtottariDasa(h)); ToDate td_pravesh = new ToDate(h.baseUT, ToDate.DateType.TithiPraveshYear, 360.0, 0, h); sweph.obtainLock(h); dc.DasaOptions.YearType = ToDate.DateType.FixedYear; dc.DasaOptions.YearLength = td_pravesh.AddYears(1).toUniversalTime() - td_pravesh.AddYears(0).toUniversalTime(); sweph.releaseLock(h); TithiAshtottariDasa.UserOptions tuo = (TithiAshtottariDasa.UserOptions)dc.DasaSpecificOptions; tuo.UseTithiRemainder = true; dc.DasaSpecificOptions = tuo; dc.DasaOptions.Compression = 1; dc.Reset(); mc = dc; } break; case BaseUserOptions.ViewType.DasaTithiPraveshAshtottariCompressedSolar: { DasaControl dc = new DasaControl(h, new TithiAshtottariDasa(h)); ToDate td_pravesh = new ToDate(h.baseUT, ToDate.DateType.TithiPraveshYear, 360.0, 0, h); sweph.obtainLock(h); double ut_start = td_pravesh.AddYears(0).toUniversalTime(); double ut_end = td_pravesh.AddYears(1).toUniversalTime(); BodyPosition sp_start = Basics.CalculateSingleBodyPosition( ut_start, sweph.BodyNameToSweph(Body.Name.Sun), Body.Name.Sun, BodyType.Name.Graha, this.h); BodyPosition sp_end = Basics.CalculateSingleBodyPosition( ut_end, sweph.BodyNameToSweph(Body.Name.Sun), Body.Name.Sun, BodyType.Name.Graha, this.h); Longitude lDiff = sp_end.longitude.sub(sp_start.longitude); double diff = lDiff.value; if (diff < 120.0) { diff += 360.0; } dc.DasaOptions.YearType = ToDate.DateType.SolarYear; dc.DasaOptions.YearLength = diff; sweph.releaseLock(h); TithiAshtottariDasa.UserOptions tuo = (TithiAshtottariDasa.UserOptions)dc.DasaSpecificOptions; tuo.UseTithiRemainder = true; dc.DasaSpecificOptions = tuo; //dc.DasaOptions.YearType = ToDate.DateType.FixedYear; //dc.DasaOptions.YearLength = td_pravesh.AddYears(1).toUniversalTime() - // td_pravesh.AddYears(0).toUniversalTime(); dc.DasaOptions.Compression = 1; dc.Reset(); mc = dc; } break; case BaseUserOptions.ViewType.DasaDwadashottari: mc = new DasaControl(h, new DwadashottariDasa(h)); break; case BaseUserOptions.ViewType.DasaPanchottari: mc = new DasaControl(h, new PanchottariDasa(h)); break; case BaseUserOptions.ViewType.DasaShatabdika: mc = new DasaControl(h, new ShatabdikaDasa(h)); break; case BaseUserOptions.ViewType.DasaChaturashitiSama: mc = new DasaControl(h, new ChaturashitiSamaDasa(h)); break; case BaseUserOptions.ViewType.DasaDwisaptatiSama: mc = new DasaControl(h, new DwisaptatiSamaDasa(h)); break; case BaseUserOptions.ViewType.DasaShatTrimshaSama: mc = new DasaControl(h, new ShatTrimshaSamaDasa(h)); break; case BaseUserOptions.ViewType.BasicCalculations: mc = new BasicCalculationsControl(h); break; case BaseUserOptions.ViewType.KeyInfo: mc = new KeyInfoControl(h); break; case BaseUserOptions.ViewType.Balas: mc = new BalasControl(h); break; case BaseUserOptions.ViewType.TransitSearch: mc = new TransitSearch(h); break; case BaseUserOptions.ViewType.NaisargikaRasiDasa: mc = new DasaControl(h, new NaisargikaRasiDasa(h)); break; case BaseUserOptions.ViewType.NaisargikaGrahaDasa: mc = new DasaControl(h, new NaisargikaGrahaDasa(h)); break; case BaseUserOptions.ViewType.DasaNarayana: mc = new DasaControl(h, new NarayanaDasa(h)); break; case BaseUserOptions.ViewType.DasaNarayanaSama: mc = new DasaControl(h, new NarayanaSamaDasa(h)); break; case BaseUserOptions.ViewType.DasaShoola: mc = new DasaControl(h, new ShoolaDasa(h)); break; case BaseUserOptions.ViewType.DasaNiryaanaShoola: mc = new DasaControl(h, new NirayaanaShoolaDasa(h)); break; case BaseUserOptions.ViewType.DasaDrig: mc = new DasaControl(h, new DrigDasa(h)); break; case BaseUserOptions.ViewType.DasaTajaka: mc = new DasaControl(h, new TajakaDasa(h)); break; case BaseUserOptions.ViewType.DasaTithiPravesh: { DasaControl dc = new DasaControl(h, new TithiPraveshDasa(h)); dc.DasaOptions.YearType = ToDate.DateType.TithiPraveshYear; dc.LinkToHoroscope = false; dc.Reset(); mc = dc; } break; case BaseUserOptions.ViewType.DasaYogaPravesh: { DasaControl dc = new DasaControl(h, new YogaPraveshDasa(h)); dc.DasaOptions.YearType = ToDate.DateType.YogaPraveshYear; dc.LinkToHoroscope = false; dc.Reset(); mc = dc; } break; case BaseUserOptions.ViewType.DasaNakshatraPravesh: { DasaControl dc = new DasaControl(h, new NakshatraPraveshDasa(h)); dc.DasaOptions.YearType = ToDate.DateType.NakshatraPraveshYear; dc.LinkToHoroscope = false; dc.Reset(); mc = dc; } break; case BaseUserOptions.ViewType.DasaKaranaPravesh: { DasaControl dc = new DasaControl(h, new KaranaPraveshDasa(h)); dc.DasaOptions.YearType = ToDate.DateType.KaranaPraveshYear; dc.LinkToHoroscope = false; dc.Reset(); mc = dc; } break; case BaseUserOptions.ViewType.DasaTattwa: mc = new DasaControl(h, new TattwaDasa(h)); break; default: Debug.Assert(false, "Unknown View Internal error"); break; } mc.Dock = DockStyle.Fill; if (null != this.Control) { this.Control.Dispose(); } this.Control = mc; return; }