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:
-rw-r--r--geometry/covering_utils.hpp16
-rw-r--r--indexer/feature_covering.cpp2
2 files changed, 11 insertions, 7 deletions
diff --git a/geometry/covering_utils.hpp b/geometry/covering_utils.hpp
index 711a4c09a8..0038b6d54b 100644
--- a/geometry/covering_utils.hpp
+++ b/geometry/covering_utils.hpp
@@ -72,16 +72,20 @@ CellObjectIntersection IntersectCellWithTriangle(
template <class CellIdT, class CellIdContainerT, typename IntersectF>
void CoverObject(IntersectF const & intersect, uint64_t cellPenaltyArea, CellIdContainerT & out,
- CellIdT cell)
+ int cellDepth, CellIdT cell)
{
- uint64_t const cellArea = my::sq(uint64_t(1 << (CellIdT::DEPTH_LEVELS - 1 - cell.Level())));
+ if (cell.Level() == cellDepth - 1)
+ {
+ out.push_back(cell);
+ return;
+ }
+
+ uint64_t const cellArea = my::sq(uint64_t(1 << (cellDepth - 1 - cell.Level())));
CellObjectIntersection const intersection = intersect(cell);
if (intersection == CELL_OBJECT_NO_INTERSECTION)
return;
- if (intersection == CELL_INSIDE_OBJECT ||
- cell.Level() == CellIdT::DEPTH_LEVELS - 1 ||
- cellPenaltyArea >= cellArea)
+ if (intersection == CELL_INSIDE_OBJECT || cellPenaltyArea >= cellArea)
{
out.push_back(cell);
return;
@@ -89,7 +93,7 @@ void CoverObject(IntersectF const & intersect, uint64_t cellPenaltyArea, CellIdC
buffer_vector<CellIdT, 32> subdiv;
for (uint8_t i = 0; i < 4; ++i)
- CoverObject(intersect, cellPenaltyArea, subdiv, cell.Child(i));
+ CoverObject(intersect, cellPenaltyArea, subdiv, cellDepth, cell.Child(i));
uint64_t subdivArea = 0;
for (size_t i = 0; i < subdiv.size(); ++i)
diff --git a/indexer/feature_covering.cpp b/indexer/feature_covering.cpp
index dfc47aeea8..1a9179e59d 100644
--- a/indexer/feature_covering.cpp
+++ b/indexer/feature_covering.cpp
@@ -114,7 +114,7 @@ vector<int64_t> CoverFeature(FeatureType const & f, int cellDepth, uint64_t cell
}
vector<RectId> cells;
- covering::CoverObject(featureIntersector, cellPenaltyArea, cells, RectId::Root());
+ covering::CoverObject(featureIntersector, cellPenaltyArea, cells, cellDepth, RectId::Root());
vector<int64_t> res(cells.size());
for (size_t i = 0; i < cells.size(); ++i)