Пример #1
0
 /**
  * Returns the astronomical (108deg) sunrise for the given date.
  *
  * @param date
  *            <code>Calendar</code> object containing the date to compute the astronomical sunrise for.
  * @return the astronomical sunrise time as a Calendar
  */
 public Calendar getAstronomicalSunriseCalendarForDate(Calendar date)
 {
     return(calculator.computeSunriseCalendar(Zenith.ASTRONOMICAL, date));
 }
Пример #2
0
        /**
         * Computes the sunrise for an arbitrary declination.
         *
         * @param latitude
         * @param longitude
         *            Coordinates for the location to compute the sunrise/sunset for.
         * @param timeZone
         *            timezone to compute the sunrise/sunset times in.
         * @param date
         *            <code>Calendar</code> object containing the date to compute the official sunset for.
         * @param degrees
         *            Angle under the horizon for which to compute sunrise. For example, "civil sunrise"
         *            corresponds to 6 degrees.
         * @return the requested sunset time as a <code>Calendar</code> object.
         */

        public static Calendar getSunrise(double latitude, double longitude, TimeZone timeZone, Calendar date, double degrees)
        {
            SolarEventCalculator solarEventCalculator = new SolarEventCalculator(new Location(latitude, longitude), timeZone);

            return(solarEventCalculator.computeSunriseCalendar(new Zenith(90 - degrees), date));
        }