mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-29 01:03:46 +00:00
Organic Maps sources as of 02.04.2025 (fad26bbf22ac3da75e01e62aa01e5c8e11861005)
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
This commit is contained in:
45
search/features_filter.cpp
Normal file
45
search/features_filter.cpp
Normal file
@@ -0,0 +1,45 @@
|
||||
#include "search/features_filter.hpp"
|
||||
|
||||
#include "search/cbv.hpp"
|
||||
|
||||
namespace search
|
||||
{
|
||||
// FeaturesFilter ----------------------------------------------------------------------------------
|
||||
FeaturesFilter::FeaturesFilter(CBV const & filter, uint64_t threshold)
|
||||
: m_filter(filter), m_threshold(threshold)
|
||||
{
|
||||
}
|
||||
|
||||
bool FeaturesFilter::NeedToFilter(CBV const & cbv) const
|
||||
{
|
||||
if (cbv.IsFull())
|
||||
return true;
|
||||
return cbv.PopCount() > m_threshold;
|
||||
}
|
||||
|
||||
// LocalityFilter ----------------------------------------------------------------------------------
|
||||
LocalityFilter::LocalityFilter(CBV const & filter)
|
||||
: FeaturesFilter(filter, 0 /* threshold */)
|
||||
{
|
||||
}
|
||||
|
||||
CBV LocalityFilter::Filter(CBV const & cbv) const
|
||||
{
|
||||
return m_filter.Intersect(cbv);
|
||||
}
|
||||
|
||||
// ViewportFilter ----------------------------------------------------------------------------------
|
||||
ViewportFilter::ViewportFilter(CBV const & filter, uint64_t threshold)
|
||||
: FeaturesFilter(filter, threshold)
|
||||
{
|
||||
}
|
||||
|
||||
CBV ViewportFilter::Filter(CBV const & cbv) const
|
||||
{
|
||||
auto result = m_filter.Intersect(cbv);
|
||||
if (!result.IsEmpty())
|
||||
return result;
|
||||
|
||||
return cbv.Take(m_threshold);
|
||||
}
|
||||
} // namespace search
|
||||
Reference in New Issue
Block a user