COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
gvector Struct Reference

3 element geodetic vector More...

#include <vector.h>

Collaboration diagram for gvector:

Public Member Functions

 gvector ()
 
 gvector (double tlat, double tlon, double th)
 
json11::Json to_json () const
 Convert class contents to JSON object. More...
 
void from_json (const string &s)
 Set class contents from JSON string. More...
 

Public Attributes

double lat = 0.
 Latitude in radians. More...
 
double lon = 0.
 Longitude in radians. More...
 
double h = 0.
 Height in meters. More...
 

Detailed Description

3 element geodetic vector

3 double precision numbers representing a vector in a WGS84 based geodetic space. Longitude increases east.

Constructor & Destructor Documentation

gvector::gvector ( )
inline
231 {}
gvector::gvector ( double  tlat,
double  tlon,
double  th 
)
inline
232  {
233  lat = tlat;
234  lon = tlon;
235  h = th;
236  }
double h
Height in meters.
Definition: vector.h:229
double lon
Longitude in radians.
Definition: vector.h:227
double lat
Latitude in radians.
Definition: vector.h:225

Member Function Documentation

json11::Json gvector::to_json ( ) const
inline

Convert class contents to JSON object.

Returns a json11 JSON object of the class

Returns
A json11 JSON object containing every member variable within the class
242  {
243  return json11::Json::object {
244  { "lat" , lat },
245  { "lon" , lon },
246  { "h" , h }
247  };
248  }
std::map< std::string, Json > object
Definition: json11.hpp:88
double h
Height in meters.
Definition: vector.h:229
double lon
Longitude in radians.
Definition: vector.h:227
double lat
Latitude in radians.
Definition: vector.h:225
void gvector::from_json ( const string &  s)
inline

Set class contents from JSON string.

Parses the provided JSON-formatted string and sets the class data. String should be formatted like the string returned from to_json()

Parameters
sJSON-formatted string to set class contents to
Returns
n/a
256  {
257  string error;
258  json11::Json parsed = json11::Json::parse(s,error);
259  if(error.empty()) {
260  if(!parsed["lat"].is_null()) lat = parsed["lat"].number_value();
261  if(!parsed["lon"].is_null()) lon = parsed["lon"].number_value();
262  if(!parsed["h"].is_null()) h = parsed["h"].number_value();
263  } else {
264  cerr<<"ERROR: <"<<error<<">"<<endl;
265  }
266  return;
267  }
Definition: json11.hpp:79
static Json parse(const std::string &in, std::string &err, JsonParse strategy=JsonParse::STANDARD)
double h
Height in meters.
Definition: vector.h:229
double lon
Longitude in radians.
Definition: vector.h:227
double lat
Latitude in radians.
Definition: vector.h:225

Member Data Documentation

double gvector::lat = 0.

Latitude in radians.

double gvector::lon = 0.

Longitude in radians.

double gvector::h = 0.

Height in meters.


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