r:trån is structured in components on different layers.
To flexibly design new conversion recipes for models, the main component provides the infrastructure to create and run transformation scripts. This is achieved via an internal Kotlin DSL that allows parameterization as well as easy assembly of new transformation blocks.
The model transformation layer is concerned with the transformation chain of a single input file containing the source model. The source model is read by the readerwriter component. In the case of OpenDRIVE, the Java classes are generated by JAXB during the build process. Since there are multiple OpenDRIVE versions, JAXB classes are generated for every OpenDRIVE version. The model component contains an implementation with functionalities of the current OpenDRIVE version. To map the generated JAXB classes to the actual OpenDRIVE implementation (in the model component) the library MapStruct is used. MapStruct generates type-safe mappers for complex data structures and provides the flexibility to adjust mapping rules when necessary. Thus, to map previous OpenDRIVE versions to the implementation of the current version, only the data model changes must be addressed by dedicated mapper rules.
The model component contains an implementation of CityGML, which is realized by citygml4j. To facilitate the generation of the B-rep representations, there is an internal and intermediate model implementation named RoadSpaces. The RoadSpaces model uses the math functionalities of the utility layer and thus provides the capability to generate explicit and area-based representations of the geometries.
The transformer component contains the transformer implementations that convert from one model to another model. Hence, there is a transformer from OpenDRIVE to RoadSpaces and another one from RoadSpaces to CityGML. Each transformer can be parameterized by a configuration class and provides an internal DSL for easy configuration. When the transformed CityGML model is available, the CityGML-ReaderWriter serializes the model using the citygml4j library.
The utility layer contains general functionalities, such as the extension of lists, the representation of results and the logging functionalities in the IO component. To keep the model transformation layer lean, supporting functionality is provided in an abstract way by the utility layer. The math component comprises the affine transformation matrices, uni- and bivariate functions as well as geometries. To decouple the geometry classes from the B-rep generation functions in the transformer component, the visitor pattern is applied.
Since the data model of OpenDRIVE is already implemented to a large extent, the functionality can be used to develop e.g. custom writers for other formats. For developing a custom writer, add its model implementation to the model component, a transformer from the RoadSpaces to the custom model and a writer to the readerwriter component.
Besides, custom model processes can be realized by implementing new transformers in the transformer component and then be composed by scripts in the main component.