VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes
makVrf::DtTimeZoneManager Class Reference

The timezone manager keeps track of all timezones available for the user to select from in the system. More...

Inheritance diagram for makVrf::DtTimeZoneManager:
Inheritance graph
[legend]

Classes

struct  FormatsSet
 
struct  IlluminationIconData
 
struct  TimezoneData
 

Public Types

typedef std::map< std::string,
TimezoneData
Timezones
 Key is abbreviation. More...
 
typedef std::map< int,
std::vector
< IlluminationIconData > > 
IlluminationIcon
 
typedef std::vector< std::string > DateTimeFormats
 
typedef std::map< std::string,
FormatsSet
FormatsSetsMap
 

Public Member Functions

 DtTimeZoneManager (makVrv::DtDe &)
 CTOR. More...
 
virtual ~DtTimeZoneManager ()
 DTOR. More...
 
virtual const Timezonestimezones () const
 
virtual void setUseLocalTimezone (bool)
 Use local timezone for timezone, irregardless of what the current timezone is set to be. More...
 
virtual bool useLocalTimezone () const
 
virtual void setDateAndTimeOfDayFormat (const std::string &)
 Sets the format for displaying the date/time of day as specified in Qt documentation. More...
 
virtual std::string dateAndTimeOfDayFormat () const
 
virtual time_t offsetForTimezone (const std::string &key) const
 Returns offset for the current timezone. More...
 
virtual time_t modifyTimeBasedOnTimezoneSelection (time_t)
 Returns time based from utc time on current timezone selected as defined in the application settings. More...
 
virtual void setCurrentTimezone (const std::string &)
 Sets the current timezone by key and sends out signal for the timezone change. More...
 
virtual std::string currentTimezone () const
 Returns current timezone. Blank timezone means local timezone. More...
 
virtual void setCurrentFormatsSet (const std::string &)
 Sets the current formatsSet by key and sends out signal for the change. More...
 
virtual std::string currentFormatsSet () const
 Returns current formatsSet. More...
 
virtual std::string currentTimezoneAbbreviation () const
 Returns current timezone abbreviation. Blank timezone means local timezone. More...
 
virtual std::string timezoneTitle () const
 Returns the title of the currently selected timezone. More...
 
virtual time_t offsetForTimezone () const
 Returns the offset for the currently selected timezone. More...
 
virtual time_t convertFromLocalTimeToUtcTime (time_t) const
 Converts from local timezone time to utc time. More...
 
virtual time_t currentUtcDateTime () const
 Return current simulation date/time as a UTC time. More...
 
virtual time_t currentLocalDateTime () const
 Return current simulation date/time in local timezone representation. More...
 
virtual time_t convertFromUtcTimeToLocalTime (time_t) const
 Converts from utc time to local timezone. More...
 
virtual void convertFromUtcTimeToLocalTime (int y, int m, int d, int h, int mm, int sec, int &year, int &month, int &day, int &hours, int &minutes, int &seconds) const
 
virtual time_t convertToUtcTime (int y, int m, int d, int h, int mm, int sec) const
 
virtual time_t convert (const std::string &source, time_t, const std::string &dest)
 Converts from supplied timezone to new local timezone given a time in the supplied timezone time. More...
 
virtual void load (const DtFilename &, bool merge=false)
 Loads the timezone file, clearing any existing timezones first if the merge flag is false. More...
 
virtual std::string dateTimeFormatString (time_t)
 Returns a string formatted with asctime for the current utc value offset to the local timezone. More...
 
virtual double illuminationValue (const DtGeodeticCoord &position, time_t time, double nighttimeMaximum=0.1, double illuminationMinimum=0.001, bool useGMTPosition=false, int *sunstate=0) const
 Give a geodetic coordinate and a UTC time, return an illumination value (0 - 1) at that position based on sun/moon position. More...
 
virtual double maximumNighttimeValue () const
 Get/set the maximum nighttime value. Default is .2. More...
 
virtual void setMaximumNighttimeValue (double)
 
