Skip to content

Commit

Permalink
added predecessor and successors for bidirectional lanes resolves #37
Browse files Browse the repository at this point in the history
  • Loading branch information
benediktschwab committed Sep 19, 2023
1 parent b334d88 commit 60d7e64
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import io.rtron.model.roadspaces.RoadspacesModel
import io.rtron.model.roadspaces.identifier.opposite
import io.rtron.model.roadspaces.roadspace.road.Lane
import io.rtron.model.roadspaces.roadspace.road.LaneChange
import io.rtron.model.roadspaces.roadspace.road.LaneType
import io.rtron.std.getValueEither
import io.rtron.transformer.converter.roadspaces2citygml.module.RelationAdder
import io.rtron.transformer.converter.roadspaces2citygml.report.Roadspaces2CitygmlReport
Expand Down Expand Up @@ -209,7 +210,10 @@ class Roadspaces2CitygmlTransformer(

// predecessor
val predecessorLaneIds =
if (currentLane.id.isForward()) {
if (currentLane.type == LaneType.BIDIRECTIONAL) {
roadspacesModel.getPredecessorLaneIdentifiers(currentLane.id).getOrElse { throw it } +
roadspacesModel.getSuccessorLaneIdentifiers(currentLane.id).getOrElse { throw it }
} else if (currentLane.id.isForward()) {
roadspacesModel.getPredecessorLaneIdentifiers(currentLane.id).getOrElse { throw it }
} else {
roadspacesModel.getSuccessorLaneIdentifiers(currentLane.id).getOrElse { throw it }
Expand All @@ -225,7 +229,10 @@ class Roadspaces2CitygmlTransformer(

// successor
val successorLaneIds =
if (currentLane.id.isForward()) {
if (currentLane.type == LaneType.BIDIRECTIONAL) {
roadspacesModel.getSuccessorLaneIdentifiers(currentLane.id).getOrElse { throw it } +
roadspacesModel.getPredecessorLaneIdentifiers(currentLane.id).getOrElse { throw it }
} else if (currentLane.id.isForward()) {
roadspacesModel.getSuccessorLaneIdentifiers(currentLane.id).getOrElse { throw it }
} else {
roadspacesModel.getPredecessorLaneIdentifiers(currentLane.id).getOrElse { throw it }
Expand Down

0 comments on commit 60d7e64

Please sign in to comment.