forked from organicmaps/organicmaps-tmp
PR fixes.
This commit is contained in:
parent
4d479d9dd8
commit
4e02b29ed5
2 changed files with 9 additions and 20 deletions
|
@ -152,9 +152,8 @@ Route::TTurns::const_iterator Route::GetCurrentTurn() const
|
|||
|
||||
double Route::GetCurrentCam(SpeedCameraRestriction & camera, Index const & index) const
|
||||
{
|
||||
size_t current_index = max(m_poly.GetCurrentIter().m_ind, m_lastCheckedCamera);
|
||||
SpeedCameraRestriction cam(static_cast<uint32_t>(current_index), 0 /* maxspeed */);
|
||||
for (size_t i = current_index; i < m_poly.GetPolyline().GetSize(); ++i)
|
||||
size_t const currentIndex = max(m_poly.GetCurrentIter().m_ind, m_lastCheckedCamera);
|
||||
for (size_t i = currentIndex; i < m_poly.GetPolyline().GetSize(); ++i)
|
||||
{
|
||||
uint8_t speed = CheckCameraInPoint(m_poly.GetPolyline().GetPoint(i), index);
|
||||
if (speed != kNoSpeedCamera)
|
||||
|
|
|
@ -33,30 +33,20 @@ uint8_t ReadCamRestriction(FeatureType & ft)
|
|||
|
||||
uint8_t CheckCameraInPoint(m2::PointD const & point, Index const & index)
|
||||
{
|
||||
Classificator & c = classif();
|
||||
uint32_t const req = c.GetTypeByPath({"highway", "speed_camera"});
|
||||
|
||||
uint32_t speedLimit = kNoSpeedCamera;
|
||||
|
||||
auto const f = [&req, &c, &point, &speedLimit](FeatureType & ft)
|
||||
auto const f = [&point, &speedLimit](FeatureType & ft)
|
||||
{
|
||||
if (ft.GetFeatureType() != feature::GEOM_POINT)
|
||||
return;
|
||||
|
||||
feature::TypesHolder hl = ft;
|
||||
for (uint32_t t : hl)
|
||||
{
|
||||
uint32_t const type = ftypes::BaseChecker::PrepareToMatch(t, 2);
|
||||
if (type == req)
|
||||
{
|
||||
ft.ParseGeometry(FeatureType::BEST_GEOMETRY);
|
||||
if (ft.GetCenter() == point)
|
||||
{
|
||||
speedLimit = ReadCamRestriction(ft);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!ftypes::IsSpeedCamChecker::Instance()(hl))
|
||||
return;
|
||||
|
||||
ft.ParseGeometry(FeatureType::BEST_GEOMETRY);
|
||||
if (ft.GetCenter() == point)
|
||||
speedLimit = ReadCamRestriction(ft);
|
||||
};
|
||||
|
||||
index.ForEachInRect(f,
|
||||
|
|
Loading…
Add table
Reference in a new issue