forked from organicmaps/organicmaps
[routing] Phantom nodes finding asserton fix.
This commit is contained in:
parent
a878ab5b0c
commit
cdb51bc8e7
2 changed files with 22 additions and 4 deletions
|
@ -26,6 +26,14 @@ namespace
|
|||
);
|
||||
}
|
||||
|
||||
// Strange asserts near Cupertino test
|
||||
UNIT_TEST(CaliforniaCupertionFindPhantomAssetText)
|
||||
{
|
||||
integration::CalculateRouteAndTestRouteLength(integration::GetAllMaps(),
|
||||
{-122.03448, 40.29689}, {0., 0.},
|
||||
{-122.03469, 40.29741}, 6548.);
|
||||
}
|
||||
|
||||
// Cross mwm tests.
|
||||
UNIT_TEST(RussiaMoscowLenigradskiy39GerPanfilovtsev22RouteTest)
|
||||
{
|
||||
|
|
|
@ -165,9 +165,8 @@ void OsrmFtSegMapping::DumpSegmentByNode(TOsrmNodeId nodeId) const
|
|||
|
||||
void OsrmFtSegMapping::GetOsrmNodes(FtSegSetT & segments, OsrmNodesT & res) const
|
||||
{
|
||||
auto addResFn = [&] (uint64_t seg, size_t idx, bool forward)
|
||||
auto addResFn = [&] (uint64_t seg, TOsrmNodeId nodeId, bool forward)
|
||||
{
|
||||
TOsrmNodeId const nodeId = GetNodeId(idx);
|
||||
auto it = res.insert({ seg, { forward ? nodeId : INVALID_NODE_ID,
|
||||
forward ? INVALID_NODE_ID : nodeId } });
|
||||
if (it.second)
|
||||
|
@ -207,7 +206,7 @@ void OsrmFtSegMapping::GetOsrmNodes(FtSegSetT & segments, OsrmNodesT & res) cons
|
|||
{
|
||||
if (seg.m_pointStart >= s.m_pointStart && seg.m_pointEnd <= s.m_pointEnd)
|
||||
{
|
||||
if (addResFn(seg.Store(), i, true))
|
||||
if (addResFn(seg.Store(), nodeId, true))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -217,7 +216,7 @@ void OsrmFtSegMapping::GetOsrmNodes(FtSegSetT & segments, OsrmNodesT & res) cons
|
|||
{
|
||||
if (seg.m_pointStart >= s.m_pointEnd && seg.m_pointEnd <= s.m_pointStart)
|
||||
{
|
||||
if (addResFn(seg.Store(), i, false))
|
||||
if (addResFn(seg.Store(), nodeId, false))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -413,6 +412,7 @@ void OsrmFtSegBackwardIndex::Construct(OsrmFtSegMapping & mapping, const uint32_
|
|||
vector<bool> inIndex(m_table->size(), false);
|
||||
m_nodeIds.reserve(temporaryBackwardIndex.size());
|
||||
|
||||
size_t removedNodes = 0;
|
||||
for (size_t i = 0; i < m_table->size(); ++i)
|
||||
{
|
||||
uint32_t fid = m_table->GetFeatureOffset(i);
|
||||
|
@ -421,9 +421,19 @@ void OsrmFtSegBackwardIndex::Construct(OsrmFtSegMapping & mapping, const uint32_
|
|||
{
|
||||
inIndex[i] = true;
|
||||
m_nodeIds.emplace_back(move(it->second));
|
||||
|
||||
// Remove duplicates nodes emmited by equal choises on a generation route step.
|
||||
TNodesList & nodesList = m_nodeIds.back();
|
||||
size_t const foundNodes = nodesList.size();
|
||||
sort(nodesList.begin(), nodesList.end());
|
||||
auto const endIt = unique(nodesList.begin(), nodesList.end());
|
||||
nodesList.erase(endIt, nodesList.end());
|
||||
removedNodes += foundNodes - nodesList.size();
|
||||
}
|
||||
}
|
||||
|
||||
LOG(LINFO, ("Backward index constructor removes", removedNodes, "duplicates."));
|
||||
|
||||
// Pack and save index
|
||||
succinct::rs_bit_vector(inIndex).swap(m_rankIndex);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue