sgp4/CoordTopographic.h

107 lines
2.2 KiB
C
Raw Normal View History

2011-04-23 11:18:51 +00:00
#ifndef COORDTOPOGRAPHIC_H_
#define COORDTOPOGRAPHIC_H_
2011-03-24 15:55:10 +00:00
2011-12-13 21:35:43 +00:00
#include "Globals.h"
#include <iostream>
2011-12-13 21:35:43 +00:00
#include <sstream>
#include <iomanip>
2011-12-13 21:35:43 +00:00
struct CoordTopographic
{
2011-03-24 15:55:10 +00:00
public:
CoordTopographic()
2011-12-13 21:35:43 +00:00
: azimuth(0.0), elevation(0.0), range(0.0), range_rate(0.0)
{
2011-03-24 15:55:10 +00:00
}
2011-05-26 23:14:00 +00:00
CoordTopographic(double az, double el, double rnge, double rnge_rate)
2011-12-13 21:35:43 +00:00
: azimuth(az), elevation(el), range(rnge), range_rate(rnge_rate)
{
2011-03-24 15:55:10 +00:00
}
2011-12-13 21:35:43 +00:00
CoordTopographic(const CoordTopographic& t)
{
azimuth = t.azimuth;
elevation = t.elevation;
range = t.range;
range_rate = t.range_rate;
}
2011-12-13 21:35:43 +00:00
virtual ~CoordTopographic()
{
2011-03-24 15:55:10 +00:00
};
2011-12-13 21:35:43 +00:00
CoordTopographic& operator=(const CoordTopographic& t)
{
if (this != &t) {
azimuth = t.azimuth;
elevation = t.elevation;
range = t.range;
range_rate = t.range_rate;
}
return *this;
}
bool operator==(const CoordTopographic& t) const
{
return IsEqual(t);
}
bool operator !=(const CoordTopographic& t) const
{
return !IsEqual(t);
}
std::string ToString() const
{
std::stringstream ss;
ss << std::right << std::fixed << std::setprecision(2);
ss << "Az: " << std::setw(7) << RadiansToDegrees(azimuth);
ss << ", El: " << std::setw(7) << RadiansToDegrees(elevation);
ss << ", Rng: " << std::setw(9) << range;
ss << ", Rng Rt: " << std::setw(6) << range_rate;
return ss.str();
}
2011-03-24 15:55:10 +00:00
/*
* radians
*/
2011-05-26 23:14:00 +00:00
double azimuth;
2011-03-24 15:55:10 +00:00
/*
* radians
*/
2011-05-26 23:14:00 +00:00
double elevation;
2011-03-24 15:55:10 +00:00
/*
* kilometers
*/
2011-05-26 23:14:00 +00:00
double range;
2011-03-24 15:55:10 +00:00
/*
* kilometers / second
*/
2011-05-26 23:14:00 +00:00
double range_rate;
2011-12-13 21:35:43 +00:00
protected:
bool IsEqual(const CoordTopographic& t) const
{
if (azimuth == t.azimuth && elevation == t.elevation &&
range == t.range && range_rate == t.range_rate)
{
return true;
}
else
{
return false;
}
}
2011-03-24 15:55:10 +00:00
};
2011-12-13 21:35:43 +00:00
inline std::ostream& operator<<(std::ostream& strm, const CoordTopographic& t)
{
return strm << t.ToString();
}
2011-03-24 15:55:10 +00:00
#endif