diff --git a/map/traffic_manager.cpp b/map/traffic_manager.cpp index 15dac614f..4495468fe 100644 --- a/map/traffic_manager.cpp +++ b/map/traffic_manager.cpp @@ -440,6 +440,7 @@ void TrafficManager::DecodeMessage(openlr::OpenLRDecoder & decoder, { LOG(LINFO, (" Path", i)); LOG(LINFO, (" Partner segment ID:", paths[i].m_segmentId)); + LOG(LINFO, (" Message ID:", paths[i].m_messageId)); LOG(LINFO, (" Edges:", paths[i].m_path.size())); for (size_t j = 0; j < paths[i].m_path.size(); j++) { diff --git a/openlr/decoded_path.hpp b/openlr/decoded_path.hpp index fe4923768..fdfc9a289 100644 --- a/openlr/decoded_path.hpp +++ b/openlr/decoded_path.hpp @@ -28,6 +28,7 @@ DECLARE_EXCEPTION(DecodedPathSaveError, RootException); struct DecodedPath { PartnerSegmentId m_segmentId; + std::string m_messageId; Path m_path; }; diff --git a/openlr/openlr_decoder.cpp b/openlr/openlr_decoder.cpp index 65dcd59ac..7a9df268d 100644 --- a/openlr/openlr_decoder.cpp +++ b/openlr/openlr_decoder.cpp @@ -234,6 +234,7 @@ public: m_graph.ResetFakes(); path.m_segmentId.Set(segment.m_segmentId); + path.m_messageId = segment.m_messageId; auto const & points = segment.GetLRPs(); CHECK_GREATER(points.size(), 1, ("A segment cannot consist of less than two points")); @@ -322,6 +323,7 @@ public: uint32_t constexpr kMaxProjectionCandidates = 5; path.m_segmentId.Set(segment.m_segmentId); + path.m_messageId = segment.m_messageId; auto const & points = segment.GetLRPs(); CHECK_GREATER(points.size(), 1, ("A segment cannot consist of less than two points")); diff --git a/openlr/openlr_model.hpp b/openlr/openlr_model.hpp index eb0d0cc4a..8acf7167e 100644 --- a/openlr/openlr_model.hpp +++ b/openlr/openlr_model.hpp @@ -151,6 +151,7 @@ struct LinearSegment LinearSegmentSource m_source = LinearSegmentSource::NotValid; // TODO(mgsergio): Think of using openlr::PartnerSegmentId uint32_t m_segmentId = kInvalidSegmentId; + std::string m_messageId = ""; // TODO(mgsergio): Make sure that one segment cannot contain // more than one location reference. LinearLocationReference m_locationReference; diff --git a/traffxml/traff_model.cpp b/traffxml/traff_model.cpp index 3ece1a95f..f6e4715b9 100644 --- a/traffxml/traff_model.cpp +++ b/traffxml/traff_model.cpp @@ -127,8 +127,14 @@ std::vector TraffLocation::ToOpenLrSegments(std::string & for (int dir = 0; dir < dirs; dir++) { openlr::LinearSegment segment; - // TODO make this a reference to the TraFF message ID - segment.m_segmentId = 42; + /* + * Segment IDs are used internally by the decoder but nowhere else. + * Since we decode TraFF locations one at a time, there are at most two segments in a single + * decoder instance (one segment per direction). Therefore, a segment ID derived from the + * direction is unique within the decoder instance. + */ + segment.m_segmentId = dir; + segment.m_messageId = messageId; /* * Segments generated from coordinates can have any number of points. Each point, except for * the last point, must indicate the distance to the next point. Line properties (functional