blob: c56e23f981cf38d8a417a20857eeea916d00e73a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#include "generator/cities_boundaries_checker.hpp"
#include "geometry/rect2d.hpp"
namespace generator
{
CitiesBoundariesChecker::CitiesBoundariesChecker(CitiesBoundaries const & citiesBoundaries)
{
for (auto const & cb : citiesBoundaries)
m_tree.Add(cb, cb.m_bbox.ToRect());
}
bool CitiesBoundariesChecker::InCity(m2::PointD const & point) const
{
bool result = false;
m_tree.ForEachInRect(m2::RectD(point, point), [&](indexer::CityBoundary const & cityBoundary) {
if (result)
return;
result = cityBoundary.HasPoint(point);
});
return result;
}
} // namespace generator
|