23#include <simgear/misc/sg_path.hxx>
24#include <simgear/xml/easyxml.hxx>
25#include <simgear/misc/strutils.hxx>
26#include <simgear/timing/timestamp.hxx>
54 SG_LOG(SG_NAVAID, SG_DEBUG,
"reading groundnet data from " << path);
59 readXML(path, visitor);
65 }
catch (sg_exception& e) {
66 SG_LOG(SG_NAVAID, SG_DEV_WARN,
"parsing groundnet XML failed:" << e.getFormattedMessage());
69 SG_LOG(SG_NAVAID, SG_DEBUG,
"parsing groundnet XML took " << t.elapsedMSec());
76 readXML(inData, visitor);
81 }
catch (sg_exception& e) {
82 SG_LOG(SG_NAVAID, SG_DEV_WARN,
"parsing groundnet XML failed:" << e.getFormattedMessage());
90 readXML(path, visitor);
96 }
catch (sg_exception& e) {
97 SG_LOG(SG_NAVAID, SG_DEV_WARN,
"parsing groundnet XML failed:" << e.getFormattedMessage());
107 const std::string& aFileName, SGPath& aPath)
114 string fileName(aFileName);
115 if (!simgear::strutils::ends_with(aFileName,
".xml")) {
116 fileName.append(
".xml");
119 const bool performFullTraversal = airport->sceneryPath().isNull() ||
120 !fileName.compare(
"procedures.xml");
124 ::snprintf(buffer, 128,
"%c/%c/%c/%s.%s",
125 aICAO[0], aICAO[1], aICAO[2],
126 aICAO.c_str(), fileName.c_str());
128 for (PathList::const_iterator it = sc.begin(); it != sc.end(); ++it) {
131 const SGPath path = *it /
"Airports" / buffer;
133 aPath = std::move(path);
140 if (!performFullTraversal && *it == airport->sceneryPath()) {
149 const string& aFileName, XMLVisitor& aVisitor)
153 SG_LOG(SG_NAVAID, SG_DEBUG,
"loadAirportXMLDataIntoVisitor: failed to find data for " << aICAO <<
"/" << aFileName);
157 bool readXMLOk =
true;
159 SG_LOG(SG_NAVAID, SG_DEBUG,
"loadAirportXMLDataIntoVisitor: loading from " << path);
160 readXML(path, aVisitor);
161 }
catch (sg_exception& e) {
163 SG_LOG(SG_NAVAID, SG_WARN,
"XML errors trying to read:" << path);
SGSharedPtr< FGAirport > FGAirportRef
static FGAirportRef findByIdent(const std::string &aIdent)
Helper to look up an FGAirport instance by unique ident.
FGAirport * airport() const
const std::string & ident() const
static void loadFromPath(FGGroundNetwork *net, const SGPath &path)
static void load(FGRunwayPreference *p)
static void loadFromStream(FGGroundNetwork *net, std::istream &inData)
static bool loadAirportXMLDataIntoVisitor(const std::string &aICAO, const std::string &aFileName, XMLVisitor &aVisitor)
Search the scenery for a file name of the form: I/C/A/ICAO.filename.xml and parse it as an XML proper...
static bool findAirportData(const std::string &aICAO, const std::string &aFileName, SGPath &aPath)
Search the scenery for a file name of the form: I/C/A/ICAO.filename.xml and return the corresponding ...
std::vector< SGPath > PathList
void updateSentryTag(const std::string &, const std::string &)
void sentryReportException(const std::string &, const std::string &)
bool fgGetBool(char const *name, bool def)
Get a bool value for a property.