| 336 | //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 337 | |
| 338 | void plotdata(DataFile& df, plotXMLVisitor* plotVisitor) |
| 339 | { |
| 340 | vector <int> IDs; |
| 341 | int XID; |
| 342 | |
| 343 | outfile.open("JSBSimPlots.html"); |
| 344 | if (!outfile) { |
| 345 | cerr << "Could not open output file " << "JSBSimPlots.html" << endl; |
| 346 | exit(-1); |
| 347 | } |
| 348 | time_t tm = time(NULL); |
| 349 | |
| 350 | outfile << "<HTML>" << endl; |
| 351 | outfile << "<HEAD>" << endl; |
| 352 | outfile << "<TITLE>JSBSim Test Run Results</TITLE>" << endl; |
| 353 | outfile << "</HEAD>" << endl; |
| 354 | outfile << "<BODY bgColor=gainsboro>" << endl; |
| 355 | outfile << "<P><FONT size=4>" << endl; |
| 356 | outfile << "JSBSim Test Results<BR></FONT>" << endl; |
| 357 | outfile << "<FONT size=2 face=Arial>" << endl; |
| 358 | // outfile << "Test: <EM>New code for aerosurfaces</EM><BR>" << endl; |
| 359 | outfile << "Date: <EM>" << ctime(&tm) << "</EM>" << endl; |
| 360 | outfile << "</FONT><FONT face=Arial>" << endl; |
| 361 | outfile << "<HR style=""LEFT: 10px; WIDTH: 100%; TOP: 52px; HEIGHT: 4px"" SIZE=4 width=""100%"">" << endl; |
| 362 | outfile << "</FONT>" << endl; |
| 363 | outfile << "<P>" << endl; |
| 364 | outfile << "<TABLE cellSpacing=2 cellPadding=3 width=""95%"" align=center border=0>" << endl; |
| 365 | |
| 366 | for (int j=0; j<plotVisitor->vPlots.size(); j++) { |
| 367 | |
| 368 | if (plotVisitor->vPlots[j].Autoscale) { // autoscaling |
| 369 | xmin = xmax = ymin = ymax = 0.00; |
| 370 | autoscale = true; |
| 371 | cout << "Autoscaling ..." << endl; |
| 372 | } else { |
| 373 | autoscale = false; |
| 374 | xmin = plotVisitor->vPlots[j].Min[eX]; |
| 375 | ymin = plotVisitor->vPlots[j].Min[eY]; |
| 376 | xmax = plotVisitor->vPlots[j].Max[eX]; |
| 377 | ymax = plotVisitor->vPlots[j].Max[eY]; |
| 378 | } |
| 379 | |
| 380 | XID = GetID(df, plotVisitor->vPlots[j].X_Variable); |
| 381 | if (XID < 0) { |
| 382 | cout << "ID not found for X axis parameter " << plotVisitor->vPlots[j].X_Variable << endl; |
| 383 | } |
| 384 | |
| 385 | IDs.clear(); |
| 386 | |
| 387 | for (int i=0; i<plotVisitor->vPlots[j].Y_Variables.size(); i++) { |
| 388 | int id = GetID(df, plotVisitor->vPlots[j].Y_Variables[i]); |
| 389 | if (id < 0) { |
| 390 | cerr << "Item[" << i << "]: " << plotVisitor->vPlots[j].Y_Variables[i] << |
| 391 | " not found in data file" << endl; |
| 392 | } else { |
| 393 | IDs.push_back(id); |
| 394 | plot(df, plotVisitor->vPlots[j].Title, |
| 395 | plotVisitor->vPlots[j].Axis_Caption[eX], |