Namespaces and formatting
This commit is contained in:
@@ -51,10 +51,10 @@ namespace file
|
||||
std::ifstream in(BASE_DIRECTORY CONFIG);
|
||||
std::string line;
|
||||
while (std::getline(in, line)) {
|
||||
std::vector<std::string> fields = util::split(line, '=');
|
||||
std::vector<std::string> fields = utilities::split(line, '=');
|
||||
if (fields.size() >= 2) {
|
||||
util::trim(fields[0]);
|
||||
util::trim(fields[1]);
|
||||
utilities::trim(fields[0]);
|
||||
utilities::trim(fields[1]);
|
||||
if (fields[0] == "scenery") {
|
||||
this->scenery = fields[1];
|
||||
} else if (fields[0] == "user") {
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace file
|
||||
public:
|
||||
inline Logbook()
|
||||
{
|
||||
if (util::fileExists(BASE_DIRECTORY LOGBOOK)) {
|
||||
if (utilities::fileExists(BASE_DIRECTORY LOGBOOK)) {
|
||||
this->fromFile();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef GERMANAIRLINESVA_FILE_RECORDINGENTRY_H
|
||||
#define GERMANAIRLINESVA_FILE_RECORDINGENTRY_H
|
||||
#ifndef GERMANAIRLINESVA_FILE_RECORDING_RECORDINGENTRY_H
|
||||
#define GERMANAIRLINESVA_FILE_RECORDING_RECORDINGENTRY_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <fstream>
|
||||
@@ -26,14 +26,14 @@ namespace file
|
||||
std::uint32_t time;
|
||||
std::uint16_t altitude = 0;
|
||||
std::uint16_t groundSpeed = 0;
|
||||
struct geodata::point coordinates = {NAN, NAN};
|
||||
struct utilities::geodata::point coordinates = {NAN, NAN};
|
||||
|
||||
public:
|
||||
inline RecordingEntry() = default;
|
||||
inline RecordingEntry(std::uint32_t time,
|
||||
std::uint16_t altitude,
|
||||
std::uint16_t groundSpeed,
|
||||
struct geodata::point coordinates)
|
||||
struct utilities::geodata::point coordinates)
|
||||
: time(time), altitude(altitude), groundSpeed(groundSpeed),
|
||||
coordinates(coordinates)
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace file
|
||||
{
|
||||
private:
|
||||
std::string designator;
|
||||
struct geodata::point center;
|
||||
struct utilities::geodata::point center;
|
||||
std::uint8_t radius;
|
||||
|
||||
public:
|
||||
@@ -45,7 +45,7 @@ namespace file
|
||||
radius(radius){};
|
||||
// From Database
|
||||
inline Gate(std::string designator,
|
||||
struct geodata::point center,
|
||||
struct utilities::geodata::point center,
|
||||
std::uint8_t radius)
|
||||
: designator(designator), center(center), radius(radius){};
|
||||
|
||||
@@ -56,9 +56,9 @@ namespace file
|
||||
write<decltype(this->radius)>(out, this->radius);
|
||||
}
|
||||
|
||||
inline bool contains(geodata::point coordinates) const
|
||||
inline bool contains(utilities::geodata::point coordinates) const
|
||||
{
|
||||
return geodata::distanceEarthP(this->center, coordinates);
|
||||
return utilities::geodata::distanceEarthP(this->center, coordinates);
|
||||
}
|
||||
|
||||
inline const std::string to_string() const
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace file
|
||||
{
|
||||
private:
|
||||
std::string designator;
|
||||
struct geodata::box bounds;
|
||||
struct utilities::geodata::box bounds;
|
||||
std::uint8_t width;
|
||||
std::uint16_t length;
|
||||
double trueHeading;
|
||||
@@ -49,52 +49,54 @@ namespace file
|
||||
double width)
|
||||
: designator(designator), width(width)
|
||||
{
|
||||
this->length = geodata::distanceEarthD(latitudeStart,
|
||||
longitudeStart,
|
||||
latitudeEnd,
|
||||
longitudeEnd);
|
||||
this->trueHeading = geodata::bearingDD(latitudeStart,
|
||||
longitudeStart,
|
||||
latitudeEnd,
|
||||
longitudeEnd);
|
||||
this->bounds =
|
||||
geodata::calculateBoxDD({latitudeStart, longitudeStart},
|
||||
{latitudeEnd, longitudeEnd},
|
||||
this->trueHeading,
|
||||
this->width);
|
||||
this->length = utilities::geodata::distanceEarthD(latitudeStart,
|
||||
longitudeStart,
|
||||
latitudeEnd,
|
||||
longitudeEnd);
|
||||
this->trueHeading = utilities::geodata::bearingDD(latitudeStart,
|
||||
longitudeStart,
|
||||
latitudeEnd,
|
||||
longitudeEnd);
|
||||
this->bounds = utilities::geodata::calculateBoxDD(
|
||||
{latitudeStart, longitudeStart},
|
||||
{latitudeEnd, longitudeEnd},
|
||||
this->trueHeading,
|
||||
this->width);
|
||||
};
|
||||
// From MakeRwys
|
||||
inline Runway(std::string designator,
|
||||
struct geodata::point start,
|
||||
struct utilities::geodata::point start,
|
||||
double width,
|
||||
double length,
|
||||
double trueHeading)
|
||||
: designator(designator), width(width), length(length),
|
||||
trueHeading(trueHeading)
|
||||
{
|
||||
geodata::point end =
|
||||
geodata::calculatePointDD(start, trueHeading, length);
|
||||
utilities::geodata::point end =
|
||||
utilities::geodata::calculatePointDD(start, trueHeading, length);
|
||||
|
||||
this->bounds =
|
||||
geodata::calculateBoxDD(start, end, trueHeading, width);
|
||||
this->bounds = utilities::geodata::calculateBoxDD(start,
|
||||
end,
|
||||
trueHeading,
|
||||
width);
|
||||
};
|
||||
// From database
|
||||
inline Runway(std::string designator,
|
||||
struct geodata::box bounds,
|
||||
struct utilities::geodata::box bounds,
|
||||
std::uint8_t width,
|
||||
std::uint16_t length,
|
||||
double trueHeading)
|
||||
: designator(designator), bounds(bounds), width(width),
|
||||
length(length), trueHeading(trueHeading){};
|
||||
|
||||
inline bool containsPoint(const geodata::point point) const
|
||||
inline bool containsPoint(const utilities::geodata::point point) const
|
||||
{
|
||||
size_t j = 3;
|
||||
bool c = false;
|
||||
std::vector<geodata::point> poly{this->bounds.topLeft,
|
||||
this->bounds.topRight,
|
||||
this->bounds.bottomRight,
|
||||
this->bounds.bottomLeft};
|
||||
std::vector<utilities::geodata::point> poly{this->bounds.topLeft,
|
||||
this->bounds.topRight,
|
||||
this->bounds.bottomRight,
|
||||
this->bounds.bottomLeft};
|
||||
|
||||
for (size_t i = 0; i < poly.size(); i++) {
|
||||
if ((point.latitude == poly[i].latitude) &&
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#ifdef XP
|
||||
#include "simdata/simdataXP.hpp"
|
||||
#endif
|
||||
#ifndef MSFS
|
||||
#if not defined(XP) && not defined(MSFS)
|
||||
#include "simdata/simdataESP.hpp"
|
||||
#endif
|
||||
|
||||
@@ -61,7 +61,8 @@ namespace file
|
||||
std::uint16_t numGates = read<std::uint16_t>(in);
|
||||
for (int j = 0; j < numGates; j++) {
|
||||
std::string designator = readString(in);
|
||||
struct geodata::point center = read<struct geodata::point>(in);
|
||||
struct utilities::geodata::point center =
|
||||
read<struct utilities::geodata::point>(in);
|
||||
std::uint8_t radius = read<std::uint8_t>(in);
|
||||
|
||||
this->airports[icao].first.emplace_back(designator,
|
||||
@@ -73,7 +74,8 @@ namespace file
|
||||
for (int j = 0; j < numRunways; j++) {
|
||||
std::string designator = readString(in);
|
||||
// Center
|
||||
struct geodata::box bounds = read<struct geodata::box>(in);
|
||||
struct utilities::geodata::box bounds =
|
||||
read<struct utilities::geodata::box>(in);
|
||||
std::uint8_t width = read<std::uint8_t>(in);
|
||||
std::uint16_t length = read<std::uint16_t>(in);
|
||||
double trueHeading = read<double>(in);
|
||||
@@ -113,7 +115,7 @@ namespace file
|
||||
std::function<void(const std::string)> toLog)
|
||||
{
|
||||
if (strcmp(configuration->getScenery().c_str(), hash) != 0 ||
|
||||
!util::fileExists(BASE_DIRECTORY SIMDATABASE)) {
|
||||
!utilities::fileExists(BASE_DIRECTORY SIMDATABASE)) {
|
||||
#ifdef XP
|
||||
scan(simVersion < 12000 ? XPLANE11_BASE_SCENERY
|
||||
: XPLANE12_BASE_SCENERY,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef GERMANAIRLINESVA_FILE_SIMDATA_SIMDATAXP_H
|
||||
#define GERMANAIRLINESVA_FILE_SIMDATA_SIMDATAXP_H
|
||||
#ifndef GERMANAIRLINESVA_FILE_SIMDATA_SIMDATAESP_H
|
||||
#define GERMANAIRLINESVA_FILE_SIMDATA_SIMDATAESP_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <fstream>
|
||||
@@ -55,7 +55,7 @@ namespace file
|
||||
log << "<FILE> " << runwaysFile << std::endl;
|
||||
|
||||
while (std::getline(runways, line)) {
|
||||
std::vector<std::string> fields = util::split(line, ',');
|
||||
std::vector<std::string> fields = utilities::split(line, ',');
|
||||
// New ICAO
|
||||
if (currentIcao != nullptr && *currentIcao != fields[0]) {
|
||||
tmpAirportRunways[*currentIcao] = tmpRunways;
|
||||
@@ -85,20 +85,21 @@ namespace file
|
||||
designator = "0" + designator;
|
||||
}
|
||||
|
||||
struct geodata::point start = {std::stod(fields[2]),
|
||||
std::stod(fields[3])};
|
||||
tmpRunways.emplace_back(designator,
|
||||
start,
|
||||
geodata::toMetre(std::stod(fields[8])),
|
||||
geodata::toMetre(std::stod(fields[6])),
|
||||
std::stod(fields[5]) + std::stod(fields[9]));
|
||||
struct utilities::geodata::point start = {std::stod(fields[2]),
|
||||
std::stod(fields[3])};
|
||||
tmpRunways.emplace_back(
|
||||
designator,
|
||||
start,
|
||||
utilities::geodata::toMetre(std::stod(fields[8])),
|
||||
utilities::geodata::toMetre(std::stod(fields[6])),
|
||||
std::stod(fields[5]) + std::stod(fields[9]));
|
||||
|
||||
log << "\t<RUNWAY> " << line << std::endl;
|
||||
}
|
||||
|
||||
currentIcao = nullptr;
|
||||
while (std::getline(gates, line)) {
|
||||
std::vector<std::string> fields = util::split(line, ',');
|
||||
std::vector<std::string> fields = utilities::split(line, ',');
|
||||
// New ICAO
|
||||
if (currentIcao != nullptr && *currentIcao != fields[0]) {
|
||||
tmpAirportGates[*currentIcao] = tmpGates;
|
||||
|
||||
@@ -79,10 +79,11 @@ namespace file
|
||||
int validCount = 0;
|
||||
|
||||
while (std::getline(infile, line)) {
|
||||
std::vector<std::string> fields = util::split(line, ' ');
|
||||
fields = util::select_T<std::string>(fields, [](const std::string &s) {
|
||||
return s.length() > 0;
|
||||
});
|
||||
std::vector<std::string> fields = utilities::split(line, ' ');
|
||||
fields =
|
||||
utilities::select_T<std::string>(fields, [](const std::string &s) {
|
||||
return s.length() > 0;
|
||||
});
|
||||
|
||||
if (fields.empty())
|
||||
continue;
|
||||
@@ -173,7 +174,7 @@ namespace file
|
||||
std::vector<std::string> packs;
|
||||
while (std::getline(custom, line)) {
|
||||
if ((pos = line.find("SCENERY_PACK")) != std::string::npos) {
|
||||
std::string path = util::rtrim_copy(line.substr(pos + 13)) +
|
||||
std::string path = utilities::rtrim_copy(line.substr(pos + 13)) +
|
||||
"Earth nav data/apt.dat";
|
||||
packs.emplace_back(path);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user