pub trait Node {
// Required methods
fn entry_height(&self) -> i64;
fn height(&self) -> i64;
fn width(&self) -> i64;
fn draw(&self, x: i64, y: i64, h_dir: HDir) -> Element;
// Provided method
fn height_below_entry(&self) -> i64 { ... }
}
Expand description
A diagram is built from a set of primitives which implement Node
.
A primitive is a geometric box, within which it can draw whatever it wants.
Simple primitives (e.g. Start
) have fixed width, height etc.. Complex
primitives, which wrap other primitives (e.g. Sequence
), use the methods
defined here to compute their own geometry. When the time comes for a primitive
to be drawn, the wrapping primitive computes the desired location of the wrapped
primitive(s) and calls .draw()
on them. It is the primitive’s job
to ensure that it uses only the space it announced.
Required Methods§
sourcefn entry_height(&self) -> i64
fn entry_height(&self) -> i64
The vertical distance from this element’s top to where the entering, connecting path is drawn.
By convention, the path connecting primitives enters from the left.
Provided Methods§
sourcefn height_below_entry(&self) -> i64
fn height_below_entry(&self) -> i64
The vertical distance from the height of the connecting path to the bottom.