18 #ifndef __itkPreOrderTreeIterator_h
19 #define __itkPreOrderTreeIterator_h
25 template<
class TTreeType >
59 template<
class TTreeType >
65 template<
class TTreeType >
73 template<
class TTreeType >
77 if ( const_cast< TreeNodeType * >( FindNextNode() ) !=
NULL )
86 template<
class TTreeType >
90 this->m_Position =
const_cast< TreeNodeType *
>( FindNextNode() );
91 return this->m_Position->Get();
96 template<
class TTreeType >
100 if ( this->m_Position ==
NULL )
104 if ( this->m_Position->HasChildren() )
106 return dynamic_cast< const TreeNodeType *
>( this->m_Position->GetChild(0) );
110 if ( !this->m_Position->HasParent() )
119 if ( parent && parent->ChildPosition(this->m_Root) >= 0 )
124 int childPosition = parent->ChildPosition(child);
125 int lastChildPosition = parent->CountChildren() - 1;
127 while ( childPosition < lastChildPosition )
138 while ( parent->HasParent() )
141 parent =
dynamic_cast< TreeNodeType *
>( parent->GetParent() );
144 if ( parent->ChildPosition(this->m_Root) >= 0 )
149 childPosition = parent->ChildPosition(child);
150 lastChildPosition = parent->CountChildren() - 1;
152 while ( childPosition < lastChildPosition )
166 template<
class TTreeType >