Skip to content

Commit cd2792a

Browse files
improved reporting
1 parent 5f17043 commit cd2792a

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

rtron-cli/src/main/kotlin/io/rtron/cli/SubcommandOpendriveToCitygml.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ class SubcommandOpendriveToCitygml : CliktCommand(
9292
help = "Path to the output directory into which the transformed CityGML models are written",
9393
).path()
9494

95-
private val rulesApplierPath by option(
96-
help = "Path to the output directory into which the transformed CityGML models are written",
97-
).path()
95+
private val applyRulesPath by option(
96+
help = "Path to the a JSON file containing a list of rules for modifying the OpenDRIVE dataset",
97+
).path(mustExist = true)
9898

9999
private val skipRoadShapeRemoval by option(
100100
help = "Skip the removal of the road shape, if a lateral lane offset exists (not compliant to standard)",
@@ -355,7 +355,7 @@ class SubcommandOpendriveToCitygml : CliktCommand(
355355
}
356356

357357
// apply predefined rules
358-
rulesApplierPath.toOption().onSome {
358+
applyRulesPath.toOption().onSome {
359359
processStep++
360360
val opendriveApplierRules: OpendriveApplierRules = Json.decodeFromString<OpendriveApplierRules>(it.readText())
361361
val opendriveApplier = OpendriveApplier(deriveOpendriveApplierParameters())

rtron-transformer/src/main/kotlin/io/rtron/transformer/modifiers/opendrive/applier/OpendriveApplier.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,23 @@ import io.rtron.model.opendrive.additions.optics.everyRoad
2525
class OpendriveApplier(
2626
val parameters: OpendriveApplierParameters,
2727
) {
28-
// Properties and Initializers
29-
3028
// Methods
3129
fun modify(
3230
opendriveModel: OpendriveModel,
3331
rules: OpendriveApplierRules,
3432
): Pair<OpendriveModel, OpendriveApplierReport> {
3533
val report = OpendriveApplierReport(parameters)
3634

35+
report.numberOfRoads = opendriveModel.road.size
36+
3737
everyRoad.modify(opendriveModel) { currentRoad ->
3838

3939
rules.roads.getOrNone(currentRoad.id).onSome { currentRoadRule ->
40-
currentRoadRule.name.toOption().onSome { currentRoad.name = it.some() }
40+
currentRoadRule.name.toOption().onSome {
41+
currentRoad.name = it.some()
42+
report.numberOfRoadNamesChanged++
43+
report.roadNamesAdded.add(it)
44+
}
4145
}
4246

4347
currentRoad

rtron-transformer/src/main/kotlin/io/rtron/transformer/modifiers/opendrive/applier/OpendriveApplierReport.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,7 @@ import kotlinx.serialization.Serializable
2121
@Serializable
2222
data class OpendriveApplierReport(
2323
val parameters: OpendriveApplierParameters,
24+
var numberOfRoads: Int = 0,
25+
var numberOfRoadNamesChanged: Int = 0,
26+
var roadNamesAdded: HashSet<String> = hashSetOf(),
2427
)

0 commit comments

Comments
 (0)