]> git.mxchange.org Git - flightgear.git/blob - src/Airports/xmlloader.cxx
Thomas Foerster: Made FGParking a subclass of FGTaxiNode
[flightgear.git] / src / Airports / xmlloader.cxx
1 // This program is free software; you can redistribute it and/or
2 // modify it under the terms of the GNU General Public License as
3 // published by the Free Software Foundation; either version 2 of the
4 // License, or (at your option) any later version.
5 //
6 // This program is distributed in the hope that it will be useful, but
7 // WITHOUT ANY WARRANTY; without even the implied warranty of
8 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
9 // General Public License for more details.
10 //
11 // You should have received a copy of the GNU General Public License
12 // along with this program; if not, write to the Free Software
13 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
14 //
15
16 #include <simgear/misc/sg_path.hxx>
17 #include <Main/globals.hxx>
18
19 #include "xmlloader.hxx"
20 #include "dynamicloader.hxx"
21 #include "runwayprefloader.hxx"
22
23 #include "dynamics.hxx"
24 #include "runwayprefs.hxx"
25
26 XMLLoader::XMLLoader() {}
27 XMLLoader::~XMLLoader() {}
28
29 void XMLLoader::load(FGAirportDynamics* d) {
30   FGAirportDynamicsXMLLoader visitor(d);
31
32   SGPath parkpath( globals->get_fg_root() );
33   parkpath.append( "/AI/Airports/" );
34   parkpath.append( d->getId() );
35   parkpath.append( "parking.xml" );
36   
37   if (parkpath.exists()) {
38     try {
39       readXML(parkpath.str(), visitor);
40       d->init();
41     } catch (const sg_exception &e) {
42       //cerr << "unable to read " << parkpath.str() << endl;
43     }
44   }
45
46 }
47
48 void XMLLoader::load(FGRunwayPreference* p) {
49   FGRunwayPreferenceXMLLoader visitor(p);
50
51   SGPath rwyPrefPath( globals->get_fg_root() );
52   rwyPrefPath.append( "AI/Airports/" );
53   rwyPrefPath.append( p->getId() );
54   rwyPrefPath.append( "rwyuse.xml" );
55
56   //if (ai_dirs.find(id.c_str()) != ai_dirs.end()
57   //  && rwyPrefPath.exists())
58   if (rwyPrefPath.exists()) {
59     try {
60       readXML(rwyPrefPath.str(), visitor);
61     } catch (const sg_exception &e) {
62       //cerr << "unable to read " << rwyPrefPath.str() << endl;
63     }
64   }
65 }