X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Ftiming%2Ftimezone.h;h=76c62a326debd6e2d5b2ac670aa8551cf3c17b32;hb=10217a3b19f690624e42b224a6fb08b6673c3edd;hp=f5779fd374aca1f50c5aa5116f28840c90841e91;hpb=733e6fa14ff507a1022ecab8d55cc9bf587bee40;p=simgear.git diff --git a/simgear/timing/timezone.h b/simgear/timing/timezone.h index f5779fd3..76c62a32 100644 --- a/simgear/timing/timezone.h +++ b/simgear/timing/timezone.h @@ -27,46 +27,38 @@ #ifndef _TIMEZONE_H_ #define _TIMEZONE_H_ -#include #include +#include -#include +#include +#include /** - * SGTimeZone is derived from geocoord, and stores the timezone centerpoint, + * 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 SGTimeZone : public SGGeoCoord +class SGTimeZone { private: + SGVec3d centerpoint; // centre of timezone, in cartesian coordinates std::string countryCode; std::string descriptor; public: - /** - * Default constructor. - */ - SGTimeZone() : SGGeoCoord() - { - countryCode.erase(); - descriptor.erase(); - }; - /** * Build a timezone object with a specifed latitude, longitude, country * code, and descriptor - * @param la latitude - * @param lo longitude + * @param pt centerpoint * @param cc country code * @param desc descriptor */ - SGTimeZone(float la, float lo, char* cc, char* desc); + SGTimeZone(const SGGeod& pt, char* cc, char* desc); /** * Build a timezone object from a textline in zone.tab @@ -79,29 +71,34 @@ public: * @param other the source object */ SGTimeZone(const SGTimeZone &other); - - /** - * Virutal destructor - */ - virtual ~SGTimeZone() { }; /** * Return the descriptor string * @return descriptor string (char array) */ - virtual const char * getDescription() { return descriptor.c_str(); }; + const char * getDescription() { return descriptor.c_str(); }; + + const SGVec3d& cartCenterpoint() const + { + return centerpoint; + } }; /** - * SGTimeZoneContainer is derived from SGGeoCoordContainer, and has some - * added functionality. + * SGTimeZoneContainer */ -class SGTimeZoneContainer : public SGGeoCoordContainer +class SGTimeZoneContainer { - public: +public: SGTimeZoneContainer(const char *filename); - virtual ~SGTimeZoneContainer(); + ~SGTimeZoneContainer(); + + SGTimeZone* getNearest(const SGGeod& ref) const; + +private: + typedef std::vector TZVec; + TZVec zones; };