Flowchart family: process, decision, loop, document and storage shapes

Overview

Base Control: FlowchartControl : MaterialControl
Namespace: Beep.Skia.FlowChart

The FlowchartControl is the root control for this diagram family. It inherits MaterialControl and provides shared port management, styling, and template methods for all nodes in the family.

This family contains 36 node types.

Node Types

Node ClassShapeDescription
ProcessNodeRectangleStandard process/action step. The most common flowchart node.
DecisionNodeDiamondConditional branching. Yes/No or True/False paths.
StartEndNodeRounded RectangleStart or End terminal. Use NodeType to specify.
DocumentNodeDocument (wavy bottom)Represents a document or report output.
DataNodeParallelogramData input/output operation.
InputOutputNodeParallelogramInput or output operation (alternative shape).
PredefinedProcessNodeRectangle with vertical barsSubroutine or predefined process.
SubProcessNodeRectangle with vertical barsNested sub-process expandable node.
ForLoopNodeHexagonFor-loop construct with initialization, condition, increment.
WhileLoopNodeHexagonWhile-loop construct with pre-condition.
DoWhileLoopNodeHexagonDo-while loop construct with post-condition.
LoopLimitNodeHexagonLoop with defined iteration limit.
DelayNodeRectangle with curved sideDelay or wait operation.
DisplayNodeScreen/display shapeDisplay output on screen.
ManualInputNodeRectangle with angled topManual data entry step.
ManualOperationNodeTrapezoidManual operation by user.
PreparationNodeHexagonInitialization or preparation step.
MergeNodeInverted triangleMerge multiple flows into one.
ForkNodeTriangleSplit one flow into multiple parallel paths.
JoinNodeInverted triangleWait for all parallel flows to complete.
OrNodeCircleOR-logic junction for alternative paths.
CollateNodeHourglassOrganize/sequence parallel data.
SortNodeDiamond variantSort operation step.
ExtractNodeRectangleExtract subset from data.
ConnectorNodeCircle (small)On-page connector reference.
OffPageReferenceNodePentagonOff-page connector reference.
SummingJunctionNodeCircle with XSumming junction for parallel flows.
InternalStorageNodeRectangleInternal storage/persistence.
StoredDataNodeCylinderData stored in database/persistent storage.
SequentialAccessNodeRolled paperSequential access storage (tape).
DirectAccessNodeDrumDirect access storage (disk).
MultiDocumentNodeStacked documentsMultiple documents.
TapeNodeData blockMagnetic tape data representation.
CardNodeCard/punched cardPunched card input.
AnnotationNodeOpen bracketAnnotation/comment connected to any node.
CommentNodeNote/calloutFree-text comment box.

ProcessNode

Standard process/action step. The most common flowchart node.

ShapeRectangle
Input Ports1 (top-center)
Output Ports1 (bottom-center)

DecisionNode

Conditional branching. Yes/No or True/False paths.

ShapeDiamond
Input Ports1 (top)
Output Ports2+ (left/right/bottom)

StartEndNode

Start or End terminal. Use NodeType to specify.

ShapeRounded Rectangle
Input Ports1 (top)
Output Ports1 (bottom)

DocumentNode

Represents a document or report output.

ShapeDocument (wavy bottom)
Input Ports1 (top)
Output Ports1 (bottom)

DataNode

Data input/output operation.

ShapeParallelogram
Input Ports1 (top)
Output Ports1 (bottom)

InputOutputNode

Input or output operation (alternative shape).

ShapeParallelogram
Input Ports1 (top)
Output Ports1 (bottom)

PredefinedProcessNode

Subroutine or predefined process.

ShapeRectangle with vertical bars
Input Ports1 (top)
Output Ports1 (bottom)

SubProcessNode

Nested sub-process expandable node.

ShapeRectangle with vertical bars
Input Ports1 (top)
Output Ports1 (bottom)

ForLoopNode

For-loop construct with initialization, condition, increment.

ShapeHexagon
Input Ports1 (top)
Output Ports1 (bottom)

WhileLoopNode

While-loop construct with pre-condition.

ShapeHexagon
Input Ports1 (top)
Output Ports1 (bottom)

DoWhileLoopNode

Do-while loop construct with post-condition.

