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"
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");
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()
50 std::ofstream
fs("output/results/res-olc-trace_triangle.txt");
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()
62 std::ofstream
fs("output/results/res-olc-trace_sprint.txt");
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()
73 std::ofstream
fs("output/results/res-olc-solution.txt");
75 if (man
.stats
.solution
[0].empty()) {
76 fs
<< "# no solution\n";
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()
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";