OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Protected Attributes | List of all members
ossimplugins::JulianDate Class Reference

This class represents a date in the julian referential. More...

#include <JulianDate.h>

Public Member Functions

 JulianDate ()
 constructor More...
 
 ~JulianDate ()
 Destructor. More...
 
 JulianDate (const JulianDate &rhs)
 Copy constructor. More...
 
 JulianDate (CivilDateTime &rhs)
 Constructor with date initialisation using a CivilDateTime. More...
 
 JulianDate (JSDDateTime &rhs)
 Constructor with date initialisation using a JSDDateTime. More...
 
 JulianDate (double julianDate)
 Constructor with date initialisation. More...
 
JulianDateoperator= (const JulianDate &rhs)
 Affectation operator. More...
 
JulianDateoperator+ (const JulianDate &rhs)
 Summation operator. More...
 
void set_julianDate (double julianDate)
 
double get_julianDate () const
 
int AsJSDDateTime (JSDDateTime *JSDdate)
 This function converts the current JulianDate in JSDDateTime. More...
 
int AsGMSTDateTime (GMSTDateTime *GMST)
 This function converts the current JulianDate into GMSTDateTime. More...
 
 operator JSDDateTime ()
 
 operator GMSTDateTime ()
 

Protected Attributes

double _julianDate
 

Detailed Description

This class represents a date in the julian referential.

Definition at line 27 of file JulianDate.h.

Constructor & Destructor Documentation

◆ JulianDate() [1/5]

ossimplugins::JulianDate::JulianDate ( )

constructor

Definition at line 27 of file JulianDate.cpp.

27  :
28  _julianDate(0.0)
29 {
30 }

◆ ~JulianDate()

ossimplugins::JulianDate::~JulianDate ( )

Destructor.

Definition at line 47 of file JulianDate.cpp.

48 {
49 }

◆ JulianDate() [2/5]

ossimplugins::JulianDate::JulianDate ( const JulianDate rhs)

Copy constructor.

Definition at line 51 of file JulianDate.cpp.

51  :
52  _julianDate(rhs._julianDate)
53 {
54 }

◆ JulianDate() [3/5]

ossimplugins::JulianDate::JulianDate ( CivilDateTime rhs)

Constructor with date initialisation using a CivilDateTime.

Definition at line 32 of file JulianDate.cpp.

References ossimplugins::CivilDateTime::AsJulianDate().

33 {
34  rhs.AsJulianDate(this);
35 }

◆ JulianDate() [4/5]

ossimplugins::JulianDate::JulianDate ( JSDDateTime rhs)

Constructor with date initialisation using a JSDDateTime.

Definition at line 42 of file JulianDate.cpp.

References ossimplugins::JSDDateTime::AsJulianDate().

43 {
44  rhs.AsJulianDate(this);
45 }

◆ JulianDate() [5/5]

ossimplugins::JulianDate::JulianDate ( double  julianDate)

Constructor with date initialisation.

Definition at line 37 of file JulianDate.cpp.

37  :
38  _julianDate(julianDate)
39 {
40 }

Member Function Documentation

◆ AsGMSTDateTime()

int ossimplugins::JulianDate::AsGMSTDateTime ( GMSTDateTime GMST)

This function converts the current JulianDate into GMSTDateTime.

Returns
0 if no error or an int greater than 0 indicating the error
Parameters
GMSTDateTime[out] The class that receives the result of the conversion of the current JulianDate into GMSTDateTime

Definition at line 84 of file JulianDate.cpp.

References _julianDate, ossimplugins::GMSTDateTime::AN1900, ossimplugins::GMSTDateTime::AN1950, ossimplugins::GMSTDateTime::AN2000, ossimplugins::GMSTDateTime::get_origine(), ossimplugins::CivilDateTime::JOURCIVIL_LENGTH, n, ossimplugins::GMSTDateTime::set_tms(), and TWOPI.

