Implements a Level (or Layered) Graph control.

LvlGraphCtrl.pas contains classes, types, constants, and routines used to implement a Level (or Layered) Graph control.

This file is part of the LazControls package.

Data is a Pointer property which points to the location in memory where the data for the node is stored.

Constructor for the class instance.

Create is the constructor for the class instance.

Destructor for the class instance.

Requires a value greater than or equal to 0 (zero) in the ImageIndex property.

The default value for the property is defined in the DefaultLvlGraphNodeImageEffect constant.

Graph is a read-only TLvlGraph property.

InEdges is a read-only indexed TLvlGraphEdge property which provides access to the input edges for the node. Use InEdgeCount to get the total number of input edges for the node.

OutEdges is a read-only indexed TLvlGraph property which provides access to the output edges for the node. Use OutEdgeCount to get the total number of output edges for the node.

NextSelected is a read-only TLvlGraphNode property.

PrevSelected is a read-only TLvlGraphNode property.

Drawing position for the node at the current Level.

The default value for the property is 1.

Calculated using the formula:

DrawPositionEnd := DrawPosition + Max(InSize, OutSize);
Last drawing position for the caption, with scrolling.

DrawnCaptionRect is a read-only TRect property.

Total weight for InEdges.

InWeight is a read-only Single property.

Total weight for OutEdges.

OutWeight is a read-only Single property.

Class reference for the TLvlGrapNode type.
Pointer to a TLvlGrapNode instance.
True when a circular reference exists between 2 nodes, with no levels between; i. e. both edges paint in the same location.
Pointer to the user data for the edge.
Constructor for the class instance.

Create is the constructor for the class instance.

Destructor for the class instance.

Destroy is the overridden destructor for the class instance.

Source is a read-only TLvlGrapNode property.

Target is a read-only TLvlGrapNode property.

Requires a value greater than or equal to 0 (zero).

BackEdge is a read-only Boolean property. The value is True if the direction for the edge was reversed (source and target were exchanged).

Last drawing rectangle, with scrolling.
DrawnAt is a read-only TRect property.
Pointer to a TLvlGraphEdge type.

TLvlGraphLevel is a TPersistent descendant.

Constructor for the class instance.

Create is the constructor for the class instance.

Destructor for the class instance.

Destroy is the overridden destructor for the class instance.

Nodes is a read-only indexed TLvlGrapNode property. Nodes is the default property for the class instance.

Sum of the maximum weights for each node: Max(InWeight,OutWeight).

Index is a read-only Integer property.

Graph is a read-only TLvlGraph property.

TLvlGraphSubGraph is a TPersistent descendant.

Constructor for the class instance.

Create is the constructor for the class instance.

Destructor for the class instance.

Destroy is the overridden destructor for the class instance.

Graph is a read-only TLvlGraph property.

Index is a read-only Integer property.

LowestLevel is a read-only Integer property.

HighestLevel is a read-only Integer property.

Create separate hidden nodes for each edge; this creates a lot of hidden nodes.
Combine hidden nodes at source (outgoing edge).
Combine hidden nodes at target (incoming edge).
Combine hidden nodes at source or target, whichever has more edges.

TLvlGraph is a TPersistent descendant.

Constructor for the class instance.

Create is the constructor for the class instance.

Destructor for the class instance.

Destroy is the overridden destructor for the class instance.

Signalled when a Node, Edge, or Level has been added or deleted in the level graph.

Nodes is a read-only indexed TLvlGraphNode property.

NodeClass is a read-only TLvlGraphNodeClass property.

FirstSelected is a read-only TLvlGrapNode property.

LastSelected is a read-only TLvlGraphNode property.

EdgeClass is a read-only TLvlGraphEdgeClass property.

SubGraphs is a read-only indexed TLvlGraphSubGraph property. Use SubGraphCount to get the number of subgraphs in the class instance.

SubGraphCount is a read-only Integer property with the number of subgraphs available in the class instance.

Levels is a read-only indexed TLvlGraphLevel property. Use LevelCount to get the number of Levels used in the nodes for the class instance.

LevelClass is a read-only TLvlGraphLevelClass property.

Creates levels using the edges for the Level Graph.

Requires BackEdge to have been processed in MarkBackEdges.

Splits long edges by adding hidden nodes.
Permutates nodes to minimize crossings.
Sets the position for all nodes to minimize overlappings.
Automatic graph layout after graph has changed.
CreateTopologicalLevels (AutoLayout) will attempts to find an order with less BackEdges.
Puts nodes topologically at higher levels.
If nodes are not fixed to a level by neighbors on both side, find the level which reduces total edge length the most.
Minimizes vertical up/down movement of edges.
Mouse hover highlights a node and its edges.
When the mouse is near an edge, highlight the node and its edges. lgoHighlightNodeUnderMouse takes precedence.

TLvlGraphNodeStyle is a TPersistent descendant.

Constructor for the class instance.

Create is the constructor for the class instance.

Level Graph control where values in the class instance are used.
Destructor for the class instance.

Destroy is the overridden destructor for the class instance.

Control is a read-only TCustomLvlGraphControl property.

The default value for the property is defined in the DefaultLvlGraphNodeCaptionPosition constant.

The default value for the property is defined in the DefaultLvlGraphNodeCaptionScale constant.

The default value for the property is defined in the DefaultLvlGraphNodeShape constant.

The default value for the property is defined in the DefaultLvlGraphNodeGapLeft constant. Used by AutoLayout.

The default value for the property is defined in the DefaultLvlGraphNodeGapTop constant. Used by AutoLayout.

