public static void CalcMoonTimes(GPLocationProvider e, GPGregorianTime vc, out GPGregorianTime rise, out GPGregorianTime set) { double UT; rise = null; set = null; // inicializacia prvej hodnoty ELEVATION vc.setDayHours(0.0); vc.normalizeValues(); UT = vc.getJulianGreenwichTime(); GPJulianTime start = new GPJulianTime(); GPJulianTime time; start.setLocalJulianDay(vc.getJulianGreenwichTime()); TRiseSet rs; set = null; rise = null; time = GPAstroEngine.GetNextMoonEvent(start, e, out rs); while (time.getLocalJulianDay() < UT + 1) { GPGregorianTime gt = new GPGregorianTime(e, time); if (rs == TRiseSet.RISE && rise == null) { rise = gt; } else if (rs == TRiseSet.SET && set == null) { set = gt; } time = GPAstroEngine.GetNextMoonEvent(time, e, out rs); } }
/// <summary> /// Recalculation of sunrise time for given travelling /// </summary> /// <param name="sun"></param> /// <param name="locChange"></param> private static void recalculateSunriseTravel(GPSun sun, GPLocationChange locChange) { GPSun newSun = new GPSun(); double drStep = 0.5; double dr = 0.0; int steps = 0; while (steps < 25) { GPLocation lp = locChange.getTravellingLocation(dr); double jd = locChange.julianStart + (locChange.julianEnd - locChange.julianStart) * dr; GPGregorianTime gt = new GPGregorianTime(lp); gt.setJulianGreenwichTime(jd); GPLocationProvider lpr = new GPLocationProvider(lp); newSun.calculateRise(sun.rise, lpr); newSun.updateSunriseTimes(sun.rise, lpr); if (gt.getJulianGreenwichTime() > newSun.rise.getJulianGreenwichTime()) { drStep = drStep / 2; dr -= drStep; } else { dr += drStep; } steps++; } sun.rise = newSun.rise; sun.sunrise_deg = newSun.sunrise_deg; sun.eclipticalLongitude = newSun.eclipticalLongitude; }
/*********************************************************************/ /* */ /* finds next time when starts next yoga */ /* */ /* timezone is not changed */ /* */ /* return value: index of yoga 0..26 */ /* or -1 if failed */ /*********************************************************************/ public static int GetNextStart(GPGregorianTime startDate, out GPGregorianTime nextDate) { double phi = 40 / 3.0; double l1, l2, sunl; double jday = startDate.getJulianGreenwichTime(); double xj; double ayanamsa = GPAyanamsa.GetAyanamsa(jday); GPMoon moon = new GPMoon(); GPGregorianTime d = new GPGregorianTime(startDate); GPGregorianTime xd = new GPGregorianTime(startDate.getLocationProvider()); double scan_step = 0.5; int prev_tit = 0; int new_tit = -1; moon.MoonCalc(jday); sunl = GPSun.GetSunLongitude(jday); l1 = GPMath.putIn360(moon.longitude_deg + sunl - 2 * ayanamsa); prev_tit = Convert.ToInt32(Math.Floor(l1 * 3 / 40.0)); int counter = 0; while (counter < 20) { xj = jday; xd.Copy(d); jday += scan_step; d.setDayHours(d.getDayHours() + scan_step); if (d.getDayHours() > 1.0) { d.setDayHours(d.getDayHours() - 1.0); d.NextDay(); } moon.MoonCalc(jday); //SunPosition(d, ed, sun, d.shour - 0.5 + d.tzone/24.0); //l2 = put_in_360(moon.longitude_deg - sun.longitude_deg - 180.0); sunl = GPSun.GetSunLongitude(jday); l2 = GPMath.putIn360(moon.longitude_deg + sunl - 2 * ayanamsa); //Debugger.Log(0, "", "Current position: " + l2/12.0 + " date: " + jday + "\n"); new_tit = Convert.ToInt32(Math.Floor(l2 / phi)); if (prev_tit != new_tit) { jday = xj; d.Copy(xd); scan_step *= 0.5; counter++; continue; } else { l1 = l2; } } nextDate = d; // nextDate.shour += startDate.tzone / 24.0; // nextDate.NormalizeValues(); return(new_tit); }
public List <GPLocation> getLocationList() { List <GPLocation> locList = new List <GPLocation>(); double start = m_vcStart.getJulianGreenwichTime(); double end = m_vcEnd.getJulianGreenwichTime(); if (m_location.getChangeCount() > 0) { for (int i = 0; i < m_location.getChangeCount(); i++) { GPLocationChange lc = m_location.getChangeAtIndex(i); if ((lc.julianStart >= start && lc.julianStart <= end) && (lc.julianEnd >= start && lc.julianEnd <= end)) { addLocationToList(lc.LocationA, locList); addLocationToList(lc.LocationB, locList); } } } else { addLocationToList(m_location.getLocationAtIndex(0), locList); } return(locList); }
/*********************************************************************/ /* */ /* finds previous time when starts next yoga */ /* */ /* timezone is not changed */ /* */ /* return value: index of yoga 0..26 */ /* or -1 if failed */ /*********************************************************************/ public static int GetPrevStart(GPGregorianTime startDate, out GPGregorianTime nextDate) { double phi = 12.0; double l1, l2, sunl; double jday = startDate.getJulianGreenwichTime(); double xj; double ayanamsa = GPAyanamsa.GetAyanamsa(jday); GPMoon moon = new GPMoon(); GPGregorianTime d = new GPGregorianTime(startDate); GPGregorianTime xd = new GPGregorianTime(startDate.getLocationProvider()); double scan_step = 0.5; int prev_tit = 0; int new_tit = -1; moon.MoonCalc(jday); sunl = GPSun.GetSunLongitude(jday); l1 = GPMath.putIn360(moon.longitude_deg + sunl - 2 * ayanamsa); prev_tit = Convert.ToInt32(Math.Floor(l1 / phi)); int counter = 0; while (counter < 20) { xj = jday; xd.Copy(d); jday -= scan_step; d.setDayHours(d.getDayHours() - scan_step); if (d.getDayHours() < 0.0) { d.setDayHours(d.getDayHours() + 1.0); d.PreviousDay(); } moon.MoonCalc(jday); sunl = GPSun.GetSunLongitude(jday); l2 = GPMath.putIn360(moon.longitude_deg + sunl - 2 * ayanamsa); new_tit = Convert.ToInt32(Math.Floor(l2 / phi)); if (prev_tit != new_tit) { jday = xj; d.Copy(xd); scan_step *= 0.5; counter++; continue; } else { l1 = l2; } } nextDate = d; // nextDate.shour += startDate.tzone / 24.0; // nextDate.NormalizeValues(); return(new_tit); }
/*********************************************************************/ /* */ /* finds previous time when starts next naksatra */ /* */ /* timezone is not changed */ /* */ /* return value: index of naksatra 0..26 */ /* or -1 if failed */ /*********************************************************************/ public static int GetPrevNaksatra(GPGregorianTime startDate, out GPGregorianTime nextDate) { double phi = 40.0 / 3.0; double l1, l2; double jday = startDate.getJulianGreenwichTime(); GPMoon moon = new GPMoon(); GPGregorianTime d = new GPGregorianTime(startDate); double ayanamsa = GPAyanamsa.GetAyanamsa(jday); double scan_step = 0.5; int prev_naks = 0; int new_naks = -1; double xj; GPGregorianTime xd = new GPGregorianTime(startDate.getLocationProvider()); moon.MoonCalc(jday); l1 = GPMath.putIn360(moon.longitude_deg - ayanamsa); prev_naks = Convert.ToInt32(Math.Floor(l1 / phi)); int counter = 0; while (counter < 20) { xj = jday; xd.Copy(d); jday -= scan_step; d.setDayHours(d.getDayHours() - scan_step); if (d.getDayHours() < 0.0) { d.setDayHours(d.getDayHours() + 1.0); d.PreviousDay(); } moon.MoonCalc(jday); l2 = GPMath.putIn360(moon.longitude_deg - ayanamsa); new_naks = Convert.ToInt32(Math.Floor(l2 / phi)); if (prev_naks != new_naks) { jday = xj; d.Copy(xd); scan_step *= 0.5; counter++; continue; } else { l1 = l2; } } nextDate = d; return(new_naks); }
/*********************************************************************/ /* Finds next time when rasi is changed */ /* */ /* startDate - starting date and time, timezone member must be valid */ /* zodiac [out] - found zodiac sign into which is changed */ /* */ /*********************************************************************/ public static GPGregorianTime GetNextSankranti(GPGregorianTime startDate, out int zodiac) { GPGregorianTime d; double step = 1.0; int count = 0; double ld, prev; int prev_rasi, new_rasi; GPGregorianTime prevday = new GPGregorianTime(startDate.getLocation()); zodiac = 0; d = new GPGregorianTime(startDate); double jdate = d.getJulianGreenwichTime(); prev = GPMath.putIn360(GPSun.GetSunLongitude(jdate) - GPAyanamsa.GetAyanamsa(jdate)); prev_rasi = Convert.ToInt32(Math.Floor(prev / 30.0)); while (count < 20) { prevday.Copy(d); d.setDayHours(d.getDayHours() + step); if (d.getDayHours() > 1.0) { d.setDayHours(d.getDayHours() - 1.0); d.NextDay(); } jdate = d.getJulianGreenwichTime(); ld = GPMath.putIn360(GPSun.GetSunLongitude(jdate) - GPAyanamsa.GetAyanamsa(jdate)); new_rasi = Convert.ToInt32(Math.Floor(ld / 30.0)); if (prev_rasi != new_rasi) { zodiac = new_rasi; //v uplynulom dni je sankranti step *= 0.5; d.Copy(prevday); count++; continue; } } return(d); }
/*********************************************************************/ /* */ /* Calculation of tithi, paksa, naksatra, yoga for given */ /* Gregorian date */ /* */ /* */ /*********************************************************************/ public int calculateDayData(GPGregorianTime aDate, GPLocationProvider earth) { double d; GPAstroData day = this; GPGregorianTime date = new GPGregorianTime(aDate); // SUNDATA sun; // sun position on sunrise on that day sun.SunCalc(date, earth); date.setDayHours(sun.getSunriseDayHours()); // date.shour is [0..1] time of sunrise in local timezone time jdate = date.getJulianGreenwichTime(); // moon position at sunrise on that day day.moon.MoonCalc(jdate); // correct_parallax(day.moon, jdate, earth.latitude_deg, earth.longitude_deg); day.msDistance = GPMath.putIn360(day.moon.longitude_deg - day.sun.eclipticalLongitude - 180.0); day.msAyanamsa = GPAyanamsa.GetAyanamsa(jdate); // tithi d = day.msDistance / 12.0; day.nTithi = Convert.ToInt32(Math.Floor(d)); day.nTithiElapse = GPMath.frac(d) * 100.0; day.nPaksa = (day.nTithi >= 15) ? 1 : 0; // naksatra d = GPMath.putIn360(day.moon.longitude_deg - day.msAyanamsa); d = (d * 3.0) / 40.0; day.nNaksatra = Convert.ToInt32(Math.Floor(d) + 0.1); day.nNaksatraElapse = GPMath.frac(d) * 100.0; // yoga d = GPMath.putIn360(day.moon.longitude_deg + day.sun.eclipticalLongitude - 2 * day.msAyanamsa); d = (d * 3.0) / 40.0; day.nYoga = Convert.ToInt32(Math.Floor(d)); day.nYogaElapse = GPMath.frac(d) * 100.0; // masa day.nMasa = -1; // rasi day.nSunRasi = GPEngine.GetRasi(day.sun.eclipticalLongitude, day.msAyanamsa); day.nMoonRasi = GPEngine.GetRasi(day.moon.longitude_deg, day.msAyanamsa); setDate(date); return(1); }
public static int GetNextRasi(GPGregorianTime startDate, out GPGregorianTime nextDate) { double jday = startDate.getJulianGreenwichTime(); GPMoon moon = new GPMoon(); GPGregorianTime d = new GPGregorianTime(startDate); double ayanamsa = GPAyanamsa.GetAyanamsa(jday); double scan_step = 0.5; int prev_naks = 0; int new_naks = -1; double xj; GPGregorianTime xd = new GPGregorianTime(startDate.getLocationProvider()); moon.MoonCalc(jday); //l1 = GPMath.putIn360(moon.longitude_deg - ayanamsa); prev_naks = GPEngine.GetRasi(moon.longitude_deg, ayanamsa); int counter = 0; while (counter < 20) { xj = jday; xd.Copy(d); jday += scan_step; d.setDayHours(d.getDayHours() + scan_step); if (d.getDayHours() > 1.0) { d.setDayHours(d.getDayHours() - 1.0); d.NextDay(); } moon.MoonCalc(jday); //l2 = GPMath.putIn360(moon.longitude_deg - ayanamsa); new_naks = GPEngine.GetRasi(moon.longitude_deg, ayanamsa); if (prev_naks != new_naks) { jday = xj; d.Copy(xd); scan_step *= 0.5; counter++; continue; } } nextDate = d; return(new_naks); }
// return values are in sun.arunodaya, sun.rise, sun.set, sun.noon, sun.length // if values are less than zero, that means, no sunrise, no sunset in that day // // brahma 1 = calculation at brahma muhurta begining // brahma 0 = calculation at sunrise public void SunCalc(GPGregorianTime vct, GPLocationProvider earth) { if (sunPosMethod == SUNPOSMETHOD_CALCULATOR) { GPSun s_rise = new GPSun(); GPSun s_set = new GPSun(); // first calculation // for 12:00 universal time s_rise.calculateRise(vct, earth); // first calculation // for 12:00 universal time s_set.calculateSet(vct, earth); // calculate times longitude_arun_deg = s_rise.eclipticalLongitude - (24.0 / 365.25); eclipticalLongitude = s_rise.eclipticalLongitude; rightAscession = s_rise.rightAscession; longitude_set_deg = s_set.eclipticalLongitude; sunrise_deg = s_rise.sunrise_deg; sunset_deg = s_set.sunset_deg; } else { calculateRiseSet(vct, earth, 180); double gmt = vct.getJulianGreenwichNoon(); longitude_arun_deg = GPAstroEngine.sunLongitudeMethodM(julianDayRise - 96 / 1440.0); eclipticalLongitude = GPAstroEngine.sunLongitudeMethodM(julianDayRise); longitude_set_deg = GPAstroEngine.sunLongitudeMethodM(julianDaySet); } updateSunriseTimes(vct, earth); updateNoonTimes(vct, earth); updateSetTimes(vct, earth); List <GPLocationChange> chr = earth.getChangesForJulianDay(arunodaya.getJulianGreenwichNoon()); processTravellingChanges(chr); // finally calculate length of the daylight DayLength = (set.getJulianGreenwichTime() - rise.getJulianGreenwichTime()) * 24.0; }
/// <summary> /// recalculation of arunodaya time for given travelling /// </summary> /// <param name="sun"></param> /// <param name="locChange"></param> private static void recalculateArunodayaTravel(GPSun sun, GPLocationChange locChange) { GPSun newSun = new GPSun(); double drStep = 0.5; double dr = 0.0; int steps = 0; while (steps < 25) { GPLocation lp = locChange.getTravellingLocation(dr); double jd = locChange.julianStart + (locChange.julianEnd - locChange.julianStart) * dr; GPGregorianTime gt = new GPGregorianTime(lp); gt.setJulianGreenwichTime(jd); GPLocationProvider lpr = new GPLocationProvider(lp); newSun.calculateRise(sun.rise, lpr); newSun.updateSunriseTimes(sun.rise, lpr); // Debugger.Log(0, "", String.Format("ROW: {0} {1} {2} {3}\n", lp.getLongitudeString(), lp.getLatitudeString(), // newSun.rise.getLongTimeString(), gt.getLongTimeString())); if (gt.getJulianGreenwichTime() > newSun.arunodaya.getJulianGreenwichTime()) { drStep = drStep / 2; dr -= drStep; } else { dr += drStep; } steps++; } sun.arunodaya = newSun.arunodaya; sun.arunodaya_deg = newSun.arunodaya_deg; sun.longitude_arun_deg = newSun.longitude_arun_deg; }
public void setStartDate(GPGregorianTime st) { pStartDate = new GPGregorianTime(st); pJulianDate = pStartDate.getJulianGreenwichTime(); pJulianDate = GPAstroEngine.ConvertUniversalToDynamic(pJulianDate); }
public void calculateAppearanceDayData(GPLocationProvider aLocation, GPGregorianTime aEvente) { //MOONDATA moon; //SUNDATA sun; location = aLocation; evente = new GPGregorianTime(aEvente); double dd; GPAstroData d = details; GPGregorianTime vc = evente; GPGregorianTime vcsun = evente; b_adhika = false; d.calculateDayData(aEvente, aLocation); //d.nTithi = GetPrevTithiStart(m_earth, vc, dprev); //GetNextTithiStart(m_earth, vc, dnext); //vcsun.setDayHours(vcsun.getDayHours() - vcsun.getTimeZoneOffsetHours() / 24.0); vcsun.normalizeValues(); d.sun.calculateCoordinatesMethodC(vcsun, -1); d.moon.MoonCalc(vcsun.getJulianGreenwichTime()); d.msDistance = GPMath.putIn360(d.moon.longitude_deg - d.sun.eclipticalLongitude - 180.0); d.msAyanamsa = GPAyanamsa.GetAyanamsa(vc.getJulianGreenwichTime()); // tithi dd = d.msDistance / 12.0; d.nTithi = Convert.ToInt32(Math.Floor(dd)); d.nTithiElapse = GPMath.frac(dd) * 100.0; d.nPaksa = (d.nTithi >= 15) ? 1 : 0; // naksatra dd = GPMath.putIn360(d.moon.longitude_deg - d.msAyanamsa); dd = (dd * 3.0) / 40.0; d.nNaksatra = Convert.ToInt32(Math.Floor(dd)); d.nNaksatraElapse = GPMath.frac(dd) * 100.0; d.nMasa = d.determineMasa(vc, out d.nGaurabdaYear); d.nMoonRasi = GPEngine.GetRasi(d.moon.longitude_deg, d.msAyanamsa); d.nSunRasi = GPEngine.GetRasi(d.sun.eclipticalLongitude, d.msAyanamsa); if (d.nMasa == GPMasa.ADHIKA_MASA) { d.nMasa = GPEngine.GetRasi(d.sun.eclipticalLongitude, d.msAyanamsa); b_adhika = true; } string dstApplicable = ""; //List<string> gstr = GPStrings.getSharedStrings().gstr; output.Add(new GPStringPair(GPStrings.getString(25), "", true)); output.Add(new GPStringPair(GPStrings.getString(7), vc.ToString())); output.Add(new GPStringPair(GPStrings.getString(8), vc.getShortTimeString(true, ref dstApplicable))); output.Add(new GPStringPair(GPStrings.getString(9), vc.getLocation().getFullName())); //output.Add(new GPStringPair(gstr[10], vc.getLocation().getLatitudeString())); //output.Add(new GPStringPair(gstr[11], vc.getLocation().getLongitudeString())); //output.Add(new GPStringPair(gstr[12], vc.getLocation().getTimeZoneName())); //output.Add(new GPStringPair(gstr[1001], dstApplicable)); output.Add(new GPStringPair(GPStrings.getString(13), GPTithi.getName(d.nTithi))); output.Add(new GPStringPair(GPStrings.getString(14), string.Format("{0:0.###} %", d.nTithiElapse))); output.Add(new GPStringPair(GPStrings.getString(15), GPNaksatra.getName(d.nNaksatra))); output.Add(new GPStringPair(GPStrings.getString(16), string.Format("{0:0.###} % ({1})", d.nNaksatraElapse, GPStrings.getString(811 + Convert.ToInt32(d.nNaksatraElapse / 25.0))))); output.Add(new GPStringPair(GPStrings.getString(991), GPSankranti.getName(d.nMoonRasi))); output.Add(new GPStringPair(GPStrings.getString(992), GPSankranti.getName(d.nSunRasi))); output.Add(new GPStringPair(GPStrings.getString(20), GPPaksa.getName(d.nPaksa))); if (b_adhika == true) { output.Add(new GPStringPair(GPStrings.getString(22), string.Format("{0} {1}", GPMasa.GetName(d.nMasa), GPStrings.getString(21)))); } else { output.Add(new GPStringPair(GPStrings.getString(22), GPMasa.GetName(d.nMasa))); } output.Add(new GPStringPair(GPStrings.getString(23), d.nGaurabdaYear.ToString())); if (GPDisplays.AppDay.childNameSuggestions()) { output.Add(new GPStringPair()); output.Add(new GPStringPair(GPStrings.getString(17), "", true)); output.Add(new GPStringPair()); output.Add(new GPStringPair(GPStrings.getString(18), string.Format("{0}...", GPAppHelper.GetNaksatraChildSylable(d.nNaksatra, Convert.ToInt32(d.nNaksatraElapse / 25.0))))); output.Add(new GPStringPair(GPStrings.getString(19), string.Format("{0}...", GPAppHelper.GetRasiChildSylable(d.nMoonRasi)))); } vc.Today(); GPVedicTime va = new GPVedicTime(); GPGregorianTime vctemp; va.tithi = d.nTithi; va.masa = d.nMasa; va.gyear = GPGaurabdaYear.getGaurabdaYear(vc, location); if (va.gyear < d.nGaurabdaYear) { va.gyear = d.nGaurabdaYear; } int countC = GPUserDefaults.IntForKey("appday.celebs", 3); if (countC > 0) { output.Add(new GPStringPair()); output.Add(new GPStringPair(GPStrings.getString(24), "", true)); output.Add(new GPStringPair()); } int m = 0; for (int i = 0; i < 6; i++) { GPEngine.VATIMEtoVCTIME(va, out vctemp, location); if (va.gyear > d.nGaurabdaYear) { if (m < countC) { output.Add(new GPStringPair(string.Format("{0} {1}", GPStrings.getString(994), va.gyear), vctemp.ToString())); m++; } } va.gyear++; } }
public void CalculateEvents(GPLocationProvider loc, GPGregorianTime vcStart, GPGregorianTime vcEnd) { GPCoreEventResults inEvents = this; GPLocationProvider earth = loc; GPGregorianTime vc = new GPGregorianTime(loc); GPSun sun = new GPSun(); //int ndst = 0; int nData; inEvents.clear(); inEvents.m_location = loc; inEvents.m_vcStart = vcStart; inEvents.m_vcEnd = vcEnd; GPGregorianTime vcAdd = new GPGregorianTime(loc); GPGregorianTime vcTemp = null; GPGregorianTime vcNext = new GPGregorianTime(loc); vc.Copy(vcStart); if (GPDisplays.CoreEvents.Sunrise()) { vcAdd.Copy(vc); while (vcAdd.IsBeforeThis(vcEnd)) { sun.SunCalc(vcAdd, earth); vcTemp = new GPGregorianTime(sun.arunodaya); inEvents.AddEvent(vcTemp, GPConstants.CCTYPE_S_ARUN, 0); //GPJulianTime tr, tt, ts; //GPAstroEngine.CalculateTimeSun(vcTemp, vcTemp.getLocation(), out tr, out tt, out ts); vcTemp = new GPGregorianTime(sun.rise); //vcTemp = new GPGregorianTime(vcTemp.getLocation(), tr); inEvents.AddEvent(vcTemp, GPConstants.CCTYPE_S_RISE, 0); vcTemp = new GPGregorianTime(sun.noon); //vcTemp = new GPGregorianTime(vcTemp.getLocation(), tt); inEvents.AddEvent(vcTemp, GPConstants.CCTYPE_S_NOON, 0); vcTemp = new GPGregorianTime(sun.set); //vcTemp = new GPGregorianTime(vcTemp.getLocation(), ts); inEvents.AddEvent(vcTemp, GPConstants.CCTYPE_S_SET, 0); vcAdd.NextDay(); } } if (GPDisplays.CoreEvents.Tithi()) { GPTithi te = new GPTithi(); te.setStartDate(vc); vcAdd = te.getNext(); while (vcAdd.IsBeforeThis(vcEnd)) { nData = te.getCurrentPosition(); //ndst = loc.getTimeZone().GetDaylightChangeType(vcNext); inEvents.AddEvent(vcAdd, GPConstants.CCTYPE_TITHI, nData); vcAdd = te.getNext(); } } if (GPDisplays.CoreEvents.Naksatra()) { GPNaksatra te = new GPNaksatra(); te.setStartDate(vc); vcAdd = te.getNext(); while (vcAdd.IsBeforeThis(vcEnd)) { nData = te.getCurrentNaksatra(); //ndst = loc.getTimeZone().GetDaylightChangeType(vcNext); inEvents.AddEvent(vcAdd, GPConstants.CCTYPE_NAKS, nData); vcAdd = te.getNext(); } } if (GPDisplays.CoreEvents.Sankranti()) { GPSankranti te = new GPSankranti(); te.setStartDate(vc); vcAdd = te.getNext(); while (vcAdd.IsBeforeThis(vcEnd)) { nData = te.getCurrentPosition(); //ndst = loc.getTimeZone().GetDaylightChangeType(vcNext); inEvents.AddEvent(vcAdd, GPConstants.CCTYPE_SANK, nData); vcAdd = te.getNext(); } } if (GPDisplays.CoreEvents.Conjunction()) { double[] times = null; GPConjunction te = new GPConjunction(); te.setStartDate(vc); vcAdd = te.getNext(); while (vcAdd.IsBeforeThis(vcEnd)) { nData = te.getCurrentPosition(); //ndst = loc.getTimeZone().GetDaylightChangeType(vcNext); inEvents.AddEvent(vcAdd, GPConstants.CCTYPE_CONJ, nData); if (GPDisplays.CoreEvents.SunEclipse()) { GPAstroEngine.CalculateTimesSunEclipse(vcAdd.getJulianGreenwichTime(), vcAdd.getLocation(), out times); if (times != null && times[2] > 0) { for (int i = 0; i < 5; i++) { if (times[i] > 0) { GPGregorianTime gt = new GPGregorianTime(vcAdd.getLocation()); gt.setJulianGreenwichTime(new GPJulianTime(times[i], 0.0)); inEvents.AddEvent(gt, GPConstants.SUNECLIPSE_CONSTS[i], 0); } } } } vcAdd = te.getNext(); } } // moon eclipses if (GPDisplays.CoreEvents.MoonEclipse()) { double[] times = null; GPConjunction te = new GPConjunction(); te.setOpositeConjunction(true); te.setStartDate(vc); vcAdd = te.getNext(); while (vcAdd.IsBeforeThis(vcEnd)) { GPAstroEngine.CalculateTimesMoonEclipse(vcAdd.getJulianGreenwichTime(), vcAdd.getLocation(), out times); if (times != null && times[4] > 0) { for (int i = 0; i < 9; i++) { if (times[i] > 0 && GPConstants.MOONECLIPSE_CONSTS[i] > 0) { GPGregorianTime gt = new GPGregorianTime(vcAdd.getLocation()); gt.setJulianGreenwichTime(new GPJulianTime(times[i], 0.0)); inEvents.AddEvent(gt, GPConstants.MOONECLIPSE_CONSTS[i], 0); } } } vcAdd = te.getNext(); } } // rise and set of the moon if (GPDisplays.CoreEvents.Moonrise()) { GPJulianTime julian = vc.getJulian(); GPJulianTime julianEnd = vcEnd.getJulian(); GPJulianTime nextJulian; TRiseSet kind; while (julian.getGreenwichJulianDay() < julianEnd.getGreenwichJulianDay()) { nextJulian = GPAstroEngine.GetNextMoonEvent(julian, vc.getLocationProvider(), out kind); if (kind == TRiseSet.RISE) { inEvents.AddEvent(new GPGregorianTime(loc, nextJulian), GPConstants.CoreEventMoonRise, 0); } else if (kind == TRiseSet.SET) { inEvents.AddEvent(new GPGregorianTime(loc, nextJulian), GPConstants.CoreEventMoonSet, 0); } julian.setGreenwichJulianDay(nextJulian.getGreenwichJulianDay() + 10.0 / 1440.0); } } // travellings { GPJulianTime julian = vc.getJulian(); GPJulianTime julianEnd = vcEnd.getJulian(); double start, end; start = julian.getGreenwichJulianDay(); end = julianEnd.getGreenwichJulianDay(); for (int i = 0; i < loc.getChangeCount(); i++) { GPLocationChange chn = loc.getChangeAtIndex(i); if ((chn.julianStart >= start && chn.julianStart <= end) || (chn.julianStart >= start && chn.julianEnd <= end)) { GPGregorianTime startTime = new GPGregorianTime(chn.LocationA); startTime.setJulianGreenwichTime(new GPJulianTime(chn.julianStart, 0)); GPGregorianTime endTime = new GPGregorianTime(chn.LocationB); endTime.setJulianGreenwichTime(new GPJulianTime(chn.julianEnd, 0)); inEvents.AddEvent(startTime, GPConstants.CCTYPE_TRAVELLING_START, 0); inEvents.AddEvent(endTime, GPConstants.CCTYPE_TRAVELLING_END, 0); } } } // eventual sorting inEvents.Sort(GPDisplays.CoreEvents.Sort()); }