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

Method InitCollection

libs/map/gps_track.cpp:170–217  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168}
169
170void GpsTrack::InitCollection()
171{
172 ASSERT(m_collection == nullptr, ());
173
174 m_collection = make_unique<GpsTrackCollection>();
175
176 InitStorageIfNeed();
177 if (!m_storage)
178 return;
179
180 try
181 {
182 // All origin points have been written in the storage,
183 // and filtered points are inserted in the runtime collection.
184
185 vector<location::GpsInfo> originPoints;
186 originPoints.reserve(gps_track::kItemBlockSize);
187
188 m_storage->ForEach([this, &originPoints](location::GpsInfo const & originPoint) -> bool
189 {
190 originPoints.emplace_back(originPoint);
191 if (originPoints.size() == originPoints.capacity())
192 {
193 vector<location::GpsInfo> points;
194 m_filter->Process(originPoints, points);
195
196 m_collection->Add(points);
197
198 originPoints.clear();
199 }
200 return true;
201 });
202
203 if (!originPoints.empty())
204 {
205 vector<location::GpsInfo> points;
206 m_filter->Process(originPoints, points);
207
208 m_collection->Add(points);
209 }
210 }
211 catch (RootException const & e)
212 {
213 LOG(LWARNING, ("Track storage exception:", e.Msg()));
214 m_collection->Clear();
215 m_storage.reset();
216 }
217}
218
219void GpsTrack::ProcessPoints()
220{

Callers

nothing calls this directly

Calls 12

ASSERTFunction · 0.85
reserveMethod · 0.45
ForEachMethod · 0.45
emplace_backMethod · 0.45
sizeMethod · 0.45
capacityMethod · 0.45
ProcessMethod · 0.45
AddMethod · 0.45
clearMethod · 0.45
emptyMethod · 0.45
ClearMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected