Alpha Framework 4.0.0 API Documentation

GraphNode
in package

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

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

addChild()

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

public addChild(GraphNode $node) : void
Parameters
$node : GraphNode
Tags
throws
IllegalArguementException
since
1.0

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

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

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

getRightSibling()

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

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

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) : void
Parameters
$node : GraphNode
Tags
throws
IllegalArguementException
since
1.0

setMessage()

Set the node text message.

public setMessage(string $message) : void
Parameters
$message : string
Tags
since
1.0

setModifier()

Set the node modifier.

public setModifier(int $modifier) : void
Parameters
$modifier : int
Tags
since
1.0

setNodeColour()

Set the node colour array.

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

setOffset()

Set the node offset.

public setOffset(int $offset) : void
Parameters
$offset : int
Tags
since
1.0

setParentNode()

Set the parent node.

public setParentNode(GraphNode $node) : void
Parameters
$node : GraphNode
Tags
throws
IllegalArguementException
since
1.0

setRightSibling()

Sets the node to the right of this node.

public setRightSibling(GraphNode $node) : void
Parameters
$node : GraphNode
Tags
throws
IllegalArguementException
since
1.0

Sets up the array of connector endpoints.

public setUpLinks() : void
Tags
since
1.0

setURL()

Set the node URL.

public setURL(string $URL) : void
Parameters
$URL : string
Tags
since
1.0

setX()

Sets the node X-coordinate.

public setX(int $x) : void
Parameters
$x : int
Tags
since
1.0

setY()

Sets the node Y-coordinate.

public setY(int $y) : void
Parameters
$y : int
Tags
since
1.0

        
On this page

Search results