Renderer, ...: use PixelRect::GetCenter()
[xcsoar.git] / src / Device / Declaration.hpp
blob86e88fd374d78f0975529676e9651117acb9a98e
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 #ifndef XCSOAR_DEVICE_DECLARATION_HPP
25 #define XCSOAR_DEVICE_DECLARATION_HPP
27 #include "Geo/GeoPoint.hpp"
28 #include "Engine/Waypoint/Waypoint.hpp"
29 #include "Util/StaticString.hpp"
30 #include "Compiler.h"
32 #include <vector>
33 #include <tchar.h>
35 struct LoggerSettings;
36 struct Plane;
37 class OrderedTask;
38 class OrderedTaskPoint;
40 struct Declaration {
41 struct TurnPoint {
42 enum Shape {
43 CYLINDER,
44 SECTOR,
45 LINE,
48 Waypoint waypoint;
49 Shape shape;
50 unsigned radius;
52 TurnPoint(const Waypoint &_waypoint)
53 :waypoint(_waypoint), shape(CYLINDER), radius(1500) {}
54 TurnPoint(const OrderedTaskPoint &tp);
57 StaticString<64> pilot_name;
58 StaticString<32> aircraft_type;
59 StaticString<32> aircraft_registration;
60 StaticString<8> competition_id;
61 std::vector<TurnPoint> turnpoints;
63 Declaration(const LoggerSettings &logger_settings, const Plane &plane,
64 const OrderedTask* task);
66 void Append(const Waypoint &waypoint) {
67 turnpoints.push_back(waypoint);
70 const Waypoint &GetWaypoint(unsigned i) const {
71 return turnpoints[i].waypoint;
74 const Waypoint &GetFirstWaypoint() const {
75 return turnpoints.front().waypoint;
78 const Waypoint &GetLastWaypoint() const {
79 return turnpoints.back().waypoint;
82 gcc_pure
83 const TCHAR *GetName(const unsigned i) const {
84 return turnpoints[i].waypoint.name.c_str();
87 const GeoPoint &GetLocation(const unsigned i) const {
88 return turnpoints[i].waypoint.location;
91 gcc_pure
92 unsigned Size() const {
93 return turnpoints.size();
97 #endif