85 {
86  const double TWOPI = 6.28318530717958647693 ;
87  const double OMEGATERRE = 6.28318530717958647693 / 86164.09054 ;
88 
89  int etat=0 , n ;
90  double j0hTU = 0.0;
91  double tsm0hTU = 0.0;
92  double t = 0.0;
93  double d = 0.0;
94  double tsm = 0.0;
95 
96 
97  n = (int)(_julianDate - 0.5) ;
98  j0hTU = (double)n + 0.5 ;
99  d = _julianDate - j0hTU ;
100 
101  if (etat == 0)
102  {
103  if (GMST->get_origine() == GMSTDateTime::AN1900)
104  {
105  t = (j0hTU - 2415020.0) / 36525.0 ;
106  tsm0hTU = 23925.836 + t * (8640184.542 + t * 0.0929) ;
107  tsm0hTU = tsm0hTU * TWOPI / CivilDateTime::JOURCIVIL_LENGTH ;
108  }
109  else if (GMST->get_origine() == GMSTDateTime::AN1950)
110  {
111  t = j0hTU - 2433281.5 ;
112  tsm0hTU = 1.72944494 + t * 6.3003880987 ;
113  }
114  else if (GMST->get_origine() == GMSTDateTime::AN2000)
115  {
116  t = (j0hTU - 2451545.0) / 36525.0 ;
117  tsm0hTU = 24110.54841 + t * (8640184.812866 + t * (0.093103 - t * 6.210e-6)) ;
118  tsm0hTU = tsm0hTU * TWOPI / CivilDateTime::JOURCIVIL_LENGTH ;
119  }
120  t = tsm0hTU + d * CivilDateTime::JOURCIVIL_LENGTH * OMEGATERRE ;
121  tsm = fmod (t,TWOPI) ;
122  if (tsm < 0.0)
123  {
124  tsm = tsm + TWOPI ;
125  }
126 
127  GMST->set_tms(tsm);
128  }
129 
130  return etat ;
131 }
static const double JOURCIVIL_LENGTH
os2<< "> n<< " > nendobj n

◆ AsJSDDateTime()

int ossimplugins::JulianDate::AsJSDDateTime ( JSDDateTime JSDdate)

This function converts the current JulianDate in JSDDateTime.

Returns
0 if no error or an int greater than 0 indicating the error
Parameters
JSDdate[out] The classe that receives the result of the conversion of the current JulianDate in JSDDateTime

Definition at line 68 of file JulianDate.cpp.

References _julianDate, ossimplugins::JSDDateTime::get_second(), ossimplugins::CivilDateTime::JOURCIVIL_LENGTH, ossimplugins::JSDDateTime::set_day0hTU(), ossimplugins::JSDDateTime::set_decimal(), and ossimplugins::JSDDateTime::set_second().

Referenced by ossimplugins::JSDDateTime::JSDDateTime().

69 {
70  int k ;
71  double r ;
72 
73  k = (int)(_julianDate - 0.5) ;
74  double jJul0hTU = (double)k + 0.5;
75 
76  JSDdate->set_day0hTU (jJul0hTU);
77  r = (_julianDate - jJul0hTU) * CivilDateTime::JOURCIVIL_LENGTH ;
78  JSDdate->set_second(floor (r));
79  JSDdate->set_decimal(r - JSDdate->get_second()) ;
80 
81  return 0 ;
82 }
static const double JOURCIVIL_LENGTH

◆ get_julianDate()

double ossimplugins::JulianDate::get_julianDate ( ) const
inline

◆ operator GMSTDateTime()

ossimplugins::JulianDate::operator GMSTDateTime ( )

Definition at line 140 of file JulianDate.cpp.

141 {
142  GMSTDateTime date;
143  AsGMSTDateTime(&date);
144  return date;
145 }
int AsGMSTDateTime(GMSTDateTime *GMST)
This function converts the current JulianDate into GMSTDateTime.
Definition: JulianDate.cpp:84

◆ operator JSDDateTime()

ossimplugins::JulianDate::operator JSDDateTime ( )

Definition at line 133 of file JulianDate.cpp.

134 {
135  JSDDateTime date;
136  AsJSDDateTime(&date);
137  return date;
138 }
int AsJSDDateTime(JSDDateTime *JSDdate)
This function converts the current JulianDate in JSDDateTime.
Definition: JulianDate.cpp:68

◆ operator+()

JulianDate & ossimplugins::JulianDate::operator+ ( const JulianDate rhs)

Summation operator.

Definition at line 62 of file JulianDate.cpp.

References _julianDate.

63 {
64  _julianDate += rhs._julianDate;
65  return *this;
66 }

◆ operator=()

JulianDate & ossimplugins::JulianDate::operator= ( const JulianDate rhs)

Affectation operator.

Definition at line 56 of file JulianDate.cpp.

References _julianDate.

57 {
58  _julianDate = rhs._julianDate;
59  return *this;
60 }

◆ set_julianDate()

void ossimplugins::JulianDate::set_julianDate ( double  julianDate)
inline

Definition at line 65 of file JulianDate.h.

Referenced by ossimplugins::CivilDateTime::AsJulianDate(), and ossimplugins::JSDDateTime::AsJulianDate().

66  {
67  _julianDate = julianDate;
68  }

Member Data Documentation

◆ _julianDate

double ossimplugins::JulianDate::_julianDate
protected

Definition at line 95 of file JulianDate.h.

Referenced by AsGMSTDateTime(), AsJSDDateTime(), operator+(), and operator=().


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