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-yan <tatiana.kondakova@gmail.com>2018-05-21 15:06:35 +0300
committermpimenov <mpimenov@users.noreply.github.com>2018-05-23 14:11:35 +0300
commit65af8b7ca73c8b907408a3c401655c7b56bb9b6a (patch)
treec6eb46044f613429e10dc67223d9054f3eb67c32 /routing/index_graph_starter.cpp
parent6fb8894efa013443460452fe270c69c468e76a28 (diff)
[routing] Fix weight calculation for fake parts of real
Diffstat (limited to 'routing/index_graph_starter.cpp')
-rw-r--r--routing/index_graph_starter.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/routing/index_graph_starter.cpp b/routing/index_graph_starter.cpp
index 14108423ba..a1d5927b8d 100644
--- a/routing/index_graph_starter.cpp
+++ b/routing/index_graph_starter.cpp
@@ -216,7 +216,7 @@ void IndexGraphStarter::GetEdgesList(Segment const & segment, bool isOutgoing,
m_graph.GetEdgeList(segment, isOutgoing, edges);
}
- AddFakeEdges(segment, edges);
+ AddFakeEdges(segment, isOutgoing, edges);
}
RouteWeight IndexGraphStarter::CalcSegmentWeight(Segment const & segment) const
@@ -344,18 +344,28 @@ void IndexGraphStarter::AddFinish(FakeEnding const & finishEnding, FakeEnding co
fakeNumerationStart);
}
-void IndexGraphStarter::AddFakeEdges(Segment const & segment, vector<SegmentEdge> & edges) const
+void IndexGraphStarter::AddFakeEdges(Segment const & segment, bool isOutgoing, vector<SegmentEdge> & edges) const
{
vector<SegmentEdge> fakeEdges;
for (auto const & edge : edges)
{
for (auto const & s : m_fake.GetFake(edge.GetTarget()))
{
- // Check fake segment is connected to source segment.
- if (GetJunction(s, false /* front */) == GetJunction(segment, true) ||
- GetJunction(s, true) == GetJunction(segment, false))
+ // |segment| |s|
+ // *------------>*----------->
+ bool const sIsOutgoing =
+ GetJunction(segment, true /*front */) == GetJunction(s, false /* front */);
+
+ // |s| |segment|
+ // *------------>*----------->
+ bool const sIsIngoing =
+ GetJunction(s, true /*front */) == GetJunction(segment, false /* front */);
+
+ if ((isOutgoing && sIsOutgoing) || (!isOutgoing && sIsIngoing))
{
- fakeEdges.emplace_back(s, edge.GetWeight());
+ // For ingoing edges we use source weight which is the same for |s| and for |edge| and is
+ // already calculated.
+ fakeEdges.emplace_back(s, isOutgoing ? CalcSegmentWeight(s) : edge.GetWeight());
}
}
}