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

Method Update

libs/drape_frontend/path_text_handle.cpp:149–192  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149void PathTextContext::Update(ScreenBase const & screen)
150{
151 if (m_updated)
152 return;
153 m_updated = true;
154
155 m_pixel3dSplines.clear();
156 m_centerPointIters.clear();
157 m_centerGlobalPivots.clear();
158
159 m2::SplineEx pixelSpline(m_globalSpline->GetSize());
160 for (auto pos : m_globalSpline->GetPath())
161 {
162 pos = screen.GtoP(pos);
163 if (screen.IsReverseProjection3d(pos))
164 {
165 if (pixelSpline.GetSize() > 1)
166 m_pixel3dSplines.push_back(std::move(pixelSpline));
167 pixelSpline.Clear();
168 continue;
169 }
170 AddPointAndRound(pixelSpline, screen.PtoP3d(pos));
171 }
172
173 if (pixelSpline.GetSize() > 1)
174 m_pixel3dSplines.emplace_back(std::move(pixelSpline));
175
176 if (m_pixel3dSplines.empty())
177 return;
178
179 ASSERT_EQUAL(m_globalPivots.size(), m_globalOffsets.size(), ());
180 for (auto const & pivot : m_globalPivots)
181 {
182 m2::PointD const pt2d = screen.GtoP(pivot);
183 if (!screen.IsReverseProjection3d(pt2d))
184 {
185 auto projectionIter = GetProjectedPoint(screen.PtoP3d(pt2d));
186 if (!projectionIter.IsAttached())
187 continue;
188 m_centerPointIters.push_back(projectionIter);
189 m_centerGlobalPivots.push_back(pivot);
190 }
191 }
192}
193
194m2::Spline::iterator PathTextContext::GetProjectedPoint(m2::PointD const & pt) const
195{

Callers

nothing calls this directly

Calls 15

AddPointAndRoundFunction · 0.85
IsReverseProjection3dMethod · 0.80
PtoP3dMethod · 0.80
CacheDynamicGeometryMethod · 0.80
GetLayoutMethod · 0.80
UpdateFunction · 0.50
clearMethod · 0.45
GetSizeMethod · 0.45
GetPathMethod · 0.45
GtoPMethod · 0.45
push_backMethod · 0.45
ClearMethod · 0.45

Tested by

no test coverage detected