Alpha Framework 3.1.0 API Documentation

GraphNode

Maintains the geometry for a tree node.

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

$children  : array<string|int, mixed>
An array of child nodes of this node.
$height  : int
The height of the node.
$id  : int
The id of the node.
$leftNode  : GraphNode
The node to the left of this one.
$links  : array<string|int, mixed>
A 2D array of the coordinates of the endpoints for connectots on this node.
$message  : string
The text message to display on the node.
$modifier  : int
Optional positional modifier.
$nodeColour  : array<string|int, mixed>
An array containing the R,G,B values for the colour of this node.
$offset  : int
The margin offset of the current node.
$parentNode  : GraphNode
Parent node of this node (if any).
$rightNode  : GraphNode
The node to the right of this one.
$URL  : string
If the node is clickable in an image map, use this property to hold the target URL.
$width  : int
The width of the node.
$x  : int
The x position of the node.
$y  : int
The y position of the node.
__construct()  : mixed
Constructor.
addChild()  : mixed
Add a new node to the children array of this node.
childCount()  : int
Get the number of child nodes attached to this node.
getChildAt()  : mixed
Gets the child node at the index provided, or returns false if none is found.
getChildren()  : array<string|int, mixed>
Returns the array of child GraphNode objects.
getChildrenCenter()  : float
Calculates and returns the midpoint X coordinate of the children of this node.
getHeight()  : int
Returns the node height.
getID()  : int
Returns the node ID.
getLeftSibling()  : GraphNode
Get the node to the left of this one (if any).
getLinks()  : array<string|int, mixed>
Returns the links array.
getMessage()  : string
Get the node text message.
getModifier()  : int
Get the node modifier.
getNodeColour()  : array<string|int, mixed>
Get the node colour array.
getOffset()  : int
Get the node offset.
getParentNode()  : GraphNode
Get the parent node of this node (if any).
getRightSibling()  : GraphNode
Get the node to the right of this one (if any).
getURL()  : string
Get the node URL.
getWidth()  : int
Returns the node width.
getX()  : int
Returns the node X-coordinate.
getY()  : int
Returns the node Y-coordinate.
setLeftSibling()  : mixed
Sets the node to the left of this node.
setMessage()  : mixed
Set the node text message.
setModifier()  : mixed
Set the node modifier.
setNodeColour()  : mixed
Set the node colour array.
setOffset()  : mixed
Set the node offset.
setParentNode()  : mixed
Set the parent node.
setRightSibling()  : mixed
Sets the node to the right of this node.
setUpLinks()  : mixed
Sets up the array of connector endpoints.
setURL()  : mixed
Set the node URL.
setX()  : mixed
Sets the node X-coordinate.
setY()  : mixed
Sets the node Y-coordinate.

Properties

$children

An array of child nodes of this node.

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

$height

The height of the node.

private int $height = 0
Tags
since
1.0

$id

The id of the node.

private int $id = 0
Tags
since
1.0

$leftNode

The node to the left of this one.

private GraphNode $leftNode
Tags
since
1.0

A 2D array of the coordinates of the endpoints for connectots on this node.

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

$message

The text message to display on the node.

private string $message
Tags
since
1.0

$modifier

Optional positional modifier.

private int $modifier = 0
Tags
since
1.0

$nodeColour

An array containing the R,G,B values for the colour of this node.

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

$offset

The margin offset of the current node.

private int $offset = 0
Tags
since
1.0

$parentNode

Parent node of this node (if any).

private GraphNode $parentNode
Tags
since
1.0

$rightNode

The node to the right of this one.

private GraphNode $rightNode
Tags
since
1.0

$URL

If the node is clickable in an image map, use this property to hold the target URL.

private string $URL
Tags
since
1.0

$width

The width of the node.

private int $width = 0
Tags
since
1.0

$x

The x position of the node.

private int $x = 0
Tags
since
1.0

$y

The y position of the node.

private int $y = 0
Tags
since
1.0

Methods

