forked from organicmaps/organicmaps
PR fix.
This commit is contained in:
parent
4ea126d0d9
commit
c3ce5330d0
4 changed files with 17 additions and 10 deletions
|
@ -186,7 +186,6 @@ void CrossMwmGraph::GetOutgoingEdgesList(BorderCross const & v,
|
|||
if (ingoingNode.m_nodeId != v.toNode.node)
|
||||
{
|
||||
LOG(LDEBUG, ("Several nodes stores in one border point.", v.toNode.point));
|
||||
vector<IngoingCrossNode> ingoingNodes;
|
||||
currentContext.ForEachIngoingNode([&ingoingNode, &v](IngoingCrossNode const & node)
|
||||
{
|
||||
if (node.m_nodeId == v.toNode.node)
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace
|
|||
{
|
||||
uint32_t constexpr kCoordBits = POINT_COORD_BITS;
|
||||
|
||||
double constexpr kMwmCrossingNodeEqualityRadiusMeters = 5.0;
|
||||
double constexpr kMwmCrossingNodeEqualityRadiusDegrees = 0.001;
|
||||
} // namespace
|
||||
|
||||
namespace routing
|
||||
|
@ -100,8 +100,10 @@ bool CrossRoutingContextReader::FindIngoingNodeByPoint(ms::LatLon const & point,
|
|||
IngoingCrossNode & node) const
|
||||
{
|
||||
bool found = false;
|
||||
m_ingoingIndex.ForEachInRect(MercatorBounds::RectByCenterXYAndSizeInMeters({point.lat, point.lon},
|
||||
kMwmCrossingNodeEqualityRadiusMeters),
|
||||
m_ingoingIndex.ForEachInRect(m2::RectD(point.lat - kMwmCrossingNodeEqualityRadiusDegrees,
|
||||
point.lon - kMwmCrossingNodeEqualityRadiusDegrees,
|
||||
point.lat + kMwmCrossingNodeEqualityRadiusDegrees,
|
||||
point.lon + kMwmCrossingNodeEqualityRadiusDegrees),
|
||||
[&found, &node](IngoingCrossNode const & nd)
|
||||
{
|
||||
node = nd;
|
||||
|
|
|
@ -93,10 +93,16 @@ public:
|
|||
OutgoingCrossNode const & outgoing) const;
|
||||
|
||||
template <class TFunctor>
|
||||
void ForEachIngoingNode(TFunctor f) const {m_ingoingIndex.ForEach(f);}
|
||||
void ForEachIngoingNode(TFunctor f) const
|
||||
{
|
||||
m_ingoingIndex.ForEach(f);
|
||||
}
|
||||
|
||||
template <class TFunctor>
|
||||
void ForEachOutgoingNode(TFunctor f) const {for_each(m_outgoingNodes.cbegin(), m_outgoingNodes.cend(), f);}
|
||||
void ForEachOutgoingNode(TFunctor f) const
|
||||
{
|
||||
for_each(m_outgoingNodes.cbegin(), m_outgoingNodes.cend(), f);
|
||||
}
|
||||
};
|
||||
|
||||
/// Helper class to generate cross context section in mwm.routing file
|
||||
|
|
|
@ -41,8 +41,8 @@ UNIT_TEST(CheckCrossSections)
|
|||
bool error = false;
|
||||
crossReader.ForEachIngoingNode([&error](IngoingCrossNode const & node)
|
||||
{
|
||||
if (node.m_point.EqualDxDy(ms::LatLon::Zero(), kPointEquality))
|
||||
error = true;
|
||||
if (node.m_point.EqualDxDy(ms::LatLon::Zero(), kPointEquality))
|
||||
error = true;
|
||||
});
|
||||
if (error)
|
||||
ingoingErrors++;
|
||||
|
@ -50,8 +50,8 @@ UNIT_TEST(CheckCrossSections)
|
|||
error = false;
|
||||
crossReader.ForEachOutgoingNode([&error](OutgoingCrossNode const & node)
|
||||
{
|
||||
if (node.m_point.EqualDxDy(ms::LatLon::Zero(), kPointEquality))
|
||||
error = true;
|
||||
if (node.m_point.EqualDxDy(ms::LatLon::Zero(), kPointEquality))
|
||||
error = true;
|
||||
});
|
||||
if (error)
|
||||
outgoingErrors++;
|
||||
|
|
Loading…
Add table
Reference in a new issue