/*****************************************************************************\
 * ObsInfo
\*****************************************************************************/

package com.mhuss.AstroLib;

/**
 * Holds latitude, longitude and time zone of an observing location.
 * 

* Note that the constructors expect latitude and longitude in * degrees, not radians, for calling convenience. */ public class ObsInfo { /** * Default constructor */ public ObsInfo() { m_longitude = m_latitude = 0D; m_timeZone = 0; } /** * Explicit (all values) constructor. * * @param lon longitude in degrees * @param lat latitude in degrees * @param tz Time Zone offset relative to UTC (-12 to 12 inclusive) */ public ObsInfo( Latitude lat, Longitude lon, int tz ) { m_latitude = Math.toRadians(lat.value); m_longitude = Math.toRadians(lon.value); m_timeZone = tz; } /** * Location only constructor.
* Timezone is taken from local computer settings. * * @param lon longitude in degrees * @param lat latitude in degrees */ public ObsInfo( Latitude lat, Longitude lon ) { m_latitude = Math.toRadians(lat.value); m_longitude = Math.toRadians(lon.value); m_timeZone = TimeOps.tzOffset(); } /** * Get latitude in degrees. * * @return Latitude in degrees */ public double getLatitudeDeg() { return Math.toDegrees(m_latitude); } /** * Get latitude in radians. * * @return Latitude in radians */ public double getLatitudeRad() { return m_latitude; } /** * Set latitude in degrees. * * @param lat Latitude in degrees */ public void setLatitudeDeg(double lat) { m_latitude = Math.toRadians(lat); } /** * Set latitude in radians. * * @param lat Latitude in radians */ public void setLatitudeRad(double lat) { m_latitude = lat; } /** * Get longitude in degrees. * * @return Longitude in degrees */ public double getLongitudeDeg() { return Math.toDegrees(m_longitude); } /** * Get longitude in radians. * * @return Longitude in radians */ public double getLongitudeRad() { return m_longitude; } /** * Set longitude in degrees. * * @param lon Longitude in degrees */ public void setLongitudeDeg(double lon) { m_longitude = Math.toRadians(lon); } /** * Set longitude in radians. * * @param lon Longitude in radians */ public void setLongitudeRad(double lon) { m_longitude = lon; } /** * Get time zone offset. * * @return Time zone offset from UTC (-12 to 12 inclusive) */ public int getTimeZone() { return m_timeZone; } /** * Set time zone offset. * * @param tz Time zone offset from UTC (-12 to 12 inclusive) */ public void setTimeZone(int tz) { m_timeZone = tz; } private double m_longitude; // in radians, N positive private double m_latitude; // in radians, E positive private int m_timeZone; // +/- 12 viz. UT };

Ads help maintain this website.