[traffic] Ignore access flags when decoding closure events

Fixes decoding of closures which are mapped in OSM as access restrictions

Signed-off-by: mvglasow <michael -at- vonglasow.com>
This commit is contained in:
mvglasow
2025-11-13 21:16:45 +02:00
parent 9d4801886e
commit d4c002851b
4 changed files with 45 additions and 6 deletions

View File

@@ -252,12 +252,12 @@ void TraffDecoder::DecodeMessage(traffxml::TraffMessage & message)
if (!message.m_location)
return;
// Decode events into consolidated traffic impact
std::optional<traffxml::TrafficImpact> impact = message.GetTrafficImpact();
m_trafficImpact = message.GetTrafficImpact();
LOG(LINFO, (" Impact: ", impact));
LOG(LINFO, (" Impact: ", m_trafficImpact));
// Skip further processing if there is no impact
if (!impact)
if (!m_trafficImpact)
return;
traffxml::MultiMwmColoring decoded;
@@ -278,7 +278,7 @@ void TraffDecoder::DecodeMessage(traffxml::TraffMessage & message)
LOG(LINFO, (" Location for message", message.m_id, "can be reused from cache"));
std::optional<traffxml::TrafficImpact> cachedImpact = it->second.GetTrafficImpact();
if (cachedImpact.has_value() && cachedImpact.value() == impact.value())
if (cachedImpact.has_value() && cachedImpact.value() == m_trafficImpact.value())
{
LOG(LINFO, (" Impact for message", message.m_id, "unchanged, reusing cached coloring"));
@@ -300,10 +300,11 @@ void TraffDecoder::DecodeMessage(traffxml::TraffMessage & message)
if (!isDecoded)
DecodeLocation(message, decoded);
if (impact)
if (m_trafficImpact)
{
ApplyTrafficImpact(impact.value(), decoded);
ApplyTrafficImpact(m_trafficImpact.value(), decoded);
std::swap(message.m_decoded, decoded);
m_trafficImpact = std::nullopt;
}
}
@@ -693,6 +694,12 @@ double RoutingTraffDecoder::TraffEstimator::CalcSegmentWeight(routing::Segment c
return result;
}
bool RoutingTraffDecoder::TraffEstimator::IsAccessIgnored()
{
ASSERT(m_decoder.m_trafficImpact, ("Traffic impact for current message is not set"));
return (m_decoder.m_trafficImpact.value().m_speedGroup == traffic::SpeedGroup::TempBlock);
}
RoutingTraffDecoder::DecoderRouter::DecoderRouter(CountryParentNameGetterFn const & countryParentNameGetterFn,
routing::TCountryFileFn const & countryFileFn,
routing::CountryRectFn const & countryRectFn,