]> git.mxchange.org Git - flightgear.git/blob - src/FDM/UIUCModel/uiuc_menu_geometry.cpp
Merge branch 'jsd/atmos' into topic/atmos-merge
[flightgear.git] / src / FDM / UIUCModel / uiuc_menu_geometry.cpp
1 /**********************************************************************
2                                                                        
3  FILENAME:     uiuc_menu_geometry.cpp
4
5 ----------------------------------------------------------------------
6
7  DESCRIPTION:  reads input data for specified aircraft and creates 
8                approporiate data storage space
9
10 ----------------------------------------------------------------------
11
12  STATUS:       alpha version
13
14 ----------------------------------------------------------------------
15
16  REFERENCES:   based on "menu reader" format of Michael Selig
17
18 ----------------------------------------------------------------------
19
20  HISTORY:      04/04/2003   initial release
21                06/30/2003   (RD) replaced istrstream with istringstream
22                             to get rid of the annoying warning about
23                             using the strstream header
24
25 ----------------------------------------------------------------------
26
27  AUTHOR(S):    Robert Deters      <rdeters@uiuc.edu>
28                Michael Selig      <m-selig@uiuc.edu>
29
30 ----------------------------------------------------------------------
31
32  VARIABLES:
33
34 ----------------------------------------------------------------------
35
36  INPUTS:       n/a
37
38 ----------------------------------------------------------------------
39
40  OUTPUTS:      n/a
41
42 ----------------------------------------------------------------------
43
44  CALLED BY:    uiuc_menu()
45
46 ----------------------------------------------------------------------
47
48  CALLS TO:     check_float() if needed
49                d_2_to_3() if needed
50                d_1_to_2() if needed
51                i_1_to_2() if needed
52                d_1_to_1() if needed
53
54  ----------------------------------------------------------------------
55
56  COPYRIGHT:    (C) 2003 by Michael Selig
57
58  This program is free software; you can redistribute it and/or
59  modify it under the terms of the GNU General Public License
60  as published by the Free Software Foundation.
61
62  This program is distributed in the hope that it will be useful,
63  but WITHOUT ANY WARRANTY; without even the implied warranty of
64  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
65  GNU General Public License for more details.
66
67  You should have received a copy of the GNU General Public License
68  along with this program; if not, write to the Free Software
69  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
70
71 **********************************************************************/
72
73 #include <simgear/compiler.h>
74
75
76 #include <cstdlib>
77 #include <string>
78 #include <iostream>
79
80 #include "uiuc_menu_geometry.h"
81
82 using std::cerr;
83 using std::cout;
84 using std::endl;
85
86 #ifndef _MSC_VER
87 using std::exit;
88 #endif
89
90 void parse_geometry( const string& linetoken2, const string& linetoken3,
91                      const string& linetoken4, const string& linetoken5, 
92                      const string& linetoken6, const string& linetoken7, 
93                      const string& linetoken8, const string& linetoken9,
94                      const string& linetoken10, 
95                      const string& aircraft_directory, LIST command_line ) {
96     double token_value;
97     istringstream token3(linetoken3.c_str());
98     istringstream token4(linetoken4.c_str());
99     istringstream token5(linetoken5.c_str());
100     istringstream token6(linetoken6.c_str());
101     istringstream token7(linetoken7.c_str());
102     istringstream token8(linetoken8.c_str());
103     istringstream token9(linetoken9.c_str());
104     istringstream token10(linetoken10.c_str());
105
106     switch(geometry_map[linetoken2])
107       {
108       case bw_flag:
109         {
110           if (check_float(linetoken3))
111             token3 >> token_value;
112           else
113             uiuc_warnings_errors(1, *command_line);
114           
115           bw = token_value;
116           geometryParts -> storeCommands (*command_line);
117           break;
118         }
119       case cbar_flag:
120         {
121           if (check_float(linetoken3))
122             token3 >> token_value;
123           else
124             uiuc_warnings_errors(1, *command_line);
125           
126           cbar = token_value;
127           geometryParts -> storeCommands (*command_line);
128           break;
129         }
130       case Sw_flag:
131         {
132           if (check_float(linetoken3))
133             token3 >> token_value;
134           else
135             uiuc_warnings_errors(1, *command_line);
136           
137           Sw = token_value;
138           geometryParts -> storeCommands (*command_line);
139           break;
140         }
141       case ih_flag:
142         {
143           if (check_float(linetoken3))
144             token3 >> token_value;
145           else
146             uiuc_warnings_errors(1, *command_line);
147           
148           ih = token_value;
149           geometryParts -> storeCommands (*command_line);
150           break;
151         }
152       case bh_flag:
153         {
154           if (check_float(linetoken3))
155             token3 >> token_value;
156           else
157             uiuc_warnings_errors(1, *command_line);
158           
159           bh = token_value;
160           geometryParts -> storeCommands (*command_line);
161           break;
162         }
163       case ch_flag:
164         {
165           if (check_float(linetoken3))
166             token3 >> token_value;
167           else
168             uiuc_warnings_errors(1, *command_line);
169           
170           chord_h = token_value;
171           geometryParts -> storeCommands (*command_line);
172           break;
173         }
174       case Sh_flag:
175         {
176           if (check_float(linetoken3))
177             token3 >> token_value;
178           else
179             uiuc_warnings_errors(1, *command_line);
180           
181           Sh = token_value;
182           geometryParts -> storeCommands (*command_line);
183           break;
184         }
185       default:
186         {
187           if (ignore_unknown_keywords) {
188             // do nothing
189           } else {
190             // print error message
191             uiuc_warnings_errors(2, *command_line);
192           }
193           break;
194         }
195       };
196 }