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

Function MatchTracks

tools/track_analyzing/track_analyzer/cmd_match.cpp:40–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38using Iter = typename vector<string>::iterator;
39
40void MatchTracks(MwmToTracks const & mwmToTracks, storage::Storage const & storage, NumMwmIds const & numMwmIds,
41 MwmToMatchedTracks & mwmToMatchedTracks)
42{
43 base::Timer timer;
44
45 uint64_t tracksCount = 0;
46 uint64_t pointsCount = 0;
47 uint64_t nonMatchedPointsCount = 0;
48
49 auto processMwm = [&](string const & mwmName, UserToTrack const & userToTrack)
50 {
51 auto const countryFile = platform::CountryFile(mwmName);
52 auto const mwmId = numMwmIds.GetId(countryFile);
53 TrackMatcher matcher(storage, mwmId, countryFile);
54
55 auto & userToMatchedTracks = mwmToMatchedTracks[mwmId];
56
57 for (auto const & it : userToTrack)
58 {
59 string const & user = it.first;
60 auto & matchedTracks = userToMatchedTracks[user];
61 try
62 {
63 matcher.MatchTrack(it.second, matchedTracks);
64 }
65 catch (RootException const & e)
66 {
67 LOG(LERROR, ("Can't match track for mwm:", mwmName, ", user:", user));
68 LOG(LERROR, (" ", e.what()));
69 }
70
71 if (matchedTracks.empty())
72 userToMatchedTracks.erase(user);
73 }
74
75 if (userToMatchedTracks.empty())
76 mwmToMatchedTracks.erase(mwmId);
77
78 tracksCount += matcher.GetTracksCount();
79 pointsCount += matcher.GetPointsCount();
80 nonMatchedPointsCount += matcher.GetNonMatchedPointsCount();
81
82 LOG(LINFO,
83 (numMwmIds.GetFile(mwmId).GetName(), ", users:", userToTrack.size(), ", tracks:", matcher.GetTracksCount(),
84 ", points:", matcher.GetPointsCount(), ", non matched points:", matcher.GetNonMatchedPointsCount()));
85 };
86
87 ForTracksSortedByMwmName(mwmToTracks, numMwmIds, processMwm);
88
89 LOG(LINFO, ("Matching finished, elapsed:", timer.ElapsedSeconds(), "seconds, tracks:", tracksCount,
90 ", points:", pointsCount, ", non matched points:", nonMatchedPointsCount));
91}
92} // namespace
93
94namespace track_analyzing

Callers 1

CmdMatchFunction · 0.85

Calls 14

ForTracksSortedByMwmNameFunction · 0.85
MatchTrackMethod · 0.80
GetTracksCountMethod · 0.80
GetFileMethod · 0.80
ElapsedSecondsMethod · 0.80
CountryFileClass · 0.50
GetIdMethod · 0.45
whatMethod · 0.45
emptyMethod · 0.45
eraseMethod · 0.45
GetPointsCountMethod · 0.45

Tested by

no test coverage detected