diff --git a/indexer/displacement_manager.hpp b/indexer/displacement_manager.hpp index e723ec1a68..ecde14cf5f 100644 --- a/indexer/displacement_manager.hpp +++ b/indexer/displacement_manager.hpp @@ -17,8 +17,8 @@ namespace { - double constexpr kPOIperTileSizeCoint = 6; - double constexpr kPointLookupDeltaDegrees = 0.000001; +double constexpr kPOIperTileSizeCoint = 6; +double constexpr kPointLookupDeltaDegrees = 0.000001; } // namespace namespace covering @@ -84,7 +84,6 @@ class DisplacementManager { public: DisplacementManager(TSorter & sorter) : m_sorter(sorter) {} - template void Add(vector const & cells, uint32_t bucket, TFeature const & ft, uint32_t index) { @@ -102,7 +101,7 @@ public: { m4::Tree acceptedNodes; list deferredNodes; - for(uint32_t zoom = 0; zoom < scales::GetUpperScale(); ++zoom) + for (uint32_t zoom = 0; zoom < scales::GetUpperScale(); ++zoom) { // Initialize queue. priority_queue displacableQueue; @@ -126,11 +125,12 @@ public: m2::RectD const displacementRect(maxNode.center.x - delta, maxNode.center.y - delta, maxNode.center.x + delta, maxNode.center.y + delta); bool isDisplacing = false; - acceptedNodes.ForEachInRect(displacementRect, - [&isDisplacing, &maxNode, &delta, &zoom](DisplacableNode const & node){ - if ((maxNode.center - node.center).Length() < delta && node.maxZoomLevel > zoom) - isDisplacing = true; - }); + acceptedNodes.ForEachInRect( + displacementRect, [&isDisplacing, &maxNode, &delta, &zoom](DisplacableNode const & node) + { + if ((maxNode.center - node.center).Length() < delta && node.maxZoomLevel > zoom) + isDisplacing = true; + }); if (isDisplacing) { deferredNodes.push_back(maxNode); @@ -143,8 +143,7 @@ public: acceptedNodes.Add(maxNode); accepted++; } - LOG(LINFO, ("Displacement for zoom", zoom, - "Features accepted:", accepted, + LOG(LINFO, ("Displacement for zoom", zoom, "Features accepted:", accepted, "Features discarted:", deferredNodes.size())); } } @@ -160,9 +159,10 @@ private: uint32_t priority; DisplacableNode() : index(0), maxZoomLevel(0), priority(0) {} - - template - DisplacableNode(vector const & cells, TFeature const & ft, uint32_t index, int zoomLevel): index(index), center(ft.GetCenter()), cells(cells) + template + DisplacableNode(vector const & cells, TFeature const & ft, uint32_t index, + int zoomLevel) + : index(index), center(ft.GetCenter()), cells(cells) { feature::TypesHolder const types(ft); auto scaleRange = feature::GetDrawableScaleRange(types); @@ -187,15 +187,8 @@ private: priority = (static_cast(d) << 8) || rank; } - bool operator < (DisplacableNode const & node) const - { - return priority < node.priority; - } - - bool operator == (DisplacableNode const & node) const - { - return index == node.index; - } + bool operator<(DisplacableNode const & node) const { return priority < node.priority; } + bool operator==(DisplacableNode const & node) const { return index == node.index; } m2::RectD const GetLimitRect() const { return m2::RectD(center, center); } }; diff --git a/indexer/scale_index_builder.hpp b/indexer/scale_index_builder.hpp index 31715970fa..d85df1e168 100644 --- a/indexer/scale_index_builder.hpp +++ b/indexer/scale_index_builder.hpp @@ -33,13 +33,13 @@ class FeatureCoverer public: FeatureCoverer(feature::DataHeader const & header, TDisplacementManager & manager, vector & featuresInBucket, vector & cellsInBucket) - : m_header(header), - m_scalesIdx(0), - m_bucketsCount(header.GetLastScale() + 1), - m_displacement(manager), - m_codingDepth(covering::GetCodingDepth(header.GetLastScale())), - m_featuresInBucket(featuresInBucket), - m_cellsInBucket(cellsInBucket) + : m_header(header) + , m_scalesIdx(0) + , m_bucketsCount(header.GetLastScale() + 1) + , m_displacement(manager) + , m_codingDepth(covering::GetCodingDepth(header.GetLastScale())) + , m_featuresInBucket(featuresInBucket) + , m_cellsInBucket(cellsInBucket) { m_featuresInBucket.resize(m_bucketsCount); m_cellsInBucket.resize(m_bucketsCount); @@ -158,7 +158,8 @@ void IndexScales(feature::DataHeader const & header, TFeaturesVector const & fea TDisplacementManager manager(sorter); vector featuresInBucket(bucketsCount); vector cellsInBucket(bucketsCount); - features.ForEach(FeatureCoverer(header, manager, featuresInBucket, cellsInBucket)); + features.ForEach( + FeatureCoverer(header, manager, featuresInBucket, cellsInBucket)); manager.Displace(); sorter.SortAndFinish();