ShapeHexagon
Input Ports1 (top)
Output Ports1 (bottom)

LoopLimitNode

Loop with defined iteration limit.

ShapeHexagon
Input Ports1 (top)
Output Ports1 (bottom)

DelayNode

Delay or wait operation.

ShapeRectangle with curved side
Input Ports1 (top)
Output Ports1 (bottom)

DisplayNode

Display output on screen.

ShapeScreen/display shape
Input Ports1 (top)
Output Ports1 (bottom)

ManualInputNode

Manual data entry step.

ShapeRectangle with angled top
Input Ports1 (top)
Output Ports1 (bottom)

ManualOperationNode

Manual operation by user.

ShapeTrapezoid
Input Ports1 (top)
Output Ports1 (bottom)

PreparationNode

Initialization or preparation step.

ShapeHexagon
Input Ports1 (top)
Output Ports1 (bottom)

MergeNode

Merge multiple flows into one.

ShapeInverted triangle
Input Ports2+ (top/sides)
Output Ports1 (bottom)

ForkNode

Split one flow into multiple parallel paths.

ShapeTriangle
Input Ports1 (top)
Output Ports2+ (bottom/sides)

JoinNode

Wait for all parallel flows to complete.

ShapeInverted triangle
Input Ports2+ (top/sides)
Output Ports1 (bottom)

OrNode

OR-logic junction for alternative paths.

ShapeCircle
Input Ports2+ (sides)
Output Ports1+ (sides)

CollateNode

Organize/sequence parallel data.

ShapeHourglass
Input Ports2+ (top)
Output Ports1 (bottom)

SortNode

Sort operation step.

ShapeDiamond variant
Input Ports1 (top)
Output Ports1 (bottom)

ExtractNode

Extract subset from data.

ShapeRectangle
Input Ports1 (top)
Output Ports1 (bottom)

ConnectorNode

On-page connector reference.

ShapeCircle (small)
Input Ports1 (any)
Output Ports1 (any)

OffPageReferenceNode

Off-page connector reference.

ShapePentagon
Input Ports1 (any)
Output Ports1 (any)

SummingJunctionNode

Summing junction for parallel flows.

ShapeCircle with X
Input Ports2+ (sides)
Output Ports1 (side)

InternalStorageNode

Internal storage/persistence.

ShapeRectangle
Input Ports1 (top)
Output Ports1 (bottom)

StoredDataNode

Data stored in database/persistent storage.

ShapeCylinder
Input Ports1 (top)
Output Ports1 (bottom)

SequentialAccessNode

Sequential access storage (tape).

ShapeRolled paper
Input Ports1 (top)
Output Ports1 (bottom)

DirectAccessNode

Direct access storage (disk).

ShapeDrum
Input Ports1 (top)
Output Ports1 (bottom)

MultiDocumentNode

Multiple documents.

ShapeStacked documents
Input Ports1 (top)
Output Ports1 (bottom)

TapeNode

Magnetic tape data representation.

ShapeData block
Input Ports1 (top)
Output Ports1 (bottom)

CardNode

Punched card input.

ShapeCard/punched card
Input Ports1 (top)
Output Ports1 (bottom)

AnnotationNode

Annotation/comment connected to any node.

ShapeOpen bracket
Input Ports0
Output Ports0

CommentNode

Free-text comment box.

ShapeNote/callout
Input Ports0
Output Ports0

Connection Points

Every node in this family exposes connection points (ports) for linking to other nodes. Port positions are computed lazily by LayoutPorts(), which runs when MarkPortsDirty() flags the layout as stale after a move or resize.

