]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/DataObjects/BoundingBox.h
...
[cpPlugins.git] / lib / cpPlugins / DataObjects / BoundingBox.h
index 3d112728801128bc3e1e3308353761417bc21185..9ee33cc02c45c5c2cca108ec29e27b63a97cdcbf 100644 (file)
@@ -29,23 +29,33 @@ namespace cpPlugins
 
     public:
       void SetDataObject( DataObject* o );
-      virtual void SetITK( itk::LightObject* o ) cpPlugins_OVERRIDE;
-      virtual void SetVTK( vtkObjectBase* o ) cpPlugins_OVERRIDE;
 
       void Copy( Self* other );
       void Blend( Self* other );
 
       template< class _TPoint >
-        inline void SetMinimum( const _TPoint& p );
+      inline void SetMinimum( const _TPoint& p )
+        {
+          this->_SetPoint( 0, p );
+        }
 
       template< class _TPoint >
-        inline void SetMaximum( const _TPoint& p );
+      inline void SetMaximum( const _TPoint& p )
+        {
+          this->_SetPoint( 1, p );
+        }
 
       template< class _TPoint >
-        inline _TPoint GetMinimum( ) const;
+      inline _TPoint GetMinimum( ) const
+        {
+          return( this->_GetPoint< _TPoint >( 0 ) );
+        }
 
       template< class _TPoint >
-        inline _TPoint GetMaximum( ) const;
+      inline _TPoint GetMaximum( ) const
+        {
+          return( this->_GetPoint< _TPoint >( 1 ) );
+        }
 
     protected:
       BoundingBox( );
@@ -54,16 +64,27 @@ namespace cpPlugins
       void _UpdateVTK( );
 
       template< class _TPoint >
-        inline void _SetPoint( unsigned int m, const _TPoint& p );
+      inline void _SetPoint( unsigned int m, const _TPoint& p )
+        {
+          this->m_Points[ m ].clear( );
+          for( unsigned int d = 0; d < _TPoint::PointDimension; ++d )
+            this->m_Points[ m ].push_back( double( p[ d ] ) );
+          this->_UpdateVTK( );
+          this->Modified( );
+        }
 
       template< class _TPoint >
-        inline _TPoint _GetPoint( unsigned int m ) const;
-
-      template< unsigned int _NDim >
-        inline bool _ITKImage( itk::LightObject* o );
-
-      template< class _TScalar, unsigned int _NDim >
-        inline bool _ITKPointSet( itk::LightObject* o );
+      inline _TPoint _GetPoint( unsigned int m ) const
+        {
+          unsigned int dim = this->m_Points[ m ].size( );
+          dim =
+            ( _TPoint::PointDimension < dim )? _TPoint::PointDimension: dim;
+          _TPoint p;
+          p.Fill( 0 );
+          for( unsigned int d = 0; d < dim; ++d )
+            p[ d ] = this->m_Points[ m ][ d ];
+          return( p );
+        }
 
     private:
       // Purposely not implemented
@@ -79,7 +100,7 @@ namespace cpPlugins
 
 } // ecapseman
 
-#include <cpPlugins/DataObjects/BoundingBox.hxx>
+// #include <cpPlugins/DataObjects/BoundingBox.hxx>
 
 #endif // __cpPlugins__DataObjects__BoundingBox__h__