GraphNode
in package
Maintains the geometry for a tree node.
Tags
Table of Contents
Properties
- $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.
Methods
- __construct() : mixed
- Constructor.
- addChild() : void
- 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|null
- 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|null
- 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() : void
- Sets the node to the left of this node.
- setMessage() : void
- Set the node text message.
- setModifier() : void
- Set the node modifier.
- setNodeColour() : void
- Set the node colour array.
- setOffset() : void
- Set the node offset.
- setParentNode() : void
- Set the parent node.
- setRightSibling() : void
- Sets the node to the right of this node.
- setUpLinks() : void
- Sets up the array of connector endpoints.
- setURL() : void
- Set the node URL.
- setX() : void
- Sets the node X-coordinate.
- setY() : void
- Sets the node Y-coordinate.
Properties
$children
An array of child nodes of this node.
private
array<string|int, mixed>
$children
= array()
Tags
$height
The height of the node.
private
int
$height
= 0
Tags
$id
The id of the node.
private
int
$id
= 0
Tags
$leftNode
The node to the left of this one.
private
GraphNode
$leftNode
Tags
$links
A 2D array of the coordinates of the endpoints for connectots on this node.
private
array<string|int, mixed>
$links
= array()
Tags
$message
The text message to display on the node.
private
string
$message
Tags
$modifier
Optional positional modifier.
private
int
$modifier
= 0
Tags
$nodeColour
An array containing the R,G,B values for the colour of this node.
private
array<string|int, mixed>
$nodeColour
= array()
Tags
$offset
The margin offset of the current node.
private
int
$offset
= 0
Tags
$parentNode
Parent node of this node (if any).
private
GraphNode
$parentNode
Tags
$rightNode
The node to the right of this one.
private
GraphNode
$rightNode
Tags
$URL
If the node is clickable in an image map, use this property to hold the target URL.
private
string
$URL
Tags
$width
The width of the node.
private
int
$width
= 0
Tags
$x
The x position of the node.
private
int
$x
= 0
Tags
$y
The y position of the node.
private
int
$y
= 0
Tags
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
addChild()
Add a new node to the children array of this node.
public
addChild(GraphNode $node) : void
Parameters
- $node : GraphNode
Tags
childCount()
Get the number of child nodes attached to this node.
public
childCount() : int
Tags
Return values
intgetChildAt()
Gets the child node at the index provided, or returns false if none is found.
public
getChildAt(int $i) : mixed
Parameters
- $i : int
Tags
getChildren()
Returns the array of child GraphNode objects.
public
getChildren() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getChildrenCenter()
Calculates and returns the midpoint X coordinate of the children of this node.
public
getChildrenCenter() : float
Tags
Return values
floatgetHeight()
Returns the node height.
public
getHeight() : int
Tags
Return values
intgetID()
Returns the node ID.
public
getID() : int
Tags
Return values
intgetLeftSibling()
Get the node to the left of this one (if any).
public
getLeftSibling() : GraphNode|null
Tags
Return values
GraphNode|nullgetLinks()
Returns the links array.
public
getLinks() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getMessage()
Get the node text message.
public
getMessage() : string
Tags
Return values
stringgetModifier()
Get the node modifier.
public
getModifier() : int
Tags
Return values
intgetNodeColour()
Get the node colour array.
public
getNodeColour() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getOffset()
Get the node offset.
public
getOffset() : int
Tags
Return values
intgetParentNode()
Get the parent node of this node (if any).
public
getParentNode() : GraphNode
Tags
Return values
GraphNodegetRightSibling()
Get the node to the right of this one (if any).
public
getRightSibling() : GraphNode|null
Tags
Return values
GraphNode|nullgetURL()
Get the node URL.
public
getURL() : string
Tags
Return values
stringgetWidth()
Returns the node width.
public
getWidth() : int
Tags
Return values
intgetX()
Returns the node X-coordinate.
public
getX() : int
Tags
Return values
intgetY()
Returns the node Y-coordinate.
public
getY() : int
Tags
Return values
intsetLeftSibling()
Sets the node to the left of this node.
public
setLeftSibling(GraphNode $node) : void
Parameters
- $node : GraphNode
Tags
setMessage()
Set the node text message.
public
setMessage(string $message) : void
Parameters
- $message : string
Tags
setModifier()
Set the node modifier.
public
setModifier(int $modifier) : void
Parameters
- $modifier : int
Tags
setNodeColour()
Set the node colour array.
public
setNodeColour(array<string|int, mixed> $nodeColour) : void
Parameters
- $nodeColour : array<string|int, mixed>
Tags
setOffset()
Set the node offset.
public
setOffset(int $offset) : void
Parameters
- $offset : int
Tags
setParentNode()
Set the parent node.
public
setParentNode(GraphNode $node) : void
Parameters
- $node : GraphNode
Tags
setRightSibling()
Sets the node to the right of this node.
public
setRightSibling(GraphNode $node) : void
Parameters
- $node : GraphNode
Tags
setUpLinks()
Sets up the array of connector endpoints.
public
setUpLinks() : void
Tags
setURL()
Set the node URL.
public
setURL(string $URL) : void
Parameters
- $URL : string
Tags
setX()
Sets the node X-coordinate.
public
setX(int $x) : void
Parameters
- $x : int
Tags
setY()
Sets the node Y-coordinate.
public
setY(int $y) : void
Parameters
- $y : int