Renderer, ...: use PixelRect::GetCenter()
[xcsoar.git] / test / src / RunIGCWriter.cpp
blobcd636d532f91aa166dac07307a05c445d42e403e
1 /*
2 Copyright_License {
4 XCSoar Glide Computer - http://www.xcsoar.org/
5 Copyright (C) 2000-2013 The XCSoar Project
6 A detailed list of copyright holders can be found in the file "AUTHORS".
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #include "OS/ConvertPathName.hpp"
25 #include "IGC/IGCWriter.hpp"
26 #include "Computer/GPSClock.hpp"
27 #include "DebugReplay.hpp"
28 #include "OS/Args.hpp"
30 #include <stdio.h>
32 int main(int argc, char **argv)
34 Args args(argc, argv, "DRIVER INFILE OUTFILE");
35 DebugReplay *replay = CreateDebugReplay(args);
36 if (replay == NULL)
37 return EXIT_FAILURE;
39 const char *output_file = args.ExpectNext();
40 args.ExpectEnd();
42 while (!replay->Basic().time_available)
43 if (!replay->Next())
44 return 0;
46 const TCHAR *driver_name = _T("Unknown");
48 PathName igc_path(output_file);
49 IGCWriter writer(igc_path);
50 writer.WriteHeader(replay->Basic().date_time_utc, _T("Manfred Mustermann"),
51 _T("Ventus"), _T("D-1234"),
52 _T("MM"), "FOO", driver_name, true);
54 GPSClock log_clock(fixed(1));
55 while (replay->Next())
56 if (log_clock.CheckAdvance(replay->Basic().time))
57 writer.LogPoint(replay->Basic());
59 writer.Flush();
61 delete replay;
63 return EXIT_SUCCESS;