57 lines
2.0 KiB
C++
57 lines
2.0 KiB
C++
#include "simdata/runway.h"
|
|
|
|
namespace germanairlinesva
|
|
{
|
|
namespace file
|
|
{
|
|
namespace simdata
|
|
{
|
|
Runway::Runway(std::string designator,
|
|
double latitudeStart,
|
|
double longitudeStart,
|
|
double latitudeEnd,
|
|
double longitudeEnd,
|
|
double width)
|
|
{
|
|
this->designator = designator;
|
|
this->width = width;
|
|
this->length = germanairlinesva::geodata::distanceEarthD(latitudeStart,
|
|
longitudeStart,
|
|
latitudeEnd,
|
|
longitudeEnd);
|
|
this->trueHeading = (std::uint16_t)std::round(
|
|
germanairlinesva::geodata::bearingDD(latitudeStart,
|
|
longitudeStart,
|
|
latitudeEnd,
|
|
longitudeEnd));
|
|
this->bounds = germanairlinesva::geodata::calculateBoxDD(
|
|
{latitudeStart, longitudeStart},
|
|
{latitudeEnd, longitudeEnd},
|
|
this->trueHeading,
|
|
this->width);
|
|
}
|
|
|
|
Runway::Runway(std::string designator,
|
|
germanairlinesva::geodata::box bounds,
|
|
std::uint8_t width,
|
|
std::uint16_t length,
|
|
std::uint16_t trueHeading)
|
|
{
|
|
this->designator = designator;
|
|
this->bounds = bounds;
|
|
this->width = width;
|
|
this->length = length;
|
|
this->trueHeading = trueHeading;
|
|
}
|
|
|
|
void Runway::toFile(std::ofstream &out) const
|
|
{
|
|
writeString(out, this->designator);
|
|
write<decltype(this->bounds)>(out, this->bounds);
|
|
write<decltype(this->width)>(out, this->width);
|
|
write<decltype(this->length)>(out, this->length);
|
|
write<decltype(this->trueHeading)>(out, this->trueHeading);
|
|
}
|
|
} // namespace simdata
|
|
} // namespace file
|
|
} // namespace germanairlinesva
|