forked from organicmaps/organicmaps-tmp
Review fixes.
This commit is contained in:
parent
4e983421eb
commit
c4fe2dfd25
1 changed files with 15 additions and 16 deletions
|
@ -13,7 +13,7 @@ namespace v2
|
|||
{
|
||||
namespace
|
||||
{
|
||||
using TParentGraph = vector<unordered_map<uint32_t, uint32_t>>;
|
||||
using TParentGraph = unordered_map<uint32_t, uint32_t>;
|
||||
|
||||
// This function tries to estimate amount of work needed to perform an
|
||||
// intersection pass on a sequence of layers.
|
||||
|
@ -66,9 +66,8 @@ bool GetPath(uint32_t id, vector<FeaturesLayer const *> const & layers, TParentG
|
|||
if (level >= parent.size())
|
||||
return true;
|
||||
|
||||
auto const & p = parent[level];
|
||||
auto const it = p.find(id);
|
||||
if (it == p.cend())
|
||||
auto const it = parent.find(id);
|
||||
if (it == parent.cend())
|
||||
return false;
|
||||
id = it->second;
|
||||
++level;
|
||||
|
@ -108,6 +107,12 @@ void FeaturesLayerPathFinder::FindReachableVerticesTopDown(
|
|||
|
||||
TParentGraph parent(layers.size() - 1);
|
||||
|
||||
auto addEdge = [&](uint32_t childFeature, uint32_t parentFeature)
|
||||
{
|
||||
parent[childFeature] = parentFeature;
|
||||
buffer.push_back(childFeature);
|
||||
};
|
||||
|
||||
for (size_t i = layers.size() - 1; i != 0; --i)
|
||||
{
|
||||
BailIfCancelled(m_cancellable);
|
||||
|
@ -115,12 +120,6 @@ void FeaturesLayerPathFinder::FindReachableVerticesTopDown(
|
|||
if (reachable.empty())
|
||||
return;
|
||||
|
||||
auto addEdge = [&](uint32_t childFeature, uint32_t parentFeature)
|
||||
{
|
||||
parent[i - 1][childFeature] = parentFeature;
|
||||
buffer.push_back(childFeature);
|
||||
};
|
||||
|
||||
FeaturesLayer parent(*layers[i]);
|
||||
if (i != layers.size() - 1)
|
||||
my::SortUnique(reachable);
|
||||
|
@ -155,6 +154,12 @@ void FeaturesLayerPathFinder::FindReachableVerticesBottomUp(
|
|||
|
||||
TParentGraph parent(layers.size() - 1);
|
||||
|
||||
auto addEdge = [&](uint32_t childFeature, uint32_t parentFeature)
|
||||
{
|
||||
parent[childFeature] = parentFeature;
|
||||
buffer.push_back(parentFeature);
|
||||
};
|
||||
|
||||
for (size_t i = 0; i + 1 != layers.size(); ++i)
|
||||
{
|
||||
BailIfCancelled(m_cancellable);
|
||||
|
@ -162,12 +167,6 @@ void FeaturesLayerPathFinder::FindReachableVerticesBottomUp(
|
|||
if (reachable.empty())
|
||||
return;
|
||||
|
||||
auto addEdge = [&](uint32_t childFeature, uint32_t parentFeature)
|
||||
{
|
||||
parent[i][childFeature] = parentFeature;
|
||||
buffer.push_back(parentFeature);
|
||||
};
|
||||
|
||||
FeaturesLayer child(*layers[i]);
|
||||
if (i != 0)
|
||||
my::SortUnique(reachable);
|
||||
|
|
Loading…
Add table
Reference in a new issue