MCPcopy Create free account
hub / github.com/comaps/comaps / DrapeEngine

Method DrapeEngine

libs/drape_frontend/drape_engine.cpp:44–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42} // namespace
43
44DrapeEngine::DrapeEngine(Params && params)
45 : m_myPositionModeChanged(std::move(params.m_myPositionModeChanged))
46 , m_viewport(std::move(params.m_viewport))
47{
48 dp::DrapeRoutine::Init();
49
50 VisualParams::Init(params.m_vs, df::CalculateTileSize(m_viewport.GetWidth(), m_viewport.GetHeight()));
51
52 SetFontScaleFactor(params.m_fontsScaleFactor);
53
54 gui::DrapeGui::Instance().SetSurfaceSize(m2::PointF(m_viewport.GetWidth(), m_viewport.GetHeight()));
55
56 m_textureManager = make_unique_dp<dp::TextureManager>();
57 m_threadCommutator = make_unique_dp<ThreadsCommutator>();
58 m_requestedTiles = make_unique_dp<RequestedTiles>();
59
60 using namespace location;
61 EMyPositionMode lastMode = PendingPosition;
62 if (settings::Get(kLocationStateMode, lastMode) && lastMode == FollowAndRotate)
63 {
64 // If the screen rect setting in follow and rotate mode is missing or invalid, it could cause
65 // invalid animations, so the follow and rotate mode should be discarded.
66 m2::AnyRectD rect;
67 if (!(settings::Get("ScreenClipRect", rect) && df::GetWorldRect().IsRectInside(rect.GetGlobalRect())))
68 lastMode = Follow;
69 }
70
71 EMyPositionMode preferredRoutingMode;
72 if (!settings::Get(kPreferredRoutingMode, preferredRoutingMode))
73 preferredRoutingMode = FollowAndRotate;
74
75 if (!settings::Get(kLastEnterBackground, m_startBackgroundTime))
76 m_startBackgroundTime = base::Timer::LocalTime();
77
78 std::vector<PostprocessRenderer::Effect> effects;
79
80 // bool enabledAntialiasing;
81 // if (!settings::Get(dp::kSupportedAntialiasing, enabledAntialiasing))
82 // enabledAntialiasing = false;
83
84 // Turn off AA for a while by energy-saving issues.
85 // if (enabledAntialiasing)
86 //{
87 // LOG(LINFO, ("Antialiasing is enabled"));
88 // effects.push_back(PostprocessRenderer::Antialiasing);
89 //}
90
91 MyPositionController::Params mpParams(lastMode, preferredRoutingMode,
92 base::Timer::LocalTime() - m_startBackgroundTime, params.m_hints,
93 params.m_isRoutingActive, params.m_isAutozoomEnabled,
94 std::bind(&DrapeEngine::MyPositionModeChanged, this, _1, _2, _3));
95
96 FrontendRenderer::Params frParams(
97 params.m_apiVersion, make_ref(m_threadCommutator), params.m_factory, make_ref(m_textureManager),
98 std::move(mpParams), m_viewport, std::bind(&DrapeEngine::ModelViewChanged, this, _1),
99 std::bind(&DrapeEngine::TapEvent, this, _1), std::bind(&DrapeEngine::UserPositionChanged, this, _1, _2),
100 make_ref(m_requestedTiles), std::move(params.m_overlaysShowStatsCallback), params.m_allow3dBuildings,
101 params.m_trafficEnabled, params.m_blockTapEvents, std::move(effects), params.m_onGraphicsContextInitialized,

Callers

nothing calls this directly

Calls 10

CalculateTileSizeFunction · 0.85
GetFunction · 0.85
GetWorldRectFunction · 0.85
make_refFunction · 0.85
SetSurfaceSizeMethod · 0.80
InitFunction · 0.50
GetWidthMethod · 0.45
GetHeightMethod · 0.45
IsRectInsideMethod · 0.45
GetGlobalRectMethod · 0.45

Tested by

no test coverage detected