Check activation index of EntryClass and warn if activation failed
This commit is contained in:
committed by
Patrick Niklaus
parent
58b61c68a3
commit
b2ed46efb5
@@ -499,7 +499,8 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
|
||||
// the entry class depends on the turn, so we have to classify the
|
||||
// interesction for
|
||||
// every edge
|
||||
const auto turn_classification = classifyIntersection(intersection);
|
||||
const auto turn_classification = classifyIntersection(
|
||||
intersection, m_coordinates[node_at_center_of_intersection]);
|
||||
|
||||
const auto entry_class_id =
|
||||
entry_class_hash.ConcurrentFindOrAdd(turn_classification.first);
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace guidance
|
||||
{
|
||||
|
||||
std::pair<util::guidance::EntryClass, util::guidance::BearingClass>
|
||||
classifyIntersection(Intersection intersection)
|
||||
classifyIntersection(Intersection intersection, const osrm::util::Coordinate &location)
|
||||
{
|
||||
if (intersection.empty())
|
||||
return {};
|
||||
@@ -56,7 +56,12 @@ classifyIntersection(Intersection intersection)
|
||||
for (const auto &road : intersection)
|
||||
{
|
||||
if (road.entry_allowed)
|
||||
entry_class.activate(number);
|
||||
{
|
||||
if (!entry_class.activate(number))
|
||||
util::Log(logWARNING) << "Road " << number << " was not activated at "
|
||||
<< location;
|
||||
}
|
||||
|
||||
auto discrete_bearing_class =
|
||||
util::guidance::BearingClass::getDiscreteBearing(std::round(road.bearing));
|
||||
bearing_class.add(std::round(discrete_bearing_class *
|
||||
@@ -69,7 +74,11 @@ classifyIntersection(Intersection intersection)
|
||||
for (const auto &road : intersection)
|
||||
{
|
||||
if (road.entry_allowed)
|
||||
entry_class.activate(number);
|
||||
{
|
||||
if (!entry_class.activate(number))
|
||||
util::Log(logWARNING) << "Road " << number << " was not activated at "
|
||||
<< location;
|
||||
}
|
||||
bearing_class.add(std::round(road.bearing));
|
||||
++number;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <climits>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace util
|
||||
@@ -9,16 +11,19 @@ namespace util
|
||||
namespace guidance
|
||||
{
|
||||
|
||||
void EntryClass::activate(std::uint32_t index)
|
||||
bool EntryClass::activate(std::uint32_t index)
|
||||
{
|
||||
BOOST_ASSERT(index < 8 * sizeof(FlagBaseType));
|
||||
enabled_entries_flags |= (1 << index);
|
||||
if (index >= CHAR_BIT * sizeof(FlagBaseType))
|
||||
return false;
|
||||
|
||||
enabled_entries_flags |= (FlagBaseType{1} << index);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EntryClass::allowsEntry(std::uint32_t index) const
|
||||
{
|
||||
BOOST_ASSERT(index < 8 * sizeof(FlagBaseType));
|
||||
return 0 != (enabled_entries_flags & (1 << index));
|
||||
BOOST_ASSERT(index < CHAR_BIT * sizeof(FlagBaseType));
|
||||
return 0 != (enabled_entries_flags & (FlagBaseType{1} << index));
|
||||
}
|
||||
|
||||
bool EntryClass::operator==(const EntryClass &other) const
|
||||
|
||||
Reference in New Issue
Block a user