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

Method UpdatePoints

libs/drape_frontend/gps_track_renderer.cpp:101–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101void GpsTrackRenderer::UpdatePoints(std::vector<GpsTrackPoint> const & toAdd, std::vector<uint32_t> const & toRemove)
102{
103 bool recreateSpline = false;
104 if (!toRemove.empty())
105 {
106 size_t const szBefore = m_points.size();
107 base::EraseIf(m_points, [&toRemove](GpsTrackPoint const & pt) { return base::IsExist(toRemove, pt.m_id); });
108
109 if (szBefore > m_points.size()) // if removed any
110 {
111 recreateSpline = true;
112 m_needUpdate = true;
113 }
114 }
115
116 if (!toAdd.empty())
117 {
118 ASSERT(is_sorted(toAdd.begin(), toAdd.end(), GpsPointsSortPredicate), ());
119 ASSERT(m_points.empty() || GpsPointsSortPredicate(m_points.back(), toAdd.front()), ());
120 m_points.insert(m_points.end(), toAdd.begin(), toAdd.end());
121 m_needUpdate = true;
122 }
123
124 if (recreateSpline) // Recreate Spline only if Remove (Clear) was invoked.
125 {
126 m_pointsSpline = m2::Spline(m_points.size());
127 for (auto const & p : m_points)
128 m_pointsSpline.AddPoint(p.m_point);
129 }
130 else // Simple append points otherwise.
131 {
132 for (auto const & p : toAdd)
133 m_pointsSpline.AddPoint(p.m_point);
134 }
135}
136
137size_t GpsTrackRenderer::GetAvailablePointsCount() const
138{

Callers 1

AcceptMessageMethod · 0.80

Calls 13

EraseIfFunction · 0.85
IsExistFunction · 0.85
ASSERTFunction · 0.85
GpsPointsSortPredicateFunction · 0.85
SplineClass · 0.85
backMethod · 0.80
frontMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected