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.
25 #define ENABLE_XML_DIALOG
26 #define ENABLE_CMDLINE
27 #define ENABLE_PROFILE
28 #define USAGE "DRIVER FILE"
31 #include "Screen/SingleWindow.hpp"
32 #include "Screen/Blank.hpp"
33 #include "Screen/BufferCanvas.hpp"
34 #include "InfoBoxes/InfoBoxLayout.hpp"
35 #include "Logger/Logger.hpp"
36 #include "Terrain/RasterWeather.hpp"
37 #include "Terrain/RasterTerrain.hpp"
38 #include "Waypoint/WaypointGlue.hpp"
39 #include "Dialogs/XML.hpp"
40 #include "Dialogs/dlgAnalysis.hpp"
41 #include "Dialogs/Task/TaskDialogs.hpp"
42 #include "Dialogs/Dialogs.h"
43 #include "Dialogs/Airspace/AirspaceWarningDialog.hpp"
44 #include "Dialogs/DialogSettings.hpp"
45 #include "UIGlobals.hpp"
46 #include "Airspace/AirspaceParser.hpp"
47 #include "Airspace/AirspaceGlue.hpp"
48 #include "Engine/Waypoint/Waypoints.hpp"
49 #include "Engine/Airspace/Airspaces.hpp"
50 #include "Engine/Task/TaskManager.hpp"
51 #include "Engine/Task/TaskEvents.hpp"
52 #include "Engine/Task/Ordered/OrderedTask.hpp"
53 #include "Computer/BasicComputer.hpp"
54 #include "Computer/GlideComputer.hpp"
55 #include "Computer/GlideComputerInterface.hpp"
56 #include "Task/ProtectedTaskManager.hpp"
57 #include "Task/ProtectedRoutePlanner.hpp"
58 #include "Task/TaskFile.hpp"
59 #include "LocalPath.hpp"
60 #include "Blackboard/InterfaceBlackboard.hpp"
61 #include "DebugReplay.hpp"
62 #include "IO/FileLineReader.hpp"
63 #include "Operation/Operation.hpp"
64 #include "Look/Look.hpp"
65 #include "Look/Fonts.hpp"
66 #include "OS/Args.hpp"
74 #include "Computer/ConditionMonitor/ConditionMonitors.hpp"
75 #include "Input/InputQueue.hpp"
76 #include "Logger/Logger.hpp"
78 void dlgBasicSettingsShowModal() {}
79 void ShowWindSettingsDialog() {}
82 dlgAirspaceWarningsShowModal(SingleWindow
&parent
,
83 ProtectedAirspaceWarningManager
&warnings
,
88 void dlgTaskManagerShowModal(SingleWindow
&parent
) {}
91 ConditionMonitorsUpdate(const NMEAInfo
&basic
, const DerivedInfo
&calculated
,
92 const ComputerSettings
&settings
)
96 bool InputEvents::processGlideComputer(unsigned) { return false; }
98 void Logger::LogStartEvent(const NMEAInfo
&gps_info
) {}
99 void Logger::LogFinishEvent(const NMEAInfo
&gps_info
) {}
100 void Logger::LogPoint(const NMEAInfo
&gps_info
) {}
102 /* done with fake symbols. */
104 static RasterTerrain
*terrain
;
107 LoadFiles(Airspaces
&airspace_database
)
109 NullOperationEnvironment operation
;
111 terrain
= RasterTerrain::OpenTerrain(NULL
, operation
);
113 const AtmosphericPressure pressure
= AtmosphericPressure::Standard();
114 ReadAirspace(airspace_database
, terrain
, pressure
, operation
);
118 LoadReplay(DebugReplay
*replay
, GlideComputer
&glide_computer
,
119 InterfaceBlackboard
&blackboard
)
122 while (replay
->Next()) {
123 const MoreData
&basic
= replay
->Basic();
125 glide_computer
.ReadBlackboard(basic
);
126 glide_computer
.ProcessGPS();
130 glide_computer
.ProcessIdle();
134 glide_computer
.ProcessExhaustive();
136 blackboard
.ReadBlackboardBasic(glide_computer
.Basic());
137 blackboard
.ReadBlackboardCalculated(glide_computer
.Calculated());
140 static DebugReplay
*replay
;
143 ParseCommandLine(Args
&args
)
145 replay
= CreateDebugReplay(args
);
146 if (replay
== nullptr)
153 const Waypoints way_points
;
155 InterfaceBlackboard blackboard
;
156 blackboard
.SetComputerSettings().SetDefaults();
157 blackboard
.SetComputerSettings().polar
.glide_polar_task
= GlidePolar(fixed(1));
158 blackboard
.SetUISettings().SetDefaults();
160 TaskBehaviour task_behaviour
;
161 task_behaviour
.SetDefaults();
163 TaskManager
task_manager(task_behaviour
, way_points
);
164 task_manager
.SetGlidePolar(blackboard
.GetComputerSettings().polar
.glide_polar_task
);
166 GlideComputerTaskEvents task_events
;
167 task_manager
.SetTaskEvents(task_events
);
169 Airspaces airspace_database
;
171 ProtectedTaskManager
protected_task_manager(task_manager
,
172 blackboard
.GetComputerSettings().task
);
174 LoadFiles(airspace_database
);
176 const TaskFactoryType task_type_default
=
177 blackboard
.GetComputerSettings().task
.task_type_default
;
179 protected_task_manager
.TaskCreateDefault(&way_points
, task_type_default
);
180 if (task
!= nullptr) {
181 task
->FillMatPoints(way_points
);
182 protected_task_manager
.TaskCommit(*task
);
186 GlideComputer
glide_computer(way_points
, airspace_database
,
187 protected_task_manager
,
189 glide_computer
.ReadComputerSettings(blackboard
.GetComputerSettings());
190 glide_computer
.SetTerrain(terrain
);
191 glide_computer
.Initialise();
193 LoadReplay(replay
, glide_computer
, blackboard
);
196 SingleWindow main_window
;
197 main_window
.Create(_T("RunAnalysis"),
200 dlgAnalysisShowModal(main_window
, *look
, blackboard
, glide_computer
,
201 &protected_task_manager
,