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 "AirspacePrinting.hpp"
24 #include "Printing.hpp"
25 #include "Geo/Math.hpp"
26 #include "Airspace/AirspaceCircle.hpp"
29 #include "Airspace/AirspaceCircle.hpp"
32 operator<<(std::ostream
&os
, const AirspaceAltitude
&aa
)
34 switch (aa
.reference
) {
35 case AltitudeReference::NONE
:
39 case AltitudeReference::AGL
:
40 if (!positive(aa
.altitude_above_terrain
))
43 os
<< iround(aa
.altitude_above_terrain
) << " AGL";
46 case AltitudeReference::MSL
:
47 os
<< iround(aa
.altitude
);
50 case AltitudeReference::STD
:
51 os
<< "FL" << iround(aa
.flight_level
);
58 std::ostream
& operator<< (std::ostream
& f
,
59 const AirspaceCircle
& as
)
62 for (double t
=0; t
<=360; t
+= 30) {
63 GeoPoint l
= FindLatitudeLongitude(as
.m_center
, Angle::Degrees(t
), as
.m_radius
);
64 f
<< l
.longitude
<< " " << l
.latitude
<< " " << as
.GetBase().altitude
<< "\n";
67 for (double t
=0; t
<=360; t
+= 30) {
68 GeoPoint l
= FindLatitudeLongitude(as
.m_center
, Angle::Degrees(t
), as
.m_radius
);
69 f
<< l
.longitude
<< " " << l
.latitude
<< " " << as
.GetTop().altitude
<< "\n";
76 #include "Airspace/AirspacePolygon.hpp"
78 std::ostream
& operator<< (std::ostream
& f
,
79 const AirspacePolygon
& as
)
82 for (auto v
= as
.m_border
.begin();
83 v
!= as
.m_border
.end(); ++v
) {
84 GeoPoint l
= v
->GetLocation();
85 f
<< l
.longitude
<< " " << l
.latitude
<< " " << as
.GetBase().altitude
<< "\n";
88 for (auto v
= as
.m_border
.begin();
89 v
!= as
.m_border
.end(); ++v
) {
90 GeoPoint l
= v
->GetLocation();
91 f
<< l
.longitude
<< " " << l
.latitude
<< " " << as
.GetTop().altitude
<< "\n";
100 #include "Airspace/AbstractAirspace.hpp"
102 std::ostream
& operator<< (std::ostream
& f
,
103 const AbstractAirspace
& as
)
106 case AbstractAirspace::Shape::CIRCLE
:
107 f
<< (const AirspaceCircle
&)as
;
110 case AbstractAirspace::Shape::POLYGON
:
111 f
<< (const AirspacePolygon
&)as
;
117 #include "Airspace/AirspaceWarning.hpp"
119 std::ostream
& operator<< (std::ostream
& f
,
120 const AirspaceWarning
& aw
)
122 AirspaceWarning::State state
= aw
.GetWarningState();
125 case AirspaceWarning::WARNING_CLEAR
:
128 case AirspaceWarning::WARNING_TASK
:
131 case AirspaceWarning::WARNING_FILTER
:
132 f
<< "predicted filter\n";
134 case AirspaceWarning::WARNING_GLIDE
:
135 f
<< "predicted glide\n";
137 case AirspaceWarning::WARNING_INSIDE
:
142 const AirspaceInterceptSolution
&solution
= aw
.GetSolution();
143 f
<< "# intercept " << solution
.location
.longitude
<< " " << solution
.location
.latitude
144 << " dist " << solution
.distance
<< " alt " << solution
.altitude
<< " time "
145 << solution
.elapsed_time
<< "\n";