JFLib

diagram_core/src/structure/cff.rs#

Source: lib/diagram_core/src/structure/cff.rs

structure::cff -- the cross-functional flowchart (ST-05): lanes and phases in a pool

  find(doc, s) -> Option<Cff>        the flowchart a shape belongs to (the pool itself, one of
                                     its lists, a lane, a phase, a shape in a lane)
  pools(doc, owner)                  every flowchart of a page
  layout(tx, eng, &cff)              lanes stacked, phases side by side across every lane,
                                     the lists and the pool around them -> what moved
  lanes(doc, &cff) / phases(doc, &cff)
  create(tx, eng, &src, page, top_left, horizontal, lanes, phases, lang) -> Cff
                                     (JD13) a new flowchart from the masters of stencil `src`
                                     (JFDiagrammer's "cff"): pool, both lists, the lanes and
                                     phases, laid out from `top_left`; create_with takes a
                                     lane or phase already on the page along (a dropped one)

Visio's structure, kept so that Visio recognises it (research in jd10-strukturen.md):

  CFF Container   Container, categories "CFF Container", takes only "CFF List"; its heading
                  is the title bar
   ├ Swimlane List  List of the lanes (items: categories "Swimlane"), direction 2 (top to
   │                bottom) for horizontal lanes, 0 for vertical ones
   └ Phase List     List of the phases (items: "Phase"), the other direction
  Swimlane        Container with its heading on the left (horizontal) or on top (vertical)
  Separator       Container with its heading on top (horizontal) or on the left; it spans
                  every lane, a shape in it is its member as well as its lane's

Horizontal (lanes one above the other):

  +--------------------------------------------+  title bar (the pool's heading, Ht)
  |       | phase 1 heading  | phase 2 heading |  phase row (the phases' headings, Hp)
  | lane1 |                  |                 |
  +-------+------------------+-----------------+
  | lane2 |                  |                 |
  +--------------------------------------------+
   Wl (the lanes' headings)

The lanes keep their heights and share one width: the lane headings plus the phases (the last
phase takes what is left), or the widest lane without phases.  The phases keep their widths
and span the phase row and every lane.  Vertical flowcharts are the same turned: lanes side by
side, the phases one above the other.  Lanes and phases carry their shapes; a shape in both
moves by the larger of the two moves on each axis (once, not twice).
  • struct Cff a cross-functional flowchart
    • pool: ShapeRef
    • lane_list: Option<ShapeRef> -- the list of the lanes and of the phases
    • phase_list: Option<ShapeRef>
    • horizontal: bool -- lanes one above the other (else side by side)
/// the categories of the parts
CAT_POOL: &str = "CFF Container"
CAT_LIST: &str = "CFF List"
CAT_LANE: &str = "Swimlane"
CAT_PHASE: &str = "Phase"
  • fn is_pool(doc: &Document, s: ShapeRef) -> bool whether a shape is a flowchart's pool

  • fn of_pool(doc: &Document, pool: ShapeRef) -> Option<Cff> the flowchart of a pool

  • fn find(doc: &Document, s: ShapeRef) -> Option<Cff> the flowchart a shape belongs to: the pool, a list of it, a lane, a phase, a shape inside

  • fn pools(doc: &Document, owner: Owner) -> Vec<Cff> every flowchart on a page or master

  • fn lanes(doc: &Document, f: &Cff) -> Vec<ShapeRef> the lanes in order

  • fn phases(doc: &Document, f: &Cff) -> Vec<ShapeRef> the phases in order

  • fn layout(tx: &mut Transaction, eng: &mut Engine, f: &Cff) -> Result<Vec<ShapeRef>, EditError> lay the flowchart out from its pool's top left corner -> the shapes that moved

  • fn layout_with(tx: &mut Transaction, eng: &mut Engine, f: &Cff, want: Option<f64>) -> Result<Vec<ShapeRef>, EditError> layout with the lanes' length given (a pool or lane resized by hand), else the longest lane's or what the phases need

/// the hidden masters of a flowchart (NameU, as in JFDiagrammer's stencil "cff")
M_POOL: &str = "CFF Container"
M_LANE_LIST: &str = "Swimlane List"
M_PHASE_LIST: &str = "Phase List"
  • fn lane_master(horizontal: bool) -> &'static str the master of a lane: horizontal (lanes one above the other) or vertical

  • fn phase_master(horizontal: bool) -> &'static str the master of a phase (a separator)

  • fn create(tx: &mut Transaction, eng: &mut Engine, src: &Document, page: PageRef, top_left: [f64; 2], horizontal: bool, lanes: usize, phases: usize, lang: usize) -> Result<Cff, EditError> a new flowchart from the masters of stencil src on page: the pool, the lane list, the phase list, lanes lanes (at least one) and phases phases, laid out with the pool's top left corner at top_left; names and texts in language lang (instance::LANGS). Connectors near it are not rerouted (the caller's glue::update)

  • fn create_with( tx: &mut Transaction, eng: &mut Engine, src: &Document, page: PageRef, top_left: [f64; 2], horizontal: bool, lane: Option<ShapeRef>, phase: Option<ShapeRef>, lanes: usize, phases: usize, lang: usize, ) -> Result<Cff, EditError> create with a lane or a phase already on the page (one dropped outside any flowchart) as the first lane or phase; the others are new

Source: docs/API.md in the JFLib repository.