move Azimuth.h to C++11

This commit is contained in:
Dennis Luxen 2014-05-05 18:21:03 +02:00
parent dd4461d473
commit 380111a604

View File

@ -25,33 +25,49 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef AZIMUTH_H_ #ifndef AZIMUTH_H
#define AZIMUTH_H_ #define AZIMUTH_H
#include <string> #include <string>
struct Azimuth { struct Azimuth
static std::string Get(const double heading) { {
if(heading <= 202.5) { static std::string Get(const double heading)
if(heading >= 0 && heading <= 22.5) {
if (heading <= 202.5)
{
if (heading >= 0 && heading <= 22.5)
{
return "N"; return "N";
if(heading > 22.5 && heading <= 67.5) }
if (heading > 22.5 && heading <= 67.5)
{
return "NE"; return "NE";
if(heading > 67.5 && heading <= 112.5) }
if (heading > 67.5 && heading <= 112.5)
{
return "E"; return "E";
if(heading > 112.5 && heading <= 157.5) }
if (heading > 112.5 && heading <= 157.5)
{
return "SE"; return "SE";
}
return "S"; return "S";
} }
if(heading > 202.5 && heading <= 247.5) if (heading > 202.5 && heading <= 247.5)
{
return "SW"; return "SW";
if(heading > 247.5 && heading <= 292.5) }
if (heading > 247.5 && heading <= 292.5)
{
return "W"; return "W";
if(heading > 292.5 && heading <= 337.5) }
if (heading > 292.5 && heading <= 337.5)
{
return "NW"; return "NW";
}
return "N"; return "N";
} }
}; };
#endif // AZIMUTH_H
#endif /* AZIMUTH_H_ */