X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Ftiming%2Ftimezone.h;h=76c62a326debd6e2d5b2ac670aa8551cf3c17b32;hb=9da0031039bb534011591ce3bd6fede21030c345;hp=ce3521befaaa0b548a9dce79746eb97d55186efa;hpb=89960ab7152fd59dee39824bd8cb44af7802884f;p=simgear.git diff --git a/simgear/timing/timezone.h b/simgear/timing/timezone.h index ce3521be..76c62a32 100644 --- a/simgear/timing/timezone.h +++ b/simgear/timing/timezone.h @@ -12,61 +12,93 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * **************************************************************************/ -/************************************************************************* +/** \file timezone.h * - * Timezone is derived from geocoord, and stores the timezone centerpoint, - * as well as the countrycode and the timezone descriptor. The latter is - * used in order to get the local time. + * Provides SGTimeZone and SGTimeZoneContainer * - ************************************************************************/ + */ #ifndef _TIMEZONE_H_ #define _TIMEZONE_H_ -#include +#include +#include -#include +#include +#include + +/** + * SGTimeZone stores the timezone centerpoint, + * as well as the countrycode and the timezone descriptor. The latter is + * used in order to get the local time. + * + */ -class Timezone : public GeoCoord +class SGTimeZone { + private: - char* countryCode; - char* descriptor; + + SGVec3d centerpoint; // centre of timezone, in cartesian coordinates + std::string countryCode; + std::string descriptor; public: - Timezone() : - GeoCoord() - { - countryCode = 0; - descriptor = 0; - }; - Timezone(float la, float lo, char* cc, char* desc); - Timezone(const char *infoString); - Timezone(const Timezone &other); - virtual ~Timezone() { delete [] countryCode; delete [] descriptor; }; - - virtual void print() { printf("%s", descriptor);}; - virtual char * getDescription() { return descriptor; }; + /** + * Build a timezone object with a specifed latitude, longitude, country + * code, and descriptor + * @param pt centerpoint + * @param cc country code + * @param desc descriptor + */ + SGTimeZone(const SGGeod& pt, char* cc, char* desc); + + /** + * Build a timezone object from a textline in zone.tab + * @param infoString the textline from zone.tab + */ + SGTimeZone(const char *infoString); + + /** + * The copy constructor + * @param other the source object + */ + SGTimeZone(const SGTimeZone &other); + + /** + * Return the descriptor string + * @return descriptor string (char array) + */ + const char * getDescription() { return descriptor.c_str(); }; + + const SGVec3d& cartCenterpoint() const + { + return centerpoint; + } }; -/************************************************************************ - * Timezone container is derived from GeoCoordContainer, and has some - * added functionality. - ************************************************************************/ +/** + * SGTimeZoneContainer + */ -class TimezoneContainer : public GeoCoordContainer +class SGTimeZoneContainer { - public: - TimezoneContainer(const char *filename); - virtual ~TimezoneContainer(); +public: + SGTimeZoneContainer(const char *filename); + ~SGTimeZoneContainer(); + + SGTimeZone* getNearest(const SGGeod& ref) const; + +private: + typedef std::vector TZVec; + TZVec zones; };