public static void Calculate(double jd, out double L, out double B, out double R) { GCMoonData md = new GCMoonData(); md.Calculate(jd); L = md.longitude_deg; B = md.latitude_deg; R = md.radius; }
public static double GetMoonElevation(GCEarthData e, GregorianDateTime vc) { GCMoonData moon = new GCMoonData(); double d = vc.GetJulianComplete(); moon.Calculate(d); moon.CorrectEqatorialWithParallax(d, e.latitudeDeg, e.longitudeDeg, 0); moon.calc_horizontal(d, e.longitudeDeg, e.latitudeDeg); return(moon.elevation); }
public static double GetMoonLongitude(GregorianDateTime vct, GCEarthData earth) { switch (System) { case AstronomySystem.Meeus: GCMoonData moon = new GCMoonData(); moon.Calculate(vct.GetJulianComplete()); return(moon.longitude_deg); } return(0); }
private void CalculateMoonTimes(GregorianDateTime vcEnd, GregorianDateTime vcAdd, GCEarthData earth, GCConfigRatedEvents rec) { GregorianDateTime vcNext = new GregorianDateTime(); vcAdd.SubtractDays(2); while (vcAdd.IsBeforeThis(vcEnd)) { vcNext.Set(GCMoonData.GetNextRise(earth, vcAdd, true)); vcNext.AddHours(earth.TimeZone.GetBiasMinutesForDay(vcNext) / 60.0); //AddEvent(vcNext, CoreEventType.CCTYPE_M_RISE, 0, ndst); AddRating(vcNext, rec.rateMoonTime[0], rec.rateMoonTime[1]); vcNext.Set(GCMoonData.GetNextRise(earth, vcNext, false)); vcNext.AddHours(earth.TimeZone.GetBiasMinutesForDay(vcNext) / 60.0); //AddEvent(vcNext, CoreEventType.CCTYPE_M_SET, 0, ndst); AddRating(vcNext, rec.rateMoonTime[1], rec.rateMoonTime[0]); vcNext.shour += 0.05; vcNext.NormalizeValues(); vcAdd.Set(vcNext); } }
public void CalculateEvents(GCLocation loc, int nYear) { //GCSunData sun = new GCSunData(); //DstTypeChange ndst = DstTypeChange.DstOff; int nData; TResultCoreEvents inEvents = this; this.Clear(); this.EarthLocation = loc; this.Year = nYear; GregorianDateTime vcStart = new GregorianDateTime(Year - 1, 12, 29); GregorianDateTime vcEnd = new GregorianDateTime(Year + 1, 1, 2); GregorianDateTime vc = new GregorianDateTime(); GregorianDateTime vcAdd = new GregorianDateTime(), vcNext = new GregorianDateTime(); GCEarthData earth = loc.GetEarthData(); vc.Set(vcStart); vc.TimezoneHours = loc.OffsetUtcHours; vcAdd.Set(vc); vcAdd.InitWeekDay(); /*while (vcAdd.IsBeforeThis(vcEnd)) * { * ndst = loc.TimeZone.DetermineDaylightChange(vcAdd); * vcAdd.NextDay(); * }*/ if (Full || GCDisplaySettings.Current.getValue(GCDS.COREEVENTS_TITHI) != 0) { vcAdd.Set(vc); vcAdd.shour = 0.0; while (vcAdd.IsBeforeThis(vcEnd)) { nData = GCTithi.GetNextTithiStart(earth, vcAdd, out vcNext); if (vcNext.GetDayInteger() < vcEnd.GetDayInteger()) { //vcNext.InitWeekDay(); //ndst = loc.TimeZone.DetermineDaylightChange(vcNext); inEvents.AddEvent(vcNext, CoreEventType.CCTYPE_TITHI, nData); } else { break; } vcAdd.Set(vcNext); vcAdd.shour += 0.2; if (vcAdd.shour >= 1.0) { vcAdd.shour -= 1.0; vcAdd.NextDay(); } } } if (Full || GCDisplaySettings.Current.getValue(GCDS.COREEVENTS_NAKSATRA) != 0) { vcAdd.Set(vc); vcAdd.shour = 0.0; while (vcAdd.IsBeforeThis(vcEnd)) { nData = GCNaksatra.GetNextNaksatra(earth, vcAdd, out vcNext); if (vcNext.GetDayInteger() < vcEnd.GetDayInteger()) { //vcNext.InitWeekDay(); //ndst = loc.TimeZone.DetermineDaylightChange(vcNext); inEvents.AddEvent(vcNext, CoreEventType.CCTYPE_NAKS, nData); } else { break; } vcAdd.Set(vcNext); vcAdd.shour += 0.2; if (vcAdd.shour >= 1.0) { vcAdd.shour -= 1.0; vcAdd.NextDay(); } } } if (Full || GCDisplaySettings.Current.getValue(GCDS.COREEVENTS_YOGA) != 0) { vcAdd.Set(vc); vcAdd.shour = 0.0; while (vcAdd.IsBeforeThis(vcEnd)) { nData = GCYoga.GetNextYogaStart(earth, vcAdd, out vcNext); if (vcNext.GetDayInteger() < vcEnd.GetDayInteger()) { //vcNext.InitWeekDay(); //ndst = loc.TimeZone.DetermineDaylightChange(vcNext); inEvents.AddEvent(vcNext, CoreEventType.CCTYPE_YOGA, nData); } else { break; } vcAdd.Set(vcNext); vcAdd.shour += 0.2; if (vcAdd.shour >= 1.0) { vcAdd.shour -= 1.0; vcAdd.NextDay(); } } } if (Full || GCDisplaySettings.Current.getValue(GCDS.COREEVENTS_SANKRANTI) != 0) { vcNext = new GregorianDateTime(); vcAdd.Set(vc); vcAdd.shour = 0.0; while (vcAdd.IsBeforeThis(vcEnd)) { vcNext.Set(GCSankranti.GetNextSankranti(vcAdd, earth, out nData)); if (vcNext.GetDayInteger() < vcEnd.GetDayInteger()) { //vcNext.InitWeekDay(); //ndst = loc.TimeZone.DetermineDaylightChange(vcNext); inEvents.AddEvent(vcNext, CoreEventType.CCTYPE_SANK, nData); } else { break; } vcAdd.Set(vcNext); vcAdd.NextDay(); } } if (Full || GCDisplaySettings.Current.getValue(GCDS.COREEVENTS_MOONRASI) != 0) { vcAdd.Set(vc); vcAdd.shour = 0.0; while (vcAdd.IsBeforeThis(vcEnd)) { nData = GCMoonData.GetNextMoonRasi(earth, vcAdd, out vcNext); if (vcNext.GetDayInteger() < vcEnd.GetDayInteger()) { //vcNext.InitWeekDay(); //ndst = loc.TimeZone.DetermineDaylightChange(vcNext); inEvents.AddEvent(vcNext, CoreEventType.CCTYPE_M_RASI, nData); } else { break; } vcAdd.Set(vcNext); vcAdd.shour += 0.5; vcAdd.NormalizeValues(); } } if (Full || GCDisplaySettings.Current.getValue(GCDS.COREEVENTS_CONJUNCTION) != 0) { double dlong; vcAdd.Set(vc); vcAdd.shour = 0.0; while (vcAdd.IsBeforeThis(vcEnd)) { dlong = GCConjunction.GetNextConjunction(vcAdd, out vcNext, true, earth); if (vcNext.GetDayInteger() < vcEnd.GetDayInteger()) { vcNext.InitWeekDay(); //ndst = loc.TimeZone.DetermineDaylightChange(vcNext); inEvents.AddEvent(vcNext, CoreEventType.CCTYPE_CONJ, GCRasi.GetRasi(dlong, GCAyanamsha.GetAyanamsa(vcNext.GetJulianComplete()))); } else { break; } vcAdd.Set(vcNext); vcAdd.NextDay(); } } inEvents.Sort(); }
/// <summary> /// Main function for CALENDAR calculations /// </summary> /// <param name="loc"></param> /// <param name="begDate"></param> /// <param name="iCount"></param> /// <returns></returns> public int CalculateCalendar(GCLocation loc, GregorianDateTime begDate, int iCount) { int i, weekday; int nTotalCount = BEFORE_DAYS + iCount + BEFORE_DAYS; GregorianDateTime date; GCEarthData earth; int lastMasa = 0; int lastGYear = 0; String tempStr; bool bCalcMoon = (GCDisplaySettings.Current.getValue(4) > 0 || GCDisplaySettings.Current.getValue(5) > 0); m_nCount = 0; m_Location = loc; m_vcStart = new GregorianDateTime(begDate); m_vcCount = iCount; earth = loc.GetEarthData(); // alokacia pola m_pData = new VAISNAVADAY[nTotalCount]; // inicializacia poctovych premennych m_nCount = nTotalCount; m_PureCount = iCount; date = new GregorianDateTime(); date.Set(begDate); date.shour = 0.0; date.TimezoneHours = loc.OffsetUtcHours; date.SubtractDays(BEFORE_DAYS); date.InitWeekDay(); weekday = date.dayOfWeek; GCFestivalSpecialExecutor exec = new GCFestivalSpecialExecutor(this); long utcDayStart = -1; long utcDayEnd = -1; // 1 // initialization of days for (i = 0; i < nTotalCount; i++) { m_pData[i] = new VAISNAVADAY(); m_pData[i].date = new GregorianDateTime(date); m_pData[i].date.dayOfWeek = weekday; date.NextDay(); weekday = (weekday + 1) % 7; m_pData[i].moonrise.SetValue(-1); m_pData[i].moonset.SetValue(-1); if (utcDayStart < 0) { utcDayStart = Convert.ToInt64(m_pData[i].date.GetJulianComplete() * 86400); } m_pData[i].UtcDayStart = utcDayStart; utcDayStart += 86400; } for (i = 0; i < nTotalCount; i++) { m_pData[i].Previous = i > 0 ? m_pData[i - 1] : null; m_pData[i].Next = i < nTotalCount - 1 ? m_pData[i + 1] : null; } TResultCoreEvents recentEvents = null; // 2 // calculating DST data and core events foreach (VAISNAVADAY t in m_pData) { t.BiasMinutes = loc.TimeZone.GetBiasMinutesForDay(t.date); if (t.Previous != null) { t.DstDayType = (t.BiasMinutes == 0 ? (t.Previous.BiasMinutes == 0 ? DstTypeChange.DstOff : DstTypeChange.DstEnd) : (t.Previous.BiasMinutes == 0 ? DstTypeChange.DstStart : DstTypeChange.DstOn)); } utcDayStart = t.UtcDayStart - (t.Previous != null ? t.Previous.BiasMinutes * 60 : 0); utcDayEnd = t.UtcDayStart + 86400 - t.BiasMinutes * 60; if (recentEvents == null || recentEvents.p_events.Count == 0 || recentEvents.Year != t.date.year) { recentEvents = GCCoreAstronomy.GetCoreEventsYear(loc, t.date.year); } recentEvents.GetCoreEvents(t.coreEvents, utcDayStart, utcDayEnd); utcDayStart = utcDayEnd; } // 3 if (bCalcMoon) { foreach (VAISNAVADAY t in m_pData) { GCMoonData.CalcMoonTimes(earth, t.date, Convert.ToDouble(t.BiasMinutes / 60.0), out t.moonrise, out t.moonset); if (!EkadasiOnly && GCDisplaySettings.Current.getValue(GCDS.CAL_MOON_RISE) != 0 && t.moonrise.hour >= 0) { tempStr = t.Format(GCStrings.Localized("Moonrise {moonRiseTime} ({dstSig})")); t.AddEvent(DisplayPriorities.PRIO_MOON, GCDS.CAL_MOON_RISE, tempStr); } if (!EkadasiOnly && GCDisplaySettings.Current.getValue(GCDS.CAL_MOON_SET) != 0 && t.moonset.hour >= 0) { tempStr = t.Format(GCStrings.Localized("Moonset {moonSetTime} ({dstSig})")); t.AddEvent(DisplayPriorities.PRIO_MOON, GCDS.CAL_MOON_SET, tempStr); } } } // 4 // init of astro data foreach (VAISNAVADAY t in m_pData) { t.astrodata = new GCAstroData(); t.astrodata.DayCalc(t.date, earth); t.coreEvents.InsertByTime(new TCoreEvent() { Time = t.UtcDayStart + (long)t.astrodata.sunArunodaya.TotalSeconds, nType = CoreEventType.CCTYPE_S_ARUN }); t.coreEvents.InsertByTime(new TCoreEvent() { Time = t.UtcDayStart + (long)t.astrodata.sunRise.TotalSeconds, nType = CoreEventType.CCTYPE_S_RISE }); t.coreEvents.InsertByTime(new TCoreEvent() { Time = t.UtcDayStart + (long)t.astrodata.sunNoon.TotalSeconds, nType = CoreEventType.CCTYPE_S_NOON }); t.coreEvents.InsertByTime(new TCoreEvent() { Time = t.UtcDayStart + (long)t.astrodata.sunSet.TotalSeconds, nType = CoreEventType.CCTYPE_S_SET }); } // 5 // init of masa foreach (VAISNAVADAY t in m_pData) { if (t.Previous == null || t.astrodata.sunRise.Paksa != t.Previous.astrodata.sunRise.Paksa) { t.astrodata.MasaCalc(t.date, earth); lastMasa = t.astrodata.Masa; lastGYear = t.astrodata.GaurabdaYear; } t.astrodata.Masa = lastMasa; t.astrodata.GaurabdaYear = lastGYear; if (!EkadasiOnly && GCDisplaySettings.Current.getValue(GCDS.CAL_SUN_LONG) != 0) { tempStr = string.Format("{0}: {1} (*)", GCStrings.Localized("Sun Longitude") , t.astrodata.sunRise.longitude); t.AddEvent(DisplayPriorities.PRIO_ASTRO, GCDS.CAL_SUN_LONG, tempStr); } if (!EkadasiOnly && GCDisplaySettings.Current.getValue(GCDS.CAL_MOON_LONG) != 0) { tempStr = string.Format("{0}: {1} (*)", GCStrings.Localized("Moon Longitude") , t.astrodata.sunRise.longitudeMoon); t.AddEvent(DisplayPriorities.PRIO_ASTRO, GCDS.CAL_MOON_LONG, tempStr); } if (!EkadasiOnly && GCDisplaySettings.Current.getValue(GCDS.CAL_AYANAMSHA) != 0) { tempStr = string.Format("{0} {1} ({2}) (*)", GCStrings.Localized("Ayanamsha") , t.astrodata.Ayanamsa , GCAyanamsha.GetAyanamsaName(GCAyanamsha.GetAyanamsaType())); t.AddEvent(DisplayPriorities.PRIO_ASTRO, GCDS.CAL_AYANAMSHA, tempStr); } if (!EkadasiOnly && GCDisplaySettings.Current.getValue(GCDS.CAL_JULIAN) != 0) { tempStr = string.Format("{0} {1} (*)", GCStrings.Localized("Julian Time") , t.astrodata.JulianDay); t.AddEvent(DisplayPriorities.PRIO_ASTRO, GCDS.CAL_JULIAN, tempStr); } } if (!EkadasiOnly && GCDisplaySettings.Current.getValue(GCDS.CAL_MASA_CHANGE) != 0) { String str; foreach (VAISNAVADAY t in m_pData) { if (t.Previous != null && t.Previous.astrodata.Masa != t.astrodata.Masa) { str = t.Format(GCStrings.Localized("First day of {masaName} Masa")); t.AddEvent(DisplayPriorities.PRIO_MASA_CHANGE, GCDS.CAL_MASA_CHANGE, str); } if (t.Next != null && t.Next.astrodata.Masa != t.astrodata.Masa) { str = t.Format(GCStrings.Localized("Last day of {masaName} Masa")); t.AddEvent(DisplayPriorities.PRIO_MASA_CHANGE, GCDS.CAL_MASA_CHANGE, str); } } } if (!EkadasiOnly && GCDisplaySettings.Current.getValue(GCDS.CAL_DST_CHANGE) != 0) { foreach (VAISNAVADAY t in m_pData) { if (t.Previous != null && t.Previous.BiasMinutes == 0 && t.BiasMinutes != 0) { t.AddEvent(DisplayPriorities.PRIO_DST_CHANGE, GCDS.CAL_DST_CHANGE, GCStrings.Localized("First day of Daylight Saving Time")); } else if (t.Next != null && t.BiasMinutes != 0 && t.Next.BiasMinutes == 0) { t.AddEvent(DisplayPriorities.PRIO_DST_CHANGE, GCDS.CAL_DST_CHANGE, GCStrings.Localized("Last day of Daylight Saving Time")); } } } // 6 // init of mahadvadasis foreach (VAISNAVADAY t in m_pData) { t.MahadvadasiCalc(earth); } // // init for Ekadasis foreach (VAISNAVADAY t in m_pData) { if (t.Previous == null) { continue; } t.EkadasiCalc(earth); if (t.Previous.nFastID == FastType.FAST_EKADASI) { t.CalculateEParana(earth); } } if (EkadasiOnly) { return(1); } // init ksaya data // init of second day of vriddhi CalculateKsayaVriddhiTithis(); // // calculate sankrantis CalculateSankrantis(); // 7 // init of festivals AddMatchedFestivals(exec); // // apply daylight saving time ApplyDaylightSavingHours(); // // resolve festivals fasting for (i = BEFORE_DAYS; i < m_PureCount + BEFORE_DAYS; i++) { ResolveFestivalsFasting(i); if (GCDisplaySettings.Current.getValue(GCDS.CAL_SUN_RISE) != 0) { tempStr = string.Format("{0}-{1}-{2} {3} - {4} - {5} ({6})", GCStrings.Localized("Sunrise"), GCStrings.Localized("Noon"), GCStrings.Localized("Sunset"), m_pData[i].astrodata.sunRise.ToShortTimeString(), m_pData[i].astrodata.sunNoon.ToShortTimeString(), m_pData[i].astrodata.sunSet.ToShortTimeString(), GCStrings.GetDSTSignature(m_pData[i].BiasMinutes)); m_pData[i].AddEvent(DisplayPriorities.PRIO_SUN, GCDS.CAL_SUN_RISE, tempStr); } if (GCDisplaySettings.Current.getValue(GCDS.CAL_SUN_SANDHYA) != 0) { tempStr = string.Format("{0}: {1} | {2} | {3} ({4})", GCStrings.Localized("Sandhyas"), m_pData[i].astrodata.sunRise.ShortSandhyaString(), m_pData[i].astrodata.sunNoon.ShortSandhyaString(), m_pData[i].astrodata.sunSet.ShortSandhyaString(), GCStrings.GetDSTSignature(m_pData[i].BiasMinutes)); m_pData[i].AddEvent(DisplayPriorities.PRIO_SUN, GCDS.CAL_SUN_SANDHYA, tempStr); } if (GCDisplaySettings.Current.getValue(GCDS.CAL_BRAHMA_MUHURTA) != 0) { tempStr = string.Format("{0}: {1} ({2})", GCStrings.Localized("Brahma Muhurta"), m_pData[i].astrodata.sunRise.ShortMuhurtaString(-2), GCStrings.GetDSTSignature(m_pData[i].BiasMinutes)); m_pData[i].AddEvent(DisplayPriorities.PRIO_SUN, GCDS.CAL_BRAHMA_MUHURTA, tempStr); } } if (GCDisplaySettings.Current.getValue(GCDS.CAL_COREEVENTS) != 0) { int number = 1; foreach (VAISNAVADAY today in m_pData) { foreach (TCoreEvent tde in today.coreEvents) { m_pData[i].AddEvent(DisplayPriorities.PRIO_ASTRO + number, GCDS.CAL_COREEVENTS, tde.TypeString + " " + today.GetCoreEventTime(tde)); number++; } } } // sorting day events according priority VAISNAVAEVENTComparer vec = new VAISNAVAEVENTComparer(); foreach (VAISNAVADAY t in m_pData) { t.dayEvents.Sort(vec); } return(1); }
public void CalculateEvents(GCLocation loc, GregorianDateTime vcStart, GregorianDateTime vcEnd) { //GCSunData sun = new GCSunData(); DstTypeChange ndst = 0; int nData; TResultEvents inEvents = this; this.Clear(); this.EarthLocation = loc; this.StartDateTime = new GregorianDateTime(vcStart); this.EndDateTime = new GregorianDateTime(vcEnd); GregorianDateTime vc = new GregorianDateTime(); GregorianDateTime vcAdd = new GregorianDateTime(), vcNext = new GregorianDateTime(); GCEarthData earth = loc.GetEarthData(); vc.Set(vcStart); vc.TimezoneHours = loc.OffsetUtcHours; vcAdd.Set(vc); vcAdd.InitWeekDay(); GCHourTime sunriseData, sunsetData; double sunRise, sunSet; double r1, r2; while (vcAdd.IsBeforeThis(vcEnd)) { sunriseData = GCSunData.CalcSunrise(vcAdd, earth); sunsetData = GCSunData.CalcSunset(vcAdd, earth); sunRise = sunriseData.TotalDays; sunSet = sunsetData.TotalDays; ndst = loc.TimeZone.DetermineDaylightChange(vcAdd); if (GCDisplaySettings.Current.getValue(GCDS.COREEVENTS_SUN) != 0) { ndst = loc.TimeZone.DetermineDaylightChange(vcAdd); vcAdd.shour = sunriseData.TotalDays - 96.0 / 1440.0; inEvents.AddEvent(vcAdd, CoreEventType.CCTYPE_S_ARUN, 0, ndst); vcAdd.shour = sunRise; inEvents.AddEvent(vcAdd, CoreEventType.CCTYPE_S_RISE, 0, ndst); vcAdd.shour = (sunRise + sunSet) / 2; inEvents.AddEvent(vcAdd, CoreEventType.CCTYPE_S_NOON, 0, ndst); vcAdd.shour = sunSet; inEvents.AddEvent(vcAdd, CoreEventType.CCTYPE_S_SET, 0, ndst); } /*if (GCDisplaySettings.Current.getValue(GCDS.COREEVENTS_ASCENDENT) != 0) * { * todayLongitude = sun.longitude_deg; * vcAdd.shour = sunRise; * todaySunriseHour = sunRise; * if (previousLongitude < -10) * { * GregorianDateTime prevSunrise = new GregorianDateTime(); * prevSunrise.Set(vcAdd); * prevSunrise.PreviousDay(); * sun.SunCalc(prevSunrise, earth); * previousSunriseHour = sun.rise.GetDayTime() - 1; * previousLongitude = sun.longitude_deg; * fromTimeLimit = 0; * } * * double a, b; * double jd = vcAdd.GetJulianComplete(); * double ayan = GCAyanamsha.GetAyanamsa(jd); * r1 = GCMath.putIn360(previousLongitude - ayan) / 30; * r2 = GCMath.putIn360(todayLongitude - ayan) / 30; * * while (r2 > r1 + 13) * { * r2 -= 12.0; * } * while (r2 < r1 + 11) * { * r2 += 12.0; * } * * a = (r2 - r1) / (todaySunriseHour - previousSunriseHour); * b = r2 - a * todaySunriseHour; * * for (double tr = Math.Floor(r1) + 1.0; tr < r2; tr += 1.0) * { * double tm = (tr - b) / a; * if (tm > fromTimeLimit) * { * vcNext.Set(vcAdd); * vcNext.shour = tm; * vcNext.NormalizeValues(); * inEvents.AddEvent(vcNext, CoreEventType.CCTYPE_ASCENDENT, (int)tr, ndst); * } * } * * previousLongitude = todayLongitude; * previousSunriseHour = todaySunriseHour - 1; * fromTimeLimit = previousSunriseHour; * }*/ if (GCDisplaySettings.Current.getValue(GCDS.COREEVENTS_RAHUKALAM) != 0) { GCSunData.CalculateKala(sunRise, sunSet, vcAdd.dayOfWeek, out r1, out r2, KalaType.KT_RAHU_KALAM); vcAdd.shour = r1; inEvents.AddEvent(vcAdd, CoreEventType.CCTYPE_KALA_START, KalaType.KT_RAHU_KALAM, ndst); vcAdd.shour = r2; inEvents.AddEvent(vcAdd, CoreEventType.CCTYPE_KALA_END, KalaType.KT_RAHU_KALAM, ndst); } if (GCDisplaySettings.Current.getValue(GCDS.COREEVENTS_YAMAGHANTI) != 0) { GCSunData.CalculateKala(sunRise, sunSet, vcAdd.dayOfWeek, out r1, out r2, KalaType.KT_YAMA_GHANTI); vcAdd.shour = r1; inEvents.AddEvent(vcAdd, CoreEventType.CCTYPE_KALA_START, KalaType.KT_YAMA_GHANTI, ndst); vcAdd.shour = r2; inEvents.AddEvent(vcAdd, CoreEventType.CCTYPE_KALA_END, KalaType.KT_YAMA_GHANTI, ndst); } if (GCDisplaySettings.Current.getValue(GCDS.COREEVENTS_GULIKALAM) != 0) { GCSunData.CalculateKala(sunRise, sunSet, vcAdd.dayOfWeek, out r1, out r2, KalaType.KT_GULI_KALAM); vcAdd.shour = r1; inEvents.AddEvent(vcAdd, CoreEventType.CCTYPE_KALA_START, KalaType.KT_GULI_KALAM, ndst); vcAdd.shour = r2; inEvents.AddEvent(vcAdd, CoreEventType.CCTYPE_KALA_END, KalaType.KT_GULI_KALAM, ndst); } if (GCDisplaySettings.Current.getValue(GCDS.COREEVENTS_ABHIJIT_MUHURTA) != 0) { GCSunData.CalculateKala(sunRise, sunSet, vcAdd.dayOfWeek, out r1, out r2, KalaType.KT_ABHIJIT); if (r1 > 0 && r2 > 0) { vcAdd.shour = r1; inEvents.AddEvent(vcAdd, CoreEventType.CCTYPE_KALA_START, KalaType.KT_ABHIJIT, ndst); vcAdd.shour = r2; inEvents.AddEvent(vcAdd, CoreEventType.CCTYPE_KALA_END, KalaType.KT_ABHIJIT, ndst); } } vcAdd.NextDay(); } if (GCDisplaySettings.Current.getValue(GCDS.COREEVENTS_ASCENDENT) != 0) { GCAscendant asc = new GCAscendant(); asc.Earth = EarthLocation.GetEarthData(); asc.CurrentDateTime = new GregorianDateTime(vc); while (asc.GetNextAscendantBefore(vcEnd)) { ndst = loc.TimeZone.DetermineDaylightChange(vcNext); inEvents.AddEvent(asc.CurrentDateTime, CoreEventType.CCTYPE_ASCENDENT, asc.CurrentSign, ndst); asc.CurrentDateTime.AddHours(0.5); } } if (GCDisplaySettings.Current.getValue(GCDS.COREEVENTS_TITHI) != 0) { vcAdd.Set(vc); vcAdd.shour = 0.0; while (vcAdd.IsBeforeThis(vcEnd)) { nData = GCTithi.GetNextTithiStart(earth, vcAdd, out vcNext); if (vcNext.GetDayInteger() < vcEnd.GetDayInteger()) { vcNext.InitWeekDay(); ndst = loc.TimeZone.DetermineDaylightChange(vcNext); inEvents.AddEvent(vcNext, CoreEventType.CCTYPE_TITHI, nData, ndst); } else { break; } vcAdd.Set(vcNext); vcAdd.shour += 0.2; if (vcAdd.shour >= 1.0) { vcAdd.shour -= 1.0; vcAdd.NextDay(); } } } if (GCDisplaySettings.Current.getValue(GCDS.COREEVENTS_NAKSATRA) != 0) { vcAdd.Set(vc); vcAdd.shour = 0.0; while (vcAdd.IsBeforeThis(vcEnd)) { nData = GCNaksatra.GetNextNaksatra(earth, vcAdd, out vcNext); if (vcNext.GetDayInteger() < vcEnd.GetDayInteger()) { vcNext.InitWeekDay(); ndst = loc.TimeZone.DetermineDaylightChange(vcNext); inEvents.AddEvent(vcNext, CoreEventType.CCTYPE_NAKS, nData, ndst); } else { break; } vcAdd.Set(vcNext); vcAdd.shour += 0.2; if (vcAdd.shour >= 1.0) { vcAdd.shour -= 1.0; vcAdd.NextDay(); } } } if (GCDisplaySettings.Current.getValue(GCDS.COREEVENTS_YOGA) != 0) { vcAdd.Set(vc); vcAdd.shour = 0.0; while (vcAdd.IsBeforeThis(vcEnd)) { nData = GCYoga.GetNextYogaStart(earth, vcAdd, out vcNext); if (vcNext.GetDayInteger() < vcEnd.GetDayInteger()) { vcNext.InitWeekDay(); ndst = loc.TimeZone.DetermineDaylightChange(vcNext); inEvents.AddEvent(vcNext, CoreEventType.CCTYPE_YOGA, nData, ndst); } else { break; } vcAdd.Set(vcNext); vcAdd.shour += 0.2; if (vcAdd.shour >= 1.0) { vcAdd.shour -= 1.0; vcAdd.NextDay(); } } } if (GCDisplaySettings.Current.getValue(GCDS.COREEVENTS_SANKRANTI) != 0) { vcNext = new GregorianDateTime(); vcAdd.Set(vc); vcAdd.shour = 0.0; while (vcAdd.IsBeforeThis(vcEnd)) { vcNext.Set(GCSankranti.GetNextSankranti(vcAdd, earth, out nData)); if (vcNext.GetDayInteger() < vcEnd.GetDayInteger()) { vcNext.InitWeekDay(); ndst = loc.TimeZone.DetermineDaylightChange(vcNext); inEvents.AddEvent(vcNext, CoreEventType.CCTYPE_SANK, nData, ndst); } else { break; } vcAdd.Set(vcNext); vcAdd.NextDay(); } } if (GCDisplaySettings.Current.getValue(GCDS.COREEVENTS_MOONRASI) != 0) { vcAdd.Set(vc); vcAdd.shour = 0.0; while (vcAdd.IsBeforeThis(vcEnd)) { nData = GCMoonData.GetNextMoonRasi(earth, vcAdd, out vcNext); if (vcNext.GetDayInteger() < vcEnd.GetDayInteger()) { vcNext.InitWeekDay(); ndst = loc.TimeZone.DetermineDaylightChange(vcNext); inEvents.AddEvent(vcNext, CoreEventType.CCTYPE_M_RASI, nData, ndst); } else { break; } vcAdd.Set(vcNext); vcAdd.shour += 0.5; vcAdd.NormalizeValues(); } } if (GCDisplaySettings.Current.getValue(GCDS.COREEVENTS_CONJUNCTION) != 0) { double dlong; vcAdd.Set(vc); vcAdd.shour = 0.0; while (vcAdd.IsBeforeThis(vcEnd)) { dlong = GCConjunction.GetNextConjunction(vcAdd, out vcNext, true, earth); if (vcNext.GetDayInteger() < vcEnd.GetDayInteger()) { vcNext.InitWeekDay(); ndst = loc.TimeZone.DetermineDaylightChange(vcNext); inEvents.AddEvent(vcNext, CoreEventType.CCTYPE_CONJ, GCRasi.GetRasi(dlong, GCAyanamsha.GetAyanamsa(vcNext.GetJulianComplete())), ndst); } else { break; } vcAdd.Set(vcNext); vcAdd.NextDay(); } } if (GCDisplaySettings.Current.getValue(GCDS.COREEVENTS_MOON) != 0) { vcAdd.Set(vc); vcAdd.shour = 0.0; while (vcAdd.IsBeforeThis(vcEnd)) { vcNext.Set(GCMoonData.GetNextRise(earth, vcAdd, true)); inEvents.AddEvent(vcNext, CoreEventType.CCTYPE_M_RISE, 0, ndst); vcNext.Set(GCMoonData.GetNextRise(earth, vcNext, false)); inEvents.AddEvent(vcNext, CoreEventType.CCTYPE_M_SET, 0, ndst); vcNext.shour += 0.05; vcNext.NormalizeValues(); vcAdd.Set(vcNext); } } if (GCDisplaySettings.Current.getValue(GCDS.COREEVENTS_ASCENDENT) != 0) {/* * vcAdd = vc; * vcAdd.shour = 0.0; * while(vcAdd.IsBeforeThis(vcEnd)) * { * nData = earth.GetNextAscendentStart(vcAdd, vcNext); * if (vcNext.GetDayInteger() < vcEnd.GetDayInteger()) * { * vcNext.InitWeekDay(); * ndst = TTimeZone.determineDaylightChange(vcNext, loc.m_nDST); * inEvents.AddEvent(vcNext, CCTYPE_ASCENDENT, nData, ndst); * } * else * { * break; * } * vcAdd = vcNext; * vcAdd.shour += 1/24.0; * if (vcAdd.shour >= 1.0) * { * vcAdd.shour -= 1.0; * vcAdd.NextDay(); * } * } * */ } if (GCDisplaySettings.Current.getValue(GCDS.COREEVENTS_SORT) != 0) { inEvents.Sort(SORTING_BY_DATE); } else { inEvents.Sort(SORTING_BY_TYPE); } }