X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Ftiming%2Ftimezone.h;h=76c62a326debd6e2d5b2ac670aa8551cf3c17b32;hb=10217a3b19f690624e42b224a6fb08b6673c3edd;hp=e286d857d55ea72bbdc5e7d409b1554187eec062;hpb=51ef4568dd248a6917720a386e658610958e1512;p=simgear.git diff --git a/simgear/timing/timezone.h b/simgear/timing/timezone.h index e286d857..76c62a32 100644 --- a/simgear/timing/timezone.h +++ b/simgear/timing/timezone.h @@ -12,10 +12,9 @@ * 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. * **************************************************************************/ @@ -28,45 +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: - string countryCode; - string descriptor; + 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,34 +71,34 @@ public: * @param other the source object */ SGTimeZone(const SGTimeZone &other); - - /** - * Virutal destructor - */ - virtual ~SGTimeZone() { }; - /** - * Print the descriptor string - */ - virtual void print() { printf("%s", descriptor.c_str()); } - /** * 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; };