MCPcopy Create free account
hub / github.com/JSBSim-Team/jsbsim / main

Function main

utils/simplot/prep_plot.cpp:133–517  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133int main(int argc, char **argv)
134{
135 string in_string, var_name, input_arg, supplied_title="";
136 string outfile="";
137 string_array plotspecfiles;
138 string_array files;
139 int ctr=1, next_comma=0, len=0, start=0, file_ctr=0;
140 ifstream infile2;
141 char num[8];
142 bool comprehensive=false;
143 bool pdf=false;
144 bool png=false;
145 bool nokey=false;
146 bool plotspecs=false;
147 string set_thickness="";
148 int font_sz_delta=0;
149
150 string font = "Helvetica,";
151
152 unsigned int DEFAULT_FONT_SZ = 12;
153 unsigned int TITLE_FONT_SZ = 14;
154 unsigned int LABEL_FONT_SZ = 12;
155 unsigned int AXIS_FONT_SZ = 12;
156 unsigned int TIMESTAMP_FONT_SZ = 10;
157 unsigned int TICS_FONT_SZ = 10;
158
159 string start_time="", end_time="";
160
161 if (argc == 1 || string(argv[1]) == "--help") {
162 cout << endl << "Usage: " << endl << endl;
163 cout << " prep_plot <datafile.csv> [--plot=<plot_directives.xml>] [--comp[rehensive]]"
164 << " [--out=<output file name>]"
165 << " [--start=<time>] [--end=<time>] [--title=<title>] [--pdf | --png]"
166 << " [--thick | --thicker | --thickest] [--smallest | --small | --large | --largest]"
167 << endl << endl;
168 cout << "If only the input data file name is given, all of the parameters available in that plot file" << endl;
169 cout << "are given." << endl << endl;
170 exit(-1);
171 }
172
173 string filename(argv[1]), new_filename, Title;
174
175 if (filename.find("#") != string::npos) { // if plotting multiple files
176 multiplot = true;
177 nokey = true;
178 while (1) {
179 new_filename=filename;
180 snprintf(num,sizeof(num),"%d",file_ctr);
181 new_filename.replace(new_filename.find("#"),1,num);
182 infile2.open(new_filename.c_str());
183 if (!infile2.is_open()) {
184 break;
185 } else {
186 getline(infile2, in_string, '\n');
187 NamesArray.push_back(split(in_string, ','));
188 infile2.close();
189 files.push_back(new_filename);
190 file_ctr++;

Callers

nothing calls this directly

Calls 12

itostrFunction · 0.85
PrintNamesFunction · 0.85
EmitSinglePlotFunction · 0.85
EmitComparisonPlotFunction · 0.85
readXMLFunction · 0.85
MakeArbitraryPlotFunction · 0.85
openMethod · 0.80
c_strMethod · 0.80
sizeMethod · 0.80
emptyMethod · 0.80
splitFunction · 0.50
eraseMethod · 0.45

Tested by

no test coverage detected