Exemplo n.º 1
0
        /**
         * Computes the sunset 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 sunset"
         *            corresponds to 6 degrees.
         * @return the requested sunset time as a <code>Calendar</code> object.
         */

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

            return(solarEventCalculator.computeSunsetCalendar(new Zenith(90 - degrees), date));
        }
Exemplo n.º 2
0
 /**
  * Returns the astronomical (108deg) sunset for the given date.
  *
  * @param date
  *            <code>Calendar</code> object containing the date to compute the astronomical sunset for.
  * @return the astronomical sunset time as a Calendar
  */
 public Calendar getAstronomicalSunsetCalendarForDate(Calendar date)
 {
     return(calculator.computeSunsetCalendar(Zenith.ASTRONOMICAL, date));
 }