]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Mesh.cxx
...
[cpPlugins.git] / lib / cpPlugins / Mesh.cxx
index 76bde83298cd9161ff3a8e9925e954db02a0b03e..216f3b3ac9cf61b4300789d920d2cb3c21d6dfa0 100644 (file)
@@ -1,7 +1,6 @@
 #include <cpPlugins/Mesh.h>
 
 #include <itkMesh.h>
-#include <itkQuadEdgeMesh.h>
 #include <itkLineCell.h>
 #include <itkTriangleCell.h>
 #include <itkPolygonCell.h>
@@ -17,10 +16,6 @@ SetITK( itk::LightObject* o )
   if( !r ) r = this->_ITK_2_VTK< itk::Mesh< double, 2 > >( o );
   if( !r ) r = this->_ITK_2_VTK< itk::Mesh< float, 3 > >( o );
   if( !r ) r = this->_ITK_2_VTK< itk::Mesh< double, 3 > >( o );
-  if( !r ) r = this->_ITK_2_VTK< itk::QuadEdgeMesh< float, 2 > >( o );
-  if( !r ) r = this->_ITK_2_VTK< itk::QuadEdgeMesh< double, 2 > >( o );
-  if( !r ) r = this->_ITK_2_VTK< itk::QuadEdgeMesh< float, 3 > >( o );
-  if( !r ) r = this->_ITK_2_VTK< itk::QuadEdgeMesh< double, 3 > >( o );
 }
 
 // -------------------------------------------------------------------------
@@ -48,54 +43,50 @@ SetVTK( vtkObjectBase* o )
     this->m_VTKObject = mesh;
 
     // Copy points
-    /* TODO
-       _TMesh::Pointer imesh = _TMesh::New( );
-       double point[ 3 ];
-       for( long i = 0; i < mesh->GetNumberOfPoints( ); ++i )
-       {
-       mesh->GetPoint( i, point );
-       _TMesh::PointType ipoint;
-       ipoint[ 0 ] = point[ 0 ];
-       ipoint[ 1 ] = point[ 1 ];
-       ipoint[ 2 ] = point[ 2 ];
-       imesh->SetPoint( i, ipoint );
-
-       } // rof
-
-       // Copy cells
-       for( long i = 0; i < mesh->GetNumberOfCells( ); ++i )
-       {
-       auto cell = mesh->GetCell( i );
-       long nPoints = cell->GetNumberOfPoints( );
-       _TCellAutoPointer icell;
-       if( nPoints == 2 )
-       {
-       icell.TakeOwnership( new _TLine );
-       icell->SetPointId( 0, cell->GetPointId( 0 ) );
-       icell->SetPointId( 1, cell->GetPointId( 1 ) );
-       }
-       else if( nPoints == 3 )
-       {
-       icell.TakeOwnership( new _TTriangle );
-       icell->SetPointId( 0, cell->GetPointId( 0 ) );
-       icell->SetPointId( 1, cell->GetPointId( 1 ) );
-       icell->SetPointId( 2, cell->GetPointId( 2 ) );
-       }
-       else if( nPoints > 3 )
-       {
-       _TPolygon* polygon = new _TPolygon( );
-       for( long j = 0; j < nPoints; ++j )
-       polygon->AddPointId( cell->GetPointId( j ) );
-       icell.TakeOwnership( polygon );
-
-       } // fi
-       imesh->SetCell( imesh->GetNumberOfCells( ), icell );
-
-       } // rof
-
-       this->m_ITKObject = imesh;
-    */
-    this->m_ITKObject = NULL; // TODO: replace this
+    _TMesh::Pointer imesh = _TMesh::New( );
+    double point[ 3 ];
+    for( long i = 0; i < mesh->GetNumberOfPoints( ); ++i )
+    {
+      mesh->GetPoint( i, point );
+      _TMesh::PointType ipoint;
+      ipoint[ 0 ] = point[ 0 ];
+      ipoint[ 1 ] = point[ 1 ];
+      ipoint[ 2 ] = point[ 2 ];
+      imesh->SetPoint( i, ipoint );
+
+    } // rof
+
+    // Copy cells
+    for( long i = 0; i < mesh->GetNumberOfCells( ); ++i )
+    {
+      auto cell = mesh->GetCell( i );
+      long nPoints = cell->GetNumberOfPoints( );
+      _TCellAutoPointer icell;
+      if( nPoints == 2 )
+      {
+        icell.TakeOwnership( new _TLine );
+        icell->SetPointId( 0, cell->GetPointId( 0 ) );
+        icell->SetPointId( 1, cell->GetPointId( 1 ) );
+      }
+      else if( nPoints == 3 )
+      {
+        icell.TakeOwnership( new _TTriangle );
+        icell->SetPointId( 0, cell->GetPointId( 0 ) );
+        icell->SetPointId( 1, cell->GetPointId( 1 ) );
+        icell->SetPointId( 2, cell->GetPointId( 2 ) );
+      }
+      else if( nPoints > 3 )
+      {
+        _TPolygon* polygon = new _TPolygon( );
+        for( long j = 0; j < nPoints; ++j )
+          polygon->AddPointId( cell->GetPointId( j ) );
+        icell.TakeOwnership( polygon );
+
+      } // fi
+      imesh->SetCell( imesh->GetNumberOfCells( ), icell );
+
+    } // rof
+    this->m_ITKObject = imesh;
     this->Modified( );
 
   } // fi