DSD-DBS / py-capellambse

A Python 3 headless implementation of the Capella modeling tool.
https://dsd-dbs.github.io/py-capellambse/
Apache License 2.0
50 stars 8 forks source link

Rework model.Diagram to use the DRepresentationDescriptor XML elements #390

Closed Wuestengecko closed 3 months ago

Wuestengecko commented 3 months ago

Use the DRepresentationDescriptor objects as primary interface to diagrams. While this does add a layer of indirection, it also solves a few issues around diagrams, allowing them to be more smoothly integrated into the model.

model.diagram.Diagram now uses an etree._Element as its _element. This allows it to be decorated as @xtype_handler, which enables ElementList and model.by_uuid() to recognize them.

Due to the representation descriptors being placed in AIRD files, which are considered not relevant for the most part, the model.search() method has been extended to specifically ask the aird module for representation descriptors if they're in the set of requested xtypes.

Note that this also changes the uuid reported by Diagram objects to the one on the DRepresentationDescriptor instead of the DSemanticDiagram (or similar). This matches what the Capella GUI and Java API reports, thus making interoperability easier and solving #388. However, this also means that existing diagram caches are incompatible with the new version of capellambse.