Skip to content

Commit 1c297c7

Browse files
committed
improve: minor change, use range-based for loop for better readability
1 parent cce23b6 commit 1c297c7

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/OpenDriveMap.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,12 +337,12 @@ OpenDriveMap::OpenDriveMap(const std::string& xodr_file,
337337
cubic_spline_fields.insert({".//lateralProfile//superelevation", road.superelevation});
338338

339339
/* parse elevation profiles, lane offsets, superelevation */
340-
for (auto entry : cubic_spline_fields)
340+
for (const auto& [xpath_query_str, cubic_spline] : cubic_spline_fields)
341341
{
342342
/* handle splines not starting at s=0, assume value 0 until start */
343-
entry.second.s0_to_poly[0.0] = Poly3(0.0, 0.0, 0.0, 0.0, 0.0);
343+
cubic_spline.s0_to_poly[0.0] = Poly3(0.0, 0.0, 0.0, 0.0, 0.0);
344344

345-
pugi::xpath_node_set nodes = road_node.select_nodes(entry.first.c_str());
345+
pugi::xpath_node_set nodes = road_node.select_nodes(xpath_query_str.c_str());
346346
for (pugi::xpath_node node : nodes)
347347
{
348348
double s0 = node.node().attribute("s").as_double(0.0);
@@ -352,9 +352,9 @@ OpenDriveMap::OpenDriveMap(const std::string& xodr_file,
352352
const double d = node.node().attribute("d").as_double(0.0);
353353

354354
odr::check_and_repair(
355-
s0 >= 0, [&]() { s0 = 0; }, "Road #%s: %s s %f < 0, set s=0", road_id.c_str(), entry.first.c_str(), s0);
355+
s0 >= 0, [&]() { s0 = 0; }, "Road #%s: %s s %f < 0, set s=0", road_id.c_str(), xpath_query_str.c_str(), s0);
356356

357-
entry.second.s0_to_poly[s0] = Poly3(s0, a, b, c, d);
357+
cubic_spline.s0_to_poly[s0] = Poly3(s0, a, b, c, d);
358358
}
359359
}
360360

0 commit comments

Comments
 (0)