# Class AlphaTreeGraph

Maintains the geometry for a tree graph

Package: alpha::util::graphs
Copyright: Copyright (c) 2012, 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.

License: The BSD License
Author: John Collins <dev@alphaframework.org>
Version: $Id: AlphaTreeGraph.inc 1496 2012-02-12 20:32:21Z alphadev $
Since: 1.0
Located at util/graphs/AlphaTreeGraph.inc

Methods summary
`public` | # `__construct( integer $rowSpace = 40 , integer $colSpace = 40, integer $branchSpace = 80 )` Constructor Constructor #### Parameters $rowSpace `integer` $rowSpace $colSpace `integer` $colSpace $branchSpace `integer` $branchSpace #### Since 1.0
`public` | # `add( integer $id, integer $pid, string $message = '', integer $w = 0, integer $h = 0, string $nodeColour, string $URL )` Add a new node to the graph Add a new node to the graph #### Parameters $id `integer` $id $pid `integer` $pid $message `string` $message $w `integer` $w $h `integer` $h $nodeColour `string` $nodeColour $URL `string` $URL #### Since 1.0
`private` | # `firstPass( `AlphaGraphNode` $node, integer $level )` The first pass of the graph The first pass of the graph #### Parameters $node ``AlphaGraphNode`` $node $level `integer` $level #### Since 1.0
`private` | # `secondPass( `AlphaGraphNode` $node, integer $level, integer $x = 0, integer $y = 0 )` The second pass of the graph The second pass of the graph #### Parameters $node ``AlphaGraphNode`` $node $level `integer` $level $x `integer` $x $y `integer` $y #### Since 1.0
`private` | # `layout( `AlphaGraphNode` $node, integer $level )` Handles the laying out of multi-branch trees Handles the laying out of multi-branch trees #### Parameters $node ``AlphaGraphNode`` $node $level `integer` $level #### Since 1.0
`private` | # `setNeighbours( `AlphaGraphNode` $node, integer $level )` Setup neighbour nodes Setup neighbour nodes #### Parameters $node ``AlphaGraphNode`` $node $level `integer` $level #### Since 1.0
`private `AlphaGraphNode`` | # `getLeftmost( `AlphaGraphNode` $node, integer $level, integer $maxlevel )` Get left most node in the branch Get left most node in the branch #### Parameters $node ``AlphaGraphNode`` $node $level `integer` $level $maxlevel `integer` $maxlevel #### Returns ``AlphaGraphNode`` #### Since 1.0
`protected` | # `render( )` Render the chart in memory Render the chart in memory #### Since 1.0
`public` | # `getWidth( )` Get the width of the graph, will invoke render() if not already rendered Get the width of the graph, will invoke render() if not already rendered #### Since 1.0
`public` | # `getHeight( )` Get the heith of the graph, will invoke render() if not already rendered Get the heith of the graph, will invoke render() if not already rendered #### Since 1.0
`public `AlphaGraphNode`` | # `next( )` Get the next AlphaGraphNode instance in the graph, will invoke render() if not already rendered Get the next AlphaGraphNode instance in the graph, will invoke render() if not already rendered #### Returns ``AlphaGraphNode`` #### Since 1.0
`public boolean` | # `hasNext( )` Check to see if another AlphaGraphNode instance in the graph is available Check to see if another AlphaGraphNode instance in the graph is available #### Returns `boolean` #### Since 1.0

Properties summary
`private array` | $previousLevelNodes | `array()` | # An array of nodes on the previous level An array of nodes on the previous level #### Since 1.0
`private array` | $nodes | `array()` | # An array of nodes in this graph An array of nodes in this graph #### Since 1.0
`private `AlphaGraphNode`` | $root | `` | # The root node of the graph The root node of the graph #### Since 1.0
`private integer` | $rowSpace | `` | # The amount of space between graph rows The amount of space between graph rows #### Since 1.0
`private integer` | $colSpace | `` | # The amount of space between graph columns The amount of space between graph columns #### Since 1.0
`private integer` | $branchSpace | `` | # The amount of space between graph branches The amount of space between graph branches #### Since 1.0
`private boolean` | $isRendered | `false` | # Flag to track whether the chart is rendered or not Flag to track whether the chart is rendered or not #### Since 1.0
`private integer` | $position | `0` | # The index of the current node in the graph we are inspecting The index of the current node in the graph we are inspecting #### Since 1.0
`private integer` | $height | `0` | # The height of the graph The height of the graph #### Since 1.0
`private integer` | $width | `0` | # The width of the graph The width of the graph #### Since 1.0
`private static `Logger`` | $logger | `null` | # Trace logger Trace logger #### Since 1.0