virtual double minimumIlluminationValue ()
 Get/set the minimal value that the illumination can be. Default is .1. More...
 
virtual void setMinimumIlluminationValue (double)
 
virtual std::string illuminationIcon (double illumination, int sunState) const
 Returns the illumination icon given the sunstate and the illumination value. More...
 
virtual void addIlluminationIcon (int sunState, double lowIllumination, double highIllumination, const std::string &)
 Adds a new illumination icon for the given state and the given range of illumination values. More...
 
const IlluminationIconilluminationIcons () const
 
IlluminationIconilluminationIcons ()
 
virtual void resetSystemDateTime ()
 Resets the system date and time to the current date/time at 10am GMT. More...
 
virtual time_t utcTime (struct tm *tod) const
 
virtual time_t offsetTimeByObserverPosition (time_t curTime) const
 Given the current observer position, add the time given by the time zone the observer is in. More...
 
virtual time_t unoffsetTimeByObserverPosition (time_t curTime) const
 Given the current observer position, subtract the time given by the time zone the observer is in. More...
 
virtual time_t timeZoneOffsetForPosition (const DtVector &) const
 Give the time zone offset for the current geocentric position. The time is in seconds. More...
 
virtual time_t timeZoneOffsetForCurrentObserver () const
 Return the time zone offset for the current observer position. The time is in seconds. More...
 
virtual const DateTimeFormatsdateTimeFormats () const
 
virtual DateTimeFormatsdateTimeFormats ()
 
- Public Member Functions inherited from makVrv::DtVirtualBaseClass
 DtVirtualBaseClass ()
 Do nothing constructor. More...
 
virtual ~DtVirtualBaseClass ()
 Virtual do nothing destructor. More...
 

Static Public Member Functions

static DtTimeZoneManagerinstance (makVrv::DtDe &de)
 Returns instance of the manager. More...
 
static void registerInstance (makVrv::DtDe &, DtTimeZoneManager *)
 Register a new manager instance. More...
 

Public Attributes

boost::signals2::signal< void(std::string,
std::string)> 
signal_timezoneChanged
 Signal of old and new timezone. More...
 
boost::signals2::signal< void(std::string)> signal_dateAndTimeFormatChanged
 
boost::signals2::signal< void(std::string)> signal_formatsSetChanged
 

Protected Attributes

Timezones myTimezones
 
makVrv::DtDemyDe
 
double myNighttimeMaximumValue
 
double myMinimumIlluminationValue
 
IlluminationIcon myIlluminationIcons
 
DateTimeFormats myDateTimeFormats
 
FormatsSetsMap myFormatsSetsMap
 

Detailed Description

The timezone manager keeps track of all timezones available for the user to select from in the system.

It will also modify UTC timezones for the currently selected timezone. The default timezone file loaded is from the settings directory, timezones.csv

Member Typedef Documentation

typedef std::map<std::string, TimezoneData> makVrf::DtTimeZoneManager::Timezones

Key is abbreviation.

typedef std::vector<std::string> makVrf::DtTimeZoneManager::DateTimeFormats
typedef std::map<std::string, FormatsSet> makVrf::DtTimeZoneManager::FormatsSetsMap

Constructor & Destructor Documentation

makVrf::DtTimeZoneManager::DtTimeZoneManager ( makVrv::DtDe )

CTOR.

virtual makVrf::DtTimeZoneManager::~DtTimeZoneManager ( )
virtual

DTOR.

Member Function Documentation

static DtTimeZoneManager& makVrf::DtTimeZoneManager::instance ( makVrv::DtDe de)
static

Returns instance of the manager.

static void makVrf::DtTimeZoneManager::registerInstance ( makVrv::DtDe ,
DtTimeZoneManager  
)
static

Register a new manager instance.

virtual const Timezones& makVrf::DtTimeZoneManager::timezones ( ) const
virtual
virtual void makVrf::DtTimeZoneManager::setUseLocalTimezone ( bool  )
virtual

Use local timezone for timezone, irregardless of what the current timezone is set to be.

