2011-12-16 23:38:28 +00:00
|
|
|
#ifndef COORDTOPOGRAPHIC_H_
|
|
|
|
#define COORDTOPOGRAPHIC_H_
|
|
|
|
|
2011-12-22 14:05:51 +00:00
|
|
|
#include "Util.h"
|
2011-12-16 23:38:28 +00:00
|
|
|
|
2012-10-11 18:52:51 +00:00
|
|
|
#include <string>
|
2011-12-16 23:38:28 +00:00
|
|
|
#include <sstream>
|
|
|
|
#include <iomanip>
|
|
|
|
|
2012-10-11 18:52:51 +00:00
|
|
|
/**
|
|
|
|
* Stores a topographic position
|
|
|
|
*/
|
2011-12-16 23:38:28 +00:00
|
|
|
struct CoordTopographic
|
|
|
|
{
|
|
|
|
public:
|
2012-10-11 18:52:51 +00:00
|
|
|
/**
|
|
|
|
* Default constructor
|
|
|
|
*/
|
2011-12-16 23:38:28 +00:00
|
|
|
CoordTopographic()
|
2012-10-11 18:52:51 +00:00
|
|
|
: azimuth(0.0),
|
|
|
|
elevation(0.0),
|
|
|
|
range(0.0),
|
|
|
|
range_rate(0.0)
|
2011-12-16 23:38:28 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-10-11 18:52:51 +00:00
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
* @param[in] arg_azimuth azimuth in radians
|
|
|
|
* @param[in] arg_elevation elevation in radians
|
|
|
|
* @param[in] arg_range range in kilometers
|
|
|
|
* @param[in] arg_range_rate range rate in kilometers per second
|
|
|
|
*/
|
|
|
|
CoordTopographic(
|
|
|
|
double arg_azimuth,
|
|
|
|
double arg_elevation,
|
|
|
|
double arg_range,
|
|
|
|
double arg_range_rate)
|
|
|
|
: azimuth(arg_azimuth),
|
|
|
|
elevation(arg_elevation),
|
|
|
|
range(arg_range),
|
|
|
|
range_rate(arg_range_rate)
|
2011-12-16 23:38:28 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-10-11 18:52:51 +00:00
|
|
|
/**
|
|
|
|
* Copy constructor
|
|
|
|
* @param[in] topo object to copy from
|
|
|
|
*/
|
|
|
|
CoordTopographic(const CoordTopographic& topo)
|
2011-12-16 23:38:28 +00:00
|
|
|
{
|
2012-10-11 18:52:51 +00:00
|
|
|
azimuth = topo.azimuth;
|
|
|
|
elevation = topo.elevation;
|
|
|
|
range = topo.range;
|
|
|
|
range_rate = topo.range_rate;
|
2011-12-16 23:38:28 +00:00
|
|
|
}
|
|
|
|
|
2012-10-11 18:52:51 +00:00
|
|
|
/**
|
|
|
|
* Destructor
|
|
|
|
*/
|
2011-12-16 23:38:28 +00:00
|
|
|
virtual ~CoordTopographic()
|
|
|
|
{
|
2012-10-11 18:52:51 +00:00
|
|
|
}
|
2011-12-16 23:38:28 +00:00
|
|
|
|
2012-10-11 18:52:51 +00:00
|
|
|
/**
|
|
|
|
* Assignment operator
|
|
|
|
* @param[in] topo object to copy from
|
|
|
|
*/
|
|
|
|
CoordTopographic& operator=(const CoordTopographic& topo)
|
2011-12-16 23:38:28 +00:00
|
|
|
{
|
2012-10-11 18:52:51 +00:00
|
|
|
if (this != &topo)
|
|
|
|
{
|
|
|
|
azimuth = topo.azimuth;
|
|
|
|
elevation = topo.elevation;
|
|
|
|
range = topo.range;
|
|
|
|
range_rate = topo.range_rate;
|
2011-12-16 23:38:28 +00:00
|
|
|
}
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2012-10-11 18:52:51 +00:00
|
|
|
/**
|
|
|
|
* Equality operator
|
|
|
|
* @param[in] topo value to check
|
|
|
|
* @returns whether the object is equal
|
|
|
|
*/
|
|
|
|
bool operator==(const CoordTopographic& topo) const
|
2011-12-16 23:38:28 +00:00
|
|
|
{
|
2012-10-11 18:52:51 +00:00
|
|
|
return IsEqual(topo);
|
2011-12-16 23:38:28 +00:00
|
|
|
}
|
|
|
|
|
2012-10-11 18:52:51 +00:00
|
|
|
/**
|
|
|
|
* Inequality operator
|
|
|
|
* @param[in] topo the object to compare with
|
|
|
|
* @returns whether the object is not equal
|
|
|
|
*/
|
|
|
|
bool operator !=(const CoordTopographic& topo) const
|
2011-12-16 23:38:28 +00:00
|
|
|
{
|
2012-10-11 18:52:51 +00:00
|
|
|
return !IsEqual(topo);
|
2011-12-16 23:38:28 +00:00
|
|
|
}
|
|
|
|
|
2012-10-11 18:52:51 +00:00
|
|
|
/**
|
|
|
|
* Dump this object to a string
|
|
|
|
* @returns string
|
|
|
|
*/
|
2011-12-16 23:38:28 +00:00
|
|
|
std::string ToString() const
|
|
|
|
{
|
|
|
|
std::stringstream ss;
|
2012-10-11 18:52:51 +00:00
|
|
|
ss << std::right << std::fixed << std::setprecision(3);
|
|
|
|
ss << "Az: " << std::setw(8) << Util::RadiansToDegrees(azimuth);
|
|
|
|
ss << ", El: " << std::setw(8) << Util::RadiansToDegrees(elevation);
|
|
|
|
ss << ", Rng: " << std::setw(10) << range;
|
|
|
|
ss << ", Rng Rt: " << std::setw(7) << range_rate;
|
2011-12-16 23:38:28 +00:00
|
|
|
return ss.str();
|
|
|
|
}
|
|
|
|
|
2012-10-11 18:52:51 +00:00
|
|
|
/** azimuth in radians */
|
2011-12-16 23:38:28 +00:00
|
|
|
double azimuth;
|
2012-10-11 18:52:51 +00:00
|
|
|
/** elevations in radians */
|
2011-12-16 23:38:28 +00:00
|
|
|
double elevation;
|
2012-10-11 18:52:51 +00:00
|
|
|
/** range in kilometers */
|
2011-12-16 23:38:28 +00:00
|
|
|
double range;
|
2012-10-11 18:52:51 +00:00
|
|
|
/** range rate in kilometers per second */
|
2011-12-16 23:38:28 +00:00
|
|
|
double range_rate;
|
|
|
|
|
2012-10-11 18:52:51 +00:00
|
|
|
private:
|
|
|
|
bool IsEqual(const CoordTopographic& topo) const
|
2011-12-16 23:38:28 +00:00
|
|
|
{
|
2012-10-11 18:52:51 +00:00
|
|
|
bool equal = false;
|
|
|
|
if (azimuth == topo.azimuth &&
|
|
|
|
elevation == topo.elevation &&
|
|
|
|
range == topo.range &&
|
|
|
|
range_rate == topo.range_rate)
|
|
|
|
{
|
|
|
|
equal = true;
|
|
|
|
}
|
|
|
|
return equal;
|
2011-12-16 23:38:28 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
inline std::ostream& operator<<(std::ostream& strm, const CoordTopographic& t)
|
|
|
|
{
|
|
|
|
return strm << t.ToString();
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|