]> git.mxchange.org Git - flightgear.git/blob - src/Airports/parking.cxx
Fix line endings
[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 //#include <algorithm>
30
31 #include <simgear/compiler.h>
32
33 //#include <plib/sg.h>
34 //#include <plib/ul.h>
35
36 //#include <Environment/environment_mgr.hxx>
37 //#include <Environment/environment.hxx>
38 //#include <simgear/misc/sg_path.hxx>
39 //#include <simgear/props/props.hxx>
40 //#include <simgear/structure/subsystem_mgr.hxx>
41 //#include <simgear/debug/logstream.hxx>
42 //#include <Main/globals.hxx>
43 //#include <Main/fg_props.hxx>
44 //#include <Airports/runways.hxx>
45
46 #include STL_STRING
47
48 #include "parking.hxx"
49
50
51 /*****************************************************************************
52  * Helper function for parsing position string
53  ****************************************************************************/
54 double processPosition(const string &pos)
55 {
56   string prefix;
57   string subs;
58   string degree;
59   string decimal;
60   int sign = 1;
61   double value;
62   subs = pos;
63   prefix= subs.substr(0,1);
64   if (prefix == string("S") || (prefix == string("W")))
65     sign = -1;
66   subs    = subs.substr(1, subs.length());
67   degree  = subs.substr(0, subs.find(" ",0));
68   decimal = subs.substr(subs.find(" ",0), subs.length());
69   
70               
71   //cerr << sign << " "<< degree << " " << decimal << endl;
72   value = sign * (atof(degree.c_str()) + atof(decimal.c_str())/60.0);
73   //cerr << value <<endl;
74   //exit(1);
75   return value;
76 }
77
78
79 /*********************************************************************************
80  * FGParking
81  ********************************************************************************/
82 FGParking::FGParking(double lat,
83                      double lon,
84                      double hdg,
85                      double rad,
86                      int idx,
87                      const string &name,
88                      const string &tpe,
89                      const string &codes)
90 {
91   latitude     = lat;
92   longitude    = lon;
93   heading      = hdg;
94   parkingName  = name;
95   index        = idx;
96   type         = tpe;
97   airlineCodes = codes;
98 }