Detailed Description

LayoutVisitor is used to position a tree of objects on a plane (the objects must implement the getParent()).

It uses a simple algorithm that positions the objects on a discrete array with distance 1 so that all leaves are equal distant from their neighbours. The positions are stored in a map that is provided by the getMap() method.

Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 25 of file LayoutVisitor.php.

+ Inheritance diagram for LayoutVisitor:

Public Member Functions

 __construct ()
 
 visit ($obj)
 
 getMap ()
 
 flip ()
 
- Public Member Functions inherited from Visitor
 startIterator (NodeIterator $iterator)
 
 startArray ($array)
 
 visit ($obj)
 
 doPreVisit ()
 
 doPostVisit ()
 

Public Attributes

const MAPTYPE_HORIZONTAL = 0
 
const MAPTYPE_VERTICAL = 1
 

Constructor & Destructor Documentation

__construct ( )

Constructor.

Definition at line 35 of file LayoutVisitor.php.

Member Function Documentation

visit (   $obj)

Visit the current object in iteration and position it on the map.

Parameters
$objPersistentObject instance

Definition at line 44 of file LayoutVisitor.php.

getMap ( )

Visit the current object in iteration and position it on the map.

Returns
The object map as assioziative array (key: object Id, value: Position). map["type"] = MAPTYPE_HORIZONTAL | MAPTYPE_VERTICAL

Definition at line 53 of file LayoutVisitor.php.

flip ( )

Flip layout (x <-> y).

Definition at line 60 of file LayoutVisitor.php.

Member Data Documentation

const MAPTYPE_HORIZONTAL = 0

Definition at line 27 of file LayoutVisitor.php.

const MAPTYPE_VERTICAL = 1

Definition at line 28 of file LayoutVisitor.php.