mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 13:03:36 +00:00
To expand with full Organic Maps and Maps.ME commits history run: git remote add om-historic [om-historic.git repo url] git fetch --tags om-historic git replace squashed-history historic-commits
26 lines
604 B
C++
26 lines
604 B
C++
#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
|