Alpha Framework 3.1.0 API Documentation

TreeGraph

Maintains the geometry for a tree graph.

Tags
since
1.0
author

John Collins dev@alphaframework.org

license

http://www.opensource.org/licenses/bsd-license.php The BSD License

copyright

Copyright (c) 2018, John Collins (founder of Alpha Framework). All rights reserved.

Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the
following conditions are met:

* Redistributions of source code must retain the above
  copyright notice, this list of conditions and the
  following disclaimer.
* Redistributions in binary form must reproduce the above
  copyright notice, this list of conditions and the
  following disclaimer in the documentation and/or other
  materials provided with the distribution.
* Neither the name of the Alpha Framework nor the names
  of its contributors may be used to endorse or promote
  products derived from this software without specific
  prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

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
since
1.0

$colSpace

The amount of space between graph columns.

private int $colSpace
Tags
since
1.0

$height

The height of the graph.

private int $height = 0
Tags
since
1.0

$isRendered

Flag to track whether the chart is rendered or not.

private bool $isRendered = false
Tags
since
1.0

$logger

Trace logger.

private static Logger $logger = null
Tags
since
1.0

$nodes

An array of nodes in this graph.

private array<string|int, mixed> $nodes = array()
Tags
since
1.0

$position

The index of the current node in the graph we are inspecting.

private int $position = 0
Tags
since
1.0

$previousLevelNodes

An array of nodes on the previous level.

private array<string|int, mixed> $previousLevelNodes = array()
Tags
since
1.0

$rowSpace

The amount of space between graph rows.

private int $rowSpace
Tags
since
1.0

$width

The width of the graph.

private int $width = 0
Tags
since
1.0

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
since
1.0
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
since
1.0
Return values
mixed

get()

Get the specified node from the graph.

public get(int $id) : GraphNode
Parameters
$id : int
Tags
since
2.0.1
Return values
GraphNode

getHeight()

Get the heith of the graph, will invoke render() if not already rendered.

public getHeight() : mixed
Tags
since
1.0
Return values
mixed

getWidth()

Get the width of the graph, will invoke render() if not already rendered.

public getWidth() : mixed
Tags
since
1.0
Return values
mixed

hasNext()

Check to see if another GraphNode instance in the graph is available.

public hasNext() : bool
Tags
since
1.0
Return values
bool

next()

Get the next GraphNode instance in the graph, will invoke render() if not already rendered.

public next() : GraphNode
Tags
since
1.0
Return values
GraphNode

render()

Render the chart in memory.

protected render() : mixed
Tags
since
1.0
Return values
mixed

firstPass()

The first pass of the graph.

private firstPass(GraphNode $node, int $level) : mixed
Parameters
$node : GraphNode
$level : int
Tags
since
1.0
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
since
1.0
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
since
1.0
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
since
1.0
Return values
mixed

setNeighbours()

Setup neighbour nodes.

private setNeighbours(GraphNode $node, int $level) : mixed
Parameters
$node : GraphNode
$level : int
Tags
since
1.0
Return values
mixed

Search results