geocoordinatecalculator/angle.h

36 lines
960 B
C
Raw Permalink Normal View History

2015-06-24 23:20:44 +02:00
#ifndef COORDINATE_H
#define COORDINATE_H
#include <string>
2017-05-01 03:40:44 +02:00
class Angle {
2015-06-24 23:20:44 +02:00
public:
2017-05-01 03:40:44 +02:00
enum class AngularMeasure { Radian, Degree };
2015-06-24 23:20:44 +02:00
2017-05-01 03:40:44 +02:00
enum class OutputForm { Degrees, Minutes, Seconds, Radians };
2015-06-24 23:20:44 +02:00
Angle();
Angle(double value, AngularMeasure measure = AngularMeasure::Radian);
explicit Angle(const std::string &value, AngularMeasure measure = AngularMeasure::Radian);
double degreeValue() const;
double radianValue() const;
bool isNull() const;
void adjust0To360();
void adjust180To180();
void reverse();
std::string toString() const;
std::string toString(OutputForm format) const;
2017-05-01 03:40:44 +02:00
bool operator==(const Angle &other) const;
bool operator!=(const Angle &other) const;
Angle operator+(const Angle &other) const;
Angle operator-(const Angle &other) const;
Angle &operator+=(const Angle &other);
Angle &operator-=(const Angle &other);
2015-06-24 23:20:44 +02:00
private:
double m_val;
};
#endif // COORDINATE_H