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

Method UpdateUserMarks

libs/drape_frontend/drape_engine.cpp:256–366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

254}
255
256void DrapeEngine::UpdateUserMarks(UserMarksProvider * provider, bool firstTime)
257{
258 auto const updatedGroupIds = firstTime ? provider->GetAllGroupIds() : provider->GetUpdatedGroupIds();
259 if (updatedGroupIds.empty())
260 return;
261
262 auto marksRenderCollection = make_unique_dp<UserMarksRenderCollection>();
263 auto linesRenderCollection = make_unique_dp<UserLinesRenderCollection>();
264 auto justCreatedIdCollection = make_unique_dp<IDCollections>();
265 auto removedIdCollection = make_unique_dp<IDCollections>();
266
267 ankerl::unordered_dense::map<kml::MarkGroupId, drape_ptr<IDCollections>> groupsVisibleIds;
268
269 auto const groupFilter = [&](kml::MarkGroupId groupId)
270 { return provider->IsGroupVisible(groupId) && (provider->GetBecameVisibleGroupIds().count(groupId) == 0); };
271
272 using GroupFilter = std::function<bool(kml::MarkGroupId groupId)>;
273
274 auto const collectIds = [&](kml::MarkIdSet const & markIds, kml::TrackIdSet const & lineIds,
275 GroupFilter const & filter, IDCollections & collection)
276 {
277 for (auto const markId : markIds)
278 if (filter == nullptr || filter(provider->GetUserPointMark(markId)->GetGroupId()))
279 collection.m_markIds.push_back(markId);
280
281 for (auto const lineId : lineIds)
282 if (filter == nullptr || filter(provider->GetUserLineMark(lineId)->GetGroupId()))
283 collection.m_lineIds.push_back(lineId);
284 };
285
286 auto const collectRenderData =
287 [&](kml::MarkIdSet const & markIds, kml::TrackIdSet const & lineIds, GroupFilter const & filter)
288 {
289 for (auto const markId : markIds)
290 {
291 auto const mark = provider->GetUserPointMark(markId);
292 if (filter == nullptr || filter(mark->GetGroupId()))
293 marksRenderCollection->emplace(markId, GenerateMarkRenderInfo(mark));
294 }
295
296 for (auto const lineId : lineIds)
297 {
298 auto const line = provider->GetUserLineMark(lineId);
299 if (filter == nullptr || filter(line->GetGroupId()))
300 linesRenderCollection->emplace(lineId, GenerateLineRenderInfo(line));
301 }
302 };
303
304 if (firstTime)
305 {
306 for (auto groupId : provider->GetAllGroupIds())
307 {
308 auto visibleIdCollection = make_unique_dp<IDCollections>();
309
310 if (provider->IsGroupVisible(groupId))
311 {
312 collectIds(provider->GetGroupPointIds(groupId), provider->GetGroupLineIds(groupId), nullptr /* filter */,
313 *visibleIdCollection);

Callers 1

NotifyChangesMethod · 0.80

Calls 11

GetAllGroupIdsMethod · 0.80
IsGroupVisibleMethod · 0.80
GetUserPointMarkMethod · 0.80
GetUserLineMarkMethod · 0.80
emptyMethod · 0.45
countMethod · 0.45
GetGroupIdMethod · 0.45
push_backMethod · 0.45
emplaceMethod · 0.45
IsEmptyMethod · 0.45
PostMessageMethod · 0.45

Tested by

no test coverage detected