TreeGraph
Maintains the geometry for a tree graph.
Tags
Table of Contents
- $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.
- __construct() : mixed
- Constructor.
- add() : mixed
- Add a new node to the graph.
- get() : GraphNode
- Get the specified node from the graph.
- getHeight() : mixed
- Get the heith of the graph, will invoke render() if not already rendered.
- getWidth() : mixed
- 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
- Get the next GraphNode instance in the graph, will invoke render() if not already rendered.
- render() : mixed
- Render the chart in memory.
- firstPass() : mixed
- The first pass of the graph.
- getLeftmost() : GraphNode
- Get left most node in the branch.
- layout() : mixed
- Handles the laying out of multi-branch trees.
- secondPass() : mixed
- The second pass of the graph.
- setNeighbours() : mixed
- 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
Return values
mixed —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) : mixed
Parameters
- $id : int
- $pid : int
- $message : string = ''
- $w : int
- $h : int
- $nodeColour : array<string|int, mixed>
- $URL : string
Tags
Return values
mixed —get()
Get the specified node from the graph.
public
get(int $id) : GraphNode
Parameters
- $id : int
Tags
Return values
GraphNode —getHeight()
Get the heith of the graph, will invoke render() if not already rendered.
public
getHeight() : mixed
Tags
Return values
mixed —getWidth()
Get the width of the graph, will invoke render() if not already rendered.
public
getWidth() : mixed
Tags
Return values
mixed —hasNext()
Check to see if another GraphNode instance in the graph is available.
public
hasNext() : bool
Tags
Return values
bool —next()
Get the next GraphNode instance in the graph, will invoke render() if not already rendered.
public
next() : GraphNode
Tags
Return values
GraphNode —render()
Render the chart in memory.
protected
render() : mixed
Tags
Return values
mixed —firstPass()
The first pass of the graph.
private
firstPass(GraphNode $node, int $level) : mixed
Parameters
- $node : GraphNode
- $level : int
Tags
Return values
mixed —getLeftmost()
Get left most node in the branch.
private
getLeftmost(GraphNode $node, int $level, int $maxlevel) : GraphNode
Parameters
- $node : GraphNode
- $level : int
- $maxlevel : int
Tags
Return values
GraphNode —layout()
Handles the laying out of multi-branch trees.
private
layout(GraphNode $node, int $level) : mixed
Parameters
- $node : GraphNode
- $level : int
Tags
Return values
mixed —secondPass()
The second pass of the graph.
private
secondPass(GraphNode $node, int $level, int $x, int $y) : mixed
Parameters
- $node : GraphNode
- $level : int
- $x : int
- $y : int
Tags
Return values
mixed —setNeighbours()
Setup neighbour nodes.
private
setNeighbours(GraphNode $node, int $level) : mixed
Parameters
- $node : GraphNode
- $level : int