Prettify CitiesBoundariesTable interface.

Signed-off-by: Viktor Govako <viktor.govako@gmail.com>
This commit is contained in:
Viktor Govako 2022-03-29 00:42:22 +03:00
parent d9c83aafa2
commit a40ca23f1d
3 changed files with 10 additions and 8 deletions

View file

@ -3214,18 +3214,16 @@ void Framework::VisualizeCityBoundariesInRect(m2::RectD const & rect)
id += ", name:" + name;
}
size_t const boundariesSize = boundaries.GetBoundariesForTesting().size();
for (size_t i = 0; i < boundariesSize; ++i)
boundaries.ForEachBoundary([&id, this](indexer::CityBoundary const & cityBoundary, size_t i)
{
string idWithIndex = id;
auto const & cityBoundary = boundaries.GetBoundariesForTesting()[i];
if (boundariesSize > 1)
idWithIndex = id + " , i:" + strings::to_string(i);
if (i > 0)
idWithIndex = id + ", i:" + strings::to_string(i);
DrawLine(cityBoundary.m_bbox, cityBoundaryBBColor, m_drapeApi, idWithIndex + ", bb");
DrawLine(cityBoundary.m_cbox, cityBoundaryCBColor, m_drapeApi, idWithIndex + ", cb");
DrawLine(cityBoundary.m_dbox, cityBoundaryDBColor, m_drapeApi, idWithIndex + ", db");
}
});
}
}

View file

@ -115,7 +115,7 @@ void GetCityBoundariesInRectForTesting(CitiesBoundariesTable const & table, m2::
{
for (auto const & cb : kv.second)
{
if (rect.IsIntersect(m2::RectD(cb.m_bbox.Min(), cb.m_bbox.Max())))
if (rect.IsIntersect(cb.m_bbox.ToRect()))
{
featureIds.push_back(kv.first);
break;

View file

@ -54,7 +54,11 @@ public:
return rect;
}
std::vector<indexer::CityBoundary> const & GetBoundariesForTesting() const { return m_boundaries; }
template <class FnT> void ForEachBoundary(FnT && fn) const
{
for (size_t i = 0; i < m_boundaries.size(); ++i)
fn(m_boundaries[i], i);
}
friend std::string DebugPrint(Boundaries const & boundaries)
{