[traffic] Comparison operators for TrafficImpact, TraffLocation and Point

Signed-off-by: mvglasow <michael -at- vonglasow.com>
This commit is contained in:
mvglasow
2025-05-16 18:32:47 +03:00
parent a39bdee0d1
commit e2aff53291
2 changed files with 59 additions and 0 deletions

View File

@@ -159,6 +159,21 @@ bool IsoTime::operator> (IsoTime & rhs)
return t_lhs > t_rhs;
}
bool operator==(TrafficImpact const & lhs, TrafficImpact const & rhs)
{
if ((lhs.m_speedGroup == traffic::SpeedGroup::TempBlock)
&& (rhs.m_speedGroup == traffic::SpeedGroup::TempBlock))
return true;
return (lhs.m_speedGroup == rhs.m_speedGroup)
&& (lhs.m_maxspeed == rhs.m_maxspeed)
&& (lhs.m_delayMins == rhs.m_delayMins);
}
bool operator==(Point const & lhs, Point const & rhs)
{
return lhs.m_coordinates == rhs.m_coordinates;
}
openlr::LocationReferencePoint Point::ToLrp()
{
openlr::LocationReferencePoint result;
@@ -166,6 +181,15 @@ openlr::LocationReferencePoint Point::ToLrp()
return result;
}
bool operator==(TraffLocation const & lhs, TraffLocation const & rhs)
{
return (lhs.m_from == rhs.m_from)
&& (lhs.m_at == rhs.m_at)
&& (lhs.m_via == rhs.m_via)
&& (lhs.m_notVia == rhs.m_notVia)
&& (lhs.m_to == rhs.m_to);
}
openlr::LinearLocationReference TraffLocation::ToLinearLocationReference(bool backwards)
{
openlr::LinearLocationReference locationReference;