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

Method Add

libs/drape/overlay_tree.cpp:170–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170void OverlayTree::Add(ref_ptr<OverlayHandle> handle)
171{
172 /// @todo Fires when deleting downloaded country ?!
173 // ASSERT(handle->GetOverlayID().IsValid(), ());
174 ASSERT(IsNeedUpdate(), ());
175
176 ScreenBase const & modelView = GetModelView();
177
178 handle->SetIsVisible(false);
179
180 if (m_zoomLevel < handle->GetMinVisibleScale())
181 return;
182
183 handle->EnableCaching(true);
184
185 // Skip duplicates.
186 if (IsInCache(handle))
187 return;
188
189 // Skip not-ready handles.
190 if (!handle->Update(modelView))
191 {
192 InvalidateOnNextFrame();
193 handle->SetReady(false);
194 return;
195 }
196 else
197 {
198 handle->SetReady(true);
199 }
200
201 // Clip handles which are out of screen if these handles were not displacers
202 // last time. Also clip all handles in reverse projection.
203 m2::RectD const pixelRect = handle->GetExtendedPixelRect(modelView);
204 if (modelView.IsReverseProjection3d(pixelRect.Center()) ||
205 (m_displacers.find(handle) == m_displacers.end() && !m_traits.GetExtendedScreenRect().IsIntersect(pixelRect)))
206 {
207 handle->SetIsVisible(false);
208 return;
209 }
210
211 ASSERT_GREATER_OR_EQUAL(handle->GetOverlayRank(), 0, ());
212 size_t const rank = static_cast<size_t>(handle->GetOverlayRank());
213 ASSERT_LESS(rank, m_handles.size(), ());
214 m_handles[rank].emplace_back(std::move(handle));
215}
216
217void OverlayTree::InsertHandle(ref_ptr<OverlayHandle> handle, int currentRank,
218 ref_ptr<OverlayHandle> const & parentOverlay)

Callers 15

GetPerspectiveRectMethod · 0.45
CollectOverlayHandlesMethod · 0.45
CacheUserMarksFunction · 0.45
PrepareSchemeSubwayMethod · 0.45
PrepareSchemePTMethod · 0.45
PrepareGeometryMethod · 0.45
PrepareArrowGeometryMethod · 0.45
DrawMethod · 0.45

Calls 15

ASSERTFunction · 0.85
GetMinVisibleScaleMethod · 0.80
EnableCachingMethod · 0.80
SetReadyMethod · 0.80
GetExtendedPixelRectMethod · 0.80
IsReverseProjection3dMethod · 0.80
GetOverlayRankMethod · 0.80
SetIsVisibleMethod · 0.45
UpdateMethod · 0.45
CenterMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected