mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-04 11:53:47 +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:
52
search/nested_rects_cache.hpp
Normal file
52
search/nested_rects_cache.hpp
Normal file
@@ -0,0 +1,52 @@
|
||||
#pragma once
|
||||
|
||||
#include "indexer/feature_decl.hpp"
|
||||
|
||||
#include "geometry/point2d.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
class DataSource;
|
||||
|
||||
namespace search
|
||||
{
|
||||
class NestedRectsCache
|
||||
{
|
||||
public:
|
||||
explicit NestedRectsCache(DataSource const & dataSource);
|
||||
|
||||
void SetPosition(m2::PointD const & position, int scale);
|
||||
|
||||
double GetDistanceToFeatureMeters(FeatureID const & id) const;
|
||||
|
||||
void Clear();
|
||||
|
||||
private:
|
||||
enum RectScale
|
||||
{
|
||||
RECT_SCALE_TINY,
|
||||
RECT_SCALE_SMALL,
|
||||
RECT_SCALE_MEDIUM,
|
||||
RECT_SCALE_LARGE,
|
||||
|
||||
RECT_SCALE_COUNT
|
||||
};
|
||||
|
||||
static double GetRadiusMeters(RectScale scale);
|
||||
|
||||
void Update();
|
||||
|
||||
DataSource const & m_dataSource;
|
||||
int m_scale;
|
||||
m2::PointD m_position;
|
||||
bool m_valid;
|
||||
|
||||
using Features = std::vector<uint32_t>;
|
||||
using Bucket = std::map<MwmSet::MwmId, Features>;
|
||||
|
||||
// Sorted lists of features.
|
||||
Bucket m_buckets[RECT_SCALE_COUNT];
|
||||
};
|
||||
} // namespace search
|
||||
Reference in New Issue
Block a user