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

This class represents an ephemeris. More...

#include <Ephemeris.h>

Inheritance diagram for ossimplugins::Ephemeris:
ossimplugins::GalileanEphemeris ossimplugins::GeographicEphemeris

Public Member Functions

 Ephemeris ()
 Constructor. More...
 
virtual ~Ephemeris ()
 Destructor. More...
 
 Ephemeris (JSDDateTime date, double pos[3], double speed[3])
 Constructor with initialisations. More...
 
 Ephemeris (const Ephemeris &rhs)
 Copy constructor. More...
 
Ephemerisoperator= (const Ephemeris &rhs)
 Affectation operator. More...
 
virtual EphemerisClone ()
 This function creatse a copy of the current class. More...
 
JSDDateTime get_date () const
 
double * get_position ()
 
const double * get_position () const
 
double * get_speed ()
 
const double * get_speed () const
 
void set_date (JSDDateTime date)
 
void set_position (double position[3])
 
void set_speed (double speed[3])
 
bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 Method to save object state to a keyword list. More...
 
bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 Method to the load (recreate) the state of the object from a keyword list. More...
 

Protected Attributes

JSDDateTime _date
 
double _position [3]
 
double _speed [3]
 

Detailed Description

This class represents an ephemeris.

Definition at line 28 of file Ephemeris.h.

Constructor & Destructor Documentation

◆ Ephemeris() [1/3]

ossimplugins::Ephemeris::Ephemeris ( )

Constructor.

Definition at line 29 of file Ephemeris.cpp.

References _position, and _speed.

Referenced by ossimplugins::GeographicEphemeris::operator=(), and ossimplugins::GalileanEphemeris::operator=().

30 {
31  _position[0] = 0.0;
32  _position[1] = 0.0;
33  _position[2] = 0.0;
34  _speed[0] = 0.0;
35  _speed[1] = 0.0;
36  _speed[2] = 0.0;
37 }

◆ ~Ephemeris()

ossimplugins::Ephemeris::~Ephemeris ( )
virtual

Destructor.

Definition at line 39 of file Ephemeris.cpp.

40 {
41 }

◆ Ephemeris() [2/3]

ossimplugins::Ephemeris::Ephemeris ( JSDDateTime  date,
double  pos[3],
double  speed[3] 
)

Constructor with initialisations.

Definition at line 43 of file Ephemeris.cpp.

References _position, and _speed.

43  :
44  _date(date)
45 {
46  _position[0] = pos[0];
47  _position[1] = pos[1];
48  _position[2] = pos[2];
49  _speed[0] = speed[0];
50  _speed[1] = speed[1];
51  _speed[2] = speed[2];
52 }

◆ Ephemeris() [3/3]

ossimplugins::Ephemeris::Ephemeris ( const Ephemeris rhs)

Copy constructor.

Definition at line 54 of file Ephemeris.cpp.

References _position, and _speed.

54  :
55  _date(rhs._date)
56 {
57  _position[0] = rhs._position[0];
58  _position[1] = rhs._position[1];
59  _position[2] = rhs._position[2];
60  _speed[0] = rhs._speed[0];
61  _speed[1] = rhs._speed[1];
62  _speed[2] = rhs._speed[2];
63 }

Member Function Documentation

◆ Clone()

virtual Ephemeris* ossimplugins::Ephemeris::Clone ( )
inlinevirtual

◆ get_date()

JSDDateTime ossimplugins::Ephemeris::get_date ( ) const
inline

◆ get_position() [1/2]

double* ossimplugins::Ephemeris::get_position ( )
inline

◆ get_position() [2/2]

const double* ossimplugins::Ephemeris::get_position ( ) const
inline

Definition at line 73 of file Ephemeris.h.

74  {
75  return _position;
76  }

◆ get_speed() [1/2]

double* ossimplugins::Ephemeris::get_speed ( )
inline

◆ get_speed() [2/2]

const double* ossimplugins::Ephemeris::get_speed ( ) const
inline

Definition at line 83 of file Ephemeris.h.

84  {
85  return _speed;
86  }

◆ loadState()

bool ossimplugins::Ephemeris::loadState ( const ossimKeywordlist kwl,
const char *  prefix = 0 
)

Method to the load (recreate) the state of the object from a keyword list.

Return true if ok or false on error.

Returns
true if load OK, false on error

Definition at line 100 of file Ephemeris.cpp.

References _date, _position, _speed, ossimKeywordlist::find(), ossimNotify(), ossimNotifyLevel_WARN, ossimplugins::JSDDateTime::set_day0hTU(), ossimplugins::JSDDateTime::set_decimal(), ossimplugins::JSDDateTime::set_second(), ossimString::toDouble(), ossimDpt3d::toPoint(), ossimDpt3d::x, ossimDpt3d::y, and ossimDpt3d::z.

Referenced by ossimplugins::RefPoint::loadState(), and ossimplugins::PlatformPosition::loadState().

