#ifndef __CPPLUGINS__INTERFACE__POINTLIST__HXX__ #define __CPPLUGINS__INTERFACE__POINTLIST__HXX__ #include #include #include // ------------------------------------------------------------------------- template< class P > void cpPlugins::Interface::PointList:: AddPoint( const P& p ) { typedef itk::SimpleDataObjectDecorator< std::vector< P > > _T; _T* container = NULL; if( this->m_NumberOfPoints == 0 ) { typename _T::Pointer obj = _T::New( ); container = obj.GetPointer( ); this->m_ITKObject = container; } else container = dynamic_cast< _T* >( this->m_ITKObject.GetPointer( ) ); if( container != NULL ) { container->Get( ).push_back( p ); this->m_NumberOfPoints += 1; } // fi } // ------------------------------------------------------------------------- template< class P > P cpPlugins::Interface::PointList:: GetPoint( const unsigned long& i ) const { typedef itk::SimpleDataObjectDecorator< std::vector< P > > _T; P ret; if( i < this->m_NumberOfPoints ) { _T* container = dynamic_cast< _T* >( this->m_ITKObject.GetPointer( ) ); if( container != NULL ) ret = container->Get( )[ i ]; } // fi return( ret ); } #endif // __CPPLUGINS__INTERFACE__POINTLIST__HXX__ // eof - $RCSfile$