Skip to content

Commit bea728f

Browse files
committed
refactor: Lane ctor, set default for level = false as defined in OpenDrive
1 parent f08ea56 commit bea728f

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

include/Lane.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ inline std::ostream& operator<<(std::ostream& os, const LaneKey& lk)
5050

5151
struct Lane
5252
{
53-
Lane(int id, bool level, std::string type);
53+
Lane(int id, std::string type, bool level = false);
5454

5555
std::vector<SingleRoadMark> get_roadmarks(const double s_start, const double s_end) const;
5656

5757
int id;
58-
bool level = false;
59-
std::string type = "";
58+
std::string type;
59+
bool level;
6060

6161
std::optional<int> predecessor;
6262
std::optional<int> successor;

src/Lane.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ std::string LaneKey::to_string() const
1919
return fmt::format("{}/{:.17g}/{}", this->road_id, this->lanesection_s0, this->lane_id);
2020
}
2121

22-
Lane::Lane(int id, bool level, std::string type) : id(id), level(level), type(type) {}
22+
Lane::Lane(int id, std::string type, bool level) : id(id), type(type), level(level) {}
2323

2424
std::vector<SingleRoadMark> Lane::get_roadmarks(const double s_start, const double s_end) const
2525
{

src/OpenDriveMap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ OpenDriveMap::OpenDriveMap(const std::string& xodr_file,
403403

404404
Lane& lane =
405405
lanesection.id_to_lane
406-
.emplace(lane_id, Lane(lane_id, lane_node.attribute("level").as_bool(false), lane_node.attribute("type").as_string("")))
406+
.emplace(lane_id, Lane(lane_id, lane_node.attribute("type").as_string(""), lane_node.attribute("level").as_bool(false)))
407407
.first->second;
408408

409409
if (const pugi::xml_attribute id_attr = lane_node.child("link").child("predecessor").attribute("id"))

0 commit comments

Comments
 (0)