Implements a Level (or Layered) Graph control.

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

lvlgraphctrl.pas 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 ensure the required gaps between nodes.
An overloaded variant without the ALevel parameter was added in version 2.3.0.
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: examples/levelgraph/lvlgraph_dependencies.lpi .

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

Converts a given point or rectangle to client coordinates in the visible area for the control.
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: examples/levelgraph/lvlgraph_dependencies.lpi .

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

Gets the distance from a point measured along axes at right angles.

GetManhattanDistancePointLine is an Integer function used to get a distance from a point measured along axes at right angles. Also called "taxicab geometry". In taxicab geometry, the distance between two points is the sum of the absolute differences of their Cartesian coordinates.

In other words, Geometric distance measures the hypotenuse for a right triangle. Manhattan distance is the cumulative length of the adjacent and opposite sides for that right triangle.

X and Y contain the coordinates with the origin for the measurement.

LineX1 and LineY1 contain the end coordinates for the adjacent side of the right triangle (starting at X, Y).

LineX2 and LineY2 contain the end coordinates for the opposite side of the right triangle (start at LineX1, LineY1).

Distance along the sides of a right triangle using the specified coordinates.
Horizontal coordinate for the origin of the measurement.
Vertical coordinate for the origin of the measurement.
Gets a string with a comma-delimited list of captions for the specified node array.
Comma-delimited list of captions for the specified node array.
Array with the TLvlGraphNode instances examined in the routine.