MCPcopy Create free account
hub / github.com/comaps/comaps / CalcMiddleCrossMwmWeight

Method CalcMiddleCrossMwmWeight

libs/routing/leaps_graph.cpp:127–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127RouteWeight LeapsGraph::CalcMiddleCrossMwmWeight(std::vector<Segment> const & path)
128{
129 ASSERT_GREATER(path.size(), 1, ());
130 auto & crossMwmGraph = m_starter.GetGraph().GetCrossMwmGraph();
131
132 RouteWeight res;
133 for (size_t i = 1; i < path.size() - 2; ++i)
134 {
135 auto const & from = path[i];
136 auto const & to = path[i + 1];
137 NumMwmId const fromMwm = from.GetMwmId();
138 NumMwmId const toMwm = to.GetMwmId();
139 ASSERT(fromMwm != kFakeNumMwmId && toMwm != kFakeNumMwmId, ());
140
141 if (fromMwm != toMwm)
142 res += m_hierarchyHandler.GetCrossBorderPenalty(fromMwm, toMwm);
143 else
144 res += crossMwmGraph.GetWeightSure(from, to);
145 }
146
147 return res;
148}
149
150} // namespace routing

Callers 1

Calls 5

ASSERTFunction · 0.85
sizeMethod · 0.45
GetMwmIdMethod · 0.45
GetCrossBorderPenaltyMethod · 0.45
GetWeightSureMethod · 0.45

Tested by

no test coverage detected