Files
comaps/search/features_filter.hpp
Konstantin Pastbin e3e4a1985a 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
2025-05-08 21:10:51 +07:00

53 lines
1.2 KiB
C++

#pragma once
#include <cstdint>
namespace search
{
class CBV;
// A lightweight filter of features.
//
// NOTE: this class and its subclasses *ARE* thread-safe.
class FeaturesFilter
{
public:
FeaturesFilter(CBV const & filter, uint64_t threshold);
virtual ~FeaturesFilter() = default;
bool NeedToFilter(CBV const & features) const;
virtual CBV Filter(CBV const & cbv) const = 0;
protected:
CBV const & m_filter;
uint64_t const m_threshold;
};
// Exact filter - leaves only features belonging to the set it was
// constructed from.
class LocalityFilter : public FeaturesFilter
{
public:
LocalityFilter(CBV const & filter);
// FeaturesFilter overrides:
CBV Filter(CBV const & cbv) const override;
};
// Fuzzy filter - tries to leave only features belonging to the set it
// was constructed from, but if the result is empty, leaves at most
// first |threshold| features instead. This property is quite useful
// when there are no matching features in viewport but it's ok to
// process a limited number of features outside the viewport.
class ViewportFilter : public FeaturesFilter
{
public:
ViewportFilter(CBV const & filter, uint64_t threshold);
// FeaturesFilter overrides:
CBV Filter(CBV const & cbv) const override;
};
} // namespace search