diff --git a/capellambse_context_diagrams/__init__.py b/capellambse_context_diagrams/__init__.py index b4ea1404..555f7dda 100644 --- a/capellambse_context_diagrams/__init__.py +++ b/capellambse_context_diagrams/__init__.py @@ -277,7 +277,9 @@ def register_data_flow_view() -> None: def register_exchange_item_class_tree_view() -> None: - supported_classes: list[SupportedClass] = [ + supported_classes: list[ + tuple[type[common.GenericElement], set[DiagramType], dict[str, t.Any]] + ] = [ (oa.CommunicationMean, {DiagramType.OAB}, {}), ( fa.ComponentExchange, diff --git a/capellambse_context_diagrams/context.py b/capellambse_context_diagrams/context.py index 6ad00721..5ab87779 100644 --- a/capellambse_context_diagrams/context.py +++ b/capellambse_context_diagrams/context.py @@ -691,7 +691,7 @@ def _create_diagram(self, params: dict[str, t.Any]) -> cdiagram.Diagram: class ExchangeItemClassTreeViewDiagram(ContextDiagram): - """An automatically generated ExchangeExchangeItemClassTreeViewDiagram.""" + """An automatically generated ExchangeItemClassTreeViewDiagram.""" @property def uuid(self) -> str: # type: ignore @@ -700,7 +700,7 @@ def uuid(self) -> str: # type: ignore @property def name(self) -> str: # type: ignore - return f"Element Relation View of {self.target.name}" + return f"Exchange Item Class Tree View of {self.target.name}" def _create_diagram(self, params: dict[str, t.Any]) -> cdiagram.Diagram: data = exchange_item_class_tree_view.collector(self, params) diff --git a/docs/exchange_item_class_tree_view.md b/docs/exchange_item_class_tree_view.md new file mode 100644 index 00000000..3467084f --- /dev/null +++ b/docs/exchange_item_class_tree_view.md @@ -0,0 +1,34 @@ + + +# Exchange Item Class Tree View + +The `ExchangeItemClassTreeView` visualizes the hierarchical structure of exchange items and the relationships between their associated classes in a tree view. You can access `.exchange_item_class_tree_view` on any `fa.ComponentExchange`. Data collection starts on the allocated exchange items and collects the associated classes through their exchange item elements. + +??? example "Exchange Item Class Tree View of C 28" + + ``` py + import capellambse + + model = capellambse.MelodyModel("tests/data/ContextDiagram.aird") + diag = model.by_uuid("0ab202d7-6497-4b78-9d13-fd7c9a75486c").exchange_item_class_tree_view + diag.render("svgdiagram").save(pretty=True) + ``` +
+ +
[LAB] Exchange Item Class Tree View of C 28
+
+ +## Known Issues + +One known issue with the current implementation is related to the routing of edges for ExchangeItemElements. The edges might not be routed optimally in certain cases due to the limitations of ELK'S edge routing algorithms. + +This issue could potentially be resolved when Libavoid for ELK becomes publicly available. Libavoid is an advanced edge routing library that offers object-avoiding orthogonal and polyline connector routing, which could improve the layout of the edges in the diagram. At that point the exchange item element labels will be added to the diagram as well. + +## Check out the code + +To understand the collection have a look into the +[`exchange_item_class_tree_view`][capellambse_context_diagrams.collectors.exchange_item_class_tree_view] +module. diff --git a/docs/gen_images.py b/docs/gen_images.py index 1e699aca..2fcb18b2 100644 --- a/docs/gen_images.py +++ b/docs/gen_images.py @@ -42,6 +42,7 @@ realization_comp_uuid = "b9f9a83c-fb02-44f7-9123-9d86326de5f1" data_flow_uuid = "3b83b4ba-671a-4de8-9c07-a5c6b1d3c422" derived_uuid = "47c3130b-ec39-4365-a77a-5ab6365d1e2e" +exchange_item_class_tree_uuid = "0ab202d7-6497-4b78-9d13-fd7c9a75486c" def generate_index_images() -> None: @@ -192,6 +193,13 @@ def generate_interface_with_hide_interface_image(): print(diag.render("svg", **params), file=fd) +def generate_exchange_item_class_tree_images() -> None: + obj = model.by_uuid(exchange_item_class_tree_uuid) + diag = obj.exchange_item_class_tree_view + with mkdocs_gen_files.open(f"{str(dest / diag.name)}.svg", "w") as fd: + print(diag.render("svg", transparent_background=False), file=fd) + + generate_index_images() generate_hierarchy_image() generate_symbol_images() @@ -219,3 +227,4 @@ def generate_interface_with_hide_interface_image(): generate_derived_image() generate_interface_with_hide_functions_image() generate_interface_with_hide_interface_image() +generate_exchange_item_class_tree_images() diff --git a/tests/test_exchange_item_class_tree_views.py b/tests/test_exchange_item_class_tree_views.py index 8eec9806..314f5168 100644 --- a/tests/test_exchange_item_class_tree_views.py +++ b/tests/test_exchange_item_class_tree_views.py @@ -13,6 +13,5 @@ def test_exchange_item_class_tree_views( obj = model.by_uuid(uuid) diag = obj.exchange_item_class_tree_view - diag.render("svgdiagram").save(pretty=True) assert diag.render(fmt)