This commit is contained in:
2022-09-11 23:26:28 +02:00
parent 46a0607b55
commit 07487e9e51
17 changed files with 161 additions and 180 deletions
+4 -2
View File
@@ -26,14 +26,16 @@ namespace file
std::uint32_t time;
std::uint16_t altitude = 0;
std::uint16_t groundSpeed = 0;
struct germanairlinesva::geodata::point coordinates{NAN, NAN};
struct geodata::point coordinates {
NAN, NAN
};
public:
RecordingEntry() = default;
RecordingEntry(std::uint32_t time,
std::uint16_t altitude,
std::uint16_t groundSpeed,
struct germanairlinesva::geodata::point coordinates);
struct geodata::point coordinates);
void toFile(std::ofstream &out) const;
+3 -3
View File
@@ -34,16 +34,16 @@ namespace file
{
private:
std::string designator;
struct germanairlinesva::geodata::point center;
struct geodata::point center;
std::uint8_t radius;
public:
Gate(std::string designator,
struct germanairlinesva::geodata::point center,
struct geodata::point center,
std::uint8_t radius);
void toFile(std::ofstream &out) const;
bool contains(germanairlinesva::geodata::point coordinates) const;
bool contains(geodata::point coordinates) const;
inline const std::string to_string() const
{
+2 -2
View File
@@ -34,7 +34,7 @@ namespace file
{
private:
std::string designator;
struct germanairlinesva::geodata::box bounds;
struct geodata::box bounds;
std::uint8_t width;
std::uint16_t length;
std::uint16_t trueHeading;
@@ -50,7 +50,7 @@ namespace file
double width);
// From database
Runway(std::string designator,
struct germanairlinesva::geodata::box bounds,
struct geodata::box bounds,
std::uint8_t width,
std::uint16_t length,
std::uint16_t trueHeading);
+6 -9
View File
@@ -42,10 +42,7 @@ namespace file
class SimDatabase
{
private:
std::map<
std::string,
std::pair<std::vector<germanairlinesva::file::simdata::Gate>,
std::vector<germanairlinesva::file::simdata::Runway>>>
std::map<std::string, std::pair<std::vector<Gate>, std::vector<Runway>>>
airports;
void fromFile();
@@ -64,11 +61,11 @@ namespace file
const std::vector<Runway>>
operator[](std::string key)
{
try {
return this->airports.at(key);
} catch (std::out_of_range &ex) {
return std::pair<const std::vector<Gate>,
const std::vector<Runway>>();
auto it = this->airports.find(key);
if (it != this->airports.end()) {
return this->airports[key];
} else {
return std::pair<std::vector<Gate>, std::vector<Runway>>();
}
}
};
+2 -4
View File
@@ -20,15 +20,13 @@ namespace file
const std::string defaultFile,
const std::string sceneryPack,
const std::string logFile,
std::map<std::string,
std::pair<std::vector<Gate>, std::vector<Runway>>>
std::map<std::string, std::pair<std::vector<Gate>, std::vector<Runway>>>
&airports);
void makeAirport(
const std::string &kind,
std::ifstream &infile,
std::map<std::string,
std::pair<std::vector<Gate>, std::vector<Runway>>>
std::map<std::string, std::pair<std::vector<Gate>, std::vector<Runway>>>
&airports,
std::ofstream &logfile);
void makeGate15(std::vector<Gate> &gates,