If set to false use the timezone that is set

virtual bool makVrf::DtTimeZoneManager::useLocalTimezone ( ) const
virtual
virtual void makVrf::DtTimeZoneManager::setDateAndTimeOfDayFormat ( const std::string &  )
virtual

Sets the format for displaying the date/time of day as specified in Qt documentation.

Default is: MM/dd/yyyy hh:mm Sends out signal when format has changed

virtual std::string makVrf::DtTimeZoneManager::dateAndTimeOfDayFormat ( ) const
virtual
virtual const DateTimeFormats& makVrf::DtTimeZoneManager::dateTimeFormats ( ) const
virtual

Date/time format information. To remove or change use the non-const member access to get direct access to the date/time format list

virtual DateTimeFormats& makVrf::DtTimeZoneManager::dateTimeFormats ( )
virtual
virtual time_t makVrf::DtTimeZoneManager::offsetForTimezone ( const std::string &  key) const
virtual

Returns offset for the current timezone.

virtual time_t makVrf::DtTimeZoneManager::modifyTimeBasedOnTimezoneSelection ( time_t  )
virtual

Returns time based from utc time on current timezone selected as defined in the application settings.

If no settings are specific assume local timezone

virtual void makVrf::DtTimeZoneManager::setCurrentTimezone ( const std::string &  )
virtual

Sets the current timezone by key and sends out signal for the timezone change.

virtual std::string makVrf::DtTimeZoneManager::currentTimezone ( ) const
virtual

Returns current timezone. Blank timezone means local timezone.

virtual void makVrf::DtTimeZoneManager::setCurrentFormatsSet ( const std::string &  )
virtual

Sets the current formatsSet by key and sends out signal for the change.

virtual std::string makVrf::DtTimeZoneManager::currentFormatsSet ( ) const
virtual

Returns current formatsSet.

virtual std::string makVrf::DtTimeZoneManager::currentTimezoneAbbreviation ( ) const
virtual

Returns current timezone abbreviation. Blank timezone means local timezone.

virtual std::string makVrf::DtTimeZoneManager::timezoneTitle ( ) const
virtual

Returns the title of the currently selected timezone.

virtual time_t makVrf::DtTimeZoneManager::offsetForTimezone ( ) const
virtual

Returns the offset for the currently selected timezone.

virtual time_t makVrf::DtTimeZoneManager::convertFromLocalTimeToUtcTime ( time_t  ) const
virtual

Converts from local timezone time to utc time.

virtual time_t makVrf::DtTimeZoneManager::currentUtcDateTime ( ) const
virtual

Return current simulation date/time as a UTC time.

virtual time_t makVrf::DtTimeZoneManager::currentLocalDateTime ( ) const
virtual

Return current simulation date/time in local timezone representation.

virtual time_t makVrf::DtTimeZoneManager::convertFromUtcTimeToLocalTime ( time_t  ) const
virtual

Converts from utc time to local timezone.

virtual void makVrf::DtTimeZoneManager::convertFromUtcTimeToLocalTime ( int  y,
int  m,
int  d,
int  h,
int  mm,
int  sec,
int year,
int month,
int day,
int hours,
int minutes,
int seconds 
) const
virtual
virtual time_t makVrf::DtTimeZoneManager::convertToUtcTime ( int  y,
int  m,
int  d,
int  h,
int  mm,
int  sec 
) const
virtual
virtual time_t makVrf::DtTimeZoneManager::convert ( const std::string &  source,
time_t  ,
const std::string &  dest 
)
virtual

Converts from supplied timezone to new local timezone given a time in the supplied timezone time.

virtual void makVrf::DtTimeZoneManager::load ( const DtFilename &  ,
bool  merge = false 
)
virtual

Loads the timezone file, clearing any existing timezones first if the merge flag is false.

virtual std::string makVrf::DtTimeZoneManager::dateTimeFormatString ( time_t  )
virtual

Returns a string formatted with asctime for the current utc value offset to the local timezone.

