DeviceBlackboard.cpp: Refactoring of Heading()
[xcsoar.git] / test / src / Printing.cpp
blobce8fb1f55f013d1b251417cc3c682b3c217282fd
1 /* Copyright_License {
3 XCSoar Glide Computer - http://www.xcsoar.org/
4 Copyright (C) 2000-2010 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.
22 #include "Printing.hpp"
23 #include <fstream>
25 #include "Engine/Task/TaskManager.hpp"
26 #include "Task/Tasks/AbortTask.hpp"
27 #include "Task/Tasks/GotoTask.hpp"
28 #include "Task/Tasks/OrderedTask.hpp"
29 #include "Task/Tasks/AbstractTask.hpp"
30 #include "Task/Tasks/BaseTask/TaskPoint.hpp"
31 #include "Task/Tasks/BaseTask/SampledTaskPoint.hpp"
32 #include "Task/Tasks/BaseTask/OrderedTaskPoint.hpp"
33 #include "Task/Tasks/ContestManager.hpp"
34 #include "Trace/Trace.hpp"
36 #ifdef FIXED_MATH
37 std::ostream& operator<<(std::ostream& os,fixed const& value)
39 return os<<value.as_double();
41 #endif
44 #include "Task/TaskPoints/AATPoint.hpp"
45 #include "Task/TaskPoints/AATIsolineSegment.hpp"
47 void
48 PrintHelper::aatpoint_print(std::ostream& f,
49 const AATPoint& tp,
50 const AIRCRAFT_STATE& state,
51 const TaskProjection &projection,
52 const int item)
54 switch(item) {
55 case 0:
56 orderedtaskpoint_print(f, tp, state, item);
57 f << "# Target " << tp.m_target_location.Longitude << ","
58 << tp.m_target_location.Latitude << "\n";
59 break;
61 case 1:
63 if (tp.valid() && (tp.getActiveState() != OrderedTaskPoint::BEFORE_ACTIVE)) {
64 assert(tp.get_previous());
65 assert(tp.get_next());
66 // note in general this will only change if
67 // prev max or target changes
69 AATIsolineSegment seg(tp, projection);
70 fixed tdist = tp.get_previous()->get_location_remaining().distance(
71 tp.get_location_min());
72 fixed rdist = tp.get_previous()->get_location_remaining().distance(
73 tp.get_location_target());
75 bool filter_backtrack = true;
76 if (seg.valid()) {
77 for (double t = 0.0; t<=1.0; t+= 1.0/20) {
78 GeoPoint ga = seg.parametric(fixed(t));
79 fixed dthis = tp.get_previous()->get_location_remaining().distance(ga);
80 if (!filter_backtrack
81 || (dthis>=tdist)
82 || (dthis>=rdist)) {
83 /// @todo unless double dist is better than current
84 f << ga.Longitude << " " << ga.Latitude << "\n";
87 } else {
88 GeoPoint ga = seg.parametric(fixed_zero);
89 f << ga.Longitude << " " << ga.Latitude << "\n";
91 f << "\n";
94 break;
99 void
100 PrintHelper::orderedtaskpoint_print(std::ostream& f,
101 const OrderedTaskPoint& tp,
102 const AIRCRAFT_STATE& state,
103 const int item)
105 if (item==0) {
106 sampledtaskpoint_print(f,tp,state);
107 orderedtaskpoint_print_boundary(f,tp,state);
108 f << "# Entered " << tp.get_state_entered().Time << "\n";
109 f << "# Bearing travelled " << tp.vector_travelled.Bearing << "\n";
110 f << "# Distance travelled " << tp.vector_travelled.Distance << "\n";
111 f << "# Bearing remaining " << tp.vector_remaining.Bearing << "\n";
112 f << "# Distance remaining " << tp.vector_remaining.Distance << "\n";
113 f << "# Bearing planned " << tp.vector_planned.Bearing << "\n";
114 f << "# Distance planned " << tp.vector_planned.Distance << "\n";
119 void
120 PrintHelper::orderedtaskpoint_print_boundary(std::ostream& f,
121 const OrderedTaskPoint& tp,
122 const AIRCRAFT_STATE &state)
124 f << "# Boundary points\n";
125 for (double t=0; t<= 1.0; t+= 0.05) {
126 GeoPoint loc = tp.get_boundary_parametric(fixed(t));
127 f << " " << loc.Longitude << " " << loc.Latitude << "\n";
129 GeoPoint loc = tp.get_boundary_parametric(fixed_zero);
130 f << " " << loc.Longitude << " " << loc.Latitude << "\n";
131 f << "\n";
135 void
136 PrintHelper::sampledtaskpoint_print(std::ostream& f, const SampledTaskPoint& tp,
137 const AIRCRAFT_STATE &state)
139 taskpoint_print(f,tp,state);
143 void
144 PrintHelper::sampledtaskpoint_print_samples(std::ostream& f,
145 const SampledTaskPoint& tp,
146 const AIRCRAFT_STATE &state)
148 const unsigned n= tp.get_search_points().size();
149 f << "# Search points\n";
150 if (tp.has_entered()) {
151 for (unsigned i=0; i<n; i++) {
152 const GeoPoint loc = tp.get_search_points()[i].get_location();
153 f << " " << loc.Longitude << " " << loc.Latitude << "\n";
156 f << "\n";
160 void
161 PrintHelper::taskpoint_print(std::ostream& f, const TaskPoint& tp,
162 const AIRCRAFT_STATE &state)
164 f << "# Task point \n";
165 f << "# Location " << tp.get_location().Longitude << "," <<
166 tp.get_location().Latitude << "\n";
170 void
171 PrintHelper::abstracttask_print(AbstractTask& task, const AIRCRAFT_STATE &state)
173 std::ofstream fs("results/res-stats-all.txt");
174 if (!task.stats.task_valid)
175 return;
177 fs << task.stats;
179 static std::ofstream f6("results/res-stats.txt");
180 static bool first = true;
182 if (first) {
183 first = false;
184 f6 << "# Time atp mc_best d_tot_rem_eff d_tot_rem ceff v_tot_rem v_tot_rem_inc v_tot_eff v_tot_eff_inc task_vario effective_mc\n";
187 if (positive(task.stats.Time)) {
188 f6 << task.stats.Time
189 << " " << task.activeTaskPoint
190 << " " << task.stats.mc_best
191 << " " << task.stats.total.remaining_effective.get_distance()
192 << " " << task.stats.total.remaining.get_distance()
193 << " " << task.stats.cruise_efficiency
194 << " " << task.stats.total.remaining.get_speed()
195 << " " << task.stats.total.remaining.get_speed_incremental()
196 << " " << task.stats.total.remaining_effective.get_speed()
197 << " " << task.stats.total.remaining_effective.get_speed_incremental()
198 << " " << task.stats.total.vario.get_value()
199 << " " << task.stats.effective_mc
200 << "\n";
201 f6.flush();
202 } else {
203 f6 << "\n";
204 f6.flush();
209 void
210 PrintHelper::gototask_print(GotoTask& task, const AIRCRAFT_STATE &state)
212 abstracttask_print(task, state);
213 if (task.tp) {
214 std::ofstream f1("results/res-goto.txt");
215 taskpoint_print(f1,*task.tp,state);
219 void
220 PrintHelper::orderedtask_print(OrderedTask& task, const AIRCRAFT_STATE &state)
222 abstracttask_print(task, state);
223 if (!task.stats.task_valid)
224 return;
226 std::ofstream fi("results/res-isolines.txt");
227 for (unsigned i=0; i<task.task_points.size(); i++) {
228 fi << "## point " << i << "\n";
229 if (task.task_points[i]->type == TaskPoint::AAT) {
230 aatpoint_print(fi, (AATPoint&)*task.task_points[i], state,
231 task.get_task_projection(), 1);
232 } else {
233 orderedtaskpoint_print(fi,*task.task_points[i],state,1);
235 fi << "\n";
238 std::ofstream f1("results/res-task.txt");
240 f1 << "#### Task points\n";
241 for (unsigned i=0; i<task.task_points.size(); i++) {
242 f1 << "## point " << i << " ###################\n";
243 if (task.task_points[i]->type == TaskPoint::AAT) {
244 aatpoint_print(f1, (AATPoint&)*task.task_points[i], state,
245 task.get_task_projection(), 0);
246 } else {
247 orderedtaskpoint_print(f1,*task.task_points[i],state,0);
249 f1 << "\n";
252 std::ofstream f5("results/res-ssample.txt");
253 f5 << "#### Task sampled points\n";
254 for (unsigned i=0; i<task.task_points.size(); i++) {
255 f5 << "## point " << i << "\n";
256 sampledtaskpoint_print_samples(f5,*task.task_points[i],state);
257 f5 << "\n";
260 std::ofstream f2("results/res-max.txt");
261 f2 << "#### Max task\n";
262 for (unsigned i=0; i<task.task_points.size(); i++) {
263 OrderedTaskPoint *tp = task.task_points[i];
264 f2 << tp->get_location_max().Longitude << " "
265 << tp->get_location_max().Latitude << "\n";
268 std::ofstream f3("results/res-min.txt");
269 f3 << "#### Min task\n";
270 for (unsigned i=0; i<task.task_points.size(); i++) {
271 OrderedTaskPoint *tp = task.task_points[i];
272 f3 << tp->get_location_min().Longitude << " "
273 << tp->get_location_min().Latitude << "\n";
276 std::ofstream f4("results/res-rem.txt");
277 f4 << "#### Remaining task\n";
278 for (unsigned i=0; i<task.task_points.size(); i++) {
279 OrderedTaskPoint *tp = task.task_points[i];
280 f4 << tp->get_location_remaining().Longitude << " "
281 << tp->get_location_remaining().Latitude << "\n";
286 void PrintHelper::aborttask_print(AbortTask& task, const AIRCRAFT_STATE &state)
288 abstracttask_print(task, state);
290 std::ofstream f1("results/res-abort-task.txt");
291 f1 << "#### Task points\n";
292 for (unsigned i=0; i<task.task_points.size(); i++) {
293 GeoPoint l = task.task_points[i].first->get_location();
294 f1 << "## point " << i << " ###################\n";
295 if (i==task.activeTaskPoint) {
296 f1 << state.Location.Longitude << " " << state.Location.Latitude << "\n";
298 f1 << l.Longitude << " " << l.Latitude << "\n";
299 f1 << "\n";
304 void PrintHelper::taskmanager_print(TaskManager& task, const AIRCRAFT_STATE &state)
306 if (task.active_task) {
307 if (task.active_task == &task.task_abort) {
308 aborttask_print(task.task_abort, state);
310 if (task.active_task == &task.task_goto) {
311 gototask_print(task.task_goto, state);
313 if (task.active_task == &task.task_ordered) {
314 orderedtask_print(task.task_ordered, state);
318 trace_print(task.trace_full, state.Location);
320 contestmanager_print(task.contest_manager);
322 std::ofstream fs("results/res-stats-common.txt");
323 fs << task.common_stats;
326 #include "Math/Earth.hpp"
327 #include "Navigation/TaskProjection.hpp"
332 std::ostream& operator<< (std::ostream& o,
333 const TaskProjection& tp)
335 o << "# Task projection\n";
336 o << "# deg (" << tp.location_min.Longitude << ","
337 << tp.location_min.Latitude << "),("
338 << tp.location_max.Longitude << "," << tp.location_max.Latitude << ")\n";
340 FlatGeoPoint pll, pur;
341 pll = tp.project(tp.location_min);
342 pur = tp.project(tp.location_max);
344 o << "# flat (" << pll.Longitude << "," << pll.Latitude << "),("
345 << pur.Longitude << "," << pur.Latitude << "\n";
346 return o;
350 #include "GlideSolvers/GlideResult.hpp"
352 std::ostream& operator<< (std::ostream& f,
353 const GlideResult& gl)
355 if (gl.Solution != GlideResult::RESULT_OK) {
356 f << "# Solution NOT OK\n";
358 f << "# Altitude Difference " << gl.AltitudeDifference << " (m)\n";
359 f << "# Distance " << gl.Vector.Distance << " (m)\n";
360 f << "# TrackBearing " << gl.Vector.Bearing << " (deg)\n";
361 f << "# CruiseTrackBearing " << gl.CruiseTrackBearing << " (deg)\n";
362 f << "# VOpt " << gl.VOpt << " (m/s)\n";
363 f << "# HeightClimb " << gl.HeightClimb << " (m)\n";
364 f << "# HeightGlide " << gl.HeightGlide << " (m)\n";
365 f << "# TimeElapsed " << gl.TimeElapsed << " (s)\n";
366 f << "# TimeVirtual " << gl.TimeVirtual << " (s)\n";
367 if (positive(gl.TimeElapsed)) {
368 f << "# Vave remaining " << gl.Vector.Distance/gl.TimeElapsed << " (m/s)\n";
370 f << "# EffectiveWindSpeed " << gl.EffectiveWindSpeed << " (m/s)\n";
371 f << "# EffectiveWindAngle " << gl.EffectiveWindAngle << " (deg)\n";
372 f << "# DistanceToFinal " << gl.DistanceToFinal << " (m)\n";
373 if (gl.is_final_glide()) {
374 f << "# On final glide\n";
376 return f;
379 #include "Task/TaskStats/TaskStats.hpp"
381 std::ostream& operator<< (std::ostream& f,
382 const DistanceStat& ds)
384 f << "# Distance " << ds.distance << " (m)\n";
385 f << "# Speed " << ds.speed << " (m/s)\n";
386 f << "# Speed incremental " << ds.speed_incremental << " (m/s)\n";
387 return f;
390 std::ostream& operator<< (std::ostream& f,
391 const TaskStats& ts)
393 f << "#### Task Stats\n";
394 f << "# dist nominal " << ts.distance_nominal << " (m)\n";
395 f << "# min dist after achieving max " << ts.distance_min << " (m)\n";
396 f << "# max dist after achieving max " << ts.distance_max << " (m)\n";
397 f << "# dist scored " << ts.distance_scored << " (m)\n";
398 f << "# mc best " << ts.mc_best << " (m/s)\n";
399 f << "# cruise efficiency " << ts.cruise_efficiency << "\n";
400 f << "# glide required " << ts.glide_required << "\n";
401 f << "#\n";
402 f << "# Total -- \n";
403 f << ts.total;
404 f << "# Leg -- \n";
405 f << ts.current_leg;
406 return f;
410 #include "Task/TaskStats/CommonStats.hpp"
412 std::ostream& operator<< (std::ostream& f,
413 const CommonStats& ts)
415 f << "#### Common Stats\n";
416 f << "# olc dist " << ts.olc.distance << " (m)\n";
417 f << "# olc time " << ts.olc.time << " (s)\n";
418 f << "# olc speed " << ts.olc.speed << " (m/s)\n";
419 return f;
423 std::ostream& operator<< (std::ostream& f,
424 const ElementStat& es)
426 f << "# Time started " << es.TimeStarted << " (s)\n";
427 f << "# Time elapsed " << es.TimeElapsed << " (s)\n";
428 f << "# Time remaining " << es.TimeRemaining << " (s)\n";
429 f << "# Time planned " << es.TimePlanned << " (s)\n";
430 f << "# Gradient " << es.gradient << "\n";
431 f << "# Remaining: \n";
432 f << es.remaining;
433 f << es.solution_remaining;
434 f << "# Remaining effective: \n";
435 f << es.remaining_effective;
436 f << "# Remaining mc0: \n";
437 f << es.solution_mc0;
438 f << "# Planned: \n";
439 f << es.planned;
440 f << es.solution_planned;
441 f << "# Travelled: \n";
442 f << es.travelled;
443 f << es.solution_travelled;
444 f << "# Vario: ";
445 f << es.vario.get_value();
446 f << "\n";
447 return f;
450 #include "Waypoint/Waypoint.hpp"
452 std::ostream& operator<< (std::ostream& f,
453 const Waypoint& wp)
455 f << wp.Location.Longitude << " " << wp.Location.Latitude << "\n";
456 return f;
459 #include "Navigation/Flat/FlatBoundingBox.hpp"
462 void
463 FlatBoundingBox::print(std::ostream &f, const TaskProjection &task_projection) const {
464 FlatGeoPoint ll(bb_ll.Longitude,bb_ll.Latitude);
465 FlatGeoPoint lr(bb_ur.Longitude,bb_ll.Latitude);
466 FlatGeoPoint ur(bb_ur.Longitude,bb_ur.Latitude);
467 FlatGeoPoint ul(bb_ll.Longitude,bb_ur.Latitude);
468 GeoPoint gll = task_projection.unproject(ll);
469 GeoPoint glr = task_projection.unproject(lr);
470 GeoPoint gur = task_projection.unproject(ur);
471 GeoPoint gul = task_projection.unproject(ul);
473 f << gll.Longitude << " " << gll.Latitude << "\n";
474 f << glr.Longitude << " " << glr.Latitude << "\n";
475 f << gur.Longitude << " " << gur.Latitude << "\n";
476 f << gul.Longitude << " " << gul.Latitude << "\n";
477 f << gll.Longitude << " " << gll.Latitude << "\n";
478 f << "\n";
483 void
484 TaskMacCready::print(std::ostream &f, const AIRCRAFT_STATE &aircraft) const
486 AIRCRAFT_STATE aircraft_start = get_aircraft_start(aircraft);
487 AIRCRAFT_STATE aircraft_predict = aircraft;
488 aircraft_predict.Altitude = aircraft_start.Altitude;
489 f << "# i alt min elev\n";
490 f << start-0.5 << " " << aircraft_start.Altitude << " " <<
491 minHs[start] << " " <<
492 task_points[start]->get_elevation() << "\n";
493 for (int i=start; i<=end; i++) {
494 aircraft_predict.Altitude -= gs[i].HeightGlide;
495 f << i << " " << aircraft_predict.Altitude << " " << minHs[i]
496 << " " << task_points[i]->get_elevation() << "\n";
498 f << "\n";
502 #include "Airspace/AirspaceCircle.hpp"
504 std::ostream& operator<< (std::ostream& f,
505 const AirspaceCircle& as)
507 f << "# circle\n";
508 for (double t=0; t<=360; t+= 30) {
509 GeoPoint l = FindLatitudeLongitude(as.m_center, Angle::degrees(fixed(t)), as.m_radius);
510 f << l.Longitude << " " << l.Latitude << " " << as.get_base().Altitude << "\n";
512 f << "\n";
513 for (double t=0; t<=360; t+= 30) {
514 GeoPoint l = FindLatitudeLongitude(as.m_center, Angle::degrees(fixed(t)), as.m_radius);
515 f << l.Longitude << " " << l.Latitude << " " << as.get_top().Altitude << "\n";
517 f << "\n";
518 f << "\n";
519 return f;
522 #include "Airspace/AirspacePolygon.hpp"
524 std::ostream& operator<< (std::ostream& f,
525 const AirspacePolygon& as)
527 f << "# polygon\n";
528 for (std::vector<SearchPoint>::const_iterator v = as.m_border.begin();
529 v != as.m_border.end(); ++v) {
530 GeoPoint l = v->get_location();
531 f << l.Longitude << " " << l.Latitude << " " << as.get_base().Altitude << "\n";
533 f << "\n";
534 for (std::vector<SearchPoint>::const_iterator v = as.m_border.begin();
535 v != as.m_border.end(); ++v) {
536 GeoPoint l = v->get_location();
537 f << l.Longitude << " " << l.Latitude << " " << as.get_top().Altitude << "\n";
539 f << "\n";
540 f << "\n";
542 return f;
546 #include "Airspace/AbstractAirspace.hpp"
548 std::ostream& operator<< (std::ostream& f,
549 const AbstractAirspace& as)
551 switch (as.shape) {
552 case AbstractAirspace::CIRCLE:
553 f << (const AirspaceCircle &)as;
554 break;
556 case AbstractAirspace::POLYGON:
557 f << (const AirspacePolygon &)as;
558 break;
560 return f;
563 #include "Airspace/AirspaceWarning.hpp"
565 std::ostream& operator<< (std::ostream& f,
566 const AirspaceWarning& aw)
568 AirspaceWarning::AirspaceWarningState state = aw.get_warning_state();
569 f << "# warning ";
570 switch(state) {
571 case AirspaceWarning::WARNING_CLEAR:
572 f << "clear\n";
573 break;
574 case AirspaceWarning::WARNING_TASK:
575 f << "task\n";
576 break;
577 case AirspaceWarning::WARNING_FILTER:
578 f << "predicted filter\n";
579 break;
580 case AirspaceWarning::WARNING_GLIDE:
581 f << "predicted glide\n";
582 break;
583 case AirspaceWarning::WARNING_INSIDE:
584 f << "inside\n";
585 break;
588 const AirspaceInterceptSolution &solution = aw.get_solution();
589 f << "# intercept " << solution.location.Longitude << " " << solution.location.Latitude
590 << " dist " << solution.distance << " alt " << solution.altitude << " time "
591 << solution.elapsed_time << "\n";
593 return f;
597 void
598 PrintHelper::contestmanager_print(const ContestManager& man)
601 std::ofstream fs("results/res-olc-trace.txt");
602 TracePointVector v;
603 man.trace_full.get_trace_points(v);
605 for (TracePointVector::const_iterator it = v.begin();
606 it != v.end(); ++it) {
607 fs << it->get_location().Longitude << " " << it->get_location().Latitude
608 << " " << it->NavAltitude << " " << it->time
609 << "\n";
614 std::ofstream fs("results/res-olc-trace_sprint.txt");
616 TracePointVector v;
617 man.trace_sprint.get_trace_points(v);
619 for (TracePointVector::const_iterator it = v.begin();
620 it != v.end(); ++it) {
621 fs << it->get_location().Longitude << " " << it->get_location().Latitude
622 << " " << it->NavAltitude << " " << it->time
623 << "\n";
627 std::ofstream fs("results/res-olc-solution.txt");
629 if (man.solution.empty()) {
630 fs << "# no solution\n";
631 return;
634 if (positive(man.result.time)) {
636 for (TracePointVector::const_iterator it = man.solution.begin();
637 it != man.solution.end(); ++it) {
638 fs << it->get_location().Longitude << " " << it->get_location().Latitude
639 << " " << it->NavAltitude << " " << it->time
640 << "\n";
645 void
646 PrintHelper::print(const ContestResult& score)
648 std::cout << "# score " << score.score << "\n";
649 std::cout << "# distance " << score.distance/fixed(1000) << " (km)\n";
650 std::cout << "# speed " << score.speed*fixed(3.6) << " (kph)\n";
651 std::cout << "# time " << score.time << " (sec)\n";
655 static void
656 print_tpv(const TracePointVector& vec, std::ofstream& fs)
658 unsigned last_time = 0;
659 for (TracePointVector::const_iterator it = vec.begin(); it != vec.end();
660 ++it) {
661 if (it->last_time != last_time) {
662 fs << "\n";
664 fs << it->time
665 << " " << it->get_location().Longitude
666 << " " << it->get_location().Latitude
667 << " " << it->NavAltitude
668 << " " << it->last_time
669 << " " << it->Vario
670 << "\n";
671 last_time = it->time;
675 void
676 PrintHelper::trace_print(const Trace& trace, const GeoPoint &loc)
678 std::ofstream fs("results/res-trace.txt");
680 TracePointVector vec = trace.find_within_range(loc, fixed(10000),
682 print_tpv(vec, fs);
684 std::ofstream ft("results/res-trace-thin.txt");
685 vec = trace.find_within_range(loc, fixed(10000), 0, fixed(1000));
687 print_tpv(vec, ft);
691 #include "Math/Angle.hpp"
693 std::ostream& operator<< (std::ostream& o, const Angle& a)
695 o << a.value_degrees();
696 return o;
700 void write_point(const SearchPoint& sp, const FlatGeoPoint& p, const char* name)
702 printf("%g %g %d %d # %s\n",
703 (double)sp.get_location().Longitude.value_degrees(),
704 (double)sp.get_location().Latitude.value_degrees(),
705 p.Longitude,
706 p.Latitude,
707 name);
708 fflush(stdout);
711 void write_spv (const SearchPointVector& spv)
713 for (std::vector<SearchPoint>::const_iterator v = spv.begin();
714 v != spv.end(); ++v) {
715 write_point(*v, v->get_flatLocation(), "spv");
717 printf("spv\n");
718 fflush(stdout);
721 void write_border (const AbstractAirspace& as)
723 const SearchPointVector& spv = as.get_points();
724 for (std::vector<SearchPoint>::const_iterator v = spv.begin();
725 v != spv.end(); ++v) {
726 write_point(*v, v->get_flatLocation(), "polygon");
728 printf("polygon\n");
729 write_spv(as.get_clearance());
730 fflush(stdout);
733 #include "Route/AirspaceRoute.hpp"
735 void PrintHelper::print_route(RoutePlanner& r)
737 for (Route::const_iterator i = r.solution_route.begin();
738 i!= r.solution_route.end(); ++i) {
739 printf("%.6g %.6g %d # solution\n",
740 (double)i->Longitude.value_degrees(),
741 (double)i->Latitude.value_degrees(),
744 printf("# solution\n");
745 for (Route::const_iterator i = r.solution_route.begin();
746 i!= r.solution_route.end(); ++i) {
747 printf("%.6g %.6g %d # solution\n",
748 (double)i->Longitude.value_degrees(),
749 (double)i->Latitude.value_degrees(),
750 i->altitude);
752 printf("# solution\n");
753 printf("# solution\n");
754 printf("# stats:\n");
755 printf("# dijkstra links %d\n", (int)r.count_dij);
756 printf("# unique links %d\n", (int)r.count_unique);
757 printf("# airspace queries %d\n", (int)r.count_airspace);
758 printf("# terrain queries %d\n", (int)r.count_terrain);
759 printf("# supressed %d\n", (int)r.count_supressed);