53 lines
1.8 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 = geodata::distanceEarthD(latitudeStart,
longitudeStart,
latitudeEnd,
longitudeEnd);
this->trueHeading = geodata::bearingDR(latitudeStart,
longitudeStart,
latitudeEnd,
longitudeEnd);
this->center = {geodata::toRadians(latitudeStart),
geodata::toRadians(longitudeStart)};
}
Runway::Runway(std::string designator,
geodata::point center,
std::uint8_t width,
std::uint16_t length,
double trueHeading)
{
this->designator = designator;
this->center = center;
this->width = width;
this->length = length;
this->trueHeading = trueHeading;
}
void Runway::toFile(std::ofstream &out) const
{
writeString(out, this->designator);
write<decltype(this->center)>(out, this->center);
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