Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Compound Members  

LayoutVisitor Class Template Reference

The LayoutVisitor is used to position the tree nodes on a plane. More...

#include <nodeprint.h>

Inheritance diagram for LayoutVisitor:

Inheritance graph
[legend]
Collaboration diagram for LayoutVisitor:

Collaboration graph
[legend]
List of all members.

Public Types

typedef LayoutVisitor< _TContent,
_TIter > 
_Self
typedef NodeVisitor< typename
_TIter::const_iterator, const
Node< _TContent >, const NormalNode<
_TContent >, const RootNode<
_TContent > > 
_Base

Public Methods

virtual _Selfconstruct () const
virtual _Selfclone () const
virtual ~LayoutVisitor ()
virtual void operator() (_TIter &iter)
 Start the layout process.

virtual void visitNormalNode (const NormalNode< _TContent > *node)
 Take a NormalNode and put it in the list.

virtual void visitRootNode (const RootNode< _TContent > *node)
 Take a RootNode and put its subtree in the list.

virtual std::map< const Node<
_TContent > *, Position
getMap () const

Protected Methods

void addNode (const Node< _TContent > *node, Position pos)
 Take a Node and put it in the list.

Position calculatePosition (const Node< _TContent > *node)
 Calculate node position using the described algorithm.


Protected Attributes

std::map< const Node< _TContent > *,
Position
m_map

Detailed Description

template<class _TContent, class _TIter>
class treecomp::LayoutVisitor< _TContent, _TIter >

The LayoutVisitor is used to position the tree nodes on a plane.

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

Yes, that is not the best layout algorithm... If anyone needs a better one, you might convince me to backport the better one I have ;-)

Definition at line 57 of file nodeprint.h.


Member Typedef Documentation

typedef NodeVisitor<typename _TIter::const_iterator, const Node<_TContent>, const NormalNode<_TContent>,const RootNode<_TContent> > _Base
 

Reimplemented from NodeVisitor< _TIter::const_iterator, const Node< _TContent >, const NormalNode< _TContent >, const RootNode< _TContent > >.

Definition at line 65 of file nodeprint.h.

typedef LayoutVisitor<_TContent,_TIter> _Self
 

Reimplemented from NodeVisitor< _TIter::const_iterator, const Node< _TContent >, const NormalNode< _TContent >, const RootNode< _TContent > >.

Definition at line 62 of file nodeprint.h.

Referenced by LayoutVisitor::clone(), and LayoutVisitor::construct().


Constructor & Destructor Documentation

virtual ~LayoutVisitor   [inline, virtual]
 

Definition at line 69 of file nodeprint.h.


Member Function Documentation

void addNode const Node< _TContent > *    node,
Position    position
[protected]
 

Take a Node and put it in the list.

Parameters:
node  The Node to add

Definition at line 171 of file nodeprint.h.

References LayoutVisitor::m_map.

Referenced by LayoutVisitor::visitNormalNode(), and LayoutVisitor::visitRootNode().

Position calculatePosition const Node< _TContent > *    node [protected]
 

Calculate node position using the described algorithm.

Parameters:
node  The Node to calculate the position for

Definition at line 181 of file nodeprint.h.

References Node::beginAll(), Node::endAll(), Node::getChildren(), Node::getParent(), LayoutVisitor::m_map, Position::x, and Position::y.

Referenced by LayoutVisitor::visitNormalNode(), and LayoutVisitor::visitRootNode().

virtual _Self* clone   const [inline, virtual]
 

Definition at line 68 of file nodeprint.h.

References LayoutVisitor::_Self.

virtual _Self* construct   const [inline, virtual]
 

Definition at line 67 of file nodeprint.h.

References LayoutVisitor::_Self.

virtual std::map<const Node<_TContent>*, Position> getMap   const [inline, virtual]
 

Definition at line 75 of file nodeprint.h.

References LayoutVisitor::m_map.

void operator() _TIter &    iter [virtual]
 

Start the layout process.

Parameters:
iter  The NodeIterator that iterates over all nodes to visit

Definition at line 139 of file nodeprint.h.

References NodeVisitor< _TIter::const_iterator, const Node< _TContent >, const NormalNode< _TContent >, const RootNode< _TContent > >::init(), NodeVisitor< _TIter::const_iterator, const Node< _TContent >, const NormalNode< _TContent >, const RootNode< _TContent > >::iterate(), and LayoutVisitor::m_map.

void visitNormalNode const NormalNode< _TContent > *    node [virtual]
 

Take a NormalNode and put it in the list.

Parameters:
node  The NormalNode to visit

Implements NodeVisitor< _TIter::const_iterator, const Node< _TContent >, const NormalNode< _TContent >, const RootNode< _TContent > >.

Definition at line 151 of file nodeprint.h.

References LayoutVisitor::addNode(), and LayoutVisitor::calculatePosition().

void visitRootNode const RootNode< _TContent > *    node [virtual]
 

Take a RootNode and put its subtree in the list.

Parameters:
node  The RootNode to visit

Implements NodeVisitor< _TIter::const_iterator, const Node< _TContent >, const NormalNode< _TContent >, const RootNode< _TContent > >.

Definition at line 161 of file nodeprint.h.

References LayoutVisitor::addNode(), and LayoutVisitor::calculatePosition().


Member Data Documentation

std::map<const Node<_TContent>*, Position> m_map [protected]
 

Definition at line 81 of file nodeprint.h.

Referenced by LayoutVisitor::addNode(), LayoutVisitor::calculatePosition(), LayoutVisitor::getMap(), and LayoutVisitor::operator()().


The documentation for this class was generated from the following file:
Generated on Mon Jan 6 12:02:20 2003 for TreeComp by doxygen1.2.17