1 // parking.cxx - Implementation of a class to manage aircraft parking in
2 // FlightGear. This code is intended to be used by AI code and
3 // initial user-startup location selection.
5 // Written by Durk Talsma, started December 2004.
7 // Copyright (C) 2004 Durk Talsma.
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License as
11 // published by the Free Software Foundation; either version 2 of the
12 // License, or (at your option) any later version.
14 // This program is distributed in the hope that it will be useful, but
15 // WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // General Public License for more details.
19 // You should have received a copy of the GNU General Public License
20 // along with this program; if not, write to the Free Software
21 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30 # define _USE_MATH_DEFINES
33 //#include <algorithm>
35 #include <simgear/compiler.h>
37 //#include <plib/sg.h>
38 //#include <plib/ul.h>
40 //#include <Environment/environment_mgr.hxx>
41 //#include <Environment/environment.hxx>
42 //#include <simgear/misc/sg_path.hxx>
43 //#include <simgear/props/props.hxx>
44 //#include <simgear/structure/subsystem_mgr.hxx>
45 //#include <simgear/debug/logstream.hxx>
46 //#include <Main/globals.hxx>
47 //#include <Main/fg_props.hxx>
48 //#include <Airports/runways.hxx>
52 #include "parking.hxx"
55 /*****************************************************************************
56 * Helper function for parsing position string
57 ****************************************************************************/
58 double processPosition(const string &pos)
67 prefix= subs.substr(0,1);
68 if (prefix == string("S") || (prefix == string("W")))
70 subs = subs.substr(1, subs.length());
71 degree = subs.substr(0, subs.find(" ",0));
72 decimal = subs.substr(subs.find(" ",0), subs.length());
75 //cerr << sign << " "<< degree << " " << decimal << endl;
76 value = sign * (atof(degree.c_str()) + atof(decimal.c_str())/60.0);
77 //cerr << value <<endl;
83 /*********************************************************************************
85 ********************************************************************************/
86 FGParking::FGParking(double lat,
101 airlineCodes = codes;