121 lines
3.4 KiB
C++
121 lines
3.4 KiB
C++
|
|
#ifndef GERMANAIRLINESVA_FILE_FSUIPC_FSLATITUDESPANIMPL_H
|
|
#define GERMANAIRLINESVA_FILE_FSUIPC_FSLATITUDESPANIMPL_H
|
|
|
|
#include "FsLatitudeSpan.h"
|
|
|
|
namespace germanairlinesva
|
|
{
|
|
namespace file
|
|
{
|
|
namespace FSUIPC
|
|
{
|
|
inline FsLatitudeSpan::FsLatitudeSpan() = default;
|
|
inline FsLatitudeSpan::FsLatitudeSpan(double DecimalDegrees)
|
|
{
|
|
this->span = DecimalDegrees;
|
|
}
|
|
inline FsLatitudeSpan::FsLatitudeSpan(std::int32_t Degrees,
|
|
double DecimalMinutes)
|
|
: FsLatitudeSpan(Degrees + DecimalMinutes / 60.0)
|
|
{
|
|
}
|
|
inline FsLatitudeSpan::FsLatitudeSpan(std::int32_t Degrees,
|
|
std::int32_t Minutes,
|
|
double DecimalSeconds)
|
|
: FsLatitudeSpan(Degrees + Minutes / 60.0 + DecimalSeconds / 3600.0)
|
|
{
|
|
}
|
|
|
|
inline FsLatitudeSpan FsLatitudeSpan::FromFeet(double Feet)
|
|
{
|
|
return FsLatitudeSpan(Feet / 364601.4567);
|
|
}
|
|
inline FsLatitudeSpan
|
|
FsLatitudeSpan::FromNauticalMiles(double NauticalMiles)
|
|
{
|
|
return FsLatitudeSpan::FromFeet(NauticalMiles * 6076.1155);
|
|
}
|
|
inline FsLatitudeSpan FsLatitudeSpan::FromMetres(double Metres)
|
|
{
|
|
return FsLatitudeSpan::FromFeet(Metres * 3.2808);
|
|
}
|
|
inline FsLatitudeSpan
|
|
FsLatitudeSpan::BetweenTwoLatitides(const FsLatitude &Lat1,
|
|
const FsLatitude &Lat2)
|
|
{
|
|
return FsLatitudeSpan(abs(Lat2.UDegrees() - Lat1.UDegrees()));
|
|
}
|
|
|
|
inline double FsLatitudeSpan::DecimalDegrees() const { return this->span; }
|
|
inline double FsLatitudeSpan::DecimalMinutes() const
|
|
{
|
|
return (this->span - trunc(this->span)) * 60.0;
|
|
}
|
|
inline double FsLatitudeSpan::DecimalSeconds() const
|
|
{
|
|
double decimalMinutes = this->DecimalMinutes();
|
|
return (decimalMinutes - trunc(decimalMinutes)) * 60.0;
|
|
}
|
|
|
|
inline std::int32_t FsLatitudeSpan::Degrees() const
|
|
{
|
|
return trunc(this->span);
|
|
}
|
|
inline std::int32_t FsLatitudeSpan::Minutes() const
|
|
{
|
|
return trunc(this->DecimalMinutes());
|
|
}
|
|
inline std::int32_t FsLatitudeSpan::Seconds() const
|
|
{
|
|
return trunc(this->DecimalSeconds());
|
|
}
|
|
|
|
inline double FsLatitudeSpan::TotalMinutes() const
|
|
{
|
|
return this->span * 60.0;
|
|
}
|
|
inline double FsLatitudeSpan::TotalSeconds() const
|
|
{
|
|
return this->span * 3600.0;
|
|
}
|
|
|
|
inline double FsLatitudeSpan::ToFeet() const
|
|
{
|
|
return 364601.4567 * this->span;
|
|
}
|
|
inline double FsLatitudeSpan::ToNauticalMiles() const
|
|
{
|
|
return this->ToFeet() / 6076.1155;
|
|
}
|
|
inline double FsLatitudeSpan::ToMetres() const
|
|
{
|
|
return this->ToFeet() / 3.2808;
|
|
}
|
|
|
|
inline const std::string FsLatitudeSpan::to_string(char DetailLevel) const
|
|
{
|
|
std::ostringstream str;
|
|
switch (DetailLevel) {
|
|
case 'm':
|
|
str << this->Degrees() << "* " << this->DecimalMinutes() << "'";
|
|
break;
|
|
case 's':
|
|
str << this->Degrees() << "* " << this->Minutes() << "' "
|
|
<< this->DecimalSeconds() << "\"";
|
|
break;
|
|
default:
|
|
str << this->span << "*";
|
|
break;
|
|
}
|
|
return str.str();
|
|
}
|
|
inline const std::string FsLatitudeSpan::to_string()
|
|
{
|
|
return this->to_string('m');
|
|
}
|
|
} // namespace FSUIPC
|
|
} // namespace file
|
|
} // namespace germanairlinesva
|
|
|
|
#endif |