]> Creatis software - FrontAlgorithms.git/blobdiff - lib/fpa/Base/RegionGrowWithMultipleCriteria.hxx
Plugins updated
[FrontAlgorithms.git] / lib / fpa / Base / RegionGrowWithMultipleCriteria.hxx
index 34420b24ad029a8e3164486082e632def436e652..0fd4378c5fbabef49d5cd827d25e44bcfcd927d6 100644 (file)
@@ -45,25 +45,46 @@ fpa::Base::RegionGrowWithMultipleCriteria< V, R, VV, VC, B >::
 // -------------------------------------------------------------------------
 template< class V, class R, class VV, class VC, class B >
 void fpa::Base::RegionGrowWithMultipleCriteria< V, R, VV, VC, B >::
-_BeforeLoop( )
+_BeforeMainLoop( )
 {
-  this->_BeforeLoop( );
+  this->Superclass::_BeforeMainLoop( );
   this->m_ActualFunction = this->m_Functions.begin( );
 }
 
 // -------------------------------------------------------------------------
 template< class V, class R, class VV, class VC, class B >
-typename fpa::Base::RegionGrowWithMultipleCriteria< V, R, VV, VC, B >::
-_TNode fpa::Base::RegionGrowWithMultipleCriteria< V, R, VV, VC, B >::
-_QueuePop( )
+void fpa::Base::RegionGrowWithMultipleCriteria< V, R, VV, VC, B >::
+_AfterLoop( )
 {
-  _TNode node = this->Superclass::_QueuePop( );
-  if( this->_IsQueueEmpty( ) )
+  this->Superclass::_AfterLoop( );
+
+  // Replace queue
+  this->_QueueClear( );
+  while( !( this->m_AuxiliaryQueue.empty( ) ) )
   {
-    std::cerr << "ERROR!!!!" << std::endl;
+    // Get node
+    _TNode node = this->m_AuxiliaryQueue.front( );
+    this->m_AuxiliaryQueue.pop( );
+    this->_QueuePush( node );
+
+    // Unmark it
+    typename _TMarks::iterator mIt = this->m_Marks.find( node.Vertex );
+    if( mIt != this->m_Marks.end( ) )
+      this->m_Marks.erase( mIt );
+    
+  } // elihw
+
+  // Move to next function
+  this->m_ActualFunction++;
+}
 
-  } // fi
-  return( node );
+// -------------------------------------------------------------------------
+template< class V, class R, class VV, class VC, class B >
+void fpa::Base::RegionGrowWithMultipleCriteria< V, R, VV, VC, B >::
+_Loop( )
+{
+  while( this->m_ActualFunction != this->m_Functions.end( ) )
+    this->Superclass::_Loop( );
 }
 
 // -------------------------------------------------------------------------
@@ -71,10 +92,15 @@ template< class V, class R, class VV, class VC, class B >
 bool fpa::Base::RegionGrowWithMultipleCriteria< V, R, VV, VC, B >::
 _CheckMembership( const _TNode& n ) const
 {
-  bool ret = ( *( this->m_ActualFunction ) )->Evaluate( n.Vertex );
-  if( !ret )
-    this->m_AuxiliaryQueue.push( n );
-  return( ret );
+  if( this->m_ActualFunction != this->m_Functions.end( ) )
+  {
+    bool ret = ( *( this->m_ActualFunction ) )->Evaluate( n.Vertex );
+    if( !ret )
+      this->m_AuxiliaryQueue.push( n );
+    return( ret );
+  }
+  else
+    return( false );
 }
 
 #endif // __FPA__BASE__REGIONGROWWITHMULTIPLECRITERIA__HXX__