_elkjs
Functionality for the ELK data model and the call to elkjs.
Implementation of the data model and subprocess callers to check for elkjs binaries or deno support.
The ELKManager class is the manager for the ELK subprocess. It is responsible for spawning the subprocess, downloading the binary if necessary, and calling into the subprocess.
The elk_manager instance is the global instance of the ELKManager class. It can be used to call into elkjs.
EDGE_STRAIGHTENING_LAYOUT_OPTIONS
module-attribute
🔗
EDGE_STRAIGHTENING_LAYOUT_OPTIONS: LayoutOptions = {
"layered.priority.straightness": "10"
}
Options for increasing the edge straightness priority.
ELKOutputChild
module-attribute
🔗
ELKOutputChild = (
ELKOutputEdge
| ELKOutputJunction
| ELKOutputLabel
| ELKOutputNode
| ELKOutputPort
)
Type alias for ELK output.
LABEL_LAYOUT_OPTIONS
module-attribute
🔗
LABEL_LAYOUT_OPTIONS: LayoutOptions = {
"nodeLabels.placement": "OUTSIDE, V_BOTTOM, H_CENTER"
}
Options for labels to configure ELK layouting.
LAYOUT_OPTIONS
module-attribute
🔗
LAYOUT_OPTIONS: ImmutableLayoutOptions = {
"algorithm": "layered",
"edgeRouting": "ORTHOGONAL",
"elk.direction": "RIGHT",
"hierarchyHandling": "INCLUDE_CHILDREN",
"layered.edgeLabels.sideSelection": "ALWAYS_DOWN",
"layered.nodePlacement.strategy": "BRANDES_KOEPF",
"spacing.labelNode": "0.0",
"spacing.edgeNode": 10,
"spacing.edgeEdge": 10,
"spacing.nodeNodeBetweenLayers": 5,
"spacing.edgeNodeBetweenLayers": 5,
"spacing.edgeEdgeBetweenLayers": 5,
}
Available (and possibly useful) Global Options to configure ELK layouting.
See Also
get_global_layered_layout_options : A function that instantiates this class with well-tested settings.
BaseELKModel 🔗
Bases: BaseModel
Base class for ELK models.
ELKInputChild 🔗
ELKInputData 🔗
ELKInputEdge 🔗
ELKInputLabel 🔗
ELKInputPort 🔗
ELKManager 🔗
ELKManager()
Source code in src/capellambse_context_diagrams/_elkjs.py
318 319 320 | |
runtime_version
property
🔗
runtime_version: str
The version of the elkjs runtime package to download.
call_elkjs 🔗
call_elkjs(elk_model: ELKInputData) -> ELKOutputData
Call into elk.js to auto-layout the diagram.
| PARAMETER | DESCRIPTION |
|---|---|
elk_model
|
The diagram data, sans layouting information
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
layouted_diagram
|
The diagram data, augmented with layouting information |
Source code in src/capellambse_context_diagrams/_elkjs.py
476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 | |
spawn_process 🔗
spawn_process() -> None
Spawn the elk.js process.
The preferenced order is: binary (downloaded) > deno > binary (needs download)
Source code in src/capellambse_context_diagrams/_elkjs.py
436 437 438 439 440 441 442 443 444 445 446 | |
ELKOutputData 🔗
ELKOutputDiagramElement 🔗
ELKOutputEdge 🔗
ELKOutputElement 🔗
ELKOutputJunction 🔗
ELKOutputLabel 🔗
ELKOutputNode 🔗
ELKOutputPort 🔗
ELKPoint 🔗
ELKSize 🔗
PORT_LABEL_POSITION 🔗
Bases: Enum
Position of port labels.
| ATTRIBUTE | DESCRIPTION |
|---|---|
OUTSIDE |
The label is placed outside the port.
|
INSIDE |
The label is placed inside the port owner box.
|
NEXT_TO_PORT_IF_POSSIBLE |
The label is placed next to the port if space allows.
|
ALWAYS_SAME_SIDE |
The label is always placed on the same side of the port.
|
ALWAYS_OTHER_SAME_SIDE |
The label is always placed on the opposite side, but on the same axis.
|
SPACE_EFFICIENT |
The label is positioned in the most space-efficient location.
|
get_global_layered_layout_options 🔗
get_global_layered_layout_options() -> LayoutOptions
Return optimal ELKLayered configuration.
Source code in src/capellambse_context_diagrams/_elkjs.py
503 504 505 | |