Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortatiana-kondakova <tatiana.kondakova@gmail.com>2018-04-20 12:14:52 +0300
committermpimenov <mpimenov@users.noreply.github.com>2018-04-21 12:23:12 +0300
commit5db1892d9b00868d705cc413ecc1e359eea3b81e (patch)
tree96eedd1cacefbcb265239645e73b6c6d7978b2ad /indexer/locality_index.hpp
parente84f61066f9a90116f8d3a064f84e90ac7ceee95 (diff)
[geocoder] Convert LocalityIndex depth to template parameter. Use different depth for objects and regions index in geocoder
Diffstat (limited to 'indexer/locality_index.hpp')
-rw-r--r--indexer/locality_index.hpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/indexer/locality_index.hpp b/indexer/locality_index.hpp
index 327bf04c34..18a58b743e 100644
--- a/indexer/locality_index.hpp
+++ b/indexer/locality_index.hpp
@@ -20,7 +20,7 @@ namespace indexer
// Geometry index which stores osm::Id as object identifier.
// Used for geocoder server, stores only POIs and buildings which have address information.
// Based on IntervalIndex.
-template <typename Reader>
+template <typename Reader, int DEPTH_LEVELS>
class LocalityIndex
{
public:
@@ -34,8 +34,7 @@ public:
void ForEachInRect(ProcessObject const & processObject, m2::RectD const & rect) const
{
covering::CoveringGetter cov(rect, covering::CoveringMode::ViewportWithLowLevels);
- covering::Intervals const & intervals =
- cov.Get<LocalityCellId::DEPTH_LEVELS>(scales::GetUpperScale());
+ covering::Intervals const & intervals = cov.Get<DEPTH_LEVELS>(scales::GetUpperScale());
for (auto const & i : intervals)
{
@@ -55,8 +54,7 @@ public:
auto const rect =
MercatorBounds::RectByCenterXYAndSizeInMeters(center, sizeM);
covering::CoveringGetter cov(rect, covering::CoveringMode::Spiral);
- covering::Intervals const & intervals =
- cov.Get<LocalityCellId::DEPTH_LEVELS>(scales::GetUpperScale());
+ covering::Intervals const & intervals = cov.Get<DEPTH_LEVELS>(scales::GetUpperScale());
std::set<uint64_t> objects;
auto process = [topSize, &objects, &processObject](uint64_t storedId) {
@@ -75,4 +73,10 @@ public:
private:
std::unique_ptr<IntervalIndex<Reader, uint64_t>> m_intervalIndex;
};
+
+template <typename Reader>
+using GeoObjectsIndex = LocalityIndex<Reader, kGeoObjectsDepthLevels>;
+
+template <typename Reader>
+using RegionsIndex = LocalityIndex<Reader, kRegionsDepthLevels>;
} // namespace indexer