Skip to content

Commit

Permalink
reflect comment(1)
Browse files Browse the repository at this point in the history
Signed-off-by: Mamoru Sobue <[email protected]>
  • Loading branch information
soblin committed Dec 24, 2024
1 parent 60ea165 commit efe2692
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
}
]
},
{
"id": "vm-03-01",
"validators": [
{
"name": "mapping.intersection.intersection_area_dangling_reference"
}
]
},
{
"id": "vm-03-08",
"validators": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,6 @@ IntersectionAreaDanglingReferenceValidator::check_intersection_area_dangling_ref
return id;
};

std::vector<std::pair<lanelet::ConstLanelet, lanelet::Id>> intersection_with_area_lanelets;
for (const auto & lanelet : map.laneletLayer) {
if (const auto id_opt = is_intersection_with_area(lanelet); id_opt) {
intersection_with_area_lanelets.emplace_back(lanelet, id_opt.value());
}
}

std::unordered_set<lanelet::Id> intersection_area_ids;
for (const auto & area : map.polygonLayer) {
if (
Expand All @@ -77,15 +70,18 @@ IntersectionAreaDanglingReferenceValidator::check_intersection_area_dangling_ref
}

lanelet::validation::Issues issues;
for (const auto & [lanelet, intersection_area_id] : intersection_with_area_lanelets) {
if (intersection_area_ids.find(intersection_area_id) == intersection_area_ids.end()) {
issues.emplace_back(
lanelet::validation::Severity::Error, lanelet::validation::Primitive::Lanelet, lanelet.id(),
append_issue_code_prefix(
this->name(), 1,
"Lanelet of ID " + std::to_string(lanelet.id()) +
" has dangling reference to non-existing intersection area of ID " +
std::to_string(intersection_area_id)));
for (const auto & lanelet : map.laneletLayer) {
if (const auto id_opt = is_intersection_with_area(lanelet); id_opt) {
const auto id = id_opt.value();
if (intersection_area_ids.find(id) == intersection_area_ids.end()) {
issues.emplace_back(
lanelet::validation::Severity::Error, lanelet::validation::Primitive::Lanelet,
lanelet.id(),
append_issue_code_prefix(
this->name(), 1,
"Dangling reference to non-existing intersection area of ID " + std::to_string(id) +
" is detected"));
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ TEST_F(TestIntersectionAreaDanglingReferenceError, ValidateDanglingReference) /
EXPECT_EQ(issues[0].primitive, lanelet::validation::Primitive::Lanelet);
EXPECT_EQ(
issues[0].message,
"[Intersection.IntersectionAreaDanglingReference-001] Lanelet of ID 53 has dangling "
"reference to non-existing intersection area of ID 777");
"[Intersection.IntersectionAreaDanglingReference-001] Dangling "
"reference to non-existing intersection area of ID 777 is detected");
}

TEST_F(TestIntersectionAreaDanglingReferenceOK, ValidIntersectionArea) // NOLINT for gtest
Expand Down

0 comments on commit efe2692

Please sign in to comment.