virtual double makVrf::DtTimeZoneManager::illuminationValue ( const DtGeodeticCoord &  position,
time_t  time,
double  nighttimeMaximum = 0.1,
double  illuminationMinimum = 0.001,
bool  useGMTPosition = false,
int sunstate = 0 
) const
virtual

Give a geodetic coordinate and a UTC time, return an illumination value (0 - 1) at that position based on sun/moon position.

The nighttimeMaximum is the maximum illumination to the full moon. The minimum illumination is that of sunset and no moon (accounting for possible illumination due to stars).

If use GMT position is true then the illumination value returned will always be 1.0

If sunstate is defined, returns the following value: 0 - Sun is not visible 1 - Sun is fully visible 2 - Dawn 3 - Dusk

virtual double makVrf::DtTimeZoneManager::maximumNighttimeValue ( ) const
virtual

Get/set the maximum nighttime value. Default is .2.

virtual void makVrf::DtTimeZoneManager::setMaximumNighttimeValue ( double  )
virtual
virtual double makVrf::DtTimeZoneManager::minimumIlluminationValue ( )
virtual

Get/set the minimal value that the illumination can be. Default is .1.

virtual void makVrf::DtTimeZoneManager::setMinimumIlluminationValue ( double  )
virtual
virtual std::string makVrf::DtTimeZoneManager::illuminationIcon ( double  illumination,
int  sunState 
) const
virtual

Returns the illumination icon given the sunstate and the illumination value.

virtual void makVrf::DtTimeZoneManager::addIlluminationIcon ( int  sunState,
double  lowIllumination,
double  highIllumination,
const std::string &   
)
virtual

Adds a new illumination icon for the given state and the given range of illumination values.

const IlluminationIcon& makVrf::DtTimeZoneManager::illuminationIcons ( ) const
inline
IlluminationIcon& makVrf::DtTimeZoneManager::illuminationIcons ( )
inline
virtual void makVrf::DtTimeZoneManager::resetSystemDateTime ( )
virtual

Resets the system date and time to the current date/time at 10am GMT.

virtual time_t makVrf::DtTimeZoneManager::utcTime ( struct tm *  tod) const
virtual
virtual time_t makVrf::DtTimeZoneManager::offsetTimeByObserverPosition ( time_t  curTime) const
virtual

Given the current observer position, add the time given by the time zone the observer is in.

virtual time_t makVrf::DtTimeZoneManager::unoffsetTimeByObserverPosition ( time_t  curTime) const
virtual

Given the current observer position, subtract the time given by the time zone the observer is in.

virtual time_t makVrf::DtTimeZoneManager::timeZoneOffsetForPosition ( const DtVector ) const
virtual

Give the time zone offset for the current geocentric position. The time is in seconds.

virtual time_t makVrf::DtTimeZoneManager::timeZoneOffsetForCurrentObserver ( ) const
virtual

Return the time zone offset for the current observer position. The time is in seconds.

Member Data Documentation

boost::signals2::signal<void (std::string, std::string)> makVrf::DtTimeZoneManager::signal_timezoneChanged

Signal of old and new timezone.

boost::signals2::signal<void (std::string)> makVrf::DtTimeZoneManager::signal_dateAndTimeFormatChanged
boost::signals2::signal<void(std::string)> makVrf::DtTimeZoneManager::signal_formatsSetChanged
Timezones makVrf::DtTimeZoneManager::myTimezones
protected
makVrv::DtDe& makVrf::DtTimeZoneManager::myDe
protected
double makVrf::DtTimeZoneManager::myNighttimeMaximumValue
protected
double makVrf::DtTimeZoneManager::myMinimumIlluminationValue
protected
IlluminationIcon makVrf::DtTimeZoneManager::myIlluminationIcons
protected
DateTimeFormats makVrf::DtTimeZoneManager::myDateTimeFormats
protected
FormatsSetsMap makVrf::DtTimeZoneManager::myFormatsSetsMap
protected

The documentation for this class was generated from the following file:

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)