Merge branch 'develop' of https://git.hofmannnet.myhome-server.de/GermanAirlines/GermanAirlinesVA-GAConnector into develop
This commit is contained in:
@@ -21,6 +21,12 @@ namespace file
|
||||
write<decltype(this->center)>(out, this->center);
|
||||
write<decltype(this->radius)>(out, this->radius);
|
||||
}
|
||||
|
||||
bool Gate::contains(germanairlinesva::geodata::point coordinates) const
|
||||
{
|
||||
return germanairlinesva::geodata::distanceEarthP(this->center,
|
||||
coordinates);
|
||||
}
|
||||
} // namespace simdata
|
||||
} // namespace file
|
||||
} // namespace germanairlinesva
|
||||
@@ -24,9 +24,9 @@ namespace file
|
||||
{
|
||||
private:
|
||||
std::uint32_t time;
|
||||
std::uint16_t altitude;
|
||||
std::uint16_t groundSpeed;
|
||||
struct germanairlinesva::geodata::point coordinates;
|
||||
std::uint16_t altitude = 0;
|
||||
std::uint16_t groundSpeed = 0;
|
||||
struct germanairlinesva::geodata::point coordinates{NAN, NAN};
|
||||
|
||||
public:
|
||||
RecordingEntry() = default;
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace file
|
||||
std::uint8_t radius);
|
||||
|
||||
void toFile(std::ofstream &out) const;
|
||||
bool contains(germanairlinesva::geodata::point coordinates) const;
|
||||
|
||||
inline const std::string to_string() const
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "simdata/gate.h"
|
||||
#include "simdata/runway.h"
|
||||
#include "simdata/simDatabase.h"
|
||||
#include "util.hpp"
|
||||
|
||||
namespace germanairlinesva
|
||||
@@ -15,20 +16,16 @@ namespace file
|
||||
{
|
||||
namespace simdata
|
||||
{
|
||||
int scan(
|
||||
const std::string defaultFile,
|
||||
const std::string sceneryPack,
|
||||
const std::string logFile,
|
||||
std::map<std::string, std::pair<std::vector<const Gate>, std::vector<const Runway>>>
|
||||
&airports);
|
||||
int scan(const std::string defaultFile,
|
||||
const std::string sceneryPack,
|
||||
const std::string logFile,
|
||||
SimDatabase &airports);
|
||||
|
||||
void makeAirport(
|
||||
const std::string &kind,
|
||||
std::ifstream &infile,
|
||||
std::map<std::string, std::pair<std::vector<const Gate>, std::vector<const Runway>>>
|
||||
&airports,
|
||||
std::ofstream &logfile);
|
||||
void makeGate15(std::vector<const Gate> &gates,
|
||||
void makeAirport(const std::string &kind,
|
||||
std::ifstream &infile,
|
||||
SimDatabase &airports,
|
||||
std::ofstream &logfile);
|
||||
void makeGate15(std::vector<Gate> &gates,
|
||||
const std::vector<std::string> &fields);
|
||||
void makeRunway(std::vector<const Runway> &runways,
|
||||
const std::vector<std::string> &fields);
|
||||
|
||||
+15
-18
@@ -6,12 +6,10 @@ namespace file
|
||||
{
|
||||
namespace simdata
|
||||
{
|
||||
int scan(
|
||||
const std::string defaultFile,
|
||||
const std::string sceneryPack,
|
||||
const std::string logFile,
|
||||
std::map<std::string, std::pair<std::vector<const Gate>, std::vector<const Runway>>>
|
||||
&airports)
|
||||
int scan(const std::string defaultFile,
|
||||
const std::string sceneryPack,
|
||||
const std::string logFile,
|
||||
SimDatabase &database)
|
||||
{
|
||||
std::ifstream base(defaultFile);
|
||||
if (!base.good()) {
|
||||
@@ -31,7 +29,7 @@ namespace file
|
||||
|
||||
// Default
|
||||
logfile << "<FILE> " << defaultFile << std::endl;
|
||||
makeAirport("DEFAULT", base, airports, logfile);
|
||||
makeAirport("DEFAULT", base, database, logfile);
|
||||
base.close();
|
||||
|
||||
std::string line;
|
||||
@@ -51,7 +49,7 @@ namespace file
|
||||
std::ifstream pack(path);
|
||||
if (pack.good()) {
|
||||
logfile << "<FILE> " << path << std::endl;
|
||||
makeAirport("CUSTOM", pack, airports, logfile);
|
||||
makeAirport("CUSTOM", pack, database, logfile);
|
||||
pack.close();
|
||||
} else {
|
||||
pack.close();
|
||||
@@ -61,19 +59,18 @@ namespace file
|
||||
}
|
||||
|
||||
logfile << std::endl
|
||||
<< "<STATUS> Total airports: " << airports.size() << std::endl;
|
||||
<< "<STATUS> Total airports: " << database.numAirports()
|
||||
<< std::endl;
|
||||
|
||||
custom.close();
|
||||
logfile.close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void makeAirport(
|
||||
const std::string &kind,
|
||||
std::ifstream &infile,
|
||||
std::map<std::string, std::pair<std::vector<const Gate>, std::vector<const Runway>>>
|
||||
&airports,
|
||||
std::ofstream &logfile)
|
||||
void makeAirport(const std::string &kind,
|
||||
std::ifstream &infile,
|
||||
SimDatabase &database,
|
||||
std::ofstream &logfile)
|
||||
{
|
||||
std::string line;
|
||||
std::string *currentIcao = nullptr;
|
||||
@@ -96,7 +93,7 @@ namespace file
|
||||
// Write to file if ICAO is valid, and we have gates and runways
|
||||
if (currentIcao != nullptr && !tmpRunways.empty() &&
|
||||
!tmpGates.empty()) {
|
||||
airports[*currentIcao] = {tmpGates, tmpRunways};
|
||||
database.addAirport(*currentIcao, tmpGates, tmpRunways);
|
||||
validCount += 1;
|
||||
logfile << "\t<STATUS> " << *currentIcao << " committed"
|
||||
<< std::endl;
|
||||
@@ -116,7 +113,7 @@ namespace file
|
||||
// Write to file if ICAO is valid, and we have gates and runways
|
||||
if (currentIcao != nullptr && !tmpRunways.empty() &&
|
||||
!tmpGates.empty()) {
|
||||
airports[*currentIcao] = {tmpGates, tmpRunways};
|
||||
database.addAirport(*currentIcao, tmpGates, tmpRunways);
|
||||
validCount += 1;
|
||||
logfile << "\t<STATUS> " << *currentIcao << " committed"
|
||||
<< std::endl;
|
||||
@@ -138,7 +135,7 @@ namespace file
|
||||
}
|
||||
|
||||
if (currentIcao != nullptr && !tmpRunways.empty() && !tmpGates.empty()) {
|
||||
airports[*currentIcao] = {tmpGates, tmpRunways};
|
||||
database.addAirport(*currentIcao, tmpGates, tmpRunways);
|
||||
validCount += 1;
|
||||
logfile << "\t<STATUS> " << *currentIcao << " committed" << std::endl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user