public void TestCoverage() { IBM.ICU.Util.GregorianCalendar cal = new IBM.ICU.Util.GregorianCalendar(1958, IBM.ICU.Util.Calendar.AUGUST, 15); DateTime then = cal.GetTime(); CalendarAstronomer myastro = new CalendarAstronomer(then); // Latitude: 34 degrees 05' North // Longitude: 118 degrees 22' West double laLat = 34 + 5d / 60, laLong = 360 - (118 + 22d / 60); CalendarAstronomer myastro2 = new CalendarAstronomer(laLong, laLat); double eclLat = laLat * System.Math.PI / 360; double eclLong = laLong * System.Math.PI / 360; IBM.ICU.Impl.CalendarAstronomer.Ecliptic ecl = new IBM.ICU.Impl.CalendarAstronomer.Ecliptic(eclLat, eclLong); Logln("ecliptic: " + ecl); CalendarAstronomer myastro3 = new CalendarAstronomer(); myastro3.SetJulianDay((4713 + 2000) * 365.25d); CalendarAstronomer[] astronomers = { myastro, myastro2, myastro3, myastro2 // check cache }; for (int i = 0; i < astronomers.Length; ++i) { CalendarAstronomer astro = astronomers[i]; Logln("astro: " + astro); Logln(" time: " + astro.GetTime()); Logln(" date: " + astro.GetDate()); Logln(" cent: " + astro.GetJulianCentury()); Logln(" gw sidereal: " + astro.GetGreenwichSidereal()); Logln(" loc sidereal: " + astro.GetLocalSidereal()); Logln(" equ ecl: " + astro.EclipticToEquatorial(ecl)); Logln(" equ long: " + astro.EclipticToEquatorial(eclLong)); Logln(" horiz: " + astro.EclipticToHorizon(eclLong)); Logln(" sunrise: " + DateUtil.DateFromJavaMillis(astro.GetSunRiseSet(true))); Logln(" sunset: " + DateUtil.DateFromJavaMillis(astro.GetSunRiseSet(false))); Logln(" moon phase: " + astro.GetMoonPhase()); Logln(" moonrise: " + DateUtil.DateFromJavaMillis(astro.GetMoonRiseSet(true))); Logln(" moonset: " + DateUtil.DateFromJavaMillis(astro.GetMoonRiseSet(false))); Logln(" prev summer solstice: " + DateUtil.DateFromJavaMillis(astro.GetSunTime( IBM.ICU.Impl.CalendarAstronomer.SUMMER_SOLSTICE, false))); Logln(" next summer solstice: " + DateUtil.DateFromJavaMillis(astro.GetSunTime( IBM.ICU.Impl.CalendarAstronomer.SUMMER_SOLSTICE, true))); Logln(" prev full moon: " + DateUtil.DateFromJavaMillis(astro.GetMoonTime(IBM.ICU.Impl.CalendarAstronomer.FULL_MOON, false))); Logln(" next full moon: " + DateUtil.DateFromJavaMillis(astro.GetMoonTime(IBM.ICU.Impl.CalendarAstronomer.FULL_MOON, true))); } }
public void TestCoordinates() { CalendarAstronomer astro = new CalendarAstronomer(); IBM.ICU.Impl.CalendarAstronomer.Equatorial result = astro.EclipticToEquatorial(139.686111d * PI / 180.0d, 4.875278d * PI / 180.0d); Logln("result is " + result + "; " + result.ToHmsString()); }