Updated CoordTopographic

feature/19
Daniel Warner 2011-12-13 21:35:43 +00:00
parent 74ac17ff42
commit 390adaf224
3 changed files with 71 additions and 76 deletions

View File

@ -1,63 +0,0 @@
#include "CoordTopographic.h"
#include "Globals.h"
#include <sstream>
#include <iomanip>
CoordTopographic::CoordTopographic(const CoordTopographic& b) {
azimuth = b.azimuth;
elevation = b.elevation;
range = b.range;
range_rate = b.range_rate;
}
CoordTopographic& CoordTopographic::operator =(const CoordTopographic& b) {
if (this != &b) {
azimuth = b.azimuth;
elevation = b.elevation;
range = b.range;
range_rate = b.range_rate;
}
return (*this);
}
bool CoordTopographic::operator ==(const CoordTopographic& b) const {
if (azimuth == b.azimuth &&
elevation == b.elevation &&
range == b.range &&
range_rate == b.range_rate) {
return true;
} else {
return false;
}
}
bool CoordTopographic::operator !=(const CoordTopographic& b) const {
if (azimuth == b.azimuth &&
elevation == b.elevation &&
range == b.range &&
range_rate == b.range_rate) {
return false;
} else {
return true;
}
}
std::ostream& operator<< (std::ostream& stream, const CoordTopographic& topo) {
std::stringstream out;
out << std::right << std::fixed << std::setprecision(2);
out << "Az: " << std::setw(7) << RadiansToDegrees(topo.azimuth);
out << ", El: " << std::setw(7) << RadiansToDegrees(topo.elevation);
out << ", Rng: " << std::setw(9) << topo.range;
out << ", Rng Rt: " << std::setw(6) << topo.range_rate;
stream << out.str();
return stream;
}

View File

@ -1,29 +1,68 @@
#ifndef COORDTOPOGRAPHIC_H_ #ifndef COORDTOPOGRAPHIC_H_
#define COORDTOPOGRAPHIC_H_ #define COORDTOPOGRAPHIC_H_
#include "Globals.h"
#include <iostream> #include <iostream>
#include <sstream>
#include <iomanip>
struct CoordTopographic { struct CoordTopographic
{
public: public:
CoordTopographic() CoordTopographic()
: azimuth(0.0), elevation(0.0), range(0.0), range_rate(0.0) { : azimuth(0.0), elevation(0.0), range(0.0), range_rate(0.0)
{
} }
CoordTopographic(double az, double el, double rnge, double rnge_rate) CoordTopographic(double az, double el, double rnge, double rnge_rate)
: azimuth(az), elevation(el), range(rnge), range_rate(rnge_rate) { : azimuth(az), elevation(el), range(rnge), range_rate(rnge_rate)
{
} }
CoordTopographic(const CoordTopographic& b); CoordTopographic(const CoordTopographic& t)
{
azimuth = t.azimuth;
elevation = t.elevation;
range = t.range;
range_rate = t.range_rate;
}
virtual ~CoordTopographic() { virtual ~CoordTopographic()
{
}; };
CoordTopographic & operator =(const CoordTopographic& b); CoordTopographic& operator=(const CoordTopographic& t)
bool operator ==(const CoordTopographic& b) const; {
bool operator !=(const CoordTopographic& b) const; if (this != &t) {
azimuth = t.azimuth;
elevation = t.elevation;
range = t.range;
range_rate = t.range_rate;
}
return *this;
}
friend std::ostream& operator<< (std::ostream& stream, const CoordTopographic& topo); 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();
}
/* /*
* radians * radians
@ -41,7 +80,27 @@ public:
* kilometers / second * kilometers / second
*/ */
double range_rate; double range_rate;
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;
}
}
}; };
inline std::ostream& operator<<(std::ostream& strm, const CoordTopographic& t)
{
return strm << t.ToString();
}
#endif #endif

View File

@ -10,8 +10,7 @@ endif
LDFLAGS= LDFLAGS=
SOURCES=CoordTopographic.cpp \ SOURCES=Eci.cpp \
Eci.cpp \
Globals.cpp \ Globals.cpp \
Julian.cpp \ Julian.cpp \
Observer.cpp \ Observer.cpp \