Node ClassInput PortsOutput PortsExtra
ProcessNode1 (top-center)1 (bottom-center)—
DecisionNode1 (top)2+ (left/right/bottom)—
StartEndNode1 (top)1 (bottom)—
DocumentNode1 (top)1 (bottom)—
DataNode1 (top)1 (bottom)—
InputOutputNode1 (top)1 (bottom)—
PredefinedProcessNode1 (top)1 (bottom)—
SubProcessNode1 (top)1 (bottom)—
ForLoopNode1 (top)1 (bottom)—
WhileLoopNode1 (top)1 (bottom)—
DoWhileLoopNode1 (top)1 (bottom)—
LoopLimitNode1 (top)1 (bottom)—
DelayNode1 (top)1 (bottom)—
DisplayNode1 (top)1 (bottom)—
ManualInputNode1 (top)1 (bottom)—
ManualOperationNode1 (top)1 (bottom)—
PreparationNode1 (top)1 (bottom)—
MergeNode2+ (top/sides)1 (bottom)—
ForkNode1 (top)2+ (bottom/sides)—
JoinNode2+ (top/sides)1 (bottom)—
OrNode2+ (sides)1+ (sides)—
CollateNode2+ (top)1 (bottom)—
SortNode1 (top)1 (bottom)—
ExtractNode1 (top)1 (bottom)—
ConnectorNode1 (any)1 (any)—
OffPageReferenceNode1 (any)1 (any)—
SummingJunctionNode2+ (sides)1 (side)—
InternalStorageNode1 (top)1 (bottom)—
StoredDataNode1 (top)1 (bottom)—
SequentialAccessNode1 (top)1 (bottom)—
DirectAccessNode1 (top)1 (bottom)—
MultiDocumentNode1 (top)1 (bottom)—
TapeNode1 (top)1 (bottom)—
CardNode1 (top)1 (bottom)—
AnnotationNode00—
CommentNode00—

Connection Conventions

When building diagrams with this family, follow these conventions:

  • Top ports are inputs; bottom ports are outputs
  • DecisionNode uses Yes (right) and No (bottom) ports
  • StartEndNode uses NodeType enum (Start/Stop)
  • Flow lines default to orthogonal routing with arrowheads

Usage Example

Complete example showing creation, node placement, and connection:

C# Example

// Create a FlowChart control
var fc = new FlowchartControl
{
    X = 100, Y = 50,
    Width = 600, Height = 400
};
drawingManager.AddComponent(fc);

// Add nodes
var start = new StartEndNode { X = 250, Y = 60, NodeType = NodeType.Start };
var process = new ProcessNode { X = 250, Y = 130, Text = "Process Data" };
var decision = new DecisionNode { X = 250, Y = 200, Text = "Valid?" };
var stop = new StartEndNode { X = 250, Y = 280, NodeType = NodeType.Stop };

drawingManager.AddComponent(start);
drawingManager.AddComponent(process);
drawingManager.AddComponent(decision);
drawingManager.AddComponent(stop);

// Connect
drawingManager.ConnectComponents(start.OutPoints[0], process.InPoints[0]);
drawingManager.ConnectComponents(process.OutPoints[0], decision.InPoints[0]);
drawingManager.ConnectComponents(decision.OutPoints[0], stop.InPoints[0]);

Code Generation

FlowchartCodeGenerator turns a flowchart into structured code. It walks the graph from the start node and emits nested constructs for loops, decisions and sub-processes:

MemberTypeDescription
Generate(manager, language)stringGenerates code for everything the manager holds.
Generate(components, lines, language)stringGenerates code for an explicit graph.
CodeLanguageenumPseudocode (default), Python or CSharp.
var generator = new FlowchartCodeGenerator();
string code = generator.Generate(drawingManager, CodeLanguage.CSharp);
File.WriteAllText("generated.cs", code);

Simulation

FlowchartSimulator executes the flowchart step by step without running the workflow engine. It tracks the current node, a step count and a readable trace, and lets the host choose branches at decision nodes:

MemberTypeDescription
Reset(components, lines)voidPrepares a run and locates the start node.
Step()boolAdvances one node; false when the flow has finished.
Run(maxSteps)boolRuns to completion or until the step cap (default 1000).
CurrentNodeSkiaComponentThe node reached by the last step.
IsFinished / StepCountbool / intRun state.
TraceList<string>Visited nodes, in order, for display or assertions.
BranchSelectorFunc<SkiaComponent, IReadOnlyList<SimulationEdge>, SimulationEdge?>Called at decision nodes to pick the outgoing edge; return null to stop.
StepExecutedeventRaised per step with the node, outgoing edges and finished flag.
var simulator = new FlowchartSimulator();
simulator.Reset(drawingManager.GetComponents().ToList(), drawingManager.GetLines());

simulator.BranchSelector = (node, edges) => edges.FirstOrDefault();

simulator.Run(maxSteps: 500);
Console.WriteLine(string.Join(" -> ", simulator.Trace));