Skip to content

Commit

Permalink
fix #39
Browse files Browse the repository at this point in the history
  • Loading branch information
benediktschwab committed Jul 22, 2024
1 parent a281e4d commit 7de834d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ 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 @@ -220,10 +219,7 @@ class Roadspaces2CitygmlTransformer(

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

// successor
val successorLaneIds =
if (currentLane.type == LaneType.BIDIRECTIONAL) {
roadspacesModel.getSuccessorLaneIdentifiers(currentLane.id).getOrElse { throw it } +
roadspacesModel.getPredecessorLaneIdentifiers(currentLane.id).getOrElse { throw it }
} else if (currentLane.id.isForward()) {
if (currentLane.id.isForward()) {
roadspacesModel.getSuccessorLaneIdentifiers(currentLane.id).getOrElse { throw it }
} else {
roadspacesModel.getPredecessorLaneIdentifiers(currentLane.id).getOrElse { throw it }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import io.rtron.model.roadspaces.identifier.AbstractRoadspacesIdentifier
import io.rtron.model.roadspaces.identifier.LaneIdentifier
import io.rtron.model.roadspaces.roadspace.objects.RoadspaceObject
import io.rtron.model.roadspaces.roadspace.road.Lane
import io.rtron.model.roadspaces.roadspace.road.LaneType
import io.rtron.model.roadspaces.roadspace.road.RoadMarking
import io.rtron.transformer.converter.roadspaces2citygml.Roadspaces2CitygmlParameters
import io.rtron.transformer.converter.roadspaces2citygml.geometry.GeometryTransformer
Expand Down Expand Up @@ -112,7 +113,12 @@ class TransportationModuleBuilder(
relatedObjects.forEach { relationAdder.addRelatedToRelation(it, trafficSpaceFeature) }
// TODO: consider left-hand traffic (LHT)
trafficSpaceFeature.trafficDirection =
if (lane.id.isForward()) TrafficDirectionValue.FORWARDS else TrafficDirectionValue.BACKWARDS
when {
lane.type == LaneType.BIDIRECTIONAL -> TrafficDirectionValue.BOTH
lane.id.isForward() -> TrafficDirectionValue.FORWARDS
else -> TrafficDirectionValue.BACKWARDS
}

// geometry
val centerLineGeometryTransformer = GeometryTransformer(parameters).also { centerLine.accept(it) }
trafficSpaceFeature.populateLod2Geometry(centerLineGeometryTransformer)
Expand Down

0 comments on commit 7de834d

Please sign in to comment.