1
0
Fork 0
flightgear/src/Airports/apt_loader.hxx

161 lines
5.7 KiB
C++
Raw Normal View History

// apt_loader.hxx -- a front end loader of the apt.dat file. This loader
// populates the runway and basic classes.
//
// Written by Curtis Olson, started December 2004.
//
// Copyright (C) 2004 Curtis L. Olson - http://www.flightgear.org/~curt
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
2006-02-21 01:16:04 +00:00
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id$
#ifndef _FG_APT_LOADER_HXX
#define _FG_APT_LOADER_HXX
#include <string>
#include <vector>
#include <unordered_map>
#include "airport.hxx"
Support merging of arbitrary apt.dat[.gz] files It is now allowed to have the same airport appear in several apt.dat files ($scenery_path/NavData/apt/*.dat[.gz] for each scenery path, plus the default $FG_ROOT/Airports/apt.dat.gz, coming last). Airports found in earlier files(*) take precedence over those found later, in case several apt.dat files define the same airports. Airports that are skipped due to this mechanism are logged with SG_LOG(SG_GENERAL, SG_INFO, ...). (*) using 1) FG_SCENERY order (followed by $FG_ROOT/Airports/apt.dat.gz) and 2) lexicographic order inside each $scenery_path/NavData/apt folder With this commit, APTLoader::parseAPT() is replaced by two methods: readAptDatFile() and loadAirports(): - APTLoader::readAptDatFile() reads airport definitions from an apt.dat file into APTLoader's 'airportInfoMap' member variable, discarding duplicate definitions due to overlapping apt.dat files ('airportInfoMap' is an std::unordered_map instance in C++11 and later, an std::map otherwise); - APTLoader::loadAirports() reads each airport definition from 'airportInfoMap' and loads it into the NavCache, the same way as APTLoader::parseAPT() used to do. The airportDBLoad() function is not useful anymore, and is thus removed (in NavDataCache::doRebuild(), APTLoader::readAptDatFile() is now called once per apt.dat file, but APTLoader::loadAirports() is only called once at the end, after duplicate airports have been discarded; the class interface is much better suited to this scheme, because it can cleanly retain the state between these calls). By the way, this commit fixes an old bug: APTLoader's member variable 'last_apt_id' was used in several places but never assigned to, except in APTLoader::APTLoader() as the empty string. Thanks to Alan Teeder for his feedback and testing.
2016-05-23 00:43:03 +02:00
#include <simgear/compiler.h>
#include <simgear/structure/SGSharedPtr.hxx>
#include <simgear/math/SGGeod.hxx>
Support merging of arbitrary apt.dat[.gz] files It is now allowed to have the same airport appear in several apt.dat files ($scenery_path/NavData/apt/*.dat[.gz] for each scenery path, plus the default $FG_ROOT/Airports/apt.dat.gz, coming last). Airports found in earlier files(*) take precedence over those found later, in case several apt.dat files define the same airports. Airports that are skipped due to this mechanism are logged with SG_LOG(SG_GENERAL, SG_INFO, ...). (*) using 1) FG_SCENERY order (followed by $FG_ROOT/Airports/apt.dat.gz) and 2) lexicographic order inside each $scenery_path/NavData/apt folder With this commit, APTLoader::parseAPT() is replaced by two methods: readAptDatFile() and loadAirports(): - APTLoader::readAptDatFile() reads airport definitions from an apt.dat file into APTLoader's 'airportInfoMap' member variable, discarding duplicate definitions due to overlapping apt.dat files ('airportInfoMap' is an std::unordered_map instance in C++11 and later, an std::map otherwise); - APTLoader::loadAirports() reads each airport definition from 'airportInfoMap' and loads it into the NavCache, the same way as APTLoader::parseAPT() used to do. The airportDBLoad() function is not useful anymore, and is thus removed (in NavDataCache::doRebuild(), APTLoader::readAptDatFile() is now called once per apt.dat file, but APTLoader::loadAirports() is only called once at the end, after duplicate airports have been discarded; the class interface is much better suited to this scheme, because it can cleanly retain the state between these calls). By the way, this commit fixes an old bug: APTLoader's member variable 'last_apt_id' was used in several places but never assigned to, except in APTLoader::APTLoader() as the empty string. Thanks to Alan Teeder for his feedback and testing.
2016-05-23 00:43:03 +02:00
#include <simgear/misc/sg_path.hxx>
#include <Navaids/positioned.hxx>
class NavDataCache;
class sg_gzifstream;
class FGPavement;
namespace flightgear
{
class APTLoader
{
public:
APTLoader();
~APTLoader();
// Read the specified apt.dat file into 'airportInfoMap'.
// 'bytesReadSoFar' and 'totalSizeOfAllAptDatFiles' are used for progress
// information.
void readAptDatFile(const SGPath& aptdb_file, std::size_t bytesReadSoFar,
std::size_t totalSizeOfAllAptDatFiles);
Support merging of arbitrary apt.dat[.gz] files It is now allowed to have the same airport appear in several apt.dat files ($scenery_path/NavData/apt/*.dat[.gz] for each scenery path, plus the default $FG_ROOT/Airports/apt.dat.gz, coming last). Airports found in earlier files(*) take precedence over those found later, in case several apt.dat files define the same airports. Airports that are skipped due to this mechanism are logged with SG_LOG(SG_GENERAL, SG_INFO, ...). (*) using 1) FG_SCENERY order (followed by $FG_ROOT/Airports/apt.dat.gz) and 2) lexicographic order inside each $scenery_path/NavData/apt folder With this commit, APTLoader::parseAPT() is replaced by two methods: readAptDatFile() and loadAirports(): - APTLoader::readAptDatFile() reads airport definitions from an apt.dat file into APTLoader's 'airportInfoMap' member variable, discarding duplicate definitions due to overlapping apt.dat files ('airportInfoMap' is an std::unordered_map instance in C++11 and later, an std::map otherwise); - APTLoader::loadAirports() reads each airport definition from 'airportInfoMap' and loads it into the NavCache, the same way as APTLoader::parseAPT() used to do. The airportDBLoad() function is not useful anymore, and is thus removed (in NavDataCache::doRebuild(), APTLoader::readAptDatFile() is now called once per apt.dat file, but APTLoader::loadAirports() is only called once at the end, after duplicate airports have been discarded; the class interface is much better suited to this scheme, because it can cleanly retain the state between these calls). By the way, this commit fixes an old bug: APTLoader's member variable 'last_apt_id' was used in several places but never assigned to, except in APTLoader::APTLoader() as the empty string. Thanks to Alan Teeder for his feedback and testing.
2016-05-23 00:43:03 +02:00
// Read all airports gathered in 'airportInfoMap' and load them into the
// navdata cache (even in case of overlapping apt.dat files,
// 'airportInfoMap' has only one entry per airport).
void loadAirports();
// 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);
private:
Support merging of arbitrary apt.dat[.gz] files It is now allowed to have the same airport appear in several apt.dat files ($scenery_path/NavData/apt/*.dat[.gz] for each scenery path, plus the default $FG_ROOT/Airports/apt.dat.gz, coming last). Airports found in earlier files(*) take precedence over those found later, in case several apt.dat files define the same airports. Airports that are skipped due to this mechanism are logged with SG_LOG(SG_GENERAL, SG_INFO, ...). (*) using 1) FG_SCENERY order (followed by $FG_ROOT/Airports/apt.dat.gz) and 2) lexicographic order inside each $scenery_path/NavData/apt folder With this commit, APTLoader::parseAPT() is replaced by two methods: readAptDatFile() and loadAirports(): - APTLoader::readAptDatFile() reads airport definitions from an apt.dat file into APTLoader's 'airportInfoMap' member variable, discarding duplicate definitions due to overlapping apt.dat files ('airportInfoMap' is an std::unordered_map instance in C++11 and later, an std::map otherwise); - APTLoader::loadAirports() reads each airport definition from 'airportInfoMap' and loads it into the NavCache, the same way as APTLoader::parseAPT() used to do. The airportDBLoad() function is not useful anymore, and is thus removed (in NavDataCache::doRebuild(), APTLoader::readAptDatFile() is now called once per apt.dat file, but APTLoader::loadAirports() is only called once at the end, after duplicate airports have been discarded; the class interface is much better suited to this scheme, because it can cleanly retain the state between these calls). By the way, this commit fixes an old bug: APTLoader's member variable 'last_apt_id' was used in several places but never assigned to, except in APTLoader::APTLoader() as the empty string. Thanks to Alan Teeder for his feedback and testing.
2016-05-23 00:43:03 +02:00
struct Line
{
Line(unsigned int number_, unsigned int rowCode_, std::string str_)
: number(number_), rowCode(rowCode_), str(str_) { }
unsigned int number;
unsigned int rowCode; // Terminology of the apt.dat spec
std::string str;
};
typedef std::vector<Line> LinesList;
struct RawAirportInfo
{
// apt.dat file where the airport was defined
SGPath file;
// Row code for the airport (1, 16 or 17)
unsigned int rowCode;
// Line number in the apt.dat file where the airport definition starts
unsigned int firstLineNum;
// The whitespace-separated strings comprising the first line of the airport
// definition
std::vector<std::string> firstLineTokens;
// Subsequent lines of the airport definition (one element per line)
LinesList otherLines;
};
typedef std::unordered_map<std::string, RawAirportInfo> AirportInfoMapType;
typedef SGSharedPtr<FGPavement> FGPavementPtr;
typedef std::vector<FGPavementPtr> NodeList;
APTLoader(const APTLoader&); // disable copy constructor
APTLoader& operator=(const APTLoader&); // disable copy-assignment operator
const FGAirport* loadAirport(const 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);
APTLoader: move handling of Viewpoint lines to a separate method - APTLoader::parseViewpointLine(): new method. - APTLoader::parseViewpointLine(): check vector size to prevent past-bounds reading. More accurate signature for fptypeFromRobinType() Row codes in the apt.dat spec are always non-negative -> take an unsigned int instead of just an int. Use an initialization list for remaining members of APTLoader::APTLoader() This is slightly more efficient in general. Swap the order of declarations for the 'cache' and 'currentAirportID' members of APTLoader to have the initialization list in the same order as the member declarations (cf. g++'s -Wreorder option and <http://stackoverflow.com/questions/1828037/whats-the-point-of-g-wreorder>). Fix detection of blank lines by APTLoader::isBlankOrCommentLine() In <https://sourceforge.net/p/flightgear/flightgear/merge-requests/39/#cea6>, it was decided to let the main apt.dat line reading loop give out "lines" that may end with '\r', because most of the downstream code will automatically get rid of this character thanks to its use of simgear::strutils::split(). However, APTLoader::isBlankOrCommentLine() didn't detect blank lines properly due to that trailing '\r', which could cause bad behavior because the subsequent atoi() call could return anything from a string containing only whitespace (the "anything" in question being then interpreted as an apt.dat row code...). Add method APTLoader::cleanLine() This method returns a copy of the input line with trailing '\r' char(s) removed. APTLoader::loadAirports(): clean message when finding an unknown row code The start of the log message could previously be overwritten by later text because of the '\r' at the end of input lines (now obtained from APTLoader::readAptDatFile()). Quite confusing! Use the new APTLoader::cleanLine() to prevent this from happening.
2016-10-12 09:40:02 +02:00
// Return a copy of 'line' with trailing '\r' char(s) removed
std::string cleanLine(const std::string& line);
void throwExceptionIfStreamError(const sg_gzifstream& input_stream,
const SGPath& path);
Support merging of arbitrary apt.dat[.gz] files It is now allowed to have the same airport appear in several apt.dat files ($scenery_path/NavData/apt/*.dat[.gz] for each scenery path, plus the default $FG_ROOT/Airports/apt.dat.gz, coming last). Airports found in earlier files(*) take precedence over those found later, in case several apt.dat files define the same airports. Airports that are skipped due to this mechanism are logged with SG_LOG(SG_GENERAL, SG_INFO, ...). (*) using 1) FG_SCENERY order (followed by $FG_ROOT/Airports/apt.dat.gz) and 2) lexicographic order inside each $scenery_path/NavData/apt folder With this commit, APTLoader::parseAPT() is replaced by two methods: readAptDatFile() and loadAirports(): - APTLoader::readAptDatFile() reads airport definitions from an apt.dat file into APTLoader's 'airportInfoMap' member variable, discarding duplicate definitions due to overlapping apt.dat files ('airportInfoMap' is an std::unordered_map instance in C++11 and later, an std::map otherwise); - APTLoader::loadAirports() reads each airport definition from 'airportInfoMap' and loads it into the NavCache, the same way as APTLoader::parseAPT() used to do. The airportDBLoad() function is not useful anymore, and is thus removed (in NavDataCache::doRebuild(), APTLoader::readAptDatFile() is now called once per apt.dat file, but APTLoader::loadAirports() is only called once at the end, after duplicate airports have been discarded; the class interface is much better suited to this scheme, because it can cleanly retain the state between these calls). By the way, this commit fixes an old bug: APTLoader's member variable 'last_apt_id' was used in several places but never assigned to, except in APTLoader::APTLoader() as the empty string. Thanks to Alan Teeder for his feedback and testing.
2016-05-23 00:43:03 +02:00
void parseAirportLine(unsigned int rowCode,
Initial support for NavData/<type>/*.dat[.gz] files in scenery paths Load every file matching the pattern NavData/apt/*.dat[.gz] inside each scenery path. These files are loaded in the same order as the components of globals->get_unmangled_fg_scenery() they reside in. Inside a given component, the order is determined by pathSortPredicate() in simgear/misc/sg_dir.cxx (lexicographic order at the time of this writing). For compatibility with existing scenery, $FG_ROOT/Airports/apt.dat.gz is also loaded last. The idea is that such files will have the same precedence order as the globals->get_unmangled_fg_scenery() scenery components they come from. This commit doesn't handle this fully yet, though: it blindly loads all these files. A future commit will ensure that no airport is loaded twice due to overlapping apt.dat files. This commit however handles all the logic of navdata cache rebuilding when the list, the order of apt.dat files, or any of their timestamps changes. Although only apt.dat files receive a new treatment in this commit, the changes to NavDataCache.[ch]xx are already generic so that extension of this method to fix.dat, nav.dat, etc. will require almost no change to NavDataCache.[ch]xx (however, changes will probably be needed in the various loaders: in fixlist.[ch]xx, navdb.[ch]xx, etc.). src/Navaids/CacheSchema.h: - increment the SCHEMA_VERSION by 1. This ensures among others that if someone uses a FlightGear version posterior to this change with new-style scenery (having NavData/apt/*.dat[.gz] files inside scenery paths), then goes back to a FlightGear version anterior to this change, his NavCache is rebuilt ignoring the in-scenery-paths NavData/apt/*.dat[.gz] files, as expected with the old FlightGear version. src/Navaids/NavDataCache.cxx: - NavDataCachePrivate: replace aptDatPath (SGPath) with aptDatPaths (PathList). - NavDataCachePrivate::getDatFilesPaths(): new method that returns the list of $scenery_path/NavData/<type>/*.dat[.gz] files found inside scenery paths (where <type> is one of 'apt', 'fix', etc.), plus the historical file (e.g., $FG_ROOT/Airports/apt.dat.gz for the 'apt' type). - NavDataCachePrivate::areDatFilesModified(): new method that tells whether any of these files (for a given type) has changed since the last NavCache rebuild, or if their ordered list has changed. - NavDataCachePrivate::isCachedFileModified(): minor changes. - NavDataCache::updateListsOfDatFiles(): new method that updates the lists of dat files used for NavCache freshness checking and rebuilding, i.e. currently sets/updates d->aptDatPaths using the new method d->getDatFilesPaths(), and d->metarDatPath, d->navDatPath, d->fixDatPath, d->poiDatPath, etc. as usual. This method will be useful for instance in the built-in launcher after updating scenery paths and before calling NavDataCache::isRebuildRequired(). - NavDataCache::NavDataCache(): use NavDataCache::updateListsOfDatFiles() to initialize d->aptDatPaths, d->metarDatPath, d->navDatPath, d->fixDatPath, d->poiDatPath, etc. - NavDataCache::isRebuildRequired(): use NavDataCachePrivate::areDatFilesModified() instead of just checking $FG_ROOT/Airports/apt.dat.gz. - NavDataCache::doRebuild(): load all apt.dat files listed in d->aptDatPaths, instead of only $FG_ROOT/Airports/apt.dat.gz. Write their ordered list and timestamps in the NavCache. src/Navaids/NavDataCache.hxx: - declare the new method NavDataCache::updateListsOfDatFiles(). - NavDataCache::DatFileType: new enum with values DATFILETYPE_APT, DATFILETYPE_METAR, DATFILETYPE_AWY, DATFILETYPE_NAV, DATFILETYPE_FIX, DATFILETYPE_POI, DATFILETYPE_CARRIER and DATFILETYPE_TACAN_FREQ. Maybe some of the corresponding files won't have to be moved to scenery paths, but simply listing them in the enum doesn't change how they are dealt with. Those for which per-scenery-path locations doesn't make sense can just be removed from the enum. - NavDataCache::datTypeStr: new static string_list giving an std::string such as 'apt' for each value of the NavDataCache::DatFileType enum. - NavDataCache::defaultDatFile: new static string_list giving a path (relative to $FG_ROOT) to the historical/default file for each value of the NavDataCache::DatFileType enum. src/Airports/apt_loader.cxx and src/Airports/apt_loader.hxx: - always include a path to the apt.dat file being processed in log messages, since they can now apply to many files; - be clearer about code 99: it should normally be at the end of apt.dat files, but technically, it is not an EOF; - use the expression "row code" consistently with the apt.dat format spec (for now: only in places where there is another change to do). src/GUI/QtLauncher.cxx and src/GUI/QtLauncher_private.hxx: - turn QtLauncher::setSceneryPaths() into a static method and call it in runLauncherDialog() before instantiating NavDataCache, so that NavDataCache::updateListsOfDatFiles() (called from NavDataCache's constructor) can see all configured scenery paths.
2016-10-11 16:31:13 +02:00
const std::vector<std::string>& token);
void finishAirport(const std::string& aptDat);
void parseRunwayLine810(const std::string& aptDat, unsigned int lineNum,
const std::vector<std::string>& token);
void parseRunwayLine850(const std::string& aptDat, unsigned int lineNum,
const std::vector<std::string>& token);
void parseWaterRunwayLine850(const std::string& aptDat, unsigned int lineNum,
const std::vector<std::string>& token);
void parseHelipadLine850(const std::string& aptDat, unsigned int lineNum,
const std::vector<std::string>& token);
APTLoader: move handling of Viewpoint lines to a separate method - APTLoader::parseViewpointLine(): new method. - APTLoader::parseViewpointLine(): check vector size to prevent past-bounds reading. More accurate signature for fptypeFromRobinType() Row codes in the apt.dat spec are always non-negative -> take an unsigned int instead of just an int. Use an initialization list for remaining members of APTLoader::APTLoader() This is slightly more efficient in general. Swap the order of declarations for the 'cache' and 'currentAirportID' members of APTLoader to have the initialization list in the same order as the member declarations (cf. g++'s -Wreorder option and <http://stackoverflow.com/questions/1828037/whats-the-point-of-g-wreorder>). Fix detection of blank lines by APTLoader::isBlankOrCommentLine() In <https://sourceforge.net/p/flightgear/flightgear/merge-requests/39/#cea6>, it was decided to let the main apt.dat line reading loop give out "lines" that may end with '\r', because most of the downstream code will automatically get rid of this character thanks to its use of simgear::strutils::split(). However, APTLoader::isBlankOrCommentLine() didn't detect blank lines properly due to that trailing '\r', which could cause bad behavior because the subsequent atoi() call could return anything from a string containing only whitespace (the "anything" in question being then interpreted as an apt.dat row code...). Add method APTLoader::cleanLine() This method returns a copy of the input line with trailing '\r' char(s) removed. APTLoader::loadAirports(): clean message when finding an unknown row code The start of the log message could previously be overwritten by later text because of the '\r' at the end of input lines (now obtained from APTLoader::readAptDatFile()). Quite confusing! Use the new APTLoader::cleanLine() to prevent this from happening.
2016-10-12 09:40:02 +02:00
void parseViewpointLine(const std::string& aptDat, unsigned int lineNum,
const std::vector<std::string>& token);
void parsePavementLine850(const std::vector<std::string>& token);
void parseNodeLine850(
NodeList *nodelist,
const std::string& aptDat, unsigned int lineNum, int rowCode,
const std::vector<std::string>& token);
void parseCommLine(
const std::string& aptDat, unsigned int lineNum, unsigned int rowCode,
const std::vector<std::string>& token);
Support merging of arbitrary apt.dat[.gz] files It is now allowed to have the same airport appear in several apt.dat files ($scenery_path/NavData/apt/*.dat[.gz] for each scenery path, plus the default $FG_ROOT/Airports/apt.dat.gz, coming last). Airports found in earlier files(*) take precedence over those found later, in case several apt.dat files define the same airports. Airports that are skipped due to this mechanism are logged with SG_LOG(SG_GENERAL, SG_INFO, ...). (*) using 1) FG_SCENERY order (followed by $FG_ROOT/Airports/apt.dat.gz) and 2) lexicographic order inside each $scenery_path/NavData/apt folder With this commit, APTLoader::parseAPT() is replaced by two methods: readAptDatFile() and loadAirports(): - APTLoader::readAptDatFile() reads airport definitions from an apt.dat file into APTLoader's 'airportInfoMap' member variable, discarding duplicate definitions due to overlapping apt.dat files ('airportInfoMap' is an std::unordered_map instance in C++11 and later, an std::map otherwise); - APTLoader::loadAirports() reads each airport definition from 'airportInfoMap' and loads it into the NavCache, the same way as APTLoader::parseAPT() used to do. The airportDBLoad() function is not useful anymore, and is thus removed (in NavDataCache::doRebuild(), APTLoader::readAptDatFile() is now called once per apt.dat file, but APTLoader::loadAirports() is only called once at the end, after duplicate airports have been discarded; the class interface is much better suited to this scheme, because it can cleanly retain the state between these calls). By the way, this commit fixes an old bug: APTLoader's member variable 'last_apt_id' was used in several places but never assigned to, except in APTLoader::APTLoader() as the empty string. Thanks to Alan Teeder for his feedback and testing.
2016-05-23 00:43:03 +02:00
std::vector<std::string> token;
AirportInfoMapType airportInfoMap;
double rwy_lat_accum;
double rwy_lon_accum;
double last_rwy_heading;
int rwy_count;
std::string last_apt_id;
double last_apt_elev;
SGGeod tower;
std::string pavement_ident;
NodeList pavements;
NodeList airport_boundary;
NodeList linear_feature;
// Not an airport identifier in the sense of the apt.dat spec!
PositionedID currentAirportPosID;
APTLoader: move handling of Viewpoint lines to a separate method - APTLoader::parseViewpointLine(): new method. - APTLoader::parseViewpointLine(): check vector size to prevent past-bounds reading. More accurate signature for fptypeFromRobinType() Row codes in the apt.dat spec are always non-negative -> take an unsigned int instead of just an int. Use an initialization list for remaining members of APTLoader::APTLoader() This is slightly more efficient in general. Swap the order of declarations for the 'cache' and 'currentAirportID' members of APTLoader to have the initialization list in the same order as the member declarations (cf. g++'s -Wreorder option and <http://stackoverflow.com/questions/1828037/whats-the-point-of-g-wreorder>). Fix detection of blank lines by APTLoader::isBlankOrCommentLine() In <https://sourceforge.net/p/flightgear/flightgear/merge-requests/39/#cea6>, it was decided to let the main apt.dat line reading loop give out "lines" that may end with '\r', because most of the downstream code will automatically get rid of this character thanks to its use of simgear::strutils::split(). However, APTLoader::isBlankOrCommentLine() didn't detect blank lines properly due to that trailing '\r', which could cause bad behavior because the subsequent atoi() call could return anything from a string containing only whitespace (the "anything" in question being then interpreted as an apt.dat row code...). Add method APTLoader::cleanLine() This method returns a copy of the input line with trailing '\r' char(s) removed. APTLoader::loadAirports(): clean message when finding an unknown row code The start of the log message could previously be overwritten by later text because of the '\r' at the end of input lines (now obtained from APTLoader::readAptDatFile()). Quite confusing! Use the new APTLoader::cleanLine() to prevent this from happening.
2016-10-12 09:40:02 +02:00
NavDataCache* cache;
// Enum to keep track of whether we are tracking a pavement, airport boundary
// or linear feature when parsing the file.
enum NodeBlock { None, Pavement, AirportBoundary, LinearFeature};
};
bool metarDataLoad(const SGPath& path);
} // of namespace flighgear
#endif // _FG_APT_LOADER_HXX