101 {
102  static const char MODULE[] = "Ephemeris::loadState";
103 
104  bool result = true;
105 
106  std::string pfx;
107  if (prefix)
108  {
109  pfx = prefix;
110  }
111  pfx += "ephemeris.";
112 
113  const char* lookup = 0;
114  ossimString s;
115  double d;
116 
117  lookup = kwl.find(pfx.c_str(), DATE_JULIAN_KW);
118  if (lookup)
119  {
120  s = lookup;
121  d = s.toDouble();
122  JulianDate jd(d);
123  _date.set_day0hTU(jd);
124  }
125  else
126  {
128  << MODULE << " Keyword not found: " << DATE_JULIAN_KW << "\n";
129 
130  result = false;
131  }
132 
133  lookup = kwl.find(pfx.c_str(), DATE_SECOND_KW);
134  if (lookup)
135  {
136  s = lookup;
137  d = s.toDouble();
138  _date.set_second(d);
139  }
140  else
141  {
143  << MODULE << " Keyword not found: " << DATE_SECOND_KW << "\n";
144  result = false;
145  }
146 
147  lookup = kwl.find(pfx.c_str(), DATE_DECIMAL_KW);
148  if (lookup)
149  {
150  s = lookup;
151  d = s.toDouble();
152  _date.set_decimal(d);
153  }
154  else
155  {
157  << MODULE << " Keyword not found: " << DATE_DECIMAL_KW << "\n";
158  result = false;
159  }
160 
161  lookup = kwl.find(pfx.c_str(), POSITION_KW);
162  if (lookup)
163  {
164  std::string ps = lookup;
165 
166  ossimDpt3d pt;
167  pt.toPoint(ps);
168 
169  _position[0] = pt.x;
170  _position[1] = pt.y;
171  _position[2] = pt.z;
172  }
173  else
174  {
176  << MODULE << " Keyword not found: " << POSITION_KW << "\n";
177  result = false;
178  }
179 
180  lookup = kwl.find(pfx.c_str(), VELOCITY_KW);
181  if (lookup)
182  {
183  std::string ps = lookup;
184 
185  ossimDpt3d pt;
186  pt.toPoint(ps);
187 
188  _speed[0] = pt.x;
189  _speed[1] = pt.y;
190  _speed[2] = pt.z;
191  }
192  else
193  {
195  << MODULE << " Keyword not found: " << VELOCITY_KW << "\n";
196  result = false;
197  }
198 
199  return result;
200 }
void toPoint(const std::string &s)
Initializes this point from string.
Definition: ossimDpt3d.cpp:92
const char * find(const char *key) const
void set_day0hTU(JulianDate day)
Definition: JSDDateTime.h:86
void set_second(double second)
Definition: JSDDateTime.h:91
double z
Definition: ossimDpt3d.h:145
void set_decimal(double decimal)
Definition: JSDDateTime.h:96
double toDouble() const
double x
Definition: ossimDpt3d.h:143
double y
Definition: ossimDpt3d.h:144
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ operator=()

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

Affectation operator.

Definition at line 65 of file Ephemeris.cpp.

References _date, _position, and _speed.

66 {
67  _position[0] = rhs._position[0];
68  _position[1] = rhs._position[1];
69  _position[2] = rhs._position[2];
70  _speed[0] = rhs._speed[0];
71  _speed[1] = rhs._speed[1];
72  _speed[2] = rhs._speed[2];
73  _date = rhs._date;
74 
75  return *this;
76 }

◆ saveState()

bool ossimplugins::Ephemeris::saveState ( ossimKeywordlist kwl,
const char *  prefix = 0 
) const

Method to save object state to a keyword list.

Parameters
kwlKeyword list to save to.
prefixadded to keys when saved.
Returns
true on success, false on error.

Definition at line 78 of file Ephemeris.cpp.

References _date, _position, _speed, ossimKeywordlist::add(), ossimplugins::JSDDateTime::get_day0hTU(), ossimplugins::JSDDateTime::get_decimal(), ossimplugins::JulianDate::get_julianDate(), ossimplugins::JSDDateTime::get_second(), and ossimDpt3d::toString().

Referenced by ossimplugins::RefPoint::saveState(), and ossimplugins::PlatformPosition::saveState().

79 {
80  std::string pfx;
81  if (prefix)
82  {
83  pfx = prefix;
84  }
85  pfx += PREFIX;
86 
87  ossimDpt3d pos(_position[0], _position[1], _position[2]);
88  ossimDpt3d vit(_speed[0], _speed[1], _speed[2]);
89  JulianDate jd = _date.get_day0hTU();
90 
91  kwl.add(pfx.c_str(), DATE_JULIAN_KW, jd.get_julianDate());
92  kwl.add(pfx.c_str(), DATE_SECOND_KW, _date.get_second());
93  kwl.add(pfx.c_str(), DATE_DECIMAL_KW, _date.get_decimal());
94  kwl.add(pfx.c_str(), POSITION_KW, pos.toString(15).c_str());
95  kwl.add(pfx.c_str(), VELOCITY_KW, vit.toString(15).c_str());
96 
97  return true;
98 }
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
JulianDate get_day0hTU() const
Definition: JSDDateTime.h:71
double get_second() const
Definition: JSDDateTime.h:76
double get_decimal() const
Definition: JSDDateTime.h:81

◆ set_date()

void ossimplugins::Ephemeris::set_date ( JSDDateTime  date)
inline

◆ set_position()

void ossimplugins::Ephemeris::set_position ( double  position[3])
inline

Definition at line 93 of file Ephemeris.h.

Referenced by ossimplugins::PlatformPosition::Interpolate(), ossimplugins::GeographicEphemeris::ToGalilean(), and ossimplugins::GalileanEphemeris::ToGeographic().

94  {
95  _position[0] = position[0];
96  _position[1] = position[1];
97  _position[2] = position[2];
98  }

◆ set_speed()

void ossimplugins::Ephemeris::set_speed ( double  speed[3])
inline

Definition at line 100 of file Ephemeris.h.

Referenced by ossimplugins::PlatformPosition::Interpolate(), ossimplugins::GeographicEphemeris::ToGalilean(), and ossimplugins::GalileanEphemeris::ToGeographic().

101  {
102  _speed[0] = speed[0];
103  _speed[1] = speed[1];
104  _speed[2] = speed[2];
105  }

Member Data Documentation

◆ _date

JSDDateTime ossimplugins::Ephemeris::_date
protected

◆ _position

double ossimplugins::Ephemeris::_position[3]
protected

◆ _speed

double ossimplugins::Ephemeris::_speed[3]
protected

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