_generic
Functionality for collecting model data.
The data stems from an instance of
MelodyModel and converts it into
_elkjs.ELKInputData.
CONNECTOR_ATTR_NAMES
module-attribute
๐
CONNECTOR_ATTR_NAMES = ('ports', 'inputs', 'outputs')
Attribute of ModelElements for receiving connections.
DIAGRAM_TYPE_TO_CONNECTOR_NAMES
module-attribute
๐
DIAGRAM_TYPE_TO_CONNECTOR_NAMES: dict[DiagramType, tuple[str, ...]] = {
OAB: (),
OAIB: (),
OCB: (),
MCB: (),
SAB: CONNECTOR_ATTR_NAMES,
SDFB: CONNECTOR_ATTR_NAMES,
LAB: CONNECTOR_ATTR_NAMES,
LDFB: CONNECTOR_ATTR_NAMES,
PAB: CONNECTOR_ATTR_NAMES + PHYSICAL_CONNECTOR_ATTR_NAMES,
PDFB: CONNECTOR_ATTR_NAMES + PHYSICAL_CONNECTOR_ATTR_NAMES,
}
Supported diagram types mapping to the attribute name of connectors.
MARKER_PADDING
module-attribute
๐
MARKER_PADDING = PORT_PADDING
Default padding of markers in pixels.
PHYSICAL_CONNECTOR_ATTR_NAMES
module-attribute
๐
PHYSICAL_CONNECTOR_ATTR_NAMES = ('physical_ports',)
Attribute of PhysicalComponents for receiving connections.
ExchangeData ๐
Bases: NamedTuple
Exchange data for ELK.
elkdata
instance-attribute
๐
elkdata: ELKInputData
The collected elkdata to add the edges in there.
filter_iterable
instance-attribute
๐
filter_iterable: Iterable[str]
A string that maps to a filter label adjuster callable in
FILTER_LABEL_ADJUSTERS.
is_hierarchical
class-attribute
instance-attribute
๐
is_hierarchical: bool = False
True if exchange isn't global, i.e. nested inside a box.
params
class-attribute
instance-attribute
๐
params: dict[str, Any] | None = None
Optional dictionary of additional render params.
collect_exchange_endpoints ๐
collect_exchange_endpoints(ex: ExchangeData | ModelElement) -> SourceAndTarget
Safely collect exchange endpoints from ex.
Source code in src/capellambse_context_diagrams/collectors/_generic.py
74 75 76 77 78 79 80 81 82 | |
collect_label ๐
collect_label(obj: ModelElement) -> str | None
Return the label of a given object.
The label usually comes from the .name attribute. Special handling
for interaction.AbstractCapabilityExtend
and interaction.AbstractCapabilityInclude`.
Source code in src/capellambse_context_diagrams/collectors/_generic.py
188 189 190 191 192 193 194 195 196 197 198 199 | |
collector ๐
collector(
diagram: ContextDiagram,
*,
width: int | float = _makers.EOI_WIDTH,
no_symbol: bool = False
) -> _elkjs.ELKInputData
Return ELK data with only centerbox in children and config.
Source code in src/capellambse_context_diagrams/collectors/_generic.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
exchange_data_collector ๐
exchange_data_collector(
data: ExchangeData,
endpoint_collector: Callable[
[ModelElement], SourceAndTarget
] = collect_exchange_endpoints,
) -> SourceAndTarget
Return source and target port from exchange.
Additionally inflate elkdata.children with input data for ELK.
You can handover a filter name that corresponds to capellambse
filters. This will apply filter functionality from
filters.FILTER_LABEL_ADJUSTERS.
| PARAMETER | DESCRIPTION |
|---|---|
data
|
Instance of
TYPE:
|
endpoint_collector
|
Optional collector function for Exchange endpoints. Defaults to
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
(source, target)
|
A tuple consisting of the exchange's source and target elements. |
Source code in src/capellambse_context_diagrams/collectors/_generic.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
get_all_owners ๐
get_all_owners(obj: ModelElement) -> cabc.Iterator[str]
Return the UUIDs from all owners of obj.
Source code in src/capellambse_context_diagrams/collectors/_generic.py
244 245 246 247 248 249 | |
move_edges ๐
move_edges(
boxes: Mapping[str, ELKInputChild],
connections: Iterable[ModelElement],
data: ELKInputData,
portless: bool = False,
) -> None
Move edges to boxes.
Source code in src/capellambse_context_diagrams/collectors/_generic.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | |
port_collector ๐
port_collector(
target: ModelElement | ElementList, diagram_type: DiagramType
) -> tuple[dict[str, m.ModelElement], dict[str, m.ModelElement]]
Collect ports from target savely.
Source code in src/capellambse_context_diagrams/collectors/_generic.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | |
port_exchange_collector ๐
port_exchange_collector(
ports: Iterable[ModelElement], filter: Filter = lambda i: i
) -> dict[str, list[fa.FunctionalExchange | fa.ComponentExchange]]
Collect exchanges from ports savely.
Source code in src/capellambse_context_diagrams/collectors/_generic.py
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | |