WIP: [traffic] Implement basic TraFF parsing, currently from hardcoded path

Not feature complete, produces incorrect results for some test cases
Some parts of the implementation are not very elegant yet
Inefficient as the whole set of messages is parsed on update
Lots of verbose debug logging
Lots of dead code from old traffic module (#ifdef traffic_dead_code)

Signed-off-by: mvglasow <michael -at- vonglasow.com>
This commit is contained in:
mvglasow
2025-05-06 00:04:09 +03:00
parent 16cb70a952
commit 24d65bd37f
7 changed files with 924 additions and 2 deletions

View File

@@ -462,9 +462,14 @@ bool LocationFromXml(pugi::xml_node node, TraffLocation & location)
location.m_via = OptionalPointFromXml(node.child("via"));
location.m_notVia = OptionalPointFromXml(node.child("not_via"));
if (!location.m_from && !location.m_to && !location.m_at)
int numPoints = 0;
for (std::optional<Point> point : {location.m_from, location.m_to, location.m_at})
if (point)
numPoints++;
// single-point locations are not supported, locations without points are not valid
if (numPoints < 2)
{
LOG(LWARNING, ("Neither from, to nor at point is specified, ignoring location"));
LOG(LWARNING, ("Only", numPoints, "points of from/to/at specified, ignoring location"));
return false;
}