1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
#pragma once
#include "window_handle.hpp"
#include "ruler.hpp"
#include "../geometry/point2d.hpp"
#include "../geometry/rect2d.hpp"
#include "../geometry/screenbase.hpp"
#include "../base/timer.hpp"
#include "../base/logging.hpp"
#include "../gui/button.hpp"
namespace location
{
class State;
}
class Drawer;
namespace gui
{
class Button;
class Controller;
}
class Framework;
class CountryStatusDisplay;
class CompassArrow;
/// Class, which displays additional information on the primary layer.
/// like rules, coordinates, GPS position and heading
class InformationDisplay
{
private:
graphics::FontDesc m_fontDesc;
ScreenBase m_screen;
m2::RectI m_displayRect;
int m_yOffset;
/// for debugging purposes
/// up to 10 debugging points
bool m_isDebugPointsEnabled;
m2::PointD m_DebugPts[10];
bool m_isRulerEnabled;
Ruler m_ruler;
bool m_isCenterEnabled;
m2::PointD m_centerPtLonLat;
int m_currentScale;
bool m_isDebugInfoEnabled;
double m_frameDuration;
shared_ptr<gui::Button> m_downloadButton;
gui::Controller * m_controller;
bool m_isBenchmarkInfoEnabled;
struct BenchmarkInfo
{
string m_name;
m2::RectD m_rect;
double m_duration;
};
vector<BenchmarkInfo> m_benchmarkInfo;
double m_bottomShift;
double m_visualScale;
my::Timer m_lastMemoryWarning;
bool m_isMemoryWarningEnabled;
/*
static bool s_isLogEnabled;
static my::LogMessageFn s_oldLogFn;
static list<string> s_log;
static size_t s_logSize;
static WindowHandle * s_windowHandle;
*/
shared_ptr<CountryStatusDisplay> m_countryStatusDisplay;
shared_ptr<CompassArrow> m_compassArrow;
shared_ptr<location::State> m_locationState;
public:
InformationDisplay(Framework * framework);
void setController(gui::Controller * controller);
void setScreen(ScreenBase const & screen);
void setDisplayRect(m2::RectI const & rect);
void setBottomShift(double bottomShift);
void setVisualScale(double visualScale);
void enableDebugPoints(bool doEnable);
void setDebugPoint(int pos, m2::PointD const & pt);
void drawDebugPoints(Drawer * pDrawer);
void enableRuler(bool doEnable);
void drawRuler(Drawer * pDrawer);
void setRulerParams(unsigned pxMinWidth, double metresMinWidth, double metresMaxWidth);
void setupRuler();
void enableCenter(bool doEnable);
void setCenter(m2::PointD const & latLongPt);
void drawCenter(Drawer * pDrawer);
void enableDebugInfo(bool doEnable);
void setDebugInfo(double frameDuration, int currentScale);
void drawDebugInfo(Drawer * pDrawer);
void enableMemoryWarning(bool doEnable);
void memoryWarning();
void drawMemoryWarning(Drawer * pDrawer);
void drawPlacemark(Drawer * pDrawer, string const & symbol, m2::PointD const & pt);
void enableBenchmarkInfo(bool doEnable);
bool addBenchmarkInfo(string const & name, m2::RectD const & globalRect, double frameDuration);
void drawBenchmarkInfo(Drawer * pDrawer);
void doDraw(Drawer * drawer);
void enableLog(bool doEnable, WindowHandle * windowHandle);
void setLogSize(size_t logSize);
void drawLog(Drawer * pDrawer);
void enableCompassArrow(bool doEnable);
void setCompassArrowAngle(double angle);
shared_ptr<location::State> const & locationState() const;
void enableCountryStatusDisplay(bool doEnable);
void setDownloadListener(gui::Button::TOnClickListener l);
void setEmptyCountryName(string const & country);
shared_ptr<CountryStatusDisplay> const & countryStatusDisplay() const;
static void logMessage(my::LogLevel, my::SrcPoint const &, string const &);
};
|