The default value for the property is defined in the DefaultLvlGraphNodeGapRight constant. Used by AutoLayout.

The default value for the property is defined in the DefaultLvlGraphNodeGapBottom constant. Used by AutoLayout.

The default value for the property is defined in the DefaultLvlGraphNodeWith constant.

TLvlGraphEdgeStyle is a TPersistent descendant.

Constructor for the class instance.

Create is the constructor for the class instance.

Destructor for the class instance.

Destroy is the overridden destructor for the class instance.

Control is a read-only TCustomLvlGraphControl property.

The default value for the property is defined in the DefaultLvlGraphEdgeSplitMode constant.

The default value for the property is defined in the DefaultLvlGraphEdgeNearMouseDistMax constant.

The default value for the property is defined in the DefaultLvlGraphEdgeShape constant.

The default value for the property is defined in the DefaultLvlGraphEdgeColor constant.

The default value for the property is defined in the DefaultLvlGraphEdgeBackColor constant.

The default value for the property is defined in the DefaultLvlGraphEdgeHighlightColor constant.

The default value for the property is defined in the DefaultLvlGraphEdgeBackHighlightColor constant.

TLvlGraphLimits is a TPersistent descendant.

Constructor for the class instance.

Create is the constructor for the class instance.

Control where class instance is used.
Destructor for the class instance.

Destroy is the overridden destructor for the class instance.

Control is a read-only TCustomLvlGraphControl property.

Maximum number of user-specified nodes for a level.

MaxLevelHeightAbs is an Integer property with the maximum number of visible (user-specified) nodes in a level. 0 (zero) indicates that the maximum is ignored. The default value for the property is defined in the DefaultMaxLevelHeightAbs constant.

MaxLevelHeightRel is a Single property with a factor used to determine the maximum number of nodes for a level. 0 (zero) indicates that the factor is ignored.

The default value for the property is defined in the DefaultMaxLevelHeightRel constant.

Ancestor for the TLvlGraphControl control.

TCustomLvlGraphControl is a TCustomControl descendant which implements the ancestor for TLvlGraphControl.

It is used to render a level graph (also known as a edlayered graph). A level graph consists of nodes (or vertices) and edges with an equidistant spacing between related nodes.

TCustomLvlGraphControl and TLvlGraphControl provide the following features:

- Offers automatic topological sorting, with an option to put nodes left-most or right-most.
- Offers automatic topological sorting, with an option to put nodes left-most or right-most.
- Edges can be automatically combined.
- Long edges over multiple levels are combined into a single line with forks to related nodes.
- Provides a heuristic to minimize line crossings.
- Automatically prevents overlapping of display elements.
- Nodes can be displayed as rectangles, ellipses or icons stored in a TImageList.
- You can select nodes using the mouse.
- You can select multiple nodes at once.
- You can highlight nodes or edges under the mouse.
- The control displays back edges in special colors, which facilitates quick visual identification of cycles (e.g. unit circles).
- Edges can be drawn straight or as a curve (bezier).
- There is a header caption.
- Node captions can be shown to the left, to the right, above, or below nodes.
- All colors can be set via published properties.
- Events are provided to custom-draw and/or skip each part of the default drawing.

There is a simple example in: ($LazarusDir)/examples/levelgraph/lvlgraph_dependencies.lpi.

TLvlGraphControl is used to display unit dependencies in the Package Graph for the Lazarus IDE.

Draws a line for the specified Edge using the current Canvas color.
Constructor for the class instance.

Create is the overridden constructor for the class instance.

Owner of the class instance.
Destructor for the class instance.

Destroy is the overridden destructor for the class instance.

Graph is a read-only TLvlGraph property.

EdgeStyle is a read-only TLvlGraphEdgeStyle property.

Limits is a read-only TLvlGraphLimits property.

The default value for the property is defined in the DefaultLvlGraphCtrlOptions constant.

ScrollTopMax is a read-only Integer property.

ScrollLeftMax is a read-only Integer property.

Event handler signalled to provide an alternative minimize crossing algorithm.
Event handler signalled to provide an alternative minimize overlappings algorithm.

PixelPerWeight is a read-only Single property.

The default value for the property is True.

Implements a control used to draw a level (or layered) graph.

TLvlGraphControl is a TCustomLvlGraphControl descendant which implements a control used to render a level graph (also known as a edlayered graph). A level graph consists of nodes (or vertices) and edges with an equidistant spacing between related nodes.

TLvlGraphControl provides the following features:

- Offers automatic topological sorting, with an option to put nodes left-most or right-most.
- Offers automatic topological sorting, with an option to put nodes left-most or right-most.
- Edges can be automatically combined.
- Long edges over multiple levels are combined into a single line with forks to related nodes.
- Provides a heuristic to minimize line crossings.
- Automatically prevents overlapping of display elements.
- Nodes can be displayed as rectangles, ellipses or icons stored in a TImageList.
- You can select nodes using the mouse.
- You can select multiple nodes at once.
- You can highlight nodes or edges under the mouse.
- The control displays back edges in special colors, which facilitates quick visual identification of cycles (e.g. unit circles).
- Edges can be drawn straight or as a curve (bezier).
- There is a header caption.
- Node captions can be shown to the left, to the right, above, or below nodes.
- All colors can be set via published properties.
- Events are provided to custom-draw and/or skip each part of the default drawing.

There is a simple example in: ($LazarusDir)/examples/levelgraph/lvlgraph_dependencies.lpi.

TLvlGraphControl is used to display unit dependencies in the Package Graph for the Lazarus IDE.