context
Extends the capellambse.model.diagram module with context diagrams.
Definitions of Custom Accessor- and Diagram-Classtypes based on
Accessor and
AbstractDiagram.
CollectorOutputData
module-attribute
🔗
CollectorOutputData: TypeAlias = (
ELKInputData | tuple[ELKInputData, ELKInputData | list[ELKInputEdge]]
)
The output of a collector or the input prepared for ELK.
CableTreeAccessor 🔗
CableTreeAccessor(dgcls: str, render_params: dict[str, Any] | None = None)
Bases: ContextAccessor
Provides access to the cable tree diagrams.
Source code in src/capellambse_context_diagrams/context.py
67 68 69 70 71 72 | |
__get__ 🔗
__get__(
obj: T | None, objtype: type | None = None
) -> m.Accessor | ContextDiagram
Make a CableTreeView for the given model object.
Source code in src/capellambse_context_diagrams/context.py
210 211 212 213 214 215 216 217 218 219 220 | |
CableTreeViewDiagram 🔗
CableTreeViewDiagram(
class_: str,
obj: ModelElement,
*,
render_styles: dict[str, Styler] | None = None,
default_render_parameters: dict[str, Any]
)
Bases: ContextDiagram
An automatically generated CableTreeView.
Source code in src/capellambse_context_diagrams/context.py
1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 | |
ClassTreeAccessor 🔗
ClassTreeAccessor(diagclass: str, render_params: dict[str, Any] | None = None)
Bases: ContextAccessor
Provides access to the tree view diagrams.
Source code in src/capellambse_context_diagrams/context.py
144 145 146 147 148 | |
__get__ 🔗
__get__(
obj: T | None, objtype: type | None = None
) -> m.Accessor | ContextDiagram
Make a ClassTreeDiagram for the given model object.
Source code in src/capellambse_context_diagrams/context.py
150 151 152 153 154 155 156 157 158 159 160 | |
ClassTreeDiagram 🔗
ClassTreeDiagram(
class_: str,
obj: ModelElement,
*,
render_styles: dict[str, Styler] | None = None,
default_render_parameters: dict[str, Any]
)
Bases: ContextDiagram
An automatically generated ClassTree Diagram.
This diagram is exclusively for Classes.
Source code in src/capellambse_context_diagrams/context.py
863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 | |
ContextAccessor 🔗
ContextAccessor(dgcls: str, render_params: dict[str, Any] | None = None)
Bases: Accessor
Provides access to the custom context diagrams.
Source code in src/capellambse_context_diagrams/context.py
67 68 69 70 71 72 | |
__get__ 🔗
__get__(obj: None, objtype: type[Any]) -> ContextAccessor
__get__(obj: T, objtype: type[T] | None = None) -> ContextDiagram
__get__(
obj: T | None, objtype: type | None = None
) -> m.Accessor | ContextDiagram
Make a ContextDiagram for the given model object.
Source code in src/capellambse_context_diagrams/context.py
80 81 82 83 84 85 86 87 88 | |
ContextDiagram 🔗
ContextDiagram(
class_: str,
obj: ModelElement | Diagram,
*,
render_styles: dict[str, Styler] | None = None,
default_render_parameters: dict[str, Any]
)
Bases: AbstractDiagram
An automatically generated context diagram.
| ATTRIBUTE | DESCRIPTION |
|---|---|
target |
The
TYPE:
|
styleclass |
The diagram class (for e.g. [LAB]).
|
render_styles |
Dictionary with the
|
serializer |
The serializer builds a
|
filters |
A list of filter names that are applied during collection of
context. Currently this is only done in
TYPE:
|
Notes
The following render parameters are supported:
- display_symbols_as_boxes: Display objects that are normally displayed as symbol as a simple box instead, with the symbol being the box' icon. This avoids the object of interest to become one giant, oversized symbol in the middle of the diagram, and instead keeps the symbol small and only enlarges the surrounding box.
- display_parent_relation: Display objects with a parent relationship to the object of interest as the parent box.
- display_derived_interfaces: Display derived objects collected from additional collectors beside the main collector for building the context.
- slim_center_box: Minimal width for the center box, containing just the icon and the label. This is False if hierarchy was identified.
- display_port_labels: Display port labels on the diagram.
- port_label_position: Position of the port labels. See
PORT_LABEL_POSITION. - transparent_background: Make the background transparent.
- context_groups: Render context UUID groups in the class attribute of every context element when an SVG is rendered.
- display_unused_ports: Display ports that are not connected to an edge.
- edge_direction: Reroute direction of edges.
- mode: Context collection mode.
- display_actor_relation: Show the connections between the context actors.
- hide_context_owner: Hide the context owner in the diagram.
- include_children_context: Include the context of the target's children.
- include_external_context: Include all children of external actors in context.
- hide_functions: Hide functions from the diagram.
- display_functional_parent_relation: Display the parent relation of functions within the context.
- display_internal_relations: Show exchanges that connect to
children of a box from the diagram. Only useful with
BLACKBOXmode. - display_cyclic_relations: Show cyclic exchanges that connect
either the box of interest or a child with itself or a child.
Only useful with
BLACKBOXmode anddisplay_cyclic_relationsturned on. - restrict_external_depth: In GREYBOX mode, restrict external components to the same depth as max_depth. This prevents showing deeply nested children from external components.
- pvmt_styling: Style the diagram according to the PVMT group applied to the diagram elements.
- child_shadow: Add a white background box (5px padding, 50% opacity) behind elements that have a parent box.
The following properties are used by the internal builders:
- collect: A callable that yields model elements from a given context diagram.
- is_portless: Boolean flag, if the diagram is portless.
Source code in src/capellambse_context_diagrams/context.py
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 | |
FilterSet 🔗
FilterSet(diagram: AbstractDiagram)
Bases: MutableSet
A set that stores filter_names and invalidates diagram cache.
Source code in src/capellambse_context_diagrams/context.py
551 552 553 554 555 556 | |
elk_input_data 🔗
elk_input_data(params: dict[str, Any]) -> CollectorOutputData
Return the collected ELK input data.
Source code in src/capellambse_context_diagrams/context.py
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 | |
CustomDiagramType 🔗
Bases: Enum
Custom Diagram types.
DataFlowAccessor 🔗
DataFlowAccessor(diagclass: str, render_params: dict[str, Any] | None = None)
Bases: ContextAccessor
Source code in src/capellambse_context_diagrams/context.py
188 189 190 191 192 | |
__get__ 🔗
__get__(
obj: T | None, objtype: type | None = None
) -> m.Accessor | ContextDiagram
Make a DataFlowViewDiagram for the given model object.
Source code in src/capellambse_context_diagrams/context.py
194 195 196 197 198 199 200 201 202 203 204 | |
DataFlowViewDiagram 🔗
DataFlowViewDiagram(
class_: str,
obj: ModelElement,
*,
render_styles: dict[str, Styler] | None = None,
default_render_parameters: dict[str, Any]
)
Bases: ContextDiagram
An automatically generated DataFlowViewDiagram.
Source code in src/capellambse_context_diagrams/context.py
1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 | |
DiagramLayoutAccessor 🔗
DiagramLayoutAccessor(
dgls_to_render_params: dict[DiagramType, dict[str, Any]] | None = None,
)
Bases: Accessor
Provides access to an ELK layout of a diagram.
Source code in src/capellambse_context_diagrams/context.py
226 227 228 229 230 231 232 233 | |
ELKDiagram 🔗
ELKDiagram(
class_: str,
obj: Diagram,
*,
render_styles: dict[str, Styler] | None = None,
default_render_parameters: dict[str, Any]
)
Bases: ContextDiagram
A former diagram layouted by ELKJS.
Source code in src/capellambse_context_diagrams/context.py
1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 | |
FunctionalChainContextAccessor 🔗
FunctionalChainContextAccessor(
diagclass: dict[type[ModelElement], str],
render_params: dict[str, Any] | None = None,
)
Bases: InterfaceContextAccessor
Provides access to the functional chain view diagrams.
Source code in src/capellambse_context_diagrams/context.py
105 106 107 108 109 110 111 | |
__get__ 🔗
__get__(
obj: T | None, objtype: type | None = None
) -> m.Accessor | ContextDiagram
Make a ContextDiagram for the given model object.
Source code in src/capellambse_context_diagrams/context.py
266 267 268 269 270 271 272 273 274 275 276 | |
FunctionalChainContextDiagram 🔗
FunctionalChainContextDiagram(
class_: str,
obj: ModelElement,
*,
render_styles: dict[str, Styler] | None = None,
default_render_parameters: dict[str, Any]
)
Bases: ContextDiagram
A custom Context Diagram exclusively for FunctionalChains.
Source code in src/capellambse_context_diagrams/context.py
1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 | |
InterfaceContextAccessor 🔗
InterfaceContextAccessor(
diagclass: dict[type[ModelElement], str],
render_params: dict[str, Any] | None = None,
)
Bases: ContextAccessor
Provides access to the interface context diagrams.
Source code in src/capellambse_context_diagrams/context.py
105 106 107 108 109 110 111 | |
__get__ 🔗
__get__(
obj: T | None, objtype: type | None = None
) -> m.Accessor | ContextDiagram
Make a ContextDiagram for the given model object.
Source code in src/capellambse_context_diagrams/context.py
113 114 115 116 117 118 119 120 121 122 123 | |
InterfaceContextDiagram 🔗
InterfaceContextDiagram(
class_: str,
obj: ModelElement,
*,
render_styles: dict[str, Styler] | None = None,
default_render_parameters: dict[str, Any]
)
Bases: ContextDiagram
A Context Diagram exclusively for ComponentExchanges.
| ATTRIBUTE | DESCRIPTION |
|---|---|
dangling_functional_exchanges |
A list of
TYPE:
|
Notes
The following render parameters are available:
- include_interface: Boolean flag to enable inclusion of the context diagram target: The interface ComponentExchange.
- include_port_allocations: Boolean flag to enable rendering of port allocations.
- hide_functions: Boolean flag to enable white box view: Only displaying Components or Entities.
In addition to all other render parameters of
ContextDiagram.
Source code in src/capellambse_context_diagrams/context.py
632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 | |
PhysicalPortContextAccessor 🔗
PhysicalPortContextAccessor(
dgcls: str, render_params: dict[str, Any] | None = None
)
Bases: ContextAccessor
Source code in src/capellambse_context_diagrams/context.py
67 68 69 70 71 72 | |
__get__ 🔗
__get__(
obj: T | None, objtype: type | None = None
) -> m.Accessor | ContextDiagram
Make a ContextDiagram for the given model object.
Source code in src/capellambse_context_diagrams/context.py
127 128 129 130 131 132 133 134 135 136 137 | |
PhysicalPortContextDiagram 🔗
PhysicalPortContextDiagram(
class_: str,
obj: ModelElement,
*,
render_styles: dict[str, Styler] | None = None,
default_render_parameters: dict[str, Any]
)
Bases: ContextDiagram
A custom Context Diagram exclusively for PhysicalPorts.
Source code in src/capellambse_context_diagrams/context.py
1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 | |
RealizationViewContextAccessor 🔗
RealizationViewContextAccessor(
diagclass: str, render_params: dict[str, Any] | None = None
)
Bases: ContextAccessor
Provides access to the realization view diagrams.
Source code in src/capellambse_context_diagrams/context.py
167 168 169 170 171 | |
__get__ 🔗
__get__(
obj: T | None, objtype: type | None = None
) -> m.Accessor | ContextDiagram
Make a RealizationViewDiagram for the given model object.
Source code in src/capellambse_context_diagrams/context.py
173 174 175 176 177 178 179 180 181 182 183 | |
RealizationViewDiagram 🔗
RealizationViewDiagram(
class_: str,
obj: ModelElement,
*,
render_styles: dict[str, Styler] | None = None,
default_render_parameters: dict[str, Any]
)
Bases: ContextDiagram
An automatically generated realization view diagram.
This diagram is exclusively for Activity, Functions,
Entity and Components of all layers.
Source code in src/capellambse_context_diagrams/context.py
977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 | |
add_context 🔗
add_context(data: ELKOutputData, is_legend: bool = False) -> None
Add all connected nodes as context to all elements.
Source code in src/capellambse_context_diagrams/context.py
923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 | |
adjust_layer_sizing 🔗
adjust_layer_sizing(
data: ELKInputData,
layout: ELKOutputData,
layer_sizing: Literal["UNION", "WIDTH", "HEIGHT", "INDIVIDUAL"],
) -> None
Set nodeSize.minimum config in the layoutOptions.
Source code in src/capellambse_context_diagrams/context.py
1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 | |
calculate_label_position 🔗
calculate_label_position(
x: float, y: float, width: float, height: float, padding: float = 10.0
) -> tuple[float, float, float]
Calculate the position of the label and tspan.
The function calculates the center of the rectangle and uses the rectangle's width and height to adjust its position within it. The text is assumed to be horizontally and vertically centered within the rectangle. The tspan y coordinate is for positioning the label right under the left side of the rectangle.
| PARAMETER | DESCRIPTION |
|---|---|
x
|
The x coordinate of the label position.
TYPE:
|
y
|
The y coordinate of the label position.
TYPE:
|
width
|
Width of the label.
TYPE:
|
height
|
Height of the label
TYPE:
|
padding
|
The padding for the label.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
position
|
A tuple containing the x- and y-coordinate for the text element and the adjusted y-coordinate for the tspan element. |
Source code in src/capellambse_context_diagrams/context.py
1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 | |
stack_diagrams 🔗
stack_diagrams(
first: Diagram, second: Diagram, axis: Literal["x", "y"] = "x"
) -> None
Add the diagram elements from right to left inline.
Source code in src/capellambse_context_diagrams/context.py
1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 | |
try_to_layout 🔗
try_to_layout(data: ELKInputData) -> _elkjs.ELKOutputData
Try calling elkjs, raise a JSONDecodeError if it fails.
Source code in src/capellambse_context_diagrams/context.py
1395 1396 1397 1398 1399 1400 1401 | |