diff --git a/docs/data_flow_view.md b/docs/data_flow_view.md index fa101353..9c9127e2 100644 --- a/docs/data_flow_view.md +++ b/docs/data_flow_view.md @@ -24,7 +24,7 @@ The diagram elements are collected from the diag.as_svgdiagram.save(pretty=True) ```
- +
[OAIB] DataFlow View Diagram of Eat food
diff --git a/docs/gen_images.py b/docs/gen_images.py index c09bfe8a..6a61734a 100644 --- a/docs/gen_images.py +++ b/docs/gen_images.py @@ -5,6 +5,7 @@ import logging import pathlib +import typing as t import mkdocs_gen_files from capellambse import MelodyModel, diagram @@ -16,19 +17,23 @@ dest = pathlib.Path("assets") / "images" model_path = pathlib.Path(__file__).parent.parent / "tests" / "data" model = MelodyModel(path=model_path, entrypoint="ContextDiagram.aird") -general_context_diagram_uuids = { - "Environment": "e37510b9-3166-4f80-a919-dfaac9b696c7", - "Eat": "8bcb11e6-443b-4b92-bec2-ff1d87a224e7", - "Middle": "da08ddb6-92ba-4c3b-956a-017424dbfe85", - "Capability": "9390b7d5-598a-42db-bef8-23677e45ba06", - "Lost": "a5642060-c9cc-4d49-af09-defaa3024bae", - "Left": "f632888e-51bc-4c9f-8e81-73e9404de784", - "educate Wizards": "957c5799-1d4a-4ac0-b5de-33a65bf1519c", - "Weird guy": "098810d9-0325-4ae8-a111-82202c0d2016", - "Top secret": "5bf3f1e3-0f5e-4fec-81d5-c113d3a1b3a6", +general_context_diagram_uuids: dict[str, tuple[str, dict[str, t.Any]]] = { + "Environment": ("e37510b9-3166-4f80-a919-dfaac9b696c7", {}), + "Eat": ("8bcb11e6-443b-4b92-bec2-ff1d87a224e7", {}), + "Middle": ("da08ddb6-92ba-4c3b-956a-017424dbfe85", {}), + "Capability": ("9390b7d5-598a-42db-bef8-23677e45ba06", {}), + "Lost": ("a5642060-c9cc-4d49-af09-defaa3024bae", {}), + "Left": ("f632888e-51bc-4c9f-8e81-73e9404de784", {}), + "educate Wizards": ("957c5799-1d4a-4ac0-b5de-33a65bf1519c", {}), + "Weird guy": ("098810d9-0325-4ae8-a111-82202c0d2016", {}), + "Top secret": ("5bf3f1e3-0f5e-4fec-81d5-c113d3a1b3a6", {}), } -interface_context_diagram_uuids = { - "Left to right": "3ef23099-ce9a-4f7d-812f-935f47e7938d", +interface_context_diagram_uuids: dict[str, tuple[str, dict[str, t.Any]]] = { + "Left to right": ("3ef23099-ce9a-4f7d-812f-935f47e7938d", {}), + "Interface": ( + "fbb7f735-3c1f-48de-9791-179d35ca7b98", + {"include_interface": True}, + ), } hierarchy_context = "16b4fcc5-548d-4721-b62a-d3d5b1c1d2eb" diagram_uuids = general_context_diagram_uuids | interface_context_diagram_uuids @@ -39,15 +44,16 @@ def generate_index_images() -> None: - for uuid in diagram_uuids.values(): + for uuid, render_params in diagram_uuids.values(): diag: context.ContextDiagram = model.by_uuid(uuid).context_diagram with mkdocs_gen_files.open(f"{str(dest / diag.name)}.svg", "w") as fd: - print(diag.render("svg", transparent_background=False), file=fd) + render_params["transparent_background"] = False # type: ignore[index] + print(diag.render("svg", **render_params), file=fd) # type: ignore[arg-type] def generate_no_symbol_images() -> None: for name in ("Capability", "Middle"): - uuid = general_context_diagram_uuids[name] + uuid, _ = general_context_diagram_uuids[name] diag: context.ContextDiagram = model.by_uuid(uuid).context_diagram diag.display_symbols_as_boxes = True diag.invalidate_cache() @@ -157,23 +163,23 @@ def generate_data_flow_image() -> None: generate_hierarchy_image() generate_no_symbol_images() -wizard = general_context_diagram_uuids["educate Wizards"] -generate_no_edgelabel_image(wizard) +wizard_uuid = general_context_diagram_uuids["educate Wizards"][0] +generate_no_edgelabel_image(wizard_uuid) -lost = general_context_diagram_uuids["Lost"] -generate_filter_image(lost, filters.EX_ITEMS, "ex") -generate_filter_image(lost, filters.FEX_EX_ITEMS, "fex and ex") -generate_filter_image(lost, filters.FEX_OR_EX_ITEMS, "fex or ex") +lost_uuid = general_context_diagram_uuids["Lost"][0] +generate_filter_image(lost_uuid, filters.EX_ITEMS, "ex") +generate_filter_image(lost_uuid, filters.FEX_EX_ITEMS, "fex and ex") +generate_filter_image(lost_uuid, filters.FEX_OR_EX_ITEMS, "fex or ex") generate_styling_image( - lost, + lost_uuid, dict( styling.BLUE_ACTOR_FNCS, junction=lambda o, s: {"stroke": diagram.RGB(220, 20, 60)}, ), "red junction", ) -generate_styling_image(wizard, {}, "no_styles") +generate_styling_image(wizard_uuid, {}, "no_styles") generate_class_tree_images() generate_realization_view_images() generate_data_flow_image() diff --git a/docs/index.md b/docs/index.md index 93ab4d46..93f44bfb 100644 --- a/docs/index.md +++ b/docs/index.md @@ -17,8 +17,8 @@ base class with [`ContextDiagram`s][capellambse_context_diagrams.context.Context Generate **Context Diagrams** from your model data!
- -
Interface context diagram of Left to right
+ +
Interface context diagram of Interface
## Features @@ -192,6 +192,21 @@ The data is collected by [get_elkdata_for_exchanges][capellambse_context_diagram
Interface context diagram of Left to right LogicalComponentExchange with type [LAB]
+??? example "Include the interface the ([`fa.ComponentExchange`][capellambse.model.crosslayer.fa.ComponentExchange])" + + ``` py + import capellambse + + model = capellambse.MelodyModel("tests/data/ContextDiagram.aird") + diag = model.by_uuid("fbb7f735-3c1f-48de-9791-179d35ca7b98").context_diagram + diag.render("svgdiagram", include_interface=True).save(pretty=True) + ``` +
+ +
Interface context diagram of Interface LogicalComponentExchange with type [LAB]
+
+ + !!! warning "Interface context only supported for the LogicalComponentExchanges" ### Customized edge routing