Exemplo n.º 1
0
 /**
  * Constructs a new <code>SunriseSunsetCalculator</code> with the given <code>Location</code>
  *
  * @param location
  *            <code>Location</code> object containing the Latitude/Longitude of the location to compute
  *            the sunrise/sunset for.
  * @param timeZoneIdentifier
  *            String identifier for the timezone to compute the sunrise/sunset times in. In the form
  *            "America/New_York". Please see the zi directory under the JDK installation for supported
  *            time zones.
  */
 public SunriseSunsetCalculator(Location location, String timeZoneIdentifier)
 {
     this.location   = location;
     this.calculator = new SolarEventCalculator(location, timeZoneIdentifier);
 }
Exemplo n.º 2
0
 /**
  * Constructs a new <code>SunriseSunsetCalculator</code> with the given <code>Location</code>
  *
  * @param location
  *            <code>Location</code> object containing the Latitude/Longitude of the location to compute
  *            the sunrise/sunset for.
  * @param timeZone
  *            timezone to compute the sunrise/sunset times in.
  */
 public SunriseSunsetCalculator(Location location, TimeZone timeZone)
 {
     this.location   = location;
     this.calculator = new SolarEventCalculator(location, timeZone);
 }
Exemplo n.º 3
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));
        }