Alpha Framework 4.0.0 API Documentation

TreeGraph
in package

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) 2021, 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

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

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

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() : int
Tags
since
1.0
Return values
int

getWidth()

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

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

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|null
Tags
since
1.0
Return values
GraphNode|null

render()

Render the chart in memory.

protected render() : void
Tags
since
1.0

firstPass()

The first pass of the graph.

private firstPass(GraphNode $node, int $level) : void
Parameters
$node : GraphNode
$level : int
Tags
since
1.0

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

layout()

Handles the laying out of multi-branch trees.

private layout(GraphNode $node, int $level) : void
Parameters
$node : GraphNode
$level : int
Tags
since
1.0

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

setNeighbours()

Setup neighbour nodes.

private setNeighbours(GraphNode $node, int $level) : void
Parameters
$node : GraphNode
$level : int
Tags
since
1.0

        
On this page

Search results