Renderer, ...: use PixelRect::GetCenter()
[xcsoar.git] / src / Renderer / TrailRenderer.hpp
blob92aae8221f8f08c9098b695e1fcfe6119d365ab5
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_TRAIL_RENDERER_HPP
25 #define XCSOAR_TRAIL_RENDERER_HPP
27 #include "Util/AllocatedArray.hpp"
28 #include "Engine/Trace/Point.hpp"
29 #include "Engine/Trace/Vector.hpp"
31 struct RasterPoint;
32 class Canvas;
33 class TraceComputer;
34 class Projection;
35 class WindowProjection;
36 class ContestTraceVector;
37 struct TrailLook;
38 struct NMEAInfo;
39 struct DerivedInfo;
40 struct TrailSettings;
42 class TrailRenderer {
43 const TrailLook &look;
45 TracePointVector trace;
46 AllocatedArray<RasterPoint> points;
48 public:
49 TrailRenderer(const TrailLook &_look):look(_look) {}
51 /**
52 * Load the full trace into this object.
54 bool LoadTrace(const TraceComputer &trace_computer);
56 /**
57 * Load a filtered trace into this object.
59 bool LoadTrace(const TraceComputer &trace_computer, unsigned min_time,
60 const WindowProjection &projection);
62 gcc_pure
63 TaskProjection GetBounds(const GeoPoint fallback_location) const;
65 void Draw(Canvas &canvas, const TraceComputer &trace_computer,
66 const WindowProjection &projection, unsigned min_time,
67 bool enable_traildrift, const RasterPoint pos, const NMEAInfo &basic,
68 const DerivedInfo &calculated, const TrailSettings &settings);
70 /**
71 * Draw the trace that was obtained by LoadTrace() with the trace pen.
73 void Draw(Canvas &canvas, const WindowProjection &projection);
75 void Draw(Canvas &canvas, const TraceComputer &trace_computer,
76 const WindowProjection &projection, unsigned min_time);
78 /**
79 * Draw a ContestTraceVector. The caller must select a Pen.
81 void DrawTraceVector(Canvas &canvas, const WindowProjection &projection,
82 const ContestTraceVector &trace);
84 private:
85 void DrawTraceVector(Canvas &canvas, const Projection &projection,
86 const TracePointVector &trace);
89 #endif