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 "TrafficRenderer.hpp"
25 #include "Screen/Canvas.hpp"
26 #include "Screen/Layout.hpp"
27 #include "Look/TrafficLook.hpp"
28 #include "FLARM/Traffic.hpp"
29 #include "Math/Screen.hpp"
32 TrafficRenderer::Draw(Canvas
&canvas
, const TrafficLook
&traffic_look
,
33 const FlarmTraffic
&traffic
, const Angle angle
,
34 const FlarmColor color
, const RasterPoint pt
)
36 // Create point array that will form that arrow polygon
39 // Fill the Arrow array with a normal arrow pointing north
51 // Select brush depending on AlarmLevel
52 switch (traffic
.alarm_level
) {
53 case FlarmTraffic::AlarmType::LOW
:
54 case FlarmTraffic::AlarmType::INFO_ALERT
:
55 canvas
.Select(traffic_look
.warning_brush
);
57 case FlarmTraffic::AlarmType::IMPORTANT
:
58 case FlarmTraffic::AlarmType::URGENT
:
59 canvas
.Select(traffic_look
.alarm_brush
);
61 case FlarmTraffic::AlarmType::NONE
:
62 canvas
.Select(traffic_look
.safe_brush
);
67 canvas
.SelectBlackPen();
69 // Rotate and shift the arrow to the right position and angle
70 PolygonRotateShift(Arrow
, 5, pt
.x
, pt
.y
, angle
);
73 canvas
.DrawPolygon(Arrow
, 5);
76 case FlarmColor::GREEN
:
77 canvas
.Select(traffic_look
.team_pen_green
);
79 case FlarmColor::BLUE
:
80 canvas
.Select(traffic_look
.team_pen_blue
);
82 case FlarmColor::YELLOW
:
83 canvas
.Select(traffic_look
.team_pen_yellow
);
85 case FlarmColor::MAGENTA
:
86 canvas
.Select(traffic_look
.team_pen_magenta
);
92 canvas
.SelectHollowBrush();
93 canvas
.DrawCircle(pt
.x
, pt
.y
, Layout::FastScale(11));