TaskStats: remove unused attribute "Time"
[xcsoar.git] / test / src / ContestPrinting.cpp
blob17ed8f7ada75027f3f94da8c1615314c06178bf0
1 /* Copyright_License {
3 XCSoar Glide Computer - http://www.xcsoar.org/
4 Copyright (C) 2000-2013 The XCSoar Project
5 A detailed list of copyright holders can be found in the file "AUTHORS".
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 #include "Printing.hpp"
24 #include "OS/FileUtil.hpp"
25 #include "Contest/ContestManager.hpp"
26 #include "Trace/Trace.hpp"
28 #include <fstream>
30 void
31 PrintHelper::contestmanager_print(const ContestManager &man,
32 const Trace &trace_full,
33 const Trace &trace_triangle,
34 const Trace &trace_sprint)
36 Directory::Create(_T("output/results"));
39 std::ofstream fs("output/results/res-olc-trace.txt");
40 TracePointVector v;
41 trace_full.GetPoints(v);
43 for (auto it = v.begin(); it != v.end(); ++it)
44 fs << it->GetLocation().longitude << " " << it->GetLocation().latitude
45 << " " << it->GetAltitude() << " " << it->GetTime()
46 << "\n";
50 std::ofstream fs("output/results/res-olc-trace_triangle.txt");
52 TracePointVector v;
53 trace_triangle.GetPoints(v);
55 for (auto it = v.begin(); it != v.end(); ++it)
56 fs << it->GetLocation().longitude << " " << it->GetLocation().latitude
57 << " " << it->GetAltitude() << " " << it->GetTime()
58 << "\n";
62 std::ofstream fs("output/results/res-olc-trace_sprint.txt");
64 TracePointVector v;
65 trace_sprint.GetPoints(v);
67 for (auto it = v.begin(); it != v.end(); ++it)
68 fs << it->GetLocation().longitude << " " << it->GetLocation().latitude
69 << " " << it->GetAltitude() << " " << it->GetTime()
70 << "\n";
73 std::ofstream fs("output/results/res-olc-solution.txt");
75 if (man.stats.solution[0].empty()) {
76 fs << "# no solution\n";
77 return;
80 if (positive(man.stats.result[0].time)) {
82 for (auto it = man.stats.solution[0].begin();
83 it != man.stats.solution[0].end(); ++it) {
84 fs << it->GetLocation().longitude << " " << it->GetLocation().latitude
85 << " " << it->GetTime()
86 << "\n";
91 void
92 PrintHelper::print(const ContestResult& score)
94 std::cout << "# score " << score.score << "\n";
95 std::cout << "# distance " << score.distance/fixed(1000) << " (km)\n";
96 std::cout << "# speed " << score.GetSpeed() * fixed(3.6) << " (kph)\n";
97 std::cout << "# time " << score.time << " (sec)\n";