]> git.mxchange.org Git - flightgear.git/blob - src/Airports/parking.cxx
Updates for newest scenery build.
[flightgear.git] / src / Airports / parking.cxx
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.
4 //
5 // Written by Durk Talsma, started December 2004.
6 //
7 // Copyright (C) 2004 Durk Talsma.
8 //
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.
13 //
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.
18 //
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.
22 //
23 // $Id$
24
25 #ifdef HAVE_CONFIG_H
26 #  include <config.h>
27 #endif
28
29 #ifdef _MSC_VER
30 #  define _USE_MATH_DEFINES
31 #endif
32 //#include <math.h>
33 //#include <algorithm>
34
35 #include <simgear/compiler.h>
36
37 //#include <plib/sg.h>
38 //#include <plib/ul.h>
39
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>
49
50 #include STL_STRING
51
52 #include "parking.hxx"
53
54
55 /*****************************************************************************
56  * Helper function for parsing position string
57  ****************************************************************************/
58 double processPosition(const string &pos)
59 {
60   string prefix;
61   string subs;
62   string degree;
63   string decimal;
64   int sign = 1;
65   double value;
66   subs = pos;
67   prefix= subs.substr(0,1);
68   if (prefix == string("S") || (prefix == string("W")))
69     sign = -1;
70   subs    = subs.substr(1, subs.length());
71   degree  = subs.substr(0, subs.find(" ",0));
72   decimal = subs.substr(subs.find(" ",0), subs.length());
73   
74               
75   //cerr << sign << " "<< degree << " " << decimal << endl;
76   value = sign * (atof(degree.c_str()) + atof(decimal.c_str())/60.0);
77   //cerr << value <<endl;
78   //exit(1);
79   return value;
80 }
81
82
83 /*********************************************************************************
84  * FGParking
85  ********************************************************************************/
86 FGParking::FGParking(double lat,
87                      double lon,
88                      double hdg,
89                      double rad,
90                      int idx,
91                      const string &name,
92                      const string &tpe,
93                      const string &codes)
94 {
95   latitude     = lat;
96   longitude    = lon;
97   heading      = hdg;
98   parkingName  = name;
99   index        = idx;
100   type         = tpe;
101   airlineCodes = codes;
102 }