1
0
Fork 0

Maintenance: apt_loader

SPDX tags.
parameter to loadAirportFormFile() changed to const&.
parameter to Line() ctor changed to const&.
parameter to loadAirport() changed to const&.
member variable initialization.
++prefix for complex types.
virtual dtor.
This commit is contained in:
scttgs0 2023-05-23 00:56:19 -05:00
parent 2c40595d3c
commit cda2337041
2 changed files with 691 additions and 718 deletions

File diff suppressed because it is too large Load diff

View file

@ -7,7 +7,6 @@
#pragma once
#include "airport.hxx"
#include <string>
#include <unordered_map>
#include <vector>
@ -18,18 +17,21 @@
#include <simgear/misc/sg_path.hxx>
#include <simgear/structure/SGSharedPtr.hxx>
#include "airport.hxx"
class NavDataCache;
class sg_gzifstream;
class FGPavement;
namespace flightgear {
class APTLoader
{
public:
APTLoader();
~APTLoader();
virtual ~APTLoader();
// Read the specified apt.dat file into 'airportInfoMap'.
// 'bytesReadSoFar' and 'totalSizeOfAllAptDatFiles' are used for progress
@ -43,11 +45,11 @@ public:
// Load a specific airport defined in aptdb_file, and return a "rich" view
// of the airport including taxiways, pavement and line features.
const FGAirport* loadAirportFromFile(std::string id, const SGPath& aptdb_file);
const FGAirport* loadAirportFromFile(const std::string& id, const SGPath& aptdb_file);
private:
struct Line {
Line(unsigned int number_, unsigned int rowCode_, std::string str_)
Line(unsigned int number_, unsigned int rowCode_, const std::string& str_)
: number(number_), rowCode(rowCode_), str(str_) {}
unsigned int number;
@ -78,7 +80,7 @@ private:
APTLoader(const APTLoader&); // disable copy constructor
APTLoader& operator=(const APTLoader&); // disable copy-assignment operator
const FGAirport* loadAirport(const std::string aptDat, const std::string airportID, RawAirportInfo* airport_info, bool createFGAirport = false);
const FGAirport* loadAirport(const std::string& aptDat, const std::string& airportID, RawAirportInfo* airport_info, bool createFGAirport = false);
// Tell whether an apt.dat line is blank or a comment line
bool isBlankOrCommentLine(const std::string& line);
@ -111,10 +113,10 @@ private:
std::vector<std::string> token;
AirportInfoMapType airportInfoMap;
double rwy_lat_accum;
double rwy_lon_accum;
double last_rwy_heading;
int rwy_count;
double rwy_lat_accum{0.0};
double rwy_lon_accum{0.0};
double last_rwy_heading{0.0};
int rwy_count{0};
std::string last_apt_id;
double last_apt_elev;
SGGeod tower;