Skip to content

Commit

Permalink
handling lane sections without lanes by road removal
Browse files Browse the repository at this point in the history
  • Loading branch information
benediktschwab committed May 14, 2024
1 parent bea2573 commit 1ab9902
Showing 1 changed file with 25 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,42 @@ object RoadLanesEvaluator {
currentRoad
}

// handle roads with lane sections containing no or multiple center lanes
everyLaneSection.modify(modifiedOpendriveModel) { currentLaneSection ->
if (currentLaneSection.center.getNumberOfLanes() != 1) {
issueList +=
DefaultIssue.of(
"LaneSectionContainsNoCenterLane",
"Lane section contains no center lane.",
currentLaneSection.additionalId, Severity.FATAL_ERROR, wasFixed = false,
"Lane section contains no or multiple center lanes. Complete road will be removed.",
currentLaneSection.additionalId, Severity.FATAL_ERROR, wasFixed = true,
)
}

currentLaneSection
}
modifiedOpendriveModel.road =
modifiedOpendriveModel.road.filter { currentRoad ->
currentRoad.lanes.laneSection.all { it.center.getNumberOfLanes() == 1 }
}

// handle roads with lane sections containing neither a left nor a right lane
everyLaneSection.modify(modifiedOpendriveModel) { currentLaneSection ->
if (currentLaneSection.getNumberOfLeftRightLanes() == 0) {
issueList +=
DefaultIssue.of(
"LaneSectionContainsNoLeftOrRightLane",
"Lane section contains neither a left nor a right lane.",
currentLaneSection.additionalId, Severity.FATAL_ERROR, wasFixed = false,
"Lane section contains neither a left nor a right lane. Complete road will be removed.",
currentLaneSection.additionalId, Severity.FATAL_ERROR, wasFixed = true,
)
}
currentLaneSection
}
modifiedOpendriveModel.road =
modifiedOpendriveModel.road.filter { currentRoad ->
currentRoad.lanes.laneSection.all { it.getNumberOfLeftRightLanes() >= 1 }
}

everyLaneSection.modify(modifiedOpendriveModel) { currentLaneSection ->

currentLaneSection.left.onSome { currentLaneSectionLeft ->
val leftLaneIds = currentLaneSectionLeft.lane.map { it.id }
Expand Down Expand Up @@ -124,26 +142,23 @@ object RoadLanesEvaluator {
everyRoadLanesLaneSectionCenterLane.modify(modifiedOpendriveModel) { currentCenterLane ->
currentCenterLane.roadMark =
filterToNonZeroLengthRoadMarks(
currentCenterLane.roadMark,
currentCenterLane.additionalId, parameters, issueList,
currentCenterLane.roadMark, currentCenterLane.additionalId, parameters, issueList,
)
currentCenterLane
}
modifiedOpendriveModel =
everyRoadLanesLaneSectionLeftLane.modify(modifiedOpendriveModel) { currentLeftLane ->
currentLeftLane.roadMark =
filterToNonZeroLengthRoadMarks(
currentLeftLane.roadMark, currentLeftLane.additionalId,
parameters, issueList,
currentLeftLane.roadMark, currentLeftLane.additionalId, parameters, issueList,
)
currentLeftLane
}
modifiedOpendriveModel =
everyRoadLanesLaneSectionRightLane.modify(modifiedOpendriveModel) { currentRightLane ->
currentRightLane.roadMark =
filterToNonZeroLengthRoadMarks(
currentRightLane.roadMark, currentRightLane.additionalId,
parameters, issueList,
currentRightLane.roadMark, currentRightLane.additionalId, parameters, issueList,
)
currentRightLane
}
Expand Down

0 comments on commit 1ab9902

Please sign in to comment.