| 147 | } |
| 148 | |
| 149 | void 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 | |
| 194 | m2::Spline::iterator PathTextContext::GetProjectedPoint(m2::PointD const & pt) const |
| 195 | { |
nothing calls this directly
no test coverage detected