diff --git a/rtron-model/src/main/kotlin/io/rtron/model/opendrive/additions/optics/Optics.kt b/rtron-model/src/main/kotlin/io/rtron/model/opendrive/additions/optics/Optics.kt index 4fcfaa6..ba90765 100644 --- a/rtron-model/src/main/kotlin/io/rtron/model/opendrive/additions/optics/Optics.kt +++ b/rtron-model/src/main/kotlin/io/rtron/model/opendrive/additions/optics/Optics.kt @@ -20,6 +20,7 @@ import arrow.optics.PPrism import arrow.optics.Traversal import io.rtron.model.opendrive.OpendriveModel import io.rtron.model.opendrive.core.Header +import io.rtron.model.opendrive.core.geoReference import io.rtron.model.opendrive.core.offset import io.rtron.model.opendrive.header import io.rtron.model.opendrive.junction @@ -57,6 +58,7 @@ import io.rtron.model.opendrive.signal.RoadSignals import io.rtron.model.opendrive.signal.signal val everyHeaderOffset = OpendriveModel.header compose Header.offset compose PPrism.some() +val everyHeaderGeoReference = OpendriveModel.header compose Header.geoReference compose PPrism.some() // road val everyRoad = OpendriveModel.road compose Traversal.list() diff --git a/rtron-transformer/src/main/kotlin/io/rtron/transformer/evaluator/opendrive/plans/basicdatatype/CoreEvaluator.kt b/rtron-transformer/src/main/kotlin/io/rtron/transformer/evaluator/opendrive/plans/basicdatatype/CoreEvaluator.kt index e7005ae..8847e7d 100644 --- a/rtron-transformer/src/main/kotlin/io/rtron/transformer/evaluator/opendrive/plans/basicdatatype/CoreEvaluator.kt +++ b/rtron-transformer/src/main/kotlin/io/rtron/transformer/evaluator/opendrive/plans/basicdatatype/CoreEvaluator.kt @@ -20,6 +20,7 @@ import io.rtron.io.issues.DefaultIssue import io.rtron.io.issues.DefaultIssueList import io.rtron.io.issues.Severity import io.rtron.model.opendrive.OpendriveModel +import io.rtron.model.opendrive.additions.optics.everyHeaderGeoReference import io.rtron.model.opendrive.additions.optics.everyHeaderOffset import io.rtron.model.opendrive.header import io.rtron.transformer.evaluator.opendrive.OpendriveEvaluatorParameters @@ -126,6 +127,24 @@ object CoreEvaluator { currentHeaderOffset } + modifiedOpendriveModel = + everyHeaderGeoReference.modify(modifiedOpendriveModel) { currentHeaderGeoReference -> + + val contentTrimmed = currentHeaderGeoReference.content.trim() + if (currentHeaderGeoReference.content.length > contentTrimmed.length) { + issueList += + DefaultIssue( + "GeoReferenceContainsLeadingAndTrailingWhitespace", + "GeoReference element contains leading and trailing whitespace.", + "GeoReference of header element", + Severity.WARNING, wasFixed = true, + ) + currentHeaderGeoReference.content = currentHeaderGeoReference.content.trim() + } + + currentHeaderGeoReference + } + return modifiedOpendriveModel } } diff --git a/rtron-transformer/src/main/kotlin/io/rtron/transformer/evaluator/opendrive/plans/modelingrules/RoadObjectsEvaluator.kt b/rtron-transformer/src/main/kotlin/io/rtron/transformer/evaluator/opendrive/plans/modelingrules/RoadObjectsEvaluator.kt index d1f33c3..3fb2c71 100644 --- a/rtron-transformer/src/main/kotlin/io/rtron/transformer/evaluator/opendrive/plans/modelingrules/RoadObjectsEvaluator.kt +++ b/rtron-transformer/src/main/kotlin/io/rtron/transformer/evaluator/opendrive/plans/modelingrules/RoadObjectsEvaluator.kt @@ -53,6 +53,23 @@ object RoadObjectsEvaluator { ) } currentRoadObjects.roadObject = roadObjectsFiltered + + val roadObjectsFilteredRepeat = + currentRoadObjects.roadObject.filter { currentRoadObject -> + currentRoadObject.repeat.isEmpty() || + currentRoadObject.repeat.all { it.s + it.length <= currentRoad.length + parameters.numberTolerance } + } + if (currentRoadObjects.roadObject.size > roadObjectsFilteredRepeat.size) { + issueList += + DefaultIssue.of( + "RoadObjectRepeatPositionNotInSValueRange", + "Road object repeats (number of objects affected: ${currentRoadObjects.roadObject.size - + roadObjectsFiltered.size}) were removed since they were positioned outside the " + + "defined length of the road.", + currentRoad.additionalId, Severity.ERROR, wasFixed = true, + ) + } + currentRoadObjects.roadObject = roadObjectsFilteredRepeat } currentRoad