TreeGraph
    
            
            in package
            
        
    
    
    
Maintains the geometry for a tree graph.
Tags
Table of Contents
Properties
- $branchSpace : int
- The amount of space between graph branches.
- $colSpace : int
- The amount of space between graph columns.
- $height : int
- The height of the graph.
- $isRendered : bool
- Flag to track whether the chart is rendered or not.
- $logger : Logger
- Trace logger.
- $nodes : array<string|int, mixed>
- An array of nodes in this graph.
- $position : int
- The index of the current node in the graph we are inspecting.
- $previousLevelNodes : array<string|int, mixed>
- An array of nodes on the previous level.
- $root : GraphNode
- The root node of the graph.
- $rowSpace : int
- The amount of space between graph rows.
- $width : int
- The width of the graph.
Methods
- __construct() : mixed
- Constructor.
- add() : void
- Add a new node to the graph.
- get() : GraphNode
- Get the specified node from the graph.
- getHeight() : int
- Get the heith of the graph, will invoke render() if not already rendered.
- getWidth() : int
- Get the width of the graph, will invoke render() if not already rendered.
- hasNext() : bool
- Check to see if another GraphNode instance in the graph is available.
- next() : GraphNode|null
- Get the next GraphNode instance in the graph, will invoke render() if not already rendered.
- render() : void
- Render the chart in memory.
- firstPass() : void
- The first pass of the graph.
- getLeftmost() : GraphNode|null
- Get left most node in the branch.
- layout() : void
- Handles the laying out of multi-branch trees.
- secondPass() : void
- The second pass of the graph.
- setNeighbours() : void
- Setup neighbour nodes.
Properties
$branchSpace
The amount of space between graph branches.
    private
        int
    $branchSpace
    
    
    
    
    Tags
$colSpace
The amount of space between graph columns.
    private
        int
    $colSpace
    
    
    
    
    Tags
$height
The height of the graph.
    private
        int
    $height
     = 0
    
    
    
    Tags
$isRendered
Flag to track whether the chart is rendered or not.
    private
        bool
    $isRendered
     = false
    
    
    
    Tags
$logger
Trace logger.
    private
    static    Logger
    $logger
     = null
    
    
    
    Tags
$nodes
An array of nodes in this graph.
    private
        array<string|int, mixed>
    $nodes
     = array()
    
    
    
    Tags
$position
The index of the current node in the graph we are inspecting.
    private
        int
    $position
     = 0
    
    
    
    Tags
$previousLevelNodes
An array of nodes on the previous level.
    private
        array<string|int, mixed>
    $previousLevelNodes
     = array()
    
    
    
    Tags
$root
The root node of the graph.
    private
        GraphNode
    $root
    
    
    
    
    Tags
$rowSpace
The amount of space between graph rows.
    private
        int
    $rowSpace
    
    
    
    
    Tags
$width
The width of the graph.
    private
        int
    $width
     = 0
    
    
    
    Tags
Methods
__construct()
Constructor.
    public
                    __construct([int $rowSpace = 40 ][, int $colSpace = 40 ][, int $branchSpace = 80 ]) : mixed
    Parameters
- $rowSpace : int = 40
- $colSpace : int = 40
- $branchSpace : int = 80
Tags
add()
Add a new node to the graph.
    public
                    add(int $id, int $pid, string $message, int $w, int $h, array<string|int, mixed> $nodeColour, string $URL) : void
    Parameters
- $id : int
- $pid : int
- $message : string
- $w : int
- $h : int
- $nodeColour : array<string|int, mixed>
- $URL : string
Tags
get()
Get the specified node from the graph.
    public
                    get(int $id) : GraphNode
    Parameters
- $id : int
Tags
Return values
GraphNodegetHeight()
Get the heith of the graph, will invoke render() if not already rendered.
    public
                    getHeight() : int
    Tags
Return values
intgetWidth()
Get the width of the graph, will invoke render() if not already rendered.
    public
                    getWidth() : int
    Tags
Return values
inthasNext()
Check to see if another GraphNode instance in the graph is available.
    public
                    hasNext() : bool
    Tags
Return values
boolnext()
Get the next GraphNode instance in the graph, will invoke render() if not already rendered.
    public
                    next() : GraphNode|null
    Tags
Return values
GraphNode|nullrender()
Render the chart in memory.
    protected
                    render() : void
    Tags
firstPass()
The first pass of the graph.
    private
                    firstPass(GraphNode $node, int $level) : void
    Parameters
- $node : GraphNode
- $level : int
Tags
getLeftmost()
Get left most node in the branch.
    private
                    getLeftmost(GraphNode $node, int $level, int $maxlevel) : GraphNode|null
    Parameters
- $node : GraphNode
- $level : int
- $maxlevel : int
Tags
Return values
GraphNode|nulllayout()
Handles the laying out of multi-branch trees.
    private
                    layout(GraphNode $node, int $level) : void
    Parameters
- $node : GraphNode
- $level : int
Tags
secondPass()
The second pass of the graph.
    private
                    secondPass(GraphNode $node, int $level[, int $x = 0 ][, int $y = 0 ]) : void
    Parameters
- $node : GraphNode
- $level : int
- $x : int = 0
- $y : int = 0
Tags
setNeighbours()
Setup neighbour nodes.
    private
                    setNeighbours(GraphNode $node, int $level) : void
    Parameters
- $node : GraphNode
- $level : int