Skip to content

Commit 24aebd1

Browse files
enabled junction mapping
1 parent 8935aad commit 24aebd1

File tree

5 files changed

+24
-11
lines changed

5 files changed

+24
-11
lines changed

rtron-model/src/main/kotlin/io/rtron/model/opendrive/junction/Junction.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@ import io.rtron.model.opendrive.additions.identifier.AdditionalJunctionIdentifie
2626
import io.rtron.model.opendrive.additions.identifier.JunctionIdentifier
2727
import io.rtron.model.opendrive.core.OpendriveElement
2828
import io.rtron.model.opendrive.objects.EOrientation
29+
import io.rtron.model.opendrive.road.RoadSurface
2930

3031
@optics
3132
data class Junction(
3233
var connection: List<JunctionConnection> = emptyList(),
3334
var priority: List<JunctionPriority> = emptyList(),
3435
var controller: List<JunctionController> = emptyList(),
35-
var surface: Option<JunctionSurface> = None,
36+
var surface: Option<RoadSurface> = None,
3637
var id: String = "",
3738
var mainRoad: Option<String> = None,
3839
var name: Option<String> = None,

rtron-readerwriter/src/main/kotlin/io/rtron/readerwriter/opendrive/reader/mapper/opendrive16/Opendrive16JunctionMapper.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import io.rtron.model.opendrive.junction.EContactPoint
2525
import io.rtron.model.opendrive.junction.EElementDir
2626
import io.rtron.model.opendrive.junction.EJunctionType
2727
import io.rtron.model.opendrive.junction.JunctionPredecessorSuccessor
28-
import io.rtron.model.opendrive.junction.JunctionSurface
28+
import io.rtron.model.opendrive.road.RoadSurface
2929
import io.rtron.readerwriter.opendrive.reader.mapper.common.OpendriveCommonMapper
3030
import io.rtron.readerwriter.opendrive.reader.mapper.common.toUpperCaseVariations
3131
import org.asam.opendrive16.E_Junction_Type
@@ -42,10 +42,9 @@ import org.mapstruct.NullValueCheckStrategy
4242
abstract class Opendrive16JunctionMapper {
4343
private val logger = KotlinLogging.logger {}
4444

45-
fun mapJunctionSurfaceToOption(source: T_Junction_Surface?): Option<JunctionSurface> =
46-
source?.let { mapJunctionSurface(it).some() } ?: None
45+
fun mapJunctionSurfaceToOption(source: T_Junction_Surface?): Option<RoadSurface> = source?.let { mapJunctionSurface(it).some() } ?: None
4746

48-
abstract fun mapJunctionSurface(source: T_Junction_Surface): JunctionSurface
47+
abstract fun mapJunctionSurface(source: T_Junction_Surface): RoadSurface
4948

5049
fun mapJunctionPredecessorSuccessorToOption(source: T_Junction_PredecessorSuccessor?): Option<JunctionPredecessorSuccessor> =
5150
source?.let { mapJunctionPredecessorSuccessor(it).some() } ?: None

rtron-readerwriter/src/main/kotlin/io/rtron/readerwriter/opendrive/reader/mapper/opendrive18/Opendrive18JunctionMapper.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ import io.github.oshai.kotlinlogging.KotlinLogging
2323
import io.rtron.model.opendrive.junction.EContactPoint
2424
import io.rtron.model.opendrive.junction.EElementDir
2525
import io.rtron.model.opendrive.junction.EJunctionType
26+
import io.rtron.model.opendrive.junction.JunctionConnection
2627
import io.rtron.model.opendrive.junction.JunctionPredecessorSuccessor
2728
import io.rtron.readerwriter.opendrive.reader.mapper.common.OpendriveCommonMapper
2829
import io.rtron.readerwriter.opendrive.reader.mapper.common.toUpperCaseVariations
2930
import org.asam.opendrive18.E_Junction_Type
31+
import org.asam.opendrive18.T_Junction_Connection_Direct
3032
import org.asam.opendrive18.T_Junction_PredecessorSuccessor
3133
import org.mapstruct.Mapper
3234
import org.mapstruct.NullValueCheckStrategy
@@ -44,6 +46,11 @@ abstract class Opendrive18JunctionMapper {
4446

4547
abstract fun mapJunctionPredecessorSuccessor(source: T_Junction_PredecessorSuccessor): JunctionPredecessorSuccessor
4648

49+
//
50+
// Connection
51+
//
52+
abstract fun mapJunctionConnection(source: T_Junction_Connection_Direct): JunctionConnection
53+
4754
//
4855
// Enumerations
4956
//

rtron-readerwriter/src/main/resources/schemas/opendrive18/OpenDRIVE_Core.xsd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ See www.asam.net/license.html for further details.
2929
<xs:alternative test="@type='crossing'" type="t_junction_crossing"/>
3030
<xs:alternative type="t_junction_common"/>
3131
</xs:element>-->
32+
<!-- TODO: generalize: for non-common junction types-->
33+
<xs:element maxOccurs="unbounded" minOccurs="0" name="junction" type="t_junction_common"/>
34+
3235
<xs:element maxOccurs="unbounded" minOccurs="0" name="junctionGroup" type="t_junctionGroup"/>
3336
<xs:element maxOccurs="unbounded" minOccurs="0" name="station" type="t_station"/>
3437
<xs:group maxOccurs="unbounded" minOccurs="0" ref="g_additionalData"/>

rtron-readerwriter/src/main/resources/schemas/opendrive18/OpenDRIVE_Junction.xsd

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,11 @@ See www.asam.net/license.html for further details.
145145
<xs:complexContent>
146146
<xs:extension base="_OpenDriveElement">
147147
<xs:sequence>
148+
<!-- TODO: enable
148149
<xs:element maxOccurs="unbounded" minOccurs="1" name="segment" type="t_junction_boundary_segment">
149-
<!--<xs:alternative test="@type='lane'" type="t_junction_boundary_segment_lane"/>
150-
<xs:alternative test="@type='joint'" type="t_junction_boundary_segment_joint"/>-->
151-
</xs:element>
150+
<xs:alternative test="@type='lane'" type="t_junction_boundary_segment_lane"/>
151+
<xs:alternative test="@type='joint'" type="t_junction_boundary_segment_joint"/>
152+
</xs:element>-->
152153
<xs:group maxOccurs="unbounded" minOccurs="0" ref="g_additionalData"/>
153154
</xs:sequence>
154155
</xs:extension>
@@ -649,10 +650,12 @@ See www.asam.net/license.html for further details.
649650
<xs:complexContent>
650651
<xs:extension base="t_junction">
651652
<xs:sequence>
653+
<!-- TODO: enable
652654
<xs:element maxOccurs="unbounded" minOccurs="0" name="connection" type="t_junction_connection">
653-
<!--<xs:alternative test="@type='virtual'" type="t_junction_connection_virtual"/>
654-
<xs:alternative type="t_junction_connection_virtual_default"/>-->
655-
</xs:element>
655+
<xs:alternative test="@type='virtual'" type="t_junction_connection_virtual"/>
656+
<xs:alternative type="t_junction_connection_virtual_default"/>
657+
</xs:element>-->
658+
<xs:element maxOccurs="unbounded" minOccurs="0" name="connection" type="t_junction_connection" />
656659
<xs:element maxOccurs="unbounded" minOccurs="0" name="crossPath" type="t_junction_crossPath"/>
657660
<xs:element maxOccurs="unbounded" minOccurs="0" name="priority" type="t_junction_priority"/>
658661
<xs:element maxOccurs="unbounded" minOccurs="0" name="controller" type="t_junction_controller"/>

0 commit comments

Comments
 (0)