Skip to main content

Module model

Module model 

Source
Expand description

The domain-agnostic graph model — the same shape nornir’s src/viz/graph_render.rs::draw_graph accepts, so this engine is a future drop-in for that egui routine. Nodes are laid out in world space by the caller (each domain owns its own layout/columns); edges reference nodes by id. Decorations is the caller-supplied overlay — facett mustn’t know what a “release gate” is, so rings/badges/emphasis-edges are opaque here.

Colours are a tiny POD Color (premultiply-free sRGBA8) with a From conversion off egui’s Color32, so a caller already speaking egui (exactly nornir’s draw_graph) maps straight across with zero glue.

Structs§

Camera
The camera transform: pan + zoom over the world. World point p projects to screen as center + pan + p * zoom (the same affine nornir’s draw_graph applies). Owned by the caller so navigation survives across frames.
Color
A straight sRGBA8 colour (NOT premultiplied). The render backends convert to their own colour type at the seam.
Decorations
The caller-supplied overlay layer (domain-agnostic). Per-node rings/badges keyed by node id, plus extra emphasis edges painted on top (e.g. a cycle’s suggested cut). Empty = no overlay.
GraphEdge
One edge: endpoints by node id, colour, a dashed flag, and an optional mid-edge label (a cut rationale).
GraphModel
The full graph to paint — nodes (laid out) + edges.
GraphNode
One laid-out node: stable id, label, chip fill + stroke (the kind colour, caller’s choice), and its world-space centre.
NodeDecoration
A per-node decoration layered over the base chip: an optional status ring colour (drawn outside the kind stroke) and an optional badge (a short glyph/text at the chip’s top-right corner).
Pos
A 2D point in world space (caller-owned layout coordinates).

Constants§

BOX_H
BOX_W
Default node chip size in world units (matches nornir’s arch board: BOX_W/BOX_H), before any pan/zoom transform.