diff --git a/capellambse_context_diagrams/__init__.py b/capellambse_context_diagrams/__init__.py index 555f7dda..f10b92cb 100644 --- a/capellambse_context_diagrams/__init__.py +++ b/capellambse_context_diagrams/__init__.py @@ -66,7 +66,7 @@ def init() -> None: register_tree_view() register_realization_view() register_data_flow_view() - register_exchange_item_class_tree_view() + register_exchange_item_relation_view() # register_functional_context() XXX: Future @@ -275,7 +275,7 @@ def register_data_flow_view() -> None: common.set_accessor(class_, "data_flow_view", accessor) -def register_exchange_item_class_tree_view() -> None: +def register_exchange_item_relation_view() -> None: supported_classes: list[ tuple[type[common.GenericElement], set[DiagramType], dict[str, t.Any]] @@ -292,15 +292,15 @@ def register_exchange_item_class_tree_view() -> None: for _class, _diagclasses, render_params in supported_classes: common.set_accessor( _class, - "exchange_item_class_tree_view", - context.ExchangeItemClassTreeAccessor( - "ExchangeItemClassTreeView Diagram", render_params + "exchange_item_relation_view", + context.ExchangeItemRelationAccessor( + "ExchangeItemRelationView Diagram", render_params ), ) for dgcls in _diagclasses: styles.update(capstyle.STYLES.get(dgcls.value, {})) - capstyle.STYLES["ExchangeItemClassTreeView Diagram"] = styles - capstyle.STYLES["ExchangeItemClassTreeView Diagram"].update( + capstyle.STYLES["ExchangeItemRelationView Diagram"] = styles + capstyle.STYLES["ExchangeItemRelationView Diagram"].update( capstyle.STYLES["Class Diagram Blank"] ) diff --git a/capellambse_context_diagrams/collectors/exchange_item_class_tree_view.py b/capellambse_context_diagrams/collectors/exchange_item_relation_view.py similarity index 96% rename from capellambse_context_diagrams/collectors/exchange_item_class_tree_view.py rename to capellambse_context_diagrams/collectors/exchange_item_relation_view.py index dfbedc6c..44e60205 100644 --- a/capellambse_context_diagrams/collectors/exchange_item_class_tree_view.py +++ b/capellambse_context_diagrams/collectors/exchange_item_relation_view.py @@ -40,10 +40,10 @@ } -class ExchangeItemClassTreeCollector: +class ExchangeItemRelationCollector: def __init__( self, - diagram: context.ExchangeItemClassTreeViewDiagram, + diagram: context.ExchangeItemRelationViewDiagram, *, params: dict[str, t.Any] | None = None, ) -> None: @@ -172,7 +172,7 @@ def _make_class_box(self, cls: information.Class) -> _elkjs.ELKInputChild: def collector( - diagram: context.ExchangeItemClassTreeViewDiagram, params: dict[str, t.Any] + diagram: context.ExchangeItemRelationViewDiagram, params: dict[str, t.Any] ) -> _elkjs.ELKInputData: """Return ExchangeElement data for ELK.""" - return ExchangeItemClassTreeCollector(diagram, params=params)() + return ExchangeItemRelationCollector(diagram, params=params)() diff --git a/capellambse_context_diagrams/context.py b/capellambse_context_diagrams/context.py index 5ab87779..4e308481 100644 --- a/capellambse_context_diagrams/context.py +++ b/capellambse_context_diagrams/context.py @@ -19,7 +19,7 @@ from . import _elkjs, filters, serializers, styling from .collectors import ( dataflow_view, - exchange_item_class_tree_view, + exchange_item_relation_view, exchanges, get_elkdata, realization_view, @@ -189,18 +189,18 @@ def __get__( # type: ignore return self._get(obj, DataFlowViewDiagram) -class ExchangeItemClassTreeAccessor(ContextAccessor): +class ExchangeItemRelationAccessor(ContextAccessor): def __get__( # type: ignore self, obj: common.T | None, objtype: type | None = None, ) -> common.Accessor | ContextDiagram: - """Make a ExchangeItemClassTreeViewDiagram for the given model object.""" + """Make a ExchangeItemRelationViewDiagram for the given model object.""" del objtype if obj is None: # pragma: no cover return self assert isinstance(obj, common.GenericElement) - return self._get(obj, ExchangeItemClassTreeViewDiagram) + return self._get(obj, ExchangeItemRelationViewDiagram) class ContextDiagram(diagram.AbstractDiagram): @@ -690,20 +690,20 @@ def _create_diagram(self, params: dict[str, t.Any]) -> cdiagram.Diagram: return super()._create_diagram(params) -class ExchangeItemClassTreeViewDiagram(ContextDiagram): - """An automatically generated ExchangeItemClassTreeViewDiagram.""" +class ExchangeItemRelationViewDiagram(ContextDiagram): + """An automatically generated ExchangeItemRelationViewDiagram.""" @property def uuid(self) -> str: # type: ignore """Returns the UUID of the diagram.""" - return f"{self.target.uuid}_exchange_item_class_tree_view" + return f"{self.target.uuid}_exchange_item_relation_view" @property def name(self) -> str: # type: ignore - return f"Exchange Item Class Tree View of {self.target.name}" + return f"Exchange Item Relation 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) + data = exchange_item_relation_view.collector(self, params) layout = try_to_layout(data) return self.serializer.make_diagram( layout, diff --git a/docs/exchange_item_class_tree_view.md b/docs/exchange_item_relation_view.md similarity index 59% rename from docs/exchange_item_class_tree_view.md rename to docs/exchange_item_relation_view.md index 3467084f..3e08ce6d 100644 --- a/docs/exchange_item_class_tree_view.md +++ b/docs/exchange_item_relation_view.md @@ -3,22 +3,22 @@ ~ SPDX-License-Identifier: Apache-2.0 --> -# Exchange Item Class Tree View +# Exchange Item Relation 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. +The `ExchangeItemRelationView` visualizes the hierarchical structure of exchange items and the relationships between their associated classes in a tree view. You can access `.exchange_item_relation_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" +??? example "Exchange Item Relation 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 = model.by_uuid("0ab202d7-6497-4b78-9d13-fd7c9a75486c").exchange_item_relation_view diag.render("svgdiagram").save(pretty=True) ```
- -
[LAB] Exchange Item Class Tree View of C 28
+ +
[LAB] Exchange Item Relation View of C 28
## Known Issues @@ -30,5 +30,5 @@ This issue could potentially be resolved when Libavoid for ELK becomes publicly ## 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] +[`exchange_item_relation_view`][capellambse_context_diagrams.collectors.exchange_item_relation_view] module. diff --git a/docs/gen_images.py b/docs/gen_images.py index 2fcb18b2..7047ecfe 100644 --- a/docs/gen_images.py +++ b/docs/gen_images.py @@ -195,7 +195,7 @@ def generate_interface_with_hide_interface_image(): def generate_exchange_item_class_tree_images() -> None: obj = model.by_uuid(exchange_item_class_tree_uuid) - diag = obj.exchange_item_class_tree_view + diag = obj.exchange_item_relation_view with mkdocs_gen_files.open(f"{str(dest / diag.name)}.svg", "w") as fd: print(diag.render("svg", transparent_background=False), file=fd) diff --git a/mkdocs.yml b/mkdocs.yml index 4d812f7c..c38b8f48 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -94,8 +94,8 @@ nav: - Overview: realization_view.md - DataFlow View: - Overview: data_flow_view.md - - Exchange Item Class Tree View: - - Overview: exchange_item_class_tree_view.md + - Exchange Item Relation View: + - Overview: exchange_item_relation_view.md - Extras: - Filters: extras/filters.md - Styling: extras/styling.md diff --git a/tests/test_exchange_item_class_tree_views.py b/tests/test_exchange_item_relation_views.py similarity index 83% rename from tests/test_exchange_item_class_tree_views.py rename to tests/test_exchange_item_relation_views.py index 314f5168..daf602a8 100644 --- a/tests/test_exchange_item_class_tree_views.py +++ b/tests/test_exchange_item_relation_views.py @@ -7,11 +7,11 @@ @pytest.mark.parametrize("uuid", ["0ab202d7-6497-4b78-9d13-fd7c9a75486c"]) @pytest.mark.parametrize("fmt", ["svgdiagram", "svg", None]) -def test_exchange_item_class_tree_views( +def test_exchange_item_relation_views( model: capellambse.MelodyModel, uuid: str, fmt: str ) -> None: obj = model.by_uuid(uuid) - diag = obj.exchange_item_class_tree_view + diag = obj.exchange_item_relation_view assert diag.render(fmt)