__construct()

Constructor.

public __construct(int $id, int $width, int $height[, string $message = '' ][, array<string|int, mixed> $nodeColour = array() ][, string $URL = null ]) : mixed
Parameters
$id : int
$width : int
$height : int
$message : string = ''
$nodeColour : array<string|int, mixed> = array()
$URL : string = null
Return values
mixed

addChild()

Add a new node to the children array of this node.

public addChild(GraphNode $node) : mixed
Parameters
$node : GraphNode
Tags
throws
IllegalArguementException
since
1.0
Return values
mixed

childCount()

Get the number of child nodes attached to this node.

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

getChildAt()

Gets the child node at the index provided, or returns false if none is found.

public getChildAt(int $i) : mixed
Parameters
$i : int
Tags
since
1.0
Return values
mixed

getChildren()

Returns the array of child GraphNode objects.

public getChildren() : array<string|int, mixed>
Tags
since
1.0
Return values
array<string|int, mixed>

getChildrenCenter()

Calculates and returns the midpoint X coordinate of the children of this node.

public getChildrenCenter() : float
Tags
since
1.0
Return values
float

getHeight()

Returns the node height.

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

getID()

Returns the node ID.

public getID() : int
Tags
since
3.1
Return values
int

getLeftSibling()

Get the node to the left of this one (if any).

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

Returns the links array.

public getLinks() : array<string|int, mixed>
Tags
since
1.0
Return values
array<string|int, mixed>

getMessage()

Get the node text message.

public getMessage() : string
Tags
since
1.0
Return values
string

getModifier()

Get the node modifier.

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

getNodeColour()

Get the node colour array.

public getNodeColour() : array<string|int, mixed>
Tags
since
1.0
Return values
array<string|int, mixed>

getOffset()

Get the node offset.

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

getParentNode()

Get the parent node of this node (if any).

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

getRightSibling()

Get the node to the right of this one (if any).

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

getURL()

Get the node URL.

public getURL() : string
Tags
since
1.0
Return values
string

getWidth()

Returns the node width.

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

getX()

Returns the node X-coordinate.

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

getY()

Returns the node Y-coordinate.

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

setLeftSibling()

Sets the node to the left of this node.

public setLeftSibling(GraphNode $node) : mixed
Parameters
$node : GraphNode
Tags
throws
IllegalArguementException
since
1.0
Return values
mixed

setMessage()

Set the node text message.

public setMessage(string $message) : mixed
Parameters
$message : string
Tags
since
1.0
Return values
mixed

setModifier()

Set the node modifier.

public setModifier(int $modifier) : mixed
Parameters
$modifier : int
Tags
since
1.0
Return values
mixed

setNodeColour()

Set the node colour array.

public setNodeColour(array<string|int, mixed> $nodeColour) : mixed
Parameters
$nodeColour : array<string|int, mixed>
Tags
throws
IllegalArguementException
since
1.0
Return values
mixed

setOffset()

Set the node offset.

public setOffset(int $offset) : mixed
Parameters
$offset : int
Tags
since
1.0
Return values
mixed

setParentNode()

Set the parent node.

public setParentNode(GraphNode $node) : mixed
Parameters
$node : GraphNode
Tags
throws
IllegalArguementException
since
1.0
Return values
mixed

setRightSibling()

Sets the node to the right of this node.

public setRightSibling(GraphNode $node) : mixed
Parameters
$node : GraphNode
Tags
throws
IllegalArguementException
since
1.0
Return values
mixed

Sets up the array of connector endpoints.

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

setURL()

Set the node URL.

public setURL(string $URL) : mixed
Parameters
$URL : string
Tags
since
1.0
Return values
mixed

setX()

Sets the node X-coordinate.

public setX(int $x) : mixed
Parameters
$x : int
Tags
since
1.0
Return values
mixed

setY()

Sets the node Y-coordinate.

public setY(int $y) : mixed
Parameters
$y : int
Tags
since
1.0
Return values
mixed

Search results